doc: typos in test file.
[automake.git] / t / txinfo-many-output-formats.sh
blob2e830c5f25dc601c455d49fa86ef4357b7e3e362
1 #! /bin/sh
2 # Copyright (C) 2003-2024 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 <https://www.gnu.org/licenses/>.
17 # Test support for building HTML documentation, and the many
18 # install-DOC flavors.
19 # Keep in sync with sister test 'txinfo-many-output-formats-vpath.sh'.
20 # FIXME: in the long term, the best thing to do is probably to convert
21 # FIXME: this test and that sister test to TAP, and merge them.
23 required='makeinfo tex texi2dvi'
24 . test-init.sh
26 cat >>configure.ac <<\EOF
27 AC_CONFIG_FILES([rec/Makefile])
29 # At the time of writing, Autoconf does not supplies any of these
30 # definitions (and those below are purposely not those of the standard).
31 AC_SUBST([dvidir], ['${datadir}/${PACKAGE}/dvi'])
32 AC_SUBST([htmldir], ['${datadir}/${PACKAGE}/html'])
33 AC_SUBST([pdfdir], ['${datadir}/${PACKAGE}/pdf'])
34 AC_SUBST([psdir], ['${datadir}/${PACKAGE}/ps'])
36 AC_OUTPUT
37 EOF
39 cat > Makefile.am << 'END'
40 SUBDIRS = rec
41 info_TEXINFOS = main.texi sub/main2.texi
42 END
44 cat > main.texi << 'END'
45 \input texinfo
46 @setfilename main.info
47 @settitle main
48 @node Top
49 Hello walls.
50 @bye
51 END
53 mkdir sub
54 cat > sub/main2.texi << 'END'
55 \input texinfo
56 @setfilename main2.info
57 @settitle main2
58 @node Top
59 Hello walls.
60 @bye
61 END
63 mkdir rec
64 cat > rec/main3.texi << 'END'
65 \input texinfo
66 @setfilename main3.info
67 @settitle main3
68 @node Top
69 Hello walls.
70 @bye
71 END
73 cat > rec/Makefile.am << 'END'
74 info_TEXINFOS = main3.texi
76 install-pdf-local:
77 @$(MKDIR_P) "$(pdfdir)"
78 : > "$(pdfdir)/hello"
79 uninstall-local:
80 rm -f "$(pdfdir)/hello"
82 check-local: ps pdf dvi html # For "make distcheck".
83 END
85 $ACLOCAL
86 $AUTOMAKE --add-missing
87 $AUTOCONF
89 # Make sure AM_TEXI2FLAGS is passed down.
90 grep '\$(TEXI2DVI).*\$(AM_TEXI2FLAGS)' Makefile.in
91 grep '\$(TEXI2PDF).*\$(AM_TEXI2FLAGS)' Makefile.in
93 # To simplify syncing with sister test 'txinfo-many-output-formats.sh'
94 srcdir=.
96 if test $srcdir = ..; then
97 mkdir build
98 cd build
101 $srcdir/configure --prefix="$(pwd)"
103 $MAKE
105 $sleep
106 # Test production of split-per-node HTML.
107 $MAKE html
108 test -d main.html
109 test -d sub/main2.html
110 test -d rec/main3.html
112 # Rebuilding main.html should cause its timestamp to be updated.
113 is_newest main.html $srcdir/main.texi
114 $sleep
115 touch $srcdir/main.texi
116 $MAKE html
117 is_newest main.html $srcdir/main.texi
119 $MAKE clean
120 test ! -e main.html
121 test ! -e sub/main2.html
122 test ! -e rec/main3.html
124 # Test production of a single HTML file.
125 run_make MAKEINFOFLAGS=--no-split html
126 test -f main.html
127 test -f sub/main2.html
128 test -f rec/main3.html
129 $MAKE clean
130 test ! -e main.html
131 test ! -e sub/main2.html
132 test ! -e rec/main3.html
134 # Make sure AM_MAKEINFOHTMLFLAGS is supported, and override AM_MAKEINFO.
135 # Ensure that MAKEINFOFLAGS is not used for the following targets by using an
136 # invalid option.
137 cp $srcdir/Makefile.am $srcdir/Makefile.sav
138 cat >> $srcdir/Makefile.am <<'EOF'
139 AM_MAKEINFOHTMLFLAGS = --no-headers --no-split
140 AM_MAKEINFOFLAGS = --unsupported-option
142 (cd $srcdir && $AUTOMAKE)
143 ./config.status Makefile
145 $MAKE html
146 test -f main.html
147 test -f sub/main2.html
148 test -d rec/main3.html
149 $MAKE clean
150 test ! -e main.html
151 test ! -e sub/main2.html
152 test ! -e rec/main3.html
154 $MAKE install-html
155 test -f share/$me/html/main.html
156 test -f share/$me/html/main2.html
157 test -d share/$me/html/main3.html
158 $MAKE uninstall
159 test ! -e share/$me/html/main.html
160 test ! -e share/$me/html/main2.html
161 test ! -e share/$me/html/main3.html
163 # Restore the makefile without a broken AM_MAKEINFOFLAGS definition.
164 # This must happen before processing any non-html targets. See
165 # https://bugs.gnu.org/30172
166 cp -f $srcdir/Makefile.sav $srcdir/Makefile.am
167 (cd $srcdir && $AUTOMAKE)
168 ./config.status Makefile
170 $MAKE dvi
171 test -f main.dvi
172 test -f sub/main2.dvi
173 test -f rec/main3.dvi
174 $MAKE clean
175 test ! -e main.dvi
176 test ! -e sub/main2.dvi
177 test ! -e rec/main3.dvi
179 $MAKE install-dvi
180 test -f share/$me/dvi/main.dvi
181 test -f share/$me/dvi/main2.dvi
182 test -f share/$me/dvi/main3.dvi
183 $MAKE uninstall
184 test ! -e share/$me/dvi/main.dvi
185 test ! -e share/$me/dvi/main2.dvi
186 test ! -e share/$me/dvi/main3.dvi
188 dvips --help || skip_ "dvips is missing"
190 $MAKE install-ps
191 test -f share/$me/ps/main.ps
192 test -f share/$me/ps/main2.ps
193 test -f share/$me/ps/main3.ps
194 $MAKE uninstall
195 test ! -e share/$me/ps/main.ps
196 test ! -e share/$me/ps/main2.ps
197 test ! -e share/$me/ps/main3.ps
199 pdfetex --help || pdftex --help \
200 || skip_ "pdftex and pdfetex are both missing"
202 $MAKE install-pdf
203 test -f share/$me/pdf/main.pdf
204 test -f share/$me/pdf/main2.pdf
205 test -f share/$me/pdf/main3.pdf
206 test -f share/$me/pdf/hello
207 $MAKE uninstall
208 test ! -e share/$me/pdf/main.pdf
209 test ! -e share/$me/pdf/main2.pdf
210 test ! -e share/$me/pdf/main3.pdf
211 test ! -e share/$me/pdf/hello
213 using_gmake || $MAKE Makefile
214 $MAKE distcheck