pkg-config

Greg Troxel gdt at lexort.com
Mon Nov 20 16:16:48 PST 2023


Paul Ramsey <pramsey at cleverelephant.ca> writes:

> I am re-working the GEOS detection in the configure script a bit, and
> I have the following logic:

>From packaging experience, I find that pkg-config is the right answer,
as long as it is rich enough to do what is needed, and in these cases I
think it is.  pkg-config is a uniform interface.  It's popular enough
that all packaging systems have to support it, and once you have to have
it, not supporting other things is a simplicity win.   And, pkg-config
is cross friendly, because a host tool reads data from destdir, nad you
don't have to run programs in destdir even if they are scripts.

> if (geos-config provided)
>   use geos-config

It certainly makes sense to respect what the user asked for, if there is
a --with-geos arg.  But I would say that's an odd thing for a user to
want to do (e.g. a developer wanting to regression test with various
geos in various prefixes).  Great to support that; just noting it's odd.

>   if (pkg-config found)
>     use pkg-config
>   elseif (geos-config on path)
>     use geos-config
>   else
>     error cannot find geos

The big question is: do correct installs of all supported geos versions
install pkg-config?   My pkgsrc install of geos certainly does but I'm
on the latest release.  If you can tell someone with geos  and without a
.pc that their packaging/install is broken and they should fix it, and
feel ok about that, then yes this is good.

If there are non-broken geos installs that are missing a .pc, then I
think you need

>   if (pkg-config found) AND pkg-config --modversion geos
>     use pkg-config
>   elseif (geos-config on path)
>     use geos-config
>   else
>     error cannot find geos


More information about the postgis-devel mailing list