depot/third_party/nixpkgs/pkgs/tools/compression/xar/0002-Use-pkg-config-for-libxml2.patch
Default email ec92d4d331 Project import generated by Copybara.
GitOrigin-RevId: 540dccb2aeaffa9dc69bfdc41c55abd7ccc6baa3
2021-05-28 11:39:13 +02:00

89 lines
2.9 KiB
Diff

From 276833851657c85651c053ee16b8e1a8dc768a50 Mon Sep 17 00:00:00 2001
From: Andrew Childs <andrew.childs@bibo.com.ph>
Date: Sun, 15 Nov 2020 19:12:56 +0900
Subject: [PATCH 2/2] Use pkg-config for libxml2
---
configure.ac | 66 +++++++++-------------------------------------------
1 file changed, 11 insertions(+), 55 deletions(-)
diff --git a/configure.ac b/configure.ac
index 358ab89..984a694 100644
--- a/configure.ac
+++ b/configure.ac
@@ -268,61 +268,17 @@ dnl Configure libxml2.
dnl
LIBXML2_VERSION_MIN=2.6.11
-have_libxml2="1"
-
-AC_ARG_WITH([xml2-config], [ --with-xml2-config libxml2 config program],
-if test "x${with_xml2_config}" = "xno" ; then
- XML2_CONFIG=
-else
- XML2_CONFIG="${with_xml2_config}"
-fi
-,
- XML2_CONFIG=
-)
-if test "x${XML2_CONFIG}" != "x" ; then
- if test ! -x "${XML2_CONFIG}" ; then
- AC_MSG_ERROR([Unusable or missing xml2-config: ${XML2_CONFIG}])
- fi
-else
- AC_PATH_PROG([XML2_CONFIG], [xml2-config], , [${PATH}])
- if test "x${XML2_CONFIG}" = "x" ; then
- AC_MSG_ERROR([Cannot configure without xml2-config])
- fi
-fi
-
-dnl Make sure the version of libxml2 found is sufficient.
-AC_MSG_CHECKING([for libxml >= ${LIBXML2_VERSION_MIN}])
-LIBXML2_FOUND=`2>&1 ${XML2_CONFIG} --version`
-LIBXML2_MAJOR=`echo ${LIBXML2_FOUND} | tr . " " | awk '{print $1}'`
-LIBXML2_MINOR=`echo ${LIBXML2_FOUND} | tr . " " | awk '{print $2}' | tr a-z " " |awk '{print $1}'`
-LIBXML2_BRANCH=`echo ${LIBXML2_FOUND} | tr . " " | awk '{print $3}' | tr a-z " " |awk '{print $1}'`
-if test "x${LIBXML2_BRANCH}" = "x" ; then
- LIBXML2_BRANCH=0
-fi
-LIBXML2_MAJOR_MIN=`echo ${LIBXML2_VERSION_MIN} | tr . " " | awk '{print $1}'`
-LIBXML2_MINOR_MIN=`echo ${LIBXML2_VERSION_MIN} | tr . " " | awk '{print $2}'`
-LIBXML2_BRANCH_MIN=`echo ${LIBXML2_VERSION_MIN} | tr . " " | awk '{print $3}'`
-if test ${LIBXML2_MAJOR} -gt ${LIBXML2_MAJOR_MIN} \
- -o ${LIBXML2_MAJOR} -eq ${LIBXML2_MAJOR_MIN} \
- -a ${LIBXML2_MINOR} -gt ${LIBXML2_MINOR_MIN} \
- -o ${LIBXML2_MAJOR} -eq ${LIBXML2_MAJOR_MIN} \
- -a ${LIBXML2_MINOR} -eq ${LIBXML2_MINOR_MIN} \
- -a ${LIBXML2_BRANCH} -ge $LIBXML2_BRANCH_MIN ; then
- AC_MSG_RESULT([${LIBXML2_MAJOR}.${LIBXML2_MINOR}.${LIBXML2_BRANCH}])
- have_libxml2="1"
- CPPFLAGS="${CPPFLAGS} `${XML2_CONFIG} --cflags`"
- LIBS="${LIBS} `${XML2_CONFIG} --libs`"
-else
- AC_MSG_RESULT([no])
- have_libxml2="0"
-fi
-if test "x${have_libxml2}" = "x1" ; then
- dnl Final sanity check, to make sure that xmlwriter is present.
- AC_CHECK_HEADER([libxml/xmlwriter.h], , [have_libxml2="0"])
-fi
-if test "x${have_libxml2}" = "x0" ; then
- AC_MSG_ERROR([Cannot build without libxml2])
-fi
+PKG_PROG_PKG_CONFIG
+
+PKG_CHECK_MODULES(LIBXML2_PKGCONFIG, [libxml-2.0 >= ${LIBXML2_VERSION_MIN}],
+ [
+ have_libxml2=1
+ CPPFLAGS="${CPPFLAGS} ${LIBXML2_PKGCONFIG_CFLAGS}"
+ LIBS="${LIBS} ${LIBXML2_PKGCONFIG_LIBS}"
+ ],
+ [
+ have_libxml2=0
+ ])
dnl
dnl Configure libcrypto (part of OpenSSL).
--
2.28.0