[SCM] PostGIS branch master updated. 3.4.0rc1-1150-g23a1dd033

git at osgeo.org git at osgeo.org
Wed Jun 12 03:34:32 PDT 2024


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "PostGIS".

The branch, master has been updated
       via  23a1dd0339b4333787d23e7f2ffd5f6d293bead8 (commit)
      from  b63abc4f93630f61bad0bc209d994e445db6660a (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 23a1dd0339b4333787d23e7f2ffd5f6d293bead8
Author: Sandro Santilli <strk at kbt.io>
Date:   Wed Jun 12 12:32:03 2024 +0200

    Drop code paths for PROJ version < 6.1.0, which is now required
    
    Rework format of proj version string to follow GEOS approach
    
    References #5742

diff --git a/README.postgis b/README.postgis
index 36e28a4c3..56b7fe8a2 100644
--- a/README.postgis
+++ b/README.postgis
@@ -16,7 +16,7 @@ Directory structure::
   ./doc         PostGIS Documentation
   ./extensions  Support for the PostgreSQL Extensions framework
   ./extras      Various pieces that didn't belong to mainstream
-                (package management specfiles, sample WKB parser, 
+                (package management specfiles, sample WKB parser,
                 postgis_tiger_geocoder)
   ./fuzzers     Google fuzz tests for liblwgeom
   ./liblwgeom   LWGEOM geometry library
@@ -57,9 +57,9 @@ For apt-based systems you can run this command to install the below dependencies
     protobuf-c-compiler \
     xsltproc
 
-* PROJ4 (Required, Version 6.1 or higher):
+* PROJ (Required, Version 6.1 or higher):
 
-  The PROJ4 catographic projection library is required if you want to use the
+  The PROJ catographic projection library is required if you want to use the
   ST_Transform() function to reproject features within the database.
 
     https://proj.org
@@ -150,7 +150,7 @@ and refuse to proceed. You can specify it using the
 
 PostGIS supports pkg-config for most dependencies.
 
-If PROJ4 has been installed but cannot be found, configure will complain and
+If PROJ has been installed but cannot be found, configure will complain and
 refuse to proceed. You can specify an alternative installation directory using
 the ``--with-projdir=DIR`` option.
 
diff --git a/configure.ac b/configure.ac
index 15f821673..8951b174e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -987,11 +987,11 @@ CFLAGS="$CFLAGS_SAVE"
 
 
 dnl ===========================================================================
-dnl Detect the version of PROJ.4 installed
+dnl Detect the version of PROJ installed
 dnl ===========================================================================
 
 AC_ARG_WITH([projdir],
-	[AS_HELP_STRING([--with-projdir=PATH], [specify the PROJ.4 installation directory])],
+	[AS_HELP_STRING([--with-projdir=PATH], [specify the PROJ installation directory])],
 	[PROJDIR="$withval"], [PROJDIR=""])
 
 if test ! "x$PROJDIR" = "x"; then
@@ -1015,7 +1015,7 @@ elif test ! -z "$PKG_CONFIG"; then
 		[
 			PROJ_CPPFLAGS="$PROJ_CFLAGS"
 			PROJ_LDFLAGS="$PROJ_LIBS"
-			POSTGIS_PROJ_VERSION=`$PKG_CONFIG proj --modversion | $PERL -nle 'print "$1$2" if /(\d+)\.(\d+)\.(\d+)/'`
+			PROJ_VERSION=`$PKG_CONFIG proj --modversion`
 		],
 		[
 			PROJ_LDFLAGS="-lproj"
@@ -1054,19 +1054,21 @@ AC_CHECK_HEADER([proj_api.h],
 		)]
 	)
 
-dnl Return the PROJ.4 version number if not detected by pkg-config
-if test "x$POSTGIS_PROJ_VERSION" = "x"; then
-	AC_PROJ_VERSION([POSTGIS_PROJ_VERSION])
+dnl Find the PROJ version number if not detected via pkg-config
+if test "x$PROJ_VERSION" = "x"; then
+	AC_PROJ_VERSION()
 fi
-AC_DEFINE_UNQUOTED([POSTGIS_PROJ_VERSION], [$POSTGIS_PROJ_VERSION], [PROJ library version])
-AC_SUBST([POSTGIS_PROJ_VERSION])
 CPPFLAGS="$CPPFLAGS_SAVE"
 
+POSTGIS_PROJ_VERSION=`echo "${PROJ_VERSION}" | $PERL -nle 'printf "%d%02d%02d\n",$1,$2,$3 if /(\d+)\.(\d+)\.(\d+)/'`
+
 dnl Ensure that we are using PROJ >= 6.1.0 (requires pj_set_searchpath)
 if test ! "$POSTGIS_PROJ_VERSION" -ge 61; then
 	AC_MSG_ERROR([PostGIS requires PROJ >= 6.1.0])
 fi
 
+AC_DEFINE_UNQUOTED([POSTGIS_PROJ_VERSION], [$POSTGIS_PROJ_VERSION], [PROJ library version])
+AC_SUBST([POSTGIS_PROJ_VERSION])
 AC_SUBST([PROJ_CPPFLAGS])
 AC_SUBST([PROJ_LDFLAGS])
 
@@ -1958,7 +1960,7 @@ fi
 AC_MSG_RESULT()
 AC_MSG_RESULT([ -------------- Dependencies -------------- ])
 AC_MSG_RESULT([  GEOS config:          ${GEOS_CONFIG_SRC}])
-AC_MSG_RESULT([  GEOS version:         ${GEOS_VERSION}])
+AC_MSG_RESULT([  GEOS version:         ${GEOS_VERSION} (${POSTGIS_GEOS_VERSION})])
 if test "x$RASTER" = "xraster"; then
     AC_MSG_RESULT([  GDAL config:          ${GDAL_CONFIG}])
     AC_MSG_RESULT([  GDAL version:         ${GDAL_FULL_VERSION}])
@@ -1973,7 +1975,7 @@ if test "x$SUPPORT_POSTGRESQL" = "xyes"; then
 else
   AC_MSG_RESULT([  PostgreSQL support:   DISABLED])
 fi
-AC_MSG_RESULT([  PROJ4 version:        ${POSTGIS_PROJ_VERSION}])
+AC_MSG_RESULT([  PROJ version:         ${PROJ_VERSION} (${POSTGIS_PROJ_VERSION})])
 AC_MSG_RESULT([  Libxml2 config:       ${XML2CONFIG}])
 AC_MSG_RESULT([  Libxml2 version:      ${POSTGIS_LIBXML2_VERSION}])
 AC_MSG_RESULT([  JSON-C support:       ${HAVE_JSON}])
diff --git a/libpgcommon/lwgeom_transform.h b/libpgcommon/lwgeom_transform.h
index 51e71de8a..be0ae1978 100644
--- a/libpgcommon/lwgeom_transform.h
+++ b/libpgcommon/lwgeom_transform.h
@@ -56,12 +56,6 @@ typedef struct srs_precision
 	int precision_m;
 } srs_precision;
 
-#if POSTGIS_PROJ_VERSION < 61
-/* Needs to call postgis_initialize_cache first */
-char *GetProj4String(int32_t srid);
-#endif
-
-
 /* Prototypes */
 PROJSRSCache* GetPROJSRSCache();
 int lwproj_lookup(int32_t srid_from, int32_t srid_to, LWPROJ **pj);
diff --git a/macros/ac_proj4_version.m4 b/macros/ac_proj4_version.m4
index 6d7471ca8..0fe751cec 100644
--- a/macros/ac_proj4_version.m4
+++ b/macros/ac_proj4_version.m4
@@ -10,57 +10,40 @@ dnl *
 dnl **********************************************************************
 
 dnl
-dnl Return the PROJ.4 version number
+dnl Extract the PROJ version number from proj.h
+dnl
+dnl Sets PROJ_VERSION
 dnl
 
 AC_DEFUN([AC_PROJ_VERSION], [
 
-	AC_CHECK_HEADER([proj.h], [
-		dnl Proj >= 6 include and version string
-		AC_RUN_IFELSE([
-			AC_LANG_PROGRAM([
-				#ifdef HAVE_STDINT_H
-				#include <stdio.h>
-				#endif
-				#include "proj.h"
-			],[
-				FILE *fp;
-				int vernum;
+	CFLAGS_SAVE="$CFLAGS"
+	LDFLAGS_SAVE="$LDFLAGS"
+	CFLAGS="$PROJ_CPPFLAGS"
+	LDFLAGS="$PROJ_LDLAGS"
 
-				fp = fopen("conftest.out", "w");
-				vernum = (100 * PROJ_VERSION_MAJOR) + (10 * PROJ_VERSION_MINOR) + PROJ_VERSION_PATCH;
-				fprintf(fp, "%d\n", vernum);
-				fclose(fp);
-			])
-		],[
-			dnl The program ran successfully, so return the version number in the form MAJORMINOR
-			$1=`cat conftest.out | sed 's/\([[0-9]]\)\([[0-9]]\)\([[0-9]]\)/\1\2/'`
-		],[
-			dnl The program failed so return an empty variable
-			$1=""
-		])
-	],[
-		dnl Proj < 6 include and version string
-		AC_RUN_IFELSE(
-			[AC_LANG_PROGRAM([
-				#ifdef HAVE_STDINT_H
-				#include <stdio.h>
-				#endif
-				#include "proj_api.h"
-			],[
-				FILE *fp;
-
-				fp = fopen("conftest.out", "w");
-				fprintf(fp, "%d\n", PJ_VERSION);
-				fclose(fp);
-			])
-		],[
-			dnl The program ran successfully, so return the version number in the form MAJORMINOR
-			$1=`cat conftest.out | sed 's/\([[0-9]]\)\([[0-9]]\)\([[0-9]]\)/\1\2/'`
-		],[
-			dnl The program failed so return an empty variable
-			$1=""
-		])
+  AC_MSG_CHECKING([PROJ version via compiled code])
+  AC_RUN_IFELSE([
+    AC_LANG_PROGRAM([
+      #ifdef HAVE_STDINT_H
+      #include <stdio.h>
+      #endif
+      #include "proj.h"
+    ],[
+      FILE *fp;
+      fp = fopen("conftest.out", "w");
+      fprintf(fp, "%d.%d.%d\n", PROJ_VERSION_MAJOR, PROJ_VERSION_MINOR, PROJ_VERSION_PATCH);
+      fclose(fp);
     ])
+  ],[
+    dnl The program ran successfully
+    PROJ_VERSION=`cat conftest.out`
+  ],[
+    AC_MSG_ERROR([Could not extract PROJ version via compiled >=6 test])
+  ])
+  AC_MSG_RESULT($PROJ_VERSION)
+
+	CFLAGS="$CFLAGS_SAVE"
+	LDFLAGS="$LDFLAGS_SAVE"
 ])
 
diff --git a/postgis/lwgeom_out_marc21.c b/postgis/lwgeom_out_marc21.c
index c04288379..5cbc46f54 100644
--- a/postgis/lwgeom_out_marc21.c
+++ b/postgis/lwgeom_out_marc21.c
@@ -76,22 +76,6 @@ Datum ST_AsMARC21(PG_FUNCTION_ARGS) {
 
 	}
 
-//	if (GetLWPROJ(srid, srid, &lwproj) == LW_FAILURE) {
-//
-//		PG_FREE_IF_COPY(gs, 0);
-//		lwpgerror("ST_AsMARC21: Failure reading projections from spatial_ref_sys.");
-//		PG_RETURN_NULL();
-//
-//	}
-
-//#if POSTGIS_PROJ_VERSION < 61
-//	is_latlong = pj_is_latlong(lwproj->pj_from);
-//#else
-//	is_latlong = lwproj->source_is_latlong;
-//#endif
-
-	//is_latlong = lwproj_is_latlong(lwproj);
-
 	if (!lwproj_is_latlong(lwproj)) {
 
 		PG_FREE_IF_COPY(gs, 0);
diff --git a/postgis/lwgeom_transform.c b/postgis/lwgeom_transform.c
index 0cd801ccc..43e40de68 100644
--- a/postgis/lwgeom_transform.c
+++ b/postgis/lwgeom_transform.c
@@ -203,16 +203,11 @@ Datum postgis_proj_version(PG_FUNCTION_ARGS)
 {
 	stringbuffer_t sb;
 
-#if POSTGIS_PROJ_VERSION < 61
-	stringbuffer_init(&sb);
-	stringbuffer_append(&sb, pj_get_release());
-#else
 	PJ_INFO pji = proj_info();
 	stringbuffer_init(&sb);
 	stringbuffer_append(&sb, pji.version);
-#endif
 
-#if POSTGIS_PROJ_VERSION >= 71
+#if POSTGIS_PROJ_VERSION >= 70100
 
 	stringbuffer_aprintf(&sb,
 		" NETWORK_ENABLED=%s",
@@ -232,7 +227,6 @@ Datum postgis_proj_version(PG_FUNCTION_ARGS)
 	PG_RETURN_POINTER(cstring_to_text(stringbuffer_getstring(&sb)));
 }
 
-
 /**
  * Encode feature in KML
  */
@@ -300,8 +294,6 @@ Datum LWGEOM_asKML(PG_FUNCTION_ARGS)
  * PROJ database reading functions
  */
 
-#if POSTGIS_PROJ_VERSION >= 61
-
 struct srs_entry {
 	text* auth_name;
 	text* auth_code;
@@ -470,7 +462,7 @@ srs_find_planar(const char *auth_name, const LWGEOM *bounds, struct srs_data *st
 	params->bbox_valid = true;
 	params->allow_deprecated = false;
 
-#if POSTGIS_PROJ_VERSION >= 81
+#if POSTGIS_PROJ_VERSION >= 80100
 	params->celestial_body_name = "Earth";
 #endif
 
@@ -523,7 +515,6 @@ srs_find_planar(const char *auth_name, const LWGEOM *bounds, struct srs_data *st
 	proj_crs_info_list_destroy(crs_list_ptr);
 	proj_get_crs_list_parameters_destroy(params);
 }
-#endif
 
 /**
  * Search for srtext and proj4text given auth_name and auth_srid,
@@ -533,9 +524,6 @@ Datum postgis_srs_entry(PG_FUNCTION_ARGS);
 PG_FUNCTION_INFO_V1(postgis_srs_entry);
 Datum postgis_srs_entry(PG_FUNCTION_ARGS)
 {
-#if POSTGIS_PROJ_VERSION < 60
-	elog(ERROR, "%s is not supported with Proj < 6.0", __func__);
-#else
 	Datum result;
 	struct srs_entry entry;
 	text* auth_name = PG_GETARG_TEXT_P(0);
@@ -557,7 +545,6 @@ Datum postgis_srs_entry(PG_FUNCTION_ARGS)
 		PG_RETURN_DATUM(srs_tuple_from_entry(&entry, tuple_desc));
 	else
 		PG_RETURN_NULL();
-#endif
 }
 
 
@@ -565,9 +552,6 @@ Datum postgis_srs_entry_all(PG_FUNCTION_ARGS);
 PG_FUNCTION_INFO_V1(postgis_srs_entry_all);
 Datum postgis_srs_entry_all(PG_FUNCTION_ARGS)
 {
-#if POSTGIS_PROJ_VERSION < 60
-	elog(ERROR, "%s is not supported with Proj < 6.0", __func__);
-#else
 	FuncCallContext *funcctx;
 	MemoryContext oldcontext;
 	struct srs_data *state;
@@ -630,7 +614,6 @@ Datum postgis_srs_entry_all(PG_FUNCTION_ARGS)
 
 	/* Stop if lookup fails drastically */
 	SRF_RETURN_DONE(funcctx);
-#endif
 }
 
 
@@ -638,9 +621,6 @@ Datum postgis_srs_codes(PG_FUNCTION_ARGS);
 PG_FUNCTION_INFO_V1(postgis_srs_codes);
 Datum postgis_srs_codes(PG_FUNCTION_ARGS)
 {
-#if POSTGIS_PROJ_VERSION < 60
-	elog(ERROR, "%s is not supported with Proj < 6.0", __func__);
-#else
 	FuncCallContext *funcctx;
 	MemoryContext oldcontext;
 	struct srs_data *state;
@@ -689,7 +669,6 @@ Datum postgis_srs_codes(PG_FUNCTION_ARGS)
 	/* Stop if lookup fails drastically */
 	SRF_RETURN_DONE(funcctx);
 	SRF_RETURN_DONE(funcctx);
-#endif
 }
 
 
@@ -701,9 +680,6 @@ Datum postgis_srs_search(PG_FUNCTION_ARGS);
 PG_FUNCTION_INFO_V1(postgis_srs_search);
 Datum postgis_srs_search(PG_FUNCTION_ARGS)
 {
-#if POSTGIS_PROJ_VERSION < 60
-	elog(ERROR, "%s is not supported with Proj < 6.0", __func__);
-#else
 	FuncCallContext *funcctx;
 	MemoryContext oldcontext;
 	struct srs_data *state;
@@ -771,7 +747,6 @@ Datum postgis_srs_search(PG_FUNCTION_ARGS)
 
 	/* Stop if lookup fails drastically */
 	SRF_RETURN_DONE(funcctx);
-#endif
 }
 
 
diff --git a/postgis/postgis_module.c b/postgis/postgis_module.c
index 9e7adb409..5c207d3da 100644
--- a/postgis/postgis_module.c
+++ b/postgis/postgis_module.c
@@ -63,7 +63,7 @@ static void onExecutorStart(QueryDesc *queryDesc, int eflags);
 * system instead of letting them default into the
 * stderr.
 */
-#if POSTGIS_PROJ_VERSION > 60
+#if POSTGIS_PROJ_VERSION > 60000
 #include "proj.h"
 
 static void
@@ -91,7 +91,7 @@ _PG_init(void)
   pg_install_lwgeom_handlers();
 
   /* pass proj messages through the pgsql error handler */
-#if POSTGIS_PROJ_VERSION > 60
+#if POSTGIS_PROJ_VERSION > 60000
   proj_log_func(NULL, NULL, pjLogFunction);
 #endif
 

-----------------------------------------------------------------------

Summary of changes:
 README.postgis                 |  8 ++---
 configure.ac                   | 22 +++++++------
 libpgcommon/lwgeom_transform.h |  6 ----
 macros/ac_proj4_version.m4     | 75 ++++++++++++++++--------------------------
 postgis/lwgeom_out_marc21.c    | 16 ---------
 postgis/lwgeom_transform.c     | 29 ++--------------
 postgis/postgis_module.c       |  4 +--
 7 files changed, 49 insertions(+), 111 deletions(-)


hooks/post-receive
-- 
PostGIS


More information about the postgis-tickets mailing list