diff --git a/configure b/configure
index 6d6a76223c..11ccbe970f 100755
--- a/configure
+++ b/configure
@@ -703,8 +703,10 @@ GREP
with_zlib
with_system_tzdata
with_libxslt
-with_libxml
+XML2_LIBS
+XML2_CFLAGS
XML2_CONFIG
+with_libxml
UUID_EXTRA_OBJS
with_uuid
with_systemd
@@ -719,13 +721,13 @@ with_perl
with_tcl
ICU_LIBS
ICU_CFLAGS
-PKG_CONFIG_LIBDIR
-PKG_CONFIG_PATH
-PKG_CONFIG
with_icu
enable_thread_safety
INCLUDES
autodepend
+PKG_CONFIG_LIBDIR
+PKG_CONFIG_PATH
+PKG_CONFIG
TAS
GCC
CPP
@@ -890,6 +892,9 @@ PKG_CONFIG_PATH
PKG_CONFIG_LIBDIR
ICU_CFLAGS
ICU_LIBS
+XML2_CONFIG
+XML2_CFLAGS
+XML2_LIBS
LDFLAGS_EX
LDFLAGS_SL'
@@ -1590,6 +1595,9 @@ Some influential environment variables:
path overriding pkg-config's built-in search path
ICU_CFLAGS C compiler flags for ICU, overriding pkg-config
ICU_LIBS linker flags for ICU, overriding pkg-config
+ XML2_CONFIG path to xml2-config utility
+ XML2_CFLAGS C compiler flags for XML2, overriding pkg-config
+ XML2_LIBS linker flags for XML2, overriding pkg-config
LDFLAGS_EX extra linker flags for linking executables only
LDFLAGS_SL extra linker flags for linking shared libraries only
@@ -6930,6 +6938,129 @@ else
fi
+#
+# Set up pkg_config in case we need it below
+#
+
+
+
+
+
+
+
+if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
+ if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}pkg-config", so it can be a program name with args.
+set dummy ${ac_tool_prefix}pkg-config; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_path_PKG_CONFIG+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ case $PKG_CONFIG in
+ [\\/]* | ?:[\\/]*)
+ ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path.
+ ;;
+ *)
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+ ;;
+esac
+fi
+PKG_CONFIG=$ac_cv_path_PKG_CONFIG
+if test -n "$PKG_CONFIG"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PKG_CONFIG" >&5
+$as_echo "$PKG_CONFIG" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_path_PKG_CONFIG"; then
+ ac_pt_PKG_CONFIG=$PKG_CONFIG
+ # Extract the first word of "pkg-config", so it can be a program name with args.
+set dummy pkg-config; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_path_ac_pt_PKG_CONFIG+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ case $ac_pt_PKG_CONFIG in
+ [\\/]* | ?:[\\/]*)
+ ac_cv_path_ac_pt_PKG_CONFIG="$ac_pt_PKG_CONFIG" # Let the user override the test with a path.
+ ;;
+ *)
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_path_ac_pt_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+ ;;
+esac
+fi
+ac_pt_PKG_CONFIG=$ac_cv_path_ac_pt_PKG_CONFIG
+if test -n "$ac_pt_PKG_CONFIG"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_pt_PKG_CONFIG" >&5
+$as_echo "$ac_pt_PKG_CONFIG" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+ if test "x$ac_pt_PKG_CONFIG" = x; then
+ PKG_CONFIG=""
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+ PKG_CONFIG=$ac_pt_PKG_CONFIG
+ fi
+else
+ PKG_CONFIG="$ac_cv_path_PKG_CONFIG"
+fi
+
+fi
+if test -n "$PKG_CONFIG"; then
+ _pkg_min_version=0.9.0
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking pkg-config is at least version $_pkg_min_version" >&5
+$as_echo_n "checking pkg-config is at least version $_pkg_min_version... " >&6; }
+ if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+ else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+ PKG_CONFIG=""
+ fi
+fi
#
# Automatic dependency tracking
@@ -7098,126 +7229,6 @@ $as_echo "$with_icu" >&6; }
if test "$with_icu" = yes; then
-
-
-
-
-
-
-if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
- if test -n "$ac_tool_prefix"; then
- # Extract the first word of "${ac_tool_prefix}pkg-config", so it can be a program name with args.
-set dummy ${ac_tool_prefix}pkg-config; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_path_PKG_CONFIG+:} false; then :
- $as_echo_n "(cached) " >&6
-else
- case $PKG_CONFIG in
- [\\/]* | ?:[\\/]*)
- ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path.
- ;;
- *)
- as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
- IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- for ac_exec_ext in '' $ac_executable_extensions; do
- if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
- ac_cv_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext"
- $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
- break 2
- fi
-done
- done
-IFS=$as_save_IFS
-
- ;;
-esac
-fi
-PKG_CONFIG=$ac_cv_path_PKG_CONFIG
-if test -n "$PKG_CONFIG"; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PKG_CONFIG" >&5
-$as_echo "$PKG_CONFIG" >&6; }
-else
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-
-fi
-if test -z "$ac_cv_path_PKG_CONFIG"; then
- ac_pt_PKG_CONFIG=$PKG_CONFIG
- # Extract the first word of "pkg-config", so it can be a program name with args.
-set dummy pkg-config; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_path_ac_pt_PKG_CONFIG+:} false; then :
- $as_echo_n "(cached) " >&6
-else
- case $ac_pt_PKG_CONFIG in
- [\\/]* | ?:[\\/]*)
- ac_cv_path_ac_pt_PKG_CONFIG="$ac_pt_PKG_CONFIG" # Let the user override the test with a path.
- ;;
- *)
- as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
- IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- for ac_exec_ext in '' $ac_executable_extensions; do
- if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
- ac_cv_path_ac_pt_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext"
- $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
- break 2
- fi
-done
- done
-IFS=$as_save_IFS
-
- ;;
-esac
-fi
-ac_pt_PKG_CONFIG=$ac_cv_path_ac_pt_PKG_CONFIG
-if test -n "$ac_pt_PKG_CONFIG"; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_pt_PKG_CONFIG" >&5
-$as_echo "$ac_pt_PKG_CONFIG" >&6; }
-else
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
- if test "x$ac_pt_PKG_CONFIG" = x; then
- PKG_CONFIG=""
- else
- case $cross_compiling:$ac_tool_warned in
-yes:)
-{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
-$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
-ac_tool_warned=yes ;;
-esac
- PKG_CONFIG=$ac_pt_PKG_CONFIG
- fi
-else
- PKG_CONFIG="$ac_cv_path_PKG_CONFIG"
-fi
-
-fi
-if test -n "$PKG_CONFIG"; then
- _pkg_min_version=0.9.0
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking pkg-config is at least version $_pkg_min_version" >&5
-$as_echo_n "checking pkg-config is at least version $_pkg_min_version... " >&6; }
- if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-$as_echo "yes" >&6; }
- else
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
- PKG_CONFIG=""
- fi
-fi
-
pkg_failed=no
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for icu-uc icu-i18n" >&5
$as_echo_n "checking for icu-uc icu-i18n... " >&6; }
@@ -7909,6 +7920,8 @@ fi
#
# XML
#
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build with XML support" >&5
+$as_echo_n "checking whether to build with XML support... " >&6; }
@@ -7935,9 +7948,89 @@ else
fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $with_libxml" >&5
+$as_echo "$with_libxml" >&6; }
+
if test "$with_libxml" = yes ; then
- if test -z "$XML2_CONFIG"; then
+ # Check pkg-config, then xml2-config. But for backwards compatibility,
+ # setting XML2_CONFIG overrides pkg-config.
+ have_libxml2_pkg_config=no
+ if test -z "$XML2_CONFIG" -a -n "$PKG_CONFIG"; then
+
+pkg_failed=no
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for libxml-2.0 >= 2.6.23" >&5
+$as_echo_n "checking for libxml-2.0 >= 2.6.23... " >&6; }
+
+if test -n "$XML2_CFLAGS"; then
+ pkg_cv_XML2_CFLAGS="$XML2_CFLAGS"
+ elif test -n "$PKG_CONFIG"; then
+ if test -n "$PKG_CONFIG" && \
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libxml-2.0 >= 2.6.23\""; } >&5
+ ($PKG_CONFIG --exists --print-errors "libxml-2.0 >= 2.6.23") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }; then
+ pkg_cv_XML2_CFLAGS=`$PKG_CONFIG --cflags "libxml-2.0 >= 2.6.23" 2>/dev/null`
+ test "x$?" != "x0" && pkg_failed=yes
+else
+ pkg_failed=yes
+fi
+ else
+ pkg_failed=untried
+fi
+if test -n "$XML2_LIBS"; then
+ pkg_cv_XML2_LIBS="$XML2_LIBS"
+ elif test -n "$PKG_CONFIG"; then
+ if test -n "$PKG_CONFIG" && \
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libxml-2.0 >= 2.6.23\""; } >&5
+ ($PKG_CONFIG --exists --print-errors "libxml-2.0 >= 2.6.23") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }; then
+ pkg_cv_XML2_LIBS=`$PKG_CONFIG --libs "libxml-2.0 >= 2.6.23" 2>/dev/null`
+ test "x$?" != "x0" && pkg_failed=yes
+else
+ pkg_failed=yes
+fi
+ else
+ pkg_failed=untried
+fi
+
+
+
+if test $pkg_failed = yes; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+
+if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
+ _pkg_short_errors_supported=yes
+else
+ _pkg_short_errors_supported=no
+fi
+ if test $_pkg_short_errors_supported = yes; then
+ XML2_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "libxml-2.0 >= 2.6.23" 2>&1`
+ else
+ XML2_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "libxml-2.0 >= 2.6.23" 2>&1`
+ fi
+ # Put the nasty error message in config.log where it belongs
+ echo "$XML2_PKG_ERRORS" >&5
+
+ # do nothing
+elif test $pkg_failed = untried; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+ # do nothing
+else
+ XML2_CFLAGS=$pkg_cv_XML2_CFLAGS
+ XML2_LIBS=$pkg_cv_XML2_LIBS
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+ have_libxml2_pkg_config=yes
+fi
+ fi
+ if test "$have_libxml2_pkg_config" = no ; then
+ if test -z "$XML2_CONFIG"; then
for ac_prog in xml2-config
do
# Extract the first word of "$ac_prog", so it can be a program name with args.
@@ -7991,22 +8084,25 @@ $as_echo_n "checking for XML2_CONFIG... " >&6; }
$as_echo "$XML2_CONFIG" >&6; }
fi
- 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
+ if test -n "$XML2_CONFIG"; then
+ XML2_CFLAGS=`$XML2_CONFIG --cflags`
+ XML2_LIBS=`$XML2_CONFIG --libs`
+ fi
fi
+ # Note the user could also set XML2_CFLAGS/XML2_LIBS directly
+ for pgac_option in $XML2_CFLAGS; do
+ case $pgac_option in
+ -I*|-D*) CPPFLAGS="$CPPFLAGS $pgac_option";;
+ esac
+ done
+ for pgac_option in $XML2_LIBS; do
+ case $pgac_option in
+ -L*) LDFLAGS="$LDFLAGS $pgac_option";;
+ esac
+ done
fi
-
#
# XSLT
#
diff --git a/configure.in b/configure.in
index 5d952fb78c..3d54db6bd7 100644
--- a/configure.in
+++ b/configure.in
@@ -652,6 +652,10 @@ else
fi
AC_SUBST(TAS)
+#
+# Set up pkg_config in case we need it below
+#
+PKG_PROG_PKG_CONFIG
#
# Automatic dependency tracking
@@ -911,26 +915,41 @@ AC_SUBST(UUID_EXTRA_OBJS)
#
# XML
#
+AC_MSG_CHECKING([whether to build with XML support])
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)])])
+AC_MSG_RESULT([$with_libxml])
+AC_SUBST(with_libxml)
if test "$with_libxml" = yes ; then
- PGAC_PATH_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
+ # Check pkg-config, then xml2-config. But for backwards compatibility,
+ # setting XML2_CONFIG overrides pkg-config.
+ AC_ARG_VAR(XML2_CONFIG, [path to xml2-config utility])dnl
+ have_libxml2_pkg_config=no
+ if test -z "$XML2_CONFIG" -a -n "$PKG_CONFIG"; then
+ PKG_CHECK_MODULES(XML2, [libxml-2.0 >= 2.6.23],
+ [have_libxml2_pkg_config=yes], [# do nothing])
fi
+ if test "$have_libxml2_pkg_config" = no ; then
+ PGAC_PATH_PROGS(XML2_CONFIG, xml2-config)
+ if test -n "$XML2_CONFIG"; then
+ XML2_CFLAGS=`$XML2_CONFIG --cflags`
+ XML2_LIBS=`$XML2_CONFIG --libs`
+ fi
+ fi
+ # Note the user could also set XML2_CFLAGS/XML2_LIBS directly
+ for pgac_option in $XML2_CFLAGS; do
+ case $pgac_option in
+ -I*|-D*) CPPFLAGS="$CPPFLAGS $pgac_option";;
+ esac
+ done
+ for pgac_option in $XML2_LIBS; do
+ case $pgac_option in
+ -L*) LDFLAGS="$LDFLAGS $pgac_option";;
+ esac
+ done
fi
-AC_SUBST(with_libxml)
#
# XSLT
diff --git a/doc/src/sgml/installation.sgml b/doc/src/sgml/installation.sgml
index 8bcbee7537..061ca5d210 100644
--- a/doc/src/sgml/installation.sgml
+++ b/doc/src/sgml/installation.sgml
@@ -979,21 +979,31 @@ su - postgres
- Build with libxml (enables SQL/XML support). Libxml version 2.6.23 or
+ Build with libxml2, enabling SQL/XML support. Libxml2 version 2.6.23 or
later is required for this feature.
- 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
- XML2_CONFIG to point to the
- xml2-config program belonging to the
- installation, or use the options
- and
- .
+ To detect the required compiler and linker options, PostgreSQL will
+ query pkg-config, if that is installed and knows
+ about libxml2. Otherwise the program xml2-config,
+ which is installed by libxml2, will be used if it is found. Use
+ of pkg-config is preferred, because it can deal
+ with multi-architecture installations better.
+
+
+
+ To use a libxml2 installation that is in an unusual location, you
+ can 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 libxml2
+ installation, or set the variables XML2_CFLAGS
+ and XML2_LIBS. (If pkg-config is
+ installed, then to override its idea of where libxml2 is you must
+ either set XML2_CONFIG or set
+ both XML2_CFLAGS and XML2_LIBS to
+ nonempty strings.)
@@ -1539,7 +1549,7 @@ su - postgres
xml2-config program used to locate the
- libxml installation.
+ libxml2 installation