Subject: bug#15023: Coreutils on IRIX

From: Paul Eggert <[email-masked]>
Date: Thu, 08 Aug 2013 06:35:57 -0700

On 08/07/2013 04:40 PM, Rainer M. Canavan wrote:
> That patch doesn't apply to 8.21

Ah, sorry, it was against the latest gnulib.  How about this?

--- lib/sys_time.in.h	2013-02-07 08:57:25.000000000 -0800
+++ /home/eggert/src/gnu/gnulib/lib/sys_time.in.h	2013-08-08 06:34:22.098553044 -0700
@@ -24,6 +24,17 @@
 #endif
 @PRAGMA_COLUMNS@
 
+/* On Cygwin, <sys/time.h> includes itself recursively via <sys/select.h>.
+   Simply delegate to the system's header in this case; it is a no-op.
+   Without this extra ifdef, the C++ gettimeofday declaration below
+   would be a forward declaration in gnulib's nested <sys/time.h>.
+
+   On IRIX, <sys/time.h> also includes itself recursively via <sys/select.h>.
+   Again, delegate to the system's header in this case.  */
+#if defined _CYGWIN_SYS_TIME_H || (defined __sgi && defined _SYS_TIME_H)
+# @INCLUDE_NEXT@ @NEXT_SYS_TIME_H@
+#else
+
 /* The include_next requires a split double-inclusion guard.  */
 #if @HAVE_SYS_TIME_H@
 # @INCLUDE_NEXT@ @NEXT_SYS_TIME_H@
@@ -200,4 +211,5 @@
 #endif
 
 #endif /* _@GUARD_PREFIX@_SYS_TIME_H */
+#endif /* _CYGWIN_SYS_TIME_H || (__sgi && _SYS_TIME_H) */
 #endif /* _@GUARD_PREFIX@_SYS_TIME_H */