changeset 39240:26058d7353f4

stdlib: Fix compilation error on OpenIndiana. * lib/stdlib.in.h: Before including <sys/loadavg.h>, include <sys/time.h>. * m4/stdlib_h.m4 (gl_STDLIB_H): Likewise. * m4/getloadavg.m4 (gl_GETLOADAVG): Likewise.
author Bruno Haible <bruno@clisp.org>
date Sat, 03 Feb 2018 14:05:45 +0100
parents 31d885413cfb
children d114fefb0a56
files ChangeLog lib/stdlib.in.h m4/getloadavg.m4 m4/stdlib_h.m4
diffstat 4 files changed, 19 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Sat Feb 03 12:50:17 2018 +0100
+++ b/ChangeLog	Sat Feb 03 14:05:45 2018 +0100
@@ -1,3 +1,11 @@
+2018-02-03  Bruno Haible  <bruno@clisp.org>
+
+	stdlib: Fix compilation error on OpenIndiana.
+	* lib/stdlib.in.h: Before including <sys/loadavg.h>, include
+	<sys/time.h>.
+	* m4/stdlib_h.m4 (gl_STDLIB_H): Likewise.
+	* m4/getloadavg.m4 (gl_GETLOADAVG): Likewise.
+
 2018-02-03  Bruno Haible  <bruno@clisp.org>
 
 	host-cpu-c-abi: Avoid use of 'grep -E' on OpenIndiana.
--- a/lib/stdlib.in.h	Sat Feb 03 12:50:17 2018 +0100
+++ b/lib/stdlib.in.h	Sat Feb 03 14:05:45 2018 +0100
@@ -47,6 +47,9 @@
 
 /* Solaris declares getloadavg() in <sys/loadavg.h>.  */
 #if (@GNULIB_GETLOADAVG@ || defined GNULIB_POSIXCHECK) && @HAVE_SYS_LOADAVG_H@
+/* OpenIndiana has a bug: <sys/time.h> must be included before
+   <sys/loadavg.h>.  */
+# include <sys/time.h>
 # include <sys/loadavg.h>
 #endif
 
--- a/m4/getloadavg.m4	Sat Feb 03 12:50:17 2018 +0100
+++ b/m4/getloadavg.m4	Sat Feb 03 14:05:45 2018 +0100
@@ -7,7 +7,7 @@
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
 
-#serial 6
+#serial 7
 
 # Autoconf defines AC_FUNC_GETLOADAVG, but that is obsolescent.
 # New applications should use gl_GETLOADAVG instead.
@@ -92,6 +92,9 @@
 fi
 AC_CHECK_DECL([getloadavg], [], [HAVE_DECL_GETLOADAVG=0],
   [[#if HAVE_SYS_LOADAVG_H
+    /* OpenIndiana has a bug: <sys/time.h> must be included before
+       <sys/loadavg.h>.  */
+    # include <sys/time.h>
     # include <sys/loadavg.h>
     #endif
     #include <stdlib.h>]])
--- a/m4/stdlib_h.m4	Sat Feb 03 12:50:17 2018 +0100
+++ b/m4/stdlib_h.m4	Sat Feb 03 14:05:45 2018 +0100
@@ -1,4 +1,4 @@
-# stdlib_h.m4 serial 44
+# stdlib_h.m4 serial 45
 dnl Copyright (C) 2007-2018 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -14,6 +14,9 @@
   dnl guaranteed by C89.
   gl_WARN_ON_USE_PREPARE([[#include <stdlib.h>
 #if HAVE_SYS_LOADAVG_H
+/* OpenIndiana has a bug: <sys/time.h> must be included before
+   <sys/loadavg.h>.  */
+# include <sys/time.h>
 # include <sys/loadavg.h>
 #endif
 #if HAVE_RANDOM_H