1238104Sdes# -*- Autoconf -*- 2238104Sdes# Process this file with autoconf to produce a configure script. 3238104SdesAC_PREREQ(2.56) 4238104Sdessinclude(acx_nlnetlabs.m4) 5238104Sdes 6238104Sdes# must be numbers. ac_defun because of later processing. 7238104Sdesm4_define([VERSION_MAJOR],[1]) 8238104Sdesm4_define([VERSION_MINOR],[6]) 9269257Sdesm4_define([VERSION_MICRO],[17]) 10238104SdesAC_INIT(ldns, m4_defn([VERSION_MAJOR]).m4_defn([VERSION_MINOR]).m4_defn([VERSION_MICRO]), libdns@nlnetlabs.nl, libdns) 11238104SdesAC_CONFIG_SRCDIR([packet.c]) 12238104Sdes# needed to build correct soname 13238104SdesAC_SUBST(LDNS_VERSION_MAJOR, [VERSION_MAJOR]) 14238104SdesAC_SUBST(LDNS_VERSION_MINOR, [VERSION_MINOR]) 15238104SdesAC_SUBST(LDNS_VERSION_MICRO, [VERSION_MICRO]) 16269257SdesAC_SUBST(VERSION_INFO, [VERSION_MAJOR:VERSION_MINOR:VERSION_MICRO]) 17238104Sdes 18269257SdesAC_AIX 19269257SdesLT_INIT 20269257SdesAC_CONFIG_MACRO_DIR([m4]) 21269257Sdes 22238104SdesOURCPPFLAGS='' 23238104SdesCPPFLAGS=${CPPFLAGS:-${OURCPPFLAGS}} 24238104SdesCFLAGS="$CFLAGS" 25238104Sdes 26238104Sdes# Checks for programs. 27238104SdesAC_PROG_CC 28238104SdesACX_DEPFLAG 29238104SdesAC_PROG_MAKE_SET 30238104Sdes 31238104Sdes# Extra (sp)lint flags for NetBSD 32238104SdesAC_CANONICAL_HOST 33238104Sdescase "$host_os" in 34238104Sdes netbsd*) LINTFLAGS="'-D__RENAME(x)=' -D_NETINET_IN_H_ $LINTFLAGS" 35238104Sdes ;; 36238104Sdes *) LINTFLAGS="$LINTFLAGS" 37238104Sdes ;; 38238104Sdesesac 39238104SdesAC_SUBST(LINTFLAGS) 40238104Sdes 41238104SdesAC_DEFINE(WINVER, 0x0502, [the version of the windows API enabled]) 42238104Sdes 43238104SdesACX_CHECK_COMPILER_FLAG(std=c99, [C99FLAG="-std=c99"]) 44238104SdesACX_CHECK_COMPILER_FLAG(xc99, [C99FLAG="-xc99"]) 45238104Sdes 46238104Sdes# routine to copy files 47238104Sdes# argument 1 is a list of files (relative to the source dir) 48238104Sdes# argument 2 is a destination directory (relative to the current 49238104Sdes# working directory 50238104SdesAC_DEFUN([COPY_FILES], 51238104Sdes[ 52238104Sdesfor file in $1; do 53238104Sdes sh $srcdir/install-sh -m 644 $file $2 54238104Sdesdone 55238104Sdes]) 56238104Sdes 57238104Sdes# copy all .h files in the dir at argument 1 58238104Sdes# (relative to source) to the dir at argument 2 59238104Sdes# (relative to current dir) 60238104SdesAC_DEFUN([COPY_HEADER_FILES], 61238104Sdes[ 62238104Sdesecho "copying header files" 63238104SdesCOPY_FILES($srcdir/$1/*.h, $2) 64238104Sdes]) 65238104Sdes 66238104Sdes# Checks for typedefs, structures, and compiler characteristics. 67238104SdesAC_C_CONST 68238104SdesAC_LANG_C 69246854Sdesif test "x$CFLAGS" = "x" ; then 70246854SdesACX_CHECK_COMPILER_FLAG(g, [CFLAGS="-g"]) 71238104SdesACX_CHECK_COMPILER_FLAG(O2, [CFLAGS="-O2 $CFLAGS"]) 72246854Sdesfi 73238104SdesACX_CHECK_COMPILER_FLAG(Wall, [CFLAGS="-Wall $CFLAGS"]) 74238104SdesACX_CHECK_COMPILER_FLAG(W, [CFLAGS="-W $CFLAGS"]) 75238104SdesACX_CHECK_COMPILER_FLAG(Wwrite-strings, [CFLAGS="-Wwrite-strings $CFLAGS"]) 76269257SdesACX_CHECK_COMPILER_FLAG(Wstrict-prototypes, [CFLAGS="-Wstrict-prototypes $CFLAGS"]) 77238104Sdes 78238104Sdes 79238104SdesAC_CHECK_HEADERS([getopt.h time.h],,, [AC_INCLUDES_DEFAULT]) 80238104Sdes 81238104Sdes# MinGW32 tests 82238104SdesAC_CHECK_HEADERS([winsock2.h ws2tcpip.h],,, [AC_INCLUDES_DEFAULT]) 83238104Sdes# end mingw32 tests 84238104Sdes 85238104SdesACX_DETERMINE_EXT_FLAGS_UNBOUND 86238104Sdes 87238104SdesAC_C_INLINE 88238104SdesAC_CHECK_TYPE(int8_t, char) 89238104SdesAC_CHECK_TYPE(int16_t, short) 90238104SdesAC_CHECK_TYPE(int32_t, int) 91238104SdesAC_CHECK_TYPE(int64_t, long long) 92238104SdesAC_CHECK_TYPE(uint8_t, unsigned char) 93238104SdesAC_CHECK_TYPE(uint16_t, unsigned short) 94238104SdesAC_CHECK_TYPE(uint32_t, unsigned int) 95238104SdesAC_CHECK_TYPE(uint64_t, unsigned long long) 96238104Sdes 97238104Sdes# my own checks 98238104SdesAC_CHECK_PROG(doxygen, doxygen, doxygen) 99238104Sdes 100238104Sdes# check to see if libraries are needed for these functions. 101238104SdesAC_SEARCH_LIBS([socket], [socket]) 102238104SdesAC_SEARCH_LIBS([inet_pton], [nsl]) 103238104Sdes 104238104Sdes 105238104SdesAC_ARG_WITH(drill, AC_HELP_STRING([--with-drill], 106238104Sdes [Also build drill.]), 107238104Sdes [],[with_drill="no"]) 108238104Sdesif test x_$with_drill != x_no ; then 109238104Sdes AC_SUBST(DRILL,[drill]) 110238104Sdes AC_SUBST(INSTALL_DRILL,[install-drill]) 111238104Sdes AC_SUBST(UNINSTALL_DRILL,[uninstall-drill]) 112238104Sdes AC_SUBST(CLEAN_DRILL,[clean-drill]) 113238104Sdes AC_SUBST(LINT_DRILL,[lint-drill]) 114238104Sdes if test -e $srcdir/drill/config.h -o -e drill/config.h ; then 115238104Sdes AC_MSG_ERROR([ 116238104SdesA config.h was detected in the drill subdirectory. 117238104SdesThis does not work with the --with-drill option. 118238104SdesPlease remove the config.h from the drill subdirectory 119238104Sdesor do not use the --with-drill option.]) 120238104Sdes fi 121246854Sdes DRILL_CONFIG=" drill/drill.1" 122238104Sdeselse 123238104Sdes AC_SUBST(DRILL,[""]) 124238104Sdes AC_SUBST(INSTALL_DRILL,[""]) 125238104Sdes AC_SUBST(UNINSTALL_DRILL,[""]) 126238104Sdes AC_SUBST(CLEAN_DRILL,[""]) 127238104Sdes AC_SUBST(LINT_DRILL,[""]) 128246854Sdes DRILL_CONFIG="" 129238104Sdesfi 130238104Sdes 131238104Sdes 132238104SdesAC_ARG_WITH(examples, AC_HELP_STRING([--with-examples], 133238104Sdes [Also build examples.]), 134238104Sdes [],[with_examples="no"]) 135238104Sdesif test x_$with_examples != x_no ; then 136238104Sdes AC_SUBST(EXAMPLES,[examples]) 137238104Sdes AC_SUBST(INSTALL_EXAMPLES,[install-examples]) 138238104Sdes AC_SUBST(UNINSTALL_EXAMPLES,[uninstall-examples]) 139238104Sdes AC_SUBST(CLEAN_EXAMPLES,[clean-examples]) 140238104Sdes AC_SUBST(LINT_EXAMPLES,[lint-examples]) 141238104Sdes if test -e $srcdir/examples/config.h -o -e examples/config.h ; then 142238104Sdes AC_MSG_ERROR([ 143238104SdesA config.h was detected in the examples subdirectory. 144238104SdesThis does not work with the --with-examples option. 145238104SdesPlease remove the config.h from the examples subdirectory 146238104Sdesor do not use the --with-examples option.]) 147238104Sdes fi 148246854Sdes EXAMPLES_CONFIG=" examples/ldns-dane.1 examples/ldns-verify-zone.1" 149238104Sdeselse 150238104Sdes AC_SUBST(EXAMPLES,[""]) 151238104Sdes AC_SUBST(INSTALL_EXAMPLES,[""]) 152238104Sdes AC_SUBST(UNINSTALL_EXAMPLES,[""]) 153238104Sdes AC_SUBST(CLEAN_EXAMPLES,[""]) 154238104Sdes AC_SUBST(LINT_EXAMPLES,[""]) 155246854Sdes EXAMPLES_CONFIG="" 156238104Sdesfi 157238104Sdes 158238104Sdes# add option to disable installation of ldns-config script 159269257SdesAC_ARG_ENABLE(ldns-config, AC_HELP_STRING([--disable-ldns-config], [disable installation of ldns-config (default=enabled)]), 160238104Sdes enable_ldns_config=$enableval, enable_ldns_config=yes) 161238104Sdesif test "x$enable_ldns_config" = xyes; then 162238104Sdes AC_SUBST(INSTALL_CONFIG, [install-config]) 163238104Sdes AC_SUBST(INSTALL_CONFIG_MANPAGE, [install-config-manpage]) 164238104Sdes AC_SUBST(UNINSTALL_CONFIG, [uninstall-config]) 165238104Sdes AC_SUBST(UNINSTALL_CONFIG_MANPAGE, [uninstall-config-manpage]) 166238104Sdeselse 167238104Sdes AC_SUBST(INSTALL_CONFIG, [""]) 168238104Sdes AC_SUBST(INSTALL_CONFIG_MANPAGE, [""]) 169238104Sdes AC_SUBST(UNINSTALL_CONFIG, [""]) 170238104Sdes AC_SUBST(UNINSTALL_CONFIG_MANPAGE, [""]) 171238104Sdesfi 172238104Sdes 173269257Sdes# add option to disable library printing to stderr 174269257SdesAC_ARG_ENABLE(stderr-msgs, AC_HELP_STRING([--enable-stderr-msgs], [Enable printing to stderr (default=disabled)]), enable_stderr_msgs=$enableval, enable_stderr_msgs=no) 175269257Sdescase "$enable_stderr_msgs" in 176269257Sdes no) dnl default 177269257Sdes ;; 178269257Sdes *) 179269257Sdes AC_DEFINE_UNQUOTED([STDERR_MSGS], [1], [Define this to enable messages to stderr.]) 180269257Sdes ;; 181269257Sdesesac 182269257Sdes 183238104Sdes# check for python 184238104SdesPYTHON_X_CFLAGS="" 185238104Sdesldns_with_pyldns=no 186238104Sdesldns_with_pyldnsx=no 187238104SdesAC_ARG_WITH(pyldns, AC_HELP_STRING([--with-pyldns], 188238104Sdes [generate python library, or --without-pyldns to disable Python support.]), 189238104Sdes [],[ withval="no" ]) 190238104Sdesldns_have_python=no 191238104Sdesif test x_$withval != x_no; then 192238104Sdes sinclude(ax_python_devel.m4) 193238104Sdes ac_save_LIBS="$LIBS" dnl otherwise AC_PYTHON_DEVEL thrashes $LIBS 194238104Sdes 195238104Sdes AX_PYTHON_DEVEL([>= '2.4.0']) 196238104Sdes if test ! -z "$ac_python_version"; then 197238104Sdes ldns_have_python=yes 198238104Sdes fi 199238104Sdes 200238104Sdes # pass additional Python 3 option to SWIG 201238104Sdes if test `$PYTHON -c "import sys; \ 202238104Sdes ver = sys.version.split()[[0]]; \ 203238104Sdes print(ver >= '3')"` = "True"; then 204238104Sdes AC_SUBST(SWIGPY3, ["-py3 -DPY3"]) 205238104Sdes fi 206238104Sdes 207238104Sdes # check for SWIG 208238104Sdes if test x_$ldns_have_python != x_no; then 209238104Sdes sinclude(ax_pkg_swig.m4) 210238104Sdes 211238104Sdes # check for >=SWIG-2.0.4 if Python 3.2 used 212238104Sdes if test `$PYTHON -c "import sys; \ 213238104Sdes ver = sys.version.split()[[0]]; \ 214238104Sdes print(ver >= '3.2')"` = "True"; then 215238104Sdes AX_PKG_SWIG(2.0.4, [], [AC_MSG_ERROR([SWIG-2.0.4 is required to build pyldns for Python 3.2 and greater.])]) 216238104Sdes else 217238104Sdes AX_PKG_SWIG 218238104Sdes fi 219238104Sdes 220238104Sdes if test ! -x "$SWIG"; then 221238104Sdes AC_MSG_ERROR([failed to find SWIG tool, install it, or do not build pyldns]) 222238104Sdes else 223238104Sdes AC_DEFINE(HAVE_SWIG,1,[Define if you have SWIG libraries and header files.]) 224238104Sdes AC_SUBST(PYLDNS, "pyldns") 225238104Sdes AC_SUBST(swig, "$SWIG") 226238104Sdes ldns_with_pyldns=yes 227238104Sdes fi 228238104Sdes else 229238104Sdes AC_MSG_RESULT([*** don't have Python, skipping SWIG, no pyldns ***]) # ' 230238104Sdes fi 231238104Sdes 232238104Sdes # xtra cflags for pyldns 233238104Sdes if test x_$ldns_have_python != x_no; then 234238104Sdes ACX_CHECK_COMPILER_FLAG(fno-strict-aliasing, [PYTHON_X_CFLAGS="-fno-strict-aliasing"]) 235238104Sdes ACX_CHECK_COMPILER_FLAG(Wno-missing-field-initializers, [PYTHON_X_CFLAGS="-Wno-missing-field-initializers $PYTHON_X_CFLAGS"]) 236238104Sdes ACX_CHECK_COMPILER_FLAG(Wno-unused-parameter, [PYTHON_X_CFLAGS="-Wno-unused-parameter $PYTHON_X_CFLAGS"]) 237238104Sdes ACX_CHECK_COMPILER_FLAG(Wno-unused-variable, [PYTHON_X_CFLAGS="-Wno-unused-variable $PYTHON_X_CFLAGS"]) 238238104Sdes fi 239238104Sdesfi 240238104SdesAC_SUBST(PYTHON_X_CFLAGS) 241238104Sdes 242238104Sdes# Check for pyldnsx 243238104SdesAC_ARG_WITH(pyldnsx, AC_HELP_STRING([--without-pyldnsx], 244238104Sdes [Do not install the ldnsx python module, or --with-pyldnsx to install it.]), 245238104Sdes [],[ withval="with_pyldns" ]) 246238104Sdesif test x_$withval != x_no; then 247238104Sdes if test x_$ldns_with_pyldns != x_no; then 248238104Sdes AC_SUBST(PYLDNSX, "pyldnsx") 249238104Sdes ldns_with_pyldnsx=yes 250238104Sdes else 251238104Sdes if test x_$withval != x_with_pyldns; then 252238104Sdes AC_MSG_ERROR([--with-pyldns is needed for the ldnsx python module]) 253238104Sdes fi 254238104Sdes fi 255238104Sdesfi 256238104Sdes 257238104Sdesif test x_$ldns_with_pyldns != x_no; then 258238104Sdes AC_SUBST(PYLDNSINST, "install-pyldns")dnl 259238104Sdes AC_SUBST(PYLDNSUNINST, "uninstall-pyldns") 260238104Sdeselse 261238104Sdes AC_SUBST(PYLDNSINST, "")dnl 262238104Sdes AC_SUBST(PYLDNSUNINST, "") 263238104Sdesfi 264238104Sdesif test x_$ldns_with_pyldnsx != x_no; then 265238104Sdes AC_SUBST(PYLDNSXINST, "install-pyldnsx")dnl 266238104Sdes AC_SUBST(PYLDNSXUNINST, "uninstall-pyldnsx") 267238104Sdeselse 268238104Sdes AC_SUBST(PYLDNSXINST, "")dnl 269238104Sdes AC_SUBST(PYLDNSXUNINST, "") 270238104Sdesfi 271238104Sdes 272269257Sdes# check for perl 273269257Sdesldns_with_p5_dns_ldns=no 274269257SdesAC_ARG_WITH(p5-dns-ldns, AC_HELP_STRING([--with-p5-dns-ldns], 275269257Sdes [generate DNS::LDNS perl bindings]), 276269257Sdes [],[ withval="no" ]) 277269257Sdesldns_have_perl=no 278269257Sdesif test x_$withval != x_no; then 279269257Sdes AC_PATH_PROG([PERL], [perl]) 280269257Sdes if test -z "$PERL"; then 281269257Sdes AC_MSG_ERROR([Cannot find perl in your system path]) 282269257Sdes fi 283269257Sdes AC_SUBST(P5_DNS_LDNS, "p5-dns-ldns")dnl 284269257Sdes AC_SUBST(TEST_P5_DNS_LDNS, "test-p5-dns-ldns")dnl 285269257Sdes AC_SUBST(INSTALL_P5_DNS_LDNS, "install-p5-dns-ldns")dnl 286269257Sdes AC_SUBST(UNINSTALL_P5_DNS_LDNS, "uninstall-p5-dns-ldns")dnl 287269257Sdes AC_SUBST(CLEAN_P5_DNS_LDNS, "clean-p5-dns-ldns") 288269257Sdeselse 289269257Sdes AC_SUBST(P5_DNS_LDNS, "")dnl 290269257Sdes AC_SUBST(TEST_P5_DNS_LDNS, "")dnl 291269257Sdes AC_SUBST(INSTALL_P5_DNS_LDNS, "")dnl 292269257Sdes AC_SUBST(UNINSTALL_P5_DNS_LDNS, "")dnl 293269257Sdes AC_SUBST(CLEAN_P5_DNS_LDNS, "") 294269257Sdesfi 295269257Sdes 296238104Sdes# Use libtool 297238104SdesACX_LIBTOOL_C_ONLY 298238104Sdes 299238104Sdestmp_CPPFLAGS=$CPPFLAGS 300238104Sdestmp_LDFLAGS=$LDFLAGS 301238104Sdestmp_LIBS=$LIBS 302238104Sdes 303238104SdesACX_WITH_SSL_OPTIONAL 304238104Sdes 305238104SdesAC_CHECK_FUNCS([EVP_sha256]) 306238104Sdes 307238104Sdes# for macosx, see if glibtool exists and use that 308238104Sdes# BSD's need to know the version... 309238104Sdes#AC_CHECK_PROG(glibtool, glibtool, [glibtool], ) 310238104Sdes#AC_CHECK_PROGS(libtool, [libtool15 libtool], [./libtool]) 311238104Sdes 312238104SdesAC_ARG_ENABLE(sha2, AC_HELP_STRING([--disable-sha2], [Disable SHA256 and SHA512 RRSIG support])) 313238104Sdescase "$enable_sha2" in 314238104Sdes no) 315238104Sdes ;; 316238104Sdes yes|*) 317238104Sdes if test "x$HAVE_SSL" != "xyes"; then 318238104Sdes AC_MSG_ERROR([SHA2 enabled, but no SSL support]) 319238104Sdes fi 320238104Sdes AC_MSG_CHECKING(for SHA256 and SHA512) 321238104Sdes AC_CHECK_FUNC(SHA256_Init, [], [ 322238104Sdes AC_MSG_ERROR([No SHA2 functions found in OpenSSL: please upgrade OpenSSL or rerun with --disable-sha2]) 323238104Sdes ]) 324238104Sdes AC_DEFINE_UNQUOTED([USE_SHA2], [1], [Define this to enable SHA256 and SHA512 support.]) 325238104Sdes ;; 326238104Sdesesac 327238104Sdes 328238104SdesAC_ARG_ENABLE(gost, AC_HELP_STRING([--disable-gost], [Disable GOST support])) 329238104Sdescase "$enable_gost" in 330238104Sdes no) 331238104Sdes ;; 332238104Sdes *) dnl default 333238104Sdes if test "x$HAVE_SSL" != "xyes"; then 334238104Sdes AC_MSG_ERROR([GOST enabled, but no SSL support]) 335238104Sdes fi 336238104Sdes AC_MSG_CHECKING(for GOST) 337238104Sdes AC_CHECK_FUNC(EVP_PKEY_set_type_str, [],[AC_MSG_ERROR([OpenSSL >= 1.0.0 is needed for GOST support or rerun with --disable-gost])]) 338238104Sdes AC_CHECK_FUNC(EC_KEY_new, [], [AC_MSG_ERROR([No ECC functions found in OpenSSL: please upgrade OpenSSL or rerun with --disable-gost])]) 339238104Sdes AC_DEFINE_UNQUOTED([USE_GOST], [1], [Define this to enable GOST support.]) 340238104Sdes ;; 341238104Sdesesac 342238104Sdes 343238104SdesAC_ARG_ENABLE(ecdsa, AC_HELP_STRING([--disable-ecdsa], [Disable ECDSA support])) 344238104Sdescase "$enable_ecdsa" in 345238104Sdes no) 346238104Sdes ;; 347238104Sdes *) dnl default 348238104Sdes if test "x$HAVE_SSL" != "xyes"; then 349238104Sdes AC_MSG_ERROR([ECDSA enabled, but no SSL support]) 350238104Sdes fi 351238104Sdes AC_CHECK_FUNC(ECDSA_sign, [], [AC_MSG_ERROR([OpenSSL does not support ECDSA: please upgrade OpenSSL or rerun with --disable-ecdsa])]) 352238104Sdes AC_CHECK_FUNC(SHA384_Init, [], [AC_MSG_ERROR([OpenSSL does not support SHA384: please upgrade OpenSSL or rerun with --disable-ecdsa])]) 353238104Sdes AC_CHECK_DECLS([NID_X9_62_prime256v1, NID_secp384r1], [], [AC_MSG_ERROR([OpenSSL does not support the ECDSA curves: please upgrade OpenSSL or rerun with --disable-ecdsa])], [AC_INCLUDES_DEFAULT 354238104Sdes#include <openssl/evp.h> 355238104Sdes ]) 356238104Sdes # we now know we have ECDSA and the required curves. 357238104Sdes AC_DEFINE_UNQUOTED([USE_ECDSA], [1], [Define this to enable ECDSA support.]) 358238104Sdes ;; 359238104Sdesesac 360238104Sdes 361269257SdesAC_ARG_ENABLE(dane, AC_HELP_STRING([--disable-dane], [Disable DANE support])) 362269257Sdescase "$enable_dane" in 363269257Sdes no) 364269257Sdes AC_SUBST(ldns_build_config_use_dane, 0) 365269257Sdes ;; 366269257Sdes *) dnl default 367269257Sdes if test "x$HAVE_SSL" != "xyes"; then 368269257Sdes AC_MSG_ERROR([DANE enabled, but no SSL support]) 369269257Sdes fi 370269257Sdes AC_CHECK_FUNC(X509_check_ca, [], [AC_MSG_ERROR([OpenSSL does not support DANE: please upgrade OpenSSL or rerun with --disable-dane])]) 371269257Sdes AC_DEFINE_UNQUOTED([USE_DANE], [1], [Define this to enable DANE support.]) 372269257Sdes AC_SUBST(ldns_build_config_use_dane, 1) 373269257Sdes ;; 374269257Sdesesac 375269257Sdes 376269257SdesAC_ARG_ENABLE(rrtype-ninfo, AC_HELP_STRING([--enable-rrtype-ninfo], [Enable draft RR type ninfo.])) 377269257Sdescase "$enable_rrtype_ninfo" in 378269257Sdes yes) 379269257Sdes AC_DEFINE_UNQUOTED([RRTYPE_NINFO], [], [Define this to enable RR type NINFO.]) 380269257Sdes ;; 381269257Sdes no|*) 382269257Sdes ;; 383269257Sdesesac 384269257SdesAC_ARG_ENABLE(rrtype-rkey, AC_HELP_STRING([--enable-rrtype-rkey], [Enable draft RR type rkey.])) 385269257Sdescase "$enable_rrtype_rkey" in 386269257Sdes yes) 387269257Sdes AC_DEFINE_UNQUOTED([RRTYPE_RKEY], [], [Define this to enable RR type RKEY.]) 388269257Sdes ;; 389269257Sdes no|*) 390269257Sdes ;; 391269257Sdesesac 392269257SdesAC_ARG_ENABLE(rrtype-cds, AC_HELP_STRING([--enable-rrtype-cds], [Enable draft RR type cds.])) 393269257Sdescase "$enable_rrtype_cds" in 394269257Sdes yes) 395269257Sdes AC_DEFINE_UNQUOTED([RRTYPE_CDS], [], [Define this to enable RR type CDS.]) 396269257Sdes ;; 397269257Sdes no|*) 398269257Sdes ;; 399269257Sdesesac 400269257SdesAC_ARG_ENABLE(rrtype-uri, AC_HELP_STRING([--enable-rrtype-uri], [Enable draft RR type uri.])) 401269257Sdescase "$enable_rrtype_uri" in 402269257Sdes yes) 403269257Sdes AC_DEFINE_UNQUOTED([RRTYPE_URI], [], [Define this to enable RR type URI.]) 404269257Sdes ;; 405269257Sdes no|*) 406269257Sdes ;; 407269257Sdesesac 408269257SdesAC_ARG_ENABLE(rrtype-ta, AC_HELP_STRING([--enable-rrtype-ta], [Enable draft RR type ta.])) 409269257Sdescase "$enable_rrtype_ta" in 410269257Sdes yes) 411269257Sdes AC_DEFINE_UNQUOTED([RRTYPE_TA], [], [Define this to enable RR type TA.]) 412269257Sdes ;; 413269257Sdes no|*) 414269257Sdes ;; 415269257Sdesesac 416269257Sdes 417238104SdesAC_SUBST(LIBSSL_CPPFLAGS) 418238104SdesAC_SUBST(LIBSSL_LDFLAGS) 419238104SdesAC_SUBST(LIBSSL_LIBS) 420246854Sdesif test "x$HAVE_SSL" = "xyes"; then 421269257SdesAC_SUBST(LIBSSL_SSL_LIBS, ["-lssl $LIBSSL_LIBS"]) 422246854Sdesfi 423238104SdesCPPFLAGS=$tmp_CPPFLAGS 424238104SdesLDFLAGS=$tmp_LDFLAGS 425238104SdesLIBS=$tmp_LIBS 426238104Sdes 427238104Sdes 428238104Sdes# add option to disable the evil rpath 429238104SdesACX_ARG_RPATH 430238104Sdes 431238104Sdes#AC_RUN_IFELSE([AC_LANG_SOURCE( 432238104Sdes#[ 433238104Sdes#int main() 434238104Sdes#{ 435238104Sdes#short one = 1; 436238104Sdes#char *cp = (char*)&one; 437238104Sdes#if ( *cp == 0 ) 438238104Sdes#return(0); 439238104Sdes#else 440238104Sdes#return(1); 441238104Sdes#} 442238104Sdes#])], [],[ 443238104Sdes#AC_DEFINE(CONFCHECK_LITTLE_ENDIAN, 1, [system appears to be little-endian]) 444238104Sdes#],[]) 445238104Sdes 446238104Sdes# should define WORDS_BIGENDIAN if the system is big-endian 447238104SdesAC_C_BIGENDIAN 448238104Sdes 449238104Sdes# Checks for header files. 450238104SdesAC_HEADER_STDC 451238104SdesAC_HEADER_STDBOOL 452238104Sdes#AC_HEADER_SYS_WAIT 453238104Sdes#AC_CHECK_HEADERS([getopt.h fcntl.h stdlib.h string.h strings.h unistd.h]) 454238104Sdes# do the very minimum - we can always extend this 455238104SdesAC_CHECK_HEADERS([getopt.h stdarg.h openssl/ssl.h netinet/in.h time.h arpa/inet.h netdb.h],,, [AC_INCLUDES_DEFAULT]) 456238104SdesAC_CHECK_HEADERS(sys/param.h sys/mount.h,,, 457238104Sdes[AC_INCLUDES_DEFAULT 458238104Sdes [ 459238104Sdes #if HAVE_SYS_PARAM_H 460238104Sdes # include <sys/param.h> 461238104Sdes #endif 462238104Sdes ] 463238104Sdes]) 464238104SdesAC_CHECK_HEADER(sys/socket.h, 465238104Sdes[ 466238104Sdesinclude_sys_socket_h='#include <sys/socket.h>' 467238104SdesAC_DEFINE(HAVE_SYS_SOCKET_H, 1, [define if you have sys/socket.h]) 468238104Sdes],[ 469238104Sdesinclude_sys_socket_h='' 470238104Sdes],[AC_INCLUDES_DEFAULT 471238104Sdes [ 472238104Sdes #if HAVE_SYS_PARAM_H 473238104Sdes # include <sys/param.h> 474238104Sdes #endif 475238104Sdes ] 476238104Sdes]) 477238104SdesAC_SUBST(include_sys_socket_h) 478238104SdesAC_CHECK_HEADER(inttypes.h, 479238104Sdes[ 480238104Sdesinclude_inttypes_h='#include <inttypes.h>' 481238104SdesAC_DEFINE(HAVE_INTTYPES_H, 1, [define if you have inttypes.h]) 482238104SdesAC_SUBST(ldns_build_config_have_inttypes_h, 1) 483238104Sdes],[ 484238104Sdesinclude_inttypes_h='' 485238104SdesAC_SUBST(ldns_build_config_have_inttypes_h, 0) 486238104Sdes],[AC_INCLUDES_DEFAULT 487238104Sdes]) 488238104SdesAC_SUBST(include_inttypes_h) 489238104SdesAC_CHECK_HEADER(sys/types.h, 490238104Sdes[ 491238104Sdesinclude_systypes_h='#include <sys/types.h>' 492238104SdesAC_DEFINE(HAVE_SYS_TYPES_H, 1, [define if you have sys/types.h]) 493238104Sdes],[ 494238104Sdesinclude_systypes_h='' 495238104Sdes],[AC_INCLUDES_DEFAULT 496238104Sdes]) 497238104SdesAC_SUBST(include_systypes_h) 498238104SdesAC_CHECK_HEADER(unistd.h, 499238104Sdes[ 500238104Sdesinclude_unistd_h='#include <unistd.h>' 501238104SdesAC_DEFINE(HAVE_UNISTD_H, 1, [define if you have unistd.h]) 502238104Sdes],[ 503238104Sdesinclude_unistd_h='' 504238104Sdes],[AC_INCLUDES_DEFAULT 505238104Sdes]) 506238104SdesAC_SUBST(include_unistd_h) 507238104Sdes 508238104SdesAC_CHECK_SIZEOF(time_t,,[ 509238104SdesAC_INCLUDES_DEFAULT 510238104Sdes#ifdef TIME_WITH_SYS_TIME 511238104Sdes# include <sys/time.h> 512238104Sdes# include <time.h> 513238104Sdes#else 514238104Sdes# ifdef HAVE_SYS_TIME_H 515238104Sdes# include <sys/time.h> 516238104Sdes# else 517238104Sdes# include <time.h> 518238104Sdes# endif 519238104Sdes#endif 520238104Sdes]) 521238104Sdes 522238104Sdesif test x_$with_examples != x_no; then 523269257SdesAC_CHECK_HEADERS([pcap.h],,, [AC_INCLUDES_DEFAULT]) 524238104SdesAC_CHECK_LIB(pcap, pcap_open_offline, [ 525238104Sdes AC_DEFINE([HAVE_LIBPCAP], [1], [Define to 1 if you have the `pcap' library (-lpcap).])dnl` 526238104Sdes AC_SUBST([LIBPCAP_LIBS], [-lpcap]) 527238104Sdes ], [ 528238104Sdes AC_MSG_WARN([Can't find pcap library (needed for ldns-dpa, will not build dpa now.)])dnl' 529238104Sdes AC_SUBST([LIBPCAP_LIBS], []) 530238104Sdes ] 531238104Sdes) 532238104SdesAC_CHECK_HEADERS([netinet/in_systm.h net/if.h netinet/ip.h netinet/udp.h netinet/igmp.h netinet/if_ether.h netinet/ip6.h net/ethernet.h netinet/ip_compat.h],,, [ 533238104SdesAC_INCLUDES_DEFAULT 534238104Sdes#ifdef HAVE_NETINET_IN_SYSTM_H 535238104Sdes#include <netinet/in_systm.h> 536238104Sdes#endif 537238104Sdes#ifdef HAVE_NETINET_IN_H 538238104Sdes#include <netinet/in.h> 539238104Sdes#endif 540238104Sdes#ifdef HAVE_SYS_SOCKET_H 541238104Sdes#include <sys/socket.h> 542238104Sdes#endif 543238104Sdes#ifdef HAVE_NET_IF_H 544238104Sdes#include <net/if.h> 545238104Sdes#endif]) 546238104Sdesfi 547238104Sdes 548238104SdesACX_TYPE_SOCKLEN_T 549246854Sdesif test "x$ac_cv_type_socklen_t" = xyes; then 550246854Sdes AC_SUBST(ldns_build_config_have_socklen_t, 1) 551246854Sdeselse 552246854Sdes AC_SUBST(ldns_build_config_have_socklen_t, 0) 553246854Sdesfi 554238104SdesAC_TYPE_SIZE_T 555269257SdesAC_CHECK_TYPE(ssize_t, int) 556269257Sdesdnl AC_TYPE_INTPTR_T does not work on all platforms (autoconf) 557269257SdesAC_CHECK_TYPE(intptr_t, size_t) 558238104SdesAC_CHECK_TYPE(in_addr_t, [], [AC_DEFINE([in_addr_t], [uint32_t], [in_addr_t])], [ 559238104Sdes#if HAVE_SYS_TYPES_H 560238104Sdes# include <sys/types.h> 561238104Sdes#endif 562238104Sdes#if HAVE_NETINET_IN_H 563238104Sdes# include <netinet/in.h> 564238104Sdes#endif]) 565238104SdesAC_CHECK_TYPE(in_port_t, [], [AC_DEFINE([in_port_t], [uint16_t], [in_port_t])], [ 566238104Sdes#if HAVE_SYS_TYPES_H 567238104Sdes# include <sys/types.h> 568238104Sdes#endif 569238104Sdes#if HAVE_NETINET_IN_H 570238104Sdes# include <netinet/in.h> 571238104Sdes#endif]) 572238104SdesACX_CHECK_SS_FAMILY 573238104Sdes 574238104SdesAC_FUNC_MALLOC 575238104SdesAC_FUNC_REALLOC 576238104Sdes 577238104SdesAC_REPLACE_FUNCS(b64_pton) 578238104SdesAC_REPLACE_FUNCS(b64_ntop) 579238104SdesAC_REPLACE_FUNCS(calloc) 580238104SdesAC_REPLACE_FUNCS(timegm) 581238104SdesAC_REPLACE_FUNCS(gmtime_r) 582238104SdesAC_REPLACE_FUNCS(ctime_r) 583238104SdesAC_REPLACE_FUNCS(localtime_r) 584238104SdesAC_REPLACE_FUNCS(isblank) 585238104SdesAC_REPLACE_FUNCS(isascii) 586238104SdesAC_REPLACE_FUNCS(inet_aton) 587238104SdesAC_REPLACE_FUNCS(inet_pton) 588238104SdesAC_REPLACE_FUNCS(inet_ntop) 589238104SdesAC_REPLACE_FUNCS(snprintf) 590238104SdesAC_REPLACE_FUNCS(strlcpy) 591238104SdesAC_REPLACE_FUNCS(memmove) 592238104SdesAC_FUNC_FORK 593269257SdesAC_CHECK_FUNCS([endprotoent endservent sleep random fcntl strtoul bzero memset b32_ntop b32_pton]) 594269257Sdesif test "x$HAVE_B32_NTOP" = "xyes"; then 595269257Sdes AC_SUBST(ldns_build_config_have_b32_ntop, 1) 596269257Sdeselse 597269257Sdes AC_SUBST(ldns_build_config_have_b32_ntop, 0) 598269257Sdesfi 599269257Sdesif test "x$HAVE_B32_PTON" = "xyes"; then 600269257Sdes AC_SUBST(ldns_build_config_have_b32_pton, 1) 601269257Sdeselse 602269257Sdes AC_SUBST(ldns_build_config_have_b32_pton, 0) 603269257Sdesfi 604238104Sdes 605238104SdesACX_CHECK_GETADDRINFO_WITH_INCLUDES 606238104Sdesif test $ac_cv_func_getaddrinfo = no; then 607238104Sdes AC_LIBOBJ([fake-rfc2553]) 608238104Sdesfi 609238104Sdesif test "$USE_WINSOCK" = 1; then 610238104Sdes AC_CHECK_TOOL(WINDRES, windres) 611238104Sdesfi 612238104SdesACX_FUNC_IOCTLSOCKET 613238104Sdes 614238104Sdes#AC_SEARCH_LIBS(RSA_new, [crypto]) 615238104Sdes 616238104SdesACX_CHECK_FORMAT_ATTRIBUTE 617238104SdesACX_CHECK_UNUSED_ATTRIBUTE 618238104Sdes 619238104Sdes# check OSX deployment target which is needed 620238104Sdesif echo $build_os | grep darwin > /dev/null; then 621238104Sdes export MACOSX_DEPLOYMENT_TARGET="10.4" 622238104Sdesfi 623238104Sdes 624238104SdesAC_DEFINE([SYSCONFDIR], [sysconfdir], [System configuration dir]) 625238104Sdes 626246854SdesAC_ARG_WITH(trust-anchor, AC_HELP_STRING([--with-trust-anchor=KEYFILE], [Default location of the trust anchor file for drill and ldns-dane. [default=SYSCONFDIR/unbound/root.key]]), [ 627246854Sdes LDNS_TRUST_ANCHOR_FILE="$withval" 628246854Sdes],[ 629246854Sdes if test "x$LDNS_TRUST_ANCHOR_FILE" = "x"; then 630246854Sdes if test "x$sysconfdir" = 'x${prefix}/etc' ; then 631246854Sdes if test "x$prefix" = 'xNONE' ; then 632246854Sdes LDNS_TRUST_ANCHOR_FILE="/etc/unbound/root.key" 633246854Sdes else 634246854Sdes LDNS_TRUST_ANCHOR_FILE="${prefix}/etc/unbound/root.key" 635246854Sdes fi 636246854Sdes else 637246854Sdes LDNS_TRUST_ANCHOR_FILE="${sysconfdir}/unbound/root.key" 638246854Sdes fi 639246854Sdes fi 640246854Sdes]) 641246854SdesAC_DEFINE_UNQUOTED([LDNS_TRUST_ANCHOR_FILE], ["$LDNS_TRUST_ANCHOR_FILE"], [Default trust anchor file]) 642246854SdesAC_SUBST(LDNS_TRUST_ANCHOR_FILE) 643246854SdesAC_MSG_NOTICE([Default trust anchor: $LDNS_TRUST_ANCHOR_FILE]) 644246854Sdes 645246854SdesAC_ARG_WITH(ca-file, AC_HELP_STRING([--with-ca-file=CAFILE], [File containing CA certificates for ldns-dane]), [ 646246854Sdes AC_DEFINE([HAVE_DANE_CA_FILE], [1], [Is a CAFILE given at configure time]) 647246854Sdes AC_DEFINE_UNQUOTED([LDNS_DANE_CA_FILE], ["$withval"], [Is a CAFILE given at configure time]) 648246854Sdes AC_MSG_NOTICE([Using CAfile: $withval]) 649246854Sdes AC_SUBST(DEFAULT_CAFILE, ["Default is $withval"]) 650246854Sdes],[ 651246854Sdes AC_DEFINE([HAVE_DANE_CA_FILE], [0], [Is a CAFILE given at configure time]) 652246854Sdes AC_SUBST(DEFAULT_CAFILE, []) 653246854Sdes]) 654246854Sdes 655246854SdesAC_ARG_WITH(ca-path, AC_HELP_STRING([--with-ca-path=CAPATH], [Directory containing CA certificate files for ldns-dane]), [ 656246854Sdes AC_DEFINE([HAVE_DANE_CA_PATH], [1], [Is a CAPATH given at configure time]) 657246854Sdes AC_DEFINE_UNQUOTED([LDNS_DANE_CA_PATH], ["$withval"], [Is a CAPATH given at configure time]) 658246854Sdes AC_MSG_NOTICE([Using CApath: $withval]) 659246854Sdes AC_SUBST(DEFAULT_CAPATH, ["Default is $withval"]) 660246854Sdes],[ 661246854Sdes AC_DEFINE([HAVE_DANE_CA_PATH], [0], [Is a CAPATH given at configure time]) 662246854Sdes AC_SUBST(DEFAULT_CAPATH, []) 663246854Sdes]) 664246854Sdes 665238104SdesAH_BOTTOM([ 666238104Sdes#include <stdio.h> 667238104Sdes#include <string.h> 668238104Sdes#include <unistd.h> 669238104Sdes#include <assert.h> 670238104Sdes 671238104Sdes#ifndef LITTLE_ENDIAN 672238104Sdes#define LITTLE_ENDIAN 1234 673238104Sdes#endif 674238104Sdes 675238104Sdes#ifndef BIG_ENDIAN 676238104Sdes#define BIG_ENDIAN 4321 677238104Sdes#endif 678238104Sdes 679238104Sdes#ifndef BYTE_ORDER 680238104Sdes#ifdef WORDS_BIGENDIAN 681238104Sdes#define BYTE_ORDER BIG_ENDIAN 682238104Sdes#else 683238104Sdes#define BYTE_ORDER LITTLE_ENDIAN 684238104Sdes#endif /* WORDS_BIGENDIAN */ 685238104Sdes#endif /* BYTE_ORDER */ 686238104Sdes 687238104Sdes#if STDC_HEADERS 688238104Sdes#include <stdlib.h> 689238104Sdes#include <stddef.h> 690238104Sdes#endif 691238104Sdes 692238104Sdes#ifdef HAVE_STDINT_H 693238104Sdes#include <stdint.h> 694238104Sdes#endif 695238104Sdes 696238104Sdes#ifdef HAVE_SYS_SOCKET_H 697238104Sdes#include <sys/socket.h> 698238104Sdes#endif 699238104Sdes 700238104Sdes#ifdef HAVE_NETINET_IN_H 701238104Sdes#include <netinet/in.h> 702238104Sdes#endif 703238104Sdes 704238104Sdes#ifdef HAVE_ARPA_INET_H 705238104Sdes#include <arpa/inet.h> 706238104Sdes#endif 707238104Sdes 708238104Sdes#ifdef HAVE_WINSOCK2_H 709238104Sdes#include <winsock2.h> 710238104Sdes#endif 711238104Sdes 712238104Sdes#ifdef HAVE_WS2TCPIP_H 713238104Sdes#include <ws2tcpip.h> 714238104Sdes#endif 715238104Sdes] 716238104SdesAHX_CONFIG_W32_FD_SET_T 717238104Sdes) 718238104Sdes 719238104SdesAH_BOTTOM([ 720238104Sdes#ifdef __cplusplus 721238104Sdesextern "C" { 722238104Sdes#endif 723238104Sdes 724238104Sdesint ldns_b64_ntop(uint8_t const *src, size_t srclength, 725238104Sdes char *target, size_t targsize); 726238104Sdes/** 727238104Sdes * calculates the size needed to store the result of b64_ntop 728238104Sdes */ 729238104Sdes/*@unused@*/ 730238104Sdesstatic inline size_t ldns_b64_ntop_calculate_size(size_t srcsize) 731238104Sdes{ 732238104Sdes return ((((srcsize + 2) / 3) * 4) + 1); 733238104Sdes} 734238104Sdesint ldns_b64_pton(char const *src, uint8_t *target, size_t targsize); 735238104Sdes/** 736238104Sdes * calculates the size needed to store the result of ldns_b64_pton 737238104Sdes */ 738238104Sdes/*@unused@*/ 739238104Sdesstatic inline size_t ldns_b64_pton_calculate_size(size_t srcsize) 740238104Sdes{ 741238104Sdes return (((((srcsize + 3) / 4) * 3)) + 1); 742238104Sdes} 743238104Sdes 744269257Sdes/** 745269257Sdes * Given in dnssec_zone.c, also used in dnssec_sign.c:w 746269257Sdes 747269257Sdes */ 748269257Sdesint ldns_dname_compare_v(const void *a, const void *b); 749269257Sdes 750238104Sdes#ifndef HAVE_SLEEP 751238104Sdes/* use windows sleep, in millisecs, instead */ 752238104Sdes#define sleep(x) Sleep((x)*1000) 753238104Sdes#endif 754238104Sdes 755238104Sdes#ifndef HAVE_RANDOM 756238104Sdes#define srandom(x) srand(x) 757238104Sdes#define random(x) rand(x) 758238104Sdes#endif 759238104Sdes 760238104Sdes#ifndef HAVE_TIMEGM 761238104Sdes#include <time.h> 762238104Sdestime_t timegm (struct tm *tm); 763238104Sdes#endif /* !TIMEGM */ 764238104Sdes#ifndef HAVE_GMTIME_R 765238104Sdesstruct tm *gmtime_r(const time_t *timep, struct tm *result); 766238104Sdes#endif 767238104Sdes#ifndef HAVE_LOCALTIME_R 768238104Sdesstruct tm *localtime_r(const time_t *timep, struct tm *result); 769238104Sdes#endif 770238104Sdes#ifndef HAVE_ISBLANK 771238104Sdesint isblank(int c); 772238104Sdes#endif /* !HAVE_ISBLANK */ 773238104Sdes#ifndef HAVE_ISASCII 774238104Sdesint isascii(int c); 775238104Sdes#endif /* !HAVE_ISASCII */ 776238104Sdes#ifndef HAVE_SNPRINTF 777238104Sdes#include <stdarg.h> 778238104Sdesint snprintf (char *str, size_t count, const char *fmt, ...); 779238104Sdesint vsnprintf (char *str, size_t count, const char *fmt, va_list arg); 780238104Sdes#endif /* HAVE_SNPRINTF */ 781238104Sdes#ifndef HAVE_INET_PTON 782238104Sdesint inet_pton(int af, const char* src, void* dst); 783238104Sdes#endif /* HAVE_INET_PTON */ 784238104Sdes#ifndef HAVE_INET_NTOP 785238104Sdesconst char *inet_ntop(int af, const void *src, char *dst, size_t size); 786238104Sdes#endif 787238104Sdes#ifndef HAVE_INET_ATON 788238104Sdesint inet_aton(const char *cp, struct in_addr *addr); 789238104Sdes#endif 790238104Sdes#ifndef HAVE_MEMMOVE 791238104Sdesvoid *memmove(void *dest, const void *src, size_t n); 792238104Sdes#endif 793238104Sdes#ifndef HAVE_STRLCPY 794238104Sdessize_t strlcpy(char *dst, const char *src, size_t siz); 795238104Sdes#endif 796238104Sdes#ifdef __cplusplus 797238104Sdes} 798238104Sdes#endif 799238104Sdes#ifndef HAVE_GETADDRINFO 800238104Sdes#include "compat/fake-rfc2553.h" 801238104Sdes#endif 802238104Sdes#ifndef HAVE_STRTOUL 803238104Sdes#define strtoul (unsigned long)strtol 804238104Sdes#endif 805238104Sdes]) 806238104Sdes 807238104Sdesif test "x$HAVE_SSL" = "xyes"; then 808238104Sdes AC_SUBST(ldns_build_config_have_ssl, 1) 809238104Sdeselse 810238104Sdes AC_SUBST(ldns_build_config_have_ssl, 0) 811238104Sdesfi 812238104Sdesif test "x$ac_cv_c_format_attribute" = "xyes"; then 813238104Sdes AC_SUBST(ldns_build_config_have_attr_format, 1) 814238104Sdeselse 815238104Sdes AC_SUBST(ldns_build_config_have_attr_format, 0) 816238104Sdesfi 817238104Sdesif test "x$ac_cv_c_unused_attribute" = "xyes"; then 818238104Sdes AC_SUBST(ldns_build_config_have_attr_unused, 1) 819238104Sdeselse 820238104Sdes AC_SUBST(ldns_build_config_have_attr_unused, 0) 821238104Sdesfi 822238104Sdes 823246854SdesCONFIG_FILES="Makefile ldns/common.h ldns/net.h ldns/util.h packaging/libldns.pc packaging/ldns-config $DRILL_CONFIG $EXAMPLES_CONFIG" 824246854SdesAC_SUBST(CONFIG_FILES) 825246854SdesAC_CONFIG_FILES([$CONFIG_FILES]) 826238104Sdes 827238104SdesAC_CONFIG_HEADER([ldns/config.h]) 828238104SdesAC_OUTPUT 829238104SdesCOPY_HEADER_FILES(ldns/, ldns/) 830238104Sdes 831238104Sdesdnl AC_CONFIG_SUBDIRS([drill]) 832238104Sdes 833238104Sdes 834