summaryrefslogtreecommitdiff
path: root/gl
diff options
context:
space:
mode:
authorGary V. Vaughan <gary@gnu.org>2014-12-03 18:53:08 +0000
committerGary V. Vaughan <gary@gnu.org>2014-12-03 18:55:23 +0000
commitef519e9eccb47d53857876c1486270b1a6dd89c2 (patch)
treef038b0a9b20e9b8f6cc3c71eb913c3fe383afa63 /gl
parentf31984b92ad1b31d7e4c964a0949a916371b0a60 (diff)
downloadlibtool-ef519e9eccb47d53857876c1486270b1a6dd89c2.tar.gz
bootstrap: sync with upstream for runtime M4 checking functions.
* gl/build-aux/extract-trace: Sync with upstream for runtime M4 checking functions. * bootstrap: Regenerate. * NEWS: Update. Signed-off-by: Gary V. Vaughan <gary@gnu.org>
Diffstat (limited to 'gl')
-rwxr-xr-xgl/build-aux/extract-trace135
1 files changed, 96 insertions, 39 deletions
diff --git a/gl/build-aux/extract-trace b/gl/build-aux/extract-trace
index 41a7b8b0..14b0f0a0 100755
--- a/gl/build-aux/extract-trace
+++ b/gl/build-aux/extract-trace
@@ -12,7 +12,7 @@ test -z "$progpath" && . `echo "$0" |${SED-sed} 's|[^/]*$||'`/funclib.sh
test extract-trace = "$progname" && . `echo "$0" |${SED-sed} 's|[^/]*$||'`/options-parser
# Set a version string.
-scriptversion=2014-01-04.01; # UTC
+scriptversion=2014-12-03.16; # UTC
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -81,6 +81,68 @@ func_autoconf_configure ()
}
+# func_tool_version_output CMD [FATAL-ERROR-MSG]
+# ----------------------------------------------
+# Attempt to run 'CMD --version', discarding errors. The output can be
+# ignored by redirecting stdout, and this function used simply to test
+# whether the command exists and exits normally when passed a
+# '--version' argument.
+# When FATAL-ERROR-MSG is given, then this function will display the
+# message and exit if running 'CMD --version' returns a non-zero exit
+# status.
+func_tool_version_output ()
+{
+ $debug_cmd
+
+ _G_cmd=$1
+ _G_fatal_error_msg=$2
+
+ # Some tools, like 'git2cl' produce thousands of lines of output
+ # unless stdin is /dev/null - in that case we want to return
+ # successfully without saving all of that output. Other tools,
+ # such as 'help2man' exit with a non-zero status when stdin comes
+ # from /dev/null, so we re-execute without /dev/null if that
+ # happens. This means that occasionally, the output from both calls
+ # ends up in the result, but the alternative would be to discard the
+ # output from one call, and hope the other produces something useful.
+ { $_G_cmd --version </dev/null || $_G_cmd --version; } 2>/dev/null
+ _G_status=$?
+
+ test 0 -ne "$_G_status" && test -n "$_G_fatal_error_msg" \
+ && func_fatal_error "$_G_fatal_error_msg"
+
+ (exit $_G_status)
+}
+
+
+# func_tool_version_number CMD [FATAL-ERROR-MSG]
+# ----------------------------------------------
+# Pass arguments to func_tool_version_output, but set
+# $func_tool_version_number_result to the last dot delimited digit string
+# on the first line of output.
+func_tool_version_number ()
+{
+ $debug_cmd
+
+ _G_verout=`func_tool_version_output "$@" |sed 1q`
+ _G_status=$?
+
+ # A version number starts with a digit following a space on the first
+ # line of output from `--version`.
+ if test -n "$_G_verout"; then
+ _G_vernum=`expr "$_G_verout" : '.* \([0-9][^ ]*\)'`
+ fi
+
+ if test -n "$_G_vernum"; then
+ printf '%s\n' "$_G_vernum"
+ else
+ printf '%s\n' "$_G_verout"
+ fi
+
+ (exit $_G_status)
+}
+
+
# func_find_tool ENVVAR NAMES...
# ------------------------------
# Search for a required program. Use the value of ENVVAR, if set,
@@ -98,16 +160,44 @@ func_find_tool ()
if test -n "$_G_find_tool_res"; then
_G_find_tool_error_prefix="\$$find_tool_envvar: "
else
+ _G_find_tool_res=
+ _G_bestver=
for _G_prog
do
- if func_tool_version_output $_G_prog >/dev/null; then
- _G_find_tool_res=$_G_prog
- break
- fi
+ _G_find_tool_save_IFS=$IFS
+ IFS=:
+ for _G_dir in $PATH; do
+ IFS=$_G_find_tool_save_IFS
+ _G_progpath=$_G_dir/$_G_prog
+ test -r $_G_progpath && {
+ _G_curver=`func_tool_version_number $_G_progpath`
+ case $_G_bestver,$_G_curver in
+ ,)
+ # first non--version responsive prog sticks!
+ test -n "$_G_progpath" || _G_find_tool_res=$_G_progpath
+ ;;
+ ,*)
+ # first --version responsive prog beats non--version responsive!
+ _G_find_tool_res=$_G_progpath
+ _G_bestver=$_G_curver
+ ;;
+ *,*)
+ # another --version responsive prog must be newer to beat previous one!
+ test "x$_G_curver" = "x$_G_bestver" \
+ || func_lt_ver "$_G_curver" "$_G_bestver" \
+ || {
+ _G_find_tool_res=$_G_progpath
+ _G_bestver=$_G_curver
+ }
+ ;;
+ esac
+ }
+ done
+ IFS=$_G_find_tool_save_IFS
done
fi
if test -n "$_G_find_tool_res"; then
- func_tool_version_output >/dev/null $_G_find_tool_res "\
+ func_tool_version_number >/dev/null $_G_find_tool_res "\
${_G_find_tool_error_prefix}Cannot run '$_G_find_tool_res --version'"
# Make sure the result is exported to the environment for children
@@ -122,39 +212,6 @@ One of these is required:
}
-# func_tool_version_output CMD [FATAL-ERROR-MSG]
-# ----------------------------------------------
-# Attempt to run 'CMD --version', discarding errors. The output can be
-# ignored by redirecting stdout, and this function used simply to test
-# whether the command exists and exits normally when passed a
-# '--version' argument.
-# When FATAL-ERROR-MSG is given, then this function will display the
-# message and exit if running 'CMD --version' returns a non-zero exit
-# status.
-func_tool_version_output ()
-{
- $debug_cmd
-
- _G_cmd=$1
- _G_fatal_error_msg=$2
-
- # Some tools, like 'git2cl' produce thousands of lines of output
- # unless stdin is /dev/null - in that case we want to return
- # successfully without saving all of that output. Other tools,
- # such as 'help2man' exit with a non-zero status when stdin comes
- # from /dev/null, so we re-execute without /dev/null if that
- # happens. This means that occasionally, the output from both calls
- # ends up in the result, but the alternative would be to discard the
- # output from one call, and hope the other produces something useful.
- { $_G_cmd --version </dev/null || $_G_cmd --version; } 2>/dev/null
- _G_status=$?
-
- test 0 -ne "$_G_status" && test -n "$_G_fatal_error_msg" \
- && func_fatal_error "$_G_fatal_error_msg"
-
- (exit $_G_status)
-}
-
## -------------------- ##
## Resource management. ##