3 AC_INIT([pdns-recursor], m4_esyscmd(build-aux/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_recursor.cc])
8 AC_CONFIG_MACRO_DIR([m4])
10 AC_CONFIG_HEADERS([config.h])
13 # Add some default CFLAGS and CXXFLAGS, can be appended to using the environment variables
14 CFLAGS="-Wall -g -O2 $CFLAGS"
15 CXXFLAGS="-Wall -g -O2 $CXXFLAGS"
17 AC_SUBST([pdns_configure_args],["$ac_configure_args"])
18 AC_DEFINE_UNQUOTED([PDNS_CONFIG_ARGS],
19 ["$pdns_configure_args"],
20 [pdns-recursor configure arguments]
29 AC_DEFINE([RECURSOR], [1],
30 [This is the PowerDNS Recursor]
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_11([ext], [mandatory])
40 PDNS_CHECK_NETWORK_LIBS
43 # Boost Context was introduced in 1.51 (Aug 2012), but there was an immediate
44 # API break in 1.52 (Nov 2012), so we only support that, and later.
45 pdns_context_library="System V ucontexts"
47 AC_DEFUN([PDNS_SELECT_CONTEXT_IMPL], [
48 AC_MSG_CHECKING([whether Boost is new enough to use the context library...])
49 if test $boost_major_version -ge 152; then
51 if test $boost_major_version -ge 157; then
53 m4_pattern_allow([^BOOST_THREAD_(LIBS|LDFLAGS)$])dnl
54 LIBS="$LIBS $BOOST_THREAD_LIBS"
55 LDFLAGS="$LDFLAGS $BOOST_THREAD_LDFLAGS"
57 AC_MSG_NOTICE([checking whether the Boost context library actually links...])
58 if test $boost_major_version -ge 161; then
59 BOOST_FIND_HEADER([boost/context/detail/fcontext.hpp], [ : ], [
60 BOOST_FIND_LIB([context], [$1], [boost/context/detail/fcontext.hpp], [[]])
63 BOOST_FIND_HEADER([boost/context/fcontext.hpp], [ : ], [
64 BOOST_FIND_LIB([context], [$1], [boost/context/fcontext.hpp], [[]])
67 case $boost_cv_lib_context in
69 pdns_context_library="Boost context"
70 AC_MSG_NOTICE([MTasker will use the Boost context library for context switching])
73 AC_MSG_NOTICE([Boost context library is missing])
74 AC_MSG_NOTICE([MTasker will use System V ucontexts for context switching])
79 AC_MSG_NOTICE([MTasker will use System V ucontexts for context switching])
83 PDNS_CHECK_CLOCK_GETTIME
85 boost_required_version=1.35
88 AS_IF([test "x$PROTOBUF_LIBS" != "x" -a x"$PROTOC" != "x"],
89 # The protobuf code needs boost::uuid, which is available from 1.42 onward
90 [AC_MSG_WARN([Bumping minimal Boost requirement to 1.42. To keep the requirement at 1.35, disable protobuf support])
91 boost_required_version=1.42]
94 BOOST_REQUIRE([$boost_required_version])
96 # Check against flat_set header that requires boost >= 1.48
97 BOOST_FIND_HEADER([boost/container/flat_set.hpp], [AC_MSG_NOTICE([boost::container::flat_set not available, will fallback to std::set])])
99 PDNS_SELECT_CONTEXT_IMPL
101 PDNS_ENABLE_UNIT_TESTS
102 PDNS_ENABLE_REPRODUCIBLE
104 PDNS_WITH_LUA([mandatory])
105 AS_IF([test "x$LUAPC" = "xluajit"], [
106 # export all symbols to be able to use the Lua FFI interface
107 AC_MSG_NOTICE([Adding -rdynamic to export all symbols for the Lua FFI interface])
108 LDFLAGS="$LDFLAGS -rdynamic"
113 PDNS_ENABLE_VERBOSE_LOGGING
116 PDNS_CHECK_LIBCRYPTO([
118 AC_MSG_ERROR([OpenSSL/libcrypto not found])
121 PDNS_CHECK_LIBCRYPTO_ECDSA
122 PDNS_CHECK_LIBCRYPTO_EDDSA
129 # check for tools we might need
130 PDNS_CHECK_RAGEL([pdns/dnslabeltext.cc], [www.powerdns.com])
133 AC_CHECK_FUNCS_ONCE([strcasestr getrandom arc4random])
135 PDNS_CHECK_PTHREAD_NP
137 AC_SUBST([socketdir])
139 AC_ARG_WITH([socketdir],
140 [AS_HELP_STRING([--with-socketdir], [where the controlsocket lives @<:@default=/var/run@:>@])],
141 [socketdir="$withval"]
146 AM_COND_IF([NOD_ENABLED],
149 AS_IF([test -z "$BOOST_FILESYSTEM_LIBS"], [ AC_MSG_ERROR([Boost filesystem library is not installed])])],
152 AC_SUBST([nodcachedir])
153 nodcachedir='${localstatedir}/lib/pdns-recursor'
154 AC_ARG_WITH([nod-cache-dir],
155 [AS_HELP_STRING([--with-nodcachedir], [where newly observed domain cache files live @<:@default=LOCALSTATEDIR/lib/pdns-recursor@:>@])],
156 [nodcachedir="$withval"]
159 AC_MSG_CHECKING([whether we will enable compiler security checks])
160 AC_ARG_ENABLE([hardening],
161 [AS_HELP_STRING([--disable-hardening], [disable compiler security checks @<:@default=no@:>@])],
162 [enable_hardening=$enableval],
163 [enable_hardening=yes]
165 AC_MSG_RESULT([$enable_hardening])
167 AS_IF([test "x$enable_hardening" != "xno"], [
169 AC_CC_STACK_PROTECTOR
170 AC_CC_PARAM_SSP_BUFFER_SIZE([4])
171 AC_CC_D_FORTIFY_SOURCE
175 PDNS_ENABLE_SANITIZERS
176 PDNS_ENABLE_MALLOC_TRACE
179 AX_CHECK_SYSTEMD_FEATURES
180 AM_CONDITIONAL([HAVE_SYSTEMD], [ test x"$systemd" = "xy" ])
181 PDNS_CHECK_VIRTUALENV
185 AC_SUBST([AM_CPPFLAGS],
186 ["AS_ESCAPE([-I$(top_builddir) -I$(top_srcdir)]) $THREADFLAGS $BOOST_CPPFLAGS"]
189 AC_SUBST([YAHTTP_CFLAGS], ['-I$(top_srcdir)/ext/yahttp'])
190 AC_SUBST([YAHTTP_LIBS], ['$(top_builddir)/ext/yahttp/yahttp/libyahttp.la'])
192 LDFLAGS="$RELRO_LDFLAGS $LDFLAGS"
193 CFLAGS="$PIE_CFLAGS $CFLAGS"
194 CXXFLAGS="$SANITIZER_FLAGS $PIE_CFLAGS $CXXFLAGS"
195 PROGRAM_LDFLAGS="$PIE_LDFLAGS $PROGRAM_LDFLAGS"
196 AC_SUBST([PROGRAM_LDFLAGS])
198 AC_CONFIG_FILES([Makefile
203 ext/yahttp/yahttp/Makefile])
208 AC_MSG_NOTICE([Configuration summary])
209 AC_MSG_NOTICE([=====================])
211 AS_IF([test "x$pdns_configure_args" != "x"],
212 [summary_conf_opts=$pdns_configure_args],
213 [summary_conf_opts="(no options)"]
215 AC_MSG_NOTICE([PowerDNS Recursor configured with: $summary_conf_opts])
217 AC_MSG_NOTICE([CC: $CC])
218 AC_MSG_NOTICE([CXX: $CXX])
219 AC_MSG_NOTICE([LD: $LD])
220 AC_MSG_NOTICE([CFLAGS: $CFLAGS])
221 AC_MSG_NOTICE([CPPFLAGS: $CPPFLAGS])
222 AC_MSG_NOTICE([CXXFLAGS: $CXXFLAGS])
223 AC_MSG_NOTICE([LDFLAGS: $LDFLAGS])
224 AC_MSG_NOTICE([LIBS: $LIBS])
225 AC_MSG_NOTICE([BOOST_CPPFLAGS: $BOOST_CPPFLAGS])
227 AC_MSG_NOTICE([Features enabled])
228 AC_MSG_NOTICE([----------------])
229 AC_MSG_NOTICE([Lua: $LUAPC])
230 AC_MSG_NOTICE([OpenSSL ECDSA: $libcrypto_ecdsa])
231 AS_IF([test "x$LIBSODIUM_LIBS" != "x" || test "x$LIBDECAF_LIBS" != "x" || test "x$libcrypto_ed25519" = "xyes"],
232 [AC_MSG_NOTICE([ed25519: yes])],
233 [AC_MSG_NOTICE([ed25519: no])]
235 AS_IF([test "x$LIBDECAF_LIBS" != "x" || test "x$libcrypto_ed448" = "xyes"],
236 [AC_MSG_NOTICE([ed448: yes])],
237 [AC_MSG_NOTICE([ed448: no])]
239 AS_IF([test "x$PROTOBUF_LIBS" != "x" -a x"$PROTOC" != "x"],
240 [AC_MSG_NOTICE([Protobuf: yes])],
241 [AC_MSG_NOTICE([Protobuf: no])]
243 AS_IF([test "x$NET_SNMP_LIBS" != "x"],
244 [AC_MSG_NOTICE([SNMP: yes])],
245 [AC_MSG_NOTICE([SNMP: no])]
247 AS_IF([test "x$systemd" != "xn"],
248 [AC_MSG_NOTICE([systemd: yes])],
249 [AC_MSG_NOTICE([systemd: no])]
251 AM_COND_IF([NOD_ENABLED],
252 [AC_MSG_NOTICE([nod: yes])],
253 [AC_MSG_NOTICE([nod: no])]
255 AC_MSG_NOTICE([Context library: $pdns_context_library])