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)
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.
30 required
=non-root
# hope to catch 'chmod a-r'-challenged file systems.
35 # In order to have a useful test on modern systems (which have a high
36 # limit, if any), use a fake install program that errors out for more
37 # than 2K characters in a command line. The POSIX limit is 4096, but
38 # that may include space taken up by the environment.
41 subdir
=long_subdir_name_with_many_characters
44 # Let's use `seq' if available, it's faster than the loop.
45 list
=`(seq 1 $nfiles) 2>/dev/null || {
47 while test $i -le $nfiles; do
52 sed "s|@limit@|$limit|g" >myinstall.
in <<'END'
54 # Fake install script. This doesn't really install
55 # (the INSTALL path below would be wrong outside this directory).
58 len=`expr "$INSTALL $*" : ".*" 2>/dev/null || echo $limit`
59 if test $len -ge $limit; then
60 echo "$0: safe command line limit of $limit characters exceeded" >&2
66 # Creative quoting in the next line to please maintainer-check.
67 sed "s|@limit@|$limit|g" >'rm' <<'END'
73 len=`expr "$RM $*" : ".*" 2>/dev/null || echo $limit`
74 if test $len -ge $limit; then
75 echo "$0: safe command line limit of $limit characters exceeded" >&2
84 cat >>configure.
in <<END
85 AC_CONFIG_FILES([myinstall], [chmod +x ./myinstall])
86 AC_CONFIG_FILES([$subdir/Makefile])
90 cat >Makefile.am
<<END
97 cat >Makefile.am
<<'END'
103 nobase_include_HEADERS =
107 cat >>Makefile.am
<<END
108 bin_SCRIPTS += script$n
109 nobase_bin_SCRIPTS += nscript$n
111 nobase_data_DATA += ndata$n
112 include_HEADERS += header$n.h
113 nobase_include_HEADERS += nheader$n.h
126 $AUTOMAKE --add-missing
131 ..
/configure
--prefix="$instdir"
133 # Try whether native install (or install-sh) works.
135 # Multiple uninstall should work, too.
138 test `find "$instdir" -type f -print | wc -l` = 0
140 # Try whether we don't exceed the low limit.
141 INSTALL
='$(SHELL) $(top_builddir)/myinstall' $MAKE -e install
142 env save_PATH
="$PATH" PATH
="`pwd`/..:$PATH" $MAKE uninstall
147 # Ensure 'make install' fails when 'install' fails.
149 # We cheat here, for efficiency, knowing the internal rule names.
150 # For correctness, one should `$MAKE install' here always, or at
151 # least use install-exec or install-data.
153 for file in script3
script$nfiles
155 chmod a-r
$srcdir/$file
156 $MAKE install-binSCRIPTS
&& Exit
1
157 chmod u
+r
$srcdir/$file
160 for file in nscript3 nscript
$nfiles
162 chmod a-r
$srcdir/$file
163 $MAKE install-nobase_binSCRIPTS
&& Exit
1
164 chmod u
+r
$srcdir/$file
167 for file in data3 data
$nfiles
169 chmod a-r
$srcdir/$file
170 $MAKE install-dataDATA
&& Exit
1
171 chmod u
+r
$srcdir/$file
174 for file in ndata3 ndata
$nfiles
176 chmod a-r
$srcdir/$file
177 $MAKE install-nobase_dataDATA
&& Exit
1
178 chmod u
+r
$srcdir/$file
181 for file in header3.h header
$nfiles.h
183 chmod a-r
$srcdir/$file
184 $MAKE install-includeHEADERS
&& Exit
1
185 chmod u
+r
$srcdir/$file
188 for file in nheader3.h nheader
$nfiles.h
190 chmod a-r
$srcdir/$file
191 $MAKE install-nobase_includeHEADERS
&& Exit
1
192 chmod u
+r
$srcdir/$file