diff --git a/config/ompi_fortran_check_optional_args.m4 b/config/ompi_fortran_check_optional_args.m4 index e6d42f3f30..06bd55e267 100644 --- a/config/ompi_fortran_check_optional_args.m4 +++ b/config/ompi_fortran_check_optional_args.m4 @@ -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 < conftest.c < -#include -$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 ])