]> git.ipfire.org Git - thirdparty/libtool.git/commitdiff
* libltdl/m4/libtool.m4 (_LT_PROG_XSI_SHELLFNS): Move non-XSI
authorRalf Wildenhues <Ralf.Wildenhues@gmx.de>
Thu, 10 Apr 2008 21:18:02 +0000 (21:18 +0000)
committerRalf Wildenhues <Ralf.Wildenhues@gmx.de>
Thu, 10 Apr 2008 21:18:02 +0000 (21:18 +0000)
definition of func_dirname_and_basename ...
* libltdl/config/general.m4sh (func_dirname_and_basename):
... here, to use it for the other scripts that use general.m4sh
(and as portable fallback for libtool).  Add marker for early
insertion of generated shell functions (into libtool, not the
other scripts) here.
Use func_dirname_and_basename to compute progname, progpath.
* libltdl/config/ltmain.m4sh (func_mode_help): Remove marker
for insertion of generated shell functions.
* tests/sh.test: Adjust function definition test to not match
function call.

ChangeLog
libltdl/config/general.m4sh
libltdl/config/ltmain.m4sh
libltdl/m4/libtool.m4
tests/sh.test

index 2ece81d94bc87df4b7d863e3eee5fb84f3d85bd9..f806f5ad6f0a47942b21fce0a50cf232eebe6411 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,18 @@
 2008-04-10  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
 
+       * libltdl/m4/libtool.m4 (_LT_PROG_XSI_SHELLFNS): Move non-XSI
+       definition of func_dirname_and_basename ...
+       * libltdl/config/general.m4sh (func_dirname_and_basename):
+       ... here, to use it for the other scripts that use general.m4sh
+       (and as portable fallback for libtool).  Add marker for early
+       insertion of generated shell functions (into libtool, not the
+       other scripts) here.
+       Use func_dirname_and_basename to compute progname, progpath.
+       * libltdl/config/ltmain.m4sh (func_mode_help): Remove marker
+       for insertion of generated shell functions.
+       * tests/sh.test: Adjust function definition test to not match
+       function call.
+
        * libltdl/m4/libtool.m4 (_LT_PROG_XSI_SHELLFNS) <func_xform>:
        New function.
        * libltdl/config/ltmain.m4sh (func_mode_compile): Use it to
index 71a20d28a63f7b5f8e201d9b24afb6c5295fe055..29b3d917e1125d0adf9ec75c5ab44e7da7478edf 100644 (file)
@@ -61,6 +61,32 @@ IFS="        $lt_nl"
 dirname="s,/[^/]*$,,"
 basename="s,^.*/,,"
 
+# 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"`
+}
+
+# Generated shell functions inserted here.
+
 # Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh
 # is ksh but when the shell is invoked as "sh" and the current value of
 # the _XPG environment variable is not equal to 1 (one), the special
@@ -71,13 +97,17 @@ progpath="$0"
 # The name of this program:
 # In the unlikely event $progname began with a '-', it would play havoc with
 # func_echo (imagine progname=-n), so we prepend ./ in that case:
-progname=`$ECHO "X$progpath" | $Xsed -e "$basename" -e 's,^-,./-,'`
+func_dirname_and_basename "$progpath"
+progname=$func_basename_result
+case $progname in
+  -*) progname=./$progname ;;
+esac
 
 # Make sure we have an absolute path for reexecution:
 case $progpath in
   [\\/]*|[A-Za-z]:\\*) ;;
   *[\\/]*)
-     progdir=`$ECHO "X$progpath" | $Xsed -e "$dirname"`
+     progdir=$func_dirname_result
      progdir=`cd "$progdir" && pwd`
      progpath="$progdir/$progname"
      ;;
index 905be9d9c903cd64aba31b210abf8f3e7c18edd8..8ffcbaf902255914755cb539dab0e54fdaec4bf0 100644 (file)
@@ -250,9 +250,6 @@ func_enable_tag ()
   esac
 }
 
-# Generated shell functions inserted here.
-
-
 # Parse options once, thoroughly.  This comes as soon as possible in
 # the script to make things like `libtool --version' happen quickly.
 {
index 38b9569d77111dd52636019782bbadebdedf5b60..1fc9ccf8d7aab9cabf7f8c1d8769b2e694629db9 100644 (file)
@@ -7198,29 +7198,9 @@ 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"`
-}
+dnl func_dirname_and_basename
+dnl A portable version of this function is already defined in general.m4sh
+dnl so there is no need for it here.
 
 # func_stripname prefix suffix name
 # strip PREFIX and SUFFIX off of NAME.
index dad74bacd5119feeb1fa1c2614b58cb58a1646f7..6d2fa20736b922eabdff43294c4e79bb8b8db542 100755 (executable)
@@ -2,7 +2,8 @@
 # sh.test - check for some nonportable or dubious or undesired shell
 #           constructs in shell scripts.
 #
-#   Copyright (C) 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
+#   Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008 Free Software
+#   Foundation, Inc.
 #   Written by Gary V. Vaughan, 2003
 #
 #   This file is part of GNU Libtool.
@@ -104,7 +105,7 @@ done
 for s in $scripts
 do
   if $SED -n '
-      /^func_/{
+      /^func_.*(/{
          N
          /^func_[^     ]* ()\n{$/d
          p