]> git.ipfire.org Git - thirdparty/pdns.git/blame - pdns/recursordist/configure.ac
Search -lresolv (if applicable) the proper auto* way
[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
0e107ef6 46AC_SEARCH_LIBS([res_query], [resolv])
4f0abcdc
OM
47# macOS uses an alternative name internally
48AC_SEARCH_LIBS([res_9_query], [resolv])
519f5484 49PTHREAD_SET_NAME
60c8f3f5 50AC_FUNC_STRERROR_R
0c6f6275 51
85c7ca75
PD
52PDNS_CHECK_CLOCK_GETTIME
53
431f0584 54BOOST_REQUIRE([1.42])
f097141b
CHB
55
56# Check against flat_set header that requires boost >= 1.48
a0b04353 57BOOST_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 61pdns_context_library=""
4c75f029 62AS_IF([test $boost_major_version -ge 152], [BOOST_CONTEXT([], [no])])
4719e12a
OM
63AS_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 68AC_MSG_CHECKING([what context library to use for MTasker])
4719e12a 69AS_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 71PDNS_ENABLE_UNIT_TESTS
0c6f6275 72PDNS_ENABLE_REPRODUCIBLE
a985c6a7 73PDNS_ENABLE_COVERAGE
0c6f6275 74
026090e8 75PDNS_WITH_LUA([mandatory])
7e03f04c
RG
76AS_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 82PDNS_CHECK_LUA_HPP
0c6f6275
PL
83
84PDNS_ENABLE_VERBOSE_LOGGING
85
86# Crypto libraries
74d83458 87PDNS_CHECK_LIBCRYPTO([
df85a9a0 88],[
74d83458
PL
89 AC_MSG_ERROR([OpenSSL/libcrypto not found])
90 ]
91)
92PDNS_CHECK_LIBCRYPTO_ECDSA
f4bd644d 93PDNS_CHECK_LIBCRYPTO_EDDSA
cb264691 94PDNS_WITH_LIBSODIUM
ee89ca58 95PDNS_WITH_LIBDECAF
1f2b341e 96PDNS_WITH_LIBCAP
841128ba 97PDNS_CHECK_LIBCURL
0c6f6275 98
d705aad9
RG
99PDNS_WITH_NET_SNMP
100
832aca33
O
101# not runtime selectable at the moment
102#AM_CONDITIONAL([HAVE_GNUTLS], [false])
66242d00
O
103AM_CONDITIONAL([HAVE_LIBSSL], [false])
104
105PDNS_ENABLE_DNS_OVER_TLS
106
107AS_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 118PDNS_CHECK_RAGEL([pdns/dnslabeltext.cc], [www.powerdns.com])
0c6f6275
PL
119PDNS_CHECK_CURL
120
290995c1
OM
121dnl the *_r functions are in posix so we can use them unconditionally, but the ext/yahttp code is
122dnl using the defines.
a0d8a0f0 123AC_CHECK_FUNCS_ONCE([localtime_r gmtime_r strcasestr])
5818e955 124AC_CHECK_FUNCS_ONCE([getrandom getentropy arc4random arc4random_uniform arc4random_buf])
0e107ef6 125
5818e955 126PDNS_CHECK_SECURE_MEMSET
0c6f6275 127
e42c94a8 128AC_CHECK_HEADERS([sys/random.h])
f87175b0 129
8fd25133
RG
130PDNS_CHECK_PTHREAD_NP
131
8c8b9197 132AC_SUBST([socketdir])
0c6f6275
PL
133socketdir="/var/run"
134AC_ARG_WITH([socketdir],
8c8b9197 135 [AS_HELP_STRING([--with-socketdir], [where the controlsocket lives @<:@default=/var/run@:>@])],
0c6f6275
PL
136 [socketdir="$withval"]
137)
138
af1377b7
NC
139PDNS_ENABLE_NOD
140
141AC_SUBST([nodcachedir])
bc39363f 142nodcachedir='${localstatedir}/lib/pdns-recursor'
af1377b7 143AC_ARG_WITH([nod-cache-dir],
bc39363f 144 [AS_HELP_STRING([--with-nodcachedir], [where newly observed domain cache files live @<:@default=LOCALSTATEDIR/lib/pdns-recursor@:>@])],
af1377b7
NC
145 [nodcachedir="$withval"]
146)
147
e593a398 148PDNS_CHECK_DNSTAP([auto])
7badc366 149
0c6f6275
PL
150AC_MSG_CHECKING([whether we will enable compiler security checks])
151AC_ARG_ENABLE([hardening],
8c8b9197 152 [AS_HELP_STRING([--disable-hardening], [disable compiler security checks @<:@default=no@:>@])],
0c6f6275
PL
153 [enable_hardening=$enableval],
154 [enable_hardening=yes]
155)
156AC_MSG_RESULT([$enable_hardening])
157
158AS_IF([test "x$enable_hardening" != "xno"], [
159 AC_CC_PIE
160 AC_CC_STACK_PROTECTOR
161 AC_CC_PARAM_SSP_BUFFER_SIZE([4])
162 AC_CC_D_FORTIFY_SOURCE
163 AC_LD_RELRO
164])
165
4f583460 166PDNS_INIT_AUTO_VARS
0c6f6275 167PDNS_ENABLE_SANITIZERS
1519d792 168PDNS_ENABLE_LTO
0c6f6275 169PDNS_ENABLE_MALLOC_TRACE
ec7fcc43 170PDNS_ENABLE_VALGRIND
1519d792 171
6b6720de 172AX_AVAILABLE_SYSTEMD
a3dfb540 173AX_CHECK_SYSTEMD_FEATURES
6b6720de 174AM_CONDITIONAL([HAVE_SYSTEMD], [ test x"$systemd" = "xy" ])
7e6d27b7 175PDNS_WITH_SERVICE_USER([pdns-recursor])
98508251
KF
176
177PDNS_CHECK_PYTHON_VENV
178
179AM_CONDITIONAL([HAVE_MANPAGES], [test -e "$srcdir/pdns_recursor.1"])
180AM_COND_IF([HAVE_MANPAGES],[],[
181 AM_COND_IF([HAVE_VENV],[],[
182 AC_MSG_WARN([Python 3 and/or venv module are not available, documentation will not be built.])
183 ])
184])
0c6f6275
PL
185
186AC_SUBST(LIBS)
187
188AC_SUBST([AM_CPPFLAGS],
189 ["AS_ESCAPE([-I$(top_builddir) -I$(top_srcdir)]) $THREADFLAGS $BOOST_CPPFLAGS"]
190)
191
192AC_SUBST([YAHTTP_CFLAGS], ['-I$(top_srcdir)/ext/yahttp'])
23448838 193AC_SUBST([YAHTTP_LIBS], ['$(top_builddir)/ext/yahttp/yahttp/libyahttp.la'])
0c6f6275 194
0c6f6275 195LDFLAGS="$RELRO_LDFLAGS $LDFLAGS"
29cc80e5 196CFLAGS="$SANITIZER_FLAGS $PIE_CFLAGS $CFLAGS"
5e4a410d
RG
197CXXFLAGS="$SANITIZER_FLAGS $PIE_CFLAGS $CXXFLAGS"
198PROGRAM_LDFLAGS="$PIE_LDFLAGS $PROGRAM_LDFLAGS"
199AC_SUBST([PROGRAM_LDFLAGS])
0c6f6275 200
637594fb
FM
201CCVERSION=`$CC --version | head -1`
202CXXVERSION=`$CXX --version | head -1`
203
0c6f6275
PL
204AC_CONFIG_FILES([Makefile
205 ext/Makefile
a0d8a0f0 206 ext/arc4random/Makefile
0c6f6275 207 ext/json11/Makefile
af1377b7 208 ext/probds/Makefile
0c6f6275 209 ext/yahttp/Makefile
9883d3f9
OM
210 ext/yahttp/yahttp/Makefile
211 settings/Makefile
212 settings/rust/Makefile])
0c6f6275
PL
213
214AC_OUTPUT
231da4c6
PL
215
216AC_MSG_NOTICE([])
217AC_MSG_NOTICE([Configuration summary])
218AC_MSG_NOTICE([=====================])
219AC_MSG_NOTICE([])
220AS_IF([test "x$pdns_configure_args" != "x"],
221 [summary_conf_opts=$pdns_configure_args],
222 [summary_conf_opts="(no options)"]
223)
ff6b244a 224AC_MSG_NOTICE([PowerDNS Recursor $VERSION configured with: $summary_conf_opts])
231da4c6 225AC_MSG_NOTICE([])
637594fb
FM
226AC_MSG_NOTICE([CC: $CC ($CCVERSION)])
227AC_MSG_NOTICE([CXX: $CXX ($CXXVERSION)])
231da4c6
PL
228AC_MSG_NOTICE([LD: $LD])
229AC_MSG_NOTICE([CFLAGS: $CFLAGS])
230AC_MSG_NOTICE([CPPFLAGS: $CPPFLAGS])
231AC_MSG_NOTICE([CXXFLAGS: $CXXFLAGS])
232AC_MSG_NOTICE([LDFLAGS: $LDFLAGS])
233AC_MSG_NOTICE([LIBS: $LIBS])
231da4c6
PL
234AC_MSG_NOTICE([BOOST_CPPFLAGS: $BOOST_CPPFLAGS])
235AC_MSG_NOTICE([])
dab358de
PL
236AC_MSG_NOTICE([Features enabled])
237AC_MSG_NOTICE([----------------])
026090e8 238AC_MSG_NOTICE([Lua: $LUAPC])
74d83458 239AC_MSG_NOTICE([OpenSSL ECDSA: $libcrypto_ecdsa])
f4bd644d
PL
240AS_IF([test "x$LIBSODIUM_LIBS" != "x" || test "x$LIBDECAF_LIBS" != "x" || test "x$libcrypto_ed25519" = "xyes"],
241 [AC_MSG_NOTICE([ed25519: yes])],
242 [AC_MSG_NOTICE([ed25519: no])]
a613e8b6 243)
f4bd644d
PL
244AS_IF([test "x$LIBDECAF_LIBS" != "x" || test "x$libcrypto_ed448" = "xyes"],
245 [AC_MSG_NOTICE([ed448: yes])],
246 [AC_MSG_NOTICE([ed448: no])]
21a8834a 247)
00b3e94a
RG
248
249AC_MSG_NOTICE([Protobuf: yes])
250
d705aad9
RG
251AS_IF([test "x$NET_SNMP_LIBS" != "x"],
252 [AC_MSG_NOTICE([SNMP: yes])],
253 [AC_MSG_NOTICE([SNMP: no])]
254)
dab358de
PL
255AS_IF([test "x$systemd" != "xn"],
256 [AC_MSG_NOTICE([systemd: yes])],
257 [AC_MSG_NOTICE([systemd: no])]
231da4c6 258)
81d510b1 259AM_COND_IF([NOD_ENABLED],
af1377b7
NC
260 [AC_MSG_NOTICE([nod: yes])],
261 [AC_MSG_NOTICE([nod: no])]
262)
ebd67986 263AM_COND_IF([FSTRM],
7badc366
OM
264 [AC_MSG_NOTICE([dnstap: yes])],
265 [AC_MSG_NOTICE([dnstap: no])]
266)
66242d00
O
267AS_IF([test "x$enable_dns_over_tls" != "xno"],
268 [AC_MSG_NOTICE([DNS over TLS: yes])],
269 [AC_MSG_NOTICE([DNS over TLS: no])]
270)
832aca33
O
271#AS_IF([test "x$enable_dns_over_tls" != "xno"], [
272# AS_IF([test "x$GNUTLS_LIBS" != "x"],
273# [AC_MSG_NOTICE([GnuTLS: yes])],
274# [AC_MSG_NOTICE([GnuTLS: no])]
275# )]
276#)
66242d00
O
277AS_IF([test "x$enable_dns_over_tls" != "xno"], [
278 AS_IF([test "x$LIBSSL_LIBS" != "x"],
279 [AC_MSG_NOTICE([OpenSSL: yes])],
280 [AC_MSG_NOTICE([OpenSSL: no])]
281 )]
282)
eaf9356d 283AS_IF([test "x$HAVE_LIBCURL" != "xn"],
841128ba
O
284 [AC_MSG_NOTICE([libcurl: yes])],
285 [AC_MSG_NOTICE([libcurl: no])]
286)
0079fda2 287AC_MSG_NOTICE([Context library: $pdns_context_library])
231da4c6 288AC_MSG_NOTICE([])