From Kurt.Hornik@ci.tuwien.ac.at  Sat Feb 17 14:25:13 2001
From: Kurt.Hornik@ci.tuwien.ac.at (Kurt Hornik)
Date: Sat, 17 Feb 2001 15:25:13 +0100
Subject: [Rd] Comments on R-1.2.1 builds (PR#851)
In-Reply-To: <200102170044.BAA19310@pubhealth.ku.dk>
References: <200102170044.BAA19310@pubhealth.ku.dk>
Message-ID: <14990.35273.167526.4092@mithrandir.hornik.net>

>>>>> beebe  writes:

> The R-1.2.1 builds have gone fairly smoothly on most of my UNIX
> architectures, but there were many warnings reported by the picky SGI
> compiler that could be eliminated in future releases.

> Generally, I have found the SGI compilers very helpful in ferreting
> out portability problems, unused and/or obsolete variables, unexpected
> datatype coercions, etc., and they compile faster than any other
> compilers too.

> First, I configured like this:

> env CC='c89 -mips3 -O3' ./configure && make all

> This reports:

> 	R is now configured for mips-sgi-irix6.5

> 	  Source directory:          .
> 	  Installation directory:    /usr/local
> 	  C compiler:                c89 -mips3 -O3  -OPT:IEEE_NaN_inf=ON -g
> 	  C++ compiler:              c++  -g -O2
> 	  FORTRAN compiler:          g77  -OPT:IEEE_NaN_inf=ON -g -O2

> 	  X11 support:               yes
> 	  Gnome support:             no
> 	  Tcl/Tk support:            yes

> 	  R profiling support:       yes
> 	  R as a shared library:     no

> The build proceeds until this failure:

> 	g77 -OPT:IEEE_NaN_inf=ON  -g -O2 -c ch2inv.f -o ch2inv.o
> 	f771: Invalid option `-OPT:IEEE_NaN_inf=ON'
> 	make[3]: *** [ch2inv.o] Error 1

> Evidently, it was not prepared for the GNU Fortran compiler.

Yep, that is a bug.  I need some feedback for fixing this, though.  The
current logic is to run the autoconf R_C_OPTIEEE test if the platform is
IRIX.  The test itself tries to compile and run

#include <math.h>
#include <ieeefp.h>
int main () {
  double x = 0;
  fpsetmask(0); x = x / x; return (x != x);
}

and if that works adds -OPT:IEEE_NaN_inf=ON to both R_XTRA_CFLAGS and
R_XTRA_FFLAGS.

This obviously does not make sense for FORTRAN, and should be made more
defensive for C.

* For C, one should additionally test whether the compiler accepts this
  flag.  I assume gcc would not, so should we do

	if_not_using_gcc  check_arg("-OPT:IEEE_NaN_inf=ON")

* For FORTRAN, I am not sure whether the result of the above test has
  any relevance.  Question is, do we have a FORTRAN test program similar
  to the above to determine whether the flag is needed?  Again, we
  should also check whether the compiler accepts the flag ...

* Or should we simply unconditionally add the flag for ``native'', i.e.,
  non-GNU compilers?

(Sorry but I do not have access to SGIs ...)

-k
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-devel-request@stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._


[Rd] Comments on R-1.2.1 builds (PR#851)
Kurt Hornik