summaryrefslogtreecommitdiff
path: root/source4/build/m4
diff options
context:
space:
mode:
Diffstat (limited to 'source4/build/m4')
-rw-r--r--source4/build/m4/check_cc.m429
1 files changed, 18 insertions, 11 deletions
diff --git a/source4/build/m4/check_cc.m4 b/source4/build/m4/check_cc.m4
index 33bb7050af..72a882b7d8 100644
--- a/source4/build/m4/check_cc.m4
+++ b/source4/build/m4/check_cc.m4
@@ -115,18 +115,25 @@ AC_TRY_RUN([#include "${srcdir-.}/build/tests/trivial.c"],
#
# Check if the compiler support ELF visibility for symbols
#
+
visibility_attribute=no
-AC_MSG_CHECKING([whether the C compiler supports the visibility attribute])
-AC_TRY_RUN([
-#pragma GCC visibility push(hidden)
-void vis_foo1(void) {}
-__attribute__((visibility("default"))) void vis_foo2(void) {}
-#include "${srcdir-.}/build/tests/trivial.c"
-], [
- AC_MSG_RESULT(yes)
- AC_DEFINE(HAVE_VISIBILITY_ATTR,1,[Whether the C compiler supports the visibility attribute])
- visibility_attribute=yes
-], [AC_MSG_RESULT(no);])
+if test x"$GCC" = x"yes" ; then
+ AX_CFLAGS_GCC_OPTION([-fvisibility=hidden], VISIBILITY_CFLAGS)
+fi
+
+if test -n "$VISIBILITY_CFLAGS"; then
+ AC_MSG_CHECKING([whether the C compiler supports the visibility attribute])
+ AC_TRY_RUN([
+ #pragma GCC visibility push(hidden)
+ void vis_foo1(void) {}
+ __attribute__((visibility("default"))) void vis_foo2(void) {}
+ #include "${srcdir-.}/build/tests/trivial.c"
+ ], [
+ AC_MSG_RESULT(yes)
+ AC_DEFINE(HAVE_VISIBILITY_ATTR,1,[Whether the C compiler supports the visibility attribute])
+ visibility_attribute=yes
+ ], [AC_MSG_RESULT(no);])
+fi
AC_SUBST(visibility_attribute)
#