Skip to content

Commit e5c63e7

Browse files
RandomDSdevelggouaillardet
authored andcommitted
config/opal_setup_java.m4: Improve JDK tool path resolution on OS X/macOS.
Also avoid picking up Apple's Java shims via the sym. links to them in `/usr/bin` on systems where any one of them could possibly exhibit behavior that is erratic and, to some extent, likely to be incorrect nowadays (cf.: - https://www.mail-archive.com/[email protected]/msg20551.html - open-mpi#5015 (comment) - the last part of open-mpi#5015 (comment) - open-mpi#5015 (comment) for more detailed context.) Works alongside open-mpi#5001 to close open-mpi#5000. Signed-off-by: Bryce Glover <[email protected]> (cherry picked from commit open-mpi/ompi@8c32cd8)
1 parent 5544367 commit e5c63e7

File tree

1 file changed

+18
-7
lines changed

1 file changed

+18
-7
lines changed

config/opal_setup_java.m4

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -93,18 +93,29 @@ AC_DEFUN([OPAL_SETUP_JAVA],[
9393
# hard-code a few of the common ones so that users don't have to
9494
# specify --with-java-<foo>=LONG_ANNOYING_DIRECTORY.
9595
AS_IF([test -z "$with_jdk_bindir"],
96-
[ # OS X Snow Leopard and Lion (10.6 and 10.7 -- did not
97-
# check prior versions)
96+
[ # OS X/macOS
9897
opal_java_found=0
98+
# The following logic was deliberately decided upon in https://github.com/open-mpi/ompi/pull/5015 specifically to prevent this script and the
99+
# rest of Open MPI's build system from getting confused by the somewhat unorthodox Java toolchain layout present on OS X/macOS systems, described
100+
# in depth by https://github.com/open-mpi/ompi/pull/5015#issuecomment-379324639, and mishandling OS X/macOS Java toolchain path
101+
# detection as a result.
99102
AS_IF([test -x /usr/libexec/java_home],
100-
[opal_java_dir=`/usr/libexec/java_home`/include],
101-
[opal_java_dir=/System/Library/Frameworks/JavaVM.framework/Versions/Current/Headers])
102-
AC_MSG_CHECKING([OSX locations])
103+
[opal_java_dir=`/usr/libexec/java_home`],
104+
[opal_java_dir=/System/Library/Frameworks/JavaVM.framework/Versions/Current])
105+
AC_MSG_CHECKING([OS X/macOS locations])
103106
AS_IF([test -d $opal_java_dir],
104107
[AC_MSG_RESULT([found ($opal_java_dir)])
105108
opal_java_found=1
106-
with_jdk_headers=$opal_java_dir
107-
with_jdk_bindir=/usr/bin],
109+
if test -d "$opal_java_dir/Headers" && test -d "$opal_java_dir/Commands"; then
110+
with_jdk_headers=$opal_java_dir/Headers
111+
with_jdk_bindir=$opal_java_dir/Commands
112+
elif test -d "$opal_java_dir/include" && test -d "$opal_java_dir/bin"; then
113+
with_jdk_headers=$opal_java_dir/include
114+
with_jdk_bindir=$opal_java_dir/bin
115+
else
116+
AC_MSG_WARN([No recognized directory structure found under $opal_java_dir])
117+
AC_MSG_ERROR([Cannot continue])
118+
fi],
108119
[AC_MSG_RESULT([not found])])
109120

110121
if test "$opal_java_found" = "0"; then

0 commit comments

Comments
 (0)