]> git.ipfire.org Git - thirdparty/pdns.git/blob - configure.in
random stuff
[thirdparty/pdns.git] / configure.in
1 dnl intro
2 AC_INIT(pdns/receiver.cc)
3 AM_INIT_AUTOMAKE(pdns, 2.9.3)
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 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 my_save_LIBS="$LIBS"
36 LIBS=""
37 AC_CHECK_LIB(dl,dlopen)
38 LIBDL=$LIBS
39 LIBS="$my_save_LIBS"
40 AC_SUBST(LIBDL)
41
42 AC_MSG_CHECKING([for RTLD_NOW]);
43 ac_save_LIBS="$LIBS"
44 LIBS="$LIBS $LIBDL"
45 AC_TRY_LINK(
46 [#include <dlfcn.h>],
47 [ (void) dlopen("",RTLD_NOW); ],
48 has_RTLD_NOW=yes, has_RTLD_NOW=no)
49 AC_MSG_RESULT([$has_RTLD_NOW])
50 if test "$has_RTLD_NOW" = "no"
51 then
52 AC_DEFINE(NEED_RTLD_NOW,,[If host OS misses RTLD_NOW])
53 fi
54 LIBS=$ac_save_LIBS
55
56 # pthread_create is in standard libraries (As in BSDI 3.0)
57 AC_MSG_CHECKING([for pthread_create in -libc]);
58 AC_TRY_LINK(
59 [#include <pthread.h>],
60 [ (void) pthread_create((pthread_t*) 0,(pthread_attr_t*) 0, 0, 0); ],
61 with_posix_threads=yes, with_posix_threads=no)
62 AC_MSG_RESULT("$with_posix_threads")
63 if test "$with_posix_threads" = "no"
64 then
65 AC_MSG_CHECKING([for pthread_create in -lpthread]);
66 ac_save_LIBS="$LIBS"
67 LIBS="$LIBS -lpthread"
68 AC_TRY_LINK(
69 [#include <pthread.h>],
70 [ (void) pthread_create((pthread_t*) 0,(pthread_attr_t*) 0, 0, 0); ],
71 with_posix_threads=yes, with_posix_threads=no)
72 AC_MSG_RESULT("$with_posix_threads")
73 if test "$with_posix_threads" = "no"
74 then
75 LIBS=" $ac_save_LIBS -lpthreads"
76 AC_MSG_CHECKING([for pthread_create in -lpthreads]);
77 AC_TRY_LINK(
78 [#include <pthread.h>],
79 [ pthread_create((pthread_t*) 0,(pthread_attr_t*) 0, 0, 0); ],
80 with_posix_threads=yes, with_posix_threads=no)
81 AC_MSG_RESULT("$with_posix_threads")
82 if test "$with_posix_threads" = "no"
83 then
84 # This is for FreeBSD
85 LIBS="$ac_save_LIBS -pthread"
86 AC_MSG_CHECKING([for pthread_create in -pthread]);
87 AC_TRY_LINK(
88 [#include <pthread.h>],
89 [ pthread_create((pthread_t*) 0,(pthread_attr_t*) 0, 0, 0); ],
90 with_posix_threads=yes, with_posix_threads=no)
91 AC_MSG_RESULT("$with_posix_threads")
92 if test "$with_posix_threads" = "no"
93 then
94 with_mit_threads="yes"
95 LIBS="$ac_save_LIBS"
96 fi
97 fi
98 fi
99 fi
100
101 DYNLINKFLAGS=""
102 case "$host_os" in
103 solaris2.8 | solaris2.9 )
104 AC_DEFINE(NEED_POSIX_TYPEDEF,,[If POSIX typedefs need to be defined])
105 AC_DEFINE(NEED_INET_NTOP_PROTO,,[If your OS is so broken that it needs an additional prototype])
106 AC_DEFINE(HAVE_IPV6,1,[If the host operating system understands IPv6])
107 LIBS="-lposix4 -lresolv -lnsl -lsocket -lpthread $LIBS"
108 CXXFLAGS="-D_REENTRANT $CXXFLAGS"
109 ;;
110 solaris2.6 | solaris2.7)
111 AC_DEFINE(NEED_POSIX_TYPEDEF,,[If POSIX typedefs need to be defined])
112 AC_DEFINE(NEED_INET_NTOP_PROTO,,[If your OS is so broken that it needs an additional prototype])
113 LIBS="-lposix4 -lresolv -lnsl -lsocket -lpthread $LIBS"
114 CXXFLAGS="-D_REENTRANT $CXXFLAGS"
115 ;;
116 linux*)
117 AC_DEFINE(HAVE_IPV6,1,[If the host operating system understands IPv6])
118 DYNLINKFLAGS="-rdynamic"
119 LDFLAGS="-pthread $LDFLAGS"
120 CXXFLAGS="-pthread -D_GNU_SOURCE $CXXFLAGS"
121 ;;
122 openbsd*)
123 AC_DEFINE(HAVE_IPV6,1,[If the host operating system understands IPv6])
124 DYNLINKFLAGS="-rdynamic"
125 LDFLAGS="-lc_r $LDFLAGS"
126 CXXFLAGS="-pthread $CXXFLAGS"
127 ;;
128 *)
129 AC_DEFINE(HAVE_IPV6,1,[If the host operating system understands IPv6])
130 DYNLINKFLAGS="-rdynamic"
131 LDFLAGS="-pthread $LDFLAGS"
132 CXXFLAGS="-pthread $CXXFLAGS"
133 ;;
134 esac
135
136 AC_SUBST(DYNLINKFLAGS)
137
138 AC_MSG_CHECKING(whether we will be doing verbose logging)
139 AC_ARG_ENABLE(verbose-logging,
140 [ --enable-verbose-logging Do verbose logging],enable_verbose_logging=yes ,enable_verbose_logging=no)
141
142 if test $enable_verbose_logging = yes; then AC_DEFINE(VERBOSELOG, 1, [If verbose logging should be enabled])
143 fi
144 AC_MSG_RESULT($enable_verbose_logging)
145
146 AC_MSG_CHECKING(whether we should build static binaries)
147
148 AC_ARG_ENABLE(static-binaries,
149 [ --enable-static-binaries Build static binaries],
150 [case "${enableval}" in
151 yes) static=true ;;
152 no) static=false ;;
153 *) AC_MSG_ERROR(bad value ${enableval} for --enable-static-binaries) ;;
154 esac],[debug=false])
155 AC_MSG_RESULT($static)
156
157 AM_CONDITIONAL(ALLSTATIC, test x$static = xtrue)
158
159 if test x$static = xtrue;
160 then
161 LDFLAGS="-all-static $LDFLAGS"
162 fi
163
164
165
166 modules="gmysql"
167 AC_ARG_WITH(modules, [ --with-modules Which userbases to compile with ],
168 [
169 modules="$withval"
170 ])
171
172 dynmodules="pipe"
173 AC_ARG_WITH(dynmodules, [ --with-dynmodules Which userbases to build for dynamic loading ],
174 [
175 dynmodules="$withval"
176 ])
177
178
179
180 AC_SUBST(socketdir)
181 socketdir="/var/run"
182 AC_ARG_WITH(socketdir, [ --with-socketdir Where the controlsocket lives ],
183 [
184 socketdir="$withval"
185 ])
186
187 AC_SUBST(moduledirs)
188 AC_SUBST(moduleobjects)
189 AC_SUBST(modulelibs)
190
191 AC_MSG_CHECKING(whether we will be building the server)
192 AC_ARG_ENABLE(pdns-server,
193 [ --enable-pdns_server If we should build the server],
194 enable_pdns_server=$enableval,
195 enable_pdns_server=yes)
196
197 AC_MSG_RESULT($enable_pdns_server)
198
199 if test x"$enable_pdns_server" = "xyes"
200 then
201 programdescend=pdns
202 fi
203
204 AC_SUBST(programdescend)
205
206 for a in $modules $dynmodules
207 do
208 case "$a" in
209 mysql )
210 needmysql=yes
211 ;;
212 gmysql )
213 needmysql=yes
214 ;;
215 gpgsql )
216 needpgsql=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++.so" || 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++.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 for a in $modules
349 do
350 moduledirs="$moduledirs ${a}backend"
351
352 for b in `cat $srcdir/modules/${a}backend/OBJECTFILES`
353 do
354 moduleobjects="$moduleobjects ../modules/${a}backend/$b"
355 done
356 modulelibs="$modulelibs `cat $srcdir/modules/${a}backend/OBJECTLIBS`"
357 done
358
359 for a in $dynmodules
360 do
361 moduledirs="$moduledirs ${a}backend"
362 done
363
364 export moduledirs moduleobjects modulelibs
365
366 AC_OUTPUT(Makefile modules/Makefile pdns/Makefile pdns/codedocs/Makefile \
367 pdns/backends/Makefile pdns/backends/bind/Makefile pdns/pdns \
368 modules/mysqlbackend/Makefile modules/pdnsbackend/Makefile \
369 modules/gmysqlbackend/Makefile modules/db2backend/Makefile \
370 modules/pipebackend/Makefile modules/oraclebackend/Makefile \
371 modules/xdbbackend/Makefile modules/odbcbackend/Makefile \
372 modules/gpgsqlbackend/Makefile )