2 A simplified variant of GNU libsigsegv.
3 It implements the most important features of GNU libsigsegv: catching SIGSEGV
4 and catching stack overflow. It does *not* implement the 'sigsegv_dispatcher'
5 type (which is not multithread-safe).
6 It supports all modern Unix-like platforms: Linux, Hurd, FreeBSD, NetBSD,
7 OpenBSD, macOS, AIX, Solaris, Cygwin, Haiku, even IRIX. It does *not* support
8 HP-UX, Minix, native Windows; on these platforms the module compiles and
9 provides a <sigsegv.h> header file, but it does not define HAVE_SIGSEGV_RECOVERY
10 and HAVE_STACK_OVERFLOW_RECOVERY.
11 Unlike GNU libsigsegv, which consists of many .h and .c files, this module
12 compiles to just two object files, rather than a library.
34 AC_REQUIRE([gl_SIGSEGV])
35 if test $gl_sigsegv_uses_libsigsegv = yes; then
36 GL_GENERATE_SIGSEGV_H=false
38 GL_GENERATE_SIGSEGV_H=true
40 gl_CONDITIONAL_HEADER([sigsegv.h])
42 if $GL_GENERATE_SIGSEGV_H; then
43 dnl Persuade glibc <sys/ucontext.h> to declare macros designating register
44 dnl indices: REG_RSP on x86_64, REG_ESP on i386.
45 dnl Persuade Solaris OpenIndiana <ucontext.h> to include <sys/regset.h>,
46 dnl which declares macros designating register indices, such as ESP on i386.
47 dnl Persuade Solaris OpenIndiana <unistd.h> to declare mincore().
48 AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
52 AC_REQUIRE([AC_CANONICAL_HOST])
55 AC_DEFINE([SOLARIS11], [1], [Define on Solaris 11 and its derivates.])
64 dnl Catching stack overflow requires an alternate signal stack.
65 dnl The old "install a guard page" trick would be unreliable, because
66 dnl we don't know where exactly to place the guard page.
69 AC_CHECK_FUNCS_ONCE([getrlimit])
73 BUILT_SOURCES += $(SIGSEGV_H)
75 if GL_GENERATE_SIGSEGV_H
76 sigsegv.h: sigsegv.in.h $(top_builddir)/config.status
77 @NMD@ $(AM_V_GEN)$(MKDIR_P) '%reldir%'
78 $(gl_V_at)$(SED_HEADER_TO_AT_t) $(srcdir)/sigsegv.in.h
81 sigsegv.h: $(top_builddir)/config.status
84 MOSTLYCLEANFILES += sigsegv.h sigsegv.h-t
86 if GL_GENERATE_SIGSEGV_H
87 lib_SOURCES += sigsegv.c stackvma.c
94 $(LTLIBSIGSEGV) when linking with libtool, $(LIBSIGSEGV) otherwise