autoconf: Specifying Target Triplets

1 
1 14.1 Specifying target triplets
1 ===============================
1 
1 Autoconf-generated `configure' scripts can make decisions based on a
1 canonical name for the system type, or "target triplet", which has the
1 form: `CPU-VENDOR-OS', where OS can be `SYSTEM' or `KERNEL-SYSTEM'
1 
1    `configure' can usually guess the canonical name for the type of
1 system it's running on.  To do so it runs a script called
1 `config.guess', which infers the name using the `uname' command or
1 symbols predefined by the C preprocessor.
1 
1    Alternately, the user can specify the system type with command line
1 arguments to `configure' (⇒System Type.  Doing so is necessary
1 when cross-compiling.  In the most complex case of cross-compiling,
1 three system types are involved.  The options to specify them are:
1 
1 `--build=BUILD-TYPE'
1      the type of system on which the package is being configured and
1      compiled.  It defaults to the result of running `config.guess'.
1      Specifying a BUILD-TYPE that differs from HOST-TYPE enables
1      cross-compilation mode.
1 
1 `--host=HOST-TYPE'
1      the type of system on which the package runs.  By default it is the
1      same as the build machine.  Specifying a HOST-TYPE that differs
1      from BUILD-TYPE, when BUILD-TYPE was also explicitly specified,
1      enables cross-compilation mode.
1 
1 `--target=TARGET-TYPE'
1      the type of system for which any compiler tools in the package
1      produce code (rarely needed).  By default, it is the same as host.
1 
1    If you mean to override the result of `config.guess', use `--build',
1 not `--host', since the latter enables cross-compilation.  For
1 historical reasons, whenever you specify `--host', be sure to specify
1 `--build' too; this will be fixed in the future.  So, to enter
1 cross-compilation mode, use a command like this
1 
1      ./configure --build=i686-pc-linux-gnu --host=m68k-coff
1 
1 Note that if you do not specify `--host', `configure' fails if it can't
1 run the code generated by the specified compiler.  For example,
1 configuring as follows fails:
1 
1      ./configure CC=m68k-coff-gcc
1 
1    When cross-compiling, `configure' will warn about any tools
1 (compilers, linkers, assemblers) whose name is not prefixed with the
1 host type.  This is an aid to users performing cross-compilation.
1 Continuing the example above, if a cross-compiler named `cc' is used
1 with a native `pkg-config', then libraries found by `pkg-config' will
1 likely cause subtle build failures; but using the names `m68k-coff-cc'
1 and `m68k-coff-pkg-config' avoids any confusion.  Avoiding the warning
1 is as simple as creating the correct symlinks naming the cross tools.
1 
1    `configure' recognizes short aliases for many system types; for
1 example, `decstation' can be used instead of `mips-dec-ultrix4.2'.
1 `configure' runs a script called `config.sub' to canonicalize system
1 type aliases.
1 
1    This section deliberately omits the description of the obsolete
1 interface; see ⇒Hosts and Cross-Compilation.
1