# HG changeset patch # User Eric Blake # Date 1213722465 21600 # Node ID 6fcac230dda461a7a4913cd49ff0699a43f64cd2 # Parent d8fca1d0aba388277d444d44efffb9dbe8852a7a Simplify c-stack prerequisites. * lib/c-stack.c (includes): Remove unused . * m4/c-stack.m4 (AC_SYS_XSI_STACK_OVERFLOW_HEURISTIC): Posix 200x no longer requires to exist. Optimize setrlimit check. (gl_PREREQ_C_STACK): Remove check for unused getcontext and . Signed-off-by: Eric Blake diff -r d8fca1d0aba3 -r 6fcac230dda4 ChangeLog --- a/ChangeLog Tue Jun 17 08:43:38 2008 -0600 +++ b/ChangeLog Tue Jun 17 11:07:45 2008 -0600 @@ -1,5 +1,13 @@ 2008-06-17 Eric Blake + Simplify c-stack prerequisites. + * lib/c-stack.c (includes): Remove unused . + * m4/c-stack.m4 (AC_SYS_XSI_STACK_OVERFLOW_HEURISTIC): Posix 200x + no longer requires to exist. Optimize setrlimit + check. + (gl_PREREQ_C_STACK): Remove check for unused getcontext and + . + Move c-stack test into testsuite. * modules/c-stack-tests: New file. * lib/c-stack.c [DEBUG]: Move test program... diff -r d8fca1d0aba3 -r 6fcac230dda4 lib/c-stack.c --- a/lib/c-stack.c Tue Jun 17 08:43:38 2008 -0600 +++ b/lib/c-stack.c Tue Jun 17 11:07:45 2008 -0600 @@ -57,16 +57,8 @@ #include #include -#if HAVE_SYS_RESOURCE_H -/* Include sys/time.h here, because... - SunOS-4.1.x fails to include . - This gives "incomplete type" errors for ru_utime and tu_stime. */ -# if HAVE_SYS_TIME_H -# include -# endif -# include -#endif - +/* Posix 2001 declares ucontext_t in , Posix 200x in + . */ #if HAVE_UCONTEXT_H # include #endif diff -r d8fca1d0aba3 -r 6fcac230dda4 m4/c-stack.m4 --- a/m4/c-stack.m4 Tue Jun 17 08:43:38 2008 -0600 +++ b/m4/c-stack.m4 Tue Jun 17 11:07:45 2008 -0600 @@ -1,16 +1,19 @@ # Check prerequisites for compiling lib/c-stack.c. -# Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc. +# Copyright (C) 2002, 2003, 2004, 2008 Free Software Foundation, Inc. # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # Written by Paul Eggert. +# serial 2 + AC_DEFUN([AC_SYS_XSI_STACK_OVERFLOW_HEURISTIC], [# for STACK_DIRECTION AC_REQUIRE([AC_FUNC_ALLOCA]) - AC_CHECK_FUNCS(setrlimit) + AC_CHECK_FUNCS_ONCE([setrlimit]) + AC_CHECK_HEADERS_ONCE([ucontext.h]) AC_CACHE_CHECK([for working C stack overflow detection], ac_cv_sys_xsi_stack_overflow_heuristic, @@ -18,7 +21,9 @@ [ #include #include - #include + #if HAVE_UCONTEXT_H + # include + #endif #if HAVE_SETRLIMIT # include # include @@ -120,9 +125,9 @@ a SIGSEGV, and an alternate stack can be established with sigaltstack, and the signal handler is passed a context that specifies the run time stack. This behavior is defined by POSIX 1003.1-2001 - with the X/Open System Interface (XSI) option + with the X/Open System Interface (XSI) option and is a standardized way to implement a SEGV-based stack - overflow detection heuristic.]) + overflow detection heuristic.]) fi]) @@ -132,12 +137,10 @@ # for STACK_DIRECTION AC_REQUIRE([AC_FUNC_ALLOCA]) - AC_CHECK_FUNCS(getcontext sigaltstack) - AC_CHECK_DECLS([getcontext], , , [#include ]) + AC_CHECK_FUNCS_ONCE([sigaltstack]) AC_CHECK_DECLS([sigaltstack], , , [#include ]) - AC_CHECK_HEADERS_ONCE(sys/time.h unistd.h) - AC_CHECK_HEADERS(sys/resource.h ucontext.h) + AC_CHECK_HEADERS_ONCE([unistd.h ucontext.h]) AC_CHECK_MEMBERS([struct sigaction.sa_sigaction], , , [#include ])