This is an old version of the file "porting.notes".  It contains
porting information that people submitted for Tk releases numbered
3.6 and earlier.  You may find information in this file useful if
there is no information available for your machine in the current
version of "porting.notes".

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.
If you see the word "I" in any explanations, it refers to the person
who contributed the information, not to me;  this means that I
probably can't answer any questions about any of this stuff. 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.  I'd be
happy to receive corrections or updates.

sccsid = SCCS: @(#) porting.old 1.2 96/02/16 10:27:30

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

1. There appears to be a compiler/library bug that prevents tkTrig.c
from compiling unless you turn off optimization (remove the -O compiler
switch).  The problem appears to have been fixed in the 1.3-4 version
of the compiler.

---------------------------------------------
HP-UX systems:
---------------------------------------------

1. Configuration:
	    HP-UX Release 7.05 on a series 300 (68k) machine.
	    The native cc has been used for production.
	    X11r4 libraries and include files were taken from
	    internet archives, where as the server came with HPUX release 7.05.
    
    Problems:
	    Symbol table space for cc had to be increased with: -Wc,-Ns3000
	    tkBind.c did not compile under -O:
		    C1 internal error in "GetField": Set Error Detected
		    *** Error code 1
	    tkBind.c did compile without optimization (no -O).

2. Note: if you have trouble getting xauth-style access control to work
(and you'll need xauth if you want to use "send"), be sure to uncomment
the line

# Vuelogin*authorize:         True

in the file /usr/vue/config/Xconfig, so that the server starts up with
authorization enabled.  Also, you may have to reboot the machine in
order to force the server to restart.

---------------------------------------------
SCO Unix:
---------------------------------------------

Getting Tk to run under SCO Unix:

Add a "#undef select" to tkEvent.c, and remove the reference to TK_EXCEPTION
around line 460 of main.c.

Tk uses its own scheme for allocating the border colors for its 3D widgets,
which causes problems when running TK on a system with "PseudoColor"
display class, and a 16-cell colormap.

If you can't go to eight bitplanes, you can instead start the server with a
"-static" (Xsco) or "-analog" (Xsight) option, making the display class 
become "StaticColor".  This makes the entire colormap read-only, and it will
return the color that most closely maps to the desired color as possible.

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

1. Change the CC variable in the Makefile to:

CC =		cc -xansi -D__STDC__ -signed

2. Change the LIBS variable in the Makefile to use the X11 shared library
   ("-lX11_s" instead of "-lX11").

3. Under some versions of IRIX (e.g. 4.0.1) you have to turn off
   optimization (e.g.  change "-O" in CFLAGS to "-O0" or remove it
   entirely) because of faulty code generation.  If the Tcl or Tk test
   suites fail, turn off optimization.

4. Add a "-lsun" switch just before "-lm" in the LIBS definition.
   Under some versions of IRIX (5.1.1.3?) you'll need to omit the
   "-lsun" switch, plus remove the "-lsocket" and "-lnsl" switches
   added by the configure script;  otherwise you won't be able to
   use symbolic host names for the display, only numerical Internet
   addresses.

5. Rumor has it that you'll also need a "-lmalloc" switch in the
   LIBS definition.

6. In IRIX 5.2 you'll have to modify Makefile to fix the following problems:
    - The "-c" option is illegal with this version of install, but
      the "-F" switch is needed instead.  Change this in the "INSTALL ="
      definition line.
    - The order of file and directory have to be changed in all the
      invocations of INSTALL_DATA or INSTALL_PROGRAM.

---------------------------------------------
IBM RS/6000's:
---------------------------------------------
1. To allow ALT- sequences to work on the RS-6000, the following
line should be changed in tkBind.c:

    OLD LINE:
     {"Alt",	Mod2Mask, 	0},
    NEW LINE:
     {"Alt",	Mod1Mask, 	0},

---------------------------------------------
AT&T SVR4:
---------------------------------------------

1. The first major hurdle is that SVR4's select() subtly differs
from BSD select.  This impacts Tk in two ways, some of the Xlib calls
make use of select() and are inherently broken and Tk itself makes
extensive use of select().  The first problem can't be fixed without
rebuilding one's Xlib, but can be avoided.  I intend to submit part
of my work the XFree86 guys so that the next version of XFree86 for
SVR4 will not be broken.  Until then, it is necessary to comment out
this section of code from Tk_DoOneEvent() (which is near line 1227):

#if !defined(SVR4)
                    void (*oldHandler)();

                    oldHandler = (void (*)()) signal(SIGPIPE, SIG_IGN);
                    XNoOp(display);
                    XFlush(display);
                    (void) signal(SIGPIPE, oldHandler);
#endif /* SVR4 */

if you don't comment it out, some scripts cause wish to go into
an infinite loop of sending no-ops to the X server.

2. As for fixing Tk's calls to select(), I've taken the simple
approach of writing a wrapper for select and then using #define to
replace all calls to select with the wrapper.  I chose tkConfig.h
to load the wrapper.  So at the very end of tkConfig.h, it now looks
like:

#if defined(SVR4)
#  include "BSDselect.h"
#endif 

#endif /* _TKCONFIG */

The file BSDselect.h looks like this:

#include <sys/types.h>
#include <sys/time.h>
#include <sys/select.h>

/*  This is a fix for the difference between BSD's select() and
 *  SVR4's select().  SVR4's select() can never return a value larger
 *  than the total number of file descriptors being checked.  So, if
 *  you select for read and write on one file descriptor, and both
 *  are true, SVR4 select() will only return 1.  BSD select in the
 *  same situation will return 2.
 *
 *	Additionally, BSD select() on timing out, will zero the masks,
 *	while SVR4 does not.  This is fixed here as well.
 *
 *	Set your tabstops to 4 characters to have this code nicely formatted.
 *
 *	Jerry Whelan, guru@bradley.edu, June 12th, 1993
 */


int
BSDselect(nfds, readfds, writefds, exceptfds, timeout)
int nfds;
fd_set *readfds, *writefds, *exceptfds;
struct timeval *timeout;
{
	int		rval,
			i;

	rval = select(nfds, readfds, writefds, exceptfds, timeout);

	switch(rval) {
		case -1:	return(rval);
					break;

		case 0:		if(readfds != NULL)
						FD_ZERO(readfds);
					if(writefds != NULL)
						FD_ZERO(writefds);
					if(exceptfds != NULL)
						FD_ZERO(exceptfds);

					return(rval);
					break;

		default:	for(i=0, rval=0; i < nfds; i++) {
						if((readfds != NULL) && FD_ISSET
(i, readfds)) rval++;
						if((writefds != NULL) && FD_ISSE
T(i, writefds)) rval++;
						if((writefds != NULL) && FD_ISSE
T(i, exceptfds)) rval++;
					}
					return(rval);
		}
/* Should never get here */
}

---------------------------------------------
CDC 4680MP, 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 can be used, but
it is better to match what TCL is built with, which must be 2.20 or
higher (see the porting notes with TCL for the details).

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 (but see the Tcl 2.1.1 porting notes
for comments about using "-non_shared").

After running configure, I changed the CC definition line in Makefile
from:
	CC=cc
to
	CC=cc2.20
to match the TCL build.  Skip this if the default compiler is already 2.20
(or later).

---------------------------------------------
CDC 4680MP, EP/IX 2.1.1:
---------------------------------------------

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 3.11 level C compiler.  Earlier levels can be used, but it
is better to match what TCL is built with, which must be 2.20 or higher
(see the porting notes with TCL for the details).

To make the configure script find the BSD extensions, I set environment
variable DEFS to "-I/usr/include/bsd -non_shared" and LIBS to "-lbsd"
before running it.

See the Tcl porting notes for comments on why "-non_shared" is needed
during the configuration step.  It was removed from AC_FLAGS before
building.

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

Instead of typing "./configure" to configure, type

    DEFS="-I/usr/include/X11/attinc" ./configure

to sh to do the configuration.

-------------------------------------------------
NextSTEP 3.1:
-------------------------------------------------

1. Run configure with predefined CPP:
	CPP='cc -E' ./configure
   (If your shell is [t]csh, do a "setenv CPP 'cc -E'")

2. Edit Makefile: 
  -add the following to AC_FLAGS:
	-Dstrtod=tcl_strtod

Note: Tk's raise test may fail when running the tvtwm window manager.
Changing to either twm or even better fvwm ensures that this test will
succeed. 

-------------------------------------------------
Encore 91, UMAX V 3.0.9.3:
-------------------------------------------------

1. Modify the CFLAGS definition in Makefile to include -DENCORE:

    CFLAGS = -O -DENCORE

2. "mkdir" does not by default create the parent directories.  The mkdir
directives should be modified to "midir -p".

3. An error of a redeclaration of read, can be resolved by conditionally
not compiling if an ENCORE system.

#ifndef ENCORE
extern int              read _ANSI_ARGS_((int fd, char *buf, size_t size));
#endif

-------------------------------------------------
Sequent machines running Dynix:
Contact: Andrew Swan (aswan@soda.berkeley.edu)
-------------------------------------------------

1. Use gcc instead of the cc distributed by Sequent

2. There are problems with the distributed version of
   <stddef.h>.  The easiest solution is probably to create a
   copy of stddef.h, make sure it comes early in the include
   path and then edit it as need be to eliminate conflicts
   with the X11 header files.

3. The same comments about the tanh function from the notes on
   porting Tcl apply to Tk.

-------------------------------------------------
Systems running Interactive 4.0:
-------------------------------------------------

1. Add "-posix" to CFLAGS in Makefile (or Makefile.in).

2. Add "-lnsl_s" to LIBS in Makefile (or Makefile.in).
