]> git.ipfire.org Git - thirdparty/ntp.git/commitdiff
Update --enable-getifaddrs handling in ntp_ipv6.m4 to match bind 9.9.1 for
authorDave Hart <hart@ntp.org>
Sun, 3 Jun 2012 07:18:47 +0000 (07:18 +0000)
committerDave Hart <hart@ntp.org>
Sun, 3 Jun 2012 07:18:47 +0000 (07:18 +0000)
  [Bug 2204] Build with --enable-getifaddrs=glibc fails

bk: 4fcb0fd7U8VCqsWkQb_3O8X7R96r2w

14 files changed:
include/isc/mem.h
include/ntp_stdlib.h
lib/isc/assertions.c
lib/isc/include/isc/assertions.h
lib/isc/task.c
lib/isc/unix/interfaceiter.c
libntp/Makefile.am
libntp/msyslog.c
ports/winnt/include/config.h
ports/winnt/vs2005/libntp.vcproj
ports/winnt/vs2008/libntp/libntp.vcproj
sntp/m4/ntp_compiler.m4
sntp/m4/ntp_ipv6.m4
sntp/m4/ntp_libntp.m4

index f5cf9ec57fff58f9ff44de7f80e9632965623894..ba1bfeb0e483ec6f63a03ba4798ea05e6f221db0 100644 (file)
@@ -60,9 +60,9 @@
 #define isc_mem_strdup(c, str)         \
        ( ISC_MEM_UNUSED_ARG(c),        estrdup(str) )
 
-#define isc_mem_attach(src, ptgt)      do { *(ptgt) = (src); } while (0)
-#define isc_mem_detach(c)              ISC_MEM_UNUSED_ARG(c)
-#define isc_mem_printallactive(s)      fprintf((s), \
+#define isc__mem_attach(src, ptgt)     do { *(ptgt) = (src); } while (0)
+#define isc__mem_detach(c)             ISC_MEM_UNUSED_ARG(c)
+#define isc__mem_printallactive(s)     fprintf((s), \
                                        "isc_mem_printallactive() stubbed.\n")
 
 #endif /* ISC_MEM_H */
index 9c4215cb37ae186f292b06cc7a27b039dece5f2c..14024728511c4ac2e300dcf0a8221a978d19edcd 100644 (file)
 #include "ntp_syslog.h"
 
 
-/*
- * #define away gcc __attribute__ if unavailable.
- */
-#ifndef __attribute__
-  /* This feature is available in gcc versions 2.5 and later.  */
-# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 5) || (defined(__STRICT_ANSI__))
-#  define __attribute__(Spec) /* empty */
-# endif
-  /*
-   * The __-protected variants of `format' and `printf' attributes are
-   * accepted by gcc versions 2.6.4 (effectively 2.7) and later.
-   */
-# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 7)
-#  define __format__   format
-#  define __printf__   printf
-#  define __noreturn__ noreturn
-# endif
-#endif
-
 extern int     mprintf(const char *, ...)
                        __attribute__((__format__(__printf__, 1, 2)));
 extern int     mfprintf(FILE *, const char *, ...)
index bde4e88dc1861522a349613c385cd22ce681a199..31c4fe7c9f273a2d109e43cd2fce2c9ae97aa3b7 100644 (file)
@@ -40,8 +40,7 @@
  * Forward.
  */
 static void
-default_callback(const char *, int, isc_assertiontype_t, const char *)
-       __attribute__ ((__noreturn__));
+default_callback(const char *, int, isc_assertiontype_t, const char *);
 
 static isc_assertioncallback_t isc_assertion_failed_cb = default_callback;
 
index c30282ac079d282cc729781d0f2786323354c9d7..2c81b1ae9880cfb51dfdb685d4817006c2be173c 100644 (file)
 #include <isc/lang.h>
 #include <isc/platform.h>
 
-/*
- * #define away gcc __attribute__ if unavailable.
- */
-#ifndef __attribute__
-  /* This feature is available in gcc versions 2.5 and later.  */
-# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 5) || (defined(__STRICT_ANSI__))
-#  define __attribute__(Spec) /* empty */
-# endif
-  /*
-   * The __-protected variants of `format' and `printf' attributes are
-   * accepted by gcc versions 2.6.4 (effectively 2.7) and later.
-   */
-# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 7)
-#  define __format__   format
-#  define __printf__   printf
-#  define __noreturn__ noreturn
-# endif
-#endif
-
 ISC_LANG_BEGINDECLS
 
 /*% isc assertion type */
@@ -57,8 +38,7 @@ typedef enum {
 } isc_assertiontype_t;
 
 typedef void (*isc_assertioncallback_t)(const char *, int, isc_assertiontype_t,
-                                       const char *)
-                                       __attribute__ ((__noreturn__));
+                                       const char *);
 
 /* coverity[+kill] */
 ISC_PLATFORM_NORETURN_PRE
index 6c572f1eeacfe493da670adc361841674b84b828..cd19d2d5270bbafa4180107a44171f4e97ef38f6 100644 (file)
@@ -1359,8 +1359,6 @@ isc__taskmgr_create(isc_mem_t *mctx, unsigned int workers,
        if (result != ISC_R_SUCCESS)
                goto cleanup_mgr;
        LOCK(&manager->lock);
-       manager->magic = TASK_MANAGER_MAGIC;
-       manager->mctx = NULL;
 
 #ifdef USE_WORKER_THREADS
        manager->workers = 0;
index d50b61b22bd538ed1bc066361a25d6fe607ab539..c42fa685c920f2290af44874871ea1338b3ee0f9 100644 (file)
@@ -189,11 +189,9 @@ static isc_result_t
 linux_if_inet6_current(isc_interfaceiter_t *iter) {
        char address[33];
        char name[IF_NAMESIZE+1];
-       char strbuf[ISC_STRERRORSIZE];
        struct in6_addr addr6;
        unsigned int ifindex;
        int prefix, scope, flags;
-       struct ifreq ifreq;
        int res;
        unsigned int i;
 
@@ -238,34 +236,7 @@ linux_if_inet6_current(isc_interfaceiter_t *iter) {
                addr6.s6_addr[i] = byte;
        }
        iter->current.af = AF_INET6;
-       iter->current.flags = 0;
-       memset(&ifreq, 0, sizeof(ifreq));
-       INSIST(sizeof(ifreq.ifr_name) <= sizeof(iter->current.name));
-       strncpy(ifreq.ifr_name, name, sizeof(ifreq.ifr_name));
-
-       if (ioctl(iter->socket, SIOCGIFFLAGS, (char *) &ifreq) < 0) {
-               isc__strerror(errno, strbuf, sizeof(strbuf));
-               UNEXPECTED_ERROR(__FILE__, __LINE__,
-                               "%s: getting interface flags: %s",
-                               ifreq.ifr_name, strbuf);
-               return (ISC_R_IGNORE);
-       }
-
-       if ((ifreq.ifr_flags & IFF_UP) != 0)
-               iter->current.flags |= INTERFACE_F_UP;
-#ifdef IFF_POINTOPOINT
-       if ((ifreq.ifr_flags & IFF_POINTOPOINT) != 0)
-               iter->current.flags |= INTERFACE_F_POINTTOPOINT;
-#endif
-       if ((ifreq.ifr_flags & IFF_LOOPBACK) != 0)
-               iter->current.flags |= INTERFACE_F_LOOPBACK;
-       if ((ifreq.ifr_flags & IFF_BROADCAST) != 0)
-               iter->current.flags |= INTERFACE_F_BROADCAST;
-#ifdef IFF_MULTICAST
-       if ((ifreq.ifr_flags & IFF_MULTICAST) != 0)
-               iter->current.flags |= INTERFACE_F_MULTICAST;
-#endif
-
+       iter->current.flags = INTERFACE_F_UP;
        isc_netaddr_fromin6(&iter->current.address, &addr6);
        iter->current.ifindex = ifindex;
        if (isc_netaddr_islinklocal(&iter->current.address)) {
index e86a7259af052c19eb166d07291734fffce230a3..d0aa08d7c249d7c3488be39232f8f218aabf8627 100644 (file)
@@ -7,6 +7,8 @@ EXTRA_LIBRARIES = libntpsim.a
 libisc_SRCS =                                                          \
        $(srcdir)/../lib/isc/assertions.c                               \
        $(srcdir)/../lib/isc/buffer.c                                   \
+       $(srcdir)/../lib/isc/backtrace-emptytbl.c                       \
+       $(srcdir)/../lib/isc/backtrace.c                                \
        $(srcdir)/../lib/isc/$(LIBISC_PTHREADS_NOTHREADS)/condition.c   \
        $(srcdir)/../lib/isc/unix/dir.c                                 \
        $(srcdir)/../lib/isc/error.c                                    \
index 8ed9dc4e75369c47faa4f052070ad84257ef2b44..283414d7442350065247b23e73b924e6c3bbd058 100644 (file)
@@ -45,14 +45,6 @@ void addto_syslog    (int, const char *);
 #ifndef VSNPRINTF_PERCENT_M
 void   format_errmsg   (char *, size_t, const char *, int);
 
-/*
- * Work around misdetection by AC_FUNC_STRERROR_R on Debian Linux.
- */
-# if defined(STRERROR_R_CHAR_P) && strerror_r == __xpg_strerror_r
-#  undef STRERROR_R_CHAR_P
-# endif
-
-
 /* format_errmsg() is under #ifndef VSNPRINTF_PERCENT_M above */
 void
 format_errmsg(
@@ -115,15 +107,7 @@ errno_to_str(
 
        buf[0] = '\0';
 #  ifdef STRERROR_R_CHAR_P
-       /*
-        * For older GNU strerror_r, the return value either points to
-        * buf, or to static storage.  We want the result always in buf.
-        * On Debian Linux 6.03 with gcc 4.4, strerror_r() returns an
-        * int despite configure detecting STRERROR_R_CHAR_P.  We are
-        * careful with the result, but need to cast to (char *) to
-        * silence gcc on Debian 6.03.
-        */
-       pstatic = (char *)strerror_r(err, buf, bufsiz);
+       pstatic = strerror_r(err, buf, bufsiz);
 #  else
        pstatic = strerror(err);
 #  endif
index e1a84c034b7267f29d392ac05ba4e6d10a1054b5..83b36d042372e71f6a80ab435f0311e80c02ad25 100644 (file)
@@ -32,8 +32,9 @@
 #define _WIN32_WINNT 0x0501
 #endif
 
-
+#define __attribute__(x) /* empty */
 #define _CRT_SECURE_NO_DEPRECATE 1
+
 /*
  * ANSI C compliance enabled
  */
index 26d51d2f8f0c2ab488ae26122b4a4d13f848850a..f2d0b9e714dfcd29489a99ac7222823d682a4646 100644 (file)
                                RelativePath="..\..\..\lib\isc\buffer.c"
                                >
                        </File>
+                       <File
+                               RelativePath="..\..\..\lib\isc\backtrace-emtpytbl.c"
+                               >
+                       </File>
+                       <File
+                               RelativePath="..\..\..\lib\isc\backtrace.c"
+                               >
+                       </File>
                        <File
                                RelativePath="..\..\..\libntp\buftvtots.c"
                                >
index 37e301bed42865f0a11fbfd785df914acdb18467..4c1a0dc7520db30f639c1ba7dd0c6ce1db73a9c6 100644 (file)
                                RelativePath="..\..\..\..\libntp\authusekey.c"
                                >
                        </File>
+                       <File
+                               RelativePath="..\..\..\..\lib\isc\backtrace-emptytbl.c"
+                               >
+                       </File>
+                       <File
+                               RelativePath="..\..\..\..\lib\isc\backtrace.c"
+                               >
+                       </File>
                        <File
                                RelativePath="..\..\..\..\lib\isc\buffer.c"
                                >
                                >
                        </File>
                        <File
-                               RelativePath="..\..\..\..\lib\isc\win32\include\isc\time.h"
+                               RelativePath="..\..\include\sys\time.h"
                                >
                        </File>
                        <File
-                               RelativePath="..\..\include\sys\time.h"
+                               RelativePath="..\..\..\..\lib\isc\win32\include\isc\time.h"
                                >
                        </File>
                        <File
index 49d677bd6ac6b91ea46f11c931d4fd1c4d1880f2..2b418662b99c2ccb7fd2765424244c2106a4915a 100644 (file)
@@ -34,6 +34,35 @@ case "$ntp_cv_cpp_warning" in
        [Should we avoid @%:@warning on option name collisions?])
 esac
 
+AC_CACHE_CHECK(
+    [if $CC supports __attribute__((...))],
+    [ntp_cv_cc_attribute],
+    [AC_COMPILE_IFELSE(
+       [AC_LANG_PROGRAM(
+           [[]],
+           [[void foo(void) __attribute__((__noreturn__));]]
+           )],
+       [ntp_cv_cc_attribute=yes],
+       [ntp_cv_cc_attribute=no]
+    )]
+)
+case "$ntp_cv_cc_attribute" in
+ yes)
+    AC_DEFINE([HAVE___ATTRIBUTE__], [],
+       [defined if C compiler supports __attribute__((...))])
+esac
+AH_VERBATIM(
+    [HAVE___ATTRIBUTE___VERBATIM],
+    [
+       /* define away __attribute__() if unsupported */
+       #ifndef HAVE___ATTRIBUTE__
+       # define __attribute__(x) /* empty */
+       #endif
+       #define ISC_PLATFORM_NORETURN_PRE
+       #define ISC_PLATFORM_NORETURN_POST __attribute__((__noreturn__))
+    ]
+)
+
 case "$GCC" in
  yes)
     SAVED_CFLAGS="$CFLAGS"
index 97a6d3ed1c4d9bcd2f9b8f7462de2f6deb3a8b72..91cca778db0125641b28d3db222b92d2fe71bb5a 100644 (file)
@@ -484,51 +484,18 @@ AC_ARG_ENABLE(
     [getifaddrs],
     [AS_HELP_STRING(
        [--enable-getifaddrs],
-       [s Enable the use of getifaddrs() [[yes|no|glibc]].
-glibc: Use getifaddrs() in glibc if you know it supports IPv6.]
+       [+ Enable the use of getifaddrs() [[yes|no]].]
     )],
     [want_getifaddrs="$enableval"],
     [want_getifaddrs="yes"]
 )
 
 case $want_getifaddrs in
- yes|glibc)
-    #
-    # Do we have getifaddrs() ?
-    #
-    case $host in
-     *-*linux*)
-       # Some recent versions of glibc support getifaddrs() which does not
-       # provide AF_INET6 addresses while the function provided by the USAGI
-       # project handles the AF_INET6 case correctly.  We need to avoid
-       # using the former but prefer the latter unless overridden by
-       # --enable-getifaddrs=glibc.
-       case "$want_getifaddrs" in
-        glibc)
-           AC_CHECK_FUNCS([getifaddrs])
-           ;;
-        *)
-           save_LIBS="$LIBS"
-           LIBS="-L/usr/local/v6/lib $LIBS"
-           AC_CHECK_LIB(
-               [inet6],
-               [getifaddrs],
-               [ans=yes],
-               [ans=no]
-           )
-           case "$ans" in
-            yes)
-               LIBS="$LIBS -linet6"
-               AC_DEFINE([HAVE_GETIFADDRS], [1])
-               ;;
-            *)
-               LIBS=${save_LIBS}
-               ;;
-           esac
-           ;;
-       esac
-       ;;
-    esac
+ no)
+    ;;
+ glibc)
+    AC_MSG_WARN([--enable-getifaddrs=glibc is no longer required])
+    AC_CHECK_FUNCS([getifaddrs])
     ;;
  *)
     AC_CHECK_FUNCS([getifaddrs])
index d2eb32786baa9dd18b9ea7bce9ea7422d7e629fc..3bf4757a343eb3d21c64b4099d370c1d434f087d 100644 (file)
@@ -476,10 +476,16 @@ AC_DEFUN([NTP_BEFORE_HW_FUNC_VSNPRINTF], [
        hw_force_rpl_snprintf=yes
        hw_force_rpl_vsnprintf=yes
     esac
-    AH_TOP([
-       #if !defined(_KERNEL) && !defined(PARSESTREAM)
-       # include <stdio.h>     /* before #define vsnprintf rpl_... */
-       #endif
+    AH_VERBATIM(
+       [snprinte],dnl  sorted in config.h just before #define snprintf
+       [
+           #if !defined(_KERNEL) && !defined(PARSESTREAM)
+           /*
+            * stdio.h must be included after _GNU_SOURCE is defined
+            * but before #define snprintf rpl_snprintf
+            */
+           # include <stdio.h> 
+           #endif
        ])
     AH_BOTTOM([
        #if !defined(_KERNEL) && !defined(PARSESTREAM)