[comp.unix.aux] Compiling gcc-1.37 and X11R4 with gcc under A/UX 2.0

lamarche@ireq.hydro.qc.ca (08/30/90)

I was succesfull in recompiling X11R4 with gcc under A/UX 2.0 using the sources
I had since mars 1990 under A/UX 1.1. I had to use my old binaries of gcc to
recompile my new version of it under 2.0. I was unsuccesfull doing that with
the version provided at apple.com. Here are the few modifications that I made
to my sources.

******************************
*   gcc-1.37 for A/UX 1.1    *
******************************

Makefile:
< CFLAGS = -O -g $(XCFLAGS) -DAUX_ASM
---
> CFLAGS = -O -g $(XCFLAGS) -DAUX_ASM -DAUX2 -D_BSD_SOURCE -D_SYSV_SOURCE

********************************
*   X11R4 with the gcc         *
********************************
mit/config/Makefile.ini:
<          CFLAGS = $(BOOTSTRAPCFLAGS) $(CDEBUGFLAGS)
---
<          CFLAGS = $(BOOTSTRAPCFLAGS) $(CDEBUGFLAGS) -DAUX2 -D_SYSV_SOURCE -D_BSD_SOURCE

mit/config/macII.cf:
< #define OSName            A/UX 1.1
< #define OSMajorVersion    1
< #define OSMinorVersion    1
< #define BootstrapCFlags   -DmacII
< #define StandardDefines    -DmacII -DSYSV
< #define StandardCppDefines -DmacII -DSYSV
---
> #define OSName            A/UX 2.0
> #define OSMajorVersion    2
> #define OSMinorVersion    0
> #define StandardDefines    -DSYSV -D_SYSV_SOURCE -D_BSD_SOURCE -DAUX2
> #define StandardCppDefines -DSYSV -D_SYSV_SOURCE -D_BSD_SOURCE -DAUX2

mit/config/site.def:
*** Ensure that HasGcc is defined
*** Modify
< #define CcCmd gcc -DNOSTDHDRS -fstrength-reduce -fpcc-struct-return -fwritable-strings \
<                   -traditional
---
> #define CcCmd gcc -DNOSTDHDRS -fstrength-reduce -fpcc-struct-return -fwritable-strings \
<                   -traditional -DAUX2 -D_SYSV_SOURCE -D_BSD_SOURCE
*** and
< #define CcCmd gcc -DNOSTDHDRS -fstrength-reduce -fpcc-struct-return
---
> #define CcCmd gcc -DNOSTDHDRS -fstrength-reduce -fpcc-struct-return -fwritable-strings \
>                   -DAUX2 -D_SYSV_SOURCE -D_BSD_SOURCE

I have tested most of the applications and the server and everything looks fine.

I hope this can help.

--
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
| Louis Lamarche, IREQ |       lamarche@IREQ.Hydro.Qc.CA
| CP 1000, Varennes    |                 or
| QC, Canada, J3X 1S1  |  514-652-8077 (office)  514-324-2919 (home)

liam@cs.qmw.ac.uk (William Roberts) (09/03/90)

Your changes should have the desired effect, but they represent
considerable overkill!

What you should have done was:

1) Use the appropriate flag to (A/UX) cc to get it to show you
the A/UX 2.0 standard invocation of cpp e.g.

whitesand.root 8 # cc -# pipetest.c |& fold
callsys /lib/cpp: '/lib/cpp' '-Dmc68k32' 'pipetest.c'
'/usr/tmp/ctmAAAa003954' .
...

2) Look in the CPP manual page to find the "reserved symbols", i.e.

          -Uname
               Remove any initial definition of name, where name is a
               reserved symbol that is predefined by the particular
               preprocessor.  The list of reserved symbols is shown
               below:

                    operating system:    unix

                    hardware:            m68k

                    UNIX(Reg.) System variant:
                                         _SYSV_SOURCE _BSD_SOURCE
                                         _AUX_SOURCE

3) Finally, arrange for CPP_PREDEFINES in your tm-aux.h file to
include all of the things that you need, and rebuild gcc.

config/tm-aux.h:
#define CPP_PREDEFINES "-Dunix -Dm68k -D_SYSV_SOURCE \
        -D_BSD_SOURCE -D_AUX_SOURCE \
        -DmacII -DAUX"


Your solution of patching up the X11 Makefiles is workable (you
didn't need _AUX_SOURCE so that could bite you someday) but
fixing the GNU cpp is more elegant.


Does anyone know if the -Dmc68k32 which the A/UX 2.0 cc adds to
its invocation of cpp is actually needed? If so, it also needs
to go into the CPP_PREDEFINES for gcc...
-- 

William Roberts                 ARPA: liam@cs.qmw.ac.uk
Queen Mary & Westfield College  UUCP: liam@qmw-cs.UUCP
Mile End Road                   AppleLink: UK0087
LONDON, E1 4NS, UK              Tel:  071-975 5250 (Fax: 081-980 6533)