Neater configure and no double config.h includes.

git-svn-id: file:///svn/unbound/trunk@1545 be551aaa-1e26-0410-a405-d3ace91eadb9
This commit is contained in:
Wouter Wijngaards 2009-03-24 10:42:57 +00:00
parent ee8465d887
commit a30d1f9f20
15 changed files with 384 additions and 223 deletions

View File

@ -32,28 +32,33 @@
# ACX_CHECK_NONBLOCKING_BROKEN - see if nonblocking sockets really work.
# ACX_MKDIR_ONE_ARG - determine mkdir(2) number of arguments.
# ACX_FUNC_IOCTLSOCKET - find ioctlsocket, portably.
# AHX_BOTTOM_FORMAT_ATTRIBUTE - config.h text for format.
# AHX_BOTTOM_UNUSED_ATTRIBUTE - config.h text for unused.
# AHX_BOTTOM_FSEEKO - define fseeko, ftello fallback.
# AHX_BOTTOM_RAND_MAX - define RAND_MAX if needed.
# AHX_BOTTOM_MAXHOSTNAMELEN - define MAXHOSTNAMELEN if needed.
# AHX_BOTTOM_IPV6_MIN_MTU - define IPV6_MIN_MTU if needed.
# AHX_BOTTOM_SNPRINTF - snprintf compat prototype
# AHX_BOTTOM_INET_PTON - inet_pton compat prototype
# AHX_BOTTOM_INET_NTOP - inet_ntop compat prototype
# AHX_BOTTOM_INET_ATON - inet_aton compat prototype
# AHX_BOTTOM_MEMMOVE - memmove compat prototype
# AHX_BOTTOM_STRLCPY - strlcpy compat prototype
# AHX_BOTTOM_GMTIME_R - gmtime_r compat prototype
# AHX_BOTTOM_W32_SLEEP - w32 compat for sleep
# AHX_BOTTOM_W32_USLEEP - w32 compat for usleep
# AHX_BOTTOM_W32_RANDOM - w32 compat for random
# AHX_BOTTOM_W32_SRANDOM - w32 compat for srandom
# AHX_BOTTOM_W32_FD_SET_T - w32 detection of FD_SET_T.
# AHX_CONFIG_FORMAT_ATTRIBUTE - config.h text for format.
# AHX_CONFIG_UNUSED_ATTRIBUTE - config.h text for unused.
# AHX_CONFIG_FSEEKO - define fseeko, ftello fallback.
# AHX_CONFIG_RAND_MAX - define RAND_MAX if needed.
# AHX_CONFIG_MAXHOSTNAMELEN - define MAXHOSTNAMELEN if needed.
# AHX_CONFIG_IPV6_MIN_MTU - define IPV6_MIN_MTU if needed.
# AHX_CONFIG_SNPRINTF - snprintf compat prototype
# AHX_CONFIG_INET_PTON - inet_pton compat prototype
# AHX_CONFIG_INET_NTOP - inet_ntop compat prototype
# AHX_CONFIG_INET_ATON - inet_aton compat prototype
# AHX_CONFIG_MEMMOVE - memmove compat prototype
# AHX_CONFIG_STRLCPY - strlcpy compat prototype
# AHX_CONFIG_GMTIME_R - gmtime_r compat prototype
# AHX_CONFIG_W32_SLEEP - w32 compat for sleep
# AHX_CONFIG_W32_USLEEP - w32 compat for usleep
# AHX_CONFIG_W32_RANDOM - w32 compat for random
# AHX_CONFIG_W32_SRANDOM - w32 compat for srandom
# AHX_CONFIG_W32_FD_SET_T - w32 detection of FD_SET_T.
# ACX_CFLAGS_STRIP - strip one flag from CFLAGS
# ACX_STRIP_EXT_FLAGS - strip extension flags from CFLAGS
# AHX_CONFIG_FLAG_OMITTED - define omitted flag
# AHX_CONFIG_FLAG_EXT - define omitted extension flag
# AHX_CONFIG_EXT_FLAGS - define the stripped extension flags
#
dnl Escape backslashes as \\, for C:\ paths, for the C preprocessor defines.
dnl for example, NLX_ESCAPE_BACKSLASH($from_var, to_var)
dnl for example, ACX_ESCAPE_BACKSLASH($from_var, to_var)
dnl $1: the text to change.
dnl $2: the result.
AC_DEFUN(ACX_ESCAPE_BACKSLASH, $2="`echo $1 | sed -e 's/\\\\/\\\\\\\\/g'`" )
@ -353,11 +358,11 @@ int test() {
}
], [CFLAGS="$CFLAGS -D__EXTENSIONS__"])
])
])dnl End of ACX_DETERMINE_EXT_FLAGS_UNBOUND
dnl Check the printf-format attribute (if any)
dnl result in HAVE_ATTR_FORMAT.
dnl Make sure you also include the AHX_BOTTOM_FORMAT_ATTRIBUTE.
dnl Make sure you also include the AHX_CONFIG_FORMAT_ATTRIBUTE.
AC_DEFUN([ACX_CHECK_FORMAT_ATTRIBUTE],
[AC_REQUIRE([AC_PROG_CC])
AC_MSG_CHECKING(whether the C compiler (${CC-cc}) accepts the "format" attribute)
@ -382,19 +387,19 @@ fi
dnl Setup ATTR_FORMAT config.h parts.
dnl make sure you call ACX_CHECK_FORMAT_ATTRIBUTE also.
AC_DEFUN(AHX_BOTTOM_FORMAT_ATTRIBUTE,
[ AH_BOTTOM([
AC_DEFUN(AHX_CONFIG_FORMAT_ATTRIBUTE,
[
#ifdef HAVE_ATTR_FORMAT
# define ATTR_FORMAT(archetype, string_index, first_to_check) \
__attribute__ ((format (archetype, string_index, first_to_check)))
#else /* !HAVE_ATTR_FORMAT */
# define ATTR_FORMAT(archetype, string_index, first_to_check) /* empty */
#endif /* !HAVE_ATTR_FORMAT */
]) ])
])
dnl Check how to mark function arguments as unused.
dnl result in HAVE_ATTR_UNUSED.
dnl Make sure you include AHX_BOTTOM_UNUSED_ATTRIBUTE also.
dnl Make sure you include AHX_CONFIG_UNUSED_ATTRIBUTE also.
AC_DEFUN([ACX_CHECK_UNUSED_ATTRIBUTE],
[AC_REQUIRE([AC_PROG_CC])
AC_MSG_CHECKING(whether the C compiler (${CC-cc}) accepts the "unused" attribute)
@ -412,8 +417,8 @@ void f (char *u __attribute__((unused)));
dnl Setup ATTR_UNUSED config.h parts.
dnl make sure you call ACX_CHECK_UNUSED_ATTRIBUTE also.
AC_DEFUN(AHX_BOTTOM_UNUSED_ATTRIBUTE,
[AH_BOTTOM([
AC_DEFUN(AHX_CONFIG_UNUSED_ATTRIBUTE,
[
#if defined(DOXYGEN)
# define ATTR_UNUSED(x) x
#elif defined(__cplusplus)
@ -423,7 +428,7 @@ AC_DEFUN(AHX_BOTTOM_UNUSED_ATTRIBUTE,
#else /* !HAVE_ATTR_UNUSED */
# define ATTR_UNUSED(x) x
#endif /* !HAVE_ATTR_UNUSED */
]) ])
])
AC_MSG_RESULT($ac_cv_c_unused_attribute)
if test $ac_cv_c_unused_attribute = yes; then
@ -900,42 +905,42 @@ AC_DEFINE(HAVE_IOCTLSOCKET, 1, [if the function 'ioctlsocket' is available])
])dnl end of ACX_FUNC_IOCTLSOCKET
dnl Define fallback for fseeko and ftello if needed.
AC_DEFUN(AHX_BOTTOM_FSEEKO,
[ AH_BOTTOM([
AC_DEFUN(AHX_CONFIG_FSEEKO,
[
#ifndef HAVE_FSEEKO
#define fseeko fseek
#define ftello ftell
#endif /* HAVE_FSEEKO */
]) ])
])
dnl Define RAND_MAX if not defined
AC_DEFUN(AHX_BOTTOM_RAND_MAX,
[ AH_BOTTOM([
AC_DEFUN(AHX_CONFIG_RAND_MAX,
[
#ifndef RAND_MAX
#define RAND_MAX 2147483647
#endif
]) ])
])
dnl Define MAXHOSTNAMELEN if not defined
AC_DEFUN(AHX_BOTTOM_MAXHOSTNAMELEN,
[ AH_BOTTOM([
AC_DEFUN(AHX_CONFIG_MAXHOSTNAMELEN,
[
#ifndef MAXHOSTNAMELEN
#define MAXHOSTNAMELEN 256
#endif
]) ])
])
dnl Define IPV6_MIN_MTU if not defined
AC_DEFUN(AHX_BOTTOM_IPV6_MIN_MTU,
[ AH_BOTTOM([
AC_DEFUN(AHX_CONFIG_IPV6_MIN_MTU,
[
#ifndef IPV6_MIN_MTU
#define IPV6_MIN_MTU 1280
#endif /* IPV6_MIN_MTU */
]) ])
])
dnl provide snprintf, vsnprintf compat prototype
dnl $1: unique name for compat code
AC_DEFUN(AHX_BOTTOM_SNPRINTF,
[ AH_BOTTOM([
AC_DEFUN(AHX_CONFIG_SNPRINTF,
[
#ifndef HAVE_SNPRINTF
#define snprintf snprintf_$1
#define vsnprintf vsnprintf_$1
@ -943,109 +948,164 @@ AC_DEFUN(AHX_BOTTOM_SNPRINTF,
int snprintf (char *str, size_t count, const char *fmt, ...);
int vsnprintf (char *str, size_t count, const char *fmt, va_list arg);
#endif /* HAVE_SNPRINTF */
]) ])
])
dnl provide inet_pton compat prototype.
dnl $1: unique name for compat code
AC_DEFUN(AHX_BOTTOM_INET_PTON,
[ AH_BOTTOM([
AC_DEFUN(AHX_CONFIG_INET_PTON,
[
#ifndef HAVE_INET_PTON
#define inet_pton inet_pton_$1
int inet_pton(int af, const char* src, void* dst);
#endif /* HAVE_INET_PTON */
]) ])
])
dnl provide inet_ntop compat prototype.
dnl $1: unique name for compat code
AC_DEFUN(AHX_BOTTOM_INET_NTOP,
[ AH_BOTTOM([
AC_DEFUN(AHX_CONFIG_INET_NTOP,
[
#ifndef HAVE_INET_NTOP
#define inet_ntop inet_ntop_$1
const char *inet_ntop(int af, const void *src, char *dst, size_t size);
#endif
]) ])
])
dnl provide inet_aton compat prototype.
dnl $1: unique name for compat code
AC_DEFUN(AHX_BOTTOM_INET_ATON,
[ AH_BOTTOM([
AC_DEFUN(AHX_CONFIG_INET_ATON,
[
#ifndef HAVE_INET_ATON
#define inet_aton inet_aton_$1
int inet_aton(const char *cp, struct in_addr *addr);
#endif
]) ])
])
dnl provide memmove compat prototype.
dnl $1: unique name for compat code
AC_DEFUN(AHX_BOTTOM_MEMMOVE,
[ AH_BOTTOM([
AC_DEFUN(AHX_CONFIG_MEMMOVE,
[
#ifndef HAVE_MEMMOVE
#define memmove memmove_$1
void *memmove(void *dest, const void *src, size_t n);
#endif
]) ])
])
dnl provide strlcpy compat prototype.
dnl $1: unique name for compat code
AC_DEFUN(AHX_BOTTOM_STRLCPY,
[ AH_BOTTOM([
AC_DEFUN(AHX_CONFIG_STRLCPY,
[
#ifndef HAVE_STRLCPY
#define strlcpy strlcpy_$1
size_t strlcpy(char *dst, const char *src, size_t siz);
#endif
]) ])
])
dnl provide gmtime_r compat prototype.
dnl $1: unique name for compat code
AC_DEFUN(AHX_BOTTOM_GMTIME_R,
[ AH_BOTTOM([
AC_DEFUN(AHX_CONFIG_GMTIME_R,
[
#ifndef HAVE_GMTIME_R
#define gmtime_r gmtime_r_$1
struct tm *gmtime_r(const time_t *timep, struct tm *result);
#endif
]) ])
])
dnl provide w32 compat definition for sleep
AC_DEFUN(AHX_BOTTOM_W32_SLEEP,
[ AH_BOTTOM([
AC_DEFUN(AHX_CONFIG_W32_SLEEP,
[
#ifndef HAVE_SLEEP
#define sleep(x) Sleep((x)*1000) /* on win32 */
#endif /* HAVE_SLEEP */
]) ])
])
dnl provide w32 compat definition for usleep
AC_DEFUN(AHX_BOTTOM_W32_USLEEP,
[ AH_BOTTOM([
AC_DEFUN(AHX_CONFIG_W32_USLEEP,
[
#ifndef HAVE_USLEEP
#define usleep(x) Sleep((x)/1000 + 1) /* on win32 */
#endif /* HAVE_USLEEP */
]) ])
])
dnl provide w32 compat definition for random
AC_DEFUN(AHX_BOTTOM_W32_RANDOM,
[ AH_BOTTOM([
AC_DEFUN(AHX_CONFIG_W32_RANDOM,
[
#ifndef HAVE_RANDOM
#define random rand /* on win32, for tests only (bad random) */
#endif /* HAVE_RANDOM */
]) ])
])
dnl provide w32 compat definition for srandom
AC_DEFUN(AHX_BOTTOM_W32_SRANDOM,
[ AH_BOTTOM([
AC_DEFUN(AHX_CONFIG_W32_SRANDOM,
[
#ifndef HAVE_SRANDOM
#define srandom(x) srand(x) /* on win32, for tests only (bad random) */
#endif /* HAVE_SRANDOM */
]) ])
])
dnl provide w32 compat definition for FD_SET_T
AC_DEFUN(AHX_BOTTOM_W32_FD_SET_T,
[ AH_BOTTOM([
AC_DEFUN(AHX_CONFIG_W32_FD_SET_T,
[
/* detect if we need to cast to unsigned int for FD_SET to avoid warnings */
#ifdef HAVE_WINSOCK2_H
#define FD_SET_T (u_int)
#else
#define FD_SET_T
#endif
]) ])
])
dnl Remove an extension flag from CFLAGS, define replacement to be made.
dnl Used by ACX_STRIP_EXT_FLAGS.
dnl $1: the name of the flag, for example -D_GNU_SOURCE.
AC_DEFUN(ACX_CFLAGS_STRIP,
[
if echo $CFLAGS | grep " $1" >/dev/null 2>&1; then
CFLAGS="`echo $CFLAGS | sed -e 's/ $1//g'`"
AC_DEFINE(AS_TR_CPP(OMITTED_$1), 1, Put $1 define in config.h)
fi
])
dnl Remove EXT flags from the CFLAGS and set them to be defined in config.h
dnl use with ACX_DETERMINE_EXT_FLAGS.
AC_DEFUN(ACX_STRIP_EXT_FLAGS,
[
AC_MSG_NOTICE([Stripping extension flags...])
ACX_CFLAGS_STRIP(-D_GNU_SOURCE)
ACX_CFLAGS_STRIP(-D_BSD_SOURCE)
ACX_CFLAGS_STRIP(-D__EXTENSIONS__)
ACX_CFLAGS_STRIP(-D_POSIX_C_SOURCE=200112)
ACX_CFLAGS_STRIP(-D_XOPEN_SOURCE=600)
ACX_CFLAGS_STRIP(-D_XOPEN_SOURCE_EXTENDED=1)
ACX_CFLAGS_STRIP(-D_ALL_SOURCE)
ACX_CFLAGS_STRIP(-std=c99)
ACX_CFLAGS_STRIP(-D_LARGEFILE_SOURCE=1)
]) dnl End of ACX_STRIP_EXT_FLAGS
dnl define one omitted flag for config.h
dnl $1: flag name. -D_GNU_SOURCE
dnl $2: replacement define. _GNU_SOURCE
dnl $3: define value, 1
AC_DEFUN(AHX_CONFIG_FLAG_OMITTED,
[#if defined($1) && !defined($2)
#define $2 $3
[#]endif ])
dnl Wrapper for AHX_CONFIG_FLAG_OMITTED for -D style flags
dnl $1: the -DNAME or -DNAME=value string.
AC_DEFUN(AHX_CONFIG_FLAG_EXT,
[AHX_CONFIG_FLAG_OMITTED(AS_TR_CPP(OMITTED_$1),m4_bpatsubst(m4_bpatsubst($1,-D,),=.*$,),m4_if(m4_bregexp($1,=),-1,1,m4_bpatsubst($1,^.*=,)))
])
dnl config.h part to define omitted cflags, use with ACX_STRIP_EXT_FLAGS.
AC_DEFUN(AHX_CONFIG_EXT_FLAGS,
[AHX_CONFIG_FLAG_EXT(-D_GNU_SOURCE)
AHX_CONFIG_FLAG_EXT(-D_BSD_SOURCE)
AHX_CONFIG_FLAG_EXT(-D__EXTENSIONS__)
AHX_CONFIG_FLAG_EXT(-D_POSIX_C_SOURCE=200112)
AHX_CONFIG_FLAG_EXT(-D_XOPEN_SOURCE=600)
AHX_CONFIG_FLAG_EXT(-D_XOPEN_SOURCE_EXTENDED=1)
AHX_CONFIG_FLAG_EXT(-D_ALL_SOURCE)
AHX_CONFIG_FLAG_OMITTED(AS_TR_CPP(OMITTED_-std=c99),_STDC_C99,1)
AHX_CONFIG_FLAG_EXT(-D_LARGEFILE_SOURCE=1)
])
dnl End of file

View File

@ -315,6 +315,33 @@
lower performance). */
#undef NONBLOCKING_IS_BROKEN
/* Put -D_ALL_SOURCE define in config.h */
#undef OMITTED__D_ALL_SOURCE
/* Put -D_BSD_SOURCE define in config.h */
#undef OMITTED__D_BSD_SOURCE
/* Put -D_GNU_SOURCE define in config.h */
#undef OMITTED__D_GNU_SOURCE
/* Put -D_LARGEFILE_SOURCE=1 define in config.h */
#undef OMITTED__D_LARGEFILE_SOURCE_1
/* Put -D_POSIX_C_SOURCE=200112 define in config.h */
#undef OMITTED__D_POSIX_C_SOURCE_200112
/* Put -D_XOPEN_SOURCE=600 define in config.h */
#undef OMITTED__D_XOPEN_SOURCE_600
/* Put -D_XOPEN_SOURCE_EXTENDED=1 define in config.h */
#undef OMITTED__D_XOPEN_SOURCE_EXTENDED_1
/* Put -D__EXTENSIONS__ define in config.h */
#undef OMITTED__D__EXTENSIONS__
/* Put -std=c99 define in config.h */
#undef OMITTED__STD_C99
/* Define to the address where bug reports for this package should be sent. */
#undef PACKAGE_BUGREPORT
@ -485,6 +512,43 @@
/* Define as `fork' if `vfork' does not work. */
#undef vfork
#if defined(OMITTED__D_GNU_SOURCE) && !defined(_GNU_SOURCE)
#define _GNU_SOURCE 1
#endif
#if defined(OMITTED__D_BSD_SOURCE) && !defined(_BSD_SOURCE)
#define _BSD_SOURCE 1
#endif
#if defined(OMITTED__D__EXTENSIONS__) && !defined(__EXTENSIONS__)
#define __EXTENSIONS__ 1
#endif
#if defined(OMITTED__D_POSIX_C_SOURCE_200112) && !defined(_POSIX_C_SOURCE)
#define _POSIX_C_SOURCE 200112
#endif
#if defined(OMITTED__D_XOPEN_SOURCE_600) && !defined(_XOPEN_SOURCE)
#define _XOPEN_SOURCE 600
#endif
#if defined(OMITTED__D_XOPEN_SOURCE_EXTENDED_1) && !defined(_XOPEN_SOURCE_EXTENDED)
#define _XOPEN_SOURCE_EXTENDED 1
#endif
#if defined(OMITTED__D_ALL_SOURCE) && !defined(_ALL_SOURCE)
#define _ALL_SOURCE 1
#endif
#if defined(OMITTED__STD_C99) && !defined(_STDC_C99)
#define _STDC_C99 1
#endif
#if defined(OMITTED__D_LARGEFILE_SOURCE_1) && !defined(_LARGEFILE_SOURCE)
#define _LARGEFILE_SOURCE 1
#endif
#ifndef UNBOUND_DEBUG
# define NDEBUG
@ -547,6 +611,62 @@
#endif
#ifdef HAVE_ATTR_FORMAT
# define ATTR_FORMAT(archetype, string_index, first_to_check) \
__attribute__ ((format (archetype, string_index, first_to_check)))
#else /* !HAVE_ATTR_FORMAT */
# define ATTR_FORMAT(archetype, string_index, first_to_check) /* empty */
#endif /* !HAVE_ATTR_FORMAT */
#if defined(DOXYGEN)
# define ATTR_UNUSED(x) x
#elif defined(__cplusplus)
# define ATTR_UNUSED(x)
#elif defined(HAVE_ATTR_UNUSED)
# define ATTR_UNUSED(x) x __attribute__((unused))
#else /* !HAVE_ATTR_UNUSED */
# define ATTR_UNUSED(x) x
#endif /* !HAVE_ATTR_UNUSED */
#ifndef HAVE_FSEEKO
#define fseeko fseek
#define ftello ftell
#endif /* HAVE_FSEEKO */
#ifndef RAND_MAX
#define RAND_MAX 2147483647
#endif
#ifndef MAXHOSTNAMELEN
#define MAXHOSTNAMELEN 256
#endif
#ifndef HAVE_SNPRINTF
#define snprintf snprintf_unbound
#define vsnprintf vsnprintf_unbound
#include <stdarg.h>
int snprintf (char *str, size_t count, const char *fmt, ...);
int vsnprintf (char *str, size_t count, const char *fmt, va_list arg);
#endif /* HAVE_SNPRINTF */
#ifndef HAVE_INET_PTON
#define inet_pton inet_pton_unbound
int inet_pton(int af, const char* src, void* dst);
#endif /* HAVE_INET_PTON */
#ifndef HAVE_INET_NTOP
#define inet_ntop inet_ntop_unbound
const char *inet_ntop(int af, const void *src, char *dst, size_t size);
#endif
#ifndef HAVE_INET_ATON
#define inet_aton inet_aton_unbound
@ -554,52 +674,44 @@ int inet_aton(const char *cp, struct in_addr *addr);
#endif
#ifndef HAVE_MEMMOVE
#define memmove memmove_unbound
void *memmove(void *dest, const void *src, size_t n);
#endif
#ifndef HAVE_STRLCPY
#define strlcpy strlcpy_unbound
size_t strlcpy(char *dst, const char *src, size_t siz);
#endif
#ifndef HAVE_GMTIME_R
#define gmtime_r gmtime_r_unbound
struct tm *gmtime_r(const time_t *timep, struct tm *result);
#endif
#ifndef HAVE_SLEEP
#define sleep(x) Sleep((x)*1000) /* on win32 */
#endif /* HAVE_SLEEP */
#ifndef HAVE_USLEEP
#define usleep(x) Sleep((x)/1000 + 1) /* on win32 */
#endif /* HAVE_USLEEP */
#ifndef HAVE_RANDOM
#define random rand /* on win32, for tests only (bad random) */
#endif /* HAVE_RANDOM */
#ifndef HAVE_SRANDOM
#define srandom(x) srand(x) /* on win32, for tests only (bad random) */
#endif /* HAVE_SRANDOM */
/* detect if we need to cast to unsigned int for FD_SET to avoid warnings */
#ifdef HAVE_WINSOCK2_H
#define FD_SET_T (u_int)
@ -608,22 +720,12 @@ struct tm *gmtime_r(const time_t *timep, struct tm *result);
#endif
#ifndef IPV6_MIN_MTU
#define IPV6_MIN_MTU 1280
#endif /* IPV6_MIN_MTU */
#ifdef HAVE_ATTR_FORMAT
# define ATTR_FORMAT(archetype, string_index, first_to_check) \
__attribute__ ((format (archetype, string_index, first_to_check)))
#else /* !HAVE_ATTR_FORMAT */
# define ATTR_FORMAT(archetype, string_index, first_to_check) /* empty */
#endif /* !HAVE_ATTR_FORMAT */
#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
@ -669,58 +771,3 @@ void *unbound_stat_realloc_log(void *ptr, size_t size, const char* file,
/** default port for DNS traffic. */
#define UNBOUND_DNS_PORT 53
#if defined(DOXYGEN)
# define ATTR_UNUSED(x) x
#elif defined(__cplusplus)
# define ATTR_UNUSED(x)
#elif defined(HAVE_ATTR_UNUSED)
# define ATTR_UNUSED(x) x __attribute__((unused))
#else /* !HAVE_ATTR_UNUSED */
# define ATTR_UNUSED(x) x
#endif /* !HAVE_ATTR_UNUSED */
#ifndef HAVE_FSEEKO
#define fseeko fseek
#define ftello ftell
#endif /* HAVE_FSEEKO */
#ifndef RAND_MAX
#define RAND_MAX 2147483647
#endif
#ifndef MAXHOSTNAMELEN
#define MAXHOSTNAMELEN 256
#endif
#ifndef HAVE_SNPRINTF
#define snprintf snprintf_unbound
#define vsnprintf vsnprintf_unbound
#include <stdarg.h>
int snprintf (char *str, size_t count, const char *fmt, ...);
int vsnprintf (char *str, size_t count, const char *fmt, va_list arg);
#endif /* HAVE_SNPRINTF */
#ifndef HAVE_INET_PTON
#define inet_pton inet_pton_unbound
int inet_pton(int af, const char* src, void* dst);
#endif /* HAVE_INET_PTON */
#ifndef HAVE_INET_NTOP
#define inet_ntop inet_ntop_unbound
const char *inet_ntop(int af, const void *src, char *dst, size_t size);
#endif

133
configure vendored
View File

@ -27667,6 +27667,100 @@ CPPFLAGS="-I$ldnsdir/include $CPPFLAGS"
LDFLAGS="$LDFLAGS $ldnsdir/*.lo"
fi
{ echo "$as_me:$LINENO: Stripping extension flags..." >&5
echo "$as_me: Stripping extension flags..." >&6;}
if echo $CFLAGS | grep " -D_GNU_SOURCE" >/dev/null 2>&1; then
CFLAGS="`echo $CFLAGS | sed -e 's/ -D_GNU_SOURCE//g'`"
cat >>confdefs.h <<\_ACEOF
#define OMITTED__D_GNU_SOURCE 1
_ACEOF
fi
if echo $CFLAGS | grep " -D_BSD_SOURCE" >/dev/null 2>&1; then
CFLAGS="`echo $CFLAGS | sed -e 's/ -D_BSD_SOURCE//g'`"
cat >>confdefs.h <<\_ACEOF
#define OMITTED__D_BSD_SOURCE 1
_ACEOF
fi
if echo $CFLAGS | grep " -D__EXTENSIONS__" >/dev/null 2>&1; then
CFLAGS="`echo $CFLAGS | sed -e 's/ -D__EXTENSIONS__//g'`"
cat >>confdefs.h <<\_ACEOF
#define OMITTED__D__EXTENSIONS__ 1
_ACEOF
fi
if echo $CFLAGS | grep " -D_POSIX_C_SOURCE=200112" >/dev/null 2>&1; then
CFLAGS="`echo $CFLAGS | sed -e 's/ -D_POSIX_C_SOURCE=200112//g'`"
cat >>confdefs.h <<\_ACEOF
#define OMITTED__D_POSIX_C_SOURCE_200112 1
_ACEOF
fi
if echo $CFLAGS | grep " -D_XOPEN_SOURCE=600" >/dev/null 2>&1; then
CFLAGS="`echo $CFLAGS | sed -e 's/ -D_XOPEN_SOURCE=600//g'`"
cat >>confdefs.h <<\_ACEOF
#define OMITTED__D_XOPEN_SOURCE_600 1
_ACEOF
fi
if echo $CFLAGS | grep " -D_XOPEN_SOURCE_EXTENDED=1" >/dev/null 2>&1; then
CFLAGS="`echo $CFLAGS | sed -e 's/ -D_XOPEN_SOURCE_EXTENDED=1//g'`"
cat >>confdefs.h <<\_ACEOF
#define OMITTED__D_XOPEN_SOURCE_EXTENDED_1 1
_ACEOF
fi
if echo $CFLAGS | grep " -D_ALL_SOURCE" >/dev/null 2>&1; then
CFLAGS="`echo $CFLAGS | sed -e 's/ -D_ALL_SOURCE//g'`"
cat >>confdefs.h <<\_ACEOF
#define OMITTED__D_ALL_SOURCE 1
_ACEOF
fi
if echo $CFLAGS | grep " -std=c99" >/dev/null 2>&1; then
CFLAGS="`echo $CFLAGS | sed -e 's/ -std=c99//g'`"
cat >>confdefs.h <<\_ACEOF
#define OMITTED__STD_C99 1
_ACEOF
fi
if echo $CFLAGS | grep " -D_LARGEFILE_SOURCE=1" >/dev/null 2>&1; then
CFLAGS="`echo $CFLAGS | sed -e 's/ -D_LARGEFILE_SOURCE=1//g'`"
cat >>confdefs.h <<\_ACEOF
#define OMITTED__D_LARGEFILE_SOURCE_1 1
_ACEOF
fi
LDFLAGS="$LATE_LDFLAGS $LDFLAGS"
@ -27678,45 +27772,6 @@ _ACEOF
ac_config_files="$ac_config_files Makefile doc/example.conf doc/libunbound.3 doc/unbound.8 doc/unbound-checkconf.8 doc/unbound.conf.5 doc/unbound-control.8"
ac_config_headers="$ac_config_headers config.h"

View File

@ -447,11 +447,17 @@ LDFLAGS="$LDFLAGS $ldnsdir/*.lo"
AC_SUBST(ldnsdir)
fi dnl end of use_ldns_builtin == yes
ACX_STRIP_EXT_FLAGS
LDFLAGS="$LATE_LDFLAGS $LDFLAGS"
AC_DEFINE_UNQUOTED([MAXSYSLOGMSGLEN], [5120], [Define to the maximum message length to pass to syslog.])
AH_BOTTOM([
AH_BOTTOM(
dnl this must be first AH_CONFIG, to define the flags before any includes.
AHX_CONFIG_EXT_FLAGS
dnl includes
[
#ifndef UNBOUND_DEBUG
# define NDEBUG
#endif
@ -511,27 +517,28 @@ AH_BOTTOM([
#ifdef HAVE_OPENSSL_RAND_H
#include <openssl/rand.h>
#endif
])
AHX_BOTTOM_FORMAT_ATTRIBUTE
AHX_BOTTOM_UNUSED_ATTRIBUTE
AHX_BOTTOM_FSEEKO
AHX_BOTTOM_RAND_MAX
AHX_BOTTOM_MAXHOSTNAMELEN
AHX_BOTTOM_SNPRINTF(unbound)
AHX_BOTTOM_INET_PTON(unbound)
AHX_BOTTOM_INET_NTOP(unbound)
AHX_BOTTOM_INET_ATON(unbound)
AHX_BOTTOM_MEMMOVE(unbound)
AHX_BOTTOM_STRLCPY(unbound)
AHX_BOTTOM_GMTIME_R(unbound)
AHX_BOTTOM_W32_SLEEP
AHX_BOTTOM_W32_USLEEP
AHX_BOTTOM_W32_RANDOM
AHX_BOTTOM_W32_SRANDOM
AHX_BOTTOM_W32_FD_SET_T
AHX_BOTTOM_IPV6_MIN_MTU
]
AH_BOTTOM([
AHX_CONFIG_FORMAT_ATTRIBUTE
AHX_CONFIG_UNUSED_ATTRIBUTE
AHX_CONFIG_FSEEKO
AHX_CONFIG_RAND_MAX
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
[
#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

View File

@ -43,7 +43,6 @@
#ifndef DAEMON_WORKER_H
#define DAEMON_WORKER_H
#include "config.h"
#include "util/netevent.h"
#include "util/locks.h"
#include "util/alloc.h"

View File

@ -1,3 +1,6 @@
24 March 2009: Wouter
- more neat configure.ac. Removed duplicate config.h includes.
23 March 2009: Wouter
- added launchd plist example file for MacOSX to contrib.
- deprecation test for daemon(3).

View File

@ -38,7 +38,7 @@
*
* This file has functions to get queries from clients.
*/
#include "config.h"
#include "services/listen_dnsport.h"
#include "services/outside_network.h"
#include "util/netevent.h"

View File

@ -42,7 +42,6 @@
#ifndef LISTEN_DNSPORT_H
#define LISTEN_DNSPORT_H
#include "config.h"
#include "util/netevent.h"
struct listen_list;
struct config_file;

View File

@ -39,7 +39,7 @@
* This file has functions to send queries to authoritative servers and
* wait for the pending answer events.
*/
#include "config.h"
#include "services/outside_network.h"
#include "services/listen_dnsport.h"
#include "services/cache/infra.h"

View File

@ -43,7 +43,6 @@
#ifndef OUTSIDE_NETWORK_H
#define OUTSIDE_NETWORK_H
#include "config.h"
#include "util/rbtree.h"
#include "util/netevent.h"
struct pending;

View File

@ -96,7 +96,6 @@
#ifndef TESTCODE_REPLAY_H
#define TESTCODE_REPLAY_H
#include "config.h"
#include "util/netevent.h"
#include "testcode/ldns-testpkts.h"
struct replay_answer;

View File

@ -9,7 +9,6 @@
#ifndef UTIL_CONFIGYYRENAME_H
#define UTIL_CONFIGYYRENAME_H
#include "config.h"
/* defines to change symbols so that no yacc/lex symbols clash */
#define yymaxdepth ub_c_maxdepth

View File

@ -42,11 +42,6 @@
#ifndef UTIL_LOG_H
#define UTIL_LOG_H
#include "config.h"
#ifdef HAVE_STDARG_H
#include <stdarg.h>
#endif
/**
* verbosity value:
*/

View File

@ -38,7 +38,7 @@
*
* This file contains event notification functions.
*/
#include "config.h"
#include "util/netevent.h"
#include "util/log.h"
#include "util/net_help.h"

View File

@ -60,7 +60,6 @@
#ifndef NET_EVENT_H
#define NET_EVENT_H
#include "config.h"
struct comm_point;
struct comm_reply;
struct event_base;