From: Sandro Santilli Date: Tue, 5 Sep 2017 20:50:39 +0000 (+0000) Subject: Rework PGSQL_VERSION again so to use 2-digits minor from 10 onward X-Git-Tag: 2.3.4~33 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=a2db4ef1598ea0a570907c204ea65e1476a83cb0;p=postgis Rework PGSQL_VERSION again so to use 2-digits minor from 10 onward See #3614 (for 2.3 branch) git-svn-id: http://svn.osgeo.org/postgis/branches/2.3@15631 b70326c6-7e19-0410-871a-916f4a2858ee --- diff --git a/configure.ac b/configure.ac index ebf8eb402..811b442f3 100644 --- a/configure.ac +++ b/configure.ac @@ -430,18 +430,22 @@ if test "x$LIBLWGEOM_ONLY" = "xno"; then dnl Note: we extract the major & minor separately, ensure they are numeric, and then combine to give dnl the final version. This is to guard against user error... PGSQL_FULL_VERSION=`$PG_CONFIG --version` + PGSQL_MAJOR_VERSION=`echo $PGSQL_FULL_VERSION | sed 's/[[^0-9]]*\([[0-9]]*\).*/\1/'` PGSQL_MINOR_VERSION=`echo $PGSQL_FULL_VERSION | sed 's/[[^\.]]*\.\([[0-9]]*\).*/\1/'` - PGSQL_MINOR_VERSION=`echo $PGSQL_MINOR_VERSION | sed 's/.*devel.*/0/'` - + if test "$PGSQL_MINOR_VERSION" = "$PGSQL_FULL_VERSION"; then + dnl No match means there's no minor version + PGSQL_MINOR_VERSION="0" + fi + if test $PGSQL_MAJOR_VERSION -gt 9; then - dnl ================================================================== - dnl Starting with PostgreSQL 10, major is the new minor - dnl This is to prevent things like 10.31 ranking higher than 11.0 - dnl=================================================================== - PGSQL_MINOR_VERSION=0 + dnl ================================================================== + dnl Starting with PostgreSQL 10, we use 2 digits for minor version + dnl This is to prevent things like 10.31 ranking higher than 11.0 + dnl=================================================================== + PGSQL_MINOR_VERSION=`printf %.2d $PGSQL_MINOR_VERSION` fi - + POSTGIS_PGSQL_VERSION="$PGSQL_MAJOR_VERSION$PGSQL_MINOR_VERSION" PGSQL_PKGLIBDIR=`$PG_CONFIG --pkglibdir` diff --git a/libpgcommon/gserialized_gist.c b/libpgcommon/gserialized_gist.c index ec2585d6a..beb0b1286 100644 --- a/libpgcommon/gserialized_gist.c +++ b/libpgcommon/gserialized_gist.c @@ -22,7 +22,7 @@ #include "lwgeom_pg.h" /* For debugging macros. */ #include "gserialized_gist.h" -#if POSTGIS_PGSQL_VERSION >= 100 +#if POSTGIS_PGSQL_VERSION >= 1000 #include #endif diff --git a/postgis/gserialized_estimate.c b/postgis/gserialized_estimate.c index ea343495b..16b209080 100644 --- a/postgis/gserialized_estimate.c +++ b/postgis/gserialized_estimate.c @@ -836,7 +836,7 @@ pg_nd_stats_from_tuple(HeapTuple stats_tuple, int mode) /* Then read the geom status histogram from that */ -#if POSTGIS_PGSQL_VERSION < 100 +#if POSTGIS_PGSQL_VERSION < 1000 float4 *floatptr; int nvalues; diff --git a/postgis/gserialized_gist_nd.c b/postgis/gserialized_gist_nd.c index e8c16c5ad..112a54c8d 100644 --- a/postgis/gserialized_gist_nd.c +++ b/postgis/gserialized_gist_nd.c @@ -52,7 +52,7 @@ #include -#if POSTGIS_PGSQL_VERSION >= 100 +#if POSTGIS_PGSQL_VERSION >= 1000 #include #endif