2007-01-03 08:53:52 +00:00
# -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.
2008-05-22 13:30:22 +00:00
AC_PREREQ(2.56)
2009-03-23 14:59:58 +00:00
sinclude(acx_nlnetlabs.m4)
sinclude(acx_pthread.m4)
2009-03-25 14:47:47 +00:00
sinclude(acx_python.m4)
sinclude(ac_pkg_swig.m4)
2007-01-03 08:53:52 +00:00
2010-08-03 12:30:45 +00:00
AC_INIT(unbound, 1.4.7, unbound-bugs@nlnetlabs.nl, unbound)
2007-01-03 08:53:52 +00:00
2009-11-26 14:28:40 +00:00
LIBUNBOUND_CURRENT=2
2010-08-03 12:30:45 +00:00
LIBUNBOUND_REVISION=7
2009-03-02 08:21:19 +00:00
LIBUNBOUND_AGE=0
2008-05-14 07:34:02 +00:00
# 1.0.0 had 0:12:0
2008-05-16 14:42:00 +00:00
# 1.0.1 had 0:13:0
2008-07-16 13:16:36 +00:00
# 1.0.2 had 0:14:0
2008-08-29 07:48:40 +00:00
# 1.1.0 had 0:15:0
2008-11-14 06:30:34 +00:00
# 1.1.1 had 0:16:0
2009-01-07 12:24:34 +00:00
# 1.2.0 had 0:17:0
2009-01-09 10:49:47 +00:00
# 1.2.1 had 0:18:0
2009-03-02 08:21:19 +00:00
# 1.3.0 had 1:0:0 # ub_cancel and -export-symbols.
2009-06-08 13:47:06 +00:00
# 1.3.1 had 1:1:0
2009-07-09 09:08:08 +00:00
# 1.3.2 had 1:2:0
2009-07-13 13:28:12 +00:00
# 1.3.3 had 1:3:0
2009-08-05 15:55:58 +00:00
# 1.3.4 had 1:4:0
2009-10-08 17:05:53 +00:00
# 1.4.0-snapshots had 1:5:0
2009-11-26 14:28:40 +00:00
# 1.4.0 had 1:5:0 (not 2:0:0) # ub_result.why_bogus
# 1.4.1 had 2:1:0
2009-12-17 09:37:29 +00:00
# 1.4.2 had 2:2:0
2010-03-09 09:40:48 +00:00
# 1.4.3 had 2:3:0
2010-03-11 14:29:32 +00:00
# 1.4.4 had 2:4:0
2010-04-22 09:02:30 +00:00
# 1.4.5 had 2:5:0
2010-06-15 07:45:55 +00:00
# 1.4.6 had 2:6:0
2010-08-03 12:30:45 +00:00
# 1.4.7 had 2:7:0
2008-05-14 07:34:02 +00:00
# Current -- the number of the binary API that we're implementing
# Revision -- which iteration of the implementation of the binary
# API are we supplying?
# Age -- How many previous binary API versions do we also
# support?
#
# If we release a new version that does not change the binary API,
# increment Revision.
#
# If we release a new version that changes the binary API, but does
# not break programs compiled against the old binary API, increment
# Current and Age. Set Revision to 0, since this is the first
# implementation of the new API.
#
# Otherwise, we're changing the binary API and breaking bakward
# compatibility with old binaries. Increment Current. Set Age to 0,
# since we're backward compatible with no previous APIs. Set Revision
# to 0 too.
AC_SUBST(LIBUNBOUND_CURRENT)
AC_SUBST(LIBUNBOUND_REVISION)
AC_SUBST(LIBUNBOUND_AGE)
2010-07-13 09:10:53 +00:00
pretty_cmdline() {
2010-07-05 13:10:49 +00:00
cmdline=""
while test -n "$1"; do
cmdline="$cmdline '"`echo $1 | sed -e 's/\\\\/\\\\\\\\/g' | sed -e 's/"/\\\\"/g' `"'"
shift
done
}
pretty_cmdline $@
AC_DEFINE_UNQUOTED(CONFIGURE_BUILD_WITH, ["$cmdline"], [configure flags])
AC_CANONICAL_TARGET
AC_DEFINE_UNQUOTED(CONFIGURE_TARGET, ["$target"], [configure target system])
AC_DEFINE_UNQUOTED(CONFIGURE_DATE, ["`date`"], [configure date])
2008-10-22 07:40:37 +00:00
CFLAGS="$CFLAGS"
2007-01-03 08:53:52 +00:00
AC_AIX
2007-11-09 13:52:13 +00:00
dnl
2008-03-04 14:25:53 +00:00
dnl By default set prefix to /usr/local
2007-11-09 13:52:13 +00:00
dnl
case "$prefix" in
NONE)
2008-03-04 14:25:53 +00:00
prefix="/usr/local"
2007-11-09 13:52:13 +00:00
;;
esac
2009-03-19 14:24:19 +00:00
# are we on MinGW?
if uname -s 2>&1 | grep MINGW32 >/dev/null; then on_mingw="yes"
2009-07-14 14:44:53 +00:00
else
if echo $target | grep mingw32 >/dev/null; then on_mingw="yes"
else on_mingw="no"; fi
fi
2009-03-19 14:24:19 +00:00
2007-11-09 13:52:13 +00:00
#
# Determine configuration file
2008-06-09 14:59:29 +00:00
# the eval is to evaluate shell expansion twice
2009-03-19 14:24:19 +00:00
if test $on_mingw = "no"; then
ub_conf_file=`eval echo "${sysconfdir}/unbound/unbound.conf"`
else
ub_conf_file="C:\\Program Files\\Unbound\\service.conf"
fi
2007-11-09 13:52:13 +00:00
AC_ARG_WITH([conf_file],
2008-06-09 14:59:29 +00:00
AC_HELP_STRING([--with-conf-file=path],
[Pathname to the Unbound configuration file]),
[ub_conf_file="$withval"])
2007-11-09 13:52:13 +00:00
AC_SUBST(ub_conf_file)
2009-03-23 14:59:58 +00:00
ACX_ESCAPE_BACKSLASH($ub_conf_file, hdr_config)
2009-02-26 16:17:46 +00:00
AC_DEFINE_UNQUOTED(CONFIGFILE, ["$hdr_config"], [Pathname to the Unbound configuration file])
2007-11-09 13:52:13 +00:00
2008-02-15 14:13:09 +00:00
# Determine run, chroot directory and pidfile locations
2008-06-09 14:59:29 +00:00
AC_ARG_WITH(run-dir,
AC_HELP_STRING([--with-run-dir=path],
[set default directory to chdir to (by default dir part of cfg file)]),
UNBOUND_RUN_DIR="$withval",
2009-03-19 14:24:19 +00:00
if test $on_mingw = no; then
UNBOUND_RUN_DIR=`dirname "$ub_conf_file"`
else
UNBOUND_RUN_DIR=""
fi
)
2008-06-09 14:59:29 +00:00
AC_SUBST(UNBOUND_RUN_DIR)
2009-03-23 14:59:58 +00:00
ACX_ESCAPE_BACKSLASH($UNBOUND_RUN_DIR, hdr_run)
2009-02-26 16:17:46 +00:00
AC_DEFINE_UNQUOTED(RUN_DIR, ["$hdr_run"], [Directory to chdir to])
2008-06-09 14:59:29 +00:00
AC_ARG_WITH(chroot-dir,
AC_HELP_STRING([--with-chroot-dir=path],
[set default directory to chroot to (by default same as run-dir)]),
UNBOUND_CHROOT_DIR="$withval",
2009-03-19 14:24:19 +00:00
if test $on_mingw = no; then
UNBOUND_CHROOT_DIR="$UNBOUND_RUN_DIR"
else
UNBOUND_CHROOT_DIR=""
fi
)
2008-06-09 14:59:29 +00:00
AC_SUBST(UNBOUND_CHROOT_DIR)
2009-03-23 14:59:58 +00:00
ACX_ESCAPE_BACKSLASH($UNBOUND_CHOOT_DIR, hdr_chroot)
2009-02-26 16:17:46 +00:00
AC_DEFINE_UNQUOTED(CHROOT_DIR, ["$hdr_chroot"], [Directory to chroot to])
2008-06-09 14:59:29 +00:00
2009-03-25 14:47:47 +00:00
AC_ARG_WITH(share-dir,
AC_HELP_STRING([--with-share-dir=path],
[set default directory with shared data (by default same as share/unbound)]),
UNBOUND_SHARE_DIR="$withval",
UNBOUND_SHARE_DIR="$UNBOUND_RUN_DIR")
AC_SUBST(UNBOUND_SHARE_DIR)
AC_DEFINE_UNQUOTED(SHARE_DIR, ["$UNBOUND_SHARE_DIR"], [Shared data])
2008-06-09 14:59:29 +00:00
AC_ARG_WITH(pidfile,
AC_HELP_STRING([--with-pidfile=filename],
[set default pathname to unbound pidfile (default run-dir/unbound.pid)]),
UNBOUND_PIDFILE="$withval",
2009-03-19 14:24:19 +00:00
if test $on_mingw = no; then
UNBOUND_PIDFILE="$UNBOUND_RUN_DIR/unbound.pid"
else
UNBOUND_PIDFILE=""
fi
)
2008-06-09 14:59:29 +00:00
AC_SUBST(UNBOUND_PIDFILE)
2009-03-23 14:59:58 +00:00
ACX_ESCAPE_BACKSLASH($UNBOUND_PIDFILE, hdr_pid)
2009-02-26 16:17:46 +00:00
AC_DEFINE_UNQUOTED(PIDFILE, ["$hdr_pid"], [default pidfile location])
2008-02-15 14:13:09 +00:00
2008-07-17 09:00:38 +00:00
AC_ARG_WITH(username,
AC_HELP_STRING([--with-username=user],
[set default user that unbound changes to (default user is unbound)]),
UNBOUND_USERNAME="$withval",
UNBOUND_USERNAME="unbound")
AC_SUBST(UNBOUND_USERNAME)
AC_DEFINE_UNQUOTED(UB_USERNAME, ["$UNBOUND_USERNAME"], [default username])
2008-05-22 13:30:22 +00:00
AC_DEFINE(WINVER, 0x0502, [the version of the windows API enabled])
2009-03-23 14:59:58 +00:00
ACX_RSRC_VERSION(wnvs)
2009-02-25 15:54:35 +00:00
AC_DEFINE_UNQUOTED(RSRC_PACKAGE_VERSION, [$wnvs], [version number for resource files])
2008-05-22 13:30:22 +00:00
2007-01-03 08:53:52 +00:00
# Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
AC_LANG_C
2009-03-23 14:59:58 +00:00
ACX_CHECK_COMPILER_FLAG(g, [CFLAGS="$CFLAGS -g"])
ACX_CHECK_COMPILER_FLAG(O2, [CFLAGS="$CFLAGS -O2"])
AC_PROG_CC
ACX_DEPFLAG
ACX_DETERMINE_EXT_FLAGS_UNBOUND
2007-02-05 11:20:38 +00:00
2009-03-23 18:09:19 +00:00
# debug mode flags warnings
2010-03-01 12:53:02 +00:00
AC_ARG_ENABLE(checking, AC_HELP_STRING([--enable-checking], [Enable warnings, asserts, makefile-dependencies]))
AC_ARG_ENABLE(debug, AC_HELP_STRING([--enable-debug], [same as enable-checking]))
if test "$enable_debug" = "yes"; then debug_enabled="$enable_debug";
else debug_enabled="$enable_checking"; fi
2008-01-14 09:51:20 +00:00
AC_SUBST(debug_enabled)
2010-03-01 12:53:02 +00:00
case "$debug_enabled" in
2008-01-14 09:51:20 +00:00
yes)
2009-03-23 14:59:58 +00:00
ACX_CHECK_COMPILER_FLAG(W, [CFLAGS="$CFLAGS -W"])
ACX_CHECK_COMPILER_FLAG(Wall, [CFLAGS="$CFLAGS -Wall"])
ACX_CHECK_COMPILER_FLAG(Wextra, [CFLAGS="$CFLAGS -Wextra"])
ACX_CHECK_COMPILER_FLAG(Wdeclaration-after-statement, [CFLAGS="$CFLAGS -Wdeclaration-after-statement"])
2008-01-14 09:51:20 +00:00
AC_DEFINE([UNBOUND_DEBUG], [], [define this to enable debug checks.])
;;
no|*)
# nothing to do.
;;
esac
2007-02-05 11:20:38 +00:00
2007-01-03 08:53:52 +00:00
AC_C_INLINE
2009-03-23 14:59:58 +00:00
ACX_CHECK_FORMAT_ATTRIBUTE
ACX_CHECK_UNUSED_ATTRIBUTE
2007-01-03 08:53:52 +00:00
2007-01-23 16:10:23 +00:00
if test "$srcdir" != "."; then
2008-02-07 14:13:03 +00:00
CPPFLAGS="$CPPFLAGS -I$srcdir"
2007-01-23 16:10:23 +00:00
fi
2009-08-25 12:10:24 +00:00
AC_DEFUN([ACX_YYLEX_DESTROY], [
AC_MSG_CHECKING([for yylex_destroy])
if echo %% | $LEX -t 2>&1 | grep yylex_destroy >/dev/null 2>&1; then
AC_DEFINE(LEX_HAS_YYLEX_DESTROY, 1, [if lex has yylex_destroy])
AC_MSG_RESULT(yes)
else AC_MSG_RESULT(no); fi
])
2007-02-20 15:28:27 +00:00
AC_PROG_LEX
2009-08-25 12:10:24 +00:00
ACX_YYLEX_DESTROY
2007-02-20 15:28:27 +00:00
AC_PROG_YACC
2009-03-23 14:59:58 +00:00
AC_CHECK_PROG(doxygen, doxygen, doxygen)
2009-07-15 11:50:13 +00:00
AC_CHECK_TOOL(STRIP, strip)
2009-03-23 14:59:58 +00:00
ACX_LIBTOOL_C_ONLY
2007-01-23 16:10:23 +00:00
# Checks for header files.
2010-09-23 15:28:08 +00:00
AC_CHECK_HEADERS([stdarg.h stdbool.h netinet/in.h sys/param.h sys/socket.h sys/uio.h sys/resource.h arpa/inet.h syslog.h netdb.h sys/wait.h pwd.h glob.h grp.h login_cap.h winsock2.h ws2tcpip.h],,, [AC_INCLUDES_DEFAULT])
2007-01-23 16:10:23 +00:00
2009-03-24 14:08:58 +00:00
# check for types.
# Using own tests for int64* because autoconf builtin only give 32bit.
AC_CHECK_TYPE(int8_t, signed char)
AC_CHECK_TYPE(int16_t, short)
AC_CHECK_TYPE(int32_t, int)
AC_CHECK_TYPE(int64_t, long long)
AC_CHECK_TYPE(uint8_t, unsigned char)
AC_CHECK_TYPE(uint16_t, unsigned short)
AC_CHECK_TYPE(uint32_t, unsigned int)
AC_CHECK_TYPE(uint64_t, unsigned long long)
2007-01-23 16:10:23 +00:00
AC_TYPE_SIZE_T
2009-03-24 14:08:58 +00:00
AC_CHECK_TYPE(ssize_t, int)
2007-01-23 16:10:23 +00:00
AC_TYPE_UID_T
AC_TYPE_PID_T
AC_TYPE_OFF_T
2009-03-23 18:09:19 +00:00
ACX_TYPE_U_CHAR
ACX_TYPE_RLIM_T
ACX_TYPE_SOCKLEN_T
ACX_TYPE_IN_ADDR_T
ACX_TYPE_IN_PORT_T
2010-02-01 13:42:30 +00:00
ACX_CHECK_MEMCMP_SIGNED
2007-01-23 16:10:23 +00:00
2007-10-11 07:34:44 +00:00
# add option to disable the evil rpath
2009-03-23 18:09:19 +00:00
ACX_ARG_RPATH
2010-03-12 09:20:40 +00:00
AC_SUBST(RUNTIME_PATH)
# check to see if libraries are needed for these functions.
AC_SEARCH_LIBS([inet_pton], [nsl])
AC_SEARCH_LIBS([socket], [socket])
# check some functions of the OS before linking libs (while still runnable).
AC_FUNC_CHOWN
AC_FUNC_FORK
AC_TYPE_SIGNAL
AC_FUNC_FSEEKO
ACX_SYS_LARGEFILE
ACX_CHECK_NONBLOCKING_BROKEN
ACX_MKDIR_ONE_ARG
2007-10-11 07:34:44 +00:00
2010-06-02 08:43:29 +00:00
# check windows threads (we use them, not pthreads, on windows).
if test "$on_mingw" = "yes"; then
# check windows threads
AC_CHECK_HEADERS([windows.h],,, [AC_INCLUDES_DEFAULT])
AC_MSG_CHECKING([for CreateThread])
AC_TRY_COMPILE([
#ifdef HAVE_WINDOWS_H
#include <windows.h>
#endif
], [
HANDLE t = CreateThread(NULL, 0, NULL, NULL, 0, NULL);
],
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_WINDOWS_THREADS, 1, [Using Windows threads])
,
AC_MSG_RESULT(no)
)
else
# not on mingw, check thread libraries.
2009-03-30 14:42:43 +00:00
# check for thread library.
# check this first, so that the pthread lib does not get linked in via
# libssl or libpython, and thus distorts the tests, and we end up using
# the non-threadsafe C libraries.
AC_ARG_WITH(pthreads, AC_HELP_STRING([--with-pthreads],
[use pthreads library, or --without-pthreads to disable threading support.]),
[ ],[ withval="yes" ])
ub_have_pthreads=no
if test x_$withval != x_no; then
ACX_PTHREAD([
AC_DEFINE(HAVE_PTHREAD,1,[Define if you have POSIX threads libraries and header files.])
LIBS="$PTHREAD_LIBS $LIBS"
CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
CC="$PTHREAD_CC"
ub_have_pthreads=yes
AC_CHECK_TYPES([pthread_spinlock_t, pthread_rwlock_t],,,[#include <pthread.h>])
])
fi
# check solaris thread library
AC_ARG_WITH(solaris-threads, AC_HELP_STRING([--with-solaris-threads],
[use solaris native thread library.]), [ ],[ withval="no" ])
ub_have_sol_threads=no
if test x_$withval != x_no; then
if test x_$ub_have_pthreads != x_no; then
AC_WARN([Have pthreads already, ignoring --with-solaris-threads])
else
AC_SEARCH_LIBS(thr_create, [thread],
[
AC_DEFINE(HAVE_SOLARIS_THREADS, 1, [Using Solaris threads])
ACX_CHECK_COMPILER_FLAG(mt, [CFLAGS="$CFLAGS -mt"],
[CFLAGS="$CFLAGS -D_REENTRANT"])
ub_have_sol_threads=yes
] , [
AC_ERROR([no solaris threads found.])
])
fi
fi
2010-06-02 08:43:29 +00:00
fi # end of non-mingw check of thread libraries
2009-03-30 14:42:43 +00:00
2009-03-25 14:47:47 +00:00
# Check for PyUnbound
AC_ARG_WITH(pyunbound,
AC_HELP_STRING([--with-pyunbound],
[build PyUnbound, or --without-pyunbound to skip it. (default=no)]),
[], [ withval="no" ])
ub_test_python=no
ub_with_pyunbound=no
if test x_$withval != x_no; then
ub_with_pyunbound=yes
ub_test_python=yes
fi
# Check for Python module
AC_ARG_WITH(pythonmodule,
AC_HELP_STRING([--with-pythonmodule],
[build Python module, or --without-pythonmodule to disable script engine. (default=no)]),
[], [ withval="no" ])
ub_with_pythonmod=no
if test x_$withval != x_no; then
ub_with_pythonmod=yes
ub_test_python=yes
fi
# Check for Python & SWIG only on PyUnbound or PyModule
if test x_$ub_test_python != x_no; then
# Check for Python
ub_have_python=no
2010-03-12 13:21:20 +00:00
ac_save_LIBS="$LIBS" dnl otherwise AC_PYTHON_DEVEL thrashes $LIBS
2009-03-25 14:47:47 +00:00
AC_PYTHON_DEVEL
2009-04-23 15:47:49 +00:00
if test ! -z "$PYTHON_VERSION"; then
if test `$PYTHON -c "print '$PYTHON_VERSION' >= '2.4.0'"` = "False"; then
AC_ERROR([Python version >= 2.4.0 is required])
fi
2009-03-25 14:47:47 +00:00
# Have Python
AC_DEFINE(HAVE_PYTHON,1,[Define if you have Python libraries and header files.])
LIBS="$PYTHON_LDFLAGS $LIBS"
2009-04-17 12:14:43 +00:00
CPPFLAGS="$CPPFLAGS $PYTHON_CPPFLAGS"
2009-03-25 14:47:47 +00:00
ub_have_python=yes
# Check for SWIG
ub_have_swig=no
AC_PROG_SWIG
AC_MSG_CHECKING(SWIG)
2009-04-21 14:32:44 +00:00
if test ! -x "$SWIG"; then
2009-06-08 14:53:27 +00:00
AC_ERROR([failed to find swig tool, install it, or do not build Python module and PyUnbound])
2009-03-25 14:47:47 +00:00
else
AC_DEFINE(HAVE_SWIG, 1, [Define if you have Swig libraries and header files.])
AC_SUBST(swig, "$SWIG")
2009-03-25 16:20:34 +00:00
AC_MSG_RESULT(present)
2009-03-25 14:47:47 +00:00
2009-03-25 16:20:34 +00:00
# If have Python & SWIG
2009-03-25 14:47:47 +00:00
# Declare PythonMod
if test x_$ub_with_pythonmod != x_no; then
AC_DEFINE(WITH_PYTHONMODULE, 1, [Define if you want Python module.])
WITH_PYTHONMODULE=yes
AC_SUBST(WITH_PYTHONMODULE)
fi
# Declare PyUnbound
if test x_$ub_with_pyunbound != x_no; then
AC_DEFINE(WITH_PYUNBOUND, 1, [Define if you want PyUnbound.])
WITH_PYUNBOUND=yes
AC_SUBST(WITH_PYUNBOUND)
fi
fi
else
2009-04-23 15:47:49 +00:00
AC_MSG_RESULT([*** Python libraries not found, won't build PythonMod or PyUnbound ***])
2009-03-25 14:47:47 +00:00
ub_with_pyunbound=no
ub_with_pythonmod=no
fi
fi
2007-01-03 08:53:52 +00:00
# Checks for libraries.
2009-03-23 18:09:19 +00:00
ACX_WITH_SSL
ACX_LIB_SSL
2009-08-24 14:40:25 +00:00
AC_CHECK_HEADERS([openssl/conf.h],,, [AC_INCLUDES_DEFAULT])
AC_CHECK_HEADERS([openssl/engine.h],,, [AC_INCLUDES_DEFAULT])
2009-08-07 15:23:35 +00:00
AC_CHECK_FUNCS([OPENSSL_config EVP_sha1 EVP_sha256 EVP_sha512])
2010-06-23 07:46:46 +00:00
AC_CHECK_DECLS([SSL_COMP_get_compression_methods,sk_SSL_COMP_pop_free], [], [], [
2009-08-25 13:05:31 +00:00
AC_INCLUDES_DEFAULT
#ifdef HAVE_OPENSSL_ERR_H
#include <openssl/err.h>
#endif
#ifdef HAVE_OPENSSL_RAND_H
#include <openssl/rand.h>
#endif
#ifdef HAVE_OPENSSL_CONF_H
#include <openssl/conf.h>
#endif
#ifdef HAVE_OPENSSL_ENGINE_H
#include <openssl/engine.h>
#endif
#include <openssl/ssl.h>
#include <openssl/evp.h>
])
2007-01-03 08:53:52 +00:00
2009-10-28 21:56:54 +00:00
AC_ARG_ENABLE(sha2, AC_HELP_STRING([--disable-sha2], [Disable SHA256 and SHA512 RRSIG support]))
2009-06-02 09:04:16 +00:00
case "$enable_sha2" in
2009-10-28 21:56:54 +00:00
no)
2009-08-06 13:38:55 +00:00
;;
2009-10-28 21:56:54 +00:00
yes|*)
AC_DEFINE([USE_SHA2], [1], [Define this to enable SHA256 and SHA512 support.])
2009-08-06 13:38:55 +00:00
;;
esac
2010-04-07 17:46:32 +00:00
AC_ARG_ENABLE(gost, AC_HELP_STRING([--enable-gost], [Enable GOST support, experimental]))
2010-04-28 19:50:34 +00:00
use_gost="no"
2009-08-06 13:38:55 +00:00
case "$enable_gost" in
2010-04-07 17:46:32 +00:00
yes)
2010-04-28 12:52:03 +00:00
AC_CHECK_FUNC(EVP_PKEY_set_type_str, [:],[AC_MSG_ERROR([OpenSSL 1.0.0 is needed for GOST support])])
2010-04-28 19:50:34 +00:00
use_gost="yes"
2010-04-06 12:15:19 +00:00
AC_DEFINE([USE_GOST], [1], [Define this to enable GOST support.])
2009-06-02 09:04:16 +00:00
;;
2010-04-28 12:52:03 +00:00
no)
;;
*) dnl default
2010-07-10 08:13:19 +00:00
AC_CHECK_FUNC(EVP_PKEY_set_type_str, [
use_gost="yes"
AC_DEFINE([USE_GOST], [1], [Define this to enable GOST support.])])
2010-04-07 17:46:32 +00:00
;;
2009-06-02 09:04:16 +00:00
esac
2007-01-23 14:16:52 +00:00
# check for libevent
2007-01-25 12:39:51 +00:00
AC_ARG_WITH(libevent, AC_HELP_STRING([--with-libevent=pathname],
2008-02-22 10:19:49 +00:00
[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.]),
[ ],[ withval="no" ])
2008-05-27 07:41:50 +00:00
if test x_$withval = x_yes -o x_$withval != x_no; then
2007-01-23 14:16:52 +00:00
AC_MSG_CHECKING(for libevent)
if test x_$withval = x_ -o x_$withval = x_yes; then
2008-02-07 14:13:03 +00:00
withval="/usr/local /opt/local /usr/lib /usr/pkg /usr/sfw /usr"
2007-01-23 14:16:52 +00:00
fi
for dir in $withval; do
thedir="$dir"
if test -f "$dir/include/event.h"; then
2008-02-07 14:13:03 +00:00
found_libevent="yes"
2009-03-24 13:55:12 +00:00
dnl assume /usr is in default path.
if test "$thedir" != "/usr"; then
CPPFLAGS="$CPPFLAGS -I$thedir/include"
fi
2007-01-23 14:16:52 +00:00
break;
fi
done
if test x_$found_libevent != x_yes; then
2008-04-09 11:58:53 +00:00
if test -f "$dir/event.h" -a \( -f "$dir/libevent.la" -o -f "$dir/libev.la" \) ; then
2007-02-02 17:19:27 +00:00
# libevent source directory
AC_MSG_RESULT(found in $thedir)
2008-04-10 08:16:26 +00:00
CPPFLAGS="$CPPFLAGS -I$thedir -I$thedir/include"
2009-03-30 08:47:20 +00:00
BAK_LDFLAGS_SET="1"
2008-01-15 13:19:59 +00:00
BAK_LDFLAGS="$LDFLAGS"
2008-02-07 14:09:24 +00:00
# remove evdns from linking
mkdir build >/dev/null 2>&1
mkdir build/libevent >/dev/null 2>&1
mkdir build/libevent/.libs >/dev/null 2>&1
2009-09-04 13:29:11 +00:00
ev_files_o=`ls $thedir/*.o | grep -v evdns\.o | grep -v bufferevent_openssl\.o`
ev_files_lo=`ls $thedir/*.lo | grep -v evdns\.lo | grep -v bufferevent_openssl\.lo`
ev_files_libso=`ls $thedir/.libs/*.o | grep -v evdns\.o | grep -v bufferevent_openssl\.o`
2008-02-07 14:09:24 +00:00
cp $ev_files_o build/libevent
cp $ev_files_lo build/libevent
cp $ev_files_libso build/libevent/.libs
2008-04-09 11:58:53 +00:00
LATE_LDFLAGS="build/libevent/*.lo -lm"
LDFLAGS="build/libevent/*.o $LDFLAGS -lm"
2007-02-02 17:19:27 +00:00
else
2007-09-24 13:32:40 +00:00
AC_MSG_ERROR([Cannot find the libevent library in $withval
2007-11-19 11:04:05 +00:00
You can restart ./configure --with-libevent=no to use a builtin alternative.
2007-09-24 13:32:40 +00:00
Please note that this alternative is not as capable as libevent when using
2008-02-22 10:19:49 +00:00
large outgoing port ranges. ])
2007-02-02 17:19:27 +00:00
fi
2007-01-23 14:16:52 +00:00
else
AC_MSG_RESULT(found in $thedir)
2009-07-03 19:40:14 +00:00
dnl assume /usr is in default path, do not add "".
if test "$thedir" != "/usr" -a "$thedir" != ""; then
2009-03-24 13:55:12 +00:00
LDFLAGS="$LDFLAGS -L$thedir/lib"
2009-03-30 08:47:20 +00:00
ACX_RUNTIME_PATH_ADD([$thedir/lib])
2007-10-11 07:34:44 +00:00
fi
2007-01-23 14:16:52 +00:00
fi
2008-05-13 14:01:23 +00:00
# check for library used by libevent after 1.3c
AC_SEARCH_LIBS([clock_gettime], [rt])
2010-04-26 08:41:24 +00:00
# is the event.h header libev or libevent?
2007-02-16 21:26:10 +00:00
AC_CHECK_HEADERS([event.h],,, [AC_INCLUDES_DEFAULT])
2010-04-26 08:41:24 +00:00
AC_CHECK_DECL(EV_VERSION_MAJOR, [
AC_SEARCH_LIBS(event_set, [ev])
],[
AC_SEARCH_LIBS(event_set, [event])
],[AC_INCLUDES_DEFAULT
#include <event.h>
])
2007-02-16 21:26:10 +00:00
AC_CHECK_FUNCS([event_base_free]) # only in libevent 1.2 and later
2009-02-06 13:42:50 +00:00
AC_CHECK_FUNCS([event_base_once]) # only in libevent 1.4.1 and later
AC_CHECK_FUNCS([event_base_new]) # only in libevent 1.4.1 and later
2008-04-11 13:24:49 +00:00
AC_CHECK_FUNCS([event_base_get_method]) # only in libevent 1.4.3 and later
2009-01-05 15:05:33 +00:00
AC_CHECK_FUNCS([ev_loop]) # only in libev. (tested on 3.51)
2009-03-30 08:47:20 +00:00
if test -n "$BAK_LDFLAGS_SET"; then
2008-01-15 13:19:59 +00:00
LDFLAGS="$BAK_LDFLAGS"
fi
2007-02-16 21:26:10 +00:00
else
AC_DEFINE(USE_MINI_EVENT, 1, [Define if you want to use internal select based events])
fi
2007-01-23 14:16:52 +00:00
2010-09-23 15:28:08 +00:00
# check for libexpat
AC_MSG_CHECKING(for libexpat)
found_libexpat="no"
for dir in /usr/local /opt/local /usr/lib /usr/pkg /usr/sfw /usr; do
if test -f "$dir/include/expat.h"; then
found_libexpat="yes"
dnl assume /usr is in default path.
if test "$dir" != "/usr"; then
CPPFLAGS="$CPPFLAGS -I$dir/include"
LDFLAGS="$LDFLAGS -L$dir/lib"
fi
AC_MSG_RESULT(found in $dir)
break;
fi
done
if test x_$found_libexpat != x_yes; then
AC_ERROR([Could not find libexpat, expat.h])
fi
AC_CHECK_HEADERS([expat.h],,, [AC_INCLUDES_DEFAULT])
2007-06-13 11:14:20 +00:00
# set static linking if requested
AC_SUBST(staticexe)
staticexe=""
AC_ARG_ENABLE(staticexe, AC_HELP_STRING([--enable-static-exe],
[ enable to compile executables statically against event, ldns libs, for debug purposes ]),
, )
if test x_$enable_static_exe = x_yes; then
staticexe="-static"
2009-04-06 08:10:14 +00:00
if test "$on_mingw" = yes; then
staticexe="-all-static"
2009-07-15 13:47:58 +00:00
# for static crosscompile, include gdi32 and zlib here.
if test "`uname`" = "Linux"; then
LIBS="$LIBS -lgdi32 -lz"
fi
2009-04-06 08:10:14 +00:00
fi
2007-06-13 11:14:20 +00:00
fi
2007-08-14 13:33:41 +00:00
# set lock checking if requested
AC_ARG_ENABLE(lock_checks, AC_HELP_STRING([--enable-lock-checks],
[ enable to check lock and unlock calls, for debug purposes ]),
, )
if test x_$enable_lock_checks = x_yes; then
AC_DEFINE(ENABLE_LOCK_CHECKS, 1, [Define if you want to use debug lock checking (slow).])
2008-06-24 09:24:08 +00:00
CHECKLOCK_SRC="testcode/checklocks.c"
AC_SUBST(CHECKLOCK_SRC)
2007-08-14 13:33:41 +00:00
fi
2007-09-05 13:47:23 +00:00
# set memory allocation checking if requested
AC_ARG_ENABLE(alloc-checks, AC_HELP_STRING([--enable-alloc-checks],
2010-03-09 16:26:53 +00:00
[ enable to memory allocation statistics, for debug purposes ]),
, )
AC_ARG_ENABLE(alloc-lite, AC_HELP_STRING([--enable-alloc-lite],
[ enable for lightweight alloc assertions, for debug purposes ]),
2007-09-05 13:47:23 +00:00
, )
2010-03-11 09:35:08 +00:00
AC_ARG_ENABLE(alloc-nonregional, AC_HELP_STRING([--enable-alloc-nonregional],
[ enable nonregional allocs, slow but exposes regional allocations to other memory purifiers, for debug purposes ]),
, )
if test x_$enable_alloc_nonregional = x_yes; then
AC_DEFINE(UNBOUND_ALLOC_NONREGIONAL, 1, [use malloc not regions, for debug use])
fi
2007-09-05 13:47:23 +00:00
if test x_$enable_alloc_checks = x_yes; then
AC_DEFINE(UNBOUND_ALLOC_STATS, 1, [use statistics for allocs and frees, for debug use])
2007-09-05 14:07:53 +00:00
else
2010-03-09 16:26:53 +00:00
if test x_$enable_alloc_lite = x_yes; then
AC_DEFINE(UNBOUND_ALLOC_LITE, 1, [use to enable lightweight alloc assertions, for debug use])
else
ACX_FUNC_MALLOC([unbound])
fi
2007-09-05 13:47:23 +00:00
fi
2009-03-23 18:09:19 +00:00
ACX_CHECK_GETADDRINFO_WITH_INCLUDES
if test "$USE_WINSOCK" = 1; then
AC_DEFINE(UB_ON_WINDOWS, 1, [Use win32 resources and API])
UB_ON_WINDOWS=yes
AC_SUBST(UB_ON_WINDOWS)
2009-09-03 10:19:06 +00:00
AC_CHECK_HEADERS([iphlpapi.h],,, [AC_INCLUDES_DEFAULT
#include <windows.h>
])
2009-07-14 14:44:53 +00:00
AC_CHECK_TOOL(WINDRES, windres)
2009-09-03 10:07:13 +00:00
LIBS="$LIBS -liphlpapi"
2008-05-22 13:30:22 +00:00
fi
if test $ac_cv_func_getaddrinfo = no; then
2009-03-23 18:09:19 +00:00
AC_LIBOBJ([fake-rfc2553])
2009-03-23 11:22:57 +00:00
fi
2010-04-16 09:27:12 +00:00
# check after getaddrinfo for its libraries
ACX_FUNC_IOCTLSOCKET
2009-03-23 11:22:57 +00:00
# see if daemon(3) exists, and if it is deprecated.
AC_CHECK_FUNCS([daemon])
if test $ac_cv_func_daemon = yes; then
2009-03-23 18:09:19 +00:00
ACX_FUNC_DEPRECATED([daemon], [(void)daemon(0, 0);], [
2009-03-23 11:22:57 +00:00
#include <stdlib.h>
])
fi
2009-02-12 08:37:30 +00:00
AC_SEARCH_LIBS([setusercontext], [util])
2010-07-05 14:32:37 +00:00
AC_CHECK_FUNCS([tzset sigprocmask fcntl getpwnam getrlimit setrlimit setsid sbrk chroot kill sleep usleep random srandom recvmsg sendmsg writev socketpair glob initgroups strftime localtime_r setusercontext _beginthreadex])
2010-03-12 09:20:40 +00:00
AC_CHECK_FUNCS([setresuid],,[AC_CHECK_FUNCS([setreuid])])
AC_CHECK_FUNCS([setresgid],,[AC_CHECK_FUNCS([setregid])])
2008-06-13 13:20:54 +00:00
2008-11-07 09:24:39 +00:00
# check if setreuid en setregid fail, on MacOSX10.4(darwin8).
if echo $build_os | grep darwin8 > /dev/null; then
AC_DEFINE(DARWIN_BROKEN_SETREUID, 1, [Define this if on macOSX10.4-darwin8 and setreuid and setregid do not work])
fi
2008-05-22 13:30:22 +00:00
AC_REPLACE_FUNCS(inet_aton)
AC_REPLACE_FUNCS(inet_pton)
AC_REPLACE_FUNCS(inet_ntop)
AC_REPLACE_FUNCS(snprintf)
AC_REPLACE_FUNCS(strlcpy)
AC_REPLACE_FUNCS(memmove)
2008-05-23 14:13:07 +00:00
AC_REPLACE_FUNCS(gmtime_r)
2009-08-25 10:29:25 +00:00
AC_REPLACE_FUNCS(ctime_r)
2008-05-22 13:30:22 +00:00
2007-10-18 13:05:41 +00:00
# check this after all other compilation checks, since the linking of the lib
# may break checks after this.
2009-02-05 14:01:37 +00:00
use_ldns_builtin="no"
AC_ARG_WITH(ldns, AC_HELP_STRING([--with-ldns=PATH],
[specify prefix of path of ldns library to use]),
[ specialldnsdir="$withval"
2009-07-03 19:40:14 +00:00
if test "$withval" != ""; then
CPPFLAGS="-I$withval/include $CPPFLAGS"
LDFLAGS="-L$withval -L$withval/lib $LDFLAGS"
ACX_RUNTIME_PATH_ADD([$withval/lib])
fi
2007-10-18 13:05:41 +00:00
ldnsdir="$withval"
AC_SUBST(ldnsdir)
])
2009-02-05 14:01:37 +00:00
AC_ARG_WITH(ldns-builtin, AC_HELP_STRING([--with-ldns-builtin],
[forces use of package included with this one]), [
use_ldns_builtin="yes"
])
# check if ldns is good enough
if test "$use_ldns_builtin" = "no"; then
2009-03-24 13:55:12 +00:00
AC_CHECK_LIB(ldns, ldns_buffer_copy)
2010-03-11 12:52:58 +00:00
AC_CHECK_FUNC(ldns_key_buf2rsa_raw)
2010-04-28 12:52:03 +00:00
AC_CHECK_FUNC(ldns_b32_ntop_extended_hex)
2010-04-28 19:50:34 +00:00
if test x$use_gost = xyes; then
AC_CHECK_FUNC(ldns_key_EVP_load_gost_id)
2010-06-22 12:27:19 +00:00
AC_CHECK_FUNCS([ldns_key_EVP_unload_gost])
2010-04-28 19:50:34 +00:00
else
ac_cv_func_ldns_key_EVP_load_gost_id="yes"
fi
2010-01-14 14:32:39 +00:00
AC_CHECK_HEADERS([ldns/ldns.h],,, [AC_INCLUDES_DEFAULT])
if test $ac_cv_lib_ldns_ldns_buffer_copy = yes \
2010-03-11 12:52:58 +00:00
-a $ac_cv_func_ldns_key_buf2rsa_raw = yes \
2010-04-28 12:52:03 +00:00
-a $ac_cv_header_ldns_ldns_h = yes \
-a $ac_cv_func_ldns_b32_ntop_extended_hex = yes \
-a $ac_cv_func_ldns_key_EVP_load_gost_id = yes; then
dnl ldns was found
:
2009-03-24 13:55:12 +00:00
else
use_ldns_builtin="yes"
fi
2009-02-05 14:01:37 +00:00
fi
if test "$use_ldns_builtin" = "yes"; then
2007-10-18 13:05:41 +00:00
dnl use the builtin ldns-src.tar.gz file to build ldns.
2007-10-31 08:30:47 +00:00
if test ! -f $srcdir/ldns-src.tar.gz; then
2007-10-18 13:05:41 +00:00
AC_MSG_ERROR([No ldns library found and no ldns-src.tar.gz, use --with-ldns=path.])
fi
echo "****************************************************************"
echo "*** ***"
echo "*** Building ldns library from package included in this one. ***"
echo "*** ***"
echo "****************************************************************"
2008-07-17 08:45:12 +00:00
if test -d $srcdir/ldns-src; then rm -rf $srcdir/ldns-src; fi
mkdir $srcdir/ldns-src; cp $srcdir/ldns-src.tar.gz $srcdir/ldns-src/ldns-src.tar.gz; (cd $srcdir/ldns-src; gzip -cd ldns-src.tar.gz | tar xf -); rm -f $srcdir/ldns-src/ldns-src.tar.gz; mv $srcdir/ldns-src $srcdir/ldns-srcb; mv $srcdir/ldns-srcb/ldns* $srcdir/ldns-src; rmdir $srcdir/ldns-srcb
ldnsdir="ldns-src"
2008-06-02 12:12:13 +00:00
AC_MSG_NOTICE([Configure $ldnsdir scheduled after config.status])
2008-07-17 08:45:12 +00:00
AC_CONFIG_SUBDIRS([ldns-src])
2008-05-19 20:23:45 +00:00
CPPFLAGS="-I$ldnsdir/include $CPPFLAGS"
2008-01-10 11:47:07 +00:00
LDFLAGS="$LDFLAGS $ldnsdir/*.lo"
2007-10-18 13:05:41 +00:00
AC_SUBST(ldnsdir)
2009-02-05 14:01:37 +00:00
fi dnl end of use_ldns_builtin == yes
2009-03-24 10:42:57 +00:00
ACX_STRIP_EXT_FLAGS
2008-02-07 14:09:24 +00:00
LDFLAGS="$LATE_LDFLAGS $LDFLAGS"
2007-10-18 13:05:41 +00:00
2009-09-10 13:13:55 +00:00
AC_DEFINE_UNQUOTED([MAXSYSLOGMSGLEN], [10240], [Define to the maximum message length to pass to syslog.])
2007-01-03 10:42:32 +00:00
2009-03-24 10:42:57 +00:00
AH_BOTTOM(
dnl this must be first AH_CONFIG, to define the flags before any includes.
AHX_CONFIG_EXT_FLAGS
dnl includes
[
2008-01-14 09:51:20 +00:00
#ifndef UNBOUND_DEBUG
# define NDEBUG
#endif
2007-01-03 08:53:52 +00:00
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <assert.h>
#if STDC_HEADERS
#include <stdlib.h>
#include <stddef.h>
#endif
#ifdef HAVE_STDINT_H
#include <stdint.h>
#endif
2007-02-20 15:28:27 +00:00
#include <errno.h>
2007-01-03 08:53:52 +00:00
#if HAVE_SYS_PARAM_H
#include <sys/param.h>
#endif
#ifdef HAVE_SYS_SOCKET_H
#include <sys/socket.h>
#endif
2007-03-29 13:05:47 +00:00
#ifdef HAVE_SYS_UIO_H
#include <sys/uio.h>
#endif
2007-01-03 08:53:52 +00:00
#ifdef HAVE_NETINET_IN_H
#include <netinet/in.h>
#endif
#ifdef HAVE_ARPA_INET_H
#include <arpa/inet.h>
#endif
2007-01-03 10:42:32 +00:00
2008-05-22 13:30:22 +00:00
#ifdef HAVE_WINSOCK2_H
#include <winsock2.h>
#endif
#ifdef HAVE_WS2TCPIP_H
#include <ws2tcpip.h>
#endif
2009-03-24 10:42:57 +00:00
]
AHX_CONFIG_FORMAT_ATTRIBUTE
AHX_CONFIG_UNUSED_ATTRIBUTE
AHX_CONFIG_FSEEKO
AHX_CONFIG_MAXHOSTNAMELEN
AHX_CONFIG_SNPRINTF(unbound)
AHX_CONFIG_INET_PTON(unbound)
AHX_CONFIG_INET_NTOP(unbound)
AHX_CONFIG_INET_ATON(unbound)
AHX_CONFIG_MEMMOVE(unbound)
AHX_CONFIG_STRLCPY(unbound)
AHX_CONFIG_GMTIME_R(unbound)
AHX_CONFIG_W32_SLEEP
AHX_CONFIG_W32_USLEEP
AHX_CONFIG_W32_RANDOM
AHX_CONFIG_W32_SRANDOM
AHX_CONFIG_W32_FD_SET_T
AHX_CONFIG_IPV6_MIN_MTU
2010-02-01 13:27:23 +00:00
AHX_MEMCMP_BROKEN(unbound)
2009-03-24 10:42:57 +00:00
[
2009-08-25 13:05:31 +00:00
#ifndef HAVE_CTIME_R
#define ctime_r unbound_ctime_r
char *ctime_r(const time_t *timep, char *buf);
#endif
2007-03-02 09:48:31 +00:00
#if defined(HAVE_EVENT_H) && !defined(HAVE_EVENT_BASE_ONCE) && (defined(HAVE_PTHREAD) || defined(HAVE_SOLARIS_THREADS))
/* using version of libevent that is not threadsafe. */
# define LIBEVENT_SIGNAL_PROBLEM 1
#endif
2007-01-03 10:42:32 +00:00
2007-02-16 23:00:31 +00:00
#ifndef CHECKED_INET6
# define CHECKED_INET6
# ifdef AF_INET6
# define INET6
# else
# define AF_INET6 28
# endif
#endif /* CHECKED_INET6 */
2007-02-16 15:18:52 +00:00
2007-02-20 15:28:27 +00:00
/* maximum nesting of included files */
#define MAXINCLUDES 10
2007-02-16 15:33:57 +00:00
#ifndef HAVE_GETADDRINFO
2007-02-16 15:53:45 +00:00
struct sockaddr_storage;
2007-02-16 15:33:57 +00:00
#include "compat/fake-rfc2553.h"
#endif
2008-06-13 13:20:54 +00:00
2007-08-10 09:07:19 +00:00
#ifdef UNBOUND_ALLOC_STATS
2007-08-14 13:15:36 +00:00
# define malloc(s) unbound_stat_malloc_log(s, __FILE__, __LINE__, __func__)
# define calloc(n,s) unbound_stat_calloc_log(n, s, __FILE__, __LINE__, __func__)
# define free(p) unbound_stat_free_log(p, __FILE__, __LINE__, __func__)
# define realloc(p,s) unbound_stat_realloc_log(p, s, __FILE__, __LINE__, __func__)
2007-08-10 09:07:19 +00:00
void *unbound_stat_malloc(size_t size);
void *unbound_stat_calloc(size_t nmemb, size_t size);
void unbound_stat_free(void *ptr);
void *unbound_stat_realloc(void *ptr, size_t size);
2007-08-14 13:15:36 +00:00
void *unbound_stat_malloc_log(size_t size, const char* file, int line,
const char* func);
void *unbound_stat_calloc_log(size_t nmemb, size_t size, const char* file,
int line, const char* func);
void unbound_stat_free_log(void *ptr, const char* file, int line,
const char* func);
void *unbound_stat_realloc_log(void *ptr, size_t size, const char* file,
int line, const char* func);
2010-03-09 16:26:53 +00:00
#elif defined(UNBOUND_ALLOC_LITE)
# include "util/alloc.h"
#endif /* UNBOUND_ALLOC_LITE and UNBOUND_ALLOC_STATS */
2007-08-10 09:07:19 +00:00
2007-02-22 13:36:29 +00:00
/** default port for DNS traffic. */
#define UNBOUND_DNS_PORT 53
2007-01-03 08:53:52 +00:00
])
2010-09-23 13:51:29 +00:00
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])
2007-01-03 08:53:52 +00:00
AC_CONFIG_HEADER([config.h])
AC_OUTPUT