]> git.ipfire.org Git - thirdparty/pdns.git/blob - configure.in
update to automake stuff, make nedmalloc default to 'yes' on freebsd, update version
[thirdparty/pdns.git] / configure.in
1 dnl intro
2 AC_INIT(pdns/receiver.cc)
3 AM_INIT_AUTOMAKE(pdns, 2.9.21-svn)
4 AC_CANONICAL_HOST
5 AM_CONFIG_HEADER(config.h)
6 AC_C_BIGENDIAN
7 AC_PREREQ(2.52)
8 CXXFLAGS="$CXXFLAGS -Wall -O2"
9
10 AC_PREFIX_DEFAULT(/usr/local)
11 AC_PROG_CC
12 AC_PROG_CXX
13 AC_PROG_YACC
14 AM_PROG_LEX
15 AC_PROG_INSTALL
16 AC_PROG_MAKE_SET
17 AC_PROG_LIBTOOL
18 AC_LANG_CPLUSPLUS
19
20 dnl Checks for header files.
21 AC_HEADER_STDC
22 AC_CHECK_HEADERS(fcntl.h getopt.h limits.h strings.h sys/time.h syslog.h unistd.h)
23 AC_CHECK_HEADERS(boost/shared_ptr.hpp, ,
24 echo Missing boost - please install Boost packages or see http://doc.powerdns.com/compiling-powerdns.html; exit)
25
26 dnl Checks for typedefs, structures, and compiler characteristics.
27 AC_TYPE_SIZE_T
28 AC_HEADER_TIME
29 AC_STRUCT_TM
30
31 dnl Checks for library functions.
32 AC_TYPE_SIGNAL
33 AC_CHECK_FUNCS(gethostname gettimeofday mkdir mktime select socket strerror)
34
35 # Check for libdl
36
37 LIBS=-lz
38
39 my_save_LIBS="$LIBS"
40 LIBS=""
41 AC_CHECK_LIB(dl,dlopen)
42 LIBDL=$LIBS
43 LIBS="$my_save_LIBS"
44 AC_SUBST(LIBDL)
45
46 AC_MSG_CHECKING([for RTLD_NOW]);
47 ac_save_LIBS="$LIBS"
48 LIBS="$LIBS $LIBDL"
49 AC_TRY_LINK(
50 [#include <dlfcn.h>],
51 [ (void) dlopen("",RTLD_NOW); ],
52 has_RTLD_NOW=yes, has_RTLD_NOW=no)
53 AC_MSG_RESULT([$has_RTLD_NOW])
54 if test "$has_RTLD_NOW" = "no"
55 then
56 AC_DEFINE(NEED_RTLD_NOW,,[If host OS misses RTLD_NOW])
57 fi
58 LIBS=$ac_save_LIBS
59
60 DYNLINKFLAGS=""
61 THREADFLAGS=""
62 enable_nedmalloc="no"
63
64 case "$host_os" in
65 solaris2.8 | solaris2.9 )
66 AC_DEFINE(NEED_POSIX_TYPEDEF,,[If POSIX typedefs need to be defined])
67 AC_DEFINE(NEED_INET_NTOP_PROTO,,[If your OS is so broken that it needs an additional prototype])
68 AC_DEFINE(HAVE_IPV6,1,[If the host operating system understands IPv6])
69 LIBS="-lposix4 -lresolv -lnsl -lsocket -lpthread $LIBS"
70 CXXFLAGS="-D_REENTRANT $CXXFLAGS"
71 ;;
72 solaris2.6 | solaris2.7)
73 AC_DEFINE(NEED_POSIX_TYPEDEF,,[If POSIX typedefs need to be defined])
74 AC_DEFINE(NEED_INET_NTOP_PROTO,,[If your OS is so broken that it needs an additional prototype])
75 LIBS="-lposix4 -lresolv -lnsl -lsocket -lpthread $LIBS"
76 CXXFLAGS="-D_REENTRANT $CXXFLAGS"
77 ;;
78 linux*)
79 AC_DEFINE(HAVE_IPV6,1,[If the host operating system understands IPv6])
80 DYNLINKFLAGS="-rdynamic"
81 LDFLAGS="$LDFLAGS"
82 THREADFLAGS="-pthread"
83 CXXFLAGS="-D_GNU_SOURCE $CXXFLAGS"
84 ;;
85 openbsd*)
86 AC_DEFINE(HAVE_IPV6,1,[If the host operating system understands IPv6])
87 DYNLINKFLAGS="-rdynamic"
88 LDFLAGS="-lc_r $LDFLAGS"
89 CXXFLAGS="-pthread $CXXFLAGS"
90 ;;
91 freebsd*)
92 AM_CONDITIONAL(NEDMALLOC, true)
93 enable_nedmalloc="yes"
94 ;;
95 *)
96 AC_DEFINE(HAVE_IPV6,1,[If the host operating system understands IPv6])
97 DYNLINKFLAGS="-rdynamic"
98 LDFLAGS="-pthread $LDFLAGS"
99 CXXFLAGS="-pthread $CXXFLAGS"
100 ;;
101 esac
102
103 AC_SUBST(THREADFLAGS)
104
105 AC_SUBST(DYNLINKFLAGS)
106
107 AC_MSG_CHECKING(whether we will be doing verbose logging)
108 AC_ARG_ENABLE(verbose-logging,
109 [ --enable-verbose-logging Do verbose logging],enable_verbose_logging=yes ,enable_verbose_logging=no)
110
111 if test $enable_verbose_logging = yes; then AC_DEFINE(VERBOSELOG, 1, [If verbose logging should be enabled])
112 fi
113 AC_MSG_RESULT($enable_verbose_logging)
114
115 AC_MSG_CHECKING(whether we should build static binaries)
116
117 AC_ARG_ENABLE(static-binaries,
118 [ --enable-static-binaries Build static binaries],
119 [case "${enableval}" in
120 yes) static=true ;;
121 no) static=false ;;
122 *) AC_MSG_ERROR(bad value ${enableval} for --enable-static-binaries) ;;
123 esac],[debug=false])
124 AC_MSG_RESULT($static)
125
126 AM_CONDITIONAL(ALLSTATIC, test x$static = xtrue)
127
128 if test x$static = xtrue;
129 then
130 LDFLAGS="-all-static $LDFLAGS"
131 fi
132
133
134
135 modules="gmysql geo"
136 AC_ARG_WITH(modules, [ --with-modules Which backends to compile with ],
137 [
138 modules="$withval"
139 ])
140
141 dynmodules="pipe"
142 AC_ARG_WITH(dynmodules, [ --with-dynmodules Which backends to build for dynamic loading ],
143 [
144 dynmodules="$withval"
145 ])
146
147
148
149 AC_SUBST(socketdir)
150 socketdir="/var/run"
151 AC_ARG_WITH(socketdir, [ --with-socketdir Where the controlsocket lives ],
152 [
153 socketdir="$withval"
154 ])
155
156 AC_SUBST(moduledirs)
157 AC_SUBST(moduleobjects)
158 AC_SUBST(modulelibs)
159
160 AC_MSG_CHECKING(whether we will be building the server)
161 AC_ARG_ENABLE(pdns-server,
162 [ --enable-pdns_server If we should build the server],
163 enable_pdns_server=$enableval,
164 enable_pdns_server=yes)
165
166 AC_MSG_RESULT($enable_pdns_server)
167
168 if test x"$enable_pdns_server" = "xyes"
169 then
170 programdescend=pdns
171 fi
172
173 AC_SUBST(programdescend)
174
175 AC_ARG_ENABLE(gcc-skip-locking,
176 [ --enable-gcc-skip-locking If we should forcefully skip gcc locking],
177 AC_DEFINE(GCC_SKIP_LOCKING,,[Skip gcc locking]),
178 )
179
180 AC_MSG_CHECKING(whether we will be building the recursor)
181 AC_ARG_ENABLE(recursor,
182 [ --enable-recursor If we should build the server],
183 enable_recursor=$enableval,
184 enable_recursor=no )
185
186 AC_MSG_RESULT($enable_recursor)
187
188 AM_CONDITIONAL(RECURSOR,test x"$enable_recursor" = "xyes")
189
190
191 AC_MSG_CHECKING(whether we should use nedmalloc allocator)
192 AC_ARG_ENABLE(nedmalloc,
193 [ --enable-nedmalloc If we should use nedmalloc],
194 enable_nedmalloc=$enableval,
195
196 )
197
198 AC_MSG_RESULT($enable_nedmalloc)
199
200 AM_CONDITIONAL(NEDMALLOC,test x"$enable_nedmalloc" = "xyes")
201
202
203 for a in $modules $dynmodules
204 do
205 case "$a" in
206 mysql )
207 needmysql=yes
208 ;;
209 gmysql )
210 needmysql=yes
211 ;;
212 gpgsql )
213 needpgsql=yes
214 ;;
215 gsqlite )
216 needsqlite=yes
217 ;;
218 pdns )
219 needmysql=yes
220 ;;
221 esac
222 done
223
224
225 if test "$needmysql"
226 then
227 AC_ARG_WITH(mysql,
228 [ --with-mysql=<path> root directory path of MySQL installation],
229 [MYSQL_lib_check="$withval/lib/mysql $with_mysql/lib"
230 MYSQL_inc_check="$withval/include/mysql"],
231 [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"
232 MYSQL_inc_check="/usr/local/mysql/include/mysql /usr/local/include/mysql /opt/mysql/include/mysql /opt/mysql/include /usr/include/mysql"])
233 AC_ARG_WITH(mysql-lib,
234 [ --with-mysql-lib=<path> directory path of MySQL library installation],
235 [MYSQL_lib_check="$withval/lib/mysql $withval/mysql $withval"])
236 AC_ARG_WITH(mysql-includes,
237 [ --with-mysql-includes=<path>
238 directory path of MySQL header installation],
239 [MYSQL_inc_check="$withval/include/mysql $withval/mysql $withval"])
240 AC_MSG_CHECKING([for MySQL library directory])
241 MYSQL_libdir=
242 for m in $MYSQL_lib_check; do
243 if test -d "$m" && \
244 (test -f "$m/libmysqlclient.so" || test -f "$m/libmysqlclient.a")
245 then
246 MYSQL_libdir=$m
247 break
248 fi
249 done
250 if test -z "$MYSQL_libdir"; then
251 AC_MSG_ERROR([Didn't find the mysql library dir in '$MYSQL_lib_check'])
252 fi
253 case "$MYSQL_libdir" in
254 /usr/lib ) MYSQL_lib="" ;;
255 /* ) MYSQL_lib=-L$MYSQL_libdir; LDFLAGS="$MYSQL_lib $LDFLAGS";;
256 * ) AC_MSG_ERROR([The MySQL library directory ($MYSQL_libdir) must be an absolute path.]) ;;
257 esac
258
259 AC_SUBST(MYSQL_lib)
260
261 AC_MSG_RESULT([$MYSQL_libdir])
262 AC_MSG_CHECKING([for MySQL include directory])
263 MYSQL_incdir=
264 for m in $MYSQL_inc_check; do
265 if test -d "$m" && test -f "$m/mysql.h"
266 then
267 MYSQL_incdir=$m
268 break
269 fi
270 done
271 if test -z "$MYSQL_incdir"; then
272 AC_MSG_ERROR([Didn't find the mysql include dir in '$MYSQL_inc_check'])
273 fi
274
275 case "$MYSQL_incdir" in
276 /* ) ;;
277 * ) AC_MSG_ERROR([The MySQL include directory ($MYSQL_incdir) must be an absolute path.]) ;;
278 esac
279
280 AC_SUBST(MYSQL_incdir)
281 AC_MSG_RESULT([$MYSQL_incdir])
282 # LIBS="$LIBS -lmysqlclient"
283 fi
284
285
286
287 if test "$needpgsql"
288 then
289 AC_ARG_WITH(pgsql,
290 [ --with-pgsql=<path> root directory path of PgSQL installation],
291 [PGSQL_lib_check="$withval/lib/pgsql $with_pgsql/lib"
292 PGSQL_inc_check="$withval/include/pgsql"],
293 [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"
294 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"])
295 AC_ARG_WITH(pgsql-lib,
296 [ --with-pgsql-lib=<path> directory path of PgSQL library installation],
297 [PGSQL_lib_check="$withval/lib/pgsql $withval/pgsql $withval"])
298 AC_ARG_WITH(pgsql-includes,
299 [ --with-pgsql-includes=<path>
300 directory path of PgSQL header installation],
301 [PGSQL_inc_check="$withval/include/pgsql $withval/pgsql $withval"])
302 AC_MSG_CHECKING([for PgSQL library directory])
303 PGSQL_libdir=
304 for m in $PGSQL_lib_check; do
305 if test -d "$m" && \
306 (test -f "$m/libpq.a" || test -f "$m/libpq++.a")
307 then
308 PGSQL_libdir=$m
309 break
310 fi
311 done
312 if test -z "$PGSQL_libdir"; then
313 AC_MSG_ERROR([Didn't find the pgsql library dir in '$PGSQL_lib_check'])
314 fi
315 case "$PGSQL_libdir" in
316 /usr/lib ) PGSQL_lib="" ;;
317 /* ) PGSQL_lib="-L$PGSQL_libdir -Wl,-rpath,$PGSQL_libdir"
318 LDFLAGS="$PGSQL_lib $LDFLAGS"
319 ;;
320 * ) AC_MSG_ERROR([The PgSQL library directory ($PGSQL_libdir) must be an absolute path.]) ;;
321 esac
322
323 AC_SUBST(PGSQL_lib)
324 AC_MSG_RESULT([$PGSQL_libdir])
325 AC_MSG_CHECKING([for PgSQL include directory])
326 PGSQL_incdir=
327 for m in $PGSQL_inc_check; do
328 if test -d "$m" && test -f "$m/libpq-fe.h"
329 then
330 PGSQL_incdir=$m
331 break
332 fi
333 done
334 if test -z "$PGSQL_incdir"; then
335 AC_MSG_ERROR([Didn't find the PgSQL include dir in '$PGSQL_inc_check'])
336 fi
337 case "$PGSQL_incdir" in
338 /* ) ;;
339 * ) AC_MSG_ERROR([The PgSQL include directory ($PGSQL_incdir) must be an absolute path.]) ;;
340 esac
341 AC_SUBST(PGSQL_incdir)
342 AC_MSG_RESULT([$PGSQL_incdir])
343
344 # LIBS="$LIBS -lpq++ -lpq -lssl -lcrypt -lcrypto"
345 fi
346
347
348 if test "$needsqlite"
349 then
350 AC_ARG_WITH(sqlite,
351 [ --with-sqlite=<path> root directory path of SQLite installation],
352 [SQLITE_lib_check="$withval/lib/sqlite $with_sqlite/lib"
353 SQLITE_inc_check="$withval/include/sqlite"],
354 [SQLITE_lib_check="/usr/local/sqlite/lib/sqlite /usr/local/lib/sqlite /opt/pgsql/lib/sqlite /usr/lib/sqlite /usr/local/sqlite/lib /usr/local/lib /opt/sqlite/lib /usr/lib"
355 SQLITE_inc_check="/usr/local/sqlite/include/sqlite /usr/local/include/sqlite/ /usr/local/include /opt/sqlite/include/sqlite /opt/sqlite/include /usr/include/ /usr/include/sqlite"])
356 AC_ARG_WITH(sqlite-lib,
357 [ --with-sqlite-lib=<path> directory path of SQLite library installation],
358 [SQLITE_lib_check="$withval/lib/sqlite $withval/sqlite $withval"])
359 AC_ARG_WITH(sqlite-includes,
360 [ --with-sqlite-includes=<path>
361 directory path of SQLite header installation],
362 [SQLITE_inc_check="$withval/include/sqlite $withval/sqlite $withval"])
363 AC_MSG_CHECKING([for SQLite library directory])
364 SQLITE_libdir=
365 for m in $SQLITE_lib_check; do
366 if test -d "$m" && \
367 (test -f "$m/libsqlite.so" || test -f "$m/libsqlite.a")
368 then
369 SQLITE_libdir=$m
370 break
371 fi
372 done
373 if test -z "$SQLITE_libdir"; then
374 AC_MSG_ERROR([Didn't find the sqlite library dir in '$SQLITE_lib_check'])
375 fi
376 case "$SQLITE_libdir" in
377 /usr/lib ) SQLITE_lib="" ;;
378 /* ) SQLITE_lib="-L$SQLITE_libdir -Wl,-rpath,$SQLITE_libdir"
379 LDFLAGS="$SQLITE_lib $LDFLAGS"
380 ;;
381 * ) AC_MSG_ERROR([The SQLite library directory ($SQLITE_libdir) must be an absolute path.]) ;;
382 esac
383
384 AC_SUBST(SQLITE_lib)
385 AC_MSG_RESULT([$SQLITE_libdir])
386 AC_MSG_CHECKING([for SQLite include directory])
387 SQLITE_incdir=
388 for m in $SQLITE_inc_check; do
389 if test -d "$m" && test -f "$m/sqlite.h"
390 then
391 SQLITE_incdir=$m
392 break
393 fi
394 done
395 if test -z "$SQLITE_incdir"; then
396 AC_MSG_ERROR([Didn't find the SQLite include dir in '$SQLITE_inc_check'])
397 fi
398 case "$SQLITE_incdir" in
399 /* ) ;;
400 * ) AC_MSG_ERROR([The SQLite include directory ($SQLITE_incdir) must be an absolute path.]) ;;
401 esac
402 AC_SUBST(SQLITE_incdir)
403 AC_MSG_RESULT([$SQLITE_incdir])
404
405 # LIBS="$LIBS -lsqlite"
406 fi
407
408
409 for a in $modules
410 do
411 moduledirs="$moduledirs ${a}backend"
412
413 for b in `cat $srcdir/modules/${a}backend/OBJECTFILES`
414 do
415 moduleobjects="$moduleobjects ../modules/${a}backend/$b"
416 done
417 modulelibs="$modulelibs `cat $srcdir/modules/${a}backend/OBJECTLIBS`"
418 done
419
420 for a in $dynmodules
421 do
422 moduledirs="$moduledirs ${a}backend"
423 done
424
425 AC_SUBST(LIBS)
426
427 export moduledirs moduleobjects modulelibs
428
429 AC_OUTPUT(Makefile modules/Makefile pdns/Makefile codedocs/Makefile \
430 pdns/backends/Makefile pdns/backends/bind/Makefile pdns/pdns pdns/precursor \
431 modules/mysqlbackend/Makefile modules/pdnsbackend/Makefile \
432 modules/gmysqlbackend/Makefile modules/db2backend/Makefile \
433 modules/geobackend/Makefile modules/opendbxbackend/Makefile \
434 modules/pipebackend/Makefile modules/oraclebackend/Makefile \
435 modules/xdbbackend/Makefile modules/odbcbackend/Makefile \
436 modules/gpgsqlbackend/Makefile modules/ldapbackend/Makefile
437 modules/gsqlitebackend/Makefile modules/goraclebackend/Makefile )