dnl intro AC_INIT(pdns/receiver.cc) AM_INIT_AUTOMAKE(pdns, 2.9.12) AC_CANONICAL_HOST AM_CONFIG_HEADER(config.h) AC_C_BIGENDIAN AC_PREREQ(2.52) CXXFLAGS="$CXXFLAGS -Wall -O2" AC_PREFIX_DEFAULT(/usr/local) AC_PROG_CC AC_PROG_CXX AC_PROG_YACC AM_PROG_LEX AC_PROG_INSTALL AC_PROG_MAKE_SET AM_PROG_LIBTOOL AC_LANG_CPLUSPLUS 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) # Check for libdl 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 ], [ (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 DYNLINKFLAGS="" THREADFLAGS="" case "$host_os" in 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" THREADFLAGS="-pthread" CXXFLAGS="-D_GNU_SOURCE $CXXFLAGS" ;; openbsd*) AC_DEFINE(HAVE_IPV6,1,[If the host operating system understands IPv6]) DYNLINKFLAGS="-rdynamic" LDFLAGS="-lc_r $LDFLAGS" CXXFLAGS="-pthread $CXXFLAGS" ;; *) 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, [ --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_MSG_CHECKING(whether we should build static binaries) AC_ARG_ENABLE(static-binaries, [ --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" AC_ARG_WITH(modules, [ --with-modules Which userbases to compile with ], [ modules="$withval" ]) dynmodules="pipe" AC_ARG_WITH(dynmodules, [ --with-dynmodules Which userbases to build for dynamic loading ], [ dynmodules="$withval" ]) AC_SUBST(socketdir) socketdir="/var/run" AC_ARG_WITH(socketdir, [ --with-socketdir Where the controlsocket lives ], [ socketdir="$withval" ]) AC_SUBST(moduledirs) AC_SUBST(moduleobjects) AC_SUBST(modulelibs) AC_MSG_CHECKING(whether we will be building the server) AC_ARG_ENABLE(pdns-server, [ --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_MSG_CHECKING(whether we will be building the recursor) AC_ARG_ENABLE(recursor, [ --enable-recursor If we should build the server], enable_recursor=$enableval, enable_recursor=no) AC_MSG_RESULT($enable_recursor) AM_CONDITIONAL(RECURSOR,test x"$enable_recursor" = "xyes") for a in $modules $dynmodules do case "$a" in mysql ) needmysql=yes ;; gmysql ) needmysql=yes ;; gpgsql ) needpgsql=yes ;; pdns ) needmysql=yes ;; esac done if test "$needmysql" then AC_ARG_WITH(mysql, [ --with-mysql= root directory path of MySQL installation], [MYSQL_lib_check="$withval/lib/mysql $with_mysql/lib" MYSQL_inc_check="$withval/include/mysql"], [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" MYSQL_inc_check="/usr/local/mysql/include/mysql /usr/local/include/mysql /opt/mysql/include/mysql /opt/mysql/include /usr/include/mysql"]) AC_ARG_WITH(mysql-lib, [ --with-mysql-lib= directory path of MySQL library installation], [MYSQL_lib_check="$withval/lib/mysql $withval/mysql $withval"]) AC_ARG_WITH(mysql-includes, [ --with-mysql-includes= directory path of MySQL header installation], [MYSQL_inc_check="$withval/include/mysql $withval/mysql $withval"]) 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([Didn't find the mysql library dir in '$MYSQL_lib_check']) fi case "$MYSQL_libdir" in /usr/lib ) MYSQL_lib="" ;; /* ) MYSQL_lib=-L$MYSQL_libdir; LDFLAGS="$MYSQL_lib $LDFLAGS";; * ) AC_MSG_ERROR([The MySQL library directory ($MYSQL_libdir) must be an absolute path.]) ;; esac AC_SUBST(MYSQL_lib) AC_MSG_RESULT([$MYSQL_libdir]) AC_MSG_CHECKING([for MySQL include directory]) MYSQL_incdir= for m in $MYSQL_inc_check; do if test -d "$m" && test -f "$m/mysql.h" then MYSQL_incdir=$m break fi done if test -z "$MYSQL_incdir"; then AC_MSG_ERROR([Didn't find the mysql include dir in '$MYSQL_inc_check']) fi case "$MYSQL_incdir" in /* ) ;; * ) AC_MSG_ERROR([The MySQL include directory ($MYSQL_incdir) must be an absolute path.]) ;; esac AC_SUBST(MYSQL_incdir) AC_MSG_RESULT([$MYSQL_incdir]) # LIBS="$LIBS -lmysqlclient" fi if test "$needpgsql" then AC_ARG_WITH(pgsql, [ --with-pgsql= 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" 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"]) AC_ARG_WITH(pgsql-lib, [ --with-pgsql-lib= directory path of PgSQL library installation], [PGSQL_lib_check="$withval/lib/pgsql $withval/pgsql $withval"]) AC_ARG_WITH(pgsql-includes, [ --with-pgsql-includes= 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++.so" || test -f "$m/libpq++.a") 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="" ;; /* ) 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++.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]) # LIBS="$LIBS -lpq++ -lpq -lssl -lcrypt -lcrypto" 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`" done for a in $dynmodules do moduledirs="$moduledirs ${a}backend" done export moduledirs moduleobjects modulelibs AC_OUTPUT(Makefile modules/Makefile pdns/Makefile codedocs/Makefile \ pdns/backends/Makefile pdns/backends/bind/Makefile pdns/pdns \ modules/mysqlbackend/Makefile modules/pdnsbackend/Makefile \ modules/gmysqlbackend/Makefile modules/db2backend/Makefile \ modules/pipebackend/Makefile modules/oraclebackend/Makefile \ modules/xdbbackend/Makefile modules/odbcbackend/Makefile \ modules/gpgsqlbackend/Makefile modules/ldapbackend/Makefile )