diff options
Diffstat (limited to 'source4/build')
-rw-r--r-- | source4/build/m4/check_cc.m4 | 29 | ||||
-rw-r--r-- | source4/build/smb_build/output.pm | 4 |
2 files changed, 20 insertions, 13 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) # diff --git a/source4/build/smb_build/output.pm b/source4/build/smb_build/output.pm index 6b3753aa9f..bd2b3eeca9 100644 --- a/source4/build/smb_build/output.pm +++ b/source4/build/smb_build/output.pm @@ -111,8 +111,8 @@ sub create_output($$) $part->{OUTPUT_TYPE} = "OBJLIST"; } - if ($part->{DEFAULT_VISIBILITY} ne "default" and - $config->{visibility_attribute} eq "yes") { + if (($part->{DEFAULT_VISIBILITY} ne "default") and + ($config->{visibility_attribute} eq "yes")) { $part->{EXTRA_CFLAGS} .= " -fvisibility=$part->{DEFAULT_VISIBILITY}"; } |