summaryrefslogtreecommitdiffstats
path: root/config.tests/mac/defaultarch.test
blob: 4502af7a7761f98dadc5d4eb96364a399d715a2d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#!/bin/sh

COMPILER=$1
VERBOSE=$2
WORKDIR=$3
QT_MAC_DEFUALT_ARCH=

touch defaultarch.c

# compile something and run 'file' on it.
if "$COMPILER" -c defaultarch.c 2>/dev/null 1>&2; then
    FIlE_OUTPUT=`file defaultarch.o`
    [ "$VERBOSE" = "yes" ] && echo "'file' reports compiler ($COMPILER) default architechture as: $FIlE_OUTPUT"

fi
rm -f defaultarch.c defaultarch.o

# detect our known archs.
if echo "$FIlE_OUTPUT" | grep '\<i386\>' > /dev/null 2>&1; then
    QT_MAC_DEFUALT_ARCH=x86 # configure knows it as "x86" not "i386"
fi
if echo "$FIlE_OUTPUT" | grep '\<x86_64\>' > /dev/null 2>&1; then
    QT_MAC_DEFUALT_ARCH=x86_64
fi
if echo "$FIlE_OUTPUT" | grep '\<ppc\>' > /dev/null 2>&1; then
    QT_MAC_DEFUALT_ARCH=ppc
fi
if echo "$FIlE_OUTPUT" | grep '\<ppc64\>' > /dev/null 2>&1; then
    QT_MAC_DEFUALT_ARCH=ppc64
fi

[ "$VERBOSE" = "yes" ] && echo "setting QT_MAC_DEFUALT_ARCH to \"$QT_MAC_DEFUALT_ARCH\""
export QT_MAC_DEFUALT_ARCH