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