]> git.ipfire.org Git - thirdparty/libtool.git/commitdiff
bootstrap: sync with upstream for runtime M4 checking functions.
authorGary V. Vaughan <gary@gnu.org>
Wed, 3 Dec 2014 18:53:08 +0000 (18:53 +0000)
committerGary V. Vaughan <gary@gnu.org>
Wed, 3 Dec 2014 18:55:23 +0000 (18:55 +0000)
* 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>
NEWS
bootstrap
gl/build-aux/extract-trace

diff --git a/NEWS b/NEWS
index cec276e31d67d0f093f566fc4d6ba77d5555472d..280ab4c59fc54e4256b37ba9ed388b0cf7eaa587 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -2,6 +2,11 @@ NEWS - list of user-visible changes between releases of GNU Libtool
 
 * Noteworthy changes in release ?.? (????-??-??) [?]
 
+** New features:
+
+  - Libtoolize searches for the best available M4 on the user PATH at
+    runtime, rather than settling for the first one found.
+
 ** Bug fixes:
 
   - Bail out at configure time if the installed M4 is not sufficient
index 45d41ec3951169d615de843c1388b620ab1004fc..a6ffd54111b1eabfdf43fd67bb01ee5e2f6c7a4d 100755 (executable)
--- a/bootstrap
+++ b/bootstrap
@@ -2155,7 +2155,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
@@ -2224,6 +2224,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,
@@ -2241,16 +2303,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
@@ -2265,39 +2355,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. ##
index 41a7b8b0da5912cdf6c7d5d6131ddfd49f9a3cfb..14b0f0a093411f8a44ddc259a50a3a79fa1c7080 100755 (executable)
@@ -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. ##