[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
In a `configure.in' file, after calling `AC_PROG_CC', you can find out whether this is a Canadian Cross configure by examining the shell variable `cross_compiling'. In a Canadian Cross, which means that the compiler is a cross compiler, `cross_compiling' will be `yes'. In a normal configuration, `cross_compiling' will be `no'.
You ordinarily do not need to know the type of the build system in a configure script. However, if you do need that information, you can get it by using the macro `AC_CANONICAL_SYSTEM', the same macro that is used to determine the target system. This macro will set the variables `build', `build_alias', `build_cpu', `build_vendor', and `build_os', which correspond to the similar `target' and `host' variables, except that they describe the build system.
When writing tests in `configure.in', you must remember that you want to test the host environment, not the build environment.
Macros like `AC_CHECK_FUNCS' which use the compiler will test the host environment. That is because the tests will be done by running the compiler, which is actually a build cross host compiler. If the compiler can find the function, that means that the function is present in the host environment.
Tests like `test -f /dev/ptyp0', on the other hand, will test the build environment. Remember that the configure script is running on the build system, not the host system. If your configure scripts examines files, those files will be on the build system. Whatever you determine based on those files may or may not be the case on the host system.
Most autoconf macros will work correctly for a Canadian Cross. The main exception is `AC_TRY_RUN'. This macro tries to compile and run a test program. This will fail in a Canadian Cross, because the program will be compiled for the host system, which means that it will not run on the build system.
The `AC_TRY_RUN' macro provides an optional argument to tell the configure script what to do in a Canadian Cross. If that argument is not present, you will get a warning when you run `autoconf':
warning: AC_TRY_RUN called without default to allow cross compiling |
In some cases while it may better to perform a test at configure time, it is also possible to perform the test at run time. In such a case you can use the cross compiling argument to `AC_TRY_RUN' to tell your program that the test could not be performed at configure time.
There are a few other autoconf macros which will not work correctly with a Canadian Cross: a partial list is `AC_FUNC_GETPGRP', `AC_FUNC_SETPGRP', `AC_FUNC_SETVBUF_REVERSED', and `AC_SYS_RESTARTABLE_SYSCALLS'. The `AC_CHECK_SIZEOF' macro is generally not very useful with a Canadian Cross; it permits an optional argument indicating the default size, but there is no way to know what the correct default should be.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |