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: Rik
Subject: Re: F77 vs. F90 in Octave
Date: Mon, 24 Nov 2014 12:28:21 -0800

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.

--Rik




reply via email to

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