1 | #! /bin/sh
|
---|
2 | # Copyright (C) 2004, 2005 Free Software Foundation, Inc.
|
---|
3 | #
|
---|
4 | # This file is part of GNU Automake.
|
---|
5 | #
|
---|
6 | # GNU Automake is free software; you can redistribute it and/or modify
|
---|
7 | # it under the terms of the GNU General Public License as published by
|
---|
8 | # the Free Software Foundation; either version 2, or (at your option)
|
---|
9 | # any later version.
|
---|
10 | #
|
---|
11 | # GNU Automake is distributed in the hope that it will be useful,
|
---|
12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
14 | # GNU General Public License for more details.
|
---|
15 | #
|
---|
16 | # You should have received a copy of the GNU General Public License
|
---|
17 | # along with Automake; see the file COPYING. If not, write to
|
---|
18 | # the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
---|
19 | # Boston, MA 02110-1301, USA.
|
---|
20 |
|
---|
21 | # Check that installation to directory with shell metacharacters succeed.
|
---|
22 | # Original report from James Amundson about file names with spaces.
|
---|
23 | # Other characters added by Paul Eggert.
|
---|
24 |
|
---|
25 | # This is mostly the same input as nobase.test, but we do not use
|
---|
26 | # libtool libraries, because Libtool does not preserve space in
|
---|
27 | # file names (Issue observed with ltmain.sh (GNU libtool) 1.5a (1.1323
|
---|
28 | # 2003/11/10 21:06:47))
|
---|
29 |
|
---|
30 |
|
---|
31 | required='gcc'
|
---|
32 | . ./defs || exit 1
|
---|
33 |
|
---|
34 | set -e
|
---|
35 |
|
---|
36 | # Set up files that won't change each time through the loop.
|
---|
37 |
|
---|
38 | cat >> configure.in <<'EOF'
|
---|
39 | AC_PROG_CC
|
---|
40 | AC_PROG_RANLIB
|
---|
41 | AC_OUTPUT
|
---|
42 | EOF
|
---|
43 |
|
---|
44 | mkdir sub
|
---|
45 |
|
---|
46 | : > sub/base.h
|
---|
47 | : > sub/nobase.h
|
---|
48 | : > sub/base.dat
|
---|
49 | : > sub/nobase.dat
|
---|
50 | : > sub/base.sh
|
---|
51 | : > sub/nobase.sh
|
---|
52 |
|
---|
53 | cat >source.c <<'EOF'
|
---|
54 | int
|
---|
55 | main (int argc, char **argv)
|
---|
56 | {
|
---|
57 | return 0;
|
---|
58 | }
|
---|
59 | EOF
|
---|
60 | cp source.c source2.c
|
---|
61 |
|
---|
62 | cat > Makefile.am << 'EOF'
|
---|
63 | foodir = $(prefix)/foo
|
---|
64 | fooexecdir = $(prefix)/foo
|
---|
65 |
|
---|
66 | foo_HEADERS = sub/base.h
|
---|
67 | nobase_foo_HEADERS = sub/nobase.h
|
---|
68 |
|
---|
69 | dist_foo_DATA = sub/base.dat
|
---|
70 | nobase_dist_foo_DATA = sub/nobase.dat
|
---|
71 |
|
---|
72 | dist_fooexec_SCRIPTS = sub/base.sh
|
---|
73 | nobase_dist_fooexec_SCRIPTS = sub/nobase.sh
|
---|
74 |
|
---|
75 | fooexec_PROGRAMS = sub/base
|
---|
76 | nobase_fooexec_PROGRAMS = sub/nobase
|
---|
77 | sub_base_SOURCES = source.c
|
---|
78 | sub_nobase_SOURCES = source.c
|
---|
79 |
|
---|
80 | fooexec_LIBRARIES = sub/libbase.a
|
---|
81 | nobase_fooexec_LIBRARIES = sub/libnobase.a
|
---|
82 | sub_libbase_a_SOURCES = source.c
|
---|
83 | sub_libnobase_a_SOURCES = source.c
|
---|
84 |
|
---|
85 | test-install-sep: install
|
---|
86 | test -f '$(DESTDIR)/$(file)-prefix/foo/sub/nobase.h'
|
---|
87 | test ! -f '$(DESTDIR)/$(file)-prefix/foo/nobase.h'
|
---|
88 | test -f '$(DESTDIR)/$(file)-prefix/foo/base.h'
|
---|
89 | test -f '$(DESTDIR)/$(file)-prefix/foo/sub/nobase.dat'
|
---|
90 | test ! -f '$(DESTDIR)/$(file)-prefix/foo/nobase.dat'
|
---|
91 | test -f '$(DESTDIR)/$(file)-prefix/foo/base.dat'
|
---|
92 | test -f '$(DESTDIR)/$(file)-prefix/foo/sub/nobase.sh'
|
---|
93 | test ! -f '$(DESTDIR)/$(file)-prefix/foo/nobase.sh'
|
---|
94 | test -f '$(DESTDIR)/$(file)-prefix/foo/base.sh'
|
---|
95 | test -f '$(DESTDIR)/$(file)-prefix/foo/sub/nobase$(EXEEXT)'
|
---|
96 | test ! -f '$(DESTDIR)/$(file)-prefix/foo/nobase$(EXEEXT)'
|
---|
97 | test -f '$(DESTDIR)/$(file)-prefix/foo/base$(EXEEXT)'
|
---|
98 | test -f '$(DESTDIR)/$(file)-prefix/foo/sub/libnobase.a'
|
---|
99 | test ! -f '$(DESTDIR)/$(file)-prefix/foo/libnobase.a'
|
---|
100 | test -f '$(DESTDIR)/$(file)-prefix/foo/libbase.a'
|
---|
101 | EOF
|
---|
102 |
|
---|
103 | $ACLOCAL
|
---|
104 | $AUTOCONF
|
---|
105 | $AUTOMAKE -a
|
---|
106 |
|
---|
107 | # Some control characters that are white space:
|
---|
108 | # back space, carriage return, form feed, horizontal tab, line feed, space
|
---|
109 | bs=''
|
---|
110 | cr='
|
---|
111 | '
|
---|
112 | ff=' |
---|
113 | '
|
---|
114 | ht=' '
|
---|
115 | lf='
|
---|
116 | '
|
---|
117 | sp=' '
|
---|
118 |
|
---|
119 | build_failures=
|
---|
120 | install_failures=
|
---|
121 |
|
---|
122 | for file in \
|
---|
123 | '!' '"' '#' '$' '%' '&' \' '(' ')' '*' '+' ',' '-' ':' ';' \
|
---|
124 | '<' '=' '>' '?' '@' '[' '\' ']' '^' '`' '{' '|' '}' '~' \
|
---|
125 | "$bs" "$cr" "$ff" "$ht" "$lf" "$sp" \
|
---|
126 | '@<:@' '@:>@' '@S|@' '@%:@' '@&t@' \
|
---|
127 | "a${sp}b" "a${sp}${sp}b" "a${lf}b" ... a:
|
---|
128 | do
|
---|
129 | for test in build install; do
|
---|
130 | case $test in
|
---|
131 | build)
|
---|
132 | build=$file
|
---|
133 | dest=`pwd`/sub1;;
|
---|
134 | install)
|
---|
135 | build=sub1
|
---|
136 | dest=`pwd`/$file;;
|
---|
137 | esac
|
---|
138 |
|
---|
139 | # Make sure this system supports this character in file names.
|
---|
140 | mkdir sub1 "./$file" || exit 77
|
---|
141 |
|
---|
142 | cd "$build"
|
---|
143 |
|
---|
144 | ../configure --prefix "/$file-prefix" &&
|
---|
145 | $MAKE &&
|
---|
146 | DESTDIR=$dest file=$file $MAKE -e test-install-sep ||
|
---|
147 | eval "${test}_failures=\"\$${test}_failures$lf\$file\""
|
---|
148 |
|
---|
149 | cd ..
|
---|
150 |
|
---|
151 | rm -fr sub1 "./$file"
|
---|
152 | done
|
---|
153 | done
|
---|
154 |
|
---|
155 | # The list of the above file names that cannot be used as a build directory
|
---|
156 | # on a POSIX host. This list should be empty, but is not due to limitations
|
---|
157 | # in Autoconf, Automake, Make, M4, or the shell.
|
---|
158 | expected_build_failures='
|
---|
159 | "
|
---|
160 | #
|
---|
161 | $
|
---|
162 | &
|
---|
163 | '\''
|
---|
164 | \
|
---|
165 | `
|
---|
166 | '"$lf"'
|
---|
167 | @&t@
|
---|
168 | a'"${lf}"'b'
|
---|
169 |
|
---|
170 | # Similarly, the list of file names that cannot be used as an install directory
|
---|
171 | # on a POSIX host. This list should also be empty.
|
---|
172 | expected_install_failures='
|
---|
173 | "
|
---|
174 | #
|
---|
175 | $
|
---|
176 | '\''
|
---|
177 | `
|
---|
178 | '"$lf"'
|
---|
179 | a'"${lf}"'b'
|
---|
180 |
|
---|
181 | fail=0
|
---|
182 | for test in build install; do
|
---|
183 | eval failures=\$${test}_failures
|
---|
184 | case $failures in
|
---|
185 | ?*)
|
---|
186 | cat >&2 <<EOF
|
---|
187 | $0: $test test failed for the following file names:$failures
|
---|
188 | EOF
|
---|
189 | eval test \"\$failures\" = \"\$expected_${test}_failures\" || fail=1
|
---|
190 | esac
|
---|
191 | done
|
---|
192 |
|
---|
193 | exit $fail
|
---|