mirror of
https://https.git.savannah.gnu.org/git/libtool.git
synced 2026-01-26 15:39:10 +00:00
* 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.
This commit is contained in:
parent
3a417017ce
commit
f470f5557b
13
ChangeLog
13
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
|
||||
|
||||
@ -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"
|
||||
;;
|
||||
|
||||
@ -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.
|
||||
{
|
||||
|
||||
26
libltdl/m4/libtool.m4
vendored
26
libltdl/m4/libtool.m4
vendored
@ -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.
|
||||
|
||||
@ -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
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user