1# -*- Autoconf -*- 2# Process this file with autoconf to produce a configure script. 3AC_PREREQ([2.56]) 4sinclude(acx_nlnetlabs.m4) 5sinclude(ax_build_date_epoch.m4) 6sinclude(ax_pthread.m4) 7sinclude(acx_python.m4) 8sinclude(ax_pkg_swig.m4) 9sinclude(dnstap/dnstap.m4) 10sinclude(dnscrypt/dnscrypt.m4) 11 12# must be numbers. ac_defun because of later processing 13m4_define([VERSION_MAJOR],[1]) 14m4_define([VERSION_MINOR],[23]) 15m4_define([VERSION_MICRO],[1]) 16AC_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]) 17AC_SUBST(UNBOUND_VERSION_MAJOR, [VERSION_MAJOR]) 18AC_SUBST(UNBOUND_VERSION_MINOR, [VERSION_MINOR]) 19AC_SUBST(UNBOUND_VERSION_MICRO, [VERSION_MICRO]) 20 21LIBUNBOUND_CURRENT=9 22LIBUNBOUND_REVISION=32 23LIBUNBOUND_AGE=1 24# 1.0.0 had 0:12:0 25# 1.0.1 had 0:13:0 26# 1.0.2 had 0:14:0 27# 1.1.0 had 0:15:0 28# 1.1.1 had 0:16:0 29# 1.2.0 had 0:17:0 30# 1.2.1 had 0:18:0 31# 1.3.0 had 1:0:0 # ub_cancel and -export-symbols. 32# 1.3.1 had 1:1:0 33# 1.3.2 had 1:2:0 34# 1.3.3 had 1:3:0 35# 1.3.4 had 1:4:0 36# 1.4.0-snapshots had 1:5:0 37# 1.4.0 had 1:5:0 (not 2:0:0) # ub_result.why_bogus 38# 1.4.1 had 2:1:0 39# 1.4.2 had 2:2:0 40# 1.4.3 had 2:3:0 41# 1.4.4 had 2:4:0 42# 1.4.5 had 2:5:0 43# 1.4.6 had 2:6:0 44# 1.4.7 had 2:7:0 45# 1.4.8 had 2:8:0 46# 1.4.9 had 2:9:0 47# 1.4.10 had 2:10:0 48# 1.4.11 had 2:11:0 49# 1.4.12 had 2:12:0 50# 1.4.13 had 2:13:0 51# and 1.4.13p1 and 1.4.13.p2 52# 1.4.14 had 2:14:0 53# 1.4.15 had 3:0:1 # adds ub_version() 54# 1.4.16 had 3:1:1 55# 1.4.17 had 3:2:1 56# 1.4.18 had 3:3:1 57# 1.4.19 had 3:4:1 58# 1.4.20 had 4:0:2 # adds libunbound.ttl # but shipped 3:5:1 59# 1.4.21 had 4:1:2 60# 1.4.22 had 4:1:2 61# 1.5.0 had 5:3:3 # adds ub_ctx_add_ta_autr 62# 1.5.1 had 5:3:3 63# 1.5.2 had 5:5:3 64# 1.5.3 had 5:6:3 65# 1.5.4 had 5:7:3 66# 1.5.5 had 5:8:3 67# 1.5.6 had 5:9:3 68# 1.5.7 had 5:10:3 69# 1.5.8 had 6:0:4 # adds ub_ctx_set_stub 70# 1.5.9 had 6:1:4 71# 1.5.10 had 6:2:4 72# 1.6.0 had 6:3:4 73# 1.6.1 had 7:0:5 # ub_callback_t typedef renamed to ub_callback_type 74# 1.6.2 had 7:1:5 75# 1.6.3 had 7:2:5 76# 1.6.4 had 7:3:5 77# 1.6.5 had 7:4:5 78# 1.6.6 had 7:5:5 79# 1.6.7 had 7:6:5 80# 1.6.8 had 7:7:5 81# 1.7.0 had 7:8:5 82# 1.7.1 had 7:9:5 83# 1.7.2 had 7:10:5 84# 1.7.3 had 7:11:5 85# 1.8.0 had 8:0:0 # changes the event callback function signature 86# 1.8.1 had 8:1:0 87# 1.8.2 had 8:2:0 88# 1.8.3 had 8:3:0 89# 1.9.0 had 9:0:1 # add ub_ctx_set_tls 90# 1.9.1 had 9:1:1 91# 1.9.2 had 9:2:1 92# 1.9.3 had 9:3:1 93# 1.9.4 had 9:4:1 94# 1.9.5 had 9:5:1 95# 1.9.6 had 9:6:1 96# 1.10.0 had 9:7:1 97# 1.10.1 had 9:8:1 98# 1.11.0 had 9:9:1 99# 1.12.0 had 9:10:1 100# 1.13.0 had 9:11:1 101# 1.13.1 had 9:12:1 102# 1.13.2 had 9:13:1 103# 1.14.0 had 9:14:1 104# 1.15.0 had 9:15:1 105# 1.16.0 had 9:16:1 106# 1.16.1 had 9:17:1 107# 1.16.2 had 9:18:1 108# 1.16.3 had 9:19:1 109# 1.17.0 had 9:20:1 110# 1.17.1 had 9:21:1 111# 1.18.0 had 9:22:1 112# 1.19.0 had 9:23:1 113# 1.19.1 had 9:24:1 114# 1.19.2 had 9:25:1 115# 1.19.3 had 9:26:1 116# 1.20.0 had 9:27:1 117# 1.21.0 had 9:28:1 118# 1.21.1 had 9:29:1 119# 1.22.0 had 9:30:1 120# 1.23.0 had 9:31:1 121# 1.23.1 had 9:32:1 122 123# Current -- the number of the binary API that we're implementing 124# Revision -- which iteration of the implementation of the binary 125# API are we supplying? 126# Age -- How many previous binary API versions do we also 127# support? 128# 129# If we release a new version that does not change the binary API, 130# increment Revision. 131# 132# If we release a new version that changes the binary API, but does 133# not break programs compiled against the old binary API, increment 134# Current and Age. Set Revision to 0, since this is the first 135# implementation of the new API. 136# 137# Otherwise, we're changing the binary API and breaking backward 138# compatibility with old binaries. Increment Current. Set Age to 0, 139# since we're backward compatible with no previous APIs. Set Revision 140# to 0 too. 141AC_SUBST(LIBUNBOUND_CURRENT) 142AC_SUBST(LIBUNBOUND_REVISION) 143AC_SUBST(LIBUNBOUND_AGE) 144 145 146cmdln="`echo $@ | sed -e 's/\\\\/\\\\\\\\/g' | sed -e 's/"/\\\\"/'g`" 147AC_DEFINE_UNQUOTED(CONFCMDLINE, ["$cmdln"], [Command line arguments used with configure]) 148 149CFLAGS="$CFLAGS" 150AC_USE_SYSTEM_EXTENSIONS 151if test "$ac_cv_header_minix_config_h" = "yes"; then 152 AC_DEFINE(_NETBSD_SOURCE,1, [Enable for compile on Minix]) 153fi 154 155dnl 156dnl By default set prefix to /usr/local 157dnl 158case "$prefix" in 159 NONE) 160 prefix="/usr/local" 161 ;; 162esac 163case "$exec_prefix" in 164 NONE) 165 exec_prefix="$prefix" 166 ;; 167esac 168 169# are we on MinGW? 170if uname -s 2>&1 | grep MINGW >/dev/null; then on_mingw="yes" 171else 172 if echo $host | grep mingw >/dev/null; then on_mingw="yes" 173 else on_mingw="no"; fi 174fi 175 176# 177# Determine configuration file 178# the eval is to evaluate shell expansion twice 179UNBOUND_SBIN_DIR=`eval echo "${sbindir}"` 180AC_SUBST(UNBOUND_SBIN_DIR) 181UNBOUND_SYSCONF_DIR=`eval echo "${sysconfdir}"` 182AC_SUBST(UNBOUND_SYSCONF_DIR) 183UNBOUND_LOCALSTATE_DIR=`eval echo "${localstatedir}"` 184AC_SUBST(UNBOUND_LOCALSTATE_DIR) 185if test $on_mingw = "no"; then 186 ub_conf_file=`eval echo "${sysconfdir}/unbound/unbound.conf"` 187else 188 ub_conf_file="C:\\Program Files\\Unbound\\service.conf" 189fi 190AC_ARG_WITH([conf_file], 191 AS_HELP_STRING([--with-conf-file=path],[Pathname to the Unbound configuration file]), 192 [ub_conf_file="$withval"]) 193AC_SUBST(ub_conf_file) 194ACX_ESCAPE_BACKSLASH($ub_conf_file, hdr_config) 195AC_DEFINE_UNQUOTED(CONFIGFILE, ["$hdr_config"], [Pathname to the Unbound configuration file]) 196ub_conf_dir=`AS_DIRNAME(["$ub_conf_file"])` 197AC_SUBST(ub_conf_dir) 198 199# Determine run, chroot directory and pidfile locations 200AC_ARG_WITH(run-dir, 201 AS_HELP_STRING([--with-run-dir=path],[set default directory to chdir to (by default dir part of cfg file)]), 202 UNBOUND_RUN_DIR="$withval", 203if test $on_mingw = no; then 204 UNBOUND_RUN_DIR=`dirname "$ub_conf_file"` 205else 206 UNBOUND_RUN_DIR="" 207fi 208) 209AC_SUBST(UNBOUND_RUN_DIR) 210ACX_ESCAPE_BACKSLASH($UNBOUND_RUN_DIR, hdr_run) 211AC_DEFINE_UNQUOTED(RUN_DIR, ["$hdr_run"], [Directory to chdir to]) 212 213AC_ARG_WITH(chroot-dir, 214 AS_HELP_STRING([--with-chroot-dir=path],[set default directory to chroot to (by default same as run-dir)]), 215 UNBOUND_CHROOT_DIR="$withval", 216if test $on_mingw = no; then 217 UNBOUND_CHROOT_DIR="$UNBOUND_RUN_DIR" 218else 219 UNBOUND_CHROOT_DIR="" 220fi 221) 222AC_SUBST(UNBOUND_CHROOT_DIR) 223ACX_ESCAPE_BACKSLASH($UNBOUND_CHROOT_DIR, hdr_chroot) 224AC_DEFINE_UNQUOTED(CHROOT_DIR, ["$hdr_chroot"], [Directory to chroot to]) 225 226AC_ARG_WITH(share-dir, 227 AS_HELP_STRING([--with-share-dir=path],[set default directory with shared data (by default same as share/unbound)]), 228 UNBOUND_SHARE_DIR="$withval", 229 UNBOUND_SHARE_DIR="$UNBOUND_RUN_DIR") 230AC_SUBST(UNBOUND_SHARE_DIR) 231AC_DEFINE_UNQUOTED(SHARE_DIR, ["$UNBOUND_SHARE_DIR"], [Shared data]) 232 233AC_ARG_WITH(pidfile, 234 AS_HELP_STRING([--with-pidfile=filename],[set default pathname to unbound pidfile (default run-dir/unbound.pid)]), 235 UNBOUND_PIDFILE="$withval", 236if test $on_mingw = no; then 237 UNBOUND_PIDFILE="$UNBOUND_RUN_DIR/unbound.pid" 238else 239 UNBOUND_PIDFILE="" 240fi 241) 242AC_SUBST(UNBOUND_PIDFILE) 243ACX_ESCAPE_BACKSLASH($UNBOUND_PIDFILE, hdr_pid) 244AC_DEFINE_UNQUOTED(PIDFILE, ["$hdr_pid"], [default pidfile location]) 245 246AC_ARG_WITH(rootkey-file, 247 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.]), 248 UNBOUND_ROOTKEY_FILE="$withval", 249if test $on_mingw = no; then 250 UNBOUND_ROOTKEY_FILE="$UNBOUND_RUN_DIR/root.key" 251else 252 UNBOUND_ROOTKEY_FILE="C:\\Program Files\\Unbound\\root.key" 253fi 254) 255AC_SUBST(UNBOUND_ROOTKEY_FILE) 256ACX_ESCAPE_BACKSLASH($UNBOUND_ROOTKEY_FILE, hdr_rkey) 257AC_DEFINE_UNQUOTED(ROOT_ANCHOR_FILE, ["$hdr_rkey"], [default rootkey location]) 258 259AC_ARG_WITH(rootcert-file, 260 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.]), 261 UNBOUND_ROOTCERT_FILE="$withval", 262if test $on_mingw = no; then 263 UNBOUND_ROOTCERT_FILE="$UNBOUND_RUN_DIR/icannbundle.pem" 264else 265 UNBOUND_ROOTCERT_FILE="C:\\Program Files\\Unbound\\icannbundle.pem" 266fi 267) 268AC_SUBST(UNBOUND_ROOTCERT_FILE) 269ACX_ESCAPE_BACKSLASH($UNBOUND_ROOTCERT_FILE, hdr_rpem) 270AC_DEFINE_UNQUOTED(ROOT_CERT_FILE, ["$hdr_rpem"], [default rootcert location]) 271 272AC_ARG_WITH(username, 273 AS_HELP_STRING([--with-username=user],[set default user that unbound changes to (default user is unbound)]), 274 UNBOUND_USERNAME="$withval", 275 UNBOUND_USERNAME="unbound") 276AC_SUBST(UNBOUND_USERNAME) 277AC_DEFINE_UNQUOTED(UB_USERNAME, ["$UNBOUND_USERNAME"], [default username]) 278 279AC_DEFINE(WINVER, 0x0502, [the version of the windows API enabled]) 280ACX_RSRC_VERSION(wnvs) 281AC_DEFINE_UNQUOTED(RSRC_PACKAGE_VERSION, [$wnvs], [version number for resource files]) 282 283# Check for 'grep -e' program, here, since ACX_CHECK_FLTO needs that. 284AC_PROG_GREP 285 286# Checks for typedefs, structures, and compiler characteristics. 287AC_C_CONST 288AC_LANG([C]) 289# allow user to override the -g -O2 flags. 290default_cflags=no 291if test "x$CFLAGS" = "x" ; then 292ACX_CHECK_COMPILER_FLAG(g, [CFLAGS="$CFLAGS -g"]) 293ACX_CHECK_COMPILER_FLAG(O2, [CFLAGS="$CFLAGS -O2"]) 294default_cflags=yes 295fi 296m4_version_prereq([2.70], [AC_PROG_CC], [AC_PROG_CC_STDC]) 297ACX_DEPFLAG 298ACX_DETERMINE_EXT_FLAGS_UNBOUND 299 300# debug mode flags warnings 301AC_ARG_ENABLE(checking, AS_HELP_STRING([--enable-checking],[Enable warnings, asserts, makefile-dependencies])) 302AC_ARG_ENABLE(debug, AS_HELP_STRING([--enable-debug],[same as enable-checking])) 303if test "$enable_debug" = "yes"; then debug_enabled="$enable_debug"; 304else debug_enabled="$enable_checking"; fi 305AC_SUBST(debug_enabled) 306case "$debug_enabled" in 307 yes) 308 ACX_CHECK_COMPILER_FLAG(W, [CFLAGS="$CFLAGS -W"]) 309 ACX_CHECK_COMPILER_FLAG(Wall, [CFLAGS="$CFLAGS -Wall"]) 310 ACX_CHECK_COMPILER_FLAG(Wextra, [CFLAGS="$CFLAGS -Wextra"]) 311 ACX_CHECK_COMPILER_FLAG(Wdeclaration-after-statement, [CFLAGS="$CFLAGS -Wdeclaration-after-statement"]) 312 AC_DEFINE([UNBOUND_DEBUG], [], [define this to enable debug checks.]) 313 ;; 314 no|*) 315 # nothing to do. 316 ;; 317esac 318if test "$default_cflags" = "yes"; then 319 # only when CFLAGS was "" at the start, if the users wants to 320 # override we shouldn't add default cflags, because they wouldn't 321 # be able to turn off these options and set the CFLAGS wanted. 322 ACX_CHECK_FLTO 323 ACX_CHECK_PIE 324 ACX_CHECK_RELRO_NOW 325fi 326 327AC_C_INLINE 328ACX_CHECK_FORMAT_ATTRIBUTE 329ACX_CHECK_UNUSED_ATTRIBUTE 330 331AC_DEFUN([CHECK_WEAK_ATTRIBUTE], 332[AC_REQUIRE([AC_PROG_CC]) 333AC_MSG_CHECKING(whether the C compiler (${CC-cc}) accepts the "weak" attribute) 334AC_CACHE_VAL(ac_cv_c_weak_attribute, 335[ac_cv_c_weak_attribute=no 336AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <stdio.h> 337__attribute__((weak)) void f(int x) { printf("%d", x); } 338]], [[ 339 f(1); 340]])],[ac_cv_c_weak_attribute="yes"],[ac_cv_c_weak_attribute="no"]) 341]) 342 343AC_MSG_RESULT($ac_cv_c_weak_attribute) 344if test $ac_cv_c_weak_attribute = yes; then 345 AC_DEFINE(HAVE_ATTR_WEAK, 1, [Whether the C compiler accepts the "weak" attribute]) 346 AC_DEFINE(ATTR_WEAK, [__attribute__((weak))], [apply the weak attribute to a symbol]) 347else 348 AC_DEFINE(ATTR_WEAK,[], [apply the weak attribute to a symbol]) 349fi 350])dnl End of CHECK_WEAK_ATTRIBUTE 351 352CHECK_WEAK_ATTRIBUTE 353 354AC_DEFUN([CHECK_NORETURN_ATTRIBUTE], 355[AC_REQUIRE([AC_PROG_CC]) 356AC_MSG_CHECKING(whether the C compiler (${CC-cc}) accepts the "noreturn" attribute) 357AC_CACHE_VAL(ac_cv_c_noreturn_attribute, 358[ac_cv_c_noreturn_attribute=no 359AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <stdio.h> 360__attribute__((noreturn)) void f(int x) { printf("%d", x); } 361]], [[ 362 f(1); 363]])],[ac_cv_c_noreturn_attribute="yes"],[ac_cv_c_noreturn_attribute="no"]) 364]) 365 366AC_MSG_RESULT($ac_cv_c_noreturn_attribute) 367if test $ac_cv_c_noreturn_attribute = yes; then 368 AC_DEFINE(HAVE_ATTR_NORETURN, 1, [Whether the C compiler accepts the "noreturn" attribute]) 369 AC_DEFINE(ATTR_NORETURN, [__attribute__((__noreturn__))], [apply the noreturn attribute to a function that exits the program]) 370else 371 AC_DEFINE(ATTR_NORETURN,[], [apply the noreturn attribute to a function that exits the program]) 372fi 373])dnl End of CHECK_NORETURN_ATTRIBUTE 374 375CHECK_NORETURN_ATTRIBUTE 376 377AC_DEFUN([CHECK_FALLTHROUGH_ATTRIBUTE], 378[AC_REQUIRE([AC_PROG_CC]) 379AC_MSG_CHECKING(whether the C compiler (${CC-cc}) accepts the "fallthrough" attribute) 380BAKCFLAGS="$CFLAGS" 381CFLAGS="$CFLAGS -Werror" 382AC_CACHE_VAL(ac_cv_c_fallthrough_attribute, 383[ac_cv_c_fallthrough_attribute=no 384AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <stdio.h> 385void f(int x) { 386 int y = 0; 387 switch(x) { 388 case 1: 389 y = 1; 390 __attribute__((fallthrough)); 391 /* fallthrough */ 392 case 2: 393 y++; 394 break; 395 case 3: 396 y = 3; 397 break; 398 } 399 printf("%d", y); 400} 401]], [[ 402 f(1); 403]])],[ac_cv_c_fallthrough_attribute="yes"],[ac_cv_c_fallthrough_attribute="no"]) 404]) 405CFLAGS="$BAKCFLAGS" 406 407AC_MSG_RESULT($ac_cv_c_fallthrough_attribute) 408if test $ac_cv_c_fallthrough_attribute = yes; then 409 AC_DEFINE(HAVE_ATTR_FALLTHROUGH, 1, [Whether the C compiler accepts the "fallthrough" attribute]) 410 AC_DEFINE(ATTR_FALLTHROUGH, [__attribute__((fallthrough));], [apply the fallthrough attribute.]) 411else 412 AC_DEFINE(ATTR_FALLTHROUGH,[], [apply the fallthrough attribute.]) 413fi 414])dnl End of CHECK_FALLTHROUGH_ATTRIBUTE 415 416CHECK_FALLTHROUGH_ATTRIBUTE 417 418if test "$srcdir" != "."; then 419 CPPFLAGS="$CPPFLAGS -I$srcdir" 420fi 421 422AC_DEFUN([ACX_YYLEX_DESTROY], [ 423 AC_MSG_CHECKING([for yylex_destroy]) 424 if echo %% | $LEX -t 2>&1 | grep yylex_destroy >/dev/null 2>&1; then 425 AC_DEFINE(LEX_HAS_YYLEX_DESTROY, 1, [if lex has yylex_destroy]) 426 AC_MSG_RESULT(yes) 427 else AC_MSG_RESULT(no); 428 LEX=":" 429 fi 430]) 431 432AC_DEFUN([ACX_YYLEX_OPTION], [ 433 AC_MSG_CHECKING([for lex %option]) 434 if cat <<EOF | $LEX -t 2>&1 | grep yy_delete_buffer >/dev/null 2>&1; then 435%option nounput 436%% 437EOF 438 AC_MSG_RESULT(yes) 439 else AC_MSG_RESULT(no); 440 LEX=":" 441 fi 442]) 443 444AC_PROG_LEX([noyywrap]) 445if test "$LEX" != "" -a "$LEX" != ":"; then 446ACX_YYLEX_DESTROY 447fi 448if test "$LEX" != "" -a "$LEX" != ":"; then 449ACX_YYLEX_OPTION 450fi 451if test "$LEX" = "" -o "$LEX" = ":"; then 452 if test ! -f util/configlexer.c; then 453 AC_MSG_ERROR([no lex and no util/configlexer.c: need flex and bison to compile from source repository.]) 454 fi 455fi 456AC_PROG_YACC 457if test "$YACC" = "" -o "$YACC" = ":"; then 458 if test ! -f util/configparser.c; then 459 AC_MSG_ERROR([no yacc and no util/configparser.c: need flex and bison to compile from source repository.]) 460 fi 461fi 462AC_CHECK_PROG(doxygen, doxygen, doxygen) 463AC_CHECK_TOOL(STRIP, strip) 464ACX_LIBTOOL_C_ONLY 465 466# pkg-config is only needed for these options, do not require it otherwise 467if test "$enable_systemd" = "yes" -o "$enable_dnstap" = "yes" -o "$with_pyunbound" = "yes" -o "$with_pythonmod" = "yes"; then 468PKG_PROG_PKG_CONFIG 469fi 470 471# Checks for header files. 472AC_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]) 473# net/if.h portability for Darwin see: 474# https://www.gnu.org/software/autoconf/manual/autoconf-2.69/html_node/Header-Portability.html 475AC_CHECK_HEADERS([net/if.h],,, [ 476#include <stdio.h> 477#ifdef STDC_HEADERS 478# include <stdlib.h> 479# include <stddef.h> 480#else 481# ifdef HAVE_STDLIB_H 482# include <stdlib.h> 483# endif 484#endif 485#ifdef HAVE_SYS_SOCKET_H 486# include <sys/socket.h> 487#endif 488]) 489 490# Check for Apple header. This uncovers TARGET_OS_IPHONE, TARGET_OS_TV or TARGET_OS_WATCH 491AC_CHECK_HEADERS([TargetConditionals.h],,, [AC_INCLUDES_DEFAULT]) 492AC_CHECK_HEADERS([netioapi.h],,, [AC_INCLUDES_DEFAULT 493#if HAVE_SYS_PARAM_H 494#include <sys/param.h> 495#endif 496 497#ifdef HAVE_SYS_SOCKET_H 498#include <sys/socket.h> 499#endif 500 501#ifdef HAVE_SYS_UIO_H 502#include <sys/uio.h> 503#endif 504 505#ifdef HAVE_NETINET_IN_H 506#include <netinet/in.h> 507#endif 508 509#ifdef HAVE_NETINET_TCP_H 510#include <netinet/tcp.h> 511#endif 512 513#ifdef HAVE_ARPA_INET_H 514#include <arpa/inet.h> 515#endif 516 517#ifdef HAVE_WINSOCK2_H 518#include <winsock2.h> 519#endif 520 521#ifdef HAVE_WS2TCPIP_H 522#include <ws2tcpip.h> 523#endif 524]) 525 526# Check for Linux timestamping headers 527AC_CHECK_HEADERS([linux/net_tstamp.h],,, [AC_INCLUDES_DEFAULT]) 528AC_CHECK_HEADERS([stdatomic.h],,, [AC_INCLUDES_DEFAULT]) 529 530# check for types. 531# Using own tests for int64* because autoconf builtin only give 32bit. 532AC_CHECK_TYPE(int8_t, signed char) 533AC_CHECK_TYPE(int16_t, short) 534AC_CHECK_TYPE(int32_t, int) 535AC_CHECK_TYPE(int64_t, long long) 536AC_CHECK_TYPE(uint8_t, unsigned char) 537AC_CHECK_TYPE(uint16_t, unsigned short) 538AC_CHECK_TYPE(uint32_t, unsigned int) 539AC_CHECK_TYPE(uint64_t, unsigned long long) 540AC_TYPE_SIZE_T 541AC_CHECK_TYPE(ssize_t, int) 542AC_TYPE_UID_T 543AC_TYPE_PID_T 544AC_TYPE_OFF_T 545ACX_TYPE_U_CHAR 546ACX_TYPE_RLIM_T 547ACX_TYPE_SOCKLEN_T 548ACX_TYPE_IN_ADDR_T 549ACX_TYPE_IN_PORT_T 550ACX_CHECK_MEMCMP_SIGNED 551 552AC_CHECK_SIZEOF(time_t,,[ 553AC_INCLUDES_DEFAULT 554#ifdef TIME_WITH_SYS_TIME 555# include <sys/time.h> 556# include <time.h> 557#else 558# ifdef HAVE_SYS_TIME_H 559# include <sys/time.h> 560# else 561# include <time.h> 562# endif 563#endif 564]) 565AC_CHECK_SIZEOF(size_t) 566 567# add option to disable the evil rpath 568ACX_ARG_RPATH 569AC_SUBST(RUNTIME_PATH) 570 571# check to see if libraries are needed for these functions. 572AC_SEARCH_LIBS([inet_pton], [nsl]) 573AC_SEARCH_LIBS([socket], [socket]) 574 575# check whether strptime also works 576AC_DEFUN([AC_CHECK_STRPTIME_WORKS], 577[AC_REQUIRE([AC_PROG_CC]) 578AC_MSG_CHECKING(whether strptime works) 579if test c${cross_compiling} = cno; then 580AC_RUN_IFELSE([AC_LANG_SOURCE([[ 581#define _XOPEN_SOURCE 600 582#include <time.h> 583int main(void) { struct tm tm; char *res; 584res = 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); 585if (!res) return 2; 586res = strptime("20070207111842", "%Y%m%d%H%M%S", &tm); 587if (!res) return 1; return 0; } 588]])] , [eval "ac_cv_c_strptime_works=yes"], [eval "ac_cv_c_strptime_works=no"], 589[eval "ac_cv_c_strptime_works=maybe"]) 590else 591eval "ac_cv_c_strptime_works=maybe" 592fi 593AC_MSG_RESULT($ac_cv_c_strptime_works) 594if test $ac_cv_c_strptime_works = no; then 595AC_LIBOBJ(strptime) 596else 597AC_DEFINE_UNQUOTED([STRPTIME_WORKS], 1, [use default strptime.]) 598fi 599])dnl 600 601# check some functions of the OS before linking libs (while still runnable). 602AC_FUNC_CHOWN 603AC_FUNC_FORK 604AC_DEFINE(RETSIGTYPE,void,[Return type of signal handlers, but autoconf 2.70 says 'your code may safely assume C89 semantics that RETSIGTYPE is void.']) 605AC_FUNC_FSEEKO 606ACX_SYS_LARGEFILE 607ACX_CHECK_NONBLOCKING_BROKEN 608ACX_MKDIR_ONE_ARG 609AC_CHECK_FUNCS([strptime],[AC_CHECK_STRPTIME_WORKS],[AC_LIBOBJ([strptime])]) 610 611# check if we can use SO_REUSEPORT 612reuseport_default=0 613if echo "$host" | $GREP -i -e linux >/dev/null; then reuseport_default=1; fi 614if echo "$host" | $GREP -i -e dragonfly >/dev/null; then reuseport_default=1; fi 615if test "$reuseport_default" = 1; then 616 AC_DEFINE(REUSEPORT_DEFAULT, 1, [if REUSEPORT is enabled by default]) 617else 618 AC_DEFINE(REUSEPORT_DEFAULT, 0, [if REUSEPORT is enabled by default]) 619fi 620 621# Include systemd.m4 - begin 622sinclude(systemd.m4) 623# Include systemd.m4 - end 624 625# set memory allocation checking if requested 626AC_ARG_ENABLE(alloc-checks, AS_HELP_STRING([--enable-alloc-checks],[ enable to memory allocation statistics, for debug purposes ]), 627 , ) 628AC_ARG_ENABLE(alloc-lite, AS_HELP_STRING([--enable-alloc-lite],[ enable for lightweight alloc assertions, for debug purposes ]), 629 , ) 630AC_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 ]), 631 , ) 632if test x_$enable_alloc_nonregional = x_yes; then 633 AC_DEFINE(UNBOUND_ALLOC_NONREGIONAL, 1, [use malloc not regions, for debug use]) 634fi 635if test x_$enable_alloc_checks = x_yes; then 636 AC_DEFINE(UNBOUND_ALLOC_STATS, 1, [use statistics for allocs and frees, for debug use]) 637 SLDNS_ALLOCCHECK_EXTRA_OBJ="alloc.lo log.lo" 638 AC_SUBST(SLDNS_ALLOCCHECK_EXTRA_OBJ) 639 ASYNCLOOK_ALLOCCHECK_EXTRA_OBJ="alloc.lo" 640 AC_SUBST(ASYNCLOOK_ALLOCCHECK_EXTRA_OBJ) 641else 642 if test x_$enable_alloc_lite = x_yes; then 643 AC_DEFINE(UNBOUND_ALLOC_LITE, 1, [use to enable lightweight alloc assertions, for debug use]) 644 else 645 ACX_FUNC_MALLOC([unbound]) 646 fi 647fi 648 649# check windows threads (we use them, not pthreads, on windows). 650if test "$on_mingw" = "yes"; then 651# check windows threads 652 AC_CHECK_HEADERS([windows.h],,, [AC_INCLUDES_DEFAULT]) 653 AC_MSG_CHECKING([for CreateThread]) 654 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([ 655#ifdef HAVE_WINDOWS_H 656#include <windows.h> 657#endif 658], [ 659 HANDLE t = CreateThread(NULL, 0, NULL, NULL, 0, NULL); 660])], 661 AC_MSG_RESULT(yes) 662 AC_DEFINE(HAVE_WINDOWS_THREADS, 1, [Using Windows threads]) 663, 664 AC_MSG_RESULT(no) 665) 666 667else 668# not on mingw, check thread libraries. 669 670# check for thread library. 671# check this first, so that the pthread lib does not get linked in via 672# libssl or libpython, and thus distorts the tests, and we end up using 673# the non-threadsafe C libraries. 674AC_ARG_WITH(pthreads, AS_HELP_STRING([--with-pthreads],[use pthreads library, or --without-pthreads to disable threading support.]), 675 [ ],[ withval="yes" ]) 676ub_have_pthreads=no 677if test x_$withval != x_no; then 678 AX_PTHREAD([ 679 AC_DEFINE(HAVE_PTHREAD,1,[Define if you have POSIX threads libraries and header files.]) 680 if test -n "$PTHREAD_LIBS"; then 681 LIBS="$PTHREAD_LIBS $LIBS" 682 fi 683 CFLAGS="$CFLAGS $PTHREAD_CFLAGS" 684 CC="$PTHREAD_CC" 685 ub_have_pthreads=yes 686 AC_CHECK_TYPES([pthread_spinlock_t, pthread_rwlock_t],,,[#include <pthread.h>]) 687 AC_CHECK_SIZEOF([unsigned long]) 688 AC_CHECK_SIZEOF(pthread_t) 689 690 if echo "$CFLAGS" | $GREP -e "-pthread" >/dev/null; then 691 AC_MSG_CHECKING([if -pthread unused during linking]) 692 # catch clang warning 'argument unused during compilation' 693 AC_LANG_CONFTEST([AC_LANG_SOURCE(AC_INCLUDES_DEFAULT 694[[ 695int main(void) {return 0;} 696]])]) 697 pthread_unused="yes" 698 # first compile 699 echo "$CC $CFLAGS -c conftest.c -o conftest.o" >&AS_MESSAGE_LOG_FD 700 $CC $CFLAGS -c conftest.c -o conftest.o 2>&AS_MESSAGE_LOG_FD >&AS_MESSAGE_LOG_FD 701 if test $? = 0; then 702 # then link 703 echo "$CC $CFLAGS -Werror $LDFLAGS $LIBS -o conftest contest.o" >&AS_MESSAGE_LOG_FD 704 $CC $CFLAGS -Werror $LDFLAGS $LIBS -o conftest conftest.o 2>&AS_MESSAGE_LOG_FD >&AS_MESSAGE_LOG_FD 705 if test $? -ne 0; then 706 AC_MSG_RESULT(yes) 707 CFLAGS=`echo "$CFLAGS" | sed -e 's/-pthread//'` 708 PTHREAD_CFLAGS_ONLY="-pthread" 709 AC_SUBST(PTHREAD_CFLAGS_ONLY) 710 else 711 AC_MSG_RESULT(no) 712 fi 713 else 714 AC_MSG_RESULT(no) 715 fi # endif cc successful 716 rm -f conftest conftest.c conftest.o 717 fi # endif -pthread in CFLAGS 718 719 ]) 720fi 721 722# check solaris thread library 723AC_ARG_WITH(solaris-threads, AS_HELP_STRING([--with-solaris-threads],[use solaris native thread library.]), [ ],[ withval="no" ]) 724ub_have_sol_threads=no 725if test x_$withval != x_no; then 726 if test x_$ub_have_pthreads != x_no; then 727 AC_MSG_WARN([Have pthreads already, ignoring --with-solaris-threads]) 728 else 729 AC_SEARCH_LIBS(thr_create, [thread], 730 [ 731 AC_DEFINE(HAVE_SOLARIS_THREADS, 1, [Using Solaris threads]) 732 733 ACX_CHECK_COMPILER_FLAG(mt, [CFLAGS="$CFLAGS -mt"], 734 [CFLAGS="$CFLAGS -D_REENTRANT"]) 735 ub_have_sol_threads=yes 736 ] , [ 737 AC_MSG_ERROR([no solaris threads found.]) 738 ]) 739 fi 740fi 741 742fi # end of non-mingw check of thread libraries 743 744# Check for SYSLOG_FACILITY 745AC_ARG_WITH(syslog-facility, AS_HELP_STRING([--with-syslog-facility=LOCAL0 - LOCAL7],[ set SYSLOG_FACILITY, default DAEMON ]), 746 [ UNBOUND_SYSLOG_FACILITY="$withval" ], []) 747case "${UNBOUND_SYSLOG_FACILITY}" in 748 749 LOCAL[[0-7]]) UNBOUND_SYSLOG_FACILITY="LOG_${UNBOUND_SYSLOG_FACILITY}" ;; 750 751 *) UNBOUND_SYSLOG_FACILITY="LOG_DAEMON" ;; 752 753esac 754AC_DEFINE_UNQUOTED(UB_SYSLOG_FACILITY,${UNBOUND_SYSLOG_FACILITY},[the SYSLOG_FACILITY to use, default LOG_DAEMON]) 755 756# Check for dynamic library module 757AC_ARG_WITH(dynlibmodule, 758 AS_HELP_STRING([--with-dynlibmodule],[build dynamic library module, or --without-dynlibmodule to disable it. (default=no)]), 759 [], [ withval="no" ]) 760 761if test x_$withval != x_no; then 762 AC_DEFINE(WITH_DYNLIBMODULE, 1, [Define if you want dynlib module.]) 763 WITH_DYNLIBMODULE=yes 764 AC_SUBST(WITH_DYNLIBMODULE) 765 DYNLIBMOD_OBJ="dynlibmod.lo" 766 AC_SUBST(DYNLIBMOD_OBJ) 767 DYNLIBMOD_HEADER='$(srcdir)/dynlibmod/dynlibmod.h' 768 AC_SUBST(DYNLIBMOD_HEADER) 769 if test $on_mingw = "no"; then 770 # link with -ldl if not already there, for all executables because 771 # dlopen call is in the dynlib module. For unbound executable, also 772 # export symbols. 773 AC_SEARCH_LIBS([dlopen], [dl]) 774 DYNLIBMOD_EXTRALIBS="-export-dynamic" 775 else 776 DYNLIBMOD_EXTRALIBS="-Wl,--export-all-symbols,--out-implib,libunbound.dll.a" 777 fi 778 AC_SUBST(DYNLIBMOD_EXTRALIBS) 779fi 780 781# Check for PyUnbound 782AC_ARG_WITH(pyunbound, 783 AS_HELP_STRING([--with-pyunbound],[build PyUnbound, or --without-pyunbound to skip it. (default=no)]), 784 [], [ withval="no" ]) 785 786ub_test_python=no 787ub_with_pyunbound=no 788if test x_$withval != x_no; then 789 ub_with_pyunbound=yes 790 ub_test_python=yes 791fi 792 793# Check for Python module 794AC_ARG_WITH(pythonmodule, 795 AS_HELP_STRING([--with-pythonmodule],[build Python module, or --without-pythonmodule to disable script engine. (default=no)]), 796 [], [ withval="no" ]) 797 798ub_with_pythonmod=no 799if test x_$withval != x_no; then 800 ub_with_pythonmod=yes 801 ub_test_python=yes 802fi 803 804# Check for Python & SWIG only on PyUnbound or PyModule 805if test x_$ub_test_python != x_no; then 806 807 # Check for Python 808 ub_have_python=no 809 ac_save_LIBS="$LIBS" dnl otherwise AC_PYTHON_DEVEL thrashes $LIBS 810 AC_PYTHON_DEVEL 811 if test ! -z "$PYTHON_VERSION"; then 812 badversion="no" 813 if test "$PYTHON_VERSION_MAJOR" -lt 2; then 814 badversion="yes" 815 fi 816 if test "$PYTHON_VERSION_MAJOR" -eq 2 -a "$PYTHON_VERSION_MINOR" -lt 4; then 817 badversion="yes" 818 fi 819 if test "$badversion" = "yes"; then 820 AC_MSG_ERROR([Python version >= 2.4.0 is required]) 821 fi 822 823 [PY_MAJOR_VERSION="`$PYTHON -c \"import sys; print(sys.version_info[0])\"`"] 824 AC_SUBST(PY_MAJOR_VERSION) 825 # Have Python 826 AC_DEFINE(HAVE_PYTHON,1,[Define if you have Python libraries and header files.]) 827 if test x_$ub_with_pythonmod != x_no; then 828 if test -n "$LIBS"; then 829 LIBS="$PYTHON_LDFLAGS $LIBS" 830 else 831 LIBS="$PYTHON_LDFLAGS" 832 fi 833 fi 834 PYTHON_LIBS="$PYTHON_LDFLAGS" 835 AC_SUBST(PYTHON_LIBS) 836 if test -n "$CPPFLAGS"; then 837 CPPFLAGS="$CPPFLAGS $PYTHON_CPPFLAGS" 838 else 839 CPPFLAGS="$PYTHON_CPPFLAGS" 840 fi 841 if test "$PYTHON_LIBDIR" != "/usr/lib" -a "$PYTHON_LIBDIR" != "" -a "$PYTHON_LIBDIR" != "/usr/lib64"; then 842 ACX_RUNTIME_PATH_ADD([$PYTHON_LIBDIR]) 843 fi 844 ub_have_python=yes 845 PKG_CHECK_EXISTS(["python${PY_MAJOR_VERSION}"], 846 [PC_PY_DEPENDENCY="python${PY_MAJOR_VERSION}"], 847 [PC_PY_DEPENDENCY="python"]) 848 AC_SUBST(PC_PY_DEPENDENCY) 849 850 # Check for SWIG 851 ub_have_swig=no 852 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])) 853 if test "$enable_swig_version_check" = "yes"; then 854 AX_PKG_SWIG(2.0.1) 855 else 856 AX_PKG_SWIG 857 fi 858 AC_MSG_CHECKING(SWIG) 859 if test ! -x "$SWIG"; then 860 AC_MSG_ERROR([failed to find swig tool, install it, or do not build Python module and PyUnbound]) 861 else 862 AC_DEFINE(HAVE_SWIG, 1, [Define if you have Swig libraries and header files.]) 863 AC_SUBST(swig, "$SWIG") 864 AC_MSG_RESULT(present) 865 866 # If have Python & SWIG 867 # Declare PythonMod 868 if test x_$ub_with_pythonmod != x_no; then 869 AC_DEFINE(WITH_PYTHONMODULE, 1, [Define if you want Python module.]) 870 WITH_PYTHONMODULE=yes 871 AC_SUBST(WITH_PYTHONMODULE) 872 PYTHONMOD_OBJ="pythonmod.lo pythonmod_utils.lo" 873 AC_SUBST(PYTHONMOD_OBJ) 874 PYTHONMOD_HEADER='$(srcdir)/pythonmod/pythonmod.h' 875 AC_SUBST(PYTHONMOD_HEADER) 876 PYTHONMOD_INSTALL=pythonmod-install 877 AC_SUBST(PYTHONMOD_INSTALL) 878 PYTHONMOD_UNINSTALL=pythonmod-uninstall 879 AC_SUBST(PYTHONMOD_UNINSTALL) 880 fi 881 882 # Declare PyUnbound 883 if test x_$ub_with_pyunbound != x_no; then 884 AC_DEFINE(WITH_PYUNBOUND, 1, [Define if you want PyUnbound.]) 885 WITH_PYUNBOUND=yes 886 AC_SUBST(WITH_PYUNBOUND) 887 PYUNBOUND_OBJ="libunbound_wrap.lo" 888 AC_SUBST(PYUNBOUND_OBJ) 889 PYUNBOUND_TARGET="_unbound.la" 890 AC_SUBST(PYUNBOUND_TARGET) 891 PYUNBOUND_INSTALL=pyunbound-install 892 AC_SUBST(PYUNBOUND_INSTALL) 893 PYUNBOUND_UNINSTALL=pyunbound-uninstall 894 AC_SUBST(PYUNBOUND_UNINSTALL) 895 fi 896 fi 897 else 898 AC_MSG_RESULT([*** Python libraries not found, won't build PythonMod or PyUnbound ***]) 899 ub_with_pyunbound=no 900 ub_with_pythonmod=no 901 fi 902fi 903 904if test "`uname`" = "NetBSD"; then 905 NETBSD_LINTFLAGS='"-D__RENAME(x)=" -D_NETINET_IN_H_' 906 AC_SUBST(NETBSD_LINTFLAGS) 907fi 908 909if test "`uname`" = "Linux"; then 910 # splint cannot parse modern c99 header files 911 GCC_DOCKER_LINTFLAGS='-syntax' 912 AC_SUBST(GCC_DOCKER_LINTFLAGS) 913fi 914AX_BUILD_DATE_EPOCH(CONFIG_DATE, [%Y%m%d]) 915AC_ARG_VAR(SOURCE_DATE_EPOCH, [If it is set, it uses the value of that variable instead of the current time as the build timestamp. The format is a unix timestamp. This enables reproducible build output.]) 916AC_SUBST(CONFIG_DATE) 917 918# Checks for libraries. 919 920# libnss 921USE_NSS="no" 922AC_ARG_WITH([nss], AS_HELP_STRING([--with-nss=path],[use libnss instead of openssl, installed at path.]), 923 [ 924 USE_NSS="yes" 925 AC_DEFINE(HAVE_NSS, 1, [Use libnss for crypto]) 926 if test "$withval" != "" -a "$withval" != "yes"; then 927 CPPFLAGS="$CPPFLAGS -I$withval/include/nss3" 928 LDFLAGS="$LDFLAGS -L$withval/lib" 929 ACX_RUNTIME_PATH_ADD([$withval/lib]) 930 CPPFLAGS="-I$withval/include/nspr4 $CPPFLAGS" 931 else 932 CPPFLAGS="$CPPFLAGS -I/usr/include/nss3" 933 CPPFLAGS="-I/usr/include/nspr4 $CPPFLAGS" 934 fi 935 LIBS="$LIBS -lnss3 -lnspr4" 936 SSLLIB="" 937 PC_CRYPTO_DEPENDENCY="nss nspr" 938 AC_SUBST(PC_CRYPTO_DEPENDENCY) 939 ] 940) 941 942# libnettle 943USE_NETTLE="no" 944AC_ARG_WITH([nettle], AS_HELP_STRING([--with-nettle=path],[use libnettle as crypto library, installed at path.]), 945 [ 946 USE_NETTLE="yes" 947 AC_DEFINE(HAVE_NETTLE, 1, [Use libnettle for crypto]) 948 AC_CHECK_HEADERS([nettle/dsa-compat.h],,, [AC_INCLUDES_DEFAULT]) 949 if test "$withval" != "" -a "$withval" != "yes"; then 950 CPPFLAGS="$CPPFLAGS -I$withval/include/nettle" 951 LDFLAGS="$LDFLAGS -L$withval/lib" 952 ACX_RUNTIME_PATH_ADD([$withval/lib]) 953 else 954 CPPFLAGS="$CPPFLAGS -I/usr/include/nettle" 955 fi 956 LIBS="$LIBS -lhogweed -lnettle -lgmp" 957 SSLLIB="" 958 PC_CRYPTO_DEPENDENCY="hogweed nettle" 959 AC_SUBST(PC_CRYPTO_DEPENDENCY) 960 ] 961) 962 963# openssl 964if test $USE_NSS = "no" -a $USE_NETTLE = "no"; then 965ACX_WITH_SSL 966ACX_LIB_SSL 967SSLLIB="-lssl" 968 969PC_CRYPTO_DEPENDENCY="" 970AC_SUBST(PC_CRYPTO_DEPENDENCY) 971 972# check if -lcrypt32 is needed because CAPIENG needs that. (on windows) 973BAKLIBS="$LIBS" 974LIBS="-lssl $LIBS" 975AC_MSG_CHECKING([if libssl needs -lcrypt32]) 976AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ 977 int EVP_sha256(void); 978 (void)EVP_sha256(); 979]])], [ 980 AC_MSG_RESULT([no]) 981 LIBS="$BAKLIBS" 982], [ 983 AC_MSG_RESULT([yes]) 984 LIBS="$BAKLIBS" 985 LIBS="$LIBS -lcrypt32" 986]) 987 988AC_MSG_CHECKING([for LibreSSL]) 989if grep VERSION_TEXT $ssldir_include/openssl/opensslv.h | grep "LibreSSL" >/dev/null; then 990 AC_MSG_RESULT([yes]) 991 AC_DEFINE([HAVE_LIBRESSL], [1], [Define if we have LibreSSL]) 992 # libressl provides these compat functions, but they may also be 993 # declared by the OS in libc. See if they have been declared. 994 AC_CHECK_DECLS([strlcpy,strlcat,arc4random,arc4random_uniform]) 995else 996 AC_MSG_RESULT([no]) 997fi 998AC_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]) 999AC_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]) 1000 1001# these check_funcs need -lssl 1002BAKLIBS="$LIBS" 1003LIBS="-lssl $LIBS" 1004AC_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]) 1005LIBS="$BAKLIBS" 1006 1007AC_CHECK_DECLS([SSL_COMP_get_compression_methods,sk_SSL_COMP_pop_free,SSL_CTX_set_ecdh_auto], [], [], [ 1008AC_INCLUDES_DEFAULT 1009#ifdef HAVE_OPENSSL_ERR_H 1010#include <openssl/err.h> 1011#endif 1012 1013#ifdef HAVE_OPENSSL_RAND_H 1014#include <openssl/rand.h> 1015#endif 1016 1017#ifdef HAVE_OPENSSL_CONF_H 1018#include <openssl/conf.h> 1019#endif 1020 1021#ifdef HAVE_OPENSSL_ENGINE_H 1022#include <openssl/engine.h> 1023#endif 1024#include <openssl/ssl.h> 1025#include <openssl/evp.h> 1026]) 1027 1028if test "$ac_cv_func_HMAC_Init_ex" = "yes"; then 1029# check function return type. 1030AC_MSG_CHECKING(the return type of HMAC_Init_ex) 1031AC_COMPILE_IFELSE([AC_LANG_PROGRAM([ 1032#ifdef HAVE_OPENSSL_ERR_H 1033#include <openssl/err.h> 1034#endif 1035 1036#ifdef HAVE_OPENSSL_RAND_H 1037#include <openssl/rand.h> 1038#endif 1039 1040#ifdef HAVE_OPENSSL_CONF_H 1041#include <openssl/conf.h> 1042#endif 1043 1044#ifdef HAVE_OPENSSL_ENGINE_H 1045#include <openssl/engine.h> 1046#endif 1047#include <openssl/ssl.h> 1048#include <openssl/evp.h> 1049], [ 1050 HMAC_CTX* hmac_ctx = NULL; 1051 void* hmac_key = NULL; 1052 const EVP_MD* digest = NULL; 1053 int x = HMAC_Init_ex(hmac_ctx, hmac_key, 32, digest, NULL); 1054 (void)x; 1055])], [ 1056 AC_MSG_RESULT(int) 1057], [ 1058 AC_MSG_RESULT(void) 1059 AC_DEFINE([HMAC_INIT_EX_RETURNS_VOID], 1, [If HMAC_Init_ex() returns void]) 1060]) 1061fi 1062 1063fi 1064AC_SUBST(SSLLIB) 1065 1066# libbsd 1067AC_ARG_WITH([libbsd], AS_HELP_STRING([--with-libbsd],[Use portable libbsd functions]), [ 1068 AC_CHECK_HEADERS([bsd/string.h bsd/stdlib.h],,, [AC_INCLUDES_DEFAULT]) 1069 if test "x$ac_cv_header_bsd_string_h" = xyes -a "x$ac_cv_header_bsd_stdlib_h" = xyes; then 1070 for func in strlcpy strlcat arc4random arc4random_uniform reallocarray; do 1071 AC_SEARCH_LIBS([$func], [bsd], [ 1072 AC_DEFINE(HAVE_LIBBSD, 1, [Use portable libbsd functions]) 1073 PC_LIBBSD_DEPENDENCY=libbsd 1074 AC_SUBST(PC_LIBBSD_DEPENDENCY) 1075 ]) 1076 done 1077 fi 1078]) 1079 1080AC_ARG_ENABLE(sha1, AS_HELP_STRING([--disable-sha1],[Disable SHA1 RRSIG support, does not disable nsec3 support])) 1081case "$enable_sha1" in 1082 no) 1083 ;; 1084 yes|*) 1085 AC_DEFINE([USE_SHA1], [1], [Define this to enable SHA1 support.]) 1086 ;; 1087esac 1088 1089 1090AC_ARG_ENABLE(sha2, AS_HELP_STRING([--disable-sha2],[Disable SHA256 and SHA512 RRSIG support])) 1091case "$enable_sha2" in 1092 no) 1093 ;; 1094 yes|*) 1095 AC_DEFINE([USE_SHA2], [1], [Define this to enable SHA256 and SHA512 support.]) 1096 ;; 1097esac 1098 1099AC_ARG_ENABLE(subnet, AS_HELP_STRING([--enable-subnet],[Enable client subnet])) 1100case "$enable_subnet" in 1101 yes) 1102 AC_DEFINE([CLIENT_SUBNET], [1], [Define this to enable client subnet option.]) 1103 SUBNET_OBJ="edns-subnet.lo subnetmod.lo addrtree.lo subnet-whitelist.lo" 1104 AC_SUBST(SUBNET_OBJ) 1105 SUBNET_HEADER='$(srcdir)/edns-subnet/subnetmod.h $(srcdir)/edns-subnet/edns-subnet.h $(srcdir)/edns-subnet/subnet-whitelist.h $(srcdir)/edns-subnet/addrtree.h' 1106 AC_SUBST(SUBNET_HEADER) 1107 ;; 1108 no|*) 1109 ;; 1110esac 1111 1112# check whether gost also works 1113AC_DEFUN([AC_CHECK_GOST_WORKS], 1114[AC_REQUIRE([AC_PROG_CC]) 1115AC_MSG_CHECKING([if GOST works]) 1116if test c${cross_compiling} = cno; then 1117BAKCFLAGS="$CFLAGS" 1118if test -n "$ssldir"; then 1119 CFLAGS="$CFLAGS -Wl,-rpath,$ssldir_lib" 1120fi 1121AC_RUN_IFELSE([AC_LANG_SOURCE([[ 1122#include <string.h> 1123#include <openssl/ssl.h> 1124#include <openssl/evp.h> 1125#include <openssl/engine.h> 1126#include <openssl/conf.h> 1127/* routine to load gost (from sldns) */ 1128int load_gost_id(void) 1129{ 1130 static int gost_id = 0; 1131 const EVP_PKEY_ASN1_METHOD* meth; 1132 ENGINE* e; 1133 1134 if(gost_id) return gost_id; 1135 1136 /* see if configuration loaded gost implementation from other engine*/ 1137 meth = EVP_PKEY_asn1_find_str(NULL, "gost2001", -1); 1138 if(meth) { 1139 EVP_PKEY_asn1_get0_info(&gost_id, NULL, NULL, NULL, NULL, meth); 1140 return gost_id; 1141 } 1142 1143 /* see if engine can be loaded already */ 1144 e = ENGINE_by_id("gost"); 1145 if(!e) { 1146 /* load it ourself, in case statically linked */ 1147 ENGINE_load_builtin_engines(); 1148 ENGINE_load_dynamic(); 1149 e = ENGINE_by_id("gost"); 1150 } 1151 if(!e) { 1152 /* no gost engine in openssl */ 1153 return 0; 1154 } 1155 if(!ENGINE_set_default(e, ENGINE_METHOD_ALL)) { 1156 ENGINE_finish(e); 1157 ENGINE_free(e); 1158 return 0; 1159 } 1160 1161 meth = EVP_PKEY_asn1_find_str(&e, "gost2001", -1); 1162 if(!meth) { 1163 /* algo not found */ 1164 ENGINE_finish(e); 1165 ENGINE_free(e); 1166 return 0; 1167 } 1168 EVP_PKEY_asn1_get0_info(&gost_id, NULL, NULL, NULL, NULL, meth); 1169 return gost_id; 1170} 1171int main(void) { 1172 EVP_MD_CTX* ctx; 1173 const EVP_MD* md; 1174 unsigned char digest[64]; /* its a 256-bit digest, so uses 32 bytes */ 1175 const char* str = "Hello world"; 1176 const unsigned char check[] = { 1177 0x40 , 0xed , 0xf8 , 0x56 , 0x5a , 0xc5 , 0x36 , 0xe1 , 1178 0x33 , 0x7c , 0x7e , 0x87 , 0x62 , 0x1c , 0x42 , 0xe0 , 1179 0x17 , 0x1b , 0x5e , 0xce , 0xa8 , 0x46 , 0x65 , 0x4d , 1180 0x8d , 0x3e , 0x22 , 0x9b , 0xe1 , 0x30 , 0x19 , 0x9d 1181 }; 1182 OPENSSL_config(NULL); 1183 (void)load_gost_id(); 1184 md = EVP_get_digestbyname("md_gost94"); 1185 if(!md) return 1; 1186 memset(digest, 0, sizeof(digest)); 1187 ctx = EVP_MD_CTX_create(); 1188 if(!ctx) return 2; 1189 if(!EVP_DigestInit_ex(ctx, md, NULL)) return 3; 1190 if(!EVP_DigestUpdate(ctx, str, 10)) return 4; 1191 if(!EVP_DigestFinal_ex(ctx, digest, NULL)) return 5; 1192 /* uncomment to see the hash calculated. 1193 {int i; 1194 for(i=0; i<32; i++) 1195 printf(" %2.2x", (int)digest[i]); 1196 printf("\n");} 1197 */ 1198 if(memcmp(digest, check, sizeof(check)) != 0) 1199 return 6; 1200 return 0; 1201} 1202]])] , [eval "ac_cv_c_gost_works=yes"], [eval "ac_cv_c_gost_works=no"], 1203[eval "ac_cv_c_gost_works=maybe"]) 1204CFLAGS="$BAKCFLAGS" 1205else 1206eval "ac_cv_c_gost_works=maybe" 1207fi 1208AC_MSG_RESULT($ac_cv_c_gost_works) 1209])dnl 1210 1211AC_ARG_ENABLE(gost, AS_HELP_STRING([--disable-gost],[Disable GOST support])) 1212use_gost="no" 1213if test $USE_NSS = "no" -a $USE_NETTLE = "no"; then 1214case "$enable_gost" in 1215 no) 1216 ;; 1217 *) 1218 AC_CHECK_FUNC(EVP_PKEY_set_type_str, [:],[AC_MSG_ERROR([OpenSSL 1.0.0 is needed for GOST support])]) 1219 AC_CHECK_FUNC(EC_KEY_new, [], [AC_MSG_ERROR([OpenSSL does not support ECC, needed for GOST support])]) 1220 AC_CHECK_GOST_WORKS 1221 if test "$ac_cv_c_gost_works" != no; then 1222 use_gost="yes" 1223 AC_DEFINE([USE_GOST], [1], [Define this to enable GOST support.]) 1224 fi 1225 ;; 1226esac 1227fi dnl !USE_NSS && !USE_NETTLE 1228 1229AC_ARG_ENABLE(ecdsa, AS_HELP_STRING([--disable-ecdsa],[Disable ECDSA support])) 1230use_ecdsa="no" 1231case "$enable_ecdsa" in 1232 no) 1233 ;; 1234 *) 1235 if test $USE_NSS = "no" -a $USE_NETTLE = "no"; then 1236 AC_CHECK_FUNC(EVP_PKEY_fromdata, [ 1237 # with EVP_PKEY_fromdata, check if EC is not disabled 1238 AC_CHECK_DECL([OPENSSL_NO_EC], [AC_MSG_ERROR([OpenSSL does not support ECDSA: please upgrade or rerun with --disable-ecdsa]) 1239 ], [], [AC_INCLUDES_DEFAULT 1240#include <openssl/evp.h> 1241 ]) 1242 ], [ 1243 # without EVP_PKEY_fromdata, older openssl, check for support 1244 AC_CHECK_FUNC(ECDSA_sign, [], [AC_MSG_ERROR([OpenSSL does not support ECDSA: please upgrade or rerun with --disable-ecdsa])]) 1245 AC_CHECK_FUNC(SHA384_Init, [], [AC_MSG_ERROR([OpenSSL does not support SHA384: please upgrade or rerun with --disable-ecdsa])]) 1246 ]) 1247 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 1248#include <openssl/evp.h> 1249 ]) 1250 # see if OPENSSL 1.0.0 or later (has EVP MD and Verify independency) 1251 AC_MSG_CHECKING([if openssl supports SHA2 and ECDSA with EVP]) 1252 if grep OPENSSL_VERSION_TEXT $ssldir_include/openssl/opensslv.h | grep "OpenSSL" >/dev/null; then 1253 if grep OPENSSL_VERSION_NUMBER $ssldir_include/openssl/opensslv.h | grep 0x0 >/dev/null; then 1254 AC_MSG_RESULT([no]) 1255 AC_DEFINE_UNQUOTED([USE_ECDSA_EVP_WORKAROUND], [1], [Define this to enable an EVP workaround for older openssl]) 1256 else 1257 AC_MSG_RESULT([yes]) 1258 fi 1259 else 1260 # not OpenSSL, thus likely LibreSSL, which supports it 1261 AC_MSG_RESULT([yes]) 1262 fi 1263 fi 1264 # we now know we have ECDSA and the required curves. 1265 AC_DEFINE_UNQUOTED([USE_ECDSA], [1], [Define this to enable ECDSA support.]) 1266 use_ecdsa="yes" 1267 ;; 1268esac 1269 1270AC_ARG_ENABLE(dsa, AS_HELP_STRING([--disable-dsa],[Disable DSA support])) 1271use_dsa="no" 1272case "$enable_dsa" in 1273 yes) 1274 # detect if DSA is supported, and turn it off if not. 1275 if test $USE_NSS = "no" -a $USE_NETTLE = "no"; then 1276 AC_CHECK_FUNC(DSA_SIG_new, [ 1277 AC_CHECK_TYPE(DSA_SIG*, [ 1278 AC_DEFINE_UNQUOTED([USE_DSA], [1], [Define this to enable DSA support.]) 1279 ], [if test "x$enable_dsa" = "xyes"; then AC_MSG_ERROR([OpenSSL does not support DSA and you used --enable-dsa.]) 1280 fi ], [ 1281AC_INCLUDES_DEFAULT 1282#ifdef HAVE_OPENSSL_ERR_H 1283#include <openssl/err.h> 1284#endif 1285 1286#ifdef HAVE_OPENSSL_RAND_H 1287#include <openssl/rand.h> 1288#endif 1289 1290#ifdef HAVE_OPENSSL_CONF_H 1291#include <openssl/conf.h> 1292#endif 1293 1294#ifdef HAVE_OPENSSL_ENGINE_H 1295#include <openssl/engine.h> 1296#endif 1297 ]) 1298 ], [if test "x$enable_dsa" = "xyes"; then AC_MSG_ERROR([OpenSSL does not support DSA and you used --enable-dsa.]) 1299 fi ]) 1300 else 1301 AC_DEFINE_UNQUOTED([USE_DSA], [1], [Define this to enable DSA support.]) 1302 fi 1303 ;; 1304 *) 1305 # disable dsa by default, RFC 8624 section 3.1, validators MUST NOT 1306 # support DSA for DNSSEC Validation. 1307 ;; 1308esac 1309 1310AC_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])) 1311if test "$with_deprecate_rsa_1024" = "yes"; then 1312 AC_DEFINE([DEPRECATE_RSA_1024], [1], [Deprecate RSA 1024 bit length, makes that an unsupported key]) 1313fi 1314 1315AC_ARG_ENABLE(ed25519, AS_HELP_STRING([--disable-ed25519],[Disable ED25519 support])) 1316use_ed25519="no" 1317case "$enable_ed25519" in 1318 no) 1319 ;; 1320 *) 1321 if test $USE_NSS = "no" -a $USE_NETTLE = "no"; then 1322 AC_CHECK_DECLS([NID_ED25519], [ 1323 use_ed25519="yes" 1324 ], [ if test "x$enable_ed25519" = "xyes"; then AC_MSG_ERROR([OpenSSL does not support ED25519 and you used --enable-ed25519.]) 1325 fi ], [AC_INCLUDES_DEFAULT 1326#include <openssl/evp.h> 1327 ]) 1328 fi 1329 if test $USE_NETTLE = "yes"; then 1330 AC_CHECK_HEADERS([nettle/eddsa.h], use_ed25519="yes",, [AC_INCLUDES_DEFAULT]) 1331 fi 1332 if test $use_ed25519 = "yes"; then 1333 AC_DEFINE_UNQUOTED([USE_ED25519], [1], [Define this to enable ED25519 support.]) 1334 fi 1335 ;; 1336esac 1337 1338AC_ARG_ENABLE(ed448, AS_HELP_STRING([--disable-ed448],[Disable ED448 support])) 1339use_ed448="no" 1340case "$enable_ed448" in 1341 no) 1342 ;; 1343 *) 1344 if test $USE_NSS = "no" -a $USE_NETTLE = "no"; then 1345 AC_CHECK_DECLS([NID_ED448], [ 1346 use_ed448="yes" 1347 ], [ if test "x$enable_ed448" = "xyes"; then AC_MSG_ERROR([OpenSSL does not support ED448 and you used --enable-ed448.]) 1348 fi ], [AC_INCLUDES_DEFAULT 1349#include <openssl/evp.h> 1350 ]) 1351 fi 1352 if test $use_ed448 = "yes"; then 1353 AC_DEFINE_UNQUOTED([USE_ED448], [1], [Define this to enable ED448 support.]) 1354 fi 1355 ;; 1356esac 1357 1358AC_ARG_ENABLE(event-api, AS_HELP_STRING([--enable-event-api],[Enable (experimental) pluggable event base libunbound API installed to unbound-event.h])) 1359case "$enable_event_api" in 1360 yes) 1361 AC_SUBST(UNBOUND_EVENT_INSTALL, [unbound-event-install]) 1362 AC_SUBST(UNBOUND_EVENT_UNINSTALL, [unbound-event-uninstall]) 1363 ;; 1364 *) 1365 ;; 1366esac 1367 1368AC_ARG_ENABLE(tfo-client, AS_HELP_STRING([--enable-tfo-client],[Enable TCP Fast Open for client mode])) 1369case "$enable_tfo_client" in 1370 yes) 1371 case "$host_os" in 1372 linux*) AC_CHECK_DECL([MSG_FASTOPEN], [AC_MSG_WARN([Check the platform specific TFO kernel parameters are correctly configured to support client mode TFO])], 1373 [AC_MSG_ERROR([TCP Fast Open is not available for client mode: please rerun without --enable-tfo-client])], 1374 [AC_INCLUDES_DEFAULT 1375#include <netinet/tcp.h> 1376]) 1377 AC_DEFINE_UNQUOTED([USE_MSG_FASTOPEN], [1], [Define this to enable client TCP Fast Open.]) 1378 ;; 1379 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])], 1380 [AC_MSG_ERROR([TCP Fast Open is not available for client mode: please rerun without --enable-tfo-client])], 1381 [AC_INCLUDES_DEFAULT 1382#include <sys/socket.h> 1383]) 1384 AC_DEFINE_UNQUOTED([USE_OSX_MSG_FASTOPEN], [1], [Define this to enable client TCP Fast Open.]) 1385 ;; 1386 esac 1387 ;; 1388 no|*) 1389 ;; 1390esac 1391 1392AC_ARG_ENABLE(tfo-server, AS_HELP_STRING([--enable-tfo-server],[Enable TCP Fast Open for server mode])) 1393case "$enable_tfo_server" in 1394 yes) 1395 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 1396#include <netinet/tcp.h> 1397 ]) 1398 AC_DEFINE_UNQUOTED([USE_TCP_FASTOPEN], [1], [Define this to enable server TCP Fast Open.]) 1399 ;; 1400 no|*) 1401 ;; 1402esac 1403 1404# check for libevent 1405AC_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.]), 1406 [ ],[ with_libevent="no" ]) 1407if test "x_$with_libevent" != x_no; then 1408 AC_DEFINE([USE_LIBEVENT], [1], [Define if you enable libevent]) 1409 AC_MSG_CHECKING(for libevent) 1410 if test "x_$with_libevent" = x_ -o "x_$with_libevent" = x_yes; then 1411 with_libevent="/usr/local /opt/local /usr/lib /usr/pkg /usr/sfw /usr" 1412 fi 1413 for dir in $with_libevent; do 1414 thedir="$dir" 1415 if test -f "$dir/include/event.h" -o -f "$dir/include/event2/event.h"; then 1416 found_libevent="yes" 1417 dnl assume /usr is in default path. 1418 if test "$thedir" != "/usr"; then 1419 CPPFLAGS="$CPPFLAGS -I$thedir/include" 1420 fi 1421 break; 1422 fi 1423 done 1424 if test x_$found_libevent != x_yes; then 1425 if test -f "$dir/event.h" -a \( -f "$dir/libevent.la" -o -f "$dir/libev.la" \) ; then 1426 # libevent source directory 1427 AC_MSG_RESULT(found in $thedir) 1428 CPPFLAGS="$CPPFLAGS -I$thedir -I$thedir/include" 1429 BAK_LDFLAGS_SET="1" 1430 BAK_LDFLAGS="$LDFLAGS" 1431 # remove evdns from linking 1432 mkdir build >/dev/null 2>&1 1433 mkdir build/libevent >/dev/null 2>&1 1434 mkdir build/libevent/.libs >/dev/null 2>&1 1435 ev_files_o=`ls $thedir/*.o | grep -v evdns\.o | grep -v bufferevent_openssl\.o` 1436 ev_files_lo=`ls $thedir/*.lo | grep -v evdns\.lo | grep -v bufferevent_openssl\.lo` 1437 ev_files_libso=`ls $thedir/.libs/*.o | grep -v evdns\.o | grep -v bufferevent_openssl\.o` 1438 cp $ev_files_o build/libevent 1439 cp $ev_files_lo build/libevent 1440 cp $ev_files_libso build/libevent/.libs 1441 LATE_LDFLAGS="build/libevent/*.lo -lm" 1442 LDFLAGS="build/libevent/*.o $LDFLAGS -lm" 1443 else 1444 AC_MSG_ERROR([Cannot find the libevent library in $with_libevent 1445You can restart ./configure --with-libevent=no to use a builtin alternative. 1446Please note that this alternative is not as capable as libevent when using 1447large outgoing port ranges. ]) 1448 fi 1449 else 1450 AC_MSG_RESULT(found in $thedir) 1451 dnl if event2 exists and no event lib in dir itself, use subdir 1452 if test ! -f $thedir/lib/libevent.a -a ! -f $thedir/lib/libevent.so -a -d "$thedir/lib/event2"; then 1453 LDFLAGS="$LDFLAGS -L$thedir/lib/event2" 1454 ACX_RUNTIME_PATH_ADD([$thedir/lib/event2]) 1455 else 1456 dnl assume /usr is in default path, do not add "". 1457 if test "$thedir" != "/usr" -a "$thedir" != ""; then 1458 LDFLAGS="$LDFLAGS -L$thedir/lib" 1459 ACX_RUNTIME_PATH_ADD([$thedir/lib]) 1460 fi 1461 fi 1462 fi 1463 # check for library used by libevent after 1.3c 1464 AC_SEARCH_LIBS([clock_gettime], [rt]) 1465 1466 # is the event.h header libev or libevent? 1467 AC_CHECK_HEADERS([event.h],,, [AC_INCLUDES_DEFAULT]) 1468 AC_CHECK_DECL(EV_VERSION_MAJOR, [ 1469 AC_SEARCH_LIBS(event_set, [ev]) 1470 ],[ 1471 AC_SEARCH_LIBS(event_set, [event]) 1472 ],[AC_INCLUDES_DEFAULT 1473#include <event.h> 1474 ]) 1475 AC_CHECK_FUNCS([event_base_free]) # only in libevent 1.2 and later 1476 AC_CHECK_FUNCS([event_base_once]) # only in libevent 1.4.1 and later 1477 AC_CHECK_FUNCS([event_base_new]) # only in libevent 1.4.1 and later 1478 AC_CHECK_FUNCS([event_base_get_method]) # only in libevent 1.4.3 and later 1479 AC_CHECK_FUNCS([ev_loop]) # only in libev. (tested on 3.51) 1480 AC_CHECK_FUNCS([ev_default_loop]) # only in libev. (tested on 4.00) 1481 AC_CHECK_FUNCS([event_assign]) # in libevent, for thread-safety 1482 AC_CHECK_DECLS([evsignal_assign], [], [], [AC_INCLUDES_DEFAULT 1483#ifdef HAVE_EVENT_H 1484# include <event.h> 1485#else 1486# include "event2/event.h" 1487#endif 1488 ]) 1489 PC_LIBEVENT_DEPENDENCY="libevent" 1490 AC_SUBST(PC_LIBEVENT_DEPENDENCY) 1491 if test -n "$BAK_LDFLAGS_SET"; then 1492 LDFLAGS="$BAK_LDFLAGS" 1493 fi 1494else 1495 AC_DEFINE(USE_MINI_EVENT, 1, [Define if you want to use internal select based events]) 1496fi 1497 1498# check for libexpat 1499AC_ARG_WITH(libexpat, AS_HELP_STRING([--with-libexpat=path],[specify explicit path for libexpat.]), 1500 [ ],[ withval="/usr/local /opt/local /usr/lib /usr/pkg /usr/sfw /usr" ]) 1501AC_MSG_CHECKING(for libexpat) 1502found_libexpat="no" 1503for dir in $withval ; do 1504 if test -f "$dir/include/expat.h"; then 1505 found_libexpat="yes" 1506 dnl assume /usr is in default path. 1507 if test "$dir" != "/usr"; then 1508 CPPFLAGS="$CPPFLAGS -I$dir/include" 1509 LDFLAGS="$LDFLAGS -L$dir/lib" 1510 fi 1511 AC_MSG_RESULT(found in $dir) 1512 break; 1513 fi 1514done 1515if test x_$found_libexpat != x_yes; then 1516 AC_MSG_ERROR([Could not find libexpat, expat.h]) 1517fi 1518AC_CHECK_HEADERS([expat.h],,, [AC_INCLUDES_DEFAULT]) 1519AC_CHECK_DECLS([XML_StopParser], [], [], [AC_INCLUDES_DEFAULT 1520#include <expat.h> 1521]) 1522 1523# hiredis (redis C client for cachedb) 1524AC_ARG_WITH(libhiredis, AS_HELP_STRING([--with-libhiredis=path],[specify explicit path for libhiredis.]), 1525 [ ],[ withval="no" ]) 1526found_libhiredis="no" 1527if test x_$withval = x_yes -o x_$withval != x_no; then 1528 AC_MSG_CHECKING(for libhiredis) 1529 if test x_$withval = x_ -o x_$withval = x_yes; then 1530 withval="/usr/local /opt/local /usr/lib /usr/pkg /usr/sfw /usr" 1531 fi 1532 for dir in $withval ; do 1533 if test -f "$dir/include/hiredis/hiredis.h"; then 1534 found_libhiredis="yes" 1535 dnl assume /usr is in default path. 1536 if test "$dir" != "/usr"; then 1537 CPPFLAGS="$CPPFLAGS -I$dir/include" 1538 LDFLAGS="$LDFLAGS -L$dir/lib" 1539 fi 1540 AC_MSG_RESULT(found in $dir) 1541 AC_DEFINE([USE_REDIS], [1], [Define this to use hiredis client.]) 1542 LIBS="$LIBS -lhiredis" 1543 break; 1544 fi 1545 done 1546 if test x_$found_libhiredis != x_yes; then 1547 AC_MSG_ERROR([Could not find libhiredis, hiredis.h]) 1548 fi 1549 AC_CHECK_HEADERS([hiredis/hiredis.h],,, [AC_INCLUDES_DEFAULT]) 1550 AC_CHECK_DECLS([redisConnect], [], [], [AC_INCLUDES_DEFAULT 1551 #include <hiredis/hiredis.h> 1552 ]) 1553fi 1554 1555# nghttp2 1556AC_ARG_WITH(libnghttp2, AS_HELP_STRING([--with-libnghttp2=path],[specify explicit path for libnghttp2.]), 1557 [ ],[ withval="no" ]) 1558found_libnghttp2="no" 1559if test x_$withval = x_yes -o x_$withval != x_no; then 1560 AC_MSG_CHECKING(for libnghttp2) 1561 if test x_$withval = x_ -o x_$withval = x_yes; then 1562 withval="/usr/local /opt/local /usr/lib /usr/pkg /usr/sfw /usr" 1563 fi 1564 for dir in $withval ; do 1565 if test -f "$dir/include/nghttp2/nghttp2.h"; then 1566 found_libnghttp2="yes" 1567 dnl assume /usr is in default path. 1568 if test "$dir" != "/usr"; then 1569 CPPFLAGS="$CPPFLAGS -I$dir/include" 1570 LDFLAGS="$LDFLAGS -L$dir/lib" 1571 fi 1572 AC_MSG_RESULT(found in $dir) 1573 AC_DEFINE([HAVE_NGHTTP2], [1], [Define this to use nghttp2 client.]) 1574 LIBS="$LIBS -lnghttp2" 1575 break; 1576 fi 1577 done 1578 if test x_$found_libnghttp2 != x_yes; then 1579 AC_MSG_ERROR([Could not find libnghttp2, nghttp2.h]) 1580 fi 1581 AC_CHECK_HEADERS([nghttp2/nghttp2.h],,, [AC_INCLUDES_DEFAULT]) 1582 AC_CHECK_DECLS([nghttp2_session_server_new], [], [], [AC_INCLUDES_DEFAULT 1583 #include <nghttp2/nghttp2.h> 1584 ]) 1585fi 1586 1587# ngtcp2 1588AC_ARG_WITH(libngtcp2, AS_HELP_STRING([--with-libngtcp2=path],[specify explicit path for libngtcp2, for QUIC.]), 1589 [ ],[ withval="no" ]) 1590found_libngtcp2="no" 1591if test x_$withval = x_yes -o x_$withval != x_no; then 1592 AC_MSG_CHECKING(for libngtcp2) 1593 if test x_$withval = x_ -o x_$withval = x_yes; then 1594 withval="/usr/local /opt/local /usr/lib /usr/pkg /usr/sfw /usr" 1595 fi 1596 for dir in $withval ; do 1597 if test -f "$dir/include/ngtcp2/ngtcp2.h"; then 1598 found_libngtcp2="yes" 1599 dnl assume /usr is in default path. 1600 if test "$dir" != "/usr"; then 1601 CPPFLAGS="$CPPFLAGS -I$dir/include" 1602 LDFLAGS="$LDFLAGS -L$dir/lib" 1603 fi 1604 AC_MSG_RESULT(found in $dir) 1605 AC_DEFINE([HAVE_NGTCP2], [1], [Define this to use ngtcp2.]) 1606 LIBS="$LIBS -lngtcp2" 1607 break; 1608 fi 1609 done 1610 if test x_$found_libngtcp2 != x_yes; then 1611 AC_MSG_ERROR([Could not find libngtcp2, ngtcp2.h]) 1612 fi 1613 AC_CHECK_HEADERS([ngtcp2/ngtcp2.h ngtcp2/ngtcp2_crypto_openssl.h ngtcp2/ngtcp2_crypto_quictls.h],,, [AC_INCLUDES_DEFAULT]) 1614 AC_CHECK_DECLS([ngtcp2_conn_server_new], [], [], [AC_INCLUDES_DEFAULT 1615 #include <ngtcp2/ngtcp2.h> 1616 ]) 1617 AC_CHECK_DECLS([ngtcp2_crypto_encrypt_cb], [], [], [AC_INCLUDES_DEFAULT 1618 #include <ngtcp2/ngtcp2_crypto.h> 1619 ]) 1620 AC_CHECK_LIB([ngtcp2_crypto_openssl], [ngtcp2_crypto_encrypt_cb], [ LIBS="$LIBS -lngtcp2_crypto_openssl" ]) 1621 AC_CHECK_LIB([ngtcp2_crypto_quictls], [ngtcp2_crypto_encrypt_cb], [ LIBS="$LIBS -lngtcp2_crypto_quictls" ]) 1622 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]) 1623 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.])]) 1624 AC_CHECK_TYPES([struct ngtcp2_version_cid, ngtcp2_encryption_level],,,[AC_INCLUDES_DEFAULT 1625 #include <ngtcp2/ngtcp2.h> 1626 ]) 1627 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 1628 #include <ngtcp2/ngtcp2.h> 1629 ]) 1630 1631 AC_MSG_CHECKING([whether ngtcp2_conn_shutdown_stream has 4 arguments]) 1632 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([AC_INCLUDES_DEFAULT 1633#include <ngtcp2/ngtcp2.h> 1634 ],[ 1635 (void)ngtcp2_conn_shutdown_stream(NULL, 0, 0, 0); 1636 ])],[ 1637 AC_MSG_RESULT(yes) 1638 AC_DEFINE(HAVE_NGTCP2_CONN_SHUTDOWN_STREAM4, 1, [Define if ngtcp2_conn_shutdown_stream has 4 arguments.]) 1639 ],[ 1640 AC_MSG_RESULT(no) 1641 ]) 1642 1643fi 1644 1645# set static linking for uninstalled libraries if requested 1646AC_SUBST(staticexe) 1647staticexe="" 1648AC_ARG_ENABLE(static-exe, AS_HELP_STRING([--enable-static-exe],[ enable to compile executables statically against (event) uninstalled libs, for debug purposes ]), 1649 , ) 1650if test x_$enable_static_exe = x_yes; then 1651 staticexe="-static" 1652 if test "$on_mingw" = yes; then 1653 staticexe="-all-static" 1654 # for static compile, include gdi32 and zlib here. 1655 if echo "$LIBS" | grep 'lgdi32' >/dev/null; then 1656 : 1657 else 1658 LIBS="$LIBS -lgdi32" 1659 fi 1660 AC_CHECK_LIB([z], [compress], [ LIBS="$LIBS -lz" ]) 1661 if echo "$LIBS" | grep -e "libssp.a" -e "lssp" >/dev/null; then 1662 : 1663 else 1664 LIBS="$LIBS -l:libssp.a" 1665 fi 1666 fi 1667fi 1668 1669# set full static linking if requested 1670AC_ARG_ENABLE(fully-static, AS_HELP_STRING([--enable-fully-static],[ enable to compile fully static ]), 1671 , ) 1672if test x_$enable_fully_static = x_yes; then 1673 staticexe="-all-static" 1674 if test "$on_mingw" = yes; then 1675 # for static compile, include gdi32 and zlib here. 1676 if echo $LIBS | grep 'lgdi32' >/dev/null; then 1677 : 1678 else 1679 LIBS="$LIBS -lgdi32" 1680 fi 1681 AC_CHECK_LIB([z], [compress], [ LIBS="$LIBS -lz" ]) 1682 if echo "$LIBS" | grep -e "libssp.a" -e "lssp" >/dev/null; then 1683 : 1684 else 1685 LIBS="$LIBS -l:libssp.a" 1686 fi 1687 fi 1688fi 1689 1690# set lock checking if requested 1691AC_ARG_ENABLE(lock_checks, AS_HELP_STRING([--enable-lock-checks],[ enable to check lock and unlock calls, for debug purposes ]), 1692 , ) 1693if test x_$enable_lock_checks = x_yes; then 1694 AC_DEFINE(ENABLE_LOCK_CHECKS, 1, [Define if you want to use debug lock checking (slow).]) 1695 CHECKLOCK_OBJ="checklocks.lo" 1696 AC_SUBST(CHECKLOCK_OBJ) 1697fi 1698 1699ACX_CHECK_GETADDRINFO_WITH_INCLUDES 1700if test "$USE_WINSOCK" = 1; then 1701 AC_DEFINE(UB_ON_WINDOWS, 1, [Use win32 resources and API]) 1702 AC_CHECK_HEADERS([iphlpapi.h],,, [AC_INCLUDES_DEFAULT 1703#include <windows.h> 1704 ]) 1705 AC_CHECK_TOOL(WINDRES, windres) 1706 if echo "$LIBS" | grep crypt32 >/dev/null; then 1707 LIBS="$LIBS -liphlpapi" 1708 else 1709 LIBS="$LIBS -liphlpapi -lcrypt32" 1710 fi 1711 WINAPPS="unbound-service-install.exe unbound-service-remove.exe anchor-update.exe" 1712 AC_SUBST(WINAPPS) 1713 WIN_DAEMON_SRC="winrc/win_svc.c winrc/w_inst.c" 1714 AC_SUBST(WIN_DAEMON_SRC) 1715 WIN_DAEMON_OBJ="win_svc.lo w_inst.lo" 1716 AC_SUBST(WIN_DAEMON_OBJ) 1717 WIN_DAEMON_OBJ_LINK="rsrc_unbound.o" 1718 AC_SUBST(WIN_DAEMON_OBJ_LINK) 1719 WIN_HOST_OBJ_LINK="rsrc_unbound_host.o" 1720 AC_SUBST(WIN_HOST_OBJ_LINK) 1721 WIN_UBANCHOR_OBJ_LINK="rsrc_unbound_anchor.o log.lo locks.lo" 1722 AC_SUBST(WIN_UBANCHOR_OBJ_LINK) 1723 WIN_CONTROL_OBJ_LINK="rsrc_unbound_control.o" 1724 AC_SUBST(WIN_CONTROL_OBJ_LINK) 1725 WIN_CHECKCONF_OBJ_LINK="rsrc_unbound_checkconf.o" 1726 AC_SUBST(WIN_CHECKCONF_OBJ_LINK) 1727 AC_DEFINE(__USE_MINGW_ANSI_STDIO, 1, [defined to use gcc ansi snprintf and sscanf that understands %lld when compiled for windows.]) 1728fi 1729if test $ac_cv_func_getaddrinfo = no; then 1730 AC_LIBOBJ([fake-rfc2553]) 1731fi 1732# check after getaddrinfo for its libraries 1733ACX_FUNC_IOCTLSOCKET 1734 1735# see if daemon(3) exists, and if it is deprecated. 1736AC_CHECK_FUNCS([daemon]) 1737if test $ac_cv_func_daemon = yes; then 1738 ACX_FUNC_DEPRECATED([daemon], [(void)daemon(0, 0);], [ 1739#include <stdlib.h> 1740#include <unistd.h> 1741]) 1742fi 1743 1744AC_CHECK_MEMBERS([struct sockaddr_un.sun_len],,,[ 1745AC_INCLUDES_DEFAULT 1746#ifdef HAVE_SYS_UN_H 1747#include <sys/un.h> 1748#endif 1749]) 1750AC_CHECK_MEMBERS([struct in_pktinfo.ipi_spec_dst],,,[ 1751AC_INCLUDES_DEFAULT 1752#if HAVE_SYS_PARAM_H 1753#include <sys/param.h> 1754#endif 1755 1756#ifdef HAVE_SYS_SOCKET_H 1757#include <sys/socket.h> 1758#endif 1759 1760#ifdef HAVE_SYS_UIO_H 1761#include <sys/uio.h> 1762#endif 1763 1764#ifdef HAVE_NETINET_IN_H 1765#include <netinet/in.h> 1766#endif 1767 1768#ifdef HAVE_NETINET_TCP_H 1769#include <netinet/tcp.h> 1770#endif 1771 1772#ifdef HAVE_ARPA_INET_H 1773#include <arpa/inet.h> 1774#endif 1775 1776#ifdef HAVE_WINSOCK2_H 1777#include <winsock2.h> 1778#endif 1779 1780#ifdef HAVE_WS2TCPIP_H 1781#include <ws2tcpip.h> 1782#endif 1783]) 1784 1785AC_MSG_CHECKING([for htobe64]) 1786AC_LINK_IFELSE([AC_LANG_PROGRAM([ 1787#include <stdio.h> 1788#ifdef HAVE_ENDIAN_H 1789# include <endian.h> 1790#endif 1791#ifdef HAVE_SYS_ENDIAN_H 1792# include <sys/endian.h> 1793#endif 1794], [unsigned long long x = htobe64(0); printf("%u", (unsigned)x);])], 1795 AC_MSG_RESULT(yes) 1796 AC_DEFINE(HAVE_HTOBE64, 1, [If we have htobe64]), 1797 AC_MSG_RESULT(no)) 1798 1799AC_MSG_CHECKING([for be64toh]) 1800AC_LINK_IFELSE([AC_LANG_PROGRAM([ 1801#include <stdio.h> 1802#ifdef HAVE_ENDIAN_H 1803# include <endian.h> 1804#endif 1805#ifdef HAVE_SYS_ENDIAN_H 1806# include <sys/endian.h> 1807#endif 1808], [unsigned long long x = be64toh(0); printf("%u", (unsigned)x);])], 1809 AC_MSG_RESULT(yes) 1810 AC_DEFINE(HAVE_BE64TOH, 1, [If we have be64toh]), 1811 AC_MSG_RESULT(no)) 1812 1813AC_SEARCH_LIBS([setusercontext], [util]) 1814AC_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]) 1815AC_CHECK_FUNCS([setresuid],,[AC_CHECK_FUNCS([setreuid])]) 1816AC_CHECK_FUNCS([setresgid],,[AC_CHECK_FUNCS([setregid])]) 1817 1818# check if setreuid en setregid fail, on MacOSX10.4(darwin8). 1819if echo $host_os | grep darwin8 > /dev/null; then 1820 AC_DEFINE(DARWIN_BROKEN_SETREUID, 1, [Define this if on macOSX10.4-darwin8 and setreuid and setregid do not work]) 1821fi 1822 1823AC_MSG_CHECKING([for atomic_store]) 1824AC_LINK_IFELSE([AC_LANG_PROGRAM(AC_INCLUDES_DEFAULT [[ 1825#ifdef HAVE_STDATOMIC_H 1826#include <stdatomic.h> 1827#endif 1828]], [[ 1829 int newvar = 5, var = 0; 1830 atomic_store((_Atomic int*)&var, newvar); 1831 newvar = 0; 1832 /* condition to use the variables. */ 1833 if(var == newvar) return 1; 1834]])], [ 1835 AC_MSG_RESULT(yes) 1836 AC_DEFINE(HAVE_LINK_ATOMIC_STORE, 1, [If we have atomic_store]) 1837], [ 1838 AC_MSG_RESULT([no]) 1839]) 1840 1841AC_CHECK_DECLS([inet_pton,inet_ntop], [], [], [ 1842AC_INCLUDES_DEFAULT 1843#ifdef HAVE_NETINET_IN_H 1844#include <netinet/in.h> 1845#endif 1846 1847#ifdef HAVE_NETINET_TCP_H 1848#include <netinet/tcp.h> 1849#endif 1850 1851#ifdef HAVE_ARPA_INET_H 1852#include <arpa/inet.h> 1853#endif 1854 1855#ifdef HAVE_WINSOCK2_H 1856#include <winsock2.h> 1857#endif 1858 1859#ifdef HAVE_WS2TCPIP_H 1860#include <ws2tcpip.h> 1861#endif 1862]) 1863AC_REPLACE_FUNCS(inet_aton) 1864AC_REPLACE_FUNCS(inet_pton) 1865AC_REPLACE_FUNCS(inet_ntop) 1866AC_REPLACE_FUNCS(snprintf) 1867# test if snprintf return the proper length 1868if test "x$ac_cv_func_snprintf" = xyes; then 1869 if test c${cross_compiling} = cno; then 1870 AC_MSG_CHECKING([for correct snprintf return value]) 1871 AC_RUN_IFELSE([AC_LANG_SOURCE(AC_INCLUDES_DEFAULT 1872[[ 1873int main(void) { return !(snprintf(NULL, 0, "test") == 4); } 1874]])], [AC_MSG_RESULT(yes)], [ 1875 AC_MSG_RESULT(no) 1876 AC_DEFINE([SNPRINTF_RET_BROKEN], [], [define if (v)snprintf does not return length needed, (but length used)]) 1877 AC_LIBOBJ(snprintf) 1878 ], [AC_MSG_RESULT(maybe)]) 1879 fi 1880fi 1881AC_REPLACE_FUNCS(strlcat) 1882AC_REPLACE_FUNCS(strlcpy) 1883AC_REPLACE_FUNCS(memmove) 1884AC_REPLACE_FUNCS(gmtime_r) 1885AC_REPLACE_FUNCS(isblank) 1886AC_REPLACE_FUNCS(explicit_bzero) 1887dnl without CTIME, ARC4-functions and without reallocarray. 1888LIBOBJ_WITHOUT_CTIMEARC4="$LIBOBJS" 1889AC_SUBST(LIBOBJ_WITHOUT_CTIMEARC4) 1890AC_MSG_CHECKING([for reallocarray]) 1891AC_LINK_IFELSE([AC_LANG_SOURCE(AC_INCLUDES_DEFAULT 1892[[ 1893#ifndef _OPENBSD_SOURCE 1894#define _OPENBSD_SOURCE 1 1895#endif 1896#include <stdlib.h> 1897int main(void) { 1898 void* p = reallocarray(NULL, 10, 100); 1899 free(p); 1900 return 0; 1901} 1902]])], [AC_MSG_RESULT(yes) 1903 AC_DEFINE(HAVE_REALLOCARRAY, 1, [If we have reallocarray(3)]) 1904], [ 1905 AC_MSG_RESULT(no) 1906 AC_LIBOBJ(reallocarray) 1907]) 1908AC_CHECK_DECLS([reallocarray]) 1909if test "$USE_NSS" = "no"; then 1910 AC_REPLACE_FUNCS(arc4random) 1911 AC_REPLACE_FUNCS(arc4random_uniform) 1912 if test "$ac_cv_func_arc4random" = "no"; then 1913 AC_LIBOBJ(arc4_lock) 1914 AC_CHECK_FUNCS([getentropy],,[ 1915 if test "$USE_WINSOCK" = 1; then 1916 AC_LIBOBJ(getentropy_win) 1917 else 1918 case "$host" in 1919 Darwin|*darwin*) 1920 AC_LIBOBJ(getentropy_osx) 1921 ;; 1922 *solaris*|*sunos*|SunOS) 1923 AC_LIBOBJ(getentropy_solaris) 1924 AC_CHECK_HEADERS([sys/sha2.h],, [ 1925 AC_CHECK_FUNCS([SHA512_Update],,[ 1926 AC_LIBOBJ(sha512) 1927 ]) 1928 ], [AC_INCLUDES_DEFAULT]) 1929 if test "$ac_cv_header_sys_sha2_h" = "yes"; then 1930 # this lib needed for sha2 on solaris 1931 LIBS="$LIBS -lmd" 1932 fi 1933 AC_SEARCH_LIBS([clock_gettime], [rt]) 1934 ;; 1935 *freebsd*|*FreeBSD) 1936 AC_LIBOBJ(getentropy_freebsd) 1937 ;; 1938 *linux*|Linux|*) 1939 AC_LIBOBJ(getentropy_linux) 1940 AC_CHECK_FUNCS([SHA512_Update],,[ 1941 AC_DEFINE([COMPAT_SHA512], [1], [Do sha512 definitions in config.h]) 1942 AC_LIBOBJ(sha512) 1943 ]) 1944 AC_CHECK_HEADERS([sys/sysctl.h],,, [AC_INCLUDES_DEFAULT]) 1945 AC_CHECK_FUNCS([getauxval]) 1946 AC_SEARCH_LIBS([clock_gettime], [rt]) 1947 ;; 1948 esac 1949 fi 1950 ]) 1951 fi 1952fi 1953LIBOBJ_WITHOUT_CTIME="$LIBOBJS" 1954AC_SUBST(LIBOBJ_WITHOUT_CTIME) 1955AC_REPLACE_FUNCS(ctime_r) 1956AC_REPLACE_FUNCS(strsep) 1957 1958AC_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])) 1959case "$enable_allsymbols" in 1960 yes) 1961 COMMON_OBJ_ALL_SYMBOLS="" 1962 UBSYMS="" 1963 EXTRALINK="libunbound.la" 1964 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]) 1965 ;; 1966 no|*) 1967 COMMON_OBJ_ALL_SYMBOLS='$(COMMON_OBJ)' 1968 UBSYMS='-export-symbols $(srcdir)/libunbound/ubsyms.def' 1969 EXTRALINK="" 1970 ;; 1971esac 1972AC_SUBST(COMMON_OBJ_ALL_SYMBOLS) 1973AC_SUBST(EXTRALINK) 1974AC_SUBST(UBSYMS) 1975if test x_$enable_lock_checks = x_yes; then 1976 UBSYMS="-export-symbols clubsyms.def" 1977 cp ${srcdir}/libunbound/ubsyms.def clubsyms.def 1978 echo lock_protect >> clubsyms.def 1979 echo lock_protect_place >> clubsyms.def 1980 echo lock_unprotect >> clubsyms.def 1981 echo lock_get_mem >> clubsyms.def 1982 echo checklock_start >> clubsyms.def 1983 echo checklock_stop >> clubsyms.def 1984 echo checklock_set_output_name >> clubsyms.def 1985 echo checklock_lock >> clubsyms.def 1986 echo checklock_unlock >> clubsyms.def 1987 echo checklock_init >> clubsyms.def 1988 echo checklock_thrcreate >> clubsyms.def 1989 echo checklock_thrjoin >> clubsyms.def 1990fi 1991 1992# check for dnstap if requested 1993dt_DNSTAP([$UNBOUND_RUN_DIR/dnstap.sock], 1994 [ 1995 AC_DEFINE([USE_DNSTAP], [1], [Define to 1 to enable dnstap support]) 1996 AC_SUBST([ENABLE_DNSTAP], [1]) 1997 1998 AC_SUBST([opt_dnstap_socket_path]) 1999 ACX_ESCAPE_BACKSLASH($opt_dnstap_socket_path, hdr_dnstap_socket_path) 2000 AC_DEFINE_UNQUOTED(DNSTAP_SOCKET_PATH, 2001 ["$hdr_dnstap_socket_path"], [default dnstap socket path]) 2002 AC_SUBST(DNSTAP_SOCKET_PATH,["$hdr_dnstap_socket_path"]) 2003 AC_SUBST(DNSTAP_SOCKET_TESTBIN,['unbound-dnstap-socket$(EXEEXT)']) 2004 AC_SUBST([DNSTAP_SRC], ["dnstap/dnstap.c dnstap/dnstap.pb-c.c dnstap/dnstap_fstrm.c dnstap/dtstream.c"]) 2005 AC_SUBST([DNSTAP_OBJ], ["dnstap.lo dnstap.pb-c.lo dnstap_fstrm.lo dtstream.lo"]) 2006 ], 2007 [ 2008 AC_SUBST([ENABLE_DNSTAP], [0]) 2009 ] 2010) 2011 2012# check for dnscrypt if requested 2013dnsc_DNSCRYPT([ 2014 AC_DEFINE([USE_DNSCRYPT], [1], [Define to 1 to enable dnscrypt support]) 2015 AC_SUBST([ENABLE_DNSCRYPT], [1]) 2016 2017 AC_SUBST([DNSCRYPT_SRC], ["dnscrypt/dnscrypt.c"]) 2018 AC_SUBST([DNSCRYPT_OBJ], ["dnscrypt.lo"]) 2019 ], 2020 [ 2021 AC_SUBST([ENABLE_DNSCRYPT], [0]) 2022 ] 2023) 2024 2025# check for cachedb if requested 2026AC_ARG_ENABLE(cachedb, AS_HELP_STRING([--enable-cachedb],[enable cachedb module that can use external cache storage])) 2027# turn on cachedb when hiredis support is enabled. 2028if test "$found_libhiredis" = "yes"; then enable_cachedb="yes"; fi 2029case "$enable_cachedb" in 2030 yes) 2031 AC_DEFINE([USE_CACHEDB], [1], [Define to 1 to use cachedb support]) 2032 AC_SUBST([CACHEDB_SRC], ["cachedb/cachedb.c cachedb/redis.c"]) 2033 AC_SUBST([CACHEDB_OBJ], ["cachedb.lo redis.lo"]) 2034 ;; 2035 no|*) 2036 # nothing 2037 ;; 2038esac 2039 2040# check for ipsecmod if requested 2041AC_ARG_ENABLE(ipsecmod, AS_HELP_STRING([--enable-ipsecmod],[Enable ipsecmod module that facilitates opportunistic IPsec])) 2042case "$enable_ipsecmod" in 2043 yes) 2044 AC_DEFINE([USE_IPSECMOD], [1], [Define to 1 to use ipsecmod support.]) 2045 IPSECMOD_OBJ="ipsecmod.lo ipsecmod-whitelist.lo" 2046 AC_SUBST(IPSECMOD_OBJ) 2047 IPSECMOD_HEADER='$(srcdir)/ipsecmod/ipsecmod.h $(srcdir)/ipsecmod/ipsecmod-whitelist.h' 2048 AC_SUBST(IPSECMOD_HEADER) 2049 ;; 2050 no|*) 2051 # nothing 2052 ;; 2053esac 2054 2055# check for ipset if requested 2056AC_ARG_ENABLE(ipset, AS_HELP_STRING([--enable-ipset],[enable ipset module])) 2057case "$enable_ipset" in 2058 yes) 2059 AC_DEFINE([USE_IPSET], [1], [Define to 1 to use ipset support]) 2060 IPSET_SRC="ipset/ipset.c" 2061 AC_SUBST(IPSET_SRC) 2062 IPSET_OBJ="ipset.lo" 2063 AC_SUBST(IPSET_OBJ) 2064 2065 # BSD's pf 2066 AC_CHECK_HEADERS([net/pfvar.h], [], [ 2067 # mnl 2068 AC_ARG_WITH(libmnl, AS_HELP_STRING([--with-libmnl=path],[specify explicit path for libmnl.]), 2069 [ ],[ withval="yes" ]) 2070 found_libmnl="no" 2071 AC_MSG_CHECKING(for libmnl) 2072 if test x_$withval = x_ -o x_$withval = x_yes; then 2073 withval="/usr/local /opt/local /usr/lib /usr/pkg /usr/sfw /usr" 2074 fi 2075 for dir in $withval ; do 2076 if test -f "$dir/include/libmnl/libmnl.h" -o -f "$dir/include/libmnl/libmnl/libmnl.h"; then 2077 found_libmnl="yes" 2078 dnl assume /usr is in default path. 2079 extralibmnl="" 2080 if test -f "$dir/include/libmnl/libmnl/libmnl.h"; then 2081 extralibmnl="/libmnl" 2082 fi 2083 if test "$dir" != "/usr" -o -n "$extralibmnl"; then 2084 CPPFLAGS="$CPPFLAGS -I$dir/include$extralibmnl" 2085 fi 2086 if test "$dir" != "/usr"; then 2087 LDFLAGS="$LDFLAGS -L$dir/lib" 2088 fi 2089 AC_MSG_RESULT(found in $dir) 2090 LIBS="$LIBS -lmnl" 2091 break; 2092 fi 2093 done 2094 if test x_$found_libmnl != x_yes; then 2095 AC_MSG_ERROR([Could not find libmnl, libmnl.h]) 2096 fi 2097 ], [ 2098 #include <netinet/in.h> 2099 #include <net/if.h> 2100 ]) 2101 ;; 2102 no|*) 2103 # nothing 2104 ;; 2105esac 2106AC_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])) 2107case "$enable_explicit_port_randomisation" in 2108 no) 2109 AC_DEFINE([DISABLE_EXPLICIT_PORT_RANDOMISATION], [1], [Define this to enable kernel based UDP source port randomization.]) 2110 ;; 2111 yes|*) 2112 ;; 2113esac 2114 2115if echo "$host" | $GREP -i -e linux >/dev/null; then 2116 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.])) 2117 case "$enable_linux_ip_local_port_range" in 2118 yes) 2119 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.]) 2120 ;; 2121 no|*) 2122 ;; 2123 esac 2124fi 2125 2126 2127AC_MSG_CHECKING([if ${MAKE:-make} supports $< with implicit rule in scope]) 2128# on openBSD, the implicit rule make $< work. 2129# on Solaris, it does not work ($? is changed sources, $^ lists dependencies). 2130# gmake works. 2131cat >conftest.make <<EOF 2132all: conftest.lo 2133 2134conftest.lo foo.lo bla.lo: 2135 if test -f "\$<"; then touch \$@; fi 2136 2137.SUFFIXES: .lo 2138.c.lo: 2139 if test -f "\$<"; then touch \$@; fi 2140 2141conftest.lo: conftest.dir/conftest.c 2142EOF 2143mkdir conftest.dir 2144touch conftest.dir/conftest.c 2145rm -f conftest.lo conftest.c 2146${MAKE:-make} -f conftest.make >/dev/null 2147rm -f conftest.make conftest.c conftest.dir/conftest.c 2148rm -rf conftest.dir 2149if test ! -f conftest.lo; then 2150 AC_MSG_RESULT(no) 2151 SOURCEDETERMINE='echo "$^" | awk "-F " "{print \$$1;}" > .source' 2152 SOURCEFILE='`cat .source`' 2153else 2154 AC_MSG_RESULT(yes) 2155 SOURCEDETERMINE=':' 2156 SOURCEFILE='$<' 2157fi 2158rm -f conftest.lo 2159AC_SUBST(SOURCEDETERMINE) 2160AC_SUBST(SOURCEFILE) 2161 2162# see if we want to build the library or everything 2163ALLTARGET="alltargets" 2164INSTALLTARGET="install-all" 2165AC_ARG_WITH(libunbound-only, AS_HELP_STRING([--with-libunbound-only],[do not build daemon and tool programs]), 2166 [ 2167 if test "$withval" = "yes"; then 2168 ALLTARGET="lib" 2169 INSTALLTARGET="install-lib" 2170 fi 2171]) 2172if test $ALLTARGET = "alltargets"; then 2173 if test $USE_NSS = "yes"; then 2174 AC_MSG_ERROR([--with-nss can only be used in combination with --with-libunbound-only.]) 2175 fi 2176 if test $USE_NETTLE = "yes"; then 2177 AC_MSG_ERROR([--with-nettle can only be used in combination with --with-libunbound-only.]) 2178 fi 2179fi 2180 2181AC_SUBST(ALLTARGET) 2182AC_SUBST(INSTALLTARGET) 2183 2184ACX_STRIP_EXT_FLAGS 2185if test -n "$LATE_LDFLAGS"; then 2186 LDFLAGS="$LATE_LDFLAGS $LDFLAGS" 2187fi 2188# remove start spaces 2189LDFLAGS=`echo "$LDFLAGS"|sed -e 's/^ *//'` 2190LIBS=`echo "$LIBS"|sed -e 's/^ *//'` 2191 2192AC_DEFINE_UNQUOTED([MAXSYSLOGMSGLEN], [10240], [Define to the maximum message length to pass to syslog.]) 2193 2194AH_BOTTOM( 2195dnl this must be first AH_CONFIG, to define the flags before any includes. 2196AHX_CONFIG_EXT_FLAGS 2197 2198dnl includes 2199[ 2200#ifndef _OPENBSD_SOURCE 2201#define _OPENBSD_SOURCE 1 2202#endif 2203 2204#ifndef UNBOUND_DEBUG 2205# ifndef NDEBUG 2206# define NDEBUG 2207# endif 2208#endif 2209 2210/** Use small-ldns codebase */ 2211#define USE_SLDNS 1 2212#ifdef HAVE_SSL 2213# define LDNS_BUILD_CONFIG_HAVE_SSL 1 2214#endif 2215 2216#include <stdio.h> 2217#include <string.h> 2218#include <unistd.h> 2219#include <assert.h> 2220 2221#if STDC_HEADERS 2222#include <stdlib.h> 2223#include <stddef.h> 2224#endif 2225 2226#ifdef HAVE_STDARG_H 2227#include <stdarg.h> 2228#endif 2229 2230#ifdef HAVE_STDINT_H 2231#include <stdint.h> 2232#endif 2233 2234#include <errno.h> 2235 2236#if HAVE_SYS_PARAM_H 2237#include <sys/param.h> 2238#endif 2239 2240#ifdef HAVE_SYS_SOCKET_H 2241#include <sys/socket.h> 2242#endif 2243 2244#ifdef HAVE_SYS_UIO_H 2245#include <sys/uio.h> 2246#endif 2247 2248#ifdef HAVE_NETINET_IN_H 2249#include <netinet/in.h> 2250#endif 2251 2252#ifdef HAVE_NETINET_TCP_H 2253#include <netinet/tcp.h> 2254#endif 2255 2256#ifdef HAVE_ARPA_INET_H 2257#include <arpa/inet.h> 2258#endif 2259 2260#ifdef HAVE_WINSOCK2_H 2261#include <winsock2.h> 2262#endif 2263 2264#ifdef HAVE_WS2TCPIP_H 2265#include <ws2tcpip.h> 2266#endif 2267 2268#if !defined(USE_WINSOCK) || !defined(HAVE_SNPRINTF) || defined(SNPRINTF_RET_BROKEN) || defined(__USE_MINGW_ANSI_STDIO) 2269#define ARG_LL "%ll" 2270#else 2271#define ARG_LL "%I64" 2272#endif 2273 2274#ifndef AF_LOCAL 2275#define AF_LOCAL AF_UNIX 2276#endif 2277] 2278 2279AHX_CONFIG_FORMAT_ATTRIBUTE 2280AHX_CONFIG_UNUSED_ATTRIBUTE 2281AHX_CONFIG_FSEEKO 2282AHX_CONFIG_MAXHOSTNAMELEN 2283#if !defined(HAVE_SNPRINTF) || defined(SNPRINTF_RET_BROKEN) 2284#define snprintf snprintf_unbound 2285#define vsnprintf vsnprintf_unbound 2286#include <stdarg.h> 2287int snprintf (char *str, size_t count, const char *fmt, ...); 2288int vsnprintf (char *str, size_t count, const char *fmt, va_list arg); 2289#endif /* HAVE_SNPRINTF or SNPRINTF_RET_BROKEN */ 2290AHX_CONFIG_INET_PTON(unbound) 2291AHX_CONFIG_INET_NTOP(unbound) 2292AHX_CONFIG_INET_ATON(unbound) 2293AHX_CONFIG_MEMMOVE(unbound) 2294AHX_CONFIG_STRLCAT(unbound) 2295AHX_CONFIG_STRLCPY(unbound) 2296AHX_CONFIG_GMTIME_R(unbound) 2297AHX_CONFIG_REALLOCARRAY(unbound) 2298AHX_CONFIG_W32_SLEEP 2299AHX_CONFIG_W32_USLEEP 2300AHX_CONFIG_W32_RANDOM 2301AHX_CONFIG_W32_SRANDOM 2302AHX_CONFIG_W32_FD_SET_T 2303AHX_CONFIG_IPV6_MIN_MTU 2304AHX_MEMCMP_BROKEN(unbound) 2305 2306[ 2307#ifndef HAVE_CTIME_R 2308#define ctime_r unbound_ctime_r 2309char *ctime_r(const time_t *timep, char *buf); 2310#endif 2311 2312#ifndef HAVE_STRSEP 2313#define strsep unbound_strsep 2314char *strsep(char **stringp, const char *delim); 2315#endif 2316 2317#ifndef HAVE_ISBLANK 2318#define isblank unbound_isblank 2319int isblank(int c); 2320#endif 2321 2322#ifndef HAVE_EXPLICIT_BZERO 2323#define explicit_bzero unbound_explicit_bzero 2324void explicit_bzero(void* buf, size_t len); 2325#endif 2326 2327#if defined(HAVE_INET_NTOP) && !HAVE_DECL_INET_NTOP 2328const char *inet_ntop(int af, const void *src, char *dst, size_t size); 2329#endif 2330 2331#if defined(HAVE_INET_PTON) && !HAVE_DECL_INET_PTON 2332int inet_pton(int af, const char* src, void* dst); 2333#endif 2334 2335#if !defined(HAVE_STRPTIME) || !defined(STRPTIME_WORKS) 2336#define strptime unbound_strptime 2337struct tm; 2338char *strptime(const char *s, const char *format, struct tm *tm); 2339#endif 2340 2341#if !HAVE_DECL_REALLOCARRAY 2342void *reallocarray(void *ptr, size_t nmemb, size_t size); 2343#endif 2344 2345#ifdef HAVE_LIBBSD 2346#include <bsd/string.h> 2347#include <bsd/stdlib.h> 2348#endif 2349 2350#ifdef HAVE_LIBRESSL 2351# if !HAVE_DECL_STRLCPY 2352size_t strlcpy(char *dst, const char *src, size_t siz); 2353# endif 2354# if !HAVE_DECL_STRLCAT 2355size_t strlcat(char *dst, const char *src, size_t siz); 2356# endif 2357# if !HAVE_DECL_ARC4RANDOM && defined(HAVE_ARC4RANDOM) 2358uint32_t arc4random(void); 2359# endif 2360# if !HAVE_DECL_ARC4RANDOM_UNIFORM && defined(HAVE_ARC4RANDOM_UNIFORM) 2361uint32_t arc4random_uniform(uint32_t upper_bound); 2362# endif 2363#endif /* HAVE_LIBRESSL */ 2364#ifndef HAVE_ARC4RANDOM 2365int getentropy(void* buf, size_t len); 2366uint32_t arc4random(void); 2367void arc4random_buf(void* buf, size_t n); 2368void _ARC4_LOCK(void); 2369void _ARC4_UNLOCK(void); 2370void _ARC4_LOCK_DESTROY(void); 2371#endif 2372#ifndef HAVE_ARC4RANDOM_UNIFORM 2373uint32_t arc4random_uniform(uint32_t upper_bound); 2374#endif 2375#ifdef COMPAT_SHA512 2376#ifndef SHA512_DIGEST_LENGTH 2377#define SHA512_BLOCK_LENGTH 128 2378#define SHA512_DIGEST_LENGTH 64 2379#define SHA512_DIGEST_STRING_LENGTH (SHA512_DIGEST_LENGTH * 2 + 1) 2380typedef struct _SHA512_CTX { 2381 uint64_t state[8]; 2382 uint64_t bitcount[2]; 2383 uint8_t buffer[SHA512_BLOCK_LENGTH]; 2384} SHA512_CTX; 2385#endif /* SHA512_DIGEST_LENGTH */ 2386void SHA512_Init(SHA512_CTX*); 2387void SHA512_Update(SHA512_CTX*, void*, size_t); 2388void SHA512_Final(uint8_t[SHA512_DIGEST_LENGTH], SHA512_CTX*); 2389unsigned char *SHA512(void* data, unsigned int data_len, unsigned char *digest); 2390#endif /* COMPAT_SHA512 */ 2391 2392 2393 2394#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)) 2395 /* using version of libevent that is not threadsafe. */ 2396# define LIBEVENT_SIGNAL_PROBLEM 1 2397#endif 2398 2399#ifndef CHECKED_INET6 2400# define CHECKED_INET6 2401# ifdef AF_INET6 2402# define INET6 2403# else 2404# define AF_INET6 28 2405# endif 2406#endif /* CHECKED_INET6 */ 2407 2408#ifndef HAVE_GETADDRINFO 2409struct sockaddr_storage; 2410#include "compat/fake-rfc2553.h" 2411#endif 2412 2413#ifdef UNBOUND_ALLOC_STATS 2414# define malloc(s) unbound_stat_malloc_log(s, __FILE__, __LINE__, __func__) 2415# define calloc(n,s) unbound_stat_calloc_log(n, s, __FILE__, __LINE__, __func__) 2416# define free(p) unbound_stat_free_log(p, __FILE__, __LINE__, __func__) 2417# define realloc(p,s) unbound_stat_realloc_log(p, s, __FILE__, __LINE__, __func__) 2418# define strdup(s) unbound_stat_strdup_log(s, __FILE__, __LINE__, __func__) 2419#ifdef HAVE_REALLOCARRAY 2420# define reallocarray(p,n,s) unbound_stat_reallocarray_log(p, n, s, __FILE__, __LINE__, __func__) 2421#endif 2422void *unbound_stat_malloc(size_t size); 2423void *unbound_stat_calloc(size_t nmemb, size_t size); 2424void unbound_stat_free(void *ptr); 2425void *unbound_stat_realloc(void *ptr, size_t size); 2426void *unbound_stat_malloc_log(size_t size, const char* file, int line, 2427 const char* func); 2428void *unbound_stat_calloc_log(size_t nmemb, size_t size, const char* file, 2429 int line, const char* func); 2430void unbound_stat_free_log(void *ptr, const char* file, int line, 2431 const char* func); 2432void *unbound_stat_realloc_log(void *ptr, size_t size, const char* file, 2433 int line, const char* func); 2434void *unbound_stat_reallocarray_log(void *ptr, size_t nmemb, size_t size, 2435 const char* file, int line, const char* func); 2436char *unbound_stat_strdup_log(const char *s, const char* file, int line, 2437 const char* func); 2438#elif defined(UNBOUND_ALLOC_LITE) 2439# include "util/alloc.h" 2440#endif /* UNBOUND_ALLOC_LITE and UNBOUND_ALLOC_STATS */ 2441 2442/** default port for DNS traffic. */ 2443#define UNBOUND_DNS_PORT 53 2444/** default port for DNS over TLS traffic. */ 2445#define UNBOUND_DNS_OVER_TLS_PORT 853 2446/** default port for DNS over HTTPS traffic. */ 2447#define UNBOUND_DNS_OVER_HTTPS_PORT 443 2448/** default port for DNS over QUIC traffic. */ 2449#define UNBOUND_DNS_OVER_QUIC_PORT 853 2450/** default port for unbound control traffic, registered port with IANA, 2451 ub-dns-control 8953/tcp unbound dns nameserver control */ 2452#define UNBOUND_CONTROL_PORT 8953 2453/** the version of unbound-control that this software implements */ 2454#define UNBOUND_CONTROL_VERSION 1 2455 2456]) 2457 2458dnl if we build from source tree, the man pages need @date@ and @version@ 2459dnl if this is a distro tarball, that was already done by makedist.sh 2460AC_SUBST(version, [VERSION_MAJOR.VERSION_MINOR.VERSION_MICRO]) 2461AX_BUILD_DATE_EPOCH(date, [[%b %e, %Y]]) 2462AC_SUBST(date) 2463 2464AC_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]) 2465AC_CONFIG_HEADERS([config.h]) 2466AC_OUTPUT 2467