autoconf
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Cross compiling when in fact we aren't


From: Guido Draheim
Subject: Re: Cross compiling when in fact we aren't
Date: Tue, 26 Aug 2003 08:59:27 +0200
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.3) Gecko/20030313



Kevin Ryde wrote:
Balint Joo <address@hidden> writes:

In my case the answer is that I am trying to compile a parallel
program, which needs a special compiler (mpcc). However in order
to run the output of mpcc, I need to be in a batch queue. Outwith
the batch queue I cannot run executables compiled with the parallel environment.


A somewhat similar situation arises on sparc64 solaris, where
executables in the 64-bit ABI can't run if the kernel is in 32-bit
mode.  The compiler can create them, but they can't run.  In gmp we
recommended what Guido said, fake up a --build to make it look like a
cross compile.  --build=none for instance, since gmp (and I would
guess a lot of packages) doesn't pay attention to the actual build
system type.


Indeed! I had been cautious since some toolchains do actually
compile some tools on the build system but in fact they can
get away with plain stdc code which they try to stick with
just for the reason to be extra portable. No optimizations
for the specific platform in there.

To be a bit sure, I've been grepping a bit around. First,
autoconf macro dir - nothing, nothing goes to test \$build
there. In aclocal, we can find a single valid reference to
\$build - in libtool.m4 as
      if test x"$host" != x"$build"; then

The only likely candidate that I can think of, well, that's
a package with a compiler-compiler - and gcc is the best
candidation I can think of in this area since I do know
it does that `canadian cross` (or what its called) with
compiler a compiler-compiler on the fly to compiler the
compiler for the host system that can compile a binrary
for the target system (phew!) - anyway, let's grepp it:

boehm-gc/configure:case "$build_alias" in
boehm-gc/configure:case "$build_alias" in
gcc/configure:case "$build_alias" in
gcc/configure:if test $host != $build; then
gcc/configure:case $build in
gcc/configure:for machine in $build $host $target; do
gcc/configure:if test x$host = x$build
gcc/configure:  FORBUILD=../$build_alias
gcc/configure:if test x$build != x$host
gcc/configure:if test x$host != x$build
gcc/configure.in:case $build in
gcc/configure.in:for machine in $build $host $target; do
gcc/configure.in:       FORBUILD=../$build_alias
gcc/configure.in:if test x$build != x$host
gcc/configure.in:if test x$host != x$build
gcc/configure.in:       str3=" on a $build system"
libf2c/configure:case "$build_alias" in
libf2c/configure:if test $host != $build; then
libffi/configure:case "$build_alias" in
libffi/configure:if test $host != $build; then
libiberty/configure:case "$build_alias" in
libjava/configure:case "$build_alias" in
libjava/configure:case "$build_alias" in
libobjc/configure:case "$build_alias" in
libobjc/configure:if test $host != $build; then
libstdc++-v3/configure:case "$build_alias" in
libstdc++-v3/configure:if test $host != $build; then
libstdc++-v3/configure:if test -n "$with_cross_host" || test x"$build" != x"$hos
t"; then
libstdc++-v3/configure:  if test -n "$with_cross_host" && test x"$build" != x"$w
ith_cross_host"; then
libstdc++-v3/configure:if test x"$build" = x"$host" && test -z "$with_cross_host
"; then
libstdc++-v3/configure.in:if test -n "$with_cross_host" || test x"$build" != x"$
host"; then
libstdc++-v3/configure.in:  if test -n "$with_cross_host" && test x"$build" != x
"$with_cross_host"; then
zlib/configure:case "$build_alias" in
zlib/configure:if test $host != $build; then

Now, that looks like a lot, does it ?

However, most of the "case $build_alias in" turn out to be from
the following snippet copy-n-pasted around:

build_alias=$build
case "$build_alias" in
NONE)
  case $nonopt in
  NONE) build_alias=$host_alias ;;
  *) build_alias=$nonopt ;;
  esac ;;
esac

For our interest, let us cut out
(1) all references like $build != $host
(2) cut out case-check for $build = NONE as above
as we result, we are left with:

gcc/configure:case $build in
gcc/configure-vax-*-*)
gcc/configure:  FORBUILD=../$build_alias

Now finally, we have a single reference in the world to the
actual value of $build - what's it like? Well, here you are:

case $build in
vax-*-*)
  if test x$GCC = xyes
  then
    stage1_cflags="-Wa,-J"
  else
    stage1_cflags="-J"
  fi
  ;;
powerpc-*-darwin*)
  # The spiffy cpp-precomp chokes on some legitimate constructs in GCC
  # sources; use -no-cpp-precomp to get to GNU cpp.
  # Apple's GCC has bugs in designated initializer handling, so disable
  # that too.
  stage1_cflags="-no-cpp-precomp -DHAVE_DESIGNATED_INITIALIZERS=0"
  ;;
esac
AC_SUBST(stage1_cflags)

well, one may guess that it is really the
only single reference in the world....
cheers,
-- guido                                  http://AC-Archive.sf.net
GCS/E/S/P C++/++++$ ULHS L++w- N++@ d(+-) s+a- r+@>+++ y++ 5++X-





reply via email to

[Prev in Thread] Current Thread [Next in Thread]