[Fwd] Problems installing R on SunOS 4.1.4

Martin Maechler Martin Maechler <maechler@stat.math.ethz.ch>
Fri, 5 Feb 1999 09:04:41 +0100


[forwarded to R-devel, where this really belongs]

>>>>> "Samira" == Samira M Ismail <samira@ime.unicamp.br> writes:

(to me in a private mail)

    Samira> We have been trying to install R.0.63 for Unix (SunOS 4.1.4 -
    Samira> SPARC 20) and we detected the following problem which makes
    Samira> impossible to run R.  We have got the following message:

    Samira> =======

    Samira> gcc -g -O2 -I../include -I../../src/include -c sunif.c -o sunif.o
    Samira> sunif.c: In function `unif_rand':
    Samira> sunif.c:131: `RAND_MAX' undeclared (first use this function)
    Samira> sunif.c:131: (Each undeclared identifier is reported only once
    Samira> sunif.c:131: for each function it appears in.)
    Samira> sunif.c: In function `Randomize':
    Samira> sunif.c:213: `NULL' undeclared (first use this function)
    Samira> *** Error code 1
    Samira> make: Fatal error: Command failed for target `sunif.o'
    Samira> Current working directory /usr/R-0.63.1/src/nmath
    Samira> *** Error code 1
    Samira> make: Fatal error: Command failed for target `R'
    Samira> Current working directory /usr/R-0.63.1/src
    Samira> *** Error code 1
    Samira> make: Fatal error: Command failed for target `R'

Both  NULL  and  RAND_MAX   are ANSI C.
      (p.102)	 (p.252)    of my Kernighan & Ritchie, 2nd. ed.
      <stdio.h>	 <stdlib.h>

However, I've experienced myself and heard more than once that
SunOS 4.x.x  has always had broken header (*.h) files.
Actually I had thought that the headers that come with gcc would 
``ifdef around these''...

Anyway,  add the following lines to your  src/include/Platform.h

#ifndef NULL
#define	NULL	0
#endif

#ifndef RAND_MAX
#define	RAND_MAX	32767
#endif

(or just to the beginning of src/nmath/sunif.c).

-----------

Kurt, could we add this bug-workaround to configure.in and Platform.in
such that something like

#ifdef SunOS4
/*-- define missing ANSI C --*/
#define	NULL	0
#define	RAND_MAX	32767
#endif

---
Un(?)fortunately, I haven't had access to SunOS4 machines for more than a
year now.

Martin Maechler <maechler@stat.math.ethz.ch>	http://stat.ethz.ch/~maechler/
Seminar fuer Statistik, ETH-Zentrum SOL G1;	Sonneggstr.33
ETH (Federal Inst. Technology)	8092 Zurich	SWITZERLAND
phone: x-41-1-632-3408		fax: ...-1086			<><
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._