c94f7983c64bbf6179f6b845e1d6c4b829f822eb
[platform/upstream/automake.git] / tests / txinfo21.test
1 #! /bin/sh
2 # Copyright (C) 2003, 2004, 2006, 2008  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 3, 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 support for building HTML documentation, and the many
18 # install-DOC flavors.
19
20 required='makeinfo-html tex texi2dvi'
21 . ./defs || Exit 1
22
23 set -e
24
25 cat >>configure.in <<\EOF
26 AC_CONFIG_FILES([rec/Makefile])
27
28 # At the time of writing, Autoconf does not supplies any of these
29 # definitions (and those below are purposedly not those of the standard).
30 AC_SUBST([dvidir],  ['${datadir}/${PACKAGE}/dvi'])
31 AC_SUBST([htmldir], ['${datadir}/${PACKAGE}/html'])
32 AC_SUBST([pdfdir],  ['${datadir}/${PACKAGE}/pdf'])
33 AC_SUBST([psdir],   ['${datadir}/${PACKAGE}/ps'])
34
35 AC_OUTPUT
36 EOF
37
38 cat > Makefile.am << 'END'
39 SUBDIRS = rec
40 info_TEXINFOS = main.texi sub/main2.texi
41 END
42
43 cat > main.texi << 'END'
44 \input texinfo
45 @setfilename main.info
46 @settitle main
47 @node Top
48 Hello walls.
49 @bye
50 END
51
52 mkdir sub
53 cat > sub/main2.texi << 'END'
54 \input texinfo
55 @setfilename main2.info
56 @settitle main2
57 @node Top
58 Hello walls.
59 @bye
60 END
61
62 mkdir rec
63 cat > rec/main3.texi << 'END'
64 \input texinfo
65 @setfilename main3.info
66 @settitle main3
67 @node Top
68 Hello walls.
69 @bye
70 END
71
72 cat > rec/Makefile.am << 'END'
73 info_TEXINFOS = main3.texi
74
75 install-pdf-local:
76         @$(MKDIR_P) "$(pdfdir)"
77         :> "$(pdfdir)/hello"
78 uninstall-local:
79         rm -f "$(pdfdir)/hello"
80 END
81
82 $ACLOCAL
83 $AUTOMAKE --add-missing
84 $AUTOCONF
85
86 ./configure
87
88 $MAKE
89
90 $sleep
91 # Test production of split-per-node HTML.
92 $MAKE html
93 test -d main.html
94 test -d sub/main2.html
95 test -d rec/main3.html
96
97 # Rebuilding main.html should cause its timestamp to be updated.
98 test `ls -1td main.texi main.html | sed 1q` = main.html
99 $sleep
100 touch main.texi
101 $MAKE html
102 test `ls -1td main.texi main.html | sed 1q` = main.html
103
104 $MAKE clean
105 test ! -d main.html
106 test ! -d sub/main2.html
107 test ! -d rec/main3.html
108
109 # Test production of a single HTML file.
110 MAKEINFOFLAGS=--no-split $MAKE -e html
111 test -f main.html
112 test -f sub/main2.html
113 test -f rec/main3.html
114 $MAKE clean
115 test ! -f main.html
116 test ! -f sub/main2.html
117 test ! -f rec/main3.html
118
119 # Make sure AM_MAKEINFOHTMLFLAGS is supported, and override AM_MAKEINFO.
120 cat >>Makefile.am <<\EOF
121 AM_MAKEINFOHTMLFLAGS=--no-split
122 AM_MAKEINFOFLAGS=--unsupported-option
123 EOF
124 $AUTOMAKE
125 ./configure --prefix "`pwd`"
126 $MAKE html
127 test -f main.html
128 test -f sub/main2.html
129 test -d rec/main3.html
130 $MAKE clean
131 test ! -f main.html
132 test ! -f sub/main2.html
133 test ! -d rec/main3.html
134
135 $MAKE install-html
136 test -f share/txinfo21/html/main.html
137 test -f share/txinfo21/html/main2.html
138 test -d share/txinfo21/html/main3.html
139 $MAKE uninstall
140 test ! -f share/txinfo21/html/main.html
141 test ! -f share/txinfo21/html/main2.html
142 test ! -d share/txinfo21/html/main3.html
143
144 $MAKE install-dvi
145 test -f share/txinfo21/dvi/main.dvi
146 test -f share/txinfo21/dvi/main2.dvi
147 test -f share/txinfo21/dvi/main3.dvi
148 $MAKE uninstall
149 test ! -f share/txinfo21/dvi/main.dvi
150 test ! -f share/txinfo21/dvi/main2.dvi
151 test ! -f share/txinfo21/dvi/main3.dvi
152
153 (dvips --help 2>/dev/null >/dev/null) || Exit 77
154
155 $MAKE install-ps
156 test -f share/txinfo21/ps/main.ps
157 test -f share/txinfo21/ps/main2.ps
158 test -f share/txinfo21/ps/main3.ps
159 $MAKE uninstall
160 test ! -f share/txinfo21/ps/main.ps
161 test ! -f share/txinfo21/ps/main2.ps
162 test ! -f share/txinfo21/ps/main3.ps
163
164 (pdfetex --help 2>/dev/null >/dev/null) ||
165   (pdftex --help 2>/dev/null >/dev/null) || Exit 77
166
167 $MAKE install-pdf
168 test -f share/txinfo21/pdf/main.pdf
169 test -f share/txinfo21/pdf/main2.pdf
170 test -f share/txinfo21/pdf/main3.pdf
171 test -f share/txinfo21/pdf/hello
172 $MAKE uninstall
173 test ! -f share/txinfo21/pdf/main.pdf
174 test ! -f share/txinfo21/pdf/main2.pdf
175 test ! -f share/txinfo21/pdf/main3.pdf
176 test ! -f share/txinfo21/pdf/hello