Clarify overriding of `*_DEPENDENCIES' in LIBOBJS node.
[automake/ericb.git] / tests / instspc.test
bloba59177df6162883a06486df6b1170f3e1c057ef6
1 #! /bin/sh
2 # Copyright (C) 2004, 2005 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)
7 # any later version.
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 # Check that installation to directory with shell metacharacters succeed.
18 # Original report from James Amundson about file names with spaces.
19 # Other characters added by Paul Eggert.
21 # This is mostly the same input as nobase.test, but we do not use
22 # libtool libraries, because Libtool does not preserve space in
23 # file names (Issue observed with ltmain.sh (GNU libtool) 1.5a (1.1323
24 # 2003/11/10 21:06:47))
27 required='gcc'
28 . ./defs || Exit 1
30 set -e
32 # Set up files that won't change each time through the loop.
34 cat >> configure.in <<'EOF'
35 AC_PROG_CC
36 AC_PROG_RANLIB
37 AC_OUTPUT
38 EOF
40 mkdir sub
42 : > sub/base.h
43 : > sub/nobase.h
44 : > sub/base.dat
45 : > sub/nobase.dat
46 : > sub/base.sh
47 : > sub/nobase.sh
49 cat >source.c <<'EOF'
50 int
51 main (int argc, char **argv)
53 return 0;
55 EOF
56 cp source.c source2.c
58 cat > Makefile.am << 'EOF'
59 foodir = $(prefix)/foo
60 fooexecdir = $(prefix)/foo
62 foo_HEADERS = sub/base.h
63 nobase_foo_HEADERS = sub/nobase.h
65 dist_foo_DATA = sub/base.dat
66 nobase_dist_foo_DATA = sub/nobase.dat
68 dist_fooexec_SCRIPTS = sub/base.sh
69 nobase_dist_fooexec_SCRIPTS = sub/nobase.sh
71 fooexec_PROGRAMS = sub/base
72 nobase_fooexec_PROGRAMS = sub/nobase
73 sub_base_SOURCES = source.c
74 sub_nobase_SOURCES = source.c
76 fooexec_LIBRARIES = sub/libbase.a
77 nobase_fooexec_LIBRARIES = sub/libnobase.a
78 sub_libbase_a_SOURCES = source.c
79 sub_libnobase_a_SOURCES = source.c
81 test-install-sep: install
82 test -f '$(DESTDIR)/$(file)-prefix/foo/sub/nobase.h'
83 test ! -f '$(DESTDIR)/$(file)-prefix/foo/nobase.h'
84 test -f '$(DESTDIR)/$(file)-prefix/foo/base.h'
85 test -f '$(DESTDIR)/$(file)-prefix/foo/sub/nobase.dat'
86 test ! -f '$(DESTDIR)/$(file)-prefix/foo/nobase.dat'
87 test -f '$(DESTDIR)/$(file)-prefix/foo/base.dat'
88 test -f '$(DESTDIR)/$(file)-prefix/foo/sub/nobase.sh'
89 test ! -f '$(DESTDIR)/$(file)-prefix/foo/nobase.sh'
90 test -f '$(DESTDIR)/$(file)-prefix/foo/base.sh'
91 test -f '$(DESTDIR)/$(file)-prefix/foo/sub/nobase$(EXEEXT)'
92 test ! -f '$(DESTDIR)/$(file)-prefix/foo/nobase$(EXEEXT)'
93 test -f '$(DESTDIR)/$(file)-prefix/foo/base$(EXEEXT)'
94 test -f '$(DESTDIR)/$(file)-prefix/foo/sub/libnobase.a'
95 test ! -f '$(DESTDIR)/$(file)-prefix/foo/libnobase.a'
96 test -f '$(DESTDIR)/$(file)-prefix/foo/libbase.a'
97 EOF
99 $ACLOCAL
100 $AUTOCONF
101 $AUTOMAKE -a
103 # Some control characters that are white space:
104 # back space, carriage return, form feed, horizontal tab, line feed, space
105 bs='\b'
106 cr=' '
107 ff='\f'
108 ht=' '
109 lf='
111 sp=' '
113 build_failures=
114 install_failures=
116 for file in \
117 '!' '"' '#' '$' '%' '&' \' '(' ')' '*' '+' ',' '-' ':' ';' \
118 '<' '=' '>' '?' '@' '[' '\' ']' '^' '`' '{' '|' '}' '~' \
119 "$bs" "$cr" "$ff" "$ht" "$lf" "$sp" \
120 '@<:@' '@:>@' '@S|@' '@%:@' '@&t@' \
121 "a${sp}b" "a${sp}${sp}b" "a${lf}b" ... a:
123 for test in build install; do
124 case $test in
125 build)
126 build=$file
127 dest=`pwd`/sub1;;
128 install)
129 build=sub1
130 dest=`pwd`/$file;;
131 esac
133 # Make sure this system supports this character in file names.
134 mkdir sub1 "./$file" || Exit 77
136 cd "$build"
138 ../configure --prefix "/$file-prefix" &&
139 $MAKE &&
140 DESTDIR=$dest file=$file $MAKE -e test-install-sep ||
141 eval "${test}_failures=\"\$${test}_failures$lf\$file\""
143 cd ..
145 rm -fr sub1 "./$file"
146 done
147 done
149 # The list of the above file names that cannot be used as a build directory
150 # on a POSIX host. This list should be empty, but is not due to limitations
151 # in Autoconf, Automake, Make, M4, or the shell.
152 expected_build_failures='
157 '\''
160 '"$lf"'
161 @&t@
162 a'"${lf}"'b'
164 # Similarly, the list of file names that cannot be used as an install directory
165 # on a POSIX host. This list should also be empty.
166 expected_install_failures='
170 '\''
172 '"$lf"'
173 a'"${lf}"'b'
175 fail=0
176 for test in build install; do
177 eval failures=\$${test}_failures
178 case $failures in
180 cat >&2 <<EOF
181 $0: $test test failed for the following file names:$failures
183 eval test \"\$failures\" = \"\$expected_${test}_failures\" || fail=1
184 esac
185 done
187 Exit $fail