]> git.ipfire.org Git - thirdparty/ntp.git/commitdiff
workaround for HP-UX /usr/include/machine/sys/getppdp.h gcc4 break.
authorDave Hart <hart@ntp.org>
Tue, 23 Nov 2010 12:26:32 +0000 (12:26 +0000)
committerDave Hart <hart@ntp.org>
Tue, 23 Nov 2010 12:26:32 +0000 (12:26 +0000)
bk: 4cebb2f8PkGuEfpmdCCTLyYe2wjEIg

configure.ac
sntp/configure.ac

index 3ed759e49cc6f098d9efde0ad8fee5b3d0a463d7..251a239efcbf5b58a1c53e6a962a3791b7997a41 100644 (file)
@@ -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 <sys/socket.h>
@@ -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 <sys/types.h>
-dnl #endif
-dnl #if HAVE_SYS_SOCKET_H
-dnl # include <sys/socket.h>
-dnl #endif
-dnl ])
-
 AC_CHECK_HEADERS(sys/proc.h, [], [],
 [#if HAVE_SYS_TYPES_H
 # include <sys/types.h>
@@ -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 <sys/types.h>
-       #endif
-       #ifdef HAVE_SYS_SOCKET_H
-       #include <sys/socket.h>
-       #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 <sys/types.h>
+#endif
+#ifdef HAVE_SYS_SOCKET_H
+#include <sys/socket.h>
+#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],
                []
            )
index 9ac384312c6460a12b48b2fc07a17840ae34f9e8..91e4cf9057308a3210ce58e88fd3e9702bf5758c 100644 (file)
@@ -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