Mercurial > hg > octave-lyh > gnulib-hg
changeset 10214:6fcac230dda4
Simplify c-stack prerequisites.
* lib/c-stack.c (includes): Remove unused <sys/resource.h>.
* m4/c-stack.m4 (AC_SYS_XSI_STACK_OVERFLOW_HEURISTIC): Posix 200x
no longer requires <ucontext.h> to exist. Optimize setrlimit
check.
(gl_PREREQ_C_STACK): Remove check for unused getcontext and
<sys/resource.h>.
Signed-off-by: Eric Blake <ebb9@byu.net>
author | Eric Blake <ebb9@byu.net> |
---|---|
date | Tue, 17 Jun 2008 11:07:45 -0600 |
parents | d8fca1d0aba3 |
children | 2bab2200e002 |
files | ChangeLog lib/c-stack.c m4/c-stack.m4 |
diffstat | 3 files changed, 22 insertions(+), 19 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,13 @@ 2008-06-17 Eric Blake <ebb9@byu.net> + Simplify c-stack prerequisites. + * lib/c-stack.c (includes): Remove unused <sys/resource.h>. + * m4/c-stack.m4 (AC_SYS_XSI_STACK_OVERFLOW_HEURISTIC): Posix 200x + no longer requires <ucontext.h> to exist. Optimize setrlimit + check. + (gl_PREREQ_C_STACK): Remove check for unused getcontext and + <sys/resource.h>. + Move c-stack test into testsuite. * modules/c-stack-tests: New file. * lib/c-stack.c [DEBUG]: Move test program...
--- a/lib/c-stack.c +++ b/lib/c-stack.c @@ -57,16 +57,8 @@ #include <stdlib.h> #include <string.h> -#if HAVE_SYS_RESOURCE_H -/* Include sys/time.h here, because... - SunOS-4.1.x <sys/resource.h> fails to include <sys/time.h>. - This gives "incomplete type" errors for ru_utime and tu_stime. */ -# if HAVE_SYS_TIME_H -# include <sys/time.h> -# endif -# include <sys/resource.h> -#endif - +/* Posix 2001 declares ucontext_t in <ucontext.h>, Posix 200x in + <signal.h>. */ #if HAVE_UCONTEXT_H # include <ucontext.h> #endif
--- a/m4/c-stack.m4 +++ b/m4/c-stack.m4 @@ -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 <unistd.h> #include <signal.h> - #include <ucontext.h> + #if HAVE_UCONTEXT_H + # include <ucontext.h> + #endif #if HAVE_SETRLIMIT # include <sys/types.h> # include <sys/time.h> @@ -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 <ucontext.h>]) + AC_CHECK_FUNCS_ONCE([sigaltstack]) AC_CHECK_DECLS([sigaltstack], , , [#include <signal.h>]) - 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 <signal.h>])