From: Dave Hart Date: Tue, 27 Oct 2009 00:16:02 +0000 (+0000) Subject: Get rid of configure tests for __ss_family and __ss_len when the more X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e2fe4d2cf3c1410cb9de74723b3afc9b5bfce706;p=thirdparty%2Fntp.git Get rid of configure tests for __ss_family and __ss_len when the more common ss_family and ss_len are present. bk: 4ae63bc2O1EJI3JMvi9vSapdDIEo5g --- diff --git a/ChangeLog b/ChangeLog index 59fb2301ce..f4435aad82 100644 --- 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 * [Bug 610] NMEA support for using PPSAPI on a different device. * [Bug 1238] use only fudge time2 to offset NMEA serial timestamp. diff --git a/configure.ac b/configure.ac index cad7191413..04beef61f8 100644 --- a/configure.ac +++ b/configure.ac @@ -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 - #include - ], - [ - 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 -#include -#include -],[ -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 + #endif + #ifdef HAVE_SYS_SOCKET_H + # include + #endif + #ifdef HAVE_NETINET_IN_H + # include + #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 -#include - ], - [ 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 + #endif + #ifdef HAVE_SYS_SOCKET_H + # include + #endif + #ifdef HAVE_NETINET_IN_H + # include + #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 -#include + #ifdef HAVE_SYS_TYPES_H + # include + #endif + #ifdef HAVE_SYS_SOCKET_H + # include + #endif + #ifdef HAVE_NETINET_IN_H + # include + #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 -#include - ], - [ 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 + #endif + #ifdef HAVE_SYS_SOCKET_H + # include + #endif + #ifdef HAVE_NETINET_IN_H + # include + #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 -#include + #ifdef HAVE_SYS_TYPES_H + # include + #endif + #ifdef HAVE_SYS_SOCKET_H + # include + #endif + #ifdef HAVE_NETINET_IN_H + # include + #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 + #include + ], + [ + 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*) diff --git a/sntp/configure.ac b/sntp/configure.ac index 750e227473..e8b21af9a8 100644 --- a/sntp/configure.ac +++ b/sntp/configure.ac @@ -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 -#include -#include -],[ -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 + #endif + #ifdef HAVE_SYS_SOCKET_H + # include + #endif + #ifdef HAVE_NETINET_IN_H + # include + #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 - #include + #ifdef HAVE_SYS_TYPES_H + # include + #endif + #ifdef HAVE_SYS_SOCKET_H + # include + #endif + #ifdef HAVE_NETINET_IN_H + # include + #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 + #endif + #ifdef HAVE_SYS_SOCKET_H + # include + #endif + #ifdef HAVE_NETINET_IN_H + # include + #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 - #include + #ifdef HAVE_SYS_TYPES_H + # include + #endif + #ifdef HAVE_SYS_SOCKET_H + # include + #endif + #ifdef HAVE_NETINET_IN_H + # include + #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 + #endif + #ifdef HAVE_SYS_SOCKET_H + # include + #endif + #ifdef HAVE_NETINET_IN_H + # include + #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.