bug-wget
[Top][All Lists]
Advanced

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

[Bug-wget] [PATCH 3/5] use pkg-config to check pcre deps if available


From: Mike Frysinger
Subject: [Bug-wget] [PATCH 3/5] use pkg-config to check pcre deps if available
Date: Mon, 27 Oct 2014 14:55:23 -0400

Newer versions of these packages ship with pkg-config files, so if we can
detect it via those, do so.  If that fails, fall back to the old methods.

Also add a configure flag to explicitly control its usage.
---
 configure.ac | 25 ++++++++++++++++++-------
 1 file changed, 18 insertions(+), 7 deletions(-)

diff --git a/configure.ac b/configure.ac
index a5fb67d..8d2050e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -581,13 +581,24 @@ dnl
 dnl Check for PCRE
 dnl
 
-AC_CHECK_HEADER(pcre.h,
-                AC_CHECK_LIB(pcre, pcre_compile,
-                  [LIBS="${LIBS} -lpcre"
-                   AC_DEFINE([HAVE_LIBPCRE], 1,
-                             [Define if libpcre is available.])
-                  ])
-)
+AC_ARG_ENABLE(pcre, AC_HELP_STRING([--disable-pcre],
+                                   [Disable PCRE style regular expressions]))
+
+AS_IF([test "X$enable_pcre" != "Xno"],[
+  PKG_CHECK_MODULES([PCRE], libpcre, [
+    LIBS="$PCRE_LIBS $LIBS"
+    CFLAGS="$PCRE_CFLAGS $CFLAGS"
+    AC_DEFINE([HAVE_LIBPCRE], [1], [Define if using libpcre.])
+  ], [
+    AC_CHECK_HEADER(pcre.h,
+                    AC_CHECK_LIB(pcre, pcre_compile,
+                      [LIBS="${LIBS} -lpcre"
+                       AC_DEFINE([HAVE_LIBPCRE], 1,
+                                 [Define if libpcre is available.])
+                      ])
+    )
+  ])
+])
 
 
 dnl Needed by src/Makefile.am
-- 
2.1.2




reply via email to

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