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