This is the mail archive of the
java-patches@gcc.gnu.org
mailing list for the Java project.
Re: [patch] add --with-java-home configure option
Thomas Fitzsimmons wrote:
Good point. Here's an updated patch. OK for mainline and gcc-4_0-
branch?
I'm going to pick at a few nits here...
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}.
How about "overrides the default value of ..." - sounds a bit more clear?
@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\"" \
This shouldn't be needed as configure will just put JAVA_HOME in
config.h, if you AC_DEFINE it?
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],
Likewise, shouldn't need JAVA_HOME_SET if you just "AC_DEFINE
(JAVA_HOME, ...)" and leave it undefined in the other case.
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);
I think it would make things easier to read if the logic was all in one
place here (ie the way it was before), instead of splitting it up?
eg:
#ifdef JAVA_HOME
SET ("java.home", JAVA_HOME);
SET ("sun.boot.class.path", ....);
else
SET ("java.home", PREFIX);
....
Patch is OK everywhere with these changes.
Regards
Bryce