fortran: configure test for "optional" keyword was too aggressive
After discussions with Craig, it looks like the check in this configure test was too aggressive and based on a prior mpi_f08 implementation model. We don't use "value" any more, and we also don't pass optional parameters back to C code, so this test was checking far more than it needed to... in a non-standard way (which breaks in the Intel 2015 Fortran compiler). All we ''really'' need is to check whether the compiler supports the "optional" keyword. So make the test ''much'' simpler and just check whether ''optional'' compiles successfull or not. Reviewed by Craig Rasmussen cmr=v1.8.3:reviewer=ompi-rm1.8 This commit was SVN r32752.
Этот коммит содержится в:
родитель
0f29f222f2
Коммит
cf56a369c2
@ -6,34 +6,30 @@ dnl Corporation. All rights reserved.
|
||||
dnl Copyright (c) 2004-2005 The University of Tennessee and The University
|
||||
dnl of Tennessee Research Foundation. All rights
|
||||
dnl reserved.
|
||||
dnl Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
|
||||
dnl Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
|
||||
dnl University of Stuttgart. All rights reserved.
|
||||
dnl Copyright (c) 2004-2005 The Regents of the University of California.
|
||||
dnl All rights reserved.
|
||||
dnl Copyright (c) 2010-2012 Cisco Systems, Inc. All rights reserved.
|
||||
dnl Copyright (c) 2010-2014 Cisco Systems, Inc. All rights reserved.
|
||||
dnl $COPYRIGHT$
|
||||
dnl
|
||||
dnl
|
||||
dnl Additional copyrights may follow
|
||||
dnl
|
||||
dnl
|
||||
dnl $HEADER$
|
||||
dnl
|
||||
|
||||
# Check whether or not the Fortran compiler supports optional
|
||||
# arguments or not, and we (generally) don't need wrapper subroutines.
|
||||
# Check whether or not the Fortran compiler supports the "optional"
|
||||
# keyword or not.
|
||||
|
||||
# OMPI_FORTRAN_CHECK_OPTIONAL_ARGS([action if found],
|
||||
# OMPI_FORTRAN_CHECK_OPTIONAL_ARGS([action if found],
|
||||
# [action if not found])
|
||||
# ----------------------------------------------------
|
||||
AC_DEFUN([OMPI_FORTRAN_CHECK_OPTIONAL_ARGS],[
|
||||
unset happy
|
||||
OPAL_VAR_SCOPE_PUSH([happy ompi_conftest_h])
|
||||
AS_VAR_PUSHDEF([optional_var], [ompi_cv_fortran_optional])
|
||||
|
||||
AC_CACHE_CHECK([if Fortran compiler supports optional arguments],
|
||||
[ompi_cv_fortran_optional_args],
|
||||
[ompi_cv_fortran_optional_args=no
|
||||
OMPI_FORTRAN_MAKE_C_FUNCTION([ompi_ac_check_op_fn], [check_op])
|
||||
cat > conftestf.f90 <<EOF
|
||||
program check_for_optional
|
||||
AC_CACHE_CHECK([if Fortran compiler supports optional arguments], optional_var,
|
||||
[AC_LANG_PUSH([Fortran])
|
||||
AC_COMPILE_IFELSE([AC_LANG_SOURCE([[program check_for_optional
|
||||
use, intrinsic :: iso_c_binding
|
||||
|
||||
interface
|
||||
@ -47,67 +43,12 @@ program check_for_optional
|
||||
|
||||
call check_op(0)
|
||||
call check_op(1, ierror)
|
||||
end program
|
||||
EOF
|
||||
end program]])],
|
||||
[AS_VAR_SET(optional_var, yes)],
|
||||
[AS_VAR_SET(optional_var, no)])
|
||||
AC_LANG_POP([Fortran])
|
||||
])
|
||||
|
||||
# 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
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
void $ompi_ac_check_op_fn(int has_op, int *ierror)
|
||||
{
|
||||
/* Force a segv if the conditions are wrong */
|
||||
char *bogus = 0;
|
||||
if (0 == has_op) {
|
||||
/* won't have optional argument */
|
||||
if (NULL != ierror) *bogus= 13;
|
||||
} else {
|
||||
/* will have optional argument */
|
||||
if (NULL == ierror) *bogus= 13;
|
||||
*ierror = 33;
|
||||
}
|
||||
}
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
EOF
|
||||
|
||||
OPAL_LOG_COMMAND([$CC $CFLAGS -I. -c conftest.c],
|
||||
[OPAL_LOG_COMMAND([$FC $FCFLAGS conftestf.f90 conftest.o -o conftest $LDFLAGS $LIBS],
|
||||
[happy="yes"], [happy="no"])],
|
||||
[happy="c_fail"])
|
||||
|
||||
AS_IF([test "$happy" = "c_fail"],
|
||||
[AC_MSG_RESULT([error])
|
||||
AC_MSG_ERROR([This error should not happen -- contact the Open MPI developers])
|
||||
])
|
||||
|
||||
AS_IF([test "$happy" = "no"],
|
||||
[AC_MSG_RESULT([unknown])
|
||||
AC_MSG_WARN([Cannot determine if Fortran compiler supports optional arguments])
|
||||
AC_MSG_WARN([Assuming: no])
|
||||
])
|
||||
|
||||
AS_IF([test "$cross_compiling" = "yes"],
|
||||
[AC_MSG_RESULT([cross-compiling])
|
||||
AC_MSG_ERROR([Cannot determine if Fortran compiler supports optional arguments when cross-compiling])],
|
||||
[OPAL_LOG_COMMAND([./conftest],
|
||||
[ompi_cv_fortran_optional_args=yes])
|
||||
])
|
||||
rm -f conftest*
|
||||
])dnl
|
||||
|
||||
AS_VAR_COPY([happy], [ompi_cv_fortran_optional_args])
|
||||
AS_IF([test "$happy" = "yes"], [$1], [$2])
|
||||
OPAL_VAR_SCOPE_POP
|
||||
AS_VAR_IF(optional_var, [yes], [$1], [$2])
|
||||
AS_VAR_POPDEF([optional_var])dnl
|
||||
])
|
||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user