Kaydet (Commit) f2cb8945 authored tarafından Norbert Thiebaud's avatar Norbert Thiebaud

use the 'canonical' way to find JAVA_HOME on MacOS.

üst b13a0c0c
...@@ -3673,47 +3673,50 @@ if test "$SOLAR_JAVA" != ""; then ...@@ -3673,47 +3673,50 @@ if test "$SOLAR_JAVA" != ""; then
fi fi
if test "$SOLAR_JAVA" != ""; then if test "$SOLAR_JAVA" != ""; then
# check if JAVA_HOME was (maybe incorrectly?) set automatically to /usr if test $_os != "Darwin"; then
if test "$JAVA_HOME" = "/usr" -a "x$with_jdk_home" = "x"; then # check if JAVA_HOME was (maybe incorrectly?) set automatically to /usr
if test "$JAVA_HOME" = "/usr" -a "x$with_jdk_home" = "x"; then
if basename $(readlink $(readlink $JAVACOMPILER)) >/dev/null 2>/dev/null; then if basename $(readlink $(readlink $JAVACOMPILER)) >/dev/null 2>/dev/null; then
# try to recover first by looking whether we have a alternatives # try to recover first by looking whether we have a alternatives
# system as in Debian or newer SuSEs where following /usr/bin/javac # system as in Debian or newer SuSEs where following /usr/bin/javac
# over /etc/alternatives/javac leads to the right bindir where we # over /etc/alternatives/javac leads to the right bindir where we
# just need to strip a bit away to get a valid JAVA_HOME # just need to strip a bit away to get a valid JAVA_HOME
JAVA_HOME=$(readlink $(readlink $JAVACOMPILER)) JAVA_HOME=$(readlink $(readlink $JAVACOMPILER))
elif readlink $JAVACOMPILER >/dev/null 2>/dev/null; then elif readlink $JAVACOMPILER >/dev/null 2>/dev/null; then
# maybe only one level of symlink (e.g. on Mac) # maybe only one level of symlink (e.g. on Mac)
JAVA_HOME=$(readlink $JAVACOMPILER) JAVA_HOME=$(readlink $JAVACOMPILER)
if test "$(dirname $JAVA_HOME)" = "."; then fi
# we've got no path to trim back if test "$(dirname $JAVA_HOME)" = "."; then
JAVA_HOME="" # we've got no path to trim back
fi JAVA_HOME=""
else fi
# else warn else
AC_MSG_WARN([JAVA_HOME is set to /usr - this is very likely to be incorrect]) # else warn
AC_MSG_WARN([if this is the case, please inform the correct JAVA_HOME with --with-jdk-home]) AC_MSG_WARN([JAVA_HOME is set to /usr - this is very likely to be incorrect])
echo "JAVA_HOME is set to /usr - this is very likely to be incorrect" >> warn AC_MSG_WARN([if this is the case, please inform the correct JAVA_HOME with --with-jdk-home])
echo "if this is the case, please inform the correct JAVA_HOME with --with-jdk-home" >> warn echo "JAVA_HOME is set to /usr - this is very likely to be incorrect" >> warn
fi echo "if this is the case, please inform the correct JAVA_HOME with --with-jdk-home" >> warn
dnl now that we have the path to the real javac, make a JAVA_HOME out of it.. fi
if test "$JAVA_HOME" != "/usr"; then dnl now that we have the path to the real javac, make a JAVA_HOME out of it..
if test "$_os" = "Darwin"; then if test "$JAVA_HOME" != "/usr"; then
dnl Leopard returns a non-suitable path with readlink - points to "Current" only JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/bin/javac$,,)
JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/Current/Commands/javac$,/CurrentJDK/Home,) fi
dnl Tiger already returns a JDK path.. else
JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/CurrentJDK/Commands/javac$,/CurrentJDK/Home,) if test "x$with_jdk_home" = "x"; then
else if test -x /usr/libexec/java_home ; then
JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/bin/javac$,,) JAVA_HOME=$(/usr/libexec/java_home)
fi else
fi JAVA_HOME="/System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK/Home"
fi fi
# as we drop out of this, JAVA_HOME may have been set to the empty string by readlink fi
fi
# as we drop out of this, JAVA_HOME may have been set to the empty string by readlink
dnl now if JAVA_HOME has been set to empty, then call findhome to find it dnl now if JAVA_HOME has been set to empty, then call findhome to find it
if test -z "$JAVA_HOME"; then if test -z "$JAVA_HOME"; then
if test "x$with_jdk_home" = "x"; then if test "x$with_jdk_home" = "x"; then
cat > findhome.java <<_ACEOF cat > findhome.java <<_ACEOF
[import java.io.File; [import java.io.File;
class findhome class findhome
...@@ -3726,29 +3729,29 @@ class findhome ...@@ -3726,29 +3729,29 @@ class findhome
} }
}] }]
_ACEOF _ACEOF
AC_MSG_CHECKING([if javac works]) AC_MSG_CHECKING([if javac works])
javac_cmd="$JAVACOMPILER findhome.java 1>&2" javac_cmd="$JAVACOMPILER findhome.java 1>&2"
AC_TRY_EVAL(javac_cmd) AC_TRY_EVAL(javac_cmd)
if test $? = 0 && test -f ./findhome.class ; then if test $? = 0 && test -f ./findhome.class ; then
AC_MSG_RESULT([javac works]) AC_MSG_RESULT([javac works])
else else
echo "configure: javac test failed" >&5 echo "configure: javac test failed" >&5
cat findhome.java >&5 cat findhome.java >&5
AC_MSG_ERROR([javac does not work - java projects will not build!]) AC_MSG_ERROR([javac does not work - java projects will not build!])
fi fi
AC_MSG_CHECKING([if gij knows its java.home]) AC_MSG_CHECKING([if gij knows its java.home])
JAVA_HOME=`$JAVAINTERPRETER findhome` JAVA_HOME=`$JAVAINTERPRETER findhome`
if test $? = 0 && test "$JAVA_HOME" != "" ; then if test $? = 0 && test "$JAVA_HOME" != "" ; then
AC_MSG_RESULT([$JAVA_HOME]) AC_MSG_RESULT([$JAVA_HOME])
else
echo "configure: java test failed" >&5
cat findhome.java >&5
AC_MSG_ERROR([gij does not know its java.home - use --with-jdk-home])
fi
else else
echo "configure: java test failed" >&5 JAVA_HOME=`echo $JAVAINTERPRETER | $SED -n "s,//*bin//*$WITH_JAVA,,p"`
cat findhome.java >&5
AC_MSG_ERROR([gij does not know its java.home - use --with-jdk-home])
fi fi
else
JAVA_HOME=`echo $JAVAINTERPRETER | $SED -n "s,//*bin//*$WITH_JAVA,,p"`
fi
fi fi
dnl second sanity check JAVA_HOME if possible dnl second sanity check JAVA_HOME if possible
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment