3 AC_INIT([pdns], m4_esyscmd([builder-support/gen-version]))
5 AC_CONFIG_SRCDIR([pdns/receiver.cc])
6 AC_CONFIG_MACRO_DIR([m4])
7 AC_CONFIG_HEADERS([config.h])
8 AC_CONFIG_AUX_DIR([build-aux])
10 AC_SUBST([pdns_configure_args], ["$ac_configure_args"])
11 AC_DEFINE_UNQUOTED([PDNS_CONFIG_ARGS],
12 ["$pdns_configure_args"],
13 [pdns configure arguments]
16 AM_INIT_AUTOMAKE([foreign dist-bzip2 no-dist-gzip tar-ustar -Wno-portability subdir-objects parallel-tests 1.11])
17 AM_SILENT_RULES([yes])
20 # Add some default CFLAGS and CXXFLAGS, can be appended to using the environment variables
21 CFLAGS="-g -O2 -Wall -Wextra -Wshadow -Wno-unused-parameter -Wmissing-declarations -Wredundant-decls $CFLAGS"
22 CXXFLAGS="-g -O2 -Wall -Wextra -Wshadow -Wno-unused-parameter -Wmissing-declarations -Wredundant-decls $CXXFLAGS"
32 AS_IF([test "x$CXX" = "xno" || test "x$CXX:x$GXX" = "xg++:x"],
33 [AC_MSG_ERROR([no C++ compiler found])]
38 AC_DEFINE([_GNU_SOURCE], [1],
39 [Define _GNU_SOURCE so that we get all necessary prototypes]
42 # Warn when pkg.m4 is missing
43 m4_pattern_forbid([^_?PKG_[A-Z_]+$], [*** pkg.m4 missing, please install pkg-config])
48 PDNS_WITH_LUA([mandatory])
51 AX_CXX_COMPILE_STDCXX_11
53 AC_MSG_CHECKING([whether we will enable compiler security checks])
54 AC_ARG_ENABLE([hardening],
55 [AS_HELP_STRING([--disable-hardening], [disable compiler security checks @<:@default=no@:>@])],
56 [enable_hardening=$enableval],
57 [enable_hardening=yes]
59 AC_MSG_RESULT([$enable_hardening])
61 AS_IF([test "x$enable_hardening" != "xno"], [
64 AC_CC_PARAM_SSP_BUFFER_SIZE([4])
65 AC_CC_D_FORTIFY_SOURCE
71 PDNS_CHECK_NETWORK_LIBS
74 LT_INIT([disable-static dlopen])
79 # Define full_libdir to be the fully expanded (${exec_prefix}, etc.)
80 # "system" library path.
81 # We use this to search for other libraries.
82 eval full_libdir="\"$libdir\""
84 # detect pkg-config explicitly
91 [AC_DEFINE(HAVE_MMAP, [1], [Define to 1 if you have mmap])],
99 PDNS_CHECK_LIBCRYPTO([
101 AC_MSG_ERROR([OpenSSL/libcrypto not found])
104 PDNS_CHECK_LIBCRYPTO_ECDSA
105 PDNS_CHECK_LIBCRYPTO_EDDSA
107 PDNS_CHECK_RAGEL([pdns/dnslabeltext.cc], [www.powerdns.com])
108 PDNS_CHECK_CLOCK_GETTIME
110 BOOST_REQUIRE([1.42])
111 # Boost accumulators, as used by dnsbulktest and dnstcpbench, need 1.48+
112 # to be compatible with C++11
113 AM_CONDITIONAL([HAVE_BOOST_GE_148], [test "$boost_major_version" -ge 148])
114 AS_IF([test "$boost_major_version" -ge 148], [
115 AC_DEFINE(HAVE_BOOST_GE_148, [1], [Define to 1 if you have boost >= 1.48])
118 BOOST_PROGRAM_OPTIONS([mt])
119 AS_IF([test "$boost_cv_lib_program_options" = "no"], [
120 AC_MSG_ERROR([Boost Program Options library not found])
122 PDNS_ENABLE_UNIT_TESTS
123 PDNS_ENABLE_BACKEND_UNIT_TESTS
124 PDNS_ENABLE_REPRODUCIBLE
125 PDNS_ENABLE_FUZZ_TARGETS
129 PDNS_CHECK_VIRTUALENV
132 dnl Checks for library functions.
133 dnl the *_r functions are in posix so we can use them unconditionally, but the ext/yahttp code is
134 dnl using the defines.
135 AC_CHECK_FUNCS_ONCE([strcasestr localtime_r gmtime_r recvmmsg sched_setscheduler getrandom arc4random])
137 AM_CONDITIONAL([HAVE_RECVMMSG], [test "x$ac_cv_func_recvmmsg" = "xyes"])
139 AS_IF([test "x$lt_cv_dlopen" = "xno"],
140 [AC_MSG_ERROR([Your system does not support dlopen])]
143 AC_SUBST([LIBDL], [$lt_cv_dlopen_libs])
145 PDNS_ENABLE_VERBOSE_LOGGING
149 AC_SUBST([socketdir])
151 AC_ARG_WITH([socketdir],
152 [AS_HELP_STRING([--with-socketdir], [where the controlsocket lives @<:@default=/var/run@:>@])],
153 [socketdir="$withval"]
156 modules="bind gmysql random"
157 AC_ARG_WITH([modules],
158 [AS_HELP_STRING([--with-modules], [which backends to compile with @<:@default=bind gmysql random@:>@])],
163 AC_ARG_WITH([dynmodules],
164 [AS_HELP_STRING([--with-dynmodules], [which backends to build for dynamic loading @<:@default=pipe@:>@])],
165 [dynmodules="$withval"]
168 AC_SUBST([moduledirs])
169 AC_SUBST([moduleobjects])
170 AC_SUBST([modulelibs])
171 AC_DEFINE_UNQUOTED([PDNS_MODULES], "$modules", [Built-in modules])
173 AS_IF([test x"$modules" = "xno"], [modules=""])
174 AS_IF([test x"$dynmodules" = "xno"], [dynmodules=""])
176 for a in $modules $dynmodules; do
195 AS_IF([test "x$enable_unit_tests" = "xyes"],
196 [PDNS_CHECK_CURL_PROGRAM]
198 have_remotebackend=yes
208 dnl Lua has been checked above
218 PDNS_ENABLE_REMOTEBACKEND_ZEROMQ
225 PDNS_WITH_LUA_RECORDS
227 AM_CONDITIONAL([LDAP], [test "x$needldap" = "xyes"])
230 AM_CONDITIONAL([SQLITE3], [test "x$needsqlite3" = "xyes"])
232 AM_CONDITIONAL([LMDB], [test "x$needlmdb" != "x"])
233 AM_CONDITIONAL([HAVE_LMDB], [test "x$LMDB_LIBS" != "x"])
235 AS_IF([test "x$needlmdb" = "xyes"], [
236 AS_IF([test "$with_lmdb" = "no"], [
237 AC_MSG_ERROR([--with-lmdb is set to 'no', but lmdb support is required])
239 AS_IF([test "x$HAVE_LMDB" != "x1"], [
240 AC_MSG_ERROR([lmdb not found via pkg-config, please install lmdb or set --with-lmdb to your lmdb installation directory])
244 AM_CONDITIONAL([CDB], [test "x$needcdb" != "x"])
245 AM_CONDITIONAL([HAVE_CDB], [test "x$CDB_LIBS" != "x"])
247 AS_IF([test "x$needcdb" = "xyes"], [
248 AS_IF([test "x$HAVE_CDB" != "x1"], [
249 AC_MSG_ERROR([cdb not found via pkg-config, please install cdb])
253 for a in $modules; do
254 AC_MSG_CHECKING([whether we can build module "${a}"])
255 if [[ -d "$srcdir/modules/${a}backend" ]]; then
257 moduledirs="$moduledirs ${a}backend"
259 for b in `cat $srcdir/modules/${a}backend/OBJECTFILES`; do
260 moduleobjects="$moduleobjects ../modules/${a}backend/$b"
262 modulelibs="$modulelibs `cat $srcdir/modules/${a}backend/OBJECTLIBS`"
265 AC_MSG_ERROR([Do not know how to build module "$a", "$srcdir/modules/${a}backend" does not exist! Please review --with-modules parameter for supported values.])
269 for a in $dynmodules; do
270 AC_MSG_CHECKING([whether we can build dynamic module "${a}"])
271 if [[ -d "$srcdir/modules/${a}backend" ]]; then
273 moduledirs="$moduledirs ${a}backend"
276 AC_MSG_ERROR([Do not know how to build module "$a", "$srcdir/modules/${a}backend" does not exist! Please review --with-dynmodules parameter for supported values.])
281 AX_CHECK_SYSTEMD_FEATURES
282 AM_CONDITIONAL([HAVE_SYSTEMD], [ test x"$systemd" = "xy" ])
283 PDNS_WITH_SERVICE_USER([pdns])
285 LDFLAGS="$RELRO_LDFLAGS $LDFLAGS"
287 CFLAGS="$PIE_CFLAGS $CFLAGS"
288 CXXFLAGS="$PIE_CFLAGS $CXXFLAGS"
289 PROGRAM_LDFLAGS="$PIE_LDFLAGS $PROGRAM_LDFLAGS"
290 AC_SUBST([PROGRAM_LDFLAGS])
293 PDNS_ENABLE_SANITIZERS
294 PDNS_ENABLE_MALLOC_TRACE
298 AC_SUBST([AM_CPPFLAGS],
299 ["AS_ESCAPE([-I$(top_builddir) -I$(top_srcdir)]) $THREADFLAGS $BOOST_CPPFLAGS"]
302 AC_SUBST([YAHTTP_CFLAGS], ['-I$(top_srcdir)/ext/yahttp'])
303 AC_SUBST([YAHTTP_LIBS], ['$(top_builddir)/ext/yahttp/yahttp/libyahttp.la'])
304 AC_SUBST([IPCRYPT_CFLAGS], ['-I$(top_srcdir)/ext/ipcrypt'])
305 AC_SUBST([IPCRYPT_LIBS], ['$(top_builddir)/ext/ipcrypt/libipcrypt.la'])
307 CXXFLAGS="$SANITIZER_FLAGS $CXXFLAGS"
309 AC_ARG_VAR(PACKAGEVERSION, [The version used in secpoll queries])
310 AS_IF([test "x$PACKAGEVERSION" != "x"],
311 [AC_DEFINE_UNQUOTED([PACKAGEVERSION], "$PACKAGEVERSION", [Set to the package version used for secpoll])]
314 export moduledirs moduleobjects modulelibs
326 ext/yahttp/yahttp/Makefile
328 modules/bindbackend/Makefile
329 modules/geoipbackend/Makefile
330 modules/gmysqlbackend/Makefile
331 modules/godbcbackend/Makefile
332 modules/gpgsqlbackend/Makefile
333 modules/gsqlite3backend/Makefile
334 modules/ldapbackend/Makefile
335 modules/lmdbbackend/Makefile
336 modules/lua2backend/Makefile
337 modules/pipebackend/Makefile
338 modules/randombackend/Makefile
339 modules/remotebackend/Makefile
340 modules/tinydnsbackend/Makefile
345 AC_MSG_NOTICE([Configuration summary])
346 AC_MSG_NOTICE([=====================])
348 AC_MSG_NOTICE([Configured with: $pdns_configure_args])
350 AC_MSG_NOTICE([CC: $CC])
351 AC_MSG_NOTICE([CXX: $CXX])
352 AC_MSG_NOTICE([LD: $LD])
353 AC_MSG_NOTICE([CFLAGS: $CFLAGS])
354 AC_MSG_NOTICE([CPPFLAGS: $CPPFLAGS])
355 AC_MSG_NOTICE([CXXFLAGS: $CXXFLAGS])
356 AC_MSG_NOTICE([LDFLAGS: $LDFLAGS])
357 AC_MSG_NOTICE([LIBS: $LIBS])
358 AC_MSG_NOTICE([BOOST_CPPFLAGS: $BOOST_CPPFLAGS])
360 AC_MSG_NOTICE([Extras enabled])
361 AC_MSG_NOTICE([--------------])
362 AS_IF([test "x$enable_tools" = "xyes"],
363 [AC_MSG_NOTICE([Tools: yes])],
364 [AC_MSG_NOTICE([Tools: no])]
366 AS_IF([test "x$enable_ixfrdist" = "xyes"],
367 [AC_MSG_NOTICE([ixfrdist: yes])],
368 [AC_MSG_NOTICE([ixfrdist: no])]
371 AC_MSG_NOTICE([Server Features enabled])
372 AC_MSG_NOTICE([-----------------------])
373 AC_MSG_NOTICE([Built-in modules: $modules])
374 AC_MSG_NOTICE([Dynamic modules: $dynmodules])
376 AS_IF([test "x$libcrypto_ecdsa" = "xyes"],
377 [AC_MSG_NOTICE([OpenSSL ecdsa: yes])],
378 [AC_MSG_NOTICE([OpenSSL ecdsa: no])]
380 AS_IF([test "x$LIBSODIUM_LIBS" != "x" || test "x$LIBDECAF_LIBS" != "x" || test "x$libcrypto_ed25519" = "xyes"],
381 [AC_MSG_NOTICE([ed25519: yes])],
382 [AC_MSG_NOTICE([ed25519: no])]
384 AS_IF([test "x$LIBDECAF_LIBS" != "x" || test "x$libcrypto_ed448" = "xyes"],
385 [AC_MSG_NOTICE([ed448: yes])],
386 [AC_MSG_NOTICE([ed448: no])]
388 AS_IF([test "x$needsqlite3" != "x"],
389 [AC_MSG_NOTICE([SQLite3: yes])],
390 [AC_MSG_NOTICE([SQLite3: no])]
392 AS_IF([test "x$LUAPC" != "x"],
393 [AC_MSG_NOTICE([Lua: $LUAPC])],
394 [AS_IF([test "x$LUAJITPC" != "x"],
395 [AC_MSG_NOTICE([LuaJit: $LUAJITPC])],
396 [AC_MSG_NOTICE([Lua/LuaJit: no])])
398 AS_IF([test "x$enable_experimental_pkcs11" = "xyes"],
399 [AC_MSG_NOTICE([PKCS-11: yes])]
401 AS_IF([test "x$enable_experimental_gss_tsig" = "xyes"],
402 [AC_MSG_NOTICE([GSS-TSIG: yes])]
404 AS_IF([test "x$enable_lua_records" = "xyes"],
405 [AC_MSG_NOTICE([LUA records: yes])]
407 AS_IF([test "x$systemd" != "xn"],
408 [AC_MSG_NOTICE([systemd: yes])],
409 [AC_MSG_NOTICE([systemd: no])]
411 AS_IF([test "x$enable_remotebackend_zeromq" != "xno"],
412 [AC_MSG_NOTICE([ZeroMQ connector for remotebackend: yes])]
414 AS_IF([test -n "$GEOIP_LIBS"],
415 [AC_MSG_NOTICE([libgeoip for geoipbackend: yes])]
417 AS_IF([test -n "$MMDB_LIBS"],
418 [AC_MSG_NOTICE([libmaxminddb for geoipbackend: yes])]