tests: never source test-defs.sh directly, source test-lib.sh instead
[automake.git] / t / nobase.sh
blob1432d8dbeb08c38a885bc8fd3093dbe5f493b4f3
1 #! /bin/sh
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)
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 # Make sure nobase_* works.
19 required=cc
20 . ./defs || exit 1
22 cat >> configure.ac <<'EOF'
23 AC_PROG_CC
24 AM_PROG_AR
25 AC_PROG_RANLIB
26 AC_OUTPUT
27 EOF
29 cat > Makefile.am << 'EOF'
30 foodir = $(prefix)/foo
31 fooexecdir = $(prefix)/foo
33 foo_HEADERS = sub/base.h sub/base-gen.h
34 nobase_foo_HEADERS = sub/nobase.h sub/nobase-gen.h
36 dist_foo_DATA = sub/base.dat sub/base-gen.dat
37 nobase_dist_foo_DATA = sub/nobase.dat sub/nobase-gen.dat
39 dist_fooexec_SCRIPTS = sub/base.sh sub/base-gen.sh
40 nobase_dist_fooexec_SCRIPTS = sub/nobase.sh sub/nobase-gen.sh
42 fooexec_PROGRAMS = sub/base
43 nobase_fooexec_PROGRAMS = sub/nobase
44 sub_base_SOURCES = source.c
45 sub_nobase_SOURCES = source.c
47 fooexec_LIBRARIES = sub/libbase.a
48 nobase_fooexec_LIBRARIES = sub/libnobase.a
49 sub_libbase_a_SOURCES = source.c
50 sub_libnobase_a_SOURCES = source.c
52 generated_files = sub/base-gen.h sub/nobase-gen.h sub/base-gen.dat \
53 sub/nobase-gen.dat sub/base-gen.sh sub/nobase-gen.sh
55 $(generated_files):
56 $(MKDIR_P) sub
57 echo "generated file $@" > $@
59 CLEANFILES = $(generated_files)
61 test-install-data: install-data
62 test -f inst/foo/sub/nobase.h
63 test ! -f inst/foo/nobase.h
64 test -f inst/foo/sub/nobase-gen.h
65 test ! -f inst/foo/nobase-gen.h
66 test -f inst/foo/base.h
67 test -f inst/foo/base-gen.h
68 test -f inst/foo/sub/nobase.dat
69 test ! -f inst/foo/nobase.dat
70 test -f inst/foo/sub/nobase-gen.dat
71 test ! -f inst/foo/nobase-gen.dat
72 test -f inst/foo/base.dat
73 test -f inst/foo/base-gen.dat
74 test ! -f inst/foo/sub/pnobase.sh
75 test ! -f inst/foo/sub/pnobase-gen.sh
76 test ! -f inst/foo/pbase.sh
77 test ! -f inst/foo/pbase-gen.sh
78 test ! -f inst/foo/sub/pnobase$(EXEEXT)
79 test ! -f inst/foo/pbase$(EXEEXT)
80 test ! -f inst/foo/sub/libnobase.a
81 test ! -f inst/foo/libbase.a
83 test-install-exec: install-exec
84 test -f inst/foo/sub/pnobase.sh
85 test ! -f inst/foo/pnobase.sh
86 test -f inst/foo/sub/pnobase-gen.sh
87 test ! -f inst/foo/pnobase-gen.sh
88 test -f inst/foo/pbase.sh
89 test -f inst/foo/pbase-gen.sh
90 test -f inst/foo/sub/pnobase$(EXEEXT)
91 test ! -f inst/foo/pnobase$(EXEEXT)
92 test -f inst/foo/pbase$(EXEEXT)
93 test -f inst/foo/sub/libnobase.a
94 test ! -f inst/foo/libnobase.a
95 test -f inst/foo/libbase.a
97 .PHONY: test-install-exec test-install-data
98 EOF
100 mkdir sub
102 : > sub/base.h
103 : > sub/nobase.h
104 : > sub/base.dat
105 : > sub/nobase.dat
106 : > sub/base.sh
107 : > sub/nobase.sh
109 cat >source.c <<'EOF'
111 main (int argc, char *argv[])
113 return 0;
116 cp source.c source2.c
118 rm -f install-sh
120 $ACLOCAL
121 $AUTOCONF
122 $AUTOMAKE -a --copy
123 ./configure --prefix "$(pwd)/inst" --program-prefix=p
125 $MAKE
126 $MAKE test-install-data
127 $MAKE test-install-exec
128 $MAKE uninstall
130 test $(find inst/foo -type f -print | wc -l) -eq 0
132 $MAKE install-strip
134 # Likewise, in a VPATH build.
136 $MAKE uninstall
137 $MAKE distclean
138 mkdir build
139 cd build
140 ../configure --prefix "$(pwd)/inst" --program-prefix=p
141 $MAKE
142 $MAKE test-install-data
143 $MAKE test-install-exec
144 $MAKE uninstall
145 test $(find inst/foo -type f -print | wc -l) -eq 0