with_cross_host vs cross-hosted

Daniel Jacobowitz dmj+@andrew.cmu.edu
Thu Jul 5 13:48:00 GMT 2001


On Thu, Jul 05, 2001 at 04:38:55PM -0400, DJ Delorie wrote:
> > > ! if test -n "$with_cross_host"; then
> > 
> > > ! if test "$build $build" != "$host $target"; then
> > 
> > How about 'if test x"$build" != x"$host"' ?  We don't really care what
> > the compiler's host will be,
> 
> Of course we do.  If the compiler's host doesn't match the build
> machine, we can't run the compiler on the build machine.  It's trying
> to run ../gcc/xgcc, not the compiler that built ../gcc/xgcc.

Doh.  Right, we need to be able to both run the compiler and its
output.

> I think then we want with_cross_host unset, and build==(host/target).
> How about:
> 
>   if test "$build $with_cross_host" = "$host "; then

Well, I'd just like to express a preference for a more explicit test
statement:

if test x"$with_cross_host" = x && test x"$build" = x"$host"

> > be.  If you're compiling x86-linux -> sparc-solaris -> x86-linux, I
> > don't see anything wrong with running the tests natively.
> 
> If we're doing x86->sparc->x86, the compiler we just built will not
> run on x86 (it runs on sparc), and we cannot use it to compile
> programs that generate sources we need for the build.

Yes, you're quite right.

> > You hit the missing "test" there too :)  Plus, as I mentioned, $target
> > can't be trusted at this point.
> 
> Actually, I fixed that in configure but forgot to propogate the change
> to configure.in for the patch.  I think thas bug alone tells us that
> we've never executed that case, so we're *always* assuming the
> compiler is native, but in my case it's not native for the *build*
> machine.
> 
> > Does 'if test x"$build" != x"$with_cross_host" && test x"$build" !=
> > x"$host"' work for you?  That's presumably the right test for a true
> > Canadian cross.
> 
> with_cross_host is not set for a linux->cygwin->cygwin build.  It is
> only set if the host doesn't match the target, not if the host doesn't
> match either the target or the build.

Exactly.  linux->cygwin->cygwin is not a Canadian cross, as people keep
reminding me; it's another kind of fish, a host-x-host.  The only thing
CANADIAN gets checked for is:
  # Passed down for canadian crosses.
  if  test x"$CANADIAN" = xyes; then
    TOPLEVEL_INCLUDES='-I$(includedir)'
  fi

Which I think is wrong to begin with, and is probably wrong for you on
a host-x-host build.  You'll probably pick up -I/usr/include that way,
and that's not kosher!


-- 
Daniel Jacobowitz                           Carnegie Mellon University
MontaVista Software                         Debian GNU/Linux Developer



More information about the Gcc-bugs mailing list