From 0692d02f5e04dede9a05f9bc3bac7bb6c91a9495 Mon Sep 17 00:00:00 2001 From: Hugh McMaster Date: Tue, 10 Mar 2020 21:33:45 +1100 Subject: [PATCH] Use PKG_CHECK_MODULES to find the libxml2 library If pkg-config is not available, fall back to xml2-config. --- configure.in | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/configure.in b/configure.in index 22f096a5ac..e74c0db6c6 100644 --- a/configure.in +++ b/configure.in @@ -927,15 +927,24 @@ PGAC_ARG_BOOL(with, libxml, no, [build with XML support], [AC_DEFINE([USE_LIBXML], 1, [Define to 1 to build with XML support. (--with-libxml)])]) if test "$with_libxml" = yes ; then - PGAC_PATH_PROGS(XML2_CONFIG, xml2-config) - AC_ARG_VAR(XML2_CONFIG, [path to xml2-config utility])dnl - if test -n "$XML2_CONFIG"; then - for pgac_option in `$XML2_CONFIG --cflags`; do + PKG_CHECK_MODULES([XML2], [libxml-2.0 >= 2.6.23], [have_libxml2="yes"], [have_libxml2="no"]) + if test "$have_libxml2" = "no"; then + PGAC_PATH_PROGS(XML2_CONFIG, xml2-config) + AC_ARG_VAR(XML2_CONFIG, [path to xml2-config utility])dnl + if test -n "$XML2_CONFIG"; then + XML2_CFLAGS=`$XML2_CONFIG --cflags` + XML2_LIBS=`$XML2_CONFIG --libs` + have_libxml2="yes" + fi + fi + + if test "$have_libxml2" = "yes"; then + for pgac_option in "$XML2_CFLAGS"; do case $pgac_option in -I*|-D*) CPPFLAGS="$CPPFLAGS $pgac_option";; esac done - for pgac_option in `$XML2_CONFIG --libs`; do + for pgac_option in "$XML2_LIBS"; do case $pgac_option in -L*) LDFLAGS="$LDFLAGS $pgac_option";; esac -- 2.25.1