source: trunk/essentials/sys-devel/automake-1.10/tests/instspc.test

Last change on this file was 3147, checked in by bird, 18 years ago

automake 1.10

File size: 4.7 KB
Line 
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
31required='gcc'
32. ./defs || exit 1
33
34set -e
35
36# Set up files that won't change each time through the loop.
37
38cat >> configure.in <<'EOF'
39AC_PROG_CC
40AC_PROG_RANLIB
41AC_OUTPUT
42EOF
43
44mkdir 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
53cat >source.c <<'EOF'
54int
55main (int argc, char **argv)
56{
57 return 0;
58}
59EOF
60cp source.c source2.c
61
62cat > Makefile.am << 'EOF'
63foodir = $(prefix)/foo
64fooexecdir = $(prefix)/foo
65
66foo_HEADERS = sub/base.h
67nobase_foo_HEADERS = sub/nobase.h
68
69dist_foo_DATA = sub/base.dat
70nobase_dist_foo_DATA = sub/nobase.dat
71
72dist_fooexec_SCRIPTS = sub/base.sh
73nobase_dist_fooexec_SCRIPTS = sub/nobase.sh
74
75fooexec_PROGRAMS = sub/base
76nobase_fooexec_PROGRAMS = sub/nobase
77sub_base_SOURCES = source.c
78sub_nobase_SOURCES = source.c
79
80fooexec_LIBRARIES = sub/libbase.a
81nobase_fooexec_LIBRARIES = sub/libnobase.a
82sub_libbase_a_SOURCES = source.c
83sub_libnobase_a_SOURCES = source.c
84
85test-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'
101EOF
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
109bs=''
110cr='
111'
112ff='
113'
114ht=' '
115lf='
116'
117sp=' '
118
119build_failures=
120install_failures=
121
122for 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:
128do
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
153done
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.
158expected_build_failures='
159"
160#
161$
162&
163'\''
164\
165`
166'"$lf"'
167@&t@
168a'"${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.
172expected_install_failures='
173"
174#
175$
176'\''
177`
178'"$lf"'
179a'"${lf}"'b'
180
181fail=0
182for 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
188EOF
189 eval test \"\$failures\" = \"\$expected_${test}_failures\" || fail=1
190 esac
191done
192
193exit $fail
Note: See TracBrowser for help on using the repository browser.