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])],
87 AC_CHECK_HEADERS([sys/random.h])
91 PDNS_CHECK_LIBCRYPTO([
93 AC_MSG_ERROR([OpenSSL/libcrypto not found])
96 PDNS_CHECK_LIBCRYPTO_ECDSA
97 PDNS_CHECK_LIBCRYPTO_EDDSA
99 AM_CONDITIONAL([HAVE_GNUTLS], [false])
100 AM_CONDITIONAL([HAVE_LIBSSL], [false])
102 PDNS_ENABLE_DNS_OVER_TLS
103 AS_IF([test "x$enable_dns_over_tls" != "xno"], [
106 AS_IF([test "x$HAVE_GNUTLS" != "x1" -a "x$HAVE_LIBSSL" != "x1"], [
107 AC_MSG_ERROR([DNS over TLS support requested but neither GnuTLS nor OpenSSL are available])
113 PDNS_CHECK_RAGEL([pdns/dnslabeltext.cc], [www.powerdns.com])
114 PDNS_CHECK_CLOCK_GETTIME
116 BOOST_REQUIRE([1.42])
117 # Boost accumulators, as used by dnsbulktest and dnstcpbench, need 1.48+
118 # to be compatible with C++11
119 AM_CONDITIONAL([HAVE_BOOST_GE_148], [test "$boost_major_version" -ge 148])
120 AS_IF([test "$boost_major_version" -ge 148], [
121 AC_DEFINE(HAVE_BOOST_GE_148, [1], [Define to 1 if you have boost >= 1.48])
124 BOOST_PROGRAM_OPTIONS([mt])
125 AS_IF([test "$boost_cv_lib_program_options" = "no"], [
126 AC_MSG_ERROR([Boost Program Options library not found])
128 PDNS_ENABLE_UNIT_TESTS
129 PDNS_ENABLE_BACKEND_UNIT_TESTS
130 PDNS_ENABLE_REPRODUCIBLE
131 PDNS_ENABLE_FUZZ_TARGETS
135 PDNS_CHECK_PYTHON_VENV
137 AM_CONDITIONAL([HAVE_API_SWAGGER_JSON], [test -e "$srcdir/pdns/api-swagger.json"])
138 AM_COND_IF([HAVE_API_SWAGGER_JSON],[],[
139 AM_COND_IF([HAVE_VENV],[],[
140 AC_MSG_ERROR([Python 3 and/or venv module are not available, Authoritative Server cannot be built.])
144 AM_CONDITIONAL([HAVE_MANPAGES], [test -e "$srcdir/docs/pdns_server.1"])
145 AM_COND_IF([HAVE_MANPAGES],[],[
146 AM_COND_IF([HAVE_VENV],[],[
147 AC_MSG_WARN([Python 3 and/or venv module are not available, documentation will not be built.])
153 dnl Checks for library functions.
154 dnl the *_r functions are in posix so we can use them unconditionally, but the ext/yahttp code is
155 dnl using the defines.
156 AC_CHECK_FUNCS_ONCE([strcasestr localtime_r gmtime_r recvmmsg sched_setscheduler])
157 AC_CHECK_FUNCS_ONCE([getrandom getentropy arc4random arc4random_uniform arc4random_buf])
158 PDNS_CHECK_SECURE_MEMSET
160 AM_CONDITIONAL([HAVE_RECVMMSG], [test "x$ac_cv_func_recvmmsg" = "xyes"])
162 AS_IF([test "x$lt_cv_dlopen" = "xno"],
163 [AC_MSG_ERROR([Your system does not support dlopen])]
166 AC_SUBST([LIBDL], [$lt_cv_dlopen_libs])
168 PDNS_ENABLE_VERBOSE_LOGGING
172 AC_SUBST([socketdir])
174 AC_ARG_WITH([socketdir],
175 [AS_HELP_STRING([--with-socketdir], [where the controlsocket lives @<:@default=/var/run@:>@])],
176 [socketdir="$withval"]
179 modules="bind gmysql"
180 AC_ARG_WITH([modules],
181 [AS_HELP_STRING([--with-modules], [which backends to compile with @<:@default=bind gmysql@:>@])],
186 AC_ARG_WITH([dynmodules],
187 [AS_HELP_STRING([--with-dynmodules], [which backends to build for dynamic loading @<:@default=pipe@:>@])],
188 [dynmodules="$withval"]
191 AC_SUBST([moduledirs])
192 AC_SUBST([moduleobjects])
193 AC_SUBST([modulelibs])
194 AC_DEFINE_UNQUOTED([PDNS_MODULES], "$modules", [Built-in modules])
196 AS_IF([test x"$modules" = "xno"], [modules=""])
197 AS_IF([test x"$dynmodules" = "xno"], [dynmodules=""])
199 for a in $modules $dynmodules; do
218 AS_IF([test "x$enable_unit_tests" = "xyes"],
219 [PDNS_CHECK_CURL_PROGRAM]
221 have_remotebackend=yes
231 dnl Lua has been checked above
241 PDNS_ENABLE_REMOTEBACKEND_ZEROMQ
246 PDNS_WITH_LUA_RECORDS
248 AM_CONDITIONAL([LDAP], [test "x$needldap" = "xyes"])
251 AM_CONDITIONAL([SQLITE3], [test "x$needsqlite3" = "xyes"])
253 AM_CONDITIONAL([LMDB], [test "x$needlmdb" != "x"])
254 AM_CONDITIONAL([HAVE_LMDB], [test "x$LMDB_LIBS" != "x"])
256 AS_IF([test "x$needlmdb" = "xyes"], [
257 AS_IF([test "$with_lmdb" = "no"], [
258 AC_MSG_ERROR([--with-lmdb is set to 'no', but lmdb support is required])
260 AS_IF([test "x$HAVE_LMDB" != "x1"], [
261 AC_MSG_ERROR([lmdb not found via pkg-config, please install lmdb or set --with-lmdb to your lmdb installation directory])
265 AM_CONDITIONAL([CDB], [test "x$needcdb" != "x"])
266 AM_CONDITIONAL([HAVE_CDB], [test "x$CDB_LIBS" != "x"])
268 AS_IF([test "x$needcdb" = "xyes"], [
269 AS_IF([test "x$HAVE_CDB" != "x1"], [
270 AC_MSG_ERROR([cdb not found via pkg-config, please install cdb])
274 for a in $modules; do
275 AC_MSG_CHECKING([whether we can build module "${a}"])
276 if [[ -d "$srcdir/modules/${a}backend" ]]; then
278 moduledirs="$moduledirs ${a}backend"
280 for b in `cat $srcdir/modules/${a}backend/OBJECTFILES`; do
281 moduleobjects="$moduleobjects ../modules/${a}backend/$b"
283 modulelibs="$modulelibs `cat $srcdir/modules/${a}backend/OBJECTLIBS`"
286 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.])
290 for a in $dynmodules; do
291 AC_MSG_CHECKING([whether we can build dynamic module "${a}"])
292 if [[ -d "$srcdir/modules/${a}backend" ]]; then
294 moduledirs="$moduledirs ${a}backend"
297 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.])
302 AX_CHECK_SYSTEMD_FEATURES
303 AM_CONDITIONAL([HAVE_SYSTEMD], [ test x"$systemd" = "xy" ])
304 PDNS_WITH_SERVICE_USER([pdns])
306 LDFLAGS="$RELRO_LDFLAGS $LDFLAGS"
308 CFLAGS="$PIE_CFLAGS $CFLAGS"
309 CXXFLAGS="$PIE_CFLAGS $CXXFLAGS"
310 PROGRAM_LDFLAGS="$PIE_LDFLAGS $PROGRAM_LDFLAGS"
311 AC_SUBST([PROGRAM_LDFLAGS])
315 PDNS_ENABLE_SANITIZERS
316 PDNS_ENABLE_MALLOC_TRACE
321 AC_SUBST([AM_CPPFLAGS],
322 ["AS_ESCAPE([-I$(top_builddir) -I$(top_srcdir)]) $THREADFLAGS $BOOST_CPPFLAGS"]
325 AC_SUBST([YAHTTP_CFLAGS], ['-I$(top_srcdir)/ext/yahttp'])
326 AC_SUBST([YAHTTP_LIBS], ['$(top_builddir)/ext/yahttp/yahttp/libyahttp.la'])
327 AC_SUBST([IPCRYPT_CFLAGS], ['-I$(top_srcdir)/ext/ipcrypt'])
328 AC_SUBST([IPCRYPT_LIBS], ['$(top_builddir)/ext/ipcrypt/libipcrypt.la'])
330 CFLAGS="$SANITIZER_FLAGS $CFLAGS"
331 CXXFLAGS="$SANITIZER_FLAGS $CXXFLAGS"
333 CCVERSION=`$CC --version | head -1`
334 CXXVERSION=`$CXX --version | head -1`
336 AC_ARG_VAR(PACKAGEVERSION, [The version used in secpoll queries])
337 AS_IF([test "x$PACKAGEVERSION" != "x"],
338 [AC_DEFINE_UNQUOTED([PACKAGEVERSION], "$PACKAGEVERSION", [Set to the package version used for secpoll])]
341 export moduledirs moduleobjects modulelibs
351 ext/arc4random/Makefile
354 ext/yahttp/yahttp/Makefile
356 modules/bindbackend/Makefile
357 modules/geoipbackend/Makefile
358 modules/gmysqlbackend/Makefile
359 modules/godbcbackend/Makefile
360 modules/gpgsqlbackend/Makefile
361 modules/gsqlite3backend/Makefile
362 modules/ldapbackend/Makefile
363 modules/lmdbbackend/Makefile
364 modules/lua2backend/Makefile
365 modules/pipebackend/Makefile
366 modules/remotebackend/Makefile
367 modules/tinydnsbackend/Makefile
372 AC_MSG_NOTICE([Configuration summary])
373 AC_MSG_NOTICE([=====================])
375 AC_MSG_NOTICE([Configured with: $pdns_configure_args])
377 AC_MSG_NOTICE([CC: $CC ($CCVERSION)])
378 AC_MSG_NOTICE([CXX: $CXX ($CXXVERSION)])
379 AC_MSG_NOTICE([LD: $LD])
380 AC_MSG_NOTICE([CFLAGS: $CFLAGS])
381 AC_MSG_NOTICE([CPPFLAGS: $CPPFLAGS])
382 AC_MSG_NOTICE([CXXFLAGS: $CXXFLAGS])
383 AC_MSG_NOTICE([LDFLAGS: $LDFLAGS])
384 AC_MSG_NOTICE([LIBS: $LIBS])
385 AC_MSG_NOTICE([BOOST_CPPFLAGS: $BOOST_CPPFLAGS])
387 AC_MSG_NOTICE([Extras enabled])
388 AC_MSG_NOTICE([--------------])
389 AS_IF([test "x$enable_tools" = "xyes"],
390 [AC_MSG_NOTICE([Tools: yes])],
391 [AC_MSG_NOTICE([Tools: no])]
393 AS_IF([test "x$enable_ixfrdist" = "xyes"],
394 [AC_MSG_NOTICE([ixfrdist: yes])],
395 [AC_MSG_NOTICE([ixfrdist: no])]
398 AC_MSG_NOTICE([Server Features enabled])
399 AC_MSG_NOTICE([-----------------------])
400 AC_MSG_NOTICE([Built-in modules: $modules])
401 AC_MSG_NOTICE([Dynamic modules: $dynmodules])
403 AS_IF([test "x$libcrypto_ecdsa" = "xyes"],
404 [AC_MSG_NOTICE([OpenSSL ecdsa: yes])],
405 [AC_MSG_NOTICE([OpenSSL ecdsa: no])]
407 AS_IF([test "x$LIBSODIUM_LIBS" != "x" || test "x$LIBDECAF_LIBS" != "x" || test "x$libcrypto_ed25519" = "xyes"],
408 [AC_MSG_NOTICE([ed25519: yes])],
409 [AC_MSG_NOTICE([ed25519: no])]
411 AS_IF([test "x$LIBDECAF_LIBS" != "x" || test "x$libcrypto_ed448" = "xyes"],
412 [AC_MSG_NOTICE([ed448: yes])],
413 [AC_MSG_NOTICE([ed448: no])]
415 AS_IF([test "x$needsqlite3" != "x"],
416 [AC_MSG_NOTICE([SQLite3: yes])],
417 [AC_MSG_NOTICE([SQLite3: no])]
419 AS_IF([test "x$LUAPC" != "x"],
420 [AC_MSG_NOTICE([Lua: $LUAPC])],
421 [AS_IF([test "x$LUAJITPC" != "x"],
422 [AC_MSG_NOTICE([LuaJit: $LUAJITPC])],
423 [AC_MSG_NOTICE([Lua/LuaJit: no])])
425 AS_IF([test "x$enable_experimental_pkcs11" = "xyes"],
426 [AC_MSG_NOTICE([PKCS-11: yes])]
428 AS_IF([test "x$enable_experimental_gss_tsig" = "xyes"],
429 [AC_MSG_NOTICE([GSS-TSIG: yes])]
431 AS_IF([test "x$enable_lua_records" = "xyes"],
432 [AC_MSG_NOTICE([LUA records: yes])]
434 AS_IF([test "x$systemd" != "xn"],
435 [AC_MSG_NOTICE([systemd: yes])],
436 [AC_MSG_NOTICE([systemd: no])]
438 AS_IF([test "x$enable_remotebackend_zeromq" != "xno"],
439 [AC_MSG_NOTICE([ZeroMQ connector for remotebackend: yes])]
441 AS_IF([test -n "$GEOIP_LIBS"],
442 [AC_MSG_NOTICE([libgeoip for geoipbackend: yes])]
444 AS_IF([test -n "$MMDB_LIBS"],
445 [AC_MSG_NOTICE([libmaxminddb for geoipbackend: yes])]