gst-parser.m4: Fix flex version check for OSX 10.8
[platform/upstream/gst-common.git] / m4 / gst-parser.m4
index 89763f5..710da89 100644 (file)
@@ -8,18 +8,17 @@ AC_DEFUN([AG_GST_BISON_CHECK],
   fi
 
   dnl check bison version
-  bison_min_version=1.35
-  bison_version=`$BISON_PATH --version | head -n 1 | sed 's/^.*) //' | sed 's/[[a-zA-Z]]*$//' | cut -d' ' -f1`
+  dnl we need version >= 1.875 for the reentrancy support
+  dnl in the parser.
+  dnl First lines observed: 'bison (GNU Bison) 2.3' or 'GNU Bison version 1.28'
+  bison_min_version=1.875
+  bison_version=`$BISON_PATH --version | head -n 1 |  sed 's/^[[^0-9]]*//' | sed 's/[[^0-9]]*$//' | cut -d' ' -f1`
   AC_MSG_CHECKING([bison version $bison_version >= $bison_min_version])
 
-  if perl -w <<EOF
-    exit ($bison_version < $bison_min_version) ? 0 : 1;
-EOF 
-  then 
+  if perl -we "exit ((v$bison_version ge v$bison_min_version) ? 0 : 1)"; then
     AC_MSG_RESULT([yes])
-  else 
-    AC_MSG_RESULT([no])
-    AC_MSG_ERROR([Your bison version is too old, $bison_min_version or later is required.])
+  else
+    AC_MSG_ERROR([no])
   fi
 ])
 
@@ -30,13 +29,12 @@ AC_DEFUN([AG_GST_FLEX_CHECK],
   if test x$FLEX_PATH = xno; then
     AC_MSG_ERROR(Could not find flex)
   fi
-  
+
   dnl check flex version
-  dnl FIXME 0.11: we need version >= 2.5.31 for the reentrancy support
-  dnl in the parser. If an older version is installed pre-generated
-  dnl sources are used. This should become a hard dependency for 0.11!
+  dnl we need version >= 2.5.31 for the reentrancy support
+  dnl in the parser.
   flex_min_version=2.5.31
-  flex_version=`$FLEX_PATH --version | head -n 1 | sed 's/^.* //' | sed 's/[[a-zA-Z]]*$//' | cut -d' ' -f1`
+  flex_version=`$FLEX_PATH --version | head -n 1 | awk '{print $2}'`
   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+)/;
@@ -51,9 +49,7 @@ AC_DEFUN([AG_GST_FLEX_CHECK],
 EOF
   then
     AC_MSG_RESULT(yes)
-    AM_CONDITIONAL(GENERATE_PARSER, true)
   else
-    AC_MSG_RESULT(no, using pre-generated parser sources)
-    AM_CONDITIONAL(GENERATE_PARSER, false)
+    AC_MSG_ERROR([no])
   fi
 ])