-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathacinclude.m4
498 lines (414 loc) · 13.1 KB
/
acinclude.m4
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
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
AC_DEFUN([AM_BLABLABLA_VER], [])
AC_DEFUN([CHECK_MYSQL],
[
AC_MSG_CHECKING([for mysql])
have_mysql=yes
AC_ARG_WITH(mysql,
[ --with-mysql=DIR base directory where MySQL is installed ],
[ mysql_lib_dir="$withval/lib/mysql"
mysql_include_dir="$withval/include" ]
)
AC_ARG_WITH(mysql-lib,
[ --with-mysql-lib=DIR directory where the MySQL libraries may be found ],
[ mysql_lib_dir="$withval" ]
)
AC_ARG_WITH(mysql-include,
[ --with-mysql-include=DIR directory where the MySQL includes may be found ],
[ mysql_include_dir="$withval" ]
)
AC_CHECK_PROG(MYSQL_CONFIG, mysql_config, yes, no)
dnl try to link to libmysqlclient_r
if test "x$MYSQL_CONFIG" = "xyes"; then
mysql_libs="$(mysql_config --libs_r)"
old_LIBS="$LIBS"
LIBS="$mysql_libs $LIBS"
AC_MSG_CHECKING([for mysql_init in -lmysqlclient_r (using mysql_config)])
AC_TRY_LINK_FUNC(mysql_init, have_libmysqlclient_r=yes)
LIBS="$old_LIBS"
if test "x$have_libmysqlclient_r" = "xyes"; then
AC_MSG_RESULT(yes)
my_libs="$mysql_libs"
else
AC_MSG_RESULT(no)
have_mysql=no
fi
else
have_mysql=no
fi
dnl ############################################################
dnl # Check for header files
dnl ############################################################
if test "x$MYSQL_CONFIG" = "xyes"; then
mysql_cflags="$(mysql_config --cflags)"
old_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS $mysql_cflags"
AC_MSG_CHECKING([for mysql.h (using mysql_config)])
AC_TRY_COMPILE([#include <mysql.h>], [int a = 1;],
have_mysql_h=yes)
if test "x$have_mysql_h" = "xyes"; then
AC_MSG_RESULT(yes)
my_cflags="$SMART_CFLAGS $mysql_cflags"
else
AC_MSG_RESULT(no)
have_mysql=no
fi
CFLAGS="$old_CFLAGS"
else
have_mysql=no
fi
if test $have_mysql = yes; then
AC_SUBST(MYSQL_CFLAGS, $my_cflags)
AC_SUBST(MYSQL_LIBS, $my_libs)
fi
AM_CONDITIONAL([GSQL_ENGINE_MYSQL],[test "x$have_mysql" = "xyes"])
if test -z "${GSQL_ENGINE_MYSQL_TRUE}"; then
HAVE_DB=yes
fi
])
AC_DEFUN([CHECK_ORACLE],
[
AC_MSG_CHECKING([for oracle])
dnl the default
have_oracle=yes
AC_ARG_WITH(oracle,
[ --with-oracle=DIR enable support for Oracle (default ORACLE_HOME)],
[
if test $withval = no; then
have_oracle=no
elif test $withval != yes; then
ORACLE_HOME=$withval
fi
], )
oracle_user_inc=
AC_ARG_WITH(oracle-includes,
[ --with-oracle-includes=DIR
set oracle include dir (default ORACLE_HOME/subdirs)],
[
have_oracle=yes
oracle_user_inc=$withval
], )
oracle_user_lib=
AC_ARG_WITH(oracle-libraries,
[ --with-oracle-libraries=DIR
set oracle lib dir (default ORACLE_HOME/lib)],
[
have_oracle=yes
oracle_user_lib=$withval
], )
oracle_user_oci_ver=
AC_ARG_WITH(oci-version,
[[ --with-oci-version=[8, 8I, 9I, 10G]
this is the version of the client, not the database.]],
[
have_oracle=yes
oracle_user_oci_ver=$withval
], )
oracle_user_instant=
AC_ARG_WITH(instant-client,
[[ --with-instant-client
define if compiling against Oracle Instant Client.
Disables testing for ORACLE_HOME and tnsnames.]],
[
have_oracle=yes
oracle_user_instant=$withval
], )
cflags_ora_save=$CFLAGS
ldflags_ora_save=$LDFLAGS
libs_ora_save=$LIBS
ora_cflags=
ora_libdir=
ora_ldflags=
ora_lib=-lclntsh
if test $have_oracle = no; then
dnl yeah, this is backwards.
AC_MSG_RESULT(no)
elif test "x$oracle_user_instant" != "x"; then
if test "x$oracle_user_lib" = "x" && test "x$oracle_user_inc" = "x"; then
dnl try to find oracle includes for instant client
dnl these are from the rpm install. they're all i know of so far.
for dir in `ls /usr/lib/oracle/`; do
echo "trying $dir" >&5
if expr $dir \> 10 >/dev/null; then
oracle_user_oci_ver=10G
fi
ora_ldflags="-L/usr/lib/oracle/$dir/client/lib"
incdir=/usr/include/oracle/$dir/client
if ! test -d $incdir; then
AC_MSG_ERROR([$incdir doesn't exist. Please install the sdk package or use --oracle-includes.])
fi
ora_cflags="-I$incdir"
break
done
fi
elif test "x$ORACLE_HOME" != "x"; then
AC_MSG_RESULT($ORACLE_HOME)
dnl try to find oracle includes
ora_check_inc="
$oracle_user_inc
$ORACLE_HOME/rdbms/demo
$ORACLE_HOME/plsql/public
$ORACLE_HOME/rdbms/public
$ORACLE_HOME/rdbms/include
$ORACLE_HOME/network/public
$ORACLE_HOME/sdk/
$ORACLE_HOME/sdk/include/
$ORACLE_HOME/include/
/usr/include/oracle"
for dir in $ora_check_inc; do
if test -d $dir; then
ora_cflags="$ora_cflags -I$dir"
fi
done
ora_check_lib="
$oracle_user_lib
$ORACLE_HOME/lib
$ORACLE_HOME/lib32
$ORACLE_HOME/lib64
/usr/lib/oracle"
for dir in $ora_check_lib; do
if test -d $dir; then
ora_ldflags="$ora_ldflags -L$dir"
fi
done
else
dnl test if we have includes or libraries
if test -z "$oracle_user_lib" || test -z "$oracle_user_inc"; then
AC_MSG_WARN(no)
have_oracle=no
else
ora_ldflags="-L$oracle_user_lib"
ora_cflags="-I$oracle_user_inc"
fi
fi
if test "x$ORACLE_HOME" != "x"; then
dnl check real quick that ORACLE_HOME doesn't end with a slash
dnl for some stupid reason, the 10g instant client bombs.
ora_home_oops=`echo $ORACLE_HOME | awk '/\/@S|@/ {print "oops"}'`
if test "$ora_home_oops" = "oops"; then
AC_MSG_WARN([Your ORACLE_HOME environment variable ends with a
slash (i.e. /). Oracle 10g Instant Client is known to have a problem
with this.])
fi
fi
if test $have_oracle = yes; then
AC_MSG_CHECKING([oci works])
CFLAGS="$CFLAGS $ora_cflags"
LDFLAGS="$LDFLAGS $ora_ldflags"
LIBS="$ora_lib"
# i pulled this from one of the examples in the demo dir.
AC_RUN_IFELSE([[
#include <oci.h>
Lda_Def lda;
ub4 hda [HDA_SIZE/(sizeof(ub4))];
int main(int c, char **v) {
return 0;
}
]], [found_oracle=yes],
[found_oracle=no], )
if test $found_oracle = no; then
AC_MSG_ERROR([Couldn't compile and run a simpile OCI app.
Try setting ORACLE_HOME or check config.log.
Otherwise, make sure ORACLE_HOME/lib is in /etc/ld.so.conf or LD_LIBRARY_PATH])
fi
sqlplus=
if test -x "$ORACLE_HOME/bin/sqlplus"; then
sqlplus="$ORACLE_HOME/bin/sqlplus"
fi
if test "x${sqlplus}" = "x"; then
if test -x "$ORACLE_HOME/bin/sqlplusO"; then
sqlplus="$ORACLE_HOME/bin/sqlplusO"
fi
fi
if test "x$oracle_user_oci_ver" != "x"; then
oci_ver=$oracle_user_oci_ver
elif test "x${sqlplus}" = "x"; then
AC_MSG_ERROR([Couldn't find sqlplus. Set the Oracle version manually.])
else
# get oracle oci version. know a better way?
sqlplus_ver=`$sqlplus -? | awk '/Release/ {print @S|@3}'`
echo "sqlplus_ver: $sqlplus_ver" >&5
if expr $sqlplus_ver \> 10 >/dev/null; then
dnl our version of oci doesn't have 10g defined yet
oci_ver=10G
elif expr $sqlplus_ver \> 9 >/dev/null; then
oci_ver=9I
elif expr $sqlplus_ver \< 8.1 >/dev/null; then
oci_ver=8
else
oci_ver=8I
fi
fi
ora_cflags="$ora_cflags -DOCI_VERSION${oci_ver}"
# don't change flags for all targets, just export ORA variables.
CFLAGS=$cflags_ora_save
AC_SUBST(ORACLE_CFLAGS, $ora_cflags)
LDFLAGS=$ldflags_ora_save
AC_SUBST(ORACLE_LDFLAGS, $ora_ldflags)
LIBS=$libs_ora_save
AC_SUBST(ORACLE_LIBS, $ora_lib)
# AM_CONDITIONAL in configure.in uses this variable to enable oracle
# targets.
enable_oracle=yes
AC_MSG_RESULT(yes)
fi
AM_CONDITIONAL([GSQL_ENGINE_ORACLE],[test "x$enable_oracle" = "xyes"])
if test -z "${GSQL_ENGINE_ORACLE_TRUE}"; then
HAVE_DB=yes
fi
])
AC_DEFUN([CHECK_PGSQL],
[
AC_MSG_CHECKING([for pgsql])
have_pgsql=yes
AC_ARG_WITH(pgsql-lib,
[ --with-pgsql-lib=DIR directory where the PGSQL libraries may be found ],
[ pgsql_lib_dir="$withval" ]
)
AC_ARG_WITH(pgsql-include,
[ --with-pgsql-include=DIR directory where the PGSQL includes may be found ],
[ pgsql_include_dir="$withval" ]
)
AC_CHECK_PROG(PG_CONFIG, pg_config, yes, no)
dnl try to link to libpq
if test "x$PG_CONFIG" = "xyes"; then
pgsql_libs="-L$(pg_config --libdir) -lpq"
old_LIBS="$LIBS"
LIBS="$pgsql_libs $LIBS"
AC_MSG_CHECKING([for PQconnectdb in -lpq (using pg_config)])
AC_TRY_LINK_FUNC(PQconnectdb, have_libpq=yes)
LIBS="$old_LIBS"
if test "x$have_libpq" = "xyes"; then
AC_MSG_RESULT(yes)
pg_libs="$pgsql_libs"
else
AC_MSG_RESULT(no)
have_pgsql=no
fi
else
have_pgsql=no
fi
dnl ############################################################
dnl # Check for header files
dnl ############################################################
if test "x$PG_CONFIG" = "xyes"; then
pgsql_cflags="-I$(pg_config --includedir)"
old_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS $pgsql_cflags"
AC_MSG_CHECKING([for libpq-fe.h (using pg_config)])
AC_TRY_COMPILE([#include <libpq-fe.h>], [int a = 1;],
have_pgsql_h=yes)
if test "x$have_pgsql_h" = "xyes"; then
AC_MSG_RESULT(yes)
pg_cflags="$SMART_CFLAGS $pgsql_cflags"
else
AC_MSG_RESULT(no)
have_pgsql=no
fi
CFLAGS="$old_CFLAGS"
else
have_pgsql=no
fi
if test $have_pgsql = yes; then
AC_SUBST(PGSQL_CFLAGS, $pg_cflags)
AC_SUBST(PGSQL_LIBS, $pg_libs)
fi
AM_CONDITIONAL([GSQL_ENGINE_PGSQL],[test "x$have_pgsql" = "xyes"])
if test -z "${GSQL_ENGINE_PGSQL_TRUE}"; then
HAVE_DB=yes
fi
])
AC_DEFUN([CHECK_FIREBIRD],
[
AC_MSG_CHECKING([for firebird])
have_firebird=yes
AC_ARG_WITH(firebird,
[ --with-firebird=DIR base directory where Firebird is installed ],
[ firebird_lib_dir="$withval/lib"
firebird_include_dir="$withval/include"
firebird_bin_dir="$withval/bin" ]
)
AC_ARG_WITH(firebird-lib,
[ --with-firebird-lib=DIR directory where the Firebird libraries may be found ],
[ firebird_lib_dir="$withval" ]
)
AC_ARG_WITH(firebird-include,
[ --with-firebird-include=DIR directory where the Firebird includes may be found ],
[ firebird_include_dir="$withval" ]
)
AC_CHECK_PROG(FB_CONFIG, fb_config, yes, no)
dnl try to link to libfbclient
if test "x$FB_CONFIG" = "xyes"; then
firebird_libs="$($FB_CONFIG --libs)"
old_LIBS="$LIBS"
LIBS="$firebird_libs $LIBS"
AC_MSG_CHECKING([for isc_attach_database in -libfbclient (using fb_config)])
AC_TRY_LINK_FUNC(isc_attach_database, have_libfbclient=yes)
LIBS="$old_LIBS"
if test "x$have_libfbclient" = "xyes"; then
AC_MSG_RESULT(yes)
my_libs="$firebird_libs"
else
AC_MSG_RESULT(no)
have_firebird=no
fi
else
have_firebird=no
fi
dnl ############################################################
dnl # Check for header files
dnl ############################################################
if test "x$FB_CONFIG" = "xyes"; then
fb_cflags="$($FB_CONFIG --cflags)"
old_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS $fb_cflags"
AC_MSG_CHECKING([for ibase.h (using fb_config)])
AC_TRY_COMPILE([#include <ibase.h>], [int a = 1;],
have_ibase_h=yes)
if test "x$have_ibase_h" = "xyes"; then
AC_MSG_RESULT(yes)
my_cflags="$SMART_CFLAGS $fb_cflags"
else
AC_MSG_RESULT(no)
have_firebird=no
fi
CFLAGS="$old_CFLAGS"
else
have_firebird=no
fi
if test $have_firebird = yes; then
AC_SUBST(FIREBIRD_CFLAGS, $my_cflags)
AC_SUBST(FIREBIRD_LIBS, $my_libs)
fi
AM_CONDITIONAL([GSQL_ENGINE_FIREBIRD],[test "x$have_firebird" = "xyes"])
if test -z "${GSQL_ENGINE_FIREBIRD_TRUE}"; then
HAVE_DB=yes
fi
])
AC_DEFUN([AM_GCONF_SOURCE_2],
[
AC_PATH_PROG([GCONFTOOL], [gconftool-2], [no])
if test "x$GCONF_SCHEMA_INSTALL_SOURCE" = "x"; then
GCONF_SCHEMA_CONFIG_SOURCE=`gconftool-2 --get-default-source`
else
GCONF_SCHEMA_CONFIG_SOURCE=$GCONF_SCHEMA_INSTALL_SOURCE
fi
AC_ARG_WITH(gconf-source,
[ --with-gconf-source=sourceaddress Config database for installing schema files.],GCONF_SCHEMA_CONFIG_SOURCE="$withval",)
AC_SUBST(GCONF_SCHEMA_CONFIG_SOURCE)
AC_MSG_RESULT([Using config source $GCONF_SCHEMA_CONFIG_SOURCE for schema installation])
if test "x$GCONF_SCHEMA_FILE_DIR" = "x"; then
GCONF_SCHEMA_FILE_DIR='$(sysconfdir)/gconf/schemas'
fi
AC_ARG_WITH(gconf-schema-file-dir,
[ --with-gconf-schema-file-dir=dir Directory for installing schema files.],GCONF_SCHEMA_FILE_DIR="$withval",)
AC_SUBST(GCONF_SCHEMA_FILE_DIR)
AC_MSG_RESULT([Using $GCONF_SCHEMA_FILE_DIR as install directory for schema files])
AC_ARG_ENABLE(schemas-install,
[ --disable-schemas-install Disable the schemas installation],
[case "${enableval}" in
yes) schemas_install=true ;;
no) schemas_install=false ;;
*) AC_MSG_ERROR(bad value ${enableval} for --disable-schemas-install) ;;
esac],[schemas_install=true])
AM_CONDITIONAL(GCONF_SCHEMAS_INSTALL, test x$schemas_install = xtrue)
])