[postgis-commits] svn - r3666 - in spike/wktraster: . rt_pg
postgis-commits at postgis.refractions.net
postgis-commits at postgis.refractions.net
Fri Feb 6 05:00:47 PST 2009
Author: strk
Date: 2009-02-06 05:00:41 -0800 (Fri, 06 Feb 2009)
New Revision: 3666
Modified:
spike/wktraster/configure.ac
spike/wktraster/rt_pg/rt_pg.c
spike/wktraster/rt_pg/rtpostgis.sql.in.c
Log:
Fix some version strings, add rt_lib_version() and rt_lib_build_date() pgsql functions
Modified: spike/wktraster/configure.ac
===================================================================
--- spike/wktraster/configure.ac 2009-02-06 12:43:55 UTC (rev 3665)
+++ spike/wktraster/configure.ac 2009-02-06 13:00:41 UTC (rev 3666)
@@ -57,9 +57,9 @@
RT_MINOR_VERSION=`cat Version.config | grep RT_MINOR_VERSION | sed 's/[[^=]]*=\([[0-9]]\)/\1/g'`
RT_MICRO_VERSION=`cat Version.config | grep RT_MICRO_VERSION | sed 's/[[^=]]*=\([[0-9]]\)/\1/g'`
-AC_DEFINE_UNQUOTED([RT_MAJOR_VERSION], ["$RT_MAJOR_VERSION"], [PostGIS major version])
-AC_DEFINE_UNQUOTED([RT_MINOR_VERSION], ["$RT_MINOR_VERSION"], [PostGIS minor version])
-AC_DEFINE_UNQUOTED([RT_MICRO_VERSION], ["$RT_MICRO_VERSION"], [PostGIS micro version])
+AC_DEFINE_UNQUOTED([RT_MAJOR_VERSION], ["$RT_MAJOR_VERSION"], [WKTRaster major version])
+AC_DEFINE_UNQUOTED([RT_MINOR_VERSION], ["$RT_MINOR_VERSION"], [WKTRaster minor version])
+AC_DEFINE_UNQUOTED([RT_MICRO_VERSION], ["$RT_MICRO_VERSION"], [WKTRaster micro version])
AC_SUBST([RT_MAJOR_VERSION])
AC_SUBST([RT_MINOR_VERSION])
@@ -276,13 +276,13 @@
PGSQL_MINOR_VERSION=`$PGCONFIG --version | sed 's/[[A-Za-z ]]*//' | cut -d. -f2 | sed 's/[[^0-9]]//g'`
RT_PGSQL_VERSION="$PGSQL_MAJOR_VERSION$PGSQL_MINOR_VERSION"
-dnl Ensure that we are using PostgreSQL >= 8.1
+dnl Ensure that we are using PostgreSQL >= 8.3
if test ! "$PGSQL_MAJOR_VERSION" -ge 8; then
- AC_MSG_ERROR([PostGIS requires PostgreSQL >= 8.1])
+ AC_MSG_ERROR([WKTRaster requires PostgreSQL >= 8.3])
else
if test "$PGSQL_MAJOR_VERSION" -eq 8; then
- if test ! "$PGSQL_MINOR_VERSION" -ge 1; then
- AC_MSG_ERROR([PostGIS requires PostgreSQL >= 8.1])
+ if test ! "$PGSQL_MINOR_VERSION" -ge 3; then
+ AC_MSG_ERROR([WKTRaster requires PostgreSQL >= 8.3])
fi
fi
fi
@@ -380,113 +380,115 @@
fi
fi
-dnl Extract the version information from geos_config
-dnl Note: we extract the major & minor separately, ensure they are numeric,
-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'`
-RT_GEOS_VERSION="$GEOS_MAJOR_VERSION$GEOS_MINOR_VERSION"
+dnl-GEOS-dnl dnl ===========================================================================
+dnl-GEOS-dnl dnl Extract the version information from geos_config
+dnl-GEOS-dnl dnl and then combine to give the final version.
+dnl-GEOS-dnl dnl This is to guard against user error...
+dnl-GEOS-dnl dnl ===========================================================================
+dnl-GEOS-dnl
+dnl-GEOS-dnl GEOS_MAJOR_VERSION=`$GEOSCONFIG --version | cut -d. -f1 | sed 's/[[^0-9]]//g'`
+dnl-GEOS-dnl GEOS_MINOR_VERSION=`$GEOSCONFIG --version | cut -d. -f2 | sed 's/[[^0-9]]//g'`
+dnl-GEOS-dnl RT_GEOS_VERSION="$GEOS_MAJOR_VERSION$GEOS_MINOR_VERSION"
+dnl-GEOS-dnl
+dnl-GEOS-dnl dnl Ensure that we are using GEOS >= 2.2.0 (requires CAPI)
+dnl-GEOS-dnl if test ! "$GEOS_MAJOR_VERSION" -ge 2; then
+dnl-GEOS-dnl AC_MSG_ERROR([PostGIS requires GEOS >= 2.2])
+dnl-GEOS-dnl else
+dnl-GEOS-dnl if test "$GEOS_MAJOR_VERSION" -eq 2; then
+dnl-GEOS-dnl if test ! "$GEOS_MINOR_VERSION" -ge 2; then
+dnl-GEOS-dnl AC_MSG_ERROR([PostGIS requires GEOS >= 2.2])
+dnl-GEOS-dnl fi
+dnl-GEOS-dnl fi
+dnl-GEOS-dnl fi
+dnl-GEOS-dnl
+dnl-GEOS-dnl dnl Extract the linker and include flags
+dnl-GEOS-dnl GEOS_LDFLAGS=`$GEOSCONFIG --ldflags`
+dnl-GEOS-dnl GEOS_CPPFLAGS=-I`$GEOSCONFIG --includes`
+dnl-GEOS-dnl
+dnl-GEOS-dnl dnl Ensure that we can parse geos_c.h
+dnl-GEOS-dnl CPPFLAGS_SAVE="$CPPFLAGS"
+dnl-GEOS-dnl CPPFLAGS="$GEOS_CPPFLAGS"
+dnl-GEOS-dnl AC_CHECK_HEADER([geos_c.h], [], [AC_MSG_ERROR([could not find geos_c.h - you may need to specify the directory of a geos-config file using --with-geosconfig])])
+dnl-GEOS-dnl CPPFLAGS="$CPPFLAGS_SAVE"
+dnl-GEOS-dnl
+dnl-GEOS-dnl dnl Ensure we can link against libgeos_c
+dnl-GEOS-dnl LIBS_SAVE="$LIBS"
+dnl-GEOS-dnl LIBS="$GEOS_LDFLAGS"
+dnl-GEOS-dnl AC_CHECK_LIB([geos_c], [initGEOS],
+dnl-GEOS-dnl [],
+dnl-GEOS-dnl [AC_MSG_ERROR([could not find libgeos_c - you may need to specify the directory of a geos-config file using --with-geosconfig])],
+dnl-GEOS-dnl [])
+dnl-GEOS-dnl LIBS="$LIBS_SAVE"
+dnl-GEOS-dnl
+dnl-GEOS-dnl AC_DEFINE_UNQUOTED([RT_GEOS_VERSION], [$RT_GEOS_VERSION], [GEOS library version])
+dnl-GEOS-dnl AC_SUBST([RT_GEOS_VERSION])
-dnl Ensure that we are using GEOS >= 2.2.0 (requires CAPI)
-if test ! "$GEOS_MAJOR_VERSION" -ge 2; then
- AC_MSG_ERROR([PostGIS requires GEOS >= 2.2])
-else
- if test "$GEOS_MAJOR_VERSION" -eq 2; then
- if test ! "$GEOS_MINOR_VERSION" -ge 2; then
- AC_MSG_ERROR([PostGIS requires GEOS >= 2.2])
- fi
- fi
-fi
-dnl Extract the linker and include flags
-GEOS_LDFLAGS=`$GEOSCONFIG --ldflags`
-GEOS_CPPFLAGS=-I`$GEOSCONFIG --includes`
+dnl-PROJ4-dnl dnl ===========================================================================
+dnl-PROJ4-dnl dnl Detect the version of PROJ.4 installed
+dnl-PROJ4-dnl dnl ===========================================================================
+dnl-PROJ4-dnl
+dnl-PROJ4-dnl AC_ARG_WITH([projdir],
+dnl-PROJ4-dnl [AS_HELP_STRING([--with-projdir=PATH], [specify the PROJ.4 installation directory])],
+dnl-PROJ4-dnl [PROJDIR="$withval"], [PROJDIR=""])
+dnl-PROJ4-dnl
+dnl-PROJ4-dnl if test ! "x$PROJDIR" = "x"; then
+dnl-PROJ4-dnl dnl Make sure that the directory exists
+dnl-PROJ4-dnl if test "x$PROJDIR" = "xyes"; then
+dnl-PROJ4-dnl AC_MSG_ERROR([you must specifiy a parameter to --with-projdir, e.g. --with-projdir=/path/to])
+dnl-PROJ4-dnl else
+dnl-PROJ4-dnl if test -d "$PROJDIR"; then
+dnl-PROJ4-dnl AC_MSG_RESULT([Using user-specified proj directory: $PROJDIR])
+dnl-PROJ4-dnl
+dnl-PROJ4-dnl dnl Add the include directory to PROJ_CPPFLAGS
+dnl-PROJ4-dnl PROJ_CPPFLAGS="-I$PROJDIR/include"
+dnl-PROJ4-dnl PROJ_LDFLAGS="-L$PROJDIR/lib"
+dnl-PROJ4-dnl else
+dnl-PROJ4-dnl AC_MSG_ERROR([the --with-projdir directory "$PROJDIR" cannot be found])
+dnl-PROJ4-dnl fi
+dnl-PROJ4-dnl fi
+dnl-PROJ4-dnl fi
+dnl-PROJ4-dnl
+dnl-PROJ4-dnl
+dnl-PROJ4-dnl dnl Check that we can find the proj_api.h header file
+dnl-PROJ4-dnl CPPFLAGS_SAVE="$CPPFLAGS"
+dnl-PROJ4-dnl CPPFLAGS="$PROJ_CPPFLAGS"
+dnl-PROJ4-dnl AC_CHECK_HEADER([proj_api.h], [], [AC_MSG_ERROR([could not find proj_api.h - you may need to specify the directory of a PROJ.4 installation using --with-projdir])])
+dnl-PROJ4-dnl
+dnl-PROJ4-dnl dnl Return the PROJ.4 version number
+dnl-PROJ4-dnl AC_PROJ_VERSION([RT_PROJ_VERSION])
+dnl-PROJ4-dnl AC_DEFINE_UNQUOTED([RT_PROJ_VERSION], [$RT_PROJ_VERSION], [PROJ library version])
+dnl-PROJ4-dnl AC_SUBST([RT_PROJ_VERSION])
+dnl-PROJ4-dnl CPPFLAGS="$CPPFLAGS_SAVE"
+dnl-PROJ4-dnl
+dnl-PROJ4-dnl dnl Ensure that we are using PROJ >= 4.5.0 (requires pj_set_searchpath)
+dnl-PROJ4-dnl if test ! "$RT_PROJ_VERSION" -ge 45; then
+dnl-PROJ4-dnl AC_MSG_ERROR([PostGIS requires PROJ >= 4.5.0])
+dnl-PROJ4-dnl fi
+dnl-PROJ4-dnl
+dnl-PROJ4-dnl dnl Ensure we can link against libproj
+dnl-PROJ4-dnl LIBS_SAVE="$LIBS"
+dnl-PROJ4-dnl LIBS="$PROJ_LDFLAGS"
+dnl-PROJ4-dnl AC_CHECK_LIB([proj], [pj_get_release],
+dnl-PROJ4-dnl [],
+dnl-PROJ4-dnl [AC_MSG_ERROR([could not find libproj - you may need to specify the directory of a PROJ.4 installation using --with-projdir])],
+dnl-PROJ4-dnl [])
+dnl-PROJ4-dnl LIBS="$LIBS_SAVE"
-dnl Ensure that we can parse geos_c.h
-CPPFLAGS_SAVE="$CPPFLAGS"
-CPPFLAGS="$GEOS_CPPFLAGS"
-AC_CHECK_HEADER([geos_c.h], [], [AC_MSG_ERROR([could not find geos_c.h - you may need to specify the directory of a geos-config file using --with-geosconfig])])
-CPPFLAGS="$CPPFLAGS_SAVE"
-dnl Ensure we can link against libgeos_c
-LIBS_SAVE="$LIBS"
-LIBS="$GEOS_LDFLAGS"
-AC_CHECK_LIB([geos_c], [initGEOS],
- [],
- [AC_MSG_ERROR([could not find libgeos_c - you may need to specify the directory of a geos-config file using --with-geosconfig])],
- [])
-LIBS="$LIBS_SAVE"
-
-AC_DEFINE_UNQUOTED([RT_GEOS_VERSION], [$RT_GEOS_VERSION], [GEOS library version])
-AC_SUBST([RT_GEOS_VERSION])
-
-
dnl ===========================================================================
-dnl Detect the version of PROJ.4 installed
-dnl ===========================================================================
-
-AC_ARG_WITH([projdir],
- [AS_HELP_STRING([--with-projdir=PATH], [specify the PROJ.4 installation directory])],
- [PROJDIR="$withval"], [PROJDIR=""])
-
-if test ! "x$PROJDIR" = "x"; then
- dnl Make sure that the directory exists
- if test "x$PROJDIR" = "xyes"; then
- AC_MSG_ERROR([you must specifiy a parameter to --with-projdir, e.g. --with-projdir=/path/to])
- else
- if test -d "$PROJDIR"; then
- AC_MSG_RESULT([Using user-specified proj directory: $PROJDIR])
-
- dnl Add the include directory to PROJ_CPPFLAGS
- PROJ_CPPFLAGS="-I$PROJDIR/include"
- PROJ_LDFLAGS="-L$PROJDIR/lib"
- else
- AC_MSG_ERROR([the --with-projdir directory "$PROJDIR" cannot be found])
- fi
- fi
-fi
-
-
-dnl Check that we can find the proj_api.h header file
-CPPFLAGS_SAVE="$CPPFLAGS"
-CPPFLAGS="$PROJ_CPPFLAGS"
-AC_CHECK_HEADER([proj_api.h], [], [AC_MSG_ERROR([could not find proj_api.h - you may need to specify the directory of a PROJ.4 installation using --with-projdir])])
-
-dnl Return the PROJ.4 version number
-AC_PROJ_VERSION([RT_PROJ_VERSION])
-AC_DEFINE_UNQUOTED([RT_PROJ_VERSION], [$RT_PROJ_VERSION], [PROJ library version])
-AC_SUBST([RT_PROJ_VERSION])
-CPPFLAGS="$CPPFLAGS_SAVE"
-
-dnl Ensure that we are using PROJ >= 4.5.0 (requires pj_set_searchpath)
-if test ! "$RT_PROJ_VERSION" -ge 45; then
- AC_MSG_ERROR([PostGIS requires PROJ >= 4.5.0])
-fi
-
-dnl Ensure we can link against libproj
-LIBS_SAVE="$LIBS"
-LIBS="$PROJ_LDFLAGS"
-AC_CHECK_LIB([proj], [pj_get_release],
- [],
- [AC_MSG_ERROR([could not find libproj - you may need to specify the directory of a PROJ.4 installation using --with-projdir])],
- [])
-LIBS="$LIBS_SAVE"
-
-
-dnl ===========================================================================
dnl Define version macros
dnl
-RT_VERSION="$RT_MAJOR_VERSION.$RT_MINOR_VERSION USE_GEOS=1 USE_PROJ=1 USE_STATS=1"
+RT_VERSION="$RT_MAJOR_VERSION.$RT_MINOR_VERSION"
RT_LIB_VERSION="$RT_MAJOR_VERSION.$RT_MINOR_VERSION.$RT_MICRO_VERSION"
RT_BUILD_DATE=`date -u "+%Y-%m-%d %H:%M:%S"`
RT_SCRIPTS_VERSION="$RT_LIB_VERSION"
-AC_DEFINE_UNQUOTED([RT_VERSION], ["$RT_VERSION"], [PostGIS version])
-AC_DEFINE_UNQUOTED([RT_LIB_VERSION], ["$RT_LIB_VERSION"], [PostGIS library version])
-AC_DEFINE_UNQUOTED([RT_BUILD_DATE], ["$RT_BUILD_DATE"], [PostGIS build date])
-AC_DEFINE_UNQUOTED([RT_SCRIPTS_VERSION], ["$RT_SCRIPTS_VERSION"], [PostGIS scripts version])
+AC_DEFINE_UNQUOTED([RT_VERSION], ["$RT_VERSION"], [WKTRaster version])
+AC_DEFINE_UNQUOTED([RT_LIB_VERSION], ["$RT_LIB_VERSION"], [WKTRaster library version])
+AC_DEFINE_UNQUOTED([RT_BUILD_DATE], ["$RT_BUILD_DATE"], [WKTRaster build date])
+AC_DEFINE_UNQUOTED([RT_SCRIPTS_VERSION], ["$RT_SCRIPTS_VERSION"], [WKTRaster scripts version])
AC_SUBST([RT_VERSION])
AC_SUBST([RT_LIB_VERSION])
Modified: spike/wktraster/rt_pg/rt_pg.c
===================================================================
--- spike/wktraster/rt_pg/rt_pg.c 2009-02-06 12:43:55 UTC (rev 3665)
+++ spike/wktraster/rt_pg/rt_pg.c 2009-02-06 13:00:41 UTC (rev 3666)
@@ -39,6 +39,7 @@
#include "rt_pg.h"
#include "pgsql_compat.h"
#include "rt_api.h"
+#include "../wktraster_config.h"
/* Define this to debug RASTER ops */
@@ -61,6 +62,8 @@
/* Prototypes */
+Datum RASTER_lib_version(PG_FUNCTION_ARGS);
+Datum RASTER_lib_build_date(PG_FUNCTION_ARGS);
Datum RASTER_in(PG_FUNCTION_ARGS);
Datum RASTER_out(PG_FUNCTION_ARGS);
Datum RASTER_to_BOX2DFLOAT4(PG_FUNCTION_ARGS);
@@ -194,6 +197,28 @@
return ctx;
}
+PG_FUNCTION_INFO_V1(RASTER_lib_version);
+Datum RASTER_lib_version(PG_FUNCTION_ARGS)
+{
+ char *ver = RT_LIB_VERSION;
+ text *result;
+ result = palloc(VARHDRSZ + strlen(ver));
+ SET_VARSIZE(result, VARHDRSZ + strlen(ver));
+ memcpy(VARDATA(result), ver, strlen(ver));
+ PG_RETURN_POINTER(result);
+}
+
+PG_FUNCTION_INFO_V1(RASTER_lib_build_date);
+Datum RASTER_lib_build_date(PG_FUNCTION_ARGS)
+{
+ char *ver = RT_BUILD_DATE;
+ text *result;
+ result = palloc(VARHDRSZ + strlen(ver));
+ SET_VARSIZE(result, VARHDRSZ + strlen(ver));
+ memcpy(VARDATA(result), ver, strlen(ver));
+ PG_RETURN_POINTER(result);
+}
+
/*
* Input is a string with hex chars in it.
* Convert to binary and put in the result
Modified: spike/wktraster/rt_pg/rtpostgis.sql.in.c
===================================================================
--- spike/wktraster/rt_pg/rtpostgis.sql.in.c 2009-02-06 12:43:55 UTC (rev 3665)
+++ spike/wktraster/rt_pg/rtpostgis.sql.in.c 2009-02-06 13:00:41 UTC (rev 3666)
@@ -46,6 +46,19 @@
storage = extended
);
+-------------------------------------------------------------------
+-- FUNCTIONS
+-------------------------------------------------------------------
+
+CREATEFUNCTION rt_lib_version() RETURNS text
+ AS 'MODULE_PATHNAME', 'RASTER_lib_version'
+ LANGUAGE 'C' IMMUTABLE; -- a new lib will require a new session
+
+CREATEFUNCTION rt_lib_build_date() RETURNS text
+ AS 'MODULE_PATHNAME', 'RASTER_lib_build_date'
+ LANGUAGE 'C' IMMUTABLE; -- a new lib will require a new session
+
+
CREATEFUNCTION rt_raster_to_box2d(raster)
RETURNS BOX2D
AS 'MODULE_PATHNAME','RASTER_to_BOX2DFLOAT4'
More information about the postgis-commits
mailing list