1 From 276833851657c85651c053ee16b8e1a8dc768a50 Mon Sep 17 00:00:00 2001
2 From: Andrew Childs <andrew.childs@bibo.com.ph>
3 Date: Sun, 15 Nov 2020 19:12:56 +0900
4 Subject: [PATCH 2/2] Use pkg-config for libxml2
7 configure.ac | 66 +++++++++-------------------------------------------
8 1 file changed, 11 insertions(+), 55 deletions(-)
10 diff --git a/configure.ac b/configure.ac
11 index 358ab89..984a694 100644
14 @@ -268,61 +268,17 @@ dnl Configure libxml2.
16 LIBXML2_VERSION_MIN=2.6.11
20 -AC_ARG_WITH([xml2-config], [ --with-xml2-config libxml2 config program],
21 -if test "x${with_xml2_config}" = "xno" ; then
24 - XML2_CONFIG="${with_xml2_config}"
29 -if test "x${XML2_CONFIG}" != "x" ; then
30 - if test ! -x "${XML2_CONFIG}" ; then
31 - AC_MSG_ERROR([Unusable or missing xml2-config: ${XML2_CONFIG}])
34 - AC_PATH_PROG([XML2_CONFIG], [xml2-config], , [${PATH}])
35 - if test "x${XML2_CONFIG}" = "x" ; then
36 - AC_MSG_ERROR([Cannot configure without xml2-config])
40 -dnl Make sure the version of libxml2 found is sufficient.
41 -AC_MSG_CHECKING([for libxml >= ${LIBXML2_VERSION_MIN}])
42 -LIBXML2_FOUND=`2>&1 ${XML2_CONFIG} --version`
43 -LIBXML2_MAJOR=`echo ${LIBXML2_FOUND} | tr . " " | awk '{print $1}'`
44 -LIBXML2_MINOR=`echo ${LIBXML2_FOUND} | tr . " " | awk '{print $2}' | tr a-z " " |awk '{print $1}'`
45 -LIBXML2_BRANCH=`echo ${LIBXML2_FOUND} | tr . " " | awk '{print $3}' | tr a-z " " |awk '{print $1}'`
46 -if test "x${LIBXML2_BRANCH}" = "x" ; then
49 -LIBXML2_MAJOR_MIN=`echo ${LIBXML2_VERSION_MIN} | tr . " " | awk '{print $1}'`
50 -LIBXML2_MINOR_MIN=`echo ${LIBXML2_VERSION_MIN} | tr . " " | awk '{print $2}'`
51 -LIBXML2_BRANCH_MIN=`echo ${LIBXML2_VERSION_MIN} | tr . " " | awk '{print $3}'`
52 -if test ${LIBXML2_MAJOR} -gt ${LIBXML2_MAJOR_MIN} \
53 - -o ${LIBXML2_MAJOR} -eq ${LIBXML2_MAJOR_MIN} \
54 - -a ${LIBXML2_MINOR} -gt ${LIBXML2_MINOR_MIN} \
55 - -o ${LIBXML2_MAJOR} -eq ${LIBXML2_MAJOR_MIN} \
56 - -a ${LIBXML2_MINOR} -eq ${LIBXML2_MINOR_MIN} \
57 - -a ${LIBXML2_BRANCH} -ge $LIBXML2_BRANCH_MIN ; then
58 - AC_MSG_RESULT([${LIBXML2_MAJOR}.${LIBXML2_MINOR}.${LIBXML2_BRANCH}])
60 - CPPFLAGS="${CPPFLAGS} `${XML2_CONFIG} --cflags`"
61 - LIBS="${LIBS} `${XML2_CONFIG} --libs`"
66 -if test "x${have_libxml2}" = "x1" ; then
67 - dnl Final sanity check, to make sure that xmlwriter is present.
68 - AC_CHECK_HEADER([libxml/xmlwriter.h], , [have_libxml2="0"])
70 -if test "x${have_libxml2}" = "x0" ; then
71 - AC_MSG_ERROR([Cannot build without libxml2])
75 +PKG_CHECK_MODULES(LIBXML2_PKGCONFIG, [libxml-2.0 >= ${LIBXML2_VERSION_MIN}],
78 + CPPFLAGS="${CPPFLAGS} ${LIBXML2_PKGCONFIG_CFLAGS}"
79 + LIBS="${LIBS} ${LIBXML2_PKGCONFIG_LIBS}"
86 dnl Configure libcrypto (part of OpenSSL).