Hello!
On Tue, 25 Apr 2000, Mo DeJong wrote:
> I am still confused about what situation would actually
> call for AC_CANONICAL_BUILD without also calling
> AC_CANONICAL_HOST? Also, wouldn't I always need to call
> AC_CANONICAL_BUILD when I was using AC_CANONICAL_HOST?
You need AC_CANONICAL_BUILD when
1) You want to figure out specific features of the build system without
actual testing for them. For example, if the actual test requires root
permissions or crashes the OS occasionally, I would prefer to test if the
build is running on BadOS without demonstrating how bad it is.
2) You want to encode the build system name somewhere in the program. It
may be nice sometimes just for "management" purposes.
I don't think AC_CANONICAL_BUILD should be used often.
> I was under the impression that the whole point of
> the --host flag was to tell autoconf that
> $host != $build and is therefore a cross compile.
Absolutely no. You can cross-compile even packages that know nothing about
AC_CANONICAL_*. You just need to specify the right compiler for that.
Autoconf defines cross-compiling as the situation when you cannot run
executables that you compile. I.e.
CC=aix-ibm-rs6000-gcc ./configure
is cross-compiling (if you run it not on AIX) whereas
./configure --build=i586-gnu --host=i386-gnu
is NOT a cross-compiling in Autoconf sense. You can run test programs, you
can test for endianess and sizeof. You can compile utilities and use them
to generate sources for the final executable. Generally, the main
restriction of cross-compiling is that you cannot run things you compile
from the same build process.
The opposite situation, however, shows the weakness of Autoconf's
approach.
./configure --build=i386-gnu --host=i586-gnu
This may be trickier. A trivial program may run whereas the actual test
would fail because of unsupported assembler instructions. Autoconf cannot
be told that we are crosscompiling (unless you play with cache variables,
which is not The Right Thing).
The problem of in Autoconf is that:
1) It can suddently decide that you are crosscompiling just because the
build OS is not set up correcly
2) You cannot force it into thinking that you are not cross-compiling and
make it fail if the test program cannot be run.
3) You cannot force it into thinking that you are cross-compiling and
disable running tests even if the trivial program would run.
A trivial solution (that needs discussion, because I'm not sure it's the
best solution) would be to accept the "--cross" argument for "configure".
If "--cross" is given you are cross-compiling, if "--cross" is not given,
you are not cross-compling.
The existing behaviour could be emulated with "--cross=maybe" but I don't
think it's worth the trouble since nobody seems to depend on this feature.
Regards,
Pavel Roskin