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