octave-maintainers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: F77 vs. F90 in Octave


From: Daniel J Sebald
Subject: Re: F77 vs. F90 in Octave
Date: Mon, 24 Nov 2014 14:19:17 -0600
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.24) Gecko/20111108 Fedora/3.1.16-1.fc14 Thunderbird/3.1.16

On 11/24/2014 01:33 PM, Daniel J Sebald wrote:
On 11/24/2014 11:52 AM, Rik wrote:
On 11/24/2014 09:36 AM, Daniel J Sebald wrote:
On 11/24/2014 11:02 AM, Rik wrote:
A quick check for F90 features shows that> 95% is written in F77. The
exceptions are some files in blas-xtra and lapack-xtra written by
Jaroslav
that seem to be in a mostly F77 syntax, but with a few F95 features.

Is the F95 code using a different compiler then? Or maybe same compiler
but a compatibility flag? How is it compiling if FC=$F77?

As far as I can see, we've simply been getting lucky. The Fortran
compiler
on most Linux systems is gfortran which can compile both F77 and F90
code.

It's fine if autoconf recognizes that gfortran is compatible with both,
but we shouldn't have to force FC=$F77.

I'm rebuilding from scratch at the moment after having removed FC=$F77.
I just noticed there is a related modification earlier than the make
stage. Inside the bootstrap is the following:

bootstrap_epilogue ()
{
## G77 is obsolete, but it is still the first option in the autoconf
## Fortran macros. We should avoid it, because mixing old versions of
## g77 with modern gcc and g++ causes trouble. The following will
## make it harder (but not impossible) for users to make this mistake.
##
## FIXME -- we should really work to fix autoconf so that it prefers
## gfortran over g77 even when searching for a Fortran 77 compiler.

echo "replacing all occurrences of g77 with gfortran in configure
script..."

sed 's/g77/gfortran/g' configure > configure.t
mv configure.t configure
chmod 755 configure
}

Perhaps that workaround is out of date. How does one tell what order
autoconf is using for compiler preference (I've grepped in the auto*
scripts and can't find anything)? But more than that, isn't the
AC_PROG_F77 macro supposed to control this?

Here's an excerpt from configure.ac:

...

dnl Keep this check before the check for the Fortran compiler,
dnl in case -lm is needed to compile Fortran programs.
AC_CHECK_LIB(m, sin)

### Determine the Fortran compiler and how to invoke it

## Default FFLAGS is -O.
if test x"$FFLAGS" = x""; then
  FFLAGS="-O"
fi

## the F77 variable, if set, overrides AC_PROG_F77 automatically
AC_PROG_F77
AC_F77_LIBRARY_LDFLAGS
AC_F77_DUMMY_MAIN
AC_F77_WRAPPERS

...

And here is the configure output for that bit of script:

checking for sin in -lm... yes
checking for gfortran... gfortran
checking whether we are using the GNU Fortran 77 compiler... yes
checking whether gfortran accepts -g... yes
checking how to get verbose linking output from gfortran... -v
checking for Fortran 77 libraries of gfortran... -L/usr/lib/gcc/x86_64-redhat-linux/4.5.1 -L/usr/lib/gcc/x86_64-redhat-linux/4.5.1/../../../../lib64 -L/lib/../lib64 -L/usr/lib/../lib64 -L/usr/lib/gcc/x86_64-redhat-linux/4.5.1/../../.. -lgfortran -lm
checking for dummy main to link with Fortran 77 libraries... none
checking for Fortran 77 name-mangling scheme... lower case, underscore, no extra underscore
configure: defining FFLAGS to be -O
checking whether gfortran has the intrinsic function ISNAN... yes
checking whether gfortran generates correct size integers... yes
checking whether gfortran accepts -ffloat-store... yes
setting F77_FLOAT_STORE_FLAG to -ffloat-store

The first FORTRAN related thing in this list is "checking for gfortran... gfortran". Does this mean that currently the first FORTRAN compiler that AC looks for is gfortran? If that is the case, then I don't think the "epilogue" is needed anymore.

Dan



reply via email to

[Prev in Thread] Current Thread [Next in Thread]