]> git.ipfire.org Git - thirdparty/pdns.git/blob - configure.in
juh
[thirdparty/pdns.git] / configure.in
1 dnl intro
2 AC_INIT(pdns/receiver.cc)
3 AM_INIT_AUTOMAKE(pdns, 2.9)
4 AM_CONFIG_HEADER(config.h)
5 CXXFLAGS="-Wall -pthread -O2"
6
7 AC_PREFIX_DEFAULT(/usr/local)
8 AC_PROG_CC
9 AC_PROG_CXX
10 AC_PROG_YACC
11 AM_PROG_LEX
12 AC_PROG_INSTALL
13 AC_PROG_MAKE_SET
14 AM_PROG_LIBTOOL
15 AC_LANG_CPLUSPLUS
16
17 dnl Checks for header files.
18 AC_HEADER_STDC
19 AC_CHECK_HEADERS(fcntl.h getopt.h limits.h strings.h sys/time.h syslog.h unistd.h)
20
21 dnl Checks for typedefs, structures, and compiler characteristics.
22 AC_TYPE_SIZE_T
23 AC_HEADER_TIME
24 AC_STRUCT_TM
25
26 dnl Checks for library functions.
27 AC_FUNC_SETVBUF_REVERSED
28 AC_TYPE_SIGNAL
29 AC_FUNC_STRFTIME
30 AC_CHECK_FUNCS(gethostname gettimeofday mkdir mktime select socket strerror)
31
32
33 #
34 # Check for libdl
35 #
36
37 my_save_LIBS="$LIBS"
38 LIBS=""
39 AC_CHECK_LIB(dl,dlopen)
40 LIBDL=$LIBS
41 LIBS="$my_save_LIBS"
42 AC_SUBST(LIBDL)
43
44
45
46 # pthread_create is in standard libraries (As in BSDI 3.0)
47 AC_MSG_CHECKING("for pthread_create in -libc");
48 AC_TRY_LINK(
49 [#include <pthread.h>],
50 [ (void) pthread_create((pthread_t*) 0,(pthread_attr_t*) 0, 0, 0); ],
51 with_posix_threads=yes, with_posix_threads=no)
52 AC_MSG_RESULT("$with_posix_threads")
53 if test "$with_posix_threads" = "no"
54 then
55 AC_MSG_CHECKING("for pthread_create in -lpthread");
56 ac_save_LIBS="$LIBS"
57 LIBS="$LIBS -lpthread"
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 LIBS=" $ac_save_LIBS -lpthreads"
66 AC_MSG_CHECKING("for pthread_create in -lpthreads");
67 AC_TRY_LINK(
68 [#include <pthread.h>],
69 [ pthread_create((pthread_t*) 0,(pthread_attr_t*) 0, 0, 0); ],
70 with_posix_threads=yes, with_posix_threads=no)
71 AC_MSG_RESULT("$with_posix_threads")
72 if test "$with_posix_threads" = "no"
73 then
74 # This is for FreeBSD
75 LIBS="$ac_save_LIBS -pthread"
76 AC_MSG_CHECKING("for pthread_create in -pthread");
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 with_mit_threads="yes"
85 LIBS="$ac_save_LIBS"
86 fi
87 fi
88 fi
89 fi
90
91 case "$host_os" in
92 solaris2*) AC_DEFINE(NEED_POSIX_TYPEDEF)
93 ;;
94 *)
95 ;;
96 esac
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)
103 fi
104 AC_MSG_RESULT($enable_verbose_logging)
105
106 AC_MSG_CHECKING(whether we should build static binaries)
107 AC_ARG_ENABLE(static-binaries,
108 [ --enable-static-binaries Build static binaries],enable_static_binaries=yes ,enable_static_binaries=no)
109
110 if test $enable_static_binaries = yes;
111 then
112 LDFLAGS="-all-static $LD_FLAGS"
113 fi
114 AC_MSG_RESULT($enable_static_binaries)
115
116
117 modules="mysql"
118 AC_ARG_WITH(modules, [ --with-modules Which userbases to compile with ],
119 [
120 modules="$withval"
121 ])
122
123
124 AC_SUBST(socketdir)
125 socketdir="/var/run"
126 AC_ARG_WITH(socketdir, [ --with-socketdir Where the controlsocket lives ],
127 [
128 socketdir="$withval"
129 ])
130
131
132 AC_SUBST(moduledirs)
133 AC_SUBST(moduleobjects)
134 AC_SUBST(modulelibs)
135
136 for a in $modules
137 do
138 moduledirs="$moduledirs ${a}backend"
139
140 case "$a" in
141 mysql )
142 #
143 # Location of MySQL installation
144 #
145 AC_ARG_WITH(mysql,
146 [ --with-mysql=<path> root directory path of MySQL installation],
147 [MYSQL_lib_check="$withval/lib/mysql $with_mysql/lib"
148 MYSQL_inc_check="$withval/include/mysql"],
149 [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"
150 MYSQL_inc_check="/usr/local/mysql/include/mysql /usr/local/include/mysql /opt/mysql/include/mysql /opt/mysql/include /usr/include/mysql"])
151
152 AC_ARG_WITH(mysql-lib,
153 [ --with-mysql-lib=<path> directory path of MySQL library installation],
154 [MYSQL_lib_check="$withval/lib/mysql $withval/mysql $withval"])
155
156 AC_ARG_WITH(mysql-includes,
157 [ --with-mysql-includes=<path>
158 directory path of MySQL header installation],
159 [MYSQL_inc_check="$withval/include/mysql $withval/mysql $withval"])
160
161 AC_MSG_CHECKING([for MySQL library directory])
162 MYSQL_libdir=
163 for m in $MYSQL_lib_check; do
164 if test -d "$m" && \
165 (test -f "$m/libmysqlclient.so" || test -f "$m/libmysqlclient.a")
166 then
167 MYSQL_libdir=$m
168 break
169 fi
170 done
171
172 if test -z "$MYSQL_libdir"; then
173 AC_MSG_ERROR([Didn't find the mysql library dir in '$MYSQL_lib_check'])
174 fi
175
176 case "$MYSQL_libdir" in
177 /usr/lib ) MYSQL_lib="";;
178 /* ) MYSQL_lib=-L$MYSQL_libdir;;
179 * ) AC_MSG_ERROR([The MySQL library directory ($MYSQL_libdir) must be an absolute path.]) ;;
180 esac
181
182 AC_SUBST(MYSQL_lib)
183 AC_MSG_RESULT([$MYSQL_libdir])
184
185 AC_MSG_CHECKING([for MySQL include directory])
186 MYSQL_incdir=
187 for m in $MYSQL_inc_check; do
188 if test -d "$m" && test -f "$m/mysql.h"
189 then
190 MYSQL_incdir=$m
191 break
192 fi
193 done
194
195 if test -z "$MYSQL_incdir"; then
196 AC_MSG_ERROR([Didn't find the mysql include dir in '$MYSQL_inc_check'])
197 fi
198
199 case "$MYSQL_incdir" in
200 /* ) ;;
201 * ) AC_MSG_ERROR([The MySQL include directory ($MYSQL_incdir) must be an absolute path.]) ;;
202 esac
203
204 AC_SUBST(MYSQL_incdir)
205 AC_MSG_RESULT([$MYSQL_incdir])
206 esac
207
208
209 for b in $(cat modules/${a}backend/OBJECTFILES)
210 do
211 moduleobjects="$moduleobjects ../modules/${a}backend/$b"
212 done
213 modulelibs="$modulelibs $(cat modules/${a}backend/OBJECTLIBS)"
214 done
215 export moduledirs moduleobjects modulelibs
216
217 AC_OUTPUT(Makefile modules/Makefile pdns/Makefile pdns/codedocs/Makefile \
218 pdns/backends/bind/Makefile pdns/backends/Makefile pdns/pdns \
219 modules/mysqlbackend/Makefile modules/pdnsbackend/Makefile \
220 modules/pgmysqlbackend/Makefile modules/db2backend/Makefile)