java: support OpenJDK 10+

Starting OpenJDK 10, the 'javah' utility is no more provided [1], and
its functionality is provided by 'javac' itself.  Hence, do not error
out on missing 'javah', and store whether it was found; in case it is
not, then:
1) assume 'javac' has the -h parameter to generate the C header, and
   make use of it
2) tell the buildsystem that com_redhat_et_libguestfs_GuestFS.h depends
   on the JAR, since the the header is generated at the step (1)

[1] https://bugs.java.com/view_bug.do?bug_id=JDK-8182758

(cherry picked from commit 662dc5d0bf)
This commit is contained in:
Pino Toscano
2018-05-04 17:04:42 +02:00
committed by Richard W.M. Jones
parent a184abae9e
commit 80acac8662
2 changed files with 13 additions and 3 deletions

View File

@@ -77,6 +77,9 @@ if HAVE_JAVA
JAVAC_FLAGS = $(EXTRA_JAVAC_FLAGS) -encoding utf-8
JAVADOC_FLAGS = -encoding utf-8
if !HAVE_JAVAH
JAVAC_FLAGS += -h .
endif
# Java source.
@@ -125,10 +128,18 @@ libguestfs_jni_la_LDFLAGS = -version-info $(JNI_VERSION_INFO) -shared
BUILT_SOURCES = com_redhat_et_libguestfs_GuestFS.h
if HAVE_JAVAH
com_redhat_et_libguestfs_GuestFS.h: $(java_prefix)/GuestFS.class
rm -f $@
$(JAVAH) -classpath $(srcdir):. com.redhat.et.libguestfs.GuestFS
else
com_redhat_et_libguestfs_GuestFS.h: libguestfs-${VERSION}.jar
endif
# Documentation.
noinst_SCRIPTS = doc-stamp