summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--source4/build/m4/check_cc.m419
-rw-r--r--source4/configure.in4
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