Oops - if we don't want the Java bindings, then we really shouldn't be building them :-/
Also ensure we don't try to build them if no Java support was found, and error out if the user requests the bindings and we didn't find Java support. Add a configure flag to skip the Java tests and just force-set the Java support to "disabled" This commit was SVN r26484.
Этот коммит содержится в:
родитель
88d5e6f2b4
Коммит
31beff6362
@ -91,10 +91,14 @@ SUBDIRS = \
|
||||
$(OMPI_MPIEXT_USEMPIF08_DIRS) \
|
||||
$(OMPI_FORTRAN_USEMPIF08_DIR) \
|
||||
mpi/fortran/mpiext \
|
||||
mpi/java \
|
||||
$(MCA_ompi_FRAMEWORK_COMPONENT_DSO_SUBDIRS) \
|
||||
$(OMPI_CONTRIB_SUBDIRS)
|
||||
|
||||
if OMPI_WANT_JAVA_BINDINGS
|
||||
SUBDIRS += \
|
||||
mpi/java
|
||||
endif
|
||||
|
||||
# The ordering of the DIST_SUBDIRS isn't as important, but note that
|
||||
# its contents *are* different than SUBDIRS. In particular, the
|
||||
# MPIEXT subdirs has a different value that is *not* equivalent to the
|
||||
|
@ -41,8 +41,15 @@ AC_DEFUN([OMPI_SETUP_JAVA_BINDINGS],[
|
||||
AC_HELP_STRING([--enable-mpi-java],
|
||||
[enable Java MPI bindings (default: disabled)]))
|
||||
|
||||
# check for required support
|
||||
if test "$orte_java_happy" = "no" -a "$enable_mpi_java" = "yes"; then
|
||||
AC_MSG_RESULT([yes])
|
||||
AC_MSG_WARN([Java bindings requested but no Java support found])
|
||||
AC_MSG_ERROR([cannot continue])
|
||||
fi
|
||||
|
||||
# Only build the Java bindings if requested
|
||||
if test "$enable_mpi_java" = "yes"; then
|
||||
if test "$orte_java_happy" = "yes" -a "$enable_mpi_java" = "yes"; then
|
||||
AC_MSG_RESULT([yes])
|
||||
WANT_MPI_JAVA_SUPPORT=1
|
||||
AC_MSG_CHECKING([if shared libraries are enabled])
|
||||
|
@ -33,6 +33,10 @@ AC_DEFUN([ORTE_SETUP_JAVA_BANNER],[
|
||||
AC_DEFUN([ORTE_SETUP_JAVA],[
|
||||
AC_REQUIRE([ORTE_SETUP_JAVA_BANNER])
|
||||
|
||||
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)]))
|
||||
|
||||
AC_ARG_WITH(jdk-dir,
|
||||
AC_HELP_STRING([--with-jdk-dir(=DIR)],
|
||||
[Location of the JDK header directory. If you use this option, do not specify --with-jdk-bindir or --with-jdk-headers.]))
|
||||
@ -43,140 +47,147 @@ AC_DEFUN([ORTE_SETUP_JAVA],[
|
||||
AC_HELP_STRING([--with-jdk-headers(=DIR)],
|
||||
[Location of the JDK header directory. If you use this option, you must also use --with-jdk-bindir (and you must NOT use --with-jdk-dir)]))
|
||||
|
||||
# Check for bozo case: ensure a directory was specified
|
||||
AS_IF([test "$with_jdk_dir" = "yes" -o "$with_jdk_dir" = "no"],
|
||||
[AC_MSG_WARN([Must specify a directory name for --with-jdk-dir])
|
||||
AC_MSG_ERROR([Cannot continue])])
|
||||
AS_IF([test "$with_jdk_bindir" = "yes" -o "$with_jdk_bindir" = "no"],
|
||||
[AC_MSG_WARN([Must specify a directory name for --with-jdk-bindir])
|
||||
AC_MSG_ERROR([Cannot continue])])
|
||||
AS_IF([test "$with_jdk_headers" = "yes" -o "$with_jdk_headers" = "no"],
|
||||
[AC_MSG_WARN([Must specify a directory name for --with-jdk-headers])
|
||||
AC_MSG_ERROR([Cannot continue])])
|
||||
|
||||
# Check for bozo case: either specify --with-jdk-dir or
|
||||
# (--with-jdk-bindir, --with-jdk-headers) -- not both.
|
||||
bad=0
|
||||
AS_IF([test -n "$with_jdk_dir" -a -n "$with_jdk_bindir" -o \
|
||||
-n "$with_jdk_dir" -a -n "$with_jdk_headers"],[bad=1])
|
||||
AS_IF([test -z "$with_jdk_bindir" -a -n "$with_jdk_headers" -o \
|
||||
-n "$with_jdk_bindir" -a -z "$with_jdk_headers"],[bad=1])
|
||||
AS_IF([test "$bad" = "1"],
|
||||
[AC_MSG_WARN([Either specify --with-jdk-dir or both of (--with-jdk_bindir, --with-jdk-headers) -- not both.])
|
||||
AC_MSG_ERROR([Cannot continue])])
|
||||
|
||||
AS_IF([test -n "$with_jdk_dir"],
|
||||
[with_jdk_bindir=$with_jdk_dir/bin
|
||||
with_jdk_headers=$with_jdk_dir/include])
|
||||
|
||||
##################################################################
|
||||
# with_jdk_dir can now be ignored; with_jdk_bindir and
|
||||
# with_jdk_headers will be either empty or have valid values.
|
||||
##################################################################
|
||||
|
||||
# Some java installations are in obscure places. So let's
|
||||
# hard-code a few of the common ones so that users don't have to
|
||||
# specify --with-java-<foo>=LONG_ANNOYING_DIRECTORY.
|
||||
AS_IF([test -z "$with_jdk_bindir"],
|
||||
[ # OS X Snow Leopard and Lion (10.6 and 10.7 -- did not
|
||||
# check prior versions)
|
||||
found=0
|
||||
dir=/System/Library/Frameworks/JavaVM.framework/Versions/Current/Headers
|
||||
AC_MSG_CHECKING([OSX locations])
|
||||
AS_IF([test -d $dir],
|
||||
[AC_MSG_RESULT([found])
|
||||
found=1
|
||||
with_jdk_headers=$dir
|
||||
with_jdk_bindir=/usr/bin],
|
||||
[AC_MSG_RESULT([not found])])
|
||||
|
||||
if test "$found" = "0"; then
|
||||
# Various Linux
|
||||
dir='/usr/lib/jvm/java-*-openjdk-*/include/'
|
||||
jnih=`ls $dir/jni.h 2>/dev/null | head -n 1`
|
||||
AC_MSG_CHECKING([Linux locations])
|
||||
AS_IF([test -r "$jnih"],
|
||||
[with_jdk_headers=`dirname $jnih`
|
||||
OPAL_WHICH([javac], [with_jdk_bindir])
|
||||
AS_IF([test -n "$with_jdk_bindir"],
|
||||
[AC_MSG_RESULT([found])
|
||||
found=1
|
||||
with_jdk_bindir=`dirname $with_jdk_bindir`],
|
||||
[with_jdk_headers=])],
|
||||
[dir='/usr/lib/jvm/default-java/include/'
|
||||
jnih=`ls $dir/jni.h 2>/dev/null | head -n 1`
|
||||
AS_IF([test -r "$jnih"],
|
||||
[with_jdk_headers=`dirname $jnih`
|
||||
OPAL_WHICH([javac], [with_jdk_bindir])
|
||||
AS_IF([test -n "$with_jdk_bindir"],
|
||||
[AC_MSG_RESULT([found])
|
||||
found=1
|
||||
with_jdk_bindir=`dirname $with_jdk_bindir`],
|
||||
[with_jdk_headers=])],
|
||||
[AC_MSG_RESULT([not found])])])
|
||||
fi
|
||||
|
||||
if test "$found" = "0"; then
|
||||
# Solaris
|
||||
dir=/usr/java
|
||||
AC_MSG_CHECKING([Solaris locations])
|
||||
AS_IF([test -d $dir -a -r "$dir/include/jni.h"],
|
||||
[AC_MSG_RESULT([found])
|
||||
with_jdk_headers=$dir/include
|
||||
with_jdk_bindir=$dir/bin
|
||||
found=1],
|
||||
[AC_MSG_RESULT([not found])])
|
||||
fi
|
||||
],
|
||||
[found=1])
|
||||
|
||||
if test "$found" = "1"; then
|
||||
OMPI_CHECK_WITHDIR([jdk-bindir], [$with_jdk_bindir], [javac])
|
||||
OMPI_CHECK_WITHDIR([jdk-headers], [$with_jdk_headers], [jni.h])
|
||||
|
||||
# Look for various Java-related programs
|
||||
if test "$enable_java" = "no"; then
|
||||
HAVE_JAVA_SUPPORT=0
|
||||
orte_java_happy=no
|
||||
PATH_save=$PATH
|
||||
AS_IF([test -n "$with_jdk_bindir" -a "$with_jdk_bindir" != "yes" -a "$with_jdk_bindir" != "no"],
|
||||
[PATH="$PATH:$with_jdk_bindir"])
|
||||
AC_PATH_PROG(JAVAC, javac)
|
||||
AC_PATH_PROG(JAVAH, javah)
|
||||
AC_PATH_PROG(JAR, jar)
|
||||
PATH=$PATH_save
|
||||
|
||||
# Check to see if we have all 3 programs.
|
||||
AS_IF([test -z "$JAVAC" -o -z "$JAVAH" -o -z "$JAR"],
|
||||
[orte_java_happy=no
|
||||
HAVE_JAVA_SUPPORT=0],
|
||||
[orte_java_happy=yes
|
||||
HAVE_JAVA_SUPPORT=1])
|
||||
|
||||
# Look for jni.h
|
||||
AS_IF([test "$orte_java_happy" = "yes"],
|
||||
[CPPFLAGS_save=$CPPFLAGS
|
||||
AS_IF([test -n "$with_jdk_headers" -a "$with_jdk_headers" != "yes" -a "$with_jdk_headers" != "no"],
|
||||
[ORTE_JDK_CPPFLAGS="-I$with_jdk_headers"
|
||||
# Some flavors of JDK also require -I<blah>/linux.
|
||||
# See if that's there, and if so, add a -I for that,
|
||||
# too. Ugh.
|
||||
AS_IF([test -d "$with_jdk_headers/linux"],
|
||||
[ORTE_JDK_CPPFLAGS="$ORTE_JDK_CPPFLAGS -I$with_jdk_headers/linux"])
|
||||
# Solaris JDK also require -I<blah>/solaris.
|
||||
# See if that's there, and if so, add a -I for that,
|
||||
# too. Ugh.
|
||||
AS_IF([test -d "$with_jdk_headers/solaris"],
|
||||
[ORTE_JDK_CPPFLAGS="$ORTE_JDK_CPPFLAGS -I$with_jdk_headers/solaris"])
|
||||
|
||||
CPPFLAGS="$CPPFLAGS $ORTE_JDK_CPPFLAGS"])
|
||||
AC_CHECK_HEADER([jni.h], [],
|
||||
[orte_java_happy=no])
|
||||
CPPFLAGS=$CPPFLAGS_save
|
||||
])
|
||||
else
|
||||
orte_java_happy=no;
|
||||
HAVE_JAVA_SUPPORT=no;
|
||||
# Check for bozo case: ensure a directory was specified
|
||||
AS_IF([test "$with_jdk_dir" = "yes" -o "$with_jdk_dir" = "no"],
|
||||
[AC_MSG_WARN([Must specify a directory name for --with-jdk-dir])
|
||||
AC_MSG_ERROR([Cannot continue])])
|
||||
AS_IF([test "$with_jdk_bindir" = "yes" -o "$with_jdk_bindir" = "no"],
|
||||
[AC_MSG_WARN([Must specify a directory name for --with-jdk-bindir])
|
||||
AC_MSG_ERROR([Cannot continue])])
|
||||
AS_IF([test "$with_jdk_headers" = "yes" -o "$with_jdk_headers" = "no"],
|
||||
[AC_MSG_WARN([Must specify a directory name for --with-jdk-headers])
|
||||
AC_MSG_ERROR([Cannot continue])])
|
||||
|
||||
# Check for bozo case: either specify --with-jdk-dir or
|
||||
# (--with-jdk-bindir, --with-jdk-headers) -- not both.
|
||||
bad=0
|
||||
AS_IF([test -n "$with_jdk_dir" -a -n "$with_jdk_bindir" -o \
|
||||
-n "$with_jdk_dir" -a -n "$with_jdk_headers"],[bad=1])
|
||||
AS_IF([test -z "$with_jdk_bindir" -a -n "$with_jdk_headers" -o \
|
||||
-n "$with_jdk_bindir" -a -z "$with_jdk_headers"],[bad=1])
|
||||
AS_IF([test "$bad" = "1"],
|
||||
[AC_MSG_WARN([Either specify --with-jdk-dir or both of (--with-jdk_bindir, --with-jdk-headers) -- not both.])
|
||||
AC_MSG_ERROR([Cannot continue])])
|
||||
|
||||
AS_IF([test -n "$with_jdk_dir"],
|
||||
[with_jdk_bindir=$with_jdk_dir/bin
|
||||
with_jdk_headers=$with_jdk_dir/include])
|
||||
|
||||
##################################################################
|
||||
# with_jdk_dir can now be ignored; with_jdk_bindir and
|
||||
# with_jdk_headers will be either empty or have valid values.
|
||||
##################################################################
|
||||
|
||||
# Some java installations are in obscure places. So let's
|
||||
# hard-code a few of the common ones so that users don't have to
|
||||
# specify --with-java-<foo>=LONG_ANNOYING_DIRECTORY.
|
||||
AS_IF([test -z "$with_jdk_bindir"],
|
||||
[ # OS X Snow Leopard and Lion (10.6 and 10.7 -- did not
|
||||
# check prior versions)
|
||||
found=0
|
||||
dir=/System/Library/Frameworks/JavaVM.framework/Versions/Current/Headers
|
||||
AC_MSG_CHECKING([OSX locations])
|
||||
AS_IF([test -d $dir],
|
||||
[AC_MSG_RESULT([found])
|
||||
found=1
|
||||
with_jdk_headers=$dir
|
||||
with_jdk_bindir=/usr/bin],
|
||||
[AC_MSG_RESULT([not found])])
|
||||
|
||||
if test "$found" = "0"; then
|
||||
# Various Linux
|
||||
dir='/usr/lib/jvm/java-*-openjdk-*/include/'
|
||||
jnih=`ls $dir/jni.h 2>/dev/null | head -n 1`
|
||||
AC_MSG_CHECKING([Linux locations])
|
||||
AS_IF([test -r "$jnih"],
|
||||
[with_jdk_headers=`dirname $jnih`
|
||||
OPAL_WHICH([javac], [with_jdk_bindir])
|
||||
AS_IF([test -n "$with_jdk_bindir"],
|
||||
[AC_MSG_RESULT([found])
|
||||
found=1
|
||||
with_jdk_bindir=`dirname $with_jdk_bindir`],
|
||||
[with_jdk_headers=])],
|
||||
[dir='/usr/lib/jvm/default-java/include/'
|
||||
jnih=`ls $dir/jni.h 2>/dev/null | head -n 1`
|
||||
AS_IF([test -r "$jnih"],
|
||||
[with_jdk_headers=`dirname $jnih`
|
||||
OPAL_WHICH([javac], [with_jdk_bindir])
|
||||
AS_IF([test -n "$with_jdk_bindir"],
|
||||
[AC_MSG_RESULT([found])
|
||||
found=1
|
||||
with_jdk_bindir=`dirname $with_jdk_bindir`],
|
||||
[with_jdk_headers=])],
|
||||
[AC_MSG_RESULT([not found])])])
|
||||
fi
|
||||
|
||||
if test "$found" = "0"; then
|
||||
# Solaris
|
||||
dir=/usr/java
|
||||
AC_MSG_CHECKING([Solaris locations])
|
||||
AS_IF([test -d $dir -a -r "$dir/include/jni.h"],
|
||||
[AC_MSG_RESULT([found])
|
||||
with_jdk_headers=$dir/include
|
||||
with_jdk_bindir=$dir/bin
|
||||
found=1],
|
||||
[AC_MSG_RESULT([not found])])
|
||||
fi
|
||||
],
|
||||
[found=1])
|
||||
|
||||
if test "$found" = "1"; then
|
||||
OMPI_CHECK_WITHDIR([jdk-bindir], [$with_jdk_bindir], [javac])
|
||||
OMPI_CHECK_WITHDIR([jdk-headers], [$with_jdk_headers], [jni.h])
|
||||
|
||||
# Look for various Java-related programs
|
||||
orte_java_happy=no
|
||||
PATH_save=$PATH
|
||||
AS_IF([test -n "$with_jdk_bindir" -a "$with_jdk_bindir" != "yes" -a "$with_jdk_bindir" != "no"],
|
||||
[PATH="$PATH:$with_jdk_bindir"])
|
||||
AC_PATH_PROG(JAVAC, javac)
|
||||
AC_PATH_PROG(JAVAH, javah)
|
||||
AC_PATH_PROG(JAR, jar)
|
||||
PATH=$PATH_save
|
||||
|
||||
# Check to see if we have all 3 programs.
|
||||
AS_IF([test -z "$JAVAC" -o -z "$JAVAH" -o -z "$JAR"],
|
||||
[orte_java_happy=no
|
||||
HAVE_JAVA_SUPPORT=0],
|
||||
[orte_java_happy=yes
|
||||
HAVE_JAVA_SUPPORT=1])
|
||||
|
||||
# Look for jni.h
|
||||
AS_IF([test "$orte_java_happy" = "yes"],
|
||||
[CPPFLAGS_save=$CPPFLAGS
|
||||
# silence a stupid Mac warning
|
||||
CPPFLAGS="$CPPFLAGS -DTARGET_RT_MAC_CFM=0"
|
||||
AS_IF([test -n "$with_jdk_headers" -a "$with_jdk_headers" != "yes" -a "$with_jdk_headers" != "no"],
|
||||
[ORTE_JDK_CPPFLAGS="-I$with_jdk_headers"
|
||||
# Some flavors of JDK also require -I<blah>/linux.
|
||||
# See if that's there, and if so, add a -I for that,
|
||||
# too. Ugh.
|
||||
AS_IF([test -d "$with_jdk_headers/linux"],
|
||||
[ORTE_JDK_CPPFLAGS="$ORTE_JDK_CPPFLAGS -I$with_jdk_headers/linux"])
|
||||
# Solaris JDK also require -I<blah>/solaris.
|
||||
# See if that's there, and if so, add a -I for that,
|
||||
# too. Ugh.
|
||||
AS_IF([test -d "$with_jdk_headers/solaris"],
|
||||
[ORTE_JDK_CPPFLAGS="$ORTE_JDK_CPPFLAGS -I$with_jdk_headers/solaris"])
|
||||
|
||||
CPPFLAGS="$CPPFLAGS $ORTE_JDK_CPPFLAGS"])
|
||||
AC_CHECK_HEADER([jni.h], [],
|
||||
[orte_java_happy=no])
|
||||
CPPFLAGS=$CPPFLAGS_save
|
||||
])
|
||||
else
|
||||
orte_java_happy=no;
|
||||
HAVE_JAVA_SUPPORT=no;
|
||||
fi
|
||||
AC_SUBST(ORTE_JDK_CPPFLAGS)
|
||||
fi
|
||||
AC_SUBST(ORTE_JDK_CPPFLAGS)
|
||||
|
||||
# Are we happy?
|
||||
AC_MSG_CHECKING([Java support available])
|
||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user