summaryrefslogtreecommitdiff
path: root/t/txinfo-builddir.sh
blob: 5e4baaff2d15f959b054b70ec451ec21046475b3 (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
#! /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/>.

# Check that info files are built in builddir when needed.
# This test that this can be done through the so far undocumented
# option 'info-in-builddir', as requested by at least GCC, GDB,
# GNU binutils and the GNU bfd library.  See automake bug#11034.

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

if useless_vpath_rebuild; then
  skip_ "$MAKE has brittle VPATH support"
fi

echo AC_OUTPUT >> configure.ac

cat > Makefile.am << 'END'
AUTOMAKE_OPTIONS = info-in-builddir
info_TEXINFOS = foo.texi subdir/bar.texi mu.texi
subdir_bar_TEXINFOS = subdir/inc.texi
CLEANFILES = mu.info

# mu.info should not be rebuilt in the current directory, since
# it's up-to-date in $(srcdir).
# This can be caused by a subtle issue related to VPATH handling
# of version.texi (see also the comment in texi-vers.am): because
# stamp-vti is newer than version.texi, the 'version.texi: stamp-vti'
# rule is always triggered.  Still that's not a reason for 'make'
# to think 'version.texi' has been created...
check-local:
	test ! -e mu.info
	test -f $(srcdir)/mu.info
END

mkdir subdir

cat > foo.texi << 'END'
\input texinfo
@setfilename foo.info
@settitle foo
@node Top
Hello walls.
@include version.texi
@bye
END

cat > mu.texi << 'END'
\input texinfo
@setfilename mu.info
@settitle mu
@node Top
Mu mu mu.
@bye
END

cat > subdir/bar.texi << 'END'
\input texinfo
@setfilename bar.info
@settitle bar
@node Top
Hello walls.
@include inc.texi
@bye
END

echo "I'm included." > subdir/inc.texi

$ACLOCAL
$AUTOMAKE --add-missing
$AUTOCONF

mkdir build
cd build
../configure
$MAKE info
test -f foo.info
test -f subdir/bar.info
test -f mu.info
test -f ../stamp-vti
test -f ../version.texi
test ! -e ../foo.info
test ! -e ../subdir/bar.info
test ! -e ../mu.info
$MAKE clean
test -f foo.info
test -f subdir/bar.info
test ! -e mu.info
test -f ../stamp-vti
test -f ../version.texi

# Make sure stamp-vti is older that version.texi.
# (A common situation in a real tree).
$sleep
touch ../stamp-vti

$MAKE distcheck
# Being distributed, this file should have been rebuilt.
test -f mu.info

$MAKE distclean
test -f ../stamp-vti
test -f ../version.texi
test -f foo.info
test -f subdir/bar.info
test ! -e mu.info

../configure
$MAKE maintainer-clean
test ! -e ../stamp-vti
test ! -e ../version.texi
test ! -e stamp-vti
test ! -e version.texi
test ! -e foo.info
test ! -e subdir/bar.info
test ! -e mu.info

: