1
1

Fix the case where there is no Fortran compiler found. Possibly fix

the case where we have a really ancient Fortran compiler that does not
support ISO_C_BINDING, but need to test to be sure that the new
configury works.

This commit was SVN r26290.
Этот коммит содержится в:
Jeff Squyres 2012-04-18 19:29:07 +00:00
родитель da2cd96bc5
Коммит b9640a582a
5 изменённых файлов: 92 добавлений и 29 удалений

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

@ -52,7 +52,6 @@ AC_DEFUN([OMPI_INTL_PTHREAD_TRY_LINK_FORTRAN], [
#
# Make sure that we can run a small application in Fortran, with
# pthreads living in a C object file
OMPI_FORTRAN_MAKE_C_FUNCTION([ompi_ac_thread_fn], [pthreadtest])
# Fortran module
cat > conftestf.f <<EOF
@ -76,7 +75,7 @@ $ompi_conftest_h
#ifdef __cplusplus
extern "C" {
#endif
void $ompi_ac_thread_fn()
void pthreadtest_f(void)
{
pthread_t th;
pthread_create(&th, NULL, NULL, NULL);
@ -86,6 +85,19 @@ void $ompi_ac_thread_fn()
pthread_create(0,0,0,0);
pthread_cleanup_pop(0);
}
void pthreadtest(void)
{ return pthreadtest_f(); }
void pthreadtest_(void)
{ return pthreadtest_f(); }
void pthreadtest__(void)
{ return pthreadtest_f(); }
void PTHREADTEST(void)
{ return pthreadtest_f(); }
#ifdef __cplusplus
}
#endif
@ -225,7 +237,7 @@ AC_DEFUN([OMPI_INTL_POSIX_THREADS_PLAIN_FC], [
#
# Fortran compiler
#
if test "$ompi_pthread_fortran_success" = "0" -a "$OMPI_WANT_FORTRAN_BINDINGS" = "1"; then
if test "$ompi_pthread_fortran_success" = "0" -a "$OMPI_WANT_FORTRAN_BINDINGS" = "1" -a $ompi_fortran_happy -eq 1; then
AC_MSG_CHECKING([if Fortran compiler and POSIX threads work as is])
if test "$HAVE_POSIX_THREADS" = "1" ; then
run_this_test=1

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

@ -22,19 +22,17 @@ AC_DEFUN([OMPI_FORTRAN_CHECK_LOGICAL_ARRAY],[
AC_CACHE_CHECK([for correct handling of Fortran logical arrays],
logical_array_var,
[if test "$1" = "none" -o $OMPI_WANT_FORTRAN_BINDINGS -eq 0; then
[if test "$1" = "none" -o $OMPI_WANT_FORTRAN_BINDINGS -eq 0 -o $ompi_fortran_happy -eq 0; then
value=skipped
else
OMPI_FORTRAN_MAKE_C_FUNCTION([ompi_check_logical_fn], [check])
# Fortran module
cat > conftestf.f <<EOF
program check_logical_array
external check
external ompi_check
logical l(2)
l(1)=.FALSE.
l(2)=.TRUE.
CALL check(l)
CALL ompi_check(l)
end
EOF
@ -56,9 +54,7 @@ EOF
#ifdef __cplusplus
extern "C" {
#endif
void $ompi_check_logical_fn(ompi_fortran_logical_t * logical);
void $ompi_check_logical_fn(ompi_fortran_logical_t * logical)
void ompi_check_f(ompi_fortran_logical_t * logical)
{
int result = 0;
FILE *f=fopen("conftestval", "w");
@ -69,6 +65,19 @@ void $ompi_check_logical_fn(ompi_fortran_logical_t * logical)
result = 1;
fprintf(f, "%d\n", result);
}
void ompi_check(ompi_fortran_logical_t * logical)
{ ompi_check_f(logical); }
void ompi_check_(ompi_fortran_logical_t * logical)
{ ompi_check_f(logical); }
void ompi_check__(ompi_fortran_logical_t * logical)
{ ompi_check_f(logical); }
void OMPI_CHECK(ompi_fortran_logical_t * logical)
{ ompi_check_f(logical); }
#ifdef __cplusplus
}
#endif

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

@ -18,8 +18,8 @@ dnl
dnl $HEADER$
dnl
# OMPI_FORTRAN_GET_KIND_VALUE(kind, variable to set)
# --------------------------------------------------------
# OMPI_FORTRAN_GET_KIND_VALUE(kind, decimal range, variable to set)
# -----------------------------------------------------------------
AC_DEFUN([OMPI_FORTRAN_GET_KIND_VALUE],[
# Use of m4_translit suggested by Eric Blake:
# http://lists.gnu.org/archive/html/bug-autoconf/2010-10/msg00016.html
@ -28,7 +28,7 @@ AC_DEFUN([OMPI_FORTRAN_GET_KIND_VALUE],[
rm -f conftest.out
AC_CACHE_CHECK([KIND value of Fortran $1], kind_value_var,
[if test $OMPI_WANT_FORTRAN_BINDINGS -eq 0 ; then
[if test $OMPI_WANT_FORTRAN_BINDINGS -eq 0 -o $ompi_fortran_happy -eq 0; then
value=skipped
else
AC_LANG_PUSH([Fortran])
@ -40,6 +40,14 @@ AC_DEFUN([OMPI_FORTRAN_GET_KIND_VALUE],[
close(7)
]]), [value=`cat conftest.out | awk '{print [$]1}'`], [value=no], [value=cross])
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])
_OMPI_FORTRAN_SELECTED_INT_KIND($2, value)])
AS_IF([test "$value" = "no"],
[AC_MSG_WARN([Could not determine KIND value of $1])
AC_MSG_WARN([See config.log for more details])
@ -53,6 +61,33 @@ AC_DEFUN([OMPI_FORTRAN_GET_KIND_VALUE],[
unset value
])
AS_VAR_COPY([$2], [kind_value_var])
AS_VAR_COPY([$3], [kind_value_var])
AS_VAR_POPDEF([kind_value_var])
])dnl
# _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])
if test "$OMPI_WANT_F90_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])
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])
AC_LANG_POP([Fortran])])
# All analysis of $value is done in the upper-level / calling
# macro
AS_VAR_COPY([$3], [type_var])
else
$3=skipped
fi
AS_VAR_POPDEF([type_var])dnl
])

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

@ -31,11 +31,9 @@ AC_DEFUN([OMPI_FORTRAN_GET_VALUE_TRUE],[
AC_CACHE_CHECK([Fortran value for .TRUE. logical type],
fortran_true_var,
[if test "$1" = "none" -o $OMPI_WANT_FORTRAN_BINDINGS -eq 0 ; then
[if test "$1" = "none" -o $OMPI_WANT_FORTRAN_BINDINGS -eq 0 -o $ompi_fortran_happy -eq 0 ; then
value=77
else
OMPI_FORTRAN_MAKE_C_FUNCTION([ompi_print_logical_fn], [print])
#
# C module
# We really need the confdefs.h Header file for
@ -57,9 +55,7 @@ AC_DEFUN([OMPI_FORTRAN_GET_VALUE_TRUE],[
extern "C" {
#endif
void $ompi_print_logical_fn(ompi_fortran_logical_t * logical);
void $ompi_print_logical_fn(ompi_fortran_logical_t * logical)
void ompi_print_f(ompi_fortran_logical_t * logical)
{
FILE *f=fopen("conftestval", "w");
if (!f) exit(1);
@ -77,16 +73,27 @@ void $ompi_print_logical_fn(ompi_fortran_logical_t * logical)
}
}
void ompi_print(ompi_fortran_logical_t *logical)
{ ompi_print_f(logical); }
void ompi_print_(ompi_fortran_logical_t *logical)
{ ompi_print_f(logical); }
void ompi_print__(ompi_fortran_logical_t *logical)
{ ompi_print_f(logical); }
void OMPI_PRINT(ompi_fortran_logical_t *logical)
{ ompi_print_f(logical); }
#ifdef __cplusplus
}
#endif
EOF
cat > conftestf.f <<EOF
program main
logical value
value=.TRUE.
CALL print(value)
CALL ompi_print(value)
end
EOF
@ -98,9 +105,9 @@ EOF
[happy=1], [happy=0])],
[happy=0])
if test "$happy" = "0" ; then
AC_MSG_ERROR([Could not determine value of Fortran .TRUE.. Aborting.])
fi
AS_IF([test $happy -eq 0 -a $ompi_fortran_happy -eq 1],
[AC_MSG_ERROR([Could not compile Fortran .TRUE. test. Aborting.])
])
AS_IF([test "$cross_compiling" = "yes"],
[AC_MSG_ERROR([Can not determine value of .TRUE. when cross-compiling])],

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

@ -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], [OMPI_FORTRAN_C_INT16_T_KIND])
OMPI_FORTRAN_GET_KIND_VALUE([C_INT32_T], [OMPI_FORTRAN_C_INT32_T_KIND])
OMPI_FORTRAN_GET_KIND_VALUE([C_INT64_T], [OMPI_FORTRAN_C_INT64_T_KIND])
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])
# Get the kind value for Fortran MPI_INTEGER_KIND (corresponding
# to whatever is the same size as a F77 INTEGER -- for the