summaryrefslogtreecommitdiffstats
path: root/config.tests/unix/fvisibility.test
diff options
context:
space:
mode:
Diffstat (limited to 'config.tests/unix/fvisibility.test')
-rwxr-xr-xconfig.tests/unix/fvisibility.test54
1 files changed, 54 insertions, 0 deletions
diff --git a/config.tests/unix/fvisibility.test b/config.tests/unix/fvisibility.test
new file mode 100755
index 0000000..b2bcc07
--- /dev/null
+++ b/config.tests/unix/fvisibility.test
@@ -0,0 +1,54 @@
+#!/bin/sh
+
+FVISIBILITY_SUPPORT=no
+COMPILER=$1
+VERBOSE=$2
+
+RunCompileTest() {
+ cat >>fvisibility.c << EOF
+__attribute__((visibility("default"))) void blah();
+#if !defined(__GNUC__)
+# error "Visiblility support requires GCC"
+#elif __GNUC__ < 4
+# error "GCC3 with backported visibility patch is known to miscompile Qt"
+#endif
+EOF
+
+ if [ "$VERBOSE" = "yes" ] ; then
+ "$COMPILER" -c -fvisibility=hidden fvisibility.c && FVISIBILITY_SUPPORT=yes
+ else
+ "$COMPILER" -c -fvisibility=hidden fvisibility.c >/dev/null 2>&1 && FVISIBILITY_SUPPORT=yes
+ fi
+ rm -f fvisibility.c fvisibility.o
+}
+
+case "$COMPILER" in
+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
+ RunCompileTest
+ ;;
+ esac
+ ;;
+
+ *)
+ 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