]> git.ipfire.org Git - thirdparty/pdns.git/blame - configure.in
ommm
[thirdparty/pdns.git] / configure.in
CommitLineData
3120733f
BH
1dnl intro
2AC_INIT(pdns/receiver.cc)
bdc9f8d2 3AM_INIT_AUTOMAKE(pdns, 2.9.4)
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
17AM_PROG_LIBTOOL
18AC_LANG_CPLUSPLUS
19
20dnl Checks for header files.
21AC_HEADER_STDC
22AC_CHECK_HEADERS(fcntl.h getopt.h limits.h strings.h sys/time.h syslog.h unistd.h)
23
24dnl Checks for typedefs, structures, and compiler characteristics.
25AC_TYPE_SIZE_T
26AC_HEADER_TIME
27AC_STRUCT_TM
28
29dnl Checks for library functions.
3120733f 30AC_TYPE_SIGNAL
3120733f
BH
31AC_CHECK_FUNCS(gethostname gettimeofday mkdir mktime select socket strerror)
32
3120733f 33# Check for libdl
3120733f
BH
34
35my_save_LIBS="$LIBS"
36LIBS=""
37AC_CHECK_LIB(dl,dlopen)
38LIBDL=$LIBS
39LIBS="$my_save_LIBS"
40AC_SUBST(LIBDL)
41
731f58b8
BH
42AC_MSG_CHECKING([for RTLD_NOW]);
43ac_save_LIBS="$LIBS"
44LIBS="$LIBS $LIBDL"
45AC_TRY_LINK(
46[#include <dlfcn.h>],
47[ (void) dlopen("",RTLD_NOW); ],
48has_RTLD_NOW=yes, has_RTLD_NOW=no)
49AC_MSG_RESULT([$has_RTLD_NOW])
50if test "$has_RTLD_NOW" = "no"
51then
52 AC_DEFINE(NEED_RTLD_NOW,,[If host OS misses RTLD_NOW])
53fi
54LIBS=$ac_save_LIBS
55
178d5134 56DYNLINKFLAGS=""
216b5dc4
BH
57THREADFLAGS=""
58
3120733f 59case "$host_os" in
178d5134 60solaris2.8 | solaris2.9 )
1258abe0
BH
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])
178d5134
BH
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 ;;
67solaris2.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"
1258abe0
BH
71 CXXFLAGS="-D_REENTRANT $CXXFLAGS"
72 ;;
73linux*)
74 AC_DEFINE(HAVE_IPV6,1,[If the host operating system understands IPv6])
178d5134 75 DYNLINKFLAGS="-rdynamic"
216b5dc4
BH
76 LDFLAGS="$LDFLAGS"
77 THREADFLAGS="-pthread"
78 CXXFLAGS="-D_GNU_SOURCE $CXXFLAGS"
3120733f 79 ;;
731f58b8
BH
80openbsd*)
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 ;;
3120733f 86*)
1258abe0 87 AC_DEFINE(HAVE_IPV6,1,[If the host operating system understands IPv6])
178d5134 88 DYNLINKFLAGS="-rdynamic"
1258abe0
BH
89 LDFLAGS="-pthread $LDFLAGS"
90 CXXFLAGS="-pthread $CXXFLAGS"
3120733f
BH
91 ;;
92esac
93
216b5dc4
BH
94AC_SUBST(THREADFLAGS)
95
178d5134
BH
96AC_SUBST(DYNLINKFLAGS)
97
3120733f
BH
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
1258abe0 102if test $enable_verbose_logging = yes; then AC_DEFINE(VERBOSELOG, 1, [If verbose logging should be enabled])
3120733f
BH
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
2896954b 126modules="gmysql"
3120733f
BH
127AC_ARG_WITH(modules, [ --with-modules Which userbases to compile with ],
128[
129 modules="$withval"
130])
131
731f58b8
BH
132dynmodules="pipe"
133AC_ARG_WITH(dynmodules, [ --with-dynmodules Which userbases to build for dynamic loading ],
134[
135 dynmodules="$withval"
136])
137
138
3120733f
BH
139
140AC_SUBST(socketdir)
141socketdir="/var/run"
142AC_ARG_WITH(socketdir, [ --with-socketdir Where the controlsocket lives ],
143[
144 socketdir="$withval"
145])
146
3120733f
BH
147AC_SUBST(moduledirs)
148AC_SUBST(moduleobjects)
149AC_SUBST(modulelibs)
150
5a59d2ac
BH
151AC_MSG_CHECKING(whether we will be building the server)
152AC_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
157AC_MSG_RESULT($enable_pdns_server)
158
159if test x"$enable_pdns_server" = "xyes"
160then
161 programdescend=pdns
162fi
163
164AC_SUBST(programdescend)
165
731f58b8 166for a in $modules $dynmodules
68d8bf3a
BH
167do
168 case "$a" in
68d8bf3a
BH
169 mysql )
170 needmysql=yes
171 ;;
2896954b
BH
172 gmysql )
173 needmysql=yes
174 ;;
175 gpgsql )
176 needpgsql=yes
177 ;;
68d8bf3a
BH
178 pdns )
179 needmysql=yes
180 ;;
181 esac
182done
183
184
185if test "$needmysql"
99c45e0a
BH
186then
187 AC_ARG_WITH(mysql,
188 [ --with-mysql=<path> root directory path of MySQL installation],
189 [MYSQL_lib_check="$withval/lib/mysql $with_mysql/lib"
190 MYSQL_inc_check="$withval/include/mysql"],
191 [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"
192 MYSQL_inc_check="/usr/local/mysql/include/mysql /usr/local/include/mysql /opt/mysql/include/mysql /opt/mysql/include /usr/include/mysql"])
3120733f 193 AC_ARG_WITH(mysql-lib,
99c45e0a
BH
194 [ --with-mysql-lib=<path> directory path of MySQL library installation],
195 [MYSQL_lib_check="$withval/lib/mysql $withval/mysql $withval"])
3120733f 196 AC_ARG_WITH(mysql-includes,
99c45e0a
BH
197 [ --with-mysql-includes=<path>
198 directory path of MySQL header installation],
199 [MYSQL_inc_check="$withval/include/mysql $withval/mysql $withval"])
3120733f 200 AC_MSG_CHECKING([for MySQL library directory])
99c45e0a
BH
201 MYSQL_libdir=
202 for m in $MYSQL_lib_check; do
203 if test -d "$m" && \
204 (test -f "$m/libmysqlclient.so" || test -f "$m/libmysqlclient.a")
205 then
206 MYSQL_libdir=$m
207 break
208 fi
209 done
3120733f 210 if test -z "$MYSQL_libdir"; then
99c45e0a
BH
211 AC_MSG_ERROR([Didn't find the mysql library dir in '$MYSQL_lib_check'])
212 fi
731f58b8 213 case "$MYSQL_libdir" in
99c45e0a
BH
214 /usr/lib ) MYSQL_lib="" ;;
215 /* ) MYSQL_lib=-L$MYSQL_libdir; LDFLAGS="$MYSQL_lib $LDFLAGS";;
216 * ) AC_MSG_ERROR([The MySQL library directory ($MYSQL_libdir) must be an absolute path.]) ;;
217 esac
731f58b8
BH
218
219 AC_SUBST(MYSQL_lib)
220
99c45e0a 221 AC_MSG_RESULT([$MYSQL_libdir])
3120733f 222 AC_MSG_CHECKING([for MySQL include directory])
99c45e0a
BH
223 MYSQL_incdir=
224 for m in $MYSQL_inc_check; do
225 if test -d "$m" && test -f "$m/mysql.h"
226 then
227 MYSQL_incdir=$m
228 break
229 fi
230 done
3120733f 231 if test -z "$MYSQL_incdir"; then
99c45e0a
BH
232 AC_MSG_ERROR([Didn't find the mysql include dir in '$MYSQL_inc_check'])
233 fi
731f58b8
BH
234
235 case "$MYSQL_incdir" in
99c45e0a
BH
236 /* ) ;;
237 * ) AC_MSG_ERROR([The MySQL include directory ($MYSQL_incdir) must be an absolute path.]) ;;
238 esac
731f58b8
BH
239
240 AC_SUBST(MYSQL_incdir)
99c45e0a 241 AC_MSG_RESULT([$MYSQL_incdir])
731f58b8 242# LIBS="$LIBS -lmysqlclient"
99c45e0a
BH
243fi
244
99c45e0a
BH
245
246
247if test "$needpgsql"
248then
249 AC_ARG_WITH(pgsql,
250 [ --with-pgsql=<path> root directory path of PgSQL installation],
251 [PGSQL_lib_check="$withval/lib/pgsql $with_pgsql/lib"
252 PGSQL_inc_check="$withval/include/pgsql"],
253 [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 254 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
255 AC_ARG_WITH(pgsql-lib,
256 [ --with-pgsql-lib=<path> directory path of PgSQL library installation],
257 [PGSQL_lib_check="$withval/lib/pgsql $withval/pgsql $withval"])
258 AC_ARG_WITH(pgsql-includes,
259 [ --with-pgsql-includes=<path>
260 directory path of PgSQL header installation],
261 [PGSQL_inc_check="$withval/include/pgsql $withval/pgsql $withval"])
262 AC_MSG_CHECKING([for PgSQL library directory])
263 PGSQL_libdir=
264 for m in $PGSQL_lib_check; do
265 if test -d "$m" && \
266 (test -f "$m/libpq++.so" || test -f "$m/libpq++.a")
267 then
268 PGSQL_libdir=$m
269 break
270 fi
271 done
272 if test -z "$PGSQL_libdir"; then
273 AC_MSG_ERROR([Didn't find the pgsql library dir in '$PGSQL_lib_check'])
274 fi
2896954b
BH
275 case "$PGSQL_libdir" in
276 /usr/lib ) PGSQL_lib="" ;;
277 /* ) PGSQL_lib="-L$PGSQL_libdir -Wl,-rpath,$PGSQL_libdir"
278 LDFLAGS="$PGSQL_lib $LDFLAGS"
279 ;;
99c45e0a
BH
280 * ) AC_MSG_ERROR([The PgSQL library directory ($PGSQL_libdir) must be an absolute path.]) ;;
281 esac
731f58b8
BH
282
283 AC_SUBST(PGSQL_lib)
99c45e0a
BH
284 AC_MSG_RESULT([$PGSQL_libdir])
285 AC_MSG_CHECKING([for PgSQL include directory])
286 PGSQL_incdir=
287 for m in $PGSQL_inc_check; do
288 if test -d "$m" && test -f "$m/libpq++.h"
289 then
290 PGSQL_incdir=$m
291 break
292 fi
293 done
294 if test -z "$PGSQL_incdir"; then
1258abe0 295 AC_MSG_ERROR([Didn't find the PgSQL include dir in '$PGSQL_inc_check'])
99c45e0a 296 fi
2896954b 297 case "$PGSQL_incdir" in
99c45e0a
BH
298 /* ) ;;
299 * ) AC_MSG_ERROR([The PgSQL include directory ($PGSQL_incdir) must be an absolute path.]) ;;
300 esac
301 AC_SUBST(PGSQL_incdir)
302 AC_MSG_RESULT([$PGSQL_incdir])
303
731f58b8 304# LIBS="$LIBS -lpq++ -lpq -lssl -lcrypt -lcrypto"
99c45e0a
BH
305fi
306
307
308for a in $modules
309do
310 moduledirs="$moduledirs ${a}backend"
311
619e8acc 312 for b in `cat $srcdir/modules/${a}backend/OBJECTFILES`
3120733f
BH
313 do
314 moduleobjects="$moduleobjects ../modules/${a}backend/$b"
315 done
619e8acc 316 modulelibs="$modulelibs `cat $srcdir/modules/${a}backend/OBJECTLIBS`"
3120733f 317done
731f58b8
BH
318
319for a in $dynmodules
320do
321 moduledirs="$moduledirs ${a}backend"
322done
323
3120733f
BH
324export moduledirs moduleobjects modulelibs
325
803ca684 326AC_OUTPUT(Makefile modules/Makefile pdns/Makefile codedocs/Makefile \
6ef3d4a9 327pdns/backends/Makefile pdns/backends/bind/Makefile pdns/pdns \
3120733f 328modules/mysqlbackend/Makefile modules/pdnsbackend/Makefile \
2896954b 329modules/gmysqlbackend/Makefile modules/db2backend/Makefile \
731f58b8 330modules/pipebackend/Makefile modules/oraclebackend/Makefile \
2896954b
BH
331modules/xdbbackend/Makefile modules/odbcbackend/Makefile \
332modules/gpgsqlbackend/Makefile )