svn commit: samba r13898 - in branches/SAMBA_4_0/source: build/m4 build/smb_build lib/registry script

jelmer at samba.org jelmer at samba.org
Mon Mar 6 21:14:42 GMT 2006


Author: jelmer
Date: 2006-03-06 21:14:41 +0000 (Mon, 06 Mar 2006)
New Revision: 13898

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

Log:
Add a subsystem-specific DEFAULT_VISIBILITY property that can be used 
to not export symbols when building shared libraries. Symbols that have to be 
available to users of the library can be explicitly exported by 
prepending them with _PUBLIC_ in the C source.

Modified:
   branches/SAMBA_4_0/source/build/m4/check_cc.m4
   branches/SAMBA_4_0/source/build/smb_build/TODO
   branches/SAMBA_4_0/source/build/smb_build/cflags.pm
   branches/SAMBA_4_0/source/build/smb_build/config_mk.pm
   branches/SAMBA_4_0/source/build/smb_build/input.pm
   branches/SAMBA_4_0/source/build/smb_build/main.pl
   branches/SAMBA_4_0/source/build/smb_build/output.pm
   branches/SAMBA_4_0/source/lib/registry/config.mk
   branches/SAMBA_4_0/source/script/mkproto.pl


Changeset:
Modified: branches/SAMBA_4_0/source/build/m4/check_cc.m4
===================================================================
--- branches/SAMBA_4_0/source/build/m4/check_cc.m4	2006-03-06 20:24:05 UTC (rev 13897)
+++ branches/SAMBA_4_0/source/build/m4/check_cc.m4	2006-03-06 21:14:41 UTC (rev 13898)
@@ -39,15 +39,11 @@
 	dnl Check whether the compiler can generate precompiled headers
 	touch conftest.h
 	if ${CC-cc} conftest.h 2> /dev/null && test -f conftest.h.gch; then
-		samba_cv_precompiled_headers=yes
+		precompiled_headers=yes
 	else
-		samba_cv_precompiled_headers=no
+		precompiled_headers=no
 	fi])
-PCH_AVAILABLE="#"
-if test x"$samba_cv_precompiled_headers" = x"yes"; then
-	PCH_AVAILABLE=""
-fi
-AC_SUBST(PCH_AVAILABLE)
+AC_SUBST(precompiled_headers)
 
 
 dnl Check if the C compiler understands volatile (it should, being ANSI).
@@ -119,23 +115,19 @@
 #
 # 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}"
-	AC_MSG_CHECKING([whether the C compiler supports the visibility attribute])
-	AC_TRY_RUN([
+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])], 
-[AC_MSG_RESULT(no);VISIBILITY_CFLAGS=""])
-	CFLAGS="${OLD_CFLAGS}"
-fi
+], [
+	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);])
+AC_SUBST(visibility_attribute)
 
 #
 # Check if the compiler can handle the options we selected by

Modified: branches/SAMBA_4_0/source/build/smb_build/TODO
===================================================================
--- branches/SAMBA_4_0/source/build/smb_build/TODO	2006-03-06 20:24:05 UTC (rev 13897)
+++ branches/SAMBA_4_0/source/build/smb_build/TODO	2006-03-06 21:14:41 UTC (rev 13898)
@@ -1,11 +1,6 @@
-- split up proto.h into headers with public or private prototypes. 
-  Public prototypes can be marked with _PUBLIC_ in the source
-   - get rid of include/structs.h
-- install Samba-specific headers in $INCLUDEDIR/samba-4.0. talloc.h, tdb.h and 
-	ldb.h belong in $INCLUDEDIR
+- get rid of include/structs.h
 - add register function to smbtorture
 - install shared modules
 - improve (un)install scripts (rewrite in perl?)
 - proper #include dependencies
 - determine dependencies from #include lines ?
-- clean up include/smb.h

Modified: branches/SAMBA_4_0/source/build/smb_build/cflags.pm
===================================================================
--- branches/SAMBA_4_0/source/build/smb_build/cflags.pm	2006-03-06 20:24:05 UTC (rev 13897)
+++ branches/SAMBA_4_0/source/build/smb_build/cflags.pm	2006-03-06 21:14:41 UTC (rev 13898)
@@ -15,6 +15,7 @@
 	foreach my $key (values %{$CTX}) {
 		next unless defined ($key->{OBJ_LIST});
 		next unless defined ($key->{EXTRA_CFLAGS});
+		next if ($key->{EXTRA_CFLAGS} eq "");
 
 		foreach (@{$key->{OBJ_LIST}}) {
 			print CFLAGS_TXT "$_: $key->{EXTRA_CFLAGS}\n";

Modified: branches/SAMBA_4_0/source/build/smb_build/config_mk.pm
===================================================================
--- branches/SAMBA_4_0/source/build/smb_build/config_mk.pm	2006-03-06 20:24:05 UTC (rev 13897)
+++ branches/SAMBA_4_0/source/build/smb_build/config_mk.pm	2006-03-06 21:14:41 UTC (rev 13898)
@@ -35,6 +35,8 @@
 		"PUBLIC_HEADERS"	=> "list",
 
 		"EXTRA_CFLAGS"		=> "string",
+
+		"DEFAULT_VISIBILITY" => "string"
 		},
 	"MODULE" => {
 		"SUBSYSTEM"		=> "string",
@@ -92,7 +94,9 @@
 		"PUBLIC_PROTO_HEADER"	=> "string",
 		"PRIVATE_PROTO_HEADER"	=> "string",
 
-		"EXTRA_CFLAGS"		=> "string"
+		"EXTRA_CFLAGS"		=> "string",
+
+		"DEFAULT_VISIBILITY" => "string"
 		}
 };
 

Modified: branches/SAMBA_4_0/source/build/smb_build/input.pm
===================================================================
--- branches/SAMBA_4_0/source/build/smb_build/input.pm	2006-03-06 20:24:05 UTC (rev 13897)
+++ branches/SAMBA_4_0/source/build/smb_build/input.pm	2006-03-06 21:14:41 UTC (rev 13898)
@@ -154,6 +154,14 @@
 		if (defined($part->{PRIVATE_PROTO_HEADER})) {
 			$part->{NOPROTO} = "YES";
 		}
+
+		unless (defined($part->{DEFAULT_VISIBILITY})) {
+			$part->{DEFAULT_VISIBILITY} = "default";
+		}
+
+		unless (defined($part->{EXTRA_CFLAGS})) {
+			$part->{EXTRA_CFLAGS} = "";
+		}
 		
 		if (defined($part->{PUBLIC_PROTO_HEADER})) {
 			$part->{NOPROTO} = "YES";

Modified: branches/SAMBA_4_0/source/build/smb_build/main.pl
===================================================================
--- branches/SAMBA_4_0/source/build/smb_build/main.pl	2006-03-06 20:24:05 UTC (rev 13897)
+++ branches/SAMBA_4_0/source/build/smb_build/main.pl	2006-03-06 21:14:41 UTC (rev 13898)
@@ -57,7 +57,7 @@
 
 my $DEPEND = smb_build::input::check($INPUT, \%config::enabled, 
 	$subsystem_output_type, $library_output_type, $module_output_type);
-my $OUTPUT = output::create_output($DEPEND);
+my $OUTPUT = output::create_output($DEPEND, \%config::config);
 $config::config{SUBSYSTEM_OUTPUT_TYPE} = $subsystem_output_type;
 $config::config{LIBRARY_OUTPUT_TYPE} = $library_output_type;
 $config::config{MODULE_OUTPUT_TYPE} = $module_output_type;

Modified: branches/SAMBA_4_0/source/build/smb_build/output.pm
===================================================================
--- branches/SAMBA_4_0/source/build/smb_build/output.pm	2006-03-06 20:24:05 UTC (rev 13897)
+++ branches/SAMBA_4_0/source/build/smb_build/output.pm	2006-03-06 21:14:41 UTC (rev 13898)
@@ -92,9 +92,9 @@
 	$bin->{BINARY} = $bin->{NAME};
 }
 
-sub create_output($)
+sub create_output($$)
 {
-	my $depend = shift;
+	my ($depend, $config) = @_;
 	my $part;
 
 	foreach $part (values %{$depend}) {
@@ -111,6 +111,11 @@
 			$part->{OUTPUT_TYPE} = "OBJLIST";
 		}
 
+		if ($part->{DEFAULT_VISIBILITY} ne "default" and 
+			$config->{visibility_attribute} eq "yes") {
+			$part->{EXTRA_CFLAGS} .= " -fvisibility=$part->{DEFAULT_VISIBILITY}";
+		}
+
 		generate_binary($part) if $part->{OUTPUT_TYPE} eq "BINARY";
 		generate_mergedobj($part) if $part->{OUTPUT_TYPE} eq "MERGEDOBJ";
 		generate_objlist($part) if $part->{OUTPUT_TYPE} eq "OBJLIST";

Modified: branches/SAMBA_4_0/source/lib/registry/config.mk
===================================================================
--- branches/SAMBA_4_0/source/lib/registry/config.mk	2006-03-06 20:24:05 UTC (rev 13897)
+++ branches/SAMBA_4_0/source/lib/registry/config.mk	2006-03-06 21:14:41 UTC (rev 13898)
@@ -82,6 +82,7 @@
 ################################################
 # Start SUBSYSTEM REGISTRY
 [LIBRARY::REGISTRY]
+DEFAULT_VISIBILITY = hidden
 MAJOR_VERSION = 0
 MINOR_VERSION = 0
 DESCRIPTION = Windows-style registry library

Modified: branches/SAMBA_4_0/source/script/mkproto.pl
===================================================================
--- branches/SAMBA_4_0/source/script/mkproto.pl	2006-03-06 20:24:05 UTC (rev 13897)
+++ branches/SAMBA_4_0/source/script/mkproto.pl	2006-03-06 21:14:41 UTC (rev 13898)
@@ -133,7 +133,7 @@
 
 		next if ($line =~ /^\/|[;]/);
 
-		if ($line =~ s/^_PUBLIC_[\t ]/extern /) {
+		if ($line =~ /^_PUBLIC_[\t ]/) {
 			$target = $public_file;
 			$is_public = 1;
 		}



More information about the samba-cvs mailing list