diff options
author | Stefan Metzmacher <metze@samba.org> | 2006-01-11 00:56:49 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 13:50:04 -0500 |
commit | eab4a561974eb54796a0a51f11f7167f8d2a7e0c (patch) | |
tree | df0bcfb448e5b00bfdeffa0876c50427e2ce30ae | |
parent | 2470034e545415537780cd1bba5284f4c58c3112 (diff) | |
download | samba-eab4a561974eb54796a0a51f11f7167f8d2a7e0c.tar.gz samba-eab4a561974eb54796a0a51f11f7167f8d2a7e0c.tar.bz2 samba-eab4a561974eb54796a0a51f11f7167f8d2a7e0c.zip |
r12836: use: -fvisibility=hidden -D_PUBLIC_="__attribute__((visibility(\"default\")))"
if the compiler supports it, this will cause that modules can only access
public functions (gcc 4 supports this)
metze
(This used to be commit bcf4c362556b8168fc0b63af5708e4a78c7b93fb)
-rw-r--r-- | source4/build/m4/check_cc.m4 | 19 | ||||
-rw-r--r-- | source4/configure.in | 4 |
2 files changed, 21 insertions, 2 deletions
diff --git a/source4/build/m4/check_cc.m4 b/source4/build/m4/check_cc.m4 index aa6c8752ed..7551b67b17 100644 --- a/source4/build/m4/check_cc.m4 +++ b/source4/build/m4/check_cc.m4 @@ -117,6 +117,25 @@ AC_TRY_RUN([#include "${srcdir-.}/build/tests/trivial.c"], AC_MSG_WARN([cannot run when cross-compiling])) # +# Check if the compiler support ELF visibility for symbols +# +if test x"$GCC" = x"yes" ; then + AX_CFLAGS_GCC_OPTION([-fvisibility=hidden], VISIBILITY_CFLAGS) +fi +if test -n "$VISIBILITY_CFLAGS"; then + OLD_CFLAGS="${CFLAGS}" + CFLAGS="${CFLAGS} ${VISIBILITY_CFLAGS} -D_PUBLIC_=__attribute__((visibility(\"default\")))" + VISIBILITY_CFLAGS="${VISIBILITY_CFLAGS} -D_PUBLIC_=\"__attribute__((visibility(\\\"default\\\")))\"" + AC_MSG_CHECKING([that the C compiler can use the VISIBILITY_CFLAGS]) + AC_TRY_RUN([ + _PUBLIC_ void vis_foo1(void) {} + __attribute__((visibility("default"))) void vis_foo2(void) {} + #include "${srcdir-.}/build/tests/trivial.c" + ], AC_MSG_RESULT(yes), [AC_MSG_RESULT(no);VISIBILITY_CFLAGS=""]) + CFLAGS="${OLD_CFLAGS}" +fi + +# # Check if the compiler can handle the options we selected by # --enable-*developer # diff --git a/source4/configure.in b/source4/configure.in index bd64cdf184..7fb6ccf38a 100644 --- a/source4/configure.in +++ b/source4/configure.in @@ -53,8 +53,8 @@ if test "${ac_cv_prog_CC}" = "insure"; then fi ################################################# -# add DEVELOPER_CFLAGS only for the real build -CFLAGS="${CFLAGS} ${DEVELOPER_CFLAGS}" +# add *_CFLAGS only for the real build +CFLAGS="${CFLAGS} ${VISIBILITY_CFLAGS} ${DEVELOPER_CFLAGS}" ################################################# # final configure stuff |