bcd037315f
it doesn't support it -- the compiler will automatically convert the unsupported type to a type that it *does* support. For example, if you try to use INTEGER*16 and the compiler doesn't support it, it may well automatically convert it to INTEGER*8 for you (!). So we have to check the actual size of the type once we determine that the compiler doesn't error if we try to use it (i.e,. the compiler *might* support that type). If the size doesn't match the expected size, then the compiler doesn't really support it. The F77 configure code actually handled this properly. The F90 code did not quite do it right. This patch brings the F90 code up to the same structure as the F77 code, albiet not m4-ized properly. I also added a comment to config/f77_check.m4 that explains *why* we do this extra size check (because no explanation was given). The impetus for this was that xlf* on OS X 10.3 was not recognizing that INTEGER*16 was not supported, and mpi-f90-interfaces.h was being assembled incorrectly. This patch fixes this problem. There is still one more problem, but waiting for some help from Craig R on that (function pointers in F90 declarations). This commit was SVN r8107.
130 строки
4.8 KiB
Bash
130 строки
4.8 KiB
Bash
dnl -*- shell-script -*-
|
|
dnl
|
|
dnl Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
|
|
dnl University Research and Technology
|
|
dnl Corporation. All rights reserved.
|
|
dnl Copyright (c) 2004-2005 The University of Tennessee and The University
|
|
dnl of Tennessee Research Foundation. All rights
|
|
dnl reserved.
|
|
dnl Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
|
|
dnl University of Stuttgart. All rights reserved.
|
|
dnl Copyright (c) 2004-2005 The Regents of the University of California.
|
|
dnl All rights reserved.
|
|
dnl $COPYRIGHT$
|
|
dnl
|
|
dnl Additional copyrights may follow
|
|
dnl
|
|
dnl $HEADER$
|
|
dnl
|
|
|
|
AC_DEFUN([OMPI_F77_CHECK],[
|
|
# Determine a bunch of things about each Fortran datatype:
|
|
# - whether the compiler supports it or not (sometimes an error if it
|
|
# does not exist, sometimes not)
|
|
# - what the size of it is
|
|
# - if it equals the expected size (if there is an expected size)
|
|
# - what its alignment is
|
|
# - what the C type corresponding to it is (sometimes an error if one
|
|
# cannot be found, sometimes not)
|
|
#
|
|
# Arguments
|
|
# 1. Fortran type name
|
|
# 2. All-caps version of #define name
|
|
# 3. All-lower version of #define name
|
|
# 4. Required to have a corresponding C type or not (yes or no)
|
|
# 5. Space-delineated list of C types to search (:'s are replaced with
|
|
# spaces, e.g., "long:long" is changed to a single type, "long
|
|
# long")
|
|
# 6. What the expected size is (or -1 if no expected size)
|
|
|
|
ofc_c_required="$4"
|
|
ofc_c_search_types="$5"
|
|
ofc_expected_size="$6"
|
|
|
|
# Some defaults
|
|
|
|
ofc_have_type=0
|
|
ofc_type_size=$ac_cv_sizeof_int
|
|
ofc_type_alignment=$ac_cv_sizeof_int
|
|
ofc_c_type=ompi_fortran_bogus_type_t
|
|
|
|
# Only check if we actually want the F77 bindings / have a F77
|
|
# compiler. This allows us to call this macro, even if there is no
|
|
# F77 compiler. If we have no f77 compiler, then just set a bunch of
|
|
# defaults.
|
|
|
|
if test "$OMPI_WANT_F77_BINDINGS" = "1"; then
|
|
OMPI_F77_CHECK_TYPE([$1], [ofc_have_type])
|
|
else
|
|
AC_MSG_CHECKING([if FORTRAN compiler supports $1])
|
|
AC_MSG_RESULT([skipped])
|
|
fi
|
|
|
|
if test "$ofc_have_type" = "1"; then
|
|
|
|
# What is the size of this type?
|
|
|
|
# NOTE: Some Fortran compilers actually will return that a type
|
|
# exists even if it doesn't support it -- the compiler will
|
|
# automatically convert the unsupported type to a type that it
|
|
# *does* support. For example, if you try to use INTEGER*16 and
|
|
# the compiler doesn't support it, it may well automatically
|
|
# convert it to INTEGER*8 for you (!). So we have to check the
|
|
# actual size of the type once we determine that the compiler
|
|
# doesn't error if we try to use it (i.e,. the compiler *might*
|
|
# support that type). If the size doesn't match the expected
|
|
# size, then the compiler doesn't really support it.
|
|
|
|
OMPI_F77_GET_SIZEOF([$1], [ofc_type_size])
|
|
if test "$ofc_expected_size" != "-1" -a "$ofc_type_size" != "$ofc_expected_size"; then
|
|
AC_MSG_WARN([*** Fortran $1 does not have expected size!])
|
|
AC_MSG_WARN([*** Expected $ofc_expected_size, got $ofc_type_size])
|
|
AC_MSG_WARN([*** Disabling MPI support for Fortran $1])
|
|
ofc_have_type=0
|
|
else
|
|
|
|
# Look for a corresponding C type (will abort by itself if the
|
|
# type isn't found and we need it)
|
|
|
|
if test "$ofc_c_search_types" != ""; then
|
|
OMPI_FIND_TYPE([Fortran $1], [$ofc_c_search_types],
|
|
[$ofc_c_required], [$ofc_type_size], [ofc_c_type])
|
|
if test -z "$ofc_c_type"; then
|
|
ofc_have_type=0
|
|
fi
|
|
fi
|
|
|
|
# Get the alignment of the type
|
|
|
|
if test "$ofc_have_type" = "1"; then
|
|
OMPI_F77_GET_ALIGNMENT([$1], [ofc_type_alignment])
|
|
fi
|
|
fi
|
|
fi
|
|
|
|
# We always need these defines -- even if we don't have a given type,
|
|
# there are some places in the code where we have to have *something*.
|
|
|
|
AC_DEFINE_UNQUOTED([OMPI_HAVE_FORTRAN_$2], [$ofc_have_type],
|
|
[Whether we have FORTRAN $1 or not])
|
|
AC_DEFINE_UNQUOTED([OMPI_SIZEOF_FORTRAN_$2], [$ofc_type_size],
|
|
[Size of FORTRAN $1])
|
|
AC_DEFINE_UNQUOTED([OMPI_ALIGNMENT_FORTRAN_$2], [$ofc_type_alignment],
|
|
[Alignment of FORTRAN $1])
|
|
if test "$ofc_c_search_types" != ""; then
|
|
AC_DEFINE_UNQUOTED([ompi_fortran_$3_t], [$ofc_c_type],
|
|
[C type corresponding to FORTRAN $1])
|
|
fi
|
|
|
|
# Save some in shell variables for later use (e.g., need
|
|
# OMPI_SIZEOF_FORTRAN_INTEGER in OMPI_F77_GET_FORTRAN_HANDLE_MAX)
|
|
|
|
OMPI_FORTRAN_$2_C_TYPE=$ofc_c_type
|
|
OMPI_SIZEOF_FORTRAN_$2=$ofc_type_size
|
|
|
|
# Clean up
|
|
|
|
unset ofc_have_type ofc_type_size ofc_type_alignment ofc_c_type ofc_bogus
|
|
unset ofc_fortran_required ofc_c_required ofc_c_search_types ofc_expected_size
|
|
])dnl
|