source: trunk/config.tests/unix/fvisibility.test

Last change on this file was 846, checked in by Dmitry A. Kuminov, 14 years ago

trunk: Merged in qt 4.7.2 sources from branches/vendor/nokia/qt.

  • Property svn:executable set to *
File size: 1.6 KB
Line 
1#!/bin/sh
2
3FVISIBILITY_SUPPORT=no
4COMPILER=$1
5VERBOSE=$2
6
7CMDLINE=
8
9
10RunCompileTest() {
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
25EOF
26
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
31 fi
32 rm -f fvisibility.c fvisibility.o
33}
34
35
36case "$COMPILER" in
37*g++*|*c++*)
38 CMDLINE="-fvisibility=hidden"
39 RunCompileTest
40 ;;
41
42aCC*)
43 ;;
44
45icpc)
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
50 ;;
51 *)
52 # the compile test works for the intel compiler because it mimics gcc's behavior
53 CMDLINE="-fvisibility=hidden"
54 RunCompileTest
55 ;;
56 esac
57 ;;
58
59CC)
60 # This should be SunStudio. If not, it'll get caught.
61 CMDLINE="-xldscope=hidden"
62 RunCompileTest
63 ;;
64esac
65
66# done
67if [ "$FVISIBILITY_SUPPORT" != "yes" ]; then
68 [ "$VERBOSE" = "yes" ] && echo "Symbol visibility control disabled."
69 exit 0
70else
71 [ "$VERBOSE" = "yes" ] && echo "Symbol visibility control enabled."
72 exit 1
73fi
Note: See TracBrowser for help on using the repository browser.