summaryrefslogtreecommitdiffstats
path: root/src/external/libpcre.m4
diff options
context:
space:
mode:
authorLukas Slebodnik <lslebodn@redhat.com>2013-08-31 12:17:38 +0200
committerJakub Hrozek <jhrozek@redhat.com>2013-09-09 17:04:36 +0200
commite64a66e620aad51c1fada6138362c5a186af178a (patch)
tree91305d3db9f79cbdf8703217cb2b2d85363ab6cd /src/external/libpcre.m4
parent2ff2cc0d12b844c2e04ca6594c714ee3884c6351 (diff)
downloadsssd-e64a66e620aad51c1fada6138362c5a186af178a.tar.gz
sssd-e64a66e620aad51c1fada6138362c5a186af178a.tar.xz
sssd-e64a66e620aad51c1fada6138362c5a186af178a.zip
AUTOTOOLS: Use pkg-config to detect libraries.
We used pkg-config only as a fallback if header files was not found, but detection of library failed in case of available header file and linking problem (missing -Ldir). This patch prefers pkg-config.
Diffstat (limited to 'src/external/libpcre.m4')
-rw-r--r--src/external/libpcre.m414
1 files changed, 11 insertions, 3 deletions
diff --git a/src/external/libpcre.m4 b/src/external/libpcre.m4
index 5917c8cfd..8df860904 100644
--- a/src/external/libpcre.m4
+++ b/src/external/libpcre.m4
@@ -3,7 +3,7 @@ AC_SUBST(PCRE_OBJ)
AC_SUBST(PCRE_LIBS)
AC_SUBST(PCRE_CFLAGS)
-PKG_CHECK_MODULES(PCRE, libpcre)
+PKG_CHECK_MODULES([PCRE], [libpcre], [found_libpcre=yes], [found_libpcre=no])
PKG_CHECK_EXISTS(libpcre >= 7,
[AC_MSG_NOTICE([PCRE version is 7 or higher])],
[AC_MSG_NOTICE([PCRE version is below 7])
@@ -11,5 +11,13 @@ PKG_CHECK_EXISTS(libpcre >= 7,
1,
[Define if libpcre version is less than 7])])
-AC_CHECK_HEADERS(pcre.h)
-AC_CHECK_LIB(pcre, pcre_compile, [ PCRE_LIBS="-lpcre" ], [AC_MSG_ERROR([PCRE is required])])
+SSS_AC_EXPAND_LIB_DIR()
+AS_IF([test x"$found_libpcre" != xyes],
+ [AC_CHECK_HEADERS([pcre.h],
+ [AC_CHECK_LIB([pcre],
+ [pcre_compile],
+ [PCRE_LIBS="-L$sss_extra_libdir -lpcre"],
+ [AC_MSG_ERROR([No usable PCRE library found])],
+ [-L$sss_extra_libdir])],
+ [AC_MSG_ERROR([pcre header files are not installed])])]
+)