On Fri, May 04, 2018 at 05:04:42PM +0200, Pino Toscano wrote: > 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 > --- > java/Makefile.am | 11 +++++++++++ > m4/guestfs-java.m4 | 5 ++--- > 2 files changed, 13 insertions(+), 3 deletions(-) > > diff --git a/java/Makefile.am b/java/Makefile.am > index 376d89d17..81c20f266 100644 > --- a/java/Makefile.am > +++ b/java/Makefile.am > @@ -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 > diff --git a/m4/guestfs-java.m4 b/m4/guestfs-java.m4 > index 9d0f948b6..2ab932ac4 100644 > --- a/m4/guestfs-java.m4 > +++ b/m4/guestfs-java.m4 > @@ -73,9 +73,7 @@ if test "x$with_java" != "xno"; then > else > JAVAC="$JAVA/bin/javac" > fi > - if test ! -x "$JAVA/bin/javah"; then > - AC_MSG_ERROR([missing $JAVA/bin/javah binary]) > - else > + if test -x "$JAVA/bin/javah"; then > JAVAH="$JAVA/bin/javah" > fi > if test ! -x "$JAVA/bin/javadoc"; then > @@ -163,6 +161,7 @@ if test "x$with_java" != "xno"; then > AC_SUBST(JAR_INSTALL_DIR) > AC_SUBST(JNI_INSTALL_DIR) > AC_SUBST(JNI_VERSION_INFO) > + AM_CONDITIONAL([HAVE_JAVAH],[test -n "$JAVAH"]) > fi > > AM_CONDITIONAL([HAVE_JAVA],[test "x$with_java" != "xno" && test -n "$JAVAC"]) > -- > 2.14.3
ACK, although perhaps another way to write this would be to have the configure script define JAVAH as ‘javac -h’. Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com virt-p2v converts physical machines to virtual machines. Boot with a live CD or over the network (PXE) and turn machines into KVM guests. http://libguestfs.org/virt-v2v _______________________________________________ Libguestfs mailing list [email protected] https://www.redhat.com/mailman/listinfo/libguestfs
