]> git.ipfire.org Git - thirdparty/pdns.git/blob - pdns/recursordist/configure.ac
Merge pull request #7853 from Marlinc/dnsdist-prometheus-histogram
[thirdparty/pdns.git] / pdns / recursordist / configure.ac
1 AC_PREREQ([2.61])
2
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])
6 AM_SILENT_RULES([yes])
7 AC_CONFIG_SRCDIR([pdns_recursor.cc])
8 AC_CONFIG_MACRO_DIR([m4])
9
10 AC_CONFIG_HEADERS([config.h])
11
12 AC_CANONICAL_HOST
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"
16
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]
21 )
22
23 AC_PROG_CC
24 AC_PROG_CXX
25 AC_LANG([C++])
26
27 AC_GNU_SOURCE
28
29 AC_DEFINE([RECURSOR], [1],
30 [This is the PowerDNS Recursor]
31 )
32
33 # Warn when pkg.m4 is missing
34 m4_pattern_forbid([^_?PKG_[A-Z_]+$], [*** pkg.m4 missing, please install pkg-config])
35
36 AX_CXX_COMPILE_STDCXX_11([ext], [mandatory])
37 AC_PROG_LIBTOOL
38
39 PDNS_CHECK_OS
40 PDNS_CHECK_NETWORK_LIBS
41 PTHREAD_SET_NAME
42
43 # Boost Context was introduced in 1.51 (Aug 2012), but there was an immediate
44 # API break in 1.52 (Nov 2012), so we only support that, and later.
45 pdns_context_library="System V ucontexts"
46
47 AC_DEFUN([PDNS_SELECT_CONTEXT_IMPL], [
48 AC_MSG_CHECKING([whether Boost is new enough to use the context library...])
49 if test $boost_major_version -ge 152; then
50 AC_MSG_RESULT([yes])
51 if test $boost_major_version -ge 157; then
52 BOOST_THREAD([$1])
53 m4_pattern_allow([^BOOST_THREAD_(LIBS|LDFLAGS)$])dnl
54 LIBS="$LIBS $BOOST_THREAD_LIBS"
55 LDFLAGS="$LDFLAGS $BOOST_THREAD_LDFLAGS"
56 fi
57 AC_MSG_NOTICE([checking whether the Boost context library actually links...])
58 if test $boost_major_version -ge 161; then
59 BOOST_FIND_HEADER([boost/context/detail/fcontext.hpp], [ : ], [
60 BOOST_FIND_LIB([context], [$1], [boost/context/detail/fcontext.hpp], [[]])
61 ])
62 else
63 BOOST_FIND_HEADER([boost/context/fcontext.hpp], [ : ], [
64 BOOST_FIND_LIB([context], [$1], [boost/context/fcontext.hpp], [[]])
65 ])
66 fi
67 case $boost_cv_lib_context in
68 (yes)
69 pdns_context_library="Boost context"
70 AC_MSG_NOTICE([MTasker will use the Boost context library for context switching])
71 ;;
72 *)
73 AC_MSG_NOTICE([Boost context library is missing])
74 AC_MSG_NOTICE([MTasker will use System V ucontexts for context switching])
75 ;;
76 esac
77 else
78 AC_MSG_RESULT([no])
79 AC_MSG_NOTICE([MTasker will use System V ucontexts for context switching])
80 fi
81 ])
82
83 PDNS_CHECK_CLOCK_GETTIME
84
85 PDNS_WITH_PROTOBUF
86
87 BOOST_REQUIRE([1.42])
88
89 # Check against flat_set header that requires boost >= 1.48
90 BOOST_FIND_HEADER([boost/container/flat_set.hpp], [AC_MSG_NOTICE([boost::container::flat_set not available, will fallback to std::set])])
91
92 PDNS_SELECT_CONTEXT_IMPL
93
94 PDNS_ENABLE_UNIT_TESTS
95 PDNS_ENABLE_REPRODUCIBLE
96
97 PDNS_WITH_LUA([mandatory])
98 AS_IF([test "x$LUAPC" = "xluajit"], [
99 # export all symbols to be able to use the Lua FFI interface
100 AC_MSG_NOTICE([Adding -rdynamic to export all symbols for the Lua FFI interface])
101 LDFLAGS="$LDFLAGS -rdynamic"
102 ])
103
104 PDNS_CHECK_LUA_HPP
105
106 PDNS_ENABLE_VERBOSE_LOGGING
107
108 # Crypto libraries
109 PDNS_CHECK_LIBCRYPTO([
110 ],[
111 AC_MSG_ERROR([OpenSSL/libcrypto not found])
112 ]
113 )
114 PDNS_CHECK_LIBCRYPTO_ECDSA
115 PDNS_CHECK_LIBCRYPTO_EDDSA
116 PDNS_WITH_LIBSODIUM
117 PDNS_WITH_LIBDECAF
118 PDNS_WITH_LIBCAP
119
120 PDNS_WITH_NET_SNMP
121
122 # check for tools we might need
123 PDNS_CHECK_RAGEL([pdns/dnslabeltext.cc], [www.powerdns.com])
124 PDNS_CHECK_CURL
125
126 AC_CHECK_FUNCS_ONCE([strcasestr getrandom arc4random])
127
128 PDNS_CHECK_PTHREAD_NP
129
130 AC_SUBST([socketdir])
131 socketdir="/var/run"
132 AC_ARG_WITH([socketdir],
133 [AS_HELP_STRING([--with-socketdir], [where the controlsocket lives @<:@default=/var/run@:>@])],
134 [socketdir="$withval"]
135 )
136
137 PDNS_ENABLE_NOD
138
139 AM_COND_IF([NOD_ENABLED],
140 [
141 BOOST_FILESYSTEM
142 AS_IF([test -z "$BOOST_FILESYSTEM_LIBS"], [ AC_MSG_ERROR([Boost filesystem library is not installed])])],
143 [])
144
145 AC_SUBST([nodcachedir])
146 nodcachedir='${localstatedir}/lib/pdns-recursor'
147 AC_ARG_WITH([nod-cache-dir],
148 [AS_HELP_STRING([--with-nodcachedir], [where newly observed domain cache files live @<:@default=LOCALSTATEDIR/lib/pdns-recursor@:>@])],
149 [nodcachedir="$withval"]
150 )
151
152 PDNS_CHECK_DNSTAP
153
154 AC_MSG_CHECKING([whether we will enable compiler security checks])
155 AC_ARG_ENABLE([hardening],
156 [AS_HELP_STRING([--disable-hardening], [disable compiler security checks @<:@default=no@:>@])],
157 [enable_hardening=$enableval],
158 [enable_hardening=yes]
159 )
160 AC_MSG_RESULT([$enable_hardening])
161
162 AS_IF([test "x$enable_hardening" != "xno"], [
163 AC_CC_PIE
164 AC_CC_STACK_PROTECTOR
165 AC_CC_PARAM_SSP_BUFFER_SIZE([4])
166 AC_CC_D_FORTIFY_SOURCE
167 AC_LD_RELRO
168 ])
169
170 PDNS_ENABLE_SANITIZERS
171 PDNS_ENABLE_MALLOC_TRACE
172 PDNS_ENABLE_VALGRIND
173 AX_AVAILABLE_SYSTEMD
174 AX_CHECK_SYSTEMD_FEATURES
175 AM_CONDITIONAL([HAVE_SYSTEMD], [ test x"$systemd" = "xy" ])
176 PDNS_CHECK_VIRTUALENV
177
178 AC_SUBST(LIBS)
179
180 AC_SUBST([AM_CPPFLAGS],
181 ["AS_ESCAPE([-I$(top_builddir) -I$(top_srcdir)]) $THREADFLAGS $BOOST_CPPFLAGS"]
182 )
183
184 AC_SUBST([YAHTTP_CFLAGS], ['-I$(top_srcdir)/ext/yahttp'])
185 AC_SUBST([YAHTTP_LIBS], ['$(top_builddir)/ext/yahttp/yahttp/libyahttp.la'])
186
187 LDFLAGS="$RELRO_LDFLAGS $LDFLAGS"
188 CFLAGS="$PIE_CFLAGS $CFLAGS"
189 CXXFLAGS="$SANITIZER_FLAGS $PIE_CFLAGS $CXXFLAGS"
190 PROGRAM_LDFLAGS="$PIE_LDFLAGS $PROGRAM_LDFLAGS"
191 AC_SUBST([PROGRAM_LDFLAGS])
192
193 AC_CONFIG_FILES([Makefile
194 ext/Makefile
195 ext/json11/Makefile
196 ext/probds/Makefile
197 ext/yahttp/Makefile
198 ext/yahttp/yahttp/Makefile])
199
200 AC_OUTPUT
201
202 AC_MSG_NOTICE([])
203 AC_MSG_NOTICE([Configuration summary])
204 AC_MSG_NOTICE([=====================])
205 AC_MSG_NOTICE([])
206 AS_IF([test "x$pdns_configure_args" != "x"],
207 [summary_conf_opts=$pdns_configure_args],
208 [summary_conf_opts="(no options)"]
209 )
210 AC_MSG_NOTICE([PowerDNS Recursor configured with: $summary_conf_opts])
211 AC_MSG_NOTICE([])
212 AC_MSG_NOTICE([CC: $CC])
213 AC_MSG_NOTICE([CXX: $CXX])
214 AC_MSG_NOTICE([LD: $LD])
215 AC_MSG_NOTICE([CFLAGS: $CFLAGS])
216 AC_MSG_NOTICE([CPPFLAGS: $CPPFLAGS])
217 AC_MSG_NOTICE([CXXFLAGS: $CXXFLAGS])
218 AC_MSG_NOTICE([LDFLAGS: $LDFLAGS])
219 AC_MSG_NOTICE([LIBS: $LIBS])
220 AC_MSG_NOTICE([BOOST_CPPFLAGS: $BOOST_CPPFLAGS])
221 AC_MSG_NOTICE([])
222 AC_MSG_NOTICE([Features enabled])
223 AC_MSG_NOTICE([----------------])
224 AC_MSG_NOTICE([Lua: $LUAPC])
225 AC_MSG_NOTICE([OpenSSL ECDSA: $libcrypto_ecdsa])
226 AS_IF([test "x$LIBSODIUM_LIBS" != "x" || test "x$LIBDECAF_LIBS" != "x" || test "x$libcrypto_ed25519" = "xyes"],
227 [AC_MSG_NOTICE([ed25519: yes])],
228 [AC_MSG_NOTICE([ed25519: no])]
229 )
230 AS_IF([test "x$LIBDECAF_LIBS" != "x" || test "x$libcrypto_ed448" = "xyes"],
231 [AC_MSG_NOTICE([ed448: yes])],
232 [AC_MSG_NOTICE([ed448: no])]
233 )
234 AS_IF([test "x$PROTOBUF_LIBS" != "x" -a x"$PROTOC" != "x"],
235 [AC_MSG_NOTICE([Protobuf: yes])],
236 [AC_MSG_NOTICE([Protobuf: no])]
237 )
238 AS_IF([test "x$NET_SNMP_LIBS" != "x"],
239 [AC_MSG_NOTICE([SNMP: yes])],
240 [AC_MSG_NOTICE([SNMP: no])]
241 )
242 AS_IF([test "x$systemd" != "xn"],
243 [AC_MSG_NOTICE([systemd: yes])],
244 [AC_MSG_NOTICE([systemd: no])]
245 )
246 AM_COND_IF([NOD_ENABLED],
247 [AC_MSG_NOTICE([nod: yes])],
248 [AC_MSG_NOTICE([nod: no])]
249 )
250 AM_COND_IF([FSTRM],
251 [AC_MSG_NOTICE([dnstap: yes])],
252 [AC_MSG_NOTICE([dnstap: no])]
253 )
254 AC_MSG_NOTICE([Context library: $pdns_context_library])
255 AC_MSG_NOTICE([])