Permalink
Browse files

Add Java support to configure (append java library path to R_LD_LIBRA…

…RY_PATH)

git-svn-id: https://svn.r-project.org/R/trunk@35523 00db46b3-68df-0310-9c12-caf00c1e9a41
  • Loading branch information...
1 parent 6ddd2e2 commit 6fd30062a10064256c7b8b7cf5cfd2535c330fb7 urbaneks committed Sep 8, 2005
Showing with 200 additions and 1 deletion.
  1. +1 −0 Makefile.in
  2. +101 −1 configure
  3. +9 −0 configure.ac
  4. +1 −0 m4/Makefile.in
  5. +3 −0 m4/README
  6. +85 −0 m4/java.m4
View
@@ -33,6 +33,7 @@ ACINCLUDE_DEPENDENCIES = \
m4/clibs.m4 \
m4/codeset.m4 \
m4/gettext.m4 \
+ m4/java.m4 \
m4/libtool.m4
CONFIGURE_DEPENDENCIES = $(srcdir)/VERSION
config.status: $(srcdir)/configure
View
102 configure
@@ -465,7 +465,7 @@ ac_includes_default="\
# include <unistd.h>
#endif"
-ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS PACKAGE VERSION build build_cpu build_vendor build_os host host_cpu host_vendor host_os R_PLATFORM R_OSTYPE LIBnn rdocdir rincludedir rsharedir config_opts WANT_R_FRAMEWORK_TRUE WANT_R_FRAMEWORK_FALSE MAINTAINER_MODE_TRUE MAINTAINER_MODE_FALSE WANT_R_SHLIB_TRUE WANT_R_SHLIB_FALSE LIBR USE_LIBTOOL_TRUE USE_LIBTOOL_FALSE R_PRINTCMD R_PAPERSIZE R_BATCHSAVE MAIN_CFLAGS SHLIB_CFLAGS MAIN_FFLAGS SHLIB_FFLAGS MAIN_LD MAIN_LDFLAGS CPICFLAGS FPICFLAGS SHLIB_LD SHLIB_LDFLAGS DYLIB_LD DYLIB_LDFLAGS CXXPICFLAGS SHLIB_CXXLD SHLIB_CXXLDFLAGS TCLTK_LIBS TCLTK_CPPFLAGS MAKE F2C R_BROWSER BLAS_LIBS LAPACK_LIBS GETWD BUILDDIR_IS_SRCDIR ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO AWK EGREP LN_S RANLIB ac_ct_RANLIB YACC AR ARFLAGS INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA JAVAC SED PAGER PERL FALSE NO_PERL5 TAR DVIPS TEX LATEX MAKEINDEX PDFTEX PDFLATEX MAKEINFO_CMD INSTALL_INFO R_RD4DVI R_RD4PDF R_UNZIPCMD R_ZIPCMD R_GZIPCMD R_PDFVIEWER CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT CPP F77 FFLAGS ac_ct_F77 USING_G77_TRUE USING_G77_FALSE USING_F2C_TRUE USING_F2C_FALSE CXX CXXFLAGS ac_ct_CXX CXXCPP ECHO ac_ct_AR STRIP ac_ct_STRIP LIBTOOL LIBTOOL_DEPS shlibpath_var LIBM BUILD_DLFCN_DARWIN_TRUE BUILD_DLFCN_DARWIN_FALSE READLINE_LIBS FLIBS HAVE_FORTRAN_DOUBLE_COMPLEX COMPILE_FORTRAN_DOUBLE_COMPLEX_TRUE COMPILE_FORTRAN_DOUBLE_COMPLEX_FALSE SHLIB_CXXFLAGS F2CFLAGS R_XTRA_CFLAGS R_XTRA_CPPFLAGS R_XTRA_CXXFLAGS R_XTRA_FFLAGS R_XTRA_LIBS XMKMF SHLIB_LIBADD SHLIB_EXT USE_EXPORTFILES_TRUE USE_EXPORTFILES_FALSE DYLIB_EXT LIBR_LDFLAGS RLAPACK_LDFLAGS LAPACK_LDFLAGS ALLOCA RMATH_HAVE_EXPM1 RMATH_HAVE_LOG1P LIBOBJS RMATH_HAVE_WORKING_LOG1P HAVE_C99_COMPLEX USE_VECLIB_G95FIX_TRUE USE_VECLIB_G95FIX_FALSE USE_EXTERNAL_BLAS_TRUE USE_EXTERNAL_BLAS_FALSE USE_EXTERNAL_LAPACK_TRUE USE_EXTERNAL_LAPACK_FALSE R_MODULES SUPPORT_UTF8 SUPPORT_MBCS X_CFLAGS X_PRE_LIBS X_LIBS X_EXTRA_LIBS BUILD_AQUA_TRUE BUILD_AQUA_FALSE use_aqua TCL_CONFIG TK_CONFIG use_tcltk BITMAP_LIBS BUILD_XDR_TRUE BUILD_XDR_FALSE BUILD_ZLIB_TRUE BUILD_ZLIB_FALSE USE_MMAP_ZLIB_TRUE USE_MMAP_ZLIB_FALSE BUILD_BZLIB_TRUE BUILD_BZLIB_FALSE BUILD_PCRE_TRUE BUILD_PCRE_FALSE R_PROFILING PAPERCONF R_LD_LIBRARY_PATH USE_RECOMMENDED_PACKAGES_TRUE USE_RECOMMENDED_PACKAGES_FALSE USE_NLS SET_MAKE MKINSTALLDIRS MSGFMT GMSGFMT XGETTEXT MSGMERGE GLIBC21 HAVE_POSIX_PRINTF HAVE_ASPRINTF HAVE_SNPRINTF HAVE_WPRINTF LIBICONV LTLIBICONV INTLBISON BUILD_INCLUDED_LIBINTL USE_INCLUDED_LIBINTL CATOBJEXT DATADIRNAME INSTOBJEXT GENCAT INTLOBJS INTL_LIBTOOL_SUFFIX_PREFIX INTLLIBS LIBINTL LTLIBINTL POSUB USE_NLS_TRUE USE_NLS_FALSE LTLIBOBJS'
+ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS PACKAGE VERSION build build_cpu build_vendor build_os host host_cpu host_vendor host_os R_PLATFORM R_OSTYPE LIBnn rdocdir rincludedir rsharedir config_opts WANT_R_FRAMEWORK_TRUE WANT_R_FRAMEWORK_FALSE MAINTAINER_MODE_TRUE MAINTAINER_MODE_FALSE WANT_R_SHLIB_TRUE WANT_R_SHLIB_FALSE LIBR USE_LIBTOOL_TRUE USE_LIBTOOL_FALSE R_PRINTCMD R_PAPERSIZE R_BATCHSAVE MAIN_CFLAGS SHLIB_CFLAGS MAIN_FFLAGS SHLIB_FFLAGS MAIN_LD MAIN_LDFLAGS CPICFLAGS FPICFLAGS SHLIB_LD SHLIB_LDFLAGS DYLIB_LD DYLIB_LDFLAGS CXXPICFLAGS SHLIB_CXXLD SHLIB_CXXLDFLAGS TCLTK_LIBS TCLTK_CPPFLAGS MAKE F2C R_BROWSER BLAS_LIBS LAPACK_LIBS GETWD BUILDDIR_IS_SRCDIR ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO AWK EGREP LN_S RANLIB ac_ct_RANLIB YACC AR ARFLAGS INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA JAVAC SED PAGER PERL FALSE NO_PERL5 TAR DVIPS TEX LATEX MAKEINDEX PDFTEX PDFLATEX MAKEINFO_CMD INSTALL_INFO R_RD4DVI R_RD4PDF R_UNZIPCMD R_ZIPCMD R_GZIPCMD R_PDFVIEWER CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT CPP F77 FFLAGS ac_ct_F77 USING_G77_TRUE USING_G77_FALSE USING_F2C_TRUE USING_F2C_FALSE CXX CXXFLAGS ac_ct_CXX CXXCPP ECHO ac_ct_AR STRIP ac_ct_STRIP LIBTOOL LIBTOOL_DEPS shlibpath_var LIBM BUILD_DLFCN_DARWIN_TRUE BUILD_DLFCN_DARWIN_FALSE READLINE_LIBS FLIBS HAVE_FORTRAN_DOUBLE_COMPLEX COMPILE_FORTRAN_DOUBLE_COMPLEX_TRUE COMPILE_FORTRAN_DOUBLE_COMPLEX_FALSE SHLIB_CXXFLAGS F2CFLAGS R_XTRA_CFLAGS R_XTRA_CPPFLAGS R_XTRA_CXXFLAGS R_XTRA_FFLAGS R_XTRA_LIBS XMKMF SHLIB_LIBADD SHLIB_EXT USE_EXPORTFILES_TRUE USE_EXPORTFILES_FALSE DYLIB_EXT LIBR_LDFLAGS RLAPACK_LDFLAGS LAPACK_LDFLAGS ALLOCA RMATH_HAVE_EXPM1 RMATH_HAVE_LOG1P LIBOBJS RMATH_HAVE_WORKING_LOG1P HAVE_C99_COMPLEX USE_VECLIB_G95FIX_TRUE USE_VECLIB_G95FIX_FALSE USE_EXTERNAL_BLAS_TRUE USE_EXTERNAL_BLAS_FALSE USE_EXTERNAL_LAPACK_TRUE USE_EXTERNAL_LAPACK_FALSE R_MODULES SUPPORT_UTF8 SUPPORT_MBCS X_CFLAGS X_PRE_LIBS X_LIBS X_EXTRA_LIBS BUILD_AQUA_TRUE BUILD_AQUA_FALSE use_aqua TCL_CONFIG TK_CONFIG use_tcltk BITMAP_LIBS BUILD_XDR_TRUE BUILD_XDR_FALSE BUILD_ZLIB_TRUE BUILD_ZLIB_FALSE USE_MMAP_ZLIB_TRUE USE_MMAP_ZLIB_FALSE BUILD_BZLIB_TRUE BUILD_BZLIB_FALSE BUILD_PCRE_TRUE BUILD_PCRE_FALSE R_PROFILING PAPERCONF JAVA_PROG JAVA_HOME JAVA_LD_PATH R_LD_LIBRARY_PATH USE_RECOMMENDED_PACKAGES_TRUE USE_RECOMMENDED_PACKAGES_FALSE USE_NLS SET_MAKE MKINSTALLDIRS MSGFMT GMSGFMT XGETTEXT MSGMERGE GLIBC21 HAVE_POSIX_PRINTF HAVE_ASPRINTF HAVE_SNPRINTF HAVE_WPRINTF LIBICONV LTLIBICONV INTLBISON BUILD_INCLUDED_LIBINTL USE_INCLUDED_LIBINTL CATOBJEXT DATADIRNAME INSTOBJEXT GENCAT INTLOBJS INTL_LIBTOOL_SUFFIX_PREFIX INTLLIBS LIBINTL LTLIBINTL POSUB USE_NLS_TRUE USE_NLS_FALSE LTLIBOBJS'
ac_subst_files='r_cc_rules_frag r_f77_rules_frag r_cxx_rules_frag'
# Initialize some variables set by options.
@@ -40082,6 +40082,97 @@ test -z "${papersize}" && papersize="${PAPERSIZE}"
## Saving.
+## Java support
+
+have_java=no
+
+if test -z "${JAVA_HOME}" ; then
+ JAVA_PATH=${PATH}
+else
+ JAVA_PATH=${JAVA_HOME}:${JAVA_HOME}/bin:${PATH}
+fi
+JAVA_PATH=${JAVA_PATH}:/usr/java/bin:/usr/jdk/bin:/usr/lib/java/bin:/usr/lib/jdk/bin:/usr/local/java/bin:/usr/local/jdk/bin:/usr/local/lib/java/bin:/usr/local/lib/jdk/bin
+for ac_prog in java
+do
+ # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_path_JAVA_PROG+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ case $JAVA_PROG in
+ [\\/]* | ?:[\\/]*)
+ ac_cv_path_JAVA_PROG="$JAVA_PROG" # Let the user override the test with a path.
+ ;;
+ *)
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in ${JAVA_PATH}
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_path_JAVA_PROG="$as_dir/$ac_word$ac_exec_ext"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+
+ ;;
+esac
+fi
+JAVA_PROG=$ac_cv_path_JAVA_PROG
+
+if test -n "$JAVA_PROG"; then
+ echo "$as_me:$LINENO: result: $JAVA_PROG" >&5
+echo "${ECHO_T}$JAVA_PROG" >&6
+else
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+ test -n "$JAVA_PROG" && break
+done
+
+
+echo "$as_me:$LINENO: checking Java environment home" >&5
+echo $ECHO_N "checking Java environment home... $ECHO_C" >&6
+
+getsp_cp=${ac_aux_dir}
+
+if test ! -z "${JAVA_PROG}" ; then
+ if test -z "${JAVA_HOME}" ; then
+ JAVA_HOME=`${JAVA_PROG} -classpath ${getsp_cp} getsp java.home`
+ fi
+fi
+
+if test -z "${JAVA_HOME}" ; then
+ echo "$as_me:$LINENO: result: not found" >&5
+echo "${ECHO_T}not found" >&6
+else
+ echo "$as_me:$LINENO: result: in ${JAVA_HOME}" >&5
+echo "${ECHO_T}in ${JAVA_HOME}" >&6
+
+ case "${host_os}" in
+ darwin*)
+ JAVA_LIBS="-framework JavaVM"
+ JAVA_LD_PATH=
+ ;;
+ *)
+ JAVA_LIBS=`${JAVA_PROG} -classpath ${getsp_cp} getsp -libs`
+ JAVA_LIBS="${JAVA_LIBS} -ljvm"
+ JAVA_LD_PATH=`${JAVA_PROG} -classpath ${getsp_cp} getsp java.library.path`
+ ;;
+ esac
+ have_java=yes
+fi
+
+
+
+
+
## Make sure -L terms come first in LIBS.
LIBS1=""
LIBS2=""
@@ -40164,6 +40255,12 @@ fi
done
## </FIXME>
+## Append JAVA_LD_PATH if existent (set by R_FIND_JAVA if Java was found)
+if test ! -z "${JAVA_LD_PATH}" ; then
+ R_LD_LIBRARY_PATH="${R_LD_LIBRARY_PATH}${PATH_SEPARATOR}${JAVA_LD_PATH}"
+fi
+
+
## Recommended packages.
if test "${use_recommended_packages}" = yes; then
@@ -47498,6 +47595,9 @@ s,@BUILD_PCRE_TRUE@,$BUILD_PCRE_TRUE,;t t
s,@BUILD_PCRE_FALSE@,$BUILD_PCRE_FALSE,;t t
s,@R_PROFILING@,$R_PROFILING,;t t
s,@PAPERCONF@,$PAPERCONF,;t t
+s,@JAVA_PROG@,$JAVA_PROG,;t t
+s,@JAVA_HOME@,$JAVA_HOME,;t t
+s,@JAVA_LD_PATH@,$JAVA_LD_PATH,;t t
s,@R_LD_LIBRARY_PATH@,$R_LD_LIBRARY_PATH,;t t
s,@USE_RECOMMENDED_PACKAGES_TRUE@,$USE_RECOMMENDED_PACKAGES_TRUE,;t t
s,@USE_RECOMMENDED_PACKAGES_FALSE@,$USE_RECOMMENDED_PACKAGES_FALSE,;t t
View
@@ -1491,6 +1491,9 @@ AC_SUBST(R_PAPERSIZE)
## Saving.
AC_SUBST(R_BATCHSAVE)
+## Java support
+R_FIND_JAVA
+
## Make sure -L terms come first in LIBS.
LIBS1=""
LIBS2=""
@@ -1554,6 +1557,12 @@ for arg in ${LDFLAGS} ${FLIBS} ${BLAS_LIBS} ${LAPACK_LIBS} ${X_LIBS} \
esac
done
## </FIXME>
+
+## Append JAVA_LD_PATH if existent (set by R_FIND_JAVA if Java was found)
+if test ! -z "${JAVA_LD_PATH}" ; then
+ R_LD_LIBRARY_PATH="${R_LD_LIBRARY_PATH}${PATH_SEPARATOR}${JAVA_LD_PATH}"
+fi
+
AC_SUBST(R_LD_LIBRARY_PATH)
## Recommended packages.
View
@@ -16,6 +16,7 @@ DISTFILES = Makefile.in README \
clibs.m4 \
codeset.m4 \
gettext.m4 \
+ java.m4 \
libtool.m4
all: Makefile R
View
@@ -33,5 +33,8 @@ The files are as follows.
a concatenation of all the required files from gettext 0.14.1
except codeset.m4.
+ java.m4
+ macros for detecting Java runtime environment or JDK.
+
libtool.m4
is from libtool 1.5.6.
View
@@ -0,0 +1,85 @@
+### java.m4 -- macros for Java environment detection -*- Autoconf -*-
+###
+### Copyright (C) 2005 R Core Team
+###
+### This file is part of R.
+###
+### R is free software; you can redistribute it and/or modify it under
+### the terms of the GNU General Public License as published by the Free
+### Software Foundation; either version 2 of the License, or (at your
+### option) any later version.
+###
+### R is distributed in the hope that it will be useful, but WITHOUT ANY
+### WARRANTY; without even the implied warranty of MERCHANTABILITY or
+### FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
+### License for more details.
+###
+### You should have received a copy of the GNU General Public License
+### along with R; if not, you can obtain it via the World Wide Web at
+### `http://www.gnu.org/copyleft/gpl.html', or by writing to the Free
+### Software Foundation, 59 Temple Place -- Suite 330, Boston, MA
+### 02111-3307, USA.
+
+## R_FIND_JAVA
+## -----------
+## Looks for Java JRE/JDK and sets:
+## have_java to yes/no; if it is yes then also sets:
+## JAVA_PROG to Java interpreter path
+## JAVA_HOME to the home directory of the Java runtime/jdk
+## JAVA_LD_PATH to the path necessary for Java runtime
+##
+## JAVA_HOME env var is honored during the search and the search
+## will fail if it is set incorrectly.
+AC_DEFUN([R_FIND_JAVA],
+[
+have_java=no
+
+## find java compiler binaries
+if test -z "${JAVA_HOME}" ; then
+ JAVA_PATH=${PATH}
+else
+ JAVA_PATH=${JAVA_HOME}:${JAVA_HOME}/bin:${PATH}
+fi
+## if 'java' is not on the PATH or JAVA_HOME, add some guesses as of
+## where java could live
+JAVA_PATH=${JAVA_PATH}:/usr/java/bin:/usr/jdk/bin:/usr/lib/java/bin:/usr/lib/jdk/bin:/usr/local/java/bin:/usr/local/jdk/bin:/usr/local/lib/java/bin:/usr/local/lib/jdk/bin
+AC_PATH_PROGS(JAVA_PROG,java,,${JAVA_PATH})
+
+AC_MSG_CHECKING([Java environment home])
+
+## this is where our test-class lives (in tools directory)
+getsp_cp=${ac_aux_dir}
+
+## retrieve JAVA_HOME from Java itself if not set and we found
+## the `java' program
+if test ! -z "${JAVA_PROG}" ; then
+ if test -z "${JAVA_HOME}" ; then
+ JAVA_HOME=`${JAVA_PROG} -classpath ${getsp_cp} getsp java.home`
+ fi
+fi
+
+## the availability of JAVA_HOME will tell us whether it's supported
+if test -z "${JAVA_HOME}" ; then
+ AC_MSG_RESULT([not found])
+else
+ AC_MSG_RESULT([in ${JAVA_HOME}])
+
+ case "${host_os}" in
+ darwin*)
+ JAVA_LIBS="-framework JavaVM"
+ JAVA_LD_PATH=
+ ;;
+ *)
+ JAVA_LIBS=`${JAVA_PROG} -classpath ${getsp_cp} getsp -libs`
+ JAVA_LIBS="${JAVA_LIBS} -ljvm"
+ JAVA_LD_PATH=`${JAVA_PROG} -classpath ${getsp_cp} getsp java.library.path`
+ ;;
+ esac
+ have_java=yes
+fi
+AC_SUBST(JAVA_HOME)
+AC_SUBST(JAVA_PROG)
+AC_SUBST(JAVA_LD_PATH)
+## should we add JAVA_LIBS too? R doesn't need it and we don't cover
+## JDK here, so the headers may not even be present...
+])

0 comments on commit 6fd3006

Please sign in to comment.