FC vs. F77 in Makefiles

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

FC vs. F77 in Makefiles

Rik-4
All,

I'm cleaning up configure.ac a bit and I came across this:

FC=$F77
AC_SUBST(FC)

which makes FC an alias for F77 in Makefiles.  However, all of the Makefile
rules I see use $F77.  Is there something I'm missing or can we delete this
as cruft?

Just to test, I commented out the two lines in configure.ac and re-built
Octave and there were no issues.

--Rik

Reply | Threaded
Open this post in threaded view
|

Re: FC vs. F77 in Makefiles

Daniel Sebald
On 11/23/2014 08:24 PM, Rik wrote:

> All,
>
> I'm cleaning up configure.ac a bit and I came across this:
>
> FC=$F77
> AC_SUBST(FC)
>
> which makes FC an alias for F77 in Makefiles.  However, all of the Makefile
> rules I see use $F77.  Is there something I'm missing or can we delete this
> as cruft?

Not sure.  My only guess would be maybe autoconf wants FC to be defined.
  According to this:

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

FC can be Fortran 77, 90 or 95.  But also the way to make the definition
seems slightly different than saying FC=$F77.  Perhaps the documentation
at the above link makes more sense to you since you are working on the
make files right now.

Dan

Reply | Threaded
Open this post in threaded view
|

Re: FC vs. F77 in Makefiles

John W. Eaton
Administrator
In reply to this post by Rik-4
On 11/23/2014 09:24 PM, Rik wrote:

> All,
>
> I'm cleaning up configure.ac a bit and I came across this:
>
> FC=$F77
> AC_SUBST(FC)
>
> which makes FC an alias for F77 in Makefiles.  However, all of the Makefile
> rules I see use $F77.  Is there something I'm missing or can we delete this
> as cruft?
>
> Just to test, I commented out the two lines in configure.ac and re-built
> Octave and there were no issues.

There are a number of places where FC appears, so you'll need to fix
those if you eliminate the substitution.

Maybe it would be best to use FC consistently instead of F77, including
using the AC_PROG_FC macro instead of F77?  I'm not sure of the
implications though.

So another option is to leave things alone as they seem to be working.

jwe



Reply | Threaded
Open this post in threaded view
|

Re: FC vs. F77 in Makefiles

Mike Miller
On Mon, Nov 24, 2014 at 10:57:40 -0500, John W. Eaton wrote:

> On 11/23/2014 09:24 PM, Rik wrote:
>>
>> All,
>>
>> I'm cleaning up configure.ac a bit and I came across this:
>>
>> FC=$F77
>> AC_SUBST(FC)
>>
>> which makes FC an alias for F77 in Makefiles.  However, all of the
>> Makefile
>> rules I see use $F77.  Is there something I'm missing or can we delete
>> this
>> as cruft?
>>
>> Just to test, I commented out the two lines in configure.ac and re-built
>> Octave and there were no issues.
>
>
> There are a number of places where FC appears, so you'll need to fix those
> if you eliminate the substitution.
>
> Maybe it would be best to use FC consistently instead of F77, including
> using the AC_PROG_FC macro instead of F77?  I'm not sure of the implications
> though.

My understanding of Automake is that it uses particular compiler
variables for predefined lists of source file extensions. It will
invoke the $(F77) compiler for files ending with .f and .for, and the
$(FC) compiler for files ending in .f90, .f95, .f03, and .f08. Since
all of our Fortran sources end in .f and .for, and are Fortran 77
compatible, I don't think $(FC) is (or can or should be) currently
used.

--
mike

Reply | Threaded
Open this post in threaded view
|

Re: FC vs. F77 in Makefiles

Rik-4
In reply to this post by John W. Eaton
On 11/24/2014 07:57 AM, John W. Eaton wrote:

> On 11/23/2014 09:24 PM, Rik wrote:
>> All,
>>
>> I'm cleaning up configure.ac a bit and I came across this:
>>
>> FC=$F77
>> AC_SUBST(FC)
>>
>> which makes FC an alias for F77 in Makefiles.  However, all of the Makefile
>> rules I see use $F77.  Is there something I'm missing or can we delete this
>> as cruft?
>>
>> Just to test, I commented out the two lines in configure.ac and re-built
>> Octave and there were no issues.
>
> There are a number of places where FC appears, so you'll need to fix
> those if you eliminate the substitution.

I could only find 3 independent instances in the Mercurial tree.

Aliasing FC to $F77
configure.ac:707:FC=$F77
configure.ac:708:AC_SUBST(FC)

Adding the alias into the Makefiles
build-aux/common.mk:94:FC = @FC@
build-aux/common.mk:557:  -e "s|%OCTAVE_CONF_FC%|\"${FC}\"|" \

In README.MacOS
etc/README.MacOS:157:  export FC="/usr/bin/gfortran"
etc/README.MacOS:178:  export FC="/usr/bin/gfortran"
etc/README.MacOS:394:  export FC=/opt/local/bin/gfortran-mp-4.4

My test of commenting out the configure.ac would have taken care of the
first two.  I don't know anything about compiling on MacOS.  Could someone
on a Mac platform comment out lines 707, 708 of configure.ac and then run
the entire build cycle to see if it is successful:
./bootstrap
./configure
make

>
> Maybe it would be best to use FC consistently instead of F77, including
> using the AC_PROG_FC macro instead of F77?  I'm not sure of the
> implications though.

AC_PROG_F77 tries to find a compiler that is Fortran 77 compliant, while
AC_PROG_FC tries to find the most modern Fortran compiler available
(Fortran 95, Fortran 90).  I think if the code base that we have is written
to be compliant with Fortran 77 then we are correct in using AC_PROG_F77.

>
> So another option is to leave things alone as they seem to be working.

I'm motivated to get this right because the Autoconf tools are so baffling
to most people that everyone shrinks from having to modify anything in
them.  This, in turn, allows a lot of cruft to build up which then makes
the files even more difficult to understand and modify--a positive feedback
loop leading to a negative outcome.

--Rik

Reply | Threaded
Open this post in threaded view
|

Re: FC vs. F77 in Makefiles

Juan Pablo Carbajal-2
On Mon, Nov 24, 2014 at 5:31 PM, Rik <[hidden email]> wrote:
> I'm motivated to get this right because the Autoconf tools are so baffling
> to most people that everyone shrinks from having to modify anything in
> them.  This, in turn, allows a lot of cruft to build up which then makes
> the files even more difficult to understand and modify--a positive feedback
> loop leading to a negative outcome.

Amen!

Reply | Threaded
Open this post in threaded view
|

Re: Fortran file naming

Rik-4
In reply to this post by Rik-4
On 11/24/2014 09:14 AM, Ben Abbott wrote:

>> On Nov 24, 2014, at 11:31 AM, Rik <[hidden email]> wrote:
>>
>> On 11/24/2014 07:57 AM, John W. Eaton wrote:
>>> On 11/23/2014 09:24 PM, Rik wrote:
>>>> All,
>>>>
>>>> I'm cleaning up configure.ac a bit and I came across this:
>>>>
>>>> FC=$F77
>>>> AC_SUBST(FC)
>>>>
>>>> which makes FC an alias for F77 in Makefiles.  However, all of the Makefile
>>>> rules I see use $F77.  Is there something I'm missing or can we delete this
>>>> as cruft?
>>>>
>>>> Just to test, I commented out the two lines in configure.ac and re-built
>>>> Octave and there were no issues.
>>> There are a number of places where FC appears, so you'll need to fix
>>> those if you eliminate the substitution.
>> I could only find 3 independent instances in the Mercurial tree.
>>
>> Aliasing FC to $F77
>> configure.ac:707:FC=$F77
>> configure.ac:708:AC_SUBST(FC)
>>
>> Adding the alias into the Makefiles
>> build-aux/common.mk:94:FC = @FC@
>> build-aux/common.mk:557:  -e "s|%OCTAVE_CONF_FC%|\"${FC}\"|" \
>>
>> In README.MacOS
>> etc/README.MacOS:157:  export FC="/usr/bin/gfortran"
>> etc/README.MacOS:178:  export FC="/usr/bin/gfortran"
>> etc/README.MacOS:394:  export FC=/opt/local/bin/gfortran-mp-4.4
>>
>> My test of commenting out the configure.ac would have taken care of the
>> first two.  I don't know anything about compiling on MacOS.  Could someone
>> on a Mac platform comment out lines 707, 708 of configure.ac and then run
>> the entire build cycle to see if it is successful:
>> ./bootstrap
>> ./configure
>> make
>>
>>> Maybe it would be best to use FC consistently instead of F77, including
>>> using the AC_PROG_FC macro instead of F77?  I'm not sure of the
>>> implications though.
>> AC_PROG_F77 tries to find a compiler that is Fortran 77 compliant, while
>> AC_PROG_FC tries to find the most modern Fortran compiler available
>> (Fortran 95, Fortran 90).  I think if the code base that we have is written
>> to be compliant with Fortran 77 then we are correct in using AC_PROG_F77.
>>
>>> So another option is to leave things alone as they seem to be working.
>> I'm motivated to get this right because the Autoconf tools are so baffling
>> to most people that everyone shrinks from having to modify anything in
>> them.  This, in turn, allows a lot of cruft to build up which then makes
>> the files even more difficult to understand and modify--a positive feedback
>> loop leading to a negative outcome.
>>
>> --Rik
> I'd prefer to rename all the f77 files to use the *.for suffix, and then do away with the F77 variable.
>
> That way f77, f90, f95, f2003, etc wlll all work.  Are there any legacy systems, which Octave is able to build on, that do not include gfortran as part of gcc?

Why do we need to rename the existing F77 files?  gfortran interprets
anything ending in .f as fixed format, usually F77, code.  Or is this a
move to potentially use other compilers which do not have this convention?

--Rik

Reply | Threaded
Open this post in threaded view
|

Re: FC vs. F77 in Makefiles

John W. Eaton
Administrator
In reply to this post by Rik-4
On 11/24/2014 11:31 AM, Rik wrote:

> I could only find 3 independent instances in the Mercurial tree.
>
> Aliasing FC to $F77
> configure.ac:707:FC=$F77
> configure.ac:708:AC_SUBST(FC)
>
> Adding the alias into the Makefiles
> build-aux/common.mk:94:FC = @FC@
> build-aux/common.mk:557:  -e "s|%OCTAVE_CONF_FC%|\"${FC}\"|" \
>
> In README.MacOS
> etc/README.MacOS:157:  export FC="/usr/bin/gfortran"
> etc/README.MacOS:178:  export FC="/usr/bin/gfortran"
> etc/README.MacOS:394:  export FC=/opt/local/bin/gfortran-mp-4.4
>
> My test of commenting out the configure.ac would have taken care of the
> first two.

Since OCTAVE_CONF_FC is set from FC, you need to eliminate uses of that
variable down as well.  I think it is just used in the
octave_config_info function using a macro defined in the oct-conf.in.h
file, so could probably just be removed.

jwe