Background: Currently, autoconf sets cross_compiling=no if host_alias = build_alias. That's not always correct -- if you want to build from pristine sources, the best way is to pretend it's a cross-build. (LFS comes to mind.) The usual workaround is to use a slightly phony value for host_alias by modifying the more-or-less unused manufacturer field (e.g. i686-HOST-linux-gnu). This fails for architectures which only have a single manufacturer, as config.sub will reject phony manufacturer names. It's also clumsy when doing a canadian cross, as all those phony machine names get confusing.
My current problem: I'm doing a canadian cross build of a gcc/glibc toolchain. gcc is configured with --build=i686-pc-linux-gnu --target=x86_64-unknown-linux-gnu --host=x86_64-unknown-linux-gnu and glibc is configured with the machine types shifted by one as usual (see the famous comment in http://gcc.gnu.org/ml/libstdc++/2003-07/msg00461.html, and another example at http://handhelds.org/download/toolchain/gcc-build-cross-3.3): --build=x86_64-unknown-linux-gnu --host=x86_64-unknown-linux-gnu Configuring glibc-2.3.2 fails with the error checking size of long double... configure: error: cannot compute sizeof (long double), 77 because autoconf-2.57 mistakenly thinks that because build=host, it can run the output of the C compiler.
Proposed fix: The simple fix seems to be to allow the user to override cross_compiling when running configure, e.g.
--- general.m4.old 2004-05-18 12:21:26.000000000 -0700 +++ general.m4 2004-05-18 12:23:18.000000000 -0700 @@ -397,7 +397,7 @@ # ac_default_prefix=/usr/local ac_config_libobj_dir=. -cross_compiling=no +cross_compiling=${cross_compiling-no} subdirs= MFLAGS= MAKEFLAGS= @@ -869,7 +869,7 @@ target=$target_alias
# FIXME: To remove some day. -if test "x$host_alias" != x; then +if test "x$cross_compiling" != "yes" && test "x$host_alias" != x; then if test "x$build_alias" = x; then cross_compiling=maybe AC_MSG_WARN([If you wanted to set the --build type, don't use --host.
What say?