From: Stefano Lattarini Date: Tue, 12 Apr 2011 15:25:42 +0000 (+0200) Subject: Merge branch 'maint' (with edits) X-Git-Tag: ng-0.5a~210 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=531cc8718179f1bb738d5d1baafdcdfd419b0db3;p=thirdparty%2Fautomake.git Merge branch 'maint' (with edits) test defs: define default $distdir (help reducing duplication) * tests/defs ($distdir): New variable, might be used in testcases checking distribution-related features. * tests/pr9.test: Use it. * tests/subdir9.test: Likewise. * tests/lex3.test: Likewise. * tests/lexvpath.test: Likewise. * tests/remake-moved-m4-file.test: Likewise. * tests/remake-renamed-m4-file.test: Likewise. * tests/remake-renamed-m4-macro-and-file.test: Likewise. * tests/yacc-basic.test: Likewise. * tests/yacc-d-basic.test: Likewise. * tests/yacc-d-vpath.test: Likewise. * tests/yacc-dist-nobuild.test: Likewise. * tests/vtexi3.test: Add comment explaining why we redefine $distdir in this test. --- 531cc8718179f1bb738d5d1baafdcdfd419b0db3 diff --cc ChangeLog index 338b56789,8a144af7c..afeac95cd --- a/ChangeLog +++ b/ChangeLog @@@ -1,3 -1,13 +1,22 @@@ + 2011-04-12 Stefano Lattarini + + test defs: define default $distdir (help reducing duplication) - * tests/defs.in ($distdir): New variable, might be used in ++ * tests/defs ($distdir): New variable, might be used in + testcases checking distribution-related features. + * tests/pr9.test: Use it. + * tests/subdir9.test: Likewise. ++ * tests/lex3.test: Likewise. ++ * tests/lexvpath.test: Likewise. ++ * tests/remake-moved-m4-file.test: Likewise. ++ * tests/remake-renamed-m4-file.test: Likewise. ++ * tests/remake-renamed-m4-macro-and-file.test: Likewise. ++ * tests/yacc-basic.test: Likewise. ++ * tests/yacc-d-basic.test: Likewise. ++ * tests/yacc-d-vpath.test: Likewise. ++ * tests/yacc-dist-nobuild.test: Likewise. + * tests/vtexi3.test: Add comment explaining why we redefine + $distdir in this test. + 2011-04-11 Stefano Lattarini depcomp: fix bugs in tests and in the depcomp script diff --cc tests/defs index a36f7180b,cf07a4eeb..f67491aed --- a/tests/defs +++ b/tests/defs @@@ -495,18 -260,20 +495,22 @@@ case " $required " i ;; esac -# We use a trap below for cleanup. This requires us to go through -# hoops to get the right exit status transported through the signal. -# So use `Exit STATUS' instead of `exit STATUS' inside of the tests. -# Turn off errexit here so that we don't trip the bug with OSF1/Tru64 -# sh inside this function. -Exit () -{ - set +e - (exit $1) - exit $1 -} -curdir=`pwd` +## ---------------------------------------------------------------- ## +## Create and set up of the temporary directory used by the test. ## +## Set up of the exit trap for cleanup of said directory. ## +## ---------------------------------------------------------------- ## + ++# This might be used in testcases checking distribution-related features. ++# Test scripts are free to override this if they need to. ++distdir=$me-1.0 ++ +# The subdirectory where the current test script will run and write its +# temporary/data files. This will be created shortly, and will be removed +# by the cleanup trap below if the test passes. If the test doesn't pass, +# this directory will be kept, to facilitate debugging. testSubDir=$me.dir + test ! -d $testSubDir || { find $testSubDir -type d ! -perm -700 -exec chmod u+rwx {} ";" rm -rf $testSubDir diff --cc tests/lex3.test index bc8839990,c4120cfc6..f7028646d --- a/tests/lex3.test +++ b/tests/lex3.test @@@ -26,12 -25,17 +26,10 @@@ required='gcc flex GNUmake CFLAGS= export CFLAGS - distdir=$me-1.0 -cat > configure.in << 'END' -AC_INIT -dnl Prevent automake from looking in .. and ../.. -AC_CONFIG_AUX_DIR(.) -AM_INIT_AUTOMAKE(am_lex_bug, 0.1.1) -- -dnl Checks for programs. +cat >> configure.in << 'END' AC_PROG_CC AM_PROG_LEX -AC_PROG_YACC -AC_OUTPUT(Makefile) +AC_OUTPUT END cat > Makefile.am << 'END' diff --cc tests/lexvpath.test index 876541a83,000000000..300a476db mode 100755,000000..100755 --- a/tests/lexvpath.test +++ b/tests/lexvpath.test @@@ -1,113 -1,0 +1,111 @@@ +#! /bin/sh +# Copyright (C) 2010, 2011 Free Software Foundation, Inc. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +# This test checks that dependent files are updated before including +# in the distribution. `lexer.c' depends on `lexer.l'. The latter is +# updated so that `lexer.c' should be rebuild. Then we are running +# `make' and `make distdir' and check whether the version of `lexer.c' +# to be distributed is up to date. + +# Please keep this in sync with sister test `yaccvapth.test'. + +required='gcc flex' +. ./defs || Exit 1 + - distdir=$me-1.0 - +cat > lexoutroot.in << 'END' +LEX_OUTPUT_ROOT='@LEX_OUTPUT_ROOT@' +END + +cat >> configure.in << 'END' +AC_CONFIG_FILES([lexoutroot]) +AC_PROG_CC +AC_PROG_LEX +AC_OUTPUT +END + +cat > Makefile.am << 'END' +bin_PROGRAMS = foo +foo_SOURCES = lexer.l foo.c +LDADD = $(LEXLIB) +END + +# Original lexer, with a "foobar" comment +cat > lexer.l << 'END' +%% +"END" return EOF; +. +%% +/*foobar*/ +END + +cat > foo.c << 'END' +int main () { return 0; } +END + +$ACLOCAL +$AUTOCONF +$AUTOMAKE -a + +mkdir sub + +# We must run configure early, to find out whay $LEX_OUTPUT_ROOT is. +cd sub +../configure +. ./lexoutroot +test -n "$LEX_OUTPUT_ROOT" # sanity check +cd .. + +flex lexer.l +mv "$LEX_OUTPUT_ROOT".c lexer.c + +cd sub + +# Ensure that lexer.l will be newer than lexer.c. +$sleep + +# New lexer, with `fubar' comment. +cat > ../lexer.l << 'END' +%% +"END" return EOF; +. +%% +/*fubar*/ +END + +$MAKE +$MAKE distdir +$FGREP '/*fubar*/' $distdir/lexer.c + +# +# Now check to make sure that `make dist' will rebuilt the parser. +# + +# Ensure that lexer.l will be newer than lexer.c. +$sleep + +# New lexer, with `maude' comment. +cat > ../lexer.l << 'END' +%% +"END" return EOF; +. +%% +/*maude*/ +END + +$MAKE distdir +$FGREP '/*maude*/' $distdir/lexer.c + +: diff --cc tests/remake-moved-m4-file.test index 55b0bce0b,000000000..4af4fddbb mode 100755,000000..100755 --- a/tests/remake-moved-m4-file.test +++ b/tests/remake-moved-m4-file.test @@@ -1,78 -1,0 +1,76 @@@ +#! /bin/sh +# Copyright (C) 2011 Free Software Foundation, Inc. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +# Test remake rules when m4 files get moved among different "include +# dirs" (i.e. those passed to aclocal with `-I' option). + +. ./defs || Exit 1 + - distdir=$me-1.0 - +cat >> configure.in <<'END' +MY_MACRO +AC_OUTPUT +END + +cat > Makefile.am <<'END' +ACLOCAL_AMFLAGS = -I d1 -I d2 -I d3 +.PHONY: test +test: + test '$(the_answer)' -eq 42 +END + +mkdir d1 d2 d3 + +cat > d1/macros.m4 <<'END' +AC_DEFUN([MY_MACRO], [FOO]) +END + +cat > d1/foo.m4 <<'END' +AC_DEFUN([FOO], [the_answer=42; AC_SUBST([the_answer])]) +END + +$ACLOCAL -I d1 +$AUTOCONF +$AUTOMAKE + +./configure +$MAKE test + +# Move one file. +mv d1/foo.m4 d2/foo.m4 +using_gmake || $MAKE Makefile +$MAKE test +$MAKE distdir +ls -l $distdir $distdir/* +test -f $distdir/d2/foo.m4 +test ! -f $distdir/d1/foo.m4 +test -f $distdir/d1/macros.m4 +test ! -f $distdir/d2/macros.m4 + +# Move both files at once. +mv d1/macros.m4 d3/macros.m4 +mv d2/foo.m4 d3/foo.m4 +using_gmake || $MAKE Makefile +$MAKE test +$MAKE distdir +ls -l $distdir $distdir/* +test -f $distdir/d3/foo.m4 +test -f $distdir/d3/macros.m4 +test ! -f $distdir/d1/foo.m4 +test ! -f $distdir/d2/foo.m4 +test ! -f $distdir/d1/macros.m4 +test ! -f $distdir/d2/macros.m4 + +: diff --cc tests/remake-renamed-m4-file.test index b2ebd7951,000000000..3378fab1d mode 100755,000000..100755 --- a/tests/remake-renamed-m4-file.test +++ b/tests/remake-renamed-m4-file.test @@@ -1,85 -1,0 +1,83 @@@ +#! /bin/sh +# Copyright (C) 2011 Free Software Foundation, Inc. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +# Test remake rules when m4 files get renamed. + +. ./defs || Exit 1 + - distdir=$me-1.0 - +cat >> configure.in <<'END' +MY_MACRO +AC_OUTPUT +END + +cat > Makefile.am <<'END' +ACLOCAL_AMFLAGS = -I m4 +.PHONY: test +test: + test '$(the_answer)' -eq 42 +END + +mkdir m4 + +cat > m4/macros.m4 <<'END' +AC_DEFUN([MY_MACRO], [FOO]) +END + +cat > m4/foo.m4 <<'END' +AC_DEFUN([FOO], [the_answer=42; AC_SUBST([the_answer])]) +END + +$ACLOCAL -I m4 +$AUTOCONF +$AUTOMAKE + +./configure +$MAKE test + +# Rename one file at the time. + +mv m4/foo.m4 m4/bar.m4 +using_gmake || $MAKE Makefile +$MAKE test +$MAKE distdir +ls -l $distdir $distdir/* +test -f $distdir/m4/bar.m4 +test ! -f $distdir/m4/foo.m4 + +mv m4/macros.m4 m4/defs.m4 +using_gmake || $MAKE Makefile +$MAKE test +$MAKE distdir +ls -l $distdir $distdir/* +test -f $distdir/m4/defs.m4 +test ! -f $distdir/m4/macros.m4 + +# Rename both files at once. + +mv m4/bar.m4 m4/quux.m4 +mv m4/defs.m4 acinclude.m4 +using_gmake || $MAKE Makefile +$MAKE test +$MAKE distdir +ls -l $distdir $distdir/* +test -f $distdir/m4/quux.m4 +test -f $distdir/acinclude.m4 +test ! -f $distdir/m4/foo.m4 +test ! -f $distdir/m4/bar.m4 +test ! -f $distdir/m4/macros.m4 +test ! -f $distdir/m4/defs.m4 + +: diff --cc tests/remake-renamed-m4-macro-and-file.test index 370c1cebd,000000000..beedb5844 mode 100755,000000..100755 --- a/tests/remake-renamed-m4-macro-and-file.test +++ b/tests/remake-renamed-m4-macro-and-file.test @@@ -1,88 -1,0 +1,86 @@@ +#! /bin/sh +# Copyright (C) 2011 Free Software Foundation, Inc. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +# Test remake rules when an m4 file gets renamed and *simultaneously* +# an m4 macro in it gets renamed. Kudos to Bruno Haible for thinking +# about this situation. + +. ./defs || Exit 1 + - distdir=$me-1.0 - +cat >> configure.in <<'END' +MY_MACRO +AC_OUTPUT +END + +cat > Makefile.am <<'END' +ACLOCAL_AMFLAGS = -I m4 +.PHONY: test +test: + test '$(the_answer)' -eq 42 +END + +mkdir m4 + +cat > m4/macros.m4 <<'END' +AC_DEFUN([MY_MACRO], [FOO_MACRO]) +END + +cat > m4/foo.m4 <<'END' +AC_DEFUN([FOO_MACRO], [the_answer=42; AC_SUBST([the_answer])]) +END + +$ACLOCAL -I m4 +$AUTOCONF +$AUTOMAKE + +./configure +$MAKE test + +# Rename only one file and one macro. + +$sleep +sed -e 's/FOO_MACRO/BAR_MACRO/' m4/foo.m4 > m4/bar.m4 +rm -f m4/foo.m4 +sed -e 's/FOO_MACRO/BAR_MACRO/' m4/macros.m4 > t +mv -f t m4/macros.m4 +using_gmake || $MAKE Makefile +$MAKE test +$MAKE distdir +ls -l $distdir $distdir/* +test -f $distdir/m4/bar.m4 +test -f $distdir/m4/macros.m4 +test ! -f $distdir/m4/foo.m4 + +# Rename both at once. + +$sleep +sed -e 's/BAR_MACRO/QUUX_MACRO/' \ + m4/bar.m4 > m4/quux.m4 +sed -e 's/BAR_MACRO/QUUX_MACRO/' -e 's/MY_MACRO/A_MACRO/' \ + m4/macros.m4 > m4/defs.m4 +rm -f m4/macros.m4 m4/bar.m4 +sed -e 's/BAR_MACRO/QUUX_MACRO/' -e 's/MY_MACRO/A_MACRO/' configure.in > t +mv -f t configure.in +using_gmake || $MAKE Makefile +$MAKE test +$MAKE distdir +ls -l $distdir $distdir/* +test -f $distdir/m4/quux.m4 +test -f $distdir/m4/defs.m4 +test ! -f $distdir/m4/bar.m4 +test ! -f $distdir/m4/macros.m4 + +: diff --cc tests/vtexi3.test index 83e64821f,4b0f45d79..04fb7d78c --- a/tests/vtexi3.test +++ b/tests/vtexi3.test @@@ -22,6 -22,10 +22,8 @@@ . ./defs || Exit 1 -set -e - + # We are going to override package version in AC_INIT, so we need + # to redefine the name of the distdir as well. distdir=$me-7.45.3a # This should work without tex, texinfo or makeinfo diff --cc tests/yacc-basic.test index 26dc4a902,000000000..351b409fc mode 100755,000000..100755 --- a/tests/yacc-basic.test +++ b/tests/yacc-basic.test @@@ -1,86 -1,0 +1,84 @@@ +#! /bin/sh +# Copyright (C) 2010, 2011 Free Software Foundation, Inc. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +# Basic semantic checks on Yacc support. + +required=yacc +. ./defs || Exit 1 + - distdir=$me-1.0 - +cat >> configure.in << 'END' +AC_PROG_CC +AC_PROG_YACC +AC_OUTPUT +END + +cat > Makefile.am << 'END' +bin_PROGRAMS = foo +foo_SOURCES = parse.y foo.c + +.PHONY: echo-distcom +echo-distcom: + @echo ' ' $(DIST_COMMON) ' ' +END + +cat > parse.y << 'END' +%{ +#include +#include +int yylex () { return (getchar ()); } +void yyerror (char *s) {} +%} +%% +a : 'a' { exit(0); }; +END + +cat > foo.c << 'END' +int main () { yyparse (); return 1; } +END + +$ACLOCAL +$AUTOCONF +$AUTOMAKE -a + +./configure +$MAKE +# The `parse.c' file must be created and not removed (i.e., not treated +# like an "intermediate file" in the GNU make sense). +test -f parse.c + +echo a | ./foo +echo b | ./foo && Exit 1 + +# The generated file `parse.c' must be shipped. +$MAKE echo-distcom +$MAKE -s echo-distcom | grep '[ /]parse.c ' +$MAKE distdir +ls -l $distdir +test -f $distdir/parse.c + +# Sanity check on distribution. +$MAKE distcheck + +# While we are at it, make sure that parse.c is erased by +# maintainer-clean, and not by distclean. +test -f parse.c +$MAKE distclean +test -f parse.c +./configure # we must re-create `Makefile' +$MAKE maintainer-clean +test ! -f parse.c + +: diff --cc tests/yacc-d-basic.test index ae60084f1,000000000..015c44cec mode 100755,000000..100755 --- a/tests/yacc-d-basic.test +++ b/tests/yacc-d-basic.test @@@ -1,156 -1,0 +1,155 @@@ +#! /bin/sh +# Copyright (C) 2011 Free Software Foundation, Inc. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +# Tests on basic Yacc support for when we have -d in YFLAGS, AM_YFLAGS +# or maude_YFLAGS. + +required=yacc +. ./defs || Exit 1 + +tab=' ' - distdir=$me-1.0 + +cat >> configure.in << 'END' +AC_PROG_CC +AC_PROG_YACC +AC_CONFIG_FILES([foo/Makefile bar/Makefile baz/Makefile]) +AC_OUTPUT +END + +cat > Makefile.am <<'END' +SUBDIRS = foo bar baz +END + +mkdir foo bar baz + +cat > foo/Makefile.am <<'END' +bin_PROGRAMS = zardoz +zardoz_SOURCES = parse.y main.c +.PHONY: echo-distcom +echo-distcom: + @echo ' ' $(DIST_COMMON) ' ' +END +cp foo/Makefile.am bar/Makefile.am +cp foo/Makefile.am baz/Makefile.am + +cat > foo/parse.y << 'END' +%{ +#include "parse.h" +int yylex () { return 0; } +void yyerror (char *s) {} +%} +%% +x : 'x' {}; +%% +END +cp foo/parse.y bar/parse.y + +cat > foo/main.c << 'END' +#include "parse.h" +int main () +{ + return yyparse (); +} +END +cp foo/main.c bar/main.c + +# Even the generated header file is renamed when target-specific YFLAGS +# are used. This might not be the best behavior, but it has been in +# place for quite a long time, so just go along with it for now. +sed 's/"parse\.h"/"zardoz-parse.h"/' foo/parse.y > baz/parse.y +sed 's/"parse\.h"/"zardoz-parse.h"/' foo/main.c > baz/main.c + +$ACLOCAL +$AUTOCONF + +$AUTOMAKE -a +$FGREP parse.h foo/Makefile.in bar/Makefile.in baz/Makefile.in && Exit 1 + +cat >> foo/Makefile.am <> bar/Makefile.am <> baz/Makefile.am <. + +# This test checks that dependent files are updated before including +# in the distribution. `parse.c' depends on `parse.y'. The latter is +# updated so that `parse.c' should be rebuilt. Then we are running +# `make' and `make distdir' and check whether the version of `parse.c' +# to be distributed is up to date. + +# Please keep this in sync with sister test `yaccvpath.test'. + +required=yacc +. ./defs || Exit 1 + - distdir=$me-1.0 - +cat >> configure.in << 'END' +AC_PROG_CC +AC_PROG_YACC +AC_OUTPUT +END + +cat > Makefile.am << 'END' +bin_PROGRAMS = foo +foo_SOURCES = parse.y foo.c +AM_YFLAGS = -d +END + +# Original parser, with `foobar' +cat > parse.y << 'END' +%{ +int yylex () {return 0;} +void yyerror (char *s) {} +%} +%token FOOBAR +%% +foobar : 'f' 'o' 'o' 'b' 'a' 'r' {}; +END + +cat > foo.c << 'END' +#include "parse.h" +int main () { return 0; } +END + +$ACLOCAL +$AUTOCONF +$AUTOMAKE -a + +$YACC -d parse.y +mv y.tab.c parse.c +mv y.tab.h parse.h +# Sanity checks. +grep foobar parse.c +grep FOOBAR parse.h + +mkdir sub +cd sub +../configure + +$sleep + +# New parser, with `fubar' +cat > ../parse.y << 'END' +%{ +int yylex () {return 0;} +void yyerror (char *s) {} +%} +%token FUBAR +%% +fubar : 'f' 'u' 'b' 'a' 'r' {}; +END + +$MAKE +$MAKE distdir +$FGREP fubar $distdir/parse.c +$FGREP FUBAR $distdir/parse.h + +# Now check to make sure that `make dist' will rebuild the parser. + +$sleep + +# New parser, with `maude' +cat > ../parse.y << 'END' +%{ +int yylex () {return 0;} +void yyerror (char *s) {} +%} +%token MAUDE +%% +maude : 'm' 'a' 'u' 'd' 'e' {}; +END + +$MAKE distdir +$FGREP maude $distdir/parse.c +$FGREP MAUDE $distdir/parse.h + +: diff --cc tests/yacc-dist-nobuild.test index 85a960dc8,000000000..7961a5f69 mode 100755,000000..100755 --- a/tests/yacc-dist-nobuild.test +++ b/tests/yacc-dist-nobuild.test @@@ -1,87 -1,0 +1,85 @@@ +#! /bin/sh +# Copyright (C) 2011 Free Software Foundation, Inc. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +# Check that distributed Yacc-generated parsers are not uselessly +# remade from an unpacked distributed tarball. + +required=yacc +. ./defs || Exit 1 + - distdir=$me-1.0 - +cat >> configure.in << 'END' +AC_PROG_CC +AC_PROG_YACC +AC_OUTPUT +END + +cat > Makefile.am << 'END' +bin_PROGRAMS = foobar zardoz +foobar_SOURCES = parse.y main.c +zardoz_SOURCES = $(foobar_SOURCES) +zardoz_YFLAGS = -d +END + +cat > parse.y << 'END' +%{ +int yylex () { return 0; } +void yyerror (char *s) {} +%} +%% +foobar : 'f' 'o' 'o' 'b' 'a' 'r' {}; +END + +cat > main.c << 'END' +int main () { return 0; } +END + +$ACLOCAL +$AUTOCONF +$AUTOMAKE -a + +./configure +$MAKE + +$MAKE distdir +chmod -R a-w $distdir + +mkdir bin +cat > bin/yacc <<'END' +#!/bin/sh +echo "$0 invoked, shouldn't happen!" >&2 +exit 1 +END +cp bin/yacc bin/bison +chmod a+x bin/yacc bin/bison +PATH=`pwd`/bin$PATH_SEPARATOR$PATH + +YACC=yacc BISON=bison +export YACC BISON + +mkdir build +cd build +../$distdir/configure +$MAKE + +# Sanity check. +chmod u+w ../$distdir +rm -f ../$distdir/parse.c +chmod a-w ../$distdir +$MAKE >out 2>&1 && { cat out; Exit 1; } +cat out +$FGREP parse.c out + +: