* java/lang/natRuntime.cc (_Jv_SetDLLSearchPath): New function.
authortromey <tromey@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 25 Oct 2002 03:28:00 +0000 (03:28 +0000)
committertromey <tromey@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 25 Oct 2002 03:28:00 +0000 (03:28 +0000)
(_Jv_FindSymbolInExecutable): Removed argument name.
(insertSystemProperties): Call _Jv_SetDLLSearchPath if
java.library.path is set.

* gij.cc (help): Document --showversion.
(version): Don't exit.
(main): Handle --showversion.  Exit if --version given.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@58520 138bc75d-0d04-0410-961f-82ee72b054a4

libjava/ChangeLog
libjava/gij.cc
libjava/java/lang/natRuntime.cc

index faa6c68..4db95b0 100644 (file)
@@ -1,3 +1,14 @@
+2002-10-24  Tom Tromey  <tromey@redhat.com>
+
+       * java/lang/natRuntime.cc (_Jv_SetDLLSearchPath): New function.
+       (_Jv_FindSymbolInExecutable): Removed argument name.
+       (insertSystemProperties): Call _Jv_SetDLLSearchPath if
+       java.library.path is set.
+
+       * gij.cc (help): Document --showversion.
+       (version): Don't exit.
+       (main): Handle --showversion.  Exit if --version given.
+
 2002-10-23  Tom Tromey  <tromey@redhat.com>
 
        * jni.cc (_Jv_JNI_AllocObject): Removed old FIXME comment.
index 47b2d60..293f3c3 100644 (file)
@@ -34,6 +34,7 @@ help ()
   printf ("  --help            print this help, then exit\n");
   printf ("  --ms=NUMBER       set initial heap size\n");
   printf ("  --mx=NUMBER       set maximum heap size\n");
+  printf ("  --showversion     print version number, then keep going\n");
   printf ("  --version         print version number, then exit\n");
   printf ("\nOptions can be specified with `-' or `--'.\n");
   printf ("\nSee http://gcc.gnu.org/java/ for information on reporting bugs\n");
@@ -47,7 +48,6 @@ version ()
   printf ("Copyright (C) 2002 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");
-  exit (0);
 }
 
 int
@@ -93,6 +93,11 @@ main (int argc, const char **argv)
       if (! strcmp (arg, "-help"))
        help ();
       else if (! strcmp (arg, "-version"))
+       {
+         version ();
+         exit (0);
+       }
+      else if (! strcmp (arg, "-showversion"))
        version ();
       /* FIXME: use getopt and avoid the ugliness here.
         We at least need to handle the argument in a better way.  */
index d0a64e7..0dcf578 100644 (file)
@@ -102,14 +102,26 @@ _Jv_FindSymbolInExecutable (const char *symname)
   return NULL;
 }
 
+void
+_Jv_SetDLLSearchPath (const char *path)
+{
+  lt_dlsetsearchpath (path);
+}
+
 #else
 
 void *
-_Jv_FindSymbolInExecutable (const char *symname)
+_Jv_FindSymbolInExecutable (const char *)
 {
   return NULL;
 }
 
+void
+_Jv_SetDLLSearchPath (const char *)
+{
+  // Nothing.
+}
+
 #endif /* USE_LTDL */
 
 \f
@@ -538,6 +550,25 @@ java::lang::Runtime::insertSystemProperties (java::util::Properties *newprops)
 
   // Allow platform specific settings and overrides.
   _Jv_platform_initProperties (newprops);
+
+  // If java.library.path is set, tell libltdl so we search the new
+  // directories as well.  FIXME: does this work properly on Windows?
+  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';
+      _Jv_SetDLLSearchPath (val);
+      _Jv_Free (val);
+    }
+  else
+    {
+      // Set a value for user code to see.
+      // FIXME: JDK sets this to the actual path used, including
+      // LD_LIBRARY_PATH, etc.
+      SET ("java.library.path", "");
+    }
 }
 
 java::lang::Process *