[ expat-Bugs-470642 ] Configure with cross-compiler + endian

noreply@sourceforge.net noreply@sourceforge.net
Fri Dec 7 02:51:05 2001


Bugs item #470642, was opened at 2001-10-12 10:35
You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=110127&aid=470642&group_id=10127

Category: Build control
Group: None
>Status: Closed
>Resolution: Fixed
Priority: 5
Submitted By: Nobody/Anonymous (nobody)
Assigned to: Greg Stein (gstein)
Summary: Configure with cross-compiler + endian

Initial Comment:
When "configure" discovers that the compiler
(say "gcc") is a cross-compiler, it is more
difficult for it to deduce the correct endian-ness
of the target system.

The script, however, has already figured out how
to run the C pre-processor, which we can take
advantage of.

I modified "configure" as follows.  (This also
adds a few more variants on the BIG_ENDIAN
and LITTLE_ENDIAN compiler predefined symbols.)

After the "guessing bigendian ..." echo statement,
comment out (or eliminate) the "echo" following
it about 3 lines later.  Add the following code,
after the "fi" immediately following the "echo":

if test $ac_cv_c_bigendian = unknown; then
cat >conftest.c <<EOF
#if BIG_ENDIAN || _BIG_ENDIAN || __BIG_ENDIAN ||\
_BIG_ENDIAN_ || __BIG_ENDIAN__
short bytes = 4321;
#elif LITTLE_ENDIAN || _LITTLE_ENDIAN ||\
 __LITTLE_ENDIAN || _LITTLE_ENDIAN_ ||\
 __LITTLE_ENDIAN__
short bytes = 1234;
#else
short bytes = 0000;
#endif
EOF
ac_try="${CPP} conftest.c 1>conftest.out 2>/dev/null"
{ (eval echo configure:2118: \$ac_try\) 1>&5; (eval
$ac_try) 2>&5; }
ac_err="`grep  '^short[ ]*bytes[ ]*=[
]*[0-4][0-4][0-4][0-4];' conftest.out 2>/d
ev/null | sed -e 's|^[^=]*=[ ]*||' -e 's|;||'`"
if test -z "$ac_err"; then
  ac_cv_c_bigendian=unknown
elif test "X$ac_err" = "X4321"; then
  ac_cv_c_bigendian=yes
elif test "X$ac_err" = "X1234"; then
  ac_cv_c_bigendian=no
else
  ac_cv_c_bigendian=unknown
fi
rm -rf conftest*
echo "$ac_t""$ac_cv_c_bigendian" 1>&6
fi

----------------------------------------------------------------------

>Comment By: Greg Stein (gstein)
Date: 2001-12-07 02:50

Message:
Logged In: YES 
user_id=6501

We're now using a similar technique through the
conftools/ac_c_bigendian_cross.m4 script.

Closing as fixed in the upcoming release.

----------------------------------------------------------------------

You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=110127&aid=470642&group_id=10127