diff options
author | Paul Eggert <eggert@cs.ucla.edu> | 2011-07-06 00:42:24 -0700 |
---|---|---|
committer | Paul Eggert <eggert@cs.ucla.edu> | 2011-07-06 00:44:21 -0700 |
commit | 8db49630deab35ffbce5c113aed093359a75091d (patch) | |
tree | c03e973a9aef0faf987bc4563cf7db90808f4bff | |
parent | 350d202a28a8744d20a693930a30d012e9e3cdaa (diff) | |
download | gnulib-8db49630deab35ffbce5c113aed093359a75091d.tar.gz |
sys_select: define sigset_t more portably
* lib/sys_select.in.h: Always include <sys/types.h>, since
we now need sigset_t and mingw defines it there.
Include <signal.h> before split inclusion guard, to avoid
mishaps on Solaris, whose <signal.h> eventually includes us.
* m4/signal_h.m4 (gl_SIGNAL_H): Require gl_CHECK_TYPE_SIGSET_T.
(gl_CHECK_TYPE_SIGSET_T): New macro, most of the contents of
which come from ...
* m4/signalblocking.m4 (gl_SIGNALBLOCKING): Require
gl_CHECK_TYPE_SIGSET_T.
(gl_PREREQ_SIGPROCMASK): Now a no-op, since gl_CHECK_TYPE_SIGSET_T
does the real work.
* modules/sys_select (Depends-on): Add 'signal'.
-rw-r--r-- | ChangeLog | 14 | ||||
-rw-r--r-- | lib/sys_select.in.h | 21 | ||||
-rw-r--r-- | m4/signal_h.m4 | 17 | ||||
-rw-r--r-- | m4/signalblocking.m4 | 25 | ||||
-rw-r--r-- | modules/sys_select | 1 |
5 files changed, 47 insertions, 31 deletions
@@ -1,5 +1,19 @@ 2011-07-06 Paul Eggert <eggert@cs.ucla.edu> + sys_select: define sigset_t more portably + * lib/sys_select.in.h: Always include <sys/types.h>, since + we now need sigset_t and mingw defines it there. + Include <signal.h> before split inclusion guard, to avoid + mishaps on Solaris, whose <signal.h> eventually includes us. + * m4/signal_h.m4 (gl_SIGNAL_H): Require gl_CHECK_TYPE_SIGSET_T. + (gl_CHECK_TYPE_SIGSET_T): New macro, most of the contents of + which come from ... + * m4/signalblocking.m4 (gl_SIGNALBLOCKING): Require + gl_CHECK_TYPE_SIGSET_T. + (gl_PREREQ_SIGPROCMASK): Now a no-op, since gl_CHECK_TYPE_SIGSET_T + does the real work. + * modules/sys_select (Depends-on): Add 'signal'. + * m4/sys_select_h.m4 (gl_HEADER_SYS_SELECT): Poison pselect. Suggested by Bruno Haible. diff --git a/lib/sys_select.in.h b/lib/sys_select.in.h index ada0311016..8cbeb66a3b 100644 --- a/lib/sys_select.in.h +++ b/lib/sys_select.in.h @@ -36,11 +36,18 @@ #ifndef _@GUARD_PREFIX@_SYS_SELECT_H -#if @HAVE_SYS_SELECT_H@ - /* On many platforms, <sys/select.h> assumes prior inclusion of - <sys/types.h>. */ -# include <sys/types.h> + <sys/types.h>. Also, mingw defines sigset_t there, instead of + in <signal.h> where it belongs. */ +#include <sys/types.h> + +/* Get definition of 'sigset_t'. + But avoid namespace pollution on glibc systems. */ +#if !(defined __GLIBC__ && !defined __UCLIBC__) +# include <signal.h> +#endif + +#if @HAVE_SYS_SELECT_H@ /* On OSF/1 4.0, <sys/select.h> provides only a forward declaration of 'struct timeval', and no definition of this type. @@ -85,12 +92,6 @@ # endif #endif -/* Get definition of 'sigset_t'. - But avoid namespace pollution on glibc systems. */ -#if !(defined __GLIBC__ && !defined __UCLIBC__) -# include <signal.h> -#endif - /* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */ /* The definition of _GL_WARN_ON_USE is copied here. */ diff --git a/m4/signal_h.m4 b/m4/signal_h.m4 index 532ef14c86..53972fba54 100644 --- a/m4/signal_h.m4 +++ b/m4/signal_h.m4 @@ -1,4 +1,4 @@ -# signal_h.m4 serial 13 +# signal_h.m4 serial 14 dnl Copyright (C) 2007-2011 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -7,6 +7,7 @@ dnl with or without modifications, as long as this notice is preserved. AC_DEFUN([gl_SIGNAL_H], [ AC_REQUIRE([gl_SIGNAL_H_DEFAULTS]) + AC_REQUIRE([gl_CHECK_TYPE_SIGSET_T]) gl_NEXT_HEADERS([signal.h]) # AIX declares sig_atomic_t to already include volatile, and C89 compilers @@ -32,6 +33,20 @@ AC_DEFUN([gl_SIGNAL_H], sigpending sigprocmask]) ]) +AC_DEFUN([gl_CHECK_TYPE_SIGSET_T], +[ + AC_CHECK_TYPES([sigset_t], + [gl_cv_type_sigset_t=yes], [gl_cv_type_sigset_t=no], + [[ + #include <signal.h> + /* Mingw defines sigset_t not in <signal.h>, but in <sys/types.h>. */ + #include <sys/types.h> + ]]) + if test $gl_cv_type_sigset_t != yes; then + HAVE_SIGSET_T=0 + fi +]) + AC_DEFUN([gl_SIGNAL_MODULE_INDICATOR], [ dnl Use AC_REQUIRE here, so that the default settings are expanded once only. diff --git a/m4/signalblocking.m4 b/m4/signalblocking.m4 index 6e83f1b141..15b74253ba 100644 --- a/m4/signalblocking.m4 +++ b/m4/signalblocking.m4 @@ -1,4 +1,4 @@ -# signalblocking.m4 serial 11 +# signalblocking.m4 serial 12 dnl Copyright (C) 2001-2002, 2006-2011 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -12,9 +12,8 @@ dnl with or without modifications, as long as this notice is preserved. AC_DEFUN([gl_SIGNALBLOCKING], [ AC_REQUIRE([gl_SIGNAL_H_DEFAULTS]) - signals_not_posix= - AC_EGREP_HEADER([sigset_t], [signal.h], , [signals_not_posix=1]) - if test -z "$signals_not_posix"; then + AC_REQUIRE([gl_CHECK_TYPE_SIGSET_T]) + if test $gl_cv_type_sigset_t = yes; then AC_CHECK_FUNC([sigprocmask], [gl_cv_func_sigprocmask=1]) fi if test -z "$gl_cv_func_sigprocmask"; then @@ -22,19 +21,5 @@ AC_DEFUN([gl_SIGNALBLOCKING], fi ]) -# Prerequisites of the part of lib/signal.in.h and of lib/sigprocmask.c. -AC_DEFUN([gl_PREREQ_SIGPROCMASK], -[ - AC_REQUIRE([gl_SIGNAL_H_DEFAULTS]) - AC_CHECK_TYPES([sigset_t], - [gl_cv_type_sigset_t=yes], [gl_cv_type_sigset_t=no], - [#include <signal.h> -/* Mingw defines sigset_t not in <signal.h>, but in <sys/types.h>. */ -#include <sys/types.h>]) - if test $gl_cv_type_sigset_t != yes; then - HAVE_SIGSET_T=0 - fi - dnl HAVE_SIGSET_T is 1 if the system lacks the sigprocmask function but has - dnl the sigset_t type. - AC_SUBST([HAVE_SIGSET_T]) -]) +# Prerequisites of lib/sigprocmask.c. +AC_DEFUN([gl_PREREQ_SIGPROCMASK], [:]) diff --git a/modules/sys_select b/modules/sys_select index cb3cb9956f..5af56ddda6 100644 --- a/modules/sys_select +++ b/modules/sys_select @@ -9,6 +9,7 @@ m4/sys_socket_h.m4 Depends-on: include_next c++defs +signal sys_time warn-on-use |