emacs-bug-tracker
[Top][All Lists]
Advanced

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

[debbugs-tracker] bug#16757: closed ([PATCH 1/2] search for pcre via pkg


From: GNU bug Tracking System
Subject: [debbugs-tracker] bug#16757: closed ([PATCH 1/2] search for pcre via pkg-config)
Date: Mon, 06 Apr 2015 23:14:02 +0000

Your message dated Mon, 06 Apr 2015 16:12:59 -0700
with message-id <address@hidden>
and subject line Re: [PATCH 1/2] search for pcre via pkg-config
has caused the debbugs.gnu.org bug report #16757,
regarding [PATCH 1/2] search for pcre via pkg-config
to be marked as done.

(If you believe you have received this mail in error, please contact
address@hidden)


-- 
16757: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=16757
GNU Bug Tracking System
Contact address@hidden with problems
--- Begin Message --- Subject: [PATCH 1/2] search for pcre via pkg-config Date: Fri, 14 Feb 2014 17:09:31 -0500
Since pcre ships a pkg-config module now, let's default to using that.
If the system lacks pkg-config support, we still fall back to the old
logic of probing the headers/libs directly.

* configure.ac: Call m4_pattern_forbid on the PKG_ namespace.
* m4/pcre.m4: Change serial to 2.
(gl_FUNC_PCRE): Require PKG_PROG_PKG_CONFIG. Change LIB_PCRE to PCRE_LIBS.
Set up PCRE_CFLAGS like PCRE_LIBS. Call PKG_CHECK_MODULES and move existing
logic to the 4th arg.
* src/Makefile.am (grep_LDADD): Change LIB_PCRE to PCRE_LIBS.
(AM_CPPFLAGS): Add $(PCRE_CFLAGS).
---
 configure.ac    |  2 ++
 m4/pcre.m4      | 42 ++++++++++++++++++++++++++----------------
 src/Makefile.am |  4 ++--
 3 files changed, 30 insertions(+), 18 deletions(-)

diff --git a/configure.ac b/configure.ac
index 886449b..a579317 100644
--- a/configure.ac
+++ b/configure.ac
@@ -75,6 +75,8 @@ AM_SILENT_RULES([yes]) # make --enable-silent-rules the 
default.
 
 AC_CONFIG_HEADERS([config.h:config.hin])
 
+m4_pattern_forbid([^PKG_])
+
 dnl Checks for programs.
 AC_CANONICAL_HOST
 AC_PROG_AWK
diff --git a/m4/pcre.m4 b/m4/pcre.m4
index a0b2b68..c424443 100644
--- a/m4/pcre.m4
+++ b/m4/pcre.m4
@@ -1,5 +1,5 @@
 # pcre.m4 - check for libpcre support
-# serial 1
+# serial 2
 
 # Copyright (C) 2010-2014 Free Software Foundation, Inc.
 # This file is free software; the Free Software Foundation
@@ -8,6 +8,8 @@
 
 AC_DEFUN([gl_FUNC_PCRE],
 [
+  AC_REQUIRE([PKG_PROG_PKG_CONFIG])
+
   AC_ARG_ENABLE([perl-regexp],
     AC_HELP_STRING([--disable-perl-regexp],
                    [disable perl-regexp (pcre) support]),
@@ -17,25 +19,33 @@ AC_DEFUN([gl_FUNC_PCRE],
      esac],
     [test_pcre=yes])
 
-  LIB_PCRE=
-  AC_SUBST([LIB_PCRE])
+  PCRE_LIBS=
+  AC_SUBST([PCRE_LIBS])
+  PCRE_CFLAGS=
+  AC_SUBST([PCRE_CFLAGS])
   use_pcre=no
 
   if test x"$test_pcre" = x"yes"; then
-    AC_CHECK_HEADERS([pcre.h])
-    AC_CHECK_HEADERS([pcre/pcre.h])
-    if test $ac_cv_header_pcre_h = yes \
-        || test $ac_cv_header_pcre_pcre_h = yes; then
-      pcre_saved_LIBS=$LIBS
-      AC_SEARCH_LIBS([pcre_compile], [pcre],
-        [test "$ac_cv_search_pcre_compile" = "none required" ||
-         LIB_PCRE=$ac_cv_search_pcre_compile])
-      AC_CHECK_FUNCS([pcre_compile])
-      LIBS=$pcre_saved_LIBS
-      if test $ac_cv_func_pcre_compile = yes; then
-        use_pcre=yes
+    PKG_CHECK_MODULES([PCRE], [libpcre], [dnl
+      # Found everything we needed via pkg-config.
+      use_pcre=yes
+      ], [dnl
+      # Fall back when pkg-config is not available.
+      AC_CHECK_HEADERS([pcre.h])
+      AC_CHECK_HEADERS([pcre/pcre.h])
+      if test $ac_cv_header_pcre_h = yes \
+          || test $ac_cv_header_pcre_pcre_h = yes; then
+        pcre_saved_LIBS=$LIBS
+        AC_SEARCH_LIBS([pcre_compile], [pcre],
+          [test "$ac_cv_search_pcre_compile" = "none required" ||
+           PCRE_LIBS=$ac_cv_search_pcre_compile])
+        AC_CHECK_FUNCS([pcre_compile])
+        LIBS=$pcre_saved_LIBS
+        if test $ac_cv_func_pcre_compile = yes; then
+          use_pcre=yes
+        fi
       fi
-    fi
+    ])
     if test $use_pcre = no; then
       AC_MSG_WARN([libpcre development library was not found or not usable.])
       AC_MSG_WARN([AC_PACKAGE_NAME will be built without pcre support.])
diff --git a/src/Makefile.am b/src/Makefile.am
index 9283d1a..5b2f2b9 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -41,8 +41,8 @@ LDADD = \
   ../lib/libgreputils.a $(LIBINTL) ../lib/libgreputils.a $(LIBICONV) \
   $(LIBTHREAD)
 
-grep_LDADD = $(LDADD) $(LIB_PCRE)
+grep_LDADD = $(LDADD) $(PCRE_LIBS)
 localedir = $(datadir)/locale
-AM_CPPFLAGS = -I$(top_builddir)/lib -I$(top_srcdir)/lib
+AM_CPPFLAGS = -I$(top_builddir)/lib -I$(top_srcdir)/lib $(PCRE_CFLAGS)
 
 EXTRA_DIST = dosbuf.c
-- 
1.8.5.4




--- End Message ---
--- Begin Message --- Subject: Re: [PATCH 1/2] search for pcre via pkg-config Date: Mon, 06 Apr 2015 16:12:59 -0700 User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.6.0
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.

Attachment: 0001-build-improve-pkg-config-doc-and-error-handling.patch
Description: Text Data


--- End Message ---

reply via email to

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