On Saturday, February 15, 2014 20:20:35 Jim Meyering wrote: > On Fri, Feb 14, 2014 at 2:09 PM, Mike Frysinger wrote: > > 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). > > Thanks, Mike, but when I try to build with that on debian unstable, I > get the attached, so I'd rather defer this one until after the > release.
looks like need to define HAVE_PCRE_H manually. no idea why it built on my system. must have had stale files or something. updated patch attached. sure, np letting it bake in master -mike
signature.asc
Description: This is a digitally signed message part.
>From a54bc1e4428388f5a8968e223bd7e1f9f2fbf41a Mon Sep 17 00:00:00 2001 From: Mike Frysinger <vap...@gentoo.org> Date: Fri, 14 Feb 2014 17:06:03 -0500 Subject: [PATCH] search for pcre via pkg-config 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 | 43 +++++++++++++++++++++++++++---------------- src/Makefile.am | 4 ++-- 3 files changed, 31 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..0be75f3 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,34 @@ 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 + AC_DEFINE([HAVE_PCRE_H], [1], [pcre.h is available]) + ], [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.5