[cig-commits] r22942 - cs/autoconf/trunk

elliott.sales.de.andrade at geodynamics.org elliott.sales.de.andrade at geodynamics.org
Tue Oct 8 00:11:53 PDT 2013


Author: elliott.sales.de.andrade
Date: 2013-10-08 00:11:52 -0700 (Tue, 08 Oct 2013)
New Revision: 22942

Modified:
   cs/autoconf/trunk/cit_vtk.m4
Log:
Fix a couple VTK macro bugs.

* Push and pop the C language around any tests.
* The zlib shared library is just named libz.so, not libzlib.so, so
  correct the linker test.
* Use test instead of brackets to reduce possibility of quoting bugs.

Modified: cs/autoconf/trunk/cit_vtk.m4
===================================================================
--- cs/autoconf/trunk/cit_vtk.m4	2013-10-08 07:11:47 UTC (rev 22941)
+++ cs/autoconf/trunk/cit_vtk.m4	2013-10-08 07:11:52 UTC (rev 22942)
@@ -43,13 +43,12 @@
                 [vtk_version="$withval"],
                 [vtk_version="5.2"])
 
-    if [[ -z "$vtk_suffix" ]]; then
-
+    if test -z "$vtk_suffix"; then
         #
         # suffix was not specified. use the version number
         # to calculate what it should be
         #
-        if [[ -n "$vtk_version" ]]; then
+        if test -n "$vtk_version"; then
             vtk_suffix="-$vtk_version"
         fi
 
@@ -58,7 +57,7 @@
         # suffix was specified. ignore version silently?
         # produce error for now
         #
-        if [[ -n "$vtk_version" ]]; then
+        if test -n "$vtk_version"; then
             AC_MSG_ERROR([The option --with-vtk-suffix overrides --with-vtk-version. Do not use simultaneously.])
         fi
 
@@ -74,19 +73,19 @@
 AC_DEFUN([CIT_PATH_VTK],[
 
     dnl do we want to check for VTK?
-    if [[ $with_vtk = "yes" ]]; then
+    if test x$with_vtk = "xyes"; then
         dnl in case user wrote --with-vtk=yes
         with_vtk="/usr"
     fi
 
-    if [[ $with_vtk != "no" ]]; then
+    if test x$with_vtk != "xno"; then
         VTK_PREFIX="$with_vtk"
 
         AC_CHECK_FILE([$VTK_PREFIX/include/vtk$vtk_suffix/vtkCommonInstantiator.h],
                       [vtkFound="OK"])
         AC_MSG_CHECKING([if VTK is installed in $VTK_PREFIX])
 
-        if [[ -z "$vtkFound" ]]; then
+        if test -z "$vtkFound"; then
 
             dnl VTK not found!
             AC_MSG_RESULT([no])
@@ -102,6 +101,7 @@
             VTK_LDFLAGS="-L$VTK_PREFIX/lib/vtk$vtk_suffix -L$VTK_PREFIX/lib64/vtk$vtk_suffix"
 
             dnl remember the old flags
+            AC_LANG_PUSH([C])
             OLD_CFLAGS=$CFLAGS
             OLD_CXXFLAGS=$CXXFLAGS
             OLD_LDFLAGS=$LDFLAGS
@@ -120,7 +120,7 @@
             AC_CHECK_LIB(vtkIO, strcmp, [], [
                 VTK_SUPPORT_LIBS="-lvtktiff -lvtkpng -lvtkjpeg -lvtkzlib -lvtkexpat"
                 AC_CHECK_LIB(vtkIO, abort, [], [
-                    VTK_SUPPORT_LIBS="-ltiff -lpng -ljpeg -lzlib -lexpat"
+                    VTK_SUPPORT_LIBS="-ltiff -lpng -ljpeg -lz -lexpat"
                     AC_CHECK_LIB(vtkIO, exit, [], [
                         VTK_SUPPORT_LIBS=""
                         AC_CHECK_LIB(vtkIO, strstr, [], [
@@ -133,7 +133,7 @@
             LIBS="$VTK_LIBS $LIBS"
 
             dnl now, check that we don't exceed the specified version
-            if [[ -n "$1" ]]; then
+            if test -n "$1"; then
                 dnl the version of VTK we need
 
                 maj=`echo $1 | sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
@@ -143,10 +143,10 @@
 
                 dnl check if the installed VTK is greater or not
                 AC_COMPILE_IFELSE([
-                    AC_LANG_PROGRAM([
+                    AC_LANG_PROGRAM([[
                         #include <vtk/vtkConfigure.h>
                         #include <stdio.h>
-                        ],[
+                        ]],[[
                         printf("VTK version is: %d.%d.%d",
                                VTK_MAJOR_VERSION,
                                VTK_MINOR_VERSION,
@@ -163,7 +163,7 @@
                         #if VTK_BUILD_VERSION < $rel
                         #error Installed VTK is too old!
                         #endif
-                    ])
+                    ]])
                 ], [vtkVersion="OK"])
 
                 dnl restore all flags without VTK values
@@ -172,7 +172,7 @@
                 LDFLAGS=$OLD_LDFLAGS
                 LIBS=$OLD_LIBS
 
-                if [[ "$vtkVersion" = "OK" ]]; then
+                if test "$vtkVersion" = "OK"; then
                     AC_MSG_RESULT([yes])
                     $2
                 else
@@ -195,6 +195,9 @@
 
             fi          #if [[ -n "$1" ]];
 
+            dnl Don't move this up to where we restore flags, because it doesn't work.
+            AC_LANG_POP([C])
+
             dnl Finally, define the C preprocessor variable HAVE_VTK
             AC_DEFINE([HAVE_VTK],,[define if the VTK library is available])
 



More information about the CIG-COMMITS mailing list