1 # ===========================================================================
2 # https://www.gnu.org/software/autoconf-archive/ax_prog_bison_version.html
3 # ===========================================================================
7 # AX_PROG_BISON_VERSION([VERSION],[ACTION-IF-TRUE],[ACTION-IF-FALSE])
11 # Makes sure that bison version is greater or equal to the version
12 # indicated. If true the shell commands in ACTION-IF-TRUE are executed. If
13 # not the shell commands in commands in ACTION-IF-TRUE are executed. If
14 # not the shell commands in ACTION-IF-FALSE are run. Note if $YACC is not
15 # set (for example by running AC_PROG_YACC or AC_PATH_PROG) the macro
21 # AX_PROG_BISON_VERSION([3.0.2],[ ... ],[ ... ])
23 # This will check to make sure that the bison you have is at least version
26 # NOTE: This macro uses the $YACC variable to perform the check, if it's
27 # empty it will failover to the $BISON variable for backwards compatibility.
31 # Copyright (c) 2015 Jonathan Rajotte-Julien <jonathan.rajotte-julien@efficios.com>
32 # 2017 Michael Jeanson <mjeanson@efficios.com>
34 # Copying and distribution of this file, with or without modification, are
35 # permitted in any medium without royalty provided the copyright notice
36 # and this notice are preserved. This file is offered as-is, without any
41 AC_DEFUN([AX_PROG_BISON_VERSION],[
42 AC_REQUIRE([AC_PROG_SED])
43 AC_REQUIRE([AC_PROG_GREP])
45 AS_IF([test -z "$YACC"],[
46 AS_IF([test -n "$BISON"],[
51 AS_IF([test -n "$YACC"],[
54 AC_MSG_CHECKING([for bison version])
56 bison_version=`$YACC --version 2>&1 \
57 | $SED -n -e '/bison (GNU Bison)/b inspect
60 s/.* (\{0,1\}\([0-9]*\.[0-9]*\.[0-9]*\))\{0,1\}.*/\1/;p'`
62 AC_MSG_RESULT($bison_version)
64 AC_SUBST([BISON_VERSION],[$bison_version])
66 AX_COMPARE_VERSION([$bison_version],[ge],[$ax_bison_version],[
74 AC_MSG_WARN([could not find bison])