1 dnl Autoconf configuration for libsigsegv.
2 dnl Process this file with autoconf to produce a configure script.
4 dnl Copyright (C) 2002-2007 Bruno Haible <bruno@clisp.org>
6 dnl This program is free software; you can redistribute it and/or modify
7 dnl it under the terms of the GNU General Public License as published by
8 dnl the Free Software Foundation; either version 2, or (at your option)
11 dnl This program is distributed in the hope that it will be useful,
12 dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
13 dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 dnl GNU General Public License for more details.
16 dnl You should have received a copy of the GNU General Public License
17 dnl along with this program; if not, write to the Free Software Foundation,
18 dnl Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
22 AC_CONFIG_SRCDIR(src/sigsegv.h.in)
23 AC_CONFIG_AUX_DIR([build-aux])
27 { echo; echo "${term_bold}Build Tools:${term_norm}"; } >& AS_MESSAGE_FD
29 AM_INIT_AUTOMAKE(libsigsegv, 2.5)
30 AM_CONFIG_HEADER(config.h)
36 AC_MSG_CHECKING([host platform])
38 changequote(,)dnl Autoconf 2.52 brokenness
41 kernelversion=`uname -r | sed -e 's/^\([0-9.]*\).*/\1/'`
42 sv_cv_host=`echo $sv_cv_host | sed -e "s/linux/linux$kernelversion/"`
45 changequote([,])dnl Autoconf 2.52 brokenness
46 cat > conftest.c << EOF
48 #ifdef __GNU_LIBRARY__
49 Version __GLIBC__ . __GLIBC_MINOR__
52 glibcversion=`$CPP $CPPFLAGS conftest.c 2>/dev/null | grep Version | sed -e 's/Version//' -e 's/ //g'`
53 if test -n "$glibcversion"; then
54 sv_cv_host="$sv_cv_host-glibc$glibcversion"
56 AC_MSG_RESULT([$sv_cv_host])
57 PLATFORM="$sv_cv_host"
65 # For testing cross-compilation behaviour.
68 { echo; echo "${term_bold}Optional Platform Environment:${term_norm}"; } >& AS_MESSAGE_FD
70 dnl Headers to be included with <signal.h>. On MacOS X (Darwin) one also
71 dnl needs <sys/signal.h>.
72 AC_CHECK_HEADERS([sys/signal.h])
74 dnl List of signals that are sent when an invalid virtual memory address
75 dnl is accessed, or when the stack overflows.
77 sunos4* | freebsd* | openbsd* | netbsd* | kfreebsd* | knetbsd*)
78 CFG_SIGNALS=signals-bsd.h ;;
80 CFG_SIGNALS=signals-hpux.h ;;
82 CFG_SIGNALS=signals-macos.h ;;
84 CFG_SIGNALS=signals-hurd.h ;;
86 CFG_SIGNALS=signals.h ;;
88 AC_DEFINE_UNQUOTED(CFG_SIGNALS, "$CFG_SIGNALS",
89 [The name of the include file describing the fault signals.])
91 # How to determine the memory page size.
94 # How to allocate fresh memory using mmap.
95 # (We need mmap, because mprotect() doesn't work on malloc()ed memory on
99 # How to write a SIGSEGV handler with access to the fault address.
101 # On MacOS X 10.2 or newer, we don't need these tests, because we'll end up
102 # using handler-macos.c anyway. If we were to perform the tests, 5 Crash Report
103 # dialog windows would pop up.
105 macos* | darwin[[6-9]]* | darwin[[1-9]][[0-9]]*) ;;
108 dnl FIXME: Put in some more known values into the third argument.
109 SV_TRY_FAULT([POSIX], sv_cv_fault_posix,
110 [*-*-solaris2.[7-9] | i?86-*-linux2.[4-9]* | i?86-*-freebsd[4-9]* | alpha*-dec-osf[4-9]* | *-*-hpux11* | mips-sgi-irix6*],
112 [int sig, siginfo_t *sip, void *ucp],
114 [action.sa_sigaction = &sigsegv_handler;
115 action.sa_flags = SA_SIGINFO;])
117 SV_TRY_FAULT([Linux/i386], sv_cv_fault_linux_i386, [i?86-*-linux2.[2-9]*],
118 [#include <asm/sigcontext.h>],
119 [int sig, struct sigcontext sc],
122 SV_TRY_FAULT([old Linux/i386], sv_cv_fault_linux_i386_old,
123 [i?86-*-linux2.[2-9]*],
125 [int sig, unsigned int more],
126 [((unsigned long *) &more) [21]])
128 dnl FIXME: Put in some more known values into the third argument.
129 SV_TRY_FAULT([Linux/m68k], sv_cv_fault_linux_m68k, [],
130 [#include <asm/sigcontext.h>
131 #include "$srcdir/src/fault-linux-m68k.c"],
132 [int sig, int code, struct sigcontext *scp],
133 [get_fault_addr (scp)])
135 dnl FIXME: Put in some more known values into the third argument.
136 SV_TRY_FAULT([Linux/PowerPC], sv_cv_fault_linux_powerpc, [],
137 [#include <asm/sigcontext.h>],
138 [int sig, struct sigcontext *scp],
141 dnl FIXME: Put in some more known values into the third argument.
142 SV_TRY_FAULT([Linux/HPPA], sv_cv_fault_linux_hppa, [],
144 [int sig, siginfo_t *sip, void *ucp],
146 [action.sa_sigaction = &sigsegv_handler;
147 action.sa_flags = SA_SIGINFO;])
149 dnl FIXME: Put in some more known values into the third argument.
150 SV_TRY_FAULT([BSD], sv_cv_fault_bsd, [i?86-*-freebsd[4-9]*],
152 [int sig, int code, struct sigcontext *scp, void *addr],
155 dnl FIXME: Put in some more known values into the third argument.
156 SV_TRY_FAULT([IRIX], sv_cv_fault_irix, [mips-sgi-irix6*],
158 [int sig, int code, struct sigcontext *scp],
159 [(unsigned long) scp->sc_badvaddr])
161 dnl FIXME: Put in some more known values into the third argument.
162 SV_TRY_FAULT([HP-UX HPPA], sv_cv_fault_hpux_hppa, [hppa*-*-hpux11*],
164 #define USE_64BIT_REGS(mc) \
165 (((mc).ss_flags & SS_WIDEREGS) && ((mc).ss_flags & SS_NARROWISINVALID))
166 #define GET_CR21(mc) \
167 (USE_64BIT_REGS(mc) ? (mc).ss_wide.ss_64.ss_cr21 : (mc).ss_narrow.ss_cr21)
169 [int sig, int code, struct sigcontext *scp],
170 [GET_CR21 (scp->sc_sl.sl_ss)])
172 dnl FIXME: Put in some more known values into the third argument.
173 SV_TRY_FAULT([OSF/1 Alpha], sv_cv_fault_osf_alpha,
174 [alpha*-*-osf[4-9]* | alpha*-*-linux2.[4-9]*],
176 [int sig, int code, struct sigcontext *scp],
177 [scp->sc_traparg_a0])
179 dnl FIXME: Put in some more known values into the third argument.
180 SV_TRY_FAULT([NetBSD Alpha], sv_cv_fault_netbsd_alpha,
181 [alpha*-*-osf[4-9]* | alpha-*-*bsd*],
182 [#include "$srcdir/src/fault-netbsd-alpha.c"],
183 [int sig, int code, struct sigcontext *scp],
184 [get_fault_addr (scp)])
186 dnl FIXME: Put in some more known values into the third argument.
187 SV_TRY_FAULT([AIX], sv_cv_fault_aix, [*-*-aix[34]*],
189 [int sig, int code, struct sigcontext *scp],
190 [scp->sc_jmpbuf.jmp_context.o_vaddr])
192 SV_TRY_FAULT([MacOSX/Darwin7 PowerPC], sv_cv_fault_macosdarwin7_ppc,
193 [powerpc-*-darwin7*],
194 [#include "$srcdir/src/fault-macosdarwin7-powerpc.c"],
195 [int sig, siginfo_t *sip, ucontext_t *ucp],
196 [get_fault_addr (sip, ucp)],
197 [action.sa_sigaction = &sigsegv_handler;
198 action.sa_flags = SA_SIGINFO;])
200 if test "$sv_cv_fault_macosdarwin7_ppc" != yes; then
201 SV_TRY_FAULT([MacOSX/Darwin5 PowerPC], sv_cv_fault_macosdarwin5_ppc,
202 [powerpc-*-darwin5*],
203 [#include "$srcdir/src/fault-macosdarwin5-powerpc.c"],
204 [int sig, int code, struct sigcontext *scp],
205 [get_fault_addr (scp)])
208 dnl FIXME: Put in some more known values into the third argument.
209 SV_TRY_FAULT([Hurd], sv_cv_fault_hurd, [],
211 [int sig, int code, struct sigcontext *scp],
214 # End of MacOS X special casing.
218 dnl Now determine the fault handler include file.
219 dnl We prefer the platform specific include files to the generic fault-posix.h
220 dnl because the former often defines SIGSEGV_FAULT_STACKPOINTER.
221 dnl Also we put the BSD test second-to-last, because the test may produce
227 FAULT_CONTEXT_INCLUDE=
228 FAULT_CONTEXT_INCLUDE2=
230 dnl First the cases where the OS provides the fault address.
232 if test -z "$CFG_FAULT" && test "$sv_cv_fault_aix" = yes; then
234 powerpc* | rs6000) CFG_FAULT=fault-aix3-powerpc.h ;;
235 *) CFG_FAULT=fault-aix3.h ;;
237 FAULT_CONTEXT='struct sigcontext'
239 if test -z "$CFG_FAULT" && test "$sv_cv_fault_irix" = yes; then
241 mips*) CFG_FAULT=fault-irix-mips.h ;;
242 *) CFG_FAULT=fault-irix.h ;;
244 FAULT_CONTEXT='struct sigcontext'
246 if test -z "$CFG_FAULT" && test "$sv_cv_fault_hpux_hppa" = yes; then
248 hppa* | parisc*) CFG_FAULT=fault-hpux-hppa.h ;;
249 *) CFG_FAULT=fault-hpux.h ;;
251 FAULT_CONTEXT='struct sigcontext'
253 if test -z "$CFG_FAULT" && test "$sv_cv_fault_osf_alpha" = yes; then
255 alpha*) CFG_FAULT=fault-osf-alpha.h ;;
256 *) CFG_FAULT=fault-osf.h ;;
258 FAULT_CONTEXT='struct sigcontext'
260 if test -z "$CFG_FAULT" && test "$sv_cv_fault_netbsd_alpha" = yes; then
262 alpha*) CFG_FAULT=fault-netbsd-alpha.h ;;
264 FAULT_CONTEXT='struct sigcontext'
266 if test -z "$CFG_FAULT" && test "$sv_cv_fault_linux_i386" = yes; then
268 i?86 | x86_64) CFG_FAULT=fault-linux-i386.h ;;
270 FAULT_CONTEXT='struct sigcontext'
272 if test -z "$CFG_FAULT" && test "$sv_cv_fault_linux_i386_old" = yes; then
274 i?86 | x86_64) CFG_FAULT=fault-linux-i386-old.h ;;
276 FAULT_CONTEXT='struct sigcontext'
278 if test -z "$CFG_FAULT" && test "$sv_cv_fault_linux_powerpc" = yes; then
280 powerpc* | rs6000) CFG_FAULT=fault-linux-powerpc.h ;;
282 FAULT_CONTEXT='struct sigcontext'
284 if test -z "$CFG_FAULT" && test "$sv_cv_fault_linux_hppa" = yes; then
286 hppa* | parisc*) CFG_FAULT=fault-linux-hppa.h ;;
289 if test -z "$CFG_FAULT" && test "$sv_cv_fault_hurd" = yes; then
291 netbsd*) # A false positive.
294 CFG_FAULT=fault-hurd.h
295 FAULT_CONTEXT='struct sigcontext'
299 if test -z "$CFG_FAULT" && test "$sv_cv_fault_bsd" = yes; then
301 freebsd* | kfreebsd*)
304 CFG_FAULT=fault-freebsd-i386.h
305 FAULT_CONTEXT='struct sigcontext'
308 CFG_FAULT=fault-bsd.h
314 CFG_FAULT=fault-bsd.h
319 if test -z "$CFG_FAULT" && test "$sv_cv_fault_posix" = yes; then
323 i?86 | x86_64) CFG_FAULT=fault-openbsd-i386.h ;;
324 *) CFG_FAULT=fault-openbsd.h ;;
326 FAULT_CONTEXT='struct sigcontext'
331 CFG_FAULT=fault-linux-ia64.h
332 FAULT_CONTEXT='struct sigcontext'
337 if test -z "$CFG_FAULT"; then
341 i?86 | x86_64) CFG_FAULT=fault-solaris-i386.h ;;
342 sparc*) CFG_FAULT=fault-solaris-sparc.h ;;
343 *) CFG_FAULT=fault-solaris.h ;;
348 powerpc* | rs6000) CFG_FAULT=fault-aix5-powerpc.h ;;
349 *) CFG_FAULT=fault-aix5.h ;;
353 CFG_FAULT=fault-netbsd.h
356 CFG_FAULT=fault-posix.h
359 FAULT_CONTEXT='ucontext_t'
360 FAULT_CONTEXT_INCLUDE='#include <ucontext.h>'
363 if test -z "$CFG_FAULT"; then
365 macos* | darwin[[6-9]]* | darwin[[1-9]][[0-9]]*)
368 CFG_MACHFAULT=machfault-macos-powerpc.h
369 FAULT_CONTEXT='ppc_thread_state_t'
372 CFG_MACHFAULT=machfault-macos-i386.h
373 FAULT_CONTEXT='i386_thread_state_t'
376 if test -n "$CFG_MACHFAULT"; then
377 CFG_HANDLER=handler-macos.c
378 FAULT_CONTEXT_INCLUDE='#include <signal.h>'
379 FAULT_CONTEXT_INCLUDE2='#include <mach/thread_status.h>'
380 CFG_FAULT=fault-macos.h # nonexistent, just a dummy
386 dnl Next, the cases where there is a hairy CPU dependent way to get the
389 if test -z "$CFG_FAULT" && test "$sv_cv_fault_linux_m68k" = yes; then
392 CFG_FAULT=fault-linux-m68k.h
393 FAULT_CONTEXT='struct sigcontext'
397 if test -z "$CFG_FAULT" && test "$sv_cv_fault_macosdarwin7_ppc" = yes; then
400 CFG_FAULT=fault-macosdarwin7-powerpc.h
401 FAULT_CONTEXT='ucontext_t'
402 FAULT_CONTEXT_INCLUDE='#include <signal.h>'
403 FAULT_CONTEXT_INCLUDE2='#include <ucontext.h>'
407 if test -z "$CFG_FAULT" && test "$sv_cv_fault_macosdarwin5_ppc" = yes; then
410 CFG_FAULT=fault-macosdarwin5-powerpc.h
411 FAULT_CONTEXT='struct sigcontext'
415 if test -z "$CFG_FAULT"; then
418 FAULT_CONTEXT='CONTEXT'
419 FAULT_CONTEXT_INCLUDE='#include <windows.h>'
420 CFG_FAULT=fault-win32.h # nonexistent, just a dummy
424 if test -n "$CFG_FAULT"; then
425 sv_cv_have_sigsegv_recovery=yes
427 sv_cv_have_sigsegv_recovery=no
429 dnl No way to get the fault address. But other information is available.
435 CFG_FAULT=fault-linux-alpha.h
436 FAULT_CONTEXT='struct sigcontext'
438 arm* | strongarm* | xscale*)
439 CFG_FAULT=fault-linux-arm.h
440 FAULT_CONTEXT='struct sigcontext'
443 CFG_FAULT=fault-linux-cris.h
444 FAULT_CONTEXT='struct sigcontext'
447 CFG_FAULT=fault-linux-mips.h
448 FAULT_CONTEXT='struct sigcontext'
451 CFG_FAULT=fault-linux-s390.h
452 FAULT_CONTEXT='struct sigcontext'
455 CFG_FAULT=fault-linux-sh.h
456 FAULT_CONTEXT='struct sigcontext'
459 CFG_FAULT=fault-linux-sparc.h
460 FAULT_CONTEXT='struct sigcontext'
463 CFG_FAULT=fault-linux-x86_64.h
464 FAULT_CONTEXT='struct sigcontext'
470 i?86 | x86_64) CFG_FAULT=fault-beos-i386.h ;;
471 *) CFG_FAULT=fault-beos.h ;;
473 FAULT_CONTEXT='struct vregs'
477 i?86 | x86_64) CFG_FAULT=fault-macos-i386.h ;;
479 FAULT_CONTEXT='struct sigcontext'
483 AC_MSG_CHECKING([for the fault handler specifics])
484 if test -n "$CFG_FAULT"; then
485 sv_cv_fault_include=$CFG_FAULT
487 if test -n "$CFG_MACHFAULT"; then
488 sv_cv_fault_include=$CFG_MACHFAULT
490 sv_cv_fault_include=none
493 AC_MSG_RESULT([$sv_cv_fault_include])
494 if test -z "$CFG_FAULT"; then
495 CFG_FAULT=fault-none.h
497 AC_DEFINE_UNQUOTED(CFG_FAULT, "$CFG_FAULT",
498 [The name of the include file describing the fault handler.])
499 if test -z "$CFG_MACHFAULT"; then
500 CFG_MACHFAULT=fault-none.h
502 AC_DEFINE_UNQUOTED(CFG_MACHFAULT, "$CFG_MACHFAULT",
503 [The name of the include file describing the Mach fault handler.])
504 AC_SUBST(FAULT_CONTEXT)
505 AC_SUBST(FAULT_CONTEXT_INCLUDE)
506 AC_SUBST(FAULT_CONTEXT_INCLUDE2)
508 AC_MSG_CHECKING([if the system supports catching SIGSEGV])
509 AC_MSG_RESULT([$sv_cv_have_sigsegv_recovery])
510 if test $sv_cv_have_sigsegv_recovery != no; then
511 HAVE_SIGSEGV_RECOVERY=1
513 HAVE_SIGSEGV_RECOVERY=0
515 AC_SUBST(HAVE_SIGSEGV_RECOVERY)
517 dnl The stackoverflow_context_t type depends on the CFG_FAULT include file.
520 AC_CACHE_CHECK([for stack direction], sv_cv_stack_direction_msg, [
522 dnl See the #define STACK_GROWS_DOWNWARD in gcc-3.1/gcc/config/*/*.h.
526 arm* | strongarm* | xscale* | \
528 c1 | c2 | c32 | c34 | c38 | \
549 powerpc* | rs6000 | \
557 sv_cv_stack_direction=-1 ;;
564 sv_cv_stack_direction=1 ;;
566 if test $cross_compiling = no; then
567 cat > conftest.c <<EOF
570 get_stack_direction ()
573 static char *dummyaddr = (char *)0;
574 if (dummyaddr != (char *)0)
575 return &dummy > dummyaddr ? 1 : &dummy < dummyaddr ? -1 : 0;
580 int result = get_stack_direction ();
581 /* The next assignment avoids tail recursion elimination
583 dummyaddr = (char *)0;
591 printf ("%d\n", get_stack_direction ());
596 sv_cv_stack_direction=`./conftest`
598 sv_cv_stack_direction=0
602 case $sv_cv_stack_direction in
603 1) sv_cv_stack_direction_msg="grows up";;
604 -1) sv_cv_stack_direction_msg="grows down";;
605 *) sv_cv_stack_direction_msg="unknown";;
608 AC_DEFINE_UNQUOTED(STACK_DIRECTION, [$sv_cv_stack_direction],
609 [Define as the direction of stack growth for your system.
610 STACK_DIRECTION > 0 => grows toward higher addresses
611 STACK_DIRECTION < 0 => grows toward lower addresses
612 STACK_DIRECTION = 0 => spaghetti stack.])
614 dnl Determination of the stack's virtual memory area.
615 AC_CACHE_CHECK([for PIOCMAP in sys/procfs.h], sv_cv_procfsvma, [
616 AC_TRY_LINK([#include <sys/procfs.h>],
617 [int x = PIOCNMAP + PIOCMAP; prmap_t y;],
618 sv_cv_procfsvma=yes, sv_cv_procfsvma=no)
620 AC_CHECK_FUNCS([mincore])
622 if test $sv_cv_procfsvma = yes; then
623 CFG_STACKVMA=stackvma-procfs.c
626 linux*) CFG_STACKVMA=stackvma-linux.c ;;
627 freebsd*) CFG_STACKVMA=stackvma-freebsd.c ;;
628 beos*) CFG_STACKVMA=stackvma-beos.c ;;
629 macos* | darwin*) CFG_STACKVMA=stackvma-mach.c ;;
632 if test -z "$CFG_STACKVMA" && test $ac_cv_func_mincore = yes; then
633 CFG_STACKVMA=stackvma-mincore.c
635 if test -n "$CFG_STACKVMA"; then
636 AC_DEFINE(HAVE_STACKVMA, 1,
637 [Define if CFG_STACKVMA is set to a nontrivial source file.])
639 CFG_STACKVMA=stackvma-none.c
641 AC_DEFINE_UNQUOTED(CFG_STACKVMA, "$CFG_STACKVMA",
642 [The name of the file determining the stack virtual memory area.])
643 AC_SUBST(CFG_STACKVMA)
645 AC_CHECK_FUNCS([getrlimit setrlimit])
647 dnl Catching stack overflow requires an alternate signal stack.
648 dnl The old "install a guard page" trick would be unreliable, because
649 dnl we don't know where exactly to place the guard page.
652 AC_CACHE_CHECK([if the system supports catching stack overflow],
653 sv_cv_have_stack_overflow_recovery,
655 dnl On Mach, it requires a machfault-*.h (see src/handler-macos.c).
656 dnl On Unix, it requires either sigaltstack() or the BeOS set_signal_stack()
657 dnl function, and on Unix it requires a fault-*.h or a stackvma-*.c with
658 dnl certain properties (see src/handler-unix.c).
659 if test "$CFG_MACHFAULT" != fault-none.h; then
660 sv_cv_have_stack_overflow_recovery=yes
662 if test "$sv_cv_sigaltstack" != no; then
663 sv_cv_have_stack_overflow_recovery=maybe
666 beos*) sv_cv_have_stack_overflow_recovery=maybe ;;
667 mingw* | cygwin*) sv_cv_have_stack_overflow_recovery=yes ;;
668 *) sv_cv_have_stack_overflow_recovery=no ;;
672 if test $sv_cv_have_stack_overflow_recovery = maybe; then
673 if test -n "$CFG_FAULT"; then
674 AC_EGREP_CPP([xyzzy], [
675 #include "$srcdir/src/$CFG_FAULT"
676 #ifdef SIGSEGV_FAULT_HANDLER_ARGLIST
677 #ifdef SIGSEGV_FAULT_ADDRESS
681 ], [condA=true], [condA=false])
685 if test -n "$CFG_FAULT"; then
686 AC_EGREP_CPP([xyzzy], [
687 #include "$srcdir/src/$CFG_FAULT"
688 #ifdef SIGSEGV_FAULT_HANDLER_ARGLIST
689 #ifdef SIGSEGV_FAULT_STACKPOINTER
693 ], [condB=true], [condB=false])
697 if test "$CFG_STACKVMA" != "stackvma-none.c"; then
702 if { $condA && $condB; } || { $condA && $condC; } || { $condB && $condC; }; then
703 sv_cv_have_stack_overflow_recovery=yes
705 sv_cv_have_stack_overflow_recovery=no
709 if test $sv_cv_have_stack_overflow_recovery != no; then
710 HAVE_STACK_OVERFLOW_RECOVERY=1
712 HAVE_STACK_OVERFLOW_RECOVERY=0
714 AC_SUBST(HAVE_STACK_OVERFLOW_RECOVERY)
716 # How to longjmp out of a signal handler, in such a way that the
717 # alternate signal stack remains functional.
719 # On MacOS X 10.2 or newer, we don't need these tests, because we'll end up
720 # using handler-macos.c anyway. If we were to perform the tests, 2 Crash Report
721 # dialog windows would pop up.
723 macos* | darwin[[6-9]]* | darwin[[1-9]][[0-9]]*) ;;
726 dnl FIXME: Put in some more known values into the third argument.
727 SV_TRY_LEAVE_HANDLER_LONGJMP([], sv_cv_leave_handler_longjmp,
728 [*-*-osf[4-9]* | *-*-hpux11* | *-*-linux2.[2-9]*],
731 dnl FIXME: Put in some more known values into the third argument.
732 SV_TRY_LEAVE_HANDLER_LONGJMP([ and sigaltstack],
733 sv_cv_leave_handler_longjmp_sigaltstack,
737 #define SS_ONSTACK SA_ONSTACK
741 if (sigaltstack (NULL, &ss) >= 0)
743 ss.ss_flags &= ~SS_ONSTACK;
744 sigaltstack (&ss, NULL);
748 dnl FIXME: Put in some more known values into the third argument.
749 SV_TRY_LEAVE_HANDLER_LONGJMP([ and setcontext],
750 sv_cv_leave_handler_longjmp_setcontext,
751 [*-*-irix* | *-*-solaris*],
752 [#include <ucontext.h>
754 #define SS_ONSTACK SA_ONSTACK
758 static ucontext_t uc;
760 if (getcontext (&uc) >= 0)
762 if (uc.uc_stack.ss_flags & SS_ONSTACK)
764 uc.uc_stack.ss_flags &= ~SS_ONSTACK;
770 # End of MacOS X special casing.
774 # How to siglongjmp out of a signal handler, in such a way that the
775 # alternate signal stack remains functional.
777 # On MacOS X 10.2 or newer, we don't need these tests, because we'll end up
778 # using handler-macos.c anyway. If we were to perform the tests, 2 Crash Report
779 # dialog windows would pop up.
781 macos* | darwin[[6-9]]* | darwin[[1-9]][[0-9]]*) ;;
784 dnl FIXME: Put in some more known values into the third argument.
785 SV_TRY_LEAVE_HANDLER_SIGLONGJMP([], sv_cv_leave_handler_siglongjmp,
786 [*-*-osf[4-9]* | *-*-hpux11* | *-*-linux2.[2-9]* | *-*-irix* | *-*-solaris*],
789 dnl FIXME: Put in some more known values into the third argument.
790 SV_TRY_LEAVE_HANDLER_SIGLONGJMP([ and sigaltstack],
791 sv_cv_leave_handler_siglongjmp_sigaltstack,
795 #define SS_ONSTACK SA_ONSTACK
799 if (sigaltstack (NULL, &ss) >= 0)
801 ss.ss_flags &= ~SS_ONSTACK;
802 sigaltstack (&ss, NULL);
806 dnl FIXME: Put in some more known values into the third argument.
807 SV_TRY_LEAVE_HANDLER_SIGLONGJMP([ and setcontext],
808 sv_cv_leave_handler_siglongjmp_setcontext,
810 [#include <ucontext.h>
812 #define SS_ONSTACK SA_ONSTACK
816 static ucontext_t uc;
818 if (getcontext(&uc) >= 0)
820 if (uc.uc_stack.ss_flags & SS_ONSTACK)
822 uc.uc_stack.ss_flags &= ~SS_ONSTACK;
828 # End of MacOS X special casing.
833 if test "$sv_cv_leave_handler_longjmp" != no; then
834 CFG_LEAVE=leave-nop.c
836 if test "$sv_cv_leave_handler_longjmp_sigaltstack" != no; then
837 CFG_LEAVE=leave-sigaltstack.c
839 if test "$sv_cv_leave_handler_longjmp_setcontext" != no; then
840 CFG_LEAVE=leave-setcontext.c
845 # On BeOS, the 6 tests fail because sigaltstack() doesn't exist.
846 # If one uses set_signal_stack() instead of sigaltstack(), the first
847 # test actually works. i.e. sv_cv_leave_handler_longjmp would be 'yes'.
848 beos*) CFG_LEAVE=leave-nop.c ;;
850 if test -z "$CFG_LEAVE"; then
851 CFG_LEAVE=leave-none.c
853 AC_DEFINE_UNQUOTED(CFG_LEAVE, "$CFG_LEAVE",
854 [The name of the file implementing sigsegv_reset_onstack_flag.])
858 mingw* | cygwin*) CFG_HANDLER=handler-win32.c ;;
860 if test -z "$CFG_HANDLER"; then
861 if test $sv_cv_have_sigsegv_recovery = no \
862 && test $sv_cv_have_stack_overflow_recovery = no; then
863 CFG_HANDLER=handler-none.c
865 CFG_HANDLER=handler-unix.c
870 AC_DEFINE_UNQUOTED(CFG_HANDLER, "$CFG_HANDLER",
871 [The name of the file implementing the handler functionality.])
872 AC_SUBST(CFG_HANDLER)
874 { echo; echo "${term_bold}Build Parameters:${term_norm}"; } >& AS_MESSAGE_FD
876 dnl Relocatability is a nop for this package.
879 { echo; echo "${term_bold}Output Substitution:${term_norm}"; } >& AS_MESSAGE_FD
881 dnl AC_OUTPUT(Makefile)
883 src/Makefile src/sigsegv.h
886 { echo; echo "Now please type '${term_bold}make${term_norm}' to compile. Good luck."; echo; } >& AS_MESSAGE_FD