blob: cc1a9f0585c6dd7e9a9c44d4bcfa1d35d044b356 [file] [log] [blame]
From 39edb8ef08f51ea6a454d286091d78a4514c89e0 Mon Sep 17 00:00:00 2001
From: Fabrice Fontaine <fontaine.fabrice@gmail.com>
Date: Sat, 1 Dec 2018 18:21:55 +0100
Subject: [PATCH] configure.ac: use pkg-config to find libxml2
Fix static build of squid with libxml2 by using pkg-config to find
libxml2 dependencies like -lz or -liconv
Fixes:
- http://autobuild.buildroot.org/results/7f23eb98c311b294c7f0e165279fa26909a5ff93
Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
[Upstream status: https://github.com/squid-cache/squid/pull/338]
---
configure.ac | 43 +++++++++++++++++++++++++------------------
1 file changed, 25 insertions(+), 18 deletions(-)
diff --git a/configure.ac b/configure.ac
index f30d824aa..47553db46 100644
--- a/configure.ac
+++ b/configure.ac
@@ -900,29 +900,36 @@ fi
AC_ARG_WITH(libxml2, AS_HELP_STRING([--without-libxml2],[Do not use libxml2 for ESI. Default: auto-detect]))
if test "x$squid_opt_use_esi" != "xno" -a "x$with_libxml2" != "xno" ; then
- AC_CHECK_LIB([xml2], [main], [XMLLIB="-lxml2"; HAVE_LIBXML2=1])
- dnl Find the main header and include path...
- AC_CACHE_CHECK([location of libxml2 include files], [ac_cv_libxml2_include], [
- AC_CHECK_HEADERS([libxml/parser.h], [], [
- AC_MSG_NOTICE([Testing in /usr/include/libxml2])
- SAVED_CPPFLAGS="$CPPFLAGS"
- CPPFLAGS="-I/usr/include/libxml2 $CPPFLAGS"
- unset ac_cv_header_libxml_parser_h
- AC_CHECK_HEADERS([libxml/parser.h], [ac_cv_libxml2_include="-I/usr/include/libxml2"], [
- AC_MSG_NOTICE([Testing in /usr/local/include/libxml2])
- CPPFLAGS="-I/usr/local/include/libxml2 $SAVED_CPPFLAGS"
+ PKG_CHECK_MODULES([LIBXML2],[libxml-2.0],[
+ CPPFLAGS="$CPPFLAGS $LIBXML2_CFLAGS";
+ SQUID_CXXFLAGS="$SQUID_CXXFLAGS $LIBXML2_CFLAGS";
+ XMLLIB="$LIBXML2_LIBS";
+ HAVE_LIBXML2=1
+ ],[
+ AC_CHECK_LIB([xml2], [main], [XMLLIB="-lxml2"; HAVE_LIBXML2=1])
+ dnl Find the main header and include path...
+ AC_CACHE_CHECK([location of libxml2 include files], [ac_cv_libxml2_include], [
+ AC_CHECK_HEADERS([libxml/parser.h], [], [
+ AC_MSG_NOTICE([Testing in /usr/include/libxml2])
+ SAVED_CPPFLAGS="$CPPFLAGS"
+ CPPFLAGS="-I/usr/include/libxml2 $CPPFLAGS"
unset ac_cv_header_libxml_parser_h
- AC_CHECK_HEADERS([libxml/parser.h], [ac_cv_libxml2_include="-I/usr/local/include/libxml2"], [
- AC_MSG_NOTICE([Failed to find libxml2 header file libxml/parser.h])
+ AC_CHECK_HEADERS([libxml/parser.h], [ac_cv_libxml2_include="-I/usr/include/libxml2"], [
+ AC_MSG_NOTICE([Testing in /usr/local/include/libxml2])
+ CPPFLAGS="-I/usr/local/include/libxml2 $SAVED_CPPFLAGS"
+ unset ac_cv_header_libxml_parser_h
+ AC_CHECK_HEADERS([libxml/parser.h], [ac_cv_libxml2_include="-I/usr/local/include/libxml2"], [
+ AC_MSG_NOTICE([Failed to find libxml2 header file libxml/parser.h])
+ ])
])
+ CPPFLAGS="$SAVED_CPPFLAGS"
])
- CPPFLAGS="$SAVED_CPPFLAGS"
])
+ if test "x$ac_cv_libxml2_include" != "x"; then
+ SQUID_CXXFLAGS="$ac_cv_libxml2_include $SQUID_CXXFLAGS"
+ CPPFLAGS="$ac_cv_libxml2_include $CPPFLAGS"
+ fi
])
- if test "x$ac_cv_libxml2_include" != "x"; then
- SQUID_CXXFLAGS="$ac_cv_libxml2_include $SQUID_CXXFLAGS"
- CPPFLAGS="$ac_cv_libxml2_include $CPPFLAGS"
- fi
dnl Now that we know where to look find the headers...
AC_CHECK_HEADERS(libxml/parser.h libxml/HTMLparser.h libxml/HTMLtree.h)
AC_DEFINE_UNQUOTED(HAVE_LIBXML2, $HAVE_LIBXML2, [Define to 1 if you have the libxml2 library])
--
2.17.1