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