Fortran vs C, easing using Fortran

Albrecht Gebhardt
Mon, 12 Apr 1999 18:27:46 +0200 (MET DST)

On Mon, 12 Apr 1999, Prof Brian Ripley wrote:

> > Date: Mon, 12 Apr 1999 11:30:20 +0200 (MET DST)
> > From: Albrecht Gebhardt <>
> > > I think in R we can do better than at present, if only I knew
> > > exactly how. One idea is to have (effectively) a `hints' file that
> > > configure uses to add a base set of libraries to FLIBS, but on Solaris
> > > at least, using the Fortran command (f77 or g77) to link a dynamic library
> > > does the job.  For linking with ld the base FLIBS would need to be
> > > 
> > > -lF77 -lM77 -lV77 -lsunmath -lm
> > > 
> > > _if_ f77 is used.  How viable is `use FC to link' on other platforms?
> > > 
> > 
> > I'm not sure if it does matter here, but the only way to build R on my
> > Alphas currently is using Fortran as LDCMD:
> > 
> > in
> > LDCMD="f77 "
> > 
> > SHLIBLD is "ld -shared -expect_unresolved '*'".
> I would have expected
> LDCMD=f77
> LDFLAGS="-g -nofor_main -fpe3"
> SHLIBLDFLAGS="-shared -expect_unresolved '*'"
> as the way to encode that.  Now my question amounts to
> Does SHLIBLD=f77 work with those SHLIBLDFLAGS?
> If not, can SHLIBLDFLAGS be modified to make it work?

   LDCMD="f77 -g -nofor_main -fpe3 "
   LDFLAGS="-g -nofor_main -fpe3"
results in

root@delta[R]# ./configure
loading cache ./config.cache
checking for a BSD compatible install... (cached) /usr/local/bin/install -c
checking whether ln -s works... (cached) yes
checking for ranlib... (cached) ranlib
checking for bison... (cached) bison -y
checking for ar... (cached) ar
checking for latex... (cached) /usr/local/bin/latex
checking for dvips... (cached) /usr/local/bin/dvips
checking for makeindex... (cached) /usr/local/bin/makeindex
checking for perl... (cached) /usr/local/bin/perl
checking whether perl is perl 5... yes
checking for cc... (cached) cc
checking for underscore after Fortran symbols... configure: error: Nothing
worked - cannot use FORTRAN

setting SHLIBLD to f77 and SHLIBLDFLAGS="-shared" works.
(SHLIBLDFLAGS="-shared -expect_unresolved '*'" fails, f77 doesn't
understand this linker option, but no matter: it would only suppress some
BTW, the value of SHLIBLDFLAGS specified in gets never used:
it will be overwritten from the configure script with the host specific
versions of SHLIBLDFLAGS.
The same thing for SHLIBLD, this is hardcoded to "ld" in
But I think there is no difference between
  SHLIBLDFLAGS="-shared -expect_unresolved '*'"
because f77 also calls ld (ok, with the correct Fortran libraries,,, I guess this works because I link R
with LDCMD="f77 -nofor_main", so it already contains the symbols of the
Fortran libraries.

Albrecht Gebhardt                   email   :
Institut fuer Mathematik            Tel.    : (++43 463) 2700/837
Universitaet Klagenfurt             Fax     : (++43 463) 2700/834
Villacher Str. 161
A-9020 Klagenfurt, Austria

r-devel mailing list -- Read
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: