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