]>
Commit | Line | Data |
---|---|---|
39653d75 RK |
1 | AC_PREREQ([2.61]) |
2 | ||
ba1a571d CH |
3 | dnl The following lines may be patched by set-version-auth. |
4 | AC_INIT([pdns], [git]) | |
5 | dnl AC_SUBST([DIST_HOST], [TO_BE_PATCHED]) | |
6 | dnl End patch area. | |
39653d75 | 7 | |
6707cb12 | 8 | AC_CONFIG_SRCDIR([pdns/receiver.cc]) |
39653d75 RK |
9 | AC_CONFIG_MACRO_DIR([m4]) |
10 | AC_CONFIG_HEADERS([config.h]) | |
11 | AC_CONFIG_AUX_DIR([build-aux]) | |
12 | ||
62423be7 | 13 | AM_INIT_AUTOMAKE([foreign dist-bzip2 no-dist-gzip tar-ustar -Wno-portability subdir-objects 1.11]) |
dcf224eb | 14 | AM_SILENT_RULES([yes]) |
39653d75 | 15 | |
92a4978f | 16 | AC_CANONICAL_HOST |
5801cd92 | 17 | : ${CXXFLAGS="-Wall -g -O2"} |
39653d75 | 18 | |
92a4978f | 19 | AC_PROG_CC |
dd50be34 | 20 | AM_PROG_CC_C_O |
44362487 | 21 | PDNS_CHECK_BISON |
33086d97 | 22 | PDNS_CHECK_FLEX |
92a4978f BH |
23 | AC_PROG_INSTALL |
24 | AC_PROG_MAKE_SET | |
39653d75 | 25 | |
27a4e655 RK |
26 | AC_PROG_CXX |
27 | AS_IF([test "x$CXX" = "xno" || test "x$CXX:x$GXX" = "xg++:x"], | |
28 | AC_MSG_ERROR([no C++ compiler found]) | |
29 | ) | |
30 | ||
66da2833 | 31 | AC_LANG([C++]) |
92a4978f | 32 | |
f33c1fff RK |
33 | AC_DEFINE([_GNU_SOURCE], [1], |
34 | [Define _GNU_SOURCE so that we get all necessary prototypes] | |
35 | ) | |
36 | ||
c77252b6 RK |
37 | AC_ARG_ENABLE([hardening], [ |
38 | AS_HELP_STRING([--disable-hardening, disable compiler security checks]) | |
39 | ]) | |
40 | AS_IF([test "x$enable_hardening" != "xno"], [ | |
41 | AC_CC_PIE | |
42 | AC_CC_STACK_PROTECTOR | |
43 | AC_CC_PARAM_SSP_BUFFER_SIZE([4]) | |
44 | AC_CC_D_FORTIFY_SOURCE | |
45 | AC_LD_RELRO | |
46 | ]) | |
d6e5e940 | 47 | |
3bdd9625 RK |
48 | AC_SEARCH_LIBS([socket], [socket]) |
49 | AC_SEARCH_LIBS([gethostent], [nsl]) | |
50 | AC_SEARCH_LIBS([inet_aton], [resolv]) | |
9d44a523 | 51 | |
59414d0e | 52 | m4_ifndef([LT_INIT],[ |
dbff3daf | 53 | AC_PROG_LIBTOOL([disable-static]) |
59414d0e | 54 | ],[ |
dbff3daf | 55 | LT_INIT([disable-static]) |
59414d0e RK |
56 | ]) |
57 | ||
d6e5e940 | 58 | |
96ae9a2e KM |
59 | MC_TM_GMTOFF |
60 | ||
39653d75 RK |
61 | AM_CONDITIONAL([RELEASE_BUILD], [test "$PACKAGE_VERSION" != "git"]) |
62 | ||
0949b8ae CH |
63 | # Define full_libdir to be the fully expanded (${exec_prefix}, etc.) |
64 | # "system" library path. | |
65 | # We use this to search for other libraries. | |
66 | eval full_libdir="\"$libdir\"" | |
39653d75 | 67 | |
27fe16bd RK |
68 | # detect pkg-config explicitly |
69 | PKG_PROG_PKG_CONFIG | |
70 | ||
a49b3356 RK |
71 | # check if we want a static build |
72 | AC_MSG_CHECKING([whether we will be building static binaries]) | |
73 | ||
74 | AC_ARG_ENABLE([static-binaries], | |
75 | [AS_HELP_STRING([--enable-static-binaries],[build static binaries @<:@default=no@:>@])], | |
76 | [static=$enableval], | |
77 | [static=no], | |
78 | ) | |
79 | AC_MSG_RESULT([$static]) | |
80 | ||
81 | AS_IF([test "x$static" != "xno"], [ | |
82 | PKG_CONFIG="$PKG_CONFIG --static" | |
83 | ]) | |
84 | ||
709ca59f AT |
85 | AC_CHECK_HEADERS( |
86 | [sys/mman.h], | |
87 | [AC_CHECK_FUNC( | |
88 | [mmap], | |
89 | [AC_DEFINE(HAVE_MMAP, [1], [Define to 1 if you have mmap])], | |
90 | [have_mmap=no] | |
91 | )], | |
92 | [have_mmap=no] | |
93 | ) | |
94 | ||
e3881b46 | 95 | PDNS_CHECK_RAGEL |
d81a3e14 | 96 | |
051f0aaa | 97 | PDNS_WITH_LUA |
d81a3e14 | 98 | |
94ac5f34 PD |
99 | BOOST_REQUIRE([1.35]) |
100 | BOOST_FOREACH | |
101 | BOOST_PROGRAM_OPTIONS([mt]) | |
102 | BOOST_SERIALIZATION([mt]) | |
051f0aaa | 103 | |
fedea66a | 104 | PDNS_ENABLE_UNIT_TESTS |
051f0aaa | 105 | |
13305eb1 | 106 | PDNS_WITH_SQLITE3 |
32869e14 | 107 | |
e9046dbc PL |
108 | PDNS_CHECK_PANDOC |
109 | PDNS_CHECK_MKDOCS | |
b43f4f8a | 110 | PDNS_CHECK_LINKCHECKER |
e9046dbc | 111 | |
92a4978f | 112 | dnl Checks for library functions. |
f50617c9 | 113 | AC_CHECK_FUNCS_ONCE([strcasestr localtime_r]) |
92a4978f BH |
114 | |
115 | # Check for libdl | |
92a4978f BH |
116 | my_save_LIBS="$LIBS" |
117 | LIBS="" | |
118 | AC_CHECK_LIB(dl,dlopen) | |
119 | LIBDL=$LIBS | |
120 | LIBS="$my_save_LIBS" | |
121 | AC_SUBST(LIBDL) | |
122 | ||
123 | AC_MSG_CHECKING([for RTLD_NOW]); | |
124 | ac_save_LIBS="$LIBS" | |
125 | LIBS="$LIBS $LIBDL" | |
67e8df4c RK |
126 | AC_LINK_IFELSE( |
127 | [AC_LANG_PROGRAM([[#include <dlfcn.h>]], | |
128 | [[(void) dlopen("",RTLD_NOW);]])], | |
129 | [has_RTLD_NOW=yes], | |
130 | [has_RTLD_NOW=no]) | |
92a4978f | 131 | AC_MSG_RESULT([$has_RTLD_NOW]) |
39653d75 RK |
132 | if test "$has_RTLD_NOW" = "no"; then |
133 | AC_DEFINE(NEED_RTLD_NOW,,[If host OS misses RTLD_NOW]) | |
92a4978f BH |
134 | fi |
135 | LIBS=$ac_save_LIBS | |
136 | ||
92a4978f BH |
137 | THREADFLAGS="" |
138 | ||
139 | case "$host_os" in | |
140 | solaris2.10) | |
29403f48 | 141 | LIBS="-lposix4 -lpthread -lrt $LIBS" |
39653d75 RK |
142 | CXXFLAGS="-D_REENTRANT $CXXFLAGS" |
143 | ;; | |
be1bd362 | 144 | solaris2.8 | solaris2.9 ) |
39653d75 RK |
145 | AC_DEFINE(NEED_POSIX_TYPEDEF,,[If POSIX typedefs need to be defined]) |
146 | AC_DEFINE(NEED_INET_NTOP_PROTO,,[If your OS is so broken that it needs an additional prototype]) | |
29403f48 | 147 | LIBS="-lposix4 -lpthread $LIBS" |
39653d75 RK |
148 | CXXFLAGS="-D_REENTRANT $CXXFLAGS" |
149 | ;; | |
92a4978f | 150 | linux*) |
39653d75 | 151 | THREADFLAGS="-pthread" |
39653d75 | 152 | ;; |
bf5a4844 | 153 | darwin*) |
bded797d | 154 | CXXFLAGS="-D__APPLE_USE_RFC_3542 -D_XOPEN_SOURCE $CXXFLAGS" |
39653d75 | 155 | ;; |
92a4978f | 156 | *) |
39653d75 RK |
157 | LDFLAGS="-pthread $LDFLAGS" |
158 | CXXFLAGS="-pthread $CXXFLAGS" | |
159 | ;; | |
92a4978f BH |
160 | esac |
161 | ||
162 | AC_SUBST(THREADFLAGS) | |
2cfb6b6e | 163 | AC_SUBST([DYNLINKFLAGS], [-export-dynamic]) |
92a4978f | 164 | |
8ffe1c55 | 165 | PDNS_ENABLE_VERBOSE_LOGGING |
08bc56f4 | 166 | PDNS_WITH_SYSTEM_POLARSSL |
5b117c5e | 167 | PDNS_ENABLE_BOTAN |
8daea594 | 168 | PDNS_ENABLE_PKCS11 |
1f0f33bc | 169 | PDNS_WITH_CRYPTOPP |
fcc5d084 | 170 | PDNS_ENABLE_ED25519 |
2239e91b | 171 | PDNS_ENABLE_REMOTEBACKEND_ZEROMQ |
a7db8aa6 | 172 | |
a49b3356 RK |
173 | AS_IF([test "x$static" != "xno"], [ |
174 | LDFLAGS="-all-static $LDFLAGS" | |
175 | ]) | |
92a4978f | 176 | |
e53a4bf6 | 177 | modules="bind gmysql geo random" |
39653d75 | 178 | AC_ARG_WITH([modules], |
ae2f3feb | 179 | [AS_HELP_STRING([--with-modules],[which backends to compile with @<:@default=bind gmysql geo random@:>@])], |
39653d75 RK |
180 | [modules="$withval"] |
181 | ) | |
92a4978f BH |
182 | |
183 | dynmodules="pipe" | |
39653d75 RK |
184 | AC_ARG_WITH([dynmodules], |
185 | [AS_HELP_STRING([--with-dynmodules],[which backends to build for dynamic loading @<:@default=pipe@:>@])], | |
186 | [dynmodules="$withval"] | |
187 | ) | |
92a4978f BH |
188 | |
189 | AC_SUBST(socketdir) | |
190 | socketdir="/var/run" | |
39653d75 RK |
191 | AC_ARG_WITH([socketdir], |
192 | [AS_HELP_STRING([--with-socketdir],[where the controlsocket lives @<:@default=/var/run@:>@])], | |
193 | [socketdir="$withval"] | |
194 | ) | |
92a4978f BH |
195 | |
196 | AC_SUBST(moduledirs) | |
197 | AC_SUBST(moduleobjects) | |
198 | AC_SUBST(modulelibs) | |
39653d75 | 199 | AC_DEFINE_UNQUOTED([PDNS_MODULES],"$modules", [Built-in modules]) |
92a4978f | 200 | |
39653d75 RK |
201 | AC_MSG_CHECKING([whether we will be building the server]) |
202 | AC_ARG_ENABLE([pdns-server], | |
203 | [AS_HELP_STRING([--enable-pdns_server],[if we should build the server @<:@default=yes@:>@])], | |
204 | [enable_pdns_server=$enableval], | |
205 | [enable_pdns_server=yes] | |
206 | ) | |
207 | AC_MSG_RESULT([$enable_pdns_server]) | |
0ff5c0a3 | 208 | AM_CONDITIONAL([WITH_PDNS_SERVER],[test "x$enable_pdns_server" != "xno"]) |
92a4978f | 209 | |
39653d75 RK |
210 | AC_ARG_ENABLE([gcc-skip-locking], |
211 | [AS_HELP_STRING([--enable-gcc-skip-locking],[if we should forcefully skip gcc locking @<:@default=no@:>@])], | |
212 | [AC_DEFINE(GCC_SKIP_LOCKING,[],[Skip gcc locking])], | |
213 | ) | |
214 | ||
215 | AC_MSG_CHECKING([whether we will be building and installing the extra tools]) | |
216 | AC_ARG_ENABLE([tools], | |
217 | [AS_HELP_STRING([--enable-tools],[if we should build and install the tools @<:@default=no@:>@])], | |
218 | [enable_tools=$enableval], | |
219 | [enable_tools=no] | |
220 | ) | |
221 | ||
222 | AC_MSG_RESULT([$enable_tools]) | |
fd9b086f | 223 | AM_CONDITIONAL([TOOLS],[test "x$enable_tools" != "xno"]) |
39653d75 RK |
224 | |
225 | for a in $modules $dynmodules; do | |
226 | case "$a" in | |
227 | oracle|goracle) | |
228 | PDNS_WITH_ORACLE | |
229 | needoracle=yes | |
230 | ;; | |
6a85d81e MZ |
231 | lmdb) |
232 | PDNS_WITH_LMDB | |
cec11b41 | 233 | needlmdb=yes |
6a85d81e | 234 | ;; |
39653d75 RK |
235 | mydns|gmysql|pdns) |
236 | PDNS_WITH_MYSQL | |
237 | ;; | |
238 | gpgsql) | |
239 | PDNS_WITH_POSTGRESQL | |
240 | ;; | |
241 | gsqlite3) | |
242 | needsqlite3=yes | |
243 | ;; | |
244 | ldap) | |
245 | PDNS_CHECK_LDAP | |
b63843d9 | 246 | needldap=yes |
39653d75 RK |
247 | ;; |
248 | opendbx) | |
249 | PDNS_CHECK_OPENDBX | |
250 | ;; | |
251 | tinydns) | |
252 | PDNS_CHECK_CDB | |
253 | ;; | |
709ca59f AT |
254 | geoip) |
255 | PDNS_CHECK_GEOIP | |
256 | ;; | |
a20adc10 RK |
257 | lua) |
258 | AS_IF([test "x$with_lua" = "xno"], | |
259 | AC_MSG_ERROR([Lua backend needs lua, run ./configure --with-lua]) | |
260 | ) | |
261 | AS_IF([test "x$LUAPC" = "x"], | |
262 | AC_MSG_ERROR([Lua backend needs lua but we cannot find it]) | |
263 | ) | |
264 | ;; | |
39653d75 | 265 | esac |
92a4978f BH |
266 | done |
267 | ||
39653d75 RK |
268 | AM_CONDITIONAL([ORACLE],[test "x$needoracle" = "xyes"]) |
269 | ||
b63843d9 RK |
270 | AM_CONDITIONAL([LDAP],[test "x$needldap" = "xyes"]) |
271 | ||
cec11b41 KM |
272 | AM_CONDITIONAL([LMDB],[test "x$needlmdb" = "xyes"]) |
273 | ||
13305eb1 | 274 | PDNS_CHECK_SQLITE3 |
39653d75 | 275 | AM_CONDITIONAL([SQLITE3], [test "x$needsqlite3" = "xyes"]) |
64e3aade | 276 | |
39653d75 RK |
277 | for a in $modules; do |
278 | moduledirs="$moduledirs ${a}backend" | |
279 | ||
280 | for b in `cat $srcdir/modules/${a}backend/OBJECTFILES`; do | |
281 | moduleobjects="$moduleobjects ../modules/${a}backend/$b" | |
282 | done | |
283 | modulelibs="$modulelibs `cat $srcdir/modules/${a}backend/OBJECTLIBS`" | |
92a4978f BH |
284 | done |
285 | ||
39653d75 RK |
286 | for a in $dynmodules; do |
287 | moduledirs="$moduledirs ${a}backend" | |
92a4978f BH |
288 | done |
289 | ||
3cc618c5 | 290 | LDFLAGS="$RELRO_LDFLAGS $LDFLAGS" |
d6e5e940 | 291 | |
62e6530a RK |
292 | AS_IF([test "x$static" != "xyes"], [ |
293 | CFLAGS="$PIE_CFLAGS $CFLAGS" | |
294 | CXXFLAGS="$PIE_CFLAGS $CXXFLAGS" | |
295 | LDFLAGS="$PIE_LDFLAGS $LDFLAGS" | |
296 | ]) | |
297 | ||
366c610a RK |
298 | PDNS_ENABLE_COVERAGE |
299 | ||
92a4978f BH |
300 | AC_SUBST(LIBS) |
301 | ||
aa357125 RK |
302 | AC_SUBST([AM_CPPFLAGS], |
303 | ["AS_ESCAPE([-I$(top_builddir) -I$(top_srcdir)]) $THREADFLAGS $BOOST_CPPFLAGS"] | |
304 | ) | |
bf491b87 | 305 | |
1f974019 RK |
306 | AC_SUBST([YAHTTP_CFLAGS], ['-I$(top_srcdir)/pdns/ext/yahttp']) |
307 | AC_SUBST([YAHTTP_LIBS], ['-L$(top_builddir)/pdns/ext/yahttp/yahttp -lyahttp']) | |
308 | ||
d9a44db5 | 309 | export moduledirs moduleobjects modulelibs |
e9046dbc | 310 | |
39653d75 RK |
311 | AC_CONFIG_FILES([ |
312 | Makefile | |
313 | modules/Makefile | |
314 | pdns/Makefile | |
315 | codedocs/Makefile | |
21557318 | 316 | docs/Makefile |
cd42e98f | 317 | pdns/pdns.init |
c5077b4c | 318 | pdns/ext/Makefile |
fcc5d084 | 319 | pdns/ext/ed25519/Makefile |
f1d2eede CH |
320 | pdns/ext/yahttp/Makefile |
321 | pdns/ext/yahttp/yahttp/Makefile | |
f4b482a0 RK |
322 | pdns/ext/polarssl/Makefile |
323 | pdns/ext/polarssl/library/Makefile | |
d0371c7d | 324 | pdns/ext/rapidjson/Makefile |
39653d75 | 325 | modules/bindbackend/Makefile |
39653d75 | 326 | modules/geobackend/Makefile |
709ca59f | 327 | modules/geoipbackend/Makefile |
39653d75 RK |
328 | modules/gmysqlbackend/Makefile |
329 | modules/goraclebackend/Makefile | |
330 | modules/gpgsqlbackend/Makefile | |
331 | modules/gsqlite3backend/Makefile | |
332 | modules/ldapbackend/Makefile | |
333 | modules/luabackend/Makefile | |
334 | modules/mydnsbackend/Makefile | |
335 | modules/opendbxbackend/Makefile | |
336 | modules/oraclebackend/Makefile | |
337 | modules/pipebackend/Makefile | |
338 | modules/randombackend/Makefile | |
339 | modules/remotebackend/Makefile | |
340 | modules/tinydnsbackend/Makefile | |
6a85d81e | 341 | modules/lmdbbackend/Makefile |
39653d75 | 342 | ]) |
6867a5ad | 343 | AC_OUTPUT |
39653d75 | 344 | |
06d0f550 RK |
345 | AC_MSG_NOTICE([]) |
346 | AC_MSG_NOTICE([Configuration summary]) | |
347 | AC_MSG_NOTICE([=====================]) | |
348 | AC_MSG_NOTICE([]) | |
349 | AC_MSG_NOTICE([Modules: $modules]) | |
350 | AC_MSG_NOTICE([Dynamic Modules: $dynmodules]) | |
351 | AC_MSG_NOTICE([]) | |
352 | AC_MSG_NOTICE([CC: $CC]) | |
353 | AC_MSG_NOTICE([CXX: $CXX]) | |
354 | AC_MSG_NOTICE([LD: $LD]) | |
355 | AC_MSG_NOTICE([CFLAGS: $CFLAGS]) | |
356 | AC_MSG_NOTICE([CPPFLAGS: $CPPFLAGS]) | |
357 | AC_MSG_NOTICE([CXXFLAGS: $CXXFLAGS]) | |
358 | AC_MSG_NOTICE([LDFLAGS: $LDFLAGS]) | |
359 | AC_MSG_NOTICE([]) | |
19cedc4b | 360 | AC_MSG_NOTICE([BOOST_CPPFLAGS: $BOOST_CPPFLAGS]) |
19cedc4b | 361 | AC_MSG_NOTICE([]) |
06d0f550 RK |
362 | AC_MSG_NOTICE([SQLite3 support: $with_sqlite3]) |
363 | AC_MSG_NOTICE([Lua support: $with_lua]) | |
364 | AC_MSG_NOTICE([]) |