tests: Let 'ltorder.sh' run successfully with Guix dynamic loader
[automake.git] / t / java-extra.sh
blobc10fed09803c8ba6185f105b0dc32bd568f58079
1 #! /bin/sh
2 # Copyright (C) 2011-2018 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 <https://www.gnu.org/licenses/>.
17 # Check use of EXTRA with the JAVA primary. Also test interaction
18 # of JAVA with conditionals (it's natural to test it here, since
19 # EXTRA_JAVA exists mostly for ensuring interoperation with Automake
20 # conditionals).
22 required=javac
23 . test-init.sh
25 cat >> configure.ac << 'END'
26 AM_CONDITIONAL([COND], [test x"$cond" = x"yes"])
27 AC_OUTPUT
28 END
30 cat > Makefile.am << 'END'
31 javadir = $(pkgdatadir)/java
33 EXTRA_JAVA = Class1.java Class2.java Class3.java
35 java_JAVA = Class1.java
37 if COND
38 java_JAVA += Class2.java
39 else !COND
40 java_JAVA += Class3.java
41 endif !COND
43 Class3.java: Makefile
44 echo 'class Class3 {}' > $@
45 CLEANFILES = Class3.java
46 END
48 echo "class Class1 {}" > Class1.java
49 echo "class Class2 {}" > Class2.java
51 $ACLOCAL
52 $AUTOCONF
53 $AUTOMAKE
55 ./configure cond=yes
56 $MAKE
57 ls -l
58 test -f Class1.class
59 test -f Class2.class
60 test ! -e Class3.class
61 test ! -e Class3.java
63 $MAKE distclean
65 ./configure cond=no
66 $MAKE
67 ls -l
68 test -f Class1.class
69 test ! -e Class2.class
70 test -f Class3.class
71 test -f Class3.java