2 # Copyright (C) 2011-2012 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)
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 <http://www.gnu.org/licenses/>.
17 # Checks on the 'install-info' target.
18 # Details about the individual checks' purposes and motivations are
21 # FIXME: this test is a good candidate for a conversion to TAP,
22 # FIXME: and could be merged with 'txinfo27.test'.
27 cwd
=$
(pwd) || fatal_
"cannot get current working directory"
30 saved_PATH
=$PATH; export saved_PATH
31 PATH
=$cwd/bin
$PATH_SEPARATOR$PATH; export PATH
33 cat >> configure.ac
<<'END'
37 cat > Makefile.am
<< 'END'
38 info_TEXINFOS
= foo.texi
41 cat > foo.texi
<< 'END'
44 @c All the following directives might be required to allow older
45 @c versions of the
'install-info' program
(e.g.
, version
4.8) to
46 @c create the
'dir' index
file in ${infodir}. Don
't remove them.
48 @dircategory Dummy utilities
50 * Foo: (foo). Does nothing at all, but has a nice name.
64 ./configure --prefix="$cwd/$instdir" --infodir="$cwd/$instdir/info"
69 if install-info --version; then
70 # Skip some checks even if 'install-info
' is the one from dpkg, not
71 # the one from GNU info, as the former might try to create files in
72 # '/var
/backups
/', causing spurious failures like this for non-root
74 if install-info --version | $EGREP -i '(dpkg|debian
) install-info
'; then
83 # The 'install-info
' target updates the '${infodir}/dir
' file
84 # by default (if the 'install-info
' program is available).
85 # This should happen in a normal as well as in a DESTDIR installation.
86 if test $have_installinfo = yes; then
89 test -f $instdir/info/foo.info
90 test -f $instdir/info/dir
91 $FGREP 'Does nothing
at all
, but has a nice name
' $instdir/info/dir
94 test ! -e $instdir/info/foo.info
95 $FGREP 'but has a nice name
' $instdir/info/dir && exit 1
97 dir="$destdir/$cwd/$instdir/info"
99 $MAKE DESTDIR="$cwd/$destdir" install-info
100 test -f "$dir"/foo.info
102 $FGREP 'Does nothing
at all
, but has a nice name
' "$dir"/dir
103 $MAKE DESTDIR="$cwd/$destdir" uninstall
104 test ! -e "$dir"/foo.info
105 $FGREP 'but has a nice name
' "$dir"/dir && exit 1
111 rm -rf $instdir $destdir
113 # The 'install-info
' target doesn't fail
if the
'install-info'
114 # program is not available.
115 cat > bin
/install-info
<<'END'
117 echo error from install-info >&2
120 chmod a
+x bin
/install-info
121 $MAKE install-info
>output
2>&1 ||
{ cat output
; exit 1; }
123 test -f $instdir/info
/foo.info
124 test ! -e $instdir/info
/dir
125 grep 'error from install-info' output
&& exit 1
127 rm -rf $instdir output
129 if test $have_installinfo = yes; then
130 # The 'install-info' target doesn't try to guess whether the 'install-info'
131 # is the GNU or debian version.
132 unindent
> bin
/install-info
<<'END'
136 for str in dpkg debian Debian; do
137 eval "echo This is $str install-info >&$fd"
140 PATH=$saved_PATH; export PATH
141 exec install-info ${1+"$@"}
144 test -f $instdir/info
/foo.info
145 test -f $instdir/info
/dir
147 test ! -e $instdir/info
/foo.info
148 test -f $instdir/info
/dir
149 $FGREP 'but has a nice name' $instdir/info
/dir
&& exit 1
150 : For shells with busted
'set -e'.
153 rm -rf $instdir bin
/install-info
155 # The 'AM_UPDATE_INFO_DIR' environment variable can be used to
156 # prevent the creation or update of the '${infodir}/dir' file,
157 # if set to a "no" value.
158 for val
in no NO n
; do
160 env AM_UPDATE_INFO_DIR
="$val" $MAKE install-info
161 test -f $instdir/info
/foo.info
162 test ! -e $instdir/info
/dir
166 if test $have_installinfo != yes; then
167 echo 'Does nothing at all, but has a nice name' > $instdir/info
/dir
170 chmod a-w
$instdir/info
/dir
171 for val
in no NO n
; do
172 env AM_UPDATE_INFO_DIR
="$val" $MAKE uninstall
173 $FGREP 'Does nothing at all, but has a nice name' $instdir/info
/dir
176 if test $have_installinfo = yes; then
177 for val
in 'yes' 'who cares!'; do
179 env AM_UPDATE_INFO_DIR
="$val" $MAKE install-info
180 test -f $instdir/info
/foo.info
181 test -f $instdir/info
/dir
182 env AM_UPDATE_INFO_DIR
="$val" $MAKE uninstall
183 test ! -e $instdir/info
/foo.info
184 $FGREP 'but has a nice name' $instdir/info
/dir
&& exit 1
185 : For shells with busted
'set -e'.