X-Git-Url: https://git.saurik.com/bison.git/blobdiff_plain/c1455babda1c43195e185a8590678836ad08ac8f..3710dd02e2ade48dc1ad17fad654daef78cf6d6e:/bootstrap diff --git a/bootstrap b/bootstrap index 4b0abfa6..4d31cbe4 100755 --- a/bootstrap +++ b/bootstrap @@ -142,29 +142,37 @@ vc_ignore=auto # find_tool ENVVAR NAMES... # ------------------------- +# Look for some needed program. Use the value of the ENVVAR if set, +# otherwise look for the first of the NAMES that can be run (i.e., +# supports --version). If found, set ENVVAR to the program name, +# die otherwise. find_tool () { # Find sha1sum, named gsha1sum on MacPorts. find_tool_envvar=$1 shift - if eval test x"\$$find_tool_envvar" = x; then + find_tool_names=$@ + eval "find_tool_res=\$$find_tool_envvar" + if test x"$find_tool_res" = x; then for i do if ($i --version /dev/null 2>&1; then - find_tool_res=$i - break + find_tool_res=$i + break fi done + else + find_tool_error_prefix="\$$find_tool_envvar: " fi if test x"$find_tool_res" = x; then - echo >&2 "$0: $find_tool_name is required" + echo >&2 "$0: one of these is required: $find_tool_names" exit 1 fi ($find_tool_res --version /dev/null 2>&1 || { - echo >&2 "$0: cannot run $find_tool_res --version" + echo >&2 "$0: ${find_tool_error_prefix}cannot run $find_tool_res --version" exit 1 } - eval "$find_tool_envvar=\"$find_tool_res\"" + eval "$find_tool_envvar=\$find_tool_res" eval "export $find_tool_envvar" }