configure.ac revision 1.1.1.16 1 # Copyright (C) Internet Systems Consortium, Inc. ("ISC")
2 #
3 # SPDX-License-Identifier: MPL-2.0
4 #
5 # This Source Code Form is subject to the terms of the Mozilla Public
6 # License, v. 2.0. If a copy of the MPL was not distributed with this
7 # file, you can obtain one at https://mozilla.org/MPL/2.0/.
8 #
9 # See the COPYRIGHT file distributed with this work for additional
10 # information regarding copyright ownership.
11
12 #
13 # Defining the version in m4 requires a bit of dancing around,
14 # so the strings are properly concatenated, as you can't use
15 # a shell variable in AC_INIT
16 #
17 m4_define([bind_VERSION_MAJOR], 9)dnl
18 m4_define([bind_VERSION_MINOR], 18)dnl
19 m4_define([bind_VERSION_PATCH], 30)dnl
20 m4_define([bind_VERSION_EXTRA], )dnl
21 m4_define([bind_DESCRIPTION], [(Extended Support Version)])dnl
22 m4_define([bind_SRCID], [m4_esyscmd_s([git rev-parse --short HEAD | cut -b1-7])])dnl
23 m4_define([bind_PKG_VERSION], [[bind_VERSION_MAJOR.bind_VERSION_MINOR.bind_VERSION_PATCH]bind_VERSION_EXTRA])dnl
24
25 #
26 # Autoconf initialization
27 #
28 AC_INIT([BIND], bind_PKG_VERSION, [https://gitlab.isc.org/isc-projects/bind9/-/issues/new?issuable_template=Bug], [], [https://www.isc.org/downloads/])
29 AC_PREREQ([2.69])
30
31 AC_DEFINE([PACKAGE_VERSION_MAJOR], ["][bind_VERSION_MAJOR]["], [BIND 9 Major part of the version])
32 AC_DEFINE([PACKAGE_VERSION_MINOR], ["][bind_VERSION_MINOR]["], [BIND 9 Minor part of the version])
33 AC_DEFINE([PACKAGE_VERSION_PATCH], ["][bind_VERSION_PATCH]["], [BIND 9 Patch part of the version])
34 AC_DEFINE([PACKAGE_VERSION_EXTRA], ["][bind_VERSION_EXTRA]["], [BIND 9 Extra part of the version])
35 AC_DEFINE([PACKAGE_DESCRIPTION], [m4_ifnblank(bind_DESCRIPTION, [" ]bind_DESCRIPTION["], [])], [An extra string to print after PACKAGE_STRING])
36 AC_DEFINE([PACKAGE_SRCID], ["][bind_SRCID]["], [A short hash from git])
37
38 bind_CONFIGARGS="${ac_configure_args:-default}"
39 AC_DEFINE_UNQUOTED([PACKAGE_CONFIGARGS], ["$bind_CONFIGARGS"], [Either 'defaults' or used ./configure options])
40
41 AC_DEFINE([PACKAGE_BUILDER], ["make"], [make or Visual Studio])
42
43 #
44 # Get the Canonical System Type
45 #
46 AC_CANONICAL_BUILD
47 AC_CANONICAL_HOST
48 AC_CANONICAL_TARGET
49
50 AC_CONFIG_SRCDIR([bin/named/main.c])
51 AM_INIT_AUTOMAKE([1.14 tar-pax foreign subdir-objects dist-xz no-dist-gzip -Wall -Werror])
52 AM_SILENT_RULES([yes])
53 AM_EXTRA_RECURSIVE_TARGETS([test unit doc])
54
55 AC_CONFIG_HEADERS([config.h])
56 AC_CONFIG_MACRO_DIR([m4])
57
58 #
59 # Enable maintainer mode by default only when building from git repository
60 # and not cross compling
61 #
62 AS_IF([test "$cross_compiling" = no],
63 [AM_MAINTAINER_MODE(m4_ifset([bind_SRCID],[enable],[disable]))],
64 [AM_MAINTAINER_MODE([disable])])
65
66 #
67 # Enable system extensions to C and POSIX
68 #
69 AC_USE_SYSTEM_EXTENSIONS
70
71 #
72 # Compiler compatibility flags
73 #
74 m4_version_prereq([2.70],
75 [AC_PROG_CC],
76 [AC_PROG_CC_C99])
77 AC_PROG_CPP_WERROR
78
79 #
80 # Find build compiler when cross compiling
81 #
82 AX_PROG_CC_FOR_BUILD
83
84 #
85 # Find the machine's endian flavor.
86 #
87 AC_C_BIGENDIAN
88
89 #
90 # Enable large file support
91 #
92 AC_SYS_LARGEFILE
93 AC_FUNC_FSEEKO
94
95 # Enable RFC 3542 APIs on macOS
96 AC_DEFINE([__APPLE_USE_RFC_3542], [1], [Select RFC3542 IPv6 API on macOS])
97
98 AC_PROG_MAKE_SET
99
100 # Checks for programs.
101 m4_ifdef([AM_PROG_AR], [AM_PROG_AR]) # call AM_PROG_AR only if available
102
103 AC_PROG_INSTALL
104 AC_PROG_LN_S
105 AX_POSIX_SHELL
106 AC_PROG_MKDIR_P
107
108 # Initialize libtool
109 LT_INIT([disable-static dlopen pic-only])
110
111 AS_IF([test "$enable_static" != "no" && test "$enable_developer" != "yes"],
112 [AC_MSG_ERROR([Static linking is not supported as it disables dlopen() and certain security features (e.g. RELRO, ASLR)])])
113
114 #
115 # Set the default CFLAGS, CPPFLAGS, and LDFLAGS
116 #
117 STD_CFLAGS="-Wall -Wextra -Wwrite-strings -Wpointer-arith -Wno-missing-field-initializers -Wformat -Wshadow"
118
119 # These should be always errors
120 STD_CFLAGS="$STD_CFLAGS -Werror=implicit-function-declaration -Werror=missing-prototypes -Werror=format-security -Werror=parentheses -Werror=implicit -Werror=strict-prototypes -Werror=vla"
121
122 STD_LDFLAGS=""
123
124 # ... except in test code
125 TEST_CFLAGS="-Wno-vla"
126
127 # Fortify the sources by default
128 STD_CPPFLAGS="-D_FORTIFY_SOURCE=2"
129
130 #
131 # Additional compiler settings.
132 #
133 AX_CHECK_COMPILE_FLAG([-fno-strict-aliasing],
134 [STD_CFLAGS="$STD_CFLAGS -fno-strict-aliasing"])
135 # Clang only issues a warning so use -Werror to force a error.
136 AX_CHECK_COMPILE_FLAG([-Werror -fno-delete-null-pointer-checks],
137 [STD_CFLAGS="$STD_CFLAGS -fno-delete-null-pointer-checks"])
138 AX_CHECK_COMPILE_FLAG([-fdiagnostics-show-option],
139 [STD_CFLAGS="$STD_CFLAGS -fdiagnostics-show-option"])
140
141 AX_CHECK_LINK_FLAG([-Wl,--export-dynamic],
142 [STD_LDFLAGS="$STD_LDFLAGS -Wl,--export-dynamic"])
143
144 host_macos=no
145 AS_CASE([$host],[*-darwin*],[host_macos=yes])
146 AM_CONDITIONAL([HOST_MACOS], [test "$host_macos" = "yes"])
147
148 #
149 # Change defaults for developers if not explicity set.
150 # Needs to be before the option is tested.
151 #
152 # [pairwise: --enable-developer, --disable-developer]
153 AC_ARG_ENABLE([developer],
154 [AS_HELP_STRING([--enable-developer],
155 [enable developer build settings])])
156
157 AS_IF([test "$enable_developer" = "yes"],
158 [DEVELOPER_MODE=yes
159 STD_CPPFLAGS="$STD_CPPFLAGS -DISC_MEM_DEFAULTFILL=1 -DISC_MEM_TRACKLINES=1 -DISC_LIST_CHECKINIT=1"
160 test "${enable_fixed_rrset+set}" = set || enable_fixed_rrset=yes
161 test "${enable_querytrace+set}" = set || enable_querytrace=yes
162 test "${with_cmocka+set}" = set || with_cmocka=yes
163 test "${with_zlib+set}" = set || with_zlib=yes
164 test "${enable_warn_error+set}" = set || enable_warn_error=yes
165 ])
166
167 AC_SUBST([DEVELOPER_MODE])
168 AC_SUBST([STD_CFLAGS])
169 AC_SUBST([STD_CPPFLAGS])
170 AC_SUBST([STD_LDFLAGS])
171 AC_SUBST([TEST_CFLAGS])
172
173 # [pairwise: --enable-warn-error, --disable-warn-error]
174 AC_ARG_ENABLE([warn_error],
175 [AS_HELP_STRING([--enable-warn-error],
176 [turn on -Werror when compiling])],
177 [],[enable_warn_error=no])
178 AS_IF([test "$enable_warn_error" = "yes"],
179 [STD_CFLAGS="$STD_CFLAGS -Werror"])
180
181 #
182 # Use pkg-config
183 #
184
185 PKG_PROG_PKG_CONFIG
186 AS_IF([test -z "$PKG_CONFIG"],
187 [AC_MSG_ERROR([The pkg-config script could not be found or is too old.])])
188
189 # Fuzzing is not included in pairwise testing as fuzzing tools are
190 # not present in the relevant Docker image.
191 #
192 # [pairwise: skip]
193 AC_ARG_ENABLE([fuzzing],
194 [AS_HELP_STRING([--enable-fuzzing=<afl|libfuzzer|ossfuzz>],
195 [Enable fuzzing using American Fuzzy Lop or libFuzzer (default=no)])],
196 [],
197 [enable_fuzzing=no])
198
199 AC_MSG_CHECKING([whether to enable fuzzing mode])
200 AS_CASE([$enable_fuzzing],
201 [no],[AC_MSG_RESULT([no])],
202 [afl],[
203 AC_MSG_RESULT([using AFL])
204 AC_DEFINE([ENABLE_AFL], [1],
205 [Define to enable American Fuzzy Lop test harness])
206 STD_CFLAGS="$STD_CFLAGS -DFUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION=1"
207 FUZZ_LOG_COMPILER="afl.sh"],
208 [libfuzzer],[
209 AC_MSG_RESULT([using libFuzzer])
210 STD_CFLAGS="$STD_CFLAGS -DFUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION=1 -fsanitize=fuzzer-no-link,address,undefined"
211 LDFLAGS="$LDFLAGS -fsanitize=address,undefined"
212 FUZZ_LDFLAGS="-fsanitize=fuzzer,address,undefined"
213 FUZZ_LOG_COMPILER="libfuzzer.sh"],
214 [ossfuzz],[
215 AC_MSG_RESULT([using OSS-Fuzz])
216 FUZZ_LDFLAGS="$LIB_FUZZING_ENGINE"],
217 [*],[AC_MSG_ERROR([You need to explicitly select the fuzzer])])
218 AM_CONDITIONAL([HAVE_FUZZ_LOG_COMPILER], [test -n "$FUZZ_LOG_COMPILER"])
219 AC_SUBST([FUZZ_LOG_COMPILER])
220 AC_SUBST([FUZZ_LDFLAGS])
221
222 AS_IF([test "$enable_fuzzing" = "afl"],
223 [AC_MSG_CHECKING("for AFL enabled compiler")
224 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],
225 [#ifndef __AFL_COMPILER
226 #error AFL compiler required
227 #endif
228 ])],
229 [AC_MSG_RESULT([yes])],
230 [AC_MSG_ERROR([set CC=afl-<gcc|clang> when --enable-fuzzing=afl is used])])
231 ])
232
233 #
234 # Perl is optional; it is used only by some of the system test scripts.
235 #
236 AC_PATH_PROGS([PERL], [perl5 perl])
237 AC_SUBST([PERL])
238 AM_CONDITIONAL([HAVE_PERL], [test -n "$PERL"])
239
240 #
241 # Python is optional, it is used only by some of the system test scripts.
242 #
243 AM_PATH_PYTHON([3.6], [], [:])
244 AM_CONDITIONAL([HAVE_PYTHON], [test "$PYTHON" != ":"])
245
246 AC_PATH_PROGS([PYTEST], [pytest-3 py.test-3 pytest py.test pytest-pypy], [])
247 AS_IF([test -z "$PYTEST"],
248 [AC_MSG_WARN([pytest not found, some system tests will be skipped])])
249 AC_SUBST([PYTEST])
250 AM_CONDITIONAL([HAVE_PYTEST], [test -n "$PYTEST"])
251
252 #
253 # xsltproc is optional, it is used only by system test scripts.
254 #
255 AC_PATH_PROG([XSLTPROC], [xsltproc])
256
257 #
258 # Using Solaris linker with gcc on Solaris breaks Thread Local Storage
259 #
260 AS_CASE([$host],
261 [*-solaris*],[
262 AS_IF([test "$GCC" = "yes"],
263 [LDFLAGS="$LDFLAGS -zrelax=transtls"
264 AC_MSG_WARN([When using GNU C Compiler on Solaris, -zrelax=transtls linker flag is used to fix bug in Thread Local Storage])
265 ])
266 ])
267
268 AC_CHECK_HEADERS([sys/param.h sys/socket.h])
269 AC_CHECK_HEADERS([fcntl.h regex.h sys/time.h unistd.h sys/mman.h sys/sockio.h sys/select.h sys/sysctl.h net/if6.h net/route.h linux/netlink.h linux/rtnetlink.h], [], [],
270 [$ac_includes_default
271 #ifdef HAVE_SYS_PARAM_H
272 # include <sys/param.h>
273 #endif
274 #ifdef HAVE_SYS_SOCKET_H
275 # include <sys/socket.h>
276 #endif
277 ])
278
279 #
280 # Check for thread local storage
281 #
282 AC_CHECK_HEADERS([threads.h])
283 AX_TLS([AS_IF([test "$ac_cv_tls" != "thread_local"],
284 [AC_DEFINE_UNQUOTED([thread_local], [$ac_cv_tls], [Define if the compiler uses a different keyword than thread_local for TLS variables])])],
285 [AC_MSG_ERROR([Thread Local Storage support required, update your toolchain to build BIND 9])])
286
287 AC_C_CONST
288 AC_C_INLINE
289 AC_C_VOLATILE
290
291 #
292 # Check for yield support on ARM processors
293 #
294 AS_CASE([$host],
295 [arm*],
296 [AC_MSG_CHECKING([for yield instruction support])
297 AC_COMPILE_IFELSE(
298 [AC_LANG_PROGRAM([[]],
299 [[__asm__ __volatile__ ("yield")]])],
300 [AC_MSG_RESULT([yes])
301 AC_DEFINE([HAVE_ARM_YIELD], [1],
302 [define if the ARM yield instruction is available])],
303 [AC_MSG_RESULT([no])])])
304
305 #
306 # Check for pause support on SPARC processors
307 #
308 AS_CASE([$host],
309 [sparc*],
310 [AC_MSG_CHECKING([for pause instruction support])
311 AC_COMPILE_IFELSE(
312 [AC_LANG_PROGRAM([[]],
313 [[__asm__ __volatile__ ("pause")]])],
314 [AC_MSG_RESULT([yes])
315 AC_DEFINE([HAVE_SPARC_PAUSE], [1],
316 [define if the SPARC pause instruction is available])],
317 [AC_MSG_RESULT([no])])])
318
319 AC_CHECK_FUNCS([sysctlbyname])
320
321 #
322 # Older versions of HP/UX don't define seteuid() and setegid()
323 #
324 AC_CHECK_FUNCS([seteuid setresuid])
325 AC_CHECK_FUNCS([setegid setresgid])
326
327 AC_TYPE_SIZE_T
328 AC_TYPE_SSIZE_T
329 AC_TYPE_UINTPTR_T
330
331 #
332 # check for uname library routine
333 #
334 AC_MSG_CHECKING([for uname])
335 AC_COMPILE_IFELSE(
336 [AC_LANG_PROGRAM(
337 [[#include <sys/utsname.h>
338 #include <stdio.h>
339 ]],
340 [[
341 struct utsname uts;
342 uname(&uts);
343 printf("running on %s %s %s for %s\n",
344 uts.sysname, uts.release, uts.version, uts.machine);
345 ]])],
346 [AC_MSG_RESULT(yes)
347 AC_DEFINE([HAVE_UNAME], [1], [define if uname is available])
348 ],
349 [AC_MSG_RESULT(no)
350 AC_MSG_WARN([uname is not correctly supported])
351 ])
352
353 #
354 # check for GCC noreturn attribute
355 #
356 AX_GCC_FUNC_ATTRIBUTE([noreturn])
357
358 #
359 # check for GCC malloc attribute
360 #
361 AX_GCC_FUNC_ATTRIBUTE([malloc])
362
363 AC_MSG_CHECKING([for extended malloc attributes])
364 AC_COMPILE_IFELSE(
365 [AC_LANG_PROGRAM(
366 [[
367 #include <stddef.h>
368 #include <stdlib.h>
369 __attribute__ ((malloc, malloc (free, 1))
370 void * xmalloc(size_t sz) { return malloc(sz); }
371 ]],
372 [[
373 void *p = xmalloc(8);
374 free(p);
375 ]])],
376 [AC_MSG_RESULT(yes)
377 AC_DEFINE([HAVE_MALLOC_EXT_ATTR], [1], [define if extended attributes for malloc are available])
378 ],
379 [AC_MSG_RESULT(no)])
380
381 #
382 # check for GCC returns_nonnull attribute
383 #
384 AX_GCC_FUNC_ATTRIBUTE([returns_nonnull])
385
386 #
387 # GeoIP support?
388 #
389 # Should be on by default if libmaxminddb exists.
390 #
391 # [pairwise: --enable-geoip --with-maxminddb=auto, --enable-geoip --with-maxminddb=yes, --disable-geoip]
392 AC_ARG_ENABLE([geoip],
393 [AS_HELP_STRING([--disable-geoip],
394 [support GeoIP2 geolocation ACLs if available [default=yes]])],
395 [], [enable_geoip="yes"])
396
397 # [pairwise: skip]
398 AC_ARG_WITH([maxminddb],
399 [AS_HELP_STRING([--with-maxminddb=PATH],
400 [Build with MaxMind GeoIP2 support (auto|yes|no|path) [default=auto]])],
401 [], [with_maxminddb="auto"])
402
403 AS_IF([test "$enable_geoip" = "yes"],
404 [AS_CASE([$with_maxminddb],
405 [no],[AC_MSG_ERROR([Use '--disable-geoip' to disable the GeoIP])],
406 [auto],[PKG_CHECK_MODULES([MAXMINDDB], [libmaxminddb],
407 [AC_DEFINE([HAVE_GEOIP2], [1], [Build with GeoIP2 support])
408 PKG_CHECK_VAR([MAXMINDDB_PREFIX], [libmaxminddb], [prefix], [], [AC_MSG_ERROR([libmaxminddb prefix not found in pkg-config; set MAXMINDDB_PREFIX in the environment])])
409 ],[:])],
410 [yes],[PKG_CHECK_MODULES([MAXMINDDB], [libmaxminddb],
411 [AC_DEFINE([HAVE_GEOIP2], [1], [Build with GeoIP2 support])
412 PKG_CHECK_VAR([MAXMINDDB_PREFIX], [libmaxminddb], [prefix], [], [AC_MSG_ERROR([libmaxminddb prefix not found in pkg-config; set MAXMINDDB_PREFIX in the environment])])
413 ])],
414 [ # default
415 AX_SAVE_FLAGS([maxminddb])
416 MAXMINDDB_CFLAGS="-I$with_maxminddb/include"
417 MAXMINDDB_LIBS="-L$with_maxminddb/lib"
418 CFLAGS="$CFLAGS $MAXMINDDB_CFLAGS"
419 LIBS="$LIBS $MAXMINDDB_LIBS"
420 AC_SEARCH_LIBS([MMDB_open], [maxminddb],
421 [AC_DEFINE([HAVE_GEOIP2], [1], [Build with GeoIP2 support])
422 MAXMINDDB_LIBS="$MAXMINDDB_LIBS $ac_cv_search_MMDB_open"
423 AC_MSG_NOTICE([GeoIP2 default database path set to $with_maxminddb/share/GeoIP])
424 AS_VAR_COPY([MAXMINDDB_PREFIX], [with_maxminddb])
425 ],
426 [AC_MSG_ERROR([GeoIP2 requested, but libmaxminddb not found])])
427 AX_RESTORE_FLAGS([maxminddb])
428 ])
429 AC_ARG_VAR([MAXMINDDB_PREFIX], [value of prefix for MAXMINDDB, overriding pkg-config])
430 ])
431
432 AM_CONDITIONAL([HAVE_GEOIP2], [test -n "$MAXMINDDB_LIBS"])
433
434 AC_SUBST([MAXMINDDB_CFLAGS])
435 AC_SUBST([MAXMINDDB_LIBS])
436
437 AX_PTHREAD
438
439 LIBS="$PTHREAD_LIBS $LIBS"
440 CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
441 CC="$PTHREAD_CC"
442
443 AC_CHECK_FUNCS([pthread_attr_getstacksize pthread_attr_setstacksize pthread_barrier_init])
444
445 # [pairwise: --with-locktype=adaptive, --with-locktype=standard]
446 AC_ARG_WITH([locktype],
447 AS_HELP_STRING([--with-locktype=ARG],
448 [Specify mutex lock type
449 (adaptive or standard)]),
450 [], [with_locktype="adaptive"])
451
452 AS_CASE([$with_locktype],
453 [adaptive],[
454 AC_MSG_CHECKING([for PTHREAD_MUTEX_ADAPTIVE_NP])
455 AC_COMPILE_IFELSE(
456 [AC_LANG_PROGRAM(
457 [[
458 #ifndef _GNU_SOURCE
459 #define _GNU_SOURCE
460 #endif
461 #include <pthread.h>
462 ]],
463 [[
464 return (PTHREAD_MUTEX_ADAPTIVE_NP);
465 ]]
466 )],
467 [AC_MSG_RESULT([using adaptive lock type])
468 AC_DEFINE([HAVE_PTHREAD_MUTEX_ADAPTIVE_NP], 1,
469 [Support for PTHREAD_MUTEX_ADAPTIVE_NP]) ],
470 [AC_MSG_RESULT([using standard lock type])]
471 )],
472 [standard],[AC_MSG_RESULT([using standard lock type])],
473 [AC_MSG_ERROR([You must specify "adaptive" or "standard" for --with-locktype.])]
474 )
475
476 AC_CHECK_HEADERS([sched.h])
477
478 AC_SEARCH_LIBS([sched_yield],[rt])
479 AC_CHECK_FUNCS([sched_yield pthread_yield pthread_yield_np])
480
481 # Look for functions relating to thread naming
482 AC_CHECK_FUNCS([pthread_setname_np pthread_set_name_np])
483 AC_CHECK_HEADERS([pthread_np.h], [], [], [#include <pthread.h>])
484
485 # libuv
486 PKG_CHECK_MODULES([LIBUV], [libuv >= 1.37.0], [],
487 [PKG_CHECK_MODULES([LIBUV], [libuv >= 1.0.0 libuv < 1.35.0], [],
488 [AC_MSG_ERROR([libuv >= 1.0.0 (except 1.35.0 and 1.36.0) not found])])])
489
490 AX_SAVE_FLAGS([libuv])
491 CFLAGS="$CFLAGS $LIBUV_CFLAGS"
492 LIBS="$LIBS $LIBUV_LIBS"
493
494 # libuv recvmmsg support
495 AC_CHECK_DECLS([UV_UDP_MMSG_FREE, UV_UDP_MMSG_CHUNK], [], [], [[#include <uv.h>]])
496 AC_MSG_CHECKING([whether struct msghdr uses padding for alignment])
497 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <sys/socket.h>],
498 [const struct msghdr h = { .__pad1 = 0, .__pad2 = 0 };])],
499 [AC_MSG_RESULT([yes])
500 AC_DEFINE([HAVE_DECL_UV_UDP_RECVMMSG],
501 [0], [Disable recvmmsg support on systems with MUSL glibc])],
502 [AC_MSG_RESULT([no])
503 AC_CHECK_DECLS([UV_UDP_RECVMMSG], [], [], [[#include <uv.h>]])])
504
505 AX_RESTORE_FLAGS([libuv])
506
507 # [pairwise: --enable-doh --with-libnghttp2=auto, --enable-doh --with-libnghttp2=yes, --disable-doh]
508 AC_ARG_ENABLE([doh],
509 [AS_HELP_STRING([--disable-doh], [disable DNS over HTTPS, removes dependency on libnghttp2 (default is --enable-doh)])],
510 [], [enable_doh=yes])
511
512 # [pairwise: skip]
513 AC_ARG_WITH([libnghttp2],
514 [AS_HELP_STRING([--with-libnghttp2],
515 [build with libnghttp2 library [yes|no|auto] (default is auto)])],
516 [], [with_libnghttp2="auto"])
517
518 AS_IF([test "$enable_doh" = "yes"],
519 [AS_CASE([$with_libnghttp2],
520 [no],[AC_MSG_ERROR([Use '--disable-doh' to disable DNS-over-HTTPS support])],
521 [auto|yes],[PKG_CHECK_MODULES([LIBNGHTTP2], [libnghttp2 >= 1.6.0],
522 [AC_DEFINE([HAVE_LIBNGHTTP2], [1], [Build with DNS-over-HTTPS support])],
523 [AC_MSG_ERROR(m4_normalize([DNS-over-HTTPS support requested, but libnghttp2 not found.
524 Either install libnghttp2 or use --disable-doh.]))])],
525 [AC_MSG_ERROR([Specifying libnghttp2 installation path is not supported, adjust PKG_CONFIG_PATH instead])])])
526
527 AM_CONDITIONAL([HAVE_LIBNGHTTP2], [test -n "$LIBNGHTTP2_LIBS"])
528
529
530 #
531 # flockfile is usually provided by pthreads
532 #
533 AC_CHECK_FUNCS([flockfile getc_unlocked])
534
535 #
536 # Look for sysconf or other ways to allow detection of the number of processors.
537 #
538 AC_CHECK_FUNCS([sysconf])
539 AC_CHECK_FUNCS(sysconf sched_getaffinity cpuset_getaffinity)
540 AC_CHECK_HEADERS([sys/cpuset.h], [], [],
541 [$ac_includes_default
542 #ifdef HAVE_SYS_PARAM_H
543 # include <sys/param.h>
544 #endif
545 ])
546
547 #
548 # Do we want to use pthread rwlock?
549 #
550 # [pairwise: --enable-pthread-rwlock, --disable-pthread-rwlock]
551 AC_ARG_ENABLE([pthread_rwlock],
552 [AS_HELP_STRING([--enable-pthread-rwlock],
553 [use pthread rwlock instead of internal rwlock implementation])],
554 [], [enable_pthread_rwlock=no])
555
556 AS_IF([test "$enable_pthread_rwlock" = "yes"],
557 [AC_CHECK_FUNCS([pthread_rwlock_rdlock], [],
558 [AC_MSG_ERROR([pthread_rwlock_rdlock requested but not found])])
559 AC_DEFINE([USE_PTHREAD_RWLOCK],[1],[Define if you want to use pthread rwlock implementation])
560 ])
561
562 CRYPTO=OpenSSL
563
564 #
565 # OpenSSL/LibreSSL is mandatory
566 #
567 PKG_CHECK_MODULES([OPENSSL], [libssl libcrypto], [],
568 [AX_CHECK_OPENSSL([:],[AC_MSG_FAILURE([OpenSSL/LibreSSL not found])])])
569
570 AX_SAVE_FLAGS([openssl])
571
572 CFLAGS="$CFLAGS $OPENSSL_CFLAGS"
573 LIBS="$LIBS $OPENSSL_LIBS"
574
575 AC_MSG_CHECKING([for OpenSSL >= 1.0.0 or LibreSSL >= 2.7.0])
576 AC_COMPILE_IFELSE(
577 [AC_LANG_PROGRAM([[#include <openssl/opensslv.h>]],
578 [[#if (!defined(LIBRESSL_VERSION_NUMBER) && (OPENSSL_VERSION_NUMBER < 0x1000000fL)) || \\
579 (defined(LIBRESSL_VERSION_NUMBER) && (LIBRESSL_VERSION_NUMBER < 0x02070000fL))
580 #error OpenSSL >= 1.0.0 or LibreSSL >= 2.7.0 required
581 #endif
582 ]])],
583 [AC_MSG_RESULT([yes])],
584 [AC_MSG_FAILURE([not found])])
585
586 #
587 # Check for functions added in OpenSSL or LibreSSL
588 #
589
590 AC_CHECK_FUNCS([BIO_read_ex BIO_write_ex])
591 AC_CHECK_FUNCS([BN_GENCB_new])
592 AC_CHECK_FUNCS([CRYPTO_zalloc])
593 AC_CHECK_FUNCS([ERR_get_error_all])
594 AC_CHECK_FUNCS([EVP_CIPHER_CTX_new EVP_CIPHER_CTX_free])
595 AC_CHECK_FUNCS([EVP_MD_CTX_new EVP_MD_CTX_free EVP_MD_CTX_reset EVP_MD_CTX_get0_md])
596 AC_CHECK_FUNCS([EVP_PKEY_new_raw_private_key EVP_PKEY_eq])
597 AC_CHECK_FUNCS([OPENSSL_init_ssl OPENSSL_init_crypto OPENSSL_cleanup])
598 AC_CHECK_FUNCS([SSL_CTX_set_keylog_callback])
599 AC_CHECK_FUNCS([SSL_CTX_set_min_proto_version])
600 AC_CHECK_FUNCS([SSL_CTX_up_ref])
601 AC_CHECK_FUNCS([SSL_read_ex SSL_peek_ex SSL_write_ex])
602 AC_CHECK_FUNCS([SSL_CTX_set1_cert_store X509_STORE_up_ref])
603 AC_CHECK_FUNCS([SSL_SESSION_is_resumable])
604
605 #
606 # Check for algorithm support in OpenSSL
607 #
608
609 AC_CHECK_FUNCS([EVP_DigestSignInit EVP_DigestVerifyInit], [:],
610 [AC_MSG_FAILURE([EVP_DigestSignInit/EVP_DigestVerifyInit support in OpenSSL is mandatory.])])
611
612 AC_MSG_CHECKING([for ECDSA P-256 support])
613 AC_COMPILE_IFELSE(
614 [AC_LANG_PROGRAM([[#include <openssl/evp.h>]],
615 [[EVP_PKEY_CTX *kctx = EVP_PKEY_CTX_new_id(NID_X9_62_prime256v1, NULL);]])],
616 [AC_MSG_RESULT([yes])],
617 [AC_MSG_FAILURE([not found. ECDSA P-256 support in OpenSSL is mandatory.])])
618
619 AC_MSG_CHECKING([for ECDSA P-384 support])
620 AC_COMPILE_IFELSE(
621 [AC_LANG_PROGRAM([[#include <openssl/evp.h>]],
622 [[EVP_PKEY_CTX *kctx = EVP_PKEY_CTX_new_id(NID_secp384r1, NULL);]])],
623 [AC_MSG_RESULT([yes])],
624 [AC_MSG_FAILURE([not found. ECDSA P-384 support in OpenSSL is mandatory.])])
625
626 AC_MSG_CHECKING([for Ed25519 support])
627 AC_COMPILE_IFELSE(
628 [AC_LANG_PROGRAM([[#include <openssl/evp.h>]],
629 [[EVP_PKEY_CTX *kctx = EVP_PKEY_CTX_new_id(NID_ED25519, NULL);]])],
630 [AC_DEFINE([HAVE_OPENSSL_ED25519], [1], [define if OpenSSL supports Ed25519])
631 AC_MSG_RESULT([yes])],
632 [AC_MSG_RESULT([no])])
633
634 AC_MSG_CHECKING([for Ed448 support])
635 AC_COMPILE_IFELSE(
636 [AC_LANG_PROGRAM([[#include <openssl/evp.h>]],
637 [[EVP_PKEY_CTX *kctx = EVP_PKEY_CTX_new_id(NID_ED448, NULL);]])],
638 [AC_DEFINE([HAVE_OPENSSL_ED448], [1], [define if OpenSSL supports Ed448])
639 AC_MSG_RESULT([yes])],
640 [AC_MSG_RESULT([no])])
641
642 #
643 # Check for OpenSSL SHA-1 support
644 #
645 AC_CHECK_FUNCS([EVP_sha1], [:],
646 [AC_MSG_FAILURE([SHA-1 support in OpenSSL is mandatory.])])
647
648 #
649 # Check for OpenSSL SHA-2 support
650 #
651 AC_CHECK_FUNCS([EVP_sha224 EVP_sha256 EVP_sha384 EVP_sha512], [:],
652 [AC_MSG_FAILURE([SHA-2 support in OpenSSL is mandatory.])])
653
654 #
655 # Check for OpenSSL AES support
656 #
657 AC_CHECK_FUNCS([EVP_aes_128_ecb EVP_aes_192_ecb EVP_aes_256_ecb], [:],
658 [AC_MSG_FAILURE([AES support in OpenSSL is mandatory.])])
659
660 #
661 # Check for OpenSSL 1.1.x/LibreSSL functions
662 #
663 AC_CHECK_FUNCS([DH_get0_key ECDSA_SIG_get0 RSA_set0_key EVP_PKEY_get0_EC_KEY])
664
665 AC_CHECK_FUNCS([TLS_server_method TLS_client_method])
666
667 #
668 # Check whether FIPS mode is available and whether we should enable it
669 #
670 # FIPS is not included in pairwise testing as the relevant Docker image
671 # does not support FIPS mode.
672 #
673 # [pairwise: skip]
674 AC_ARG_ENABLE([fips-mode],
675 [AS_HELP_STRING([--enable-fips-mode],
676 [enable FIPS mode in OpenSSL library [default=no]])],
677 [], [enable_fips_mode="no"])
678
679 AC_MSG_CHECKING([whether to enable FIPS mode in OpenSSL library])
680 AS_CASE([$enable_fips_mode],
681 [yes], [AC_MSG_RESULT([yes])
682 AC_CHECK_FUNCS([FIPS_mode],
683 [], [AC_MSG_FAILURE([OpenSSL FIPS mode requested but not available.])])],
684 [no], [AC_MSG_RESULT([no])])
685
686 AX_RESTORE_FLAGS([openssl])
687
688 AC_SUBST([OPENSSL_CFLAGS])
689 AC_SUBST([OPENSSL_LIBS])
690
691 AC_CHECK_FUNCS([clock_gettime])
692
693 # [pairwise: --with-gssapi=yes, --with-gssapi=auto, --without-gssapi]
694 AC_ARG_WITH([gssapi],
695 [AS_HELP_STRING([--with-gssapi=[PATH|[/path/]krb5-config]],
696 [Specify path for system-supplied GSSAPI
697 [default=auto]])],
698 [], [with_gssapi="auto"])
699
700 KRB5_CONFIG=
701 AS_CASE([$with_gssapi],
702 [no],[AC_MSG_CHECKING([for GSSAPI support])
703 AC_MSG_RESULT([no])],
704 [yes],[AC_PATH_PROG([KRB5_CONFIG], [krb5-config])
705 AS_IF([test -z "$KRB5_CONFIG"],
706 [AC_MSG_ERROR([krb5-config required but not found])])],
707 [auto],[AC_PATH_PROG([KRB5_CONFIG], [krb5-config])],
708 [*krb5-config*],[KRB5_CONFIG="$with_gssapi"],
709 [AC_MSG_ERROR([--with-gssapi requires yes|no|auto|/path/to/krb5-config])])
710
711 GSSAPI_CFLAGS=
712 GSSAPI_LIBS=
713 KRB5_CFLAGS=
714 KRB5_LIBS=
715 AS_IF([test -n "$KRB5_CONFIG"],
716 [AC_MSG_CHECKING([for gssapi libraries])
717 AX_SAVE_FLAGS([gssapi])
718 GSSAPI_CFLAGS=`"$KRB5_CONFIG" --cflags gssapi`
719 GSSAPI_LIBS=`"$KRB5_CONFIG" --libs gssapi`
720 CFLAGS="$CFLAGS $GSSAPI_CFLAGS"
721 LIBS="$LIBS $GSSAPI_LIBS"
722 AC_MSG_RESULT([$GSSAPI_CFLAGS $GSSAPI_LIBS])
723 AC_CHECK_HEADERS([gssapi/gssapi.h], [],
724 [AC_CHECK_HEADERS([gssapi.h], [],
725 [AC_MSG_ERROR([neither gssapi/gssapi.h nor gssapi.h found])])])
726 AC_CHECK_HEADERS([gssapi/gssapi_krb5.h],
727 [AC_CHECK_HEADERS([gssapi_krb5.h], []
728 [AC_MSG_ERROR([neither gssapi/gssapi_krb5.h nor gssapi_krb5.h found])])])
729 AC_CHECK_FUNCS([gss_acquire_cred],[],
730 [AC_MSG_ERROR([linking with $GSSAPI_LIBS does not work])])
731 AX_RESTORE_FLAGS([gssapi])
732
733 AC_MSG_CHECKING([for krb5 libraries])
734 AX_SAVE_FLAGS([krb5])
735 KRB5_CFLAGS=`"$KRB5_CONFIG" --cflags krb5`
736 KRB5_LIBS=`$KRB5_CONFIG --libs krb5`
737 CFLAGS="$CFLAGS $KRB5_CFLAGS"
738 LIBS="$CFLAGS $KRB5_LIBS"
739 AC_MSG_RESULT([$KRB5_CFLAGS $KRB5_LIBS])
740 AC_CHECK_HEADERS([krb5/krb5.h], [],
741 [AC_CHECK_HEADERS([krb5.h], [],
742 [AC_MSG_ERROR([neither krb5/krb5.h nor krb5 found])])])
743 AC_CHECK_FUNCS([krb5_init_context], [],
744 [AC_MSG_ERROR([linking with $KRB5_LIBS failed])])
745 AX_RESTORE_FLAGS([krb5])
746
747 AC_DEFINE([HAVE_GSSAPI], [1], [Define to 1 if you have the Kerberos Framework available])
748 # kludge to silence compiler warnings which recommend use of GSS.framework on macOS
749 AS_CASE([$host],[*-darwin*],[CFLAGS="$CFLAGS -Wno-deprecated-declarations"])])
750 AM_CONDITIONAL([HAVE_GSSAPI], [test -n "$GSSAPI_LIBS"])
751 AC_SUBST([GSSAPI_CFLAGS])
752 AC_SUBST([GSSAPI_LIBS])
753 AC_SUBST([KRB5_CFLAGS])
754 AC_SUBST([KRB5_LIBS])
755
756 #
757 # was --with-lmdb specified?
758 #
759
760 # [pairwise: --with-lmdb=auto, --with-lmdb=yes, --without-lmdb]
761 AC_ARG_WITH([lmdb],
762 [AS_HELP_STRING([--with-lmdb=@<:@PATH@:>@],
763 [use LMDB library @<:@default=auto@:>@, optionally specify the prefix for lmdb library])],
764 [:],
765 [with_lmdb="auto"])
766
767 ac_lib_lmdb_found=no
768 AS_CASE([$with_lmdb],
769 [no],[],
770 [auto|yes], [PKG_CHECK_MODULES([LMDB], [lmdb],
771 [ac_lib_lmdb_found=yes],
772 [for ac_lib_lmdb_path in /usr /usr/local /opt /opt/local; do
773 AX_LIB_LMDB([$ac_lib_lmdb_path],
774 [ac_lib_lmdb_found=yes
775 break])
776 done
777 ])],
778 [AX_LIB_LMDB([$with_lmdb],[ac_lib_lmdb_found=yes])])
779
780 # don't fail when in automatic mode
781 AS_IF([test "$with_lmdb" = "auto" && test "$ac_lib_lmdb_found" = "no"],
782 [with_lmdb=no])
783
784 # hard fail when LMDB requested, but not found
785 AS_IF([test "$with_lmdb" != "no" && test "$ac_lib_lmdb_found" != "yes"],
786 [AC_MSG_ERROR([LMDB requested, but not found])])
787
788 AS_IF([test "$ac_lib_lmdb_found" = "yes"],
789 [AC_DEFINE([HAVE_LMDB], [1], [Use lmdb library])])
790
791 AC_SUBST([LMDB_CFLAGS])
792 AC_SUBST([LMDB_LIBS])
793 AM_CONDITIONAL([HAVE_LMDB], [test -n "$LMDB_LIBS"])
794
795 #
796 # was --with-libxml2 specified?
797 #
798 # [pairwise: --with-libxml2=auto, --with-libxml2=yes, --without-libxml2]
799 AC_ARG_WITH([libxml2],
800 [AS_HELP_STRING([--with-libxml2],
801 [build with libxml2 library [yes|no|auto] (default is auto)])],
802 [], [with_libxml2="auto"])
803
804 AS_CASE([$with_libxml2],
805 [no],[],
806 [auto],[PKG_CHECK_MODULES([LIBXML2], [libxml-2.0 >= 2.6.0],
807 [AC_DEFINE([HAVE_LIBXML2], [1], [Use libxml2 library])],
808 [:])],
809 [yes],[PKG_CHECK_MODULES([LIBXML2], [libxml-2.0 >= 2.6.0],
810 [AC_DEFINE([HAVE_LIBXML2], [1], [Use libxml2 library])])],
811 [AC_MSG_ERROR([Specifying libxml2 installation path is not supported, adjust PKG_CONFIG_PATH instead])])
812
813 AM_CONDITIONAL([HAVE_LIBXML2], [test -n "$LIBXML2_LIBS"])
814
815 #
816 # was --with-json-c specified?
817 #
818 # [pairwise: --with-json-c=detect, --with-json-c=yes, --without-json-c]
819 AC_ARG_WITH([json-c],
820 [AS_HELP_STRING([--with-json-c],
821 [build with json-c library [yes|no|detect] (default is detect)])],
822 [], [with_json_c="detect"])
823
824 AS_CASE([$with_json_c],
825 [no],[],
826 [detect],[PKG_CHECK_MODULES([JSON_C], [json-c >= 0.11],
827 [AC_DEFINE([HAVE_JSON_C], [1], [Use json-c library])],
828 [:])],
829 [yes],[PKG_CHECK_MODULES([JSON_C], [json-c >= 0.11],
830 [AC_DEFINE([HAVE_JSON_C], [1], [Use json-c library])])],
831 [AC_MSG_ERROR([Specifying json-c installation path is not supported, adjust PKG_CONFIG_PATH instead])]
832 )
833
834 AM_CONDITIONAL([HAVE_JSON_C], [test -n "$JSON_C_LIBS"])
835
836 AC_SUBST([JSON_C_CFLAGS])
837 AC_SUBST([JSON_C_LIBS])
838
839 #
840 # was --with-zlib specified?
841 #
842 # [pairwise: --with-zlib=auto, --with-zlib=yes, --without-zlib]
843 AC_ARG_WITH([zlib],
844 [AS_HELP_STRING([--with-zlib],
845 [build with zlib for HTTP compression
846 [default=yes]])],
847 [], with_zlib="auto")
848
849 AS_CASE([$with_zlib],
850 [no],[],
851 [auto],[PKG_CHECK_MODULES([ZLIB], [zlib],
852 [AC_DEFINE([HAVE_ZLIB], [1], [Use zlib library])],
853 [:])],
854 [yes],[PKG_CHECK_MODULES([ZLIB], [zlib],
855 [AC_DEFINE([HAVE_ZLIB], [1], [Use zlib library])])],
856 [AC_MSG_ERROR([Specifying zlib installation path is not supported, adjust PKG_CONFIG_PATH instead])])
857 AC_SUBST([ZLIB_CFLAGS])
858 AC_SUBST([ZLIB_LIBS])
859
860 #
861 # Check if the system supports glibc-compatible backtrace() function.
862 #
863 AC_CHECK_HEADERS([execinfo.h],
864 [AC_SEARCH_LIBS([backtrace_symbols], [execinfo],
865 [AC_CHECK_FUNCS([backtrace_symbols])])])
866
867 #
868 # We do the IPv6 compilation checking after libtool so that we can put
869 # the right suffix on the files.
870 #
871 AC_MSG_CHECKING([for IPv6 structures])
872 AC_COMPILE_IFELSE(
873 [AC_LANG_PROGRAM(
874 [[
875 #include <sys/types.h>
876 #include <sys/socket.h>
877 #include <netinet/in.h>
878 ]],
879 [[
880 struct sockaddr_in6 sin6;
881 struct in6_addr in6;
882 struct in6_pktinfo in6_pi;
883 struct sockaddr_storage storage;
884 in6 = in6addr_any;
885 in6 = in6addr_loopback;
886 sin6.sin6_scope_id = 0;
887 return (0);
888 ]])],
889 [AC_MSG_RESULT([yes])],
890 [AC_MSG_FAILURE([IPv6 support is mandatory])])
891
892 #
893 # Allow forcibly disabling TCP Fast Open support as autodetection might yield
894 # confusing results on some systems (e.g. FreeBSD; see set_tcp_fastopen()
895 # comment in lib/isc/socket.c).
896 #
897 # [pairwise: --enable-tcp-fastopen, --disable-tcp-fastopen]
898 AC_ARG_ENABLE([tcp_fastopen],
899 [AS_HELP_STRING([--disable-tcp-fastopen],
900 [disable TCP Fast Open support [default=yes]])],
901 [], [enable_tcp_fastopen="yes"])
902
903 AS_IF([test "$enable_tcp_fastopen" = "yes"],
904 [AC_DEFINE([ENABLE_TCP_FASTOPEN], [1], [define if you want TCP_FASTOPEN enabled if available])])
905
906 #
907 # Check for some other useful functions that are not ever-present.
908 #
909 AC_CHECK_FUNCS([strlcpy strlcat strnstr])
910
911 #
912 # Check for readline support
913 #
914
915 # editline is not included in pairwise testing as the library
916 # is not present in the relevant Docker image.
917 #
918 # GNU Readline is not included in pairwise testing as the library
919 # in the relevant Docker image does not support pkg-config.
920 #
921 # [pairwise: --with-readline=auto, --with-readline=yes, --with-readline=libedit, --without-readline]
922 AC_ARG_WITH([readline],
923 [AS_HELP_STRING([--with-readline=yes|no|libedit|readline],
924 [specify readline library [default auto]])],
925 [], [with_readline="auto"])
926
927 AS_CASE([$with_readline],
928 [no],[],
929 [auto|yes],
930 [PKG_CHECK_MODULES([READLINE], [libedit],
931 [AC_DEFINE([HAVE_READLINE_LIBEDIT], [1], [Build with libedit support])],
932 [PKG_CHECK_MODULES([READLINE], [libeditline],
933 [AC_DEFINE([HAVE_READLINE_EDITLINE], [1], [Build with editline support.])],
934 [PKG_CHECK_MODULES([READLINE], [readline],
935 [AC_DEFINE([HAVE_READLINE_READLINE], [1], [Build with readline support.])],
936 [AS_IF([test "$with_readline" = "yes"],
937 [AC_MSG_ERROR([readline support requested, but none of the libraries have been found.])])])])])],
938 [libedit],
939 [PKG_CHECK_MODULES([READLINE], [libedit],
940 [AC_DEFINE([HAVE_READLINE_LIBEDIT], [1], [Build with libedit support])])],
941 [editline],
942 [PKG_CHECK_MODULES([READLINE], [libeditline],
943 [AC_DEFINE([HAVE_READLINE_EDITLINE], [1], [Build with editline support])])],
944 [readline],
945 [PKG_CHECK_MODULES([READLINE], [readline],
946 [AC_DEFINE([HAVE_READLINE_READLINE], [1], [Build with readline support])])],
947 [AC_MSG_ERROR([Unknown readline '$with_readline' library requested.])])
948 AM_CONDITIONAL([HAVE_READLINE], [test -n "$READLINE_LIBS"])
949 AC_SUBST([READLINE_CFLAGS])
950 AC_SUBST([READLINE_LIBS])
951
952 #
953 # Security Stuff
954 #
955 # Note it is very recommended to *not* disable chroot(),
956 # this is only because chroot() was made obsolete by Posix.
957 #
958 # [pairwise: --enable-chroot, --disable-chroot]
959 AC_ARG_ENABLE(chroot, AS_HELP_STRING([--disable-chroot], [disable chroot]))
960 case "$enable_chroot" in
961 yes|'')
962 AC_CHECK_FUNCS(chroot)
963 ;;
964 no)
965 ;;
966 esac
967
968 LIBCAP_LIBS=""
969 AC_MSG_CHECKING([whether to enable Linux capabilities])
970
971 # [pairwise: --enable-linux-caps, --disable-linux-caps]
972 AC_ARG_ENABLE([linux-caps],
973 [AS_HELP_STRING([--disable-linux-caps],
974 [disable Linux capabilities])],
975 [],
976 [AS_CASE([$host],
977 [*-linux*],[enable_linux_caps=yes],
978 [enable_linux_caps=no])])
979
980 AS_IF([test "$enable_linux_caps" = "yes"],
981 [AC_MSG_RESULT([yes])
982 AC_CHECK_HEADERS([sys/capability.h],
983 [],
984 [AC_MSG_ERROR(m4_normalize([sys/capability.h header is required for Linux capabilities support.
985 Either install libcap or use --disable-linux-caps.]))])
986 AX_SAVE_FLAGS([cap])
987 AC_SEARCH_LIBS([cap_set_proc], [cap],
988 [LIBCAP_LIBS="$ac_cv_search_cap_set_proc"],
989 [AC_MSG_ERROR(m4_normalize([libcap is required for Linux capabilities support.
990 Either install libcap or use --disable-linux-caps.]))])
991 AX_RESTORE_FLAGS([cap])],
992 [AC_MSG_RESULT([no])])
993 AC_SUBST([LIBCAP_LIBS])
994
995 case "$host" in
996 *-solaris*)
997 AC_DEFINE(NEED_SECURE_DIRECTORY, 1,
998 [Define if connect does not honour the permission on the UNIX domain socket.])
999 ;;
1000 esac
1001
1002 #
1003 # Time Zone Stuff
1004 #
1005 AC_CHECK_FUNCS([tzset])
1006
1007 AC_MSG_CHECKING(for optarg declaration)
1008 AC_COMPILE_IFELSE(
1009 [AC_LANG_PROGRAM(
1010 [[#include <unistd.h>]],
1011 [[optarg = 0;]]
1012 )],
1013 [AC_MSG_RESULT(yes)],
1014 [AC_MSG_RESULT(no)
1015 GEN_NEED_OPTARG="-DNEED_OPTARG=1"
1016 AC_DEFINE(NEED_OPTARG, 1, [Defined if extern char *optarg is not declared.])]
1017 )
1018
1019 #
1020 # Check for nanoseconds in file stats
1021 #
1022 AC_MSG_CHECKING([for st_mtim.tv_nsec])
1023 AC_COMPILE_IFELSE(
1024 [AC_LANG_PROGRAM(
1025 [[#include <sys/stat.h>]],
1026 [[struct stat s;
1027 return(s.st_mtim.tv_nsec);
1028 ]])],
1029 [AC_MSG_RESULT([yes])
1030 AC_DEFINE([HAVE_STAT_NSEC], [1], [define if struct stat has st_mtim.tv_nsec field])],
1031 [AC_MSG_RESULT([no])])
1032
1033 #
1034 # Check for if_nametoindex() for IPv6 scoped addresses support
1035 #
1036 AC_CHECK_FUNCS([if_nametoindex])
1037
1038 ISC_ATOMIC_LIBS=""
1039 AC_CHECK_HEADERS(
1040 [stdatomic.h],
1041 [AC_MSG_CHECKING([for memory model aware atomic operations])
1042 AC_COMPILE_IFELSE(
1043 [AC_LANG_PROGRAM(
1044 [[#include <stdatomic.h>]],
1045 [[atomic_int_fast32_t val = 0; atomic_fetch_add_explicit(&val, 1, memory_order_relaxed);]]
1046 )],
1047 [AC_MSG_RESULT([stdatomic.h])
1048 AC_MSG_CHECKING([whether -latomic is needed for 64-bit stdatomic.h functions])
1049 AC_LINK_IFELSE(
1050 [AC_LANG_PROGRAM(
1051 [[#include <stdatomic.h>]],
1052 [[atomic_int_fast64_t val = 0; atomic_fetch_add_explicit(&val, 1, memory_order_relaxed);]]
1053 )],
1054 [AC_MSG_RESULT([no])],
1055 [ISC_ATOMIC_LIBS="-latomic"
1056 AX_SAVE_FLAGS([atomic])
1057 LIBS="$LIBS $ISC_ATOMIC_LIBS"
1058 AC_LINK_IFELSE(
1059 [AC_LANG_PROGRAM(
1060 [[#include <stdatomic.h>]],
1061 [[atomic_int_fast64_t val = 0; atomic_fetch_add_explicit(&val, 1, memory_order_relaxed);]]
1062 )],
1063 [AC_MSG_RESULT([yes])],
1064 [AC_MSG_FAILURE([libatomic needed, but linking with -latomic failed, please fix your toolchain.])])
1065 AX_RESTORE_FLAGS([atomic])
1066 ])
1067 ],
1068 [AC_MSG_FAILURE([stdatomic.h header found, but compilation failed, please fix your toolchain.])]
1069 )],
1070 [AC_MSG_CHECKING([for memory model aware atomic operations])
1071 AC_COMPILE_IFELSE(
1072 [AC_LANG_PROGRAM(
1073 [[#include <inttypes.h>]],
1074 [[int32_t val = 0; __atomic_fetch_add(&val, 1, __ATOMIC_RELAXED);]]
1075 )],
1076 [AC_MSG_RESULT([__atomic builtins])
1077 AC_DEFINE([HAVE___ATOMIC], [1], [define if __atomic builtins are not available])
1078 AC_MSG_CHECKING([whether -latomic is needed for 64-bit __atomic builtins])
1079 AC_LINK_IFELSE(
1080 [AC_LANG_PROGRAM(
1081 [[#include <inttypes.h>]],
1082 [[int64_t val = 0; __atomic_fetch_add(&val, 1, __ATOMIC_RELAXED);]]
1083 )],
1084 [AC_MSG_RESULT([no])],
1085 [ISC_ATOMIC_LIBS="-latomic"
1086 AX_SAVE_FLAGS([atomic])
1087 LIBS="$LIBS $ISC_ATOMIC_LIBS"
1088 AC_LINK_IFELSE(
1089 [AC_LANG_PROGRAM(
1090 [[#include <inttypes.h>]],
1091 [[int64_t val = 0; __atomic_fetch_add(&val, 1, __ATOMIC_RELAXED);]]
1092 )],
1093 [AC_MSG_RESULT([yes])],
1094 [AC_MSG_FAILURE([libatomic needed, but linking with -latomic failed, please fix your toolchain.])])
1095 AX_RESTORE_FLAGS([atomic])
1096 ])
1097 ],
1098 [AC_MSG_FAILURE([not found])
1099 ])
1100 ])
1101 LIBS="$LIBS $ISC_ATOMIC_LIBS"
1102
1103 AC_CHECK_HEADERS([stdalign.h stdnoreturn.h])
1104
1105 AC_CHECK_HEADERS([uchar.h])
1106
1107 #
1108 # Check for __builtin_unreachable
1109 #
1110 AC_MSG_CHECKING([compiler support for __builtin_unreachable()])
1111 AC_LINK_IFELSE(
1112 [AC_LANG_PROGRAM(
1113 [[]],
1114 [[__builtin_unreachable();]]
1115 )],
1116 [AC_MSG_RESULT([yes])
1117 AC_DEFINE([HAVE_BUILTIN_UNREACHABLE], [1], [define if the compiler supports __builtin_unreachable().])
1118 ],
1119 [AC_MSG_RESULT([no])
1120 ])
1121
1122 #
1123 # Check for __builtin_clz
1124 #
1125 AC_MSG_CHECKING([compiler support for __builtin_clz])
1126 AC_LINK_IFELSE(
1127 [AC_LANG_PROGRAM(
1128 [[]],
1129 [[return (__builtin_clz(0xff) == 24 ? 1 : 0);]]
1130 )],
1131 [AC_MSG_RESULT([yes])
1132 AC_DEFINE(HAVE_BUILTIN_CLZ, 1, [Define to 1 if the compiler supports __builtin_clz.])
1133 ],
1134 [AC_MSG_RESULT([no])]
1135 )
1136
1137 #
1138 # Check for __builtin_uadd_overflow
1139 #
1140 AC_MSG_CHECKING([compiler support for __builtin_*_overflow()])
1141 AC_LINK_IFELSE(
1142 [AC_LANG_PROGRAM(
1143 [[#include <limits.h>]],
1144 [[return (__builtin_uadd_overflow(UINT_MAX, UINT_MAX, &(unsigned int){ 0 }));]]
1145 )],
1146 [AC_MSG_RESULT([yes])
1147 AC_DEFINE([HAVE_BUILTIN_OVERFLOW], [1], [define if the compiler supports __builtin_*_overflow().])
1148 ],
1149 [AC_MSG_RESULT([no])
1150 ])
1151
1152 #
1153 # Activate "rrset-order fixed" or not?
1154 #
1155 # [pairwise: --enable-fixed-rrset, --disable-fixed-rrset]
1156 AC_ARG_ENABLE([fixed-rrset],
1157 [AS_HELP_STRING([--enable-fixed-rrset],
1158 [enable fixed rrset ordering [default=no]])],
1159 [], [enable_fixed_rrset="no"])
1160 AS_IF([test "$enable_fixed_rrset" = "yes"],
1161 [AC_DEFINE([DNS_RDATASET_FIXED], [1],
1162 [Define to enable "rrset-order fixed" syntax.])])
1163
1164 #
1165 # Activate dnstap?
1166 #
1167 # [pairwise: --enable-dnstap, --disable-dnstap]
1168 AC_ARG_ENABLE([dnstap],
1169 [AS_HELP_STRING([--enable-dnstap],
1170 [enable dnstap support
1171 (requires fstrm, protobuf-c)])],
1172 [], [enable_dnstap=no])
1173
1174 AS_IF([test "$enable_dnstap" != "no"],
1175 [PKG_CHECK_MODULES([DNSTAP], [libfstrm libprotobuf-c], [],
1176 [AC_MSG_FAILURE([Required libraries (fstrm, protobuf-c) were not found, please install them.])])
1177 AC_PATH_PROG([FSTRM_CAPTURE], [fstrm_capture])
1178 AC_PATH_PROG([PROTOC_C], [protoc-c])
1179 AS_IF([test -z "$PROTOC_C"],
1180 [AC_MSG_ERROR([protoc-c compiler not found])])
1181 AC_DEFINE([HAVE_DNSTAP], 1, [Define to 1 to enable dnstap support])
1182 ])
1183
1184 AC_SUBST([DNSTAP_CFLAGS])
1185 AC_SUBST([DNSTAP_LIBS])
1186 AM_CONDITIONAL([HAVE_DNSTAP], [test "$enable_dnstap" != "no"])
1187 #
1188 # The following sections deal with tools used for formatting
1189 # the documentation. They are all optional, unless you are
1190 # a developer editing the documentation source.
1191 #
1192
1193 #
1194 # Look for sphinx-build
1195 #
1196 AC_ARG_VAR([SPHINX_BUILD], [path to sphinx-build binary used to build the documentation])
1197 AC_PATH_PROG([SPHINX_BUILD], [sphinx-build], [])
1198 AM_CONDITIONAL([HAVE_SPHINX_BUILD], [test -n "$SPHINX_BUILD"])
1199
1200 AC_PATH_PROG([XELATEX], [xelatex], [])
1201 AC_PATH_PROG([LATEXMK], [latexmk], [])
1202 AM_CONDITIONAL([HAVE_XELATEX], [test -n "$XELATEX" && test -n "$LATEXMK"])
1203
1204 #
1205 # Build the man pages only if we have prebuilt manpages or we can build them from RST sources
1206 #
1207 AM_CONDITIONAL([BUILD_MANPAGES], [test -e doc/man/named.conf.5in || test -n "$SPHINX_BUILD"])
1208
1209 #
1210 # Pull release date from changelog.rst file last modification date
1211 # for reproducible builds
1212 #
1213 release_date=`date -u -r doc/arm/changelog.rst +%Y-%m-%d`
1214 AC_SUBST([RELEASE_DATE], $release_date)
1215
1216 #
1217 # Look for Doxygen
1218 #
1219 AC_PATH_PROGS([DOXYGEN], [doxygen])
1220
1221 AC_CONFIG_FILES([doc/doxygen/doxygen-input-filter],
1222 [chmod +x doc/doxygen/doxygen-input-filter])
1223
1224 #
1225 # Look for curl
1226 #
1227
1228 AC_PATH_PROG(CURL, curl, curl)
1229 AC_SUBST(CURL)
1230
1231 #
1232 # Look for nc
1233 #
1234
1235 AC_PATH_PROGS(NC, nc, nc)
1236 AC_SUBST(NC)
1237
1238 #
1239 # IDN support using libidn2
1240 #
1241
1242 LIBIDN2_CFLAGS=
1243 LIBIDN2_LIBS=
1244
1245 # [pairwise: --with-libidn2=yes, --without-libidn2]
1246 AC_ARG_WITH([libidn2],
1247 [AS_HELP_STRING([--with-libidn2[=PATH]], [enable IDN support using GNU libidn2 [yes|no(default)|path]])],
1248 [with_libidn2="$withval"], [with_libidn2="no"])
1249 AS_CASE([$with_libidn2],
1250 [yes], [PKG_CHECK_MODULES([LIBIDN2], [libidn2],
1251 [AC_DEFINE([HAVE_LIBIDN2], [1], [Define if libidn2 was found])])],
1252 [no], [],
1253 [*], [AX_SAVE_FLAGS([libidn2])
1254 LIBIDN2_CFLAGS="-I$with_libidn2/include"
1255 LIBIDN2_LIBS="-L$with_libidn2/lib"
1256 CFLAGS="$CFLAGS $LIBIDN2_CFLAGS"
1257 LIBS="$LIBS $LIBIDN2_LIBS"
1258 AC_CHECK_HEADERS([idn2.h],
1259 [],
1260 [AC_MSG_ERROR([idn2.h not found])])
1261 AC_SEARCH_LIBS([idn2_to_ascii_lz], [idn2],
1262 [LIBIDN2_LIBS="$LIBIDN2_LIBS $ac_cv_search_idn2_to_ascii_lz"
1263 AC_DEFINE([HAVE_LIBIDN2], [1], [Define if libidn2 was found])],
1264 [AC_MSG_ERROR([libidn2 requested, but not found])])
1265 AX_RESTORE_FLAGS([libidn2])])
1266 AC_SUBST([LIBIDN2_CFLAGS])
1267 AC_SUBST([LIBIDN2_LIBS])
1268
1269 #
1270 # Check whether to build with cmocka unit testing framework
1271 #
1272 # [pairwise: --with-cmocka=detect, --with-cmocka=yes, --without-cmocka]
1273 AC_ARG_WITH([cmocka],
1274 [AS_HELP_STRING([--with-cmocka=detect],[enable CMocka based tests (default is detect)])],
1275 [],[with_cmocka=detect])
1276
1277 AS_CASE([$with_cmocka],
1278 [no],[],
1279 [detect],[PKG_CHECK_MODULES([CMOCKA], [cmocka >= 1.1.3],
1280 [AC_DEFINE([HAVE_CMOCKA], [1], [Use CMocka])
1281 with_cmocka=yes],[with_cmocka=no])],
1282 [yes],[PKG_CHECK_MODULES([CMOCKA], [cmocka >= 1.1.3],
1283 [AC_DEFINE([HAVE_CMOCKA], [1], [Use CMocka])])],
1284 [AC_MSG_ERROR([Use PKG_CONFIG_PATH to specify path to CMocka library])]
1285 )
1286 AC_SUBST([CMOCKA_CFLAGS])
1287 AC_SUBST([CMOCKA_LIBS])
1288
1289 AM_CONDITIONAL([HAVE_CMOCKA], [test "$with_cmocka" = "yes"])
1290
1291 #
1292 # Compile with jemalloc (either provided as package or wired in the system on FreeBSD)
1293 #
1294 # [pairwise: --with-jemalloc=detect, --with-jemalloc=yes, --without-jemalloc]
1295 AC_ARG_WITH([jemalloc],
1296 [AS_HELP_STRING([--with-jemalloc=detect],[enable jemalloc memory allocator (default is detect)])],
1297 [],[with_jemalloc=detect])
1298
1299 AS_CASE([$with_jemalloc],
1300 [no],[],
1301 [yes],[AX_CHECK_JEMALLOC(
1302 [AC_DEFINE([HAVE_JEMALLOC], [1], [Define to 1 if jemalloc is available])],
1303 [AC_MSG_ERROR([jemalloc not found])])],
1304 [AX_CHECK_JEMALLOC(
1305 [AC_DEFINE([HAVE_JEMALLOC], [1], [Define to 1 if jemalloc is available])
1306 with_jemalloc=yes],
1307 [AC_MSG_WARN([jemalloc not found; performance will be reduced])
1308 with_jemalloc=no])])
1309
1310 AS_IF([test "$with_jemalloc" = "no"],
1311 [AS_CASE([$host],
1312 [*-freebsd*],[AC_MSG_ERROR([You cannot compile without jemalloc; jemalloc is the system allocator on FreeBSD])])])
1313
1314 AM_CONDITIONAL([HAVE_JEMALLOC], [test "$with_jemalloc" = "yes"])
1315
1316 #
1317 # was --with-tuning specified?
1318 #
1319 # [pairwise: --with-tuning=small, --without-tuning]
1320 AC_ARG_WITH([tuning],
1321 AS_HELP_STRING([--with-tuning=ARG],
1322 [Specify server tuning (default or small)]),
1323 [],[with_tuning=no])
1324
1325 AS_CASE([$with_tuning],
1326 [small],[AC_MSG_NOTICE(using small system tuning)],
1327 [AC_DEFINE(TUNE_LARGE, 1, [Define to use default system tuning.])
1328 AC_MSG_NOTICE(using default system tuning)])
1329
1330 #
1331 # was --enable-querytrace or --enable-singletrace specified?
1332 #
1333 # [pairwise: --enable-singletrace --enable-querytrace, --disable-singletrace --enable-querytrace, --disable-singletrace --disable-querytrace]
1334 AC_ARG_ENABLE([singletrace],
1335 AS_HELP_STRING([--enable-singletrace],
1336 [enable single-query trace logging
1337 [default=no]]),
1338 enable_singletrace="$enableval", enable_singletrace="no")
1339
1340 AC_MSG_CHECKING([whether to enable single-query trace logging])
1341 case "$enable_singletrace" in
1342 yes)
1343 enable_querytrace=yes
1344 AC_MSG_RESULT(yes)
1345 AC_DEFINE(WANT_SINGLETRACE, 1, [Define to enable single-query tracing.])
1346 ;;
1347 no)
1348 AC_MSG_RESULT(no)
1349 ;;
1350 *)
1351 AC_MSG_ERROR("--enable-singletrace requires yes or no")
1352 ;;
1353 esac
1354
1355 # [pairwise: skip]
1356 AC_ARG_ENABLE(querytrace,
1357 AS_HELP_STRING([--enable-querytrace],
1358 [enable very verbose query trace logging
1359 [default=no]]),
1360 enable_querytrace="$enableval",
1361 enable_querytrace="$enable_singletrace")
1362
1363 AC_MSG_CHECKING([whether to enable query trace logging])
1364 case "$enable_querytrace" in
1365 yes)
1366 AC_MSG_RESULT(yes)
1367 AC_DEFINE(WANT_QUERYTRACE, 1, [Define to enable very verbose query trace logging.])
1368 ;;
1369 no)
1370 AS_IF([test "$enable_singletrace" = "yes"],
1371 [AC_MSG_ERROR([--enable-singletrace requires --enable-querytrace])])
1372 AC_MSG_RESULT(no)
1373 ;;
1374 *)
1375 AC_MSG_ERROR("--enable-querytrace requires yes or no (not $enable_querytrace)")
1376 ;;
1377 esac
1378
1379 #
1380 # Was --disable-auto-validation specified?
1381 #
1382
1383 validation_default=auto
1384
1385 # [pairwise: --enable-auto-validation, --disable-auto-validation]
1386 AC_ARG_ENABLE(auto-validation,
1387 AS_HELP_STRING([--enable-auto-validation],
1388 [turn on DNSSEC validation by default, using the IANA root key [default=yes]]),
1389 [:],[enable_auto_validation=yes])
1390 AS_IF([test "$enable_auto_validation" = "no"],[validation_default=yes])
1391 AC_DEFINE_UNQUOTED([VALIDATION_DEFAULT], ["$validation_default"], [the default value of dnssec-validation option])
1392
1393 #
1394 #
1395 # Response policy rewriting using DNS Response Policy Service (DNSRPS)
1396 # interface.
1397 #
1398 # DNSRPS can be compiled into BIND everywhere with a reasonably
1399 # modern C compiler. It is enabled on systems with dlopen() and librpz.so.
1400 #
1401 dnsrps_avail=yes
1402 AC_MSG_CHECKING([for librpz __attribute__s])
1403 AC_COMPILE_IFELSE(
1404 [AC_LANG_PROGRAM(
1405 [[]],
1406 [[
1407 extern void f(char *p __attribute__((unused)), ...)
1408 __attribute__((format(printf,1,2))) __attribute__((__noreturn__));
1409 ]])],
1410 [
1411 librpz_have_attr=yes
1412 AC_DEFINE([LIBRPZ_HAVE_ATTR], [1], [have __attribute__s used in librpz.h])
1413 AC_MSG_RESULT([yes])
1414 ],[
1415 librpz_have_attr=no
1416 AC_MSG_RESULT([no])
1417 ])
1418
1419 # [pairwise: --enable-dnsrps --enable-dnsrps-dl, --disable-dnsrps]
1420 AC_ARG_ENABLE([dnsrps-dl],
1421 [AS_HELP_STRING([--enable-dnsrps-dl],
1422 [DNS Response Policy Service delayed link
1423 [default=$librpz_dl]])],
1424 [enable_librpz_dl="$enableval"], [enable_librpz_dl="$with_dlopen"])
1425
1426 AS_IF([test "$enable_librpz_dl" = "yes" -a "$with_dlopen" = "no"],
1427 [AC_MSG_ERROR([DNS Response Policy Service delayed link requires dlopen to be enabled])])
1428
1429 # [pairwise: skip]
1430 AC_ARG_WITH([dnsrps-libname],
1431 [AS_HELP_STRING([--with-dnsrps-libname],
1432 [DNSRPS provider library name (librpz.so)])],
1433 [librpz_name="$withval"], [librpz_name="librpz.so"])
1434
1435 # [pairwise: skip]
1436 AC_ARG_WITH([dnsrps-dir],
1437 [AS_HELP_STRING([--with-dnsrps-dir],
1438 [path to DNSRPS provider library])],
1439 [librpz_path="$withval/$librpz_name"], [librpz_path="$librpz_name"])
1440 AC_DEFINE_UNQUOTED([DNSRPS_LIBRPZ_PATH], ["$librpz_path"],
1441 [dnsrps $librpz_name])
1442 AS_IF([test "$enable_librpz_dl" = "yes"],
1443 [
1444 dnsrps_lib_open=2
1445 ],[
1446 dnsrps_lib_open=1
1447 # Add librpz.so to linked libraries if we are not using dlopen()
1448 AC_SEARCH_LIBS([librpz_client_create], [rpz], [],
1449 [dnsrps_lib_open=0
1450 dnsrps_avail=no])
1451 ])
1452 AC_DEFINE_UNQUOTED([DNSRPS_LIB_OPEN], [$dnsrps_lib_open],
1453 [0=no DNSRPS 1=static link 2=dlopen()])
1454
1455 # [pairwise: skip]
1456 AC_ARG_ENABLE([dnsrps],
1457 AS_HELP_STRING([--enable-dnsrps],
1458 [enable DNS Response Policy Service API]),
1459 [enable_dnsrps=$enableval], [enable_dnsrps=no])
1460
1461 AS_IF([test "$enable_dnsrps" != "no"],[
1462 AS_IF([test "$dnsrps_avail" != "yes"],
1463 [AC_MSG_ERROR([dlopen and librpz.so needed for DNSRPS])])
1464 AS_IF([test "$dnsrps_lib_open" = "0"],
1465 [AC_MSG_ERROR([dlopen and librpz.so needed for DNSRPS])])
1466 AC_DEFINE([USE_DNSRPS], [1], [Enable DNS Response Policy Service API])
1467 ])
1468
1469 AC_CHECK_HEADERS([glob.h])
1470
1471 #
1472 # Support for constructor and destructor attributes
1473 #
1474 AX_GCC_FUNC_ATTRIBUTE([constructor])
1475 AX_GCC_FUNC_ATTRIBUTE([destructor])
1476
1477 #
1478 # Files to configure. These are listed here because we used to
1479 # specify them as arguments to AC_OUTPUT.
1480 #
1481
1482 # Top
1483
1484 AC_CONFIG_FILES([Makefile])
1485
1486 # Binaries
1487
1488 AC_CONFIG_FILES([bin/Makefile
1489 bin/named/Makefile
1490 bin/rndc/Makefile
1491 bin/dig/Makefile
1492 bin/delv/Makefile
1493 bin/dnssec/Makefile
1494 bin/tools/Makefile
1495 bin/nsupdate/Makefile
1496 bin/check/Makefile
1497 bin/confgen/Makefile
1498 bin/plugins/Makefile])
1499
1500 # Libraries
1501
1502 AC_CONFIG_FILES([lib/Makefile
1503 lib/isc/Makefile
1504 lib/dns/Makefile
1505 lib/ns/Makefile
1506 lib/irs/Makefile
1507 lib/isccfg/Makefile
1508 lib/isccc/Makefile
1509 lib/bind9/Makefile])
1510
1511 # Documentation
1512
1513 AC_CONFIG_FILES([doc/Makefile
1514 doc/arm/Makefile
1515 doc/man/Makefile
1516 doc/misc/Makefile])
1517
1518 # Unit Tests
1519
1520 AC_CONFIG_FILES([tests/Makefile
1521 tests/isc/Makefile
1522 tests/dns/Makefile
1523 tests/ns/Makefile
1524 tests/irs/Makefile
1525 tests/isccfg/Makefile
1526 tests/libtest/Makefile])
1527
1528 AC_CONFIG_FILES([tests/unit-test-driver.sh],
1529 [chmod +x tests/unit-test-driver.sh])
1530
1531 # System Tests
1532
1533 AC_CONFIG_FILES([bin/tests/Makefile
1534 bin/tests/system/Makefile
1535 bin/tests/system/conf.sh
1536 bin/tests/system/dyndb/driver/Makefile
1537 bin/tests/system/dlzexternal/driver/Makefile
1538 bin/tests/system/hooks/driver/Makefile])
1539
1540 AC_CONFIG_FILES([bin/tests/system/ifconfig.sh],
1541 [chmod +x bin/tests/system/ifconfig.sh])
1542 AC_CONFIG_FILES([bin/tests/system/legacy.run.sh],
1543 [chmod +x bin/tests/system/legacy.run.sh])
1544 AC_CONFIG_FILES([bin/tests/system/start.sh],
1545 [chmod +x bin/tests/system/start.sh])
1546 AC_CONFIG_FILES([bin/tests/system/stop.sh],
1547 [chmod +x bin/tests/system/stop.sh])
1548
1549 # Fuzz Tests
1550
1551 AC_CONFIG_FILES([fuzz/Makefile])
1552
1553 # Misc
1554
1555 AC_CONFIG_FILES([util/check-make-install])
1556
1557 #
1558 # Do it
1559 #
1560
1561 AC_OUTPUT
1562
1563 # [pairwise: --enable-full-report, --disable-full-report]
1564 AC_ARG_ENABLE(full-report,
1565 AS_HELP_STRING([--enable-full-report],
1566 [report values of all configure options]))
1567
1568 report() {
1569 echo "==============================================================================="
1570 echo "Configuration summary:"
1571 echo "-------------------------------------------------------------------------------"
1572 echo "Optional features enabled:"
1573 if test "yes" = "$with_jemalloc"; then
1574 echo " Memory allocator: jemalloc"
1575 fi
1576 if test "yes" = "$enable_full_report" -o "standard" = "$with_locktype"; then
1577 echo " Mutex lock type: $with_locktype"
1578 fi
1579 test "small" = "$with_tuning" && echo " Small-system tuning (--with-tuning)"
1580 test "no" = "$enable_dnstap" || \
1581 echo " Allow 'dnstap' packet logging (--enable-dnstap)"
1582 test -z "$MAXMINDDB_LIBS" || echo " GeoIP2 access control (--enable-geoip)"
1583 test -z "$GSSAPI_LIBS" || echo " GSS-API (--with-gssapi)"
1584
1585 # these lines are only printed if run with --enable-full-report
1586 if test "yes" = "$enable_full_report"; then
1587 test -z "$LIBXML2_LIBS" || echo " XML statistics (--with-libxml2)"
1588 test -z "$JSON_C_LIBS" || echo " JSON statistics (--with-json-c): $JSON_C_CFLAGS $JSON_C_LIBS"
1589 test -z "$ZLIB_LIBS" || echo " HTTP zlib compression (--with-zlib)"
1590 test -z "$LMDB_LIBS" || echo " LMDB database to store configuration for 'addzone' zones (--with-lmdb)"
1591 test -z "$LIBIDN2_LIBS" || echo " IDN support (--with-libidn2)"
1592 fi
1593
1594 test "yes" = "$enable_dnsrps" && \
1595 echo " DNS Response Policy Service interface (--enable-dnsrps)"
1596 test "yes" = "$enable_fixed_rrset" && \
1597 echo " Allow 'fixed' rrset-order (--enable-fixed-rrset)"
1598 test "yes" = "$enable_querytrace" && \
1599 echo " Very verbose query trace logging (--enable-querytrace)"
1600 test "yes" = "$enable_singletrace" && \
1601 echo " Single-query trace logging (--enable-singletrace)"
1602 test -z "$HAVE_CMOCKA" || echo " CMocka Unit Testing Framework (--with-cmocka)"
1603
1604 test "auto" = "$validation_default" && echo " DNSSEC validation active by default (--enable-auto-validation)"
1605
1606 echo "-------------------------------------------------------------------------------"
1607
1608 echo "Features disabled or unavailable on this platform:"
1609 if test "no" = "$with_jemalloc"; then
1610 echo " Memory allocator: system"
1611 echo
1612 echo " +------------------------------------------+"
1613 echo " | ==== WARNING ==== |"
1614 echo " | |"
1615 echo " | This is NOT a recommended configuration. |"
1616 echo " | Using the system memory allocator causes |"
1617 echo " | reduced performance and increased memory |"
1618 echo " | fragmentation. Installing the jemalloc |"
1619 echo " | memory allocator (version >= 4.0.0) is |"
1620 echo " | strongly recommended. |"
1621 echo " +------------------------------------------+"
1622 echo
1623 fi
1624 test "small" = "$with_tuning" || echo " Small-system tuning (--with-tuning)"
1625
1626 test "no" = "$enable_dnstap" && \
1627 echo " Allow 'dnstap' packet logging (--enable-dnstap)"
1628 test -z "$MAXMINDDB_LIBS" && echo " GeoIP2 access control (--enable-geoip)"
1629 test -z "$GSSAPI_LIBS" && echo " GSS-API (--with-gssapi)"
1630
1631 test "no" = "$enable_dnsrps" && \
1632 echo " DNS Response Policy Service interface (--enable-dnsrps)"
1633
1634 test "yes" = "$enable_fixed_rrset" || \
1635 echo " Allow 'fixed' rrset-order (--enable-fixed-rrset)"
1636
1637 test "yes" = "$validation_default" && echo " DNSSEC validation requires configuration (--enable-auto-validation)"
1638
1639 test "yes" = "$enable_querytrace" || \
1640 echo " Very verbose query trace logging (--enable-querytrace)"
1641 test "yes" = "$enable_singletrace" || \
1642 echo " Single-query trace logging (--enable-singletrace)"
1643
1644 test "no" = "$with_cmocka" && echo " CMocka Unit Testing Framework (--with-cmocka)"
1645
1646 test -z "$LIBXML2_LIBS" && echo " XML statistics (--with-libxml2)"
1647 test -z "$JSON_C_LIBS" && echo " JSON statistics (--with-json-c)"
1648 test -z "$ZLIB_LIBS" && echo " HTTP zlib compression (--with-zlib)"
1649 test -z "$LMDB_LIBS" && echo " LMDB database to store configuration for 'addzone' zones (--with-lmdb)"
1650 test -z "$LIBIDN2_LIBS" && echo " IDN support (--with-libidn2)"
1651
1652 echo "-------------------------------------------------------------------------------"
1653 echo "Configured paths:"
1654 echo " prefix: $prefix"
1655 echo " sysconfdir: $sysconfdir"
1656 echo " localstatedir: $localstatedir"
1657 echo "-------------------------------------------------------------------------------"
1658 echo "Compiler: $CC"
1659 AS_IF([test "$GCC" = "yes"],
1660 [$CC --version 2>&1 | sed 's/^/ /'],
1661 [AS_CASE([$host],
1662 [*-solaris*],[$CC -V 2>&1 | sed 's/^/ /'],
1663 [$CC --version 2>&1 | sed 's/^/ /'])])
1664 echo "CFLAGS: $STD_CFLAGS $CFLAGS"
1665 echo "CPPFLAGS: $STD_CPPFLAGS $CPPFLAGS"
1666 echo "LDFLAGS: $LDFLAGS"
1667
1668 if test "X$ac_unrecognized_opts" != "X"; then
1669 echo "-------------------------------------------------------------------------------"
1670 echo "Unrecognized options:"
1671 echo " $ac_unrecognized_opts"
1672 fi
1673
1674 if test "yes" != "$enable_full_report"; then
1675 echo "-------------------------------------------------------------------------------"
1676 echo "For more detail, use --enable-full-report."
1677 fi
1678 echo "==============================================================================="
1679 }
1680
1681 if test "yes" != "$silent"; then
1682 report
1683 fi
1684
1685 # Tell Emacs to edit this file in shell mode.
1686 # Local Variables:
1687 # mode: sh
1688 # End:
1689