From a2c711b54b207d9228ca70fe08028614903c2bf6 Mon Sep 17 00:00:00 2001 From: Gilles Gouaillardet Date: Wed, 1 Apr 2020 16:19:54 +0900 Subject: [PATCH] configury: try if -fpp flag is needed to preprocess .F90 files .F90 files are preprocessed by gfortran and other compilers. NAG compilers only preprocess .{ff,ff90,ff95} files, and the -fpp flag is required to process .F90 files. Fixes open-mpi/ompi#7583 Signed-off-by: Gilles Gouaillardet --- config/ompi_setup_fc.m4 | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/config/ompi_setup_fc.m4 b/config/ompi_setup_fc.m4 index a65caa179d..7526e15c63 100644 --- a/config/ompi_setup_fc.m4 +++ b/config/ompi_setup_fc.m4 @@ -14,8 +14,8 @@ 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) 2015-2016 Research Organization for Information Science -dnl and Technology (RIST). All rights reserved. +dnl Copyright (c) 2015-2020 Research Organization for Information Science +dnl and Technology (RIST). All rights reserved. dnl $COPYRIGHT$ dnl dnl Additional copyrights may follow @@ -139,6 +139,24 @@ 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* + # Per trac #1982, on OS X, we may need some esoteric linker flags # in the wrapper compilers. However, per # https://github.com/open-mpi/ompi/issues/259, we need to use