On 11/24/2014 01:02 PM, Daniel J Sebald wrote:
On 11/24/2014 02:52 PM, Mike Miller wrote:
On Mon, Nov 24, 2014 at 12:28:21 -0800, Rik wrote:
On 11/24/2014 11:33 AM, Daniel J Sebald wrote:
That is, if we want gfortran to have precedence, then we would define
(using the example at the above link)
AC_PROG_F77([gfortran fl32 f77 fort77 xlf g77 f90 xlf90])
So, perhaps that is a better solution than using the stream editor to
I think this is a fine idea. Eliminate all the weird hacks with sed in
favor of just listing our preference.
The main problem with listing our preferred compiler like this is that
it discards the curated list of supported compilers that Autoconf
gives us today. So from a portability point of view, we would be
throwing away the autodetection of xlf95, ifort, pgf95, etc, (just
picking some random examples) that we inherit from Autoconf.
There is no way (that I know of) to set our preferred compiler without
specifying the entire list of compilers to try, to put it another way.
Other than the bootstrap_epilogue function that we currently use.
That's correct. But I just found out how to view what AC's preferred
list is. gfortran is now at the front of the list. The fact that g77
isn't even in their list, I think means that we don't even have to worry
about any problem that the stream-editor epilogue script was attempting
to solve. That is, the comment
## FIXME -- we should really work to fix autoconf so that it prefers
## gfortran over g77 even when searching for a Fortran 77 compiler.
has been implemented apparently.
I don't think that's true, at least not for my installation which is only 2
years old (Ubuntu 12.04). The following is from
# _AC_PROG_FC([DIALECT], [COMPILERS...])
# DIALECT is a Fortran dialect, given by Fortran [YY]YY or simply [YY]YY,
# and must be one of those supported by _AC_FC_DIALECT_YEAR
# If DIALECT is supplied, then we search for compilers of that dialect
# first, and then later dialects. Otherwise, we search for compilers
# of the newest dialect first, and then earlier dialects in increasing age.
# This search order is necessarily imperfect because the dialect cannot
# always be inferred from the compiler name.
# Known compilers:
# f77/f90/f95: generic compiler names
# g77: GNU Fortran 77 compiler
# gfortran: GNU Fortran 95+ compiler (released in gcc 4.0)
# g95: original gcc-based f95 compiler (gfortran is a fork)
# ftn: native Fortran 95 compiler on Cray X1
# cf77: native F77 compiler under older Crays (prefer over fort77)
# fort77: native F77 compiler under HP-UX (and some older Crays)
# frt: Fujitsu F77 compiler
# pgf77/pgf90/pghpf/pgf95/pgfortran: Portland Group F77/F90/F95 compilers
# xlf/xlf90/xlf95: IBM (AIX) F77/F90/F95 compilers
# Prefer xlf9x to the generic names because they do not reject files
# with extension `.f'.
# lf95: Lahey-Fujitsu F95 compiler
# fl32: Microsoft Fortran 77 "PowerStation" compiler
# af77: Apogee F77 compiler for Intergraph hardware running CLIX
# epcf90: "Edinburgh Portable Compiler" F90
# fort: Compaq (now HP) Fortran 90/95 compiler for Tru64 and Linux/Alpha
# ifort, previously ifc: Intel Fortran 95 compiler for Linux/x86
# efc: Intel Fortran 95 compiler for IA64
m4_define([_AC_F95_FC], [gfortran g95 xlf95 f95 fort ifort ifc efc
pgfortran pgf95 lf95 ftn])
m4_define([_AC_F90_FC], [xlf90 f90 pgf90 pghpf epcf90])
m4_define([_AC_F77_FC], [g77 xlf f77 frt pgf77 cf77 fort77 fl32 af77])
, [_AC_F90_FC _AC_F95_FC],
, [_AC_F77_FC _AC_F90_FC _AC_F95_FC],
[_AC_F95_FC _AC_F90_FC _AC_F77_FC])))
The default for the list _AC_F77_FC which begins with g77. gfortran is
only added in later via _AC_F95_FC. I checked this by symlinking g77 to
gfortran and then re-running configure and it picks up g77 now instead of
Interestingly, this is the entire list of known compilers so we could
simply put this list in as the preference to AC_PROG_F77 with gfortran at
the start like so:
AC_PROG_F77([gfortran g77 xlf f77 frt pgf77 cf77 fort77 fl32 af77 xlf90 f90
pgf90 pghpf epcf90 g95 xlf95 f95 fort ifort ifc efc pgfortran pgf95 lf95 ftn])
I did this and it now picks up gfortran even with g77 symlinked in /usr/bin.