m4-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Changes to m4/ltdl/m4/stackovf.m4,v


From: Eric Blake
Subject: Changes to m4/ltdl/m4/stackovf.m4,v
Date: Sat, 22 Jul 2006 22:38:15 +0000

CVSROOT:        /sources/m4
Module name:    m4
Changes by:     Eric Blake <ericb>      06/07/22 22:38:14

Index: ltdl/m4/stackovf.m4
===================================================================
RCS file: /sources/m4/m4/ltdl/m4/stackovf.m4,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- ltdl/m4/stackovf.m4 16 Jun 2006 03:51:29 -0000      1.2
+++ ltdl/m4/stackovf.m4 22 Jul 2006 22:38:14 -0000      1.3
@@ -18,56 +18,64 @@
 # the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
 # Boston, MA 02110-1301, USA.
 
-# serial 3
+# serial 4
 
 # M4_SYS_STACKOVF
 # ---------------
 AC_DEFUN([M4_SYS_STACKOVF],
-[AC_PREREQ([2.56])dnl We use the new compiler based header checking in 2.56
+[AC_PREREQ([2.60])dnl We use the _ONCE variants
 AC_REQUIRE([AC_TYPE_SIGNAL])dnl
 
-AC_CHECK_HEADERS([siginfo.h], [], [], [AC_INCLUDES_DEFAULT])
-AC_CHECK_FUNCS([sigaction sigaltstack sigstack sigvec])
-AC_MSG_CHECKING([if stack overflow is detectable])
+AC_CHECK_HEADERS_ONCE([siginfo.h])
+AC_CHECK_FUNCS_ONCE([sigaction sigaltstack sigstack sigvec])
 # Code from Jim Avera <address@hidden>.
 # stackovf.c requires:
 #  1. Either sigaction with SA_ONSTACK, or sigvec with SV_ONSTACK
 #  2. Either sigaltstack or sigstack
 #  3. getrlimit, including support for RLIMIT_STACK
-use_stackovf=no
+AC_CACHE_CHECK([if stack overflow is detectable], [M4_cv_use_stackovf],
+[M4_cv_use_stackovf=no
 if test "$ac_cv_func_sigaction" = yes || test "$ac_cv_func_sigvec" = yes; then
   if test "$ac_cv_func_sigaltstack" = yes || test "$ac_cv_func_sigstack" = 
yes; then
     AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <sys/time.h>
 #include <sys/resource.h>
-#include <signal.h>]],
-      [[struct rlimit r; int i; getrlimit (RLIMIT_STACK, &r)
+#include <signal.h>
+]], [[struct rlimit r; getrlimit (RLIMIT_STACK, &r);
 #if (!defined(HAVE_SIGACTION) || !defined(SA_ONSTACK)) \
     && (!defined(HAVE_SIGVEC) || !defined(SV_ONSTACK))
 choke me               /* SA_ONSTACK and/or SV_ONSTACK are not defined */
-#endif]])],
-      [use_stackovf=yes])
+#endif
+]])], [M4_cv_use_stackovf=yes])
   fi
-fi
-AC_MSG_RESULT([$use_stackovf])
+fi])
 
-AM_CONDITIONAL([STACKOVF], [test "$use_stackovf" = yes])
-if test "$use_stackovf" = yes; then
+AM_CONDITIONAL([STACKOVF], [test "$M4_cv_use_stackovf" = yes])
+if test "$M4_cv_use_stackovf" = yes; then
   AC_DEFINE([USE_STACKOVF], [1],
     [Define to 1 if using stack overflow detection.])
-  AC_EGREP_HEADER([rlim_t], [sys/resource.h], [],
+  AC_CHECK_TYPES([rlim_t], [],
        [AC_DEFINE([rlim_t], [int],
-       [Define to int if rlim_t is not defined in <sys/resource.h>.])])
-  AC_EGREP_HEADER([stack_t], [signal.h], [],
+      [Define to int if rlim_t is not defined in sys/resource.h])],
+    [[#include <sys/resource.h>
+]])
+  AC_CHECK_TYPES([stack_t], [],
        [AC_DEFINE([stack_t], [struct sigaltstack],
-       [Define to struct sigaltstack if stack_t is not defined in 
<sys/signal.h>.])])
-  AC_EGREP_HEADER([sigcontext], [signal.h],
-       [AC_DEFINE([HAVE_SIGCONTEXT], [1],
-       [Define to 1 if <signal.h> declares sigcontext.])])
-  AC_EGREP_HEADER([siginfo_t], [signal.h],
-                 [AC_DEFINE([HAVE_SIGINFO_T], [1],
-       [Define to 1 if <signal.h> declares siginfo_t.])])
+      [Define to struct sigaltstack if stack_t is not in signal.h])],
+    [[#include <signal.h>
+]])
+  AC_CHECK_TYPES([sigcontext], [], [], [[#include <signal.h>
+]])
+  AC_CHECK_TYPES([siginfo_t], [], [], [[#include <signal.h>
+#if HAVE_SIGINFO_H
+# include <siginfo.h>
+#endif
+]])
+  AC_CHECK_MEMBERS([struct sigaction.sa_sigaction], [], [],
+[[#include <signal.h>
+]])
 
-  AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <signal.h>]],
+  AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <signal.h>
+]],
            [[struct sigaltstack x; x.ss_base = 0;]])],
            [AC_DEFINE([ss_sp], [ss_base],
            [Define to ss_base if stack_t has ss_base instead of ss_sp.])])




reply via email to

[Prev in Thread] Current Thread [Next in Thread]