diff options
author | fitzsim <fitzsim@138bc75d-0d04-0410-961f-82ee72b054a4> | 2006-05-30 21:38:51 +0000 |
---|---|---|
committer | fitzsim <fitzsim@138bc75d-0d04-0410-961f-82ee72b054a4> | 2006-05-30 21:38:51 +0000 |
commit | 03b8eaaddec1ba9a586be7987111526fa7ea088d (patch) | |
tree | 541f5e5b869d78007d2f185daf6d91235889cc93 /libjava/gij.cc | |
parent | 5f4f36179fad688358074cd9dd9cd0461168334a (diff) | |
download | gcc-03b8eaaddec1ba9a586be7987111526fa7ea088d.tar.gz |
2006-05-30 Thomas Fitzsimmons <fitzsim@redhat.com>
* 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 <fitzsim@redhat.com>
* 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
Diffstat (limited to 'libjava/gij.cc')
-rw-r--r-- | libjava/gij.cc | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/libjava/gij.cc b/libjava/gij.cc index b10e53b0808..933fe503df4 100644 --- a/libjava/gij.cc +++ b/libjava/gij.cc @@ -14,6 +14,7 @@ #include <stdio.h> #include <string.h> #include <stdlib.h> +#include <unistd.h> static void help () @@ -71,6 +72,47 @@ add_option (JvVMInitArgs& vm_args, char const* option, void const* extra) int main (int argc, char const** argv) { + // libjawt.so must be installed in GCJ's versioned directory and not + // the main library directory so that it doesn't override other + // libjawt.so implementations. Programs that use the AWT Native + // Interface contain a JNI library that links to libjawt.so. We do + // not want to require that users explicitly add GCJ's versioned + // directory to LD_LIBRARY_PATH when running such programs. + + // Simply adding GCJ's versioned directory to the module load path + // does not solve this problem since libltdl searches its module + // load path only for object that it will dlopen; dependencies of + // these dynamically loaded objects are searched for in + // LD_LIBRARY_PATH. + + // In addition, setting LD_LIBRARY_PATH from within the current + // process does not alter the dependency search path, since it is + // computed on startup. This behaviour makes sense since + // LD_LIBRARY_PATH is designed to allow users to override the path + // set by a program. This re-spawning trick makes it impossible to + // override, using LD_LIBRARY_PATH, the versioned directories + // searched by gij. + + // Check if LD_LIBRARY_PATH is already prefixed with + // GCJ_VERSIONED_LIBDIR. If not, export LD_LIBRARY_PATH prefixed + // with GCJ_VERSIONED_LIBDIR and re-spawn gij. + char *libpath = getenv (LTDL_SHLIBPATH_VAR); + char *newpath = _Jv_PrependVersionedLibdir (libpath); + + if (! libpath || strcmp (libpath, newpath)) + { + setenv (LTDL_SHLIBPATH_VAR, newpath, 1); + JvFree (newpath); + + int error_code = execvp (argv[0], (char* const*) argv); + + fprintf (stderr, "error re-spawning gij with new " + LTDL_SHLIBPATH_VAR " value: %s\n", strerror (error_code)); + + return error_code; + } + JvFree (newpath); + JvVMInitArgs vm_args; bool jar_mode = false; |