summaryrefslogtreecommitdiff
path: root/bootstrap
diff options
context:
space:
mode:
authorPádraig Brady <P@draigBrady.com>2009-11-30 14:01:44 +0100
committerJim Meyering <meyering@redhat.com>2009-11-30 14:04:43 +0100
commitcb775df09e79fc8cb5608bbc4a2ca8b621a4f771 (patch)
tree048f5398afb577ae243cff56b81b4c6a04ea4c05 /bootstrap
parentb92e0455e1c70437a3c0553abc103727553fe238 (diff)
downloadcoreutils-cb775df09e79fc8cb5608bbc4a2ca8b621a4f771.tar.xz
bootstrap: fix handling of various perl --version formats
* bootstrap (get_version): Don't use perl's $] special variable, as that requires updating all bootstrap.conf files to use perl's x.yyyzzz version format. Instead make the regular expression more general to support version formats from older perl-5.005_002 (5.5.2) and perl-5.11 which has other numbers in the version line.
Diffstat (limited to 'bootstrap')
-rwxr-xr-xbootstrap19
1 files changed, 11 insertions, 8 deletions
diff --git a/bootstrap b/bootstrap
index a837194cb..8cba3be73 100755
--- a/bootstrap
+++ b/bootstrap
@@ -311,20 +311,23 @@ sort_ver() { # sort -V is not generally available
get_version() {
app=$1
- # perl 5.11's --version output does not fit the mold,
- # handle perl as a special case.
- if test "_$app" = _perl; then
- perl -le 'print $]' || return 1
- return 0
- fi
-
$app --version >/dev/null 2>&1 || return 1
$app --version 2>&1 |
- sed -n 's/[^0-9.]*\([0-9]\{1,\}\.[.a-z0-9-]*\).*/\1/p
+ sed -n '# extract version within line
+ s/.*[v ]\{1,\}\([0-9]\{1,\}\.[.a-z0-9-]*\).*/\1/
+ t done
+
+ # extract version at start of line
+ s/^\([0-9]\{1,\}\.[.a-z0-9-]*\).*/\1/
t done
+
d
+
:done
+ #the following essentially does s/5.005/5.5/
+ s/\.0*\([1-9]\)/.\1/g
+ p
q'
}