]> git.ipfire.org Git - thirdparty/pdns.git/blob - configure.ac
Merge pull request #13209 from omoerbeek/rec-aggr-cache-pruning
[thirdparty/pdns.git] / configure.ac
1 AC_PREREQ([2.69])
2
3 AC_INIT([pdns], m4_esyscmd([builder-support/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/auth-main.cc])
8 AC_CONFIG_MACRO_DIR([m4])
9
10 AC_USE_SYSTEM_EXTENSIONS
11 AC_CONFIG_HEADERS([config.h])
12
13 AC_CANONICAL_HOST
14 # Add some default CFLAGS and CXXFLAGS, can be appended to using the environment variables
15 CFLAGS="-g -O2 -Wall -Wextra -Wshadow -Wmissing-declarations -Wredundant-decls $CFLAGS"
16 CXXFLAGS="-g -O2 -Wall -Wextra -Wshadow -Wmissing-declarations -Wredundant-decls $CXXFLAGS"
17
18 AC_SUBST([pdns_configure_args], ["$ac_configure_args"])
19 AC_DEFINE_UNQUOTED([PDNS_CONFIG_ARGS],
20 ["$pdns_configure_args"],
21 [pdns configure arguments]
22 )
23
24 AC_PROG_CC
25 # AM_PROG_CC_C_O
26 AC_PROG_CXX
27 AC_LANG([C++])
28
29 PDNS_CHECK_TIME_T
30 PDNS_CHECK_BISON
31 PDNS_CHECK_FLEX
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_17([noext], [mandatory])
37 LT_PREREQ([2.2.2])
38 LT_INIT([disable-static dlopen])
39
40 PDNS_CHECK_OS
41 PTHREAD_SET_NAME
42 AC_FUNC_STRERROR_R
43 AX_CXX_CXXFS
44
45 PDNS_WITH_LUA([mandatory])
46 PDNS_CHECK_LUA_HPP
47
48 AC_MSG_CHECKING([whether we will enable compiler security checks])
49 AC_ARG_ENABLE([hardening],
50 [AS_HELP_STRING([--disable-hardening], [disable compiler security checks @<:@default=no@:>@])],
51 [enable_hardening=$enableval],
52 [enable_hardening=yes]
53 )
54 AC_MSG_RESULT([$enable_hardening])
55
56 AS_IF([test "x$enable_hardening" != "xno"], [
57 AC_CC_PIE
58 AC_CC_STACK_PROTECTOR
59 AC_CC_PARAM_SSP_BUFFER_SIZE([4])
60 AC_CC_D_FORTIFY_SOURCE
61 AC_LD_RELRO
62 ])
63
64 PDNS_ENABLE_KISS
65
66 PDNS_CHECK_NETWORK_LIBS
67
68
69 MC_TM_GMTOFF
70
71 # Define full_libdir to be the fully expanded (${exec_prefix}, etc.)
72 # "system" library path.
73 # We use this to search for other libraries.
74 eval full_libdir="\"$libdir\""
75
76 # detect pkg-config explicitly
77 PKG_PROG_PKG_CONFIG
78
79 AC_CHECK_HEADERS(
80 [sys/mman.h],
81 [AC_CHECK_FUNC(
82 [mmap],
83 [AC_DEFINE(HAVE_MMAP, [1], [Define to 1 if you have mmap])],
84 [have_mmap=no]
85 )],
86 [have_mmap=no]
87 )
88 AC_CHECK_HEADERS([sys/random.h])
89
90 PDNS_WITH_LIBSODIUM
91 PDNS_WITH_LIBDECAF
92 PDNS_CHECK_LIBCRYPTO([
93 ],[
94 AC_MSG_ERROR([OpenSSL/libcrypto not found])
95 ]
96 )
97 PDNS_CHECK_LIBCRYPTO_ECDSA
98 PDNS_CHECK_LIBCRYPTO_EDDSA
99
100 AM_CONDITIONAL([HAVE_GNUTLS], [false])
101 AM_CONDITIONAL([HAVE_LIBSSL], [false])
102
103 PDNS_ENABLE_DNS_OVER_TLS
104 AS_IF([test "x$enable_dns_over_tls" != "xno"], [
105 PDNS_WITH_LIBSSL
106 PDNS_WITH_GNUTLS
107 AS_IF([test "x$HAVE_GNUTLS" != "x1" -a "x$HAVE_LIBSSL" != "x1"], [
108 AC_MSG_ERROR([DNS over TLS support requested but neither GnuTLS nor OpenSSL are available])
109 ])
110 ])
111
112 PDNS_ENABLE_IPCIPHER
113
114 PDNS_CHECK_RAGEL([pdns/dnslabeltext.cc], [www.powerdns.com])
115 PDNS_CHECK_CLOCK_GETTIME
116
117 BOOST_REQUIRE([1.42])
118 # Boost accumulators, as used by dnsbulktest and dnstcpbench, need 1.48+
119 # to be compatible with C++11
120 AM_CONDITIONAL([HAVE_BOOST_GE_148], [test "$boost_major_version" -ge 148])
121 AS_IF([test "$boost_major_version" -ge 148], [
122 AC_DEFINE(HAVE_BOOST_GE_148, [1], [Define to 1 if you have boost >= 1.48])
123 ])
124
125 BOOST_PROGRAM_OPTIONS([mt])
126 AS_IF([test "$boost_cv_lib_program_options" = "no"], [
127 AC_MSG_ERROR([Boost Program Options library not found])
128 ])
129 PDNS_ENABLE_UNIT_TESTS
130 PDNS_ENABLE_BACKEND_UNIT_TESTS
131 PDNS_ENABLE_REPRODUCIBLE
132 PDNS_ENABLE_FUZZ_TARGETS
133
134 PDNS_WITH_SQLITE3
135
136 PDNS_CHECK_PYTHON_VENV
137
138 AM_CONDITIONAL([HAVE_API_SWAGGER_JSON], [test -e "$srcdir/pdns/api-swagger.json"])
139 AM_COND_IF([HAVE_API_SWAGGER_JSON],[],[
140 AM_COND_IF([HAVE_VENV],[],[
141 AC_MSG_ERROR([Python 3 and/or venv module are not available, Authoritative Server cannot be built.])
142 ])
143 ])
144
145 AM_CONDITIONAL([HAVE_MANPAGES], [test -e "$srcdir/docs/pdns_server.1"])
146 AM_COND_IF([HAVE_MANPAGES],[],[
147 AM_COND_IF([HAVE_VENV],[],[
148 AC_MSG_WARN([Python 3 and/or venv module are not available, documentation will not be built.])
149 ])
150 ])
151
152 PDNS_FROM_GIT
153
154 dnl Checks for library functions.
155 dnl the *_r functions are in posix so we can use them unconditionally, but the ext/yahttp code is
156 dnl using the defines.
157 AC_CHECK_FUNCS_ONCE([strcasestr localtime_r gmtime_r recvmmsg sched_setscheduler])
158 AC_CHECK_FUNCS_ONCE([getrandom getentropy arc4random arc4random_uniform arc4random_buf])
159 PDNS_CHECK_SECURE_MEMSET
160
161 AM_CONDITIONAL([HAVE_RECVMMSG], [test "x$ac_cv_func_recvmmsg" = "xyes"])
162
163 AS_IF([test "x$lt_cv_dlopen" = "xno"],
164 [AC_MSG_ERROR([Your system does not support dlopen])]
165 )
166
167 AC_SUBST([LIBDL], [$lt_cv_dlopen_libs])
168
169 PDNS_ENABLE_VERBOSE_LOGGING
170 PDNS_ENABLE_PKCS11
171 PDNS_ENABLE_GSS_TSIG
172
173 AC_SUBST([socketdir])
174 socketdir="/var/run"
175 AC_ARG_WITH([socketdir],
176 [AS_HELP_STRING([--with-socketdir], [where the controlsocket lives @<:@default=/var/run@:>@])],
177 [socketdir="$withval"]
178 )
179
180 modules="bind gmysql"
181 AC_ARG_WITH([modules],
182 [AS_HELP_STRING([--with-modules], [which backends to compile with @<:@default=bind gmysql@:>@])],
183 [modules="$withval"]
184 )
185
186 dynmodules="pipe"
187 AC_ARG_WITH([dynmodules],
188 [AS_HELP_STRING([--with-dynmodules], [which backends to build for dynamic loading @<:@default=pipe@:>@])],
189 [dynmodules="$withval"]
190 )
191
192 AC_SUBST([moduledirs])
193 AC_SUBST([moduleobjects])
194 AC_SUBST([modulelibs])
195 AC_DEFINE_UNQUOTED([PDNS_MODULES], "$modules", [Built-in modules])
196
197 AS_IF([test x"$modules" = "xno"], [modules=""])
198 AS_IF([test x"$dynmodules" = "xno"], [dynmodules=""])
199
200 for a in $modules $dynmodules; do
201 case "$a" in
202 godbc)
203 PDNS_WITH_UNIXODBC
204 ;;
205 gmysql)
206 PDNS_WITH_MYSQL
207 ;;
208 gpgsql)
209 PDNS_WITH_POSTGRESQL
210 ;;
211 gsqlite3)
212 needsqlite3=yes
213 ;;
214 ldap)
215 PDNS_CHECK_LDAP
216 needldap=yes
217 ;;
218 remote)
219 AS_IF([test "x$enable_unit_tests" = "xyes"],
220 [PDNS_CHECK_CURL_PROGRAM]
221 )
222 have_remotebackend=yes
223 ;;
224 tinydns)
225 needcdb=yes
226 PDNS_CHECK_CDB
227 ;;
228 geoip)
229 PDNS_CHECK_GEOIP
230 ;;
231 lua*)
232 dnl Lua has been checked above
233 ;;
234 lmdb)
235 needlmdb=yes
236 PDNS_CHECK_LMDB
237 BOOST_SERIALIZATION
238 ;;
239 esac
240 done
241
242 PDNS_ENABLE_REMOTEBACKEND_ZEROMQ
243
244 PDNS_ENABLE_TOOLS
245 PDNS_ENABLE_IXFRDIST
246
247 PDNS_WITH_LUA_RECORDS
248
249 AM_CONDITIONAL([LDAP], [test "x$needldap" = "xyes"])
250
251 PDNS_CHECK_SQLITE3
252 AM_CONDITIONAL([SQLITE3], [test "x$needsqlite3" = "xyes"])
253
254 AM_CONDITIONAL([LMDB], [test "x$needlmdb" != "x"])
255 AM_CONDITIONAL([HAVE_LMDB], [test "x$LMDB_LIBS" != "x"])
256
257 AS_IF([test "x$needlmdb" = "xyes"], [
258 AS_IF([test "$with_lmdb" = "no"], [
259 AC_MSG_ERROR([--with-lmdb is set to 'no', but lmdb support is required])
260 ])
261 AS_IF([test "x$HAVE_LMDB" != "x1"], [
262 AC_MSG_ERROR([lmdb not found via pkg-config, please install lmdb or set --with-lmdb to your lmdb installation directory])
263 ])
264 ])
265
266 AM_CONDITIONAL([CDB], [test "x$needcdb" != "x"])
267 AM_CONDITIONAL([HAVE_CDB], [test "x$CDB_LIBS" != "x"])
268
269 AS_IF([test "x$needcdb" = "xyes"], [
270 AS_IF([test "x$HAVE_CDB" != "x1"], [
271 AC_MSG_ERROR([cdb not found via pkg-config, please install cdb])
272 ])
273 ])
274
275 for a in $modules; do
276 AC_MSG_CHECKING([whether we can build module "${a}"])
277 if [[ -d "$srcdir/modules/${a}backend" ]]; then
278 AC_MSG_RESULT([yes])
279 moduledirs="$moduledirs ${a}backend"
280
281 for b in `cat $srcdir/modules/${a}backend/OBJECTFILES`; do
282 moduleobjects="$moduleobjects ../modules/${a}backend/$b"
283 done
284 modulelibs="$modulelibs `cat $srcdir/modules/${a}backend/OBJECTLIBS`"
285 else
286 AC_MSG_RESULT([no])
287 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.])
288 fi
289 done
290
291 for a in $dynmodules; do
292 AC_MSG_CHECKING([whether we can build dynamic module "${a}"])
293 if [[ -d "$srcdir/modules/${a}backend" ]]; then
294 AC_MSG_RESULT([yes])
295 moduledirs="$moduledirs ${a}backend"
296 else
297 AC_MSG_RESULT([no])
298 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.])
299 fi
300 done
301
302 AX_AVAILABLE_SYSTEMD
303 AX_CHECK_SYSTEMD_FEATURES
304 AM_CONDITIONAL([HAVE_SYSTEMD], [ test x"$systemd" = "xy" ])
305 PDNS_WITH_SERVICE_USER([pdns])
306
307 LDFLAGS="$RELRO_LDFLAGS $LDFLAGS"
308
309 CFLAGS="$PIE_CFLAGS $CFLAGS"
310 CXXFLAGS="$PIE_CFLAGS $CXXFLAGS"
311 PROGRAM_LDFLAGS="$PIE_LDFLAGS $PROGRAM_LDFLAGS"
312 AS_IF([test "$ax_cxx_cv_filesystem_lib" != "none"],
313 [PROGRAM_LDFLAGS="$PROGRAM_LDFLAGS -l$ax_cxx_cv_filesystem_lib"],
314 []
315 )
316 AC_SUBST([PROGRAM_LDFLAGS])
317
318 PDNS_ENABLE_COVERAGE
319 PDNS_INIT_AUTO_VARS
320 PDNS_ENABLE_SANITIZERS
321 PDNS_ENABLE_MALLOC_TRACE
322 PDNS_ENABLE_LTO
323
324 AC_SUBST(LIBS)
325
326 AC_SUBST([AM_CPPFLAGS],
327 ["AS_ESCAPE([-I$(top_builddir) -I$(top_srcdir)]) $THREADFLAGS $BOOST_CPPFLAGS"]
328 )
329
330 AC_SUBST([YAHTTP_CFLAGS], ['-I$(top_srcdir)/ext/yahttp'])
331 AC_SUBST([YAHTTP_LIBS], ['$(top_builddir)/ext/yahttp/yahttp/libyahttp.la'])
332 AC_SUBST([IPCRYPT_CFLAGS], ['-I$(top_srcdir)/ext/ipcrypt'])
333 AC_SUBST([IPCRYPT_LIBS], ['$(top_builddir)/ext/ipcrypt/libipcrypt.la'])
334
335 CFLAGS="$SANITIZER_FLAGS $CFLAGS"
336 CXXFLAGS="$SANITIZER_FLAGS $CXXFLAGS"
337
338 CCVERSION=`$CC --version | head -1`
339 CXXVERSION=`$CXX --version | head -1`
340
341 AC_ARG_VAR(PACKAGEVERSION, [The version used in secpoll queries])
342 AS_IF([test "x$PACKAGEVERSION" != "x"],
343 [AC_DEFINE_UNQUOTED([PACKAGEVERSION], "$PACKAGEVERSION", [Set to the package version used for secpoll])]
344 )
345
346 export moduledirs moduleobjects modulelibs
347
348 AC_CONFIG_FILES([
349 Makefile
350 modules/Makefile
351 pdns/Makefile
352 codedocs/Makefile
353 docs/Makefile
354 ext/Makefile
355 ext/arc4random/Makefile
356 ext/ipcrypt/Makefile
357 ext/yahttp/Makefile
358 ext/yahttp/yahttp/Makefile
359 ext/json11/Makefile
360 modules/bindbackend/Makefile
361 modules/geoipbackend/Makefile
362 modules/gmysqlbackend/Makefile
363 modules/godbcbackend/Makefile
364 modules/gpgsqlbackend/Makefile
365 modules/gsqlite3backend/Makefile
366 modules/ldapbackend/Makefile
367 modules/lmdbbackend/Makefile
368 modules/lua2backend/Makefile
369 modules/pipebackend/Makefile
370 modules/remotebackend/Makefile
371 modules/tinydnsbackend/Makefile
372 ])
373 AC_OUTPUT
374
375 AC_MSG_NOTICE([])
376 AC_MSG_NOTICE([Configuration summary])
377 AC_MSG_NOTICE([=====================])
378 AC_MSG_NOTICE([])
379 AC_MSG_NOTICE([Configured with: $pdns_configure_args])
380 AC_MSG_NOTICE([])
381 AC_MSG_NOTICE([CC: $CC ($CCVERSION)])
382 AC_MSG_NOTICE([CXX: $CXX ($CXXVERSION)])
383 AC_MSG_NOTICE([LD: $LD])
384 AC_MSG_NOTICE([CFLAGS: $CFLAGS])
385 AC_MSG_NOTICE([CPPFLAGS: $CPPFLAGS])
386 AC_MSG_NOTICE([CXXFLAGS: $CXXFLAGS])
387 AC_MSG_NOTICE([LDFLAGS: $LDFLAGS])
388 AC_MSG_NOTICE([LIBS: $LIBS])
389 AC_MSG_NOTICE([BOOST_CPPFLAGS: $BOOST_CPPFLAGS])
390 AC_MSG_NOTICE([])
391 AC_MSG_NOTICE([Extras enabled])
392 AC_MSG_NOTICE([--------------])
393 AS_IF([test "x$enable_tools" = "xyes"],
394 [AC_MSG_NOTICE([Tools: yes])],
395 [AC_MSG_NOTICE([Tools: no])]
396 )
397 AS_IF([test "x$enable_ixfrdist" = "xyes"],
398 [AC_MSG_NOTICE([ixfrdist: yes])],
399 [AC_MSG_NOTICE([ixfrdist: no])]
400 )
401 AC_MSG_NOTICE([])
402 AC_MSG_NOTICE([Server Features enabled])
403 AC_MSG_NOTICE([-----------------------])
404 AC_MSG_NOTICE([Built-in modules: $modules])
405 AC_MSG_NOTICE([Dynamic modules: $dynmodules])
406 AC_MSG_NOTICE([])
407 AS_IF([test "x$libcrypto_ecdsa" = "xyes"],
408 [AC_MSG_NOTICE([OpenSSL ecdsa: yes])],
409 [AC_MSG_NOTICE([OpenSSL ecdsa: no])]
410 )
411 AS_IF([test "x$LIBSODIUM_LIBS" != "x" || test "x$LIBDECAF_LIBS" != "x" || test "x$libcrypto_ed25519" = "xyes"],
412 [AC_MSG_NOTICE([ed25519: yes])],
413 [AC_MSG_NOTICE([ed25519: no])]
414 )
415 AS_IF([test "x$LIBDECAF_LIBS" != "x" || test "x$libcrypto_ed448" = "xyes"],
416 [AC_MSG_NOTICE([ed448: yes])],
417 [AC_MSG_NOTICE([ed448: no])]
418 )
419 AS_IF([test "x$needsqlite3" != "x"],
420 [AC_MSG_NOTICE([SQLite3: yes])],
421 [AC_MSG_NOTICE([SQLite3: no])]
422 )
423 AS_IF([test "x$LUAPC" != "x"],
424 [AC_MSG_NOTICE([Lua: $LUAPC])],
425 [AS_IF([test "x$LUAJITPC" != "x"],
426 [AC_MSG_NOTICE([LuaJit: $LUAJITPC])],
427 [AC_MSG_NOTICE([Lua/LuaJit: no])])
428 ])
429 AS_IF([test "x$enable_experimental_pkcs11" = "xyes"],
430 [AC_MSG_NOTICE([PKCS-11: yes])]
431 )
432 AS_IF([test "x$enable_experimental_gss_tsig" = "xyes"],
433 [AC_MSG_NOTICE([GSS-TSIG: yes])]
434 )
435 AS_IF([test "x$enable_lua_records" = "xyes"],
436 [AC_MSG_NOTICE([LUA records: yes])]
437 )
438 AS_IF([test "x$systemd" != "xn"],
439 [AC_MSG_NOTICE([systemd: yes])],
440 [AC_MSG_NOTICE([systemd: no])]
441 )
442 AS_IF([test "x$enable_remotebackend_zeromq" != "xno"],
443 [AC_MSG_NOTICE([ZeroMQ connector for remotebackend: yes])]
444 )
445 AS_IF([test -n "$GEOIP_LIBS"],
446 [AC_MSG_NOTICE([libgeoip for geoipbackend: yes])]
447 )
448 AS_IF([test -n "$MMDB_LIBS"],
449 [AC_MSG_NOTICE([libmaxminddb for geoipbackend: yes])]
450 )
451 AC_MSG_NOTICE([])