Commit fa6f0000 authored by Bruno Haible's avatar Bruno Haible

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>.
parent e5c4538a
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
......@@ -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:
......
......@@ -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
......
# 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])
])
......@@ -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)' \
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment