Merge branch 'msvc' into maint
[platform/upstream/automake.git] / tests / java-compile-install.test
1 #! /bin/sh
2 # Copyright (C) 2011 Free Software Foundation, Inc.
3 #
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.
8 #
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.
13 #
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/>.
16
17 # Test on compilation and installation of Java class files.
18
19 required=javac
20 . ./defs || Exit 1
21
22 set -e
23
24 cat >>configure.in <<'EOF'
25 AC_OUTPUT
26 EOF
27
28 cat > Makefile.am << 'END'
29 javadir = $(datadir)/java
30 java_JAVA = Foo.java
31 nobase_java_JAVA = Foo2.java
32 nobase_dist_java_JAVA = Bar.java
33 nodist_java_JAVA = Baz.java
34
35 # Java files are not distributed by default, so we distribute
36 # one "by hand" ...
37 EXTRA_DIST = Foo.java
38 # ... and make the other one generated.
39 Foo2.java:
40         rm -f $@ $@-t
41         echo 'class bClass {}' > $@-t
42         chmod a-w $@-t && mv -f $@-t $@
43
44 # Explicitly declared as `nodist_', so generate it.
45 Baz.java:
46         rm -f $@ $@-t
47         echo 'class Baz {}' > $@-t
48         echo 'class Baz2 {}' >> $@-t
49         chmod a-w $@-t && mv -f $@-t $@
50
51 test:
52         ls -l $(srcdir) . ;: For debugging.
53         test   -f $(srcdir)/Foo.java
54         test   -f $(srcdir)/Bar.java
55         test   -f Foo2.java
56         test   -f Baz.java
57         test   -f aClass.class
58         test   -f bClass.class
59         test   -f Zardoz.class
60         test   -f Baz.class
61         test   -f Baz2.class
62         test ! -r Foo.class
63         test ! -r Bar.class
64         test   -f classjava.stamp
65
66 test-install:
67         ls -l $(javadir) ;: For debugging.
68         test   -f '$(javadir)/bClass.class'
69         test   -f '$(javadir)/aClass.class'
70         test   -f '$(javadir)/Zardoz.class'
71         test   -f '$(javadir)/Baz.class'
72         test   -f '$(javadir)/Baz2.class'
73         test ! -r '$(javadir)/Foo.class'
74         test ! -r '$(javadir)/Bar.class'
75         if find $(prefix) | grep '\.stamp$$'; then exit 1; else :; fi
76
77 check-local: test
78 installcheck-local: test-install
79
80 .PHONY: test test-install
81
82 DISTCLEANFILES = Baz.java Foo2.java
83 END
84
85 echo 'class aClass {}' > Foo.java
86 echo 'class Zardoz {}' > Bar.java
87
88 $ACLOCAL
89 $AUTOCONF
90 $AUTOMAKE
91
92 ./configure --prefix="`pwd`"/_inst
93 $MAKE
94 $MAKE test
95 $MAKE install
96 $MAKE test-install
97 $MAKE distcheck
98
99 :