Use pkg-config, if available, to locate libxml2 during configure

Enterprise / PostgreSQL - Tom Lane [] - 17 March 2020 16:09 EDT

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.


0bc8cebdb8 Use pkg-config, if available, to locate libxml2 during configure.
configure | 366 ++++++++++++++++++++++++++--------------- | 44 +++--
doc/src/sgml/installation.sgml | 34 ++--
3 files changed, 283 insertions(+), 161 deletions(-)


  • Share