with_cross_host vs cross-hosted

DJ Delorie dj@redhat.com
Thu Jul 5 13:39:00 GMT 2001

> No.  I posted about this a couple of weeks ago.  Your patch is wrong;
> once we're building libstdc++, $host is what is normally considered
> $target, and $target is undefined.

Right, forgot about that.  What's the history behind that, anyway?  It
always bothers me in libiberty.

> > ! 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.

I think then we want with_cross_host unset, and build==(host/target).
How about:

  if test "$build $with_cross_host" = "$host "; then

> 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.

> 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*

> 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.

More information about the Gcc-bugs mailing list