changeset 30232:93e5702f1344

strengthen self-containedness check for sys/select.h 2008-09-29 Paolo Bonzini <bonzini@gnu.org> Bruno Haible <bruno@clisp.org> * lib/sys_select.in.h: Include sys/time.h. * m4/sys_select.h.m4: Test that struct timeval is fully defined. * modules/sys_select: Depend on sys_time. * tests/test-sys_select.c: Test that sys/select.h defines struct timeval fully.
author Paolo Bonzini <bonzini@gnu.org>
date Mon, 29 Sep 2008 12:02:35 +0200
parents d75f2a61b4f9
children 8bf8bbba1c84
files ChangeLog lib/sys_select.in.h m4/sys_select_h.m4 modules/sys_select tests/test-sys_select.c
diffstat 5 files changed, 21 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Mon Sep 29 12:08:01 2008 +0200
+++ b/ChangeLog	Mon Sep 29 12:02:35 2008 +0200
@@ -1,3 +1,12 @@
+2008-09-29  Paolo Bonzini  <bonzini@gnu.org>
+            Bruno Haible  <bruno@clisp.org>
+
+	* lib/sys_select.in.h: Include sys/time.h.
+	* m4/sys_select.h.m4: Test that struct timeval is fully defined.
+	* modules/sys_select: Depend on sys_time.
+	* tests/test-sys_select.c: Test that sys/select.h defines struct
+	timeval fully.
+
 2008-09-29  Bruno Haible  <bruno@clisp.org>
 
 	* lib/sys_socket.in.h: Wrap the definitions in 'extern "C"'.
--- a/lib/sys_select.in.h	Mon Sep 29 12:08:01 2008 +0200
+++ b/lib/sys_select.in.h	Mon Sep 29 12:02:35 2008 +0200
@@ -25,6 +25,10 @@
    <sys/types.h>.  */
 # include <sys/types.h>
 
+/* On OSF/1 4.0, <sys/select.h> provides only a forward declaration
+   of 'struct timeval', and no definition of this type..  */
+# include <sys/time.h>
+
 /* The include_next requires a split double-inclusion guard.  */
 # @INCLUDE_NEXT@ @NEXT_SYS_SELECT_H@
 
--- a/m4/sys_select_h.m4	Mon Sep 29 12:08:01 2008 +0200
+++ b/m4/sys_select_h.m4	Mon Sep 29 12:02:35 2008 +0200
@@ -10,7 +10,8 @@
   AC_CACHE_CHECK([whether <sys/select.h> is self-contained],
     [gl_cv_header_sys_select_h_selfcontained],
     [
-      AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/select.h>]], [[]])],
+      AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/select.h>]],
+					 [[struct timeval b;]])],
         [gl_cv_header_sys_select_h_selfcontained=yes],
         [gl_cv_header_sys_select_h_selfcontained=no])
     ])
--- a/modules/sys_select	Mon Sep 29 12:08:01 2008 +0200
+++ b/modules/sys_select	Mon Sep 29 12:02:35 2008 +0200
@@ -10,6 +10,7 @@
 alloca
 include_next
 sys_socket
+sys_time
 
 configure.ac:
 gl_HEADER_SYS_SELECT
--- a/tests/test-sys_select.c	Mon Sep 29 12:08:01 2008 +0200
+++ b/tests/test-sys_select.c	Mon Sep 29 12:02:35 2008 +0200
@@ -19,10 +19,13 @@
 
 #include <config.h>
 
+#include <sys/select.h>
+
+/* Check that the 'struct timeval' type is defined.  */
+struct timeval t1;
+
 #include <stdio.h>
 #include <string.h>
-#include <sys/select.h>
-#include <sys/time.h>
 #include <netinet/in.h>
 #include <arpa/inet.h>
 #include <fcntl.h>