1 # libsigsegv.m4 serial 2
2 dnl Copyright (C) 2002-2003, 2008 Free Software Foundation, Inc.
3 dnl This file is free software; the Free Software Foundation
4 dnl gives unlimited permission to copy and/or distribute it,
5 dnl with or without modifications, as long as this notice is preserved.
7 dnl From Bruno Haible, Sam Steingold.
9 AC_DEFUN([gl_LIBSIGSEGV],
11 dnl Prerequisites of AC_LIB_LINKFLAGS_BODY.
12 AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
13 AC_REQUIRE([AC_LIB_RPATH])
15 dnl Search for libsigsegv and define LIBSIGSEGV, LTLIBSIGSEGV and INCSIGSEGV
17 AC_LIB_LINKFLAGS_BODY([sigsegv])
19 dnl Add $INCSIGSEGV to CPPFLAGS before performing the following checks,
20 dnl because if the user has installed libsigsegv and not disabled its use
21 dnl via --without-libsigsegv-prefix, he wants to use it.
22 gl_save_CPPFLAGS="$CPPFLAGS"
23 AC_LIB_APPENDTOVAR([CPPFLAGS], [$INCSIGSEGV])
25 AC_CACHE_CHECK([for libsigsegv], gl_cv_lib_sigsegv, [
26 gl_cv_lib_sigsegv="no, consider installing GNU libsigsegv"
28 LIBS="$LIBS $LIBSIGSEGV"
29 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <sigsegv.h>]],
30 [sigsegv_deinstall_handler();])],
31 [gl_cv_lib_sigsegv=yes])
34 if test "$gl_cv_lib_sigsegv" = yes; then
35 AC_DEFINE([HAVE_LIBSIGSEGV], 1,
36 [Define if you have the libsigsegv library.])
37 AC_MSG_CHECKING([how to link with libsigsegv])
38 AC_MSG_RESULT([$LIBSIGSEGV])
40 dnl If $LIBSIGSEGV didn't lead to a usable library, we don't need
41 dnl $INCSIGSEGV either.
42 CPPFLAGS="$gl_save_CPPFLAGS"
47 AC_SUBST(LTLIBSIGSEGV)