X-Git-Url: http://git.sourceforge.jp/view?a=blobdiff_plain;f=libjava%2Fgij.cc;h=c04b1d889a8492c3b9739edb842d382b85c074cb;hb=b65ec27fff70d4767110ff0ffa7c7b27396ddc10;hp=817378f8bca1a6a5ea79e79ff95cbc9f19ddca98;hpb=2bc98306edc176961bc1602d1f84183a418c2be6;p=pf3gnuchains%2Fgcc-fork.git diff --git a/libjava/gij.cc b/libjava/gij.cc index 817378f8bca..c04b1d889a8 100644 --- a/libjava/gij.cc +++ b/libjava/gij.cc @@ -1,4 +1,4 @@ -/* Copyright (C) 1999-2006 Free Software Foundation +/* Copyright (C) 1999-2007 Free Software Foundation This file is part of libgcj. @@ -14,7 +14,6 @@ #include #include #include -#include static void help () @@ -43,7 +42,7 @@ version () { printf ("java version \"" JV_VERSION "\"\n"); printf ("gij (GNU libgcj) version %s\n\n", __VERSION__); - printf ("Copyright (C) 2006 Free Software Foundation, Inc.\n"); + printf ("Copyright (C) 2007 Free Software Foundation, Inc.\n"); printf ("This is free software; see the source for copying conditions. There is NO\n"); printf ("warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n"); } @@ -72,52 +71,6 @@ 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)) - { - char *buffer = (char *) JvMalloc (strlen (LTDL_SHLIBPATH_VAR) - + strlen (newpath) + 2); - strcpy (buffer, LTDL_SHLIBPATH_VAR); - strcat (buffer, "="); - strcat (buffer, newpath); - putenv (buffer); - 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; @@ -168,11 +121,11 @@ main (int argc, char const** argv) continue; else if (! strcmp (arg, "-jrockit")) continue; - // Ignore JVM Tool Interface options + // JVM Tool Interface options. else if (! strncmp (arg, "-agentlib:", sizeof ("-agentlib:") - 1)) - continue; + add_option (vm_args, arg, NULL); else if (! strncmp (arg, "-agentpath:", sizeof ("-agentpath:") - 1)) - continue; + add_option (vm_args, arg, NULL); else if (! strcmp (arg, "-classpath") || ! strcmp (arg, "-cp")) { if (i >= argc - 1)