summaryrefslogtreecommitdiffstats
path: root/config.tests/unix/fvisibility.test
diff options
context:
space:
mode:
authorQt by Nokia <qt-info@nokia.com>2011-04-27 12:05:43 +0200
committeraxis <qt-info@nokia.com>2011-04-27 12:05:43 +0200
commit38be0d13830efd2d98281c645c3a60afe05ffece (patch)
tree6ea73f3ec77f7d153333779883e8120f82820abe /config.tests/unix/fvisibility.test
Initial import from the monolithic Qt.
This is the beginning of revision history for this module. If you want to look at revision history older than this, please refer to the Qt Git wiki for how to use Git history grafting. At the time of writing, this wiki is located here: http://qt.gitorious.org/qt/pages/GitIntroductionWithQt If you have already performed the grafting and you don't see any history beyond this commit, try running "git log" with the "--follow" argument. Branched from the monolithic repo, Qt master branch, at commit 896db169ea224deb96c59ce8af800d019de63f12
Diffstat (limited to 'config.tests/unix/fvisibility.test')
-rwxr-xr-xconfig.tests/unix/fvisibility.test73
1 files changed, 73 insertions, 0 deletions
diff --git a/config.tests/unix/fvisibility.test b/config.tests/unix/fvisibility.test
new file mode 100755
index 0000000000..27c6841082
--- /dev/null
+++ b/config.tests/unix/fvisibility.test
@@ -0,0 +1,73 @@
+#!/bin/sh
+
+FVISIBILITY_SUPPORT=no
+COMPILER=$1
+VERBOSE=$2
+
+CMDLINE=
+
+
+RunCompileTest() {
+ cat >>fvisibility.c << EOF
+#if defined(__GNUC__)
+# if (__GNUC__ < 4)
+# error "GCC3 with backported visibility patch is known to miscompile Qt"
+# endif
+__attribute((visibility("default"))) void blah();
+#elif defined(__SUNPRO_CC)
+# if (__SUNPRO_CC < 0x0550)
+# error "SunStudio 8 or later is required for ELF visibility"
+# endif
+__global void blah();
+#else
+# error "GCC4+ or SunStudio 8+ are required to support ELF visibility"
+#endif
+EOF
+
+ if [ "$VERBOSE" = "yes" ] ; then
+ "$COMPILER" -c $CMDLINE fvisibility.c && FVISIBILITY_SUPPORT=yes
+ else
+ "$COMPILER" -c $CMDLINE fvisibility.c >/dev/null 2>&1 && FVISIBILITY_SUPPORT=yes
+ fi
+ rm -f fvisibility.c fvisibility.o
+}
+
+
+case "$COMPILER" in
+*g++*|*c++*)
+ CMDLINE="-fvisibility=hidden"
+ RunCompileTest
+ ;;
+
+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
+ CMDLINE="-fvisibility=hidden"
+ RunCompileTest
+ ;;
+ esac
+ ;;
+
+CC)
+ # This should be SunStudio. If not, it'll get caught.
+ CMDLINE="-xldscope=hidden"
+ 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