This is the mail archive of the
java-patches@gcc.gnu.org
mailing list for the Java project.
[patch] add --with-java-home configure option
- From: Thomas Fitzsimmons <fitzsim at redhat dot com>
- To: java-patches at gcc dot gnu dot org
- Date: Mon, 04 Apr 2005 18:19:46 -0400
- Subject: [patch] add --with-java-home configure option
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.
Tom
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.
* java/lang/natRuntime.cc
(insertSystemProperties): Set java.home and sun.boot.class.path
based on JAVA_HOME
* testsuite/Makefile.in: Regenerate.
Index: Makefile.am
===================================================================
RCS file: /cvs/gcc/gcc/libjava/Makefile.am,v
retrieving revision 1.471
diff -u -r1.471 Makefile.am
--- Makefile.am 1 Apr 2005 19:19:04 -0000 1.471
+++ Makefile.am 4 Apr 2005 22:03:13 -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: configure.ac
===================================================================
RCS file: /cvs/gcc/gcc/libjava/configure.ac,v
retrieving revision 1.25
diff -u -r1.25 configure.ac
--- configure.ac 2 Apr 2005 02:26:50 -0000 1.25
+++ configure.ac 4 Apr 2005 22:03:51 -0000
@@ -74,6 +74,12 @@
[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}"],[JAVA_HOME=""])
+AC_SUBST(JAVA_HOME)
+
# Default to --enable-multilib
AC_ARG_ENABLE(multilib,
AS_HELP_STRING([--enable-multilib],
Index: 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
--- java/lang/natRuntime.cc 2 Apr 2005 02:26:51 -0000 1.53
+++ java/lang/natRuntime.cc 4 Apr 2005 22:03:55 -0000
@@ -398,7 +398,10 @@
// 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);
+ if (! strcmp (JAVA_HOME, ""))
+ SET ("java.home", PREFIX);
+ else
+ SET ("java.home", JAVA_HOME);
SET ("gnu.classpath.home", PREFIX);
// This is set to $(libdir) because we use this to find .security
// files at runtime.
@@ -534,7 +537,15 @@
SET ("gnu.gcj.runtime.endorsed.dirs", GCJ_ENDORSED_DIRS);
// The path to libgcj's boot classes
- SET ("sun.boot.class.path", BOOT_CLASS_PATH);
+ if (! strcmp (JAVA_HOME, ""))
+ SET ("sun.boot.class.path", BOOT_CLASS_PATH);
+ else
+ {
+ char boot_val[sizeof (JAVA_HOME) + sizeof ("/lib/rt.jar") + 1];
+ strcpy (boot_val, JAVA_HOME);
+ strcat (boot_val, "/lib/rt.jar");
+ SET ("sun.boot.class.path", boot_val);
+ }
// If there is a default system database, set it.
SET ("gnu.gcj.precompiled.db.path", LIBGCJ_DEFAULT_DATABASE);