2 # Copyright (C) 2001-2012 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 2, or (at your option)
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 # Test installation with substitutions. This test is based on nobase.test.
22 cat >> configure.ac <<'EOF'
26 if test x"$doit" = x"yes"; then
27 AC_SUBST([basehdr], [sub/base.h])
28 AC_SUBST([nobasehdr], [sub/nobase.h])
29 AC_SUBST([basedata], [sub/base.dat])
30 AC_SUBST([nobasedata], [sub/nobase.dat])
31 AC_SUBST([basescript], [sub/base.sh])
32 AC_SUBST([nobasescript], [sub/nobase.sh])
33 AC_SUBST([baseprog], ['sub/base$(EXEEXT)'])
34 AC_SUBST([nobaseprog], ['sub/nobase$(EXEEXT)'])
35 AC_SUBST([baselib], [sub/libbase.a])
36 AC_SUBST([nobaselib], [sub/libnobase.a])
41 cat > Makefile.am << 'EOF'
42 foodir = $(prefix)/foo
43 fooexecdir = $(prefix)/foo
45 foo_HEADERS = @basehdr@
46 nobase_foo_HEADERS = @nobasehdr@
47 EXTRA_HEADERS = sub/base.h sub/nobase.h
49 dist_foo_DATA = @basedata@
50 nobase_dist_foo_DATA = @nobasedata@
52 dist_fooexec_SCRIPTS = @basescript@
53 nobase_dist_fooexec_SCRIPTS = @nobasescript@
54 EXTRA_SCRIPTS = sub/base.sh sub/nobase.sh
56 fooexec_PROGRAMS = @baseprog@
57 nobase_fooexec_PROGRAMS = @nobaseprog@
58 EXTRA_PROGRAMS = sub/base sub/nobase
59 sub_base_SOURCES = source.c
60 sub_nobase_SOURCES = source.c
62 fooexec_LIBRARIES = @baselib@
63 nobase_fooexec_LIBRARIES = @nobaselib@
64 EXTRA_LIBRARIES = sub/libbase.a sub/libnobase.a
65 sub_libbase_a_SOURCES = source.c
66 sub_libnobase_a_SOURCES = source.c
68 test-install-data: install-data
69 test -f inst/foo/sub/nobase.h
70 test ! -f inst/foo/nobase.h
71 test -f inst/foo/base.h
72 test -f inst/foo/sub/nobase.dat
73 test ! -f inst/foo/nobase.dat
74 test -f inst/foo/base.dat
75 test ! -f inst/foo/sub/pnobase.sh
76 test ! -f inst/foo/pbase.sh
77 test ! -f inst/foo/sub/pnobase$(EXEEXT)
78 test ! -f inst/foo/pbase$(EXEEXT)
79 test ! -f inst/foo/sub/libnobase.a
80 test ! -f inst/foo/libbase.a
82 test-install-exec: install-exec
83 test -f inst/foo/sub/pnobase.sh
84 test ! -f inst/foo/pnobase.sh
85 test -f inst/foo/pbase.sh
86 test -f inst/foo/sub/pnobase$(EXEEXT)
87 test ! -f inst/foo/pnobase$(EXEEXT)
88 test -f inst/foo/pbase$(EXEEXT)
89 test -f inst/foo/sub/libnobase.a
90 test ! -f inst/foo/libnobase.a
91 test -f inst/foo/libbase.a
93 test-install-nothing-data: install-data
94 test ! -f inst/foo/sub/nobase.h
95 test ! -f inst/foo/nobase.h
96 test ! -f inst/foo/base.h
97 test ! -f inst/foo/sub/nobase.dat
98 test ! -f inst/foo/nobase.dat
99 test ! -f inst/foo/base.dat
100 test ! -f inst/foo/sub/pnobase.sh
101 test ! -f inst/foo/pbase.sh
102 test ! -f inst/foo/sub/pnobase$(EXEEXT)
103 test ! -f inst/foo/pbase$(EXEEXT)
104 test ! -f inst/foo/sub/libnobase.a
105 test ! -f inst/foo/libbase.a
107 test-install-nothing-exec: install-exec
108 test ! -f inst/foo/sub/pnobase.sh
109 test ! -f inst/foo/pnobase.sh
110 test ! -f inst/foo/pbase.sh
111 test ! -f inst/foo/sub/pnobase$(EXEEXT)
112 test ! -f inst/foo/pnobase$(EXEEXT)
113 test ! -f inst/foo/pbase$(EXEEXT)
114 test ! -f inst/foo/sub/libnobase.a
115 test ! -f inst/foo/libnobase.a
116 test ! -f inst/foo/libbase.a
128 cat >source.c <<'EOF'
130 main (int argc, char *argv[])
135 cp source.c source2.c
142 ./configure --prefix "$(pwd)/inst" --program-prefix=p doit=yes
145 $MAKE test-install-data
146 $MAKE test-install-exec
150 test $(find inst/foo -type f -print | wc -l) -eq 0
152 ./configure --prefix "$(pwd)/inst" --program-prefix=p doit=no
155 $MAKE test-install-nothing-data
156 $MAKE test-install-nothing-exec
160 # Likewise, in a VPATH build.
165 ../configure --prefix "$(pwd)/inst" --program-prefix=p doit=yes
167 $MAKE test-install-data
168 $MAKE test-install-exec
170 test $(find inst/foo -type f -print | wc -l) -eq 0
172 ../configure --prefix "$(pwd)/inst" --program-prefix=p doit=no
174 $MAKE test-install-nothing-data
175 $MAKE test-install-nothing-exec