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 PDNS_CHECK_CLOCK_GETTIME
49 # Check against flat_set header that requires boost >= 1.48
50 BOOST_FIND_HEADER([boost/container/flat_set.hpp], [AC_MSG_NOTICE([boost::container::flat_set not available, will fallback to std::set])])
52 # Boost Context was introduced in 1.51 (Aug 2012), but there was an immediate
53 # API break in 1.52 (Nov 2012), so we only support that, and later.
54 pdns_context_library="System V ucontexts"
55 AS_IF([test $boost_major_version -ge 152], [BOOST_CONTEXT([], [no])])
56 AC_MSG_CHECKING([what context library to use for MTasker])
57 AS_IF([test x"$boost_cv_lib_context" = "xyes"], [pdns_context_library="Boost Context"])
58 AC_MSG_RESULT([$pdns_context_library])
60 PDNS_ENABLE_UNIT_TESTS
61 PDNS_ENABLE_REPRODUCIBLE
63 PDNS_WITH_LUA([mandatory])
64 AS_IF([test "x$LUAPC" = "xluajit"], [
65 # export all symbols to be able to use the Lua FFI interface
66 AC_MSG_NOTICE([Adding -rdynamic to export all symbols for the Lua FFI interface])
67 LDFLAGS="$LDFLAGS -rdynamic"
72 PDNS_ENABLE_VERBOSE_LOGGING
75 PDNS_CHECK_LIBCRYPTO([
77 AC_MSG_ERROR([OpenSSL/libcrypto not found])
80 PDNS_CHECK_LIBCRYPTO_ECDSA
81 PDNS_CHECK_LIBCRYPTO_EDDSA
88 # check for tools we might need
89 PDNS_CHECK_RAGEL([pdns/dnslabeltext.cc], [www.powerdns.com])
92 AC_CHECK_FUNCS_ONCE([strcasestr getrandom arc4random])
98 AC_ARG_WITH([socketdir],
99 [AS_HELP_STRING([--with-socketdir], [where the controlsocket lives @<:@default=/var/run@:>@])],
100 [socketdir="$withval"]
105 AM_COND_IF([NOD_ENABLED],
108 AS_IF([test -z "$BOOST_FILESYSTEM_LIBS"], [ AC_MSG_ERROR([Boost filesystem library is not installed])])],
111 AC_SUBST([nodcachedir])
112 nodcachedir='${localstatedir}/lib/pdns-recursor'
113 AC_ARG_WITH([nod-cache-dir],
114 [AS_HELP_STRING([--with-nodcachedir], [where newly observed domain cache files live @<:@default=LOCALSTATEDIR/lib/pdns-recursor@:>@])],
115 [nodcachedir="$withval"]
120 AC_MSG_CHECKING([whether we will enable compiler security checks])
121 AC_ARG_ENABLE([hardening],
122 [AS_HELP_STRING([--disable-hardening], [disable compiler security checks @<:@default=no@:>@])],
123 [enable_hardening=$enableval],
124 [enable_hardening=yes]
126 AC_MSG_RESULT([$enable_hardening])
128 AS_IF([test "x$enable_hardening" != "xno"], [
130 AC_CC_STACK_PROTECTOR
131 AC_CC_PARAM_SSP_BUFFER_SIZE([4])
132 AC_CC_D_FORTIFY_SOURCE
136 PDNS_ENABLE_SANITIZERS
137 PDNS_ENABLE_MALLOC_TRACE
140 AX_CHECK_SYSTEMD_FEATURES
141 AM_CONDITIONAL([HAVE_SYSTEMD], [ test x"$systemd" = "xy" ])
142 PDNS_WITH_SERVICE_USER([pdns-recursor])
143 PDNS_CHECK_VIRTUALENV
147 AC_SUBST([AM_CPPFLAGS],
148 ["AS_ESCAPE([-I$(top_builddir) -I$(top_srcdir)]) $THREADFLAGS $BOOST_CPPFLAGS"]
151 AC_SUBST([YAHTTP_CFLAGS], ['-I$(top_srcdir)/ext/yahttp'])
152 AC_SUBST([YAHTTP_LIBS], ['$(top_builddir)/ext/yahttp/yahttp/libyahttp.la'])
154 LDFLAGS="$RELRO_LDFLAGS $LDFLAGS"
155 CFLAGS="$PIE_CFLAGS $CFLAGS"
156 CXXFLAGS="$SANITIZER_FLAGS $PIE_CFLAGS $CXXFLAGS"
157 PROGRAM_LDFLAGS="$PIE_LDFLAGS $PROGRAM_LDFLAGS"
158 AC_SUBST([PROGRAM_LDFLAGS])
160 AC_CONFIG_FILES([Makefile
165 ext/yahttp/yahttp/Makefile])
170 AC_MSG_NOTICE([Configuration summary])
171 AC_MSG_NOTICE([=====================])
173 AS_IF([test "x$pdns_configure_args" != "x"],
174 [summary_conf_opts=$pdns_configure_args],
175 [summary_conf_opts="(no options)"]
177 AC_MSG_NOTICE([PowerDNS Recursor configured with: $summary_conf_opts])
179 AC_MSG_NOTICE([CC: $CC])
180 AC_MSG_NOTICE([CXX: $CXX])
181 AC_MSG_NOTICE([LD: $LD])
182 AC_MSG_NOTICE([CFLAGS: $CFLAGS])
183 AC_MSG_NOTICE([CPPFLAGS: $CPPFLAGS])
184 AC_MSG_NOTICE([CXXFLAGS: $CXXFLAGS])
185 AC_MSG_NOTICE([LDFLAGS: $LDFLAGS])
186 AC_MSG_NOTICE([LIBS: $LIBS])
187 AC_MSG_NOTICE([BOOST_CPPFLAGS: $BOOST_CPPFLAGS])
189 AC_MSG_NOTICE([Features enabled])
190 AC_MSG_NOTICE([----------------])
191 AC_MSG_NOTICE([Lua: $LUAPC])
192 AC_MSG_NOTICE([OpenSSL ECDSA: $libcrypto_ecdsa])
193 AS_IF([test "x$LIBSODIUM_LIBS" != "x" || test "x$LIBDECAF_LIBS" != "x" || test "x$libcrypto_ed25519" = "xyes"],
194 [AC_MSG_NOTICE([ed25519: yes])],
195 [AC_MSG_NOTICE([ed25519: no])]
197 AS_IF([test "x$LIBDECAF_LIBS" != "x" || test "x$libcrypto_ed448" = "xyes"],
198 [AC_MSG_NOTICE([ed448: yes])],
199 [AC_MSG_NOTICE([ed448: no])]
201 AS_IF([test "x$PROTOBUF_LIBS" != "x" -a x"$PROTOC" != "x"],
202 [AC_MSG_NOTICE([Protobuf: yes])],
203 [AC_MSG_NOTICE([Protobuf: no])]
205 AS_IF([test "x$NET_SNMP_LIBS" != "x"],
206 [AC_MSG_NOTICE([SNMP: yes])],
207 [AC_MSG_NOTICE([SNMP: no])]
209 AS_IF([test "x$systemd" != "xn"],
210 [AC_MSG_NOTICE([systemd: yes])],
211 [AC_MSG_NOTICE([systemd: no])]
213 AM_COND_IF([NOD_ENABLED],
214 [AC_MSG_NOTICE([nod: yes])],
215 [AC_MSG_NOTICE([nod: no])]
218 [AC_MSG_NOTICE([dnstap: yes])],
219 [AC_MSG_NOTICE([dnstap: no])]
221 AC_MSG_NOTICE([Context library: $pdns_context_library])