[postgis-devel] Using pkg-config for PROJ

Even Rouault even.rouault at spatialys.com
Sat Feb 9 11:35:44 PST 2019


On samedi 9 février 2019 20:06:28 CET Sandro Santilli wrote:
> On Fri, Feb 08, 2019 at 08:47:49PM +0100, Raúl Marín Rodríguez wrote:
> > Hi,
> > 
> > I started doing it in https://github.com/postgis/postgis/pull/372.
> > Then I noticed that `json-c` had the same option (and we weren't
> > including its files correctly) and, after that, that the same happens
> > with `libpcre` and `cunit`.
> > 
> > Wouldn't it make more sense to drop those 4 options (`--with-projdir`,
> > `--with-jsondir`, etc) and make pkg-config mandatory instead? My only
> > concern is Windows, which I don't really know if it can use it.
> 
> -1 from me. It's more flexible to have the ability to force other
> dirs, could be used for cross compiling (I've heard) and for user-only
> builds (when you don't have control of system directories).

You can just set PKG_CONFIG_PATH to point to your custom
$(install_prefix)/share/pkgconfig directory

And the generated code for PKG_CHECK_MODULES allows to manually set 
environment variables

e.g PROJ master configure.ac as

PKG_CHECK_MODULES([SQLITE3], [sqlite3 >= 3.7])

and ./configure --help shows that this automatigically causes the following 
ebvironment variables to be taken into account:

  SQLITE3_CFLAGS
              C compiler flags for SQLITE3, overriding pkg-config
  SQLITE3_LIBS
              linker flags for SQLITE3, overriding pkg-config

So requiring pkg-config is a non-issue and has the same flexibility as 
manually defining the include and libs variable

See
https://github.com/OSGeo/proj.4/blob/master/m4/pkg.m4#L104

Even

-- 
Spatialys - Geospatial professional services
http://www.spatialys.com


More information about the postgis-devel mailing list