diff --git a/configure.in b/configure.in index f31f7ef..81ac837 100644 --- a/configure.in +++ b/configure.in @@ -706,18 +706,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 - AC_CHECK_PROGS(XML2_CONFIG, xml2-config) - if test -n "$XML2_CONFIG"; then - for pgac_option in `$XML2_CONFIG --cflags`; do - case $pgac_option in - -I*|-D*) CPPFLAGS="$CPPFLAGS $pgac_option";; - esac - done - for pgac_option in `$XML2_CONFIG --libs`; do - case $pgac_option in - -L*) LDFLAGS="$LDFLAGS $pgac_option";; - esac - done + AC_CHECK_PROGS(PKG_CONFIG, pkg-config) + if test -n "$PKG_CONFIG" && $PKG_CONFIG --exists libxml-2.0; then + CPPFLAGS="$CPPFLAGS "`$PKG_CONFIG libxml-2.0 --cflags-only-I` + LDFLAGS="$LDFLAGS "`$PKG_CONFIG libxml-2.0 --libs-only-L` + else + AC_CHECK_PROGS(XML2_CONFIG, xml2-config) + if test -n "$XML2_CONFIG"; then + for pgac_option in `$XML2_CONFIG --cflags`; do + case $pgac_option in + -I*|-D*) CPPFLAGS="$CPPFLAGS $pgac_option";; + esac + done + for pgac_option in `$XML2_CONFIG --libs`; do + case $pgac_option in + -L*) LDFLAGS="$LDFLAGS $pgac_option";; + esac + done + fi fi fi diff --git a/doc/src/sgml/installation.sgml b/doc/src/sgml/installation.sgml index 22e6cf1..09c1d09 100644 --- a/doc/src/sgml/installation.sgml +++ b/doc/src/sgml/installation.sgml @@ -892,11 +892,18 @@ Configuration - Libxml installs a program xml2-config that - can be used to detect the required compiler and linker - options. PostgreSQL will use it automatically if found. To - specify a libxml installation at an unusual location, you can - either set the environment variable + To detect the required compiler and linker options, PostgreSQL will + query pkg-config, if it is installed and knows + about libxml2. Otherwise the program xml2-config, + which is installed by libxml, will be used if it is found. Use + of pkg-config is preferred, because it can deal + with multi-arch installations better. + + + + To specify a libxml installation at an unusual location, you can + either set pkg-config-related environment variables + (see its documentation), or set the environment variable XML2_CONFIG to point to the xml2-config program belonging to the installation, or use the options