bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

simplify libsigsegv.m4


From: Bruno Haible
Subject: simplify libsigsegv.m4
Date: Sun, 26 Apr 2009 18:10:32 +0200
User-agent: KMail/1.9.9

This patch simplifies m4/libsigsegv.m4, by use of the AC_LIB_HAVE_LINKFLAGS.


2009-04-26  Bruno Haible  <address@hidden>

        * m4/lib-link.m4 (AC_LIB_HAVE_LINKFLAGS): Accept a fifth argument.
        * m4/libsigsegv.m4 (gl_LIBSIGSEGV): Simplify by using
        AC_LIB_HAVE_LINKFLAGS.

*** m4/lib-link.m4.orig 2009-04-26 18:00:47.000000000 +0200
--- m4/lib-link.m4      2009-04-26 17:59:16.000000000 +0200
***************
*** 1,4 ****
! # lib-link.m4 serial 18 (gettext-0.18)
  dnl Copyright (C) 2001-2009 Free Software Foundation, Inc.
  dnl This file is free software; the Free Software Foundation
  dnl gives unlimited permission to copy and/or distribute it,
--- 1,4 ----
! # lib-link.m4 serial 19 (gettext-0.18)
  dnl Copyright (C) 2001-2009 Free Software Foundation, Inc.
  dnl This file is free software; the Free Software Foundation
  dnl gives unlimited permission to copy and/or distribute it,
***************
*** 43,54 ****
    popdef([Name])
  ])
  
! dnl AC_LIB_HAVE_LINKFLAGS(name, dependencies, includes, testcode)
  dnl searches for libname and the libraries corresponding to explicit and
  dnl implicit dependencies, together with the specified include files and
! dnl the ability to compile and link the specified testcode. If found, it
! dnl sets and AC_SUBSTs HAVE_LIB${NAME}=yes and the LIB${NAME} and
! dnl LTLIB${NAME} variables and augments the CPPFLAGS variable, and
  dnl #defines HAVE_LIB${NAME} to 1. Otherwise, it sets and AC_SUBSTs
  dnl HAVE_LIB${NAME}=no and LIB${NAME} and LTLIB${NAME} to empty.
  dnl Sets and AC_SUBSTs the LIB${NAME}_PREFIX variable to nonempty if libname
--- 43,55 ----
    popdef([Name])
  ])
  
! dnl AC_LIB_HAVE_LINKFLAGS(name, dependencies, includes, testcode, 
[missing-message])
  dnl searches for libname and the libraries corresponding to explicit and
  dnl implicit dependencies, together with the specified include files and
! dnl the ability to compile and link the specified testcode. The 
missing-message
! dnl defaults to 'no' and may contain additional hints for the user.
! dnl If found, it sets and AC_SUBSTs HAVE_LIB${NAME}=yes and the LIB${NAME}
! dnl and LTLIB${NAME} variables and augments the CPPFLAGS variable, and
  dnl #defines HAVE_LIB${NAME} to 1. Otherwise, it sets and AC_SUBSTs
  dnl HAVE_LIB${NAME}=no and LIB${NAME} and LTLIB${NAME} to empty.
  dnl Sets and AC_SUBSTs the LIB${NAME}_PREFIX variable to nonempty if libname
***************
*** 74,85 ****
    AC_CACHE_CHECK([for lib[]$1], [ac_cv_lib[]Name], [
      ac_save_LIBS="$LIBS"
      LIBS="$LIBS $LIB[]NAME"
!     AC_TRY_LINK([$3], [$4], [ac_cv_lib[]Name=yes], [ac_cv_lib[]Name=no])
      LIBS="$ac_save_LIBS"
    ])
    if test "$ac_cv_lib[]Name" = yes; then
      HAVE_LIB[]NAME=yes
!     AC_DEFINE([HAVE_LIB]NAME, 1, [Define if you have the $1 library.])
      AC_MSG_CHECKING([how to link with lib[]$1])
      AC_MSG_RESULT([$LIB[]NAME])
    else
--- 75,88 ----
    AC_CACHE_CHECK([for lib[]$1], [ac_cv_lib[]Name], [
      ac_save_LIBS="$LIBS"
      LIBS="$LIBS $LIB[]NAME"
!     AC_TRY_LINK([$3], [$4],
!       [ac_cv_lib[]Name=yes],
!       [ac_cv_lib[]Name='m4_if([$5], [], [no], [[$5]])'])
      LIBS="$ac_save_LIBS"
    ])
    if test "$ac_cv_lib[]Name" = yes; then
      HAVE_LIB[]NAME=yes
!     AC_DEFINE([HAVE_LIB]NAME, 1, [Define if you have the lib[]$1 library.])
      AC_MSG_CHECKING([how to link with lib[]$1])
      AC_MSG_RESULT([$LIB[]NAME])
    else
*** m4/libsigsegv.m4.orig       2009-04-26 18:00:47.000000000 +0200
--- m4/libsigsegv.m4    2009-04-26 17:59:16.000000000 +0200
***************
*** 1,4 ****
! # libsigsegv.m4 serial 3
  dnl Copyright (C) 2002-2003, 2008, 2009 Free Software Foundation, Inc.
  dnl This file is free software; the Free Software Foundation
  dnl gives unlimited permission to copy and/or distribute it,
--- 1,4 ----
! # libsigsegv.m4 serial 4
  dnl Copyright (C) 2002-2003, 2008, 2009 Free Software Foundation, Inc.
  dnl This file is free software; the Free Software Foundation
  dnl gives unlimited permission to copy and/or distribute it,
***************
*** 8,48 ****
  
  AC_DEFUN([gl_LIBSIGSEGV],
  [
!   dnl Prerequisites of AC_LIB_LINKFLAGS_BODY.
!   AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
!   AC_REQUIRE([AC_LIB_RPATH])
! 
!   dnl Search for libsigsegv and define LIBSIGSEGV, LTLIBSIGSEGV and INCSIGSEGV
!   dnl accordingly.
!   AC_LIB_LINKFLAGS_BODY([sigsegv])
! 
!   dnl Add $INCSIGSEGV to CPPFLAGS before performing the following checks,
!   dnl because if the user has installed libsigsegv and not disabled its use
!   dnl via --without-libsigsegv-prefix, he wants to use it.
!   gl_save_CPPFLAGS="$CPPFLAGS"
!   AC_LIB_APPENDTOVAR([CPPFLAGS], [$INCSIGSEGV])
! 
!   AC_CACHE_CHECK([for libsigsegv], [gl_cv_lib_sigsegv], [
!     gl_cv_lib_sigsegv="no, consider installing GNU libsigsegv"
!     gl_save_LIBS="$LIBS"
!     LIBS="$LIBS $LIBSIGSEGV"
!     AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <sigsegv.h>]],
!       [sigsegv_deinstall_handler();])],
!       [gl_cv_lib_sigsegv=yes])
!     LIBS="$gl_save_LIBS"
!   ])
!   if test "$gl_cv_lib_sigsegv" = yes; then
!     AC_DEFINE([HAVE_LIBSIGSEGV], [1],
!       [Define if you have the libsigsegv library.])
!     AC_MSG_CHECKING([how to link with libsigsegv])
!     AC_MSG_RESULT([$LIBSIGSEGV])
!   else
!     dnl If $LIBSIGSEGV didn't lead to a usable library, we don't need
!     dnl $INCSIGSEGV either.
!     CPPFLAGS="$gl_save_CPPFLAGS"
!     LIBSIGSEGV=
!     LTLIBSIGSEGV=
!   fi
!   AC_SUBST([LIBSIGSEGV])
!   AC_SUBST([LTLIBSIGSEGV])
  ])
--- 8,16 ----
  
  AC_DEFUN([gl_LIBSIGSEGV],
  [
!   AC_LIB_HAVE_LINKFLAGS([sigsegv], [],
!     [#include <sigsegv.h>], [sigsegv_deinstall_handler();],
!     [no, consider installing GNU libsigsegv])
!   dnl Some other autoconf macros and clisp's configure use this variable.
!   gl_cv_lib_sigsegv="$ac_cv_libsigsegv"
  ])




reply via email to

[Prev in Thread] Current Thread [Next in Thread]