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