1 dnl Autoconf configuration for libsigsegv.
2 dnl Process this file with autoconf to produce a configure script.
4 dnl Copyright (C) 2002-2008 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.7-pre1)
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"
62 LT_INIT([disable-shared])
64 # For testing cross-compilation behaviour.
67 { echo; echo "${term_bold}Optional Platform Environment:${term_norm}"; } >& AS_MESSAGE_FD
69 dnl Headers to be included with <signal.h>. On MacOS X (Darwin) one also
70 dnl needs <sys/signal.h>.
71 AC_CHECK_HEADERS([sys/signal.h])
73 dnl List of signals that are sent when an invalid virtual memory address
74 dnl is accessed, or when the stack overflows.
76 sunos4* | freebsd* | dragonfly* | openbsd* | netbsd* | kfreebsd* | knetbsd*)
77 CFG_SIGNALS=signals-bsd.h ;;
79 CFG_SIGNALS=signals-hpux.h ;;
81 CFG_SIGNALS=signals-macos.h ;;
83 CFG_SIGNALS=signals-hurd.h ;;
85 CFG_SIGNALS=signals.h ;;
87 AC_DEFINE_UNQUOTED(CFG_SIGNALS, "$CFG_SIGNALS",
88 [The name of the include file describing the fault signals.])
90 # How to determine the memory page size.
93 # How to allocate fresh memory using mmap.
94 # (We need mmap, because mprotect() doesn't work on malloc()ed memory on
98 # How to write a SIGSEGV handler with access to the fault address.
100 # On MacOS X 10.2 or newer, we don't need these tests, because we'll end up
101 # using handler-macos.c anyway. If we were to perform the tests, 5 Crash Report
102 # dialog windows would pop up.
104 macos* | darwin[[6-9]]* | darwin[[1-9]][[0-9]]*) ;;
107 dnl FIXME: Put in some more known values into the third argument.
108 SV_TRY_FAULT([POSIX], sv_cv_fault_posix,
109 [*-*-solaris2.[7-9] | i?86-*-linux2.[4-9]* | i?86-*-freebsd[4-9]* | alpha*-dec-osf[4-9]* | *-*-hpux11* | mips-sgi-irix6*],
111 [int sig, siginfo_t *sip, void *ucp],
113 [action.sa_sigaction = &sigsegv_handler;
114 action.sa_flags = SA_SIGINFO;])
116 SV_TRY_FAULT([Linux/i386], sv_cv_fault_linux_i386, [i?86-*-linux2.[2-9]*],
117 [#include <asm/sigcontext.h>],
118 [int sig, struct sigcontext sc],
121 SV_TRY_FAULT([old Linux/i386], sv_cv_fault_linux_i386_old,
122 [i?86-*-linux2.[2-9]*],
124 [int sig, unsigned int more],
125 [((unsigned long *) &more) [21]])
127 dnl FIXME: Put in some more known values into the third argument.
128 SV_TRY_FAULT([Linux/m68k], sv_cv_fault_linux_m68k, [],
129 [#include <asm/sigcontext.h>
130 #include "$srcdir/src/fault-linux-m68k.c"],
131 [int sig, int code, struct sigcontext *scp],
132 [get_fault_addr (scp)])
134 dnl FIXME: Put in some more known values into the third argument.
135 SV_TRY_FAULT([Linux/PowerPC], sv_cv_fault_linux_powerpc, [],
136 [#include <asm/sigcontext.h>],
137 [int sig, struct sigcontext *scp],
140 dnl FIXME: Put in some more known values into the third argument.
141 SV_TRY_FAULT([Linux/HPPA], sv_cv_fault_linux_hppa, [],
143 [int sig, siginfo_t *sip, void *ucp],
145 [action.sa_sigaction = &sigsegv_handler;
146 action.sa_flags = SA_SIGINFO;])
148 dnl FIXME: Put in some more known values into the third argument.
149 SV_TRY_FAULT([BSD], sv_cv_fault_bsd, [i?86-*-freebsd[4-9]*],
151 [int sig, int code, struct sigcontext *scp, void *addr],
154 dnl FIXME: Put in some more known values into the third argument.
155 SV_TRY_FAULT([IRIX], sv_cv_fault_irix, [mips-sgi-irix6*],
157 [int sig, int code, struct sigcontext *scp],
158 [(unsigned long) scp->sc_badvaddr])
160 dnl FIXME: Put in some more known values into the third argument.
161 SV_TRY_FAULT([HP-UX HPPA], sv_cv_fault_hpux_hppa, [hppa*-*-hpux11*],
163 #define USE_64BIT_REGS(mc) \
164 (((mc).ss_flags & SS_WIDEREGS) && ((mc).ss_flags & SS_NARROWISINVALID))
165 #define GET_CR21(mc) \
166 (USE_64BIT_REGS(mc) ? (mc).ss_wide.ss_64.ss_cr21 : (mc).ss_narrow.ss_cr21)
168 [int sig, int code, struct sigcontext *scp],
169 [GET_CR21 (scp->sc_sl.sl_ss)])
171 dnl FIXME: Put in some more known values into the third argument.
172 SV_TRY_FAULT([OSF/1 Alpha], sv_cv_fault_osf_alpha,
173 [alpha*-*-osf[4-9]* | alpha*-*-linux2.[4-9]*],
175 [int sig, int code, struct sigcontext *scp],
176 [scp->sc_traparg_a0])
178 dnl FIXME: Put in some more known values into the third argument.
179 SV_TRY_FAULT([NetBSD Alpha], sv_cv_fault_netbsd_alpha,
180 [alpha*-*-osf[4-9]* | alpha-*-*bsd*],
181 [#include "$srcdir/src/fault-netbsd-alpha.c"],
182 [int sig, int code, struct sigcontext *scp],
183 [get_fault_addr (scp)])
185 dnl FIXME: Put in some more known values into the third argument.
186 SV_TRY_FAULT([AIX], sv_cv_fault_aix, [*-*-aix[34]*],
188 [int sig, int code, struct sigcontext *scp],
189 [scp->sc_jmpbuf.jmp_context.o_vaddr])
191 SV_TRY_FAULT([MacOSX/Darwin7 PowerPC], sv_cv_fault_macosdarwin7_ppc,
192 [powerpc-*-darwin7*],
193 [#include "$srcdir/src/fault-macosdarwin7-powerpc.c"],
194 [int sig, siginfo_t *sip, ucontext_t *ucp],
195 [get_fault_addr (sip, ucp)],
196 [action.sa_sigaction = &sigsegv_handler;
197 action.sa_flags = SA_SIGINFO;])
199 if test "$sv_cv_fault_macosdarwin7_ppc" != yes; then
200 SV_TRY_FAULT([MacOSX/Darwin5 PowerPC], sv_cv_fault_macosdarwin5_ppc,
201 [powerpc-*-darwin5*],
202 [#include "$srcdir/src/fault-macosdarwin5-powerpc.c"],
203 [int sig, int code, struct sigcontext *scp],
204 [get_fault_addr (scp)])
207 dnl FIXME: Put in some more known values into the third argument.
208 SV_TRY_FAULT([Hurd], sv_cv_fault_hurd, [],
210 [int sig, int code, struct sigcontext *scp],
213 # End of MacOS X special casing.
217 dnl Now determine the fault handler include file.
218 dnl We prefer the platform specific include files to the generic fault-posix.h
219 dnl because the former often defines SIGSEGV_FAULT_STACKPOINTER.
220 dnl Also we put the BSD test second-to-last, because the test may produce
226 FAULT_CONTEXT_INCLUDE=
228 dnl First the cases where the OS provides the fault address.
230 if test -z "$CFG_FAULT" && test "$sv_cv_fault_aix" = yes; then
232 powerpc* | rs6000) CFG_FAULT=fault-aix3-powerpc.h ;;
233 *) CFG_FAULT=fault-aix3.h ;;
235 FAULT_CONTEXT='struct sigcontext'
237 if test -z "$CFG_FAULT" && test "$sv_cv_fault_irix" = yes; then
239 mips*) CFG_FAULT=fault-irix-mips.h ;;
240 *) CFG_FAULT=fault-irix.h ;;
242 FAULT_CONTEXT='struct sigcontext'
244 if test -z "$CFG_FAULT" && test "$sv_cv_fault_hpux_hppa" = yes; then
246 hppa* | parisc*) CFG_FAULT=fault-hpux-hppa.h ;;
247 *) CFG_FAULT=fault-hpux.h ;;
249 FAULT_CONTEXT='struct sigcontext'
251 if test -z "$CFG_FAULT" && test "$sv_cv_fault_osf_alpha" = yes; then
253 alpha*) CFG_FAULT=fault-osf-alpha.h ;;
254 *) CFG_FAULT=fault-osf.h ;;
256 FAULT_CONTEXT='struct sigcontext'
258 if test -z "$CFG_FAULT" && test "$sv_cv_fault_netbsd_alpha" = yes; then
260 alpha*) CFG_FAULT=fault-netbsd-alpha.h ;;
262 FAULT_CONTEXT='struct sigcontext'
264 if test -z "$CFG_FAULT" && test "$sv_cv_fault_linux_i386" = yes; then
266 i?86 | x86_64) CFG_FAULT=fault-linux-i386.h ;;
268 FAULT_CONTEXT='struct sigcontext'
270 if test -z "$CFG_FAULT" && test "$sv_cv_fault_linux_i386_old" = yes; then
272 i?86 | x86_64) CFG_FAULT=fault-linux-i386-old.h ;;
274 FAULT_CONTEXT='struct sigcontext'
276 if test -z "$CFG_FAULT" && test "$sv_cv_fault_linux_powerpc" = yes; then
278 powerpc* | rs6000) CFG_FAULT=fault-linux-powerpc.h ;;
280 FAULT_CONTEXT='struct sigcontext'
282 if test -z "$CFG_FAULT" && test "$sv_cv_fault_linux_hppa" = yes; then
284 hppa* | parisc*) CFG_FAULT=fault-linux-hppa.h ;;
287 if test -z "$CFG_FAULT" && test "$sv_cv_fault_hurd" = yes; then
289 netbsd*) # A false positive.
292 CFG_FAULT=fault-hurd.h
293 FAULT_CONTEXT='struct sigcontext'
297 if test -z "$CFG_FAULT" && test "$sv_cv_fault_bsd" = yes; then
299 freebsd* | dragonfly* | kfreebsd*)
302 CFG_FAULT=fault-freebsd-i386.h
303 FAULT_CONTEXT='struct sigcontext'
306 CFG_FAULT=fault-bsd.h
312 CFG_FAULT=fault-bsd.h
317 if test -z "$CFG_FAULT" && test "$sv_cv_fault_posix" = yes; then
321 i?86 | x86_64) CFG_FAULT=fault-openbsd-i386.h ;;
322 *) CFG_FAULT=fault-openbsd.h ;;
324 FAULT_CONTEXT='struct sigcontext'
329 CFG_FAULT=fault-linux-ia64.h
330 FAULT_CONTEXT='struct sigcontext'
335 if test -z "$CFG_FAULT"; then
339 i?86 | x86_64) CFG_FAULT=fault-solaris-i386.h ;;
340 sparc*) CFG_FAULT=fault-solaris-sparc.h ;;
341 *) CFG_FAULT=fault-solaris.h ;;
346 powerpc* | rs6000) CFG_FAULT=fault-aix5-powerpc.h ;;
347 *) CFG_FAULT=fault-aix5.h ;;
351 CFG_FAULT=fault-netbsd.h
354 CFG_FAULT=fault-posix.h
357 FAULT_CONTEXT='ucontext_t'
358 FAULT_CONTEXT_INCLUDE='#include <ucontext.h>'
361 if test -z "$CFG_FAULT"; then
363 macos* | darwin[[6-9]]* | darwin[[1-9]][[0-9]]*)
365 powerpc* | rs6000 | i?86 | x86_64)
366 CFG_MACHFAULT=machfault-macos.h
367 FAULT_CONTEXT_INCLUDE='#include <signal.h>
368 #include <mach/thread_status.h>
369 #if defined __ppc64__
370 #define sigsegv_thread_state_t ppc_thread_state64_t
371 #elif defined __ppc__
372 #define sigsegv_thread_state_t ppc_thread_state_t
374 #if defined __x86_64__
375 #define sigsegv_thread_state_t x86_thread_state64_t
376 #elif defined __i386__
377 #if defined x86_THREAD_STATE32
378 #define sigsegv_thread_state_t x86_thread_state32_t
380 #define sigsegv_thread_state_t i386_thread_state_t
383 FAULT_CONTEXT='sigsegv_thread_state_t'
386 if test -n "$CFG_MACHFAULT"; then
387 CFG_HANDLER=handler-macos.c
388 CFG_FAULT=fault-macos.h # nonexistent, just a dummy
394 dnl Next, the cases where there is a hairy CPU dependent way to get the
397 if test -z "$CFG_FAULT" && test "$sv_cv_fault_linux_m68k" = yes; then
400 CFG_FAULT=fault-linux-m68k.h
401 FAULT_CONTEXT='struct sigcontext'
405 if test -z "$CFG_FAULT" && test "$sv_cv_fault_macosdarwin7_ppc" = yes; then
408 CFG_FAULT=fault-macosdarwin7-powerpc.h
409 FAULT_CONTEXT='ucontext_t'
410 FAULT_CONTEXT_INCLUDE='#include <signal.h>
411 #include <ucontext.h>'
415 if test -z "$CFG_FAULT" && test "$sv_cv_fault_macosdarwin5_ppc" = yes; then
418 CFG_FAULT=fault-macosdarwin5-powerpc.h
419 FAULT_CONTEXT='struct sigcontext'
423 if test -z "$CFG_FAULT"; then
426 FAULT_CONTEXT='CONTEXT'
427 FAULT_CONTEXT_INCLUDE='#include <windows.h>'
428 CFG_FAULT=fault-win32.h # nonexistent, just a dummy
432 if test -n "$CFG_FAULT"; then
433 sv_cv_have_sigsegv_recovery=yes
435 sv_cv_have_sigsegv_recovery=no
437 dnl No way to get the fault address. But other information is available.
443 CFG_FAULT=fault-linux-alpha.h
444 FAULT_CONTEXT='struct sigcontext'
446 arm* | strongarm* | xscale*)
447 CFG_FAULT=fault-linux-arm.h
448 FAULT_CONTEXT='struct sigcontext'
451 CFG_FAULT=fault-linux-cris.h
452 FAULT_CONTEXT='struct sigcontext'
455 CFG_FAULT=fault-linux-mips.h
456 FAULT_CONTEXT='struct sigcontext'
459 CFG_FAULT=fault-linux-s390.h
460 FAULT_CONTEXT='struct sigcontext'
463 CFG_FAULT=fault-linux-sh.h
464 FAULT_CONTEXT='struct sigcontext'
467 CFG_FAULT=fault-linux-sparc.h
468 FAULT_CONTEXT='struct sigcontext'
471 CFG_FAULT=fault-linux-x86_64.h
472 FAULT_CONTEXT='struct sigcontext'
478 i?86 | x86_64) CFG_FAULT=fault-beos-i386.h ;;
479 *) CFG_FAULT=fault-beos.h ;;
481 FAULT_CONTEXT='struct vregs'
485 i?86 | x86_64) CFG_FAULT=fault-macos-i386.h ;;
487 FAULT_CONTEXT='struct sigcontext'
491 AC_MSG_CHECKING([for the fault handler specifics])
492 if test -n "$CFG_FAULT"; then
493 sv_cv_fault_include=$CFG_FAULT
495 if test -n "$CFG_MACHFAULT"; then
496 sv_cv_fault_include=$CFG_MACHFAULT
498 sv_cv_fault_include=none
501 AC_MSG_RESULT([$sv_cv_fault_include])
502 if test -z "$CFG_FAULT"; then
503 CFG_FAULT=fault-none.h
505 AC_DEFINE_UNQUOTED(CFG_FAULT, "$CFG_FAULT",
506 [The name of the include file describing the fault handler.])
507 if test -z "$CFG_MACHFAULT"; then
508 CFG_MACHFAULT=fault-none.h
510 AC_DEFINE_UNQUOTED(CFG_MACHFAULT, "$CFG_MACHFAULT",
511 [The name of the include file describing the Mach fault handler.])
512 AC_SUBST(FAULT_CONTEXT)
513 AC_SUBST(FAULT_CONTEXT_INCLUDE)
515 AC_MSG_CHECKING([if the system supports catching SIGSEGV])
516 AC_MSG_RESULT([$sv_cv_have_sigsegv_recovery])
517 if test $sv_cv_have_sigsegv_recovery != no; then
518 HAVE_SIGSEGV_RECOVERY=1
520 HAVE_SIGSEGV_RECOVERY=0
522 AC_SUBST(HAVE_SIGSEGV_RECOVERY)
524 dnl The stackoverflow_context_t type depends on the CFG_FAULT include file.
527 AC_CACHE_CHECK([for stack direction], sv_cv_stack_direction_msg, [
529 dnl See the #define STACK_GROWS_DOWNWARD in gcc-3.1/gcc/config/*/*.h.
533 arm* | strongarm* | xscale* | \
535 c1 | c2 | c32 | c34 | c38 | \
556 powerpc* | rs6000 | \
564 sv_cv_stack_direction=-1 ;;
571 sv_cv_stack_direction=1 ;;
573 if test $cross_compiling = no; then
574 cat > conftest.c <<EOF
577 get_stack_direction ()
580 static char *dummyaddr = (char *)0;
581 if (dummyaddr != (char *)0)
582 return &dummy > dummyaddr ? 1 : &dummy < dummyaddr ? -1 : 0;
587 int result = get_stack_direction ();
588 /* The next assignment avoids tail recursion elimination
590 dummyaddr = (char *)0;
598 printf ("%d\n", get_stack_direction ());
603 sv_cv_stack_direction=`./conftest`
605 sv_cv_stack_direction=0
609 case $sv_cv_stack_direction in
610 1) sv_cv_stack_direction_msg="grows up";;
611 -1) sv_cv_stack_direction_msg="grows down";;
612 *) sv_cv_stack_direction_msg="unknown";;
615 AC_DEFINE_UNQUOTED(STACK_DIRECTION, [$sv_cv_stack_direction],
616 [Define as the direction of stack growth for your system.
617 STACK_DIRECTION > 0 => grows toward higher addresses
618 STACK_DIRECTION < 0 => grows toward lower addresses
619 STACK_DIRECTION = 0 => spaghetti stack.])
621 dnl Determination of the stack's virtual memory area.
622 AC_CACHE_CHECK([for PIOCMAP in sys/procfs.h], sv_cv_procfsvma, [
623 AC_TRY_LINK([#include <sys/procfs.h>],
624 [int x = PIOCNMAP + PIOCMAP; prmap_t y;],
625 sv_cv_procfsvma=yes, sv_cv_procfsvma=no)
627 AC_CHECK_FUNCS([mincore])
629 if test $sv_cv_procfsvma = yes; then
630 CFG_STACKVMA=stackvma-procfs.c
633 linux*) CFG_STACKVMA=stackvma-linux.c ;;
634 freebsd* | dragonfly*) CFG_STACKVMA=stackvma-freebsd.c ;;
635 beos*) CFG_STACKVMA=stackvma-beos.c ;;
636 macos* | darwin*) CFG_STACKVMA=stackvma-mach.c ;;
639 if test -z "$CFG_STACKVMA" && test $ac_cv_func_mincore = yes; then
640 CFG_STACKVMA=stackvma-mincore.c
642 if test -n "$CFG_STACKVMA"; then
643 AC_DEFINE(HAVE_STACKVMA, 1,
644 [Define if CFG_STACKVMA is set to a nontrivial source file.])
646 CFG_STACKVMA=stackvma-none.c
648 AC_DEFINE_UNQUOTED(CFG_STACKVMA, "$CFG_STACKVMA",
649 [The name of the file determining the stack virtual memory area.])
650 AC_SUBST(CFG_STACKVMA)
652 AC_CHECK_FUNCS([getrlimit setrlimit])
654 dnl Catching stack overflow requires an alternate signal stack.
655 dnl The old "install a guard page" trick would be unreliable, because
656 dnl we don't know where exactly to place the guard page.
659 AC_CACHE_CHECK([if the system supports catching stack overflow],
660 sv_cv_have_stack_overflow_recovery,
662 dnl On Mach, it requires a machfault-*.h (see src/handler-macos.c).
663 dnl On Unix, it requires either sigaltstack() or the BeOS set_signal_stack()
664 dnl function, and on Unix it requires a fault-*.h or a stackvma-*.c with
665 dnl certain properties (see src/handler-unix.c).
666 if test "$CFG_MACHFAULT" != fault-none.h; then
667 sv_cv_have_stack_overflow_recovery=yes
669 if test "$sv_cv_sigaltstack" != no; then
670 sv_cv_have_stack_overflow_recovery=maybe
673 beos*) sv_cv_have_stack_overflow_recovery=maybe ;;
674 mingw* | cygwin*) sv_cv_have_stack_overflow_recovery=yes ;;
675 *) sv_cv_have_stack_overflow_recovery=no ;;
679 if test $sv_cv_have_stack_overflow_recovery = maybe; then
680 if test -n "$CFG_FAULT"; then
681 AC_EGREP_CPP([xyzzy], [
682 #include "$srcdir/src/$CFG_FAULT"
683 #ifdef SIGSEGV_FAULT_HANDLER_ARGLIST
684 #ifdef SIGSEGV_FAULT_ADDRESS
688 ], [condA=true], [condA=false])
692 if test -n "$CFG_FAULT"; then
693 AC_EGREP_CPP([xyzzy], [
694 #include "$srcdir/src/$CFG_FAULT"
695 #ifdef SIGSEGV_FAULT_HANDLER_ARGLIST
696 #ifdef SIGSEGV_FAULT_STACKPOINTER
700 ], [condB=true], [condB=false])
704 if test "$CFG_STACKVMA" != "stackvma-none.c"; then
709 if { $condA && $condB; } || { $condA && $condC; } || { $condB && $condC; }; then
710 sv_cv_have_stack_overflow_recovery=yes
712 sv_cv_have_stack_overflow_recovery=no
716 if test $sv_cv_have_stack_overflow_recovery != no; then
717 HAVE_STACK_OVERFLOW_RECOVERY=1
719 HAVE_STACK_OVERFLOW_RECOVERY=0
721 AC_SUBST(HAVE_STACK_OVERFLOW_RECOVERY)
723 # How to longjmp out of a signal handler, in such a way that the
724 # alternate signal stack remains functional.
726 # On MacOS X 10.2 or newer, we don't need these tests, because we'll end up
727 # using handler-macos.c anyway. If we were to perform the tests, 2 Crash Report
728 # dialog windows would pop up.
730 macos* | darwin[[6-9]]* | darwin[[1-9]][[0-9]]*) ;;
733 dnl FIXME: Put in some more known values into the third argument.
734 SV_TRY_LEAVE_HANDLER_LONGJMP([], sv_cv_leave_handler_longjmp,
735 [*-*-osf[4-9]* | *-*-hpux11* | *-*-linux2.[2-9]*],
738 dnl FIXME: Put in some more known values into the third argument.
739 SV_TRY_LEAVE_HANDLER_LONGJMP([ and sigaltstack],
740 sv_cv_leave_handler_longjmp_sigaltstack,
744 #define SS_ONSTACK SA_ONSTACK
748 if (sigaltstack (NULL, &ss) >= 0)
750 ss.ss_flags &= ~SS_ONSTACK;
751 sigaltstack (&ss, NULL);
755 dnl FIXME: Put in some more known values into the third argument.
756 SV_TRY_LEAVE_HANDLER_LONGJMP([ and setcontext],
757 sv_cv_leave_handler_longjmp_setcontext,
758 [*-*-irix* | *-*-solaris*],
759 [#include <ucontext.h>
761 #define SS_ONSTACK SA_ONSTACK
765 static ucontext_t uc;
767 if (getcontext (&uc) >= 0)
769 if (uc.uc_stack.ss_flags & SS_ONSTACK)
771 uc.uc_stack.ss_flags &= ~SS_ONSTACK;
777 # End of MacOS X special casing.
781 # How to siglongjmp out of a signal handler, in such a way that the
782 # alternate signal stack remains functional.
784 # On MacOS X 10.2 or newer, we don't need these tests, because we'll end up
785 # using handler-macos.c anyway. If we were to perform the tests, 2 Crash Report
786 # dialog windows would pop up.
788 macos* | darwin[[6-9]]* | darwin[[1-9]][[0-9]]*) ;;
791 dnl FIXME: Put in some more known values into the third argument.
792 SV_TRY_LEAVE_HANDLER_SIGLONGJMP([], sv_cv_leave_handler_siglongjmp,
793 [*-*-osf[4-9]* | *-*-hpux11* | *-*-linux2.[2-9]* | *-*-irix* | *-*-solaris*],
796 dnl FIXME: Put in some more known values into the third argument.
797 SV_TRY_LEAVE_HANDLER_SIGLONGJMP([ and sigaltstack],
798 sv_cv_leave_handler_siglongjmp_sigaltstack,
802 #define SS_ONSTACK SA_ONSTACK
806 if (sigaltstack (NULL, &ss) >= 0)
808 ss.ss_flags &= ~SS_ONSTACK;
809 sigaltstack (&ss, NULL);
813 dnl FIXME: Put in some more known values into the third argument.
814 SV_TRY_LEAVE_HANDLER_SIGLONGJMP([ and setcontext],
815 sv_cv_leave_handler_siglongjmp_setcontext,
817 [#include <ucontext.h>
819 #define SS_ONSTACK SA_ONSTACK
823 static ucontext_t uc;
825 if (getcontext(&uc) >= 0)
827 if (uc.uc_stack.ss_flags & SS_ONSTACK)
829 uc.uc_stack.ss_flags &= ~SS_ONSTACK;
835 # End of MacOS X special casing.
840 if test "$sv_cv_leave_handler_longjmp" != no; then
841 CFG_LEAVE=leave-nop.c
843 if test "$sv_cv_leave_handler_longjmp_sigaltstack" != no; then
844 CFG_LEAVE=leave-sigaltstack.c
846 if test "$sv_cv_leave_handler_longjmp_setcontext" != no; then
847 CFG_LEAVE=leave-setcontext.c
852 # On BeOS, the 6 tests fail because sigaltstack() doesn't exist.
853 # If one uses set_signal_stack() instead of sigaltstack(), the first
854 # test actually works. i.e. sv_cv_leave_handler_longjmp would be 'yes'.
855 beos*) CFG_LEAVE=leave-nop.c ;;
857 if test -z "$CFG_LEAVE"; then
858 CFG_LEAVE=leave-none.c
860 AC_DEFINE_UNQUOTED(CFG_LEAVE, "$CFG_LEAVE",
861 [The name of the file implementing sigsegv_reset_onstack_flag.])
865 mingw* | cygwin*) CFG_HANDLER=handler-win32.c ;;
867 if test -z "$CFG_HANDLER"; then
868 if test $sv_cv_have_sigsegv_recovery = no \
869 && test $sv_cv_have_stack_overflow_recovery = no; then
870 CFG_HANDLER=handler-none.c
872 CFG_HANDLER=handler-unix.c
877 AC_DEFINE_UNQUOTED(CFG_HANDLER, "$CFG_HANDLER",
878 [The name of the file implementing the handler functionality.])
879 AC_SUBST(CFG_HANDLER)
881 { echo; echo "${term_bold}Build Parameters:${term_norm}"; } >& AS_MESSAGE_FD
883 dnl Relocatability is a nop for this package.
886 { echo; echo "${term_bold}Output Substitution:${term_norm}"; } >& AS_MESSAGE_FD
888 dnl AC_OUTPUT(Makefile)
890 src/Makefile src/sigsegv.h
893 { echo; echo "Now please type '${term_bold}make${term_norm}' to compile. Good luck."; echo; } >& AS_MESSAGE_FD