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