summaryrefslogtreecommitdiffstats
path: root/config.tests/mac/dwarf2.test
blob: a640b113de5d17815e22f2b44a054d032a0cdc1e (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
34
35
36
37
38
39
40
41
42
#!/bin/sh

DWARF2_SUPPORT=no
DWARF2_SUPPORT_BROKEN=no
COMPILER=$1
VERBOSE=$2
WORKDIR=$3

touch dwarf2.c

if "$COMPILER" -c dwarf2.c -Werror -gdwarf-2 2>/dev/null 1>&2; then
    if "$COMPILER" -c dwarf2.c -Werror -gdwarf-2  2>&1 | grep "unsupported" >/dev/null ; then
        true
    else
        DWARF2_SUPPORT=yes
    fi
fi
rm -f dwarf2.c dwarf2.o

# Test for xcode 2.4.0, which has a broken implementation of DWARF
"$COMPILER" $WORKDIR/xcodeversion.cpp -o xcodeversion -framework Carbon;
./xcodeversion

if [ "$?" == "1" ]; then
    DWARF2_SUPPORT_BROKEN=yes
fi

rm xcodeversion

# done
if [ "$DWARF2_SUPPORT" != "yes" ]; then
    [ "$VERBOSE" = "yes" ] && echo "DWARF2 debug symbols disabled."
    exit 0
else
    if [ "$DWARF2_SUPPORT_BROKEN" == "yes" ]; then
        [ "$VERBOSE" = "yes" ] && echo "DWARF2 debug symbols disabled."
        exit 0
    else
        [ "$VERBOSE" = "yes" ] && echo "DWARF2 debug symbols enabled."
        exit 1
    fi
fi