forked from PowerDNS/pdns
-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure.ac
780 lines (692 loc) · 24.7 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
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
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
dnl intro
dnl The following lines may be patched by set-version-auth.
AC_INIT([pdns], [git])
dnl AC_SUBST([DIST_HOST], [TO_BE_PATCHED])
dnl End patch area.
AC_CONFIG_SRCDIR([pdns/receiver.cc])
AM_INIT_AUTOMAKE([foreign tar-ustar -Wno-portability subdir-objects])
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
AC_CANONICAL_HOST
LT_INIT
AC_CONFIG_MACRO_DIR([m4])
AC_CONFIG_HEADERS([config.h])
AC_C_BIGENDIAN
AC_PREREQ(2.52)
: ${CXXFLAGS="-Wall -O2"}
AC_PREFIX_DEFAULT(/usr/local)
AC_PROG_CC
AC_PROG_CXX
AM_PROG_CC_C_O
AC_PROG_YACC
AM_PROG_LEX
AC_PROG_INSTALL
AC_PROG_MAKE_SET
AC_PROG_LIBTOOL
AC_LANG_CPLUSPLUS
AC_CHECK_PROG([RAGEL], [ragel], [ragel])
AC_CHECK_PROG([ASCIIDOC], [asciidoc], [asciidoc])
dnl Check for lua
AC_MSG_CHECKING(if with lua)
AC_ARG_WITH(lua, AC_HELP_STRING([--with-lua],[use Lua]), [WITH_LUA=$withval],[WITH_LUA=yes])
AC_MSG_RESULT($WITH_LUA)
if test "$WITH_LUA" != "no"; then
# try pkgconfig
if test "$WITH_LUA" = "yes"; then
LUAPC=lua
else
LUAPC=$WITH_LUA
fi
PKG_CHECK_MODULES(LUA, $LUAPC >= 5.1, [
AC_DEFINE([HAVE_LUA], [1], [liblua])
AC_DEFINE([HAVE_LUA_H], [1], [lua.h])
],[
PKG_CHECK_MODULES(LUA, lua5.1 >= 5.1, [
AC_DEFINE([HAVE_LUA], [1], [liblua])
AC_DEFINE([HAVE_LUA_H], [1], [lua.h])
],[
PKG_CHECK_MODULES(LUA, lua-5.1 >= 5.1, [
AC_DEFINE([HAVE_LUA], [1], [liblua])
AC_DEFINE([HAVE_LUA_H], [1], [lua.h])
])
])
])
AC_SUBST(LUA_CFLAGS)
AC_SUBST(LUA_LIBS)
fi
AM_CONDITIONAL([RELEASE_BUILD], [test "$PACKAGE_VERSION" != "git"])
BOOST_REQUIRE([1.35])
BOOST_FOREACH
BOOST_PROGRAM_OPTIONS([mt])
BOOST_SERIALIZATION([mt])
AC_ARG_ENABLE(unit-tests, AC_HELP_STRING([--enable-unit-tests],[enable unit test building]), [enable_unit_tests=yes],[enable_unit_tests=no])
if test x"$enable_unit_tests" = "xyes"; then
BOOST_TEST([mt])
fi
#BOOST_SYSTEM([mt])
# detect pkg-config explicitly
PKG_PROG_PKG_CONFIG
dnl Allow user to require SQLite3
AC_MSG_CHECKING(whether user requires sqlite3)
AC_ARG_WITH(sqlite3, AC_HELP_STRING([--with-sqlite3],[include sqlite3 driver]), [WITH_SQLITE3=$withval],[WITH_SQLITE3=no])
AC_MSG_RESULT($WITH_SQLITE3)
SQLITE3PC=sqlite3
if test "$WITH_SQLITE3" != "no"; then
needsqlite3=yes
if test "$WITH_SQLITE3" != "yes"; then
SQLITE3PC=$WITH_SQLITE3
fi
fi
dnl Checks for header files.
AC_HEADER_STDC
AC_CHECK_HEADERS(fcntl.h getopt.h limits.h strings.h sys/time.h syslog.h unistd.h)
dnl Checks for typedefs, structures, and compiler characteristics.
AC_TYPE_SIZE_T
AC_HEADER_TIME
AC_STRUCT_TM
dnl Checks for library functions.
AC_TYPE_SIGNAL
AC_CHECK_FUNCS(gethostname gettimeofday mkdir mktime select socket strerror strcasestr)
# Check for libdl
LIBS="$LIBS -lz"
my_save_LIBS="$LIBS"
LIBS=""
AC_CHECK_LIB(dl,dlopen)
LIBDL=$LIBS
LIBS="$my_save_LIBS"
AC_SUBST(LIBDL)
AC_MSG_CHECKING([for RTLD_NOW]);
ac_save_LIBS="$LIBS"
LIBS="$LIBS $LIBDL"
AC_TRY_LINK(
[#include <dlfcn.h>],
[ (void) dlopen("",RTLD_NOW); ],
has_RTLD_NOW=yes, has_RTLD_NOW=no)
AC_MSG_RESULT([$has_RTLD_NOW])
if test "$has_RTLD_NOW" = "no"
then
AC_DEFINE(NEED_RTLD_NOW,,[If host OS misses RTLD_NOW])
fi
LIBS=$ac_save_LIBS
# Check for libcrypt
my_save_LIBS="$LIBS"
LIBS=""
AC_CHECK_LIB(crypt, crypt)
LIBCRYPT=$LIBS
LIBS="$my_save_LIBS"
AC_SUBST(LIBCRYPT)
DYNLINKFLAGS=""
THREADFLAGS=""
AM_CONDITIONAL([OS_MACOSX], false)
case "$host_os" in
solaris2.10)
AC_DEFINE(HAVE_IPV6,1,[If the host operating system understands IPv6])
LIBS="-lposix4 -lresolv -lnsl -lsocket -lpthread -lrt $LIBS"
CXXFLAGS="-D_REENTRANT $CXXFLAGS"
;;
solaris2.8 | solaris2.9 )
AC_DEFINE(NEED_POSIX_TYPEDEF,,[If POSIX typedefs need to be defined])
AC_DEFINE(NEED_INET_NTOP_PROTO,,[If your OS is so broken that it needs an additional prototype])
AC_DEFINE(HAVE_IPV6,1,[If the host operating system understands IPv6])
LIBS="-lposix4 -lresolv -lnsl -lsocket -lpthread $LIBS"
CXXFLAGS="-D_REENTRANT $CXXFLAGS"
;;
solaris2.6 | solaris2.7)
AC_DEFINE(NEED_POSIX_TYPEDEF,,[If POSIX typedefs need to be defined])
AC_DEFINE(NEED_INET_NTOP_PROTO,,[If your OS is so broken that it needs an additional prototype])
LIBS="-lposix4 -lresolv -lnsl -lsocket -lpthread $LIBS"
CXXFLAGS="-D_REENTRANT $CXXFLAGS"
;;
linux*)
AC_DEFINE(HAVE_IPV6,1,[If the host operating system understands IPv6])
DYNLINKFLAGS="-rdynamic"
LDFLAGS="$LDFLAGS -lrt"
THREADFLAGS="-pthread"
CXXFLAGS="-D_GNU_SOURCE $CXXFLAGS"
;;
darwin11* | darwin12*)
AC_DEFINE(HAVE_IPV6,1,[If the host operating system understands IPv6])
DYNLINKFLAGS="-rdynamic"
LDFLAGS="-pthread $LDFLAGS"
CXXFLAGS="-pthread $CXXFLAGS -D__APPLE_USE_RFC_3542"
AM_CONDITIONAL([OS_MACOSX], true)
;;
*)
AC_DEFINE(HAVE_IPV6,1,[If the host operating system understands IPv6])
DYNLINKFLAGS="-rdynamic"
LDFLAGS="-pthread $LDFLAGS"
CXXFLAGS="-pthread $CXXFLAGS"
;;
esac
AC_SUBST(THREADFLAGS)
AC_SUBST(DYNLINKFLAGS)
AC_MSG_CHECKING(whether we will be doing verbose logging)
AC_ARG_ENABLE(verbose-logging,
AC_HELP_STRING([--enable-verbose-logging],[do verbose logging]), [enable_verbose_logging=yes], [enable_verbose_logging=no])
if test $enable_verbose_logging = yes; then AC_DEFINE(VERBOSELOG, 1, [If verbose logging should be enabled])
fi
AC_MSG_RESULT($enable_verbose_logging)
AC_ARG_WITH([system-polarssl],
AS_HELP_STRING([--without-system-polarssl], [do not use system PolarSSL]))
AS_IF([test "x$with_system_polarssl" != "xno"],
[AC_CHECK_LIB([polarssl], [sha1_hmac], [
AC_MSG_CHECKING([PolarSSL version >= 1.1])
AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM(
[[
#include <polarssl/version.h>
]],
[[
#if POLARSSL_VERSION_NUMBER < 0x01010000
#error invalid version
#endif
]]
)],
[have_system_polarssl=yes],
[have_system_polarssl=no])
AC_MSG_RESULT($have_system_polarssl) ],
[have_system_polarssl=no])],
[have_system_polarssl=no]
)
POLARSSL_SUBDIR=ext/polarssl-1.1.2
POLARSSL_CFLAGS=-I\$\(top_srcdir\)/pdns/$POLARSSL_SUBDIR/include/
POLARSSL_LIBS=\$\(top_builddir\)/pdns/$POLARSSL_SUBDIR/library/libpolarssl.a
AS_IF([test "x$have_system_polarssl" = "xyes"],
[
POLARSSL_CFLAGS=
POLARSSL_LIBS=-lpolarssl
POLARSSL_SUBDIR=
],
[AS_IF([test "x$with_system_polarssl" = "xyes"],
[AC_MSG_ERROR([use of system polarssl requested but not found])]
)] )
AC_MSG_CHECKING(whether we will try to link in system PolarSSL)
AC_MSG_RESULT($have_system_polarssl)
AC_SUBST(POLARSSL_CFLAGS)
AC_SUBST(POLARSSL_LIBS)
AC_SUBST(POLARSSL_SUBDIR)
AC_MSG_CHECKING(whether we will be linking in Botan 1.10)
AC_ARG_ENABLE(botan1.10,
AC_HELP_STRING([--enable-botan1.10],[use Botan 1.10]), [enable_botan110=yes], [enable_botan110=no])
AC_MSG_RESULT($enable_botan110)
AM_CONDITIONAL(BOTAN110,test x"$enable_botan110" = "xyes")
AC_MSG_CHECKING(whether we will be linking in Botan 1.8)
AC_ARG_ENABLE(botan1.8,
AC_HELP_STRING([--enable-botan1.8],[use Botan 1.8]), [enable_botan18=yes], [enable_botan18=no])
AC_MSG_RESULT($enable_botan18)
AM_CONDITIONAL(BOTAN18,test x"$enable_botan18" = "xyes")
AC_MSG_CHECKING(whether we will be linking in Crypto++)
AC_ARG_ENABLE(cryptopp,
AC_HELP_STRING([--enable-cryptopp],[use Crypto++]), [enable_cryptopp=yes], [enable_cryptopp=no])
AC_MSG_RESULT($enable_cryptopp)
AM_CONDITIONAL(CRYPTOPP,test x"$enable_cryptopp" = "xyes")
if test "x$enable_botan110" = "xyes"
then
PKG_CHECK_MODULES(BOTAN110, botan-1.10, HAVE_BOTAN110=yes, AC_MSG_ERROR([Could not find botan 1.10]))
AC_SUBST(BOTAN110_LIBS)
AC_SUBST(BOTAN110_CFLAGS)
AC_DEFINE(HAVE_BOTAN110,1,[If we have botan 1.10])
fi
if test "x$enable_botan18" = "xyes"
then
PKG_CHECK_MODULES(BOTAN18, botan-1.8, HAVE_BOTAN18=yes, AC_MSG_ERROR([Could not find botan 1.8]))
AC_SUBST(BOTAN18_LIBS)
AC_SUBST(BOTAN18_CFLAGS)
AC_DEFINE(HAVE_BOTAN18,1,[If we have botan 1.8])
fi
if test "x$enable_cryptopp" = "xyes"
then
AC_DEFINE(HAVE_CRYPTOPP,1,[If we have cryptopp])
fi
AC_ARG_ENABLE(remotebackend_http, AC_HELP_STRING([--enable-remotebackend-http],[enable HTTP connector for remotebackend]),[enable_remotebackend_http=yes], [enable_remotebackend_http=no])
AC_MSG_CHECKING(whether to enable http connector in remotebackend)
AC_MSG_RESULT($enable_remotebackend_http)
AM_CONDITIONAL(REMOTEBACKEND_HTTP,test x"$enable_remotebackend_http" = "xyes")
if test "x$enable_remotebackend_http" = "xyes"
then
PKG_CHECK_MODULES(LIBCURL, libcurl, HAVE_LIBCURL=yes, AC_MSG_ERROR([Could not find libcurl]))
REMOTEBACKEND_HTTP=yes
AC_SUBST(LIBCURL_LIBS)
AC_SUBST(LIBCURL_CFLAGS)
AC_DEFINE(HAVE_LIBCURL,1,[If we have libcurl])
AC_DEFINE(REMOTEBACKEND_HTTP,1,[If we want HTTP connector])
AC_SUBST(REMOTEBACKEND_HTTP)
fi
AC_MSG_CHECKING(whether we should build static binaries)
AC_ARG_ENABLE(static-binaries, AC_HELP_STRING([--enable-static-binaries],[Build static binaries]),
[case "${enableval}" in
yes) static=true ;;
no) static=false ;;
*) AC_MSG_ERROR(bad value ${enableval} for --enable-static-binaries) ;;
esac],[debug=false])
AC_MSG_RESULT($static)
AM_CONDITIONAL(ALLSTATIC, test x$static = xtrue)
if test x$static = xtrue;
then
LDFLAGS="-all-static $LDFLAGS"
fi
modules="gmysql geo random"
AC_ARG_WITH(modules, AC_HELP_STRING([--with-modules],[which backends to compile with]),
[
modules="$withval"
])
dynmodules="pipe"
AC_ARG_WITH(dynmodules, AC_HELP_STRING([--with-dynmodules],[which backends to build for dynamic loading]),
[
dynmodules="$withval"
])
AC_SUBST(socketdir)
socketdir="/var/run"
AC_ARG_WITH(socketdir, AC_HELP_STRING([--with-socketdir],[where the controlsocket lives]),
[
socketdir="$withval"
])
AC_SUBST(moduledirs)
AC_SUBST(moduleobjects)
AC_SUBST(modulelibs)
AC_DEFINE_UNQUOTED(PDNS_MODULES,"$modules", [Built-in modules])
AC_MSG_CHECKING(whether we will be building the server)
AC_ARG_ENABLE(pdns-server,
AC_HELP_STRING([--enable-pdns_server],[if we should build the server]),
[enable_pdns_server=$enableval],
[enable_pdns_server=yes])
AC_MSG_RESULT($enable_pdns_server)
if test x"$enable_pdns_server" = "xyes"
then
programdescend=pdns
fi
AC_SUBST(programdescend)
AC_ARG_ENABLE(gcc-skip-locking,
AC_HELP_STRING([--enable-gcc-skip-locking],[if we should forcefully skip gcc locking]),
AC_DEFINE(GCC_SKIP_LOCKING,,[Skip gcc locking]),
)
AC_MSG_CHECKING(whether we will be building and installing the extra tools)
AC_ARG_ENABLE(tools,
AC_HELP_STRING([--enable-tools],[if we should build+install the tools]),
enable_tools=$enableval,
enable_tools=no )
AC_MSG_RESULT($enable_tools)
AM_CONDITIONAL(TOOLS,test x"$enable_tools" = "xyes")
for a in $modules $dynmodules
do
case "$a" in
oracle|goracle)
needoracle=yes
;;
gmysql )
needmysql=yes
;;
mydns )
needmysql=yes
;;
gpgsql )
needpgsql=yes
;;
gsqlite3 )
needsqlite3=yes
;;
pdns )
needmysql=yes
;;
ldap)
AC_CHECK_HEADERS([ldap.h], , [AC_MSG_ERROR([ldap header (ldap.h) not found])])
AC_CHECK_HEADERS([lber.h], , [AC_MSG_ERROR([ldap header (lber.h) not found])])
AC_SUBST([LIBLDAP])
AC_CHECK_LIB(
[ldap_r], [ldap_set_option],
[AC_DEFINE([HAVE_LIBLDAP_R], 1, [Have -lldap_r]) LIBLDAP="ldap_r"],
[AC_CHECK_LIB(
[ldap], [ldap_set_option],
[AC_DEFINE([HAVE_LIBLDAP], 1, [Have -lldap]) LIBLDAP="ldap"],
[AC_MSG_ERROR([ldap library (libldap) not found])]
)]
)
AC_CHECK_LIB(
[$LIBLDAP], [ldap_initialize],
[AC_DEFINE([HAVE_LDAP_INITIALIZE], 1, [Define to 1 if you have ldap_initialize])]
)
AC_CHECK_LIB(
[$LIBLDAP], [ldap_sasl_bind],
[AC_DEFINE([HAVE_LDAP_SASL_BIND], 1, [Define to 1 if you have ldap_sasl_bind])]
)
;;
godbc )
needunixodbc=yes
;;
opendbx)
AC_CHECK_HEADERS([odbx.h], , [AC_MSG_ERROR([opendbx header (odbx.h) not found])])
AC_SUBST([LIBOPENDBX])
AC_CHECK_LIB(
[opendbx], [odbx_init],
[AC_DEFINE([HAVE_LIBOPENDBX], 1, [Have -lopendbx]) LIBOPENDBX="opendbx"]
)
;;
tinydns)
needcdb=yes
;;
esac
done
AM_CONDITIONAL(ORACLE,test x"$needoracle" = "xyes")
if test "$needoracle"
then
AC_ARG_WITH(oracle_includes, AC_HELP_STRING([--with-oracle-includes=<path>],[instantclient sdk include dir]))
AC_ARG_WITH(oracle_libs, AC_HELP_STRING([--with-oracle-libs=<path>],[instantclient oracle library dir]))
if test x"$with_oracle_includes" = "x"
then
# check possible locations
for p1 in /usr/include/oracle /usr/local/include/oracle
do
for p2 in $p1/*/client*
do
if test -d "$p2"
then
with_oracle_includes=$p2
fi
done
done
fi
if test x"$with_oracle_includes" = x && test "$ORACLE_HOME/rdbms/public" != "/rdbms/public"; then
if test -d $ORACLE_HOME/rdbms/public; then
with_oracle_includes=$ORACLE_HOME/rdbms/public
fi
fi
# test header
old_CXXFLAGS="$CXXFLAGS"
old_CFLAGS="$CFLAGS"
CXXFLAGS="$CXXFLAGS -I$with_oracle_includes"
CPPFLAGS="$CPPFLAGS -I$with_oracle_includes"
AC_CHECK_HEADER([oci.h], ORACLE_CFLAGS="-I$with_oracle_includes", AC_MSG_ERROR([Could not find oci.h]))
CXXFLAGS="$old_CXXFLAGS"
CPPFLAGS="$old_CPPFLAGS"
AC_SUBST([ORACLE_CFLAGS])
AC_SUBST([ORACLE_LIBS])
if test x"$with_oracle_libs" = "x"
then
# check possible locationse
for p1 in /usr/lib/oracle /usr/local/lib/oracle
do
for p2 in $p1/*/client*/lib
do
if test -d "$p2"
then
with_oracle_libs=$p2
fi
done
done
fi
if test x"$with_oracle_libs" = x && test "$ORACLE_HOME/lib" != "/lib"; then
if test -d $ORACLE_HOME/lib; then
with_oracle_libs=$ORACLE_HOME/lib
fi
fi
# we have to check for client9 as well...
# test -lclntsh
old_LDFLAGS="$LDFLAGS"
LDFLAGS="-L$with_oracle_libs -lnnz11 -locci"
AC_CHECK_LIB([clntsh],[OCIEnvInit],ORACLE_LIBS="-L$with_oracle_libs -lnnz11 -lclntsh -locci",
AC_CHECK_LIB([client9], [OCIEnvInit],ORACLE_LIBS="-L$with_oracle_libs -lclient9 -lclntsh9",AC_MSG_ERROR([Could not find client libraries])))
LDFLAGS="$old_LDFLAGS"
fi
if test "$needmysql"
then
AC_ARG_WITH(mysql,
AC_HELP_STRING([--with-mysql=<path>],[root directory path of MySQL installation]),
[MYSQL_lib_check="$withval/lib/mysql $with_mysql/lib"
MYSQL_inc_check="$withval/include/mysql"
MYSQL_config_check="$withval/bin/mysql_config"],
[MYSQL_lib_check="/usr/local/mysql/lib/mysql /usr/local/lib/mysql /opt/mysql/lib/mysql \
/usr/lib/mysql /usr/lib64/mysql /usr/local/mysql/lib /usr/local/lib /opt/mysql/lib /usr/lib \
/usr/sfw/lib/ /usr/lib/x86_64-linux-gnu/"
MYSQL_inc_check="/usr/local/mysql/include/mysql /usr/local/include/mysql \
/opt/mysql/include/mysql /opt/mysql/include /usr/include/mysql /usr/sfw/include/mysql"])
AC_ARG_WITH(mysql-config,
AC_HELP_STRING([--with-mysql-config=<path>],[file path to mysql_config]),
[MYSQL_config_check=$withval])
AC_ARG_WITH(mysql-lib,
AC_HELP_STRING([--with-mysql-lib=<path>],[directory path of MySQL library installation]),
[MYSQL_lib_check="$withval/lib/mysql $withval/mysql $withval"
MYSQL_config_check="skip"])
AC_ARG_WITH(mysql-includes,
AC_HELP_STRING([--with-mysql-includes=<path>],[directory path of MySQL header installation]),
[MYSQL_inc_check="$withval/include/mysql $withval/mysql $withval"
MYSQL_config_check="skip"])
MYSQL_config=""
if test "x$MYSQL_config_check" != "xskip"; then
AC_MSG_CHECKING([for mysql_config])
if test "x$MYSQL_config_check" == "x"; then
# check if it's in path
for m in /bin /usr/bin /usr/local/bin /opt/csw/bin; do
if test -x $m/mysql_config; then
MYSQL_config=$m/mysql_config
break
fi
done
if test "x$MYSQL_config" == "x"; then
AC_MSG_RESULT([not found])
else
AC_MSG_RESULT([$MYSQL_config])
fi
else
if test -x $MYSQL_config_check; then
MYSQL_config="$MYSQL_config_check"
AC_MSG_RESULT([$MYSQL_config])
else
MYSQL_config=""
AC_MSG_ERROR([not found])
fi
fi
fi
if test "x$MYSQL_config" != "x"; then
# use this to configure everything
MYSQL_lib=`$MYSQL_config --libs`
MYSQL_inc=`$MYSQL_config --include`
else
AC_MSG_CHECKING([for MySQL library directory])
MYSQL_libdir=
for m in $MYSQL_lib_check; do
if test -d "$m" && \
(test -f "$m/libmysqlclient.so" || test -f "$m/libmysqlclient.a")
then
MYSQL_libdir=$m
break
fi
done
if test -z "$MYSQL_libdir"; then
AC_MSG_ERROR([Did not find the mysql library dir in '$MYSQL_lib_check'])
fi
case "$MYSQL_libdir" in
/*) MYSQL_lib="-L$MYSQL_libdir -lmysqlclient"
;;
*) AC_MSG_ERROR([The MySQL library directory ($MYSQL_libdir) must be an absolute path.])
;;
esac
AC_MSG_RESULT([$MYSQL_libdir])
AC_SUBST(MYSQL_lib)
AC_MSG_CHECKING([for MySQL include directory])
MYSQL_inc=
for m in $MYSQL_inc_check; do
if test -d "$m" && test -f "$m/mysql.h"
then
MYSQL_inc="$m"
break
fi
done
if test -z "$MYSQL_inc"; then
AC_MSG_ERROR([Did not find the mysql include dir in '$MYSQL_inc_check'])
fi
case "$MYSQL_inc" in
/*) AC_MSG_RESULT($MYSQL_inc)
;;
*) AC_MSG_ERROR([The MySQL include directory ($MYSQL_inc) must be an absolute path.])
;;
esac
MYSQL_inc="-I$MYSQL_inc"
fi
AC_SUBST(MYSQL_lib)
AC_SUBST(MYSQL_inc)
fi
if test "$needpgsql"
then
AC_ARG_WITH(pgsql,
AC_HELP_STRING([--with-pgsql=<path>],[root directory path of PgSQL installation]),
[PGSQL_lib_check="$withval/lib/pgsql $with_pgsql/lib"
PGSQL_inc_check="$withval/include/pgsql"],
[PGSQL_lib_check="/usr/local/pgsql/lib/pgsql /usr/local/lib/pgsql /opt/pgsql/lib/pgsql /usr/lib/pgsql /usr/local/pgsql/lib /usr/local/lib /opt/pgsql/lib /usr/lib /usr/lib64"
PGSQL_inc_check="/usr/local/pgsql/include/pgsql /usr/include /usr/local/include/postgresql/ /usr/local/include /opt/pgsql/include/pgsql /opt/pgsql/include /usr/include/pgsql/ /usr/include/postgresql"])
AC_ARG_WITH(pgsql-lib,
AC_HELP_STRING([--with-pgsql-lib=<path>],[directory path of PgSQL library installation]),
[PGSQL_lib_check="$withval/lib/pgsql $withval/pgsql $withval"])
AC_ARG_WITH(pgsql-includes,
AC_HELP_STRING([--with-pgsql-includes=<path>],[directory path of PgSQL header installation]),
[PGSQL_inc_check="$withval/include/pgsql $withval/pgsql $withval"])
AC_MSG_CHECKING([for PgSQL library directory])
PGSQL_libdir=
for m in $PGSQL_lib_check; do
if test -d "$m" && \
(test -f "$m/libpq.a" || test -f "$m/libpq.so")
then
PGSQL_libdir=$m
break
fi
done
if test -z "$PGSQL_libdir"; then
AC_MSG_ERROR([Didn't find the pgsql library dir in '$PGSQL_lib_check'])
fi
case "$PGSQL_libdir" in
/usr/lib ) PGSQL_lib="" ;;
/usr/lib64 ) PGSQL_lib="" ;;
/* ) PGSQL_lib="-L$PGSQL_libdir -Wl,-rpath,$PGSQL_libdir"
LDFLAGS="$PGSQL_lib $LDFLAGS"
;;
* ) AC_MSG_ERROR([The PgSQL library directory ($PGSQL_libdir) must be an absolute path.]) ;;
esac
AC_SUBST(PGSQL_lib)
AC_MSG_RESULT([$PGSQL_libdir])
AC_MSG_CHECKING([for PgSQL include directory])
PGSQL_incdir=
for m in $PGSQL_inc_check; do
if test -d "$m" && test -f "$m/libpq-fe.h"
then
PGSQL_incdir=$m
break
fi
done
if test -z "$PGSQL_incdir"; then
AC_MSG_ERROR([Didn't find the PgSQL include dir in '$PGSQL_inc_check'])
fi
case "$PGSQL_incdir" in
/* ) ;;
* ) AC_MSG_ERROR([The PgSQL include directory ($PGSQL_incdir) must be an absolute path.]) ;;
esac
AC_SUBST(PGSQL_incdir)
AC_MSG_RESULT([$PGSQL_incdir])
fi
AM_CONDITIONAL(SQLITE3, test "$needsqlite3")
if test "$needsqlite3"
then
PKG_CHECK_MODULES(SQLITE3, $SQLITE3PC, HAVE_SQLITE3=yes, AC_MSG_ERROR([+Could not find sqlite3]))
AC_SUBST(SQLITE3_LIBS)
AC_SUBST(SQLITE3_CFLAGS)
AC_DEFINE(HAVE_SQLITE3,1,[If we have sqlite3])
fi
if test "$needcdb"
then
PKG_CHECK_MODULES(CDB, libcdb, HAVE_CDB=yes, AC_MSG_ERROR([+Could not find libcdb/tinycdb]))
AC_SUBST(CDB_LIBS)
AC_SUBST(CDB_CFLAGS)
fi
if test "$needunixodbc"
then
AC_ARG_WITH(unixodbc,
AC_HELP_STRING([--with-unixodbc=<path>],[root directory path of unixodbc installation]),
[UNIXODBC_lib_check="$withval/lib/unixodbc $with_unixodbc/lib $withval/lib"
UNIXODBC_inc_check="$withval/include/unixodbc"],
[UNIXODBC_lib_check="/usr/local/unixodbc/lib/unixodbc /usr/local/lib/unixodbc /usr/lib/unixodbc /usr/local/unixodbc/lib /usr/local/lib /opt/unixodbc/lib /usr/lib"
UNIXODBC_inc_check="/usr/local/unixodbc/include/unixodbc /usr/local/include/unixodbc/ /usr/local/include /opt/unixodbc/include/unixodbc /opt/unixodbc/include /usr/include/ /usr/include/unixodbc"])
AC_ARG_WITH(unixodbc-lib,
AC_HELP_STRING([--with-unixodbc-lib=<path>],[directory path of unixodbc library installation]),
[UNIXODBC_lib_check="$withval/lib/unixodbc $withval/unixodbc $withval"])
AC_ARG_WITH(unixodbc-includes,
AC_HELP_STRING([--with-unixodbc-includes=<path>],[directory path of unixodbc header installation]),
[UNIXODBC_inc_check="$withval/include $withval/include/unixodbc $withval/unixodbc $withval"])
AC_MSG_CHECKING([for unixodbc library directory])
UNIXODBC_libdir=
for m in $UNIXODBC_lib_check; do
if test -d "$m" && \
(test -f "$m/libodbc.so" || test -f "$m/libodbc.a")
then
UNIXODBC_libdir=$m
break
fi
done
if test -z "$UNIXODBC_libdir"; then
AC_MSG_ERROR([Didn't find the unixodbc library dir in '$UNIXODBC_lib_check'])
fi
case "$UNIXODBC_libdir" in
/usr/lib ) UNIXODBC_lib="" ;;
/* ) UNIXODBC_lib="-L$UNIXODBC_libdir -Wl,-rpath,$UNIXODBC_libdir"
LDFLAGS="$UNIXODBC_lib $LDFLAGS"
;;
* ) AC_MSG_ERROR([The unixodbc library directory ($UNIXODBC_libdir) must be an absolute path.]) ;;
esac
AC_SUBST(UNIXODBC_lib)
AC_MSG_RESULT([$UNIXODBC_libdir])
AC_MSG_CHECKING([for unixodbc include directory])
UNIXODBC_incdir=
for m in $UNIXODBC_inc_check; do
if test -d "$m" && test -f "$m/sql.h"
then
UNIXODBC_incdir=$m
break
fi
done
if test -z "$UNIXODBC_incdir"; then
AC_MSG_ERROR([Didn't find the unixodbc include dir in '$UNIXODBC_inc_check'])
fi
case "$UNIXODBC_incdir" in
/* ) ;;
* ) AC_MSG_ERROR([The unixodbc include directory ($UNIXODBC_incdir) must be an absolute path.]) ;;
esac
AC_SUBST(UNIXODBC_incdir)
AC_MSG_RESULT([$UNIXODBC_incdir])
# LIBS="$LIBS -lunixodbc"
fi
for a in $modules
do
moduledirs="$moduledirs ${a}backend"
for b in `cat $srcdir/modules/${a}backend/OBJECTFILES`
do
moduleobjects="$moduleobjects ../modules/${a}backend/$b"
done
modulelibs="$modulelibs `cat $srcdir/modules/${a}backend/OBJECTLIBS`"
if test ${a} = "gpgsql"; then
LIBS="$LIBS $LIBCRYPT"
case "$host_os" in
freebsd*)
;;
darwin*)
modulelibs="$modulelibs -lresolv"
;;
*)
modulelibs="$modulelibs -lresolv -lnsl"
;;
esac
fi
done
for a in $dynmodules
do
moduledirs="$moduledirs ${a}backend"
done
AC_SUBST(LIBS)
export moduledirs moduleobjects modulelibs
AC_OUTPUT(Makefile modules/Makefile pdns/Makefile codedocs/Makefile \
pdns/backends/Makefile pdns/backends/bind/Makefile pdns/pdns pdns/precursor \
modules/gmysqlbackend/Makefile modules/db2backend/Makefile \
modules/geobackend/Makefile modules/opendbxbackend/Makefile \
modules/pipebackend/Makefile modules/oraclebackend/Makefile \
modules/xdbbackend/Makefile modules/godbcbackend/Makefile \
modules/gpgsqlbackend/Makefile modules/ldapbackend/Makefile \
modules/gsqlite3backend/Makefile \
modules/goraclebackend/Makefile modules/mydnsbackend/Makefile \
modules/luabackend/Makefile modules/tinydnsbackend/Makefile \
modules/remotebackend/Makefile \
modules/randombackend/Makefile)