2 # Copyright (C) 2001-2012 Free Software Foundation, Inc.
4 # This program is free software; you can redistribute it and/or modify
5 # it under the terms of the GNU General Public License as published by
6 # the Free Software Foundation; either version 2, or (at your option)
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
14 # You should have received a copy of the GNU General Public License
15 # along with this program. If not, see <http://www.gnu.org/licenses/>.
17 # Check that automake yacc support ensures that yacc-generated C
18 # files use correct "#line" directives. Try also with the
19 # `subdir-object' option enabled.
20 # See also sister test `lex-line.test'.
27 cat >> configure.
in << 'END'
28 AC_CONFIG_FILES
([sub
/Makefile
])
37 cat > Makefile.am
<< 'END'
39 bin_PROGRAMS
= foo bar
42 foo_SOURCES
= zardoz.y
43 bar_SOURCES
= dir
/quux.y
44 ## Avoid spurious failures with Solaris make.
45 zardoz.@OBJEXT@
: zardoz.c
46 bar-quux.@OBJEXT@
: bar-quux.c
49 cat > sub
/Makefile.am
<< 'END'
50 AUTOMAKE_OPTIONS
= subdir-objects
51 noinst_PROGRAMS
= foo bar
53 foo_SOURCES
= zardoz.y
54 bar_SOURCES
= dir
/quux.y
55 ## Avoid spurious failures with Solaris make.
56 foo-zardoz.@OBJEXT@
: foo-zardoz.c
57 dir
/quux.@OBJEXT@
: dir
/quux.c
60 cat > zardoz.y
<< 'END'
62 int yylex
() { return 0; }
63 void yyerror
(char
*s
) { return; }
74 cp zardoz.y dir
/quux.y
75 cp zardoz.y sub
/zardoz.y
76 cp zardoz.y sub
/dir
/quux.y
78 c_outputs
='zardoz.c bar-quux.c sub/foo-zardoz.c sub/dir/quux.c'
84 for vpath
in : false
; do
99 $FGREP '.y' $c_outputs
101 # Adjusted "#line" should not contain reference to the builddir.
102 $EGREP '#.*line.*(build|\.\.).*\.y' $c_outputs && Exit
1
103 # Adjusted "#line" should not contain reference to the default
104 # output file names, e.g., `y.tab.c' and `y.tab.h'.
105 $EGREP '#.*line.*y\.tab\.' $c_outputs && Exit
1
106 # Don't be excessively strict in grepping, to avoid spurious failures.
107 grep '#.*line.*zardoz\.y' zardoz.c
108 grep '#.*line.*quux\.y' bar-quux.c
109 grep '#.*line.*zardoz\.y' sub
/foo-zardoz.c
110 grep '#.*line.*quux\.y' sub
/dir
/quux.c