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