summaryrefslogtreecommitdiffstats
path: root/debian/patches/disable-java-in-odk-build-examples-on-zero-vm.diff
blob: 1935360924b23bd4d140121e27e1ff41ed9a0961 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
diff --git a/config_host.mk.in b/config_host.mk.in
index 8cbbc5fee1d5..40e37643a0ea 100644
--- a/config_host.mk.in
+++ b/config_host.mk.in
@@ -282,6 +282,7 @@ export JAVAFLAGS=@JAVAFLAGS@
 export JAVAIFLAGS=@JAVAIFLAGS@
 export JAVA_CLASSPATH_NOT_SET=@JAVA_CLASSPATH_NOT_SET@
 export JAVAINTERPRETER=@JAVAINTERPRETER@
+export JAVA_HAS_ZERO_VM=@JAVA_HAS_ZERO_VM@
 export JAVA_HOME=@JAVA_HOME@
 export JAVA_SOURCE_VER=@JAVA_SOURCE_VER@
 export JAVA_TARGET_VER=@JAVA_TARGET_VER@
diff --git a/configure.ac b/configure.ac
index e6bfb13ebab8..3b7f0a2e1121 100644
--- a/configure.ac
+++ b/configure.ac
@@ -6675,6 +6675,14 @@ you must use the "--with-jdk-home" configure option explicitly])
             JAVAIFLAGS=-Xmx64M
             # set to limit VM usage for javac
             JAVAFLAGS=-J-Xmx128M
+
+            AC_MSG_CHECKING([whether $JAVAINTERPRETER is using the Zero VM])
+	    if $JAVAINTERPRETER -version 2>&1 | grep -q Zero; then
+		JAVA_HAS_ZERO_VM=y
+               AC_MSG_RESULT([yes])
+           else
+               AC_MSG_RESULT([no])
+            fi
         fi
     else
         AC_MSG_ERROR([Java not found. You need at least JDK 9])
@@ -6684,6 +6689,7 @@ else
     JAVA_HOME=
     export JAVA_HOME
 fi
+AC_SUBST(JAVA_HAS_ZERO_VM)
 
 dnl ===================================================================
 dnl Checks for javac
diff --git a/odk/Module_odk.mk b/odk/Module_odk.mk
index 410f8cf8ef1e..bd05d4bba200 100644
--- a/odk/Module_odk.mk
+++ b/odk/Module_odk.mk
@@ -60,10 +62,14 @@ $(eval $(call gb_Module_add_check_targets,odk,\
 ifneq ($(filter $(OS),LINUX MACOSX),)
 $(eval $(call gb_Module_add_subsequentcheck_targets,odk, \
     CustomTarget_build-examples \
+))
+ifneq ($(JAVA_HAS_ZERO_VM),y)
+$(eval $(call gb_Module_add_subsequentcheck_targets,odk, \
     $(if $(ENABLE_JAVA),\
         CustomTarget_build-examples_java \
     ) \
 ))
 endif
+endif
 
 # vim: set noet sw=4 ts=4: