Allow for spaces in path to java include directory and executables

For typical Windows installs of Java.
Also don't use cygpath on MinGW.
This commit is contained in:
William S Fulton 2015-04-02 06:39:30 +01:00
commit f27faa9c69

View file

@ -1108,6 +1108,7 @@ fi
AC_MSG_CHECKING(for java include file jni.h)
AC_ARG_WITH(javaincl, [ --with-javaincl=path Set location of Java include directory], [JAVAINCDIR="$withval"], [JAVAINCDIR=])
JAVAINC=""
if test -z "$JAVAINCDIR" ; then
JAVAINCDIR="/usr/j2sdk*/include /usr/local/j2sdk*/include /usr/jdk*/include /usr/local/jdk*/include /opt/j2sdk*/include /opt/jdk*/include /usr/java/include /usr/java/j2sdk*/include /usr/java/jdk*/include /usr/local/java/include /opt/java/include /usr/include/java /usr/local/include/java /usr/lib/java/include /usr/lib/jvm/java*/include /usr/lib64/jvm/java*/include /usr/include/kaffe /usr/local/include/kaffe /usr/include"
@ -1117,30 +1118,33 @@ if test -z "$JAVAINCDIR" ; then
*-*-darwin*) JAVAINCDIR="/System/Library/Frameworks/JavaVM.framework/Headers $JAVAINCDIR";;
*);;
esac
fi
JAVAINC=""
for d in $JAVAINCDIR ; do
if test -r "$d/jni.h" ; then
AC_MSG_RESULT($d)
JAVAINCDIR=$d
JAVAINC=-I\"$d\"
break
for d in $JAVAINCDIR ; do
if test -r "$d/jni.h" ; then
JAVAINCDIR=$d
JAVAINC=-I\"$d\"
break
fi
done
else
if test -r "$JAVAINCDIR/jni.h" ; then
JAVAINC=-I\"$JAVAINCDIR\"
fi
done
fi
if test "$JAVAINC" = "" ; then
AC_MSG_RESULT(not found)
else
AC_MSG_RESULT($JAVAINC)
# now look for <arch>/jni_md.h
AC_MSG_CHECKING(for java include file jni_md.h)
JAVAMDDIR=`find "$JAVAINCDIR" -follow -name jni_md.h -print`
if test "$JAVAMDDIR" = "" ; then
AC_MSG_RESULT(not found)
else
JAVAMDDIR=`dirname "$JAVAMDDIR" | tail -1`
JAVAINC="${JAVAINC} -I\"$JAVAMDDIR\""
JAVAMDDIR=-I\"`dirname "$JAVAMDDIR" | tail -1`\"
AC_MSG_RESULT($JAVAMDDIR)
JAVAINC="${JAVAINC} ${JAVAMDDIR}"
fi
fi
@ -1195,6 +1199,15 @@ case $host in
esac
fi
# Quote for spaces in path to executables
if test -n "$JAVA"; then
JAVA=\"$JAVA\"
fi
if test -n "$JAVAC"; then
JAVAC=\"$JAVAC\"
fi
AC_SUBST(JAVA)
AC_SUBST(JAVAC)
AC_SUBST(JAVAINC)
@ -2669,13 +2682,18 @@ AC_SUBST(SKIP_ANDROID)
ABS_SRCDIR=`(cd ${srcdir} && pwd)`
# Root directory
# Translate path for native Windows compilers for use with 'make check'
ROOT_DIR=`pwd`
case $host in
*-*-cygwin* | *-*-mingw*)
*-*-cygwin*)
# Translate path for native Windows compilers for use with 'make check'
if (cygpath --mixed $ROOT_DIR) >/dev/null 2>/dev/null; then
ROOT_DIR=`cygpath --mixed $ROOT_DIR`
fi
;;
esac
case $host in
*-*-cygwin* | *-*-mingw*)
# Extra files generated by some Windows compilers
EXTRA_CLEAN="*.stackdump *.exp *.lib *.pdb *.ilk"
;;