Skip to content

Commit

Permalink
Remove OGR_ENABLED c preprocessor directives (#6117).
Browse files Browse the repository at this point in the history
GDAL has required OGR to be enabled for a while, so get rid of most of the
now unnecessary #if logic.  Hardcodes the response that OGR is enabled for
things like gdal-config.


git-svn-id: https://svn.osgeo.org/gdal/trunk/gdal@33757 f0d54148-0727-0410-94bb-9a71ac55c965
  • Loading branch information
goatbar committed Mar 20, 2016
1 parent c41282c commit 16f5216
Show file tree
Hide file tree
Showing 31 changed files with 9 additions and 232 deletions.
1 change: 0 additions & 1 deletion Doxyfile
Original file line number Diff line number Diff line change
Expand Up @@ -940,7 +940,6 @@ PREDEFINED = HAVE_DLFCN_H \
__cplusplus \
DOXYGEN_SKIP \
HAVE_CURL \
OGR_ENABLED \
CPL_UNUSED= \
UNUSED_IF_NO_GEOS=

Expand Down
11 changes: 2 additions & 9 deletions GDALmake.opt.in
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ PY_HAVE_SETUPTOOLS=@PY_HAVE_SETUPTOOLS@
BINDINGS = @BINDINGS@

HAVE_OGDI = @HAVE_OGDI@
OGR_ENABLED = @OGR_ENABLED@
OGR_ENABLED = yes
GNM_ENABLED = @GNM_ENABLED@

OSX_FRAMEWORK_PREFIX = /Library/Frameworks/GDAL.framework
Expand Down Expand Up @@ -518,12 +518,9 @@ PROJ_INCLUDE = @PROJ_INCLUDE@

PAM_SETTING = @PAM_SETTING@

ifeq ($(OGR_ENABLED),yes)
GDAL_LIBS := $(GDAL_LIB) $(OCI_LIB) $(GDAL_LIBS)
# TODO: Remove -DOGR_ENABLED.
CPPFLAGS := -DOGR_ENABLED $(CPPFLAGS)
else
GDAL_LIBS = $(GDAL_LIB)
endif

ifeq ($(GNM_ENABLED),yes)
CPPFLAGS := -DGNM_ENABLED $(CPPFLAGS)
Expand Down Expand Up @@ -581,11 +578,9 @@ endif

endif

ifeq ($(OGR_ENABLED),yes)
ifeq ($(HAVE_SQLITE),yes)
GDAL_FORMATS := $(GDAL_FORMATS) rasterlite mbtiles
endif
endif

ifeq ($(HAVE_POSTGISRASTER),yes)
GDAL_FORMATS := $(GDAL_FORMATS) postgisraster
Expand All @@ -595,9 +590,7 @@ ifeq ($(HAVE_CHARLS),yes)
GDAL_FORMATS := $(GDAL_FORMATS) jpegls
endif

ifeq ($(OGR_ENABLED),yes)
GDAL_FORMATS := $(GDAL_FORMATS) arg
endif

#
# CONFIG_LIBS is what local program should link against, and CONFIG_LIBS_INS
Expand Down
4 changes: 2 additions & 2 deletions aclocal.m4
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# generated automatically by aclocal 1.15 -*- Autoconf -*-
# generated automatically by aclocal 1.14.1 -*- Autoconf -*-

# Copyright (C) 1996-2014 Free Software Foundation, Inc.
# Copyright (C) 1996-2013 Free Software Foundation, Inc.

# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
Expand Down
9 changes: 1 addition & 8 deletions alg/contour.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,6 @@

CPL_CVSID("$Id$");

#ifdef OGR_ENABLED

// The amount of a contour interval that pixels should be fudged by if they
// match a contour level exactly.

Expand Down Expand Up @@ -1402,7 +1400,7 @@ CPLErr OGRContourWriter( double dfLevel,

return (eErr == OGRERR_NONE) ? CE_None : CE_Failure;
}
#endif // OGR_ENABLED


/************************************************************************/
/* GDALContourGenerate() */
Expand Down Expand Up @@ -1550,10 +1548,6 @@ CPLErr GDALContourGenerate( GDALRasterBandH hBand,
GDALProgressFunc pfnProgress, void *pProgressArg )

{
#ifndef OGR_ENABLED
CPLError(CE_Failure, CPLE_NotSupported, "GDALContourGenerate() unimplemented in a non OGR build");
return CE_Failure;
#else
VALIDATE_POINTER1( hBand, "GDALContourGenerate", CE_Failure );

OGRContourWriterInfo oCWI;
Expand Down Expand Up @@ -1639,5 +1633,4 @@ CPLErr GDALContourGenerate( GDALRasterBandH hBand,
CPLFree( padfScanline );

return eErr;
#endif // OGR_ENABLED
}
4 changes: 0 additions & 4 deletions alg/gdal_alg_priv.h
Original file line number Diff line number Diff line change
Expand Up @@ -187,8 +187,6 @@ int GDALDitherRGB2PCTInternal( GDALRasterBandH hRed,
#define MEDIAN_CUT_AND_DITHER_BUFFER_SIZE_65536 (6 * sizeof(int) * PRIME_FOR_65536)


#ifdef OGR_ENABLED

/************************************************************************/
/* Float comparison function. */
/************************************************************************/
Expand All @@ -208,6 +206,4 @@ struct FloatEqualityTest
bool operator()(float a, float b) { return GDALFloatEquals(a,b) == TRUE; }
};

#endif /* OGR_ENABLED */

#endif /* ndef GDAL_ALG_PRIV_H_INCLUDED */
13 changes: 0 additions & 13 deletions alg/gdalrasterize.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,7 @@
#include "ogr_geometry.h"
#include "ogr_spatialref.h"

#ifdef OGR_ENABLED
#include "ogrsf_frmts.h"
#endif

/************************************************************************/
/* gvBurnScanline() */
Expand Down Expand Up @@ -790,10 +788,6 @@ CPLErr GDALRasterizeLayers( GDALDatasetH hDS,
void *pProgressArg )

{
#ifndef OGR_ENABLED
CPLError(CE_Failure, CPLE_NotSupported, "GDALRasterizeLayers() unimplemented in a non OGR build");
return CE_Failure;
#else
GDALDataType eType;
unsigned char *pabyChunkBuf;
GDALDataset *poDS = (GDALDataset *) hDS;
Expand Down Expand Up @@ -1074,7 +1068,6 @@ CPLErr GDALRasterizeLayers( GDALDatasetH hDS,
VSIFree( pabyChunkBuf );

return eErr;
#endif /* def OGR_ENABLED */
}

/************************************************************************/
Expand Down Expand Up @@ -1172,11 +1165,6 @@ CPLErr GDALRasterizeLayersBuf( void *pData, int nBufXSize, int nBufYSize,
void *pProgressArg )

{
#ifndef OGR_ENABLED
CPLError( CE_Failure, CPLE_NotSupported,
"GDALRasterizeLayersBuf() unimplemented in a non OGR build" );
return CE_Failure;
#else
/* -------------------------------------------------------------------- */
/* If pixel and line spaceing are defaulted assign reasonable */
/* value assuming a packed buffer. */
Expand Down Expand Up @@ -1333,5 +1321,4 @@ CPLErr GDALRasterizeLayersBuf( void *pData, int nBufXSize, int nBufYSize,
}

return eErr;
#endif /* def OGR_ENABLED */
}
2 changes: 0 additions & 2 deletions alg/gdalrasterpolygonenumerator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,4 @@ void GDALRasterPolygonEnumeratorT<DataType,EqualityTest>::ProcessLine(

template class GDALRasterPolygonEnumeratorT<GInt32, IntEqualityTest>;

#ifdef OGR_ENABLED
template class GDALRasterPolygonEnumeratorT<float, FloatEqualityTest>;
#endif
14 changes: 0 additions & 14 deletions alg/polygonize.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,6 @@

CPL_CVSID("$Id$");

#ifdef OGR_ENABLED

/************************************************************************/
/* ==================================================================== */
/* RPolygon */
Expand Down Expand Up @@ -756,8 +754,6 @@ GBool GDALFloatEquals(float A, float B)
}


#endif // OGR_ENABLED

/************************************************************************/
/* GDALPolygonize() */
/************************************************************************/
Expand Down Expand Up @@ -825,10 +821,6 @@ GDALPolygonize( GDALRasterBandH hSrcBand,
void * pProgressArg )

{
#ifndef OGR_ENABLED
CPLError(CE_Failure, CPLE_NotSupported, "GDALPolygonize() unimplemented in a non OGR build");
return CE_Failure;
#else
return GDALPolygonizeT<GInt32, IntEqualityTest>(hSrcBand,
hMaskBand,
hOutLayer,
Expand All @@ -837,7 +829,6 @@ GDALPolygonize( GDALRasterBandH hSrcBand,
pfnProgress,
pProgressArg,
GDT_Int32);
#endif // OGR_ENABLED
}


Expand Down Expand Up @@ -909,10 +900,6 @@ GDALFPolygonize( GDALRasterBandH hSrcBand,
void * pProgressArg )

{
#ifndef OGR_ENABLED
CPLError(CE_Failure, CPLE_NotSupported, "GDALFPolygonize() unimplemented in a non OGR build");
return CE_Failure;
#else
return GDALPolygonizeT<float, FloatEqualityTest>(hSrcBand,
hMaskBand,
hOutLayer,
Expand All @@ -921,5 +908,4 @@ GDALFPolygonize( GDALRasterBandH hSrcBand,
pfnProgress,
pProgressArg,
GDT_Float32);
#endif // OGR_ENABLED
}
6 changes: 2 additions & 4 deletions apps/GNUmakefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ BIN_LIST = gdalinfo$(EXE) gdalserver$(EXE) gdal_translate$(EXE) \
OBJ = commonutils.o gdalinfo_lib.o gdal_translate_lib.o gdalwarp_lib.o ogr2ogr_lib.o \
gdaldem_lib.o nearblack_lib.o gdal_grid_lib.o gdal_rasterize_lib.o gdalbuildvrt_lib.o

ifeq ($(OGR_ENABLED),yes)
BIN_LIST += gdal_contour$(EXE) \
gdaltindex$(EXE) \
gdal_rasterize$(EXE) \
Expand All @@ -27,7 +26,6 @@ BIN_LIST += gdal_contour$(EXE) \
ogrlineref$(EXE) \
testepsg$(EXE) \
gdalbuildvrt$(EXE)
endif

ifeq ($(GNM_ENABLED),yes)
BIN_LIST += gnmmanage$(EXE) gnmanalyse$(EXE)
Expand Down Expand Up @@ -194,7 +192,7 @@ gdal-config: gdal-config.in ../GDALmake.opt ./GNUmakefile ../VERSION
echo 'CONFIG_CFLAGS="-I$(GDAL_ROOT)/port -I$(GDAL_ROOT)/gcore -I$(GDAL_ROOT)/alg -I$(GDAL_ROOT)/ogr -I$(GDAL_ROOT)/ogr/ogrsf_frmts -I$(GDAL_ROOT)/frmts/vrt -I$(GDAL_ROOT)/apps"' >> gdal-config
echo 'CONFIG_DATA="$(GDAL_ROOT)/data"' >> gdal-config
echo 'CONFIG_VERSION="'`cat ../VERSION`'"' >> gdal-config
echo 'CONFIG_OGR_ENABLED=$(OGR_ENABLED)' >> gdal-config
echo 'CONFIG_OGR_ENABLED=yes' >> gdal-config
echo 'CONFIG_GNM_ENABLED=$(GNM_ENABLED)' >> gdal-config
echo 'CONFIG_FORMATS="$(GDAL_FORMATS)"' >> gdal-config
cat gdal-config.in >> gdal-config
Expand All @@ -209,7 +207,7 @@ gdal-config-inst: gdal-config.in ../GDALmake.opt ./GNUmakefile ../VERSION
echo 'CONFIG_CFLAGS="-I$(INST_INCLUDE)"' >> gdal-config-inst
echo 'CONFIG_DATA="$(INST_DATA)"' >> gdal-config-inst
echo 'CONFIG_VERSION="'`cat ../VERSION`'"' >> gdal-config-inst
echo 'CONFIG_OGR_ENABLED=$(OGR_ENABLED)' >> gdal-config-inst
echo 'CONFIG_OGR_ENABLED=yes' >> gdal-config-inst
echo 'CONFIG_GNM_ENABLED=$(GNM_ENABLED)' >> gdal-config-inst
echo 'CONFIG_FORMATS="$(GDAL_FORMATS)"' >> gdal-config-inst
cat gdal-config.in >> gdal-config-inst
Expand Down
2 changes: 1 addition & 1 deletion apps/gdal-config.in
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ case $1 in
;;

--ogr-enabled)
echo $CONFIG_OGR_ENABLED
echo yes
;;

--gnm-enabled)
Expand Down
2 changes: 0 additions & 2 deletions apps/gdalbuildvrt_bin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -207,9 +207,7 @@ int main( int argc, char ** argv )

GDALDestroyDriverManager();

#ifdef OGR_ENABLED
OGRCleanupAll();
#endif

return nRetCode;
}
8 changes: 0 additions & 8 deletions apps/gdalbuildvrt_lib.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,7 @@
#include "gdal_vrt.h"
#include "vrtdataset.h"

#ifdef OGR_ENABLED
#include "ogr_api.h"
#endif
#include "ogr_srs_api.h"

CPL_CVSID("$Id$");
Expand Down Expand Up @@ -1189,11 +1187,6 @@ static bool add_file_to_list(const char* filename, const char* tile_index,

if (EQUAL(CPLGetExtension(filename), "SHP"))
{
#ifndef OGR_ENABLED
CPLError(CE_Failure, CPLE_AppDefined, "OGR support needed to read tileindex");
*pnInputFiles = 0;
*pppszInputFilenames = NULL;
#else
OGRRegisterAll();

/* Handle gdaltindex Shapefile as a special case */
Expand Down Expand Up @@ -1254,7 +1247,6 @@ static bool add_file_to_list(const char* filename, const char* tile_index,
ppszInputFilenames[nInputFiles] = NULL;

OGR_DS_Destroy( hDS );
#endif
}
else
{
Expand Down
5 changes: 0 additions & 5 deletions apps/gdalsrsinfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -109,9 +109,6 @@ int main( int argc, char ** argv )
/* Register standard GDAL and OGR drivers. */
/* -------------------------------------------------------------------- */
GDALAllRegister();
#ifdef OGR_ENABLED
OGRRegisterAll();
#endif

/* -------------------------------------------------------------------- */
/* Register standard GDAL drivers, and process generic GDAL */
Expand Down Expand Up @@ -247,9 +244,7 @@ int main( int argc, char ** argv )

/* cleanup anything left */
GDALDestroyDriverManager();
#ifdef OGR_ENABLED
OGRCleanupAll();
#endif
CSLDestroy( argv );

return 0;
Expand Down
4 changes: 0 additions & 4 deletions apps/gdalwarp_bin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -272,9 +272,7 @@ static int GDALExit( int nCode )

GDALDestroyDriverManager();

#ifdef OGR_ENABLED
OGRCleanupAll();
#endif

exit( nCode );
}
Expand Down Expand Up @@ -525,9 +523,7 @@ int main( int argc, char ** argv )

GDALDestroyDriverManager();

#ifdef OGR_ENABLED
OGRCleanupAll();
#endif

return nRetCode;
}
Loading

0 comments on commit 16f5216

Please sign in to comment.