ar-lib: new 'AM_PROG_AR' macro, triggering the 'ar-lib' script
[automake.git] / tests / nobase.test
blobcac8756278246a4acc2fde2f94c7224006377aea
1 #! /bin/sh
2 # Copyright (C) 2001, 2002, 2004, 2005, 2006, 2007, 2008, 2009 Free
3 # Software 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 2, 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 # Make sure nobase_* works.
20 required='gcc'
21 . ./defs || Exit 1
23 set -e
25 cat >> configure.in <<'EOF'
26 AC_PROG_CC
27 AM_PROG_AR
28 AC_PROG_RANLIB
29 AC_OUTPUT
30 EOF
32 cat > Makefile.am << 'EOF'
33 foodir = $(prefix)/foo
34 fooexecdir = $(prefix)/foo
36 foo_HEADERS = sub/base.h sub/base-gen.h
37 nobase_foo_HEADERS = sub/nobase.h sub/nobase-gen.h
39 dist_foo_DATA = sub/base.dat sub/base-gen.dat
40 nobase_dist_foo_DATA = sub/nobase.dat sub/nobase-gen.dat
42 dist_fooexec_SCRIPTS = sub/base.sh sub/base-gen.sh
43 nobase_dist_fooexec_SCRIPTS = sub/nobase.sh sub/nobase-gen.sh
45 fooexec_PROGRAMS = sub/base
46 nobase_fooexec_PROGRAMS = sub/nobase
47 sub_base_SOURCES = source.c
48 sub_nobase_SOURCES = source.c
50 fooexec_LIBRARIES = sub/libbase.a
51 nobase_fooexec_LIBRARIES = sub/libnobase.a
52 sub_libbase_a_SOURCES = source.c
53 sub_libnobase_a_SOURCES = source.c
55 generated_files = sub/base-gen.h sub/nobase-gen.h sub/base-gen.dat \
56 sub/nobase-gen.dat sub/base-gen.sh sub/nobase-gen.sh
58 $(generated_files):
59 $(MKDIR_P) sub
60 echo "generated file $@" > $@
62 CLEANFILES = $(generated_files)
64 test-install-data: install-data
65 test -f inst/foo/sub/nobase.h
66 test ! -f inst/foo/nobase.h
67 test -f inst/foo/sub/nobase-gen.h
68 test ! -f inst/foo/nobase-gen.h
69 test -f inst/foo/base.h
70 test -f inst/foo/base-gen.h
71 test -f inst/foo/sub/nobase.dat
72 test ! -f inst/foo/nobase.dat
73 test -f inst/foo/sub/nobase-gen.dat
74 test ! -f inst/foo/nobase-gen.dat
75 test -f inst/foo/base.dat
76 test -f inst/foo/base-gen.dat
77 test ! -f inst/foo/sub/pnobase.sh
78 test ! -f inst/foo/sub/pnobase-gen.sh
79 test ! -f inst/foo/pbase.sh
80 test ! -f inst/foo/pbase-gen.sh
81 test ! -f inst/foo/sub/pnobase$(EXEEXT)
82 test ! -f inst/foo/pbase$(EXEEXT)
83 test ! -f inst/foo/sub/libnobase.a
84 test ! -f inst/foo/libbase.a
86 test-install-exec: install-exec
87 test -f inst/foo/sub/pnobase.sh
88 test ! -f inst/foo/pnobase.sh
89 test -f inst/foo/sub/pnobase-gen.sh
90 test ! -f inst/foo/pnobase-gen.sh
91 test -f inst/foo/pbase.sh
92 test -f inst/foo/pbase-gen.sh
93 test -f inst/foo/sub/pnobase$(EXEEXT)
94 test ! -f inst/foo/pnobase$(EXEEXT)
95 test -f inst/foo/pbase$(EXEEXT)
96 test -f inst/foo/sub/libnobase.a
97 test ! -f inst/foo/libnobase.a
98 test -f inst/foo/libbase.a
99 EOF
101 mkdir sub
103 : > sub/base.h
104 : > sub/nobase.h
105 : > sub/base.dat
106 : > sub/nobase.dat
107 : > sub/base.sh
108 : > sub/nobase.sh
110 cat >source.c <<'EOF'
112 main (int argc, char *argv[])
114 return 0;
117 cp source.c source2.c
119 rm -f install-sh
121 $ACLOCAL
122 $AUTOCONF
123 $AUTOMAKE -a --copy
124 ./configure --prefix "`pwd`/inst" --program-prefix=p
126 $MAKE
127 $MAKE test-install-data
128 $MAKE test-install-exec
129 $MAKE uninstall
131 test `find inst/foo -type f -print | wc -l` = 0
133 $MAKE install-strip
135 # Likewise, in a VPATH build.
137 $MAKE uninstall
138 $MAKE distclean
139 mkdir build
140 cd build
141 ../configure --prefix "`pwd`/inst" --program-prefix=p
142 $MAKE
143 $MAKE test-install-data
144 $MAKE test-install-exec
145 $MAKE uninstall
146 test `find inst/foo -type f -print | wc -l` = 0