0
|
1 |
#!/bin/sh
|
|
2 |
|
|
3 |
DWARF2_SUPPORT=no
|
|
4 |
DWARF2_SUPPORT_BROKEN=no
|
|
5 |
COMPILER=$1
|
|
6 |
VERBOSE=$2
|
|
7 |
WORKDIR=$3
|
|
8 |
|
|
9 |
touch dwarf2.c
|
|
10 |
|
|
11 |
if "$COMPILER" -c dwarf2.c -Werror -gdwarf-2 2>/dev/null 1>&2; then
|
|
12 |
if "$COMPILER" -c dwarf2.c -Werror -gdwarf-2 2>&1 | grep "unsupported" >/dev/null ; then
|
|
13 |
true
|
|
14 |
else
|
|
15 |
DWARF2_SUPPORT=yes
|
|
16 |
fi
|
|
17 |
fi
|
|
18 |
rm -f dwarf2.c dwarf2.o
|
|
19 |
|
|
20 |
# Test for xcode 2.4.0, which has a broken implementation of DWARF
|
|
21 |
"$COMPILER" $WORKDIR/xcodeversion.cpp -o xcodeversion -framework Carbon;
|
|
22 |
./xcodeversion
|
|
23 |
|
|
24 |
if [ "$?" == "1" ]; then
|
|
25 |
DWARF2_SUPPORT_BROKEN=yes
|
|
26 |
fi
|
|
27 |
|
|
28 |
rm xcodeversion
|
|
29 |
|
|
30 |
# done
|
|
31 |
if [ "$DWARF2_SUPPORT" != "yes" ]; then
|
|
32 |
[ "$VERBOSE" = "yes" ] && echo "DWARF2 debug symbols disabled."
|
|
33 |
exit 0
|
|
34 |
else
|
|
35 |
if [ "$DWARF2_SUPPORT_BROKEN" == "yes" ]; then
|
|
36 |
[ "$VERBOSE" = "yes" ] && echo "DWARF2 debug symbols disabled."
|
|
37 |
exit 0
|
|
38 |
else
|
|
39 |
[ "$VERBOSE" = "yes" ] && echo "DWARF2 debug symbols enabled."
|
|
40 |
exit 1
|
|
41 |
fi
|
|
42 |
fi
|