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