This is the mail archive of the java-patches@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Patch: FYI: gij --showversion and java.library.path


I'm checking this in.

This patch adds --showversion support to gij.  This is for
compatibility with the JDK java command.

This also adds support for the java.library.path System property.

Documentation patch included.

Tom

Index: ChangeLog
from  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.

Index: gij.cc
===================================================================
RCS file: /cvs/gcc/gcc/libjava/gij.cc,v
retrieving revision 1.19
diff -u -r1.19 gij.cc
--- gij.cc 22 Aug 2002 22:44:26 -0000 1.19
+++ gij.cc 24 Oct 2002 22:40:53 -0000
@@ -34,6 +34,7 @@
   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 @@
   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 @@
       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: java/lang/natRuntime.cc
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/lang/natRuntime.cc,v
retrieving revision 1.26
diff -u -r1.26 natRuntime.cc
--- java/lang/natRuntime.cc 20 Oct 2002 23:47:43 -0000 1.26
+++ java/lang/natRuntime.cc 24 Oct 2002 22:40:54 -0000
@@ -102,14 +102,26 @@
   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 */
 
 
@@ -538,6 +550,25 @@
 
   // 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 *
Index: ChangeLog
from  Tom Tromey  <tromey@redhat.com>

	* gcj.texi (Invoking gij): Document --showversion.
	(Standard Properties): java.library.path now set.

Index: gcj.texi
===================================================================
RCS file: /cvs/gcc/gcc/gcc/java/gcj.texi,v
retrieving revision 1.41
diff -u -r1.41 gcj.texi
--- gcj.texi 20 Oct 2002 23:47:05 -0000 1.41
+++ gcj.texi 25 Oct 2002 03:25:41 -0000
@@ -775,7 +775,7 @@
   [@option{-cp} @var{path}] [@option{-classpath} @var{path}]
   [@option{-D}@var{name}[=@var{value}]@dots{}]
   [@option{-ms=}@var{number}] [@option{-mx=}@var{number}]
-  [@option{--version}] [@option{--help}]
+  [@option{--showversion}] [@option{--version}] [@option{--help}]
 @c man end
 @c man begin SEEALSO gij
 gcc(1), gcj(1), gcjh(1), jv-scan(1), jcf-dump(1), gfdl(7),
@@ -842,6 +842,9 @@
 @item --help
 Print help, then exit.
 
+@item --showversion
+Print version number and continue.
+
 @item --version
 Print version number, then exit.
 @end table
@@ -2065,7 +2068,7 @@
 The paths (jar files, zip files and directories) used for finding class files.
 
 @item java.library.path
-Directory path used for finding native libraries.  Currently not set.
+Directory path used for finding native libraries.
 
 @item java.io.tmpdir
 The directory used to put temporary files in.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]