From b40c456d51bbd5cb4c15ffd1694a9a7266fe5bcf Mon Sep 17 00:00:00 2001 From: fidomax Date: Tue, 26 Jan 2021 08:48:17 +0300 Subject: [PATCH] Use pkg-config to get PROJ version if available In case of cross-compile AC_PROJ_VERSION([POSTGIS_PROJ_VERSION]) fails. So try to get version by pkg-config first --- configure.ac | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index 9ac7051bb67..304476bdbfc 100644 --- a/configure.ac +++ b/configure.ac @@ -886,7 +886,13 @@ AC_CHECK_HEADER([proj_api.h], ) dnl Return the PROJ.4 version number -AC_PROJ_VERSION([POSTGIS_PROJ_VERSION]) +if test ! -z "$PKG_CONFIG"; then + PKG_CHECK_MODULES([PROJ], [proj], [ + POSTGIS_PROJ_VERSION=`$PKG_CONFIG proj --modversion | sed 's/\([[0-9]]\).*\([[0-9]]\).*\([[0-9]]\)/\1\2/'` + ], []) +else + AC_PROJ_VERSION([POSTGIS_PROJ_VERSION]) +fi AC_DEFINE_UNQUOTED([POSTGIS_PROJ_VERSION], [$POSTGIS_PROJ_VERSION], [PROJ library version]) AC_SUBST([POSTGIS_PROJ_VERSION]) CPPFLAGS="$CPPFLAGS_SAVE"