]> git.ipfire.org Git - thirdparty/libtool.git/commitdiff
* libltdl/m4/libtool.m4 (func_dirname_and_basename) <XSI>:
authorCharles Wilson <libtool@cwilson.fastmail.fm>
Fri, 13 Jul 2007 07:21:39 +0000 (07:21 +0000)
committerCharles Wilson <libtool@cwilson.fastmail.fm>
Fri, 13 Jul 2007 07:21:39 +0000 (07:21 +0000)
New function.
(func_dirname_and_basename) <!XSI>: 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.

ChangeLog
libltdl/config/ltmain.m4sh
libltdl/m4/libtool.m4

index cbc4b2c50aceefc3a211bfc7cea6a3a5c93dc89d..1924be4cfddcd83313a6a0425ec556a23dd0a05c 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,10 +1,22 @@
+2007-07-13  Charles Wilson  <libtool@cwilson.fastmail.fm>
+
+       * libltdl/m4/libtool.m4 (func_dirname_and_basename) <XSI>:
+       New function.
+       (func_dirname_and_basename) <!XSI>: 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  <peda@lysator.liu.se>
 
        * 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  <peter@pogma.com
+2007-07-06  Peter O'Gorman  <peter@pogma.com>
 
        * libltdl/config/libtool.m4sh: Don't pass -msg_* through to the
        linker.
index 8ce9b8a308a2ca3d29587cb1eb8da7d885b7a2bc..c42450c5e3ab515c8667b627e04b16684f84efff 100644 (file)
@@ -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
index e34cbc4e18485482467934c71d0935bb51433f88..a15a2bd73382d7f575a06dd0e1362f6ea6f87fae 100644 (file)
@@ -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