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="-Wall -g -O2 $CFLAGS"
22 CXXFLAGS="-Wall -g -O2 $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])
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 AC_CHECK_FUNCS_ONCE([strcasestr localtime_r recvmmsg getrandom arc4random])
135 AM_CONDITIONAL([HAVE_RECVMMSG], [test "x$ac_cv_func_recvmmsg" = "xyes"])
137 AS_IF([test "x$lt_cv_dlopen" = "xno"],
138 [AC_MSG_ERROR([Your system does not support dlopen])]
141 AC_SUBST([LIBDL], [$lt_cv_dlopen_libs])
143 PDNS_ENABLE_VERBOSE_LOGGING
147 AC_SUBST([socketdir])
149 AC_ARG_WITH([socketdir],
150 [AS_HELP_STRING([--with-socketdir], [where the controlsocket lives @<:@default=/var/run@:>@])],
151 [socketdir="$withval"]
154 modules="bind gmysql random"
155 AC_ARG_WITH([modules],
156 [AS_HELP_STRING([--with-modules], [which backends to compile with @<:@default=bind gmysql random@:>@])],
161 AC_ARG_WITH([dynmodules],
162 [AS_HELP_STRING([--with-dynmodules], [which backends to build for dynamic loading @<:@default=pipe@:>@])],
163 [dynmodules="$withval"]
166 AC_SUBST([moduledirs])
167 AC_SUBST([moduleobjects])
168 AC_SUBST([modulelibs])
169 AC_DEFINE_UNQUOTED([PDNS_MODULES], "$modules", [Built-in modules])
171 AS_IF([test x"$modules" = "xno"], [modules=""])
172 AS_IF([test x"$dynmodules" = "xno"], [dynmodules=""])
174 for a in $modules $dynmodules; do
200 AS_IF([test "x$enable_unit_tests" = "xyes"],
201 [PDNS_CHECK_CURL_PROGRAM]
203 have_remotebackend=yes
212 AS_IF([test "x$with_lua" = "xno"],
213 [AC_MSG_ERROR([${a} backend needs lua, run ./configure --with-lua])]
215 AS_IF([test "x$LUAPC" = "x"],
216 [AC_MSG_ERROR([${a} backend needs lua but we cannot find it])]
226 PDNS_ENABLE_REMOTEBACKEND_ZEROMQ
228 AC_MSG_CHECKING([whether we will be building and installing the extra tools])
229 AC_ARG_ENABLE([tools],
230 [AS_HELP_STRING([--enable-tools], [if we should build and install the tools @<:@default=no@:>@])],
231 [enable_tools=$enableval],
235 AC_MSG_RESULT([$enable_tools])
236 AM_CONDITIONAL([TOOLS], [test "x$enable_tools" != "xno"])
241 PDNS_WITH_LUA_RECORDS
243 AM_CONDITIONAL([ORACLE], [test "x$needoracle" = "xyes"])
245 AM_CONDITIONAL([LDAP], [test "x$needldap" = "xyes"])
248 AM_CONDITIONAL([SQLITE3], [test "x$needsqlite3" = "xyes"])
250 for a in $modules; do
251 AC_MSG_CHECKING([whether we can build module "${a}"])
252 if [[ -d "$srcdir/modules/${a}backend" ]]; then
254 moduledirs="$moduledirs ${a}backend"
256 for b in `cat $srcdir/modules/${a}backend/OBJECTFILES`; do
257 moduleobjects="$moduleobjects ../modules/${a}backend/$b"
259 modulelibs="$modulelibs `cat $srcdir/modules/${a}backend/OBJECTLIBS`"
262 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.])
266 for a in $dynmodules; do
267 AC_MSG_CHECKING([whether we can build dynamic module "${a}"])
268 if [[ -d "$srcdir/modules/${a}backend" ]]; then
270 moduledirs="$moduledirs ${a}backend"
273 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.])
278 AX_CHECK_SYSTEMD_FEATURES
279 AM_CONDITIONAL([HAVE_SYSTEMD], [ test x"$systemd" = "xy" ])
281 LDFLAGS="$RELRO_LDFLAGS $LDFLAGS"
283 CFLAGS="$PIE_CFLAGS $CFLAGS"
284 CXXFLAGS="$PIE_CFLAGS $CXXFLAGS"
285 PROGRAM_LDFLAGS="$PIE_LDFLAGS $PROGRAM_LDFLAGS"
286 AC_SUBST([PROGRAM_LDFLAGS])
289 PDNS_ENABLE_SANITIZERS
290 PDNS_ENABLE_MALLOC_TRACE
294 AC_SUBST([AM_CPPFLAGS],
295 ["AS_ESCAPE([-I$(top_builddir) -I$(top_srcdir)]) $THREADFLAGS $BOOST_CPPFLAGS"]
298 AC_SUBST([YAHTTP_CFLAGS], ['-I$(top_srcdir)/ext/yahttp'])
299 AC_SUBST([YAHTTP_LIBS], ['$(top_builddir)/ext/yahttp/yahttp/libyahttp.la'])
300 AC_SUBST([IPCRYPT_CFLAGS], ['-I$(top_srcdir)/ext/ipcrypt'])
301 AC_SUBST([IPCRYPT_LIBS], ['$(top_builddir)/ext/ipcrypt/libipcrypt.la'])
303 CXXFLAGS="$SANITIZER_FLAGS $CXXFLAGS"
305 AC_ARG_VAR(PACKAGEVERSION, [The version used in secpoll queries])
306 AS_IF([test "x$PACKAGEVERSION" != "x"],
307 [AC_DEFINE_UNQUOTED([PACKAGEVERSION], "$PACKAGEVERSION", [Set to the package version used for secpoll])]
310 export moduledirs moduleobjects modulelibs
322 ext/yahttp/yahttp/Makefile
324 modules/bindbackend/Makefile
325 modules/geoipbackend/Makefile
326 modules/gmysqlbackend/Makefile
327 modules/godbcbackend/Makefile
328 modules/goraclebackend/Makefile
329 modules/gpgsqlbackend/Makefile
330 modules/gsqlite3backend/Makefile
331 modules/ldapbackend/Makefile
332 modules/lmdbbackend/Makefile
333 modules/luabackend/Makefile
334 modules/lua2backend/Makefile
335 modules/mydnsbackend/Makefile
336 modules/opendbxbackend/Makefile
337 modules/oraclebackend/Makefile
338 modules/pipebackend/Makefile
339 modules/randombackend/Makefile
340 modules/remotebackend/Makefile
341 modules/tinydnsbackend/Makefile
346 AC_MSG_NOTICE([Configuration summary])
347 AC_MSG_NOTICE([=====================])
349 AC_MSG_NOTICE([Configured with: $pdns_configure_args])
351 AC_MSG_NOTICE([CC: $CC])
352 AC_MSG_NOTICE([CXX: $CXX])
353 AC_MSG_NOTICE([LD: $LD])
354 AC_MSG_NOTICE([CFLAGS: $CFLAGS])
355 AC_MSG_NOTICE([CPPFLAGS: $CPPFLAGS])
356 AC_MSG_NOTICE([CXXFLAGS: $CXXFLAGS])
357 AC_MSG_NOTICE([LDFLAGS: $LDFLAGS])
358 AC_MSG_NOTICE([LIBS: $LIBS])
359 AC_MSG_NOTICE([BOOST_CPPFLAGS: $BOOST_CPPFLAGS])
361 AC_MSG_NOTICE([Features enabled])
362 AC_MSG_NOTICE([----------------])
363 AC_MSG_NOTICE([Built-in modules: $modules])
364 AC_MSG_NOTICE([Dynamic modules: $dynmodules])
366 AS_IF([test "x$libcrypto_ecdsa" = "xyes"],
367 [AC_MSG_NOTICE([OpenSSL ecdsa: yes])],
368 [AC_MSG_NOTICE([OpenSSL ecdsa: no])]
370 AS_IF([test "x$LIBSODIUM_LIBS" != "x" || test "x$LIBDECAF_LIBS" != "x" || test "x$libcrypto_ed25519" = "xyes"],
371 [AC_MSG_NOTICE([ed25519: yes])],
372 [AC_MSG_NOTICE([ed25519: no])]
374 AS_IF([test "x$LIBDECAF_LIBS" != "x" || test "x$libcrypto_ed448" = "xyes"],
375 [AC_MSG_NOTICE([ed448: yes])],
376 [AC_MSG_NOTICE([ed448: no])]
378 AS_IF([test "x$needsqlite3" != "x"],
379 [AC_MSG_NOTICE([SQLite3: yes])],
380 [AC_MSG_NOTICE([SQLite3: no])]
382 AS_IF([test "x$LUAPC" != "x"],
383 [AC_MSG_NOTICE([Lua: $LUAPC])],
384 [AS_IF([test "x$LUAJITPC" != "x"],
385 [AC_MSG_NOTICE([LuaJit: $LUAJITPC])],
386 [AC_MSG_NOTICE([Lua/LuaJit: no])])
388 AS_IF([test "x$enable_experimental_pkcs11" = "xyes"],
389 [AC_MSG_NOTICE([PKCS-11: yes])]
391 AS_IF([test "x$enable_experimental_gss_tsig" = "xyes"],
392 [AC_MSG_NOTICE([GSS-TSIG: yes])]
394 AS_IF([test "x$systemd" != "xn"],
395 [AC_MSG_NOTICE([systemd: yes])],
396 [AC_MSG_NOTICE([systemd: no])]
398 AS_IF([test "x$enable_remotebackend_zeromq" != "xno"],
399 [AC_MSG_NOTICE([ZeroMQ connector for remotebackend: yes])]