Merge branch 'maint'
[platform/upstream/automake.git] / t / ac-output-old.tap
1 #!/bin/sh
2 # Copyright (C) 1996-2012 Free Software Foundation, Inc.
3 #
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.
8 #
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.
13 #
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/>.
16
17 # Test for various older bugs related to quoting, escaping and
18 # line breaking in the use of AC_OUTPUT.  Synthesised by a bunch
19 # of older tests (referenced below).
20
21 . ./defs || exit 1
22
23 plan_ 22
24
25 rm -f configure.ac depcomp # Not required.
26
27 # -----------------------------------------------------------------------
28
29 # Test for bug reported by François Pinard.
30 # If \ is in AC_OUTPUT, automake barfs.
31 # This was the old test 'acoutbs.test'.
32
33 # Also test for bug reported by David A. Swierczek.
34 # Another bug with \ in AC_OUTPUT (this time with whitespace).
35 # This was the old test 'acoutbs2.test'.
36
37 acoutbs_check ()
38 {
39   dir=acoutbs$1
40   mkdir $dir
41   cd $dir
42   cat > configure.ac
43   touch Makefile.am zot.in
44   command_ok_ "aclocal groks '\\' in AC_OUTPUT ($dir)" $ACLOCAL
45   command_ok_ "automake groks '\\' in AC_OUTPUT ($dir)" $AUTOMAKE
46   command_ok_ "autoconf groks '\\' in AC_OUTPUT ($dir)" $AUTOCONF
47   command_ok_ "can ./configure in $dir" ./configure
48   command_ok_ "zot created in $dir" test -f zot
49   ls -a > lst || bailout_ "cannot get file listing in $dir"
50   command_ok_ "'\\' not leaked in filenames in $dir" not grep '\\' lst
51   cd ..
52 }
53
54 acoutbs_check 1 << 'END'
55 AC_INIT([acoutbs1], [1.0])
56 AM_INIT_AUTOMAKE
57 AC_OUTPUT(Makefile \
58 zot)
59 END
60
61 acoutbs_check 2 << 'END'
62 AC_INIT([acoutbs2], [1.0])
63 AM_INIT_AUTOMAKE
64 AC_OUTPUT(\
65    Makefile \
66    zot
67 )
68 END
69
70 # -----------------------------------------------------------------------
71
72 # Test for bug reported by Jerome Santini.
73 # If I put this line in my configure.ac:
74 #  AC_OUTPUT(Makefile src/Makefile tests/Makefile, echo timestamp > stamp-h)dnl
75 # automake is not happy:
76 #  [ ... ]
77 # This was the old test 'acoutnoq.test'.
78
79 mkdir acoutnoq
80 cd acoutnoq
81
82 cat > configure.ac << 'END'
83 AC_INIT([acoutnoq], [1.0])
84 AM_INIT_AUTOMAKE
85 AC_OUTPUT(Makefile, [true])
86 END
87
88 : > Makefile.am
89
90 command_ok_ "aclocal and quoted AC_OUTPUT second argument" $ACLOCAL
91 command_ok_ "automake and quoted AC_OUTPUT second argument" $AUTOMAKE
92
93 cd ..
94
95 # -----------------------------------------------------------------------
96
97 # Test for bug when AC_OUTPUT has 2 args on the same line, eg:
98 #   AC_OUTPUT([Makefile automake tests/Makefile],[chmod +x automake])
99 # This was the old test 'acoutpt.test'.
100
101 mkdir acoutpt
102 cd acoutpt
103
104 cat > configure.ac << 'END'
105 AC_INIT([acoutpt], [1.0])
106 AM_INIT_AUTOMAKE
107 AC_OUTPUT([Makefile], [true])
108 END
109
110 : > Makefile.am
111
112 command_ok_ "aclocal and two AC_OUTPUT arguments on same line" $ACLOCAL
113 command_ok_ "automake and two AC_OUTPUT arguments on same line" $AUTOMAKE
114
115 cd ..
116
117 # -----------------------------------------------------------------------
118
119 # Test for bug reported by Eric Magnien.
120 # This was the old test 'acoutpt2.test'.
121
122 mkdir acoutpt2
123 cd acoutpt2
124
125 # Name of the current "subtest".
126 cur=acoutput2
127
128 cat > configure.ac <<END
129 AC_INIT([$cur], [1.0])
130 AM_INIT_AUTOMAKE
131 AC_OUTPUT([subdir/Makefile subdir/foo Makefile foo], [true])
132 END
133
134 mkdir subdir
135
136 : > Makefile.am
137 : > subdir/Makefile.am
138 : > foo.in
139 : > subdir/foo.in
140
141 command_ok_ "aclocal and AC_OUTPUT ($cur)" $ACLOCAL
142 command_ok_ "automake and AC_OUTPUT ($cur)" $AUTOMAKE
143 command_ok_ "foo.in mentioned two times in Makefile.in ($cur)" \
144              test $($FGREP -c 'foo.in' Makefile.in) -eq 2
145
146 # This ought to work as well.
147 command_ok_ "'automake -a -f' and AC_OUTPUT ($cur)" \
148             $AUTOMAKE --add-missing --force-missing
149
150 cd ..
151
152 # -----------------------------------------------------------------------
153
154 # Test for bug reported by François Pinard.
155 # This was the old test 'acoutqnl.test'.
156
157 mkdir acoutqnl
158 cd acoutqnl
159
160 cat > configure.ac << 'END'
161 AC_INIT([acoutqnl], [1.0])
162 AM_INIT_AUTOMAKE
163 AC_OUTPUT([Makefile],
164 [echo zardoz has spoken])
165 END
166
167 : > Makefile.am
168
169 command_ok_ "aclocal and two AC_OUTPUT arguments on two lines" $ACLOCAL
170 command_ok_ "automake and two AC_OUTPUT arguments on two lines" $AUTOMAKE
171
172 cd ..
173
174 # -----------------------------------------------------------------------
175
176 # And we're done.
177 exit 0