The GNU configure system names all systems using a configuration name. All such names used to be triplets (they may now contain four parts in certain cases), and the term configuration triplet is still seen.
This is a string of the form cpu-manufacturer-operating_system. In some cases, this is extended to a four part form: cpu-manufacturer-kernel-operating_system.
When using a configuration name in a configure option, it is normally not necessary to specify an entire name. In particular, the manufacturer field is often omitted, leading to strings such as `i386-linux' or `sparc-sunos'. The shell script `config.sub' will translate these shortened strings into the canonical form. autoconf will arrange for `config.sub' to be run automatically when it is needed.
The fields of a configuration name are as follows:
The shell script `config.guess' will normally print the correct configuration name for the system on which it is run. It does by running `uname' and by examining other characteristics of the system.
Because `config.guess' can normally determine the configuration name for a machine, it is normally only necessary to specify a configuration name when building a cross-compiler or when building using a cross-compiler.
A configure script will sometimes have to make a decision based on a configuration name. You will need to do this if you have to compile code differently based on something which can not be tested using a standard autoconf feature test.
It is normally better to test for particular features, rather than to test for a particular system. This is because as Unix evolves, different systems copy features from one another. Even if you need to determine whether the feature is supported based on a configuration name, you should define a macro which describes the feature, rather than defining a macro which describes the particular system you are on.
Testing for a particular system is normally done using a case statement in `configure.in'. The case statement might look something like the following, assuming that `host' is a shell variable holding a canonical configuration name (which will be the case if `configure.in' uses the `AC_CANONICAL_HOST' or `AC_CANONICAL_SYSTEM' macro).
case "${host}" in i[3456]86-*-linux-gnu*) do something ;; sparc*-sun-solaris2.[56789]*) do something ;; sparc*-sun-solaris*) do something ;; mips*-*-elf*) do something ;; esac
It is particularly important to use `*' after the operating system field, in order to match the version number which will be generated by `config.guess'.
In most cases you must be careful to match a range of processor types. For most processor families, a trailing `*' suffices, as in `mips*' above. For the i386 family, something along the lines of `i[3456]86' suffices at present. For the m68k family, you will need something like `m68*'. Of course, if you do not need to match on the processor, it is simpler to just replace the entire field by a `*', as in `*-*-irix*'.
Go to the first, previous, next, last section, table of contents.