common/autoconf/boot-jdk.m4

Print this page

        

@@ -256,20 +256,34 @@
     AC_MSG_NOTICE([Could not find a valid Boot JDK. $HELP_MSG])
     AC_MSG_NOTICE([This might be fixed by explicitely setting --with-boot-jdk])
     AC_MSG_ERROR([Cannot continue])
   fi
 
-  # Setup proper paths for what we found
-  BOOT_RTJAR="$BOOT_JDK/jre/lib/rt.jar"
-  if test ! -f "$BOOT_RTJAR"; then
-    # On MacOSX it is called classes.jar
-    BOOT_RTJAR="$BOOT_JDK/../Classes/classes.jar"
-    if test -f "$BOOT_RTJAR"; then
-      # Remove the ..
-      BOOT_RTJAR="`cd ${BOOT_RTJAR%/*} && pwd`/${BOOT_RTJAR##*/}"
-    fi
+  # Get the value of BOOT_RTJAR by parsing the 'sun.boot.class.path' property.
+  # We only use the existing jar-files and directories of 'sun.boot.class.path'.
+  #
+  # The tricky thing is that we must quote AWK field references (i.e. $1, $2, ..)
+  # and the name 'index' which is a M4-buildin function by placing brackets
+  # (i.e. '[]') into the corresponding names.
+  BOOT_RTJAR=`$BOOT_JDK/bin/java -XshowSettings:properties 2>&1 | $NAWK ' \
+      /path.separator/      { path_separator = $[]3 } \
+      /sun.boot.class.path/ { if (system("test -e \"" $[]3 "\"") == 0) sun_boot_class_path = $[]3; \
+                              while (getline && !in[]dex($[]0,"=")) { \
+                                if (system("test -e \"" $[]1 "\"") == 0) sun_boot_class_path = sun_boot_class_path "\n" $[]1 \
+                              } \
+                              sub("^\n", "", sun_boot_class_path) \
+                            } \
+      END { gsub("\n", path_separator, sun_boot_class_path); print sun_boot_class_path }'`
+
+  # The content of sun.boot.class.path is in Windows form on Windows.
+  # We have to convert it to Unix form first, but with Windows path
+  # separators. This is required by the FIXPATH utility which will convert
+  # it back to the Windows form later on during the build process.
+  if test "x$OPENJDK_TARGET_OS" = xwindows; then
+    BOOT_RTJAR=`cygpath -u -p "$BOOT_RTJAR" | $TR ':' ';'`
   fi
+
   BOOT_TOOLSJAR="$BOOT_JDK/lib/tools.jar"
   BOOT_JDK="$BOOT_JDK"
   AC_SUBST(BOOT_RTJAR)
   AC_SUBST(BOOT_TOOLSJAR)
   AC_SUBST(BOOT_JDK)