This file contains a collection of notes that various people have
provided about porting Tcl to various machines and operating systems.
I don't have personal access to any of these machines, so I make
no guarantees that the notes are correct, complete, or up-to-date.
In some cases, a person has volunteered to act as a contact point
for questions about porting Tcl to a particular machine;  in these
cases the person's name and e-mail address are listed.

---------------------------------------------
Cray machines running UNICOS:
Contact: John Freeman (jlf@cray.com)
---------------------------------------------

1. There is an error in the strstr function in UNICOS such that if the
string to be searched is empty (""), the search will continue past the
end of the string.  Because of this, the history substitution loop
will sometimes run past the end of its target string and trash
malloc's free list, resulting in a core dump some time later.  (As you
can probably guess, this took a while to diagnose.)  I've submitted a
problem report to the C library maintainers, but in the meantime here
is a workaround.

-----------------------------------------------------------------
diff -c1 -r1.1 tclHistory.c
*** 1.1	1991/11/12 16:01:58
--- tclHistory.c	1991/11/12 16:14:22
***************
*** 23,24 ****
--- 23,29 ----
  #include "tclInt.h"
+ 
+ #ifdef _CRAY
+ /* There is a bug in strstr in UNICOS; this works around it. */
+ #define strstr(s1,s2) ((s1)?(*(s1)?strstr((s1),(s2)):0):0)
+ #endif _CRAY

---------------------------------------------
MIPS systems runing EP/IX:
---------------------------------------------

1. Need to add a line "#include <bsd/sys/time.h>" in tclUnix.h.

2. Need to add "-lbsd" into the line that makes tclTest:

	${CC} ${CFLAGS} tclTest.o libtcl.a -lbsd -o tclTest

---------------------------------------------
IBM RS/6000 systems running AIX:
---------------------------------------------

1. The system version of strtoul is buggy, at least under some
versions of AIX.  If the expression tests fail, try forcing Tcl
to use its own version of strtoul instead of the system version.
To do this, first copy strtoul.c from the compat subdirectory up
to the main Tcl directory.  Then modify the Makefile so that
the definition for COMPAT_OBJS includes "strtoul.o".  Note:  the
"config" script should now detect the buggy strtoul and substitute
Tcl's version automatically.

2. You may have to comment out the declaration of open in tclUnix.h.

3. You may need to add "-D_BSD -lbsd" to the CFLAGS definition.  This
causes the system include files to look like BSD include files and
causes C library routines to act like bsd library routines.  Without
this, the system may choke on "struct wait".

---------------------------------------------
AT&T 4.03 OS:
---------------------------------------------

Machine: i386/33Mhz i387 32k Cache 16MByte 
OS: AT&T SYSV Release 4 Version 3
X: X11R5 fixlevel 9
Xserver: X386 1.2

1. Change the Tk Makefile as follows:
XLIB            = -lX11
	should be changed to:
XLIB            = -lX11 -lsocket -lnsl

-------------------------------------------------------
Silicon Graphics systems:
-------------------------------------------------------

1. Change the CC variable in the Makefile to:

CC =		cc -xansi -D__STDC__ -signed

2. In  Irix releases 4.0.1 or earlier the C compiler has a buggy optimizer.
   If Tcl fails its test suite or generates inexplicable errors,
   compile tclVar.c with -O0 instead of -O.

3. For IRIX 5.1 or later, comments 1 and 2 are no longer relevant,
but you must add -D_BSD_SIGNALS to CFLAGS to get the proper signal
routines.

4. Add a "-lsun" switch in the targets for tclsh and tcltest,
just before ${MATH_LIBS}.

---------------------------------------------
NeXT machines running NeXTStep 3.1:
---------------------------------------------

1. Run configure with predefined CPP:
	CPP='cc -E' ./configure
	
2. Edit Makefile: 
  -add tmpnam.o to COMPAT_OBJS:
	COMPAT_OBJS =		 getcwd.o waitpid.o strtod.o tmpnam.o
  -add '-m' to MATH_LIBS
	MATH_LIBS = -m -lm  

3. Edit compat/tmpnam.o and replace "/usr/tmp" with "/tmp"

After this, tcl7.0 will be build fine on NeXT (ignore linker warning)
and run all the tests. There are some formatting problems in printf() or
scanf() which come from NeXT's lacking POSIX conformance. Ignore those
errors, they don't matter much.

-------------------------------------------------
ISC 2.2 UNIX (using standard ATT SYSV compiler):
-------------------------------------------------

In Makefile, change

CFLAGS =      -g -I. -DTCL_LIBRARY=\"${TCL_LIBRARY}\"

to

CFLAGS =      -g -I. -DPOSIX_JC -DTCL_LIBRARY=\"${TCL_LIBRARY}\"

This brings in the typedef for pid_t, which is needed for
/usr/include/sys/wait.h in tclUnix.h.

---------------------------------------------
DEC Alphas:
---------------------------------------------

1. There appears to be a compiler/library bug that causes core-dumps
unless you compile tclVar.c without optimization (remove the -O compiler
switch).  The problem appears to have been fixed in the 1.3-4 version
of the compiler.

---------------------------------------------
CDC 4680MNP, EP/IX 1.4.3:
---------------------------------------------

The installation was done in the System V environment (-systype sysv)
with the BSD extensions available (-I/usr/include/bsd and -lbsd).  It was
built with the 2.20 level C compiler.  The 2.11 level should not be used
because it has a problem with detecting NaN values in lines like:
	if (x != x) ...
which appear in the TCL code.

To make the configure script find the BSD extensions, I set environment
variable DEFS to "-I/usr/include/bsd" and LIBS to "-lbsd" before
running it.  I would have also set CC to "cc2.20", but that compiler
driver has a bug that loader errors (e.g. not finding a library routine,
which the script uses to tell what is available) do not cause an error
status to be returned to the shell.

There is a bug in the <sys/wait.h> include file that mis-defines the
structure fields and causes WIFEXITED and WIFSIGNALED to return incorrect
values.  My solution was to create a subdirectory "sys" of the main TCL
source directory and put a corrected wait.h in it.  The "-I." already on
all the compile lines causes it to be used instead of the system version.
To fix this, compare the structure definition in /usr/include/bsd/sys/wait.h
with /bsd43/include/sys/wait.h (or mail to John Jackson, jrj@cc.purdue.edu,
and he'll send you a context diff).

After running configure, I made the following changes to Makefile:

	1)  In AC_FLAGS, change:
		-DNO_WAIT3=1
	to
		-DNO_WAIT3=0 -Dwait3=wait2
	EP/IX (in the System V environment) provides a wait2() system
	call with what TCL needs (the WNOHANG flag).  The extra parameter
	TCL passes to what it thinks is wait3() (the resources used by
	the child process) is always zero and will be safely ignored.

	3)  Change:
		CC=cc
	to
		CC=cc2.20
	because of the NaN problem mentioned earlier.  Skip this if the
	default compiler is already 2.20 (or later).

	4)  Add "-lbsd" to the commands that create tclsh and tcltest
	(look for "-o").

---------------------------------------------
Convex systems, OS 10.1 and 10.2:
Contact: Lennart Sorth (ls@dmi.min.dk)
---------------------------------------------

1. tcl7.0b2 compiles on Convex systems (OS 10.1 and 10.2) by just running 
  configure, typing make, except tclUnixUtil.c needs to be compiled
  with option "-pcc" (portable cc, =!ANSI) due to:
  cc: Error on line 1111 of tclUnixUtil.c: 'waitpid' redeclared:
  incompatible types.

-------------------------------------------------
Pyramid, OSx 5.1a (UCB universe, GCC installed):
-------------------------------------------------

1. The procedures memcpy, strchr, fmod, and strrchr are all missing,
so you'll need to provide substitutes for them.  After you do that
everything should compile fine.  There will be one error in a scan
test, but it's an obscure one because of a non-ANSI implementation
of sscanf on the machine;  you can ignore it.

2. You may also have to add "tmpnam.o" to COMPAT_OBJS in Makefile:
the system version appears to be bad.
