1From 876a04a795fcb179e0dc802e260353012c4890f9 Mon Sep 17 00:00:00 2001
2From: Maxim Kochetkov <adobegitler@gmail.com>
3Date: Thu, 28 Jan 2021 08:12:57 +0300
4Subject: [PATCH] Use pkg-config to get PROJ version if available
5
6In case of cross-compile AC_PROJ_VERSION([POSTGIS_PROJ_VERSION]) fails.
7So try to get version by pkg-config first
8
9Signed-off-by: Maxim Kochetkov <fido_max@inbox.ru>
10Fetch from: https://github.com/postgis/postgis/commit/671a878982550e3c590d642620a6621b52c230c7.patch
11---
12 configure.ac | 7 +++++--
13 1 file changed, 5 insertions(+), 2 deletions(-)
14
15diff --git a/configure.ac b/configure.ac
16index 86e1597ee..016f81c7d 100644
17--- a/configure.ac
18+++ b/configure.ac
19@@ -866,6 +866,7 @@ elif test ! -z "$PKG_CONFIG"; then
20 		[
21 			PROJ_CPPFLAGS="$PROJ_CFLAGS"
22 			PROJ_LDFLAGS="$PROJ_LIBS"
23+			POSTGIS_PROJ_VERSION=`$PKG_CONFIG proj --modversion | sed 's/\([[0-9]]\).*\([[0-9]]\).*\([[0-9]]\)/\1\2/'`
24 		],
25 		[
26 			PROJ_LDFLAGS="-lproj"
27@@ -887,8 +888,10 @@ AC_CHECK_HEADER([proj_api.h],
28 		)]
29 	)
30
31-dnl Return the PROJ.4 version number
32-AC_PROJ_VERSION([POSTGIS_PROJ_VERSION])
33+dnl Return the PROJ.4 version number if not detected by pkg-config
34+if test "x$POSTGIS_PROJ_VERSION" = "x"; then
35+	AC_PROJ_VERSION([POSTGIS_PROJ_VERSION])
36+fi
37 AC_DEFINE_UNQUOTED([POSTGIS_PROJ_VERSION], [$POSTGIS_PROJ_VERSION], [PROJ library version])
38 AC_SUBST([POSTGIS_PROJ_VERSION])
39 CPPFLAGS="$CPPFLAGS_SAVE"
40--
412.30.0
42
43