diff m4/acinclude.m4 @ 16174:39096b290a2f

check syntax used to enable bison push/pull parser * acinclude.m4 (OCTAVE_PROG_BISON): Check for syntax used to enable push/pull parser. * common.mk (BISON_PUSH_PULL_DECL_STYLE): New variable. * libinterp/Makefile.am (BUILT_DISTFILES): Include oct-parse.yy in the list. (EXTRA_DIST): Include oct-pase.in.yy in the list. (ULT_DIST_SRC): New variable. (SRC_DEF_FILES, TST_FILES_SRC): Use $(ULT_DIST_SRC) instead of $(DIST_SRC). * find-defun-files.sh: Transform .in.yy instead of .yy. * libinterp/parse-tree/module.mk (parse-tree/oct-parse.yy): New target and rule to substitute push-pull decl. * oct-parse.in.yy: Rename from oct-parse.yy Substitute %PUSH_PULL_DECL%.
author John W. Eaton <jwe@octave.org>
date Sat, 02 Mar 2013 12:26:42 -0500
parents b309a5da17f5
children 7ce484126bb2
line wrap: on
line diff
--- a/m4/acinclude.m4	Sat Mar 02 07:59:25 2013 -0800
+++ b/m4/acinclude.m4	Sat Mar 02 12:26:42 2013 -0500
@@ -1405,6 +1405,62 @@
   AC_PROG_YACC
   case "$YACC" in
     bison*)
+    AC_CACHE_CHECK([syntax of bison push/pull declaration],
+                   [octave_cv_bison_push_pull_decl_style], [
+      style="dash underscore"
+      quote="noquote quote"
+      for s in $style; do
+        for q in $quote; do
+          if test $s = "dash"; then
+            def="%define api.push-pull"
+          else
+            def="%define api.push_pull"
+          fi
+          if test $q = "quote"; then
+            def="$def \"both\""
+          else
+            def="$def both"
+          fi
+          cat << EOF > conftest.yy
+$def
+%start input
+%%
+input:;
+%%
+EOF
+          $YACC conftest.yy > /dev/null 2>&1
+          ac_status=$?
+          if test $ac_status -eq 0; then
+            if test $q = noquote; then
+              q=
+            fi
+            octave_cv_bison_push_pull_decl_style="$s $q"
+            break
+          fi
+        done
+        if test $ac_status -eq 0; then
+          break
+        fi
+      done
+      rm -f conftest.yy y.tab.h
+      ])
+    ;;
+  esac
+
+  AC_SUBST(BISON_PUSH_PULL_DECL_STYLE, $octave_cv_bison_push_pull_decl_style)
+
+  if test -z "$octave_cv_bison_push_pull_decl_style"; then
+    YACC=
+    warn_bison_push_pull_decl_style="
+
+I wasn't able to find a suitable style for declaring a push-pull
+parser in a bison input file so I'm disabling bison.
+"
+    OCTAVE_CONFIGURE_WARNING([warn_bison_push_pull_decl_style])
+  fi
+
+  case "$YACC" in
+    bison*)
     ;;
     *)
       YACC='$(top_srcdir)/build-aux/missing bison'