2 # Copyright (C) 2008-2013 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 # Installing many files should not exceed the command line length limit.
18 # Here, the main issue is that we may prepend '$(srcdir)/' to each file,
19 # which may cause much longer command lines. The list of files must
20 # anyway remain below the limit, otherwise 'make' won't be able to even
23 # Further, the install rule should honor failures of the install program.
25 # Python is done in the sister test.
26 # For texinfos, we expand names using $(srcdir) in the first place.
27 # Let's hope nobody uses many texinfos.
31 # In order to have a useful test on modern systems (which have a high
32 # limit, if any), use a fake install program that errors out for more
33 # than 2K characters in a command line. The POSIX limit is 4096, but
34 # that may include space taken up by the environment.
37 subdir=long_subdir_name_with_many_characters
39 list=$(seq_ 1 $nfiles)
41 sed "s|@limit@|$limit|g" >myinstall.in <<'END'
43 # Fake install script. This doesn't really install
44 # (the INSTALL path below would be wrong outside this directory).
47 len=`expr "$INSTALL $*" : ".*" 2>/dev/null || echo $limit`
48 if test $len -ge $limit; then
49 echo "$0: safe command line limit of $limit characters exceeded" >&2
55 # Creative quoting in the next line to please maintainer-check.
56 sed "s|@limit@|$limit|g" >'rm' <<'END'
62 len=`expr "$RM $*" : ".*" 2>/dev/null || echo $limit`
63 if test $len -ge $limit; then
64 echo "$0: safe command line limit of $limit characters exceeded" >&2
73 cat >>configure.ac <<END
74 AC_CONFIG_FILES([myinstall], [chmod +x ./myinstall])
75 AC_CONFIG_FILES([$subdir/Makefile])
79 cat >Makefile.am <<END
86 cat >Makefile.am <<'END'
92 nobase_include_HEADERS =
96 unindent >>Makefile.am <<END
97 bin_SCRIPTS += script$n
98 nobase_bin_SCRIPTS += nscript$n
100 nobase_data_DATA += ndata$n
101 include_HEADERS += header$n.h
102 nobase_include_HEADERS += nheader$n.h
115 $AUTOMAKE --add-missing
120 ../configure --prefix="$instdir"
122 # Try whether native install (or install-sh) works.
124 # Multiple uninstall should work, too.
127 test $(find "$instdir" -type f -print | wc -l) -eq 0
129 # Try whether we don't exceed the low limit.
130 INSTALL='$(SHELL) $(top_builddir)/myinstall' $MAKE -e install
131 env save_PATH="$PATH" PATH="$(pwd)/..$PATH_SEPARATOR$PATH" $MAKE uninstall
136 # Ensure 'make install' fails when 'install' fails.
138 # We cheat here, for efficiency, knowing the internal rule names.
139 # For correctness, one should '$MAKE install' here always, or at
140 # least use install-exec or install-data.
142 for file in script3 script$nfiles
144 chmod a-r $srcdir/$file
145 test ! -r $srcdir/$file || skip_ "cannot drop file read permissions"
146 $MAKE install-binSCRIPTS && exit 1
147 chmod u+r $srcdir/$file
150 for file in nscript3 nscript$nfiles
152 chmod a-r $srcdir/$file
153 $MAKE install-nobase_binSCRIPTS && exit 1
154 chmod u+r $srcdir/$file
157 for file in data3 data$nfiles
159 chmod a-r $srcdir/$file
160 $MAKE install-dataDATA && exit 1
161 chmod u+r $srcdir/$file
164 for file in ndata3 ndata$nfiles
166 chmod a-r $srcdir/$file
167 $MAKE install-nobase_dataDATA && exit 1
168 chmod u+r $srcdir/$file
171 for file in header3.h header$nfiles.h
173 chmod a-r $srcdir/$file
174 $MAKE install-includeHEADERS && exit 1
175 chmod u+r $srcdir/$file
178 for file in nheader3.h nheader$nfiles.h
180 chmod a-r $srcdir/$file
181 $MAKE install-nobase_includeHEADERS && exit 1
182 chmod u+r $srcdir/$file