2016-01-30 11:03:10 -08:00
# Copyright (C) Internet Systems Consortium, Inc. ("ISC")
2014-03-10 23:46:12 +00:00
#
2000-03-23 19:43:14 +00:00
# SPDX-License-Identifier: MPL-2.0
2021-06-03 08:37:05 +02:00
#
2000-03-23 19:43:14 +00:00
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, you can obtain one at https://mozilla.org/MPL/2.0/.
2018-02-23 09:53:12 +01:00
#
2000-03-23 19:43:14 +00:00
# See the COPYRIGHT file distributed with this work for additional
2000-12-23 18:27:43 +00:00
# information regarding copyright ownership.
2014-03-10 12:14:35 -07:00
2018-08-07 16:46:53 +02:00
#
# Defining the version in m4 requires a bit of dancing around,
# so the strings are properly concatenated, as you can't use
2021-04-16 12:25:35 +02:00
# a shell variable in AC_INIT
2018-08-07 16:46:53 +02:00
#
m4_define([bind_VERSION_MAJOR], 9)dnl
2022-04-11 10:08:24 +02:00
m4_define([bind_VERSION_MINOR], 19)dnl
2022-10-10 23:17:49 +02:00
m4_define([bind_VERSION_PATCH], 7)dnl
2022-04-12 11:15:13 +02:00
m4_define([bind_VERSION_EXTRA], -dev)dnl
2018-08-07 16:46:53 +02:00
m4_define([bind_DESCRIPTION], [(Development Release)])dnl
2020-06-09 14:47:06 +02:00
m4_define([bind_SRCID], [m4_esyscmd_s([git rev-parse --short HEAD | cut -b1-7])])dnl
2018-08-07 16:46:53 +02:00
m4_define([bind_PKG_VERSION], [[bind_VERSION_MAJOR.bind_VERSION_MINOR.bind_VERSION_PATCH]bind_VERSION_EXTRA])dnl
#
# Autoconf initialization
#
2022-02-02 10:50:45 +01:00
AC_INIT([BIND], bind_PKG_VERSION, [https://gitlab.isc.org/isc-projects/bind9/-/issues/new?issuable_template=Bug], [], [https://www.isc.org/downloads/])
2021-04-16 12:25:35 +02:00
AC_PREREQ([2.69])
2018-08-07 16:46:53 +02:00
AC_DEFINE([PACKAGE_VERSION_MAJOR], ["][bind_VERSION_MAJOR]["], [BIND 9 Major part of the version])
AC_DEFINE([PACKAGE_VERSION_MINOR], ["][bind_VERSION_MINOR]["], [BIND 9 Minor part of the version])
AC_DEFINE([PACKAGE_VERSION_PATCH], ["][bind_VERSION_PATCH]["], [BIND 9 Patch part of the version])
AC_DEFINE([PACKAGE_VERSION_EXTRA], ["][bind_VERSION_EXTRA]["], [BIND 9 Extra part of the version])
AC_DEFINE([PACKAGE_DESCRIPTION], [m4_ifnblank(bind_DESCRIPTION, [" ]bind_DESCRIPTION["], [])], [An extra string to print after PACKAGE_STRING])
AC_DEFINE([PACKAGE_SRCID], ["][bind_SRCID]["], [A short hash from git])
bind_CONFIGARGS="${ac_configure_args:-default}"
AC_DEFINE_UNQUOTED([PACKAGE_CONFIGARGS], ["$bind_CONFIGARGS"], [Either 'defaults' or used ./configure options])
AC_DEFINE([PACKAGE_BUILDER], ["make"], [make or Visual Studio])
2021-04-16 12:25:35 +02:00
#
# Get the Canonical System Type
#
AC_CANONICAL_BUILD
AC_CANONICAL_HOST
AC_CANONICAL_TARGET
2018-08-07 16:46:53 +02:00
AC_CONFIG_SRCDIR([bin/named/main.c])
2022-02-14 09:17:41 +01:00
AM_INIT_AUTOMAKE([1.14 tar-pax foreign subdir-objects dist-xz no-dist-gzip -Wall -Werror])
2018-08-07 16:46:53 +02:00
AM_SILENT_RULES([yes])
2019-03-31 12:49:47 +02:00
AM_EXTRA_RECURSIVE_TARGETS([test unit doc])
2018-08-07 16:46:53 +02:00
AC_CONFIG_HEADERS([config.h])
AC_CONFIG_MACRO_DIR([m4])
1998-12-11 20:10:26 +00:00
2019-06-19 14:26:49 +02:00
#
2020-06-22 14:26:07 +02:00
# Enable maintainer mode by default only when building from git repository
2020-12-18 16:37:26 +11:00
# and not cross compling
2019-06-19 14:26:49 +02:00
#
2020-12-18 16:37:26 +11:00
AS_IF([test "$cross_compiling" = no],
[AM_MAINTAINER_MODE(m4_ifset([bind_SRCID],[enable],[disable]))],
[AM_MAINTAINER_MODE([disable])])
2019-06-19 14:26:49 +02:00
2019-03-07 13:32:30 +01:00
#
# Enable system extensions to C and POSIX
#
2018-08-28 21:27:48 +02:00
AC_USE_SYSTEM_EXTENSIONS
2018-08-07 16:46:53 +02:00
#
# Compiler compatibility flags
#
2021-04-16 12:25:35 +02:00
m4_version_prereq([2.70],
[AC_PROG_CC],
[AC_PROG_CC_C99])
2018-08-07 16:46:53 +02:00
AC_PROG_CPP_WERROR
2020-12-18 15:48:00 +11:00
#
# Find build compiler when cross compiling
#
2022-01-25 10:47:34 +01:00
AX_PROG_CC_FOR_BUILD
2020-12-18 15:48:00 +11:00
2018-08-07 16:46:53 +02:00
#
# Find the machine's endian flavor.
#
AC_C_BIGENDIAN
2018-08-28 21:27:48 +02:00
2019-03-07 13:32:30 +01:00
#
# Enable large file support
#
AC_SYS_LARGEFILE
AC_FUNC_FSEEKO
2018-08-28 21:27:48 +02:00
# Enable RFC 3542 APIs on macOS
AC_DEFINE([__APPLE_USE_RFC_3542], [1], [Select RFC3542 IPv6 API on macOS])
1998-12-11 20:10:26 +00:00
1999-04-29 05:19:29 +00:00
AC_PROG_MAKE_SET
2009-06-10 02:23:42 +00:00
2018-08-07 16:46:53 +02:00
# Checks for programs.
m4_ifdef([AM_PROG_AR], [AM_PROG_AR]) # call AM_PROG_AR only if available
1999-04-29 05:19:29 +00:00
AC_PROG_INSTALL
2005-06-20 01:05:33 +00:00
AC_PROG_LN_S
2018-11-06 17:09:08 +07:00
AX_POSIX_SHELL
2019-03-31 12:49:47 +02:00
AC_PROG_MKDIR_P
1999-04-29 05:19:29 +00:00
2018-08-07 16:46:53 +02:00
# Initialize libtool
2020-06-16 10:38:46 +02:00
LT_INIT([disable-static dlopen pic-only])
2020-08-12 15:19:23 +02:00
AS_IF([test "$enable_static" != "no" && test "$enable_developer" != "yes"],
2020-06-16 10:38:46 +02:00
[AC_MSG_ERROR([Static linking is not supported as it disables dlopen() and certain security features (e.g. RELRO, ASLR)])])
2018-08-07 16:46:53 +02:00
2018-06-04 08:54:58 +02:00
#
2022-04-27 16:41:27 +02:00
# Set the default CFLAGS, CPPFLAGS, and LDFLAGS
2018-06-04 08:54:58 +02:00
#
2020-10-31 20:42:18 +01:00
STD_CFLAGS="-Wall -Wextra -Wwrite-strings -Wpointer-arith -Wno-missing-field-initializers -Wformat -Wshadow"
2018-06-04 08:54:58 +02:00
2018-08-07 16:46:53 +02:00
# These should be always errors
Avoid using C99 variable length arrays
From an attacker's point of view, a VLA declaration is essentially a
primitive for performing arbitrary arithmetic on the stack pointer. If
the attacker can control the size of a VLA they have a very powerful
tool for causing memory corruption.
To mitigate this kind of attack, and the more general class of stack
clash vulnerabilities, C compilers insert extra code when allocating a
VLA to probe the growing stack one page at a time. If these probes hit
the stack guard page, the program will crash.
From the point of view of a C programmer, there are a few things to
consider about VLAs:
* If it is important to handle allocation failures in a controlled
manner, don't use VLAs. You can use VLAs if it is OK for
unreasonable inputs to cause an uncontrolled crash.
* If the VLA is known to be smaller than some known fixed size,
use a fixed size array and a run-time check to ensure it is large
enough. This will be more efficient than the compiler's stack
probes that need to cope with arbitrary-size VLAs.
* If the VLA might be large, allocate it on the heap. The heap
allocator can allocate multiple pages in one shot, whereas the
stack clash probes work one page at a time.
Most of the existing uses of VLAs in BIND are in test code where they
are benign, but there was one instance in `named`, in the GSS-TSIG
verification code, which has now been removed.
This commit adjusts the style guide and the C compiler flags to allow
VLAs in test code but not elsewhere.
2022-03-18 14:50:36 +00:00
STD_CFLAGS="$STD_CFLAGS -Werror=implicit-function-declaration -Werror=missing-prototypes -Werror=format-security -Werror=parentheses -Werror=implicit -Werror=strict-prototypes -Werror=vla"
Disable stringop-overread with gcc-11+ Address Sanitizer
When Address Sanitizer is enabled in gcc-11+, number of false positives
might appear like this:
netmgr/udp.c: In function 'isc__nm_udp_send':
netmgr/udp.c:729:13: warning: 'uv_udp_send' reading 16 bytes from a region of size 8 [-Wstringop-overread]
729 | r = uv_udp_send(&uvreq->uv_req.udp_send, &sock->uv_handle.udp,
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
730 | &uvreq->uvbuf, 1, sa, udp_send_cb);
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
netmgr/udp.c:729:13: note: referencing argument 3 of type 'const uv_buf_t[0]'
In file included from ./include/isc/uv.h:17,
from ./include/isc/barrier.h:31,
from netmgr/udp.c:17:
/usr/include/uv.h:711:15: note: in a call to function 'uv_udp_send'
711 | UV_EXTERN int uv_udp_send(uv_udp_send_t* req,
| ^~~~~~~~~~~
Disable the warning globally in the autoconf, instead of just locally in
a single CI job, as it might affect people outside our GitLab CI.
2022-09-08 07:33:31 +02:00
# Disable false positives generated by GCC 11+ and ASAN
AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM([[]],
[[#if __GNUC__ >= 11 && defined(__SANITIZE_ADDRESS__)
#error Address Sanitizer enabled
#endif
]])],
[],
[STD_CFLAGS="$STD_CFLAGS -Wno-stringop-overread"])
2022-04-27 16:41:27 +02:00
STD_LDFLAGS=""
Avoid using C99 variable length arrays
From an attacker's point of view, a VLA declaration is essentially a
primitive for performing arbitrary arithmetic on the stack pointer. If
the attacker can control the size of a VLA they have a very powerful
tool for causing memory corruption.
To mitigate this kind of attack, and the more general class of stack
clash vulnerabilities, C compilers insert extra code when allocating a
VLA to probe the growing stack one page at a time. If these probes hit
the stack guard page, the program will crash.
From the point of view of a C programmer, there are a few things to
consider about VLAs:
* If it is important to handle allocation failures in a controlled
manner, don't use VLAs. You can use VLAs if it is OK for
unreasonable inputs to cause an uncontrolled crash.
* If the VLA is known to be smaller than some known fixed size,
use a fixed size array and a run-time check to ensure it is large
enough. This will be more efficient than the compiler's stack
probes that need to cope with arbitrary-size VLAs.
* If the VLA might be large, allocate it on the heap. The heap
allocator can allocate multiple pages in one shot, whereas the
stack clash probes work one page at a time.
Most of the existing uses of VLAs in BIND are in test code where they
are benign, but there was one instance in `named`, in the GSS-TSIG
verification code, which has now been removed.
This commit adjusts the style guide and the C compiler flags to allow
VLAs in test code but not elsewhere.
2022-03-18 14:50:36 +00:00
# ... except in test code
TEST_CFLAGS="-Wno-vla"
2018-06-04 08:54:58 +02:00
2018-08-07 16:46:53 +02:00
# Fortify the sources by default
STD_CPPFLAGS="-D_FORTIFY_SOURCE=2"
2017-11-08 23:28:10 +11:00
2018-08-07 16:46:53 +02:00
#
# Additional compiler settings.
#
AX_CHECK_COMPILE_FLAG([-fno-strict-aliasing],
[STD_CFLAGS="$STD_CFLAGS -fno-strict-aliasing"])
2020-04-22 13:02:18 +10:00
# Clang only issues a warning so use -Werror to force a error.
AX_CHECK_COMPILE_FLAG([-Werror -fno-delete-null-pointer-checks],
2018-08-07 16:46:53 +02:00
[STD_CFLAGS="$STD_CFLAGS -fno-delete-null-pointer-checks"])
AX_CHECK_COMPILE_FLAG([-fdiagnostics-show-option],
[STD_CFLAGS="$STD_CFLAGS -fdiagnostics-show-option"])
2015-01-20 13:29:18 -08:00
2022-04-27 16:41:27 +02:00
AX_CHECK_LINK_FLAG([-Wl,--export-dynamic],
[STD_LDFLAGS="$STD_LDFLAGS -Wl,--export-dynamic"])
2020-09-28 09:09:21 +02:00
host_macos=no
AS_CASE([$host],[*-darwin*],[host_macos=yes])
AM_CONDITIONAL([HOST_MACOS], [test "$host_macos" = "yes"])
2020-04-23 14:29:07 -07:00
#
# Change defaults for developers if not explicity set.
# Needs to be before the option is tested.
#
2020-07-01 10:29:36 +02:00
# [pairwise: --enable-developer, --disable-developer]
2019-06-19 11:16:47 +02:00
AC_ARG_ENABLE([developer],
[AS_HELP_STRING([--enable-developer],
[enable developer build settings])])
2014-07-08 15:51:40 +10:00
2019-06-19 11:16:47 +02:00
AS_IF([test "$enable_developer" = "yes"],
2020-07-30 14:07:49 +02:00
[DEVELOPER_MODE=yes
2022-01-17 12:39:56 +01:00
STD_CPPFLAGS="$STD_CPPFLAGS -DISC_MEM_DEFAULTFILL=1 -DISC_MEM_TRACKLINES=1 -DISC_LIST_CHECKINIT=1 -DISC_STATS_CHECKUNDERFLOW=1"
2019-06-19 11:16:47 +02:00
test "${enable_fixed_rrset+set}" = set || enable_fixed_rrset=yes
test "${enable_querytrace+set}" = set || enable_querytrace=yes
test "${with_cmocka+set}" = set || with_cmocka=yes
test "${with_zlib+set}" = set || with_zlib=yes
2018-08-07 16:46:53 +02:00
test "${enable_warn_error+set}" = set || enable_warn_error=yes
2019-06-19 11:16:47 +02:00
])
2018-08-07 16:46:53 +02:00
2020-07-30 14:07:49 +02:00
AC_SUBST([DEVELOPER_MODE])
2018-08-07 16:46:53 +02:00
AC_SUBST([STD_CFLAGS])
AC_SUBST([STD_CPPFLAGS])
2022-04-27 16:41:27 +02:00
AC_SUBST([STD_LDFLAGS])
Avoid using C99 variable length arrays
From an attacker's point of view, a VLA declaration is essentially a
primitive for performing arbitrary arithmetic on the stack pointer. If
the attacker can control the size of a VLA they have a very powerful
tool for causing memory corruption.
To mitigate this kind of attack, and the more general class of stack
clash vulnerabilities, C compilers insert extra code when allocating a
VLA to probe the growing stack one page at a time. If these probes hit
the stack guard page, the program will crash.
From the point of view of a C programmer, there are a few things to
consider about VLAs:
* If it is important to handle allocation failures in a controlled
manner, don't use VLAs. You can use VLAs if it is OK for
unreasonable inputs to cause an uncontrolled crash.
* If the VLA is known to be smaller than some known fixed size,
use a fixed size array and a run-time check to ensure it is large
enough. This will be more efficient than the compiler's stack
probes that need to cope with arbitrary-size VLAs.
* If the VLA might be large, allocate it on the heap. The heap
allocator can allocate multiple pages in one shot, whereas the
stack clash probes work one page at a time.
Most of the existing uses of VLAs in BIND are in test code where they
are benign, but there was one instance in `named`, in the GSS-TSIG
verification code, which has now been removed.
This commit adjusts the style guide and the C compiler flags to allow
VLAs in test code but not elsewhere.
2022-03-18 14:50:36 +00:00
AC_SUBST([TEST_CFLAGS])
2018-08-07 16:46:53 +02:00
2020-07-01 10:29:36 +02:00
# [pairwise: --enable-warn-error, --disable-warn-error]
2020-04-23 14:29:07 -07:00
AC_ARG_ENABLE([warn_error],
[AS_HELP_STRING([--enable-warn-error],
[turn on -Werror when compiling])],
[],[enable_warn_error=no])
AS_IF([test "$enable_warn_error" = "yes"],
[STD_CFLAGS="$STD_CFLAGS -Werror"])
2018-08-07 16:46:53 +02:00
#
# Use pkg-config
#
PKG_PROG_PKG_CONFIG
AS_IF([test -z "$PKG_CONFIG"],
[AC_MSG_ERROR([The pkg-config script could not be found or is too old.])])
2020-07-01 10:29:36 +02:00
# Fuzzing is not included in pairwise testing as fuzzing tools are
# not present in the relevant Docker image.
#
# [pairwise: skip]
2018-07-03 15:45:11 +02:00
AC_ARG_ENABLE([fuzzing],
2020-08-12 21:06:26 +02:00
[AS_HELP_STRING([--enable-fuzzing=<afl|libfuzzer|ossfuzz>],
2018-07-03 15:45:11 +02:00
[Enable fuzzing using American Fuzzy Lop or libFuzzer (default=no)])],
[],
[enable_fuzzing=no])
AC_MSG_CHECKING([whether to enable fuzzing mode])
AS_CASE([$enable_fuzzing],
[no],[AC_MSG_RESULT([no])],
[afl],[
AC_MSG_RESULT([using AFL])
AC_DEFINE([ENABLE_AFL], [1],
[Define to enable American Fuzzy Lop test harness])
2020-07-31 15:20:56 +02:00
STD_CFLAGS="$STD_CFLAGS -DFUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION=1"
FUZZ_LOG_COMPILER="afl.sh"],
2018-07-03 15:45:11 +02:00
[libfuzzer],[
AC_MSG_RESULT([using libFuzzer])
2020-07-31 15:20:56 +02:00
STD_CFLAGS="$STD_CFLAGS -DFUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION=1 -fsanitize=fuzzer-no-link,address,undefined"
LDFLAGS="$LDFLAGS -fsanitize=address,undefined"
FUZZ_LDFLAGS="-fsanitize=fuzzer,address,undefined"
FUZZ_LOG_COMPILER="libfuzzer.sh"],
2020-08-12 21:06:26 +02:00
[ossfuzz],[
AC_MSG_RESULT([using OSS-Fuzz])
FUZZ_LDFLAGS="$LIB_FUZZING_ENGINE"],
2018-07-03 15:45:11 +02:00
[*],[AC_MSG_ERROR([You need to explicitly select the fuzzer])])
2020-07-31 15:20:56 +02:00
AM_CONDITIONAL([HAVE_FUZZ_LOG_COMPILER], [test -n "$FUZZ_LOG_COMPILER"])
AC_SUBST([FUZZ_LOG_COMPILER])
AC_SUBST([FUZZ_LDFLAGS])
2018-07-03 15:45:11 +02:00
AS_IF([test "$enable_fuzzing" = "afl"],
[AC_MSG_CHECKING("for AFL enabled compiler")
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],
[#ifndef __AFL_COMPILER
#error AFL compiler required
#endif
])],
[AC_MSG_RESULT([yes])],
[AC_MSG_ERROR([set CC=afl-<gcc|clang> when --enable-fuzzing=afl is used])])
])
2016-05-05 11:46:11 +02:00
2000-06-13 17:34:28 +00:00
#
# Perl is optional; it is used only by some of the system test scripts.
#
2018-08-07 16:46:53 +02:00
AC_PATH_PROGS([PERL], [perl5 perl])
AC_SUBST([PERL])
AM_CONDITIONAL([HAVE_PERL], [test -n "$PERL"])
2000-06-13 17:34:28 +00:00
2018-08-07 16:46:53 +02:00
AX_PERL_MODULE([Digest::HMAC])
AM_CONDITIONAL([HAVE_PERLMOD_DIGEST_HMAC],
[test "$HAVE_PERLMOD_DIGEST__HMAC" = "yes"])
2018-12-18 15:05:52 +01:00
2018-08-07 16:46:53 +02:00
AX_PERL_MODULE([File::Fetch])
AM_CONDITIONAL([HAVE_PERLMOD_FILE_FETCH],
[test "$HAVE_PERLMOD_FILE__FETCH" = "yes"])
2019-12-03 08:38:50 +11:00
2018-08-07 16:46:53 +02:00
AX_PERL_MODULE([Net::DNS])
AM_CONDITIONAL([HAVE_PERLMOD_NET_DNS],
[test "$HAVE_PERLMOD_NET__DNS" = "yes"])
2018-11-27 11:43:46 +01:00
2018-08-07 16:46:53 +02:00
AX_PERL_MODULE([Net::DNS::Nameserver])
AM_CONDITIONAL([HAVE_PERLMOD_NET_DNS_NAMESERVER],
[test "$HAVE_PERLMOD_NET__DNS__NAMESERVER" = "yes"])
2018-12-18 15:05:52 +01:00
2018-08-07 16:46:53 +02:00
AX_PERL_MODULE([Time::HiRes])
AM_CONDITIONAL([HAVE_PERLMOD_TIME_HIRES],
[test "$HAVE_PERLMOD_TIME__HIRES" = "yes"])
2018-11-27 11:43:46 +01:00
2018-08-07 16:46:53 +02:00
#
# Python is optional, it is used only by some of the system test scripts.
#
2022-04-22 11:25:27 +02:00
AM_PATH_PYTHON([3.6], [], [:])
2018-08-07 16:46:53 +02:00
AM_CONDITIONAL([HAVE_PYTHON], [test "$PYTHON" != ":"])
2018-11-27 11:43:46 +01:00
2021-05-13 17:24:57 +02:00
AC_PATH_PROGS([PYTEST], [pytest-3 py.test-3 pytest py.test pytest-pypy], [])
2020-03-27 13:23:24 +01:00
AS_IF([test -z "$PYTEST"],
[AC_MSG_WARN([pytest not found, some system tests will be skipped])])
AC_SUBST([PYTEST])
2020-04-29 15:55:38 -03:00
AM_CONDITIONAL([HAVE_PYTEST], [test -n "$PYTEST"])
2020-03-27 13:23:24 +01:00
2018-08-07 16:46:53 +02:00
AX_PYTHON_MODULE([dns])
AM_CONDITIONAL([HAVE_PYMOD_DNS], [test "$HAVE_PYMOD_DNS" = "yes"])
2000-02-10 01:14:06 +00:00
2000-02-11 18:35:11 +00:00
#
2018-08-07 16:46:53 +02:00
# xsltproc is optional, it is used only by system test scripts.
2000-02-11 18:35:11 +00:00
#
2018-08-07 16:46:53 +02:00
AC_PATH_PROG([XSLTPROC], [xsltproc])
2003-01-21 04:11:26 +00:00
2019-06-19 11:21:36 +02:00
#
# Using Solaris linker with gcc on Solaris breaks Thread Local Storage
#
AS_CASE([$host],
[*-solaris*],[
AS_IF([test "$GCC" = "yes"],
[LDFLAGS="$LDFLAGS -zrelax=transtls"
AC_MSG_WARN([When using GNU C Compiler on Solaris, -zrelax=transtls linker flag is used to fix bug in Thread Local Storage])
])
])
2018-08-07 16:46:53 +02:00
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], [], [],
[$ac_includes_default
#ifdef HAVE_SYS_PARAM_H
# include <sys/param.h>
#endif
#ifdef HAVE_SYS_SOCKET_H
# include <sys/socket.h>
#endif
])
2001-01-31 19:22:46 +00:00
2018-05-29 14:10:32 +02:00
#
# Check for thread local storage
#
2018-08-07 16:46:53 +02:00
AC_CHECK_HEADERS([threads.h])
AX_TLS([AS_IF([test "$ac_cv_tls" != "thread_local"],
[AC_DEFINE_UNQUOTED([thread_local], [$ac_cv_tls], [Define if the compiler uses a different keyword than thread_local for TLS variables])])],
[AC_MSG_ERROR([Thread Local Storage support required, update your toolchain to build BIND 9])])
2018-05-29 14:10:32 +02:00
2001-01-31 19:22:46 +00:00
AC_C_CONST
AC_C_INLINE
2008-01-04 03:28:39 +00:00
AC_C_VOLATILE
2001-05-03 19:54:44 +00:00
2018-10-23 09:27:02 +02:00
#
# Check for yield support on ARM processors
#
AS_CASE([$host],
2019-05-06 18:06:59 +10:00
[arm*],
[AC_MSG_CHECKING([for yield instruction support])
AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM([[]],
[[__asm__ __volatile__ ("yield")]])],
[AC_MSG_RESULT([yes])
AC_DEFINE([HAVE_ARM_YIELD], [1],
[define if the ARM yield instruction is available])],
[AC_MSG_RESULT([no])])])
2018-10-23 09:27:02 +02:00
2019-08-08 08:33:10 +01:00
#
# Check for pause support on SPARC processors
#
AS_CASE([$host],
[sparc*],
[AC_MSG_CHECKING([for pause instruction support])
AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM([[]],
[[__asm__ __volatile__ ("pause")]])],
[AC_MSG_RESULT([yes])
AC_DEFINE([HAVE_SPARC_PAUSE], [1],
[define if the SPARC pause instruction is available])],
[AC_MSG_RESULT([no])])])
2018-09-05 13:33:59 +02:00
AC_CHECK_FUNCS([sysctlbyname])
2009-07-14 22:39:30 +00:00
#
# Older versions of HP/UX don't define seteuid() and setegid()
#
2018-08-07 16:46:53 +02:00
AC_CHECK_FUNCS([seteuid setresuid])
AC_CHECK_FUNCS([setegid setresgid])
2009-07-14 22:39:30 +00:00
2001-01-31 19:22:46 +00:00
AC_TYPE_SIZE_T
2018-07-24 14:42:20 +02:00
AC_TYPE_SSIZE_T
AC_TYPE_UINTPTR_T
2016-01-30 11:03:10 -08:00
#
# check for uname library routine
#
2018-09-05 12:58:02 +02:00
AC_MSG_CHECKING([for uname])
AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM(
[[#include <sys/utsname.h>
#include <stdio.h>
]],
[[
struct utsname uts;
uname(&uts);
printf("running on %s %s %s for %s\n",
uts.sysname, uts.release, uts.version, uts.machine);
]])],
[AC_MSG_RESULT(yes)
AC_DEFINE([HAVE_UNAME], [1], [define if uname is available])
],
[AC_MSG_RESULT(no)
AC_MSG_WARN([uname is not correctly supported])
])
2016-01-30 11:03:10 -08:00
2009-09-29 15:06:07 +00:00
#
# check for GCC noreturn attribute
#
2018-08-07 16:46:53 +02:00
AX_GCC_FUNC_ATTRIBUTE([noreturn])
2009-09-29 15:06:07 +00:00
2021-04-01 17:03:59 -03:00
#
# check for GCC malloc attribute
#
AX_GCC_FUNC_ATTRIBUTE([malloc])
AC_MSG_CHECKING([for extended malloc attributes])
AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM(
[[
#include <stddef.h>
#include <stdlib.h>
__attribute__ ((malloc, malloc (free, 1))
void * xmalloc(size_t sz) { return malloc(sz); }
]],
[[
void *p = xmalloc(8);
free(p);
]])],
[AC_MSG_RESULT(yes)
AC_DEFINE([HAVE_MALLOC_EXT_ATTR], [1], [define if extended attributes for malloc are available])
],
[AC_MSG_RESULT(no)])
#
# check for GCC returns_nonnull attribute
#
AX_GCC_FUNC_ATTRIBUTE([returns_nonnull])
2008-06-23 19:41:20 +00:00
#
# check if we have kqueue
#
2020-07-01 10:29:36 +02:00
# [pairwise: --enable-kqueue, --disable-kqueue]
2018-09-05 12:05:32 +02:00
AC_ARG_ENABLE([kqueue],
[AS_HELP_STRING([--enable-kqueue],
[use BSD kqueue when available [default=yes]])],
[], enable_kqueue="yes")
AS_IF([test "$enable_kqueue" = "yes"],
[AC_CHECK_FUNCS([kqueue])])
2008-06-23 19:41:20 +00:00
#
2008-08-22 13:17:56 +00:00
# check if we have epoll. Linux kernel 2.4 has epoll_create() which fails,
# so we need to try running the code, not just test its existence.
2008-06-23 19:41:20 +00:00
#
2020-07-01 10:29:36 +02:00
# [pairwise: --enable-epoll, --disable-epoll]
2018-09-05 12:14:27 +02:00
AC_ARG_ENABLE([epoll],
[AS_HELP_STRING([--enable-epoll],
[use Linux epoll when available [default=auto]])],
[], [enable_epoll="yes"])
AS_IF([test "$enable_epoll" = "yes"],
[AC_CHECK_FUNCS([epoll_create1])])
2008-06-23 19:41:20 +00:00
#
# check if we support /dev/poll
#
2020-07-01 10:29:36 +02:00
# [pairwise: --enable-devpoll, --disable-devpoll]
2018-09-05 12:26:40 +02:00
AC_ARG_ENABLE([devpoll],
[AS_HELP_STRING([--enable-devpoll],
[use /dev/poll when available [default=yes]])],
[], [enable_devpoll="yes"])
AS_IF([test "$enable_devpoll" = "yes"],
[AC_CHECK_HEADERS([sys/devpoll.h devpoll.h])])
2001-10-03 05:08:32 +00:00
2000-08-02 19:35:35 +00:00
#
2014-01-14 15:40:56 -08:00
# GeoIP support?
2000-08-02 19:35:35 +00:00
#
2019-06-27 21:19:30 -07:00
# Should be on by default if libmaxminddb exists.
#
2020-07-01 10:29:36 +02:00
# [pairwise: --enable-geoip --with-maxminddb=auto, --enable-geoip --with-maxminddb=yes, --disable-geoip]
2019-06-27 21:19:30 -07:00
AC_ARG_ENABLE([geoip],
[AS_HELP_STRING([--disable-geoip],
[support GeoIP2 geolocation ACLs if available [default=yes]])],
[], [enable_geoip="yes"])
2020-07-01 10:29:36 +02:00
# [pairwise: skip]
2019-06-27 21:19:30 -07:00
AC_ARG_WITH([maxminddb],
[AS_HELP_STRING([--with-maxminddb=PATH],
2019-06-27 21:08:20 -07:00
[Build with MaxMind GeoIP2 support (auto|yes|no|path) [default=auto]])],
2018-08-07 16:46:53 +02:00
[], [with_maxminddb="auto"])
2019-06-11 15:59:31 -07:00
2019-06-27 21:19:30 -07:00
AS_IF([test "$enable_geoip" = "yes"],
[AS_CASE([$with_maxminddb],
[no],[AC_MSG_ERROR([Use '--disable-geoip' to disable the GeoIP])],
[auto],[PKG_CHECK_MODULES([MAXMINDDB], [libmaxminddb],
[AC_DEFINE([HAVE_GEOIP2], [1], [Build with GeoIP2 support])
PKG_CHECK_VAR([MAXMINDDB_PREFIX], [libmaxminddb], [prefix], [], [AC_MSG_ERROR([libmaxminddb prefix not found in pkg-config; set MAXMINDDB_PREFIX in the environment])])
],[:])],
[yes],[PKG_CHECK_MODULES([MAXMINDDB], [libmaxminddb],
[AC_DEFINE([HAVE_GEOIP2], [1], [Build with GeoIP2 support])
PKG_CHECK_VAR([MAXMINDDB_PREFIX], [libmaxminddb], [prefix], [], [AC_MSG_ERROR([libmaxminddb prefix not found in pkg-config; set MAXMINDDB_PREFIX in the environment])])
])],
[ # default
AX_SAVE_FLAGS([maxminddb])
MAXMINDDB_CFLAGS="-I$with_maxminddb/include"
2019-11-05 12:54:35 +11:00
MAXMINDDB_LIBS="-L$with_maxminddb/lib"
2019-06-27 21:19:30 -07:00
CFLAGS="$CFLAGS $MAXMINDDB_CFLAGS"
2018-08-07 16:46:53 +02:00
LIBS="$LIBS $MAXMINDDB_LIBS"
2019-06-27 21:19:30 -07:00
AC_SEARCH_LIBS([MMDB_open], [maxminddb],
[AC_DEFINE([HAVE_GEOIP2], [1], [Build with GeoIP2 support])
2021-01-06 18:05:58 +11:00
MAXMINDDB_LIBS="$MAXMINDDB_LIBS $ac_cv_search_MMDB_open"
2019-06-27 21:19:30 -07:00
AC_MSG_NOTICE([GeoIP2 default database path set to $with_maxminddb/share/GeoIP])
2022-05-17 19:39:22 +10:00
AS_VAR_COPY([MAXMINDDB_PREFIX], [with_maxminddb])
2019-06-27 21:19:30 -07:00
],
[AC_MSG_ERROR([GeoIP2 requested, but libmaxminddb not found])])
2019-07-09 13:35:39 +02:00
AX_RESTORE_FLAGS([maxminddb])
2019-06-27 21:19:30 -07:00
])
AC_ARG_VAR([MAXMINDDB_PREFIX], [value of prefix for MAXMINDDB, overriding pkg-config])
])
2018-08-07 16:46:53 +02:00
AM_CONDITIONAL([HAVE_GEOIP2], [test -n "$MAXMINDDB_LIBS"])
2019-06-11 15:59:31 -07:00
AC_SUBST([MAXMINDDB_CFLAGS])
AC_SUBST([MAXMINDDB_LIBS])
2008-03-31 14:42:51 +00:00
2018-08-15 11:12:03 +02:00
AX_PTHREAD
2008-03-31 14:42:51 +00:00
2018-08-15 11:12:03 +02:00
LIBS="$PTHREAD_LIBS $LIBS"
CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
CC="$PTHREAD_CC"
2013-02-27 17:19:39 -08:00
2019-05-13 20:58:20 +07:00
AC_CHECK_FUNCS([pthread_attr_getstacksize pthread_attr_setstacksize])
2018-06-06 11:39:50 +02:00
2020-07-01 10:29:36 +02:00
# [pairwise: --with-locktype=adaptive, --with-locktype=standard]
2018-08-15 11:12:03 +02:00
AC_ARG_WITH([locktype],
2018-06-06 11:39:50 +02:00
AS_HELP_STRING([--with-locktype=ARG],
[Specify mutex lock type
2018-08-15 11:12:03 +02:00
(adaptive or standard)]),
[], [with_locktype="adaptive"])
AS_CASE([$with_locktype],
[adaptive],[
AC_MSG_CHECKING([for PTHREAD_MUTEX_ADAPTIVE_NP])
AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM(
[[
#ifndef _GNU_SOURCE
#define _GNU_SOURCE
#endif
#include <pthread.h>
]],
[[
return (PTHREAD_MUTEX_ADAPTIVE_NP);
]]
)],
[AC_MSG_RESULT([using adaptive lock type])
AC_DEFINE([HAVE_PTHREAD_MUTEX_ADAPTIVE_NP], 1,
[Support for PTHREAD_MUTEX_ADAPTIVE_NP]) ],
[AC_MSG_RESULT([using standard lock type])]
)],
[standard],[AC_MSG_RESULT([using standard lock type])],
[AC_MSG_ERROR([You must specify "adaptive" or "standard" for --with-locktype.])]
)
AC_CHECK_HEADERS([sched.h])
AC_SEARCH_LIBS([sched_yield],[rt])
AC_CHECK_FUNCS([sched_yield pthread_yield pthread_yield_np])
2018-06-06 11:39:50 +02:00
# Look for functions relating to thread naming
2018-08-15 11:12:03 +02:00
AC_CHECK_FUNCS([pthread_setname_np pthread_set_name_np])
2018-06-06 11:39:50 +02:00
AC_CHECK_HEADERS([pthread_np.h], [], [], [#include <pthread.h>])
2019-11-05 13:55:54 -08:00
# libuv
2018-08-07 16:46:53 +02:00
AC_MSG_CHECKING([for libuv])
2022-09-27 14:10:40 +02:00
PKG_CHECK_MODULES([LIBUV], [libuv >= 1.34.0], [],
[AC_MSG_ERROR([libuv >= 1.34.0 not found])])
2019-12-02 11:19:55 +01:00
2022-05-18 14:10:58 +02:00
AX_SAVE_FLAGS([libuv])
CFLAGS="$CFLAGS $LIBUV_CFLAGS"
LIBS="$LIBS $LIBUV_LIBS"
Fix the UDP recvmmsg support
Previously, the netmgr/udp.c tried to detect the recvmmsg detection in
libuv with #ifdef UV_UDP_<foo> preprocessor macros. However, because
the UV_UDP_<foo> are not preprocessor macros, but enum members, the
detection didn't work. Because the detection didn't work, the code
didn't have access to the information when we received the final chunk
of the recvmmsg and tried to free the uvbuf every time. Fortunately,
the isc__nm_free_uvbuf() had a kludge that detected attempt to free in
the middle of the receive buffer, so the code worked.
However, libuv 1.37.0 changed the way the recvmmsg was enabled from
implicit to explicit, and we checked for yet another enum member
presence with preprocessor macro, so in fact libuv recvmmsg support was
never enabled with libuv >= 1.37.0.
This commit changes to the preprocessor macros to autoconf checks for
declaration, so the detection now works again. On top of that, it's now
possible to cleanup the alloc_cb and free_uvbuf functions because now,
the information whether we can or cannot free the buffer is available to
us.
2022-01-11 12:14:23 +01:00
# libuv recvmmsg support
2022-01-13 22:43:20 +01:00
AC_CHECK_DECLS([UV_UDP_MMSG_FREE, UV_UDP_MMSG_CHUNK], [], [], [[#include <uv.h>]])
AC_MSG_CHECKING([whether struct msghdr uses padding for alignment])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <sys/socket.h>],
[const struct msghdr h = { .__pad1 = 0, .__pad2 = 0 };])],
[AC_MSG_RESULT([yes])
AC_DEFINE([HAVE_DECL_UV_UDP_RECVMMSG],
[0], [Disable recvmmsg support on systems with MUSL glibc])],
[AC_MSG_RESULT([no])
AC_CHECK_DECLS([UV_UDP_RECVMMSG], [], [], [[#include <uv.h>]])])
Fix the UDP recvmmsg support
Previously, the netmgr/udp.c tried to detect the recvmmsg detection in
libuv with #ifdef UV_UDP_<foo> preprocessor macros. However, because
the UV_UDP_<foo> are not preprocessor macros, but enum members, the
detection didn't work. Because the detection didn't work, the code
didn't have access to the information when we received the final chunk
of the recvmmsg and tried to free the uvbuf every time. Fortunately,
the isc__nm_free_uvbuf() had a kludge that detected attempt to free in
the middle of the receive buffer, so the code worked.
However, libuv 1.37.0 changed the way the recvmmsg was enabled from
implicit to explicit, and we checked for yet another enum member
presence with preprocessor macro, so in fact libuv recvmmsg support was
never enabled with libuv >= 1.37.0.
This commit changes to the preprocessor macros to autoconf checks for
declaration, so the detection now works again. On top of that, it's now
possible to cleanup the alloc_cb and free_uvbuf functions because now,
the information whether we can or cannot free the buffer is available to
us.
2022-01-11 12:14:23 +01:00
2022-04-25 14:09:44 +02:00
# libuv recverr support
AC_CHECK_DECLS([UV_UDP_LINUX_RECVERR], [], [], [[#include <uv.h>]])
2022-05-18 14:10:58 +02:00
AX_RESTORE_FLAGS([libuv])
2021-04-21 13:52:15 +02:00
# [pairwise: --enable-doh --with-libnghttp2=auto, --enable-doh --with-libnghttp2=yes, --disable-doh]
AC_ARG_ENABLE([doh],
[AS_HELP_STRING([--disable-doh], [enable DNS over HTTPS, requires libnghttp2 (default=yes)])],
[], [enable_doh=yes])
# [pairwise: skip]
AC_ARG_WITH([libnghttp2],
[AS_HELP_STRING([--with-libnghttp2],
[build with libnghttp2 library [yes|no|auto] (default is auto)])],
[], [with_libnghttp2="auto"])
AS_IF([test "$enable_doh" = "yes"],
[AS_CASE([$with_libnghttp2],
2022-01-20 15:40:37 +01:00
[no],[AC_MSG_ERROR([Use '--disable-doh' to disable DNS-over-HTTPS support])],
2021-04-21 13:52:15 +02:00
[auto|yes],[PKG_CHECK_MODULES([LIBNGHTTP2], [libnghttp2 >= 1.6.0],
2022-01-20 15:40:37 +01:00
[AC_DEFINE([HAVE_LIBNGHTTP2], [1], [Build with DNS-over-HTTPS support])],
2022-01-20 15:40:37 +01:00
[AC_MSG_ERROR(m4_normalize([DNS-over-HTTPS support requested, but libnghttp2 not found.
Either install libnghttp2 or use --disable-doh.]))])],
2021-04-21 13:52:15 +02:00
[AC_MSG_ERROR([Specifying libnghttp2 installation path is not supported, adjust PKG_CONFIG_PATH instead])])])
AM_CONDITIONAL([HAVE_LIBNGHTTP2], [test -n "$LIBNGHTTP2_LIBS"])
2020-10-31 20:42:18 +01:00
2019-03-07 13:32:30 +01:00
#
# flockfile is usually provided by pthreads
#
AC_CHECK_FUNCS([flockfile getc_unlocked])
2018-06-06 11:39:50 +02:00
#
# Look for sysconf to allow detection of the number of processors.
#
2018-09-05 13:29:28 +02:00
AC_CHECK_FUNCS([sysconf])
2006-12-04 01:54:53 +00:00
2019-01-25 12:29:52 +01:00
#
2020-02-27 13:21:31 +01:00
# Do we want to use pthread rwlock?
2019-01-25 12:29:52 +01:00
#
2020-07-01 10:29:36 +02:00
# [pairwise: --enable-pthread-rwlock, --disable-pthread-rwlock]
2019-01-25 12:29:52 +01:00
AC_ARG_ENABLE([pthread_rwlock],
2020-04-17 08:36:24 +02:00
[AS_HELP_STRING([--enable-pthread-rwlock],
[use pthread rwlock instead of internal rwlock implementation])],
[], [enable_pthread_rwlock=no])
2019-01-25 12:29:52 +01:00
AS_IF([test "$enable_pthread_rwlock" = "yes"],
[AC_CHECK_FUNCS([pthread_rwlock_rdlock], [],
[AC_MSG_ERROR([pthread_rwlock_rdlock requested but not found])])
AC_DEFINE([USE_PTHREAD_RWLOCK],[1],[Define if you want to use pthread rwlock implementation])
])
2018-08-24 14:17:34 -07:00
2018-06-12 11:26:04 +02:00
CRYPTO=OpenSSL
2017-07-31 15:26:00 +02:00
2018-06-12 11:26:04 +02:00
#
2019-06-24 14:06:56 +02:00
# OpenSSL/LibreSSL is mandatory
2018-06-12 11:26:04 +02:00
#
2020-05-13 17:37:51 +02:00
PKG_CHECK_MODULES([OPENSSL], [libssl libcrypto], [],
2019-06-24 14:06:56 +02:00
[AX_CHECK_OPENSSL([:],[AC_MSG_FAILURE([OpenSSL/LibreSSL not found])])])
2018-06-12 11:26:04 +02:00
2019-06-19 11:16:47 +02:00
AX_SAVE_FLAGS([openssl])
2019-06-24 14:06:56 +02:00
CFLAGS="$CFLAGS $OPENSSL_CFLAGS"
2018-06-12 11:26:04 +02:00
LIBS="$LIBS $OPENSSL_LIBS"
2020-12-17 11:40:29 +01:00
AC_MSG_CHECKING([for OpenSSL >= 1.0.0 or LibreSSL >= 2.7.0])
2018-06-12 11:26:04 +02:00
AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM([[#include <openssl/opensslv.h>]],
2020-12-17 11:40:29 +01:00
[[#if (!defined(LIBRESSL_VERSION_NUMBER) && (OPENSSL_VERSION_NUMBER < 0x1000000fL)) || \\
(defined(LIBRESSL_VERSION_NUMBER) && (LIBRESSL_VERSION_NUMBER < 0x02070000fL))
#error OpenSSL >= 1.0.0 or LibreSSL >= 2.7.0 required
2018-06-12 11:26:04 +02:00
#endif
]])],
[AC_MSG_RESULT([yes])],
[AC_MSG_FAILURE([not found])])
2018-10-26 05:29:56 +02:00
#
# Check for functions added in OpenSSL or LibreSSL
#
2021-12-22 18:17:26 +01:00
AC_CHECK_FUNCS([BIO_read_ex BIO_write_ex])
2022-02-25 09:00:52 +00:00
AC_CHECK_FUNCS([BN_GENCB_new])
2018-10-26 05:29:56 +02:00
AC_CHECK_FUNCS([CRYPTO_zalloc])
2021-12-22 18:17:26 +01:00
AC_CHECK_FUNCS([ERR_get_error_all])
2018-10-26 05:29:56 +02:00
AC_CHECK_FUNCS([EVP_CIPHER_CTX_new EVP_CIPHER_CTX_free])
2021-09-01 18:50:46 +00:00
AC_CHECK_FUNCS([EVP_MD_CTX_new EVP_MD_CTX_free EVP_MD_CTX_reset EVP_MD_CTX_get0_md])
2021-12-22 18:17:26 +01:00
AC_CHECK_FUNCS([EVP_PKEY_new_raw_private_key EVP_PKEY_eq])
AC_CHECK_FUNCS([OPENSSL_init_ssl OPENSSL_init_crypto OPENSSL_cleanup])
AC_CHECK_FUNCS([SSL_CTX_set_keylog_callback])
2020-12-17 11:40:29 +01:00
AC_CHECK_FUNCS([SSL_CTX_set_min_proto_version])
2021-12-22 18:17:26 +01:00
AC_CHECK_FUNCS([SSL_CTX_up_ref])
AC_CHECK_FUNCS([SSL_read_ex SSL_peek_ex SSL_write_ex])
2022-04-01 11:16:44 +03:00
AC_CHECK_FUNCS([SSL_CTX_set1_cert_store X509_STORE_up_ref])
2022-02-22 17:07:57 +02:00
AC_CHECK_FUNCS([SSL_CTX_up_ref])
2022-05-09 19:08:29 +03:00
AC_CHECK_FUNCS([SSL_SESSION_is_resumable])
2018-10-26 05:29:56 +02:00
2018-06-12 11:26:04 +02:00
#
# Check for algorithm support in OpenSSL
#
2021-09-01 13:13:24 +00:00
AC_CHECK_FUNCS([EVP_DigestSignInit EVP_DigestVerifyInit], [:],
[AC_MSG_FAILURE([EVP_DigestSignInit/EVP_DigestVerifyInit support in OpenSSL is mandatory.])])
2018-06-12 11:26:04 +02:00
AC_MSG_CHECKING([for ECDSA P-256 support])
AC_COMPILE_IFELSE(
2021-09-01 13:13:24 +00:00
[AC_LANG_PROGRAM([[#include <openssl/evp.h>]],
[[EVP_PKEY_CTX *kctx = EVP_PKEY_CTX_new_id(NID_X9_62_prime256v1, NULL);]])],
2018-06-12 11:26:04 +02:00
[AC_MSG_RESULT([yes])],
[AC_MSG_FAILURE([not found. ECDSA P-256 support in OpenSSL is mandatory.])])
AC_MSG_CHECKING([for ECDSA P-384 support])
AC_COMPILE_IFELSE(
2021-09-01 13:13:24 +00:00
[AC_LANG_PROGRAM([[#include <openssl/evp.h>]],
[[EVP_PKEY_CTX *kctx = EVP_PKEY_CTX_new_id(NID_secp384r1, NULL);]])],
2018-06-12 11:26:04 +02:00
[AC_MSG_RESULT([yes])],
[AC_MSG_FAILURE([not found. ECDSA P-384 support in OpenSSL is mandatory.])])
AC_MSG_CHECKING([for Ed25519 support])
AC_COMPILE_IFELSE(
2021-09-01 13:13:24 +00:00
[AC_LANG_PROGRAM([[#include <openssl/evp.h>]],
[[EVP_PKEY_CTX *kctx = EVP_PKEY_CTX_new_id(NID_ED25519, NULL);]])],
2018-06-12 11:26:04 +02:00
[AC_DEFINE([HAVE_OPENSSL_ED25519], [1], [define if OpenSSL supports Ed25519])
AC_MSG_RESULT([yes])],
[AC_MSG_RESULT([no])])
2017-07-31 15:26:00 +02:00
2018-06-12 11:26:04 +02:00
AC_MSG_CHECKING([for Ed448 support])
2019-05-29 15:32:16 +10:00
AC_COMPILE_IFELSE(
2021-09-01 13:13:24 +00:00
[AC_LANG_PROGRAM([[#include <openssl/evp.h>]],
[[EVP_PKEY_CTX *kctx = EVP_PKEY_CTX_new_id(NID_ED448, NULL);]])],
2019-05-29 15:32:16 +10:00
[AC_DEFINE([HAVE_OPENSSL_ED448], [1], [define if OpenSSL supports Ed448])
AC_MSG_RESULT([yes])],
2019-08-30 15:32:11 +02:00
[AC_MSG_RESULT([no])])
2018-06-12 11:26:04 +02:00
#
# Check for OpenSSL SHA-1 support
#
AC_CHECK_FUNCS([EVP_sha1], [:],
[AC_MSG_FAILURE([SHA-1 support in OpenSSL is mandatory.])])
2014-02-26 19:00:05 -08:00
2018-06-12 11:26:04 +02:00
#
# Check for OpenSSL SHA-2 support
#
AC_CHECK_FUNCS([EVP_sha224 EVP_sha256 EVP_sha384 EVP_sha512], [:],
[AC_MSG_FAILURE([SHA-2 support in OpenSSL is mandatory.])])
2014-02-10 15:01:06 +11:00
2018-06-12 11:26:04 +02:00
#
# Check for OpenSSL AES support
#
AC_CHECK_FUNCS([EVP_aes_128_ecb EVP_aes_192_ecb EVP_aes_256_ecb], [:],
[AC_MSG_FAILURE([AES support in OpenSSL is mandatory.])])
2006-12-04 01:54:53 +00:00
2014-01-14 15:40:56 -08:00
#
2018-06-12 11:26:04 +02:00
# Check for OpenSSL 1.1.x/LibreSSL functions
2014-01-14 15:40:56 -08:00
#
2021-12-08 16:04:15 +00:00
AC_CHECK_FUNCS([DH_get0_key ECDSA_SIG_get0 RSA_set0_key EVP_PKEY_get0_EC_KEY])
2006-12-04 01:54:53 +00:00
2020-12-17 11:40:29 +01:00
AC_CHECK_FUNCS([TLS_server_method TLS_client_method])
2020-05-13 17:37:51 +02:00
2018-10-14 14:32:02 +02:00
#
# Check whether FIPS mode is available and whether we should enable it
#
2020-07-01 10:29:36 +02:00
# FIPS is not included in pairwise testing as the relevant Docker image
# does not support FIPS mode.
#
# [pairwise: skip]
2018-10-14 14:32:02 +02:00
AC_ARG_ENABLE([fips-mode],
[AS_HELP_STRING([--enable-fips-mode],
[enable FIPS mode in OpenSSL library [default=no]])],
[], [enable_fips_mode="no"])
AC_MSG_CHECKING([whether to enable FIPS mode in OpenSSL library])
AS_CASE([$enable_fips_mode],
[yes], [AC_MSG_RESULT([yes])
AC_CHECK_FUNCS([FIPS_mode],
[], [AC_MSG_FAILURE([OpenSSL FIPS mode requested but not available.])])],
[no], [AC_MSG_RESULT([no])])
2019-06-19 11:16:47 +02:00
AX_RESTORE_FLAGS([openssl])
2006-12-04 01:54:53 +00:00
2019-06-24 14:06:56 +02:00
AC_SUBST([OPENSSL_CFLAGS])
2018-06-12 11:26:04 +02:00
AC_SUBST([OPENSSL_LIBS])
2014-02-19 12:53:42 +11:00
2018-08-07 16:46:53 +02:00
AC_CHECK_FUNCS([clock_gettime])
2018-06-12 11:26:04 +02:00
2020-07-01 10:29:36 +02:00
# [pairwise: --with-gssapi=yes, --with-gssapi=auto, --without-gssapi]
2018-08-07 16:46:53 +02:00
AC_ARG_WITH([gssapi],
[AS_HELP_STRING([--with-gssapi=[PATH|[/path/]krb5-config]],
2018-06-12 11:26:04 +02:00
[Specify path for system-supplied GSSAPI
2018-08-07 16:46:53 +02:00
[default=auto]])],
[], [with_gssapi="auto"])
KRB5_CONFIG=
AS_CASE([$with_gssapi],
[no],[AC_MSG_CHECKING([for GSSAPI support])
AC_MSG_RESULT([no])],
[yes],[AC_PATH_PROG([KRB5_CONFIG], [krb5-config])
AS_IF([test -z "$KRB5_CONFIG"],
[AC_MSG_ERROR([krb5-config required but not found])])],
[auto],[AC_PATH_PROG([KRB5_CONFIG], [krb5-config])],
[*krb5-config*],[KRB5_CONFIG="$with_gssapi"],
[AC_MSG_ERROR([--with-gssapi requires yes|no|auto|/path/to/krb5-config])])
GSSAPI_CFLAGS=
GSSAPI_LIBS=
KRB5_CFLAGS=
KRB5_LIBS=
AS_IF([test -n "$KRB5_CONFIG"],
[AC_MSG_CHECKING([for gssapi libraries])
AX_SAVE_FLAGS([gssapi])
GSSAPI_CFLAGS=`"$KRB5_CONFIG" --cflags gssapi`
GSSAPI_LIBS=`"$KRB5_CONFIG" --libs gssapi`
CFLAGS="$CFLAGS $GSSAPI_CFLAGS"
LIBS="$LIBS $GSSAPI_LIBS"
AC_MSG_RESULT([$GSSAPI_CFLAGS $GSSAPI_LIBS])
AC_CHECK_HEADERS([gssapi/gssapi.h], [],
[AC_CHECK_HEADERS([gssapi.h], [],
[AC_MSG_ERROR([neither gssapi/gssapi.h nor gssapi.h found])])])
AC_CHECK_HEADERS([gssapi/gssapi_krb5.h],
[AC_CHECK_HEADERS([gssapi_krb5.h], []
[AC_MSG_ERROR([neither gssapi/gssapi_krb5.h nor gssapi_krb5.h found])])])
AC_CHECK_FUNCS([gss_acquire_cred],[],
[AC_MSG_ERROR([linking with $GSSAPI_LIBS does not work])])
AX_RESTORE_FLAGS([gssapi])
AC_MSG_CHECKING([for krb5 libraries])
AX_SAVE_FLAGS([krb5])
KRB5_CFLAGS=`"$KRB5_CONFIG" --cflags krb5`
KRB5_LIBS=`$KRB5_CONFIG --libs krb5`
CFLAGS="$CFLAGS $KRB5_CFLAGS"
LIBS="$CFLAGS $KRB5_LIBS"
AC_MSG_RESULT([$KRB5_CFLAGS $KRB5_LIBS])
AC_CHECK_HEADERS([krb5/krb5.h], [],
[AC_CHECK_HEADERS([krb5.h], [],
[AC_MSG_ERROR([neither krb5/krb5.h nor krb5 found])])])
AC_CHECK_FUNCS([krb5_init_context], [],
[AC_MSG_ERROR([linking with $KRB5_LIBS failed])])
AX_RESTORE_FLAGS([krb5])
AC_DEFINE([HAVE_GSSAPI], [1], [Define to 1 if you have the Kerberos Framework available])
# kludge to silence compiler warnings which recommend use of GSS.framework on macOS
AS_CASE([$host],[*-darwin*],[CFLAGS="$CFLAGS -Wno-deprecated-declarations"])])
AM_CONDITIONAL([HAVE_GSSAPI], [test -n "$GSSAPI_LIBS"])
AC_SUBST([GSSAPI_CFLAGS])
AC_SUBST([GSSAPI_LIBS])
AC_SUBST([KRB5_CFLAGS])
AC_SUBST([KRB5_LIBS])
2014-04-03 09:24:53 +02:00
2016-07-21 11:13:03 -07:00
#
# was --with-lmdb specified?
#
2020-07-01 10:29:36 +02:00
# [pairwise: --with-lmdb=auto, --with-lmdb=yes, --without-lmdb]
2020-03-10 12:37:25 +01:00
AC_ARG_WITH([lmdb],
[AS_HELP_STRING([--with-lmdb=@<:@PATH@:>@],
[use LMDB library @<:@default=auto@:>@, optionally specify the prefix for lmdb library])],
[:],
[with_lmdb="auto"])
2016-07-21 11:13:03 -07:00
2020-03-10 12:37:25 +01:00
ac_lib_lmdb_found=no
AS_CASE([$with_lmdb],
[no],[],
[auto|yes], [PKG_CHECK_MODULES([LMDB], [lmdb],
[ac_lib_lmdb_found=yes],
[for ac_lib_lmdb_path in /usr /usr/local /opt /opt/local; do
AX_LIB_LMDB([$ac_lib_lmdb_path],
[ac_lib_lmdb_found=yes
break])
done
])],
[AX_LIB_LMDB([$with_lmdb],[ac_lib_lmdb_found=yes])])
# don't fail when in automatic mode
AS_IF([test "$with_lmdb" = "auto" && test "$ac_lib_lmdb_found" = "no"],
[with_lmdb=no])
# hard fail when LMDB requested, but not found
AS_IF([test "$with_lmdb" != "no" && test "$ac_lib_lmdb_found" != "yes"],
[AC_MSG_ERROR([LMDB requested, but not found])])
AS_IF([test "$ac_lib_lmdb_found" = "yes"],
[AC_DEFINE([HAVE_LMDB], [1], [Use lmdb library])])
AC_SUBST([LMDB_CFLAGS])
AC_SUBST([LMDB_LIBS])
2018-08-07 16:46:53 +02:00
AM_CONDITIONAL([HAVE_LMDB], [test -n "$LMDB_LIBS"])
2016-07-21 11:13:03 -07:00
2006-12-21 06:03:37 +00:00
#
# was --with-libxml2 specified?
#
2020-07-01 10:29:36 +02:00
# [pairwise: --with-libxml2=auto, --with-libxml2=yes, --without-libxml2]
2019-06-24 14:25:55 +02:00
AC_ARG_WITH([libxml2],
[AS_HELP_STRING([--with-libxml2],
[build with libxml2 library [yes|no|auto] (default is auto)])],
[], [with_libxml2="auto"])
AS_CASE([$with_libxml2],
[no],[],
[auto],[PKG_CHECK_MODULES([LIBXML2], [libxml-2.0 >= 2.6.0],
[AC_DEFINE([HAVE_LIBXML2], [1], [Use libxml2 library])],
[:])],
[yes],[PKG_CHECK_MODULES([LIBXML2], [libxml-2.0 >= 2.6.0],
[AC_DEFINE([HAVE_LIBXML2], [1], [Use libxml2 library])])],
[AC_MSG_ERROR([Specifying libxml2 installation path is not supported, adjust PKG_CONFIG_PATH instead])])
2006-12-21 06:03:37 +00:00
2018-08-07 16:46:53 +02:00
AM_CONDITIONAL([HAVE_LIBXML2], [test -n "$LIBXML2_LIBS"])
2013-03-13 14:24:50 -07:00
2019-02-06 11:56:42 +01:00
#
# was --with-json-c specified?
#
2020-07-01 10:29:36 +02:00
# [pairwise: --with-json-c=detect, --with-json-c=yes, --without-json-c]
2019-02-06 11:56:42 +01:00
AC_ARG_WITH([json-c],
[AS_HELP_STRING([--with-json-c],
[build with json-c library [yes|no|detect] (default is detect)])],
2018-08-07 16:46:53 +02:00
[], [with_json_c="detect"])
2013-03-13 14:24:50 -07:00
2019-02-06 11:56:42 +01:00
AS_CASE([$with_json_c],
[no],[],
[detect],[PKG_CHECK_MODULES([JSON_C], [json-c >= 0.11],
[AC_DEFINE([HAVE_JSON_C], [1], [Use json-c library])],
[:])],
[yes],[PKG_CHECK_MODULES([JSON_C], [json-c >= 0.11],
[AC_DEFINE([HAVE_JSON_C], [1], [Use json-c library])])],
[AC_MSG_ERROR([Specifying json-c installation path is not supported, adjust PKG_CONFIG_PATH instead])]
)
2013-03-13 14:24:50 -07:00
2018-08-07 16:46:53 +02:00
AM_CONDITIONAL([HAVE_JSON_C], [test -n "$JSON_C_LIBS"])
2019-02-06 11:56:42 +01:00
AC_SUBST([JSON_C_CFLAGS])
AC_SUBST([JSON_C_LIBS])
2013-07-09 16:43:59 -07:00
2018-08-07 16:46:53 +02:00
#
# was --with-zlib specified?
#
2020-07-01 10:29:36 +02:00
# [pairwise: --with-zlib=auto, --with-zlib=yes, --without-zlib]
2019-07-31 13:50:15 +02:00
AC_ARG_WITH([zlib],
2018-08-07 16:46:53 +02:00
[AS_HELP_STRING([--with-zlib],
[build with zlib for HTTP compression
[default=yes]])],
[], with_zlib="auto")
2019-07-31 13:50:15 +02:00
AS_CASE([$with_zlib],
[no],[],
[auto],[PKG_CHECK_MODULES([ZLIB], [zlib],
2020-05-15 16:37:44 -07:00
[AC_DEFINE([HAVE_ZLIB], [1], [Use zlib library])],
[:])],
2019-07-31 13:50:15 +02:00
[yes],[PKG_CHECK_MODULES([ZLIB], [zlib],
2020-05-15 16:37:44 -07:00
[AC_DEFINE([HAVE_ZLIB], [1], [Use zlib library])])],
2019-07-31 13:50:15 +02:00
[AC_MSG_ERROR([Specifying zlib installation path is not supported, adjust PKG_CONFIG_PATH instead])])
2020-02-19 00:17:03 -08:00
AC_SUBST([ZLIB_CFLAGS])
AC_SUBST([ZLIB_LIBS])
2015-10-02 10:45:10 +02:00
2021-10-20 18:14:49 +02:00
#
# was --with-libsystemd specified?
#
# [pairwise: --with-libsystemd=auto, --with-libsystemd=yes, --without-libsystemd]
AC_ARG_WITH([libsystemd],
[AS_HELP_STRING([--with-libsystemd],
[build with libsystemd integration [default=auto]])],
[], [with_libsystemd=auto])
AS_CASE([$with_libsystemd],
[no],[],
[auto],[PKG_CHECK_MODULES([LIBSYSTEMD], [libsystemd],
[AC_DEFINE([HAVE_LIBSYSTEMD], [1], [Use libsystemd library])],
[:])],
[yes],[PKG_CHECK_MODULES([LIBSYSTEMD], [libsystemd],
[AC_DEFINE([HAVE_LIBSYSTEMD], [1], [Use libsystemd library])])],
[AC_MSG_ERROR([Specifying libsystemd installation path is not supported, adjust PKG_CONFIG_PATH instead])])
AC_SUBST([LIBSYSTEMD_CFLAGS])
AC_SUBST([LIBSYSTEMD_LIBS])
2009-09-01 18:40:25 +00:00
#
2020-03-11 09:55:48 +01:00
# Check if the system supports glibc-compatible backtrace() function.
2009-09-01 18:40:25 +00:00
#
2020-03-11 09:55:48 +01:00
AC_CHECK_HEADERS([execinfo.h],
2021-04-27 16:20:03 +02:00
[AC_SEARCH_LIBS([backtrace_symbols], [execinfo],
[AC_CHECK_FUNCS([backtrace_symbols])])])
2000-07-25 23:54:09 +00:00
2000-02-11 18:35:11 +00:00
#
# We do the IPv6 compilation checking after libtool so that we can put
# the right suffix on the files.
#
2018-08-21 11:50:23 +02:00
AC_MSG_CHECKING([for IPv6 structures])
AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM(
[[
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
]],
[[
2018-08-21 12:54:15 +02:00
struct sockaddr_in6 sin6;
struct in6_addr in6;
2018-08-21 13:22:40 +02:00
struct in6_pktinfo in6_pi;
2018-08-21 13:48:48 +02:00
struct sockaddr_storage storage;
2018-08-21 12:54:15 +02:00
in6 = in6addr_any;
2018-08-21 13:07:05 +02:00
in6 = in6addr_loopback;
2018-08-21 13:17:00 +02:00
sin6.sin6_scope_id = 0;
2018-08-21 12:54:15 +02:00
return (0);
2018-08-21 11:50:23 +02:00
]])],
[AC_MSG_RESULT([yes])],
[AC_MSG_FAILURE([IPv6 support is mandatory])])
2000-01-07 02:44:13 +00:00
2016-08-12 15:31:33 +10:00
#
2017-09-18 08:34:41 +02:00
# Allow forcibly disabling TCP Fast Open support as autodetection might yield
# confusing results on some systems (e.g. FreeBSD; see set_tcp_fastopen()
2021-05-20 15:53:50 +02:00
# comment in lib/isc/socket.c).
2016-08-12 15:31:33 +10:00
#
2020-07-01 10:29:36 +02:00
# [pairwise: --enable-tcp-fastopen, --disable-tcp-fastopen]
2018-09-05 12:34:10 +02:00
AC_ARG_ENABLE([tcp_fastopen],
[AS_HELP_STRING([--disable-tcp-fastopen],
[disable TCP Fast Open support [default=yes]])],
2018-08-07 16:46:53 +02:00
[], [enable_tcp_fastopen="yes"])
2017-09-18 08:34:41 +02:00
2018-09-05 12:34:10 +02:00
AS_IF([test "$enable_tcp_fastopen" = "yes"],
[AC_DEFINE([ENABLE_TCP_FASTOPEN], [1], [define if you want TCP_FASTOPEN enabled if available])])
2016-08-12 15:31:33 +10:00
2000-07-25 23:54:09 +00:00
#
2000-04-26 21:50:49 +00:00
# Check for some other useful functions that are not ever-present.
2000-07-25 23:54:09 +00:00
#
2022-09-15 17:03:50 +10:00
AC_CHECK_FUNCS([strlcpy strlcat strnstr])
2001-12-03 21:52:07 +00:00
2020-08-11 16:14:36 +02:00
#
# Check for readline support
#
2020-07-01 10:29:36 +02:00
# editline is not included in pairwise testing as the library
# is not present in the relevant Docker image.
#
# GNU Readline is not included in pairwise testing as the library
# in the relevant Docker image does not support pkg-config.
#
# [pairwise: --with-readline=auto, --with-readline=yes, --with-readline=libedit, --without-readline]
2020-08-11 16:14:36 +02:00
AC_ARG_WITH([readline],
[AS_HELP_STRING([--with-readline=yes|no|libedit|readline],
[specify readline library [default auto]])],
[], [with_readline="auto"])
AS_CASE([$with_readline],
[no],[],
2020-08-18 16:31:20 +02:00
[auto|yes],
2020-08-11 16:14:36 +02:00
[PKG_CHECK_MODULES([READLINE], [libedit],
[AC_DEFINE([HAVE_READLINE_LIBEDIT], [1], [Build with libedit support])],
2020-08-19 17:12:25 +02:00
[PKG_CHECK_MODULES([READLINE], [libeditline],
2020-08-11 16:14:36 +02:00
[AC_DEFINE([HAVE_READLINE_EDITLINE], [1], [Build with editline support.])],
[PKG_CHECK_MODULES([READLINE], [readline],
[AC_DEFINE([HAVE_READLINE_READLINE], [1], [Build with readline support.])],
[AS_IF([test "$with_readline" = "yes"],
[AC_MSG_ERROR([readline support requested, but none of the libraries have been found.])])])])])],
[libedit],
[PKG_CHECK_MODULES([READLINE], [libedit],
[AC_DEFINE([HAVE_READLINE_LIBEDIT], [1], [Build with libedit support])])],
[editline],
2020-08-19 17:12:25 +02:00
[PKG_CHECK_MODULES([READLINE], [libeditline],
2020-08-11 16:14:36 +02:00
[AC_DEFINE([HAVE_READLINE_EDITLINE], [1], [Build with editline support])])],
[readline],
[PKG_CHECK_MODULES([READLINE], [readline],
[AC_DEFINE([HAVE_READLINE_READLINE], [1], [Build with readline support])])],
[AC_MSG_ERROR([Unknown readline '$with_readline' library requested.])])
AM_CONDITIONAL([HAVE_READLINE], [test -n "$READLINE_LIBS"])
AC_SUBST([READLINE_CFLAGS])
AC_SUBST([READLINE_LIBS])
2011-12-16 23:01:17 +00:00
2000-02-11 18:35:11 +00:00
#
# Security Stuff
#
2008-12-01 03:53:32 +00:00
# Note it is very recommended to *not* disable chroot(),
# this is only because chroot() was made obsolete by Posix.
2020-07-01 10:29:36 +02:00
#
# [pairwise: --enable-chroot, --disable-chroot]
2017-11-13 11:36:45 +11:00
AC_ARG_ENABLE(chroot, AS_HELP_STRING([--disable-chroot], [disable chroot]))
2008-12-01 03:53:32 +00:00
case "$enable_chroot" in
yes|'')
AC_CHECK_FUNCS(chroot)
;;
no)
;;
esac
2018-06-26 14:52:11 +02:00
LIBCAP_LIBS=""
AC_MSG_CHECKING([whether to enable Linux capabilities])
2020-07-01 10:29:36 +02:00
# [pairwise: --enable-linux-caps, --disable-linux-caps]
2018-06-26 14:52:11 +02:00
AC_ARG_ENABLE([linux-caps],
[AS_HELP_STRING([--disable-linux-caps],
[disable Linux capabilities])],
[],
[AS_CASE([$host],
[*-linux*],[enable_linux_caps=yes],
[enable_linux_caps=no])])
AS_IF([test "$enable_linux_caps" = "yes"],
[AC_MSG_RESULT([yes])
AC_CHECK_HEADERS([sys/capability.h],
[],
2018-07-02 08:53:13 +02:00
[AC_MSG_ERROR(m4_normalize([sys/capability.h header is required for Linux capabilities support.
Either install libcap or use --disable-linux-caps.]))])
2019-06-19 11:16:47 +02:00
AX_SAVE_FLAGS([cap])
2018-06-26 14:52:11 +02:00
AC_SEARCH_LIBS([cap_set_proc], [cap],
[LIBCAP_LIBS="$ac_cv_search_cap_set_proc"],
2018-07-02 08:53:13 +02:00
[AC_MSG_ERROR(m4_normalize([libcap is required for Linux capabilities support.
Either install libcap or use --disable-linux-caps.]))])
2019-06-19 11:16:47 +02:00
AX_RESTORE_FLAGS([cap])],
2018-06-26 14:52:11 +02:00
[AC_MSG_RESULT([no])])
AC_SUBST([LIBCAP_LIBS])
2005-02-23 01:09:23 +00:00
case "$host" in
*-solaris*)
AC_DEFINE(NEED_SECURE_DIRECTORY, 1,
[Define if connect does not honour the permission on the UNIX domain socket.])
;;
esac
2004-01-07 05:48:15 +00:00
#
# Time Zone Stuff
#
2018-09-05 12:58:02 +02:00
AC_CHECK_FUNCS([tzset])
2004-01-07 05:48:15 +00:00
2009-01-17 09:35:58 +00:00
AC_MSG_CHECKING(for optarg declaration)
2021-04-16 12:25:35 +02:00
AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM(
[[#include <unistd.h>]],
[[optarg = 0;]]
)],
[AC_MSG_RESULT(yes)],
[AC_MSG_RESULT(no)
GEN_NEED_OPTARG="-DNEED_OPTARG=1"
AC_DEFINE(NEED_OPTARG, 1, [Defined if extern char *optarg is not declared.])]
)
2005-06-08 02:09:18 +00:00
2016-05-05 12:22:26 -07:00
#
# Check for nanoseconds in file stats
#
2018-09-05 12:39:51 +02:00
AC_MSG_CHECKING([for st_mtim.tv_nsec])
AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM(
2021-09-20 17:33:56 +10:00
[[#include <sys/stat.h>]],
2018-09-05 12:39:51 +02:00
[[struct stat s;
return(s.st_mtim.tv_nsec);
]])],
2021-09-20 17:33:56 +10:00
[AC_MSG_RESULT([yes])
AC_DEFINE([HAVE_STAT_NSEC], [1], [define if struct stat has st_mtim.tv_nsec field])],
[AC_MSG_RESULT([no])])
2016-05-05 12:22:26 -07:00
2002-11-26 03:53:42 +00:00
#
# Check for if_nametoindex() for IPv6 scoped addresses support
#
2018-09-04 12:35:42 +02:00
AC_CHECK_FUNCS([if_nametoindex])
2002-11-26 03:53:42 +00:00
2018-08-14 09:52:25 +02:00
ISC_ATOMIC_LIBS=""
AC_CHECK_HEADERS(
[stdatomic.h],
[AC_MSG_CHECKING([for memory model aware atomic operations])
AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM(
[[#include <stdatomic.h>]],
[[atomic_int_fast32_t val = 0; atomic_fetch_add_explicit(&val, 1, memory_order_relaxed);]]
)],
[AC_MSG_RESULT([stdatomic.h])
AC_MSG_CHECKING([whether -latomic is needed for 64-bit stdatomic.h functions])
AC_LINK_IFELSE(
[AC_LANG_PROGRAM(
[[#include <stdatomic.h>]],
[[atomic_int_fast64_t val = 0; atomic_fetch_add_explicit(&val, 1, memory_order_relaxed);]]
)],
[AC_MSG_RESULT([no])],
2019-03-01 10:10:17 +01:00
[ISC_ATOMIC_LIBS="-latomic"
2019-06-19 11:16:47 +02:00
AX_SAVE_FLAGS([atomic])
2019-03-01 10:10:17 +01:00
LIBS="$LIBS $ISC_ATOMIC_LIBS"
AC_LINK_IFELSE(
[AC_LANG_PROGRAM(
[[#include <stdatomic.h>]],
[[atomic_int_fast64_t val = 0; atomic_fetch_add_explicit(&val, 1, memory_order_relaxed);]]
)],
[AC_MSG_RESULT([yes])],
[AC_MSG_FAILURE([libatomic needed, but linking with -latomic failed, please fix your toolchain.])])
2019-06-19 11:16:47 +02:00
AX_RESTORE_FLAGS([atomic])
2018-08-14 09:52:25 +02:00
])
],
2019-03-01 10:10:17 +01:00
[AC_MSG_FAILURE([stdatomic.h header found, but compilation failed, please fix your toolchain.])]
2018-08-14 09:52:25 +02:00
)],
[AC_MSG_CHECKING([for memory model aware atomic operations])
AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM(
[[#include <inttypes.h>]],
[[int32_t val = 0; __atomic_fetch_add(&val, 1, __ATOMIC_RELAXED);]]
)],
[AC_MSG_RESULT([__atomic builtins])
AC_DEFINE([HAVE___ATOMIC], [1], [define if __atomic builtins are not available])
AC_MSG_CHECKING([whether -latomic is needed for 64-bit __atomic builtins])
AC_LINK_IFELSE(
[AC_LANG_PROGRAM(
[[#include <inttypes.h>]],
[[int64_t val = 0; __atomic_fetch_add(&val, 1, __ATOMIC_RELAXED);]]
)],
[AC_MSG_RESULT([no])],
2019-03-01 10:10:17 +01:00
[ISC_ATOMIC_LIBS="-latomic"
2019-06-19 11:16:47 +02:00
AX_SAVE_FLAGS([atomic])
2019-03-01 10:10:17 +01:00
LIBS="$LIBS $ISC_ATOMIC_LIBS"
AC_LINK_IFELSE(
[AC_LANG_PROGRAM(
[[#include <inttypes.h>]],
[[int64_t val = 0; __atomic_fetch_add(&val, 1, __ATOMIC_RELAXED);]]
)],
[AC_MSG_RESULT([yes])],
[AC_MSG_FAILURE([libatomic needed, but linking with -latomic failed, please fix your toolchain.])])
2019-06-19 11:16:47 +02:00
AX_RESTORE_FLAGS([atomic])
2018-08-14 09:52:25 +02:00
])
],
2021-06-03 08:00:22 +02:00
[AC_MSG_FAILURE([not found])
2018-08-14 09:52:25 +02:00
])
])
LIBS="$LIBS $ISC_ATOMIC_LIBS"
2005-06-04 05:32:50 +00:00
2021-10-11 12:57:27 +02:00
AC_CHECK_HEADERS([stdalign.h stdnoreturn.h])
2019-11-05 13:28:50 -08:00
2018-08-14 10:23:50 +02:00
AC_CHECK_HEADERS([uchar.h])
2018-06-04 13:41:09 +02:00
#
# Check for __builtin_unreachable
#
AC_MSG_CHECKING([compiler support for __builtin_unreachable()])
AC_LINK_IFELSE(
[AC_LANG_PROGRAM(
[[]],
[[__builtin_unreachable();]]
)],
[AC_MSG_RESULT([yes])
AC_DEFINE([HAVE_BUILTIN_UNREACHABLE], [1], [define if the compiler supports __builtin_unreachable().])
],
[AC_MSG_RESULT([no])
])
2016-07-10 19:46:17 +05:30
#
# Check for __builtin_clz
#
AC_MSG_CHECKING([compiler support for __builtin_clz])
2021-04-16 12:25:35 +02:00
AC_LINK_IFELSE(
[AC_LANG_PROGRAM(
[[]],
[[return (__builtin_clz(0xff) == 24 ? 1 : 0);]]
)],
2021-10-20 11:22:52 +02:00
[AC_MSG_RESULT([yes])
AC_DEFINE(HAVE_BUILTIN_CLZ, 1, [Define to 1 if the compiler supports __builtin_clz.])
],
[AC_MSG_RESULT([no])]
2021-04-16 12:25:35 +02:00
)
2021-10-20 11:22:52 +02:00
#
2022-09-23 15:35:58 +02:00
# Check for __builtin_*_overflow
2021-10-20 11:22:52 +02:00
#
2022-09-23 15:35:58 +02:00
AC_MSG_CHECKING([compiler support for __builtin_add_overflow()])
2021-10-20 11:22:52 +02:00
AC_LINK_IFELSE(
[AC_LANG_PROGRAM(
[[#include <limits.h>]],
2022-09-23 15:35:58 +02:00
[[return (__builtin_add_overflow((unsigned int)UINT_MAX, (unsigned int)UINT_MAX, &(unsigned int){ 0 }));]]
2021-10-20 11:22:52 +02:00
)],
[AC_MSG_RESULT([yes])
2022-09-23 15:35:58 +02:00
AC_DEFINE([HAVE_BUILTIN_ADD_OVERFLOW], [1], [define if the compiler supports __builtin_add_overflow().])
],
[AC_MSG_RESULT([no])
])
AC_MSG_CHECKING([compiler support for __builtin_sub_overflow()])
AC_LINK_IFELSE(
[AC_LANG_PROGRAM(
[[#include <limits.h>]],
[[return (__builtin_sub_overflow((unsigned int)0, (unsigned int)UINT_MAX, &(unsigned int){ 0 }));]]
)],
[AC_MSG_RESULT([yes])
AC_DEFINE([HAVE_BUILTIN_SUB_OVERFLOW], [1], [define if the compiler supports __builtin_sub_overflow().])
],
[AC_MSG_RESULT([no])
])
AC_MSG_CHECKING([compiler support for __builtin_mul_overflow()])
AC_LINK_IFELSE(
[AC_LANG_PROGRAM(
[[#include <limits.h>]],
[[return (__builtin_mul_overflow(UINT64_C(UINT64_MAX), UINT64_C(UINT64_MAX), &(uint64_t){ 0 }));]]
)],
[AC_MSG_RESULT([yes])
AC_DEFINE([HAVE_BUILTIN_MUL_OVERFLOW], [1], [define if the compiler supports __builtin_mul_overflow().])
2021-10-20 11:22:52 +02:00
],
[AC_MSG_RESULT([no])
])
2016-07-10 19:46:17 +05:30
2008-04-23 21:32:57 +00:00
#
# Activate "rrset-order fixed" or not?
#
2020-07-01 10:29:36 +02:00
# [pairwise: --enable-fixed-rrset, --disable-fixed-rrset]
2018-08-07 16:46:53 +02:00
AC_ARG_ENABLE([fixed-rrset],
[AS_HELP_STRING([--enable-fixed-rrset],
[enable fixed rrset ordering [default=no]])],
[], [enable_fixed_rrset="no"])
AS_IF([test "$enable_fixed_rrset" = "yes"],
[AC_DEFINE([DNS_RDATASET_FIXED], [1],
[Define to enable "rrset-order fixed" syntax.])])
2008-04-23 21:32:57 +00:00
2015-10-02 12:32:42 -07:00
#
# Activate dnstap?
#
2020-07-01 10:29:36 +02:00
# [pairwise: --enable-dnstap, --disable-dnstap]
2018-08-07 16:46:53 +02:00
AC_ARG_ENABLE([dnstap],
[AS_HELP_STRING([--enable-dnstap],
[enable dnstap support
(requires fstrm, protobuf-c)])],
[], [enable_dnstap=no])
AS_IF([test "$enable_dnstap" != "no"],
[PKG_CHECK_MODULES([DNSTAP], [libfstrm libprotobuf-c], [],
[AC_MSG_FAILURE([Required libraries (fstrm, protobuf-c) were not found, please install them.])])
2020-04-23 08:34:11 +02:00
AC_PATH_PROG([FSTRM_CAPTURE], [fstrm_capture])
AC_PATH_PROG([PROTOC_C], [protoc-c])
2018-08-07 16:46:53 +02:00
AS_IF([test -z "$PROTOC_C"],
[AC_MSG_ERROR([protoc-c compiler not found])])
AC_DEFINE([HAVE_DNSTAP], 1, [Define to 1 to enable dnstap support])
])
2006-12-22 01:46:19 +00:00
2018-08-07 16:46:53 +02:00
AC_SUBST([DNSTAP_CFLAGS])
AC_SUBST([DNSTAP_LIBS])
AM_CONDITIONAL([HAVE_DNSTAP], [test "$enable_dnstap" != "no"])
2019-03-31 12:49:47 +02:00
#
# The following sections deal with tools used for formatting
# the documentation. They are all optional, unless you are
# a developer editing the documentation source.
#
#
# Look for sphinx-build
#
AC_ARG_VAR([SPHINX_BUILD], [path to sphinx-build binary used to build the documentation])
AC_PATH_PROG([SPHINX_BUILD], [sphinx-build], [:])
AM_CONDITIONAL([HAVE_SPHINX_BUILD], [test "$SPHINX_BUILD" != ":"])
AC_PATH_PROG([XELATEX], [xelatex], [:])
AC_PATH_PROG([LATEXMK], [latexmk], [:])
AM_CONDITIONAL([HAVE_XELATEX], [test "$XELATEX" != ":" && test "$LATEXMK" != ":"])
#
# Pull release date from CHANGES file last modification date
# for reproducible builds
#
2022-01-24 16:09:48 +01:00
release_date=`date -u -r CHANGES +%Y-%m-%d`
2019-03-31 12:49:47 +02:00
AC_SUBST([RELEASE_DATE], $release_date)
#
# Look for Doxygen
#
AC_PATH_PROGS([DOXYGEN], [doxygen])
AC_CONFIG_FILES([doc/doxygen/doxygen-input-filter],
[chmod +x doc/doxygen/doxygen-input-filter])
2006-12-22 01:46:19 +00:00
2015-06-29 18:33:18 +05:30
#
# Look for curl
#
AC_PATH_PROG(CURL, curl, curl)
AC_SUBST(CURL)
2021-10-26 15:28:36 +11:00
#
# Look for nc
#
AC_PATH_PROGS(NC, nc, nc)
AC_SUBST(NC)
2015-09-23 16:47:37 +02:00
#
# IDN support using libidn2
#
2018-03-14 11:30:47 +01:00
LIBIDN2_CFLAGS=
2017-08-15 14:36:59 +02:00
LIBIDN2_LIBS=
2020-07-01 10:29:36 +02:00
# [pairwise: --with-libidn2=yes, --without-libidn2]
Rework libidn2 detection
Clean up the parts of configure.in responsible for handling libidn2
detection and adjust other pieces of the build system to match these
cleanups:
- use pkg-config when --with-libidn2 is used without an explicit path,
- look for idn2_to_ascii_lz() rather than idn2_to_ascii_8z() as the
former is used in BIND while the latter is not,
- do not look for idn2_to_unicode_8zlz() as it is present in all
libidn2 versions which have idn2_to_ascii_lz(),
- check whether the <idn2.h> header is usable,
- set LDFLAGS in the Makefile for dig so that, if specified, the
requested libidn2 path is used when linking with libidn2,
- override CPPFLAGS when looking for libidn2 components so that the
configure script does not produce warnings when libidn2 is not
installed system-wide,
- merge the AS_CASE() call into the AS_IF() call below it to simplify
code,
- indicate the default value of --with-libidn2 in "./configure --help"
output,
- use $with_libidn2 rather than $use_libidn2 to better match the name
of the configure script argument,
- stop differentiating between IDN "in" and "out" support, i.e. make
dig either support libidn2 or not; remove WITH_* Autoconf macros and
use a new one, HAVE_LIBIDN2, to determine whether libidn2 support
should be enabled.
2018-07-10 14:34:35 +02:00
AC_ARG_WITH([libidn2],
[AS_HELP_STRING([--with-libidn2[=PATH]], [enable IDN support using GNU libidn2 [yes|no(default)|path]])],
[with_libidn2="$withval"], [with_libidn2="no"])
AS_CASE([$with_libidn2],
[yes], [PKG_CHECK_MODULES([LIBIDN2], [libidn2],
[AC_DEFINE([HAVE_LIBIDN2], [1], [Define if libidn2 was found])])],
[no], [],
2019-06-19 11:16:47 +02:00
[*], [AX_SAVE_FLAGS([libidn2])
Rework libidn2 detection
Clean up the parts of configure.in responsible for handling libidn2
detection and adjust other pieces of the build system to match these
cleanups:
- use pkg-config when --with-libidn2 is used without an explicit path,
- look for idn2_to_ascii_lz() rather than idn2_to_ascii_8z() as the
former is used in BIND while the latter is not,
- do not look for idn2_to_unicode_8zlz() as it is present in all
libidn2 versions which have idn2_to_ascii_lz(),
- check whether the <idn2.h> header is usable,
- set LDFLAGS in the Makefile for dig so that, if specified, the
requested libidn2 path is used when linking with libidn2,
- override CPPFLAGS when looking for libidn2 components so that the
configure script does not produce warnings when libidn2 is not
installed system-wide,
- merge the AS_CASE() call into the AS_IF() call below it to simplify
code,
- indicate the default value of --with-libidn2 in "./configure --help"
output,
- use $with_libidn2 rather than $use_libidn2 to better match the name
of the configure script argument,
- stop differentiating between IDN "in" and "out" support, i.e. make
dig either support libidn2 or not; remove WITH_* Autoconf macros and
use a new one, HAVE_LIBIDN2, to determine whether libidn2 support
should be enabled.
2018-07-10 14:34:35 +02:00
LIBIDN2_CFLAGS="-I$with_libidn2/include"
2020-11-24 14:51:51 +01:00
LIBIDN2_LIBS="-L$with_libidn2/lib"
CFLAGS="$CFLAGS $LIBIDN2_CFLAGS"
LIBS="$LIBS $LIBIDN2_LIBS"
Rework libidn2 detection
Clean up the parts of configure.in responsible for handling libidn2
detection and adjust other pieces of the build system to match these
cleanups:
- use pkg-config when --with-libidn2 is used without an explicit path,
- look for idn2_to_ascii_lz() rather than idn2_to_ascii_8z() as the
former is used in BIND while the latter is not,
- do not look for idn2_to_unicode_8zlz() as it is present in all
libidn2 versions which have idn2_to_ascii_lz(),
- check whether the <idn2.h> header is usable,
- set LDFLAGS in the Makefile for dig so that, if specified, the
requested libidn2 path is used when linking with libidn2,
- override CPPFLAGS when looking for libidn2 components so that the
configure script does not produce warnings when libidn2 is not
installed system-wide,
- merge the AS_CASE() call into the AS_IF() call below it to simplify
code,
- indicate the default value of --with-libidn2 in "./configure --help"
output,
- use $with_libidn2 rather than $use_libidn2 to better match the name
of the configure script argument,
- stop differentiating between IDN "in" and "out" support, i.e. make
dig either support libidn2 or not; remove WITH_* Autoconf macros and
use a new one, HAVE_LIBIDN2, to determine whether libidn2 support
should be enabled.
2018-07-10 14:34:35 +02:00
AC_CHECK_HEADERS([idn2.h],
[],
[AC_MSG_ERROR([idn2.h not found])])
AC_SEARCH_LIBS([idn2_to_ascii_lz], [idn2],
2020-11-24 14:51:51 +01:00
[LIBIDN2_LIBS="$LIBIDN2_LIBS $ac_cv_search_idn2_to_ascii_lz"
Rework libidn2 detection
Clean up the parts of configure.in responsible for handling libidn2
detection and adjust other pieces of the build system to match these
cleanups:
- use pkg-config when --with-libidn2 is used without an explicit path,
- look for idn2_to_ascii_lz() rather than idn2_to_ascii_8z() as the
former is used in BIND while the latter is not,
- do not look for idn2_to_unicode_8zlz() as it is present in all
libidn2 versions which have idn2_to_ascii_lz(),
- check whether the <idn2.h> header is usable,
- set LDFLAGS in the Makefile for dig so that, if specified, the
requested libidn2 path is used when linking with libidn2,
- override CPPFLAGS when looking for libidn2 components so that the
configure script does not produce warnings when libidn2 is not
installed system-wide,
- merge the AS_CASE() call into the AS_IF() call below it to simplify
code,
- indicate the default value of --with-libidn2 in "./configure --help"
output,
- use $with_libidn2 rather than $use_libidn2 to better match the name
of the configure script argument,
- stop differentiating between IDN "in" and "out" support, i.e. make
dig either support libidn2 or not; remove WITH_* Autoconf macros and
use a new one, HAVE_LIBIDN2, to determine whether libidn2 support
should be enabled.
2018-07-10 14:34:35 +02:00
AC_DEFINE([HAVE_LIBIDN2], [1], [Define if libidn2 was found])],
[AC_MSG_ERROR([libidn2 requested, but not found])])
2019-06-19 11:16:47 +02:00
AX_RESTORE_FLAGS([libidn2])])
2018-03-14 11:30:47 +01:00
AC_SUBST([LIBIDN2_CFLAGS])
AC_SUBST([LIBIDN2_LIBS])
2015-09-23 16:47:37 +02:00
2018-06-04 08:54:58 +02:00
#
# Check whether to build with cmocka unit testing framework
#
2020-07-01 10:29:36 +02:00
# [pairwise: --with-cmocka=detect, --with-cmocka=yes, --without-cmocka]
2018-06-04 08:54:58 +02:00
AC_ARG_WITH([cmocka],
2019-02-06 15:26:19 -08:00
[AS_HELP_STRING([--with-cmocka=detect],[enable CMocka based tests (default is detect)])],
2019-02-06 01:30:57 +01:00
[],[with_cmocka=detect])
2018-06-04 08:54:58 +02:00
AS_CASE([$with_cmocka],
2019-02-06 01:30:57 +01:00
[no],[],
2021-03-15 10:22:15 +01:00
[detect],[PKG_CHECK_MODULES([CMOCKA], [cmocka >= 1.1.3],
2019-02-06 15:26:19 -08:00
[AC_DEFINE([HAVE_CMOCKA], [1], [Use CMocka])
2018-08-07 16:46:53 +02:00
with_cmocka=yes],[with_cmocka=no])],
2021-03-15 10:22:15 +01:00
[yes],[PKG_CHECK_MODULES([CMOCKA], [cmocka >= 1.1.3],
2018-08-07 16:46:53 +02:00
[AC_DEFINE([HAVE_CMOCKA], [1], [Use CMocka])])],
2019-02-06 15:26:19 -08:00
[AC_MSG_ERROR([Use PKG_CONFIG_PATH to specify path to CMocka library])]
2019-02-06 01:30:57 +01:00
)
2018-06-04 08:54:58 +02:00
AC_SUBST([CMOCKA_CFLAGS])
AC_SUBST([CMOCKA_LIBS])
2018-10-23 11:44:33 +02:00
2018-08-07 16:46:53 +02:00
AM_CONDITIONAL([HAVE_CMOCKA], [test "$with_cmocka" = "yes"])
2018-10-23 11:44:33 +02:00
2021-05-11 12:29:57 +02:00
#
Use system allocator when jemalloc is unavailable
This commit adds support for systems where the jemalloc library is not
available as a package, here's the quick summary:
* On Linux - the jemalloc is usually available as a package, if
configured --without-jemalloc, the shim would be used around
malloc(), free(), realloc() and malloc_usable_size()
* On macOS - the jemalloc is available from homebrew or macports, if
configured --without-jemalloc, the shim would be used around
malloc(), free(), realloc() and malloc_size()
* On FreeBSD - the jemalloc is *the* system allocator, we just need
to check for <malloc_np.h> header to get access to non-standard API
* On NetBSD - the jemalloc is *the* system allocator, we just need to
check for <jemalloc/jemalloc.h> header to get access to non-standard
API
* On a system hostile to users and developers (read OpenBSD) - the
jemalloc API is emulated by using ((size_t *)ptr)[-1] field to hold
the size information. The OpenBSD developers care only for
themselves, so why should we care about speed on OpenBSD?
2021-05-25 12:46:00 +02:00
# Compile with jemalloc (either provided as package or wired in the system on FreeBSD and NetBSD)
2021-05-11 12:29:57 +02:00
#
Use system allocator when jemalloc is unavailable
This commit adds support for systems where the jemalloc library is not
available as a package, here's the quick summary:
* On Linux - the jemalloc is usually available as a package, if
configured --without-jemalloc, the shim would be used around
malloc(), free(), realloc() and malloc_usable_size()
* On macOS - the jemalloc is available from homebrew or macports, if
configured --without-jemalloc, the shim would be used around
malloc(), free(), realloc() and malloc_size()
* On FreeBSD - the jemalloc is *the* system allocator, we just need
to check for <malloc_np.h> header to get access to non-standard API
* On NetBSD - the jemalloc is *the* system allocator, we just need to
check for <jemalloc/jemalloc.h> header to get access to non-standard
API
* On a system hostile to users and developers (read OpenBSD) - the
jemalloc API is emulated by using ((size_t *)ptr)[-1] field to hold
the size information. The OpenBSD developers care only for
themselves, so why should we care about speed on OpenBSD?
2021-05-25 12:46:00 +02:00
# [pairwise: --with-jemalloc=detect, --with-jemalloc=yes, --without-jemalloc]
AC_ARG_WITH([jemalloc],
[AS_HELP_STRING([--with-jemalloc=detect],[enable jemalloc memory allocator (default is detect)])],
[],[with_jemalloc=detect])
AS_CASE([$with_jemalloc],
[no],[],
[yes],[AX_CHECK_JEMALLOC(
[AC_DEFINE([HAVE_JEMALLOC], [1], [Define to 1 if jemalloc is available])],
[AC_MSG_ERROR([jemalloc not found])])],
[AX_CHECK_JEMALLOC(
[AC_DEFINE([HAVE_JEMALLOC], [1], [Define to 1 if jemalloc is available])
with_jemalloc=yes],
[AC_MSG_WARN([jemalloc not found; performance will be reduced])
with_jemalloc=no])])
AS_IF([test "$with_jemalloc" = "no"],
2022-09-21 17:44:48 +01:00
[AS_CASE([$host],
[*-freebsd*],[AC_MSG_ERROR([You cannot compile without jemalloc; jemalloc is the system allocator on FreeBSD])],
[*-netbsd*],[AC_MSG_ERROR([You cannot compile without jemalloc; jemalloc is the system allocator on NetBSD])])
AC_CHECK_FUNCS([malloc_size malloc_usable_size])])
2021-05-11 12:29:57 +02:00
2021-10-12 10:44:30 +02:00
AM_CONDITIONAL([HAVE_JEMALLOC], [test "$with_jemalloc" = "yes"])
2022-09-27 13:35:26 +02:00
#
# Check memory leaks in external libraries
#
# [pairwise: --enable-leak-detection, --disable-leak-detection]
AC_ARG_ENABLE([leak-detection],
[AS_HELP_STRING([--enable-leak-detection],[enable the memory leak detection in external libraries (libxml2, libuv, OpenSSL) (disabled by default)])],
[],[enable_leak_detection=no])
AS_CASE([$enable_leak_detection],
[yes],[AC_DEFINE([ENABLE_LEAK_DETECTION], [1], [Define to enable memory leak detection in external libraries])])
2014-02-18 22:36:14 -08:00
#
# was --with-tuning specified?
#
2020-07-01 10:29:36 +02:00
# [pairwise: --with-tuning=small, --without-tuning]
2020-02-03 10:50:18 +01:00
AC_ARG_WITH([tuning],
2017-11-13 11:36:45 +11:00
AS_HELP_STRING([--with-tuning=ARG],
2020-02-03 10:50:18 +01:00
[Specify server tuning (default or small)]),
[],[with_tuning=no])
2014-02-18 22:36:14 -08:00
2020-02-03 10:50:18 +01:00
AS_CASE([$with_tuning],
[small],[AC_MSG_NOTICE(using small system tuning)],
[AC_DEFINE(TUNE_LARGE, 1, [Define to use default system tuning.])
AC_MSG_NOTICE(using default system tuning)])
2014-02-18 22:36:14 -08:00
2015-02-26 16:49:27 +05:30
#
2020-05-15 16:37:44 -07:00
# was --enable-querytrace or --enable-singletrace specified?
2015-02-26 16:49:27 +05:30
#
2020-07-01 10:29:36 +02:00
# [pairwise: --enable-singletrace --enable-querytrace, --disable-singletrace --enable-querytrace, --disable-singletrace --disable-querytrace]
2020-05-15 16:37:44 -07:00
AC_ARG_ENABLE([singletrace],
AS_HELP_STRING([--enable-singletrace],
[enable single-query trace logging
[default=no]]),
enable_singletrace="$enableval", enable_singletrace="no")
AC_MSG_CHECKING([whether to enable single-query trace logging])
case "$enable_singletrace" in
yes)
enable_querytrace=yes
AC_MSG_RESULT(yes)
AC_DEFINE(WANT_SINGLETRACE, 1, [Define to enable single-query tracing.])
;;
no)
AC_MSG_RESULT(no)
;;
*)
AC_MSG_ERROR("--enable-singletrace requires yes or no")
;;
esac
2020-07-01 10:29:36 +02:00
# [pairwise: skip]
2015-02-26 16:49:27 +05:30
AC_ARG_ENABLE(querytrace,
2017-11-13 11:36:45 +11:00
AS_HELP_STRING([--enable-querytrace],
[enable very verbose query trace logging
[default=no]]),
2020-05-15 16:37:44 -07:00
enable_querytrace="$enableval",
enable_querytrace="$enable_singletrace")
2015-02-26 16:49:27 +05:30
2016-03-04 11:12:23 +05:30
AC_MSG_CHECKING([whether to enable query trace logging])
2020-04-23 14:29:07 -07:00
case "$enable_querytrace" in
2015-02-26 16:49:27 +05:30
yes)
AC_MSG_RESULT(yes)
AC_DEFINE(WANT_QUERYTRACE, 1, [Define to enable very verbose query trace logging.])
;;
no)
2020-05-15 16:37:44 -07:00
AS_IF([test "$enable_singletrace" = "yes"],
[AC_MSG_ERROR([--enable-singletrace requires --enable-querytrace])])
2015-02-26 16:49:27 +05:30
AC_MSG_RESULT(no)
;;
*)
2020-05-15 16:37:44 -07:00
AC_MSG_ERROR("--enable-querytrace requires yes or no (not $enable_querytrace)")
2015-02-26 16:49:27 +05:30
;;
esac
2018-05-16 11:58:15 -07:00
#
# Was --disable-auto-validation specified?
#
2020-07-01 10:29:36 +02:00
2018-06-06 12:02:40 +02:00
validation_default=auto
2020-07-01 10:29:36 +02:00
# [pairwise: --enable-auto-validation, --disable-auto-validation]
2018-05-16 11:58:15 -07:00
AC_ARG_ENABLE(auto-validation,
AS_HELP_STRING([--enable-auto-validation],
[turn on DNSSEC validation by default, using the IANA root key [default=yes]]),
2018-06-06 12:02:40 +02:00
[:],[enable_auto_validation=yes])
AS_IF([test "$enable_auto_validation" = "no"],[validation_default=yes])
AC_DEFINE_UNQUOTED([VALIDATION_DEFAULT], ["$validation_default"], [the default value of dnssec-validation option])
2018-05-16 11:58:15 -07:00
2018-08-21 14:35:57 +02:00
#
2018-08-25 13:15:06 +02:00
#
# Response policy rewriting using DNS Response Policy Service (DNSRPS)
# interface.
#
# DNSRPS can be compiled into BIND everywhere with a reasonably
# modern C compiler. It is enabled on systems with dlopen() and librpz.so.
#
dnsrps_avail=yes
AC_MSG_CHECKING([for librpz __attribute__s])
AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM(
[[]],
[[
extern void f(char *p __attribute__((unused)), ...)
__attribute__((format(printf,1,2))) __attribute__((__noreturn__));
]])],
[
librpz_have_attr=yes
AC_DEFINE([LIBRPZ_HAVE_ATTR], [1], [have __attribute__s used in librpz.h])
AC_MSG_RESULT([yes])
],[
librpz_have_attr=no
AC_MSG_RESULT([no])
])
2020-07-01 10:29:36 +02:00
# DNSRPS is not included in pairwise testing as the librpz library is not
# present in the relevant Docker image.
#
# [pairwise: skip]
2018-08-25 13:15:06 +02:00
AC_ARG_ENABLE([dnsrps-dl],
[AS_HELP_STRING([--enable-dnsrps-dl],
[DNS Response Policy Service delayed link
[default=$librpz_dl]])],
[enable_librpz_dl="$enableval"], [enable_librpz_dl="$with_dlopen"])
AS_IF([test "$enable_librpz_dl" = "yes" -a "$with_dlopen" = "no"],
[AC_MSG_ERROR([DNS Response Policy Service delayed link requires dlopen to be enabled])])
2020-07-01 10:29:36 +02:00
# [pairwise: skip]
2018-08-25 13:15:06 +02:00
AC_ARG_WITH([dnsrps-libname],
[AS_HELP_STRING([--with-dnsrps-libname],
[DNSRPS provider library name (librpz.so)])],
[librpz_name="$withval"], [librpz_name="librpz.so"])
2020-07-01 10:29:36 +02:00
# [pairwise: skip]
2018-08-25 13:15:06 +02:00
AC_ARG_WITH([dnsrps-dir],
[AS_HELP_STRING([--with-dnsrps-dir],
[path to DNSRPS provider library])],
[librpz_path="$withval/$librpz_name"], [librpz_path="$librpz_name"])
AC_DEFINE_UNQUOTED([DNSRPS_LIBRPZ_PATH], ["$librpz_path"],
[dnsrps $librpz_name])
AS_IF([test "$enable_librpz_dl" = "yes"],
[
dnsrps_lib_open=2
],[
dnsrps_lib_open=1
# Add librpz.so to linked libraries if we are not using dlopen()
AC_SEARCH_LIBS([librpz_client_create], [rpz], [],
[dnsrps_lib_open=0
dnsrps_avail=no])
])
AC_DEFINE_UNQUOTED([DNSRPS_LIB_OPEN], [$dnsrps_lib_open],
[0=no DNSRPS 1=static link 2=dlopen()])
2020-07-01 10:29:36 +02:00
# [pairwise: skip]
2018-08-25 13:15:06 +02:00
AC_ARG_ENABLE([dnsrps],
AS_HELP_STRING([--enable-dnsrps],
[enable DNS Response Policy Service API]),
[enable_dnsrps=$enableval], [enable_dnsrps=no])
AS_IF([test "$enable_dnsrps" != "no"],[
AS_IF([test "$dnsrps_avail" != "yes"],
[AC_MSG_ERROR([dlopen and librpz.so needed for DNSRPS])])
AS_IF([test "$dnsrps_lib_open" = "0"],
[AC_MSG_ERROR([dlopen and librpz.so needed for DNSRPS])])
AC_DEFINE([USE_DNSRPS], [1], [Enable DNS Response Policy Service API])
])
2018-08-07 16:46:53 +02:00
AC_CHECK_HEADERS([glob.h])
2005-09-05 00:12:29 +00:00
2021-02-09 17:44:40 +01:00
#
# Support for constructor and destructor attributes
#
AX_GCC_FUNC_ATTRIBUTE([constructor])
AX_GCC_FUNC_ATTRIBUTE([destructor])
2018-08-07 16:46:53 +02:00
#
# Files to configure. These are listed here because we used to
# specify them as arguments to AC_OUTPUT.
#
2005-09-05 00:12:29 +00:00
2018-08-07 16:46:53 +02:00
# Top
2019-10-23 16:25:06 -03:00
2018-08-07 16:46:53 +02:00
AC_CONFIG_FILES([Makefile])
2006-01-05 00:30:34 +00:00
2018-08-07 16:46:53 +02:00
# Binaries
2006-12-04 01:54:53 +00:00
2018-08-07 16:46:53 +02:00
AC_CONFIG_FILES([bin/Makefile
bin/named/Makefile
bin/rndc/Makefile
bin/dig/Makefile
bin/delv/Makefile
bin/dnssec/Makefile
bin/tools/Makefile
bin/nsupdate/Makefile
bin/check/Makefile
bin/confgen/Makefile
bin/plugins/Makefile])
2005-09-05 00:12:29 +00:00
2018-08-07 16:46:53 +02:00
# Libraries
2005-05-11 05:55:41 +00:00
2018-08-07 16:46:53 +02:00
AC_CONFIG_FILES([lib/Makefile
lib/isc/Makefile
lib/dns/Makefile
lib/ns/Makefile
lib/irs/Makefile
lib/isccfg/Makefile
lib/isccc/Makefile
2021-03-22 18:40:21 -07:00
lib/bind9/Makefile])
2005-05-11 05:55:41 +00:00
2019-03-31 12:49:47 +02:00
# Documentation
AC_CONFIG_FILES([doc/Makefile
doc/arm/Makefile
doc/man/Makefile
doc/misc/Makefile])
2022-06-25 15:29:54 +01:00
# Unit tests and benchmarks
2018-08-07 16:46:53 +02:00
2022-05-03 11:37:31 +02:00
AC_CONFIG_FILES([tests/Makefile
2022-06-25 15:29:54 +01:00
tests/bench/Makefile
2022-05-03 11:37:31 +02:00
tests/isc/Makefile
tests/dns/Makefile
tests/ns/Makefile
tests/irs/Makefile
2022-05-03 19:43:23 -07:00
tests/isccfg/Makefile
tests/libtest/Makefile])
2022-05-03 11:37:31 +02:00
AC_CONFIG_FILES([tests/unit-test-driver.sh],
[chmod +x tests/unit-test-driver.sh])
2020-04-03 11:26:02 +02:00
2018-08-07 16:46:53 +02:00
# System Tests
AC_CONFIG_FILES([bin/tests/Makefile
bin/tests/system/Makefile
bin/tests/system/conf.sh
bin/tests/system/dyndb/driver/Makefile
2020-11-19 17:58:45 -08:00
bin/tests/system/dlzexternal/driver/Makefile
bin/tests/system/hooks/driver/Makefile])
2018-08-07 16:46:53 +02:00
AC_CONFIG_FILES([bin/tests/system/ifconfig.sh],
[chmod +x bin/tests/system/ifconfig.sh])
AC_CONFIG_FILES([bin/tests/system/run.sh],
[chmod +x bin/tests/system/run.sh])
AC_CONFIG_FILES([bin/tests/system/start.sh],
[chmod +x bin/tests/system/start.sh])
AC_CONFIG_FILES([bin/tests/system/stop.sh],
[chmod +x bin/tests/system/stop.sh])
2020-07-31 15:20:56 +02:00
# Fuzz Tests
AC_CONFIG_FILES([fuzz/Makefile])
2018-08-07 16:46:53 +02:00
# Misc
AC_CONFIG_FILES([util/check-make-install])
2005-09-05 00:12:29 +00:00
#
# Do it
#
AC_OUTPUT
2000-07-04 01:20:53 +00:00
2020-07-01 10:29:36 +02:00
# [pairwise: --enable-full-report, --disable-full-report]
2013-07-10 20:54:08 -07:00
AC_ARG_ENABLE(full-report,
2017-11-13 11:36:45 +11:00
AS_HELP_STRING([--enable-full-report],
[report values of all configure options]))
2013-07-10 20:54:08 -07:00
2017-04-20 15:09:28 -07:00
report() {
echo "==============================================================================="
echo "Configuration summary:"
echo "-------------------------------------------------------------------------------"
echo "Optional features enabled:"
Use system allocator when jemalloc is unavailable
This commit adds support for systems where the jemalloc library is not
available as a package, here's the quick summary:
* On Linux - the jemalloc is usually available as a package, if
configured --without-jemalloc, the shim would be used around
malloc(), free(), realloc() and malloc_usable_size()
* On macOS - the jemalloc is available from homebrew or macports, if
configured --without-jemalloc, the shim would be used around
malloc(), free(), realloc() and malloc_size()
* On FreeBSD - the jemalloc is *the* system allocator, we just need
to check for <malloc_np.h> header to get access to non-standard API
* On NetBSD - the jemalloc is *the* system allocator, we just need to
check for <jemalloc/jemalloc.h> header to get access to non-standard
API
* On a system hostile to users and developers (read OpenBSD) - the
jemalloc API is emulated by using ((size_t *)ptr)[-1] field to hold
the size information. The OpenBSD developers care only for
themselves, so why should we care about speed on OpenBSD?
2021-05-25 12:46:00 +02:00
if test "yes" = "$with_jemalloc"; then
echo " Memory allocator: jemalloc"
fi
2020-02-19 00:17:03 -08:00
if test "yes" = "$enable_full_report" -o "standard" = "$with_locktype"; then
echo " Mutex lock type: $with_locktype"
2017-04-20 15:09:28 -07:00
fi
2020-02-21 12:51:49 +01:00
test "small" = "$with_tuning" && echo " Small-system tuning (--with-tuning)"
2020-04-23 14:29:07 -07:00
test "no" = "$enable_dnstap" || \
2017-11-13 11:36:45 +11:00
echo " Allow 'dnstap' packet logging (--enable-dnstap)"
2019-06-27 21:19:30 -07:00
test -z "$MAXMINDDB_LIBS" || echo " GeoIP2 access control (--enable-geoip)"
2020-04-23 14:29:07 -07:00
test -z "$GSSAPI_LIBS" || echo " GSS-API (--with-gssapi)"
2014-01-18 11:51:07 -08:00
2018-08-21 14:35:57 +02:00
# these lines are only printed if run with --enable-full-report
2017-04-20 15:09:28 -07:00
if test "yes" = "$enable_full_report"; then
2020-04-23 14:29:07 -07:00
test -z "$LIBXML2_LIBS" || echo " XML statistics (--with-libxml2)"
test -z "$JSON_C_LIBS" || echo " JSON statistics (--with-json-c): $JSON_C_CFLAGS $JSON_C_LIBS"
test -z "$ZLIB_LIBS" || echo " HTTP zlib compression (--with-zlib)"
test -z "$LMDB_LIBS" || echo " LMDB database to store configuration for 'addzone' zones (--with-lmdb)"
test -z "$LIBIDN2_LIBS" || echo " IDN support (--with-libidn2)"
2017-04-20 15:09:28 -07:00
fi
2014-01-18 11:51:07 -08:00
2017-09-11 11:53:42 -07:00
test "yes" = "$enable_dnsrps" && \
2017-11-13 11:36:45 +11:00
echo " DNS Response Policy Service interface (--enable-dnsrps)"
2020-04-23 14:29:07 -07:00
test "yes" = "$enable_fixed_rrset" && \
2017-11-13 11:36:45 +11:00
echo " Allow 'fixed' rrset-order (--enable-fixed-rrset)"
2020-04-23 14:29:07 -07:00
test "yes" = "$enable_querytrace" && \
2017-11-13 11:36:45 +11:00
echo " Very verbose query trace logging (--enable-querytrace)"
2020-05-15 16:37:44 -07:00
test "yes" = "$enable_singletrace" && \
echo " Single-query trace logging (--enable-singletrace)"
2020-04-23 14:29:07 -07:00
test -z "$HAVE_CMOCKA" || echo " CMocka Unit Testing Framework (--with-cmocka)"
2017-04-20 15:09:28 -07:00
2019-04-04 10:43:33 -07:00
test "auto" = "$validation_default" && echo " DNSSEC validation active by default (--enable-auto-validation)"
2018-06-22 13:47:45 +02:00
2017-09-30 10:01:01 -07:00
echo "-------------------------------------------------------------------------------"
2017-04-20 15:09:28 -07:00
echo "Features disabled or unavailable on this platform:"
Use system allocator when jemalloc is unavailable
This commit adds support for systems where the jemalloc library is not
available as a package, here's the quick summary:
* On Linux - the jemalloc is usually available as a package, if
configured --without-jemalloc, the shim would be used around
malloc(), free(), realloc() and malloc_usable_size()
* On macOS - the jemalloc is available from homebrew or macports, if
configured --without-jemalloc, the shim would be used around
malloc(), free(), realloc() and malloc_size()
* On FreeBSD - the jemalloc is *the* system allocator, we just need
to check for <malloc_np.h> header to get access to non-standard API
* On NetBSD - the jemalloc is *the* system allocator, we just need to
check for <jemalloc/jemalloc.h> header to get access to non-standard
API
* On a system hostile to users and developers (read OpenBSD) - the
jemalloc API is emulated by using ((size_t *)ptr)[-1] field to hold
the size information. The OpenBSD developers care only for
themselves, so why should we care about speed on OpenBSD?
2021-05-25 12:46:00 +02:00
if test "no" = "$with_jemalloc"; then
echo " Memory allocator: system"
2021-08-10 12:20:52 +02:00
echo
echo " +------------------------------------------+"
echo " | ==== WARNING ==== |"
echo " | |"
echo " | This is NOT a recommended configuration. |"
echo " | Using the system memory allocator causes |"
echo " | reduced performance and increased memory |"
echo " | fragmentation. Installing the jemalloc |"
echo " | memory allocator (version >= 4.0.0) is |"
echo " | strongly recommended. |"
echo " +------------------------------------------+"
echo
Use system allocator when jemalloc is unavailable
This commit adds support for systems where the jemalloc library is not
available as a package, here's the quick summary:
* On Linux - the jemalloc is usually available as a package, if
configured --without-jemalloc, the shim would be used around
malloc(), free(), realloc() and malloc_usable_size()
* On macOS - the jemalloc is available from homebrew or macports, if
configured --without-jemalloc, the shim would be used around
malloc(), free(), realloc() and malloc_size()
* On FreeBSD - the jemalloc is *the* system allocator, we just need
to check for <malloc_np.h> header to get access to non-standard API
* On NetBSD - the jemalloc is *the* system allocator, we just need to
check for <jemalloc/jemalloc.h> header to get access to non-standard
API
* On a system hostile to users and developers (read OpenBSD) - the
jemalloc API is emulated by using ((size_t *)ptr)[-1] field to hold
the size information. The OpenBSD developers care only for
themselves, so why should we care about speed on OpenBSD?
2021-05-25 12:46:00 +02:00
fi
2020-02-21 12:51:49 +01:00
test "small" = "$with_tuning" || echo " Small-system tuning (--with-tuning)"
2017-04-20 15:09:28 -07:00
2020-04-23 14:29:07 -07:00
test "no" = "$enable_dnstap" && \
2017-11-13 11:36:45 +11:00
echo " Allow 'dnstap' packet logging (--enable-dnstap)"
2019-06-27 21:19:30 -07:00
test -z "$MAXMINDDB_LIBS" && echo " GeoIP2 access control (--enable-geoip)"
2020-04-23 14:29:07 -07:00
test -z "$GSSAPI_LIBS" && echo " GSS-API (--with-gssapi)"
2017-04-20 15:09:28 -07:00
2017-09-11 11:53:42 -07:00
test "no" = "$enable_dnsrps" && \
2017-11-13 11:36:45 +11:00
echo " DNS Response Policy Service interface (--enable-dnsrps)"
2017-09-11 11:53:42 -07:00
2020-04-23 14:29:07 -07:00
test "yes" = "$enable_fixed_rrset" || \
2017-11-13 11:36:45 +11:00
echo " Allow 'fixed' rrset-order (--enable-fixed-rrset)"
2017-04-20 15:09:28 -07:00
2020-04-23 14:29:07 -07:00
test "yes" = "$validation_default" && echo " DNSSEC validation requires configuration (--enable-auto-validation)"
2018-05-16 11:58:15 -07:00
2020-04-23 14:29:07 -07:00
test "yes" = "$enable_querytrace" || \
2017-11-13 11:36:45 +11:00
echo " Very verbose query trace logging (--enable-querytrace)"
2020-05-15 16:37:44 -07:00
test "yes" = "$enable_singletrace" || \
echo " Single-query trace logging (--enable-singletrace)"
2017-04-20 15:09:28 -07:00
2019-02-06 12:08:34 +01:00
test "no" = "$with_cmocka" && echo " CMocka Unit Testing Framework (--with-cmocka)"
2017-04-20 15:09:28 -07:00
2020-04-23 14:29:07 -07:00
test -z "$LIBXML2_LIBS" && echo " XML statistics (--with-libxml2)"
test -z "$JSON_C_LIBS" && echo " JSON statistics (--with-json-c)"
test -z "$ZLIB_LIBS" && echo " HTTP zlib compression (--with-zlib)"
test -z "$LMDB_LIBS" && echo " LMDB database to store configuration for 'addzone' zones (--with-lmdb)"
test -z "$LIBIDN2_LIBS" && echo " IDN support (--with-libidn2)"
2017-04-20 15:09:28 -07:00
2017-09-30 10:01:01 -07:00
echo "-------------------------------------------------------------------------------"
echo "Configured paths:"
echo " prefix: $prefix"
echo " sysconfdir: $sysconfdir"
echo " localstatedir: $localstatedir"
2018-09-07 10:59:04 -07:00
echo "-------------------------------------------------------------------------------"
echo "Compiler: $CC"
2021-10-11 21:18:49 +02:00
AS_IF([test "$GCC" = "yes"],
[$CC --version 2>&1 | sed 's/^/ /'],
[AS_CASE([$host],
[*-solaris*],[$CC -V 2>&1 | sed 's/^/ /'],
[$CC --version 2>&1 | sed 's/^/ /'])])
2018-08-07 16:46:53 +02:00
echo "CFLAGS: $STD_CFLAGS $CFLAGS"
echo "CPPFLAGS: $STD_CPPFLAGS $CPPFLAGS"
echo "LDFLAGS: $LDFLAGS"
2017-09-30 10:01:01 -07:00
2017-04-20 15:09:28 -07:00
if test "X$ac_unrecognized_opts" != "X"; then
2020-05-15 16:37:44 -07:00
echo "-------------------------------------------------------------------------------"
2017-11-13 11:36:45 +11:00
echo "Unrecognized options:"
echo " $ac_unrecognized_opts"
2017-04-20 15:09:28 -07:00
fi
2017-09-30 10:01:01 -07:00
2017-07-19 15:53:01 +10:00
if test "yes" != "$enable_full_report"; then
2017-11-13 11:36:45 +11:00
echo "-------------------------------------------------------------------------------"
echo "For more detail, use --enable-full-report."
2017-04-20 15:09:28 -07:00
fi
echo "==============================================================================="
}
2017-07-19 15:53:01 +10:00
if test "yes" != "$silent"; then
2017-11-13 11:36:45 +11:00
report
2015-12-02 14:02:53 -08:00
fi
2013-07-10 20:54:08 -07:00
2000-07-04 01:20:53 +00:00
# Tell Emacs to edit this file in shell mode.
# Local Variables:
# mode: sh
# End: