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.
Этот коммит содержится в:
родитель
a584c60dbe
Коммит
48f82db838
@ -17,113 +17,96 @@ 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)
|
||||
# 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
|
||||
|
||||
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
|
||||
# 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=1], [ofc_have_type=0])
|
||||
else
|
||||
AC_MSG_CHECKING([if FORTRAN compiler supports $1])
|
||||
AC_MSG_RESULT([skipped])
|
||||
fi
|
||||
|
||||
# Look for a corresponding C type (will abort by itself if the
|
||||
# type isn't found and we need it)
|
||||
if test "$ofc_have_type" = "1"; then
|
||||
# What is the size of this type?
|
||||
|
||||
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
|
||||
# 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 "$3" != ""; then
|
||||
OMPI_FIND_TYPE([$1], [$3], [$2], [$ofc_type_size], [ofc_c_type])
|
||||
if test -z "$ofc_c_type"; then
|
||||
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
|
||||
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*.
|
||||
# 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_]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_]m4_bpatsubst(m4_bpatsubst([$1], [*], []), [[^a-zA-Z0-9_]], [_]),
|
||||
[$ofc_type_size],
|
||||
[Size of FORTRAN $1])
|
||||
AC_DEFINE_UNQUOTED([OMPI_ALIGNMENT_FORTRAN_]m4_bpatsubst(m4_bpatsubst([$1], [*], []), [[^a-zA-Z0-9_]], [_]),
|
||||
[$ofc_type_alignment],
|
||||
[Alignment of FORTRAN $1])
|
||||
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
|
||||
|
||||
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_]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]
|
||||
|
||||
# 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
|
||||
# Clean up
|
||||
unset ofc_have_type ofc_type_size ofc_type_alignment ofc_c_type
|
||||
unset ofc_expected_size
|
||||
])dnl
|
||||
|
@ -16,36 +16,15 @@ dnl $HEADER$
|
||||
dnl
|
||||
|
||||
AC_DEFUN([OMPI_F77_CHECK_LOGICAL_ARRAY],[
|
||||
AC_MSG_CHECKING([for correct handling of FORTRAN logical arrays])
|
||||
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 "$1" = "none" -o "$OMPI_WANT_F77_BINDINGS" = "0"; then
|
||||
AC_MSG_RESULT([no Fortran 77 bindings -- skipped])
|
||||
else
|
||||
|
||||
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
|
||||
# Fortran module
|
||||
cat > conftestf.f <<EOF
|
||||
program check_logical_array
|
||||
external CHECK
|
||||
logical l(2)
|
||||
@ -55,19 +34,17 @@ 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])
|
||||
AC_MSG_WARN([*** See config.log for details.])
|
||||
AC_MSG_ERROR([*** Cannot continue.])
|
||||
fi
|
||||
# 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])
|
||||
AC_MSG_WARN([*** See config.log for details.])
|
||||
AC_MSG_ERROR([*** Cannot continue.])
|
||||
fi
|
||||
|
||||
cat > conftest.c <<EOF
|
||||
cat > conftest.c <<EOF
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include "confdefs.h"
|
||||
@ -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],
|
||||
[happy=1], [happy=0])],
|
||||
[happy=0])
|
||||
if test "$happy" = "0" ; then
|
||||
AC_MSG_ERROR([Error determining if arrays of logical values work properly.])
|
||||
fi
|
||||
|
||||
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])
|
||||
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
|
||||
ompi_cv_f77_logical_array_correct=no
|
||||
fi],
|
||||
[ompi_cv_f77_logical_array_correct=no])])
|
||||
fi])
|
||||
|
||||
if test "$HAPPY" = "1" -a -f conftestval; then
|
||||
ompi_result=`cat conftestval`
|
||||
if test "$ompi_result" = "1"; then
|
||||
AC_MSG_RESULT([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])
|
||||
if test "$ompi_cv_f77_logical_array_correct" = "no" ; then
|
||||
AC_MSG_ERROR([Error determining if arrays of logical values work properly.])
|
||||
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.])
|
||||
fi
|
||||
|
||||
unset HAPPY ompi_result
|
||||
/bin/rm -f conftest*
|
||||
fi
|
||||
])dnl
|
||||
unset happy ompi_check_logical_fn
|
||||
/bin/rm -f conftest*
|
||||
])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],[
|
||||
# Determine FORTRAN datatype size.
|
||||
# First arg is type, 2nd arg is config var to define
|
||||
AS_VAR_PUSHDEF([type_var], [ompi_cv_f77_have_$1])
|
||||
|
||||
AC_MSG_CHECKING([if FORTRAN compiler supports $1])
|
||||
|
||||
AC_LANG_PUSH(Fortran 77)
|
||||
AC_COMPILE_IFELSE(AC_LANG_SOURCE([[C
|
||||
# Determine FORTRAN datatype size.
|
||||
# First arg is type, 2nd arg is config var to define
|
||||
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])
|
||||
else
|
||||
cat > conftestf.f <<EOF
|
||||
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 >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 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
|
||||
elif test "$ompi_cv_f77_external_symbol" = "single underscore" ; then
|
||||
ompi_fortran_single_underscore=1
|
||||
elif test "$ompi_cv_f77_external_symbol" = "mixed case" ; then
|
||||
ompi_fortran_caps=1
|
||||
elif test "$ompi_cv_f77_external_symbol" = "no underscore" ; then
|
||||
ompi_fortran_plain=1
|
||||
elif test "$ompi_cv_f77_external_sumbol" = "upper case" ; then
|
||||
ompi_fortran_caps=1
|
||||
else
|
||||
nm conftestf.o | grep foo_bar__ > /dev/null 2>&1
|
||||
if test $? = "0"; then
|
||||
AC_MSG_RESULT([double underscore])
|
||||
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])
|
||||
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])
|
||||
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])
|
||||
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])
|
||||
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
|
||||
AC_MSG_ERROR([unknown naming convention: $ompi_cv_f77_external_symbol])
|
||||
fi
|
||||
fi
|
||||
|
||||
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,
|
||||
[Whether fortran symbols have a trailing underscore or not])
|
||||
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,
|
||||
[Whether fortran symbols have no trailing underscore or not])
|
||||
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],
|
||||
[Whether fortran symbols have a trailing underscore or not])
|
||||
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],
|
||||
[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,31 +17,15 @@ 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])
|
||||
|
||||
#
|
||||
# Fortran module
|
||||
#
|
||||
|
||||
cat > conftestf.f <<EOF
|
||||
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
|
||||
$1 w,x,y,z
|
||||
@ -51,16 +35,13 @@ cat > conftestf.f <<EOF
|
||||
end
|
||||
EOF
|
||||
|
||||
#
|
||||
# C module
|
||||
#
|
||||
|
||||
if test -f conftest.h; then
|
||||
ompi_conftest_h="#include \"conftest.h\""
|
||||
else
|
||||
ompi_conftest_h=""
|
||||
fi
|
||||
cat > conftest.c <<EOF
|
||||
# C module
|
||||
if test -f conftest.h; then
|
||||
ompi_conftest_h="#include \"conftest.h\""
|
||||
else
|
||||
ompi_conftest_h=""
|
||||
fi
|
||||
cat > conftest.c <<EOF
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
$conftest
|
||||
@ -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],
|
||||
[happy="yes"], [happy="no"])], [happy="no"])
|
||||
|
||||
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])
|
||||
if test "$happy" = "no" ; then
|
||||
AC_MSG_ERROR([Could not determine alignment of $1])
|
||||
fi
|
||||
|
||||
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"
|
||||
fi
|
||||
else
|
||||
AC_MSG_RESULT([unknown])
|
||||
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])])])
|
||||
|
||||
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])
|
||||
unset happy ompi_conf
|
||||
rm -f conftest*])
|
||||
|
||||
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 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,65 +17,66 @@ 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_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
|
||||
else
|
||||
# Calculate the number of f's that we need to append to the hex
|
||||
# value. Do one less than we really need becaue we assume the
|
||||
# top nybble is 0x7 to avoid sign issues.
|
||||
ompi_numf=`expr $OMPI_SIZEOF_FORTRAN_INTEGER \* 2 - 1`
|
||||
ompi_fint_max=0x7
|
||||
while test "$ompi_numf" -gt "0"; do
|
||||
ompi_fint_max=${ompi_fint_max}f
|
||||
ompi_numf=`expr $ompi_numf - 1`
|
||||
done
|
||||
fi
|
||||
|
||||
AC_MSG_CHECKING([for max fortran MPI handle index])
|
||||
# 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
|
||||
else
|
||||
# Calculate the number of f's that we need to append to the hex
|
||||
# value. Do one less than we really need becaue we assume the
|
||||
# top nybble is 0x7 to avoid sign issues.
|
||||
ompi_numf=`expr $OMPI_SIZEOF_FORTRAN_INTEGER \* 2 - 1`
|
||||
ompi_fint_max=0x7
|
||||
while test "$ompi_numf" -gt "0"; do
|
||||
ompi_fint_max=${ompi_fint_max}f
|
||||
ompi_numf=`expr $ompi_numf - 1`
|
||||
done
|
||||
fi
|
||||
|
||||
# Get INT_MAX. Compute a SWAG if we are cross compiling or something
|
||||
# goes wrong.
|
||||
rm -f conftest.out > /dev/null 2>&1
|
||||
AC_RUN_IFELSE(AC_LANG_PROGRAM([[
|
||||
# Get INT_MAX. Compute a SWAG if we are cross compiling or something
|
||||
# goes wrong.
|
||||
rm -f conftest.out >/dev/null 2>&1
|
||||
AC_RUN_IFELSE(AC_LANG_PROGRAM([[
|
||||
#include <stdio.h>
|
||||
#include <limits.h>
|
||||
]],[[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.
|
||||
ompi_numf=`expr $ac_cv_sizeof_int \* 2 - 1`
|
||||
ompi_cint_max=0x7
|
||||
while test "$ompi_numf" -gt "0" ; do
|
||||
ompi_cint_max=${ompi_cint_max}f
|
||||
ompi_numf=`expr $ompi_numf - 1`
|
||||
done])
|
||||
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
|
||||
ompi_cint_max=${ompi_cint_max}f
|
||||
ompi_numf=`expr $ompi_numf - 1`
|
||||
done])
|
||||
|
||||
if test "$ompi_cint_max" = "0" ; then
|
||||
# wow - something went really wrong. Be conservative
|
||||
OMPI_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
|
||||
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 )"
|
||||
fi
|
||||
rm -f conftest.out > /dev/null 2>&1
|
||||
if test "$ompi_cint_max" = "0" ; then
|
||||
# wow - something went really wrong. Be conservative
|
||||
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_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_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 ])
|
||||
|
||||
AC_DEFINE_UNQUOTED(OMPI_FORTRAN_HANDLE_MAX,
|
||||
$OMPI_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])
|
||||
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)])
|
||||
])dnl
|
||||
|
@ -17,36 +17,15 @@ 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
|
||||
|
||||
#
|
||||
# Cannot use standard AC_TRY macros because we need two different .o
|
||||
# files here, and link them together
|
||||
#
|
||||
|
||||
#
|
||||
# Fortran module
|
||||
#
|
||||
|
||||
cat > conftestf.f <<EOF
|
||||
AS_VAR_PUSHDEF([type_var], [ompi_cv_f77_sizeof_$1])
|
||||
|
||||
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
|
||||
$1 x(2)
|
||||
@ -54,16 +33,13 @@ cat > conftestf.f <<EOF
|
||||
end
|
||||
EOF
|
||||
|
||||
#
|
||||
# C module
|
||||
#
|
||||
|
||||
if test -f conftest.h; then
|
||||
ompi_conftest_h="#include \"conftest.h\""
|
||||
else
|
||||
ompi_conftest_h=""
|
||||
fi
|
||||
cat > conftest.c <<EOF
|
||||
# C module
|
||||
if test -f conftest.h; then
|
||||
ompi_conftest_h="#include \"conftest.h\""
|
||||
else
|
||||
ompi_conftest_h=""
|
||||
fi
|
||||
cat > conftest.c <<EOF
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
$ompi_conftest_h
|
||||
@ -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],
|
||||
[happy="yes"], [happy="no"])], [happy="no"])
|
||||
|
||||
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])
|
||||
if test "$happy" = "no" ; then
|
||||
AC_MSG_ERROR([Could not determine size of $1])
|
||||
fi
|
||||
|
||||
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])
|
||||
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])])])
|
||||
|
||||
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])
|
||||
unset happy ompi_conftest_h
|
||||
rm -f conftest*])
|
||||
|
||||
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
|
||||
|
||||
unset ompi_ac_fortsize HAPPY ompi_conftest_h
|
||||
/bin/rm -f conftest*])dnl
|
||||
$2=AS_VAR_GET(type_var)
|
||||
AS_VAR_POPDEF([type_var])dnl
|
||||
])dnl
|
||||
|
@ -15,44 +15,31 @@ 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_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
|
||||
OMPI_F77_MAKE_C_FUNCTION([ompi_print_logical_fn], [print])
|
||||
|
||||
AC_MSG_CHECKING([FORTRAN value for .TRUE. logical type])
|
||||
#
|
||||
# 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])
|
||||
AC_MSG_WARN([*** See config.log for details.])
|
||||
AC_MSG_ERROR([*** Cannot continue.])
|
||||
fi
|
||||
|
||||
if test "$1" = "none" -o "$OMPI_WANT_F77_BINDINGS" = "0"; then
|
||||
OMPI_FORTRAN_VALUE_TRUE=0
|
||||
AC_MSG_RESULT([no Fortran 77 bindings -- skipped])
|
||||
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
|
||||
|
||||
#
|
||||
# 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])
|
||||
AC_MSG_WARN([*** See config.log for details.])
|
||||
AC_MSG_ERROR([*** Cannot continue.])
|
||||
fi
|
||||
|
||||
cat > conftest.c <<EOF
|
||||
cat > conftest.c <<EOF
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include "confdefs.h"
|
||||
@ -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");
|
||||
@ -80,7 +67,7 @@ void $ompi_ac_print_logical_fn(ompi_fortran_logical_t * logical)
|
||||
#endif
|
||||
EOF
|
||||
|
||||
cat > conftestf.f <<EOF
|
||||
cat > conftestf.f <<EOF
|
||||
program main
|
||||
logical value
|
||||
value=.TRUE.
|
||||
@ -88,38 +75,29 @@ EOF
|
||||
end
|
||||
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])
|
||||
#
|
||||
# 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],
|
||||
[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`
|
||||
if test "$happy" = "0" ; then
|
||||
AC_MSG_ERROR([Could not determine value of Fotran .TRUE.. Aborting.])
|
||||
fi
|
||||
|
||||
OMPI_FORTRAN_VALUE_TRUE=$ompi_ac_value_true
|
||||
AC_MSG_RESULT([$ompi_ac_value_true])
|
||||
else
|
||||
AC_MSG_RESULT([unknown])
|
||||
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])
|
||||
|
||||
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_DEFINE_UNQUOTED([OMPI_FORTRAN_VALUE_TRUE],
|
||||
[$ompi_cv_f77_true_value],
|
||||
[Fortran value for LOGICAL .TRUE. value])
|
||||
|
||||
AC_MSG_WARN([*** Problem running configure test!])
|
||||
AC_MSG_WARN([*** See config.log for details.])
|
||||
AC_MSG_ERROR([*** Cannot continue.])
|
||||
fi
|
||||
|
||||
unset HAPPY
|
||||
/bin/rm -f conftest*
|
||||
fi
|
||||
AC_DEFINE_UNQUOTED(OMPI_FORTRAN_VALUE_TRUE,
|
||||
$OMPI_FORTRAN_VALUE_TRUE,
|
||||
[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"
|
||||
oft_abort_on_fail="$3"
|
||||
oft_target_size="$4"
|
||||
oft_target_name="$5"
|
||||
AS_VAR_PUSHDEF([type_var], [ompi_cv_find_type_$1])
|
||||
|
||||
# Announce
|
||||
AC_MSG_CHECKING([for C type corresponding to $oft_msg])
|
||||
oft_abort_on_fail="$3"
|
||||
oft_target_size="$4"
|
||||
|
||||
# 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
|
||||
AC_CACHE_CHECK([for C type corresponding to $1], type_var,
|
||||
[ # Loop over all the types handed to us
|
||||
oft_real_type=
|
||||
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
|
||||
])])
|
||||
AS_IF([test -z "$oft_real_type"],
|
||||
[AS_VAR_SET(type_var, "not found")],
|
||||
[AS_VAR_SET(type_var, "$oft_real_type")])])
|
||||
|
||||
# Convert the name handed to us to a variable name, and get
|
||||
# its size in $oft_type_size
|
||||
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])])])
|
||||
|
||||
oft_type_varname="`echo $oft_type | sed -e s/:/_/g`"
|
||||
oft_str="oft_type_size=\$ac_cv_sizeof_${oft_type_varname}"
|
||||
eval $oft_str
|
||||
$5=AS_VAR_GET(type_var)
|
||||
|
||||
# If the size matches the target size, we're done
|
||||
unset oft_real_type oft_target_size
|
||||
|
||||
if test "$oft_target_size" != "" -a \
|
||||
"$oft_type_size" = "$oft_target_size"; then
|
||||
oft_real_type="`echo $oft_type | sed -e 's/:/ /'g`"
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
||||
# 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
|
||||
|
||||
# Set the type in the output, even if it's empty (so that the caller
|
||||
# knows if we found it or not)
|
||||
|
||||
oft_str="${oft_target_name}=\$oft_real_type"
|
||||
eval $oft_str
|
||||
|
||||
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
|
||||
|
59
configure.ac
59
configure.ac
@ -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
|
||||
|
Загрузка…
Ссылка в новой задаче
Block a user