| || |
While feature tests are definitely the best approach, a `configure' script may occasionally have to make a decision based on a configuration name . This may be necessary if certain code must be compiled differently based on something which can not be tested using a standard Autoconf feature test. For instance, the
It is normally better to test for particular features, rather than to test for a particular system type. This is because as Unix and other operating systems evolve , different systems copy features from one another.
When there is no alternative to testing the configuration name in a `configure' script, it is best to define a macro which describes the feature, rather than defining a macro which describes the particular system. This permits the same macro to be used on other systems which adopt the same feature (see section 23. Writing New Macros for Autoconf).
Testing for a particular system is normally done using a case statement in the autoconf `configure.in' file. The
Note the doubled square brackets in this piece of code. These are used to work around an ugly implementation detail of
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 `i86' 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*' .