4 AM_INIT_AUTOMAKE(pdns, 2.9)
5 AM_CONFIG_HEADER(config.h)
6 CXXFLAGS="-Wall -pthread -O2"
8 AC_PREFIX_DEFAULT(/opt/pdns)
19 #dnl Replace `main' with a function in -ldl:
20 #AC_CHECK_LIB(dl, main)
21 #dnl Replace `main' with a function in -lpthread:
22 #AC_CHECK_LIB(pthread, main)
24 #CPPFLAGS="$CPPFLAGS -I/usr/include/postgresql"
25 #LDFLAGS="$LDFLAGS -L/usr/local/lib"
27 AC_CHECK_LIB(gnugetopt,getopt_long,LIBS="$LIBS -lgnugetopt")
29 dnl Checks for header files.
31 AC_CHECK_HEADERS(fcntl.h getopt.h limits.h strings.h sys/time.h syslog.h unistd.h)
33 dnl Checks for typedefs, structures, and compiler characteristics.
38 dnl Checks for library functions.
39 AC_FUNC_SETVBUF_REVERSED
42 AC_CHECK_FUNCS(gethostname gettimeofday mkdir mktime select socket strerror)
47 # # Check if we have libresolv. XXX If we do not have libresolv then we
48 # # cannot build the 'resolver'. Is it possible to remove that target
52 # AC_CHECK_LIB(resolv, res_mkquery, RESOLV_LIBS="-l resolv")
53 # AC_MSG_CHECKING("for resolver library")
54 # if test -f /usr/lib/libresolv.so -o -f /lib/libresolv.o
56 # AC_MSG_RESULT("yes")
57 # LIBS="$LIBS -lresolv"
68 AC_CHECK_LIB(resolv,res_mkquery)
79 AC_CHECK_LIB(dl,dlopen)
86 # The following code checks for the right pthreads library and linker
87 # flags. It was taken from MySQL, so we should have the same platform
88 # support as they have.
90 # XXX Dit is nog niet correct. Als dit matched dan moet de rest van de
91 # XXX thread checks niet. Fixen als we solaris hebben.
94 #AC_MSG_CHECKING("for Solaris threads")
95 #if test -f /usr/lib/libpthread.so -a -f /usr/lib/libthread.so
97 # with_named_thread="-lpthread -lthread"
98 # AC_MSG_RESULT("yes")
100 # AC_MSG_RESULT("no")
103 # pthread_create is in standard libraries (As in BSDI 3.0)
104 AC_MSG_CHECKING("for pthread_create in -libc");
106 [#include <pthread.h>],
107 [ (void) pthread_create((pthread_t*) 0,(pthread_attr_t*) 0, 0, 0); ],
108 with_posix_threads=yes, with_posix_threads=no)
109 AC_MSG_RESULT("$with_posix_threads")
110 if test "$with_posix_threads" = "no"
112 AC_MSG_CHECKING("for pthread_create in -lpthread");
114 LIBS="$LIBS -lpthread"
116 [#include <pthread.h>],
117 [ (void) pthread_create((pthread_t*) 0,(pthread_attr_t*) 0, 0, 0); ],
118 with_posix_threads=yes, with_posix_threads=no)
119 AC_MSG_RESULT("$with_posix_threads")
120 if test "$with_posix_threads" = "no"
122 LIBS=" $ac_save_LIBS -lpthreads"
123 AC_MSG_CHECKING("for pthread_create in -lpthreads");
125 [#include <pthread.h>],
126 [ pthread_create((pthread_t*) 0,(pthread_attr_t*) 0, 0, 0); ],
127 with_posix_threads=yes, with_posix_threads=no)
128 AC_MSG_RESULT("$with_posix_threads")
129 if test "$with_posix_threads" = "no"
131 # This is for FreeBSD
132 LIBS="$ac_save_LIBS -pthread"
133 AC_MSG_CHECKING("for pthread_create in -pthread");
135 [#include <pthread.h>],
136 [ pthread_create((pthread_t*) 0,(pthread_attr_t*) 0, 0, 0); ],
137 with_posix_threads=yes, with_posix_threads=no)
138 AC_MSG_RESULT("$with_posix_threads")
139 if test "$with_posix_threads" = "no"
141 with_mit_threads="yes"
149 solaris2*) AC_DEFINE(NEED_POSIX_TYPEDEF)
155 AC_CHECK_HEADER(sstream,dontneedstl=1)
157 if test "$dontneedstl" != "1"
160 AC_ARG_WITH(stl-includes, [ --with-stl-includes=PATH Specify location of STL headers],
161 [ if test x"$withval" = x"no"; then
164 #if test x"$withval" != x"yes"; then
165 if test -d "$withval"; then
166 STL_INCLUDES="-I$withval"
174 AC_ARG_WITH(stl-libs, [ --with-stl-libs=PATH Specify location of STL libs],
175 [ if test x"$withval" = x"no"; then
178 #if test x"$withval" != x"yes"; then
179 if test -d "$withval"; then
180 STL_LIBS="$LIBS -L$withval -lstlport_gcc"
187 AC_DEFUN(AC_CHECK_STL,
188 [ if test x"$search_stl" != x"0"; then
189 if test -f "$1/$2"; then
199 AC_DEFUN(AC_SEARCH_STL,
200 [ AC_MSG_CHECKING("location of sstream")
201 AC_CHECK_STL(/usr/include, sstream, -lstlport_gcc,, "found in /usr/include")
202 AC_CHECK_STL(/usr/include/stlport, sstream, -lstlport_gcc, -I/usr/include/stlport, "found in /usr/include/stlport")
203 AC_CHECK_STL(/usr/local/include, sstream, -L/usr/local/lib -lstlport_gcc, -I/usr/local/include, "found in /usr/local")
204 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")
205 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")
206 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")
209 if test x"$search_stl" != x"0"; then
213 if test x"$has_stl" = x"1"; then
214 echo Found sstream include file, assuming working and compliant STL
217 echo Did not find sstream include file, this probably means that your STL is not
218 echo compliant - the default gcc libstdc++ isn\'t. Download STLport-4.0 from
219 echo http://www.stlport.org, or use --with-stl-includes and --with-stl-libs
220 echo to specify the location of your STL.
225 CPPFLAGS="$CPPFLAGS $STL_INCLUDES"
226 LIBS="$LIBS $STL_LIBS"
229 AC_MSG_CHECKING(whether we will be doing verbose logging)
230 AC_ARG_ENABLE(verbose-logging,
231 [ --enable-verbose-logging Do verbose logging],enable_verbose_logging=yes ,enable_verbose_logging=no)
233 if test $enable_verbose_logging = yes; then AC_DEFINE(VERBOSELOG, 1)
235 AC_MSG_RESULT($enable_verbose_logging)
237 AC_MSG_CHECKING(whether we should build static binaries)
238 AC_ARG_ENABLE(static-binaries,
239 [ --enable-static-binaries Build static binaries],enable_static_binaries=yes ,enable_static_binaries=no)
241 if test $enable_static_binaries = yes;
243 LDFLAGS="-all-static $LD_FLAGS"
245 AC_MSG_RESULT($enable_static_binaries)
249 AC_OUTPUT(Makefile codedocs/Makefile backends/bind/Makefile \
251 pdns.conf-dist buildroot.sh \
252 showvar pdns mkbindist)