Add support for disabling offline raster storage at compile time

Adds --disable-offline-raster configure switch
Testsuite fails with offline rasters disabled (could be fixed to
skip offline raster tests)

git-svn-id: http://svn.osgeo.org/postgis/trunk@12450 b70326c6-7e19-0410-871a-916f4a2858ee
This commit is contained in:
Sandro Santilli 2014-04-10 09:18:15 +00:00
parent b55193f5c3
commit 610a37eb20
3 changed files with 26 additions and 1 deletions

View file

@ -1107,6 +1107,20 @@ if test "x$with_raster" != "xno"; then
AC_SUBST([GDALFPOLYGONIZE])
dnl ===========================================================================
dnl Allow output of double truncation warnings with --with-raster-dblwarning
dnl ===========================================================================
AC_ARG_ENABLE(
[offline-rasters],
AC_HELP_STRING([--disable-offline-rasters], [disable support for off-db rasters]),
[POSTGIS_RASTER_DISABLE_OFFLINE=1],
[POSTGIS_RASTER_DISABLE_OFFLINE=0])
AC_DEFINE_UNQUOTED(
[POSTGIS_RASTER_DISABLE_OFFLINE],
[$POSTGIS_RASTER_DISABLE_OFFLINE],
[Define to disable support for offline rasters])
else
AC_MSG_RESULT([not found])
AC_MSG_ERROR([gdal-config not found. Use --without-raster or try --with-gdalconfig=<path to gdal-config>])
@ -1228,7 +1242,11 @@ AC_MSG_RESULT([ Perl: ${PERL}])
AC_MSG_RESULT()
AC_MSG_RESULT([ --------------- Extensions --------------- ])
if test "x$RASTER" = "xraster"; then
AC_MSG_RESULT([ PostGIS Raster: enabled])
if test "x$POSTGIS_RASTER_DISABLE_OFFLINE" = "x1"; then
AC_MSG_RESULT([ PostGIS Raster: enabled (no offline)])
else
AC_MSG_RESULT([ PostGIS Raster: enabled (offline included)])
fi
else
AC_MSG_RESULT([ PostGIS Raster: disabled])

View file

@ -32,3 +32,6 @@
/* Define to 1 if a warning is outputted every time a double is truncated */
#undef POSTGIS_RASTER_WARN_ON_TRUNCATION
/* Define to disable support for offline rasters */
#undef POSTGIS_RASTER_DISABLE_OFFLINE

View file

@ -580,6 +580,10 @@ rt_raster_serialize(rt_raster raster) {
/* Add band type */
*ptr = band->pixtype;
if (band->offline) {
#ifdef POSTGIS_RASTER_DISABLE_OFFLINE
rterror("rt_raster_serialize: offdb raster support disabled at compile-time");
return NULL;
#endif
*ptr |= BANDTYPE_FLAG_OFFDB;
}
if (band->hasnodata) {