1
1

Fixes for old compilers:

* If the Fortran compiler doesn't support ISO_C_BINDINGS, fall back
   to an older (less precise) test for KIND values
 * If we're building the mpi module, don't assume that we're also
   building mpi_f08 module (i.e., don't add -lmpi_usempif08 to mpifort
   unless we're actually building the mpi_f08 module)

This commit was SVN r26294.
This commit is contained in:
Jeff Squyres 2012-04-19 00:47:54 +00:00
parent 6cf8d8ad95
commit 5e0a154fa3
3 changed files with 29 additions and 24 deletions

View File

@ -138,8 +138,10 @@ AC_DEFUN([OMPI_FORTRAN_CHECK], [
[AC_MSG_RESULT([<skipped>])])
# See if the value is -1. If so, then just say we don't
# have a match.
OMPI_FORTRAN_GET_KIND_VALUE([$ofc_type_kind], [ofc_type_kind_value])
# have a match. If the compiler doesn't support
# ISO_C_BINDING, then we'll just fall back to a default
# kind and hope for the best. :-\
OMPI_FORTRAN_GET_KIND_VALUE([$ofc_type_kind], 4, [ofc_type_kind_value])
AS_IF([test $ofc_type_kind_value -le 0],
[ofc_have_type=0
AC_MSG_WARN([Compiler $1 and $ofc_c_type mismatch; MPI datatype unsupported])])

View File

@ -39,13 +39,14 @@ AC_DEFUN([OMPI_FORTRAN_GET_KIND_VALUE],[
write(7, *) $1
close(7)
]]), [value=`cat conftest.out | awk '{print [$]1}'`], [value=no], [value=cross])
rm -f conftest.out
fi
# If the compiler is ancient enough to not support the
# ISO_C_BINDING stuff, then we have to fall back to older
# tests. Yuck.
AS_IF([test "$value" = "no"],
[AC_MSG_RESULT([ISO_C_BINDING not supported -- fallback])
[AC_MSG_RESULT([no ISO_C_BINDING -- fallback])
_OMPI_FORTRAN_SELECTED_INT_KIND($2, value)])
AS_IF([test "$value" = "no"],
@ -68,27 +69,29 @@ AC_DEFUN([OMPI_FORTRAN_GET_KIND_VALUE],[
# _OMPI_FORTRAN_SELECTED_INT_KIND(decimal range, variable to set)
# -----------------------------------------------------------------
AC_DEFUN([_OMPI_FORTRAN_SELECTED_INT_KIND],[
AS_VAR_PUSHDEF([type_var], [ompi_cv_fortran_int_kind_$1])
AS_VAR_PUSHDEF([sel_int_kind_var], [ompi_cv_fortran_int_kind_$1])
AC_CACHE_CHECK([Fortran value of selected_int_kind($1)], sel_int_kind_var,
[outval=no
if test $OMPI_WANT_FORTRAN_BINDINGS -eq 1 -a $ompi_fortran_happy -eq 1; then
AC_CACHE_CHECK([Fortran value of selected_int_kind($1)],
type_var,
[AC_LANG_PUSH([Fortran])
value=
AC_RUN_IFELSE(AC_LANG_PROGRAM(, [[
AS_IF([test $OMPI_WANT_FORTRAN_BINDINGS -eq 1 -a $ompi_fortran_happy -eq 1],
[rm -f conftest.out
AC_LANG_PUSH([Fortran])
AC_RUN_IFELSE(AC_LANG_PROGRAM(, [[
open(8, file="conftest.out")
write(8, fmt="(I5)") selected_int_kind($1)
close(8)
]]), [value=`cat conftest.out | awk '{print [$]1}'`], [value=no], [value=cross])
]]), [outval=`cat conftest.out | awk '{print [$]1}'`], [outval=no], [outval=cross])
rm -f conftest.out
AC_LANG_POP([Fortran])
])
AC_LANG_POP([Fortran])])
AS_VAR_SET(sel_int_kind_var, [$outval])
unset outval
])
# All analysis of $value is done in the upper-level / calling
# macro
# All analysis of $value is done in the upper-level / calling
# macro
AS_VAR_COPY([$2], [type_var])
else
$2=skipped
fi
AS_VAR_POPDEF([type_var])dnl
AS_VAR_COPY([$2], [sel_int_kind_var])
AS_VAR_POPDEF([sel_int_kind_var])dnl
])

View File

@ -238,9 +238,9 @@ AC_DEFUN([OMPI_SETUP_MPI_FORTRAN],[
# the Fortran/C interop C_INTxx_T KIND values). So figure out
# those KIND values here and just substitue them in via
# AC_DEFINE's. Kinda gross, but there you are. :-\
OMPI_FORTRAN_GET_KIND_VALUE([C_INT16_T], 9, [OMPI_FORTRAN_C_INT16_T_KIND])
OMPI_FORTRAN_GET_KIND_VALUE([C_INT32_T], 18, [OMPI_FORTRAN_C_INT32_T_KIND])
OMPI_FORTRAN_GET_KIND_VALUE([C_INT64_T], 19, [OMPI_FORTRAN_C_INT64_T_KIND])
OMPI_FORTRAN_GET_KIND_VALUE([C_INT16_T], 4, [OMPI_FORTRAN_C_INT16_T_KIND])
OMPI_FORTRAN_GET_KIND_VALUE([C_INT32_T], 9, [OMPI_FORTRAN_C_INT32_T_KIND])
OMPI_FORTRAN_GET_KIND_VALUE([C_INT64_T], 18, [OMPI_FORTRAN_C_INT64_T_KIND])
# Get the kind value for Fortran MPI_INTEGER_KIND (corresponding
# to whatever is the same size as a F77 INTEGER -- for the
@ -318,7 +318,6 @@ AC_DEFUN([OMPI_SETUP_MPI_FORTRAN],[
# We now know that we can now build the mpi module
# with at least ignore TKR functionality
OMPI_BUILD_FORTRAN_USEMPIF08_BINDINGS=1
OMPI_FORTRAN_USEMPIF08_LIB=-lmpi_usempif08
OMPI_FORTRAN_F08_PREDECL=$OMPI_FORTRAN_IGNORE_TKR_PREDECL
OMPI_FORTRAN_F08_TYPE=$OMPI_FORTRAN_IGNORE_TKR_TYPE])
])
@ -446,7 +445,8 @@ end type test_mpi_handle],
])
AC_MSG_CHECKING([if building Fortran 'use mpi_f08' bindings])
AS_IF([test $OMPI_BUILD_FORTRAN_USEMPIF08_BINDINGS -eq 1],
[AC_MSG_RESULT([yes])],
[OMPI_FORTRAN_USEMPIF08_LIB=-lmpi_usempif08
AC_MSG_RESULT([yes])],
[AC_MSG_RESULT([no])])
# -------------------