Skip to content

Commit 4652ba5

Browse files
authored
Merge pull request #7593 from jsquyres/pr/fix-fortran-preprocessor-configure-check
Fortran: fix the F90 compiler preprocessor check
2 parents 7d31a99 + a7e4ca4 commit 4652ba5

File tree

2 files changed

+48
-18
lines changed

2 files changed

+48
-18
lines changed
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
dnl -*- shell-script -*-
2+
dnl
3+
dnl Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
4+
dnl University Research and Technology
5+
dnl Corporation. All rights reserved.
6+
dnl Copyright (c) 2004-2005 The University of Tennessee and The University
7+
dnl of Tennessee Research Foundation. All rights
8+
dnl reserved.
9+
dnl Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
10+
dnl University of Stuttgart. All rights reserved.
11+
dnl Copyright (c) 2004-2005 The Regents of the University of California.
12+
dnl All rights reserved.
13+
dnl Copyright (c) 2009 Oak Ridge National Labs. All rights reserved.
14+
dnl Copyright (c) 2009-2020 Cisco Systems, Inc. All rights reserved.
15+
dnl Copyright (c) 2015 Research Organization for Information Science
16+
dnl and Technology (RIST). All rights reserved.
17+
dnl $COPYRIGHT$
18+
dnl
19+
dnl Additional copyrights may follow
20+
dnl
21+
dnl $HEADER$
22+
dnl
23+
24+
AC_DEFUN([OMPI_FORTRAN_CHECK_PREPROCESS_F90], [
25+
AC_MSG_CHECKING([if Fortran compilers preprocess .F90 files without additional flag])
26+
cat > conftest_f.F90 << EOF
27+
#if 0
28+
#error The source file was not preprocessed
29+
#endif
30+
program bogus
31+
end program
32+
EOF
33+
OPAL_LOG_COMMAND([$FC $FCFLAGS -c conftest_f.F90],
34+
[AC_MSG_RESULT([yes])],
35+
[AC_MSG_RESULT([no])
36+
AC_MSG_CHECKING([if -fpp flag works])
37+
OPAL_LOG_COMMAND([$FC $FCFLAGS -fpp -c conftest_f.F90],
38+
[AC_MSG_RESULT([yes])
39+
FCFLAGS="$FCFLAGS -fpp"],
40+
[AC_MSG_RESULT(no)
41+
AC_MSG_ERROR([cannot preprocess Fortran files, Aborting])])])
42+
rm -f conftest*
43+
])dnl

config/ompi_setup_fc.m4

Lines changed: 5 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ dnl All rights reserved.
1313
dnl Copyright (c) 2007 Los Alamos National Security, LLC. All rights
1414
dnl reserved.
1515
dnl Copyright (c) 2007 Sun Microsystems, Inc. All rights reserved.
16-
dnl Copyright (c) 2009-2014 Cisco Systems, Inc. All rights reserved.
16+
dnl Copyright (c) 2009-2020 Cisco Systems, Inc. All rights reserved.
1717
dnl Copyright (c) 2015-2020 Research Organization for Information Science
1818
dnl and Technology (RIST). All rights reserved.
1919
dnl $COPYRIGHT$
@@ -139,23 +139,10 @@ AC_DEFUN([OMPI_SETUP_FC],[
139139
[AC_FC_SRCEXT(f)
140140
AC_FC_SRCEXT(f90)])
141141

142-
AC_MSG_CHECKING([if Fortran compilers preprocess .F90 files without additional flag])
143-
cat > conftest_f.F90 << EOF
144-
#if 0
145-
#error The source file was not preprocessed
146-
#endif
147-
program bogus
148-
end program
149-
EOF
150-
OPAL_LOG_COMMAND([$FC $FCFLAGS -c conftest_f.F90],
151-
[AC_MSG_RESULT(["yes"])],
152-
[AC_MSG_CHECKING([if -fpp flag works])
153-
OPAL_LOG_COMMAND([$FC $FCFLAGS -fpp -c conftest_f.F90],
154-
[AC_MSG_RESULT(["yes"])
155-
FCFLAGS="$FCFLAGS -fpp"],
156-
[AC_MSG_RESULT("no")
157-
AC_MSG_ERROR(["cannot preprocess Fortran files, Aborting"])])])
158-
rm -f conftest*
142+
# Check to see if we need additional compiler flags for
143+
# preprocessing .F90 files.
144+
AS_IF([test $ompi_fc_happy -eq 1],
145+
[OMPI_FORTRAN_CHECK_PREPROCESS_F90])
159146

160147
# Per trac #1982, on OS X, we may need some esoteric linker flags
161148
# in the wrapper compilers. However, per

0 commit comments

Comments
 (0)