home *** CD-ROM | disk | FTP | other *** search
/ OpenStep 4.2J (Developer) / os42jdev.iso / NextDeveloper / Source / GNU / gcc / README.X11 < prev    next >
INI File  |  1995-09-21  |  14KB  |  448 lines

  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.   .c.o:
  139.       $(CC) -c $(CFLAGS) $*.c
  140. *** mit/config/sunLib.rules    Mon May 17 22:02:46 1993
  141. --- new/config/sunLib.rules    Mon May 17 22:19:06 1993
  142. ***************
  143. *** 23,29 ****
  144. --- 23,33 ----
  145.   #define SharedLibraryLoadFlags -assert pure-text
  146.   #endif
  147.   #ifndef PositionIndependentCFlags
  148. + #if defined(HasGcc) && GccVersion > 1
  149. + #define PositionIndependentCFlags -fpic
  150. + #else
  151.   #define PositionIndependentCFlags -pic
  152. + #endif
  153.   #endif
  154.   
  155.   /*
  156. *** mit/lib/X/Imakefile    Mon May 17 22:05:03 1993
  157. --- new/lib/X/Imakefile    Mon May 17 22:32:26 1993
  158. ***************
  159. *** 9,14 ****
  160. --- 9,31 ----
  161.   #define MotifBC NO
  162.   #endif
  163.   
  164. + #if defined(SunArchitecture)
  165. + #if SystemV4
  166. + #if HasGcc
  167. + REQUIREDLIBS= -lgcc -lc
  168. + #else
  169. + REQUIREDLIBS= -lc
  170. + #endif
  171. + #else
  172. + #if HasGcc && GccVersion > 1
  173. + XCOMM Hack to fix gcc 2 ``-nostdlib'' deficiency on SunOS 4.x
  174. + REQUIREDLIBS= `gcc -v 2>&1 | awk '{print $$4}' | sed -e 's/specs$$/libgcc.a/'`
  175. + #else
  176. + REQUIREDLIBS=
  177. + #endif
  178. + #endif
  179. + #endif
  180.   #ifndef BuildXimp
  181.   #define BuildXimp NO
  182.   #endif
  183. *** mit/rgb/Imakefile    Mon May 17 22:05:31 1993
  184. --- new/rgb/Imakefile    Mon May 17 22:25:30 1993
  185. ***************
  186. *** 17,23 ****
  187.   #if !(defined(SGIArchitecture) || SystemV4)
  188.          DBMLIB = -ldbm
  189.   #endif
  190. ! #if defined(SparcArchitecture) && HasGcc
  191.              CC = cc
  192.       CCOPTIONS = /**/
  193.       EXTRA_LOAD_FLAGS = /**/
  194. --- 17,23 ----
  195.   #if !(defined(SGIArchitecture) || SystemV4)
  196.          DBMLIB = -ldbm
  197.   #endif
  198. ! #if defined(SparcArchitecture) && HasGcc && GccVersion <= 1
  199.              CC = cc
  200.       CCOPTIONS = /**/
  201.       EXTRA_LOAD_FLAGS = /**/
  202. *** mit/server/ddx/sun/Imakefile    Mon May 17 22:05:57 1993
  203. --- new/server/ddx/sun/Imakefile    Mon May 17 22:27:23 1993
  204. ***************
  205. *** 43,48 ****
  206. --- 43,53 ----
  207.   LinkFile(sunGX.o,sunGX.o.dist)
  208.   #endif
  209.   
  210. + #if HasGcc && GccVersion > 1
  211. + SpecialObjectRule(sunCG2C.o,sunCG2C.c,-fvolatile)
  212. + SpecialObjectRule(sunCG2M.o,sunCG2M.c,-fvolatile)
  213. + #endif
  214.   sunInitExtMono.o: $(ICONFIGFILES)
  215.   ObjectFromSpecialSource(sunInitExtMono,../mi/miinitext,-UPEXEXT)
  216.   ObjectFromSpecialSource(sunInitMono,sunInit,-DMONO_ONLY)
  217. *** mit/server/os/Imakefile    Mon May 17 22:05:46 1993
  218. --- new/server/os/Imakefile    Mon May 17 22:26:02 1993
  219. ***************
  220. *** 132,138 ****
  221.   SpecialObjectRule(osinit.o,$(ICONFIGFILES),$(ADM_DEFINES))
  222.   SpecialObjectRule(WaitFor.o,$(ICONFIGFILES),$(EXT_DEFINES))
  223.   SpecialObjectRule(fonttype.o,$(ICONFIGFILES),$(FONT_DEFINES))
  224. ! #if defined(SparcArchitecture) && HasGcc
  225.   oscolor.o: $(ICONFIGFILES)
  226.       $(RM) $@
  227.       cc -c $(DBM_DEFINES) $(CDEBUGFLAGS) $(ALLDEFINES) $*.c
  228. --- 132,138 ----
  229.   SpecialObjectRule(osinit.o,$(ICONFIGFILES),$(ADM_DEFINES))
  230.   SpecialObjectRule(WaitFor.o,$(ICONFIGFILES),$(EXT_DEFINES))
  231.   SpecialObjectRule(fonttype.o,$(ICONFIGFILES),$(FONT_DEFINES))
  232. ! #if defined(SparcArchitecture) && HasGcc && GccVersion <= 1
  233.   oscolor.o: $(ICONFIGFILES)
  234.       $(RM) $@
  235.       cc -c $(DBM_DEFINES) $(CDEBUGFLAGS) $(ALLDEFINES) $*.c
  236.  
  237.  
  238. [This is the older version]
  239.  
  240. How to compile X11R5 (patch level 11) with GCC version 2:
  241.  
  242. The patches include support for building the shared libraries with GCC 2 on 
  243. the Sparc and 68k machines.
  244.  
  245. NOTE: Such shared libraries built with GCC version 2.3 DID NOT WORK
  246. with executables previously linked using Sun CC!  This is because
  247. neither those executables nor the gcc-compiled shared libraries contain
  248. libgcc.a.  The shared libraries did work with executables linked using
  249. GCC (running the Sun linker, of course) because GCC tells the linker to
  250. link in libgcc.a.  Because of these limitations the default behavior is
  251. to NOT build the shared libraries with gcc.
  252.  
  253. Changes in GCC 2.4 seem to have eliminated the problem, and such a
  254. shared library now seems work with all executables.  If you want the
  255. gcc-compiled shared libraries turn on "Gcc2BuildLibs" in site.def.  If
  256. you try this, please tell bug-gcc@prep.ai.mit.edu whether it works.
  257.  
  258. Sun forgot to include a static version of libdl.a with some versions
  259. of SunOS (4.1 mainly).  If you see undefined symbols _dlopen, _dlsym,
  260. or _dlclose when linking with -lX11, compile and link against the file
  261. mit/util/misc/dlsym.c in the MIT X11R5 distribution.
  262.  
  263. mit/config/Imake.tmpl -- Do not set -fstrength-reduce if we have GCC 2.  If
  264. -fstrength-reduce (or any other -f option) is a major win, then it will
  265. most likely be turned on by -O2 optimization.
  266.  
  267. mit/config/sunLib.rules -- If HasGcc2 and Gcc2BuildLibs are defined, then 
  268. use gcc -fpic to generate PIC code.  Make sure that gcc does not use gas (the 
  269. GNU assembler) when compiling PIC code; gas does not assemble it correctly.  
  270. If you have gas installed where gcc uses it by default, you might have to add
  271. -B/bin/ to the PositionIndependentCFlags.
  272.  
  273. mit/config/site.def -- Define HasGcc2 to be YES.
  274.  
  275. mit/config/sun.cf -- When compiling with GCC 2, use -O2 optimization.
  276.  
  277. mit/rgb/Imakefile -- No longer need to compile some modules with 
  278. cc on the Sparc since GCC 2 produces proper -fpcc-struct-return code.
  279.  
  280. mit/server/os/Imakefile -- Likewise.
  281.  
  282. mit/clients/twm/Imakefile -- fix bad decls of malloc, realloc in gram.c.
  283.  
  284. *** mit/config/Imake.tmpl.ORIG    Tue Dec 31 11:07:56 1991
  285. --- mit/config/Imake.tmpl    Tue Dec 31 12:30:47 1991
  286. ***************
  287. *** 499,508 ****
  288. --- 499,512 ----
  289.   #define HasGcc NO
  290.   #endif
  291.   #ifndef CcCmd
  292. + #if HasGcc2
  293. + #define CcCmd gcc -fpcc-struct-return
  294. + #else
  295.   #if HasGcc
  296.   #define CcCmd gcc -fstrength-reduce -fpcc-struct-return 
  297.   #else
  298.   #define CcCmd cc
  299. + #endif
  300.   #endif
  301.   #endif
  302.   #if HasFortran
  303. *** mit/config/sunLib.rules.ORIG    Tue Dec 31 11:11:24 1991
  304. --- mit/config/sunLib.rules    Tue May  5 12:26:12 1992
  305. ***************
  306. *** 23,30 ****
  307. --- 23,34 ----
  308.   #define SharedLibraryLoadFlags -assert pure-text
  309.   #endif
  310.   #ifndef PositionIndependentCFlags
  311. + #if defined(HasGcc2) && defined (Gcc2BuildLibs)
  312. + #define PositionIndependentCFlags -fpic
  313. + #else
  314.   #define PositionIndependentCFlags -pic
  315.   #endif
  316. + #endif
  317.   
  318.   /*
  319.    * InstallSharedLibrary - generate rules to install the shared library.
  320. *** mit/config/site.def.ORIG    Tue Dec 31 11:13:49 1991
  321. --- mit/config/site.def    Tue Dec 31 12:02:59 1991
  322. ***************
  323. *** 25,31 ****
  324.   
  325.   #ifdef BeforeVendorCF
  326.   
  327. ! /* #define HasGcc YES */
  328.   
  329.   #endif /* BeforeVendorCF */
  330.   
  331. --- 25,33 ----
  332.   
  333.   #ifdef BeforeVendorCF
  334.   
  335. ! #define HasGcc YES 
  336. ! #define HasGcc2 YES
  337. ! /* #define Gcc2BuildLibs YES */
  338.   
  339.   #endif /* BeforeVendorCF */
  340.   
  341. *** mit/config/sun.cf.ORIG    Tue Dec 31 11:13:57 1991
  342. --- mit/config/sun.cf    Tue May  5 12:29:50 1992
  343. ***************
  344. *** 34,42 ****
  345. --- 41,61 ----
  346.   
  347.   #if HasGcc
  348.   
  349. + #if defined(HasGcc2) 
  350. + #define OptimizedCDebugFlags -O2 
  351. + /* Leave Alone XXX */
  352. + #else 
  353. + #define OptimizedCDebugFlags -O
  354.   #define SharedLibraryCcCmd cc
  355.   #define ExtraLoadFlags -B/usr/bin/
  356.   #define AllocateLocalDefines /**/
  357. + #endif
  358. + #if !defined(Gcc2BuildLibs)
  359. + #define SharedLibraryCcCmd cc
  360. + #define ExtraLoadFlags -B/usr/bin/
  361. + #define AllocateLocalDefines /**/
  362. + #endif
  363.   
  364.   .c.o:
  365.       $(CC) -c $(CFLAGS) $*.c
  366. *** mit/rgb/Imakefile.ORIG    Wed Jan 15 16:43:18 1992
  367. --- mit/rgb/Imakefile    Thu Jan  2 13:34:09 1992
  368. ***************
  369. *** 17,23 ****
  370.   #if !(defined(SGIArchitecture) || SystemV4)
  371.          DBMLIB = -ldbm
  372.   #endif
  373. ! #if defined(SparcArchitecture) && HasGcc
  374.              CC = cc
  375.       CCOPTIONS = /**/
  376.       EXTRA_LOAD_FLAGS = /**/
  377. --- 17,23 ----
  378.   #if !(defined(SGIArchitecture) || SystemV4)
  379.          DBMLIB = -ldbm
  380.   #endif
  381. ! #if defined(SparcArchitecture) && HasGcc && !defined(HasGcc2)
  382.              CC = cc
  383.       CCOPTIONS = /**/
  384.       EXTRA_LOAD_FLAGS = /**/
  385. *** mit/server/os/Imakefile.ORIG    Wed Jan 15 16:46:23 1992
  386. --- mit/server/os/Imakefile    Wed Jan 15 16:46:48 1992
  387. ***************
  388. *** 132,138 ****
  389.   SpecialObjectRule(osinit.o,$(ICONFIGFILES),$(ADM_DEFINES))
  390.   SpecialObjectRule(WaitFor.o,$(ICONFIGFILES),$(EXT_DEFINES))
  391.   SpecialObjectRule(fonttype.o,$(ICONFIGFILES),$(FONT_DEFINES))
  392. ! #if defined(SparcArchitecture) && HasGcc
  393.   oscolor.o: $(ICONFIGFILES)
  394.       $(RM) $@
  395.       cc -c $(DBM_DEFINES) $(CDEBUGFLAGS) $(ALLDEFINES) $*.c
  396. --- 132,138 ----
  397.   SpecialObjectRule(osinit.o,$(ICONFIGFILES),$(ADM_DEFINES))
  398.   SpecialObjectRule(WaitFor.o,$(ICONFIGFILES),$(EXT_DEFINES))
  399.   SpecialObjectRule(fonttype.o,$(ICONFIGFILES),$(FONT_DEFINES))
  400. ! #if defined(SparcArchitecture) && HasGcc && !defined(HasGcc2)
  401.   oscolor.o: $(ICONFIGFILES)
  402.       $(RM) $@
  403.       cc -c $(DBM_DEFINES) $(CDEBUGFLAGS) $(ALLDEFINES) $*.c
  404. *** 1.1 1992/09/08 19:52:07
  405. --- mit/server/ddx/sun/Imakefile        1992/09/08 21:10:22
  406. ***************
  407. *** 43,48 ****
  408. --- 43,53 ----
  409.   LinkFile(sunGX.o,sunGX.o.dist)
  410.   #endif
  411.  
  412. + #if HasGcc2
  413. + SpecialObjectRule(sunCG2C.o,sunCG2C.c,-fvolatile)
  414. + SpecialObjectRule(sunCG2M.o,sunCG2M.c,-fvolatile)
  415. + #endif
  416.   sunInitExtMono.o: $(ICONFIGFILES)
  417.   ObjectFromSpecialSource(sunInitExtMono,../mi/miinitext,-UPEXEXT)
  418.   ObjectFromSpecialSource(sunInitMono,sunInit,-DMONO_ONLY)
  419.  
  420. *** /tmp/RCSAa24446     Tue Sep 15 12:23:32 1992
  421. --- mit/clients/twm/Imakefile   Thu Aug 13 18:18:07 1992
  422. ***************
  423. *** 32,41 ****
  424. --- 32,48 ----
  425.   ComplexProgramTarget(twm)
  426.   InstallNonExecFile(system.twmrc,$(TWMDIR))
  427.   
  428. + #if HasGcc2 && defined (SunArchitecture)
  429.   gram.h gram.c: gram.y
  430.         yacc $(YFLAGS) gram.y
  431. +       sed -e 's/^extern char \*malloc(), \*realloc();//g' y.tab.c >gram.c
  432. +       $(MV) y.tab.h gram.h
  433. + #else
  434. + gram.h gram.c: gram.y
  435. +       yacc $(YFLAGS) gram.y
  436.         $(MV) y.tab.c gram.c
  437.         $(MV) y.tab.h gram.h
  438. + #endif
  439.   
  440.   clean::
  441.         $(RM) y.tab.h y.tab.c lex.yy.c gram.h gram.c lex.c deftwmrc.c 
  442.  
  443.