1 dnl AC_PROG_FLEX: Check whether the LEXer is flex, and which version it has
2 dnl The first arg must be a version number with 3 parts.
4 dnl You may want to check for version >= 2.5.31 (the one breaking posix compatibility)
6 AC_DEFUN([_AC_PROG_FLEX_HELPER_TOO_OLD],[
7 AC_MSG_NOTICE([Found flex is too old. Parsers won't get updated (Found v$FLEX_VERSION < v$1)])
8 LEX="$SHELL $missing_dir/missing flex";
12 AC_DEFUN([AC_PROG_FLEX],
15 AC_REQUIRE([AM_MISSING_HAS_RUN])dnl
16 AC_REQUIRE([AC_PROG_LEX])dnl
17 if test "$LEX" != flex; then
18 AC_MSG_NOTICE([Flex not found. Parsers won't get updated.])
19 LEX=${am_missing_run}flex
22 if test "x$1" != "x" ; then
24 dnl We were asked to check the version number
26 changequote(<<, >>)dnl because of the regexp [blabla]
27 FLEX_VERSION=`flex --version | sed -e 's/^[^0-9]*//' -e 's/[^0-9]*$//'`
29 FLEX_VER_MAJ=`echo "$FLEX_VERSION" | sed 's/\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\)/\1/'`
30 FLEX_VER_MED=`echo "$FLEX_VERSION" | sed 's/\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\)/\2/'`
31 FLEX_VER_MIN=`echo "$FLEX_VERSION" | sed 's/\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\)/\3/'`
33 WANT_VER_MAJ=`echo $1 | sed 's/\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\)/\1/'`;
34 WANT_VER_MED=`echo $1 | sed 's/\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\)/\2/'`;
35 WANT_VER_MIN=`echo $1 | sed 's/\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\)/\3/'`;
36 changequote([, ])dnl back to normality, there is no regexp afterward
38 if test "$FLEX_VER_MAJ" -lt "$WANT_VER_MAJ" ||
39 test "$FLEX_VER_MAJ" -eq "$WANT_VER_MAJ" -a "$FLEX_VER_MED" -lt "$WANT_VER_MED" ||
40 test "$FLEX_VER_MAJ" -eq "$WANT_VER_MAJ" -a "$FLEX_VER_MED" -eq "$WANT_VER_MED" -a "$FLEX_VER_MIN" -lt "$WANT_VER_MIN" ;
42 AC_MSG_NOTICE([Found flex is too old. Parsers won't get updated (Found v$FLEX_VERSION < v$1)])
43 LEX=${am_missing_run}flex
46 AC_MSG_NOTICE([Flex found. Parsers will get updated])