Mercurial > hg > octave-kai > gnulib-hg
changeset 14686:e753ffb0501f
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>.
author | Bruno Haible <bruno@clisp.org> |
---|---|
date | Thu, 05 May 2011 19:03:57 +0200 |
parents | f7f11056a86e |
children | 79a38ad7e1ba |
files | ChangeLog doc/posix-headers/signal.texi lib/signal.in.h m4/signal_h.m4 modules/signal |
diffstat | 5 files changed, 43 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- 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
--- a/doc/posix-headers/signal.texi +++ b/doc/posix-headers/signal.texi @@ -28,6 +28,11 @@ @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:
--- a/lib/signal.in.h +++ b/lib/signal.in.h @@ -66,6 +66,20 @@ # 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
--- a/m4/signal_h.m4 +++ b/m4/signal_h.m4 @@ -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_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_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]) ])
--- a/modules/signal +++ b/modules/signal @@ -10,6 +10,7 @@ c++defs include_next warn-on-use +extensions configure.ac: gl_SIGNAL_H @@ -35,6 +36,7 @@ -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)' \