+ [foo.tab.cc foo.tab.hh foo.output stack.hh],
+ [], [AT_CHECK_NO_SUBDIR_PART([foo.tab])])
+
+AT_CHECK_OUTPUT([subdir/foo.yy], [%skeleton "lalr1.cc" %defines %verbose %locations],
+ [-o subdir/foo.cc],
+ [subdir/foo.cc subdir/foo.hh subdir/foo.output subdir/location.hh subdir/stack.hh subdir/position.hh],
+ [], [AT_CHECK_NO_SUBDIR_PART([subdir/foo])])
+
+AT_CHECK_OUTPUT([gram_dir/foo.yy],
+ [%skeleton "lalr1.cc" %defines %verbose %file-prefix "output_dir/foo"],
+ [],
+ [output_dir/foo.tab.cc output_dir/foo.tab.hh output_dir/foo.output output_dir/stack.hh])
+
+AT_CHECK_OUTPUT([gram_dir/foo.yy],
+ [%skeleton "lalr1.cc" %defines %locations %verbose %file-prefix "output_dir/foo"],
+ [],
+ [output_dir/foo.tab.cc output_dir/foo.tab.hh output_dir/foo.output output_dir/location.hh output_dir/stack.hh output_dir/position.hh])
+
+
+# AT_CHECK_CONFLICTING_OUTPUT(INPUT-FILE, DIRECTIVES, FLAGS, STDERR,
+# [EXIT-STATUS])
+# ------------------------------------------------------------------
+m4_define([AT_CHECK_CONFLICTING_OUTPUT],
+[AT_SETUP([Conflicting output files: $2 $3])
+case "$1" in
+ */*) mkdir `echo "$1" | sed 's,/.*,,'`;;
+esac
+AT_DATA([$1],
+[[$2
+%%
+foo: {};
+]])
+
+[cp ]$1[ expout]
+# Because an output file name conflict is still a warning, Bison exits
+# with status 0, so AT_BISON_CHECK does not realize that there may be no
+# output file against which to check the XML. AT_BISON_CHECK_NO_XML
+# avoids that problem.
+AT_BISON_CHECK_NO_XML([$3 $1], $5, [], [$4])
+AT_CHECK([[cat $1]], [[0]], [expout])
+AT_CLEANUP
+])
+
+AT_CHECK_CONFLICTING_OUTPUT([foo.y],
+[], [--graph="foo.tab.c"],
+[[foo.y: warning: conflicting outputs to file 'foo.tab.c' [-Wother]
+]])
+
+AT_CHECK_CONFLICTING_OUTPUT([foo.y],
+[%defines "foo.output"], [-v],
+[[foo.y: warning: conflicting outputs to file 'foo.output' [-Wother]
+]])
+
+AT_CHECK_CONFLICTING_OUTPUT([foo.y],
+[%skeleton "lalr1.cc" %defines %locations], [--graph="location.hh"],
+[[foo.y: warning: conflicting outputs to file 'location.hh' [-Wother]
+]])
+
+AT_CHECK_CONFLICTING_OUTPUT([foo.y], [], [-o foo.y],
+[[foo.y: refusing to overwrite the input file 'foo.y'
+]], 1)
+
+
+# AT_CHECK_OUTPUT_FILE_NAME(FILE-NAME-PREFIX, [ADDITIONAL-TESTS])
+# ---------------------------------------------------------------
+m4_define([AT_CHECK_OUTPUT_FILE_NAME],
+[AT_SETUP([Output file name: $1])
+
+AT_BISON_OPTION_PUSHDEFS
+# Skip if platform doesn't support file name. For example, Cygwin
+# doesn't support file names containing ":" or "\".
+AT_CHECK([[touch "]AS_ESCAPE([$1[.tmp]])[" || exit 77]])
+
+AT_DATA_GRAMMAR([glr.y],
+[[%glr-parser
+%code {
+]AT_YYERROR_DECLARE_EXTERN[
+]AT_YYLEX_DECLARE_EXTERN[
+}
+%%
+start: {};
+]])
+AT_BISON_CHECK([-o "AS_ESCAPE([$1.c])" --defines="AS_ESCAPE([$1.h])" glr.y])
+AT_CHECK([ls "AS_ESCAPE([$1.c])" "AS_ESCAPE([$1.h])"], [], [ignore])
+AT_COMPILE([glr.o], [-c "AS_ESCAPE([$1.c])"])
+$2
+
+AT_DATA_GRAMMAR([cxx.y],
+[[%skeleton "lalr1.cc"
+%code { int yylex (yy::parser::semantic_type*); }
+%%
+start: {};
+]])
+AT_BISON_CHECK([-o "AS_ESCAPE([$1.c])" --defines="AS_ESCAPE([$1.h])" cxx.y])
+AT_CHECK([ls "AS_ESCAPE([$1.c])" "AS_ESCAPE([$1.h])"], [], [ignore])
+AT_COMPILE_CXX([cxx.o], [-c "AS_ESCAPE([$1.c])"])
+$2
+
+AT_BISON_OPTION_POPDEFS
+AT_CLEANUP
+])