[vmkit-commits] [vmkit] r146346 - in /vmkit/trunk: autoconf/configure.ac lib/j3/ClassLib/Classpath.h.in lib/j3/ClassLib/OpenJDK/OpenJDK.inc

Will Dietz wdietz2 at illinois.edu
Sun Dec 11 12:42:56 PST 2011


Author: wdietz2
Date: Sun Dec 11 14:42:56 2011
New Revision: 146346

URL: http://llvm.org/viewvc/llvm-project?rev=146346&view=rev
Log:
OpenJDK: Improved path support, simpler configure-time parameters.

Properly set various paths from input JDK path.
java.home should point to a JRE, not the JDK, for example.

Additionally, set java.ext.dirs so programs can find the classes there
(in particular enables various crypto-related codes to work)

Modified:
    vmkit/trunk/autoconf/configure.ac
    vmkit/trunk/lib/j3/ClassLib/Classpath.h.in
    vmkit/trunk/lib/j3/ClassLib/OpenJDK/OpenJDK.inc

Modified: vmkit/trunk/autoconf/configure.ac
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/autoconf/configure.ac?rev=146346&r1=146345&r2=146346&view=diff
==============================================================================
--- vmkit/trunk/autoconf/configure.ac (original)
+++ vmkit/trunk/autoconf/configure.ac Sun Dec 11 14:42:56 2011
@@ -206,24 +206,15 @@
 dnl **************************************************************************
 dnl OpenJDK Paths
 dnl **************************************************************************
-dnl Chat with OpenJDK folk about best way to look for the things we need
-dnl For now, this should suffice.
 
-AC_ARG_WITH(openjdk-jre,
-       [AS_HELP_STRING(--with-openjdk-jre,
-           [Build J3 with OpenJDK JRE install (default is '/usr/lib/java/jre')])],
-       [[openjdkjre=$withval]],
-       [[openjdkjre=/usr/lib/java/jre]]
+AC_ARG_WITH(openjdk-path,
+       [AS_HELP_STRING(--with-openjdk-path,
+           [Build J3 with OpenJDK JRE install (default is '/usr/lib/java/')])],
+       [[openjdkpath=$withval]],
+       [[openjdkpath=/usr/lib/java/]]
 )
 
-AC_ARG_WITH(openjdk-arch-dir,
-       [AS_HELP_STRING(--with-openjdk-arch-dir,
-           [Location of architecture-specific OpenJDK libraries (default is '/usr/lib/java/jre/lib/i386')])],
-       [[openjdkarchdir=$withval]],
-       [[openjdkarchdir=/usr/lib/java/jre/lib/i386]]
-)
-AC_SUBST([openjdkjre])
-AC_SUBST([openjdkarchdir])
+AC_SUBST([openjdkpath])
 
 
 dnl **************************************************************************
@@ -253,15 +244,9 @@
       ;;
   openjdk)
     AC_MSG_NOTICE(Validating OpenJDK installation...)
-    AC_CHECK_FILES([${openjdkjre}]
-                   [${openjdkjre}/lib/rt.jar],,
-      AC_MSG_ERROR([[Invalid OpenJDK JRE path, can't find required jar files!]]))
-    AC_CHECK_FILE([${openjdkarchdir}],,
-      AC_MSG_ERROR([[Invalid OpenJDK arch dir]]))
-    dnl Check that $archdir/client/libjava.so or $archdir/server/libjava.so exist
-    AC_CHECK_FILE([${openjdkarchdir}]/client/libjvm.$DYLIB_EXTENSION,,
-      AC_CHECK_FILE([${openjdkarchdir}]/server/libjvm.$DYLIB_EXTENSION,,
-        AC_MSG_ERROR([[Can't find libjvm.$DYLIB_EXTENSION]])))
+    AC_CHECK_FILES([${openjdkpath}]
+                   [${openjdkpath}/jre/lib/rt.jar],,
+      AC_MSG_ERROR([[Invalid OpenJDK JDK path, can't find required jar files!]]))
       ;;
   *)
     AC_MSG_ERROR([Invalid --with-classpath-impl "${classpathimpl}".  Must be one of "gnuclasspath" or "openjdk"])

Modified: vmkit/trunk/lib/j3/ClassLib/Classpath.h.in
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/j3/ClassLib/Classpath.h.in?rev=146346&r1=146345&r2=146346&view=diff
==============================================================================
--- vmkit/trunk/lib/j3/ClassLib/Classpath.h.in (original)
+++ vmkit/trunk/lib/j3/ClassLib/Classpath.h.in Sun Dec 11 14:42:56 2011
@@ -9,6 +9,7 @@
 
 // Historically has been included here, keep it for now
 #include <jni.h>
+#include "vmkit/System.h"
 
 #ifndef USE_OPENJDK
 
@@ -23,27 +24,35 @@
 #else
 
 // OpenJDK values
-#define OpenJDKJRE "@openjdkjre@"
-#define OpenJDKArch "@openjdkarchdir@"
+#define OpenJDKPath "@openjdkpath@"
 
-// OpenJDK Bootstrap classpath
-extern const char * OpenJDKBootPath;
+// Select which architecture directory name to use
+#if ARCH_X86
+#define OpenJDKArchComp "i386"
+#elif ARCH_X64
+#define OpenJDKArchComp "amd64"
+#else
+#error "Unsupported architecture"
+#endif
 
-// Location of OpenJDK's libjava.so
-#define OpenJDKLibJava OpenJDKArch "/libjava.so"
+// Build various other paths from OpenJDKPath
+// Done this way to make them compile-time constants.
+#define OpenJDKJRE OpenJDKPath "/jre"
+#define OpenJDKArchDir OpenJDKJRE "/lib/" OpenJDKArchComp
+#define OpenJDKLibJava OpenJDKArchDir "/libjava.so"
+#define OpenJDKExtDirs OpenJDKJRE "/lib/ext"
 
 // Search path for native library files
-// TODO: Use LD_LIBRARY_PATH to second part of this?
-#define OpenJDKLibPaths \
-      OpenJDKArch \
-  ":" OpenJDKArch "/client" \
-  ":" OpenJDKArch "/server" \
-  ":" "/lib" \
-  ":" "/lib64" \
-  ":" "/usr/lib" \
-  ":" "/usr/lib64"
+#define OpenJDKSystemLibPaths "/lib:/lib64:/usr/lib:/usr/lib64"
+#define OpenJDKLibPath \
+      OpenJDKArchDir \
+  ":" OpenJDKArchDir "/server/" \
+  ":" OpenJDKSystemLibPaths
+
+// Bootstrap path. Defined in JavaUpcalls.cpp to add VMString location.
+extern const char * OpenJDKBootPath;
 
 #define ClasslibBootEnv OpenJDKBootPath
-#define ClasslibLibEnv OpenJDKLibPaths
+#define ClasslibLibEnv OpenJDKLibPath
 
 #endif // USE_OPENJDK

Modified: vmkit/trunk/lib/j3/ClassLib/OpenJDK/OpenJDK.inc
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/j3/ClassLib/OpenJDK/OpenJDK.inc?rev=146346&r1=146345&r2=146346&view=diff
==============================================================================
--- vmkit/trunk/lib/j3/ClassLib/OpenJDK/OpenJDK.inc (original)
+++ vmkit/trunk/lib/j3/ClassLib/OpenJDK/OpenJDK.inc Sun Dec 11 14:42:56 2011
@@ -260,6 +260,12 @@
   setProperty(vm, prop, "java.version", "1.6");
   setProperty(vm, prop, "java.runtime.version", "1.6");
 
+  // Set additional path properties
+  // For now, ignore JAVA_HOME.  We don't want to be using a location
+  // other than the one we precompiled against anyway.
+  setProperty(vm, prop, "java.home", OpenJDKJRE);
+  setProperty(vm, prop, "java.ext.dirs", OpenJDKExtDirs);
+
   RETURN_FROM_JNI(p);
 
   END_JNI_EXCEPTION





More information about the vmkit-commits mailing list