]> git.ipfire.org Git - thirdparty/pdns.git/blame - pdns/recursordist/configure.ac
rec: also look for __res_query symbol
[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
c3023433 46AC_SEARCH_LIBS([res_query], [resolv], [], [AC_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
OM
124AC_CHECK_FUNCS_ONCE([getrandom getentropy arc4random arc4random_uniform arc4random_buf])
125PDNS_CHECK_SECURE_MEMSET
0c6f6275 126
e42c94a8 127AC_CHECK_HEADERS([sys/random.h])
f87175b0 128
8fd25133
RG
129PDNS_CHECK_PTHREAD_NP
130
8c8b9197 131AC_SUBST([socketdir])
0c6f6275
PL
132socketdir="/var/run"
133AC_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
138PDNS_ENABLE_NOD
139
140AC_SUBST([nodcachedir])
bc39363f 141nodcachedir='${localstatedir}/lib/pdns-recursor'
af1377b7 142AC_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 147PDNS_CHECK_DNSTAP([auto])
7badc366 148
0c6f6275
PL
149AC_MSG_CHECKING([whether we will enable compiler security checks])
150AC_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)
155AC_MSG_RESULT([$enable_hardening])
156
157AS_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 165PDNS_INIT_AUTO_VARS
0c6f6275 166PDNS_ENABLE_SANITIZERS
1519d792 167PDNS_ENABLE_LTO
0c6f6275 168PDNS_ENABLE_MALLOC_TRACE
ec7fcc43 169PDNS_ENABLE_VALGRIND
1519d792 170
6b6720de 171AX_AVAILABLE_SYSTEMD
a3dfb540 172AX_CHECK_SYSTEMD_FEATURES
6b6720de 173AM_CONDITIONAL([HAVE_SYSTEMD], [ test x"$systemd" = "xy" ])
7e6d27b7 174PDNS_WITH_SERVICE_USER([pdns-recursor])
98508251
KF
175
176PDNS_CHECK_PYTHON_VENV
177
178AM_CONDITIONAL([HAVE_MANPAGES], [test -e "$srcdir/pdns_recursor.1"])
179AM_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
185AC_SUBST(LIBS)
186
187AC_SUBST([AM_CPPFLAGS],
188 ["AS_ESCAPE([-I$(top_builddir) -I$(top_srcdir)]) $THREADFLAGS $BOOST_CPPFLAGS"]
189)
190
191AC_SUBST([YAHTTP_CFLAGS], ['-I$(top_srcdir)/ext/yahttp'])
23448838 192AC_SUBST([YAHTTP_LIBS], ['$(top_builddir)/ext/yahttp/yahttp/libyahttp.la'])
0c6f6275 193
0c6f6275 194LDFLAGS="$RELRO_LDFLAGS $LDFLAGS"
29cc80e5 195CFLAGS="$SANITIZER_FLAGS $PIE_CFLAGS $CFLAGS"
5e4a410d
RG
196CXXFLAGS="$SANITIZER_FLAGS $PIE_CFLAGS $CXXFLAGS"
197PROGRAM_LDFLAGS="$PIE_LDFLAGS $PROGRAM_LDFLAGS"
198AC_SUBST([PROGRAM_LDFLAGS])
0c6f6275 199
637594fb
FM
200CCVERSION=`$CC --version | head -1`
201CXXVERSION=`$CXX --version | head -1`
202
0c6f6275
PL
203AC_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
213AC_OUTPUT
231da4c6
PL
214
215AC_MSG_NOTICE([])
216AC_MSG_NOTICE([Configuration summary])
217AC_MSG_NOTICE([=====================])
218AC_MSG_NOTICE([])
219AS_IF([test "x$pdns_configure_args" != "x"],
220 [summary_conf_opts=$pdns_configure_args],
221 [summary_conf_opts="(no options)"]
222)
ff6b244a 223AC_MSG_NOTICE([PowerDNS Recursor $VERSION configured with: $summary_conf_opts])
231da4c6 224AC_MSG_NOTICE([])
637594fb
FM
225AC_MSG_NOTICE([CC: $CC ($CCVERSION)])
226AC_MSG_NOTICE([CXX: $CXX ($CXXVERSION)])
231da4c6
PL
227AC_MSG_NOTICE([LD: $LD])
228AC_MSG_NOTICE([CFLAGS: $CFLAGS])
229AC_MSG_NOTICE([CPPFLAGS: $CPPFLAGS])
230AC_MSG_NOTICE([CXXFLAGS: $CXXFLAGS])
231AC_MSG_NOTICE([LDFLAGS: $LDFLAGS])
232AC_MSG_NOTICE([LIBS: $LIBS])
231da4c6
PL
233AC_MSG_NOTICE([BOOST_CPPFLAGS: $BOOST_CPPFLAGS])
234AC_MSG_NOTICE([])
dab358de
PL
235AC_MSG_NOTICE([Features enabled])
236AC_MSG_NOTICE([----------------])
026090e8 237AC_MSG_NOTICE([Lua: $LUAPC])
74d83458 238AC_MSG_NOTICE([OpenSSL ECDSA: $libcrypto_ecdsa])
f4bd644d
PL
239AS_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
243AS_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
248AC_MSG_NOTICE([Protobuf: yes])
249
d705aad9
RG
250AS_IF([test "x$NET_SNMP_LIBS" != "x"],
251 [AC_MSG_NOTICE([SNMP: yes])],
252 [AC_MSG_NOTICE([SNMP: no])]
253)
dab358de
PL
254AS_IF([test "x$systemd" != "xn"],
255 [AC_MSG_NOTICE([systemd: yes])],
256 [AC_MSG_NOTICE([systemd: no])]
231da4c6 257)
81d510b1 258AM_COND_IF([NOD_ENABLED],
af1377b7
NC
259 [AC_MSG_NOTICE([nod: yes])],
260 [AC_MSG_NOTICE([nod: no])]
261)
ebd67986 262AM_COND_IF([FSTRM],
7badc366
OM
263 [AC_MSG_NOTICE([dnstap: yes])],
264 [AC_MSG_NOTICE([dnstap: no])]
265)
66242d00
O
266AS_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
276AS_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 282AS_IF([test "x$HAVE_LIBCURL" != "xn"],
841128ba
O
283 [AC_MSG_NOTICE([libcurl: yes])],
284 [AC_MSG_NOTICE([libcurl: no])]
285)
0079fda2 286AC_MSG_NOTICE([Context library: $pdns_context_library])
231da4c6 287AC_MSG_NOTICE([])