2 # Process this file with autoconf to produce a configure script.
4 sinclude(acx_nlnetlabs.m4)
5 sinclude(ax_pthread.m4)
6 sinclude(acx_python.m4)
7 sinclude(ac_pkg_swig.m4)
8 sinclude(dnstap/dnstap.m4)
10 # must be numbers. ac_defun because of later processing
11 m4_define([VERSION_MAJOR],[1])
12 m4_define([VERSION_MINOR],[5])
13 m4_define([VERSION_MICRO],[3])
14 AC_INIT(unbound, m4_defn([VERSION_MAJOR]).m4_defn([VERSION_MINOR]).m4_defn([VERSION_MICRO]), unbound-bugs@nlnetlabs.nl, unbound)
15 AC_SUBST(UNBOUND_VERSION_MAJOR, [VERSION_MAJOR])
16 AC_SUBST(UNBOUND_VERSION_MINOR, [VERSION_MINOR])
17 AC_SUBST(UNBOUND_VERSION_MICRO, [VERSION_MICRO])
29 # 1.3.0 had 1:0:0 # ub_cancel and -export-symbols.
34 # 1.4.0-snapshots had 1:5:0
35 # 1.4.0 had 1:5:0 (not 2:0:0) # ub_result.why_bogus
49 # and 1.4.13p1 and 1.4.13.p2
51 # 1.4.15 had 3:0:1 # adds ub_version()
56 # 1.4.20 had 4:0:2 # adds libunbound.ttl # but shipped 3:5:1
59 # 1.5.0 had 5:3:3 # adds ub_ctx_add_ta_autr
64 # Current -- the number of the binary API that we're implementing
65 # Revision -- which iteration of the implementation of the binary
66 # API are we supplying?
67 # Age -- How many previous binary API versions do we also
70 # If we release a new version that does not change the binary API,
73 # If we release a new version that changes the binary API, but does
74 # not break programs compiled against the old binary API, increment
75 # Current and Age. Set Revision to 0, since this is the first
76 # implementation of the new API.
78 # Otherwise, we're changing the binary API and breaking bakward
79 # compatibility with old binaries. Increment Current. Set Age to 0,
80 # since we're backward compatible with no previous APIs. Set Revision
82 AC_SUBST(LIBUNBOUND_CURRENT)
83 AC_SUBST(LIBUNBOUND_REVISION)
84 AC_SUBST(LIBUNBOUND_AGE)
88 if test "$ac_cv_header_minix_config_h" = "yes"; then
89 AC_DEFINE(_NETBSD_SOURCE,1, [Enable for compile on Minix])
93 dnl By default set prefix to /usr/local
102 if uname -s 2>&1 | grep MINGW32 >/dev/null; then on_mingw="yes"
104 if echo $target | grep mingw32 >/dev/null; then on_mingw="yes"
105 else on_mingw="no"; fi
109 # Determine configuration file
110 # the eval is to evaluate shell expansion twice
111 if test $on_mingw = "no"; then
112 ub_conf_file=`eval echo "${sysconfdir}/unbound/unbound.conf"`
114 ub_conf_file="C:\\Program Files\\Unbound\\service.conf"
116 AC_ARG_WITH([conf_file],
117 AC_HELP_STRING([--with-conf-file=path],
118 [Pathname to the Unbound configuration file]),
119 [ub_conf_file="$withval"])
120 AC_SUBST(ub_conf_file)
121 ACX_ESCAPE_BACKSLASH($ub_conf_file, hdr_config)
122 AC_DEFINE_UNQUOTED(CONFIGFILE, ["$hdr_config"], [Pathname to the Unbound configuration file])
123 ub_conf_dir=`AS_DIRNAME(["$ub_conf_file"])`
124 AC_SUBST(ub_conf_dir)
126 # Determine run, chroot directory and pidfile locations
128 AC_HELP_STRING([--with-run-dir=path],
129 [set default directory to chdir to (by default dir part of cfg file)]),
130 UNBOUND_RUN_DIR="$withval",
131 if test $on_mingw = no; then
132 UNBOUND_RUN_DIR=`dirname "$ub_conf_file"`
137 AC_SUBST(UNBOUND_RUN_DIR)
138 ACX_ESCAPE_BACKSLASH($UNBOUND_RUN_DIR, hdr_run)
139 AC_DEFINE_UNQUOTED(RUN_DIR, ["$hdr_run"], [Directory to chdir to])
141 AC_ARG_WITH(chroot-dir,
142 AC_HELP_STRING([--with-chroot-dir=path],
143 [set default directory to chroot to (by default same as run-dir)]),
144 UNBOUND_CHROOT_DIR="$withval",
145 if test $on_mingw = no; then
146 UNBOUND_CHROOT_DIR="$UNBOUND_RUN_DIR"
148 UNBOUND_CHROOT_DIR=""
151 AC_SUBST(UNBOUND_CHROOT_DIR)
152 ACX_ESCAPE_BACKSLASH($UNBOUND_CHROOT_DIR, hdr_chroot)
153 AC_DEFINE_UNQUOTED(CHROOT_DIR, ["$hdr_chroot"], [Directory to chroot to])
155 AC_ARG_WITH(share-dir,
156 AC_HELP_STRING([--with-share-dir=path],
157 [set default directory with shared data (by default same as share/unbound)]),
158 UNBOUND_SHARE_DIR="$withval",
159 UNBOUND_SHARE_DIR="$UNBOUND_RUN_DIR")
160 AC_SUBST(UNBOUND_SHARE_DIR)
161 AC_DEFINE_UNQUOTED(SHARE_DIR, ["$UNBOUND_SHARE_DIR"], [Shared data])
164 AC_HELP_STRING([--with-pidfile=filename],
165 [set default pathname to unbound pidfile (default run-dir/unbound.pid)]),
166 UNBOUND_PIDFILE="$withval",
167 if test $on_mingw = no; then
168 UNBOUND_PIDFILE="$UNBOUND_RUN_DIR/unbound.pid"
173 AC_SUBST(UNBOUND_PIDFILE)
174 ACX_ESCAPE_BACKSLASH($UNBOUND_PIDFILE, hdr_pid)
175 AC_DEFINE_UNQUOTED(PIDFILE, ["$hdr_pid"], [default pidfile location])
177 AC_ARG_WITH(rootkey-file,
178 AC_HELP_STRING([--with-rootkey-file=filename],
179 [set default pathname to root key file (default run-dir/root.key). This file is read and written.]),
180 UNBOUND_ROOTKEY_FILE="$withval",
181 if test $on_mingw = no; then
182 UNBOUND_ROOTKEY_FILE="$UNBOUND_RUN_DIR/root.key"
184 UNBOUND_ROOTKEY_FILE="C:\\Program Files\\Unbound\\root.key"
187 AC_SUBST(UNBOUND_ROOTKEY_FILE)
188 ACX_ESCAPE_BACKSLASH($UNBOUND_ROOTKEY_FILE, hdr_rkey)
189 AC_DEFINE_UNQUOTED(ROOT_ANCHOR_FILE, ["$hdr_rkey"], [default rootkey location])
191 AC_ARG_WITH(rootcert-file,
192 AC_HELP_STRING([--with-rootcert-file=filename],
193 [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.]),
194 UNBOUND_ROOTCERT_FILE="$withval",
195 if test $on_mingw = no; then
196 UNBOUND_ROOTCERT_FILE="$UNBOUND_RUN_DIR/icannbundle.pem"
198 UNBOUND_ROOTCERT_FILE="C:\\Program Files\\Unbound\\icannbundle.pem"
201 AC_SUBST(UNBOUND_ROOTCERT_FILE)
202 ACX_ESCAPE_BACKSLASH($UNBOUND_ROOTCERT_FILE, hdr_rpem)
203 AC_DEFINE_UNQUOTED(ROOT_CERT_FILE, ["$hdr_rpem"], [default rootcert location])
205 AC_ARG_WITH(username,
206 AC_HELP_STRING([--with-username=user],
207 [set default user that unbound changes to (default user is unbound)]),
208 UNBOUND_USERNAME="$withval",
209 UNBOUND_USERNAME="unbound")
210 AC_SUBST(UNBOUND_USERNAME)
211 AC_DEFINE_UNQUOTED(UB_USERNAME, ["$UNBOUND_USERNAME"], [default username])
213 AC_DEFINE(WINVER, 0x0502, [the version of the windows API enabled])
214 ACX_RSRC_VERSION(wnvs)
215 AC_DEFINE_UNQUOTED(RSRC_PACKAGE_VERSION, [$wnvs], [version number for resource files])
217 # Checks for typedefs, structures, and compiler characteristics.
220 # allow user to override the -g -O2 flags.
221 if test "x$CFLAGS" = "x" ; then
222 ACX_CHECK_COMPILER_FLAG(g, [CFLAGS="$CFLAGS -g"])
223 ACX_CHECK_COMPILER_FLAG(O2, [CFLAGS="$CFLAGS -O2"])
227 ACX_DETERMINE_EXT_FLAGS_UNBOUND
229 # debug mode flags warnings
230 AC_ARG_ENABLE(checking, AC_HELP_STRING([--enable-checking], [Enable warnings, asserts, makefile-dependencies]))
231 AC_ARG_ENABLE(debug, AC_HELP_STRING([--enable-debug], [same as enable-checking]))
232 if test "$enable_debug" = "yes"; then debug_enabled="$enable_debug";
233 else debug_enabled="$enable_checking"; fi
234 AC_SUBST(debug_enabled)
235 case "$debug_enabled" in
237 ACX_CHECK_COMPILER_FLAG(W, [CFLAGS="$CFLAGS -W"])
238 ACX_CHECK_COMPILER_FLAG(Wall, [CFLAGS="$CFLAGS -Wall"])
239 ACX_CHECK_COMPILER_FLAG(Wextra, [CFLAGS="$CFLAGS -Wextra"])
240 ACX_CHECK_COMPILER_FLAG(Wdeclaration-after-statement, [CFLAGS="$CFLAGS -Wdeclaration-after-statement"])
241 AC_DEFINE([UNBOUND_DEBUG], [], [define this to enable debug checks.])
250 ACX_CHECK_FORMAT_ATTRIBUTE
251 ACX_CHECK_UNUSED_ATTRIBUTE
253 if test "$srcdir" != "."; then
254 CPPFLAGS="$CPPFLAGS -I$srcdir"
257 AC_DEFUN([ACX_YYLEX_DESTROY], [
258 AC_MSG_CHECKING([for yylex_destroy])
259 if echo %% | $LEX -t 2>&1 | grep yylex_destroy >/dev/null 2>&1; then
260 AC_DEFINE(LEX_HAS_YYLEX_DESTROY, 1, [if lex has yylex_destroy])
262 else AC_MSG_RESULT(no); fi
268 AC_CHECK_PROG(doxygen, doxygen, doxygen)
269 AC_CHECK_TOOL(STRIP, strip)
272 # Checks for header files.
273 AC_CHECK_HEADERS([stdarg.h stdbool.h netinet/in.h sys/param.h sys/socket.h sys/un.h sys/uio.h sys/resource.h arpa/inet.h syslog.h netdb.h sys/wait.h pwd.h glob.h grp.h login_cap.h winsock2.h ws2tcpip.h endian.h],,, [AC_INCLUDES_DEFAULT])
276 # Using own tests for int64* because autoconf builtin only give 32bit.
277 AC_CHECK_TYPE(int8_t, signed char)
278 AC_CHECK_TYPE(int16_t, short)
279 AC_CHECK_TYPE(int32_t, int)
280 AC_CHECK_TYPE(int64_t, long long)
281 AC_CHECK_TYPE(uint8_t, unsigned char)
282 AC_CHECK_TYPE(uint16_t, unsigned short)
283 AC_CHECK_TYPE(uint32_t, unsigned int)
284 AC_CHECK_TYPE(uint64_t, unsigned long long)
286 AC_CHECK_TYPE(ssize_t, int)
295 ACX_CHECK_MEMCMP_SIGNED
297 AC_CHECK_SIZEOF(time_t,,[
299 #ifdef TIME_WITH_SYS_TIME
300 # include <sys/time.h>
303 # ifdef HAVE_SYS_TIME_H
304 # include <sys/time.h>
311 # add option to disable the evil rpath
313 AC_SUBST(RUNTIME_PATH)
315 # check to see if libraries are needed for these functions.
316 AC_SEARCH_LIBS([inet_pton], [nsl])
317 AC_SEARCH_LIBS([socket], [socket])
319 # check wether strptime also works
320 AC_DEFUN([AC_CHECK_STRPTIME_WORKS],
321 [AC_REQUIRE([AC_PROG_CC])
322 AC_MSG_CHECKING(whether strptime works)
323 if test c${cross_compiling} = cno; then
324 AC_RUN_IFELSE([AC_LANG_SOURCE([[
325 #define _XOPEN_SOURCE 600
327 int main(void) { struct tm tm; char *res;
328 res = strptime("2010-07-15T00:00:00+00:00", "%t%Y%t-%t%m%t-%t%d%tT%t%H%t:%t%M%t:%t%S%t", &tm);
330 res = strptime("20070207111842", "%Y%m%d%H%M%S", &tm);
331 if (!res) return 1; return 0; }
332 ]])] , [eval "ac_cv_c_strptime_works=yes"], [eval "ac_cv_c_strptime_works=no"])
334 eval "ac_cv_c_strptime_works=maybe"
336 AC_MSG_RESULT($ac_cv_c_strptime_works)
337 if test $ac_cv_c_strptime_works = no; then
340 AC_DEFINE_UNQUOTED([STRPTIME_WORKS], 1, [use default strptime.])
344 # check some functions of the OS before linking libs (while still runnable).
350 ACX_CHECK_NONBLOCKING_BROKEN
352 AC_CHECK_FUNCS([strptime],[AC_CHECK_STRPTIME_WORKS],[AC_LIBOBJ([strptime])])
354 # set memory allocation checking if requested
355 AC_ARG_ENABLE(alloc-checks, AC_HELP_STRING([--enable-alloc-checks],
356 [ enable to memory allocation statistics, for debug purposes ]),
358 AC_ARG_ENABLE(alloc-lite, AC_HELP_STRING([--enable-alloc-lite],
359 [ enable for lightweight alloc assertions, for debug purposes ]),
361 AC_ARG_ENABLE(alloc-nonregional, AC_HELP_STRING([--enable-alloc-nonregional],
362 [ enable nonregional allocs, slow but exposes regional allocations to other memory purifiers, for debug purposes ]),
364 if test x_$enable_alloc_nonregional = x_yes; then
365 AC_DEFINE(UNBOUND_ALLOC_NONREGIONAL, 1, [use malloc not regions, for debug use])
367 if test x_$enable_alloc_checks = x_yes; then
368 AC_DEFINE(UNBOUND_ALLOC_STATS, 1, [use statistics for allocs and frees, for debug use])
370 if test x_$enable_alloc_lite = x_yes; then
371 AC_DEFINE(UNBOUND_ALLOC_LITE, 1, [use to enable lightweight alloc assertions, for debug use])
373 ACX_FUNC_MALLOC([unbound])
377 # check windows threads (we use them, not pthreads, on windows).
378 if test "$on_mingw" = "yes"; then
379 # check windows threads
380 AC_CHECK_HEADERS([windows.h],,, [AC_INCLUDES_DEFAULT])
381 AC_MSG_CHECKING([for CreateThread])
382 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([
383 #ifdef HAVE_WINDOWS_H
387 HANDLE t = CreateThread(NULL, 0, NULL, NULL, 0, NULL);
390 AC_DEFINE(HAVE_WINDOWS_THREADS, 1, [Using Windows threads])
396 # not on mingw, check thread libraries.
398 # check for thread library.
399 # check this first, so that the pthread lib does not get linked in via
400 # libssl or libpython, and thus distorts the tests, and we end up using
401 # the non-threadsafe C libraries.
402 AC_ARG_WITH(pthreads, AC_HELP_STRING([--with-pthreads],
403 [use pthreads library, or --without-pthreads to disable threading support.]),
404 [ ],[ withval="yes" ])
406 if test x_$withval != x_no; then
408 AC_DEFINE(HAVE_PTHREAD,1,[Define if you have POSIX threads libraries and header files.])
409 LIBS="$PTHREAD_LIBS $LIBS"
410 CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
413 AC_CHECK_TYPES([pthread_spinlock_t, pthread_rwlock_t],,,[#include <pthread.h>])
417 # check solaris thread library
418 AC_ARG_WITH(solaris-threads, AC_HELP_STRING([--with-solaris-threads],
419 [use solaris native thread library.]), [ ],[ withval="no" ])
420 ub_have_sol_threads=no
421 if test x_$withval != x_no; then
422 if test x_$ub_have_pthreads != x_no; then
423 AC_WARN([Have pthreads already, ignoring --with-solaris-threads])
425 AC_SEARCH_LIBS(thr_create, [thread],
427 AC_DEFINE(HAVE_SOLARIS_THREADS, 1, [Using Solaris threads])
429 ACX_CHECK_COMPILER_FLAG(mt, [CFLAGS="$CFLAGS -mt"],
430 [CFLAGS="$CFLAGS -D_REENTRANT"])
431 ub_have_sol_threads=yes
433 AC_ERROR([no solaris threads found.])
438 fi # end of non-mingw check of thread libraries
440 # Check for PyUnbound
441 AC_ARG_WITH(pyunbound,
442 AC_HELP_STRING([--with-pyunbound],
443 [build PyUnbound, or --without-pyunbound to skip it. (default=no)]),
444 [], [ withval="no" ])
448 if test x_$withval != x_no; then
449 ub_with_pyunbound=yes
453 # Check for Python module
454 AC_ARG_WITH(pythonmodule,
455 AC_HELP_STRING([--with-pythonmodule],
456 [build Python module, or --without-pythonmodule to disable script engine. (default=no)]),
457 [], [ withval="no" ])
460 if test x_$withval != x_no; then
461 ub_with_pythonmod=yes
465 # Check for Python & SWIG only on PyUnbound or PyModule
466 if test x_$ub_test_python != x_no; then
470 ac_save_LIBS="$LIBS" dnl otherwise AC_PYTHON_DEVEL thrashes $LIBS
472 if test ! -z "$PYTHON_VERSION"; then
473 if test `$PYTHON -c "print('$PYTHON_VERSION' >= '2.4.0')"` = "False"; then
474 AC_ERROR([Python version >= 2.4.0 is required])
478 AC_DEFINE(HAVE_PYTHON,1,[Define if you have Python libraries and header files.])
479 LIBS="$PYTHON_LDFLAGS $LIBS"
480 CPPFLAGS="$CPPFLAGS $PYTHON_CPPFLAGS"
486 AC_MSG_CHECKING(SWIG)
487 if test ! -x "$SWIG"; then
488 AC_ERROR([failed to find swig tool, install it, or do not build Python module and PyUnbound])
490 AC_DEFINE(HAVE_SWIG, 1, [Define if you have Swig libraries and header files.])
491 AC_SUBST(swig, "$SWIG")
492 AC_MSG_RESULT(present)
494 # If have Python & SWIG
496 if test x_$ub_with_pythonmod != x_no; then
497 AC_DEFINE(WITH_PYTHONMODULE, 1, [Define if you want Python module.])
498 WITH_PYTHONMODULE=yes
499 AC_SUBST(WITH_PYTHONMODULE)
500 PYTHONMOD_OBJ="pythonmod.lo pythonmod_utils.lo"
501 AC_SUBST(PYTHONMOD_OBJ)
502 PYTHONMOD_HEADER='$(srcdir)/pythonmod/pythonmod.h'
503 AC_SUBST(PYTHONMOD_HEADER)
504 PYTHONMOD_INSTALL=pythonmod-install
505 AC_SUBST(PYTHONMOD_INSTALL)
506 PYTHONMOD_UNINSTALL=pythonmod-uninstall
507 AC_SUBST(PYTHONMOD_UNINSTALL)
511 if test x_$ub_with_pyunbound != x_no; then
512 AC_DEFINE(WITH_PYUNBOUND, 1, [Define if you want PyUnbound.])
514 AC_SUBST(WITH_PYUNBOUND)
515 PYUNBOUND_OBJ="libunbound_wrap.lo"
516 AC_SUBST(PYUNBOUND_OBJ)
517 PYUNBOUND_TARGET="_unbound.la"
518 AC_SUBST(PYUNBOUND_TARGET)
519 PYUNBOUND_INSTALL=pyunbound-install
520 AC_SUBST(PYUNBOUND_INSTALL)
521 PYUNBOUND_UNINSTALL=pyunbound-uninstall
522 AC_SUBST(PYUNBOUND_UNINSTALL)
526 AC_MSG_RESULT([*** Python libraries not found, won't build PythonMod or PyUnbound ***])
532 if test "`uname`" = "NetBSD"; then
533 NETBSD_LINTFLAGS='"-D__RENAME(x)=" -D_NETINET_IN_H_'
534 AC_SUBST(NETBSD_LINTFLAGS)
536 CONFIG_DATE=`date +%Y%m%d`
537 AC_SUBST(CONFIG_DATE)
539 # Checks for libraries.
543 AC_ARG_WITH([nss], AC_HELP_STRING([--with-nss=path],
544 [use libnss instead of openssl, installed at path.]),
547 AC_DEFINE(HAVE_NSS, 1, [Use libnss for crypto])
548 if test "$withval" != "" -a "$withval" != "yes"; then
549 CPPFLAGS="$CPPFLAGS -I$withval/include/nss3"
550 LDFLAGS="$LDFLAGS -L$withval/lib"
551 ACX_RUNTIME_PATH_ADD([$withval/lib])
552 CPPFLAGS="-I$withval/include/nspr4 $CPPFLAGS"
554 CPPFLAGS="$CPPFLAGS -I/usr/include/nss3"
555 CPPFLAGS="-I/usr/include/nspr4 $CPPFLAGS"
557 LIBS="$LIBS -lnss3 -lnspr4"
562 if test $USE_NSS = "no"; then
565 AC_MSG_CHECKING([for LibreSSL])
566 if grep OPENSSL_VERSION_TEXT $ssldir/include/openssl/opensslv.h | grep "LibreSSL" >/dev/null; then
568 AC_DEFINE([HAVE_LIBRESSL], [1], [Define if we have LibreSSL])
569 # libressl provides these compat functions, but they may also be
570 # declared by the OS in libc. See if they have been declared.
571 AC_CHECK_DECLS([strlcpy,strlcat,arc4random,arc4random_uniform])
575 AC_CHECK_HEADERS([openssl/conf.h],,, [AC_INCLUDES_DEFAULT])
576 AC_CHECK_HEADERS([openssl/engine.h],,, [AC_INCLUDES_DEFAULT])
577 AC_CHECK_FUNCS([OPENSSL_config EVP_sha1 EVP_sha256 EVP_sha512 FIPS_mode])
578 AC_CHECK_DECLS([SSL_COMP_get_compression_methods,sk_SSL_COMP_pop_free], [], [], [
580 #ifdef HAVE_OPENSSL_ERR_H
581 #include <openssl/err.h>
584 #ifdef HAVE_OPENSSL_RAND_H
585 #include <openssl/rand.h>
588 #ifdef HAVE_OPENSSL_CONF_H
589 #include <openssl/conf.h>
592 #ifdef HAVE_OPENSSL_ENGINE_H
593 #include <openssl/engine.h>
595 #include <openssl/ssl.h>
596 #include <openssl/evp.h>
601 AC_ARG_ENABLE(sha2, AC_HELP_STRING([--disable-sha2], [Disable SHA256 and SHA512 RRSIG support]))
602 case "$enable_sha2" in
606 AC_DEFINE([USE_SHA2], [1], [Define this to enable SHA256 and SHA512 support.])
610 # check wether gost also works
611 AC_DEFUN([AC_CHECK_GOST_WORKS],
612 [AC_REQUIRE([AC_PROG_CC])
613 AC_MSG_CHECKING([if GOST works])
614 if test c${cross_compiling} = cno; then
616 if test -n "$ssldir"; then
617 CFLAGS="$CFLAGS -Wl,-rpath,$ssldir/lib"
619 AC_RUN_IFELSE([AC_LANG_SOURCE([[
621 #include <openssl/ssl.h>
622 #include <openssl/evp.h>
623 #include <openssl/engine.h>
624 #include <openssl/conf.h>
625 /* routine to load gost (from sldns) */
626 int load_gost_id(void)
628 static int gost_id = 0;
629 const EVP_PKEY_ASN1_METHOD* meth;
632 if(gost_id) return gost_id;
634 /* see if configuration loaded gost implementation from other engine*/
635 meth = EVP_PKEY_asn1_find_str(NULL, "gost2001", -1);
637 EVP_PKEY_asn1_get0_info(&gost_id, NULL, NULL, NULL, NULL, meth);
641 /* see if engine can be loaded already */
642 e = ENGINE_by_id("gost");
644 /* load it ourself, in case statically linked */
645 ENGINE_load_builtin_engines();
646 ENGINE_load_dynamic();
647 e = ENGINE_by_id("gost");
650 /* no gost engine in openssl */
653 if(!ENGINE_set_default(e, ENGINE_METHOD_ALL)) {
659 meth = EVP_PKEY_asn1_find_str(&e, "gost2001", -1);
666 EVP_PKEY_asn1_get0_info(&gost_id, NULL, NULL, NULL, NULL, meth);
672 unsigned char digest[64]; /* its a 256-bit digest, so uses 32 bytes */
673 const char* str = "Hello world";
674 const unsigned char check[] = {
675 0x40 , 0xed , 0xf8 , 0x56 , 0x5a , 0xc5 , 0x36 , 0xe1 ,
676 0x33 , 0x7c , 0x7e , 0x87 , 0x62 , 0x1c , 0x42 , 0xe0 ,
677 0x17 , 0x1b , 0x5e , 0xce , 0xa8 , 0x46 , 0x65 , 0x4d ,
678 0x8d , 0x3e , 0x22 , 0x9b , 0xe1 , 0x30 , 0x19 , 0x9d
680 OPENSSL_config(NULL);
681 (void)load_gost_id();
682 md = EVP_get_digestbyname("md_gost94");
684 memset(digest, 0, sizeof(digest));
685 ctx = EVP_MD_CTX_create();
687 if(!EVP_DigestInit_ex(ctx, md, NULL)) return 3;
688 if(!EVP_DigestUpdate(ctx, str, 10)) return 4;
689 if(!EVP_DigestFinal_ex(ctx, digest, NULL)) return 5;
690 /* uncomment to see the hash calculated.
693 printf(" %2.2x", (int)digest[i]);
696 if(memcmp(digest, check, sizeof(check)) != 0)
700 ]])] , [eval "ac_cv_c_gost_works=yes"], [eval "ac_cv_c_gost_works=no"])
703 eval "ac_cv_c_gost_works=maybe"
705 AC_MSG_RESULT($ac_cv_c_gost_works)
708 AC_ARG_ENABLE(gost, AC_HELP_STRING([--disable-gost], [Disable GOST support]))
710 if test $USE_NSS = "no"; then
711 case "$enable_gost" in
715 AC_CHECK_FUNC(EVP_PKEY_set_type_str, [:],[AC_MSG_ERROR([OpenSSL 1.0.0 is needed for GOST support])])
716 AC_CHECK_FUNC(EC_KEY_new, [], [AC_MSG_ERROR([OpenSSL does not support ECC, needed for GOST support])])
718 if test "$ac_cv_c_gost_works" != no; then
720 AC_DEFINE([USE_GOST], [1], [Define this to enable GOST support.])
726 AC_ARG_ENABLE(ecdsa, AC_HELP_STRING([--disable-ecdsa], [Disable ECDSA support]))
728 case "$enable_ecdsa" in
732 if test $USE_NSS = "no"; then
733 AC_CHECK_FUNC(ECDSA_sign, [], [AC_MSG_ERROR([OpenSSL does not support ECDSA: please upgrade or rerun with --disable-ecdsa])])
734 AC_CHECK_FUNC(SHA384_Init, [], [AC_MSG_ERROR([OpenSSL does not support SHA384: please upgrade or rerun with --disable-ecdsa])])
735 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
736 #include <openssl/evp.h>
738 # see if OPENSSL 1.0.0 or later (has EVP MD and Verify independency)
739 AC_MSG_CHECKING([if openssl supports SHA2 and ECDSA with EVP])
740 if grep OPENSSL_VERSION_TEXT $ssldir/include/openssl/opensslv.h | grep "OpenSSL" >/dev/null; then
741 if grep OPENSSL_VERSION_NUMBER $ssldir/include/openssl/opensslv.h | grep 0x0 >/dev/null; then
743 AC_DEFINE_UNQUOTED([USE_ECDSA_EVP_WORKAROUND], [1], [Define this to enable an EVP workaround for older openssl])
748 # not OpenSSL, thus likely LibreSSL, which supports it
752 # we now know we have ECDSA and the required curves.
753 AC_DEFINE_UNQUOTED([USE_ECDSA], [1], [Define this to enable ECDSA support.])
758 AC_ARG_ENABLE(event-api, AC_HELP_STRING([--enable-event-api], [Enable (experimental) libevent-based libunbound API installed to unbound-event.h]))
759 use_unbound_event="no"
760 case "$enable_event_api" in
762 use_unbound_event="yes"
769 AC_ARG_WITH(libevent, AC_HELP_STRING([--with-libevent=pathname],
770 [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.]),
771 [ ],[ withval="no" ])
772 if test x_$withval = x_yes -o x_$withval != x_no; then
773 AC_MSG_CHECKING(for libevent)
774 if test x_$withval = x_ -o x_$withval = x_yes; then
775 withval="/usr/local /opt/local /usr/lib /usr/pkg /usr/sfw /usr"
777 for dir in $withval; do
779 if test -f "$dir/include/event.h" -o -f "$dir/include/event2/event.h"; then
781 dnl assume /usr is in default path.
782 if test "$thedir" != "/usr"; then
783 CPPFLAGS="$CPPFLAGS -I$thedir/include"
788 if test x_$found_libevent != x_yes; then
789 if test -f "$dir/event.h" -a \( -f "$dir/libevent.la" -o -f "$dir/libev.la" \) ; then
790 # libevent source directory
791 AC_MSG_RESULT(found in $thedir)
792 CPPFLAGS="$CPPFLAGS -I$thedir -I$thedir/include"
794 BAK_LDFLAGS="$LDFLAGS"
795 # remove evdns from linking
796 mkdir build >/dev/null 2>&1
797 mkdir build/libevent >/dev/null 2>&1
798 mkdir build/libevent/.libs >/dev/null 2>&1
799 ev_files_o=`ls $thedir/*.o | grep -v evdns\.o | grep -v bufferevent_openssl\.o`
800 ev_files_lo=`ls $thedir/*.lo | grep -v evdns\.lo | grep -v bufferevent_openssl\.lo`
801 ev_files_libso=`ls $thedir/.libs/*.o | grep -v evdns\.o | grep -v bufferevent_openssl\.o`
802 cp $ev_files_o build/libevent
803 cp $ev_files_lo build/libevent
804 cp $ev_files_libso build/libevent/.libs
805 LATE_LDFLAGS="build/libevent/*.lo -lm"
806 LDFLAGS="build/libevent/*.o $LDFLAGS -lm"
808 AC_MSG_ERROR([Cannot find the libevent library in $withval
809 You can restart ./configure --with-libevent=no to use a builtin alternative.
810 Please note that this alternative is not as capable as libevent when using
811 large outgoing port ranges. ])
814 AC_MSG_RESULT(found in $thedir)
815 dnl if event2 exists and no event lib in dir itself, use subdir
816 if test ! -f $thedir/lib/libevent.a -a ! -f $thedir/lib/libevent.so -a -d "$thedir/lib/event2"; then
817 LDFLAGS="$LDFLAGS -L$thedir/lib/event2"
818 ACX_RUNTIME_PATH_ADD([$thedir/lib/event2])
820 dnl assume /usr is in default path, do not add "".
821 if test "$thedir" != "/usr" -a "$thedir" != ""; then
822 LDFLAGS="$LDFLAGS -L$thedir/lib"
823 ACX_RUNTIME_PATH_ADD([$thedir/lib])
827 # check for library used by libevent after 1.3c
828 AC_SEARCH_LIBS([clock_gettime], [rt])
830 # is the event.h header libev or libevent?
831 AC_CHECK_HEADERS([event.h],,, [AC_INCLUDES_DEFAULT])
832 AC_CHECK_DECL(EV_VERSION_MAJOR, [
833 AC_SEARCH_LIBS(event_set, [ev])
835 AC_SEARCH_LIBS(event_set, [event])
836 ],[AC_INCLUDES_DEFAULT
839 AC_CHECK_FUNCS([event_base_free]) # only in libevent 1.2 and later
840 AC_CHECK_FUNCS([event_base_once]) # only in libevent 1.4.1 and later
841 AC_CHECK_FUNCS([event_base_new]) # only in libevent 1.4.1 and later
842 AC_CHECK_FUNCS([event_base_get_method]) # only in libevent 1.4.3 and later
843 AC_CHECK_FUNCS([ev_loop]) # only in libev. (tested on 3.51)
844 AC_CHECK_FUNCS([ev_default_loop]) # only in libev. (tested on 4.00)
845 if test -n "$BAK_LDFLAGS_SET"; then
846 LDFLAGS="$BAK_LDFLAGS"
848 if test "$use_unbound_event" = "yes"; then
849 AC_SUBST(UNBOUND_EVENT_INSTALL, [unbound-event-install])
850 AC_SUBST(UNBOUND_EVENT_UNINSTALL, [unbound-event-uninstall])
853 AC_DEFINE(USE_MINI_EVENT, 1, [Define if you want to use internal select based events])
857 AC_ARG_WITH(libexpat, AC_HELP_STRING([--with-libexpat=path],
858 [specify explicit path for libexpat.]),
859 [ ],[ withval="/usr/local /opt/local /usr/lib /usr/pkg /usr/sfw /usr" ])
860 AC_MSG_CHECKING(for libexpat)
862 for dir in $withval ; do
863 if test -f "$dir/include/expat.h"; then
865 dnl assume /usr is in default path.
866 if test "$dir" != "/usr"; then
867 CPPFLAGS="$CPPFLAGS -I$dir/include"
868 LDFLAGS="$LDFLAGS -L$dir/lib"
870 AC_MSG_RESULT(found in $dir)
874 if test x_$found_libexpat != x_yes; then
875 AC_ERROR([Could not find libexpat, expat.h])
877 AC_CHECK_HEADERS([expat.h],,, [AC_INCLUDES_DEFAULT])
879 # set static linking if requested
882 AC_ARG_ENABLE(static-exe, AC_HELP_STRING([--enable-static-exe],
883 [ enable to compile executables statically against (event) libs, for debug purposes ]),
885 if test x_$enable_static_exe = x_yes; then
887 if test "$on_mingw" = yes; then
888 staticexe="-all-static"
889 # for static crosscompile, include gdi32 and zlib here.
890 if test "`uname`" = "Linux"; then
891 LIBS="$LIBS -lgdi32 -lz"
896 # set lock checking if requested
897 AC_ARG_ENABLE(lock_checks, AC_HELP_STRING([--enable-lock-checks],
898 [ enable to check lock and unlock calls, for debug purposes ]),
900 if test x_$enable_lock_checks = x_yes; then
901 AC_DEFINE(ENABLE_LOCK_CHECKS, 1, [Define if you want to use debug lock checking (slow).])
902 CHECKLOCK_OBJ="checklocks.lo"
903 AC_SUBST(CHECKLOCK_OBJ)
906 ACX_CHECK_GETADDRINFO_WITH_INCLUDES
907 if test "$USE_WINSOCK" = 1; then
908 AC_DEFINE(UB_ON_WINDOWS, 1, [Use win32 resources and API])
909 AC_CHECK_HEADERS([iphlpapi.h],,, [AC_INCLUDES_DEFAULT
912 AC_CHECK_TOOL(WINDRES, windres)
913 LIBS="$LIBS -liphlpapi"
914 WINAPPS="unbound-service-install.exe unbound-service-remove.exe anchor-update.exe"
916 WIN_DAEMON_SRC="winrc/win_svc.c winrc/w_inst.c"
917 AC_SUBST(WIN_DAEMON_SRC)
918 WIN_DAEMON_OBJ="win_svc.lo w_inst.lo"
919 AC_SUBST(WIN_DAEMON_OBJ)
920 WIN_DAEMON_OBJ_LINK="rsrc_unbound.o"
921 AC_SUBST(WIN_DAEMON_OBJ_LINK)
922 WIN_HOST_OBJ_LINK="rsrc_unbound_host.o"
923 AC_SUBST(WIN_HOST_OBJ_LINK)
924 WIN_UBANCHOR_OBJ_LINK="rsrc_unbound_anchor.o log.lo locks.lo"
925 AC_SUBST(WIN_UBANCHOR_OBJ_LINK)
926 WIN_CONTROL_OBJ_LINK="rsrc_unbound_control.o"
927 AC_SUBST(WIN_CONTROL_OBJ_LINK)
928 WIN_CHECKCONF_OBJ_LINK="rsrc_unbound_checkconf.o"
929 AC_SUBST(WIN_CHECKCONF_OBJ_LINK)
931 if test $ac_cv_func_getaddrinfo = no; then
932 AC_LIBOBJ([fake-rfc2553])
934 # check after getaddrinfo for its libraries
937 # see if daemon(3) exists, and if it is deprecated.
938 AC_CHECK_FUNCS([daemon])
939 if test $ac_cv_func_daemon = yes; then
940 ACX_FUNC_DEPRECATED([daemon], [(void)daemon(0, 0);], [
945 AC_CHECK_MEMBERS([struct sockaddr_un.sun_len],,,[
951 AC_CHECK_MEMBERS([struct in_pktinfo.ipi_spec_dst],,,[
954 #include <sys/param.h>
957 #ifdef HAVE_SYS_SOCKET_H
958 #include <sys/socket.h>
961 #ifdef HAVE_SYS_UIO_H
965 #ifdef HAVE_NETINET_IN_H
966 #include <netinet/in.h>
969 #ifdef HAVE_ARPA_INET_H
970 #include <arpa/inet.h>
973 #ifdef HAVE_WINSOCK2_H
974 #include <winsock2.h>
977 #ifdef HAVE_WS2TCPIP_H
978 #include <ws2tcpip.h>
981 AC_SEARCH_LIBS([setusercontext], [util])
982 AC_CHECK_FUNCS([tzset sigprocmask fcntl getpwnam getrlimit setrlimit setsid sbrk chroot kill chown sleep usleep random srandom recvmsg sendmsg writev socketpair glob initgroups strftime localtime_r setusercontext _beginthreadex endservent endprotoent])
983 AC_CHECK_FUNCS([setresuid],,[AC_CHECK_FUNCS([setreuid])])
984 AC_CHECK_FUNCS([setresgid],,[AC_CHECK_FUNCS([setregid])])
986 # check if setreuid en setregid fail, on MacOSX10.4(darwin8).
987 if echo $build_os | grep darwin8 > /dev/null; then
988 AC_DEFINE(DARWIN_BROKEN_SETREUID, 1, [Define this if on macOSX10.4-darwin8 and setreuid and setregid do not work])
990 AC_REPLACE_FUNCS(inet_aton)
991 AC_REPLACE_FUNCS(inet_pton)
992 AC_REPLACE_FUNCS(inet_ntop)
993 AC_REPLACE_FUNCS(snprintf)
994 AC_REPLACE_FUNCS(strlcat)
995 AC_REPLACE_FUNCS(strlcpy)
996 AC_REPLACE_FUNCS(memmove)
997 AC_REPLACE_FUNCS(gmtime_r)
998 LIBOBJ_WITHOUT_CTIMEARC4="$LIBOBJS"
999 AC_SUBST(LIBOBJ_WITHOUT_CTIMEARC4)
1000 if test "$USE_NSS" = "no"; then
1001 AC_REPLACE_FUNCS(arc4random)
1002 AC_REPLACE_FUNCS(arc4random_uniform)
1003 if test "$ac_cv_func_arc4random" = "no"; then
1004 AC_LIBOBJ(explicit_bzero)
1005 AC_LIBOBJ(arc4_lock)
1006 AC_CHECK_FUNCS([getentropy],,[
1007 if test "$USE_WINSOCK" = 1; then
1008 AC_LIBOBJ(getentropy_win)
1012 AC_LIBOBJ(getentropy_osx)
1015 AC_LIBOBJ(getentropy_solaris)
1016 AC_CHECK_HEADERS([sys/sha2.h],, [
1017 AC_CHECK_FUNCS([SHA512_Update],,[
1020 ], [AC_INCLUDES_DEFAULT])
1021 if test "$ac_cv_header_sys_sha2_h" = "yes"; then
1022 # this lib needed for sha2 on solaris
1025 AC_SEARCH_LIBS([clock_gettime], [rt])
1028 AC_LIBOBJ(getentropy_linux)
1029 AC_CHECK_FUNCS([SHA512_Update],,[
1030 AC_DEFINE([COMPAT_SHA512], [1], [Do sha512 definitions in config.h])
1033 AC_CHECK_HEADERS([sys/sysctl.h],,, [AC_INCLUDES_DEFAULT])
1034 AC_CHECK_FUNCS([getauxval])
1035 AC_SEARCH_LIBS([clock_gettime], [rt])
1042 LIBOBJ_WITHOUT_CTIME="$LIBOBJS"
1043 AC_SUBST(LIBOBJ_WITHOUT_CTIME)
1044 AC_REPLACE_FUNCS(ctime_r)
1046 AC_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]))
1047 case "$enable_allsymbols" in
1049 COMMON_OBJ_ALL_SYMBOLS=""
1051 EXTRALINK="-L. -L.libs -lunbound"
1052 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])
1055 COMMON_OBJ_ALL_SYMBOLS='$(COMMON_OBJ)'
1056 UBSYMS='-export-symbols $(srcdir)/libunbound/ubsyms.def'
1060 AC_SUBST(COMMON_OBJ_ALL_SYMBOLS)
1063 if test x_$enable_lock_checks = x_yes; then
1064 UBSYMS="-export-symbols clubsyms.def"
1065 cp ${srcdir}/libunbound/ubsyms.def clubsyms.def
1066 echo lock_protect >> clubsyms.def
1067 echo lock_unprotect >> clubsyms.def
1068 echo lock_get_mem >> clubsyms.def
1069 echo checklock_start >> clubsyms.def
1070 echo checklock_stop >> clubsyms.def
1071 echo checklock_lock >> clubsyms.def
1072 echo checklock_unlock >> clubsyms.def
1073 echo checklock_init >> clubsyms.def
1074 echo checklock_thrcreate >> clubsyms.def
1075 echo checklock_thrjoin >> clubsyms.def
1078 # check for dnstap if requested
1079 dt_DNSTAP([$UNBOUND_RUN_DIR/dnstap.sock],
1081 AC_DEFINE([USE_DNSTAP], [1], [Define to 1 to enable dnstap support])
1082 AC_SUBST([ENABLE_DNSTAP], [1])
1084 AC_SUBST([opt_dnstap_socket_path])
1085 ACX_ESCAPE_BACKSLASH($opt_dnstap_socket_path, hdr_dnstap_socket_path)
1086 AC_DEFINE_UNQUOTED(DNSTAP_SOCKET_PATH,
1087 ["$hdr_dnstap_socket_path"], [default dnstap socket path])
1089 AC_SUBST([DNSTAP_SRC], ["dnstap/dnstap.c dnstap/dnstap.pb-c.c"])
1090 AC_SUBST([DNSTAP_OBJ], ["dnstap.lo dnstap.pb-c.lo"])
1093 AC_SUBST([ENABLE_DNSTAP], [0])
1097 AC_MSG_CHECKING([if ${MAKE:-make} supports $< with implicit rule in scope])
1098 # on openBSD, the implicit rule make $< work.
1099 # on Solaris, it does not work ($? is changed sources, $^ lists dependencies).
1101 cat >conftest.make <<EOF
1104 conftest.lo foo.lo bla.lo:
1105 if test -f "\$<"; then touch \$@; fi
1109 if test -f "\$<"; then touch \$@; fi
1111 conftest.lo: conftest.dir/conftest.c
1114 touch conftest.dir/conftest.c
1115 rm -f conftest.lo conftest.c
1116 ${MAKE:-make} -f conftest.make >/dev/null
1117 rm -f conftest.make conftest.c conftest.dir/conftest.c
1119 if test ! -f conftest.lo; then
1121 SOURCEDETERMINE='echo "$^" | awk "-F " "{print \$$1;}" > .source'
1122 SOURCEFILE='`cat .source`'
1129 AC_SUBST(SOURCEDETERMINE)
1130 AC_SUBST(SOURCEFILE)
1132 # see if we want to build the library or everything
1133 ALLTARGET="alltargets"
1134 INSTALLTARGET="install-all"
1135 AC_ARG_WITH(libunbound-only, AC_HELP_STRING([--with-libunbound-only],
1136 [do not build daemon and tool programs]),
1138 if test "$withval" = "yes"; then
1140 INSTALLTARGET="install-lib"
1144 AC_SUBST(INSTALLTARGET)
1147 LDFLAGS="$LATE_LDFLAGS $LDFLAGS"
1149 AC_DEFINE_UNQUOTED([MAXSYSLOGMSGLEN], [10240], [Define to the maximum message length to pass to syslog.])
1152 dnl this must be first AH_CONFIG, to define the flags before any includes.
1153 AHX_CONFIG_EXT_FLAGS
1157 #ifndef UNBOUND_DEBUG
1161 /** Use small-ldns codebase */
1164 # define LDNS_BUILD_CONFIG_HAVE_SSL 1
1177 #ifdef HAVE_STDARG_H
1181 #ifdef HAVE_STDINT_H
1187 #if HAVE_SYS_PARAM_H
1188 #include <sys/param.h>
1191 #ifdef HAVE_SYS_SOCKET_H
1192 #include <sys/socket.h>
1195 #ifdef HAVE_SYS_UIO_H
1196 #include <sys/uio.h>
1199 #ifdef HAVE_NETINET_IN_H
1200 #include <netinet/in.h>
1203 #ifdef HAVE_ARPA_INET_H
1204 #include <arpa/inet.h>
1207 #ifdef HAVE_WINSOCK2_H
1208 #include <winsock2.h>
1211 #ifdef HAVE_WS2TCPIP_H
1212 #include <ws2tcpip.h>
1216 #define ARG_LL "%ll"
1218 #define ARG_LL "%I64"
1222 #define AF_LOCAL AF_UNIX
1226 AHX_CONFIG_FORMAT_ATTRIBUTE
1227 AHX_CONFIG_UNUSED_ATTRIBUTE
1229 AHX_CONFIG_MAXHOSTNAMELEN
1230 AHX_CONFIG_SNPRINTF(unbound)
1231 AHX_CONFIG_INET_PTON(unbound)
1232 AHX_CONFIG_INET_NTOP(unbound)
1233 AHX_CONFIG_INET_ATON(unbound)
1234 AHX_CONFIG_MEMMOVE(unbound)
1235 AHX_CONFIG_STRLCAT(unbound)
1236 AHX_CONFIG_STRLCPY(unbound)
1237 AHX_CONFIG_GMTIME_R(unbound)
1238 AHX_CONFIG_W32_SLEEP
1239 AHX_CONFIG_W32_USLEEP
1240 AHX_CONFIG_W32_RANDOM
1241 AHX_CONFIG_W32_SRANDOM
1242 AHX_CONFIG_W32_FD_SET_T
1243 AHX_CONFIG_IPV6_MIN_MTU
1244 AHX_MEMCMP_BROKEN(unbound)
1247 #ifndef HAVE_CTIME_R
1248 #define ctime_r unbound_ctime_r
1249 char *ctime_r(const time_t *timep, char *buf);
1252 #if !defined(HAVE_STRPTIME) || !defined(STRPTIME_WORKS)
1253 #define strptime unbound_strptime
1255 char *strptime(const char *s, const char *format, struct tm *tm);
1258 #ifdef HAVE_LIBRESSL
1259 # if !HAVE_DECL_STRLCPY
1260 size_t strlcpy(char *dst, const char *src, size_t siz);
1262 # if !HAVE_DECL_STRLCAT
1263 size_t strlcat(char *dst, const char *src, size_t siz);
1265 # if !HAVE_DECL_ARC4RANDOM && defined(HAVE_ARC4RANDOM)
1266 uint32_t arc4random(void);
1268 # if !HAVE_DECL_ARC4RANDOM_UNIFORM && defined(HAVE_ARC4RANDOM_UNIFORM)
1269 uint32_t arc4random_uniform(uint32_t upper_bound);
1271 #endif /* HAVE_LIBRESSL */
1272 #ifndef HAVE_ARC4RANDOM
1273 void explicit_bzero(void* buf, size_t len);
1274 int getentropy(void* buf, size_t len);
1275 uint32_t arc4random(void);
1276 void arc4random_buf(void* buf, size_t n);
1277 void _ARC4_LOCK(void);
1278 void _ARC4_UNLOCK(void);
1280 #ifndef HAVE_ARC4RANDOM_UNIFORM
1281 uint32_t arc4random_uniform(uint32_t upper_bound);
1283 #ifdef COMPAT_SHA512
1284 #ifndef SHA512_DIGEST_LENGTH
1285 #define SHA512_BLOCK_LENGTH 128
1286 #define SHA512_DIGEST_LENGTH 64
1287 #define SHA512_DIGEST_STRING_LENGTH (SHA512_DIGEST_LENGTH * 2 + 1)
1288 typedef struct _SHA512_CTX {
1290 uint64_t bitcount[2];
1291 uint8_t buffer[SHA512_BLOCK_LENGTH];
1293 #endif /* SHA512_DIGEST_LENGTH */
1294 void SHA512_Init(SHA512_CTX*);
1295 void SHA512_Update(SHA512_CTX*, void*, size_t);
1296 void SHA512_Final(uint8_t[SHA512_DIGEST_LENGTH], SHA512_CTX*);
1297 unsigned char *SHA512(void* data, unsigned int data_len, unsigned char *digest);
1298 #endif /* COMPAT_SHA512 */
1302 #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))
1303 /* using version of libevent that is not threadsafe. */
1304 # define LIBEVENT_SIGNAL_PROBLEM 1
1307 #ifndef CHECKED_INET6
1308 # define CHECKED_INET6
1312 # define AF_INET6 28
1314 #endif /* CHECKED_INET6 */
1316 #ifndef HAVE_GETADDRINFO
1317 struct sockaddr_storage;
1318 #include "compat/fake-rfc2553.h"
1321 #ifdef UNBOUND_ALLOC_STATS
1322 # define malloc(s) unbound_stat_malloc_log(s, __FILE__, __LINE__, __func__)
1323 # define calloc(n,s) unbound_stat_calloc_log(n, s, __FILE__, __LINE__, __func__)
1324 # define free(p) unbound_stat_free_log(p, __FILE__, __LINE__, __func__)
1325 # define realloc(p,s) unbound_stat_realloc_log(p, s, __FILE__, __LINE__, __func__)
1326 void *unbound_stat_malloc(size_t size);
1327 void *unbound_stat_calloc(size_t nmemb, size_t size);
1328 void unbound_stat_free(void *ptr);
1329 void *unbound_stat_realloc(void *ptr, size_t size);
1330 void *unbound_stat_malloc_log(size_t size, const char* file, int line,
1332 void *unbound_stat_calloc_log(size_t nmemb, size_t size, const char* file,
1333 int line, const char* func);
1334 void unbound_stat_free_log(void *ptr, const char* file, int line,
1336 void *unbound_stat_realloc_log(void *ptr, size_t size, const char* file,
1337 int line, const char* func);
1338 #elif defined(UNBOUND_ALLOC_LITE)
1339 # include "util/alloc.h"
1340 #endif /* UNBOUND_ALLOC_LITE and UNBOUND_ALLOC_STATS */
1342 /** default port for DNS traffic. */
1343 #define UNBOUND_DNS_PORT 53
1344 /** default port for unbound control traffic, registered port with IANA,
1345 ub-dns-control 8953/tcp unbound dns nameserver control */
1346 #define UNBOUND_CONTROL_PORT 8953
1347 /** the version of unbound-control that this software implements */
1348 #define UNBOUND_CONTROL_VERSION 1
1352 dnl if we build from source tree, the man pages need @date@ and @version@
1353 dnl if this is a distro tarball, that was already done by makedist.sh
1354 AC_SUBST(version, [VERSION_MAJOR.VERSION_MINOR.VERSION_MICRO])
1355 AC_SUBST(date, [`date +'%b %e, %Y'`])
1357 AC_CONFIG_FILES([Makefile doc/example.conf doc/libunbound.3 doc/unbound.8 doc/unbound-anchor.8 doc/unbound-checkconf.8 doc/unbound.conf.5 doc/unbound-control.8 doc/unbound-host.1 smallapp/unbound-control-setup.sh dnstap/dnstap_config.h])
1358 AC_CONFIG_HEADER([config.h])