Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Add a boolean to each node indicating whether it's an internal node or not to allow...
[simgrid.git] / acmacro / flex.m4
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.
3
4 dnl You may want to check for version >= 2.5.31 (the one breaking posix compatibility)
5
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";
9   AC_SUBST(LEXLIB, '')
10 ])
11
12 AC_DEFUN([AC_PROG_FLEX],
13  [
14   AC_PROG_LEX
15   if test "$LEX" != flex; then
16     AC_MSG_NOTICE([Flex not found. Parsers won't get updated.])
17     LEX="$SHELL $missing_dir/missing flex";
18     AC_SUBST(LEXLIB, '')
19   else
20     if test "x$1" != "x" ; then
21       dnl
22       dnl We were asked to check the version number
23       dnl
24       changequote(<<, >>)dnl because of the regexp [blabla]
25       FLEX_VERSION=`flex --version | sed -e 's/^[^0-9]*//' -e 's/[^0-9]*$//'`
26
27       FLEX_VER_MAJ=`echo "$FLEX_VERSION" | sed 's/\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\)/\1/'`
28       FLEX_VER_MED=`echo "$FLEX_VERSION" | sed 's/\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\)/\2/'`
29       FLEX_VER_MIN=`echo "$FLEX_VERSION" | sed 's/\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\)/\3/'`
30
31       WANT_VER_MAJ=`echo $1 | sed 's/\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\)/\1/'`;
32       WANT_VER_MED=`echo $1 | sed 's/\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\)/\2/'`;
33       WANT_VER_MIN=`echo $1 | sed 's/\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\)/\3/'`;
34       changequote([, ])dnl back to normality, there is no regexp afterward
35  
36       if test "$FLEX_VER_MAJ" -lt "$WANT_VER_MAJ" ||
37          test "$FLEX_VER_MAJ" -eq "$WANT_VER_MAJ" -a "$FLEX_VER_MED" -lt "$WANT_VER_MED"  ||
38          test "$FLEX_VER_MAJ" -eq "$WANT_VER_MAJ" -a "$FLEX_VER_MED" -eq "$WANT_VER_MED" -a "$FLEX_VER_MIN" -lt "$WANT_VER_MIN" ;
39       then
40         AC_MSG_NOTICE([Found flex is too old. Parsers won't get updated (Found v$FLEX_VERSION < v$1)])
41         LEX="$SHELL $missing_dir/missing flex";
42         AC_SUBST(LEXLIB, '')
43       fi
44     fi
45   fi
46   AC_MSG_NOTICE([Flex found. Parsers will get updated])
47 ])