summaryrefslogtreecommitdiff
path: root/t/txinfo-include.sh
blob: 0efda433c5a943190f04230ac46feac78edac8e8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
#! /bin/sh
# Copyright (C) 2012-2017 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.

# Texinfo input files using @include directives.  Check both in-tree
# and VPATH builds, and both top-level and subdir input.

required='makeinfo tex texi2dvi'
. test-init.sh

echo AC_OUTPUT >> configure.ac

cat > Makefile.am << 'END'
info_TEXINFOS = main.texi sub/more.texi
main_TEXINFOS = one.texi two.texi three.texi
sub_more_TEXINFOS = sub/desc.texi sub/hist.texi
END

cat > main.texi << 'END'
\input texinfo
@setfilename main.info
@settitle main
@ifnottex
@node Top
@top GNU dummy.
@menu
* one::   Chapter one
* two::   Chapter two
* three:: Chapter three
@end menu
@end ifnottex
@include one.texi
@include two.texi
@include three.texi
@bye
END

cat > one.texi << 'END'
@node one
@chapter Chapter one
Foo bar, baz.
END

cat > two.texi << 'END'
@node two
@chapter Chapter two
Blah Blah Blah.
END

cat > three.texi << 'END'
@node three
@chapter Chapter two
GNU's Not Unix.
END

mkdir sub

cat > sub/more.texi << 'END'
\input texinfo
@setfilename more.info
@settitle main
@ifnottex
@node Top
@top GNU more.
@menu
* desc:: Description of this program
* hist:: History of this program
@end menu
@end ifnottex
@include desc.texi
@include hist.texi
@bye
END

cat > sub/desc.texi << 'END'
@node desc
@chapter Description of this program
It does something, really.
END

cat > sub/hist.texi << 'END'
@node hist
@chapter History of this program
It was written somehow.
END

cat > exp << 'END'
./main.info
./sub/more.info
END

check_info_contents ()
{
  srcdir=${1-.}
  $FGREP "Foo bar, baz."                        $srcdir/main.info
  $FGREP "Blah Blah Blah."                      $srcdir/main.info
  $FGREP "GNU's Not Unix."                      $srcdir/main.info
  $FGREP 'It does something, really.'           $srcdir/sub/more.info
  $FGREP 'It was written somehow.'              $srcdir/sub/more.info
}

get_info_names ()
{
  find ${1-.} -type f -name '*.info' | LC_ALL=C sort > got
}

check_expected ()
{
  cat exp
  cat got
  diff exp got
}

$ACLOCAL
$AUTOMAKE --add-missing
$AUTOCONF

./configure

$MAKE info
get_info_names
check_expected

check_info_contents

$MAKE dvi
test -f main.dvi
test -f sub/more.dvi

$MAKE maintainer-clean
test ! -f main.dvi
test ! -f sub/more.dvi
test ! -f main.info
test ! -f sub/more.info

mkdir build
cd build
../configure
$MAKE all dvi

get_info_names ..
sed 's|^\./|../|' ../exp > exp
check_expected

test -f main.dvi
test -f sub/more.dvi

check_info_contents ..

$MAKE distcheck

: