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])
44 PDNS_WITH_LUA([mandatory])
47 AC_MSG_CHECKING([whether we will enable compiler security checks])
48 AC_ARG_ENABLE([hardening],
49 [AS_HELP_STRING([--disable-hardening], [disable compiler security checks @<:@default=no@:>@])],
50 [enable_hardening=$enableval],
51 [enable_hardening=yes]
53 AC_MSG_RESULT([$enable_hardening])
55 AS_IF([test "x$enable_hardening" != "xno"], [
58 AC_CC_PARAM_SSP_BUFFER_SIZE([4])
59 AC_CC_D_FORTIFY_SOURCE
65 PDNS_CHECK_NETWORK_LIBS
70 # Define full_libdir to be the fully expanded (${exec_prefix}, etc.)
71 # "system" library path.
72 # We use this to search for other libraries.
73 eval full_libdir="\"$libdir\""
75 # detect pkg-config explicitly
82 [AC_DEFINE(HAVE_MMAP, [1], [Define to 1 if you have mmap])],
90 PDNS_CHECK_LIBCRYPTO([
92 AC_MSG_ERROR([OpenSSL/libcrypto not found])
95 PDNS_CHECK_LIBCRYPTO_ECDSA
96 PDNS_CHECK_LIBCRYPTO_EDDSA
98 AM_CONDITIONAL([HAVE_GNUTLS], [false])
99 AM_CONDITIONAL([HAVE_LIBSSL], [false])
101 PDNS_ENABLE_DNS_OVER_TLS
102 AS_IF([test "x$enable_dns_over_tls" != "xno"], [
105 AS_IF([test "x$HAVE_GNUTLS" != "x1" -a "x$HAVE_LIBSSL" != "x1"], [
106 AC_MSG_ERROR([DNS over TLS support requested but neither GnuTLS nor OpenSSL are available])
112 PDNS_CHECK_RAGEL([pdns/dnslabeltext.cc], [www.powerdns.com])
113 PDNS_CHECK_CLOCK_GETTIME
115 BOOST_REQUIRE([1.42])
116 # Boost accumulators, as used by dnsbulktest and dnstcpbench, need 1.48+
117 # to be compatible with C++11
118 AM_CONDITIONAL([HAVE_BOOST_GE_148], [test "$boost_major_version" -ge 148])
119 AS_IF([test "$boost_major_version" -ge 148], [
120 AC_DEFINE(HAVE_BOOST_GE_148, [1], [Define to 1 if you have boost >= 1.48])
123 BOOST_PROGRAM_OPTIONS([mt])
124 AS_IF([test "$boost_cv_lib_program_options" = "no"], [
125 AC_MSG_ERROR([Boost Program Options library not found])
127 PDNS_ENABLE_UNIT_TESTS
128 PDNS_ENABLE_BACKEND_UNIT_TESTS
129 PDNS_ENABLE_REPRODUCIBLE
130 PDNS_ENABLE_FUZZ_TARGETS
134 PDNS_CHECK_PYTHON_VENV
136 AM_CONDITIONAL([HAVE_API_SWAGGER_JSON], [test -e "$srcdir/pdns/api-swagger.json"])
137 AM_COND_IF([HAVE_API_SWAGGER_JSON],[],[
138 AM_COND_IF([HAVE_VENV],[],[
139 AC_MSG_ERROR([Python 3 and/or venv module are not available, Authoritative Server cannot be built.])
143 AM_CONDITIONAL([HAVE_MANPAGES], [test -e "$srcdir/docs/pdns_server.1"])
144 AM_COND_IF([HAVE_MANPAGES],[],[
145 AM_COND_IF([HAVE_VENV],[],[
146 AC_MSG_WARN([Python 3 and/or venv module are not available, documentation will not be built.])
152 dnl Checks for library functions.
153 dnl the *_r functions are in posix so we can use them unconditionally, but the ext/yahttp code is
154 dnl using the defines.
155 AC_CHECK_FUNCS_ONCE([strcasestr localtime_r gmtime_r recvmmsg sched_setscheduler])
156 AC_CHECK_FUNCS_ONCE([getrandom getentropy arc4random arc4random_uniform arc4random_buf])
158 AM_CONDITIONAL([HAVE_RECVMMSG], [test "x$ac_cv_func_recvmmsg" = "xyes"])
160 AS_IF([test "x$lt_cv_dlopen" = "xno"],
161 [AC_MSG_ERROR([Your system does not support dlopen])]
164 AC_SUBST([LIBDL], [$lt_cv_dlopen_libs])
166 PDNS_ENABLE_VERBOSE_LOGGING
170 AC_SUBST([socketdir])
172 AC_ARG_WITH([socketdir],
173 [AS_HELP_STRING([--with-socketdir], [where the controlsocket lives @<:@default=/var/run@:>@])],
174 [socketdir="$withval"]
177 modules="bind gmysql"
178 AC_ARG_WITH([modules],
179 [AS_HELP_STRING([--with-modules], [which backends to compile with @<:@default=bind gmysql@:>@])],
184 AC_ARG_WITH([dynmodules],
185 [AS_HELP_STRING([--with-dynmodules], [which backends to build for dynamic loading @<:@default=pipe@:>@])],
186 [dynmodules="$withval"]
189 AC_SUBST([moduledirs])
190 AC_SUBST([moduleobjects])
191 AC_SUBST([modulelibs])
192 AC_DEFINE_UNQUOTED([PDNS_MODULES], "$modules", [Built-in modules])
194 AS_IF([test x"$modules" = "xno"], [modules=""])
195 AS_IF([test x"$dynmodules" = "xno"], [dynmodules=""])
197 for a in $modules $dynmodules; do
216 AS_IF([test "x$enable_unit_tests" = "xyes"],
217 [PDNS_CHECK_CURL_PROGRAM]
219 have_remotebackend=yes
229 dnl Lua has been checked above
239 PDNS_ENABLE_REMOTEBACKEND_ZEROMQ
244 PDNS_WITH_LUA_RECORDS
246 AM_CONDITIONAL([LDAP], [test "x$needldap" = "xyes"])
249 AM_CONDITIONAL([SQLITE3], [test "x$needsqlite3" = "xyes"])
251 AM_CONDITIONAL([LMDB], [test "x$needlmdb" != "x"])
252 AM_CONDITIONAL([HAVE_LMDB], [test "x$LMDB_LIBS" != "x"])
254 AS_IF([test "x$needlmdb" = "xyes"], [
255 AS_IF([test "$with_lmdb" = "no"], [
256 AC_MSG_ERROR([--with-lmdb is set to 'no', but lmdb support is required])
258 AS_IF([test "x$HAVE_LMDB" != "x1"], [
259 AC_MSG_ERROR([lmdb not found via pkg-config, please install lmdb or set --with-lmdb to your lmdb installation directory])
263 AM_CONDITIONAL([CDB], [test "x$needcdb" != "x"])
264 AM_CONDITIONAL([HAVE_CDB], [test "x$CDB_LIBS" != "x"])
266 AS_IF([test "x$needcdb" = "xyes"], [
267 AS_IF([test "x$HAVE_CDB" != "x1"], [
268 AC_MSG_ERROR([cdb not found via pkg-config, please install cdb])
272 for a in $modules; do
273 AC_MSG_CHECKING([whether we can build module "${a}"])
274 if [[ -d "$srcdir/modules/${a}backend" ]]; then
276 moduledirs="$moduledirs ${a}backend"
278 for b in `cat $srcdir/modules/${a}backend/OBJECTFILES`; do
279 moduleobjects="$moduleobjects ../modules/${a}backend/$b"
281 modulelibs="$modulelibs `cat $srcdir/modules/${a}backend/OBJECTLIBS`"
284 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.])
288 for a in $dynmodules; do
289 AC_MSG_CHECKING([whether we can build dynamic module "${a}"])
290 if [[ -d "$srcdir/modules/${a}backend" ]]; then
292 moduledirs="$moduledirs ${a}backend"
295 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.])
300 AX_CHECK_SYSTEMD_FEATURES
301 AM_CONDITIONAL([HAVE_SYSTEMD], [ test x"$systemd" = "xy" ])
302 PDNS_WITH_SERVICE_USER([pdns])
304 LDFLAGS="$RELRO_LDFLAGS $LDFLAGS"
306 CFLAGS="$PIE_CFLAGS $CFLAGS"
307 CXXFLAGS="$PIE_CFLAGS $CXXFLAGS"
308 PROGRAM_LDFLAGS="$PIE_LDFLAGS $PROGRAM_LDFLAGS"
309 AC_SUBST([PROGRAM_LDFLAGS])
313 PDNS_ENABLE_SANITIZERS
314 PDNS_ENABLE_MALLOC_TRACE
319 AC_SUBST([AM_CPPFLAGS],
320 ["AS_ESCAPE([-I$(top_builddir) -I$(top_srcdir)]) $THREADFLAGS $BOOST_CPPFLAGS"]
323 AC_SUBST([YAHTTP_CFLAGS], ['-I$(top_srcdir)/ext/yahttp'])
324 AC_SUBST([YAHTTP_LIBS], ['$(top_builddir)/ext/yahttp/yahttp/libyahttp.la'])
325 AC_SUBST([IPCRYPT_CFLAGS], ['-I$(top_srcdir)/ext/ipcrypt'])
326 AC_SUBST([IPCRYPT_LIBS], ['$(top_builddir)/ext/ipcrypt/libipcrypt.la'])
328 CFLAGS="$SANITIZER_FLAGS $CFLAGS"
329 CXXFLAGS="$SANITIZER_FLAGS $CXXFLAGS"
331 CCVERSION=`$CC --version | head -1`
332 CXXVERSION=`$CXX --version | head -1`
334 AC_ARG_VAR(PACKAGEVERSION, [The version used in secpoll queries])
335 AS_IF([test "x$PACKAGEVERSION" != "x"],
336 [AC_DEFINE_UNQUOTED([PACKAGEVERSION], "$PACKAGEVERSION", [Set to the package version used for secpoll])]
339 export moduledirs moduleobjects modulelibs
349 ext/arc4random/Makefile
352 ext/yahttp/yahttp/Makefile
354 modules/bindbackend/Makefile
355 modules/geoipbackend/Makefile
356 modules/gmysqlbackend/Makefile
357 modules/godbcbackend/Makefile
358 modules/gpgsqlbackend/Makefile
359 modules/gsqlite3backend/Makefile
360 modules/ldapbackend/Makefile
361 modules/lmdbbackend/Makefile
362 modules/lua2backend/Makefile
363 modules/pipebackend/Makefile
364 modules/remotebackend/Makefile
365 modules/tinydnsbackend/Makefile
370 AC_MSG_NOTICE([Configuration summary])
371 AC_MSG_NOTICE([=====================])
373 AC_MSG_NOTICE([Configured with: $pdns_configure_args])
375 AC_MSG_NOTICE([CC: $CC ($CCVERSION)])
376 AC_MSG_NOTICE([CXX: $CXX ($CXXVERSION)])
377 AC_MSG_NOTICE([LD: $LD])
378 AC_MSG_NOTICE([CFLAGS: $CFLAGS])
379 AC_MSG_NOTICE([CPPFLAGS: $CPPFLAGS])
380 AC_MSG_NOTICE([CXXFLAGS: $CXXFLAGS])
381 AC_MSG_NOTICE([LDFLAGS: $LDFLAGS])
382 AC_MSG_NOTICE([LIBS: $LIBS])
383 AC_MSG_NOTICE([BOOST_CPPFLAGS: $BOOST_CPPFLAGS])
385 AC_MSG_NOTICE([Extras enabled])
386 AC_MSG_NOTICE([--------------])
387 AS_IF([test "x$enable_tools" = "xyes"],
388 [AC_MSG_NOTICE([Tools: yes])],
389 [AC_MSG_NOTICE([Tools: no])]
391 AS_IF([test "x$enable_ixfrdist" = "xyes"],
392 [AC_MSG_NOTICE([ixfrdist: yes])],
393 [AC_MSG_NOTICE([ixfrdist: no])]
396 AC_MSG_NOTICE([Server Features enabled])
397 AC_MSG_NOTICE([-----------------------])
398 AC_MSG_NOTICE([Built-in modules: $modules])
399 AC_MSG_NOTICE([Dynamic modules: $dynmodules])
401 AS_IF([test "x$libcrypto_ecdsa" = "xyes"],
402 [AC_MSG_NOTICE([OpenSSL ecdsa: yes])],
403 [AC_MSG_NOTICE([OpenSSL ecdsa: no])]
405 AS_IF([test "x$LIBSODIUM_LIBS" != "x" || test "x$LIBDECAF_LIBS" != "x" || test "x$libcrypto_ed25519" = "xyes"],
406 [AC_MSG_NOTICE([ed25519: yes])],
407 [AC_MSG_NOTICE([ed25519: no])]
409 AS_IF([test "x$LIBDECAF_LIBS" != "x" || test "x$libcrypto_ed448" = "xyes"],
410 [AC_MSG_NOTICE([ed448: yes])],
411 [AC_MSG_NOTICE([ed448: no])]
413 AS_IF([test "x$needsqlite3" != "x"],
414 [AC_MSG_NOTICE([SQLite3: yes])],
415 [AC_MSG_NOTICE([SQLite3: no])]
417 AS_IF([test "x$LUAPC" != "x"],
418 [AC_MSG_NOTICE([Lua: $LUAPC])],
419 [AS_IF([test "x$LUAJITPC" != "x"],
420 [AC_MSG_NOTICE([LuaJit: $LUAJITPC])],
421 [AC_MSG_NOTICE([Lua/LuaJit: no])])
423 AS_IF([test "x$enable_experimental_pkcs11" = "xyes"],
424 [AC_MSG_NOTICE([PKCS-11: yes])]
426 AS_IF([test "x$enable_experimental_gss_tsig" = "xyes"],
427 [AC_MSG_NOTICE([GSS-TSIG: yes])]
429 AS_IF([test "x$enable_lua_records" = "xyes"],
430 [AC_MSG_NOTICE([LUA records: yes])]
432 AS_IF([test "x$systemd" != "xn"],
433 [AC_MSG_NOTICE([systemd: yes])],
434 [AC_MSG_NOTICE([systemd: no])]
436 AS_IF([test "x$enable_remotebackend_zeromq" != "xno"],
437 [AC_MSG_NOTICE([ZeroMQ connector for remotebackend: yes])]
439 AS_IF([test -n "$GEOIP_LIBS"],
440 [AC_MSG_NOTICE([libgeoip for geoipbackend: yes])]
442 AS_IF([test -n "$MMDB_LIBS"],
443 [AC_MSG_NOTICE([libmaxminddb for geoipbackend: yes])]