Skip to content

Commit 045af83

Browse files
committed
configury: use javac -h when javah cannot be used.
If javah is not present (it has been removed from Java 10) or not usable (/usr/bin/javah symbolic link still exists on OS X), then use javac -h instead of javah. Refs. #5000 Signed-off-by: Gilles Gouaillardet <[email protected]>
1 parent 44a1c78 commit 045af83

File tree

2 files changed

+19
-4
lines changed

2 files changed

+19
-4
lines changed

config/opal_setup_java.m4

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ dnl reserved.
1515
dnl Copyright (c) 2007-2012 Oracle and/or its affiliates. All rights reserved.
1616
dnl Copyright (c) 2008-2013 Cisco Systems, Inc. All rights reserved.
1717
dnl Copyright (c) 2013 Intel, Inc. All rights reserved.
18-
dnl Copyright (c) 2015 Research Organization for Information Science
18+
dnl Copyright (c) 2015-2018 Research Organization for Information Science
1919
dnl and Technology (RIST). All rights reserved.
2020
dnl Copyright (c) 2017 FUJITSU LIMITED. All rights reserved.
2121
dnl $COPYRIGHT$
@@ -37,7 +37,7 @@ AC_DEFUN([OPAL_SETUP_JAVA_BANNER],[
3737
AC_DEFUN([OPAL_SETUP_JAVA],[
3838
AC_REQUIRE([OPAL_SETUP_JAVA_BANNER])
3939

40-
OPAL_VAR_SCOPE_PUSH([opal_java_bad opal_java_found opal_java_dir opal_java_jnih opal_java_PATH_save opal_java_CPPFLAGS_save])
40+
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])
4141
AC_ARG_ENABLE(java,
4242
AC_HELP_STRING([--enable-java],
4343
[Enable Java-based support in the system - use this option to disable all Java-based compiler tests (default: enabled)]))
@@ -165,9 +165,12 @@ AC_DEFUN([OPAL_SETUP_JAVA],[
165165
AC_PATH_PROG(JAR, jar)
166166
AC_PATH_PROG(JAVADOC, javadoc)
167167
PATH=$opal_java_PATH_save
168+
AS_IF([test -n "$JAVAH"],
169+
[AS_IF([$JAVAH -version > /dev/null 2>&1],
170+
[opal_javah_happy=yes])])
168171

169-
# Check to see if we have all 4 programs.
170-
AS_IF([test -z "$JAVAC" || test -z "$JAVAH" || test -z "$JAR" || test -z "$JAVADOC"],
172+
# Check to see if we have all 3 programs.
173+
AS_IF([test -z "$JAVAC" || test -z "$JAR" || test -z "$JAVADOC"],
171174
[opal_java_happy=no
172175
HAVE_JAVA_SUPPORT=0],
173176
[opal_java_happy=yes
@@ -216,5 +219,6 @@ AC_DEFUN([OPAL_SETUP_JAVA],[
216219

217220
AC_DEFINE_UNQUOTED([OPAL_HAVE_JAVA_SUPPORT], [$HAVE_JAVA_SUPPORT], [do we have Java support])
218221
AM_CONDITIONAL(OPAL_HAVE_JAVA_SUPPORT, test "$opal_java_happy" = "yes")
222+
AM_CONDITIONAL(OPAL_HAVE_JAVAH_SUPPORT, test "$opal_javah_happy" = "yes")
219223
OPAL_VAR_SCOPE_POP
220224
])

ompi/mpi/java/java/Makefile.am

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
# Copyright (c) 2015 Los Alamos National Security, LLC. All rights
55
# reserved.
66
# Copyright (c) 2017 FUJITSU LIMITED. All rights reserved.
7+
# Copyright (c) 2018 Research Organization for Information Science
8+
# and Technology (RIST). All rights reserved.
79
# $COPYRIGHT$
810
#
911
# Additional copyrights may follow
@@ -148,11 +150,20 @@ mpi/MPI.class: $(JAVA_SRC_FILES)
148150
# Similar to above, all the generated .h files are dependent upon the
149151
# token mpi/MPI.class file. Hence, all the classes will be generated
150152
# first, then we'll individually generate each of the .h files.
153+
154+
if OPAL_HAVE_JAVAH_SUPPORT
151155
$(JAVA_H): mpi/MPI.class
152156
$(OMPI_V_JAVAH) sourcename=mpi.`echo $@ | sed -e s/^mpi_// -e s/.h$$//`; \
153157
CLASSPATH=. ; \
154158
export CLASSPATH ; \
155159
$(JAVAH) -d . -jni $$sourcename
160+
else
161+
$(JAVA_H): mpi/MPI.class
162+
$(OMPI_V_JAVAC) sourcename=$(top_srcdir)/ompi/mpi/java/java/`echo $@ | sed -e s/^mpi_// -e s/.h$$//`.java; \
163+
CLASSPATH=. ; \
164+
export CLASSPATH ; \
165+
$(JAVAC) -h . $$sourcename
166+
endif # OPAL_HAVE_JAVAH_SUPPORT
156167

157168
# Generate the .jar file from all the class files. List mpi/MPI.class
158169
# as a dependency so that it fires the rule above that will generate

0 commit comments

Comments
 (0)