[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 10/10] sys_select: define sigset_t more portably
From: |
Paul Eggert |
Subject: |
[PATCH 10/10] sys_select: define sigset_t more portably |
Date: |
Wed, 06 Jul 2011 01:01:16 -0700 |
User-agent: |
Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.17) Gecko/20110516 Thunderbird/3.1.10 |
* 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'.
---
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 7717ad0..2e630ae 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,19 @@
2011-07-06 Paul Eggert <address@hidden>
+ 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 ada0311..8cbeb66 100644
--- a/lib/sys_select.in.h
+++ b/lib/sys_select.in.h
@@ -36,11 +36,18 @@
#ifndef address@hidden@_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 532ef14..53972fb 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 6e83f1b..15b7425 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 cb3cb99..5af56dd 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
--
1.7.4.4
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [PATCH 10/10] sys_select: define sigset_t more portably,
Paul Eggert <=