3 # AX_PROG_FLEX_VERSION([VERSION],[ACTION-IF-TRUE],[ACTION-IF-FALSE])
7 # Makes sure that flex version is greater or equal to the version indicated.
8 # If true the shell commands in ACTION-IF-TRUE are executed. If not the shell
9 # commands in commands in ACTION-IF-TRUE are executed. If not the shell
10 # commands in ACTION-IF-FALSE are run. Note if $FLEX is not set (for example
11 # by running AC_CHECK_PROG or AC_PATH_PROG) the macro will fail.
15 # AC_PATH_PROG([FLEX],[flex])
16 # AX_PROG_FLEX_VERSION([2.5.39],[ ... ],[ ... ])
18 # This will check to make sure that the flex you have is at least
19 # version 2.5.39 or greater.
21 # NOTE: This macro uses the $FLEX variable to perform the check.
25 # Copyright (c) 2015 Jonathan Rajotte-Julien <jonathan.rajotte-julien@efficios.com>
27 # Copying and distribution of this file, with or without modification, are
28 # permitted in any medium without royalty provided the copyright notice
29 # and this notice are preserved. This file is offered as-is, without any
34 AC_DEFUN([AX_PROG_FLEX_VERSION],[
35 AC_REQUIRE([AC_PROG_SED])
36 AC_REQUIRE([AC_PROG_GREP])
38 AS_IF([test -n "$FLEX"],[
41 AC_MSG_CHECKING([for flex version])
43 flex_version=`$FLEX --version 2>&1 \
44 | $SED -n -e '/flex /b inspect
47 s/.* (\{0,1\}\([0-9]*\.[0-9]*\.[0-9]*\))\{0,1\}.*/\1/;p'`
49 AC_MSG_RESULT($flex_version)
51 AC_SUBST([FLEX_VERSION],[$flex_version])
53 AX_COMPARE_VERSION([$flex_version],[ge],[$ax_flex_version],[
61 AC_MSG_WARN([could not find flex])