qt5base-lts/config.tests/unix/endian.test
Rohan McGovern 8f872ee0e8 configure: fixed stray output from endian.test when not verbose
The output of building and running config.tests are generally silent
unless -verbose is passed to configure.

However, there was one place in endian.test where a check for $VERBOSE
was missed, leading to confusing output like:

    Creating qmake. Please wait...
    rm -f endiantest.o
    rm -f *~ core *.core
    rm -f endiantest
    rm -f Makefile
    rm -f endiantest.o
    rm -f *~ core *.core
    rm -f endiantest
    rm -f Makefile

Change-Id: Idabe85f2b188ed9da713392d116d4d2853be2189
Reviewed-by: Jason McDonald <jason.mcdonald@nokia.com>
2012-02-28 07:29:00 +01:00

61 lines
1.6 KiB
Bash
Executable File

#!/bin/sh
QMKSPEC=$1
VERBOSE=$2
SRCDIR=$3
OUTDIR=$4
QMFLAGS=$5
# debuggery
[ "$VERBOSE" = "yes" ] && echo "Determining machine byte-order... ($*)"
# build and run a test program
test -d "$OUTDIR/config.tests/unix/endian" || mkdir -p "$OUTDIR/config.tests/unix/endian"
"$OUTDIR/bin/qmake" -nocache -spec "$QMKSPEC" "QT_BUILD_TREE=$OUTDIR" $QMFLAGS "$SRCDIR/config.tests/unix/endian/endiantest.pro" -o "$OUTDIR/config.tests/unix/endian/Makefile" >/dev/null 2>&1
cd "$OUTDIR/config.tests/unix/endian"
ENDIAN="UNKNOWN"
[ "$VERBOSE" = "yes" ] && $MAKE || $MAKE >/dev/null 2>&1
if [ -f ./endiantest.exe ]; then
binary=./endiantest.exe
else
binary=./endiantest
fi
if [ -f $binary ]; then
: # nop
else
[ "$VERBOSE" = "yes" ] && echo "Unknown byte order!"
exit 2
fi
if strings - $binary | grep LeastSignificantByteFirst >/dev/null 2>&1; then
[ "$VERBOSE" = "yes" ] && echo " Found 'LeastSignificantByteFirst' in binary"
ENDIAN="LITTLE"
elif strings - $binary | grep MostSignificantByteFirst >/dev/null 2>&1; then
[ "$VERBOSE" = "yes" ] && echo " Found 'MostSignificantByteFirst' in binary"
ENDIAN="BIG"
fi
# make clean as this tests is compiled for both the host and the target
if [ "$VERBOSE" = "yes" ]; then
$MAKE distclean
else
$MAKE distclean >/dev/null 2>&1
fi
# done
if [ "$ENDIAN" = "LITTLE" ]; then
[ "$VERBOSE" = "yes" ] && echo "Using little endian."
exit 0
elif [ "$ENDIAN" = "BIG" ]; then
[ "$VERBOSE" = "yes" ] && echo "Using big endian."
exit 1
else
[ "$VERBOSE" = "yes" ] && echo "Unknown byte order!"
exit 2
fi