equal
deleted
inserted
replaced
2 |
2 |
3 FVISIBILITY_SUPPORT=no |
3 FVISIBILITY_SUPPORT=no |
4 COMPILER=$1 |
4 COMPILER=$1 |
5 VERBOSE=$2 |
5 VERBOSE=$2 |
6 |
6 |
|
7 CMDLINE= |
|
8 |
|
9 |
7 RunCompileTest() { |
10 RunCompileTest() { |
8 cat >>fvisibility.c << EOF |
11 cat >>fvisibility.c << EOF |
9 __attribute__((visibility("default"))) void blah(); |
12 #if defined(__GNUC__) |
10 #if !defined(__GNUC__) |
13 # if (__GNUC__ < 4) |
11 # error "Visiblility support requires GCC" |
14 # error "GCC3 with backported visibility patch is known to miscompile Qt" |
12 #elif __GNUC__ < 4 |
15 # endif |
13 # error "GCC3 with backported visibility patch is known to miscompile Qt" |
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" |
14 #endif |
24 #endif |
15 EOF |
25 EOF |
16 |
26 |
17 if [ "$VERBOSE" = "yes" ] ; then |
27 if [ "$VERBOSE" = "yes" ] ; then |
18 "$COMPILER" -c -fvisibility=hidden fvisibility.c && FVISIBILITY_SUPPORT=yes |
28 "$COMPILER" -c $CMDLINE fvisibility.c && FVISIBILITY_SUPPORT=yes |
19 else |
29 else |
20 "$COMPILER" -c -fvisibility=hidden fvisibility.c >/dev/null 2>&1 && FVISIBILITY_SUPPORT=yes |
30 "$COMPILER" -c $CMDLINE fvisibility.c >/dev/null 2>&1 && FVISIBILITY_SUPPORT=yes |
21 fi |
31 fi |
22 rm -f fvisibility.c fvisibility.o |
32 rm -f fvisibility.c fvisibility.o |
23 } |
33 } |
24 |
34 |
|
35 |
25 case "$COMPILER" in |
36 case "$COMPILER" in |
|
37 gcc|g++) |
|
38 CMDLINE="-fvisibility=hidden" |
|
39 RunCompileTest |
|
40 ;; |
|
41 |
26 aCC*) |
42 aCC*) |
27 ;; |
43 ;; |
28 |
44 |
29 icpc) |
45 icpc) |
30 ICPC_VERSION=`icpc -dumpversion` |
46 ICPC_VERSION=`icpc -dumpversion` |
32 8.*|9.*|10.0) |
48 8.*|9.*|10.0) |
33 # 8.x, 9.x, and 10.0 don't support symbol visibility |
49 # 8.x, 9.x, and 10.0 don't support symbol visibility |
34 ;; |
50 ;; |
35 *) |
51 *) |
36 # the compile test works for the intel compiler because it mimics gcc's behavior |
52 # the compile test works for the intel compiler because it mimics gcc's behavior |
|
53 CMDLINE="-fvisibility=hidden" |
37 RunCompileTest |
54 RunCompileTest |
38 ;; |
55 ;; |
39 esac |
56 esac |
40 ;; |
57 ;; |
41 |
58 |
42 *) |
59 CC) |
43 RunCompileTest |
60 # This should be SunStudio. If not, it'll get caught. |
44 ;; |
61 CMDLINE="-xldscope=hidden" |
|
62 RunCompileTest |
|
63 ;; |
45 esac |
64 esac |
46 |
65 |
47 # done |
66 # done |
48 if [ "$FVISIBILITY_SUPPORT" != "yes" ]; then |
67 if [ "$FVISIBILITY_SUPPORT" != "yes" ]; then |
49 [ "$VERBOSE" = "yes" ] && echo "Symbol visibility control disabled." |
68 [ "$VERBOSE" = "yes" ] && echo "Symbol visibility control disabled." |