home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Professional / OS2PRO194.ISO / os2 / prgramer / unix / info / gcc.i04 (.txt) < prev    next >
GNU Info File  |  1993-06-12  |  51KB  |  846 lines

  1. This is Info file gcc.info, produced by Makeinfo-1.47 from the input
  2. file gcc.tex.
  3.    This file documents the use and the internals of the GNU compiler.
  4.    Copyright (C) 1988, 1989, 1992 Free Software Foundation, Inc.
  5.    Permission is granted to make and distribute verbatim copies of this
  6. manual provided the copyright notice and this permission notice are
  7. preserved on all copies.
  8.    Permission is granted to copy and distribute modified versions of
  9. this manual under the conditions for verbatim copying, provided also
  10. that the sections entitled "GNU General Public License" and "Protect
  11. Your Freedom--Fight `Look And Feel'" are included exactly as in the
  12. original, and provided that the entire resulting derived work is
  13. distributed under the terms of a permission notice identical to this
  14.    Permission is granted to copy and distribute translations of this
  15. manual into another language, under the above conditions for modified
  16. versions, except that the sections entitled "GNU General Public
  17. License" and "Protect Your Freedom--Fight `Look And Feel'", and this
  18. permission notice, may be included in translations approved by the Free
  19. Software Foundation instead of in the original English.
  20. File: gcc.info,  Node: Environment Variables,  Next: Running Protoize,  Prev: Code Gen Options,  Up: Invoking GCC
  21. Environment Variables Affecting GNU CC
  22. ======================================
  23.    This section describes several environment variables that affect how
  24. GNU CC operates.  They work by specifying directories or prefixes to use
  25. when searching for various kinds of files.
  26.    Note that you can also specify places to search using options such as
  27. `-B', `-I' and `-L' (*note Directory Options::.).  These take
  28. precedence over places specified using environment variables, which in
  29. turn take precedence over those specified by the configuration of GNU
  30. CC.  *Note Driver::.
  31. `TMPDIR'
  32.      If `TMPDIR' is set, it specifies the directory to use for temporary
  33.      files.  GNU CC uses temporary files to hold the output of one
  34.      stage of compilation which is to be used as input to the next
  35.      stage: for example, the output of the preprocessor, which is the
  36.      input to the compiler proper.
  37. `GCC_EXEC_PREFIX'
  38.      If `GCC_EXEC_PREFIX' is set, it specifies a prefix to use in the
  39.      names of the subprograms executed by the compiler.  No slash is
  40.      added when this prefix is combined with the name of a subprogram,
  41.      but you can specify a prefix that ends with a slash if you wish.
  42.      If GNU CC cannot find the subprogram using the specified prefix, it
  43.      tries looking in the usual places for the subprogram.
  44.      Other prefixes specified with `-B' take precedence over this
  45.      prefix.
  46.      This prefix is also used for finding files such as `crt0.o' that
  47.      are used for linking.
  48.      In addition, the prefix is used in an unusual way in finding the
  49.      directories to search for header files.  For each of the standard
  50.      directories whose name normally begins with
  51.      `/usr/local/lib/gcc-lib' (more precisely, with the value of
  52.      `GCC_INCLUDE_DIR'), GNU CC tries replacing that beginning with the
  53.      specified prefix to produce an alternate directory name.  Thus,
  54.      with `-Bfoo/', GNU CC will search `foo/bar' where it would
  55.      normally search `/usr/local/lib/bar'. These alternate directories
  56.      are searched first; the standard directories come next.
  57. `COMPILER_PATH'
  58.      The value of `COMPILER_PATH' is a colon-separated list of
  59.      directories, much like `PATH'.  GNU CC tries the directories thus
  60.      specified when searching for subprograms, if it can't find the
  61.      subprograms using `GCC_EXEC_PREFIX'.
  62. `LIBRARY_PATH'
  63.      The value of `LIBRARY_PATH' is a colon-separated list of
  64.      directories, much like `PATH'.  GNU CC tries the directories thus
  65.      specified when searching for special linker files, if it can't
  66.      find them using `GCC_EXEC_PREFIX'.  Linking using GNU CC also uses
  67.      these directories when searching for ordinary libraries for the
  68.      `-l' option (but directories specified with `-L' come first).
  69. `C_INCLUDE_PATH'
  70. `CPLUS_INCLUDE_PATH'
  71. `OBJC_INCLUDE_PATH'
  72.      These environment variables pertain to particular languages.  Each
  73.      variable's value is a colon-separated list of directories, much
  74.      like `PATH'.  When GNU CC searches for header files, it tries the
  75.      directories listed in the variable for the language you are using,
  76.      after the directories specified with `-I' but before the standard
  77.      header file directories.
  78. `DEPENDENCIES_OUTPUT'
  79.      If this variable is set, its value specifies how to output
  80.      dependencies for Make based on the header files processed by the
  81.      compiler.  This output looks much like the output from the `-M'
  82.      option (*note Preprocessor Options::.), but it goes to a separate
  83.      file, and is in addition to the usual results of compilation.
  84.      The value of `DEPENDENCIES_OUTPUT' can be just a file name, in
  85.      which case the Make rules are written to that file, guessing the
  86.      target name from the source file name.  Or the value can have the
  87.      form `FILE TARGET', in which case the rules are written to file
  88.      FILE using TARGET as the target name.
  89. File: gcc.info,  Node: Running Protoize,  Prev: Environment Variables,  Up: Invoking GCC
  90. Running Protoize
  91. ================
  92.    The program `protoize' is an optional part of GNU C.  You can use it
  93. to add prototypes to a program, thus converting the program to ANSI C
  94. in one respect.  The companion program `unprotoize' does the reverse:
  95. it removes argument types from any prototypes that are found.
  96.    When you run these programs, you must specify a set of source files
  97. as command line arguments.  The conversion programs start out by
  98. compiling these files to see what functions they define.  The
  99. information gathered about a file FOO is saved in a file named `FOO.X'.
  100.    After scanning comes actual conversion.  The specified files are all
  101. eligible to be converted; any files they include (whether sources or
  102. just headers) are eligible as well.
  103.    But not all the eligible files are converted.  By default,
  104. `protoize' and `unprotoize' convert only source and header files in the
  105. current directory.  You can specify additional directories whose files
  106. should be converted with the `-d DIRECTORY' option.  You can also
  107. specify particular files to exclude with the `-x FILE' option.  A file
  108. is converted if it is eligible, its directory name matches one of the
  109. specified directory names, and its name within the directory has not
  110. been excluded.
  111.    Basic conversion with `protoize' consists of rewriting most function
  112. definitions and function declarations to specify the types of the
  113. arguments.  The only ones not rewritten are those for varargs functions.
  114.    `protoize' optionally inserts prototype declarations at the
  115. beginning of the source file, to make them available for any calls that
  116. precede the function's definition.  Or it can insert prototype
  117. declarations with block scope in the blocks where undeclared functions
  118. are called.
  119.    Basic conversion with `unprotoize' consists of rewriting most
  120. function declarations to remove any argument types, and rewriting
  121. function definitions to the old-style pre-ANSI form.
  122.    Both conversion programs print a warning for any function
  123. declaration or definition that they can't convert.  You can suppress
  124. these warnings with `-q'.
  125.    The output from `protoize' or `unprotoize' replaces the original
  126. source file.  The original file is renamed to a name ending with
  127. `.save'.  If the `.save' file already exists, then the source file is
  128. simply discarded.
  129.    `protoize' and `unprotoize' both depend on GNU CC itself to scan the
  130. program and collect information about the functions it uses. So neither
  131. of these programs will work until GNU CC is installed.
  132.    Here is a table of the options you can use with `protoize' and
  133. `unprotoize'.  Each option works with both programs unless otherwise
  134. stated.
  135. `-B DIRECTORY'
  136.      Look for the file `SYSCALLS.c.X' in DIRECTORY, instead of the
  137.      usual directory (normally `/usr/local/lib').  This file contains
  138.      prototype information about standard system functions.  This option
  139.      applies only to `protoize'.
  140. `-c COMPILATION-OPTIONS'
  141.      Use  COMPILATION-OPTIONS as the options when running `gcc' to
  142.      produce the `.X' files.  The special option `-aux-info' is always
  143.      passed in addition, to tell `gcc' to write a `.X' file.
  144.      Note that the compilation options must be given as a single
  145.      argument to `protoize' or `unprotoize'.  If you want to specify
  146.      several `gcc' options, you must quote the entire set of
  147.      compilation options to make them a single word in the shell.
  148.      There are certain `gcc' arguments that you cannot use, because they
  149.      would produce the wrong kind of output.  These include `-g', `-O',
  150.      `-c', `-S', and `-o' If you include these in the
  151.      COMPILATION-OPTIONS, they are ignored.
  152.      Rename files to end in `.C' instead of `.c'. This is convenient if
  153.      you are converting a C program to C++. This option applies only to
  154.      `protoize'.
  155.      Add explicit global declarations.  This means inserting explicit
  156.      declarations at the beginning of each source file for each function
  157.      that is called in the file and was not declared.  These
  158.      declarations precede the first function definition that contains a
  159.      call to an undeclared function.  This option applies only to
  160.      `protoize'.
  161. `-i STRING'
  162.      Indent old-style parameter declarations with the string STRING.
  163.      This option applies only to `protoize'.
  164.      `unprotoize' converts prototyped function definitions to old-style
  165.      function definitions, where the arguments are declared between the
  166.      argument list and the initial `{'.  By default, `unprotoize' uses
  167.      five spaces as the indentation.  If you want to indent with just
  168.      one space instead, use `-i " "'.
  169.      Keep the `.X' files.  Normally, they are deleted after conversion
  170.      is finished.
  171.      Add explicit local declarations.  `protoize' with `-l' inserts a
  172.      prototype declaration for each function in each block which calls
  173.      the function without any declaration.  This option applies only to
  174.      `protoize'.
  175.      Make no real changes.  This mode just prints information about the
  176.      conversions that would have been done without `-n'.
  177.      Make no `.save' files.  The original files are simply deleted. Use
  178.      this option with caution.
  179. `-p PROGRAM'
  180.      Use the program PROGRAM as the compiler.  Normally, the name `gcc'
  181.      is used.
  182.      Work quietly.  Most warnings are suppressed.
  183.      Print the version number, just like `-v' for `gcc'.
  184.    If you need special compiler options to compile one of your program's
  185. source files, then you should generate that file's `.X' file specially,
  186. by running `gcc' on that source file with the appropriate options and
  187. the option `-aux-info'.  Then run `protoize' on the entire set of
  188. files.  `protoize' will use the existing `.X' file because it is newer
  189. than the source file. For example:
  190.      gcc -Dfoo=bar file1.c -aux-info
  191.      protoize *.c
  192. You need to include the special files along with the rest in the
  193. `protoize' command, even though their `.X' files already exist, because
  194. otherwise they won't get converted.
  195.    *Note Protoize Caveats::, for more information on how to use
  196. `protoize' successfully.
  197. File: gcc.info,  Node: Installation,  Next: Extensions,  Prev: Invoking GCC,  Up: Top
  198. Installing GNU CC
  199. *****************
  200.    Here is the procedure for installing GNU CC on a Unix system.
  201. * Menu:
  202. * Other Dir::     Compiling in a separate directory (not where the source is).
  203. * Cross-Compiler::   Building and installing a cross-compiler.
  204. * PA Install::    See below for installation on the HP Precision Architecture.
  205. * Sun Install::   See below for installation on the Sun.
  206. * 3b1 Install::   See below for installation on the 3b1.
  207. * Unos Install::  See below for installation on Unos (from CRDS).
  208. * VMS Install::   See below for installation on VMS.
  209. * WE32K Install:: See below for installation on the 3b* aside from the 3b1.
  210. * MIPS Install::  See below for installation on the MIPS Architecture.
  211.   1. If you have built GNU CC previously in the same directory for a
  212.      different target machine, do `make distclean' to delete all files
  213.      that might be invalid.  One of the files this deletes is
  214.      `Makefile'; if `make distclean' complains that `Makefile' does not
  215.      exist, it probably means that the directory is already suitably
  216.      clean.
  217.   2. On a System V release 4 system, make sure `/usr/bin' precedes
  218.      `/usr/ucb' in `PATH'.  The `cc' command in `/usr/ucb' uses
  219.      libraries which have bugs.
  220.   3. Specify the host and target machine configurations.  You do this by
  221.      running the file `configure' with appropriate arguments.
  222.      If you are building a compiler to produce code for the machine it
  223.      runs on, specify just one machine type.  Use the `--target'
  224.      option; the host type will default to be the same as the target. 
  225.      (For information on building a cross-compiler, see *Note
  226.      Cross-Compiler::.)  The command looks like this:
  227.           configure --target=sparc-sun-sunos4.1
  228.      A configuration name may be canonical or it may be more or less
  229.      abbreviated.
  230.      A canonical configuration name has three parts, separated by
  231.      dashes. It looks like this: `CPU-COMPANY-SYSTEM'. (The three parts
  232.      may themselves contain dashes; `configure' can figure out which
  233.      dashes serve which purpose.)  For example, `m68k-sun-sunos4.1'
  234.      specifies a Sun 3.
  235.      You can also replace parts of the configuration by nicknames or
  236.      aliases. For example, `sun3' stands for `m68k-sun', so
  237.      `sun3-sunos4.1' is another way to specify a Sun 3.  You can also
  238.      use simply `sun3-sunos', since the version of SunOS is assumed by
  239.      default to be version 4.  `sun3-bsd' also works, since `configure'
  240.      knows that the only BSD variant on a Sun 3 is SunOS.
  241.      You can specify a version number after any of the system types,
  242.      and some of the CPU types.  In most cases, the version is
  243.      irrelevant, and will be ignored.  So you might as well specify the
  244.      version if you know it.
  245.      Here are the possible CPU types:
  246.           a29k, alpha, arm, cN, elxsi, hppa1.0, hppa1.1, i386, i860,
  247.           i960, m68000, m68k, m88k, mips, ns32k, pyramid, romp, rs6000,
  248.           sparc, vax, we32k.
  249.      Here are the recognized company names.  As you can see, customary
  250.      abbreviations are used rather than the longer official names.
  251.           alliant, altos, apollo, att, cbm, convergent, convex, crds,
  252.           dec, dg, encore, harris, hp, ibm, mips, motorola, ncr, next,
  253.           ns, omron, sequent, sgi, sony, sun, tti, unicom.
  254.      The company name is meaningful only to disambiguate when the rest
  255.      of the information supplied is insufficient.  You can omit it,
  256.      writing just `CPU-SYSTEM', if it is not needed.  For example,
  257.      `vax-ultrix4.2' is equivalent to `vax-dec-ultrix4.2'.
  258.      Here is a list of system types:
  259.           aix, aos, bsd, ctix, dgux, dynix, genix, hpux, isc, linux,
  260.           luna, mach, minix, newsos, osf, osfrose, riscos, sco, sunos,
  261.           sysv, ultrix, unos, vms.
  262.      You can omit the system type; then `configure' guesses the
  263.      operating system from the CPU and company.
  264.      You can add a version number to the system type; this may or may
  265.      not make a difference.  For example, you can write `bsd4.3' or
  266.      `bsd4.4' to distinguish versions of BSD.  In practice, the version
  267.      number is most needed for `sysv3' and `sysv4', which are often
  268.      treated differently.
  269.      If you specify an impossible combination such as `i860-dg-vms',
  270.      then you may get an error message from `configure', or it may
  271.      ignore part of the information and do the best it can with the
  272.      rest. `configure' always prints the canonical name for the
  273.      alternative that it used.
  274.      Often a particular model of machine has a name.  Many machine
  275.      names are recognized as aliases for CPU/company combinations. 
  276.      Thus, the machine name `sun3', mentioned above, is an alias for
  277.      `m68k-sun'. Sometimes we accept a company name as a machine name,
  278.      when the name is popularly used for a particular machine.  Here is
  279.      a table of the known machine names:
  280.           3300, 3b1, 3bN, 7300, altos3068, altos, apollo68, att-7300,
  281.           balance, convex-cN, crds, decstation-3100, decstation, delta,
  282.           encore, fx2800, gmicro, hp7NN, hp8NN, hp9k2NN, hp9k3NN,
  283.           hp9k7NN, hp9k8NN, iris4d, iris, isi68, m3230, magnum, merlin,
  284.           miniframe, mmax, news-3600, news800, news, next, pbd, pc532,
  285.           pmax, ps2, risc-news, rtpc, sun2, sun386i, sun386, sun3,
  286.           sun4, symmetry, tower-32, tower.
  287.      Remember that a machine name specifies both the cpu type and the
  288.      company name.
  289.      There are four additional options you can specify independently to
  290.      describe variant hardware and software configurations.  These are
  291.      `--with-gnu-as', `--with-gnu-ld', `--with-stabs' and `--nfp'.
  292.     `--with-gnu-as'
  293.           On certain systems, you must specify whether you want GNU CC
  294.           to work with the usual compilation tools or with the GNU
  295.           compilation tools (including GAS).  Use the `--with-gnu-as'
  296.           argument when you run `configure', if you want to use the GNU
  297.           tools.  (Specify `--with-gnu-ld' as well, since on these
  298.           systems GAS works only with the GNU linker.)  The systems
  299.           where this makes a difference are `i386-ANYTHING-sysv',
  300.           `i860-ANYTHING-bsd', `m68k-hp-hpux', `m68k-sony-bsd',
  301.           `m68k-altos-sysv', `m68000-hp-hpux', and `m68000-att-sysv'. 
  302.           On any other system, `--with-gnu-as' has no effect.
  303.     `--with-gnu-ld'
  304.           Specify the option `--with-gnu-ld' if you plan to use the GNU
  305.           linker.  This inhibits the installation of `collect2', a
  306.           program which otherwise serves as a front-end for the
  307.           system's linker on most configurations.
  308.     `--with-stabs'
  309.           On MIPS based systems, you must specify whether you want GNU
  310.           CC to create the normal ECOFF debugging format, or to use
  311.           BSD-style stabs passed through the ECOFF symbol table.  The
  312.           normal ECOFF debug format cannot fully handle languages other
  313.           than C.  BSD stabs format can handle other languages, but it
  314.           only works with the GNU debugger GDB.
  315.           Normally, GNU CC uses the ECOFF debugging format by default;
  316.           if you prefer BSD stabs, specify `--with-stabs' when you
  317.           configure GNU CC.
  318.           No matter which default you choose when you configure GNU CC,
  319.           the user can use the `-gcoff' and `-gstabs+' options to
  320.           specify explicitly the debug format for a particular
  321.           compilation.
  322.     `--nfp'
  323.           On certain systems, you must specify whether the machine has
  324.           a floating point unit.  These systems are `m68k-sun-sunosN'
  325.           and `m68k-isi-bsd'.  On any other system, `--nfp' currently
  326.           has no effect, though perhaps there are other systems where
  327.           it could usefully make a difference.
  328.      If you want to install your own homemade configuration files, you
  329.      can use `local' as the company name to access them.  If you use
  330.      configuration `CPU-local', the entire configuration name is used
  331.      to form the configuration file names.
  332.      Thus, if you specify `m68k-local', then the files used are
  333.      `m68k-local.md', `m68k-local.h', `m68k-local.c',
  334.      `xm-m68k-local.h', `t-m68k-local', and `x-m68k-local'.
  335.      Here is a list of configurations that have special treatment or
  336.      special things you must know:
  337.     `alpha-*-osf1'
  338.           Systems using processors that implement the DEC Alpha
  339.           architecture and are running the OSF/1 operating system. (VMS
  340.           on the Alpha is not currently supported by GNU CC.)  As of
  341.           this writing, the only Alpha-based product currently
  342.           available from DEC is the 21064 (EV4) processor chip; no
  343.           system-level products can be ordered.  This port is provided
  344.           for those developers who might have early Alpha hardware from
  345.           DEC or other vendors and run the OSF/1 operating system.  It
  346.           has not been extensively tested and both the C++ and
  347.           Objective-C languages may not work, except in a
  348.           cross-compilation environment.
  349.           The `ASSEMBLE_FILE_START' macro writes a `.verstamp' directive
  350.           containing the version of the calling sequence.  Currently,
  351.           we use `9 0', which we believe will work until the official
  352.           release by DEC of their system, at which point `3 11' is the
  353.           correct value.  If you get a mismatch error from the
  354.           assembler on a `.verstamp' line, consult the file
  355.           `/usr/include/stamp.h' for the present value.  GNU C on the
  356.           Alpha does not support versions of DEC's OSF/1 earlier than
  357.           BL9; if you are running an older version, we suggest you ask
  358.           your DEC contact for an update.
  359.           Note that since the Alpha is a 64-bit architecture,
  360.           cross-compilers from 32-bit machines will not generate as
  361.           efficient code as that generated when the compiler is running
  362.           on a 64-bit machine because many optimizations that depend on
  363.           being able to represent a word on the target in an integral
  364.           value on the host cannot be performed.
  365.     `a29k'
  366.           AMD Am29K-family processors.  These are normally used in
  367.           embedded applications.  There are no standard Unix
  368.           configurations. This configuration corresponds to AMD's
  369.           standard calling sequence and binary interface and is
  370.           compatible with other 29K tools.
  371.           You may need to make a variant of the file `a29k.h' for your
  372.           particular configuration.
  373.     `a29k-*-bsd'
  374.           AMD Am29050 used in a system running a variant of BSD Unix.
  375.     `elxsi-elxsi-bsd'
  376.           The Elxsi's C compiler has known limitations that prevent it
  377.           from compiling GNU C.  Please contact `mrs@cygnus.com' for
  378.           more details.
  379.     `i386-*-sco'
  380.           Compilation with RCC is recommended.
  381.     `i386-ibm-aix'
  382.           You need a version of GAS that you can get from
  383.           `tranle@intellicorp.com'.
  384.     `i386-sequent'
  385.           Go to the Berkeley universe before compiling.  In addition,
  386.           you probably need to create a file named `string.h'
  387.           containing just one line: `#include <strings.h>'.
  388.     `i386-sun-sunos4'
  389.           You may find that you need another version of GNU CC to begin
  390.           bootstrapping with, since the current version when built with
  391.           the system's own compiler seems to get an infinite loop
  392.           compiling part of `libgcc2.c'.  GNU CC version 2 compiled
  393.           with GNU CC (any version) seems not to have this problem.
  394.     `m68000-att'
  395.           AT&T 3b1, a.k.a. 7300 PC.  Special procedures are needed to
  396.           compile GNU CC with this machine's standard C compiler, due
  397.           to bugs in that compiler.  *Note 3b1 Install::.  You can
  398.           bootstrap it more easily with previous versions of GNU CC if
  399.           you have them.
  400.     `m68000-hp-bsd'
  401.           HP 9000 series 200 running BSD.  Note that the C compiler
  402.           that comes with this system cannot compile GNU CC; contact
  403.           `law@cs.utah.edu' to get binaries of GNU CC for bootstrapping.
  404.     `m68k-altos'
  405.           Altos 3068.  You must use the GNU assembler, linker and
  406.           debugger, with COFF-encapsulation.  Also, you must fix a
  407.           kernel bug.  Details in the file `README.ALTOS'.
  408.     `m68k-hp-hpux'
  409.           HP 9000 series 300 or 400 running HP-UX.  HP-UX version 8.0
  410.           has a bug in the assembler that prevents compilation of GNU
  411.           CC.  To fix it, get patch PHCO_0800 from HP.
  412.           In addition, `--gas' does not currently work with this
  413.           configuration.  Changes in HP-UX have broken the library
  414.           conversion tool and the linker.
  415.     `m68k-sun'
  416.           Sun 3.  We do not provide a configuration file to use the Sun
  417.           FPA by default, because programs that establish signal
  418.           handlers for floating point traps inherently cannot work with
  419.           the FPA.
  420.     `m88k-svr3'
  421.           Motorola m88k running the AT&T/Unisoft/Motorola V.3 reference
  422.           port. These systems tend to use the Green Hills C, revision
  423.           1.8.5, as the standard C compiler.  There are apparently bugs
  424.           in this compiler that result in object files differences
  425.           between stage 2 and stage 3.  If this happens, make the stage
  426.           4 compiler and compare it to the stage 3 compiler.  If the
  427.           stage 3 and stage 4 object files are identical, this suggests
  428.           a problem with the standard C compiler.  It is best, however,
  429.           to use an older version of GNU CC for bootstrapping.
  430.     `m88k-dgux'
  431.           Motorola m88k running DG/UX.  To build native or cross
  432.           compilers on DG/UX, you must first change to the 88open BCS
  433.           software development environment.  This is done by issuing
  434.           this command:
  435.                eval `sde-target m88kbcs`
  436.     `mips-mips-bsd'
  437.           MIPS machines running the MIPS operating system in BSD mode. 
  438.           It's possible that some old versions of the system lack the
  439.           functions `memcpy', `memcmp', and `memset'.  If your system
  440.           lacks these, you must remove or undo the definition of
  441.           `TARGET_MEM_FUNCTIONS' in `mips-bsd.h'.
  442.     `mips-sony-sysv'
  443.           Sony MIPS NEWS.  This works in NEWSOS 5.0.1, but not in 5.0.2
  444.           (which uses ELF instead of COFF).  Support for 5.0.2 will
  445.           probably be provided soon by volunteers.
  446.     `ns32k-encore'
  447.           Encore ns32000 system.  Encore systems are supported only
  448.           under BSD.
  449.     `ns32k-*-genix'
  450.           National Semiconductor ns32000 system.  Genix has bugs in
  451.           `alloca' and `malloc'; you must get the compiled versions of
  452.           these from GNU Emacs.
  453.     `ns32k-sequent'
  454.           Go to the Berkeley universe before compiling.  In addition,
  455.           you probably need to create a file named `string.h'
  456.           containing just one line: `#include <strings.h>'.
  457.     `ns32k-utek'
  458.           UTEK ns32000 system ("merlin").  The C compiler that comes
  459.           with this system cannot compile GNU CC; contact
  460.           `tektronix!reed!mason' to get binaries of GNU CC for
  461.           bootstrapping.
  462.     `romp-*-aos'
  463.     `romp-*-mach'
  464.           The only operating systems supported for the IBM RT PC are
  465.           AOS and MACH.  GNU CC does not support AIX running on the RT.
  466.            We recommend you compile GNU CC with an earlier version of
  467.           itself; if you compile GNU CC with `hc', the Metaware
  468.           compiler, it will work, but you will get mismatches between
  469.           the stage 2 and stage 3 compilers in various files. These
  470.           errors are minor differences in some floating-point constants
  471.           and can be safely ignored; the stage 3 compiler is correct.
  472.     `rs6000-*-aix'
  473.           *Read the file `README.RS6000' for information on how to get
  474.           a fix for a problem in the IBM assembler that prevents use of
  475.           GNU CC.* You must either obtain the new assembler or avoid
  476.           using the `-g' switch.  Note that `Makefile.in' uses `-g' by
  477.           default when compiling `libgcc2.c'.
  478.     `vax-dec-ultrix'
  479.           Don't try compiling with Vax C (`vcc').  It produces
  480.           incorrect code in some cases (for example, when `alloca' is
  481.           used).
  482.           Meanwhile, compiling `cp-parse.c' with pcc does not work
  483.           because of an internal table size limitation in that
  484.           compiler.  To avoid this problem, compile just the GNU C
  485.           compiler first, and use it to recompile building all the
  486.           languages that you want to run.
  487.      Here we spell out what files will be set up by `configure'. 
  488.      Normally you need not be concerned with these files.
  489.         * A symbolic link named `config.h' is made to the top-level
  490.           config file for the machine you will run the compiler on
  491.           (*note Config::.). This file is responsible for defining
  492.           information about the host machine.  It includes `tm.h'.
  493.           The top-level config file is located in the subdirectory
  494.           `config'. Its name is always `xm-SOMETHING.h'; usually
  495.           `xm-MACHINE.h', but there are some exceptions.
  496.           If your system does not support symbolic links, you might
  497.           want to set up `config.h' to contain a `#include' command
  498.           which refers to the appropriate file.
  499.         * A symbolic link named `tconfig.h' is made to the top-level
  500.           config file for your target machine.  This is used for
  501.           compiling certain programs to run on that machine.
  502.         * A symbolic link named `tm.h' is made to the
  503.           machine-description macro file for your target machine.  It
  504.           should be in the subdirectory `config' and its name is often
  505.           `MACHINE.h'.
  506.         * A symbolic link named `md' will be made to the machine
  507.           description pattern file.  It should be in the `config'
  508.           subdirectory and its name should be `MACHINE.md'; but MACHINE
  509.           is often not the same as the name used in the `tm.h' file
  510.           because the `md' files are more general.
  511.         * A symbolic link named `aux-output.c' will be made to the
  512.           output subroutine file for your machine.  It should be in the
  513.           `config' subdirectory and its name should be `MACHINE.c'.
  514.         * The command file `configure' also constructs `Makefile' by
  515.           adding some text to the template file `Makefile.in'.  The
  516.           additional text comes from files in the `config' directory,
  517.           named `t-TARGET' and `h-HOST'.  If these files do not exist,
  518.           it means nothing needs to be added for a given target or host.
  519.   4. Make sure the Bison parser generator is installed.  (This is
  520.      unnecessary if the Bison output files `c-parse.c' and `cexp.c' are
  521.      more recent than `c-parse.y' and `cexp.y' and you do not plan to
  522.      change the `.y' files.)
  523.      Bison versions older than Sept 8, 1988 will produce incorrect
  524.      output for `c-parse.c'.
  525.   5. Build the compiler.  Just type `make LANGUAGES=c' in the compiler
  526.      directory.
  527.      `LANGUAGES=c' specifies that only the C compiler should be
  528.      compiled.  The makefile normally builds compilers for all the
  529.      supported languages; currently, C, C++ and Objective C.  However,
  530.      C is the only language that is sure to work when you build with
  531.      other non-GNU C compilers.  In addition, building anything but C
  532.      at this stage is a waste of time.
  533.      In general, you can specify the languages to build by typing the
  534.      argument `LANGUAGES="LIST"', where LIST is one or more words from
  535.      the list `c', `c++', and `objective-c'.
  536.      Ignore any warnings you may see about "statement not reached" in
  537.      `insn-emit.c'; they are normal.  Any other compilation errors may
  538.      represent bugs in the port to your machine or operating system, and
  539.      should be investigated and reported (*note Bugs::.).
  540.      Some commercial compilers fail to compile GNU CC because they have
  541.      bugs or limitations.  For example, the Microsoft compiler is said
  542.      to run out of macro space.  Some Ultrix compilers run out of
  543.      expression space; then you need to break up the statement where
  544.      the problem happens.
  545.      If you are building with a previous GNU C compiler, do not use
  546.      `CC=gcc' on the make command or by editing the Makefile. Instead,
  547.      use a full pathname to specify the compiler, such as
  548.      `CC=/usr/local/bin/gcc'.  This is because make might execute the
  549.      `gcc' in the current directory before all of the compiler
  550.      components have been built.
  551.   6. If you are using COFF-encapsulation, you must convert `libgcc.a' to
  552.      a GNU-format library at this point.  See the file `README.ENCAP'
  553.      in the directory containing the GNU binary file utilities, for
  554.      directions.
  555.   7. If you are building a cross-compiler, stop here.  *Note
  556.      Cross-Compiler::.
  557.   8. Move the first-stage object files and executables into a
  558.      subdirectory with this command:
  559.           make stage1
  560.      The files are moved into a subdirectory named `stage1'. Once
  561.      installation is complete, you may wish to delete these files with
  562.      `rm -r stage1'.
  563.   9. Recompile the compiler with itself, with this command:
  564.           make CC="stage1/xgcc -Bstage1/" CFLAGS="-g -O"
  565.      This is called making the stage 2 compiler.
  566.      The command shown above builds compilers for all the supported
  567.      languages.  If you don't want them all, you can specify the
  568.      languages to build by typing the argument `LANGUAGES="LIST"'.  LIST
  569.      should contain one or more words from the list `c', `c++',
  570.      `objective-c', and `proto'.  Separate the words with spaces.
  571.      `proto' stands for the programs `protoize' and `unprotoize'; they
  572.      are not a separate language, but you use `LANGUAGES' to enable or
  573.      disable their installation.
  574.      If you are going to build the stage 3 compiler, then you might
  575.      want to build only the C language in stage 2.
  576.      Once you have built the stage 2 compiler, if you are short of disk
  577.      space, you can delete the subdirectory `stage1'.
  578.      On a 68000 or 68020 system lacking floating point hardware, unless
  579.      you have selected a `tm.h' file that expects by default that there
  580.      is no such hardware, do this instead:
  581.           make CC="stage1/xgcc -Bstage1/" CFLAGS="-g -O -msoft-float"
  582.  10. If you wish to test the compiler by compiling it with itself one
  583.      more time, do this:
  584.           make stage2
  585.           make CC="stage2/xgcc -Bstage2/" CFLAGS="-g -O"
  586.      This is called making the stage 3 compiler.  Aside from the `-B'
  587.      option, the compiler options should be the same as when you made
  588.      the stage 2 compiler.  But the `LANGUAGES' option need not be the
  589.      same.  The command shown above builds compilers for all the
  590.      supported languages; if you don't want them all, you can specify
  591.      the languages to build by typing the argument `LANGUAGES="LIST"',
  592.      as described above.
  593.      Then compare the latest object files with the stage 2 object
  594.      files--they ought to be identical, unless they contain time stamps.
  595.      You can compare the files, disregarding the time stamps if any,
  596.      like this:
  597.           make compare
  598.      This will mention any object files that differ between stage 2 and
  599.      stage 3.  Any difference, no matter how innocuous, indicates that
  600.      the stage 2 compiler has compiled GNU CC incorrectly, and is
  601.      therefore a potentially serious bug which you should investigate
  602.      and report (*note Bugs::.).
  603.      If your system does not put time stamps in the object files, then
  604.      this is a faster way to compare them (using the Bourne shell):
  605.           for file in *.o; do
  606.           cmp $file stage2/$file
  607.           done
  608.      If you have built the compiler with the `-mno-mips-tfile' option on
  609.      MIPS machines, you will not be able to compare the files.
  610.  11. Install the compiler driver, the compiler's passes and run-time
  611.      support. You can use the following command:
  612.           make install CC="stage2/xgcc -Bstage2/" CFLAGS="-g -O" LANGUAGES="LIST"
  613.      (Use the same value for `CC', `CFLAGS' and `LANGUAGES' that you
  614.      used when compiling the files that are being installed.  One
  615.      reason this is necessary is that some versions of Make have bugs
  616.      and recompile files gratuitously when you do this step.  If you
  617.      use the same variable values, those files will be recompiled
  618.      properly.
  619.      This copies the files `cc1', `cpp' and `libgcc.a' to files `cc1',
  620.      `cpp' and `libgcc.a' in directory
  621.      `/usr/local/lib/gcc-lib/TARGET/VERSION', which is where the
  622.      compiler driver program looks for them.  Here TARGET is the target
  623.      machine type specified when you ran `configure', and VERSION is
  624.      the version number of GNU CC.  This naming scheme permits various
  625.      versions and/or cross-compilers to coexist.
  626.      It also copies the driver program `gcc' into the directory
  627.      `/usr/local/bin', so that it appears in typical execution search
  628.      paths.
  629.      On some systems, this command will cause recompilation of some
  630.      files. This is usually due to bugs in `make'.  You should either
  631.      ignore this problem, or use GNU Make.
  632.      *Warning: there is a bug in `alloca' in the Sun library.  To avoid
  633.      this bug, be sure to install the executables of GNU CC that were
  634.      compiled by GNU CC.  (That is, the executables from stage 2 or 3,
  635.      not stage 1.)  They use `alloca' as a built-in function and never
  636.      the one in the library.*
  637.      (It is usually better to install GNU CC executables from stage 2
  638.      or 3, since they usually run faster than the ones compiled with
  639.      some other compiler.)
  640.  12. Install the Objective C library (if you have built the Objective C
  641.      compiler).  Here is the command to do this:
  642.           make install-libobjc CC="stage2/xgcc -Bstage2/" CFLAGS="-g -O"
  643.  13. Correct errors in the header files on your machine.
  644.      Various system header files often contain constructs which are
  645.      erroneous, incompatible with ANSI C or otherwise unsuitable, and
  646.      they will not work when you compile programs with GNU CC.
  647.      The most common erroneous construct is found in `ioctl.h', where a
  648.      macro expects argument values to be substituted for argument names
  649.      inside of character constants--something not done in ANSI C.  This
  650.      particular problem can be prevented by using `-traditional'.  Other
  651.      problems are not so easy to work around.
  652.      GNU CC comes with shell scripts to fix known header file problems.
  653.       They install corrected copies of various header files in a
  654.      special directory where only GNU CC will normally look for them. 
  655.      The scripts adapt to various systems by searching all the system
  656.      header files for the problem cases that we know about.
  657.      Use the following command to do this:
  658.           make install-fixincludes
  659.      If you selected a different directory for GNU CC installation when
  660.      you installed it, by specifying the Make variable `prefix' or
  661.      `libdir', specify it the same way in this command.
  662.      Note that some systems are starting to come with ANSI C system
  663.      header files.  On these systems, don't run `install-fixincludes';
  664.      it may not work, and is certainly not necessary.  One exception:
  665.      there are is a special script for System V release 4, which you
  666.      should run.
  667.      It is not the purpose of `install-fixincludes' to add prototypes to
  668.      the system header files.  We support headers with ANSI C
  669.      prototypes in the GNU C Library, and we have no time to support
  670.      adding them to other systems' header files.
  671.    If you cannot install the compiler's passes and run-time support in
  672. `/usr/local/lib', you can alternatively use the `-B' option to specify
  673. a prefix by which they may be found.  The compiler concatenates the
  674. prefix with the names  `cpp', `cc1' and `libgcc.a'. Thus, you can put
  675. the files in a directory `/usr/foo/gcc' and specify `-B/usr/foo/gcc/'
  676. when you run GNU CC.
  677.    Also, you can specify an alternative default directory for these
  678. files by setting the Make variable `libdir' when you make GNU CC.
  679. File: gcc.info,  Node: Other Dir,  Next: Cross-Compiler,  Up: Installation
  680. Compilation in a Separate Directory
  681. ===================================
  682.    If you wish to build the object files and executables in a directory
  683. other than the one containing the source files, here is what you must
  684. do differently:
  685.   1. Make sure you have a version of Make that supports the `VPATH'
  686.      feature.  (GNU Make supports it, as do Make versions on most BSD
  687.      systems.)
  688.   2. If you have ever run `configure' in the source directory, you must
  689.      undo the configuration.  Do this by running:
  690.           make distclean
  691.   3. Go to the directory in which you want to build the compiler before
  692.      running `configure':
  693.           mkdir gcc-sun3
  694.           cd gcc-sun3
  695.      On systems that do not support symbolic links, this directory must
  696.      be on the same file system as the source code directory.
  697.   4. Specify where to find `configure' when you run it:
  698.           ../gcc/configure ...
  699.      This also tells `configure' where to find the compiler sources;
  700.      `configure' takes the directory from the file name that was used to
  701.      invoke it.  But if you want to be sure, you can specify the source
  702.      directory with the `--srcdir' option, like this:
  703.           ../gcc/configure --srcdir=../gcc sun3
  704.      The directory you specify with `--srcdir' need not be the same as
  705.      the one that `configure' is found in.
  706.    Now, you can run `make' in that directory.  You need not repeat the
  707. configuration steps shown above, when ordinary source files change.  You
  708. must, however, run `configure' again when the configuration files
  709. change, if your system does not support symbolic links.
  710. File: gcc.info,  Node: Cross-Compiler,  Next: PA Install,  Prev: Other Dir,  Up: Installation
  711. Building and Installing a Cross-Compiler
  712. ========================================
  713.    GNU CC can function as a cross-compiler for many machines, but not
  714.    * Cross-compilers for the Mips as target do not work because the
  715.      auxiliary programs `mips-tdump.c' and `mips-tfile.c' can't be
  716.      compiled on anything but a Mips.
  717.    * Cross-compilers to or from the Vax probably don't work completely
  718.      because the Vax uses an incompatible floating point format (not
  719.      IEEE format).
  720.    Since GNU CC generates assembler code, you probably need a
  721. cross-assembler that GNU CC can run, in order to produce object files.
  722. If you want to link on other than the target machine, you need a
  723. cross-linker as well.  You also need header files and libraries suitable
  724. for the target machine that you can install on the host machine.
  725.    To build GNU CC as a cross-compiler, you start out by running
  726. `configure'.  You must specify two different configurations, the host
  727. and the target.  Use the `--host=HOST' option for the host and
  728. `--target=TARGET' to specify the target type.  For example, here is how
  729. to configure for a cross-compiler that runs on a hypothetical Intel 386
  730. system and produces code for an HP 68030 system running BSD:
  731.      configure --target=m68k-hp-bsd4.3 --host=i386-bozotheclone-bsd4.3
  732.    Next you should install the cross-assembler and cross-linker (and
  733. `ar' and `ranlib').  Put them in the directory `/usr/local/TARGET/bin'.
  734.  The installation of GNU CC will find them there and copy or link them
  735. to the proper place to find them when you run the cross-compiler later.
  736.    If you want to install any additional libraries to use with the
  737. cross-compiler, put them in the directory `/usr/local/TARGET/lib'; all
  738. files in that subdirectory will be installed in the proper place when
  739. you install the cross-compiler. Likewise, put the header files for the
  740. target machine in `/usr/local/TARGET/include'.
  741.    You must now produce a substitute for `libgcc1.a'.  Normally this
  742. file is compiled with the "native compiler" for the target machine;
  743. compiling it with GNU CC does not work.  But compiling it with the host
  744. machine's compiler also doesn't work--that produces a file that would
  745. run on the host, and you need it to run on the target.
  746.    We can't give you any automatic way to produce this substitute.  For
  747. some targets, the subroutines in `libgcc1.c' are not actually used. You
  748. need not provide the ones that won't be used.  The ones that most
  749. commonly are used are the multiplication, division and remainder
  750. routines--many RISC machines rely on the library for this.  One way to
  751. make them work is to define the appropriate `perform_...' macros for
  752. the subroutines that you need.  If these definitions do not use the C
  753. arithmetic operators that they are meant to implement, you might be
  754. able to compile them with the cross-compiler you are building. To do
  755. this, specify `LIBGCC1=libgcc1.a OLDCC=./xgcc' when building the
  756. compiler.
  757.    Now you can proceed just as for compiling a single-machine compiler
  758. through the step of building stage 1.  If you have not provided some
  759. sort of `libgcc1.a', then compilation will give up at the point where
  760. it needs that file, printing a suitable error message.  If you do
  761. provide `libgcc1.a', then building the compiler will automatically
  762. compile and link a test program called `cross-test'; if you get errors
  763. in the linking, it means that not all of the necessary routines in
  764. `libgcc1.a' are available.
  765.    When you are using a cross-compiler configuration, building stage 1
  766. does not compile all of GNU CC.  This is because one part of building,
  767. the compilation of `libgcc2.c', requires use of the cross-compiler.
  768.    However, when you type `make install' to install the bulk of the
  769. cross-compiler, that will also compile `libgcc2.c' and install the
  770. resulting `libgcc.a'.
  771.    Do not try to build stage 2 for a cross-compiler.  It doesn't work to
  772. rebuild GNU CC as a cross-compiler using the cross-compiler, because
  773. that would produce a program that runs on the target machine, not on the
  774. host.  For example, if you compile a 386-to-68030 cross-compiler with
  775. itself, the result will not be right either for the 386 (because it was
  776. compiled into 68030 code) or for the 68030 (because it was configured
  777. for a 386 as the host).  If you want to compile GNU CC into 68030 code,
  778. whether you compile it on a 68030 or with a cross-compiler on a 386, you
  779. must specify a 68030 as the host when you configure it.
  780. File: gcc.info,  Node: PA Install,  Next: Sun Install,  Prev: Cross-Compiler,  Up: Installation
  781. Installing GNU CC on the HP Precision Architecture
  782. ==================================================
  783.    There are two variants of this CPU, called 1.0 and 1.1, which have
  784. different machine descriptions.  You must use the right one for your
  785. machine.  All 7NN machines and 8N7 machines use 1.1, while all other
  786. 8NN machines use 1.0.
  787.    The easiest way to handle this problem is to use `configure hpNNN'
  788. or `configure hpNNN-hpux', where NNN is the model number of the
  789. machine.  Then `configure' will figure out if the machine is a 1.0 or
  790. 1.1.  Use `uname -a' to find out the model number of your machine.
  791.    `-g' does not work on HP-UX, since that system uses a peculiar
  792. debugging format which GNU CC does not know about.  There are
  793. preliminary versions of GAS and GDB for the HP-PA which do work with
  794. GNU CC for debugging.  You can get them by anonymous ftp from
  795. `jaguar.cs.utah.edu' `dist' subdirectory.  You would need to install
  796. GAS in the file
  797.      /usr/local/lib/gcc-lib/CONFIGURATION/GCCVERSION/as
  798. where CONFIGURATION is the configuration name (perhaps `hpNNN-hpux')
  799. and GCCVERSION is the GNU CC version number.  Do this *before* starting
  800. the build process, otherwise you will get errors from the HPUX
  801. assembler while building `libgcc2.a'.  The command
  802.      make install-dir
  803. will create the necessary directory hierarchy so you can install GAS
  804. before building GCC.
  805.    If you obtained GAS before October 6, 1992 it is highly recommended
  806. you get a new one to avoid several bugs which have been discovered
  807. recently.
  808.    To enable debugging, configure GNU CC with the `--gas' option before
  809. building.
  810. File: gcc.info,  Node: Sun Install,  Next: 3b1 Install,  Prev: PA Install,  Up: Installation
  811. Installing GNU CC on the Sun
  812. ============================
  813.    Make sure the environment variable `FLOAT_OPTION' is not set when
  814. you compile `libgcc.a'.  If this option were set to `f68881' when
  815. `libgcc.a' is compiled, the resulting code would demand to be linked
  816. with a special startup file and would not link properly without special
  817. pains.
  818.    There is a bug in `alloca' in certain versions of the Sun library.
  819. To avoid this bug, install the binaries of GNU CC that were compiled by
  820. GNU CC.  They use `alloca' as a built-in function and never the one in
  821. the library.
  822.    Some versions of the Sun compiler crash when compiling GNU CC.  The
  823. problem is a segmentation fault in cpp.  This problem seems to be due to
  824. the bulk of data in the environment variables.  You may be able to avoid
  825. it by using the following command to compile GNU CC with Sun CC:
  826.      make CC="TERMCAP=x OBJS=x LIBFUNCS=x STAGESTUFF=x cc"
  827. File: gcc.info,  Node: 3b1 Install,  Next: Unos Install,  Prev: Sun Install,  Up: Installation
  828. Installing GNU CC on the 3b1
  829. ============================
  830.    Installing GNU CC on the 3b1 is difficult if you do not already have
  831. GNU CC running, due to bugs in the installed C compiler.  However, the
  832. following procedure might work.  We are unable to test it.
  833.   1. Comment out the `#include "config.h"' line on line 37 of `cccp.c'
  834.      and do `make cpp'.  This makes a preliminary version of GNU cpp.
  835.   2. Save the old `/lib/cpp' and copy the preliminary GNU cpp to that
  836.      file name.
  837.   3. Undo your change in `cccp.c', or reinstall the original version,
  838.      and do `make cpp' again.
  839.   4. Copy this final version of GNU cpp into `/lib/cpp'.
  840.   5. Replace every occurrence of `obstack_free' in the file `tree.c'
  841.      with `_obstack_free'.
  842.   6. Run `make' to get the first-stage GNU CC.
  843.   7. Reinstall the original version of `/lib/cpp'.
  844.   8. Now you can compile GNU CC with itself and install it in the normal
  845.      fashion.
  846.