dnl intro AC_INIT(pdns/receiver.cc) AM_INIT_AUTOMAKE(pdns, 2.9.1) AC_CANONICAL_HOST AM_CONFIG_HEADER(config.h) CXXFLAGS="-Wall -pthread -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_FUNC_SETVBUF_REVERSED AC_TYPE_SIGNAL AC_FUNC_STRFTIME 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) # pthread_create is in standard libraries (As in BSDI 3.0) AC_MSG_CHECKING("for pthread_create in -libc"); AC_TRY_LINK( [#include ], [ (void) pthread_create((pthread_t*) 0,(pthread_attr_t*) 0, 0, 0); ], with_posix_threads=yes, with_posix_threads=no) AC_MSG_RESULT("$with_posix_threads") if test "$with_posix_threads" = "no" then AC_MSG_CHECKING("for pthread_create in -lpthread"); ac_save_LIBS="$LIBS" LIBS="$LIBS -lpthread" AC_TRY_LINK( [#include ], [ (void) pthread_create((pthread_t*) 0,(pthread_attr_t*) 0, 0, 0); ], with_posix_threads=yes, with_posix_threads=no) AC_MSG_RESULT("$with_posix_threads") if test "$with_posix_threads" = "no" then LIBS=" $ac_save_LIBS -lpthreads" AC_MSG_CHECKING("for pthread_create in -lpthreads"); AC_TRY_LINK( [#include ], [ pthread_create((pthread_t*) 0,(pthread_attr_t*) 0, 0, 0); ], with_posix_threads=yes, with_posix_threads=no) AC_MSG_RESULT("$with_posix_threads") if test "$with_posix_threads" = "no" then # This is for FreeBSD LIBS="$ac_save_LIBS -pthread" AC_MSG_CHECKING("for pthread_create in -pthread"); AC_TRY_LINK( [#include ], [ pthread_create((pthread_t*) 0,(pthread_attr_t*) 0, 0, 0); ], with_posix_threads=yes, with_posix_threads=no) AC_MSG_RESULT("$with_posix_threads") if test "$with_posix_threads" = "no" then with_mit_threads="yes" LIBS="$ac_save_LIBS" fi fi fi fi case "$host_os" in solaris2*) AC_DEFINE(NEED_POSIX_TYPEDEF) ;; *) ;; esac 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) 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="mysql" AC_ARG_WITH(modules, [ --with-modules Which userbases to compile with ], [ modules="$withval" ]) AC_SUBST(socketdir) socketdir="/var/run" AC_ARG_WITH(socketdir, [ --with-socketdir Where the controlsocket lives ], [ socketdir="$withval" ]) domysql=yes AC_MSG_CHECKING(whether we to include mysql support in the generic backend) AC_ARG_ENABLE(mysql, [ --enable-mysql Whether to include MySQL support in generic backend],domysql=yes,domysql=) AC_MSG_RESULT($domysql) AC_SUBST(domysql) AC_MSG_CHECKING(whether we to include pgsql support in the generic backend) AC_ARG_ENABLE(pgsql, [ --enable-pgsql Whether to include PgSQL support in generic backend],dopgsql=yes,dopgsql=) AC_MSG_RESULT($dopgsql) AC_SUBST(dopgsql) AC_SUBST(moduledirs) AC_SUBST(moduleobjects) AC_SUBST(modulelibs) for a in $modules do case "$a" in pgmysql ) if test "$dopgsql" then needpgsql=yes fi if test "$domysql" then needmysql=yes fi ;; mysql ) needmysql=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/pgsql /opt/pgsql/include/pgsql /opt/pgsql/include /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; 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 mysql 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" case "$a" in pgmysql) rm -f $srcdir/modules/pgmysqlbackend/OBJECTFILES cat /dev/null > $srcdir/modules/pgmysqlbackend/OBJECTLIBS echo gmysqlbackend.o > $srcdir/modules/pgmysqlbackend/OBJECTFILES if test -n "$domysql" then echo smysql.o >> $srcdir/modules/pgmysqlbackend/OBJECTFILES fi if test -n "$dopgsql" then echo spgsql.o >> $srcdir/modules/pgmysqlbackend/OBJECTFILES fi ;; esac 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 export moduledirs moduleobjects modulelibs AC_OUTPUT(Makefile modules/Makefile pdns/Makefile pdns/codedocs/Makefile \ pdns/backends/Makefile pdns/backends/bind/Makefile pdns/pdns \ modules/mysqlbackend/Makefile modules/pdnsbackend/Makefile \ modules/pgmysqlbackend/Makefile modules/db2backend/Makefile \ modules/pipebackend/Makefile )