2 # Process this file with autoconf to produce a configure script.
4 sinclude(acx_nlnetlabs.m4)
6 # must be numbers. ac_defun because of later processing.
7 m4_define([VERSION_MAJOR],[1])
8 m4_define([VERSION_MINOR],[7])
9 m4_define([VERSION_MICRO],[0])
10 AC_INIT(ldns, m4_defn([VERSION_MAJOR]).m4_defn([VERSION_MINOR]).m4_defn([VERSION_MICRO]), libdns@nlnetlabs.nl, libdns)
11 AC_CONFIG_SRCDIR([packet.c])
12 # needed to build correct soname
13 AC_SUBST(LDNS_VERSION_MAJOR, [VERSION_MAJOR])
14 AC_SUBST(LDNS_VERSION_MINOR, [VERSION_MINOR])
15 AC_SUBST(LDNS_VERSION_MICRO, [VERSION_MICRO])
19 # current:revision:age
20 # (binary-api-number):(which-binary-api-version):(how-many-nrs-backwardscompat)
21 # if source code changes increment revision
22 # if any interfaces have been added/removed/changed since last update then
23 # increment current and set revision to 0
24 # if any interfaces have been added since the last public release then increment age
25 # if any interfaces have been removed or changed since the last public release then
28 # ldns-1.6.17 and before had a .so with version same as VERSION_INFO
29 # ldns-1.7.0 will have libversion 2:0:0
31 AC_SUBST(VERSION_INFO, [2:0:0])
34 if test "$ac_cv_header_minix_config_h" = "yes"; then
35 AC_DEFINE(_NETBSD_SOURCE,1, [Enable for compile on Minix])
38 AC_CONFIG_MACRO_DIR([m4])
41 CPPFLAGS=${CPPFLAGS:-${OURCPPFLAGS}}
44 # Checks for programs.
49 # Extra (sp)lint flags for NetBSD
52 netbsd*) LINTFLAGS="'-D__RENAME(x)=' -D_NETINET_IN_H_ $LINTFLAGS"
54 *) LINTFLAGS="$LINTFLAGS"
59 AC_DEFINE(WINVER, 0x0502, [the version of the windows API enabled])
61 ACX_CHECK_COMPILER_FLAG(std=c99, [C99FLAG="-std=c99"])
62 ACX_CHECK_COMPILER_FLAG(xc99, [C99FLAG="-xc99"])
64 # routine to copy files
65 # argument 1 is a list of files (relative to the source dir)
66 # argument 2 is a destination directory (relative to the current
68 AC_DEFUN([COPY_FILES],
71 sh $srcdir/install-sh -m 644 $file $2
75 # copy all .h files in the dir at argument 1
76 # (relative to source) to the dir at argument 2
77 # (relative to current dir)
78 AC_DEFUN([COPY_HEADER_FILES],
80 echo "copying header files"
81 COPY_FILES($srcdir/$1/*.h, $2)
84 # Checks for typedefs, structures, and compiler characteristics.
87 if test "x$CFLAGS" = "x" ; then
88 ACX_CHECK_COMPILER_FLAG(g, [CFLAGS="-g"])
89 ACX_CHECK_COMPILER_FLAG(O2, [CFLAGS="-O2 $CFLAGS"])
91 ACX_CHECK_COMPILER_FLAG(Wall, [CFLAGS="-Wall $CFLAGS"])
92 ACX_CHECK_COMPILER_FLAG(W, [CFLAGS="-W $CFLAGS"])
93 ACX_CHECK_COMPILER_FLAG(Wwrite-strings, [CFLAGS="-Wwrite-strings $CFLAGS"])
94 ACX_CHECK_COMPILER_FLAG(Wstrict-prototypes, [CFLAGS="-Wstrict-prototypes $CFLAGS"])
95 #ACX_CHECK_COMPILER_FLAG(Wshadow, [CFLAGS="-Wshadow $CFLAGS"])
96 ACX_CHECK_COMPILER_FLAG(Wunused-function, [CFLAGS="-Wunused-function $CFLAGS"])
97 ACX_CHECK_COMPILER_FLAG(Wmissing-prototypes, [CFLAGS="-Wmissing-prototypes $CFLAGS"])
99 AC_CHECK_HEADERS([getopt.h time.h],,, [AC_INCLUDES_DEFAULT])
102 AC_CHECK_HEADERS([winsock2.h ws2tcpip.h],,, [AC_INCLUDES_DEFAULT])
105 ACX_DETERMINE_EXT_FLAGS_UNBOUND
108 AC_CHECK_TYPE(int8_t, char)
109 AC_CHECK_TYPE(int16_t, short)
110 AC_CHECK_TYPE(int32_t, int)
111 AC_CHECK_TYPE(int64_t, long long)
112 AC_CHECK_TYPE(uint8_t, unsigned char)
113 AC_CHECK_TYPE(uint16_t, unsigned short)
114 AC_CHECK_TYPE(uint32_t, unsigned int)
115 AC_CHECK_TYPE(uint64_t, unsigned long long)
118 AC_CHECK_PROG(doxygen, doxygen, doxygen)
120 # check to see if libraries are needed for these functions.
121 AC_SEARCH_LIBS([socket], [socket])
122 AC_SEARCH_LIBS([inet_pton], [nsl])
125 AC_ARG_WITH(drill, AC_HELP_STRING([--with-drill],
126 [Also build drill.]),
127 [],[with_drill="no"])
128 if test x_$with_drill != x_no ; then
129 AC_SUBST(DRILL,[drill])
130 AC_SUBST(INSTALL_DRILL,[install-drill])
131 AC_SUBST(UNINSTALL_DRILL,[uninstall-drill])
132 AC_SUBST(CLEAN_DRILL,[clean-drill])
133 AC_SUBST(LINT_DRILL,[lint-drill])
134 if test -e $srcdir/drill/config.h -o -e drill/config.h ; then
136 A config.h was detected in the drill subdirectory.
137 This does not work with the --with-drill option.
138 Please remove the config.h from the drill subdirectory
139 or do not use the --with-drill option.])
143 AC_SUBST(INSTALL_DRILL,[""])
144 AC_SUBST(UNINSTALL_DRILL,[""])
145 AC_SUBST(CLEAN_DRILL,[""])
146 AC_SUBST(LINT_DRILL,[""])
150 AC_ARG_WITH(examples, AC_HELP_STRING([--with-examples],
151 [Also build examples.]),
152 [],[with_examples="no"])
153 if test x_$with_examples != x_no ; then
154 AC_SUBST(EXAMPLES,[examples])
155 AC_SUBST(INSTALL_EXAMPLES,[install-examples])
156 AC_SUBST(UNINSTALL_EXAMPLES,[uninstall-examples])
157 AC_SUBST(CLEAN_EXAMPLES,[clean-examples])
158 AC_SUBST(LINT_EXAMPLES,[lint-examples])
159 if test -e $srcdir/examples/config.h -o -e examples/config.h ; then
161 A config.h was detected in the examples subdirectory.
162 This does not work with the --with-examples option.
163 Please remove the config.h from the examples subdirectory
164 or do not use the --with-examples option.])
167 AC_SUBST(EXAMPLES,[""])
168 AC_SUBST(INSTALL_EXAMPLES,[""])
169 AC_SUBST(UNINSTALL_EXAMPLES,[""])
170 AC_SUBST(CLEAN_EXAMPLES,[""])
171 AC_SUBST(LINT_EXAMPLES,[""])
174 # add option to disable installation of ldns-config script
175 AC_ARG_ENABLE(ldns-config, AC_HELP_STRING([--disable-ldns-config], [disable installation of ldns-config (default=enabled)]),
176 enable_ldns_config=$enableval, enable_ldns_config=yes)
177 if test "x$enable_ldns_config" = xyes; then
178 AC_SUBST(INSTALL_CONFIG, [install-config])
179 AC_SUBST(INSTALL_CONFIG_MANPAGE, [install-config-manpage])
180 AC_SUBST(UNINSTALL_CONFIG, [uninstall-config])
181 AC_SUBST(UNINSTALL_CONFIG_MANPAGE, [uninstall-config-manpage])
183 AC_SUBST(INSTALL_CONFIG, [""])
184 AC_SUBST(INSTALL_CONFIG_MANPAGE, [""])
185 AC_SUBST(UNINSTALL_CONFIG, [""])
186 AC_SUBST(UNINSTALL_CONFIG_MANPAGE, [""])
189 # add option to disable library printing to stderr
190 AC_ARG_ENABLE(stderr-msgs, AC_HELP_STRING([--enable-stderr-msgs], [Enable printing to stderr (default=disabled)]), enable_stderr_msgs=$enableval, enable_stderr_msgs=no)
191 case "$enable_stderr_msgs" in
195 AC_DEFINE_UNQUOTED([STDERR_MSGS], [1], [Define this to enable messages to stderr.])
200 [AX_CONFIG_FEATURE_ENABLE(poll)],
201 [AX_CONFIG_FEATURE_DISABLE(poll)])
203 [poll], [This platform supports poll(7)],
204 [HAVE_POLL], [This platform supports poll(7).])
210 AC_ARG_WITH(pyldns, AC_HELP_STRING([--with-pyldns],
211 [generate python library, or --without-pyldns to disable Python support.]),
214 if test x_$withval != x_no; then
215 sinclude(ax_python_devel.m4)
216 ac_save_LIBS="$LIBS" dnl otherwise AC_PYTHON_DEVEL thrashes $LIBS
218 AX_PYTHON_DEVEL([>= '2.4.0'])
219 if test ! -z "$ac_python_version"; then
223 # pass additional Python 3 option to SWIG
224 if test `$PYTHON -c "import sys; \
225 ver = sys.version.split()[[0]]; \
226 print(ver >= '3')"` = "True"; then
227 AC_SUBST(SWIGPY3, ["-py3 -DPY3"])
231 if test x_$ldns_have_python != x_no; then
232 sinclude(ax_pkg_swig.m4)
234 # check for >=SWIG-2.0.4 if Python 3.2 used
235 if test `$PYTHON -c "import sys; \
236 ver = sys.version.split()[[0]]; \
237 print(ver >= '3.2')"` = "True"; then
238 AX_PKG_SWIG(2.0.4, [], [AC_MSG_ERROR([SWIG-2.0.4 is required to build pyldns for Python 3.2 and greater.])])
243 if test ! -x "$SWIG"; then
244 AC_MSG_ERROR([failed to find SWIG tool, install it, or do not build pyldns])
246 AC_DEFINE(HAVE_SWIG,1,[Define if you have SWIG libraries and header files.])
247 AC_SUBST(PYLDNS, "pyldns")
248 AC_SUBST(swig, "$SWIG")
252 AC_MSG_RESULT([*** don't have Python, skipping SWIG, no pyldns ***]) # '
255 # xtra cflags for pyldns
256 if test x_$ldns_have_python != x_no; then
257 ACX_CHECK_COMPILER_FLAG(fno-strict-aliasing, [PYTHON_X_CFLAGS="-fno-strict-aliasing"])
258 ACX_CHECK_COMPILER_FLAG(Wno-missing-field-initializers, [PYTHON_X_CFLAGS="-Wno-missing-field-initializers $PYTHON_X_CFLAGS"])
259 ACX_CHECK_COMPILER_FLAG(Wno-unused-parameter, [PYTHON_X_CFLAGS="-Wno-unused-parameter $PYTHON_X_CFLAGS"])
260 ACX_CHECK_COMPILER_FLAG(Wno-unused-variable, [PYTHON_X_CFLAGS="-Wno-unused-variable $PYTHON_X_CFLAGS"])
263 AC_SUBST(PYTHON_X_CFLAGS)
266 AC_ARG_WITH(pyldnsx, AC_HELP_STRING([--without-pyldnsx],
267 [Do not install the ldnsx python module, or --with-pyldnsx to install it.]),
268 [],[ withval="with_pyldns" ])
269 if test x_$withval != x_no; then
270 if test x_$ldns_with_pyldns != x_no; then
271 AC_SUBST(PYLDNSX, "pyldnsx")
272 ldns_with_pyldnsx=yes
274 if test x_$withval != x_with_pyldns; then
275 AC_MSG_ERROR([--with-pyldns is needed for the ldnsx python module])
280 if test x_$ldns_with_pyldns != x_no; then
281 AC_SUBST(PYLDNSINST, "install-pyldns")dnl
282 AC_SUBST(PYLDNSUNINST, "uninstall-pyldns")
284 AC_SUBST(PYLDNSINST, "")dnl
285 AC_SUBST(PYLDNSUNINST, "")
287 if test x_$ldns_with_pyldnsx != x_no; then
288 AC_SUBST(PYLDNSXINST, "install-pyldnsx")dnl
289 AC_SUBST(PYLDNSXUNINST, "uninstall-pyldnsx")
291 AC_SUBST(PYLDNSXINST, "")dnl
292 AC_SUBST(PYLDNSXUNINST, "")
296 ldns_with_p5_dns_ldns=no
297 AC_ARG_WITH(p5-dns-ldns, AC_HELP_STRING([--with-p5-dns-ldns],
298 [generate DNS::LDNS perl bindings]),
301 if test x_$withval != x_no; then
302 AC_PATH_PROG([PERL], [perl])
303 if test -z "$PERL"; then
304 AC_MSG_ERROR([Cannot find perl in your system path])
306 AC_SUBST(P5_DNS_LDNS, "p5-dns-ldns")dnl
307 AC_SUBST(TEST_P5_DNS_LDNS, "test-p5-dns-ldns")dnl
308 AC_SUBST(INSTALL_P5_DNS_LDNS, "install-p5-dns-ldns")dnl
309 AC_SUBST(UNINSTALL_P5_DNS_LDNS, "uninstall-p5-dns-ldns")dnl
310 AC_SUBST(CLEAN_P5_DNS_LDNS, "clean-p5-dns-ldns")
312 AC_SUBST(P5_DNS_LDNS, "")dnl
313 AC_SUBST(TEST_P5_DNS_LDNS, "")dnl
314 AC_SUBST(INSTALL_P5_DNS_LDNS, "")dnl
315 AC_SUBST(UNINSTALL_P5_DNS_LDNS, "")dnl
316 AC_SUBST(CLEAN_P5_DNS_LDNS, "")
322 tmp_CPPFLAGS=$CPPFLAGS
326 ACX_WITH_SSL_OPTIONAL
327 AC_MSG_CHECKING([for LibreSSL])
328 if grep VERSION_TEXT $ssldir/include/openssl/opensslv.h | grep "LibreSSL" >/dev/null; then
330 AC_DEFINE([HAVE_LIBRESSL], [1], [Define if we have LibreSSL])
334 AC_CHECK_FUNCS([EVP_sha256 EVP_sha384 EVP_sha512 ENGINE_load_cryptodev EVP_PKEY_keygen ECDSA_SIG_get0 EVP_MD_CTX_new EVP_PKEY_base_id DSA_SIG_set0 DSA_SIG_get0 EVP_dss1 DSA_get0_pqg DSA_get0_key])
336 # for macosx, see if glibtool exists and use that
337 # BSD's need to know the version...
338 #AC_CHECK_PROG(glibtool, glibtool, [glibtool], )
339 #AC_CHECK_PROGS(libtool, [libtool15 libtool], [./libtool])
341 AC_ARG_ENABLE(sha2, AC_HELP_STRING([--disable-sha2], [Disable SHA256 and SHA512 RRSIG support]))
342 case "$enable_sha2" in
346 if test "x$HAVE_SSL" != "xyes"; then
347 AC_MSG_ERROR([SHA2 enabled, but no SSL support])
349 AC_MSG_CHECKING(for SHA256 and SHA512)
350 AC_CHECK_FUNC(SHA256_Init, [], [
351 AC_MSG_ERROR([No SHA2 functions found in OpenSSL: please upgrade OpenSSL or rerun with --disable-sha2])
353 AC_DEFINE_UNQUOTED([USE_SHA2], [1], [Define this to enable SHA256 and SHA512 support.])
357 # check wether gost also works
358 AC_DEFUN([AC_CHECK_GOST_WORKS],
359 [AC_REQUIRE([AC_PROG_CC])
360 AC_MSG_CHECKING([if GOST works])
361 if test c${cross_compiling} = cno; then
363 if test -n "$ssldir"; then
364 CFLAGS="$CFLAGS -Wl,-rpath,$ssldir/lib"
366 AC_RUN_IFELSE([AC_LANG_SOURCE([[
368 #include <openssl/ssl.h>
369 #include <openssl/evp.h>
370 #include <openssl/engine.h>
371 #include <openssl/conf.h>
372 /* routine to load gost (from sldns) */
373 int load_gost_id(void)
375 static int gost_id = 0;
376 const EVP_PKEY_ASN1_METHOD* meth;
379 if(gost_id) return gost_id;
381 /* see if configuration loaded gost implementation from other engine*/
382 meth = EVP_PKEY_asn1_find_str(NULL, "gost2001", -1);
384 EVP_PKEY_asn1_get0_info(&gost_id, NULL, NULL, NULL, NULL, meth);
388 /* see if engine can be loaded already */
389 e = ENGINE_by_id("gost");
391 /* load it ourself, in case statically linked */
392 ENGINE_load_builtin_engines();
393 ENGINE_load_dynamic();
394 e = ENGINE_by_id("gost");
397 /* no gost engine in openssl */
400 if(!ENGINE_set_default(e, ENGINE_METHOD_ALL)) {
406 meth = EVP_PKEY_asn1_find_str(&e, "gost2001", -1);
413 EVP_PKEY_asn1_get0_info(&gost_id, NULL, NULL, NULL, NULL, meth);
419 unsigned char digest[64]; /* its a 256-bit digest, so uses 32 bytes */
420 const char* str = "Hello world";
421 const unsigned char check[] = {
422 0x40 , 0xed , 0xf8 , 0x56 , 0x5a , 0xc5 , 0x36 , 0xe1 ,
423 0x33 , 0x7c , 0x7e , 0x87 , 0x62 , 0x1c , 0x42 , 0xe0 ,
424 0x17 , 0x1b , 0x5e , 0xce , 0xa8 , 0x46 , 0x65 , 0x4d ,
425 0x8d , 0x3e , 0x22 , 0x9b , 0xe1 , 0x30 , 0x19 , 0x9d
427 OPENSSL_config(NULL);
428 (void)load_gost_id();
429 md = EVP_get_digestbyname("md_gost94");
431 memset(digest, 0, sizeof(digest));
432 ctx = EVP_MD_CTX_create();
434 if(!EVP_DigestInit_ex(ctx, md, NULL)) return 3;
435 if(!EVP_DigestUpdate(ctx, str, 10)) return 4;
436 if(!EVP_DigestFinal_ex(ctx, digest, NULL)) return 5;
437 /* uncomment to see the hash calculated.
440 printf(" %2.2x", (int)digest[i]);
443 if(memcmp(digest, check, sizeof(check)) != 0)
447 ]])] , [eval "ac_cv_c_gost_works=yes"], [eval "ac_cv_c_gost_works=no"])
450 eval "ac_cv_c_gost_works=maybe"
454 AC_ARG_ENABLE(gost, AC_HELP_STRING([--disable-gost], [Disable GOST support]))
455 case "$enable_gost" in
459 if test "x$HAVE_SSL" != "xyes"; then
460 AC_MSG_ERROR([GOST enabled, but no SSL support])
462 AC_MSG_CHECKING(for GOST)
463 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])])
464 AC_CHECK_FUNC(EC_KEY_new, [], [AC_MSG_ERROR([No ECC functions found in OpenSSL: please upgrade OpenSSL or rerun with --disable-gost])])
466 AC_ARG_ENABLE(gost-anyway, AC_HELP_STRING([--enable-gost-anyway], [Enable GOST even whithout a GOST engine installed]))
467 if test "$ac_cv_c_gost_works" != "no" -o "$enable_gost_anyway" = "yes"; then
468 if test "$ac_cv_c_gost_works" = "no"; then
469 AC_MSG_RESULT([no, but compiling with GOST support anyway])
474 AC_DEFINE([USE_GOST], [1], [Define this to enable GOST support.])
477 AC_MSG_WARN([Gost support does not work because the engine is missing.])
478 AC_MSG_WARN([Install gost-engine first or use the --enable-gost-anyway to compile with GOST support anyway])
479 AC_MSG_WARN([See also https://github.com/gost-engine/engine/wiki for information about gost-engine])
484 AC_ARG_ENABLE(ecdsa, AC_HELP_STRING([--disable-ecdsa], [Disable ECDSA support]))
485 case "$enable_ecdsa" in
489 if test "x$HAVE_SSL" != "xyes"; then
490 AC_MSG_ERROR([ECDSA enabled, but no SSL support])
492 AC_CHECK_FUNC(ECDSA_sign, [], [AC_MSG_ERROR([OpenSSL does not support ECDSA: please upgrade OpenSSL or rerun with --disable-ecdsa])])
493 AC_CHECK_FUNC(SHA384_Init, [], [AC_MSG_ERROR([OpenSSL does not support SHA384: please upgrade OpenSSL or rerun with --disable-ecdsa])])
494 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
495 #include <openssl/evp.h>
497 # we now know we have ECDSA and the required curves.
498 AC_DEFINE_UNQUOTED([USE_ECDSA], [1], [Define this to enable ECDSA support.])
502 AC_ARG_ENABLE(dsa, AC_HELP_STRING([--disable-dsa], [Disable DSA support]))
503 case "$enable_dsa" in
507 # detect if DSA is supported, and turn it off if not.
508 AC_CHECK_FUNC(DSA_SIG_new, [
509 AC_DEFINE_UNQUOTED([USE_DSA], [1], [Define this to enable DSA support.])
510 ], [if test "x$enable_dsa" = "xyes"; then AC_MSG_ERROR([OpenSSL does not support DSA and you used --enable-dsa.])
515 AC_ARG_ENABLE(ed25519, AC_HELP_STRING([--enable-ed25519], [Enable ED25519 support (experimental)]))
516 case "$enable_ed25519" in
518 if test "x$HAVE_SSL" != "xyes"; then
519 AC_MSG_ERROR([ED25519 enabled, but no SSL support])
521 AC_CHECK_DECLS([NID_X25519], [], [AC_MSG_ERROR([OpenSSL does not support the EDDSA curve: please upgrade OpenSSL or rerun with --disable-ed25519])], [AC_INCLUDES_DEFAULT
522 #include <openssl/evp.h>
524 AC_DEFINE_UNQUOTED([USE_ED25519], [1], [Define this to enable ED25519 support.])
530 AC_ARG_ENABLE(ed448, AC_HELP_STRING([--enable-ed448], [Enable ED448 support (experimental)]))
531 case "$enable_ed448" in
533 if test "x$HAVE_SSL" != "xyes"; then
534 AC_MSG_ERROR([ED448 enabled, but no SSL support])
536 AC_CHECK_DECLS([NID_X448], [], [AC_MSG_ERROR([OpenSSL does not support the EDDSA curve: please upgrade OpenSSL or rerun with --disable-ed448])], [AC_INCLUDES_DEFAULT
537 #include <openssl/evp.h>
539 AC_DEFINE_UNQUOTED([USE_ED448], [1], [Define this to enable ED448 support.])
545 AC_ARG_ENABLE(dane, AC_HELP_STRING([--disable-dane], [Disable DANE support]))
546 AC_ARG_ENABLE(dane-verify, AC_HELP_STRING([--disable-dane-verify], [Disable DANE verify support]))
547 AC_ARG_ENABLE(dane-ta-usage, AC_HELP_STRING([--disable-dane-ta-usage], [Disable DANE-TA usage type support]))
549 AC_ARG_ENABLE(full-dane,, [
550 enable_dane_ta_usage=yes
551 enable_dane_verify=yes
554 AC_ARG_ENABLE(no-dane-ta-usage,, [
555 enable_dane_ta_usage=no
556 enable_dane_verify=yes
559 AC_ARG_ENABLE(no-dane-verify,, [
560 enable_dane_ta_usage=no
561 enable_dane_verify=no
564 case "$enable_dane" in
566 AC_SUBST(ldns_build_config_use_dane, 0)
567 AC_SUBST(ldns_build_config_use_dane_verify, 0)
568 AC_SUBST(ldns_build_config_use_dane_ta_usage, 0)
571 if test "x$HAVE_SSL" != "xyes"; then
572 AC_MSG_ERROR([DANE enabled, but no SSL support])
574 AC_CHECK_FUNC(X509_check_ca, [], [AC_MSG_ERROR([OpenSSL does not support DANE: please upgrade OpenSSL or rerun with --disable-dane])])
575 AC_SUBST(ldns_build_config_use_dane, 1)
576 AC_DEFINE_UNQUOTED([USE_DANE], [1], [Define this to enable DANE support.])
577 case "$enable_dane_verify" in
579 AC_SUBST(ldns_build_config_use_dane_verify, 0)
580 AC_SUBST(ldns_build_config_use_dane_ta_usage, 0)
583 AC_SUBST(ldns_build_config_use_dane_verify, 1)
584 AC_DEFINE_UNQUOTED([USE_DANE_VERIFY], [1], [Define this to enable DANE verify support.])
585 case "$enable_dane_ta_usage" in
587 AC_SUBST(ldns_build_config_use_dane_ta_usage, 0)
591 AC_CHECK_FUNC(SSL_get0_dane, [], [AC_MSG_ERROR([OpenSSL does not support offline DANE verification (Needed for the DANE-TA usage type). Please upgrade OpenSSL to version >= 1.1.0 or rerun with --disable-dane-verify or --disable-dane-ta-usage])])
592 LIBSSL_LIBS="$LIBSSL_LIBS -lssl"
593 AC_SUBST(ldns_build_config_use_dane_ta_usage, 1)
594 AC_DEFINE_UNQUOTED([USE_DANE_TA_USAGE], [1], [Define this to enable DANE-TA usage type support.])
601 AC_ARG_ENABLE(rrtype-ninfo, AC_HELP_STRING([--enable-rrtype-ninfo], [Enable draft RR type ninfo.]))
602 case "$enable_rrtype_ninfo" in
604 AC_DEFINE_UNQUOTED([RRTYPE_NINFO], [], [Define this to enable RR type NINFO.])
609 AC_ARG_ENABLE(rrtype-rkey, AC_HELP_STRING([--enable-rrtype-rkey], [Enable draft RR type rkey.]))
610 case "$enable_rrtype_rkey" in
612 AC_DEFINE_UNQUOTED([RRTYPE_RKEY], [], [Define this to enable RR type RKEY.])
617 AC_ARG_ENABLE(rrtype-openpgpkey, AC_HELP_STRING([--disable-rrtype-openpgpkey], [Disable openpgpkey RR type.]))
618 case "$enable_rrtype_openpgpkey" in
622 AC_DEFINE_UNQUOTED([RRTYPE_OPENPGPKEY], [], [Define this to enable RR type OPENPGPKEY.])
625 AC_ARG_ENABLE(rrtype-ta, AC_HELP_STRING([--enable-rrtype-ta], [Enable draft RR type ta.]))
626 case "$enable_rrtype_ta" in
628 AC_DEFINE_UNQUOTED([RRTYPE_TA], [], [Define this to enable RR type TA.])
633 AC_ARG_ENABLE(rrtype-avc, AC_HELP_STRING([--enable-rrtype-avc], [Enable draft RR type avc.]))
634 case "$enable_rrtype_avc" in
636 AC_DEFINE_UNQUOTED([RRTYPE_AVC], [], [Define this to enable RR type AVC.])
642 AC_SUBST(LIBSSL_CPPFLAGS)
643 AC_SUBST(LIBSSL_LDFLAGS)
644 AC_SUBST(LIBSSL_LIBS)
645 if test "x$HAVE_SSL" = "xyes"; then
646 AC_SUBST(LIBSSL_SSL_LIBS, ["-lssl $LIBSSL_LIBS"])
648 CPPFLAGS=$tmp_CPPFLAGS
653 # add option to disable the evil rpath
656 #AC_RUN_IFELSE([AC_LANG_SOURCE(
661 #char *cp = (char*)&one;
668 #AC_DEFINE(CONFCHECK_LITTLE_ENDIAN, 1, [system appears to be little-endian])
671 # should define WORDS_BIGENDIAN if the system is big-endian
674 # Checks for header files.
678 #AC_CHECK_HEADERS([getopt.h fcntl.h stdlib.h string.h strings.h unistd.h])
679 # do the very minimum - we can always extend this
680 AC_CHECK_HEADERS([getopt.h stdarg.h openssl/ssl.h netinet/in.h time.h arpa/inet.h netdb.h],,, [AC_INCLUDES_DEFAULT])
681 AC_CHECK_HEADERS(sys/param.h sys/mount.h,,,
685 # include <sys/param.h>
689 AC_CHECK_HEADER(sys/socket.h,
691 include_sys_socket_h='#include <sys/socket.h>'
692 AC_DEFINE(HAVE_SYS_SOCKET_H, 1, [define if you have sys/socket.h])
694 include_sys_socket_h=''
695 ],[AC_INCLUDES_DEFAULT
698 # include <sys/param.h>
702 AC_SUBST(include_sys_socket_h)
703 AC_CHECK_HEADER(inttypes.h,
705 include_inttypes_h='#include <inttypes.h>'
706 AC_DEFINE(HAVE_INTTYPES_H, 1, [define if you have inttypes.h])
707 AC_SUBST(ldns_build_config_have_inttypes_h, 1)
709 include_inttypes_h=''
710 AC_SUBST(ldns_build_config_have_inttypes_h, 0)
711 ],[AC_INCLUDES_DEFAULT
713 AC_SUBST(include_inttypes_h)
714 AC_CHECK_HEADER(sys/types.h,
716 include_systypes_h='#include <sys/types.h>'
717 AC_DEFINE(HAVE_SYS_TYPES_H, 1, [define if you have sys/types.h])
719 include_systypes_h=''
720 ],[AC_INCLUDES_DEFAULT
722 AC_SUBST(include_systypes_h)
723 AC_CHECK_HEADER(unistd.h,
725 include_unistd_h='#include <unistd.h>'
726 AC_DEFINE(HAVE_UNISTD_H, 1, [define if you have unistd.h])
729 ],[AC_INCLUDES_DEFAULT
731 AC_SUBST(include_unistd_h)
733 AC_CHECK_SIZEOF(time_t,,[
735 #ifdef TIME_WITH_SYS_TIME
736 # include <sys/time.h>
739 # ifdef HAVE_SYS_TIME_H
740 # include <sys/time.h>
747 if test x_$with_examples != x_no; then
748 AC_CHECK_HEADERS([pcap.h],,, [AC_INCLUDES_DEFAULT])
749 AC_CHECK_LIB(pcap, pcap_open_offline, [
750 AC_DEFINE([HAVE_LIBPCAP], [1], [Define to 1 if you have the `pcap' library (-lpcap).])dnl`
751 AC_SUBST([LIBPCAP_LIBS], [-lpcap])
753 AC_MSG_WARN([Can't find pcap library (needed for ldns-dpa, will not build dpa now.)])dnl'
754 AC_SUBST([LIBPCAP_LIBS], [])
757 AC_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],,, [
759 #ifdef HAVE_NETINET_IN_SYSTM_H
760 #include <netinet/in_systm.h>
762 #ifdef HAVE_NETINET_IN_H
763 #include <netinet/in.h>
765 #ifdef HAVE_SYS_SOCKET_H
766 #include <sys/socket.h>
774 if test "x$ac_cv_type_socklen_t" = xyes; then
775 AC_SUBST(ldns_build_config_have_socklen_t, 1)
777 AC_SUBST(ldns_build_config_have_socklen_t, 0)
780 AC_CHECK_TYPE(ssize_t, int)
781 dnl AC_TYPE_INTPTR_T does not work on all platforms (autoconf)
782 AC_CHECK_TYPE(intptr_t, size_t)
783 AC_CHECK_TYPE(in_addr_t, [], [AC_DEFINE([in_addr_t], [uint32_t], [in_addr_t])], [
785 # include <sys/types.h>
787 #if HAVE_NETINET_IN_H
788 # include <netinet/in.h>
790 AC_CHECK_TYPE(in_port_t, [], [AC_DEFINE([in_port_t], [uint16_t], [in_port_t])], [
792 # include <sys/types.h>
794 #if HAVE_NETINET_IN_H
795 # include <netinet/in.h>
802 AC_REPLACE_FUNCS(b64_pton)
803 AC_REPLACE_FUNCS(b64_ntop)
804 AC_REPLACE_FUNCS(calloc)
805 AC_REPLACE_FUNCS(timegm)
806 AC_REPLACE_FUNCS(gmtime_r)
807 AC_REPLACE_FUNCS(ctime_r)
808 AC_REPLACE_FUNCS(localtime_r)
809 AC_REPLACE_FUNCS(isblank)
810 AC_REPLACE_FUNCS(isascii)
811 AC_REPLACE_FUNCS(inet_aton)
812 AC_REPLACE_FUNCS(inet_pton)
813 AC_REPLACE_FUNCS(inet_ntop)
814 AC_REPLACE_FUNCS(snprintf)
815 AC_REPLACE_FUNCS(strlcpy)
816 AC_REPLACE_FUNCS(memmove)
818 AC_CHECK_FUNCS([endprotoent endservent sleep random fcntl strtoul bzero memset b32_ntop b32_pton])
819 if test "x$HAVE_B32_NTOP" = "xyes"; then
820 AC_SUBST(ldns_build_config_have_b32_ntop, 1)
822 AC_SUBST(ldns_build_config_have_b32_ntop, 0)
824 if test "x$HAVE_B32_PTON" = "xyes"; then
825 AC_SUBST(ldns_build_config_have_b32_pton, 1)
827 AC_SUBST(ldns_build_config_have_b32_pton, 0)
830 ACX_CHECK_GETADDRINFO_WITH_INCLUDES
831 if test $ac_cv_func_getaddrinfo = no; then
832 AC_LIBOBJ([fake-rfc2553])
834 if test "$USE_WINSOCK" = 1; then
835 AC_CHECK_TOOL(WINDRES, windres)
839 #AC_SEARCH_LIBS(RSA_new, [crypto])
841 ACX_CHECK_FORMAT_ATTRIBUTE
842 ACX_CHECK_UNUSED_ATTRIBUTE
844 # check OSX deployment target, if needed
845 if echo $build_os | grep darwin > /dev/null; then
846 sdk_p=`xcode-select -print-path`;
847 sdk_v="$( /usr/bin/xcrun --show-sdk-version )";
849 10.9|10.8) sdk_c="10.7";;
850 10.11|10.10|*) sdk_c="10.10";;
852 export MACOSX_DEPLOYMENT_TARGET="${sdk_c}";
853 export CFLAGS="$CFLAGS -mmacosx-version-min=${sdk_c} -isysroot ${sdk_p}/Platforms/MacOSX.platform/Developer/SDKs/MacOSX${sdk_v}.sdk";
856 AC_DEFINE([SYSCONFDIR], [sysconfdir], [System configuration dir])
858 AC_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]]), [
859 AC_SUBST([LDNS_TRUST_ANCHOR_FILE], ["$withval"])
860 AC_MSG_NOTICE([Default trust anchor: $withval])
862 AC_SUBST([LDNS_TRUST_ANCHOR_FILE], ["\$(sysconfdir)/unbound/root.key"])
865 AC_ARG_WITH(ca-file, AC_HELP_STRING([--with-ca-file=CAFILE], [File containing CA certificates for ldns-dane]), [
866 AC_DEFINE([HAVE_DANE_CA_FILE], [1], [Is a CAFILE given at configure time])
867 AC_DEFINE_UNQUOTED([LDNS_DANE_CA_FILE], ["$withval"], [Is a CAFILE given at configure time])
868 AC_MSG_NOTICE([Using CAfile: $withval])
869 AC_SUBST(DEFAULT_CAFILE, ["Default is $withval"])
871 AC_DEFINE([HAVE_DANE_CA_FILE], [0], [Is a CAFILE given at configure time])
872 AC_SUBST(DEFAULT_CAFILE, [])
875 AC_ARG_WITH(ca-path, AC_HELP_STRING([--with-ca-path=CAPATH], [Directory containing CA certificate files for ldns-dane]), [
876 AC_DEFINE([HAVE_DANE_CA_PATH], [1], [Is a CAPATH given at configure time])
877 AC_DEFINE_UNQUOTED([LDNS_DANE_CA_PATH], ["$withval"], [Is a CAPATH given at configure time])
878 AC_MSG_NOTICE([Using CApath: $withval])
879 AC_SUBST(DEFAULT_CAPATH, ["Default is $withval"])
881 AC_DEFINE([HAVE_DANE_CA_PATH], [0], [Is a CAPATH given at configure time])
882 AC_SUBST(DEFAULT_CAPATH, [])
891 #ifndef LITTLE_ENDIAN
892 #define LITTLE_ENDIAN 1234
896 #define BIG_ENDIAN 4321
900 #ifdef WORDS_BIGENDIAN
901 #define BYTE_ORDER BIG_ENDIAN
903 #define BYTE_ORDER LITTLE_ENDIAN
904 #endif /* WORDS_BIGENDIAN */
905 #endif /* BYTE_ORDER */
916 #ifdef HAVE_SYS_SOCKET_H
917 #include <sys/socket.h>
920 #ifdef HAVE_NETINET_IN_H
921 #include <netinet/in.h>
924 #ifdef HAVE_ARPA_INET_H
925 #include <arpa/inet.h>
928 #ifdef HAVE_WINSOCK2_H
929 #include <winsock2.h>
932 #ifdef HAVE_WS2TCPIP_H
933 #include <ws2tcpip.h>
936 AHX_CONFIG_W32_FD_SET_T
944 int ldns_b64_ntop(uint8_t const *src, size_t srclength,
945 char *target, size_t targsize);
947 * calculates the size needed to store the result of b64_ntop
950 static inline size_t ldns_b64_ntop_calculate_size(size_t srcsize)
952 return ((((srcsize + 2) / 3) * 4) + 1);
954 int ldns_b64_pton(char const *src, uint8_t *target, size_t targsize);
956 * calculates the size needed to store the result of ldns_b64_pton
959 static inline size_t ldns_b64_pton_calculate_size(size_t srcsize)
961 return (((((srcsize + 3) / 4) * 3)) + 1);
965 * Given in dnssec_zone.c, also used in dnssec_sign.c:w
968 int ldns_dname_compare_v(const void *a, const void *b);
971 /* use windows sleep, in millisecs, instead */
972 #define sleep(x) Sleep((x)*1000)
976 #define srandom(x) srand(x)
977 #define random(x) rand(x)
982 time_t timegm (struct tm *tm);
984 #ifndef HAVE_GMTIME_R
985 struct tm *gmtime_r(const time_t *timep, struct tm *result);
987 #ifndef HAVE_LOCALTIME_R
988 struct tm *localtime_r(const time_t *timep, struct tm *result);
992 #endif /* !HAVE_ISBLANK */
995 #endif /* !HAVE_ISASCII */
996 #ifndef HAVE_SNPRINTF
998 int snprintf (char *str, size_t count, const char *fmt, ...);
999 int vsnprintf (char *str, size_t count, const char *fmt, va_list arg);
1000 #endif /* HAVE_SNPRINTF */
1001 #ifndef HAVE_INET_PTON
1002 int inet_pton(int af, const char* src, void* dst);
1003 #endif /* HAVE_INET_PTON */
1004 #ifndef HAVE_INET_NTOP
1005 const char *inet_ntop(int af, const void *src, char *dst, size_t size);
1007 #ifndef HAVE_INET_ATON
1008 int inet_aton(const char *cp, struct in_addr *addr);
1010 #ifndef HAVE_MEMMOVE
1011 void *memmove(void *dest, const void *src, size_t n);
1013 #ifndef HAVE_STRLCPY
1014 size_t strlcpy(char *dst, const char *src, size_t siz);
1018 #define SOCK_INVALID INVALID_SOCKET
1019 #define close_socket(_s) do { if (_s > SOCK_INVALID) {closesocket(_s); _s = SOCK_INVALID;} } while(0)
1021 #define SOCK_INVALID -1
1022 #define close_socket(_s) do { if (_s > SOCK_INVALID) {close(_s); _s = SOCK_INVALID;} } while(0)
1028 #ifndef HAVE_GETADDRINFO
1029 #include "compat/fake-rfc2553.h"
1031 #ifndef HAVE_STRTOUL
1032 #define strtoul (unsigned long)strtol
1036 if test "x$HAVE_SSL" = "xyes"; then
1037 AC_SUBST(ldns_build_config_have_ssl, 1)
1039 AC_SUBST(ldns_build_config_have_ssl, 0)
1041 if test "x$ac_cv_c_format_attribute" = "xyes"; then
1042 AC_SUBST(ldns_build_config_have_attr_format, 1)
1044 AC_SUBST(ldns_build_config_have_attr_format, 0)
1046 if test "x$ac_cv_c_unused_attribute" = "xyes"; then
1047 AC_SUBST(ldns_build_config_have_attr_unused, 1)
1049 AC_SUBST(ldns_build_config_have_attr_unused, 0)
1052 CONFIG_FILES="Makefile ldns/common.h ldns/net.h ldns/util.h packaging/libldns.pc packaging/ldns-config"
1053 AC_SUBST(CONFIG_FILES)
1054 AC_CONFIG_FILES([$CONFIG_FILES])
1056 AC_CONFIG_HEADER([ldns/config.h])
1058 COPY_HEADER_FILES(ldns/, ldns/)
1060 dnl AC_CONFIG_SUBDIRS([drill])