Work on systems without sa_sigaction.
authorRyan C. Gordon <icculus@icculus.org>
Wed, 20 Jul 2011 16:35:37 -0700
changeset 5577 ced8a6788629
parent 5573 7dd4caf23bf5
child 5578 44463666df04
Work on systems without sa_sigaction.
configure.in
include/SDL_config.h.in
src/events/SDL_quit.c
--- a/configure.in	Mon Jul 18 14:55:24 2011 -0700
+++ b/configure.in	Wed Jul 20 16:35:37 2011 -0700
@@ -236,6 +236,8 @@
 
     AC_CHECK_LIB(iconv, iconv_open, [LIBS="$LIBS -liconv"; EXTRA_LDFLAGS="$EXTRA_LDFLAGS -liconv"])
     AC_CHECK_FUNCS(iconv)
+
+    AC_CHECK_MEMBER(struct sigaction.sa_sigaction,[AC_DEFINE(HAVE_SA_SIGACTION)], ,[#include <signal.h>])
 fi
 
 AC_CHECK_SIZEOF(void*)
--- a/include/SDL_config.h.in	Mon Jul 18 14:55:24 2011 -0700
+++ b/include/SDL_config.h.in	Wed Jul 20 16:35:37 2011 -0700
@@ -139,6 +139,7 @@
 #undef HAVE_SINF
 #undef HAVE_SQRT
 #undef HAVE_SIGACTION
+#undef HAVE_SA_SIGACTION
 #undef HAVE_SETJMP
 #undef HAVE_NANOSLEEP
 #undef HAVE_SYSCONF
--- a/src/events/SDL_quit.c	Mon Jul 18 14:55:24 2011 -0700
+++ b/src/events/SDL_quit.c	Wed Jul 20 16:35:37 2011 -0700
@@ -49,12 +49,21 @@
 #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);
     }