1 dnl -*- shell-script -*-
3 dnl Copyright (c) 2004-2005 The Trustees of Indiana University.
4 dnl All rights reserved.
5 dnl Copyright (c) 2004-2005 The Trustees of the University of Tennessee.
6 dnl All rights reserved.
7 dnl Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
8 dnl University of Stuttgart. All rights reserved.
9 dnl Copyright (c) 2004-2005 The Regents of the University of California.
10 dnl All rights reserved.
13 dnl Additional copyrights may follow
19 # OMPI_F77_GET_VALUE_TRUE()
20 # -------------------------------------------------------
21 # Determine the value of .TRUE. of this FORTRAN compiler.
22 AC_DEFUN([OMPI_F77_GET_VALUE_TRUE],[
23 # invalidate cache if result came from a run where F77 was disabled
24 if test "$ompi_cv_f77_true_value" = "0" ; then
25 unset ompi_cv_f77_true_value
28 AC_CACHE_CHECK([FORTRAN value for .TRUE. logical type],
29 [ompi_cv_f77_true_value],
30 [if test "$1" = "none" -o "$OMPI_WANT_F77_BINDINGS" = "0" ; then
31 ompi_cv_f77_true_value=0
33 OMPI_F77_MAKE_C_FUNCTION([ompi_print_logical_fn], [print])
37 # We really need the confdefs.h Header file for
38 # the ompi_fortran_logical_t definition
40 if test \! -f confdefs.h ; then
41 AC_MSG_WARN([*** Problem running configure test!])
42 AC_MSG_WARN([*** Cannot find confdefs.h file for config test])
43 AC_MSG_WARN([*** See config.log for details.])
44 AC_MSG_ERROR([*** Cannot continue.])
47 cat > conftest.c <<EOF
55 void $ompi_print_logical_fn(ompi_fortran_logical_t * logical);
57 void $ompi_print_logical_fn(ompi_fortran_logical_t * logical)
60 FILE *f=fopen("conftestval", "w");
63 if( SIZEOF_INT >= sizeof(ompi_fortran_logical_t) ) {
64 fprintf(f, "%d\n", (int)*logical);
65 } else if (SIZEOF_LONG >= sizeof(ompi_fortran_logical_t) ) {
66 fprintf(f, "%ld\n", (long) *logical);
77 cat > conftestf.f <<EOF
86 # Try the compilation and run.
88 OMPI_LOG_COMMAND([$CC $CFLAGS -I. -c conftest.c],
89 [OMPI_LOG_COMMAND([$F77 $FFLAGS -o conftest conftest.o conftestf.f $LDFLAGS $LIBS],
90 [happy=1], [happy=0])],
93 if test "$happy" = "0" ; then
94 AC_MSG_ERROR([Could not determine value of Fotran .TRUE.. Aborting.])
97 AS_IF([test "$cross_compiling" = "yes"],
98 [AC_MSG_ERROR([Can not determine value of .TRUE. when cross-compiling])],
99 [OMPI_LOG_COMMAND([./conftest],
100 [ompi_cv_f77_true_value=`sed 's/ *//' conftestval`],
101 [AC_MSG_ERROR([Could not determine value of Fotran .TRUE.. Aborting.])])])
104 AC_DEFINE_UNQUOTED([OMPI_FORTRAN_VALUE_TRUE],
105 [$ompi_cv_f77_true_value],
106 [Fortran value for LOGICAL .TRUE. value])
108 unset happy ompi_print_logical_fn