[mapserver-commits] r7171 - trunk/mapserver

svn at osgeo.org svn at osgeo.org
Fri Dec 14 10:11:26 EST 2007


Author: dmorissette
Date: 2007-12-14 10:11:26 -0500 (Fri, 14 Dec 2007)
New Revision: 7171

Modified:
   trunk/mapserver/configure
   trunk/mapserver/configure.in
   trunk/mapserver/mapogr.cpp
   trunk/mapserver/nmake.opt
Log:
Test on GDAL_VERSION_NUM instead of custom HAVE_OGRSTYLE_C (#565)

Modified: trunk/mapserver/configure
===================================================================
--- trunk/mapserver/configure	2007-12-14 13:10:42 UTC (rev 7170)
+++ trunk/mapserver/configure	2007-12-14 15:11:26 UTC (rev 7171)
@@ -9546,9 +9546,6 @@
 fi
 
 
-
-unset ac_cv_lib_gdal_OGR_SM_Create
-
 echo "$as_me:$LINENO: checking if GDAL support requested" >&5
 echo $ECHO_N "checking if GDAL support requested... $ECHO_C" >&6
 
@@ -9647,77 +9644,8 @@
   GDAL_LIB=`$GDAL_CONFIG --libs`' '`$GDAL_CONFIG --dep-libs`
   GDAL_INC=`$GDAL_CONFIG --cflags`
 
-        echo "$as_me:$LINENO: checking for OGR_SM_Create in -lgdal" >&5
-echo $ECHO_N "checking for OGR_SM_Create in -lgdal... $ECHO_C" >&6
-if test "${ac_cv_lib_gdal_OGR_SM_Create+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  ac_check_lib_save_LIBS=$LIBS
-LIBS="-lgdal $GDAL_LIB $LIBS"
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-
-/* Override any gcc2 internal prototype to avoid an error.  */
-#ifdef __cplusplus
-extern "C"
-#endif
-/* We use char because int might match the return type of a gcc2
-   builtin and then its argument prototype would still apply.  */
-char OGR_SM_Create ();
-int
-main ()
-{
-OGR_SM_Create ();
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
-  (eval $ac_link) 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; } &&
-	 { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  ac_cv_lib_gdal_OGR_SM_Create=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-ac_cv_lib_gdal_OGR_SM_Create=no
 fi
-rm -f conftest.err conftest.$ac_objext \
-      conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
-fi
-echo "$as_me:$LINENO: result: $ac_cv_lib_gdal_OGR_SM_Create" >&5
-echo "${ECHO_T}$ac_cv_lib_gdal_OGR_SM_Create" >&6
-if test $ac_cv_lib_gdal_OGR_SM_Create = yes; then
-  OGRSTYLE="-DHAVE_OGRSTYLE_C"
-fi
 
-  OGR_ENABLED="$OGR_ENABLED $OGRSTYLE"
-
-fi
-
 GDAL_ENABLED=$GDAL_ENABLED
 
 OGR_ENABLED=$OGR_ENABLED

Modified: trunk/mapserver/configure.in
===================================================================
--- trunk/mapserver/configure.in	2007-12-14 13:10:42 UTC (rev 7170)
+++ trunk/mapserver/configure.in	2007-12-14 15:11:26 UTC (rev 7171)
@@ -1199,10 +1199,6 @@
 dnl ---------------------------------------------------------------------
 dnl Find GDAL only if requested (and not supplied by OGR)
 dnl ---------------------------------------------------------------------
-
-dnl Clear some cache variables
-unset ac_cv_lib_gdal_OGR_SM_Create
-
 AC_MSG_CHECKING(if GDAL support requested)
 
 AC_ARG_WITH(gdal,
@@ -1253,12 +1249,6 @@
   GDAL_LIB=`$GDAL_CONFIG --libs`' '`$GDAL_CONFIG --dep-libs`
   GDAL_INC=`$GDAL_CONFIG --cflags`
 
-  dnl
-  dnl If we have GDAL 1.5.0 or better then use OGR C API for style handling
-  dnl
-  AC_CHECK_LIB(gdal,OGR_SM_Create,OGRSTYLE="-DHAVE_OGRSTYLE_C",,$GDAL_LIB)
-  OGR_ENABLED="$OGR_ENABLED $OGRSTYLE"
-
 fi
 
 AC_SUBST(GDAL_ENABLED,$GDAL_ENABLED)

Modified: trunk/mapserver/mapogr.cpp
===================================================================
--- trunk/mapserver/mapogr.cpp	2007-12-14 13:10:42 UTC (rev 7170)
+++ trunk/mapserver/mapogr.cpp	2007-12-14 15:11:26 UTC (rev 7171)
@@ -58,12 +58,12 @@
 
 #ifdef USE_OGR
 
-#ifdef HAVE_OGRSTYLE_C
+#if GDAL_VERSION_NUM >= 1500 /* Use OGR Style C API */
 #include "ogr_api.h"
-#else
+#else /* Use OGR Style C++ */
 #include "ogrsf_frmts.h"
 #include "ogr_featurestyle.h"
-#endif /* HAVE_OGRSTYLE_C */
+#endif
 
 typedef struct ms_ogr_file_info_t
 {
@@ -534,7 +534,7 @@
     return(NULL);
   }
 
-#ifdef HAVE_OGRSTYLE_C
+#if GDAL_VERSION_NUM >= 1500 /* Use OGR Style C API */
   OGRStyleMgrH  hStyleMgr = NULL;
   OGRStyleToolH hLabelStyle = NULL;
 #else
@@ -551,7 +551,7 @@
         values[i] = strdup(OGR_F_GetFieldAsString( hFeature, itemindexes[i]));
     }
     else
-#ifdef HAVE_OGRSTYLE_C
+#if GDAL_VERSION_NUM >= 1500 /* Use OGR Style C API */
     {
         // Handle special OGR attributes coming from StyleString
         if (!hStyleMgr)
@@ -628,10 +628,10 @@
           return(NULL);
         }
     }
-#endif /* HAVE_OGRSTYLE_C */
+#endif /* OGRStyle C API */
   }
 
-#ifdef HAVE_OGRSTYLE_C
+#if GDAL_VERSION_NUM >= 1500 /* Use OGR Style C API */
   OGR_SM_Destroy(hStyleMgr);
   OGR_ST_Destroy(hLabelStyle);
 #else
@@ -2120,7 +2120,7 @@
       GBool bIsNull, bIsBrush=MS_FALSE, bIsPen=MS_FALSE;
       int r=0,g=0,b=0,t=0;
 
-#ifdef HAVE_OGRSTYLE_C
+#if GDAL_VERSION_NUM >= 1500 /* Use OGR Style C API */
       OGRStyleMgrH hStyleMgr = OGR_SM_Create(NULL);
       OGR_SM_InitFromFeature(hStyleMgr, psInfo->hLastFeature);
       int numParts = OGR_SM_GetPartCount(hStyleMgr, NULL);
@@ -2128,12 +2128,12 @@
       OGRStyleMgr *poStyleMgr = new OGRStyleMgr(NULL);
       poStyleMgr->InitFromFeature((OGRFeature *)psInfo->hLastFeature);
       int numParts = poStyleMgr->GetPartCount();
-#endif /* HAVE_OGRSTYLE_C */
+#endif /* OGRStyle C API */
 
       for(int i=0; i<numParts; i++)
       {
           OGRSTClassId eStylePartType;
-#ifdef HAVE_OGRSTYLE_C
+#if GDAL_VERSION_NUM >= 1500 /* Use OGR Style C API */
           OGRStyleToolH hStylePart = OGR_SM_GetPart(hStyleMgr, i, NULL);
           if (!hStylePart)
               continue;
@@ -2143,7 +2143,7 @@
           if (!poStylePart)
               continue;
           eStylePartType = poStylePart->GetType();
-#endif /* HAVE_OGRSTYLE_C */
+#endif /* OGRStyle C API */
 
           // We want all size values returned in pixels.
           //
@@ -2155,14 +2155,14 @@
           // as long as use the same assumptions everywhere)
           // That gives scale = cellsize*72*39.37
 
-#ifdef HAVE_OGRSTYLE_C
+#if GDAL_VERSION_NUM >= 1500 /* Use OGR Style C API */
           OGR_ST_SetUnit(hStylePart, OGRSTUPixel, map->cellsize*72.0*39.37);
 #else
           poStylePart->SetUnit(OGRSTUPixel, map->cellsize*72.0*39.37);
 #endif
 
           if (eStylePartType == OGRSTCLabel)
-#ifdef HAVE_OGRSTYLE_C
+#if GDAL_VERSION_NUM >= 1500 /* Use OGR Style C API */
           {
               OGRStyleToolH hLabelStyle = hStylePart;
 
@@ -2286,9 +2286,9 @@
                   // msDebug("** Using 'medium' BITMAP font **\n");
               }
           }
-#endif /* HAVE_OGRSTYLE_C */
+#endif /* OGRStyle C API */
           else if (eStylePartType == OGRSTCPen)
-#ifdef HAVE_OGRSTYLE_C
+#if GDAL_VERSION_NUM >= 1500 /* Use OGR Style C API */
           {
               OGRStyleToolH hPenStyle = hStylePart;
               bIsPen = TRUE;
@@ -2454,9 +2454,9 @@
               }
 
           }
-#endif /* HAVE_OGRSTYLE_C */
+#endif /* OGRStyle C API */
           else if (eStylePartType == OGRSTCBrush)
-#ifdef HAVE_OGRSTYLE_C
+#if GDAL_VERSION_NUM >= 1500 /* Use OGR Style C API */
           {
               OGRStyleToolH hBrushStyle = hStylePart;
 
@@ -2561,9 +2561,9 @@
                                                          pszName, NULL);
               }
           }
-#endif /* HAVE_OGRSTYLE_C */
+#endif /* OGRStyle C API */
           else if (eStylePartType == OGRSTCSymbol)
-#ifdef HAVE_OGRSTYLE_C
+#if GDAL_VERSION_NUM >= 1500 /* Use OGR Style C API */
           {
               OGRStyleToolH hSymbolStyle = hStylePart;
 
@@ -2633,9 +2633,9 @@
                                                     pszName, 
                                                     "default-marker");
           }
-#endif /* HAVE_OGRSTYLE_C */
+#endif /* OGRStyle C API */
 
-#ifdef HAVE_OGRSTYLE_C
+#if GDAL_VERSION_NUM >= 1500 /* Use OGR Style C API */
           OGR_ST_Destroy(hStylePart);
 #else
           delete poStylePart;
@@ -2643,7 +2643,7 @@
 
       }
 
-#ifdef HAVE_OGRSTYLE_C
+#if GDAL_VERSION_NUM >= 1500 /* Use OGR Style C API */
       OGR_SM_Destroy(hStyleMgr);
 #else
       delete poStyleMgr;

Modified: trunk/mapserver/nmake.opt
===================================================================
--- trunk/mapserver/nmake.opt	2007-12-14 13:10:42 UTC (rev 7170)
+++ trunk/mapserver/nmake.opt	2007-12-14 15:11:26 UTC (rev 7171)
@@ -349,14 +349,8 @@
 # NOTE: Both -DUSE_OGR and -DUSE_GDAL need to be defined if you 
 # want to use GDAL/OGR for both raster and vector support, but GDAL_DIR 
 # needs only be defined once.
-#
-# NOTE 2: If using GDAL/OGR 1.5.0 or more recent then use -DHAVE_OGRSTYLE_C
-#         to enable the use of the OGR C API and allow upgrading GDAL.DLL
-#         without having to recompile MapServer. Older versions of GDAL/OGR
-#         still work, but with only partial support for the C API 
-#         See ticket #545 at http://trac.osgeo.org/mapserver/ticket/545
 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-#OGR=-DUSE_OGR -DHAVE_OGRSTYLE_C
+#OGR=-DUSE_OGR
 #GDAL_DIR=$(MS_BASE)\..\gdal
 
 



More information about the mapserver-commits mailing list