Amend the autoconf and CMake regexps to match a minor version that is
an integer >= 0 instead of >= 1. As far as I can tell, grammar.y would
have "%define api.pure" instead of "%pure-parser" for bison/yacc
versions 1.0 and 2.0 (cannot estimate the probability of running into
these in the wild though). Also this bug caused an error message in the
middle of the usual output:
./configure: line 8569: test: : integer expression expected
$ bison -V
bison (GNU Bison) 3.0.4
Written by Robert Corbett and Richard Stallman.
Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
(cherry picked from commit
3c453c59240786868dc3f1e47adaa3daaeca7579)
Squelch some compiler warnings
Squelch some Bison warnings
Fix cross-builds with older kernels lacking BPF_MOD and BPF_XOR
+ Fix Bison detection for minor version 0.
Linux:
Drop support for text-mode USB captures, as we require a 2.6.27
or later kernel (credit to Chaoyuan Peng for noting the
# "%pure-parser".
#
execute_process(COMMAND ${YACC_EXECUTABLE} -V OUTPUT_VARIABLE bison_full_version)
- string(REGEX MATCH "[1-9][0-9]*[.][1-9][0-9]*" bison_major_minor ${bison_full_version})
+ string(REGEX MATCH "[1-9][0-9]*[.][0-9]+" bison_major_minor ${bison_full_version})
if (bison_major_minor VERSION_LESS "2.4")
set(REENTRANT_PARSER "%pure-parser")
else()
# Bison prior to 2.4(.1) doesn't support "%define api.pure", so use
# "%pure-parser".
#
- bison_major_version=`$BISON_BYACC -V | sed -n 's/.* \([1-9][0-9]*\)\.[1-9][0-9.]*/\1/p'`
- bison_minor_version=`$BISON_BYACC -V | sed -n 's/.* [1-9][0-9]*\.\([1-9][0-9]*\).*/\1/p'`
+ bison_major_version=`$BISON_BYACC -V | sed -n 's/.* \([1-9][0-9]*\)\.[0-9][0-9.]*/\1/p'`
+ bison_minor_version=`$BISON_BYACC -V | sed -n 's/.* [1-9][0-9]*\.\([0-9]+\).*/\1/p'`
if test "$bison_major_version" -lt 2 -o \
\( "$bison_major_version" -eq 2 -a "$bison_major_version" -lt 4 \)
then
# Bison prior to 2.4(.1) doesn't support "%define api.pure", so use
# "%pure-parser".
#
- bison_major_version=`$BISON_BYACC -V | sed -n 's/.* \(@<:@1-9@:>@@<:@0-9@:>@*\)\.@<:@1-9@:>@@<:@0-9.@:>@*/\1/p'`
- bison_minor_version=`$BISON_BYACC -V | sed -n 's/.* @<:@1-9@:>@@<:@0-9@:>@*\.\(@<:@1-9@:>@@<:@0-9@:>@*\).*/\1/p'`
+ bison_major_version=`$BISON_BYACC -V | sed -n 's/.* \(@<:@1-9@:>@@<:@0-9@:>@*\)\.@<:@0-9@:>@@<:@0-9.@:>@*/\1/p'`
+ bison_minor_version=`$BISON_BYACC -V | sed -n 's/.* @<:@1-9@:>@@<:@0-9@:>@*\.\(@<:@0-9@:>@+\).*/\1/p'`
if test "$bison_major_version" -lt 2 -o \
\( "$bison_major_version" -eq 2 -a "$bison_major_version" -lt 4 \)
then