]> git.ipfire.org Git - thirdparty/pdns.git/blame - configure.in
dependencies
[thirdparty/pdns.git] / configure.in
CommitLineData
3120733f
BH
1dnl intro
2AC_INIT(pdns/receiver.cc)
5303a045 3AM_INIT_AUTOMAKE(pdns, 2.9.1)
a71808f6 4AC_CANONICAL_HOST
3120733f
BH
5AM_CONFIG_HEADER(config.h)
6CXXFLAGS="-Wall -pthread -O2"
7
8AC_PREFIX_DEFAULT(/usr/local)
9AC_PROG_CC
10AC_PROG_CXX
11AC_PROG_YACC
12AM_PROG_LEX
13AC_PROG_INSTALL
14AC_PROG_MAKE_SET
15AM_PROG_LIBTOOL
16AC_LANG_CPLUSPLUS
17
18dnl Checks for header files.
19AC_HEADER_STDC
20AC_CHECK_HEADERS(fcntl.h getopt.h limits.h strings.h sys/time.h syslog.h unistd.h)
21
22dnl Checks for typedefs, structures, and compiler characteristics.
23AC_TYPE_SIZE_T
24AC_HEADER_TIME
25AC_STRUCT_TM
26
27dnl Checks for library functions.
28AC_FUNC_SETVBUF_REVERSED
29AC_TYPE_SIGNAL
30AC_FUNC_STRFTIME
31AC_CHECK_FUNCS(gethostname gettimeofday mkdir mktime select socket strerror)
32
33
34#
35# Check for libdl
36#
37
38my_save_LIBS="$LIBS"
39LIBS=""
40AC_CHECK_LIB(dl,dlopen)
41LIBDL=$LIBS
42LIBS="$my_save_LIBS"
43AC_SUBST(LIBDL)
44
3120733f
BH
45# pthread_create is in standard libraries (As in BSDI 3.0)
46AC_MSG_CHECKING("for pthread_create in -libc");
47AC_TRY_LINK(
48[#include <pthread.h>],
49[ (void) pthread_create((pthread_t*) 0,(pthread_attr_t*) 0, 0, 0); ],
50with_posix_threads=yes, with_posix_threads=no)
51AC_MSG_RESULT("$with_posix_threads")
52if test "$with_posix_threads" = "no"
53then
54 AC_MSG_CHECKING("for pthread_create in -lpthread");
55 ac_save_LIBS="$LIBS"
56 LIBS="$LIBS -lpthread"
57 AC_TRY_LINK(
58 [#include <pthread.h>],
59 [ (void) pthread_create((pthread_t*) 0,(pthread_attr_t*) 0, 0, 0); ],
60 with_posix_threads=yes, with_posix_threads=no)
61 AC_MSG_RESULT("$with_posix_threads")
62 if test "$with_posix_threads" = "no"
63 then
64 LIBS=" $ac_save_LIBS -lpthreads"
65 AC_MSG_CHECKING("for pthread_create in -lpthreads");
66 AC_TRY_LINK(
67 [#include <pthread.h>],
68 [ pthread_create((pthread_t*) 0,(pthread_attr_t*) 0, 0, 0); ],
69 with_posix_threads=yes, with_posix_threads=no)
70 AC_MSG_RESULT("$with_posix_threads")
71 if test "$with_posix_threads" = "no"
72 then
73 # This is for FreeBSD
74 LIBS="$ac_save_LIBS -pthread"
75 AC_MSG_CHECKING("for pthread_create in -pthread");
76 AC_TRY_LINK(
77 [#include <pthread.h>],
78 [ pthread_create((pthread_t*) 0,(pthread_attr_t*) 0, 0, 0); ],
79 with_posix_threads=yes, with_posix_threads=no)
80 AC_MSG_RESULT("$with_posix_threads")
81 if test "$with_posix_threads" = "no"
82 then
83 with_mit_threads="yes"
84 LIBS="$ac_save_LIBS"
85 fi
86 fi
87 fi
88fi
89
90case "$host_os" in
99c45e0a
BH
91solaris2*)
92 AC_DEFINE(NEED_POSIX_TYPEDEF)
3120733f
BH
93 ;;
94*)
95 ;;
96esac
97
98AC_MSG_CHECKING(whether we will be doing verbose logging)
99AC_ARG_ENABLE(verbose-logging,
100 [ --enable-verbose-logging Do verbose logging],enable_verbose_logging=yes ,enable_verbose_logging=no)
101
102if test $enable_verbose_logging = yes; then AC_DEFINE(VERBOSELOG, 1)
103fi
104AC_MSG_RESULT($enable_verbose_logging)
105
106AC_MSG_CHECKING(whether we should build static binaries)
ac2bb9e7 107
3120733f 108AC_ARG_ENABLE(static-binaries,
ac2bb9e7
BH
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])
115AC_MSG_RESULT($static)
116
117AM_CONDITIONAL(ALLSTATIC, test x$static = xtrue)
3120733f 118
ac2bb9e7 119if test x$static = xtrue;
3120733f 120then
99c45e0a 121 LDFLAGS="-all-static $LDFLAGS"
3120733f 122fi
ac2bb9e7 123
3120733f
BH
124
125
126modules="mysql"
127AC_ARG_WITH(modules, [ --with-modules Which userbases to compile with ],
128[
129 modules="$withval"
130])
131
132
133AC_SUBST(socketdir)
134socketdir="/var/run"
135AC_ARG_WITH(socketdir, [ --with-socketdir Where the controlsocket lives ],
136[
137 socketdir="$withval"
138])
139
99c45e0a
BH
140domysql=yes
141AC_MSG_CHECKING(whether we to include mysql support in the generic backend)
142AC_ARG_ENABLE(mysql,
143 [ --enable-mysql Whether to include MySQL support in generic backend],domysql=yes,domysql=)
144
145AC_MSG_RESULT($domysql)
146AC_SUBST(domysql)
147
148AC_MSG_CHECKING(whether we to include pgsql support in the generic backend)
149AC_ARG_ENABLE(pgsql,
150 [ --enable-pgsql Whether to include PgSQL support in generic backend],dopgsql=yes,dopgsql=)
151
152AC_MSG_RESULT($dopgsql)
153AC_SUBST(dopgsql)
154
3120733f
BH
155
156AC_SUBST(moduledirs)
157AC_SUBST(moduleobjects)
158AC_SUBST(modulelibs)
159
68d8bf3a
BH
160for a in $modules
161do
162 case "$a" in
163 pgmysql )
164 if test "$dopgsql"
165 then
166 needpgsql=yes
167 fi
168 if test "$domysql"
169 then
170 needmysql=yes
171 fi
172 ;;
173 mysql )
174 needmysql=yes
175 ;;
176 pdns )
177 needmysql=yes
178 ;;
179 esac
180done
181
182
183if test "$needmysql"
99c45e0a
BH
184then
185 AC_ARG_WITH(mysql,
186 [ --with-mysql=<path> root directory path of MySQL installation],
187 [MYSQL_lib_check="$withval/lib/mysql $with_mysql/lib"
188 MYSQL_inc_check="$withval/include/mysql"],
189 [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"
190 MYSQL_inc_check="/usr/local/mysql/include/mysql /usr/local/include/mysql /opt/mysql/include/mysql /opt/mysql/include /usr/include/mysql"])
3120733f 191 AC_ARG_WITH(mysql-lib,
99c45e0a
BH
192 [ --with-mysql-lib=<path> directory path of MySQL library installation],
193 [MYSQL_lib_check="$withval/lib/mysql $withval/mysql $withval"])
3120733f 194 AC_ARG_WITH(mysql-includes,
99c45e0a
BH
195 [ --with-mysql-includes=<path>
196 directory path of MySQL header installation],
197 [MYSQL_inc_check="$withval/include/mysql $withval/mysql $withval"])
3120733f 198 AC_MSG_CHECKING([for MySQL library directory])
99c45e0a
BH
199 MYSQL_libdir=
200 for m in $MYSQL_lib_check; do
201 if test -d "$m" && \
202 (test -f "$m/libmysqlclient.so" || test -f "$m/libmysqlclient.a")
203 then
204 MYSQL_libdir=$m
205 break
206 fi
207 done
3120733f 208 if test -z "$MYSQL_libdir"; then
99c45e0a
BH
209 AC_MSG_ERROR([Didn't find the mysql library dir in '$MYSQL_lib_check'])
210 fi
3120733f 211 case "$MYSQL_libdir" in
99c45e0a
BH
212 /usr/lib ) MYSQL_lib="" ;;
213 /* ) MYSQL_lib=-L$MYSQL_libdir; LDFLAGS="$MYSQL_lib $LDFLAGS";;
214 * ) AC_MSG_ERROR([The MySQL library directory ($MYSQL_libdir) must be an absolute path.]) ;;
215 esac
3120733f 216 AC_SUBST(MYSQL_lib)
99c45e0a 217 AC_MSG_RESULT([$MYSQL_libdir])
3120733f 218 AC_MSG_CHECKING([for MySQL include directory])
99c45e0a
BH
219 MYSQL_incdir=
220 for m in $MYSQL_inc_check; do
221 if test -d "$m" && test -f "$m/mysql.h"
222 then
223 MYSQL_incdir=$m
224 break
225 fi
226 done
3120733f 227 if test -z "$MYSQL_incdir"; then
99c45e0a
BH
228 AC_MSG_ERROR([Didn't find the mysql include dir in '$MYSQL_inc_check'])
229 fi
3120733f 230 case "$MYSQL_incdir" in
99c45e0a
BH
231 /* ) ;;
232 * ) AC_MSG_ERROR([The MySQL include directory ($MYSQL_incdir) must be an absolute path.]) ;;
233 esac
3120733f 234 AC_SUBST(MYSQL_incdir)
99c45e0a
BH
235 AC_MSG_RESULT([$MYSQL_incdir])
236 LIBS="$LIBS -lmysqlclient"
237fi
238
99c45e0a
BH
239
240
241if test "$needpgsql"
242then
243 AC_ARG_WITH(pgsql,
244 [ --with-pgsql=<path> root directory path of PgSQL installation],
245 [PGSQL_lib_check="$withval/lib/pgsql $with_pgsql/lib"
246 PGSQL_inc_check="$withval/include/pgsql"],
247 [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"
248 PGSQL_inc_check="/usr/local/pgsql/include/pgsql /usr/local/include/pgsql /opt/pgsql/include/pgsql /opt/pgsql/include /usr/include/postgresql"])
249 AC_ARG_WITH(pgsql-lib,
250 [ --with-pgsql-lib=<path> directory path of PgSQL library installation],
251 [PGSQL_lib_check="$withval/lib/pgsql $withval/pgsql $withval"])
252 AC_ARG_WITH(pgsql-includes,
253 [ --with-pgsql-includes=<path>
254 directory path of PgSQL header installation],
255 [PGSQL_inc_check="$withval/include/pgsql $withval/pgsql $withval"])
256 AC_MSG_CHECKING([for PgSQL library directory])
257 PGSQL_libdir=
258 for m in $PGSQL_lib_check; do
259 if test -d "$m" && \
260 (test -f "$m/libpq++.so" || test -f "$m/libpq++.a")
261 then
262 PGSQL_libdir=$m
263 break
264 fi
265 done
266 if test -z "$PGSQL_libdir"; then
267 AC_MSG_ERROR([Didn't find the pgsql library dir in '$PGSQL_lib_check'])
268 fi
269 case "$PGSQL_libdir" in
270 /usr/lib ) PGSQL_lib="" ;;
271 /* ) PGSQL_lib=-L$PGSQL_libdir; LDFLAGS="$PGSQL_lib $LDFLAGS";;
272 * ) AC_MSG_ERROR([The PgSQL library directory ($PGSQL_libdir) must be an absolute path.]) ;;
273 esac
274 AC_SUBST(PGSQL_lib)
275 AC_MSG_RESULT([$PGSQL_libdir])
276 AC_MSG_CHECKING([for PgSQL include directory])
277 PGSQL_incdir=
278 for m in $PGSQL_inc_check; do
279 if test -d "$m" && test -f "$m/libpq++.h"
280 then
281 PGSQL_incdir=$m
282 break
283 fi
284 done
285 if test -z "$PGSQL_incdir"; then
286 AC_MSG_ERROR([Didn't find the mysql include dir in '$PGSQL_inc_check'])
287 fi
288 case "$PGSQL_incdir" in
289 /* ) ;;
290 * ) AC_MSG_ERROR([The PgSQL include directory ($PGSQL_incdir) must be an absolute path.]) ;;
291 esac
292 AC_SUBST(PGSQL_incdir)
293 AC_MSG_RESULT([$PGSQL_incdir])
294
295 LIBS="$LIBS -lpq++ -lpq -lssl -lcrypt -lcrypto"
296fi
297
298
299for a in $modules
300do
301 moduledirs="$moduledirs ${a}backend"
302
303 case "$a" in
304 pgmysql)
6ef3d4a9
BH
305 rm -f $srcdir/modules/pgmysqlbackend/OBJECTFILES
306 cat /dev/null > $srcdir/modules/pgmysqlbackend/OBJECTLIBS
619e8acc 307 echo gmysqlbackend.o > $srcdir/modules/pgmysqlbackend/OBJECTFILES
99c45e0a
BH
308 if test -n "$domysql"
309 then
619e8acc 310 echo smysql.o >> $srcdir/modules/pgmysqlbackend/OBJECTFILES
99c45e0a
BH
311 fi
312
313 if test -n "$dopgsql"
314 then
6ef3d4a9 315 echo spgsql.o >> $srcdir/modules/pgmysqlbackend/OBJECTFILES
99c45e0a
BH
316 fi
317 ;;
3120733f
BH
318 esac
319
320
619e8acc 321 for b in `cat $srcdir/modules/${a}backend/OBJECTFILES`
3120733f
BH
322 do
323 moduleobjects="$moduleobjects ../modules/${a}backend/$b"
324 done
619e8acc 325 modulelibs="$modulelibs `cat $srcdir/modules/${a}backend/OBJECTLIBS`"
3120733f
BH
326done
327export moduledirs moduleobjects modulelibs
328
329AC_OUTPUT(Makefile modules/Makefile pdns/Makefile pdns/codedocs/Makefile \
6ef3d4a9 330pdns/backends/Makefile pdns/backends/bind/Makefile pdns/pdns \
3120733f 331modules/mysqlbackend/Makefile modules/pdnsbackend/Makefile \
ac2bb9e7
BH
332modules/pgmysqlbackend/Makefile modules/db2backend/Makefile \
333modules/pipebackend/Makefile )