* 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>
2008-06-17 Eric Blake <ebb9@byu.net>
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...
Move c-stack test into testsuite.
* modules/c-stack-tests: New file.
* lib/c-stack.c [DEBUG]: Move test program...
#include <stdlib.h>
#include <string.h>
#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
#if HAVE_UCONTEXT_H
# include <ucontext.h>
#endif
# Check prerequisites for compiling lib/c-stack.c.
# 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.
# 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.
AC_DEFUN([AC_SYS_XSI_STACK_OVERFLOW_HEURISTIC],
[# for STACK_DIRECTION
AC_REQUIRE([AC_FUNC_ALLOCA])
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,
AC_CACHE_CHECK([for working C stack overflow detection],
ac_cv_sys_xsi_stack_overflow_heuristic,
[
#include <unistd.h>
#include <signal.h>
[
#include <unistd.h>
#include <signal.h>
+ #if HAVE_UCONTEXT_H
+ # include <ucontext.h>
+ #endif
#if HAVE_SETRLIMIT
# include <sys/types.h>
# include <sys/time.h>
#if HAVE_SETRLIMIT
# include <sys/types.h>
# include <sys/time.h>
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
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
and is a standardized way to implement a SEGV-based stack
- overflow detection heuristic.])
+ overflow detection heuristic.])
# for STACK_DIRECTION
AC_REQUIRE([AC_FUNC_ALLOCA])
# 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_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>])
AC_CHECK_MEMBERS([struct sigaction.sa_sigaction], , , [#include <signal.h>])