1# -*- Autoconf -*- 2# Process this file with autoconf to produce a configure script. 3AC_PREREQ(2.56) 4sinclude(acx_nlnetlabs.m4) 5sinclude(acx_pthread.m4) 6sinclude(acx_python.m4) 7sinclude(ac_pkg_swig.m4) 8 9AC_INIT(unbound, 1.4.20, unbound-bugs@nlnetlabs.nl, unbound) 10 11LIBUNBOUND_CURRENT=3 12LIBUNBOUND_REVISION=5 13LIBUNBOUND_AGE=1 14# 1.0.0 had 0:12:0 15# 1.0.1 had 0:13:0 16# 1.0.2 had 0:14:0 17# 1.1.0 had 0:15:0 18# 1.1.1 had 0:16:0 19# 1.2.0 had 0:17:0 20# 1.2.1 had 0:18:0 21# 1.3.0 had 1:0:0 # ub_cancel and -export-symbols. 22# 1.3.1 had 1:1:0 23# 1.3.2 had 1:2:0 24# 1.3.3 had 1:3:0 25# 1.3.4 had 1:4:0 26# 1.4.0-snapshots had 1:5:0 27# 1.4.0 had 1:5:0 (not 2:0:0) # ub_result.why_bogus 28# 1.4.1 had 2:1:0 29# 1.4.2 had 2:2:0 30# 1.4.3 had 2:3:0 31# 1.4.4 had 2:4:0 32# 1.4.5 had 2:5:0 33# 1.4.6 had 2:6:0 34# 1.4.7 had 2:7:0 35# 1.4.8 had 2:8:0 36# 1.4.9 had 2:9:0 37# 1.4.10 had 2:10:0 38# 1.4.11 had 2:11:0 39# 1.4.12 had 2:12:0 40# 1.4.13 had 2:13:0 41# and 1.4.13p1 and 1.4.13.p2 42# 1.4.14 had 2:14:0 43# 1.4.15 had 3:0:1 # adds ub_version() 44# 1.4.16 had 3:1:1 45# 1.4.17 had 3:2:1 46# 1.4.18 had 3:3:1 47# 1.4.19 had 3:4:1 48# 1.4.20 had 4:0:2 # adds libunbound.ttl 49 50# Current -- the number of the binary API that we're implementing 51# Revision -- which iteration of the implementation of the binary 52# API are we supplying? 53# Age -- How many previous binary API versions do we also 54# support? 55# 56# If we release a new version that does not change the binary API, 57# increment Revision. 58# 59# If we release a new version that changes the binary API, but does 60# not break programs compiled against the old binary API, increment 61# Current and Age. Set Revision to 0, since this is the first 62# implementation of the new API. 63# 64# Otherwise, we're changing the binary API and breaking bakward 65# compatibility with old binaries. Increment Current. Set Age to 0, 66# since we're backward compatible with no previous APIs. Set Revision 67# to 0 too. 68AC_SUBST(LIBUNBOUND_CURRENT) 69AC_SUBST(LIBUNBOUND_REVISION) 70AC_SUBST(LIBUNBOUND_AGE) 71 72CFLAGS="$CFLAGS" 73AC_AIX 74 75dnl 76dnl By default set prefix to /usr/local 77dnl 78case "$prefix" in 79 NONE) 80 prefix="/usr/local" 81 ;; 82esac 83 84# are we on MinGW? 85if uname -s 2>&1 | grep MINGW32 >/dev/null; then on_mingw="yes" 86else 87 if echo $target | grep mingw32 >/dev/null; then on_mingw="yes" 88 else on_mingw="no"; fi 89fi 90 91# 92# Determine configuration file 93# the eval is to evaluate shell expansion twice 94if test $on_mingw = "no"; then 95 ub_conf_file=`eval echo "${sysconfdir}/unbound/unbound.conf"` 96else 97 ub_conf_file="C:\\Program Files\\Unbound\\service.conf" 98fi 99AC_ARG_WITH([conf_file], 100 AC_HELP_STRING([--with-conf-file=path], 101 [Pathname to the Unbound configuration file]), 102 [ub_conf_file="$withval"]) 103AC_SUBST(ub_conf_file) 104ACX_ESCAPE_BACKSLASH($ub_conf_file, hdr_config) 105AC_DEFINE_UNQUOTED(CONFIGFILE, ["$hdr_config"], [Pathname to the Unbound configuration file]) 106 107# Determine run, chroot directory and pidfile locations 108AC_ARG_WITH(run-dir, 109 AC_HELP_STRING([--with-run-dir=path], 110 [set default directory to chdir to (by default dir part of cfg file)]), 111 UNBOUND_RUN_DIR="$withval", 112if test $on_mingw = no; then 113 UNBOUND_RUN_DIR=`dirname "$ub_conf_file"` 114else 115 UNBOUND_RUN_DIR="" 116fi 117) 118AC_SUBST(UNBOUND_RUN_DIR) 119ACX_ESCAPE_BACKSLASH($UNBOUND_RUN_DIR, hdr_run) 120AC_DEFINE_UNQUOTED(RUN_DIR, ["$hdr_run"], [Directory to chdir to]) 121 122AC_ARG_WITH(chroot-dir, 123 AC_HELP_STRING([--with-chroot-dir=path], 124 [set default directory to chroot to (by default same as run-dir)]), 125 UNBOUND_CHROOT_DIR="$withval", 126if test $on_mingw = no; then 127 UNBOUND_CHROOT_DIR="$UNBOUND_RUN_DIR" 128else 129 UNBOUND_CHROOT_DIR="" 130fi 131) 132AC_SUBST(UNBOUND_CHROOT_DIR) 133ACX_ESCAPE_BACKSLASH($UNBOUND_CHROOT_DIR, hdr_chroot) 134AC_DEFINE_UNQUOTED(CHROOT_DIR, ["$hdr_chroot"], [Directory to chroot to]) 135 136AC_ARG_WITH(share-dir, 137 AC_HELP_STRING([--with-share-dir=path], 138 [set default directory with shared data (by default same as share/unbound)]), 139 UNBOUND_SHARE_DIR="$withval", 140 UNBOUND_SHARE_DIR="$UNBOUND_RUN_DIR") 141AC_SUBST(UNBOUND_SHARE_DIR) 142AC_DEFINE_UNQUOTED(SHARE_DIR, ["$UNBOUND_SHARE_DIR"], [Shared data]) 143 144AC_ARG_WITH(pidfile, 145 AC_HELP_STRING([--with-pidfile=filename], 146 [set default pathname to unbound pidfile (default run-dir/unbound.pid)]), 147 UNBOUND_PIDFILE="$withval", 148if test $on_mingw = no; then 149 UNBOUND_PIDFILE="$UNBOUND_RUN_DIR/unbound.pid" 150else 151 UNBOUND_PIDFILE="" 152fi 153) 154AC_SUBST(UNBOUND_PIDFILE) 155ACX_ESCAPE_BACKSLASH($UNBOUND_PIDFILE, hdr_pid) 156AC_DEFINE_UNQUOTED(PIDFILE, ["$hdr_pid"], [default pidfile location]) 157 158AC_ARG_WITH(rootkey-file, 159 AC_HELP_STRING([--with-rootkey-file=filename], 160 [set default pathname to root key file (default run-dir/root.key). This file is read and written.]), 161 UNBOUND_ROOTKEY_FILE="$withval", 162if test $on_mingw = no; then 163 UNBOUND_ROOTKEY_FILE="$UNBOUND_RUN_DIR/root.key" 164else 165 UNBOUND_ROOTKEY_FILE="C:\\Program Files\\Unbound\\root.key" 166fi 167) 168AC_SUBST(UNBOUND_ROOTKEY_FILE) 169ACX_ESCAPE_BACKSLASH($UNBOUND_ROOTKEY_FILE, hdr_rkey) 170AC_DEFINE_UNQUOTED(ROOT_ANCHOR_FILE, ["$hdr_rkey"], [default rootkey location]) 171 172AC_ARG_WITH(rootcert-file, 173 AC_HELP_STRING([--with-rootcert-file=filename], 174 [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.]), 175 UNBOUND_ROOTCERT_FILE="$withval", 176if test $on_mingw = no; then 177 UNBOUND_ROOTCERT_FILE="$UNBOUND_RUN_DIR/icannbundle.pem" 178else 179 UNBOUND_ROOTCERT_FILE="C:\\Program Files\\Unbound\\icannbundle.pem" 180fi 181) 182AC_SUBST(UNBOUND_ROOTCERT_FILE) 183ACX_ESCAPE_BACKSLASH($UNBOUND_ROOTCERT_FILE, hdr_rpem) 184AC_DEFINE_UNQUOTED(ROOT_CERT_FILE, ["$hdr_rpem"], [default rootcert location]) 185 186AC_ARG_WITH(username, 187 AC_HELP_STRING([--with-username=user], 188 [set default user that unbound changes to (default user is unbound)]), 189 UNBOUND_USERNAME="$withval", 190 UNBOUND_USERNAME="unbound") 191AC_SUBST(UNBOUND_USERNAME) 192AC_DEFINE_UNQUOTED(UB_USERNAME, ["$UNBOUND_USERNAME"], [default username]) 193 194AC_DEFINE(WINVER, 0x0502, [the version of the windows API enabled]) 195ACX_RSRC_VERSION(wnvs) 196AC_DEFINE_UNQUOTED(RSRC_PACKAGE_VERSION, [$wnvs], [version number for resource files]) 197 198# Checks for typedefs, structures, and compiler characteristics. 199AC_C_CONST 200AC_LANG_C 201# allow user to override the -g -O2 flags. 202if test "x$CFLAGS" = "x" ; then 203ACX_CHECK_COMPILER_FLAG(g, [CFLAGS="$CFLAGS -g"]) 204ACX_CHECK_COMPILER_FLAG(O2, [CFLAGS="$CFLAGS -O2"]) 205fi 206AC_PROG_CC 207ACX_DEPFLAG 208ACX_DETERMINE_EXT_FLAGS_UNBOUND 209 210# debug mode flags warnings 211AC_ARG_ENABLE(checking, AC_HELP_STRING([--enable-checking], [Enable warnings, asserts, makefile-dependencies])) 212AC_ARG_ENABLE(debug, AC_HELP_STRING([--enable-debug], [same as enable-checking])) 213if test "$enable_debug" = "yes"; then debug_enabled="$enable_debug"; 214else debug_enabled="$enable_checking"; fi 215AC_SUBST(debug_enabled) 216case "$debug_enabled" in 217 yes) 218 ACX_CHECK_COMPILER_FLAG(W, [CFLAGS="$CFLAGS -W"]) 219 ACX_CHECK_COMPILER_FLAG(Wall, [CFLAGS="$CFLAGS -Wall"]) 220 ACX_CHECK_COMPILER_FLAG(Wextra, [CFLAGS="$CFLAGS -Wextra"]) 221 ACX_CHECK_COMPILER_FLAG(Wdeclaration-after-statement, [CFLAGS="$CFLAGS -Wdeclaration-after-statement"]) 222 AC_DEFINE([UNBOUND_DEBUG], [], [define this to enable debug checks.]) 223 ;; 224 no|*) 225 # nothing to do. 226 ;; 227esac 228ACX_CHECK_FLTO 229 230AC_C_INLINE 231ACX_CHECK_FORMAT_ATTRIBUTE 232ACX_CHECK_UNUSED_ATTRIBUTE 233 234if test "$srcdir" != "."; then 235 CPPFLAGS="$CPPFLAGS -I$srcdir" 236fi 237 238AC_DEFUN([ACX_YYLEX_DESTROY], [ 239 AC_MSG_CHECKING([for yylex_destroy]) 240 if echo %% | $LEX -t 2>&1 | grep yylex_destroy >/dev/null 2>&1; then 241 AC_DEFINE(LEX_HAS_YYLEX_DESTROY, 1, [if lex has yylex_destroy]) 242 AC_MSG_RESULT(yes) 243 else AC_MSG_RESULT(no); fi 244]) 245 246AC_PROG_LEX 247ACX_YYLEX_DESTROY 248AC_PROG_YACC 249AC_CHECK_PROG(doxygen, doxygen, doxygen) 250AC_CHECK_TOOL(STRIP, strip) 251ACX_LIBTOOL_C_ONLY 252 253# Checks for header files. 254AC_CHECK_HEADERS([stdarg.h stdbool.h netinet/in.h sys/param.h sys/socket.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],,, [AC_INCLUDES_DEFAULT]) 255 256# check for types. 257# Using own tests for int64* because autoconf builtin only give 32bit. 258AC_CHECK_TYPE(int8_t, signed char) 259AC_CHECK_TYPE(int16_t, short) 260AC_CHECK_TYPE(int32_t, int) 261AC_CHECK_TYPE(int64_t, long long) 262AC_CHECK_TYPE(uint8_t, unsigned char) 263AC_CHECK_TYPE(uint16_t, unsigned short) 264AC_CHECK_TYPE(uint32_t, unsigned int) 265AC_CHECK_TYPE(uint64_t, unsigned long long) 266AC_TYPE_SIZE_T 267AC_CHECK_TYPE(ssize_t, int) 268AC_TYPE_UID_T 269AC_TYPE_PID_T 270AC_TYPE_OFF_T 271ACX_TYPE_U_CHAR 272ACX_TYPE_RLIM_T 273ACX_TYPE_SOCKLEN_T 274ACX_TYPE_IN_ADDR_T 275ACX_TYPE_IN_PORT_T 276ACX_CHECK_MEMCMP_SIGNED 277 278# add option to disable the evil rpath 279ACX_ARG_RPATH 280AC_SUBST(RUNTIME_PATH) 281 282# check to see if libraries are needed for these functions. 283AC_SEARCH_LIBS([inet_pton], [nsl]) 284AC_SEARCH_LIBS([socket], [socket]) 285 286# check wether strptime also works 287AC_DEFUN([AC_CHECK_STRPTIME_WORKS], 288[AC_REQUIRE([AC_PROG_CC]) 289AC_MSG_CHECKING(whether strptime works) 290if test c${cross_compiling} = cno; then 291AC_RUN_IFELSE([AC_LANG_SOURCE([[ 292#define _XOPEN_SOURCE 293#include <time.h> 294int main(void) { struct tm tm; char *res; 295res = 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); 296if (!res) return 2; 297res = strptime("20070207111842", "%Y%m%d%H%M%S", &tm); 298if (!res) return 1; return 0; } 299]])] , [eval "ac_cv_c_strptime_works=yes"], [eval "ac_cv_c_strptime_works=no"]) 300else 301eval "ac_cv_c_strptime_works=maybe" 302fi 303AC_MSG_RESULT($ac_cv_c_strptime_works) 304if test $ac_cv_c_strptime_works = no; then 305AC_LIBOBJ(strptime) 306else 307AC_DEFINE_UNQUOTED([STRPTIME_WORKS], 1, [use default strptime.]) 308fi 309])dnl 310 311# check some functions of the OS before linking libs (while still runnable). 312AC_FUNC_CHOWN 313AC_FUNC_FORK 314AC_TYPE_SIGNAL 315AC_FUNC_FSEEKO 316ACX_SYS_LARGEFILE 317ACX_CHECK_NONBLOCKING_BROKEN 318ACX_MKDIR_ONE_ARG 319AC_CHECK_FUNCS([strptime],[AC_CHECK_STRPTIME_WORKS],[AC_LIBOBJ([strptime])]) 320 321# set memory allocation checking if requested 322AC_ARG_ENABLE(alloc-checks, AC_HELP_STRING([--enable-alloc-checks], 323 [ enable to memory allocation statistics, for debug purposes ]), 324 , ) 325AC_ARG_ENABLE(alloc-lite, AC_HELP_STRING([--enable-alloc-lite], 326 [ enable for lightweight alloc assertions, for debug purposes ]), 327 , ) 328AC_ARG_ENABLE(alloc-nonregional, AC_HELP_STRING([--enable-alloc-nonregional], 329 [ enable nonregional allocs, slow but exposes regional allocations to other memory purifiers, for debug purposes ]), 330 , ) 331if test x_$enable_alloc_nonregional = x_yes; then 332 AC_DEFINE(UNBOUND_ALLOC_NONREGIONAL, 1, [use malloc not regions, for debug use]) 333fi 334if test x_$enable_alloc_checks = x_yes; then 335 AC_DEFINE(UNBOUND_ALLOC_STATS, 1, [use statistics for allocs and frees, for debug use]) 336else 337 if test x_$enable_alloc_lite = x_yes; then 338 AC_DEFINE(UNBOUND_ALLOC_LITE, 1, [use to enable lightweight alloc assertions, for debug use]) 339 else 340 ACX_FUNC_MALLOC([unbound]) 341 fi 342fi 343 344# check windows threads (we use them, not pthreads, on windows). 345if test "$on_mingw" = "yes"; then 346# check windows threads 347 AC_CHECK_HEADERS([windows.h],,, [AC_INCLUDES_DEFAULT]) 348 AC_MSG_CHECKING([for CreateThread]) 349 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([ 350#ifdef HAVE_WINDOWS_H 351#include <windows.h> 352#endif 353], [ 354 HANDLE t = CreateThread(NULL, 0, NULL, NULL, 0, NULL); 355])], 356 AC_MSG_RESULT(yes) 357 AC_DEFINE(HAVE_WINDOWS_THREADS, 1, [Using Windows threads]) 358, 359 AC_MSG_RESULT(no) 360) 361 362else 363# not on mingw, check thread libraries. 364 365# check for thread library. 366# check this first, so that the pthread lib does not get linked in via 367# libssl or libpython, and thus distorts the tests, and we end up using 368# the non-threadsafe C libraries. 369AC_ARG_WITH(pthreads, AC_HELP_STRING([--with-pthreads], 370 [use pthreads library, or --without-pthreads to disable threading support.]), 371 [ ],[ withval="yes" ]) 372ub_have_pthreads=no 373if test x_$withval != x_no; then 374 ACX_PTHREAD([ 375 AC_DEFINE(HAVE_PTHREAD,1,[Define if you have POSIX threads libraries and header files.]) 376 LIBS="$PTHREAD_LIBS $LIBS" 377 CFLAGS="$CFLAGS $PTHREAD_CFLAGS" 378 CC="$PTHREAD_CC" 379 ub_have_pthreads=yes 380 AC_CHECK_TYPES([pthread_spinlock_t, pthread_rwlock_t],,,[#include <pthread.h>]) 381 ]) 382fi 383 384# check solaris thread library 385AC_ARG_WITH(solaris-threads, AC_HELP_STRING([--with-solaris-threads], 386 [use solaris native thread library.]), [ ],[ withval="no" ]) 387ub_have_sol_threads=no 388if test x_$withval != x_no; then 389 if test x_$ub_have_pthreads != x_no; then 390 AC_WARN([Have pthreads already, ignoring --with-solaris-threads]) 391 else 392 AC_SEARCH_LIBS(thr_create, [thread], 393 [ 394 AC_DEFINE(HAVE_SOLARIS_THREADS, 1, [Using Solaris threads]) 395 396 ACX_CHECK_COMPILER_FLAG(mt, [CFLAGS="$CFLAGS -mt"], 397 [CFLAGS="$CFLAGS -D_REENTRANT"]) 398 ub_have_sol_threads=yes 399 ] , [ 400 AC_ERROR([no solaris threads found.]) 401 ]) 402 fi 403fi 404 405fi # end of non-mingw check of thread libraries 406 407# Check for PyUnbound 408AC_ARG_WITH(pyunbound, 409 AC_HELP_STRING([--with-pyunbound], 410 [build PyUnbound, or --without-pyunbound to skip it. (default=no)]), 411 [], [ withval="no" ]) 412 413ub_test_python=no 414ub_with_pyunbound=no 415if test x_$withval != x_no; then 416 ub_with_pyunbound=yes 417 ub_test_python=yes 418fi 419 420# Check for Python module 421AC_ARG_WITH(pythonmodule, 422 AC_HELP_STRING([--with-pythonmodule], 423 [build Python module, or --without-pythonmodule to disable script engine. (default=no)]), 424 [], [ withval="no" ]) 425 426ub_with_pythonmod=no 427if test x_$withval != x_no; then 428 ub_with_pythonmod=yes 429 ub_test_python=yes 430fi 431 432# Check for Python & SWIG only on PyUnbound or PyModule 433if test x_$ub_test_python != x_no; then 434 435 # Check for Python 436 ub_have_python=no 437 ac_save_LIBS="$LIBS" dnl otherwise AC_PYTHON_DEVEL thrashes $LIBS 438 AC_PYTHON_DEVEL 439 if test ! -z "$PYTHON_VERSION"; then 440 if test `$PYTHON -c "print '$PYTHON_VERSION' >= '2.4.0'"` = "False"; then 441 AC_ERROR([Python version >= 2.4.0 is required]) 442 fi 443 444 # Have Python 445 AC_DEFINE(HAVE_PYTHON,1,[Define if you have Python libraries and header files.]) 446 LIBS="$PYTHON_LDFLAGS $LIBS" 447 CPPFLAGS="$CPPFLAGS $PYTHON_CPPFLAGS" 448 ub_have_python=yes 449 450 # Check for SWIG 451 ub_have_swig=no 452 AC_PROG_SWIG 453 AC_MSG_CHECKING(SWIG) 454 if test ! -x "$SWIG"; then 455 AC_ERROR([failed to find swig tool, install it, or do not build Python module and PyUnbound]) 456 else 457 AC_DEFINE(HAVE_SWIG, 1, [Define if you have Swig libraries and header files.]) 458 AC_SUBST(swig, "$SWIG") 459 AC_MSG_RESULT(present) 460 461 # If have Python & SWIG 462 # Declare PythonMod 463 if test x_$ub_with_pythonmod != x_no; then 464 AC_DEFINE(WITH_PYTHONMODULE, 1, [Define if you want Python module.]) 465 WITH_PYTHONMODULE=yes 466 AC_SUBST(WITH_PYTHONMODULE) 467 PYTHONMOD_OBJ="pythonmod.lo pythonmod_utils.lo" 468 AC_SUBST(PYTHONMOD_OBJ) 469 PYTHONMOD_HEADER='$(srcdir)/pythonmod/pythonmod.h' 470 AC_SUBST(PYTHONMOD_HEADER) 471 PYTHONMOD_INSTALL=pythonmod-install 472 AC_SUBST(PYTHONMOD_INSTALL) 473 PYTHONMOD_UNINSTALL=pythonmod-uninstall 474 AC_SUBST(PYTHONMOD_UNINSTALL) 475 fi 476 477 # Declare PyUnbound 478 if test x_$ub_with_pyunbound != x_no; then 479 AC_DEFINE(WITH_PYUNBOUND, 1, [Define if you want PyUnbound.]) 480 WITH_PYUNBOUND=yes 481 AC_SUBST(WITH_PYUNBOUND) 482 PYUNBOUND_OBJ="libunbound_wrap.lo" 483 AC_SUBST(PYUNBOUND_OBJ) 484 PYUNBOUND_TARGET="_unbound.la" 485 AC_SUBST(PYUNBOUND_TARGET) 486 PYUNBOUND_INSTALL=pyunbound-install 487 AC_SUBST(PYUNBOUND_INSTALL) 488 PYUNBOUND_UNINSTALL=pyunbound-uninstall 489 AC_SUBST(PYUNBOUND_UNINSTALL) 490 fi 491 fi 492 else 493 AC_MSG_RESULT([*** Python libraries not found, won't build PythonMod or PyUnbound ***]) 494 ub_with_pyunbound=no 495 ub_with_pythonmod=no 496 fi 497fi 498 499if test "`uname`" = "NetBSD"; then 500 NETBSD_LINTFLAGS='"-D__RENAME(x)=" -D_NETINET_IN_H_' 501 AC_SUBST(NETBSD_LINTFLAGS) 502fi 503CONFIG_DATE=`date +%Y%m%d` 504AC_SUBST(CONFIG_DATE) 505 506# Checks for libraries. 507 508# libnss 509USE_NSS="no" 510AC_ARG_WITH([nss], AC_HELP_STRING([--with-nss=path], 511 [use libnss instead of openssl, installed at path.]), 512 [ 513 USE_NSS="yes" 514 AC_DEFINE(HAVE_NSS, 1, [Use libnss for crypto]) 515 if test "$withval" != "" -a "$withval" != "yes"; then 516 CPPFLAGS="$CPPFLAGS -I$withval/include/nss3" 517 LDFLAGS="$LDFLAGS -L$withval/lib" 518 ACX_RUNTIME_PATH_ADD([$withval/lib]) 519 CPPFLAGS="-I$withval/include/nspr4 $CPPFLAGS" 520 else 521 CPPFLAGS="$CPPFLAGS -I/usr/include/nss3" 522 CPPFLAGS="-I/usr/include/nspr4 $CPPFLAGS" 523 fi 524 LIBS="$LIBS -lnss3 -lnspr4" 525 ] 526) 527 528# openssl 529if test $USE_NSS = "no"; then 530ACX_WITH_SSL 531ACX_LIB_SSL 532AC_CHECK_HEADERS([openssl/conf.h],,, [AC_INCLUDES_DEFAULT]) 533AC_CHECK_HEADERS([openssl/engine.h],,, [AC_INCLUDES_DEFAULT]) 534AC_CHECK_FUNCS([OPENSSL_config EVP_sha1 EVP_sha256 EVP_sha512 FIPS_mode]) 535AC_CHECK_DECLS([SSL_COMP_get_compression_methods,sk_SSL_COMP_pop_free], [], [], [ 536AC_INCLUDES_DEFAULT 537#ifdef HAVE_OPENSSL_ERR_H 538#include <openssl/err.h> 539#endif 540 541#ifdef HAVE_OPENSSL_RAND_H 542#include <openssl/rand.h> 543#endif 544 545#ifdef HAVE_OPENSSL_CONF_H 546#include <openssl/conf.h> 547#endif 548 549#ifdef HAVE_OPENSSL_ENGINE_H 550#include <openssl/engine.h> 551#endif 552#include <openssl/ssl.h> 553#include <openssl/evp.h> 554]) 555fi 556 557 558AC_ARG_ENABLE(sha2, AC_HELP_STRING([--disable-sha2], [Disable SHA256 and SHA512 RRSIG support])) 559case "$enable_sha2" in 560 no) 561 ;; 562 yes|*) 563 AC_DEFINE([USE_SHA2], [1], [Define this to enable SHA256 and SHA512 support.]) 564 ;; 565esac 566 567# check wether gost also works 568AC_DEFUN([AC_CHECK_GOST_WORKS], 569[AC_REQUIRE([AC_PROG_CC]) 570AC_MSG_CHECKING([if GOST works]) 571if test c${cross_compiling} = cno; then 572BAKCFLAGS="$CFLAGS" 573if test -n "$ssldir"; then 574 CFLAGS="$CFLAGS -Wl,-rpath,$ssldir/lib" 575fi 576AC_RUN_IFELSE([AC_LANG_SOURCE([[ 577#include <string.h> 578#include <openssl/ssl.h> 579#include <openssl/evp.h> 580#include <openssl/engine.h> 581#include <openssl/conf.h> 582/* routine to load gost from ldns */ 583int load_gost_id(void) 584{ 585 static int gost_id = 0; 586 const EVP_PKEY_ASN1_METHOD* meth; 587 ENGINE* e; 588 589 if(gost_id) return gost_id; 590 591 /* see if configuration loaded gost implementation from other engine*/ 592 meth = EVP_PKEY_asn1_find_str(NULL, "gost2001", -1); 593 if(meth) { 594 EVP_PKEY_asn1_get0_info(&gost_id, NULL, NULL, NULL, NULL, meth); 595 return gost_id; 596 } 597 598 /* see if engine can be loaded already */ 599 e = ENGINE_by_id("gost"); 600 if(!e) { 601 /* load it ourself, in case statically linked */ 602 ENGINE_load_builtin_engines(); 603 ENGINE_load_dynamic(); 604 e = ENGINE_by_id("gost"); 605 } 606 if(!e) { 607 /* no gost engine in openssl */ 608 return 0; 609 } 610 if(!ENGINE_set_default(e, ENGINE_METHOD_ALL)) { 611 ENGINE_finish(e); 612 ENGINE_free(e); 613 return 0; 614 } 615 616 meth = EVP_PKEY_asn1_find_str(&e, "gost2001", -1); 617 if(!meth) { 618 /* algo not found */ 619 ENGINE_finish(e); 620 ENGINE_free(e); 621 return 0; 622 } 623 EVP_PKEY_asn1_get0_info(&gost_id, NULL, NULL, NULL, NULL, meth); 624 return gost_id; 625} 626int main(void) { 627 EVP_MD_CTX* ctx; 628 const EVP_MD* md; 629 unsigned char digest[64]; /* its a 256-bit digest, so uses 32 bytes */ 630 const char* str = "Hello world"; 631 const unsigned char check[] = { 632 0x40 , 0xed , 0xf8 , 0x56 , 0x5a , 0xc5 , 0x36 , 0xe1 , 633 0x33 , 0x7c , 0x7e , 0x87 , 0x62 , 0x1c , 0x42 , 0xe0 , 634 0x17 , 0x1b , 0x5e , 0xce , 0xa8 , 0x46 , 0x65 , 0x4d , 635 0x8d , 0x3e , 0x22 , 0x9b , 0xe1 , 0x30 , 0x19 , 0x9d 636 }; 637 OPENSSL_config(NULL); 638 (void)load_gost_id(); 639 md = EVP_get_digestbyname("md_gost94"); 640 if(!md) return 1; 641 memset(digest, 0, sizeof(digest)); 642 ctx = EVP_MD_CTX_create(); 643 if(!ctx) return 2; 644 if(!EVP_DigestInit_ex(ctx, md, NULL)) return 3; 645 if(!EVP_DigestUpdate(ctx, str, 10)) return 4; 646 if(!EVP_DigestFinal_ex(ctx, digest, NULL)) return 5; 647 /* uncomment to see the hash calculated. 648 {int i; 649 for(i=0; i<32; i++) 650 printf(" %2.2x", (int)digest[i]); 651 printf("\n");} 652 */ 653 if(memcmp(digest, check, sizeof(check)) != 0) 654 return 6; 655 return 0; 656} 657]])] , [eval "ac_cv_c_gost_works=yes"], [eval "ac_cv_c_gost_works=no"]) 658CFLAGS="$BAKCFLAGS" 659else 660eval "ac_cv_c_gost_works=maybe" 661fi 662AC_MSG_RESULT($ac_cv_c_gost_works) 663])dnl 664 665AC_ARG_ENABLE(gost, AC_HELP_STRING([--disable-gost], [Disable GOST support])) 666use_gost="no" 667if test $USE_NSS = "no"; then 668case "$enable_gost" in 669 no) 670 ;; 671 *) 672 AC_CHECK_FUNC(EVP_PKEY_set_type_str, [:],[AC_MSG_ERROR([OpenSSL 1.0.0 is needed for GOST support])]) 673 AC_CHECK_FUNC(EC_KEY_new, [], [AC_MSG_ERROR([OpenSSL does not support ECC, needed for GOST support])]) 674 AC_CHECK_GOST_WORKS 675 if test "$ac_cv_c_gost_works" != no; then 676 use_gost="yes" 677 AC_DEFINE([USE_GOST], [1], [Define this to enable GOST support.]) 678 fi 679 ;; 680esac 681fi dnl !USE_NSS 682 683AC_ARG_ENABLE(ecdsa, AC_HELP_STRING([--disable-ecdsa], [Disable ECDSA support])) 684use_ecdsa="no" 685case "$enable_ecdsa" in 686 no) 687 ;; 688 *) 689 if test $USE_NSS = "no"; then 690 AC_CHECK_FUNC(ECDSA_sign, [], [AC_MSG_ERROR([OpenSSL does not support ECDSA: please upgrade or rerun with --disable-ecdsa])]) 691 AC_CHECK_FUNC(SHA384_Init, [], [AC_MSG_ERROR([OpenSSL does not support SHA384: please upgrade or rerun with --disable-ecdsa])]) 692 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 693#include <openssl/evp.h> 694 ]) 695 # see if OPENSSL 1.0.0 or later (has EVP MD and Verify independency) 696 AC_MSG_CHECKING([if openssl supports SHA2 and ECDSA with EVP]) 697 if grep OPENSSL_VERSION_NUMBER $ssldir/include/openssl/opensslv.h | grep 0x0 >/dev/null; then 698 AC_MSG_RESULT([no]) 699 AC_DEFINE_UNQUOTED([USE_ECDSA_EVP_WORKAROUND], [1], [Define this to enable an EVP workaround for older openssl]) 700 else 701 AC_MSG_RESULT([yes]) 702 fi 703 fi 704 # we now know we have ECDSA and the required curves. 705 AC_DEFINE_UNQUOTED([USE_ECDSA], [1], [Define this to enable ECDSA support.]) 706 use_ecdsa="yes" 707 ;; 708esac 709 710# check for libevent 711AC_ARG_WITH(libevent, AC_HELP_STRING([--with-libevent=pathname], 712 [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.]), 713 [ ],[ withval="no" ]) 714if test x_$withval = x_yes -o x_$withval != x_no; then 715 AC_MSG_CHECKING(for libevent) 716 if test x_$withval = x_ -o x_$withval = x_yes; then 717 withval="/usr/local /opt/local /usr/lib /usr/pkg /usr/sfw /usr" 718 fi 719 for dir in $withval; do 720 thedir="$dir" 721 if test -f "$dir/include/event.h"; then 722 found_libevent="yes" 723 dnl assume /usr is in default path. 724 if test "$thedir" != "/usr"; then 725 CPPFLAGS="$CPPFLAGS -I$thedir/include" 726 fi 727 break; 728 fi 729 done 730 if test x_$found_libevent != x_yes; then 731 if test -f "$dir/event.h" -a \( -f "$dir/libevent.la" -o -f "$dir/libev.la" \) ; then 732 # libevent source directory 733 AC_MSG_RESULT(found in $thedir) 734 CPPFLAGS="$CPPFLAGS -I$thedir -I$thedir/include" 735 BAK_LDFLAGS_SET="1" 736 BAK_LDFLAGS="$LDFLAGS" 737 # remove evdns from linking 738 mkdir build >/dev/null 2>&1 739 mkdir build/libevent >/dev/null 2>&1 740 mkdir build/libevent/.libs >/dev/null 2>&1 741 ev_files_o=`ls $thedir/*.o | grep -v evdns\.o | grep -v bufferevent_openssl\.o` 742 ev_files_lo=`ls $thedir/*.lo | grep -v evdns\.lo | grep -v bufferevent_openssl\.lo` 743 ev_files_libso=`ls $thedir/.libs/*.o | grep -v evdns\.o | grep -v bufferevent_openssl\.o` 744 cp $ev_files_o build/libevent 745 cp $ev_files_lo build/libevent 746 cp $ev_files_libso build/libevent/.libs 747 LATE_LDFLAGS="build/libevent/*.lo -lm" 748 LDFLAGS="build/libevent/*.o $LDFLAGS -lm" 749 else 750 AC_MSG_ERROR([Cannot find the libevent library in $withval 751You can restart ./configure --with-libevent=no to use a builtin alternative. 752Please note that this alternative is not as capable as libevent when using 753large outgoing port ranges. ]) 754 fi 755 else 756 AC_MSG_RESULT(found in $thedir) 757 dnl assume /usr is in default path, do not add "". 758 if test "$thedir" != "/usr" -a "$thedir" != ""; then 759 LDFLAGS="$LDFLAGS -L$thedir/lib" 760 ACX_RUNTIME_PATH_ADD([$thedir/lib]) 761 fi 762 fi 763 # check for library used by libevent after 1.3c 764 AC_SEARCH_LIBS([clock_gettime], [rt]) 765 766 # is the event.h header libev or libevent? 767 AC_CHECK_HEADERS([event.h],,, [AC_INCLUDES_DEFAULT]) 768 AC_CHECK_DECL(EV_VERSION_MAJOR, [ 769 AC_SEARCH_LIBS(event_set, [ev]) 770 ],[ 771 AC_SEARCH_LIBS(event_set, [event]) 772 ],[AC_INCLUDES_DEFAULT 773#include <event.h> 774 ]) 775 AC_CHECK_FUNCS([event_base_free]) # only in libevent 1.2 and later 776 AC_CHECK_FUNCS([event_base_once]) # only in libevent 1.4.1 and later 777 AC_CHECK_FUNCS([event_base_new]) # only in libevent 1.4.1 and later 778 AC_CHECK_FUNCS([event_base_get_method]) # only in libevent 1.4.3 and later 779 AC_CHECK_FUNCS([ev_loop]) # only in libev. (tested on 3.51) 780 AC_CHECK_FUNCS([ev_default_loop]) # only in libev. (tested on 4.00) 781 if test -n "$BAK_LDFLAGS_SET"; then 782 LDFLAGS="$BAK_LDFLAGS" 783 fi 784else 785 AC_DEFINE(USE_MINI_EVENT, 1, [Define if you want to use internal select based events]) 786fi 787 788# check for libexpat 789AC_ARG_WITH(libexpat, AC_HELP_STRING([--with-libexpat=path], 790 [specify explicit path for libexpat.]), 791 [ ],[ withval="/usr/local /opt/local /usr/lib /usr/pkg /usr/sfw /usr" ]) 792AC_MSG_CHECKING(for libexpat) 793found_libexpat="no" 794for dir in $withval ; do 795 if test -f "$dir/include/expat.h"; then 796 found_libexpat="yes" 797 dnl assume /usr is in default path. 798 if test "$dir" != "/usr"; then 799 CPPFLAGS="$CPPFLAGS -I$dir/include" 800 LDFLAGS="$LDFLAGS -L$dir/lib" 801 fi 802 AC_MSG_RESULT(found in $dir) 803 break; 804 fi 805done 806if test x_$found_libexpat != x_yes; then 807 AC_ERROR([Could not find libexpat, expat.h]) 808fi 809AC_CHECK_HEADERS([expat.h],,, [AC_INCLUDES_DEFAULT]) 810 811# set static linking if requested 812AC_SUBST(staticexe) 813staticexe="" 814AC_ARG_ENABLE(static-exe, AC_HELP_STRING([--enable-static-exe], 815 [ enable to compile executables statically against event, ldns libs, for debug purposes ]), 816 , ) 817if test x_$enable_static_exe = x_yes; then 818 staticexe="-static" 819 if test "$on_mingw" = yes; then 820 staticexe="-all-static" 821 # for static crosscompile, include gdi32 and zlib here. 822 if test "`uname`" = "Linux"; then 823 LIBS="$LIBS -lgdi32 -lz" 824 fi 825 fi 826fi 827 828# set lock checking if requested 829AC_ARG_ENABLE(lock_checks, AC_HELP_STRING([--enable-lock-checks], 830 [ enable to check lock and unlock calls, for debug purposes ]), 831 , ) 832if test x_$enable_lock_checks = x_yes; then 833 AC_DEFINE(ENABLE_LOCK_CHECKS, 1, [Define if you want to use debug lock checking (slow).]) 834 CHECKLOCK_OBJ="checklocks.lo" 835 AC_SUBST(CHECKLOCK_OBJ) 836fi 837 838ACX_CHECK_GETADDRINFO_WITH_INCLUDES 839if test "$USE_WINSOCK" = 1; then 840 AC_DEFINE(UB_ON_WINDOWS, 1, [Use win32 resources and API]) 841 AC_CHECK_HEADERS([iphlpapi.h],,, [AC_INCLUDES_DEFAULT 842#include <windows.h> 843 ]) 844 AC_CHECK_TOOL(WINDRES, windres) 845 LIBS="$LIBS -liphlpapi" 846 WINAPPS="unbound-service-install.exe unbound-service-remove.exe anchor-update.exe" 847 AC_SUBST(WINAPPS) 848 WIN_DAEMON_SRC="winrc/win_svc.c winrc/w_inst.c" 849 AC_SUBST(WIN_DAEMON_SRC) 850 WIN_DAEMON_OBJ="win_svc.lo w_inst.lo" 851 AC_SUBST(WIN_DAEMON_OBJ) 852 WIN_DAEMON_OBJ_LINK="rsrc_unbound.o" 853 AC_SUBST(WIN_DAEMON_OBJ_LINK) 854 WIN_HOST_OBJ_LINK="rsrc_unbound_host.o" 855 AC_SUBST(WIN_HOST_OBJ_LINK) 856 WIN_UBANCHOR_OBJ_LINK="rsrc_unbound_anchor.o log.lo locks.lo" 857 AC_SUBST(WIN_UBANCHOR_OBJ_LINK) 858 WIN_CONTROL_OBJ_LINK="rsrc_unbound_control.o" 859 AC_SUBST(WIN_CONTROL_OBJ_LINK) 860 WIN_CHECKCONF_OBJ_LINK="rsrc_unbound_checkconf.o" 861 AC_SUBST(WIN_CHECKCONF_OBJ_LINK) 862fi 863if test $ac_cv_func_getaddrinfo = no; then 864 AC_LIBOBJ([fake-rfc2553]) 865fi 866# check after getaddrinfo for its libraries 867ACX_FUNC_IOCTLSOCKET 868 869# see if daemon(3) exists, and if it is deprecated. 870AC_CHECK_FUNCS([daemon]) 871if test $ac_cv_func_daemon = yes; then 872 ACX_FUNC_DEPRECATED([daemon], [(void)daemon(0, 0);], [ 873#include <stdlib.h> 874]) 875fi 876 877AC_CHECK_MEMBERS([struct in_pktinfo.ipi_spec_dst],,,[ 878AC_INCLUDES_DEFAULT 879#if HAVE_SYS_PARAM_H 880#include <sys/param.h> 881#endif 882 883#ifdef HAVE_SYS_SOCKET_H 884#include <sys/socket.h> 885#endif 886 887#ifdef HAVE_SYS_UIO_H 888#include <sys/uio.h> 889#endif 890 891#ifdef HAVE_NETINET_IN_H 892#include <netinet/in.h> 893#endif 894 895#ifdef HAVE_ARPA_INET_H 896#include <arpa/inet.h> 897#endif 898 899#ifdef HAVE_WINSOCK2_H 900#include <winsock2.h> 901#endif 902 903#ifdef HAVE_WS2TCPIP_H 904#include <ws2tcpip.h> 905#endif 906]) 907AC_SEARCH_LIBS([setusercontext], [util]) 908AC_CHECK_FUNCS([tzset sigprocmask fcntl getpwnam getrlimit setrlimit setsid sbrk chroot kill sleep usleep random srandom recvmsg sendmsg writev socketpair glob initgroups strftime localtime_r setusercontext _beginthreadex]) 909AC_CHECK_FUNCS([setresuid],,[AC_CHECK_FUNCS([setreuid])]) 910AC_CHECK_FUNCS([setresgid],,[AC_CHECK_FUNCS([setregid])]) 911 912# check if setreuid en setregid fail, on MacOSX10.4(darwin8). 913if echo $build_os | grep darwin8 > /dev/null; then 914 AC_DEFINE(DARWIN_BROKEN_SETREUID, 1, [Define this if on macOSX10.4-darwin8 and setreuid and setregid do not work]) 915fi 916AC_REPLACE_FUNCS(inet_aton) 917AC_REPLACE_FUNCS(inet_pton) 918AC_REPLACE_FUNCS(inet_ntop) 919AC_REPLACE_FUNCS(snprintf) 920AC_REPLACE_FUNCS(strlcpy) 921AC_REPLACE_FUNCS(memmove) 922AC_REPLACE_FUNCS(gmtime_r) 923LIBOBJ_WITHOUT_CTIME="$LIBOBJS" 924AC_SUBST(LIBOBJ_WITHOUT_CTIME) 925AC_REPLACE_FUNCS(ctime_r) 926 927AC_ARG_ENABLE(allsymbols, AC_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])) 928case "$enable_allsymbols" in 929 yes) 930 COMMON_OBJ_ALL_SYMBOLS="" 931 UBSYMS="" 932 EXTRALINK="-L. -L.libs -lunbound" 933 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]) 934 ;; 935 no|*) 936 COMMON_OBJ_ALL_SYMBOLS='$(COMMON_OBJ)' 937 UBSYMS='-export-symbols $(srcdir)/libunbound/ubsyms.def' 938 EXTRALINK="" 939 ;; 940esac 941AC_SUBST(COMMON_OBJ_ALL_SYMBOLS) 942AC_SUBST(EXTRALINK) 943AC_SUBST(UBSYMS) 944if test x_$enable_lock_checks = x_yes; then 945 UBSYMS="-export-symbols clubsyms.def" 946 cp ${srcdir}/libunbound/ubsyms.def clubsyms.def 947 echo lock_protect >> clubsyms.def 948 echo lock_unprotect >> clubsyms.def 949 echo lock_get_mem >> clubsyms.def 950 echo checklock_start >> clubsyms.def 951 echo checklock_stop >> clubsyms.def 952 echo checklock_lock >> clubsyms.def 953 echo checklock_unlock >> clubsyms.def 954 echo checklock_init >> clubsyms.def 955 echo checklock_thrcreate >> clubsyms.def 956 echo checklock_thrjoin >> clubsyms.def 957fi 958 959AC_MSG_CHECKING([if ${MAKE:-make} supports $< with implicit rule in scope]) 960# on openBSD, the implicit rule make $< work. 961# on Solaris, it does not work ($? is changed sources, $^ lists dependencies). 962# gmake works. 963cat >conftest.make <<EOF 964all: conftest.lo 965 966conftest.lo foo.lo bla.lo: 967 if test -f "\$<"; then touch \$@; fi 968 969.SUFFIXES: .lo 970.c.lo: 971 if test -f "\$<"; then touch \$@; fi 972 973conftest.lo: conftest.dir/conftest.c 974EOF 975mkdir conftest.dir 976touch conftest.dir/conftest.c 977rm -f conftest.lo conftest.c 978${MAKE:-make} -f conftest.make >/dev/null 979rm -f conftest.make conftest.c conftest.dir/conftest.c 980rm -rf conftest.dir 981if test ! -f conftest.lo; then 982 AC_MSG_RESULT(no) 983 SOURCEDETERMINE='echo "$^" | awk "-F " "{print \$$1;}" > .source' 984 SOURCEFILE='`cat .source`' 985else 986 AC_MSG_RESULT(yes) 987 SOURCEDETERMINE=':' 988 SOURCEFILE='$<' 989fi 990rm -f conftest.lo 991AC_SUBST(SOURCEDETERMINE) 992AC_SUBST(SOURCEFILE) 993 994# see if we want to build the library or everything 995ALLTARGET="alltargets" 996AC_ARG_WITH(libunbound-only, AC_HELP_STRING([--with-libunbound-only], 997 [do not build daemon and tool programs]), 998 [ 999 if test "$withval" = "yes"; then 1000 ALLTARGET="lib" 1001 fi 1002]) 1003AC_SUBST(ALLTARGET) 1004 1005# check this after all other compilation checks, since the linking of the lib 1006# may break checks after this. 1007AC_ARG_WITH(ldns, AC_HELP_STRING([--with-ldns=PATH], 1008 [specify prefix of path of ldns library to use]), 1009 [ 1010 if test "$withval" != "yes"; then 1011 if test "$withval" != "/usr" -a "$withval" != ""; then 1012 CPPFLAGS="-I$withval/include $CPPFLAGS" 1013 LDFLAGS="-L$withval/lib $LDFLAGS" 1014 ACX_RUNTIME_PATH_ADD([$withval/lib]) 1015 fi 1016 ldnsdir="$withval" 1017 AC_SUBST(ldnsdir) 1018 fi 1019]) 1020 1021# check if ldns is good enough 1022AC_CHECK_LIB(ldns, ldns_rr_new,,[ 1023 AC_MSG_ERROR([No ldns library found, install the ldns library into system lib dir or use --with-ldns=path to other location. The --with-ldns can point to the make-dir of ldns. Install the package ldns or download source http://www.nlnetlabs.nl/projects/ldns]) 1024]) 1025AC_CHECK_FUNC(ldns_buffer_copy) 1026if test $USE_NSS = "no"; then 1027 AC_CHECK_FUNC(ldns_key_buf2rsa_raw) 1028else 1029 dnl ignore test 1030 ac_cv_func_ldns_key_buf2rsa_raw="yes" 1031fi 1032AC_CHECK_FUNC(ldns_get_random) 1033AC_CHECK_FUNC(ldns_b32_ntop_extended_hex) 1034if test x$use_gost = xyes -a x$USE_NSS = xno; then 1035 AC_CHECK_FUNC(ldns_key_EVP_load_gost_id) 1036 AC_CHECK_FUNCS([ldns_key_EVP_unload_gost]) 1037else 1038 dnl ignore test 1039 ac_cv_func_ldns_key_EVP_load_gost_id="yes" 1040fi 1041if test x$use_ecdsa = xyes; then 1042 AC_CHECK_DECL([LDNS_ECDSAP384SHA384], [], [], [ 1043AC_INCLUDES_DEFAULT 1044#ifdef HAVE_SYS_SOCKET_H 1045# include <sys/socket.h> 1046#endif 1047#ifdef HAVE_WS2TCPIP_H 1048# include <ws2tcpip.h> 1049#endif 1050#include <ldns/ldns.h> 1051 ]) 1052else 1053 ac_cv_have_decl_LDNS_ECDSAP384SHA384="yes" 1054fi 1055AC_CHECK_HEADERS([ldns/ldns.h],,[ 1056 AC_MSG_ERROR([No ldns include file found, install the ldns library development files. Install package ldns-dev or ldns-devel or download source http://www.nlnetlabs.nl/projects/ldns]) 1057 ], [AC_INCLUDES_DEFAULT 1058#ifdef HAVE_SYS_SOCKET_H 1059#include <sys/socket.h> 1060#endif 1061 1062#ifdef HAVE_NETINET_IN_H 1063#include <netinet/in.h> 1064#endif 1065 1066#ifdef HAVE_ARPA_INET_H 1067#include <arpa/inet.h> 1068#endif 1069 1070#ifdef HAVE_WINSOCK2_H 1071#include <winsock2.h> 1072#endif 1073 1074#ifdef HAVE_WS2TCPIP_H 1075#include <ws2tcpip.h> 1076#endif 1077]) 1078if test $ac_cv_func_ldns_buffer_copy = yes \ 1079 -a $ac_cv_func_ldns_key_buf2rsa_raw = yes \ 1080 -a $ac_cv_func_ldns_get_random = yes \ 1081 -a $ac_cv_header_ldns_ldns_h = yes \ 1082 -a $ac_cv_func_ldns_b32_ntop_extended_hex = yes \ 1083 -a $ac_cv_func_ldns_key_EVP_load_gost_id = yes \ 1084 -a $ac_cv_have_decl_LDNS_ECDSAP384SHA384 = yes; then 1085 dnl ldns was found 1086 : 1087else 1088 AC_MSG_ERROR([ldns library is not recent, update the ldns library, install it into system lib dir or use --with-ldns=path to other location. The --with-ldns can point to the make-dir of ldns. Package libldns or download source http://www.nlnetlabs.nl/projects/ldns]) 1089fi 1090 1091ACX_STRIP_EXT_FLAGS 1092LDFLAGS="$LATE_LDFLAGS $LDFLAGS" 1093 1094AC_DEFINE_UNQUOTED([MAXSYSLOGMSGLEN], [10240], [Define to the maximum message length to pass to syslog.]) 1095 1096AH_BOTTOM( 1097dnl this must be first AH_CONFIG, to define the flags before any includes. 1098AHX_CONFIG_EXT_FLAGS 1099 1100dnl includes 1101[ 1102#ifndef UNBOUND_DEBUG 1103# define NDEBUG 1104#endif 1105 1106#include <stdio.h> 1107#include <string.h> 1108#include <unistd.h> 1109#include <assert.h> 1110 1111#if STDC_HEADERS 1112#include <stdlib.h> 1113#include <stddef.h> 1114#endif 1115 1116#ifdef HAVE_STDINT_H 1117#include <stdint.h> 1118#endif 1119 1120#include <errno.h> 1121 1122#if HAVE_SYS_PARAM_H 1123#include <sys/param.h> 1124#endif 1125 1126#ifdef HAVE_SYS_SOCKET_H 1127#include <sys/socket.h> 1128#endif 1129 1130#ifdef HAVE_SYS_UIO_H 1131#include <sys/uio.h> 1132#endif 1133 1134#ifdef HAVE_NETINET_IN_H 1135#include <netinet/in.h> 1136#endif 1137 1138#ifdef HAVE_ARPA_INET_H 1139#include <arpa/inet.h> 1140#endif 1141 1142#ifdef HAVE_WINSOCK2_H 1143#include <winsock2.h> 1144#endif 1145 1146#ifdef HAVE_WS2TCPIP_H 1147#include <ws2tcpip.h> 1148#endif 1149] 1150 1151AHX_CONFIG_FORMAT_ATTRIBUTE 1152AHX_CONFIG_UNUSED_ATTRIBUTE 1153AHX_CONFIG_FSEEKO 1154AHX_CONFIG_MAXHOSTNAMELEN 1155AHX_CONFIG_SNPRINTF(unbound) 1156AHX_CONFIG_INET_PTON(unbound) 1157AHX_CONFIG_INET_NTOP(unbound) 1158AHX_CONFIG_INET_ATON(unbound) 1159AHX_CONFIG_MEMMOVE(unbound) 1160AHX_CONFIG_STRLCPY(unbound) 1161AHX_CONFIG_GMTIME_R(unbound) 1162AHX_CONFIG_W32_SLEEP 1163AHX_CONFIG_W32_USLEEP 1164AHX_CONFIG_W32_RANDOM 1165AHX_CONFIG_W32_SRANDOM 1166AHX_CONFIG_W32_FD_SET_T 1167AHX_CONFIG_IPV6_MIN_MTU 1168AHX_MEMCMP_BROKEN(unbound) 1169 1170[ 1171#ifndef HAVE_CTIME_R 1172#define ctime_r unbound_ctime_r 1173char *ctime_r(const time_t *timep, char *buf); 1174#endif 1175 1176#if !defined(HAVE_STRPTIME) || !defined(STRPTIME_WORKS) 1177#define strptime unbound_strptime 1178struct tm; 1179char *strptime(const char *s, const char *format, struct tm *tm); 1180#endif 1181 1182#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)) 1183 /* using version of libevent that is not threadsafe. */ 1184# define LIBEVENT_SIGNAL_PROBLEM 1 1185#endif 1186 1187#ifndef CHECKED_INET6 1188# define CHECKED_INET6 1189# ifdef AF_INET6 1190# define INET6 1191# else 1192# define AF_INET6 28 1193# endif 1194#endif /* CHECKED_INET6 */ 1195 1196/* maximum nesting of included files */ 1197#define MAXINCLUDES 10 1198#ifndef HAVE_GETADDRINFO 1199struct sockaddr_storage; 1200#include "compat/fake-rfc2553.h" 1201#endif 1202 1203#ifdef UNBOUND_ALLOC_STATS 1204# define malloc(s) unbound_stat_malloc_log(s, __FILE__, __LINE__, __func__) 1205# define calloc(n,s) unbound_stat_calloc_log(n, s, __FILE__, __LINE__, __func__) 1206# define free(p) unbound_stat_free_log(p, __FILE__, __LINE__, __func__) 1207# define realloc(p,s) unbound_stat_realloc_log(p, s, __FILE__, __LINE__, __func__) 1208void *unbound_stat_malloc(size_t size); 1209void *unbound_stat_calloc(size_t nmemb, size_t size); 1210void unbound_stat_free(void *ptr); 1211void *unbound_stat_realloc(void *ptr, size_t size); 1212void *unbound_stat_malloc_log(size_t size, const char* file, int line, 1213 const char* func); 1214void *unbound_stat_calloc_log(size_t nmemb, size_t size, const char* file, 1215 int line, const char* func); 1216void unbound_stat_free_log(void *ptr, const char* file, int line, 1217 const char* func); 1218void *unbound_stat_realloc_log(void *ptr, size_t size, const char* file, 1219 int line, const char* func); 1220#elif defined(UNBOUND_ALLOC_LITE) 1221# include "util/alloc.h" 1222#endif /* UNBOUND_ALLOC_LITE and UNBOUND_ALLOC_STATS */ 1223 1224/** default port for DNS traffic. */ 1225#define UNBOUND_DNS_PORT 53 1226/** default port for unbound control traffic, registered port with IANA, 1227 ub-dns-control 8953/tcp unbound dns nameserver control */ 1228#define UNBOUND_CONTROL_PORT 8953 1229/** the version of unbound-control that this software implements */ 1230#define UNBOUND_CONTROL_VERSION 1 1231 1232]) 1233 1234AC_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 smallapp/unbound-control-setup.sh]) 1235AC_CONFIG_HEADER([config.h]) 1236AC_OUTPUT 1237