changeset 989:520fd54a7c43

Merge
author jlaskey
date Tue, 16 Jul 2013 09:08:46 -0300
parents 99ad803f8c4e (diff) de886178f8e6 (current diff)
children 67dc3d7d5b5f
files common/autoconf/generated-configure.sh common/autoconf/spec.gmk.in common/makefiles/Main.gmk
diffstat 20 files changed, 1478 insertions(+), 634 deletions(-) [+]
line wrap: on
line diff
--- a/.hgtags	Wed Jun 05 13:08:59 2013 -0300
+++ b/.hgtags	Tue Jul 16 09:08:46 2013 -0300
@@ -214,3 +214,8 @@
 69b773a221b956a3386933ecdbfeccee0edeac47 jdk8-b90
 cb51fb4789ac0b8be4056482077ddfb8f3bd3805 jdk8-b91
 3a36c926a7aafa9d4a892a45ef3678e87ad8359b jdk8-b92
+27c51c6e31c1ef36afa0e6efb031f9b13f26c12b jdk8-b93
+50d2bde060f2a9bbbe4da0c8986e20aca61f2e2e jdk8-b94
+785d07fe38901ecc1b7e0145e53e1c3da9361fee jdk8-b95
+c156084add486f941c12d886a0b1b2854795d557 jdk8-b96
+a1c1e8bf71f354f3aec0214cf13d6668811e021d jdk8-b97
--- a/NewMakefile.gmk	Wed Jun 05 13:08:59 2013 -0300
+++ b/NewMakefile.gmk	Tue Jul 16 09:08:46 2013 -0300
@@ -68,12 +68,15 @@
         # First, find out the valid targets
         # Run the makefile with an arbitraty SPEC using -p -q (quiet dry-run and dump rules) to find
         # available PHONY targets. Use this list as valid targets to pass on to the repeated calls.
-        all_phony_targets=$(filter-out $(global_targets), $(strip $(shell \
-            $(MAKE) -p -q -f common/makefiles SPEC=$(firstword $(SPEC)) | \
+        all_phony_targets=$(filter-out $(global_targets) bundles-only, $(strip $(shell \
+            $(MAKE) -p -q -f common/makefiles/Main.gmk SPEC=$(firstword $(SPEC)) | \
             grep ^.PHONY: | head -n 1 | cut -d " " -f 2-)))
 
-$(all_phony_targets):
-	@$(foreach spec,$(SPEC),($(MAKE) -f NewMakefile.gmk SPEC=$(spec) $(VERBOSE) VERBOSE=$(VERBOSE) LOG_LEVEL=$(LOG_LEVEL) $@) &&) true
+        $(all_phony_targets):
+		$(foreach spec,$(SPEC),($(MAKE) -f NewMakefile.gmk SPEC=$(spec) \
+			$(VERBOSE) VERBOSE=$(VERBOSE) LOG_LEVEL=$(LOG_LEVEL) $@) &&) true
+
+        .PHONY: $(all_phony_targets)
 
     endif
 endif
--- a/README-builds.html	Wed Jun 05 13:08:59 2013 -0300
+++ b/README-builds.html	Tue Jul 16 09:08:46 2013 -0300
@@ -355,12 +355,24 @@
                     </li>
                     <li>
                         Install a
-                        <a name="bootjdk">Bootstrap JDK</a>
-                        <br>
+                        <a name="bootjdk">Bootstrap JDK</a>.
                         All OpenJDK builds require access to a previously released
-                        JDK, this is often called a bootstrap JDK.
-                        Currently, for this JDK release we require
-                        JDK 7 Update 7 or newer.
+                        JDK called the <i>bootstrap JDK</i> or <i>boot JDK.</i>
+                        The general rule is that the bootstrap JDK
+                        must be an instance of the previous major
+                        release of the JDK. In addition, there may be
+                        a requirement to use a release at or beyond a
+                        particular update level.
+                        <br>&nbsp;<br>
+
+                        <b><i>Building JDK 8 requires use of a version
+                        of JDK 7 that is at Update 7 or newer. JDK 8
+                        developers should not use JDK 8 as the boot
+                        JDK, to ensure that JDK 8 dependencies are
+                        not introduced into the parts of the system
+                        that are built with JDK 7.</i></b>
+
+                        <br>&nbsp;<br>
                         The JDK 7 binaries can be downloaded from Oracle's 
                         <a href="http://www.oracle.com/technetwork/java/javase/downloads/index.html"
                            target="_blank">JDK 7 download site</a>.
--- a/common/autoconf/basics.m4	Wed Jun 05 13:08:59 2013 -0300
+++ b/common/autoconf/basics.m4	Tue Jul 16 09:08:46 2013 -0300
@@ -43,6 +43,16 @@
     fi
 ])
 
+# Appends a string to a path variable, only adding the : when needed.
+AC_DEFUN([BASIC_APPEND_TO_PATH],
+[
+  if test "x[$]$1" = x; then
+    $1="$2"
+  else
+    $1="[$]$1:$2"
+  fi
+])
+
 # This will make sure the given variable points to a full and proper
 # path. This means:
 # 1) There will be no spaces in the path. On posix platforms,
@@ -72,7 +82,7 @@
       AC_MSG_ERROR([The path of $1, which resolves as "$path", is not found.])
     fi
 
-    $1="`cd "$path"; $THEPWDCMD`" 
+    $1="`cd "$path"; $THEPWDCMD -L`" 
   fi
 ])
 
@@ -169,10 +179,10 @@
             COUNTER=0
             sym_link_dir=`$DIRNAME [$]$1`
             sym_link_file=`$BASENAME [$]$1`
-            # Use the system pwd and not the shell builtin to resolve directory symlinks
             cd $sym_link_dir
-            cd `$THEPWDCMD`
-            sym_link_dir=`$THEPWDCMD`
+            # Use -P flag to resolve symlinks in directories.
+            cd `$THEPWDCMD -P`
+            sym_link_dir=`$THEPWDCMD -P`
             # Resolve file symlinks
             while test $COUNTER -lt 20; do
                 ISLINK=`$LS -l $sym_link_dir/$sym_link_file | $GREP '\->' | $SED -e 's/.*-> \(.*\)/\1/'`
@@ -183,7 +193,7 @@
                 # Again resolve directory symlinks since the target of the just found
                 # link could be in a different directory
                 cd `$DIRNAME $ISLINK`
-                sym_link_dir=`$THEPWDCMD`
+                sym_link_dir=`$THEPWDCMD -P`
                 sym_link_file=`$BASENAME $ISLINK`
                 let COUNTER=COUNTER+1
             done
@@ -264,7 +274,6 @@
 BASIC_REQUIRE_PROG(MKTEMP, mktemp)
 BASIC_REQUIRE_PROG(MV, mv)
 BASIC_REQUIRE_PROG(PRINTF, printf)
-BASIC_REQUIRE_PROG(THEPWDCMD, pwd)
 BASIC_REQUIRE_PROG(RM, rm)
 BASIC_REQUIRE_PROG(SH, sh)
 BASIC_REQUIRE_PROG(SORT, sort)
@@ -297,6 +306,10 @@
 # Always force rm.
 RM="$RM -f"
 
+# pwd behaves differently on various platforms and some don't support the -L flag.
+# Always use the bash builtin pwd to get uniform behavior.
+THEPWDCMD=pwd
+
 # These are not required on all platforms
 AC_PATH_PROG(CYGPATH, cygpath)
 AC_PATH_PROG(READLINK, readlink)
@@ -309,13 +322,12 @@
 [
 # Locate the directory of this script.
 SCRIPT="[$]0"
-BASIC_REMOVE_SYMBOLIC_LINKS(SCRIPT)
-AUTOCONF_DIR=`cd \`$DIRNAME $SCRIPT\`; $THEPWDCMD`
+AUTOCONF_DIR=`cd \`$DIRNAME $SCRIPT\`; $THEPWDCMD -L`
 
 # Where is the source? It is located two levels above the configure script.
 CURDIR="$PWD"
 cd "$AUTOCONF_DIR/../.."
-SRC_ROOT="`$THEPWDCMD`"
+SRC_ROOT="`$THEPWDCMD -L`"
 
 if test "x$OPENJDK_TARGET_OS" = "xwindows"; then
   PATH_SEP=";"
@@ -349,7 +361,9 @@
 AC_SUBST(SYS_ROOT)
 
 AC_ARG_WITH([tools-dir], [AS_HELP_STRING([--with-tools-dir],
-  [search this directory for compilers and tools (for cross-compiling)])], [TOOLS_DIR=$with_tools_dir])
+  [search this directory for compilers and tools (for cross-compiling)])], 
+  [TOOLS_DIR=$with_tools_dir]
+)
 
 AC_ARG_WITH([devkit], [AS_HELP_STRING([--with-devkit],
   [use this directory as base for tools-dir and sys-root (for cross-compiling)])],
@@ -357,13 +371,14 @@
     if test "x$with_sys_root" != x; then
       AC_MSG_ERROR([Cannot specify both --with-devkit and --with-sys-root at the same time])
     fi
-    if test "x$with_tools_dir" != x; then
-      AC_MSG_ERROR([Cannot specify both --with-devkit and --with-tools-dir at the same time])
+    BASIC_FIXUP_PATH([with_devkit])
+    BASIC_APPEND_TO_PATH([TOOLS_DIR],$with_devkit/bin)
+    if test -d "$with_devkit/$host_alias/libc"; then
+      SYS_ROOT=$with_devkit/$host_alias/libc
+    elif test -d "$with_devkit/$host/sys-root"; then
+      SYS_ROOT=$with_devkit/$host/sys-root
     fi
-    TOOLS_DIR=$with_devkit/bin
-    SYS_ROOT=$with_devkit/$host_alias/libc
   ])
-
 ])
 
 AC_DEFUN_ONCE([BASIC_SETUP_OUTPUT_DIR],
@@ -374,13 +389,9 @@
         [ CONF_NAME=${with_conf_name} ])
 
 # Test from where we are running configure, in or outside of src root.
-# To enable comparison of directories, CURDIR needs to be symlink free
-# just like SRC_ROOT already is
-NOSYM_CURDIR="$CURDIR"
-BASIC_REMOVE_SYMBOLIC_LINKS(NOSYM_CURDIR)
-if test "x$NOSYM_CURDIR" = "x$SRC_ROOT" || test "x$NOSYM_CURDIR" = "x$SRC_ROOT/common" \
-        || test "x$NOSYM_CURDIR" = "x$SRC_ROOT/common/autoconf" \
-        || test "x$NOSYM_CURDIR" = "x$SRC_ROOT/common/makefiles" ; then
+if test "x$CURDIR" = "x$SRC_ROOT" || test "x$CURDIR" = "x$SRC_ROOT/common" \
+        || test "x$CURDIR" = "x$SRC_ROOT/common/autoconf" \
+        || test "x$CURDIR" = "x$SRC_ROOT/common/makefiles" ; then
     # We are running configure from the src root.
     # Create a default ./build/target-variant-debuglevel output root.
     if test "x${CONF_NAME}" = x; then
@@ -610,6 +621,14 @@
 AC_PATH_PROG(HG, hg)
 AC_PATH_PROG(STAT, stat)
 AC_PATH_PROG(TIME, time)
+# Check if it's GNU time
+IS_GNU_TIME=`$TIME --version 2>&1 | $GREP 'GNU time'`
+if test "x$IS_GNU_TIME" != x; then
+  IS_GNU_TIME=yes
+else
+  IS_GNU_TIME=no
+fi
+AC_SUBST(IS_GNU_TIME)
 
 if test "x$OPENJDK_TARGET_OS" = "xwindows"; then
   BASIC_REQUIRE_PROG(COMM, comm)
@@ -617,6 +636,20 @@
 
 if test "x$OPENJDK_TARGET_OS" = "xmacosx"; then
   BASIC_REQUIRE_PROG(XATTR, xattr)
+  AC_PATH_PROG(CODESIGN, codesign)
+  if test "x$CODESIGN" != "x"; then
+    # Verify that the openjdk_codesign certificate is present
+    AC_MSG_CHECKING([if openjdk_codesign certificate is present])
+    rm -f codesign-testfile
+    touch codesign-testfile
+    codesign -s openjdk_codesign codesign-testfile 2>&AS_MESSAGE_LOG_FD >&AS_MESSAGE_LOG_FD || CODESIGN=
+    rm -f codesign-testfile
+    if test "x$CODESIGN" = x; then
+      AC_MSG_RESULT([no])
+    else
+      AC_MSG_RESULT([yes])
+    fi
+  fi
 fi
 ])
 
--- a/common/autoconf/basics_windows.m4	Wed Jun 05 13:08:59 2013 -0300
+++ b/common/autoconf/basics_windows.m4	Tue Jul 16 09:08:46 2013 -0300
@@ -300,7 +300,7 @@
 # Setup basic configuration paths, and platform-specific stuff related to PATHs.
 AC_DEFUN([BASIC_CHECK_PATHS_WINDOWS],
 [
-  SRC_ROOT_LENGTH=`$THEPWDCMD|$WC -m`
+  SRC_ROOT_LENGTH=`$THEPWDCMD -L|$WC -m`
   if test $SRC_ROOT_LENGTH -gt 100; then
       AC_MSG_ERROR([Your base path is too long. It is $SRC_ROOT_LENGTH characters long, but only 100 is supported])
   fi
--- a/common/autoconf/build-performance.m4	Wed Jun 05 13:08:59 2013 -0300
+++ b/common/autoconf/build-performance.m4	Tue Jul 16 09:08:46 2013 -0300
@@ -145,6 +145,9 @@
     if test "$JOBS" -gt "16"; then
       JOBS=16
     fi
+    if test "$JOBS" -eq "0"; then
+      JOBS=1
+    fi
     AC_MSG_RESULT([$JOBS])
   else
     JOBS=$with_jobs
@@ -159,7 +162,12 @@
 	      		      [disable using ccache to speed up recompilations @<:@enabled@:>@])],
               [ENABLE_CCACHE=${enable_ccache}], [ENABLE_CCACHE=yes])
     if test "x$ENABLE_CCACHE" = xyes; then
+        OLD_PATH="$PATH"
+        if test "x$TOOLS_DIR" != x; then
+          PATH=$TOOLS_DIR:$PATH
+        fi
         AC_PATH_PROG(CCACHE, ccache)
+        PATH="$OLD_PATH"
     else
         AC_MSG_CHECKING([for ccache])
         AC_MSG_RESULT([explicitly disabled])    
--- a/common/autoconf/generated-configure.sh	Wed Jun 05 13:08:59 2013 -0300
+++ b/common/autoconf/generated-configure.sh	Tue Jul 16 09:08:46 2013 -0300
@@ -681,8 +681,8 @@
 SHARED_LIBRARY
 OBJ_SUFFIX
 COMPILER_NAME
+JT_HOME
 JTREGEXE
-JT_HOME
 LIPO
 ac_ct_OBJDUMP
 OBJDUMP
@@ -797,7 +797,9 @@
 OS_VERSION_MINOR
 OS_VERSION_MAJOR
 PKG_CONFIG
+CODESIGN
 XATTR
+IS_GNU_TIME
 TIME
 STAT
 HG
@@ -900,7 +902,6 @@
 SORT
 SH
 RM
-THEPWDCMD
 PRINTF
 MV
 MKTEMP
@@ -988,6 +989,7 @@
 with_cacerts_file
 enable_unlimited_crypto
 with_milestone
+with_update_version
 with_build_number
 with_user_release_suffix
 with_boot_jdk
@@ -1727,6 +1729,7 @@
                           group
   --with-cacerts-file     specify alternative cacerts file
   --with-milestone        Set milestone value for build [internal]
+  --with-update-version   Set update version value for build [b00]
   --with-build-number     Set build number value for build [b00]
   --with-user-release-suffix
                           Add a custom string to the version string if build
@@ -2843,7 +2846,7 @@
       || { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
 as_fn_error $? "failed to load site script $ac_site_file
-See \`config.log' for more details" "$LINENO" 5; }
+See \`config.log' for more details" "$LINENO" 5 ; }
   fi
 done
 
@@ -3081,6 +3084,9 @@
 # Also set JVM_ARG_OK to true/false depending on outcome.
 
 
+# Appends a string to a path variable, only adding the : when needed.
+
+
 # This will make sure the given variable points to a full and proper
 # path. This means:
 # 1) There will be no spaces in the path. On posix platforms,
@@ -3780,7 +3786,7 @@
 #CUSTOM_AUTOCONF_INCLUDE
 
 # Do not change or remove the following line, it is needed for consistency checks:
-DATE_WHEN_GENERATED=1369764185
+DATE_WHEN_GENERATED=1372770384
 
 ###############################################################################
 #
@@ -5169,65 +5175,6 @@
 
 
 
-    for ac_prog in pwd
-do
-  # Extract the first word of "$ac_prog", so it can be a program name with args.
-set dummy $ac_prog; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_THEPWDCMD+set}" = set; then :
-  $as_echo_n "(cached) " >&6
-else
-  case $THEPWDCMD in
-  [\\/]* | ?:[\\/]*)
-  ac_cv_path_THEPWDCMD="$THEPWDCMD" # Let the user override the test with a path.
-  ;;
-  *)
-  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-    for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
-    ac_cv_path_THEPWDCMD="$as_dir/$ac_word$ac_exec_ext"
-    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-  done
-IFS=$as_save_IFS
-
-  ;;
-esac
-fi
-THEPWDCMD=$ac_cv_path_THEPWDCMD
-if test -n "$THEPWDCMD"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $THEPWDCMD" >&5
-$as_echo "$THEPWDCMD" >&6; }
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-
-  test -n "$THEPWDCMD" && break
-done
-
-
-    if test "x$THEPWDCMD" = x; then
-        if test "xpwd" = x; then
-          PROG_NAME=thepwdcmd
-        else
-          PROG_NAME=pwd
-        fi
-        { $as_echo "$as_me:${as_lineno-$LINENO}: Could not find $PROG_NAME!" >&5
-$as_echo "$as_me: Could not find $PROG_NAME!" >&6;}
-        as_fn_error $? "Cannot continue" "$LINENO" 5
-    fi
-
-
-
     for ac_prog in rm
 do
   # Extract the first word of "$ac_prog", so it can be a program name with args.
@@ -6426,6 +6373,10 @@
 # Always force rm.
 RM="$RM -f"
 
+# pwd behaves differently on various platforms and some don't support the -L flag.
+# Always use the bash builtin pwd to get uniform behavior.
+THEPWDCMD=pwd
+
 # These are not required on all platforms
 # Extract the first word of "cygpath", so it can be a program name with args.
 set dummy cygpath; ac_word=$2
@@ -6613,7 +6564,7 @@
 $as_echo "$ac_cv_build" >&6; }
 case $ac_cv_build in
 *-*-*) ;;
-*) as_fn_error $? "invalid value of canonical build" "$LINENO" 5;;
+*) as_fn_error $? "invalid value of canonical build" "$LINENO" 5 ;;
 esac
 build=$ac_cv_build
 ac_save_IFS=$IFS; IFS='-'
@@ -6646,7 +6597,7 @@
 $as_echo "$ac_cv_host" >&6; }
 case $ac_cv_host in
 *-*-*) ;;
-*) as_fn_error $? "invalid value of canonical host" "$LINENO" 5;;
+*) as_fn_error $? "invalid value of canonical host" "$LINENO" 5 ;;
 esac
 host=$ac_cv_host
 ac_save_IFS=$IFS; IFS='-'
@@ -6679,7 +6630,7 @@
 $as_echo "$ac_cv_target" >&6; }
 case $ac_cv_target in
 *-*-*) ;;
-*) as_fn_error $? "invalid value of canonical target" "$LINENO" 5;;
+*) as_fn_error $? "invalid value of canonical target" "$LINENO" 5 ;;
 esac
 target=$ac_cv_target
 ac_save_IFS=$IFS; IFS='-'
@@ -7133,65 +7084,17 @@
 
 # Locate the directory of this script.
 SCRIPT="$0"
-
-    if test "x$OPENJDK_BUILD_OS" != xwindows; then
-        # Follow a chain of symbolic links. Use readlink
-        # where it exists, else fall back to horribly
-        # complicated shell code.
-        if test "x$READLINK_TESTED" != yes; then
-            # On MacOSX there is a readlink tool with a different
-            # purpose than the GNU readlink tool. Check the found readlink.
-            ISGNU=`$READLINK --version 2>&1 | $GREP GNU`
-            if test "x$ISGNU" = x; then
-                 # A readlink that we do not know how to use.
-                 # Are there other non-GNU readlinks out there?
-                 READLINK_TESTED=yes
-                 READLINK=
-            fi
-        fi
-
-        if test "x$READLINK" != x; then
-            SCRIPT=`$READLINK -f $SCRIPT`
-        else
-            # Save the current directory for restoring afterwards
-            STARTDIR=$PWD
-            COUNTER=0
-            sym_link_dir=`$DIRNAME $SCRIPT`
-            sym_link_file=`$BASENAME $SCRIPT`
-            # Use the system pwd and not the shell builtin to resolve directory symlinks
-            cd $sym_link_dir
-            cd `$THEPWDCMD`
-            sym_link_dir=`$THEPWDCMD`
-            # Resolve file symlinks
-            while test $COUNTER -lt 20; do
-                ISLINK=`$LS -l $sym_link_dir/$sym_link_file | $GREP '\->' | $SED -e 's/.*-> \(.*\)/\1/'`
-                if test "x$ISLINK" == x; then
-                    # This is not a symbolic link! We are done!
-                    break
-                fi
-                # Again resolve directory symlinks since the target of the just found
-                # link could be in a different directory
-                cd `$DIRNAME $ISLINK`
-                sym_link_dir=`$THEPWDCMD`
-                sym_link_file=`$BASENAME $ISLINK`
-                let COUNTER=COUNTER+1
-            done
-            cd $STARTDIR
-            SCRIPT=$sym_link_dir/$sym_link_file
-        fi
-    fi
-
-AUTOCONF_DIR=`cd \`$DIRNAME $SCRIPT\`; $THEPWDCMD`
+AUTOCONF_DIR=`cd \`$DIRNAME $SCRIPT\`; $THEPWDCMD -L`
 
 # Where is the source? It is located two levels above the configure script.
 CURDIR="$PWD"
 cd "$AUTOCONF_DIR/../.."
-SRC_ROOT="`$THEPWDCMD`"
+SRC_ROOT="`$THEPWDCMD -L`"
 
 if test "x$OPENJDK_TARGET_OS" = "xwindows"; then
   PATH_SEP=";"
 
-  SRC_ROOT_LENGTH=`$THEPWDCMD|$WC -m`
+  SRC_ROOT_LENGTH=`$THEPWDCMD -L|$WC -m`
   if test $SRC_ROOT_LENGTH -gt 100; then
       as_fn_error $? "Your base path is too long. It is $SRC_ROOT_LENGTH characters long, but only 100 is supported" "$LINENO" 5
   fi
@@ -7407,7 +7310,7 @@
       as_fn_error $? "The path of SRC_ROOT, which resolves as \"$path\", is not found." "$LINENO" 5
     fi
 
-    SRC_ROOT="`cd "$path"; $THEPWDCMD`"
+    SRC_ROOT="`cd "$path"; $THEPWDCMD -L`"
   fi
 
 
@@ -7529,7 +7432,7 @@
       as_fn_error $? "The path of CURDIR, which resolves as \"$path\", is not found." "$LINENO" 5
     fi
 
-    CURDIR="`cd "$path"; $THEPWDCMD`"
+    CURDIR="`cd "$path"; $THEPWDCMD -L`"
   fi
 
 
@@ -7558,6 +7461,7 @@
 # Check whether --with-tools-dir was given.
 if test "${with_tools_dir+set}" = set; then :
   withval=$with_tools_dir; TOOLS_DIR=$with_tools_dir
+
 fi
 
 
@@ -7568,14 +7472,142 @@
     if test "x$with_sys_root" != x; then
       as_fn_error $? "Cannot specify both --with-devkit and --with-sys-root at the same time" "$LINENO" 5
     fi
-    if test "x$with_tools_dir" != x; then
-      as_fn_error $? "Cannot specify both --with-devkit and --with-tools-dir at the same time" "$LINENO" 5
-    fi
-    TOOLS_DIR=$with_devkit/bin
-    SYS_ROOT=$with_devkit/$host_alias/libc
-
-fi
-
+
+  if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
+
+  # Input might be given as Windows format, start by converting to
+  # unix format.
+  path="$with_devkit"
+  new_path=`$CYGPATH -u "$path"`
+
+  # Cygwin tries to hide some aspects of the Windows file system, such that binaries are
+  # named .exe but called without that suffix. Therefore, "foo" and "foo.exe" are considered
+  # the same file, most of the time (as in "test -f"). But not when running cygpath -s, then
+  # "foo.exe" is OK but "foo" is an error.
+  #
+  # This test is therefore slightly more accurate than "test -f" to check for file precense.
+  # It is also a way to make sure we got the proper file name for the real test later on.
+  test_shortpath=`$CYGPATH -s -m "$new_path" 2> /dev/null`
+  if test "x$test_shortpath" = x; then
+    { $as_echo "$as_me:${as_lineno-$LINENO}: The path of with_devkit, which resolves as \"$path\", is invalid." >&5
+$as_echo "$as_me: The path of with_devkit, which resolves as \"$path\", is invalid." >&6;}
+    as_fn_error $? "Cannot locate the the path of with_devkit" "$LINENO" 5
+  fi
+
+  # Call helper function which possibly converts this using DOS-style short mode.
+  # If so, the updated path is stored in $new_path.
+
+  input_path="$new_path"
+  # Check if we need to convert this using DOS-style short mode. If the path
+  # contains just simple characters, use it. Otherwise (spaces, weird characters),
+  # take no chances and rewrite it.
+  # Note: m4 eats our [], so we need to use [ and ] instead.
+  has_forbidden_chars=`$ECHO "$input_path" | $GREP [^-._/a-zA-Z0-9]`
+  if test "x$has_forbidden_chars" != x; then
+    # Now convert it to mixed DOS-style, short mode (no spaces, and / instead of \)
+    shortmode_path=`$CYGPATH -s -m -a "$input_path"`
+    path_after_shortmode=`$CYGPATH -u "$shortmode_path"`
+    if test "x$path_after_shortmode" != "x$input_to_shortpath"; then
+      # Going to short mode and back again did indeed matter. Since short mode is
+      # case insensitive, let's make it lowercase to improve readability.
+      shortmode_path=`$ECHO "$shortmode_path" | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
+      # Now convert it back to Unix-stile (cygpath)
+      input_path=`$CYGPATH -u "$shortmode_path"`
+      new_path="$input_path"
+    fi
+  fi
+
+  test_cygdrive_prefix=`$ECHO $input_path | $GREP ^/cygdrive/`
+  if test "x$test_cygdrive_prefix" = x; then
+    # As a simple fix, exclude /usr/bin since it's not a real path.
+    if test "x`$ECHO $new_path | $GREP ^/usr/bin/`" = x; then
+      # The path is in a Cygwin special directory (e.g. /home). We need this converted to
+      # a path prefixed by /cygdrive for fixpath to work.
+      new_path="$CYGWIN_ROOT_PATH$input_path"
+    fi
+  fi
+
+
+  if test "x$path" != "x$new_path"; then
+    with_devkit="$new_path"
+    { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting with_devkit to \"$new_path\"" >&5
+$as_echo "$as_me: Rewriting with_devkit to \"$new_path\"" >&6;}
+  fi
+
+  elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then
+
+  path="$with_devkit"
+  has_colon=`$ECHO $path | $GREP ^.:`
+  new_path="$path"
+  if test "x$has_colon" = x; then
+    # Not in mixed or Windows style, start by that.
+    new_path=`cmd //c echo $path`
+  fi
+
+
+  input_path="$new_path"
+  # Check if we need to convert this using DOS-style short mode. If the path
+  # contains just simple characters, use it. Otherwise (spaces, weird characters),
+  # take no chances and rewrite it.
+  # Note: m4 eats our [], so we need to use [ and ] instead.
+  has_forbidden_chars=`$ECHO "$input_path" | $GREP [^-_/:a-zA-Z0-9]`
+  if test "x$has_forbidden_chars" != x; then
+    # Now convert it to mixed DOS-style, short mode (no spaces, and / instead of \)
+    new_path=`cmd /c "for %A in (\"$input_path\") do @echo %~sA"|$TR \\\\\\\\ / | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
+  fi
+
+
+  windows_path="$new_path"
+  if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
+    unix_path=`$CYGPATH -u "$windows_path"`
+    new_path="$unix_path"
+  elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then
+    unix_path=`$ECHO "$windows_path" | $SED -e 's,^\\(.\\):,/\\1,g' -e 's,\\\\,/,g'`
+    new_path="$unix_path"
+  fi
+
+  if test "x$path" != "x$new_path"; then
+    with_devkit="$new_path"
+    { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting with_devkit to \"$new_path\"" >&5
+$as_echo "$as_me: Rewriting with_devkit to \"$new_path\"" >&6;}
+  fi
+
+  # Save the first 10 bytes of this path to the storage, so fixpath can work.
+  all_fixpath_prefixes=("${all_fixpath_prefixes[@]}" "${new_path:0:10}")
+
+  else
+    # We're on a posix platform. Hooray! :)
+    path="$with_devkit"
+    has_space=`$ECHO "$path" | $GREP " "`
+    if test "x$has_space" != x; then
+      { $as_echo "$as_me:${as_lineno-$LINENO}: The path of with_devkit, which resolves as \"$path\", is invalid." >&5
+$as_echo "$as_me: The path of with_devkit, which resolves as \"$path\", is invalid." >&6;}
+      as_fn_error $? "Spaces are not allowed in this path." "$LINENO" 5
+    fi
+
+    # Use eval to expand a potential ~
+    eval path="$path"
+    if test ! -f "$path" && test ! -d "$path"; then
+      as_fn_error $? "The path of with_devkit, which resolves as \"$path\", is not found." "$LINENO" 5
+    fi
+
+    with_devkit="`cd "$path"; $THEPWDCMD -L`"
+  fi
+
+
+  if test "x$TOOLS_DIR" = x; then
+    TOOLS_DIR="$with_devkit/bin"
+  else
+    TOOLS_DIR="$TOOLS_DIR:$with_devkit/bin"
+  fi
+
+    if test -d "$with_devkit/$host_alias/libc"; then
+      SYS_ROOT=$with_devkit/$host_alias/libc
+    elif test -d "$with_devkit/$host/sys-root"; then
+      SYS_ROOT=$with_devkit/$host/sys-root
+    fi
+
+fi
 
 
 
@@ -7900,60 +7932,9 @@
 
 
 # Test from where we are running configure, in or outside of src root.
-# To enable comparison of directories, CURDIR needs to be symlink free
-# just like SRC_ROOT already is
-NOSYM_CURDIR="$CURDIR"
-
-    if test "x$OPENJDK_BUILD_OS" != xwindows; then
-        # Follow a chain of symbolic links. Use readlink
-        # where it exists, else fall back to horribly
-        # complicated shell code.
-        if test "x$READLINK_TESTED" != yes; then
-            # On MacOSX there is a readlink tool with a different
-            # purpose than the GNU readlink tool. Check the found readlink.
-            ISGNU=`$READLINK --version 2>&1 | $GREP GNU`
-            if test "x$ISGNU" = x; then
-                 # A readlink that we do not know how to use.
-                 # Are there other non-GNU readlinks out there?
-                 READLINK_TESTED=yes
-                 READLINK=
-            fi
-        fi
-
-        if test "x$READLINK" != x; then
-            NOSYM_CURDIR=`$READLINK -f $NOSYM_CURDIR`
-        else
-            # Save the current directory for restoring afterwards
-            STARTDIR=$PWD
-            COUNTER=0
-            sym_link_dir=`$DIRNAME $NOSYM_CURDIR`
-            sym_link_file=`$BASENAME $NOSYM_CURDIR`
-            # Use the system pwd and not the shell builtin to resolve directory symlinks
-            cd $sym_link_dir
-            cd `$THEPWDCMD`
-            sym_link_dir=`$THEPWDCMD`
-            # Resolve file symlinks
-            while test $COUNTER -lt 20; do
-                ISLINK=`$LS -l $sym_link_dir/$sym_link_file | $GREP '\->' | $SED -e 's/.*-> \(.*\)/\1/'`
-                if test "x$ISLINK" == x; then
-                    # This is not a symbolic link! We are done!
-                    break
-                fi
-                # Again resolve directory symlinks since the target of the just found
-                # link could be in a different directory
-                cd `$DIRNAME $ISLINK`
-                sym_link_dir=`$THEPWDCMD`
-                sym_link_file=`$BASENAME $ISLINK`
-                let COUNTER=COUNTER+1
-            done
-            cd $STARTDIR
-            NOSYM_CURDIR=$sym_link_dir/$sym_link_file
-        fi
-    fi
-
-if test "x$NOSYM_CURDIR" = "x$SRC_ROOT" || test "x$NOSYM_CURDIR" = "x$SRC_ROOT/common" \
-        || test "x$NOSYM_CURDIR" = "x$SRC_ROOT/common/autoconf" \
-        || test "x$NOSYM_CURDIR" = "x$SRC_ROOT/common/makefiles" ; then
+if test "x$CURDIR" = "x$SRC_ROOT" || test "x$CURDIR" = "x$SRC_ROOT/common" \
+        || test "x$CURDIR" = "x$SRC_ROOT/common/autoconf" \
+        || test "x$CURDIR" = "x$SRC_ROOT/common/makefiles" ; then
     # We are running configure from the src root.
     # Create a default ./build/target-variant-debuglevel output root.
     if test "x${CONF_NAME}" = x; then
@@ -8128,7 +8109,7 @@
       as_fn_error $? "The path of OUTPUT_ROOT, which resolves as \"$path\", is not found." "$LINENO" 5
     fi
 
-    OUTPUT_ROOT="`cd "$path"; $THEPWDCMD`"
+    OUTPUT_ROOT="`cd "$path"; $THEPWDCMD -L`"
   fi
 
 
@@ -10370,6 +10351,14 @@
 fi
 
 
+# Check if it's GNU time
+IS_GNU_TIME=`$TIME --version 2>&1 | $GREP 'GNU time'`
+if test "x$IS_GNU_TIME" != x; then
+  IS_GNU_TIME=yes
+else
+  IS_GNU_TIME=no
+fi
+
 
 if test "x$OPENJDK_TARGET_OS" = "xwindows"; then
 
@@ -10493,6 +10482,62 @@
     fi
 
 
+  # Extract the first word of "codesign", so it can be a program name with args.
+set dummy codesign; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_path_CODESIGN+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  case $CODESIGN in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_CODESIGN="$CODESIGN" # Let the user override the test with a path.
+  ;;
+  *)
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_path_CODESIGN="$as_dir/$ac_word$ac_exec_ext"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+  ;;
+esac
+fi
+CODESIGN=$ac_cv_path_CODESIGN
+if test -n "$CODESIGN"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CODESIGN" >&5
+$as_echo "$CODESIGN" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+  if test "x$CODESIGN" != "x"; then
+    # Verify that the openjdk_codesign certificate is present
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking if openjdk_codesign certificate is present" >&5
+$as_echo_n "checking if openjdk_codesign certificate is present... " >&6; }
+    rm -f codesign-testfile
+    touch codesign-testfile
+    codesign -s openjdk_codesign codesign-testfile 2>&5 >&5 || CODESIGN=
+    rm -f codesign-testfile
+    if test "x$CODESIGN" = x; then
+      { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+    else
+      { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+    fi
+  fi
 fi
 
 
@@ -10878,11 +10923,7 @@
 if test "x$with_cacerts_file" != x; then
     CACERTS_FILE=$with_cacerts_file
 else
-    if test "x$OPENJDK" = "xtrue"; then
-        CACERTS_FILE=${SRC_ROOT}/jdk/src/share/lib/security/cacerts
-    else
-        CACERTS_FILE=${SRC_ROOT}/jdk/src/closed/share/lib/security/cacerts.internal
-    fi
+    CACERTS_FILE=${SRC_ROOT}/jdk/src/share/lib/security/cacerts
 fi
 
 
@@ -10939,6 +10980,18 @@
 fi
 
 
+# Check whether --with-update-version was given.
+if test "${with_update_version+set}" = set; then :
+  withval=$with_update_version;
+fi
+
+if test "x$with_update_version" = xyes; then
+  as_fn_error $? "Update version must have a value" "$LINENO" 5
+elif test "x$with_update_version" != x; then
+  JDK_UPDATE_VERSION="$with_update_version"
+fi
+
+
 # Check whether --with-build-number was given.
 if test "${with_build_number+set}" = set; then :
   withval=$with_build_number;
@@ -11188,7 +11241,7 @@
       as_fn_error $? "The path of BOOT_JDK, which resolves as \"$path\", is not found." "$LINENO" 5
     fi
 
-    BOOT_JDK="`cd "$path"; $THEPWDCMD`"
+    BOOT_JDK="`cd "$path"; $THEPWDCMD -L`"
   fi
 
               { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Boot JDK" >&5
@@ -11520,7 +11573,7 @@
       as_fn_error $? "The path of BOOT_JDK, which resolves as \"$path\", is not found." "$LINENO" 5
     fi
 
-    BOOT_JDK="`cd "$path"; $THEPWDCMD`"
+    BOOT_JDK="`cd "$path"; $THEPWDCMD -L`"
   fi
 
               { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Boot JDK" >&5
@@ -11666,7 +11719,7 @@
       as_fn_error $? "The path of JAVA_HOME_PROCESSED, which resolves as \"$path\", is not found." "$LINENO" 5
     fi
 
-    JAVA_HOME_PROCESSED="`cd "$path"; $THEPWDCMD`"
+    JAVA_HOME_PROCESSED="`cd "$path"; $THEPWDCMD -L`"
   fi
 
         if test ! -d "$JAVA_HOME_PROCESSED"; then
@@ -11838,7 +11891,7 @@
       as_fn_error $? "The path of BOOT_JDK, which resolves as \"$path\", is not found." "$LINENO" 5
     fi
 
-    BOOT_JDK="`cd "$path"; $THEPWDCMD`"
+    BOOT_JDK="`cd "$path"; $THEPWDCMD -L`"
   fi
 
               { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Boot JDK" >&5
@@ -12026,7 +12079,7 @@
       as_fn_error $? "The path of BOOT_JDK, which resolves as \"$path\", is not found." "$LINENO" 5
     fi
 
-    BOOT_JDK="`cd "$path"; $THEPWDCMD`"
+    BOOT_JDK="`cd "$path"; $THEPWDCMD -L`"
   fi
 
               { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Boot JDK" >&5
@@ -12165,10 +12218,10 @@
             COUNTER=0
             sym_link_dir=`$DIRNAME $BINARY`
             sym_link_file=`$BASENAME $BINARY`
-            # Use the system pwd and not the shell builtin to resolve directory symlinks
             cd $sym_link_dir
-            cd `$THEPWDCMD`
-            sym_link_dir=`$THEPWDCMD`
+            # Use -P flag to resolve symlinks in directories.
+            cd `$THEPWDCMD -P`
+            sym_link_dir=`$THEPWDCMD -P`
             # Resolve file symlinks
             while test $COUNTER -lt 20; do
                 ISLINK=`$LS -l $sym_link_dir/$sym_link_file | $GREP '\->' | $SED -e 's/.*-> \(.*\)/\1/'`
@@ -12179,7 +12232,7 @@
                 # Again resolve directory symlinks since the target of the just found
                 # link could be in a different directory
                 cd `$DIRNAME $ISLINK`
-                sym_link_dir=`$THEPWDCMD`
+                sym_link_dir=`$THEPWDCMD -P`
                 sym_link_file=`$BASENAME $ISLINK`
                 let COUNTER=COUNTER+1
             done
@@ -12354,7 +12407,7 @@
       as_fn_error $? "The path of BOOT_JDK, which resolves as \"$path\", is not found." "$LINENO" 5
     fi
 
-    BOOT_JDK="`cd "$path"; $THEPWDCMD`"
+    BOOT_JDK="`cd "$path"; $THEPWDCMD -L`"
   fi
 
               { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Boot JDK" >&5
@@ -12569,7 +12622,7 @@
       as_fn_error $? "The path of BOOT_JDK, which resolves as \"$path\", is not found." "$LINENO" 5
     fi
 
-    BOOT_JDK="`cd "$path"; $THEPWDCMD`"
+    BOOT_JDK="`cd "$path"; $THEPWDCMD -L`"
   fi
 
               { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Boot JDK" >&5
@@ -12749,7 +12802,7 @@
       as_fn_error $? "The path of BOOT_JDK, which resolves as \"$path\", is not found." "$LINENO" 5
     fi
 
-    BOOT_JDK="`cd "$path"; $THEPWDCMD`"
+    BOOT_JDK="`cd "$path"; $THEPWDCMD -L`"
   fi
 
               { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Boot JDK" >&5
@@ -12957,7 +13010,7 @@
       as_fn_error $? "The path of BOOT_JDK, which resolves as \"$path\", is not found." "$LINENO" 5
     fi
 
-    BOOT_JDK="`cd "$path"; $THEPWDCMD`"
+    BOOT_JDK="`cd "$path"; $THEPWDCMD -L`"
   fi
 
               { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Boot JDK" >&5
@@ -13137,7 +13190,7 @@
       as_fn_error $? "The path of BOOT_JDK, which resolves as \"$path\", is not found." "$LINENO" 5
     fi
 
-    BOOT_JDK="`cd "$path"; $THEPWDCMD`"
+    BOOT_JDK="`cd "$path"; $THEPWDCMD -L`"
   fi
 
               { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Boot JDK" >&5
@@ -13345,7 +13398,7 @@
       as_fn_error $? "The path of BOOT_JDK, which resolves as \"$path\", is not found." "$LINENO" 5
     fi
 
-    BOOT_JDK="`cd "$path"; $THEPWDCMD`"
+    BOOT_JDK="`cd "$path"; $THEPWDCMD -L`"
   fi
 
               { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Boot JDK" >&5
@@ -13525,7 +13578,7 @@
       as_fn_error $? "The path of BOOT_JDK, which resolves as \"$path\", is not found." "$LINENO" 5
     fi
 
-    BOOT_JDK="`cd "$path"; $THEPWDCMD`"
+    BOOT_JDK="`cd "$path"; $THEPWDCMD -L`"
   fi
 
               { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Boot JDK" >&5
@@ -13733,7 +13786,7 @@
       as_fn_error $? "The path of BOOT_JDK, which resolves as \"$path\", is not found." "$LINENO" 5
     fi
 
-    BOOT_JDK="`cd "$path"; $THEPWDCMD`"
+    BOOT_JDK="`cd "$path"; $THEPWDCMD -L`"
   fi
 
               { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Boot JDK" >&5
@@ -13913,7 +13966,7 @@
       as_fn_error $? "The path of BOOT_JDK, which resolves as \"$path\", is not found." "$LINENO" 5
     fi
 
-    BOOT_JDK="`cd "$path"; $THEPWDCMD`"
+    BOOT_JDK="`cd "$path"; $THEPWDCMD -L`"
   fi
 
               { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Boot JDK" >&5
@@ -14108,7 +14161,7 @@
       as_fn_error $? "The path of BOOT_JDK, which resolves as \"$path\", is not found." "$LINENO" 5
     fi
 
-    BOOT_JDK="`cd "$path"; $THEPWDCMD`"
+    BOOT_JDK="`cd "$path"; $THEPWDCMD -L`"
   fi
 
               { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Boot JDK" >&5
@@ -14286,7 +14339,7 @@
       as_fn_error $? "The path of BOOT_JDK, which resolves as \"$path\", is not found." "$LINENO" 5
     fi
 
-    BOOT_JDK="`cd "$path"; $THEPWDCMD`"
+    BOOT_JDK="`cd "$path"; $THEPWDCMD -L`"
   fi
 
               { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Boot JDK" >&5
@@ -14482,7 +14535,7 @@
       as_fn_error $? "The path of BOOT_JDK, which resolves as \"$path\", is not found." "$LINENO" 5
     fi
 
-    BOOT_JDK="`cd "$path"; $THEPWDCMD`"
+    BOOT_JDK="`cd "$path"; $THEPWDCMD -L`"
   fi
 
               { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Boot JDK" >&5
@@ -14660,7 +14713,7 @@
       as_fn_error $? "The path of BOOT_JDK, which resolves as \"$path\", is not found." "$LINENO" 5
     fi
 
-    BOOT_JDK="`cd "$path"; $THEPWDCMD`"
+    BOOT_JDK="`cd "$path"; $THEPWDCMD -L`"
   fi
 
               { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Boot JDK" >&5
@@ -14855,7 +14908,7 @@
       as_fn_error $? "The path of BOOT_JDK, which resolves as \"$path\", is not found." "$LINENO" 5
     fi
 
-    BOOT_JDK="`cd "$path"; $THEPWDCMD`"
+    BOOT_JDK="`cd "$path"; $THEPWDCMD -L`"
   fi
 
               { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Boot JDK" >&5
@@ -15033,7 +15086,7 @@
       as_fn_error $? "The path of BOOT_JDK, which resolves as \"$path\", is not found." "$LINENO" 5
     fi
 
-    BOOT_JDK="`cd "$path"; $THEPWDCMD`"
+    BOOT_JDK="`cd "$path"; $THEPWDCMD -L`"
   fi
 
               { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Boot JDK" >&5
@@ -15229,7 +15282,7 @@
       as_fn_error $? "The path of BOOT_JDK, which resolves as \"$path\", is not found." "$LINENO" 5
     fi
 
-    BOOT_JDK="`cd "$path"; $THEPWDCMD`"
+    BOOT_JDK="`cd "$path"; $THEPWDCMD -L`"
   fi
 
               { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Boot JDK" >&5
@@ -15407,7 +15460,7 @@
       as_fn_error $? "The path of BOOT_JDK, which resolves as \"$path\", is not found." "$LINENO" 5
     fi
 
-    BOOT_JDK="`cd "$path"; $THEPWDCMD`"
+    BOOT_JDK="`cd "$path"; $THEPWDCMD -L`"
   fi
 
               { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Boot JDK" >&5
@@ -15584,7 +15637,7 @@
       as_fn_error $? "The path of BOOT_JDK, which resolves as \"$path\", is not found." "$LINENO" 5
     fi
 
-    BOOT_JDK="`cd "$path"; $THEPWDCMD`"
+    BOOT_JDK="`cd "$path"; $THEPWDCMD -L`"
   fi
 
               { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Boot JDK" >&5
@@ -16261,14 +16314,28 @@
 # Check whether --with-jtreg was given.
 if test "${with_jtreg+set}" = set; then :
   withval=$with_jtreg;
-fi
-
-
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for JTReg Regression Test Harness" >&5
-$as_echo_n "checking for JTReg Regression Test Harness... " >&6; }
-
-  if test "x$with_jtreg" != x; then
-    JT_HOME="$with_jtreg"
+else
+  with_jtreg=no
+fi
+
+
+  if test "x$with_jtreg" = xno; then
+    # jtreg disabled
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for jtreg" >&5
+$as_echo_n "checking for jtreg... " >&6; }
+    { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+  else
+    if test "x$with_jtreg" != xyes; then
+      # with path specified.
+      JT_HOME="$with_jtreg"
+    fi
+
+    if test "x$JT_HOME" != x; then
+      { $as_echo "$as_me:${as_lineno-$LINENO}: checking for jtreg" >&5
+$as_echo_n "checking for jtreg... " >&6; }
+
+      # use JT_HOME enviroment var.
 
   if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
 
@@ -16388,20 +16455,82 @@
       as_fn_error $? "The path of JT_HOME, which resolves as \"$path\", is not found." "$LINENO" 5
     fi
 
-    JT_HOME="`cd "$path"; $THEPWDCMD`"
-  fi
-
-    { $as_echo "$as_me:${as_lineno-$LINENO}: result: $JT_HOME" >&5
-$as_echo "$JT_HOME" >&6; }
-
-    # jtreg win32 script works for everybody
-    JTREGEXE="$JT_HOME/win32/bin/jtreg"
-    if test ! -f "$JTREGEXE"; then
-      as_fn_error $? "JTReg executable does not exist: $JTREGEXE" "$LINENO" 5
-    fi
-  else
-    { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
+    JT_HOME="`cd "$path"; $THEPWDCMD -L`"
+  fi
+
+
+      # jtreg win32 script works for everybody
+      JTREGEXE="$JT_HOME/win32/bin/jtreg"
+
+      if test ! -f "$JTREGEXE"; then
+        as_fn_error $? "JTReg executable does not exist: $JTREGEXE" "$LINENO" 5
+      fi
+
+      { $as_echo "$as_me:${as_lineno-$LINENO}: result: $JTREGEXE" >&5
+$as_echo "$JTREGEXE" >&6; }
+    else
+      # try to find jtreg on path
+
+    for ac_prog in jtreg
+do
+  # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_path_JTREGEXE+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  case $JTREGEXE in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_JTREGEXE="$JTREGEXE" # Let the user override the test with a path.
+  ;;
+  *)
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_path_JTREGEXE="$as_dir/$ac_word$ac_exec_ext"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+  ;;
+esac
+fi
+JTREGEXE=$ac_cv_path_JTREGEXE
+if test -n "$JTREGEXE"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $JTREGEXE" >&5
+$as_echo "$JTREGEXE" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+  test -n "$JTREGEXE" && break
+done
+
+
+    if test "x$JTREGEXE" = x; then
+        if test "xjtreg" = x; then
+          PROG_NAME=jtregexe
+        else
+          PROG_NAME=jtreg
+        fi
+        { $as_echo "$as_me:${as_lineno-$LINENO}: Could not find $PROG_NAME!" >&5
+$as_echo "$as_me: Could not find $PROG_NAME!" >&6;}
+        as_fn_error $? "Cannot continue" "$LINENO" 5
+    fi
+
+
+      JT_HOME="`$DIRNAME $JTREGEXE`"
+    fi
   fi
 
 
@@ -16518,6 +16647,123 @@
     as_fn_error $? "Cannot locate a valid Visual Studio installation" "$LINENO" 5
   fi
 
+  if test "x$VS100COMNTOOLS" != x; then
+
+  if test "x$VS_ENV_CMD" = x; then
+    VS100BASE="$VS100COMNTOOLS/../.."
+    METHOD="VS100COMNTOOLS variable"
+
+  windows_path="$VS100BASE"
+  if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
+    unix_path=`$CYGPATH -u "$windows_path"`
+    VS100BASE="$unix_path"
+  elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then
+    unix_path=`$ECHO "$windows_path" | $SED -e 's,^\\(.\\):,/\\1,g' -e 's,\\\\,/,g'`
+    VS100BASE="$unix_path"
+  fi
+
+    if test -d "$VS100BASE"; then
+      if test -f "$VS100BASE/$VCVARSFILE"; then
+        { $as_echo "$as_me:${as_lineno-$LINENO}: Found Visual Studio installation at $VS100BASE using $METHOD" >&5
+$as_echo "$as_me: Found Visual Studio installation at $VS100BASE using $METHOD" >&6;}
+        VS_ENV_CMD="$VS100BASE/$VCVARSFILE"
+      else
+        { $as_echo "$as_me:${as_lineno-$LINENO}: Found Visual Studio installation at $VS100BASE using $METHOD" >&5
+$as_echo "$as_me: Found Visual Studio installation at $VS100BASE using $METHOD" >&6;}
+        { $as_echo "$as_me:${as_lineno-$LINENO}: Warning: $VCVARSFILE is missing, this is probably Visual Studio Express. Ignoring" >&5
+$as_echo "$as_me: Warning: $VCVARSFILE is missing, this is probably Visual Studio Express. Ignoring" >&6;}
+      fi
+    fi
+  fi
+
+  fi
+  if test "x$PROGRAMFILES" != x; then
+
+  if test "x$VS_ENV_CMD" = x; then
+    VS100BASE="$PROGRAMFILES/Microsoft Visual Studio 10.0"
+    METHOD="well-known name"
+
+  windows_path="$VS100BASE"
+  if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
+    unix_path=`$CYGPATH -u "$windows_path"`
+    VS100BASE="$unix_path"
+  elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then
+    unix_path=`$ECHO "$windows_path" | $SED -e 's,^\\(.\\):,/\\1,g' -e 's,\\\\,/,g'`
+    VS100BASE="$unix_path"
+  fi
+
+    if test -d "$VS100BASE"; then
+      if test -f "$VS100BASE/$VCVARSFILE"; then
+        { $as_echo "$as_me:${as_lineno-$LINENO}: Found Visual Studio installation at $VS100BASE using $METHOD" >&5
+$as_echo "$as_me: Found Visual Studio installation at $VS100BASE using $METHOD" >&6;}
+        VS_ENV_CMD="$VS100BASE/$VCVARSFILE"
+      else
+        { $as_echo "$as_me:${as_lineno-$LINENO}: Found Visual Studio installation at $VS100BASE using $METHOD" >&5
+$as_echo "$as_me: Found Visual Studio installation at $VS100BASE using $METHOD" >&6;}
+        { $as_echo "$as_me:${as_lineno-$LINENO}: Warning: $VCVARSFILE is missing, this is probably Visual Studio Express. Ignoring" >&5
+$as_echo "$as_me: Warning: $VCVARSFILE is missing, this is probably Visual Studio Express. Ignoring" >&6;}
+      fi
+    fi
+  fi
+
+  fi
+
+  if test "x$VS_ENV_CMD" = x; then
+    VS100BASE="C:/Program Files/Microsoft Visual Studio 10.0"
+    METHOD="well-known name"
+
+  windows_path="$VS100BASE"
+  if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
+    unix_path=`$CYGPATH -u "$windows_path"`
+    VS100BASE="$unix_path"
+  elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then
+    unix_path=`$ECHO "$windows_path" | $SED -e 's,^\\(.\\):,/\\1,g' -e 's,\\\\,/,g'`
+    VS100BASE="$unix_path"
+  fi
+
+    if test -d "$VS100BASE"; then
+      if test -f "$VS100BASE/$VCVARSFILE"; then
+        { $as_echo "$as_me:${as_lineno-$LINENO}: Found Visual Studio installation at $VS100BASE using $METHOD" >&5
+$as_echo "$as_me: Found Visual Studio installation at $VS100BASE using $METHOD" >&6;}
+        VS_ENV_CMD="$VS100BASE/$VCVARSFILE"
+      else
+        { $as_echo "$as_me:${as_lineno-$LINENO}: Found Visual Studio installation at $VS100BASE using $METHOD" >&5
+$as_echo "$as_me: Found Visual Studio installation at $VS100BASE using $METHOD" >&6;}
+        { $as_echo "$as_me:${as_lineno-$LINENO}: Warning: $VCVARSFILE is missing, this is probably Visual Studio Express. Ignoring" >&5
+$as_echo "$as_me: Warning: $VCVARSFILE is missing, this is probably Visual Studio Express. Ignoring" >&6;}
+      fi
+    fi
+  fi
+
+
+  if test "x$VS_ENV_CMD" = x; then
+    VS100BASE="C:/Program Files (x86)/Microsoft Visual Studio 10.0"
+    METHOD="well-known name"
+
+  windows_path="$VS100BASE"
+  if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
+    unix_path=`$CYGPATH -u "$windows_path"`
+    VS100BASE="$unix_path"
+  elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then
+    unix_path=`$ECHO "$windows_path" | $SED -e 's,^\\(.\\):,/\\1,g' -e 's,\\\\,/,g'`
+    VS100BASE="$unix_path"
+  fi
+
+    if test -d "$VS100BASE"; then
+      if test -f "$VS100BASE/$VCVARSFILE"; then
+        { $as_echo "$as_me:${as_lineno-$LINENO}: Found Visual Studio installation at $VS100BASE using $METHOD" >&5
+$as_echo "$as_me: Found Visual Studio installation at $VS100BASE using $METHOD" >&6;}
+        VS_ENV_CMD="$VS100BASE/$VCVARSFILE"
+      else
+        { $as_echo "$as_me:${as_lineno-$LINENO}: Found Visual Studio installation at $VS100BASE using $METHOD" >&5
+$as_echo "$as_me: Found Visual Studio installation at $VS100BASE using $METHOD" >&6;}
+        { $as_echo "$as_me:${as_lineno-$LINENO}: Warning: $VCVARSFILE is missing, this is probably Visual Studio Express. Ignoring" >&5
+$as_echo "$as_me: Warning: $VCVARSFILE is missing, this is probably Visual Studio Express. Ignoring" >&6;}
+      fi
+    fi
+  fi
+
+
   if test "x$ProgramW6432" != x; then
 
   if test "x$VS_ENV_CMD" = x; then
@@ -16725,123 +16971,6 @@
   fi
 
 
-  if test "x$VS100COMNTOOLS" != x; then
-
-  if test "x$VS_ENV_CMD" = x; then
-    VS100BASE="$VS100COMNTOOLS/../.."
-    METHOD="VS100COMNTOOLS variable"
-
-  windows_path="$VS100BASE"
-  if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
-    unix_path=`$CYGPATH -u "$windows_path"`
-    VS100BASE="$unix_path"
-  elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then
-    unix_path=`$ECHO "$windows_path" | $SED -e 's,^\\(.\\):,/\\1,g' -e 's,\\\\,/,g'`
-    VS100BASE="$unix_path"
-  fi
-
-    if test -d "$VS100BASE"; then
-      if test -f "$VS100BASE/$VCVARSFILE"; then
-        { $as_echo "$as_me:${as_lineno-$LINENO}: Found Visual Studio installation at $VS100BASE using $METHOD" >&5
-$as_echo "$as_me: Found Visual Studio installation at $VS100BASE using $METHOD" >&6;}
-        VS_ENV_CMD="$VS100BASE/$VCVARSFILE"
-      else
-        { $as_echo "$as_me:${as_lineno-$LINENO}: Found Visual Studio installation at $VS100BASE using $METHOD" >&5
-$as_echo "$as_me: Found Visual Studio installation at $VS100BASE using $METHOD" >&6;}
-        { $as_echo "$as_me:${as_lineno-$LINENO}: Warning: $VCVARSFILE is missing, this is probably Visual Studio Express. Ignoring" >&5
-$as_echo "$as_me: Warning: $VCVARSFILE is missing, this is probably Visual Studio Express. Ignoring" >&6;}
-      fi
-    fi
-  fi
-
-  fi
-  if test "x$PROGRAMFILES" != x; then
-
-  if test "x$VS_ENV_CMD" = x; then
-    VS100BASE="$PROGRAMFILES/Microsoft Visual Studio 10.0"
-    METHOD="well-known name"
-
-  windows_path="$VS100BASE"
-  if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
-    unix_path=`$CYGPATH -u "$windows_path"`
-    VS100BASE="$unix_path"
-  elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then
-    unix_path=`$ECHO "$windows_path" | $SED -e 's,^\\(.\\):,/\\1,g' -e 's,\\\\,/,g'`
-    VS100BASE="$unix_path"
-  fi
-
-    if test -d "$VS100BASE"; then
-      if test -f "$VS100BASE/$VCVARSFILE"; then
-        { $as_echo "$as_me:${as_lineno-$LINENO}: Found Visual Studio installation at $VS100BASE using $METHOD" >&5
-$as_echo "$as_me: Found Visual Studio installation at $VS100BASE using $METHOD" >&6;}
-        VS_ENV_CMD="$VS100BASE/$VCVARSFILE"
-      else
-        { $as_echo "$as_me:${as_lineno-$LINENO}: Found Visual Studio installation at $VS100BASE using $METHOD" >&5
-$as_echo "$as_me: Found Visual Studio installation at $VS100BASE using $METHOD" >&6;}
-        { $as_echo "$as_me:${as_lineno-$LINENO}: Warning: $VCVARSFILE is missing, this is probably Visual Studio Express. Ignoring" >&5
-$as_echo "$as_me: Warning: $VCVARSFILE is missing, this is probably Visual Studio Express. Ignoring" >&6;}
-      fi
-    fi
-  fi
-
-  fi
-
-  if test "x$VS_ENV_CMD" = x; then
-    VS100BASE="C:/Program Files/Microsoft Visual Studio 10.0"
-    METHOD="well-known name"
-
-  windows_path="$VS100BASE"
-  if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
-    unix_path=`$CYGPATH -u "$windows_path"`
-    VS100BASE="$unix_path"
-  elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then
-    unix_path=`$ECHO "$windows_path" | $SED -e 's,^\\(.\\):,/\\1,g' -e 's,\\\\,/,g'`
-    VS100BASE="$unix_path"
-  fi
-
-    if test -d "$VS100BASE"; then
-      if test -f "$VS100BASE/$VCVARSFILE"; then
-        { $as_echo "$as_me:${as_lineno-$LINENO}: Found Visual Studio installation at $VS100BASE using $METHOD" >&5
-$as_echo "$as_me: Found Visual Studio installation at $VS100BASE using $METHOD" >&6;}
-        VS_ENV_CMD="$VS100BASE/$VCVARSFILE"
-      else
-        { $as_echo "$as_me:${as_lineno-$LINENO}: Found Visual Studio installation at $VS100BASE using $METHOD" >&5
-$as_echo "$as_me: Found Visual Studio installation at $VS100BASE using $METHOD" >&6;}
-        { $as_echo "$as_me:${as_lineno-$LINENO}: Warning: $VCVARSFILE is missing, this is probably Visual Studio Express. Ignoring" >&5
-$as_echo "$as_me: Warning: $VCVARSFILE is missing, this is probably Visual Studio Express. Ignoring" >&6;}
-      fi
-    fi
-  fi
-
-
-  if test "x$VS_ENV_CMD" = x; then
-    VS100BASE="C:/Program Files (x86)/Microsoft Visual Studio 10.0"
-    METHOD="well-known name"
-
-  windows_path="$VS100BASE"
-  if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
-    unix_path=`$CYGPATH -u "$windows_path"`
-    VS100BASE="$unix_path"
-  elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then
-    unix_path=`$ECHO "$windows_path" | $SED -e 's,^\\(.\\):,/\\1,g' -e 's,\\\\,/,g'`
-    VS100BASE="$unix_path"
-  fi
-
-    if test -d "$VS100BASE"; then
-      if test -f "$VS100BASE/$VCVARSFILE"; then
-        { $as_echo "$as_me:${as_lineno-$LINENO}: Found Visual Studio installation at $VS100BASE using $METHOD" >&5
-$as_echo "$as_me: Found Visual Studio installation at $VS100BASE using $METHOD" >&6;}
-        VS_ENV_CMD="$VS100BASE/$VCVARSFILE"
-      else
-        { $as_echo "$as_me:${as_lineno-$LINENO}: Found Visual Studio installation at $VS100BASE using $METHOD" >&5
-$as_echo "$as_me: Found Visual Studio installation at $VS100BASE using $METHOD" >&6;}
-        { $as_echo "$as_me:${as_lineno-$LINENO}: Warning: $VCVARSFILE is missing, this is probably Visual Studio Express. Ignoring" >&5
-$as_echo "$as_me: Warning: $VCVARSFILE is missing, this is probably Visual Studio Express. Ignoring" >&6;}
-      fi
-    fi
-  fi
-
-
   if test "x$VS_ENV_CMD" != x; then
     # We have found a Visual Studio environment on disk, let's extract variables from the vsvars bat file.
 
@@ -17243,11 +17372,25 @@
 $as_echo "$as_me: Warning: msvcr100.dll not found in VCINSTALLDIR: $VCINSTALLDIR" >&6;}
       fi
     fi
+    # Try some fallback alternatives
     if test "x$MSVCR_DLL" = x; then
-      if test -f "$SYSTEMROOT/system32/msvcr100.dll"; then
-        { $as_echo "$as_me:${as_lineno-$LINENO}: msvcr100.dll found in $SYSTEMROOT/system32" >&5
+      # If visual studio express is installed, there is usually one with the debugger
+      if test "x$VS100COMNTOOLS" != x; then
+        if test "x$OPENJDK_TARGET_CPU_BITS" = x64; then
+          MSVCR_DLL=`find "$VS100COMNTOOLS/.." -name msvcr100.dll | grep -i x64 | head --lines 1`
+          { $as_echo "$as_me:${as_lineno-$LINENO}: msvcr100.dll found in $VS100COMNTOOLS..: $VS100COMNTOOLS.." >&5
+$as_echo "$as_me: msvcr100.dll found in $VS100COMNTOOLS..: $VS100COMNTOOLS.." >&6;}
+        fi
+      fi
+    fi
+    if test "x$MSVCR_DLL" = x; then
+      if test "x$OPENJDK_TARGET_CPU_BITS" = x32; then
+        # Fallback for 32bit builds, look in the windows directory.
+        if test -f "$SYSTEMROOT/system32/msvcr100.dll"; then
+          { $as_echo "$as_me:${as_lineno-$LINENO}: msvcr100.dll found in $SYSTEMROOT/system32" >&5
 $as_echo "$as_me: msvcr100.dll found in $SYSTEMROOT/system32" >&6;}
-        MSVCR_DLL="$SYSTEMROOT/system32/msvcr100.dll"
+          MSVCR_DLL="$SYSTEMROOT/system32/msvcr100.dll"
+        fi
       fi
     fi
   fi
@@ -17377,7 +17520,7 @@
       as_fn_error $? "The path of MSVCR_DLL, which resolves as \"$path\", is not found." "$LINENO" 5
     fi
 
-    MSVCR_DLL="`cd "$path"; $THEPWDCMD`"
+    MSVCR_DLL="`cd "$path"; $THEPWDCMD -L`"
   fi
 
 
@@ -17534,7 +17677,7 @@
       as_fn_error $? "The path of dxsdk_path, which resolves as \"$path\", is not found." "$LINENO" 5
     fi
 
-    dxsdk_path="`cd "$path"; $THEPWDCMD`"
+    dxsdk_path="`cd "$path"; $THEPWDCMD -L`"
   fi
 
 
@@ -17672,7 +17815,7 @@
       as_fn_error $? "The path of DXSDK_LIB_PATH, which resolves as \"$path\", is not found." "$LINENO" 5
     fi
 
-    DXSDK_LIB_PATH="`cd "$path"; $THEPWDCMD`"
+    DXSDK_LIB_PATH="`cd "$path"; $THEPWDCMD -L`"
   fi
 
 
@@ -17808,7 +17951,7 @@
       as_fn_error $? "The path of DXSDK_INCLUDE_PATH, which resolves as \"$path\", is not found." "$LINENO" 5
     fi
 
-    DXSDK_INCLUDE_PATH="`cd "$path"; $THEPWDCMD`"
+    DXSDK_INCLUDE_PATH="`cd "$path"; $THEPWDCMD -L`"
   fi
 
 
@@ -18927,15 +19070,6 @@
     fi
 
 
-if test "x$SYS_ROOT" != "x/" ; then
-    CFLAGS="--sysroot=$SYS_ROOT $CFLAGS"
-    CXXFLAGS="--sysroot=$SYS_ROOT $CXXFLAGS"
-    OBJCFLAGS="--sysroot=$SYS_ROOT $OBJCFLAGS"
-    OBJCXXFLAGS="--sysroot=$SYS_ROOT $OBJCFLAGS"
-    CPPFLAGS="--sysroot=$SYS_ROOT $CPPFLAGS"
-    LDFLAGS="--sysroot=$SYS_ROOT $LDFLAGS"
-fi
-
 # Store the CFLAGS etal passed to the configure script.
 ORG_CFLAGS="$CFLAGS"
 ORG_CXXFLAGS="$CXXFLAGS"
@@ -19395,10 +19529,10 @@
             COUNTER=0
             sym_link_dir=`$DIRNAME $TEST_COMPILER`
             sym_link_file=`$BASENAME $TEST_COMPILER`
-            # Use the system pwd and not the shell builtin to resolve directory symlinks
             cd $sym_link_dir
-            cd `$THEPWDCMD`
-            sym_link_dir=`$THEPWDCMD`
+            # Use -P flag to resolve symlinks in directories.
+            cd `$THEPWDCMD -P`
+            sym_link_dir=`$THEPWDCMD -P`
             # Resolve file symlinks
             while test $COUNTER -lt 20; do
                 ISLINK=`$LS -l $sym_link_dir/$sym_link_file | $GREP '\->' | $SED -e 's/.*-> \(.*\)/\1/'`
@@ -19409,7 +19543,7 @@
                 # Again resolve directory symlinks since the target of the just found
                 # link could be in a different directory
                 cd `$DIRNAME $ISLINK`
-                sym_link_dir=`$THEPWDCMD`
+                sym_link_dir=`$THEPWDCMD -P`
                 sym_link_file=`$BASENAME $ISLINK`
                 let COUNTER=COUNTER+1
             done
@@ -19832,10 +19966,10 @@
             COUNTER=0
             sym_link_dir=`$DIRNAME $PROPER_COMPILER_CC`
             sym_link_file=`$BASENAME $PROPER_COMPILER_CC`
-            # Use the system pwd and not the shell builtin to resolve directory symlinks
             cd $sym_link_dir
-            cd `$THEPWDCMD`
-            sym_link_dir=`$THEPWDCMD`
+            # Use -P flag to resolve symlinks in directories.
+            cd `$THEPWDCMD -P`
+            sym_link_dir=`$THEPWDCMD -P`
             # Resolve file symlinks
             while test $COUNTER -lt 20; do
                 ISLINK=`$LS -l $sym_link_dir/$sym_link_file | $GREP '\->' | $SED -e 's/.*-> \(.*\)/\1/'`
@@ -19846,7 +19980,7 @@
                 # Again resolve directory symlinks since the target of the just found
                 # link could be in a different directory
                 cd `$DIRNAME $ISLINK`
-                sym_link_dir=`$THEPWDCMD`
+                sym_link_dir=`$THEPWDCMD -P`
                 sym_link_file=`$BASENAME $ISLINK`
                 let COUNTER=COUNTER+1
             done
@@ -19886,7 +20020,7 @@
   elif test  "x$OPENJDK_TARGET_OS" = xwindows; then
     # First line typically looks something like:
     # Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 16.00.30319.01 for 80x86
-    COMPILER_VERSION_TEST=`$COMPILER 2>&1 | $HEAD -n 1`
+    COMPILER_VERSION_TEST=`$COMPILER 2>&1 | $HEAD -n 1 | $TR -d '\r'`
     COMPILER_VERSION=`$ECHO $COMPILER_VERSION_TEST | $SED -n "s/^.*Version \([1-9][0-9.]*\) .*/\1/p"`
     COMPILER_VENDOR="Microsoft CL.EXE"
     COMPILER_CPU_TEST=`$ECHO $COMPILER_VERSION_TEST | $SED -n "s/^.* for \(.*\)$/\1/p"`
@@ -20035,7 +20169,7 @@
 test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
 as_fn_error $? "no acceptable C compiler found in \$PATH
-See \`config.log' for more details" "$LINENO" 5; }
+See \`config.log' for more details" "$LINENO" 5 ; }
 
 # Provide some information about the compiler.
 $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5
@@ -20150,7 +20284,7 @@
 { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
 as_fn_error 77 "C compiler cannot create executables
-See \`config.log' for more details" "$LINENO" 5; }
+See \`config.log' for more details" "$LINENO" 5 ; }
 else
   { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
 $as_echo "yes" >&6; }
@@ -20193,7 +20327,7 @@
   { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
 as_fn_error $? "cannot compute suffix of executables: cannot compile and link
-See \`config.log' for more details" "$LINENO" 5; }
+See \`config.log' for more details" "$LINENO" 5 ; }
 fi
 rm -f conftest conftest$ac_cv_exeext
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5
@@ -20252,7 +20386,7 @@
 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
 as_fn_error $? "cannot run C compiled programs.
 If you meant to cross compile, use \`--host'.
-See \`config.log' for more details" "$LINENO" 5; }
+See \`config.log' for more details" "$LINENO" 5 ; }
     fi
   fi
 fi
@@ -20304,7 +20438,7 @@
 { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
 as_fn_error $? "cannot compute suffix of object files: cannot compile
-See \`config.log' for more details" "$LINENO" 5; }
+See \`config.log' for more details" "$LINENO" 5 ; }
 fi
 rm -f conftest.$ac_cv_objext conftest.$ac_ext
 fi
@@ -20968,10 +21102,10 @@
             COUNTER=0
             sym_link_dir=`$DIRNAME $TEST_COMPILER`
             sym_link_file=`$BASENAME $TEST_COMPILER`
-            # Use the system pwd and not the shell builtin to resolve directory symlinks
             cd $sym_link_dir
-            cd `$THEPWDCMD`
-            sym_link_dir=`$THEPWDCMD`
+            # Use -P flag to resolve symlinks in directories.
+            cd `$THEPWDCMD -P`
+            sym_link_dir=`$THEPWDCMD -P`
             # Resolve file symlinks
             while test $COUNTER -lt 20; do
                 ISLINK=`$LS -l $sym_link_dir/$sym_link_file | $GREP '\->' | $SED -e 's/.*-> \(.*\)/\1/'`
@@ -20982,7 +21116,7 @@
                 # Again resolve directory symlinks since the target of the just found
                 # link could be in a different directory
                 cd `$DIRNAME $ISLINK`
-                sym_link_dir=`$THEPWDCMD`
+                sym_link_dir=`$THEPWDCMD -P`
                 sym_link_file=`$BASENAME $ISLINK`
                 let COUNTER=COUNTER+1
             done
@@ -21405,10 +21539,10 @@
             COUNTER=0
             sym_link_dir=`$DIRNAME $PROPER_COMPILER_CXX`
             sym_link_file=`$BASENAME $PROPER_COMPILER_CXX`
-            # Use the system pwd and not the shell builtin to resolve directory symlinks
             cd $sym_link_dir
-            cd `$THEPWDCMD`
-            sym_link_dir=`$THEPWDCMD`
+            # Use -P flag to resolve symlinks in directories.
+            cd `$THEPWDCMD -P`
+            sym_link_dir=`$THEPWDCMD -P`
             # Resolve file symlinks
             while test $COUNTER -lt 20; do
                 ISLINK=`$LS -l $sym_link_dir/$sym_link_file | $GREP '\->' | $SED -e 's/.*-> \(.*\)/\1/'`
@@ -21419,7 +21553,7 @@
                 # Again resolve directory symlinks since the target of the just found
                 # link could be in a different directory
                 cd `$DIRNAME $ISLINK`
-                sym_link_dir=`$THEPWDCMD`
+                sym_link_dir=`$THEPWDCMD -P`
                 sym_link_file=`$BASENAME $ISLINK`
                 let COUNTER=COUNTER+1
             done
@@ -21459,7 +21593,7 @@
   elif test  "x$OPENJDK_TARGET_OS" = xwindows; then
     # First line typically looks something like:
     # Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 16.00.30319.01 for 80x86
-    COMPILER_VERSION_TEST=`$COMPILER 2>&1 | $HEAD -n 1`
+    COMPILER_VERSION_TEST=`$COMPILER 2>&1 | $HEAD -n 1 | $TR -d '\r'`
     COMPILER_VERSION=`$ECHO $COMPILER_VERSION_TEST | $SED -n "s/^.*Version \([1-9][0-9.]*\) .*/\1/p"`
     COMPILER_VENDOR="Microsoft CL.EXE"
     COMPILER_CPU_TEST=`$ECHO $COMPILER_VERSION_TEST | $SED -n "s/^.* for \(.*\)$/\1/p"`
@@ -23719,19 +23853,20 @@
         RC_FLAGS="$RC_FLAGS -d NDEBUG"
 
 fi
-    JDK_UPDATE_VERSION_NOTNULL=$JDK_UPDATE_VERSION
-    if test "x$JDK_UPDATE_VERSION" = x; then :
-
-        JDK_UPDATE_VERSION_NOTNULL=0
-
-fi
-    RC_FLAGS="$RC_FLAGS -d \"JDK_BUILD_ID=$FULL_VERSION\""
-    RC_FLAGS="$RC_FLAGS -d \"JDK_COMPANY=$COMPANY_NAME\""
-    RC_FLAGS="$RC_FLAGS -d \"JDK_COMPONENT=$PRODUCT_NAME $JDK_RC_PLATFORM_NAME binary\""
-    RC_FLAGS="$RC_FLAGS -d \"JDK_VER=$JDK_MINOR_VERSION.$JDK_MICRO_VERSION.$JDK_UPDATE_VERSION_NOTNULL.$COOKED_BUILD_NUMBER\""
-    RC_FLAGS="$RC_FLAGS -d \"JDK_COPYRIGHT=Copyright \xA9 $COPYRIGHT_YEAR\""
-    RC_FLAGS="$RC_FLAGS -d \"JDK_NAME=$PRODUCT_NAME $JDK_RC_PLATFORM_NAME $JDK_MINOR_VERSION $JDK_UPDATE_META_TAG\""
-    RC_FLAGS="$RC_FLAGS -d \"JDK_FVER=$JDK_MINOR_VERSION,$JDK_MICRO_VERSION,$JDK_UPDATE_VERSION_NOTNULL,$COOKED_BUILD_NUMBER\""
+
+    # The version variables used to create RC_FLAGS may be overridden
+    # in a custom configure script, or possibly the command line.
+    # Let those variables be expanded at make time in spec.gmk.
+    # The \$ are escaped to the shell, and the $(...) variables
+    # are evaluated by make.
+    RC_FLAGS="$RC_FLAGS \
+        -d \"JDK_BUILD_ID=\$(FULL_VERSION)\" \
+        -d \"JDK_COMPANY=\$(COMPANY_NAME)\" \
+        -d \"JDK_COMPONENT=\$(PRODUCT_NAME) \$(JDK_RC_PLATFORM_NAME) binary\" \
+        -d \"JDK_VER=\$(JDK_MINOR_VERSION).\$(JDK_MICRO_VERSION).\$(if \$(JDK_UPDATE_VERSION),\$(JDK_UPDATE_VERSION),0).\$(COOKED_BUILD_NUMBER)\" \
+        -d \"JDK_COPYRIGHT=Copyright \xA9 $COPYRIGHT_YEAR\" \
+        -d \"JDK_NAME=\$(PRODUCT_NAME) \$(JDK_RC_PLATFORM_NAME) \$(JDK_MINOR_VERSION) \$(JDK_UPDATE_META_TAG)\" \
+        -d \"JDK_FVER=\$(JDK_MINOR_VERSION),\$(JDK_MICRO_VERSION),\$(if \$(JDK_UPDATE_VERSION),\$(JDK_UPDATE_VERSION),0),\$(COOKED_BUILD_NUMBER)\""
 
     # lib.exe is used to create static libraries.
     # Extract the first word of "lib", so it can be a program name with args.
@@ -24479,7 +24614,7 @@
   { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
 as_fn_error $? "C preprocessor \"$CPP\" fails sanity check
-See \`config.log' for more details" "$LINENO" 5; }
+See \`config.log' for more details" "$LINENO" 5 ; }
 fi
 
 ac_ext=cpp
@@ -24879,7 +25014,7 @@
   { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
 as_fn_error $? "C++ preprocessor \"$CXXCPP\" fails sanity check
-See \`config.log' for more details" "$LINENO" 5; }
+See \`config.log' for more details" "$LINENO" 5 ; }
 fi
 
 ac_ext=cpp
@@ -28716,7 +28851,7 @@
      { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
 as_fn_error 77 "cannot compute sizeof (int *)
-See \`config.log' for more details" "$LINENO" 5; }
+See \`config.log' for more details" "$LINENO" 5 ; }
    else
      ac_cv_sizeof_int_p=0
    fi
@@ -29142,7 +29277,6 @@
 
 case $COMPILER_TYPE in
   CC )
-    D_FLAG="-g"
     case $COMPILER_NAME in
       gcc )
       	case $OPENJDK_TARGET_OS in
@@ -29157,17 +29291,17 @@
 	    C_O_FLAG_HI="-O3"
 	    C_O_FLAG_NORM="-O2"
 	    C_O_FLAG_NONE="-O0"
-	    CFLAGS_DEBUG_SYMBOLS="-g"
-	    CXXFLAGS_DEBUG_SYMBOLS="-g"
-	    if test "x$OPENJDK_TARGET_CPU_BITS" = "x64" && test "x$DEBUG_LEVEL" = "xfastdebug"; then
-	       CFLAGS_DEBUG_SYMBOLS="-g1"
-	       CXXFLAGS_DEBUG_SYMBOLS="-g1"
-	    fi
 	    ;;
 	esac
         CXX_O_FLAG_HI="$C_O_FLAG_HI"
         CXX_O_FLAG_NORM="$C_O_FLAG_NORM"
         CXX_O_FLAG_NONE="$C_O_FLAG_NONE"
+        CFLAGS_DEBUG_SYMBOLS="-g"
+        CXXFLAGS_DEBUG_SYMBOLS="-g"
+        if test "x$OPENJDK_TARGET_CPU_BITS" = "x64" && test "x$DEBUG_LEVEL" = "xfastdebug"; then
+            CFLAGS_DEBUG_SYMBOLS="-g1"
+            CXXFLAGS_DEBUG_SYMBOLS="-g1"
+        fi
         ;;
       ossc )
         #
@@ -29248,7 +29382,6 @@
     esac
     ;;
   CL )
-    D_FLAG=
     C_O_FLAG_HIGHEST="-O2"
     C_O_FLAG_HI="-O1"
     C_O_FLAG_NORM="-O1"
@@ -29387,6 +29520,28 @@
 
 ###############################################################################
 
+# Adjust flags according to debug level.
+case $DEBUG_LEVEL in
+      fastdebug )
+              CFLAGS_JDK="$CFLAGS_JDK $CFLAGS_DEBUG_SYMBOLS"
+              CXXFLAGS_JDK="$CXXFLAGS_JDK $CXXFLAGS_DEBUG_SYMBOLS"
+	      C_O_FLAG_HI="$C_O_FLAG_NORM"
+	      C_O_FLAG_NORM="$C_O_FLAG_NORM"
+	      CXX_O_FLAG_HI="$CXX_O_FLAG_NORM"
+	      CXX_O_FLAG_NORM="$CXX_O_FLAG_NORM"
+              JAVAC_FLAGS="$JAVAC_FLAGS -g"
+              ;;
+      slowdebug )
+              CFLAGS_JDK="$CFLAGS_JDK $CFLAGS_DEBUG_SYMBOLS"
+              CXXFLAGS_JDK="$CXXFLAGS_JDK $CXXFLAGS_DEBUG_SYMBOLS"
+	      C_O_FLAG_HI="$C_O_FLAG_NONE"
+	      C_O_FLAG_NORM="$C_O_FLAG_NONE"
+	      CXX_O_FLAG_HI="$CXX_O_FLAG_NONE"
+	      CXX_O_FLAG_NORM="$CXX_O_FLAG_NONE"
+              JAVAC_FLAGS="$JAVAC_FLAGS -g"
+              ;;
+esac
+
 CCXXFLAGS_JDK="$CCXXFLAGS_JDK $ADD_LP64"
 
 # The package path is used only on macosx?
@@ -29530,23 +29685,6 @@
     fi
 fi
 
-# Adjust flags according to debug level.
-case $DEBUG_LEVEL in
-      fastdebug )
-              CFLAGS="$CFLAGS $D_FLAG"
-              JAVAC_FLAGS="$JAVAC_FLAGS -g"
-              ;;
-      slowdebug )
-              CFLAGS="$CFLAGS $D_FLAG"
-	      C_O_FLAG_HI="$C_O_FLAG_NONE"
-	      C_O_FLAG_NORM="$C_O_FLAG_NONE"
-	      CXX_O_FLAG_HI="$CXX_O_FLAG_NONE"
-	      CXX_O_FLAG_NORM="$CXX_O_FLAG_NONE"
-              JAVAC_FLAGS="$JAVAC_FLAGS -g"
-              ;;
-esac
-
-
 
 
 
@@ -29905,11 +30043,17 @@
   if test "x$x_includes" = xNONE; then
     if test -f "$SYS_ROOT/usr/X11R6/include/X11/Xlib.h"; then
       x_includes="$SYS_ROOT/usr/X11R6/include"
+    elif test -f "$SYS_ROOT/usr/include/X11/Xlib.h"; then
+      x_includes="$SYS_ROOT/usr/include"
     fi
   fi
   if test "x$x_libraries" = xNONE; then
     if test -f "$SYS_ROOT/usr/X11R6/lib/libX11.so"; then
       x_libraries="$SYS_ROOT/usr/X11R6/lib"
+    elif test "$SYS_ROOT/usr/lib64/libX11.so" && test "x$OPENJDK_TARGET_CPU_BITS" = x64; then
+      x_libraries="$SYS_ROOT/usr/lib64"
+    elif test -f "$SYS_ROOT/usr/lib/libX11.so"; then
+      x_libraries="$SYS_ROOT/usr/lib"
     fi
   fi
 fi
@@ -29930,7 +30074,7 @@
   have_x=disabled
 else
   case $x_includes,$x_libraries in #(
-    *\'*) as_fn_error $? "cannot use X directory names containing '" "$LINENO" 5;; #(
+    *\'*) as_fn_error $? "cannot use X directory names containing '" "$LINENO" 5 ;; #(
     *,NONE | NONE,*) if test "${ac_cv_have_x+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
@@ -30640,8 +30784,7 @@
 if test "x$OPENJDK_TARGET_OS" = xlinux; then
     if test -d "$SYS_ROOT/usr/X11R6"; then
         OPENWIN_HOME="$SYS_ROOT/usr/X11R6"
-    fi
-    if test -d "$SYS_ROOT/usr/include/X11"; then
+    elif test -d "$SYS_ROOT/usr/include/X11"; then
         OPENWIN_HOME="$SYS_ROOT/usr"
     fi
 fi
@@ -31131,7 +31274,7 @@
       as_fn_error $? "The path of with_freetype, which resolves as \"$path\", is not found." "$LINENO" 5
     fi
 
-    with_freetype="`cd "$path"; $THEPWDCMD`"
+    with_freetype="`cd "$path"; $THEPWDCMD -L`"
   fi
 
 	    FREETYPE2_LIBS="-L$with_freetype/lib -lfreetype"
@@ -31433,7 +31576,7 @@
       as_fn_error $? "The path of FREETYPELOCATION, which resolves as \"$path\", is not found." "$LINENO" 5
     fi
 
-    FREETYPELOCATION="`cd "$path"; $THEPWDCMD`"
+    FREETYPELOCATION="`cd "$path"; $THEPWDCMD -L`"
   fi
 
 	    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for freetype in some standard windows locations" >&5
@@ -31534,12 +31677,12 @@
 	    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for freetype in some standard locations" >&5
 $as_echo_n "checking for freetype in some standard locations... " >&6; }
 
-	    if test -s /usr/X11/include/ft2build.h && test -d /usr/X11/include/freetype2/freetype; then
-	        DEFAULT_FREETYPE_CFLAGS="-I/usr/X11/include/freetype2 -I/usr/X11/include"
-	        DEFAULT_FREETYPE_LIBS="-L/usr/X11/lib -lfreetype"
+	    if test -s $SYS_ROOT/usr/X11/include/ft2build.h && test -d $SYS_ROOT/usr/X11/include/freetype2/freetype; then
+	        DEFAULT_FREETYPE_CFLAGS="-I$SYS_ROOT/usr/X11/include/freetype2 -I$SYS_ROOT/usr/X11/include"
+	        DEFAULT_FREETYPE_LIBS="-L$SYS_ROOT/usr/X11/lib -lfreetype"
 	    fi
-	    if test -s /usr/include/ft2build.h && test -d /usr/include/freetype2/freetype; then
-	        DEFAULT_FREETYPE_CFLAGS="-I/usr/include/freetype2"
+	    if test -s $SYS_ROOT/usr/include/ft2build.h && test -d $SYS_ROOT/usr/include/freetype2/freetype; then
+	        DEFAULT_FREETYPE_CFLAGS="-I$SYS_ROOT/usr/include/freetype2"
 	        DEFAULT_FREETYPE_LIBS="-lfreetype"
 	    fi
 
@@ -32591,7 +32734,7 @@
 See the pkg-config man page for more details.
 
 To get pkg-config, see <http://pkg-config.freedesktop.org/>.
-See \`config.log' for more details" "$LINENO" 5; }
+See \`config.log' for more details" "$LINENO" 5 ; }
 else
 	LIBFFI_CFLAGS=$pkg_cv_LIBFFI_CFLAGS
 	LIBFFI_LIBS=$pkg_cv_LIBFFI_LIBS
@@ -32933,6 +33076,9 @@
     if test "$JOBS" -gt "16"; then
       JOBS=16
     fi
+    if test "$JOBS" -eq "0"; then
+      JOBS=1
+    fi
     { $as_echo "$as_me:${as_lineno-$LINENO}: result: $JOBS" >&5
 $as_echo "$JOBS" >&6; }
   else
@@ -33212,6 +33358,10 @@
 fi
 
     if test "x$ENABLE_CCACHE" = xyes; then
+        OLD_PATH="$PATH"
+        if test "x$TOOLS_DIR" != x; then
+          PATH=$TOOLS_DIR:$PATH
+        fi
         # Extract the first word of "ccache", so it can be a program name with args.
 set dummy ccache; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
@@ -33252,6 +33402,7 @@
 fi
 
 
+        PATH="$OLD_PATH"
     else
         { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ccache" >&5
 $as_echo_n "checking for ccache... " >&6; }
@@ -34112,7 +34263,7 @@
     "$OUTPUT_ROOT/spec.sh") CONFIG_FILES="$CONFIG_FILES $OUTPUT_ROOT/spec.sh:$AUTOCONF_DIR/spec.sh.in" ;;
     "$OUTPUT_ROOT/Makefile") CONFIG_FILES="$CONFIG_FILES $OUTPUT_ROOT/Makefile:$AUTOCONF_DIR/Makefile.in" ;;
 
-  *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;;
+  *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5 ;;
   esac
 done
 
@@ -34427,7 +34578,7 @@
   esac
   case $ac_mode$ac_tag in
   :[FHL]*:*);;
-  :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5;;
+  :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5 ;;
   :[FH]-) ac_tag=-:-;;
   :[FH]*) ac_tag=$ac_tag:$ac_tag.in;;
   esac
@@ -34455,7 +34606,7 @@
 	   [\\/$]*) false;;
 	   *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";;
 	   esac ||
-	   as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5;;
+	   as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5 ;;
       esac
       case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac
       as_fn_append ac_file_inputs " '$ac_f'"
@@ -34482,7 +34633,7 @@
 
     case $ac_tag in
     *:-:* | *:-) cat >"$tmp/stdin" \
-      || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;;
+      || as_fn_error $? "could not create $ac_file" "$LINENO" 5  ;;
     esac
     ;;
   esac
--- a/common/autoconf/jdk-options.m4	Wed Jun 05 13:08:59 2013 -0300
+++ b/common/autoconf/jdk-options.m4	Tue Jul 16 09:08:46 2013 -0300
@@ -351,11 +351,7 @@
 if test "x$with_cacerts_file" != x; then
     CACERTS_FILE=$with_cacerts_file
 else
-    if test "x$OPENJDK" = "xtrue"; then
-        CACERTS_FILE=${SRC_ROOT}/jdk/src/share/lib/security/cacerts
-    else
-        CACERTS_FILE=${SRC_ROOT}/jdk/src/closed/share/lib/security/cacerts.internal
-    fi
+    CACERTS_FILE=${SRC_ROOT}/jdk/src/share/lib/security/cacerts
 fi
 AC_SUBST(CACERTS_FILE)
 
@@ -422,6 +418,14 @@
   MILESTONE=internal
 fi
 
+AC_ARG_WITH(update-version, [AS_HELP_STRING([--with-update-version], 
+                          [Set update version value for build @<:@b00@:>@])])
+if test "x$with_update_version" = xyes; then
+  AC_MSG_ERROR([Update version must have a value])
+elif test "x$with_update_version" != x; then
+  JDK_UPDATE_VERSION="$with_update_version"
+fi
+
 AC_ARG_WITH(build-number, [AS_HELP_STRING([--with-build-number], 
                           [Set build number value for build @<:@b00@:>@])])
 if test "x$with_build_number" = xyes; then
--- a/common/autoconf/libraries.m4	Wed Jun 05 13:08:59 2013 -0300
+++ b/common/autoconf/libraries.m4	Tue Jul 16 09:08:46 2013 -0300
@@ -123,11 +123,17 @@
   if test "x$x_includes" = xNONE; then
     if test -f "$SYS_ROOT/usr/X11R6/include/X11/Xlib.h"; then
       x_includes="$SYS_ROOT/usr/X11R6/include"
+    elif test -f "$SYS_ROOT/usr/include/X11/Xlib.h"; then
+      x_includes="$SYS_ROOT/usr/include"
     fi
   fi
   if test "x$x_libraries" = xNONE; then
     if test -f "$SYS_ROOT/usr/X11R6/lib/libX11.so"; then
       x_libraries="$SYS_ROOT/usr/X11R6/lib"
+    elif test "$SYS_ROOT/usr/lib64/libX11.so" && test "x$OPENJDK_TARGET_CPU_BITS" = x64; then
+      x_libraries="$SYS_ROOT/usr/lib64"
+    elif test -f "$SYS_ROOT/usr/lib/libX11.so"; then
+      x_libraries="$SYS_ROOT/usr/lib"
     fi
   fi
 fi
@@ -153,8 +159,7 @@
 if test "x$OPENJDK_TARGET_OS" = xlinux; then
     if test -d "$SYS_ROOT/usr/X11R6"; then
         OPENWIN_HOME="$SYS_ROOT/usr/X11R6"
-    fi
-    if test -d "$SYS_ROOT/usr/include/X11"; then
+    elif test -d "$SYS_ROOT/usr/include/X11"; then
         OPENWIN_HOME="$SYS_ROOT/usr"
     fi
 fi
@@ -359,12 +364,12 @@
 	if test "x$FREETYPE2_FOUND" = xno; then
 	    AC_MSG_CHECKING([for freetype in some standard locations])
 	
-	    if test -s /usr/X11/include/ft2build.h && test -d /usr/X11/include/freetype2/freetype; then
-	        DEFAULT_FREETYPE_CFLAGS="-I/usr/X11/include/freetype2 -I/usr/X11/include"
-	        DEFAULT_FREETYPE_LIBS="-L/usr/X11/lib -lfreetype"
+	    if test -s $SYS_ROOT/usr/X11/include/ft2build.h && test -d $SYS_ROOT/usr/X11/include/freetype2/freetype; then
+	        DEFAULT_FREETYPE_CFLAGS="-I$SYS_ROOT/usr/X11/include/freetype2 -I$SYS_ROOT/usr/X11/include"
+	        DEFAULT_FREETYPE_LIBS="-L$SYS_ROOT/usr/X11/lib -lfreetype"
 	    fi
-	    if test -s /usr/include/ft2build.h && test -d /usr/include/freetype2/freetype; then
-	        DEFAULT_FREETYPE_CFLAGS="-I/usr/include/freetype2"
+	    if test -s $SYS_ROOT/usr/include/ft2build.h && test -d $SYS_ROOT/usr/include/freetype2/freetype; then
+	        DEFAULT_FREETYPE_CFLAGS="-I$SYS_ROOT/usr/include/freetype2"
 	        DEFAULT_FREETYPE_LIBS="-lfreetype"
 	    fi
 	
--- a/common/autoconf/spec.gmk.in	Wed Jun 05 13:08:59 2013 -0300
+++ b/common/autoconf/spec.gmk.in	Tue Jul 16 09:08:46 2013 -0300
@@ -275,6 +275,8 @@
 FREETYPE2_CFLAGS:=@FREETYPE2_CFLAGS@
 USING_SYSTEM_FT_LIB=@USING_SYSTEM_FT_LIB@
 CUPS_CFLAGS:=@CUPS_CFLAGS@
+ALSA_LIBS:=@ALSA_LIBS@
+ALSA_CFLAGS:=@ALSA_CFLAGS@
 
 PACKAGE_PATH=@PACKAGE_PATH@
 
@@ -478,6 +480,7 @@
 # CD is going away, but remains to cater for legacy makefiles.
 CD:=cd
 CHMOD:=@CHMOD@
+CODESIGN:=@CODESIGN@
 COMM:=@COMM@
 CP:=@CP@
 CPIO:=@CPIO@
@@ -507,6 +510,7 @@
 TAIL:=@TAIL@
 TEE:=@TEE@
 TIME:=@TIME@
+IS_GNU_TIME:=@IS_GNU_TIME@
 TR:=@TR@
 TOUCH:=@TOUCH@
 UNIQ:=@UNIQ@
--- a/common/autoconf/toolchain.m4	Wed Jun 05 13:08:59 2013 -0300
+++ b/common/autoconf/toolchain.m4	Tue Jul 16 09:08:46 2013 -0300
@@ -36,7 +36,7 @@
     $ECHO $COMPILER_VERSION_TEST | $GREP "^.*: Sun $COMPILER_NAME" > /dev/null
     if test $? -ne 0; then
       GCC_VERSION_TEST=`$COMPILER --version 2>&1 | $HEAD -n 1`
-      
+
       AC_MSG_NOTICE([The $COMPILER_NAME compiler (located as $COMPILER) does not seem to be the required Sun Studio compiler.])
       AC_MSG_NOTICE([The result from running with -V was: "$COMPILER_VERSION_TEST" and with --version: "$GCC_VERSION_TEST"])
       AC_MSG_ERROR([Sun Studio compiler is required. Try setting --with-tools-dir.])
@@ -47,7 +47,7 @@
   elif test  "x$OPENJDK_TARGET_OS" = xwindows; then
     # First line typically looks something like:
     # Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 16.00.30319.01 for 80x86
-    COMPILER_VERSION_TEST=`$COMPILER 2>&1 | $HEAD -n 1`
+    COMPILER_VERSION_TEST=`$COMPILER 2>&1 | $HEAD -n 1 | $TR -d '\r'`
     COMPILER_VERSION=`$ECHO $COMPILER_VERSION_TEST | $SED -n "s/^.*Version \(@<:@1-9@:>@@<:@0-9.@:>@*\) .*/\1/p"`
     COMPILER_VENDOR="Microsoft CL.EXE"
     COMPILER_CPU_TEST=`$ECHO $COMPILER_VERSION_TEST | $SED -n "s/^.* for \(.*\)$/\1/p"`
@@ -69,7 +69,7 @@
       AC_MSG_NOTICE([The result from running with --version was: "$COMPILER_VERSION_TEST"])
       AC_MSG_ERROR([GCC compiler is required. Try setting --with-tools-dir.])
     fi
-    
+
     # First line typically looks something like:
     # gcc (Ubuntu/Linaro 4.5.2-8ubuntu4) 4.5.2
     COMPILER_VERSION=`$ECHO $COMPILER_VERSION_TEST | $SED -n "s/^.* \(@<:@1-9@:>@@<:@0-9.@:>@*\)/\1/p"`
@@ -142,7 +142,7 @@
   BASIC_REMOVE_SYMBOLIC_LINKS(TEST_COMPILER)
   AC_MSG_RESULT([$TEST_COMPILER])
   AC_MSG_CHECKING([if $1 is disguised ccache])
-  
+
   COMPILER_BASENAME=`$BASENAME "$TEST_COMPILER"`
   if test "x$COMPILER_BASENAME" = "xccache"; then
     AC_MSG_RESULT([yes, trying to find proper $COMPILER_NAME compiler])
@@ -226,15 +226,6 @@
                     ],
                     [])
 
-if test "x$SYS_ROOT" != "x/" ; then                    
-    CFLAGS="--sysroot=$SYS_ROOT $CFLAGS"
-    CXXFLAGS="--sysroot=$SYS_ROOT $CXXFLAGS"
-    OBJCFLAGS="--sysroot=$SYS_ROOT $OBJCFLAGS" 
-    OBJCXXFLAGS="--sysroot=$SYS_ROOT $OBJCFLAGS" 
-    CPPFLAGS="--sysroot=$SYS_ROOT $CPPFLAGS"
-    LDFLAGS="--sysroot=$SYS_ROOT $LDFLAGS"
-fi
-
 # Store the CFLAGS etal passed to the configure script.
 ORG_CFLAGS="$CFLAGS"
 ORG_CXXFLAGS="$CXXFLAGS"
@@ -330,7 +321,7 @@
 COMPILER_NAME=gcc
 COMPILER_TYPE=CC
 AS_IF([test "x$OPENJDK_TARGET_OS" = xwindows], [
-    # For now, assume that we are always compiling using cl.exe. 
+    # For now, assume that we are always compiling using cl.exe.
     CC_OUT_OPTION=-Fo
     EXE_OUT_OPTION=-out:
     LD_OUT_OPTION=-out:
@@ -378,17 +369,20 @@
     AS_IF([test "x$VARIANT" = xOPT], [
         RC_FLAGS="$RC_FLAGS -d NDEBUG"
     ])
-    JDK_UPDATE_VERSION_NOTNULL=$JDK_UPDATE_VERSION
-    AS_IF([test "x$JDK_UPDATE_VERSION" = x], [
-        JDK_UPDATE_VERSION_NOTNULL=0
-    ])
-    RC_FLAGS="$RC_FLAGS -d \"JDK_BUILD_ID=$FULL_VERSION\""
-    RC_FLAGS="$RC_FLAGS -d \"JDK_COMPANY=$COMPANY_NAME\""
-    RC_FLAGS="$RC_FLAGS -d \"JDK_COMPONENT=$PRODUCT_NAME $JDK_RC_PLATFORM_NAME binary\""
-    RC_FLAGS="$RC_FLAGS -d \"JDK_VER=$JDK_MINOR_VERSION.$JDK_MICRO_VERSION.$JDK_UPDATE_VERSION_NOTNULL.$COOKED_BUILD_NUMBER\""
-    RC_FLAGS="$RC_FLAGS -d \"JDK_COPYRIGHT=Copyright \xA9 $COPYRIGHT_YEAR\""
-    RC_FLAGS="$RC_FLAGS -d \"JDK_NAME=$PRODUCT_NAME $JDK_RC_PLATFORM_NAME $JDK_MINOR_VERSION $JDK_UPDATE_META_TAG\""
-    RC_FLAGS="$RC_FLAGS -d \"JDK_FVER=$JDK_MINOR_VERSION,$JDK_MICRO_VERSION,$JDK_UPDATE_VERSION_NOTNULL,$COOKED_BUILD_NUMBER\""
+
+    # The version variables used to create RC_FLAGS may be overridden
+    # in a custom configure script, or possibly the command line.  
+    # Let those variables be expanded at make time in spec.gmk.
+    # The \$ are escaped to the shell, and the $(...) variables
+    # are evaluated by make.
+    RC_FLAGS="$RC_FLAGS \
+        -d \"JDK_BUILD_ID=\$(FULL_VERSION)\" \
+        -d \"JDK_COMPANY=\$(COMPANY_NAME)\" \
+        -d \"JDK_COMPONENT=\$(PRODUCT_NAME) \$(JDK_RC_PLATFORM_NAME) binary\" \
+        -d \"JDK_VER=\$(JDK_MINOR_VERSION).\$(JDK_MICRO_VERSION).\$(if \$(JDK_UPDATE_VERSION),\$(JDK_UPDATE_VERSION),0).\$(COOKED_BUILD_NUMBER)\" \
+        -d \"JDK_COPYRIGHT=Copyright \xA9 $COPYRIGHT_YEAR\" \
+        -d \"JDK_NAME=\$(PRODUCT_NAME) \$(JDK_RC_PLATFORM_NAME) \$(JDK_MINOR_VERSION) \$(JDK_UPDATE_META_TAG)\" \
+        -d \"JDK_FVER=\$(JDK_MINOR_VERSION),\$(JDK_MICRO_VERSION),\$(if \$(JDK_UPDATE_VERSION),\$(JDK_UPDATE_VERSION),0),\$(COOKED_BUILD_NUMBER)\""
 
     # lib.exe is used to create static libraries.
     AC_CHECK_PROG([WINAR], [lib],[lib],,,)
@@ -491,7 +485,7 @@
 
 ###############################################################################
 #
-# How to compile shared libraries. 
+# How to compile shared libraries.
 #
 
 if test "x$GCC" = xyes; then
@@ -525,7 +519,7 @@
         SHARED_LIBRARY_FLAGS="-dynamiclib -compatibility_version 1.0.0 -current_version 1.0.0 $PICFLAG"
         SHARED_LIBRARY_SUFFIX='.dylib'
         EXE_SUFFIX=''
-        SET_SHARED_LIBRARY_NAME='-Xlinker -install_name -Xlinker @rpath/[$]1' 
+        SET_SHARED_LIBRARY_NAME='-Xlinker -install_name -Xlinker @rpath/[$]1'
         SET_SHARED_LIBRARY_MAPFILE=''
         SET_SHARED_LIBRARY_ORIGIN='-Xlinker -rpath -Xlinker @loader_path/.'
         SET_EXECUTABLE_ORIGIN="$SET_SHARED_LIBRARY_ORIGIN"
@@ -629,7 +623,6 @@
 
 case $COMPILER_TYPE in
   CC )
-    D_FLAG="-g"
     case $COMPILER_NAME in
       gcc )
       	case $OPENJDK_TARGET_OS in
@@ -644,17 +637,17 @@
 	    C_O_FLAG_HI="-O3"
 	    C_O_FLAG_NORM="-O2"
 	    C_O_FLAG_NONE="-O0"
-	    CFLAGS_DEBUG_SYMBOLS="-g"
-	    CXXFLAGS_DEBUG_SYMBOLS="-g"
-	    if test "x$OPENJDK_TARGET_CPU_BITS" = "x64" && test "x$DEBUG_LEVEL" = "xfastdebug"; then
-	       CFLAGS_DEBUG_SYMBOLS="-g1"
-	       CXXFLAGS_DEBUG_SYMBOLS="-g1"
-	    fi
 	    ;;
 	esac
         CXX_O_FLAG_HI="$C_O_FLAG_HI"
         CXX_O_FLAG_NORM="$C_O_FLAG_NORM"
         CXX_O_FLAG_NONE="$C_O_FLAG_NONE"
+        CFLAGS_DEBUG_SYMBOLS="-g"
+        CXXFLAGS_DEBUG_SYMBOLS="-g"
+        if test "x$OPENJDK_TARGET_CPU_BITS" = "x64" && test "x$DEBUG_LEVEL" = "xfastdebug"; then
+            CFLAGS_DEBUG_SYMBOLS="-g1"
+            CXXFLAGS_DEBUG_SYMBOLS="-g1"
+        fi
         ;;
       ossc )
         #
@@ -676,7 +669,7 @@
         # Use single precision floating point with 'float'
         CC_HIGHEST="$CC_HIGHEST -fsingle"
         # Assume memory references via basic pointer types do not alias
-        #   (Source with excessing pointer casting and data access with mixed 
+        #   (Source with excessing pointer casting and data access with mixed
         #    pointer types are not recommended)
         CC_HIGHEST="$CC_HIGHEST -xalias_level=basic"
         # Use intrinsic or inline versions for math/std functions
@@ -735,7 +728,6 @@
     esac
     ;;
   CL )
-    D_FLAG=
     C_O_FLAG_HIGHEST="-O2"
     C_O_FLAG_HI="-O1"
     C_O_FLAG_NORM="-O1"
@@ -861,6 +853,28 @@
 
 ###############################################################################
 
+# Adjust flags according to debug level.
+case $DEBUG_LEVEL in
+      fastdebug )
+              CFLAGS_JDK="$CFLAGS_JDK $CFLAGS_DEBUG_SYMBOLS"
+              CXXFLAGS_JDK="$CXXFLAGS_JDK $CXXFLAGS_DEBUG_SYMBOLS"
+	      C_O_FLAG_HI="$C_O_FLAG_NORM"
+	      C_O_FLAG_NORM="$C_O_FLAG_NORM"
+	      CXX_O_FLAG_HI="$CXX_O_FLAG_NORM"
+	      CXX_O_FLAG_NORM="$CXX_O_FLAG_NORM"
+              JAVAC_FLAGS="$JAVAC_FLAGS -g"
+              ;;
+      slowdebug )
+              CFLAGS_JDK="$CFLAGS_JDK $CFLAGS_DEBUG_SYMBOLS"
+              CXXFLAGS_JDK="$CXXFLAGS_JDK $CXXFLAGS_DEBUG_SYMBOLS"
+	      C_O_FLAG_HI="$C_O_FLAG_NONE"
+	      C_O_FLAG_NORM="$C_O_FLAG_NONE"
+	      CXX_O_FLAG_HI="$CXX_O_FLAG_NONE"
+	      CXX_O_FLAG_NORM="$CXX_O_FLAG_NONE"
+              JAVAC_FLAGS="$JAVAC_FLAGS -g"
+              ;;
+esac
+
 CCXXFLAGS_JDK="$CCXXFLAGS_JDK $ADD_LP64"
 
 # The package path is used only on macosx?
@@ -892,7 +906,7 @@
 fi
 if test "x$OPENJDK_TARGET_OS" = xmacosx; then
     CCXXFLAGS_JDK="$CCXXFLAGS_JDK -DMACOSX -D_ALLBSD_SOURCE"
-    # Setting these parameters makes it an error to link to macosx APIs that are 
+    # Setting these parameters makes it an error to link to macosx APIs that are
     # newer than the given OS version and makes the linked binaries compatible even
     # if built on a newer version of the OS.
     # The expected format is X.Y.Z
@@ -940,12 +954,12 @@
 # Which should we link to? Are we lucky enough that the binary api to the libjvm.so library
 # is identical for client and server? Yes. Which is picked at runtime (client or server)?
 # Neither, since the chosen libjvm.so has already been loaded by the launcher, all the following
-# libraries will link to whatever is in memory. Yuck. 
+# libraries will link to whatever is in memory. Yuck.
 #
 # Thus we offer the compiler to find libjvm.so first in server then in client. It works. Ugh.
 if test "x$COMPILER_NAME" = xcl; then
     LDFLAGS_JDK="$LDFLAGS_JDK -nologo -opt:ref -incremental:no"
-    if test "x$OPENJDK_TARGET_CPU" = xx86; then 
+    if test "x$OPENJDK_TARGET_CPU" = xx86; then
         LDFLAGS_JDK="$LDFLAGS_JDK -safeseh"
     fi
     # TODO: make -debug optional "--disable-full-debug-symbols"
@@ -965,7 +979,7 @@
         if test -n "$HAS_GNU_HASH"; then
             LDFLAGS_JDK="${LDFLAGS_JDK} -Xlinker --hash-style=both "
         fi
-        if test "x$OPENJDK_TARGET_OS" = xlinux; then 
+        if test "x$OPENJDK_TARGET_OS" = xlinux; then
           # And since we now know that the linker is gnu, then add -z defs, to forbid
           # undefined symbols in object files.
           LDFLAGS_JDK="${LDFLAGS_JDK} -Xlinker -z -Xlinker defs"
@@ -1004,23 +1018,6 @@
     fi
 fi
 
-# Adjust flags according to debug level.
-case $DEBUG_LEVEL in
-      fastdebug ) 
-              CFLAGS="$CFLAGS $D_FLAG"
-              JAVAC_FLAGS="$JAVAC_FLAGS -g"
-              ;;
-      slowdebug )
-              CFLAGS="$CFLAGS $D_FLAG"
-	      C_O_FLAG_HI="$C_O_FLAG_NONE"
-	      C_O_FLAG_NORM="$C_O_FLAG_NONE"
-	      CXX_O_FLAG_HI="$CXX_O_FLAG_NONE"
-	      CXX_O_FLAG_NORM="$CXX_O_FLAG_NONE"
-              JAVAC_FLAGS="$JAVAC_FLAGS -g"
-              ;;
-esac              
-
-                
 AC_SUBST(CFLAGS_JDKLIB)
 AC_SUBST(CFLAGS_JDKEXE)
 
@@ -1092,28 +1089,45 @@
   AC_SUBST(COMPILER_SUPPORTS_TARGET_BITS_FLAG)
 ])
 
-# Setup the JTREG paths 
-AC_DEFUN_ONCE([TOOLCHAIN_SETUP_JTREG], 
-[ 
-  AC_ARG_WITH(jtreg, [AS_HELP_STRING([--with-jtreg], 
-  [Regression Test Harness @<:@probed@:>@])]) 
- 
-  AC_MSG_CHECKING([for JTReg Regression Test Harness]) 
- 
-  if test "x$with_jtreg" != x; then 
-    JT_HOME="$with_jtreg"
-    BASIC_FIXUP_PATH([JT_HOME])
-    AC_MSG_RESULT($JT_HOME)
- 
-    # jtreg win32 script works for everybody 
-    JTREGEXE="$JT_HOME/win32/bin/jtreg"
-    if test ! -f "$JTREGEXE"; then
-      AC_MSG_ERROR([JTReg executable does not exist: $JTREGEXE])
+# Setup the JTREG paths
+AC_DEFUN_ONCE([TOOLCHAIN_SETUP_JTREG],
+[
+  AC_ARG_WITH(jtreg, [AS_HELP_STRING([--with-jtreg],
+  [Regression Test Harness @<:@probed@:>@])],
+  [],
+  [with_jtreg=no])
+
+  if test "x$with_jtreg" = xno; then
+    # jtreg disabled
+    AC_MSG_CHECKING([for jtreg])
+    AC_MSG_RESULT(no)
+  else
+    if test "x$with_jtreg" != xyes; then
+      # with path specified.
+      JT_HOME="$with_jtreg"
     fi
-  else 
-    AC_MSG_RESULT(no)
-  fi 
- 
-  AC_SUBST(JT_HOME) 
-  AC_SUBST(JTREGEXE) 
+
+    if test "x$JT_HOME" != x; then
+      AC_MSG_CHECKING([for jtreg])
+
+      # use JT_HOME enviroment var.
+      BASIC_FIXUP_PATH([JT_HOME])
+
+      # jtreg win32 script works for everybody
+      JTREGEXE="$JT_HOME/win32/bin/jtreg"
+
+      if test ! -f "$JTREGEXE"; then
+        AC_MSG_ERROR([JTReg executable does not exist: $JTREGEXE])
+      fi
+
+      AC_MSG_RESULT($JTREGEXE)
+    else
+      # try to find jtreg on path
+      BASIC_REQUIRE_PROG(JTREGEXE, jtreg)
+      JT_HOME="`$DIRNAME $JTREGEXE`"
+    fi
+  fi
+
+  AC_SUBST(JT_HOME)
+  AC_SUBST(JTREGEXE)
 ])
--- a/common/autoconf/toolchain_windows.m4	Wed Jun 05 13:08:59 2013 -0300
+++ b/common/autoconf/toolchain_windows.m4	Tue Jul 16 09:08:46 2013 -0300
@@ -91,6 +91,15 @@
     AC_MSG_ERROR([Cannot locate a valid Visual Studio installation])
   fi  
 
+  if test "x$VS100COMNTOOLS" != x; then
+    TOOLCHAIN_CHECK_POSSIBLE_VISUAL_STUDIO_ROOT([$VS100COMNTOOLS/../..], [VS100COMNTOOLS variable])
+  fi
+  if test "x$PROGRAMFILES" != x; then
+    TOOLCHAIN_CHECK_POSSIBLE_VISUAL_STUDIO_ROOT([$PROGRAMFILES/Microsoft Visual Studio 10.0], [well-known name])
+  fi
+  TOOLCHAIN_CHECK_POSSIBLE_VISUAL_STUDIO_ROOT([C:/Program Files/Microsoft Visual Studio 10.0], [well-known name])
+  TOOLCHAIN_CHECK_POSSIBLE_VISUAL_STUDIO_ROOT([C:/Program Files (x86)/Microsoft Visual Studio 10.0], [well-known name])
+
   if test "x$ProgramW6432" != x; then
     TOOLCHAIN_CHECK_POSSIBLE_WIN_SDK_ROOT([$ProgramW6432/Microsoft SDKs/Windows/v7.1/Bin], [well-known name])
   fi
@@ -102,15 +111,6 @@
   fi
   TOOLCHAIN_CHECK_POSSIBLE_WIN_SDK_ROOT([C:/Program Files/Microsoft SDKs/Windows/v7.1/Bin], [well-known name])
   TOOLCHAIN_CHECK_POSSIBLE_WIN_SDK_ROOT([C:/Program Files (x86)/Microsoft SDKs/Windows/v7.1/Bin], [well-known name])
-
-  if test "x$VS100COMNTOOLS" != x; then
-    TOOLCHAIN_CHECK_POSSIBLE_VISUAL_STUDIO_ROOT([$VS100COMNTOOLS/../..], [VS100COMNTOOLS variable])
-  fi
-  if test "x$PROGRAMFILES" != x; then
-    TOOLCHAIN_CHECK_POSSIBLE_VISUAL_STUDIO_ROOT([$PROGRAMFILES/Microsoft Visual Studio 10.0], [well-known name])
-  fi
-  TOOLCHAIN_CHECK_POSSIBLE_VISUAL_STUDIO_ROOT([C:/Program Files/Microsoft Visual Studio 10.0], [well-known name])
-  TOOLCHAIN_CHECK_POSSIBLE_VISUAL_STUDIO_ROOT([C:/Program Files (x86)/Microsoft Visual Studio 10.0], [well-known name])
 ])
 
 # Check if the VS env variables were setup prior to running configure.
@@ -248,10 +248,23 @@
         AC_MSG_NOTICE([Warning: msvcr100.dll not found in VCINSTALLDIR: $VCINSTALLDIR])
       fi
     fi
+    # Try some fallback alternatives
     if test "x$MSVCR_DLL" = x; then
-      if test -f "$SYSTEMROOT/system32/msvcr100.dll"; then
-        AC_MSG_NOTICE([msvcr100.dll found in $SYSTEMROOT/system32])
-        MSVCR_DLL="$SYSTEMROOT/system32/msvcr100.dll"
+      # If visual studio express is installed, there is usually one with the debugger
+      if test "x$VS100COMNTOOLS" != x; then
+        if test "x$OPENJDK_TARGET_CPU_BITS" = x64; then
+          MSVCR_DLL=`find "$VS100COMNTOOLS/.." -name msvcr100.dll | grep -i x64 | head --lines 1`
+          AC_MSG_NOTICE([msvcr100.dll found in $VS100COMNTOOLS..: $VS100COMNTOOLS..])
+        fi
+      fi
+    fi
+    if test "x$MSVCR_DLL" = x; then
+      if test "x$OPENJDK_TARGET_CPU_BITS" = x32; then
+        # Fallback for 32bit builds, look in the windows directory.
+        if test -f "$SYSTEMROOT/system32/msvcr100.dll"; then
+          AC_MSG_NOTICE([msvcr100.dll found in $SYSTEMROOT/system32])
+          MSVCR_DLL="$SYSTEMROOT/system32/msvcr100.dll"
+        fi
       fi
     fi
   fi
--- a/common/makefiles/JavaCompilation.gmk	Wed Jun 05 13:08:59 2013 -0300
+++ b/common/makefiles/JavaCompilation.gmk	Tue Jul 16 09:08:46 2013 -0300
@@ -155,7 +155,7 @@
         # lines, but not here for use in make dependencies.
         $1_DEPS+=$$(subst \,,$$(foreach src,$$($1_SRCS),$$(addprefix $$(src)/,$$($1_EXTRA_FILES))))
         ifeq (,$$($1_SKIP_METAINF))
-            $1_DEPS+=$$(call CacheFind $$(wildcard $$(addsuffix /META-INF,$$($1_SRCS))))
+            $1_DEPS+=$$(call CacheFind,$$(wildcard $$(addsuffix /META-INF,$$($1_SRCS))))
         endif
     endif
 
@@ -255,12 +255,21 @@
     $(call LogSetupMacroEntry,SetupZipArchive($1),$2,$3,$4,$5,$6,$7,$8,$9,$(10),$(11),$(12),$(13),$(14),$(15))
     $(if $(16),$(error Internal makefile error: Too many arguments to SetupZipArchive, please update JavaCompilation.gmk))
 
+    # To avoid running find over too large sets of files, which causes make to crash
+    # on some configurations (cygwin), use INCLUDES and INCLUDE_FILES to build a set
+    # of directories to run find in, if available.
+    ifneq ($$($1_INCLUDES)$$($1_INCLUDE_FILES),)
+	$1_FIND_LIST := $$(wildcard $$(foreach i,$$($1_SRC),\
+		$$(addprefix $$i/,$$($1_INCLUDES) $$($1_INCLUDE_FILES))))
+    else
+        $1_FIND_LIST := $$($1_SRC)
+    endif
+
     # Find all files in the source tree.
     $1_ALL_SRCS := $$(call not-containing,_the.,\
-            $$(filter $$(addprefix %,$$($1_SUFFIXES)),$$(call CacheFind $$($1_SRC))))
+            $$(filter $$(addprefix %,$$($1_SUFFIXES)),$$(call CacheFind,$$($1_FIND_LIST))))
 
     ifneq ($$($1_INCLUDES),)
-        $1_SRC_INCLUDES := $$(foreach i,$$($1_SRC),$$(addprefix $$i/,$$(addsuffix /%,$$($1_INCLUDES))))
         ifneq ($$($1_SUFFIXES),)
             $1_ZIP_INCLUDES := $$(foreach s,$$($1_SUFFIXES),\
 		$$(addprefix -i$(SPACE)$(DQUOTE),$$(addsuffix /*$$s$(DQUOTE),$$($1_INCLUDES))))
@@ -269,12 +278,8 @@
         endif
     endif
     ifneq ($$($1_INCLUDE_FILES),)
-        $1_SRC_INCLUDES += $$(foreach i,$$($1_SRC),$$(addprefix $$i/,$$($1_INCLUDE_FILES)))
         $1_ZIP_INCLUDES += $$(addprefix -i$(SPACE),$$($1_INCLUDE_FILES))
     endif
-    ifneq ($$($1_SRC_INCLUDES),)
-        $1_ALL_SRCS     := $$(filter $$($1_SRC_INCLUDES),$$($1_ALL_SRCS))
-    endif
     ifneq ($$($1_EXCLUDES),)
         $1_SRC_EXCLUDES := $$(foreach i,$$($1_SRC),$$(addprefix $$i/,$$(addsuffix /%,$$($1_EXCLUDES))))
         $1_ZIP_EXCLUDES := $$(addprefix -x$(SPACE)$(DQUOTE),$$(addsuffix /*$(DQUOTE),$$($1_EXCLUDES)))
--- a/common/makefiles/Jprt.gmk	Wed Jun 05 13:08:59 2013 -0300
+++ b/common/makefiles/Jprt.gmk	Tue Jul 16 09:08:46 2013 -0300
@@ -133,6 +133,15 @@
   ifdef ALT_WIXDIR
 	@$(ECHO) " --with-wix=$(call UnixPath,$(ALT_WIXDIR)) " >> $@.tmp
   endif
+  ifdef ALT_INSTALL_LZMA_PATH
+	@$(ECHO) " --with-lzma-path=$(call UnixPath,$(ALT_INSTALL_LZMA_PATH)) " >> $@.tmp
+  endif
+  ifdef ALT_INSTALL_UPX_PATH
+	@$(ECHO) " --with-upx-path=$(call UnixPath,$(ALT_INSTALL_UPX_PATH)) " >> $@.tmp
+  endif
+  ifdef ALT_INSTALL_UPX_FILENAME
+	@$(ECHO) " --with-upx-filename=$(call UnixPath,$(ALT_INSTALL_UPX_FILENAME)) " >> $@.tmp
+  endif
   ifdef ALT_CCSS_SIGNING_DIR
 	@$(ECHO) " --with-ccss-signing=$(call UnixPath,$(ALT_CCSS_SIGNING_DIR)) " >> $@.tmp
   endif
--- a/common/makefiles/Main.gmk	Wed Jun 05 13:08:59 2013 -0300
+++ b/common/makefiles/Main.gmk	Tue Jul 16 09:08:46 2013 -0300
@@ -183,7 +183,7 @@
 test: images test-only
 test-only: start-make
 	@$(call TargetEnter)
-	@($(CD) $(SRC_ROOT)/test && $(BUILD_LOG_WRAPPER) $(MAKE) -j1 -k MAKEFLAGS= PRODUCT_HOME=$(JDK_IMAGE_DIR) JPRT_JAVA_HOME=$(JDK_IMAGE_DIR) ALT_OUTPUTDIR=$(OUTPUT_ROOT) $(TEST)) || true
+	@($(CD) $(SRC_ROOT)/test && $(BUILD_LOG_WRAPPER) $(MAKE) -j1 -k MAKEFLAGS= JT_HOME=$(JT_HOME) PRODUCT_HOME=$(JDK_IMAGE_DIR) JPRT_JAVA_HOME=$(JDK_IMAGE_DIR) ALT_OUTPUTDIR=$(OUTPUT_ROOT) CONCURRENCY=$(JOBS) $(TEST)) || true
 	@$(call TargetExit)
 
 # Stores the tips for each repository. This file is be used when constructing the jdk image and can be
@@ -192,7 +192,7 @@
 $(OUTPUT_ROOT)/source_tips: FRC
 	@$(MKDIR) -p $(@D)
 	@$(RM) $@
-	@$(if $(HG),$(call GetSourceTips),$(ECHO) "hg not installed" > $@)
+	@$(call GetSourceTips)
 
 
 # Remove everything, except the output from configure.
--- a/common/makefiles/MakeBase.gmk	Wed Jun 05 13:08:59 2013 -0300
+++ b/common/makefiles/MakeBase.gmk	Tue Jul 16 09:08:46 2013 -0300
@@ -332,9 +332,11 @@
         # Shell redefinition trick inspired by http://www.cmcrossroads.com/ask-mr-make/6535-tracing-rule-execution-in-gnu-make
         # For each target executed, will print
         # Building <TARGET> (from <FIRST PREREQUISITE>) (<ALL NEWER PREREQUISITES> newer)
-        # but with a limit of 20 on <ALL NEWER PREREQUISITES>, to avoid cluttering logs too much (and causing a crash on Cygwin).
-        OLD_SHELL:=$$(SHELL)
-        WRAPPER_SHELL:=$$(OLD_SHELL) $$(SRC_ROOT)/common/bin/shell-tracer.sh $$(if $$(TIME),$$(TIME),-) $$(OUTPUT_ROOT)/build-trace-time.log $$(OLD_SHELL)
+        # but with a limit of 20 on <ALL NEWER PREREQUISITES>, to avoid cluttering logs too much 
+        # (and causing a crash on Cygwin).
+        # Default shell seems to always be /bin/sh. Must override with bash to get this to work on Solaris.
+        # Only use time if it's GNU time which supports format and output file.
+        WRAPPER_SHELL:=/bin/bash $$(SRC_ROOT)/common/bin/shell-tracer.sh $$(if $$(findstring yes,$$(IS_GNU_TIME)),$$(TIME),-) $$(OUTPUT_ROOT)/build-trace-time.log /bin/bash
         SHELL=$$(warning $$(if $$@,Building $$@,Running shell command) $$(if $$<, (from $$<))$$(if $$?, ($$(wordlist 1, 20, $$?) $$(if $$(wordlist 21, 22, $$?), ... [in total $$(words $$?) files]) newer)))$$(WRAPPER_SHELL)
     endif
     # Never remove warning messages; this is just for completeness
@@ -361,8 +363,8 @@
 
 # This is to be called by all SetupFoo macros
 define LogSetupMacroEntry
-    $(if $(26),$(error Internal makefile error: Too many arguments to LogSetupMacroEntry, please update MakeBase.gmk))
-    $(if $(findstring $(LOG_LEVEL),debug trace), $(info $1 $(foreach i,2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25,$(if $($i),$(NEWLINE) $(strip [$i] $($i))))))
+    $(if $(27),$(error Internal makefile error: Too many arguments to LogSetupMacroEntry, please update MakeBase.gmk))
+    $(if $(findstring $(LOG_LEVEL),debug trace), $(info $1 $(foreach i,2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26,$(if $($i),$(NEWLINE) $(strip [$i] $($i))))))
 endef
 
 # Make directory without forking mkdir if not needed
--- a/common/makefiles/NativeCompilation.gmk	Wed Jun 05 13:08:59 2013 -0300
+++ b/common/makefiles/NativeCompilation.gmk	Tue Jul 16 09:08:46 2013 -0300
@@ -108,7 +108,11 @@
         # setting -showIncludes, all included files are printed. These are filtered out and 
         # parsed into make dependences.
         ifeq ($(COMPILER_TYPE),CL)
-		$$($1_$2_COMP) $$($1_$2_FLAGS) -showIncludes $$($1_$2_DEBUG_OUT_FLAGS) $(CC_OUT_OPTION)$$($1_$2_OBJ) $2 | $(TEE) $$($1_$2_DEP).raw | $(GREP) -v "^Note: including file:"
+		($$($1_$2_COMP) $$($1_$2_FLAGS) -showIncludes $$($1_$2_DEBUG_OUT_FLAGS) \
+			$(CC_OUT_OPTION)$$($1_$2_OBJ) $2 ; echo $$$$? > $$($1_$2_DEP).exitvalue) \
+			| $(TEE) $$($1_$2_DEP).raw | $(GREP) -v "^Note: including file:" \
+			&& exit `cat $$($1_$2_DEP).exitvalue`
+		$(RM) $$($1_$2_DEP).exitvalue
 		($(ECHO) $$@: \\ \
 		 && $(SED) -e '/^Note: including file:/!d' \
 			-e 's|Note: including file: *||' \
@@ -147,9 +151,9 @@
     #    CC the compiler to use, default is $(CC)
     #    LDEXE the linker to use for linking executables, default is $(LDEXE)
     #    OPTIMIZATION sets optimization level to NONE, LOW, HIGH, HIGHEST
-    $(foreach i,2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25, $(if $($i),$1_$(strip $($i)))$(NEWLINE))
-    $(call LogSetupMacroEntry,SetupNativeCompilation($1),$2,$3,$4,$5,$6,$7,$8,$9,$(10),$(11),$(12),$(13),$(14),$(15),$(16),$(17),$(18),$(19),$(20),$(21),$(22),$(23),$(24),$(25))
-    $(if $(26),$(error Internal makefile error: Too many arguments to SetupNativeCompilation, please update NativeCompilation.gmk))
+    $(foreach i,2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26, $(if $($i),$1_$(strip $($i)))$(NEWLINE))
+    $(call LogSetupMacroEntry,SetupNativeCompilation($1),$2,$3,$4,$5,$6,$7,$8,$9,$(10),$(11),$(12),$(13),$(14),$(15),$(16),$(17),$(18),$(19),$(20),$(21),$(22),$(23),$(24),$(25),$(26))
+    $(if $(27),$(error Internal makefile error: Too many arguments to SetupNativeCompilation, please update NativeCompilation.gmk))
 
     ifneq (,$$($1_BIN))
         $$(error BIN has been replaced with OBJECT_DIR)
@@ -567,6 +571,12 @@
         ifneq (,$$($1_GEN_MANIFEST))
 		$(MT) -nologo -manifest $$($1_GEN_MANIFEST) -outputresource:$$@;#1
         endif
-
+        # This only works if the openjdk_codesign identity is present on the system. Let
+        # silently fail otherwise.
+        ifneq (,$(CODESIGN))
+            ifneq (,$$($1_CODESIGN))
+		$(CODESIGN) -s openjdk_codesign $$@
+            endif
+        endif
     endif
 endef
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/common/makefiles/devkit/Makefile	Tue Jul 16 09:08:46 2013 -0300
@@ -0,0 +1,123 @@
+#
+# Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# This code is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation.  Oracle designates this
+# particular file as subject to the "Classpath" exception as provided
+# by Oracle in the LICENSE file that accompanied this code.
+#
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+#
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+
+##########################################################################################
+#
+# This Makefile, together with Tools.gmk, can be used to compile a set of 
+# gcc based cross compilation, portable, self contained packages, capable 
+# of building OpenJDK.
+# 
+# In addition to the makefiles, access to Oracle Linux installation 
+# media is required. This has been tested against Oracle Enterprise Linux 
+# 5.5. Set variables RPM_DIR_x86_64 and RPM_DIR_i686 respectively to point
+# to directory containing the RPMs.
+#
+# By default this Makefile will build crosstools for:
+# * i686-unknown-linux-gnu
+# * x86_64-unknown-linux-gnu
+# The x86_64 version of the compilers will work in multi arch mode and will
+# be able to compile 32bit binaries with the -m32 flag. This makes the
+# explicit cross compiler for i686 somewhat redundant and is a known issue.
+#
+# To build the full set of crosstools, use a command line looking like this:
+#
+# make tars  RPM_DIR_x86_64=/tmp/oel55-x86_64/Server/ RPM_DIR_i686=/tmp/oel55-i686/Server/
+#
+# To create a x86_64 package without the redundant i686 cross compiler, do 
+# like this:
+#
+# make tars platforms=x86_64-unknown-linux-gnu RPM_DIR_x86_64=/tmp/oel55-x86_64/Server/ RPM_DIR_i686=/tmp/oel55-i686/Server/
+
+#
+# Main makefile which iterates over all host and target platforms.
+#
+
+os		:= $(shell uname -o)
+cpu 		:= x86_64
+#$(shell uname -p)
+
+#
+# This wrapper script can handle exactly these platforms
+#
+platforms	:= $(foreach p,x86_64 i686,$(p)-unknown-linux-gnu)
+#platforms	:= $(foreach p,x86_64,$(p)-unknown-linux-gnu)
+
+# Figure out what platform this is building on.
+me		:= $(cpu)-$(if $(findstring Linux,$(os)),unknown-linux-gnu)
+
+$(info Building on platform $(me))
+
+all compile	: $(platforms)
+
+ifeq (,$(SKIP_ME))
+$(foreach p,$(filter-out $(me),$(platforms)),$(eval $(p) : $$(me)))
+endif
+
+OUTPUT_ROOT	= $(abspath ../../../build/devkit)
+RESULT		= $(OUTPUT_ROOT)/result
+
+submakevars	= HOST=$@ BUILD=$(me)				\
+			RESULT=$(RESULT) PREFIX=$(RESULT)/$@    \
+			OUTPUT_ROOT=$(OUTPUT_ROOT)
+$(platforms)	:
+		@echo 'Building compilers for $@'
+		@echo 'Targets: $(platforms)'
+		for p in $@ $(filter-out $@,$(platforms)); do	\
+			$(MAKE) -f Tools.gmk all $(submakevars)	\
+				TARGET=$$p || exit 1	;	\
+		done
+		@echo 'Building ccache program for $@'
+		$(MAKE) -f Tools.gmk ccache $(submakevars) TARGET=$@
+		@echo 'All done"'
+
+$(foreach a,i686 x86_64,$(eval $(a) : $(filter $(a)%,$(platforms))))
+
+ia32		:  i686
+today		:= $(shell date +%Y%m%d)
+
+
+define Mktar
+$(1)_tar	= $$(RESULT)/sdk-$(1)-$$(today).tar.gz
+$$($(1)_tar)	: PLATFORM = $(1)
+TARFILES	+= $$($(1)_tar)
+$$($(1)_tar)	: $(1) $$(shell find $$(RESULT)/$(1))
+endef
+
+$(foreach p,$(platforms),$(eval $(call Mktar,$(p))))
+
+tars		: all $(TARFILES)
+onlytars	: $(TARFILES)
+%.tar.gz	:
+		@echo 'Creating compiler package $@'
+		cd $(RESULT)/$(PLATFORM) && tar -czf $@ *
+		touch $@
+
+clean		:
+	rm -rf build result
+
+FORCE		:
+.PHONY		: $(configs) $(platforms)
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/common/makefiles/devkit/Tools.gmk	Tue Jul 16 09:08:46 2013 -0300
@@ -0,0 +1,473 @@
+#
+# Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# This code is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation.  Oracle designates this
+# particular file as subject to the "Classpath" exception as provided
+# by Oracle in the LICENSE file that accompanied this code.
+#
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+#
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+
+##########################################################################################
+#
+# Workhorse makefile for creating ONE cross compiler
+# Needs either to be from BUILD -> BUILD OR have 
+# BUILD -> HOST prebuilt
+#
+# NOTE: There is a bug here. We don't limit the 
+# PATH when building BUILD -> BUILD, which means that 
+# if you configure after you've once build the BUILD->BUILD
+# compiler THAT one will be picked up as the compiler for itself.
+# This is not so great, especially if you did a partial delete
+# of the target tree. 
+#
+# Fix this...
+#
+
+$(info TARGET=$(TARGET))
+$(info HOST=$(HOST))
+$(info BUILD=$(BUILD))
+
+ARCH		:= $(word 1,$(subst -, ,$(TARGET)))
+
+##########################################################################################
+# Define external dependencies
+
+# Latest that could be made to work.
+gcc_ver		:= gcc-4.7.3
+binutils_ver	:= binutils-2.22
+ccache_ver	:= ccache-3.1.9
+mpfr_ver        := mpfr-3.0.1
+gmp_ver         := gmp-4.3.2
+mpc_ver		:= mpc-1.0.1
+
+GCC		:= http://ftp.gnu.org/pub/gnu/gcc/$(gcc_ver)/$(gcc_ver).tar.bz2
+BINUTILS	:= http://ftp.gnu.org/pub/gnu/binutils/$(binutils_ver).tar.bz2
+CCACHE		:= http://samba.org/ftp/ccache/$(ccache_ver).tar.gz
+MPFR		:= http://www.mpfr.org/${mpfr_ver}/${mpfr_ver}.tar.bz2
+GMP 		:= http://ftp.gnu.org/pub/gnu/gmp/${gmp_ver}.tar.bz2
+MPC		:= http://www.multiprecision.org/mpc/download/${mpc_ver}.tar.gz
+
+# RPMs in OEL5.5
+RPM_LIST 	:= \
+		kernel-headers \
+		glibc-2 glibc-headers glibc-devel \
+		cups-libs cups-devel \
+		libX11 libX11-devel \
+		xorg-x11-proto-devel \
+		alsa-lib alsa-lib-devel \
+		libXext libXext-devel \
+		libXtst libXtst-devel \
+		libXrender libXrender-devel \
+		freetype freetype-devel \
+		libXt libXt-devel \
+		libSM libSM-devel \
+		libICE libICE-devel \
+		libXi libXi-devel \
+		libXdmcp libXdmcp-devel \
+		libXau libXau-devel \
+		libgcc
+
+
+ifeq ($(ARCH),x86_64)
+  RPM_DIR ?= $(RPM_DIR_x86_64)
+  RPM_ARCHS := x86_64
+  ifeq ($(BUILD),$(HOST))
+    ifeq ($(TARGET),$(HOST))
+      # When building the native compiler for x86_64, enable mixed mode.
+      RPM_ARCHS	+= i386 i686
+    endif
+  endif
+else
+  RPM_DIR ?= $(RPM_DIR_i686)
+  RPM_ARCHS := i386 i686
+endif
+
+# Sort to remove duplicates
+RPM_FILE_LIST := $(sort $(foreach a,$(RPM_ARCHS),$(wildcard $(patsubst %,$(RPM_DIR)/%*$a.rpm,$(RPM_LIST)))))
+
+ifeq ($(RPM_FILE_LIST),)
+  $(error Found no RPMs, RPM_DIR must point to list of directories to search for RPMs)
+endif
+
+##########################################################################################
+# Define common directories and files
+
+# Ensure we have 32-bit libs also for x64. We enable mixed-mode.
+ifeq (x86_64,$(ARCH))
+  LIBDIRS	:= lib64 lib
+  CFLAGS_lib	:= -m32
+else
+  LIBDIRS 	:= lib
+endif
+
+# Define directories
+RESULT		:= $(OUTPUT_ROOT)/result
+BUILDDIR	:= $(OUTPUT_ROOT)/$(HOST)/$(TARGET)
+PREFIX		:= $(RESULT)/$(HOST)
+TARGETDIR	:= $(PREFIX)/$(TARGET)
+SYSROOT		:= $(TARGETDIR)/sys-root
+DOWNLOAD	:= $(OUTPUT_ROOT)/download
+SRCDIR		:= $(OUTPUT_ROOT)/src
+
+# Marker file for unpacking rpms
+rpms		:= $(SYSROOT)/rpms_unpacked
+
+# Need to patch libs that are linker scripts to use non-absolute paths 
+libs		:= $(SYSROOT)/libs_patched
+
+##########################################################################################
+# Unpack source packages
+
+# Generate downloading + unpacking of sources. 
+define Download
+$(1)_DIR	= $(abspath $(SRCDIR)/$(basename $(basename $(notdir $($(1))))))
+$(1)_CFG	= $$($(1)_DIR)/configure
+$(1)_FILE	= $(DOWNLOAD)/$(notdir $($(1)))
+
+$$($(1)_CFG)	: $$($(1)_FILE)
+		mkdir -p $$(SRCDIR)
+		tar -C $$(SRCDIR) -x$$(if $$(findstring .gz, $$<),z,j)f $$<
+		$$(foreach p,$$(abspath $$(wildcard $$(notdir $$($(1)_DIR)).patch)),	\
+			echo PATCHING $$(p) ;						\
+			patch -d $$($(1)_DIR) -p1 -i $$(p) ; 				\
+			)
+		touch $$@
+
+$$($(1)_FILE)	:
+		wget -P $(DOWNLOAD) $$($(1))
+endef
+
+# Download and unpack all source packages
+$(foreach p,GCC BINUTILS CCACHE MPFR GMP MPC,$(eval $(call Download,$(p))))
+
+##########################################################################################
+# Unpack RPMS
+
+# Note. For building linux you should install rpm2cpio. 
+define unrpm
+$(SYSROOT)/$(notdir $(1)).unpacked	\
+		: $(1)
+$$(rpms)	: $(SYSROOT)/$(notdir $(1)).unpacked
+endef
+
+%.unpacked	:
+		$(info Unpacking target rpms and libraries from $<)
+		@(mkdir -p $(@D);					\
+		cd $(@D);						\
+		rpm2cpio $< | 						\
+			cpio --extract --make-directories 		\
+				-f 					\
+				"./usr/share/doc/*" 			\
+				"./usr/share/man/*"			\
+				"./usr/X11R6/man/*" 			\
+				"*/X11/locale/*"			\
+				|| die ; )
+		touch $@
+
+$(foreach p,$(RPM_FILE_LIST),$(eval $(call unrpm,$(p))))
+
+##########################################################################################
+
+# Note: MUST create a <sys-root>/usr/lib even if not really needed. 
+# gcc will use a path relative to it to resolve lib64. (x86_64). 
+# we're creating multi-lib compiler with 32bit libc as well, so we should 
+# have it anyway, but just to make sure...
+# Patch libc.so and libpthread.so to force linking against libraries in sysroot
+# and not the ones installed on the build machine.
+$(libs)		: $(rpms)
+		@echo Patching libc and pthreads
+		@(for f in `find $(SYSROOT) -name libc.so -o -name libpthread.so`; do \
+			(cat $$f | sed -e 's|/usr/lib64/||g' 		\
+				       -e 's|/usr/lib/||g'		\
+				       -e 's|/lib64/||g'		\
+				       -e 's|/lib/||g' ) > $$f.tmp ;	\
+			mv $$f.tmp $$f				;	\
+		done)
+		@mkdir -p $(SYSROOT)/usr/lib
+		@touch $@
+
+##########################################################################################
+
+# Define marker files for each source package to be compiled
+$(foreach t,binutils mpfr gmp mpc gcc ccache,$(eval $(t) = $(TARGETDIR)/$($(t)_ver).done))
+
+##########################################################################################
+
+# Default base config
+CONFIG		= --target=$(TARGET) 					\
+			--host=$(HOST) --build=$(BUILD)			\
+			--prefix=$(PREFIX)
+
+PATHEXT 	= $(RESULT)/$(BUILD)/bin:
+
+PATHPRE		= PATH=$(PATHEXT)$(PATH)
+BUILDPAR	= -j16
+
+# Default commands to when making
+MAKECMD		=
+INSTALLCMD	= install
+
+
+declare_tools   = CC$(1)=$(2)gcc LD$(1)=$(2)ld AR$(1)=$(2)ar AS$(1)=$(2)as RANLIB$(1)=$(2)ranlib CXX$(1)=$(2)g++ OBJDUMP$(1)=$(2)objdump
+
+ifeq ($(HOST),$(BUILD))
+ifeq ($(HOST),$(TARGET))
+TOOLS		= $(call declare_tools,_FOR_TARGET,)
+endif
+endif
+
+TOOLS		?=  $(call declare_tools,_FOR_TARGET,$(TARGET)-)
+
+##########################################################################################
+
+# Create a TARGET bfd + libiberty only. 
+# Configure one or two times depending on mulitlib arch.
+# If multilib, the second should be 32-bit, and we resolve 
+# CFLAG_<name> to most likely -m32.
+define mk_bfd
+$$(info Libs for $(1)) 
+$$(BUILDDIR)/$$(binutils_ver)-$(subst /,-,$(1))/Makefile \
+		: CFLAGS += $$(CFLAGS_$(1))
+$$(BUILDDIR)/$$(binutils_ver)-$(subst /,-,$(1))/Makefile \
+		: LIBDIRS = --libdir=$(TARGETDIR)/$(1)
+
+bfdlib		+= $$(TARGETDIR)/$$(binutils_ver)-$(subst /,-,$(1)).done
+bfdmakes	+= $$(BUILDDIR)/$$(binutils_ver)-$(subst /,-,$(1))/Makefile
+endef
+
+# Create one set of bfds etc for each multilib arch
+$(foreach l,$(LIBDIRS),$(eval $(call mk_bfd,$(l))))
+
+# Only build these two libs.
+$(bfdlib)	: MAKECMD 	= all-libiberty all-bfd
+$(bfdlib)	: INSTALLCMD 	= install-libiberty install-bfd
+
+# Building targets libbfd + libiberty. HOST==TARGET, i.e not 
+# for a cross env. 
+$(bfdmakes)	: CONFIG = --target=$(TARGET) 				\
+			--host=$(TARGET) --build=$(BUILD)		\
+			--prefix=$(TARGETDIR) 				\
+			--with-sysroot=$(SYSROOT) 			\
+			$(LIBDIRS)
+
+$(bfdmakes)	: TOOLS = $(call declare_tools,_FOR_TARGET,$(TARGET)-) $(call declare_tools,,$(TARGET)-)
+
+##########################################################################################
+
+$(gcc)		\
+$(binutils)	\
+$(gmp)		\
+$(mpfr)		\
+$(mpc)		\
+$(bfdmakes)	\
+$(ccache)	: ENVS += $(TOOLS)
+
+# libdir to work around hateful bfd stuff installing into wrong dirs...
+# ensure we have 64 bit bfd support in the HOST library. I.e our 
+# compiler on i686 will know 64 bit symbols, BUT later
+# we build just the libs again for TARGET, then with whatever the arch 
+# wants.
+$(BUILDDIR)/$(binutils_ver)/Makefile : CONFIG += --enable-64-bit-bfd --libdir=$(PREFIX)/$(word 1,$(LIBDIRS))
+
+# Makefile creation. Simply run configure in build dir.
+$(bfdmakes)				\
+$(BUILDDIR)/$(binutils_ver)/Makefile	\
+		: $(BINUTILS_CFG)
+		$(info Configuring $@. Log in $(@D)/log.config)
+		@mkdir -p $(@D)
+		(						\
+			cd $(@D) ;				\
+			$(PATHPRE) $(ENVS) CFLAGS="$(CFLAGS)"	\
+				$(BINUTILS_CFG) 		\
+				$(CONFIG) 			\
+				--with-sysroot=$(SYSROOT)	\
+				--disable-nls			\
+				--program-prefix=$(TARGET)-	\
+				--enable-multilib		\
+		) > $(@D)/log.config 2>&1
+		@echo 'done'
+
+$(BUILDDIR)/$(mpfr_ver)/Makefile	\
+		: $(MPFR_CFG)
+		$(info Configuring $@. Log in $(@D)/log.config)
+		@mkdir -p $(@D)
+		(						\
+			cd $(@D) ;				\
+			$(PATHPRE) $(ENVS) CFLAGS="$(CFLAGS)"	\
+				$(MPFR_CFG) 			\
+				$(CONFIG) 			\
+				--program-prefix=$(TARGET)-	\
+				--enable-shared=no		\
+				--with-gmp=$(PREFIX)	\
+		) > $(@D)/log.config 2>&1
+		@echo 'done'
+
+$(BUILDDIR)/$(gmp_ver)/Makefile	\
+		: $(GMP_CFG)
+		$(info Configuring $@. Log in $(@D)/log.config)
+		@mkdir -p $(@D)
+		(						\
+			cd $(@D) ;				\
+			$(PATHPRE) $(ENVS) CFLAGS="$(CFLAGS)"	\
+				$(GMP_CFG) 			\
+				--host=$(HOST) --build=$(BUILD)	\
+				--prefix=$(PREFIX)		\
+				--disable-nls			\
+				--program-prefix=$(TARGET)-	\
+				--enable-shared=no		\
+				--with-mpfr=$(PREFIX)	\
+		) > $(@D)/log.config 2>&1
+		@echo 'done'
+
+$(BUILDDIR)/$(mpc_ver)/Makefile	\
+		: $(MPC_CFG)
+		$(info Configuring $@. Log in $(@D)/log.config)
+		@mkdir -p $(@D)
+		(						\
+			cd $(@D) ;				\
+			$(PATHPRE) $(ENVS) CFLAGS="$(CFLAGS)"	\
+				$(MPC_CFG) 			\
+				$(CONFIG) 			\
+				--program-prefix=$(TARGET)-	\
+				--enable-shared=no		\
+				--with-mpfr=$(PREFIX)	\
+				--with-gmp=$(PREFIX)	\
+		) > $(@D)/log.config 2>&1
+		@echo 'done'
+
+# Only valid if glibc target -> linux
+# proper destructor handling for c++
+ifneq (,$(findstring linux,$(TARGET)))
+$(BUILDDIR)/$(gcc_ver)/Makefile : CONFIG += --enable-__cxa_atexit 
+endif
+
+# Want:
+# 	c,c++
+# 	shared libs
+#	multilib (-m32/-m64 on x64)
+# 	skip native language. 
+#	and link and assemble with the binutils we created 
+#	earlier, so --with-gnu*
+$(BUILDDIR)/$(gcc_ver)/Makefile	\
+		: $(GCC_CFG) 
+		$(info Configuring $@. Log in $(@D)/log.config)
+		mkdir -p $(@D)
+		(						\
+			cd $(@D) ;				\
+			$(PATHPRE) $(ENVS) $(GCC_CFG) $(EXTRA_CFLAGS) \
+				$(CONFIG) 			\
+				--with-sysroot=$(SYSROOT)	\
+				--enable-languages=c,c++ 	\
+				--enable-shared			\
+				--enable-multilib		\
+				--disable-nls			\
+				--with-gnu-as 			\
+				--with-gnu-ld			\
+				--with-mpfr=$(PREFIX)		\
+				--with-gmp=$(PREFIX)		\
+				--with-mpc=$(PREFIX)		\
+		) > $(@D)/log.config 2>&1
+		@echo 'done'
+
+# need binutils for gcc
+$(gcc)		: $(binutils) 
+
+# as of 4.3 or so need these for doing config
+$(BUILDDIR)/$(gcc_ver)/Makefile : $(gmp) $(mpfr) $(mpc)
+$(mpfr)		: $(gmp)
+$(mpc)		: $(gmp) $(mpfr)
+
+##########################################################################################
+# very straightforward. just build a ccache. it is only for host. 
+$(BUILDDIR)/$(ccache_ver)/Makefile	\
+		: $(CCACHE_CFG)
+		$(info Configuring $@. Log in $(@D)/log.config)
+		@mkdir -p $(@D)
+		@(						\
+			cd $(@D) ;				\
+			$(PATHPRE) $(ENVS) $(CCACHE_CFG)	\
+				$(CONFIG) 			\
+		) > $(@D)/log.config 2>&1
+		@echo 'done'
+
+gccpatch	= $(TARGETDIR)/gcc-patched
+
+##########################################################################################
+# For some reason cpp is not created as a target-compiler 
+ifeq ($(HOST),$(TARGET))
+$(gccpatch)	: $(gcc) link_libs
+		@echo -n 'Creating compiler symlinks...'
+		@for f in cpp; do 				\
+			if [ ! -e $(PREFIX)/bin/$(TARGET)-$$f ];\
+			then					\
+			cd $(PREFIX)/bin && 			\
+				ln -s $$f $(TARGET)-$$f ;	\
+			fi					\
+		done
+		@touch $@
+		@echo 'done'
+
+##########################################################################################
+# Ugly at best. Seems that when we compile host->host compiler, that are NOT
+# the BUILD compiler, the result will not try searching for libs in package root.
+# "Solve" this by create links from the target libdirs to where they are. 
+link_libs:
+		@echo -n 'Creating library symlinks...'
+		@$(foreach l,$(LIBDIRS),							\
+		for f in `cd $(PREFIX)/$(l) && ls`; do 						\
+			if [ ! -e $(TARGETDIR)/$(l)/$$f ]; then					\
+				mkdir -p $(TARGETDIR)/$(l) &&					\
+				cd $(TARGETDIR)/$(l)/ && 					\
+				ln -s $(if $(findstring /,$(l)),../,)../../$(l)/$$f $$f;	\
+			fi									\
+		done;) 
+		@echo 'done'
+else
+$(gccpatch)	:
+		@echo 'done'
+endif
+
+##########################################################################################
+# Build in two steps. 
+# make <default>
+# make install. 
+# Use path to our build hosts cross tools
+# Always need to build cross tools for build host self. 
+$(TARGETDIR)/%.done : $(BUILDDIR)/%/Makefile 
+		$(info Building $(basename $@). Log in $(<D)/log.build)
+		$(PATHPRE) $(ENVS) $(MAKE) $(BUILDPAR) -f $< -C $(<D) $(MAKECMD) $(MAKECMD.$(notdir $@)) > $(<D)/log.build 2>&1
+		@echo -n 'installing...'
+		$(PATHPRE) $(MAKE) $(INSTALLPAR) -f $< -C $(<D) $(INSTALLCMD) $(MAKECMD.$(notdir $@))  > $(<D)/log.install 2>&1
+		@touch $@
+		@echo 'done'
+
+##########################################################################################
+
+bfdlib		: $(bfdlib)
+binutils	: $(binutils)
+rpms		: $(rpms)
+libs		: $(libs)
+sysroot		: rpms libs
+gcc		: sysroot $(gcc) $(gccpatch)
+all		: binutils gcc bfdlib
+
+# this is only built for host. so separate. 
+ccache		: $(ccache)
+
+.PHONY		: gcc all binutils bfdlib link_libs rpms libs sysroot
--- a/make/deploy-rules.gmk	Wed Jun 05 13:08:59 2013 -0300
+++ b/make/deploy-rules.gmk	Tue Jul 16 09:08:46 2013 -0300
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2002, 2011, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -42,20 +42,6 @@
 endif
 
 DEPLOY_BUILD_TARGETS = sanity deploy 
-# Only build 7-Zip LZMA file compression if it is available
-# Enable 7-Zip LZMA file (de)compression for Java Kernel if it is available
-ifeq ($(ARCH_DATA_MODEL), 32)
-  ifeq ($(PLATFORM), windows)
-      EC_TMP = $(shell if [ -d $(DEPLOY_TOPDIR)/make/lzma ] ; then \
-        $(ECHO) true ; \
-      else \
-  $(ECHO) false ; \
-      fi )
-  ifeq ($(EC_TMP), true)
-        DEPLOY_BUILD_TARGETS += extra-comp-all
-      endif
-  endif
-endif
 
 ifneq ($(JQS), off)
   ifeq ($(ARCH_DATA_MODEL), 32)
@@ -65,22 +51,6 @@
   endif
 endif
 
-ifeq ($(ARCH_DATA_MODEL), 32)
-  ifeq ($(PLATFORM), windows)
-    # Only set up to use UPX compression if it is available
-    UP_TMP = $(shell if [ -d $(DEPLOY_TOPDIR)/make/upx ] ; then \
-      $(ECHO) true ; \
-    else \
-      $(ECHO) false ; \
-    fi )
-    ifeq ($(UP_TMP), true)
-      DEPLOY_BUILD_TARGETS += cmd-comp-all
-    endif
-  endif
-endif
-
-
-
 ifndef DEV_ONLY
   DEPLOY_BUILD_TARGETS += images
 else