diff options
| author | Glenn Morris | 2017-06-19 21:13:08 -0400 |
|---|---|---|
| committer | Glenn Morris | 2017-06-19 21:13:08 -0400 |
| commit | c4bec6cc2ad19b9910b8a502eae36d2a01ddcc85 (patch) | |
| tree | bbed18690109bb1bf4428af1406260185285c52f | |
| parent | 8b387202204e009b0e242bed602e20720d087acc (diff) | |
| download | emacs-c4bec6cc2ad19b9910b8a502eae36d2a01ddcc85.tar.gz emacs-c4bec6cc2ad19b9910b8a502eae36d2a01ddcc85.zip | |
autogen.sh: try to check for tool being present but broken
* autogen.sh (get_version): Check return status of "--version".
(check_version): Try to distinguish between a missing tool
and a broken one. (Bug#27288)
| -rwxr-xr-x | autogen.sh | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/autogen.sh b/autogen.sh index 0153f896a17..9fdd492456f 100755 --- a/autogen.sh +++ b/autogen.sh | |||
| @@ -45,8 +45,10 @@ autoconf_min=`sed -n 's/^ *AC_PREREQ(\([0-9\.]*\)).*/\1/p' configure.ac` | |||
| 45 | ## Also note that we do not handle micro versions. | 45 | ## Also note that we do not handle micro versions. |
| 46 | get_version () | 46 | get_version () |
| 47 | { | 47 | { |
| 48 | ## Remove eg "./autogen.sh: line 50: autoconf: command not found". | 48 | vers=`$1 --version 2> /dev/null` |
| 49 | $1 --version 2>&1 | sed -e '/not found/d' -e 's/.* //' -n -e '1 s/\([0-9][0-9\.]*\).*/\1/p' | 49 | [ x"$vers" = x ] && return 1 |
| 50 | |||
| 51 | echo "$vers" | sed -n -e '1 s/.* \([0-9][0-9\.]*\).*/\1/p' | ||
| 50 | } | 52 | } |
| 51 | 53 | ||
| 52 | ## $1 = version string, eg "2.59" | 54 | ## $1 = version string, eg "2.59" |
| @@ -82,9 +84,15 @@ check_version () | |||
| 82 | printf '%s' "(using $uprog0=$uprog) " | 84 | printf '%s' "(using $uprog0=$uprog) " |
| 83 | fi | 85 | fi |
| 84 | 86 | ||
| 87 | found=`command -v $uprog 2> /dev/null` | ||
| 88 | [ x"$found" = x ] && return 1 | ||
| 89 | |||
| 85 | have_version=`get_version $uprog` | 90 | have_version=`get_version $uprog` |
| 86 | 91 | ||
| 87 | [ x"$have_version" = x ] && return 1 | 92 | ## We should really check the return status of get_version. |
| 93 | ## Non-zero means a broken executable, otherwise we failed to | ||
| 94 | ## parse the version string. | ||
| 95 | [ x"$have_version" = x ] && return 4 | ||
| 88 | 96 | ||
| 89 | have_maj=`major_version $have_version` | 97 | have_maj=`major_version $have_version` |
| 90 | need_maj=`major_version $2` | 98 | need_maj=`major_version $2` |
| @@ -158,6 +166,7 @@ if $do_autoconf; then | |||
| 158 | 0) stat="ok" ;; | 166 | 0) stat="ok" ;; |
| 159 | 1) stat="missing" ;; | 167 | 1) stat="missing" ;; |
| 160 | 2) stat="too old" ;; | 168 | 2) stat="too old" ;; |
| 169 | 4) stat="broken?" ;; | ||
| 161 | *) stat="unable to check" ;; | 170 | *) stat="unable to check" ;; |
| 162 | esac | 171 | esac |
| 163 | 172 | ||