From 0de5e4f0924d5101a02480f9b42513d28db1307e Mon Sep 17 00:00:00 2001 From: Richard Levitte Date: Wed, 12 Oct 2016 17:05:35 +0200 Subject: [PATCH] Remove automatic RPATH - add user rpath support Make Configure recognise -rpath and -R to support user added rpaths for OSF1 and Solaris. For convenience, add a variable LIBRPATH in the Unix Makefile, which the users can use as follows: ./config [options] -Wl,-rpath,\$(LIBRPATH) Reviewed-by: Rich Salz (cherry picked from commit fad599f7f147ee71e5581211fb654c2c8c491cd8) --- Configurations/unix-Makefile.tmpl | 6 +++++- Configure | 11 ++++++++++- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/Configurations/unix-Makefile.tmpl b/Configurations/unix-Makefile.tmpl index 85f399616b..a11d7c147d 100644 --- a/Configurations/unix-Makefile.tmpl +++ b/Configurations/unix-Makefile.tmpl @@ -153,6 +153,10 @@ LIBDIR={- # ENGINESDIR={- use File::Spec::Functions; catdir($prefix,$libdir,"engines-$sover") -} +# Convenience variable for those who want to set the rpath in shared +# libraries and applications +LIBRPATH=$(INSTALLTOP)/$(LIBDIR) + MANDIR=$(INSTALLTOP)/share/man DOCDIR=$(INSTALLTOP)/share/doc/$(BASENAME) HTMLDIR=$(DOCDIR)/html @@ -1064,7 +1068,7 @@ $bin$exeext: $objs $deps APPNAME=$bin$exeext OBJECTS="$objs" \\ LIBDEPS='\$(PLIB_LDFLAGS) '"$linklibs"' \$(EX_LIBS)' \\ CC='\$(CC)' CFLAGS='\$(CFLAGS) \$(BIN_CFLAGS)' \\ - LDFLAGS='\$(LDFLAGS)' LIBRPATH='\$(INSTALLTOP)/\$(LIBDIR)' \\ + LDFLAGS='\$(LDFLAGS)' \\ link_app.$shlib_target EOF } diff --git a/Configure b/Configure index 04efe67fdb..c9ac09755d 100755 --- a/Configure +++ b/Configure @@ -540,8 +540,9 @@ $config{build_type} = "release"; my %unsupported_options = (); my %deprecated_options = (); -foreach (@argvcopy) +while (@argvcopy) { + $_ = shift @argvcopy; # VMS is a case insensitive environment, and depending on settings # out of our control, we may receive options uppercased. Let's # downcase at least the part before any equal sign. @@ -728,6 +729,14 @@ foreach (@argvcopy) { $libs.=$_." "; } + elsif (/^-rpath$/ or /^-R$/) + # -rpath is the OSF1 rpath flag + # -R is the old Solaris rpath flag + { + my $rpath = shift(@argvcopy) || ""; + $rpath .= " " if $rpath ne ""; + $libs.=$_." ".$rpath; + } elsif (/^-static$/) { $libs.=$_." "; -- 2.25.1