]>
Commit | Line | Data |
---|---|---|
49ffe59e RK |
1 | AC_PREREQ([2.61]) |
2 | ||
831525d2 | 3 | AC_INIT([pdns-recursor], m4_esyscmd(build-aux/gen-version)) |
0c6f6275 PL |
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_DEFINE([_GNU_SOURCE], [1], | |
27 | [Define _GNU_SOURCE so that we get all necessary prototypes] | |
28 | ) | |
29 | ||
acbfb1c1 PL |
30 | AC_DEFINE([RECURSOR], [1], |
31 | [This is the PowerDNS Recursor] | |
32 | ) | |
33 | ||
0c6f6275 | 34 | # Warn when pkg.m4 is missing |
8c8b9197 | 35 | m4_pattern_forbid([^_?PKG_[A-Z_]+$], [*** pkg.m4 missing, please install pkg-config]) |
0c6f6275 | 36 | |
8c8b9197 | 37 | AX_CXX_COMPILE_STDCXX_11([ext], [mandatory]) |
0c6f6275 PL |
38 | AC_PROG_LIBTOOL |
39 | ||
40 | PDNS_CHECK_OS | |
e10b6528 | 41 | PDNS_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 | 45 | pdns_context_library="System V ucontexts" |
e512f4f9 | 46 | |
7158b2f5 | 47 | AC_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 |
83 | PDNS_CHECK_CLOCK_GETTIME |
84 | ||
aa4c56be PL |
85 | boost_required_version=1.35 |
86 | ||
87 | PDNS_WITH_PROTOBUF | |
88 | AS_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 | ||
94 | BOOST_REQUIRE([$boost_required_version]) | |
7158b2f5 AN |
95 | PDNS_SELECT_CONTEXT_IMPL |
96 | ||
35d883a8 | 97 | PDNS_ENABLE_UNIT_TESTS |
0c6f6275 PL |
98 | PDNS_ENABLE_REPRODUCIBLE |
99 | ||
100 | PDNS_WITH_LUAJIT | |
101 | AS_IF([test "x$with_luajit" = "xno"], [ | |
102 | PDNS_WITH_LUA | |
103 | ]) | |
c790f462 PD |
104 | AS_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 | 107 | PDNS_CHECK_LUA_HPP |
0c6f6275 PL |
108 | |
109 | PDNS_ENABLE_VERBOSE_LOGGING | |
110 | ||
111 | # Crypto libraries | |
0c6f6275 | 112 | PDNS_ENABLE_BOTAN |
74d83458 | 113 | PDNS_CHECK_LIBCRYPTO([ |
df85a9a0 | 114 | ],[ |
74d83458 PL |
115 | AC_MSG_ERROR([OpenSSL/libcrypto not found]) |
116 | ] | |
117 | ) | |
118 | PDNS_CHECK_LIBCRYPTO_ECDSA | |
d1b28475 | 119 | PDNS_CHECK_LIBSODIUM |
0c6f6275 | 120 | |
d705aad9 RG |
121 | PDNS_WITH_NET_SNMP |
122 | ||
0c6f6275 PL |
123 | # check for tools we might need |
124 | PDNS_CHECK_RAGEL | |
125 | PDNS_CHECK_CURL | |
126 | ||
127 | AC_CHECK_FUNCS([strcasestr]) | |
128 | ||
8c8b9197 | 129 | AC_SUBST([socketdir]) |
0c6f6275 PL |
130 | socketdir="/var/run" |
131 | AC_ARG_WITH([socketdir], | |
8c8b9197 | 132 | [AS_HELP_STRING([--with-socketdir], [where the controlsocket lives @<:@default=/var/run@:>@])], |
0c6f6275 PL |
133 | [socketdir="$withval"] |
134 | ) | |
135 | ||
136 | AC_MSG_CHECKING([whether we will enable compiler security checks]) | |
137 | AC_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 | ) | |
142 | AC_MSG_RESULT([$enable_hardening]) | |
143 | ||
144 | AS_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 | ||
152 | PDNS_ENABLE_SANITIZERS | |
153 | PDNS_ENABLE_MALLOC_TRACE | |
ec7fcc43 | 154 | PDNS_ENABLE_VALGRIND |
6b6720de PL |
155 | AX_AVAILABLE_SYSTEMD |
156 | AM_CONDITIONAL([HAVE_SYSTEMD], [ test x"$systemd" = "xy" ]) | |
0c6f6275 PL |
157 | PDNS_CHECK_PANDOC |
158 | ||
159 | AC_SUBST(LIBS) | |
160 | ||
161 | AC_SUBST([AM_CPPFLAGS], | |
162 | ["AS_ESCAPE([-I$(top_builddir) -I$(top_srcdir)]) $THREADFLAGS $BOOST_CPPFLAGS"] | |
163 | ) | |
164 | ||
165 | AC_SUBST([YAHTTP_CFLAGS], ['-I$(top_srcdir)/ext/yahttp']) | |
23448838 | 166 | AC_SUBST([YAHTTP_LIBS], ['$(top_builddir)/ext/yahttp/yahttp/libyahttp.la']) |
0c6f6275 | 167 | |
0c6f6275 | 168 | LDFLAGS="$RELRO_LDFLAGS $LDFLAGS" |
5e4a410d RG |
169 | CFLAGS="$PIE_CFLAGS $CFLAGS" |
170 | CXXFLAGS="$SANITIZER_FLAGS $PIE_CFLAGS $CXXFLAGS" | |
171 | PROGRAM_LDFLAGS="$PIE_LDFLAGS $PROGRAM_LDFLAGS" | |
172 | AC_SUBST([PROGRAM_LDFLAGS]) | |
0c6f6275 PL |
173 | |
174 | AC_CONFIG_FILES([Makefile | |
175 | ext/Makefile | |
176 | ext/json11/Makefile | |
177 | ext/yahttp/Makefile | |
178 | ext/yahttp/yahttp/Makefile]) | |
179 | ||
180 | AC_OUTPUT | |
231da4c6 PL |
181 | |
182 | AC_MSG_NOTICE([]) | |
183 | AC_MSG_NOTICE([Configuration summary]) | |
184 | AC_MSG_NOTICE([=====================]) | |
185 | AC_MSG_NOTICE([]) | |
186 | AS_IF([test "x$pdns_configure_args" != "x"], | |
187 | [summary_conf_opts=$pdns_configure_args], | |
188 | [summary_conf_opts="(no options)"] | |
189 | ) | |
190 | AC_MSG_NOTICE([PowerDNS Recursor configured with: $summary_conf_opts]) | |
191 | AC_MSG_NOTICE([]) | |
192 | AC_MSG_NOTICE([CC: $CC]) | |
193 | AC_MSG_NOTICE([CXX: $CXX]) | |
194 | AC_MSG_NOTICE([LD: $LD]) | |
195 | AC_MSG_NOTICE([CFLAGS: $CFLAGS]) | |
196 | AC_MSG_NOTICE([CPPFLAGS: $CPPFLAGS]) | |
197 | AC_MSG_NOTICE([CXXFLAGS: $CXXFLAGS]) | |
198 | AC_MSG_NOTICE([LDFLAGS: $LDFLAGS]) | |
199 | AC_MSG_NOTICE([LIBS: $LIBS]) | |
231da4c6 PL |
200 | AC_MSG_NOTICE([BOOST_CPPFLAGS: $BOOST_CPPFLAGS]) |
201 | AC_MSG_NOTICE([]) | |
dab358de PL |
202 | AC_MSG_NOTICE([Features enabled]) |
203 | AC_MSG_NOTICE([----------------]) | |
231da4c6 | 204 | AS_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 | 210 | AC_MSG_NOTICE([OpenSSL ECDSA: $libcrypto_ecdsa]) |
a613e8b6 PL |
211 | AS_IF([test "x$LIBSODIUM_LIBS" != "x"], |
212 | [AC_MSG_NOTICE([libsodium ed25519: yes])], | |
213 | [AC_MSG_NOTICE([libsodium ed25519: no])] | |
214 | ) | |
231da4c6 | 215 | AS_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 |
219 | AS_IF([test "x$NET_SNMP_LIBS" != "x"], |
220 | [AC_MSG_NOTICE([SNMP: yes])], | |
221 | [AC_MSG_NOTICE([SNMP: no])] | |
222 | ) | |
dab358de PL |
223 | AS_IF([test "x$systemd" != "xn"], |
224 | [AC_MSG_NOTICE([systemd: yes])], | |
225 | [AC_MSG_NOTICE([systemd: no])] | |
231da4c6 | 226 | ) |
0079fda2 | 227 | AC_MSG_NOTICE([Context library: $pdns_context_library]) |
231da4c6 | 228 | AC_MSG_NOTICE([]) |