1 dnl -*- shell-script -*-
3 dnl Copyright (c) 2004-2006 The Trustees of Indiana University and Indiana
4 dnl University Research and Technology
5 dnl Corporation. All rights reserved.
6 dnl Copyright (c) 2004-2005 The University of Tennessee and The University
7 dnl of Tennessee Research Foundation. All rights
9 dnl Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
10 dnl University of Stuttgart. All rights reserved.
11 dnl Copyright (c) 2004-2005 The Regents of the University of California.
12 dnl All rights reserved.
15 dnl Additional copyrights may follow
22 dnl F90 : full pathname to compiler
23 dnl BASEF90 : compiler name (no path)
24 dnl OMPI_WANT_F90_BINDINGS : (actually set by ompi_configure_options, may be
26 dnl FC : Same as F90. Side effect of AC_PROG_FC. Should
29 dnl OMPI_F90 : same as F90
30 dnl OMPI_WANT_F90_BINDINGS :
32 dnl OMPI_WANT_F90_BINDINGS :
34 AC_DEFUN([OMPI_SETUP_F90],[
36 # Modularize this setup so that sub-configure.in scripts can use this
39 ompi_show_subtitle "Fortran 90/95 compiler"
41 if test "$OMPI_WANT_F77_BINDINGS" = "0" ; then
42 AC_MSG_WARN([*** Fortran 90/95 bindings implicitly disabled (because])
43 AC_MSG_WARN([*** Fortran 77 bindings were disabled)])
45 OMPI_WANT_F90_BINDINGS=0
48 OMPI_F90_ABSOLUTE="none"
49 if test "$enable_f90" = "yes"; then
50 AC_MSG_WARN([*** but --enable-f90 was explicitly specified])
51 AC_MSG_ERROR([Cannot continue])
53 elif test "$OMPI_WANT_F90_BINDINGS" = "0" ; then
54 AC_MSG_WARN([*** Fortran 90/95 bindings disabled by user])
55 OMPI_WANT_F90_BINDINGS=0
58 OMPI_F90_ABSOLUTE="none"
62 # Check for the compiler
64 # Note that we don't actually *use* the fortran compiler to build
65 # anything in OMPI; it's only used here in configure to find out
66 # symbol conventions, type sizes, etc. We also pass it down to
67 # the wrapper compiler mpif90.
69 # Note that AC_PROG_FC will look for *any* fortran compiler, and
70 # we don't want it to find an F77 compiler. The AC docs don't
71 # recommend using the "dialect" feature of AC_PROG_FC (and you can
72 # only look for one of Fortran 90 or 95 -- not both), so instead
73 # use the optional first parameter and steal the list of Fortran
74 # compilers (excluding the f77 compiler names) from AC's default
75 # list of 95 and 90 compilers and use it here.
78 ompi_fcflags_save="$FCFLAGS"
79 AC_PROG_FC([gfortran f95 fort xlf95 ifort ifc efc pgf95 lf95 f90 xlf90 pgf90 epcf90])
80 FCFLAGS="$ompi_fcflags_save"
81 if test -z "$FC"; then
82 AC_MSG_WARN([*** Fortran 90/95 bindings disabled (could not find compiler)])
83 OMPI_WANT_F90_BINDINGS=0
86 OMPI_F90_ABSOLUTE="none"
88 OMPI_WANT_F90_BINDINGS=1
90 BASEF90="`basename $FC`"
91 OMPI_F90_ABSOLUTE="`which $FC`"
94 # make sure the compiler actually works, if not cross-compiling
95 # Don't just use the AC macro so that we can have a pretty
97 AS_IF([test $OMPI_WANT_F90_BINDINGS -eq 1],
98 [OMPI_CHECK_COMPILER_WORKS([Fortran], [], [],
99 [AC_MSG_ERROR([Could not run a simple Fortran program. Aborting.])])])
101 # check to see if the F77 and F90 compilers are compatible
102 AS_IF([test $OMPI_WANT_F90_BINDINGS -eq 1],
103 [AC_MSG_CHECKING([whether $OMPI_F77 and $OMPI_F90 compilers are compatible])
104 OMPI_INTL_F90_F77_INTERACTION([fortran_goodness=1], [fortran_goodness=0])
105 if test "$fortran_goodness" = "0" ; then
107 AC_MSG_WARN([*** Fortran 77 and Fortran 90 compilers are not link compatible])
108 AC_MSG_WARN([*** Disabling MPI Fortran 90/95 bindings])
109 OMPI_WANT_F90_BINDINGS=0
115 # if we're still good, then save the extra file types. Do this last
116 # because it implies tests that should be invoked by the above tests
117 # (e.g., running the fortran compiler).
118 AS_IF([test $OMPI_WANT_F90_BINDINGS -eq 1],
119 [AC_LANG_PUSH(Fortran)
122 AC_LANG_POP(Fortran)])
124 # All done -- save values
125 AC_DEFINE_UNQUOTED(OMPI_WANT_F90_BINDINGS, $OMPI_WANT_F90_BINDINGS,
126 [Whether we want the MPI f90 bindings or not])
127 AC_DEFINE_UNQUOTED(OMPI_F90, "$OMPI_F90", [OMPI underlying F90 compiler])
128 AM_CONDITIONAL(OMPI_WANT_F90_BINDINGS, test "$OMPI_WANT_F90_BINDINGS" = "1")
129 AC_SUBST(OMPI_F90_ABSOLUTE)
130 unset fortran_goodness
133 #############################################################################
135 AC_DEFUN([OMPI_INTL_F90_F77_INTERACTION], [
136 # make sure that we can combine F90 and F77 code
137 AC_LANG_PUSH(Fortran)
139 cat > conftestf77.f <<EOF
140 subroutine Conf1_test()
143 cat > conftestf90.f <<EOF
151 [$OMPI_F90 $FCFLAGS $FCFLAGS_f -c conftestf90.f],
153 [$OMPI_F77 $FFLAGS -c conftestf77.f],
155 [$OMPI_F90 $FCFLAGS -o conftest conftestf90.o conftestf77.o $LIBS],
161 if test "$HAPPY" = "1"; then
164 OMPI_LOG_MSG([here is the F77 program:], 1)
165 OMPI_LOG_FILE([conftestf77.f])
166 OMPI_LOG_MSG([here is the F90 program:], 1)
167 OMPI_LOG_FILE([conftestf90.f])
171 unset HAPPY ompi_conftest_h