forked from maekitalo/tntdb
-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure.ac
314 lines (265 loc) · 7.31 KB
/
configure.ac
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
AC_INIT(tntdb, 1.3rc3, [Tommi Maekitalo <tommi@tntnet.org>])
AM_INIT_AUTOMAKE
LT_INIT([disable-static])
abi_current=4
abi_revision=0
abi_age=0
sonumber=${abi_current}:${abi_revision}:${abi_age}
AC_SUBST(sonumber)
AC_SUBST(abi_current)
AC_CONFIG_MACRO_DIR([m4])
AC_CONFIG_HEADERS([src/config.h])
AC_CONFIG_FILES([include/tntdb/config.h])
AC_CONFIG_SRCDIR([src/connect.cpp])
AC_PROG_CXX
AC_LANG(C++)
AX_CXX_COMPILE_STDCXX_11(noext, optional)
AX_COMPILER_VENDOR
AS_IF([test "$ax_cv_cxx_compiler_vendor" = "ibm"],
[CPPFLAGS="$CPPFLAGS -qrtti -qlanglvl=newexcp -D__NOLOCK_ON_INPUT -D__NOLOCK_ON_OUTPUT"],
AX_CHECK_COMPILE_FLAG([-Wno-long-long], [CPPFLAGS="$CPPFLAGS -Wno-long-long"])
AX_CHECK_COMPILE_FLAG([-Wall], [CPPFLAGS="$CPPFLAGS -Wall"])
AX_CHECK_COMPILE_FLAG([-pedantic], [CPPFLAGS="$CPPFLAGS -pedantic"]))
AC_PROG_LIBTOOL
AC_MSG_CHECKING([for sighandler_t])
AC_COMPILE_IFELSE(
[AC_LANG_SOURCE([
#include <signal.h>
sighandler_t *f;])],
has_sighandler_t=yes,has_sighandler_t=no)
AC_MSG_RESULT($has_sighandler_t)
AS_IF([test "$has_sighandler_t" = "yes"],
[AC_DEFINE( HAVE_SIGHANDLER_T, 1, [Define if sighandler_t available] )])
#
# check standard integer types
#
AC_TYPE_LONG_LONG_INT
AS_IF(
[test "$ac_cv_type_long_long_int" = yes],
[HAVE_LONG_LONG=HAVE_LONG_LONG],
[HAVE_LONG_LONG=NO_LONG_LONG])
AC_SUBST(HAVE_LONG_LONG, "$HAVE_LONG_LONG")
AC_TYPE_UNSIGNED_LONG_LONG_INT
AS_IF(
[test "$ac_cv_type_unsigned_long_long_int" = yes],
[HAVE_UNSIGNED_LONG_LONG=HAVE_UNSIGNED_LONG_LONG],
[HAVE_UNSIGNED_LONG_LONG=NO_UNSIGNED_LONG_LONG])
AC_SUBST(HAVE_UNSIGNED_LONG_LONG, "$HAVE_UNSIGNED_LONG_LONG")
AC_COMPILE_IFELSE(
[AC_LANG_SOURCE([
#include <stdint.h>
void foo(int) {}
void foo(long) {}
void foo(int32_t) {}
])],
INT_INT32_T_CONFLICT=0,
INT_INT32_T_CONFLICT=1)
AC_SUBST(INT_INT32_T_CONFLICT)
AC_COMPILE_IFELSE(
[AC_LANG_SOURCE([
#include <stdint.h>
void foo(unsigned) {}
void foo(unsigned long) {}
void foo(uint32_t) {}
])],
UNSIGNED_UINT32_T_CONFLICT=0,
UNSIGNED_UINT32_T_CONFLICT=1)
AC_SUBST(UNSIGNED_UINT32_T_CONFLICT)
AC_COMPILE_IFELSE(
[AC_LANG_SOURCE([
#include <stdint.h>
void foo(int) {}
void foo(long) {}
void foo(int64_t) {}
])],
INT_INT64_T_CONFLICT=0,
INT_INT64_T_CONFLICT=1)
AC_SUBST(INT_INT64_T_CONFLICT)
AC_COMPILE_IFELSE(
[AC_LANG_SOURCE([
#include <stdint.h>
void foo(unsigned) {}
void foo(unsigned long) {}
void foo(uint64_t) {}
])],
UNSIGNED_UINT64_T_CONFLICT=0,
UNSIGNED_UINT64_T_CONFLICT=1)
AC_SUBST(UNSIGNED_UINT64_T_CONFLICT)
#
# Cxxtools
#
AC_CHECK_HEADER([cxxtools/condition.h], , AC_MSG_ERROR([cxxtools headers not found]))
LDFLAGS="$LDFLAGS -lcxxtools"
#
# Postgresql
#
AC_ARG_WITH(
[postgresql],
AS_HELP_STRING([--with-postgresql],
[build postgresql driver (default: yes)]),
[with_postgresql=$withval],
[with_postgresql=yes])
AS_IF([test "$with_postgresql" = yes],
[
AC_PATH_PROGS(PG_CONFIG, pg_config)
if ! test -x "$PG_CONFIG"; then
AC_MSG_ERROR([postgresql configuration script pg_config was not found])
fi
PG_CPPFLAGS=-I`$PG_CONFIG --includedir`
PG_LDFLAGS="-L`$PG_CONFIG --libdir` -lpq"
AC_SUBST(PG_CONFIG)
AC_SUBST(PG_CPPFLAGS)
AC_SUBST(PG_LDFLAGS)
save_CPPFLAGS=$CPPFLAGS
CPPFLAGS="$CPPFLAGS $PG_CPPFLAGS"
AC_CHECK_HEADER([libpq-fe.h], , AC_MSG_ERROR([postgresql headers not found]))
AC_MSG_CHECKING([for PQprepare in libpq-fe.h])
AC_COMPILE_IFELSE(
[AC_LANG_SOURCE([#include <libpq-fe.h>
void t() { PQprepare(0, 0, 0, 0, 0); }])],
[AC_DEFINE(HAVE_PQPREPARE, 1, [Defined if postgresql supports PQprepare])
AC_MSG_RESULT(yes)
],
AC_MSG_RESULT(no))
CPPFLAGS=$save_CPPFLAGS
])
AM_CONDITIONAL(MAKE_POSTGRESQL, test "$with_postgresql" = yes)
#
# mysql
#
AC_ARG_WITH(
[mysql],
AS_HELP_STRING([--with-mysql],
[build mysql driver (default: yes)]),
[ with_mysql=$withval ],
[ with_mysql=yes ])
AS_IF([test "$with_mysql" = yes],
[
AC_PATH_PROGS(MYSQL_CONFIG, mysql_config)
if ! test -x "$MYSQL_CONFIG"; then
AC_MSG_ERROR([mysql configuration script was not found])
fi
MYSQL_CFLAGS=`$MYSQL_CONFIG --cflags`
MYSQL_LDFLAGS=`$MYSQL_CONFIG --libs_r`
AC_SUBST(MYSQL_CONFIG)
AC_SUBST(MYSQL_CFLAGS)
AC_SUBST(MYSQL_LDFLAGS)
])
AM_CONDITIONAL(MAKE_MYSQL, test "$with_mysql" = yes)
#
# Sqlite
#
AC_ARG_WITH(
[sqlite],
AS_HELP_STRING([--with-sqlite],
[build sqlite driver (default: yes)]),
[with_sqlite=$withval],
[with_sqlite=yes])
AS_IF([test "$with_sqlite" = yes],
[
AC_CHECK_HEADER([sqlite3.h], , AC_MSG_ERROR([header for sqlite3 not found]))
# check for sqlite3_transfer_bindings
AC_MSG_CHECKING([for sqlite3_transfer_bindings])
AC_COMPILE_IFELSE(
[AC_LANG_SOURCE([#include <sqlite3.h>
void t() { sqlite3_transfer_bindings(0, 0); }])],
[AC_MSG_RESULT(yes)],
[AC_MSG_ERROR([sqlite3_transfer_bindings is missing])])
# check for sqlite3_prepare_v2
AC_MSG_CHECKING([for sqlite3_prepare_v2])
AC_COMPILE_IFELSE(
[AC_LANG_SOURCE([#include <sqlite3.h>
void t() { sqlite3_prepare_v2(0, 0, 0, 0, 0); }])],
[AC_DEFINE(HAVE_SQLITE3_PREPARE_V2, 1, [Defined if sqlite have sqlite3_prepare_v2])
AC_MSG_RESULT(yes)
],
AC_MSG_RESULT(no))
])
AM_CONDITIONAL(MAKE_SQLITE, test "$with_sqlite" = yes)
#
# Cassandra
#
AC_ARG_WITH(
[cassandra],
AS_HELP_STRING([--with-cassandra],
[build cassandra-driver (default: no)]),
[with_cassandra=$withval],
[with_cassandra=no])
AS_IF([test "$with_cassandra" = yes],
[
AC_CHECK_HEADER([cassandra.h], , AC_MSG_ERROR([header for cassandra not found]))
])
AM_CONDITIONAL(MAKE_CASSANDRA, test "$with_cassandra" = yes)
#
# Oracle
#
AX_LIB_ORACLE_OCI([8.0])
AM_CONDITIONAL(MAKE_ORACLE, test "$HAVE_ORACLE_OCI" == "yes")
#
# Replicate
#
AC_ARG_WITH(
[replicate],
AS_HELP_STRING([--with-replicate],
[build replicate driver (default: yes)]),
[with_replicate=$withval],
[with_replicate=yes])
AM_CONDITIONAL(MAKE_REPLICATE, test "$with_replicate" = yes)
#
# Doxygen-documentation
#
AC_ARG_VAR(DOXYGEN, [doxygen documentation generator])
AC_ARG_WITH(
[doxygen],
AS_HELP_STRING([--with-doxygen],
[generate doxygen documentation]),
[doxygenFlag=$withval],
[doxygenFlag=no])
AS_IF([test "$doxygenFlag" != "no"],
[
AC_CHECK_PROG(DOXYGEN, doxygen, doxygen)
if test "$DOXYGEN" == ""
then
AC_MSG_ERROR([doxygen not found])
fi
AC_DEFINE(WITH_DOXYGEN, 1, [build doxygen documentation])
])
AM_CONDITIONAL(MAKE_DOXYGEN, test "$doxygenFlag" != "no")
AC_SUBST(DOXYGEN)
# driverlibdir
AC_ARG_WITH(
[driverdir],
AS_HELP_STRING([--with-driverdir=dir],
[specify directory for driver files [[LIBDIR/tntdb]] ]),
[driverdir=$withval],
[driverdir=$libdir/tntdb])
AC_SUBST(driverdir)
AS_IF([test "$driverdir" == "yes"],
[driverdir=$libdir/tntdb])
# additional shared library checks
case "${host_cpu}-${host_os}" in
*-aix*)
SHARED_LIB_FLAG=-qmkshrobj
;;
*)
SHARED_LIB_FLAG=
;;
esac
AC_SUBST(SHARED_LIB_FLAG)
AC_CONFIG_FILES([
Makefile
doc/Makefile
doc/tntdb.doxygen
demo/Makefile
include/Makefile
pkgconfig/tntdb.pc
src/Makefile
src/mysql/Makefile
src/postgresql/Makefile
src/replicate/Makefile
src/sqlite/Makefile
src/cassandra/Makefile
src/oracle/Makefile
test/Makefile
])
AC_OUTPUT