Initial release
[adaptation/ap_samsung/gst-plugins-s5pc2xx.git] / common / m4 / gst-parser.m4
1 AC_DEFUN([AG_GST_BISON_CHECK],
2 [
3   dnl FIXME: check if AC_PROG_YACC is suitable here
4   dnl FIXME: make precious
5   AC_PATH_PROG(BISON_PATH, bison, no)
6   if test x$BISON_PATH = xno; then
7     AC_MSG_ERROR(Could not find bison)
8   fi
9
10   dnl check bison version
11   dnl FIXME 0.11: we need version >= 1.875 for the reentrancy support
12   dnl in the parser. If an older version is installed pre-generated
13   dnl sources are used. This should become a hard dependency for 0.11!
14   bison_min_version=1.875
15   bison_version=`$BISON_PATH --version | head -n 1 | sed 's/^.*) //' | sed 's/[[a-zA-Z]]*$//' | cut -d' ' -f1`
16   AC_MSG_CHECKING([bison version $bison_version >= $bison_min_version])
17
18   if perl -w <<EOF
19     exit ($bison_version < $bison_min_version) ? 0 : 1;
20 EOF 
21   then 
22     AC_MSG_RESULT([yes])
23     AM_CONDITIONAL(GENERATE_PARSER, test -z $GENERATE_PARSER_TRUE)
24   else 
25     AC_MSG_RESULT([no, using pre-generated parser sources])
26     AM_CONDITIONAL(GENERATE_PARSER, false)
27   fi
28 ])
29
30 AC_DEFUN([AG_GST_FLEX_CHECK],
31 [
32   dnl we require flex for building the parser
33   AC_PATH_PROG(FLEX_PATH, flex, no)
34   if test x$FLEX_PATH = xno; then
35     AC_MSG_ERROR(Could not find flex)
36   fi
37   
38   dnl check flex version
39   dnl FIXME 0.11: we need version >= 2.5.31 for the reentrancy support
40   dnl in the parser. If an older version is installed pre-generated
41   dnl sources are used. This should become a hard dependency for 0.11!
42   flex_min_version=2.5.31
43   flex_version=`$FLEX_PATH --version | head -n 1 | sed 's/^.* //' | sed 's/[[a-zA-Z]]*$//' | cut -d' ' -f1`
44   AC_MSG_CHECKING([flex version $flex_version >= $flex_min_version])
45   if perl -w <<EOF
46     (\$min_version_major, \$min_version_minor, \$min_version_micro ) = "$flex_min_version" =~ /(\d+)\.(\d+)\.(\d+)/;
47     (\$flex_version_major, \$flex_version_minor, \$flex_version_micro ) = "$flex_version" =~ /(\d+)\.(\d+)\.(\d+)/;
48     exit (((\$flex_version_major > \$min_version_major) ||
49      ((\$flex_version_major == \$min_version_major) &&
50       (\$flex_version_minor > \$min_version_minor)) ||
51      ((\$flex_version_major == \$min_version_major) &&
52       (\$flex_version_minor == \$min_version_minor) &&
53       (\$flex_version_micro >= \$min_version_micro)))
54      ? 0 : 1);
55 EOF
56   then
57     AC_MSG_RESULT(yes)
58     AM_CONDITIONAL(GENERATE_PARSER, test -z $GENERATE_PARSER_TRUE)
59   else
60     AC_MSG_RESULT([no, using pre-generated parser sources])
61     AM_CONDITIONAL(GENERATE_PARSER, false)
62   fi
63 ])