From 8db49630deab35ffbce5c113aed093359a75091d Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Wed, 6 Jul 2011 00:42:24 -0700 Subject: [PATCH] sys_select: define sigset_t more portably * lib/sys_select.in.h: Always include , since we now need sigset_t and mingw defines it there. Include before split inclusion guard, to avoid mishaps on Solaris, whose 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'. --- ChangeLog | 14 ++++++++++++++ lib/sys_select.in.h | 21 +++++++++++---------- m4/signal_h.m4 | 17 ++++++++++++++++- m4/signalblocking.m4 | 25 +++++-------------------- modules/sys_select | 1 + 5 files changed, 47 insertions(+), 31 deletions(-) diff --git a/ChangeLog b/ChangeLog index 7717ad0cd..2e630aed5 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,19 @@ 2011-07-06 Paul Eggert + sys_select: define sigset_t more portably + * lib/sys_select.in.h: Always include , since + we now need sigset_t and mingw defines it there. + Include before split inclusion guard, to avoid + mishaps on Solaris, whose 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 ada031101..8cbeb66a3 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, assumes prior inclusion of - . */ -# include + . Also, mingw defines sigset_t there, instead of + in where it belongs. */ +#include + +/* Get definition of 'sigset_t'. + But avoid namespace pollution on glibc systems. */ +#if !(defined __GLIBC__ && !defined __UCLIBC__) +# include +#endif + +#if @HAVE_SYS_SELECT_H@ /* On OSF/1 4.0, 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 -#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 532ef14c8..53972fba5 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 + /* Mingw defines sigset_t not in , but in . */ + #include + ]]) + 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 6e83f1b14..15b74253b 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 -/* Mingw defines sigset_t not in , but in . */ -#include ]) - 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 cb3cb9956..5af56ddda 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 -- 2.11.0