summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--source4/build/m4/check_ld.m43
-rw-r--r--source4/build/smb_build/makefile.pm9
2 files changed, 7 insertions, 5 deletions
diff --git a/source4/build/m4/check_ld.m4 b/source4/build/m4/check_ld.m4
index c630658378..129ee00ebc 100644
--- a/source4/build/m4/check_ld.m4
+++ b/source4/build/m4/check_ld.m4
@@ -187,9 +187,6 @@ AC_TRY_RUN([#include "${srcdir-.}/build/tests/trivial.c"],
AC_MSG_WARN([cannot run when cross-compiling]))
-# TODO: remove this line when our shared libs correctly link without unresolved symbols
-BLDSHARED=false
-
USESHARED=false
AC_SUBST(USESHARED)
diff --git a/source4/build/smb_build/makefile.pm b/source4/build/smb_build/makefile.pm
index e388308f85..4cd7e5681b 100644
--- a/source4/build/smb_build/makefile.pm
+++ b/source4/build/smb_build/makefile.pm
@@ -108,9 +108,11 @@ sub _prepare_compiler_linker($)
my $builddir_headers = "";
my $libdir;
+ my $extra_link_flags = "";
if ($self->{config}->{USESHARED} eq "true") {
$libdir = "\$(builddir)/bin/shared";
+ $extra_link_flags = "-Wl,-rpath-link,\$(builddir)/bin/shared";
} else {
$libdir = "\$(builddir)/bin/static";
}
@@ -134,6 +136,8 @@ PICFLAG=$self->{config}->{PICFLAG}
HOSTCC=$self->{config}->{HOSTCC}
HOSTCC_CFLAGS=-D_SAMBA_HOSTCC_ $self->{config}->{CFLAGS} \$(CPPFLAGS)
+INSTALL_LINK_FLAGS=$extra_link_flags
+
LD=$self->{config}->{LD}
LDFLAGS=$self->{config}->{LDFLAGS} -L$libdir
@@ -280,7 +284,7 @@ __EOD__
$ctx->{SHAREDDIR}/$ctx->{LIBRARY_REALNAME}: \$($ctx->{TYPE}_$ctx->{NAME}_DEPEND_LIST) \$($ctx->{TYPE}_$ctx->{NAME}_FULL_OBJ_LIST) $init_obj
\@echo Linking \$\@
\@mkdir -p $ctx->{SHAREDDIR}
- \@\$(SHLD) \$(SHLD_FLAGS) -o \$\@ \\
+ \@\$(SHLD) \$(SHLD_FLAGS) -o \$\@ \$(INSTALL_LINK_FLAGS) \\
\$($ctx->{TYPE}_$ctx->{NAME}_LINK_FLAGS) \\
\$($ctx->{TYPE}_$ctx->{NAME}\_FULL_OBJ_LIST) $soarg \\
$init_obj $singlesoarg
@@ -369,7 +373,8 @@ sub Binary($$)
$self->output(<< "__EOD__"
$installdir/$ctx->{BINARY}: \$($ctx->{TYPE}_$ctx->{NAME}_DEPEND_LIST) \$($ctx->{TYPE}_$ctx->{NAME}_FULL_OBJ_LIST)
\@echo Linking \$\@
- \@\$(LD) \$(LDFLAGS) -o \$\@ \$\($ctx->{TYPE}_$ctx->{NAME}_LINK_FLAGS)
+ \@\$(LD) \$(LDFLAGS) -o \$\@ \$(INSTALL_LINK_FLAGS) \\
+ \$\($ctx->{TYPE}_$ctx->{NAME}_LINK_FLAGS)
__EOD__
);