#60 closed defect (fixed)
Wrong gcc option for GFortran
Reported by: | Dave Offiler | Owned by: | marq |
---|---|---|---|
Priority: | normal | Milestone: | |
Component: | ROPP (all) | Version: | 0.8 |
Keywords: | GFortran | Cc: |
Description
GFortran requires gcc to use the -DNAGf90Fortran convention of cfortran.h (this appears to have changed from -Df2cFortran from 4.1.0 about 6 months ago).
The ROPP <package>/m4/cm_compiler_defualts.m4 detects 'GNU' fortran and sets the default to the f2c form. This is correct for g95, but not (now) for gfc. Adding -DNAGf90Fortran to the configure CPPFLAGS doesn't override the default - both appear in Makefile, so presumably gcc only accespts the first occurance (the default).
While ropp_tools appears to build correctly with gfc, the print_stdout.c & print_stderr.c in messages/ are not built with the right interface; this causes dependent modules (ropp_io) to fail ./configure, as the test for 'message' in ropp_tools fails to comple.
Hand-editing ropp_tools/build/Makefile to change AM_CPPFLAGS from 'f2c' to 'NAGf90' allows the correct C interfaces in ropp_tools to be built, and ropp_io ./configure works again with gfc.
cm_compiler_defaults.m4 (and/or the vendor detector code in cm_compilers.m4) needs modifying to detect gfc from g95 (both report as 'GNU'). For reference, if it helps,
$ gfc --version GNU Fortran 95 (GCC) 4.2.0 20060619 (experimental) Copyright (C) 2006 Free Software Foundation, Inc. GNU Fortran comes with NO WARRANTY, to the extent permitted by law. You may redistribute copies of GNU Fortran under the terms of the GNU General Public License. For more information about these matters, see the file named COPYING $ g95 --version G95 (GCC 4.0.3 (g95!) Jun 18 2006) Copyright (C) 2002-2005 Free Software Foundation, Inc. G95 comes with NO WARRANTY, to the extent permitted by law. You may redistribute copies of G95 under the terms of the GNU General Public License. For more information about these matters, see the file named COPYING
Maybe instead of 'GCC', CM_FC_VENDOR could detect as 'GNU' (GFortran) or 'G95' ?
Change history (4)
comment:1 by , 18 years ago
comment:2 by , 18 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
Version: | 0.8 |
a) cm_compilers.m4
Add 'G95' to list of compiler vendor strings in both CM_PROG_F77_VENDOR and CM_PROG_FC_VENDOR macros before GCC so that g95 can be detected as such. GFortran continues to be detected as GCC
b) cm_compiler_defaults.m4
Added new case block for G95 as copy of the one for GCC; modified AM_CPPFLAGS to be -DNAGf90Fortran instead of -Df2cFortran in the GCC block.
These two changes allow the configure for gfc to generate the appropriate gcc interfaces.
comment:3 by , 18 years ago
Version: | → 0.8 |
---|
Until the appropriate m4 files are changed so that configure generates the correct gcc flag, the following hack to the ropp configure script for gfc (ropp-configure-gfc) will do the job:
This at least allows ropp_io configure to successfully test 'message' against the required ropp_tools library, pre-built using the above script.