Clarify overriding of `*_DEPENDENCIES' in LIBOBJS node.
[automake/ericb.git] / tests / instmany-mans.test
blob773fa76ceaa0fae85b964184b5416cb55354cd89
1 #! /bin/sh
2 # Copyright (C) 2008 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 3, 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 <http://www.gnu.org/licenses/>.
17 # Installing many files should not exceed the command line length limit.
19 # This is the mans sister test of instmany.test, see there for details.
21 required=non-root # hope to catch 'chmod a-r'-challenged file systems.
22 . ./defs || Exit 1
24 set -e
26 # In order to have a useful test on modern systems (which have a high
27 # limit, if any), use a fake install program that errors out for more
28 # than 2K characters in a command line. The POSIX limit is 4096, but
29 # that may include space taken up by the environment.
31 limit=2500
32 subdir=long_subdir_name_with_many_characters
33 nfiles=81
35 # Let's use `seq' if available, it's faster than the loop.
36 list=`(seq 1 $nfiles) 2>/dev/null || {
37 i=1
38 while test $i -le $nfiles; do
39 echo $i
40 i=\`expr $i + 1\`
41 done; }`
43 sed "s|@limit@|$limit|g" >myinstall.in <<'END'
44 #! /bin/sh
45 # Fake install script. This doesn't really install
46 # (the INSTALL path below would be wrong outside this directory).
47 limit=@limit@
48 INSTALL='@INSTALL@'
49 len=`expr "$INSTALL $*" : ".*" 2>/dev/null || echo $limit`
50 if test $len -ge $limit; then
51 echo "$0: safe command line limit of $limit characters exceeded" >&2
52 exit 1
54 exit 0
55 END
57 # Creative quoting in the next line to please maintainer-check.
58 sed "s|@limit@|$limit|g" >'rm' <<'END'
59 #! /bin/sh
60 limit=@limit@
61 PATH=$save_PATH
62 export PATH
63 RM='rm -f'
64 len=`expr "$RM $*" : ".*" 2>/dev/null || echo $limit`
65 if test $len -ge $limit; then
66 echo "$0: safe command line limit of $limit characters exceeded" >&2
67 exit 1
69 exec $RM "$@"
70 exit 1
71 END
73 chmod +x rm
75 cat >>configure.in <<END
76 AC_CONFIG_FILES([myinstall], [chmod +x ./myinstall])
77 AC_CONFIG_FILES([$subdir/Makefile])
78 AC_OUTPUT
79 END
81 cat >Makefile.am <<END
82 SUBDIRS = $subdir
83 END
85 mkdir $subdir
86 cd $subdir
88 cat >Makefile.am <<'END'
89 man_MANS =
90 man3_MANS =
91 notrans_man_MANS =
92 notrans_man3_MANS =
93 END
95 for n in $list; do
96 cat >>Makefile.am <<END
97 man_MANS += page$n.1
98 man3_MANS += page$n.man
99 notrans_man_MANS += npage$n.1
100 notrans_man3_MANS += npage$n.man
102 echo >page$n.1
103 echo >page$n.man
104 echo >npage$n.1
105 echo >npage$n.man
106 done
108 cd ..
109 $ACLOCAL
110 $AUTOCONF
111 $AUTOMAKE --add-missing
113 instdir=`pwd`/inst
114 mkdir build
115 cd build
116 ../configure --prefix="$instdir"
117 $MAKE
118 # Try whether native install (or install-sh) works.
119 $MAKE install
120 # Multiple uninstall should work, too.
121 $MAKE uninstall
122 $MAKE uninstall
123 test `find "$instdir" -type f -print | wc -l` = 0
125 # Try whether we don't exceed the low limit.
126 INSTALL='$(SHELL) $(top_builddir)/myinstall' $MAKE -e install
127 env save_PATH="$PATH" PATH="`pwd`/..:$PATH" $MAKE uninstall
129 cd $subdir
130 srcdir=../../$subdir
132 # Ensure 'make install' fails when 'install' fails.
134 # We cheat here, for efficiency, knowing the internal rule names.
135 # For correctness, one should `$MAKE install' here always, or at
136 # least use install-exec or install-data.
138 for file in page3.1 page$nfiles.1 npage3.1 npage$nfiles.1; do
139 chmod a-r $srcdir/$file
140 $MAKE install-man1 && Exit 1
141 chmod u+r $srcdir/$file
142 done
144 for file in page3.man page$nfiles.man npage3.man npage$nfiles.man; do
145 chmod a-r $srcdir/$file
146 $MAKE install-man3 && Exit 1
147 chmod u+r $srcdir/$file
148 done