summaryrefslogtreecommitdiff
path: root/source4
diff options
context:
space:
mode:
Diffstat (limited to 'source4')
-rw-r--r--source4/build/m4/check_ld.m47
-rw-r--r--source4/build/smb_build/config_mk.pm2
-rw-r--r--source4/build/smb_build/input.pm13
-rw-r--r--source4/build/smb_build/main.pl27
-rw-r--r--source4/build/smb_build/makefile.pm17
-rw-r--r--source4/build/smb_build/output.pm24
-rw-r--r--source4/build/smb_build/summary.pm6
7 files changed, 45 insertions, 51 deletions
diff --git a/source4/build/m4/check_ld.m4 b/source4/build/m4/check_ld.m4
index e44c29d0e3..9428f62040 100644
--- a/source4/build/m4/check_ld.m4
+++ b/source4/build/m4/check_ld.m4
@@ -185,10 +185,3 @@ AC_TRY_RUN([#include "${srcdir-.}/build/tests/trivial.c"],
AC_MSG_RESULT(yes),
AC_MSG_ERROR([we cannot link with the selected cc and ld flags. Aborting configure]),
AC_MSG_WARN([cannot run when cross-compiling]))
-
-AC_ARG_ENABLE(dso,
-[ --enable-dso Enable building internal libraries as DSO's (experimental)],
-[ if test x$enable_dso != xyes; then
- BLDSHARED=false
- fi],
-[BLDSHARED=false])
diff --git a/source4/build/smb_build/config_mk.pm b/source4/build/smb_build/config_mk.pm
index fbf20f4ae9..c11a0458d8 100644
--- a/source4/build/smb_build/config_mk.pm
+++ b/source4/build/smb_build/config_mk.pm
@@ -51,7 +51,7 @@ my $section_types = {
"ENABLE" => "bool",
- "OUTPUT_TYPE" => "string",
+ "OUTPUT_TYPE" => "list",
"MANPAGE" => "string",
"PRIVATE_PROTO_HEADER" => "string",
diff --git a/source4/build/smb_build/input.pm b/source4/build/smb_build/input.pm
index 2465caa68b..3b8da8c964 100644
--- a/source4/build/smb_build/input.pm
+++ b/source4/build/smb_build/input.pm
@@ -94,10 +94,11 @@ sub check_module($$$)
$mod->{OUTPUT_TYPE} = $default_ot;
}
- if ($mod->{OUTPUT_TYPE} eq "SHARED_LIBRARY") {
+ if (grep(/SHARED_LIBRARY/, @{$mod->{OUTPUT_TYPE}})) {
$mod->{INSTALLDIR} = "MODULESDIR/$mod->{SUBSYSTEM}";
push (@{$mod->{PRIVATE_DEPENDENCIES}}, $mod->{SUBSYSTEM});
- } else {
+ }
+ if (grep(/INTEGRATED/, @{$mod->{OUTPUT_TYPE}})) {
push (@{$INPUT->{$mod->{SUBSYSTEM}}{INIT_FUNCTIONS}}, $mod->{INIT_FUNCTION}) if defined($mod->{INIT_FUNCTION});
}
add_libreplace($mod);
@@ -137,7 +138,7 @@ sub check_binary($$)
($bin->{BINARY} = (lc $bin->{NAME})) if not defined($bin->{BINARY});
- $bin->{OUTPUT_TYPE} = "BINARY";
+ $bin->{OUTPUT_TYPE} = ["BINARY"];
add_libreplace($bin);
}
@@ -147,7 +148,7 @@ sub import_integrated($$)
foreach my $mod (values %$depend) {
next if(not defined($mod->{OUTPUT_TYPE}));
- next if($mod->{OUTPUT_TYPE} ne "INTEGRATED");
+ next if(not grep(/INTEGRATED/, @{$mod->{OUTPUT_TYPE}}));
next if(not defined($mod->{SUBSYSTEM}));
next if($mod->{SUBSYSTEM} ne $lib->{NAME});
next if($mod->{ENABLE} ne "YES");
@@ -174,8 +175,8 @@ sub calc_unique_deps($$$$$$)
if (defined ($dep->{OUTPUT_TYPE}) &&
($withlibs or
- ($dep->{OUTPUT_TYPE} eq "INTEGRATED") or
- ($dep->{OUTPUT_TYPE} eq "STATIC_LIBRARY"))) {
+ (@{$dep->{OUTPUT_TYPE}}[0] eq "INTEGRATED") or
+ (@{$dep->{OUTPUT_TYPE}}[0] eq "STATIC_LIBRARY"))) {
push (@$busy, $dep->{NAME});
calc_unique_deps($dep->{NAME}, $INPUT, $dep->{PUBLIC_DEPENDENCIES}, $udeps, $withlibs, $busy);
calc_unique_deps($dep->{NAME}, $INPUT, $dep->{PRIVATE_DEPENDENCIES}, $udeps, $withlibs, $busy);
diff --git a/source4/build/smb_build/main.pl b/source4/build/smb_build/main.pl
index 3e546d58ae..54ba984d67 100644
--- a/source4/build/smb_build/main.pl
+++ b/source4/build/smb_build/main.pl
@@ -21,41 +21,42 @@ my $mkfile = smb_build::config_mk::run_config_mk($INPUT, $config::config{srcdir}
my $library_output_type;
if ($config::config{USESHARED} eq "true") {
- $library_output_type = "SHARED_LIBRARY";
+ $library_output_type = ["SHARED_LIBRARY", "STATIC_LIBRARY"];
} else {
- $library_output_type = "STATIC_LIBRARY";
+ $library_output_type = ["STATIC_LIBRARY"];
+ push (@$library_output_type, "SHARED_LIBRARY") if
+ ($config::config{BLDSHARED} eq "true")
}
my $module_output_type;
if ($config::config{USESHARED} eq "true") {
- $module_output_type = "SHARED_LIBRARY";
+ $module_output_type = ["SHARED_LIBRARY"];
} else {
- $module_output_type = "INTEGRATED";
+ $module_output_type = ["INTEGRATED"];
}
my $DEPEND = smb_build::input::check($INPUT, \%config::enabled,
- "STATIC_LIBRARY", $library_output_type, $module_output_type);
+ ["STATIC_LIBRARY"], $library_output_type, $module_output_type);
my $OUTPUT = output::create_output($DEPEND, \%config::config);
-$config::config{SUBSYSTEM_OUTPUT_TYPE} = "STATIC_LIBRARY";
+$config::config{SUBSYSTEM_OUTPUT_TYPE} = ["STATIC_LIBRARY"];
$config::config{LIBRARY_OUTPUT_TYPE} = $library_output_type;
$config::config{MODULE_OUTPUT_TYPE} = $module_output_type;
my $mkenv = new smb_build::makefile(\%config::config, $mkfile);
-
foreach my $key (values %$OUTPUT) {
next unless defined $key->{OUTPUT_TYPE};
- $mkenv->Integrated($key) if $key->{OUTPUT_TYPE} eq "INTEGRATED";
+ $mkenv->Integrated($key) if grep(/INTEGRATED/, @{$key->{OUTPUT_TYPE}});
}
foreach my $key (values %$OUTPUT) {
next unless defined $key->{OUTPUT_TYPE};
- $mkenv->StaticLibrary($key) if $key->{OUTPUT_TYPE} eq "STATIC_LIBRARY";
- $mkenv->PkgConfig($key) if ($key->{OUTPUT_TYPE} eq "SHARED_LIBRARY") and
- defined($key->{VERSION});
- $mkenv->SharedLibrary($key) if $key->{OUTPUT_TYPE} eq "SHARED_LIBRARY";
- $mkenv->Binary($key) if $key->{OUTPUT_TYPE} eq "BINARY";
+ $mkenv->StaticLibrary($key) if grep(/STATIC_LIBRARY/, @{$key->{OUTPUT_TYPE}});
+ $mkenv->PkgConfig($key) if grep(/SHARED_LIBRARY/, @{$key->{OUTPUT_TYPE}})
+ and defined($key->{VERSION});
+ $mkenv->SharedLibrary($key) if grep(/SHARED_LIBRARY/, @{$key->{OUTPUT_TYPE}});
+ $mkenv->Binary($key) if grep(/BINARY/, @{$key->{OUTPUT_TYPE}});
$mkenv->Manpage($key) if defined($key->{MANPAGE});
$mkenv->Header($key) if defined($key->{PUBLIC_HEADERS});
$mkenv->ProtoHeader($key) if defined($key->{PRIVATE_PROTO_HEADER}) or
diff --git a/source4/build/smb_build/makefile.pm b/source4/build/smb_build/makefile.pm
index 78b16599f4..0158597f74 100644
--- a/source4/build/smb_build/makefile.pm
+++ b/source4/build/smb_build/makefile.pm
@@ -106,13 +106,11 @@ sub _prepare_compiler_linker($)
{
my ($self) = @_;
- my $devld_install = "";
my $builddir_headers = "";
my $libdir;
if ($self->{config}->{USESHARED} eq "true") {
$libdir = "\$(builddir)/bin/shared";
- $devld_install = " -Wl,-rpath-link,\$(builddir)/bin/shared";
} else {
$libdir = "\$(builddir)/bin/static";
}
@@ -134,7 +132,7 @@ CFLAGS=$self->{config}->{CFLAGS} \$(CPPFLAGS)
PICFLAG=$self->{config}->{PICFLAG}
HOSTCC=$self->{config}->{HOSTCC}
-INSTALL_LINK_FLAGS=$devld_install
+INSTALL_LINK_FLAGS=-Wl,-rpath-link,\$(builddir)/bin/shared
LD=$self->{config}->{LD}
LDFLAGS=$self->{config}->{LDFLAGS} -L$libdir
@@ -217,7 +215,7 @@ sub SharedLibrary($$)
push (@{$self->{shared_libs}}, "$ctx->{SHAREDDIR}/$ctx->{LIBRARY_REALNAME}") if (defined($ctx->{SO_VERSION}));
push (@{$self->{installable_shared_libs}}, "$ctx->{SHAREDDIR}/$ctx->{LIBRARY_REALNAME}") if (defined($ctx->{SO_VERSION}));
} elsif ($ctx->{TYPE} eq "MODULE") {
- push (@{$self->{shared_modules}}, "$ctx->{TARGET}");
+ push (@{$self->{shared_modules}}, "$ctx->{TARGET_SHARED_LIBRARY}");
push (@{$self->{plugins}}, "$ctx->{SHAREDDIR}/$ctx->{LIBRARY_REALNAME}");
$self->{install_plugins} .= "\t\@echo Installing $ctx->{SHAREDDIR}/$ctx->{LIBRARY_REALNAME} as \$(DESTDIR)\$(MODULESDIR)/$ctx->{SUBSYSTEM}/$ctx->{LIBRARY_REALNAME}\n";
@@ -283,8 +281,9 @@ $ctx->{SHAREDDIR}/$ctx->{LIBRARY_REALNAME}: \$($ctx->{TYPE}_$ctx->{NAME}_DEPEND_
\@echo Linking \$\@
\@mkdir -p $ctx->{SHAREDDIR}
\@\$(SHLD) \$(SHLD_FLAGS) -o \$\@ \$(INSTALL_LINK_FLAGS) \\
- \$($ctx->{TYPE}_$ctx->{NAME}_LINK_FLAGS) $soarg \\
- $init_obj $singlesoarg
+ \$($ctx->{TYPE}_$ctx->{NAME}_LINK_FLAGS) \\
+ \$($ctx->{TYPE}_$ctx->{NAME}\_FULL_OBJ_LIST) $soarg \\
+ $init_obj $singlesoarg
__EOD__
);
@@ -302,19 +301,17 @@ sub StaticLibrary($$)
return unless (defined($ctx->{OBJ_FILES}));
- push (@{$self->{static_libs}}, $ctx->{TARGET}) if ($ctx->{TYPE} eq "LIBRARY");
+ push (@{$self->{static_libs}}, $ctx->{TARGET_STATIC_LIBRARY}) if ($ctx->{TYPE} eq "LIBRARY");
$self->output("$ctx->{TYPE}_$ctx->{NAME}_OUTPUT = $ctx->{OUTPUT}\n");
$self->_prepare_list($ctx, "OBJ_LIST");
$self->_prepare_list($ctx, "FULL_OBJ_LIST");
- $self->_prepare_list($ctx, "LINK_FLAGS");
-
push(@{$self->{all_objs}}, "\$($ctx->{TYPE}_$ctx->{NAME}_FULL_OBJ_LIST)");
$self->output(<< "__EOD__"
#
-$ctx->{TARGET}: \$($ctx->{TYPE}_$ctx->{NAME}_FULL_OBJ_LIST)
+$ctx->{TARGET_STATIC_LIBRARY}: \$($ctx->{TYPE}_$ctx->{NAME}_FULL_OBJ_LIST)
\@echo Linking \$@
\@rm -f \$@
\@\$(STLD) \$(STLD_FLAGS) \$@ \$($ctx->{TYPE}_$ctx->{NAME}_FULL_OBJ_LIST)
diff --git a/source4/build/smb_build/output.pm b/source4/build/smb_build/output.pm
index 34ed7ae03e..1451b8bb7d 100644
--- a/source4/build/smb_build/output.pm
+++ b/source4/build/smb_build/output.pm
@@ -38,7 +38,6 @@ sub generate_shared_library($)
my $lib_name;
$lib->{DEPEND_LIST} = [];
- push(@{$lib->{LINK_FLAGS}}, "\$($lib->{TYPE}_$lib->{NAME}\_FULL_OBJ_LIST)");
$link_name = lc($lib->{NAME});
$lib_name = $link_name;
@@ -71,8 +70,8 @@ sub generate_shared_library($)
$lib->{LIBRARY_REALNAME} = "$lib->{LIBRARY_REALNAME}.$lib->{VERSION}";
}
- $lib->{TARGET} = "$lib->{SHAREDDIR}/$lib->{LIBRARY_REALNAME}";
- $lib->{OUTPUT} = $lib->{TARGET};
+ $lib->{TARGET_SHARED_LIBRARY} = "$lib->{SHAREDDIR}/$lib->{LIBRARY_REALNAME}";
+ $lib->{OUTPUT_SHARED_LIBRARY} = $lib->{TARGET_SHARED_LIBRARY};
}
sub generate_static_library($)
@@ -86,14 +85,13 @@ sub generate_static_library($)
$link_name =~ s/^LIB//;
$lib->{LIBRARY_NAME} = "lib".lc($link_name).".a";
- push(@{$lib->{LINK_FLAGS}}, "\$($lib->{TYPE}_$lib->{NAME}\_OBJ_LIST)");
if (defined($lib->{OBJ_FILES})) {
- $lib->{TARGET} = "bin/static/$lib->{LIBRARY_NAME}";
+ $lib->{TARGET_STATIC_LIBRARY} = "bin/static/$lib->{LIBRARY_NAME}";
} else {
- $lib->{TARGET} = "";
+ $lib->{TARGET_STATIC_LIBRARY} = "";
}
- $lib->{OUTPUT} = $lib->{TARGET};
+ $lib->{OUTPUT_STATIC_LIBRARY} = $lib->{TARGET_STATIC_LIBRARY};
}
sub generate_binary($)
@@ -104,7 +102,7 @@ sub generate_binary($)
push(@{$bin->{LINK_FLAGS}}, "\$($bin->{TYPE}_$bin->{NAME}\_OBJ_LIST)");
$bin->{DEBUGDIR} = "bin/";
- $bin->{TARGET} = $bin->{OUTPUT} = "$bin->{DEBUGDIR}/$bin->{NAME}";
+ $bin->{TARGET_BINARY} = $bin->{OUTPUT_BINARY} = "$bin->{DEBUGDIR}/$bin->{NAME}";
$bin->{BINARY} = $bin->{NAME};
}
@@ -123,7 +121,6 @@ sub merge_array($$)
}
}
-
sub create_output($$)
{
my ($depend, $config) = @_;
@@ -135,10 +132,11 @@ sub create_output($$)
# Combine object lists
push(@{$part->{OBJ_LIST}}, add_dir($part->{BASEDIR}, $part->{OBJ_FILES})) if defined($part->{OBJ_FILES});
- generate_binary($part) if $part->{OUTPUT_TYPE} eq "BINARY";
- generate_shared_library($part) if $part->{OUTPUT_TYPE} eq "SHARED_LIBRARY";
- generate_static_library($part) if $part->{OUTPUT_TYPE} eq "STATIC_LIBRARY";
-
+ generate_binary($part) if grep(/BINARY/, @{$part->{OUTPUT_TYPE}});
+ generate_shared_library($part) if grep(/SHARED_LIBRARY/, @{$part->{OUTPUT_TYPE}});
+ generate_static_library($part) if grep(/STATIC_LIBRARY/, @{$part->{OUTPUT_TYPE}});
+ $part->{OUTPUT} = $part->{"OUTPUT_" . @{$part->{OUTPUT_TYPE}}[0]};
+ $part->{TARGET} = $part->{"TARGET_" . @{$part->{OUTPUT_TYPE}}[0]};
}
foreach $part (values %{$depend}) {
diff --git a/source4/build/smb_build/summary.pm b/source4/build/smb_build/summary.pm
index 94da12fc91..de4ab43d24 100644
--- a/source4/build/smb_build/summary.pm
+++ b/source4/build/smb_build/summary.pm
@@ -56,10 +56,14 @@ sub show($$)
? "yes" : "no (install GNU make >= 3.81 and see --enable-automatic-dependencies)") .
"\n";
- print "Using shared libraries: " .
+ print "Building shared libraries: " .
(enabled($config->{BLDSHARED})
? "yes" : "no (not supported on this system)") .
"\n";
+ print "Using shared libraries internally: " .
+ (enabled($config->{USESHARED})
+ ? "yes" : "no (specify --enable-dso)") .
+ "\n";
print "\n";
}