How to compile X11R5 (patch level 9) with GCC version 2:

The patches include support for building the shared libraries with GCC 2 on 
the Sparc and 68k machines.

Sun forgot to include a static version of libdl.a with some versions
of SunOS (4.1 mainly).  If you see undefined symbols _dlopen, _dlsym,
or _dlclose when linking with -lX11, compile and link against the file
mit/util/misc/dlsym.c in the MIT X11R5 distribution.

mit/config/Imake.tmpl -- Do not set -fstrength-reduce if we have GCC 2.  If
-fstrength-reduce (or any other -f option) is a major win, then it will
most likely be turned on by -O2 optimization.

mit/config/sunLib.rules -- If HasGcc2 is defined, then use -fpic to 
generate PIC code.  Make sure that gcc does not use gas (the GNU assembler)
when compiling PIC code; gas does not assemble it correctly.  If you
have gas installed where gcc uses it by default, you might have to add
-B/bin/ to the PositionIndependentCFlags.

mit/config/site.def -- Define HasGcc2 to be YES.

mit/config/sun.cf -- When compiling with GCC 2, use -O2 optimization.

mit/rgb/Imakefile -- No longer need to compile some modules with 
cc on the Sparc since GCC 2 produces proper -fpcc-struct-return code.

mit/server/os/Imakefile -- Likewise.

*** mit/config/Imake.tmpl.ORIG	Tue Dec 31 11:07:56 1991
--- mit/config/Imake.tmpl	Tue Dec 31 12:30:47 1991
***************
*** 499,508 ****
--- 499,512 ----
  #define HasGcc NO
  #endif
  #ifndef CcCmd
+ #if HasGcc2
+ #define CcCmd gcc -fpcc-struct-return
+ #else
  #if HasGcc
  #define CcCmd gcc -fstrength-reduce -fpcc-struct-return 
  #else
  #define CcCmd cc
+ #endif
  #endif
  #endif
  #if HasFortran
*** mit/config/sunLib.rules.ORIG	Tue Dec 31 11:11:24 1991
--- mit/config/sunLib.rules	Thu Jan  2 15:39:29 1992
***************
*** 23,29 ****
--- 23,33 ----
  #define SharedLibraryLoadFlags -assert pure-text
  #endif
  #ifndef PositionIndependentCFlags
+ #if defined(HasGcc2)
+ #define PositionIndependentCFlags -fpic
+ #else
  #define PositionIndependentCFlags -pic
+ #endif
  #endif
  
  /*
*** mit/config/site.def.ORIG	Tue Dec 31 11:13:49 1991
--- mit/config/site.def	Tue Dec 31 12:02:59 1991
***************
*** 25,31 ****
  
  #ifdef BeforeVendorCF
  
! /* #define HasGcc YES */
  
  #endif /* BeforeVendorCF */
  
--- 25,32 ----
  
  #ifdef BeforeVendorCF
  
! #define HasGcc YES 
! #define HasGcc2 YES
  
  #endif /* BeforeVendorCF */
  
*** mit/config/sun.cf.ORIG	Tue Dec 31 11:13:57 1991
--- mit/config/sun.cf	Wed Jan 15 12:13:53 1992
***************
*** 34,42 ****
--- 34,47 ----
  
  #if HasGcc
  
+ #define OptimizedCDebugFlags -O
+ #if defined(HasGcc2) 
+ #define OptimizedCDebugFlags -O2
+ #else
  #define SharedLibraryCcCmd cc
  #define ExtraLoadFlags -B/usr/bin/
  #define AllocateLocalDefines /**/
+ #endif
  
  .c.o:
  	$(CC) -c $(CFLAGS) $*.c

*** mit/rgb/Imakefile.ORIG	Wed Jan 15 16:43:18 1992
--- mit/rgb/Imakefile	Thu Jan  2 13:34:09 1992
***************
*** 17,23 ****
  #if !(defined(SGIArchitecture) || SystemV4)
         DBMLIB = -ldbm
  #endif
! #if defined(SparcArchitecture) && HasGcc
             CC = cc
      CCOPTIONS = /**/
      EXTRA_LOAD_FLAGS = /**/
--- 17,23 ----
  #if !(defined(SGIArchitecture) || SystemV4)
         DBMLIB = -ldbm
  #endif
! #if defined(SparcArchitecture) && HasGcc && !defined(HasGcc2)
             CC = cc
      CCOPTIONS = /**/
      EXTRA_LOAD_FLAGS = /**/
*** mit/server/os/Imakefile.ORIG	Wed Jan 15 16:46:23 1992
--- mit/server/os/Imakefile	Wed Jan 15 16:46:48 1992
***************
*** 132,138 ****
  SpecialObjectRule(osinit.o,$(ICONFIGFILES),$(ADM_DEFINES))
  SpecialObjectRule(WaitFor.o,$(ICONFIGFILES),$(EXT_DEFINES))
  SpecialObjectRule(fonttype.o,$(ICONFIGFILES),$(FONT_DEFINES))
! #if defined(SparcArchitecture) && HasGcc
  oscolor.o: $(ICONFIGFILES)
  	$(RM) $@
  	cc -c $(DBM_DEFINES) $(CDEBUGFLAGS) $(ALLDEFINES) $*.c
--- 132,138 ----
  SpecialObjectRule(osinit.o,$(ICONFIGFILES),$(ADM_DEFINES))
  SpecialObjectRule(WaitFor.o,$(ICONFIGFILES),$(EXT_DEFINES))
  SpecialObjectRule(fonttype.o,$(ICONFIGFILES),$(FONT_DEFINES))
! #if defined(SparcArchitecture) && HasGcc && !defined(HasGcc2)
  oscolor.o: $(ICONFIGFILES)
  	$(RM) $@
  	cc -c $(DBM_DEFINES) $(CDEBUGFLAGS) $(ALLDEFINES) $*.c


