Merge branch 'master' of scm.dev.nokia.troll.no:qt/oslo-staging-1 into master-integration
[qt-netbsd.git] / config.tests / unix / fvisibility.test
blob99e6fbe881f11b3089b270fdd968856b434a07f9
1 #!/bin/sh
3 FVISIBILITY_SUPPORT=no
4 COMPILER=$1
5 VERBOSE=$2
7 CMDLINE=
10 RunCompileTest() {
11 cat >>fvisibility.c << EOF
12 #if defined(__GNUC__)
13 # if (__GNUC__ < 4)
14 # error "GCC3 with backported visibility patch is known to miscompile Qt"
15 # endif
16 __attribute((visibility("default"))) void blah();
17 #elif defined(__SUNPRO_CC)
18 # if (__SUNPRO_CC < 0x0550)
19 # error "SunStudio 8 or later is required for ELF visibility"
20 # endif
21 __global void blah();
22 #else
23 # error "GCC4+ or SunStudio 8+ are required to support ELF visibility"
24 #endif
25 EOF
27 if [ "$VERBOSE" = "yes" ] ; then
28 "$COMPILER" -c $CMDLINE fvisibility.c && FVISIBILITY_SUPPORT=yes
29 else
30 "$COMPILER" -c $CMDLINE fvisibility.c >/dev/null 2>&1 && FVISIBILITY_SUPPORT=yes
32 rm -f fvisibility.c fvisibility.o
36 case "$COMPILER" in
37 gcc|g++)
38 CMDLINE="-fvisibility=hidden"
39 RunCompileTest
42 aCC*)
45 icpc)
46 ICPC_VERSION=`icpc -dumpversion`
47 case "$ICPC_VERSION" in
48 8.*|9.*|10.0)
49 # 8.x, 9.x, and 10.0 don't support symbol visibility
52 # the compile test works for the intel compiler because it mimics gcc's behavior
53 CMDLINE="-fvisibility=hidden"
54 RunCompileTest
56 esac
59 CC)
60 # This should be SunStudio. If not, it'll get caught.
61 CMDLINE="-xldscope=hidden"
62 RunCompileTest
64 esac
66 # done
67 if [ "$FVISIBILITY_SUPPORT" != "yes" ]; then
68 [ "$VERBOSE" = "yes" ] && echo "Symbol visibility control disabled."
69 exit 0
70 else
71 [ "$VERBOSE" = "yes" ] && echo "Symbol visibility control enabled."
72 exit 1