From 4ea0e64a8db7064427f6aa5624a4efd4b41db132 Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Sun, 22 Aug 2021 01:25:59 +0200 Subject: [PATCH] c-stack: Test for libsigsegv once, not twice. * m4/sigsegv.m4: New file, based on modules/sigsegv. * modules/sigsegv (Files): Add it. (configure.ac): Require gl_SIGSEGV. Test gl_sigsegv_uses_libsigsegv instead of with_libsigsegv and gl_cv_lib_sigsegv. * m4/c-stack.m4 (gl_C_STACK): Likewise. --- ChangeLog | 11 ++++++++++- m4/c-stack.m4 | 12 +++++------- m4/sigsegv.m4 | 20 ++++++++++++++++++++ modules/sigsegv | 15 ++++++--------- 4 files changed, 41 insertions(+), 17 deletions(-) create mode 100644 m4/sigsegv.m4 diff --git a/ChangeLog b/ChangeLog index a0a20e496f..732b6f1fff 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2021-08-21 Bruno Haible + + c-stack: Test for libsigsegv once, not twice. + * m4/sigsegv.m4: New file, based on modules/sigsegv. + * modules/sigsegv (Files): Add it. + (configure.ac): Require gl_SIGSEGV. Test gl_sigsegv_uses_libsigsegv + instead of with_libsigsegv and gl_cv_lib_sigsegv. + * m4/c-stack.m4 (gl_C_STACK): Likewise. + 2021-08-21 Bruno Haible rawmemchr: Fix use in relocatable-prog-wrapper (regression 2021-08-20). @@ -23,7 +32,7 @@ 2021-08-17 Paul Eggert - c-stack: fix libsigsegv dependency + c-stack: fix libsigsegv dependency (regression 2021-05-18) Problem reported for GNU grep by Evan Miller (Bug#50098). * m4/c-stack.m4 (gl_C_STACK): Call gl_LIBSIGSEGV before testing gl_cv_lib_sigsegv. diff --git a/m4/c-stack.m4 b/m4/c-stack.m4 index f3de54fad4..caf1d2de72 100644 --- a/m4/c-stack.m4 +++ b/m4/c-stack.m4 @@ -7,16 +7,14 @@ # Written by Paul Eggert. -# serial 24 +# serial 25 AC_DEFUN([gl_C_STACK], [ dnl 'c-stack' needs -lsigsegv if and only if the 'sigsegv' module needs it. - if test "$with_libsigsegv" = yes; then - gl_LIBSIGSEGV - if test "$gl_cv_lib_sigsegv" = yes; then - AC_SUBST([LIBCSTACK], [$LIBSIGSEGV]) - AC_SUBST([LTLIBCSTACK], [$LTLIBSIGSEGV]) - fi + AC_REQUIRE([gl_SIGSEGV]) + if test $gl_sigsegv_uses_libsigsegv = yes; then + AC_SUBST([LIBCSTACK], [$LIBSIGSEGV]) + AC_SUBST([LTLIBCSTACK], [$LTLIBSIGSEGV]) fi ]) diff --git a/m4/sigsegv.m4 b/m4/sigsegv.m4 new file mode 100644 index 0000000000..d5d1fc4b1a --- /dev/null +++ b/m4/sigsegv.m4 @@ -0,0 +1,20 @@ +# sigsegv.m4 serial 1 +dnl Copyright (C) 2021 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +dnl From Bruno Haible. + +AC_DEFUN_ONCE([gl_SIGSEGV], +[ + AC_ARG_WITH([libsigsegv], + [AS_HELP_STRING([--with-libsigsegv], + [use the GNU libsigsegv library, when present, instead of the gnulib module 'sigsegv'])]) + if test "$with_libsigsegv" = yes; then + gl_LIBSIGSEGV + gl_sigsegv_uses_libsigsegv="$gl_cv_lib_sigsegv" + else + gl_sigsegv_uses_libsigsegv=no + fi +]) diff --git a/modules/sigsegv b/modules/sigsegv index 2ef84332d2..fdd815c370 100644 --- a/modules/sigsegv +++ b/modules/sigsegv @@ -20,6 +20,7 @@ m4/mmap-anon.m4 m4/sigaltstack.m4 m4/stack-direction.m4 m4/libsigsegv.m4 +m4/sigsegv.m4 Depends-on: havelib @@ -28,15 +29,11 @@ stdint getpagesize configure.ac: -AC_ARG_WITH([libsigsegv], - [AS_HELP_STRING([--with-libsigsegv], - [use the GNU libsigsegv library, when present, instead of the gnulib module 'sigsegv'])]) -SIGSEGV_H=sigsegv.h -if test "$with_libsigsegv" = yes; then - gl_LIBSIGSEGV - if test "$gl_cv_lib_sigsegv" = yes; then - SIGSEGV_H= - fi +AC_REQUIRE([gl_SIGSEGV]) +if test $gl_sigsegv_uses_libsigsegv = yes; then + SIGSEGV_H= +else + SIGSEGV_H=sigsegv.h fi AC_SUBST([SIGSEGV_H]) AM_CONDITIONAL([GL_GENERATE_SIGSEGV_H], [test -n "$SIGSEGV_H"]) -- 2.39.5