]>
Commit | Line | Data |
---|---|---|
3120733f BH |
1 | dnl intro |
2 | AC_INIT(pdns/receiver.cc) | |
bdc9f8d2 | 3 | AM_INIT_AUTOMAKE(pdns, 2.9.4) |
a71808f6 | 4 | AC_CANONICAL_HOST |
3120733f | 5 | AM_CONFIG_HEADER(config.h) |
1258abe0 BH |
6 | AC_C_BIGENDIAN |
7 | AC_PREREQ(2.52) | |
152b4591 | 8 | CXXFLAGS="$CXXFLAGS -Wall -O2" |
3120733f BH |
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. | |
3120733f | 30 | AC_TYPE_SIGNAL |
3120733f BH |
31 | AC_CHECK_FUNCS(gethostname gettimeofday mkdir mktime select socket strerror) |
32 | ||
3120733f | 33 | # Check for libdl |
3120733f BH |
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 | ||
731f58b8 BH |
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 | ||
178d5134 | 56 | DYNLINKFLAGS="" |
216b5dc4 BH |
57 | THREADFLAGS="" |
58 | ||
3120733f | 59 | case "$host_os" in |
178d5134 | 60 | solaris2.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 | ;; | |
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" | |
1258abe0 BH |
71 | CXXFLAGS="-D_REENTRANT $CXXFLAGS" |
72 | ;; | |
73 | linux*) | |
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 |
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 | ;; | |
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 | ;; |
92 | esac | |
93 | ||
216b5dc4 BH |
94 | AC_SUBST(THREADFLAGS) |
95 | ||
178d5134 BH |
96 | AC_SUBST(DYNLINKFLAGS) |
97 | ||
3120733f BH |
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 | ||
1258abe0 | 102 | if test $enable_verbose_logging = yes; then AC_DEFINE(VERBOSELOG, 1, [If verbose logging should be enabled]) |
3120733f BH |
103 | fi |
104 | AC_MSG_RESULT($enable_verbose_logging) | |
105 | ||
106 | AC_MSG_CHECKING(whether we should build static binaries) | |
ac2bb9e7 | 107 | |
3120733f | 108 | AC_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]) | |
115 | AC_MSG_RESULT($static) | |
116 | ||
117 | AM_CONDITIONAL(ALLSTATIC, test x$static = xtrue) | |
3120733f | 118 | |
ac2bb9e7 | 119 | if test x$static = xtrue; |
3120733f | 120 | then |
99c45e0a | 121 | LDFLAGS="-all-static $LDFLAGS" |
3120733f | 122 | fi |
ac2bb9e7 | 123 | |
3120733f BH |
124 | |
125 | ||
2896954b | 126 | modules="gmysql" |
3120733f BH |
127 | AC_ARG_WITH(modules, [ --with-modules Which userbases to compile with ], |
128 | [ | |
129 | modules="$withval" | |
130 | ]) | |
131 | ||
731f58b8 BH |
132 | dynmodules="pipe" |
133 | AC_ARG_WITH(dynmodules, [ --with-dynmodules Which userbases to build for dynamic loading ], | |
134 | [ | |
135 | dynmodules="$withval" | |
136 | ]) | |
137 | ||
138 | ||
3120733f BH |
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 | ||
3120733f BH |
147 | AC_SUBST(moduledirs) |
148 | AC_SUBST(moduleobjects) | |
149 | AC_SUBST(modulelibs) | |
150 | ||
5a59d2ac BH |
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 | ||
731f58b8 | 166 | for a in $modules $dynmodules |
68d8bf3a BH |
167 | do |
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 | |
182 | done | |
183 | ||
184 | ||
185 | if test "$needmysql" | |
99c45e0a BH |
186 | then |
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 |
243 | fi |
244 | ||
99c45e0a BH |
245 | |
246 | ||
247 | if test "$needpgsql" | |
248 | then | |
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 |
305 | fi |
306 | ||
307 | ||
308 | for a in $modules | |
309 | do | |
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 | 317 | done |
731f58b8 BH |
318 | |
319 | for a in $dynmodules | |
320 | do | |
321 | moduledirs="$moduledirs ${a}backend" | |
322 | done | |
323 | ||
3120733f BH |
324 | export moduledirs moduleobjects modulelibs |
325 | ||
803ca684 | 326 | AC_OUTPUT(Makefile modules/Makefile pdns/Makefile codedocs/Makefile \ |
6ef3d4a9 | 327 | pdns/backends/Makefile pdns/backends/bind/Makefile pdns/pdns \ |
3120733f | 328 | modules/mysqlbackend/Makefile modules/pdnsbackend/Makefile \ |
2896954b | 329 | modules/gmysqlbackend/Makefile modules/db2backend/Makefile \ |
731f58b8 | 330 | modules/pipebackend/Makefile modules/oraclebackend/Makefile \ |
2896954b BH |
331 | modules/xdbbackend/Makefile modules/odbcbackend/Makefile \ |
332 | modules/gpgsqlbackend/Makefile ) |