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