--- /dev/null
+dnl Process this file with autoconf to produce a configure script.
+AC_INIT(pdnsbackend.cc)
+AM_INIT_AUTOMAKE(ahudns-pdnsbackend, 2.0rc2)
+AC_CANONICAL_SYSTEM
+AC_PREFIX_DEFAULT(/opt/pdns)
+AC_PROG_CC
+AC_PROG_CXX
+AC_PROG_INSTALL
+AC_PROG_MAKE_SET
+AC_DISABLE_STATIC
+AM_PROG_LIBTOOL
+AC_LANG_CPLUSPLUS
+
+#
+# Location of MySQL installation
+#
+AC_ARG_WITH(mysql,
+ [ --with-mysql=<path> 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=<path> directory path of MySQL library installation],
+ [MYSQL_lib_check="$withval/lib/mysql $withval/mysql $withval"])
+
+AC_ARG_WITH(mysql-includes,
+ [ --with-mysql-includes=<path>
+ 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
+ /* ) ;;
+ * ) AC_MSG_ERROR([The MySQL library directory ($MYSQL_libdir) must be an absolute path.]) ;;
+esac
+
+AC_MSG_RESULT([$MYSQL_libdir])
+
+case "$MYSQL_libdir" in
+ /usr/lib) ;;
+ *) LDFLAGS="$LDFLAGS -L${MYSQL_libdir}" ;;
+esac
+
+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_MSG_RESULT([$MYSQL_incdir])
+
+CPPFLAGS="$CPPFLAGS -I${MYSQL_incdir}"
+
+dnl Checks for programs.
+
+dnl Checks for libraries.
+dnl Replace `main' with a function in -ldl:
+AC_CHECK_LIB(dl, main)
+AC_CHECK_LIB(z, main)
+AC_CHECK_LIB(mysqlclient, mysql_store_result)
+dnl Replace `main' with a function in -lpthread:
+AC_CHECK_LIB(pthread, main)
+
+dnl Checks for header files.
+AC_HEADER_STDC
+AC_CHECK_HEADERS(unistd.h)
+
+dnl Checks for typedefs, structures, and compiler characteristics.
+
+dnl Checks for ahudns functions
+dnl Check for ahudns
+
+search_ahudns=1
+
+AC_ARG_WITH(ahudns-includes, [ --with-ahudns-includes=PATH Specify location of ahudns headers],
+[ if test x"$withval" = x"no"; then
+ search_ahudns=0
+ else
+ #if test x"$withval" != x"yes"; then
+ if test -d "$withval"; then
+ AHUDNS_INCLUDES="-I$withval"
+ search_ahudns=0
+ has_ahudns=1
+ fi
+ fi
+])
+
+
+AC_DEFUN(AC_CHECK_AHUDNS,
+[ if test x"$search_ahudns" != x"0"; then
+ if test -f "$1/$2"; then
+ AC_MSG_RESULT($5)
+ AHUDNS_LIBS="$3"
+ AHUDNS_INCLUDES="$4"
+ search_ahudns=0
+ has_ahudns=1
+ fi
+ fi
+])
+
+AC_DEFUN(AC_SEARCH_AHUDNS,
+[ AC_MSG_CHECKING("location of ahudns logger.hh include")
+ AC_CHECK_AHUDNS($HOME/programming/ahudns, logger.hh,,-I$HOME/programming/ahudns, "found in $HOME/programming/ahudns")
+ AC_CHECK_AHUDNS(../ahudns, logger.hh,,-I../ahudns, "found in ../ahudns")
+ AC_CHECK_AHUDNS(../ahudns-1.2, logger.hh,,-I../ahudns-1.2, "found in ../ahudns-1.2")
+])
+
+if test x"$search_ahudns" != x"0"; then
+ AC_SEARCH_AHUDNS()
+fi
+
+if test x"$has_ahudns" = x"1"; then
+ echo Found ahudns include file, assuming working and compliant ahudns
+else
+ echo
+ echo Did not find ahudns include file
+ echo
+ exit 1
+fi
+
+CPPFLAGS="$CPPFLAGS $AHUDNS_INCLUDES"
+
+
+dnl Checks for library functions.
+
+dnl Check for STL
+AC_CHECK_HEADER(sstream,dontneedstl=1)
+
+if test "$dontneedstl" != "1"
+then
+search_stl=1
+
+AC_ARG_WITH(stl-includes, [ --with-stl-includes=PATH Specify location of STL headers],
+[ if test x"$withval" = x"no"; then
+ search_stl=0
+ else
+ #if test x"$withval" != x"yes"; then
+ if test -d "$withval"; then
+ STL_INCLUDES="-I$withval"
+ search_stl=0
+ has_stl=1
+ fi
+ fi
+])
+
+
+
+AC_ARG_WITH(stl-libs, [ --with-stl-libs=PATH Specify location of STL libs],
+[ if test x"$withval" = x"no"; then
+ search_stl=0
+ else
+ #if test x"$withval" != x"yes"; then
+ if test -d "$withval"; then
+ STL_LIBS="$LIBS -L$withval -lstlport_gcc"
+ search_stl=0
+ has_stl=1
+ fi
+ fi
+])
+
+AC_DEFUN(AC_CHECK_STL,
+[ if test x"$search_stl" != x"0"; then
+ if test -f "$1/$2"; then
+ AC_MSG_RESULT($5)
+ STL_LIBS="$3"
+ STL_INCLUDES="$4"
+ search_stl=0
+ has_stl=1
+ fi
+ fi
+])
+
+AC_DEFUN(AC_SEARCH_STL,
+[ AC_MSG_CHECKING("location of sstream")
+ AC_CHECK_STL(/usr/include, sstream, -lstlport_gcc,, "found in /usr/include")
+ AC_CHECK_STL(/usr/include/stlport, sstream, -lstlport_gcc, -I/usr/include/stlport, "found in /usr/include/stlport")
+ AC_CHECK_STL(/usr/include, sstream, -lstlport_gcc,, "found in /usr/include")
+ AC_CHECK_STL(/usr/local/include, sstream, -L/usr/local/lib -lstlport_gcc, -I/usr/local/include, "found in /usr/local")
+ AC_CHECK_STL(/usr/local/include/stl, sstream, -L/usr/local/lib -L/usr/local/lib/stl -lstlport_gcc, -I/usr/local/include/stl, "found in /usr/local/include/stl")
+ AC_CHECK_STL(/home/ahu/download/STLport-4.0/stlport, sstream,-L/home/ahu/download/STLport-4.0/lib/ -lstlport_gcc, -I/home/ahu/download/STLport-4.0/stlport/, "found in /home/ahu/download/STLport-4.0/stlport")
+ AC_CHECK_STL($HOME/STLport-4.0/stlport, sstream,-L$HOME/STLport-4.0/lib/ -lstlport_gcc, -I$HOME/STLport-4.0/stlport/, "found in $HOME/STLport-4.0/stlport")
+])
+
+if test x"$search_stl" != x"0"; then
+ AC_SEARCH_STL()
+fi
+
+if test x"$has_stl" = x"1"; then
+ echo Found sstream include file, assuming working and compliant STL
+else
+ echo
+ echo Did not find sstream include file, this probably means that your STL is not
+ echo compliant - the default gcc libstdc++ isn\'t. Download STLport-4.0 from
+ echo http://www.stlport.org, or use --with-stl-includes and --with-stl-libs
+ echo to specify the location of your STL.
+ echo
+ exit 1
+fi
+
+CPPFLAGS="$CPPFLAGS $STL_INCLUDES $MYSQLPP_INCLUDES"
+LIBS="$LIBS $STL_LIBS"
+fi
+
+AM_CONFIG_HEADER(config.h)
+AC_OUTPUT(Makefile)
+