tests: cosmetic changes in t/extra-sources.sh
[platform/upstream/automake.git] / t / java-empty-classpath.sh
1 #! /bin/sh
2 # Copyright (C) 2011-2013 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 # Java compilation works also when CLASSPATH is unset or empty at
18 # compilation time.  See automake bug#9306.
19
20 required=javac
21 . test-init.sh
22
23 cat >> configure.ac <<'END'
24 AC_CONFIG_SRCDIR([org/gnu/bug/Library.java])
25 AC_CONFIG_FILES([
26     org/Makefile
27     org/gnu/Makefile
28     org/gnu/bug/Makefile
29 ])
30 AC_OUTPUT
31 END
32
33 mkdir org org/gnu org/gnu/bug
34 cat > Makefile.am <<END
35 CLEANFILES = *.class
36 SUBDIRS = org
37 END
38 echo SUBDIRS = gnu > org/Makefile.am
39 echo SUBDIRS = bug > org/gnu/Makefile.am
40 cat > org/gnu/bug/Makefile.am <<'END'
41 JAVAROOT = ../../..
42 dist_noinst_JAVA = Library.java Application.java
43 END
44
45 cat > org/gnu/bug/Library.java <<'END'
46 package org.gnu.bug;
47 public class Library
48 {
49     public Library ()
50     {
51       // Nothing to do.
52     }
53     public static void doSomethingUseful (String arg)
54     {
55       System.out.println (arg);
56     }
57 }
58 END
59
60 cat > org/gnu/bug/Application.java <<'END'
61 import org.gnu.bug.*;
62 public class Application
63 {
64     public static void main (String args[])
65     {
66         Library lib = new Library ();
67         lib.doSomethingUseful ("PLUGH");
68     }
69 }
70 END
71
72 $ACLOCAL
73 $AUTOCONF
74 $AUTOMAKE
75 ./configure
76
77 unset CLASSPATH
78 $MAKE
79 $MAKE clean
80
81 CLASSPATH=''; export CLASSPATH
82 $MAKE
83 $MAKE clean
84
85 unset CLASSPATH
86 $MAKE distcheck
87
88 :