[cig-commits] [commit] master: Moved SVN changes by Elliot Sales de Andrade from SVN repo to Git (09ca47b)

cig_noreply at geodynamics.org cig_noreply at geodynamics.org
Mon Nov 11 09:43:45 PST 2013


Repository : ssh://geoshell/autoconf_cig

On branch  : master
Link       : https://github.com/geodynamics/autoconf_cig/compare/80f2b368e3011f2676f42c66e989504772338554...09ca47be4e87a6133563b7e8e32974a6da7c5d58

>---------------------------------------------------------------

commit 09ca47be4e87a6133563b7e8e32974a6da7c5d58
Author: CIG Backend <emheien at ucdavis.edu>
Date:   Mon Nov 11 09:43:02 2013 -0800

    Moved SVN changes by Elliot Sales de Andrade from SVN repo to Git


>---------------------------------------------------------------

09ca47be4e87a6133563b7e8e32974a6da7c5d58
 cit_adios.m4     |  82 +++++++++-----
 cit_backports.m4 | 340 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
 cit_cuda.m4      |  76 +++++++------
 cit_fortran.m4   | 178 -----------------------------
 cit_mpi.m4       |  33 ++++++
 cit_vtk.m4       | 215 +++++++++++++++++++++++++++++++++++
 6 files changed, 684 insertions(+), 240 deletions(-)

diff --git a/cit_adios.m4 b/cit_adios.m4
index a83f107..3aa7a19 100644
--- a/cit_adios.m4
+++ b/cit_adios.m4
@@ -6,39 +6,61 @@
 # ======================================================================
 
 # ----------------------------------------------------------------------
-# CIT_ADIOS_HEADER
+# CIT_ADIOS_CONFIG
 # ----------------------------------------------------------------------
-AC_DEFUN([CIT_ADIOS_HEADER], [
-  AC_REQUIRE_CPP
-  AC_LANG(C)
-  AC_CHECK_HEADER([adios.h], [], [
-    AC_MSG_ERROR([adios C header not found; try CPPFLAGS="-I<adios include dir>"])
-  ])dnl
-])dnl CIT_ADIOS_HEADER
+AC_DEFUN([CIT_ADIOS_CONFIG], [
+  dnl ADIOS comes with a program that *should* tell us how to link with it.
+  AC_ARG_VAR([ADIOS_CONFIG], [Path to adios_config program that indicates how to compile with it.])
+  AC_PATH_PROG([ADIOS_CONFIG], [adios_config])
 
+  if test "x$ADIOS_CONFIG" = "x"; then
+    AC_MSG_ERROR([adios_config program not found; try setting ADIOS_CONFIG to point to it])
+  fi
 
-# ----------------------------------------------------------------------
-# CIT_ADIOS_LIB
-# ----------------------------------------------------------------------
-AC_DEFUN([CIT_ADIOS_LIB], [
-  AC_LANG(Fortran)
-  AC_MSG_CHECKING([for adios_init in -ladiosf])
-  dnl Sample ADIOS program must be compiled with mpif90 in order to link
-  dnl the proper libraries (eg the ones bundled with openmpi)
-  FC_BCK=$FC
-  FC=$MPIFC
-  AC_COMPILE_IFELSE(
-    [AC_LANG_PROGRAM([[]],
-	             [[use adios_write_mod; call adios_init_noxml(MPI_COMM_WORLD, ierr)]])],
-    [AC_MSG_RESULT(yes)],
-    [AC_MSG_RESULT(no)
-     AC_MSG_ERROR([adiosf library not found; try LDFLAGS="-L<adios lib dir>" 
-					     and FCFLAGS="-I<adios inc dir>"])
-    ])dnl
-  dnl Revert the Fortran compiler to its initial value
-  FC=$FC_BCK
-  ]))
-])dnl CIT_ADIOS_LIB
+  AC_LANG_PUSH([Fortran])
+  FC_save="$FC"
+  FCFLAGS_save="$FCFLAGS"
+  LIBS_save="$LIBS"
+  FC="$MPIFC" dnl Must use mpi compiler.
+
+  dnl First check for directory with ADIOS modules
+  AC_MSG_CHECKING([for ADIOS modules])
+  ADIOS_FCFLAGS=`$ADIOS_CONFIG -c -f`
+  FCFLAGS="$ADIOS_FCFLAGS $FCFLAGS"
+  AC_COMPILE_IFELSE([
+    AC_LANG_PROGRAM([], [[
+    use adios_read_mod
+    use adios_write_mod
+    ]])
+  ], [
+    AC_MSG_RESULT(yes)
+  ], [
+    AC_MSG_RESULT(no)
+    AC_MSG_ERROR([ADIOS modules not found; is ADIOS built with Fortran support for this compiler?])
+  ])
+
+  dnl Now check for libraries that must be linked.
+  AC_MSG_CHECKING([for ADIOS libraries])
+  FCFLAGS="$ADIOS_FCFLAGS $FCFLAGS_save"
+  ADIOS_LIBS=`$ADIOS_CONFIG -l -f`
+  LIBS="$ADIOS_LIBS $LIBS"
+  AC_LINK_IFELSE([
+    AC_LANG_PROGRAM([],
+                    [[use adios_write_mod; call adios_init_noxml(MPI_COMM_WORLD, ierr)]])
+  ], [
+    AC_MSG_RESULT(yes)
+  ], [
+    AC_MSG_RESULT(no)
+    AC_MSG_ERROR([ADIOS libraries not found.])
+  ])
+
+  FC="$FC_save"
+  FCFLAGS="$FCFLAGS_save"
+  LIBS="$LIBS_save"
+  AC_LANG_POP([Fortran])
 
+  AC_SUBST([ADIOS_FCFLAGS])
+  AC_SUBST([ADIOS_LIBS])
+])dnl CIT_ADIOS_CONFIG
 
 dnl end of file
diff --git a/cit_backports.m4 b/cit_backports.m4
index 45b0009..3c48be1 100644
--- a/cit_backports.m4
+++ b/cit_backports.m4
@@ -12,4 +12,344 @@ m4_ifdef([AC_PROG_MKDIR_P], [], [
      AC_SUBST([MKDIR_P])])])
 
 
+#
+# The following two macros are from autoconf 2.68 (which is still new).
+#
+
+# AC_FC_PP_SRCEXT(EXT, [ACTION-IF-SUCCESS], [ACTION-IF-FAILURE])
+# --------------------------------------------------------------
+# Like AC_FC_SRCEXT, set the source-code extension used in Fortran (FC) tests
+# to EXT (which defaults to f).  Also, look for any necessary additional
+# FCFLAGS needed to allow this extension for preprocessed Fortran, and store
+# them in the output variable FCFLAGS_<EXT> (e.g. FCFLAGS_f90 for EXT=f90).
+# If successful, call ACTION-IF-SUCCESS.  If unable to compile preprocessed
+# source code with EXT, call ACTION-IF-FAILURE, which defaults to failing with
+# an error message.
+#
+# Some compilers allow preprocessing with either a Fortran preprocessor or
+# with the C preprocessor (cpp).  Prefer the Fortran preprocessor, to deal
+# correctly with continuation lines, `//' (not a comment), and preserve white
+# space (for fixed form).
+#
+# (The flags for the current source-code extension, if any, are stored in
+# $ac_fcflags_srcext and used automatically in subsequent autoconf tests.)
+#
+# For ordinary extensions like f90, etcetera, the modified FCFLAGS
+# are needed for IBM's xlf*.  Also, for Intel's ifort compiler, the
+# $FCFLAGS_<EXT> variable *must* go immediately before the source file on the
+# command line, unlike other $FCFLAGS.  Ugh.
+#
+# Known extensions that enable preprocessing by default, and flags to force it:
+# GNU: .F .F90 .F95 .F03 .F08, -cpp for most others,
+#      -x f77-cpp-input for .f77 .F77; -x f95-cpp-input for gfortran < 4.4
+# SGI: .F .F90, -ftpp or -cpp for .f .f90, -E write preproc to stdout
+#      -macro_expand enable macro expansion everywhere (with -ftpp)
+#      -P preproc only, save in .i, no #line's
+# SUN: .F .F95, -fpp for others; -xpp={fpp,cpp} for preprocessor selection
+#      -F preprocess only (save in lowercase extension)
+# IBM: .F .F77 .F90 .F95 .F03, -qsuffix=cpp=EXT for extension .EXT to invoke cpp
+#      -WF,-qnofpp -WF,-qfpp=comment:linecont:nocomment:nolinecont
+#      -WF,-qlanglvl=classic or not -qnoescape (trigraph problems)
+#      -d no #line in output, -qnoobject for preprocessing only (output in .f)
+#      -q{no,}ppsuborigarg substitute original macro args before expansion
+# HP:  .F, +cpp={yes|no|default} use cpp, -cpp, +cpp_keep save in .i/.i90
+# PGI: -Mpreprocess
+# Absoft: .F .FOR .F90 .F95, -cpp for others
+# Cray: .F .F90 .FTN, -e Z for others; -F enable macro expansion everywhere
+# Intel: .F .F90, -fpp for others, but except for .f and .f90, -Tf may also be
+#        needed right before the source file name
+# PathScale: .F .F90 .F95, -ftpp or -cpp for .f .f90 .f95
+#         -macro_expand for expansion everywhere, -P for no #line in output
+# Lahey: .F .FOR .F90 .F95, -Cpp
+# NAGWare: .F .F90 .F95, .ff .ff90 .ff95 (new), -fpp for others
+# Compaq/Tru64: .F .F90, -cpp, -P keep .i file, -P keep .i file
+# f2c: .F, -cpp
+# g95: .F .FOR .F90 .F95 .F03, -cpp -no-cpp, -E for stdout
+m4_version_prereq([2.68], [], [
+AC_DEFUN([AC_FC_PP_SRCEXT],
+[AC_LANG_PUSH(Fortran)dnl
+AC_CACHE_CHECK([for Fortran flag to compile preprocessed .$1 files],
+		ac_cv_fc_pp_srcext_$1,
+[ac_ext=$1
+ac_fcflags_pp_srcext_save=$ac_fcflags_srcext
+ac_fcflags_srcext=
+ac_cv_fc_pp_srcext_$1=unknown
+case $ac_ext in #(
+  [[fF]]77) ac_try=f77-cpp-input;; #(
+  *) ac_try=f95-cpp-input;;
+esac
+for ac_flag in none -ftpp -fpp -Tf "-fpp -Tf" -xpp=fpp -Mpreprocess "-e Z" \
+               -cpp -xpp=cpp -qsuffix=cpp=$1 "-x $ac_try" +cpp -Cpp; do
+  test "x$ac_flag" != xnone && ac_fcflags_srcext="$ac_flag"
+  AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [[
+#if 0
+#include <ac_nonexistent.h>
+      choke me
+#endif]])],
+    [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [[
+#if 1
+#include <ac_nonexistent.h>
+      choke me
+#endif]])],
+       [],
+       [ac_cv_fc_pp_srcext_$1=$ac_flag; break])])
+done
+rm -f conftest.$ac_objext conftest.$1
+ac_fcflags_srcext=$ac_fcflags_pp_srcext_save
+])
+if test "x$ac_cv_fc_pp_srcext_$1" = xunknown; then
+  m4_default([$3],
+             [AC_MSG_ERROR([Fortran could not compile preprocessed .$1 files])])
+else
+  ac_fc_srcext=$1
+  if test "x$ac_cv_fc_pp_srcext_$1" = xnone; then
+    ac_fcflags_srcext=""
+    FCFLAGS_[]$1[]=""
+  else
+    ac_fcflags_srcext=$ac_cv_fc_pp_srcext_$1
+    FCFLAGS_[]$1[]=$ac_cv_fc_pp_srcext_$1
+  fi
+  AC_SUBST(FCFLAGS_[]$1)
+  $2
+fi
+AC_LANG_POP(Fortran)dnl
+])# AC_FC_PP_SRCEXT
+])
+
+# AC_FC_PP_DEFINE([ACTION-IF-SUCCESS], [ACTION-IF-FAILURE = FAILURE])
+# -------------------------------------------------------------------
+# Find a flag to specify defines for preprocessed Fortran.  Not all
+# Fortran compilers use -D.  Substitute FC_DEFINE with the result and
+# call ACTION-IF-SUCCESS (defaults to nothing) if successful, and
+# ACTION-IF-FAILURE (defaults to failing with an error message) if not.
+#
+# Known flags:
+# IBM: -WF,-D
+# Lahey/Fujitsu: -Wp,-D     older versions???
+# f2c: -D or -Wc,-D
+# others: -D
+m4_version_prereq([2.68], [], [
+AC_DEFUN([AC_FC_PP_DEFINE],
+[AC_LANG_PUSH([Fortran])dnl
+ac_fc_pp_define_srcext_save=$ac_fc_srcext
+AC_FC_PP_SRCEXT([F])
+AC_CACHE_CHECK([how to define symbols for preprocessed Fortran],
+  [ac_cv_fc_pp_define],
+[ac_fc_pp_define_srcext_save=$ac_fc_srcext
+ac_cv_fc_pp_define=unknown
+ac_fc_pp_define_FCFLAGS_save=$FCFLAGS
+for ac_flag in -D -WF,-D -Wp,-D -Wc,-D
+do
+  FCFLAGS="$ac_fc_pp_define_FCFLAGS_save ${ac_flag}FOOBAR ${ac_flag}ZORK=42"
+  AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [[
+#ifndef FOOBAR
+      choke me
+#endif
+#if ZORK != 42
+      choke me
+#endif]])],
+    [ac_cv_fc_pp_define=$ac_flag])
+  test x"$ac_cv_fc_pp_define" != xunknown && break
+done
+FCFLAGS=$ac_fc_pp_define_FCFLAGS_save
+])
+ac_fc_srcext=$ac_fc_pp_define_srcext_save
+if test "x$ac_cv_fc_pp_define" = xunknown; then
+  FC_DEFINE=
+  m4_default([$2],
+	     [AC_MSG_ERROR([Fortran does not allow to define preprocessor symbols], 77)])
+else
+  FC_DEFINE=$ac_cv_fc_pp_define
+  $1
+fi
+AC_SUBST([FC_DEFINE])dnl
+AC_LANG_POP([Fortran])dnl
+])
+])
+
+
+#
+# The following three macros are from autoconf 2.69 (which is quite new).
+#
+
+# AC_FC_MODULE_EXTENSION
+# ----------------------
+# Find the Fortran 90 module file extension.  The module extension is stored
+# in the variable FC_MODEXT and empty if it cannot be determined.  The result
+# or "unknown" is cached in the cache variable ac_cv_fc_module_ext.
+m4_version_prereq([2.69], [], [
+AC_DEFUN([AC_FC_MODULE_EXTENSION],
+[AC_CACHE_CHECK([Fortran 90 module extension], [ac_cv_fc_module_ext],
+[AC_LANG_PUSH([Fortran])
+mkdir conftest.dir
+cd conftest.dir
+ac_cv_fc_module_ext=unknown
+AC_COMPILE_IFELSE([[
+      module conftest_module
+      contains
+      subroutine conftest_routine
+      write(*,'(a)') 'gotcha!'
+      end subroutine
+      end module]],
+  [ac_cv_fc_module_ext=`ls | sed -n 's,conftest_module\.,,p'`
+   if test x$ac_cv_fc_module_ext = x; then
+dnl Some F90 compilers use upper case characters for the module file name.
+     ac_cv_fc_module_ext=`ls | sed -n 's,CONFTEST_MODULE\.,,p'`
+   fi])
+cd ..
+rm -rf conftest.dir
+AC_LANG_POP([Fortran])
+])
+FC_MODEXT=$ac_cv_fc_module_ext
+if test "$FC_MODEXT" = unknown; then
+  FC_MODEXT=
+fi
+AC_SUBST([FC_MODEXT])dnl
+])
+])
+
+
+# AC_FC_MODULE_FLAG([ACTION-IF-SUCCESS], [ACTION-IF-FAILURE = FAILURE])
+# ---------------------------------------------------------------------
+# Find a flag to include Fortran 90 modules from another directory.
+# If successful, run ACTION-IF-SUCCESS (defaults to nothing), otherwise
+# run ACTION-IF-FAILURE (defaults to failing with an error message).
+# The module flag is cached in the ac_cv_fc_module_flag variable.
+# It may contain significant trailing whitespace.
+#
+# Known flags:
+# gfortran: -Idir, -I dir (-M dir, -Mdir (deprecated), -Jdir for writing)
+# g95: -I dir (-fmod=dir for writing)
+# SUN: -Mdir, -M dir (-moddir=dir for writing;
+#                     -Idir for includes is also searched)
+# HP: -Idir, -I dir (+moddir=dir for writing)
+# IBM: -Idir (-qmoddir=dir for writing)
+# Intel: -Idir -I dir (-mod dir for writing)
+# Absoft: -pdir
+# Lahey: -mod dir
+# Cray: -module dir, -p dir (-J dir for writing)
+#       -e m is needed to enable writing .mod files at all
+# Compaq: -Idir
+# NAGWare: -I dir
+# PathScale: -I dir  (but -module dir is looked at first)
+# Portland: -module dir (first -module also names dir for writing)
+# Fujitsu: -Am -Idir (-Mdir for writing is searched first, then '.', then -I)
+#                    (-Am indicates how module information is saved)
+m4_version_prereq([2.69], [], [
+AC_DEFUN([AC_FC_MODULE_FLAG],[
+AC_CACHE_CHECK([Fortran 90 module inclusion flag], [ac_cv_fc_module_flag],
+[AC_LANG_PUSH([Fortran])
+ac_cv_fc_module_flag=unknown
+mkdir conftest.dir
+cd conftest.dir
+AC_COMPILE_IFELSE([[
+      module conftest_module
+      contains
+      subroutine conftest_routine
+      write(*,'(a)') 'gotcha!'
+      end subroutine
+      end module]],
+  [cd ..
+   ac_fc_module_flag_FCFLAGS_save=$FCFLAGS
+   # Flag ordering is significant for gfortran and Sun.
+   for ac_flag in -M -I '-I ' '-M ' -p '-mod ' '-module ' '-Am -I'; do
+     # Add the flag twice to prevent matching an output flag.
+     FCFLAGS="$ac_fc_module_flag_FCFLAGS_save ${ac_flag}conftest.dir ${ac_flag}conftest.dir"
+     AC_COMPILE_IFELSE([[
+      program main
+      use conftest_module
+      call conftest_routine
+      end program]],
+       [ac_cv_fc_module_flag="$ac_flag"])
+     if test "$ac_cv_fc_module_flag" != unknown; then
+       break
+     fi
+   done
+   FCFLAGS=$ac_fc_module_flag_FCFLAGS_save
+])
+rm -rf conftest.dir
+AC_LANG_POP([Fortran])
+])
+if test "$ac_cv_fc_module_flag" != unknown; then
+  FC_MODINC=$ac_cv_fc_module_flag
+  $1
+else
+  FC_MODINC=
+  m4_default([$2],
+    [AC_MSG_ERROR([unable to find compiler flag for module search path])])
+fi
+AC_SUBST([FC_MODINC])
+# Ensure trailing whitespace is preserved in a Makefile.
+AC_SUBST([ac_empty], [""])
+AC_CONFIG_COMMANDS_PRE([case $FC_MODINC in #(
+  *\ ) FC_MODINC=$FC_MODINC'${ac_empty}' ;;
+esac])dnl
+])
+])
+
+
+# AC_FC_MODULE_OUTPUT_FLAG([ACTION-IF-SUCCESS], [ACTION-IF-FAILURE = FAILURE])
+# ----------------------------------------------------------------------------
+# Find a flag to write Fortran 90 module information to another directory.
+# If successful, run ACTION-IF-SUCCESS (defaults to nothing), otherwise
+# run ACTION-IF-FAILURE (defaults to failing with an error message).
+# The module flag is cached in the ac_cv_fc_module_output_flag variable.
+# It may contain significant trailing whitespace.
+#
+# For known flags, see the documentation of AC_FC_MODULE_FLAG above.
+m4_version_prereq([2.69], [], [
+AC_DEFUN([AC_FC_MODULE_OUTPUT_FLAG],[
+AC_CACHE_CHECK([Fortran 90 module output flag], [ac_cv_fc_module_output_flag],
+[AC_LANG_PUSH([Fortran])
+mkdir conftest.dir conftest.dir/sub
+cd conftest.dir
+ac_cv_fc_module_output_flag=unknown
+ac_fc_module_output_flag_FCFLAGS_save=$FCFLAGS
+# Flag ordering is significant: put flags late which some compilers use
+# for the search path.
+for ac_flag in -J '-J ' -fmod= -moddir= +moddir= -qmoddir= '-mod ' \
+	      '-module ' -M '-Am -M' '-e m -J '; do
+  FCFLAGS="$ac_fc_module_output_flag_FCFLAGS_save ${ac_flag}sub"
+  AC_COMPILE_IFELSE([[
+      module conftest_module
+      contains
+      subroutine conftest_routine
+      write(*,'(a)') 'gotcha!'
+      end subroutine
+      end module]],
+    [cd sub
+     AC_COMPILE_IFELSE([[
+      program main
+      use conftest_module
+      call conftest_routine
+      end program]],
+       [ac_cv_fc_module_output_flag="$ac_flag"])
+     cd ..
+     if test "$ac_cv_fc_module_output_flag" != unknown; then
+       break
+     fi])
+done
+FCFLAGS=$ac_fc_module_output_flag_FCFLAGS_save
+cd ..
+rm -rf conftest.dir
+AC_LANG_POP([Fortran])
+])
+if test "$ac_cv_fc_module_output_flag" != unknown; then
+  FC_MODOUT=$ac_cv_fc_module_output_flag
+  $1
+else
+  FC_MODOUT=
+  m4_default([$2],
+    [AC_MSG_ERROR([unable to find compiler flag to write module information to])])
+fi
+AC_SUBST([FC_MODOUT])
+# Ensure trailing whitespace is preserved in a Makefile.
+AC_SUBST([ac_empty], [""])
+AC_CONFIG_COMMANDS_PRE([case $FC_MODOUT in #(
+  *\ ) FC_MODOUT=$FC_MODOUT'${ac_empty}' ;;
+esac])dnl
+])
+])
+
+
 dnl End of file
diff --git a/cit_cuda.m4 b/cit_cuda.m4
index e306673..fd9924f 100644
--- a/cit_cuda.m4
+++ b/cit_cuda.m4
@@ -1,53 +1,65 @@
 # -*- Autoconf -*-
 
 
-## --------------------------- ##
+## ------------------------- ##
 ## Autoconf macros for CUDA. ##
-## --------------------------- ##
+## ------------------------- ##
+
 
 # ----------------------------------------------------------------------
-# CIT_CUDA_INCDIR
+# CIT_CUDA_CONFIG
 # ----------------------------------------------------------------------
 # Determine the directory containing <cuda_runtime.h>
-AC_DEFUN([CIT_CUDA_INCDIR], [
-  AC_REQUIRE_CPP
-  AC_LANG(C++)
-  AC_CHECK_HEADER([cuda_runtime.h], [], [
-    AC_MSG_ERROR([CUDA runtime header not found; try CPPFLAGS="-I<CUDA include dir>"])
-  ])dnl
-])dnl CIT_CUDA_INCDIR
+AC_DEFUN([CIT_CUDA_CONFIG], [
+  AC_ARG_VAR(CUDA_INC, [Location of CUDA include files])
+  AC_ARG_VAR(CUDA_LIB, [Location of CUDA library libcudart])
 
+  dnl Check for compiler
+  AC_PATH_PROG(NVCC, nvcc)
+  if test -z "$NVCC" ; then
+    AC_MSG_ERROR([cannot find 'nvcc' program.])
+  fi
 
-# ----------------------------------------------------------------------
-# CIT_CUDA_LIB
-# ----------------------------------------------------------------------
-# Checking for the CUDA library.
-AC_DEFUN([CIT_CUDA_LIB], [
+  AC_LANG_PUSH([C++])
   AC_REQUIRE_CPP
-  AC_LANG(C++)
-  AC_MSG_CHECKING([for cudaMalloc in -lcuda])
-  AC_COMPILE_IFELSE(
+  CPPFLAGS_save="$CPPFLAGS"
+  LDFLAGS_save="$LDFLAGS"
+  LIBS_save="$LIBS"
+
+  dnl Check for CUDA headers
+  if test "x$CUDA_INC" != "x"; then
+    CUDA_CPPFLAGS="-I$CUDA_INC"
+    CPPFLAGS="$CUDA_CPPFLAGS $CPPFLAGS"
+  fi
+  AC_CHECK_HEADER([cuda_runtime.h], [], [
+    AC_MSG_ERROR([CUDA runtime header not found; try setting CUDA_INC.])
+  ])
+
+  if test "x$CUDA_LIB" != "x"; then
+    CUDA_LDFLAGS="-L$CUDA_LIB"
+    LDFLAGS="$CUDA_LDFLAGS $LDFLAGS"
+  fi
+  CUDA_LIBS="-lcudart"
+  LIBS="$CUDA_LIBS $LIBS"
+  AC_MSG_CHECKING([for cudaMalloc in -lcudart])
+  AC_LINK_IFELSE(
     [AC_LANG_PROGRAM([[#include <cuda_runtime.h>]],
                      [[void* ptr = 0;]]
   	             [[cudaMalloc(&ptr, 1);]])],
     [AC_MSG_RESULT(yes)],
     [AC_MSG_RESULT(no)
-     AC_MSG_ERROR([cuda library not found.])
-  ])dnl
-])dnl CIT_CUDA_LIB
+     AC_MSG_ERROR([CUDA library not found; try setting CUDA_LIB.])
+  ])
 
-# ----------------------------------------------------------------------
-# CIT_CUDA_COMPILER
-# ----------------------------------------------------------------------
-# Checking for the CUDA compiler.
-AC_DEFUN([CIT_CUDA_COMPILER], [
-  AC_PATH_PROG(NVCC, nvcc)
-  if test -z "$NVCC" ; then
-    AC_MSG_FAILURE([cannot find 'nvcc' program.])
-    NVCC=`echo "Error: nvcc is not installed." ; false`
-  fi
-])dnl CIT_CUDA_COMPILER
+  CPPFLAGS="$CPPFLAGS_save"
+  LDFLAGS="$LDFLAGS_save"
+  LIBS="$LIBS_save"
+  AC_LANG_POP([C++])
 
+  AC_SUBST([CUDA_CPPFLAGS])
+  AC_SUBST([CUDA_LDFLAGS])
+  AC_SUBST([CUDA_LIBS])
+])dnl CIT_CUDA_COMPILER
 
 
 dnl end of file
diff --git a/cit_fortran.m4 b/cit_fortran.m4
index 1678834..b80e80d 100644
--- a/cit_fortran.m4
+++ b/cit_fortran.m4
@@ -305,182 +305,4 @@ AC_LANG_PROGRAM([], [[
 ]])
 ])dnl _CIT_FC_TRIVIAL_MPI_PROGRAM
 
-
-#
-# The following three macros are from autoconf 2.69 (which is quite new).
-#
-
-# CIT_FC_MODULE_EXTENSION
-# ----------------------
-# Find the Fortran 90 module file extension.  The module extension is stored
-# in the variable FC_MODEXT and empty if it cannot be determined.  The result
-# or "unknown" is cached in the cache variable ac_cv_fc_module_ext.
-AC_DEFUN([CIT_FC_MODULE_EXTENSION],
-[AC_CACHE_CHECK([Fortran 90 module extension], [ac_cv_fc_module_ext],
-[AC_LANG_PUSH(Fortran)
-mkdir conftest.dir
-cd conftest.dir
-ac_cv_fc_module_ext=unknown
-AC_COMPILE_IFELSE([[
-      module conftest_module
-      contains
-      subroutine conftest_routine
-      write(*,'(a)') 'gotcha!'
-      end subroutine
-      end module]],
-  [ac_cv_fc_module_ext=`ls | sed -n 's,conftest_module\.,,p'`
-   if test x$ac_cv_fc_module_ext = x; then
-dnl Some F90 compilers use upper case characters for the module file name.
-     ac_cv_fc_module_ext=`ls | sed -n 's,CONFTEST_MODULE\.,,p'`
-   fi])
-cd ..
-rm -rf conftest.dir
-AC_LANG_POP(Fortran)
-])
-FC_MODEXT=$ac_cv_fc_module_ext
-if test "$FC_MODEXT" = unknown; then
-  FC_MODEXT=
-fi
-AC_SUBST([FC_MODEXT])dnl
-])
-
-
-# CIT_FC_MODULE_FLAG([ACTION-IF-SUCCESS], [ACTION-IF-FAILURE = FAILURE])
-# ---------------------------------------------------------------------
-# Find a flag to include Fortran 90 modules from another directory.
-# If successful, run ACTION-IF-SUCCESS (defaults to nothing), otherwise
-# run ACTION-IF-FAILURE (defaults to failing with an error message).
-# The module flag is cached in the ac_cv_fc_module_flag variable.
-# It may contain significant trailing whitespace.
-#
-# Known flags:
-# gfortran: -Idir, -I dir (-M dir, -Mdir (deprecated), -Jdir for writing)
-# g95: -I dir (-fmod=dir for writing)
-# SUN: -Mdir, -M dir (-moddir=dir for writing;
-#                     -Idir for includes is also searched)
-# HP: -Idir, -I dir (+moddir=dir for writing)
-# IBM: -Idir (-qmoddir=dir for writing)
-# Intel: -Idir -I dir (-mod dir for writing)
-# Absoft: -pdir
-# Lahey: -mod dir
-# Cray: -module dir, -p dir (-J dir for writing)
-#       -e m is needed to enable writing .mod files at all
-# Compaq: -Idir
-# NAGWare: -I dir
-# PathScale: -I dir  (but -module dir is looked at first)
-# Portland: -module dir (first -module also names dir for writing)
-# Fujitsu: -Am -Idir (-Mdir for writing is searched first, then '.', then -I)
-#                    (-Am indicates how module information is saved)
-AC_DEFUN([CIT_FC_MODULE_FLAG],[
-AC_CACHE_CHECK([Fortran 90 module inclusion flag], [ac_cv_fc_module_flag],
-[AC_LANG_PUSH([Fortran])
-ac_cv_fc_module_flag=unknown
-mkdir conftest.dir
-cd conftest.dir
-AC_COMPILE_IFELSE([[
-      module conftest_module
-      contains
-      subroutine conftest_routine
-      write(*,'(a)') 'gotcha!'
-      end subroutine
-      end module]],
-  [cd ..
-   ac_fc_module_flag_FCFLAGS_save=$FCFLAGS
-   # Flag ordering is significant for gfortran and Sun.
-   for ac_flag in -M -I '-I ' '-M ' -p '-mod ' '-module ' '-Am -I'; do
-     # Add the flag twice to prevent matching an output flag.
-     FCFLAGS="$ac_fc_module_flag_FCFLAGS_save ${ac_flag}conftest.dir ${ac_flag}conftest.dir"
-     AC_COMPILE_IFELSE([[
-      program main
-      use conftest_module
-      call conftest_routine
-      end program]],
-       [ac_cv_fc_module_flag="$ac_flag"])
-     if test "$ac_cv_fc_module_flag" != unknown; then
-       break
-     fi
-   done
-   FCFLAGS=$ac_fc_module_flag_FCFLAGS_save
-])
-rm -rf conftest.dir
-AC_LANG_POP([Fortran])
-])
-if test "$ac_cv_fc_module_flag" != unknown; then
-  FC_MODINC=$ac_cv_fc_module_flag
-  $1
-else
-  FC_MODINC=
-  m4_default([$2],
-    [AC_MSG_ERROR([unable to find compiler flag for module search path])])
-fi
-AC_SUBST([FC_MODINC])
-# Ensure trailing whitespace is preserved in a Makefile.
-AC_SUBST([ac_empty], [""])
-AC_CONFIG_COMMANDS_PRE([case $FC_MODINC in #(
-  *\ ) FC_MODINC=$FC_MODINC'${ac_empty}' ;;
-esac])dnl
-])
-
-
-# CIT_FC_MODULE_OUTPUT_FLAG([ACTION-IF-SUCCESS], [ACTION-IF-FAILURE = FAILURE])
-# ----------------------------------------------------------------------------
-# Find a flag to write Fortran 90 module information to another directory.
-# If successful, run ACTION-IF-SUCCESS (defaults to nothing), otherwise
-# run ACTION-IF-FAILURE (defaults to failing with an error message).
-# The module flag is cached in the ac_cv_fc_module_output_flag variable.
-# It may contain significant trailing whitespace.
-#
-# For known flags, see the documentation of CIT_FC_MODULE_FLAG above.
-AC_DEFUN([CIT_FC_MODULE_OUTPUT_FLAG],[
-AC_CACHE_CHECK([Fortran 90 module output flag], [ac_cv_fc_module_output_flag],
-[AC_LANG_PUSH([Fortran])
-mkdir conftest.dir conftest.dir/sub
-cd conftest.dir
-ac_cv_fc_module_output_flag=unknown
-ac_fc_module_output_flag_FCFLAGS_save=$FCFLAGS
-# Flag ordering is significant: put flags late which some compilers use
-# for the search path.
-for ac_flag in -J '-J ' -fmod= -moddir= +moddir= -qmoddir= '-mod ' \
-	      '-module ' -M '-Am -M' '-e m -J '; do
-  FCFLAGS="$ac_fc_module_output_flag_FCFLAGS_save ${ac_flag}sub"
-  AC_COMPILE_IFELSE([[
-      module conftest_module
-      contains
-      subroutine conftest_routine
-      write(*,'(a)') 'gotcha!'
-      end subroutine
-      end module]],
-    [cd sub
-     AC_COMPILE_IFELSE([[
-      program main
-      use conftest_module
-      call conftest_routine
-      end program]],
-       [ac_cv_fc_module_output_flag="$ac_flag"])
-     cd ..
-     if test "$ac_cv_fc_module_output_flag" != unknown; then
-       break
-     fi])
-done
-FCFLAGS=$ac_fc_module_output_flag_FCFLAGS_save
-cd ..
-rm -rf conftest.dir
-AC_LANG_POP([Fortran])
-])
-if test "$ac_cv_fc_module_output_flag" != unknown; then
-  FC_MODOUT=$ac_cv_fc_module_output_flag
-  $1
-else
-  FC_MODOUT=
-  m4_default([$2],
-    [AC_MSG_ERROR([unable to find compiler flag to write module information to])])
-fi
-AC_SUBST([FC_MODOUT])
-# Ensure trailing whitespace is preserved in a Makefile.
-AC_SUBST([ac_empty], [""])
-AC_CONFIG_COMMANDS_PRE([case $FC_MODOUT in #(
-  *\ ) FC_MODOUT=$FC_MODOUT'${ac_empty}' ;;
-esac])dnl
-])
-
 dnl end of file
diff --git a/cit_mpi.m4 b/cit_mpi.m4
index 798b301..f069804 100644
--- a/cit_mpi.m4
+++ b/cit_mpi.m4
@@ -486,4 +486,37 @@ AC_DEFUN([CIT_MPI_LINK_INFO_SWITCHES], ["-show" "-showme" "-echo" "-link_info"])
 AC_DEFUN([CIT_SKIP_MPICXX_DEFINES], ["-DMPICH_SKIP_MPICXX" "-UHAVE_MPI_CPP" "-DLAM_WANT_MPI2CPP=0" "-DLAM_BUILDING=1" "-DOMPI_WANT_CXX_BINDINGS=0" "-DOMPI_BUILDING=1"])
 
 
+# CIT_MPI_INCDIR(COMMAND)
+# --------------
+# Check for MPI C++ header used by COMMAND
+# User may set MPI_INC to these directories or else it's auto-detected.
+# Result is stored in MPI_INCLUDES.
+AC_DEFUN([CIT_MPI_INCDIR], [
+  AC_ARG_VAR(MPI_INC, [Location of MPI include mpi.h, needed by CUDA/VTK (default: auto-detect)])
+  AC_LANG_PUSH([C++])
+  AC_REQUIRE_CPP
+  CPPFLAGS_save="$CPPFLAGS"
+
+  if test "x$MPI_INC" = "x"; then
+    MPI_INC=`$1 -showme:incdirs`
+  fi
+  if test "x$MPI_INC" != "x"; then
+    dnl showme:incdirs may return multiple directories:
+    for i in $MPI_INC
+    do
+      MPI_INCLUDES="$MPI_INCLUDES -I$i"
+    done
+    CPPFLAGS="$MPI_INCLUDES $CPPFLAGS"
+  fi
+  AC_CHECK_HEADER([mpi.h], [], [
+    AC_MSG_ERROR([MPI header not found; try setting MPI_INC.])
+  ])
+
+  CPPFLAGS="$CPPFLAGS_save"
+  AC_LANG_POP([C++])
+
+  AC_SUBST([MPI_INCLUDES])
+])
+
+
 dnl end of file
diff --git a/cit_vtk.m4 b/cit_vtk.m4
new file mode 100644
index 0000000..b859f6b
--- /dev/null
+++ b/cit_vtk.m4
@@ -0,0 +1,215 @@
+##############################################################################
+# -*- Autoconf -*-
+#
+# Implements the AM_OPTIONS_VTK and AM_PATH_VTK macros.
+# The AM_OPTIONS_VTK macro adds the --with-vtk=path option,
+# and the AM_PATH_VTK macro is used to detect VTK presence,
+# location and version.
+#
+# Modified from http://www.vtk.org/Wiki/VTK_Autoconf
+# Originally by Francesco Montorsi
+#
+
+
+##############################################################################
+#
+# CIT_OPTIONS_VTK
+#
+# Adds the --with-vtk=PATH option to the configure options
+#
+AC_DEFUN([CIT_OPTIONS_VTK],[
+
+    # vtk install prefix
+    AC_ARG_WITH([vtk],
+                [AC_HELP_STRING(
+                    [--with-vtk],
+                    [The prefix where VTK is installed @<:@default=/usr@:>@])],
+                [with_vtk="$withval"],
+                [with_vtk="/usr"])
+
+    # vtk suffix, to allow for multiple installations of vtk libraries
+    AC_ARG_WITH([vtk-suffix],
+                [AC_HELP_STRING(
+                    [--with-vtk-suffix],
+                    [Suffix to append to VTK's include directory, e.g., for vtk-5.2/ the suffix is "-5.2"])],
+                [vtk_suffix="$withval"],
+                [vtk_suffix=""])
+
+    # alternatively, derive suffix from version number
+    AC_ARG_WITH([vtk-version],
+                [AC_HELP_STRING(
+                    [--with-vtk-version],
+                    [Version number of VTK library @<:@default=5.2@:>@])],
+                [vtk_version="$withval"],
+                [vtk_version="5.2"])
+
+    if test -z "$vtk_suffix"; then
+        #
+        # suffix was not specified. use the version number
+        # to calculate what it should be
+        #
+        if test -n "$vtk_version"; then
+            vtk_suffix="-$vtk_version"
+        fi
+
+    else
+        #
+        # suffix was specified. ignore version silently?
+        # produce error for now
+        #
+        if test -n "$vtk_version"; then
+            AC_MSG_ERROR([The option --with-vtk-suffix overrides --with-vtk-version. Do not use simultaneously.])
+        fi
+
+    fi
+])
+
+##############################################################################
+#
+# CIT_PATH_VTK([minimum-version], [action-if-found], [action-if-not-found])
+#
+# NOTE: [minimum-version] must be in the form [X.Y.Z]
+#
+AC_DEFUN([CIT_PATH_VTK],[
+
+    dnl do we want to check for VTK?
+    if test x$with_vtk = "xyes"; then
+        dnl in case user wrote --with-vtk=yes
+        with_vtk="/usr"
+    fi
+
+    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 test -z "$vtkFound"; then
+
+            dnl VTK not found!
+            AC_MSG_RESULT([no])
+            $3
+
+        else
+
+            dnl VTK found!
+            AC_MSG_RESULT([yes])
+
+            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
+            AC_LANG_PUSH([C])
+            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"
+            AC_CHECK_LIB(vtkIO, strcmp, [], [
+                VTK_SUPPORT_LIBS="-lvtktiff -lvtkpng -lvtkjpeg -lvtkzlib -lvtkexpat"
+                AC_CHECK_LIB(vtkIO, abort, [], [
+                    VTK_SUPPORT_LIBS="-ltiff -lpng -ljpeg -lz -lexpat"
+                    AC_CHECK_LIB(vtkIO, exit, [], [
+                        VTK_SUPPORT_LIBS=""
+                        AC_CHECK_LIB(vtkIO, strstr, [], [
+                            AC_MSG_ERROR([cannot link against VTK libraries])
+                        ], [$VTK_SUPPORT_LIBS])
+                    ], [$VTK_SUPPORT_LIBS])
+                ], [$VTK_SUPPORT_LIBS])
+            ], [$VTK_SUPPORT_LIBS])
+            VTK_LIBS="-lvtkIO -lvtkDICOMParser -lvtkFiltering -lvtkGenericFiltering -lvtkCommon $VTK_SUPPORT_LIBS -lvtksys"
+            LIBS="$VTK_LIBS $LIBS"
+
+            dnl now, check that we don't exceed the specified version
+            if test -n "$1"; then
+                dnl the version of VTK we need
+
+                maj=`echo $1 | sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
+                min=`echo $1 | sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
+                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 check if the installed VTK is greater or not
+                AC_COMPILE_IFELSE([
+                    AC_LANG_PROGRAM([[
+                        #include <vtk/vtkConfigure.h>
+                        #include <stdio.h>
+                        ]],[[
+                        printf("VTK version is: %d.%d.%d",
+                               VTK_MAJOR_VERSION,
+                               VTK_MINOR_VERSION,
+                               VTK_BUILD_VERSION);
+
+                        #if VTK_MAJOR_VERSION < $maj
+                        #error Installed VTK is too old!
+                        #endif
+
+                        #if VTK_MINOR_VERSION < $min
+                        #error Installed VTK is too old!
+                        #endif
+
+                        #if VTK_BUILD_VERSION < $rel
+                        #error Installed VTK is too old!
+                        #endif
+                    ]])
+                ], [vtkVersion="OK"])
+
+                dnl restore all flags without VTK values
+                CFLAGS=$OLD_CFLAGS
+                CXXFLAGS=$OLD_CXXFLAGS
+                LDFLAGS=$OLD_LDFLAGS
+                LIBS=$OLD_LIBS
+
+                if test "$vtkVersion" = "OK"; then
+                    AC_MSG_RESULT([yes])
+                    $2
+                else
+                    AC_MSG_RESULT([no])
+                    $3
+                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
+                $2
+
+            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])
+
+        fi          # if [[ -z "$vtkFound" ]];
+    fi          # $with_vtk != "no"
+
+    dnl Substitute the values of our VTK flags
+    AC_SUBST(VTK_INCLUDES)
+    AC_SUBST(VTK_LDFLAGS)
+    AC_SUBST(VTK_LIBS)
+])
+
+
+
+# vim: syntax=config



More information about the CIG-COMMITS mailing list