]>
Commit | Line | Data |
---|---|---|
691c80fb | 1 | AC_PREREQ([2.69]) |
49ffe59e | 2 | |
831525d2 | 3 | AC_INIT([pdns-recursor], m4_esyscmd(build-aux/gen-version)) |
0c6f6275 PL |
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]) | |
6 | AM_SILENT_RULES([yes]) | |
7 | AC_CONFIG_SRCDIR([pdns_recursor.cc]) | |
8 | AC_CONFIG_MACRO_DIR([m4]) | |
9 | ||
691c80fb | 10 | AC_USE_SYSTEM_EXTENSIONS |
0c6f6275 PL |
11 | AC_CONFIG_HEADERS([config.h]) |
12 | ||
13 | AC_CANONICAL_HOST | |
d44335b4 | 14 | # Add some default CFLAGS and CXXFLAGS, can be appended to using the environment variables |
0936b170 FM |
15 | CFLAGS="-Wall -Wextra -Wshadow -Wmissing-declarations -Wredundant-decls -fvisibility=hidden -g -O2 $CFLAGS" |
16 | CXXFLAGS="-Wall -Wextra -Wshadow -Wmissing-declarations -Wredundant-decls -fvisibility=hidden -g -O2 $CXXFLAGS" | |
0c6f6275 PL |
17 | |
18 | AC_SUBST([pdns_configure_args],["$ac_configure_args"]) | |
19 | AC_DEFINE_UNQUOTED([PDNS_CONFIG_ARGS], | |
20 | ["$pdns_configure_args"], | |
21 | [pdns-recursor configure arguments] | |
22 | ) | |
23 | ||
24 | AC_PROG_CC | |
25 | AC_PROG_CXX | |
26 | AC_LANG([C++]) | |
27 | ||
12e06ae7 | 28 | PDNS_CHECK_TIME_T |
fc891038 | 29 | |
acbfb1c1 PL |
30 | AC_DEFINE([RECURSOR], [1], |
31 | [This is the PowerDNS Recursor] | |
32 | ) | |
33 | ||
0c6f6275 | 34 | # Warn when pkg.m4 is missing |
8c8b9197 | 35 | m4_pattern_forbid([^_?PKG_[A-Z_]+$], [*** pkg.m4 missing, please install pkg-config]) |
0c6f6275 | 36 | |
dd742383 | 37 | AX_CXX_COMPILE_STDCXX_17([noext], [mandatory]) |
9bd78ce8 | 38 | PDNS_CHECK_CARGO([1.64]) |
9883d3f9 OM |
39 | |
40 | # Rust runtime used dlopen from its static lib | |
41 | LT_INIT([dlopen]) | |
42 | AC_SUBST([LIBDL], [$lt_cv_dlopen_libs]) | |
0c6f6275 PL |
43 | |
44 | PDNS_CHECK_OS | |
e10b6528 | 45 | PDNS_CHECK_NETWORK_LIBS |
0e107ef6 | 46 | AC_SEARCH_LIBS([res_query], [resolv]) |
4f0abcdc OM |
47 | # macOS uses an alternative name internally |
48 | AC_SEARCH_LIBS([res_9_query], [resolv]) | |
519f5484 | 49 | PTHREAD_SET_NAME |
60c8f3f5 | 50 | AC_FUNC_STRERROR_R |
0c6f6275 | 51 | |
85c7ca75 PD |
52 | PDNS_CHECK_CLOCK_GETTIME |
53 | ||
431f0584 | 54 | BOOST_REQUIRE([1.42]) |
f097141b CHB |
55 | |
56 | # Check against flat_set header that requires boost >= 1.48 | |
a0b04353 | 57 | BOOST_FIND_HEADER([boost/container/flat_set.hpp], [AC_MSG_NOTICE([boost::container::flat_set not available, will fallback to std::set])]) |
f097141b | 58 | |
4c75f029 PL |
59 | # Boost Context was introduced in 1.51 (Aug 2012), but there was an immediate |
60 | # API break in 1.52 (Nov 2012), so we only support that, and later. | |
4719e12a | 61 | pdns_context_library="" |
4c75f029 | 62 | AS_IF([test $boost_major_version -ge 152], [BOOST_CONTEXT([], [no])]) |
4719e12a OM |
63 | AS_IF([test x"$boost_cv_lib_context" = "xyes"], [ |
64 | pdns_context_library="Boost Context" | |
65 | ], [ | |
66 | AC_CHECK_FUNCS([getcontext makecontext swapcontext], [pdns_context_library="System V ucontexts"]) | |
67 | ]) | |
4c75f029 | 68 | AC_MSG_CHECKING([what context library to use for MTasker]) |
4719e12a | 69 | AS_IF([test -n "$pdns_context_library"], [AC_MSG_RESULT([$pdns_context_library])], [AC_MSG_ERROR([neither boost::context nor System V ucontexts available])]) |
7158b2f5 | 70 | |
35d883a8 | 71 | PDNS_ENABLE_UNIT_TESTS |
0c6f6275 | 72 | PDNS_ENABLE_REPRODUCIBLE |
a985c6a7 | 73 | PDNS_ENABLE_COVERAGE |
0c6f6275 | 74 | |
026090e8 | 75 | PDNS_WITH_LUA([mandatory]) |
7e03f04c RG |
76 | AS_IF([test "x$LUAPC" = "xluajit"], [ |
77 | # export all symbols to be able to use the Lua FFI interface | |
78 | AC_MSG_NOTICE([Adding -rdynamic to export all symbols for the Lua FFI interface]) | |
f1f50454 | 79 | LDFLAGS="$LDFLAGS -rdynamic" |
7e03f04c RG |
80 | ]) |
81 | ||
9a927586 | 82 | PDNS_CHECK_LUA_HPP |
0c6f6275 PL |
83 | |
84 | PDNS_ENABLE_VERBOSE_LOGGING | |
85 | ||
86 | # Crypto libraries | |
74d83458 | 87 | PDNS_CHECK_LIBCRYPTO([ |
df85a9a0 | 88 | ],[ |
74d83458 PL |
89 | AC_MSG_ERROR([OpenSSL/libcrypto not found]) |
90 | ] | |
91 | ) | |
92 | PDNS_CHECK_LIBCRYPTO_ECDSA | |
f4bd644d | 93 | PDNS_CHECK_LIBCRYPTO_EDDSA |
cb264691 | 94 | PDNS_WITH_LIBSODIUM |
ee89ca58 | 95 | PDNS_WITH_LIBDECAF |
1f2b341e | 96 | PDNS_WITH_LIBCAP |
841128ba | 97 | PDNS_CHECK_LIBCURL |
0c6f6275 | 98 | |
d705aad9 RG |
99 | PDNS_WITH_NET_SNMP |
100 | ||
832aca33 O |
101 | # not runtime selectable at the moment |
102 | #AM_CONDITIONAL([HAVE_GNUTLS], [false]) | |
66242d00 O |
103 | AM_CONDITIONAL([HAVE_LIBSSL], [false]) |
104 | ||
105 | PDNS_ENABLE_DNS_OVER_TLS | |
106 | ||
107 | AS_IF([test "x$enable_dns_over_tls" != "xno"], [ | |
108 | PDNS_WITH_LIBSSL | |
eaf9356d | 109 | # not runtime selectable at the moment |
60c8f3f5 | 110 | # PDNS_WITH_GNUTLS |
66242d00 | 111 | |
832aca33 O |
112 | AS_IF([test "x$HAVE_LIBSSL" != "x1"], [ |
113 | AC_MSG_ERROR([DNS over TLS support requested but no OpenSSL available]) | |
66242d00 O |
114 | ]) |
115 | ]) | |
116 | ||
0c6f6275 | 117 | # check for tools we might need |
29e13421 | 118 | PDNS_CHECK_RAGEL([pdns/dnslabeltext.cc], [www.powerdns.com]) |
0c6f6275 PL |
119 | PDNS_CHECK_CURL |
120 | ||
290995c1 OM |
121 | dnl the *_r functions are in posix so we can use them unconditionally, but the ext/yahttp code is |
122 | dnl using the defines. | |
a0d8a0f0 | 123 | AC_CHECK_FUNCS_ONCE([localtime_r gmtime_r strcasestr]) |
5818e955 OM |
124 | AC_CHECK_FUNCS_ONCE([getrandom getentropy arc4random arc4random_uniform arc4random_buf]) |
125 | PDNS_CHECK_SECURE_MEMSET | |
0c6f6275 | 126 | |
e42c94a8 | 127 | AC_CHECK_HEADERS([sys/random.h]) |
f87175b0 | 128 | |
8fd25133 RG |
129 | PDNS_CHECK_PTHREAD_NP |
130 | ||
8c8b9197 | 131 | AC_SUBST([socketdir]) |
0c6f6275 PL |
132 | socketdir="/var/run" |
133 | AC_ARG_WITH([socketdir], | |
8c8b9197 | 134 | [AS_HELP_STRING([--with-socketdir], [where the controlsocket lives @<:@default=/var/run@:>@])], |
0c6f6275 PL |
135 | [socketdir="$withval"] |
136 | ) | |
137 | ||
af1377b7 NC |
138 | PDNS_ENABLE_NOD |
139 | ||
140 | AC_SUBST([nodcachedir]) | |
bc39363f | 141 | nodcachedir='${localstatedir}/lib/pdns-recursor' |
af1377b7 | 142 | AC_ARG_WITH([nod-cache-dir], |
bc39363f | 143 | [AS_HELP_STRING([--with-nodcachedir], [where newly observed domain cache files live @<:@default=LOCALSTATEDIR/lib/pdns-recursor@:>@])], |
af1377b7 NC |
144 | [nodcachedir="$withval"] |
145 | ) | |
146 | ||
e593a398 | 147 | PDNS_CHECK_DNSTAP([auto]) |
7badc366 | 148 | |
0c6f6275 PL |
149 | AC_MSG_CHECKING([whether we will enable compiler security checks]) |
150 | AC_ARG_ENABLE([hardening], | |
8c8b9197 | 151 | [AS_HELP_STRING([--disable-hardening], [disable compiler security checks @<:@default=no@:>@])], |
0c6f6275 PL |
152 | [enable_hardening=$enableval], |
153 | [enable_hardening=yes] | |
154 | ) | |
155 | AC_MSG_RESULT([$enable_hardening]) | |
156 | ||
157 | AS_IF([test "x$enable_hardening" != "xno"], [ | |
158 | AC_CC_PIE | |
159 | AC_CC_STACK_PROTECTOR | |
160 | AC_CC_PARAM_SSP_BUFFER_SIZE([4]) | |
161 | AC_CC_D_FORTIFY_SOURCE | |
162 | AC_LD_RELRO | |
163 | ]) | |
164 | ||
4f583460 | 165 | PDNS_INIT_AUTO_VARS |
0c6f6275 | 166 | PDNS_ENABLE_SANITIZERS |
1519d792 | 167 | PDNS_ENABLE_LTO |
0c6f6275 | 168 | PDNS_ENABLE_MALLOC_TRACE |
ec7fcc43 | 169 | PDNS_ENABLE_VALGRIND |
1519d792 | 170 | |
6b6720de | 171 | AX_AVAILABLE_SYSTEMD |
a3dfb540 | 172 | AX_CHECK_SYSTEMD_FEATURES |
6b6720de | 173 | AM_CONDITIONAL([HAVE_SYSTEMD], [ test x"$systemd" = "xy" ]) |
7e6d27b7 | 174 | PDNS_WITH_SERVICE_USER([pdns-recursor]) |
98508251 KF |
175 | |
176 | PDNS_CHECK_PYTHON_VENV | |
177 | ||
178 | AM_CONDITIONAL([HAVE_MANPAGES], [test -e "$srcdir/pdns_recursor.1"]) | |
179 | AM_COND_IF([HAVE_MANPAGES],[],[ | |
180 | AM_COND_IF([HAVE_VENV],[],[ | |
181 | AC_MSG_WARN([Python 3 and/or venv module are not available, documentation will not be built.]) | |
182 | ]) | |
183 | ]) | |
0c6f6275 PL |
184 | |
185 | AC_SUBST(LIBS) | |
186 | ||
187 | AC_SUBST([AM_CPPFLAGS], | |
188 | ["AS_ESCAPE([-I$(top_builddir) -I$(top_srcdir)]) $THREADFLAGS $BOOST_CPPFLAGS"] | |
189 | ) | |
190 | ||
191 | AC_SUBST([YAHTTP_CFLAGS], ['-I$(top_srcdir)/ext/yahttp']) | |
23448838 | 192 | AC_SUBST([YAHTTP_LIBS], ['$(top_builddir)/ext/yahttp/yahttp/libyahttp.la']) |
0c6f6275 | 193 | |
0c6f6275 | 194 | LDFLAGS="$RELRO_LDFLAGS $LDFLAGS" |
29cc80e5 | 195 | CFLAGS="$SANITIZER_FLAGS $PIE_CFLAGS $CFLAGS" |
5e4a410d RG |
196 | CXXFLAGS="$SANITIZER_FLAGS $PIE_CFLAGS $CXXFLAGS" |
197 | PROGRAM_LDFLAGS="$PIE_LDFLAGS $PROGRAM_LDFLAGS" | |
198 | AC_SUBST([PROGRAM_LDFLAGS]) | |
0c6f6275 | 199 | |
637594fb FM |
200 | CCVERSION=`$CC --version | head -1` |
201 | CXXVERSION=`$CXX --version | head -1` | |
202 | ||
0c6f6275 PL |
203 | AC_CONFIG_FILES([Makefile |
204 | ext/Makefile | |
a0d8a0f0 | 205 | ext/arc4random/Makefile |
0c6f6275 | 206 | ext/json11/Makefile |
af1377b7 | 207 | ext/probds/Makefile |
0c6f6275 | 208 | ext/yahttp/Makefile |
9883d3f9 OM |
209 | ext/yahttp/yahttp/Makefile |
210 | settings/Makefile | |
211 | settings/rust/Makefile]) | |
0c6f6275 PL |
212 | |
213 | AC_OUTPUT | |
231da4c6 PL |
214 | |
215 | AC_MSG_NOTICE([]) | |
216 | AC_MSG_NOTICE([Configuration summary]) | |
217 | AC_MSG_NOTICE([=====================]) | |
218 | AC_MSG_NOTICE([]) | |
219 | AS_IF([test "x$pdns_configure_args" != "x"], | |
220 | [summary_conf_opts=$pdns_configure_args], | |
221 | [summary_conf_opts="(no options)"] | |
222 | ) | |
ff6b244a | 223 | AC_MSG_NOTICE([PowerDNS Recursor $VERSION configured with: $summary_conf_opts]) |
231da4c6 | 224 | AC_MSG_NOTICE([]) |
637594fb FM |
225 | AC_MSG_NOTICE([CC: $CC ($CCVERSION)]) |
226 | AC_MSG_NOTICE([CXX: $CXX ($CXXVERSION)]) | |
231da4c6 PL |
227 | AC_MSG_NOTICE([LD: $LD]) |
228 | AC_MSG_NOTICE([CFLAGS: $CFLAGS]) | |
229 | AC_MSG_NOTICE([CPPFLAGS: $CPPFLAGS]) | |
230 | AC_MSG_NOTICE([CXXFLAGS: $CXXFLAGS]) | |
231 | AC_MSG_NOTICE([LDFLAGS: $LDFLAGS]) | |
232 | AC_MSG_NOTICE([LIBS: $LIBS]) | |
231da4c6 PL |
233 | AC_MSG_NOTICE([BOOST_CPPFLAGS: $BOOST_CPPFLAGS]) |
234 | AC_MSG_NOTICE([]) | |
dab358de PL |
235 | AC_MSG_NOTICE([Features enabled]) |
236 | AC_MSG_NOTICE([----------------]) | |
026090e8 | 237 | AC_MSG_NOTICE([Lua: $LUAPC]) |
74d83458 | 238 | AC_MSG_NOTICE([OpenSSL ECDSA: $libcrypto_ecdsa]) |
f4bd644d PL |
239 | AS_IF([test "x$LIBSODIUM_LIBS" != "x" || test "x$LIBDECAF_LIBS" != "x" || test "x$libcrypto_ed25519" = "xyes"], |
240 | [AC_MSG_NOTICE([ed25519: yes])], | |
241 | [AC_MSG_NOTICE([ed25519: no])] | |
a613e8b6 | 242 | ) |
f4bd644d PL |
243 | AS_IF([test "x$LIBDECAF_LIBS" != "x" || test "x$libcrypto_ed448" = "xyes"], |
244 | [AC_MSG_NOTICE([ed448: yes])], | |
245 | [AC_MSG_NOTICE([ed448: no])] | |
21a8834a | 246 | ) |
00b3e94a RG |
247 | |
248 | AC_MSG_NOTICE([Protobuf: yes]) | |
249 | ||
d705aad9 RG |
250 | AS_IF([test "x$NET_SNMP_LIBS" != "x"], |
251 | [AC_MSG_NOTICE([SNMP: yes])], | |
252 | [AC_MSG_NOTICE([SNMP: no])] | |
253 | ) | |
dab358de PL |
254 | AS_IF([test "x$systemd" != "xn"], |
255 | [AC_MSG_NOTICE([systemd: yes])], | |
256 | [AC_MSG_NOTICE([systemd: no])] | |
231da4c6 | 257 | ) |
81d510b1 | 258 | AM_COND_IF([NOD_ENABLED], |
af1377b7 NC |
259 | [AC_MSG_NOTICE([nod: yes])], |
260 | [AC_MSG_NOTICE([nod: no])] | |
261 | ) | |
ebd67986 | 262 | AM_COND_IF([FSTRM], |
7badc366 OM |
263 | [AC_MSG_NOTICE([dnstap: yes])], |
264 | [AC_MSG_NOTICE([dnstap: no])] | |
265 | ) | |
66242d00 O |
266 | AS_IF([test "x$enable_dns_over_tls" != "xno"], |
267 | [AC_MSG_NOTICE([DNS over TLS: yes])], | |
268 | [AC_MSG_NOTICE([DNS over TLS: no])] | |
269 | ) | |
832aca33 O |
270 | #AS_IF([test "x$enable_dns_over_tls" != "xno"], [ |
271 | # AS_IF([test "x$GNUTLS_LIBS" != "x"], | |
272 | # [AC_MSG_NOTICE([GnuTLS: yes])], | |
273 | # [AC_MSG_NOTICE([GnuTLS: no])] | |
274 | # )] | |
275 | #) | |
66242d00 O |
276 | AS_IF([test "x$enable_dns_over_tls" != "xno"], [ |
277 | AS_IF([test "x$LIBSSL_LIBS" != "x"], | |
278 | [AC_MSG_NOTICE([OpenSSL: yes])], | |
279 | [AC_MSG_NOTICE([OpenSSL: no])] | |
280 | )] | |
281 | ) | |
eaf9356d | 282 | AS_IF([test "x$HAVE_LIBCURL" != "xn"], |
841128ba O |
283 | [AC_MSG_NOTICE([libcurl: yes])], |
284 | [AC_MSG_NOTICE([libcurl: no])] | |
285 | ) | |
0079fda2 | 286 | AC_MSG_NOTICE([Context library: $pdns_context_library]) |
231da4c6 | 287 | AC_MSG_NOTICE([]) |