]> granicus.if.org Git - postgis/commitdiff
Cleanup of GDAL checks and additional check for OGR
authorBborie Park <bkpark at ucdavis.edu>
Fri, 3 Aug 2012 00:19:27 +0000 (00:19 +0000)
committerBborie Park <bkpark at ucdavis.edu>
Fri, 3 Aug 2012 00:19:27 +0000 (00:19 +0000)
git-svn-id: http://svn.osgeo.org/postgis/trunk@10156 b70326c6-7e19-0410-871a-916f4a2858ee

configure.ac

index a6629cd20859d4bee66816fa76df7dc35eb27f0c..92b10b7614074cfc13897e6352ef94131aea40c4 100644 (file)
@@ -968,7 +968,7 @@ if test "x$with_raster" != "xno"; then
                [AC_PATH_PROG([GDAL_CONFIG], [gdal-config], [])]
   )
 
-       AC_MSG_CHECKING([for GDAL >= $GDAL_MIN_VERSION])
+       AC_MSG_CHECKING([GDAL version])
 
        if test -x "$GDAL_CONFIG"; then
                dnl Extract the version information from gdal-config
@@ -982,17 +982,25 @@ if test "x$with_raster" != "xno"; then
                POSTGIS_GDAL_VERSION="$GDAL_MAJOR_VERSION$GDAL_MINOR_VERSION"
                GDAL_VERSION_NUMBER="$GDAL_MAJOR_VERSION$GDAL_MINOR_VERSION$GDAL_PATCH_VERSION"
 
+               AC_MSG_RESULT([$GDAL_FULL_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 raster requires GDAL >= $GDAL_MIN_VERSION. Use --without-raster to build without raster support.])
                fi
 
-               AC_MSG_RESULT([found])
-
                AC_DEFINE_UNQUOTED([POSTGIS_GDAL_VERSION], [$POSTGIS_GDAL_VERSION], [GDAL library version])     
                AC_SUBST([POSTGIS_GDAL_VERSION])
 
+               dnl Check that OGR is enabled
+               AC_MSG_CHECKING([for OGR enabled])
+               OGR_ENABLED=`$GDAL_CONFIG --ogr-enabled`
+               if test "x$OGR_ENABLED" != "xyes"; then
+                       AC_MSG_RESULT([$OGR_ENABLED])
+                       AC_MSG_ERROR([PostGIS raster requires OGR to be enabled in GDAL. Use --without-raster to build without raster support.])
+               fi
+               AC_MSG_RESULT([$OGR_ENABLED])
+
                dnl Extract the linker and include flags 
                LIBGDAL_LDFLAGS=`$GDAL_CONFIG --libs`
                LIBGDAL_CFLAGS=`$GDAL_CONFIG --cflags`
@@ -1015,6 +1023,11 @@ if test "x$with_raster" != "xno"; then
 
                LIBS="$LIBGDAL_LDFLAGS"
 
+               dnl Ensure we can link against ogr
+               AC_SEARCH_LIBS([OGRRegisterAll], [gdal], [], [AC_MSG_ERROR([could not find gdal])], [])
+
+               LIBS="$LIBGDAL_LDFLAGS"
+
                dnl Check if the new polygonize function is present
                AC_SEARCH_LIBS(
                        [GDALFPolygonize],
@@ -1030,6 +1043,7 @@ if test "x$with_raster" != "xno"; then
                AC_SUBST([LIBGDAL_LDFLAGS])
 
                AC_SUBST([GDALFPOLYGONIZE])
+
        else
                AC_MSG_RESULT([not found])
                AC_MSG_ERROR([gdal-config not found. Use --without-raster or try --with-gdalconfig=<path to gdal-config>])