You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by ka...@apache.org on 2018/09/03 22:14:39 UTC
[mesos] 04/04: Replaced javah with `javac -c` for newer JDKs.
This is an automated email from the ASF dual-hosted git repository.
kapil pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mesos.git
commit 06301a830aa57d99c350f5f241f85450baf74b29
Author: Kapil Arya <ka...@mesosphere.io>
AuthorDate: Mon Sep 3 12:57:46 2018 -0400
Replaced javah with `javac -c` for newer JDKs.
Starting with JDK 10, javah is not available. The substitute is to use
`javac -h` for generating headers.
Review: https://reviews.apache.org/r/68613
---
configure.ac | 2 ++
src/Makefile.am | 14 ++++++++++++--
2 files changed, 14 insertions(+), 2 deletions(-)
diff --git a/configure.ac b/configure.ac
index 726348a..556a3b0 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1423,6 +1423,8 @@ has been correctly installed.
fi
AM_CONDITIONAL([HAS_JAVA], [test "x$has_java" = "xyes"])
+AC_PATH_PROG([JAVAH], [javah], [$JAVAH], [$JAVA_HOME/bin])
+AM_CONDITIONAL([HAS_JAVAH], [test -n "x$JAVAH" != "x"])
# Check if LevelDB prefix path was supplied and if so, add it to
diff --git a/src/Makefile.am b/src/Makefile.am
index 0c3d22c..0a9eeab 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -2009,12 +2009,22 @@ nodist_libjava_la_SOURCES = \
BUILT_SOURCES += $(nodist_libjava_la_SOURCES)
# The automatic variable '$(*F)' captures the matching stem (whatever matches
-# the '%') of the target (e.g., 'org_apache_mesos_Log'). We then substitute
-# '_' with '.' to get the class name (e.g., org.apache.mesos.Log).
+# the '%') of the target (e.g., 'org_apache_mesos_Log').
+# * For 'javah' recipe, we then substitute '_' with '.' to get the class name
+# (e.g., org.apache.mesos.Log).
+# * For 'javac -h' recipe, we substitute '_' with '/' to compute the source path
+# of the java file. Unlike 'javah', 'javac -h' requires java sources to
+# generate headers.
java/jni/%.h: $(MESOS_JAR)
+if HAS_JAVAH
$(JAVA_HOME)/bin/javah -d java/jni \
-classpath $(MESOS_JAR):@PROTOBUF_JAR@ \
$(subst _,.,$(*F))
+else
+ $(JAVA_HOME)/bin/javac -h java/jni \
+ -classpath $(MESOS_JAR):@PROTOBUF_JAR@ \
+ $(srcdir)/java/src/$(subst _,/,$(*F)).java
+endif
$(EXAMPLES_JAR): $(EXAMPLES_SOURCE)
@echo "Building examples.jar ..."