2 # Copyright (C) 2008, 2009, 2010 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.
33 # In order to have a useful test on modern systems (which have a high
34 # limit, if any), use a fake install program that errors out for more
35 # than 2K characters in a command line. The POSIX limit is 4096, but
36 # that may include space taken up by the environment.
39 subdir
=long_subdir_name_with_many_characters
42 # Let's use `seq' if available, it's faster than the loop.
43 list
=`(seq 1 $nfiles) 2>/dev/null || {
45 while test $i -le $nfiles; do
50 sed "s|@limit@|$limit|g" >myinstall.
in <<'END'
52 # Fake install script. This doesn't really install
53 # (the INSTALL path below would be wrong outside this directory).
56 len=`expr "$INSTALL $*" : ".*" 2>/dev/null || echo $limit`
57 if test $len -ge $limit; then
58 echo "$0: safe command line limit of $limit characters exceeded" >&2
64 # Creative quoting in the next line to please maintainer-check.
65 sed "s|@limit@|$limit|g" >'rm' <<'END'
71 len=`expr "$RM $*" : ".*" 2>/dev/null || echo $limit`
72 if test $len -ge $limit; then
73 echo "$0: safe command line limit of $limit characters exceeded" >&2
82 cat >>configure.
in <<END
83 AC_CONFIG_FILES([myinstall], [chmod +x ./myinstall])
84 AC_CONFIG_FILES([$subdir/Makefile])
88 cat >Makefile.am
<<END
95 cat >Makefile.am
<<'END'
101 nobase_include_HEADERS =
105 cat >>Makefile.am
<<END
106 bin_SCRIPTS += script$n
107 nobase_bin_SCRIPTS += nscript$n
109 nobase_data_DATA += ndata$n
110 include_HEADERS += header$n.h
111 nobase_include_HEADERS += nheader$n.h
124 $AUTOMAKE --add-missing
129 ..
/configure
--prefix="$instdir"
131 # Try whether native install (or install-sh) works.
133 # Multiple uninstall should work, too.
136 test `find "$instdir" -type f -print | wc -l` = 0
138 # Try whether we don't exceed the low limit.
139 INSTALL
='$(SHELL) $(top_builddir)/myinstall' $MAKE -e install
140 env save_PATH
="$PATH" PATH
="`pwd`/..$PATH_SEPARATOR$PATH" $MAKE uninstall
145 # Ensure 'make install' fails when 'install' fails.
147 # We cheat here, for efficiency, knowing the internal rule names.
148 # For correctness, one should `$MAKE install' here always, or at
149 # least use install-exec or install-data.
151 for file in script3
script$nfiles
153 chmod a-r
$srcdir/$file
154 test ! -r $srcdir/$file || Exit
77
155 $MAKE install-binSCRIPTS
&& Exit
1
156 chmod u
+r
$srcdir/$file
159 for file in nscript3 nscript
$nfiles
161 chmod a-r
$srcdir/$file
162 $MAKE install-nobase_binSCRIPTS
&& Exit
1
163 chmod u
+r
$srcdir/$file
166 for file in data3 data
$nfiles
168 chmod a-r
$srcdir/$file
169 $MAKE install-dataDATA
&& Exit
1
170 chmod u
+r
$srcdir/$file
173 for file in ndata3 ndata
$nfiles
175 chmod a-r
$srcdir/$file
176 $MAKE install-nobase_dataDATA
&& Exit
1
177 chmod u
+r
$srcdir/$file
180 for file in header3.h header
$nfiles.h
182 chmod a-r
$srcdir/$file
183 $MAKE install-includeHEADERS
&& Exit
1
184 chmod u
+r
$srcdir/$file
187 for file in nheader3.h nheader
$nfiles.h
189 chmod a-r
$srcdir/$file
190 $MAKE install-nobase_includeHEADERS
&& Exit
1
191 chmod u
+r
$srcdir/$file