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)
7 dnl Copyright (C) 2005. Martin Quinson. All rights reserved.
9 dnl This file is part of the SimGrid project. This is free software:
10 dnl You can redistribute and/or modify it under the terms of the
11 dnl GNU LGPL (v2.1) licence.
14 AC_DEFUN([_AC_PROG_FLEX_HELPER_TOO_OLD],[
15 AC_MSG_NOTICE([Found flex is too old. Parsers won't get updated (Found v$FLEX_VERSION < v$1)])
16 LEX="$SHELL $missing_dir/missing flex";
20 AC_DEFUN([AC_PROG_FLEX],
23 AC_REQUIRE([AM_MISSING_HAS_RUN])dnl
24 AC_REQUIRE([AC_PROG_LEX])dnl
25 if test "$LEX" != flex; then
26 AC_MSG_NOTICE([Flex not found. Parsers won't get updated.])
27 LEX=${am_missing_run}flex
30 if test "x$1" != "x" ; then
32 dnl We were asked to check the version number
34 changequote(<<, >>)dnl because of the regexp [blabla]
35 FLEX_VERSION=`flex --version | sed -e 's/^[^0-9]*//' -e 's/[^0-9]*$//'`
37 FLEX_VER_MAJ=`echo "$FLEX_VERSION" | sed 's/\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\)/\1/'`
38 FLEX_VER_MED=`echo "$FLEX_VERSION" | sed 's/\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\)/\2/'`
39 FLEX_VER_MIN=`echo "$FLEX_VERSION" | sed 's/\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\)/\3/'`
41 WANT_VER_MAJ=`echo $1 | sed 's/\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\)/\1/'`;
42 WANT_VER_MED=`echo $1 | sed 's/\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\)/\2/'`;
43 WANT_VER_MIN=`echo $1 | sed 's/\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\)/\3/'`;
44 changequote([, ])dnl back to normality, there is no regexp afterward
46 if test "$FLEX_VER_MAJ" -lt "$WANT_VER_MAJ" ||
47 test "$FLEX_VER_MAJ" -eq "$WANT_VER_MAJ" -a "$FLEX_VER_MED" -lt "$WANT_VER_MED" ||
48 test "$FLEX_VER_MAJ" -eq "$WANT_VER_MAJ" -a "$FLEX_VER_MED" -eq "$WANT_VER_MED" -a "$FLEX_VER_MIN" -lt "$WANT_VER_MIN" ;
50 AC_MSG_NOTICE([Found flex is too old. Parsers won't get updated (Found v$FLEX_VERSION < v$1)])
51 LEX=${am_missing_run}flex
54 AC_MSG_NOTICE([Flex found. Parsers will get updated])