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