configure.info: Host and Target Libraries

Go forward to Target Library Configure Scripts
Go up to Cross Tools in the Cygnus Tree
Go to the top op configure

Host and Target Libraries

   The Cygnus tree distinguishes host libraries from target libraries.
   Host libraries are built with the compiler used to build the programs
which run on the host, which is called the host compiler.  This includes
libraries such as `bfd' and `tcl'.  These libraries are built with the
host compiler, and are linked into programs like the binutils or gcc
which run on the host.
   Target libraries are built with the target compiler.  If gcc is
present in the source tree, then the target compiler is the gcc that is
built using the host compiler.  Target libraries are libraries such as
`newlib' and `libstdc++'.  These libraries are not linked into the host
programs, but are instead made available for use with programs built
with the target compiler.
   For the rest of this section, assume that gcc is present in the
source tree, so that it will be used to build the target libraries.
   There is a complication here.  The configure process needs to know
which compiler you are going to use to build a tool; otherwise, the
feature tests will not work correctly.  The Cygnus tree handles this by
not configuring the target libraries until the target compiler is
built.  In order to permit everything to build using a single
`configure'/`make', the configuration of the target libraries is
actually triggered during the make step.
   When the target libraries are configured, the `--target' option is
not used.  Instead, the `--host' option is used with the argument of
the `--target' option for the overall configuration.  If no `--target'
option was used for the overall configuration, the `--host' option will
be passed with the output of the `config.guess' shell script.  Any
`--build' option is passed down unchanged.
   This translation of configuration options is done because since the
target libraries are compiled with the target compiler, they are being
built in order to run on the target of the overall configuration.  By
the definition of host, this means that their host system is the same as
the target system of the overall configuration.
   The same process is used for both a native configuration and a cross
configuration.  Even when using a native configuration, the target
libraries will be configured and built using the newly built compiler.
This is particularly important for the C++ libraries, since there is no
reason to assume that the C++ compiler used to build the host tools (if
there even is one) uses the same ABI as the g++ compiler which will be
used to build the target libraries.
   There is one difference between a native configuration and a cross
configuration.  In a native configuration, the target libraries are
normally configured and built as siblings of the host tools.  In a cross
configuration, the target libraries are normally built in a subdirectory
whose name is the argument to `--target'.  This is mainly for
historical reasons.
   To summarize, running `configure' in the Cygnus tree configures all
the host libraries and tools, but does not configure any of the target
libraries.  Running `make' then does the following steps:
   * Build the host libraries.
   * Build the host programs, including gcc.  Note that we call gcc
     both a host program (since it runs on the host) and a target
     compiler (since it generates code for the target).
   * Using the newly built target compiler, configure the target
     libraries.
   * Build the target libraries.
   The steps need not be done in precisely this order, since they are
actually controlled by `Makefile' targets.