ref: aa27e714d4e8c9aee15d220dd9f207cfd2524bba
parent: 6874f694e5eadfdeb5ddfcf24dea57413c02bd46
author: ISSOtm <eldredhabert0@gmail.com>
date: Tue Dec 29 17:29:25 EST 2020
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.
--- a/Makefile
+++ b/Makefile
@@ -125,7 +125,7 @@
$QDEFS=; \
add_flag(){ \
if src/check_bison_ver.sh $$1 $$2; then \
- DEFS+=-D$$3; \
+ DEFS="$$DEFS -D$$3"; \
fi \
}; \
add_flag 3 5 api.token.raw=true; \
--- a/src/check_bison_ver.sh
+++ b/src/check_bison_ver.sh
@@ -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"
+}'