Avoid double-buffering in QFile
[qt-netbsd.git] / config.tests / unix / endian.test
blob4755b1f629c6b685f8a041036f710d5e630ae3bd
1 #!/bin/sh
3 QMKSPEC=$1
4 VERBOSE=$2
5 SRCDIR=$3
6 OUTDIR=$4
8 # debuggery
9 [ "$VERBOSE" = "yes" ] && echo "Determining machine byte-order... ($*)"
11 # build and run a test program
12 test -d "$OUTDIR/config.tests/unix/endian" || mkdir -p "$OUTDIR/config.tests/unix/endian"
13 "$OUTDIR/bin/qmake" -nocache -spec "$QMKSPEC" "$SRCDIR/config.tests/unix/endian/endiantest.pro" -o "$OUTDIR/config.tests/unix/endian/Makefile" >/dev/null 2>&1
14 cd "$OUTDIR/config.tests/unix/endian"
17 ENDIAN="UNKNOWN"
18 [ "$VERBOSE" = "yes" ] && $MAKE || $MAKE >/dev/null 2>&1
20 if [ -f ./endiantest.exe ]; then
21 binary=./endiantest.exe
22 else
23 binary=./endiantest
27 if [ -f $binary ]; then
28 : # nop
29 else
30 [ "$VERBOSE" = "yes" ] && echo "Unknown byte order!"
31 exit 2
34 if strings $binary | grep LeastSignificantByteFirst >/dev/null 2>&1; then
35 [ "$VERBOSE" = "yes" ] && echo " Found 'LeastSignificantByteFirst' in binary"
36 ENDIAN="LITTLE"
37 elif strings $binary | grep MostSignificantByteFirst >/dev/null 2>&1; then
38 [ "$VERBOSE" = "yes" ] && echo " Found 'MostSignificantByteFirst' in binary"
39 ENDIAN="BIG"
42 # make clean as this tests is compiled for both the host and the target
43 $MAKE distclean
45 # done
46 if [ "$ENDIAN" = "LITTLE" ]; then
47 [ "$VERBOSE" = "yes" ] && echo "Using little endian."
48 exit 0
49 elif [ "$ENDIAN" = "BIG" ]; then
50 [ "$VERBOSE" = "yes" ] && echo "Using big endian."
51 exit 1
52 else
53 [ "$VERBOSE" = "yes" ] && echo "Unknown byte order!"
54 exit 2