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
18 AC_DEFUN([OMPI_F77_CHECK_LOGICAL_ARRAY],[
19 AC_CACHE_CHECK([for correct handling of FORTRAN logical arrays],
20 [ompi_cv_f77_logical_array_correct],
21 [if test "$1" = "none" -o "$OMPI_WANT_F77_BINDINGS" = "0"; then
22 ompi_cv_f77_logical_array_correct=yes
24 OMPI_F77_MAKE_C_FUNCTION([ompi_check_logical_fn], [check])
27 cat > conftestf.f <<EOF
28 program check_logical_array
38 # We really need the confdefs.h Header file for
39 # 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_check_logical_fn(ompi_fortran_logical_t * logical);
57 void $ompi_check_logical_fn(ompi_fortran_logical_t * logical)
60 FILE *f=fopen("conftestval", "w");
63 if (logical[[0]] == 0 &&
64 logical[[1]] == $ompi_cv_f77_true_value)
66 fprintf(f, "%d\n", result);
73 # Try the compilation and run. Can't use AC_TRY_RUN
74 # because it's two module files.
75 OMPI_LOG_COMMAND([$CC $CFLAGS -I. -c conftest.c],
76 [OMPI_LOG_COMMAND([$F77 $FFLAGS conftestf.f conftest.o -o conftest $LDFLAGS $LIBS],
77 [happy=1], [happy=0])],
79 if test "$happy" = "0" ; then
80 AC_MSG_ERROR([Error determining if arrays of logical values work properly.])
83 AS_IF([test "$cross_compiling" = "yes"],
85 ompi_cv_f77_logical_array_correct=yes],
86 [OMPI_LOG_COMMAND([./conftest],
87 [if test "`cat conftestval`" = "1" ; then
88 ompi_cv_f77_logical_array_correct=yes
90 ompi_cv_f77_logical_array_correct=no
92 [ompi_cv_f77_logical_array_correct=no])])
95 if test "$ompi_cv_f77_logical_array_correct" = "no" ; then
96 AC_MSG_ERROR([Error determining if arrays of logical values work properly.])
99 unset happy ompi_check_logical_fn