Clarify overriding of `*_DEPENDENCIES' in LIBOBJS node.
[automake/ericb.git] / tests / subst3.test
blob2f01908a0259ea90aeabb46fd12bf2b8fe4caf75
1 #! /bin/sh
2 # Copyright (C) 2001, 2002, 2004, 2005, 2006, 2007, 2008 Free Software
3 # Foundation, Inc.
5 # This program is free software; you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License as published by
7 # the Free Software Foundation; either version 3, or (at your option)
8 # any later version.
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU General Public License for more details.
15 # You should have received a copy of the GNU General Public License
16 # along with this program. If not, see <http://www.gnu.org/licenses/>.
18 # Test installation with substitutions. This test is based on nobase.test.
20 required='gcc'
21 . ./defs || Exit 1
23 set -e
25 cat >> configure.in <<'EOF'
26 AC_PROG_CC
27 AC_PROG_RANLIB
28 if test -n "$doit"; then
29 AC_SUBST([basehdr], [sub/base.h])
30 AC_SUBST([nobasehdr], [sub/nobase.h])
31 AC_SUBST([basedata], [sub/base.dat])
32 AC_SUBST([nobasedata], [sub/nobase.dat])
33 AC_SUBST([basescript], [sub/base.sh])
34 AC_SUBST([nobasescript], [sub/nobase.sh])
35 AC_SUBST([baseprog], ['sub/base$(EXEEXT)'])
36 AC_SUBST([nobaseprog], ['sub/nobase$(EXEEXT)'])
37 AC_SUBST([baselib], [sub/libbase.a])
38 AC_SUBST([nobaselib], [sub/libnobase.a])
40 AC_OUTPUT
41 EOF
43 cat > Makefile.am << 'EOF'
44 foodir = $(prefix)/foo
45 fooexecdir = $(prefix)/foo
47 foo_HEADERS = @basehdr@
48 nobase_foo_HEADERS = @nobasehdr@
49 EXTRA_HEADERS = sub/base.h sub/nobase.h
51 dist_foo_DATA = @basedata@
52 nobase_dist_foo_DATA = @nobasedata@
54 dist_fooexec_SCRIPTS = @basescript@
55 nobase_dist_fooexec_SCRIPTS = @nobasescript@
56 EXTRA_SCRIPTS = sub/base.sh sub/nobase.sh
58 fooexec_PROGRAMS = @baseprog@
59 nobase_fooexec_PROGRAMS = @nobaseprog@
60 EXTRA_PROGRAMS = sub/base sub/nobase
61 sub_base_SOURCES = source.c
62 sub_nobase_SOURCES = source.c
64 fooexec_LIBRARIES = @baselib@
65 nobase_fooexec_LIBRARIES = @nobaselib@
66 EXTRA_LIBRARIES = sub/libbase.a sub/libnobase.a
67 sub_libbase_a_SOURCES = source.c
68 sub_libnobase_a_SOURCES = source.c
70 test-install-data: install-data
71 test -f inst/foo/sub/nobase.h
72 test ! -f inst/foo/nobase.h
73 test -f inst/foo/base.h
74 test -f inst/foo/sub/nobase.dat
75 test ! -f inst/foo/nobase.dat
76 test -f inst/foo/base.dat
77 test ! -f inst/foo/sub/pnobase.sh
78 test ! -f inst/foo/pbase.sh
79 test ! -f inst/foo/sub/pnobase$(EXEEXT)
80 test ! -f inst/foo/pbase$(EXEEXT)
81 test ! -f inst/foo/sub/libnobase.a
82 test ! -f inst/foo/libbase.a
84 test-install-exec: install-exec
85 test -f inst/foo/sub/pnobase.sh
86 test ! -f inst/foo/pnobase.sh
87 test -f inst/foo/pbase.sh
88 test -f inst/foo/sub/pnobase$(EXEEXT)
89 test ! -f inst/foo/pnobase$(EXEEXT)
90 test -f inst/foo/pbase$(EXEEXT)
91 test -f inst/foo/sub/libnobase.a
92 test ! -f inst/foo/libnobase.a
93 test -f inst/foo/libbase.a
95 test-install-nothing-data: install-data
96 test ! -f inst/foo/sub/nobase.h
97 test ! -f inst/foo/nobase.h
98 test ! -f inst/foo/base.h
99 test ! -f inst/foo/sub/nobase.dat
100 test ! -f inst/foo/nobase.dat
101 test ! -f inst/foo/base.dat
102 test ! -f inst/foo/sub/pnobase.sh
103 test ! -f inst/foo/pbase.sh
104 test ! -f inst/foo/sub/pnobase$(EXEEXT)
105 test ! -f inst/foo/pbase$(EXEEXT)
106 test ! -f inst/foo/sub/libnobase.a
107 test ! -f inst/foo/libbase.a
109 test-install-nothing-exec: install-exec
110 test ! -f inst/foo/sub/pnobase.sh
111 test ! -f inst/foo/pnobase.sh
112 test ! -f inst/foo/pbase.sh
113 test ! -f inst/foo/sub/pnobase$(EXEEXT)
114 test ! -f inst/foo/pnobase$(EXEEXT)
115 test ! -f inst/foo/pbase$(EXEEXT)
116 test ! -f inst/foo/sub/libnobase.a
117 test ! -f inst/foo/libnobase.a
118 test ! -f inst/foo/libbase.a
121 mkdir sub
123 : > sub/base.h
124 : > sub/nobase.h
125 : > sub/base.dat
126 : > sub/nobase.dat
127 : > sub/base.sh
128 : > sub/nobase.sh
130 cat >source.c <<'EOF'
132 main (int argc, char *argv[])
134 return 0;
137 cp source.c source2.c
139 rm -f install-sh
141 $ACLOCAL
142 $AUTOCONF
143 $AUTOMAKE -a --copy
144 ./configure --prefix "`pwd`/inst" --program-prefix=p doit=yes
146 $MAKE
147 $MAKE test-install-data
148 $MAKE test-install-exec
149 $MAKE uninstall
150 $MAKE clean
152 test `find inst/foo -type f -print | wc -l` = 0
154 ./configure --prefix "`pwd`/inst" --program-prefix=p doit=
156 $MAKE
157 $MAKE test-install-nothing-data
158 $MAKE test-install-nothing-exec
159 $MAKE uninstall
162 # Likewise, in a VPATH build.
164 $MAKE distclean
165 mkdir build
166 cd build
167 ../configure --prefix "`pwd`/inst" --program-prefix=p doit=yes
168 $MAKE
169 $MAKE test-install-data
170 $MAKE test-install-exec
171 $MAKE uninstall
172 test `find inst/foo -type f -print | wc -l` = 0
174 ../configure --prefix "`pwd`/inst" --program-prefix=p doit=
175 $MAKE
176 $MAKE test-install-nothing-data
177 $MAKE test-install-nothing-exec