Opened 6 years ago

Closed 6 years ago

#4324 closed enhancement (fixed)

Use pkg-config to improve dependency detection

Reported by: Algunenano Owned by: Algunenano
Priority: medium Milestone: PostGIS 3.0.0
Component: postgis Version: master
Keywords: Cc:

Description

Mailist: https://lists.osgeo.org/pipermail/postgis-devel/2019-February/027687.html

The idea is to use pkg-config for those dependencies that support it when the corresponding option (e.g. --with-projdir) isn't set.

This has several benefits:

  • It doesn't matter where you've installed your packages as long as the pkg-build path is set up correctly, for example, OSX with brew.
  • It's much simpler to support: You can do a one-liner to check if the library is available and which flags to use.
  • If any dependency in the future decided to change their API (different include structure, change its library name), the pkg-build would work automatically. OTOH, it'd be a nightmare with the hardcoded paths and libraries.

For now, I've kept the --with-XXdir options as the first priority, defaulting to pkg-build only if the option isn't passed and pkg-build is available. I'm also showing a warning when using those options.

In the future (before final release) we should decide whether to keep the options and/or the warnings.

Note that, for full manual configuration, if the proper "--prefix" is passed when configuring proj:

./configure --with-projdir="/home/raul/dev/build/proj.4"

is equivalent to

./configure PKG_CONFIG_PATH="/home/raul/dev/build/proj.4"

which, with current proj, is equivalent to

./configure PROJ_CFLAGS="/home/raul/dev/build/proj.4/include" PROJ_LIBS="-L/home/raul/dev/build/proj.4/libs -lproj"

Change History (5)

comment:1 by Raul Marin, 6 years ago

Resolution: fixed
Status: assignedclosed

In 17233:

Use pkg-config to improve dependency detection

Closes #4324
Closes https://github.com/postgis/postgis/pull/372

comment:2 by Algunenano, 6 years ago

Resolution: fixed
Status: closedreopened

Looks like PROJ added the pkg-build file for 4.8, but at least for Ubuntu official packages it wasn't included until 4.9. Dronie seems to be failing because of that, but Travis is happy because it doesn't use the official packages.

I'll see if I can relax the requirement since we still support proj 4.6 officially. Either that or increase the minimum supported release.

comment:3 by Algunenano, 6 years ago

I've made pg-config for PROJ optional in r17244. If the script isn't available it'll try to continue as before.

comment:4 by Raul Marin, 6 years ago

In 17245:

Configure: libpcre is optional

Build shouldn't stop if libpcre isn't present

References #4324

comment:5 by Algunenano, 6 years ago

Resolution: fixed
Status: reopenedclosed

Dronie is now happy.

Note: See TracTickets for help on using tickets.