From: Dave Hart Date: Tue, 23 Nov 2010 12:26:32 +0000 (+0000) Subject: workaround for HP-UX /usr/include/machine/sys/getppdp.h gcc4 break. X-Git-Tag: NTP_4_2_7P85~3^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c9b29b1d61c8e1e4faf345b6f81c24545d7899f1;p=thirdparty%2Fntp.git workaround for HP-UX /usr/include/machine/sys/getppdp.h gcc4 break. bk: 4cebb2f8PkGuEfpmdCCTLyYe2wjEIg --- diff --git a/configure.ac b/configure.ac index 3ed759e49..251a239ef 100644 --- a/configure.ac +++ b/configure.ac @@ -131,10 +131,10 @@ AC_FUNC_FORK AC_CACHE_CHECK( [if $CC can handle @%:@warning], - [ac_cv_cpp_warning], + ac_cv_cpp_warning, [ AC_COMPILE_IFELSE( - [AC_LANG_PROGRAM([[]], [[#warning foo]])], + AC_LANG_PROGRAM([], [#warning foo]), [ac_cv_cpp_warning=yes], [ac_cv_cpp_warning=no], ) @@ -464,6 +464,53 @@ esac AC_CHECK_HEADERS([arpa/nameser.h]) AC_CHECK_HEADERS([sys/socket.h]) + +dnl HP-UX 11.31 on HPPA has a net/if.h that can't be compiled with gcc4 +dnl due to an incomplete type (a union) mpinfou used in an array. gcc3 +dnl compiles it without complaint. The mpinfou union is defined later +dnl in the resulting preprocessed source than the spu_info array in +dnl /usr/include/machine/sys/getppdp.h: +dnl extern union mpinfou spu_info[]; +dnl triggering the error. Our strategy is on HP-UX only, test for +dnl net/netmp.h, which is the file included by net/if.h that leads to +dnl getppdp.h. If it is present but can't be compiled, try adding +dnl a duplicate definition of mpinfou, which should then allow the +dnl following net/if.h and net/if6.h tests to proceed normally. +dnl Using net/netmp.h allows us to avoid polluting test results for +dnl net/if.h. +# +case "$host" in + *-hp-hpux*) + AC_CHECK_HEADERS( + [net/netmp.h], + [netmp_h_works=yes], + [netmp_h_works=no] + ) + case "$netmp_h_works" in + no) + cat >>confdefs.h <<_ACEOF +#ifndef MPINFOU_PREDECLARED +# define MPINFOU_PREDECLARED +typedef union mpinfou { /* For lint */ + struct pdk_mpinfo *pdkptr; + struct mpinfo *pikptr; +} mpinfou_t; +#endif +_ACEOF + AH_BOTTOM([ +#ifndef MPINFOU_PREDECLARED +# define MPINFOU_PREDECLARED +typedef union mpinfou { /* For lint */ + struct pdk_mpinfo *pdkptr; + struct mpinfo *pikptr; +} mpinfou_t; +#endif +]) + ;; + esac + ;; +esac + AC_CHECK_HEADERS([net/if.h], [], [], [#ifdef HAVE_SYS_SOCKET_H #include @@ -636,15 +683,6 @@ case "$ac_cv_func___adjtimex" in ;; esac -dnl AC_CHECK_HEADERS(net/if.h, [], [], -dnl [#if HAVE_SYS_TYPES_H -dnl # include -dnl #endif -dnl #if HAVE_SYS_SOCKET_H -dnl # include -dnl #endif -dnl ]) - AC_CHECK_HEADERS(sys/proc.h, [], [], [#if HAVE_SYS_TYPES_H # include @@ -1251,17 +1289,14 @@ AC_CACHE_VAL(ac_cv_func_getsockname_arg2,dnl [AC_CACHE_VAL(ac_cv_func_getsockname_socklen_type,dnl [for ac_cv_func_getsockname_arg2 in 'struct sockaddr *' 'void *'; do for ac_cv_func_getsockname_socklen_type in 'socklen_t' 'size_t' 'unsigned int' 'int'; do - AC_TRY_COMPILE( - [AC_LANG_PROGRAM([ - #ifdef HAVE_SYS_TYPES_H - #include - #endif - #ifdef HAVE_SYS_SOCKET_H - #include - #endif - ], [ - extern getsockname (int, $ac_cv_func_getsockname_arg2, $ac_cv_func_getsockname_socklen_type *); - ])], , + AC_TRY_COMPILE(dnl +[#ifdef HAVE_SYS_TYPES_H +#include +#endif +#ifdef HAVE_SYS_SOCKET_H +#include +#endif +extern getsockname (int, $ac_cv_func_getsockname_arg2, $ac_cv_func_getsockname_socklen_type *);],,dnl [ac_not_found=no ; break 2], ac_not_found=yes) done done @@ -2170,8 +2205,8 @@ case "$ac_cv_var_tty_clk" in esac AC_CACHE_CHECK([for the ppsclock streams module], - [ac_cv_var_ppsclock], - [ac_cv_var_ppsclock=$ac_cv_struct_ppsclockev]) + ac_cv_var_ppsclock, + ac_cv_var_ppsclock=$ac_cv_struct_ppsclockev) case "$ac_cv_var_ppsclock" in yes) AC_DEFINE(PPS, 1, [Do we have the ppsclock streams module?]) ;; esac @@ -2185,7 +2220,7 @@ AC_CACHE_CHECK( i386-sequent-sysv4) ;; *) - AC_COMPILE_IFELSE([ + AC_COMPILE_IFELSE( AC_LANG_PROGRAM( [ #ifdef HAVE_NETINET_IN_H @@ -2196,7 +2231,7 @@ AC_CACHE_CHECK( struct ip_mreq ipmr; ipmr.imr_interface.s_addr = 0; ] - )], + ), [ntp_cv_multicast=yes], [] ) diff --git a/sntp/configure.ac b/sntp/configure.ac index 9ac384312..91e4cf905 100644 --- a/sntp/configure.ac +++ b/sntp/configure.ac @@ -44,7 +44,8 @@ dnl AC_ARG_PROGRAM AC_PREREQ([2.53]) # Checks for programs. -AC_PROG_CC +AM_PROG_CC_C_O +AC_PROG_CPP # AC_PROG_CC_STDC has two functions. It attempts to find a compiler # capable of C99, or failing that, for C89. CC is set afterward with @@ -146,6 +147,53 @@ AC_SEARCH_LIBS([setsockopt], [socket xnet]) # Checks for header files. AC_HEADER_STDC + +dnl HP-UX 11.31 on HPPA has a net/if.h that can't be compiled with gcc4 +dnl due to an incomplete type (a union) mpinfou used in an array. gcc3 +dnl compiles it without complaint. The mpinfou union is defined later +dnl in the resulting preprocessed source than the spu_info array in +dnl /usr/include/machine/sys/getppdp.h: +dnl extern union mpinfou spu_info[]; +dnl triggering the error. Our strategy is on HP-UX only, test for +dnl net/netmp.h, which is the file included by net/if.h that leads to +dnl getppdp.h. If it is present but can't be compiled, try adding +dnl a duplicate definition of mpinfou, which should then allow the +dnl following net/if.h and net/if6.h tests to proceed normally. +dnl Using net/netmp.h allows us to avoid polluting test results for +dnl net/if.h. +# +case "$host" in + *-hp-hpux*) + AC_CHECK_HEADERS( + [net/netmp.h], + [netmp_h_works=yes], + [netmp_h_works=no] + ) + case "$netmp_h_works" in + no) + cat >>confdefs.h <<_ACEOF +#ifndef MPINFOU_PREDECLARED +# define MPINFOU_PREDECLARED +typedef union mpinfou { /* For lint */ + struct pdk_mpinfo *pdkptr; + struct mpinfo *pikptr; +} mpinfou_t; +#endif +_ACEOF + AH_BOTTOM([ +#ifndef MPINFOU_PREDECLARED +# define MPINFOU_PREDECLARED +typedef union mpinfou { /* For lint */ + struct pdk_mpinfo *pdkptr; + struct mpinfo *pikptr; +} mpinfou_t; +#endif +]) + ;; + esac + ;; +esac + AC_CHECK_HEADERS([netdb.h netinet/in.h stdlib.h string.h strings.h syslog.h]) AC_CHECK_HEADERS([sys/socket.h sys/time.h]) AC_HEADER_TIME