Annotation of GNUtools/cc/README.X11, revision 1.1.1.1

1.1       root        1: [This file contains two alternative recipes for compiling X11 with GCC.
                      2: The first alternative puts libgcc.a into the shared X library; the second
                      3: does not.  Neither alternative works on all kinds of systems.
                      4: It may be that when using GCC 2.4, both alternatives work okay on 
                      5: relatively recent Sparc systems.  The first alternative is likely
                      6: not to work on a Sun 3 without hardware floating point.]
                      7: 
                      8: How to compile X11R5 (patch level 11) with GCC version 2:
                      9: 
                     10: The patches include support for building the shared libraries with GCC
                     11: 2 on the Sparc and 68k machines.  This version includes the necessary
                     12: parts of libgcc.a in the shared library for X, in case functions in
                     13: that library need it.  Thus the default behavior is now to build
                     14: everything, including the libraries, with gcc.
                     15: 
                     16: If you build the shared library this way, it may not work with 
                     17: executables made with older versions of GCC (2.3.3 and earlier).
                     18: If that happens, relink those executables with the latest GCC.
                     19: IF YOU THINK YOU MIGHT COMPILE X FOR SOLARIS 2, then you really don't
                     20: need this patch: get /contrib/R5.SunOS5.patch.tar.Z from
                     21: export.lcs.mit.edu instead.  It has everything you need to do the
                     22: build for Solaris 2, sets you up to everything with GCC, and is
                     23: backward compatible with Sunos 4.*.  Get the the README
                     24: (/contrib/R5.SunOS5.patch.README at export) for more info.
                     25: 
                     26: If you see undefined symbols _dlopen, _dlsym, or _dlclose when linking
                     27: with -lX11, compile and link against the file mit/util/misc/dlsym.c in
                     28: the MIT X11R5 distribution.  Alternatively, do dynamic linking
                     29: by using a non-GNU ld.
                     30: 
                     31: mit/config/Imake.tmpl -- Do not set -fstrength-reduce if we have GCC 2.
                     32: If -fstrength-reduce (or any other -f option) is a major win, then it
                     33: will most likely be turned on by -O2 optimization.
                     34: 
                     35: mit/config/sunLib.rules -- If HasGcc and GccVersion > 1 are true, then
                     36: use gcc -fpic to generate PIC code.  Make sure that gcc does not use
                     37: gas (the GNU assembler) when compiling PIC code; gas does not assemble
                     38: it correctly.
                     39: 
                     40: ***If you have gas installed where gcc uses it by default, you might have
                     41: to add -B/bin/ to the PositionIndependentCFlags.***
                     42: 
                     43: mit/config/site.def -- Define GccVersion to be 2.
                     44: 
                     45: mit/config/sun.cf -- When compiling with GCC 2, use -O2 optimization.
                     46: 
                     47: mit/config/sunLib.rules -- When compiling with GCC 2, use -fpic for
                     48: position independent code generation.
                     49: 
                     50: mit/rgb/Imakefile -- No longer need to compile some modules with 
                     51: cc on the Sparc since GCC 2 produces proper -fpcc-struct-return code.
                     52: 
                     53: mit/server/os/Imakefile -- Likewise.
                     54: 
                     55: mit/server/ddx/sun/Imakefile -- When compiling with GCC 2, some modules
                     56: should be compiled with -fvolatile.
                     57: 
                     58: mit/clients/twm/Imakefile -- Fix bad decls of malloc, realloc in gram.c.
                     59: 
                     60: mit/lib/X/Imakefile -- Make libgcc.a a required lib for libX11.so
                     61: 
                     62: *** mit/clients/twm/Imakefile  Mon May 17 22:05:22 1993
                     63: --- new/clients/twm/Imakefile  Mon May 17 22:28:46 1993
                     64: ***************
                     65: *** 32,41 ****
                     66: --- 32,48 ----
                     67:   ComplexProgramTarget(twm)
                     68:   InstallNonExecFile(system.twmrc,$(TWMDIR))
                     69:   
                     70: + #if HasGcc && GccVersion > 1 && defined (SunArchitecture)
                     71:   gram.h gram.c: gram.y
                     72:        yacc $(YFLAGS) gram.y
                     73: +      sed -e 's/^extern char \*malloc(), \*realloc();//g' y.tab.c >gram.c
                     74: +      $(MV) y.tab.h gram.h
                     75: + #else
                     76: + gram.h gram.c: gram.y
                     77: +      yacc $(YFLAGS) gram.y
                     78:        $(MV) y.tab.c gram.c
                     79:        $(MV) y.tab.h gram.h
                     80: + #endif
                     81:   
                     82:   clean::
                     83:        $(RM) y.tab.h y.tab.c lex.yy.c gram.h gram.c lex.c deftwmrc.c 
                     84: *** mit/config/Imake.tmpl      Mon May 17 22:02:57 1993
                     85: --- new/config/Imake.tmpl      Mon May 17 22:15:06 1993
                     86: ***************
                     87: *** 500,506 ****
                     88: --- 500,510 ----
                     89:   #endif
                     90:   #ifndef CcCmd
                     91:   #if HasGcc
                     92: + #if GccVersion > 1
                     93: + #define CcCmd gcc -fpcc-struct-return
                     94: + #else
                     95:   #define CcCmd gcc -fstrength-reduce -fpcc-struct-return 
                     96: + #endif
                     97:   #else
                     98:   #define CcCmd cc
                     99:   #endif
                    100: *** mit/config/site.def        Mon May 17 22:02:44 1993
                    101: --- new/config/site.def        Mon May 17 22:22:28 1993
                    102: ***************
                    103: *** 25,31 ****
                    104:   
                    105:   #ifdef BeforeVendorCF
                    106:   
                    107: ! /* #define HasGcc YES */
                    108:   
                    109:   #endif /* BeforeVendorCF */
                    110:   
                    111: --- 25,33 ----
                    112:   
                    113:   #ifdef BeforeVendorCF
                    114:   
                    115: ! #define HasGcc YES
                    116: ! /* GccVersion > 1 implies building shared libraries with gcc */
                    117: ! #define GccVersion 2
                    118:   
                    119:   #endif /* BeforeVendorCF */
                    120:   
                    121: *** mit/config/sun.cf  Mon May 17 22:03:02 1993
                    122: --- new/config/sun.cf  Mon May 17 22:24:55 1993
                    123: ***************
                    124: *** 41,49 ****
                    125: --- 41,55 ----
                    126:   
                    127:   #if HasGcc
                    128:   
                    129: + #if GccVersion > 1
                    130: + #define OptimizedCDebugFlags -O2
                    131: + #else
                    132: + #define OptimizedCDebugFlags -O
                    133:   #define SharedLibraryCcCmd cc
                    134:   #define ExtraLoadFlags -B/usr/bin/
                    135:   #define AllocateLocalDefines /**/
                    136: + #endif
                    137: + 
                    138:   
                    139:   .c.o:
                    140:        $(CC) -c $(CFLAGS) $*.c
                    141: *** mit/config/sunLib.rules    Mon May 17 22:02:46 1993
                    142: --- new/config/sunLib.rules    Mon May 17 22:19:06 1993
                    143: ***************
                    144: *** 23,29 ****
                    145: --- 23,33 ----
                    146:   #define SharedLibraryLoadFlags -assert pure-text
                    147:   #endif
                    148:   #ifndef PositionIndependentCFlags
                    149: + #if defined(HasGcc) && GccVersion > 1
                    150: + #define PositionIndependentCFlags -fpic
                    151: + #else
                    152:   #define PositionIndependentCFlags -pic
                    153: + #endif
                    154:   #endif
                    155:   
                    156:   /*
                    157: *** mit/lib/X/Imakefile        Mon May 17 22:05:03 1993
                    158: --- new/lib/X/Imakefile        Mon May 17 22:32:26 1993
                    159: ***************
                    160: *** 9,14 ****
                    161: --- 9,31 ----
                    162:   #define MotifBC NO
                    163:   #endif
                    164:   
                    165: + #if defined(SunArchitecture)
                    166: + #if SystemV4
                    167: + #if HasGcc
                    168: + REQUIREDLIBS= -lgcc -lc
                    169: + #else
                    170: + REQUIREDLIBS= -lc
                    171: + #endif
                    172: + #else
                    173: + #if HasGcc && GccVersion > 1
                    174: + XCOMM Hack to fix gcc 2 ``-nostdlib'' deficiency on SunOS 4.x
                    175: + REQUIREDLIBS= `gcc -v 2>&1 | awk '{print $$4}' | sed -e 's/specs$$/libgcc.a/'`
                    176: + #else
                    177: + REQUIREDLIBS=
                    178: + #endif
                    179: + #endif
                    180: + #endif
                    181: + 
                    182:   #ifndef BuildXimp
                    183:   #define BuildXimp NO
                    184:   #endif
                    185: *** mit/rgb/Imakefile  Mon May 17 22:05:31 1993
                    186: --- new/rgb/Imakefile  Mon May 17 22:25:30 1993
                    187: ***************
                    188: *** 17,23 ****
                    189:   #if !(defined(SGIArchitecture) || SystemV4)
                    190:          DBMLIB = -ldbm
                    191:   #endif
                    192: ! #if defined(SparcArchitecture) && HasGcc
                    193:              CC = cc
                    194:       CCOPTIONS = /**/
                    195:       EXTRA_LOAD_FLAGS = /**/
                    196: --- 17,23 ----
                    197:   #if !(defined(SGIArchitecture) || SystemV4)
                    198:          DBMLIB = -ldbm
                    199:   #endif
                    200: ! #if defined(SparcArchitecture) && HasGcc && GccVersion <= 1
                    201:              CC = cc
                    202:       CCOPTIONS = /**/
                    203:       EXTRA_LOAD_FLAGS = /**/
                    204: *** mit/server/ddx/sun/Imakefile       Mon May 17 22:05:57 1993
                    205: --- new/server/ddx/sun/Imakefile       Mon May 17 22:27:23 1993
                    206: ***************
                    207: *** 43,48 ****
                    208: --- 43,53 ----
                    209:   LinkFile(sunGX.o,sunGX.o.dist)
                    210:   #endif
                    211:   
                    212: + #if HasGcc && GccVersion > 1
                    213: + SpecialObjectRule(sunCG2C.o,sunCG2C.c,-fvolatile)
                    214: + SpecialObjectRule(sunCG2M.o,sunCG2M.c,-fvolatile)
                    215: + #endif
                    216: + 
                    217:   sunInitExtMono.o: $(ICONFIGFILES)
                    218:   ObjectFromSpecialSource(sunInitExtMono,../mi/miinitext,-UPEXEXT)
                    219:   ObjectFromSpecialSource(sunInitMono,sunInit,-DMONO_ONLY)
                    220: *** mit/server/os/Imakefile    Mon May 17 22:05:46 1993
                    221: --- new/server/os/Imakefile    Mon May 17 22:26:02 1993
                    222: ***************
                    223: *** 132,138 ****
                    224:   SpecialObjectRule(osinit.o,$(ICONFIGFILES),$(ADM_DEFINES))
                    225:   SpecialObjectRule(WaitFor.o,$(ICONFIGFILES),$(EXT_DEFINES))
                    226:   SpecialObjectRule(fonttype.o,$(ICONFIGFILES),$(FONT_DEFINES))
                    227: ! #if defined(SparcArchitecture) && HasGcc
                    228:   oscolor.o: $(ICONFIGFILES)
                    229:        $(RM) $@
                    230:        cc -c $(DBM_DEFINES) $(CDEBUGFLAGS) $(ALLDEFINES) $*.c
                    231: --- 132,138 ----
                    232:   SpecialObjectRule(osinit.o,$(ICONFIGFILES),$(ADM_DEFINES))
                    233:   SpecialObjectRule(WaitFor.o,$(ICONFIGFILES),$(EXT_DEFINES))
                    234:   SpecialObjectRule(fonttype.o,$(ICONFIGFILES),$(FONT_DEFINES))
                    235: ! #if defined(SparcArchitecture) && HasGcc && GccVersion <= 1
                    236:   oscolor.o: $(ICONFIGFILES)
                    237:        $(RM) $@
                    238:        cc -c $(DBM_DEFINES) $(CDEBUGFLAGS) $(ALLDEFINES) $*.c
                    239: 
                    240: 
                    241: [This is the older version]
                    242: 
                    243: How to compile X11R5 (patch level 11) with GCC version 2:
                    244: 
                    245: The patches include support for building the shared libraries with GCC 2 on 
                    246: the Sparc and 68k machines.
                    247: 
                    248: NOTE: Such shared libraries built with GCC version 2.3 DID NOT WORK
                    249: with executables previously linked using Sun CC!  This is because
                    250: neither those executables nor the gcc-compiled shared libraries contain
                    251: libgcc.a.  The shared libraries did work with executables linked using
                    252: GCC (running the Sun linker, of course) because GCC tells the linker to
                    253: link in libgcc.a.  Because of these limitations the default behavior is
                    254: to NOT build the shared libraries with gcc.
                    255: 
                    256: Changes in GCC 2.4 seem to have eliminated the problem, and such a
                    257: shared library now seems work with all executables.  If you want the
                    258: gcc-compiled shared libraries turn on "Gcc2BuildLibs" in site.def.  If
                    259: you try this, please tell [email protected] whether it works.
                    260: 
                    261: Sun forgot to include a static version of libdl.a with some versions
                    262: of SunOS (4.1 mainly).  If you see undefined symbols _dlopen, _dlsym,
                    263: or _dlclose when linking with -lX11, compile and link against the file
                    264: mit/util/misc/dlsym.c in the MIT X11R5 distribution.
                    265: 
                    266: mit/config/Imake.tmpl -- Do not set -fstrength-reduce if we have GCC 2.  If
                    267: -fstrength-reduce (or any other -f option) is a major win, then it will
                    268: most likely be turned on by -O2 optimization.
                    269: 
                    270: mit/config/sunLib.rules -- If HasGcc2 and Gcc2BuildLibs are defined, then 
                    271: use gcc -fpic to generate PIC code.  Make sure that gcc does not use gas (the 
                    272: GNU assembler) when compiling PIC code; gas does not assemble it correctly.  
                    273: If you have gas installed where gcc uses it by default, you might have to add
                    274: -B/bin/ to the PositionIndependentCFlags.
                    275: 
                    276: mit/config/site.def -- Define HasGcc2 to be YES.
                    277: 
                    278: mit/config/sun.cf -- When compiling with GCC 2, use -O2 optimization.
                    279: 
                    280: mit/rgb/Imakefile -- No longer need to compile some modules with 
                    281: cc on the Sparc since GCC 2 produces proper -fpcc-struct-return code.
                    282: 
                    283: mit/server/os/Imakefile -- Likewise.
                    284: 
                    285: mit/clients/twm/Imakefile -- fix bad decls of malloc, realloc in gram.c.
                    286: 
                    287: *** mit/config/Imake.tmpl.ORIG Tue Dec 31 11:07:56 1991
                    288: --- mit/config/Imake.tmpl      Tue Dec 31 12:30:47 1991
                    289: ***************
                    290: *** 499,508 ****
                    291: --- 499,512 ----
                    292:   #define HasGcc NO
                    293:   #endif
                    294:   #ifndef CcCmd
                    295: + #if HasGcc2
                    296: + #define CcCmd gcc -fpcc-struct-return
                    297: + #else
                    298:   #if HasGcc
                    299:   #define CcCmd gcc -fstrength-reduce -fpcc-struct-return 
                    300:   #else
                    301:   #define CcCmd cc
                    302: + #endif
                    303:   #endif
                    304:   #endif
                    305:   #if HasFortran
                    306: *** mit/config/sunLib.rules.ORIG       Tue Dec 31 11:11:24 1991
                    307: --- mit/config/sunLib.rules    Tue May  5 12:26:12 1992
                    308: ***************
                    309: *** 23,30 ****
                    310: --- 23,34 ----
                    311:   #define SharedLibraryLoadFlags -assert pure-text
                    312:   #endif
                    313:   #ifndef PositionIndependentCFlags
                    314: + #if defined(HasGcc2) && defined (Gcc2BuildLibs)
                    315: + #define PositionIndependentCFlags -fpic
                    316: + #else
                    317:   #define PositionIndependentCFlags -pic
                    318:   #endif
                    319: + #endif
                    320:   
                    321:   /*
                    322:    * InstallSharedLibrary - generate rules to install the shared library.
                    323: *** mit/config/site.def.ORIG   Tue Dec 31 11:13:49 1991
                    324: --- mit/config/site.def        Tue Dec 31 12:02:59 1991
                    325: ***************
                    326: *** 25,31 ****
                    327:   
                    328:   #ifdef BeforeVendorCF
                    329:   
                    330: ! /* #define HasGcc YES */
                    331:   
                    332:   #endif /* BeforeVendorCF */
                    333:   
                    334: --- 25,33 ----
                    335:   
                    336:   #ifdef BeforeVendorCF
                    337:   
                    338: ! #define HasGcc YES 
                    339: ! #define HasGcc2 YES
                    340: ! /* #define Gcc2BuildLibs YES */
                    341:   
                    342:   #endif /* BeforeVendorCF */
                    343:   
                    344: *** mit/config/sun.cf.ORIG     Tue Dec 31 11:13:57 1991
                    345: --- mit/config/sun.cf  Tue May  5 12:29:50 1992
                    346: ***************
                    347: *** 34,42 ****
                    348: --- 41,61 ----
                    349:   
                    350:   #if HasGcc
                    351:   
                    352: + #if defined(HasGcc2) 
                    353: + #define OptimizedCDebugFlags -O2 
                    354: + /* Leave Alone XXX */
                    355: + #else 
                    356: + #define OptimizedCDebugFlags -O
                    357:   #define SharedLibraryCcCmd cc
                    358:   #define ExtraLoadFlags -B/usr/bin/
                    359:   #define AllocateLocalDefines /**/
                    360: + #endif
                    361: + 
                    362: + #if !defined(Gcc2BuildLibs)
                    363: + #define SharedLibraryCcCmd cc
                    364: + #define ExtraLoadFlags -B/usr/bin/
                    365: + #define AllocateLocalDefines /**/
                    366: + #endif
                    367:   
                    368:   .c.o:
                    369:        $(CC) -c $(CFLAGS) $*.c
                    370: *** mit/rgb/Imakefile.ORIG     Wed Jan 15 16:43:18 1992
                    371: --- mit/rgb/Imakefile  Thu Jan  2 13:34:09 1992
                    372: ***************
                    373: *** 17,23 ****
                    374:   #if !(defined(SGIArchitecture) || SystemV4)
                    375:          DBMLIB = -ldbm
                    376:   #endif
                    377: ! #if defined(SparcArchitecture) && HasGcc
                    378:              CC = cc
                    379:       CCOPTIONS = /**/
                    380:       EXTRA_LOAD_FLAGS = /**/
                    381: --- 17,23 ----
                    382:   #if !(defined(SGIArchitecture) || SystemV4)
                    383:          DBMLIB = -ldbm
                    384:   #endif
                    385: ! #if defined(SparcArchitecture) && HasGcc && !defined(HasGcc2)
                    386:              CC = cc
                    387:       CCOPTIONS = /**/
                    388:       EXTRA_LOAD_FLAGS = /**/
                    389: *** mit/server/os/Imakefile.ORIG       Wed Jan 15 16:46:23 1992
                    390: --- mit/server/os/Imakefile    Wed Jan 15 16:46:48 1992
                    391: ***************
                    392: *** 132,138 ****
                    393:   SpecialObjectRule(osinit.o,$(ICONFIGFILES),$(ADM_DEFINES))
                    394:   SpecialObjectRule(WaitFor.o,$(ICONFIGFILES),$(EXT_DEFINES))
                    395:   SpecialObjectRule(fonttype.o,$(ICONFIGFILES),$(FONT_DEFINES))
                    396: ! #if defined(SparcArchitecture) && HasGcc
                    397:   oscolor.o: $(ICONFIGFILES)
                    398:        $(RM) $@
                    399:        cc -c $(DBM_DEFINES) $(CDEBUGFLAGS) $(ALLDEFINES) $*.c
                    400: --- 132,138 ----
                    401:   SpecialObjectRule(osinit.o,$(ICONFIGFILES),$(ADM_DEFINES))
                    402:   SpecialObjectRule(WaitFor.o,$(ICONFIGFILES),$(EXT_DEFINES))
                    403:   SpecialObjectRule(fonttype.o,$(ICONFIGFILES),$(FONT_DEFINES))
                    404: ! #if defined(SparcArchitecture) && HasGcc && !defined(HasGcc2)
                    405:   oscolor.o: $(ICONFIGFILES)
                    406:        $(RM) $@
                    407:        cc -c $(DBM_DEFINES) $(CDEBUGFLAGS) $(ALLDEFINES) $*.c
                    408: *** 1.1 1992/09/08 19:52:07
                    409: --- mit/server/ddx/sun/Imakefile        1992/09/08 21:10:22
                    410: ***************
                    411: *** 43,48 ****
                    412: --- 43,53 ----
                    413:   LinkFile(sunGX.o,sunGX.o.dist)
                    414:   #endif
                    415: 
                    416: + #if HasGcc2
                    417: + SpecialObjectRule(sunCG2C.o,sunCG2C.c,-fvolatile)
                    418: + SpecialObjectRule(sunCG2M.o,sunCG2M.c,-fvolatile)
                    419: + #endif
                    420: + 
                    421:   sunInitExtMono.o: $(ICONFIGFILES)
                    422:   ObjectFromSpecialSource(sunInitExtMono,../mi/miinitext,-UPEXEXT)
                    423:   ObjectFromSpecialSource(sunInitMono,sunInit,-DMONO_ONLY)
                    424: 
                    425: *** /tmp/RCSAa24446     Tue Sep 15 12:23:32 1992
                    426: --- mit/clients/twm/Imakefile   Thu Aug 13 18:18:07 1992
                    427: ***************
                    428: *** 32,41 ****
                    429: --- 32,48 ----
                    430:   ComplexProgramTarget(twm)
                    431:   InstallNonExecFile(system.twmrc,$(TWMDIR))
                    432:   
                    433: + #if HasGcc2 && defined (SunArchitecture)
                    434:   gram.h gram.c: gram.y
                    435:         yacc $(YFLAGS) gram.y
                    436: +       sed -e 's/^extern char \*malloc(), \*realloc();//g' y.tab.c >gram.c
                    437: +       $(MV) y.tab.h gram.h
                    438: + #else
                    439: + gram.h gram.c: gram.y
                    440: +       yacc $(YFLAGS) gram.y
                    441:         $(MV) y.tab.c gram.c
                    442:         $(MV) y.tab.h gram.h
                    443: + #endif
                    444:   
                    445:   clean::
                    446:         $(RM) y.tab.h y.tab.c lex.yy.c gram.h gram.c lex.c deftwmrc.c 
                    447: 

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.