From 03b8eaaddec1ba9a586be7987111526fa7ea088d Mon Sep 17 00:00:00 2001 From: fitzsim Date: Tue, 30 May 2006 21:38:51 +0000 Subject: 2006-05-30 Thomas Fitzsimmons * scripts/makemake.tcl (emit_bc_rule): Do not skip gnu-java-awt-peer-gtk.lo. Include gnu/java/awt/peer/gtk Java objects in libgcj.so. Use C++ ABI for gnu/java/awt/peer/gtk package. * gnu/classpath/natSystemProperties.cc (PrependVersionedLibdir): New function. (insertSystemProperties): Only set java.ext.dirs if it is not already defined. Prepend GCJ_VERSIONED_LIBDIR to module search path where necessary. * configure.ac (GTK_AWT): Remove automake conditional. * include/jvm.h (_Jv_PrependVersionedLibdir): New function declaration. * gij.cc (main): Prepend LD_LIBRARY_PATH with GCJ_VERSIONED_LIBDIR and re-exec self. * Makefile.am (AM_CXXFLAGS): Define GCJ_VERSIONED_LIBDIR, GIJ_EXECUTABLE and PATH_SEPARATOR macros. Remove lib-gnu-java-awt-peer-gtk.la and libgcjawt.la build logic. * prims.cc (_Jv_PrependVersionedLibdir): New function. 2006-05-30 Thomas Fitzsimmons * native/jni/gtk-peer/Makefile.am (gcc_version): New variable. (gcjversionedlibdir): Likewise. (libgtkpeer_la_LDFLAGS): Likewise. Install libgtkpeer.so in GCJ versioned library directory. * native/jawt/Makefile.am (gcc_version): New variable. (gcjversionedlibdir): Likewise. (libjawt_la_LDFLAGS): Likewise. Rename libjawtgnu.so libjawt.so. Install libjawt.so in GCJ versioned library directory. * gnu/java/awt/peer/gtk/GdkFontPeer.java (static): Call System.loadLibrary unconditionally. * gnu/java/awt/peer/gtk/GdkPixbufDecoder.java: Likewise. * gnu/java/awt/peer/gtk/GdkGraphics2D.java: Likewise. * gnu/java/awt/peer/gtk/GdkGraphics.java: Likewise. * gnu/java/awt/peer/gtk/GtkToolkit.java: Likewise. * gnu/java/awt/peer/gtk/GdkTextLayout.java: Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@114247 138bc75d-0d04-0410-961f-82ee72b054a4 --- libjava/gnu/classpath/natSystemProperties.cc | 42 +++++++++++++++++++++------- 1 file changed, 32 insertions(+), 10 deletions(-) (limited to 'libjava/gnu') diff --git a/libjava/gnu/classpath/natSystemProperties.cc b/libjava/gnu/classpath/natSystemProperties.cc index f21220f1f6d..2a39e079b8a 100644 --- a/libjava/gnu/classpath/natSystemProperties.cc +++ b/libjava/gnu/classpath/natSystemProperties.cc @@ -121,6 +121,26 @@ getpwuid_adaptor(T_passwd * (*getpwuid_r)(T_uid user_id, T_passwd *pwd_r, } #endif +// Prepend GCJ_VERSIONED_LIBDIR to a module search path stored in a +// Java string, if the path is not already prefixed by +// GCJ_VERSIONED_LIBDIR. Return a newly JvMalloc'd char buffer. The +// result should be freed using JvFree. See +// _Jv_PrependVersionedLibdir in prims.cc. +static char* +PrependVersionedLibdir (::java::lang::String* libpath) +{ + char* retval = 0; + + // Extract a C char array from libpath. + char* val = (char*) _Jv_Malloc (JvGetStringUTFLength (libpath) + 1); + jsize total = JvGetStringUTFRegion (libpath, 0, libpath->length(), val); + val[total] = '\0'; + retval = _Jv_PrependVersionedLibdir (val); + JvFree (val); + + return retval; +} + void gnu::classpath::SystemProperties::insertSystemProperties (java::util::Properties *newprops) { @@ -288,8 +308,11 @@ gnu::classpath::SystemProperties::insertSystemProperties (java::util::Properties SET ("user.region", "US"); } - // The java extensions directory. - SET ("java.ext.dirs", JAVA_EXT_DIRS); + // Set the java extension directories property if it has not yet been + // specified. + ::java::lang::String *extdirs = newprops->getProperty(JvNewStringLatin1("java.ext.dirs")); + if (! extdirs) + SET ("java.ext.dirs", JAVA_EXT_DIRS); // The endorsed directories that libgcj knows about by default. // This is a way to get other jars into the boot class loader @@ -343,9 +366,9 @@ gnu::classpath::SystemProperties::insertSystemProperties (java::util::Properties ::java::lang::String *path = newprops->getProperty(JvNewStringLatin1("java.library.path")); if (path) { - char *val = (char *) _Jv_Malloc (JvGetStringUTFLength (path) + 1); - jsize total = JvGetStringUTFRegion (path, 0, path->length(), val); - val[total] = '\0'; + // Prepend GCJ_VERSIONED_LIBDIR to the module load path so that + // libgcj will find its own JNI libraries, like libgtkpeer.so. + char* val = PrependVersionedLibdir (path); _Jv_SetDLLSearchPath (val); _Jv_Free (val); } @@ -354,11 +377,10 @@ gnu::classpath::SystemProperties::insertSystemProperties (java::util::Properties // Set a value for user code to see. #ifdef USE_LTDL char *libpath = getenv (LTDL_SHLIBPATH_VAR); - if (libpath) - newprops->put(JvNewStringLatin1 ("java.library.path"), - JvNewStringLatin1 (libpath)); - else - SET ("java.library.path", ""); + char* val = _Jv_PrependVersionedLibdir (libpath); + SET ("java.library.path", val); + _Jv_SetDLLSearchPath (val); + _Jv_Free (val); #else SET ("java.library.path", ""); #endif -- cgit v1.2.3