On 04/06/2015 12:14 AM, Mike Frysinger wrote:
On 25 May 2014 01:14, Paul Eggert wrote:
--- a/m4/pcre.m4
+++ b/m4/pcre.m4

+  if test $test_pcre = yes; then
the previous code quoted test_pcre ... i guess previously it was normalized into
"yes" and "no", but seems pretty cheap & easy to be resilient ?

For gnulib we tend to prefer omitting the quotes when they're not needed, to make the code *less* resilient (i.e., to find bugs better....). A style thing, admittedly.


+    PKG_CHECK_MODULES([PCRE], [libpcre], [],
+      [if test -r /usr/include/pcre/pcre.h &&
+          test ! -r /usr/include/pcre.h
+       then
ugh, but i guess i don't really care since this is the default and it can go
poking around in whatever terrible way it wants.

That was fixed in <http://bugs.gnu.org/16757#26>.


+         PCRE_CFLAGS=-I/usr/include/libpng
png eh ?

This was also fixed.

+    if test "$pcre_cv_have_pcre_compile" = yes; then
+      use_pcre=yes
+    else
        AC_MSG_WARN([AC_PACKAGE_NAME will be built without pcre support.])
      fi
ideally this would error out if the user passed --enable-perl-regexp.  the
test_pcre setup would have to pick like "auto" though in the default case.

Thanks, fixed by the attached further patch. I've installed this and the earlier patches in this sequence, and am marking this as done.

>From 5b0cf3b1aa930537312a71e77960f5481b3b79e4 Mon Sep 17 00:00:00 2001
From: Paul Eggert <egg...@cs.ucla.edu>
Date: Mon, 6 Apr 2015 16:09:39 -0700
Subject: [PATCH] build: improve pkg-config doc and error handling

Error-handling improvement suggested by Mike Frysinger in:
http://bugs.gnu.org/16757#29
* NEWS: Document pkg-config changes.
* README-prereq: pkg-config is now a prereq when building from
repository.
* m4/pcre.m4 (gl_FUNC_PCRE): Report an error if pcre is explicitly
requested but not available.  Defer to user-supplied PCRE_CFLAGS
and PCRE_LIBS.
---
 NEWS          |  5 +++++
 README-prereq | 23 ++++++++++++-----------
 m4/pcre.m4    | 12 ++++++------
 3 files changed, 23 insertions(+), 17 deletions(-)

diff --git a/NEWS b/NEWS
index 071caab..ae8f38f 100644
--- a/NEWS
+++ b/NEWS
@@ -2,6 +2,11 @@ GNU grep NEWS                                    -*- outline -*-
 
 * Noteworthy changes in release ?.? (????-??-??) [?]
 
+** Improvements
+
+  When building grep, 'configure' now uses PCRE's pkg-config module for
+  configuration information, rather than attempting to guess it by hand.
+
 ** Bug fixes
 
   grep no longer reads from uninitialized memory or from beyond the end
diff --git a/README-prereq b/README-prereq
index 056f42d..0422aa6 100644
--- a/README-prereq
+++ b/README-prereq
@@ -1,17 +1,18 @@
 This gives some notes on obtaining the tools required for development.
 I.E. the tools checked for by the bootstrap script and include:
 
-- Autoconf  <http://www.gnu.org/software/autoconf/>
-- Automake  <http://www.gnu.org/software/automake/>
-- Bison     <http://www.gnu.org/software/bison/>
-- Gettext   <http://www.gnu.org/software/gettext/>
-- Git       <http://git.or.cz/>
-- Gperf     <http://www.gnu.org/software/gperf/>
-- Gzip      <http://www.gnu.org/software/gzip/>
-- Perl      <http://www.cpan.org/>
-- Rsync     <http://samba.anu.edu.au/rsync/>
-- Tar       <http://www.gnu.org/software/tar/>
-- Texinfo   <http://www.gnu.org/software/texinfo/>
+- Autoconf   <http://www.gnu.org/software/autoconf/>
+- Automake   <http://www.gnu.org/software/automake/>
+- Bison      <http://www.gnu.org/software/bison/>
+- Gettext    <http://www.gnu.org/software/gettext/>
+- Git        <http://git.or.cz/>
+- Gperf      <http://www.gnu.org/software/gperf/>
+- Gzip       <http://www.gnu.org/software/gzip/>
+- Perl       <http://www.cpan.org/>
+- Pkg-config <http://www.freedesktop.org/wiki/Software/pkg-config/>
+- Rsync      <http://samba.anu.edu.au/rsync/>
+- Tar        <http://www.gnu.org/software/tar/>
+- Texinfo    <http://www.gnu.org/software/texinfo/>
 
 Note please try to install/build official packages for your system.
 If these programs are not available use the following instructions
diff --git a/m4/pcre.m4 b/m4/pcre.m4
index 37de4c5..0effc53 100644
--- a/m4/pcre.m4
+++ b/m4/pcre.m4
@@ -14,16 +14,14 @@ AC_DEFUN([gl_FUNC_PCRE],
        yes|no) test_pcre=$enableval;;
        *) AC_MSG_ERROR([invalid value $enableval for --disable-perl-regexp]);;
      esac],
-    [test_pcre=yes])
+    [test_pcre=maybe])
 
-  PCRE_CFLAGS=
-  PCRE_LIBS=
   AC_SUBST([PCRE_CFLAGS])
   AC_SUBST([PCRE_LIBS])
   use_pcre=no
 
-  if test $test_pcre = yes; then
-    PKG_CHECK_MODULES([PCRE], [libpcre], [], [PCRE_LIBS=-lpcre])
+  if test $test_pcre != no; then
+    PKG_CHECK_MODULES([PCRE], [libpcre], [], [: ${PCRE_LIBS=-lpcre}])
 
     AC_CACHE_CHECK([for pcre_compile], [pcre_cv_have_pcre_compile],
       [pcre_saved_CFLAGS=$CFLAGS
@@ -42,8 +40,10 @@ AC_DEFUN([gl_FUNC_PCRE],
 
     if test "$pcre_cv_have_pcre_compile" = yes; then
       use_pcre=yes
-    else
+    elif test $test_pcre = maybe; then
       AC_MSG_WARN([AC_PACKAGE_NAME will be built without pcre support.])
+    else
+      AC_MSG_ERROR([pcre support not available])
     fi
   fi
 
-- 
2.1.0

Reply via email to