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: RFA: Set default value for java.library.path


Hi,

java.library.path should default to the contents of the shared library
path environment variable (LD_LIBRARY_PATH on GNU/Linux).  To make this
cross-platform I've used libltdl's AC_LTDL_SHLIBPATH macro to define
LTDL_SHLIBPATH_VAR.  With this patch the aclocal call used in
gcc/libjava needs one extra -I argument, becoming:

aclocal -I . -I .. -I ../config -I ./libltdl

The order of -I arguments to aclocal is important; misplacing
-I ./libltdl gives strange results.

OK for mainline?

Tom

2005-09-07  Thomas Fitzsimmons  <fitzsim@redhat.com>

	PR libgcj/23762
	* configure.ac: If libltdl is being used call AC_LTDL_SHLIBPATH
	macro.
	* gnu/classpath/natSystemProperties.cc (insertSystemProperties)
	[USE_LTDL]: If it was not defined with -D set java.library.path to
	the value of LTDL_SHLIBPATH_VAR.

Index: configure.ac
===================================================================
RCS file: /cvs/gcc/gcc/libjava/configure.ac,v
retrieving revision 1.39
diff -u -r1.39 configure.ac
--- configure.ac	30 Aug 2005 01:52:12 -0000	1.39
+++ configure.ac	7 Sep 2005 15:15:36 -0000
@@ -142,8 +142,12 @@
 AC_SUBST(LIBGCJ_JAVAFLAGS)
 AC_SUBST(LIBGCJ_LD_SYMBOLIC)
 
-AC_CONFIG_HEADERS([include/config.h gcj/libgcj-config.h])
+# Only use libltdl for non-newlib builds.
+if test "x${with_newlib}" = "x" || test "x${with_newlib}" = "xno"; then
+   AC_LTDL_SHLIBPATH
+fi
 
+AC_CONFIG_HEADERS([include/config.h gcj/libgcj-config.h])
 
 # See if the user has requested runtime debugging.
 LIBGCJDEBUG="disable"
Index: gnu/classpath/natSystemProperties.cc
===================================================================
RCS file: /cvs/gcc/gcc/libjava/gnu/classpath/natSystemProperties.cc,v
retrieving revision 1.1
diff -u -r1.1 natSystemProperties.cc
--- gnu/classpath/natSystemProperties.cc	25 Apr 2005 19:48:34 -0000	1.1
+++ gnu/classpath/natSystemProperties.cc	7 Sep 2005 15:15:38 -0000
@@ -350,9 +352,16 @@
   else
     {
       // Set a value for user code to see.
-      // FIXME: JDK sets this to the actual path used, including
-      // LD_LIBRARY_PATH, etc.
+#ifdef USE_LTDL
+      char *libpath = getenv (LTDL_SHLIBPATH_VAR);
+      if (libpath)
+        newprops->put(JvNewStringLatin1 ("java.library.path"),
+                      JvNewStringLatin1 (libpath));
+      else
+        SET ("java.library.path", "");
+#else
       SET ("java.library.path", "");
+#endif
     }
 
   // If java.class.path is still not set then set it according to the

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