2 # Copyright (C) 2001, 2002, 2004, 2005, 2006, 2007, 2008 Free Software
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 2, or (at your option)
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.
25 cat >> configure.in <<'EOF'
29 if test -n "$doit"; then
30 AC_SUBST([basehdr], [sub/base.h])
31 AC_SUBST([nobasehdr], [sub/nobase.h])
32 AC_SUBST([basedata], [sub/base.dat])
33 AC_SUBST([nobasedata], [sub/nobase.dat])
34 AC_SUBST([basescript], [sub/base.sh])
35 AC_SUBST([nobasescript], [sub/nobase.sh])
36 AC_SUBST([baseprog], ['sub/base$(EXEEXT)'])
37 AC_SUBST([nobaseprog], ['sub/nobase$(EXEEXT)'])
38 AC_SUBST([baselib], [sub/libbase.a])
39 AC_SUBST([nobaselib], [sub/libnobase.a])
44 cat > Makefile.am << 'EOF'
45 foodir = $(prefix)/foo
46 fooexecdir = $(prefix)/foo
48 foo_HEADERS = @basehdr@
49 nobase_foo_HEADERS = @nobasehdr@
50 EXTRA_HEADERS = sub/base.h sub/nobase.h
52 dist_foo_DATA = @basedata@
53 nobase_dist_foo_DATA = @nobasedata@
55 dist_fooexec_SCRIPTS = @basescript@
56 nobase_dist_fooexec_SCRIPTS = @nobasescript@
57 EXTRA_SCRIPTS = sub/base.sh sub/nobase.sh
59 fooexec_PROGRAMS = @baseprog@
60 nobase_fooexec_PROGRAMS = @nobaseprog@
61 EXTRA_PROGRAMS = sub/base sub/nobase
62 sub_base_SOURCES = source.c
63 sub_nobase_SOURCES = source.c
65 fooexec_LIBRARIES = @baselib@
66 nobase_fooexec_LIBRARIES = @nobaselib@
67 EXTRA_LIBRARIES = sub/libbase.a sub/libnobase.a
68 sub_libbase_a_SOURCES = source.c
69 sub_libnobase_a_SOURCES = source.c
71 test-install-data: install-data
72 test -f inst/foo/sub/nobase.h
73 test ! -f inst/foo/nobase.h
74 test -f inst/foo/base.h
75 test -f inst/foo/sub/nobase.dat
76 test ! -f inst/foo/nobase.dat
77 test -f inst/foo/base.dat
78 test ! -f inst/foo/sub/pnobase.sh
79 test ! -f inst/foo/pbase.sh
80 test ! -f inst/foo/sub/pnobase$(EXEEXT)
81 test ! -f inst/foo/pbase$(EXEEXT)
82 test ! -f inst/foo/sub/libnobase.a
83 test ! -f inst/foo/libbase.a
85 test-install-exec: install-exec
86 test -f inst/foo/sub/pnobase.sh
87 test ! -f inst/foo/pnobase.sh
88 test -f inst/foo/pbase.sh
89 test -f inst/foo/sub/pnobase$(EXEEXT)
90 test ! -f inst/foo/pnobase$(EXEEXT)
91 test -f inst/foo/pbase$(EXEEXT)
92 test -f inst/foo/sub/libnobase.a
93 test ! -f inst/foo/libnobase.a
94 test -f inst/foo/libbase.a
96 test-install-nothing-data: install-data
97 test ! -f inst/foo/sub/nobase.h
98 test ! -f inst/foo/nobase.h
99 test ! -f inst/foo/base.h
100 test ! -f inst/foo/sub/nobase.dat
101 test ! -f inst/foo/nobase.dat
102 test ! -f inst/foo/base.dat
103 test ! -f inst/foo/sub/pnobase.sh
104 test ! -f inst/foo/pbase.sh
105 test ! -f inst/foo/sub/pnobase$(EXEEXT)
106 test ! -f inst/foo/pbase$(EXEEXT)
107 test ! -f inst/foo/sub/libnobase.a
108 test ! -f inst/foo/libbase.a
110 test-install-nothing-exec: install-exec
111 test ! -f inst/foo/sub/pnobase.sh
112 test ! -f inst/foo/pnobase.sh
113 test ! -f inst/foo/pbase.sh
114 test ! -f inst/foo/sub/pnobase$(EXEEXT)
115 test ! -f inst/foo/pnobase$(EXEEXT)
116 test ! -f inst/foo/pbase$(EXEEXT)
117 test ! -f inst/foo/sub/libnobase.a
118 test ! -f inst/foo/libnobase.a
119 test ! -f inst/foo/libbase.a
131 cat >source.c <<'EOF'
133 main (int argc, char *argv[])
138 cp source.c source2.c
145 ./configure --prefix "`pwd`/inst" --program-prefix=p doit=yes
148 $MAKE test-install-data
149 $MAKE test-install-exec
153 test `find inst/foo -type f -print | wc -l` = 0
155 ./configure --prefix "`pwd`/inst" --program-prefix=p doit=
158 $MAKE test-install-nothing-data
159 $MAKE test-install-nothing-exec
163 # Likewise, in a VPATH build.
168 ../configure --prefix "`pwd`/inst" --program-prefix=p doit=yes
170 $MAKE test-install-data
171 $MAKE test-install-exec
173 test `find inst/foo -type f -print | wc -l` = 0
175 ../configure --prefix "`pwd`/inst" --program-prefix=p doit=
177 $MAKE test-install-nothing-data
178 $MAKE test-install-nothing-exec