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?)