summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Lynagh <igloo@earth.li>2010-11-23 17:05:41 +0000
committerIan Lynagh <igloo@earth.li>2010-11-23 17:05:41 +0000
commitb6fff39114fee90b806ed2e29cc8f5d9728d85a8 (patch)
tree92f4f95006b3c9ab13048031c5b2a135efa2236a
parent7267a7862cc406e593c89e79a4d5ab064ac40120 (diff)
downloadhaskell-b6fff39114fee90b806ed2e29cc8f5d9728d85a8.tar.gz
Add a configure test for the visibility hidden attribute
-rw-r--r--aclocal.m418
-rw-r--r--configure.ac2
-rw-r--r--includes/Rts.h2
-rw-r--r--rts/BeginPrivate.h2
-rw-r--r--rts/EndPrivate.h2
5 files changed, 23 insertions, 3 deletions
diff --git a/aclocal.m4 b/aclocal.m4
index c50d3481da..288fd83208 100644
--- a/aclocal.m4
+++ b/aclocal.m4
@@ -35,6 +35,24 @@ AC_DEFUN([FPTOOLS_SET_C_LD_FLAGS],
])
+# FP_VISIBILITY_HIDDEN
+# ----------------------------------
+# Is the visibility hidden attribute supported?
+AC_DEFUN([FP_VISIBILITY_HIDDEN],
+[
+ AC_MSG_CHECKING([whether __attribute__((visibility("hidden"))) is supported])
+ echo '__attribute__((visibility("hidden"))) void foo(void) {}' > conftest.c
+ if $CC -Wall -Werror -c conftest.c > /dev/null 2>&1
+ then
+ AC_MSG_RESULT([yes])
+ AC_DEFINE(HAS_VISIBILITY_HIDDEN, 1, [Has visibility hidden])
+ else
+ AC_MSG_RESULT([no])
+ fi
+ rm -f conftest.c conftest.o
+])
+
+
# FPTOOLS_FLOAT_WORD_ORDER_BIGENDIAN
# ----------------------------------
# Little endian Arm on Linux with some ABIs has big endian word order
diff --git a/configure.ac b/configure.ac
index b09c5a7e90..5e887772c0 100644
--- a/configure.ac
+++ b/configure.ac
@@ -835,6 +835,8 @@ AC_COMPILE_IFELSE(
[AC_MSG_RESULT(no)])
CFLAGS="$CFLAGS2"
+FP_VISIBILITY_HIDDEN
+
dnl ** check for librt
AC_CHECK_LIB(rt, clock_gettime)
AC_CHECK_FUNCS(clock_gettime timer_create timer_settime)
diff --git a/includes/Rts.h b/includes/Rts.h
index 394eb9710f..51351fab0d 100644
--- a/includes/Rts.h
+++ b/includes/Rts.h
@@ -51,7 +51,7 @@ extern "C" {
// Symbols that are extern, but private to the RTS, are declared
// with visibility "hidden" to hide them outside the RTS shared
// library.
-#if !defined(mingw32_HOST_OS)
+#if defined(HAS_VISIBILITY_HIDDEN)
#define RTS_PRIVATE GNUC3_ATTRIBUTE(visibility("hidden"))
#else
#define RTS_PRIVATE /* disabled: RTS_PRIVATE */
diff --git a/rts/BeginPrivate.h b/rts/BeginPrivate.h
index 6a7ca5fb8f..6471b92a40 100644
--- a/rts/BeginPrivate.h
+++ b/rts/BeginPrivate.h
@@ -5,6 +5,6 @@
/* On Windows, with gcc 4.5.0-1, using visibility hidden gives:
error: visibility attribute not supported in this configuration; ignored
*/
-#if __GNUC__ >= 4 && !defined(freebsd_HOST_OS) && !defined(mingw32_HOST_OS)
+#if defined(HAS_VISIBILITY_HIDDEN) && !defined(freebsd_HOST_OS)
#pragma GCC visibility push(hidden)
#endif
diff --git a/rts/EndPrivate.h b/rts/EndPrivate.h
index f0080beee5..4cfb68f0ba 100644
--- a/rts/EndPrivate.h
+++ b/rts/EndPrivate.h
@@ -1,3 +1,3 @@
-#if __GNUC__ >= 4 && !defined(freebsd_HOST_OS) && !defined(mingw32_HOST_OS)
+#if defined(HAS_VISIBILITY_HIDDEN) && !defined(freebsd_HOST_OS)
#pragma GCC visibility pop
#endif