~ubuntu-branches/ubuntu/wily/libpreludedb/wily-proposed

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
AC_INIT
AC_CONFIG_SRCDIR([src])
AC_PREREQ(2.59)
AC_CANONICAL_HOST
AC_CANONICAL_TARGET


dnl **********************************************************
dnl * Version and release information
dnl **********************************************************

libpreludedb_major=1
libpreludedb_minor=0
libpreludedb_micro=0
libpreludedb_patchlevel=
libpreludedb_version=$libpreludedb_major.$libpreludedb_minor.$libpreludedb_micro$libpreludedb_patchlevel


dnl **********************************************************
dnl * Library soname (http://sources.redhat.com/autobook/autobook/autobook_91.html#SEC91)
dnl **********************************************************
libpreludedb_current=4
libpreludedb_revision=10
libpreludedb_age=4
LIBPRELUDEDB_SONAME=$libpreludedb_current:$libpreludedb_revision:$libpreludedb_age


AM_INIT_AUTOMAKE(libpreludedb, $libpreludedb_version)
AC_CONFIG_HEADER(config.h)
AM_MAINTAINER_MODE


dnl **********************************************************
dnl * Check required program.
dnl **********************************************************
AC_PROG_INSTALL
AC_PROG_MAKE_SET
AC_PROG_CC

BINDINGS_CC="$CC"


dnl **********************************************************
dnl * Setup GnuLib, libtool and libltdl.
dnl **********************************************************

gl_EARLY
AC_LIBTOOL_DLOPEN
AC_LIBTOOL_WIN32_DLL
AM_DISABLE_STATIC
AC_PROG_LIBTOOL




dnl **************************************************
dnl * Setup custom compiler flags                    *
dnl **************************************************

AC_MSG_CHECKING(for cpu-specific compiler flags)
if test "$host_cpu" == "x86_64" && test $enable_static = "yes"; then
        AC_MSG_RESULT(x86_64/static: adding -fPIC)
        AX_C_CHECK_FLAG(-fPIC, , , CPPFLAGS="$CPPFLAGS -fPIC")
else
        AC_MSG_RESULT(none needed)
fi

AC_MSG_CHECKING(for platform-specific compiler flags)
case "$host_os" in
 darwin*)
        # It may be called "cc", but it's really a GCC derivative
        # with a problematic special precompiler and precompiled
        # headers; turn off the special precompiler, as some
        # apparently-legal code won't compile with its precompiled
        # headers.
        AC_MSG_RESULT(Darwin: adding -no-cpp-precomp)
        AX_C_CHECK_FLAG(-no-cpp-precomp, , , PCFLAGS="$PCFLAGS -no-cpp-precomp")
        libext=dylib
        ;;
 *)
        libext=so
        AC_MSG_RESULT(none needed)
        ;;
esac

AX_LD_CHECK_FLAG(-z relro, , , LDFLAGS="$LDFLAGS -z relro")
AX_LD_CHECK_FLAG(-z now, , , LDFLAGS="$LDFLAGS -z now")


for i in -Wall -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations \
         -Wbad-function-cast -Wcast-qual -Wcast-align -Wnested-externs -Wunused \
         -Wformat -Wformat-security; do
        AX_C_CHECK_FLAG($i, , , PCFLAGS="$PCFLAGS $i")
done

if test x$buggy_pthread_initializers = xyes; then
   AX_C_CHECK_FLAG(-Wno-missing-braces, , , PCFLAGS="$PCFLAGS -Wno-missing-braces")
fi


dnl **************************************************
dnl * Check for libprelude                           *
dnl **************************************************

AM_PATH_LIBPRELUDE(0.9.9, , AC_MSG_ERROR(Cannot find libprelude: Is libprelude-config in the path?), no)


dnl ***************************************************
dnl * Check for the MySQL library (MySQL plugin       *
dnl ***************************************************
AX_LIB_MYSQL()
with_mysql="no"
if test x$MYSQL_CONFIG != x; then
        with_mysql="yes"
        LIBS_bkp=$LIBS
        LIBS="$MYSQL_LDFLAGS"
        AC_CHECK_FUNC(mysql_real_escape_string, AC_DEFINE(HAVE_MYSQL_REAL_ESCAPE_STRING, , mysql_real_escape_string function present))
        LIBS=$LIBS_bkp
fi

AM_CONDITIONAL(HAVE_MYSQL, test x$with_mysql = xyes)


dnl ********************************************************
dnl * Check for the PostgreSQL library (PostgreSQL plugin) *
dnl ********************************************************
AX_LIB_POSTGRESQL()

with_pgsql="no"
if test x$POSTGRESQL_VERSION != x; then
        with_pgsql="yes"
        LIBS_bkp=$LIBS
        LIBS="$POSTGRESQL_LDFLAGS"
        AC_CHECK_FUNC(PQserverVersion, AC_DEFINE(HAVE_PQSERVERVERSION, , [Define if PQserverVersion function is available]))
        LIBS=$LIBS_bkp;
fi

AM_CONDITIONAL(HAVE_PGSQL, test x$with_pgsql = xyes)

dnl ********************************************************
dnl * Check for the SQLite3 library (SQLite3 plugin)       *
dnl ********************************************************
AX_LIB_SQLITE3("3.0.0")

if test x$SQLITE3_VERSION != x; then
        with_sqlite3="yes"
else
        with_sqlite3="no"
fi

AM_CONDITIONAL(HAVE_SQLITE3, test x$with_sqlite3 = xyes)



dnl **************************************************
dnl * Swig support                                   *
dnl **************************************************

AC_ARG_WITH(swig, AC_HELP_STRING(--with-swig@<:@=PATH@:>@, Re-generate perl/python bindings sources @<:@default=auto@:>@),
            [swig_required=true; if test x$withval = xyes; then with_swig="swig"; fi], with_swig="swig")

if test x$with_swig != xno; then
   AC_PATH_PROG(SWIG, `basename $with_swig`, no, `dirname $with_swig`:$PATH)

   if test x$SWIG = xno; then
      if test x$swig_required = xtrue; then
         AC_MSG_ERROR([Could not find $with_swig binary])
      fi
   fi
fi

AM_CONDITIONAL(HAVE_SWIG, test x$SWIG != xno)


dnl **************************************************
dnl * Perl support                                   *
dnl **************************************************

AC_ARG_WITH(perl, AC_HELP_STRING(--with-perl@<:@=PATH@:>@, Enable support for perl binding @<:@default=auto@:>@),
            [perl_required=true; if test x$withval = xyes; then with_perl="perl"; fi], with_perl="perl")

if test x$with_perl != xno; then

   AC_PATH_PROG(PERL, `basename $with_perl`, no, `dirname $with_perl`:$PATH)

   if test x$PERL = xno; then
      if test x$perl_required = xtrue; then
         AC_MSG_ERROR([Could not find $with_perl binary])
      fi

      with_perl=no
   else
      PERL_CFLAGS="-I`$PERL -e 'use Config; print $Config{archlib}'`/CORE"

      old_CPPFLAGS="$CPPFLAGS"
      CPPFLAGS="$CPPFLAGS $PERL_CFLAGS"

      AC_CHECK_HEADER(EXTERN.h, [AC_CHECK_HEADER(perl.h, with_perl=yes, with_perl=no, [#include <EXTERN.h>])], with_perl=no)
      CPPFLAGS="$old_CPPFLAGS"
   fi
fi

AM_CONDITIONAL(HAVE_PERL, test x$with_perl = xyes)


PERL_INSTALLDIRS="site"

AC_ARG_WITH(perl-installdirs, AC_HELP_STRING(--with-perl-installdirs=@<:@site|vendor@:>@, Specify where to install the Perl module @<:@default=site@:>@),
            PERL_INSTALLDIRS="$withval")

if test x$PERL_INSTALLDIRS != xsite && test x$PERL_INSTALLDIRS != xvendor; then
        AC_MSG_ERROR(Invalid value for --with-perl-installdirs: only "site" or "vendor" supported.)
fi

PERL_EXTRA_PARAMS="INSTALLDIRS=$PERL_INSTALLDIRS"
AC_SUBST(PERL_EXTRA_PARAMS)



dnl **************************************************
dnl * Python support                                 *
dnl **************************************************


AC_ARG_WITH(python, AC_HELP_STRING(--with-python@<:@=PATH@:>@, Enable support for python binding @<:@default=auto@:>@),
            [python_required=true; if test x$withval = xyes; then with_python="python"; fi], with_python="python")

if test x$with_python != xno; then

   AC_PATH_PROG(PYTHON, `basename $with_python`, no, `dirname $with_python`:$PATH)
   if test x$PYTHON = xno; then
      if test x$python_required = xtrue; then
         AC_MSG_ERROR([Could not find $with_python binary])
      fi

      with_python=no
   else
      old_CPPFLAGS="$CPPFLAGS"
      CPPFLAGS="-I`$PYTHON -c 'from distutils.sysconfig import get_python_inc; print get_python_inc()'`"

      AC_CHECK_HEADER(Python.h, with_python=yes, with_python=no)
      CPPFLAGS="$old_CPPFLAGS"
   fi
fi

AM_CONDITIONAL(HAVE_PYTHON, test x$with_python = xyes)


dnl **************************************************
dnl * Check for missing function replacement         *
dnl **************************************************
gl_SOURCE_BASE(libmissing)
gl_M4_BASE(libmissing/m4)
gl_INIT


dnl **************************************************
dnl * Check for GTK-DOC                              *
dnl **************************************************

GTK_DOC_CHECK(1.0)


dnl **************************************************
dnl * Typedefs, structures, compiler characteristics.*
dnl **************************************************

AC_C_CONST
AC_C_INLINE
AC_TYPE_SIZE_T
AC_HEADER_TIME



dnl **************************************************
dnl * Check for GTK-DOC                              *
dnl **************************************************

GTK_DOC_CHECK(1.0)


dnl **************************************************
dnl * Setup build variable                           *
dnl **************************************************

AC_SUBST(PCFLAGS)
AC_SUBST(BINDINGS_CC)
AC_SUBST(LIBPRELUDEDB_SONAME)

AS_AC_EXPAND(LIBDIR, $libdir)
AS_AC_EXPAND(DATADIR, $datadir)
AS_AC_EXPAND(SYSCONFDIR, $sysconfdir)


db_plugin_dir=$LIBDIR/libpreludedb/plugins
sql_plugin_dir=$db_plugin_dir/sql
format_plugin_dir=$db_plugin_dir/formats
format_schema_dir=$DATADIR/libpreludedb

AC_SUBST(db_plugin_dir)
AC_SUBST(sql_plugin_dir)
AC_SUBST(format_plugin_dir)
AC_SUBST(format_schema_dir)


AC_CONFIG_FILES([
libpreludedb-config

Makefile
m4/Makefile
libmissing/Makefile
libmissing/tests/Makefile

src/Makefile
src/include/Makefile
src/include/preludedb-version.h

plugins/Makefile

plugins/sql/Makefile
plugins/sql/mysql/Makefile
plugins/sql/pgsql/Makefile
plugins/sql/sqlite3/Makefile

plugins/format/Makefile
plugins/format/classic/Makefile
plugins/format/classic/include/Makefile

docs/Makefile
docs/api/Makefile
docs/manpages/Makefile

bindings/Makefile
bindings/perl/Makefile.PL
bindings/python/setup.py

])
AC_CONFIG_COMMANDS([default],[[ chmod +x libpreludedb-config ]],[[]])
AC_OUTPUT


echo
echo "*** Dumping configuration ***"
echo "    - Generate documentation      : $enable_gtk_doc"
echo "    - Enable MySQL plugin         : $with_mysql"
echo "    - Enable PostgreSQL plugin    : $with_pgsql"
echo "    - Enable SQLite3 plugin       : $with_sqlite3"
echo "    - Perl binding                : $with_perl"
echo "    - Python binding              : $with_python";