1
1

Merge pull request #7593 from jsquyres/pr/fix-fortran-preprocessor-configure-check

Fortran: fix the F90 compiler preprocessor check
Этот коммит содержится в:
Jeff Squyres 2020-04-02 19:50:19 -04:00 коммит произвёл GitHub
родитель 7d31a99ef8 a7e4ca4dc0
Коммит 4652ba5518
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
2 изменённых файлов: 48 добавлений и 18 удалений

43
config/ompi_fortran_check_preprocess_f90.m4 Обычный файл
Просмотреть файл

@ -0,0 +1,43 @@
dnl -*- shell-script -*-
dnl
dnl Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
dnl University Research and Technology
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 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) 2009 Oak Ridge National Labs. All rights reserved.
dnl Copyright (c) 2009-2020 Cisco Systems, Inc. All rights reserved.
dnl Copyright (c) 2015 Research Organization for Information Science
dnl and Technology (RIST). All rights reserved.
dnl $COPYRIGHT$
dnl
dnl Additional copyrights may follow
dnl
dnl $HEADER$
dnl
AC_DEFUN([OMPI_FORTRAN_CHECK_PREPROCESS_F90], [
AC_MSG_CHECKING([if Fortran compilers preprocess .F90 files without additional flag])
cat > conftest_f.F90 << EOF
#if 0
#error The source file was not preprocessed
#endif
program bogus
end program
EOF
OPAL_LOG_COMMAND([$FC $FCFLAGS -c conftest_f.F90],
[AC_MSG_RESULT([yes])],
[AC_MSG_RESULT([no])
AC_MSG_CHECKING([if -fpp flag works])
OPAL_LOG_COMMAND([$FC $FCFLAGS -fpp -c conftest_f.F90],
[AC_MSG_RESULT([yes])
FCFLAGS="$FCFLAGS -fpp"],
[AC_MSG_RESULT(no)
AC_MSG_ERROR([cannot preprocess Fortran files, Aborting])])])
rm -f conftest*
])dnl

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

@ -13,7 +13,7 @@ dnl All rights reserved.
dnl Copyright (c) 2007 Los Alamos National Security, LLC. All rights
dnl reserved.
dnl Copyright (c) 2007 Sun Microsystems, Inc. All rights reserved.
dnl Copyright (c) 2009-2014 Cisco Systems, Inc. All rights reserved.
dnl Copyright (c) 2009-2020 Cisco Systems, Inc. All rights reserved.
dnl Copyright (c) 2015-2020 Research Organization for Information Science
dnl and Technology (RIST). All rights reserved.
dnl $COPYRIGHT$
@ -139,23 +139,10 @@ AC_DEFUN([OMPI_SETUP_FC],[
[AC_FC_SRCEXT(f)
AC_FC_SRCEXT(f90)])
AC_MSG_CHECKING([if Fortran compilers preprocess .F90 files without additional flag])
cat > conftest_f.F90 << EOF
#if 0
#error The source file was not preprocessed
#endif
program bogus
end program
EOF
OPAL_LOG_COMMAND([$FC $FCFLAGS -c conftest_f.F90],
[AC_MSG_RESULT(["yes"])],
[AC_MSG_CHECKING([if -fpp flag works])
OPAL_LOG_COMMAND([$FC $FCFLAGS -fpp -c conftest_f.F90],
[AC_MSG_RESULT(["yes"])
FCFLAGS="$FCFLAGS -fpp"],
[AC_MSG_RESULT("no")
AC_MSG_ERROR(["cannot preprocess Fortran files, Aborting"])])])
rm -f conftest*
# Check to see if we need additional compiler flags for
# preprocessing .F90 files.
AS_IF([test $ompi_fc_happy -eq 1],
[OMPI_FORTRAN_CHECK_PREPROCESS_F90])
# Per trac #1982, on OS X, we may need some esoteric linker flags
# in the wrapper compilers. However, per