]> git.ipfire.org Git - thirdparty/pdns.git/blob - configure.ac
Merge pull request #12561 from rgacogne/ddist-test-protobuf-doh-tags-all-protocols
[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 getrandom arc4random])
156
157 AM_CONDITIONAL([HAVE_RECVMMSG], [test "x$ac_cv_func_recvmmsg" = "xyes"])
158
159 AS_IF([test "x$lt_cv_dlopen" = "xno"],
160 [AC_MSG_ERROR([Your system does not support dlopen])]
161 )
162
163 AC_SUBST([LIBDL], [$lt_cv_dlopen_libs])
164
165 PDNS_ENABLE_VERBOSE_LOGGING
166 PDNS_ENABLE_PKCS11
167 PDNS_ENABLE_GSS_TSIG
168
169 AC_SUBST([socketdir])
170 socketdir="/var/run"
171 AC_ARG_WITH([socketdir],
172 [AS_HELP_STRING([--with-socketdir], [where the controlsocket lives @<:@default=/var/run@:>@])],
173 [socketdir="$withval"]
174 )
175
176 modules="bind gmysql"
177 AC_ARG_WITH([modules],
178 [AS_HELP_STRING([--with-modules], [which backends to compile with @<:@default=bind gmysql@:>@])],
179 [modules="$withval"]
180 )
181
182 dynmodules="pipe"
183 AC_ARG_WITH([dynmodules],
184 [AS_HELP_STRING([--with-dynmodules], [which backends to build for dynamic loading @<:@default=pipe@:>@])],
185 [dynmodules="$withval"]
186 )
187
188 AC_SUBST([moduledirs])
189 AC_SUBST([moduleobjects])
190 AC_SUBST([modulelibs])
191 AC_DEFINE_UNQUOTED([PDNS_MODULES], "$modules", [Built-in modules])
192
193 AS_IF([test x"$modules" = "xno"], [modules=""])
194 AS_IF([test x"$dynmodules" = "xno"], [dynmodules=""])
195
196 for a in $modules $dynmodules; do
197 case "$a" in
198 godbc)
199 PDNS_WITH_UNIXODBC
200 ;;
201 gmysql)
202 PDNS_WITH_MYSQL
203 ;;
204 gpgsql)
205 PDNS_WITH_POSTGRESQL
206 ;;
207 gsqlite3)
208 needsqlite3=yes
209 ;;
210 ldap)
211 PDNS_CHECK_LDAP
212 needldap=yes
213 ;;
214 remote)
215 AS_IF([test "x$enable_unit_tests" = "xyes"],
216 [PDNS_CHECK_CURL_PROGRAM]
217 )
218 have_remotebackend=yes
219 ;;
220 tinydns)
221 needcdb=yes
222 PDNS_CHECK_CDB
223 ;;
224 geoip)
225 PDNS_CHECK_GEOIP
226 ;;
227 lua*)
228 dnl Lua has been checked above
229 ;;
230 lmdb)
231 needlmdb=yes
232 PDNS_CHECK_LMDB
233 BOOST_SERIALIZATION
234 ;;
235 esac
236 done
237
238 PDNS_ENABLE_REMOTEBACKEND_ZEROMQ
239
240 PDNS_ENABLE_TOOLS
241 PDNS_ENABLE_IXFRDIST
242
243 PDNS_WITH_LUA_RECORDS
244
245 AM_CONDITIONAL([LDAP], [test "x$needldap" = "xyes"])
246
247 PDNS_CHECK_SQLITE3
248 AM_CONDITIONAL([SQLITE3], [test "x$needsqlite3" = "xyes"])
249
250 AM_CONDITIONAL([LMDB], [test "x$needlmdb" != "x"])
251 AM_CONDITIONAL([HAVE_LMDB], [test "x$LMDB_LIBS" != "x"])
252
253 AS_IF([test "x$needlmdb" = "xyes"], [
254 AS_IF([test "$with_lmdb" = "no"], [
255 AC_MSG_ERROR([--with-lmdb is set to 'no', but lmdb support is required])
256 ])
257 AS_IF([test "x$HAVE_LMDB" != "x1"], [
258 AC_MSG_ERROR([lmdb not found via pkg-config, please install lmdb or set --with-lmdb to your lmdb installation directory])
259 ])
260 ])
261
262 AM_CONDITIONAL([CDB], [test "x$needcdb" != "x"])
263 AM_CONDITIONAL([HAVE_CDB], [test "x$CDB_LIBS" != "x"])
264
265 AS_IF([test "x$needcdb" = "xyes"], [
266 AS_IF([test "x$HAVE_CDB" != "x1"], [
267 AC_MSG_ERROR([cdb not found via pkg-config, please install cdb])
268 ])
269 ])
270
271 for a in $modules; do
272 AC_MSG_CHECKING([whether we can build module "${a}"])
273 if [[ -d "$srcdir/modules/${a}backend" ]]; then
274 AC_MSG_RESULT([yes])
275 moduledirs="$moduledirs ${a}backend"
276
277 for b in `cat $srcdir/modules/${a}backend/OBJECTFILES`; do
278 moduleobjects="$moduleobjects ../modules/${a}backend/$b"
279 done
280 modulelibs="$modulelibs `cat $srcdir/modules/${a}backend/OBJECTLIBS`"
281 else
282 AC_MSG_RESULT([no])
283 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.])
284 fi
285 done
286
287 for a in $dynmodules; do
288 AC_MSG_CHECKING([whether we can build dynamic module "${a}"])
289 if [[ -d "$srcdir/modules/${a}backend" ]]; then
290 AC_MSG_RESULT([yes])
291 moduledirs="$moduledirs ${a}backend"
292 else
293 AC_MSG_RESULT([no])
294 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.])
295 fi
296 done
297
298 AX_AVAILABLE_SYSTEMD
299 AX_CHECK_SYSTEMD_FEATURES
300 AM_CONDITIONAL([HAVE_SYSTEMD], [ test x"$systemd" = "xy" ])
301 PDNS_WITH_SERVICE_USER([pdns])
302
303 LDFLAGS="$RELRO_LDFLAGS $LDFLAGS"
304
305 CFLAGS="$PIE_CFLAGS $CFLAGS"
306 CXXFLAGS="$PIE_CFLAGS $CXXFLAGS"
307 PROGRAM_LDFLAGS="$PIE_LDFLAGS $PROGRAM_LDFLAGS"
308 AC_SUBST([PROGRAM_LDFLAGS])
309
310 PDNS_ENABLE_COVERAGE
311 PDNS_INIT_AUTO_VARS
312 PDNS_ENABLE_SANITIZERS
313 PDNS_ENABLE_MALLOC_TRACE
314 PDNS_ENABLE_LTO
315
316 AC_SUBST(LIBS)
317
318 AC_SUBST([AM_CPPFLAGS],
319 ["AS_ESCAPE([-I$(top_builddir) -I$(top_srcdir)]) $THREADFLAGS $BOOST_CPPFLAGS"]
320 )
321
322 AC_SUBST([YAHTTP_CFLAGS], ['-I$(top_srcdir)/ext/yahttp'])
323 AC_SUBST([YAHTTP_LIBS], ['$(top_builddir)/ext/yahttp/yahttp/libyahttp.la'])
324 AC_SUBST([IPCRYPT_CFLAGS], ['-I$(top_srcdir)/ext/ipcrypt'])
325 AC_SUBST([IPCRYPT_LIBS], ['$(top_builddir)/ext/ipcrypt/libipcrypt.la'])
326
327 CFLAGS="$SANITIZER_FLAGS $CFLAGS"
328 CXXFLAGS="$SANITIZER_FLAGS $CXXFLAGS"
329
330 CCVERSION=`$CC --version | head -1`
331 CXXVERSION=`$CXX --version | head -1`
332
333 AC_ARG_VAR(PACKAGEVERSION, [The version used in secpoll queries])
334 AS_IF([test "x$PACKAGEVERSION" != "x"],
335 [AC_DEFINE_UNQUOTED([PACKAGEVERSION], "$PACKAGEVERSION", [Set to the package version used for secpoll])]
336 )
337
338 export moduledirs moduleobjects modulelibs
339
340 AC_CONFIG_FILES([
341 Makefile
342 modules/Makefile
343 pdns/Makefile
344 codedocs/Makefile
345 docs/Makefile
346 pdns/pdns.init
347 ext/Makefile
348 ext/ipcrypt/Makefile
349 ext/yahttp/Makefile
350 ext/yahttp/yahttp/Makefile
351 ext/json11/Makefile
352 modules/bindbackend/Makefile
353 modules/geoipbackend/Makefile
354 modules/gmysqlbackend/Makefile
355 modules/godbcbackend/Makefile
356 modules/gpgsqlbackend/Makefile
357 modules/gsqlite3backend/Makefile
358 modules/ldapbackend/Makefile
359 modules/lmdbbackend/Makefile
360 modules/lua2backend/Makefile
361 modules/pipebackend/Makefile
362 modules/remotebackend/Makefile
363 modules/tinydnsbackend/Makefile
364 ])
365 AC_OUTPUT
366
367 AC_MSG_NOTICE([])
368 AC_MSG_NOTICE([Configuration summary])
369 AC_MSG_NOTICE([=====================])
370 AC_MSG_NOTICE([])
371 AC_MSG_NOTICE([Configured with: $pdns_configure_args])
372 AC_MSG_NOTICE([])
373 AC_MSG_NOTICE([CC: $CC ($CCVERSION)])
374 AC_MSG_NOTICE([CXX: $CXX ($CXXVERSION)])
375 AC_MSG_NOTICE([LD: $LD])
376 AC_MSG_NOTICE([CFLAGS: $CFLAGS])
377 AC_MSG_NOTICE([CPPFLAGS: $CPPFLAGS])
378 AC_MSG_NOTICE([CXXFLAGS: $CXXFLAGS])
379 AC_MSG_NOTICE([LDFLAGS: $LDFLAGS])
380 AC_MSG_NOTICE([LIBS: $LIBS])
381 AC_MSG_NOTICE([BOOST_CPPFLAGS: $BOOST_CPPFLAGS])
382 AC_MSG_NOTICE([])
383 AC_MSG_NOTICE([Extras enabled])
384 AC_MSG_NOTICE([--------------])
385 AS_IF([test "x$enable_tools" = "xyes"],
386 [AC_MSG_NOTICE([Tools: yes])],
387 [AC_MSG_NOTICE([Tools: no])]
388 )
389 AS_IF([test "x$enable_ixfrdist" = "xyes"],
390 [AC_MSG_NOTICE([ixfrdist: yes])],
391 [AC_MSG_NOTICE([ixfrdist: no])]
392 )
393 AC_MSG_NOTICE([])
394 AC_MSG_NOTICE([Server Features enabled])
395 AC_MSG_NOTICE([-----------------------])
396 AC_MSG_NOTICE([Built-in modules: $modules])
397 AC_MSG_NOTICE([Dynamic modules: $dynmodules])
398 AC_MSG_NOTICE([])
399 AS_IF([test "x$libcrypto_ecdsa" = "xyes"],
400 [AC_MSG_NOTICE([OpenSSL ecdsa: yes])],
401 [AC_MSG_NOTICE([OpenSSL ecdsa: no])]
402 )
403 AS_IF([test "x$LIBSODIUM_LIBS" != "x" || test "x$LIBDECAF_LIBS" != "x" || test "x$libcrypto_ed25519" = "xyes"],
404 [AC_MSG_NOTICE([ed25519: yes])],
405 [AC_MSG_NOTICE([ed25519: no])]
406 )
407 AS_IF([test "x$LIBDECAF_LIBS" != "x" || test "x$libcrypto_ed448" = "xyes"],
408 [AC_MSG_NOTICE([ed448: yes])],
409 [AC_MSG_NOTICE([ed448: no])]
410 )
411 AS_IF([test "x$needsqlite3" != "x"],
412 [AC_MSG_NOTICE([SQLite3: yes])],
413 [AC_MSG_NOTICE([SQLite3: no])]
414 )
415 AS_IF([test "x$LUAPC" != "x"],
416 [AC_MSG_NOTICE([Lua: $LUAPC])],
417 [AS_IF([test "x$LUAJITPC" != "x"],
418 [AC_MSG_NOTICE([LuaJit: $LUAJITPC])],
419 [AC_MSG_NOTICE([Lua/LuaJit: no])])
420 ])
421 AS_IF([test "x$enable_experimental_pkcs11" = "xyes"],
422 [AC_MSG_NOTICE([PKCS-11: yes])]
423 )
424 AS_IF([test "x$enable_experimental_gss_tsig" = "xyes"],
425 [AC_MSG_NOTICE([GSS-TSIG: yes])]
426 )
427 AS_IF([test "x$enable_lua_records" = "xyes"],
428 [AC_MSG_NOTICE([LUA records: yes])]
429 )
430 AS_IF([test "x$systemd" != "xn"],
431 [AC_MSG_NOTICE([systemd: yes])],
432 [AC_MSG_NOTICE([systemd: no])]
433 )
434 AS_IF([test "x$enable_remotebackend_zeromq" != "xno"],
435 [AC_MSG_NOTICE([ZeroMQ connector for remotebackend: yes])]
436 )
437 AS_IF([test -n "$GEOIP_LIBS"],
438 [AC_MSG_NOTICE([libgeoip for geoipbackend: yes])]
439 )
440 AS_IF([test -n "$MMDB_LIBS"],
441 [AC_MSG_NOTICE([libmaxminddb for geoipbackend: yes])]
442 )
443 AC_MSG_NOTICE([])