root/trunk/pdns/configure.in @ 176

Revision 176, 9.7 KB (checked in by ahu, 10 years ago)

2.9.10

  • Property svn:eol-style set to native
  • Property svn:keywords set to author date id revision
Line 
1dnl intro
2AC_INIT(pdns/receiver.cc)
3AM_INIT_AUTOMAKE(pdns, 2.9.10)
4AC_CANONICAL_HOST
5AM_CONFIG_HEADER(config.h)
6AC_C_BIGENDIAN
7AC_PREREQ(2.52)
8CXXFLAGS="$CXXFLAGS -Wall -O2"
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.
30AC_TYPE_SIGNAL
31AC_CHECK_FUNCS(gethostname gettimeofday mkdir mktime select socket strerror)
32
33# Check for libdl
34
35my_save_LIBS="$LIBS"
36LIBS=""
37AC_CHECK_LIB(dl,dlopen)
38LIBDL=$LIBS
39LIBS="$my_save_LIBS"
40AC_SUBST(LIBDL)
41
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
56DYNLINKFLAGS=""
57THREADFLAGS=""
58
59case "$host_os" in
60solaris2.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        ;;
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"
71        CXXFLAGS="-D_REENTRANT $CXXFLAGS"
72        ;;
73linux*)
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        ;;
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        ;;
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        ;;
92esac
93
94AC_SUBST(THREADFLAGS)
95
96AC_SUBST(DYNLINKFLAGS)
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, [If verbose logging should be enabled])
103fi
104AC_MSG_RESULT($enable_verbose_logging)
105
106AC_MSG_CHECKING(whether we should build static binaries)
107
108AC_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])
115AC_MSG_RESULT($static)
116
117AM_CONDITIONAL(ALLSTATIC, test x$static = xtrue)
118
119if test x$static = xtrue;
120then
121        LDFLAGS="-all-static $LDFLAGS"
122fi
123
124
125
126modules="gmysql"
127AC_ARG_WITH(modules, [  --with-modules Which userbases to compile with ],
128[
129        modules="$withval" 
130])
131
132dynmodules="pipe"
133AC_ARG_WITH(dynmodules, [  --with-dynmodules Which userbases to build for dynamic loading ],
134[
135        dynmodules="$withval" 
136])
137
138
139
140AC_SUBST(socketdir)
141socketdir="/var/run"
142AC_ARG_WITH(socketdir, [  --with-socketdir Where the controlsocket lives ],
143[
144        socketdir="$withval" 
145])
146
147AC_SUBST(moduledirs)
148AC_SUBST(moduleobjects)
149AC_SUBST(modulelibs)
150
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
166
167AC_MSG_CHECKING(whether we will be building the recursor)
168AC_ARG_ENABLE(recursor,
169 [  --enable-recursor   If we should build the server],
170        enable_recursor=$enableval,
171        enable_recursor=no)
172
173AC_MSG_RESULT($enable_recursor)
174
175AM_CONDITIONAL(RECURSOR,test x"$enable_recursor" = "xyes")
176
177for a in $modules $dynmodules
178do
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
193done
194
195
196if test "$needmysql"
197then
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"
254fi
255
256
257
258if test "$needpgsql"
259then
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"
316fi
317
318
319for a in $modules
320do
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`"
328done
329
330for a in $dynmodules
331do
332        moduledirs="$moduledirs ${a}backend"
333done
334
335export moduledirs moduleobjects modulelibs
336
337AC_OUTPUT(Makefile modules/Makefile pdns/Makefile codedocs/Makefile \
338pdns/backends/Makefile pdns/backends/bind/Makefile pdns/pdns \
339modules/mysqlbackend/Makefile modules/pdnsbackend/Makefile \
340modules/gmysqlbackend/Makefile modules/db2backend/Makefile \
341modules/pipebackend/Makefile modules/oraclebackend/Makefile \
342modules/xdbbackend/Makefile modules/odbcbackend/Makefile \
343modules/gpgsqlbackend/Makefile modules/ldapbackend/Makefile )
Note: See TracBrowser for help on using the browser.