This is the mail archive of the java-patches@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [patch] add --with-java-home configure option


On Mon, 2005-04-04 at 19:11 -0400, Bryce McKinlay wrote:
> Thomas Fitzsimmons wrote:
> 
> >Hi,
> >
> >This patch adds a --with-java-home configure option and sets the
> >java.home and sun.boot.class.path system properties accordingly.  In the
> >future, we plan to make libgcj's installation layout more SDK-like for
> >compatibility reasons -- at that point, we can expand the meaning of
> >this option.  For now a separate project, java-gcj-compat, can be
> >installed to provide compatibility symlinks.  The --with-java-home
> >option will allow us to symlink java directly to gij, where before we
> >were wrapping gij with a hacky option-massaging shell script.
> >  
> >
> 
> --with-java-home needs to be documented in install.texi
> 

OK, see new patch.

> It would be better to use something like "#ifdef JAVA_HOME" here rather 
> than a runtime comparison.
> 

Good point.  Here's an updated patch.  OK for mainline and gcc-4_0-
branch?

Tom

2005-04-04  Thomas Fitzsimmons  <fitzsim@redhat.com>

	* doc/install.texi (Configuration): Document --with-java-home.

2005-04-04  Thomas Fitzsimmons  <fitzsim@redhat.com>

	PR libgcj/20750
	* Makefile.am (AM_CXXFLAGS): Define JAVA_HOME.
	* Makefile.in: Regenerate.
	* configure.ac: Add --with-java-home option.
	* configure: Regenerate.
	* external/Makefile.in: Regenerate.
	* external/sax/Makefile.in: Regenerate.
	* external/w3c_dom/Makefile.in: Regenerate.
	* gcj/Makefile.in: Regenerate.
	* include/Makefile.in: Regenerate.
	* libjava/include/config.h.in: Regenerate.
	* java/lang/natRuntime.cc
	(insertSystemProperties): Set java.home and sun.boot.class.path
	based on JAVA_HOME
	* testsuite/Makefile.in: Regenerate.

Index: gcc/doc/install.texi
===================================================================
RCS file: /cvs/gcc/gcc/gcc/doc/install.texi,v
retrieving revision 1.341
diff -u -r1.341 install.texi
--- gcc/doc/install.texi	3 Apr 2005 14:30:29 -0000	1.341
+++ gcc/doc/install.texi	5 Apr 2005 01:19:39 -0000
@@ -1035,6 +1035,12 @@
 parallel.  This is currently supported by @samp{libgfortran},
 @samp{libjava}, @samp{libmudflap}, @samp{libstdc++}, and @samp{libobjc}.
 
+@item --with-java-home=@var{dirname}
+This @samp{libjava} option sets the value of the @samp{java.home}
+system property.  It is also used to set @samp{sun.boot.class.path} to
+@file{@var{dirname}/lib/rt.jar}.  By default @samp{java.home} is set
+to @file{@var{prefix}} and @samp{sun.boot.class.path} to
+@file{@var{datadir}/java/libgcj-@var{version}.jar}.
 
 @item --enable-languages=@var{lang1},@var{lang2},@dots{}
 Specify that only a particular subset of compilers and
Index: libjava/Makefile.am
===================================================================
RCS file: /cvs/gcc/gcc/libjava/Makefile.am,v
retrieving revision 1.471
diff -u -r1.471 Makefile.am
--- libjava/Makefile.am	1 Apr 2005 19:19:04 -0000	1.471
+++ libjava/Makefile.am	5 Apr 2005 01:20:23 -0000
@@ -184,6 +184,7 @@
 	-D_GNU_SOURCE \
 	-DPREFIX="\"$(prefix)\"" \
 	-DLIBDIR="\"$(libdir)\"" \
+	-DJAVA_HOME="\"$(JAVA_HOME)\"" \
 	-DBOOT_CLASS_PATH="\"$(jardir)/$(jar_DATA)\"" \
 	-DJAVA_EXT_DIRS="\"$(jardir)/ext\"" \
 	-DGCJ_ENDORSED_DIRS="\"$(jardir)/gcj-endorsed\"" \
Index: libjava/configure.ac
===================================================================
RCS file: /cvs/gcc/gcc/libjava/configure.ac,v
retrieving revision 1.25
diff -u -r1.25 configure.ac
--- libjava/configure.ac	2 Apr 2005 02:26:50 -0000	1.25
+++ libjava/configure.ac	5 Apr 2005 01:21:06 -0000
@@ -74,6 +74,15 @@
     [version_specific_libs=no]
 )
 
+AC_ARG_WITH(java-home,
+  AS_HELP_STRING([--with-java-home=DIRECTORY],
+                 [value of java.home system property]),
+		 [JAVA_HOME="${withval}"
+		  AC_DEFINE(JAVA_HOME_SET, 1,
+                            [Define if --with-java-home was given])],
+		 [JAVA_HOME=""])
+AC_SUBST(JAVA_HOME)
+
 # Default to --enable-multilib
 AC_ARG_ENABLE(multilib,
   AS_HELP_STRING([--enable-multilib],
Index: libjava/java/lang/natRuntime.cc
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/lang/natRuntime.cc,v
retrieving revision 1.53
diff -u -r1.53 natRuntime.cc
--- libjava/java/lang/natRuntime.cc	2 Apr 2005 02:26:51 -0000	1.53
+++ libjava/java/lang/natRuntime.cc	5 Apr 2005 01:21:10 -0000
@@ -50,6 +50,14 @@
 #include <langinfo.h>
 #endif
 
+#ifdef JAVA_HOME_SET
+#define JAVA_HOME_PROP JAVA_HOME
+#define BOOT_CLASS_PATH_PROP JAVA_HOME"/lib/rt.jar"
+#else
+#define JAVA_HOME_PROP PREFIX
+#define BOOT_CLASS_PATH_PROP BOOT_CLASS_PATH
+#endif
+
 
 
 #ifdef USE_LTDL
@@ -398,7 +406,7 @@
   // part we do this because most people specify only --prefix and
   // nothing else when installing gcj.  Plus, people are free to
   // redefine `java.home' with `-D' if necessary.
-  SET ("java.home", PREFIX);
+  SET ("java.home", JAVA_HOME_PROP);
   SET ("gnu.classpath.home", PREFIX);
   // This is set to $(libdir) because we use this to find .security
   // files at runtime.
@@ -534,7 +542,7 @@
   SET ("gnu.gcj.runtime.endorsed.dirs", GCJ_ENDORSED_DIRS);
 
   // The path to libgcj's boot classes
-  SET ("sun.boot.class.path", BOOT_CLASS_PATH);
+  SET ("sun.boot.class.path", BOOT_CLASS_PATH_PROP);
 
   // If there is a default system database, set it.
   SET ("gnu.gcj.precompiled.db.path", LIBGCJ_DEFAULT_DATABASE);

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]