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
89 # Check against flat_set header that requires boost >= 1.48
90 BOOST_FIND_HEADER([boost/container/flat_set.hpp], [AC_MSG_NOTICE([boost::container::flat_set not available, will fallback to std::set])])
92 PDNS_SELECT_CONTEXT_IMPL
94 PDNS_ENABLE_UNIT_TESTS
95 PDNS_ENABLE_REPRODUCIBLE
97 PDNS_WITH_LUA([mandatory])
98 AS_IF([test "x$LUAPC" = "xluajit"], [
99 # export all symbols to be able to use the Lua FFI interface
100 AC_MSG_NOTICE([Adding -rdynamic to export all symbols for the Lua FFI interface])
101 LDFLAGS="$LDFLAGS -rdynamic"
106 PDNS_ENABLE_VERBOSE_LOGGING
109 PDNS_CHECK_LIBCRYPTO([
111 AC_MSG_ERROR([OpenSSL/libcrypto not found])
114 PDNS_CHECK_LIBCRYPTO_ECDSA
115 PDNS_CHECK_LIBCRYPTO_EDDSA
122 # check for tools we might need
123 PDNS_CHECK_RAGEL([pdns/dnslabeltext.cc], [www.powerdns.com])
126 AC_CHECK_FUNCS_ONCE([strcasestr getrandom arc4random])
128 PDNS_CHECK_PTHREAD_NP
130 AC_SUBST([socketdir])
132 AC_ARG_WITH([socketdir],
133 [AS_HELP_STRING([--with-socketdir], [where the controlsocket lives @<:@default=/var/run@:>@])],
134 [socketdir="$withval"]
139 AM_COND_IF([NOD_ENABLED],
142 AS_IF([test -z "$BOOST_FILESYSTEM_LIBS"], [ AC_MSG_ERROR([Boost filesystem library is not installed])])],
145 AC_SUBST([nodcachedir])
146 nodcachedir='${localstatedir}/lib/pdns-recursor'
147 AC_ARG_WITH([nod-cache-dir],
148 [AS_HELP_STRING([--with-nodcachedir], [where newly observed domain cache files live @<:@default=LOCALSTATEDIR/lib/pdns-recursor@:>@])],
149 [nodcachedir="$withval"]
154 AC_MSG_CHECKING([whether we will enable compiler security checks])
155 AC_ARG_ENABLE([hardening],
156 [AS_HELP_STRING([--disable-hardening], [disable compiler security checks @<:@default=no@:>@])],
157 [enable_hardening=$enableval],
158 [enable_hardening=yes]
160 AC_MSG_RESULT([$enable_hardening])
162 AS_IF([test "x$enable_hardening" != "xno"], [
164 AC_CC_STACK_PROTECTOR
165 AC_CC_PARAM_SSP_BUFFER_SIZE([4])
166 AC_CC_D_FORTIFY_SOURCE
170 PDNS_ENABLE_SANITIZERS
171 PDNS_ENABLE_MALLOC_TRACE
174 AX_CHECK_SYSTEMD_FEATURES
175 AM_CONDITIONAL([HAVE_SYSTEMD], [ test x"$systemd" = "xy" ])
176 PDNS_CHECK_VIRTUALENV
180 AC_SUBST([AM_CPPFLAGS],
181 ["AS_ESCAPE([-I$(top_builddir) -I$(top_srcdir)]) $THREADFLAGS $BOOST_CPPFLAGS"]
184 AC_SUBST([YAHTTP_CFLAGS], ['-I$(top_srcdir)/ext/yahttp'])
185 AC_SUBST([YAHTTP_LIBS], ['$(top_builddir)/ext/yahttp/yahttp/libyahttp.la'])
187 LDFLAGS="$RELRO_LDFLAGS $LDFLAGS"
188 CFLAGS="$PIE_CFLAGS $CFLAGS"
189 CXXFLAGS="$SANITIZER_FLAGS $PIE_CFLAGS $CXXFLAGS"
190 PROGRAM_LDFLAGS="$PIE_LDFLAGS $PROGRAM_LDFLAGS"
191 AC_SUBST([PROGRAM_LDFLAGS])
193 AC_CONFIG_FILES([Makefile
198 ext/yahttp/yahttp/Makefile])
203 AC_MSG_NOTICE([Configuration summary])
204 AC_MSG_NOTICE([=====================])
206 AS_IF([test "x$pdns_configure_args" != "x"],
207 [summary_conf_opts=$pdns_configure_args],
208 [summary_conf_opts="(no options)"]
210 AC_MSG_NOTICE([PowerDNS Recursor configured with: $summary_conf_opts])
212 AC_MSG_NOTICE([CC: $CC])
213 AC_MSG_NOTICE([CXX: $CXX])
214 AC_MSG_NOTICE([LD: $LD])
215 AC_MSG_NOTICE([CFLAGS: $CFLAGS])
216 AC_MSG_NOTICE([CPPFLAGS: $CPPFLAGS])
217 AC_MSG_NOTICE([CXXFLAGS: $CXXFLAGS])
218 AC_MSG_NOTICE([LDFLAGS: $LDFLAGS])
219 AC_MSG_NOTICE([LIBS: $LIBS])
220 AC_MSG_NOTICE([BOOST_CPPFLAGS: $BOOST_CPPFLAGS])
222 AC_MSG_NOTICE([Features enabled])
223 AC_MSG_NOTICE([----------------])
224 AC_MSG_NOTICE([Lua: $LUAPC])
225 AC_MSG_NOTICE([OpenSSL ECDSA: $libcrypto_ecdsa])
226 AS_IF([test "x$LIBSODIUM_LIBS" != "x" || test "x$LIBDECAF_LIBS" != "x" || test "x$libcrypto_ed25519" = "xyes"],
227 [AC_MSG_NOTICE([ed25519: yes])],
228 [AC_MSG_NOTICE([ed25519: no])]
230 AS_IF([test "x$LIBDECAF_LIBS" != "x" || test "x$libcrypto_ed448" = "xyes"],
231 [AC_MSG_NOTICE([ed448: yes])],
232 [AC_MSG_NOTICE([ed448: no])]
234 AS_IF([test "x$PROTOBUF_LIBS" != "x" -a x"$PROTOC" != "x"],
235 [AC_MSG_NOTICE([Protobuf: yes])],
236 [AC_MSG_NOTICE([Protobuf: no])]
238 AS_IF([test "x$NET_SNMP_LIBS" != "x"],
239 [AC_MSG_NOTICE([SNMP: yes])],
240 [AC_MSG_NOTICE([SNMP: no])]
242 AS_IF([test "x$systemd" != "xn"],
243 [AC_MSG_NOTICE([systemd: yes])],
244 [AC_MSG_NOTICE([systemd: no])]
246 AM_COND_IF([NOD_ENABLED],
247 [AC_MSG_NOTICE([nod: yes])],
248 [AC_MSG_NOTICE([nod: no])]
251 [AC_MSG_NOTICE([dnstap: yes])],
252 [AC_MSG_NOTICE([dnstap: no])]
254 AC_MSG_NOTICE([Context library: $pdns_context_library])