2007-01-03 03:53:52 -05:00
# -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.
2021-01-05 04:27:13 -05:00
AC_PREREQ([2.56])
2009-03-23 10:59:58 -04:00
sinclude(acx_nlnetlabs.m4)
2013-05-27 04:22:40 -04:00
sinclude(ax_pthread.m4)
2009-03-25 10:47:47 -04:00
sinclude(acx_python.m4)
2024-04-15 05:30:19 -04:00
sinclude(ax_pkg_swig.m4)
2014-08-05 03:57:52 -04:00
sinclude(dnstap/dnstap.m4)
2017-03-20 10:55:31 -04:00
sinclude(dnscrypt/dnscrypt.m4)
2007-01-03 03:53:52 -05:00
2013-03-22 08:41:13 -04:00
# must be numbers. ac_defun because of later processing
m4_define([VERSION_MAJOR],[1])
2024-10-03 12:19:01 -04:00
m4_define([VERSION_MINOR],[22])
m4_define([VERSION_MICRO],[0])
2021-01-05 04:27:13 -05:00
AC_INIT([unbound],m4_defn([VERSION_MAJOR]).m4_defn([VERSION_MINOR]).m4_defn([VERSION_MICRO]),[unbound-bugs@nlnetlabs.nl or https://github.com/NLnetLabs/unbound/issues],[unbound])
2013-03-22 08:41:13 -04:00
AC_SUBST(UNBOUND_VERSION_MAJOR, [VERSION_MAJOR])
AC_SUBST(UNBOUND_VERSION_MINOR, [VERSION_MINOR])
AC_SUBST(UNBOUND_VERSION_MICRO, [VERSION_MICRO])
2007-01-03 03:53:52 -05:00
2019-01-28 03:26:10 -05:00
LIBUNBOUND_CURRENT=9
2024-10-03 12:19:01 -04:00
LIBUNBOUND_REVISION=30
2019-01-28 03:26:10 -05:00
LIBUNBOUND_AGE=1
2008-05-14 03:34:02 -04:00
# 1.0.0 had 0:12:0
2008-05-16 10:42:00 -04:00
# 1.0.1 had 0:13:0
2008-07-16 09:16:36 -04:00
# 1.0.2 had 0:14:0
2008-08-29 03:48:40 -04:00
# 1.1.0 had 0:15:0
2008-11-14 01:30:34 -05:00
# 1.1.1 had 0:16:0
2009-01-07 07:24:34 -05:00
# 1.2.0 had 0:17:0
2009-01-09 05:49:47 -05:00
# 1.2.1 had 0:18:0
2009-03-02 03:21:19 -05:00
# 1.3.0 had 1:0:0 # ub_cancel and -export-symbols.
2009-06-08 09:47:06 -04:00
# 1.3.1 had 1:1:0
2009-07-09 05:08:08 -04:00
# 1.3.2 had 1:2:0
2009-07-13 09:28:12 -04:00
# 1.3.3 had 1:3:0
2009-08-05 11:55:58 -04:00
# 1.3.4 had 1:4:0
2009-10-08 13:05:53 -04:00
# 1.4.0-snapshots had 1:5:0
2009-11-26 09:28:40 -05:00
# 1.4.0 had 1:5:0 (not 2:0:0) # ub_result.why_bogus
# 1.4.1 had 2:1:0
2009-12-17 04:37:29 -05:00
# 1.4.2 had 2:2:0
2010-03-09 04:40:48 -05:00
# 1.4.3 had 2:3:0
2010-03-11 09:29:32 -05:00
# 1.4.4 had 2:4:0
2010-04-22 05:02:30 -04:00
# 1.4.5 had 2:5:0
2010-06-15 03:45:55 -04:00
# 1.4.6 had 2:6:0
2010-08-03 08:30:45 -04:00
# 1.4.7 had 2:7:0
2010-11-08 08:22:54 -05:00
# 1.4.8 had 2:8:0
2011-01-24 09:59:33 -05:00
# 1.4.9 had 2:9:0
2011-05-25 02:09:01 -04:00
# 1.4.10 had 2:10:0
2011-06-16 09:27:57 -04:00
# 1.4.11 had 2:11:0
2011-06-30 04:56:56 -04:00
# 1.4.12 had 2:12:0
2011-07-14 04:33:12 -04:00
# 1.4.13 had 2:13:0
2011-12-19 06:37:15 -05:00
# and 1.4.13p1 and 1.4.13.p2
2011-09-15 04:54:25 -04:00
# 1.4.14 had 2:14:0
2012-01-12 08:52:38 -05:00
# 1.4.15 had 3:0:1 # adds ub_version()
2012-01-26 04:04:28 -05:00
# 1.4.16 had 3:1:1
2012-02-02 04:21:11 -05:00
# 1.4.17 had 3:2:1
2012-05-24 05:00:26 -04:00
# 1.4.18 had 3:3:1
2012-08-02 03:57:33 -04:00
# 1.4.19 had 3:4:1
2013-03-21 08:24:42 -04:00
# 1.4.20 had 4:0:2 # adds libunbound.ttl # but shipped 3:5:1
# 1.4.21 had 4:1:2
2014-03-12 10:25:21 -04:00
# 1.4.22 had 4:1:2
2014-11-11 08:23:50 -05:00
# 1.5.0 had 5:3:3 # adds ub_ctx_add_ta_autr
2014-12-09 03:24:27 -05:00
# 1.5.1 had 5:3:3
# 1.5.2 had 5:5:3
2015-02-19 10:16:40 -05:00
# 1.5.3 had 5:6:3
2015-03-10 06:03:45 -04:00
# 1.5.4 had 5:7:3
2015-09-28 09:50:36 -04:00
# 1.5.5 had 5:8:3
2015-10-06 05:57:08 -04:00
# 1.5.6 had 5:9:3
2015-10-20 10:01:54 -04:00
# 1.5.7 had 5:10:3
2016-02-23 05:43:10 -05:00
# 1.5.8 had 6:0:4 # adds ub_ctx_set_stub
2016-03-02 03:15:05 -05:00
# 1.5.9 had 6:1:4
2016-06-09 08:18:43 -04:00
# 1.5.10 had 6:2:4
2016-11-29 08:33:09 -05:00
# 1.6.0 had 6:3:4
2017-01-19 04:08:15 -05:00
# 1.6.1 had 7:0:5 # ub_callback_t typedef renamed to ub_callback_type
2017-02-21 09:06:48 -05:00
# 1.6.2 had 7:1:5
2017-04-24 08:30:55 -04:00
# 1.6.3 had 7:2:5
2017-06-13 10:25:47 -04:00
# 1.6.4 had 7:3:5
2017-06-27 06:53:52 -04:00
# 1.6.5 had 7:4:5
2017-08-21 04:58:55 -04:00
# 1.6.6 had 7:5:5
2017-09-18 03:49:41 -04:00
# 1.6.7 had 7:6:5
2017-10-10 03:38:56 -04:00
# 1.6.8 had 7:7:5
2018-03-06 04:07:22 -05:00
# 1.7.0 had 7:8:5
2018-03-15 06:19:14 -04:00
# 1.7.1 had 7:9:5
2018-05-03 03:59:09 -04:00
# 1.7.2 had 7:10:5
2018-06-11 06:05:03 -04:00
# 1.7.3 had 7:11:5
2018-09-10 08:32:28 -04:00
# 1.8.0 had 8:0:0 # changes the event callback function signature
# 1.8.1 had 8:1:0
2018-10-08 08:09:44 -04:00
# 1.8.2 had 8:2:0
2018-12-04 04:30:03 -05:00
# 1.8.3 had 8:3:0
2019-02-05 04:26:39 -05:00
# 1.9.0 had 9:0:1 # add ub_ctx_set_tls
# 1.9.1 had 9:1:1
2019-03-12 05:33:18 -04:00
# 1.9.2 had 9:2:1
2019-06-17 05:42:19 -04:00
# 1.9.3 had 9:3:1
2019-08-27 03:56:20 -04:00
# 1.9.4 had 9:4:1
2019-10-03 05:40:13 -04:00
# 1.9.5 had 9:5:1
2019-11-19 04:06:12 -05:00
# 1.9.6 had 9:6:1
2020-02-12 06:51:35 -05:00
# 1.10.0 had 9:7:1
2020-02-20 08:42:58 -05:00
# 1.10.1 had 9:8:1
2020-07-20 07:02:09 -04:00
# 1.11.0 had 9:9:1
2020-10-01 03:11:22 -04:00
# 1.12.0 had 9:10:1
2020-11-24 02:28:08 -05:00
# 1.13.0 had 9:11:1
2020-12-03 04:14:14 -05:00
# 1.13.1 had 9:12:1
2021-02-09 03:16:23 -05:00
# 1.13.2 had 9:13:1
2021-12-01 04:08:54 -05:00
# 1.14.0 had 9:14:1
2022-02-02 07:09:51 -05:00
# 1.15.0 had 9:15:1
2022-05-27 10:09:28 -04:00
# 1.16.0 had 9:16:1
2022-06-02 07:56:52 -04:00
# 1.16.1 had 9:17:1
2022-07-11 05:34:54 -04:00
# 1.16.2 had 9:18:1
2022-08-01 09:17:10 -04:00
# 1.16.3 had 9:19:1
2022-09-21 06:16:13 -04:00
# 1.17.0 had 9:20:1
2022-10-13 03:34:44 -04:00
# 1.17.1 had 9:21:1
2023-08-22 08:32:51 -04:00
# 1.18.0 had 9:22:1
2023-11-02 03:40:20 -04:00
# 1.19.0 had 9:23:1
2023-11-08 04:59:25 -05:00
# 1.19.1 had 9:24:1
2024-02-13 08:03:30 -05:00
# 1.19.2 had 9:25:1
2024-03-07 05:06:42 -05:00
# 1.19.3 had 9:26:1
2024-05-01 04:15:12 -04:00
# 1.20.0 had 9:27:1
2024-08-08 03:30:53 -04:00
# 1.21.0 had 9:28:1
2024-08-15 05:01:41 -04:00
# 1.21.1 had 9:29:1
2024-10-03 12:19:01 -04:00
# 1.22.0 had 9:30:1
2008-05-14 03:34:02 -04:00
# Current -- the number of the binary API that we're implementing
# Revision -- which iteration of the implementation of the binary
# API are we supplying?
# Age -- How many previous binary API versions do we also
# support?
#
# If we release a new version that does not change the binary API,
# increment Revision.
#
# If we release a new version that changes the binary API, but does
# not break programs compiled against the old binary API, increment
# Current and Age. Set Revision to 0, since this is the first
# implementation of the new API.
#
2017-09-15 10:29:28 -04:00
# Otherwise, we're changing the binary API and breaking backward
2008-05-14 03:34:02 -04:00
# compatibility with old binaries. Increment Current. Set Age to 0,
# since we're backward compatible with no previous APIs. Set Revision
# to 0 too.
AC_SUBST(LIBUNBOUND_CURRENT)
AC_SUBST(LIBUNBOUND_REVISION)
AC_SUBST(LIBUNBOUND_AGE)
2019-08-15 09:05:02 -04:00
cmdln="`echo $@ | sed -e 's/\\\\/\\\\\\\\/g' | sed -e 's/"/\\\\"/'g`"
AC_DEFINE_UNQUOTED(CONFCMDLINE, ["$cmdln"], [Command line arguments used with configure])
2019-08-12 11:52:43 -04:00
2008-10-22 03:40:37 -04:00
CFLAGS="$CFLAGS"
2021-01-05 04:27:13 -05:00
AC_USE_SYSTEM_EXTENSIONS
2014-02-14 04:23:32 -05:00
if test "$ac_cv_header_minix_config_h" = "yes"; then
AC_DEFINE(_NETBSD_SOURCE,1, [Enable for compile on Minix])
fi
2007-01-03 03:53:52 -05:00
2007-11-09 08:52:13 -05:00
dnl
2008-03-04 09:25:53 -05:00
dnl By default set prefix to /usr/local
2007-11-09 08:52:13 -05:00
dnl
case "$prefix" in
NONE)
2008-03-04 09:25:53 -05:00
prefix="/usr/local"
2007-11-09 08:52:13 -05:00
;;
esac
2017-05-17 11:04:05 -04:00
case "$exec_prefix" in
NONE)
2017-05-26 06:47:18 -04:00
exec_prefix="$prefix"
2017-05-17 11:04:05 -04:00
;;
esac
2007-11-09 08:52:13 -05:00
2009-03-19 10:24:19 -04:00
# are we on MinGW?
2021-05-17 02:43:46 -04:00
if uname -s 2>&1 | grep MINGW >/dev/null; then on_mingw="yes"
2023-04-20 11:39:55 -04:00
else
2021-06-14 10:15:21 -04:00
if echo $host | grep mingw >/dev/null; then on_mingw="yes"
2009-07-14 10:44:53 -04:00
else on_mingw="no"; fi
fi
2009-03-19 10:24:19 -04:00
2007-11-09 08:52:13 -05:00
#
# Determine configuration file
2008-06-09 10:59:29 -04:00
# the eval is to evaluate shell expansion twice
2017-05-17 11:04:05 -04:00
UNBOUND_SBIN_DIR=`eval echo "${sbindir}"`
AC_SUBST(UNBOUND_SBIN_DIR)
UNBOUND_SYSCONF_DIR=`eval echo "${sysconfdir}"`
AC_SUBST(UNBOUND_SYSCONF_DIR)
UNBOUND_LOCALSTATE_DIR=`eval echo "${localstatedir}"`
AC_SUBST(UNBOUND_LOCALSTATE_DIR)
2009-03-19 10:24:19 -04:00
if test $on_mingw = "no"; then
ub_conf_file=`eval echo "${sysconfdir}/unbound/unbound.conf"`
else
2017-02-22 02:31:32 -05:00
ub_conf_file="C:\\Program Files\\Unbound\\service.conf"
2009-03-19 10:24:19 -04:00
fi
2007-11-09 08:52:13 -05:00
AC_ARG_WITH([conf_file],
2021-01-05 04:27:13 -05:00
AS_HELP_STRING([--with-conf-file=path],[Pathname to the Unbound configuration file]),
2008-06-09 10:59:29 -04:00
[ub_conf_file="$withval"])
2007-11-09 08:52:13 -05:00
AC_SUBST(ub_conf_file)
2009-03-23 10:59:58 -04:00
ACX_ESCAPE_BACKSLASH($ub_conf_file, hdr_config)
2009-02-26 11:17:46 -05:00
AC_DEFINE_UNQUOTED(CONFIGFILE, ["$hdr_config"], [Pathname to the Unbound configuration file])
2015-01-05 08:20:04 -05:00
ub_conf_dir=`AS_DIRNAME(["$ub_conf_file"])`
AC_SUBST(ub_conf_dir)
2007-11-09 08:52:13 -05:00
2008-02-15 09:13:09 -05:00
# Determine run, chroot directory and pidfile locations
2023-04-20 11:39:55 -04:00
AC_ARG_WITH(run-dir,
AS_HELP_STRING([--with-run-dir=path],[set default directory to chdir to (by default dir part of cfg file)]),
UNBOUND_RUN_DIR="$withval",
2009-03-19 10:24:19 -04:00
if test $on_mingw = no; then
UNBOUND_RUN_DIR=`dirname "$ub_conf_file"`
else
UNBOUND_RUN_DIR=""
fi
)
2008-06-09 10:59:29 -04:00
AC_SUBST(UNBOUND_RUN_DIR)
2009-03-23 10:59:58 -04:00
ACX_ESCAPE_BACKSLASH($UNBOUND_RUN_DIR, hdr_run)
2009-02-26 11:17:46 -05:00
AC_DEFINE_UNQUOTED(RUN_DIR, ["$hdr_run"], [Directory to chdir to])
2008-06-09 10:59:29 -04:00
2023-04-20 11:39:55 -04:00
AC_ARG_WITH(chroot-dir,
AS_HELP_STRING([--with-chroot-dir=path],[set default directory to chroot to (by default same as run-dir)]),
UNBOUND_CHROOT_DIR="$withval",
2009-03-19 10:24:19 -04:00
if test $on_mingw = no; then
UNBOUND_CHROOT_DIR="$UNBOUND_RUN_DIR"
else
UNBOUND_CHROOT_DIR=""
fi
)
2008-06-09 10:59:29 -04:00
AC_SUBST(UNBOUND_CHROOT_DIR)
2012-04-05 05:10:56 -04:00
ACX_ESCAPE_BACKSLASH($UNBOUND_CHROOT_DIR, hdr_chroot)
2009-02-26 11:17:46 -05:00
AC_DEFINE_UNQUOTED(CHROOT_DIR, ["$hdr_chroot"], [Directory to chroot to])
2008-06-09 10:59:29 -04:00
2009-03-25 10:47:47 -04:00
AC_ARG_WITH(share-dir,
2021-01-05 04:27:13 -05:00
AS_HELP_STRING([--with-share-dir=path],[set default directory with shared data (by default same as share/unbound)]),
2009-03-25 10:47:47 -04:00
UNBOUND_SHARE_DIR="$withval",
UNBOUND_SHARE_DIR="$UNBOUND_RUN_DIR")
AC_SUBST(UNBOUND_SHARE_DIR)
AC_DEFINE_UNQUOTED(SHARE_DIR, ["$UNBOUND_SHARE_DIR"], [Shared data])
2023-04-20 11:39:55 -04:00
AC_ARG_WITH(pidfile,
AS_HELP_STRING([--with-pidfile=filename],[set default pathname to unbound pidfile (default run-dir/unbound.pid)]),
UNBOUND_PIDFILE="$withval",
2009-03-19 10:24:19 -04:00
if test $on_mingw = no; then
UNBOUND_PIDFILE="$UNBOUND_RUN_DIR/unbound.pid"
else
UNBOUND_PIDFILE=""
fi
)
2008-06-09 10:59:29 -04:00
AC_SUBST(UNBOUND_PIDFILE)
2009-03-23 10:59:58 -04:00
ACX_ESCAPE_BACKSLASH($UNBOUND_PIDFILE, hdr_pid)
2009-02-26 11:17:46 -05:00
AC_DEFINE_UNQUOTED(PIDFILE, ["$hdr_pid"], [default pidfile location])
2008-02-15 09:13:09 -05:00
2023-04-20 11:39:55 -04:00
AC_ARG_WITH(rootkey-file,
AS_HELP_STRING([--with-rootkey-file=filename],[set default pathname to root key file (default run-dir/root.key). This file is read and written.]),
UNBOUND_ROOTKEY_FILE="$withval",
2010-09-28 06:27:49 -04:00
if test $on_mingw = no; then
UNBOUND_ROOTKEY_FILE="$UNBOUND_RUN_DIR/root.key"
else
2017-02-22 02:31:32 -05:00
UNBOUND_ROOTKEY_FILE="C:\\Program Files\\Unbound\\root.key"
2010-09-28 06:27:49 -04:00
fi
)
AC_SUBST(UNBOUND_ROOTKEY_FILE)
ACX_ESCAPE_BACKSLASH($UNBOUND_ROOTKEY_FILE, hdr_rkey)
AC_DEFINE_UNQUOTED(ROOT_ANCHOR_FILE, ["$hdr_rkey"], [default rootkey location])
2023-04-20 11:39:55 -04:00
AC_ARG_WITH(rootcert-file,
AS_HELP_STRING([--with-rootcert-file=filename],[set default pathname to root update certificate file (default run-dir/icannbundle.pem). This file need not exist if you are content with the builtin.]),
UNBOUND_ROOTCERT_FILE="$withval",
2010-09-28 06:27:49 -04:00
if test $on_mingw = no; then
UNBOUND_ROOTCERT_FILE="$UNBOUND_RUN_DIR/icannbundle.pem"
else
2017-02-22 02:31:32 -05:00
UNBOUND_ROOTCERT_FILE="C:\\Program Files\\Unbound\\icannbundle.pem"
2010-09-28 06:27:49 -04:00
fi
)
AC_SUBST(UNBOUND_ROOTCERT_FILE)
ACX_ESCAPE_BACKSLASH($UNBOUND_ROOTCERT_FILE, hdr_rpem)
AC_DEFINE_UNQUOTED(ROOT_CERT_FILE, ["$hdr_rpem"], [default rootcert location])
2023-04-20 11:39:55 -04:00
AC_ARG_WITH(username,
AS_HELP_STRING([--with-username=user],[set default user that unbound changes to (default user is unbound)]),
UNBOUND_USERNAME="$withval",
2008-07-17 05:00:38 -04:00
UNBOUND_USERNAME="unbound")
AC_SUBST(UNBOUND_USERNAME)
AC_DEFINE_UNQUOTED(UB_USERNAME, ["$UNBOUND_USERNAME"], [default username])
2008-05-22 09:30:22 -04:00
AC_DEFINE(WINVER, 0x0502, [the version of the windows API enabled])
2009-03-23 10:59:58 -04:00
ACX_RSRC_VERSION(wnvs)
2009-02-25 10:54:35 -05:00
AC_DEFINE_UNQUOTED(RSRC_PACKAGE_VERSION, [$wnvs], [version number for resource files])
2008-05-22 09:30:22 -04:00
2024-04-25 04:53:35 -04:00
# Check for 'grep -e' program, here, since ACX_CHECK_FLTO needs that.
AC_PROG_GREP
2007-01-03 03:53:52 -05:00
# Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
2021-01-05 04:27:13 -05:00
AC_LANG([C])
2012-07-19 04:51:35 -04:00
# allow user to override the -g -O2 flags.
2017-11-03 06:52:25 -04:00
default_cflags=no
2012-07-19 04:51:35 -04:00
if test "x$CFLAGS" = "x" ; then
2009-03-23 10:59:58 -04:00
ACX_CHECK_COMPILER_FLAG(g, [CFLAGS="$CFLAGS -g"])
ACX_CHECK_COMPILER_FLAG(O2, [CFLAGS="$CFLAGS -O2"])
2017-11-03 06:52:25 -04:00
default_cflags=yes
2012-07-19 04:51:35 -04:00
fi
2023-09-15 07:00:17 -04:00
m4_version_prereq([2.70], [AC_PROG_CC], [AC_PROG_CC_STDC])
2009-03-23 10:59:58 -04:00
ACX_DEPFLAG
ACX_DETERMINE_EXT_FLAGS_UNBOUND
2007-02-05 06:20:38 -05:00
2009-03-23 14:09:19 -04:00
# debug mode flags warnings
2021-01-05 04:27:13 -05:00
AC_ARG_ENABLE(checking, AS_HELP_STRING([--enable-checking],[Enable warnings, asserts, makefile-dependencies]))
AC_ARG_ENABLE(debug, AS_HELP_STRING([--enable-debug],[same as enable-checking]))
2023-04-20 11:39:55 -04:00
if test "$enable_debug" = "yes"; then debug_enabled="$enable_debug";
2010-03-01 07:53:02 -05:00
else debug_enabled="$enable_checking"; fi
2008-01-14 04:51:20 -05:00
AC_SUBST(debug_enabled)
2010-03-01 07:53:02 -05:00
case "$debug_enabled" in
2008-01-14 04:51:20 -05:00
yes)
2009-03-23 10:59:58 -04:00
ACX_CHECK_COMPILER_FLAG(W, [CFLAGS="$CFLAGS -W"])
ACX_CHECK_COMPILER_FLAG(Wall, [CFLAGS="$CFLAGS -Wall"])
ACX_CHECK_COMPILER_FLAG(Wextra, [CFLAGS="$CFLAGS -Wextra"])
ACX_CHECK_COMPILER_FLAG(Wdeclaration-after-statement, [CFLAGS="$CFLAGS -Wdeclaration-after-statement"])
2008-01-14 04:51:20 -05:00
AC_DEFINE([UNBOUND_DEBUG], [], [define this to enable debug checks.])
;;
no|*)
# nothing to do.
;;
esac
2017-11-03 06:52:25 -04:00
if test "$default_cflags" = "yes"; then
# only when CFLAGS was "" at the start, if the users wants to
# override we shouldn't add default cflags, because they wouldn't
# be able to turn off these options and set the CFLAGS wanted.
ACX_CHECK_FLTO
ACX_CHECK_PIE
ACX_CHECK_RELRO_NOW
fi
2007-02-05 06:20:38 -05:00
2007-01-03 03:53:52 -05:00
AC_C_INLINE
2009-03-23 10:59:58 -04:00
ACX_CHECK_FORMAT_ATTRIBUTE
ACX_CHECK_UNUSED_ATTRIBUTE
2007-01-03 03:53:52 -05:00
2016-03-03 10:59:25 -05:00
AC_DEFUN([CHECK_WEAK_ATTRIBUTE],
[AC_REQUIRE([AC_PROG_CC])
AC_MSG_CHECKING(whether the C compiler (${CC-cc}) accepts the "weak" attribute)
AC_CACHE_VAL(ac_cv_c_weak_attribute,
[ac_cv_c_weak_attribute=no
2021-01-05 04:27:13 -05:00
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <stdio.h>
2016-03-03 10:59:25 -05:00
__attribute__((weak)) void f(int x) { printf("%d", x); }
2021-01-05 04:27:13 -05:00
]], [[
2016-03-03 10:59:25 -05:00
f(1);
2021-01-05 04:27:13 -05:00
]])],[ac_cv_c_weak_attribute="yes"],[ac_cv_c_weak_attribute="no"])
2016-03-03 10:59:25 -05:00
])
AC_MSG_RESULT($ac_cv_c_weak_attribute)
if test $ac_cv_c_weak_attribute = yes; then
AC_DEFINE(HAVE_ATTR_WEAK, 1, [Whether the C compiler accepts the "weak" attribute])
2018-09-13 04:58:21 -04:00
AC_DEFINE(ATTR_WEAK, [__attribute__((weak))], [apply the weak attribute to a symbol])
2024-07-23 04:02:39 -04:00
else
AC_DEFINE(ATTR_WEAK,[], [apply the weak attribute to a symbol])
2016-03-03 10:59:25 -05:00
fi
])dnl End of CHECK_WEAK_ATTRIBUTE
CHECK_WEAK_ATTRIBUTE
2018-09-13 04:58:21 -04:00
AC_DEFUN([CHECK_NORETURN_ATTRIBUTE],
[AC_REQUIRE([AC_PROG_CC])
AC_MSG_CHECKING(whether the C compiler (${CC-cc}) accepts the "noreturn" attribute)
AC_CACHE_VAL(ac_cv_c_noreturn_attribute,
[ac_cv_c_noreturn_attribute=no
2021-01-05 04:27:13 -05:00
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <stdio.h>
2018-09-13 04:58:21 -04:00
__attribute__((noreturn)) void f(int x) { printf("%d", x); }
2021-01-05 04:27:13 -05:00
]], [[
2018-09-13 04:58:21 -04:00
f(1);
2021-01-05 04:27:13 -05:00
]])],[ac_cv_c_noreturn_attribute="yes"],[ac_cv_c_noreturn_attribute="no"])
2018-09-13 04:58:21 -04:00
])
AC_MSG_RESULT($ac_cv_c_noreturn_attribute)
if test $ac_cv_c_noreturn_attribute = yes; then
AC_DEFINE(HAVE_ATTR_NORETURN, 1, [Whether the C compiler accepts the "noreturn" attribute])
AC_DEFINE(ATTR_NORETURN, [__attribute__((__noreturn__))], [apply the noreturn attribute to a function that exits the program])
2024-07-23 03:55:31 -04:00
else
AC_DEFINE(ATTR_NORETURN,[], [apply the noreturn attribute to a function that exits the program])
2018-09-13 04:58:21 -04:00
fi
])dnl End of CHECK_NORETURN_ATTRIBUTE
CHECK_NORETURN_ATTRIBUTE
2024-07-23 03:47:42 -04:00
AC_DEFUN([CHECK_FALLTHROUGH_ATTRIBUTE],
[AC_REQUIRE([AC_PROG_CC])
AC_MSG_CHECKING(whether the C compiler (${CC-cc}) accepts the "fallthrough" attribute)
BAKCFLAGS="$CFLAGS"
CFLAGS="$CFLAGS -Werror"
AC_CACHE_VAL(ac_cv_c_fallthrough_attribute,
[ac_cv_c_fallthrough_attribute=no
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <stdio.h>
void f(int x) {
int y = 0;
switch(x) {
case 1:
y = 1;
__attribute__((fallthrough));
/* fallthrough */
case 2:
y++;
break;
case 3:
y = 3;
break;
}
printf("%d", y);
}
]], [[
f(1);
]])],[ac_cv_c_fallthrough_attribute="yes"],[ac_cv_c_fallthrough_attribute="no"])
])
CFLAGS="$BAKCFLAGS"
AC_MSG_RESULT($ac_cv_c_fallthrough_attribute)
if test $ac_cv_c_fallthrough_attribute = yes; then
AC_DEFINE(HAVE_ATTR_FALLTHROUGH, 1, [Whether the C compiler accepts the "fallthrough" attribute])
AC_DEFINE(ATTR_FALLTHROUGH, [__attribute__((fallthrough));], [apply the fallthrough attribute.])
else
AC_DEFINE(ATTR_FALLTHROUGH,[], [apply the fallthrough attribute.])
fi
])dnl End of CHECK_FALLTHROUGH_ATTRIBUTE
CHECK_FALLTHROUGH_ATTRIBUTE
2007-01-23 11:10:23 -05:00
if test "$srcdir" != "."; then
2008-02-07 09:13:03 -05:00
CPPFLAGS="$CPPFLAGS -I$srcdir"
2007-01-23 11:10:23 -05:00
fi
2009-08-25 08:10:24 -04:00
AC_DEFUN([ACX_YYLEX_DESTROY], [
AC_MSG_CHECKING([for yylex_destroy])
if echo %% | $LEX -t 2>&1 | grep yylex_destroy >/dev/null 2>&1; then
AC_DEFINE(LEX_HAS_YYLEX_DESTROY, 1, [if lex has yylex_destroy])
AC_MSG_RESULT(yes)
2018-08-03 07:10:55 -04:00
else AC_MSG_RESULT(no);
LEX=":"
fi
2009-08-25 08:10:24 -04:00
])
2018-07-20 07:53:57 -04:00
AC_DEFUN([ACX_YYLEX_OPTION], [
AC_MSG_CHECKING([for lex %option])
if cat <<EOF | $LEX -t 2>&1 | grep yy_delete_buffer >/dev/null 2>&1; then
%option nounput
%%
EOF
AC_MSG_RESULT(yes)
else AC_MSG_RESULT(no);
2018-07-20 08:52:37 -04:00
LEX=":"
2018-07-20 07:53:57 -04:00
fi
])
2021-01-05 04:27:13 -05:00
AC_PROG_LEX([noyywrap])
2018-07-20 08:52:37 -04:00
if test "$LEX" != "" -a "$LEX" != ":"; then
2009-08-25 08:10:24 -04:00
ACX_YYLEX_DESTROY
2018-08-03 07:10:55 -04:00
fi
if test "$LEX" != "" -a "$LEX" != ":"; then
2018-07-20 07:53:57 -04:00
ACX_YYLEX_OPTION
fi
2023-05-04 05:12:11 -04:00
if test "$LEX" = "" -o "$LEX" = ":"; then
if test ! -f util/configlexer.c; then
AC_MSG_ERROR([no lex and no util/configlexer.c: need flex and bison to compile from source repository.])
fi
fi
2007-02-20 10:28:27 -05:00
AC_PROG_YACC
2023-05-04 05:12:11 -04:00
if test "$YACC" = "" -o "$YACC" = ":"; then
if test ! -f util/configparser.c; then
AC_MSG_ERROR([no yacc and no util/configparser.c: need flex and bison to compile from source repository.])
fi
fi
2009-03-23 10:59:58 -04:00
AC_CHECK_PROG(doxygen, doxygen, doxygen)
2009-07-15 07:50:13 -04:00
AC_CHECK_TOOL(STRIP, strip)
2009-03-23 10:59:58 -04:00
ACX_LIBTOOL_C_ONLY
2007-01-23 11:10:23 -05:00
2021-06-25 05:05:57 -04:00
# pkg-config is only needed for these options, do not require it otherwise
2024-02-07 04:38:52 -05:00
if test "$enable_systemd" = "yes" -o "$enable_dnstap" = "yes" -o "$with_pyunbound" = "yes" -o "$with_pythonmod" = "yes"; then
2019-01-31 05:21:54 -05:00
PKG_PROG_PKG_CONFIG
2021-06-25 05:05:57 -04:00
fi
2019-01-31 05:21:54 -05:00
2007-01-23 11:10:23 -05:00
# Checks for header files.
2022-08-31 05:54:11 -04:00
AC_CHECK_HEADERS([stdarg.h stdbool.h netinet/in.h netinet/tcp.h sys/param.h sys/select.h sys/socket.h sys/un.h sys/uio.h sys/resource.h arpa/inet.h syslog.h netdb.h sys/wait.h pwd.h glob.h grp.h login_cap.h winsock2.h ws2tcpip.h endian.h sys/endian.h libkern/OSByteOrder.h sys/ipc.h sys/shm.h ifaddrs.h poll.h],,, [AC_INCLUDES_DEFAULT])
2020-10-21 10:45:18 -04:00
# net/if.h portability for Darwin see:
# https://www.gnu.org/software/autoconf/manual/autoconf-2.69/html_node/Header-Portability.html
AC_CHECK_HEADERS([net/if.h],,, [
#include <stdio.h>
#ifdef STDC_HEADERS
# include <stdlib.h>
# include <stddef.h>
#else
# ifdef HAVE_STDLIB_H
# include <stdlib.h>
# endif
#endif
#ifdef HAVE_SYS_SOCKET_H
# include <sys/socket.h>
#endif
])
2007-01-23 11:10:23 -05:00
2020-03-11 03:41:56 -04:00
# Check for Apple header. This uncovers TARGET_OS_IPHONE, TARGET_OS_TV or TARGET_OS_WATCH
2021-03-24 10:34:26 -04:00
AC_CHECK_HEADERS([TargetConditionals.h],,, [AC_INCLUDES_DEFAULT])
2021-12-03 04:44:47 -05:00
AC_CHECK_HEADERS([netioapi.h],,, [AC_INCLUDES_DEFAULT
#if HAVE_SYS_PARAM_H
#include <sys/param.h>
#endif
#ifdef HAVE_SYS_SOCKET_H
#include <sys/socket.h>
#endif
#ifdef HAVE_SYS_UIO_H
#include <sys/uio.h>
#endif
#ifdef HAVE_NETINET_IN_H
#include <netinet/in.h>
#endif
#ifdef HAVE_NETINET_TCP_H
#include <netinet/tcp.h>
#endif
#ifdef HAVE_ARPA_INET_H
#include <arpa/inet.h>
#endif
#ifdef HAVE_WINSOCK2_H
#include <winsock2.h>
#endif
#ifdef HAVE_WS2TCPIP_H
#include <ws2tcpip.h>
#endif
])
2020-03-11 03:39:48 -04:00
2023-04-13 10:49:32 -04:00
# Check for Linux timestamping headers
AC_CHECK_HEADERS([linux/net_tstamp.h],,, [AC_INCLUDES_DEFAULT])
# check for types.
2009-03-24 10:08:58 -04:00
# Using own tests for int64* because autoconf builtin only give 32bit.
AC_CHECK_TYPE(int8_t, signed char)
AC_CHECK_TYPE(int16_t, short)
AC_CHECK_TYPE(int32_t, int)
AC_CHECK_TYPE(int64_t, long long)
AC_CHECK_TYPE(uint8_t, unsigned char)
AC_CHECK_TYPE(uint16_t, unsigned short)
AC_CHECK_TYPE(uint32_t, unsigned int)
AC_CHECK_TYPE(uint64_t, unsigned long long)
2007-01-23 11:10:23 -05:00
AC_TYPE_SIZE_T
2009-03-24 10:08:58 -04:00
AC_CHECK_TYPE(ssize_t, int)
2007-01-23 11:10:23 -05:00
AC_TYPE_UID_T
AC_TYPE_PID_T
AC_TYPE_OFF_T
2009-03-23 14:09:19 -04:00
ACX_TYPE_U_CHAR
ACX_TYPE_RLIM_T
ACX_TYPE_SOCKLEN_T
ACX_TYPE_IN_ADDR_T
ACX_TYPE_IN_PORT_T
2010-02-01 08:42:30 -05:00
ACX_CHECK_MEMCMP_SIGNED
2007-01-23 11:10:23 -05:00
2013-10-31 11:09:26 -04:00
AC_CHECK_SIZEOF(time_t,,[
AC_INCLUDES_DEFAULT
#ifdef TIME_WITH_SYS_TIME
# include <sys/time.h>
# include <time.h>
#else
# ifdef HAVE_SYS_TIME_H
# include <sys/time.h>
# else
# include <time.h>
# endif
#endif
])
2019-11-19 09:38:05 -05:00
AC_CHECK_SIZEOF(size_t)
2013-10-31 11:09:26 -04:00
2007-10-11 03:34:44 -04:00
# add option to disable the evil rpath
2009-03-23 14:09:19 -04:00
ACX_ARG_RPATH
2010-03-12 04:20:40 -05:00
AC_SUBST(RUNTIME_PATH)
# check to see if libraries are needed for these functions.
AC_SEARCH_LIBS([inet_pton], [nsl])
AC_SEARCH_LIBS([socket], [socket])
2021-11-29 05:41:45 -05:00
# check whether strptime also works
2011-10-19 08:20:45 -04:00
AC_DEFUN([AC_CHECK_STRPTIME_WORKS],
[AC_REQUIRE([AC_PROG_CC])
AC_MSG_CHECKING(whether strptime works)
if test c${cross_compiling} = cno; then
AC_RUN_IFELSE([AC_LANG_SOURCE([[
2014-07-11 10:27:14 -04:00
#define _XOPEN_SOURCE 600
2011-10-19 08:20:45 -04:00
#include <time.h>
int main(void) { struct tm tm; char *res;
res = strptime("2010-07-15T00:00:00+00:00", "%t%Y%t-%t%m%t-%t%d%tT%t%H%t:%t%M%t:%t%S%t", &tm);
if (!res) return 2;
res = strptime("20070207111842", "%Y%m%d%H%M%S", &tm);
if (!res) return 1; return 0; }
2023-08-31 03:19:24 -04:00
]])] , [eval "ac_cv_c_strptime_works=yes"], [eval "ac_cv_c_strptime_works=no"],
[eval "ac_cv_c_strptime_works=maybe"])
2011-10-19 08:20:45 -04:00
else
eval "ac_cv_c_strptime_works=maybe"
fi
AC_MSG_RESULT($ac_cv_c_strptime_works)
if test $ac_cv_c_strptime_works = no; then
AC_LIBOBJ(strptime)
else
AC_DEFINE_UNQUOTED([STRPTIME_WORKS], 1, [use default strptime.])
fi
])dnl
2010-03-12 04:20:40 -05:00
# check some functions of the OS before linking libs (while still runnable).
AC_FUNC_CHOWN
AC_FUNC_FORK
2021-01-05 04:27:13 -05:00
AC_DEFINE(RETSIGTYPE,void,[Return type of signal handlers, but autoconf 2.70 says 'your code may safely assume C89 semantics that RETSIGTYPE is void.'])
2010-03-12 04:20:40 -05:00
AC_FUNC_FSEEKO
ACX_SYS_LARGEFILE
ACX_CHECK_NONBLOCKING_BROKEN
ACX_MKDIR_ONE_ARG
2011-10-19 08:20:45 -04:00
AC_CHECK_FUNCS([strptime],[AC_CHECK_STRPTIME_WORKS],[AC_LIBOBJ([strptime])])
2007-10-11 03:34:44 -04:00
2018-10-05 11:07:19 -04:00
# check if we can use SO_REUSEPORT
2021-06-25 04:37:47 -04:00
reuseport_default=0
if echo "$host" | $GREP -i -e linux >/dev/null; then reuseport_default=1; fi
if echo "$host" | $GREP -i -e dragonfly >/dev/null; then reuseport_default=1; fi
if test "$reuseport_default" = 1; then
2018-10-05 11:07:19 -04:00
AC_DEFINE(REUSEPORT_DEFAULT, 1, [if REUSEPORT is enabled by default])
else
AC_DEFINE(REUSEPORT_DEFAULT, 0, [if REUSEPORT is enabled by default])
fi
2019-08-22 06:22:25 -04:00
# Include systemd.m4 - begin
sinclude(systemd.m4)
# Include systemd.m4 - end
2011-12-05 10:38:21 -05:00
# set memory allocation checking if requested
2023-04-20 11:39:55 -04:00
AC_ARG_ENABLE(alloc-checks, AS_HELP_STRING([--enable-alloc-checks],[ enable to memory allocation statistics, for debug purposes ]),
2011-12-05 10:38:21 -05:00
, )
2023-04-20 11:39:55 -04:00
AC_ARG_ENABLE(alloc-lite, AS_HELP_STRING([--enable-alloc-lite],[ enable for lightweight alloc assertions, for debug purposes ]),
2011-12-05 10:38:21 -05:00
, )
2023-04-20 11:39:55 -04:00
AC_ARG_ENABLE(alloc-nonregional, AS_HELP_STRING([--enable-alloc-nonregional],[ enable nonregional allocs, slow but exposes regional allocations to other memory purifiers, for debug purposes ]),
2011-12-05 10:38:21 -05:00
, )
if test x_$enable_alloc_nonregional = x_yes; then
AC_DEFINE(UNBOUND_ALLOC_NONREGIONAL, 1, [use malloc not regions, for debug use])
fi
if test x_$enable_alloc_checks = x_yes; then
AC_DEFINE(UNBOUND_ALLOC_STATS, 1, [use statistics for allocs and frees, for debug use])
2019-11-20 07:51:10 -05:00
SLDNS_ALLOCCHECK_EXTRA_OBJ="alloc.lo log.lo"
AC_SUBST(SLDNS_ALLOCCHECK_EXTRA_OBJ)
ASYNCLOOK_ALLOCCHECK_EXTRA_OBJ="alloc.lo"
AC_SUBST(ASYNCLOOK_ALLOCCHECK_EXTRA_OBJ)
2011-12-05 10:38:21 -05:00
else
if test x_$enable_alloc_lite = x_yes; then
AC_DEFINE(UNBOUND_ALLOC_LITE, 1, [use to enable lightweight alloc assertions, for debug use])
else
ACX_FUNC_MALLOC([unbound])
fi
fi
2010-06-02 04:43:29 -04:00
# check windows threads (we use them, not pthreads, on windows).
if test "$on_mingw" = "yes"; then
# check windows threads
AC_CHECK_HEADERS([windows.h],,, [AC_INCLUDES_DEFAULT])
AC_MSG_CHECKING([for CreateThread])
2011-08-01 07:14:33 -04:00
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([
2010-06-02 04:43:29 -04:00
#ifdef HAVE_WINDOWS_H
#include <windows.h>
#endif
], [
HANDLE t = CreateThread(NULL, 0, NULL, NULL, 0, NULL);
2011-08-01 07:14:33 -04:00
])],
2010-06-02 04:43:29 -04:00
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_WINDOWS_THREADS, 1, [Using Windows threads])
2023-04-20 11:39:55 -04:00
,
2010-06-02 04:43:29 -04:00
AC_MSG_RESULT(no)
)
else
# not on mingw, check thread libraries.
2009-03-30 10:42:43 -04:00
# check for thread library.
# check this first, so that the pthread lib does not get linked in via
# libssl or libpython, and thus distorts the tests, and we end up using
# the non-threadsafe C libraries.
2023-04-20 11:39:55 -04:00
AC_ARG_WITH(pthreads, AS_HELP_STRING([--with-pthreads],[use pthreads library, or --without-pthreads to disable threading support.]),
2009-03-30 10:42:43 -04:00
[ ],[ withval="yes" ])
ub_have_pthreads=no
if test x_$withval != x_no; then
2013-05-27 04:22:40 -04:00
AX_PTHREAD([
2009-03-30 10:42:43 -04:00
AC_DEFINE(HAVE_PTHREAD,1,[Define if you have POSIX threads libraries and header files.])
2017-08-08 05:43:51 -04:00
if test -n "$PTHREAD_LIBS"; then
LIBS="$PTHREAD_LIBS $LIBS"
fi
2009-03-30 10:42:43 -04:00
CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
CC="$PTHREAD_CC"
ub_have_pthreads=yes
AC_CHECK_TYPES([pthread_spinlock_t, pthread_rwlock_t],,,[#include <pthread.h>])
2022-09-02 04:21:00 -04:00
AC_CHECK_SIZEOF([unsigned long])
AC_CHECK_SIZEOF(pthread_t)
2015-12-11 08:15:40 -05:00
2016-01-11 08:41:33 -05:00
if echo "$CFLAGS" | $GREP -e "-pthread" >/dev/null; then
2015-12-11 08:15:40 -05:00
AC_MSG_CHECKING([if -pthread unused during linking])
# catch clang warning 'argument unused during compilation'
AC_LANG_CONFTEST([AC_LANG_SOURCE(AC_INCLUDES_DEFAULT
[[
int main(void) {return 0;}
]])])
pthread_unused="yes"
# first compile
echo "$CC $CFLAGS -c conftest.c -o conftest.o" >&AS_MESSAGE_LOG_FD
$CC $CFLAGS -c conftest.c -o conftest.o 2>&AS_MESSAGE_LOG_FD >&AS_MESSAGE_LOG_FD
2023-04-20 11:39:55 -04:00
if test $? = 0; then
2015-12-11 08:15:40 -05:00
# then link
echo "$CC $CFLAGS -Werror $LDFLAGS $LIBS -o conftest contest.o" >&AS_MESSAGE_LOG_FD
$CC $CFLAGS -Werror $LDFLAGS $LIBS -o conftest conftest.o 2>&AS_MESSAGE_LOG_FD >&AS_MESSAGE_LOG_FD
if test $? -ne 0; then
AC_MSG_RESULT(yes)
CFLAGS=`echo "$CFLAGS" | sed -e 's/-pthread//'`
PTHREAD_CFLAGS_ONLY="-pthread"
AC_SUBST(PTHREAD_CFLAGS_ONLY)
else
AC_MSG_RESULT(no)
fi
else
AC_MSG_RESULT(no)
fi # endif cc successful
rm -f conftest conftest.c conftest.o
fi # endif -pthread in CFLAGS
2009-03-30 10:42:43 -04:00
])
fi
2023-04-20 11:39:55 -04:00
# check solaris thread library
2021-01-05 04:27:13 -05:00
AC_ARG_WITH(solaris-threads, AS_HELP_STRING([--with-solaris-threads],[use solaris native thread library.]), [ ],[ withval="no" ])
2009-03-30 10:42:43 -04:00
ub_have_sol_threads=no
if test x_$withval != x_no; then
if test x_$ub_have_pthreads != x_no; then
2021-01-05 04:27:13 -05:00
AC_MSG_WARN([Have pthreads already, ignoring --with-solaris-threads])
2009-03-30 10:42:43 -04:00
else
AC_SEARCH_LIBS(thr_create, [thread],
[
AC_DEFINE(HAVE_SOLARIS_THREADS, 1, [Using Solaris threads])
ACX_CHECK_COMPILER_FLAG(mt, [CFLAGS="$CFLAGS -mt"],
[CFLAGS="$CFLAGS -D_REENTRANT"])
ub_have_sol_threads=yes
2023-04-20 11:39:55 -04:00
] , [
AC_MSG_ERROR([no solaris threads found.])
2009-03-30 10:42:43 -04:00
])
fi
fi
2010-06-02 04:43:29 -04:00
fi # end of non-mingw check of thread libraries
2009-03-30 10:42:43 -04:00
2019-09-09 08:27:55 -04:00
# Check for SYSLOG_FACILITY
2021-01-05 04:27:13 -05:00
AC_ARG_WITH(syslog-facility, AS_HELP_STRING([--with-syslog-facility=LOCAL0 - LOCAL7],[ set SYSLOG_FACILITY, default DAEMON ]),
2019-09-09 08:27:55 -04:00
[ UNBOUND_SYSLOG_FACILITY="$withval" ], [])
case "${UNBOUND_SYSLOG_FACILITY}" in
LOCAL[[0-7]]) UNBOUND_SYSLOG_FACILITY="LOG_${UNBOUND_SYSLOG_FACILITY}" ;;
*) UNBOUND_SYSLOG_FACILITY="LOG_DAEMON" ;;
esac
AC_DEFINE_UNQUOTED(UB_SYSLOG_FACILITY,${UNBOUND_SYSLOG_FACILITY},[the SYSLOG_FACILITY to use, default LOG_DAEMON])
2019-10-17 09:10:33 -04:00
# Check for dynamic library module
AC_ARG_WITH(dynlibmodule,
2021-01-05 04:27:13 -05:00
AS_HELP_STRING([--with-dynlibmodule],[build dynamic library module, or --without-dynlibmodule to disable it. (default=no)]),
2019-10-17 09:10:33 -04:00
[], [ withval="no" ])
if test x_$withval != x_no; then
AC_DEFINE(WITH_DYNLIBMODULE, 1, [Define if you want dynlib module.])
WITH_DYNLIBMODULE=yes
AC_SUBST(WITH_DYNLIBMODULE)
DYNLIBMOD_OBJ="dynlibmod.lo"
AC_SUBST(DYNLIBMOD_OBJ)
DYNLIBMOD_HEADER='$(srcdir)/dynlibmod/dynlibmod.h'
AC_SUBST(DYNLIBMOD_HEADER)
if test $on_mingw = "no"; then
2021-02-02 07:18:18 -05:00
# link with -ldl if not already there, for all executables because
# dlopen call is in the dynlib module. For unbound executable, also
# export symbols.
AC_SEARCH_LIBS([dlopen], [dl])
DYNLIBMOD_EXTRALIBS="-export-dynamic"
2019-10-17 09:10:33 -04:00
else
2021-01-14 10:50:17 -05:00
DYNLIBMOD_EXTRALIBS="-Wl,--export-all-symbols,--out-implib,libunbound.dll.a"
2019-10-17 09:10:33 -04:00
fi
AC_SUBST(DYNLIBMOD_EXTRALIBS)
fi
2009-03-25 10:47:47 -04:00
# Check for PyUnbound
AC_ARG_WITH(pyunbound,
2021-01-05 04:27:13 -05:00
AS_HELP_STRING([--with-pyunbound],[build PyUnbound, or --without-pyunbound to skip it. (default=no)]),
2009-03-25 10:47:47 -04:00
[], [ withval="no" ])
ub_test_python=no
ub_with_pyunbound=no
if test x_$withval != x_no; then
ub_with_pyunbound=yes
ub_test_python=yes
fi
# Check for Python module
AC_ARG_WITH(pythonmodule,
2021-01-05 04:27:13 -05:00
AS_HELP_STRING([--with-pythonmodule],[build Python module, or --without-pythonmodule to disable script engine. (default=no)]),
2009-03-25 10:47:47 -04:00
[], [ withval="no" ])
ub_with_pythonmod=no
if test x_$withval != x_no; then
ub_with_pythonmod=yes
ub_test_python=yes
fi
# Check for Python & SWIG only on PyUnbound or PyModule
if test x_$ub_test_python != x_no; then
# Check for Python
ub_have_python=no
2010-03-12 08:21:20 -05:00
ac_save_LIBS="$LIBS" dnl otherwise AC_PYTHON_DEVEL thrashes $LIBS
2009-03-25 10:47:47 -04:00
AC_PYTHON_DEVEL
2009-04-23 11:47:49 -04:00
if test ! -z "$PYTHON_VERSION"; then
2023-01-09 09:10:00 -05:00
badversion="no"
if test "$PYTHON_VERSION_MAJOR" -lt 2; then
badversion="yes"
fi
if test "$PYTHON_VERSION_MAJOR" -eq 2 -a "$PYTHON_VERSION_MINOR" -lt 4; then
badversion="yes"
fi
if test "$badversion" = "yes"; then
2021-01-05 04:27:13 -05:00
AC_MSG_ERROR([Python version >= 2.4.0 is required])
2009-04-23 11:47:49 -04:00
fi
2009-03-25 10:47:47 -04:00
2015-08-28 02:56:27 -04:00
[PY_MAJOR_VERSION="`$PYTHON -c \"import sys; print(sys.version_info[0])\"`"]
2015-04-16 10:41:14 -04:00
AC_SUBST(PY_MAJOR_VERSION)
2009-03-25 10:47:47 -04:00
# Have Python
AC_DEFINE(HAVE_PYTHON,1,[Define if you have Python libraries and header files.])
2021-07-23 01:23:05 -04:00
if test x_$ub_with_pythonmod != x_no; then
if test -n "$LIBS"; then
LIBS="$PYTHON_LDFLAGS $LIBS"
else
LIBS="$PYTHON_LDFLAGS"
fi
2017-08-08 05:43:51 -04:00
fi
2021-07-23 01:23:05 -04:00
PYTHON_LIBS="$PYTHON_LDFLAGS"
AC_SUBST(PYTHON_LIBS)
2017-08-08 05:43:51 -04:00
if test -n "$CPPFLAGS"; then
CPPFLAGS="$CPPFLAGS $PYTHON_CPPFLAGS"
else
CPPFLAGS="$PYTHON_CPPFLAGS"
fi
2020-04-20 04:04:34 -04:00
if test "$PYTHON_LIBDIR" != "/usr/lib" -a "$PYTHON_LIBDIR" != "" -a "$PYTHON_LIBDIR" != "/usr/lib64"; then
ACX_RUNTIME_PATH_ADD([$PYTHON_LIBDIR])
fi
2009-03-25 10:47:47 -04:00
ub_have_python=yes
2018-06-27 01:46:36 -04:00
PKG_CHECK_EXISTS(["python${PY_MAJOR_VERSION}"],
[PC_PY_DEPENDENCY="python${PY_MAJOR_VERSION}"],
[PC_PY_DEPENDENCY="python"])
2016-10-18 09:56:42 -04:00
AC_SUBST(PC_PY_DEPENDENCY)
2009-03-25 10:47:47 -04:00
# Check for SWIG
ub_have_swig=no
2021-01-05 04:27:13 -05:00
AC_ARG_ENABLE(swig-version-check, AS_HELP_STRING([--disable-swig-version-check],[Disable swig version check to build python modules with older swig even though that is unreliable]))
2018-03-09 03:00:40 -05:00
if test "$enable_swig_version_check" = "yes"; then
2024-04-15 05:30:19 -04:00
AX_PKG_SWIG(2.0.1)
2018-03-09 03:00:40 -05:00
else
2024-04-15 05:30:19 -04:00
AX_PKG_SWIG
2018-03-09 03:00:40 -05:00
fi
2009-03-25 10:47:47 -04:00
AC_MSG_CHECKING(SWIG)
2009-04-21 10:32:44 -04:00
if test ! -x "$SWIG"; then
2021-01-05 04:27:13 -05:00
AC_MSG_ERROR([failed to find swig tool, install it, or do not build Python module and PyUnbound])
2009-03-25 10:47:47 -04:00
else
AC_DEFINE(HAVE_SWIG, 1, [Define if you have Swig libraries and header files.])
AC_SUBST(swig, "$SWIG")
2009-03-25 12:20:34 -04:00
AC_MSG_RESULT(present)
2009-03-25 10:47:47 -04:00
2009-03-25 12:20:34 -04:00
# If have Python & SWIG
2009-03-25 10:47:47 -04:00
# Declare PythonMod
if test x_$ub_with_pythonmod != x_no; then
AC_DEFINE(WITH_PYTHONMODULE, 1, [Define if you want Python module.])
WITH_PYTHONMODULE=yes
AC_SUBST(WITH_PYTHONMODULE)
2011-11-10 13:44:06 -05:00
PYTHONMOD_OBJ="pythonmod.lo pythonmod_utils.lo"
AC_SUBST(PYTHONMOD_OBJ)
2012-03-27 03:23:41 -04:00
PYTHONMOD_HEADER='$(srcdir)/pythonmod/pythonmod.h'
AC_SUBST(PYTHONMOD_HEADER)
2011-11-10 13:44:06 -05:00
PYTHONMOD_INSTALL=pythonmod-install
AC_SUBST(PYTHONMOD_INSTALL)
PYTHONMOD_UNINSTALL=pythonmod-uninstall
AC_SUBST(PYTHONMOD_UNINSTALL)
2009-03-25 10:47:47 -04:00
fi
# Declare PyUnbound
if test x_$ub_with_pyunbound != x_no; then
AC_DEFINE(WITH_PYUNBOUND, 1, [Define if you want PyUnbound.])
WITH_PYUNBOUND=yes
AC_SUBST(WITH_PYUNBOUND)
2011-11-10 13:44:06 -05:00
PYUNBOUND_OBJ="libunbound_wrap.lo"
AC_SUBST(PYUNBOUND_OBJ)
PYUNBOUND_TARGET="_unbound.la"
AC_SUBST(PYUNBOUND_TARGET)
PYUNBOUND_INSTALL=pyunbound-install
AC_SUBST(PYUNBOUND_INSTALL)
PYUNBOUND_UNINSTALL=pyunbound-uninstall
AC_SUBST(PYUNBOUND_UNINSTALL)
2009-03-25 10:47:47 -04:00
fi
fi
else
2009-04-23 11:47:49 -04:00
AC_MSG_RESULT([*** Python libraries not found, won't build PythonMod or PyUnbound ***])
2009-03-25 10:47:47 -04:00
ub_with_pyunbound=no
ub_with_pythonmod=no
fi
fi
2011-11-10 13:44:06 -05:00
if test "`uname`" = "NetBSD"; then
NETBSD_LINTFLAGS='"-D__RENAME(x)=" -D_NETINET_IN_H_'
AC_SUBST(NETBSD_LINTFLAGS)
fi
2021-08-04 06:57:55 -04:00
2022-02-02 08:47:57 -05:00
if test "`uname`" = "Linux"; then
2021-08-04 06:57:55 -04:00
# splint cannot parse modern c99 header files
GCC_DOCKER_LINTFLAGS='-syntax'
AC_SUBST(GCC_DOCKER_LINTFLAGS)
fi
2011-11-10 13:44:06 -05:00
CONFIG_DATE=`date +%Y%m%d`
AC_SUBST(CONFIG_DATE)
2007-01-03 03:53:52 -05:00
# Checks for libraries.
2012-06-20 11:11:53 -04:00
# libnss
USE_NSS="no"
2021-01-05 04:27:13 -05:00
AC_ARG_WITH([nss], AS_HELP_STRING([--with-nss=path],[use libnss instead of openssl, installed at path.]),
2012-06-20 11:11:53 -04:00
[
USE_NSS="yes"
AC_DEFINE(HAVE_NSS, 1, [Use libnss for crypto])
2013-01-30 08:15:03 -05:00
if test "$withval" != "" -a "$withval" != "yes"; then
CPPFLAGS="$CPPFLAGS -I$withval/include/nss3"
2012-06-20 11:11:53 -04:00
LDFLAGS="$LDFLAGS -L$withval/lib"
ACX_RUNTIME_PATH_ADD([$withval/lib])
CPPFLAGS="-I$withval/include/nspr4 $CPPFLAGS"
else
2013-01-30 08:15:03 -05:00
CPPFLAGS="$CPPFLAGS -I/usr/include/nss3"
2012-06-20 11:11:53 -04:00
CPPFLAGS="-I/usr/include/nspr4 $CPPFLAGS"
fi
LIBS="$LIBS -lnss3 -lnspr4"
2015-11-17 04:43:07 -05:00
SSLLIB=""
2020-01-26 22:23:53 -05:00
PC_CRYPTO_DEPENDENCY="nss nspr"
AC_SUBST(PC_CRYPTO_DEPENDENCY)
2015-11-17 04:43:07 -05:00
]
)
# libnettle
USE_NETTLE="no"
2021-01-05 04:27:13 -05:00
AC_ARG_WITH([nettle], AS_HELP_STRING([--with-nettle=path],[use libnettle as crypto library, installed at path.]),
2015-11-17 04:43:07 -05:00
[
USE_NETTLE="yes"
AC_DEFINE(HAVE_NETTLE, 1, [Use libnettle for crypto])
2016-07-05 10:00:33 -04:00
AC_CHECK_HEADERS([nettle/dsa-compat.h],,, [AC_INCLUDES_DEFAULT])
2015-11-17 04:43:07 -05:00
if test "$withval" != "" -a "$withval" != "yes"; then
CPPFLAGS="$CPPFLAGS -I$withval/include/nettle"
LDFLAGS="$LDFLAGS -L$withval/lib"
ACX_RUNTIME_PATH_ADD([$withval/lib])
else
CPPFLAGS="$CPPFLAGS -I/usr/include/nettle"
fi
LIBS="$LIBS -lhogweed -lnettle -lgmp"
SSLLIB=""
2020-01-26 22:23:53 -05:00
PC_CRYPTO_DEPENDENCY="hogweed nettle"
AC_SUBST(PC_CRYPTO_DEPENDENCY)
2012-06-20 11:11:53 -04:00
]
)
# openssl
2015-11-17 04:43:07 -05:00
if test $USE_NSS = "no" -a $USE_NETTLE = "no"; then
2009-03-23 14:09:19 -04:00
ACX_WITH_SSL
ACX_LIB_SSL
2015-11-17 04:43:07 -05:00
SSLLIB="-lssl"
2016-06-14 06:04:15 -04:00
2021-05-24 06:41:09 -04:00
PC_CRYPTO_DEPENDENCY=""
2020-01-26 22:23:53 -05:00
AC_SUBST(PC_CRYPTO_DEPENDENCY)
2016-06-14 06:04:15 -04:00
# check if -lcrypt32 is needed because CAPIENG needs that. (on windows)
BAKLIBS="$LIBS"
LIBS="-lssl $LIBS"
AC_MSG_CHECKING([if libssl needs -lcrypt32])
2021-01-05 04:27:13 -05:00
AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[
int EVP_sha256(void);
(void)EVP_sha256();
]])], [
2016-06-14 06:04:15 -04:00
AC_MSG_RESULT([no])
LIBS="$BAKLIBS"
], [
AC_MSG_RESULT([yes])
LIBS="$BAKLIBS"
2016-06-14 06:08:43 -04:00
LIBS="$LIBS -lcrypt32"
2016-06-14 06:04:15 -04:00
])
2014-07-12 10:13:45 -04:00
AC_MSG_CHECKING([for LibreSSL])
2021-08-17 04:32:12 -04:00
if grep VERSION_TEXT $ssldir_include/openssl/opensslv.h | grep "LibreSSL" >/dev/null; then
2014-07-12 10:13:45 -04:00
AC_MSG_RESULT([yes])
AC_DEFINE([HAVE_LIBRESSL], [1], [Define if we have LibreSSL])
# libressl provides these compat functions, but they may also be
# declared by the OS in libc. See if they have been declared.
2019-09-19 04:09:49 -04:00
AC_CHECK_DECLS([strlcpy,strlcat,arc4random,arc4random_uniform])
2014-07-12 10:13:45 -04:00
else
AC_MSG_RESULT([no])
fi
2021-08-02 08:43:51 -04:00
AC_CHECK_HEADERS([openssl/conf.h openssl/engine.h openssl/bn.h openssl/dh.h openssl/dsa.h openssl/rsa.h openssl/core_names.h openssl/param_build.h],,, [AC_INCLUDES_DEFAULT])
2024-06-17 06:28:45 -04:00
AC_CHECK_FUNCS([OPENSSL_config EVP_sha1 EVP_sha256 EVP_sha512 FIPS_mode EVP_default_properties_is_fips_enabled EVP_MD_CTX_new OpenSSL_add_all_digests OPENSSL_init_crypto EVP_cleanup ENGINE_cleanup ERR_load_crypto_strings CRYPTO_cleanup_all_ex_data ERR_free_strings RAND_cleanup DSA_SIG_set0 EVP_dss1 EVP_DigestVerify EVP_aes_256_cbc EVP_EncryptInit_ex HMAC_Init_ex CRYPTO_THREADID_set_callback EVP_MAC_CTX_set_params OSSL_PARAM_BLD_new BIO_set_callback_ex SSL_CTX_set_tmp_ecdh])
2016-09-15 09:45:35 -04:00
# these check_funcs need -lssl
BAKLIBS="$LIBS"
LIBS="-lssl $LIBS"
2021-07-30 07:54:43 -04:00
AC_CHECK_FUNCS([OPENSSL_init_ssl SSL_CTX_set_security_level SSL_set1_host SSL_get0_peername X509_VERIFY_PARAM_set1_host SSL_CTX_set_ciphersuites SSL_CTX_set_tlsext_ticket_key_evp_cb SSL_CTX_set_alpn_select_cb SSL_get0_alpn_selected SSL_CTX_set_alpn_protos SSL_get1_peer_certificate])
2016-09-15 09:45:35 -04:00
LIBS="$BAKLIBS"
2015-07-21 10:30:49 -04:00
AC_CHECK_DECLS([SSL_COMP_get_compression_methods,sk_SSL_COMP_pop_free,SSL_CTX_set_ecdh_auto], [], [], [
2009-08-25 09:05:31 -04:00
AC_INCLUDES_DEFAULT
#ifdef HAVE_OPENSSL_ERR_H
#include <openssl/err.h>
#endif
#ifdef HAVE_OPENSSL_RAND_H
#include <openssl/rand.h>
#endif
#ifdef HAVE_OPENSSL_CONF_H
#include <openssl/conf.h>
#endif
#ifdef HAVE_OPENSSL_ENGINE_H
#include <openssl/engine.h>
#endif
#include <openssl/ssl.h>
#include <openssl/evp.h>
])
2019-11-18 09:53:47 -05:00
if test "$ac_cv_func_HMAC_Init_ex" = "yes"; then
# check function return type.
AC_MSG_CHECKING(the return type of HMAC_Init_ex)
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([
#ifdef HAVE_OPENSSL_ERR_H
#include <openssl/err.h>
#endif
#ifdef HAVE_OPENSSL_RAND_H
#include <openssl/rand.h>
#endif
#ifdef HAVE_OPENSSL_CONF_H
#include <openssl/conf.h>
#endif
#ifdef HAVE_OPENSSL_ENGINE_H
#include <openssl/engine.h>
#endif
#include <openssl/ssl.h>
#include <openssl/evp.h>
], [
HMAC_CTX* hmac_ctx = NULL;
void* hmac_key = NULL;
const EVP_MD* digest = NULL;
int x = HMAC_Init_ex(hmac_ctx, hmac_key, 32, digest, NULL);
(void)x;
])], [
AC_MSG_RESULT(int)
], [
AC_MSG_RESULT(void)
AC_DEFINE([HMAC_INIT_EX_RETURNS_VOID], 1, [If HMAC_Init_ex() returns void])
])
fi
2012-06-20 11:11:53 -04:00
fi
2015-11-17 04:43:07 -05:00
AC_SUBST(SSLLIB)
2012-06-20 11:11:53 -04:00
2017-02-16 07:37:41 -05:00
# libbsd
2021-01-05 04:27:13 -05:00
AC_ARG_WITH([libbsd], AS_HELP_STRING([--with-libbsd],[Use portable libbsd functions]), [
2017-02-16 07:37:41 -05:00
AC_CHECK_HEADERS([bsd/string.h bsd/stdlib.h],,, [AC_INCLUDES_DEFAULT])
if test "x$ac_cv_header_bsd_string_h" = xyes -a "x$ac_cv_header_bsd_stdlib_h" = xyes; then
for func in strlcpy strlcat arc4random arc4random_uniform reallocarray; do
AC_SEARCH_LIBS([$func], [bsd], [
AC_DEFINE(HAVE_LIBBSD, 1, [Use portable libbsd functions])
PC_LIBBSD_DEPENDENCY=libbsd
AC_SUBST(PC_LIBBSD_DEPENDENCY)
])
done
fi
])
2007-01-03 03:53:52 -05:00
2021-01-05 04:27:13 -05:00
AC_ARG_ENABLE(sha1, AS_HELP_STRING([--disable-sha1],[Disable SHA1 RRSIG support, does not disable nsec3 support]))
2017-03-09 08:18:08 -05:00
case "$enable_sha1" in
no)
;;
yes|*)
AC_DEFINE([USE_SHA1], [1], [Define this to enable SHA1 support.])
;;
esac
2021-01-05 04:27:13 -05:00
AC_ARG_ENABLE(sha2, AS_HELP_STRING([--disable-sha2],[Disable SHA256 and SHA512 RRSIG support]))
2009-06-02 05:04:16 -04:00
case "$enable_sha2" in
2009-10-28 17:56:54 -04:00
no)
2009-08-06 09:38:55 -04:00
;;
2009-10-28 17:56:54 -04:00
yes|*)
AC_DEFINE([USE_SHA2], [1], [Define this to enable SHA256 and SHA512 support.])
2009-08-06 09:38:55 -04:00
;;
esac
2021-01-05 04:27:13 -05:00
AC_ARG_ENABLE(subnet, AS_HELP_STRING([--enable-subnet],[Enable client subnet]))
2017-03-21 08:08:17 -04:00
case "$enable_subnet" in
yes)
AC_DEFINE([CLIENT_SUBNET], [1], [Define this to enable client subnet option.])
SUBNET_OBJ="edns-subnet.lo subnetmod.lo addrtree.lo subnet-whitelist.lo"
AC_SUBST(SUBNET_OBJ)
SUBNET_HEADER='$(srcdir)/edns-subnet/subnetmod.h $(srcdir)/edns-subnet/edns-subnet.h $(srcdir)/edns-subnet/subnet-whitelist.h $(srcdir)/edns-subnet/addrtree.h'
AC_SUBST(SUBNET_HEADER)
;;
no|*)
;;
esac
2021-11-29 05:41:45 -05:00
# check whether gost also works
2011-10-19 08:40:20 -04:00
AC_DEFUN([AC_CHECK_GOST_WORKS],
[AC_REQUIRE([AC_PROG_CC])
2011-10-19 09:11:40 -04:00
AC_MSG_CHECKING([if GOST works])
2011-10-19 08:40:20 -04:00
if test c${cross_compiling} = cno; then
2011-10-19 09:11:40 -04:00
BAKCFLAGS="$CFLAGS"
if test -n "$ssldir"; then
2021-08-17 04:32:12 -04:00
CFLAGS="$CFLAGS -Wl,-rpath,$ssldir_lib"
2011-10-19 09:11:40 -04:00
fi
2011-10-19 08:40:20 -04:00
AC_RUN_IFELSE([AC_LANG_SOURCE([[
2011-10-19 09:11:40 -04:00
#include <string.h>
#include <openssl/ssl.h>
#include <openssl/evp.h>
2011-10-19 08:40:20 -04:00
#include <openssl/engine.h>
2011-10-19 09:11:40 -04:00
#include <openssl/conf.h>
2013-12-03 08:51:11 -05:00
/* routine to load gost (from sldns) */
2011-10-19 09:11:40 -04:00
int load_gost_id(void)
{
static int gost_id = 0;
const EVP_PKEY_ASN1_METHOD* meth;
ENGINE* e;
if(gost_id) return gost_id;
/* see if configuration loaded gost implementation from other engine*/
meth = EVP_PKEY_asn1_find_str(NULL, "gost2001", -1);
if(meth) {
EVP_PKEY_asn1_get0_info(&gost_id, NULL, NULL, NULL, NULL, meth);
return gost_id;
}
/* see if engine can be loaded already */
e = ENGINE_by_id("gost");
if(!e) {
/* load it ourself, in case statically linked */
ENGINE_load_builtin_engines();
ENGINE_load_dynamic();
e = ENGINE_by_id("gost");
}
if(!e) {
/* no gost engine in openssl */
return 0;
}
if(!ENGINE_set_default(e, ENGINE_METHOD_ALL)) {
ENGINE_finish(e);
ENGINE_free(e);
return 0;
}
meth = EVP_PKEY_asn1_find_str(&e, "gost2001", -1);
if(!meth) {
/* algo not found */
ENGINE_finish(e);
ENGINE_free(e);
return 0;
}
EVP_PKEY_asn1_get0_info(&gost_id, NULL, NULL, NULL, NULL, meth);
return gost_id;
}
2023-04-20 11:39:55 -04:00
int main(void) {
2011-10-19 09:11:40 -04:00
EVP_MD_CTX* ctx;
const EVP_MD* md;
unsigned char digest[64]; /* its a 256-bit digest, so uses 32 bytes */
const char* str = "Hello world";
const unsigned char check[] = {
0x40 , 0xed , 0xf8 , 0x56 , 0x5a , 0xc5 , 0x36 , 0xe1 ,
0x33 , 0x7c , 0x7e , 0x87 , 0x62 , 0x1c , 0x42 , 0xe0 ,
0x17 , 0x1b , 0x5e , 0xce , 0xa8 , 0x46 , 0x65 , 0x4d ,
0x8d , 0x3e , 0x22 , 0x9b , 0xe1 , 0x30 , 0x19 , 0x9d
};
OPENSSL_config(NULL);
(void)load_gost_id();
md = EVP_get_digestbyname("md_gost94");
if(!md) return 1;
memset(digest, 0, sizeof(digest));
ctx = EVP_MD_CTX_create();
if(!ctx) return 2;
if(!EVP_DigestInit_ex(ctx, md, NULL)) return 3;
if(!EVP_DigestUpdate(ctx, str, 10)) return 4;
if(!EVP_DigestFinal_ex(ctx, digest, NULL)) return 5;
2011-10-19 09:18:25 -04:00
/* uncomment to see the hash calculated.
{int i;
2011-10-19 09:11:40 -04:00
for(i=0; i<32; i++)
printf(" %2.2x", (int)digest[i]);
2011-10-19 09:18:25 -04:00
printf("\n");}
*/
2011-10-19 09:11:40 -04:00
if(memcmp(digest, check, sizeof(check)) != 0)
return 6;
return 0;
}
2023-08-31 03:19:24 -04:00
]])] , [eval "ac_cv_c_gost_works=yes"], [eval "ac_cv_c_gost_works=no"],
[eval "ac_cv_c_gost_works=maybe"])
2011-10-19 09:11:40 -04:00
CFLAGS="$BAKCFLAGS"
2011-10-19 08:40:20 -04:00
else
eval "ac_cv_c_gost_works=maybe"
fi
AC_MSG_RESULT($ac_cv_c_gost_works)
])dnl
2021-01-05 04:27:13 -05:00
AC_ARG_ENABLE(gost, AS_HELP_STRING([--disable-gost],[Disable GOST support]))
2010-04-28 15:50:34 -04:00
use_gost="no"
2015-11-17 04:43:07 -05:00
if test $USE_NSS = "no" -a $USE_NETTLE = "no"; then
2009-08-06 09:38:55 -04:00
case "$enable_gost" in
2010-11-01 07:24:07 -04:00
no)
;;
*)
2010-04-28 08:52:03 -04:00
AC_CHECK_FUNC(EVP_PKEY_set_type_str, [:],[AC_MSG_ERROR([OpenSSL 1.0.0 is needed for GOST support])])
2012-06-20 11:11:53 -04:00
AC_CHECK_FUNC(EC_KEY_new, [], [AC_MSG_ERROR([OpenSSL does not support ECC, needed for GOST support])])
2011-10-19 08:40:20 -04:00
AC_CHECK_GOST_WORKS
2012-06-20 11:11:53 -04:00
if test "$ac_cv_c_gost_works" != no; then
2011-10-19 08:40:20 -04:00
use_gost="yes"
AC_DEFINE([USE_GOST], [1], [Define this to enable GOST support.])
fi
2009-06-02 05:04:16 -04:00
;;
esac
2015-11-17 04:43:07 -05:00
fi dnl !USE_NSS && !USE_NETTLE
2009-06-02 05:04:16 -04:00
2021-01-05 04:27:13 -05:00
AC_ARG_ENABLE(ecdsa, AS_HELP_STRING([--disable-ecdsa],[Disable ECDSA support]))
2012-02-08 08:22:44 -05:00
use_ecdsa="no"
case "$enable_ecdsa" in
2012-04-13 12:19:13 -04:00
no)
;;
*)
2015-11-17 04:43:07 -05:00
if test $USE_NSS = "no" -a $USE_NETTLE = "no"; then
2024-06-17 06:28:45 -04:00
AC_CHECK_FUNC(EVP_PKEY_fromdata, [
# with EVP_PKEY_fromdata, check if EC is not disabled
AC_CHECK_DECL([OPENSSL_NO_EC], [AC_MSG_ERROR([OpenSSL does not support ECDSA: please upgrade or rerun with --disable-ecdsa])
], [], [AC_INCLUDES_DEFAULT
#include <openssl/evp.h>
])
], [
# without EVP_PKEY_fromdata, older openssl, check for support
AC_CHECK_FUNC(ECDSA_sign, [], [AC_MSG_ERROR([OpenSSL does not support ECDSA: please upgrade or rerun with --disable-ecdsa])])
AC_CHECK_FUNC(SHA384_Init, [], [AC_MSG_ERROR([OpenSSL does not support SHA384: please upgrade or rerun with --disable-ecdsa])])
])
2012-06-20 11:11:53 -04:00
AC_CHECK_DECLS([NID_X9_62_prime256v1, NID_secp384r1], [], [AC_MSG_ERROR([OpenSSL does not support the ECDSA curves: please upgrade or rerun with --disable-ecdsa])], [AC_INCLUDES_DEFAULT
2012-02-08 08:22:44 -05:00
#include <openssl/evp.h>
2012-06-20 11:11:53 -04:00
])
# see if OPENSSL 1.0.0 or later (has EVP MD and Verify independency)
AC_MSG_CHECKING([if openssl supports SHA2 and ECDSA with EVP])
2021-08-17 04:32:12 -04:00
if grep OPENSSL_VERSION_TEXT $ssldir_include/openssl/opensslv.h | grep "OpenSSL" >/dev/null; then
if grep OPENSSL_VERSION_NUMBER $ssldir_include/openssl/opensslv.h | grep 0x0 >/dev/null; then
2014-07-12 08:54:50 -04:00
AC_MSG_RESULT([no])
AC_DEFINE_UNQUOTED([USE_ECDSA_EVP_WORKAROUND], [1], [Define this to enable an EVP workaround for older openssl])
else
AC_MSG_RESULT([yes])
fi
2012-06-20 11:11:53 -04:00
else
2014-07-12 08:54:50 -04:00
# not OpenSSL, thus likely LibreSSL, which supports it
2012-06-20 11:11:53 -04:00
AC_MSG_RESULT([yes])
fi
2012-02-08 11:40:46 -05:00
fi
2012-02-08 08:22:44 -05:00
# we now know we have ECDSA and the required curves.
AC_DEFINE_UNQUOTED([USE_ECDSA], [1], [Define this to enable ECDSA support.])
use_ecdsa="yes"
;;
esac
2021-01-05 04:27:13 -05:00
AC_ARG_ENABLE(dsa, AS_HELP_STRING([--disable-dsa],[Disable DSA support]))
2016-03-23 04:19:49 -04:00
use_dsa="no"
2016-10-20 05:22:04 -04:00
case "$enable_dsa" in
2020-01-27 03:40:18 -05:00
yes)
2016-03-23 04:19:49 -04:00
# detect if DSA is supported, and turn it off if not.
2017-07-24 06:09:05 -04:00
if test $USE_NSS = "no" -a $USE_NETTLE = "no"; then
2016-12-07 07:58:47 -05:00
AC_CHECK_FUNC(DSA_SIG_new, [
2018-03-05 09:28:21 -05:00
AC_CHECK_TYPE(DSA_SIG*, [
2016-03-23 04:19:49 -04:00
AC_DEFINE_UNQUOTED([USE_DSA], [1], [Define this to enable DSA support.])
2018-03-05 09:28:21 -05:00
], [if test "x$enable_dsa" = "xyes"; then AC_MSG_ERROR([OpenSSL does not support DSA and you used --enable-dsa.])
fi ], [
AC_INCLUDES_DEFAULT
#ifdef HAVE_OPENSSL_ERR_H
#include <openssl/err.h>
#endif
#ifdef HAVE_OPENSSL_RAND_H
#include <openssl/rand.h>
#endif
#ifdef HAVE_OPENSSL_CONF_H
#include <openssl/conf.h>
#endif
#ifdef HAVE_OPENSSL_ENGINE_H
#include <openssl/engine.h>
#endif
])
2016-03-23 04:19:49 -04:00
], [if test "x$enable_dsa" = "xyes"; then AC_MSG_ERROR([OpenSSL does not support DSA and you used --enable-dsa.])
fi ])
2017-07-24 06:09:05 -04:00
else
AC_DEFINE_UNQUOTED([USE_DSA], [1], [Define this to enable DSA support.])
fi
2016-03-23 04:19:49 -04:00
;;
2020-01-27 03:40:18 -05:00
*)
# disable dsa by default, RFC 8624 section 3.1, validators MUST NOT
# support DSA for DNSSEC Validation.
;;
2016-03-23 04:19:49 -04:00
esac
2021-05-07 08:28:20 -04:00
AC_ARG_WITH(deprecate-rsa-1024, AS_HELP_STRING([--with-deprecate-rsa-1024],[Deprecate RSA 1024 bit length, makes that an unsupported key, for use when OpenSSL FIPS refuses 1024 bit verification]))
if test "$with_deprecate_rsa_1024" = "yes"; then
AC_DEFINE([DEPRECATE_RSA_1024], [1], [Deprecate RSA 1024 bit length, makes that an unsupported key])
fi
2021-01-05 04:27:13 -05:00
AC_ARG_ENABLE(ed25519, AS_HELP_STRING([--disable-ed25519],[Disable ED25519 support]))
2017-05-30 08:28:25 -04:00
use_ed25519="no"
case "$enable_ed25519" in
no)
;;
*)
if test $USE_NSS = "no" -a $USE_NETTLE = "no"; then
AC_CHECK_DECLS([NID_ED25519], [
use_ed25519="yes"
], [ if test "x$enable_ed25519" = "xyes"; then AC_MSG_ERROR([OpenSSL does not support ED25519 and you used --enable-ed25519.])
fi ], [AC_INCLUDES_DEFAULT
#include <openssl/evp.h>
])
fi
2017-07-24 06:44:30 -04:00
if test $USE_NETTLE = "yes"; then
AC_CHECK_HEADERS([nettle/eddsa.h], use_ed25519="yes",, [AC_INCLUDES_DEFAULT])
fi
if test $use_ed25519 = "yes"; then
AC_DEFINE_UNQUOTED([USE_ED25519], [1], [Define this to enable ED25519 support.])
fi
2017-05-30 08:28:25 -04:00
;;
esac
2016-03-23 04:19:49 -04:00
2021-01-05 04:27:13 -05:00
AC_ARG_ENABLE(ed448, AS_HELP_STRING([--disable-ed448],[Disable ED448 support]))
2018-04-05 10:44:17 -04:00
use_ed448="no"
case "$enable_ed448" in
no)
;;
*)
if test $USE_NSS = "no" -a $USE_NETTLE = "no"; then
AC_CHECK_DECLS([NID_ED448], [
use_ed448="yes"
], [ if test "x$enable_ed448" = "xyes"; then AC_MSG_ERROR([OpenSSL does not support ED448 and you used --enable-ed448.])
fi ], [AC_INCLUDES_DEFAULT
#include <openssl/evp.h>
])
fi
if test $use_ed448 = "yes"; then
AC_DEFINE_UNQUOTED([USE_ED448], [1], [Define this to enable ED448 support.])
fi
;;
esac
2021-01-05 04:27:13 -05:00
AC_ARG_ENABLE(event-api, AS_HELP_STRING([--enable-event-api],[Enable (experimental) pluggable event base libunbound API installed to unbound-event.h]))
2014-01-24 05:55:28 -05:00
case "$enable_event_api" in
yes)
2016-03-07 09:10:06 -05:00
AC_SUBST(UNBOUND_EVENT_INSTALL, [unbound-event-install])
AC_SUBST(UNBOUND_EVENT_UNINSTALL, [unbound-event-uninstall])
2014-01-24 05:55:28 -05:00
;;
*)
;;
esac
2021-01-05 04:27:13 -05:00
AC_ARG_ENABLE(tfo-client, AS_HELP_STRING([--enable-tfo-client],[Enable TCP Fast Open for client mode]))
2016-07-14 03:06:34 -04:00
case "$enable_tfo_client" in
yes)
2021-06-09 09:52:56 -04:00
case "$host_os" in
linux*) AC_CHECK_DECL([MSG_FASTOPEN], [AC_MSG_WARN([Check the platform specific TFO kernel parameters are correctly configured to support client mode TFO])],
[AC_MSG_ERROR([TCP Fast Open is not available for client mode: please rerun without --enable-tfo-client])],
[AC_INCLUDES_DEFAULT
2016-07-14 03:06:34 -04:00
#include <netinet/tcp.h>
])
2021-06-09 09:52:56 -04:00
AC_DEFINE_UNQUOTED([USE_MSG_FASTOPEN], [1], [Define this to enable client TCP Fast Open.])
;;
darwin*) AC_CHECK_DECL([CONNECT_RESUME_ON_READ_WRITE], [AC_MSG_WARN([Check the platform specific TFO kernel parameters are correctly configured to support client mode TFO])],
[AC_MSG_ERROR([TCP Fast Open is not available for client mode: please rerun without --enable-tfo-client])],
[AC_INCLUDES_DEFAULT
2016-07-14 03:06:34 -04:00
#include <sys/socket.h>
])
2021-06-09 09:52:56 -04:00
AC_DEFINE_UNQUOTED([USE_OSX_MSG_FASTOPEN], [1], [Define this to enable client TCP Fast Open.])
;;
2016-07-14 03:06:34 -04:00
esac
2021-06-09 09:52:56 -04:00
;;
2016-07-14 03:06:34 -04:00
no|*)
;;
esac
2021-01-05 04:27:13 -05:00
AC_ARG_ENABLE(tfo-server, AS_HELP_STRING([--enable-tfo-server],[Enable TCP Fast Open for server mode]))
2016-07-14 03:06:34 -04:00
case "$enable_tfo_server" in
yes)
AC_CHECK_DECL([TCP_FASTOPEN], [AC_MSG_WARN([Check the platform specific TFO kernel parameters are correctly configured to support server mode TFO])], [AC_MSG_ERROR([TCP Fast Open is not available for server mode: please rerun without --enable-tfo-server])], [AC_INCLUDES_DEFAULT
#include <netinet/tcp.h>
])
AC_DEFINE_UNQUOTED([USE_TCP_FASTOPEN], [1], [Define this to enable server TCP Fast Open.])
;;
no|*)
;;
esac
2007-01-23 09:16:52 -05:00
# check for libevent
2021-01-05 04:27:13 -05:00
AC_ARG_WITH(libevent, AS_HELP_STRING([--with-libevent=pathname],[use libevent (will check /usr/local /opt/local /usr/lib /usr/pkg /usr/sfw /usr or you can specify an explicit path). Slower, but allows use of large outgoing port ranges.]),
2020-03-17 06:46:18 -04:00
[ ],[ with_libevent="no" ])
if test "x_$with_libevent" != x_no; then
AC_DEFINE([USE_LIBEVENT], [1], [Define if you enable libevent])
2007-01-23 09:16:52 -05:00
AC_MSG_CHECKING(for libevent)
2020-03-17 06:46:18 -04:00
if test "x_$with_libevent" = x_ -o "x_$with_libevent" = x_yes; then
with_libevent="/usr/local /opt/local /usr/lib /usr/pkg /usr/sfw /usr"
2007-01-23 09:16:52 -05:00
fi
2020-03-17 06:46:18 -04:00
for dir in $with_libevent; do
2007-01-23 09:16:52 -05:00
thedir="$dir"
2014-02-03 06:02:17 -05:00
if test -f "$dir/include/event.h" -o -f "$dir/include/event2/event.h"; then
2008-02-07 09:13:03 -05:00
found_libevent="yes"
2020-03-17 06:46:18 -04:00
dnl assume /usr is in default path.
if test "$thedir" != "/usr"; then
CPPFLAGS="$CPPFLAGS -I$thedir/include"
fi
break;
fi
2007-01-23 09:16:52 -05:00
done
if test x_$found_libevent != x_yes; then
2008-04-09 07:58:53 -04:00
if test -f "$dir/event.h" -a \( -f "$dir/libevent.la" -o -f "$dir/libev.la" \) ; then
2007-02-02 12:19:27 -05:00
# libevent source directory
2020-03-17 06:46:18 -04:00
AC_MSG_RESULT(found in $thedir)
CPPFLAGS="$CPPFLAGS -I$thedir -I$thedir/include"
2009-03-30 04:47:20 -04:00
BAK_LDFLAGS_SET="1"
2008-01-15 08:19:59 -05:00
BAK_LDFLAGS="$LDFLAGS"
2008-02-07 09:09:24 -05:00
# remove evdns from linking
mkdir build >/dev/null 2>&1
mkdir build/libevent >/dev/null 2>&1
mkdir build/libevent/.libs >/dev/null 2>&1
2009-09-04 09:29:11 -04:00
ev_files_o=`ls $thedir/*.o | grep -v evdns\.o | grep -v bufferevent_openssl\.o`
ev_files_lo=`ls $thedir/*.lo | grep -v evdns\.lo | grep -v bufferevent_openssl\.lo`
ev_files_libso=`ls $thedir/.libs/*.o | grep -v evdns\.o | grep -v bufferevent_openssl\.o`
2008-02-07 09:09:24 -05:00
cp $ev_files_o build/libevent
cp $ev_files_lo build/libevent
cp $ev_files_libso build/libevent/.libs
2020-03-17 06:46:18 -04:00
LATE_LDFLAGS="build/libevent/*.lo -lm"
2008-04-09 07:58:53 -04:00
LDFLAGS="build/libevent/*.o $LDFLAGS -lm"
2007-02-02 12:19:27 -05:00
else
2020-03-17 06:46:18 -04:00
AC_MSG_ERROR([Cannot find the libevent library in $with_libevent
2007-11-19 06:04:05 -05:00
You can restart ./configure --with-libevent=no to use a builtin alternative.
2007-09-24 09:32:40 -04:00
Please note that this alternative is not as capable as libevent when using
2008-02-22 05:19:49 -05:00
large outgoing port ranges. ])
2007-02-02 12:19:27 -05:00
fi
2007-01-23 09:16:52 -05:00
else
AC_MSG_RESULT(found in $thedir)
2014-02-03 06:41:19 -05:00
dnl if event2 exists and no event lib in dir itself, use subdir
if test ! -f $thedir/lib/libevent.a -a ! -f $thedir/lib/libevent.so -a -d "$thedir/lib/event2"; then
LDFLAGS="$LDFLAGS -L$thedir/lib/event2"
ACX_RUNTIME_PATH_ADD([$thedir/lib/event2])
else
dnl assume /usr is in default path, do not add "".
if test "$thedir" != "/usr" -a "$thedir" != ""; then
LDFLAGS="$LDFLAGS -L$thedir/lib"
ACX_RUNTIME_PATH_ADD([$thedir/lib])
fi
2007-10-11 03:34:44 -04:00
fi
2007-01-23 09:16:52 -05:00
fi
2008-05-13 10:01:23 -04:00
# check for library used by libevent after 1.3c
AC_SEARCH_LIBS([clock_gettime], [rt])
2010-04-26 04:41:24 -04:00
# is the event.h header libev or libevent?
2007-02-16 16:26:10 -05:00
AC_CHECK_HEADERS([event.h],,, [AC_INCLUDES_DEFAULT])
2010-04-26 04:41:24 -04:00
AC_CHECK_DECL(EV_VERSION_MAJOR, [
AC_SEARCH_LIBS(event_set, [ev])
],[
AC_SEARCH_LIBS(event_set, [event])
],[AC_INCLUDES_DEFAULT
#include <event.h>
])
2007-02-16 16:26:10 -05:00
AC_CHECK_FUNCS([event_base_free]) # only in libevent 1.2 and later
2009-02-06 08:42:50 -05:00
AC_CHECK_FUNCS([event_base_once]) # only in libevent 1.4.1 and later
AC_CHECK_FUNCS([event_base_new]) # only in libevent 1.4.1 and later
2008-04-11 09:24:49 -04:00
AC_CHECK_FUNCS([event_base_get_method]) # only in libevent 1.4.3 and later
2009-01-05 10:05:33 -05:00
AC_CHECK_FUNCS([ev_loop]) # only in libev. (tested on 3.51)
2010-10-29 11:03:20 -04:00
AC_CHECK_FUNCS([ev_default_loop]) # only in libev. (tested on 4.00)
2019-04-08 07:02:34 -04:00
AC_CHECK_FUNCS([event_assign]) # in libevent, for thread-safety
AC_CHECK_DECLS([evsignal_assign], [], [], [AC_INCLUDES_DEFAULT
#ifdef HAVE_EVENT_H
# include <event.h>
#else
# include "event2/event.h"
#endif
])
2016-10-18 09:56:42 -04:00
PC_LIBEVENT_DEPENDENCY="libevent"
AC_SUBST(PC_LIBEVENT_DEPENDENCY)
2009-03-30 04:47:20 -04:00
if test -n "$BAK_LDFLAGS_SET"; then
2008-01-15 08:19:59 -05:00
LDFLAGS="$BAK_LDFLAGS"
fi
2007-02-16 16:26:10 -05:00
else
AC_DEFINE(USE_MINI_EVENT, 1, [Define if you want to use internal select based events])
fi
2007-01-23 09:16:52 -05:00
2010-09-23 11:28:08 -04:00
# check for libexpat
2021-01-05 04:27:13 -05:00
AC_ARG_WITH(libexpat, AS_HELP_STRING([--with-libexpat=path],[specify explicit path for libexpat.]),
2010-09-28 06:27:49 -04:00
[ ],[ withval="/usr/local /opt/local /usr/lib /usr/pkg /usr/sfw /usr" ])
2010-09-23 11:28:08 -04:00
AC_MSG_CHECKING(for libexpat)
found_libexpat="no"
2010-09-28 06:27:49 -04:00
for dir in $withval ; do
2010-09-23 11:28:08 -04:00
if test -f "$dir/include/expat.h"; then
found_libexpat="yes"
dnl assume /usr is in default path.
if test "$dir" != "/usr"; then
CPPFLAGS="$CPPFLAGS -I$dir/include"
LDFLAGS="$LDFLAGS -L$dir/lib"
fi
AC_MSG_RESULT(found in $dir)
break;
fi
done
if test x_$found_libexpat != x_yes; then
2021-01-05 04:27:13 -05:00
AC_MSG_ERROR([Could not find libexpat, expat.h])
2010-09-23 11:28:08 -04:00
fi
AC_CHECK_HEADERS([expat.h],,, [AC_INCLUDES_DEFAULT])
2015-10-27 06:22:05 -04:00
AC_CHECK_DECLS([XML_StopParser], [], [], [AC_INCLUDES_DEFAULT
#include <expat.h>
])
2010-09-23 11:28:08 -04:00
2018-03-15 08:33:51 -04:00
# hiredis (redis C client for cachedb)
2021-01-05 04:27:13 -05:00
AC_ARG_WITH(libhiredis, AS_HELP_STRING([--with-libhiredis=path],[specify explicit path for libhiredis.]),
2018-03-15 08:33:51 -04:00
[ ],[ withval="no" ])
found_libhiredis="no"
if test x_$withval = x_yes -o x_$withval != x_no; then
2018-07-02 03:09:30 -04:00
AC_MSG_CHECKING(for libhiredis)
2018-03-15 08:33:51 -04:00
if test x_$withval = x_ -o x_$withval = x_yes; then
withval="/usr/local /opt/local /usr/lib /usr/pkg /usr/sfw /usr"
fi
for dir in $withval ; do
if test -f "$dir/include/hiredis/hiredis.h"; then
found_libhiredis="yes"
dnl assume /usr is in default path.
if test "$dir" != "/usr"; then
CPPFLAGS="$CPPFLAGS -I$dir/include"
LDFLAGS="$LDFLAGS -L$dir/lib"
fi
AC_MSG_RESULT(found in $dir)
AC_DEFINE([USE_REDIS], [1], [Define this to use hiredis client.])
LIBS="$LIBS -lhiredis"
break;
fi
done
if test x_$found_libhiredis != x_yes; then
2021-01-05 04:27:13 -05:00
AC_MSG_ERROR([Could not find libhiredis, hiredis.h])
2018-03-15 08:33:51 -04:00
fi
AC_CHECK_HEADERS([hiredis/hiredis.h],,, [AC_INCLUDES_DEFAULT])
AC_CHECK_DECLS([redisConnect], [], [], [AC_INCLUDES_DEFAULT
#include <hiredis/hiredis.h>
])
fi
2020-05-07 10:36:26 -04:00
# nghttp2
2021-01-05 04:27:13 -05:00
AC_ARG_WITH(libnghttp2, AS_HELP_STRING([--with-libnghttp2=path],[specify explicit path for libnghttp2.]),
2020-05-07 10:36:26 -04:00
[ ],[ withval="no" ])
found_libnghttp2="no"
if test x_$withval = x_yes -o x_$withval != x_no; then
AC_MSG_CHECKING(for libnghttp2)
if test x_$withval = x_ -o x_$withval = x_yes; then
withval="/usr/local /opt/local /usr/lib /usr/pkg /usr/sfw /usr"
fi
for dir in $withval ; do
if test -f "$dir/include/nghttp2/nghttp2.h"; then
found_libnghttp2="yes"
dnl assume /usr is in default path.
if test "$dir" != "/usr"; then
CPPFLAGS="$CPPFLAGS -I$dir/include"
LDFLAGS="$LDFLAGS -L$dir/lib"
fi
AC_MSG_RESULT(found in $dir)
AC_DEFINE([HAVE_NGHTTP2], [1], [Define this to use nghttp2 client.])
LIBS="$LIBS -lnghttp2"
break;
fi
done
if test x_$found_libnghttp2 != x_yes; then
2021-01-05 04:27:13 -05:00
AC_MSG_ERROR([Could not find libnghttp2, nghttp2.h])
2020-05-07 10:36:26 -04:00
fi
AC_CHECK_HEADERS([nghttp2/nghttp2.h],,, [AC_INCLUDES_DEFAULT])
AC_CHECK_DECLS([nghttp2_session_server_new], [], [], [AC_INCLUDES_DEFAULT
#include <nghttp2/nghttp2.h>
])
fi
DNSoverQUIC (#871)
* - dnsoverquic, configure --with-libngtcp2 option.
* - dnsoverquic, create comm_point for doq and receive cmsg local address.
* - dnsoverquic, less obtrusive debug.
* - dnsoverquic, log and fix local port number. Neater subroutines and ifdefs.
* - dnsoverquic, add testcode/doqclient.
* - dnsoverquic, review fixes on doqclient.
* - dnsoverquic, fix unit test testbound link.
* - dnsoverquic, parse query in doqclient.
* - dnsoverquic, link with libngtcp2_crypto_openssl and code for doqclient.
* - dnsoverquic, random routine for doqclient and fix ngaddr allocation, and
check ub_initstate return.
* - dnsoverquic, fix doqclient free of allocated ngaddr addresses.
* - dnsoverquic, enable debug output with -v for doqclient.
* - dnsoverquic, create and set TLS object and TLS context in doqclient.
* - dnsoverquic, work on quic tls context in doqclient.
* - dnsoverquic, set default dnsoverquic port to the standardized 853 port.
* - dnsoverquic, remove debug comment.
* - dnsoverquic, dns-over-quic quic-port: 853 config option.
* - dnsoverquic, log type of interface created at start of unbound.
* - dnsoverquic, log type of no tls https as https when interface is created.
* - dnsoverquic, setup client quic tls methods.
* - dnsoverquic, event work in doqclient.
* - dnsoverquic, explain in documentation that QUIC uses UDP.
* - dnsoverquic, make doqclient exit.
* - dnsoverquic, doqclient cleanup run routine.
* - dnsoverquic, doqclient code nicer.
* - dnsoverquic, doqclient read and timer.
* - dnsoverquic, doqclient write work.
* - dnsoverquic, review fixes.
* - dnsoverquic, detect openssl quic support at configure time.
* - dnsoverquic, do not allow QUIC on port 53 to stop confusion of DoQ and DNS.
* - dnsoverquic, in doqclient, when idle close is returned, drop the connection
without calling ngtcp2_conn_write_connection_close.
* - dnsoverquic, in doqclient, log callbacks.
* - dnsoverquic, in doqclient add extend_max_local_streams_bidi callback.
* - dnsoverquic, in doqclient add client query lists.
* - dnsoverquic, in doqclient, code cleaner, log text nicer.
* - dnsoverquic, in doqclient, work on write_streams.
* - dnsoverquic, in doqclient, use signed int for stream_id, work on the
ngtcp2_recv_stream_data callback.
* - dnsoverquic, in doqclient, print result and fixes for recv data.
* - dnsoverquic, in doqclient, add the event callbacks to fptr wlist.
* - dnsoverquic, in doqclient, when already expired, use zero timeout timer.
* - dnsoverquic, in doqclient, ignore unused return codes from
ngtcp2_conn_writev_stream.
* - dnsoverquic, add doqclient event functions to the unbound-dnstap-socket
test tool for linking.
* - dnsoverquic, in doqclient, fix multiple operands for the commandline.
neater dns message output.
* - dnsoverquic, in doqclient, store packet when write blocks and try later.
* - dnsoverquic, in doqclient, limit number of packets and number of bytes sent.
* - dnsoverquic, in doqclient, better size estimate for outgoing packet.
* - dnsoverquic, in doqclient, fix that already written next packet is not
counted for data length to send.
* - dnsoverquic, in doqclient, early data transmission and session resumption.
* - dnsoverquic, send version negotiation packet.
* - dnsoverquic, send retry and accept the connection.
* - dnsoverquic, storage structures.
* - dnsoverquic, doq connection setup.
* - dnsoverquic, neater code layout for new conn. Fix verbosity of log print.
* - dnsoverquic, doq conn callback functions.
* - dnsoverquic, doq_fill_rand routine in header file.
* - dnsoverquic, keep track of connection ids.
* - dnsoverquic, get_new_connection_id callback.
* - dnsoverquic, create doq_conid tree.
* - dnsoverquic, settings for server connection.
* - dnsoverquic, tls context.
* - dnsoverquic, sendmsg error handling.
* - dnsoverquic, neat code.
* - dnsoverquic, track doq connection last error.
* - dnsoverquic, neater packet address parameters.
* - dnsoverquic, fix uninitialized bytes in msg control in doq sendmsg, and
fix tree cleanup of conid tree.
* - dnsoverquic, better usage text for doqclient.
* - dnsoverquic, neat code.
* - dnsoverquic, connection receive packet handling.
* - dnsoverquic, debug output.
* - dnsoverquic, debug switched meaning of scid and dcid gives
ERR_TRANSPORT_PARAM.
* - dnsoverquic, remove debug output.
* - dnsoverquic, connection delete routine and error from connection read in
more detail with less clutter.
* - dnsoverquic, write to stream, and receive stream data, log packet.
* - dnsoverquic, alpn set up.
* - dnsoverquic, connection close.
* - dnsoverquic, doq_table and locks.
* - dnsoverquic, fix tests.
* - dnsoverquic, better locking.
* - dnsoverquic, doq_stream.
* - dnsoverquic, remove compile warning.
* - dnsoverquic, doq_stream receive data.
* - dnsoverquic, fixes for locks and keep length bytes allocated.
* - dnsoverquic, lock connection on initial insertion.
* - dnsoverquic, reply information, and reply buffer.
* - dnsoverquic, reply info from cache, local-zone and recursion lookups.
* - dnsoverquic, spelling in comment about buffer storage.
* - dnsoverquic, stream write list and doqclient fixes to exit and printout.
* - dnsoverquic, doqclient -q option for short printout.
* - dnsoverquic, unit test with local data reply.
* - dnsoverquic, write connection and write event is set.
* - dnsoverquic, neater logging for write event connection stream writes.
* - dnsoverquic, log remote connection when the streams are written for it.
* - dnsoverquic, better threaded use, threads can write to doq connections at
the same time.
* - dnsoverquic, unit test for the calculation of connection size with a query.
* - dnsoverquic, use less memory per connection.
* - dnsoverquic, remove unit test output.
* - dnsoverquic, add MSG_DONTWAIT so that there is no mistakenly blocking
socket operations.
* - dnsoverquic, doqclient logs address on connection failures.
* - dnsoverquic, compat code for clock get time routine.
* - dnsoverquic, use skip_test for doq unit test.
* - dnsoverquic, fixes for proxyprotocol, use remote_addr and set proxyprotocol
disabled on the doq connection.
* - dnsoverquic, doqclient sets log identity to its name, instead of "unbound".
* - dnsoverquic, handle blocked udp packet writes.
* - dnsoverquic, fix function documentation for verbose_print_addr from
services/listen_dnsport.c.
* - dnsoverquic, fix doq_conn lock protection. The checklock allows to set
the output file name, and doqclient uses that. Print place of lock_protect.
* - dnsoverquic, neater buffer clear when write of blocked packet fails, make
sure that memory area does not overlap for blocked packet addresses when
write of blocked packet fails, and size blocked packet buffer to the pkt buf.
* - dnsoverquic, move lock check after the test to test script in doq test.
* - dnsoverquic, the doq test uses valgrind when enabled.
* - dnsoverquic, git ignore the doqclient test.
* - dnsoverquic, limit the buffer for packets to max packet size with some more.
* - dnsoverquic, spelling fix.
* - dnsoverquic, timer work, structure and adds and deletes.
* - dnsoverquic, timer_tree uses table.lock.
* - dnsoverquic, fix timer tree remove and spelling in header file comment.
* - dnsoverquic, fix testbound for timer compare function linkage.
* - dnsoverquic, timer set add debug output.
* - dnsoverquic, doq_conn_check_timer function.
* - dnsoverquic, doq_done_setup_timer_and_write function.
* - dnsoverquic, fix that doq conn is not deleted whilst editing write and timer.
* - dnsoverquic, Fix #861 make ERROR netevent.h:1073:32: error: field 'blocked_pkt_pi' has incomplete type
* - dnsoverquic, timer element has timeout setup when socket callback complete.
* - dnsoverquic, fix unit test compile.
* - dnsoverquic, timer callback routine, handle timeout and close and delete the
connection if necessary.
* - dnsoverquic, timer pickup stops at current time.
* - dnsoverquic, timer comparable with the event base time.
* - dnsoverquic, erase marked time when timer disabled.
* - dnsoverquic, fix timer to set correctly and lock popped write connection
early, before it is modified.
* - dnsoverquic, fix to unlock connection lock when it is unlinked and deleted.
* - dnsoverquic, fix to unlock connection lock when it is deleted because it is
a duplicate connection.
* - dnsoverquic, fix that doq timer is not disabled when not set.
* - dnsoverquic, quic-size: 8m maximum number of bytes for QUIC buffers.
* - dnsoverquic, flex and bison.
* - dnsoverquic, quic-size turn away new connections when full.
* - dnsoverquic, doqclient outputs stream reset information.
* - dnsoverquic, detect stream close and reset.
* - dnsoverquic, free stream buffers when data is acked and stream is closed.
* - dnsoverquic, delete stream when closed. Unlink it. Allow stream_id 4 as first.
* - dnsoverquic, stats output for mem.quic and num.query.quic.
* - dnsoverquic, review fix.
* - dnsoverquic, fix when compiled without ngtcp2.
* - dnsoverquic, fix to detect ngtcp2_crypto_quictls for openssl crypto, after
change in libngtcp2.
* - dnsoverquic, fix for newer ngtcp2 versions. detect ngtcp2_ccerr_default,
ngtcp2/ngtcp2_crypto_quictls.h, struct ngtcp2_pkt_hd.tokenlen,
struct ngtcp2_settings.tokenlen and struct ngtcp2_version_cid.
* - dnsoverquic, fix for newer ngtcp2 version, detect number of arguments for
ngtcp2_conn_shutdown_stream.
* - dnsoverquic, fix for newer ngtcp2.
* - dnsoverquic, use the functions from util/timeval_func.h.
* - dnsoverquic, fix in doqclient only write transport parameters once.
* - dnsoverquic, debug log output removed.
* - dnsoverquic, fix in doqclient to work with renamed NGTCP2_CC_ALGO_BBR_V2
from ngtcp2.
* - dnsoverquic, fix to check in doq_server_socket_create that tls-service-key
and tls-service-pem have a value.
* - dnsoverquic, fix to error when doq_server_socket_create fails.
* - dnsoverquic, improve linebreaks in configparser additions.
* - dnsoverquic, fix port from interface pickup after main branch change.
* Fix getting user data from SSL, fix calloc warning.
* Fix fwrite return value check in doqclient
* - timeval_substruct from timeval_func.h
- lock_protect also for HAVE_NGTCP2_CCERR_DEFAULT
- fix doq logging for inet_ntop failures
* - memset for consistency
- no value returned from msghdr_get_ecn when S_SPLINT_S is defined
* - dnsoverquic, rerun autoconf.
---------
Co-authored-by: Yorgos Thessalonikefs <yorgos@nlnetlabs.nl>
2024-10-09 04:32:03 -04:00
# ngtcp2
AC_ARG_WITH(libngtcp2, AS_HELP_STRING([--with-libngtcp2=path],[specify explicit path for libngtcp2, for QUIC.]),
[ ],[ withval="no" ])
found_libngtcp2="no"
if test x_$withval = x_yes -o x_$withval != x_no; then
AC_MSG_CHECKING(for libngtcp2)
if test x_$withval = x_ -o x_$withval = x_yes; then
withval="/usr/local /opt/local /usr/lib /usr/pkg /usr/sfw /usr"
fi
for dir in $withval ; do
if test -f "$dir/include/ngtcp2/ngtcp2.h"; then
found_libngtcp2="yes"
dnl assume /usr is in default path.
if test "$dir" != "/usr"; then
CPPFLAGS="$CPPFLAGS -I$dir/include"
LDFLAGS="$LDFLAGS -L$dir/lib"
fi
AC_MSG_RESULT(found in $dir)
AC_DEFINE([HAVE_NGTCP2], [1], [Define this to use ngtcp2.])
LIBS="$LIBS -lngtcp2"
break;
fi
done
if test x_$found_libngtcp2 != x_yes; then
AC_MSG_ERROR([Could not find libngtcp2, ngtcp2.h])
fi
AC_CHECK_HEADERS([ngtcp2/ngtcp2.h ngtcp2/ngtcp2_crypto_openssl.h ngtcp2/ngtcp2_crypto_quictls.h],,, [AC_INCLUDES_DEFAULT])
AC_CHECK_DECLS([ngtcp2_conn_server_new], [], [], [AC_INCLUDES_DEFAULT
#include <ngtcp2/ngtcp2.h>
])
AC_CHECK_DECLS([ngtcp2_crypto_encrypt_cb], [], [], [AC_INCLUDES_DEFAULT
#include <ngtcp2/ngtcp2_crypto.h>
])
AC_CHECK_LIB([ngtcp2_crypto_openssl], [ngtcp2_crypto_encrypt_cb], [ LIBS="$LIBS -lngtcp2_crypto_openssl" ])
AC_CHECK_LIB([ngtcp2_crypto_quictls], [ngtcp2_crypto_encrypt_cb], [ LIBS="$LIBS -lngtcp2_crypto_quictls" ])
AC_CHECK_FUNCS([ngtcp2_crypto_encrypt_cb ngtcp2_ccerr_default ngtcp2_conn_in_closing_period ngtcp2_conn_in_draining_period ngtcp2_conn_get_max_local_streams_uni ngtcp2_crypto_quictls_from_ossl_encryption_level ngtcp2_crypto_quictls_configure_server_context ngtcp2_crypto_quictls_configure_client_context ngtcp2_conn_get_num_scid ngtcp2_conn_tls_early_data_rejected ngtcp2_conn_encode_0rtt_transport_params])
AC_CHECK_FUNCS([SSL_is_quic], [], [AC_MSG_ERROR([No QUIC support detected in OpenSSL. Need OpenSSL version with QUIC support to enable DNS over QUIC with libngtcp2.])])
AC_CHECK_TYPES([struct ngtcp2_version_cid, ngtcp2_encryption_level],,,[AC_INCLUDES_DEFAULT
#include <ngtcp2/ngtcp2.h>
])
AC_CHECK_MEMBERS([struct ngtcp2_pkt_hd.tokenlen, struct ngtcp2_settings.tokenlen, struct ngtcp2_settings.max_tx_udp_payload_size, struct ngtcp2_transport_params.original_dcid_present],,,[AC_INCLUDES_DEFAULT
#include <ngtcp2/ngtcp2.h>
])
AC_MSG_CHECKING([whether ngtcp2_conn_shutdown_stream has 4 arguments])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([AC_INCLUDES_DEFAULT
#include <ngtcp2/ngtcp2.h>
],[
(void)ngtcp2_conn_shutdown_stream(NULL, 0, 0, 0);
])],[
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_NGTCP2_CONN_SHUTDOWN_STREAM4, 1, [Define if ngtcp2_conn_shutdown_stream has 4 arguments.])
],[
AC_MSG_RESULT(no)
])
fi
2019-10-23 08:40:24 -04:00
# set static linking for uninstalled libraries if requested
2007-06-13 07:14:20 -04:00
AC_SUBST(staticexe)
staticexe=""
2021-01-05 04:27:13 -05:00
AC_ARG_ENABLE(static-exe, AS_HELP_STRING([--enable-static-exe],[ enable to compile executables statically against (event) uninstalled libs, for debug purposes ]),
2007-06-13 07:14:20 -04:00
, )
if test x_$enable_static_exe = x_yes; then
staticexe="-static"
2009-04-06 04:10:14 -04:00
if test "$on_mingw" = yes; then
staticexe="-all-static"
2016-06-29 07:22:57 -04:00
# for static compile, include gdi32 and zlib here.
2024-01-16 10:40:14 -05:00
if echo "$LIBS" | grep 'lgdi32' >/dev/null; then
2017-09-05 04:28:39 -04:00
:
else
LIBS="$LIBS -lgdi32"
fi
2022-06-29 05:41:20 -04:00
AC_CHECK_LIB([z], [compress], [ LIBS="$LIBS -lz" ])
2024-01-16 10:40:14 -05:00
if echo "$LIBS" | grep -e "libssp.a" -e "lssp" >/dev/null; then
:
else
LIBS="$LIBS -l:libssp.a"
fi
2009-04-06 04:10:14 -04:00
fi
2007-06-13 07:14:20 -04:00
fi
2019-10-23 08:40:24 -04:00
# set full static linking if requested
2021-01-05 04:27:13 -05:00
AC_ARG_ENABLE(fully-static, AS_HELP_STRING([--enable-fully-static],[ enable to compile fully static ]),
2019-10-23 08:40:24 -04:00
, )
if test x_$enable_fully_static = x_yes; then
staticexe="-all-static"
if test "$on_mingw" = yes; then
# for static compile, include gdi32 and zlib here.
if echo $LIBS | grep 'lgdi32' >/dev/null; then
:
else
LIBS="$LIBS -lgdi32"
fi
2022-06-29 05:41:20 -04:00
AC_CHECK_LIB([z], [compress], [ LIBS="$LIBS -lz" ])
2024-01-16 10:40:14 -05:00
if echo "$LIBS" | grep -e "libssp.a" -e "lssp" >/dev/null; then
:
else
LIBS="$LIBS -l:libssp.a"
fi
2019-10-23 08:40:24 -04:00
fi
fi
2007-08-14 09:33:41 -04:00
# set lock checking if requested
2023-04-20 11:39:55 -04:00
AC_ARG_ENABLE(lock_checks, AS_HELP_STRING([--enable-lock-checks],[ enable to check lock and unlock calls, for debug purposes ]),
2007-08-14 09:33:41 -04:00
, )
if test x_$enable_lock_checks = x_yes; then
AC_DEFINE(ENABLE_LOCK_CHECKS, 1, [Define if you want to use debug lock checking (slow).])
2011-11-11 09:37:30 -05:00
CHECKLOCK_OBJ="checklocks.lo"
AC_SUBST(CHECKLOCK_OBJ)
2007-08-14 09:33:41 -04:00
fi
2009-03-23 14:09:19 -04:00
ACX_CHECK_GETADDRINFO_WITH_INCLUDES
if test "$USE_WINSOCK" = 1; then
AC_DEFINE(UB_ON_WINDOWS, 1, [Use win32 resources and API])
2009-09-03 06:19:06 -04:00
AC_CHECK_HEADERS([iphlpapi.h],,, [AC_INCLUDES_DEFAULT
#include <windows.h>
])
2009-07-14 10:44:53 -04:00
AC_CHECK_TOOL(WINDRES, windres)
2024-01-15 10:44:27 -05:00
if echo "$LIBS" | grep crypt32 >/dev/null; then
LIBS="$LIBS -liphlpapi"
else
LIBS="$LIBS -liphlpapi -lcrypt32"
fi
2011-11-10 13:44:06 -05:00
WINAPPS="unbound-service-install.exe unbound-service-remove.exe anchor-update.exe"
AC_SUBST(WINAPPS)
WIN_DAEMON_SRC="winrc/win_svc.c winrc/w_inst.c"
AC_SUBST(WIN_DAEMON_SRC)
WIN_DAEMON_OBJ="win_svc.lo w_inst.lo"
AC_SUBST(WIN_DAEMON_OBJ)
WIN_DAEMON_OBJ_LINK="rsrc_unbound.o"
AC_SUBST(WIN_DAEMON_OBJ_LINK)
WIN_HOST_OBJ_LINK="rsrc_unbound_host.o"
AC_SUBST(WIN_HOST_OBJ_LINK)
WIN_UBANCHOR_OBJ_LINK="rsrc_unbound_anchor.o log.lo locks.lo"
AC_SUBST(WIN_UBANCHOR_OBJ_LINK)
WIN_CONTROL_OBJ_LINK="rsrc_unbound_control.o"
AC_SUBST(WIN_CONTROL_OBJ_LINK)
WIN_CHECKCONF_OBJ_LINK="rsrc_unbound_checkconf.o"
AC_SUBST(WIN_CHECKCONF_OBJ_LINK)
2022-03-02 08:34:36 -05:00
AC_DEFINE(__USE_MINGW_ANSI_STDIO, 1, [defined to use gcc ansi snprintf and sscanf that understands %lld when compiled for windows.])
2008-05-22 09:30:22 -04:00
fi
if test $ac_cv_func_getaddrinfo = no; then
2009-03-23 14:09:19 -04:00
AC_LIBOBJ([fake-rfc2553])
2009-03-23 07:22:57 -04:00
fi
2010-04-16 05:27:12 -04:00
# check after getaddrinfo for its libraries
ACX_FUNC_IOCTLSOCKET
2009-03-23 07:22:57 -04:00
# see if daemon(3) exists, and if it is deprecated.
AC_CHECK_FUNCS([daemon])
if test $ac_cv_func_daemon = yes; then
2009-03-23 14:09:19 -04:00
ACX_FUNC_DEPRECATED([daemon], [(void)daemon(0, 0);], [
2009-03-23 07:22:57 -04:00
#include <stdlib.h>
2021-03-24 05:22:37 -04:00
#include <unistd.h>
2009-03-23 07:22:57 -04:00
])
fi
2015-01-06 09:12:59 -05:00
AC_CHECK_MEMBERS([struct sockaddr_un.sun_len],,,[
AC_INCLUDES_DEFAULT
#ifdef HAVE_SYS_UN_H
#include <sys/un.h>
#endif
])
2012-02-13 05:42:22 -05:00
AC_CHECK_MEMBERS([struct in_pktinfo.ipi_spec_dst],,,[
AC_INCLUDES_DEFAULT
#if HAVE_SYS_PARAM_H
#include <sys/param.h>
#endif
#ifdef HAVE_SYS_SOCKET_H
#include <sys/socket.h>
#endif
#ifdef HAVE_SYS_UIO_H
#include <sys/uio.h>
#endif
#ifdef HAVE_NETINET_IN_H
#include <netinet/in.h>
#endif
2016-01-05 05:03:59 -05:00
#ifdef HAVE_NETINET_TCP_H
#include <netinet/tcp.h>
#endif
2012-02-13 05:42:22 -05:00
#ifdef HAVE_ARPA_INET_H
#include <arpa/inet.h>
#endif
#ifdef HAVE_WINSOCK2_H
#include <winsock2.h>
#endif
#ifdef HAVE_WS2TCPIP_H
#include <ws2tcpip.h>
#endif
])
2020-01-29 05:56:29 -05:00
AC_MSG_CHECKING([for htobe64])
AC_LINK_IFELSE([AC_LANG_PROGRAM([
#include <stdio.h>
#ifdef HAVE_ENDIAN_H
# include <endian.h>
#endif
#ifdef HAVE_SYS_ENDIAN_H
# include <sys/endian.h>
#endif
], [unsigned long long x = htobe64(0); printf("%u", (unsigned)x);])],
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_HTOBE64, 1, [If we have htobe64]),
AC_MSG_RESULT(no))
AC_MSG_CHECKING([for be64toh])
AC_LINK_IFELSE([AC_LANG_PROGRAM([
#include <stdio.h>
#ifdef HAVE_ENDIAN_H
# include <endian.h>
#endif
#ifdef HAVE_SYS_ENDIAN_H
# include <sys/endian.h>
#endif
], [unsigned long long x = be64toh(0); printf("%u", (unsigned)x);])],
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_BE64TOH, 1, [If we have be64toh]),
AC_MSG_RESULT(no))
2009-02-12 03:37:30 -05:00
AC_SEARCH_LIBS([setusercontext], [util])
2022-09-01 09:14:20 -04:00
AC_CHECK_FUNCS([tzset sigprocmask fcntl getpwnam endpwent getrlimit setrlimit setsid chroot kill chown sleep usleep random srandom recvmsg sendmsg writev socketpair glob initgroups strftime localtime_r setusercontext _beginthreadex endservent endprotoent fsync shmget accept4 getifaddrs if_nametoindex poll gettid])
2010-03-12 04:20:40 -05:00
AC_CHECK_FUNCS([setresuid],,[AC_CHECK_FUNCS([setreuid])])
AC_CHECK_FUNCS([setresgid],,[AC_CHECK_FUNCS([setregid])])
2008-06-13 09:20:54 -04:00
2008-11-07 04:24:39 -05:00
# check if setreuid en setregid fail, on MacOSX10.4(darwin8).
2021-06-09 10:36:19 -04:00
if echo $host_os | grep darwin8 > /dev/null; then
2008-11-07 04:24:39 -05:00
AC_DEFINE(DARWIN_BROKEN_SETREUID, 1, [Define this if on macOSX10.4-darwin8 and setreuid and setregid do not work])
fi
2016-12-15 08:10:58 -05:00
AC_CHECK_DECLS([inet_pton,inet_ntop], [], [], [
AC_INCLUDES_DEFAULT
#ifdef HAVE_NETINET_IN_H
#include <netinet/in.h>
#endif
#ifdef HAVE_NETINET_TCP_H
#include <netinet/tcp.h>
#endif
#ifdef HAVE_ARPA_INET_H
#include <arpa/inet.h>
#endif
#ifdef HAVE_WINSOCK2_H
#include <winsock2.h>
#endif
#ifdef HAVE_WS2TCPIP_H
#include <ws2tcpip.h>
#endif
])
2008-05-22 09:30:22 -04:00
AC_REPLACE_FUNCS(inet_aton)
AC_REPLACE_FUNCS(inet_pton)
AC_REPLACE_FUNCS(inet_ntop)
AC_REPLACE_FUNCS(snprintf)
2015-10-27 09:47:50 -04:00
# test if snprintf return the proper length
if test "x$ac_cv_func_snprintf" = xyes; then
if test c${cross_compiling} = cno; then
AC_MSG_CHECKING([for correct snprintf return value])
AC_RUN_IFELSE([AC_LANG_SOURCE(AC_INCLUDES_DEFAULT
[[
2015-10-27 10:11:51 -04:00
int main(void) { return !(snprintf(NULL, 0, "test") == 4); }
2015-10-27 09:47:50 -04:00
]])], [AC_MSG_RESULT(yes)], [
AC_MSG_RESULT(no)
AC_DEFINE([SNPRINTF_RET_BROKEN], [], [define if (v)snprintf does not return length needed, (but length used)])
AC_LIBOBJ(snprintf)
2023-08-31 03:19:24 -04:00
], [AC_MSG_RESULT(maybe)])
2015-10-27 09:47:50 -04:00
fi
fi
2013-10-31 11:09:26 -04:00
AC_REPLACE_FUNCS(strlcat)
2008-05-22 09:30:22 -04:00
AC_REPLACE_FUNCS(strlcpy)
AC_REPLACE_FUNCS(memmove)
2008-05-23 10:13:07 -04:00
AC_REPLACE_FUNCS(gmtime_r)
2015-10-27 05:52:16 -04:00
AC_REPLACE_FUNCS(isblank)
2018-09-17 03:06:57 -04:00
AC_REPLACE_FUNCS(explicit_bzero)
2015-06-29 06:19:42 -04:00
dnl without CTIME, ARC4-functions and without reallocarray.
2014-07-11 05:27:24 -04:00
LIBOBJ_WITHOUT_CTIMEARC4="$LIBOBJS"
AC_SUBST(LIBOBJ_WITHOUT_CTIMEARC4)
2019-05-28 05:12:05 -04:00
AC_MSG_CHECKING([for reallocarray])
AC_LINK_IFELSE([AC_LANG_SOURCE(AC_INCLUDES_DEFAULT
[[
2019-05-29 07:28:03 -04:00
#ifndef _OPENBSD_SOURCE
2019-05-28 05:12:05 -04:00
#define _OPENBSD_SOURCE 1
2019-05-29 07:28:03 -04:00
#endif
2019-05-28 05:12:05 -04:00
#include <stdlib.h>
int main(void) {
void* p = reallocarray(NULL, 10, 100);
free(p);
return 0;
}
]])], [AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_REALLOCARRAY, 1, [If we have reallocarray(3)])
], [
AC_MSG_RESULT(no)
AC_LIBOBJ(reallocarray)
])
2019-09-19 04:09:49 -04:00
AC_CHECK_DECLS([reallocarray])
2014-07-11 05:27:24 -04:00
if test "$USE_NSS" = "no"; then
AC_REPLACE_FUNCS(arc4random)
AC_REPLACE_FUNCS(arc4random_uniform)
2014-07-12 05:46:15 -04:00
if test "$ac_cv_func_arc4random" = "no"; then
2014-07-11 05:27:24 -04:00
AC_LIBOBJ(arc4_lock)
2014-07-11 06:44:00 -04:00
AC_CHECK_FUNCS([getentropy],,[
2014-07-12 05:46:15 -04:00
if test "$USE_WINSOCK" = 1; then
2014-07-11 10:46:46 -04:00
AC_LIBOBJ(getentropy_win)
2014-07-12 05:46:15 -04:00
else
2017-01-02 03:51:50 -05:00
case "$host" in
2017-02-06 07:52:32 -05:00
Darwin|*darwin*)
2014-07-11 10:46:46 -04:00
AC_LIBOBJ(getentropy_osx)
;;
2017-02-06 07:52:32 -05:00
*solaris*|*sunos*|SunOS)
2014-07-11 10:46:46 -04:00
AC_LIBOBJ(getentropy_solaris)
AC_CHECK_HEADERS([sys/sha2.h],, [
AC_CHECK_FUNCS([SHA512_Update],,[
AC_LIBOBJ(sha512)
])
], [AC_INCLUDES_DEFAULT])
if test "$ac_cv_header_sys_sha2_h" = "yes"; then
2014-07-12 05:46:15 -04:00
# this lib needed for sha2 on solaris
2014-07-11 10:46:46 -04:00
LIBS="$LIBS -lmd"
fi
2015-02-20 09:03:41 -05:00
AC_SEARCH_LIBS([clock_gettime], [rt])
2014-07-11 10:46:46 -04:00
;;
2019-11-02 14:08:23 -04:00
*freebsd*|*FreeBSD)
AC_LIBOBJ(getentropy_freebsd)
;;
2017-02-06 07:52:32 -05:00
*linux*|Linux|*)
2014-07-11 10:46:46 -04:00
AC_LIBOBJ(getentropy_linux)
2014-07-11 05:27:24 -04:00
AC_CHECK_FUNCS([SHA512_Update],,[
2014-07-11 12:45:47 -04:00
AC_DEFINE([COMPAT_SHA512], [1], [Do sha512 definitions in config.h])
2014-07-11 05:27:24 -04:00
AC_LIBOBJ(sha512)
])
2014-07-12 14:03:27 -04:00
AC_CHECK_HEADERS([sys/sysctl.h],,, [AC_INCLUDES_DEFAULT])
2015-01-05 04:13:32 -05:00
AC_CHECK_FUNCS([getauxval])
2014-07-11 10:46:46 -04:00
AC_SEARCH_LIBS([clock_gettime], [rt])
;;
esac
2014-07-12 05:46:15 -04:00
fi
2014-07-11 06:44:00 -04:00
])
fi
2014-07-11 05:27:24 -04:00
fi
2011-11-10 13:44:06 -05:00
LIBOBJ_WITHOUT_CTIME="$LIBOBJS"
AC_SUBST(LIBOBJ_WITHOUT_CTIME)
2009-08-25 06:29:25 -04:00
AC_REPLACE_FUNCS(ctime_r)
2016-05-31 08:27:41 -04:00
AC_REPLACE_FUNCS(strsep)
2008-05-22 09:30:22 -04:00
2021-01-05 04:27:13 -05:00
AC_ARG_ENABLE(allsymbols, AS_HELP_STRING([--enable-allsymbols],[export all symbols from libunbound and link binaries to it, smaller install size but libunbound export table is polluted by internal symbols]))
2011-05-10 06:57:42 -04:00
case "$enable_allsymbols" in
yes)
2011-11-10 13:44:06 -05:00
COMMON_OBJ_ALL_SYMBOLS=""
UBSYMS=""
2021-03-31 19:22:47 -04:00
EXTRALINK="libunbound.la"
2011-10-13 10:09:50 -04:00
AC_DEFINE(EXPORT_ALL_SYMBOLS, 1, [Define this if you enabled-allsymbols from libunbound to link binaries to it for smaller install size, but the libunbound export table is polluted by internal symbols])
2011-05-10 06:57:42 -04:00
;;
2011-11-10 13:44:06 -05:00
no|*)
COMMON_OBJ_ALL_SYMBOLS='$(COMMON_OBJ)'
UBSYMS='-export-symbols $(srcdir)/libunbound/ubsyms.def'
EXTRALINK=""
;;
2011-05-10 06:57:42 -04:00
esac
2011-11-10 13:44:06 -05:00
AC_SUBST(COMMON_OBJ_ALL_SYMBOLS)
AC_SUBST(EXTRALINK)
AC_SUBST(UBSYMS)
if test x_$enable_lock_checks = x_yes; then
UBSYMS="-export-symbols clubsyms.def"
cp ${srcdir}/libunbound/ubsyms.def clubsyms.def
echo lock_protect >> clubsyms.def
DNSoverQUIC (#871)
* - dnsoverquic, configure --with-libngtcp2 option.
* - dnsoverquic, create comm_point for doq and receive cmsg local address.
* - dnsoverquic, less obtrusive debug.
* - dnsoverquic, log and fix local port number. Neater subroutines and ifdefs.
* - dnsoverquic, add testcode/doqclient.
* - dnsoverquic, review fixes on doqclient.
* - dnsoverquic, fix unit test testbound link.
* - dnsoverquic, parse query in doqclient.
* - dnsoverquic, link with libngtcp2_crypto_openssl and code for doqclient.
* - dnsoverquic, random routine for doqclient and fix ngaddr allocation, and
check ub_initstate return.
* - dnsoverquic, fix doqclient free of allocated ngaddr addresses.
* - dnsoverquic, enable debug output with -v for doqclient.
* - dnsoverquic, create and set TLS object and TLS context in doqclient.
* - dnsoverquic, work on quic tls context in doqclient.
* - dnsoverquic, set default dnsoverquic port to the standardized 853 port.
* - dnsoverquic, remove debug comment.
* - dnsoverquic, dns-over-quic quic-port: 853 config option.
* - dnsoverquic, log type of interface created at start of unbound.
* - dnsoverquic, log type of no tls https as https when interface is created.
* - dnsoverquic, setup client quic tls methods.
* - dnsoverquic, event work in doqclient.
* - dnsoverquic, explain in documentation that QUIC uses UDP.
* - dnsoverquic, make doqclient exit.
* - dnsoverquic, doqclient cleanup run routine.
* - dnsoverquic, doqclient code nicer.
* - dnsoverquic, doqclient read and timer.
* - dnsoverquic, doqclient write work.
* - dnsoverquic, review fixes.
* - dnsoverquic, detect openssl quic support at configure time.
* - dnsoverquic, do not allow QUIC on port 53 to stop confusion of DoQ and DNS.
* - dnsoverquic, in doqclient, when idle close is returned, drop the connection
without calling ngtcp2_conn_write_connection_close.
* - dnsoverquic, in doqclient, log callbacks.
* - dnsoverquic, in doqclient add extend_max_local_streams_bidi callback.
* - dnsoverquic, in doqclient add client query lists.
* - dnsoverquic, in doqclient, code cleaner, log text nicer.
* - dnsoverquic, in doqclient, work on write_streams.
* - dnsoverquic, in doqclient, use signed int for stream_id, work on the
ngtcp2_recv_stream_data callback.
* - dnsoverquic, in doqclient, print result and fixes for recv data.
* - dnsoverquic, in doqclient, add the event callbacks to fptr wlist.
* - dnsoverquic, in doqclient, when already expired, use zero timeout timer.
* - dnsoverquic, in doqclient, ignore unused return codes from
ngtcp2_conn_writev_stream.
* - dnsoverquic, add doqclient event functions to the unbound-dnstap-socket
test tool for linking.
* - dnsoverquic, in doqclient, fix multiple operands for the commandline.
neater dns message output.
* - dnsoverquic, in doqclient, store packet when write blocks and try later.
* - dnsoverquic, in doqclient, limit number of packets and number of bytes sent.
* - dnsoverquic, in doqclient, better size estimate for outgoing packet.
* - dnsoverquic, in doqclient, fix that already written next packet is not
counted for data length to send.
* - dnsoverquic, in doqclient, early data transmission and session resumption.
* - dnsoverquic, send version negotiation packet.
* - dnsoverquic, send retry and accept the connection.
* - dnsoverquic, storage structures.
* - dnsoverquic, doq connection setup.
* - dnsoverquic, neater code layout for new conn. Fix verbosity of log print.
* - dnsoverquic, doq conn callback functions.
* - dnsoverquic, doq_fill_rand routine in header file.
* - dnsoverquic, keep track of connection ids.
* - dnsoverquic, get_new_connection_id callback.
* - dnsoverquic, create doq_conid tree.
* - dnsoverquic, settings for server connection.
* - dnsoverquic, tls context.
* - dnsoverquic, sendmsg error handling.
* - dnsoverquic, neat code.
* - dnsoverquic, track doq connection last error.
* - dnsoverquic, neater packet address parameters.
* - dnsoverquic, fix uninitialized bytes in msg control in doq sendmsg, and
fix tree cleanup of conid tree.
* - dnsoverquic, better usage text for doqclient.
* - dnsoverquic, neat code.
* - dnsoverquic, connection receive packet handling.
* - dnsoverquic, debug output.
* - dnsoverquic, debug switched meaning of scid and dcid gives
ERR_TRANSPORT_PARAM.
* - dnsoverquic, remove debug output.
* - dnsoverquic, connection delete routine and error from connection read in
more detail with less clutter.
* - dnsoverquic, write to stream, and receive stream data, log packet.
* - dnsoverquic, alpn set up.
* - dnsoverquic, connection close.
* - dnsoverquic, doq_table and locks.
* - dnsoverquic, fix tests.
* - dnsoverquic, better locking.
* - dnsoverquic, doq_stream.
* - dnsoverquic, remove compile warning.
* - dnsoverquic, doq_stream receive data.
* - dnsoverquic, fixes for locks and keep length bytes allocated.
* - dnsoverquic, lock connection on initial insertion.
* - dnsoverquic, reply information, and reply buffer.
* - dnsoverquic, reply info from cache, local-zone and recursion lookups.
* - dnsoverquic, spelling in comment about buffer storage.
* - dnsoverquic, stream write list and doqclient fixes to exit and printout.
* - dnsoverquic, doqclient -q option for short printout.
* - dnsoverquic, unit test with local data reply.
* - dnsoverquic, write connection and write event is set.
* - dnsoverquic, neater logging for write event connection stream writes.
* - dnsoverquic, log remote connection when the streams are written for it.
* - dnsoverquic, better threaded use, threads can write to doq connections at
the same time.
* - dnsoverquic, unit test for the calculation of connection size with a query.
* - dnsoverquic, use less memory per connection.
* - dnsoverquic, remove unit test output.
* - dnsoverquic, add MSG_DONTWAIT so that there is no mistakenly blocking
socket operations.
* - dnsoverquic, doqclient logs address on connection failures.
* - dnsoverquic, compat code for clock get time routine.
* - dnsoverquic, use skip_test for doq unit test.
* - dnsoverquic, fixes for proxyprotocol, use remote_addr and set proxyprotocol
disabled on the doq connection.
* - dnsoverquic, doqclient sets log identity to its name, instead of "unbound".
* - dnsoverquic, handle blocked udp packet writes.
* - dnsoverquic, fix function documentation for verbose_print_addr from
services/listen_dnsport.c.
* - dnsoverquic, fix doq_conn lock protection. The checklock allows to set
the output file name, and doqclient uses that. Print place of lock_protect.
* - dnsoverquic, neater buffer clear when write of blocked packet fails, make
sure that memory area does not overlap for blocked packet addresses when
write of blocked packet fails, and size blocked packet buffer to the pkt buf.
* - dnsoverquic, move lock check after the test to test script in doq test.
* - dnsoverquic, the doq test uses valgrind when enabled.
* - dnsoverquic, git ignore the doqclient test.
* - dnsoverquic, limit the buffer for packets to max packet size with some more.
* - dnsoverquic, spelling fix.
* - dnsoverquic, timer work, structure and adds and deletes.
* - dnsoverquic, timer_tree uses table.lock.
* - dnsoverquic, fix timer tree remove and spelling in header file comment.
* - dnsoverquic, fix testbound for timer compare function linkage.
* - dnsoverquic, timer set add debug output.
* - dnsoverquic, doq_conn_check_timer function.
* - dnsoverquic, doq_done_setup_timer_and_write function.
* - dnsoverquic, fix that doq conn is not deleted whilst editing write and timer.
* - dnsoverquic, Fix #861 make ERROR netevent.h:1073:32: error: field 'blocked_pkt_pi' has incomplete type
* - dnsoverquic, timer element has timeout setup when socket callback complete.
* - dnsoverquic, fix unit test compile.
* - dnsoverquic, timer callback routine, handle timeout and close and delete the
connection if necessary.
* - dnsoverquic, timer pickup stops at current time.
* - dnsoverquic, timer comparable with the event base time.
* - dnsoverquic, erase marked time when timer disabled.
* - dnsoverquic, fix timer to set correctly and lock popped write connection
early, before it is modified.
* - dnsoverquic, fix to unlock connection lock when it is unlinked and deleted.
* - dnsoverquic, fix to unlock connection lock when it is deleted because it is
a duplicate connection.
* - dnsoverquic, fix that doq timer is not disabled when not set.
* - dnsoverquic, quic-size: 8m maximum number of bytes for QUIC buffers.
* - dnsoverquic, flex and bison.
* - dnsoverquic, quic-size turn away new connections when full.
* - dnsoverquic, doqclient outputs stream reset information.
* - dnsoverquic, detect stream close and reset.
* - dnsoverquic, free stream buffers when data is acked and stream is closed.
* - dnsoverquic, delete stream when closed. Unlink it. Allow stream_id 4 as first.
* - dnsoverquic, stats output for mem.quic and num.query.quic.
* - dnsoverquic, review fix.
* - dnsoverquic, fix when compiled without ngtcp2.
* - dnsoverquic, fix to detect ngtcp2_crypto_quictls for openssl crypto, after
change in libngtcp2.
* - dnsoverquic, fix for newer ngtcp2 versions. detect ngtcp2_ccerr_default,
ngtcp2/ngtcp2_crypto_quictls.h, struct ngtcp2_pkt_hd.tokenlen,
struct ngtcp2_settings.tokenlen and struct ngtcp2_version_cid.
* - dnsoverquic, fix for newer ngtcp2 version, detect number of arguments for
ngtcp2_conn_shutdown_stream.
* - dnsoverquic, fix for newer ngtcp2.
* - dnsoverquic, use the functions from util/timeval_func.h.
* - dnsoverquic, fix in doqclient only write transport parameters once.
* - dnsoverquic, debug log output removed.
* - dnsoverquic, fix in doqclient to work with renamed NGTCP2_CC_ALGO_BBR_V2
from ngtcp2.
* - dnsoverquic, fix to check in doq_server_socket_create that tls-service-key
and tls-service-pem have a value.
* - dnsoverquic, fix to error when doq_server_socket_create fails.
* - dnsoverquic, improve linebreaks in configparser additions.
* - dnsoverquic, fix port from interface pickup after main branch change.
* Fix getting user data from SSL, fix calloc warning.
* Fix fwrite return value check in doqclient
* - timeval_substruct from timeval_func.h
- lock_protect also for HAVE_NGTCP2_CCERR_DEFAULT
- fix doq logging for inet_ntop failures
* - memset for consistency
- no value returned from msghdr_get_ecn when S_SPLINT_S is defined
* - dnsoverquic, rerun autoconf.
---------
Co-authored-by: Yorgos Thessalonikefs <yorgos@nlnetlabs.nl>
2024-10-09 04:32:03 -04:00
echo lock_protect_place >> clubsyms.def
2011-11-10 13:44:06 -05:00
echo lock_unprotect >> clubsyms.def
echo lock_get_mem >> clubsyms.def
echo checklock_start >> clubsyms.def
echo checklock_stop >> clubsyms.def
DNSoverQUIC (#871)
* - dnsoverquic, configure --with-libngtcp2 option.
* - dnsoverquic, create comm_point for doq and receive cmsg local address.
* - dnsoverquic, less obtrusive debug.
* - dnsoverquic, log and fix local port number. Neater subroutines and ifdefs.
* - dnsoverquic, add testcode/doqclient.
* - dnsoverquic, review fixes on doqclient.
* - dnsoverquic, fix unit test testbound link.
* - dnsoverquic, parse query in doqclient.
* - dnsoverquic, link with libngtcp2_crypto_openssl and code for doqclient.
* - dnsoverquic, random routine for doqclient and fix ngaddr allocation, and
check ub_initstate return.
* - dnsoverquic, fix doqclient free of allocated ngaddr addresses.
* - dnsoverquic, enable debug output with -v for doqclient.
* - dnsoverquic, create and set TLS object and TLS context in doqclient.
* - dnsoverquic, work on quic tls context in doqclient.
* - dnsoverquic, set default dnsoverquic port to the standardized 853 port.
* - dnsoverquic, remove debug comment.
* - dnsoverquic, dns-over-quic quic-port: 853 config option.
* - dnsoverquic, log type of interface created at start of unbound.
* - dnsoverquic, log type of no tls https as https when interface is created.
* - dnsoverquic, setup client quic tls methods.
* - dnsoverquic, event work in doqclient.
* - dnsoverquic, explain in documentation that QUIC uses UDP.
* - dnsoverquic, make doqclient exit.
* - dnsoverquic, doqclient cleanup run routine.
* - dnsoverquic, doqclient code nicer.
* - dnsoverquic, doqclient read and timer.
* - dnsoverquic, doqclient write work.
* - dnsoverquic, review fixes.
* - dnsoverquic, detect openssl quic support at configure time.
* - dnsoverquic, do not allow QUIC on port 53 to stop confusion of DoQ and DNS.
* - dnsoverquic, in doqclient, when idle close is returned, drop the connection
without calling ngtcp2_conn_write_connection_close.
* - dnsoverquic, in doqclient, log callbacks.
* - dnsoverquic, in doqclient add extend_max_local_streams_bidi callback.
* - dnsoverquic, in doqclient add client query lists.
* - dnsoverquic, in doqclient, code cleaner, log text nicer.
* - dnsoverquic, in doqclient, work on write_streams.
* - dnsoverquic, in doqclient, use signed int for stream_id, work on the
ngtcp2_recv_stream_data callback.
* - dnsoverquic, in doqclient, print result and fixes for recv data.
* - dnsoverquic, in doqclient, add the event callbacks to fptr wlist.
* - dnsoverquic, in doqclient, when already expired, use zero timeout timer.
* - dnsoverquic, in doqclient, ignore unused return codes from
ngtcp2_conn_writev_stream.
* - dnsoverquic, add doqclient event functions to the unbound-dnstap-socket
test tool for linking.
* - dnsoverquic, in doqclient, fix multiple operands for the commandline.
neater dns message output.
* - dnsoverquic, in doqclient, store packet when write blocks and try later.
* - dnsoverquic, in doqclient, limit number of packets and number of bytes sent.
* - dnsoverquic, in doqclient, better size estimate for outgoing packet.
* - dnsoverquic, in doqclient, fix that already written next packet is not
counted for data length to send.
* - dnsoverquic, in doqclient, early data transmission and session resumption.
* - dnsoverquic, send version negotiation packet.
* - dnsoverquic, send retry and accept the connection.
* - dnsoverquic, storage structures.
* - dnsoverquic, doq connection setup.
* - dnsoverquic, neater code layout for new conn. Fix verbosity of log print.
* - dnsoverquic, doq conn callback functions.
* - dnsoverquic, doq_fill_rand routine in header file.
* - dnsoverquic, keep track of connection ids.
* - dnsoverquic, get_new_connection_id callback.
* - dnsoverquic, create doq_conid tree.
* - dnsoverquic, settings for server connection.
* - dnsoverquic, tls context.
* - dnsoverquic, sendmsg error handling.
* - dnsoverquic, neat code.
* - dnsoverquic, track doq connection last error.
* - dnsoverquic, neater packet address parameters.
* - dnsoverquic, fix uninitialized bytes in msg control in doq sendmsg, and
fix tree cleanup of conid tree.
* - dnsoverquic, better usage text for doqclient.
* - dnsoverquic, neat code.
* - dnsoverquic, connection receive packet handling.
* - dnsoverquic, debug output.
* - dnsoverquic, debug switched meaning of scid and dcid gives
ERR_TRANSPORT_PARAM.
* - dnsoverquic, remove debug output.
* - dnsoverquic, connection delete routine and error from connection read in
more detail with less clutter.
* - dnsoverquic, write to stream, and receive stream data, log packet.
* - dnsoverquic, alpn set up.
* - dnsoverquic, connection close.
* - dnsoverquic, doq_table and locks.
* - dnsoverquic, fix tests.
* - dnsoverquic, better locking.
* - dnsoverquic, doq_stream.
* - dnsoverquic, remove compile warning.
* - dnsoverquic, doq_stream receive data.
* - dnsoverquic, fixes for locks and keep length bytes allocated.
* - dnsoverquic, lock connection on initial insertion.
* - dnsoverquic, reply information, and reply buffer.
* - dnsoverquic, reply info from cache, local-zone and recursion lookups.
* - dnsoverquic, spelling in comment about buffer storage.
* - dnsoverquic, stream write list and doqclient fixes to exit and printout.
* - dnsoverquic, doqclient -q option for short printout.
* - dnsoverquic, unit test with local data reply.
* - dnsoverquic, write connection and write event is set.
* - dnsoverquic, neater logging for write event connection stream writes.
* - dnsoverquic, log remote connection when the streams are written for it.
* - dnsoverquic, better threaded use, threads can write to doq connections at
the same time.
* - dnsoverquic, unit test for the calculation of connection size with a query.
* - dnsoverquic, use less memory per connection.
* - dnsoverquic, remove unit test output.
* - dnsoverquic, add MSG_DONTWAIT so that there is no mistakenly blocking
socket operations.
* - dnsoverquic, doqclient logs address on connection failures.
* - dnsoverquic, compat code for clock get time routine.
* - dnsoverquic, use skip_test for doq unit test.
* - dnsoverquic, fixes for proxyprotocol, use remote_addr and set proxyprotocol
disabled on the doq connection.
* - dnsoverquic, doqclient sets log identity to its name, instead of "unbound".
* - dnsoverquic, handle blocked udp packet writes.
* - dnsoverquic, fix function documentation for verbose_print_addr from
services/listen_dnsport.c.
* - dnsoverquic, fix doq_conn lock protection. The checklock allows to set
the output file name, and doqclient uses that. Print place of lock_protect.
* - dnsoverquic, neater buffer clear when write of blocked packet fails, make
sure that memory area does not overlap for blocked packet addresses when
write of blocked packet fails, and size blocked packet buffer to the pkt buf.
* - dnsoverquic, move lock check after the test to test script in doq test.
* - dnsoverquic, the doq test uses valgrind when enabled.
* - dnsoverquic, git ignore the doqclient test.
* - dnsoverquic, limit the buffer for packets to max packet size with some more.
* - dnsoverquic, spelling fix.
* - dnsoverquic, timer work, structure and adds and deletes.
* - dnsoverquic, timer_tree uses table.lock.
* - dnsoverquic, fix timer tree remove and spelling in header file comment.
* - dnsoverquic, fix testbound for timer compare function linkage.
* - dnsoverquic, timer set add debug output.
* - dnsoverquic, doq_conn_check_timer function.
* - dnsoverquic, doq_done_setup_timer_and_write function.
* - dnsoverquic, fix that doq conn is not deleted whilst editing write and timer.
* - dnsoverquic, Fix #861 make ERROR netevent.h:1073:32: error: field 'blocked_pkt_pi' has incomplete type
* - dnsoverquic, timer element has timeout setup when socket callback complete.
* - dnsoverquic, fix unit test compile.
* - dnsoverquic, timer callback routine, handle timeout and close and delete the
connection if necessary.
* - dnsoverquic, timer pickup stops at current time.
* - dnsoverquic, timer comparable with the event base time.
* - dnsoverquic, erase marked time when timer disabled.
* - dnsoverquic, fix timer to set correctly and lock popped write connection
early, before it is modified.
* - dnsoverquic, fix to unlock connection lock when it is unlinked and deleted.
* - dnsoverquic, fix to unlock connection lock when it is deleted because it is
a duplicate connection.
* - dnsoverquic, fix that doq timer is not disabled when not set.
* - dnsoverquic, quic-size: 8m maximum number of bytes for QUIC buffers.
* - dnsoverquic, flex and bison.
* - dnsoverquic, quic-size turn away new connections when full.
* - dnsoverquic, doqclient outputs stream reset information.
* - dnsoverquic, detect stream close and reset.
* - dnsoverquic, free stream buffers when data is acked and stream is closed.
* - dnsoverquic, delete stream when closed. Unlink it. Allow stream_id 4 as first.
* - dnsoverquic, stats output for mem.quic and num.query.quic.
* - dnsoverquic, review fix.
* - dnsoverquic, fix when compiled without ngtcp2.
* - dnsoverquic, fix to detect ngtcp2_crypto_quictls for openssl crypto, after
change in libngtcp2.
* - dnsoverquic, fix for newer ngtcp2 versions. detect ngtcp2_ccerr_default,
ngtcp2/ngtcp2_crypto_quictls.h, struct ngtcp2_pkt_hd.tokenlen,
struct ngtcp2_settings.tokenlen and struct ngtcp2_version_cid.
* - dnsoverquic, fix for newer ngtcp2 version, detect number of arguments for
ngtcp2_conn_shutdown_stream.
* - dnsoverquic, fix for newer ngtcp2.
* - dnsoverquic, use the functions from util/timeval_func.h.
* - dnsoverquic, fix in doqclient only write transport parameters once.
* - dnsoverquic, debug log output removed.
* - dnsoverquic, fix in doqclient to work with renamed NGTCP2_CC_ALGO_BBR_V2
from ngtcp2.
* - dnsoverquic, fix to check in doq_server_socket_create that tls-service-key
and tls-service-pem have a value.
* - dnsoverquic, fix to error when doq_server_socket_create fails.
* - dnsoverquic, improve linebreaks in configparser additions.
* - dnsoverquic, fix port from interface pickup after main branch change.
* Fix getting user data from SSL, fix calloc warning.
* Fix fwrite return value check in doqclient
* - timeval_substruct from timeval_func.h
- lock_protect also for HAVE_NGTCP2_CCERR_DEFAULT
- fix doq logging for inet_ntop failures
* - memset for consistency
- no value returned from msghdr_get_ecn when S_SPLINT_S is defined
* - dnsoverquic, rerun autoconf.
---------
Co-authored-by: Yorgos Thessalonikefs <yorgos@nlnetlabs.nl>
2024-10-09 04:32:03 -04:00
echo checklock_set_output_name >> clubsyms.def
2011-11-10 13:44:06 -05:00
echo checklock_lock >> clubsyms.def
echo checklock_unlock >> clubsyms.def
echo checklock_init >> clubsyms.def
echo checklock_thrcreate >> clubsyms.def
echo checklock_thrjoin >> clubsyms.def
fi
2011-05-10 06:57:42 -04:00
2014-08-05 03:57:52 -04:00
# check for dnstap if requested
dt_DNSTAP([$UNBOUND_RUN_DIR/dnstap.sock],
[
AC_DEFINE([USE_DNSTAP], [1], [Define to 1 to enable dnstap support])
AC_SUBST([ENABLE_DNSTAP], [1])
AC_SUBST([opt_dnstap_socket_path])
ACX_ESCAPE_BACKSLASH($opt_dnstap_socket_path, hdr_dnstap_socket_path)
AC_DEFINE_UNQUOTED(DNSTAP_SOCKET_PATH,
["$hdr_dnstap_socket_path"], [default dnstap socket path])
2020-02-14 03:03:09 -05:00
AC_SUBST(DNSTAP_SOCKET_PATH,["$hdr_dnstap_socket_path"])
2021-01-26 11:29:22 -05:00
AC_SUBST(DNSTAP_SOCKET_TESTBIN,['unbound-dnstap-socket$(EXEEXT)'])
2020-01-30 11:11:07 -05:00
AC_SUBST([DNSTAP_SRC], ["dnstap/dnstap.c dnstap/dnstap.pb-c.c dnstap/dnstap_fstrm.c dnstap/dtstream.c"])
AC_SUBST([DNSTAP_OBJ], ["dnstap.lo dnstap.pb-c.lo dnstap_fstrm.lo dtstream.lo"])
2014-08-05 03:57:52 -04:00
],
[
AC_SUBST([ENABLE_DNSTAP], [0])
]
)
2017-03-20 10:55:31 -04:00
# check for dnscrypt if requested
dnsc_DNSCRYPT([
AC_DEFINE([USE_DNSCRYPT], [1], [Define to 1 to enable dnscrypt support])
AC_SUBST([ENABLE_DNSCRYPT], [1])
AC_SUBST([DNSCRYPT_SRC], ["dnscrypt/dnscrypt.c"])
AC_SUBST([DNSCRYPT_OBJ], ["dnscrypt.lo"])
],
[
AC_SUBST([ENABLE_DNSCRYPT], [0])
]
)
2016-04-14 10:50:18 -04:00
# check for cachedb if requested
2021-01-05 04:27:13 -05:00
AC_ARG_ENABLE(cachedb, AS_HELP_STRING([--enable-cachedb],[enable cachedb module that can use external cache storage]))
2018-05-03 05:59:18 -04:00
# turn on cachedb when hiredis support is enabled.
if test "$found_libhiredis" = "yes"; then enable_cachedb="yes"; fi
2016-04-14 10:50:18 -04:00
case "$enable_cachedb" in
yes)
AC_DEFINE([USE_CACHEDB], [1], [Define to 1 to use cachedb support])
2021-03-24 11:28:18 -04:00
AC_SUBST([CACHEDB_SRC], ["cachedb/cachedb.c cachedb/redis.c"])
AC_SUBST([CACHEDB_OBJ], ["cachedb.lo redis.lo"])
2016-04-14 10:50:18 -04:00
;;
no|*)
# nothing
;;
esac
2017-05-16 08:39:24 -04:00
# check for ipsecmod if requested
2021-01-05 04:27:13 -05:00
AC_ARG_ENABLE(ipsecmod, AS_HELP_STRING([--enable-ipsecmod],[Enable ipsecmod module that facilitates opportunistic IPsec]))
2017-05-16 08:39:24 -04:00
case "$enable_ipsecmod" in
yes)
AC_DEFINE([USE_IPSECMOD], [1], [Define to 1 to use ipsecmod support.])
IPSECMOD_OBJ="ipsecmod.lo ipsecmod-whitelist.lo"
AC_SUBST(IPSECMOD_OBJ)
IPSECMOD_HEADER='$(srcdir)/ipsecmod/ipsecmod.h $(srcdir)/ipsecmod/ipsecmod-whitelist.h'
AC_SUBST(IPSECMOD_HEADER)
;;
no|*)
# nothing
;;
esac
2019-05-02 07:43:30 -04:00
# check for ipset if requested
2021-01-05 04:27:13 -05:00
AC_ARG_ENABLE(ipset, AS_HELP_STRING([--enable-ipset],[enable ipset module]))
2019-05-02 07:43:30 -04:00
case "$enable_ipset" in
yes)
AC_DEFINE([USE_IPSET], [1], [Define to 1 to use ipset support])
IPSET_SRC="ipset/ipset.c"
AC_SUBST(IPSET_SRC)
IPSET_OBJ="ipset.lo"
AC_SUBST(IPSET_OBJ)
2020-01-11 09:58:55 -05:00
# BSD's pf
AC_CHECK_HEADERS([net/pfvar.h], [], [
2024-07-01 08:36:33 -04:00
# mnl
AC_ARG_WITH(libmnl, AS_HELP_STRING([--with-libmnl=path],[specify explicit path for libmnl.]),
2019-05-02 07:43:30 -04:00
[ ],[ withval="yes" ])
2024-07-01 08:36:33 -04:00
found_libmnl="no"
AC_MSG_CHECKING(for libmnl)
if test x_$withval = x_ -o x_$withval = x_yes; then
2019-05-02 07:43:30 -04:00
withval="/usr/local /opt/local /usr/lib /usr/pkg /usr/sfw /usr"
2024-07-01 08:36:33 -04:00
fi
for dir in $withval ; do
2022-05-27 03:10:16 -04:00
if test -f "$dir/include/libmnl/libmnl.h" -o -f "$dir/include/libmnl/libmnl/libmnl.h"; then
2019-05-02 07:43:30 -04:00
found_libmnl="yes"
dnl assume /usr is in default path.
2022-05-27 03:10:16 -04:00
extralibmnl=""
if test -f "$dir/include/libmnl/libmnl/libmnl.h"; then
extralibmnl="/libmnl"
fi
if test "$dir" != "/usr" -o -n "$extralibmnl"; then
CPPFLAGS="$CPPFLAGS -I$dir/include$extralibmnl"
fi
2019-05-02 07:43:30 -04:00
if test "$dir" != "/usr"; then
LDFLAGS="$LDFLAGS -L$dir/lib"
fi
AC_MSG_RESULT(found in $dir)
LIBS="$LIBS -lmnl"
break;
fi
2024-07-01 08:36:33 -04:00
done
if test x_$found_libmnl != x_yes; then
2021-02-03 07:19:19 -05:00
AC_MSG_ERROR([Could not find libmnl, libmnl.h])
2024-07-01 08:36:33 -04:00
fi
2020-01-11 09:58:55 -05:00
], [
#include <netinet/in.h>
#include <net/if.h>
])
2019-05-02 07:43:30 -04:00
;;
no|*)
# nothing
;;
esac
2021-01-05 04:27:13 -05:00
AC_ARG_ENABLE(explicit-port-randomisation, AS_HELP_STRING([--disable-explicit-port-randomisation],[disable explicit source port randomisation and rely on the kernel to provide random source ports]))
2020-01-10 07:55:55 -05:00
case "$enable_explicit_port_randomisation" in
no)
AC_DEFINE([DISABLE_EXPLICIT_PORT_RANDOMISATION], [1], [Define this to enable kernel based UDP source port randomization.])
;;
yes|*)
;;
esac
2020-12-17 11:00:54 -05:00
if echo "$host" | $GREP -i -e linux >/dev/null; then
2023-08-31 03:19:24 -04:00
AC_ARG_ENABLE(linux-ip-local-port-range, AS_HELP_STRING([--enable-linux-ip-local-port-range], [Define this to enable use of /proc/sys/net/ipv4/ip_local_port_range as a default outgoing port range. This is only for the libunbound on Linux and does not affect unbound resolving daemon itself. This may severely limit the number of available outgoing ports and thus decrease randomness. Define this only when the target system restricts (e.g. some of SELinux enabled distributions) the use of non-ephemeral ports.]))
2020-12-17 11:00:54 -05:00
case "$enable_linux_ip_local_port_range" in
yes)
AC_DEFINE([USE_LINUX_IP_LOCAL_PORT_RANGE], [1], [Define this to enable use of /proc/sys/net/ipv4/ip_local_port_range as a default outgoing port range. This is only for the libunbound on Linux and does not affect unbound resolving daemon itself. This may severely limit the number of available outgoing ports and thus decrease randomness. Define this only when the target system restricts (e.g. some of SELinux enabled distributions) the use of non-ephemeral ports.])
;;
no|*)
;;
esac
fi
2019-05-02 07:43:30 -04:00
2011-11-11 05:54:45 -05:00
AC_MSG_CHECKING([if ${MAKE:-make} supports $< with implicit rule in scope])
# on openBSD, the implicit rule make $< work.
2011-11-11 08:02:48 -05:00
# on Solaris, it does not work ($? is changed sources, $^ lists dependencies).
2011-11-11 05:54:45 -05:00
# gmake works.
cat >conftest.make <<EOF
all: conftest.lo
conftest.lo foo.lo bla.lo:
if test -f "\$<"; then touch \$@; fi
.SUFFIXES: .lo
.c.lo:
if test -f "\$<"; then touch \$@; fi
conftest.lo: conftest.dir/conftest.c
EOF
mkdir conftest.dir
touch conftest.dir/conftest.c
rm -f conftest.lo conftest.c
2011-11-11 05:58:51 -05:00
${MAKE:-make} -f conftest.make >/dev/null
2011-11-11 05:54:45 -05:00
rm -f conftest.make conftest.c conftest.dir/conftest.c
rm -rf conftest.dir
if test ! -f conftest.lo; then
2011-11-11 05:31:35 -05:00
AC_MSG_RESULT(no)
2011-11-11 08:02:48 -05:00
SOURCEDETERMINE='echo "$^" | awk "-F " "{print \$$1;}" > .source'
2011-11-11 05:31:35 -05:00
SOURCEFILE='`cat .source`'
else
AC_MSG_RESULT(yes)
SOURCEDETERMINE=':'
SOURCEFILE='$<'
fi
2011-11-11 05:54:45 -05:00
rm -f conftest.lo
2011-11-11 05:31:35 -05:00
AC_SUBST(SOURCEDETERMINE)
AC_SUBST(SOURCEFILE)
2012-06-19 08:20:11 -04:00
# see if we want to build the library or everything
ALLTARGET="alltargets"
2013-11-03 18:12:55 -05:00
INSTALLTARGET="install-all"
2021-01-05 04:27:13 -05:00
AC_ARG_WITH(libunbound-only, AS_HELP_STRING([--with-libunbound-only],[do not build daemon and tool programs]),
2012-06-19 08:20:11 -04:00
[
if test "$withval" = "yes"; then
ALLTARGET="lib"
2013-11-03 18:12:55 -05:00
INSTALLTARGET="install-lib"
2012-06-19 08:20:11 -04:00
fi
])
2017-12-07 05:51:22 -05:00
if test $ALLTARGET = "alltargets"; then
2023-04-20 11:39:55 -04:00
if test $USE_NSS = "yes"; then
AC_MSG_ERROR([--with-nss can only be used in combination with --with-libunbound-only.])
2017-12-07 05:51:22 -05:00
fi
if test $USE_NETTLE = "yes"; then
2023-04-20 11:39:55 -04:00
AC_MSG_ERROR([--with-nettle can only be used in combination with --with-libunbound-only.])
2017-12-07 05:51:22 -05:00
fi
fi
2012-06-19 08:20:11 -04:00
AC_SUBST(ALLTARGET)
2013-11-03 18:12:55 -05:00
AC_SUBST(INSTALLTARGET)
2012-06-19 08:20:11 -04:00
2019-05-09 11:07:01 -04:00
ACX_STRIP_EXT_FLAGS
2017-08-08 05:43:51 -04:00
if test -n "$LATE_LDFLAGS"; then
LDFLAGS="$LATE_LDFLAGS $LDFLAGS"
fi
2023-04-20 11:39:55 -04:00
# remove start spaces
2017-08-08 05:43:51 -04:00
LDFLAGS=`echo "$LDFLAGS"|sed -e 's/^ *//'`
LIBS=`echo "$LIBS"|sed -e 's/^ *//'`
2007-10-18 09:05:41 -04:00
2009-09-10 09:13:55 -04:00
AC_DEFINE_UNQUOTED([MAXSYSLOGMSGLEN], [10240], [Define to the maximum message length to pass to syslog.])
2007-01-03 05:42:32 -05:00
2009-03-24 06:42:57 -04:00
AH_BOTTOM(
dnl this must be first AH_CONFIG, to define the flags before any includes.
AHX_CONFIG_EXT_FLAGS
dnl includes
[
2019-05-29 07:28:03 -04:00
#ifndef _OPENBSD_SOURCE
#define _OPENBSD_SOURCE 1
#endif
2008-01-14 04:51:20 -05:00
#ifndef UNBOUND_DEBUG
2019-03-07 03:34:00 -05:00
# ifndef NDEBUG
2008-01-14 04:51:20 -05:00
# define NDEBUG
2019-03-07 03:34:00 -05:00
# endif
2008-01-14 04:51:20 -05:00
#endif
2013-10-31 11:09:26 -04:00
/** Use small-ldns codebase */
#define USE_SLDNS 1
#ifdef HAVE_SSL
# define LDNS_BUILD_CONFIG_HAVE_SSL 1
#endif
2007-01-03 03:53:52 -05:00
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <assert.h>
#if STDC_HEADERS
#include <stdlib.h>
#include <stddef.h>
#endif
2013-10-31 11:17:53 -04:00
#ifdef HAVE_STDARG_H
#include <stdarg.h>
#endif
2007-01-03 03:53:52 -05:00
#ifdef HAVE_STDINT_H
#include <stdint.h>
#endif
2007-02-20 10:28:27 -05:00
#include <errno.h>
2007-01-03 03:53:52 -05:00
#if HAVE_SYS_PARAM_H
#include <sys/param.h>
#endif
#ifdef HAVE_SYS_SOCKET_H
#include <sys/socket.h>
#endif
2007-03-29 09:05:47 -04:00
#ifdef HAVE_SYS_UIO_H
#include <sys/uio.h>
#endif
2007-01-03 03:53:52 -05:00
#ifdef HAVE_NETINET_IN_H
#include <netinet/in.h>
#endif
2016-01-05 05:03:59 -05:00
#ifdef HAVE_NETINET_TCP_H
#include <netinet/tcp.h>
#endif
2007-01-03 03:53:52 -05:00
#ifdef HAVE_ARPA_INET_H
#include <arpa/inet.h>
#endif
2007-01-03 05:42:32 -05:00
2008-05-22 09:30:22 -04:00
#ifdef HAVE_WINSOCK2_H
#include <winsock2.h>
#endif
#ifdef HAVE_WS2TCPIP_H
#include <ws2tcpip.h>
#endif
2014-01-16 11:01:37 -05:00
2022-03-02 08:34:36 -05:00
#if !defined(USE_WINSOCK) || !defined(HAVE_SNPRINTF) || defined(SNPRINTF_RET_BROKEN) || defined(__USE_MINGW_ANSI_STDIO)
2014-01-16 11:01:37 -05:00
#define ARG_LL "%ll"
#else
#define ARG_LL "%I64"
#endif
2015-01-23 10:23:58 -05:00
#ifndef AF_LOCAL
#define AF_LOCAL AF_UNIX
#endif
2009-03-24 06:42:57 -04:00
]
AHX_CONFIG_FORMAT_ATTRIBUTE
AHX_CONFIG_UNUSED_ATTRIBUTE
AHX_CONFIG_FSEEKO
AHX_CONFIG_MAXHOSTNAMELEN
2015-10-27 09:47:50 -04:00
#if !defined(HAVE_SNPRINTF) || defined(SNPRINTF_RET_BROKEN)
#define snprintf snprintf_unbound
#define vsnprintf vsnprintf_unbound
#include <stdarg.h>
int snprintf (char *str, size_t count, const char *fmt, ...);
int vsnprintf (char *str, size_t count, const char *fmt, va_list arg);
#endif /* HAVE_SNPRINTF or SNPRINTF_RET_BROKEN */
2009-03-24 06:42:57 -04:00
AHX_CONFIG_INET_PTON(unbound)
AHX_CONFIG_INET_NTOP(unbound)
AHX_CONFIG_INET_ATON(unbound)
AHX_CONFIG_MEMMOVE(unbound)
2013-10-31 11:09:26 -04:00
AHX_CONFIG_STRLCAT(unbound)
2009-03-24 06:42:57 -04:00
AHX_CONFIG_STRLCPY(unbound)
AHX_CONFIG_GMTIME_R(unbound)
2015-03-17 04:24:24 -04:00
AHX_CONFIG_REALLOCARRAY(unbound)
2009-03-24 06:42:57 -04:00
AHX_CONFIG_W32_SLEEP
AHX_CONFIG_W32_USLEEP
AHX_CONFIG_W32_RANDOM
AHX_CONFIG_W32_SRANDOM
AHX_CONFIG_W32_FD_SET_T
AHX_CONFIG_IPV6_MIN_MTU
2010-02-01 08:27:23 -05:00
AHX_MEMCMP_BROKEN(unbound)
2009-03-24 06:42:57 -04:00
[
2009-08-25 09:05:31 -04:00
#ifndef HAVE_CTIME_R
#define ctime_r unbound_ctime_r
char *ctime_r(const time_t *timep, char *buf);
#endif
2016-05-31 08:27:41 -04:00
#ifndef HAVE_STRSEP
#define strsep unbound_strsep
char *strsep(char **stringp, const char *delim);
#endif
2015-10-27 05:52:16 -04:00
#ifndef HAVE_ISBLANK
#define isblank unbound_isblank
int isblank(int c);
#endif
2016-12-15 08:10:58 -05:00
2018-09-17 03:06:57 -04:00
#ifndef HAVE_EXPLICIT_BZERO
#define explicit_bzero unbound_explicit_bzero
void explicit_bzero(void* buf, size_t len);
#endif
2016-12-15 08:10:58 -05:00
#if defined(HAVE_INET_NTOP) && !HAVE_DECL_INET_NTOP
const char *inet_ntop(int af, const void *src, char *dst, size_t size);
#endif
#if defined(HAVE_INET_PTON) && !HAVE_DECL_INET_PTON
int inet_pton(int af, const char* src, void* dst);
#endif
2015-10-27 05:52:16 -04:00
2010-09-29 04:31:31 -04:00
#if !defined(HAVE_STRPTIME) || !defined(STRPTIME_WORKS)
2010-09-28 10:58:35 -04:00
#define strptime unbound_strptime
struct tm;
char *strptime(const char *s, const char *format, struct tm *tm);
#endif
2019-09-19 04:09:49 -04:00
#if !HAVE_DECL_REALLOCARRAY
void *reallocarray(void *ptr, size_t nmemb, size_t size);
#endif
2017-02-16 07:37:41 -05:00
#ifdef HAVE_LIBBSD
#include <bsd/string.h>
#include <bsd/stdlib.h>
#endif
2014-07-12 10:13:45 -04:00
#ifdef HAVE_LIBRESSL
# if !HAVE_DECL_STRLCPY
size_t strlcpy(char *dst, const char *src, size_t siz);
# endif
# if !HAVE_DECL_STRLCAT
size_t strlcat(char *dst, const char *src, size_t siz);
# endif
2014-07-12 13:13:38 -04:00
# if !HAVE_DECL_ARC4RANDOM && defined(HAVE_ARC4RANDOM)
2014-07-12 10:13:45 -04:00
uint32_t arc4random(void);
# endif
2014-07-12 13:13:38 -04:00
# if !HAVE_DECL_ARC4RANDOM_UNIFORM && defined(HAVE_ARC4RANDOM_UNIFORM)
2014-07-12 10:13:45 -04:00
uint32_t arc4random_uniform(uint32_t upper_bound);
# endif
#endif /* HAVE_LIBRESSL */
#ifndef HAVE_ARC4RANDOM
2014-07-11 05:27:24 -04:00
int getentropy(void* buf, size_t len);
uint32_t arc4random(void);
void arc4random_buf(void* buf, size_t n);
void _ARC4_LOCK(void);
void _ARC4_UNLOCK(void);
2018-02-02 04:27:16 -05:00
void _ARC4_LOCK_DESTROY(void);
2014-07-11 05:27:24 -04:00
#endif
#ifndef HAVE_ARC4RANDOM_UNIFORM
uint32_t arc4random_uniform(uint32_t upper_bound);
#endif
2014-07-11 12:44:26 -04:00
#ifdef COMPAT_SHA512
2014-07-11 12:35:05 -04:00
#ifndef SHA512_DIGEST_LENGTH
#define SHA512_BLOCK_LENGTH 128
#define SHA512_DIGEST_LENGTH 64
#define SHA512_DIGEST_STRING_LENGTH (SHA512_DIGEST_LENGTH * 2 + 1)
typedef struct _SHA512_CTX {
uint64_t state[8];
uint64_t bitcount[2];
uint8_t buffer[SHA512_BLOCK_LENGTH];
} SHA512_CTX;
#endif /* SHA512_DIGEST_LENGTH */
void SHA512_Init(SHA512_CTX*);
void SHA512_Update(SHA512_CTX*, void*, size_t);
void SHA512_Final(uint8_t[SHA512_DIGEST_LENGTH], SHA512_CTX*);
unsigned char *SHA512(void* data, unsigned int data_len, unsigned char *digest);
2014-07-11 12:44:26 -04:00
#endif /* COMPAT_SHA512 */
2014-07-11 12:35:05 -04:00
2014-07-11 05:27:24 -04:00
2010-10-29 11:03:20 -04:00
#if defined(HAVE_EVENT_H) && !defined(HAVE_EVENT_BASE_ONCE) && !(defined(HAVE_EV_LOOP) || defined(HAVE_EV_DEFAULT_LOOP)) && (defined(HAVE_PTHREAD) || defined(HAVE_SOLARIS_THREADS))
2007-03-02 04:48:31 -05:00
/* using version of libevent that is not threadsafe. */
# define LIBEVENT_SIGNAL_PROBLEM 1
#endif
2007-01-03 05:42:32 -05:00
2007-02-16 18:00:31 -05:00
#ifndef CHECKED_INET6
# define CHECKED_INET6
# ifdef AF_INET6
# define INET6
# else
# define AF_INET6 28
# endif
#endif /* CHECKED_INET6 */
2007-02-16 10:18:52 -05:00
2007-02-16 10:33:57 -05:00
#ifndef HAVE_GETADDRINFO
2007-02-16 10:53:45 -05:00
struct sockaddr_storage;
2007-02-16 10:33:57 -05:00
#include "compat/fake-rfc2553.h"
#endif
2008-06-13 09:20:54 -04:00
2007-08-10 05:07:19 -04:00
#ifdef UNBOUND_ALLOC_STATS
2007-08-14 09:15:36 -04:00
# define malloc(s) unbound_stat_malloc_log(s, __FILE__, __LINE__, __func__)
# define calloc(n,s) unbound_stat_calloc_log(n, s, __FILE__, __LINE__, __func__)
# define free(p) unbound_stat_free_log(p, __FILE__, __LINE__, __func__)
# define realloc(p,s) unbound_stat_realloc_log(p, s, __FILE__, __LINE__, __func__)
2024-08-02 02:54:54 -04:00
# define strdup(s) unbound_stat_strdup_log(s, __FILE__, __LINE__, __func__)
2007-08-10 05:07:19 -04:00
void *unbound_stat_malloc(size_t size);
void *unbound_stat_calloc(size_t nmemb, size_t size);
void unbound_stat_free(void *ptr);
void *unbound_stat_realloc(void *ptr, size_t size);
2007-08-14 09:15:36 -04:00
void *unbound_stat_malloc_log(size_t size, const char* file, int line,
const char* func);
void *unbound_stat_calloc_log(size_t nmemb, size_t size, const char* file,
int line, const char* func);
void unbound_stat_free_log(void *ptr, const char* file, int line,
const char* func);
void *unbound_stat_realloc_log(void *ptr, size_t size, const char* file,
int line, const char* func);
2024-08-02 02:54:54 -04:00
char *unbound_stat_strdup_log(const char *s, const char* file, int line,
const char* func);
2010-03-09 11:26:53 -05:00
#elif defined(UNBOUND_ALLOC_LITE)
# include "util/alloc.h"
#endif /* UNBOUND_ALLOC_LITE and UNBOUND_ALLOC_STATS */
2007-08-10 05:07:19 -04:00
2007-02-22 08:36:29 -05:00
/** default port for DNS traffic. */
#define UNBOUND_DNS_PORT 53
2018-04-19 10:23:14 -04:00
/** default port for DNS over TLS traffic. */
#define UNBOUND_DNS_OVER_TLS_PORT 853
2020-05-07 10:36:26 -04:00
/** default port for DNS over HTTPS traffic. */
#define UNBOUND_DNS_OVER_HTTPS_PORT 443
DNSoverQUIC (#871)
* - dnsoverquic, configure --with-libngtcp2 option.
* - dnsoverquic, create comm_point for doq and receive cmsg local address.
* - dnsoverquic, less obtrusive debug.
* - dnsoverquic, log and fix local port number. Neater subroutines and ifdefs.
* - dnsoverquic, add testcode/doqclient.
* - dnsoverquic, review fixes on doqclient.
* - dnsoverquic, fix unit test testbound link.
* - dnsoverquic, parse query in doqclient.
* - dnsoverquic, link with libngtcp2_crypto_openssl and code for doqclient.
* - dnsoverquic, random routine for doqclient and fix ngaddr allocation, and
check ub_initstate return.
* - dnsoverquic, fix doqclient free of allocated ngaddr addresses.
* - dnsoverquic, enable debug output with -v for doqclient.
* - dnsoverquic, create and set TLS object and TLS context in doqclient.
* - dnsoverquic, work on quic tls context in doqclient.
* - dnsoverquic, set default dnsoverquic port to the standardized 853 port.
* - dnsoverquic, remove debug comment.
* - dnsoverquic, dns-over-quic quic-port: 853 config option.
* - dnsoverquic, log type of interface created at start of unbound.
* - dnsoverquic, log type of no tls https as https when interface is created.
* - dnsoverquic, setup client quic tls methods.
* - dnsoverquic, event work in doqclient.
* - dnsoverquic, explain in documentation that QUIC uses UDP.
* - dnsoverquic, make doqclient exit.
* - dnsoverquic, doqclient cleanup run routine.
* - dnsoverquic, doqclient code nicer.
* - dnsoverquic, doqclient read and timer.
* - dnsoverquic, doqclient write work.
* - dnsoverquic, review fixes.
* - dnsoverquic, detect openssl quic support at configure time.
* - dnsoverquic, do not allow QUIC on port 53 to stop confusion of DoQ and DNS.
* - dnsoverquic, in doqclient, when idle close is returned, drop the connection
without calling ngtcp2_conn_write_connection_close.
* - dnsoverquic, in doqclient, log callbacks.
* - dnsoverquic, in doqclient add extend_max_local_streams_bidi callback.
* - dnsoverquic, in doqclient add client query lists.
* - dnsoverquic, in doqclient, code cleaner, log text nicer.
* - dnsoverquic, in doqclient, work on write_streams.
* - dnsoverquic, in doqclient, use signed int for stream_id, work on the
ngtcp2_recv_stream_data callback.
* - dnsoverquic, in doqclient, print result and fixes for recv data.
* - dnsoverquic, in doqclient, add the event callbacks to fptr wlist.
* - dnsoverquic, in doqclient, when already expired, use zero timeout timer.
* - dnsoverquic, in doqclient, ignore unused return codes from
ngtcp2_conn_writev_stream.
* - dnsoverquic, add doqclient event functions to the unbound-dnstap-socket
test tool for linking.
* - dnsoverquic, in doqclient, fix multiple operands for the commandline.
neater dns message output.
* - dnsoverquic, in doqclient, store packet when write blocks and try later.
* - dnsoverquic, in doqclient, limit number of packets and number of bytes sent.
* - dnsoverquic, in doqclient, better size estimate for outgoing packet.
* - dnsoverquic, in doqclient, fix that already written next packet is not
counted for data length to send.
* - dnsoverquic, in doqclient, early data transmission and session resumption.
* - dnsoverquic, send version negotiation packet.
* - dnsoverquic, send retry and accept the connection.
* - dnsoverquic, storage structures.
* - dnsoverquic, doq connection setup.
* - dnsoverquic, neater code layout for new conn. Fix verbosity of log print.
* - dnsoverquic, doq conn callback functions.
* - dnsoverquic, doq_fill_rand routine in header file.
* - dnsoverquic, keep track of connection ids.
* - dnsoverquic, get_new_connection_id callback.
* - dnsoverquic, create doq_conid tree.
* - dnsoverquic, settings for server connection.
* - dnsoverquic, tls context.
* - dnsoverquic, sendmsg error handling.
* - dnsoverquic, neat code.
* - dnsoverquic, track doq connection last error.
* - dnsoverquic, neater packet address parameters.
* - dnsoverquic, fix uninitialized bytes in msg control in doq sendmsg, and
fix tree cleanup of conid tree.
* - dnsoverquic, better usage text for doqclient.
* - dnsoverquic, neat code.
* - dnsoverquic, connection receive packet handling.
* - dnsoverquic, debug output.
* - dnsoverquic, debug switched meaning of scid and dcid gives
ERR_TRANSPORT_PARAM.
* - dnsoverquic, remove debug output.
* - dnsoverquic, connection delete routine and error from connection read in
more detail with less clutter.
* - dnsoverquic, write to stream, and receive stream data, log packet.
* - dnsoverquic, alpn set up.
* - dnsoverquic, connection close.
* - dnsoverquic, doq_table and locks.
* - dnsoverquic, fix tests.
* - dnsoverquic, better locking.
* - dnsoverquic, doq_stream.
* - dnsoverquic, remove compile warning.
* - dnsoverquic, doq_stream receive data.
* - dnsoverquic, fixes for locks and keep length bytes allocated.
* - dnsoverquic, lock connection on initial insertion.
* - dnsoverquic, reply information, and reply buffer.
* - dnsoverquic, reply info from cache, local-zone and recursion lookups.
* - dnsoverquic, spelling in comment about buffer storage.
* - dnsoverquic, stream write list and doqclient fixes to exit and printout.
* - dnsoverquic, doqclient -q option for short printout.
* - dnsoverquic, unit test with local data reply.
* - dnsoverquic, write connection and write event is set.
* - dnsoverquic, neater logging for write event connection stream writes.
* - dnsoverquic, log remote connection when the streams are written for it.
* - dnsoverquic, better threaded use, threads can write to doq connections at
the same time.
* - dnsoverquic, unit test for the calculation of connection size with a query.
* - dnsoverquic, use less memory per connection.
* - dnsoverquic, remove unit test output.
* - dnsoverquic, add MSG_DONTWAIT so that there is no mistakenly blocking
socket operations.
* - dnsoverquic, doqclient logs address on connection failures.
* - dnsoverquic, compat code for clock get time routine.
* - dnsoverquic, use skip_test for doq unit test.
* - dnsoverquic, fixes for proxyprotocol, use remote_addr and set proxyprotocol
disabled on the doq connection.
* - dnsoverquic, doqclient sets log identity to its name, instead of "unbound".
* - dnsoverquic, handle blocked udp packet writes.
* - dnsoverquic, fix function documentation for verbose_print_addr from
services/listen_dnsport.c.
* - dnsoverquic, fix doq_conn lock protection. The checklock allows to set
the output file name, and doqclient uses that. Print place of lock_protect.
* - dnsoverquic, neater buffer clear when write of blocked packet fails, make
sure that memory area does not overlap for blocked packet addresses when
write of blocked packet fails, and size blocked packet buffer to the pkt buf.
* - dnsoverquic, move lock check after the test to test script in doq test.
* - dnsoverquic, the doq test uses valgrind when enabled.
* - dnsoverquic, git ignore the doqclient test.
* - dnsoverquic, limit the buffer for packets to max packet size with some more.
* - dnsoverquic, spelling fix.
* - dnsoverquic, timer work, structure and adds and deletes.
* - dnsoverquic, timer_tree uses table.lock.
* - dnsoverquic, fix timer tree remove and spelling in header file comment.
* - dnsoverquic, fix testbound for timer compare function linkage.
* - dnsoverquic, timer set add debug output.
* - dnsoverquic, doq_conn_check_timer function.
* - dnsoverquic, doq_done_setup_timer_and_write function.
* - dnsoverquic, fix that doq conn is not deleted whilst editing write and timer.
* - dnsoverquic, Fix #861 make ERROR netevent.h:1073:32: error: field 'blocked_pkt_pi' has incomplete type
* - dnsoverquic, timer element has timeout setup when socket callback complete.
* - dnsoverquic, fix unit test compile.
* - dnsoverquic, timer callback routine, handle timeout and close and delete the
connection if necessary.
* - dnsoverquic, timer pickup stops at current time.
* - dnsoverquic, timer comparable with the event base time.
* - dnsoverquic, erase marked time when timer disabled.
* - dnsoverquic, fix timer to set correctly and lock popped write connection
early, before it is modified.
* - dnsoverquic, fix to unlock connection lock when it is unlinked and deleted.
* - dnsoverquic, fix to unlock connection lock when it is deleted because it is
a duplicate connection.
* - dnsoverquic, fix that doq timer is not disabled when not set.
* - dnsoverquic, quic-size: 8m maximum number of bytes for QUIC buffers.
* - dnsoverquic, flex and bison.
* - dnsoverquic, quic-size turn away new connections when full.
* - dnsoverquic, doqclient outputs stream reset information.
* - dnsoverquic, detect stream close and reset.
* - dnsoverquic, free stream buffers when data is acked and stream is closed.
* - dnsoverquic, delete stream when closed. Unlink it. Allow stream_id 4 as first.
* - dnsoverquic, stats output for mem.quic and num.query.quic.
* - dnsoverquic, review fix.
* - dnsoverquic, fix when compiled without ngtcp2.
* - dnsoverquic, fix to detect ngtcp2_crypto_quictls for openssl crypto, after
change in libngtcp2.
* - dnsoverquic, fix for newer ngtcp2 versions. detect ngtcp2_ccerr_default,
ngtcp2/ngtcp2_crypto_quictls.h, struct ngtcp2_pkt_hd.tokenlen,
struct ngtcp2_settings.tokenlen and struct ngtcp2_version_cid.
* - dnsoverquic, fix for newer ngtcp2 version, detect number of arguments for
ngtcp2_conn_shutdown_stream.
* - dnsoverquic, fix for newer ngtcp2.
* - dnsoverquic, use the functions from util/timeval_func.h.
* - dnsoverquic, fix in doqclient only write transport parameters once.
* - dnsoverquic, debug log output removed.
* - dnsoverquic, fix in doqclient to work with renamed NGTCP2_CC_ALGO_BBR_V2
from ngtcp2.
* - dnsoverquic, fix to check in doq_server_socket_create that tls-service-key
and tls-service-pem have a value.
* - dnsoverquic, fix to error when doq_server_socket_create fails.
* - dnsoverquic, improve linebreaks in configparser additions.
* - dnsoverquic, fix port from interface pickup after main branch change.
* Fix getting user data from SSL, fix calloc warning.
* Fix fwrite return value check in doqclient
* - timeval_substruct from timeval_func.h
- lock_protect also for HAVE_NGTCP2_CCERR_DEFAULT
- fix doq logging for inet_ntop failures
* - memset for consistency
- no value returned from msghdr_get_ecn when S_SPLINT_S is defined
* - dnsoverquic, rerun autoconf.
---------
Co-authored-by: Yorgos Thessalonikefs <yorgos@nlnetlabs.nl>
2024-10-09 04:32:03 -04:00
/** default port for DNS over QUIC traffic. */
#define UNBOUND_DNS_OVER_QUIC_PORT 853
2011-06-10 06:11:38 -04:00
/** default port for unbound control traffic, registered port with IANA,
ub-dns-control 8953/tcp unbound dns nameserver control */
#define UNBOUND_CONTROL_PORT 8953
/** the version of unbound-control that this software implements */
#define UNBOUND_CONTROL_VERSION 1
2007-01-03 03:53:52 -05:00
])
2014-10-06 03:42:42 -04:00
dnl if we build from source tree, the man pages need @date@ and @version@
dnl if this is a distro tarball, that was already done by makedist.sh
AC_SUBST(version, [VERSION_MAJOR.VERSION_MINOR.VERSION_MICRO])
AC_SUBST(date, [`date +'%b %e, %Y'`])
2020-01-24 18:48:25 -05:00
AC_CONFIG_FILES([Makefile doc/example.conf doc/libunbound.3 doc/unbound.8 doc/unbound-anchor.8 doc/unbound-checkconf.8 doc/unbound.conf.5 doc/unbound-control.8 doc/unbound-host.1 smallapp/unbound-control-setup.sh dnstap/dnstap_config.h dnscrypt/dnscrypt_config.h contrib/libunbound.pc contrib/unbound.socket contrib/unbound.service contrib/unbound_portable.service])
2021-01-05 04:27:13 -05:00
AC_CONFIG_HEADERS([config.h])
2007-01-03 03:53:52 -05:00
AC_OUTPUT