diff options
author | Jonathan Rajotte <jonathan.rajotte-julien@efficios.com> | 2015-07-02 15:24:28 -0400 |
---|---|---|
committer | Peter Simons <simons@cryp.to> | 2015-07-09 16:38:18 +0200 |
commit | fd1f2862c1524e73495d67646d26000e2e85e807 (patch) | |
tree | 918f6ca4a808bb608e1209dba743d771f4896632 /m4/ax_prog_bison_version.m4 | |
parent | b2bdd8591b2d6b1eb580ead5f978a30e3ecfc36c (diff) | |
download | autoconf-archive-fd1f2862c1524e73495d67646d26000e2e85e807.tar.gz |
Add GNU Bison version check
Valid from Bison v1.29b until now[1].
[1]http://git.savannah.gnu.org/cgit/bison.git/commit/?id=e79137accc7ea0352cd4677ff22818f9c68d4eab
Diffstat (limited to 'm4/ax_prog_bison_version.m4')
-rw-r--r-- | m4/ax_prog_bison_version.m4 | 68 |
1 files changed, 68 insertions, 0 deletions
diff --git a/m4/ax_prog_bison_version.m4 b/m4/ax_prog_bison_version.m4 new file mode 100644 index 0000000..32e2a67 --- /dev/null +++ b/m4/ax_prog_bison_version.m4 @@ -0,0 +1,68 @@ +# =========================================================================== +# http://www.gnu.org/software/autoconf-archive/ax_prog_bison_version.html +# =========================================================================== +# +# SYNOPSIS +# +# AX_PROG_BISON_VERSION([VERSION],[ACTION-IF-TRUE],[ACTION-IF-FALSE]) +# +# DESCRIPTION +# +# Makes sure that bison version is greater or equal to the version indicated. +# If true the shell commands in ACTION-IF-TRUE are executed. If not the shell +# commands in commands in ACTION-IF-TRUE are executed. If not the shell +# commands in ACTION-IF-FALSE are run. Note if $BISON is not set (for example +# by running AC_CHECK_PROG or AC_PATH_PROG) the macro will fail. +# +# Example: +# +# AC_PATH_PROG([BISON],[bison]) +# AX_PROG_BISON_VERSION([3.0.2],[ ... ],[ ... ]) +# +# This will check to make sure that the bison you have is at least +# version 3.0.2 or greater. +# +# NOTE: This macro uses the $BISON variable to perform the check. +# +# LICENSE +# +# Copyright (c) 2015 Jonathan Rajotte-Julien <jonathan.rajotte-julien@efficios.com> +# +# Copying and distribution of this file, with or without modification, are +# permitted in any medium without royalty provided the copyright notice +# and this notice are preserved. This file is offered as-is, without any +# warranty. + +#serial 1 + +AC_DEFUN([AX_PROG_BISON_VERSION],[ + AC_REQUIRE([AC_PROG_SED]) + AC_REQUIRE([AC_PROG_GREP]) + + AS_IF([test -n "$BISON"],[ + ax_bison_version="$1" + + AC_MSG_CHECKING([for bison version]) + changequote(<<,>>) + bison_version=`$BISON --version 2>&1 \ + | $SED -n -e '/bison (GNU Bison)/b inspect +b +: inspect +s/.* (\{0,1\}\([0-9]*\.[0-9]*\.[0-9]*\))\{0,1\}.*/\1/;p'` + changequote([,]) + AC_MSG_RESULT($bison_version) + + AC_SUBST([BISON_VERSION],[$bison_version]) + + AX_COMPARE_VERSION([$bison_version],[ge],[$ax_bison_version],[ + : + $2 + ],[ + : + $3 + ]) + ],[ + AC_MSG_WARN([could not find bison]) + $3 + ]) +]) |