[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[RFC PATCH] Strip trailing slashes from libdir and destdir
From: |
Paolo Bonzini |
Subject: |
[RFC PATCH] Strip trailing slashes from libdir and destdir |
Date: |
Sat, 9 Oct 2010 10:51:34 +0200 |
I found this patch at OpenEmbedded,
http://lists.linuxtogo.org/pipermail/openembedded-devel/2010-October/025133.html
It looks to me like the code can be simplified by unconditionally
stripping trailing slashes from $libdir and $destdir (i.e. not
introducing the new variables). Ideas?
Paolo
* libltdl/config/ltmain.m4sh (func_mode_install): Check if
$destdir ends with $libdir only after stripping trailing slashes
from both. Patch from Gary Thomas <address@hidden> and
Nitin A Kamble <address@hidden>.
---
libltdl/config/ltmain.m4sh | 11 +++++++++--
2 files changed, 9 insertions(+), 2 deletions(-)
diff --git a/libltdl/config/ltmain.m4sh b/libltdl/config/ltmain.m4sh
index af46cb8..2add022 100644
--- a/libltdl/config/ltmain.m4sh
+++ b/libltdl/config/ltmain.m4sh
@@ -2164,8 +2164,15 @@ func_mode_install ()
func_append dir "$objdir"
if test -n "$relink_command"; then
+ # Strip any trailing slash from the destination.
+ func_stripname '' '/' "$libdir"
+ destlibdir=$func_stripname_result
+
+ func_stripname '' '/' "$destdir"
+ s_destdir=$func_stripname_result
+
# Determine the prefix the user has applied to our future dir.
- inst_prefix_dir=`$ECHO "$destdir" | $SED -e "s%$libdir\$%%"`
+ inst_prefix_dir=`$ECHO "X$s_destdir" | $Xsed -e "s%$destlibdir\$%%"`
# Don't allow the user to place us outside of our expected
# location b/c this prevents finding dependent libraries that
@@ -2173,7 +2180,7 @@ func_mode_install ()
# At present, this check doesn't affect windows .dll's that
# are installed into $libdir/../bin (currently, that works fine)
# but it's something to keep an eye on.
- test "$inst_prefix_dir" = "$destdir" && \
+ test "$inst_prefix_dir" = "$s_destdir" && \
func_fatal_error "error: cannot install \`$file' to a directory not
ending in $libdir"
if test -n "$inst_prefix_dir"; then
--
1.7.2.3
- [RFC PATCH] Strip trailing slashes from libdir and destdir,
Paolo Bonzini <=