summaryrefslogtreecommitdiff
path: root/configure.in
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2020-03-17 12:09:27 -0400
committerTom Lane <tgl@sss.pgh.pa.us>2020-03-17 12:09:27 -0400
commitd67d7243f914f99bd1103f811efd320c987db2bc (patch)
tree77c4e7bd6cd5af9cc59e517f2bedfe6ad0bdcce0 /configure.in
parent5e4a0b7194b9b53eeedc718fde1430eb649b8b62 (diff)
Use pkg-config, if available, to locate libxml2 during configure.
If pkg-config is installed and knows about libxml2, use its information rather than asking xml2-config. Otherwise proceed as before. This patch allows "configure --with-libxml" to succeed on platforms that have pkg-config but not xml2-config, which is likely to soon become a typical situation. The old mechanism can be forced by setting XML2_CONFIG explicitly (hence, build processes that were already doing so will certainly not need adjustment). Also, it's now possible to set XML2_CFLAGS and XML2_LIBS explicitly to override both programs. There is a small risk of this breaking existing build processes, if there are multiple libxml2 installations on the machine and pkg-config disagrees with xml2-config about which to use. The only case where that seems really likely is if a builder has tried to select a non-default xml2-config by putting it early in his PATH rather than setting XML2_CONFIG. Plan to warn against that in the minor release notes. Back-patch to v10; before that we had no pkg-config infrastructure, and it doesn't seem worth adding it for this. Hugh McMaster and Tom Lane; Peter Eisentraut also made an earlier attempt at this, from which I lifted most of the docs changes. Discussion: https://postgr.es/m/CAN9BcdvfUwc9Yx5015bLH2TOiQ-M+t_NADBSPhMF7dZ=pLa_iw@mail.gmail.com
Diffstat (limited to 'configure.in')
-rw-r--r--configure.in45
1 files changed, 32 insertions, 13 deletions
diff --git a/configure.in b/configure.in
index 97e2c273f31..7fbaf8d0c9b 100644
--- a/configure.in
+++ b/configure.in
@@ -589,6 +589,10 @@ else
fi
AC_SUBST(TAS)
+#
+# Set up pkg_config in case we need it below
+#
+PKG_PROG_PKG_CONFIG
#
# Automatic dependency tracking
@@ -845,26 +849,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