gst-parser.m4 1.91 KB
Newer Older
Thomas Vander Stichele's avatar
Thomas Vander Stichele committed
1
AC_DEFUN([AG_GST_BISON_CHECK],
2 3 4 5 6 7 8 9 10
[
  dnl FIXME: check if AC_PROG_YACC is suitable here
  dnl FIXME: make precious
  AC_PATH_PROG(BISON_PATH, bison, no)
  if test x$BISON_PATH = xno; then
    AC_MSG_ERROR(Could not find bison)
  fi

  dnl check bison version
11 12
  dnl we need version >= 1.875 for the reentrancy support
  dnl in the parser.
13
  dnl First lines observed: 'bison (GNU Bison) 2.3' or 'GNU Bison version 1.28'
14
  bison_min_version=1.875
15
  bison_version=`$BISON_PATH --version | head -n 1 |  sed 's/^[[^0-9]]*//' | sed 's/[[^0-9]]*$//' | cut -d' ' -f1`
16 17 18 19 20 21 22 23
  AC_MSG_CHECKING([bison version $bison_version >= $bison_min_version])

  if perl -w <<EOF
    exit ($bison_version < $bison_min_version) ? 0 : 1;
EOF 
  then 
    AC_MSG_RESULT([yes])
  else 
24
    AC_MSG_ERROR([no])
25 26 27
  fi
])

Thomas Vander Stichele's avatar
Thomas Vander Stichele committed
28
AC_DEFUN([AG_GST_FLEX_CHECK],
29 30 31 32 33 34 35 36
[
  dnl we require flex for building the parser
  AC_PATH_PROG(FLEX_PATH, flex, no)
  if test x$FLEX_PATH = xno; then
    AC_MSG_ERROR(Could not find flex)
  fi
  
  dnl check flex version
37 38
  dnl we need version >= 2.5.31 for the reentrancy support
  dnl in the parser. 
Sebastian Dröge's avatar
Sebastian Dröge committed
39
  flex_min_version=2.5.31
40
  flex_version=`$FLEX_PATH --version | head -n 1 | sed 's/^.* //' | sed 's/[[a-zA-Z]]*$//' | cut -d' ' -f1`
41 42 43 44 45 46
  AC_MSG_CHECKING([flex version $flex_version >= $flex_min_version])
  if perl -w <<EOF
    (\$min_version_major, \$min_version_minor, \$min_version_micro ) = "$flex_min_version" =~ /(\d+)\.(\d+)\.(\d+)/;
    (\$flex_version_major, \$flex_version_minor, \$flex_version_micro ) = "$flex_version" =~ /(\d+)\.(\d+)\.(\d+)/;
    exit (((\$flex_version_major > \$min_version_major) ||
     ((\$flex_version_major == \$min_version_major) &&
47
      (\$flex_version_minor > \$min_version_minor)) ||
48
     ((\$flex_version_major == \$min_version_major) &&
49
      (\$flex_version_minor == \$min_version_minor) &&
50 51 52 53 54 55
      (\$flex_version_micro >= \$min_version_micro)))
     ? 0 : 1);
EOF
  then
    AC_MSG_RESULT(yes)
  else
56
    AC_MSG_ERROR([no])
57 58
  fi
])