From: Denis Ovsienko Date: Wed, 3 Feb 2021 21:55:15 +0000 (+0000) Subject: Fix Bison detection for minor version 0. [skip ci] X-Git-Tag: libpcap-1.10.1~77 X-Git-Url: https://git.tcpdump.org/libpcap/commitdiff_plain/840d7122d448e2bcba9a7159d2c7738edbcb3bbc Fix Bison detection for minor version 0. [skip ci] 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) --- diff --git a/CHANGES b/CHANGES index 64b9c3f7..25167981 100644 --- a/CHANGES +++ b/CHANGES @@ -7,6 +7,7 @@ Monthday, Month DD, YYYY 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 diff --git a/CMakeLists.txt b/CMakeLists.txt index 0b87759f..4df0a74f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2072,7 +2072,7 @@ else() # "%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() diff --git a/configure b/configure index 8b22882b..43bde171 100755 --- a/configure +++ b/configure @@ -8564,8 +8564,8 @@ if test x"$BISON_BYACC" != x; 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 diff --git a/configure.ac b/configure.ac index eb427d8a..cc112e08 100644 --- a/configure.ac +++ b/configure.ac @@ -1757,8 +1757,8 @@ if test x"$BISON_BYACC" != x; 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