]> The Tcpdump Group git mirrors - libpcap/commitdiff
Fix Bison detection for minor version 0. [skip ci]
authorDenis Ovsienko <[email protected]>
Wed, 3 Feb 2021 21:55:15 +0000 (21:55 +0000)
committerGuy Harris <[email protected]>
Thu, 25 Feb 2021 19:02:29 +0000 (11:02 -0800)
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)

CHANGES
CMakeLists.txt
configure
configure.ac

diff --git a/CHANGES b/CHANGES
index 64b9c3f73741c3d86abd91d8de296ea535975052..25167981499aec940ac18178e5c0d1e21cd7ec0e 100644 (file)
--- 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
       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
     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
index 0b87759f346e701c30cd37345d335a9527a7ad91..4df0a74fb3ae9a99c040ad6eb4a1c44e50173c34 100644 (file)
@@ -2072,7 +2072,7 @@ else()
     # "%pure-parser".
     #
     execute_process(COMMAND ${YACC_EXECUTABLE} -V OUTPUT_VARIABLE bison_full_version)
     # "%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()
     if (bison_major_minor VERSION_LESS "2.4")
         set(REENTRANT_PARSER "%pure-parser")
     else()
index 8b22882b02bce658f59e436e9f6f17e994f2716f..43bde171bfbcfe2a0ee0b5c5733b7c6babcebedb 100755 (executable)
--- 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 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
        if test "$bison_major_version" -lt 2 -o \
            \( "$bison_major_version" -eq 2 -a "$bison_major_version" -lt 4 \)
        then
index eb427d8a3ee59c3f584bc1ff327a900dc46e0715..cc112e0832bcfe14af319b4fc9eb7c3e2cf21914 100644 (file)
@@ -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 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
        if test "$bison_major_version" -lt 2 -o \
            \( "$bison_major_version" -eq 2 -a "$bison_major_version" -lt 4 \)
        then