From: Charles Wilson Date: Fri, 13 Jul 2007 07:21:39 +0000 (+0000) Subject: * libltdl/m4/libtool.m4 (func_dirname_and_basename) : X-Git-Tag: release-2-1b~99 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=f88b0894138b58ab4f6f9d37554c0b28829c0f32;p=thirdparty%2Flibtool.git * libltdl/m4/libtool.m4 (func_dirname_and_basename) : New function. (func_dirname_and_basename) : New function. * libltdl/config/ltmain.m4sh (func_ltwrapper_scriptname): Call it. Also, take advantage of missed optimization using func_dirname's additional arguments. (func_mode_compile): Call it. (func_mode_install): Call it. (func_mode_link): Call it. --- diff --git a/ChangeLog b/ChangeLog index cbc4b2c50..1924be4cf 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,10 +1,22 @@ +2007-07-13 Charles Wilson + + * libltdl/m4/libtool.m4 (func_dirname_and_basename) : + New function. + (func_dirname_and_basename) : New function. + * libltdl/config/ltmain.m4sh (func_ltwrapper_scriptname): + Call it. Also, take advantage of missed optimization using + func_dirname's additional arguments. + (func_mode_compile): Call it. + (func_mode_install): Call it. + (func_mode_link): Call it. + 2007-07-12 Peter Rosin * libltdl/config/ltmain.m4sh (func_mode_link): Strip the cwrapper using $STRIP instead of relying on the tools to support -s, which MSVC doesn't. -2007-07-06 Peter O'Gorman * libltdl/config/libtool.m4sh: Don't pass -msg_* through to the linker. diff --git a/libltdl/config/ltmain.m4sh b/libltdl/config/ltmain.m4sh index 8ce9b8a30..c42450c5e 100644 --- a/libltdl/config/ltmain.m4sh +++ b/libltdl/config/ltmain.m4sh @@ -692,14 +692,9 @@ func_ltwrapper_scriptname () { func_ltwrapper_scriptname_result="" if func_ltwrapper_executable_p "$1"; then - func_dirname "$1" - func_basename "$1" + func_dirname_and_basename "$1" "" "." func_stripname '' '.exe' "$func_basename_result" - if test -z "$func_dirname_result"; then - func_ltwrapper_scriptname_result="./$objdir/${func_stripname_result}_ltshwrapper" - else - func_ltwrapper_scriptname_result="$func_dirname_result/$objdir/${func_stripname_result}_ltshwrapper" - fi + func_ltwrapper_scriptname_result="$func_dirname_result/$objdir/${func_stripname_result}_ltshwrapper" fi } @@ -1422,9 +1417,8 @@ func_mode_compile () test "X$libobj" != "X$func_quote_for_eval_result" \ && $ECHO "X$libobj" | $GREP '[@:>@~#^*{};<>?"'"'"' &()|`$@<:@]' \ && func_warning "libobj name \`$libobj' may not contain shell special characters." - func_basename "$obj" + func_dirname_and_basename "$obj" "/" "" objname="$func_basename_result" - func_dirname "$obj" "/" "" xdir="$func_dirname_result" lobj=${xdir}$objdir/$objname @@ -1921,9 +1915,8 @@ func_mode_install () destdir="$dest" destname= else - func_dirname "$dest" "" "." + func_dirname_and_basename "$dest" "" "." destdir="$func_dirname_result" - func_basename "$dest" destname="$func_basename_result" # Not a directory, so check to see that there is only one file specified. @@ -6785,13 +6778,9 @@ EOF esac case $host in *cygwin* | *mingw* ) - func_basename "$output" + func_dirname_and_basename "$output" "" "." output_name=$func_basename_result - func_dirname "$output" output_path=$func_dirname_result - if test -z "$output_path"; then - output_path=. - fi cwrappersource="$output_path/$objdir/lt-$output_name.c" cwrapper="$output_path/$output_name.exe" $RM $cwrappersource $cwrapper diff --git a/libltdl/m4/libtool.m4 b/libltdl/m4/libtool.m4 index e34cbc4e1..a15a2bd73 100644 --- a/libltdl/m4/libtool.m4 +++ b/libltdl/m4/libtool.m4 @@ -7056,6 +7056,27 @@ func_basename () func_basename_result="${1##*/}" } +# func_dirname_and_basename file append nondir_replacement +# perform func_basename and func_dirname in a single function +# call: +# dirname: Compute the dirname of FILE. If nonempty, +# add APPEND to the result, otherwise set result +# to NONDIR_REPLACEMENT. +# value returned in "$func_dirname_result" +# basename: Compute filename of FILE. +# value retuned in "$func_basename_result" +# Implementation must be kept synchronized with func_dirname +# and func_basename. For efficiency, we do not delegate to +# those functions but instead duplicate the functionality here. +func_dirname_and_basename () +{ + case ${1} in + */*) func_dirname_result="${1%/*}${2}" ;; + * ) func_dirname_result="${3}" ;; + esac + func_basename_result="${1##*/}" +} + # func_stripname prefix suffix name # strip PREFIX and SUFFIX off of NAME. # PREFIX and SUFFIX must not contain globbing or regex special @@ -7109,6 +7130,30 @@ func_basename () func_basename_result=`$ECHO "X${1}" | $Xsed -e "$basename"` } +# func_dirname_and_basename file append nondir_replacement +# perform func_basename and func_dirname in a single function +# call: +# dirname: Compute the dirname of FILE. If nonempty, +# add APPEND to the result, otherwise set result +# to NONDIR_REPLACEMENT. +# value returned in "$func_dirname_result" +# basename: Compute filename of FILE. +# value retuned in "$func_basename_result" +# Implementation must be kept synchronized with func_dirname +# and func_basename. For efficiency, we do not delegate to +# those functions but instead duplicate the functionality here. +func_dirname_and_basename () +{ + # Extract subdirectory from the argument. + func_dirname_result=`$ECHO "X${1}" | $Xsed -e "$dirname"` + if test "X$func_dirname_result" = "X${1}"; then + func_dirname_result="${3}" + else + func_dirname_result="$func_dirname_result${2}" + fi + func_basename_result=`$ECHO "X${1}" | $Xsed -e "$basename"` +} + # func_stripname prefix suffix name # strip PREFIX and SUFFIX off of NAME. # PREFIX and SUFFIX must not contain globbing or regex special