diff --git a/config/opal_setup_java.m4 b/config/opal_setup_java.m4 index 0770546e1e2..1de5b3407be 100644 --- a/config/opal_setup_java.m4 +++ b/config/opal_setup_java.m4 @@ -15,7 +15,7 @@ dnl reserved. dnl Copyright (c) 2007-2012 Oracle and/or its affiliates. All rights reserved. dnl Copyright (c) 2008-2013 Cisco Systems, Inc. All rights reserved. dnl Copyright (c) 2013 Intel, Inc. All rights reserved. -dnl Copyright (c) 2015 Research Organization for Information Science +dnl Copyright (c) 2015-2018 Research Organization for Information Science dnl and Technology (RIST). All rights reserved. dnl Copyright (c) 2017 FUJITSU LIMITED. All rights reserved. dnl $COPYRIGHT$ @@ -37,7 +37,7 @@ AC_DEFUN([OPAL_SETUP_JAVA_BANNER],[ AC_DEFUN([OPAL_SETUP_JAVA],[ AC_REQUIRE([OPAL_SETUP_JAVA_BANNER]) - OPAL_VAR_SCOPE_PUSH([opal_java_bad opal_java_found opal_java_dir opal_java_jnih opal_java_PATH_save opal_java_CPPFLAGS_save]) + OPAL_VAR_SCOPE_PUSH([opal_java_bad opal_javah_happy opal_java_found opal_java_dir opal_java_jnih opal_java_PATH_save opal_java_CPPFLAGS_save]) AC_ARG_ENABLE(java, AC_HELP_STRING([--enable-java], [Enable Java-based support in the system - use this option to disable all Java-based compiler tests (default: enabled)])) @@ -161,13 +161,13 @@ AC_DEFUN([OPAL_SETUP_JAVA],[ AS_IF([test -n "$with_jdk_bindir" && test "$with_jdk_bindir" != "yes" && test "$with_jdk_bindir" != "no"], [PATH="$with_jdk_bindir:$PATH"]) AC_PATH_PROG(JAVAC, javac) - AC_PATH_PROG(JAVAH, javah) AC_PATH_PROG(JAR, jar) AC_PATH_PROG(JAVADOC, javadoc) + AC_PATH_PROG(JAVAH, javah) PATH=$opal_java_PATH_save - # Check to see if we have all 4 programs. - AS_IF([test -z "$JAVAC" || test -z "$JAVAH" || test -z "$JAR" || test -z "$JAVADOC"], + # Check to see if we have all 3 programs. + AS_IF([test -z "$JAVAC" || test -z "$JAR" || test -z "$JAVADOC"], [opal_java_happy=no HAVE_JAVA_SUPPORT=0], [opal_java_happy=yes @@ -178,6 +178,21 @@ AC_DEFUN([OPAL_SETUP_JAVA],[ [opal_java_CPPFLAGS_save=$CPPFLAGS # silence a stupid Mac warning CPPFLAGS="$CPPFLAGS -DTARGET_RT_MAC_CFM=0" + AC_MSG_CHECKING([javac -h]) + cat > Conftest.java << EOF +public final class Conftest { + public native void conftest(); +} +EOF + AS_IF([$JAVAC -d . -h . Conftest.java > /dev/null 2>&1], + [AC_MSG_RESULT([yes])], + [AC_MSG_RESULT([no]) + AS_IF([test -n "$JAVAH"], + [opal_javah_happy=yes], + [opal_java_happy=no])]) + rm -f Conftest.java Conftest.class Conftest.h + + AS_IF([test -n "$with_jdk_headers" && test "$with_jdk_headers" != "yes" && test "$with_jdk_headers" != "no"], [OPAL_JDK_CPPFLAGS="-I$with_jdk_headers" # Some flavors of JDK also require -I/linux. @@ -216,5 +231,6 @@ AC_DEFUN([OPAL_SETUP_JAVA],[ AC_DEFINE_UNQUOTED([OPAL_HAVE_JAVA_SUPPORT], [$HAVE_JAVA_SUPPORT], [do we have Java support]) AM_CONDITIONAL(OPAL_HAVE_JAVA_SUPPORT, test "$opal_java_happy" = "yes") + AM_CONDITIONAL(OPAL_HAVE_JAVAH_SUPPORT, test "$opal_javah_happy" = "yes") OPAL_VAR_SCOPE_POP ]) diff --git a/ompi/mpi/java/java/Makefile.am b/ompi/mpi/java/java/Makefile.am index fd12b3e273a..f4b41481b19 100644 --- a/ompi/mpi/java/java/Makefile.am +++ b/ompi/mpi/java/java/Makefile.am @@ -4,6 +4,8 @@ # Copyright (c) 2015 Los Alamos National Security, LLC. All rights # reserved. # Copyright (c) 2017 FUJITSU LIMITED. All rights reserved. +# Copyright (c) 2018 Research Organization for Information Science +# and Technology (RIST). All rights reserved. # $COPYRIGHT$ # # Additional copyrights may follow @@ -74,7 +76,6 @@ if OMPI_WANT_JAVA_BINDINGS # from JAVA_SRC_FILES. JAVA_H = \ mpi_MPI.h \ - mpi_CartParms.h \ mpi_CartComm.h \ mpi_Comm.h \ mpi_Constant.h \ @@ -82,7 +83,6 @@ JAVA_H = \ mpi_Datatype.h \ mpi_Errhandler.h \ mpi_File.h \ - mpi_GraphParms.h \ mpi_GraphComm.h \ mpi_Group.h \ mpi_Info.h \ @@ -92,9 +92,7 @@ JAVA_H = \ mpi_Op.h \ mpi_Prequest.h \ mpi_Request.h \ - mpi_ShiftParms.h \ mpi_Status.h \ - mpi_Version.h \ mpi_Win.h # A little verbosity magic; see Makefile.ompi-rules for an explanation. @@ -140,6 +138,7 @@ ompi__v_JAVADOC_QUIET_0 = -quiet # in. This, along with the fact that the .java files seem to have # circular references, prevents us from using a .foo.bar: generic # Makefile rule. :-( +if OPAL_HAVE_JAVAH_SUPPORT mpi/MPI.class: $(JAVA_SRC_FILES) $(OMPI_V_JAVAC) CLASSPATH=. ; \ export CLASSPATH ; \ @@ -148,11 +147,18 @@ mpi/MPI.class: $(JAVA_SRC_FILES) # Similar to above, all the generated .h files are dependent upon the # token mpi/MPI.class file. Hence, all the classes will be generated # first, then we'll individually generate each of the .h files. + $(JAVA_H): mpi/MPI.class $(OMPI_V_JAVAH) sourcename=mpi.`echo $@ | sed -e s/^mpi_// -e s/.h$$//`; \ CLASSPATH=. ; \ export CLASSPATH ; \ $(JAVAH) -d . -jni $$sourcename +else +mpi/MPI.class: $(JAVA_SRC_FILES) + $(OMPI_V_JAVAC) CLASSPATH=. ; \ + export CLASSPATH ; \ + $(JAVAC) -h . -d . $(top_srcdir)/ompi/mpi/java/java/*.java +endif # OPAL_HAVE_JAVAH_SUPPORT # Generate the .jar file from all the class files. List mpi/MPI.class # as a dependency so that it fires the rule above that will generate @@ -171,7 +177,11 @@ java_DATA = mpi.jar # List all the header files in BUILT_SOURCES so that Automake's "all" # target will build them. This will also force the building of the # mpi/*.class files (for the jar file). +if OPAL_HAVE_JAVAH_SUPPORT BUILT_SOURCES = $(JAVA_H) doc +else +BUILT_SOURCES = mpi/MPI.class doc +endif # Convenience for building Javadoc docs jdoc: doc