Next: , Up: Manual Configuration


13.1 Specifying the System Type

Like other GNU configure scripts, Autoconf-generated configure scripts can make decisions based on a canonical name for the system type, which has the form: ‘cpu-vendor-os’, where os can be ‘system’ or ‘kernel-system

configure can usually guess the canonical name for the type of system it's running on. To do so it runs a script called config.guess, which infers the name using the uname command or symbols predefined by the C preprocessor.

Alternately, the user can specify the system type with command line arguments to configure. Doing so is necessary when cross-compiling. In the most complex case of cross-compiling, three system types are involved. The options to specify them are:

--build=build-type
the type of system on which the package is being configured and compiled. It defaults to the result of running config.guess.
--host=host-type
the type of system on which the package runs. By default it is the same as the build machine. Specifying it enables the cross-compilation mode.
--target=target-type
the type of system for which any compiler tools in the package produce code (rarely needed). By default, it is the same as host.

If you mean to override the result of config.guess, use --build, not --host, since the latter enables cross-compilation. For historical reasons, passing --host also changes the build type. Therefore, whenever you specify --host, be sure to specify --build too; this will be fixed in the future. So, to enter cross-compilation mode, use a command like this

     ./configure --build=i686-pc-linux-gnu --host=m68k-coff

Note that if you do not specify --host, configure fails if it can't run the code generated by the specified compiler. For example, configuring as follows fails:

     ./configure CC=m68k-coff-gcc

In the future, when cross-compiling Autoconf will not accept tools (compilers, linkers, assemblers) whose name is not prefixed with the host type. The only case when this may be useful is when you really are not cross-compiling, but only building for a least-common-denominator architecture: an example is building for i386-pc-linux-gnu while running on an i686-pc-linux-gnu architecture. In this case, some particular pairs might be similar enough to let you get away with the system compilers, but in general the compiler might make bogus assumptions on the host: if you know what you are doing, please create symbolic links from the host compiler to the build compiler.

configure recognizes short aliases for many system types; for example, ‘decstation’ can be used instead of ‘mips-dec-ultrix4.2’. configure runs a script called config.sub to canonicalize system type aliases.

This section deliberately omits the description of the obsolete interface; see Hosts and Cross-Compilation.