]> git.ipfire.org Git - thirdparty/pdns.git/blame - pdns/recursordist/configure.ac
Merge pull request #5422 from mind04/ed25519
[thirdparty/pdns.git] / pdns / recursordist / configure.ac
CommitLineData
49ffe59e
RK
1AC_PREREQ([2.61])
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
10AC_CONFIG_HEADERS([config.h])
11
12AC_CANONICAL_HOST
13: ${CFLAGS="-Wall -g -O2"}
14: ${CXXFLAGS="-Wall -g -O2"}
15
16AC_SUBST([pdns_configure_args],["$ac_configure_args"])
17AC_DEFINE_UNQUOTED([PDNS_CONFIG_ARGS],
18 ["$pdns_configure_args"],
19 [pdns-recursor configure arguments]
20)
21
22AC_PROG_CC
23AC_PROG_CXX
24AC_LANG([C++])
25
26AC_DEFINE([_GNU_SOURCE], [1],
27 [Define _GNU_SOURCE so that we get all necessary prototypes]
28)
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
8c8b9197 37AX_CXX_COMPILE_STDCXX_11([ext], [mandatory])
0c6f6275
PL
38AC_PROG_LIBTOOL
39
40PDNS_CHECK_OS
e10b6528 41PDNS_CHECK_NETWORK_LIBS
0c6f6275 42
e512f4f9
AN
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.
0079fda2 45pdns_context_library="System V ucontexts"
e512f4f9 46
7158b2f5 47AC_DEFUN([PDNS_SELECT_CONTEXT_IMPL], [
e512f4f9 48 AC_MSG_CHECKING([whether Boost is new enough to use the context library...])
f53de853 49 if test $boost_major_version -ge 152; then
e512f4f9
AN
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...])
f53de853
RG
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
e512f4f9
AN
67 case $boost_cv_lib_context in
68 (yes)
0079fda2 69 pdns_context_library="Boost context"
e512f4f9
AN
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
7158b2f5
AN
81])
82
85c7ca75
PD
83PDNS_CHECK_CLOCK_GETTIME
84
aa4c56be
PL
85boost_required_version=1.35
86
87PDNS_WITH_PROTOBUF
88AS_IF([test "x$PROTOBUF_LIBS" != "x" -a x"$PROTOC" != "x"],
89 # The protobuf code needs boost::uuid, which is available from 1.42 onward
d778e06d
PL
90 [AC_MSG_WARN([Bumping minimal Boost requirement to 1.42. To keep the requirement at 1.35, disable protobuf support])
91 boost_required_version=1.42]
aa4c56be
PL
92)
93
94BOOST_REQUIRE([$boost_required_version])
7158b2f5
AN
95PDNS_SELECT_CONTEXT_IMPL
96
35d883a8 97PDNS_ENABLE_UNIT_TESTS
0c6f6275
PL
98PDNS_ENABLE_REPRODUCIBLE
99
100PDNS_WITH_LUAJIT
101AS_IF([test "x$with_luajit" = "xno"], [
102 PDNS_WITH_LUA
103])
c790f462
PD
104AS_IF([test "x$LUAPC" = "x" -a "x$LUAJITPC" = "x"], [
105 AC_MSG_ERROR([Neither Lua nor LuaJIT found, Lua support is not optional])
106])
9a927586 107PDNS_CHECK_LUA_HPP
0c6f6275
PL
108
109PDNS_ENABLE_VERBOSE_LOGGING
110
111# Crypto libraries
0c6f6275 112PDNS_ENABLE_BOTAN
74d83458 113PDNS_CHECK_LIBCRYPTO([
df85a9a0 114],[
74d83458
PL
115 AC_MSG_ERROR([OpenSSL/libcrypto not found])
116 ]
117)
118PDNS_CHECK_LIBCRYPTO_ECDSA
d1b28475 119PDNS_CHECK_LIBSODIUM
0c6f6275 120
d705aad9
RG
121PDNS_WITH_NET_SNMP
122
0c6f6275
PL
123# check for tools we might need
124PDNS_CHECK_RAGEL
125PDNS_CHECK_CURL
126
127AC_CHECK_FUNCS([strcasestr])
128
8c8b9197 129AC_SUBST([socketdir])
0c6f6275
PL
130socketdir="/var/run"
131AC_ARG_WITH([socketdir],
8c8b9197 132 [AS_HELP_STRING([--with-socketdir], [where the controlsocket lives @<:@default=/var/run@:>@])],
0c6f6275
PL
133 [socketdir="$withval"]
134)
135
136AC_MSG_CHECKING([whether we will enable compiler security checks])
137AC_ARG_ENABLE([hardening],
8c8b9197 138 [AS_HELP_STRING([--disable-hardening], [disable compiler security checks @<:@default=no@:>@])],
0c6f6275
PL
139 [enable_hardening=$enableval],
140 [enable_hardening=yes]
141)
142AC_MSG_RESULT([$enable_hardening])
143
144AS_IF([test "x$enable_hardening" != "xno"], [
145 AC_CC_PIE
146 AC_CC_STACK_PROTECTOR
147 AC_CC_PARAM_SSP_BUFFER_SIZE([4])
148 AC_CC_D_FORTIFY_SOURCE
149 AC_LD_RELRO
150])
151
152PDNS_ENABLE_SANITIZERS
153PDNS_ENABLE_MALLOC_TRACE
ec7fcc43 154PDNS_ENABLE_VALGRIND
6b6720de
PL
155AX_AVAILABLE_SYSTEMD
156AM_CONDITIONAL([HAVE_SYSTEMD], [ test x"$systemd" = "xy" ])
0c6f6275
PL
157PDNS_CHECK_PANDOC
158
159AC_SUBST(LIBS)
160
161AC_SUBST([AM_CPPFLAGS],
162 ["AS_ESCAPE([-I$(top_builddir) -I$(top_srcdir)]) $THREADFLAGS $BOOST_CPPFLAGS"]
163)
164
165AC_SUBST([YAHTTP_CFLAGS], ['-I$(top_srcdir)/ext/yahttp'])
23448838 166AC_SUBST([YAHTTP_LIBS], ['$(top_builddir)/ext/yahttp/yahttp/libyahttp.la'])
0c6f6275 167
0c6f6275 168LDFLAGS="$RELRO_LDFLAGS $LDFLAGS"
5e4a410d
RG
169CFLAGS="$PIE_CFLAGS $CFLAGS"
170CXXFLAGS="$SANITIZER_FLAGS $PIE_CFLAGS $CXXFLAGS"
171PROGRAM_LDFLAGS="$PIE_LDFLAGS $PROGRAM_LDFLAGS"
172AC_SUBST([PROGRAM_LDFLAGS])
0c6f6275
PL
173
174AC_CONFIG_FILES([Makefile
175 ext/Makefile
176 ext/json11/Makefile
177 ext/yahttp/Makefile
178 ext/yahttp/yahttp/Makefile])
179
180AC_OUTPUT
231da4c6
PL
181
182AC_MSG_NOTICE([])
183AC_MSG_NOTICE([Configuration summary])
184AC_MSG_NOTICE([=====================])
185AC_MSG_NOTICE([])
186AS_IF([test "x$pdns_configure_args" != "x"],
187 [summary_conf_opts=$pdns_configure_args],
188 [summary_conf_opts="(no options)"]
189)
190AC_MSG_NOTICE([PowerDNS Recursor configured with: $summary_conf_opts])
191AC_MSG_NOTICE([])
192AC_MSG_NOTICE([CC: $CC])
193AC_MSG_NOTICE([CXX: $CXX])
194AC_MSG_NOTICE([LD: $LD])
195AC_MSG_NOTICE([CFLAGS: $CFLAGS])
196AC_MSG_NOTICE([CPPFLAGS: $CPPFLAGS])
197AC_MSG_NOTICE([CXXFLAGS: $CXXFLAGS])
198AC_MSG_NOTICE([LDFLAGS: $LDFLAGS])
199AC_MSG_NOTICE([LIBS: $LIBS])
231da4c6
PL
200AC_MSG_NOTICE([BOOST_CPPFLAGS: $BOOST_CPPFLAGS])
201AC_MSG_NOTICE([])
dab358de
PL
202AC_MSG_NOTICE([Features enabled])
203AC_MSG_NOTICE([----------------])
231da4c6 204AS_IF([test "x$LUAPC" != "x"],
dab358de
PL
205 [AC_MSG_NOTICE([Lua: $LUAPC])],
206 [AS_IF([test "x$LUAJITPC" != "x"],
207 [AC_MSG_NOTICE([LuaJit: $LUAJITPC])],
208 [AC_MSG_NOTICE([Lua/LuaJit: no])])
209])
74d83458 210AC_MSG_NOTICE([OpenSSL ECDSA: $libcrypto_ecdsa])
a613e8b6
PL
211AS_IF([test "x$LIBSODIUM_LIBS" != "x"],
212 [AC_MSG_NOTICE([libsodium ed25519: yes])],
213 [AC_MSG_NOTICE([libsodium ed25519: no])]
214)
231da4c6 215AS_IF([test "x$PROTOBUF_LIBS" != "x" -a x"$PROTOC" != "x"],
dab358de
PL
216 [AC_MSG_NOTICE([Protobuf: yes])],
217 [AC_MSG_NOTICE([Protobuf: no])]
231da4c6 218)
d705aad9
RG
219AS_IF([test "x$NET_SNMP_LIBS" != "x"],
220 [AC_MSG_NOTICE([SNMP: yes])],
221 [AC_MSG_NOTICE([SNMP: no])]
222)
dab358de
PL
223AS_IF([test "x$systemd" != "xn"],
224 [AC_MSG_NOTICE([systemd: yes])],
225 [AC_MSG_NOTICE([systemd: no])]
231da4c6 226)
0079fda2 227AC_MSG_NOTICE([Context library: $pdns_context_library])
231da4c6 228AC_MSG_NOTICE([])