1 # libsigsegv.m4 serial 1
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.
11 AC_DEFUN([gl_LIBSIGSEGV],
13 dnl Prerequisites of AC_LIB_LINKFLAGS_BODY.
14 AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
15 AC_REQUIRE([AC_LIB_RPATH])
17 dnl Search for libsigsegv and define LIBSIGSEGV, LTLIBSIGSEGV and INCSIGSEGV
19 AC_LIB_LINKFLAGS_BODY([sigsegv])
21 dnl Add $INCSIGSEGV to CPPFLAGS before performing the following checks,
22 dnl because if the user has installed libsigsegv and not disabled its use
23 dnl via --without-libsigsegv-prefix, he wants to use it.
24 gl_save_CPPFLAGS="$CPPFLAGS"
25 AC_LIB_APPENDTOVAR([CPPFLAGS], [$INCSIGSEGV])
27 AC_CACHE_CHECK([for libsigsegv], gl_cv_lib_sigsegv, [
28 gl_cv_lib_sigsegv="no, consider installing GNU libsigsegv"
30 LIBS="$LIBS $LIBSIGSEGV"
31 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <sigsegv.h>]],
32 [sigsegv_deinstall_handler();])],
33 [gl_cv_lib_sigsegv=yes])
36 if test "$gl_cv_lib_sigsegv" = yes; then
37 AC_DEFINE([HAVE_LIBSIGSEGV], 1,
38 [Define if you have the libsigsegv library.])
39 AC_MSG_CHECKING([how to link with libsigsegv])
40 AC_MSG_RESULT([$LIBSIGSEGV])
42 dnl If $LIBSIGSEGV didn't lead to a usable library, we don't need
43 dnl $INCSIGSEGV either.
44 CPPFLAGS="$gl_save_CPPFLAGS"
49 AC_SUBST(LTLIBSIGSEGV)