Sometimes, a target has a multilib which doesn't actually work on host for that target.
The particular example I'm thinking of is that on i386-darwin, there is a -m64 multilib for 64-bit programs, and all darwin9 hosts support building using this multilib, but not all darwin hosts are capable of running 64-bit programs. A similar situation occurs on powerpc-darwin. On some other systems, there are multilibs that make the ABI different (like -msoft-float); sometimes these are 'close enough' that programs can be run, sometimes not. The problem with this is that a native build, using 'configure && make' with no special options, is not a cross compilation and so autoconf will check that built programs can be run, and if they don't run configure will error. This is fine for the default multilib, since that ought to work, but not fine for -m64 on a 32-bit processor. So, I'd like to put in this patch, which adds a little code to AM_MULTILIB to make non-default multilibs possibly be considered to be cross compilation. autoconf will check whether compiling actually fails. I tested this by building development GCC 4.2 on a Darwin machine with an Intel Core Duo (not to be confused with Core 2 Duo) with '$srcdir/configure && make' after regenerating the libstdc++-v3, libssp, libgomp, and libobjc copies of aclocal.m4 and configure with a automake 1.9.6 with this patch applied. (multi.m4 is identical in 1.9.6 and mainline.) I'd appreciate it if this could go on the 1.9.x branch as well as mainline. -- - Geoffrey Keating <[EMAIL PROTECTED]> ===File ~/patches/automake-multilibcross.patch============== 2006-09-14 Geoffrey Keating <[EMAIL PROTECTED]> * m4/multi.m4: Non-default multilibs may be cross compilation. Index: m4/multi.m4 =================================================================== RCS file: /cvs/automake/automake/m4/multi.m4,v retrieving revision 1.14 diff -u -p -r1.14 multi.m4 --- m4/multi.m4 9 Jan 2005 14:46:21 -0000 1.14 +++ m4/multi.m4 14 Sep 2006 23:54:10 -0000 @@ -1,12 +1,12 @@ ## -*- Autoconf -*- -# Copyright (C) 1998, 1999, 2000, 2001, 2003, 2004, 2005 +# Copyright (C) 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006 # Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. -# serial 5 +# serial 6 # AM_ENABLE_MULTILIB([MAKEFILE], [REL-TO-TOP-SRCDIR]) # --------------------------------------------------- @@ -37,6 +37,13 @@ else fi AC_SUBST(multi_basedir) +# Even if the default multilib is not a cross compilation, +# it may be that some of the other multilibs are. +if test $cross_compiling = no && test $multilib = yes \ + && test "x${with_multisubdir}" != x ; then + cross_compiling=maybe +fi + AC_OUTPUT_COMMANDS([ # Only add multilib support code if we just rebuilt the top-level # Makefile. ============================================================