signal: Define sighandler_t.
authorBruno Haible <bruno@clisp.org>
Thu, 5 May 2011 17:03:57 +0000 (19:03 +0200)
committerBruno Haible <bruno@clisp.org>
Thu, 5 May 2011 17:03:57 +0000 (19:03 +0200)
* lib/signal.in.h (sighandler_t): New type.
* m4/signal_h.m4 (gl_SIGNAL_H): Require AC_USE_SYSTEM_EXTENSIONS. Test
whether sighandler_t is defined.
(gl_SIGNAL_H_DEFAULTS): Initialize HAVE_SIGHANDLER_T.
* modules/signal (Depends-on): Add extensions.
(Makefile.am): Substitute HAVE_SIGHANDLER_T.
* doc/posix-headers/signal.texi: Mention the problem with sighandler_t.
Suggested by Markus Steinborn <gnugv_maintainer@yahoo.de>.

ChangeLog
doc/posix-headers/signal.texi
lib/signal.in.h
m4/signal_h.m4
modules/signal

index 55c709fc25c04ecd15efd50977fe975d8fc34fdd..75a0b571d9139bd1f1be4dbc274a5f526f731bd8 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2011-05-05  Bruno Haible  <bruno@clisp.org>
+
+       signal: Define sighandler_t.
+       * lib/signal.in.h (sighandler_t): New type.
+       * m4/signal_h.m4 (gl_SIGNAL_H): Require AC_USE_SYSTEM_EXTENSIONS. Test
+       whether sighandler_t is defined.
+       (gl_SIGNAL_H_DEFAULTS): Initialize HAVE_SIGHANDLER_T.
+       * modules/signal (Depends-on): Add extensions.
+       (Makefile.am): Substitute HAVE_SIGHANDLER_T.
+       * doc/posix-headers/signal.texi: Mention the problem with sighandler_t.
+       Suggested by Markus Steinborn <gnugv_maintainer@yahoo.de>.
+
 2011-05-05  Eric Blake  <eblake@redhat.com>
 
        maint: remove useless REPLACE_*_H macros
index 77a54323c3679719a6b2420e0f42e38c0741a36c..7e953ce1ff267a617c4b7d72267a088ca892d8db 100644 (file)
@@ -28,6 +28,11 @@ mingw.
 @item
 The macro @code{SA_NODEFER} is not defined on some platforms:
 Interix 3.5.
+@item
+The type @code{sighandler_t} (a GNU extension) is not defined on most non-glibc
+platforms:
+MacOS X 10.5, FreeBSD 6.0, NetBSD 5.0, OpenBSD 3.8, AIX 5.1, HP-UX 11,
+IRIX 6.5, OSF/1 5.1, Solaris 11 2010-11, Cygwin, mingw, Interix 3.5, BeOS.
 @end itemize
 
 Portability problems not fixed by Gnulib:
index 7a6d6ee8566881a0fda29a3890460c05518facf4..036e4f2deb35368d3a2305f182446769b84dcc16 100644 (file)
@@ -66,6 +66,20 @@ typedef unsigned int sigset_t;
 # endif
 #endif
 
+/* Define sighandler_t, the type of signal handlers.  A GNU extension.  */
+#if !@HAVE_SIGHANDLER_T@
+# ifdef __cplusplus
+extern "C" {
+# endif
+# if !GNULIB_defined_sighandler_t
+typedef void (*sighandler_t) (int);
+#  define GNULIB_defined_sighandler_t 1
+# endif
+# ifdef __cplusplus
+}
+# endif
+#endif
+
 
 #if @GNULIB_SIGNAL_H_SIGPIPE@
 # ifndef SIGPIPE
index 77eb1257103ed9e17f774023e3275d62b82a8ddf..459ec007f316933839cc891c9f0d5490fc5364da 100644 (file)
@@ -1,4 +1,4 @@
-# signal_h.m4 serial 11
+# signal_h.m4 serial 12
 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,
@@ -8,14 +8,22 @@ AC_DEFUN([gl_SIGNAL_H],
 [
   AC_REQUIRE([gl_SIGNAL_H_DEFAULTS])
   gl_NEXT_HEADERS([signal.h])
+
 # AIX declares sig_atomic_t to already include volatile, and C89 compilers
 # then choke on 'volatile sig_atomic_t'.  C99 requires that it compile.
   AC_CHECK_TYPE([volatile sig_atomic_t], [],
     [HAVE_TYPE_VOLATILE_SIG_ATOMIC_T=0], [[
 #include <signal.h>
     ]])
+
   AC_REQUIRE([AC_TYPE_UID_T])
 
+  dnl Persuade glibc <signal.h> to define sighandler_t.
+  AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])
+  AC_CHECK_TYPE([sighandler_t], [], [HAVE_SIGHANDLER_T=0], [[
+#include <signal.h>
+    ]])
+
   dnl Check for declarations of anything we want to poison if the
   dnl corresponding gnulib module is not in use.
   gl_WARN_ON_USE_PREPARE([[#include <signal.h>
@@ -46,4 +54,5 @@ AC_DEFUN([gl_SIGNAL_H_DEFAULTS],
                                AC_SUBST([HAVE_STRUCT_SIGACTION_SA_SIGACTION])
   HAVE_TYPE_VOLATILE_SIG_ATOMIC_T=1;
                                AC_SUBST([HAVE_TYPE_VOLATILE_SIG_ATOMIC_T])
+  HAVE_SIGHANDLER_T=1;         AC_SUBST([HAVE_SIGHANDLER_T])
 ])
index 29b7af3cf11d36a129bffa5f1691609f06382e4c..c8d93a1dc0d572a6a3e29eb7521c663149340af4 100644 (file)
@@ -10,6 +10,7 @@ arg-nonnull
 c++defs
 include_next
 warn-on-use
+extensions
 
 configure.ac:
 gl_SIGNAL_H
@@ -35,6 +36,7 @@ signal.h: signal.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H
              -e 's|@''HAVE_SIGACTION''@|$(HAVE_SIGACTION)|g' \
              -e 's|@''HAVE_STRUCT_SIGACTION_SA_SIGACTION''@|$(HAVE_STRUCT_SIGACTION_SA_SIGACTION)|g' \
              -e 's|@''HAVE_TYPE_VOLATILE_SIG_ATOMIC_T''@|$(HAVE_TYPE_VOLATILE_SIG_ATOMIC_T)|g' \
+             -e 's|@''HAVE_SIGHANDLER_T''@|$(HAVE_SIGHANDLER_T)|g' \
              -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \
              -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \
              -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \