2 AC_INIT(pdns/receiver.cc)
3 AM_INIT_AUTOMAKE(pdns, 2.9)
4 AM_CONFIG_HEADER(config.h)
5 CXXFLAGS="-Wall -pthread -O2"
7 AC_PREFIX_DEFAULT(/usr/local)
17 dnl Checks for header files.
19 AC_CHECK_HEADERS(fcntl.h getopt.h limits.h strings.h sys/time.h syslog.h unistd.h)
21 dnl Checks for typedefs, structures, and compiler characteristics.
26 dnl Checks for library functions.
27 AC_FUNC_SETVBUF_REVERSED
30 AC_CHECK_FUNCS(gethostname gettimeofday mkdir mktime select socket strerror)
39 AC_CHECK_LIB(dl,dlopen)
46 # pthread_create is in standard libraries (As in BSDI 3.0)
47 AC_MSG_CHECKING("for pthread_create in -libc");
49 [#include <pthread.h>],
50 [ (void) pthread_create((pthread_t*) 0,(pthread_attr_t*) 0, 0, 0); ],
51 with_posix_threads=yes, with_posix_threads=no)
52 AC_MSG_RESULT("$with_posix_threads")
53 if test "$with_posix_threads" = "no"
55 AC_MSG_CHECKING("for pthread_create in -lpthread");
57 LIBS="$LIBS -lpthread"
59 [#include <pthread.h>],
60 [ (void) pthread_create((pthread_t*) 0,(pthread_attr_t*) 0, 0, 0); ],
61 with_posix_threads=yes, with_posix_threads=no)
62 AC_MSG_RESULT("$with_posix_threads")
63 if test "$with_posix_threads" = "no"
65 LIBS=" $ac_save_LIBS -lpthreads"
66 AC_MSG_CHECKING("for pthread_create in -lpthreads");
68 [#include <pthread.h>],
69 [ pthread_create((pthread_t*) 0,(pthread_attr_t*) 0, 0, 0); ],
70 with_posix_threads=yes, with_posix_threads=no)
71 AC_MSG_RESULT("$with_posix_threads")
72 if test "$with_posix_threads" = "no"
75 LIBS="$ac_save_LIBS -pthread"
76 AC_MSG_CHECKING("for pthread_create in -pthread");
78 [#include <pthread.h>],
79 [ pthread_create((pthread_t*) 0,(pthread_attr_t*) 0, 0, 0); ],
80 with_posix_threads=yes, with_posix_threads=no)
81 AC_MSG_RESULT("$with_posix_threads")
82 if test "$with_posix_threads" = "no"
84 with_mit_threads="yes"
92 solaris2*) AC_DEFINE(NEED_POSIX_TYPEDEF)
98 AC_MSG_CHECKING(whether we will be doing verbose logging)
99 AC_ARG_ENABLE(verbose-logging,
100 [ --enable-verbose-logging Do verbose logging],enable_verbose_logging=yes ,enable_verbose_logging=no)
102 if test $enable_verbose_logging = yes; then AC_DEFINE(VERBOSELOG, 1)
104 AC_MSG_RESULT($enable_verbose_logging)
106 AC_MSG_CHECKING(whether we should build static binaries)
107 AC_ARG_ENABLE(static-binaries,
108 [ --enable-static-binaries Build static binaries],enable_static_binaries=yes ,enable_static_binaries=no)
110 if test $enable_static_binaries = yes;
112 LDFLAGS="-all-static $LD_FLAGS"
114 AC_MSG_RESULT($enable_static_binaries)
118 AC_ARG_WITH(modules, [ --with-modules Which userbases to compile with ],
126 AC_ARG_WITH(socketdir, [ --with-socketdir Where the controlsocket lives ],
133 AC_SUBST(moduleobjects)
138 moduledirs="$moduledirs ${a}backend"
143 # Location of MySQL installation
146 [ --with-mysql=<path> root directory path of MySQL installation],
147 [MYSQL_lib_check="$withval/lib/mysql $with_mysql/lib"
148 MYSQL_inc_check="$withval/include/mysql"],
149 [MYSQL_lib_check="/usr/local/mysql/lib/mysql /usr/local/lib/mysql /opt/mysql/lib/mysql /usr/lib/mysql /usr/local/mysql/lib /usr/local/lib /opt/mysql/lib /usr/lib"
150 MYSQL_inc_check="/usr/local/mysql/include/mysql /usr/local/include/mysql /opt/mysql/include/mysql /opt/mysql/include /usr/include/mysql"])
152 AC_ARG_WITH(mysql-lib,
153 [ --with-mysql-lib=<path> directory path of MySQL library installation],
154 [MYSQL_lib_check="$withval/lib/mysql $withval/mysql $withval"])
156 AC_ARG_WITH(mysql-includes,
157 [ --with-mysql-includes=<path>
158 directory path of MySQL header installation],
159 [MYSQL_inc_check="$withval/include/mysql $withval/mysql $withval"])
161 AC_MSG_CHECKING([for MySQL library directory])
163 for m in $MYSQL_lib_check; do
165 (test -f "$m/libmysqlclient.so" || test -f "$m/libmysqlclient.a")
172 if test -z "$MYSQL_libdir"; then
173 AC_MSG_ERROR([Didn't find the mysql library dir in '$MYSQL_lib_check'])
176 case "$MYSQL_libdir" in
177 /usr/lib ) MYSQL_lib="";;
178 /* ) MYSQL_lib=-L$MYSQL_libdir;;
179 * ) AC_MSG_ERROR([The MySQL library directory ($MYSQL_libdir) must be an absolute path.]) ;;
183 AC_MSG_RESULT([$MYSQL_libdir])
185 AC_MSG_CHECKING([for MySQL include directory])
187 for m in $MYSQL_inc_check; do
188 if test -d "$m" && test -f "$m/mysql.h"
195 if test -z "$MYSQL_incdir"; then
196 AC_MSG_ERROR([Didn't find the mysql include dir in '$MYSQL_inc_check'])
199 case "$MYSQL_incdir" in
201 * ) AC_MSG_ERROR([The MySQL include directory ($MYSQL_incdir) must be an absolute path.]) ;;
204 AC_SUBST(MYSQL_incdir)
205 AC_MSG_RESULT([$MYSQL_incdir])
209 for b in $(cat modules/${a}backend/OBJECTFILES)
211 moduleobjects="$moduleobjects ../modules/${a}backend/$b"
213 modulelibs="$modulelibs $(cat modules/${a}backend/OBJECTLIBS)"
215 export moduledirs moduleobjects modulelibs
217 AC_OUTPUT(Makefile modules/Makefile pdns/Makefile pdns/codedocs/Makefile \
218 pdns/backends/bind/Makefile pdns/backends/Makefile pdns/pdns \
219 modules/mysqlbackend/Makefile modules/pdnsbackend/Makefile \
220 modules/pgmysqlbackend/Makefile modules/db2backend/Makefile)