Merge branch 'maint'
[automake.git] / t / cond36.sh
bloba65343fedab8125967d75e37205407dd62a83b01
1 #!/bin/sh
2 # Copyright (C) 2004-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)
7 # any later version.
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 rules output for parser defined conditionally.
19 . test-init.sh
21 cat >>configure.ac <<'EOF'
22 AM_CONDITIONAL([CASE_A], [test -z "$case_B"])
23 AC_PROG_CC
24 AM_PROG_LEX
25 AC_PROG_YACC
26 AC_OUTPUT
27 EOF
29 cat > Makefile.am <<'EOF'
30 AM_YFLAGS = -d
32 BUILT_SOURCES = tparse.h
34 if CASE_A
35 bin_PROGRAMS = ta
36 ta_SOURCES = ta.c tparse.h tscan.l tparse.y
37 ta_LDADD = $(LEXLIB)
38 else
39 bin_PROGRAMS = tb
40 tb_SOURCES = tb.c tparse.h tscan.l tparse.y
41 tb_LDADD = $(LEXLIB)
42 tparse.h: tparce.c
43 echo whatever
44 endif
45 EOF
47 $ACLOCAL
49 # Presently Automake doesn't fully support partially overriden rules
50 # and should complain.
51 AUTOMAKE_fails --add-missing
52 grep 'tparse\.h.*already defined' stderr
53 $AUTOMAKE -Wno-error
55 # Still and all, it should generate two rules.
56 $FGREP 'tparse.h' Makefile.in # For debugging.
57 test $($FGREP -c 'tparse.h:' Makefile.in) -eq 2
58 $FGREP '@CASE_A_TRUE@tparse.h:' Makefile.in
59 $FGREP '@CASE_A_FALSE@tparse.h:' Makefile.in