* INSTALL, lib/INSTALL, lib/config-ml.in, lib/config.guess,
[automake/plouj.git] / tests / yacc6.test
blobfe48f29d34eb040033b8a92400c2e477593fa649
1 #! /bin/sh
2 # Copyright (C) 2001, 2002, 2003, 2004, 2006, 2007 Free Software
3 # Foundation, Inc.
5 # This file is part of GNU Automake.
7 # GNU Automake is free software; you can redistribute it and/or modify
8 # it under the terms of the GNU General Public License as published by
9 # the Free Software Foundation; either version 3, or (at your option)
10 # any later version.
12 # GNU Automake is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 # GNU General Public License for more details.
17 # You should have received a copy of the GNU General Public License
18 # along with Automake; see the file COPYING. If not, write to
19 # the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
20 # Boston, MA 02110-1301, USA.
22 # Test to make sure ylwrap put in right location.
23 # Report from Tim Van Holder.
24 # Also make sure depcomp does not needlessly update headers.
25 # Report from Paolo Bonzini.
27 required='gcc bison GNUmake'
28 . ./defs || exit 1
30 set -e
32 cat > configure.in << 'END'
33 AC_INIT([yacc6], [1.0])
34 AC_CONFIG_AUX_DIR([aux1])
35 AM_INIT_AUTOMAKE
36 AC_CONFIG_FILES([Makefile])
37 AC_PROG_CC
38 AM_PROG_CC_C_O
39 AC_PROG_YACC
40 AC_CONFIG_FILES([sub/Makefile])
41 AC_OUTPUT
42 END
44 cat > Makefile.am << 'END'
45 SUBDIRS = sub
47 test-time-unchanged:
48 test `ls -1t sub/main.$(OBJEXT) z | sed 1q` = z
49 test-time-changed:
50 test `ls -1t sub/main.$(OBJEXT) z | sed 1q` = sub/main.$(OBJEXT)
51 END
53 mkdir aux1 sub
55 cat > sub/Makefile.am << 'END'
56 bin_PROGRAMS = foo bar
57 AM_YFLAGS = -d
58 foo_SOURCES = foo.y main.c
59 foo_CPPFLAGS = -DFOO
60 bar_SOURCES = bar.y main.c
61 BUILT_SOURCES = foo.h bar.h
62 END
64 cat > sub/foo.y << 'END'
66 int yylex () {return 0;}
67 void yyerror (char *s) {}
69 %token TOKEN
71 foobar : 'f' 'o' 'o' 'b' 'a' 'r' {};
72 END
74 cp sub/foo.y sub/bar.y
76 cat >sub/main.c <<'EOF'
77 #ifdef FOO
78 # include "foo.h"
79 #else
80 # include "bar.h"
81 #endif
83 int
84 main()
86 return 0;
88 EOF
90 $ACLOCAL
91 $AUTOCONF
92 $AUTOMAKE -a
93 test -f aux1/ylwrap
94 test ! -f ylwrap
95 test ! -f sub/ylwrap
96 $FGREP '(top_srcdir)/aux1/ylwrap' sub/Makefile.in
97 ./configure
98 $MAKE
99 grep '#.*line.*foo.y' sub/foo.c
100 grep '#.*line.*bar.y' sub/bar.c
102 $sleep
103 : > z
104 $sleep
105 touch sub/bar.y
106 $MAKE
107 $MAKE test-time-unchanged
108 $sleep
109 sed s/TOKEN/TEKON/g sub/bar.y >sub/bar.yt
110 mv -f sub/bar.yt sub/bar.y
111 $MAKE
112 $MAKE test-time-changed