summaryrefslogtreecommitdiffstats
path: root/package/squid/0001-configure.ac-use-pkg-config-to-find-libxml2.patch
blob: cc1a9f0585c6dd7e9a9c44d4bcfa1d35d044b356 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
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

OpenPOWER on IntegriCloud