Re: [PATCH] Use PKG_CHECK_MODULES to detect the libxml2 library

From: Hugh McMaster <hugh(dot)mcmaster(at)outlook(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Daniel Gustafsson <daniel(at)yesql(dot)se>, Peter Eisentraut <peter(dot)eisentraut(at)2ndquadrant(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: [PATCH] Use PKG_CHECK_MODULES to detect the libxml2 library
Date: 2020-03-13 12:26:03
Message-ID: CAN9BcdtUqgaaMiRwgOed-XnjDFhopqbKHJMEZ+6oTnmkMbr6mg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, 13 Mar 2020 at 03:39, Tom Lane wrote:
> I poked at this issue a bit more and realized that Hugh's patch
> flat-out breaks building --with-libxml in environments without
> pkg-config, because PKG_CHECK_MODULES just gives up and dies
> if there's no pkg-config (as we'd already found out in connection
> with ICU).

As you found out, that is by design. PKG_CHECK_MODULES actually checks
for pkg-config via PKG_PROG_PKG_CONFIG, but only in the first
expansion of PKG_CHECK_MODULES. If the first instance is in a
conditional, then the check for pkg-config is also in that
conditional. Once a build system begins using pkg-config without a
fallback (e.g. like for ICU), pkg-config becomes a build dependency
(and, yes, I realise ICU isn't mandatory here).

That won't win us any friends, so the attached revision
> doesn't call PKG_CHECK_MODULES unless we found pkg-config.

Did you mean to terminate configure if pkg-config cannot find
libxml-2.0 or the library is too old? Your doc changes don't indicate
that intent, nor was it prior behaviour, but some projects like that
behaviour and others don't.

> I also concluded that if the user has set XML2_CONFIG, it's pretty clear
> that her intent is to use whatever that is pointing at, so we should
> not use pkg-config in that case either.
>
> Also, I'd been going back and forth about whether it was worth
> documenting XML2_CFLAGS/XML2_LIBS, but I realized that use of
> PKG_CHECK_MODULES(XML2, ...) basically forces the issue for us:
> it does AC_ARG_VAR on them, which puts them into configure's
> --help output and makes configure picky about caching them.
> So we can't really pretend they're boring implementation detail.

You might consider this an edge case, but you override custom
XML2_CFLAGS/LIBS if xml2-config is detected.

> So the attached mostly adopts Peter's old suggested docs, but
> I added discussion of XML2_CFLAGS/XML2_LIBS and dropped the mention
> of forcing matters with --with-libs/--with-libraries (not because
> that doesn't work anymore but because it seemed like we were offering
> quite enough alternatives already).
>
> I'd originally thought that we might back-patch this, but I'm now of
> the opinion that we probably should not. If pkg-config is present,
> this can change the default behavior about where we get libxml from,
> which seems like something not to do in minor releases. (OTOH, it'd
> only matter if the default pkg-config choice is different from the
> default xml2-config choice, so maybe the risk of breakage is small
> enough to be acceptable?)

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Eisentraut 2020-03-13 12:32:27 Re: Restore replication settings when modifying a field type
Previous Message Laurenz Albe 2020-03-13 12:07:52 Re: Berserk Autovacuum (let's save next Mandrill)