From 1149ad86c4fa9a130554cf1603c98016aa0b4834 Mon Sep 17 00:00:00 2001 From: rlar Date: Thu, 30 Sep 2010 20:26:57 +0000 Subject: [PATCH] use autoconf to find a suitable signal function type --- ChangeLog | 5 +++++ configure.ac | 7 +++++++ src/include/defines.h | 12 ++++++++---- 3 files changed, 20 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 9b14ba159..a415e42a0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2010-09-30 Robert Larice + * configure.ac , + * src/include/defines.h : + use autoconf to find a suitable signal function type + 2010-09-30 Robert Larice * src/xspice/icm/Makefile : use $(MAKE) instead of `make' diff --git a/configure.ac b/configure.ac index e785473de..a7eacaa86 100644 --- a/configure.ac +++ b/configure.ac @@ -618,6 +618,13 @@ dnl Check for a few typdefs: AC_TYPE_PID_T AC_TYPE_SIGNAL +dnl sighandler_t is the type of the signal handler on GNU variants, +dnl sig_t is the type of a signal handler on 4.4BSD's, +dnl other systems use __sighandler_t. +AC_CHECK_TYPES([sighandler_t, sig_t, __sighandler_t], , , + [#include + #include ]) + dnl Check for a few libraries and headers: AC_HEADER_DIRENT AC_CHECK_HEADERS(unistd.h ctype.h pwd.h fcntl.h sys/ioctl.h stropts.h) diff --git a/src/include/defines.h b/src/include/defines.h index 6e3a8a1c4..0ce7bef15 100644 --- a/src/include/defines.h +++ b/src/include/defines.h @@ -112,11 +112,15 @@ #ifndef SIGNAL_FUNCTION -#if defined(_MSC_VER) || defined(__MINGW32__) || defined(__CYGWIN__) || defined(__SUNPRO_C) -# define SIGNAL_FUNCTION RETSIGTYPE (*)(int) -#else +# ifdef HAVE_SIGHANDLER_T # define SIGNAL_FUNCTION sighandler_t -#endif +# elif HAVE_SIG_T +# define SIGNAL_FUNCTION sig_t +# elif HAVE___SIGHANDLER_T +# define SIGNAL_FUNCTION __sighandler_t +# else +# define SIGNAL_FUNCTION RETSIGTYPE (*)(int) +# endif #endif #define BSIZE_SP 512