config.tests/unix/fvisibility.test
author Eckhart Koeppen <eckhart.koppen@nokia.com>
Thu, 29 Apr 2010 15:15:16 +0300
branchRCL_3
changeset 16 4b6ee5efea19
parent 0 1918ee327afb
permissions -rwxr-xr-x
2010-17 9996a03743ab23f83c83c5bc7ade0f82f71b1506

#!/bin/sh

FVISIBILITY_SUPPORT=no
COMPILER=$1
VERBOSE=$2

RunCompileTest() {
    cat >>fvisibility.c << EOF
__attribute__((visibility("default"))) void blah();
#if !defined(__GNUC__)
# error "Visiblility support requires GCC"
#elif __GNUC__ < 4
# error "GCC3 with backported visibility patch is known to miscompile Qt"
#endif
EOF

    if [ "$VERBOSE" = "yes" ] ; then
        "$COMPILER" -c -fvisibility=hidden fvisibility.c && FVISIBILITY_SUPPORT=yes
    else
        "$COMPILER" -c -fvisibility=hidden fvisibility.c >/dev/null 2>&1 && FVISIBILITY_SUPPORT=yes
    fi
    rm -f fvisibility.c fvisibility.o
}

case "$COMPILER" in
aCC*)
    ;;

icpc)
    ICPC_VERSION=`icpc -dumpversion`
    case "$ICPC_VERSION" in
    8.*|9.*|10.0)
        # 8.x, 9.x, and 10.0 don't support symbol visibility
        ;;
    *)
        # the compile test works for the intel compiler because it mimics gcc's behavior
        RunCompileTest
        ;;
    esac
    ;;

    *)
    RunCompileTest
    ;;
esac

# done
if [ "$FVISIBILITY_SUPPORT" != "yes" ]; then
    [ "$VERBOSE" = "yes" ] && echo "Symbol visibility control disabled."
    exit 0
else
    [ "$VERBOSE" = "yes" ] && echo "Symbol visibility control enabled."
    exit 1
fi