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

elliott.sales.de.andrade at geodynamics.org elliott.sales.de.andrade at geodynamics.org
Tue Jul 2 14:41:00 PDT 2013


Author: elliott.sales.de.andrade
Date: 2013-07-02 14:41:00 -0700 (Tue, 02 Jul 2013)
New Revision: 22492

Modified:
   cs/autoconf/trunk/cit_fortran.m4
Log:
Make CIT_FC_MPI_MODULE a bit more autoconf-y.

That is, allow overriding the default actions for when the module is
or isn't found. This was the simplest way to let me check for the mpi
module without changing every other user of this check.

Modified: cs/autoconf/trunk/cit_fortran.m4
===================================================================
--- cs/autoconf/trunk/cit_fortran.m4	2013-07-02 18:27:06 UTC (rev 22491)
+++ cs/autoconf/trunk/cit_fortran.m4	2013-07-02 21:41:00 UTC (rev 22492)
@@ -149,11 +149,14 @@
 ])dnl CIT_FC_STREAM_IO
 
 
-# CIT_FC_MPI_MODULE(FILENAME, MPIFC, MPIFCFLAGS)
+# CIT_FC_MPI_MODULE(FILENAME, MPIFC, MPIFCFLAGS,
+#                   [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
 # -----------------------------------------------------
 AC_DEFUN([CIT_FC_MPI_MODULE], [
-# Use 'mpi' module or 'mpif.h', as appropriate.  UNFINISHED.  This
-# strategy doesn't play well with "implicit none": whether the
+# Use 'mpi' module or 'mpif.h', as appropriate.  UNFINISHED.
+# The default actions are to create FILENAME that either uses the
+# appropriate module or includes the existing mpif.h.
+# This strategy doesn't play well with "implicit none": whether the
 # generated header must be included before or after "implicit none"
 # depends upon the result of the test!  It might be possible to make
 # "use mpi" always work: simply generate an 'mpi' module if the MPI
@@ -166,6 +169,7 @@
 trap "rm \"$cfgfile\"; exit 1" 1 2 15
 rm -f "$cfgfile"
 
+cit_fc_header=none
 cit_fc_save_fc=$FC
 cit_fc_save_fcflags=$FCFLAGS
 FC=$2
@@ -181,9 +185,10 @@
 ]])
 ], [
     AC_MSG_RESULT(yes)
-    cit_fc_header="use mpi"
+    m4_default([$4], [cit_fc_header="use mpi"])
 ], [
     AC_MSG_RESULT(no)
+    m4_default([$5], [
     AC_MSG_CHECKING([whether mpif.h works])
     AC_COMPILE_IFELSE([
         AC_LANG_PROGRAM([], [[
@@ -206,7 +211,7 @@
         AC_MSG_RESULT(no)
         AC_MSG_FAILURE([cannot compile a trivial MPI program using $2])
     ])
-])
+])])
 
 if test "$cit_fc_header" != "none"; then
     AC_MSG_NOTICE([creating $ofile])



More information about the CIG-COMMITS mailing list