]> git.ipfire.org Git - thirdparty/ntp.git/commitdiff
Get rid of configure tests for __ss_family and __ss_len when the more
authorDave Hart <hart@ntp.org>
Tue, 27 Oct 2009 00:16:02 +0000 (00:16 +0000)
committerDave Hart <hart@ntp.org>
Tue, 27 Oct 2009 00:16:02 +0000 (00:16 +0000)
  common ss_family and ss_len are present.

bk: 4ae63bc2O1EJI3JMvi9vSapdDIEo5g

ChangeLog
configure.ac
sntp/configure.ac

index 59fb2301cebb840b0d8bffb075583aceedcd028a..f4435aad82511165ac964e71beb6099ef8e7fb5d 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -5,6 +5,8 @@
 * CID 105, 106 ensure ntpdc arrays are not overrun even if callers
   misbehave.
 * CID 113 use va_end() in refclock_true.c true_debug().
+* Get rid of configure tests for __ss_family and __ss_len when the more
+  common ss_family and ss_len are present.
 (4.2.5p237-RC) 2009/10/26 Released by Harlan Stenn <stenn@ntp.org>
 * [Bug 610] NMEA support for using PPSAPI on a different device.
 * [Bug 1238] use only fudge time2 to offset NMEA serial timestamp.
index cad719141368c66c4c8cf5dfa6cbf3b5d15fcc54..04beef61f880682e033025d2e7350b83c975b569 100644 (file)
@@ -751,32 +751,6 @@ if test $ac_cv_type_u_int64_t = yes; then
        AC_DEFINE(HAVE_TYPE_U_INT64_T, 1, [Does u_int64_t exist?])
 fi
 
-#
-# Look for in_port_t.
-#
-AC_CACHE_CHECK(
-    [for in_port_t],
-    isc_cv_have_in_port_t,
-    [
-       AC_TRY_COMPILE(
-           [
-               #include <sys/types.h>
-               #include <netinet/in.h>
-           ],
-           [
-               in_port_t port = 25; 
-               return (0);
-           ],
-           [isc_cv_have_in_port_t=yes],
-           [isc_cv_have_in_port_t=no]
-       )
-    ]
-)
-case "$isc_cv_have_in_port_t" in
- no)
-       AC_DEFINE(ISC_PLATFORM_NEEDPORTT, 1, [Declare in_port_t?])
-esac
-
 AC_CACHE_CHECK([for a fallback value for HZ], ac_cv_var_default_hz,
 [ac_cv_var_default_hz=100
 case "$host" in
@@ -896,104 +870,198 @@ if test $ac_cv_struct_ppsclockev = yes; then
     AC_DEFINE(HAVE_STRUCT_PPSCLOCKEV, 1, [Does a system header define struct ppsclockev?])
 fi
 
-AC_CACHE_CHECK([for struct sockaddr_storage], ac_cv_struct_sockaddr_storage,
-[AC_TRY_COMPILE([
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-],[
-struct sockaddr_storage n;],
-       ac_cv_struct_sockaddr_storage=yes,
-       ac_cv_struct_sockaddr_storage=no)
-])
-if test $ac_cv_struct_sockaddr_storage = yes; then
+AC_CACHE_CHECK(
+    [for struct sockaddr_storage],
+    ntp_cv_sockaddr_storage,
+    [
+       AC_TRY_COMPILE(
+           [
+               #ifdef HAVE_SYS_TYPES_H
+               # include <sys/types.h>
+               #endif
+               #ifdef HAVE_SYS_SOCKET_H
+               # include <sys/socket.h>
+               #endif
+               #ifdef HAVE_NETINET_IN_H
+               # include <netinet/in.h>
+               #endif
+           ],
+           [
+               struct sockaddr_storage n;
+           ],
+           [ntp_cv_sockaddr_storage="yes"],
+           [ntp_cv_sockaddr_storage="no"]
+       )
+    ]
+)
+case "$ntp_cv_sockaddr_storage" in
+ yes)
     AC_DEFINE(HAVE_STRUCT_SOCKADDR_STORAGE, 1, [Does a system header define struct sockaddr_storage?])
-fi
+esac
 
-AC_CACHE_CHECK([for ss_family field in struct sockaddr_storage],
-               ac_cv_have_ss_family_in_struct_ss, [
+AC_CACHE_CHECK(
+    [for sockaddr_storage.ss_family],
+    ntp_cv_have_ss_family,
+    [
        AC_TRY_COMPILE(
-               [
-#include <sys/types.h>
-#include <sys/socket.h>
-               ],
-               [ struct sockaddr_storage s; s.ss_family = 1; ],
-               [ ac_cv_have_ss_family_in_struct_ss="yes" ],
-               [ ac_cv_have_ss_family_in_struct_ss="no" ],
+           [
+               #ifdef HAVE_SYS_TYPES_H
+               # include <sys/types.h>
+               #endif
+               #ifdef HAVE_SYS_SOCKET_H
+               # include <sys/socket.h>
+               #endif
+               #ifdef HAVE_NETINET_IN_H
+               # include <netinet/in.h>
+               #endif
+           ],
+           [
+               struct sockaddr_storage s;
+               s.ss_family = 1;
+           ],
+           [ntp_cv_have_ss_family="yes"],
+           [ntp_cv_have_ss_family="no"]
        )
-])
-if test "x$ac_cv_have_ss_family_in_struct_ss" = "xyes" ; then
-       AC_DEFINE(HAVE_SS_FAMILY_IN_SS, 1, [Does struct sockaddr_storage have ss_family?])
-else
-    # Hack around a problem...
-    # HMS: This is $host because we need the -D if we are building *for* it.
-    # HMS: 061029: Now that we separate the ss_* checks this is causing
-    # a problem - disable it until we get to the bottom of it.
-    case "$host" in
-     XXX*-*-hpux11.11) CPPFLAGS="$CPPFLAGS -D_NETINET_IN6_H"
-       ;;
-    esac
-fi
+    ]
+)
 
-AC_CACHE_CHECK([for __ss_family field in struct sockaddr_storage],
-               ac_cv_have___ss_family_in_struct_ss, [
-       AC_TRY_COMPILE(
+case "$ntp_cv_have_ss_family" in
+ no)
+    AC_CACHE_CHECK(
+       [for sockaddr_storage.__ss_family],
+       ntp_cv_have___ss_family,
+       [
+           AC_TRY_COMPILE(
                [
-#include <sys/types.h>
-#include <sys/socket.h>
+                   #ifdef HAVE_SYS_TYPES_H
+                   # include <sys/types.h>
+                   #endif
+                   #ifdef HAVE_SYS_SOCKET_H
+                   # include <sys/socket.h>
+                   #endif
+                   #ifdef HAVE_NETINET_IN_H
+                   # include <netinet/in.h>
+                   #endif
                ],
-               [ struct sockaddr_storage s; s.__ss_family = 1; ],
-               [ ac_cv_have___ss_family_in_struct_ss="yes" ],
-               [ ac_cv_have___ss_family_in_struct_ss="no" ]
-       )
-])
-if test "x$ac_cv_have___ss_family_in_struct_ss" = "xyes" ; then
+               [
+                   struct sockaddr_storage s;
+                   s.__ss_family = 1;
+               ],
+               [ntp_cv_have___ss_family="yes"],
+               [ntp_cv_have___ss_family="no"]
+           )
+       ]
+    )
+    case "$ntp_cv_have___ss_family" in
+     yes)
        AC_DEFINE(HAVE___SS_FAMILY_IN_SS, 1, [Does struct sockaddr_storage have __ss_family?])
-fi
+    esac
+esac
 
-AH_VERBATIM([X_HAVE_SS_FAMILY_IN_SS],
-[/* Handle ss_family */
-#if !defined(HAVE_SS_FAMILY_IN_SS) && defined(HAVE___SS_FAMILY_IN_SS)
-# define ss_family __ss_family
-#endif /* !defined(HAVE_SS_FAMILY_IN_SS) && defined(HAVE_SA_FAMILY_IN_SS) */])
+AH_VERBATIM(
+    [HAVE___SS_FAMILY_IN_SS_VERBATIM],
+    [
+       /* Handle sockaddr_storage.__ss_family */
+       #ifdef HAVE___SS_FAMILY_IN_SS
+       # define ss_family __ss_family
+       #endif /* HAVE___SS_FAMILY_IN_SS */
+    ]
+)
 
-AC_CACHE_CHECK([for ss_len field in struct sockaddr_storage],
-               ac_cv_have_ss_len_in_struct_ss, [
+AC_CACHE_CHECK(
+    [for sockaddr_storage.ss_len],
+    ntp_cv_have_ss_len,
+    [
        AC_TRY_COMPILE(
-               [
-#include <sys/types.h>
-#include <sys/socket.h>
-               ],
-               [ struct sockaddr_storage s; s.ss_len = 1; ],
-               [ ac_cv_have_ss_len_in_struct_ss="yes" ],
-               [ ac_cv_have_ss_len_in_struct_ss="no" ],
+           [
+               #ifdef HAVE_SYS_TYPES_H
+               # include <sys/types.h>
+               #endif
+               #ifdef HAVE_SYS_SOCKET_H
+               # include <sys/socket.h>
+               #endif
+               #ifdef HAVE_NETINET_IN_H
+               # include <netinet/in.h>
+               #endif
+           ],
+           [
+               struct sockaddr_storage s;
+               s.ss_len = 1;
+           ],
+           [ntp_cv_have_ss_len="yes"],
+           [ntp_cv_have_ss_len="no"]
        )
-])
-if test "x$ac_cv_have_ss_len_in_struct_ss" = "xyes" ; then
-       AC_DEFINE(HAVE_SS_LEN_IN_SS, 1, [Does struct sockaddr_storage have ss_len?])
-fi
+    ]
+)
 
-AC_CACHE_CHECK([for __ss_len field in struct sockaddr_storage],
-               ac_cv_have___ss_len_in_struct_ss, [
-       AC_TRY_COMPILE(
+case "$ntp_cv_have_ss_len" in
+ no)
+    AC_CACHE_CHECK(
+       [for sockaddr_storage.__ss_len],
+       ntp_cv_have___ss_len,
+       [
+           AC_TRY_COMPILE(
                [
-#include <sys/types.h>
-#include <sys/socket.h>
+                   #ifdef HAVE_SYS_TYPES_H
+                   # include <sys/types.h>
+                   #endif
+                   #ifdef HAVE_SYS_SOCKET_H
+                   # include <sys/socket.h>
+                   #endif
+                   #ifdef HAVE_NETINET_IN_H
+                   # include <netinet/in.h>
+                   #endif
                ],
-               [ struct sockaddr_storage s; s.__ss_len = 1; ],
-               [ ac_cv_have___ss_len_in_struct_ss="yes" ],
-               [ ac_cv_have___ss_len_in_struct_ss="no" ]
-       )
-])
-if test "x$ac_cv_have___ss_len_in_struct_ss" = "xyes" ; then
+               [
+                   struct sockaddr_storage s;
+                   s.__ss_len = 1;
+               ],
+               [ntp_cv_have___ss_len="yes"],
+               [ntp_cv_have___ss_len="no"]
+           )
+       ]
+    )
+    case "$ntp_cv_have___ss_len" in
+     yes)
        AC_DEFINE(HAVE___SS_LEN_IN_SS, 1, [Does struct sockaddr_storage have __ss_len?])
-fi
+    esac
+esac
 
-AH_VERBATIM([X_HAVE_SS_LEN_IN_SS],
-[/* Handle ss_len */
-#if !defined(HAVE_SS_LEN_IN_SS) && defined(HAVE___SS_LEN_IN_SS)
-# define ss_len __ss_len
-#endif /* !defined(HAVE_SS_LEN_IN_SS) && defined(HAVE_SA_LEN_IN_SS) */])
+AH_VERBATIM(
+    [HAVE___SS_LEN_IN_SS_VERBATIM],
+    [
+       /* Handle sockaddr_storage.__ss_len */
+       #ifdef HAVE___SS_LEN_IN_SS
+       # define ss_len __ss_len
+       #endif /* HAVE___SS_LEN_IN_SS */
+    ]
+)
+
+#
+# Look for in_port_t.
+#
+AC_CACHE_CHECK(
+    [for in_port_t],
+    isc_cv_have_in_port_t,
+    [
+       AC_TRY_COMPILE(
+           [
+               #include <sys/types.h>
+               #include <netinet/in.h>
+           ],
+           [
+               in_port_t port = 25; 
+               return (0);
+           ],
+           [isc_cv_have_in_port_t=yes],
+           [isc_cv_have_in_port_t=no]
+       )
+    ]
+)
+case "$isc_cv_have_in_port_t" in
+ no)
+       AC_DEFINE(ISC_PLATFORM_NEEDPORTT, 1, [Declare in_port_t?])
+esac
 
 case "$ac_cv_header_machine_soundcard_h$ac_cv_header_sys_soundcard_h" in
   *yes*)
index 750e22747398349766492ced01b4d06683ce5728..e8b21af9a836bf23847b435aec51c7212369bf35 100644 (file)
@@ -218,77 +218,172 @@ AC_DEFINE_UNQUOTED([GETSOCKNAME_SOCKLEN_TYPE],
                   $ac_cv_func_getsockname_socklen_type,
                   [What is getsockname()'s socklen type?])
 
-AC_CACHE_CHECK(for struct sockaddr_storage, ac_cv_struct_sockaddr_storage,
-[AC_TRY_COMPILE([
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-],[
-struct sockaddr_storage n;],
-       ac_cv_struct_sockaddr_storage=yes,
-       ac_cv_struct_sockaddr_storage=no)
-])
-if test $ac_cv_struct_sockaddr_storage = yes; then
-    AC_DEFINE([HAVE_STRUCT_SOCKADDR_STORAGE], 1, [Does a system header define struct sockaddr_storage?])
-fi
+AC_CACHE_CHECK(
+    [for struct sockaddr_storage],
+    ntp_cv_sockaddr_storage,
+    [
+       AC_TRY_COMPILE(
+           [
+               #ifdef HAVE_SYS_TYPES_H
+               # include <sys/types.h>
+               #endif
+               #ifdef HAVE_SYS_SOCKET_H
+               # include <sys/socket.h>
+               #endif
+               #ifdef HAVE_NETINET_IN_H
+               # include <netinet/in.h>
+               #endif
+           ],
+           [
+               struct sockaddr_storage n;
+           ],
+           [ntp_cv_sockaddr_storage="yes"],
+           [ntp_cv_sockaddr_storage="no"]
+       )
+    ]
+)
+case "$ntp_cv_sockaddr_storage" in
+ yes)
+    AC_DEFINE(HAVE_STRUCT_SOCKADDR_STORAGE, 1, [Does a system header define struct sockaddr_storage?])
+esac
 
 AC_CACHE_CHECK(
-    [for ss_family field in struct sockaddr_storage],
-    ac_cv_have_ss_family_in_struct_ss,
+    [for sockaddr_storage.ss_family],
+    ntp_cv_have_ss_family,
     [
        AC_TRY_COMPILE(
            [
-               #include <sys/types.h>
-               #include <sys/socket.h>
+               #ifdef HAVE_SYS_TYPES_H
+               # include <sys/types.h>
+               #endif
+               #ifdef HAVE_SYS_SOCKET_H
+               # include <sys/socket.h>
+               #endif
+               #ifdef HAVE_NETINET_IN_H
+               # include <netinet/in.h>
+               #endif
            ],
            [
                struct sockaddr_storage s;
                s.ss_family = 1;
            ],
-           [ac_cv_have_ss_family_in_struct_ss=yes],
-           [ac_cv_have_ss_family_in_struct_ss=no]
+           [ntp_cv_have_ss_family="yes"],
+           [ntp_cv_have_ss_family="no"]
        )
     ]
 )
-if test "x$ac_cv_have_ss_family_in_struct_ss" = "xyes" ; then
-       AC_DEFINE(HAVE_SS_FAMILY_IN_SS, 1, [Does struct sockaddr_storage have ss_family?])
-else
-    # Hack around a problem...
-    # HMS: This is $host because we need the -D if we are building *for* it.
-    # HMS: 061029: Now that we separate the ss_* checks this is causing
-    # a problem - disable it until we get to the bottom of it.
-    case "$host" in
-     XXX*-*-hpux11.11) CPPFLAGS="$CPPFLAGS -D_NETINET_IN6_H"
-       ;;
+
+case "$ntp_cv_have_ss_family" in
+ no)
+    AC_CACHE_CHECK(
+       [for sockaddr_storage.__ss_family],
+       ntp_cv_have___ss_family,
+       [
+           AC_TRY_COMPILE(
+               [
+                   #ifdef HAVE_SYS_TYPES_H
+                   # include <sys/types.h>
+                   #endif
+                   #ifdef HAVE_SYS_SOCKET_H
+                   # include <sys/socket.h>
+                   #endif
+                   #ifdef HAVE_NETINET_IN_H
+                   # include <netinet/in.h>
+                   #endif
+               ],
+               [
+                   struct sockaddr_storage s;
+                   s.__ss_family = 1;
+               ],
+               [ntp_cv_have___ss_family="yes"],
+               [ntp_cv_have___ss_family="no"]
+           )
+       ]
+    )
+    case "$ntp_cv_have___ss_family" in
+     yes)
+       AC_DEFINE(HAVE___SS_FAMILY_IN_SS, 1, [Does struct sockaddr_storage have __ss_family?])
     esac
-fi
+esac
+
+AH_VERBATIM(
+    [HAVE___SS_FAMILY_IN_SS_VERBATIM],
+    [
+       /* Handle sockaddr_storage.__ss_family */
+       #ifdef HAVE___SS_FAMILY_IN_SS
+       # define ss_family __ss_family
+       #endif /* HAVE___SS_FAMILY_IN_SS */
+    ]
+)
 
 AC_CACHE_CHECK(
-    [for __ss_family field in struct sockaddr_storage],
-    ac_cv_have___ss_family_in_struct_ss,
+    [for sockaddr_storage.ss_len],
+    ntp_cv_have_ss_len,
     [
        AC_TRY_COMPILE(
            [
-               #include <sys/types.h>
-               #include <sys/socket.h>
+               #ifdef HAVE_SYS_TYPES_H
+               # include <sys/types.h>
+               #endif
+               #ifdef HAVE_SYS_SOCKET_H
+               # include <sys/socket.h>
+               #endif
+               #ifdef HAVE_NETINET_IN_H
+               # include <netinet/in.h>
+               #endif
            ],
            [
                struct sockaddr_storage s;
-               s.__ss_family = 1;
+               s.ss_len = 1;
            ],
-           [ac_cv_have___ss_family_in_struct_ss=yes],
-           [ac_cv_have___ss_family_in_struct_ss=no]
+           [ntp_cv_have_ss_len="yes"],
+           [ntp_cv_have_ss_len="no"]
        )
-])
-if test "x$ac_cv_have___ss_family_in_struct_ss" = "xyes" ; then
-       AC_DEFINE(HAVE___SS_FAMILY_IN_SS, 1, [Does struct sockaddr_storage have __ss_family?])
-fi
+    ]
+)
+
+case "$ntp_cv_have_ss_len" in
+ no)
+    AC_CACHE_CHECK(
+       [for sockaddr_storage.__ss_len],
+       ntp_cv_have___ss_len,
+       [
+           AC_TRY_COMPILE(
+               [
+                   #ifdef HAVE_SYS_TYPES_H
+                   # include <sys/types.h>
+                   #endif
+                   #ifdef HAVE_SYS_SOCKET_H
+                   # include <sys/socket.h>
+                   #endif
+                   #ifdef HAVE_NETINET_IN_H
+                   # include <netinet/in.h>
+                   #endif
+               ],
+               [
+                   struct sockaddr_storage s;
+                   s.__ss_len = 1;
+               ],
+               [ntp_cv_have___ss_len="yes"],
+               [ntp_cv_have___ss_len="no"]
+           )
+       ]
+    )
+    case "$ntp_cv_have___ss_len" in
+     yes)
+       AC_DEFINE(HAVE___SS_LEN_IN_SS, 1, [Does struct sockaddr_storage have __ss_len?])
+    esac
+esac
 
-AH_VERBATIM([X_HAVE_SS_FAMILY_IN_SS],
-[/* Handle ss_family */
-#if !defined(HAVE_SS_FAMILY_IN_SS) && defined(HAVE___SS_FAMILY_IN_SS)
-# define ss_family __ss_family
-#endif /* !defined(HAVE_SS_FAMILY_IN_SS) && defined(HAVE_SA_FAMILY_IN_SS) */])
+AH_VERBATIM(
+    [HAVE___SS_LEN_IN_SS_VERBATIM],
+    [
+       /* Handle sockaddr_storage.__ss_len */
+       #ifdef HAVE___SS_LEN_IN_SS
+       # define ss_len __ss_len
+       #endif /* HAVE___SS_LEN_IN_SS */
+    ]
+)
 
 #
 # Look for in_port_t.