From: Eric Blake Date: Thu, 3 Nov 2016 18:50:30 +0000 (-0500) Subject: bootstrap: Fix get_version() for AIX 5.3 X-Git-Tag: v1.0~6567 X-Git-Url: https://gitweb.git.savannah.gnu.org/gitweb/?a=commitdiff_plain;h=4f9007e2467788fee5e08ba5df20aebab9d4a373;p=gnulib.git bootstrap: Fix get_version() for AIX 5.3 * build-aux/bootstrap (get_version): Factor out sed script, since indented comments choke AIX 5.3 sed. Reported-by: Michael Felt Signed-off-by: Eric Blake --- diff --git a/ChangeLog b/ChangeLog index 79495a59a0..e5d7987f30 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2016-11-03 Eric Blake + + bootstrap: Fix get_version() for AIX 5.3 + * build-aux/bootstrap (get_version): Factor out sed script, since + indented comments choke AIX 5.3 sed. + Reported-by: Michael Felt + 2016-11-03 Paul Eggert intprops: port to older XL C diff --git a/build-aux/bootstrap b/build-aux/bootstrap index f060bab83e..5d3c2898cf 100755 --- a/build-aux/bootstrap +++ b/build-aux/bootstrap @@ -1,6 +1,6 @@ #! /bin/sh # Print a version string. -scriptversion=2016-01-24.06; # UTC +scriptversion=2016-11-03.18; # UTC # Bootstrap this package from checked-out sources. @@ -418,28 +418,30 @@ sort_ver() { # sort -V is not generally available done } -get_version() { - app=$1 +get_version_sed=' +# Move version to start of line. +s/.*[v ]\([0-9]\)/\1/ - $app --version >/dev/null 2>&1 || { $app --version; return 1; } +# Skip lines that do not start with version. +/^[0-9]/!d - $app --version 2>&1 | - sed -n '# Move version to start of line. - s/.*[v ]\([0-9]\)/\1/ +# Remove characters after the version. +s/[^.a-z0-9-].*// - # Skip lines that do not start with version. - /^[0-9]/!d +# The first component must be digits only. +s/^\([0-9]*\)[a-z-].*/\1/ - # Remove characters after the version. - s/[^.a-z0-9-].*// +#the following essentially does s/5.005/5.5/ +s/\.0*\([1-9]\)/.\1/g +p +q' - # The first component must be digits only. - s/^\([0-9]*\)[a-z-].*/\1/ +get_version() { + app=$1 + + $app --version >/dev/null 2>&1 || { $app --version; return 1; } - #the following essentially does s/5.005/5.5/ - s/\.0*\([1-9]\)/.\1/g - p - q' + $app --version 2>&1 | sed -n "$get_version_sed" } check_versions() {