Changeset: 63b700f4565b for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=63b700f4565b
Modified Files:
        NT/monetdb_config.h.in
        configure.ag
        geom/monetdb5/Makefile.ag
        geom/monetdb5/geom.c
        geom/monetdb5/geom.mal
Branch: geo
Log Message:

Added checks to avoid errors in windows when the proj_api.h is not found


diffs (124 lines):

diff --git a/NT/monetdb_config.h.in b/NT/monetdb_config.h.in
--- a/NT/monetdb_config.h.in
+++ b/NT/monetdb_config.h.in
@@ -416,6 +416,9 @@
 /* Define to 1 if you have the <procfs.h> header file. */
 /* #undef HAVE_PROCFS_H */
 
+/* Define if you have the proj library */
+/* #undef HAVE_PROJ */
+
 /* Define to 1 if you have the <pthread.h> header file. */
 /* #undef HAVE_PTHREAD_H */
 
diff --git a/configure.ag b/configure.ag
--- a/configure.ag
+++ b/configure.ag
@@ -2385,7 +2385,7 @@ yes|auto)
        CPPFLAGS="$CPPFLAGS $PROJ_INCS"
        LDFLAGS="$LDFLAGS $PROJ_LIBS"
        AC_CHECK_HEADER(proj_api.h,
-               AC_CHECK_LIB(proj, pj_init_plus, :,
+               AC_CHECK_LIB(proj, pj_init_plus, AC_DEFINE(HAVE_PROJ, 1, 
[Define if you have the proj library]),
                        [ if test "x$have_proj" != xauto; then 
AC_MSG_ERROR([-lproj library not found]); fi
                        have_proj=no; why_have_proj="(proj library not found)" 
], ),
                [ if test "x$have_proj" != xauto; then AC_MSG_ERROR([proj_api.h 
header not found]); fi
@@ -2413,6 +2413,7 @@ yes|auto)
 esac
 AC_SUBST(PROJ_INCS)
 AC_SUBST(PROJ_LIBS)
+AM_CONDITIONAL(HAVE_PROJ, test x"$have_proj" != xno)
 
 
 # geos, only used in geom module
diff --git a/geom/monetdb5/Makefile.ag b/geom/monetdb5/Makefile.ag
--- a/geom/monetdb5/Makefile.ag
+++ b/geom/monetdb5/Makefile.ag
@@ -25,6 +25,7 @@ INCLUDES = ../lib \
 
 lib__geom = {
        MODULE
+       COND = HAVE_PROJ
        DIR = libdir/monetdb5
        SOURCES = geom.c
        LIBS = ../lib/libgeom \
@@ -46,4 +47,4 @@ headers_autoload = {
        SOURCES = 30_geom.mal
 }
 
-EXTRA_DIST = 30_geom.mal geom.mal
+EXTRA_DIST = 30_geom.malQq geom.mal
diff --git a/geom/monetdb5/geom.c b/geom/monetdb5/geom.c
--- a/geom/monetdb5/geom.c
+++ b/geom/monetdb5/geom.c
@@ -212,8 +212,6 @@ static str transformCoordSeq(int idx, in
        GEOSCoordSeq_getX(gcs_old, idx, &x);
        GEOSCoordSeq_getY(gcs_old, idx, &y);
                                
-       //fprintf(stderr, "transforming POINT(%f %f) from '%s' to '%s'\n", x, 
y, pj_get_def(proj4_src,0), pj_get_def(proj4_dst,0));
-
        if(coordinatesNum > 2) 
                GEOSCoordSeq_getZ(gcs_old, idx, &z);
 
@@ -238,8 +236,6 @@ static str transformCoordSeq(int idx, in
        if (pj_is_latlong(proj4_dst)) radians2degrees(&x, &y, &z);
 
 
-       //fprintf(stderr, "transformed to POINT(%f %f)\n", x, y);
-
        GEOSCoordSeq_setX(*gcs_new, idx, x);
        GEOSCoordSeq_setY(*gcs_new, idx, y);
        
@@ -494,12 +490,17 @@ static str transformMultiGeometry(GEOSGe
 
 /* It gets a geometry and transforms its coordinates to the provided srid */
 str wkbTransform(wkb** transformedWKB, wkb** geomWKB, int* srid_src, int* 
srid_dst, char** proj4_src_str, char** proj4_dst_str) {
+
        projPJ proj4_src, proj4_dst;
        GEOSGeom geosGeometry, transformedGeosGeometry;
        int geometryType = -1;
 
        str ret = MAL_SUCCEED;
 
+#ifndef HAVE_PROJ 
+return createException(MAL, "geom.Transform", "Function Not Implemented");
+#endif
+
        if(!strcmp(*proj4_src_str, "null"))
                throw(MAL, "geom.wkbTransform", "Could not find in 
spatial_ref_sys srid %d\n", *srid_src);
        if(!strcmp(*proj4_dst_str, "null"))
@@ -508,9 +509,6 @@ str wkbTransform(wkb** transformedWKB, w
        proj4_dst = /*pj_init_plus*/projFromStr(*proj4_dst_str);
        
        
-//fprintf(stderr, "source:\t%s\n", *proj4_src_str);
-//fprintf(stderr, "destination:\t%s\n", *proj4_dst_str);
-
        if(*geomWKB == NULL) {
                *transformedWKB = wkb_nil;
                pj_free(proj4_src);
diff --git a/geom/monetdb5/geom.mal b/geom/monetdb5/geom.mal
--- a/geom/monetdb5/geom.mal
+++ b/geom/monetdb5/geom.mal
@@ -332,7 +332,10 @@ end YMaxFromMBR;
 #comment "Creates the mbr for the given (xmin,ymin) and (xmax,ymax).";
 
 
+command prelude():void address geom_prelude;
+command epilogue():void address geom_epilogue;
 
+geom.prelude();
 
 module batgeom;
 #command point(x:bat[:oid,:dbl],y:bat[:oid,:dbl]) :bat[:oid,:wkb]
@@ -354,10 +357,7 @@ comment "creates a 2D with m attribute p
 
 
 
-command prelude():void address geom_prelude;
-command epilogue():void address geom_epilogue;
 
-geom.prelude();
 
 module calc;
 
_______________________________________________
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to