From c4ee1af3fb835612360f9cc7a6fa1ead17b64340 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Wed, 8 Nov 2006 01:37:28 +0000 Subject: r19631: Re-enable shared libraries, but don't use -rpath-link unless shared libraries are actually used. (This used to be commit 93e4f093b946cbb1b6deca82efdf0d5f033128b8) --- source4/build/m4/check_ld.m4 | 3 --- source4/build/smb_build/makefile.pm | 9 +++++++-- 2 files changed, 7 insertions(+), 5 deletions(-) (limited to 'source4/build') 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__ ); -- cgit