From ripley at stats.ox.ac.uk  Wed Jun  7 18:08:50 2006
From: ripley at stats.ox.ac.uk (Prof Brian Ripley)
Date: Wed, 7 Jun 2006 17:08:50 +0100 (BST)
Subject: [Rd] further f77/gfortran
In-Reply-To: <4486F46B.1090305@zoo.ufl.edu>
References: <4486F46B.1090305@zoo.ufl.edu>
Message-ID: <Pine.LNX.4.64.0606071652100.1628@gannet.stats.ox.ac.uk>

On Wed, 7 Jun 2006, Ben Bolker wrote:

>
>  OK: despite Dirk's very kind help, I decided that
> trying to deal with R configuration and Debian configuration
> simultaneously was too difficult.
>
>  I did manage to solve my problem by reconfiguring/making/
> installing all of 2.3.1 from source:
>
> ./configure F77=/usr/bin/g77
> make
> make install
>
>   A few questions inspired by this experience:
>
>  (1) it seems a bit odd that R sets F77=gfortran
> by default, since the system has both g77 and gfortran
> compilers on it, and given that there is a separate
> variable (FC) for the Fortran 90/95 compiler --
> does it make any sense to switch
> the search order in configure so that g77 comes up first if present?

That's not what is happening, I believe.  If the C compiler is gcc4, it 
preferentially picks gfortran, as gcc4 and g77 are not compatible on 
structures such as double complex on at least some architectures.  From 
the R.m4 file

## * If the C compiler is gcc, we try looking for a matching GCC Fortran
##   compiler (gfortran for 4.x, g77 for 3.x) first.  This should handle
##   problems if GCC 4.x and 3.x suites are installed and, depending on
##   the gcc default, the "wrong" GCC Fortran compiler is picked up (as

We used to pick a F77 compiler first, but note that all legal F77 code is 
legal F95 code so there was no actual advantage is doing so.  The issue 
here is that your code is not legal F77, and g77 (which implements 'GNU 
Fortran') is letting it through.

>  (2) I couldn't figure out a way to set the F77 variable
> on a per-package basis: adding a src/Makevars file or a configure
> file to the package didn't seem to help, but perhaps I didn't
> put it in the right place/get it exactly right.  Any clues?

You cannot override either F77 or the default .f.o rule, as etc/Makeconf 
wins.  However, you set up a specific rule in Makevars, and also need an 
all: target.  See fastICA/src/Makevars for the sort of thing.

-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595



[Rd] further f77/gfortran
Prof Brian Ripley