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:50:23 -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 02:28 PM, Rik wrote:
On 11/24/2014 11:33 AM, 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?

http://www.hep.by/gnu/autoconf/Fortran-Compiler.html

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
replace g77.

I think this is a fine idea.  Eliminate all the weird hacks with sed in
favor of just listing our preference.

And I'm not sure we want to rely on luck regarding a compiler that handles
both F77 and F90.  I see several choices: 1) Change Jaroslav's code to be
F77-compliant, 2) Change the extension on Jaroslav's files to .f90, but we
would potentially then need to use the AC_PROG_FC macro and get that
working to handle the F90 stuff with a different compiler, 3) Switch
completely over to AC_PROG_FC, but this assumes that any compiler chosen
will be able to compile both F77 and F90 code, 4) force use of gfortran.


Anyway, compilation is complete without problems here.  What I see in the
Makefile is

F77 = gfortran
...
FC = @FC@

What does the FC = @FC@ mean?

In the final Makefile?  or Makefile.in or Makefile.am?  The pattern @VAR@
is replaced by Autotools when it builds the Makefiles using values from the
configure process.

The final Makefile.

address@hidden build1]# grep "FC = @" * -r
doc/interpreter/Makefile:FC = @FC@
doc/liboctave/Makefile:FC = @FC@
doc/doxyhtml/Makefile:FC = @FC@
doc/Makefile:FC = @FC@
doc/refcard/Makefile:FC = @FC@
etc/icons/Makefile:FC = @FC@
examples/code/Makefile:FC = @FC@
examples/Makefile:FC = @FC@
examples/data/Makefile:FC = @FC@
libgui/Makefile:FC = @FC@
libinterp/Makefile:FC = @FC@
liboctave/Makefile:FC = @FC@
Makefile:FC = @FC@
scripts/Makefile:FC = @FC@
src/Makefile:FC = @FC@
test/Makefile:FC = @FC@

I've placed AC_PROG_FC in my configure.ac file to see what happens. I don't see any kind of corresponding action to it anywhere.

... Oh, here's the list of FORTRAN compilers that AC checks for (it's created inside the "configure" file as part of bootstrap):

## the F77 variable, if set, overrides AC_PROG_F77 automatically
ac_ext=f
ac_compile='$F77 -c $FFLAGS conftest.$ac_ext >&5'
ac_link='$F77 -o conftest$ac_exeext $FFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
ac_compiler_gnu=$ac_cv_f77_compiler_gnu
if test -n "$ac_tool_prefix"; then
for ac_prog in gfortran xlf f77 frt pgf77 cf77 fort77 fl32 af77 xlf90 f90 pgf90 pghpf epcf90 gfortran g95 xlf95 f95 fort ifort ifc efc pgfortran pgf95 lf95 ftn
  do
# Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
set dummy $ac_tool_prefix$ac_prog; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
if test "${ac_cv_prog_F77+set}" = set; then :
  $as_echo_n "(cached) " >&6
else

I see gfortran as the preference (first in list) and don't even see g77 in the list. I don't see "g77" in the Octave source tree anywhere other than comments. I think that epilogue code can be removed.

Dan



reply via email to

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