Patch Kit No. 1 for COHERENT 4.2r05/XFree386 1.2
==========================================================================

Contents of the Kit
-------------------

This patch kit repairs some problems discovered with release 1.0 of
X Windows for COHERENT.  It consists of the following files:

Install.Coh		Script to install these items
README			This file
Xfuncs.h		A fixed X11 header file
Xlib.h			A fixed X11 header file
Xos.h			A fixed X11 header file
bdftopcf		Font compiler
cc			Repaired version of the COHERENT C compiler
cursorfont.h		A missing X11 header file
keysymdef.h		A missing X11 header file
make			Repaired version of the COHERENT make utility
mkdirhier		Repaired version of this script
site.def		A fixed version of the site-definition file
startx			A repaired version of the "startx" script
x11perf			Manual page for command "x11perf"
x11perfcomp		Manual page for command "x11perfcomp"

The header files Xfuncs.h, Xlib.h, and Xos.h fix some bugs that
made it impossible to compile certain public-domain applications.

The header files cursorfont.h and keysymdef.h are used by a few
X applications, in particular xf, a user-interface builder
that is based on tcl/tk.

File "site.def" included two compiler options by default that cause GCC
to jump the rails.  As these options add nothing to compilation with "cc"
and only create problems, they have been deleted.

File "startx" has been modified so that it checks to see if the X lock file
exists in /tmp before it invokes "xinit".  This protects the user from
invoking X from within X (which, as you can imagine, creates any number of
problems).

File "mkdirhier" has been rewritten to make it more robust.

The version of "make" shipped with COHERENT 4.2.05 had a bug that made it
impossible to compile a Makefile built from an Imakefile.  The version
of make included in this kit repairs this problem.

The C compiler included with COHERENT 4.2.05 had a bug in the way it
performed extension that it impossible to compile certain X applications,
such as ghostscript and ghostview.  The verison of the compiler included
here fixes this problem.

The font compiler bdftopcf was not included missing in the X11 distribution.
Some X11 packages includes additional fonts in the bdf format, which must
be compiled into the pcf format used by X11R5.  It is easy to use:

	bdftopcf <filename.bdf >filename.pcf

To install the patch kit, su to "root" and execute script "Install.Coh".

Manual pages for the X utilities "x11perf" and "x11perfcomp" were not
included in the original X manual.  They are now included, and can be
viewed with the command "man".

How To Compile X11 Applications Under COHERENT 4.2
--------------------------------------------------
The following gives some tips on importing X applications to COHERENT
that we have gleaned from our experience over the last months.

To begin, we have found that most X applications need minimal modifications
to compile under COHERENT; and that once an application has compiled, chances
are it will run successfully.  This by means guarantees that any particular
application will compile successfully, or will run once it is compiled; but
it does mean that it's probably worth the effort to try to compile an
application.  Note, too, that applications vary wildly in the quality of
their code, and that will affect what success you have with it.

So, to begin.  Once you have gathered the sources together, look for a
"README" file.  This should warn you of pitfalls and problems, and point
you at the preferred way to rebuild the program.

Then, look for an Imakefile or Makefile for the application.  You probably
will need to make the following changes:

- X header files are kept in directory /usr/X11/include/X11.  A Makefile
must use the option -I to name this directory explicitly:

	-I/usr/X11/include

This tells "cc" to look in /usr/X11/include for any header file whose name
is prefixed with X11, such as:

	#include <X11/Xos.h>

Often, this is done as part of the macro "CCFLAGS".

- The directory that holds the libraries is /usr/X11/lib.  If you are using
a Makefile, you must that directory explicitly.  Many Makefiles use a 
macro named something like "LIBFLAGS" to set linking options and name
libraries; before the list of libraries, you must add the option
"-L/usr/X11/lib".  This is not necessary if you are using an Imakefile.

- Add -lXbsd to the end of the list of libraries to be linked into the
application.  This library holds the socket-emulation routines.

- Add the option "-DCOHERENT" to the macro "CCFLAGS".

- Remove the option "-lsocket" from the list of library names, should it
appear there.

- If your application uses ANSI-specific grammar (e.g., function prototypes
or pointer to type "void"), you must compile it with an ANSI-compliant
compiler, e.g., GCC.  In a Makefile or Imakefile, define the macro "CC"
to "gcc".

Once you have made these adjustments, you are ready to begin compiling.

If your application has an Imakefile, first build a Makefile by using the
command "xmkmf".  This command normally does not take an argument.
Occasionally, the command dies with an error message and writes a bogus
Makefile.  When this happens, check the Imakefile at the line indicated;
most often, this occurs when xmkmf interprets a comment as being a
C preprocessor instruction.  This happens inevitably when an Imakefile
has an RCS header.  Just remove the comment that triggers the problem
and try again.

Once you have created the Makefile, type "make", then sit back and watch.
Most problems that pop up during compilation are straightforward to fix.
During link phase, however, you may see an undefined symbol for the function
"select".  That is because under X Windows for COHERENT, this function is
named "soselect".  To fix the problem, go through the module in question,
and conditionally replace "select" with "soselect".  For example, change:

	select( [stuff] );
to:

	#if defined(COHERENT)
		soselect ( [stuff] );
	#else
		select ( [stuff] );
	#endif

This is the proper way to add new COHERENT-specific code to these sources.

- You may find problems with the following routines:  bcopy(), bcmp(),
bzero(), index(), and rindex().  The problems usually consist of a clash
between the manner in which these routines are declared or defined within
the application, and they way they are declared or defined in the COHERENT
header files.  In most instances, you should conditionalize out the
declaration within the application, and ensure that the proper COHERENT
header file is included.  For details, use the "man" command to view the
manual entries for the routine in question.

- In some cases, PI is redeclared.  Conditionalize out the declaration of
PI within the application, as shown above.

If you have other problems, send mail to support@mwc.com.  We will help you
as quickly as possible.
