source: trunk/config.tests/unix/endian.test@ 987

Last change on this file since 987 was 846, checked in by Dmitry A. Kuminov, 14 years ago

trunk: Merged in qt 4.7.2 sources from branches/vendor/nokia/qt.

  • Property svn:executable set to *
File size: 1.5 KB
Line 
1#!/bin/sh
2
3QMKSPEC=$1
4VERBOSE=$2
5SRCDIR=$3
6OUTDIR=$4
7
8# debuggery
9[ "$VERBOSE" = "yes" ] && echo "Determining machine byte-order... ($*)"
10
11# build and run a test program
12test -d "$OUTDIR/config.tests/unix/endian" || mkdir -p "$OUTDIR/config.tests/unix/endian"
13"$OUTDIR/bin/qmake" -nocache -spec "$QMKSPEC" "QT_BUILD_TREE=$OUTDIR" "$SRCDIR/config.tests/unix/endian/endiantest.pro" -o "$OUTDIR/config.tests/unix/endian/Makefile" >/dev/null 2>&1
14cd "$OUTDIR/config.tests/unix/endian"
15
16
17ENDIAN="UNKNOWN"
18[ "$VERBOSE" = "yes" ] && $MAKE || $MAKE >/dev/null 2>&1
19
20if [ -f ./endiantest.exe ]; then
21 binary=./endiantest.exe
22else
23 binary=./endiantest
24fi
25
26
27if [ -f $binary ]; then
28 : # nop
29else
30 [ "$VERBOSE" = "yes" ] && echo "Unknown byte order!"
31 exit 2
32fi
33
34if strings $binary | grep LeastSignificantByteFirst >/dev/null 2>&1; then
35 [ "$VERBOSE" = "yes" ] && echo " Found 'LeastSignificantByteFirst' in binary"
36 ENDIAN="LITTLE"
37elif strings $binary | grep MostSignificantByteFirst >/dev/null 2>&1; then
38 [ "$VERBOSE" = "yes" ] && echo " Found 'MostSignificantByteFirst' in binary"
39 ENDIAN="BIG"
40fi
41
42# make clean as this tests is compiled for both the host and the target
43$MAKE distclean
44
45# done
46if [ "$ENDIAN" = "LITTLE" ]; then
47 [ "$VERBOSE" = "yes" ] && echo "Using little endian."
48 exit 0
49elif [ "$ENDIAN" = "BIG" ]; then
50 [ "$VERBOSE" = "yes" ] && echo "Using big endian."
51 exit 1
52else
53 [ "$VERBOSE" = "yes" ] && echo "Unknown byte order!"
54 exit 2
55fi
Note: See TracBrowser for help on using the repository browser.