From 305951edfeb48e73ea5af3cd9b97e1642e439a0e Mon Sep 17 00:00:00 2001 From: Paolo Bonzini Date: Mon, 29 Sep 2008 12:02:35 +0200 Subject: [PATCH] strengthen self-containedness check for sys/select.h 2008-09-29 Paolo Bonzini Bruno Haible * 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. --- ChangeLog | 9 +++++++++ lib/sys_select.in.h | 4 ++++ m4/sys_select_h.m4 | 3 ++- modules/sys_select | 1 + tests/test-sys_select.c | 7 +++++-- 5 files changed, 21 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index bdff5cc5e..42f640117 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2008-09-29 Paolo Bonzini + Bruno Haible + + * 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 * lib/sys_socket.in.h: Wrap the definitions in 'extern "C"'. diff --git a/lib/sys_select.in.h b/lib/sys_select.in.h index 255c02ffd..396f20947 100644 --- a/lib/sys_select.in.h +++ b/lib/sys_select.in.h @@ -25,6 +25,10 @@ . */ # include +/* On OSF/1 4.0, provides only a forward declaration + of 'struct timeval', and no definition of this type.. */ +# include + /* The include_next requires a split double-inclusion guard. */ # @INCLUDE_NEXT@ @NEXT_SYS_SELECT_H@ diff --git a/m4/sys_select_h.m4 b/m4/sys_select_h.m4 index f9468af1d..865a41442 100644 --- a/m4/sys_select_h.m4 +++ b/m4/sys_select_h.m4 @@ -10,7 +10,8 @@ AC_DEFUN([gl_HEADER_SYS_SELECT], AC_CACHE_CHECK([whether is self-contained], [gl_cv_header_sys_select_h_selfcontained], [ - AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include ]], [[]])], + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include ]], + [[struct timeval b;]])], [gl_cv_header_sys_select_h_selfcontained=yes], [gl_cv_header_sys_select_h_selfcontained=no]) ]) diff --git a/modules/sys_select b/modules/sys_select index f2f769890..4f1391781 100644 --- a/modules/sys_select +++ b/modules/sys_select @@ -10,6 +10,7 @@ Depends-on: alloca include_next sys_socket +sys_time configure.ac: gl_HEADER_SYS_SELECT diff --git a/tests/test-sys_select.c b/tests/test-sys_select.c index 6bdd65083..053b6c68d 100644 --- a/tests/test-sys_select.c +++ b/tests/test-sys_select.c @@ -19,10 +19,13 @@ #include +#include + +/* Check that the 'struct timeval' type is defined. */ +struct timeval t1; + #include #include -#include -#include #include #include #include -- 2.11.0