[comp.windows.x] X11R4 under S/6000 AIX 3.1

kline@ux1.cso.uiuc.edu (Charley Kline) (12/22/90)

I just finished a port of X11R4. With a little help from Bill Moran (whose
xterm patches are necessary but not sufficient), everything now works except
xterm, which works mostly but leaves a couple of termio settings undone (and
I have no way to set them without major hacking on the xterm code, a twisty
little maze of #ifdefs, all mostly alike).

Some words of wisdom garnered from my build notes, admittedly a bit terse:

*  Set the environment variable IMAKECPP to /usr/lpp/X11/Xamples/util/cpp/cpp
   before building, (or hack imakemdep.h to change the default definition of
   DEFAULT_CPP.

*  You'll need BOOTSTRAPCFLAGS (I set it to -Drs6000).

*  Change Imake.tmpl to key on the rs6000 symbol, and make an RS6000.cf
   config file. Mine looks like this:

	#define OSMajorVersion         3	/* S/6000 AIX Version 3.1 */
	#define OSMinorVersion         1

	#define SystemV YES
	#define OSName AIX 3.1
	#define HasNdbm YES
	#define CppCmd /usr/lpp/X11/Xamples/util/cpp/cpp
	#define PreProcessCmd /usr/lpp/X11/Xamples/util/cpp/cpp
	#define StandardCppDefines -Drs6000 -DSYSV
	#define BuildServer NO
	#define BootstrapCFlags -Drs6000
	#define OPERATING_SYSTEM AIX
	#define LibraryDefines -DUNIXCPP ibmlibdefs StandardDefines
	#define StandardDefines -Drs6000 -DSYSV -DMALLOC_0_RETURNS_NULL
	#define LintOpts -ax -Drs6000
	#define SpecialMalloc YES
	#define ibmSpecialMalloc YES

* Follow the directions in imakemdep.h carefully!

* I found things to work better when I left the xlc.cfg file alone; i.e.,
  DON'T try to make the C compiler behave more like the bsd one.

* A few source changes were necessary. Most are trivial, two are massive.
  I used #ifdef rs6000 around all my changes to keep things portable. You
  should too.

     X11/Xos.h
	 after comment "Get struct timeval", arrange for the following
	 set of conditionals to include both <time.h> and <sys/time.h>.
	 There are a couple of ways to do this.

     lib/Xaw/Text.c
	 cast required near line 1560 to keep compiler happy because
	 operands on either side of the : in a ?: operator were of
	 wrong types (hereafter referred to as ?: type check).

     clients/bitmap/bitmap.c
	 #include <math.h> needs to be moved up to the top with the
	 other includes, and the declaration of malloc near line 165
	 needs to be ifdeffed out.

     clients/xmh/command.c 
	 #include <sys/select.h> needs to be added.

     clients/xpr/pmp.h
	 #undef FALSE and #undef TRUE before the declaration of
	 enum bool.
    
     clients/xpr/x2pmp.c
	 declaration of calloc near line 37 needs to be ifdeffed out.

     clients/xdm/dm.h
	 declaration of strcpy near line 218 needs to be ifdeffed out
	 (in AIX this is an in-line optimization by the compiler, so
	 degenerates to a macro).
     
     clients/xman/man.c
	 change all calls to realloc to calls to Xrealloc (this is a
	 more general oversight than for the S/6000!). Change #ifdef USG
	 to #if defined(USG) || defined(rs6000) at line 443.

     clients/twm/events.c
	 ?: type check near line 1418.

     clients/twm/iconmgr.c
	 declaration of strcmp near line 43 needs to be ifdeffed out
	 for the same reason as strcpy did.

     clients/xterm
	 massive changes required in main.c, mostly having to do with
	 the unique pty naming scheme under AIX and the fact that the
	 #ifdefs seemt to take everything into account EXCEPT the POSIX
	 terminal I/O that AIX likes to use. I hope someone will
	 correct me if I'm wrong. I still don't have this right. We're
	 still using the "aixterm" program supplied with X11R3.

     clients/xload/get_load.c
	 AIX doesn't keep the load average in the kernel! I had to add
	 some code to do this; the result looks just like a real load
	 average display except all the math is being done by
	 get_load.c, not the kernel. Contact me for details.  For this
	 reason...

     clients/xload/Imakefile
	 EXTRA_LIBRARIES = -lm since I call exp() in get_load.c.

     util/scripts/bsdinst.sh
	 needs to be modified because /etc/install under AIX expects
	 -M to set the mode instead of -m.