Home | History | Annotate | Line # | Download | only in dist
configure.ac revision 1.1.1.9
      1 # Copyright (C) Internet Systems Consortium, Inc. ("ISC")
      2 #
      3 # This Source Code Form is subject to the terms of the Mozilla Public
      4 # License, v. 2.0. If a copy of the MPL was not distributed with this
      5 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
      6 #
      7 # See the COPYRIGHT file distributed with this work for additional
      8 # information regarding copyright ownership.
      9 
     10 AC_INIT(BIND, [9.16], [info (a] isc.org], [], [https://www.isc.org/downloads/])
     11 AC_PREREQ([2.60])
     12 
     13 #
     14 # Enable maintainer mode by default, but allow to disable it in the CI
     15 #
     16 AM_MAINTAINER_MODE([enable])
     17 
     18 AC_CONFIG_HEADER(config.h)
     19 AC_CONFIG_MACRO_DIR([m4])
     20 
     21 AC_CANONICAL_HOST
     22 
     23 #
     24 # Enable system extensions to C and POSIX
     25 #
     26 AC_USE_SYSTEM_EXTENSIONS
     27 
     28 #
     29 # Enable large file support
     30 #
     31 AC_SYS_LARGEFILE
     32 AC_FUNC_FSEEKO
     33 
     34 LFS_CFLAGS=`getconf LFS_CFLAGS 2>/dev/null`
     35 LFS_LDFLAGS=`getconf LFS_LDFLAGS 2>/dev/null`
     36 LFS_LIBS=`getconf LFS_LIBS 2>/dev/null`
     37 
     38 AC_SUBST([LFS_CFLAGS])
     39 AC_SUBST([LFS_LDFLAGS])
     40 AC_SUBST([LFS_LIBS])
     41 
     42 # Enable RFC 3542 APIs on macOS
     43 AC_DEFINE([__APPLE_USE_RFC_3542], [1], [Select RFC3542 IPv6 API on macOS])
     44 
     45 AC_PROG_MAKE_SET
     46 
     47 AC_PROG_LIBTOOL
     48 AC_PROG_INSTALL
     49 AC_PROG_LN_S
     50 AX_POSIX_SHELL
     51 AC_PROG_MKDIR_P
     52 
     53 AC_SUBST(STD_CINCLUDES)
     54 AC_SUBST(STD_CDEFINES)
     55 AC_SUBST(STD_CWARNINGS)
     56 AC_SUBST(CCOPT)
     57 AC_SUBST(CCNOOPT)
     58 AC_SUBST(BACKTRACECFLAGS)
     59 
     60 #
     61 # Use pkg-config
     62 #
     63 
     64 PKG_PROG_PKG_CONFIG
     65 AS_IF([test -z "$PKG_CONFIG"],
     66       [AC_MSG_ERROR([The pkg-config script could not be found or is too old.])])
     67 
     68 # [pairwise: --enable-buffer-useinline, --disable-buffer-useinline]
     69 AC_ARG_ENABLE(buffer_useinline,
     70 	      AS_HELP_STRING([--enable-buffer-useinline],
     71 		             [define ISC_BUFFER_USEINLINE when compiling
     72 				[default=yes]]),
     73 	      if test yes = "${enable}"
     74 	      then
     75 		      AC_DEFINE([ISC_BUFFER_USEINLINE], [1],
     76 			        [Define if you want to use inline buffers])
     77 	      fi,
     78 	      AC_DEFINE([ISC_BUFFER_USEINLINE], [1]))
     79 
     80 # [pairwise: --enable-warn-shadow, --disable-warn-shadow]
     81 AC_ARG_ENABLE([warn_shadow],
     82 	      [AS_HELP_STRING([--enable-warn-shadow],
     83 			      [turn on -Wshadow when compiling])])
     84 
     85 # [pairwise: --enable-warn-error, --disable-warn-error]
     86 AC_ARG_ENABLE([warn_error],
     87 	      [AS_HELP_STRING([--enable-warn-error],
     88 			      [turn on -Werror when compiling])])
     89 
     90 # [pairwise: --enable-developer, --disable-developer]
     91 AC_ARG_ENABLE([developer],
     92 	      [AS_HELP_STRING([--enable-developer],
     93 			      [enable developer build settings])])
     94 
     95 XTARGETS=
     96 AS_IF([test "$enable_developer" = "yes"],
     97       [STD_CDEFINES="$STD_CDEFINES -DISC_MEM_DEFAULTFILL=1 -DISC_LIST_CHECKINIT=1"
     98        test "${enable_fixed_rrset+set}" = set || enable_fixed_rrset=yes
     99        test "${enable_querytrace+set}" = set || enable_querytrace=yes
    100        test "${with_cmocka+set}" = set || with_cmocka=yes
    101        test "${with_dlz_filesystem+set}" = set || with_dlz_filesystem=yes
    102        test "${enable_symtable+set}" = set || enable_symtable=all
    103        test "${enable_warn_error+set}" = set || enable_warn_error=yes
    104        test "${enable_warn_shadow+set}" = set || enable_warn_shadow=yes
    105        test "${with_zlib+set}" = set || with_zlib=yes
    106        XTARGETS='${XTARGETS}'
    107        ])
    108 AC_SUBST([XTARGETS])
    109 
    110 # Fuzzing is not included in pairwise testing as fuzzing tools are
    111 # not present in the relevant Docker image.
    112 #
    113 # [pairwise: skip]
    114 AC_ARG_ENABLE([fuzzing],
    115 	      [AS_HELP_STRING([--enable-fuzzing=<afl|libfuzzer>],
    116 			      [Enable fuzzing using American Fuzzy Lop or libFuzzer (default=no)])],
    117 	      [],
    118 	      [enable_fuzzing=no])
    119 
    120 AC_MSG_CHECKING([whether to enable fuzzing mode])
    121 AS_CASE([$enable_fuzzing],
    122 	[no],[AC_MSG_RESULT([no])],
    123 	[afl],[
    124 	  AC_MSG_RESULT([using AFL])
    125 	  AC_DEFINE([ENABLE_AFL], [1],
    126 		    [Define to enable American Fuzzy Lop test harness])
    127 	  CFLAGS="$CFLAGS -DFUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION=1"
    128 	  LIBS="$LIBS -lpthread"],
    129 	[libfuzzer],[
    130 	  AC_MSG_RESULT([using libFuzzer])
    131 	  CFLAGS="$CFLAGS -DFUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION=1 -fsanitize=fuzzer,address,undefined"
    132 	  LDFLAGS="$LDFLAGS -fsanitize=fuzzer,address,undefined"],
    133 	[*],[AC_MSG_ERROR([You need to explicitly select the fuzzer])])
    134 
    135 AS_IF([test "$enable_fuzzing" = "afl"],
    136       [AC_MSG_CHECKING("for AFL enabled compiler")
    137        AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],
    138 					  [#ifndef __AFL_COMPILER
    139 					   #error AFL compiler required
    140 					   #endif
    141 					  ])],
    142 			 [AC_MSG_RESULT([yes])],
    143 			 [AC_MSG_ERROR([set CC=afl-<gcc|clang> when --enable-fuzzing=afl is used])])
    144       ])
    145 
    146 # [pairwise: --enable-mutex-atomics, --disable-mutex-atomics]
    147 AC_ARG_ENABLE(mutex_atomics,
    148 	      AS_HELP_STRING([--enable-mutex-atomics],
    149 		             [emulate atomics by mutex-locked variables, useful for debugging
    150 				[default=no]]),
    151 	      [],
    152 	      [enable_mutex_atomics=no])
    153 
    154 AC_MSG_CHECKING([whether to emulate atomics with mutexes])
    155 case "$enable_mutex_atomics" in
    156 yes)
    157         AC_MSG_RESULT(yes)
    158         AC_DEFINE(ISC_MUTEX_ATOMICS, 1, [Define to emulate atomic variables with mutexes.])
    159         ;;
    160 no)
    161         AC_MSG_RESULT(no)
    162         ;;
    163 *)
    164         AC_MSG_ERROR("--enable-mutex-atomics requires yes or no")
    165         ;;
    166 esac
    167 
    168 #
    169 # Make very sure that these are the first files processed by
    170 # config.status, since we use the processed output as the input for
    171 # AC_SUBST_FILE() substitutions in other files.
    172 #
    173 AC_CONFIG_FILES([make/rules make/includes])
    174 
    175 AC_PATH_PROG(AR, ar)
    176 ARFLAGS="cruv"
    177 AC_SUBST(AR)
    178 AC_SUBST(ARFLAGS)
    179 
    180 # The POSIX ln(1) program.  Non-POSIX systems may substitute
    181 # "copy" or something.
    182 LN=ln
    183 AC_SUBST(LN)
    184 
    185 case "$AR" in
    186 	"")
    187 		AC_MSG_ERROR([
    188 ar program not found.  Please fix your PATH to include the directory in
    189 which ar resides, or set AR in the environment with the full path to ar.
    190 ])
    191 
    192 		;;
    193 esac
    194 
    195 #
    196 # Look for w3m
    197 #
    198 AC_PATH_PROGS(W3M, w3m, w3m)
    199 AC_SUBST(W3M)
    200 
    201 #
    202 # Look for pandoc
    203 #
    204 AC_PATH_PROG(PANDOC, pandoc, pandoc)
    205 AC_SUBST(PANDOC)
    206 
    207 #
    208 # Perl is optional; it is used only by some of the system test scripts.
    209 # Note: the backtrace feature (see below) uses perl to build the symbol table,
    210 # but it still compiles without perl, in which case an empty table will be used.
    211 #
    212 AC_PATH_PROGS(PERL, perl5 perl)
    213 AC_SUBST(PERL)
    214 
    215 #
    216 # Python is also optional but required by default so that dnssec-keymgr gets
    217 # installed unless explicitly prevented by the user using --without-python.
    218 #
    219 testminvers='import sys
    220 if (sys.version_info < (2,7)) or (sys.version_info < (3,2) and sys.version_info >= (3,0)):
    221    exit(1)'
    222 
    223 testargparse='try: import argparse
    224 except: exit(1)'
    225 
    226 testply='try: import ply
    227 except: exit(1)'
    228 
    229 testsetup='try: from distutils.core import setup
    230 except: exit(1)'
    231 
    232 default_with_python="python python3 python3.7 python3.6 python3.5 python3.4 python3.3 python3.2 python2 python2.7"
    233 
    234 AC_ARG_VAR([PYTHON], [path to python executable])
    235 
    236 # [pairwise: --with-python, --without-python]
    237 AC_ARG_WITH([python],
    238 	    AS_HELP_STRING([--with-python=PATH],
    239 			   [specify path to Python interpreter]),
    240 	    [], [with_python=$default_with_python])
    241 
    242 # [pairwise: skip]
    243 AC_ARG_WITH([python-install-dir],
    244 	    AS_HELP_STRING([--with-python-install-dir=PATH],
    245 			   [installation directory for Python modules]),
    246 	    [], with_python_install_dir="")
    247 
    248 AS_IF([test "$with_python" = "yes"],
    249       [with_python=$default_with_python])
    250 
    251 AS_IF([test "$with_python" = "no"],
    252       [AC_MSG_CHECKING([for Python support])
    253        unset PYTHON
    254        AC_MSG_RESULT([disabled])],
    255       [for p in $with_python
    256        do
    257 	 AS_CASE([$p],
    258 		 [/*],[PYTHON="$p"])
    259 
    260 	 AC_PATH_PROG([PYTHON], [$p])
    261 	 # Do not cache the result of the check from the previous line.  If the
    262 	 # first found Python interpreter has missing module dependencies and
    263 	 # the result of the above check is cached, subsequent module checks
    264 	 # will erroneously keep on using the cached path to the first found
    265 	 # Python interpreter instead of different ones.
    266 	 unset ac_cv_path_PYTHON
    267 
    268 	 AS_IF([test -z "$PYTHON"], [continue])
    269 
    270 	 AC_MSG_CHECKING([if $PYTHON is python2 version >= 2.7 or python3 version >= 3.2])
    271 	 AS_IF(["$PYTHON" -c "$testminvers" 2>/dev/null],
    272 	       [AC_MSG_RESULT([yes])],
    273 	       [AC_MSG_RESULT([no])
    274 		unset PYTHON
    275 		continue])
    276 
    277 	 AC_MSG_CHECKING([Python module 'argparse'])
    278 	 AS_IF(["$PYTHON" -c "$testargparse" 2>/dev/null],
    279 	       [AC_MSG_RESULT([yes])],
    280 	       [AC_MSG_RESULT([no])
    281 		unset PYTHON
    282 		continue])
    283 
    284 	 AC_MSG_CHECKING([Python module 'ply'])
    285 	 AS_IF(["$PYTHON" -c "$testply" 2>/dev/null],
    286 	       [AC_MSG_RESULT([yes])],
    287 	       [AC_MSG_RESULT([no])
    288 		unset PYTHON
    289 		continue])
    290 
    291 	 AC_MSG_CHECKING([Python module 'distutils.core setup'])
    292 	 AS_IF(["$PYTHON" -c "$testsetup" 2>/dev/null],
    293 	       [AC_MSG_RESULT([yes])],
    294 	       [AC_MSG_RESULT([no])
    295 		unset PYTHON
    296 		continue])
    297 
    298 	 # Stop looking any further once we find a Python interpreter
    299 	 # satisfying all requirements.
    300 	 break
    301        done
    302 
    303        AS_IF([test "X$PYTHON" = "X"],
    304 	     [AC_MSG_CHECKING([for Python support])
    305 	      AC_MSG_RESULT([no])
    306 	      AC_MSG_ERROR([m4_normalize(
    307 				[Python >= 2.7 or >= 3.2 and the PLY package
    308                                  are required for dnssec-keymgr and other
    309                                  Python-based tools. PLY may be
    310                                  available from your OS package manager
    311                                  as python-ply or python3-ply; it can also
    312                                  be installed via pip. To build without
    313                                  Python/PLY, use --without-python.]
    314 			    )])])])
    315 
    316 PYTHON_TOOLS=''
    317 CHECKDS=''
    318 COVERAGE=''
    319 KEYMGR=''
    320 AS_IF([test "X$PYTHON" != "X"],
    321       [PYTHON_TOOLS=python
    322        CHECKDS=checkds
    323        COVERAGE=coverage
    324        KEYMGR=keymgr
    325        PYTHON_INSTALL_DIR="$with_python_install_dir"
    326        AS_IF([test -n "$with_python_install_dir"],
    327 	     [PYTHON_INSTALL_LIB="--install-lib=$with_python_install_dir"])])
    328 AC_SUBST(CHECKDS)
    329 AC_SUBST(COVERAGE)
    330 AC_SUBST(KEYMGR)
    331 AC_SUBST(PYTHON_TOOLS)
    332 AC_SUBST(PYTHON_INSTALL_DIR)
    333 AC_SUBST(PYTHON_INSTALL_LIB)
    334 
    335 #
    336 # expanded_sysconfdir is needed for replacement in the python utilities
    337 #
    338 expanded_sysconfdir=`eval echo $sysconfdir`
    339 AC_SUBST(expanded_sysconfdir)
    340 
    341 #
    342 # Make sure INSTALL uses an absolute path, else it will be wrong in all
    343 # Makefiles, since they use make/rules.in and INSTALL will be adjusted by
    344 # configure based on the location of the file where it is substituted.
    345 # Since in BIND9 INSTALL is only substituted into make/rules.in, an immediate
    346 # subdirectory of install-sh, This relative path will be wrong for all
    347 # directories more than one level down from install-sh.
    348 #
    349 case "$INSTALL" in
    350 	/*)
    351 		;;
    352 	*)
    353 		#
    354 		# Not all systems have dirname.
    355 		#
    356 		changequote({, })
    357 		ac_dir="`echo $INSTALL | sed 's%/[^/]*$%%'`"
    358 		changequote([, ])
    359 
    360 		ac_prog="`echo $INSTALL | sed 's%.*/%%'`"
    361 		test "X$ac_dir" = "X$ac_prog" && ac_dir=.
    362 		test -d "$ac_dir" && ac_dir="`(cd \"$ac_dir\" && pwd)`"
    363 		INSTALL="$ac_dir/$ac_prog"
    364 		;;
    365 esac
    366 
    367 AC_PATH_PROGS([PYTEST], [pytest-3 py.test-3 pytest pytest-pypy], [])
    368 AS_IF([test -z "$PYTEST"],
    369       [AC_MSG_WARN([pytest not found, some system tests will be skipped])])
    370 AC_SUBST([PYTEST])
    371 
    372 
    373 AC_PROG_CC
    374 AC_PROG_CC_C99
    375 
    376 #
    377 # Using Solaris linker with gcc on Solaris breaks Thread Local Storage
    378 #
    379 AS_CASE([$host],
    380 	[*-solaris*],[
    381 	    AS_IF([test "$GCC" = "yes"],
    382 		  [LDFLAGS="$LDFLAGS -zrelax=transtls"
    383 		   AC_MSG_WARN([When using GNU C Compiler on Solaris, -zrelax=transtls linker flag is used to fix bug in Thread Local Storage])
    384 		  ])
    385 	],
    386 	[*-darwin*],[LDFLAGS="$LDFLAGS -Wl,-flat_namespace"])
    387 
    388 #
    389 # CCNOOPT defaults to -O0 on gcc and disables optimization when is last
    390 #
    391 if test "X$CCNOOPT" = "X" -a "X$GCC" = "Xyes"; then
    392 	CCNOOPT="-O0"
    393 fi
    394 
    395 AC_HEADER_STDC
    396 
    397 AC_CHECK_HEADERS(fcntl.h regex.h sys/time.h unistd.h sys/mman.h sys/sockio.h sys/select.h sys/param.h sys/sysctl.h net/if6.h sys/socket.h net/route.h linux/netlink.h linux/rtnetlink.h,,,
    398 [$ac_includes_default
    399 #ifdef HAVE_SYS_PARAM_H
    400 # include <sys/param.h>
    401 #endif
    402 #ifdef HAVE_SYS_SOCKET_H
    403 # include <sys/socket.h>
    404 #endif
    405 ])
    406 
    407 #
    408 # Check for thread local storage
    409 #
    410 AC_CHECK_HEADERS([threads.h],
    411 		 [
    412 		     AC_MSG_CHECKING([for C11 Thread-Local Storage using thread_local])
    413 		     AC_COMPILE_IFELSE(
    414 			 [AC_LANG_PROGRAM(
    415 			      [
    416 				  #include <threads.h>
    417 			      ],[
    418 				  static thread_local int tls = 0;
    419 				  return (tls);
    420 			      ])
    421 			 ],[
    422 			     AC_MSG_RESULT([yes])
    423 			     AC_DEFINE([HAVE_THREAD_LOCAL],[1],[Define if thread_local keyword is available])
    424 			     AC_DEFINE([HAVE_TLS],[1],[Define if Thread-Local Storage is available])
    425 			 ],[
    426 			     AC_MSG_ERROR([Thread Local Storage support required, update your toolchain to build BIND 9])
    427 			 ])
    428 		 ],[
    429 		     AC_MSG_CHECKING([for Thread-Local Storage using __thread])
    430 		     AC_COMPILE_IFELSE(
    431 			 [AC_LANG_PROGRAM(
    432 			      [
    433 			      ],[
    434 				  static __thread int tls = 0;
    435 				  return (tls);
    436 			      ])
    437 			 ],[
    438 			     AC_MSG_RESULT([yes])
    439 			     AC_DEFINE([HAVE___THREAD],[1],[Define if __thread keyword is available])
    440 			     AC_DEFINE([HAVE_TLS],[1],[Define if Thread-Local Storage is available])
    441 			 ],[
    442 			     AC_MSG_ERROR([Thread Local Storage support required, update your toolchain to build BIND 9])
    443 			 ])
    444 		 ])
    445 
    446 AC_C_CONST
    447 AC_C_INLINE
    448 AC_C_VOLATILE
    449 AC_C_FLEXIBLE_ARRAY_MEMBER
    450 
    451 #
    452 # Check for yield support on ARM processors
    453 #
    454 AS_CASE([$host],
    455 	[arm*],
    456 	[AC_MSG_CHECKING([for yield instruction support])
    457 	 AC_COMPILE_IFELSE(
    458 	     [AC_LANG_PROGRAM([[]],
    459 			     [[__asm__ __volatile__ ("yield")]])],
    460 	     [AC_MSG_RESULT([yes])
    461 	      AC_DEFINE([HAVE_ARM_YIELD], [1],
    462 			[define if the ARM yield instruction is available])],
    463 	     [AC_MSG_RESULT([no])])])
    464 
    465 #
    466 # Check for pause support on SPARC processors
    467 #
    468 AS_CASE([$host],
    469 	[sparc*],
    470 	[AC_MSG_CHECKING([for pause instruction support])
    471 	 AC_COMPILE_IFELSE(
    472 	     [AC_LANG_PROGRAM([[]],
    473 			     [[__asm__ __volatile__ ("pause")]])],
    474 	     [AC_MSG_RESULT([yes])
    475 	      AC_DEFINE([HAVE_SPARC_PAUSE], [1],
    476 			[define if the SPARC pause instruction is available])],
    477 	     [AC_MSG_RESULT([no])])])
    478 
    479 AC_CHECK_FUNCS([sysctlbyname])
    480 
    481 #
    482 # Check for the existence of mmap to enable the fast format zones
    483 #
    484 AC_CHECK_FUNCS(mmap)
    485 
    486 #
    487 # Older versions of HP/UX don't define seteuid() and setegid()
    488 #
    489 AC_CHECK_FUNCS(seteuid setresuid)
    490 AC_CHECK_FUNCS(setegid setresgid)
    491 
    492 AC_TYPE_SIZE_T
    493 AC_TYPE_SSIZE_T
    494 AC_TYPE_UINTPTR_T
    495 
    496 AC_HEADER_TIME
    497 
    498 #
    499 # check for uname library routine
    500 #
    501 AC_MSG_CHECKING([for uname])
    502 AC_COMPILE_IFELSE(
    503   [AC_LANG_PROGRAM(
    504      [[#include <sys/utsname.h>
    505        #include <stdio.h>
    506       ]],
    507      [[
    508        struct utsname uts;
    509        uname(&uts);
    510        printf("running on %s %s %s for %s\n",
    511 	      uts.sysname, uts.release, uts.version, uts.machine);
    512      ]])],
    513   [AC_MSG_RESULT(yes)
    514    AC_DEFINE([HAVE_UNAME], [1], [define if uname is available])
    515   ],
    516   [AC_MSG_RESULT(no)
    517    AC_MSG_WARN([uname is not correctly supported])
    518   ])
    519 
    520 #
    521 # check for GCC noreturn attribute
    522 #
    523 AC_MSG_CHECKING(for GCC noreturn attribute)
    524 AC_TRY_COMPILE([],[void foo() __attribute__((noreturn));],
    525 	[AC_MSG_RESULT(yes)
    526 		ISC_PLATFORM_NORETURN_PRE="#define ISC_PLATFORM_NORETURN_PRE"
    527 		ISC_PLATFORM_NORETURN_POST="#define ISC_PLATFORM_NORETURN_POST __attribute__((noreturn))"],
    528 	[AC_MSG_RESULT(no)
    529 		ISC_PLATFORM_NORETURN_PRE="#define ISC_PLATFORM_NORETURN_PRE"
    530 		ISC_PLATFORM_NORETURN_POST="#define ISC_PLATFORM_NORETURN_POST"])
    531 AC_SUBST(ISC_PLATFORM_NORETURN_PRE)
    532 AC_SUBST(ISC_PLATFORM_NORETURN_POST)
    533 
    534 #
    535 # check if we have kqueue
    536 #
    537 # [pairwise: --enable-kqueue, --disable-kqueue]
    538 AC_ARG_ENABLE([kqueue],
    539 	      [AS_HELP_STRING([--enable-kqueue],
    540 			      [use BSD kqueue when available [default=yes]])],
    541 	      [], enable_kqueue="yes")
    542 
    543 AS_IF([test "$enable_kqueue" = "yes"],
    544       [AC_CHECK_FUNCS([kqueue])])
    545 
    546 #
    547 # check if we have epoll.  Linux kernel 2.4 has epoll_create() which fails,
    548 # so we need to try running the code, not just test its existence.
    549 #
    550 # [pairwise: --enable-epoll, --disable-epoll]
    551 AC_ARG_ENABLE([epoll],
    552 	      [AS_HELP_STRING([--enable-epoll],
    553 			      [use Linux epoll when available [default=auto]])],
    554 	      [], [enable_epoll="yes"])
    555 
    556 AS_IF([test "$enable_epoll" = "yes"],
    557       [AC_CHECK_FUNCS([epoll_create1])])
    558 
    559 #
    560 # check if we support /dev/poll
    561 #
    562 # [pairwise: --enable-devpoll, --disable-devpoll]
    563 AC_ARG_ENABLE([devpoll],
    564 	      [AS_HELP_STRING([--enable-devpoll],
    565 			      [use /dev/poll when available [default=yes]])],
    566 	      [], [enable_devpoll="yes"])
    567 AS_IF([test "$enable_devpoll" = "yes"],
    568       [AC_CHECK_HEADERS([sys/devpoll.h devpoll.h])])
    569 
    570 #
    571 # Find the machine's endian flavor.
    572 #
    573 AC_C_BIGENDIAN
    574 
    575 #
    576 # GeoIP support?
    577 #
    578 # Should be on by default if libmaxminddb exists.
    579 #
    580 # [pairwise: skip]
    581 AC_ARG_WITH([geoip2],
    582 	    [AS_HELP_STRING([--with-geoip2],
    583 			    [deprecated, use --with-maxminddb])],
    584 	    [AC_MSG_WARN([--with-geoip2 is DEPRECATED and will be removed in a future release, use --with-maxminddb instead])],
    585 	    [with_geoip2="auto"])
    586 
    587 # [pairwise: --enable-geoip --with-maxminddb=auto, --enable-geoip --with-maxminddb=yes, --disable-geoip]
    588 AC_ARG_ENABLE([geoip],
    589 	      [AS_HELP_STRING([--disable-geoip],
    590 			      [support GeoIP2 geolocation ACLs if available [default=yes]])],
    591 	      [], [enable_geoip="yes"])
    592 
    593 # [pairwise: skip]
    594 AC_ARG_WITH([maxminddb],
    595 	    [AS_HELP_STRING([--with-maxminddb=PATH],
    596 			    [Build with MaxMind GeoIP2 support (auto|yes|no|path) [default=auto]])],
    597 	    [], [with_maxminddb="$with_geoip2"])
    598 
    599 GEOIP2LINKSRCS=
    600 GEOIP2LINKOBJS=
    601 AS_IF([test "$enable_geoip" = "yes"],
    602       [AS_CASE([$with_maxminddb],
    603 	       [no],[AC_MSG_ERROR([Use '--disable-geoip' to disable the GeoIP])],
    604 	       [auto],[PKG_CHECK_MODULES([MAXMINDDB], [libmaxminddb],
    605 					 [AC_DEFINE([HAVE_GEOIP2], [1], [Build with GeoIP2 support])
    606 					  PKG_CHECK_VAR([MAXMINDDB_PREFIX], [libmaxminddb], [prefix], [], [AC_MSG_ERROR([libmaxminddb prefix not found in pkg-config; set MAXMINDDB_PREFIX in the environment])])
    607 					  GEOIP2LINKSRCS='${GEOIP2LINKSRCS}'
    608 					  GEOIP2LINKOBJS='${GEOIP2LINKOBJS}'
    609 					 ],[:])],
    610 	       [yes],[PKG_CHECK_MODULES([MAXMINDDB], [libmaxminddb],
    611 					[AC_DEFINE([HAVE_GEOIP2], [1], [Build with GeoIP2 support])
    612 					 PKG_CHECK_VAR([MAXMINDDB_PREFIX], [libmaxminddb], [prefix], [], [AC_MSG_ERROR([libmaxminddb prefix not found in pkg-config; set MAXMINDDB_PREFIX in the environment])])
    613 					 GEOIP2LINKSRCS='${GEOIP2LINKSRCS}'
    614 					 GEOIP2LINKOBJS='${GEOIP2LINKOBJS}'
    615 					])],
    616 	       [ # default
    617 		   AX_SAVE_FLAGS([maxminddb])
    618 		   MAXMINDDB_CFLAGS="-I$with_maxminddb/include"
    619 		   MAXMINDDB_LIBS="-L$with_maxminddb/lib"
    620 		   CFLAGS="$CFLAGS $MAXMINDDB_CFLAGS"
    621 		   LDFLAGS="$LDFLAGS $MAXMINDDB_LIBS"
    622 		   AC_SEARCH_LIBS([MMDB_open], [maxminddb],
    623 				  [AC_DEFINE([HAVE_GEOIP2], [1], [Build with GeoIP2 support])
    624 				   GEOIP2LINKSRCS='${GEOIP2LINKSRCS}'
    625 				   GEOIP2LINKOBJS='${GEOIP2LINKOBJS}'
    626 				   MAXMINDDB_LIBS="$MAXMINDDB_LIBS $ac_cv_search_MMDB_open"
    627 				   AC_MSG_NOTICE([GeoIP2 default database path set to $with_maxminddb/share/GeoIP])
    628 				   AS_VAR_COPY([MAXMINDDB_PREFIX], [$with_maxminddb])
    629 				  ],
    630 				  [AC_MSG_ERROR([GeoIP2 requested, but libmaxminddb not found])])
    631 		   AX_RESTORE_FLAGS([maxminddb])
    632 	       ])
    633        AC_ARG_VAR([MAXMINDDB_PREFIX], [value of prefix for MAXMINDDB, overriding pkg-config])
    634 ])
    635 
    636 AC_SUBST([MAXMINDDB_CFLAGS])
    637 AC_SUBST([MAXMINDDB_LIBS])
    638 AC_SUBST([GEOIP2LINKSRCS])
    639 AC_SUBST([GEOIP2LINKOBJS])
    640 
    641 #
    642 # Do we have arc4random(), etc ?
    643 #
    644 AC_CHECK_FUNCS(arc4random arc4random_buf arc4random_uniform getrandom)
    645 
    646 AX_PTHREAD
    647 
    648 LIBS="$PTHREAD_LIBS $LIBS"
    649 CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
    650 CC="$PTHREAD_CC"
    651 
    652 AC_CHECK_FUNCS([pthread_attr_getstacksize pthread_attr_setstacksize])
    653 
    654 # [pairwise: --with-locktype=adaptive, --with-locktype=standard]
    655 AC_ARG_WITH([locktype],
    656 	    AS_HELP_STRING([--with-locktype=ARG],
    657 			   [Specify mutex lock type
    658 			    (adaptive or standard)]),
    659 	    [], [with_locktype="adaptive"])
    660 
    661 AS_CASE([$with_locktype],
    662 	[adaptive],[
    663 	  AC_MSG_CHECKING([for PTHREAD_MUTEX_ADAPTIVE_NP])
    664 	  AC_COMPILE_IFELSE(
    665 	    [AC_LANG_PROGRAM(
    666 	       [[
    667 		 #ifndef _GNU_SOURCE
    668 		 #define _GNU_SOURCE
    669 		 #endif
    670 		 #include <pthread.h>
    671 	       ]],
    672 	       [[
    673 		 return (PTHREAD_MUTEX_ADAPTIVE_NP);
    674 	       ]]
    675 	     )],
    676 	    [AC_MSG_RESULT([using adaptive lock type])
    677 	     AC_DEFINE([HAVE_PTHREAD_MUTEX_ADAPTIVE_NP], 1,
    678 		       [Support for PTHREAD_MUTEX_ADAPTIVE_NP]) ],
    679 	    [AC_MSG_RESULT([using standard lock type])]
    680 	  )],
    681 	[standard],[AC_MSG_RESULT([using standard lock type])],
    682 	[AC_MSG_ERROR([You must specify "adaptive" or "standard" for --with-locktype.])]
    683        )
    684 
    685 AC_CHECK_HEADERS([sched.h])
    686 
    687 AC_SEARCH_LIBS([sched_yield],[rt])
    688 AC_CHECK_FUNCS([sched_yield pthread_yield pthread_yield_np])
    689 
    690 AC_CHECK_HEADERS([sys/cpuset.h])
    691 AC_CHECK_HEADERS([sys/procset.h])
    692 AC_CHECK_FUNCS([pthread_setaffinity_np cpuset_setaffinity processor_bind sched_setaffinity])
    693 
    694 # Look for functions relating to thread naming
    695 AC_CHECK_FUNCS([pthread_setname_np pthread_set_name_np])
    696 AC_CHECK_HEADERS([pthread_np.h], [], [], [#include <pthread.h>])
    697 
    698 # libuv
    699 AC_MSG_CHECKING(for libuv)
    700 PKG_CHECK_MODULES([LIBUV], [libuv >= 1.0.0], [],
    701 		  [AC_MSG_ERROR([libuv not found])])
    702 AC_SUBST([LIBUV_CFLAGS])
    703 AC_SUBST([LIBUV_LIBS])
    704 
    705 AX_SAVE_FLAGS([libuv])
    706 CFLAGS="$CFLAGS $LIBUV_CFLAGS"
    707 LIBS="$LDFLAGS $LIBUV_LIBS"
    708 # Those functions are only provided in newer versions of libuv, we'll be emulating them
    709 # for now
    710 AC_CHECK_FUNCS([uv_handle_get_data uv_handle_set_data uv_import uv_udp_connect uv_translate_sys_error])
    711 AX_RESTORE_FLAGS([libuv])
    712 
    713 #
    714 # flockfile is usually provided by pthreads
    715 #
    716 AC_CHECK_FUNCS([flockfile getc_unlocked])
    717 
    718 #
    719 # Look for sysconf to allow detection of the number of processors.
    720 #
    721 AC_CHECK_FUNCS([sysconf])
    722 
    723 AC_SUBST(ALWAYS_DEFINES)
    724 
    725 AC_MSG_CHECKING(for libtool)
    726 
    727 # [pairwise: --with-libtool, --without-libtool]
    728 AC_ARG_WITH(libtool, AS_HELP_STRING([--with-libtool], [use GNU libtool]),
    729 	    use_libtool="$withval", use_libtool="no")
    730 NO_LIBTOOL_ISCLIBS=
    731 NO_LIBTOOL_DNSLIBS=
    732 case $use_libtool in
    733 	yes)
    734 		AC_MSG_RESULT(yes)
    735 		AM_PROG_LIBTOOL
    736 		O=lo
    737 		A=la
    738 		LIBTOOL_MKDEP_SED='s;\.o;\.lo;'
    739 		LIBTOOL_MODE_COMPILE='--mode=compile'
    740 		LIBTOOL_MODE_INSTALL='--mode=install'
    741 		LIBTOOL_MODE_LINK='--mode=link'
    742 		LIBTOOL_MODE_UNINSTALL='--mode=uninstall'
    743 		INSTALL_LIBRARY='${INSTALL_PROGRAM}'
    744 		AC_DEFINE([USE_LIBTOOL],[1],[Define if libtool is used for compilation])
    745 		;;
    746 	*)
    747 		AC_MSG_RESULT(no)
    748 		O=o
    749 		A=a
    750 		LIBTOOL=
    751 		AC_SUBST(LIBTOOL)
    752 		LIBTOOL_MKDEP_SED=
    753 		LIBTOOL_MODE_COMPILE=
    754 		LIBTOOL_MODE_INSTALL=
    755 		LIBTOOL_MODE_LINK=
    756 		LIBTOOL_MODE_UNINSTALL=
    757 		INSTALL_LIBRARY='${INSTALL_DATA}'
    758 		NO_LIBTOOL_ISCLIBS='${NO_LIBTOOL_ISCLIBS}'
    759 		NO_LIBTOOL_DNSLIBS='${NO_LIBTOOL_DNSLIBS}'
    760 		;;
    761 esac
    762 AC_SUBST(INSTALL_LIBRARY)
    763 AC_SUBST(NO_LIBTOOL_ISCLIBS)
    764 AC_SUBST(NO_LIBTOOL_DNSLIBS)
    765 
    766 #
    767 # Do we want to use pthread rwlock?
    768 #
    769 # [pairwise: --enable-pthread-rwlock, --disable-pthread-rwlock]
    770 AC_ARG_ENABLE([pthread_rwlock],
    771 	      [AS_HELP_STRING([--enable-pthread-rwlock],
    772 			      [use pthread rwlock instead of internal rwlock implementation])],
    773 	      [], [enable_pthread_rwlock=no])
    774 
    775 AS_IF([test "$enable_pthread_rwlock" = "yes"],
    776       [AC_CHECK_FUNCS([pthread_rwlock_rdlock], [],
    777 		      [AC_MSG_ERROR([pthread_rwlock_rdlock requested but not found])])
    778        AC_DEFINE([USE_PTHREAD_RWLOCK],[1],[Define if you want to use pthread rwlock implementation])
    779       ])
    780 
    781 CRYPTO=OpenSSL
    782 
    783 #
    784 # OpenSSL/LibreSSL is mandatory
    785 #
    786 PKG_CHECK_MODULES([OPENSSL], [libssl libcrypto], [],
    787 		  [AX_CHECK_OPENSSL([:],[AC_MSG_FAILURE([OpenSSL/LibreSSL not found])])])
    788 
    789 AX_SAVE_FLAGS([openssl])
    790 
    791 CFLAGS="$CFLAGS $OPENSSL_CFLAGS"
    792 LIBS="$LIBS $OPENSSL_LIBS"
    793 
    794 AC_MSG_CHECKING([for OpenSSL >= 1.0.0 or LibreSSL])
    795 AC_COMPILE_IFELSE(
    796     [AC_LANG_PROGRAM([[#include <openssl/opensslv.h>]],
    797 		     [[#if !defined(LIBRESSL_VERSION_NUMBER) && (OPENSSL_VERSION_NUMBER < 0x1000000fL)
    798 		       #error OpenSSL >= 1.0.0 or LibreSSL required
    799 		       #endif
    800 		      ]])],
    801     [AC_MSG_RESULT([yes])],
    802     [AC_MSG_FAILURE([not found])])
    803 
    804 #
    805 # Check for functions added in OpenSSL or LibreSSL
    806 #
    807 
    808 AC_CHECK_FUNCS([CRYPTO_zalloc])
    809 AC_CHECK_FUNCS([EVP_CIPHER_CTX_new EVP_CIPHER_CTX_free])
    810 AC_CHECK_FUNCS([EVP_MD_CTX_new EVP_MD_CTX_free EVP_MD_CTX_reset])
    811 AC_CHECK_FUNCS([HMAC_CTX_new HMAC_CTX_free HMAC_CTX_reset HMAC_CTX_get_md])
    812 
    813 #
    814 # Check for algorithm support in OpenSSL
    815 #
    816 
    817 AC_CHECK_FUNCS([ECDSA_sign ECDSA_verify], [:],
    818 	       [AC_MSG_FAILURE([ECDSA support in OpenSSL is mandatory.])])
    819 
    820 AC_MSG_CHECKING([for ECDSA P-256 support])
    821 AC_COMPILE_IFELSE(
    822     [AC_LANG_PROGRAM([[#include <openssl/evp.h>
    823 		       #include <openssl/ec.h>]],
    824 		     [[EC_KEY *key = EC_KEY_new_by_curve_name(NID_X9_62_prime256v1);]])],
    825     [AC_MSG_RESULT([yes])],
    826     [AC_MSG_FAILURE([not found.  ECDSA P-256 support in OpenSSL is mandatory.])])
    827 
    828 AC_MSG_CHECKING([for ECDSA P-384 support])
    829 AC_COMPILE_IFELSE(
    830     [AC_LANG_PROGRAM([[#include <openssl/evp.h>
    831 		       #include <openssl/ec.h>]],
    832 		     [[EC_KEY *key = EC_KEY_new_by_curve_name(NID_secp384r1);]])],
    833     [AC_MSG_RESULT([yes])],
    834     [AC_MSG_FAILURE([not found.  ECDSA P-384 support in OpenSSL is mandatory.])])
    835 
    836 AC_MSG_CHECKING([for Ed25519 support])
    837 AC_COMPILE_IFELSE(
    838     [AC_LANG_PROGRAM([[#include <openssl/evp.h>
    839 		       #include <openssl/ec.h>]],
    840 		     [[EC_KEY *key = EC_KEY_new_by_curve_name(NID_ED25519);]])],
    841     [AC_DEFINE([HAVE_OPENSSL_ED25519], [1], [define if OpenSSL supports Ed25519])
    842      AC_MSG_RESULT([yes])],
    843     [AC_MSG_RESULT([no])])
    844 
    845 AC_MSG_CHECKING([for Ed448 support])
    846 AC_COMPILE_IFELSE(
    847     [AC_LANG_PROGRAM([[#include <openssl/evp.h>
    848 		       #include <openssl/ec.h>]],
    849 		     [[EC_KEY *key = EC_KEY_new_by_curve_name(NID_ED448);]])],
    850     [AC_DEFINE([HAVE_OPENSSL_ED448], [1], [define if OpenSSL supports Ed448])
    851      AC_MSG_RESULT([yes])],
    852     [AC_MSG_RESULT([no])])
    853 
    854 #
    855 # Check for OpenSSL SHA-1 support
    856 #
    857 AC_CHECK_FUNCS([EVP_sha1], [:],
    858 	       [AC_MSG_FAILURE([SHA-1 support in OpenSSL is mandatory.])])
    859 
    860 #
    861 # Check for OpenSSL SHA-2 support
    862 #
    863 AC_CHECK_FUNCS([EVP_sha224 EVP_sha256 EVP_sha384 EVP_sha512], [:],
    864 	       [AC_MSG_FAILURE([SHA-2 support in OpenSSL is mandatory.])])
    865 
    866 #
    867 # Check for OpenSSL AES support
    868 #
    869 AC_CHECK_FUNCS([EVP_aes_128_ecb EVP_aes_192_ecb EVP_aes_256_ecb], [:],
    870 	       [AC_MSG_FAILURE([AES support in OpenSSL is mandatory.])])
    871 
    872 #
    873 # Check for OpenSSL 1.1.x/LibreSSL functions
    874 #
    875 AC_CHECK_FUNCS([DH_get0_key ECDSA_SIG_get0 RSA_set0_key])
    876 
    877 AC_CHECK_FUNCS([TLS_server_method])
    878 
    879 #
    880 # Check whether FIPS mode is available and whether we should enable it
    881 #
    882 # FIPS is not included in pairwise testing as the relevant Docker image
    883 # does not support FIPS mode.
    884 #
    885 # [pairwise: skip]
    886 AC_ARG_ENABLE([fips-mode],
    887 	      [AS_HELP_STRING([--enable-fips-mode],
    888 			      [enable FIPS mode in OpenSSL library [default=no]])],
    889 	      [], [enable_fips_mode="no"])
    890 
    891 AC_MSG_CHECKING([whether to enable FIPS mode in OpenSSL library])
    892 AS_CASE([$enable_fips_mode],
    893 	[yes], [AC_MSG_RESULT([yes])
    894 		AC_CHECK_FUNCS([FIPS_mode],
    895 			       [], [AC_MSG_FAILURE([OpenSSL FIPS mode requested but not available.])])],
    896 	[no], [AC_MSG_RESULT([no])])
    897 
    898 AX_RESTORE_FLAGS([openssl])
    899 
    900 AC_SUBST([OPENSSL_CFLAGS])
    901 AC_SUBST([OPENSSL_LIBS])
    902 
    903 PKCS11_TOOLS=
    904 PKCS11_TEST=
    905 PKCS11_MANS=
    906 #
    907 # was --enable-native-pkcs11 specified?
    908 #
    909 # [pairwise: --enable-native-pkcs11 --with-dlopen, --disable-native-pkcs11 --with-dlopen, --disable-native-pkcs11 --without-dlopen]
    910 AC_ARG_ENABLE(native-pkcs11,
    911 	      AS_HELP_STRING([--enable-native-pkcs11],
    912 			     [use native PKCS11 for public-key crypto [default=no]]),
    913 	      [:], [enable_native_pkcs11="no"])
    914 
    915 AC_MSG_CHECKING([for PKCS11 for Public-Key Cryptography])
    916 AS_CASE([$enable_native_pkcs11],
    917 	[no],[AC_MSG_RESULT([no])],
    918 	[yes],[PKCS11_TOOLS=pkcs11
    919 	       PKCS11_TEST=pkcs11
    920 	       PKCS11_MANS='${pkcs11_man8_MANS}'
    921 	       CRYPTO=pkcs11
    922 	       AS_IF([$use_threads],
    923 		     [:],
    924 		     [AC_MSG_ERROR([PKCS11 requires threading support])])
    925 	       AC_MSG_RESULT([yes])
    926 	       AC_CHECK_FUNCS([getpassphrase])
    927 	      ])
    928 AC_SUBST([PKCS11_TEST])
    929 AC_SUBST([PKCS11_TOOLS])
    930 AC_SUBST([PKCS11_MANS])
    931 
    932 AC_SUBST([CRYPTO])
    933 AS_CASE([$CRYPTO],
    934 	[pkcs11],[AC_DEFINE([USE_PKCS11], [1], [define if PKCS11 is used for Public-Key Cryptography])],
    935 	[AC_DEFINE([USE_OPENSSL], [1], [define if OpenSSL is used for Public-Key Cryptography])])
    936 
    937 # preparation for automake
    938 # AM_CONDITIONAL([PKCS11_TOOLS], [test "$with_native_pkcs11" = "yes"])
    939 
    940 #
    941 # was --with-pkcs11 specified?
    942 #
    943 # [pairwise: skip]
    944 AC_ARG_WITH([pkcs11],
    945 	    [AS_HELP_STRING([--with-pkcs11[=PATH]],
    946 			    [Build with PKCS11 support [no|path] (PATH is for the PKCS11 provider)])],
    947 	    [:], [with_pkcs11="undefined"])
    948 
    949 AS_CASE([$with_pkcs11],
    950 	[yes|auto],[AC_MSG_ERROR([--with-pkcs11 needs explicit path to the PKCS11 library])],
    951 	[no|undefined],[with_pkcs11="undefined"])
    952 AC_DEFINE_UNQUOTED([PK11_LIB_LOCATION], ["$with_pkcs11"], [define the default PKCS11 library path])
    953 
    954 # for PKCS11 benchmarks
    955 
    956 have_clock_gt=no
    957 AC_CHECK_FUNC(clock_gettime,have_clock_gt=yes,)
    958 if test "no" = "$have_clock_gt"; then
    959 	AC_CHECK_LIB(rt,clock_gettime,have_clock_gt=rt,)
    960 fi
    961 
    962 if test "no" != "$have_clock_gt"; then
    963 	AC_DEFINE(HAVE_CLOCK_GETTIME, 1, [Define if clock_gettime is available.])
    964 fi
    965 
    966 if test "rt" = "$have_clock_gt"; then
    967 	LIBS="-lrt $LIBS"
    968 fi
    969 
    970 AC_MSG_CHECKING(for GSSAPI library)
    971 
    972 # [pairwise: --with-gssapi=yes, --with-gssapi=auto, --without-gssapi]
    973 AC_ARG_WITH(gssapi,
    974 	    AS_HELP_STRING([--with-gssapi=[PATH|[/path/]krb5-config]],
    975 			   [Specify path for system-supplied GSSAPI
    976 				[default=auto]]),
    977 	    use_gssapi="$withval", use_gssapi="auto")
    978 
    979 # first try using krb5-config, if that does not work then fall back to "yes" method.
    980 
    981 case "$use_gssapi" in
    982 */krb5-config|krb5-config)
    983     AC_MSG_RESULT(trying $use_gssapi)
    984     if test krb5-config = "$use_gssapi"
    985     then
    986 	AC_PATH_PROG(KRB5_CONFIG, $use_gssapi)
    987     else
    988 	KRB5_CONFIG="$use_gssapi"
    989     fi
    990     gssapi_cflags=`$KRB5_CONFIG --cflags gssapi`
    991     gssapi_libs=`$KRB5_CONFIG --libs gssapi`
    992     saved_cppflags="$CPPFLAGS"
    993     CPPFLAGS="$gssapi_cflags $CPPFLAGS"
    994     AC_CHECK_HEADERS(gssapi.h gssapi/gssapi.h,
    995 	[ISC_PLATFORM_GSSAPIHEADER="#define ISC_PLATFORM_GSSAPIHEADER <$ac_header>"])
    996     if test "" = "$ISC_PLATFORM_GSSAPIHEADER"; then
    997 	AC_MSG_RESULT([krb5-config: gssapi.h not found])
    998 	CPPFLAGS="$saved_cppflags"
    999 	use_gssapi="yes"
   1000     else
   1001 	AC_CHECK_HEADERS(krb5/krb5.h krb5.h,
   1002 	    [ISC_PLATFORM_KRB5HEADER="#define ISC_PLATFORM_KRB5HEADER <$ac_header>"])
   1003 	if test "" = "$ISC_PLATFORM_KRB5HEADER"; then
   1004 	    AC_MSG_RESULT([krb5-config: krb5.h not found])
   1005 	    CPPFLAGS="$saved_cppflags"
   1006 	    use_gssapi="yes"
   1007 	else
   1008 	    CPPFLAGS="$saved_cppflags"
   1009 	    saved_libs="$LIBS"
   1010 	    LIBS=$gssapi_libs
   1011 	    AC_MSG_CHECKING([krb5-config linking as $LIBS])
   1012 	    AC_TRY_LINK( , [gss_acquire_cred();krb5_init_context()],
   1013 		gssapi_linked=yes, gssapi_linked=no)
   1014 	    case $gssapi_linked in
   1015 		yes) AC_MSG_RESULT([krb5-config: linked]);;
   1016 		no)  AC_MSG_RESULT([krb5-config: could not determine proper GSSAPI linkage])
   1017 		    use_gssapi="yes"
   1018 		    ;;
   1019 	    esac
   1020 	    LIBS=$saved_libs
   1021 	fi
   1022     fi
   1023     if test "yes" = "$use_gssapi"; then
   1024 	AC_MSG_CHECKING([for GSSAPI library, non krb5-config method])
   1025     fi
   1026     ;;
   1027 esac
   1028 
   1029 case "$host" in
   1030 *darwin*)
   1031 	if test "yes" = "$use_gssapi" -o "auto" = "$use_gssapi"
   1032 	then
   1033 		use_gssapi=framework
   1034 	fi
   1035 	;;
   1036 esac
   1037 
   1038 # gssapi is just the framework, we really require kerberos v5, so
   1039 # look for those headers (the gssapi headers must be there, too)
   1040 # The problem with this implementation is that it doesn't allow
   1041 # for the specification of gssapi and krb5 headers in different locations,
   1042 # which probably ought to be fixed although fixing might raise the issue of
   1043 # trying to build with incompatible versions of gssapi and krb5.
   1044 if test "yes" = "$use_gssapi" -o "auto" = "$use_gssapi"
   1045 then
   1046 	# first, deal with the obvious
   1047 	if test \( -f /usr/include/kerberosv5/krb5.h -o \
   1048 		   -f /usr/include/krb5/krb5.h -o \
   1049 		   -f /usr/include/krb5.h \)   -a \
   1050 		\( -f /usr/include/gssapi.h -o \
   1051 		   -f /usr/include/gssapi/gssapi.h \)
   1052 	then
   1053 		use_gssapi=/usr
   1054 	else
   1055 	    krb5dirs="/usr/local /usr/local/krb5 /usr/local/kerberosv5 /usr/local/kerberos /usr/pkg /usr/krb5 /usr/kerberosv5 /usr/kerberos /usr"
   1056 	    for d in $krb5dirs
   1057 	    do
   1058 		if test -f $d/include/gssapi/gssapi_krb5.h -o \
   1059 			-f $d/include/krb5.h
   1060 		then
   1061 			if test -f $d/include/gssapi/gssapi.h -o \
   1062 				-f $d/include/gssapi.h
   1063 			then
   1064 				use_gssapi=$d
   1065 				break
   1066 			fi
   1067 		fi
   1068 	    done
   1069 	    if test "auto" = "$use_gssapi"
   1070 	    then
   1071 		use_gssapi="no"
   1072 	    fi
   1073 	fi
   1074 fi
   1075 
   1076 case "$use_gssapi" in
   1077 	no)
   1078 		AC_MSG_RESULT(disabled)
   1079 		USE_GSSAPI=''
   1080 		;;
   1081 	yes)
   1082 		AC_MSG_ERROR([--with-gssapi must specify a path])
   1083 		;;
   1084 	*/krb5-config|krb5-config)
   1085 		USE_GSSAPI='-DGSSAPI'
   1086 		DST_GSSAPI_INC="$gssapi_cflags"
   1087 		DNS_GSSAPI_LIBS="$gssapi_libs"
   1088 		;;
   1089 	framework)
   1090 		USE_GSSAPI='-DGSSAPI'
   1091 		ISC_PLATFORM_GSSAPIHEADER="#define ISC_PLATFORM_GSSAPIHEADER <Kerberos/Kerberos.h>"
   1092 		ISC_PLATFORM_KRB5HEADER="#define ISC_PLATFORM_KRB5HEADER <Kerberos/Kerberos.h>"
   1093 		DNS_GSSAPI_LIBS="-framework Kerberos"
   1094 		AC_MSG_RESULT(framework)
   1095 		;;
   1096 
   1097 	*)
   1098 		AC_MSG_RESULT(looking in $use_gssapi/lib)
   1099 		USE_GSSAPI='-DGSSAPI'
   1100 		saved_cppflags="$CPPFLAGS"
   1101 		CPPFLAGS="-I$use_gssapi/include $CPPFLAGS"
   1102 		AC_CHECK_HEADERS(gssapi.h gssapi/gssapi.h,
   1103 		    [ISC_PLATFORM_GSSAPIHEADER="#define ISC_PLATFORM_GSSAPIHEADER <$ac_header>"
   1104 		     gssapi_hack="#include <$ac_header>"])
   1105 
   1106 		if test "" = "$ISC_PLATFORM_GSSAPIHEADER"; then
   1107 		    AC_MSG_ERROR([gssapi.h not found])
   1108 		fi
   1109 
   1110 		AC_CHECK_HEADERS(gssapi_krb5.h gssapi/gssapi_krb5.h,
   1111 		    [ISC_PLATFORM_GSSAPI_KRB5_HEADER="#define ISC_PLATFORM_GSSAPI_KRB5_HEADER <$ac_header>"
   1112 		     gssapi_krb5_hack="#include <$ac_header>"])
   1113 
   1114 		AC_CHECK_HEADERS(krb5.h krb5/krb5.h kerberosv5/krb5.h,
   1115 		    [ISC_PLATFORM_KRB5HEADER="#define ISC_PLATFORM_KRB5HEADER <$ac_header>"
   1116 		    krb5_hack="#include <$ac_header>"])
   1117 
   1118 		if test "" = "$ISC_PLATFORM_KRB5HEADER"; then
   1119 		    AC_MSG_ERROR([krb5.h not found])
   1120 		fi
   1121 
   1122 		#
   1123 		# XXXDCL This probably doesn't work right on all systems.
   1124 		# It will need to be worked on as problems become evident.
   1125 		#
   1126 		# Essentially the problems here relate to two different
   1127 		# areas.  The first area is building with either KTH
   1128 		# or MIT Kerberos, particularly when both are present on
   1129 		# the machine.  The other is static versus dynamic linking.
   1130 		#
   1131 		# On the KTH vs MIT issue, Both have libkrb5 that can mess
   1132 		# up the works if one implementation ends up trying to
   1133 		# use the other's krb.  This is unfortunately a situation
   1134 		# that very easily arises.
   1135 		#
   1136 		# Dynamic linking when the dependency information is built
   1137 		# into MIT's libgssapi_krb5 or KTH's libgssapi magically makes
   1138 		# all such problems go away, but when that setup is not
   1139 		# present, because either the dynamic libraries lack
   1140 		# dependencies or static linking is being done, then the
   1141 		# problems start to show up.
   1142 		saved_libs="$LIBS"
   1143 		for TRY_LIBS in \
   1144 		    "-lgssapi_krb5" \
   1145 		    "-lgssapi_krb5 -lkrb5 -lk5crypto -lcom_err" \
   1146 		    "-lgssapi_krb5 -lkrb5 -lk5crypto -lcom_err -lresolv" \
   1147 		    "-lgssapi" \
   1148 		    "-lgssapi -lkrb5 -ldes -lcrypt -lasn1 -lroken -lcom_err" \
   1149 		    "-lgssapi -lkrb5 -lcrypt -lasn1 -lroken -lcom_err" \
   1150 		    "-lgssapi -lkrb5 -lgssapi_krb5 -lcrypt -lasn1 -lroken -lcom_err" \
   1151 		    "-lgssapi -lkrb5 -lhx509 -lcrypt -lasn1 -lroken -lcom_err" \
   1152 		    "-lgss -lkrb5"
   1153 		do
   1154 		    # Note that this does not include $saved_libs, because
   1155 		    # on FreeBSD machines this configure script has added
   1156 		    # -L/usr/local/lib to LIBS, which can make the
   1157 		    # -lgssapi_krb5 test succeed with shared libraries even
   1158 		    # when you are trying to build with KTH in /usr/lib.
   1159 		    if test "/usr" = "$use_gssapi"
   1160 		    then
   1161 			    LIBS="$TRY_LIBS $ISC_OPENSSL_LIBS"
   1162 		    else
   1163 			    LIBS="-L$use_gssapi/lib $TRY_LIBS $ISC_OPENSSL_LIBS"
   1164 		    fi
   1165 		    AC_MSG_CHECKING(linking as $TRY_LIBS)
   1166 		    AC_TRY_LINK([
   1167 #include <sys/types.h>
   1168 $gssapi_hack
   1169 $gssapi_krb5_hack
   1170 $krb5_hack
   1171 				] , [gss_acquire_cred(NULL, NULL, 0, NULL, 0, NULL, NULL, NULL);krb5_init_context(NULL);
   1172 #if defined(HAVE_GSSAPI_KRB5_H) || defined(HAVE_GSSAPI_GSSAPI_KRB5_H)
   1173 gsskrb5_register_acceptor_identity(NULL);
   1174 #endif],
   1175 				gssapi_linked=yes, gssapi_linked=no)
   1176 		    case $gssapi_linked in
   1177 		    yes) AC_MSG_RESULT(yes); break ;;
   1178 		    no)  AC_MSG_RESULT(no) ;;
   1179 		    esac
   1180 		done
   1181 
   1182 		CPPFLAGS="$saved_cppflags"
   1183 
   1184 		case $gssapi_linked in
   1185 		no) AC_MSG_ERROR(could not determine proper GSSAPI linkage) ;;
   1186 		esac
   1187 
   1188 		#
   1189 		# XXXDCL Major kludge.  Tries to cope with KTH in /usr/lib
   1190 		# but MIT in /usr/local/lib and trying to build with KTH.
   1191 		# /usr/local/lib can end up earlier on the link lines.
   1192 		# Like most kludges, this one is not only inelegant it
   1193 		# is also likely to be the wrong thing to do at least as
   1194 		# many times as it is the right thing.  Something better
   1195 		# needs to be done.
   1196 		#
   1197 		if test "/usr" = "$use_gssapi" -a \
   1198 			-f /usr/local/lib/libkrb5.a; then
   1199 		    FIX_KTH_VS_MIT=yes
   1200 		fi
   1201 
   1202 		case "$FIX_KTH_VS_MIT" in
   1203 		yes)
   1204 		    case "$enable_static_linking" in
   1205 		    yes) gssapi_lib_suffix=".a"  ;;
   1206 		    *)   gssapi_lib_suffix=".so" ;;
   1207 		    esac
   1208 
   1209 		    for lib in $LIBS; do
   1210 			case $lib in
   1211 			-L*)
   1212 			    ;;
   1213 			-l*)
   1214 			    new_lib=`echo $lib |
   1215 				     sed -e s%^-l%$use_gssapi/lib/lib% \
   1216 					 -e s%$%$gssapi_lib_suffix%`
   1217 			    NEW_LIBS="$NEW_LIBS $new_lib"
   1218 			    ;;
   1219 			*)
   1220 			   AC_MSG_ERROR([KTH vs MIT Kerberos confusion!])
   1221 			    ;;
   1222 			esac
   1223 		    done
   1224 		    LIBS="$NEW_LIBS"
   1225 		    ;;
   1226 		esac
   1227 
   1228 		DST_GSSAPI_INC="-I$use_gssapi/include"
   1229 		DNS_GSSAPI_LIBS="$LIBS"
   1230 
   1231 		AC_MSG_RESULT(using GSSAPI from $use_gssapi/lib and $use_gssapi/include)
   1232 		LIBS="$saved_libs"
   1233 		;;
   1234 esac
   1235 
   1236 AC_SUBST(ISC_PLATFORM_GSSAPIHEADER)
   1237 AC_SUBST(ISC_PLATFORM_GSSAPI_KRB5_HEADER)
   1238 AC_SUBST(ISC_PLATFORM_KRB5HEADER)
   1239 
   1240 AC_SUBST(USE_GSSAPI)
   1241 AC_SUBST(DST_GSSAPI_INC)
   1242 AC_SUBST(DNS_GSSAPI_LIBS)
   1243 DNS_CRYPTO_LIBS="$DNS_GSSAPI_LIBS"
   1244 
   1245 #
   1246 # Applications linking with libdns also need to link with these libraries.
   1247 #
   1248 
   1249 AC_SUBST(DNS_CRYPTO_LIBS)
   1250 
   1251 #
   1252 # was --with-lmdb specified?
   1253 #
   1254 AC_MSG_CHECKING(for lmdb library)
   1255 
   1256 # [pairwise: --with-lmdb=auto, --with-lmdb=yes, --without-lmdb]
   1257 AC_ARG_WITH(lmdb,
   1258 	    AS_HELP_STRING([--with-lmdb[=PATH]],
   1259 			   [build with LMDB library [yes|no|path]]),
   1260     use_lmdb="$withval", use_lmdb="auto")
   1261 
   1262 have_lmdb=""
   1263 case "$use_lmdb" in
   1264 	no)
   1265 		LMDB_LIBS=""
   1266 		;;
   1267 	auto|yes)
   1268 		for d in /usr /usr/local /opt/local
   1269 		do
   1270 			if test -f "${d}/include/lmdb.h"
   1271 			then
   1272 				if test ${d} != /usr
   1273 				then
   1274 					LMDB_CFLAGS="-I ${d}/include"
   1275 					LMDB_LIBS="-L${d}/lib"
   1276 				fi
   1277 				have_lmdb="yes"
   1278 			fi
   1279 		done
   1280 		;;
   1281 	*)
   1282 		if test -f "${use_lmdb}/include/lmdb.h"
   1283 		then
   1284 			LMDB_CFLAGS="-I${use_lmdb}/include"
   1285 			LMDB_LIBS="-L${use_lmdb}/lib"
   1286 			have_lmdb="yes"
   1287 		else
   1288 			AC_MSG_ERROR([$use_lmdb/include/lmdb.h not found.])
   1289 		fi
   1290 		;;
   1291 esac
   1292 
   1293 if test "X${have_lmdb}" != "X"
   1294 then
   1295 	AC_MSG_RESULT(yes)
   1296 	AX_SAVE_FLAGS([lmdb])
   1297 	CFLAGS="$CFLAGS $LMDB_CFLAGS"
   1298 	LIBS="$LIBS $LMDB_LIBS"
   1299 	AC_SEARCH_LIBS([mdb_env_create], [lmdb], [],
   1300 		       [AC_MSG_ERROR([found lmdb include but not library.])
   1301 			have_lmdb=""])
   1302 	LMDB_LIBS="$LMDB_LIBS $ac_cv_search_mdb_env_create"
   1303 	AX_RESTORE_FLAGS([lmdb])
   1304 elif test "X$use_lmdb" = Xyes
   1305 then
   1306 	AC_MSG_ERROR([include/lmdb.h not found.])
   1307 else
   1308 	AC_MSG_RESULT(no)
   1309 fi
   1310 AC_SUBST([LMDB_CFLAGS])
   1311 AC_SUBST([LMDB_LIBS])
   1312 
   1313 NZD_TOOLS=""
   1314 NZDSRCS=
   1315 NZDTARGETS=
   1316 if test "X${have_lmdb}" != "X"
   1317 then
   1318 	AC_DEFINE(HAVE_LMDB, 1, [Define if lmdb was found])
   1319 	NZD_TOOLS="nzd"
   1320 	NZDSRCS='${NZDSRCS}'
   1321 	NZDTARGETS='${NZDTARGETS}'
   1322 	NZD_MANS='${nzd_man8_MANS}'
   1323 fi
   1324 AC_SUBST(NZD_TOOLS)
   1325 AC_SUBST(NZDSRCS)
   1326 AC_SUBST(NZDTARGETS)
   1327 AC_SUBST(NZD_MANS)
   1328 
   1329 #
   1330 # was --with-libxml2 specified?
   1331 #
   1332 # [pairwise: --with-libxml2=auto, --with-libxml2=yes, --without-libxml2]
   1333 AC_ARG_WITH([libxml2],
   1334 	    [AS_HELP_STRING([--with-libxml2],
   1335 			    [build with libxml2 library [yes|no|auto] (default is auto)])],
   1336 	    [], [with_libxml2="auto"])
   1337 
   1338 AS_CASE([$with_libxml2],
   1339 	[no],[],
   1340 	[auto],[PKG_CHECK_MODULES([LIBXML2], [libxml-2.0 >= 2.6.0],
   1341 				  [AC_DEFINE([HAVE_LIBXML2], [1], [Use libxml2 library])],
   1342 				  [:])],
   1343 	[yes],[PKG_CHECK_MODULES([LIBXML2], [libxml-2.0 >= 2.6.0],
   1344 				 [AC_DEFINE([HAVE_LIBXML2], [1], [Use libxml2 library])])],
   1345 	[AC_MSG_ERROR([Specifying libxml2 installation path is not supported, adjust PKG_CONFIG_PATH instead])])
   1346 
   1347 #
   1348 # DEPRECATED
   1349 #
   1350 # [pairwise: skip]
   1351 AC_ARG_WITH([libjson],
   1352 	    [AS_HELP_STRING([--with-libjson],
   1353 			    [deprecated, use --with-json-c])],
   1354 	    [AC_MSG_WARN([--with-libjson is DEPRECATED and will be removed in a future release, use --with-json-c instead])],
   1355 	    [with_libjson="detect"])
   1356 
   1357 #
   1358 # was --with-json-c specified?
   1359 #
   1360 # [pairwise: --with-json-c=detect, --with-json-c=yes, --without-json-c]
   1361 AC_ARG_WITH([json-c],
   1362 	    [AS_HELP_STRING([--with-json-c],
   1363 			    [build with json-c library [yes|no|detect] (default is detect)])],
   1364 	    [], [with_json_c="$with_libjson"])
   1365 
   1366 AS_CASE([$with_json_c],
   1367 	[no],[],
   1368 	[detect],[PKG_CHECK_MODULES([JSON_C], [json-c >= 0.11],
   1369 				    [AC_DEFINE([HAVE_JSON_C], [1], [Use json-c library])],
   1370 				    [:])],
   1371 	[yes],[PKG_CHECK_MODULES([JSON_C], [json-c >= 0.11],
   1372 				 [AC_DEFINE([HAVE_JSON_C], [1], [Use json-c library])])],
   1373 	[AC_MSG_ERROR([Specifying json-c installation path is not supported, adjust PKG_CONFIG_PATH instead])]
   1374        )
   1375 
   1376 AC_SUBST([JSON_C_CFLAGS])
   1377 AC_SUBST([JSON_C_LIBS])
   1378 
   1379 # [pairwise: --with-zlib=auto, --with-zlib=yes, --without-zlib]
   1380 AC_ARG_WITH([zlib],
   1381            [AS_HELP_STRING([--with-zlib],
   1382                            [build with zlib for HTTP compression
   1383                             [default=yes]])],
   1384 	   [], with_zlib="auto")
   1385 
   1386 AS_CASE([$with_zlib],
   1387        [no],[],
   1388        [auto],[PKG_CHECK_MODULES([ZLIB], [zlib],
   1389                                  [AC_DEFINE([HAVE_ZLIB], [1], [Use zlib library])],
   1390                                  [:])],
   1391        [yes],[PKG_CHECK_MODULES([ZLIB], [zlib],
   1392                                 [AC_DEFINE([HAVE_ZLIB], [1], [Use zlib library])])],
   1393        [AC_MSG_ERROR([Specifying zlib installation path is not supported, adjust PKG_CONFIG_PATH instead])])
   1394 AC_SUBST([ZLIB_CFLAGS])
   1395 AC_SUBST([ZLIB_LIBS])
   1396 
   1397 #
   1398 # In solaris 10, SMF can manage named service
   1399 #
   1400 AC_CHECK_LIB(scf, smf_enable_instance)
   1401 
   1402 #
   1403 # Additional compiler settings.
   1404 #
   1405 MKDEPCC="$CC"
   1406 
   1407 MKDEPCFLAGS="-M"
   1408 AS_CASE([$host],
   1409 	[*-solaris*],[
   1410 	    AS_IF([test "$GCC" != "yes"],
   1411 		  [MKDEPCFLAGS="-xM"])])
   1412 
   1413 AS_IF([test "$GCC" = "yes"],
   1414       [STD_CWARNINGS="$STD_CWARNINGS -W -Wall -Wmissing-prototypes -Wcast-qual -Wwrite-strings -Wformat -Wpointer-arith -Wno-missing-field-initializers"]
   1415       )
   1416 
   1417 AX_CHECK_COMPILE_FLAG([-fno-strict-aliasing],
   1418 		      [STD_CWARNINGS="$STD_CWARNINGS -fno-strict-aliasing"])
   1419 AX_CHECK_COMPILE_FLAG([-Werror -fno-delete-null-pointer-checks],
   1420 		      [STC_CWARNINGS="$STD_CWARNINGS -fno-delete-null-pointer-checks"])
   1421 AS_IF([test "$enable_warn_shadow" = "yes"],
   1422       [AX_CHECK_COMPILE_FLAG([-Wshadow],
   1423 			     [STD_CWARNINGS="$STD_CWARNINGS -Wshadow"])])
   1424 AS_IF([test "$enable_warn_error" = "yes"],
   1425       [AX_CHECK_COMPILE_FLAG([-Werror],
   1426 			     [STD_CWARNINGS="$STD_CWARNINGS -Werror"])])
   1427 
   1428 AC_SUBST([MKDEPCC])
   1429 AC_SUBST([MKDEPCFLAGS])
   1430 AC_SUBST([MKDEPPROG])
   1431 
   1432 #
   1433 # -lxnet buys us one big porting headache...  standards, gotta love 'em.
   1434 #
   1435 # AC_CHECK_LIB(xnet, socket, ,
   1436 #    AC_CHECK_LIB(socket, socket)
   1437 # )
   1438 #
   1439 # Use this for now, instead:
   1440 #
   1441 case "$host" in
   1442 	*-linux*)
   1443 		;;
   1444 	*)
   1445 		AC_CHECK_LIB(socket, socket)
   1446 		AC_CHECK_LIB(nsl, inet_addr)
   1447 		;;
   1448 esac
   1449 
   1450 #
   1451 # Work around Solaris's select() limitations.
   1452 #
   1453 case "$host" in
   1454 	*-solaris2.[[89]]|*-solaris2.1?)
   1455 	AC_DEFINE(FD_SETSIZE, 65536,
   1456 		  [Solaris hack to get select_large_fdset.])
   1457 	;;
   1458 esac
   1459 
   1460 #
   1461 # Purify support
   1462 #
   1463 AC_MSG_CHECKING(whether to use purify)
   1464 
   1465 # Purify is not included in pairwise testing as that tool is not present
   1466 # in the relevant Docker image.
   1467 #
   1468 # [pairwise: skip]
   1469 AC_ARG_WITH(purify,
   1470 	    AS_HELP_STRING([--with-purify[=PATH]],[use Rational purify]),
   1471 	    use_purify="$withval", use_purify="no")
   1472 
   1473 case "$use_purify" in
   1474 	no)
   1475 		;;
   1476 	yes)
   1477 		AC_PATH_PROG(purify_path, purify, purify)
   1478 		;;
   1479 	*)
   1480 		purify_path="$use_purify"
   1481 		;;
   1482 esac
   1483 
   1484 case "$use_purify" in
   1485 	no)
   1486 		AC_MSG_RESULT(no)
   1487 		PURIFY=""
   1488 		;;
   1489 	*)
   1490 		if test -f "$purify_path" || test purify = "$purify_path"; then
   1491 			AC_MSG_RESULT($purify_path)
   1492 			PURIFYFLAGS="`echo $PURIFYOPTIONS`"
   1493 			PURIFY="$purify_path $PURIFYFLAGS"
   1494 		else
   1495 			AC_MSG_ERROR([$purify_path not found.
   1496 
   1497 Please choose the proper path with the following command:
   1498 
   1499     configure --with-purify=PATH
   1500 ])
   1501 		fi
   1502 		;;
   1503 esac
   1504 
   1505 AC_SUBST(PURIFY)
   1506 
   1507 #
   1508 # Google/Great Performance Tools CPU Profiler
   1509 #
   1510 AC_MSG_CHECKING(whether to use gperftools profiler)
   1511 
   1512 # Google/Great Performance Tools CPU Profiler is not included in
   1513 # pairwise testing as that tool is not present in the relevant Docker
   1514 # image.
   1515 #
   1516 # [pairwise: skip]
   1517 AC_ARG_WITH(gperftools-profiler,
   1518 	    AS_HELP_STRING([--with-gperftools-profiler],
   1519 			   [use gperftools CPU profiler]),
   1520 	    use_profiler="$withval", use_profiler="no")
   1521 
   1522 case $use_profiler in
   1523 	yes)
   1524 		AC_MSG_RESULT(yes)
   1525 		AC_DEFINE([HAVE_GPERFTOOLS_PROFILER], 1,
   1526 		[Define to use gperftools CPU profiler.])
   1527 		LIBS="$LIBS -lprofiler"
   1528 		;;
   1529 	*)
   1530 		AC_MSG_RESULT(no)
   1531 		;;
   1532 esac
   1533 
   1534 #
   1535 # enable/disable dumping stack backtrace.  Also check if the system supports
   1536 # glibc-compatible backtrace() function.
   1537 #
   1538 # [pairwise: --enable-backtrace, --disable-backtrace]
   1539 AC_ARG_ENABLE([backtrace],
   1540 	      [AS_HELP_STRING([--enable-backtrace],
   1541 			      [log stack backtrace on abort [default=yes]])],
   1542 	      [], [enable_backtrace="yes"])
   1543 
   1544 AS_IF([test "$enable_backtrace" = "yes"],
   1545       [AC_DEFINE([USE_BACKTRACE], [1], [define if we can use backtrace])
   1546        AC_LINK_IFELSE(
   1547 	 [AC_LANG_PROGRAM(
   1548 	    [[#include <execinfo.h>]],
   1549 	    [[return (backtrace((void **)0, 0));]]
   1550 	  )],
   1551 	 [AC_DEFINE([HAVE_LIBCTRACE], [1], [define if system have backtrace function])],
   1552 	 [AC_LINK_IFELSE(
   1553 	    [AC_LANG_PROGRAM(
   1554 	       [[#include <stddef.h>]],
   1555 	       [[return _Unwind_Backtrace(NULL, NULL);]]
   1556 	     )],
   1557 	    [AC_DEFINE([HAVE_UNWIND_BACKTRACE], [1], [define if the compiler supports _Unwind_Backtrace()])]
   1558 	  )]
   1559        )])
   1560 
   1561 # [pairwise: --enable-symtable, --disable-symtable]
   1562 AC_ARG_ENABLE(symtable,
   1563 	      AS_HELP_STRING([--enable-symtable],
   1564 			     [use internal symbol table for backtrace
   1565 			      [all|minimal(default)|none]]),
   1566 		want_symtable="$enableval",  want_symtable="minimal")
   1567 case $want_symtable in
   1568 yes|all|minimal)     # "yes" is a hidden value equivalent to "minimal"
   1569 	if test "" = "$PERL"
   1570 	then
   1571 		AC_MSG_ERROR([Internal symbol table requires perl but no perl is found.
   1572 Install perl or explicitly disable the feature by --disable-symtable.])
   1573 	fi
   1574 	if test "yes" = "$use_libtool"; then
   1575 		AC_MSG_WARN([Internal symbol table does not work with libtool.  Disabling symbol table.])
   1576 	else
   1577 		# we generate the internal symbol table only for those systems
   1578 		# known to work to avoid unexpected build failure.  Also, warn
   1579 		# about unsupported systems when the feature is enabled
   1580 		#  manually.
   1581 		case $host_os in
   1582 		freebsd*|netbsd*|openbsd*|linux*|solaris*|darwin*)
   1583 			MKSYMTBL_PROGRAM="$PERL"
   1584 			if test "all" = "$want_symtable"; then
   1585 				ALWAYS_MAKE_SYMTABLE="yes"
   1586 			fi
   1587 			;;
   1588 		*)
   1589 			if test "yes" = "$want_symtable" -o "all" = "$want_symtable"
   1590 			then
   1591 				AC_MSG_WARN([this system is not known to generate internal symbol table safely; disabling it])
   1592 			fi
   1593 		esac
   1594 	fi
   1595 	;;
   1596 *)
   1597 	;;
   1598 esac
   1599 AC_SUBST(MKSYMTBL_PROGRAM)
   1600 AC_SUBST(ALWAYS_MAKE_SYMTABLE)
   1601 
   1602 #
   1603 # File name extension for static archive files, for those few places
   1604 # where they are treated differently from dynamic ones.
   1605 #
   1606 SA=a
   1607 
   1608 AC_SUBST(O)
   1609 AC_SUBST(A)
   1610 AC_SUBST(SA)
   1611 AC_SUBST(LIBTOOL_MKDEP_SED)
   1612 AC_SUBST(LIBTOOL_MODE_COMPILE)
   1613 AC_SUBST(LIBTOOL_MODE_INSTALL)
   1614 AC_SUBST(LIBTOOL_MODE_LINK)
   1615 AC_SUBST(LIBTOOL_MODE_UNINSTALL)
   1616 
   1617 BIND9_CO_RULE=".c.$O:"
   1618 AC_SUBST(BIND9_CO_RULE)
   1619 
   1620 #
   1621 # Here begins a very long section to determine the system's networking
   1622 # capabilities.  The order of the tests is significant.
   1623 #
   1624 
   1625 #
   1626 # We do the IPv6 compilation checking after libtool so that we can put
   1627 # the right suffix on the files.
   1628 #
   1629 AC_MSG_CHECKING([for IPv6 structures])
   1630 AC_COMPILE_IFELSE(
   1631   [AC_LANG_PROGRAM(
   1632      [[
   1633        #include <sys/types.h>
   1634        #include <sys/socket.h>
   1635        #include <netinet/in.h>
   1636      ]],
   1637      [[
   1638        struct sockaddr_in6 sin6;
   1639        struct in6_addr in6;
   1640        struct in6_pktinfo in6_pi;
   1641        struct sockaddr_storage storage;
   1642        in6 = in6addr_any;
   1643        in6 = in6addr_loopback;
   1644        sin6.sin6_scope_id = 0;
   1645        return (0);
   1646      ]])],
   1647   [AC_MSG_RESULT([yes])],
   1648   [AC_MSG_FAILURE([IPv6 support is mandatory])])
   1649 
   1650 #
   1651 # Allow forcibly disabling TCP Fast Open support as autodetection might yield
   1652 # confusing results on some systems (e.g. FreeBSD; see set_tcp_fastopen()
   1653 # comment in lib/isc/unix/socket.c).
   1654 #
   1655 # [pairwise: --enable-tcp-fastopen, --disable-tcp-fastopen]
   1656 AC_ARG_ENABLE([tcp_fastopen],
   1657 	      [AS_HELP_STRING([--disable-tcp-fastopen],
   1658 			      [disable TCP Fast Open support [default=yes]])],
   1659 	     [], [enable_tcp_fastopen="yes"])
   1660 
   1661 AS_IF([test "$enable_tcp_fastopen" = "yes"],
   1662       [AC_DEFINE([ENABLE_TCP_FASTOPEN], [1], [define if you want TCP_FASTOPEN enabled if available])])
   1663 
   1664 #
   1665 # Check for some other useful functions that are not ever-present.
   1666 #
   1667 AC_CHECK_FUNCS([strlcpy strlcat])
   1668 
   1669 AC_SUBST(READLINE_LIB)
   1670 
   1671 # [pairwise: --with-readline=auto, --with-readline=yes, --without-readline]
   1672 AC_ARG_WITH(readline,
   1673 	    AS_HELP_STRING([--with-readline[=LIBSPEC]],
   1674 			   [specify readline library [default auto]]),
   1675 	    use_readline="$withval", use_readline="auto")
   1676 case "$use_readline" in
   1677 no)	;;
   1678 *)
   1679 	saved_LIBS="$LIBS"
   1680 	case "$use_readline" in
   1681 	yes|auto) try_readline="-ledit"; or_readline="-lreadline" ;;
   1682 	*) try_readline="$use_readline"
   1683 	esac
   1684 	for readline in "$try_readline" $or_readline
   1685 	do
   1686 		LIBS="$readline"
   1687 		AC_MSG_NOTICE(checking for readline with $readline)
   1688 		AC_CHECK_FUNCS(readline)
   1689 		if test "yes" = "$ac_cv_func_readline"
   1690 		then
   1691 			READLINE_LIB="$readline"
   1692 			break
   1693 		fi
   1694 		for lib in -lterminfo -ltermcap -lncurses -lcurses
   1695 		do
   1696 			AC_MSG_NOTICE(checking for readline with $readline $lib)
   1697 			unset ac_cv_func_readline
   1698 			LIBS="$readline $lib"
   1699 			AC_CHECK_FUNCS(readline)
   1700 			if test "yes" = "$ac_cv_func_readline"
   1701 			then
   1702 				READLINE_LIB="$readline $lib"
   1703 				break
   1704 			fi
   1705 		done
   1706 		if test "yes" = "$ac_cv_func_readline"
   1707 		then
   1708 			break
   1709 		fi
   1710 	done
   1711 	if test "auto" != "$use_readline" &&
   1712 	   test "X$READLINE_LIB" = "X"
   1713 	then
   1714 		AC_MSG_ERROR([The readline library was not found.])
   1715 	fi
   1716 	LIBS="$saved_LIBS"
   1717 	;;
   1718 esac
   1719 if test "yes" = "$ac_cv_func_readline"
   1720 then
   1721 	case "$READLINE_LIB" in
   1722 	*edit*)
   1723 		AC_CHECK_HEADERS(editline/readline.h)
   1724 		AC_CHECK_HEADERS(edit/readline/readline.h)
   1725 		AC_CHECK_HEADERS(edit/readline/history.h)
   1726 		;;
   1727 	esac
   1728 	AC_CHECK_HEADERS(readline/readline.h)
   1729 	AC_CHECK_HEADERS(readline/history.h)
   1730 fi
   1731 
   1732 #
   1733 # Use our own SPNEGO implementation?
   1734 #
   1735 # [pairwise: --enable-isc-spnego, --disable-isc-spnego]
   1736 AC_ARG_ENABLE(isc-spnego,
   1737 	      AS_HELP_STRING([--disable-isc-spnego],
   1738 			     [use SPNEGO from GSSAPI library]))
   1739 
   1740 if test -n "$USE_GSSAPI"
   1741 then
   1742 	case "$enable_isc_spnego" in
   1743 		yes|'')
   1744 			USE_ISC_SPNEGO='-DUSE_ISC_SPNEGO'
   1745 			DST_EXTRA_OBJS="$DST_EXTRA_OBJS spnego.$O"
   1746 			DST_EXTRA_SRCS="$DST_EXTRA_SRCS spnego.c"
   1747 			AC_MSG_RESULT(using SPNEGO from lib/dns)
   1748 			;;
   1749 		no)
   1750 			AC_MSG_RESULT(using SPNEGO from GSSAPI library)
   1751 			;;
   1752 	esac
   1753 fi
   1754 
   1755 AC_SUBST(USE_ISC_SPNEGO)
   1756 
   1757 AC_SUBST(DST_EXTRA_OBJS)
   1758 AC_SUBST(DST_EXTRA_SRCS)
   1759 
   1760 #
   1761 # Security Stuff
   1762 #
   1763 # Note it is very recommended to *not* disable chroot(),
   1764 # this is only because chroot() was made obsolete by Posix.
   1765 #
   1766 # [pairwise: --enable-chroot, --disable-chroot]
   1767 AC_ARG_ENABLE(chroot, AS_HELP_STRING([--disable-chroot], [disable chroot]))
   1768 case "$enable_chroot" in
   1769 	yes|'')
   1770 		AC_CHECK_FUNCS(chroot)
   1771 		;;
   1772 	no)
   1773 		;;
   1774 esac
   1775 
   1776 LIBCAP_LIBS=""
   1777 AC_MSG_CHECKING([whether to enable Linux capabilities])
   1778 
   1779 # [pairwise: --enable-linux-caps, --disable-linux-caps]
   1780 AC_ARG_ENABLE([linux-caps],
   1781 	      [AS_HELP_STRING([--disable-linux-caps],
   1782 			      [disable Linux capabilities])],
   1783 	      [],
   1784 	      [AS_CASE([$host],
   1785 		       [*-linux*],[enable_linux_caps=yes],
   1786 		       [enable_linux_caps=no])])
   1787 
   1788 AS_IF([test "$enable_linux_caps" = "yes"],
   1789       [AC_MSG_RESULT([yes])
   1790        AC_CHECK_HEADERS([sys/capability.h],
   1791 			[],
   1792 			[AC_MSG_ERROR(m4_normalize([sys/capability.h header is required for Linux capabilities support.
   1793 						    Either install libcap or use --disable-linux-caps.]))])
   1794        AX_SAVE_FLAGS([cap])
   1795        AC_SEARCH_LIBS([cap_set_proc], [cap],
   1796 		      [LIBCAP_LIBS="$ac_cv_search_cap_set_proc"],
   1797 		      [AC_MSG_ERROR(m4_normalize([libcap is required for Linux capabilities support.
   1798 						  Either install libcap or use --disable-linux-caps.]))])
   1799        AX_RESTORE_FLAGS([cap])],
   1800       [AC_MSG_RESULT([no])])
   1801 AC_SUBST([LIBCAP_LIBS])
   1802 
   1803 AC_CHECK_HEADERS(sys/un.h,
   1804 ISC_PLATFORM_HAVESYSUNH="#define ISC_PLATFORM_HAVESYSUNH 1"
   1805 ,
   1806 ISC_PLATFORM_HAVESYSUNH="#undef ISC_PLATFORM_HAVESYSUNH"
   1807 )
   1808 AC_SUBST(ISC_PLATFORM_HAVESYSUNH)
   1809 
   1810 case "$host" in
   1811 *-solaris*)
   1812 	AC_DEFINE(NEED_SECURE_DIRECTORY, 1,
   1813 		  [Define if connect does not honour the permission on the UNIX domain socket.])
   1814 	;;
   1815 esac
   1816 
   1817 #
   1818 # Time Zone Stuff
   1819 #
   1820 AC_CHECK_FUNCS([tzset])
   1821 
   1822 AC_MSG_CHECKING(for optarg declaration)
   1823 AC_TRY_COMPILE([
   1824 #include <unistd.h>
   1825 ],
   1826 [optarg = 0;],
   1827 [AC_MSG_RESULT(yes)],
   1828 [AC_MSG_RESULT(no)
   1829 GEN_NEED_OPTARG="-DNEED_OPTARG=1"
   1830 AC_DEFINE(NEED_OPTARG, 1, [Defined if extern char *optarg is not declared.])])
   1831 
   1832 #
   1833 # Check for nanoseconds in file stats
   1834 #
   1835 AC_MSG_CHECKING([for st_mtim.tv_nsec])
   1836 AC_COMPILE_IFELSE(
   1837   [AC_LANG_PROGRAM(
   1838      [[#include <sys/fcntl.h>]],
   1839      [[struct stat s;
   1840        return(s.st_mtim.tv_nsec);
   1841       ]])],
   1842    [AC_DEFINE([HAVE_STAT_NSEC], [1], [define if struct stat has st_mtim.tv_nsec field])])
   1843 
   1844 #
   1845 # Check for if_nametoindex() for IPv6 scoped addresses support
   1846 #
   1847 AC_CHECK_FUNCS([if_nametoindex])
   1848 
   1849 AC_CHECK_FUNCS(nanosleep usleep explicit_bzero)
   1850 
   1851 ISC_ATOMIC_LIBS=""
   1852 AC_CHECK_HEADERS(
   1853   [stdatomic.h],
   1854   [AC_MSG_CHECKING([for memory model aware atomic operations])
   1855    AC_COMPILE_IFELSE(
   1856      [AC_LANG_PROGRAM(
   1857 	[[#include <stdatomic.h>]],
   1858 	[[atomic_int_fast32_t val = 0; atomic_fetch_add_explicit(&val, 1, memory_order_relaxed);]]
   1859       )],
   1860      [AC_MSG_RESULT([stdatomic.h])
   1861       AC_MSG_CHECKING([whether -latomic is needed for 64-bit stdatomic.h functions])
   1862       AC_LINK_IFELSE(
   1863 	[AC_LANG_PROGRAM(
   1864 	   [[#include <stdatomic.h>]],
   1865 	   [[atomic_int_fast64_t val = 0; atomic_fetch_add_explicit(&val, 1, memory_order_relaxed);]]
   1866 	 )],
   1867 	[AC_MSG_RESULT([no])],
   1868 	[ISC_ATOMIC_LIBS="-latomic"
   1869 	 AX_SAVE_FLAGS([atomic])
   1870 	 LIBS="$LIBS $ISC_ATOMIC_LIBS"
   1871 	 AC_LINK_IFELSE(
   1872 	   [AC_LANG_PROGRAM(
   1873 	      [[#include <stdatomic.h>]],
   1874 	      [[atomic_int_fast64_t val = 0; atomic_fetch_add_explicit(&val, 1, memory_order_relaxed);]]
   1875 	    )],
   1876 	   [AC_MSG_RESULT([yes])],
   1877 	   [AC_MSG_FAILURE([libatomic needed, but linking with -latomic failed, please fix your toolchain.])])
   1878 	 AX_RESTORE_FLAGS([atomic])
   1879 	])
   1880      ],
   1881      [AC_MSG_FAILURE([stdatomic.h header found, but compilation failed, please fix your toolchain.])]
   1882    )],
   1883   [AC_MSG_CHECKING([for memory model aware atomic operations])
   1884    AC_COMPILE_IFELSE(
   1885      [AC_LANG_PROGRAM(
   1886 	[[#include <inttypes.h>]],
   1887 	[[int32_t val = 0; __atomic_fetch_add(&val, 1, __ATOMIC_RELAXED);]]
   1888       )],
   1889      [AC_MSG_RESULT([__atomic builtins])
   1890       AC_DEFINE([HAVE___ATOMIC], [1], [define if __atomic builtins are not available])
   1891       AC_MSG_CHECKING([whether -latomic is needed for 64-bit __atomic builtins])
   1892       AC_LINK_IFELSE(
   1893 	[AC_LANG_PROGRAM(
   1894 	   [[#include <inttypes.h>]],
   1895 	   [[int64_t val = 0; __atomic_fetch_add(&val, 1, __ATOMIC_RELAXED);]]
   1896 	 )],
   1897 	[AC_MSG_RESULT([no])],
   1898 	[ISC_ATOMIC_LIBS="-latomic"
   1899 	 AX_SAVE_FLAGS([atomic])
   1900 	 LIBS="$LIBS $ISC_ATOMIC_LIBS"
   1901 	 AC_LINK_IFELSE(
   1902 	   [AC_LANG_PROGRAM(
   1903 	      [[#include <inttypes.h>]],
   1904 	      [[int64_t val = 0; __atomic_fetch_add(&val, 1, __ATOMIC_RELAXED);]]
   1905 	    )],
   1906 	   [AC_MSG_RESULT([yes])],
   1907 	   [AC_MSG_FAILURE([libatomic needed, but linking with -latomic failed, please fix your toolchain.])])
   1908 	 AX_RESTORE_FLAGS([atomic])
   1909 	])
   1910      ],
   1911      [AC_MSG_RESULT([__sync builtins])
   1912      ])
   1913   ])
   1914 LIBS="$LIBS $ISC_ATOMIC_LIBS"
   1915 
   1916 AC_CHECK_HEADERS([stdalign.h])
   1917 
   1918 AC_CHECK_HEADERS([uchar.h])
   1919 
   1920 #
   1921 # Check for __builtin_unreachable
   1922 #
   1923 AC_MSG_CHECKING([compiler support for __builtin_unreachable()])
   1924 AC_LINK_IFELSE(
   1925   [AC_LANG_PROGRAM(
   1926      [[]],
   1927      [[__builtin_unreachable();]]
   1928    )],
   1929   [AC_MSG_RESULT([yes])
   1930    AC_DEFINE([HAVE_BUILTIN_UNREACHABLE], [1], [define if the compiler supports __builtin_unreachable().])
   1931   ],
   1932   [AC_MSG_RESULT([no])
   1933   ])
   1934 
   1935 #
   1936 # Check for __builtin_expect
   1937 #
   1938 AC_MSG_CHECKING([compiler support for __builtin_expect])
   1939 AC_TRY_LINK(, [
   1940 	return (__builtin_expect(1, 1) ? 1 : 0);
   1941 ], [
   1942 	have_builtin_expect=yes
   1943 	AC_MSG_RESULT(yes)
   1944 ], [
   1945 	have_builtin_expect=no
   1946 	AC_MSG_RESULT(no)
   1947 ])
   1948 if test "yes" = "$have_builtin_expect"; then
   1949 	AC_DEFINE(HAVE_BUILTIN_EXPECT, 1, [Define to 1 if the compiler supports __builtin_expect.])
   1950 fi
   1951 
   1952 #
   1953 # Check for __builtin_clz
   1954 #
   1955 AC_MSG_CHECKING([compiler support for __builtin_clz])
   1956 AC_TRY_LINK(, [
   1957 	return (__builtin_clz(0xff) == 24 ? 1 : 0);
   1958 ], [
   1959 	have_builtin_clz=yes
   1960 	AC_MSG_RESULT(yes)
   1961 ], [
   1962 	have_builtin_clz=no
   1963 	AC_MSG_RESULT(no)
   1964 ])
   1965 if test "yes" = "$have_builtin_clz"; then
   1966 	AC_DEFINE(HAVE_BUILTIN_CLZ, 1, [Define to 1 if the compiler supports __builtin_clz.])
   1967 fi
   1968 
   1969 #
   1970 # Activate "rrset-order fixed" or not?
   1971 #
   1972 # [pairwise: --enable-fixed-rrset, --disable-fixed-rrset]
   1973 AC_ARG_ENABLE(fixed-rrset,
   1974 	      AS_HELP_STRING([--enable-fixed-rrset],
   1975 			     [enable fixed rrset ordering [default=no]]),
   1976 	      enable_fixed="$enableval", enable_fixed="no")
   1977 case "$enable_fixed" in
   1978 	yes)
   1979 		AC_DEFINE(DNS_RDATASET_FIXED, 1,
   1980 			  [Define to enable "rrset-order fixed" syntax.])
   1981 		;;
   1982 	no)
   1983 		;;
   1984 	*)
   1985 		;;
   1986 esac
   1987 
   1988 #
   1989 # Activate dnstap?
   1990 #
   1991 # [pairwise: --enable-dnstap, --disable-dnstap]
   1992 AC_ARG_ENABLE(dnstap,
   1993 	      AS_HELP_STRING([--enable-dnstap],
   1994 			     [enable dnstap support
   1995 				(requires fstrm, protobuf-c)]),
   1996 	      use_dnstap=$enableval, use_dnstap=no)
   1997 
   1998 DNSTAP=
   1999 DNSTAPSRCS=
   2000 DNSTAPOBJS=
   2001 DNSTAPTARGETS=
   2002 if test "x$use_dnstap" != "xno"; then
   2003 
   2004 	# [pairwise: skip]
   2005 	AC_ARG_WITH([protobuf-c],
   2006 		    AS_HELP_STRING([--with-protobuf-c=path],
   2007 				   [Path where protobuf-c is installed, for dnstap]), [
   2008 	    # workaround for protobuf-c includes at old dir
   2009 	    # before protobuf-c-1.0.0
   2010 	    if test -f $withval/include/google/protobuf-c/protobuf-c.h
   2011 	    then
   2012 		PROTOBUF_C_CFLAGS="-I$withval/include/google"
   2013 	    else
   2014 		PROTOBUF_C_CFLAGS="-I$withval/include"
   2015 	    fi
   2016 	    PROTOBUF_C_LIBS="-L$withval/lib"
   2017 	    AC_PATH_PROG([PROTOC_C], [protoc-c], [],
   2018 			 [$PATH$PATH_SEPARATOR$withval/bin])
   2019 	], [
   2020 	    # workaround for protobuf-c includes at old dir
   2021 	    # before protobuf-c-1.0.0
   2022 	    if test -f /usr/include/google/protobuf-c/protobuf-c.h
   2023 	    then
   2024 		PROTOBUF_C_CFLAGS="-I/usr/include/google"
   2025 	    else
   2026 		if test -f /usr/local/include/google/protobuf-c/protobuf-c.h
   2027 		then
   2028 		    PROTOBUF_C_CFLAGS="-I/usr/local/include/google"
   2029 		    PROTOBUF_C_LIBS="-L/usr/local/lib"
   2030 		elif test -f /opt/local/include/google/protobuf-c/protobuf-c.h
   2031 		then
   2032 		    PROTOBUF_C_CFLAGS="-I/opt/local/include/google"
   2033 		    PROTOBUF_C_LIBS="-L/opt/local/lib"
   2034 		fi
   2035 	    fi
   2036 	    AC_PATH_PROG([PROTOC_C],[protoc-c])
   2037 	])
   2038 	if test -z "$PROTOC_C"; then
   2039 		AC_MSG_ERROR([The protoc-c program was not found.])
   2040 	fi
   2041 
   2042 	# [pairwise: skip]
   2043 	AC_ARG_WITH([libfstrm], AS_HELP_STRING([--with-libfstrm=path],
   2044 		    [Path where libfstrm is installed, for dnstap]), [
   2045 	    FSTRM_CFLAGS="-I$withval/include"
   2046 	    FSTRM_LIBS="-L$withval/lib"
   2047 	    AC_PATH_PROG([FSTRM_CAPTURE], [fstrm_capture], [], [$PATH$PATH_SEPARATOR$withval/bin])
   2048 	],[
   2049 	    for d in /usr /usr/local /opt/local
   2050 	    do
   2051 		if test -f "${d}/include/fstrm.h"
   2052 		then
   2053 		    if test ${d} != /usr
   2054 		    then
   2055 			FSTRM_CFLAGS="-I${d}/include"
   2056 			FSTRM_LIBS="-L${d}/lib"
   2057 		    fi
   2058 		    have_fstrm="$d"
   2059 		    break
   2060 		fi
   2061 	    done
   2062 	    if test -z "$have_fstrm"; then
   2063 		AC_PATH_PROG([FSTRM_CAPTURE], [fstrm_capture])
   2064 	    else
   2065 		AC_PATH_PROG([FSTRM_CAPTURE], [fstrm_capture], [], [$PATH$PATH_SEPARATOR$have_fstrm/bin])
   2066 	    fi
   2067 	])
   2068 	AX_SAVE_FLAGS([dnstap])
   2069 	CFLAGS="$CFLAGS $PROTOBUF_C_CFLAGS $FSTRM_CFLAGS"
   2070 	LIBS="$LDFLAGS $PROTOBUF_C_LIBS $FSTRM_LIBS"
   2071 
   2072 	AC_SEARCH_LIBS([fstrm_iothr_init], [fstrm], [],
   2073 		       AC_MSG_ERROR([The fstrm library was not found. Please install fstrm!]))
   2074 	FSTRM_LIBS="$FSTRM_LIBS $ac_cv_search_fstrm_iothr_init"
   2075 
   2076 	AC_SEARCH_LIBS([protobuf_c_message_pack], [protobuf-c], [],
   2077 		       AC_MSG_ERROR([The protobuf-c library was not found. Please install protobuf-c!]))
   2078 	PROTOBUF_C_LIBS="$PROTOBUF_C_LIBS $ac_cv_search_protobuf_c_message_pack"
   2079 
   2080 	AX_RESTORE_FLAGS([dnstap])
   2081 	AC_DEFINE(HAVE_DNSTAP, 1, [Define to 1 to enable dnstap support])
   2082 	DNSTAP=dnstap
   2083 	DNSTAPSRCS='${DNSTAPSRCS}'
   2084 	DNSTAPOBJS='${DNSTAPOBJS}'
   2085 	DNSTAPTARGETS='${DNSTAPTARGETS}'
   2086 	DNSTAP_MANS='${dnstap_man1_MANS}'
   2087 fi
   2088 AC_SUBST(DNSTAP)
   2089 AC_SUBST(DNSTAPSRCS)
   2090 AC_SUBST(DNSTAPOBJS)
   2091 AC_SUBST(DNSTAPTARGETS)
   2092 AC_SUBST(DNSTAP_MANS)
   2093 AC_SUBST([PROTOBUF_C_CFLAGS])
   2094 AC_SUBST([PROTOBUF_C_LIBS])
   2095 AC_SUBST([FSTRM_CFLAGS])
   2096 AC_SUBST([FSTRM_LIBS])
   2097 
   2098 #
   2099 #  The following sets up how non-blocking i/o is established.
   2100 #  cygwin and solaris 2.x (x<5) require special handling.
   2101 #
   2102 case "$host" in
   2103 *-cygwin*) AC_DEFINE(PORT_NONBLOCK, O_NDELAY);;
   2104 *-solaris2.[[01234]])
   2105 	AC_DEFINE(PORT_NONBLOCK, O_NONBLOCK)
   2106 	AC_DEFINE(USE_FIONBIO_IOCTL, 1,
   2107 		  [Defined if you need to use ioctl(FIONBIO) instead a fcntl call to make non-blocking.])
   2108 	;;
   2109 *) AC_DEFINE(PORT_NONBLOCK, O_NONBLOCK,
   2110 	     [Sets which flag to pass to open/fcntl to make non-blocking (O_NDELAY/O_NONBLOCK).])
   2111 	;;
   2112 esac
   2113 #
   2114 # Solaris 2.5.1 and earlier cannot bind() then connect() a TCP socket.
   2115 # This prevents the source address being set.
   2116 #
   2117 case "$host" in
   2118 *-solaris2.[[012345]]|*-solaris2.5.1)
   2119 	AC_DEFINE(BROKEN_TCP_BIND_BEFORE_CONNECT, 1,
   2120 		  [Define if you cannot bind() before connect() for TCP sockets.])
   2121 	;;
   2122 esac
   2123 #
   2124 # The following sections deal with tools used for formatting
   2125 # the documentation.  They are all optional, unless you are
   2126 # a developer editing the documentation source.
   2127 #
   2128 
   2129 #
   2130 # The following sections deal with tools used for formatting
   2131 # the documentation.  They are all optional, unless you are
   2132 # a developer editing the documentation source.
   2133 #
   2134 
   2135 #
   2136 # Look for sphinx-build
   2137 #
   2138 AC_ARG_VAR([SPHINX_BUILD], [path to sphinx-build binary used to build the documentation])
   2139 AC_PATH_PROG([SPHINX_BUILD], [sphinx-build], [:])
   2140 AM_CONDITIONAL([HAVE_SPHINX_BUILD], [test "$SPHINX_BUILD" != ":"])
   2141 
   2142 AC_PATH_PROG([XELATEX], [xelatex], [:])
   2143 AC_PATH_PROG([LATEXMK], [latexmk], [:])
   2144 AM_CONDITIONAL([HAVE_XELATEX], [test "$XELATEX" != ":" && test "$LATEXMK" != ":"])
   2145 
   2146 #
   2147 # Pull release date from CHANGES file last modification date
   2148 # for reproducible builds
   2149 #
   2150 release_date=`date -r CHANGES +%Y-%m-%d`
   2151 AC_SUBST([RELEASE_DATE], $release_date)
   2152 
   2153 # Don't build the documentation if the sphinx-build is not present
   2154 PDFTARGET=
   2155 HTMLTARGET=
   2156 MANSRCS=
   2157 AS_IF([test -n "$SPHINX_BUILD"],[
   2158 	  MANSRCS='$(MANPAGES_IN)'
   2159 	  HTMLTARGET='html dirhtml'
   2160 	  AC_PATH_PROGS([PDFLATEX], [pdflatex], [])
   2161 	  AC_PATH_PROGS([LATEXMK], [latexmk], [])
   2162 	  AS_IF([test -n "$PDFLATEX" && test -n "$LATEXMK"],[
   2163 		    PDFTARGET='pdf'
   2164 		])
   2165       ])
   2166 AC_SUBST([HTMLTARGET])
   2167 AC_SUBST([PDFTARGET])
   2168 AC_SUBST([MANSRCS])
   2169 
   2170 #
   2171 # Look for Doxygen
   2172 #
   2173 AC_PATH_PROGS([DOXYGEN], [doxygen])
   2174 AC_SUBST(DOXYGEN)
   2175 
   2176 #
   2177 # Look for curl
   2178 #
   2179 
   2180 AC_PATH_PROG(CURL, curl, curl)
   2181 AC_SUBST(CURL)
   2182 
   2183 #
   2184 # IDN support using libidn2
   2185 #
   2186 
   2187 LIBIDN2_CFLAGS=
   2188 LIBIDN2_LDFLAGS=
   2189 LIBIDN2_LIBS=
   2190 
   2191 # [pairwise: --with-libidn2=yes, --without-libidn2]
   2192 AC_ARG_WITH([libidn2],
   2193 	    [AS_HELP_STRING([--with-libidn2[=PATH]], [enable IDN support using GNU libidn2 [yes|no(default)|path]])],
   2194 	    [with_libidn2="$withval"], [with_libidn2="no"])
   2195 AS_CASE([$with_libidn2],
   2196 	[yes],	[PKG_CHECK_MODULES([LIBIDN2], [libidn2],
   2197 				   [AC_DEFINE([HAVE_LIBIDN2], [1], [Define if libidn2 was found])])],
   2198 	[no],	[],
   2199 	[*],	[AX_SAVE_FLAGS([libidn2])
   2200 		 LIBIDN2_CFLAGS="-I$with_libidn2/include"
   2201 		 LIBIDN2_LDFLAGS="-L$with_libidn2/lib"
   2202 		 CFLAGS="$LIBIDN2_CFLAGS $CFLAGS"
   2203 		 CPPFLAGS="$LIBIDN2_CFLAGS $CPPFLAGS"
   2204 		 LDFLAGS="$LIBIDN2_LDFLAGS $LDFLAGS"
   2205 		 AC_CHECK_HEADERS([idn2.h],
   2206 				  [],
   2207 				  [AC_MSG_ERROR([idn2.h not found])])
   2208 		 AC_SEARCH_LIBS([idn2_to_ascii_lz], [idn2],
   2209 				[LIBIDN2_LIBS="$ac_cv_search_idn2_to_ascii_lz"
   2210 				 AC_DEFINE([HAVE_LIBIDN2], [1], [Define if libidn2 was found])],
   2211 				[AC_MSG_ERROR([libidn2 requested, but not found])])
   2212 		AX_RESTORE_FLAGS([libidn2])])
   2213 AC_SUBST([LIBIDN2_CFLAGS])
   2214 AC_SUBST([LIBIDN2_LDFLAGS])
   2215 AC_SUBST([LIBIDN2_LIBS])
   2216 
   2217 #
   2218 # Check whether to build with cmocka unit testing framework
   2219 #
   2220 # [pairwise: --with-cmocka=detect, --with-cmocka=yes, --without-cmocka]
   2221 AC_ARG_WITH([cmocka],
   2222 	    [AS_HELP_STRING([--with-cmocka=detect],[enable CMocka based tests (default is detect)])],
   2223 	    [],[with_cmocka=detect])
   2224 
   2225 AS_CASE([$with_cmocka],
   2226 	[no],[],
   2227 	[detect],[PKG_CHECK_MODULES([CMOCKA], [cmocka >= 1.0.0],
   2228 				    [AC_DEFINE([HAVE_CMOCKA], [1], [Use CMocka])],
   2229 				    [with_cmocka=no])],
   2230 	[yes],[PKG_CHECK_MODULES([CMOCKA], [cmocka >= 1.0.0],
   2231 				 [AC_DEFINE([HAVE_CMOCKA], [1], [Use CMocka])])],
   2232 	[AC_MSG_ERROR([Use PKG_CONFIG_PATH to specify path to CMocka library])]
   2233        )
   2234 AC_SUBST([CMOCKA_CFLAGS])
   2235 AC_SUBST([CMOCKA_LIBS])
   2236 
   2237 #
   2238 # Check for kyua execution engine if CMocka was requested
   2239 # and bail out if execution engine was not found
   2240 #
   2241 AC_ARG_VAR([KYUA], [path to kyua execution engine])
   2242 AS_IF([test "$with_cmocka" != "no"],
   2243       [AC_PATH_PROGS([KYUA], [kyua], [])
   2244        AS_IF([test -z "$KYUA"],
   2245              [AC_MSG_WARN([kyua test execution engine not found])],
   2246              [UNITTESTS=tests])])
   2247 AC_SUBST([KYUA])
   2248 AC_SUBST([UNITTESTS])
   2249 
   2250 #
   2251 # Check for -Wl,--wrap= support
   2252 #
   2253 
   2254 LD_WRAP_TESTS=false
   2255 AC_MSG_CHECKING([for linker support for --wrap option])
   2256 AX_SAVE_FLAGS([wrap])
   2257 LDFLAGS="-Wl,--wrap,exit"
   2258 AC_LINK_IFELSE(
   2259     [AC_LANG_PROGRAM([[#include <stdlib.h>
   2260 		       void __real_exit (int status);
   2261 		       void __wrap_exit (int status) { __real_exit (0); }
   2262 		      ]],
   2263 		     [[exit (1);]])],
   2264     [LD_WRAP_TESTS=true
   2265      AC_DEFINE([LD_WRAP], [1], [define if the linker supports --wrap option])
   2266      AC_MSG_RESULT([yes])],
   2267     [AC_MSG_RESULT([no])])
   2268 AX_RESTORE_FLAGS([wrap])
   2269 
   2270 AC_SUBST([LD_WRAP_TESTS])
   2271 
   2272 #
   2273 # Check for i18n
   2274 #
   2275 AC_CHECK_HEADERS(locale.h)
   2276 AC_CHECK_FUNCS(setlocale)
   2277 
   2278 #
   2279 # was --with-tuning specified?
   2280 #
   2281 # [pairwise: --with-tuning=small, --without-tuning]
   2282 AC_ARG_WITH([tuning],
   2283 	    AS_HELP_STRING([--with-tuning=ARG],
   2284 			   [Specify server tuning (default or small)]),
   2285 	    [],[with_tuning=no])
   2286 
   2287 AS_CASE([$with_tuning],
   2288 	[small],[AC_MSG_NOTICE(using small system tuning)],
   2289 	[AC_DEFINE(TUNE_LARGE, 1, [Define to use default system tuning.])
   2290 	 AC_MSG_NOTICE(using default system tuning)])
   2291 
   2292 #
   2293 # was --enable-querytrace specified?
   2294 #
   2295 # [pairwise: --enable-querytrace, --disable-querytrace]
   2296 AC_ARG_ENABLE(querytrace,
   2297 	      AS_HELP_STRING([--enable-querytrace],
   2298 			     [enable very verbose query trace logging
   2299 				[default=no]]),
   2300 	      want_querytrace="$enableval", want_querytrace="no")
   2301 
   2302 AC_MSG_CHECKING([whether to enable query trace logging])
   2303 case "$want_querytrace" in
   2304 yes)
   2305 	AC_MSG_RESULT(yes)
   2306 	AC_DEFINE(WANT_QUERYTRACE, 1, [Define to enable very verbose query trace logging.])
   2307 	;;
   2308 no)
   2309 	AC_MSG_RESULT(no)
   2310 	;;
   2311 *)
   2312 	AC_MSG_ERROR("--enable-querytrace requires yes or no")
   2313 	;;
   2314 esac
   2315 
   2316 #
   2317 # Was --disable-auto-validation specified?
   2318 #
   2319 
   2320 validation_default=auto
   2321 
   2322 # [pairwise: --enable-auto-validation, --disable-auto-validation]
   2323 AC_ARG_ENABLE(auto-validation,
   2324 	      AS_HELP_STRING([--enable-auto-validation],
   2325 			     [turn on DNSSEC validation by default, using the IANA root key [default=yes]]),
   2326 	      [:],[enable_auto_validation=yes])
   2327 AS_IF([test "$enable_auto_validation" = "no"],[validation_default=yes])
   2328 AC_DEFINE_UNQUOTED([VALIDATION_DEFAULT], ["$validation_default"], [the default value of dnssec-validation option])
   2329 
   2330 #
   2331 # Substitutions
   2332 #
   2333 AC_SUBST(BIND9_TOP_BUILDDIR)
   2334 BIND9_TOP_BUILDDIR=`pwd`
   2335 
   2336 AC_SUBST(BIND9_ISC_BUILDINCLUDE)
   2337 AC_SUBST(BIND9_ISCCC_BUILDINCLUDE)
   2338 AC_SUBST(BIND9_ISCCFG_BUILDINCLUDE)
   2339 AC_SUBST(BIND9_DNS_BUILDINCLUDE)
   2340 AC_SUBST(BIND9_NS_BUILDINCLUDE)
   2341 AC_SUBST(BIND9_BIND9_BUILDINCLUDE)
   2342 AC_SUBST(BIND9_IRS_BUILDINCLUDE)
   2343 if test "X$srcdir" != "X"; then
   2344 	BIND9_ISC_BUILDINCLUDE="-I${BIND9_TOP_BUILDDIR}/lib/isc/include"
   2345 	BIND9_ISCCC_BUILDINCLUDE="-I${BIND9_TOP_BUILDDIR}/lib/isccc/include"
   2346 	BIND9_ISCCFG_BUILDINCLUDE="-I${BIND9_TOP_BUILDDIR}/lib/isccfg/include"
   2347 	BIND9_DNS_BUILDINCLUDE="-I${BIND9_TOP_BUILDDIR}/lib/dns/include"
   2348 	BIND9_NS_BUILDINCLUDE="-I${BIND9_TOP_BUILDDIR}/lib/ns/include"
   2349 	BIND9_BIND9_BUILDINCLUDE="-I${BIND9_TOP_BUILDDIR}/lib/bind9/include"
   2350 	BIND9_IRS_BUILDINCLUDE="-I${BIND9_TOP_BUILDDIR}/lib/irs/include"
   2351 else
   2352 	BIND9_ISC_BUILDINCLUDE=""
   2353 	BIND9_ISCCC_BUILDINCLUDE=""
   2354 	BIND9_ISCCFG_BUILDINCLUDE=""
   2355 	BIND9_DNS_BUILDINCLUDE=""
   2356 	BIND9_NS_BUILDINCLUDE=""
   2357 	BIND9_BIND9_BUILDINCLUDE=""
   2358 	BIND9_IRS_BUILDINCLUDE=""
   2359 fi
   2360 
   2361 AC_SUBST_FILE(BIND9_MAKE_INCLUDES)
   2362 BIND9_MAKE_INCLUDES=$BIND9_TOP_BUILDDIR/make/includes
   2363 
   2364 AC_SUBST_FILE(BIND9_MAKE_RULES)
   2365 BIND9_MAKE_RULES=$BIND9_TOP_BUILDDIR/make/rules
   2366 
   2367 . "$srcdir/version"
   2368 BIND9_PRODUCT="PRODUCT=\"${PRODUCT}\""
   2369 AC_SUBST(BIND9_PRODUCT)
   2370 BIND9_DESCRIPTION="DESCRIPTION=\"${DESCRIPTION}\""
   2371 AC_SUBST(BIND9_DESCRIPTION)
   2372 BIND9_VERSION="${MAJORVER}.${MINORVER}${PATCHVER:+.}${PATCHVER}${RELEASETYPE}${RELEASEVER}${EXTENSIONS}"
   2373 AC_SUBST(BIND9_VERSION)
   2374 BIND9_MAJOR="MAJOR=${MAJORVER}.${MINORVER}"
   2375 AC_SUBST(BIND9_MAJOR)
   2376 BIND9_VERSIONSTRING="${PRODUCT} ${MAJORVER}.${MINORVER}${PATCHVER:+.}${PATCHVER}${RELEASETYPE}${RELEASEVER}${EXTENSIONS}${DESCRIPTION:+ }${DESCRIPTION}"
   2377 AC_SUBST(BIND9_VERSIONSTRING)
   2378 
   2379 BIND9_SRCID="SRCID=unset_id"
   2380 if test -f "${srcdir}/srcid"; then
   2381 	. "${srcdir}/srcid"
   2382 	BIND9_SRCID="SRCID=$SRCID"
   2383 elif test -d "${srcdir}/.git"; then
   2384 	BIND9_SRCID="SRCID="`(cd "${srcdir}";git rev-parse --short HEAD)`
   2385 fi
   2386 
   2387 AC_SUBST(BIND9_SRCID)
   2388 
   2389 if test -z "$ac_configure_args"; then
   2390 	BIND9_CONFIGARGS="defaults"
   2391 else
   2392 	for a in $ac_configure_args
   2393 	do
   2394 		BIND9_CONFIGARGS="$BIND9_CONFIGARGS $a"
   2395 	done
   2396 fi
   2397 BIND9_CONFIGARGS="`echo $BIND9_CONFIGARGS | sed 's/^ //'`"
   2398 BIND9_CONFIGARGS="CONFIGARGS=${BIND9_CONFIGARGS}"
   2399 AC_SUBST(BIND9_CONFIGARGS)
   2400 
   2401 AC_SUBST_FILE(LIBDNS_MAPAPI)
   2402 LIBDNS_MAPAPI="$srcdir/lib/dns/mapapi"
   2403 
   2404 #
   2405 # Configure any DLZ drivers.
   2406 #
   2407 # If config.dlz.in selects one or more DLZ drivers, it will set
   2408 # CONTRIB_DLZ to a non-empty value, which will be our clue to
   2409 # build DLZ drivers in contrib.
   2410 #
   2411 # This section has to come after the libtool stuff because it needs to
   2412 # know how to name the driver object files.
   2413 #
   2414 
   2415 CONTRIB_DLZ=""
   2416 DLZ_DRIVER_INCLUDES=""
   2417 DLZ_DRIVER_LIBS=""
   2418 DLZ_DRIVER_SRCS=""
   2419 DLZ_DRIVER_OBJS=""
   2420 DLZ_SYSTEM_TEST=""
   2421 DLZ_DRIVER_MYSQL_INCLUDES=""
   2422 DLZ_DRIVER_MYSQL_LIBS=""
   2423 
   2424 #
   2425 # Configure support for building a shared library object
   2426 #
   2427 # Even when libtool is available it can't always be relied upon
   2428 # to build an object that can be dlopen()'ed, but this is necessary
   2429 # for building the dlzexternal system test, so we'll try it the
   2430 # old-fashioned way.
   2431 #
   2432 SO="so"
   2433 SO_CFLAGS=""
   2434 SO_LDFLAGS=""
   2435 SO_LD=""
   2436 SO_TARGETS=""
   2437 SO_STRIP="cat"
   2438 
   2439 # [pairwise: skip]
   2440 AC_ARG_WITH([dlopen],
   2441 	    AS_HELP_STRING([--with-dlopen=ARG],
   2442 			   [support dynamically loadable DLZ and DYNDB drivers]),
   2443 	    [], [with_dlopen="auto"])
   2444 
   2445 
   2446 #
   2447 # If PIC is disabled, dlopen must also be
   2448 #
   2449 AS_IF([test "$pic_mode" = "no"],
   2450       [AS_CASE([$with_dlopen],
   2451 	       [auto],[with_dlopen="no"],
   2452 	       [yes],[AC_MSG_ERROR([--with-dlopen requires PIC])])])
   2453 
   2454 AS_CASE([$with_dlopen],
   2455 	[auto|yes],[
   2456 	  # -fsanitize=thread hijacks dlopen and dlclose so use dlsym.
   2457 	  AC_SEARCH_LIBS([dlsym],[dl])
   2458 	  AC_CHECK_FUNCS([dlopen dlclose dlsym],
   2459 			 [with_dlopen="yes"],
   2460 			 [with_dlopen="no"])
   2461 	])
   2462 
   2463 AS_IF([test "$with_dlopen" = "yes"],
   2464       [AS_CASE([$host],
   2465 	       [*-linux*|*-gnu*],[
   2466 		 LDFLAGS="${LDFLAGS} -Wl,--export-dynamic"
   2467 		 SO_CFLAGS="-fPIC"
   2468 		 SO_LDFLAGS=""
   2469 		 AS_IF([test "$use_libtool" = "yes"],[
   2470 			 SO_LDFLAGS="-Xcompiler -shared"
   2471 			 SO_LD="${CC}"
   2472 		       ],[
   2473 			 SO_LDFLAGS="-shared"
   2474 			 SO_LD="${CC}"
   2475 		       ])
   2476 	       ],
   2477 	       [*-freebsd*|*-openbsd*|*-netbsd*],[
   2478 		 LDFLAGS="${LDFLAGS} -Wl,-E"
   2479 		 SO_CFLAGS="-fpic"
   2480 		 AS_IF([test "$use_libtool" = "yes"],[
   2481 			 SO_LDFLAGS="-Xcompiler -shared"
   2482 			 SO_LD="${CC}"
   2483 		       ],[
   2484 			 SO_LDFLAGS="-shared"
   2485 			 SO_LD="${CC}"
   2486 		       ])
   2487 	       ],
   2488 	       [*-darwin*],[
   2489 		 SO_CFLAGS="-fPIC"
   2490                  SO_LD="${CC}"
   2491 		 AS_IF([test "$use_libtool" = "yes"],[
   2492 			 SO_LDFLAGS="-Xcompiler -dynamiclib -undefined dynamic_lookup"
   2493 		       ],[
   2494 			 SO_LDFLAGS="-dynamiclib -undefined dynamic_lookup"
   2495 		       ])
   2496 	       ],
   2497 	       [*-solaris*],[
   2498 		 SO_CFLAGS="-KPIC"
   2499 		 SO_LDFLAGS="-G -z text"
   2500 		 SO_LD="ld"
   2501 	       ],
   2502 	       [ia64-hp-hpux*],[
   2503 		 SO_CFLAGS="+z"
   2504 	         SO_LDFLAGS="-b"
   2505 		 SO_LD="${CC}"
   2506 	       ],
   2507 	       [
   2508 		 SO_CFLAGS="-fPIC"
   2509 	       ])
   2510        AS_IF([test "$GCC" = "yes"],[
   2511 	       SO_CFLAGS="-fPIC"
   2512 	       AS_IF([test -z "$SO_LD"],
   2513 		     [AS_IF([test "$use_libtool" = "yes"],[
   2514 			      SO_LDFLAGS="-Xcompiler -shared"
   2515 			      SO_LD="${CC}"
   2516 			    ],[
   2517 			      SO_LDFLAGS="-shared"
   2518 			      SO_LD="${CC}"
   2519 			    ])
   2520 		     ])
   2521 	     ])
   2522        # If we still don't know how to make shared objects, don't make any.
   2523        AS_IF([test -n "$SO_LD"],
   2524 	     [SO_TARGETS="\${SO_TARGETS}"
   2525 	      AC_DEFINE([ISC_DLZ_DLOPEN], [1],
   2526 			[Define to allow building of objects for dlopen().])
   2527 	     ])
   2528       ])
   2529 
   2530 AS_IF([test "$with_dlopen" = "no" -a "$enable_native_pkcs11" = "yes"],
   2531       [AC_MSG_ERROR([PKCS11 requires dlopen() support])])
   2532 
   2533 CFLAGS="$CFLAGS $SO_CFLAGS"
   2534 
   2535 AC_SUBST(SO)
   2536 AC_SUBST(SO_CFLAGS)
   2537 AC_SUBST(SO_LDFLAGS)
   2538 AC_SUBST(SO_LD)
   2539 AC_SUBST(SO_STRIP)
   2540 AC_SUBST(SO_TARGETS)
   2541 
   2542 #
   2543 # Response policy rewriting using DNS Response Policy Service (DNSRPS)
   2544 # interface.
   2545 #
   2546 # DNSRPS can be compiled into BIND everywhere with a reasonably
   2547 # modern C compiler.  It is enabled on systems with dlopen() and librpz.so.
   2548 #
   2549 dnsrps_avail=yes
   2550 AC_MSG_CHECKING([for librpz __attribute__s])
   2551 AC_COMPILE_IFELSE(
   2552   [AC_LANG_PROGRAM(
   2553      [[]],
   2554      [[
   2555        extern void f(char *p __attribute__((unused)), ...)
   2556        __attribute__((format(printf,1,2))) __attribute__((__noreturn__));
   2557      ]])],
   2558   [
   2559     librpz_have_attr=yes
   2560     AC_DEFINE([LIBRPZ_HAVE_ATTR], [1], [have __attribute__s used in librpz.h])
   2561     AC_MSG_RESULT([yes])
   2562   ],[
   2563     librpz_have_attr=no
   2564     AC_MSG_RESULT([no])
   2565   ])
   2566 
   2567 # DNSRPS is not included in pairwise testing as the librpz library is not
   2568 # present in the relevant Docker image.
   2569 #
   2570 # [pairwise: skip]
   2571 AC_ARG_ENABLE([dnsrps-dl],
   2572 	      [AS_HELP_STRING([--enable-dnsrps-dl],
   2573 			      [DNS Response Policy Service delayed link
   2574 			       [default=$librpz_dl]])],
   2575 	      [enable_librpz_dl="$enableval"], [enable_librpz_dl="$with_dlopen"])
   2576 
   2577 AS_IF([test "$enable_librpz_dl" = "yes" -a "$with_dlopen" = "no"],
   2578       [AC_MSG_ERROR([DNS Response Policy Service delayed link requires dlopen to be enabled])])
   2579 
   2580 # [pairwise: skip]
   2581 AC_ARG_WITH([dnsrps-libname],
   2582 	    [AS_HELP_STRING([--with-dnsrps-libname],
   2583 			    [DNSRPS provider library name (librpz.so)])],
   2584 	    [librpz_name="$withval"], [librpz_name="librpz.so"])
   2585 
   2586 # [pairwise: skip]
   2587 AC_ARG_WITH([dnsrps-dir],
   2588 	    [AS_HELP_STRING([--with-dnsrps-dir],
   2589 			    [path to DNSRPS provider library])],
   2590 	    [librpz_path="$withval/$librpz_name"], [librpz_path="$librpz_name"])
   2591 AC_DEFINE_UNQUOTED([DNSRPS_LIBRPZ_PATH], ["$librpz_path"],
   2592 		   [dnsrps $librpz_name])
   2593 AS_IF([test "$enable_librpz_dl" = "yes"],
   2594       [
   2595 	dnsrps_lib_open=2
   2596       ],[
   2597 	dnsrps_lib_open=1
   2598 	# Add librpz.so to linked libraries if we are not using dlopen()
   2599 	AC_SEARCH_LIBS([librpz_client_create], [rpz], [],
   2600 		[dnsrps_lib_open=0
   2601 		 dnsrps_avail=no])
   2602       ])
   2603 AC_DEFINE_UNQUOTED([DNSRPS_LIB_OPEN], [$dnsrps_lib_open],
   2604 		   [0=no DNSRPS  1=static link  2=dlopen()])
   2605 
   2606 # [pairwise: skip]
   2607 AC_ARG_ENABLE([dnsrps],
   2608 	      AS_HELP_STRING([--enable-dnsrps],
   2609 			     [enable DNS Response Policy Service API]),
   2610 	      [enable_dnsrps=$enableval], [enable_dnsrps=no])
   2611 
   2612 AS_IF([test "$enable_dnsrps" != "no"],[
   2613 	AS_IF([test "$dnsrps_avail" != "yes"],
   2614 	      [AC_MSG_ERROR([dlopen and librpz.so needed for DNSRPS])])
   2615 	AS_IF([test "$dnsrps_lib_open" = "0"],
   2616 	      [AC_MSG_ERROR([dlopen and librpz.so needed for DNSRPS])])
   2617 	AC_DEFINE([USE_DNSRPS], [1], [Enable DNS Response Policy Service API])
   2618       ])
   2619 
   2620 sinclude(contrib/dlz/config.dlz.in)
   2621 AC_MSG_CHECKING(contributed DLZ drivers)
   2622 
   2623 if test -n "$CONTRIB_DLZ"
   2624 then
   2625 	AC_MSG_RESULT(yes)
   2626 	DLZ_DRIVER_RULES=contrib/dlz/drivers/rules
   2627 	AC_CONFIG_FILES([$DLZ_DRIVER_RULES
   2628 		contrib/dlz/modules/mysql/Makefile
   2629 		contrib/dlz/modules/mysqldyn/Makefile])
   2630 else
   2631 	AC_MSG_RESULT(no)
   2632 	DLZ_DRIVER_RULES=/dev/null
   2633 fi
   2634 
   2635 AC_SUBST(CONTRIB_DLZ)
   2636 AC_SUBST(DLZ_DRIVER_INCLUDES)
   2637 AC_SUBST(DLZ_DRIVER_LIBS)
   2638 AC_SUBST(DLZ_DRIVER_SRCS)
   2639 AC_SUBST(DLZ_DRIVER_OBJS)
   2640 AC_SUBST(DLZ_SYSTEM_TEST)
   2641 AC_SUBST(DLZ_DRIVER_MYSQL_INCLUDES)
   2642 AC_SUBST(DLZ_DRIVER_MYSQL_LIBS)
   2643 AC_SUBST_FILE(DLZ_DRIVER_RULES)
   2644 
   2645 if test "yes" = "$cross_compiling"; then
   2646 	if test -z "$BUILD_CC"; then
   2647 		AC_MSG_ERROR([BUILD_CC not set])
   2648 	fi
   2649 	BUILD_CFLAGS="$BUILD_CFLAGS"
   2650 	BUILD_CPPFLAGS="$BUILD_CPPFLAGS"
   2651 	BUILD_LDFLAGS="$BUILD_LDFLAGS"
   2652 	BUILD_LIBS="$BUILD_LIBS"
   2653 else
   2654 	BUILD_CC="$CC"
   2655 	BUILD_CFLAGS="$CFLAGS"
   2656 	BUILD_CPPFLAGS="$CPPFLAGS $GEN_NEED_OPTARG"
   2657 	BUILD_LDFLAGS="$LDFLAGS"
   2658 	BUILD_LIBS="$LIBS"
   2659 fi
   2660 
   2661 NEWFLAGS=""
   2662 for e in $BUILD_LDFLAGS ; do
   2663     case $e in
   2664 	-L*)
   2665 	    case $host_os in
   2666 		netbsd*)
   2667 		    ee=`echo $e | sed -e 's%^-L%-Wl,-rpath,%'`
   2668 		    NEWFLAGS="$NEWFLAGS $e $ee"
   2669 		    ;;
   2670 		freebsd*)
   2671 		    ee=`echo $e | sed -e 's%^-L%-Wl,-rpath,%'`
   2672 		    NEWFLAGS="$NEWFLAGS $e $ee"
   2673 		    ;;
   2674 		solaris*)
   2675 		    ee=`echo $e | sed -e 's%^-L%-R%'`
   2676 		    NEWFLAGS="$NEWFLAGS $e $ee"
   2677 		    ;;
   2678 		*)
   2679 		    NEWFLAGS="$NEWFLAGS $e"
   2680 		    ;;
   2681 		esac
   2682 	    ;;
   2683 	*)
   2684 	    NEWFLAGS="$NEWFLAGS $e"
   2685 	    ;;
   2686     esac
   2687 done
   2688 BUILD_LDFLAGS="$NEWFLAGS"
   2689 
   2690 NEWFLAGS=""
   2691 for e in $DNS_GSSAPI_LIBS ; do
   2692     case $e in
   2693 	-L*)
   2694 	    case $host_os in
   2695 		netbsd*)
   2696 		    ee=`echo $e | sed -e 's%^-L%-Wl,-rpath,%'`
   2697 		    NEWFLAGS="$NEWFLAGS $e $ee"
   2698 		    ;;
   2699 		freebsd*)
   2700 		    ee=`echo $e | sed -e 's%^-L%-Wl,-rpath,%'`
   2701 		    NEWFLAGS="$NEWFLAGS $e $ee"
   2702 		    ;;
   2703 		solaris*)
   2704 		    ee=`echo $e | sed -e 's%^-L%-R%'`
   2705 		    NEWFLAGS="$NEWFLAGS $e $ee"
   2706 		    ;;
   2707 		*)
   2708 		    NEWFLAGS="$NEWFLAGS $e"
   2709 		    ;;
   2710 		esac
   2711 	    ;;
   2712 	*)
   2713 	    NEWFLAGS="$NEWFLAGS $e"
   2714 	    ;;
   2715     esac
   2716 done
   2717 DNS_GSSAPI_LIBS="$NEWFLAGS"
   2718 
   2719 NEWFLAGS=""
   2720 for e in $ISC_OPENSSL_LIBS ; do
   2721     case $e in
   2722 	-L*)
   2723 	    case $host_os in
   2724 		netbsd*)
   2725 		    ee=`echo $e | sed -e 's%^-L%-Wl,-rpath,%'`
   2726 		    NEWFLAGS="$NEWFLAGS $e $ee"
   2727 		    ;;
   2728 		freebsd*)
   2729 		    ee=`echo $e | sed -e 's%^-L%-Wl,-rpath,%'`
   2730 		    NEWFLAGS="$NEWFLAGS $e $ee"
   2731 		    ;;
   2732 		solaris*)
   2733 		    ee=`echo $e | sed -e 's%^-L%-R%'`
   2734 		    NEWFLAGS="$NEWFLAGS $e $ee"
   2735 		    ;;
   2736 		*)
   2737 		    NEWFLAGS="$NEWFLAGS $e"
   2738 		    ;;
   2739 		esac
   2740 	    ;;
   2741 	*)
   2742 	    NEWFLAGS="$NEWFLAGS $e"
   2743 	    ;;
   2744     esac
   2745 done
   2746 ISC_OPENSSL_LIBS="$NEWFLAGS"
   2747 
   2748 NEWFLAGS=""
   2749 for e in $DNS_CRYPTO_LIBS ; do
   2750     case $e in
   2751 	-L*)
   2752 	    case $host_os in
   2753 		netbsd*)
   2754 		    ee=`echo $e | sed -e 's%^-L%-Wl,-rpath,%'`
   2755 		    NEWFLAGS="$NEWFLAGS $e $ee"
   2756 		    ;;
   2757 		freebsd*)
   2758 		    ee=`echo $e | sed -e 's%^-L%-Wl,-rpath,%'`
   2759 		    NEWFLAGS="$NEWFLAGS $e $ee"
   2760 		    ;;
   2761 		solaris*)
   2762 		    ee=`echo $e | sed -e 's%^-L%-R%'`
   2763 		    NEWFLAGS="$NEWFLAGS $e $ee"
   2764 		    ;;
   2765 		*)
   2766 		    NEWFLAGS="$NEWFLAGS $e"
   2767 		    ;;
   2768 		esac
   2769 	    ;;
   2770 	*)
   2771 	    NEWFLAGS="$NEWFLAGS $e"
   2772 	    ;;
   2773     esac
   2774 done
   2775 DNS_CRYPTO_LIBS="$NEWFLAGS"
   2776 
   2777 AC_SUBST(BUILD_CC)
   2778 AC_SUBST(BUILD_CFLAGS)
   2779 AC_SUBST(BUILD_CPPFLAGS)
   2780 AC_SUBST(BUILD_LDFLAGS)
   2781 AC_SUBST(BUILD_LIBS)
   2782 
   2783 #
   2784 # Commands to run at the end of config.status.
   2785 # Don't just put these into configure, it won't work right if somebody
   2786 # runs config.status directly (which autoconf allows).
   2787 #
   2788 
   2789 AC_CONFIG_COMMANDS(
   2790 	[chmod],
   2791 	[chmod a+x doc/doxygen/doxygen-input-filter])
   2792 
   2793 #
   2794 # Files to configure.  These are listed here because we used to
   2795 # specify them as arguments to AC_OUTPUT.  It's (now) ok to move these
   2796 # elsewhere if there's a good reason for doing so.
   2797 #
   2798 
   2799 AC_CONFIG_FILES([
   2800 	Makefile
   2801 	bin/Makefile
   2802 	bin/check/Makefile
   2803 	bin/confgen/Makefile
   2804 	bin/confgen/unix/Makefile
   2805 	bin/delv/Makefile
   2806 	bin/dig/Makefile
   2807 	bin/dnssec/Makefile
   2808 	bin/named/Makefile
   2809 	bin/named/unix/Makefile
   2810 	bin/nsupdate/Makefile
   2811 	bin/pkcs11/Makefile
   2812 	bin/plugins/Makefile
   2813 	bin/python/Makefile
   2814 	bin/python/dnssec-checkds.py
   2815 	bin/python/dnssec-coverage.py
   2816 	bin/python/dnssec-keymgr.py
   2817 	bin/python/isc/Makefile
   2818 	bin/python/isc/__init__.py
   2819 	bin/python/isc/checkds.py
   2820 	bin/python/isc/coverage.py
   2821 	bin/python/isc/dnskey.py
   2822 	bin/python/isc/eventlist.py
   2823 	bin/python/isc/keydict.py
   2824 	bin/python/isc/keyevent.py
   2825 	bin/python/isc/keymgr.py
   2826 	bin/python/isc/keyseries.py
   2827 	bin/python/isc/keyzone.py
   2828 	bin/python/isc/policy.py
   2829 	bin/python/isc/rndc.py
   2830 	bin/python/isc/tests/Makefile
   2831 	bin/python/isc/tests/dnskey_test.py
   2832 	bin/python/isc/tests/policy_test.py
   2833 	bin/python/isc/utils.py
   2834 	bin/rndc/Makefile
   2835 	bin/tests/Makefile
   2836 	bin/tests/headerdep_test.sh
   2837 	bin/tests/optional/Makefile
   2838 	bin/tests/pkcs11/Makefile
   2839 	bin/tests/pkcs11/benchmarks/Makefile
   2840 	bin/tests/system/Makefile
   2841 	bin/tests/system/conf.sh
   2842 	bin/tests/system/dlzexternal/Makefile
   2843 	bin/tests/system/dlzexternal/ns1/dlzs.conf
   2844 	bin/tests/system/dyndb/Makefile
   2845 	bin/tests/system/dyndb/driver/Makefile
   2846 	bin/tests/system/pipelined/Makefile
   2847 	bin/tests/system/rndc/Makefile
   2848 	bin/tests/system/rpz/Makefile
   2849 	bin/tests/system/rsabigexponent/Makefile
   2850 	bin/tests/system/tkey/Makefile
   2851 	bin/tools/Makefile
   2852 	contrib/scripts/check-secure-delegation.pl
   2853 	contrib/scripts/zone-edit.sh
   2854 	doc/Makefile
   2855 	doc/arm/Makefile
   2856 	doc/doxygen/Doxyfile
   2857 	doc/doxygen/Makefile
   2858 	doc/doxygen/doxygen-input-filter
   2859 	doc/man/Makefile
   2860 	doc/misc/Makefile
   2861 	fuzz/Makefile
   2862 	lib/Makefile
   2863 	lib/bind9/Makefile
   2864 	lib/bind9/include/Makefile
   2865 	lib/bind9/include/bind9/Makefile
   2866 	lib/dns/Makefile
   2867 	lib/dns/include/Makefile
   2868 	lib/dns/include/dns/Makefile
   2869 	lib/dns/include/dst/Makefile
   2870 	lib/dns/tests/Makefile
   2871 	lib/irs/Makefile
   2872 	lib/irs/include/Makefile
   2873 	lib/irs/include/irs/Makefile
   2874 	lib/irs/include/irs/netdb.h
   2875 	lib/irs/include/irs/platform.h
   2876 	lib/irs/tests/Makefile
   2877 	lib/isc/Makefile
   2878 	lib/isc/include/Makefile
   2879 	lib/isc/include/isc/Makefile
   2880 	lib/isc/include/isc/platform.h
   2881 	lib/isc/include/pk11/Makefile
   2882 	lib/isc/include/pkcs11/Makefile
   2883 	lib/isc/netmgr/Makefile
   2884 	lib/isc/pthreads/Makefile
   2885 	lib/isc/pthreads/include/Makefile
   2886 	lib/isc/pthreads/include/isc/Makefile
   2887 	lib/isc/tests/Makefile
   2888 	lib/isc/unix/Makefile
   2889 	lib/isc/unix/include/Makefile
   2890 	lib/isc/unix/include/isc/Makefile
   2891 	lib/isccc/Makefile
   2892 	lib/isccc/include/Makefile
   2893 	lib/isccc/include/isccc/Makefile
   2894 	lib/isccc/tests/Makefile
   2895 	lib/isccfg/Makefile
   2896 	lib/isccfg/include/Makefile
   2897 	lib/isccfg/include/isccfg/Makefile
   2898 	lib/isccfg/tests/Makefile
   2899 	lib/ns/Makefile
   2900 	lib/ns/include/Makefile
   2901 	lib/ns/include/ns/Makefile
   2902 	lib/ns/tests/Makefile
   2903 	lib/samples/Makefile
   2904 	lib/samples/Makefile-postinstall
   2905 	make/Makefile
   2906 	make/mkdep
   2907 	unit/unittest.sh
   2908 	util/check-make-install
   2909 ])
   2910 
   2911 #
   2912 # Do it
   2913 #
   2914 
   2915 AC_OUTPUT
   2916 
   2917 #
   2918 # Now that the Makefiles exist we can ensure that everything is rebuilt.
   2919 #
   2920 # [pairwise: --with-make-clean, --without-make-clean]
   2921 AC_ARG_WITH(make-clean,
   2922 	    AS_HELP_STRING([--with-make-clean],
   2923 			   [run "make clean" at end of configure [yes|no]]),
   2924     make_clean="$withval", make_clean="yes")
   2925 case "$make_clean" in
   2926 yes)
   2927 	if test "yes" != "$no_create"
   2928 	then
   2929 		if test "yes" = "$silent"
   2930 		then
   2931 			make clean > /dev/null
   2932 		else
   2933 			make clean
   2934 		fi
   2935 	fi
   2936 	;;
   2937 esac
   2938 
   2939 # [pairwise: --enable-full-report, --disable-full-report]
   2940 AC_ARG_ENABLE(full-report,
   2941 	      AS_HELP_STRING([--enable-full-report],
   2942 			     [report values of all configure options]))
   2943 
   2944 report() {
   2945     echo "==============================================================================="
   2946     echo "Configuration summary:"
   2947     echo "-------------------------------------------------------------------------------"
   2948     echo "Optional features enabled:"
   2949     if test "yes" = "$enable_full_report" -o "standard" = "$with_locktype"; then
   2950 	echo "    Mutex lock type: $with_locktype"
   2951     fi
   2952     test "small" = "$with_tuning" && echo "    Small-system tuning (--with-tuning)"
   2953     test "no" = "$use_dnstap" || \
   2954 	    echo "    Allow 'dnstap' packet logging (--enable-dnstap)"
   2955     test -z "$MAXMINDDB_LIBS" || echo "    GeoIP2 access control (--enable-geoip)"
   2956     test "no" = "$use_gssapi" || echo "    GSS-API (--with-gssapi)"
   2957 
   2958     # these lines are only printed if run with --enable-full-report
   2959     if test "yes" = "$enable_full_report"; then
   2960 	test "no" = "$found_ipv6" || echo "    IPv6 support (--enable-ipv6)"
   2961 	test "X$PYTHON" = "X" || echo "    Python tools (--with-python)"
   2962 	test "X$LIBXML2_LIBS" = "X" || echo "    XML statistics (--with-libxml2)"
   2963 	test "X$JSON_C_LIBS" = "X" || echo "    JSON statistics (--with-json-c): $JSON_C_CFLAGS $JSON_C_LIBS"
   2964 	test "X$ZLIB_LIBS" = "X" || echo "    HTTP zlib compression (--with-zlib)"
   2965 	test "X$NZD_TOOLS" = "X" || echo "    LMDB database to store configuration for 'addzone' zones (--with-lmdb)"
   2966 	test "no" = "$with_libidn2" || echo "    IDN support (--with-libidn2)"
   2967     fi
   2968 
   2969     test "yes" = "$enable_dnsrps" && \
   2970 	echo "    DNS Response Policy Service interface (--enable-dnsrps)"
   2971     test "yes" = "$enable_fixed" && \
   2972 	echo "    Allow 'fixed' rrset-order (--enable-fixed-rrset)"
   2973     test "yes" = "$enable_backtrace" && \
   2974 	echo "    Print backtrace on crash (--enable-backtrace)"
   2975     test "minimal" = "$want_symtable" && \
   2976 	echo "    Use symbol table for backtrace, named only (--enable-symtable)"
   2977     test "yes" = "$want_symtable" -o "all" = "$want_symtable" && \
   2978 	echo "    Use symbol table for backtrace, all binaries (--enable-symtable=all)"
   2979     test "no" = "$use_libtool" || echo "    Use GNU libtool (--with-libtool)"
   2980     test "yes" = "$want_querytrace" && \
   2981 	echo "    Very verbose query trace logging (--enable-querytrace)"
   2982     test "no" = "$with_cmocka" || echo "    CMocka Unit Testing Framework (--with-cmocka)"
   2983 
   2984     test "auto" = "$validation_default" && echo "    DNSSEC validation active by default (--enable-auto-validation)"
   2985 
   2986     test "$CRYPTO" = "pkcs11" && (
   2987 	echo "    Using PKCS#11 for Public-Key Cryptography (--with-native-pkcs11)"
   2988 	echo "    PKCS#11 module (--with-pkcs11): $with_pkcs11"
   2989     )
   2990 
   2991     echo "    Dynamically loadable zone (DLZ) drivers:"
   2992     test "no" = "$use_dlz_bdb" || \
   2993 	echo "        Berkeley DB (--with-dlz-bdb)"
   2994     test "no" = "$use_dlz_ldap" || \
   2995 	echo "        LDAP (--with-dlz-ldap)"
   2996     test "no" = "$use_dlz_mysql" || \
   2997 	echo "        MySQL (--with-dlz-mysql)"
   2998     test "no" = "$use_dlz_odbc" || \
   2999 	echo "        ODBC (--with-dlz-odbc)"
   3000     test "no" = "$use_dlz_postgres" || \
   3001 	echo "        Postgres (--with-dlz-postgres)"
   3002     test "no" = "$use_dlz_filesystem" || \
   3003 	echo "        Filesystem (--with-dlz-filesystem)"
   3004     test "no" = "$use_dlz_stub" || \
   3005 	echo "        Stub (--with-dlz-stub)"
   3006     test "$use_dlz_bdb $use_dlz_ldap $use_dlz_mysql $use_dlz_odbc $use_dlz_postgres $use_dlz_filesystem $use_dlz_stub" = "no no no no no no no" && echo "        None"
   3007 
   3008     echo "-------------------------------------------------------------------------------"
   3009 
   3010     echo "Features disabled or unavailable on this platform:"
   3011     test "no" = "$found_ipv6" && echo "    IPv6 support (--enable-ipv6)"
   3012     test "small" = "$with_tuning" || echo "    Small-system tuning (--with-tuning)"
   3013 
   3014     test "no" = "$use_dnstap" && \
   3015 	    echo "    Allow 'dnstap' packet logging (--enable-dnstap)"
   3016     test -z "$MAXMINDDB_LIBS" && echo "    GeoIP2 access control (--enable-geoip)"
   3017     test "no" = "$use_gssapi" && echo "    GSS-API (--with-gssapi)"
   3018 
   3019     test "no" = "$enable_dnsrps" && \
   3020 	echo "    DNS Response Policy Service interface (--enable-dnsrps)"
   3021 
   3022     test "yes" = "$enable_fixed" || \
   3023 	echo "    Allow 'fixed' rrset-order (--enable-fixed-rrset)"
   3024 
   3025     test "yes" = "$validation_default" && echo "    DNSSEC validation requires configuration (--enablee-auto-validation)"
   3026 
   3027     test "$CRYPTO" = "pkcs11" || (
   3028 	echo "    Using PKCS#11 for Public-Key Cryptography (--with-native-pkcs11)"
   3029     )
   3030 
   3031     test "yes" = "$enable_backtrace" || \
   3032 	echo "    Print backtrace on crash (--enable-backtrace)"
   3033     test "yes" = "$want_querytrace" || \
   3034 	echo "    Very verbose query trace logging (--enable-querytrace)"
   3035 
   3036     test "yes" = "$use_libtool" || echo "    Use GNU libtool (--with-libtool)"
   3037     test "no" = "$with_cmocka" && echo "    CMocka Unit Testing Framework (--with-cmocka)"
   3038 
   3039     test "X$PYTHON" = "X" && echo "    Python tools (--with-python)"
   3040     test "X$LIBXML2_LIBS" = "X" && echo "    XML statistics (--with-libxml2)"
   3041     test "X$JSON_C_LIBS" = "X" && echo "    JSON statistics (--with-json-c)"
   3042     test "X$ZLIB_LIBS" = "X" && echo "    HTTP zlib compression (--with-zlib)"
   3043     test "X$NZD_TOOLS" = "X" && echo "    LMDB database to store configuration for 'addzone' zones (--with-lmdb)"
   3044     test "no" = "$with_libidn2" && echo "    IDN support (--with-libidn2)"
   3045 
   3046     echo "-------------------------------------------------------------------------------"
   3047     echo "Configured paths:"
   3048     echo "    prefix: $prefix"
   3049     echo "    sysconfdir: $sysconfdir"
   3050     echo "    localstatedir: $localstatedir"
   3051     echo "-------------------------------------------------------------------------------"
   3052     echo "Compiler: $CC"
   3053     $CC --version 2>&1 | sed 's/^/    /'
   3054 
   3055     if test "X$ac_unrecognized_opts" != "X"; then
   3056 	echo "Unrecognized options:"
   3057 	echo "    $ac_unrecognized_opts"
   3058     fi
   3059 
   3060     if test "yes" != "$enable_full_report"; then
   3061 	echo "-------------------------------------------------------------------------------"
   3062 	echo "For more detail, use --enable-full-report."
   3063     fi
   3064     echo "==============================================================================="
   3065 }
   3066 
   3067 if test "yes" != "$silent"; then
   3068 	report
   3069 fi
   3070 
   3071 # Tell Emacs to edit this file in shell mode.
   3072 # Local Variables:
   3073 # mode: sh
   3074 # End:
   3075