Merge branch 'maint' (with edits)
authorStefano Lattarini <stefano.lattarini@gmail.com>
Tue, 12 Apr 2011 15:25:42 +0000 (17:25 +0200)
committerStefano Lattarini <stefano.lattarini@gmail.com>
Tue, 12 Apr 2011 15:26:29 +0000 (17:26 +0200)
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.

14 files changed:
1  2 
ChangeLog
tests/defs
tests/lex3.test
tests/lexvpath.test
tests/pr9.test
tests/remake-moved-m4-file.test
tests/remake-renamed-m4-file.test
tests/remake-renamed-m4-macro-and-file.test
tests/subdir9.test
tests/vtexi3.test
tests/yacc-basic.test
tests/yacc-d-basic.test
tests/yacc-d-vpath.test
tests/yacc-dist-nobuild.test

diff --cc ChangeLog
+++ b/ChangeLog
@@@ -1,3 -1,13 +1,22 @@@
 -      * tests/defs.in ($distdir): New variable, might be used in
+ 2011-04-12  Stefano Lattarini  <stefano.lattarini@gmail.com>
+       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.
  2011-04-11  Stefano Lattarini  <stefano.lattarini@gmail.com>
  
        depcomp: fix bugs in tests and in the depcomp script
diff --cc 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
@@@ -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'
index 876541a,0000000..300a476
mode 100755,000000..100755
--- /dev/null
@@@ -1,113 -1,0 +1,111 @@@
- distdir=$me-1.0
 +#! /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 <http://www.gnu.org/licenses/>.
 +
 +# 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
 +
 +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/pr9.test
Simple merge
index 55b0bce,0000000..4af4fdd
mode 100755,000000..100755
--- /dev/null
@@@ -1,78 -1,0 +1,76 @@@
- distdir=$me-1.0
 +#! /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 <http://www.gnu.org/licenses/>.
 +
 +# Test remake rules when m4 files get moved among different "include
 +# dirs" (i.e. those passed to aclocal with `-I' option).
 +
 +. ./defs || Exit 1
 +
 +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
 +
 +:
index b2ebd79,0000000..3378fab
mode 100755,000000..100755
--- /dev/null
@@@ -1,85 -1,0 +1,83 @@@
- distdir=$me-1.0
 +#! /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 <http://www.gnu.org/licenses/>.
 +
 +# Test remake rules when m4 files get renamed.
 +
 +. ./defs || Exit 1
 +
 +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
 +
 +:
index 370c1ce,0000000..beedb58
mode 100755,000000..100755
--- /dev/null
@@@ -1,88 -1,0 +1,86 @@@
- distdir=$me-1.0
 +#! /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 <http://www.gnu.org/licenses/>.
 +
 +# 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
 +
 +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
 +
 +:
Simple merge
  
  . ./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
index 26dc4a9,0000000..351b409
mode 100755,000000..100755
--- /dev/null
@@@ -1,86 -1,0 +1,84 @@@
- distdir=$me-1.0
 +#! /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 <http://www.gnu.org/licenses/>.
 +
 +# Basic semantic checks on Yacc support.
 +
 +required=yacc
 +. ./defs || Exit 1
 +
 +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 <stdio.h>
 +#include <stdlib.h>
 +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
 +
 +:
index ae60084,0000000..015c44c
mode 100755,000000..100755
--- /dev/null
@@@ -1,156 -1,0 +1,155 @@@
- distdir=$me-1.0
 +#! /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 <http://www.gnu.org/licenses/>.
 +
 +# Tests on basic Yacc support for when we have -d in YFLAGS, AM_YFLAGS
 +# or maude_YFLAGS.
 +
 +required=yacc
 +. ./defs || Exit 1
 +
 +tab=' '
 +
 +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 <<END
 +BUILT_SOURCES = parse.h
 +YFLAGS=\
 +-d
 +END
 +$AUTOMAKE -Wno-gnu foo/Makefile
 +
 +sed 's/EOL$//' >> bar/Makefile.am <<END
 +AM_YFLAGS${tab}=  -d EOL
 +BUILT_SOURCES = parse.h
 +END
 +$AUTOMAKE bar/Makefile
 +
 +cat >> baz/Makefile.am <<END
 +BUILT_SOURCES = zardoz-parse.h
 +zardoz_YFLAGS =-d${tab}
 +END
 +$AUTOMAKE baz/Makefile
 +
 +./configure
 +
 +$MAKE
 +
 +test -f foo/parse.c
 +test -f foo/parse.h
 +test -f bar/parse.c
 +test -f bar/parse.h
 +test -f baz/zardoz-parse.c
 +test -f baz/zardoz-parse.h
 +
 +# The generated C and header files must be shipped.
 +for dir in foo bar; do
 +  cd $dir
 +  $MAKE echo-distcom
 +  $MAKE -s echo-distcom | grep '[ /]parse.c '
 +  $MAKE -s echo-distcom | grep '[ /]parse.h '
 +  cd ..
 +done
 +cd baz
 +$MAKE echo-distcom
 +$MAKE -s echo-distcom | grep '[ /]zardoz-parse.c '
 +$MAKE -s echo-distcom | grep '[ /]zardoz-parse.h '
 +cd ..
 +
 +$MAKE distdir
 +ls -l $distdir
 +test -f $distdir/foo/parse.c
 +test -f $distdir/foo/parse.h
 +test -f $distdir/bar/parse.c
 +test -f $distdir/bar/parse.h
 +test -f $distdir/baz/zardoz-parse.c
 +test -f $distdir/baz/zardoz-parse.h
 +
 +# Sanity check the distribution.
 +$MAKE distcheck
 +
 +# While we are at it, make sure that `parse.c' and `parse.h' are erased
 +# by maintainer-clean, and not by distclean.
 +$MAKE distclean
 +test -f foo/parse.c
 +test -f foo/parse.h
 +test -f bar/parse.c
 +test -f bar/parse.h
 +test -f baz/zardoz-parse.c
 +test -f baz/zardoz-parse.h
 +./configure # We must re-create `Makefile'.
 +$MAKE maintainer-clean
 +test ! -f foo/parse.c
 +test ! -f foo/parse.h
 +test ! -f bar/parse.c
 +test ! -f bar/parse.h
 +test ! -f baz/zardoz-parse.c
 +test ! -f baz/zardoz-parse.h
 +
 +:
index b331bf5,0000000..401998e
mode 100755,000000..100755
--- /dev/null
@@@ -1,110 -1,0 +1,108 @@@
- distdir=$me-1.0
 +#! /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 <http://www.gnu.org/licenses/>.
 +
 +# 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
 +
 +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
 +
 +:
index 85a960d,0000000..7961a5f
mode 100755,000000..100755
--- /dev/null
@@@ -1,87 -1,0 +1,85 @@@
- distdir=$me-1.0
 +#! /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 <http://www.gnu.org/licenses/>.
 +
 +# Check that distributed Yacc-generated parsers are not uselessly
 +# remade from an unpacked distributed tarball.
 +
 +required=yacc
 +. ./defs || Exit 1
 +
 +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
 +
 +: