From 47d0d4c331d45fcb1115c97fca1246a1202cfc14 Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Mon, 27 Oct 2014 14:55:23 -0400 Subject: [PATCH] use pkg-config to check pcre deps if available 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. --- ChangeLog | 3 +++ configure.ac | 25 ++++++++++++++++++------- 2 files changed, 21 insertions(+), 7 deletions(-) diff --git a/ChangeLog b/ChangeLog index 3475f6f0..42a096a8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -6,6 +6,9 @@ * configure.ac: Use pkg-config to check for libuuid presence and fallback to the previous code if that doesn't work. + * configure.ac: Use pkg-config to check for pcre presence and + fallback to the previous code if that doesn't work. + 2014-07-28 Ángel González * contrib: Created contrib folder. * contrib/tsocked-wget: Added wrapper for usage with socks proxy. diff --git a/configure.ac b/configure.ac index ad88c597..1b5407dc 100644 --- a/configure.ac +++ b/configure.ac @@ -600,13 +600,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