2 AC_INIT(pdns/receiver.cc)
3 AM_INIT_AUTOMAKE(pdns, 2.9.22-snapshot)
5 AM_CONFIG_HEADER(config.h)
8 CXXFLAGS="$CXXFLAGS -Wall -O2"
10 AC_PREFIX_DEFAULT(/usr/local)
20 dnl Checks for header files.
22 AC_CHECK_HEADERS(fcntl.h getopt.h limits.h strings.h sys/time.h syslog.h unistd.h)
23 AC_CHECK_HEADERS(boost/shared_ptr.hpp, ,
24 echo Missing boost - please install Boost packages or see http://doc.powerdns.com/compiling-powerdns.html; exit)
26 dnl Checks for typedefs, structures, and compiler characteristics.
31 dnl Checks for library functions.
33 AC_CHECK_FUNCS(gethostname gettimeofday mkdir mktime select socket strerror)
41 AC_CHECK_LIB(dl,dlopen)
46 AC_MSG_CHECKING([for RTLD_NOW]);
51 [ (void) dlopen("",RTLD_NOW); ],
52 has_RTLD_NOW=yes, has_RTLD_NOW=no)
53 AC_MSG_RESULT([$has_RTLD_NOW])
54 if test "$has_RTLD_NOW" = "no"
56 AC_DEFINE(NEED_RTLD_NOW,,[If host OS misses RTLD_NOW])
65 AC_DEFINE(HAVE_IPV6,1,[If the host operating system understands IPv6])
66 LIBS="-lposix4 -lresolv -lnsl -lsocket -lpthread -lrt $LIBS"
67 CXXFLAGS="-D_REENTRANT $CXXFLAGS"
70 solaris2.8 | solaris2.9 )
71 AC_DEFINE(NEED_POSIX_TYPEDEF,,[If POSIX typedefs need to be defined])
72 AC_DEFINE(NEED_INET_NTOP_PROTO,,[If your OS is so broken that it needs an additional prototype])
73 AC_DEFINE(HAVE_IPV6,1,[If the host operating system understands IPv6])
74 LIBS="-lposix4 -lresolv -lnsl -lsocket -lpthread $LIBS"
75 CXXFLAGS="-D_REENTRANT $CXXFLAGS"
77 solaris2.6 | solaris2.7)
78 AC_DEFINE(NEED_POSIX_TYPEDEF,,[If POSIX typedefs need to be defined])
79 AC_DEFINE(NEED_INET_NTOP_PROTO,,[If your OS is so broken that it needs an additional prototype])
80 LIBS="-lposix4 -lresolv -lnsl -lsocket -lpthread $LIBS"
81 CXXFLAGS="-D_REENTRANT $CXXFLAGS"
84 AC_DEFINE(HAVE_IPV6,1,[If the host operating system understands IPv6])
85 DYNLINKFLAGS="-rdynamic"
87 THREADFLAGS="-pthread"
88 CXXFLAGS="-D_GNU_SOURCE $CXXFLAGS"
91 AC_DEFINE(HAVE_IPV6,1,[If the host operating system understands IPv6])
92 DYNLINKFLAGS="-rdynamic"
93 LDFLAGS="-lc_r $LDFLAGS"
94 CXXFLAGS="-pthread $CXXFLAGS"
97 AC_DEFINE(HAVE_IPV6,1,[If the host operating system understands IPv6])
98 DYNLINKFLAGS="-rdynamic"
99 LDFLAGS="-pthread $LDFLAGS"
100 CXXFLAGS="-pthread $CXXFLAGS"
104 AC_SUBST(THREADFLAGS)
106 AC_SUBST(DYNLINKFLAGS)
108 AC_MSG_CHECKING(whether we will be doing verbose logging)
109 AC_ARG_ENABLE(verbose-logging,
110 [ --enable-verbose-logging Do verbose logging],enable_verbose_logging=yes ,enable_verbose_logging=no)
112 if test $enable_verbose_logging = yes; then AC_DEFINE(VERBOSELOG, 1, [If verbose logging should be enabled])
114 AC_MSG_RESULT($enable_verbose_logging)
116 AC_MSG_CHECKING(whether we should build static binaries)
118 AC_ARG_ENABLE(static-binaries,
119 [ --enable-static-binaries Build static binaries],
120 [case "${enableval}" in
123 *) AC_MSG_ERROR(bad value ${enableval} for --enable-static-binaries) ;;
125 AC_MSG_RESULT($static)
127 AM_CONDITIONAL(ALLSTATIC, test x$static = xtrue)
129 if test x$static = xtrue;
131 LDFLAGS="-all-static $LDFLAGS"
137 AC_ARG_WITH(modules, [ --with-modules Which backends to compile with ],
143 AC_ARG_WITH(dynmodules, [ --with-dynmodules Which backends to build for dynamic loading ],
145 dynmodules="$withval"
152 AC_ARG_WITH(socketdir, [ --with-socketdir Where the controlsocket lives ],
158 AC_SUBST(moduleobjects)
161 AC_MSG_CHECKING(whether we will be building the server)
162 AC_ARG_ENABLE(pdns-server,
163 [ --enable-pdns_server If we should build the server],
164 enable_pdns_server=$enableval,
165 enable_pdns_server=yes)
167 AC_MSG_RESULT($enable_pdns_server)
169 if test x"$enable_pdns_server" = "xyes"
174 AC_SUBST(programdescend)
176 AC_ARG_ENABLE(gcc-skip-locking,
177 [ --enable-gcc-skip-locking If we should forcefully skip gcc locking],
178 AC_DEFINE(GCC_SKIP_LOCKING,,[Skip gcc locking]),
181 AC_MSG_CHECKING(whether we will be building the recursor)
182 AC_ARG_ENABLE(recursor,
183 [ --enable-recursor If we should build the recursor],
184 enable_recursor=$enableval,
187 AC_MSG_RESULT($enable_recursor)
189 AM_CONDITIONAL(RECURSOR,test x"$enable_recursor" = "xyes")
192 AC_MSG_CHECKING(whether we should use nedmalloc allocator)
193 AC_ARG_ENABLE(nedmalloc,
194 [ --enable-nedmalloc If we should use nedmalloc],
195 enable_nedmalloc=$enableval,
196 if echo $host_os | grep -i freebsd > /dev/null
203 AC_MSG_RESULT($enable_nedmalloc)
205 AM_CONDITIONAL(NEDMALLOC,test x"$enable_nedmalloc" = "xyes")
208 for a in $modules $dynmodules
230 AC_CHECK_HEADERS([ldap.h], , [AC_MSG_ERROR([ldap header (ldap.h) not found])])
231 AC_CHECK_HEADERS([lber.h], , [AC_MSG_ERROR([ldap header (lber.h) not found])])
234 [ldap_r], [ldap_set_option],
235 [AC_DEFINE([HAVE_LIBLDAP_R], 1, [Have -lldap_r]) LIBLDAP="ldap_r"],
237 [ldap], [ldap_set_option],
238 [AC_DEFINE([HAVE_LIBLDAP], 1, [Have -lldap]) LIBLDAP="ldap"],
239 [AC_MSG_ERROR([ldap library (libldap) not found])]
243 [$LIBLDAP], [ldap_initialize],
244 [AC_DEFINE([HAVE_LDAP_INITIALIZE], 1, [Define to 1 if you have ldap_initialize])]
247 [$LIBLDAP], [ldap_sasl_bind],
248 [AC_DEFINE([HAVE_LDAP_SASL_BIND], 1, [Define to 1 if you have ldap_sasl_bind])]
252 AC_CHECK_HEADERS([odbx.h], , [AC_MSG_ERROR([opendbx header (odbx.h) not found])])
253 AC_SUBST([LIBOPENDBX])
255 [opendbx], [odbx_init],
256 [AC_DEFINE([HAVE_LIBOPENDBX], 1, [Have -lopendbx]) LIBOPENDBX="opendbx"]
266 [ --with-mysql=<path> root directory path of MySQL installation],
267 [MYSQL_lib_check="$withval/lib/mysql $with_mysql/lib"
268 MYSQL_inc_check="$withval/include/mysql"],
269 [MYSQL_lib_check="/usr/local/mysql/lib/mysql /usr/local/lib/mysql /opt/mysql/lib/mysql \
270 /usr/lib/mysql /usr/local/mysql/lib /usr/local/lib /opt/mysql/lib /usr/lib \
272 MYSQL_inc_check="/usr/local/mysql/include/mysql /usr/local/include/mysql \
273 /opt/mysql/include/mysql /opt/mysql/include /usr/include/mysql /usr/sfw/include/mysql"])
274 AC_ARG_WITH(mysql-lib,
275 [ --with-mysql-lib=<path> directory path of MySQL library installation],
276 [MYSQL_lib_check="$withval/lib/mysql $withval/mysql $withval"])
277 AC_ARG_WITH(mysql-includes,
278 [ --with-mysql-includes=<path>
279 directory path of MySQL header installation],
280 [MYSQL_inc_check="$withval/include/mysql $withval/mysql $withval"])
281 AC_MSG_CHECKING([for MySQL library directory])
283 for m in $MYSQL_lib_check; do
285 (test -f "$m/libmysqlclient.so" || test -f "$m/libmysqlclient.a")
291 if test -z "$MYSQL_libdir"; then
292 AC_MSG_ERROR([Didn't find the mysql library dir in '$MYSQL_lib_check'])
294 case "$MYSQL_libdir" in
295 /usr/lib ) MYSQL_lib="" ;;
296 /* ) MYSQL_lib=-L$MYSQL_libdir; LDFLAGS="$MYSQL_lib $LDFLAGS";;
297 * ) AC_MSG_ERROR([The MySQL library directory ($MYSQL_libdir) must be an absolute path.]) ;;
302 AC_MSG_RESULT([$MYSQL_libdir])
303 AC_MSG_CHECKING([for MySQL include directory])
305 for m in $MYSQL_inc_check; do
306 if test -d "$m" && test -f "$m/mysql.h"
312 if test -z "$MYSQL_incdir"; then
313 AC_MSG_ERROR([Didn't find the mysql include dir in '$MYSQL_inc_check'])
316 case "$MYSQL_incdir" in
318 * ) AC_MSG_ERROR([The MySQL include directory ($MYSQL_incdir) must be an absolute path.]) ;;
321 AC_SUBST(MYSQL_incdir)
322 AC_MSG_RESULT([$MYSQL_incdir])
323 # LIBS="$LIBS -lmysqlclient"
331 [ --with-pgsql=<path> root directory path of PgSQL installation],
332 [PGSQL_lib_check="$withval/lib/pgsql $with_pgsql/lib"
333 PGSQL_inc_check="$withval/include/pgsql"],
334 [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"
335 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"])
336 AC_ARG_WITH(pgsql-lib,
337 [ --with-pgsql-lib=<path> directory path of PgSQL library installation],
338 [PGSQL_lib_check="$withval/lib/pgsql $withval/pgsql $withval"])
339 AC_ARG_WITH(pgsql-includes,
340 [ --with-pgsql-includes=<path>
341 directory path of PgSQL header installation],
342 [PGSQL_inc_check="$withval/include/pgsql $withval/pgsql $withval"])
343 AC_MSG_CHECKING([for PgSQL library directory])
345 for m in $PGSQL_lib_check; do
347 (test -f "$m/libpq.a" || test -f "$m/libpq++.a")
353 if test -z "$PGSQL_libdir"; then
354 AC_MSG_ERROR([Didn't find the pgsql library dir in '$PGSQL_lib_check'])
356 case "$PGSQL_libdir" in
357 /usr/lib ) PGSQL_lib="" ;;
358 /* ) PGSQL_lib="-L$PGSQL_libdir -Wl,-rpath,$PGSQL_libdir"
359 LDFLAGS="$PGSQL_lib $LDFLAGS"
361 * ) AC_MSG_ERROR([The PgSQL library directory ($PGSQL_libdir) must be an absolute path.]) ;;
365 AC_MSG_RESULT([$PGSQL_libdir])
366 AC_MSG_CHECKING([for PgSQL include directory])
368 for m in $PGSQL_inc_check; do
369 if test -d "$m" && test -f "$m/libpq-fe.h"
375 if test -z "$PGSQL_incdir"; then
376 AC_MSG_ERROR([Didn't find the PgSQL include dir in '$PGSQL_inc_check'])
378 case "$PGSQL_incdir" in
380 * ) AC_MSG_ERROR([The PgSQL include directory ($PGSQL_incdir) must be an absolute path.]) ;;
382 AC_SUBST(PGSQL_incdir)
383 AC_MSG_RESULT([$PGSQL_incdir])
385 # LIBS="$LIBS -lpq++ -lpq -lssl -lcrypt -lcrypto"
389 if test "$needsqlite"
392 [ --with-sqlite=<path> root directory path of SQLite installation],
393 [SQLITE_lib_check="$withval/lib/sqlite $with_sqlite/lib"
394 SQLITE_inc_check="$withval/include/sqlite"],
395 [SQLITE_lib_check="/usr/local/sqlite/lib/sqlite /usr/local/lib/sqlite /opt/pgsql/lib/sqlite /usr/lib/sqlite /usr/local/sqlite/lib /usr/local/lib /opt/sqlite/lib /usr/lib"
396 SQLITE_inc_check="/usr/local/sqlite/include/sqlite /usr/local/include/sqlite/ /usr/local/include /opt/sqlite/include/sqlite /opt/sqlite/include /usr/include/ /usr/include/sqlite"])
397 AC_ARG_WITH(sqlite-lib,
398 [ --with-sqlite-lib=<path> directory path of SQLite library installation],
399 [SQLITE_lib_check="$withval/lib/sqlite $withval/sqlite $withval"])
400 AC_ARG_WITH(sqlite-includes,
401 [ --with-sqlite-includes=<path>
402 directory path of SQLite header installation],
403 [SQLITE_inc_check="$withval/include/sqlite $withval/sqlite $withval"])
404 AC_MSG_CHECKING([for SQLite library directory])
406 for m in $SQLITE_lib_check; do
408 (test -f "$m/libsqlite.so" || test -f "$m/libsqlite.a")
414 if test -z "$SQLITE_libdir"; then
415 AC_MSG_ERROR([Didn't find the sqlite library dir in '$SQLITE_lib_check'])
417 case "$SQLITE_libdir" in
418 /usr/lib ) SQLITE_lib="" ;;
419 /* ) SQLITE_lib="-L$SQLITE_libdir -Wl,-rpath,$SQLITE_libdir"
420 LDFLAGS="$SQLITE_lib $LDFLAGS"
422 * ) AC_MSG_ERROR([The SQLite library directory ($SQLITE_libdir) must be an absolute path.]) ;;
426 AC_MSG_RESULT([$SQLITE_libdir])
427 AC_MSG_CHECKING([for SQLite include directory])
429 for m in $SQLITE_inc_check; do
430 if test -d "$m" && test -f "$m/sqlite.h"
436 if test -z "$SQLITE_incdir"; then
437 AC_MSG_ERROR([Didn't find the SQLite include dir in '$SQLITE_inc_check'])
439 case "$SQLITE_incdir" in
441 * ) AC_MSG_ERROR([The SQLite include directory ($SQLITE_incdir) must be an absolute path.]) ;;
443 AC_SUBST(SQLITE_incdir)
444 AC_MSG_RESULT([$SQLITE_incdir])
446 # LIBS="$LIBS -lsqlite"
449 if test "$needsqlite3"
452 [ --with-sqlite3=<path> root directory path of SQLite3 installation],
453 [SQLITE3_lib_check="$withval/lib/sqlite3 $with_sqlite3/lib"
454 SQLITE3_inc_check="$withval/include/sqlite3"],
455 [SQLITE3_lib_check="/usr/local/sqlite3/lib/sqlite3 /usr/local/lib/sqlite3 /usr/lib/sqlite3 /usr/local/sqlite3/lib /usr/local/lib /opt/sqlite3/lib /usr/lib"
456 SQLITE3_inc_check="/usr/local/sqlite3/include/sqlite3 /usr/local/include/sqlite3/ /usr/local/include /opt/sqlite3/include/sqlite3 /opt/sqlite3/include /usr/include/ /usr/include/sqlite3"])
457 AC_ARG_WITH(sqlite3-lib,
458 [ --with-sqlite3-lib=<path> directory path of SQLite3 library installation],
459 [SQLITE3_lib_check="$withval/lib/sqlite3 $withval/sqlite3 $withval"])
460 AC_ARG_WITH(sqlite3-includes,
461 [ --with-sqlite3-includes=<path> directory path of SQLite3 header installation],
462 [SQLITE3_inc_check="$withval/include/sqlite3 $withval/sqlite3 $withval"])
463 AC_MSG_CHECKING([for SQLite3 library directory])
465 for m in $SQLITE3_lib_check; do
467 (test -f "$m/libsqlite3.so" || test -f "$m/libsqlite3.a")
473 if test -z "$SQLITE3_libdir"; then
474 AC_MSG_ERROR([Didn't find the sqlite3 library dir in '$SQLITE3_lib_check'])
476 case "$SQLITE3_libdir" in
477 /usr/lib ) SQLITE3_lib="" ;;
478 /* ) SQLITE3_lib="-L$SQLITE3_libdir -Wl,-rpath,$SQLITE3_libdir"
479 LDFLAGS="$SQLITE3_lib $LDFLAGS"
481 * ) AC_MSG_ERROR([The SQLite3 library directory ($SQLITE3_libdir) must be an absolute path.]) ;;
484 AC_SUBST(SQLITE3_lib)
485 AC_MSG_RESULT([$SQLITE3_libdir])
486 AC_MSG_CHECKING([for SQLite3 include directory])
488 for m in $SQLITE3_inc_check; do
489 if test -d "$m" && test -f "$m/sqlite3.h"
495 if test -z "$SQLITE3_incdir"; then
496 AC_MSG_ERROR([Didn't find the SQLite3 include dir in '$SQLITE3_inc_check'])
498 case "$SQLITE3_incdir" in
500 * ) AC_MSG_ERROR([The SQLite3 include directory ($SQLITE3_incdir) must be an absolute path.]) ;;
502 AC_SUBST(SQLITE3_incdir)
503 AC_MSG_RESULT([$SQLITE3_incdir])
505 # LIBS="$LIBS -lsqlite3"
511 moduledirs="$moduledirs ${a}backend"
513 for b in `cat $srcdir/modules/${a}backend/OBJECTFILES`
515 moduleobjects="$moduleobjects ../modules/${a}backend/$b"
517 modulelibs="$modulelibs `cat $srcdir/modules/${a}backend/OBJECTLIBS`"
522 moduledirs="$moduledirs ${a}backend"
527 export moduledirs moduleobjects modulelibs
529 AC_OUTPUT(Makefile modules/Makefile pdns/Makefile codedocs/Makefile \
530 pdns/backends/Makefile pdns/backends/bind/Makefile pdns/pdns pdns/precursor \
531 modules/mysqlbackend/Makefile modules/pdnsbackend/Makefile \
532 modules/gmysqlbackend/Makefile modules/db2backend/Makefile \
533 modules/geobackend/Makefile modules/opendbxbackend/Makefile \
534 modules/pipebackend/Makefile modules/oraclebackend/Makefile \
535 modules/xdbbackend/Makefile modules/odbcbackend/Makefile \
536 modules/gpgsqlbackend/Makefile modules/ldapbackend/Makefile
537 modules/gsqlitebackend/Makefile modules/gsqlite3backend/Makefile
538 modules/goraclebackend/Makefile )