]> git.ipfire.org Git - thirdparty/pdns.git/blob - configure.in
lots of changes, mostly a crash fix
[thirdparty/pdns.git] / configure.in
1 dnl intro
2 AC_INIT(pdns/receiver.cc)
3 AM_INIT_AUTOMAKE(pdns, 2.9.9)
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 DYNLINKFLAGS=""
57 THREADFLAGS=""
58
59 case "$host_os" in
60 solaris2.8 | solaris2.9 )
61 AC_DEFINE(NEED_POSIX_TYPEDEF,,[If POSIX typedefs need to be defined])
62 AC_DEFINE(NEED_INET_NTOP_PROTO,,[If your OS is so broken that it needs an additional prototype])
63 AC_DEFINE(HAVE_IPV6,1,[If the host operating system understands IPv6])
64 LIBS="-lposix4 -lresolv -lnsl -lsocket -lpthread $LIBS"
65 CXXFLAGS="-D_REENTRANT $CXXFLAGS"
66 ;;
67 solaris2.6 | solaris2.7)
68 AC_DEFINE(NEED_POSIX_TYPEDEF,,[If POSIX typedefs need to be defined])
69 AC_DEFINE(NEED_INET_NTOP_PROTO,,[If your OS is so broken that it needs an additional prototype])
70 LIBS="-lposix4 -lresolv -lnsl -lsocket -lpthread $LIBS"
71 CXXFLAGS="-D_REENTRANT $CXXFLAGS"
72 ;;
73 linux*)
74 AC_DEFINE(HAVE_IPV6,1,[If the host operating system understands IPv6])
75 DYNLINKFLAGS="-rdynamic"
76 LDFLAGS="$LDFLAGS"
77 THREADFLAGS="-pthread"
78 CXXFLAGS="-D_GNU_SOURCE $CXXFLAGS"
79 ;;
80 openbsd*)
81 AC_DEFINE(HAVE_IPV6,1,[If the host operating system understands IPv6])
82 DYNLINKFLAGS="-rdynamic"
83 LDFLAGS="-lc_r $LDFLAGS"
84 CXXFLAGS="-pthread $CXXFLAGS"
85 ;;
86 *)
87 AC_DEFINE(HAVE_IPV6,1,[If the host operating system understands IPv6])
88 DYNLINKFLAGS="-rdynamic"
89 LDFLAGS="-pthread $LDFLAGS"
90 CXXFLAGS="-pthread $CXXFLAGS"
91 ;;
92 esac
93
94 AC_SUBST(THREADFLAGS)
95
96 AC_SUBST(DYNLINKFLAGS)
97
98 AC_MSG_CHECKING(whether we will be doing verbose logging)
99 AC_ARG_ENABLE(verbose-logging,
100 [ --enable-verbose-logging Do verbose logging],enable_verbose_logging=yes ,enable_verbose_logging=no)
101
102 if test $enable_verbose_logging = yes; then AC_DEFINE(VERBOSELOG, 1, [If verbose logging should be enabled])
103 fi
104 AC_MSG_RESULT($enable_verbose_logging)
105
106 AC_MSG_CHECKING(whether we should build static binaries)
107
108 AC_ARG_ENABLE(static-binaries,
109 [ --enable-static-binaries Build static binaries],
110 [case "${enableval}" in
111 yes) static=true ;;
112 no) static=false ;;
113 *) AC_MSG_ERROR(bad value ${enableval} for --enable-static-binaries) ;;
114 esac],[debug=false])
115 AC_MSG_RESULT($static)
116
117 AM_CONDITIONAL(ALLSTATIC, test x$static = xtrue)
118
119 if test x$static = xtrue;
120 then
121 LDFLAGS="-all-static $LDFLAGS"
122 fi
123
124
125
126 modules="gmysql"
127 AC_ARG_WITH(modules, [ --with-modules Which userbases to compile with ],
128 [
129 modules="$withval"
130 ])
131
132 dynmodules="pipe"
133 AC_ARG_WITH(dynmodules, [ --with-dynmodules Which userbases to build for dynamic loading ],
134 [
135 dynmodules="$withval"
136 ])
137
138
139
140 AC_SUBST(socketdir)
141 socketdir="/var/run"
142 AC_ARG_WITH(socketdir, [ --with-socketdir Where the controlsocket lives ],
143 [
144 socketdir="$withval"
145 ])
146
147 AC_SUBST(moduledirs)
148 AC_SUBST(moduleobjects)
149 AC_SUBST(modulelibs)
150
151 AC_MSG_CHECKING(whether we will be building the server)
152 AC_ARG_ENABLE(pdns-server,
153 [ --enable-pdns_server If we should build the server],
154 enable_pdns_server=$enableval,
155 enable_pdns_server=yes)
156
157 AC_MSG_RESULT($enable_pdns_server)
158
159 if test x"$enable_pdns_server" = "xyes"
160 then
161 programdescend=pdns
162 fi
163
164 AC_SUBST(programdescend)
165
166
167 AC_MSG_CHECKING(whether we will be building the recursor)
168 AC_ARG_ENABLE(recursor,
169 [ --enable-recursor If we should build the server],
170 enable_recursor=$enableval,
171 enable_recursor=no)
172
173 AC_MSG_RESULT($enable_recursor)
174
175 AM_CONDITIONAL(RECURSOR,test x"$enable_recursor" = "xyes")
176
177 for a in $modules $dynmodules
178 do
179 case "$a" in
180 mysql )
181 needmysql=yes
182 ;;
183 gmysql )
184 needmysql=yes
185 ;;
186 gpgsql )
187 needpgsql=yes
188 ;;
189 pdns )
190 needmysql=yes
191 ;;
192 esac
193 done
194
195
196 if test "$needmysql"
197 then
198 AC_ARG_WITH(mysql,
199 [ --with-mysql=<path> root directory path of MySQL installation],
200 [MYSQL_lib_check="$withval/lib/mysql $with_mysql/lib"
201 MYSQL_inc_check="$withval/include/mysql"],
202 [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"
203 MYSQL_inc_check="/usr/local/mysql/include/mysql /usr/local/include/mysql /opt/mysql/include/mysql /opt/mysql/include /usr/include/mysql"])
204 AC_ARG_WITH(mysql-lib,
205 [ --with-mysql-lib=<path> directory path of MySQL library installation],
206 [MYSQL_lib_check="$withval/lib/mysql $withval/mysql $withval"])
207 AC_ARG_WITH(mysql-includes,
208 [ --with-mysql-includes=<path>
209 directory path of MySQL header installation],
210 [MYSQL_inc_check="$withval/include/mysql $withval/mysql $withval"])
211 AC_MSG_CHECKING([for MySQL library directory])
212 MYSQL_libdir=
213 for m in $MYSQL_lib_check; do
214 if test -d "$m" && \
215 (test -f "$m/libmysqlclient.so" || test -f "$m/libmysqlclient.a")
216 then
217 MYSQL_libdir=$m
218 break
219 fi
220 done
221 if test -z "$MYSQL_libdir"; then
222 AC_MSG_ERROR([Didn't find the mysql library dir in '$MYSQL_lib_check'])
223 fi
224 case "$MYSQL_libdir" in
225 /usr/lib ) MYSQL_lib="" ;;
226 /* ) MYSQL_lib=-L$MYSQL_libdir; LDFLAGS="$MYSQL_lib $LDFLAGS";;
227 * ) AC_MSG_ERROR([The MySQL library directory ($MYSQL_libdir) must be an absolute path.]) ;;
228 esac
229
230 AC_SUBST(MYSQL_lib)
231
232 AC_MSG_RESULT([$MYSQL_libdir])
233 AC_MSG_CHECKING([for MySQL include directory])
234 MYSQL_incdir=
235 for m in $MYSQL_inc_check; do
236 if test -d "$m" && test -f "$m/mysql.h"
237 then
238 MYSQL_incdir=$m
239 break
240 fi
241 done
242 if test -z "$MYSQL_incdir"; then
243 AC_MSG_ERROR([Didn't find the mysql include dir in '$MYSQL_inc_check'])
244 fi
245
246 case "$MYSQL_incdir" in
247 /* ) ;;
248 * ) AC_MSG_ERROR([The MySQL include directory ($MYSQL_incdir) must be an absolute path.]) ;;
249 esac
250
251 AC_SUBST(MYSQL_incdir)
252 AC_MSG_RESULT([$MYSQL_incdir])
253 # LIBS="$LIBS -lmysqlclient"
254 fi
255
256
257
258 if test "$needpgsql"
259 then
260 AC_ARG_WITH(pgsql,
261 [ --with-pgsql=<path> root directory path of PgSQL installation],
262 [PGSQL_lib_check="$withval/lib/pgsql $with_pgsql/lib"
263 PGSQL_inc_check="$withval/include/pgsql"],
264 [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"
265 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"])
266 AC_ARG_WITH(pgsql-lib,
267 [ --with-pgsql-lib=<path> directory path of PgSQL library installation],
268 [PGSQL_lib_check="$withval/lib/pgsql $withval/pgsql $withval"])
269 AC_ARG_WITH(pgsql-includes,
270 [ --with-pgsql-includes=<path>
271 directory path of PgSQL header installation],
272 [PGSQL_inc_check="$withval/include/pgsql $withval/pgsql $withval"])
273 AC_MSG_CHECKING([for PgSQL library directory])
274 PGSQL_libdir=
275 for m in $PGSQL_lib_check; do
276 if test -d "$m" && \
277 (test -f "$m/libpq++.so" || test -f "$m/libpq++.a")
278 then
279 PGSQL_libdir=$m
280 break
281 fi
282 done
283 if test -z "$PGSQL_libdir"; then
284 AC_MSG_ERROR([Didn't find the pgsql library dir in '$PGSQL_lib_check'])
285 fi
286 case "$PGSQL_libdir" in
287 /usr/lib ) PGSQL_lib="" ;;
288 /* ) PGSQL_lib="-L$PGSQL_libdir -Wl,-rpath,$PGSQL_libdir"
289 LDFLAGS="$PGSQL_lib $LDFLAGS"
290 ;;
291 * ) AC_MSG_ERROR([The PgSQL library directory ($PGSQL_libdir) must be an absolute path.]) ;;
292 esac
293
294 AC_SUBST(PGSQL_lib)
295 AC_MSG_RESULT([$PGSQL_libdir])
296 AC_MSG_CHECKING([for PgSQL include directory])
297 PGSQL_incdir=
298 for m in $PGSQL_inc_check; do
299 if test -d "$m" && test -f "$m/libpq++.h"
300 then
301 PGSQL_incdir=$m
302 break
303 fi
304 done
305 if test -z "$PGSQL_incdir"; then
306 AC_MSG_ERROR([Didn't find the PgSQL include dir in '$PGSQL_inc_check'])
307 fi
308 case "$PGSQL_incdir" in
309 /* ) ;;
310 * ) AC_MSG_ERROR([The PgSQL include directory ($PGSQL_incdir) must be an absolute path.]) ;;
311 esac
312 AC_SUBST(PGSQL_incdir)
313 AC_MSG_RESULT([$PGSQL_incdir])
314
315 # LIBS="$LIBS -lpq++ -lpq -lssl -lcrypt -lcrypto"
316 fi
317
318
319 for a in $modules
320 do
321 moduledirs="$moduledirs ${a}backend"
322
323 for b in `cat $srcdir/modules/${a}backend/OBJECTFILES`
324 do
325 moduleobjects="$moduleobjects ../modules/${a}backend/$b"
326 done
327 modulelibs="$modulelibs `cat $srcdir/modules/${a}backend/OBJECTLIBS`"
328 done
329
330 for a in $dynmodules
331 do
332 moduledirs="$moduledirs ${a}backend"
333 done
334
335 export moduledirs moduleobjects modulelibs
336
337 AC_OUTPUT(Makefile modules/Makefile pdns/Makefile codedocs/Makefile \
338 pdns/backends/Makefile pdns/backends/bind/Makefile pdns/pdns \
339 modules/mysqlbackend/Makefile modules/pdnsbackend/Makefile \
340 modules/gmysqlbackend/Makefile modules/db2backend/Makefile \
341 modules/pipebackend/Makefile modules/oraclebackend/Makefile \
342 modules/xdbbackend/Makefile modules/odbcbackend/Makefile \
343 modules/gpgsqlbackend/Makefile modules/ldapbackend/Makefile )