Skip to content

Commit

Permalink
fix Java environment checks and make them more specific about the error
Browse files Browse the repository at this point in the history
git-svn-id: svn://svn.rforge.net/rJava/trunk@308 634b503b-a89c-4e0f-88f7-82c2bf7838a2
  • Loading branch information
s-u committed Sep 4, 2007
1 parent f1fb414 commit ea96c47
Show file tree
Hide file tree
Showing 3 changed files with 84 additions and 24 deletions.
64 changes: 50 additions & 14 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -3788,18 +3788,22 @@ _ACEOF
fi
{ echo "$as_me:$LINENO: checking Java support in R" >&5
echo $ECHO_N "checking Java support in R... $ECHO_C" >&6; }
R_JAVA_HOME=`"${RBIN}" CMD config JAVA_HOME`
: ${JAVA_HOME="${R_JAVA_HOME}"}
if test -z "${JAVA_HOME}"; then
{ { echo "$as_me:$LINENO: error: R was configured without Java support. Please run
{ { echo "$as_me:$LINENO: error: absent
R was configured without Java support. Please run
R CMD javareconf
as root to add Java support to R.
If you don't have root privileges, run
R CMD javareconf -e
to set all Java-related variables and then install rJava.
(works with R 2.5.0 only)" >&5
echo "$as_me: error: R was configured without Java support. Please run
echo "$as_me: error: absent
R was configured without Java support. Please run
R CMD javareconf
as root to add Java support to R.
Expand All @@ -3817,27 +3821,53 @@ fi
: ${JAVA_CPPFLAGS=`"${RBIN}" CMD config JAVA_CPPFLAGS|sed 's/ERROR:.*//'`}
: ${JAVA_LIBS=`"${RBIN}" CMD config JAVA_LIBS|sed 's/ERROR:.*//'`}
have_all_flags=yes
test -z "${JAVA}" || test -z "${JAVAC}" || test -z "${JAVAH}" || \
test -z "${JAVA_CPPFLAGS}" || test -z "${JAVA_LIB}" || test -z "${JAR}" || \
{ echo "$as_me:$LINENO: result: present:
interpreter : '${JAVA}'
archiver : '${JAR}'
compiler : '${JAVAC}'
header prep.: '${JAVAH}'
cpp flags : '${JAVA_CPPFLAGS}'
java libs : '${JAVA_LIBS}'" >&5
echo "${ECHO_T}present:
interpreter : '${JAVA}'
archiver : '${JAR}'
compiler : '${JAVAC}'
header prep.: '${JAVAH}'
cpp flags : '${JAVA_CPPFLAGS}'
java libs : '${JAVA_LIBS}'" >&6; }
java_error='One or more Java configuration variables are not set.'
if test -z "${JAVA}"; then
java_error='Java interpreter is missing or not registered in R'
fi
if test -z "${JAVAC}"; then
java_error='Java Development Kit (JDK) is missing or not registered in R'
fi
have_all_flags=no
if test -n "${JAVA}" && test -n "${JAVAC}" && test -n "${JAVAH}" && \
test -n "${JAVA_CPPFLAGS}" && test -n "${JAVA_LIBS}" && test -n "${JAR}"; then
have_all_flags=yes;
fi
if test "${have_all_flags}" = no; then
{ { echo "$as_me:$LINENO: error: One or more Java configuration variables are not set.
{ { echo "$as_me:$LINENO: error: ${java_error}
Make sure R is configured with full Java support (including JDK). Run
R CMD javareconf
as root to add Java support to R.
If you don't have root privileges, run
R CMD javareconf -e
to set all Java-related variables and then install rJava." >&5
echo "$as_me: error: One or more Java configuration variables are not set.
to set all Java-related variables and then install rJava.
" >&5
echo "$as_me: error: ${java_error}
Make sure R is configured with full Java support (including JDK). Run
R CMD javareconf
as root to add Java support to R.
If you don't have root privileges, run
R CMD javareconf -e
to set all Java-related variables and then install rJava." >&2;}
to set all Java-related variables and then install rJava.
" >&2;}
{ (exit 1); exit 1; }; }
fi
Expand Down Expand Up @@ -3883,8 +3913,16 @@ else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
{ { echo "$as_me:$LINENO: error: Cannot compile a simple JNI program. See config.log for details." >&5
echo "$as_me: error: Cannot compile a simple JNI program. See config.log for details." >&2;}
{ { echo "$as_me:$LINENO: error: Cannot compile a simple JNI program. See config.log for details.
Make sure you have Java Development Kit installed and correctly registered in R.
If in doubt, re-run \"R CMD javareconf\" as root.
" >&5
echo "$as_me: error: Cannot compile a simple JNI program. See config.log for details.
Make sure you have Java Development Kit installed and correctly registered in R.
If in doubt, re-run \"R CMD javareconf\" as root.
" >&2;}
{ (exit 1); exit 1; }; }
fi
Expand Down Expand Up @@ -3954,9 +3992,7 @@ echo $ECHO_N "checking whether JRI should be compiled (autodetect)... $ECHO_C" >
echo "${ECHO_T}${has_R_shlib}" >&6; }
want_jri=${has_R_shlib}
fi
if test "x${want_jri}" = xyes; then
if test "x${want_jri}" = xyes; then
WANT_JRI_TRUE=
WANT_JRI_FALSE='#'
else
Expand Down
38 changes: 31 additions & 7 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -103,10 +103,12 @@ if test "${can_inline}" = yes; then
AC_DEFINE(HAVE_STATIC_INLINE, 1, [Define to 1 when static inline works])
fi

AC_MSG_CHECKING([Java support in R])
R_JAVA_HOME=`"${RBIN}" CMD config JAVA_HOME`
: ${JAVA_HOME="${R_JAVA_HOME}"}
if test -z "${JAVA_HOME}"; then
AC_MSG_ERROR([R was configured without Java support. Please run
AC_MSG_ERROR([absent
R was configured without Java support. Please run
R CMD javareconf
as root to add Java support to R.
Expand All @@ -123,19 +125,37 @@ fi
: ${JAVA_CPPFLAGS=`"${RBIN}" CMD config JAVA_CPPFLAGS|sed 's/ERROR:.*//'`}
: ${JAVA_LIBS=`"${RBIN}" CMD config JAVA_LIBS|sed 's/ERROR:.*//'`}

have_all_flags=yes
test -z "${JAVA}" || test -z "${JAVAC}" || test -z "${JAVAH}" || \
test -z "${JAVA_CPPFLAGS}" || test -z "${JAVA_LIB}" || test -z "${JAR}" || \
AC_MSG_RESULT([present:
interpreter : '${JAVA}'
archiver : '${JAR}'
compiler : '${JAVAC}'
header prep.: '${JAVAH}'
cpp flags : '${JAVA_CPPFLAGS}'
java libs : '${JAVA_LIBS}'])

java_error='One or more Java configuration variables are not set.'
if test -z "${JAVA}"; then
java_error='Java interpreter is missing or not registered in R'
fi
if test -z "${JAVAC}"; then
java_error='Java Development Kit (JDK) is missing or not registered in R'
fi

have_all_flags=no
if test -n "${JAVA}" && test -n "${JAVAC}" && test -n "${JAVAH}" && \
test -n "${JAVA_CPPFLAGS}" && test -n "${JAVA_LIBS}" && test -n "${JAR}"; then
have_all_flags=yes;
fi
if test "${have_all_flags}" = no; then
AC_MSG_ERROR([One or more Java configuration variables are not set.
AC_MSG_ERROR([${java_error}
Make sure R is configured with full Java support (including JDK). Run
R CMD javareconf
as root to add Java support to R.
If you don't have root privileges, run
R CMD javareconf -e
to set all Java-related variables and then install rJava.])
to set all Java-related variables and then install rJava.
])
fi

LIBS="${LIBS} ${JAVA_LIBS}"
Expand All @@ -153,7 +173,11 @@ int main(void) {
return 0;
}
],[AC_MSG_RESULT(yes)],
[AC_MSG_ERROR([Cannot compile a simple JNI program. See config.log for details.])])
[AC_MSG_ERROR([Cannot compile a simple JNI program. See config.log for details.
Make sure you have Java Development Kit installed and correctly registered in R.
If in doubt, re-run "R CMD javareconf" as root.
])])

AC_MSG_CHECKING([JNI data types])
AC_TRY_RUN(
Expand Down
6 changes: 3 additions & 3 deletions src/rJava.h
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
#ifndef __RJAVA_H__
#define __RJAVA_H__

#define RJAVA_VER 0x000500 /* rJava v0.5-0 */
#define RJAVA_VER 0x000501 /* rJava v0.5-1 */

/* important changes between versions:
3.0 - adds compiler
2.0 - integrates JRI, adds callbacks and class-loader
2.0
1.0
0.5
0.5 - integrates JRI, adds callbacks and class-loader
0.4 - includes JRI
0.3 - uses EXTPTR in jobj slot, adds finalizers
0.2 - uses S4 classes
Expand Down

0 comments on commit ea96c47

Please sign in to comment.