svn commit: samba r12836 - in branches/SAMBA_4_0/source: . build/m4

metze at samba.org metze at samba.org
Wed Jan 11 00:56:50 GMT 2006


Author: metze
Date: 2006-01-11 00:56:49 +0000 (Wed, 11 Jan 2006)
New Revision: 12836

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=12836

Log:
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
Modified:
   branches/SAMBA_4_0/source/build/m4/check_cc.m4
   branches/SAMBA_4_0/source/configure.in


Changeset:
Modified: branches/SAMBA_4_0/source/build/m4/check_cc.m4
===================================================================
--- branches/SAMBA_4_0/source/build/m4/check_cc.m4	2006-01-10 22:22:55 UTC (rev 12835)
+++ branches/SAMBA_4_0/source/build/m4/check_cc.m4	2006-01-11 00:56:49 UTC (rev 12836)
@@ -117,6 +117,25 @@
 	    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
 #

Modified: branches/SAMBA_4_0/source/configure.in
===================================================================
--- branches/SAMBA_4_0/source/configure.in	2006-01-10 22:22:55 UTC (rev 12835)
+++ branches/SAMBA_4_0/source/configure.in	2006-01-11 00:56:49 UTC (rev 12836)
@@ -53,8 +53,8 @@
 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



More information about the samba-cvs mailing list