1From 5c4d6d8538994d5fe9b3b46bfafaf0a605e3bda6 Mon Sep 17 00:00:00 2001
2From: Koen Kooi <koen.kooi@linaro.org>
3Date: Tue, 17 Jun 2014 08:18:17 +0200
4Subject: [PATCH] configure: use pkg-config for pcre detection
5
6Signed-off-by: Koen Kooi <koen.kooi@linaro.org>
7Upstream-Status: Pending
8---
9 configure.ac | 38 +++++++-------------------------------
10 1 file changed, 7 insertions(+), 31 deletions(-)
11
12--- a/configure.ac
13+++ b/configure.ac
14@@ -52,38 +52,14 @@ AC_MSG_RESULT([$with_pcre])
15
16 dnl To make configuring easier, check for a locally built PCRE using the Tools/pcre-build.sh script
17 if test x"${with_pcre}" = xyes ; then
18-  AC_MSG_CHECKING([whether to use local PCRE])
19-  local_pcre_config=no
20-  if test -z $PCRE_CONFIG; then
21-    if test -f `pwd`/pcre/pcre-swig-install/bin/pcre-config; then
22-      PCRE_CONFIG=`pwd`/pcre/pcre-swig-install/bin/pcre-config
23-      local_pcre_config=$PCRE_CONFIG
24-    fi
25-  fi
26-  AC_MSG_RESULT([$local_pcre_config])
27-fi
28-AS_IF([test "x$with_pcre" != xno],
29-  [AX_PATH_GENERIC([pcre],
30-    [], dnl Minimal version of PCRE we need -- accept any
31-    [], dnl custom sed script for version parsing is not needed
32-    [AC_DEFINE([HAVE_PCRE], [1], [Define if you have PCRE library])
33-     LIBS="$LIBS $PCRE_LIBS"
34-     CPPFLAGS="$CPPFLAGS $PCRE_CFLAGS"
35-    ],
36-    [AC_MSG_FAILURE([
37-        Cannot find pcre-config script from PCRE (Perl Compatible Regular Expressions)
38-        library package. This dependency is needed for configure to complete,
39-        Either:
40-        - Install the PCRE developer package on your system (preferred approach).
41-        - Download the PCRE source tarball, build and install on your system
42-          as you would for any package built from source distribution.
43-        - Use the Tools/pcre-build.sh script to build PCRE just for SWIG to statically
44-          link against. Run 'Tools/pcre-build.sh --help' for instructions.
45-          (quite easy and does not require privileges to install PCRE on your system)
46-        - Use configure --without-pcre to disable regular expressions support in SWIG
47-          (not recommended).])
48-    ])
49+  PKG_CHECK_MODULES([PCRE], [libpcre], [
50+    AC_DEFINE([HAVE_PCRE], [1], [Define if you have PCRE library])
51+    LIBS="$LIBS $PCRE_LIBS"
52+    CPPFLAGS="$CPPFLAGS $PCRE_CFLAGS"
53+  ], [
54+    AC_MSG_WARN([$PCRE_PKG_ERRORS])
55   ])
56+fi
57
58
59 dnl CCache
60