Description: Use pkg-config to find libxml2
Author: Hugh McMaster <hugh.mcmaster@outlook.com>
Bug-Debian: https://bugs.debian.org/949088
Forwarded: https://github.com/comotion/cpm/pull/66
Last-Update: 2022-03-26

--- a/configure.in
+++ b/configure.in
@@ -14,6 +14,8 @@
 AC_PROG_LN_S
 AC_PROG_MAKE_SET
 
+PKG_PROG_PKG_CONFIG
+
 # Check --with-XXX configuration
 AC_ARG_WITH(curses-dir,
     [  --with-curses-dir=PATH  path to the curses installation],
@@ -346,23 +348,11 @@
 AC_SUBST(CDK_VERSION_DEF)
 AC_SUBST(CDK_DEBIAN_DEP)
 
+PKG_CHECK_MODULES([LIBXML], [libxml-2.0])
 
-# ------------------------------------------------------------------------------
-# libxml2 check from http://webcvs.kde.org/cgi-bin/cvsweb.cgi/kdelibs/kdoctools/configure.in.in?rev=1.38&content-type=text/x-cvsweb-markup
-
-AC_PATH_PROG([XML_CONFIG], [xml2-config])
-if test -z "$ac_cv_path_XML_CONFIG"; then
-  AC_MSG_ERROR([Could not find libxml2 anywhere.])
-fi
-
-LIBXML_LIBS="`$XML_CONFIG --libs`"
-LIBXML_CFLAGS="`$XML_CONFIG --cflags`"
-LIBXML_XMLLINT=`dirname $XML_CONFIG`"/xmllint"
-AC_SUBST(LIBXML_LIBS)
-AC_SUBST(LIBXML_CFLAGS)
+LIBXML_XMLLINT="$exec_prefix/bin/xmllint"
 AC_SUBST(LIBXML_XMLLINT)
 
-
 AC_PATH_PROG([GPGME_CONFIG], [gpgme-config])
 if test -z "$ac_cv_path_GPGME_CONFIG"; then
   AC_MSG_ERROR([Could not find gpgme anywhere.])
