blob: cfcbd8c73ae633dff1286a5585605e64b9affbfa [file] [log] [blame]
Andrew Geissler517393d2023-01-13 08:55:19 -06001From ffb785ed8d3cac3c28e014b1238d93e2bc1f0c01 Mon Sep 17 00:00:00 2001
Patrick Williamsc124f4f2015-09-15 14:41:29 -05002From: 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>
Andrew Geissler595f6302022-01-24 19:11:47 +00007Upstream-Status: Pending
Patrick Williamsc124f4f2015-09-15 14:41:29 -05008
Andrew Geissler517393d2023-01-13 08:55:19 -06009---
10 configure.ac | 39 +++++++--------------------------------
11 1 file changed, 7 insertions(+), 32 deletions(-)
12
13diff --git a/configure.ac b/configure.ac
14index f88004a..3a2b47c 100644
Patrick Williamsc124f4f2015-09-15 14:41:29 -050015--- a/configure.ac
16+++ b/configure.ac
Andrew Geissler517393d2023-01-13 08:55:19 -060017@@ -57,39 +57,14 @@ AC_MSG_RESULT([$with_pcre])
Patrick Williamsc124f4f2015-09-15 14:41:29 -050018
19 dnl To make configuring easier, check for a locally built PCRE using the Tools/pcre-build.sh script
20 if test x"${with_pcre}" = xyes ; then
Andrew Geissler517393d2023-01-13 08:55:19 -060021- AC_MSG_CHECKING([whether to use local PCRE2])
Patrick Williamsc124f4f2015-09-15 14:41:29 -050022- local_pcre_config=no
Andrew Geissler517393d2023-01-13 08:55:19 -060023- if test -z "$PCRE2_CONFIG"; then
24- if test -f `pwd`/pcre/pcre-swig-install/bin/pcre2-config; then
25- PCRE2_CONFIG=`pwd`/pcre/pcre-swig-install/bin/pcre2-config
26- local_pcre_config=$PCRE2_CONFIG
Patrick Williamsc124f4f2015-09-15 14:41:29 -050027- fi
28- fi
29- AC_MSG_RESULT([$local_pcre_config])
30-fi
31-AS_IF([test "x$with_pcre" != xno],
Andrew Geissler517393d2023-01-13 08:55:19 -060032- [AX_PATH_GENERIC([pcre2],
Patrick Williamsc124f4f2015-09-15 14:41:29 -050033- [], dnl Minimal version of PCRE we need -- accept any
34- [], dnl custom sed script for version parsing is not needed
Andrew Geissler517393d2023-01-13 08:55:19 -060035- [AC_DEFINE([HAVE_PCRE], [1], [Define if you have PCRE2 library])
36- LIBS="$LIBS $PCRE2_LIBS"
37- CPPFLAGS="$CPPFLAGS $PCRE2_CFLAGS"
Patrick Williamsc124f4f2015-09-15 14:41:29 -050038- ],
39- [AC_MSG_FAILURE([
Andrew Geissler517393d2023-01-13 08:55:19 -060040- Cannot find pcre2-config script from PCRE2 (Perl Compatible Regular Expressions)
Patrick Williamsc124f4f2015-09-15 14:41:29 -050041- library package. This dependency is needed for configure to complete,
42- Either:
Andrew Geissler517393d2023-01-13 08:55:19 -060043- - Install the PCRE2 developer package on your system (preferred approach).
44- - Download the PCRE2 source tarball, build and install on your system
Patrick Williamsc124f4f2015-09-15 14:41:29 -050045- as you would for any package built from source distribution.
Andrew Geissler517393d2023-01-13 08:55:19 -060046- - Use the Tools/pcre-build.sh script to build PCRE2 just for SWIG to statically
Patrick Williamsc124f4f2015-09-15 14:41:29 -050047- link against. Run 'Tools/pcre-build.sh --help' for instructions.
Andrew Geissler517393d2023-01-13 08:55:19 -060048- (quite easy and does not require privileges to install PCRE2 on your system)
Patrick Williamsc124f4f2015-09-15 14:41:29 -050049- - Use configure --without-pcre to disable regular expressions support in SWIG
50- (not recommended).])
Andrew Geissler517393d2023-01-13 08:55:19 -060051- ],
52- [],[],[--libs8])
53+ PKG_CHECK_MODULES([PCRE], [libpcre2], [
Patrick Williamsc124f4f2015-09-15 14:41:29 -050054+ AC_DEFINE([HAVE_PCRE], [1], [Define if you have PCRE library])
55+ LIBS="$LIBS $PCRE_LIBS"
56+ CPPFLAGS="$CPPFLAGS $PCRE_CFLAGS"
57+ ], [
58+ AC_MSG_WARN([$PCRE_PKG_ERRORS])
59 ])
60+fi
61
62
63 dnl CCache