From ee8465d8877ab51fbb62f5ad591e4ccdfce41364 Mon Sep 17 00:00:00 2001 From: Wouter Wijngaards Date: Mon, 23 Mar 2009 18:09:19 +0000 Subject: [PATCH] More common configure code. git-svn-id: file:///svn/unbound/trunk@1544 be551aaa-1e26-0410-a405-d3ace91eadb9 --- acx_nlnetlabs.m4 | 670 ++++++++++++++++++++++++++++++++- config.h.in | 242 +++++++----- configure | 951 +++++++++++++++++++++++++++++------------------ configure.ac | 534 +++----------------------- 4 files changed, 1470 insertions(+), 927 deletions(-) diff --git a/acx_nlnetlabs.m4 b/acx_nlnetlabs.m4 index 06de76cd8..9fc5d48f5 100644 --- a/acx_nlnetlabs.m4 +++ b/acx_nlnetlabs.m4 @@ -5,6 +5,52 @@ # Automates some of the checking constructs. Aims at portability for POSIX. # Documentation for functions is below. # +# the following macro's are provided in this file: +# (see below for details on each macro). +# +# ACX_ESCAPE_BACKSLASH - escape backslashes in var for C-preproc. +# ACX_RSRC_VERSION - create windows resource version number. +# ACX_CHECK_COMPILER_FLAG - see if cc supports a flag. +# ACX_CHECK_ERROR_FLAGS - see which flag is -werror (used below). +# ACX_CHECK_COMPILER_FLAG_NEEDED - see if flags make the code compile cleanly. +# ACX_DEPFLAG - find cc dependency flags. +# ACX_DETERMINE_EXT_FLAGS_UNBOUND - find out which flags enable BSD and POSIX. +# ACX_CHECK_FORMAT_ATTRIBUTE - find cc printf format syntax. +# ACX_CHECK_UNUSED_ATTRIBUTE - find cc variable unused syntax. +# ACX_LIBTOOL_C_ONLY - create libtool for C only, improved. +# ACX_TYPE_U_CHAR - u_char type. +# ACX_TYPE_RLIM_T - rlim_t type. +# ACX_TYPE_SOCKLEN_T - socklen_t type. +# ACX_TYPE_IN_ADDR_T - in_addr_t type. +# ACX_TYPE_IN_PORT_T - in_port_t type. +# ACX_ARG_RPATH - add --disable-rpath option. +# ACX_WITH_SSL - add --with-ssl option, link -lcrypto. +# ACX_LIB_SSL - setup to link -lssl. +# ACX_SYS_LARGEFILE - improved sys_largefile, fseeko, >2G files. +# ACX_CHECK_GETADDRINFO_WITH_INCLUDES - find getaddrinfo, portably. +# ACX_FUNC_DEPRECATED - see if func is deprecated. +# 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. +# dnl Escape backslashes as \\, for C:\ paths, for the C preprocessor defines. dnl for example, NLX_ESCAPE_BACKSLASH($from_var, to_var) @@ -310,7 +356,8 @@ int test() { ]) dnl Check the printf-format attribute (if any) -dnl result in HAVE_ATTR_FORMAT +dnl result in HAVE_ATTR_FORMAT. +dnl Make sure you also include the AHX_BOTTOM_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) @@ -331,10 +378,23 @@ AC_MSG_RESULT($ac_cv_c_format_attribute) if test $ac_cv_c_format_attribute = yes; then AC_DEFINE(HAVE_ATTR_FORMAT, 1, [Whether the C compiler accepts the "format" attribute]) fi -])dnl +])dnl End of ACX_CHECK_FORMAT_ATTRIBUTE + +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([ +#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 result in HAVE_ATTR_UNUSED. +dnl Make sure you include AHX_BOTTOM_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) @@ -350,6 +410,21 @@ void f (char *u __attribute__((unused))); [ac_cv_c_unused_attribute="no"]) ]) +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([ +#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 */ +]) ]) + AC_MSG_RESULT($ac_cv_c_unused_attribute) if test $ac_cv_c_unused_attribute = yes; then AC_DEFINE(HAVE_ATTR_UNUSED, 1, [Whether the C compiler accepts the "unused" attribute]) @@ -384,4 +459,593 @@ fi AC_PROG_LIBTOOL ]) +dnl Detect if u_char type is defined, otherwise define it. +AC_DEFUN(ACX_TYPE_U_CHAR, + [AC_CHECK_TYPE(u_char, unsigned char)]) + +dnl Detect if rlim_t type is defined, otherwise define it. +AC_DEFUN(ACX_TYPE_RLIM_T, +[AC_CHECK_TYPE(rlim_t, , + [AC_DEFINE([rlim_t], [unsigned long], [Define to 'int' if not defined])], [ +AC_INCLUDES_DEFAULT +#if HAVE_SYS_RESOURCE_H +# include +#endif +]) ]) + +dnl Detect if socklen_t type is defined, otherwise define it. +AC_DEFUN(ACX_TYPE_SOCKLEN_T, +[ +AC_CHECK_TYPE(socklen_t, , + [AC_DEFINE([socklen_t], [int], [Define to 'int' if not defined])], [ +AC_INCLUDES_DEFAULT +#if HAVE_SYS_SOCKET_H +# include +#endif +]) ]) + +dnl Detect if socklen_t type is defined, otherwise define it. +AC_DEFUN(ACX_TYPE_IN_ADDR_T, +[ AC_CHECK_TYPE(in_addr_t, [], [AC_DEFINE([in_addr_t], [uint32_t], [in_addr_t])], [ +AC_INCLUDES_DEFAULT +#if HAVE_SYS_TYPES_H +# include +#endif +#if HAVE_NETINET_IN_H +# include +#endif +]) ]) + +dnl Detect if socklen_t type is defined, otherwise define it. +AC_DEFUN(ACX_TYPE_IN_PORT_T, +[ AC_CHECK_TYPE(in_port_t, [], [AC_DEFINE([in_port_t], [uint16_t], [in_port_t])], [ +AC_INCLUDES_DEFAULT +#if HAVE_SYS_TYPES_H +# include +#endif +#if HAVE_NETINET_IN_H +# include +#endif +]) ]) + +dnl Add option to disable the evil rpath. Check whether to use rpath or not. +dnl Adds the --disable-rpath option. Uses trick to edit the ./libtool. +AC_DEFUN(ACX_ARG_RPATH, +[ +AC_ARG_ENABLE(rpath, + [ --disable-rpath disable hardcoded rpath (default=enabled)], + enable_rpath=$enableval, enable_rpath=yes) +if test "x$enable_rpath" = xno; then + AC_MSG_RESULT([Fixing libtool for -rpath problems.]) + sed < libtool > libtool-2 \ + 's/^hardcode_libdir_flag_spec.*$'/'hardcode_libdir_flag_spec=" -D__LIBTOOL_RPATH_SED__ "/' + mv libtool-2 libtool + chmod 755 libtool + libtool="./libtool" +fi +]) + +dnl Check for SSL. +dnl Adds --with-ssl option, searches for openssl and defines HAVE_SSL if found +dnl Setup of CPPFLAGS, CFLAGS. Adds -lcrypto to LIBS. +dnl Checks main header files of SSL. +dnl +AC_DEFUN(ACX_WITH_SSL, +[ +AC_ARG_WITH(ssl, AC_HELP_STRING([--with-ssl=pathname], + [enable SSL (will check /usr/local/ssl + /usr/lib/ssl /usr/ssl /usr/pkg /usr/local /opt/local /usr/sfw /usr)]),[ + ],[ + withval="yes" + ]) + if test x_$withval = x_no; then + AC_MSG_ERROR([Need SSL library to do digital signature cryptography]) + fi + if test x_$withval != x_no; then + AC_MSG_CHECKING(for SSL) + if test x_$withval = x_ -o x_$withval = x_yes; then + withval="/usr/local/ssl /usr/lib/ssl /usr/ssl /usr/pkg /usr/local /opt/local /usr/sfw /usr" + fi + for dir in $withval; do + ssldir="$dir" + if test -f "$dir/include/openssl/ssl.h"; then + found_ssl="yes" + AC_DEFINE_UNQUOTED([HAVE_SSL], [], [Define if you have the SSL libraries installed.]) + CPPFLAGS="$CPPFLAGS -I$ssldir/include" + break; + fi + done + if test x_$found_ssl != x_yes; then + AC_MSG_ERROR(Cannot find the SSL libraries in $withval) + else + AC_MSG_RESULT(found in $ssldir) + HAVE_SSL=yes + LDFLAGS="$LDFLAGS -L$ssldir/lib" + if test "x$enable_rpath" = xyes; then + RUNTIME_PATH="$RUNTIME_PATH -R$ssldir/lib" + fi + + AC_MSG_CHECKING([for HMAC_CTX_init in -lcrypto]) + LIBS="$LIBS -lcrypto" + AC_TRY_LINK(, [ + int HMAC_CTX_init(void); + (void)HMAC_CTX_init(); + ], [ + AC_MSG_RESULT(yes) + AC_DEFINE([HAVE_HMAC_CTX_INIT], 1, + [If you have HMAC_CTX_init]) + ], [ + AC_MSG_RESULT(no) + # check if -lwsock32 or -lgdi32 are needed. + LIBS="$LIBS -lgdi32" + AC_MSG_CHECKING([if -lcrypto needs -lgdi32]) + AC_TRY_LINK([], [ + int HMAC_CTX_init(void); + (void)HMAC_CTX_init(); + ],[ + AC_DEFINE([HAVE_HMAC_CTX_INIT], 1, + [If you have HMAC_CTX_init]) + AC_MSG_RESULT(yes) + ],[ + AC_MSG_RESULT(no) + AC_MSG_ERROR([OpenSSL found in $ssldir, but version 0.9.7 or higher is required]) + ]) + ]) + fi + AC_SUBST(HAVE_SSL) + AC_SUBST(RUNTIME_PATH) + fi +AC_CHECK_HEADERS([openssl/ssl.h],,, [AC_INCLUDES_DEFAULT]) +AC_CHECK_HEADERS([openssl/err.h],,, [AC_INCLUDES_DEFAULT]) +AC_CHECK_HEADERS([openssl/rand.h],,, [AC_INCLUDES_DEFAULT]) +])dnl End of ACX_WITH_SSL + +dnl Setup to use -lssl +dnl To use -lcrypto, use the ACX_WITH_SSL setup (before this one). +AC_DEFUN(ACX_LIB_SSL, +[ +# check if libssl needs libdl +BAKLIBS="$LIBS" +LIBS="-lssl $LIBS" +AC_MSG_CHECKING([if libssl needs libdl]) +AC_TRY_LINK_FUNC([SSL_CTX_new], [ + AC_MSG_RESULT([no]) + LIBS="$BAKLIBS" +] , [ + AC_MSG_RESULT([yes]) + LIBS="$BAKLIBS" + AC_SEARCH_LIBS([dlopen], [dl]) +]) ])dnl End of ACX_LIB_SSL + +dnl Setup to use very large files (>2Gb). +dnl setups fseeko and its own +AC_DEFUN(ACX_SYS_LARGEFILE, +[ +AC_SYS_LARGEFILE +dnl try to see if an additional _LARGEFILE_SOURCE 1 is needed to get fseeko +ACX_CHECK_COMPILER_FLAG_NEEDED(-D_LARGEFILE_SOURCE=1, +[ +#include +int test() { + int a = fseeko(stdin, 0, 0); + return a; +} +], [CFLAGS="$CFLAGS -D_LARGEFILE_SOURCE=1"]) +]) + +dnl Check getaddrinfo. +dnl Works on linux, solaris, bsd and windows(links winsock). +dnl defines HAVE_GETADDRINFO, USE_WINSOCK. +AC_DEFUN([ACX_CHECK_GETADDRINFO_WITH_INCLUDES], +[AC_REQUIRE([AC_PROG_CC]) +AC_MSG_CHECKING(for getaddrinfo) +ac_cv_func_getaddrinfo=no +AC_LINK_IFELSE( +[ +#ifdef __cplusplus +extern "C" +{ +#endif +char* getaddrinfo(); +char* (*f) () = getaddrinfo; +#ifdef __cplusplus +} +#endif +int main() { + ; + return 0; +} +], +dnl this case on linux, solaris, bsd +[ac_cv_func_getaddrinfo="yes"], +dnl no quick getaddrinfo, try mingw32 and winsock2 library. +ORIGLIBS="$LIBS" +LIBS="$LIBS -lws2_32" +AC_LINK_IFELSE( +AC_LANG_PROGRAM( +[ +#ifdef HAVE_WS2TCPIP_H +#include +#endif +], +[ + (void)getaddrinfo(NULL, NULL, NULL, NULL); +] +), +[ +ac_cv_func_getaddrinfo="yes" +dnl already: LIBS="$LIBS -lws2_32" +AC_DEFINE(USE_WINSOCK, 1, [Whether the windows socket API is used]) +USE_WINSOCK="1" +], +[ +ac_cv_func_getaddrinfo="no" +LIBS="$ORIGLIBS" +]) +) + +AC_MSG_RESULT($ac_cv_func_getaddrinfo) +if test $ac_cv_func_getaddrinfo = yes; then + AC_DEFINE(HAVE_GETADDRINFO, 1, [Whether getaddrinfo is available]) +fi +])dnl Endof AC_CHECK_GETADDRINFO_WITH_INCLUDES + +dnl check if a function is deprecated. defines DEPRECATED_func in config.h. +dnl $1: function name +dnl $2: C-statement that calls the function. +dnl $3: includes for the program. +dnl $4: executes if yes +dnl $5: executes if no +AC_DEFUN([ACX_FUNC_DEPRECATED], +[ +AC_REQUIRE([AC_PROG_CC]) +AC_MSG_CHECKING(if $1 is deprecated) +cache=`echo $1 | sed 'y%.=/+-%___p_%'` +AC_CACHE_VAL(cv_cc_deprecated_$cache, +[ +echo '$3' >conftest.c +echo 'void f(){ $2 }' >>conftest.c +if test -z "`$CC -c conftest.c 2>&1 | grep deprecated`"; then +eval "cv_cc_deprecated_$cache=no" +else +eval "cv_cc_deprecated_$cache=yes" +fi +rm -f conftest conftest.o conftest.c +]) +if eval "test \"`echo '$cv_cc_deprecated_'$cache`\" = yes"; then +AC_MSG_RESULT(yes) +AC_DEFINE_UNQUOTED(AS_TR_CPP([DEPRECATED_$1]), 1, [Whether $1 is deprecated]) +: +$4 +else +AC_MSG_RESULT(no) +: +$5 +fi +])dnl end of ACX_FUNC_DEPRECATED + +dnl check if select and nonblocking sockets actually work. +dnl Needs fork(2) and select(2). +dnl defines NONBLOCKING_IS_BROKEN, and if that is true multiple reads from +dnl a nonblocking socket do not work, a new call to select is necessary. +AC_DEFUN(ACX_CHECK_NONBLOCKING_BROKEN, +[ +AC_MSG_CHECKING([if nonblocking sockets work]) +AC_RUN_IFELSE(AC_LANG_PROGRAM([ +#include +#include +#include +#include +#include +#ifdef HAVE_SYS_TYPES_H +#include +#endif +#ifdef HAVE_SYS_SOCKET_H +#include +#endif +#ifdef HAVE_NETINET_IN_H +#include +#endif +#ifdef HAVE_ARPA_INET_H +#include +#endif +#ifdef HAVE_UNISTD_H +#include +#endif +#ifdef HAVE_TIME_H +#include +#endif +],[[ + int port; + int sfd, cfd; + int num = 10; + int i, p; + struct sockaddr_in a; + /* test if select and nonblocking reads work well together */ + /* open port. + fork child to send 10 messages. + select to read. + then try to nonblocking read the 10 messages + then, nonblocking read must give EAGAIN + */ + + port = 12345 + (time(0)%32); + sfd = socket(PF_INET, SOCK_DGRAM, 0); + if(sfd == -1) { + perror("socket"); + return 1; + } + memset(&a, 0, sizeof(a)); + a.sin_family = AF_INET; + a.sin_port = htons(port); + a.sin_addr.s_addr = inet_addr("127.0.0.1"); + if(bind(sfd, (struct sockaddr*)&a, sizeof(a)) < 0) { + perror("bind"); + return 1; + } + if(fcntl(sfd, F_SETFL, O_NONBLOCK) == -1) { + perror("fcntl"); + return 1; + } + + cfd = socket(PF_INET, SOCK_DGRAM, 0); + if(cfd == -1) { + perror("client socket"); + return 1; + } + a.sin_port = 0; + if(bind(cfd, (struct sockaddr*)&a, sizeof(a)) < 0) { + perror("client bind"); + return 1; + } + a.sin_port = htons(port); + + /* no handler, causes exit in 10 seconds */ + alarm(10); + + /* send and receive on the socket */ + if((p=fork()) == 0) { + for(i=0; i +#include +#ifdef HAVE_WINSOCK2_H +#include +#endif +#ifdef HAVE_SYS_STAT_H +#include +#endif +], [ + (void)mkdir("directory"); +], +AC_MSG_RESULT(yes) +AC_DEFINE(MKDIR_HAS_ONE_ARG, 1, [Define if mkdir has one argument.]) +, +AC_MSG_RESULT(no) +) +])dnl end of ACX_MKDIR_ONE_ARG + +dnl Check for ioctlsocket function. works on mingw32 too. +AC_DEFUN(ACX_FUNC_IOCTLSOCKET, +[ +# check ioctlsocket +AC_MSG_CHECKING(for ioctlsocket) +AC_LINK_IFELSE(AC_LANG_PROGRAM([ +#ifdef HAVE_WINSOCK2_H +#include +#endif +], [ + (void)ioctlsocket(0, 0, NULL); +]), [ +AC_MSG_RESULT(yes) +AC_DEFINE(HAVE_IOCTLSOCKET, 1, [if the function 'ioctlsocket' is available]) +],[AC_MSG_RESULT(no)]) +])dnl end of ACX_FUNC_IOCTLSOCKET + +dnl Define fallback for fseeko and ftello if needed. +AC_DEFUN(AHX_BOTTOM_FSEEKO, +[ AH_BOTTOM([ +#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([ +#ifndef RAND_MAX +#define RAND_MAX 2147483647 +#endif +]) ]) + +dnl Define MAXHOSTNAMELEN if not defined +AC_DEFUN(AHX_BOTTOM_MAXHOSTNAMELEN, +[ AH_BOTTOM([ +#ifndef MAXHOSTNAMELEN +#define MAXHOSTNAMELEN 256 +#endif +]) ]) + +dnl Define IPV6_MIN_MTU if not defined +AC_DEFUN(AHX_BOTTOM_IPV6_MIN_MTU, +[ AH_BOTTOM([ +#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([ +#ifndef HAVE_SNPRINTF +#define snprintf snprintf_$1 +#define vsnprintf vsnprintf_$1 +#include +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([ +#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([ +#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([ +#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([ +#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([ +#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([ +#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([ +#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([ +#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([ +#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([ +#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([ +/* 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 End of file diff --git a/config.h.in b/config.h.in index a09cd1032..1a001f62c 100644 --- a/config.h.in +++ b/config.h.in @@ -390,6 +390,21 @@ /* Define for large files, on AIX-style hosts. */ #undef _LARGE_FILES +/* Define for Solaris 2.5.1 so the uint32_t typedef from , + , or is not used. If the typedef was allowed, the + #define below would cause a syntax error. */ +#undef _UINT32_T + +/* Define for Solaris 2.5.1 so the uint64_t typedef from , + , or is not used. If the typedef was allowed, the + #define below would cause a syntax error. */ +#undef _UINT64_T + +/* Define for Solaris 2.5.1 so the uint8_t typedef from , + , or is not used. If the typedef was allowed, the + #define below would cause a syntax error. */ +#undef _UINT8_T + /* Define to empty if `const' does not conform to ANSI C. */ #undef const @@ -408,16 +423,20 @@ #undef inline #endif -/* Define to `short' if does not define. */ +/* Define to the type of a signed integer type of width exactly 16 bits if + such a type exists and the standard includes do not define it. */ #undef int16_t -/* Define to `int' if does not define. */ +/* Define to the type of a signed integer type of width exactly 32 bits if + such a type exists and the standard includes do not define it. */ #undef int32_t -/* Define to `long long' if does not define. */ +/* Define to the type of a signed integer type of width exactly 64 bits if + such a type exists and the standard includes do not define it. */ #undef int64_t -/* Define to `char' if does not define. */ +/* Define to the type of a signed integer type of width exactly 8 bits if such + a type exists and the standard includes do not define it. */ #undef int8_t /* Define to rpl_malloc if the replacement function should be used. */ @@ -447,16 +466,20 @@ /* Define to `int' if doesn't define. */ #undef uid_t -/* Define to `unsigned short' if does not define. */ +/* Define to the type of an unsigned integer type of width exactly 16 bits if + such a type exists and the standard includes do not define it. */ #undef uint16_t -/* Define to `unsigned int' if does not define. */ +/* Define to the type of an unsigned integer type of width exactly 32 bits if + such a type exists and the standard includes do not define it. */ #undef uint32_t -/* Define to `unsigned long long' if does not define. */ +/* Define to the type of an unsigned integer type of width exactly 64 bits if + such a type exists and the standard includes do not define it. */ #undef uint64_t -/* Define to `unsigned char' if does not define. */ +/* Define to the type of an unsigned integer type of width exactly 8 bits if + such a type exists and the standard includes do not define it. */ #undef uint8_t /* Define as `fork' if `vfork' does not work. */ @@ -523,42 +546,89 @@ #include #endif + + +#ifndef HAVE_INET_ATON +#define inet_aton inet_aton_unbound +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) +#else +#define FD_SET_T +#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(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 */ + + + #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 -#ifndef RAND_MAX -#define RAND_MAX 2147483647 -#endif - -#ifndef MAXHOSTNAMELEN -#define MAXHOSTNAMELEN 256 -#endif - -#ifndef IPV6_MIN_MTU -#define IPV6_MIN_MTU 1280 -#endif /* IPV6_MIN_MTU */ - #ifndef CHECKED_INET6 # define CHECKED_INET6 # ifdef AF_INET6 @@ -570,61 +640,10 @@ /* maximum nesting of included files */ #define MAXINCLUDES 10 - -#ifndef HAVE_SNPRINTF -#define snprintf snprintf_unbound -#define vsnprintf vsnprintf_unbound -#include -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 -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_GETADDRINFO struct sockaddr_storage; #include "compat/fake-rfc2553.h" #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) -#else -#define FD_SET_T -#endif #include "ldns/ldns.h" @@ -650,3 +669,58 @@ 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 +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 + diff --git a/configure b/configure index 94b76f8b2..9ecd9775a 100755 --- a/configure +++ b/configure @@ -4288,6 +4288,24 @@ ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu + +{ echo "$as_me:$LINENO: checking $CC dependency flag" >&5 +echo $ECHO_N "checking $CC dependency flag... $ECHO_C" >&6; } +echo 'void f(){}' >conftest.c +if test "`$CC -MM conftest.c 2>&1`" = "conftest.o: conftest.c"; then + DEPFLAG="-MM" +else + if test "`$CC -xM1 conftest.c 2>&1`" = "conftest.o: conftest.c"; then + DEPFLAG="-xM1" + else + DEPFLAG="-MM" # dunno do something + fi +fi +{ echo "$as_me:$LINENO: result: $DEPFLAG" >&5 +echo "${ECHO_T}$DEPFLAG" >&6; } +rm -f conftest.c + + { echo "$as_me:$LINENO: checking for ANSI C header files" >&5 echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6; } if test "${ac_cv_header_stdc+set}" = set; then @@ -4533,83 +4551,6 @@ done -for ac_header in winsock2.h ws2tcpip.h -do -as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` -{ echo "$as_me:$LINENO: checking for $ac_header" >&5 -echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } -if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_includes_default - -#include <$ac_header> -_ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - eval "$as_ac_Header=yes" -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - eval "$as_ac_Header=no" -fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -ac_res=`eval echo '${'$as_ac_Header'}'` - { echo "$as_me:$LINENO: result: $ac_res" >&5 -echo "${ECHO_T}$ac_res" >&6; } -if test `eval echo '${'$as_ac_Header'}'` = yes; then - cat >>confdefs.h <<_ACEOF -#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 -_ACEOF - -fi - -done - - -{ echo "$as_me:$LINENO: checking $CC dependency flag" >&5 -echo $ECHO_N "checking $CC dependency flag... $ECHO_C" >&6; } -echo 'void f(){}' >conftest.c -if test "`$CC -MM conftest.c 2>&1`" = "conftest.o: conftest.c"; then - DEPFLAG="-MM" -else - if test "`$CC -xM1 conftest.c 2>&1`" = "conftest.o: conftest.c"; then - DEPFLAG="-xM1" - else - DEPFLAG="-MM" # dunno do something - fi -fi -{ echo "$as_me:$LINENO: result: $DEPFLAG" >&5 -echo "${ECHO_T}$DEPFLAG" >&6; } -rm -f conftest.c - - - - { echo "$as_me:$LINENO: checking whether $CC supports -Werror" >&5 echo $ECHO_N "checking whether $CC supports -Werror... $ECHO_C" >&6; } @@ -5455,7 +5396,8 @@ echo "${ECHO_T}no" >&6; } fi -# flag warnings. + +# debug mode flags warnings # Check whether --enable-debug was given. if test "${enable_debug+set}" = set; then enableval=$enable_debug; @@ -5792,6 +5734,8 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi + + { echo "$as_me:$LINENO: result: $ac_cv_c_unused_attribute" >&5 echo "${ECHO_T}$ac_cv_c_unused_attribute" >&6; } if test $ac_cv_c_unused_attribute = yes; then @@ -6730,7 +6674,7 @@ ia64-*-hpux*) ;; *-*-irix6*) # Find out which ABI we are using. - echo '#line 6733 "configure"' > conftest.$ac_ext + echo '#line 6677 "configure"' > conftest.$ac_ext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? @@ -8044,11 +7988,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:8047: $lt_compile\"" >&5) + (eval echo "\"\$as_me:7991: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:8051: \$? = $ac_status" >&5 + echo "$as_me:7995: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -8334,11 +8278,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:8337: $lt_compile\"" >&5) + (eval echo "\"\$as_me:8281: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:8341: \$? = $ac_status" >&5 + echo "$as_me:8285: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -8438,11 +8382,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:8441: $lt_compile\"" >&5) + (eval echo "\"\$as_me:8385: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:8445: \$? = $ac_status" >&5 + echo "$as_me:8389: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -10789,7 +10733,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext < conftest.$ac_ext <&5) + (eval echo "\"\$as_me:13256: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:13316: \$? = $ac_status" >&5 + echo "$as_me:13260: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -13413,11 +13357,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:13416: $lt_compile\"" >&5) + (eval echo "\"\$as_me:13360: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:13420: \$? = $ac_status" >&5 + echo "$as_me:13364: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -14977,11 +14921,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:14980: $lt_compile\"" >&5) + (eval echo "\"\$as_me:14924: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:14984: \$? = $ac_status" >&5 + echo "$as_me:14928: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -15081,11 +15025,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:15084: $lt_compile\"" >&5) + (eval echo "\"\$as_me:15028: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:15088: \$? = $ac_status" >&5 + echo "$as_me:15032: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -17270,11 +17214,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:17273: $lt_compile\"" >&5) + (eval echo "\"\$as_me:17217: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:17277: \$? = $ac_status" >&5 + echo "$as_me:17221: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -17560,11 +17504,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:17563: $lt_compile\"" >&5) + (eval echo "\"\$as_me:17507: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:17567: \$? = $ac_status" >&5 + echo "$as_me:17511: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -17664,11 +17608,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:17667: $lt_compile\"" >&5) + (eval echo "\"\$as_me:17611: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:17671: \$? = $ac_status" >&5 + echo "$as_me:17615: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -20488,7 +20432,9 @@ fi -for ac_header in 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 + + +for ac_header in 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 do as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` { echo "$as_me:$LINENO: checking for $ac_header" >&5 @@ -20547,26 +20493,28 @@ done # check for types -{ echo "$as_me:$LINENO: checking for int8_t" >&5 + + { echo "$as_me:$LINENO: checking for int8_t" >&5 echo $ECHO_N "checking for int8_t... $ECHO_C" >&6; } -if test "${ac_cv_type_int8_t+set}" = set; then +if test "${ac_cv_c_int8_t+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat >conftest.$ac_ext <<_ACEOF + ac_cv_c_int8_t=no + for ac_type in 'int8_t' 'int' 'long int' \ + 'long long int' 'short int' 'signed char'; do + cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default -typedef int8_t ac__type_new_; int main () { -if ((ac__type_new_ *) 0) - return 0; -if (sizeof (ac__type_new_)) - return 0; +static int test_array [1 - 2 * !(0 < ($ac_type) (((($ac_type) 1 << (8 - 2)) - 1) * 2 + 1))]; +test_array [0] = 0 + ; return 0; } @@ -20588,48 +20536,99 @@ eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then - ac_cv_type_int8_t=yes + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ +static int test_array [1 - 2 * !(($ac_type) (((($ac_type) 1 << (8 - 2)) - 1) * 2 + 1) + < ($ac_type) (((($ac_type) 1 << (8 - 2)) - 1) * 2 + 2))]; +test_array [0] = 0 + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 - ac_cv_type_int8_t=no + case $ac_type in + int8_t) ac_cv_c_int8_t=yes ;; + *) ac_cv_c_int8_t=$ac_type ;; +esac + fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -{ echo "$as_me:$LINENO: result: $ac_cv_type_int8_t" >&5 -echo "${ECHO_T}$ac_cv_type_int8_t" >&6; } -if test $ac_cv_type_int8_t = yes; then - : else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + test "$ac_cv_c_int8_t" != no && break + done +fi +{ echo "$as_me:$LINENO: result: $ac_cv_c_int8_t" >&5 +echo "${ECHO_T}$ac_cv_c_int8_t" >&6; } + case $ac_cv_c_int8_t in #( + no|yes) ;; #( + *) cat >>confdefs.h <<_ACEOF -#define int8_t char +#define int8_t $ac_cv_c_int8_t _ACEOF +;; + esac -fi -{ echo "$as_me:$LINENO: checking for int16_t" >&5 + { echo "$as_me:$LINENO: checking for int16_t" >&5 echo $ECHO_N "checking for int16_t... $ECHO_C" >&6; } -if test "${ac_cv_type_int16_t+set}" = set; then +if test "${ac_cv_c_int16_t+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat >conftest.$ac_ext <<_ACEOF + ac_cv_c_int16_t=no + for ac_type in 'int16_t' 'int' 'long int' \ + 'long long int' 'short int' 'signed char'; do + cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default -typedef int16_t ac__type_new_; int main () { -if ((ac__type_new_ *) 0) - return 0; -if (sizeof (ac__type_new_)) - return 0; +static int test_array [1 - 2 * !(0 < ($ac_type) (((($ac_type) 1 << (16 - 2)) - 1) * 2 + 1))]; +test_array [0] = 0 + ; return 0; } @@ -20651,48 +20650,99 @@ eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then - ac_cv_type_int16_t=yes + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ +static int test_array [1 - 2 * !(($ac_type) (((($ac_type) 1 << (16 - 2)) - 1) * 2 + 1) + < ($ac_type) (((($ac_type) 1 << (16 - 2)) - 1) * 2 + 2))]; +test_array [0] = 0 + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 - ac_cv_type_int16_t=no + case $ac_type in + int16_t) ac_cv_c_int16_t=yes ;; + *) ac_cv_c_int16_t=$ac_type ;; +esac + fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -{ echo "$as_me:$LINENO: result: $ac_cv_type_int16_t" >&5 -echo "${ECHO_T}$ac_cv_type_int16_t" >&6; } -if test $ac_cv_type_int16_t = yes; then - : else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + test "$ac_cv_c_int16_t" != no && break + done +fi +{ echo "$as_me:$LINENO: result: $ac_cv_c_int16_t" >&5 +echo "${ECHO_T}$ac_cv_c_int16_t" >&6; } + case $ac_cv_c_int16_t in #( + no|yes) ;; #( + *) cat >>confdefs.h <<_ACEOF -#define int16_t short +#define int16_t $ac_cv_c_int16_t _ACEOF +;; + esac -fi -{ echo "$as_me:$LINENO: checking for int32_t" >&5 + { echo "$as_me:$LINENO: checking for int32_t" >&5 echo $ECHO_N "checking for int32_t... $ECHO_C" >&6; } -if test "${ac_cv_type_int32_t+set}" = set; then +if test "${ac_cv_c_int32_t+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat >conftest.$ac_ext <<_ACEOF + ac_cv_c_int32_t=no + for ac_type in 'int32_t' 'int' 'long int' \ + 'long long int' 'short int' 'signed char'; do + cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default -typedef int32_t ac__type_new_; int main () { -if ((ac__type_new_ *) 0) - return 0; -if (sizeof (ac__type_new_)) - return 0; +static int test_array [1 - 2 * !(0 < ($ac_type) (((($ac_type) 1 << (32 - 2)) - 1) * 2 + 1))]; +test_array [0] = 0 + ; return 0; } @@ -20714,48 +20764,99 @@ eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then - ac_cv_type_int32_t=yes + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ +static int test_array [1 - 2 * !(($ac_type) (((($ac_type) 1 << (32 - 2)) - 1) * 2 + 1) + < ($ac_type) (((($ac_type) 1 << (32 - 2)) - 1) * 2 + 2))]; +test_array [0] = 0 + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 - ac_cv_type_int32_t=no + case $ac_type in + int32_t) ac_cv_c_int32_t=yes ;; + *) ac_cv_c_int32_t=$ac_type ;; +esac + fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -{ echo "$as_me:$LINENO: result: $ac_cv_type_int32_t" >&5 -echo "${ECHO_T}$ac_cv_type_int32_t" >&6; } -if test $ac_cv_type_int32_t = yes; then - : else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + test "$ac_cv_c_int32_t" != no && break + done +fi +{ echo "$as_me:$LINENO: result: $ac_cv_c_int32_t" >&5 +echo "${ECHO_T}$ac_cv_c_int32_t" >&6; } + case $ac_cv_c_int32_t in #( + no|yes) ;; #( + *) cat >>confdefs.h <<_ACEOF -#define int32_t int +#define int32_t $ac_cv_c_int32_t _ACEOF +;; + esac -fi -{ echo "$as_me:$LINENO: checking for int64_t" >&5 + { echo "$as_me:$LINENO: checking for int64_t" >&5 echo $ECHO_N "checking for int64_t... $ECHO_C" >&6; } -if test "${ac_cv_type_int64_t+set}" = set; then +if test "${ac_cv_c_int64_t+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat >conftest.$ac_ext <<_ACEOF + ac_cv_c_int64_t=no + for ac_type in 'int64_t' 'int' 'long int' \ + 'long long int' 'short int' 'signed char'; do + cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default -typedef int64_t ac__type_new_; int main () { -if ((ac__type_new_ *) 0) - return 0; -if (sizeof (ac__type_new_)) - return 0; +static int test_array [1 - 2 * !(0 < ($ac_type) (((($ac_type) 1 << (64 - 2)) - 1) * 2 + 1))]; +test_array [0] = 0 + ; return 0; } @@ -20777,48 +20878,99 @@ eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then - ac_cv_type_int64_t=yes + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ +static int test_array [1 - 2 * !(($ac_type) (((($ac_type) 1 << (64 - 2)) - 1) * 2 + 1) + < ($ac_type) (((($ac_type) 1 << (64 - 2)) - 1) * 2 + 2))]; +test_array [0] = 0 + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 - ac_cv_type_int64_t=no + case $ac_type in + int64_t) ac_cv_c_int64_t=yes ;; + *) ac_cv_c_int64_t=$ac_type ;; +esac + fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -{ echo "$as_me:$LINENO: result: $ac_cv_type_int64_t" >&5 -echo "${ECHO_T}$ac_cv_type_int64_t" >&6; } -if test $ac_cv_type_int64_t = yes; then - : else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + test "$ac_cv_c_int64_t" != no && break + done +fi +{ echo "$as_me:$LINENO: result: $ac_cv_c_int64_t" >&5 +echo "${ECHO_T}$ac_cv_c_int64_t" >&6; } + case $ac_cv_c_int64_t in #( + no|yes) ;; #( + *) cat >>confdefs.h <<_ACEOF -#define int64_t long long +#define int64_t $ac_cv_c_int64_t _ACEOF +;; + esac -fi -{ echo "$as_me:$LINENO: checking for uint8_t" >&5 + { echo "$as_me:$LINENO: checking for uint8_t" >&5 echo $ECHO_N "checking for uint8_t... $ECHO_C" >&6; } -if test "${ac_cv_type_uint8_t+set}" = set; then +if test "${ac_cv_c_uint8_t+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat >conftest.$ac_ext <<_ACEOF + ac_cv_c_uint8_t=no + for ac_type in 'uint8_t' 'unsigned int' 'unsigned long int' \ + 'unsigned long long int' 'unsigned short int' 'unsigned char'; do + cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default -typedef uint8_t ac__type_new_; int main () { -if ((ac__type_new_ *) 0) - return 0; -if (sizeof (ac__type_new_)) - return 0; +static int test_array [1 - 2 * !(($ac_type) -1 >> (8 - 1) == 1)]; +test_array [0] = 0 + ; return 0; } @@ -20840,48 +20992,61 @@ eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then - ac_cv_type_uint8_t=yes + case $ac_type in + uint8_t) ac_cv_c_uint8_t=yes ;; + *) ac_cv_c_uint8_t=$ac_type ;; +esac + else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 - ac_cv_type_uint8_t=no + fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + test "$ac_cv_c_uint8_t" != no && break + done fi -{ echo "$as_me:$LINENO: result: $ac_cv_type_uint8_t" >&5 -echo "${ECHO_T}$ac_cv_type_uint8_t" >&6; } -if test $ac_cv_type_uint8_t = yes; then - : -else +{ echo "$as_me:$LINENO: result: $ac_cv_c_uint8_t" >&5 +echo "${ECHO_T}$ac_cv_c_uint8_t" >&6; } + case $ac_cv_c_uint8_t in #( + no|yes) ;; #( + *) -cat >>confdefs.h <<_ACEOF -#define uint8_t unsigned char +cat >>confdefs.h <<\_ACEOF +#define _UINT8_T 1 _ACEOF -fi -{ echo "$as_me:$LINENO: checking for uint16_t" >&5 +cat >>confdefs.h <<_ACEOF +#define uint8_t $ac_cv_c_uint8_t +_ACEOF +;; + esac + + + { echo "$as_me:$LINENO: checking for uint16_t" >&5 echo $ECHO_N "checking for uint16_t... $ECHO_C" >&6; } -if test "${ac_cv_type_uint16_t+set}" = set; then +if test "${ac_cv_c_uint16_t+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat >conftest.$ac_ext <<_ACEOF + ac_cv_c_uint16_t=no + for ac_type in 'uint16_t' 'unsigned int' 'unsigned long int' \ + 'unsigned long long int' 'unsigned short int' 'unsigned char'; do + cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default -typedef uint16_t ac__type_new_; int main () { -if ((ac__type_new_ *) 0) - return 0; -if (sizeof (ac__type_new_)) - return 0; +static int test_array [1 - 2 * !(($ac_type) -1 >> (16 - 1) == 1)]; +test_array [0] = 0 + ; return 0; } @@ -20903,48 +21068,57 @@ eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then - ac_cv_type_uint16_t=yes + case $ac_type in + uint16_t) ac_cv_c_uint16_t=yes ;; + *) ac_cv_c_uint16_t=$ac_type ;; +esac + else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 - ac_cv_type_uint16_t=no + fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + test "$ac_cv_c_uint16_t" != no && break + done fi -{ echo "$as_me:$LINENO: result: $ac_cv_type_uint16_t" >&5 -echo "${ECHO_T}$ac_cv_type_uint16_t" >&6; } -if test $ac_cv_type_uint16_t = yes; then - : -else +{ echo "$as_me:$LINENO: result: $ac_cv_c_uint16_t" >&5 +echo "${ECHO_T}$ac_cv_c_uint16_t" >&6; } + case $ac_cv_c_uint16_t in #( + no|yes) ;; #( + *) + cat >>confdefs.h <<_ACEOF -#define uint16_t unsigned short +#define uint16_t $ac_cv_c_uint16_t _ACEOF +;; + esac -fi -{ echo "$as_me:$LINENO: checking for uint32_t" >&5 + { echo "$as_me:$LINENO: checking for uint32_t" >&5 echo $ECHO_N "checking for uint32_t... $ECHO_C" >&6; } -if test "${ac_cv_type_uint32_t+set}" = set; then +if test "${ac_cv_c_uint32_t+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat >conftest.$ac_ext <<_ACEOF + ac_cv_c_uint32_t=no + for ac_type in 'uint32_t' 'unsigned int' 'unsigned long int' \ + 'unsigned long long int' 'unsigned short int' 'unsigned char'; do + cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default -typedef uint32_t ac__type_new_; int main () { -if ((ac__type_new_ *) 0) - return 0; -if (sizeof (ac__type_new_)) - return 0; +static int test_array [1 - 2 * !(($ac_type) -1 >> (32 - 1) == 1)]; +test_array [0] = 0 + ; return 0; } @@ -20966,48 +21140,61 @@ eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then - ac_cv_type_uint32_t=yes + case $ac_type in + uint32_t) ac_cv_c_uint32_t=yes ;; + *) ac_cv_c_uint32_t=$ac_type ;; +esac + else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 - ac_cv_type_uint32_t=no + fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + test "$ac_cv_c_uint32_t" != no && break + done fi -{ echo "$as_me:$LINENO: result: $ac_cv_type_uint32_t" >&5 -echo "${ECHO_T}$ac_cv_type_uint32_t" >&6; } -if test $ac_cv_type_uint32_t = yes; then - : -else +{ echo "$as_me:$LINENO: result: $ac_cv_c_uint32_t" >&5 +echo "${ECHO_T}$ac_cv_c_uint32_t" >&6; } + case $ac_cv_c_uint32_t in #( + no|yes) ;; #( + *) -cat >>confdefs.h <<_ACEOF -#define uint32_t unsigned int +cat >>confdefs.h <<\_ACEOF +#define _UINT32_T 1 _ACEOF -fi -{ echo "$as_me:$LINENO: checking for uint64_t" >&5 +cat >>confdefs.h <<_ACEOF +#define uint32_t $ac_cv_c_uint32_t +_ACEOF +;; + esac + + + { echo "$as_me:$LINENO: checking for uint64_t" >&5 echo $ECHO_N "checking for uint64_t... $ECHO_C" >&6; } -if test "${ac_cv_type_uint64_t+set}" = set; then +if test "${ac_cv_c_uint64_t+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat >conftest.$ac_ext <<_ACEOF + ac_cv_c_uint64_t=no + for ac_type in 'uint64_t' 'unsigned int' 'unsigned long int' \ + 'unsigned long long int' 'unsigned short int' 'unsigned char'; do + cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default -typedef uint64_t ac__type_new_; int main () { -if ((ac__type_new_ *) 0) - return 0; -if (sizeof (ac__type_new_)) - return 0; +static int test_array [1 - 2 * !(($ac_type) -1 >> (64 - 1) == 1)]; +test_array [0] = 0 + ; return 0; } @@ -21029,27 +21216,38 @@ eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then - ac_cv_type_uint64_t=yes + case $ac_type in + uint64_t) ac_cv_c_uint64_t=yes ;; + *) ac_cv_c_uint64_t=$ac_type ;; +esac + else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 - ac_cv_type_uint64_t=no + fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + test "$ac_cv_c_uint64_t" != no && break + done fi -{ echo "$as_me:$LINENO: result: $ac_cv_type_uint64_t" >&5 -echo "${ECHO_T}$ac_cv_type_uint64_t" >&6; } -if test $ac_cv_type_uint64_t = yes; then - : -else +{ echo "$as_me:$LINENO: result: $ac_cv_c_uint64_t" >&5 +echo "${ECHO_T}$ac_cv_c_uint64_t" >&6; } + case $ac_cv_c_uint64_t in #( + no|yes) ;; #( + *) -cat >>confdefs.h <<_ACEOF -#define uint64_t unsigned long long +cat >>confdefs.h <<\_ACEOF +#define _UINT64_T 1 _ACEOF -fi + +cat >>confdefs.h <<_ACEOF +#define uint64_t $ac_cv_c_uint64_t +_ACEOF +;; + esac { echo "$as_me:$LINENO: checking for size_t" >&5 echo $ECHO_N "checking for size_t... $ECHO_C" >&6; } @@ -21404,7 +21602,6 @@ _ACEOF fi - { echo "$as_me:$LINENO: checking for rlim_t" >&5 echo $ECHO_N "checking for rlim_t... $ECHO_C" >&6; } if test "${ac_cv_type_rlim_t+set}" = set; then @@ -21474,6 +21671,7 @@ _ACEOF fi + { echo "$as_me:$LINENO: checking for socklen_t" >&5 echo $ECHO_N "checking for socklen_t... $ECHO_C" >&6; } if test "${ac_cv_type_socklen_t+set}" = set; then @@ -21543,7 +21741,7 @@ _ACEOF fi -{ echo "$as_me:$LINENO: checking for in_addr_t" >&5 + { echo "$as_me:$LINENO: checking for in_addr_t" >&5 echo $ECHO_N "checking for in_addr_t... $ECHO_C" >&6; } if test "${ac_cv_type_in_addr_t+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 @@ -21615,7 +21813,7 @@ _ACEOF fi -{ echo "$as_me:$LINENO: checking for in_port_t" >&5 + { echo "$as_me:$LINENO: checking for in_port_t" >&5 echo $ECHO_N "checking for in_port_t... $ECHO_C" >&6; } if test "${ac_cv_type_in_port_t+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 @@ -21689,6 +21887,7 @@ fi # add option to disable the evil rpath + # Check whether --enable-rpath was given. if test "${enable_rpath+set}" = set; then enableval=$enable_rpath; enable_rpath=$enableval @@ -21706,8 +21905,10 @@ echo "${ECHO_T}Fixing libtool for -rpath problems." >&6; } libtool="./libtool" fi + # Checks for libraries. + # Check whether --with-ssl was given. if test "${with_ssl+set}" = set; then withval=$with_ssl; @@ -22059,101 +22260,6 @@ done - -for ac_func in EVP_sha1 EVP_sha256 EVP_sha512 -do -as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` -{ echo "$as_me:$LINENO: checking for $ac_func" >&5 -echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6; } -if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -/* Define $ac_func to an innocuous variant, in case declares $ac_func. - For example, HP-UX 11i declares gettimeofday. */ -#define $ac_func innocuous_$ac_func - -/* System header to define __stub macros and hopefully few prototypes, - which can conflict with char $ac_func (); below. - Prefer to if __STDC__ is defined, since - exists even on freestanding compilers. */ - -#ifdef __STDC__ -# include -#else -# include -#endif - -#undef $ac_func - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char $ac_func (); -/* The GNU C library defines this for functions which it implements - to always fail with ENOSYS. Some functions are actually named - something starting with __ and the normal name is an alias. */ -#if defined __stub_$ac_func || defined __stub___$ac_func -choke me -#endif - -int -main () -{ -return $ac_func (); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_link") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest$ac_exeext && - $as_test_x conftest$ac_exeext; then - eval "$as_ac_var=yes" -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - eval "$as_ac_var=no" -fi - -rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ - conftest$ac_exeext conftest.$ac_ext -fi -ac_res=`eval echo '${'$as_ac_var'}'` - { echo "$as_me:$LINENO: result: $ac_res" >&5 -echo "${ECHO_T}$ac_res" >&6; } -if test `eval echo '${'$as_ac_var'}'` = yes; then - cat >>confdefs.h <<_ACEOF -#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 -_ACEOF - -fi -done - - # check if libssl needs libdl BAKLIBS="$LIBS" LIBS="-lssl $LIBS" @@ -22301,6 +22407,102 @@ fi rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext + + +for ac_func in EVP_sha1 EVP_sha256 EVP_sha512 +do +as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` +{ echo "$as_me:$LINENO: checking for $ac_func" >&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6; } +if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +/* Define $ac_func to an innocuous variant, in case declares $ac_func. + For example, HP-UX 11i declares gettimeofday. */ +#define $ac_func innocuous_$ac_func + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $ac_func (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#endif + +#undef $ac_func + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char $ac_func (); +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined __stub_$ac_func || defined __stub___$ac_func +choke me +#endif + +int +main () +{ +return $ac_func (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then + eval "$as_ac_var=yes" +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + eval "$as_ac_var=no" +fi + +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext +fi +ac_res=`eval echo '${'$as_ac_var'}'` + { echo "$as_me:$LINENO: result: $ac_res" >&5 +echo "${ECHO_T}$ac_res" >&6; } +if test `eval echo '${'$as_ac_var'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF + +fi +done + + # check for thread library. # Check whether --with-pthreads was given. @@ -25251,6 +25453,7 @@ _ACEOF fi + # Check whether --enable-largefile was given. if test "${enable_largefile+set}" = set; then enableval=$enable_largefile; @@ -25754,17 +25957,11 @@ eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 ac_cv_func_getaddrinfo="yes" -cat >>confdefs.h <<\_ACEOF -#define UB_ON_WINDOWS 1 -_ACEOF - -UB_ON_WINDOWS=yes - - cat >>confdefs.h <<\_ACEOF #define USE_WINSOCK 1 _ACEOF +USE_WINSOCK="1" else echo "$as_me: failed program was:" >&5 @@ -25794,8 +25991,17 @@ _ACEOF fi +if test "$USE_WINSOCK" = 1; then + +cat >>confdefs.h <<\_ACEOF +#define UB_ON_WINDOWS 1 +_ACEOF + + UB_ON_WINDOWS=yes + +fi if test $ac_cv_func_getaddrinfo = no; then -case " $LIBOBJS " in + case " $LIBOBJS " in *" fake-rfc2553.$ac_objext "* ) ;; *) LIBOBJS="$LIBOBJS fake-rfc2553.$ac_objext" ;; @@ -25803,14 +26009,6 @@ esac fi -# check if a function is deprecated. defines DEPRECATED_func in config.h. -# 1: function name -# 2: C-statement that calls the function. -# 3: includes for the program. -# 4: executes if yes -# 5: executes if no - - # see if daemon(3) exists, and if it is deprecated. for ac_func in daemon @@ -26160,7 +26358,6 @@ _ACEOF fi -# check if select and nonblocking sockets actually work. { echo "$as_me:$LINENO: checking if nonblocking sockets work" >&5 echo $ECHO_N "checking if nonblocking sockets work... $ECHO_C" >&6; } if test "$cross_compiling" = yes; then @@ -26346,7 +26543,7 @@ fi -# check mkdir + { echo "$as_me:$LINENO: checking whether mkdir has one arg" >&5 echo $ECHO_N "checking whether mkdir has one arg... $ECHO_C" >&6; } cat >conftest.$ac_ext <<_ACEOF @@ -26411,6 +26608,7 @@ fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + # check ioctlsocket { echo "$as_me:$LINENO: checking for ioctlsocket" >&5 echo $ECHO_N "checking for ioctlsocket... $ECHO_C" >&6; } @@ -27480,6 +27678,45 @@ _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" diff --git a/configure.ac b/configure.ac index d213b7ea4..14460c197 100644 --- a/configure.ac +++ b/configure.ac @@ -133,14 +133,14 @@ AC_LANG_C ACX_CHECK_COMPILER_FLAG(g, [CFLAGS="$CFLAGS -g"]) ACX_CHECK_COMPILER_FLAG(O2, [CFLAGS="$CFLAGS -O2"]) AC_PROG_CC -AC_CHECK_HEADERS([winsock2.h ws2tcpip.h],,, [AC_INCLUDES_DEFAULT]) ACX_DEPFLAG ACX_DETERMINE_EXT_FLAGS_UNBOUND # for Sun studio 11. ACX_CHECK_COMPILER_FLAG(xO4, [CFLAGS="$CFLAGS -xO4"]) ACX_CHECK_COMPILER_FLAG(xtarget=generic, [CFLAGS="$CFLAGS -xtarget=generic"]) -# flag warnings. + +# debug mode flags warnings AC_ARG_ENABLE(debug, AC_HELP_STRING([--enable-debug], [Enable debug warnings, asserts, makefile-dependencies])) debug_enabled="$enable_debug" AC_SUBST(debug_enabled) @@ -171,153 +171,36 @@ AC_CHECK_PROG(doxygen, doxygen, doxygen) ACX_LIBTOOL_C_ONLY # Checks for header files. -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],,, [AC_INCLUDES_DEFAULT]) +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]) # check for types -AC_CHECK_TYPE(int8_t, 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) +AC_TYPE_INT8_T +AC_TYPE_INT16_T +AC_TYPE_INT32_T +AC_TYPE_INT64_T +AC_TYPE_UINT8_T +AC_TYPE_UINT16_T +AC_TYPE_UINT32_T +AC_TYPE_UINT64_T AC_TYPE_SIZE_T -AC_CHECK_TYPE(ssize_t, int) +AC_TYPE_SSIZE_T AC_TYPE_UID_T AC_TYPE_PID_T AC_TYPE_OFF_T -AC_CHECK_TYPE(u_char, unsigned char) - -AC_CHECK_TYPE(rlim_t, , - [AC_DEFINE([rlim_t], [unsigned long], [Define to 'int' if not defined])], [ -AC_INCLUDES_DEFAULT -#if HAVE_SYS_RESOURCE_H -# include -#endif -]) -AC_CHECK_TYPE(socklen_t, , - [AC_DEFINE([socklen_t], [int], [Define to 'int' if not defined])], [ -AC_INCLUDES_DEFAULT -#if HAVE_SYS_SOCKET_H -# include -#endif -]) -AC_CHECK_TYPE(in_addr_t, [], [AC_DEFINE([in_addr_t], [uint32_t], [in_addr_t])], [ -AC_INCLUDES_DEFAULT -#if HAVE_SYS_TYPES_H -# include -#endif -#if HAVE_NETINET_IN_H -# include -#endif -]) -AC_CHECK_TYPE(in_port_t, [], [AC_DEFINE([in_port_t], [uint16_t], [in_port_t])], [ -AC_INCLUDES_DEFAULT -#if HAVE_SYS_TYPES_H -# include -#endif -#if HAVE_NETINET_IN_H -# include -#endif -]) +ACX_TYPE_U_CHAR +ACX_TYPE_RLIM_T +ACX_TYPE_SOCKLEN_T +ACX_TYPE_IN_ADDR_T +ACX_TYPE_IN_PORT_T # add option to disable the evil rpath -dnl Check whether to use rpath or not -AC_ARG_ENABLE(rpath, - [ --disable-rpath disable hardcoded rpath (default=enabled)], - enable_rpath=$enableval, enable_rpath=yes) -if test "x$enable_rpath" = xno; then - AC_MSG_RESULT([Fixing libtool for -rpath problems.]) - sed < libtool > libtool-2 \ - 's/^hardcode_libdir_flag_spec.*$'/'hardcode_libdir_flag_spec=" -D__LIBTOOL_RPATH_SED__ "/' - mv libtool-2 libtool - chmod 755 libtool - libtool="./libtool" -fi +ACX_ARG_RPATH # Checks for libraries. -AC_ARG_WITH(ssl, AC_HELP_STRING([--with-ssl=pathname], - [enable SSL (will check /usr/local/ssl - /usr/lib/ssl /usr/ssl /usr/pkg /usr/local /opt/local /usr/sfw /usr)]),[ - ],[ - withval="yes" - ]) - if test x_$withval = x_no; then - AC_MSG_ERROR([Need SSL library to do digital signature cryptography]) - fi - if test x_$withval != x_no; then - AC_MSG_CHECKING(for SSL) - if test x_$withval = x_ -o x_$withval = x_yes; then - withval="/usr/local/ssl /usr/lib/ssl /usr/ssl /usr/pkg /usr/local /opt/local /usr/sfw /usr" - fi - for dir in $withval; do - ssldir="$dir" - if test -f "$dir/include/openssl/ssl.h"; then - found_ssl="yes" - AC_DEFINE_UNQUOTED([HAVE_SSL], [], [Define if you have the SSL libraries installed.]) - CPPFLAGS="$CPPFLAGS -I$ssldir/include" - break; - fi - done - if test x_$found_ssl != x_yes; then - AC_MSG_ERROR(Cannot find the SSL libraries in $withval) - else - AC_MSG_RESULT(found in $ssldir) - HAVE_SSL=yes - LDFLAGS="$LDFLAGS -L$ssldir/lib" - if test "x$enable_rpath" = xyes; then - RUNTIME_PATH="$RUNTIME_PATH -R$ssldir/lib" - fi - - AC_MSG_CHECKING([for HMAC_CTX_init in -lcrypto]) - LIBS="$LIBS -lcrypto" - AC_TRY_LINK(, [ - int HMAC_CTX_init(void); - (void)HMAC_CTX_init(); - ], [ - AC_MSG_RESULT(yes) - AC_DEFINE([HAVE_HMAC_CTX_INIT], 1, - [If you have HMAC_CTX_init]) - ], [ - AC_MSG_RESULT(no) - # check if -lwsock32 or -lgdi32 are needed. - LIBS="$LIBS -lgdi32" - AC_MSG_CHECKING([if -lcrypto needs -lgdi32]) - AC_TRY_LINK([], [ - int HMAC_CTX_init(void); - (void)HMAC_CTX_init(); - ],[ - AC_DEFINE([HAVE_HMAC_CTX_INIT], 1, - [If you have HMAC_CTX_init]) - AC_MSG_RESULT(yes) - ],[ - AC_MSG_RESULT(no) - AC_MSG_ERROR([OpenSSL found in $ssldir, but version 0.9.7 or higher is required]) - ]) - ]) - fi - AC_SUBST(HAVE_SSL) - AC_SUBST(RUNTIME_PATH) - fi -AC_CHECK_HEADERS([openssl/ssl.h],,, [AC_INCLUDES_DEFAULT]) -AC_CHECK_HEADERS([openssl/err.h],,, [AC_INCLUDES_DEFAULT]) -AC_CHECK_HEADERS([openssl/rand.h],,, [AC_INCLUDES_DEFAULT]) +ACX_WITH_SSL +ACX_LIB_SSL AC_CHECK_FUNCS([EVP_sha1 EVP_sha256 EVP_sha512]) -# check if libssl needs libdl -BAKLIBS="$LIBS" -LIBS="-lssl $LIBS" -AC_MSG_CHECKING([if libssl needs libdl]) -AC_TRY_LINK_FUNC([SSL_CTX_new], [ - AC_MSG_RESULT([no]) - LIBS="$BAKLIBS" -] , [ - AC_MSG_RESULT([yes]) - LIBS="$BAKLIBS" - AC_SEARCH_LIBS([dlopen], [dl]) -]) - # check for thread library. AC_ARG_WITH(pthreads, AC_HELP_STRING([--with-pthreads], [use pthreads library, or --without-pthreads to disable threading support.]), @@ -477,116 +360,22 @@ AC_FUNC_CHOWN AC_FUNC_FORK AC_TYPE_SIGNAL AC_FUNC_FSEEKO -AC_SYS_LARGEFILE -dnl try to see if an additional _LARGEFILE_SOURCE 1 is needed to get fseeko -ACX_CHECK_COMPILER_FLAG_NEEDED(-D_LARGEFILE_SOURCE=1, -[ -#include -int test() { - int a = fseeko(stdin, 0, 0); - return a; -} -], [CFLAGS="$CFLAGS -D_LARGEFILE_SOURCE=1"]) +ACX_SYS_LARGEFILE -AC_DEFUN([AC_CHECK_GETADDRINFO_WITH_INCLUDES], -[AC_REQUIRE([AC_PROG_CC]) -AC_MSG_CHECKING(for getaddrinfo) -ac_cv_func_getaddrinfo=no -AC_LINK_IFELSE( -[ -#ifdef __cplusplus -extern "C" -{ -#endif -char* getaddrinfo(); -char* (*f) () = getaddrinfo; -#ifdef __cplusplus -} -#endif -int main() { - ; - return 0; -} -], -dnl this case on linux, solaris, bsd -[ac_cv_func_getaddrinfo="yes"], -dnl no quick getaddrinfo, try mingw32 and winsock2 library. -ORIGLIBS="$LIBS" -LIBS="$LIBS -lws2_32" -AC_LINK_IFELSE( -AC_LANG_PROGRAM( -[ -#ifdef HAVE_WS2TCPIP_H -#include -#endif -], -[ - (void)getaddrinfo(NULL, NULL, NULL, NULL); -] -), -[ -ac_cv_func_getaddrinfo="yes" -dnl already: LIBS="$LIBS -lws2_32" -AC_DEFINE(UB_ON_WINDOWS, 1, [Use win32 resources and API]) -UB_ON_WINDOWS=yes -AC_SUBST(UB_ON_WINDOWS) -AC_DEFINE(USE_WINSOCK, 1, [Whether the windows socket API is used]) -], -[ -ac_cv_func_getaddrinfo="no" -LIBS="$ORIGLIBS" -]) -) - -AC_MSG_RESULT($ac_cv_func_getaddrinfo) -if test $ac_cv_func_getaddrinfo = yes; then - AC_DEFINE(HAVE_GETADDRINFO, 1, [Whether getaddrinfo is available]) +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) fi -])dnl - -AC_CHECK_GETADDRINFO_WITH_INCLUDES if test $ac_cv_func_getaddrinfo = no; then -AC_LIBOBJ([fake-rfc2553]) + AC_LIBOBJ([fake-rfc2553]) fi -# check if a function is deprecated. defines DEPRECATED_func in config.h. -# 1: function name -# 2: C-statement that calls the function. -# 3: includes for the program. -# 4: executes if yes -# 5: executes if no -AC_DEFUN([CHECK_DEPRECATED], -[ -AC_REQUIRE([AC_PROG_CC]) -AC_MSG_CHECKING(if $1 is deprecated) -cache=`echo $1 | sed 'y%.=/+-%___p_%'` -AC_CACHE_VAL(cv_cc_deprecated_$cache, -[ -echo '$3' >conftest.c -echo 'void f(){ $2 }' >>conftest.c -if test -z "`$CC -c conftest.c 2>&1 | grep deprecated`"; then -eval "cv_cc_deprecated_$cache=no" -else -eval "cv_cc_deprecated_$cache=yes" -fi -rm -f conftest conftest.o conftest.c -]) -if eval "test \"`echo '$cv_cc_deprecated_'$cache`\" = yes"; then -AC_MSG_RESULT(yes) -AC_DEFINE_UNQUOTED(AS_TR_CPP([DEPRECATED_$1]), 1, [Whether $1 is deprecated]) -: -$4 -else -AC_MSG_RESULT(no) -: -$5 -fi -]) - # see if daemon(3) exists, and if it is deprecated. AC_CHECK_FUNCS([daemon]) if test $ac_cv_func_daemon = yes; then - CHECK_DEPRECATED([daemon], [(void)daemon(0, 0);], [ + ACX_FUNC_DEPRECATED([daemon], [(void)daemon(0, 0);], [ #include ]) fi @@ -598,168 +387,9 @@ AC_CHECK_FUNCS([tzset sigprocmask fcntl getpwnam getrlimit setsid sbrk chroot ki 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 - -# check if select and nonblocking sockets actually work. -AC_MSG_CHECKING([if nonblocking sockets work]) -AC_RUN_IFELSE(AC_LANG_PROGRAM([ -#include -#include -#include -#include -#include -#ifdef HAVE_SYS_TYPES_H -#include -#endif -#ifdef HAVE_SYS_SOCKET_H -#include -#endif -#ifdef HAVE_NETINET_IN_H -#include -#endif -#ifdef HAVE_ARPA_INET_H -#include -#endif -#ifdef HAVE_UNISTD_H -#include -#endif -#ifdef HAVE_TIME_H -#include -#endif -],[[ - int port; - int sfd, cfd; - int num = 10; - int i, p; - struct sockaddr_in a; - /* test if select and nonblocking reads work well together */ - /* open port. - fork child to send 10 messages. - select to read. - then try to nonblocking read the 10 messages - then, nonblocking read must give EAGAIN - */ - - port = 12345 + (time(0)%32); - sfd = socket(PF_INET, SOCK_DGRAM, 0); - if(sfd == -1) { - perror("socket"); - return 1; - } - memset(&a, 0, sizeof(a)); - a.sin_family = AF_INET; - a.sin_port = htons(port); - a.sin_addr.s_addr = inet_addr("127.0.0.1"); - if(bind(sfd, (struct sockaddr*)&a, sizeof(a)) < 0) { - perror("bind"); - return 1; - } - if(fcntl(sfd, F_SETFL, O_NONBLOCK) == -1) { - perror("fcntl"); - return 1; - } - - cfd = socket(PF_INET, SOCK_DGRAM, 0); - if(cfd == -1) { - perror("client socket"); - return 1; - } - a.sin_port = 0; - if(bind(cfd, (struct sockaddr*)&a, sizeof(a)) < 0) { - perror("client bind"); - return 1; - } - a.sin_port = htons(port); - - /* no handler, causes exit in 10 seconds */ - alarm(10); - - /* send and receive on the socket */ - if((p=fork()) == 0) { - for(i=0; i -#include -#ifdef HAVE_WINSOCK2_H -#include -#endif -#ifdef HAVE_SYS_STAT_H -#include -#endif -], [ - (void)mkdir("directory"); -], -AC_MSG_RESULT(yes) -AC_DEFINE(MKDIR_HAS_ONE_ARG, 1, [Define if mkdir has one argument.]) -, -AC_MSG_RESULT(no) -) - -# check ioctlsocket -AC_MSG_CHECKING(for ioctlsocket) -AC_LINK_IFELSE(AC_LANG_PROGRAM([ -#ifdef HAVE_WINSOCK2_H -#include -#endif -], [ - (void)ioctlsocket(0, 0, NULL); -]), [ -AC_MSG_RESULT(yes) -AC_DEFINE(HAVE_IOCTLSOCKET, 1, [if the function 'ioctlsocket' is available]) -],[AC_MSG_RESULT(no)]) - +ACX_CHECK_NONBLOCKING_BROKEN +ACX_MKDIR_ONE_ARG +ACX_FUNC_IOCTLSOCKET AC_REPLACE_FUNCS(inet_aton) AC_REPLACE_FUNCS(inet_pton) AC_REPLACE_FUNCS(inet_ntop) @@ -881,43 +511,32 @@ AH_BOTTOM([ #ifdef HAVE_OPENSSL_RAND_H #include #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 -#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 */ +AH_BOTTOM([ #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 -#ifndef RAND_MAX -#define RAND_MAX 2147483647 -#endif - -#ifndef MAXHOSTNAMELEN -#define MAXHOSTNAMELEN 256 -#endif - -#ifndef IPV6_MIN_MTU -#define IPV6_MIN_MTU 1280 -#endif /* IPV6_MIN_MTU */ - #ifndef CHECKED_INET6 # define CHECKED_INET6 # ifdef AF_INET6 @@ -929,61 +548,10 @@ AH_BOTTOM([ /* maximum nesting of included files */ #define MAXINCLUDES 10 - -#ifndef HAVE_SNPRINTF -#define snprintf snprintf_unbound -#define vsnprintf vsnprintf_unbound -#include -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 -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_GETADDRINFO struct sockaddr_storage; #include "compat/fake-rfc2553.h" #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) -#else -#define FD_SET_T -#endif #include "ldns/ldns.h"