summaryrefslogtreecommitdiffstats
path: root/config.tests/unix/objcopy.test
blob: e2051a782342dac1927530bd85809ec0ce2a8084 (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
#!/bin/sh

TEST_PATH=`dirname "$0"`
SEP_DEBUG_SUPPORT=no
COMPILER=$1
QMAKE_OBJCOPY=$2
VERBOSE=$3

if [ -n "$QMAKE_OBJCOPY" ]; then
    echo "int main() { return 0; }" > objcopy_test.cpp
    if $TEST_PATH/which.test "$QMAKE_OBJCOPY" >/dev/null 2>&1 && $COMPILER -g -o objcopy_test objcopy_test.cpp >/dev/null 2>&1; then
        "$QMAKE_OBJCOPY" --only-keep-debug objcopy_test objcopy_test.debug >/dev/null 2>&1 \
            && "$QMAKE_OBJCOPY" --strip-debug objcopy_test >/dev/null 2>&1 \
            && "$QMAKE_OBJCOPY" --add-gnu-debuglink=objcopy_test.debug objcopy_test >/dev/null 2>&1 \
            && SEP_DEBUG_SUPPORT=yes 
    fi
    rm -f objcopy_test objcopy_test.debug objcopy_test.cpp
else
    [ "$VERBOSE" = "yes" ] && echo "Separate debug info check skipped, QMAKE_OBJCOPY is unset.";
fi

# done
if [ "$SEP_DEBUG_SUPPORT" != "yes" ]; then
    [ "$VERBOSE" = "yes" ] && echo "Separate debug info support disabled."
    exit 0
else
    [ "$VERBOSE" = "yes" ] && echo "Separate debug info support enabled."
    exit 1
fi