diff m4/acinclude.m4 @ 18974:d8abf813c69f stable

handle changes in bison 3.x * acinclude.m4 (OCTAVE_PROG_BISON): Also check for the proper way to declare api.prefix. * build-aux/common.mk (BISON_API_PREFIX_DECL_STYLE): New variable. * lex.ll: Conditionally define YYSTYPE. * oct-parse.in.yy (%API_PREFIX_DECL%): Allow for differences in the way api.prefix is specified in different versions of bison. * libinterp/parse-tree/module.mk (parse-tree/oct-parse.yy): Also substitute %API_PREFIX_DECL% in lex.ll.
author John W. Eaton <jwe@octave.org>
date Fri, 01 Aug 2014 08:09:02 -0400
parents 625e3bb65885
children c59745865c7f 6b4dfb1e5afb
line wrap: on
line diff
--- a/m4/acinclude.m4	Tue Jul 01 15:56:00 2014 -0400
+++ b/m4/acinclude.m4	Fri Aug 01 08:09:02 2014 -0400
@@ -1762,6 +1762,49 @@
   esac
 
   if test $tmp_have_bison = yes; then
+    AC_CACHE_CHECK([syntax of bison api.prefix (or name-prefix) declaration],
+                   [octave_cv_bison_api_prefix_decl_style], [
+      style="api name"
+      for s in $style; do
+        if test $s = "api"; then
+          def='%define api.prefix "foo_"'
+        else
+          def='%name-prefix="foo_"'
+        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
+          octave_cv_bison_api_prefix_decl_style="$s"
+          break
+        fi
+        if test $ac_status -eq 0; then
+          break
+        fi
+      done
+      rm -f conftest.yy y.tab.h y.tab.c
+      ])
+  fi
+
+  AC_SUBST(BISON_API_PREFIX_DECL_STYLE, $octave_cv_bison_api_prefix_decl_style)
+
+  if test -z "$octave_cv_bison_api_prefix_decl_style"; then
+    YACC=
+    warn_bison_api_prefix_decl_style="
+
+I wasn't able to find a suitable style for declaring the api prefix
+in a bison input file so I'm disabling bison.
+"
+    OCTAVE_CONFIGURE_WARNING([warn_bison_api_prefix_decl_style])
+  fi
+
+  if test $tmp_have_bison = yes; then
     AC_CACHE_CHECK([syntax of bison push/pull declaration],
                    [octave_cv_bison_push_pull_decl_style], [
       style="dash underscore"