]> git.ipfire.org Git - thirdparty/pdns.git/blob - configure.ac
Merge pull request #6634 from rgacogne/more-systemd-sandboxing
[thirdparty/pdns.git] / configure.ac
1 AC_PREREQ([2.61])
2
3 AC_INIT([pdns], m4_esyscmd([builder-support/gen-version]))
4
5 AC_CONFIG_SRCDIR([pdns/receiver.cc])
6 AC_CONFIG_MACRO_DIR([m4])
7 AC_CONFIG_HEADERS([config.h])
8 AC_CONFIG_AUX_DIR([build-aux])
9
10 AC_SUBST([pdns_configure_args], ["$ac_configure_args"])
11 AC_DEFINE_UNQUOTED([PDNS_CONFIG_ARGS],
12 ["$pdns_configure_args"],
13 [pdns configure arguments]
14 )
15
16 AM_INIT_AUTOMAKE([foreign dist-bzip2 no-dist-gzip tar-ustar -Wno-portability subdir-objects parallel-tests 1.11])
17 AM_SILENT_RULES([yes])
18
19 AC_CANONICAL_HOST
20 : ${CFLAGS="-Wall -g -O2"}
21 : ${CXXFLAGS="-Wall -g -O2"}
22
23 AC_PROG_CC
24 AM_PROG_CC_C_O
25 PDNS_CHECK_BISON
26 PDNS_CHECK_FLEX
27 AC_PROG_INSTALL
28 AC_PROG_MAKE_SET
29
30 AC_PROG_CXX
31 AS_IF([test "x$CXX" = "xno" || test "x$CXX:x$GXX" = "xg++:x"],
32 [AC_MSG_ERROR([no C++ compiler found])]
33 )
34
35 AC_LANG([C++])
36
37 AC_DEFINE([_GNU_SOURCE], [1],
38 [Define _GNU_SOURCE so that we get all necessary prototypes]
39 )
40
41 # Warn when pkg.m4 is missing
42 m4_pattern_forbid([^_?PKG_[A-Z_]+$], [*** pkg.m4 missing, please install pkg-config])
43
44 PDNS_CHECK_OS
45 PTHREAD_SET_NAME
46
47 PDNS_WITH_LUA
48 PDNS_CHECK_LUA_HPP
49
50 AX_CXX_COMPILE_STDCXX_11
51
52 AC_MSG_CHECKING([whether we will enable compiler security checks])
53 AC_ARG_ENABLE([hardening],
54 [AS_HELP_STRING([--disable-hardening], [disable compiler security checks @<:@default=no@:>@])],
55 [enable_hardening=$enableval],
56 [enable_hardening=yes]
57 )
58 AC_MSG_RESULT([$enable_hardening])
59
60 AS_IF([test "x$enable_hardening" != "xno"], [
61 AC_CC_PIE
62 AC_CC_STACK_PROTECTOR
63 AC_CC_PARAM_SSP_BUFFER_SIZE([4])
64 AC_CC_D_FORTIFY_SOURCE
65 AC_LD_RELRO
66 ])
67
68 PDNS_ENABLE_KISS
69
70 PDNS_CHECK_NETWORK_LIBS
71
72 LT_PREREQ([2.2.2])
73 LT_INIT([disable-static dlopen])
74
75
76 MC_TM_GMTOFF
77
78 # Define full_libdir to be the fully expanded (${exec_prefix}, etc.)
79 # "system" library path.
80 # We use this to search for other libraries.
81 eval full_libdir="\"$libdir\""
82
83 # detect pkg-config explicitly
84 PKG_PROG_PKG_CONFIG
85
86 AC_CHECK_HEADERS(
87 [sys/mman.h],
88 [AC_CHECK_FUNC(
89 [mmap],
90 [AC_DEFINE(HAVE_MMAP, [1], [Define to 1 if you have mmap])],
91 [have_mmap=no]
92 )],
93 [have_mmap=no]
94 )
95
96 PDNS_WITH_LIBSODIUM
97 PDNS_WITH_LIBDECAF
98 PDNS_CHECK_LIBCRYPTO([
99 ],[
100 AC_MSG_ERROR([OpenSSL/libcrypto not found])
101 ]
102 )
103 PDNS_CHECK_LIBCRYPTO_ECDSA
104 PDNS_CHECK_LIBCRYPTO_EDDSA
105
106 PDNS_CHECK_RAGEL([pdns/dnslabeltext.cc], [www.powerdns.com])
107 PDNS_CHECK_CLOCK_GETTIME
108
109 BOOST_REQUIRE([1.35])
110 # Boost accumulators, as used by dnsbulktest and dnstcpbench, need 1.48+
111 # to be compatible with C++11
112 AM_CONDITIONAL([HAVE_BOOST_GE_148], [test "$boost_major_version" -ge 148])
113 AS_IF([test "$boost_major_version" -ge 148], [
114 AC_DEFINE(HAVE_BOOST_GE_148, [1], [Define to 1 if you have boost >= 1.48])
115 ])
116
117 BOOST_PROGRAM_OPTIONS([mt])
118 AS_IF([test "$boost_cv_lib_program_options" = "no"], [
119 AC_MSG_ERROR([Boost Program Options library not found])
120 ])
121 PDNS_ENABLE_UNIT_TESTS
122 PDNS_ENABLE_BACKEND_UNIT_TESTS
123 PDNS_ENABLE_REPRODUCIBLE
124 PDNS_ENABLE_FUZZ_TARGETS
125
126 PDNS_WITH_SQLITE3
127
128 PDNS_CHECK_VIRTUALENV
129 PDNS_FROM_GIT
130
131 dnl Checks for library functions.
132 AC_CHECK_FUNCS_ONCE([strcasestr localtime_r recvmmsg getrandom arc4random])
133
134 AM_CONDITIONAL([HAVE_RECVMMSG], [test "x$ac_cv_func_recvmmsg" = "xyes"])
135
136 AS_IF([test "x$lt_cv_dlopen" = "xno"],
137 [AC_MSG_ERROR([Your system does not support dlopen])]
138 )
139
140 AC_SUBST([LIBDL], [$lt_cv_dlopen_libs])
141
142 PDNS_ENABLE_VERBOSE_LOGGING
143 PDNS_ENABLE_PKCS11
144 PDNS_ENABLE_GSS_TSIG
145
146 AC_SUBST([socketdir])
147 socketdir="/var/run"
148 AC_ARG_WITH([socketdir],
149 [AS_HELP_STRING([--with-socketdir], [where the controlsocket lives @<:@default=/var/run@:>@])],
150 [socketdir="$withval"]
151 )
152
153 modules="bind gmysql random"
154 AC_ARG_WITH([modules],
155 [AS_HELP_STRING([--with-modules], [which backends to compile with @<:@default=bind gmysql random@:>@])],
156 [modules="$withval"]
157 )
158
159 dynmodules="pipe"
160 AC_ARG_WITH([dynmodules],
161 [AS_HELP_STRING([--with-dynmodules], [which backends to build for dynamic loading @<:@default=pipe@:>@])],
162 [dynmodules="$withval"]
163 )
164
165 AC_SUBST([moduledirs])
166 AC_SUBST([moduleobjects])
167 AC_SUBST([modulelibs])
168 AC_DEFINE_UNQUOTED([PDNS_MODULES], "$modules", [Built-in modules])
169
170 AS_IF([test x"$modules" = "xno"], [modules=""])
171 AS_IF([test x"$dynmodules" = "xno"], [dynmodules=""])
172
173 for a in $modules $dynmodules; do
174 case "$a" in
175 oracle|goracle)
176 PDNS_WITH_ORACLE
177 needoracle=yes
178 ;;
179 godbc)
180 PDNS_WITH_UNIXODBC
181 ;;
182 mydns|gmysql)
183 PDNS_WITH_MYSQL
184 ;;
185 gpgsql)
186 PDNS_WITH_POSTGRESQL
187 ;;
188 gsqlite3)
189 needsqlite3=yes
190 ;;
191 ldap)
192 PDNS_CHECK_LDAP
193 needldap=yes
194 ;;
195 opendbx)
196 PDNS_CHECK_OPENDBX
197 ;;
198 remote)
199 AS_IF([test "x$enable_unit_tests" = "xyes"],
200 [PDNS_CHECK_CURL_PROGRAM]
201 )
202 have_remotebackend=yes
203 ;;
204 tinydns)
205 PDNS_CHECK_CDB
206 ;;
207 geoip)
208 PDNS_CHECK_GEOIP
209 ;;
210 lua*)
211 AS_IF([test "x$with_lua" = "xno"],
212 [AC_MSG_ERROR([${a} backend needs lua, run ./configure --with-lua])]
213 )
214 AS_IF([test "x$LUAPC" = "x"],
215 [AC_MSG_ERROR([${a} backend needs lua but we cannot find it])]
216 )
217 ;;
218 esac
219 done
220
221 PDNS_ENABLE_REMOTEBACKEND_ZEROMQ
222
223 AC_MSG_CHECKING([whether we will be building and installing the extra tools])
224 AC_ARG_ENABLE([tools],
225 [AS_HELP_STRING([--enable-tools], [if we should build and install the tools @<:@default=no@:>@])],
226 [enable_tools=$enableval],
227 [enable_tools=no]
228 )
229
230 AC_MSG_RESULT([$enable_tools])
231 AM_CONDITIONAL([TOOLS], [test "x$enable_tools" != "xno"])
232 PDNS_ENABLE_IXFRDIST
233
234 PDNS_WITH_PROTOBUF
235
236 PDNS_WITH_LUA_RECORDS
237
238 AM_CONDITIONAL([ORACLE], [test "x$needoracle" = "xyes"])
239
240 AM_CONDITIONAL([LDAP], [test "x$needldap" = "xyes"])
241
242 PDNS_CHECK_SQLITE3
243 AM_CONDITIONAL([SQLITE3], [test "x$needsqlite3" = "xyes"])
244
245 for a in $modules; do
246 AC_MSG_CHECKING([whether we can build module "${a}"])
247 if [[ -d "$srcdir/modules/${a}backend" ]]; then
248 AC_MSG_RESULT([yes])
249 moduledirs="$moduledirs ${a}backend"
250
251 for b in `cat $srcdir/modules/${a}backend/OBJECTFILES`; do
252 moduleobjects="$moduleobjects ../modules/${a}backend/$b"
253 done
254 modulelibs="$modulelibs `cat $srcdir/modules/${a}backend/OBJECTLIBS`"
255 else
256 AC_MSG_RESULT([no])
257 AC_MSG_ERROR([Do not know how to build module "$a", "$srcdir/modules/${a}backend" does not exist! Please review --with-modules parameter for supported values.])
258 fi
259 done
260
261 for a in $dynmodules; do
262 AC_MSG_CHECKING([whether we can build dynamic module "${a}"])
263 if [[ -d "$srcdir/modules/${a}backend" ]]; then
264 AC_MSG_RESULT([yes])
265 moduledirs="$moduledirs ${a}backend"
266 else
267 AC_MSG_RESULT([no])
268 AC_MSG_ERROR([Do not know how to build module "$a", "$srcdir/modules/${a}backend" does not exist! Please review --with-dynmodules parameter for supported values.])
269 fi
270 done
271
272 AX_AVAILABLE_SYSTEMD
273 AX_CHECK_SYSTEMD_FEATURES
274 AM_CONDITIONAL([HAVE_SYSTEMD], [ test x"$systemd" = "xy" ])
275
276 LDFLAGS="$RELRO_LDFLAGS $LDFLAGS"
277
278 CFLAGS="$PIE_CFLAGS $CFLAGS"
279 CXXFLAGS="$PIE_CFLAGS $CXXFLAGS"
280 PROGRAM_LDFLAGS="$PIE_LDFLAGS $PROGRAM_LDFLAGS"
281 AC_SUBST([PROGRAM_LDFLAGS])
282
283 PDNS_ENABLE_COVERAGE
284 PDNS_ENABLE_SANITIZERS
285 PDNS_ENABLE_MALLOC_TRACE
286
287 AC_SUBST(LIBS)
288
289 AC_SUBST([AM_CPPFLAGS],
290 ["AS_ESCAPE([-I$(top_builddir) -I$(top_srcdir)]) $THREADFLAGS $BOOST_CPPFLAGS"]
291 )
292
293 AC_SUBST([YAHTTP_CFLAGS], ['-I$(top_srcdir)/ext/yahttp'])
294 AC_SUBST([YAHTTP_LIBS], ['$(top_builddir)/ext/yahttp/yahttp/libyahttp.la'])
295
296 CXXFLAGS="$SANITIZER_FLAGS $CXXFLAGS"
297
298 AC_ARG_VAR(PACKAGEVERSION, [The version used in secpoll queries])
299 AS_IF([test "x$PACKAGEVERSION" != "x"],
300 [AC_DEFINE_UNQUOTED([PACKAGEVERSION], "$PACKAGEVERSION", [Set to the package version used for secpoll])]
301 )
302
303 export moduledirs moduleobjects modulelibs
304
305 AC_CONFIG_FILES([
306 Makefile
307 modules/Makefile
308 pdns/Makefile
309 codedocs/Makefile
310 docs/Makefile
311 pdns/pdns.init
312 ext/Makefile
313 ext/yahttp/Makefile
314 ext/yahttp/yahttp/Makefile
315 ext/json11/Makefile
316 modules/bindbackend/Makefile
317 modules/geoipbackend/Makefile
318 modules/gmysqlbackend/Makefile
319 modules/godbcbackend/Makefile
320 modules/goraclebackend/Makefile
321 modules/gpgsqlbackend/Makefile
322 modules/gsqlite3backend/Makefile
323 modules/ldapbackend/Makefile
324 modules/luabackend/Makefile
325 modules/lua2backend/Makefile
326 modules/mydnsbackend/Makefile
327 modules/opendbxbackend/Makefile
328 modules/oraclebackend/Makefile
329 modules/pipebackend/Makefile
330 modules/randombackend/Makefile
331 modules/remotebackend/Makefile
332 modules/tinydnsbackend/Makefile
333 ])
334 AC_OUTPUT
335
336 AC_MSG_NOTICE([])
337 AC_MSG_NOTICE([Configuration summary])
338 AC_MSG_NOTICE([=====================])
339 AC_MSG_NOTICE([])
340 AC_MSG_NOTICE([Configured with: $pdns_configure_args])
341 AC_MSG_NOTICE([])
342 AC_MSG_NOTICE([CC: $CC])
343 AC_MSG_NOTICE([CXX: $CXX])
344 AC_MSG_NOTICE([LD: $LD])
345 AC_MSG_NOTICE([CFLAGS: $CFLAGS])
346 AC_MSG_NOTICE([CPPFLAGS: $CPPFLAGS])
347 AC_MSG_NOTICE([CXXFLAGS: $CXXFLAGS])
348 AC_MSG_NOTICE([LDFLAGS: $LDFLAGS])
349 AC_MSG_NOTICE([LIBS: $LIBS])
350 AC_MSG_NOTICE([BOOST_CPPFLAGS: $BOOST_CPPFLAGS])
351 AC_MSG_NOTICE([])
352 AC_MSG_NOTICE([Features enabled])
353 AC_MSG_NOTICE([----------------])
354 AC_MSG_NOTICE([Built-in modules: $modules])
355 AC_MSG_NOTICE([Dynamic modules: $dynmodules])
356 AC_MSG_NOTICE([])
357 AS_IF([test "x$libcrypto_ecdsa" = "xyes"],
358 [AC_MSG_NOTICE([OpenSSL ecdsa: yes])],
359 [AC_MSG_NOTICE([OpenSSL ecdsa: no])]
360 )
361 AS_IF([test "x$LIBSODIUM_LIBS" != "x" || test "x$LIBDECAF_LIBS" != "x" || test "x$libcrypto_ed25519" = "xyes"],
362 [AC_MSG_NOTICE([ed25519: yes])],
363 [AC_MSG_NOTICE([ed25519: no])]
364 )
365 AS_IF([test "x$LIBDECAF_LIBS" != "x" || test "x$libcrypto_ed448" = "xyes"],
366 [AC_MSG_NOTICE([ed448: yes])],
367 [AC_MSG_NOTICE([ed448: no])]
368 )
369 AS_IF([test "x$needsqlite3" != "x"],
370 [AC_MSG_NOTICE([SQLite3: yes])],
371 [AC_MSG_NOTICE([SQLite3: no])]
372 )
373 AS_IF([test "x$LUAPC" != "x"],
374 [AC_MSG_NOTICE([Lua: $LUAPC])],
375 [AS_IF([test "x$LUAJITPC" != "x"],
376 [AC_MSG_NOTICE([LuaJit: $LUAJITPC])],
377 [AC_MSG_NOTICE([Lua/LuaJit: no])])
378 ])
379 AS_IF([test "x$enable_experimental_pkcs11" = "xyes"],
380 [AC_MSG_NOTICE([PKCS-11: yes])]
381 )
382 AS_IF([test "x$enable_experimental_gss_tsig" = "xyes"],
383 [AC_MSG_NOTICE([GSS-TSIG: yes])]
384 )
385 AS_IF([test "x$systemd" != "xn"],
386 [AC_MSG_NOTICE([systemd: yes])],
387 [AC_MSG_NOTICE([systemd: no])]
388 )
389 AS_IF([test "x$enable_remotebackend_zeromq" != "xno"],
390 [AC_MSG_NOTICE([ZeroMQ connector for remotebackend: yes])]
391 )
392 AC_MSG_NOTICE([])