Author: rathann Date: Fri Mar 5 22:16:01 2010 New Revision: 1191 Log: Detect arch endianness. src/bswap.h depends on WORD_BIGENDIAN being defined on big-endian arch to select appropriate macros. configure2 did not produce that definition in config.h, so the code ended up being incorrect on ppc and other big-endian arches. Approved by Nico. Modified: trunk/libdvdread/configure2 Modified: trunk/libdvdread/configure2 ============================================================================== --- trunk/libdvdread/configure2 Thu Mar 4 20:14:17 2010 (r1190) +++ trunk/libdvdread/configure2 Fri Mar 5 22:16:01 2010 (r1191) @@ -108,6 +108,19 @@ case $targetos in ;; esac +echo -n "Checking if we're big-endian... " +bigendian=no +TMPD=`mktemp -d` +TMPC=$TMPD/endian.c +TMPO=$TMPD/endian.o +cat > $TMPC <<EOF +unsigned int endian = 'B' << 24 | 'I' << 16 | 'G' << 8 | 'E'; +EOF +$cc $optimizations $cflags -c -o $TMPO $TMPC +od -A n -t x1 $TMPO | grep -q '42 *49 *47 *45' && bigendian=yes +rm -rf $TMPD +echo "$bigendian" + cat > config.mak << EOF # Automatically generated by configure, do not edit PREFIX=$PREFIX @@ -136,6 +149,7 @@ cat > config.h << EOF /* Automatically generated by configure, do not edit */ #include "version.h" EOF +test "$bigendian" == "yes" && echo "#define WORDS_BIGENDIAN" || echo "#undef WORDS_BIGENDIAN" >> config.h # build tree in object directory if source path is different from current one if test "$source_path_used" != "no"; then
participants (1)
-
rathann