3 AC_INIT([pdns], m4_esyscmd([builder-support/gen-version]))
4 AC_CONFIG_AUX_DIR([build-aux])
5 AM_INIT_AUTOMAKE([foreign dist-bzip2 no-dist-gzip tar-ustar -Wno-portability subdir-objects parallel-tests 1.11])
7 AC_CONFIG_SRCDIR([pdns/auth-main.cc])
8 AC_CONFIG_MACRO_DIR([m4])
10 AC_USE_SYSTEM_EXTENSIONS
11 AC_CONFIG_HEADERS([config.h])
14 # Add some default CFLAGS and CXXFLAGS, can be appended to using the environment variables
15 CFLAGS="-g -O2 -Wall -Wextra -Wshadow -Wmissing-declarations -Wredundant-decls $CFLAGS"
16 CXXFLAGS="-g -O2 -Wall -Wextra -Wshadow -Wmissing-declarations -Wredundant-decls $CXXFLAGS"
18 AC_SUBST([pdns_configure_args], ["$ac_configure_args"])
19 AC_DEFINE_UNQUOTED([PDNS_CONFIG_ARGS],
20 ["$pdns_configure_args"],
21 [pdns configure arguments]
33 # Warn when pkg.m4 is missing
34 m4_pattern_forbid([^_?PKG_[A-Z_]+$], [*** pkg.m4 missing, please install pkg-config])
36 AX_CXX_COMPILE_STDCXX_17([noext], [mandatory])
38 LT_INIT([disable-static dlopen])
45 PDNS_WITH_LUA([mandatory])
48 AC_MSG_CHECKING([whether we will enable compiler security checks])
49 AC_ARG_ENABLE([hardening],
50 [AS_HELP_STRING([--disable-hardening], [disable compiler security checks @<:@default=no@:>@])],
51 [enable_hardening=$enableval],
52 [enable_hardening=yes]
54 AC_MSG_RESULT([$enable_hardening])
56 AS_IF([test "x$enable_hardening" != "xno"], [
59 AC_CC_PARAM_SSP_BUFFER_SIZE([4])
60 AC_CC_D_FORTIFY_SOURCE
66 PDNS_CHECK_NETWORK_LIBS
71 # Define full_libdir to be the fully expanded (${exec_prefix}, etc.)
72 # "system" library path.
73 # We use this to search for other libraries.
74 eval full_libdir="\"$libdir\""
76 # detect pkg-config explicitly
83 [AC_DEFINE(HAVE_MMAP, [1], [Define to 1 if you have mmap])],
88 AC_CHECK_HEADERS([sys/random.h])
92 PDNS_CHECK_LIBCRYPTO([
94 AC_MSG_ERROR([OpenSSL/libcrypto not found])
97 PDNS_CHECK_LIBCRYPTO_ECDSA
98 PDNS_CHECK_LIBCRYPTO_EDDSA
100 AM_CONDITIONAL([HAVE_GNUTLS], [false])
101 AM_CONDITIONAL([HAVE_LIBSSL], [false])
103 PDNS_ENABLE_DNS_OVER_TLS
104 AS_IF([test "x$enable_dns_over_tls" != "xno"], [
107 AS_IF([test "x$HAVE_GNUTLS" != "x1" -a "x$HAVE_LIBSSL" != "x1"], [
108 AC_MSG_ERROR([DNS over TLS support requested but neither GnuTLS nor OpenSSL are available])
114 PDNS_CHECK_RAGEL([pdns/dnslabeltext.cc], [www.powerdns.com])
115 PDNS_CHECK_CLOCK_GETTIME
117 BOOST_REQUIRE([1.42])
118 # Boost accumulators, as used by dnsbulktest and dnstcpbench, need 1.48+
119 # to be compatible with C++11
120 AM_CONDITIONAL([HAVE_BOOST_GE_148], [test "$boost_major_version" -ge 148])
121 AS_IF([test "$boost_major_version" -ge 148], [
122 AC_DEFINE(HAVE_BOOST_GE_148, [1], [Define to 1 if you have boost >= 1.48])
125 BOOST_PROGRAM_OPTIONS([mt])
126 AS_IF([test "$boost_cv_lib_program_options" = "no"], [
127 AC_MSG_ERROR([Boost Program Options library not found])
129 PDNS_ENABLE_UNIT_TESTS
130 PDNS_ENABLE_BACKEND_UNIT_TESTS
131 PDNS_ENABLE_REPRODUCIBLE
132 PDNS_ENABLE_FUZZ_TARGETS
137 PDNS_CHECK_PYTHON_VENV
139 AM_CONDITIONAL([HAVE_API_SWAGGER_JSON], [test -e "$srcdir/pdns/api-swagger.json"])
140 AM_COND_IF([HAVE_API_SWAGGER_JSON],[],[
141 AM_COND_IF([HAVE_VENV],[],[
142 AC_MSG_ERROR([Python 3 and/or venv module are not available, Authoritative Server cannot be built.])
146 AM_CONDITIONAL([HAVE_MANPAGES], [test -e "$srcdir/docs/pdns_server.1"])
147 AM_COND_IF([HAVE_MANPAGES],[],[
148 AM_COND_IF([HAVE_VENV],[],[
149 AC_MSG_WARN([Python 3 and/or venv module are not available, documentation will not be built.])
155 dnl Checks for library functions.
156 dnl the *_r functions are in posix so we can use them unconditionally, but the ext/yahttp code is
157 dnl using the defines.
158 AC_CHECK_FUNCS_ONCE([strcasestr localtime_r gmtime_r recvmmsg sched_setscheduler])
159 AC_CHECK_FUNCS_ONCE([getrandom getentropy arc4random arc4random_uniform arc4random_buf])
160 PDNS_CHECK_SECURE_MEMSET
162 AM_CONDITIONAL([HAVE_RECVMMSG], [test "x$ac_cv_func_recvmmsg" = "xyes"])
164 AS_IF([test "x$lt_cv_dlopen" = "xno"],
165 [AC_MSG_ERROR([Your system does not support dlopen])]
168 AC_SUBST([LIBDL], [$lt_cv_dlopen_libs])
170 PDNS_ENABLE_VERBOSE_LOGGING
174 AC_SUBST([socketdir])
176 AC_ARG_WITH([socketdir],
177 [AS_HELP_STRING([--with-socketdir], [where the controlsocket lives @<:@default=/var/run@:>@])],
178 [socketdir="$withval"]
181 modules="bind gmysql"
182 AC_ARG_WITH([modules],
183 [AS_HELP_STRING([--with-modules], [which backends to compile with @<:@default=bind gmysql@:>@])],
188 AC_ARG_WITH([dynmodules],
189 [AS_HELP_STRING([--with-dynmodules], [which backends to build for dynamic loading @<:@default=pipe@:>@])],
190 [dynmodules="$withval"]
193 AC_SUBST([moduledirs])
194 AC_SUBST([moduleobjects])
195 AC_SUBST([modulelibs])
196 AC_DEFINE_UNQUOTED([PDNS_MODULES], "$modules", [Built-in modules])
198 AS_IF([test x"$modules" = "xno"], [modules=""])
199 AS_IF([test x"$dynmodules" = "xno"], [dynmodules=""])
201 for a in $modules $dynmodules; do
220 AS_IF([test "x$enable_unit_tests" = "xyes"],
221 [PDNS_CHECK_CURL_PROGRAM]
223 have_remotebackend=yes
233 dnl Lua has been checked above
243 PDNS_ENABLE_REMOTEBACKEND_ZEROMQ
248 PDNS_WITH_LUA_RECORDS
250 AM_CONDITIONAL([LDAP], [test "x$needldap" = "xyes"])
253 AM_CONDITIONAL([SQLITE3], [test "x$needsqlite3" = "xyes"])
255 AM_CONDITIONAL([LMDB], [test "x$needlmdb" != "x"])
256 AM_CONDITIONAL([HAVE_LMDB], [test "x$LMDB_LIBS" != "x"])
258 AS_IF([test "x$needlmdb" = "xyes"], [
259 AS_IF([test "$with_lmdb" = "no"], [
260 AC_MSG_ERROR([--with-lmdb is set to 'no', but lmdb support is required])
262 AS_IF([test "x$HAVE_LMDB" != "x1"], [
263 AC_MSG_ERROR([lmdb not found via pkg-config, please install lmdb or set --with-lmdb to your lmdb installation directory])
267 AM_CONDITIONAL([CDB], [test "x$needcdb" != "x"])
268 AM_CONDITIONAL([HAVE_CDB], [test "x$CDB_LIBS" != "x"])
270 AS_IF([test "x$needcdb" = "xyes"], [
271 AS_IF([test "x$HAVE_CDB" != "x1"], [
272 AC_MSG_ERROR([cdb not found via pkg-config, please install cdb])
276 for a in $modules; do
277 AC_MSG_CHECKING([whether we can build module "${a}"])
278 if [[ -d "$srcdir/modules/${a}backend" ]]; then
280 moduledirs="$moduledirs ${a}backend"
282 for b in `cat $srcdir/modules/${a}backend/OBJECTFILES`; do
283 moduleobjects="$moduleobjects ../modules/${a}backend/$b"
285 modulelibs="$modulelibs `cat $srcdir/modules/${a}backend/OBJECTLIBS`"
288 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.])
292 for a in $dynmodules; do
293 AC_MSG_CHECKING([whether we can build dynamic module "${a}"])
294 if [[ -d "$srcdir/modules/${a}backend" ]]; then
296 moduledirs="$moduledirs ${a}backend"
299 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.])
304 AX_CHECK_SYSTEMD_FEATURES
305 AM_CONDITIONAL([HAVE_SYSTEMD], [ test x"$systemd" = "xy" ])
306 PDNS_WITH_SERVICE_USER([pdns])
308 LDFLAGS="$RELRO_LDFLAGS $LDFLAGS"
310 CFLAGS="$PIE_CFLAGS $CFLAGS"
311 CXXFLAGS="$PIE_CFLAGS $CXXFLAGS"
312 PROGRAM_LDFLAGS="$PIE_LDFLAGS $PROGRAM_LDFLAGS"
313 AS_IF([test "$ax_cxx_cv_filesystem_lib" != "none"],
314 [PROGRAM_LDFLAGS="$PROGRAM_LDFLAGS -l$ax_cxx_cv_filesystem_lib"],
317 AC_SUBST([PROGRAM_LDFLAGS])
321 PDNS_ENABLE_SANITIZERS
322 PDNS_ENABLE_MALLOC_TRACE
327 AC_SUBST([AM_CPPFLAGS],
328 ["AS_ESCAPE([-I$(top_builddir) -I$(top_srcdir)]) $THREADFLAGS $BOOST_CPPFLAGS"]
331 AC_SUBST([YAHTTP_CFLAGS], ['-I$(top_srcdir)/ext/yahttp'])
332 AC_SUBST([YAHTTP_LIBS], ['$(top_builddir)/ext/yahttp/yahttp/libyahttp.la'])
333 AC_SUBST([IPCRYPT_CFLAGS], ['-I$(top_srcdir)/ext/ipcrypt'])
334 AC_SUBST([IPCRYPT_LIBS], ['$(top_builddir)/ext/ipcrypt/libipcrypt.la'])
336 CFLAGS="$SANITIZER_FLAGS $CFLAGS"
337 CXXFLAGS="$SANITIZER_FLAGS $CXXFLAGS"
339 CCVERSION=`$CC --version | head -1`
340 CXXVERSION=`$CXX --version | head -1`
342 AC_ARG_VAR(PACKAGEVERSION, [The version used in secpoll queries])
343 AS_IF([test "x$PACKAGEVERSION" != "x"],
344 [AC_DEFINE_UNQUOTED([PACKAGEVERSION], "$PACKAGEVERSION", [Set to the package version used for secpoll])]
347 export moduledirs moduleobjects modulelibs
356 ext/arc4random/Makefile
359 ext/yahttp/yahttp/Makefile
361 modules/bindbackend/Makefile
362 modules/geoipbackend/Makefile
363 modules/gmysqlbackend/Makefile
364 modules/godbcbackend/Makefile
365 modules/gpgsqlbackend/Makefile
366 modules/gsqlite3backend/Makefile
367 modules/ldapbackend/Makefile
368 modules/lmdbbackend/Makefile
369 modules/lua2backend/Makefile
370 modules/pipebackend/Makefile
371 modules/remotebackend/Makefile
372 modules/tinydnsbackend/Makefile
377 AC_MSG_NOTICE([Configuration summary])
378 AC_MSG_NOTICE([=====================])
380 AC_MSG_NOTICE([Configured with: $pdns_configure_args])
382 AC_MSG_NOTICE([CC: $CC ($CCVERSION)])
383 AC_MSG_NOTICE([CXX: $CXX ($CXXVERSION)])
384 AC_MSG_NOTICE([LD: $LD])
385 AC_MSG_NOTICE([CFLAGS: $CFLAGS])
386 AC_MSG_NOTICE([CPPFLAGS: $CPPFLAGS])
387 AC_MSG_NOTICE([CXXFLAGS: $CXXFLAGS])
388 AC_MSG_NOTICE([LDFLAGS: $LDFLAGS])
389 AC_MSG_NOTICE([LIBS: $LIBS])
390 AC_MSG_NOTICE([BOOST_CPPFLAGS: $BOOST_CPPFLAGS])
392 AC_MSG_NOTICE([Extras enabled])
393 AC_MSG_NOTICE([--------------])
394 AS_IF([test "x$enable_tools" = "xyes"],
395 [AC_MSG_NOTICE([Tools: yes])],
396 [AC_MSG_NOTICE([Tools: no])]
398 AS_IF([test "x$enable_ixfrdist" = "xyes"],
399 [AC_MSG_NOTICE([ixfrdist: yes])],
400 [AC_MSG_NOTICE([ixfrdist: no])]
403 AC_MSG_NOTICE([Server Features enabled])
404 AC_MSG_NOTICE([-----------------------])
405 AC_MSG_NOTICE([Built-in modules: $modules])
406 AC_MSG_NOTICE([Dynamic modules: $dynmodules])
408 AS_IF([test "x$libcrypto_ecdsa" = "xyes"],
409 [AC_MSG_NOTICE([OpenSSL ecdsa: yes])],
410 [AC_MSG_NOTICE([OpenSSL ecdsa: no])]
412 AS_IF([test "x$LIBSODIUM_LIBS" != "x" || test "x$LIBDECAF_LIBS" != "x" || test "x$libcrypto_ed25519" = "xyes"],
413 [AC_MSG_NOTICE([ed25519: yes])],
414 [AC_MSG_NOTICE([ed25519: no])]
416 AS_IF([test "x$LIBDECAF_LIBS" != "x" || test "x$libcrypto_ed448" = "xyes"],
417 [AC_MSG_NOTICE([ed448: yes])],
418 [AC_MSG_NOTICE([ed448: no])]
420 AS_IF([test "x$needsqlite3" != "x"],
421 [AC_MSG_NOTICE([SQLite3: yes])],
422 [AC_MSG_NOTICE([SQLite3: no])]
424 AS_IF([test "x$LUAPC" != "x"],
425 [AC_MSG_NOTICE([Lua: $LUAPC])],
426 [AS_IF([test "x$LUAJITPC" != "x"],
427 [AC_MSG_NOTICE([LuaJit: $LUAJITPC])],
428 [AC_MSG_NOTICE([Lua/LuaJit: no])])
430 AS_IF([test "x$enable_experimental_pkcs11" = "xyes"],
431 [AC_MSG_NOTICE([PKCS-11: yes])]
433 AS_IF([test "x$enable_experimental_gss_tsig" = "xyes"],
434 [AC_MSG_NOTICE([GSS-TSIG: yes])]
436 AS_IF([test "x$enable_lua_records" = "xyes"],
437 [AC_MSG_NOTICE([LUA records: yes])]
439 AS_IF([test "x$systemd" != "xn"],
440 [AC_MSG_NOTICE([systemd: yes])],
441 [AC_MSG_NOTICE([systemd: no])]
443 AS_IF([test "x$enable_remotebackend_zeromq" != "xno"],
444 [AC_MSG_NOTICE([ZeroMQ connector for remotebackend: yes])]
446 AS_IF([test -n "$GEOIP_LIBS"],
447 [AC_MSG_NOTICE([libgeoip for geoipbackend: yes])]
449 AS_IF([test -n "$MMDB_LIBS"],
450 [AC_MSG_NOTICE([libmaxminddb for geoipbackend: yes])]