Make Bison version detection more portable

- POSIX sh actually does NOT support `+=`,
  but Bash does even in compatibility mode
- `mawk` does not fully support POSIX EREs (regexes),
  so work around its lack of brace support
Fixes building on Debian, apparently.
This commit is contained in:
ISSOtm
2020-12-29 22:29:25 +01:00
parent 6874f694e5
commit aa27e714d4
2 changed files with 5 additions and 5 deletions

View File

@@ -1,7 +1,7 @@
#!/bin/sh
bison -V | awk '
/^bison.*[0-9]+(\.[0-9]+){1,2}$/ {
match($0, /[0-9]+(\.[0-9]+){1,2}$/);
bison -V | awk -v major="$1" -v minor="$2" '
/^bison.*[0-9]+(\.[0-9]+)(\.[0-9]+)?$/ {
match($0, /[0-9]+(\.[0-9]+)(\.[0-9]+)?$/);
split(substr($0, RSTART), ver, ".");
if (ver[1] == major && ver[2] >= minor) { exit 0 } else { exit 1 }
}' major="$1" minor="$2"
}'