Version française
Home     About     Download     Resources     Contact us    
Browse thread
patch for Ocaml 1.07 on CrayT3E
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Basile STARYNKEVITCH <basile.starynkevitch@c...>
Subject: patch for Ocaml 1.07 on CrayT3E

{{ posté sur les listes caml (INRIA) & elan (CEA) - archivé en interne
CEA en http://www-drn2.cea.fr/elan/ArchiveListe/ inaccessible de
l'exterieur du CEA }}

[[ french version follows ]]


Hello All,

I'm proud to announce the port of Ocaml-1.07 (the bytecode version,
not the native compiler) on the CEA's Cray T3E supercomputer, located
at CEA/Grenoble (France, near Alpes mountains).

The Cray T3E has 256 nodes. Each node has a 64 bits DEC Alpha
processor (128Mb or 1Gbyte of RAM each). They can communicate with a
high speed bus (which is not yet used on this port of Caml - but MPI
or PVM can be used). The operating system is unix like (Unicos/Mk
2.0.2.17). The compiler used is the cc provided by Cray (Cray Standard
C Version 6.0.1.0)

Although the T3E has DEC Alpha processors it is still a bizarre
machine. for instance, it is big endian and it short integers take
four -not two- bytes.


Many thanks to Damien Doliguez, Pierre Weis, Francois Rouaix, and
others from INRIA (they actually did most of the work! I just tried
what they did after my unsuccessful hacks) and Laurent Colombet
(CISI/Athesa CEA/Grenoble)

The patch can be applied to ocaml-1.07 and don't break anything on my
Linux PC box. I hope that it will be included in ocaml-1.08!


To apply the patch, save the lines after my signature as
$HOME/patchcray and do

    ## go to your Ocaml 1.07 source tree

    cd /your/path/to/ocaml-1.07

    ## run the patch command
    patch -p1 < $HOME/patchcray

    # manually set configuration files
    cd config
    mv Makefile Makefile.old
    ln -s Makefile-crayt3e Makefile
    ln -s m-crayt3e.h m.h
    ln -s s-crayt3e.h s.h

    # edit the Makefile for appropriate target directory 

    # go to top directory
    cd ..

    # build all 
    make world

    # get yourself a drink (coffee, cocacola, water) to wait for 10 minutes

    # maybe install
    make install

    ## enjoy

################

Bonjour à tous, 

J'ai la joie d'annoncer le portage de Ocaml-1.07 (version interprète
de code octet, le compilateur natif n'est pas porté) sur le
supercalculateur Cray T3E du CEA situé au CEA/Grenoble (France)

Le Cray T3E comporte 256 noeuds. Chaque noeud a un processeur DEC
Alpha 64 bits (128Mo ou 1Goctets de RAM chacun). Ils communiquent par
un bus rapide (qui n'est pas encore utilisé dans ce portage - mais on
peut utiliser MPI ou PVM). Le système d'exploitation est unixoide
(Unicos/Mk 2.0.2.17). Le compilateur cc est celui fourni par Cray
(Cray Standard C Version 6.0.1.0)

Pour appliquer ce patch, veuillez suivre les instructions en anglais
ci-dessus en sauvegardant les lignes après ma signature comme
$HOME/patchcray



Bien que le T3E a des processeurs DEC Alpha ca reste une machine
bizarre: elle est big-endian et les shorts y occupent quatre -et non
deux- octets.

Merci beaucoup à Damien Doliguez et Pierre Weis, Francois Rouaix, et
d'autres à l'INRIA (ils ont fait tous le boulot, j'ai juste essayé ce
qu'il ont dit après avoir bidouillé sans succès) et Laurent Colombet
(CISI/Athesa CEA/Grenoble)

Le patch peut etre appliqué à ocaml-1.07 sans rien abimer (j'ai essayé
sur mon PC/Linux). J'espere qu'il sera integré à ocaml-1.08


################


N.B. Any opinions expressed here are solely mine, and not of my organization.
N.B. Les opinions exprimees ici me sont personnelles et n engagent pas le CEA.

----------------------------------------------------------------------
Basile STARYNKEVITCH   ----  Commissariat à l Energie Atomique 
DRN/DMT/SYSCO * CEA/Saclay bat.460 * 91191 GIF/YVETTE CEDEX * France
fax: (33) 01,69.08.96.96; phone: 01,69.08.40.66; home: 01,46.65.45.53
email: Basile . Starynkevitch @ cea . fr  (but remove white space)
I speak french, english, russian. Je parle français, anglais, russe.



##### start of patch -- save after this line up to end of message


diff -P -u -B -b -r -d -x *.cm* ocaml-1.07/byterun/interp.c ocaml-1.07-cray/byterun/interp.c
--- ocaml-1.07/byterun/interp.c	Tue Sep  2 14:54:01 1997
+++ ocaml-1.07-cray/byterun/interp.c	Wed Apr  8 13:56:01 1998
@@ -109,11 +109,18 @@
 #define ACCU_REG asm("%l2")
 #endif
 #ifdef __alpha__
+#ifdef __CRAY__
+#define PC_REG asm("r9")
+#define SP_REG asm("r10")
+#define ACCU_REG asm("r11")
+#define JUMPTBL_BASE_REG asm("r12")
+#else
 #define PC_REG asm("$9")
 #define SP_REG asm("$10")
 #define ACCU_REG asm("$11")
 #define JUMPTBL_BASE_REG asm("$12")
 #endif
+#endif
 #ifdef __i386__
 #define PC_REG asm("%esi")
 #define SP_REG asm("%edi")
diff -P -u -B -b -r -d -x *.cm* ocaml-1.07/byterun/lexing.c ocaml-1.07-cray/byterun/lexing.c
--- ocaml-1.07/byterun/lexing.c	Tue Sep  2 14:54:03 1997
+++ ocaml-1.07-cray/byterun/lexing.c	Mon Apr  6 15:17:29 1998
@@ -39,11 +39,33 @@
 };
 
 #ifdef ARCH_BIG_ENDIAN
+
+#if defined(ARCH_SIXTYFOUR) && defined(ARCH_SHORT32)
+/* hardcode 2 bytes */
+
+#define Short(tbl,n) \
+  (*((unsigned char *)((tbl) + (n) * 2)) + \
+          (*((schar *)((tbl) + (n) * 2 + 1)) << 8))
+
+#else
+
 #define Short(tbl,n) \
   (*((unsigned char *)((tbl) + (n) * sizeof(short))) + \
           (*((schar *)((tbl) + (n) * sizeof(short) + 1)) << 8))
+
+#endif 
+
+#else
+
+#if defined(ARCH_SIXTYFOUR) && defined(ARCH_SHORT32)
+
+#define Short(tbl,n) \
+  (*((unsigned char *)((tbl) + (n) * 2)) + \
+          (*((schar *)((tbl) + (n) * 2 + 1)) << 8))
+
 #else
 #define Short(tbl,n) (((short *)(tbl))[n])
+#endif
 #endif
 
 value lex_engine(struct lexing_table *tbl, value start_state, struct lexer_buffer *lexbuf)     /* ML */
diff -P -u -B -b -r -d -x *.cm* ocaml-1.07/byterun/mlvalues.h ocaml-1.07-cray/byterun/mlvalues.h
--- ocaml-1.07/byterun/mlvalues.h	Tue Sep  2 14:54:06 1997
+++ ocaml-1.07-cray/byterun/mlvalues.h	Fri Apr  3 11:02:15 1998
@@ -55,8 +55,13 @@
 typedef unsigned long color_t;
 typedef unsigned long mark_t;
 
+#ifdef ARCH_SHORT32
+typedef short int32;            /* CrayT3E (Dec Alpha based) has 32 bits short */
+typedef unsigned short uint32;  
+#else
 typedef int int32;            /* Not portable, but checked by autoconf. */
 typedef unsigned int uint32;  /* Seems like a reasonable assumption anyway. */
+#endif /*ARCH_SHORT32*/
 
 /* Longs vs blocks. */
 #define Is_long(x)   (((x) & 1) != 0)
diff -P -u -B -b -r -d -x *.cm* ocaml-1.07/byterun/parsing.c ocaml-1.07-cray/byterun/parsing.c
--- ocaml-1.07/byterun/parsing.c	Tue Sep  2 14:54:07 1997
+++ ocaml-1.07-cray/byterun/parsing.c	Mon Apr  6 15:53:35 1998
@@ -58,12 +58,43 @@
 };
 
 #ifdef ARCH_BIG_ENDIAN
+
+#if defined(ARCH_SIXTYFOUR) && defined(ARCH_SHORT32)
+
+/* hardcode short as 2 bytes */
+
+#define Short(tbl,n) \
+  (*((unsigned char *)((tbl) + (n) * 2)) + \
+          (*((schar *)((tbl) + (n) * 2 + 1)) << 8))
+
+#else
+
 #define Short(tbl,n) \
   (*((unsigned char *)((tbl) + (n) * sizeof(short))) + \
           (*((schar *)((tbl) + (n) * sizeof(short) + 1)) << 8))
+
+#endif 
+
+
 #else
+
+#if defined(ARCH_SIXTYFOUR) && defined(ARCH_SHORT32)
+
+/* hardcode short as 2 bytes */
+
+#define Short(tbl,n) \
+  (*((unsigned char *)((tbl) + (n) * 2)) + \
+          (*((schar *)((tbl) + (n) * 2 + 1)) << 8))
+
+#else
+
 #define Short(tbl,n) (((short *)(tbl))[n])
+
 #endif
+
+#endif
+
+
 
 #ifdef DEBUG
 int parser_trace = 0;


diff -P -u -B -b -r -d -x *.cm* ocaml-1.07/config/Makefile-crayt3e ocaml-1.07-cray/config/Makefile-crayt3e
--- ocaml-1.07/config/Makefile-crayt3e	Thu Jan  1 01:00:00 1970
+++ ocaml-1.07-cray/config/Makefile-crayt3e	Wed Apr  8 11:01:40 1998
@@ -0,0 +1,209 @@
+### Compile-time configuration
+#fichier Makefile-crayt3e
+########## General configuration
+
+### Where to install the binaries
+TOPDIR=/u/basile/local
+BINDIR=$(TOPDIR)/bin
+
+### Where to install the standard library
+LIBDIR=$(TOPDIR)/lib/caml
+
+### Where to install the man pages
+MANDIR=$(TOPDIR)/man
+MANEXT=1
+
+### Do #! scripts work on your system?
+### Beware: on some systems (e.g. SunOS 4), this will work only if 
+### the string "#!$(BINDIR)/ocamlrun" is less than 32 characters long.
+### In doubt, set SHARPBANGSCRIPTS to false.
+SHARPBANGSCRIPTS=true
+#SHARPBANGSCRIPTS=false
+
+########## Configuration for the bytecode compiler
+
+### Which C compiler to use for the bytecode interpreter.
+### Performance of the bytecode interpreter is *much* improved
+### if Gnu CC version 2 is used.
+#BYTECC=gcc
+BYTECC=cc
+
+### Additional compile-time options for $(BYTECC).
+# If using gcc on Intel 386 or Motorola 68k:
+# (the -fno-defer-pop option circumvents a gcc bug)
+#BYTECCCOMPOPTS=-fno-defer-pop -Wall
+# If using gcc and being superstitious:
+#BYTECCCOMPOPTS=-Wall
+# Under NextStep:
+#BYTECCCOMPOPTS=-U__GNUC__ -fno-defer-pop -Wall
+# Otherwise:
+# the UMK cpp symbol is needed on CrayT3e for lots of stuff (MAXPATHLEN..) 
+BYTECCCOMPOPTS= -G n -DUMK 
+
+### Additional link-time options for $(BYTECC)
+### If using GCC on a Dec Alpha under OSF1:
+#BYTECCLINKOPTS=-Xlinker -taso
+# Otherwise:
+BYTECCLINKOPTS=
+
+### Libraries needed
+# On most platforms:
+CCLIBS=-lcurses -ltermcap -lm
+
+### How to invoke the C preprocessor
+# This is not needed anymore.  Leave these lines commented out.
+# On most machines:
+#CPP=/lib/cpp -P
+# Under Solaris:
+#CPP=/usr/ccs/lib/cpp -P
+# Under FreeBSD:
+#CPP=cpp -P
+
+### How to invoke ranlib
+# BSD-style:
+RANLIB=ranlib
+RANLIBCMD=ranlib
+# If ranlib is not needed:
+#RANLIB=ar rs
+#RANLIBCMD=
+
+############# Configuration for the native-code compiler
+
+### Name of architecture for the native-code compiler
+### Currently supported:
+###
+### alpha       DecStation 3000 under OSF1
+### sparc       Sun Sparcstation under SunOS 4.1 or Solaris 2
+### i386        Intel 386 / 486 / Pentium PCs under Linux, NextStep or FreeBSD
+### mips        DecStation 3100 and 5000 under Ultrix 4
+### hppa        HP 9000/700 under NextStep
+### power       IBM RS6000 and PowerPC workstations under AIX 3.2
+### m68k        Motorola 68020 and beyond under SunOS 4
+###
+### Set ARCH=none if your machine is not supported
+ARCH=alpha
+#ARCH=sparc
+#ARCH=i386
+#ARCH=mips
+#ARCH=hppa
+#ARCH=m68k
+#ARCH=none
+
+### Name of architecture model for the native-code compiler.
+### Some architectures come in several slightly different flavors
+### that share a common code generator. This variable tailors the
+### behavior of the code generator to the particular flavor used.
+### Currently needed only if ARCH=power; leave MODEL=default for
+### other architectures.
+### If ARCH=power: choose between
+###   MODEL=rs6000      The original IBM RS6000 workstations
+###                     (RIOS and RIOS2 processors)
+###   MODEL=ppc         The newer PowerPC processors
+###                     (Motorola/IBM PPC601, PPC603, PPC604, etc)
+### The Motorola PPC601 is compatible with both models, but the newer
+### PPCs will work only with MODEL=ppc, and the older IBM RS6000
+### workstations will work only with MODEL=rs6000.
+###
+### For other architectures: leave MODEL=default
+###
+#MODEL=rs6000
+#MODEL=ppc
+#MODEL=default
+
+### Name of operating system family for the native-code compiler.
+### If ARCH=sparc: choose between
+###   SYSTEM=sunos      SunOS 4.1
+###   SYSTEM=solaris    Solaris 2
+###
+### If ARCH=i386:  choose between
+###   SYSTEM=linux_aout Linux with a.out binaries
+###   SYSTEM=linux_elf  Linux with ELF binaries
+###   SYSTEM=bsd        FreeBSD, probably works for NetBSD also
+###   SYSTEM=nextstep   NextStep
+###
+### For other architectures: set SYSTEM=unknown
+###
+#SYSTEM=sunos
+#SYSTEM=solaris
+#SYSTEM=linux
+#SYSTEM=linux_elf
+#SYSTEM=bsd
+#SYSTEM=nextstep
+SYSTEM=unknown
+
+### Which C compiler to use for the native-code compiler.
+### cc is better than gcc on the Mips and Alpha.
+NATIVECC=cc
+#NATIVECC=gcc
+
+### Additional compile-time options for $(NATIVECC).
+# For cc on the Alpha:
+#NATIVECCCOMPOPTS=-std1
+# For cc on the Mips:
+#NATIVECCCOMPOPTS=-std
+# For gcc if superstitious:
+#NATIVECCCOMPOPTS=-Wall
+
+NATIVECCCOMPOPTS=-O
+
+### Additional link-time options for $(NATIVECC)
+#NATIVECCLINKOPTS=
+
+### Flags for the assembler
+# For the Alpha or the Mips:
+#ASFLAGS=-O2
+# For the PowerPC:
+#ASFLAGS=-u -m ppc -w
+# For the RS6000:
+#ASFLAGS=-u -m pwr -w
+# Otherwise:
+#ASFLAGS=
+
+### Command and flags to use for assembling .S files (often with preprocessing)
+# If gcc is available:
+#ASPP=gcc
+#ASPPFLAGS=-c -DSYS_$(SYSTEM)
+# On SunOS and Solaris:
+#ASPP=$(AS)
+#ASPPFLAGS=-P -DSYS_$(SYSTEM)
+# Otherwise:
+#ASPP=$(AS)
+#ASPPFLAGS=
+
+############# Configuration for the contributed libraries
+
+### Which libraries to compile and install
+# Currently available:
+#       unix            Unix system calls
+#       str             Regular expressions and high-level string processing
+#       num             Arbitrary-precision rational arithmetic
+#       threads         Lightweight concurrent processes 
+#       systhreads      Same as threads, requires POSIX threads
+#       graph           Portable drawing primitives for X11
+#       dynlink         Dynamic linking of bytecode
+#
+OTHERLIBRARIES=unix str num threads graph dynlink
+
+### Name of the target architecture for the "num" library
+# Known targets:
+#       x86     68K     vax     ns      mips    alpha   pyramid i960
+#       sparc   supersparc      sparc-solaris   supersparc-solaris
+# See the file otherlibs/num/README for more explanations.
+# If you don't know, leave BIGNUM_ARCH=C, which selects a portable
+# C implementation of these routines.
+BIGNUM_ARCH=C
+
+### Location of the include directory containing the X11/*.h includes
+# Needed for the "graph" package
+# Usually:
+#X11_INCLUDES=/usr/include
+# For SunOS with OpenLook:
+#X11_INCLUDES=/usr/openwin/include
+
+### Link-time options to ocamlc or ocamlopt for linking with X11 libraries
+# Needed for the "graph" package
+# Usually:
+#X11_LINK=-cclib -lX11
+# For SunOS with OpenLook:
+#X11_LINK=-cclib -L$(X11_LIB) -cclib -lX11
+
diff -P -u -B -b -r -d -x *.cm* ocaml-1.07/config/m-crayt3e.h ocaml-1.07-cray/config/m-crayt3e.h
--- ocaml-1.07/config/m-crayt3e.h	Thu Jan  1 01:00:00 1970
+++ ocaml-1.07-cray/config/m-crayt3e.h	Mon Apr  6 15:04:09 1998
@@ -0,0 +1,51 @@
+/***********************************************************************/
+/*                                                                     */
+/*                           Objective Caml                            */
+/*                                                                     */
+/*            Xavier Leroy, projet Cristal, INRIA Rocquencourt         */
+/*                                                                     */
+/*  Copyright 1996 Institut National de Recherche en Informatique et   */
+/*  Automatique.  Distributed only by permission.                      */
+/*                                                                     */
+/***********************************************************************/
+
+/* basile sur Cray sccs @(#)m-crayt3e.h	1.7  15:04:09 98/04/06 */
+
+#define ARCH_VERSION "@(#)m-crayt3e.h	1.7 15:04:09 98/04/06 "
+
+
+/* Processor dependencies */
+
+#define ARCH_SIXTYFOUR
+
+/* Define ARCH_SIXTYFOUR if the processor has a natural word size of 64 bits.
+   That is, both sizeof(long) = 8 and sizeof(char *) = 8.
+   Otherwise, leave ARCH_SIXTYFOUR undefined. This assumes
+   sizeof(long) = sizeof(char *) = 4. */
+
+#define ARCH_BIG_ENDIAN
+
+/* Define ARCH_BIG_ENDIAN if the processor is big endian (the most
+   significant byte of an integer stored in memory comes first).
+   Leave ARCH_BIG_ENDIAN undefined if the processor is little-endian
+   (the least significant byte comes first).
+*/
+
+#undef ARCH_ALIGN_DOUBLE
+
+/* Define ARCH_ALIGN_DOUBLE if the processor requires doubles to be
+   doubleword-aligned. Leave ARCH_ALIGN_DOUBLE undefined if the processor
+   supports word-aligned doubles. */
+
+#undef ARCH_CODE32
+
+/* Define ARCH_CODE32 if, on a 64-bit machine, code pointers fit in 32 bits,
+   i.e. the code segment resides in the low 4G of the addressing space.
+   ARCH_CODE32 is ignored on 32-bit machines. */
+
+/* added by basile:
+   Define ARCH_SHORT32 if , on a 64-bit machine, shorts fit in 32 bits.
+   undefine itr if on a 64 bit machine shorts fit in 16 bits.
+   This has no sense on 32 bits machines.
+*/
+#define ARCH_SHORT32

diff -P -u -B -b -r -d -x *.cm* ocaml-1.07/config/s-crayt3e.h ocaml-1.07-cray/config/s-crayt3e.h
--- ocaml-1.07/config/s-crayt3e.h	Thu Jan  1 01:00:00 1970
+++ ocaml-1.07-cray/config/s-crayt3e.h	Tue Apr  7 16:44:25 1998
@@ -0,0 +1,183 @@
+/***********************************************************************/
+/*                                                                     */
+/*                           Objective Caml                            */
+/*                                                                     */
+/*            Xavier Leroy, projet Cristal, INRIA Rocquencourt         */
+/*                                                                     */
+/*  Copyright 1996 Institut National de Recherche en Informatique et   */
+/*  Automatique.  Distributed only by permission.                      */
+/*                                                                     */
+/***********************************************************************/
+
+/* $Id: s-templ.h,v 1.10 1996/10/07 14:02:45 doligez Exp $ */
+
+/* Operating system and standard library dependencies. */
+
+/* 0. Operating system type string. */
+
+#define OCAML_OS_TYPE "Unix"
+/* #define OCAML_OS_TYPE "Win32" */
+/* #define OCAML_OS_TYPE "MacOS" */
+
+/* 1. For the runtime system. */
+
+#define HAS_MEMMOVE
+
+/* Define HAS_MEMMOVE if you have `memmove', and if
+  `memmove' is guaranteed to work even on overlapping areas.
+  That's the case if your library is ANSI C compliant. */
+
+#define HAS_BCOPY
+
+/* Define HAS_BCOPY if you have `bcopy', and if
+   `bcopy' is guaranteed to work even on overlapping areas. */
+
+/* If none of HAS_MEMMOVE and HAS_BCOPY is defined, then we'll
+   use our own memory copy routine. It might be slightly slower than the
+   routines provided in the standard library, but at least it is guaranteed
+   to work. So, in doubt, don't define anything. */
+
+#define POSIX_SIGNALS
+
+/* Define POSIX_SIGNALS if signal handling is POSIX-compliant.
+   In particular, sigaction(), sigprocmask() and the operations on
+   sigset_t are provided. */
+
+#define BSD_SIGNALS
+
+/* Define BSD_SIGNALS if signal handlers have the BSD semantics: the handler
+   remains attached to the signal when the signal is received. Leave it
+   undefined if signal handlers have the System V semantics: the signal
+   resets the behavior to default. */
+
+#define HAS_SIGSETMASK
+
+/* Define HAS_SIGSETMASK if you have sigsetmask(), as in BSD. */
+
+#define HAS_TERMCAP
+
+/* Define HAS_TERMCAP if you have the termcap functions to read the
+   terminal database, e.g. tgetent(), tgetstr(), tgetnum(), tputs().
+   Also add the required libraries (e.g. -lcurses -ltermcap) to $(CCLIBS)
+   in ../Makefile.config */
+
+#define HAS_STRERROR
+
+/* Define HAS_STRERROR if you have strerror(). */
+
+/* 2. For the Unix library. */
+
+#define HAS_SOCKETS
+
+/* Define HAS_SOCKETS if you have BSD sockets. */
+
+#define HAS_UNISTD
+
+/* Define HAS_UNISTD if you have /usr/include/unistd.h. */
+
+#define HAS_DIRENT
+
+/* Define HAS_DIRENT if you have /usr/include/dirent.h and the result of
+   readdir() is of type struct dirent *.
+   Otherwise, we'll load /usr/include/sys/dir.h, and readdir() is expected to
+   return a struct direct *. */
+
+#define HAS_REWINDDIR
+
+/* Define HAS_REWINDDIR if you have rewinddir(). */
+
+#define HAS_LOCKF
+
+/* Define HAS_LOCKF if the library provides the lockf() function. */
+
+#define HAS_MKFIFO
+
+/* Define HAS_MKFIFO if the library provides the mkfifo() function. */
+
+#define HAS_GETCWD
+#undef HAS_GETWD
+
+/* Define HAS_GETCWD if the library provides the getcwd() function. */
+/* Define HAS_GETWD if the library provides the getwd() function. */
+
+#undef HAS_GETPRIORITY
+
+/* Define HAS_GETPRIORITY if the library provides getpriority() and
+   setpriority(). Otherwise, we'll use nice(). */
+
+#define HAS_UTIME
+#define HAS_UTIMES
+
+/* Define HAS_UTIME if you have /usr/include/utime.h and the library
+   provides utime(). Define HAS_UTIMES if the library provides utimes(). */
+
+#define HAS_DUP2
+
+/* Define HAS_DUP2 if you have dup2(). */
+
+#define HAS_FCHMOD
+
+/* Define HAS_FCHMOD if you have fchmod() and fchown(). */
+
+#define HAS_TRUNCATE
+
+/* Define HAS_TRUNCATE if you have truncate() and
+   ftruncate(). */
+
+#define HAS_SELECT
+
+/* Define HAS_SELECT if you have select(). */
+
+#define HAS_SYS_SELECT_H
+
+/* Define HAS_SYS_SELECT_H if /usr/include/sys/select.h exists
+   and should be included before using select(). */
+
+#define HAS_SYMLINK
+
+/* Define HAS_SYMLINK if you have symlink() and readlink() and lstat(). */
+
+#define HAS_WAIT4
+#define HAS_WAITPID
+
+/* Define HAS_WAIT4 if you have wait4().
+   Define HAS_WAITPID if you have waitpid(). */
+
+#define HAS_GETGROUPS
+
+/* Define HAS_GETGROUPS if you have getgroups(). */
+
+#define HAS_TERMIOS
+
+/* Define HAS_TERMIOS if you have /usr/include/termios.h and it is
+   Posix-compliant. */
+
+#define HAS_ASYNC_IO
+
+/* Define HAS_ASYNC_IO if BSD-style asynchronous I/O are supported
+   (the process can request to be sent a SIGIO signal when a descriptor
+   is ready for reading). */
+
+#define HAS_SETITIMER
+
+/* Define HAS_SETITIMER if you have setitimer(). */
+
+#define HAS_GETHOSTNAME
+
+/* Define HAS_GETHOSTNAME if you have gethostname(). */
+
+#define HAS_UNAME
+
+/* Define HAS_UNAME if you have uname(). */
+
+#define HAS_GETTIMEOFDAY
+
+/* Define HAS_GETTIMEOFDAY if you have gettimeofday(). */
+
+#define HAS_MKTIME
+
+/* Define HAS_MKTIME if you have mktime(). */
+
+
+/* Cray's <sys/param.h> need UMK for MAXPATHLEN */
+#define UMK

diff -P -u -B -b -r -d -x *.cm* ocaml-1.07/otherlibs/graph/libgraph.h ocaml-1.07-cray/otherlibs/graph/libgraph.h
--- ocaml-1.07/otherlibs/graph/libgraph.h	Tue Sep  2 14:54:23 1997
+++ ocaml-1.07-cray/otherlibs/graph/libgraph.h	Tue Apr  7 16:43:20 1998
@@ -16,6 +16,9 @@
 #include <X11/Xutil.h>
 #include <mlvalues.h>
 
+#include "../../config/s.h"
+#include "../../config/m.h"
+
 struct canvas {
   int w, h;                     /* Dimensions of the drawable */
   Drawable win;                 /* The drawable itself */
diff -P -u -B -b -r -d -x *.cm* ocaml-1.07/otherlibs/graph/open.c ocaml-1.07-cray/otherlibs/graph/open.c
--- ocaml-1.07/otherlibs/graph/open.c	Tue Sep  2 14:54:24 1997
+++ ocaml-1.07-cray/otherlibs/graph/open.c	Wed Apr  8 12:13:36 1998
@@ -22,6 +22,9 @@
 #include <sys/time.h>
 #endif
 
+/* the CrayT3E defines FASYNC here: */
+#include <sys/file.h>
+
 Display * grdisplay = NULL;
 
 static Bool gr_initialized = False;
diff -P -u -B -b -r -d -x *.cm* ocaml-1.07/otherlibs/unix/getcwd.c ocaml-1.07-cray/otherlibs/unix/getcwd.c
--- ocaml-1.07/otherlibs/unix/getcwd.c	Tue Sep  2 14:54:35 1997
+++ ocaml-1.07-cray/otherlibs/unix/getcwd.c	Tue Apr  7 16:28:32 1998
@@ -15,6 +15,8 @@
 #include <alloc.h>
 #include "unixsupport.h"
 
+#include "../config/s.h"
+
 #ifdef HAS_GETCWD
 
 #ifndef _WIN32


--- ocaml-1.07/yacc/defs.h	Tue Sep  2 14:54:58 1997
+++ ocaml-1.07-cray/yacc/defs.h	Tue Apr  7 16:05:57 1998
@@ -44,15 +44,20 @@
 /*	from r (0-indexed)				*/
 /*  SETBIT sets the n-th bit starting from r		*/
 
-#define	MAXCHAR		255
-#define	MAXSHORT	32767
-#define MINSHORT	-32768
+
+#include <limits.h>
+
+#define	MAXCHAR		UCHAR_MAX
+#define	MAXSHORT	SHRT_MAX
+#define MINSHORT	SHRT_MIN
 #define MAXTABLE	32500
 
-#define BITS_PER_WORD	32
+#define BITS_PER_WORD	(8*sizeof(unsigned))
 #define	WORDSIZE(n)	(((n)+(BITS_PER_WORD-1))/BITS_PER_WORD)
-#define	BIT(r, n)	((((r)[(n)>>5])>>((n)&31))&1)
-#define	SETBIT(r, n)	((r)[(n)>>5]|=((unsigned)1<<((n)&31)))
+#define	BIT(r, n)	((((r)[(n)/BITS_PER_WORD])>>((n)%BITS_PER_WORD))&1)
+#define	SETBIT(r, n)	((r)[(n)/BITS_PER_WORD]|=((unsigned)1<<((n)%BITS_PER_WORD)))
+
+
 
 /*  character names  */