[mpich2-commits] r7970 - in mpich2/trunk: . confdb

chan at mcs.anl.gov chan at mcs.anl.gov
Tue Feb 15 14:44:27 CST 2011


Author: chan
Date: 2011-02-15 14:44:27 -0600 (Tue, 15 Feb 2011)
New Revision: 7970

Modified:
   mpich2/trunk/confdb/aclocal_f77.m4
   mpich2/trunk/configure.in
Log:
rwritten more tests that have explicit references of OBJEXT/EXEEXT. The test for sizeof(MPI_Status) is replaced with one uses cross-compile freiendly AC_COMPUTE_INT.



Modified: mpich2/trunk/confdb/aclocal_f77.m4
===================================================================
--- mpich2/trunk/confdb/aclocal_f77.m4	2011-02-15 20:10:59 UTC (rev 7969)
+++ mpich2/trunk/confdb/aclocal_f77.m4	2011-02-15 20:44:27 UTC (rev 7970)
@@ -216,6 +216,7 @@
 dnl
 dnl D*/
 AC_DEFUN([PAC_PROG_F77_CHECK_SIZEOF],[
+AC_REQUIRE([AC_HEADER_STDC])
 AC_REQUIRE([AC_F77_LIBRARY_LDFLAGS])
 changequote(<<, >>)dnl
 dnl The name to #define.
@@ -243,7 +244,9 @@
     AC_LANG_PUSH([C])
     AC_RUN_IFELSE([
         AC_LANG_PROGRAM([
+#if defined(HAVE_STDIO_H) || defined(STDC_HEADERS)
 #include <stdio.h>
+#endif
 #ifdef F77_NAME_UPPER
 #define cisize_ CISIZE
 #define isize_ ISIZE
@@ -307,6 +310,7 @@
 define(<<PAC_CV_NAME>>, translit(pac_cv_f77_sizeof_$1, [ *], [__]))dnl
 changequote([,])dnl
 AC_CACHE_CHECK([for size of Fortran type $1],PAC_CV_NAME,[
+AC_REQUIRE([AC_HEADER_STDC])
 AC_REQUIRE([PAC_PROG_F77_NAME_MANGLE])
 dnl if test "$cross_compiling" = yes ; then
 dnl     ifelse([$2],[],
@@ -316,7 +320,9 @@
 AC_LANG_PUSH([C])
 AC_COMPILE_IFELSE([
     AC_LANG_SOURCE([
+#if defined(HAVE_STDIO_H) || defined(STDC_HEADERS)
 #include <stdio.h>
+#endif
 #ifdef F77_NAME_UPPER
 #define cisize_ CISIZE
 #define isize_ ISIZE
@@ -691,6 +697,7 @@
 dnl to select the appropriate Fortran name.
 dnl 
 AC_DEFUN([PAC_PROG_F77_RUN_PROC_FROM_C],[
+AC_REQUIRE([AC_HEADER_STDC])
 AC_REQUIRE([AC_F77_LIBRARY_LDFLAGS])
 AC_LANG_PUSH([Fortran 77])
 AC_COMPILE_IFELSE([
@@ -704,7 +711,9 @@
     AC_LANG_PUSH([C])
     AC_RUN_IFELSE([
         AC_LANG_SOURCE([
+#if defined(HAVE_STDIO_H) || defined(STDC_HEADERS)
 #include <stdio.h>
+#endif
 #ifdef F77_NAME_UPPER
 #define ftest_ FTEST
 #elif defined(F77_NAME_LOWER) || defined(F77_NAME_MIXED)
@@ -742,6 +751,7 @@
 dnl 
 dnl
 AC_DEFUN([PAC_PROG_F77_IN_C_LIBS],[
+AC_REQUIRE([AC_HEADER_STDC])
 AC_REQUIRE([AC_F77_LIBRARY_LDFLAGS])
 AC_MSG_CHECKING([for which Fortran libraries are needed to link C with Fortran])
 F77_IN_C_LIBS="invalid"
@@ -762,7 +772,9 @@
     # Create conftest for all link tests.
     AC_LANG_CONFTEST([
         AC_LANG_PROGRAM([
+#if defined(HAVE_STDIO_H) || defined(STDC_HEADERS)
 #include <stdio.h>
+#endif
         ],[
 #ifdef F77_NAME_UPPER
 #define ftest_ FTEST
@@ -951,6 +963,7 @@
 dnl add it to F77_OTHER_LIBS
 dnl
 AC_DEFUN([PAC_PROG_F77_AND_C_STDIO_LIBS],[
+AC_REQUIRE([AC_HEADER_STDC])
 AC_REQUIRE([PAC_PROG_F77_NAME_MANGLE])
 # To simply the code in the cache_check macro, chose the routine name
 # first, in case we need it
@@ -971,7 +984,9 @@
 AC_LANG_PUSH([C])
 AC_COMPILE_IFELSE([
     AC_LANG_SOURCE([
+#if defined(HAVE_STDIO_H) || defined(STDC_HEADERS)
 #include <stdio.h>
+#endif
 int $confname(int a) {
     printf( "The answer is %d\n", a ); fflush(stdout); return 0;
 }
@@ -1272,3 +1287,157 @@
     ifelse([$2],[],[:],[$2])
 fi
 ])
+dnl
+dnl
+dnl PAC_F77_INIT_WORKS_WITH_C
+dnl
+AC_DEFUN(PAC_F77_INIT_WORKS_WITH_C,[
+AC_REQUIRE([AC_HEADER_STDC])
+AC_MSG_CHECKING([whether Fortran init will work with C])
+pac_f_init_works_with_c=unknown
+AC_LANG_PUSH([Fortran 77])
+AC_COMPILE_IFELSE([
+    AC_LANG_SOURCE([
+        subroutine minit()
+        common /m1/ vc, vc2
+        character *1 vc(1,1), vc2(1)
+        common /m2/ vd
+        integer vd
+        save /m1/, /m2/
+        call minitc( vc, vc2, vd )
+        end
+    ])
+],[
+    PAC_RUNLOG([mv conftest.$OBJEXT pac_f77conftest.$OBJEXT])
+    saved_LIBS="$LIBS"
+    LIBS="pac_f77conftest.$OBJEXT $FLIBS $LIBS"
+    AC_LANG_PUSH([C])
+    AC_LINK_IFELSE([
+        AC_LANG_SOURCE([
+#if defined(HAVE_STDIO_H) || defined(STDC_HEADERS)
+#include <stdio.h>
+#endif
+#ifdef F77_NAME_UPPER
+#define minit_ MINIT
+#elif defined(F77_NAME_LOWER) || defined(F77_NAME_MIXED)
+#define minit_ minit
+#endif
+int main( int argc, char *argv )
+{
+    minit_();
+    return 0;
+}
+char *v1 = 0;
+char *vc2 = 0;
+int  v2 = 0;
+minitc_( char *dv1, int d, char *dv2, int d2, int dv3 )
+{
+v1 = dv1;
+v2 = dv3;
+vc2 = dv2;
+*vc2 = ' ';
+}
+        ])
+    ],[pac_f_init_works_with_c=yes],[pac_f_init_works_with_c=no])
+    AC_LANG_POP([C])
+    LIBS="$saved_LIBS"
+    rm -f pac_f77conftest.$OBJEXT
+])
+AC_LANG_POP([Fortran 77])
+AC_MSG_RESULT([$pac_f_init_works_with_c])
+])
+dnl
+dnl PAC_F77_LOGICALS_IN_C(MPI_FINT)
+dnl
+dnl where MPI_FINT is the C type for Fortran integer.
+dnl
+dnl Use a Fortran main program.  This simplifies some steps, 
+dnl since getting all of the Fortran libraries (including shared 
+dnl libraries that are not in the default library search path) can 
+dnl be tricky.  Specifically, The PROG_F77_RUN_PROC_FROM_C failed with 
+dnl some installations of the Portland group compiler.
+dnl
+dnl We'd also like to check other values for .TRUE. and .FALSE. to see
+dnl if the compiler allows (or uses) more than one value (some DEC compilers,
+dnl for example, used the high (sign) bit to indicate true and false; the 
+dnl rest of the bits were ignored.  For now, we'll assume that there are 
+dnl unique true and false values.
+dnl
+AC_DEFUN([PAC_F77_LOGICALS_IN_C],[
+AC_REQUIRE([AC_HEADER_STDC])
+AC_REQUIRE([PAC_PROG_F77_NAME_MANGLE])
+pac_mpi_fint="$1"
+AC_MSG_CHECKING([for values of Fortran logicals])
+AC_CACHE_VAL(pac_cv_prog_f77_true_false_value,[
+pac_cv_prog_f77_true_false_value=""
+AC_LANG_PUSH([C])
+AC_COMPILE_IFELSE([
+    AC_LANG_SOURCE([
+#if defined(HAVE_STDIO_H) || defined(STDC_HEADERS)
+#include <stdio.h>
+#endif
+#if defined(HAVE_STDLIB_H) || defined(STDC_HEADERS)
+#include <stdlib.h>
+#endif
+#ifdef F77_NAME_UPPER
+#define ftest_ FTEST
+#elif defined(F77_NAME_LOWER) || defined(F77_NAME_MIXED)
+#define ftest_ ftest
+#endif
+void ftest_( $pac_mpi_fint *, $pac_mpi_fint *);
+void ftest_( $pac_mpi_fint *itrue, $pac_mpi_fint *ifalse )
+{
+  FILE *f = fopen("conftestval","w");
+  if (!f) exit(1);
+  fprintf( f, "%d %d\n", *itrue, *ifalse );
+  fclose(f);
+}
+    ])
+],[
+    PAC_RUNLOG([mv conftest.$OBJEXT pac_conftest.$OBJEXT])
+    saved_LIBS="$LIBS"
+    LIBS="pac_conftest.$OBJEXT $saved_LIBS"
+    AC_LANG_PUSH([Fortran 77])
+    AC_RUN_IFELSE([
+        AC_LANG_SOURCE([
+            program main
+            logical itrue, ifalse
+            itrue = .TRUE.
+            ifalse = .FALSE.
+            call ftest( itrue, ifalse )
+            end
+        ])
+    ],[
+        pac_cv_prog_f77_true_false_value="`cat conftestval`"
+    ],[
+        AC_MSG_WARN([Failed to build/run program to determine Fortran logical values.])
+    ],[
+        # Cross-Compiling.  Allow the user to set the values
+        if test -n "$CROSS_F77_TRUE_VALUE" -a -n "$CROSS_F77_FALSE_VALUE" ; then
+            pac_cv_prog_f77_true_false_value="$CROSS_F77_TRUE_VALUE $CROSS_F77_FALSE_VALUE"
+        else
+            AC_MSG_WARN([Either CROSS_F77_TRUE_VALUE="$CROSS_F77_TRUE_VALUE" or CROSS_F77_FALSE_VALUE="$CROSS_F77_FALSE_VALUE" is not set.])
+        fi
+    ])
+    AC_LANG_POP([Fortran 77])
+    LIBS="$saved_LIBS"
+    rm -f pac_conftest.$OBJEXT
+])
+AC_LANG_POP([C])
+])
+dnl Endof ac_cache_val
+if test "X$pac_cv_prog_f77_true_false_value" != "X" ; then
+    true_val="`echo $pac_cv_prog_f77_true_false_value | sed -e 's/ .*//g'`"
+    false_val="`echo $pac_cv_prog_f77_true_false_value | sed -e 's/.*  *//g'`"
+    if test -n "$true_val" -a -n "$false_val" ; then
+        AC_MSG_RESULT([True is $true_val and False is $false_val])
+    else
+        AC_MSG_RESULT([could not determine])
+    fi
+fi
+if test -n "$true_val" -a -n "$false_val" ; then
+    AC_DEFINE(F77_TRUE_VALUE_SET,1,[Define if we know the value of Fortran true and false])
+    AC_DEFINE_UNQUOTED(F77_TRUE_VALUE,$true_val,[The value of true in Fortran])
+    AC_DEFINE_UNQUOTED(F77_FALSE_VALUE,$false_val,[The value of false in Fortran])
+fi
+])

Modified: mpich2/trunk/configure.in
===================================================================
--- mpich2/trunk/configure.in	2011-02-15 20:10:59 UTC (rev 7969)
+++ mpich2/trunk/configure.in	2011-02-15 20:44:27 UTC (rev 7970)
@@ -1812,68 +1812,11 @@
     # (making linking C-only programs unnecessarily difficult).  What we test 
     # here is whether the much more restricted needs of the Fortran 
     # initialize can be met with no special use of the Fortran runtime
-    pac_f_init_works_with_c=unknown
-    AC_MSG_CHECKING([whether Fortran init will work with C])
-    rm -f conftest*
-    cat > conftestc.c <<EOF
-#include <stdio.h>
-#include "confdefs.h"
-#ifdef F77_NAME_UPPER
-#define minit_ MINIT
-#elif defined(F77_NAME_LOWER) || defined(F77_NAME_MIXED)
-#define minit_ minit
-#endif
-int main( int argc, char *argv )
-{
-    minit_();
-    return 0;
-}
-char *v1 = 0;
-char *vc2 = 0;
-int  v2 = 0;
-minitc_( char *dv1, int d, char *dv2, int d2, int dv3 )
-{
-v1 = dv1;
-v2 = dv3;
-vc2 = dv2;
-*vc2 = ' ';
-}
-EOF
-    cat > conftestf.f <<EOF
-       subroutine minit()
-       common /m1/ vc, vc2
-       character *1 vc(1,1), vc2(1)
-       common /m2/ vd
-       integer vd
-       save /m1/, /m2/
-       call minitc( vc, vc2, vd )
-       end
-EOF
-   myfcompile='${F77-f77} -c $FFLAGS conftestf.f 1>&AC_FD_CC'
-   myccompile='${CC-cc} -c $CFLAGS conftestc.c 1>&AC_FD_CC'
-   if AC_TRY_EVAL(myfcompile) && test -s conftestf.o ; then
-       :
-   else 
-	echo "configure: failed program was:" >&AC_FD_CC
-        cat conftestf.f >&AC_FD_CC
-   fi
-   if AC_TRY_EVAL(myccompile) && test -s conftestc.o ; then
-       :
-   else 
-	echo "configure: failed program was:" >&AC_FD_CC
-        cat conftestc.c >&AC_FD_CC
-   fi
-   # Now try the link step
-   myclink='${CC-cc} $CFLAGS -o conftest conftestc.o conftestf.o $LDFLAGS >conftest.out 2>&1'
-   if AC_TRY_EVAL(myclink) && test -x conftest${ac_exeext} ; then
-      pac_f_init_works_with_c=yes
-   else
-      pac_f_init_works_with_c=no
-   fi
-   AC_MSG_RESULT($pac_f_init_works_with_c)
+   PAC_F77_INIT_WORKS_WITH_C
    if test "$pac_f_init_works_with_c" = "yes" ; then
        AC_DEFINE(HAVE_MPI_F_INIT_WORKS_WITH_C,1,[Define if the Fortran init code for MPI works from C programs without special libraries])
    fi
+
 fi
 
 # FC requires F77 as well.  If the user disabled f77, do not run the
@@ -2003,28 +1946,32 @@
 	 # if the compiler allows it (e.g., building with gcc but
 	 # a different Fortran compiler. Another option is to
 	 # *require* g77.
-	 rm -f conftest.f
-	 cat > conftest.f <<EOF
-       program main
-       end
-EOF
+         AC_LANG_PUSH([Fortran 77])
+         AC_LANG_CONFTEST([
+             AC_LANG_SOURCE([
+                program main
+                end
+             ])
+         ])
+         saved_FFLAGS="$FFLAGS"
          F77_SHL=false
          for sh_arg in "-shared -fPIC" "-fPIC" "-shared -fpic" "-fpic" "-KPIC" ; do
  	     AC_MSG_CHECKING([whether $F77 allows $sh_arg])
-             if $F77 $sh_arg -o conftest conftest.f >/dev/null 2>&1 ; then
+             FFLAGS="$sh_arg $saved_FFLAGS"
+             AC_LINK_IFELSE([],[
 	         F77_SHL="$F77 $sh_arg"
                  AC_MSG_RESULT(yes)
-	         break
-             else
+                 break
+             ],[
                  AC_MSG_RESULT(no)
-             fi
+             ])
 	 done
+         FFLAGS="$saved_FFLAGS"
 	 if test "$F77_SHL" = "false" ; then
 	     AC_ERROR([Cannot build shared libraries for Fortran with this compiler])
          fi
-	 # This is needed for Mac OSX 10.5
-	 rm -rf conftest.dSYM
-         rm -f conftest*
+         rm -f confest.$ac_ext
+         AC_LANG_POP([Fortran 77])
 	 if test "$enable_rpath" = yes ; then 
 	      F77_LINKPATH_SHL="-Wl,-rpath -Wl,"
 	 fi
@@ -4191,15 +4138,10 @@
     # This is not quite right unless the device setup script, executed above,
     # sets the EXTRA_STATUS_DECL that will be used in defining a status.
     # The default size assumes that there are 5 ints
-    default_status_size=`expr 5 \* $ac_cv_sizeof_int`
     AC_CACHE_CHECK([for size of MPI_Status],pac_cv_sizeof_mpi_status,[
-    AC_TRY_RUN([
-#include "confdefs.h"
-#include <stdio.h>
-#ifdef HAVE_STDLIB_H
-#include <stdlib.h>
-#endif
-typedef struct { 
+        rm -f pac_mpi_status.h
+        cat > pac_mpi_status.h <<_EOF
+typedef struct {
     int count;
     int cancelled;
     int MPI_SOURCE;
@@ -4207,14 +4149,19 @@
     int MPI_ERROR;
     $EXTRA_STATUS_DECL
 } MPI_Status;
-int main( int argc, char **argv ){
-  FILE *f=fopen("conftestval", "w");
-  if (!f) exit(1);
-  fprintf(f, "%d\n", sizeof(MPI_Status));
-  exit(0);
-}
-],pac_cv_sizeof_mpi_status=`cat conftestval`,pac_cv_sizeof_mpi_status=$default_status_size,pac_cv_sizeof_mpi_status=$default_status_size)
-])
+_EOF
+        dnl another alternative is to use AC_CHECK_SIZEOF as follows:
+        dnl AC_CHECK_SIZEOF([MPI_Status],[], [#include "pac_status.h"])
+        dnl But AC_CHECK_SIZEOF has its own AC_MSG_CHECKING, so can't use
+        dnl AC_CACHE_CHECK, so use AC_COMPUTE_INT here.
+        default_status_size=`expr 5 \* $ac_cv_sizeof_int`
+        AC_COMPUTE_INT([pac_cv_sizeof_mpi_status],
+                       [sizeof(MPI_Status)],
+                       [#include "pac_mpi_status.h"],
+                       [pac_cv_sizeof_mpi_status=$default_status_size])
+        rm -f pac_mpi_status.h
+    ])
+
     SIZEOF_MPI_STATUS=$pac_cv_sizeof_mpi_status
     export SIZEOF_MPI_STATUS
     AC_SUBST(SIZEOF_MPI_STATUS)
@@ -4222,10 +4169,10 @@
     if test -z "$MPI_STATUS_SIZE" ; then
         if test -n "$SIZEOF_MPI_STATUS" ; then
             # compute from the C sizeof
-	    MPI_STATUS_SIZE=`expr $SIZEOF_MPI_STATUS / $ac_cv_sizeof_int`
-	    if test "$MPI_STATUS_SIZE" = "0" ; then
-	         AC_MSG_WARN([Could not compute the size of MPI_Status])
-	        MPI_STATUS_SIZE=5
+            MPI_STATUS_SIZE=`expr $SIZEOF_MPI_STATUS / $ac_cv_sizeof_int`
+            if test "$MPI_STATUS_SIZE" = "0" ; then
+                AC_MSG_WARN([Could not compute the size of MPI_Status])
+                MPI_STATUS_SIZE=5
             fi
         else
             AC_MSG_WARN([MPI_STATUS_SIZE was not defined!])
@@ -4238,55 +4185,55 @@
     # We must convert all hex values to decimal (!).
     # This is for the C types so they are also available in Fortran
     for var in CHAR SIGNED_CHAR UNSIGNED_CHAR WCHAR SHORT \
-		  UNSIGNED_SHORT INT UNSIGNED_INT LONG UNSIGNED_LONG \
-		  FLOAT DOUBLE LONG_DOUBLE LONG_LONG_INT \
-		  UNSIGNED_LONG_LONG LONG_LONG FLOAT_INT DOUBLE_INT \
-		  LONG_INT SHORT_INT "2INT" LONG_DOUBLE_INT \
+                  UNSIGNED_SHORT INT UNSIGNED_INT LONG UNSIGNED_LONG \
+                  FLOAT DOUBLE LONG_DOUBLE LONG_LONG_INT \
+                  UNSIGNED_LONG_LONG LONG_LONG FLOAT_INT DOUBLE_INT \
+                  LONG_INT SHORT_INT "2INT" LONG_DOUBLE_INT \
                   INT8_T INT16_T INT32_T INT64_T            \
                   UINT8_T UINT16_T UINT32_T UINT64_T        \
                   C_BOOL C_FLOAT_COMPLEX C_DOUBLE_COMPLEX   \
                   C_LONG_DOUBLE_COMPLEX AINT OFFSET ; do
         fullvar="MPI_$var"
-	fullf77var="MPI_F77_$var"
+        fullf77var="MPI_F77_$var"
         eval fullvarvalue=\$$fullvar
         #echo "$fullvar = $fullvarvalue"
-	if test "x$fullvarvalue" = "x" -o \
-	        "x$fullvarvalue" = "xMPI_DATATYPE_NULL" ; then
+        if test "x$fullvarvalue" = "x" -o \
+                "x$fullvarvalue" = "xMPI_DATATYPE_NULL" ; then
              eval $fullf77var="MPI_DATATYPE_NULL"
- 	     continue
+              continue
         fi
         value=0
         fullvarvalue=`echo $fullvarvalue | sed -e 's/..\(.*\)/\1/'`
-	offset=0
+        offset=0
         for pos in 3 4 5 6 7 8 9 10 ; do
             # This works, even for Tru64, because only a single character
-  	    # is extracted
+            # is extracted
             char=`expr $fullvarvalue : '\(.\)'`
-	    # FIXME: Tru64 Unix eliminates leading zeros (!)
- 	    # How do we fix something that broken?
-	    fullvarvalue=`echo $fullvarvalue | sed -e 's/.\(.*\)/\1/'`
+            # FIXME: Tru64 Unix eliminates leading zeros (!)
+            # How do we fix something that broken?
+            fullvarvalue=`echo $fullvarvalue | sed -e 's/.\(.*\)/\1/'`
             case $char in 
                 a) char=10 ;;
-	        b) char=11 ;;
-	        c) char=12 ;;
-	        d) char=13 ;;
-	        e) char=14 ;;
-	        f) char=15 ;;
+                b) char=11 ;;
+                c) char=12 ;;
+                d) char=13 ;;
+                e) char=14 ;;
+                f) char=15 ;;
             esac
-	    # For Fortran, if the value is too big for an unsigned int, 
-	    # we need to make it a signed (negative) int. Currently, the
-	    # types in this class are the minloc/maxloc types.
-	    if test $pos = 3 -a $char -ge 8 ; then
-	        #echo "for $var in position $pos found a value >= 8"
-		char=`expr $char - 8`
-		offset=-2147483648
+            # For Fortran, if the value is too big for an unsigned int, 
+            # we need to make it a signed (negative) int. Currently, the
+            # types in this class are the minloc/maxloc types.
+            if test $pos = 3 -a $char -ge 8 ; then
+                #echo "for $var in position $pos found a value >= 8"
+                char=`expr $char - 8`
+                offset=-2147483648
             fi
-	    value=`expr $value \* 16 + $char`
+            value=`expr $value \* 16 + $char`
         done
-	if test "$offset" != 0 ; then 
-	    #echo "$fullf77var: $value, $offset"
+        if test "$offset" != 0 ; then 
+            #echo "$fullf77var: $value, $offset"
             value=`expr $value + $offset`
-	fi
+        fi
         #echo "$fullf77var = $value"
         eval $fullf77var=$value
     done
@@ -4337,100 +4284,7 @@
     # Try and compute the values of .true. and .false. in Fortran
     # This code has been removed because the Fortran binding code does
     # not yet support it.  
-    if test "$cross_compiling" = "no" ; then
-        AC_MSG_CHECKING([for values of Fortran logicals])
-        # Use a Fortran main program.  This simplifies some steps, 
-	# since getting all of the Fortran libraries (including shared 
-	# libraries that are not in the default library search path) can 
-	# be tricky.  Specifically, The PROG_F77_RUN_PROC_FROM_C failed with 
-        # some installations of the Portland group compiler.
-        AC_CACHE_VAL(pac_cv_prog_f77_true_false_value,[
-        # Compile a C routine to print the values of true and false
-        cat >conftestc.c <<EOF
-#include <stdio.h>
-#include "confdefs.h"
-#ifdef HAVE_STDLIB_H
-#include <stdlib.h>
-#endif
-#ifdef F77_NAME_UPPER
-#define ftest_ FTEST
-#elif defined(F77_NAME_LOWER) || defined(F77_NAME_MIXED)
-#define ftest_ ftest
-#endif
-void ftest_( $MPI_FINT *, $MPI_FINT *);
-void ftest_( $MPI_FINT *itrue, $MPI_FINT *ifalse )
-{ 
-  FILE *f = fopen("conftestval","w");
-  if (!f) exit(1);
-  fprintf( f, "%d %d\n", *itrue, *ifalse );
-  fclose(f);
-}
-EOF
-        # Create the Fortran program
-        cat >conftest.f <<EOF
-       program main
-       logical itrue, ifalse
-       itrue = .TRUE. 
-       ifalse = .FALSE.
-       call ftest( itrue, ifalse )
-       end
-EOF
-        # Compile the two files
-        pac_tmp_compile='$CC -c $CFLAGS $CPPFLAGS conftestc.c >&AC_FD_CC'
-        if AC_TRY_EVAL(pac_tmp_compile) && test -s conftestc.o ; then
-            AC_LANG_SAVE
-            AC_LANG_FORTRAN77
-            saveLIBS=$LIBS
-            LIBS="conftestc.o $LIBS"
-            if AC_TRY_EVAL(ac_link) && test -s conftest$ac_exeext ; then
-	        if ./conftest$ac_exeext ; then
-	            # success
-		    pac_cv_prog_f77_true_false_value=`cat conftestval`
-                else
-	            # failure 
-		    AC_MSG_WARN([Unable to run the program to determine the values of logicals])
-		    echo "configure: failed program was:" >&AC_FD_CC
-		    cat conftest.f >&AC_FD_CC
-	        fi
-            else
-	        # failure
-                AC_MSG_WARN([Unable to build program to determine values of logicals])
-	        echo "configure: failed program was:" >&AC_FD_CC
-	        cat conftest.f >&AC_FD_CC
-            fi
-	    LIBS=$saveLIBS
-            AC_LANG_RESTORE
-        else
-            AC_MSG_WARN([Unable to compile the C routine for finding the values of logicals])
-	    echo "configure: failed program was:" >&AC_FD_CC
-	    cat conftestc.c >&AC_FD_CC
-        fi
-])
-        true_val="`echo $pac_cv_prog_f77_true_false_value | sed -e 's/ .*//g'`"
-        false_val="`echo $pac_cv_prog_f77_true_false_value | sed -e 's/.*  *//g'`"
-        if test -n "$true_val" -a -n "$false_val" ; then
-	    AC_MSG_RESULT([True is $true_val and False is $false_val])
-        else
-	    AC_MSG_RESULT([could not determine])
-        fi
-    else
-        # Cross-compiling.  Allow the user to set the values
-        if test -n "$CROSS_F77_TRUE_VALUE" -a -n "$CROSS_F77_FALSE_VALUE" ; then
-            true_val=$CROSS_F77_TRUE_VALUE
-	    false_val=$CROSS_F77_FALSE_VALUE
-        fi	
-    fi
-    if test -n "$true_val" -a -n "$false_val" ; then
-        AC_DEFINE(F77_TRUE_VALUE_SET,1,[Define if we know the value of Fortran true and false])
-        AC_DEFINE_UNQUOTED(F77_TRUE_VALUE,$true_val,[The value of true in Fortran])
-        AC_DEFINE_UNQUOTED(F77_FALSE_VALUE,$false_val,[The value of false in Fortran])
-    fi
-    #
-    # We'd also like to check other values for .TRUE. and .FALSE. to see
-    # if the compiler allows (or uses) more than one value (some DEC compilers,
-    # for example, used the high (sign) bit to indicate true and false; the 
-    # rest of the bits were ignored.  For now, we'll assume that there are 
-    # unique true and false values.
+    PAC_F77_LOGICALS_IN_C([$MPI_FINT])
 
     # Check if multiple __attribute__((alias)) is available
     if test "$enable_multi_aliases" = "yes" ; then



More information about the mpich2-commits mailing list