[GRASS-dev] lib/vector/Vlib/field.c: Assumes `HAVE_GDAL'

Markus Neteler neteler at osgeo.org
Sun Mar 22 14:38:25 EDT 2009


On Sun, Mar 22, 2009 at 1:31 PM, Ivan Shmakov <oneingray at gmail.com> wrote:
>        Currently, GRASS doesn't compile well --without-gdal, since the
>        code in `field.c' seems to assume that GDAL is available.
>
>        The following patch seems to fix the issue.  Unless there'll be
>        objections, I'm going to commit it to the trunk.
>
> --- field.c     (revision 36440)
> +++ field.c     (working copy)
> @@ -29,7 +29,9 @@
>  #include <grass/dbmi.h>
>  #include <grass/Vect.h>
>
> +#ifdef HAVE_GDAL
>  #include <gdal_version.h>      /* needed for FID detection */
> +#endif /* HAVE_GDAL */
>
>  /*!
>    \brief Create and init new dblinks ctructure
> @@ -443,7 +445,11 @@
>
>     G_debug(3, "Searching for FID column in OGR DB");
>     if (Map->format == GV_FORMAT_OGR) {
>
> +#ifndef HAVE_GDAL
> +       G_fatal_error(_("The support for OGR vector maps wasn't"
> +                       " compiled in."));
> +#else
>  #if GDAL_VERSION_NUM > 1320    /* seems to be fixed after 1320 release */
>        int layer, nLayers;
>        OGRDataSourceH Ogr_ds;
> @@ -596,6 +601,7 @@
>        }
>  #endif /* GDAL_VERSION_NUM > 1320 */
>        return (1);
> +#endif /* HAVE_GDAL */
>     }
>     else if (Map->format != GV_FORMAT_NATIVE) {
>        G_fatal_error(_("Don't know how to read links for format %d"),
>

This looks good to me (untested).

Markus


More information about the grass-dev mailing list