1
1

Convert all Fortran 77 tests to use config cache so that we have a way to

determine values like Fortran alignment (which can only be determined by
running a program) when cross-compiling.  By providing cache values, the
programs will not be run at all, and life will be good.  Also clean up
some macro interfaces so that they are a bit easier to use, at the cost
of horrid internals ;).

This commit was SVN r8684.
Этот коммит содержится в:
Brian Barrett 2006-01-13 04:08:40 +00:00
родитель a584c60dbe
Коммит 48f82db838
13 изменённых файлов: 443 добавлений и 645 удалений

Просмотреть файл

@ -17,64 +17,50 @@ 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)
# OMPI_F77_CHECK(Fortran type, c type required,
# types to search, expected size)
#----------------------------------------------------------
# Check Fortran type, including:
# - whether compiler supports or not
# - size of type
# - equal to expected size
# - alignment
# - associated C type
#
# 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
# types to search is a comma-seperated list of values
AC_DEFUN([OMPI_F77_CHECK], [
ofc_expected_size=$4
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.
# 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])
OMPI_F77_CHECK_TYPE([$1], [ofc_have_type=1], [ofc_have_type=0])
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.
# 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!])
@ -82,20 +68,16 @@ if test "$ofc_have_type" = "1"; then
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 "$3" != ""; then
OMPI_FIND_TYPE([$1], [$3], [$2], [$ofc_type_size], [ofc_c_type])
if test -z "$ofc_c_type"; then
ofc_have_type=0
ofc_have_type=
fi
fi
# Get the alignment of the type
if test "$ofc_have_type" = "1"; then
OMPI_F77_GET_ALIGNMENT([$1], [ofc_type_alignment])
fi
@ -104,26 +86,27 @@ 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],
AC_DEFINE_UNQUOTED([OMPI_HAVE_FORTRAN_]m4_bpatsubst(m4_bpatsubst([$1], [*], []), [[^a-zA-Z0-9_]], [_]),
[$ofc_have_type],
[Whether we have FORTRAN $1 or not])
AC_DEFINE_UNQUOTED([OMPI_SIZEOF_FORTRAN_$2], [$ofc_type_size],
AC_DEFINE_UNQUOTED([OMPI_SIZEOF_FORTRAN_]m4_bpatsubst(m4_bpatsubst([$1], [*], []), [[^a-zA-Z0-9_]], [_]),
[$ofc_type_size],
[Size of FORTRAN $1])
AC_DEFINE_UNQUOTED([OMPI_ALIGNMENT_FORTRAN_$2], [$ofc_type_alignment],
AC_DEFINE_UNQUOTED([OMPI_ALIGNMENT_FORTRAN_]m4_bpatsubst(m4_bpatsubst([$1], [*], []), [[^a-zA-Z0-9_]], [_]),
[$ofc_type_alignment],
[Alignment of FORTRAN $1])
if test "$ofc_c_search_types" != ""; then
AC_DEFINE_UNQUOTED([ompi_fortran_$3_t], [$ofc_c_type],
if test "$3" != ""; then
AC_DEFINE_UNQUOTED([ompi_fortran_]m4_translit(m4_bpatsubst(m4_bpatsubst([$1], [*], []), [[^a-zA-Z0-9_]], [_]), [A-Z], [a-z])[_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
[OMPI_FORTRAN_]m4_bpatsubst(m4_bpatsubst([$1], [*], []), [[^a-zA-Z0-9_]], [_])[_C_TYPE=$ofc_c_type]
[OMPI_SIZEOF_FORTRAN_]m4_bpatsubst(m4_bpatsubst([$1], [*], []), [[^a-zA-Z0-9_]], [_])[=$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
unset ofc_have_type ofc_type_size ofc_type_alignment ofc_c_type
unset ofc_expected_size
])dnl

Просмотреть файл

@ -16,35 +16,14 @@ dnl $HEADER$
dnl
AC_DEFUN([OMPI_F77_CHECK_LOGICAL_ARRAY],[
AC_MSG_CHECKING([for correct handling of FORTRAN logical arrays])
if test "$1" = "none" -o "$OMPI_WANT_F77_BINDINGS" = "0"; then
AC_MSG_RESULT([no Fortran 77 bindings -- skipped])
AC_CACHE_CHECK([for correct handling of FORTRAN logical arrays],
[ompi_cv_f77_logical_array_correct],
[if test "$1" = "none" -o "$OMPI_WANT_F77_BINDINGS" = "0"; then
ompi_cv_f77_logical_array_correct=yes
else
OMPI_F77_MAKE_C_FUNCTION([ompi_check_logical_fn], [check])
if test "x$ompi_ac_doubleunder" = xy || test "x$ompi_ac_singleunder" = xy; then
ompi_ac_check_logical_fn=check_
else
if test "x$ompi_ac_nounder" = xy; then
ompi_ac_check_logical_fn=check
else
if test "x$ompi_ac_caps" = xy; then
ompi_ac_check_logical_fn=CHECK
else
AC_MSG_WARN([*** FORTRAN external naming convention undefined])
AC_MSG_ERROR([*** Cannot continue.])
fi
fi
fi
#
# Cannot use standard AC_TRY macros because we need two different .o
# files here, and link them together
#
#
# Fortran module
#
cat > conftestf.f <<EOF
program check_logical_array
external CHECK
@ -55,11 +34,9 @@ else
end
EOF
#
# C module
# We really need the confdefs.h Header file for
# the ompi_fortran_logical_t definition
#
if test \! -f confdefs.h ; then
AC_MSG_WARN([*** Problem running configure test!])
AC_MSG_WARN([*** Cannot find confdefs.h file for config test])
@ -75,16 +52,16 @@ EOF
#ifdef __cplusplus
extern "C" {
#endif
void $ompi_ac_check_logical_fn(ompi_fortran_logical_t * logical);
void $ompi_check_logical_fn(ompi_fortran_logical_t * logical);
void $ompi_ac_check_logical_fn(ompi_fortran_logical_t * logical)
void $ompi_check_logical_fn(ompi_fortran_logical_t * logical)
{
int result = 0;
FILE *f=fopen("conftestval", "w");
if (!f) exit(1);
if (logical[[0]] == 0 &&
logical[[1]] == $ompi_ac_value_true)
logical[[1]] == $ompi_cv_f77_true_value)
result = 1;
fprintf(f, "%d\n", result);
}
@ -93,45 +70,32 @@ void $ompi_ac_check_logical_fn(ompi_fortran_logical_t * logical)
#endif
EOF
#
# Try the compilation and run. Can't use AC_TRY_RUN because it's two
# module files.
#
# Try the compilation and run. Can't use AC_TRY_RUN
# because it's two module files.
OMPI_LOG_COMMAND([$CC $CFLAGS -I. -c conftest.c],
OMPI_LOG_COMMAND([$F77 $FFLAGS conftestf.f conftest.o -o conftest $LDFLAGS $LIBS],
OMPI_LOG_COMMAND([./conftest],[HAPPY=1],[HAPPY=0]),
[HAPPY=0]),
[HAPPY=0])
[OMPI_LOG_COMMAND([$F77 $FFLAGS conftestf.f conftest.o -o conftest $LDFLAGS $LIBS],
[happy=1], [happy=0])],
[happy=0])
if test "$happy" = "0" ; then
AC_MSG_ERROR([Error determining if arrays of logical values work properly.])
fi
if test "$HAPPY" = "1" -a -f conftestval; then
ompi_result=`cat conftestval`
if test "$ompi_result" = "1"; then
AC_MSG_RESULT([yes])
AS_IF([test "$cross_compiling" = "yes"],
[ # assume we're ok
ompi_cv_f77_logical_array_correct=yes],
[OMPI_LOG_COMMAND([./conftest],
[if test "`cat conftestval`" = "1" ; then
ompi_cv_f77_logical_array_correct=yes
else
AC_MSG_RESULT([no])
AC_MSG_WARN([*** Problem running configure test!])
AC_MSG_WARN([*** See config.log for details.])
AC_MSG_ERROR([*** Cannot continue.])
fi
else
AC_MSG_RESULT([unknown])
ompi_cv_f77_logical_array_correct=no
fi],
[ompi_cv_f77_logical_array_correct=no])])
fi])
OMPI_LOG_MSG([here is the C program:], 1)
OMPI_LOG_FILE([conftest.c])
if test -f conftest.h; then
OMPI_LOG_MSG([here is contest.h:], 1)
OMPI_LOG_FILE([conftest.h])
fi
OMPI_LOG_MSG([here is the fortran program:], 1)
OMPI_LOG_FILE([conftestf.f])
AC_MSG_WARN([*** Problem running configure test!])
AC_MSG_WARN([*** See config.log for details.])
AC_MSG_ERROR([*** Cannot continue.])
if test "$ompi_cv_f77_logical_array_correct" = "no" ; then
AC_MSG_ERROR([Error determining if arrays of logical values work properly.])
fi
unset HAPPY ompi_result
unset happy ompi_check_logical_fn
/bin/rm -f conftest*
fi
])dnl

Просмотреть файл

@ -17,24 +17,24 @@ dnl
dnl $HEADER$
dnl
# OMPI_F77_CHECK_TYPE([type, action if found, action if not found])
# -----------------------------------------------------------------
AC_DEFUN([OMPI_F77_CHECK_TYPE],[
AS_VAR_PUSHDEF([type_var], [ompi_cv_f77_have_$1])
# Determine FORTRAN datatype size.
# First arg is type, 2nd arg is config var to define
AC_MSG_CHECKING([if FORTRAN compiler supports $1])
AC_LANG_PUSH(Fortran 77)
AC_COMPILE_IFELSE(AC_LANG_SOURCE([[C
AC_CACHE_CHECK([if Fortran compiler supports $1], type_var,
[AC_LANG_PUSH([Fortran 77])
AC_COMPILE_IFELSE([AC_LANG_SOURCE([[C
program main
$1 bogus_variable
end]]),
[HAPPY=1
AC_MSG_RESULT([yes])],
[HAPPY=0
AC_MSG_RESULT([no])])
AC_LANG_POP
end]])],
[AS_VAR_SET(type_var, "yes")],
[AS_VAR_SET(type_var, "no")])
AC_LANG_POP([Fortran 77])])
str="$2=$HAPPY"
eval $str
AS_IF([test "AS_VAR_GET(type_var)" = "yes"], [$2], [$3])
AS_VAR_POPDEF([type_var])dnl
])dnl
unset HAPPY])dnl

Просмотреть файл

@ -17,84 +17,98 @@ dnl
dnl $HEADER$
dnl
define(OMPI_F77_FIND_EXT_SYMBOL_CONVENTION,[
AC_MSG_CHECKING($1 external symbol convention)
ompi_fortran_double_underscore=0
ompi_fortran_single_underscore=0
ompi_fortran_caps=0
ompi_fortran_plain=0
AC_DEFUN([OMPI_F77_FIND_EXT_SYMBOL_CONVENTION], [
AC_REQUIRE([AC_PROG_NM])
# If we didn't find an f77 compiler, or if we don't want the f77
# bindings, just leave everything hardwired to 0. Otherwise, do the
# real test.
if test "$1" = "none" -o "$OMPI_WANT_F77_BINDINGS" = "0"; then
AC_MSG_RESULT([no Fortran 77 bindings -- skipped])
AC_CACHE_CHECK([$F77 external symbol convention],
[ompi_cv_f77_external_symbol],
[if test "$F77" = "none" -o "$OMPI_WANT_F77_BINDINGS" = "0"; then
ompi_cv_f77_external_symbol="skipped"
else
cat > conftestf.f <<EOF
cat >conftest.f <<EOF
subroutine FOO_bar(a)
integer a
a = 1
return
end
EOF
$1 $FFLAGS -c conftestf.f 1>&5 2>&1
if test ! -s conftestf.o; then
AC_MSG_WARN(unable to produce an object file testing F77 compiler)
OMPI_LOG_COMMAND([$F77 $FFLAGS -c conftest.f $LDFLAGS $LIBS],
[if $NM conftest.o | grep foo_bar__ >/dev/null 2>&1 ; then
ompi_cv_f77_external_symbol="double underscore"
elif $NM conftest.o | grep foo_bar_ >/dev/null 2>&1 ; then
ompi_cv_f77_external_symbol="single underscore"
elif $NM conftest.o | grep FOO_bar >/dev/null 2>&1 ; then
ompi_cv_f77_external_symbol="mixed case"
elif $NM conftest.o | grep foo_bar >/dev/null 2>&1 ; then
ompi_cv_f77_external_symbol="no underscore"
elif $NM conftest.o | grep FOO_BAR >/dev/null 2>&1 ; then
ompi_cv_f77_external_symbol="upper case"
else
nm conftestf.o | grep foo_bar__ > /dev/null 2>&1
if test $? = "0"; then
AC_MSG_RESULT([double underscore])
$NM conftest.o >conftest.out 2>&1
OMPI_LOG_MSG([output from $NM:])
OMPI_LOG_FILE([conftest.out])
AC_MSG_ERROR([Could not determine Fortran naming convention.])
fi],
[AC_MSG_ERROR([Fortran compiler did not produce object file])])
fi])
ompi_fortran_double_underscore=0
ompi_fortran_single_underscore=0
ompi_fortran_caps=0
ompi_fortran_plain=0
if test "$ompi_cv_f77_external_symbol" = "double underscore" ; then
ompi_fortran_double_underscore=1
ompi_ac_doubleunder=y
else
nm conftestf.o | grep foo_bar_ > /dev/null 2>&1
if test $? = "0"; then
AC_MSG_RESULT([single underscore])
elif test "$ompi_cv_f77_external_symbol" = "single underscore" ; then
ompi_fortran_single_underscore=1
ompi_ac_singleunder=y
else
# We may get into trouble here if we start accepting
# mixed case compilers -- we may need to have caps
# underscore, or caps double underscore, for example.
# But we haven't found any that require that yet. :-)
nm conftestf.o | grep FOO_bar > /dev/null 2>&1
if test $? = "0"; then
AC_MSG_RESULT([mixed case, so FORTRANCAPS])
elif test "$ompi_cv_f77_external_symbol" = "mixed case" ; then
ompi_fortran_caps=1
ompi_ac_caps=y
else
nm conftestf.o | grep foo_bar > /dev/null 2>&1
if test $? = "0"; then
AC_MSG_RESULT([no underscore])
elif test "$ompi_cv_f77_external_symbol" = "no underscore" ; then
ompi_fortran_plain=1
ompi_ac_nounder=y
else
nm conftestf.o | grep FOO_BAR > /dev/null 2>&1
if test $? = "0"; then
AC_MSG_RESULT([all upper case])
elif test "$ompi_cv_f77_external_sumbol" = "upper case" ; then
ompi_fortran_caps=1
ompi_ac_caps=y
else
AC_MSG_WARN([*** Could not find name of subroutine foo_bar])
AC_MSG_ERROR([Cannot continue])
fi
fi
fi
fi
fi
fi
AC_MSG_ERROR([unknown naming convention: $ompi_cv_f77_external_symbol])
fi
AC_DEFINE_UNQUOTED(OMPI_F77_DOUBLE_UNDERSCORE,
$ompi_fortran_double_underscore,
AC_DEFINE_UNQUOTED([OMPI_F77_DOUBLE_UNDERSCORE],
[$ompi_fortran_double_underscore],
[Whether fortran symbols have a trailing double underscore or not])
AC_DEFINE_UNQUOTED(OMPI_F77_SINGLE_UNDERSCORE, $ompi_fortran_single_underscore,
AC_DEFINE_UNQUOTED([OMPI_F77_SINGLE_UNDERSCORE],
[$ompi_fortran_single_underscore],
[Whether fortran symbols have a trailing underscore or not])
AC_DEFINE_UNQUOTED(OMPI_F77_CAPS, $ompi_fortran_caps,
AC_DEFINE_UNQUOTED([OMPI_F77_CAPS],
[$ompi_fortran_caps],
[Whether fortran symbols are all caps or not])
AC_DEFINE_UNQUOTED(OMPI_F77_PLAIN, $ompi_fortran_plain,
AC_DEFINE_UNQUOTED([OMPI_F77_PLAIN],
[$ompi_fortran_plain],
[Whether fortran symbols have no trailing underscore or not])
/bin/rm -f conftestf.f conftestf.o])dnl
rm -f conftest.*
])dnl
AC_DEFUN([OMPI_F77_MAKE_C_FUNCTION], [
if test "$ompi_cv_f77_external_symbol" = "double underscore" ; then
# so the general rule is that if there is an _ in the function
# name, then there are two trailing underscores. Otherwise,
# there is only one trailing underscore. Any idea how to do
# that with m4_translit?
if echo $2 | grep _ >/dev/null 2>&1 ; then
$1[=]m4_translit([$2], [A-Z], [a-z])[__]
else
$1[=]m4_translit([$2], [A-Z], [a-z])[_]
fi
elif test "$ompi_cv_f77_external_symbol" = "single underscore" ; then
$1[=]m4_translit([$2], [A-Z], [a-z])[_]
elif test "$ompi_cv_f77_external_symbol" = "mixed case" ; then
$1[=]$2
elif test "$ompi_cv_f77_external_symbol" = "no underscore" ; then
$1[=]m4_translit([$2], [A-Z], [a-z])
elif test "$ompi_cv_f77_external_sumbol" = "upper case" ; then
$1[=]m4_translit([$2], [a-z], [A-Z])
else
AC_MSG_ERROR([unknown naming convention: $ompi_cv_f77_external_symbol])
fi
])

Просмотреть файл

@ -17,30 +17,14 @@ dnl
dnl $HEADER$
dnl
# OMPI_F77_GET_ALIGNMENT(type, shell variable to set)
# ----------------------------------------------------
AC_DEFUN([OMPI_F77_GET_ALIGNMENT],[
# Determine FORTRAN datatype size.
# First arg is type, 2nd arg is config var to define.
AC_MSG_CHECKING(alignment of FORTRAN $1)
ompi_ac_align_fn=
if test "x$ompi_ac_doubleunder" = xy || test "x$ompi_ac_singleunder" = xy; then
ompi_ac_align_fn=align_
else
if test "x$ompi_ac_nounder" = xy; then
ompi_ac_align_fn=align
else
if test "x$ompi_ac_caps" = xy; then
ompi_ac_align_fn=ALIGN
else
AC_MSG_WARN([*** FORTRAN external naming convention undefined])
AC_MSG_ERROR([*** Cannot continue.])
fi
fi
fi
AS_VAR_PUSHDEF([type_var], [ompi_cv_f77_alignment_$1])
#
AC_CACHE_CHECK([alignment of FORTRAN $1], type_var,
[OMPI_F77_MAKE_C_FUNCTION([ompi_ac_align_fn], [align])
# Fortran module
#
cat > conftestf.f <<EOF
program falign
external ALIGN
@ -51,10 +35,7 @@ cat > conftestf.f <<EOF
end
EOF
#
# C module
#
if test -f conftest.h; then
ompi_conftest_h="#include \"conftest.h\""
else
@ -89,41 +70,23 @@ void $ompi_ac_align_fn(char *w, char *x, char *y, char *z)
#endif
EOF
#
# Try the compilation and run. Can't use AC_TRY_RUN because it's two
# module files.
#
OMPI_LOG_COMMAND([$CC $CFLAGS -I. -c conftest.c],
OMPI_LOG_COMMAND([$F77 $FFLAGS conftestf.f conftest.o -o conftest $LDFLAGS $LIBS],
OMPI_LOG_COMMAND([./conftest],[HAPPY=1],[HAPPY=0]),
[HAPPY=0]),
[HAPPY=0])
[OMPI_LOG_COMMAND([$F77 $FFLAGS conftestf.f conftest.o -o conftest $LDFLAGS $LIBS],
[happy="yes"], [happy="no"])], [happy="no"])
if test "$HAPPY" = "1" -a -f conftestval; then
ompi_ac_align=`cat conftestval`
AC_MSG_RESULT([$ompi_ac_align])
if test -n "$2"; then
eval "$2=$ompi_ac_align"
if test "$happy" = "no" ; then
AC_MSG_ERROR([Could not determine alignment of $1])
fi
else
AC_MSG_RESULT([unknown])
OMPI_LOG_MSG([here is the C program:], 1)
OMPI_LOG_FILE([conftest.c])
if test -f conftest.h; then
OMPI_LOG_MSG([here is contest.h:], 1)
OMPI_LOG_FILE([conftest.h])
fi
OMPI_LOG_MSG([here is the fortran program:], 1)
OMPI_LOG_FILE([conftestf.f])
AS_IF([test "$cross_compiling" = "yes"],
[AC_MSG_ERROR([Can not determine alignment of $1 when cross-compiling])],
[OMPI_LOG_COMMAND([./conftest],
[AS_VAR_SET(type_var, [`cat conftestval`])],
[AC_MSG_ERROR([Could not determine alignment of $1])])])
AC_MSG_WARN([*** Problem running configure test!])
AC_MSG_WARN([*** See config.log for details.])
AC_MSG_ERROR([*** Cannot continue.])
fi
str="$2=$ompi_ac_align"
eval $str
unset happy ompi_conf
rm -f conftest*])
unset ompi_ac_align HAPPY ompi_conftest_h
/bin/rm -f conftest*])dnl
$2=AS_VAR_GET([type_var])
AS_VAR_POPDEF([type_var])dnl
])

Просмотреть файл

@ -17,13 +17,15 @@ dnl
dnl $HEADER$
dnl
AC_DEFUN([OMPI_F77_GET_FORTRAN_HANDLE_MAX],[
# OMPI_F77_GET_FORTRAN_HANDLE_MAX()
# ---------------------------------------------------------------
# Find the maximum value of fortran integers, then calculate
# min(INT_MAX, max fortran INTEGER). This represents the maximum
# number of fortran MPI handle index.
AC_MSG_CHECKING([for max fortran MPI handle index])
# Find max fortran INTEGER value. Set to sentinel value if we don't
AC_DEFUN([OMPI_F77_GET_FORTRAN_HANDLE_MAX],[
AC_CACHE_CHECK([for max Fortran MPI handle index],
[ompi_cv_f77_fortran_handle_max],
[ # Find max fortran INTEGER value. Set to sentinel value if we don't
# have a Fortran compiler (e.g., if --disable-f77 was given).
if test "$OMPI_WANT_F77_BINDINGS" = "0" ; then
ompi_fint_max=0
@ -48,9 +50,10 @@ AC_RUN_IFELSE(AC_LANG_PROGRAM([[
]],[[FILE *fp = fopen("conftest.out", "w");
long cint = INT_MAX;
fprintf(fp, "%ld", cint);
fclose(fp);]]), [ompi_cint_max=`cat conftest.out`],
[ompi_cint_max=0], [ #cross compiling is fun
# try to compute INT_MAX the same way we computed Fortran INTEGER max.
fclose(fp);]]),
[ompi_cint_max=`cat conftest.out`],
[ompi_cint_max=0],
[ #cross compiling is fun. compute INT_MAX same as INTEGER max
ompi_numf=`expr $ac_cv_sizeof_int \* 2 - 1`
ompi_cint_max=0x7
while test "$ompi_numf" -gt "0" ; do
@ -60,22 +63,20 @@ done])
if test "$ompi_cint_max" = "0" ; then
# wow - something went really wrong. Be conservative
OMPI_FORTRAN_HANDLE_MAX=32767
ompi_cv_f77_fortran_handle_max=32767
elif test "$ompi_fint_max" = "0" ; then
# we aren't compiling Fortran - just set it to C INT_MAX
OMPI_FORTRAN_HANDLE_MAX=$ompi_cint_max
ompi_cv_f77_fortran_handle_max=$ompi_cint_max
else
# take the lesser of C INT_MAX and Fortran INTEGER max. The
# resulting value will then be storable in either type. There's
# no easy way to do this in the shell, so make the preprocessor do
# it.
OMPI_FORTRAN_HANDLE_MAX="( $ompi_fint_max < $ompi_cint_max ? $ompi_fint_max : $ompi_cint_max )"
# take the lesser of C INT_MAX and Fortran INTEGER
# max. The resulting value will then be storable in
# either type. There's no easy way to do this in
# the shell, so make the preprocessor do it.
ompi_cv_f77_fortran_handle_max="( $ompi_fint_max < $ompi_cint_max ? $ompi_fint_max : $ompi_cint_max )"
fi
rm -f conftest.out > /dev/null 2>&1
rm -f conftest.out > /dev/null 2>&1 ])
AC_DEFINE_UNQUOTED(OMPI_FORTRAN_HANDLE_MAX,
$OMPI_FORTRAN_HANDLE_MAX,
AC_DEFINE_UNQUOTED([OMPI_FORTRAN_HANDLE_MAX],
[$ompi_cv_f77_fortran_handle_max],
[Max handle value for fortran MPI handles, effectively min(INT_MAX, max fortran INTEGER value)])
AC_MSG_RESULT([$OMPI_FORTRAN_HANDLE_MAX])
])dnl

Просмотреть файл

@ -17,35 +17,14 @@ dnl
dnl $HEADER$
dnl
# OMPI_F77_GET_SIZEOF(type, variable to set)
# ------------------------------------------
AC_DEFUN([OMPI_F77_GET_SIZEOF],[
# Determine FORTRAN datatype size.
# First arg is type, 2nd arg is config var to define.
AC_MSG_CHECKING([size of FORTRAN $1])
ompi_ac_size_fn=
if test "x$ompi_ac_doubleunder" = xy || test "x$ompi_ac_singleunder" = xy; then
ompi_ac_size_fn=size_
else
if test "x$ompi_ac_nounder" = xy; then
ompi_ac_size_fn=size
else
if test "x$ompi_ac_caps" = xy; then
ompi_ac_size_fn=SIZE
else
AC_MSG_WARN([*** FORTRAN external naming convention undefined])
AC_MSG_ERROR([*** Cannot continue.])
fi
fi
fi
AS_VAR_PUSHDEF([type_var], [ompi_cv_f77_sizeof_$1])
#
# Cannot use standard AC_TRY macros because we need two different .o
# files here, and link them together
#
#
AC_CACHE_CHECK([size of Fortran $1], type_var,
[OMPI_F77_MAKE_C_FUNCTION([ompi_ac_size_fn], [size])
# Fortran module
#
cat > conftestf.f <<EOF
program fsize
external SIZE
@ -54,10 +33,7 @@ cat > conftestf.f <<EOF
end
EOF
#
# C module
#
if test -f conftest.h; then
ompi_conftest_h="#include \"conftest.h\""
else
@ -83,40 +59,23 @@ void $ompi_ac_size_fn(char *a, char *b)
#endif
EOF
#
# Try the compilation and run. Can't use AC_TRY_RUN because it's two
# module files.
#
OMPI_LOG_COMMAND([$CC $CFLAGS -I. -c conftest.c],
OMPI_LOG_COMMAND([$F77 $FFLAGS conftestf.f conftest.o -o conftest $LDFLAGS $LIBS],
OMPI_LOG_COMMAND([./conftest],[HAPPY=1],[HAPPY=0]),
[HAPPY=0]),
[HAPPY=0])
[OMPI_LOG_COMMAND([$F77 $FFLAGS conftestf.f conftest.o -o conftest $LDFLAGS $LIBS],
[happy="yes"], [happy="no"])], [happy="no"])
ompi_ac_fortsize=-1
if test "$HAPPY" = "1" -a -f conftestval; then
ompi_ac_fortsize=`cat conftestval`
AC_MSG_RESULT([$ompi_ac_fortsize])
eval "$2=$ompi_ac_fortsize"
else
AC_MSG_RESULT([unknown])
OMPI_LOG_MSG([here is the C program:], 1)
OMPI_LOG_FILE([conftest.c])
if test -f conftest.h; then
OMPI_LOG_MSG([here is contest.h:], 1)
OMPI_LOG_FILE([conftest.h])
if test "$happy" = "no" ; then
AC_MSG_ERROR([Could not determine size of $1])
fi
OMPI_LOG_MSG([here is the fortran program:], 1)
OMPI_LOG_FILE([conftestf.f])
AC_MSG_WARN([*** Problem running configure test!])
AC_MSG_WARN([*** See config.log for details.])
AC_MSG_ERROR([*** Cannot continue.])
fi
str="$2=$ompi_ac_fortsize"
eval $str
AS_IF([test "$cross_compiling" = "yes"],
[AC_MSG_ERROR([Can not determine size of $1 when cross-compiling])],
[OMPI_LOG_COMMAND([./conftest],
[AS_VAR_SET(type_var, [`cat conftestval`])],
[AC_MSG_ERROR([Could not determine size of $1])])])
unset ompi_ac_fortsize HAPPY ompi_conftest_h
/bin/rm -f conftest*])dnl
unset happy ompi_conftest_h
rm -f conftest*])
$2=AS_VAR_GET(type_var)
AS_VAR_POPDEF([type_var])dnl
])dnl

Просмотреть файл

@ -15,30 +15,17 @@ dnl
dnl $HEADER$
dnl
AC_DEFUN([OMPI_F77_GET_VALUE_TRUE],[
# OMPI_F77_GET_VALUE_TRUE()
# -------------------------------------------------------
# Determine the value of .TRUE. of this FORTRAN compiler.
AC_MSG_CHECKING([FORTRAN value for .TRUE. logical type])
if test "$1" = "none" -o "$OMPI_WANT_F77_BINDINGS" = "0"; then
OMPI_FORTRAN_VALUE_TRUE=0
AC_MSG_RESULT([no Fortran 77 bindings -- skipped])
AC_DEFUN([OMPI_F77_GET_VALUE_TRUE],[
AC_CACHE_CHECK([FORTRAN value for .TRUE. logical type],
[ompi_cv_f77_true_value],
[if test "$1" = "none" -o "$OMPI_WANT_F77_BINDINGS" = "0" ; then
ompi_cv_f77_true_value=0
else
if test "x$ompi_ac_doubleunder" = xy || test "x$ompi_ac_singleunder" = xy; then
ompi_ac_print_logical_fn=print_
else
if test "x$ompi_ac_nounder" = xy; then
ompi_ac_print_logical_fn=print
else
if test "x$ompi_ac_caps" = xy; then
ompi_ac_print_logical_fn=PRINT
else
AC_MSG_WARN([*** FORTRAN external naming convention undefined])
AC_MSG_ERROR([*** Cannot continue.])
fi
fi
fi
OMPI_F77_MAKE_C_FUNCTION([ompi_print_logical_fn], [print])
#
# C module
@ -60,9 +47,9 @@ cat > conftest.c <<EOF
#ifdef __cplusplus
extern "C" {
#endif
void $ompi_ac_print_logical_fn(ompi_fortran_logical_t * logical);
void $ompi_print_logical_fn(ompi_fortran_logical_t * logical);
void $ompi_ac_print_logical_fn(ompi_fortran_logical_t * logical)
void $ompi_print_logical_fn(ompi_fortran_logical_t * logical)
{
int result = 0;
FILE *f=fopen("conftestval", "w");
@ -92,34 +79,25 @@ EOF
# Try the compilation and run.
#
OMPI_LOG_COMMAND([$CC $CFLAGS -I. -c conftest.c],
OMPI_LOG_COMMAND([$F77 $FFLAGS -o conftest conftest.o conftestf.f $LDFLAGS $LIBS],
OMPI_LOG_COMMAND([./conftest], [HAPPY=1], [HAPPY=0]),
[HAPPY=0]),
[HAPPY=0])
[OMPI_LOG_COMMAND([$F77 $FFLAGS -o conftest conftest.o conftestf.f $LDFLAGS $LIBS],
[happy=1], [happy=0])],
[happy=0])
if test "$HAPPY" = "1" -a -f conftestval; then
# get rid of leading spaces for eval assignment
ompi_ac_value_true=`sed 's/ *//' conftestval`
OMPI_FORTRAN_VALUE_TRUE=$ompi_ac_value_true
AC_MSG_RESULT([$ompi_ac_value_true])
else
AC_MSG_RESULT([unknown])
OMPI_LOG_MSG([here is the C program:], 1)
OMPI_LOG_FILE([conftest.c])
OMPI_LOG_MSG([here is the fortran program:], 1)
OMPI_LOG_FILE([conftestf.f])
AC_MSG_WARN([*** Problem running configure test!])
AC_MSG_WARN([*** See config.log for details.])
AC_MSG_ERROR([*** Cannot continue.])
if test "$happy" = "0" ; then
AC_MSG_ERROR([Could not determine value of Fotran .TRUE.. Aborting.])
fi
unset HAPPY
/bin/rm -f conftest*
fi
AC_DEFINE_UNQUOTED(OMPI_FORTRAN_VALUE_TRUE,
$OMPI_FORTRAN_VALUE_TRUE,
AS_IF([test "$cross_compiling" = "yes"],
[AC_MSG_ERROR([Can not determine value of .TRUE. when cross-compiling])],
[OMPI_LOG_COMMAND([./conftest],
[ompi_cv_f77_true_value=`sed 's/ *//' conftestval`],
[AC_MSG_ERROR([Could not determine value of Fotran .TRUE.. Aborting.])])])
fi])
AC_DEFINE_UNQUOTED([OMPI_FORTRAN_VALUE_TRUE],
[$ompi_cv_f77_true_value],
[Fortran value for LOGICAL .TRUE. value])
unset happy ompi_print_logical_fn
/bin/rm -f conftest*
])dnl

Просмотреть файл

@ -21,21 +21,7 @@ AC_DEFUN([OMPI_F90_GET_ALIGNMENT],[
# Determine FORTRAN datatype size.
# First arg is type, 2nd arg is config var to define.
AC_MSG_CHECKING(alignment of FORTRAN $1)
ompi_ac_align_fn=
if test "x$ompi_ac_doubleunder" = xy || test "x$ompi_ac_singleunder" = xy; then
ompi_ac_align_fn=align_
else
if test "x$ompi_ac_nounder" = xy; then
ompi_ac_align_fn=align
else
if test "x$ompi_ac_caps" = xy; then
ompi_ac_align_fn=ALIGN
else
AC_MSG_WARN([*** FORTRAN external naming convention undefined])
AC_MSG_ERROR([*** Cannot continue.])
fi
fi
fi
OMPI_F77_MAKE_C_FUNCTION([ompi_ac_align_fn], [align])
#
# Fortran module

Просмотреть файл

@ -21,21 +21,7 @@ AC_DEFUN([OMPI_F90_GET_SIZEOF],[
# Determine FORTRAN datatype size.
# First arg is type, 2nd arg is config var to define.
AC_MSG_CHECKING([size of FORTRAN $1])
ompi_ac_size_fn=
if test "x$ompi_ac_doubleunder" = xy || test "x$ompi_ac_singleunder" = xy; then
ompi_ac_size_fn=size_
else
if test "x$ompi_ac_nounder" = xy; then
ompi_ac_size_fn=size
else
if test "x$ompi_ac_caps" = xy; then
ompi_ac_size_fn=SIZE
else
AC_MSG_WARN([*** FORTRAN external naming convention undefined])
AC_MSG_ERROR([*** Cannot continue.])
fi
fi
fi
OMPI_F77_MAKE_C_FUNCTION([ompi_ac_size_fn], [size])
#
# Cannot use standard AC_TRY macros because we need two different .o

Просмотреть файл

@ -51,21 +51,7 @@ AC_DEFUN([OMPI_INTL_PTHREAD_TRY_LINK_F77], [
#
# Make sure that we can run a small application in Fortran, with
# pthreads living in a C object file
ompi_ac_thread_fn=
if test "x$ompi_ac_doubleunder" = xy || test "x$ompi_ac_singleunder" = xy; then
ompi_ac_thread_fn=pthreadtest_
else
if test "x$ompi_ac_nounder" = xy; then
ompi_ac_thread_fn=pthreadtest
else
if test "x$ompi_ac_caps" = xy; then
ompi_ac_thread_fn=PTHREADTEST
else
AC_MSG_WARN([*** FORTRAN external naming convention undefined])
AC_MSG_ERROR([*** Cannot continue.])
fi
fi
fi
OMPI_F77_MAKE_C_FUNCTION([ompi_ac_thread_fn], [pthreadtest])
# Fortran module
cat > conftestf.f <<EOF

Просмотреть файл

@ -17,57 +17,38 @@ dnl
dnl $HEADER$
dnl
# OMPI_FIND_TYPE(type, [list of c types], abort if not found,
# target size, variable to set)
# -----------------------------------------------------------
AC_DEFUN([OMPI_FIND_TYPE],[
# $1 = message ouptupt
# $2 = C types to check
# $3 = abort on not found
# $4 = target size
# $5 = output variable name
oft_msg="$1"
oft_types="$2"
AS_VAR_PUSHDEF([type_var], [ompi_cv_find_type_$1])
oft_abort_on_fail="$3"
oft_target_size="$4"
oft_target_name="$5"
# Announce
AC_MSG_CHECKING([for C type corresponding to $oft_msg])
# Loop over all the types handed to us
AC_CACHE_CHECK([for C type corresponding to $1], type_var,
[ # Loop over all the types handed to us
oft_real_type=
for oft_type in $oft_types; do
if test -z "$oft_real_type"; then
# Convert the name handed to us to a variable name, and get
# its size in $oft_type_size
oft_type_varname="`echo $oft_type | sed -e s/:/_/g`"
oft_str="oft_type_size=\$ac_cv_sizeof_${oft_type_varname}"
eval $oft_str
# If the size matches the target size, we're done
if test "$oft_target_size" != "" -a \
"$oft_type_size" = "$oft_target_size"; then
oft_real_type="`echo $oft_type | sed -e 's/:/ /'g`"
AS_IF([test "$oft_target_size" != ""],
[m4_foreach(oft_type, [$2],
[if test -z "$oft_real_type"; then
if test "[$ac_cv_sizeof_]m4_bpatsubst(oft_type, [[^a-zA-Z0-9_]], [_])" = "$oft_target_size" ; then
oft_real_type="oft_type"
fi
fi
done
])])
AS_IF([test -z "$oft_real_type"],
[AS_VAR_SET(type_var, "not found")],
[AS_VAR_SET(type_var, "$oft_real_type")])])
# Did we find it?
if test -z "$oft_real_type"; then
AC_MSG_RESULT([not found])
AC_MSG_WARN([*** Did not find corresponding C type])
if test "$oft_abort_on_fail" != "no"; then
AC_MSG_ERROR([Cannot continue])
fi
else
AC_MSG_RESULT([$oft_real_type])
fi
AS_IF([test "AS_VAR_GET(type_var)" == "not found"],
[AC_MSG_WARN([*** Did not find corresponding C type])
AS_IF([test "$oft_abort_on_fail" != "no"],
[AC_MSG_ERROR([Cannot continue])])])
# Set the type in the output, even if it's empty (so that the caller
# knows if we found it or not)
$5=AS_VAR_GET(type_var)
oft_str="${oft_target_name}=\$oft_real_type"
eval $oft_str
unset oft_real_type oft_target_size
unset oft_types oft_name oft_str oft_real_type oft_target_size oft_type_size oft_msg oft_type_varname])
AS_VAR_POPDEF([type_var])dnl
])dnl

Просмотреть файл

@ -457,7 +457,7 @@ OMPI_CONFIG_ASM
##################################
OMPI_SETUP_F77
OMPI_F77_FIND_EXT_SYMBOL_CONVENTION($OMPI_F77)
OMPI_F77_FIND_EXT_SYMBOL_CONVENTION
# This allows us to mark bogus types, but still have them be a valid
# [sentinel] value
@ -468,35 +468,32 @@ AC_DEFINE([ompi_fortran_bogus_type_t], [int],
# We want to set the #define's for all of these, so invoke the macros
# regardless of whether we have F77 support or not.
OMPI_F77_CHECK(LOGICAL, LOGICAL, logical, yes,
[char int int32_t], -1)
OMPI_F77_CHECK([LOGICAL], [yes], [char, int, int32_t], [-1])
OMPI_F77_CHECK([INTEGER], [yes],
[int32_t, int, int64_r, long long, long], [-1])
OMPI_F77_CHECK([INTEGER*1], [no],
[char, int8_t, short, int, int64_t, long long, long], [1])
OMPI_F77_CHECK([INTEGER*2], [no],
[short, int16_t, int32_t, int, int64_t, long long, long], [2])
OMPI_F77_CHECK([INTEGER*4], [no],
[int32_t, int, int64_t, long long, long], [4])
OMPI_F77_CHECK([INTEGER*8], [no],
[int, int64_t, long long, long], [8])
OMPI_F77_CHECK([INTEGER*16], [no],
[int, int64_t, long long, long], [16])
OMPI_F77_CHECK(INTEGER, INTEGER, integer, yes,
[int32_t int int64_r long:long long], -1)
OMPI_F77_CHECK(INTEGER*1, INTEGER1, integer1, no,
[char int8_t short int int64_t long:long long], 1)
OMPI_F77_CHECK(INTEGER*2, INTEGER2, integer2, no,
[short int16_t int32_t int int64_t long:long long], 2)
OMPI_F77_CHECK(INTEGER*4, INTEGER4, integer4, no,
[int32_t int int64_t long:long long], 4)
OMPI_F77_CHECK(INTEGER*8, INTEGER8, integer8, no,
[int int64_t long:long long], 8)
OMPI_F77_CHECK(INTEGER*16, INTEGER16, integer16, no,
[int int64_t long:long long], 16)
OMPI_F77_CHECK([REAL], [yes],
[float, double, long double], [-1])
OMPI_F77_CHECK([REAL*4], [no],
[float, double, long double], [4])
OMPI_F77_CHECK([REAL*8], [no],
[float, double, long double], [8])
OMPI_F77_CHECK([REAL*16], [no],
[float, double, long double], [16])
OMPI_F77_CHECK([DOUBLE PRECISION], [yes],
[float, double, long double], [-1])
OMPI_F77_CHECK(REAL, REAL, real, yes,
[float double long:double], -1)
OMPI_F77_CHECK(REAL*4, REAL4, real4, no,
[float double long:double], 4)
OMPI_F77_CHECK(REAL*8, REAL8, real8, no,
[float double long:double], 8)
OMPI_F77_CHECK(REAL*16, REAL16, real16, no,
[float double long:double], 16)
OMPI_F77_CHECK(DOUBLE PRECISION, DOUBLE_PRECISION, double_precision, yes,
[float double long:double], -1)
OMPI_F77_CHECK(COMPLEX, COMPLEX, [], yes, [], -1)
OMPI_F77_CHECK([COMPLEX], [yes], [], [-1])
# The complex*N tests are a bit different (note: the complex tests are
# the same as all the rest, because complex is a composite of two
@ -509,9 +506,9 @@ OMPI_F77_CHECK(COMPLEX, COMPLEX, [], yes, [], -1)
# have a back-end C type for it)
# b) compiler supports complex*N
OMPI_F77_CHECK(COMPLEX*8, COMPLEX8, [], no, [], 8)
OMPI_F77_CHECK(COMPLEX*16, COMPLEX16, [], no, [], 16)
OMPI_F77_CHECK(COMPLEX*32, COMPLEX32, [], no, [], 32)
OMPI_F77_CHECK([COMPLEX*8], [no], [], [8])
OMPI_F77_CHECK([COMPLEX*16], [no], [], [16])
OMPI_F77_CHECK([COMPLEX*32], [no], [], [32])
# Regardless of whether we have fortran bindings, or even a fortran
# compiler, get the max value for a fortran MPI handle (this macro