[PATCH V3] configure.ac: Fallback to older detection code if pkg-config can't find expat

Peter Hutterer peter.hutterer at who-t.net
Tue Feb 3 14:29:21 PST 2015


On Tue, Feb 03, 2015 at 02:10:32PM -0800, Bill Spitzak wrote:
> 
> 
> On 02/03/2015 01:50 PM, Peter Hutterer wrote:
> >On Tue, Feb 03, 2015 at 12:33:35PM -0800, Bill Spitzak wrote:
> >>This paritally reverts commit a4afd90f9f0c27ed5f3f313b915c260673f8be34.
> >>
> >>On older expat versions (ie the one on Ubuntu 12.04) there is no pkg-config
> >>file, so fall back to a test for the header and library.
> >
> >hmm, this is the first time I read this paragraph: 12.04 is almost 2 years
> >old now, are there any more recent examples that need this patch? If not,
> >I'd recommend going with "install newer expat in your prefix" than
> >adding build system workarounds.
> 
> Any idea where it is? I can find a cvs repository on SourceForge. Would
> rather not add yet another dependency on using cvs! Is it on git somewhere
> or is this cvs the official version?
> 
> I could also just place a fake pkg-config file in the install directory.
> 
> Both of these would require updating the Ubuntu build directions page.
> 
> Both by previous employers are frozen at Ubuntu 12.04, I don't think this is
> uncommon. The earlier one had finally updated from a 5 year old system from
> SUSE.

http://expat.sourceforge.net indicates the CVS repository is the upstream
repo. Also, it looks like the pkgconfig file was added in 2007, talk about a
slow release cycle...

> >that looks correct, but the ,, almost caught me and the nesting is a bit
> >hard to read. How about:
> >
> >PKG_CHECK_MODULES(EXPAT, [expat], HAVE_EXPAT="yes", HAVE_EXPAT="no")
> >if test x$HAVE_EXPAT = "xno"; then
> >         AC_CHECK_HEADERS
> >         ...
> >         AC_SEARCH_LIBS
> >         ...
> >         AC_SUBST # I think you should have it explicitly here
> >fi
> 
> I find that much harder to read because of the unreadability of binary tests
> in M4 and reliance on an intermediate variable. Also it makes it harder to
> remove the fallback code in the future. But I think I can get rid of the
> double commas, though they are used elsewhere.

the thing here is that this is what a lot of projects use, so most
developers are used to exactly that control sequence. Which makes it safer
to use than any other solution where one actually has to switch the brain on
to parse what it's doing ;)

Note that weston already uses this sequence (in slight variations) for rdp,
with-cairo, wedp, libva, libjpeg, etc.
So please go with a simple solution that's already in use, it makes life a
lot easier for everyone else. configure scripts should not the be a
target for optimization, readability is king here.

Cheers,
   Peter


More information about the wayland-devel mailing list