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