2 AC_INIT(pdns/receiver.cc)
3 AM_INIT_AUTOMAKE(pdns, 2.9.9)
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)
24 dnl Checks for typedefs, structures, and compiler characteristics.
29 dnl Checks for library functions.
31 AC_CHECK_FUNCS(gethostname gettimeofday mkdir mktime select socket strerror)
37 AC_CHECK_LIB(dl,dlopen)
42 AC_MSG_CHECKING([for RTLD_NOW]);
47 [ (void) dlopen("",RTLD_NOW); ],
48 has_RTLD_NOW=yes, has_RTLD_NOW=no)
49 AC_MSG_RESULT([$has_RTLD_NOW])
50 if test "$has_RTLD_NOW" = "no"
52 AC_DEFINE(NEED_RTLD_NOW,,[If host OS misses RTLD_NOW])
60 solaris2.8 | solaris2.9 )
61 AC_DEFINE(NEED_POSIX_TYPEDEF,,[If POSIX typedefs need to be defined])
62 AC_DEFINE(NEED_INET_NTOP_PROTO,,[If your OS is so broken that it needs an additional prototype])
63 AC_DEFINE(HAVE_IPV6,1,[If the host operating system understands IPv6])
64 LIBS="-lposix4 -lresolv -lnsl -lsocket -lpthread $LIBS"
65 CXXFLAGS="-D_REENTRANT $CXXFLAGS"
67 solaris2.6 | solaris2.7)
68 AC_DEFINE(NEED_POSIX_TYPEDEF,,[If POSIX typedefs need to be defined])
69 AC_DEFINE(NEED_INET_NTOP_PROTO,,[If your OS is so broken that it needs an additional prototype])
70 LIBS="-lposix4 -lresolv -lnsl -lsocket -lpthread $LIBS"
71 CXXFLAGS="-D_REENTRANT $CXXFLAGS"
74 AC_DEFINE(HAVE_IPV6,1,[If the host operating system understands IPv6])
75 DYNLINKFLAGS="-rdynamic"
77 THREADFLAGS="-pthread"
78 CXXFLAGS="-D_GNU_SOURCE $CXXFLAGS"
81 AC_DEFINE(HAVE_IPV6,1,[If the host operating system understands IPv6])
82 DYNLINKFLAGS="-rdynamic"
83 LDFLAGS="-lc_r $LDFLAGS"
84 CXXFLAGS="-pthread $CXXFLAGS"
87 AC_DEFINE(HAVE_IPV6,1,[If the host operating system understands IPv6])
88 DYNLINKFLAGS="-rdynamic"
89 LDFLAGS="-pthread $LDFLAGS"
90 CXXFLAGS="-pthread $CXXFLAGS"
96 AC_SUBST(DYNLINKFLAGS)
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, [If verbose logging should be enabled])
104 AC_MSG_RESULT($enable_verbose_logging)
106 AC_MSG_CHECKING(whether we should build static binaries)
108 AC_ARG_ENABLE(static-binaries,
109 [ --enable-static-binaries Build static binaries],
110 [case "${enableval}" in
113 *) AC_MSG_ERROR(bad value ${enableval} for --enable-static-binaries) ;;
115 AC_MSG_RESULT($static)
117 AM_CONDITIONAL(ALLSTATIC, test x$static = xtrue)
119 if test x$static = xtrue;
121 LDFLAGS="-all-static $LDFLAGS"
127 AC_ARG_WITH(modules, [ --with-modules Which userbases to compile with ],
133 AC_ARG_WITH(dynmodules, [ --with-dynmodules Which userbases to build for dynamic loading ],
135 dynmodules="$withval"
142 AC_ARG_WITH(socketdir, [ --with-socketdir Where the controlsocket lives ],
148 AC_SUBST(moduleobjects)
151 AC_MSG_CHECKING(whether we will be building the server)
152 AC_ARG_ENABLE(pdns-server,
153 [ --enable-pdns_server If we should build the server],
154 enable_pdns_server=$enableval,
155 enable_pdns_server=yes)
157 AC_MSG_RESULT($enable_pdns_server)
159 if test x"$enable_pdns_server" = "xyes"
164 AC_SUBST(programdescend)
167 AC_MSG_CHECKING(whether we will be building the recursor)
168 AC_ARG_ENABLE(recursor,
169 [ --enable-recursor If we should build the server],
170 enable_recursor=$enableval,
173 AC_MSG_RESULT($enable_recursor)
175 AM_CONDITIONAL(RECURSOR,test x"$enable_recursor" = "xyes")
177 for a in $modules $dynmodules
199 [ --with-mysql=<path> root directory path of MySQL installation],
200 [MYSQL_lib_check="$withval/lib/mysql $with_mysql/lib"
201 MYSQL_inc_check="$withval/include/mysql"],
202 [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"
203 MYSQL_inc_check="/usr/local/mysql/include/mysql /usr/local/include/mysql /opt/mysql/include/mysql /opt/mysql/include /usr/include/mysql"])
204 AC_ARG_WITH(mysql-lib,
205 [ --with-mysql-lib=<path> directory path of MySQL library installation],
206 [MYSQL_lib_check="$withval/lib/mysql $withval/mysql $withval"])
207 AC_ARG_WITH(mysql-includes,
208 [ --with-mysql-includes=<path>
209 directory path of MySQL header installation],
210 [MYSQL_inc_check="$withval/include/mysql $withval/mysql $withval"])
211 AC_MSG_CHECKING([for MySQL library directory])
213 for m in $MYSQL_lib_check; do
215 (test -f "$m/libmysqlclient.so" || test -f "$m/libmysqlclient.a")
221 if test -z "$MYSQL_libdir"; then
222 AC_MSG_ERROR([Didn't find the mysql library dir in '$MYSQL_lib_check'])
224 case "$MYSQL_libdir" in
225 /usr/lib ) MYSQL_lib="" ;;
226 /* ) MYSQL_lib=-L$MYSQL_libdir; LDFLAGS="$MYSQL_lib $LDFLAGS";;
227 * ) AC_MSG_ERROR([The MySQL library directory ($MYSQL_libdir) must be an absolute path.]) ;;
232 AC_MSG_RESULT([$MYSQL_libdir])
233 AC_MSG_CHECKING([for MySQL include directory])
235 for m in $MYSQL_inc_check; do
236 if test -d "$m" && test -f "$m/mysql.h"
242 if test -z "$MYSQL_incdir"; then
243 AC_MSG_ERROR([Didn't find the mysql include dir in '$MYSQL_inc_check'])
246 case "$MYSQL_incdir" in
248 * ) AC_MSG_ERROR([The MySQL include directory ($MYSQL_incdir) must be an absolute path.]) ;;
251 AC_SUBST(MYSQL_incdir)
252 AC_MSG_RESULT([$MYSQL_incdir])
253 # LIBS="$LIBS -lmysqlclient"
261 [ --with-pgsql=<path> root directory path of PgSQL installation],
262 [PGSQL_lib_check="$withval/lib/pgsql $with_pgsql/lib"
263 PGSQL_inc_check="$withval/include/pgsql"],
264 [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"
265 PGSQL_inc_check="/usr/local/pgsql/include/pgsql /usr/local/include/postgresql/ /usr/local/include /opt/pgsql/include/pgsql /opt/pgsql/include /usr/include/pgsql/ /usr/include/postgresql"])
266 AC_ARG_WITH(pgsql-lib,
267 [ --with-pgsql-lib=<path> directory path of PgSQL library installation],
268 [PGSQL_lib_check="$withval/lib/pgsql $withval/pgsql $withval"])
269 AC_ARG_WITH(pgsql-includes,
270 [ --with-pgsql-includes=<path>
271 directory path of PgSQL header installation],
272 [PGSQL_inc_check="$withval/include/pgsql $withval/pgsql $withval"])
273 AC_MSG_CHECKING([for PgSQL library directory])
275 for m in $PGSQL_lib_check; do
277 (test -f "$m/libpq++.so" || test -f "$m/libpq++.a")
283 if test -z "$PGSQL_libdir"; then
284 AC_MSG_ERROR([Didn't find the pgsql library dir in '$PGSQL_lib_check'])
286 case "$PGSQL_libdir" in
287 /usr/lib ) PGSQL_lib="" ;;
288 /* ) PGSQL_lib="-L$PGSQL_libdir -Wl,-rpath,$PGSQL_libdir"
289 LDFLAGS="$PGSQL_lib $LDFLAGS"
291 * ) AC_MSG_ERROR([The PgSQL library directory ($PGSQL_libdir) must be an absolute path.]) ;;
295 AC_MSG_RESULT([$PGSQL_libdir])
296 AC_MSG_CHECKING([for PgSQL include directory])
298 for m in $PGSQL_inc_check; do
299 if test -d "$m" && test -f "$m/libpq++.h"
305 if test -z "$PGSQL_incdir"; then
306 AC_MSG_ERROR([Didn't find the PgSQL include dir in '$PGSQL_inc_check'])
308 case "$PGSQL_incdir" in
310 * ) AC_MSG_ERROR([The PgSQL include directory ($PGSQL_incdir) must be an absolute path.]) ;;
312 AC_SUBST(PGSQL_incdir)
313 AC_MSG_RESULT([$PGSQL_incdir])
315 # LIBS="$LIBS -lpq++ -lpq -lssl -lcrypt -lcrypto"
321 moduledirs="$moduledirs ${a}backend"
323 for b in `cat $srcdir/modules/${a}backend/OBJECTFILES`
325 moduleobjects="$moduleobjects ../modules/${a}backend/$b"
327 modulelibs="$modulelibs `cat $srcdir/modules/${a}backend/OBJECTLIBS`"
332 moduledirs="$moduledirs ${a}backend"
335 export moduledirs moduleobjects modulelibs
337 AC_OUTPUT(Makefile modules/Makefile pdns/Makefile codedocs/Makefile \
338 pdns/backends/Makefile pdns/backends/bind/Makefile pdns/pdns \
339 modules/mysqlbackend/Makefile modules/pdnsbackend/Makefile \
340 modules/gmysqlbackend/Makefile modules/db2backend/Makefile \
341 modules/pipebackend/Makefile modules/oraclebackend/Makefile \
342 modules/xdbbackend/Makefile modules/odbcbackend/Makefile \
343 modules/gpgsqlbackend/Makefile modules/ldapbackend/Makefile )