From 7d94c6fd132ae9e921ae8c3c78eb1e895b13bf8a Mon Sep 17 00:00:00 2001 From: Paul Ramsey Date: Fri, 15 Jan 2010 17:54:52 +0000 Subject: [PATCH] Make GEOS 3.1 the mandatory minimum (#385) git-svn-id: http://svn.osgeo.org/postgis/trunk@5129 b70326c6-7e19-0410-871a-916f4a2858ee --- configure.ac | 14 +++++++++----- postgis/lwgeom_geos.c | 12 ------------ postgis/lwgeom_geos_prepared.h | 2 -- postgis/postgis.sql.in.c | 8 -------- postgis/uninstall_postgis.sql.in.c | 15 --------------- regress/Makefile.in | 12 ++---------- 6 files changed, 11 insertions(+), 52 deletions(-) diff --git a/configure.ac b/configure.ac index f5826308e..7ccabdf6e 100644 --- a/configure.ac +++ b/configure.ac @@ -293,8 +293,10 @@ dnl Note: we extract the major & minor separately, ensure they are numeric, and dnl the final version. This is to guard against user error... PGSQL_MAJOR_VERSION=`$PGCONFIG --version | sed 's/[[A-Za-z ]]*//' | cut -d. -f1 | sed 's/[[^0-9]]//g'` PGSQL_MINOR_VERSION=`$PGCONFIG --version | sed 's/[[A-Za-z ]]*//' | cut -d. -f2 | sed 's/[[^0-9]]//g'` +PGSQL_FULL_VERSION=`$PGCONFIG --version` POSTGIS_PGSQL_VERSION="$PGSQL_MAJOR_VERSION$PGSQL_MINOR_VERSION" +AC_MSG_RESULT([checking PostgreSQL version... $PGSQL_FULL_VERSION]) dnl Ensure that we are using PostgreSQL >= 8.3 if test ! "$PGSQL_MAJOR_VERSION" -ge 8; then AC_MSG_ERROR([PostGIS requires PostgreSQL >= 8.3]) @@ -449,11 +451,13 @@ dnl and then combine to give the final version. dnl This is to guard against user error... GEOS_MAJOR_VERSION=`$GEOSCONFIG --version | cut -d. -f1 | sed 's/[[^0-9]]//g'` GEOS_MINOR_VERSION=`$GEOSCONFIG --version | cut -d. -f2 | sed 's/[[^0-9]]//g'` +GEOS_FULL_VERSION=`$GEOSCONFIG --version` POSTGIS_GEOS_VERSION="$GEOS_MAJOR_VERSION$GEOS_MINOR_VERSION" -dnl Ensure that we are using GEOS >= 3.0.0 -if test ! "$GEOS_MAJOR_VERSION" -ge 3; then - AC_MSG_ERROR([PostGIS requires GEOS >= 3.0]) +dnl Ensure that we are using GEOS >= 3.1.0 +AC_MSG_RESULT([checking GEOS version... $GEOS_FULL_VERSION]) +if test ! "$POSTGIS_GEOS_VERSION" -ge 31; then + AC_MSG_ERROR([PostGIS requires GEOS >= 3.1]) fi dnl Extract the linker and include flags @@ -657,9 +661,9 @@ AC_MSG_RESULT([ C++ compiler: ${CXX} ${CXXFLAGS}]) AC_MSG_RESULT() AC_MSG_RESULT([ -------------- Dependencies -------------- ]) AC_MSG_RESULT([ GEOS config: ${GEOSCONFIG}]) -AC_MSG_RESULT([ GEOS version: ${GEOS_MAJOR_VERSION}.${GEOS_MINOR_VERSION}]) +AC_MSG_RESULT([ GEOS version: ${GEOS_FULL_VERSION}]) AC_MSG_RESULT([ PostgreSQL config: ${PGCONFIG}]) -AC_MSG_RESULT([ PostgreSQL version: ${PGSQL_MAJOR_VERSION}.${PGSQL_MINOR_VERSION}]) +AC_MSG_RESULT([ PostgreSQL version: ${PGSQL_FULL_VERSION}]) AC_MSG_RESULT([ PROJ4 version: ${POSTGIS_PROJ_VERSION}]) AC_MSG_RESULT([ Libxml2 config: ${XML2CONFIG}]) AC_MSG_RESULT([ Libxml2 version: ${POSTGIS_LIBXML2_VERSION}]) diff --git a/postgis/lwgeom_geos.c b/postgis/lwgeom_geos.c index e6652f678..8d9640351 100644 --- a/postgis/lwgeom_geos.c +++ b/postgis/lwgeom_geos.c @@ -209,10 +209,8 @@ Datum pgis_union_geometry_array(PG_FUNCTION_ARGS) #if POSTGIS_DEBUG_LEVEL > 0 static int call=1; #endif -#if POSTGIS_GEOS_VERSION >= 31 int gotsrid = 0; int allpolys=1; -#endif #if POSTGIS_DEBUG_LEVEL > 0 call++; @@ -247,8 +245,6 @@ Datum pgis_union_geometry_array(PG_FUNCTION_ARGS) /* Ok, we really need geos now ;) */ initGEOS(lwnotice, lwnotice); -#if POSTGIS_GEOS_VERSION >= 31 - /* ** First, see if all our elements are POLYGON/MULTIPOLYGON ** If they are, we can use UnionCascaded for faster results. @@ -388,7 +384,6 @@ Datum pgis_union_geometry_array(PG_FUNCTION_ARGS) } else { -#endif /* POSTGIS_GEOS_VERSION >= 31 */ /* ** Heterogeneous result, let's slog through this one union at a time. */ @@ -465,9 +460,7 @@ Datum pgis_union_geometry_array(PG_FUNCTION_ARGS) PG_RETURN_NULL(); } -#if POSTGIS_GEOS_VERSION >= 31 } -#endif if ( result == NULL ) { @@ -787,8 +780,6 @@ Datum convexhull(PG_FUNCTION_ARGS) } -#if POSTGIS_GEOS_VERSION >= 30 - PG_FUNCTION_INFO_V1(topologypreservesimplify); Datum topologypreservesimplify(PG_FUNCTION_ARGS) { @@ -832,7 +823,6 @@ Datum topologypreservesimplify(PG_FUNCTION_ARGS) PG_FREE_IF_COPY(geom1, 0); PG_RETURN_POINTER(result); } -#endif /* POSTGIS_GEOS_VERSION >= 30 */ PG_FUNCTION_INFO_V1(buffer); Datum buffer(PG_FUNCTION_ARGS) @@ -1413,7 +1403,6 @@ Datum isvalid(PG_FUNCTION_ARGS) PG_RETURN_BOOL(result); } -#if POSTGIS_GEOS_VERSION >= 31 /* ** IsValidReason is only available in the GEOS ** C API > version 3.0 @@ -1455,7 +1444,6 @@ Datum isvalidreason(PG_FUNCTION_ARGS) PG_RETURN_POINTER(result); } -#endif /** * overlaps(PG_LWGEOM g1,PG_LWGEOM g2) diff --git a/postgis/lwgeom_geos_prepared.h b/postgis/lwgeom_geos_prepared.h index 8b8dbd5e1..7107ce9e3 100644 --- a/postgis/lwgeom_geos_prepared.h +++ b/postgis/lwgeom_geos_prepared.h @@ -33,9 +33,7 @@ /* ** GEOS prepared geometry is only available from GEOS 3.1 onwards */ -#if POSTGIS_GEOS_VERSION >= 31 #define PREPARED_GEOM -#endif /* ** Cache structure. We use PG_LWGEOM as keys so no transformations diff --git a/postgis/postgis.sql.in.c b/postgis/postgis.sql.in.c index f2595c3bf..ebc99ddb1 100644 --- a/postgis/postgis.sql.in.c +++ b/postgis/postgis.sql.in.c @@ -3901,7 +3901,6 @@ CREATE OR REPLACE FUNCTION ST_LocateBetweenElevations(geometry, float8, float8) AS 'MODULE_PATHNAME', 'ST_LocateBetweenElevations' LANGUAGE 'C' IMMUTABLE STRICT; -#if POSTGIS_GEOS_VERSION >= 30 -- Requires GEOS >= 3.0.0 -- Availability: 1.3.3 CREATE OR REPLACE FUNCTION ST_SimplifyPreserveTopology(geometry, float8) @@ -3909,9 +3908,7 @@ CREATE OR REPLACE FUNCTION ST_SimplifyPreserveTopology(geometry, float8) AS 'MODULE_PATHNAME','topologypreservesimplify' LANGUAGE 'C' IMMUTABLE STRICT COST 100; -#endif -#if POSTGIS_GEOS_VERSION >= 31 -- Requires GEOS >= 3.1.0 -- Availability: 1.4.0 CREATE OR REPLACE FUNCTION ST_IsValidReason(geometry) @@ -3919,7 +3916,6 @@ CREATE OR REPLACE FUNCTION ST_IsValidReason(geometry) AS 'MODULE_PATHNAME', 'isvalidreason' LANGUAGE 'C' IMMUTABLE STRICT COST 100; -#endif #if POSTGIS_GEOS_VERSION >= 32 -- Requires GEOS >= 3.2.0 @@ -4352,7 +4348,6 @@ CREATE OR REPLACE FUNCTION ST_Contains(geometry,geometry) AS 'SELECT $1 && $2 AND _ST_Contains($1,$2)' LANGUAGE 'SQL' IMMUTABLE; -#if POSTGIS_GEOS_VERSION >= 30 -- Availability: 1.2.2 CREATE OR REPLACE FUNCTION _ST_CoveredBy(geometry,geometry) RETURNS boolean @@ -4379,9 +4374,7 @@ CREATE OR REPLACE FUNCTION ST_Covers(geometry,geometry) RETURNS boolean AS 'SELECT $1 && $2 AND _ST_Covers($1,$2)' LANGUAGE 'SQL' IMMUTABLE; -#endif -#if POSTGIS_GEOS_VERSION >= 31 -- Availability: 1.4.0 CREATE OR REPLACE FUNCTION _ST_ContainsProperly(geometry,geometry) RETURNS boolean @@ -4395,7 +4388,6 @@ CREATE OR REPLACE FUNCTION ST_ContainsProperly(geometry,geometry) RETURNS boolean AS 'SELECT $1 && $2 AND _ST_ContainsProperly($1,$2)' LANGUAGE 'SQL' IMMUTABLE; -#endif -- Deprecation in 1.2.3 CREATE OR REPLACE FUNCTION overlaps(geometry,geometry) diff --git a/postgis/uninstall_postgis.sql.in.c b/postgis/uninstall_postgis.sql.in.c index a71c3d662..dd5404e91 100644 --- a/postgis/uninstall_postgis.sql.in.c +++ b/postgis/uninstall_postgis.sql.in.c @@ -281,18 +281,12 @@ DROP FUNCTION IsValid(geometry); DROP FUNCTION ST_Overlaps(geometry,geometry); DROP FUNCTION _ST_Overlaps(geometry,geometry); DROP FUNCTION overlaps(geometry,geometry); - -#if POSTGIS_GEOS_VERSION >= 31 DROP FUNCTION ST_ContainsProperly(geometry,geometry); DROP FUNCTION _ST_ContainsProperly(geometry,geometry); -#endif - -#if POSTGIS_GEOS_VERSION >= 30 DROP FUNCTION ST_Covers(geometry,geometry); DROP FUNCTION _ST_Covers(geometry,geometry); DROP FUNCTION ST_CoveredBy(geometry,geometry); DROP FUNCTION _ST_CoveredBy(geometry,geometry); -#endif DROP FUNCTION ST_Contains(geometry,geometry); DROP FUNCTION _ST_Contains(geometry,geometry); @@ -369,15 +363,8 @@ DROP FUNCTION ST_Boundary(geometry); DROP FUNCTION boundary(geometry); DROP FUNCTION ST_Difference(geometry,geometry); DROP FUNCTION difference(geometry,geometry); - -#if POSTGIS_GEOS_VERSION >= 31 DROP FUNCTION ST_IsValidReason(geometry); -#endif - -#if POSTGIS_GEOS_VERSION >= 30 DROP FUNCTION ST_SimplifyPreserveTopology(geometry, float8); -#endif - DROP FUNCTION ST_LocateBetweenElevations(geometry, float8, float8); DROP FUNCTION ST_LineCrossingDirection(geometry, geometry); DROP FUNCTION _ST_LineCrossingDirection(geometry, geometry); @@ -393,8 +380,6 @@ DROP FUNCTION ST_Intersection(geometry,geometry); DROP FUNCTION intersection(geometry,geometry); #if POSTGIS_GEOS_VERSION >= 32 DROP FUNCTION ST_HausdorffDistance(geometry, geometry); -#endif -#if POSTGIS_GEOS_VERSION >= 32 DROP FUNCTION ST_HausdorffDistance(geometry, geometry, float8); #endif diff --git a/regress/Makefile.in b/regress/Makefile.in index 4e5a5e3b8..94b9fdb0e 100644 --- a/regress/Makefile.in +++ b/regress/Makefile.in @@ -63,22 +63,14 @@ TESTS = \ in_gml \ in_kml \ regress_ogc \ + regress_ogc_cover \ + regress_ogc_prep \ regress_bdpoly \ regress_proj \ dumppoints \ wmsservers \ tickets -# Covers/CoveredBy only if GEOS >= 3.0 -ifeq ($(shell expr $(POSTGIS_GEOS_VERSION) ">=" 30),1) - TESTS += regress_ogc_cover -endif - -# PreparedGeometry only if GEOS >= 3.1 -ifeq ($(shell expr $(POSTGIS_GEOS_VERSION) ">=" 31),1) - TESTS += regress_ogc_prep -endif - # Styled buffer only if GEOS >= 3.2 ifeq ($(shell expr $(POSTGIS_GEOS_VERSION) ">=" 32),1) TESTS += regress_buffer_params -- 2.50.1