From: Mateusz Loskot Date: Sat, 19 Feb 2011 01:05:30 +0000 (+0000) Subject: Improved GDAL detection and reporting X-Git-Tag: 2.0.0alpha1~1952 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=708e3a0268408c8ef20cf8b8b726c306edb1e07a;p=postgis Improved GDAL detection and reporting git-svn-id: http://svn.osgeo.org/postgis/trunk@6848 b70326c6-7e19-0410-871a-916f4a2858ee --- diff --git a/configure.ac b/configure.ac index 94a7f4d1e..a5f767b47 100644 --- a/configure.ac +++ b/configure.ac @@ -797,38 +797,45 @@ if test "x$RASTER" = "xyes"; then LIBGDAL_CFLAGS="" LIBGDAL_LDFLAGS="" - AC_MSG_CHECKING([for GDAL]) + dnl GDAL version constants, update here + GDAL_MIN_VERSION=1.6.0 + GDAL_MIN_VERSION_NUMBER=160 dnl TODO: Use GDAL version calculation MAJOR*1000+MINOR*100+REV*10+BUILD + AC_ARG_WITH([gdal], - AC_HELP_STRING([--with-gdalconfig=@<:@ARG@:>@],[specify location of gdal-config (ARG=path)]), + AC_HELP_STRING([--with-gdalconfig=@<:@ARG@:>@],[specify location of gdal-config (ARG=path)]), [GDAL_CONFIG="$withval"], [GDAL_CONFIG=""]) + AC_MSG_CHECKING([for GDAL >= $GDAL_MIN_VERSION]) if test "x$GDAL_CONFIG" = "x"; then - dnl If GDAL_CONFIG path not provided, try to find it + dnl If GDAL_CONFIG path not provided, try to find it GDAL_CONFIG_TMP=`which gdal-config` if test "`basename xx/${GDAL_CONFIG_TMP}`" = "gdal-config" ; then - AC_MSG_RESULT([yes]) GDAL_CONFIG=${GDAL_CONFIG_TMP} - else - AC_MSG_ERROR([gdal-config not found. Try --with-gdalconfig=]) fi fi - dnl Extract the version information from gdal-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... - GDAL_MAJOR_VERSION=`$GDAL_CONFIG --version | cut -d. -f1 | sed 's/[[^0-9]]//g'` - GDAL_MINOR_VERSION=`$GDAL_CONFIG --version | cut -d. -f2 | sed 's/[[^0-9]]//g'` - GDAL_PATCH_VERSION=`$GDAL_CONFIG --version | cut -d. -f3 | sed 's/[[^0-9]]//g'` - GDAL_FULL_VERSION=`$GDAL_CONFIG --version` - POSTGIS_GDAL_VERSION="$GDAL_MAJOR_VERSION$GDAL_MINOR_VERSION" - GDAL_NUMERIC_VERSION="$GDAL_MAJOR_VERSION$GDAL_MINOR_VERSION$GDAL_PATCH_VERSION" - - dnl Ensure that we are using GDAL >= 1.6.0 - AC_MSG_RESULT([checking GDAL version... $GDAL_FULL_VERSION]) - if test ! "$GDAL_NUMERIC_VERSION" -ge 160; then - AC_MSG_ERROR([PostGIS requires GDAL >= 1.6.0]) - fi + if test -x "$GDAL_CONFIG"; then + dnl Extract the version information from gdal-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... + GDAL_MAJOR_VERSION=`$GDAL_CONFIG --version | cut -d. -f1 | sed 's/[[^0-9]]//g'` + GDAL_MINOR_VERSION=`$GDAL_CONFIG --version | cut -d. -f2 | sed 's/[[^0-9]]//g'` + GDAL_PATCH_VERSION=`$GDAL_CONFIG --version | cut -d. -f3 | sed 's/[[^0-9]]//g'` + GDAL_FULL_VERSION=`$GDAL_CONFIG --version` + POSTGIS_GDAL_VERSION="$GDAL_MAJOR_VERSION$GDAL_MINOR_VERSION" + GDAL_VERSION_NUMBER="$GDAL_MAJOR_VERSION$GDAL_MINOR_VERSION$GDAL_PATCH_VERSION" + + dnl Ensure we are using minimum required version of GDAL + if test ! "$GDAL_VERSION_NUMBER" -ge "$GDAL_MIN_VERSION_NUMBER" ; then + AC_MSG_RESULT([not found]) + AC_MSG_ERROR([PostGIS requires GDAL >= $GDAL_MIN_VERSION]) + fi + else + AC_MSG_RESULT([not found]) + AC_MSG_ERROR([gdal-config not found. Try --with-gdalconfig=]) + fi + AC_MSG_RESULT([found]) dnl Determine if GDAL Python bindings are available AC_MSG_CHECKING([for GDAL Python bindings])