Bump to m4 1.4.19
[platform/upstream/m4.git] / bootstrap
index e123a8b..b9326ba 100755 (executable)
--- a/bootstrap
+++ b/bootstrap
 #! /bin/sh
+## DO NOT EDIT - This file generated from build-aux/bootstrap.in
+##               by inline-source v2019-02-19.15
 
 # Bootstrap an Autotooled package from checked-out sources.
 # Written by Gary V. Vaughan, 2010
+# Inspired by a script written by Paul Eggert.
 
-# Copyright (C) 2010-2013 Free Software Foundation, Inc.
-# This is free software; see the source for copying conditions.  There is NO
-# warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+# This is free software.  There is NO warranty; not even for
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+#
+# Copyright (C) 2010-2019 Bootstrap Authors
+#
+# This file is dual licensed under the terms of the MIT license
+# <https://opensource.org/license/MIT>, and GPL version 2 or later
+# <http://www.gnu.org/licenses/gpl-2.0.html>.  You must apply one of
+# these licenses when using or redistributing this software or any of
+# the files within it.  See the URLs above, or the file `LICENSE`
+# included in the Bootstrap distribution for the full license texts.
 
-# Source required external libraries:
-# Set a version string for this script.
-scriptversion=2013-08-23.20; # UTC
+# You should place a copy of this script under version control in the
+# top-level directory of your project.  The intent is that all
+# customization can be done with a `bootstrap.conf` file also maintained
+# in your version control.
 
-# General shell script boiler plate, and helper functions.
-# Written by Gary V. Vaughan, 2004
+# Please report bugs or propose patches to:
+# <https://github.com/gnulib-modules/bootstrap/issues>
 
-# Copyright (C) 2004-2013 Free Software Foundation, Inc.
-# This is free software; see the source for copying conditions.  There is NO
-# warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 
-# 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
-# the Free Software Foundation; either version 3 of the License, or
-# (at your option) any later version.
+## ------ ##
+## Usage. ##
+## ------ ##
 
-# As a special exception to the GNU General Public License, if you distribute
-# this file as part of a program or library that is built using GNU Libtool,
-# you may include this file under the same distribution terms that you use
-# for the rest of that program.
+# Most GNUish projects do not keep all of the generated Autotool
+# files under version control, but running all of the right tools
+# with the right arguments, in the correct order to regenerate
+# all of those files in readiness for configuration and building
+# can be surprisingly involved!  Many projects have a 'bootstrap'
+# script under version control to invoke Autotools and perform
+# other assorted book-keeping with version numbers and the like.
+#
+# This bootstrap script aims to probe the configure.ac and top
+# Makefile.am of your project to automatically determine what
+# the correct ordering and arguments are and then run the tools for
+# you.  In order to use it, you can generate an initial standalone
+# script with:
+#
+#   gl/build-aux/inline-source gl/build-aux/bootstrap.in > bootstrap
+#
+# You should then store than script in version control for other
+# developers in you project.  It will give you instructions about
+# how to keep it up to date if the sources change.
+#
+# See gl/doc/bootstrap.texi for documentation on how to write
+# a bootstrap.conf to customize it for your project's
+# idiosyncracies.
 
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNES FOR A PARTICULAR PURPOSE. See the GNU
-# General Public License for more details.
 
-# You should have received a copy of the GNU General Public License
-# along with this program. If not, see <http://www.gnu.org/licenses/>.
+## ================================================================== ##
+##                                                                    ##
+##     DO NOT EDIT THIS FILE, CUSTOMIZE IT USING A BOOTSTRAP.CONF     ##
+##                                                                    ##
+## ================================================================== ##
 
-# Please report bugs or propose patches to gary@gnu.org.
+## ------------------------------- ##
+## User overridable command paths. ##
+## ------------------------------- ##
+
+# All uppercase denotes values stored in the environment.  These
+# variables should generally be overridden by the user - however, we do
+# set them to 'true' in some parts of this script to prevent them being
+# called at the wrong time by other tools that we call ('autoreconf',
+# for example).
+#
+# We also allow 'LIBTOOLIZE', 'M4', 'SHA1SUM' and some others to be
+# overridden, and export the result for child processes, but they are
+# handled by the function 'func_find_tool' and not defaulted in this
+# section.
+
+: ${ACLOCAL="aclocal"}
+: ${AUTOCONF="autoconf"}
+: ${AUTOHEADER="autoheader"}
+: ${AUTOM4TE="autom4te"}
+: ${AUTOHEADER="autoheader"}
+: ${AUTOMAKE="automake"}
+: ${AUTOPOINT="autopoint"}
+: ${AUTORECONF="autoreconf"}
+: ${CMP="cmp"}
+: ${CONFIG_SHELL="/bin/sh"}
+: ${DIFF="diff"}
+: ${GIT="git"}
+: ${LN_S="ln -s"}
+: ${RM="rm"}
+
+export ACLOCAL
+export AUTOCONF
+export AUTOHEADER
+export AUTOM4TE
+export AUTOHEADER
+export AUTOMAKE
+export AUTOPOINT
+export AUTORECONF
+export CONFIG_SHELL
+
+
+## -------------- ##
+## Configuration. ##
+## -------------- ##
+
+# A newline delimited list of triples of programs (that respond to
+# --version), the minimum version numbers required (or just '-' in the
+# version field if any version will be sufficient) and homepage URLs
+# to help locate missing packages.
+buildreq=
+
+# Name of a file containing instructions on installing missing packages
+# required in 'buildreq'.
+buildreq_readme=README-hacking
+
+# These are extracted from AC_INIT in configure.ac, though you can
+# override those values in 'bootstrap.conf' if you prefer.
+build_aux=
+macro_dir=
+package=
+package_name=
+package_version=
+package_bugreport=
+
+# These are extracted from 'gnulib-cache.m4', or else fall-back
+# automatically on the gnulib defaults; unless you set the values
+# manually in 'bootstrap.conf'.
+doc_base=
+gnulib_mk=
+gnulib_name=
+local_gl_path=
+source_base=
+tests_base=
+
+# The list of gnulib modules required at 'gnulib-tool' time.  If you
+# check 'gnulib-cache.m4' into your repository, then this list will be
+# extracted automatically.
+gnulib_modules=
+
+# Extra gnulib files that are not in modules, which override files of
+# the same name installed by other bootstrap tools.
+gnulib_non_module_files="
+        build-aux/compile
+        build-aux/install-sh
+        build-aux/mdate-sh
+        build-aux/texinfo.tex
+        build-aux/depcomp
+        build-aux/config.guess
+        build-aux/config.sub
+        doc/INSTALL
+"
+
+# Relative path to the local gnulib submodule, and url to the upstream
+# git repository. If you have a gnulib entry in your .gitmodules file,
+# these values are ignored.
+gnulib_path=
+gnulib_url=
+
+# Date from which to clone github, to avoid a full clone.
+gnulib_clone_since=
+
+# Additional gnulib-tool options to use.
+gnulib_tool_options="
+        --no-changelog
+"
+
+# bootstrap removes any macro-files that are not included by aclocal.m4,
+# except for files listed in this variable that are always kept.
+gnulib_precious="
+        gnulib-tool.m4
+"
+
+# When truncating long commands for display, always allow at least this
+# many characters before truncating.
+min_cmd_len=160
+
+# The command to download all .po files for a specified domain into
+# a specified directory.  Fill in the first %s is the domain name, and
+# the second with the destination directory.  Use rsync's -L and -r
+# options because the latest/%s directory and the .po files within are
+# all symlinks.
+po_download_command_format=\
+"rsync --delete --exclude '*.s1' -Lrtvz \
+'translationproject.org::tp/latest/%s/' '%s'"
+
+# Other locale categories that need message catalogs.
+extra_locale_categories=
+
+# Additional xgettext options to use.  Gnulib might provide you with an
+# extensive list of additional options to append to this, but gettext
+# 0.16.1 and newer appends them automaticaly, so you can safely ignore
+# the complaints from 'gnulib-tool' if your $configure_ac states:
+#
+#    AM_GNU_GETTEXT_VERSION([0.16.1])
+xgettext_options="
+        --flag=_:1:pass-c-format
+        --flag=N_:1:pass-c-format
+"
+
+# Package copyright holder for gettext files.  Defaults to FSF if unset.
+copyright_holder=
+
+# File that should exist in the top directory of a checked out hierarchy,
+# but not in a distribution tarball.
+checkout_only_file=
+
+# Whether to use copies instead of symlinks by default (if set to true,
+# the --copy option has no effect).
+copy=false
+
+# Set this to ".cvsignore .gitignore" in 'bootstrap.conf' if you want
+# those files to be generated in directories like 'lib/', 'm4/', and 'po/',
+# or set it to "auto" to make this script select what to use based
+# on what version control system (if any) is used in the source directory.
+# Or set it to "none" to ignore VCS ignore files entirely.  Default is
+# "auto".
+vc_ignore=
+
+
+## ------------------- ##
+## External Libraries. ##
+## ------------------- ##
+
+# Source required external libraries:
+# Set a version string for this script.
+scriptversion=2019-02-19.15; # UTC
+
+# General shell script boiler plate, and helper functions.
+# Written by Gary V. Vaughan, 2004
+
+# This is free software.  There is NO warranty; not even for
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+#
+# Copyright (C) 2004-2019 Bootstrap Authors
+#
+# This file is dual licensed under the terms of the MIT license
+# <https://opensource.org/license/MIT>, and GPL version 2 or later
+# <http://www.gnu.org/licenses/gpl-2.0.html>.  You must apply one of
+# these licenses when using or redistributing this software or any of
+# the files within it.  See the URLs above, or the file `LICENSE`
+# included in the Bootstrap distribution for the full license texts.
+
+# Please report bugs or propose patches to:
+# <https://github.com/gnulib-modules/bootstrap/issues>
 
 
 ## ------ ##
@@ -85,56 +294,183 @@ do
        fi"
 done
 
-# CDPATH.
-(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
-
 # Make sure IFS has a sensible default
 sp=' '
 nl='
 '
 IFS="$sp       $nl"
 
-# There are still modern systems that have problems with 'echo' mis-
-# handling backslashes, among others, so make sure $bs_echo is set to a
-# command that correctly interprets backslashes.
-# (this code from Autoconf 2.68)
-
-# Printing a long string crashes Solaris 7 /usr/bin/printf.
-bs_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'
-bs_echo=$bs_echo$bs_echo$bs_echo$bs_echo$bs_echo
-bs_echo=$bs_echo$bs_echo$bs_echo$bs_echo$bs_echo$bs_echo
-# Prefer a ksh shell builtin over an external printf program on Solaris,
-# but without wasting forks for bash or zsh.
-if test -z "$BASH_VERSION$ZSH_VERSION" \
-    && (test "X`print -r -- $bs_echo`" = "X$bs_echo") 2>/dev/null; then
-  bs_echo='print -r --'
-  bs_echo_n='print -rn --'
-elif (test "X`printf %s $bs_echo`" = "X$bs_echo") 2>/dev/null; then
-  bs_echo='printf %s\n'
-  bs_echo_n='printf %s'
-else
-  if test "X`(/usr/ucb/echo -n -n $bs_echo) 2>/dev/null`" = "X-n $bs_echo"; then
-    bs_echo_body='eval /usr/ucb/echo -n "$1$nl"'
-    bs_echo_n='/usr/ucb/echo -n'
-  else
-    bs_echo_body='eval expr "X$1" : "X\\(.*\\)"'
-    bs_echo_n_body='eval
-      arg=$1;
-      case $arg in #(
-      *"$nl"*)
-       expr "X$arg" : "X\\(.*\\)$nl";
-       arg=`expr "X$arg" : ".*$nl\\(.*\\)"`;;
-      esac;
-      expr "X$arg" : "X\\(.*\\)" | tr -d "$nl"
-    '
-    export bs_echo_n_body
-    bs_echo_n='sh -c $bs_echo_n_body bs_echo'
-  fi
-  export bs_echo_body
-  bs_echo='sh -c $bs_echo_body bs_echo'
+# There are apparently some retarded systems that use ';' as a PATH separator!
+if test "${PATH_SEPARATOR+set}" != set; then
+  PATH_SEPARATOR=:
+  (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && {
+    (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 ||
+      PATH_SEPARATOR=';'
+  }
 fi
 
 
+# func_unset VAR
+# --------------
+# Portably unset VAR.
+# In some shells, an 'unset VAR' statement leaves a non-zero return
+# status if VAR is already unset, which might be problematic if the
+# statement is used at the end of a function (thus poisoning its return
+# value) or when 'set -e' is active (causing even a spurious abort of
+# the script in this case).
+func_unset ()
+{
+    { eval $1=; (eval unset $1) >/dev/null 2>&1 && eval unset $1 || : ; }
+}
+
+
+# Make sure CDPATH doesn't cause `cd` commands to output the target dir.
+func_unset CDPATH
+
+# Make sure ${,E,F}GREP behave sanely.
+func_unset GREP_OPTIONS
+
+
+## ------------------------- ##
+## Locate command utilities. ##
+## ------------------------- ##
+
+
+# func_executable_p FILE
+# ----------------------
+# Check that FILE is an executable regular file.
+func_executable_p ()
+{
+    test -f "$1" && test -x "$1"
+}
+
+
+# func_path_progs PROGS_LIST CHECK_FUNC [PATH]
+# --------------------------------------------
+# Search for either a program that responds to --version with output
+# containing "GNU", or else returned by CHECK_FUNC otherwise, by
+# trying all the directories in PATH with each of the elements of
+# PROGS_LIST.
+#
+# CHECK_FUNC should accept the path to a candidate program, and
+# set $func_check_prog_result if it truncates its output less than
+# $_G_path_prog_max characters.
+func_path_progs ()
+{
+    _G_progs_list=$1
+    _G_check_func=$2
+    _G_PATH=${3-"$PATH"}
+
+    _G_path_prog_max=0
+    _G_path_prog_found=false
+    _G_save_IFS=$IFS; IFS=${PATH_SEPARATOR-:}
+    for _G_dir in $_G_PATH; do
+      IFS=$_G_save_IFS
+      test -z "$_G_dir" && _G_dir=.
+      for _G_prog_name in $_G_progs_list; do
+        for _exeext in '' .EXE; do
+          _G_path_prog=$_G_dir/$_G_prog_name$_exeext
+          func_executable_p "$_G_path_prog" || continue
+          case `"$_G_path_prog" --version 2>&1` in
+            *GNU*) func_path_progs_result=$_G_path_prog _G_path_prog_found=: ;;
+            *)     $_G_check_func $_G_path_prog
+                  func_path_progs_result=$func_check_prog_result
+                  ;;
+          esac
+          $_G_path_prog_found && break 3
+        done
+      done
+    done
+    IFS=$_G_save_IFS
+    test -z "$func_path_progs_result" && {
+      echo "no acceptable sed could be found in \$PATH" >&2
+      exit 1
+    }
+}
+
+
+# We want to be able to use the functions in this file before configure
+# has figured out where the best binaries are kept, which means we have
+# to search for them ourselves - except when the results are already set
+# where we skip the searches.
+
+# Unless the user overrides by setting SED, search the path for either GNU
+# sed, or the sed that truncates its output the least.
+test -z "$SED" && {
+  _G_sed_script=s/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb/
+  for _G_i in 1 2 3 4 5 6 7; do
+    _G_sed_script=$_G_sed_script$nl$_G_sed_script
+  done
+  echo "$_G_sed_script" 2>/dev/null | sed 99q >conftest.sed
+  _G_sed_script=
+
+  func_check_prog_sed ()
+  {
+    _G_path_prog=$1
+
+    _G_count=0
+    printf 0123456789 >conftest.in
+    while :
+    do
+      cat conftest.in conftest.in >conftest.tmp
+      mv conftest.tmp conftest.in
+      cp conftest.in conftest.nl
+      echo '' >> conftest.nl
+      "$_G_path_prog" -f conftest.sed <conftest.nl >conftest.out 2>/dev/null || break
+      diff conftest.out conftest.nl >/dev/null 2>&1 || break
+      _G_count=`expr $_G_count + 1`
+      if test "$_G_count" -gt "$_G_path_prog_max"; then
+        # Best one so far, save it but keep looking for a better one
+        func_check_prog_result=$_G_path_prog
+        _G_path_prog_max=$_G_count
+      fi
+      # 10*(2^10) chars as input seems more than enough
+      test 10 -lt "$_G_count" && break
+    done
+    rm -f conftest.in conftest.tmp conftest.nl conftest.out
+  }
+
+  func_path_progs "sed gsed" func_check_prog_sed "$PATH:/usr/xpg4/bin"
+  rm -f conftest.sed
+  SED=$func_path_progs_result
+}
+
+
+# Unless the user overrides by setting GREP, search the path for either GNU
+# grep, or the grep that truncates its output the least.
+test -z "$GREP" && {
+  func_check_prog_grep ()
+  {
+    _G_path_prog=$1
+
+    _G_count=0
+    _G_path_prog_max=0
+    printf 0123456789 >conftest.in
+    while :
+    do
+      cat conftest.in conftest.in >conftest.tmp
+      mv conftest.tmp conftest.in
+      cp conftest.in conftest.nl
+      echo 'GREP' >> conftest.nl
+      "$_G_path_prog" -e 'GREP$' -e '-(cannot match)-' <conftest.nl >conftest.out 2>/dev/null || break
+      diff conftest.out conftest.nl >/dev/null 2>&1 || break
+      _G_count=`expr $_G_count + 1`
+      if test "$_G_count" -gt "$_G_path_prog_max"; then
+        # Best one so far, save it but keep looking for a better one
+        func_check_prog_result=$_G_path_prog
+        _G_path_prog_max=$_G_count
+      fi
+      # 10*(2^10) chars as input seems more than enough
+      test 10 -lt "$_G_count" && break
+    done
+    rm -f conftest.in conftest.tmp conftest.nl conftest.out
+  }
+
+  func_path_progs "grep ggrep" func_check_prog_grep "$PATH:/usr/xpg4/bin"
+  GREP=$func_path_progs_result
+}
+
+
 ## ------------------------------- ##
 ## User overridable command paths. ##
 ## ------------------------------- ##
@@ -145,16 +481,14 @@ fi
 # in the command search PATH.
 
 : ${CP="cp -f"}
-: ${ECHO="$bs_echo"}
-: ${EGREP="grep -E"}
-: ${FGREP="grep -F"}
-: ${GREP="grep"}
+: ${ECHO="printf %s\n"}
+: ${EGREP="$GREP -E"}
+: ${FGREP="$GREP -F"}
 : ${LN_S="ln -s"}
 : ${MAKE="make"}
 : ${MKDIR="mkdir"}
 : ${MV="mv -f"}
 : ${RM="rm -f"}
-: ${SED="sed"}
 : ${SHELL="${CONFIG_SHELL-/bin/sh}"}
 
 
@@ -245,13 +579,13 @@ exit_status=$EXIT_SUCCESS
 progpath=$0
 
 # The name of this program.
-progname=`$bs_echo "$progpath" |$SED "$sed_basename"`
+progname=`$ECHO "$progpath" |$SED "$sed_basename"`
 
 # Make sure we have an absolute progpath for reexecution:
 case $progpath in
   [\\/]*|[A-Za-z]:\\*) ;;
   *[\\/]*)
-     progdir=`$bs_echo "$progpath" |$SED "$sed_dirname"`
+     progdir=`$ECHO "$progpath" |$SED "$sed_dirname"`
      progdir=`cd "$progdir" && pwd`
      progpath=$progdir/$progname
      ;;
@@ -417,16 +751,16 @@ if test yes = "$_G_HAVE_PLUSEQ_OP"; then
   {
     $debug_cmd
 
-    func_quote_for_eval "$2"
-    eval "$1+=\\ \$func_quote_for_eval_result"
+    func_quote_arg pretty "$2"
+    eval "$1+=\\ \$func_quote_arg_result"
   }'
 else
   func_append_quoted ()
   {
     $debug_cmd
 
-    func_quote_for_eval "$2"
-    eval "$1=\$$1\\ \$func_quote_for_eval_result"
+    func_quote_arg pretty "$2"
+    eval "$1=\$$1\\ \$func_quote_arg_result"
   }
 fi
 
@@ -445,7 +779,7 @@ func_append_uniq ()
 {
     $debug_cmd
 
-    eval _G_current_value='`$bs_echo $'$1'`'
+    eval _G_current_value='`$ECHO $'$1'`'
     _G_delim=`expr "$2" : '\(.\)'`
 
     case $_G_delim$_G_current_value$_G_delim in
@@ -558,7 +892,7 @@ func_echo ()
     IFS=$nl
     for _G_line in $_G_message; do
       IFS=$func_echo_IFS
-      $bs_echo "$progname: $_G_line"
+      $ECHO "$progname: $_G_line"
     done
     IFS=$func_echo_IFS
 }
@@ -592,17 +926,17 @@ func_echo_infix_1 ()
     for _G_tc in "$tc_reset" "$tc_bold" "$tc_standout" "$tc_red" "$tc_green" "$tc_blue" "$tc_cyan"
     do
       test -n "$_G_tc" && {
-        _G_esc_tc=`$bs_echo "$_G_tc" | sed "$sed_make_literal_regex"`
-        _G_indent=`$bs_echo "$_G_indent" | sed "s|$_G_esc_tc||g"`
+        _G_esc_tc=`$ECHO "$_G_tc" | $SED "$sed_make_literal_regex"`
+        _G_indent=`$ECHO "$_G_indent" | $SED "s|$_G_esc_tc||g"`
       }
     done
-    _G_indent="$progname: "`echo "$_G_indent" | sed 's|.| |g'`"  " ## exclude from sc_prohibit_nested_quotes
+    _G_indent="$progname: "`echo "$_G_indent" | $SED 's|.| |g'`"  " ## exclude from sc_prohibit_nested_quotes
 
     func_echo_infix_1_IFS=$IFS
     IFS=$nl
     for _G_line in $_G_message; do
       IFS=$func_echo_infix_1_IFS
-      $bs_echo "$_G_prefix$tc_bold$_G_line$tc_reset" >&2
+      $ECHO "$_G_prefix$tc_bold$_G_line$tc_reset" >&2
       _G_prefix=$_G_indent
     done
     IFS=$func_echo_infix_1_IFS
@@ -928,85 +1262,199 @@ func_relative_path ()
 }
 
 
-# func_quote_for_eval ARG...
-# --------------------------
-# Aesthetically quote ARGs to be evaled later.
-# This function returns two values:
-#   i) func_quote_for_eval_result
-#      double-quoted, suitable for a subsequent eval
-#  ii) func_quote_for_eval_unquoted_result
-#      has all characters that are still active within double
-#      quotes backslashified.
-func_quote_for_eval ()
+# func_quote_portable EVAL ARG
+# ----------------------------
+# Internal function to portably implement func_quote_arg.  Note that we still
+# keep attention to performance here so we as much as possible try to avoid
+# calling sed binary (so far O(N) complexity as long as func_append is O(1)).
+func_quote_portable ()
 {
     $debug_cmd
 
-    func_quote_for_eval_unquoted_result=
-    func_quote_for_eval_result=
-    while test 0 -lt $#; do
-      case $1 in
-        *[\\\`\"\$]*)
-         _G_unquoted_arg=`printf '%s\n' "$1" |$SED "$sed_quote_subst"` ;;
-        *)
-          _G_unquoted_arg=$1 ;;
-      esac
-      if test -n "$func_quote_for_eval_unquoted_result"; then
-       func_append func_quote_for_eval_unquoted_result " $_G_unquoted_arg"
-      else
-        func_append func_quote_for_eval_unquoted_result "$_G_unquoted_arg"
+    func_quote_portable_result=$2
+
+    # one-time-loop (easy break)
+    while true
+    do
+      if $1; then
+        func_quote_portable_result=`$ECHO "$2" | $SED \
+          -e "$sed_double_quote_subst" -e "$sed_double_backslash"`
+        break
       fi
 
-      case $_G_unquoted_arg in
-        # Double-quote args containing shell metacharacters to delay
-        # word splitting, command substitution and variable expansion
-        # for a subsequent eval.
-        # Many Bourne shells cannot handle close brackets correctly
-        # in scan sets, so we specify it separately.
-        *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \  ]*|*]*|"")
-          _G_quoted_arg=\"$_G_unquoted_arg\"
+      # Quote for eval.
+      case $func_quote_portable_result in
+        *[\\\`\"\$]*)
+          case $func_quote_portable_result in
+            *[\[\*\?]*)
+              func_quote_portable_result=`$ECHO "$func_quote_portable_result" \
+                  | $SED "$sed_quote_subst"`
+              break
+              ;;
+          esac
+
+          func_quote_portable_old_IFS=$IFS
+          for _G_char in '\' '`' '"' '$'
+          do
+            # STATE($1) PREV($2) SEPARATOR($3)
+            set start "" ""
+            func_quote_portable_result=dummy"$_G_char$func_quote_portable_result$_G_char"dummy
+            IFS=$_G_char
+            for _G_part in $func_quote_portable_result
+            do
+              case $1 in
+              quote)
+                func_append func_quote_portable_result "$3$2"
+                set quote "$_G_part" "\\$_G_char"
+                ;;
+              start)
+                set first "" ""
+                func_quote_portable_result=
+                ;;
+              first)
+                set quote "$_G_part" ""
+                ;;
+              esac
+            done
+          done
+          IFS=$func_quote_portable_old_IFS
           ;;
-        *)
-          _G_quoted_arg=$_G_unquoted_arg
-         ;;
+        *) ;;
       esac
-
-      if test -n "$func_quote_for_eval_result"; then
-       func_append func_quote_for_eval_result " $_G_quoted_arg"
-      else
-        func_append func_quote_for_eval_result "$_G_quoted_arg"
-      fi
-      shift
+      break
     done
+
+    func_quote_portable_unquoted_result=$func_quote_portable_result
+    case $func_quote_portable_result in
+      # double-quote args containing shell metacharacters to delay
+      # word splitting, command substitution and variable expansion
+      # for a subsequent eval.
+      # many bourne shells cannot handle close brackets correctly
+      # in scan sets, so we specify it separately.
+      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \    ]*|*]*|"")
+        func_quote_portable_result=\"$func_quote_portable_result\"
+        ;;
+    esac
 }
 
 
-# func_quote_for_expand ARG
-# -------------------------
-# Aesthetically quote ARG to be evaled later; same as above,
-# but do not quote variable references.
-func_quote_for_expand ()
-{
-    $debug_cmd
+# func_quotefast_eval ARG
+# -----------------------
+# Quote one ARG (internal).  This is equivalent to 'func_quote_arg eval ARG',
+# but optimized for speed.  Result is stored in $func_quotefast_eval.
+if test xyes = `(x=; printf -v x %q yes; echo x"$x") 2>/dev/null`; then
+  printf -v _GL_test_printf_tilde %q '~'
+  if test '\~' = "$_GL_test_printf_tilde"; then
+    func_quotefast_eval ()
+    {
+      printf -v func_quotefast_eval_result %q "$1"
+    }
+  else
+    # Broken older Bash implementations.  Make those faster too if possible.
+    func_quotefast_eval ()
+    {
+      case $1 in
+        '~'*)
+          func_quote_portable false "$1"
+          func_quotefast_eval_result=$func_quote_portable_result
+          ;;
+        *)
+          printf -v func_quotefast_eval_result %q "$1"
+          ;;
+      esac
+    }
+  fi
+else
+  func_quotefast_eval ()
+  {
+    func_quote_portable false "$1"
+    func_quotefast_eval_result=$func_quote_portable_result
+  }
+fi
 
-    case $1 in
-      *[\\\`\"]*)
-       _G_arg=`$ECHO "$1" | $SED \
-           -e "$sed_double_quote_subst" -e "$sed_double_backslash"` ;;
-      *)
-        _G_arg=$1 ;;
+
+# func_quote_arg MODEs ARG
+# ------------------------
+# Quote one ARG to be evaled later.  MODEs argument may contain zero or more
+# specifiers listed below separated by ',' character.  This function returns two
+# values:
+#   i) func_quote_arg_result
+#      double-quoted (when needed), suitable for a subsequent eval
+#  ii) func_quote_arg_unquoted_result
+#      has all characters that are still active within double
+#      quotes backslashified.  Available only if 'unquoted' is specified.
+#
+# Available modes:
+# ----------------
+# 'eval' (default)
+#       - escape shell special characters
+# 'expand'
+#       - the same as 'eval';  but do not quote variable references
+# 'pretty'
+#       - request aesthetic output, i.e. '"a b"' instead of 'a\ b'.  This might
+#         be used later in func_quote to get output like: 'echo "a b"' instead
+#         of 'echo a\ b'.  This is slower than default on some shells.
+# 'unquoted'
+#       - produce also $func_quote_arg_unquoted_result which does not contain
+#         wrapping double-quotes.
+#
+# Examples for 'func_quote_arg pretty,unquoted string':
+#
+#   string      | *_result              | *_unquoted_result
+#   ------------+-----------------------+-------------------
+#   "           | \"                    | \"
+#   a b         | "a b"                 | a b
+#   "a b"       | "\"a b\""             | \"a b\"
+#   *           | "*"                   | *
+#   z="${x-$y}" | "z=\"\${x-\$y}\""     | z=\"\${x-\$y}\"
+#
+# Examples for 'func_quote_arg pretty,unquoted,expand string':
+#
+#   string        |   *_result          |  *_unquoted_result
+#   --------------+---------------------+--------------------
+#   z="${x-$y}"   | "z=\"${x-$y}\""     | z=\"${x-$y}\"
+func_quote_arg ()
+{
+    _G_quote_expand=false
+    case ,$1, in
+      *,expand,*)
+        _G_quote_expand=:
+        ;;
     esac
 
-    case $_G_arg in
-      # Double-quote args containing shell metacharacters to delay
-      # word splitting and command substitution for a subsequent eval.
-      # Many Bourne shells cannot handle close brackets correctly
-      # in scan sets, so we specify it separately.
-      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \    ]*|*]*|"")
-        _G_arg=\"$_G_arg\"
+    case ,$1, in
+      *,pretty,*|*,expand,*|*,unquoted,*)
+        func_quote_portable $_G_quote_expand "$2"
+        func_quote_arg_result=$func_quote_portable_result
+        func_quote_arg_unquoted_result=$func_quote_portable_unquoted_result
+        ;;
+      *)
+        # Faster quote-for-eval for some shells.
+        func_quotefast_eval "$2"
+        func_quote_arg_result=$func_quotefast_eval_result
         ;;
     esac
+}
+
 
-    func_quote_for_expand_result=$_G_arg
+# func_quote MODEs ARGs...
+# ------------------------
+# Quote all ARGs to be evaled later and join them into single command.  See
+# func_quote_arg's description for more info.
+func_quote ()
+{
+    $debug_cmd
+    _G_func_quote_mode=$1 ; shift
+    func_quote_result=
+    while test 0 -lt $#; do
+      func_quote_arg "$_G_func_quote_mode" "$1"
+      if test -n "$func_quote_result"; then
+        func_append func_quote_result " $func_quote_arg_result"
+      else
+        func_append func_quote_result "$func_quote_arg_result"
+      fi
+      shift
+    done
 }
 
 
@@ -1052,8 +1500,8 @@ func_show_eval ()
     _G_cmd=$1
     _G_fail_exp=${2-':'}
 
-    func_quote_for_expand "$_G_cmd"
-    eval "func_notquiet $func_quote_for_expand_result"
+    func_quote_arg pretty,expand "$_G_cmd"
+    eval "func_notquiet $func_quote_arg_result"
 
     $opt_dry_run || {
       eval "$_G_cmd"
@@ -1078,8 +1526,8 @@ func_show_eval_locale ()
     _G_fail_exp=${2-':'}
 
     $opt_quiet || {
-      func_quote_for_expand "$_G_cmd"
-      eval "func_echo $func_quote_for_expand_result"
+      func_quote_arg expand,pretty "$_G_cmd"
+      eval "func_echo $func_quote_arg_result"
     }
 
     $opt_dry_run || {
@@ -1166,39 +1614,66 @@ func_warning ()
 }
 
 
+# func_sort_ver VER1 VER2
+# -----------------------
+# 'sort -V' is not generally available.
+# Note this deviates from the version comparison in automake
+# in that it treats 1.5 < 1.5.0, and treats 1.4.4a < 1.4-p3a
+# but this should suffice as we won't be specifying old
+# version formats or redundant trailing .0 in bootstrap.conf.
+# If we did want full compatibility then we should probably
+# use m4_version_compare from autoconf.
+func_sort_ver ()
+{
+    $debug_cmd
+
+    printf '%s\n%s\n' "$1" "$2" \
+      | sort -t. -k 1,1n -k 2,2n -k 3,3n -k 4,4n -k 5,5n -k 6,6n -k 7,7n -k 8,8n -k 9,9n
+}
+
+# func_lt_ver PREV CURR
+# ---------------------
+# Return true if PREV and CURR are in the correct order according to
+# func_sort_ver, otherwise false.  Use it like this:
+#
+#  func_lt_ver "$prev_ver" "$proposed_ver" || func_fatal_error "..."
+func_lt_ver ()
+{
+    $debug_cmd
+
+    test "x$1" = x`func_sort_ver "$1" "$2" | $SED 1q`
+}
+
+
 # Local variables:
 # mode: shell-script
 # sh-indentation: 2
-# eval: (add-hook 'write-file-hooks 'time-stamp)
+# eval: (add-hook 'before-save-hook 'time-stamp)
 # time-stamp-pattern: "10/scriptversion=%:y-%02m-%02d.%02H; # UTC"
 # time-stamp-time-zone: "UTC"
 # End:
 #! /bin/sh
 
-# Set a version string for this script.
-scriptversion=2012-10-21.11; # UTC
-
 # A portable, pluggable option parser for Bourne shell.
 # Written by Gary V. Vaughan, 2010
 
-# Copyright (C) 2010-2013 Free Software Foundation, Inc.
-# This is free software; see the source for copying conditions.  There is NO
-# warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-
-# 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
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
+# This is free software.  There is NO warranty; not even for
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+#
+# Copyright (C) 2010-2019 Bootstrap Authors
+#
+# This file is dual licensed under the terms of the MIT license
+# <https://opensource.org/license/MIT>, and GPL version 2 or later
+# <http://www.gnu.org/licenses/gpl-2.0.html>.  You must apply one of
+# these licenses when using or redistributing this software or any of
+# the files within it.  See the URLs above, or the file `LICENSE`
+# included in the Bootstrap distribution for the full license texts.
 
-# You should have received a copy of the GNU General Public License
-# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+# Please report bugs or propose patches to:
+# <https://github.com/gnulib-modules/bootstrap/issues>
 
-# Please report bugs or propose patches to gary@gnu.org.
+# Set a version string for this script.
+scriptversion=2019-02-19.15; # UTC
 
 
 ## ------ ##
@@ -1221,7 +1696,7 @@ scriptversion=2012-10-21.11; # UTC
 #
 # In order for the '--version' option to work, you will need to have a
 # suitably formatted comment like the one at the top of this file
-# starting with '# Written by ' and ending with '# warranty; '.
+# starting with '# Written by ' and ending with '# Copyright'.
 #
 # For '-h' and '--help' to work, you will also need a one line
 # description of your script's purpose in a comment directly above the
@@ -1233,7 +1708,7 @@ scriptversion=2012-10-21.11; # UTC
 # to display verbose messages only when your user has specified
 # '--verbose'.
 #
-# After sourcing this file, you can plug processing for additional
+# After sourcing this file, you can plug in processing for additional
 # options by amending the variables from the 'Configuration' section
 # below, and following the instructions in the 'Option parsing'
 # section further down.
@@ -1282,8 +1757,8 @@ fatal_help="Try '\$progname --help' for more information."
 ## ------------------------- ##
 
 # This section contains functions for adding, removing, and running hooks
-# to the main code.  A hook is just a named list of of function, that can
-# be run in order later on.
+# in the main code.  A hook is just a list of function names that can be
+# run in order later on.
 
 # func_hookable FUNC_NAME
 # -----------------------
@@ -1316,19 +1791,38 @@ func_add_hook ()
 
 # func_remove_hook FUNC_NAME HOOK_FUNC
 # ------------------------------------
-# Remove HOOK_FUNC from the list of functions called by FUNC_NAME.
+# Remove HOOK_FUNC from the list of hook functions to be called by
+# FUNC_NAME.
 func_remove_hook ()
 {
     $debug_cmd
 
-    eval ${1}_hooks='`$bs_echo "\$'$1'_hooks" |$SED "s| '$2'||"`'
+    eval ${1}_hooks='`$ECHO "\$'$1'_hooks" |$SED "s| '$2'||"`'
+}
+
+
+# func_propagate_result FUNC_NAME_A FUNC_NAME_B
+# ---------------------------------------------
+# If the *_result variable of FUNC_NAME_A _is set_, assign its value to
+# *_result variable of FUNC_NAME_B.
+func_propagate_result ()
+{
+    $debug_cmd
+
+    func_propagate_result_result=:
+    if eval "test \"\${${1}_result+set}\" = set"
+    then
+      eval "${2}_result=\$${1}_result"
+    else
+      func_propagate_result_result=false
+    fi
 }
 
 
 # func_run_hooks FUNC_NAME [ARG]...
 # ---------------------------------
 # Run all hook functions registered to FUNC_NAME.
-# It is assumed that the list of hook functions contains nothing more
+# It's assumed that the list of hook functions contains nothing more
 # than a whitespace-delimited list of legal shell function names, and
 # no effort is wasted trying to catch shell meta-characters or preserve
 # whitespace.
@@ -1338,22 +1832,19 @@ func_run_hooks ()
 
     case " $hookable_fns " in
       *" $1 "*) ;;
-      *) func_fatal_error "'$1' does not support hook funcions.n" ;;
+      *) func_fatal_error "'$1' does not support hook functions." ;;
     esac
 
     eval _G_hook_fns=\$$1_hooks; shift
 
     for _G_hook in $_G_hook_fns; do
-      eval $_G_hook '"$@"'
-
-      # store returned options list back into positional
-      # parameters for next 'cmd' execution.
-      eval _G_hook_result=\$${_G_hook}_result
-      eval set dummy "$_G_hook_result"; shift
+      func_unset "${_G_hook}_result"
+      eval $_G_hook '${1+"$@"}'
+      func_propagate_result $_G_hook func_run_hooks
+      if $func_propagate_result_result; then
+        eval set dummy "$func_run_hooks_result"; shift
+      fi
     done
-
-    func_quote_for_eval ${1+"$@"}
-    func_run_hooks_result=$func_quote_for_eval_result
 }
 
 
@@ -1363,10 +1854,18 @@ func_run_hooks ()
 ## --------------- ##
 
 # In order to add your own option parsing hooks, you must accept the
-# full positional parameter list in your hook function, remove any
-# options that you action, and then pass back the remaining unprocessed
-# options in '<hooked_function_name>_result', escaped suitably for
-# 'eval'.  Like this:
+# full positional parameter list from your hook function.  You may remove
+# or edit any options that you action, and then pass back the remaining
+# unprocessed options in '<hooked_function_name>_result', escaped
+# suitably for 'eval'.
+#
+# The '<hooked_function_name>_result' variable is automatically unset
+# before your hook gets called; for best performance, only set the
+# *_result variable when necessary (i.e. don't call the 'func_quote'
+# function unnecessarily because it can be an expensive operation on some
+# machines).
+#
+# Like this:
 #
 #    my_options_prep ()
 #    {
@@ -1376,9 +1875,8 @@ func_run_hooks ()
 #        usage_message=$usage_message'
 #      -s, --silent       don'\''t print informational messages
 #    '
-#
-#        func_quote_for_eval ${1+"$@"}
-#        my_options_prep_result=$func_quote_for_eval_result
+#        # No change in '$@' (ignored completely by this hook).  Leave
+#        # my_options_prep_result variable intact.
 #    }
 #    func_add_hook func_options_prep my_options_prep
 #
@@ -1387,25 +1885,36 @@ func_run_hooks ()
 #    {
 #        $debug_cmd
 #
-#        # Note that for efficiency, we parse as many options as we can
+#        args_changed=false
+#
+#        # Note that, for efficiency, we parse as many options as we can
 #        # recognise in a loop before passing the remainder back to the
 #        # caller on the first unrecognised argument we encounter.
 #        while test $# -gt 0; do
 #          opt=$1; shift
 #          case $opt in
-#            --silent|-s) opt_silent=: ;;
+#            --silent|-s) opt_silent=:
+#                         args_changed=:
+#                         ;;
 #            # Separate non-argument short options:
 #            -s*)         func_split_short_opt "$_G_opt"
 #                         set dummy "$func_split_short_opt_name" \
 #                             "-$func_split_short_opt_arg" ${1+"$@"}
 #                         shift
+#                         args_changed=:
 #                         ;;
-#            *)            set dummy "$_G_opt" "$*"; shift; break ;;
+#            *)           # Make sure the first unrecognised option "$_G_opt"
+#                         # is added back to "$@" in case we need it later,
+#                         # if $args_changed was set to 'true'.
+#                         set dummy "$_G_opt" ${1+"$@"}; shift; break ;;
 #          esac
 #        done
 #
-#        func_quote_for_eval ${1+"$@"}
-#        my_silent_option_result=$func_quote_for_eval_result
+#        # Only call 'func_quote' here if we processed at least one argument.
+#        if $args_changed; then
+#          func_quote eval ${1+"$@"}
+#          my_silent_option_result=$func_quote_result
+#        fi
 #    }
 #    func_add_hook func_parse_options my_silent_option
 #
@@ -1416,17 +1925,26 @@ func_run_hooks ()
 #
 #        $opt_silent && $opt_verbose && func_fatal_help "\
 #    '--silent' and '--verbose' options are mutually exclusive."
-#
-#        func_quote_for_eval ${1+"$@"}
-#        my_option_validation_result=$func_quote_for_eval_result
 #    }
 #    func_add_hook func_validate_options my_option_validation
 #
-# You'll alse need to manually amend $usage_message to reflect the extra
+# You'll also need to manually amend $usage_message to reflect the extra
 # options you parse.  It's preferable to append if you can, so that
 # multiple option parsing hooks can be added safely.
 
 
+# func_options_finish [ARG]...
+# ----------------------------
+# Finishing the option parse loop (call 'func_options' hooks ATM).
+func_options_finish ()
+{
+    $debug_cmd
+
+    func_run_hooks func_options ${1+"$@"}
+    func_propagate_result func_run_hooks func_options_finish
+}
+
+
 # func_options [ARG]...
 # ---------------------
 # All the functions called inside func_options are hookable. See the
@@ -1436,17 +1954,27 @@ func_options ()
 {
     $debug_cmd
 
-    func_options_prep ${1+"$@"}
-    eval func_parse_options \
-        ${func_options_prep_result+"$func_options_prep_result"}
-    eval func_validate_options \
-        ${func_parse_options_result+"$func_parse_options_result"}
+    _G_options_quoted=false
 
-    eval func_run_hooks func_options \
-        ${func_validate_options_result+"$func_validate_options_result"}
+    for my_func in options_prep parse_options validate_options options_finish
+    do
+      func_unset func_${my_func}_result
+      func_unset func_run_hooks_result
+      eval func_$my_func '${1+"$@"}'
+      func_propagate_result func_$my_func func_options
+      if $func_propagate_result_result; then
+        eval set dummy "$func_options_result"; shift
+        _G_options_quoted=:
+      fi
+    done
 
-    # save modified positional parameters for caller
-    func_options_result=$func_run_hooks_result
+    $_G_options_quoted || {
+      # As we (func_options) are top-level options-parser function and
+      # nobody quoted "$@" for us yet, we need to do it explicitly for
+      # caller.
+      func_quote eval ${1+"$@"}
+      func_options_result=$func_quote_result
+    }
 }
 
 
@@ -1455,9 +1983,8 @@ func_options ()
 # All initialisations required before starting the option parse loop.
 # Note that when calling hook functions, we pass through the list of
 # positional parameters.  If a hook function modifies that list, and
-# needs to propogate that back to rest of this script, then the complete
-# modified list must be put in 'func_run_hooks_result' before
-# returning.
+# needs to propagate that back to rest of this script, then the complete
+# modified list must be put in 'func_run_hooks_result' before returning.
 func_hookable func_options_prep
 func_options_prep ()
 {
@@ -1468,9 +1995,7 @@ func_options_prep ()
     opt_warning_types=
 
     func_run_hooks func_options_prep ${1+"$@"}
-
-    # save modified positional parameters for caller
-    func_options_prep_result=$func_run_hooks_result
+    func_propagate_result func_run_hooks func_options_prep
 }
 
 
@@ -1482,25 +2007,32 @@ func_parse_options ()
 {
     $debug_cmd
 
-    func_parse_options_result=
-
+    _G_parse_options_requote=false
     # this just eases exit handling
     while test $# -gt 0; do
       # Defer to hook functions for initial option parsing, so they
       # get priority in the event of reusing an option name.
       func_run_hooks func_parse_options ${1+"$@"}
-
-      # Adjust func_parse_options positional parameters to match
-      eval set dummy "$func_run_hooks_result"; shift
+      func_propagate_result func_run_hooks func_parse_options
+      if $func_propagate_result_result; then
+        eval set dummy "$func_parse_options_result"; shift
+        # Even though we may have changed "$@", we passed the "$@" array
+        # down into the hook and it quoted it for us (because we are in
+        # this if-branch).  No need to quote it again.
+        _G_parse_options_requote=false
+      fi
 
       # Break out of the loop if we already parsed every option.
       test $# -gt 0 || break
 
+      # We expect that one of the options parsed in this function matches
+      # and thus we remove _G_opt from "$@" and need to re-quote.
+      _G_match_parse_options=:
       _G_opt=$1
       shift
       case $_G_opt in
         --debug|-x)   debug_cmd='set -x'
-                      func_echo "enabling shell trace mode"
+                      func_echo "enabling shell trace mode" >&2
                       $debug_cmd
                       ;;
 
@@ -1510,7 +2042,10 @@ func_parse_options ()
                      ;;
 
         --warnings|--warning|-W)
-                      test $# = 0 && func_missing_arg $_G_opt && break
+                      if test $# = 0 && func_missing_arg $_G_opt; then
+                        _G_parse_options_requote=:
+                        break
+                      fi
                       case " $warning_categories $1" in
                         *" $1 "*)
                           # trailing space prevents matching last $1 above
@@ -1563,15 +2098,24 @@ func_parse_options ()
                       shift
                       ;;
 
-        --)           break ;;
+        --)           _G_parse_options_requote=: ; break ;;
         -*)           func_fatal_help "unrecognised option: '$_G_opt'" ;;
-        *)            set dummy "$_G_opt" ${1+"$@"}; shift; break ;;
+        *)            set dummy "$_G_opt" ${1+"$@"}; shift
+                      _G_match_parse_options=false
+                      break
+                      ;;
       esac
+
+      if $_G_match_parse_options; then
+        _G_parse_options_requote=:
+      fi
     done
 
-    # save modified positional parameters for caller
-    func_quote_for_eval ${1+"$@"}
-    func_parse_options_result=$func_quote_for_eval_result
+    if $_G_parse_options_requote; then
+      # save modified positional parameters for caller
+      func_quote eval ${1+"$@"}
+      func_parse_options_result=$func_quote_result
+    fi
 }
 
 
@@ -1588,19 +2132,17 @@ func_validate_options ()
     test -n "$opt_warning_types" || opt_warning_types=" $warning_categories"
 
     func_run_hooks func_validate_options ${1+"$@"}
+    func_propagate_result func_run_hooks func_validate_options
 
     # Bail if the options were screwed!
     $exit_cmd $EXIT_FAILURE
-
-    # save modified positional parameters for caller
-    func_validate_options_result=$func_run_hooks_result
 }
 
 
 
-## ------------------##
+## ----------------- ##
 ## Helper functions. ##
-## ------------------##
+## ----------------- ##
 
 # This section contains the helper functions used by the rest of the
 # hookable option parser framework in ascii-betical order.
@@ -1614,8 +2156,8 @@ func_fatal_help ()
 {
     $debug_cmd
 
-    eval \$bs_echo \""Usage: $usage"\"
-    eval \$bs_echo \""$fatal_help"\"
+    eval \$ECHO \""Usage: $usage"\"
+    eval \$ECHO \""$fatal_help"\"
     func_error ${1+"$@"}
     exit $EXIT_FAILURE
 }
@@ -1629,7 +2171,7 @@ func_help ()
     $debug_cmd
 
     func_usage_message
-    $bs_echo "$long_help_message"
+    $ECHO "$long_help_message"
     exit 0
 }
 
@@ -1649,8 +2191,8 @@ func_missing_arg ()
 
 # func_split_equals STRING
 # ------------------------
-# Set func_split_equals_lhs and func_split_equals_rhs shell variables after
-# splitting STRING at the '=' sign.
+# Set func_split_equals_lhs and func_split_equals_rhs shell variables
+# after splitting STRING at the '=' sign.
 test -z "$_G_HAVE_XSI_OPS" \
     && (eval 'x=a/b/c;
       test 5aa/bb/cc = "${#x}${x%%/*}${x%/*}${x#*/}${x##*/}"') 2>/dev/null \
@@ -1665,8 +2207,9 @@ then
 
       func_split_equals_lhs=${1%%=*}
       func_split_equals_rhs=${1#*=}
-      test "x$func_split_equals_lhs" = "x$1" \
-        && func_split_equals_rhs=
+      if test "x$func_split_equals_lhs" = "x$1"; then
+        func_split_equals_rhs=
+      fi
   }'
 else
   # ...otherwise fall back to using expr, which is often a shell builtin.
@@ -1716,7 +2259,7 @@ func_usage ()
     $debug_cmd
 
     func_usage_message
-    $bs_echo "Run '$progname --help |${PAGER-more}' for full usage"
+    $ECHO "Run '$progname --help |${PAGER-more}' for full usage"
     exit 0
 }
 
@@ -1728,7 +2271,7 @@ func_usage_message ()
 {
     $debug_cmd
 
-    eval \$bs_echo \""Usage: $usage"\"
+    eval \$ECHO \""Usage: $usage"\"
     echo
     $SED -n 's|^# ||
         /^Written by/{
@@ -1737,38 +2280,51 @@ func_usage_message ()
        h
        /^Written by/q' < "$progpath"
     echo
-    eval \$bs_echo \""$usage_message"\"
+    eval \$ECHO \""$usage_message"\"
 }
 
 
 # func_version
 # ------------
 # Echo version message to standard output and exit.
+# The version message is extracted from the calling file's header
+# comments, with leading '# ' stripped:
+#   1. First display the progname and version
+#   2. Followed by the header comment line matching  /^# Written by /
+#   3. Then a blank line followed by the first following line matching
+#      /^# Copyright /
+#   4. Immediately followed by any lines between the previous matches,
+#      except lines preceding the intervening completely blank line.
+# For example, see the header comments of this file.
 func_version ()
 {
     $debug_cmd
 
     printf '%s\n' "$progname $scriptversion"
-    $SED -n '/^##/q
-        /(C)/!b go
-        :more
-        /\./!{
-          N
-          s|\n# | |
-          b more
+    $SED -n '
+        /^# Written by /!b
+        s|^# ||; p; n
+
+        :fwd2blnk
+        /./ {
+          n
+          b fwd2blnk
         }
-        :go
-        /^# Written by /,/# warranty; / {
-          s|^# ||
-          s|^# *$||
-          s|\((C)\)[ 0-9,-]*[ ,-]\([1-9][0-9]* \)|\1 \2|
-          p
-        }
-        /^# Written by / {
-          s|^# ||
-          p
+        p; n
+
+        :holdwrnt
+        s|^# ||
+        s|^# *$||
+        /^Copyright /!{
+          /./H
+          n
+          b holdwrnt
         }
-        /^warranty; /q' < "$progpath"
+
+        s|\((C)\)[ 0-9,-]*[ ,-]\([1-9][0-9]* \)|\1 \2|
+        G
+        s|\(\n\)\n*|\1|g
+        p; q' < "$progpath"
 
     exit $?
 }
@@ -1777,8 +2333,8 @@ func_version ()
 # Local variables:
 # mode: shell-script
 # sh-indentation: 2
-# eval: (add-hook 'write-file-hooks 'time-stamp)
-# time-stamp-pattern: "10/scriptversion=%:y-%02m-%02d.%02H; # UTC"
+# eval: (add-hook 'before-save-hook 'time-stamp)
+# time-stamp-pattern: "30/scriptversion=%:y-%02m-%02d.%02H; # UTC"
 # time-stamp-time-zone: "UTC"
 # End:
 #! /bin/sh
@@ -1786,31 +2342,27 @@ func_version ()
 # Extract macro arguments from autotools input with GNU M4.
 # Written by Gary V. Vaughan, 2010
 #
-# Copyright (C) 2010-2013 Free Software Foundation, Inc.
-# This is free software; see the source for copying conditions.  There is NO
-# warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+# This is free software.  There is NO warranty; not even for
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+#
+# Copyright (C) 2010-2019 Bootstrap Authors
+#
+# This file is dual licensed under the terms of the MIT license
+# <https://opensource.org/license/MIT>, and GPL version 2 or later
+# <http://www.gnu.org/licenses/gpl-2.0.html>.  You must apply one of
+# these licenses when using or redistributing this software or any of
+# the files within it.  See the URLs above, or the file `LICENSE`
+# included in the Bootstrap distribution for the full license texts.
+
+# Please report bugs or propose patches to:
+# <https://github.com/gnulib-modules/bootstrap/issues>
 
 # Make sure we've evaluated scripts we depend on.
 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=2013-08-22.10; # 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
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-
-# You should have received a copy of the GNU General Public License
-# along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-# Please report bugs or propose patches to gary@gnu.org.
+scriptversion=2019-02-19.15; # UTC
 
 
 ## ------ ##
@@ -1827,9 +2379,9 @@ scriptversion=2013-08-22.10; # UTC
 
 
 
-## ------------------##
+## ----------------- ##
 ## Helper functions. ##
-## ------------------##
+## ----------------- ##
 
 # This section contains the helper functions used by the rest of
 # 'extract-trace'.
@@ -1851,7 +2403,7 @@ func_autoconf_configure ()
 
     # If we were passed a genuine file, make sure it calls AC_INIT.
     test -f "$1" \
-      && _G_ac_init=`$SED "$_G_sed_no_comment" "$1" |grep AC_INIT`
+      && _G_ac_init=`$SED "$_G_sed_no_comment" "$1" |$GREP AC_INIT`
 
     # Otherwise it is not a genuine Autoconf input file.
     test -n "$_G_ac_init"
@@ -1864,6 +2416,69 @@ 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 "$@"`
+    _G_status=$?
+
+    # A version number starts with a digit following a space on the first
+    # line of output from `--version`.
+    _G_verout=`echo "$_G_verout" |sed 1q`
+    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,
@@ -1881,16 +2496,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=${PATH_SEPARATOR-:}
+       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
@@ -1905,39 +2548,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. ##
@@ -2025,8 +2635,8 @@ func_extract_trace ()
     $require_configure_ac
     $require_gnu_m4
 
-    _G_m4_traces=`$bs_echo "--trace=$1" |$SED 's%,% --trace=%g'`
-    _G_re_macros=`$bs_echo "($1)" |$SED 's%,%|%g'`
+    _G_m4_traces=`$ECHO "--trace=$1" |$SED 's%,% --trace=%g'`
+    _G_re_macros=`$ECHO "($1)" |$SED 's%,%|%g'`
     _G_macros="$1"; shift
     test $# -gt 0 || {
       set dummy $configure_ac
@@ -2054,29 +2664,41 @@ func_extract_trace ()
     # arguments to Autocof functions, but without following
     # 'm4_s?include' files.
     _G_mini='
-        # Initialisation.
+        dnl  Initialisation.
         m4_changequote([,])
         m4_define([m4_copy],   [m4_define([$2], m4_defn([$1]))])
         m4_define([m4_rename], [m4_copy([$1], [$2])m4_undefine([$1])])
 
-        # Disable these macros.
-        m4_undefine([m4_dnl])
-        m4_undefine([m4_include])
-        m4_undefine([m4_m4exit])
-        m4_undefine([m4_m4wrap])
-        m4_undefine([m4_maketemp])
+        dnl  Replace macros which may abort m4 with a no-op variant.
+        m4_pushdef([m4_assert])
+        m4_pushdef([m4_exit])
+        m4_pushdef([m4_fatal])
+        m4_pushdef([m4_m4exit])
+
+        dnl  Replace macros that might break stderr of m4.
+        m4_pushdef([m4_errprint])
+        m4_pushdef([m4_errprintn])
+        m4_pushdef([m4_include])
+        m4_pushdef([m4_warn])
+
+        dnl  Avoid side-effects of tracing by extract-trace.
+        m4_pushdef([m4_maketemp])
+        m4_pushdef([m4_mkstemp])
+
+        dnl  TODO: reasons for this
+        m4_pushdef([m4_dnl])
+        m4_pushdef([m4_m4wrap])
 
-        # Copy and rename macros not handled by "m4 --prefix".
+        dnl  Copy and rename macros not handled by "m4 --prefix".
         m4_define([dnl],         [m4_builtin([dnl])])
         m4_copy([m4_define],     [m4_defun])
         m4_rename([m4_ifelse],   [m4_if])
-        m4_ifdef([m4_mkstemp],   [m4_undefine([m4_mkstemp])])
         m4_rename([m4_patsubst], [m4_bpatsubst])
         m4_rename([m4_regexp],   [m4_bregexp])
 
-        # "m4sugar.mini" - useful m4-time macros for dynamic arguments.
-        # If we discover packages that need more m4 macros defined in
-        # order to bootstrap correctly, add them here:
+        dnl  "m4sugar.mini" - useful m4-time macros for dynamic arguments.
+        dnl  If we discover packages that need more m4 macros defined in
+        dnl  order to bootstrap correctly, add them here:
         m4_define([m4_bmatch],
             [m4_if([$#], 0, [], [$#], 1, [], [$#], 2, [$2],
                    [m4_if(m4_bregexp([$1], [$2]), -1,
@@ -2087,11 +2709,11 @@ func_extract_trace ()
         m4_define([m4_require], [$1])
         m4_define([m4_shift3], [m4_shift(m4shift(m4shift($@)))])
 
-        # "autoconf.mini" - things from autoconf macros we care about.
+        dnl  "autoconf.mini" - things from autoconf macros we care about.
         m4_copy([m4_defun], [AC_DEFUN])
 
-        # Dummy definitions for the macros we want to trace.
-        # AM_INIT_AUTOMAKE at least produces no trace without this.
+        dnl  Dummy definitions for the macros we want to trace.
+        dnl  AM_INIT_AUTOMAKE at least produces no trace without this.
     '
 
     _G_save=$IFS
@@ -2128,7 +2750,7 @@ func_extract_trace ()
 
     # Save the command pipeline results for further use by callers of
     # this function.
-    func_extract_trace_result=`$bs_echo "$_G_mini" \
+    func_extract_trace_result=`$ECHO "$_G_mini" \
       |$M4 -daq --prefix $_G_m4_traces - "$@" 2>&1 1>/dev/null \
       |$SED -n -e "$_G_transform"`
 }
@@ -2144,284 +2766,66 @@ func_extract_trace_first ()
     $debug_cmd
 
     func_extract_trace ${1+"$@"}
-    func_extract_trace_first_result=`$bs_echo "$func_extract_trace_result" \
+    func_extract_trace_first_result=`$ECHO "$func_extract_trace_result" \
       |$SED -e 's|:.*$||g' -e 1q`
-}
-
-
-# func_main [ARG]...
-# ------------------
-func_main ()
-{
-    $debug_cmd
-
-    # Configuration.
-    usage='$progname MACRO_NAME FILE [...]'
-
-    long_help_message='
-The first argument to this program is the name of an autotools macro
-whose arguments you want to extract by examining the files listed in the
-remaining arguments using the same tool that Autoconf and Automake use,
-GNU M4.
-
-The arguments are returned separated by colons, with each traced call
-on a separate line.'
-
-    # Option processing.
-    func_options "$@"
-    eval set dummy "$func_options_result"; shift
-
-    # Validate remaining non-option arguments.
-    test $# -gt 1 \
-        || func_fatal_help "not enough arguments"
-
-    # Pass non-option arguments to extraction function.
-    func_extract_trace "$@"
-
-    # Display results.
-    test -n "$func_extract_trace_result" \
-        && $bs_echo "$func_extract_trace_result"
-
-    # The End.
-    exit $EXIT_SUCCESS
-}
-
-
-## --------------------------- ##
-## Actually perform the trace. ##
-## --------------------------- ##
-
-# Only call 'func_main' if this script was called directly.
-test extract-trace = "$progname" && func_main "$@"
-
-# Local variables:
-# mode: shell-script
-# sh-indentation: 2
-# eval: (add-hook 'write-file-hooks 'time-stamp)
-# time-stamp-pattern: "10/scriptversion=%:y-%02m-%02d.%02H; # UTC"
-# time-stamp-time-zone: "UTC"
-# End:
-
-# Set a version string for *this* script.
-scriptversion=2013-09-15.06; # 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
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-
-# You should have received a copy of the GNU General Public License
-# along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-# Originally written by Paul Eggert.  The canonical version of this
-# script is maintained as build-aux/bootstrap in gnulib, however, to
-# be useful to your project, you should place a copy of it under
-# version control in the top-level directory of your project.  The
-# intent is that all customization can be done with a bootstrap.conf
-# file also maintained in your version control; gnulib comes with a
-# template build-aux/bootstrap.conf to get you started.
-
-# Please report bugs or propose patches to bug-gnulib@gnu.org.
-
-
-## ------ ##
-## Usage. ##
-## ------ ##
-
-# Most GNUish projects do not keep all of the generated Autotool
-# files under version control, but running all of the right tools
-# with the right arguments, in the correct order to regenerate
-# all of those files in readiness for configuration and building
-# can be surprisingly involved!  Many projects have a 'bootstrap'
-# script under version control to invoke Autotools and perform
-# other assorted book-keeping with version numbers and the like.
-#
-# This bootstrap script aims to probe the configure.ac and top
-# Makefile.am of your project to automatically determine what
-# the correct ordering and arguments are and then run the tools for
-# you.  In order to use it, you can generate an initial standalone
-# script with:
-#
-#   gl/build-aux/inline-source gl/build-aux/bootstrap.in > bootstrap
-#
-# You should then store than script in version control for other
-# developers in you project.  It will give you instructions about
-# how to keep it up to date if the sources change.
-#
-# See gl/doc/bootstrap.texi for documentation on how to write
-# a bootstrap.conf to customize it for your project's
-# idiosyncracies.
-
-
-## ================================================================== ##
-##                                                                    ##
-##     DO NOT EDIT THIS FILE, CUSTOMIZE IT USING A BOOTSTRAP.CONF     ##
-##                                                                    ##
-## ================================================================== ##
-
-## ------------------------------- ##
-## User overridable command paths. ##
-## ------------------------------- ##
-
-# All uppercase denotes values stored in the environment.  These
-# variables should generally be overridden by the user - however, we do
-# set them to 'true' in some parts of this script to prevent them being
-# called at the wrong time by other tools that we call ('autoreconf',
-# for example).
-#
-# We also allow 'LIBTOOLIZE', 'M4', 'SHA1SUM' and some others to be
-# overridden, and export the result for child processes, but they are
-# handled by the function 'func_find_tool' and not defaulted in this
-# section.
-
-: ${ACLOCAL="aclocal"}
-: ${AUTOCONF="autoconf"}
-: ${AUTOHEADER="autoheader"}
-: ${AUTOM4TE="autom4te"}
-: ${AUTOHEADER="autoheader"}
-: ${AUTOMAKE="automake"}
-: ${AUTOPOINT="autopoint"}
-: ${AUTORECONF="autoreconf"}
-: ${CMP="cmp"}
-: ${CONFIG_SHELL="/bin/sh"}
-: ${DIFF="diff"}
-: ${EGREP="grep -E"}
-: ${FGREP="grep -F"}
-: ${GIT="git"}
-: ${GREP="grep"}
-: ${LN_S="ln -s"}
-: ${RM="rm"}
-: ${SED="sed"}
-
-export ACLOCAL
-export AUTOCONF
-export AUTOHEADER
-export AUTOM4TE
-export AUTOHEADER
-export AUTOMAKE
-export AUTOPOINT
-export AUTORECONF
-export CONFIG_SHELL
-
-
-## -------------- ##
-## Configuration. ##
-## -------------- ##
-
-# A newline delimited list of triples of programs (that respond to
-# --version), the minimum version numbers required (or just '-' in the
-# version field if any version will be sufficient) and homepage URLs
-# to help locate missing packages.
-buildreq=
-
-# Name of a file containing instructions on installing missing packages
-# required in 'buildreq'.
-buildreq_readme=README-hacking
-
-# These are extracted from AC_INIT in configure.ac, though you can
-# override those values in 'bootstrap.conf' if you prefer.
-build_aux=
-macro_dir=
-package=
-package_name=
-package_version=
-package_bugreport=
+}
 
-# These are extracted from 'gnulib-cache.m4', or else fall-back
-# automatically on the gnulib defaults; unless you set the values
-# manually in 'bootstrap.conf'.
-doc_base=
-gnulib_mk=
-gnulib_name=
-local_gl_dir=
-source_base=
-tests_base=
 
-# The list of gnulib modules required at 'gnulib-tool' time.  If you
-# check 'gnulib-cache.m4' into your repository, then this list will be
-# extracted automatically.
-gnulib_modules=
+# func_main [ARG]...
+# ------------------
+func_main ()
+{
+    $debug_cmd
 
-# Extra gnulib files that are not in modules, which override files of
-# the same name installed by other bootstrap tools.
-gnulib_non_module_files="
-        build-aux/compile
-        build-aux/install-sh
-        build-aux/mdate-sh
-        build-aux/texinfo.tex
-        build-aux/depcomp
-        build-aux/config.guess
-        build-aux/config.sub
-        doc/INSTALL
-"
+    # Configuration.
+    usage='$progname MACRO_NAME FILE [...]'
 
-# Relative path to the local gnulib submodule, and url to the upstream
-# git repository. If you have a gnulib entry in your .gitmodules file,
-# these values are ignored.
-gnulib_path=
-gnulib_url=
+    long_help_message='
+The first argument to this program is the name of an autotools macro
+whose arguments you want to extract by examining the files listed in the
+remaining arguments using the same tool that Autoconf and Automake use,
+GNU M4.
 
-# Additional gnulib-tool options to use.
-gnulib_tool_options="
-        --no-changelog
-"
+The arguments are returned separated by colons, with each traced call
+on a separate line.'
 
-# bootstrap removes any macro-files that are not included by aclocal.m4,
-# except for files listed in this variable that are always kept.
-gnulib_precious="
-        gnulib-tool.m4
-"
+    # Option processing.
+    func_options "$@"
+    eval set dummy "$func_options_result"; shift
 
-# When truncating long commands for display, always allow at least this
-# many characters before truncating.
-min_cmd_len=160
+    # Validate remaining non-option arguments.
+    test $# -gt 1 \
+        || func_fatal_help "not enough arguments"
 
-# The command to download all .po files for a specified domain into
-# a specified directory.  Fill in the first %s is the domain name, and
-# the second with the destination directory.  Use rsync's -L and -r
-# options because the latest/%s directory and the .po files within are
-# all symlinks.
-po_download_command_format=\
-"rsync --delete --exclude '*.s1' -Lrtvz \
-'translationproject.org::tp/latest/%s/' '%s'"
+    # Pass non-option arguments to extraction function.
+    func_extract_trace "$@"
 
-# Other locale categories that need message catalogs.
-extra_locale_categories=
+    # Display results.
+    test -n "$func_extract_trace_result" \
+        && $ECHO "$func_extract_trace_result"
 
-# Additional xgettext options to use.  Gnulib might provide you with an
-# extensive list of additional options to append to this, but gettext
-# 0.16.1 and newer appends them automaticaly, so you can safely ignore
-# the complaints from 'gnulib-tool' if your $configure_ac states:
-#
-#    AM_GNU_GETTEXT_VERSION([0.16.1])
-xgettext_options="
-        --flag=_:1:pass-c-format
-        --flag=N_:1:pass-c-format
-"
+    # The End.
+    exit $EXIT_SUCCESS
+}
 
-# Package copyright holder for gettext files.  Defaults to FSF if unset.
-copyright_holder=
 
-# File that should exist in the top directory of a checked out hierarchy,
-# but not in a distribution tarball.
-checkout_only_file=
+## --------------------------- ##
+## Actually perform the trace. ##
+## --------------------------- ##
 
-# Whether to use copies instead of symlinks by default (if set to true,
-# the --copy option has no effect).
-copy=false
+# Only call 'func_main' if this script was called directly.
+test extract-trace = "$progname" && func_main "$@"
 
-# Set this to ".cvsignore .gitignore" in 'bootstrap.conf' if you want
-# those files to be generated in directories like 'lib/', 'm4/', and 'po/',
-# or set it to "auto" to make this script select what to use based
-# on what version control system (if any) is used in the source directory.
-# Or set it to "none" to ignore VCS ignore files entirely.  Default is
-# "auto".
-vc_ignore=
+# Local variables:
+# mode: shell-script
+# sh-indentation: 2
+# eval: (add-hook 'before-save-hook 'time-stamp)
+# time-stamp-pattern: "50/scriptversion=%:y-%02m-%02d.%02H; # UTC"
+# time-stamp-time-zone: "UTC"
+# End:
+
+# Set a version string for *this* script.
+scriptversion=2019-03-22.11; # UTC
 
 
 ## ------------------- ##
@@ -2449,8 +2853,8 @@ func_bootstrap ()
 
     # Save the current positional parameters to prevent them being
     # corrupted by calls to 'set' in 'func_init'.
-    func_quote_for_eval ${1+"$@"}
-    _G_saved_positional_parameters=$func_quote_for_eval_result
+    func_quote eval ${1+"$@"}
+    _G_saved_positional_parameters=$func_quote_result
 
     # Initialisation.
     func_init
@@ -2461,10 +2865,6 @@ func_bootstrap ()
     # Post-option preparation.
     func_prep
 
-    # Ensure ChangeLog presence.
-    func_ifcontains "$gnulib_modules" gitlog-to-changelog \
-      func_ensure_changelog
-
     # Reconfigure the package.
     func_reconfigure
 
@@ -2509,6 +2909,10 @@ func_prep ()
 
     $require_gnulib_merge_changelog
 
+    # Report the results of SED and GREP searches from funclib.sh.
+    func_verbose "GREP='$GREP'"
+    func_verbose "SED='$SED'"
+
     # fetch update files from the translation project
     func_update_translations
 
@@ -2545,8 +2949,32 @@ func_reconfigure ()
 {
     $debug_cmd
 
+    $require_automake_options
+
+    # Automake (without 'foreign' option) requires that NEWS & README exist.
+    case " $automake_options " in
+      " foreign ") ;;
+      *)
+        func_ensure_NEWS
+        func_ensure_README
+        ;;
+    esac
+
+    # Ensure ChangeLog presence.
+    if test -n "$gnulib_modules"; then
+      func_ifcontains "$gnulib_modules" gitlog-to-changelog \
+        func_ensure_changelog
+    else
+      $require_gnulib_cache
+      if $SED -n '/^gl_MODULES(\[/,/^])$/p' $gnulib_cache 2>/dev/null |
+         func_grep_q gitlog-to-changelog
+      then
+        func_ensure_changelog
+      fi
+    fi
+
     # Released 'autopoint' has the tendency to install macros that have
-    # been obsoleted in current 'gnulib., so run this before 'gnulib-tool'.
+    # been obsoleted in current 'gnulib', so run this before 'gnulib-tool'.
     func_autopoint
 
     # Autoreconf runs 'aclocal' before 'libtoolize', which causes spurious
@@ -2586,6 +3014,8 @@ func_gnulib_tool ()
     $require_libtoolize
 
     test true = "$gnulib_tool" || {
+      $require_gnulib_git_submodules
+
       # bootstrap.conf written for gnulib bootstrap expects
       # gnulib_tool_option_extras to which --no-changelog is appended,
       # but libtool bootstrap expects you to append to gnulib_tool_options
@@ -2707,6 +3137,7 @@ func_gettext_configuration ()
              '"$_G_xgettext_options"' \\\
              $${end_of_xgettext_options+}
         }
+        s/ *$//
       ' po/Makevars.template >po/Makevars || exit 1
     }
 
@@ -2761,7 +3192,7 @@ func_libtoolize ()
 # -----------------------------------
 # Copy SRC, a path relative to the gnulib sub-tree, to DEST, a path
 # relative to the top-level source directory using gnulib-tool so that
-# any patches or replacements in $local_gl_dir are applied.
+# any patches or replacements in $local_gl_path are applied.
 func_gnulib_tool_copy_file ()
 {
     $debug_cmd
@@ -2858,12 +3289,67 @@ EOT
 }
 
 
-# func_autoreconf
-# ---------------
+# func_ensure_NEWS
+# ----------------
+# Without AM_INIT_AUTOMAKE([foreign]), automake will not run to
+# completion with no NEWS file, even though NEWS.md or NEWS.txt
+# is often preferable.
+func_ensure_NEWS ()
+{
+    $debug_cmd
+
+    test -f NEWS || {
+      _G_NEWS=
+      for _G_news in NEWS.txt NEWS.md NEWS.rst; do
+        test -f "$_G_news" && break
+      done
+
+      test -f "$_G_news" && $LN_S $_G_news NEWS
+      func_verbose "$LN_S $_G_news NEWS"
+    }
+
+    return 0
+}
+
+
+# func_ensure_README
+# ------------------
+# Without AM_INIT_AUTOMAKE([foreign]), automake will not run to
+# completion with no README file, even though README.md or README.txt
+# is often preferable.
+func_ensure_README ()
+{
+    $debug_cmd
+
+    test -f README || {
+      _G_README=
+      for _G_readme in README.txt README.md README.rst; do
+        test -f "$_G_readme" && break
+      done
+
+      test -f "$_G_readme" && $LN_S $_G_readme README
+      func_verbose "$LN_S $_G_readme README"
+    }
+
+    return 0
+}
+
+
+# func_autoreconf [SUBDIR]
+# ------------------------
 # Being careful not to re-run 'autopoint' or 'libtoolize', and not to
 # try to run 'autopoint', 'libtoolize' or 'autoheader' on packages that
 # don't use them, defer to 'autoreconf' for execution of the remaining
 # autotools to bootstrap this package.
+#
+# Projects with multiple trees to reconfigure can hook another call to
+# this function onto func_reconfigure:
+#
+#    my_autoreconf_foo ()
+#    {
+#        func_autoreconf foo
+#    }
+#    func_add_hook func_reconfigure my_autoreconf_foo
 func_autoreconf ()
 {
     $debug_cmd
@@ -2880,7 +3366,7 @@ func_autoreconf ()
     $opt_copy || func_append _G_autoreconf_options " --symlink"
     $opt_force && func_append _G_autoreconf_options " --force"
     $opt_verbose && func_append _G_autoreconf_options " --verbose"
-    func_show_eval "$AUTORECONF$_G_autoreconf_options --install" 'exit $?'
+    func_show_eval "$AUTORECONF$_G_autoreconf_options --install${1+ $1}" 'exit $?'
 
     AUTOPOINT=$save_AUTOPOINT
     LIBTOOLIZE=$save_LIBTOOLIZE
@@ -2955,7 +3441,7 @@ func_clean_unused_macros ()
 
       # We use 'ls|grep' instead of 'ls *.m4' to avoid exceeding
       # command line length limits in some shells.
-      for file in `cd "$macro_dir" && ls -1 |grep '\.m4$'`; do
+      for file in `cd "$macro_dir" && ls -1 |$GREP '\.m4$'`; do
 
        # Remove a macro file when aclocal.m4 does not m4_include it...
         func_grep_q 'm4_include([[]'$macro_dir/$file'])' $aclocal_m4s \
@@ -3031,6 +3517,26 @@ func_update_dotversion ()
 # most, once.
 
 
+# require_gnulib_git_submodules
+# -----------------------------
+# Initialize all git modules from $gnulib_git_submodules before we
+# run 'gnulib-tool'.
+require_gnulib_git_submodules=func_require_gnulib_git_submodules
+func_require_gnulib_git_submodules ()
+{
+    test -n "$gnulib_git_submodules" && {
+      for _G_submodule in $gnulib_git_submodules
+      do
+        func_show_eval "git submodule init -- $_G_submodule" \
+            && func_show_eval "git submodule update -- $_G_submodule" \
+            || func_fatal_error "Unable to init git module '$_G_submodule'."
+      done
+    }
+
+    require_gnulib_git_submodules=:
+}
+
+
 # require_checkout_only_file
 # --------------------------
 # Bail out  if this package only bootstraps properly from a repository
@@ -3105,6 +3611,21 @@ func_require_autoheader ()
 }
 
 
+# require_automake_options
+# ------------------------
+# Extract options from AM_AUTOMAKE_INIT.
+require_automake_options=func_require_automake_options
+func_require_automake_options ()
+{
+    $debug_cmd
+
+    func_extract_trace AM_INIT_AUTOMAKE
+    automake_options=$func_extract_trace_result
+
+    require_automake_options=:
+}
+
+
 # require_autopoint
 # -----------------
 # Skip autopoint if it's not needed.
@@ -3159,17 +3680,19 @@ Please add bootstrap to your gnulib_modules list in
 'bootstrap.conf', so that I can tell you when there are
 updates available."
     else
+      rm -f bootstrap.new
       $build_aux/inline-source $build_aux/bootstrap.in > bootstrap.new
 
       if func_cmp_s "$progpath" bootstrap.new; then
         rm -f bootstrap.new
        func_verbose "bootstrap script up to date"
       else
+        chmod 555 bootstrap.new
         func_warning upgrade "\
 An updated bootstrap script has been generated for you in
 'bootstrap.new'.  After you've verified that you want
 the changes, you can update with:
-    cat bootstrap.new > $progname
+    mv -f bootstrap.new $progname
     ./$progname
 
 Or you can disable this check permanently by adding the
@@ -3273,7 +3796,7 @@ for tool in autoconf libtoolize autopoint; do
             '$tool' $_G_version http://www.gnu.org/s/'$b'
 "
         func_verbose \
-            "auto-adding '\'$tool'-'$_G_version\'' to build requirements"
+            "auto-adding '\'$tool'-$_G_version'\'' to build requirements"
       }
     }
 
@@ -3298,7 +3821,7 @@ func_require_buildreq_automake ()
 
       # ...and AM_INIT_AUTOMAKE is declared...
       test -n "$func_extract_trace_result" && {
-        automake_version=`$bs_echo "$func_extract_trace_result" \
+        automake_version=`$ECHO "$func_extract_trace_result" \
            |$SED -e 's|[^0-9]*||' -e 's| .*$||'`
         test -n "$automake_version" || automake_version=-
 
@@ -3317,13 +3840,13 @@ func_require_buildreq_automake ()
 # require_buildreq_patch
 # ----------------------
 # Automatically add a patch build-requirement if there are diff files
-# in $local_gl_dir.
+# in $local_gl_path.
 require_buildreq_patch=func_require_buildreq_patch
 func_require_buildreq_patch ()
 {
     $debug_cmd
 
-    $require_local_gl_dir
+    $require_local_gl_path
 
     # This ensures PATCH is set appropriately by the time
     # func_check_versions enforces $buildreq.
@@ -3331,14 +3854,19 @@ func_require_buildreq_patch ()
 
     # If patch is not already listed in $buildreq...
     printf '%s\n' "$buildreq" |func_grep_q '^[  ]*patch' || {
-      # The ugly find invocation is necessary to exit with non-zero
-      # status for old find binaries that don't support -exec fully.
-      if test ! -d "$local_gl_dir" \
-          || find "$local_gl_dir" -name *.diff -exec false {} \; ; then :
-      else
-          func_append buildreq 'patch - http://www.gnu.org/s/patch
-'
-      fi
+      eval "set dummy $local_gl_path_quoted" ; shift
+
+      for _G_dir
+      do
+        # The ugly find invocation is necessary to exit with non-zero
+        # status for old find binaries that don't support -exec fully.
+        if test ! -d "$_G_dir" \
+            || find "$_G_dir" -name "*.diff" -exec false {} \; ; then :
+        else
+          func_append buildreq "patch - http://www.gnu.org/s/patch$nl"
+          break
+        fi
+      done
     }
 
     require_buildreq_patch=:
@@ -3486,8 +4014,8 @@ func_require_git ()
     $opt_skip_git && GIT=true
 
     test true = "$GIT" || {
-      if test -f .gitignore && ($GIT --version) >/dev/null 2>&1; then :; else
-      GIT=true
+      if test -d .git/.; then
+        ($GIT --version) >/dev/null 2>&1 || GIT=true
       fi
     }
 
@@ -3692,8 +4220,9 @@ func_require_gnulib_submodule ()
         trap func_cleanup_gnulib 1 2 13 15
 
         shallow=
-        $GIT clone -h 2>&1 |func_grep_q -- --depth \
-            && shallow='--depth 365'
+        test -n "$gnulib_clone_since" && \
+            $GIT clone -h 2>&1 |func_grep_q -- --shallow-since \
+            && shallow="--shallow-since=$gnulib_clone_since"
 
         func_show_eval "$GIT clone $shallow '$gnulib_url' '$gnulib_path'" \
           func_cleanup_gnulib
@@ -3704,8 +4233,8 @@ func_require_gnulib_submodule ()
       fi
 
       # Make sure we've checked out the correct revision of gnulib.
-      func_show_eval "$GIT submodule init" \
-          && func_show_eval "$GIT submodule update" \
+      func_show_eval "$GIT submodule init -- $gnulib_path" \
+          && func_show_eval "$GIT submodule update -- $gnulib_path" \
           ||  func_fatal_error "Unable to update gnulib submodule."
     fi
 
@@ -3772,9 +4301,14 @@ func_require_gnulib_tool_base_options ()
       $require_gnulib_name
       test -n "$gnulib_name" \
           && func_append_uniq gnulib_tool_base_options " --lib=$gnulib_name"
-      $require_local_gl_dir
-      test -n "$local_gl_dir" \
-          && func_append_uniq gnulib_tool_base_options " --local-dir=$local_gl_dir"
+      $require_local_gl_path
+      test -n "$local_gl_path" && {
+        eval "set dummy $local_gl_path_quoted" ; shift
+        for _G_dir
+        do
+          func_append_uniq gnulib_tool_base_options " --local-dir=$_G_dir"
+        done
+      }
       $require_source_base
       test -n "$source_base" \
           && func_append_uniq gnulib_tool_base_options " --source-base=$source_base"
@@ -3809,6 +4343,9 @@ func_require_libtoolize ()
       func_find_tool LIBTOOLIZE libtoolize glibtoolize
     }
 
+    test -n "$LIBTOOLIZE" || func_fatal_error "\
+Please install GNU Libtool, or 'export LIBTOOLIZE=/path/to/libtoolize'."
+
     func_verbose "export LIBTOOLIZE='$LIBTOOLIZE'"
 
     # Make sure the search result is visible to subshells
@@ -3818,25 +4355,49 @@ func_require_libtoolize ()
 }
 
 
-# require_local_gl_dir
-# --------------------
-# Ensure local_gl_dir has a sensible value, extracted from 'gnulib-cache.m4'
-# if possible, otherwise letting 'gnulib-tool' pick a default.
-require_local_gl_dir=func_require_local_gl_dir
-func_require_local_gl_dir ()
+# require_local_gl_path
+# ---------------------
+# Ensure local_gl_path has a sensible value, extracted from 'gnulib-cache.m4' if
+# possible, otherwise letting 'gnulib-tool' pick a default.
+require_local_gl_path=func_require_local_gl_path
+func_require_local_gl_path ()
 {
     $debug_cmd
 
     $require_gnulib_cache
 
-    test -f "$gnulib_cache" && test -z "$local_gl_dir" && {
+    # Compat with older bootstrap versions.
+    test -n "$local_gl_dir" && {
+      func_warning settings "\
+Please use 'local_gl_path' instead of 'local_gl_dir' in your
+'bootstrap.conf' file."
+      local_gl_path=$local_gl_dir
+      local_gl_dir=
+    }
+
+    test -f "$gnulib_cache" && test -z "$local_gl_path" && {
       func_extract_trace_first "gl_LOCAL_DIR" "$gnulib_cache"
-      local_gl_dir=$func_extract_trace_first_result
+      local_gl_path=$func_extract_trace_first_result
+      test -n "$local_gl_path" && func_verbose "local_gl_path='$local_gl_path'"
+    }
 
-      test -n "$local_gl_dir" && func_verbose "local_gl_dir='$local_gl_dir'"
+    test -z "$local_gl_path_quoted" && test -n "$local_gl_path" && {
+      save_IFS=$IFS
+      set dummy
+      # Don't use PATH_SEPARATOR here, gnulib must be fixed to store only ':' as
+      # path separator into gnulib-cache.m4 (consistency reasons among systems).
+      IFS=:
+      for _G_dir in $local_gl_path
+      do
+        set "$@" "$_G_dir"
+      done
+      shift
+      IFS=$save_IFS
+      func_quote eval "$@"
+      local_gl_path_quoted=$func_quote_result
     }
 
-    require_local_gl_dir=:
+    require_local_gl_path=:
 }
 
 
@@ -3899,7 +4460,6 @@ func_require_macro_dir ()
 # require_makefile_am
 # -------------------
 # Ensure there is a 'Makefile.am' in the current directory.
-# names an existing file.
 require_makefile_am=func_require_makefile_am
 func_require_makefile_am ()
 {
@@ -4047,6 +4607,9 @@ func_require_patch ()
       func_find_tool PATCH gpatch patch
     }
 
+    test -n "$PATCH" || func_fatal_error "\
+Please install GNU Patch, or 'export PATCH=/path/to/gnu/patch'."
+
     func_verbose "export PATCH='$PATCH'"
 
     # Make sure the search result is visible to subshells
@@ -4104,9 +4667,9 @@ func_require_vc_ignore_files ()
 }
 
 
-## ------------------##
+## ----------------- ##
 ## Helper functions. ##
-## ------------------##
+## ----------------- ##
 
 # This section contains the helper functions used by the rest of 'bootstrap'.
 
@@ -4133,21 +4696,6 @@ else
 fi
 
 
-# func_unset VAR
-# --------------
-# Portably unset VAR.
-# In some shells, an 'unset VAR' statement leaves a non-zero return
-# status if VAR is already unset, which might be problematic if the
-# statement is used at the end of a function (thus poisoning its return
-# value) or when 'set -e' is active (causing even a spurious abort of
-# the script in this case).
-func_unset ()
-{
-    { eval $1=; unset $1; }
-}
-unset=func_unset
-
-
 # func_cmp_s FILE1 FILE2
 # ----------------------
 # Return non-zero exit status unless FILE1 and FILE2 are identical, without
@@ -4179,27 +4727,30 @@ func_grep_q ()
 # func_ifcontains LIST MEMBER YES-CMD [NO-CMD]
 # --------------------------------------------
 # If whitespace-separated LIST contains MEMBER then execute YES-CMD,
-# otherwise if NO-CMD was give, execute that.
+# otherwise if NO-CMD was given, execute that.
 func_ifcontains ()
 {
     $debug_cmd
 
-    # The embedded echo is to squash whitespace before globbing.
-    _G_wslist=`$bs_echo " "$1" "`
+    _G_wslist=$1
     _G_member=$2
     _G_yes_cmd=$3
     _G_no_cmd=${4-":"}
 
-    case $_G_wslist in
-      *" $_G_member "*)
-        eval "$_G_yes_cmd"
-       _G_status=$?
-       ;;
-      *)
-       eval "$_G_no_cmd"
-       _G_status=$?
-       ;;
-    esac
+    _G_found=false
+    for _G_item in $_G_wslist; do
+      test "x$_G_item" = "x$_G_member" && {
+        _G_found=:
+       break
+      }
+    done
+    if $_G_found; then
+      eval "$_G_yes_cmd"
+      _G_status=$?
+    else
+      eval "$_G_no_cmd"
+      _G_status=$?
+    fi
 
     test 0 -eq "$_G_status" || exit $_G_status
 }
@@ -4213,7 +4764,7 @@ func_strpad ()
     $debug_cmd
 
     _G_width=`expr "$2" - 1`
-    func_strpad_result=`$bs_echo "$1" |$SED '
+    func_strpad_result=`$ECHO "$1" |$SED '
         :a
         s|^.\{0,'"$_G_width"'\}$|&'"$3"'|
         ta
@@ -4230,7 +4781,7 @@ func_strrpad ()
     $debug_cmd
 
     _G_width=`expr "$2" - 1`
-    func_strrpad_result=`$bs_echo "$1" |$SED '
+    func_strrpad_result=`$ECHO "$1" |$SED '
         :a
         s|^.\{0,'"$_G_width"'\}$|'"$3"'&|
         ta
@@ -4315,7 +4866,7 @@ func_strtable ()
 
     # Strip off the indent, and make a divider with '-' chars, then
     # reindent.
-    _G_divider=`$bs_echo "$func_strrow_result" \
+    _G_divider=`$ECHO "$func_strrow_result" \
         |$SED 's|[^ ]|-|g
             :a
             s|- |--|g
@@ -4385,8 +4936,8 @@ func_show_eval ()
     _G_fail_exp=${2-':'}
 
     ${opt_silent-'false'} || {
-      func_quote_for_eval $_G_cmd
-      eval func_truncate_cmd $func_quote_for_eval_result
+      func_quote eval $_G_cmd
+      eval func_truncate_cmd $func_quote_result
       func_echo "running: $tc_bold$func_truncate_cmd_result$tc_reset"
     }
 
@@ -4442,7 +4993,7 @@ func_gitignore_entries ()
 {
     $debug_cmd
 
-    sed -e '/^#/d' -e '/^$/d' "$@"
+    $SED -e '/^#/d' -e '/^$/d' "$@"
 }
 
 
@@ -4472,62 +5023,15 @@ func_insert_if_absent ()
           || func_verbose "inserting '$str' into '$file'"
 
       linesold=`func_gitignore_entries "$file" |wc -l`
-      linesnew=`{ $bs_echo "$str"; cat "$file"; } \
+      linesnew=`{ $ECHO "$str"; cat "$file"; } \
                 |func_gitignore_entries |sort -u |wc -l`
       test "$linesold" -eq "$linesnew" \
-        || { sed "1i\\$nl$str$nl" "$file" >"$file"T && mv "$file"T "$file"; } \
+        || { $SED "1i\\$nl$str$nl" "$file" >"$file"T && mv "$file"T "$file"; } \
         || func_permissions_error "$file"
     done
 }
 
 
-# func_sort_ver VER1 VER2
-# -----------------------
-# 'sort -V' is not generally available.
-# Note this deviates from the version comparison in automake
-# in that it treats 1.5 < 1.5.0, and treats 1.4.4a < 1.4-p3a
-# but this should suffice as we won't be specifying old
-# version formats or redundant trailing .0 in bootstrap.conf.
-# If we did want full compatibility then we should probably
-# use m4_version_compare from autoconf.
-func_sort_ver ()
-{
-    $debug_cmd
-
-    ver1=$1
-    ver2=$2
-
-    # Split on '.' and compare each component.
-    i=1
-    while :; do
-      p1=`echo "$ver1" |cut -d. -f$i`
-      p2=`echo "$ver2" |cut -d. -f$i`
-      if test ! "$p1"; then
-        echo "$1 $2"
-        break
-      elif test ! "$p2"; then
-        echo "$2 $1"
-        break
-      elif test ! "$p1" = "$p2"; then
-        if test "$p1" -gt "$p2" 2>/dev/null; then # numeric comparison
-          echo "$2 $1"
-        elif test "$p2" -gt "$p1" 2>/dev/null; then # numeric comparison
-          echo "$1 $2"
-        else # numeric, then lexicographic comparison
-          lp=`printf "$p1\n$p2\n" |sort -n |tail -n1`
-          if test "$lp" = "$p2"; then
-            echo "$1 $2"
-          else
-            echo "$2 $1"
-          fi
-        fi
-        break
-      fi
-      i=`expr $i + 1`
-    done
-}
-
-
 # func_get_version APP
 # --------------------
 # echo the version number (if any) of APP, which is looked up along your
@@ -4540,7 +5044,7 @@ func_get_version ()
 
     # Rather than uncomment the sed script in-situ, strip the comments
     # programatically before passing the result to $SED for evaluation.
-    sed_get_version=`$bs_echo '# extract version within line
+    sed_get_version=`$ECHO '# extract version within line
           s|.*[v ]\{1,\}\([0-9]\{1,\}\.[.a-z0-9-]*\).*|\1|
           t done
 
@@ -4582,7 +5086,7 @@ func_check_tool ()
       ;;
     *)
       save_IFS=$IFS
-      IFS=:
+      IFS=${PATH_SEPARATOR-:}
       for _G_check_tool_path in $PATH; do
         IFS=$save_IFS
        if test -x "$_G_check_tool_path/$1"; then
@@ -4638,9 +5142,6 @@ delimited list of triples; 'program min-version url'."
       else
         _G_instver=`func_get_version $_G_app`
 
-        test -z "$_G_instver" \
-            || func_verbose "found '$_G_app' version $_G_instver."
-
         # Fail if --version didn't work.
         if test -z "$_G_instver"; then
           func_error "Prerequisite '$_G_app' not found. Please install it, or
@@ -4649,13 +5150,29 @@ delimited list of triples; 'program min-version url'."
 
         # Fail if a newer version than what we have is required.
         else
-          _G_newer=`func_sort_ver $_G_reqver $_G_instver |cut -d' ' -f2`
-          test "$_G_newer" != "$_G_instver" && {
-            func_error "\
+          func_verbose "found '$_G_app' version $_G_instver."
+
+         case $_G_reqver in
+            =*)
+              # If $buildreq version starts with '=', version must
+             # match the installed program exactly.
+             test "x$_G_reqver" = "x=$_G_instver" || {
+               func_error "\
+  '$_G_app' version == $_G_instver is too old
+  'exactly $_G_app-$_G_reqver is required"
+                func_check_versions_result=false
+              }
+             ;;
+           *)
+              # Otherwise, anything that is not older is a match.
+              func_lt_ver "$_G_reqver" "$_G_instver" || {
+                func_error "\
   '$_G_app' version == $_G_instver is too old
   '$_G_app' version >= $_G_reqver is required"
             func_check_versions_result=false
-          }
+              }
+             ;;
+         esac
         fi
       fi
     done
@@ -4715,6 +5232,9 @@ func_update_po_files ()
     # Find sha1sum, named gsha1sum on MacPorts, and shasum on MacOS 10.6+.
     func_find_tool SHA1SUM sha1sum gsha1sum shasum sha1
 
+    test -n "$SHA1SUM" || func_fatal_error "\
+Please install GNU Coreutils, or 'export SHA1SUM=/path/to/sha1sum'."
+
     _G_langs=`cd $_G_ref_po_dir && echo *.po|$SED 's|\.po||g'`
     test '*' = "$_G_langs" && _G_langs=x
     for _G_po in $_G_langs; do
@@ -4804,8 +5324,8 @@ bootstrap_options_prep ()
     opt_skip_po=false
 
     # Pass back the list of options we consumed.
-    func_quote_for_eval ${1+"$@"}
-    bootstrap_options_prep_result=$func_quote_for_eval_result
+    func_quote eval ${1+"$@"}
+    bootstrap_options_prep_result=$func_quote_result
 }
 func_add_hook func_options_prep bootstrap_options_prep
 
@@ -4855,8 +5375,8 @@ bootstrap_parse_options ()
     done
 
     # save modified positional parameters for caller
-    func_quote_for_eval ${1+"$@"}
-    bootstrap_parse_options_result=$func_quote_for_eval_result
+    func_quote eval ${1+"$@"}
+    bootstrap_parse_options_result=$func_quote_result
 }
 func_add_hook func_parse_options bootstrap_parse_options
 
@@ -4874,8 +5394,8 @@ bootstrap_validate_options ()
         && func_fatal_help "too many arguments"
 
     # Pass back the (empty) list of unconsumed options.
-    func_quote_for_eval ${1+"$@"}
-    bootstrap_validate_options_result=$func_quote_for_eval_result
+    func_quote eval ${1+"$@"}
+    bootstrap_validate_options_result=$func_quote_result
 }
 func_add_hook func_validate_options bootstrap_validate_options
 
@@ -4905,7 +5425,7 @@ exit ${exit_status-$EXIT_SUCCESS}
 # Local variables:
 # mode: shell-script
 # sh-indentation: 2
-# eval: (add-hook 'write-file-hooks 'time-stamp)
-# time-stamp-pattern: "20/scriptversion=%:y-%02m-%02d.%02H; # UTC"
+# eval: (add-hook 'before-save-hook 'time-stamp)
+# time-stamp-pattern: "500/scriptversion=%:y-%02m-%02d.%02H; # UTC"
 # time-stamp-time-zone: "UTC"
 # End: