qt5base-lts/config.tests/unix/ptrsize.test
Laszlo Agocs 19e61ac290 Fix pointer size detection when cross-compiling
The initial configure fails to build the pointer size test correctly
due to the missing --sysroot argument. This breaks 64-bit targets
as the pointer size is set to 4. A subsequent configure correctly
builds and picks 8 up, but we expect the first attempt to work as well.

Task-number: QTBUG-47840
Change-Id: Iaf9450635f1bbc12e18062fa0a51f35cf690ce08
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
2015-08-21 12:43:41 +00:00

36 lines
838 B
Bash
Executable File

#!/bin/sh
QMKSPEC=$1
VERBOSE=$2
SRCDIR=$3
OUTDIR=$4
LFLAGS=$SYSROOT_FLAG
CXXFLAGS=$SYSROOT_FLAG
# debuggery
[ "$VERBOSE" = "yes" ] && echo "Testing size of pointers ... ($*)"
# build and run a test program
test -d "$OUTDIR/config.tests/unix/ptrsize" || mkdir -p "$OUTDIR/config.tests/unix/ptrsize"
"$OUTDIR/bin/qmake" -nocache -spec "$QMKSPEC" "CONFIG-=app_bundle" "QMAKE_LFLAGS*=$LFLAGS" "QMAKE_CXXFLAGS*=$CXXFLAGS" "$SRCDIR/config.tests/unix/ptrsize/ptrsizetest.pro" -o "$OUTDIR/config.tests/unix/ptrsize/Makefile" >/dev/null 2>&1
cd "$OUTDIR/config.tests/unix/ptrsize"
if [ "$VERBOSE" = "yes" ]; then
($MAKE clean && $MAKE)
else
($MAKE clean && $MAKE) >/dev/null 2>&1
fi
RETVAL=$?
if [ "$RETVAL" -ne 0 ]; then
PTRSIZE=4
else
PTRSIZE=8
fi
# done
[ "$VERBOSE" = "yes" ] && echo "Pointer size: $PTRSIZE"
exit $PTRSIZE