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