From 8ac7e0f418044d2079e7cf11fba8391b75640e98 Mon Sep 17 00:00:00 2001 From: Patrice Mandin Date: Thu, 14 Jul 2011 15:40:07 +0200 Subject: [PATCH] Check sa_sigaction member of struct sigaction --- configure.in | 2 ++ src/events/SDL_quit.c | 8 ++++++++ 2 files changed, 10 insertions(+) diff --git a/configure.in b/configure.in index be91920f5..c540b6fec 100644 --- a/configure.in +++ b/configure.in @@ -185,6 +185,8 @@ if test x$enable_libc = xyes; then AC_CHECK_LIB(iconv, libiconv_open, [EXTRA_LDFLAGS="$EXTRA_LDFLAGS -liconv"]) AC_CHECK_LIB(m, pow, [EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lm"]) + + AC_CHECK_MEMBER(struct sigaction.sa_sigaction,[AC_DEFINE(HAVE_SA_SIGACTION)], ,[#include ]) fi if test x$have_inttypes != xyes; then diff --git a/src/events/SDL_quit.c b/src/events/SDL_quit.c index 099b97112..2765aab8d 100644 --- a/src/events/SDL_quit.c +++ b/src/events/SDL_quit.c @@ -48,12 +48,20 @@ int SDL_QuitInit(void) #ifdef HAVE_SIGACTION struct sigaction action; sigaction(SIGINT, NULL, &action); +# ifdef HAVE_SA_SIGACTION if ( action.sa_handler == SIG_DFL && action.sa_sigaction == (void*)SIG_DFL ) { +# else + if ( action.sa_handler == SIG_DFL ) { +# endif action.sa_handler = SDL_HandleSIG; sigaction(SIGINT, &action, NULL); } sigaction(SIGTERM, NULL, &action); +# ifdef HAVE_SA_SIGACTION if ( action.sa_handler == SIG_DFL && action.sa_sigaction == (void*)SIG_DFL ) { +# else + if ( action.sa_handler == SIG_DFL ) { +# endif action.sa_handler = SDL_HandleSIG; sigaction(SIGTERM, &action, NULL); }