[cig-commits] r13613 - cs/cigma/trunk/config

luis at geodynamics.org luis at geodynamics.org
Tue Dec 9 18:16:04 PST 2008


Author: luis
Date: 2008-12-09 18:16:04 -0800 (Tue, 09 Dec 2008)
New Revision: 13613

Modified:
   cs/cigma/trunk/config/cigma_vtk.m4
Log:
Fixed CIGMA_PATH_VTK macro for nonstandard VTK prefixes

Modified: cs/cigma/trunk/config/cigma_vtk.m4
===================================================================
--- cs/cigma/trunk/config/cigma_vtk.m4	2008-12-10 02:16:02 UTC (rev 13612)
+++ cs/cigma/trunk/config/cigma_vtk.m4	2008-12-10 02:16:04 UTC (rev 13613)
@@ -65,8 +65,23 @@
             dnl VTK found!
             AC_MSG_RESULT([yes])
 
-            dnl these are the VTK libraries of a default build
+            dnl set VTK flags
+            VTK_INCLUDES="-I$VTK_PREFIX/include/vtk$vtk_suffix"
+            VTK_LDFLAGS="-L$VTK_PREFIX/lib/vtk$vtk_suffix -L$VTK_PREFIX/lib64/vtk$vtk_suffix"
 
+            dnl remember the old flags
+            OLD_CFLAGS=$CFLAGS
+            OLD_CXXFLAGS=$CXXFLAGS
+            OLD_LDFLAGS=$LDFLAGS
+            OLD_LIBS=$LIBS
+
+            dnl in order to be able to compile the following test programs,
+            dnl we need to add to our VTK settings to the current flags
+            CFLAGS="$VTK_CFLAGS $CFLAGS"
+            CXXFLAGS="$VTK_CXXFLAGS $CXXFLAGS"
+            LDFLAGS="$VTK_LDFLAGS $LDFLAGS"
+
+            dnl these are the VTK libraries of a default build.
             dnl figure out vtkCommon, vtkIO, vtkFiltering, plus dependencies (in case VTK libs are static)
             dnl order of libs is significant
             VTK_SUPPORT_LIBS="-lvtktiff -lvtkpng -lvtkjpeg -lvtkzlib -lvtkexpat -lvfw32 -lgdi32"
@@ -83,16 +98,14 @@
                 ], [$VTK_SUPPORT_LIBS])
             ], [$VTK_SUPPORT_LIBS])
             VTK_LIBS="-lvtkIO -lvtkDICOMParser -lvtkFiltering -lvtkCommon $VTK_SUPPORT_LIBS -lvtksys"
+            LIBS="$VTK_LIBS $LIBS"
 
-            dnl set VTK flags
-            VTK_INCLUDES="-I$VTK_PREFIX/include/vtk$vtk_suffix"
-            VTK_LDFLAGS="-L$VTK_PREFIX/lib/vtk$vtk_suffix -L$VTK_PREFIX/lib64/vtk$vtk_suffix"
-
+            dnl Substitute the values of our VTK flags
             AC_SUBST(VTK_INCLUDES)
             AC_SUBST(VTK_LDFLAGS)
             AC_SUBST(VTK_LIBS)
 
-            dnl now, eventually check version
+            dnl now, check that we don't exceed the specified version
             if [[ -n "$1" ]]; then
                 
                 dnl the version of VTK we need
@@ -102,19 +115,6 @@
                 rel=`echo $1 | sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
                 AC_MSG_CHECKING([if VTK version is at least $maj.$min.$rel])
 
-                dnl in order to be able to compile the following test program,
-                dnl we need to add to the current flags, the VTK settings...
-
-                OLD_CFLAGS=$CFLAGS
-                OLD_CXXFLAGS=$CXXFLAGS
-                OLD_LDFLAGS=$LDFLAGS
-                OLD_LIBS=$LIBS
-
-                CFLAGS="$VTK_CFLAGS $CFLAGS"
-                CXXFLAGS="$VTK_CXXFLAGS $CXXFLAGS"
-                LDFLAGS="$VTK_LDFLAGS $LDFLAGS"
-                LIBS="$VTK_LIBS $LIBS"
-
                 dnl check if the installed VTK is greater or not
                 AC_COMPILE_IFELSE([
                     AC_LANG_PROGRAM([
@@ -152,21 +152,24 @@
                 else
                     AC_MSG_RESULT([no])
                     $3
-                fi              # if [[ $vtkVersion = "OK ]];
+                fi
 
             else
 
+                dnl restore all flags without VTK values
+                CFLAGS=$OLD_CFLAGS
+                CXXFLAGS=$OLD_CXXFLAGS
+                LDFLAGS=$OLD_LDFLAGS
+                LIBS=$OLD_LIBS
+
                 dnl if we don't have to check for minimum version
                 dnl (because the user did not set that option),
                 dnl then we can execute here the block action-if-found
-                CFLAGS="$VTK_CFLAGS $CFLAGS"
-                CXXFLAGS="$VTK_CXXFLAGS $CXXFLAGS"
-                LDFLAGS="$VTK_LDFLAGS $LDFLAGS"
-                
                 $2
 
             fi          #if [[ -n "$1" ]];
 
+            dnl Finally, define the C preprocessor variable HAVE_VTK
             AC_DEFINE([HAVE_VTK],,[define if the VTK library is available])
 
         fi          # if [[ -z "$vtkFound" ]];



More information about the CIG-COMMITS mailing list