]> git.ipfire.org Git - thirdparty/pdns.git/blob - pdns/recursordist/configure.ac
d3ceb2b2e72d22db7a639b66af3b30e813a0462c
[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='${prefix}/var/lib/pdns-recursor'
153 AC_ARG_WITH([nod-cache-dir],
154 [AS_HELP_STRING([--with-nodcachedir], [where newly observed domain cache files live @<:@default=PREFIX/var/lib/pdns-recursor@:>@])],
155 [nodcachedir="$withval"]
156 )
157
158 AC_MSG_CHECKING([whether we will enable compiler security checks])
159 AC_ARG_ENABLE([hardening],
160 [AS_HELP_STRING([--disable-hardening], [disable compiler security checks @<:@default=no@:>@])],
161 [enable_hardening=$enableval],
162 [enable_hardening=yes]
163 )
164 AC_MSG_RESULT([$enable_hardening])
165
166 AS_IF([test "x$enable_hardening" != "xno"], [
167 AC_CC_PIE
168 AC_CC_STACK_PROTECTOR
169 AC_CC_PARAM_SSP_BUFFER_SIZE([4])
170 AC_CC_D_FORTIFY_SOURCE
171 AC_LD_RELRO
172 ])
173
174 PDNS_ENABLE_SANITIZERS
175 PDNS_ENABLE_MALLOC_TRACE
176 PDNS_ENABLE_VALGRIND
177 AX_AVAILABLE_SYSTEMD
178 AM_CONDITIONAL([HAVE_SYSTEMD], [ test x"$systemd" = "xy" ])
179 PDNS_CHECK_VIRTUALENV
180
181 AC_SUBST(LIBS)
182
183 AC_SUBST([AM_CPPFLAGS],
184 ["AS_ESCAPE([-I$(top_builddir) -I$(top_srcdir)]) $THREADFLAGS $BOOST_CPPFLAGS"]
185 )
186
187 AC_SUBST([YAHTTP_CFLAGS], ['-I$(top_srcdir)/ext/yahttp'])
188 AC_SUBST([YAHTTP_LIBS], ['$(top_builddir)/ext/yahttp/yahttp/libyahttp.la'])
189
190 LDFLAGS="$RELRO_LDFLAGS $LDFLAGS"
191 CFLAGS="$PIE_CFLAGS $CFLAGS"
192 CXXFLAGS="$SANITIZER_FLAGS $PIE_CFLAGS $CXXFLAGS"
193 PROGRAM_LDFLAGS="$PIE_LDFLAGS $PROGRAM_LDFLAGS"
194 AC_SUBST([PROGRAM_LDFLAGS])
195
196 AC_CONFIG_FILES([Makefile
197 ext/Makefile
198 ext/json11/Makefile
199 ext/probds/Makefile
200 ext/yahttp/Makefile
201 ext/yahttp/yahttp/Makefile])
202
203 AC_OUTPUT
204
205 AC_MSG_NOTICE([])
206 AC_MSG_NOTICE([Configuration summary])
207 AC_MSG_NOTICE([=====================])
208 AC_MSG_NOTICE([])
209 AS_IF([test "x$pdns_configure_args" != "x"],
210 [summary_conf_opts=$pdns_configure_args],
211 [summary_conf_opts="(no options)"]
212 )
213 AC_MSG_NOTICE([PowerDNS Recursor configured with: $summary_conf_opts])
214 AC_MSG_NOTICE([])
215 AC_MSG_NOTICE([CC: $CC])
216 AC_MSG_NOTICE([CXX: $CXX])
217 AC_MSG_NOTICE([LD: $LD])
218 AC_MSG_NOTICE([CFLAGS: $CFLAGS])
219 AC_MSG_NOTICE([CPPFLAGS: $CPPFLAGS])
220 AC_MSG_NOTICE([CXXFLAGS: $CXXFLAGS])
221 AC_MSG_NOTICE([LDFLAGS: $LDFLAGS])
222 AC_MSG_NOTICE([LIBS: $LIBS])
223 AC_MSG_NOTICE([BOOST_CPPFLAGS: $BOOST_CPPFLAGS])
224 AC_MSG_NOTICE([])
225 AC_MSG_NOTICE([Features enabled])
226 AC_MSG_NOTICE([----------------])
227 AC_MSG_NOTICE([Lua: $LUAPC])
228 AC_MSG_NOTICE([OpenSSL ECDSA: $libcrypto_ecdsa])
229 AS_IF([test "x$LIBSODIUM_LIBS" != "x" || test "x$LIBDECAF_LIBS" != "x" || test "x$libcrypto_ed25519" = "xyes"],
230 [AC_MSG_NOTICE([ed25519: yes])],
231 [AC_MSG_NOTICE([ed25519: no])]
232 )
233 AS_IF([test "x$LIBDECAF_LIBS" != "x" || test "x$libcrypto_ed448" = "xyes"],
234 [AC_MSG_NOTICE([ed448: yes])],
235 [AC_MSG_NOTICE([ed448: no])]
236 )
237 AS_IF([test "x$PROTOBUF_LIBS" != "x" -a x"$PROTOC" != "x"],
238 [AC_MSG_NOTICE([Protobuf: yes])],
239 [AC_MSG_NOTICE([Protobuf: no])]
240 )
241 AS_IF([test "x$NET_SNMP_LIBS" != "x"],
242 [AC_MSG_NOTICE([SNMP: yes])],
243 [AC_MSG_NOTICE([SNMP: no])]
244 )
245 AS_IF([test "x$systemd" != "xn"],
246 [AC_MSG_NOTICE([systemd: yes])],
247 [AC_MSG_NOTICE([systemd: no])]
248 )
249 AM_COND_IF([NOD_ENABLED],
250 [AC_MSG_NOTICE([nod: yes])],
251 [AC_MSG_NOTICE([nod: no])]
252 )
253 AC_MSG_NOTICE([Context library: $pdns_context_library])
254 AC_MSG_NOTICE([])