config.tests/unix/fvisibility.test
changeset 0 1918ee327afb
child 30 5dc02b23752f
equal deleted inserted replaced
-1:000000000000 0:1918ee327afb
       
     1 #!/bin/sh
       
     2 
       
     3 FVISIBILITY_SUPPORT=no
       
     4 COMPILER=$1
       
     5 VERBOSE=$2
       
     6 
       
     7 RunCompileTest() {
       
     8     cat >>fvisibility.c << EOF
       
     9 __attribute__((visibility("default"))) void blah();
       
    10 #if !defined(__GNUC__)
       
    11 # error "Visiblility support requires GCC"
       
    12 #elif __GNUC__ < 4
       
    13 # error "GCC3 with backported visibility patch is known to miscompile Qt"
       
    14 #endif
       
    15 EOF
       
    16 
       
    17     if [ "$VERBOSE" = "yes" ] ; then
       
    18         "$COMPILER" -c -fvisibility=hidden fvisibility.c && FVISIBILITY_SUPPORT=yes
       
    19     else
       
    20         "$COMPILER" -c -fvisibility=hidden fvisibility.c >/dev/null 2>&1 && FVISIBILITY_SUPPORT=yes
       
    21     fi
       
    22     rm -f fvisibility.c fvisibility.o
       
    23 }
       
    24 
       
    25 case "$COMPILER" in
       
    26 aCC*)
       
    27     ;;
       
    28 
       
    29 icpc)
       
    30     ICPC_VERSION=`icpc -dumpversion`
       
    31     case "$ICPC_VERSION" in
       
    32     8.*|9.*|10.0)
       
    33         # 8.x, 9.x, and 10.0 don't support symbol visibility
       
    34         ;;
       
    35     *)
       
    36         # the compile test works for the intel compiler because it mimics gcc's behavior
       
    37         RunCompileTest
       
    38         ;;
       
    39     esac
       
    40     ;;
       
    41 
       
    42     *)
       
    43     RunCompileTest
       
    44     ;;
       
    45 esac
       
    46 
       
    47 # done
       
    48 if [ "$FVISIBILITY_SUPPORT" != "yes" ]; then
       
    49     [ "$VERBOSE" = "yes" ] && echo "Symbol visibility control disabled."
       
    50     exit 0
       
    51 else
       
    52     [ "$VERBOSE" = "yes" ] && echo "Symbol visibility control enabled."
       
    53     exit 1
       
    54 fi