Merge jdk8-b57
authorduke
Wed, 05 Jul 2017 18:22:52 +0200
changeset 13723 2c21c080b11b
parent 13722 17faab0e7f7b (diff)
parent 13695 5c62073e781f (current diff)
child 13724 6198187f5ad9
child 13725 fc1beab39b2a
child 13726 33f922a83629
child 13749 ab29bec425bb
child 13765 08a2396d4c97
child 13829 9da0d8f01a5a
child 13832 84521b7fdb66
child 13834 63e6a7c76188
child 13836 e033f1ff319a
child 13838 341f4267dab9
Merge
--- a/.hgignore	Wed Jul 05 18:22:17 2017 +0200
+++ b/.hgignore	Wed Jul 05 18:22:52 2017 +0200
@@ -1,6 +1,7 @@
 ^build/
 ^dist/
-/nbproject/private/
+nbproject/private/
 ^webrev
 ^.hgtip
+^.bridge2
 .DS_Store
--- a/.hgtags-top-repo	Wed Jul 05 18:22:17 2017 +0200
+++ b/.hgtags-top-repo	Wed Jul 05 18:22:52 2017 +0200
@@ -177,3 +177,4 @@
 febd7ff5280067ca482faaeb9418ae88764c1a35 jdk8-b53
 c1a277c6022affbc6855bdfb039511e73fbe2395 jdk8-b54
 b85b44cced2406792cfb9baab1377ff03e7001d8 jdk8-b55
+76844579fa4b30929731115b237e477181a82394 jdk8-b56
--- a/Makefile	Wed Jul 05 18:22:17 2017 +0200
+++ b/Makefile	Wed Jul 05 18:22:52 2017 +0200
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 1995, 2011, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 1995, 2012, 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
@@ -23,6 +23,16 @@
 # questions.
 #
 
+# If NEWBUILD is defined, use the new build-infra Makefiles and configure.
+#     See NewMakefile.gmk for more information.
+
+ifeq ($(NEWBUILD),true)
+
+  # The new top level Makefile
+  include NewMakefile.gmk
+
+else # Original Makefile logic
+
 BUILD_PARENT_DIRECTORY=.
 
 # Basename of any originally supplied ALT_OUTPUTDIR directory
@@ -557,3 +567,5 @@
 # Force target
 FRC:
 
+endif # Original Makefile logic
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/NewMakefile.gmk	Wed Jul 05 18:22:52 2017 +0200
@@ -0,0 +1,211 @@
+#
+# Copyright (c) 2012, 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.
+#
+
+# Utilities used in this Makefile
+BASENAME=basename
+CAT=cat
+CD=cd
+CMP=cmp
+CP=cp
+ECHO=echo
+MKDIR=mkdir
+PWD=pwd
+SH=sh
+ifeq ($(PLATFORM),windows)
+  ZIP=zip
+else
+  # store symbolic links as the link
+  ZIP=zip -y
+endif
+# Insure we have a path that looks like it came from pwd
+#   (This is mostly for Windows sake and drive letters)
+define UnixPath # path
+$(shell (cd "$1" && $(PWD)))
+endef
+
+# Current root directory
+CURRENT_DIRECTORY := $(shell $(PWD))
+
+# Build directory root
+BUILD_DIR_ROOT = $(CURRENT_DIRECTORY)/build
+
+# All configured Makefiles to run
+ALL_MAKEFILES = $(wildcard $(BUILD_DIR_ROOT)/*-*/Makefile)
+
+# All bundles to create
+ALL_IMAGE_DIRS = $(wildcard $(BUILD_DIR_ROOT)/*-*/images/*-image)
+
+# Build all the standard 'all', 'images', and 'clean' targets
+all images clean: checks
+	@if [ "$(ALL_MAKEFILES)" = "" ] ; then \
+	  $(ECHO) "ERROR: No configurations to build"; exit 1; \
+	fi
+	@for bdir in $(dir $(ALL_MAKEFILES)) ; do \
+	  $(ECHO) "$(CD) $${bdir} && $(MAKE) $(EXTRA_MAKE_ARGS) $@" ; \
+	  $(CD) $${bdir} && $(MAKE) $(EXTRA_MAKE_ARGS) $@ ; \
+	done
+
+# Bundle creation
+bundles:
+	@if [ "$(ALL_IMAGE_DIRS)" = "" ] ; then \
+	  $(ECHO) "ERROR: No images to bundle"; exit 1; \
+	fi
+	@for i in $(ALL_IMAGE_DIRS) ; do \
+          $(MKDIR) -p $${i}/../../bundles && \
+          $(RM) $${i}/../../bundles/`$(BASENAME) $${i}`.zip && \
+	  $(ECHO) "$(CD) $${i} && $(ZIP) -q -r ../../bundles/`$(BASENAME) $${i}`.zip ."  && \
+	  $(CD) $${i} && $(ZIP) -q -r ../../bundles/`$(BASENAME) $${i}`.zip . ; \
+	done
+
+# Clobber all the built files
+clobber::
+	$(RM) -r $(BUILD_DIR_ROOT)
+
+# Make various checks to insure the build will be successful
+#   Possibilities:
+#     * Check that if any closed repo is provided, they all must be.
+#     * Check that all open repos exist, at least until we are ready for some
+#       kind of partial build.
+checks:
+	@$(ECHO) "No checks yet"
+
+# Keep track of phony targets
+PHONY_LIST += all images clean clobber checks
+
+###########################################################################
+# To help in adoption of the new configure&&make build process, a bridge
+#   build will use the old settings to run configure and do the build.
+
+# Build with the configure bridge
+bridgeBuild: bridge2configure images
+
+# Bridge from old Makefile ALT settings to configure options
+bridge2configure: .bridge2configureOpts
+	$(CD) common/makefiles && sh ../autoconf/configure $(strip $(shell $(CAT) $<))
+
+# Create a file with configure options created from old Makefile mechanisms.
+.bridge2configureOpts: .bridge2configureOptsLatest
+	$(RM) $@
+	$(CP) $< $@
+
+# In case make was invoked from a specific path
+_MAKE_COMMAND_PATH:=$(firstword $(MAKE))
+ifneq ($(dir $(_MAKE_COMMAND_PATH)),./)
+  # This could be removed someday if JPRT was fixed and we could assume that
+  #    the path to make was always in PATH.
+  MAKE_BINDIR:=$(call UnixPath,$(dir $(_MAKE_COMMAND_PATH)))
+  NEWPATH:=$(MAKE_BINDIR):${PATH}
+  PATH:=$(NEWPATH)
+  export PATH
+  MAKE_COMMAND=$(MAKE_BINDIR)/$(notdir $(_MAKE_COMMAND_PATH))
+else
+  MAKE_COMMAND=$(_MAKE_COMMAND_PATH)
+endif
+
+# Use this file to only change when obvious things have changed
+.bridge2configureOptsLatest: FRC
+	$(RM) $@.tmp
+	@$(ECHO) " MAKE=$(MAKE_COMMAND) " >> $@.tmp
+	@$(ECHO) " --with-debug-level=$(if $(DEBUG_LEVEL),$(DEBUG_LEVEL),release) " >> $@.tmp
+ifdef ARCH_DATA_MODEL
+	@$(ECHO) " --with-target-bits=$(ARCH_DATA_MODEL) " >> $@.tmp
+endif
+ifdef ALT_PARALLEL_COMPILE_JOBS
+	@$(ECHO) " --with-num-cores=$(ALT_PARALLEL_COMPILE_JOBS) " >> $@.tmp
+endif
+ifdef ALT_BOOTDIR
+	@$(ECHO) " --with-boot-jdk=$(call UnixPath,$(ALT_BOOTDIR)) " >> $@.tmp
+endif
+ifdef ALT_CUPS_HEADERS_PATH
+	@$(ECHO) " --with-cups-include=$(call UnixPath,$(ALT_CUPS_HEADERS_PATH)) " >> $@.tmp
+endif
+ifdef ALT_FREETYPE_HEADERS_PATH
+	@$(ECHO) " --with-freetype=$(call UnixPath,$(ALT_FREETYPE_HEADERS_PATH)/..) " >> $@.tmp
+endif
+	@if [ -f $@ ] ; then \
+          if ! $(CMP) $@ $@.tmp > /dev/null ; then \
+            $(CP) $@.tmp $@ ; \
+          fi ; \
+        else \
+          $(CP) $@.tmp $@ ; \
+        fi
+	$(RM) $@.tmp
+
+# Clobber all the built files
+clobber:: bridge2clobber
+bridge2clobber::
+	$(RM) .bridge2*
+
+# Keep track of phony targets
+PHONY_LIST += bridge2configure bridgeBuild bridge2clobber
+
+###########################################################################
+# Javadocs
+#
+
+javadocs:
+	cd common/makefiles && $(MAKE) -f MakefileJavadoc.gmk
+
+# Keep track of phony targets
+PHONY_LIST += javadocs
+
+###########################################################################
+# JPRT targets
+
+ifndef JPRT_ARCHIVE_BUNDLE
+  JPRT_ARCHIVE_BUNDLE=/tmp/jprt_bundles/j2sdk-image.zip
+endif
+
+jprt_build_product: DEBUG_LEVEL=release
+jprt_build_product: BUILD_DIRNAME=*-release
+jprt_build_product: jprt_build_generic
+
+jprt_build_fastdebug: DEBUG_LEVEL=fastdebug
+jprt_build_fastdebug: BUILD_DIRNAME=*-fastdebug
+jprt_build_fastdebug: jprt_build_generic
+
+jprt_build_debug: DEBUG_LEVEL=slowdebug
+jprt_build_debug: BUILD_DIRNAME=*-debug
+jprt_build_debug: jprt_build_generic
+
+jprt_build_generic: EXTRA_MAKE_ARGS=LOG=nofile,info
+jprt_build_generic: $(JPRT_ARCHIVE_BUNDLE)
+
+$(JPRT_ARCHIVE_BUNDLE): bridgeBuild bundles
+	$(MKDIR) -p $(@D)
+	$(RM) $@
+	$(CP) $(BUILD_DIR_ROOT)/$(BUILD_DIRNAME)/bundles/j2sdk-image.zip $@
+
+# Keep track of phony targets
+PHONY_LIST += jprt_build_product jprt_build_fastdebug jprt_build_debug \
+              jprt_build_generic
+
+###########################################################################
+# Phony targets
+.PHONY: $(PHONY_LIST)
+
+# Force target
+FRC:
+
--- a/common/autoconf/autogen.sh	Wed Jul 05 18:22:17 2017 +0200
+++ b/common/autoconf/autogen.sh	Wed Jul 05 18:22:52 2017 +0200
@@ -23,18 +23,38 @@
 #
 
 script_dir=`dirname $0`
-closed_script_dir="$script_dir/../../jdk/make/closed/autoconf"
 
 # Create a timestamp as seconds since epoch
-TIMESTAMP=`date +%s`
+if test "x`uname -s`" = "xSunOS"; then
+  # date +%s is not available on Solaris, use this workaround
+  # from http://solarisjedi.blogspot.co.uk/2006/06/solaris-date-command-and-epoch-time.html
+  TIMESTAMP=`/usr/bin/truss /usr/bin/date 2>&1 |  nawk -F= '/^time\(\)/ {gsub(/ /,"",$2);print $2}'`
+  # On Solaris /bin/sh doesn't support test -e but /usr/bin/test does.
+  TEST=`which test`
+else
+  TIMESTAMP=`date +%s`
+  TEST="test"
+fi
 
+if $TEST "$CUSTOM_CONFIG_DIR" = ""; then
+  custom_script_dir="$script_dir/../../jdk/make/closed/autoconf"
+else
+  custom_script_dir=$CUSTOM_CONFIG_DIR
+fi
+
+custom_hook=$custom_script_dir/custom-hook.m4
+
+echo Generating generated-configure.sh
 cat $script_dir/configure.ac  | sed -e "s|@DATE_WHEN_GENERATED@|$TIMESTAMP|" | autoconf -W all -I$script_dir - > $script_dir/generated-configure.sh
 rm -rf autom4te.cache
 
-if test -e $closed_script_dir/closed-hook.m4; then
-  # We have closed sources available; also generate configure script
-  # with closed hooks compiled in.
+if $TEST -e $custom_hook; then
+  echo Generating custom generated-configure.sh
+  # We have custom sources available; also generate configure script
+  # with custom hooks compiled in.
   cat $script_dir/configure.ac | sed -e "s|@DATE_WHEN_GENERATED@|$TIMESTAMP|" | \
-    sed -e "s|AC_DEFUN_ONCE(\[CLOSED_HOOK\])|m4_include([$closed_script_dir/closed-hook.m4])|" | autoconf -W all -I$script_dir - > $closed_script_dir/generated-configure.sh
+    sed -e "s|AC_DEFUN_ONCE(\[CUSTOM_HOOK\])|m4_include([$custom_hook])|" | autoconf -W all -I$script_dir - > $custom_script_dir/generated-configure.sh
   rm -rf autom4te.cache
+else
+  echo No custom hook found:  $custom_hook
 fi
--- a/common/autoconf/basics.m4	Wed Jul 05 18:22:17 2017 +0200
+++ b/common/autoconf/basics.m4	Wed Jul 05 18:22:52 2017 +0200
@@ -34,7 +34,7 @@
     fi
 ])
 
-AC_DEFUN([WHICHCMD],
+AC_DEFUN([SET_FULL_PATH],
 [
     # Translate "gcc -E" into "`which gcc` -E" ie
     # extract the full path to the binary and at the
@@ -46,7 +46,7 @@
     cdr="${tmp#* }"
     # On windows we want paths without spaces.
     if test "x$OPENJDK_BUILD_OS" = "xwindows"; then
-        WHICHCMD_SPACESAFE(car)
+        SET_FULL_PATH_SPACESAFE(car)
     else
         # "which" is not portable, but is used here
         # because we know that the command exists!
@@ -66,15 +66,19 @@
     HAS_SPACE=`echo "[$]$1" | grep " "`
     if test "x$HAS_SPACE" != x; then
         if test "x$OPENJDK_BUILD_OS" = "xwindows"; then
+            # First convert it to DOS-style, short mode (no spaces)
             $1=`$CYGPATH -s -m -a "[$]$1"`
-            $1=`$CYGPATH -u "[$]$1"`            
+            # Now it's case insensitive; let's make it lowercase to improve readability
+            $1=`$ECHO "[$]$1" | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvqxyz'`
+            # Now convert it back to Unix-stile (cygpath)
+            $1=`$CYGPATH -u "[$]$1"`
         else
             AC_MSG_ERROR([You cannot have spaces in $2! "[$]$1"])
         fi
     fi
 ])
 
-AC_DEFUN([WHICHCMD_SPACESAFE],
+AC_DEFUN([SET_FULL_PATH_SPACESAFE],
 [
     # Translate long cygdrive or C:\sdfsf path
     # into a short mixed mode path that has no
@@ -148,15 +152,16 @@
 AC_SUBST(CONFIGURE_COMMAND_LINE)
 DATE_WHEN_CONFIGURED=`LANG=C date`
 AC_SUBST(DATE_WHEN_CONFIGURED)
+])
 
+# Setup basic configuration paths, and platform-specific stuff related to PATHs.
+AC_DEFUN_ONCE([BASIC_SETUP_PATHS],
+[
 # Locate the directory of this script.
 SCRIPT="[$]0"
-REMOVE_SYMBOLIC_LINKS(SCRIPT)        
+REMOVE_SYMBOLIC_LINKS(SCRIPT)
 AUTOCONF_DIR=`dirname [$]0`
-])
 
-AC_DEFUN_ONCE([BASIC_SETUP_PATHS],
-[
 # Where is the source? It is located two levels above the configure script.
 CURDIR="$PWD"
 cd "$AUTOCONF_DIR/../.."
@@ -172,18 +177,12 @@
 
 SPACESAFE(SRC_ROOT,[the path to the source root])
 SPACESAFE(CURDIR,[the path to the current directory])
-])
 
-AC_DEFUN_ONCE([BASIC_SETUP_SEARCHPATH],
-[
 if test "x$OPENJDK_BUILD_OS" = "xsolaris"; then
     # Add extra search paths on solaris for utilities like ar and as etc...
     PATH="$PATH:/usr/ccs/bin:/usr/sfw/bin:/opt/csw/bin"
 fi
-])
 
-AC_DEFUN_ONCE([BASIC_SETUP_PATH_SEP],
-[
 # For cygwin we need cygpath first, since it is used everywhere.
 AC_PATH_PROG(CYGPATH, cygpath)
 PATH_SEP=":"
@@ -194,6 +193,36 @@
     PATH_SEP=";"
 fi
 AC_SUBST(PATH_SEP)
+
+# You can force the sys-root if the sys-root encoded into the cross compiler tools
+# is not correct.
+AC_ARG_WITH(sys-root, [AS_HELP_STRING([--with-sys-root],
+  [pass this sys-root to the compilers and linker (useful if the sys-root encoded in
+   the cross compiler tools is incorrect)])])
+
+if test "x$with_sys_root" != x; then
+  SYS_ROOT=$with_sys_root
+else
+  SYS_ROOT=/
+fi
+AC_SUBST(SYS_ROOT)
+
+AC_ARG_WITH([tools-dir], [AS_HELP_STRING([--with-tools-dir],
+  [search this directory for (cross-compiling) compilers and tools])], [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)])],
+  [
+    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])
+    fi
+    TOOLS_DIR=$with_devkit/bin
+    SYS_ROOT=$with_devkit/$host_alias/libc
+  ])
+
 ])
 
 AC_DEFUN_ONCE([BASIC_SETUP_OUTPUT_DIR],
@@ -236,7 +265,13 @@
 AC_CONFIG_HEADERS([$OUTPUT_ROOT/config.h:$AUTOCONF_DIR/config.h.in])
 # The spec.gmk file contains all variables for the make system.
 AC_CONFIG_FILES([$OUTPUT_ROOT/spec.gmk:$AUTOCONF_DIR/spec.gmk.in])
-# The spec.sh file contains variables for compare{images|-objects}.sh scrips.
+# The hotspot-spec.gmk file contains legacy variables for the hotspot make system.
+AC_CONFIG_FILES([$OUTPUT_ROOT/hotspot-spec.gmk:$AUTOCONF_DIR/hotspot-spec.gmk.in])
+# The bootcycle-spec.gmk file contains support for boot cycle builds.
+AC_CONFIG_FILES([$OUTPUT_ROOT/bootcycle-spec.gmk:$AUTOCONF_DIR/bootcycle-spec.gmk.in])
+# The compare.sh is used to compare the build output to other builds.
+AC_CONFIG_FILES([$OUTPUT_ROOT/compare.sh:$AUTOCONF_DIR/compare.sh.in])
+# Spec.sh is currently used by compare-objects.sh
 AC_CONFIG_FILES([$OUTPUT_ROOT/spec.sh:$AUTOCONF_DIR/spec.sh.in])
 # The generated Makefile knows where the spec.gmk is and where the source is.
 # You can run make from the OUTPUT_ROOT, or from the top-level Makefile
@@ -261,6 +296,79 @@
 
 #%%% Simple tools %%%
 
+# Check if we have found a usable version of make
+# $1: the path to a potential make binary (or empty)
+# $2: the description on how we found this
+AC_DEFUN([BASIC_CHECK_MAKE_VERSION],
+[
+  MAKE_CANDIDATE="$1"
+  DESCRIPTION="$2"
+  if test "x$MAKE_CANDIDATE" != x; then
+    AC_MSG_NOTICE([Testing potential make at $MAKE_CANDIDATE, found using $DESCRIPTION])
+    SET_FULL_PATH(MAKE_CANDIDATE)
+    MAKE_VERSION_STRING=`$MAKE_CANDIDATE --version | $HEAD -n 1`
+    IS_GNU_MAKE=`$ECHO $MAKE_VERSION_STRING | $GREP 'GNU Make'`
+    if test "x$IS_GNU_MAKE" = x; then
+      AC_MSG_NOTICE([Found potential make at $MAKE_CANDIDATE, however, this is not GNU Make. Ignoring.])
+    else
+      IS_MODERN_MAKE=`$ECHO $MAKE_VERSION_STRING | $GREP '3.8[[12346789]]'`
+      if test "x$IS_MODERN_MAKE" = x; then
+        AC_MSG_NOTICE([Found GNU make at $MAKE_CANDIDATE, however this is not version 3.81 or later. (it is: $MAKE_VERSION_STRING). Ignoring.])
+      else 
+        FOUND_MAKE=$MAKE_CANDIDATE
+      fi
+    fi
+  fi
+])
+
+# Goes looking for a usable version of GNU make.
+AC_DEFUN([BASIC_CHECK_GNU_MAKE],
+[
+  # We need to find a recent version of GNU make. Especially on Solaris, this can be tricky.
+  if test "x$MAKE" != x; then
+    # User has supplied a make, test it.
+    if test ! -f "$MAKE"; then
+      AC_MSG_ERROR([The specified make (by MAKE=$MAKE) is not found.])
+    fi
+    BASIC_CHECK_MAKE_VERSION("$MAKE", [user supplied MAKE=])
+    if test "x$FOUND_MAKE" = x; then
+      AC_MSG_ERROR([The specified make (by MAKE=$MAKE) is not GNU make 3.81 or newer.])
+    fi
+  else
+    # Try our hardest to locate a correct version of GNU make
+    AC_PATH_PROGS(CHECK_GMAKE, gmake)
+    BASIC_CHECK_MAKE_VERSION("$CHECK_GMAKE", [gmake in PATH])
+
+    if test "x$FOUND_MAKE" = x; then
+      AC_PATH_PROGS(CHECK_MAKE, make)
+      BASIC_CHECK_MAKE_VERSION("$CHECK_MAKE", [make in PATH])
+    fi
+
+    if test "x$FOUND_MAKE" = x; then
+      if test "x$TOOLS_DIR" != x; then
+        # We have a tools-dir, check that as well before giving up.
+        OLD_PATH=$PATH
+        PATH=$TOOLS_DIR:$PATH
+        AC_PATH_PROGS(CHECK_TOOLSDIR_GMAKE, gmake)
+        BASIC_CHECK_MAKE_VERSION("$CHECK_TOOLSDIR_GMAKE", [gmake in tools-dir])
+        if test "x$FOUND_MAKE" = x; then
+          AC_PATH_PROGS(CHECK_TOOLSDIR_MAKE, make)
+          BASIC_CHECK_MAKE_VERSION("$CHECK_TOOLSDIR_MAKE", [make in tools-dir])
+        fi
+        PATH=$OLD_PATH
+      fi
+    fi
+
+    if test "x$FOUND_MAKE" = x; then
+      AC_MSG_ERROR([Cannot find GNU make 3.81 or newer! Please put it in the path, or add e.g. MAKE=/opt/gmake3.81/make as argument to configure.])
+    fi
+  fi
+
+  MAKE=$FOUND_MAKE
+  AC_SUBST(MAKE)
+  AC_MSG_NOTICE([Using GNU make 3.81 (or later) at $FOUND_MAKE (version: $MAKE_VERSION_STRING)])
+])
+
 AC_DEFUN([BASIC_CHECK_FIND_DELETE],
 [
     # Test if find supports -delete
@@ -283,10 +391,30 @@
     rmdir $DELETEDIR
 ])
 
+# Test that variable $1 denoting a program is not empty. If empty, exit with an error.
+# $1: variable to check
+# $2: executable name to print in warning (optional)
 AC_DEFUN([CHECK_NONEMPTY],
 [
-    # Test that variable $1 is not empty.
-    if test "" = "[$]$1"; then AC_MSG_ERROR(Could not find translit($1,A-Z,a-z) !); fi
+    if test "x[$]$1" = x; then
+        if test "x$2" = x; then
+          PROG_NAME=translit($1,A-Z,a-z)
+        else
+          PROG_NAME=$2
+        fi
+        AC_MSG_NOTICE([Could not find $PROG_NAME!])
+        AC_MSG_ERROR([Cannot continue])
+    fi
+])
+
+# Does AC_PATH_PROG followed by CHECK_NONEMPTY.
+# Arguments as AC_PATH_PROG:
+# $1: variable to set
+# $2: executable name to look for
+AC_DEFUN([BASIC_REQUIRE_PROG],
+[
+    AC_PATH_PROGS($1, $2)
+    CHECK_NONEMPTY($1, $2)
 ])
 
 AC_DEFUN_ONCE([BASIC_SETUP_TOOLS],
@@ -295,90 +423,68 @@
 # and can be expected to be found in the default PATH. These tools are
 # used by configure. Nor are these tools expected to be found in the
 # devkit from the builddeps server either, since they are
-# needed to download the devkit. 
+# needed to download the devkit.
+
+# First are all the simple required tools.
+BASIC_REQUIRE_PROG(BASENAME, basename)
+BASIC_REQUIRE_PROG(CAT, cat)
+BASIC_REQUIRE_PROG(CHMOD, chmod)
+BASIC_REQUIRE_PROG(CMP, cmp)
+BASIC_REQUIRE_PROG(CP, cp)
+BASIC_REQUIRE_PROG(CPIO, cpio)
+BASIC_REQUIRE_PROG(CUT, cut)
+BASIC_REQUIRE_PROG(DATE, date)
+BASIC_REQUIRE_PROG(DF, df)
+BASIC_REQUIRE_PROG(DIFF, [gdiff diff])
+BASIC_REQUIRE_PROG(ECHO, echo)
+BASIC_REQUIRE_PROG(EXPR, expr)
+BASIC_REQUIRE_PROG(FILE, file)
+BASIC_REQUIRE_PROG(FIND, find)
+BASIC_REQUIRE_PROG(HEAD, head)
+BASIC_REQUIRE_PROG(LN, ln)
+BASIC_REQUIRE_PROG(LS, ls)
+BASIC_REQUIRE_PROG(MKDIR, mkdir)
+BASIC_REQUIRE_PROG(MV, mv)
+BASIC_REQUIRE_PROG(PRINTF, printf)
+BASIC_REQUIRE_PROG(SH, sh)
+BASIC_REQUIRE_PROG(SORT, sort)
+BASIC_REQUIRE_PROG(TAIL, tail)
+BASIC_REQUIRE_PROG(TAR, tar)
+BASIC_REQUIRE_PROG(TEE, tee)
+BASIC_REQUIRE_PROG(TOUCH, touch)
+BASIC_REQUIRE_PROG(TR, tr)
+BASIC_REQUIRE_PROG(UNIQ, uniq)
+BASIC_REQUIRE_PROG(UNZIP, unzip)
+BASIC_REQUIRE_PROG(WC, wc)
+BASIC_REQUIRE_PROG(XARGS, xargs)
+BASIC_REQUIRE_PROG(ZIP, zip)
+
+# Then required tools that require some special treatment.
 AC_PROG_AWK
 CHECK_NONEMPTY(AWK)
-AC_PATH_PROG(CAT, cat)
-CHECK_NONEMPTY(CAT)
-AC_PATH_PROG(CHMOD, chmod)
-CHECK_NONEMPTY(CHMOD)
-AC_PATH_PROG(CP, cp)
-CHECK_NONEMPTY(CP)
-AC_PATH_PROG(CPIO, cpio)
-CHECK_NONEMPTY(CPIO)
-AC_PATH_PROG(CUT, cut)
-CHECK_NONEMPTY(CUT)
-AC_PATH_PROG(DATE, date)
-CHECK_NONEMPTY(DATE)
-AC_PATH_PROG(DF, df)
-CHECK_NONEMPTY(DF)
-AC_PATH_PROG(DIFF, diff)
-CHECK_NONEMPTY(DIFF)
-# Warning echo is really, really unportable!!!!! Different
-# behaviour in bash and dash and in a lot of other shells!
-# Use printf for serious work! 
-AC_PATH_PROG(ECHO, echo)
-CHECK_NONEMPTY(ECHO)
+AC_PROG_GREP
+CHECK_NONEMPTY(GREP)
 AC_PROG_EGREP
 CHECK_NONEMPTY(EGREP)
 AC_PROG_FGREP
 CHECK_NONEMPTY(FGREP)
+AC_PROG_SED
+CHECK_NONEMPTY(SED)
 
-AC_PATH_PROG(FIND, find)
-CHECK_NONEMPTY(FIND)
+AC_PATH_PROGS(NAWK, [nawk gawk awk])
+CHECK_NONEMPTY(NAWK)
+
+BASIC_CHECK_GNU_MAKE
+
+BASIC_REQUIRE_PROG(RM, rm)
+RM="$RM -f"
+
 BASIC_CHECK_FIND_DELETE
 AC_SUBST(FIND_DELETE)
 
-AC_PROG_GREP
-CHECK_NONEMPTY(GREP)
-AC_PATH_PROG(HEAD, head)
-CHECK_NONEMPTY(HEAD)
-AC_PATH_PROG(LN, ln)
-CHECK_NONEMPTY(LN)
-AC_PATH_PROG(LS, ls)
-CHECK_NONEMPTY(LS)
-AC_PATH_PROGS(MAKE, [gmake make])
-CHECK_NONEMPTY(MAKE)
-MAKE_VERSION=`$MAKE --version | head -n 1 | grep '3.8[[12346789]]'`
-if test "x$MAKE_VERSION" = x; then
-    AC_MSG_ERROR([You must use GNU make 3.81 or newer! Please put it in the path, or add e.g. MAKE=/opt/gmake3.81/make as argument to configure.])
-fi
-AC_PATH_PROG(MKDIR, mkdir)
-CHECK_NONEMPTY(MKDIR)
-AC_PATH_PROG(MV, mv)
-CHECK_NONEMPTY(MV)
-AC_PATH_PROGS(NAWK, [nawk gawk awk])
-CHECK_NONEMPTY(NAWK)
-AC_PATH_PROG(PRINTF, printf)
-CHECK_NONEMPTY(PRINTF)
+# Non-required basic tools
+
 AC_PATH_PROG(THEPWDCMD, pwd)
-AC_PATH_PROG(RM, rm)
-CHECK_NONEMPTY(RM)
-RM="$RM -f"
-AC_PROG_SED
-CHECK_NONEMPTY(SED)
-AC_PATH_PROG(SH, sh)
-CHECK_NONEMPTY(SH)
-AC_PATH_PROG(SORT, sort)
-CHECK_NONEMPTY(SORT)
-AC_PATH_PROG(TAR, tar)
-CHECK_NONEMPTY(TAR)
-AC_PATH_PROG(TAIL, tail)
-CHECK_NONEMPTY(TAIL)
-AC_PATH_PROG(TEE, tee)
-CHECK_NONEMPTY(TEE)
-AC_PATH_PROG(TR, tr)
-CHECK_NONEMPTY(TR)
-AC_PATH_PROG(TOUCH, touch)
-CHECK_NONEMPTY(TOUCH)
-AC_PATH_PROG(WC, wc)
-CHECK_NONEMPTY(WC)
-AC_PATH_PROG(XARGS, xargs)
-CHECK_NONEMPTY(XARGS)
-AC_PATH_PROG(ZIP, zip)
-CHECK_NONEMPTY(ZIP)
-AC_PATH_PROG(UNZIP, unzip)
-CHECK_NONEMPTY(UNZIP)
 AC_PATH_PROG(LDD, ldd)
 if test "x$LDD" = "x"; then
     # List shared lib dependencies is used for
@@ -390,16 +496,11 @@
 if test "x$OTOOL" = "x"; then
    OTOOL="true"
 fi
-AC_PATH_PROG(READELF, readelf)
-AC_PATH_PROG(EXPR, expr)
-CHECK_NONEMPTY(EXPR)
-AC_PATH_PROG(FILE, file)
-CHECK_NONEMPTY(FILE)
+AC_PATH_PROGS(READELF, [readelf greadelf])
+AC_PATH_PROGS(OBJDUMP, [objdump gobjdump])
 AC_PATH_PROG(HG, hg)
 ])
 
-
-
 AC_DEFUN_ONCE([BASIC_COMPILE_UNCYGDRIVE],
 [
 # When using cygwin, we need a wrapper binary that renames
@@ -433,6 +534,8 @@
     fi
     AC_MSG_RESULT([yes])
     rm -f $OUTPUT_ROOT/uncygdrive?.??? $OUTPUT_ROOT/uncygdrive.obj
+    # The path to uncygdrive to use should be Unix-style
+    UNCYGDRIVE="$OUTPUT_ROOT/uncygdrive.exe"
 fi
 
 AC_SUBST(UNCYGDRIVE)
--- a/common/autoconf/boot-jdk.m4	Wed Jul 05 18:22:17 2017 +0200
+++ b/common/autoconf/boot-jdk.m4	Wed Jul 05 18:22:52 2017 +0200
@@ -23,22 +23,186 @@
 # questions.
 #
 
-# Fixes paths on windows to be mixed mode short.
-AC_DEFUN([BOOTJDK_WIN_FIX_PATH],
+# Execute the check given as argument, and verify the result
+# If the Boot JDK was previously found, do nothing
+# $1 A command line (typically autoconf macro) to execute
+AC_DEFUN([BOOTJDK_DO_CHECK],
 [
-    if test "x$OPENJDK_BUILD_OS" = "xwindows"; then
-        AC_PATH_PROG(CYGPATH, cygpath)
-        tmp="[$]$1"
-        # Convert to C:/ mixed style path without spaces.
-        tmp=`$CYGPATH -s -m "$tmp"`
-        $1="$tmp"
+  if test "x$BOOT_JDK_FOUND" = xno; then
+    # Now execute the test
+    $1
+
+    # If previous step claimed to have found a JDK, check it to see if it seems to be valid.
+    if test "x$BOOT_JDK_FOUND" = xmaybe; then
+      # Do we have a bin/java?
+      if test ! -x "$BOOT_JDK/bin/java"; then
+        AC_MSG_NOTICE([Potential Boot JDK found at $BOOT_JDK did not contain bin/java; ignoring])
+        BOOT_JDK_FOUND=no
+      else
+        # Do we have a bin/javac?
+        if test ! -x "$BOOT_JDK/bin/javac"; then
+          AC_MSG_NOTICE([Potential Boot JDK found at $BOOT_JDK did not contain bin/javac; ignoring])
+          AC_MSG_NOTICE([(This might be an JRE instead of an JDK)])
+          BOOT_JDK_FOUND=no
+        else 
+          # Do we have an rt.jar? (On MacOSX it is called classes.jar)
+          if test ! -f "$BOOT_JDK/jre/lib/rt.jar" && test ! -f "$BOOT_JDK/../Classes/classes.jar"; then
+            AC_MSG_NOTICE([Potential Boot JDK found at $BOOT_JDK did not contain an rt.jar; ignoring])
+            BOOT_JDK_FOUND=no
+          else
+            # Oh, this is looking good! We probably have found a proper JDK. Is it the correct version?
+            BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | head -n 1`
+
+            # Extra M4 quote needed to protect [] in grep expression.
+            [FOUND_VERSION_78=`echo $BOOT_JDK_VERSION | grep  '\"1\.[78]\.'`]
+            if test "x$FOUND_VERSION_78" = x; then
+              AC_MSG_NOTICE([Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring])
+              AC_MSG_NOTICE([(Your Boot JDK must be version 7 or 8)])
+              BOOT_JDK_FOUND=no
+            else
+              # We're done! :-)
+              BOOT_JDK_FOUND=yes
+              SPACESAFE(BOOT_JDK,[the path to the Boot JDK])
+              AC_MSG_CHECKING([for Boot JDK])
+              AC_MSG_RESULT([$BOOT_JDK ($BOOT_JDK_VERSION)])
+            fi # end check jdk version
+          fi # end check rt.jar
+        fi # end check javac
+      fi # end check java
+    fi # end check boot jdk found
+  fi
+])
+
+# Test: Is bootjdk explicitely set by command line arguments?
+AC_DEFUN([BOOTJDK_CHECK_ARGUMENTS],
+[
+if test "x$with_boot_jdk" != x; then
+    BOOT_JDK=$with_boot_jdk
+    BOOT_JDK_FOUND=maybe
+    AC_MSG_NOTICE([Found potential Boot JDK using configure arguments])
+fi
+])
+
+# Test: Is bootjdk available from builddeps?
+AC_DEFUN([BOOTJDK_CHECK_BUILDDEPS],
+[
+    BDEPS_CHECK_MODULE(BOOT_JDK, bootjdk, xxx, [BOOT_JDK_FOUND=maybe], [BOOT_JDK_FOUND=no])
+])
+
+# Test: Is $JAVA_HOME set?
+AC_DEFUN([BOOTJDK_CHECK_JAVA_HOME],
+[
+    if test "x$JAVA_HOME" != x; then
+        if test "x$OPENJDK_TARGET_OS" = xwindows; then
+          # On Windows, JAVA_HOME is likely in DOS-style
+          JAVA_HOME_PROCESSED="`$CYGPATH -u "$JAVA_HOME"`"
+        else
+          JAVA_HOME_PROCESSED="$JAVA_HOME"
+        fi
+        if test ! -d "$JAVA_HOME_PROCESSED"; then
+            AC_MSG_NOTICE([Your JAVA_HOME points to a non-existing directory!])
+        else
+          # Aha, the user has set a JAVA_HOME
+          # let us use that as the Boot JDK.
+          BOOT_JDK="$JAVA_HOME_PROCESSED"
+          BOOT_JDK_FOUND=maybe
+          AC_MSG_NOTICE([Found potential Boot JDK using JAVA_HOME])
+        fi
     fi
 ])
 
-AC_DEFUN([BOOTJDK_MISSING_ERROR],
+# Test: Is there a java or javac in the PATH, which is a symlink to the JDK?
+AC_DEFUN([BOOTJDK_CHECK_JAVA_IN_PATH_IS_SYMLINK],
+[
+    AC_PATH_PROG(JAVAC_CHECK, javac)
+    AC_PATH_PROG(JAVA_CHECK, java)
+    BINARY="$JAVAC_CHECK"
+    if test "x$JAVAC_CHECK" = x; then
+        BINARY="$JAVA_CHECK"
+    fi
+    if test "x$BINARY" != x; then
+        # So there is a java(c) binary, it might be part of a JDK.
+        # Lets find the JDK/JRE directory by following symbolic links.
+        # Linux/GNU systems often have links from /usr/bin/java to 
+        # /etc/alternatives/java to the real JDK binary.
+        SET_FULL_PATH_SPACESAFE(BINARY)
+        REMOVE_SYMBOLIC_LINKS(BINARY)
+        BOOT_JDK=`dirname "$BINARY"`
+        BOOT_JDK=`cd "$BOOT_JDK/.."; pwd`
+        if test -x "$BOOT_JDK/bin/javac" && test -x "$BOOT_JDK/bin/java"; then
+            # Looks like we found ourselves an JDK
+            BOOT_JDK_FOUND=maybe
+            AC_MSG_NOTICE([Found potential Boot JDK using java(c) in PATH])
+        fi
+    fi
+])
+
+# Test: Is there a /usr/libexec/java_home? (Typically on MacOSX)
+AC_DEFUN([BOOTJDK_CHECK_LIBEXEC_JAVA_HOME],
+[
+    if test -x /usr/libexec/java_home; then
+        BOOT_JDK=`/usr/libexec/java_home`
+        BOOT_JDK_FOUND=maybe
+        AC_MSG_NOTICE([Found potential Boot JDK using /usr/libexec/java_home])
+    fi
+])
+
+# Look for a jdk in the given path. If there are multiple, try to select the newest.
+# If found, set BOOT_JDK and BOOT_JDK_FOUND.
+# $1 = Path to directory containing jdk installations.
+# $2 = String to append to the found JDK directory to get the proper JDK home
+AC_DEFUN([BOOTJDK_FIND_BEST_JDK_IN_DIRECTORY],
 [
-    AC_MSG_NOTICE([This might be fixed by explicitely setting --with-boot-jdk])
-    AC_MSG_ERROR([Cannot continue])
+  BOOT_JDK_PREFIX="$1"
+  BOOT_JDK_SUFFIX="$2"
+  BEST_JDK_FOUND=`$LS "$BOOT_JDK_PREFIX" 2> /dev/null | $GREP jdk | $SORT -r | $HEAD -n 1 `
+  if test "x$BEST_JDK_FOUND" != x; then
+    BOOT_JDK="${BOOT_JDK_PREFIX}/${BEST_JDK_FOUND}${BOOT_JDK_SUFFIX}"
+    if test -d "$BOOT_JDK"; then
+      BOOT_JDK_FOUND=maybe
+      AC_MSG_NOTICE([Found potential Boot JDK using well-known locations (in $BOOT_JDK_PREFIX)])
+    fi
+  fi
+])
+
+# Call BOOTJDK_FIND_BEST_JDK_IN_DIRECTORY, but use the given
+# environmental variable as base for where to look.
+# $1 Name of an environmal variable, assumed to point to the Program Files directory.
+AC_DEFUN([BOOTJDK_FIND_BEST_JDK_IN_WINDOWS_VIRTUAL_DIRECTORY],
+[
+  if test "x[$]$1" != x; then
+    BOOTJDK_FIND_BEST_JDK_IN_DIRECTORY([`$CYGPATH -u "[$]$1"`/Java])
+  fi
+])
+
+# Test: Is there a JDK installed in default, well-known locations?
+AC_DEFUN([BOOTJDK_CHECK_WELL_KNOWN_LOCATIONS],
+[
+  if test "x$OPENJDK_TARGET_OS" = xwindows; then
+    BOOTJDK_DO_CHECK([BOOTJDK_FIND_BEST_JDK_IN_WINDOWS_VIRTUAL_DIRECTORY([ProgramW6432])])
+    BOOTJDK_DO_CHECK([BOOTJDK_FIND_BEST_JDK_IN_WINDOWS_VIRTUAL_DIRECTORY([PROGRAMW6432])])
+    BOOTJDK_DO_CHECK([BOOTJDK_FIND_BEST_JDK_IN_WINDOWS_VIRTUAL_DIRECTORY([PROGRAMFILES])])
+    BOOTJDK_DO_CHECK([BOOTJDK_FIND_BEST_JDK_IN_WINDOWS_VIRTUAL_DIRECTORY([ProgramFiles])])
+    BOOTJDK_DO_CHECK([BOOTJDK_FIND_BEST_JDK_IN_DIRECTORY([/cygdrive/c/Program Files/Java])])
+  elif test "x$OPENJDK_TARGET_OS" = xmacosx; then
+    BOOTJDK_DO_CHECK([BOOTJDK_FIND_BEST_JDK_IN_DIRECTORY([/Library/Java/JavaVirtualMachines],[/Contents/Home])])
+    BOOTJDK_DO_CHECK([BOOTJDK_FIND_BEST_JDK_IN_DIRECTORY([/System/Library/Java/JavaVirtualMachines],[/Contents/Home])])
+  fi
+])
+
+# Check that a command-line tool in the Boot JDK is correct
+# $1 = name of variable to assign
+# $2 = name of binary
+AC_DEFUN([BOOTJDK_CHECK_TOOL_IN_BOOTJDK],
+[
+  AC_MSG_CHECKING([for $2 in Boot JDK])
+  $1=$BOOT_JDK/bin/$2
+  if test ! -x [$]$1; then
+      AC_MSG_RESULT(not found)
+      AC_MSG_NOTICE([Your Boot JDK seems broken. This might be fixed by explicitely setting --with-boot-jdk])
+      AC_MSG_ERROR([Could not find $2 in the Boot JDK])
+  fi
+  AC_MSG_RESULT(ok)
 ])
 
 ###############################################################################
@@ -51,204 +215,74 @@
 BOOT_JDK_FOUND=no
 AC_ARG_WITH(boot-jdk, [AS_HELP_STRING([--with-boot-jdk],
     [path to Boot JDK (used to bootstrap build) @<:@probed@:>@])])
-                    
-if test "x$with_boot_jdk" != x; then
-    BOOT_JDK=$with_boot_jdk
-    BOOT_JDK_FOUND=yes
-fi
-if test "x$BOOT_JDK_FOUND" = xno; then
-    BDEPS_CHECK_MODULE(BOOT_JDK, boot-jdk, xxx, [BOOT_JDK_FOUND=yes], [BOOT_JDK_FOUND=no])
-fi
 
-if test "x$BOOT_JDK_FOUND" = xno; then
-    if test "x$JAVA_HOME" != x; then
-        if test ! -d "$JAVA_HOME"; then
-            AC_MSG_NOTICE([Your JAVA_HOME points to a non-existing directory!])
-            BOOTJDK_MISSING_ERROR
-        fi
-        # Aha, the user has set a JAVA_HOME
-        # let us use that as the Boot JDK.
-        BOOT_JDK="$JAVA_HOME"
-        BOOT_JDK_FOUND=yes
-        # To be on the safe side, lets check that it is a JDK.
-        if test -x "$BOOT_JDK/bin/javac" && test -x "$BOOT_JDK/bin/java"; then
-            JAVAC="$BOOT_JDK/bin/javac"
-            JAVA="$BOOT_JDK/bin/java"
-            BOOT_JDK_FOUND=yes
-        else
-            AC_MSG_NOTICE([Your JAVA_HOME points to a JRE! The build needs a JDK! Please point JAVA_HOME to a JDK. JAVA_HOME=[$]JAVA_HOME])
-            BOOTJDK_MISSING_ERROR
-        fi            
-    fi
-fi
+# We look for the Boot JDK through various means, going from more certain to
+# more of a guess-work. After each test, BOOT_JDK_FOUND is set to "yes" if
+# we detected something (if so, the path to the jdk is in BOOT_JDK). But we 
+# must check if this is indeed valid; otherwise we'll continue looking.
 
-if test "x$BOOT_JDK_FOUND" = xno; then
-    AC_PATH_PROG(JAVAC_CHECK, javac)
-    AC_PATH_PROG(JAVA_CHECK, java)
-    BINARY="$JAVAC_CHECK"
-    if test "x$JAVAC_CHECK" = x; then
-        BINARY="$JAVA_CHECK"
-    fi
-    if test "x$BINARY" != x; then
-        # So there is a java(c) binary, it might be part of a JDK.
-        # Lets find the JDK/JRE directory by following symbolic links.
-        # Linux/GNU systems often have links from /usr/bin/java to 
-        # /etc/alternatives/java to the real JDK binary.
-	WHICHCMD_SPACESAFE(BINARY,[path to javac])
-        REMOVE_SYMBOLIC_LINKS(BINARY)
-        BOOT_JDK=`dirname $BINARY`
-        BOOT_JDK=`cd $BOOT_JDK/..; pwd`
-        if test -x $BOOT_JDK/bin/javac && test -x $BOOT_JDK/bin/java; then
-            JAVAC=$BOOT_JDK/bin/javac
-            JAVA=$BOOT_JDK/bin/java
-            BOOT_JDK_FOUND=yes
-        fi
-    fi
-fi
-
-if test "x$BOOT_JDK_FOUND" = xno; then
-    # Try the MacOSX way.
-    if test -x /usr/libexec/java_home; then
-        BOOT_JDK=`/usr/libexec/java_home`
-        if test -x $BOOT_JDK/bin/javac && test -x $BOOT_JDK/bin/java; then
-            JAVAC=$BOOT_JDK/bin/javac
-            JAVA=$BOOT_JDK/bin/java
-            BOOT_JDK_FOUND=yes
-        fi
-    fi
+# Test: Is bootjdk explicitely set by command line arguments?
+BOOTJDK_DO_CHECK([BOOTJDK_CHECK_ARGUMENTS])
+if test "x$with_boot_jdk" != x && test "x$BOOT_JDK_FOUND" = xno; then
+  # Having specified an argument which is incorrect will produce an instant failure;
+  # we should not go on looking
+  AC_MSG_ERROR([The path given by --with-boot-jdk does not contain a valid Boot JDK])
 fi
 
+# Test: Is bootjdk available from builddeps?
+BOOTJDK_DO_CHECK([BOOTJDK_CHECK_BUILDDEPS])
+
+# Test: Is $JAVA_HOME set?
+BOOTJDK_DO_CHECK([BOOTJDK_CHECK_JAVA_HOME])
+
+# Test: Is there a /usr/libexec/java_home? (Typically on MacOSX)
+BOOTJDK_DO_CHECK([BOOTJDK_CHECK_LIBEXEC_JAVA_HOME])
+
+# Test: Is there a java or javac in the PATH, which is a symlink to the JDK?
+BOOTJDK_DO_CHECK([BOOTJDK_CHECK_JAVA_IN_PATH_IS_SYMLINK])
+
+# Test: Is there a JDK installed in default, well-known locations?
+BOOTJDK_DO_CHECK([BOOTJDK_CHECK_WELL_KNOWN_LOCATIONS])
+
+# If we haven't found anything yet, we've truly lost. Give up.
 if test "x$BOOT_JDK_FOUND" = xno; then
-    AC_PATH_PROG(JAVA_CHECK, java)
-    if test "x$JAVA_CHECK" != x; then
-        # There is a java in the path. But apparently we have not found a javac 
-        # in the path, since that would have been tested earlier.
-        if test "x$OPENJDK_TARGET_OS" = xwindows; then
-            # Now if this is a windows platform. The default installation of a JDK
-            # actually puts the JRE in the path and keeps the JDK out of the path!
-            # Go look in the default installation location.
-            BOOT_JDK=/cygdrive/c/Program\ Files/Java/`ls /cygdrive/c/Program\ Files/Java | grep jdk | sort -r | head --lines 1`
-            if test -d "$BOOT_JDK"; then
-                BOOT_JDK_FOUND=yes
-            fi
-        fi
-        if test "x$BOOT_JDK_FOUND" = xno; then
-            HELP_MSG_MISSING_DEPENDENCY([openjdk])
-            AC_MSG_NOTICE([Found a JRE, not not a JDK! Please remove the JRE from your path and put a JDK there instead. $HELP_MSG])
-            BOOTJDK_MISSING_ERROR
-        fi
-    else
-        HELP_MSG_MISSING_DEPENDENCY([openjdk])
-        AC_MSG_NOTICE([Could not find a JDK. $HELP_MSG])
-        BOOTJDK_MISSING_ERROR
-    fi
+  HELP_MSG_MISSING_DEPENDENCY([openjdk])
+  AC_MSG_NOTICE([Could not find a valid Boot JDK. $HELP_MSG])
+  AC_MSG_NOTICE([This might be fixed by explicitely setting --with-boot-jdk])
+  AC_MSG_ERROR([Cannot continue])
 fi
 
-BOOTJDK_WIN_FIX_PATH(BOOT_JDK)
-
-# Now see if we can find the rt.jar, or its nearest equivalent.
+# Setup proper paths for what we found
 BOOT_RTJAR="$BOOT_JDK/jre/lib/rt.jar"
-SPACESAFE(BOOT_RTJAR,[the path to the Boot JDK rt.jar (or nearest equivalent)])
-
-BOOT_TOOLSJAR="$BOOT_JDK/lib/tools.jar"
-SPACESAFE(BOOT_TOOLSJAR,[the path to the Boot JDK tools.jar (or nearest equivalent)])
-
-if test ! -f $BOOT_RTJAR; then
+if test ! -f "$BOOT_RTJAR"; then
     # On MacOSX it is called classes.jar
-    BOOT_RTJAR=$BOOT_JDK/../Classes/classes.jar
-    if test ! -f $BOOT_RTJAR; then
-        AC_MSG_NOTICE([Cannot find the rt.jar or its equivalent!])
-        AC_MSG_NOTICE([This typically means that configure failed to automatically find a suitable Boot JDK])
-        BOOTJDK_MISSING_ERROR
+    BOOT_RTJAR="$BOOT_JDK/../Classes/classes.jar"
+    if test -f "$BOOT_RTJAR"; then
+      # Remove the .. 
+      BOOT_RTJAR="`cd ${BOOT_RTJAR%/*} && pwd`/${BOOT_RTJAR##*/}"
     fi
-    # Remove the .. 
-    BOOT_RTJAR="`cd ${BOOT_RTJAR%/*} && pwd`/${BOOT_RTJAR##*/}"
-    # The tools.jar is part of classes.jar
-    BOOT_TOOLSJAR="$BOOT_RTJAR"
 fi
-
-AC_SUBST(BOOT_JDK)
+BOOT_TOOLSJAR="$BOOT_JDK/lib/tools.jar"
+BOOT_JDK="$BOOT_JDK"
 AC_SUBST(BOOT_RTJAR)
 AC_SUBST(BOOT_TOOLSJAR)
-AC_MSG_CHECKING([for Boot JDK])
-AC_MSG_RESULT([$BOOT_JDK])
-AC_MSG_CHECKING([for Boot rt.jar])
-AC_MSG_RESULT([$BOOT_RTJAR])
-AC_MSG_CHECKING([for Boot tools.jar])
-AC_MSG_RESULT([$BOOT_TOOLSJAR])
+AC_SUBST(BOOT_JDK)
 
-# Use the java tool from the Boot JDK.
-AC_MSG_CHECKING([for java in Boot JDK])
-JAVA=$BOOT_JDK/bin/java
-if test ! -x $JAVA; then
-    AC_MSG_NOTICE([Could not find a working java])
-    BOOTJDK_MISSING_ERROR
-fi
-BOOT_JDK_VERSION=`$JAVA -version 2>&1 | head -n 1`
-AC_MSG_RESULT([yes $BOOT_JDK_VERSION])
-AC_SUBST(JAVA)
+# Setup tools from the Boot JDK.
+BOOTJDK_CHECK_TOOL_IN_BOOTJDK(JAVA,java)
+BOOTJDK_CHECK_TOOL_IN_BOOTJDK(JAVAC,javac)
+BOOTJDK_CHECK_TOOL_IN_BOOTJDK(JAVAH,javah)
+BOOTJDK_CHECK_TOOL_IN_BOOTJDK(JAVAP,javap)
+BOOTJDK_CHECK_TOOL_IN_BOOTJDK(JAR,jar)
+BOOTJDK_CHECK_TOOL_IN_BOOTJDK(RMIC,rmic)
+BOOTJDK_CHECK_TOOL_IN_BOOTJDK(NATIVE2ASCII,native2ascii)
 
-# Extra M4 quote needed to protect [] in grep expression.
-[FOUND_VERSION_78=`echo $BOOT_JDK_VERSION | grep  '\"1\.[78]\.'`]
-if test "x$FOUND_VERSION_78" = x; then
-    HELP_MSG_MISSING_DEPENDENCY([openjdk])
-    AC_MSG_NOTICE([Your boot-jdk must be version 7 or 8. $HELP_MSG])
-    BOOTJDK_MISSING_ERROR
-fi
+# Finally, set some other options...
 
 # When compiling code to be executed by the Boot JDK, force jdk7 compatibility.
 BOOT_JDK_SOURCETARGET="-source 7 -target 7"
 AC_SUBST(BOOT_JDK_SOURCETARGET)
-
-# Use the javac tool from the Boot JDK.
-AC_MSG_CHECKING([for javac in Boot JDK])
-JAVAC=$BOOT_JDK/bin/javac
-if test ! -x $JAVAC; then
-    AC_MSG_ERROR([Could not find a working javac])
-fi
-AC_MSG_RESULT(yes)
-AC_SUBST(JAVAC)
 AC_SUBST(JAVAC_FLAGS)
-
-# Use the javah tool from the Boot JDK.
-AC_MSG_CHECKING([for javah in Boot JDK])
-JAVAH=$BOOT_JDK/bin/javah
-if test ! -x $JAVAH; then
-    AC_MSG_NOTICE([Could not find a working javah])
-    BOOTJDK_MISSING_ERROR
-fi
-AC_MSG_RESULT(yes)
-AC_SUBST(JAVAH)
-
-# Use the jar tool from the Boot JDK.
-AC_MSG_CHECKING([for jar in Boot JDK])
-JAR=$BOOT_JDK/bin/jar
-if test ! -x $JAR; then
-    AC_MSG_NOTICE([Could not find a working jar])
-    BOOTJDK_MISSING_ERROR
-fi
-AC_SUBST(JAR)
-AC_MSG_RESULT(yes)
-
-# Use the rmic tool from the Boot JDK.
-AC_MSG_CHECKING([for rmic in Boot JDK])
-RMIC=$BOOT_JDK/bin/rmic
-if test ! -x $RMIC; then
-    AC_MSG_NOTICE([Could not find a working rmic])
-    BOOTJDK_MISSING_ERROR
-fi
-AC_SUBST(RMIC)
-AC_MSG_RESULT(yes)
-
-# Use the native2ascii tool from the Boot JDK.
-AC_MSG_CHECKING([for native2ascii in Boot JDK])
-NATIVE2ASCII=$BOOT_JDK/bin/native2ascii
-if test ! -x $NATIVE2ASCII; then
-    AC_MSG_NOTICE([Could not find a working native2ascii])
-    BOOTJDK_MISSING_ERROR
-fi
-AC_MSG_RESULT(yes)
-AC_SUBST(NATIVE2ASCII)
 ])
 
 AC_DEFUN_ONCE([BOOTJDK_SETUP_BOOT_JDK_ARGUMENTS],
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/common/autoconf/bootcycle-spec.gmk.in	Wed Jul 05 18:22:52 2017 +0200
@@ -0,0 +1,43 @@
+#
+# Copyright (c) 2011, 2012, 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.
+#
+
+# Support for building boot cycle builds
+
+# First include the real base spec.gmk file
+include @SPEC@
+
+# Check that the user did not try to specify a different java to use for compiling.
+ifneq ($(firstword $(SJAVAC_SERVER_JAVA)),$(firstword $(JAVA)))
+  $(error Bootcycle builds are not possible if --with-sjavac-server-java is specified)
+endif
+
+# Override specific values to do a boot cycle build
+
+# The bootcycle build has a different output directory
+BUILD_OUTPUT:=@BUILD_OUTPUT@/bootcycle-build
+
+# Use a different Boot JDK
+BOOT_JDK:=@BUILD_OUTPUT@/images/j2sdk-image
+BOOT_RTJAR:=@BUILD_OUTPUT@/images/j2sdk-image/jre/lib/rt.jar
--- a/common/autoconf/build-aux/config.guess	Wed Jul 05 18:22:17 2017 +0200
+++ b/common/autoconf/build-aux/config.guess	Wed Jul 05 18:22:52 2017 +0200
@@ -22,17 +22,39 @@
 # questions.
 #
 
-# This is a wrapper for the config.guess from autoconf. The latter does not properly
-# detect amd64 systems, since that require isainfo instead of uname. Instead of patching
-# the autoconf system (which might easily get lost in a future update), we wrap it and
-# fix the broken property, if needed.
+# This is a wrapper for the config.guess from autoconf. The latter does not
+# properly detect 64 bit systems on all platforms. Instead of patching the
+# autoconf system (which might easily get lost in a future update), we wrap it
+# and fix the broken property, if needed.
 
 DIR=`dirname $0`
 OUT=`. $DIR/autoconf-config.guess`
+
+# Test and fix solaris on x86_64
 echo $OUT | grep i386-pc-solaris > /dev/null 2> /dev/null
 if test $? = 0; then
-  # isainfo -n returns either i386 or amd64 on Intel systems
+  # isainfo -n returns either i386 or amd64
   REAL_CPU=`isainfo -n`
   OUT=$REAL_CPU`echo $OUT | sed -e 's/[^-]*//'`
 fi
+
+# Test and fix solaris on sparcv9
+echo $OUT | grep sparc-sun-solaris > /dev/null 2> /dev/null
+if test $? = 0; then
+  # isainfo -n returns either sparc or sparcv9
+  REAL_CPU=`isainfo -n`
+  OUT=$REAL_CPU`echo $OUT | sed -e 's/[^-]*//'`
+fi
+
+# Test and fix cygwin on x86_64
+echo $OUT | grep 86-pc-cygwin > /dev/null 2> /dev/null
+if test $? = 0; then
+  case `echo $PROCESSOR_IDENTIFIER | cut -f1 -d' '` in
+    intel64|Intel64|INTEL64|em64t|EM64T|amd64|AMD64|8664|x86_64)
+      REAL_CPU=x86_64
+      OUT=$REAL_CPU`echo $OUT | sed -e 's/[^-]*//'`
+      ;;
+  esac
+fi  
+
 echo $OUT
--- a/common/autoconf/build-performance.m4	Wed Jul 05 18:22:17 2017 +0200
+++ b/common/autoconf/build-performance.m4	Wed Jul 05 18:22:52 2017 +0200
@@ -30,27 +30,19 @@
     FOUND_CORES=no
     
     if test -f /proc/cpuinfo; then
-        # Looks like a Linux system
+        # Looks like a Linux (or cygwin) system
         NUM_CORES=`cat /proc/cpuinfo  | grep -c processor`
         FOUND_CORES=yes
-    fi
-
-    if test -x /usr/sbin/psrinfo; then
+    elif test -x /usr/sbin/psrinfo; then
         # Looks like a Solaris system
         NUM_CORES=`LC_MESSAGES=C /usr/sbin/psrinfo -v | grep -c on-line`
         FOUND_CORES=yes
-    fi
-
-    if test -x /usr/sbin/system_profiler; then
+    elif test -x /usr/sbin/system_profiler; then
         # Looks like a MacOSX system
         NUM_CORES=`/usr/sbin/system_profiler -detailLevel full SPHardwareDataType | grep 'Cores' | awk  '{print [$]5}'`
         FOUND_CORES=yes
     fi
 
-    if test "x$build_os" = xwindows; then
-        NUM_CORES=4
-    fi
-
     # For c/c++ code we run twice as many concurrent build
     # jobs than we have cores, otherwise we will stall on io.
     CONCURRENT_BUILD_JOBS=`expr $NUM_CORES \* 2`
@@ -66,31 +58,26 @@
 AC_DEFUN([BPERF_CHECK_MEMORY_SIZE],
 [
     AC_MSG_CHECKING([for memory size])
-    # Default to 1024MB
+    # Default to 1024 MB
     MEMORY_SIZE=1024
     FOUND_MEM=no
     
-    if test -f /proc/cpuinfo; then
-        # Looks like a Linux system
+    if test -f /proc/meminfo; then
+        # Looks like a Linux (or cygwin) system
         MEMORY_SIZE=`cat /proc/meminfo | grep MemTotal | awk '{print [$]2}'`
         MEMORY_SIZE=`expr $MEMORY_SIZE / 1024`
         FOUND_MEM=yes
-    fi
-
-    if test -x /usr/sbin/prtconf; then
+    elif test -x /usr/sbin/prtconf; then
         # Looks like a Solaris system
         MEMORY_SIZE=`/usr/sbin/prtconf | grep "Memory size" | awk '{ print [$]3 }'`
         FOUND_MEM=yes
-    fi
-
-    if test -x /usr/sbin/system_profiler; then
+    elif test -x /usr/sbin/system_profiler; then
         # Looks like a MacOSX system
         MEMORY_SIZE=`/usr/sbin/system_profiler -detailLevel full SPHardwareDataType | grep 'Memory' | awk  '{print [$]2}'`
         MEMORY_SIZE=`expr $MEMORY_SIZE \* 1024`
         FOUND_MEM=yes
-    fi
-
-    if test "x$build_os" = xwindows; then
+    elif test "x$build_os" = xwindows; then
+        # Windows, but without cygwin
         MEMORY_SIZE=`systeminfo | grep 'Total Physical Memory:' | awk '{ print [$]4 }' | sed 's/,//'`
         FOUND_MEM=yes    
     fi
@@ -98,7 +85,7 @@
     if test "x$FOUND_MEM" = xyes; then
         AC_MSG_RESULT([$MEMORY_SIZE MB])
     else
-        AC_MSG_RESULT([could not detect memory size defaulting to 1024MB!])
+        AC_MSG_RESULT([could not detect memory size defaulting to 1024 MB!])
     fi 
 ])
 
@@ -240,46 +227,30 @@
 
 AC_DEFUN_ONCE([BPERF_SETUP_SMART_JAVAC],
 [
-AC_ARG_WITH(server-java, [AS_HELP_STRING([--with-server-java],
-	[use this java binary for running the javac background server and other long running java tasks in the build process,
-     e.g. ---with-server-java="/opt/jrockit/bin/java -server"])])
+AC_ARG_WITH(sjavac-server-java, [AS_HELP_STRING([--with-sjavac-server-java],
+	[use this java binary for running the sjavac background server and other long running java tasks in the build process,
+     e.g. ---with-sjavac-server-java="/opt/jrockit/bin/java -server"])])
 
-if test "x$with_server_java" != x; then
-    SERVER_JAVA="$with_server_java"
-    FOUND_VERSION=`$SERVER_JAVA -version 2>&1 | grep " version \""`
+if test "x$with_sjavac_server_java" != x; then
+    SJAVAC_SERVER_JAVA="$with_sjavac_server_java"
+    FOUND_VERSION=`$SJAVAC_SERVER_JAVA -version 2>&1 | grep " version \""`
     if test "x$FOUND_VERSION" = x; then
-        AC_MSG_ERROR([Could not execute server java: $SERVER_JAVA])
+        AC_MSG_ERROR([Could not execute server java: $SJAVAC_SERVER_JAVA])
     fi
 else
-    SERVER_JAVA=""
+    SJAVAC_SERVER_JAVA=""
     # Hotspot specific options.
-    ADD_JVM_ARG_IF_OK([-XX:+UseParallelOldGC],SERVER_JAVA,[$JAVA])
-    ADD_JVM_ARG_IF_OK([-verbosegc],SERVER_JAVA,[$JAVA])
+    ADD_JVM_ARG_IF_OK([-verbosegc],SJAVAC_SERVER_JAVA,[$JAVA])
     # JRockit specific options.
-    ADD_JVM_ARG_IF_OK([-Xverbose:gc],SERVER_JAVA,[$JAVA])
-    SERVER_JAVA="$JAVA $SERVER_JAVA"
+    ADD_JVM_ARG_IF_OK([-Xverbose:gc],SJAVAC_SERVER_JAVA,[$JAVA])
+    SJAVAC_SERVER_JAVA="$JAVA $SJAVAC_SERVER_JAVA"
 fi                    
-AC_SUBST(SERVER_JAVA)
+AC_SUBST(SJAVAC_SERVER_JAVA)
 
-AC_MSG_CHECKING([whether to use shared server for javac])
-AC_ARG_ENABLE([javac-server], [AS_HELP_STRING([--enable-javac-server],
-	[enable the shared javac server during the build process @<:@disabled@:>@])],
-	[ENABLE_JAVAC_SERVER="${enableval}"], [ENABLE_JAVAC_SERVER='no'])
-AC_MSG_RESULT([$ENABLE_JAVAC_SERVER])
-if test "x$ENABLE_JAVAC_SERVER" = xyes; then
-    JAVAC_USE_REMOTE=true
-    JAVAC_SERVERS="$OUTPUT_ROOT/javacservers"
-else
-    JAVAC_USE_REMOTE=false
-    JAVAC_SERVERS=
-fi
-AC_SUBST(JAVAC_USE_REMOTE)
-AC_SUBST(JAVAC_SERVERS)
-
-AC_ARG_WITH(javac-server-cores, [AS_HELP_STRING([--with-javac-server-cores],
-	[use at most this number of concurrent threads on the javac server @<:@probed@:>@])])
-if test "x$with_javac_server_cores" != x; then
-    JAVAC_SERVER_CORES="$with_javac_server_cores"
+AC_ARG_WITH(sjavac-server-cores, [AS_HELP_STRING([--with-sjavac-server-cores],
+	[use at most this number of concurrent threads on the sjavac server @<:@probed@:>@])])
+if test "x$with_sjavac_server_cores" != x; then
+    SJAVAC_SERVER_CORES="$with_sjavac_server_cores"
 else
     if test "$NUM_CORES" -gt 16; then
         # We set this arbitrary limit because we want to limit the heap
@@ -287,86 +258,49 @@
         # In the future we will make the javac compilers in the server
         # share more and more state, thus enabling us to use more and
         # more concurrent threads in the server.
-        JAVAC_SERVER_CORES="16"
+        SJAVAC_SERVER_CORES="16"
     else
-        JAVAC_SERVER_CORES="$NUM_CORES"
+        SJAVAC_SERVER_CORES="$NUM_CORES"
     fi
 
     if test "$MEMORY_SIZE" -gt "17000"; then
         MAX_HEAP_MEM=10000
-        ADD_JVM_ARG_IF_OK([-d64],SERVER_JAVA,[$SERVER_JAVA])
-        ADD_JVM_ARG_IF_OK([-Xms10G -Xmx10G],SERVER_JAVA,[$SERVER_JAVA])
-        ADD_JVM_ARG_IF_OK([-Xmn2G],SERVER_JAVA,[$SERVER_JAVA])
+        ADD_JVM_ARG_IF_OK([-d64],SJAVAC_SERVER_JAVA,[$SJAVAC_SERVER_JAVA])
+        ADD_JVM_ARG_IF_OK([-Xms10G -Xmx10G],SJAVAC_SERVER_JAVA,[$SJAVAC_SERVER_JAVA])
     elif test "$MEMORY_SIZE" -gt "10000"; then
         MAX_HEAP_MEM=6000
-        ADD_JVM_ARG_IF_OK([-d64],SERVER_JAVA,[$SERVER_JAVA])
-        ADD_JVM_ARG_IF_OK([-Xms6G -Xmx6G],SERVER_JAVA,[$SERVER_JAVA])
-        ADD_JVM_ARG_IF_OK([-Xmn1G],SERVER_JAVA,[$SERVER_JAVA])
+        ADD_JVM_ARG_IF_OK([-d64],SJAVAC_SERVER_JAVA,[$SJAVAC_SERVER_JAVA])
+        ADD_JVM_ARG_IF_OK([-Xms6G -Xmx6G],SJAVAC_SERVER_JAVA,[$SJAVAC_SERVER_JAVA])
     elif test "$MEMORY_SIZE" -gt "5000"; then
         MAX_HEAP_MEM=3000
-        ADD_JVM_ARG_IF_OK([-d64],SERVER_JAVA,[$SERVER_JAVA])
-        ADD_JVM_ARG_IF_OK([-Xms1G -Xmx3G],SERVER_JAVA,[$SERVER_JAVA])
-        ADD_JVM_ARG_IF_OK([-Xmn256M],SERVER_JAVA,[$SERVER_JAVA])
+        ADD_JVM_ARG_IF_OK([-d64],SJAVAC_SERVER_JAVA,[$SJAVAC_SERVER_JAVA])
+        ADD_JVM_ARG_IF_OK([-Xms1G -Xmx3G],SJAVAC_SERVER_JAVA,[$SJAVAC_SERVER_JAVA])
     elif test "$MEMORY_SIZE" -gt "3800"; then
         MAX_HEAP_MEM=2500
-        ADD_JVM_ARG_IF_OK([-Xms1G -Xmx2500M],SERVER_JAVA,[$SERVER_JAVA])
-        ADD_JVM_ARG_IF_OK([-Xmn256M],SERVER_JAVA,[$SERVER_JAVA])
+        ADD_JVM_ARG_IF_OK([-Xms1G -Xmx2500M],SJAVAC_SERVER_JAVA,[$SJAVAC_SERVER_JAVA])
     elif test "$MEMORY_SIZE" -gt "1900"; then
         MAX_HEAP_MEM=1200
-        ADD_JVM_ARG_IF_OK([-Xms700M -Xmx1200M],SERVER_JAVA,[$SERVER_JAVA])
-        ADD_JVM_ARG_IF_OK([-Xmn256M],SERVER_JAVA,[$SERVER_JAVA])
+        ADD_JVM_ARG_IF_OK([-Xms700M -Xmx1400M],SJAVAC_SERVER_JAVA,[$SJAVAC_SERVER_JAVA])
     elif test "$MEMORY_SIZE" -gt "1000"; then
         MAX_HEAP_MEM=900
-        ADD_JVM_ARG_IF_OK([-Xms400M -Xmx900M],SERVER_JAVA,[$SERVER_JAVA])
-        ADD_JVM_ARG_IF_OK([-Xmn128M],SERVER_JAVA,[$SERVER_JAVA])
+        ADD_JVM_ARG_IF_OK([-Xms400M -Xmx1100M],SJAVAC_SERVER_JAVA,[$SJAVAC_SERVER_JAVA])
     else
         MAX_HEAP_MEM=512
-        ADD_JVM_ARG_IF_OK([-Xms256M -Xmx512M],SERVER_JAVA,[$SERVER_JAVA])
-        ADD_JVM_ARG_IF_OK([-Xmn128M],SERVER_JAVA,[$SERVER_JAVA])
+        ADD_JVM_ARG_IF_OK([-Xms256M -Xmx512M],SJAVAC_SERVER_JAVA,[$SJAVAC_SERVER_JAVA])
     fi
 
+    ADD_JVM_ARG_IF_OK([-XX:PermSize=32m],SJAVAC_SERVER_JAVA,[$SJAVAC_SERVER_JAVA])
+    ADD_JVM_ARG_IF_OK([-XX:MaxPermSize=160m],SJAVAC_SERVER_JAVA,[$SJAVAC_SERVER_JAVA])
+    ADD_JVM_ARG_IF_OK([-XX:ThreadStackSize=$STACK_SIZE],SJAVAC_SERVER_JAVA,[$SJAVAC_SERVER_JAVA])
+
     MAX_COMPILERS_IN_HEAP=`expr $MAX_HEAP_MEM / 501`
-    if test "$JAVAC_SERVER_CORES" -gt "$MAX_COMPILERS_IN_HEAP"; then
+    if test "$SJAVAC_SERVER_CORES" -gt "$MAX_COMPILERS_IN_HEAP"; then
         AC_MSG_CHECKING([if number of server cores must be reduced])
-        JAVAC_SERVER_CORES="$MAX_COMPILERS_IN_HEAP"
-        AC_MSG_RESULT([yes, to $JAVAC_SERVER_CORES with max heap size $MAX_HEAP_MEM MB])
+        SJAVAC_SERVER_CORES="$MAX_COMPILERS_IN_HEAP"
+        AC_MSG_RESULT([yes, to $SJAVAC_SERVER_CORES with max heap size $MAX_HEAP_MEM MB])
     fi
 fi                    
-AC_SUBST(JAVAC_SERVER_CORES)
-
-AC_MSG_CHECKING([whether to track dependencies between Java packages])
-AC_ARG_ENABLE([javac-deps], [AS_HELP_STRING([--enable-javac-deps],
-	[enable the dependency tracking between Java packages @<:@disabled@:>@])],
-	[ENABLE_JAVAC_DEPS="${enableval}"], [ENABLE_JAVAC_DEPS='no'])
-AC_MSG_RESULT([$ENABLE_JAVAC_DEPS])
-if test "x$ENABLE_JAVAC_DEPS" = xyes; then
-    JAVAC_USE_DEPS=true
-else
-    JAVAC_USE_DEPS=false
-fi
-AC_SUBST(JAVAC_USE_DEPS)
-
-AC_MSG_CHECKING([whether to use multiple cores for javac compilation])
-AC_ARG_ENABLE([javac-multi-core], [AS_HELP_STRING([--enable-javac-multi-core],
-	[compile Java packages concurrently @<:@disabled@:>@])],
-	[ENABLE_JAVAC_MULTICORE="${enableval}"], [ENABLE_JAVAC_MULTICORE='no'])
-AC_MSG_RESULT([$ENABLE_JAVAC_MULTICORE])
-if test "x$ENABLE_JAVAC_MULTICORE" = xyes; then
-    JAVAC_USE_MODE=MULTI_CORE_CONCURRENT
-else
-    JAVAC_USE_MODE=SINGLE_THREADED_BATCH
-    if test "x$ENABLE_JAVAC_DEPS" = xyes; then
-        AC_MSG_WARN([Dependency tracking is not supported with single threaded batch compiles of Java source roots. Please add --disable-javac-deps to your configure options.])
-        AC_MSG_WARN([Disabling dependency tracking for you now.])
-        JAVAC_USE_DEPS=false
-    fi
-    if test "x$ENABLE_JAVAC_SERVER" = xyes; then
-        AC_MSG_WARN([The javac server will not be used since single threaded batch compiles are run within their own JVM. Please add --disable-javac-server to your configure options.])
-        AC_MSG_WARN([Disabling javac server for you now.])
-        JAVAC_USE_REMOTE=false
-    fi
-fi
-AC_SUBST(JAVAC_USE_MODE)
+AC_SUBST(SJAVAC_SERVER_CORES)
 
 AC_MSG_CHECKING([whether to use sjavac])
 AC_ARG_ENABLE([sjavac], [AS_HELP_STRING([--enable-sjavac],
@@ -375,4 +309,11 @@
 AC_MSG_RESULT([$ENABLE_SJAVAC])
 AC_SUBST(ENABLE_SJAVAC)
 
+if test "x$ENABLE_SJAVAC" = xyes; then
+    SJAVAC_SERVER_DIR="$OUTPUT_ROOT/javacservers"
+else
+    SJAVAC_SERVER_DIR=
+fi
+AC_SUBST(SJAVAC_SERVER_DIR)
+
 ])
--- a/common/autoconf/builddeps.conf.example	Wed Jul 05 18:22:17 2017 +0200
+++ b/common/autoconf/builddeps.conf.example	Wed Jul 05 18:22:52 2017 +0200
@@ -31,7 +31,7 @@
 
 # Translate a configuration triplet/quadruplet into something
 # known by this configuration file.
-# If no rewrite was found, then rewritten_target=${OPENJDK_TARGET_SYSTEM}
+# If no rewrite was found, then rewritten_target=${OPENJDK_TARGET_AUTOCONF_NAME}
 REWRITE_i686_pc_linux_gnu=i686-unknown-linux-gnu
 REWRITE_i386_pc_solaris2_10=i686-sun-solaris2_10
  
--- a/common/autoconf/builddeps.m4	Wed Jul 05 18:22:17 2017 +0200
+++ b/common/autoconf/builddeps.m4	Wed Jul 05 18:22:52 2017 +0200
@@ -52,19 +52,19 @@
         fi
         # Create build and target names that use _ instead of "-" and ".".
         # This is necessary to use them in variable names.
-        build_var=`echo ${OPENJDK_BUILD_SYSTEM} | tr '-' '_' | tr '.' '_'`
-        target_var=`echo ${OPENJDK_TARGET_SYSTEM} | tr '-' '_' | tr '.' '_'`
+        build_var=`echo ${OPENJDK_BUILD_AUTOCONF_NAME} | tr '-' '_' | tr '.' '_'`
+        target_var=`echo ${OPENJDK_TARGET_AUTOCONF_NAME} | tr '-' '_' | tr '.' '_'`
         # Extract rewrite information for build and target
         eval rewritten_build=\${REWRITE_${build_var}}
         if test "x$rewritten_build" = x; then
-            rewritten_build=${OPENJDK_BUILD_SYSTEM}
+            rewritten_build=${OPENJDK_BUILD_AUTOCONF_NAME}
             echo Build stays the same $rewritten_build
         else
             echo Rewriting build for builddeps into $rewritten_build
         fi
         eval rewritten_target=\${REWRITE_${target_var}}
         if test "x$rewritten_target" = x; then
-            rewritten_target=${OPENJDK_TARGET_SYSTEM}
+            rewritten_target=${OPENJDK_TARGET_AUTOCONF_NAME}
             echo Target stays the same $rewritten_target
         else
             echo Rewriting target for builddeps into $rewritten_target
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/common/autoconf/compare.sh.in	Wed Jul 05 18:22:52 2017 +0200
@@ -0,0 +1,1669 @@
+#!/bin/bash
+#
+# Copyright (c) 2012, 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.
+#
+# 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 script is processed by configure before it's usable. It is run from 
+# the root of the build directory.
+
+
+##########################################################################################
+# Substitutions from autoconf
+
+LEGACY_BUILD_DIR=@OPENJDK_TARGET_OS@-@OPENJDK_TARGET_CPU_LEGACY@
+
+OPENJDK_TARGET_OS="@OPENJDK_TARGET_OS@"
+OPENJDK_TARGET_CPU="@OPENJDK_TARGET_CPU@"
+
+AWK="@AWK@"
+CAT="@CAT@"
+CMP="@CMP@"
+CP="@CP@"
+CUT="@CUT@"
+DIFF="@DIFF@"
+DUMPBIN="@UNCYGDRIVE@ @DUMPBIN@"
+EXPR="@EXPR@"
+FILE="@FILE@"
+FIND="@FIND@"
+GREP="@GREP@"
+JAVAP="@UNCYGDRIVE@ @BOOT_JDK@/bin/javap"
+LDD="@LDD@"
+MKDIR="@MKDIR@"
+NM="@NM@"
+OBJDUMP="@OBJDUMP@"
+OTOOL="@OTOOL@"
+PRINTF="@PRINTF@"
+READELF="@READELF@"
+RM="@RM@"
+SED="@SED@"
+SORT="@SORT@"
+STRIP="@POST_STRIP_CMD@"
+TEE="@TEE@"
+UNIQ="@UNIQ@"
+UNZIP="@UNZIP@"
+
+SRC_ROOT="@SRC_ROOT@"
+
+if [ "$OPENJDK_TARGET_OS" = "macosx" ]; then
+    READELF_CMD="otool -v -V -h -X -t -d"
+elif [ -n "$READELF" ] && [ "$OPENJDK_TARGET_OS" != "windows" ]; then
+    READELF_CMD="$READELF -a"
+fi
+
+if [ "$OPENJDK_TARGET_OS" = "macosx" ]; then
+    LDD_CMD="$OTOOL -L"
+elif [ -n "$LDD" ]; then
+    LDD_CMD="$LDD"
+fi
+
+##########################################################################################
+# Diff exceptions
+
+if [ "$OPENJDK_TARGET_OS" = "linux" ] && [ "$OPENJDK_TARGET_CPU" = "x86_64" ]; then
+STRIP_BEFORE_COMPARE="
+./demo/jvmti/compiledMethodLoad/lib/libcompiledMethodLoad.so
+./demo/jvmti/gctest/lib/libgctest.so
+./demo/jvmti/heapTracker/lib/libheapTracker.so
+./demo/jvmti/heapViewer/lib/libheapViewer.so
+./demo/jvmti/hprof/lib/libhprof.so
+./demo/jvmti/minst/lib/libminst.so
+./demo/jvmti/mtrace/lib/libmtrace.so
+./demo/jvmti/versionCheck/lib/libversionCheck.so
+./demo/jvmti/waiters/lib/libwaiters.so
+"
+
+KNOWN_BIN_DIFF="
+"
+
+ACCEPTED_BIN_DIFF="
+./demo/jvmti/compiledMethodLoad/lib/libcompiledMethodLoad.so
+./demo/jvmti/gctest/lib/libgctest.so
+./demo/jvmti/heapTracker/lib/libheapTracker.so
+./demo/jvmti/heapViewer/lib/libheapViewer.so
+./demo/jvmti/hprof/lib/libhprof.so
+./demo/jvmti/minst/lib/libminst.so
+./demo/jvmti/mtrace/lib/libmtrace.so
+./demo/jvmti/versionCheck/lib/libversionCheck.so
+./demo/jvmti/waiters/lib/libwaiters.so
+./jre/lib/amd64/libattach.so
+./jre/lib/amd64/libdt_socket.so
+./jre/lib/amd64/libhprof.so
+./jre/lib/amd64/libinstrument.so
+./jre/lib/amd64/libjava_crw_demo.so
+./jre/lib/amd64/libjsdt.so
+./jre/lib/amd64/libjsig.so
+./jre/lib/amd64/libmanagement.so
+./jre/lib/amd64/libnpt.so
+./jre/lib/amd64/libsaproc.so
+./jre/lib/amd64/libverify.so
+./jre/lib/amd64/server/libjsig.so
+./jre/lib/amd64/server/libjvm.so
+./bin/appletviewer
+./bin/extcheck
+./bin/idlj
+./bin/jar
+./bin/jarsigner
+./bin/java
+./bin/javac
+./bin/javadoc
+./bin/javah
+./bin/javap
+./bin/jcmd
+./bin/jconsole
+./bin/jdb
+./bin/jhat
+./bin/jinfo
+./bin/jmap
+./bin/jps
+./bin/jrunscript
+./bin/jsadebugd
+./bin/jstack
+./bin/jstat
+./bin/jstatd
+./bin/keytool
+./bin/native2ascii
+./bin/orbd
+./bin/pack200
+./bin/policytool
+./bin/rmic
+./bin/rmid
+./bin/rmiregistry
+./bin/schemagen
+./bin/serialver
+./bin/servertool
+./bin/tnameserv
+./bin/wsgen
+./bin/wsimport
+./bin/xjc
+./jre/bin/java
+./jre/bin/keytool
+./jre/bin/orbd
+./jre/bin/pack200
+./jre/bin/policytool
+./jre/bin/rmid
+./jre/bin/rmiregistry
+./jre/bin/servertool
+./jre/bin/tnameserv
+"
+
+KNOWN_SIZE_DIFF="
+"
+
+KNOWN_SYM_DIFF="
+"
+
+KNOWN_ELF_DIFF="
+./demo/jvmti/heapTracker/lib/libheapTracker.so
+./demo/jvmti/hprof/lib/libhprof.so
+./demo/jvmti/waiters/lib/libwaiters.so
+"
+fi
+
+if [ "$OPENJDK_TARGET_OS" = "solaris" ] && [ "$OPENJDK_TARGET_CPU" = "x86" ]; then
+
+STRIP_BEFORE_COMPARE="
+./demo/jni/Poller/lib/libPoller.so
+./demo/jvmti/compiledMethodLoad/lib/libcompiledMethodLoad.so
+./demo/jvmti/gctest/lib/libgctest.so
+./demo/jvmti/heapTracker/lib/libheapTracker.so
+./demo/jvmti/heapViewer/lib/libheapViewer.so
+./demo/jvmti/hprof/lib/libhprof.so
+./demo/jvmti/minst/lib/libminst.so
+./demo/jvmti/mtrace/lib/libmtrace.so
+./demo/jvmti/versionCheck/lib/libversionCheck.so
+./demo/jvmti/waiters/lib/libwaiters.so
+./jre/lib/i386/jexec
+"
+
+SORT_SYMBOLS="
+./jre/lib/i386/client/libjvm.so
+./jre/lib/i386/server/libjvm.so
+"
+
+SKIP_BIN_DIFF="true"
+
+ACCEPTED_SMALL_SIZE_DIFF="
+./demo/jni/Poller/lib/libPoller.so
+./demo/jvmti/compiledMethodLoad/lib/libcompiledMethodLoad.so
+./demo/jvmti/gctest/lib/libgctest.so
+./demo/jvmti/heapTracker/lib/libheapTracker.so
+./demo/jvmti/heapViewer/lib/libheapViewer.so
+./demo/jvmti/hprof/lib/libhprof.so
+./demo/jvmti/minst/lib/libminst.so
+./demo/jvmti/mtrace/lib/libmtrace.so
+./demo/jvmti/versionCheck/lib/libversionCheck.so
+./demo/jvmti/waiters/lib/libwaiters.so
+./jre/lib/i386/client/libjvm.so
+./jre/lib/i386/jli/libjli.so
+./jre/lib/i386/libJdbcOdbc.so
+./jre/lib/i386/libattach.so
+./jre/lib/i386/libawt.so
+./jre/lib/i386/libawt_headless.so
+./jre/lib/i386/libawt_xawt.so
+./jre/lib/i386/libdcpr.so
+./jre/lib/i386/libdt_socket.so
+./jre/lib/i386/libfontmanager.so
+./jre/lib/i386/libhprof.so
+./jre/lib/i386/libinstrument.so
+./jre/lib/i386/libj2gss.so
+./jre/lib/i386/libj2pcsc.so
+./jre/lib/i386/libj2pkcs11.so
+./jre/lib/i386/libj2ucrypto.so
+./jre/lib/i386/libjaas_unix.so
+./jre/lib/i386/libjava.so
+./jre/lib/i386/libjava_crw_demo.so
+./jre/lib/i386/libjawt.so
+./jre/lib/i386/libjdwp.so
+./jre/lib/i386/libjfr.so
+./jre/lib/i386/libjpeg.so
+./jre/lib/i386/libjsdt.so
+./jre/lib/i386/libjsound.so
+./jre/lib/i386/libkcms.so
+./jre/lib/i386/libmanagement.so
+./jre/lib/i386/libmlib_image.so
+./jre/lib/i386/libnet.so
+./jre/lib/i386/libnio.so
+./jre/lib/i386/libnpt.so
+./jre/lib/i386/libsctp.so
+./jre/lib/i386/libsplashscreen.so
+./jre/lib/i386/libsunec.so
+./jre/lib/i386/libsunwjdga.so
+./jre/lib/i386/libt2k.so
+./jre/lib/i386/libunpack.so
+./jre/lib/i386/libverify.so
+./jre/lib/i386/libzip.so
+./jre/lib/i386/server/libjvm.so
+./bin/appletviewer
+./bin/extcheck
+./bin/idlj
+./bin/jar
+./bin/jarsigner
+./bin/java
+./bin/javac
+./bin/javadoc
+./bin/javah
+./bin/javap
+./bin/jcmd
+./bin/jconsole
+./bin/jdb
+./bin/jhat
+./bin/jinfo
+./bin/jmap
+./bin/jps
+./bin/jrunscript
+./bin/jsadebugd
+./bin/jstack
+./bin/jstat
+./bin/jstatd
+./bin/keytool
+./bin/native2ascii
+./bin/orbd
+./bin/pack200
+./bin/policytool
+./bin/rmic
+./bin/rmid
+./bin/rmiregistry
+./bin/schemagen
+./bin/serialver
+./bin/servertool
+./bin/tnameserv
+./bin/unpack200
+./bin/wsgen
+./bin/wsimport
+./bin/xjc
+./jre/bin/java
+./jre/bin/keytool
+./jre/bin/orbd
+./jre/bin/pack200
+./jre/bin/policytool
+./jre/bin/rmid
+./jre/bin/rmiregistry
+./jre/bin/servertool
+./jre/bin/tnameserv
+./jre/bin/unpack200
+./jre/lib/i386/jexec
+"
+
+SKIP_ELF_DIFF="true"
+
+# libjvm.so differs in the random 15 char prefix on some symbols.
+ACCEPTED_DIS_DIFF="
+./jre/lib/i386/client/libjvm.so
+./jre/lib/i386/server/libjvm.so
+"
+
+fi
+
+if [ "$OPENJDK_TARGET_OS" = "solaris" ] && [ "$OPENJDK_TARGET_CPU" = "x86_64" ]; then
+
+STRIP_BEFORE_COMPARE="
+./demo/jni/Poller/lib/amd64/libPoller.so
+./demo/jvmti/compiledMethodLoad/lib/amd64/libcompiledMethodLoad.so
+./demo/jvmti/gctest/lib/amd64/libgctest.so
+./demo/jvmti/heapTracker/lib/amd64/libheapTracker.so
+./demo/jvmti/heapViewer/lib/amd64/libheapViewer.so
+./demo/jvmti/hprof/lib/amd64/libhprof.so
+./demo/jvmti/minst/lib/amd64/libminst.so
+./demo/jvmti/mtrace/lib/amd64/libmtrace.so
+./demo/jvmti/versionCheck/lib/amd64/libversionCheck.so
+./demo/jvmti/waiters/lib/amd64/libwaiters.so
+"
+
+SORT_SYMBOLS="
+./jre/lib/amd64/server/libjvm.so
+"
+
+SKIP_BIN_DIFF="true"
+
+ACCEPTED_SMALL_SIZE_DIFF="
+./demo/jni/Poller/lib/amd64/libPoller.so
+./demo/jvmti/compiledMethodLoad/lib/amd64/libcompiledMethodLoad.so
+./demo/jvmti/gctest/lib/amd64/libgctest.so
+./demo/jvmti/heapTracker/lib/amd64/libheapTracker.so
+./demo/jvmti/heapViewer/lib/amd64/libheapViewer.so
+./demo/jvmti/hprof/lib/amd64/libhprof.so
+./demo/jvmti/minst/lib/amd64/libminst.so
+./demo/jvmti/mtrace/lib/amd64/libmtrace.so
+./demo/jvmti/versionCheck/lib/amd64/libversionCheck.so
+./demo/jvmti/waiters/lib/amd64/libwaiters.so
+./jre/lib/amd64/jli/libjli.so
+./jre/lib/amd64/libJdbcOdbc.so
+./jre/lib/amd64/libattach.so
+./jre/lib/amd64/libawt.so
+./jre/lib/amd64/libawt_headless.so
+./jre/lib/amd64/libawt_xawt.so
+./jre/lib/amd64/libdcpr.so
+./jre/lib/amd64/libdt_socket.so
+./jre/lib/amd64/libfontmanager.so
+./jre/lib/amd64/libhprof.so
+./jre/lib/amd64/libinstrument.so
+./jre/lib/amd64/libj2gss.so
+./jre/lib/amd64/libj2pcsc.so
+./jre/lib/amd64/libj2pkcs11.so
+./jre/lib/amd64/libj2ucrypto.so
+./jre/lib/amd64/libjaas_unix.so
+./jre/lib/amd64/libjava.so
+./jre/lib/amd64/libjava_crw_demo.so
+./jre/lib/amd64/libjawt.so
+./jre/lib/amd64/libjdwp.so
+./jre/lib/amd64/libjfr.so
+./jre/lib/amd64/libjpeg.so
+./jre/lib/amd64/libjsdt.so
+./jre/lib/amd64/libjsound.so
+./jre/lib/amd64/libkcms.so
+./jre/lib/amd64/libmanagement.so
+./jre/lib/amd64/libmlib_image.so
+./jre/lib/amd64/libnet.so
+./jre/lib/amd64/libnio.so
+./jre/lib/amd64/libnpt.so
+./jre/lib/amd64/libsctp.so
+./jre/lib/amd64/libsplashscreen.so
+./jre/lib/amd64/libsunec.so
+./jre/lib/amd64/libsunwjdga.so
+./jre/lib/amd64/libt2k.so
+./jre/lib/amd64/libunpack.so
+./jre/lib/amd64/libverify.so
+./jre/lib/amd64/libzip.so
+./jre/lib/amd64/server/64/libjvm_db.so
+./jre/lib/amd64/server/64/libjvm_dtrace.so
+./bin/amd64/appletviewer
+./bin/amd64/extcheck
+./bin/amd64/idlj
+./bin/amd64/jar
+./bin/amd64/jarsigner
+./bin/amd64/java
+./bin/amd64/javac
+./bin/amd64/javadoc
+./bin/amd64/javah
+./bin/amd64/javap
+./bin/amd64/jcmd
+./bin/amd64/jconsole
+./bin/amd64/jdb
+./bin/amd64/jhat
+./bin/amd64/jinfo
+./bin/amd64/jmap
+./bin/amd64/jps
+./bin/amd64/jrunscript
+./bin/amd64/jsadebugd
+./bin/amd64/jstack
+./bin/amd64/jstat
+./bin/amd64/jstatd
+./bin/amd64/keytool
+./bin/amd64/native2ascii
+./bin/amd64/orbd
+./bin/amd64/pack200
+./bin/amd64/policytool
+./bin/amd64/rmic
+./bin/amd64/rmid
+./bin/amd64/rmiregistry
+./bin/amd64/schemagen
+./bin/amd64/serialver
+./bin/amd64/servertool
+./bin/amd64/tnameserv
+./bin/amd64/unpack200
+./bin/amd64/wsgen
+./bin/amd64/wsimport
+./bin/amd64/xjc
+./jre/bin/amd64/java
+./jre/bin/amd64/keytool
+./jre/bin/amd64/orbd
+./jre/bin/amd64/pack200
+./jre/bin/amd64/policytool
+./jre/bin/amd64/rmid
+./jre/bin/amd64/rmiregistry
+./jre/bin/amd64/servertool
+./jre/bin/amd64/tnameserv
+./jre/bin/amd64/unpack200
+./jre/lib/amd64/jexec
+"
+
+SKIP_ELF_DIFF="true"
+
+# Can't find an explaination for the diff in libmlib_image.so.
+KNOWN_DIS_DIFF="
+./jre/lib/amd64/libmlib_image.so
+"
+# libjvm.so differs in the random 15 char prefix on some symbols.
+ACCEPTED_DIS_DIFF="
+./jre/lib/amd64/server/libjvm.so
+"
+
+fi
+
+if [ "$OPENJDK_TARGET_OS" = "windows" ] && [ "$OPENJDK_TARGET_CPU" = "x86_64" ]; then
+
+ACCEPTED_BIN_DIFF="
+./bin/jli.dll
+./demo/jvmti/compiledMethodLoad/lib/compiledMethodLoad.dll
+./demo/jvmti/gctest/lib/gctest.dll
+./demo/jvmti/heapTracker/lib/heapTracker.dll
+./demo/jvmti/heapViewer/lib/heapViewer.dll
+./demo/jvmti/hprof/lib/hprof.dll
+./demo/jvmti/minst/lib/minst.dll
+./demo/jvmti/mtrace/lib/mtrace.dll
+./demo/jvmti/versionCheck/lib/versionCheck.dll
+./demo/jvmti/waiters/lib/waiters.dll
+./jre/bin/attach.dll
+./jre/bin/awt.dll
+./jre/bin/dcpr.dll
+./jre/bin/dt_shmem.dll
+./jre/bin/dt_socket.dll
+./jre/bin/fontmanager.dll
+./jre/bin/hprof.dll
+./jre/bin/instrument.dll
+./jre/bin/j2pcsc.dll
+./jre/bin/j2pkcs11.dll
+./jre/bin/jaas_nt.dll
+./jre/bin/java.dll
+./jre/bin/java_crw_demo.dll
+./jre/bin/jawt.dll
+./jre/bin/JdbcOdbc.dll
+./jre/bin/jdwp.dll
+./jre/bin/jfr.dll
+./jre/bin/jli.dll
+./jre/bin/jpeg.dll
+./jre/bin/jsdt.dll
+./jre/bin/jsound.dll
+./jre/bin/jsoundds.dll
+./jre/bin/kcms.dll
+./jre/bin/management.dll
+./jre/bin/mlib_image.dll
+./jre/bin/net.dll
+./jre/bin/nio.dll
+./jre/bin/npt.dll
+./jre/bin/sawindbg.dll
+./jre/bin/server/jvm.dll
+./jre/bin/splashscreen.dll
+./jre/bin/sunec.dll
+./jre/bin/sunmscapi.dll
+./jre/bin/t2k.dll
+./jre/bin/unpack.dll
+./jre/bin/verify.dll
+./jre/bin/w2k_lsa_auth.dll
+./jre/bin/zip.dll
+./bin/appletviewer.exe
+./bin/extcheck.exe
+./bin/idlj.exe
+./bin/jar.exe
+./bin/jarsigner.exe
+./bin/java.exe
+./bin/javac.exe
+./bin/javadoc.exe
+./bin/javah.exe
+./bin/javap.exe
+./bin/java-rmi.exe
+./bin/javaw.exe
+./bin/jcmd.exe
+./bin/jconsole.exe
+./bin/jdb.exe
+./bin/jhat.exe
+./bin/jinfo.exe
+./bin/jmap.exe
+./bin/jps.exe
+./bin/jrunscript.exe
+./bin/jsadebugd.exe
+./bin/jstack.exe
+./bin/jstat.exe
+./bin/jstatd.exe
+./bin/keytool.exe
+./bin/kinit.exe
+./bin/klist.exe
+./bin/ktab.exe
+./bin/native2ascii.exe
+./bin/orbd.exe
+./bin/pack200.exe
+./bin/policytool.exe
+./bin/rmic.exe
+./bin/rmid.exe
+./bin/rmiregistry.exe
+./bin/schemagen.exe
+./bin/serialver.exe
+./bin/servertool.exe
+./bin/tnameserv.exe
+./bin/unpack200.exe
+./bin/wsgen.exe
+./bin/wsimport.exe
+./bin/xjc.exe
+./jre/bin/java.exe
+./jre/bin/java-rmi.exe
+./jre/bin/javaw.exe
+./jre/bin/keytool.exe
+./jre/bin/kinit.exe
+./jre/bin/klist.exe
+./jre/bin/ktab.exe
+./jre/bin/orbd.exe
+./jre/bin/pack200.exe
+./jre/bin/policytool.exe
+./jre/bin/rmid.exe
+./jre/bin/rmiregistry.exe
+./jre/bin/servertool.exe
+./jre/bin/tnameserv.exe
+./jre/bin/unpack200.exe
+"
+
+KNOWN_SIZE_DIFF="
+./demo/jvmti/heapTracker/lib/heapTracker.dll
+./demo/jvmti/minst/lib/minst.dll
+./jre/bin/awt.dll
+./jre/bin/java_crw_demo.dll
+./bin/java.exe
+./bin/javaw.exe
+./bin/unpack200.exe
+./jre/bin/java.exe
+./jre/bin/javaw.exe
+./jre/bin/unpack200.exe
+"
+
+KNOWN_SYM_DIFF="
+./jre/bin/awt.dll
+./jre/bin/java_crw_demo.dll
+"
+fi
+
+
+
+if [ "$OPENJDK_TARGET_OS" = "macosx" ]; then
+ACCEPTED_JARZIP_CONTENTS="
+/META-INF/INDEX.LIST
+"
+
+KNOWN_BIN_DIFF="
+./jre/lib/libJObjC.dylib
+./jre/lib/libsaproc.dylib
+./jre/lib/server/libjvm.dylib
+"
+
+ACCEPTED_BIN_DIFF="
+./bin/appletviewer
+./bin/extcheck
+./bin/idlj
+./bin/jar
+./bin/jarsigner
+./bin/java
+./bin/javac
+./bin/javadoc
+./bin/javah
+./bin/javap
+./bin/jcmd
+./bin/jconsole
+./bin/jdb
+./bin/jhat
+./bin/jinfo
+./bin/jmap
+./bin/jps
+./bin/jrunscript
+./bin/jsadebugd
+./bin/jstack
+./bin/jstat
+./bin/jstatd
+./bin/keytool
+./bin/native2ascii
+./bin/orbd
+./bin/pack200
+./bin/policytool
+./bin/rmic
+./bin/rmid
+./bin/rmiregistry
+./bin/schemagen
+./bin/serialver
+./bin/servertool
+./bin/tnameserv
+./bin/wsgen
+./bin/wsimport
+./bin/xjc
+./jre/bin/java
+./jre/bin/keytool
+./jre/bin/orbd
+./jre/bin/pack200
+./jre/bin/policytool
+./jre/bin/rmid
+./jre/bin/rmiregistry
+./jre/bin/servertool
+./jre/bin/tnameserv
+"
+
+KNOWN_SIZE_DIFF="
+./jre/lib/libJObjC.dylib
+./jre/lib/server/libjvm.dylib
+"
+
+KNOWN_SYM_DIFF="
+./jre/lib/libJObjC.dylib
+./jre/lib/server/libjvm.dylib
+"
+
+KNOWN_ELF_DIFF="
+./jre/lib/libJObjC.dylib
+./jre/lib/server/libjvm.dylib
+"
+
+SKIP_DIS_DIFF="true"
+
+fi
+
+##########################################################################################
+# Compare text files and ignore specific differences:
+#
+#  * Timestamps in Java sources generated by idl2java
+#  * Sorting order and cleanup style in .properties files
+
+diff_text() {
+    OTHER_FILE=$1
+    THIS_FILE=$2
+
+    SUFFIX="${THIS_FILE##*.}"
+
+    TMP=1
+
+    if [[ "$THIS_FILE" = *"META-INF/MANIFEST.MF" ]]; then
+        TMP=$(LANG=C $DIFF $OTHER_FILE $THIS_FILE | \
+            $GREP '^[<>]' | \
+            $SED -e '/[<>] Ant-Version: Apache Ant .*/d' \
+	         -e '/[<>] Created-By: .* (Oracle Corporation).*/d')
+    fi
+    if test "x$SUFFIX" = "xjava"; then
+        TMP=$(LANG=C $DIFF $OTHER_FILE $THIS_FILE | \
+            $GREP '^[<>]' | \
+            $SED -e '/[<>] \* from.*\.idl/d' \
+                 -e '/[<>] \*.*[0-9]\{4\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}-b[0-9]\{2\}.*/d' \
+                 -e '/[<>] \*.*[0-9]\{4\} [0-9][0-9]*:[0-9]\{2\}:[0-9]\{2\}.*/d' \
+                 -e '/\/\/ Generated from input file.*/d' \
+                 -e '/\/\/ This file was generated AUTOMATICALLY from a template file.*/d' \
+                 -e '/\/\/ java GenerateCharacter.*/d')
+    fi
+    # Ignore date strings in class files.
+    # On Macosx the system sources for generated java classes produce different output on 
+    # consequtive invokations seemingly randomly.
+    # For example a method parameter randomly named "thePoint" or "aPoint". Ignore this.
+    if test "x$SUFFIX" = "xclass"; then
+        $JAVAP -c -constants -l -p ${OTHER_FILE} >  ${OTHER_FILE}.javap
+        $JAVAP -c -constants -l -p ${THIS_FILE} > ${THIS_FILE}.javap
+        TMP=$($DIFF ${OTHER_FILE}.javap ${THIS_FILE}.javap | \
+            $GREP '^[<>]' | \
+            $SED -e '/[<>].*[0-9]\{4\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}-b[0-9]\{2\}.*/d' \
+	         -e '/[<>].*Point   Lcom\/apple\/jobjc\/foundation\/NSPoint;/d' \
+	         -e '/[<>].*public com\.apple\.jobjc\.Pointer<com\.apple\.jobjc\..*itemsPtr();/d' \
+	         -e '/[<>].*public void setItemsPtr(com\.apple\.jobjc\.Pointer<com\.apple\.jobjc\..*);/d')
+    fi
+    if test "x$SUFFIX" = "xproperties"; then
+        $CAT $OTHER_FILE | $SED -e 's/\([^\\]\):/\1\\:/g' -e  's/\([^\\]\)=/\1\\=/g' -e 's/#.*/#/g' \
+            | $SED -f "$SRC_ROOT/common/bin/unicode2x.sed" \
+  	    | $SED -e '/^#/d' -e '/^$/d' \
+            -e :a -e '/\\$/N; s/\\\n//; ta' \
+  	    -e 's/^[ \t]*//;s/[ \t]*$//' \
+	    -e 's/\\=/=/' | LANG=C $SORT > $OTHER_FILE.cleaned
+        TMP=$(LANG=C $DIFF $OTHER_FILE.cleaned $THIS_FILE)
+    fi
+    if test -n "$TMP"; then
+        echo Files $OTHER_FILE and $THIS_FILE differ
+        return 1
+    fi
+
+    return 0
+}
+
+##########################################################################################
+# Compare directory structure
+
+compare_dirs() {
+    THIS_DIR=$1
+    OTHER_DIR=$2
+    WORK_DIR=$3
+
+    mkdir -p $WORK_DIR
+
+    (cd $OTHER_DIR && $FIND . -type d | $SORT > $WORK_DIR/other_dirs)
+    (cd $THIS_DIR && $FIND . -type d | $SORT > $WORK_DIR/this_dirs)
+    
+    echo -n Directory structure...
+    if $DIFF $WORK_DIR/other_dirs $WORK_DIR/this_dirs > /dev/null; then
+        echo Identical!
+    else
+        echo Differences found.
+        REGRESSIONS=true
+    # Differences in directories found.
+        ONLY_OTHER=$($DIFF $WORK_DIR/other_dirs $WORK_DIR/this_dirs | $GREP '<')
+        if [ "$ONLY_OTHER" ]; then
+            echo Only in $OTHER
+            echo $ONLY_OTHER | $SED 's|< ./|\t|g' | $SED 's/ /\n/g'
+        fi
+    # Differences in directories found.
+        ONLY_THIS=$($DIFF $WORK_DIR/other_dirs $WORK_DIR/this_dirs | $GREP '>')
+        if [ "$ONLY_THIS" ]; then
+            echo Only in $THIS
+            echo $ONLY_THIS | $SED 's|> ./|\t|g' | $SED 's/ /\n/g'
+        fi
+    fi
+}
+
+
+##########################################################################################
+# Compare file structure
+
+compare_files() {
+    THIS_DIR=$1
+    OTHER_DIR=$2
+    WORK_DIR=$3
+
+    mkdir -p $WORK_DIR
+
+    (cd $OTHER_DIR && $FIND . -type f | $SORT > $WORK_DIR/other_files)
+    (cd $THIS_DIR && $FIND . -type f | $SORT > $WORK_DIR/this_files)
+    
+    echo -n File names...
+    if diff $WORK_DIR/other_files $WORK_DIR/this_files > /dev/null; then
+        echo Identical!
+    else
+        echo Differences found.
+        REGRESSIONS=true
+    # Differences in directories found.
+        ONLY_OTHER=$(diff $WORK_DIR/other_files $WORK_DIR/this_files | $GREP '<')
+        if [ "$ONLY_OTHER" ]; then
+            echo Only in $OTHER
+            echo "$ONLY_OTHER" | sed 's|< ./|    |g'
+        fi
+    # Differences in directories found.
+        ONLY_THIS=$(diff $WORK_DIR/other_files $WORK_DIR/this_files | $GREP '>')
+        if [ "$ONLY_THIS" ]; then
+            echo Only in $THIS
+            echo "$ONLY_THIS" | sed 's|> ./|    |g'
+        fi
+    fi
+}
+
+
+##########################################################################################
+# Compare permissions
+
+compare_permissions() {
+    THIS_DIR=$1
+    OTHER_DIR=$2
+    WORK_DIR=$3
+
+    mkdir -p $WORK_DIR
+
+    echo -n Permissions...
+    found=""
+    for f in `cd $OTHER_DIR && $FIND . -type f`
+    do
+        if [ ! -f ${OTHER_DIR}/$f ]; then continue; fi
+        if [ ! -f ${THIS_DIR}/$f ]; then continue; fi
+        OP=`ls -l ${OTHER_DIR}/$f | awk '{printf("%.10s\n", $1);}'`
+        TP=`ls -l ${THIS_DIR}/$f | awk '{printf("%.10s\n", $1);}'`
+        if [ "$OP" != "$TP" ]
+        then
+	    if [ -z "$found" ]; then echo ; found="yes"; fi
+	    $PRINTF "\told: ${OP} new: ${TP}\t$f\n"
+        fi
+    done
+    if [ -z "$found" ]; then 
+        echo "Identical!"
+    else
+        REGRESSIONS=true
+    fi
+}
+
+##########################################################################################
+# Compare file command output
+
+compare_file_types() {
+    THIS_DIR=$1
+    OTHER_DIR=$2
+    WORK_DIR=$3
+
+    $MKDIR -p $WORK_DIR
+
+    echo -n File types...
+    found=""
+    for f in `cd $OTHER_DIR && $FIND . -type f`
+    do
+        if [ ! -f ${OTHER_DIR}/$f ]; then continue; fi
+        if [ ! -f ${THIS_DIR}/$f ]; then continue; fi
+        OF=`cd ${OTHER_DIR} && $FILE $f`
+        TF=`cd ${THIS_DIR} && $FILE $f`
+        if [ "$f" = "./src.zip" ] || [ "$f" = "./jre/lib/JObjC.jar" ] || [ "$f" = "./lib/JObjC.jar" ]
+        then
+	    if [ "`echo $OF | $GREP -ic zip`" -gt 0 -a "`echo $TF | $GREP -ic zip`" -gt 0 ]
+	    then
+	        # the way we produces zip-files make it so that directories are stored in old file
+	        # but not in new (only files with full-path)
+	        # this makes file-5.09 report them as different
+	        continue;
+	    fi
+        fi
+        
+        if [ "$OF" != "$TF" ]
+        then
+	    if [ -z "$found" ]; then echo ; found="yes"; fi
+	    $PRINTF "\tother: ${OF}\n\tthis : ${TF}\n"
+        fi
+    done
+    if [ -z "$found" ]; then 
+        echo "Identical!"
+    else
+        REGRESSIONS=true
+    fi
+}
+
+##########################################################################################
+# Compare the rest of the files
+
+compare_general_files() {
+    THIS_DIR=$1
+    OTHER_DIR=$2
+    WORK_DIR=$3
+    
+    GENERAL_FILES=$(cd $THIS_DIR && $FIND . -type f ! -name "*.so" ! -name "*.jar" ! -name "*.zip" \
+        ! -name "*.debuginfo" ! -name "*.dylib" ! -name "jexec" \
+        ! -name "ct.sym" ! -name "*.diz" ! -name "*.dll" \
+        ! -name "*.pdb" ! -name "*.exp" ! -name "*.ilk" \
+        ! -name "*.lib" \
+        | $GREP -v "./bin/"  | $SORT | $FILTER)
+
+    echo General files...
+    for f in $GENERAL_FILES
+    do
+        if [ -e $OTHER_DIR/$f ]; then
+            DIFF_OUT=$($DIFF $OTHER_DIR/$f $THIS_DIR/$f 2>&1)
+            if [ -n "$DIFF_OUT" ]; then
+                echo $f
+                REGRESSIONS=true
+                if [ "$SHOW_DIFFS" = "true" ]; then
+                    echo "$DIFF_OUT"
+                fi
+            fi
+        fi
+    done
+
+
+}
+
+##########################################################################################
+# Compare zip file
+
+compare_zip_file() {
+    THIS_DIR=$1
+    OTHER_DIR=$2
+    WORK_DIR=$3
+    ZIP_FILE=$4
+
+    THIS_ZIP=$THIS_DIR/$ZIP_FILE
+    OTHER_ZIP=$OTHER_DIR/$ZIP_FILE
+
+    THIS_SUFFIX="${THIS_ZIP##*.}"
+    OTHER_SUFFIX="${OTHER_ZIP##*.}"
+    if [ "$THIS_SUFFIX" != "$OTHER_SUFFIX" ]; then
+        echo The files do not have the same suffix type!
+        return 2
+    fi
+
+    UNARCHIVE="$UNZIP -q"
+
+    TYPE="$THIS_SUFFIX"
+
+    if $CMP $OTHER_ZIP $THIS_ZIP > /dev/null
+    then
+        return 0
+    fi
+    # Not quite identical, the might still contain the same data.
+    # Unpack the jar/zip files in temp dirs
+    
+    THIS_UNZIPDIR=$WORK_DIR/$ZIP_FILE.this
+    OTHER_UNZIPDIR=$WORK_DIR/$ZIP_FILE.other
+    $RM -rf $THIS_UNZIPDIR $OTHER_UNZIPDIR
+    $MKDIR -p $THIS_UNZIPDIR
+    $MKDIR -p $OTHER_UNZIPDIR
+    (cd $THIS_UNZIPDIR && $UNARCHIVE $THIS_ZIP)
+    (cd $OTHER_UNZIPDIR && $UNARCHIVE $OTHER_ZIP)
+
+    CONTENTS_DIFF_FILE=$WORK_DIR/$ZIP_FILE.diff
+    LANG=C $DIFF -rq $OTHER_UNZIPDIR $THIS_UNZIPDIR > $CONTENTS_DIFF_FILE
+
+    ONLY_OTHER=$($GREP "^Only in $OTHER_UNZIPDIR" $CONTENTS_DIFF_FILE)
+    ONLY_THIS=$($GREP "^Only in $THIS_UNZIPDIR" $CONTENTS_DIFF_FILE)
+
+    return_value=0
+
+    if [ -n "$ONLY_OTHER" ]; then
+        echo "        Only OTHER $ZIP_FILE contains:"
+        echo "$ONLY_OTHER" | sed "s|Only in $OTHER_UNZIPDIR|            |"g | sed 's|: |/|g'
+        return_value=1
+    fi
+
+    if [ -n "$ONLY_THIS" ]; then
+        echo "        Only THIS $ZIP_FILE contains:"
+        echo "$ONLY_THIS" | sed "s|Only in $THIS_UNZIPDIR|            |"g | sed 's|: |/|g'
+        return_value=1
+    fi
+
+    DIFFING_FILES=$($GREP differ $CONTENTS_DIFF_FILE | $CUT -f 2 -d ' ' | $SED "s|$OTHER_UNZIPDIR/||g")
+
+    $RM -f $WORK_DIR/$ZIP_FILE.diffs
+    for file in $DIFFING_FILES; do
+	if [[ "$ACCEPTED_JARZIP_CONTENTS" != *"$file"* ]]; then
+            diff_text $OTHER_UNZIPDIR/$file $THIS_UNZIPDIR/$file >> $WORK_DIR/$ZIP_FILE.diffs
+	fi
+    done
+
+    if [ -s "$WORK_DIR/$ZIP_FILE.diffs" ]; then
+        return_value=1
+        echo "        Differing files in $ZIP_FILE"
+        $CAT $WORK_DIR/$ZIP_FILE.diffs | $GREP differ | cut -f 2 -d ' ' | \
+            $SED "s|$OTHER_UNZIPDIR|            |g" > $WORK_DIR/$ZIP_FILE.difflist
+        $CAT $WORK_DIR/$ZIP_FILE.difflist
+
+        if [ -n "$SHOW_DIFFS" ]; then
+            for i in $(cat $WORK_DIR/$ZIP_FILE.difflist) ; do
+                if [ -f "${OTHER_UNZIPDIR}/$i.javap" ]; then
+                    LANG=C $DIFF ${OTHER_UNZIPDIR}/$i.javap ${THIS_UNZIPDIR}/$i.javap
+                elif [ -f "${OTHER_UNZIPDIR}/$i.cleaned" ]; then
+                    LANG=C $DIFF ${OTHER_UNZIPDIR}/$i.cleaned ${THIS_UNZIPDIR}/$i
+                else
+                    LANG=C $DIFF ${OTHER_UNZIPDIR}/$i ${THIS_UNZIPDIR}/$i
+                fi
+            done
+        fi
+    fi
+
+    return $return_value
+}
+
+
+##########################################################################################
+# Compare all zip files
+
+compare_all_zip_files() {
+    THIS_DIR=$1
+    OTHER_DIR=$2
+    WORK_DIR=$3
+
+    ZIPS=$(cd $THIS_DIR && $FIND . -type f -name "*.zip" | $SORT | $FILTER )
+
+    if [ -n "$ZIPS" ]; then
+        echo Zip files...
+
+        return_value=0
+        for f in $ZIPS; do
+            if [ -f "$OTHER_DIR/$f" ]; then
+                compare_zip_file $THIS_DIR $OTHER_DIR $WORK_DIR $f
+                if [ "$?" != "0" ]; then
+                    return_value=1
+                    REGRESSIONS=true
+                fi
+            fi
+        done
+    fi
+
+    return $return_value
+}
+
+##########################################################################################
+# Compare all jar files
+
+compare_all_jar_files() {
+    THIS_DIR=$1
+    OTHER_DIR=$2
+    WORK_DIR=$3
+
+    # TODO filter?
+    ZIPS=$(cd $THIS_DIR && $FIND . -type f -name "*.jar" | $SORT | $FILTER)
+
+    if [ -n "$ZIPS" ]; then
+        echo Jar files...
+
+        return_value=0
+        for f in $ZIPS; do
+            if [ -f "$OTHER_DIR/$f" ]; then
+                compare_zip_file $THIS_DIR $OTHER_DIR $WORK_DIR $f
+                if [ "$?" != "0" ]; then
+                    return_value=1
+                    REGRESSIONS=true
+                fi
+            fi
+        done
+    fi
+
+    return $return_value
+}
+
+##########################################################################################
+# Compare binary (executable/library) file
+
+compare_bin_file() {
+    THIS_DIR=$1
+    OTHER_DIR=$2
+    WORK_DIR=$3
+    BIN_FILE=$4
+
+    THIS_FILE=$THIS_DIR/$BIN_FILE
+    OTHER_FILE=$OTHER_DIR/$BIN_FILE
+    NAME=$(basename $BIN_FILE)
+    WORK_FILE_BASE=$WORK_DIR/$BIN_FILE
+    FILE_WORK_DIR=$(dirname $WORK_FILE_BASE)
+
+    $MKDIR -p $FILE_WORK_DIR
+
+    ORIG_THIS_FILE="$THIS_FILE"
+    ORIG_OTHER_FILE="$OTHER_FILE"
+
+    if [[ "$STRIP_BEFORE_COMPARE" = *"$BIN_FILE"* ]]; then
+        THIS_STRIPPED_FILE=$FILE_WORK_DIR/this/$NAME
+        OTHER_STRIPPED_FILE=$FILE_WORK_DIR/other/$NAME
+        $MKDIR -p $FILE_WORK_DIR/this $FILE_WORK_DIR/other
+        $CP $THIS_FILE $THIS_STRIPPED_FILE
+        $CP $OTHER_FILE $OTHER_STRIPPED_FILE
+        $STRIP $THIS_STRIPPED_FILE
+        $STRIP $OTHER_STRIPPED_FILE
+        THIS_FILE="$THIS_STRIPPED_FILE"
+        OTHER_FILE="$OTHER_STRIPPED_FILE"
+    fi
+
+    if [ -z "$SKIP_BIN_DIFF" ]; then
+        if cmp $OTHER_FILE $THIS_FILE > /dev/null; then
+        # The files were bytewise identical.
+            if [ -n "$VERBOSE" ]; then
+                echo "        :           :         :         :          : $BIN_FILE"
+            fi
+            return 0
+        fi
+        BIN_MSG=" diff "
+        if [[ "$ACCEPTED_BIN_DIFF" != *"$BIN_FILE"* ]]; then
+            DIFF_BIN=true
+            if [[ "$KNOWN_BIN_DIFF" != *"$BIN_FILE"* ]]; then
+                BIN_MSG="*$BIN_MSG*"
+                REGRESSIONS=true
+            else
+                BIN_MSG=" $BIN_MSG "
+            fi
+        else
+            BIN_MSG="($BIN_MSG)"
+            DIFF_BIN=
+        fi
+    fi
+
+    THIS_SIZE=$(ls -l "$THIS_FILE" | awk '{ print $5 }')
+    OTHER_SIZE=$(ls -l "$OTHER_FILE" | awk '{ print $5 }')
+    if [ $THIS_SIZE -ne $OTHER_SIZE ]; then
+        DIFF_SIZE_NUM=$($EXPR $THIS_SIZE - $OTHER_SIZE)
+        DIFF_SIZE_REL=$($EXPR $THIS_SIZE \* 100 / $OTHER_SIZE)
+        SIZE_MSG=$($PRINTF "%3d%% %4d" $DIFF_SIZE_REL $DIFF_SIZE_NUM)
+        if [[ "$ACCEPTED_SMALL_SIZE_DIFF" = *"$BIN_FILE"* ]] && [ "$DIFF_SIZE_REL" -gt 98 ] && [ "$DIFF_SIZE_REL" -lt 102 ]; then
+            SIZE_MSG="($SIZE_MSG)"
+            DIFF_SIZE=
+        else
+            if [[ "$ACCEPTED_SIZE_DIFF" != *"$BIN_FILE"* ]]; then
+                DIFF_SIZE=true
+                if [[ "$KNOWN_SIZE_DIFF" != *"$BIN_FILE"* ]]; then
+                    SIZE_MSG="*$SIZE_MSG*"
+                    REGRESSIONS=true
+                else
+                    SIZE_MSG=" $SIZE_MSG "
+                fi
+            else
+                SIZE_MSG="($SIZE_MSG)"
+                DIFF_SIZE=
+            fi
+        fi
+    else
+        SIZE_MSG="           "
+        DIFF_SIZE=
+        if [[ "$KNOWN_SIZE_DIFF $ACCEPTED_SIZE_DIFF" = *"$BIN_FILE"* ]]; then
+            SIZE_MSG="     !     "
+        fi
+    fi
+
+    if [[ "$SORT_SYMBOLS" = *"$BIN_FILE"* ]]; then
+        SYM_SORT_CMD="sort"
+    else
+        SYM_SORT_CMD="cat"
+    fi
+
+    # Check symbols
+    if [ "$OPENJDK_TARGET_OS" = "windows" ]; then
+	$DUMPBIN -exports $OTHER_FILE | $GREP " = " | $SYM_SORT_CMD > $WORK_FILE_BASE.symbols.other
+	$DUMPBIN -exports $THIS_FILE  | $GREP " = " | $SYM_SORT_CMD > $WORK_FILE_BASE.symbols.this
+    elif [ "$OPENJDK_TARGET_OS" = "solaris" ]; then
+        # Some symbols get seemingly random 15 character prefixes. Filter them out.
+        $NM -a $ORIG_OTHER_FILE | $GREP -v $NAME | $AWK '{print $2, $3, $4, $5}' | $SED 's/^\([a-zA-Z] \.\)[a-zA-Z0-9_\$]\{15,15\}\./\1./g' | $SYM_SORT_CMD > $WORK_FILE_BASE.symbols.other
+	$NM -a $ORIG_THIS_FILE  | $GREP -v $NAME | $AWK '{print $2, $3, $4, $5}' | $SED 's/^\([a-zA-Z] \.\)[a-zA-Z0-9_\$]\{15,15\}\./\1./g' | $SYM_SORT_CMD > $WORK_FILE_BASE.symbols.this
+    else
+	$NM -a $ORIG_OTHER_FILE | $GREP -v $NAME | $AWK '{print $2, $3, $4, $5}' | $SYM_SORT_CMD > $WORK_FILE_BASE.symbols.other
+	$NM -a $ORIG_THIS_FILE  | $GREP -v $NAME | $AWK '{print $2, $3, $4, $5}' | $SYM_SORT_CMD > $WORK_FILE_BASE.symbols.this
+    fi
+    
+    LANG=C $DIFF $WORK_FILE_BASE.symbols.other $WORK_FILE_BASE.symbols.this > $WORK_FILE_BASE.symbols.diff
+    if [ -s $WORK_FILE_BASE.symbols.diff ]; then
+        SYM_MSG=" diff  "
+        if [[ "$ACCEPTED_SYM_DIFF" != *"$BIN_FILE"* ]]; then
+            DIFF_SYM=true
+            if [[ "$KNOWN_SYM_DIFF" != *"$BIN_FILE"* ]]; then
+                SYM_MSG="*$SYM_MSG*"
+                REGRESSIONS=true
+            else
+                SYM_MSG=" $SYM_MSG "
+            fi
+        else
+            SYM_MSG="($SYM_MSG)"            
+            DIFF_SYM=
+        fi
+    else
+        SYM_MSG="         "
+        DIFF_SYM=
+        if [[ "$KNOWN_SYM_DIFF $ACCEPTED_SYM_DIFF" = *"$BIN_FILE"* ]]; then
+            SYM_MSG="    !    "
+        fi
+    fi
+
+    # Check dependencies
+    if [ -n "$LDD_CMD" ];then
+	(cd $FILE_WORK_DIR && $CP $OTHER_FILE . && $LDD_CMD $NAME | $AWK '{ print $1;}' | $SORT | $TEE $WORK_FILE_BASE.deps.other | $UNIQ > $WORK_FILE_BASE.deps.other.uniq)
+	(cd $FILE_WORK_DIR && $CP $THIS_FILE . && $LDD_CMD $NAME | $AWK '{ print $1;}' | $SORT | $TEE $WORK_FILE_BASE.deps.this | $UNIQ > $WORK_FILE_BASE.deps.this.uniq)
+	(cd $FILE_WORK_DIR && $RM -f $NAME)
+	
+	LANG=C $DIFF $WORK_FILE_BASE.deps.other $WORK_FILE_BASE.deps.this > $WORK_FILE_BASE.deps.diff
+	LANG=C $DIFF $WORK_FILE_BASE.deps.other.uniq $WORK_FILE_BASE.deps.this.uniq > $WORK_FILE_BASE.deps.diff.uniq
+	
+	if [ -s $WORK_FILE_BASE.deps.diff ]; then
+            if [ -s $WORK_FILE_BASE.deps.diff.uniq ]; then
+		DEP_MSG=" diff  "
+            else
+		DEP_MSG=" redun "
+            fi
+            if [[ "$ACCEPTED_DEP_DIFF" != *"$BIN_FILE"* ]]; then
+		DIFF_DEP=true
+		if [[ "$KNOWN_DEP_DIFF" != *"$BIN_FILE"* ]]; then
+                    DEP_MSG="*$DEP_MSG*"
+                    REGRESSIONS=true
+		else
+                    DEP_MSG=" $DEP_MSG "
+		fi
+            else
+		DEP_MSG="($DEP_MSG)"
+		DIFF_DEP=
+            fi
+	else
+	    DEP_MSG="         "
+	    DIFF_DEP=
+            if [[ "$KNOWN_DEP_DIFF $ACCEPTED_DEP_DIFF" = *"$BIN_FILE"* ]]; then
+                DEP_MSG="     !      "
+            fi
+	fi
+    fi
+    
+    # Compare readelf output
+    if [ -n "$READELF_CMD" ] && [ -z "$SKIP_ELF_DIFF" ]; then
+        $READELF_CMD $OTHER_FILE > $WORK_FILE_BASE.readelf.other 2>&1
+        $READELF_CMD $THIS_FILE > $WORK_FILE_BASE.readelf.this 2>&1
+        
+        LANG=C $DIFF $WORK_FILE_BASE.readelf.other $WORK_FILE_BASE.readelf.this > $WORK_FILE_BASE.readelf.diff
+        
+        if [ -s $WORK_FILE_BASE.readelf.diff ]; then
+            ELF_DIFF_SIZE=$(ls -n $WORK_FILE_BASE.readelf.diff | awk '{print $5}')
+            ELF_MSG=$($PRINTF "%8d" $ELF_DIFF_SIZE)
+            if [[ "$ACCEPTED_ELF_DIFF" != *"$BIN_FILE"* ]]; then
+                DIFF_ELF=true
+                if [[ "$KNOWN_ELF_DIFF" != *"$BIN_FILE"* ]]; then
+                    ELF_MSG="*$ELF_MSG*"
+                    REGRESSIONS=true
+                else
+                    ELF_MSG=" $ELF_MSG "
+                fi
+            else
+                ELF_MSG="($ELF_MSG)"
+                DIFF_ELF=
+            fi
+        else
+            ELF_MSG="          "
+            DIFF_ELF=
+            if [[ "$KNOWN_DEP_DIFF $ACCEPTED_DEP_DIFF" = *"$BIN_FILE"* ]]; then
+                ELF_MSG="    !    "
+            fi
+        fi
+    fi
+
+    # Compare disassemble output
+    if [ -f "$OBJDUMP" ] && [ -z "$SKIP_DIS_DIFF" ]; then
+        $OBJDUMP -d $OTHER_FILE | $GREP -v $NAME > $WORK_FILE_BASE.dis.other 2>&1
+        $OBJDUMP -d $THIS_FILE  | $GREP -v $NAME > $WORK_FILE_BASE.dis.this  2>&1
+        
+        LANG=C $DIFF $WORK_FILE_BASE.dis.other $WORK_FILE_BASE.dis.this > $WORK_FILE_BASE.dis.diff
+        
+        if [ -s $WORK_FILE_BASE.dis.diff ]; then
+            DIS_DIFF_SIZE=$(ls -n $WORK_FILE_BASE.dis.diff | awk '{print $5}')
+            DIS_MSG=$($PRINTF "%8d" $DIS_DIFF_SIZE)
+            if [[ "$ACCEPTED_DIS_DIFF" != *"$BIN_FILE"* ]]; then
+                DIFF_DIS=true
+                if [[ "$KNOWN_DIS_DIFF" != *"$BIN_FILE"* ]]; then
+                    DIS_MSG="*$DIS_MSG*"
+                    REGRESSIONS=true
+                else
+                    DIS_MSG=" $DIS_MSG "
+                fi
+            else
+                DIS_MSG="($DIS_MSG)"
+                DIFF_DIS=
+            fi
+        else
+            DIS_MSG="          "
+            DIFF_DIS=
+            if [[ "$KNOWN_DEP_DIFF $ACCEPTED_DEP_DIFF" = *"$BIN_FILE"* ]]; then
+                DIS_MSG="    !    "
+            fi
+        fi
+    fi
+
+
+    if [ -n "$DIFF_BIN$DIFF_SIZE$DIFF_SYM$DIFF_DEP$DIFF_ELF$DIFF_DIS" ] || [ -n "$VERBOSE" ]; then
+        if [ -n "$BIN_MSG" ]; then echo -n "$BIN_MSG:"; fi
+        if [ -n "$SIZE_MSG" ]; then echo -n "$SIZE_MSG:"; fi
+        if [ -n "$SYM_MSG" ]; then echo -n "$SYM_MSG:"; fi
+        if [ -n "$DEP_MSG" ]; then echo -n "$DEP_MSG:"; fi
+        if [ -n "$ELF_MSG" ]; then echo -n "$ELF_MSG:"; fi
+        if [ -n "$DIS_MSG" ]; then echo -n "$DIS_MSG:"; fi
+        echo " $BIN_FILE"
+        if [ "$SHOW_DIFFS" = "true" ]; then
+            if [ -s "$WORK_FILE_BASE.symbols.diff" ]; then
+                echo "Symbols diff:"
+                $CAT $WORK_FILE_BASE.symbols.diff
+            fi
+            if [ -s "$WORK_FILE_BASE.deps.diff" ]; then
+                echo "Deps diff:"
+                $CAT $WORK_FILE_BASE.deps.diff
+            fi
+            if [ -s "$WORK_FILE_BASE.readelf.diff" ]; then
+                echo "Readelf diff:"
+                $CAT $WORK_FILE_BASE.readelf.diff
+            fi
+            if [ -s "$WORK_FILE_BASE.dis.diff" ]; then
+                echo "Disassembly diff:"
+                $CAT $WORK_FILE_BASE.dis.diff
+            fi
+        fi
+        return 1
+    fi
+    return 0
+}
+
+##########################################################################################
+# Print binary diff header
+
+print_binary_diff_header() {
+    if [ -z "$SKIP_BIN_DIFF" ]; then echo -n " Binary :"; fi
+    if [ -z "$SKIP_SIZE_DIFF" ]; then echo -n "   Size    :"; fi
+    if [ -z "$SKIP_SYM_DIFF" ]; then echo -n " Symbols :"; fi
+    if [ -z "$SKIP_DEP_DIFF" ]; then echo -n "  Deps   :"; fi
+    if [ -z "$SKIP_ELF_DIFF" ]; then echo -n " Readelf  :"; fi
+    if [ -z "$SKIP_DIS_DIFF" ]; then echo -n " Disass   :"; fi
+    echo
+}
+
+##########################################################################################
+# Compare all libraries
+
+compare_all_libs() {
+    THIS_DIR=$1
+    OTHER_DIR=$2
+    WORK_DIR=$3
+
+    LIBS=$(cd $THIS_DIR && $FIND . -name 'lib*.so' -o -name '*.dylib' -o -name '*.dll' | $SORT | $FILTER)
+
+    if [ -n "$LIBS" ]; then
+        echo Libraries...
+        print_binary_diff_header
+        for l in $LIBS; do
+            if [ -f "$OTHER_DIR/$l" ]; then
+                compare_bin_file $THIS_DIR $OTHER_DIR $WORK_DIR $l
+                if [ "$?" != "0" ]; then
+                    return_value=1
+                fi
+            fi
+        done
+    fi
+
+    return $return_value
+}
+
+##########################################################################################
+# Compare all executables
+
+compare_all_execs() {
+    THIS_DIR=$1
+    OTHER_DIR=$2
+    WORK_DIR=$3
+
+    if [ "$OPENJDK_TARGET_OS" = "windows" ]; then
+        EXECS=$(cd $THIS_DIR && $FIND . -type f -name '*.exe' | $SORT | $FILTER)
+    else
+        EXECS=$(cd $THIS_DIR && $FIND . -name db -prune -o -type f -perm -100 \! \( -name '*.so' -o -name '*.dylib' -o -name '*.dll' -o -name '*.cgi' \) | $SORT | $FILTER)
+    fi
+
+    if [ -n "$EXECS" ]; then
+        echo Executables...
+        print_binary_diff_header
+        for e in $EXECS; do
+            if [ -f "$OTHER_DIR/$e" ]; then
+                compare_bin_file $THIS_DIR $OTHER_DIR $WORK_DIR $e
+                if [ "$?" != "0" ]; then
+                    return_value=1
+                fi
+            fi
+        done
+    fi
+
+    return $return_value
+}
+
+##########################################################################################
+# Initiate configuration
+
+COMPARE_ROOT=/tmp/cimages.$USER
+$MKDIR -p $COMPARE_ROOT
+if [ "$OPENJDK_TARGET_OS" = "windows" ]; then
+    if [ "$(uname -o)" = "Cygwin" ]; then
+	COMPARE_ROOT=$(cygpath -msa $COMPARE_ROOT)
+    fi
+fi
+
+THIS="$( cd "$( dirname "$0" )" && pwd )"
+echo "$THIS"
+THIS_SCRIPT="$0"
+
+if [ -z "$1" ] || [ "$1" = "-h" ] || [ "$1" = "-?" ] || [ "$1" = "/h" ] || [ "$1" = "/?" ] || [ "$1" = "-help" ] || [ "$1" = "--help" ]; then
+    echo "bash ./compare.sh [OPTIONS] [FILTER]"
+    echo ""
+    echo "-all                Compare all files in all known ways"
+    echo "-names              Compare the file names and directory structure"
+    echo "-perms              Compare the permission bits on all files and directories"
+    echo "-types              Compare the output of the file command on all files"
+    echo "-general            Compare the files not convered by the specialized comparisons"
+    echo "-zips               Compare the contents of all zip files"
+    echo "-jars               Compare the contents of all jar files"
+    echo "-libs               Compare all native libraries"
+    echo "-execs              Compare all executables"
+    echo "-v                  Verbose output, does not hide known differences"
+    echo "-vv                 More verbose output, shows diff output of all comparisons"
+    echo "-o [OTHER]          Compare with build in other directory. Will default to the old build directory"
+    echo ""
+    echo "[FILTER]            List filenames in the image to compare, works for jars, zips, libs and execs"
+    echo "Example:"
+    echo "bash ./common/bin/compareimages.sh CodePointIM.jar"
+    exit 10
+fi
+
+CMP_NAMES=false
+CMP_PERMS=false
+CMP_TYPES=false
+CMP_GENERAL=false
+CMP_ZIPS=false
+CMP_JARS=false
+CMP_LIBS=false
+CMP_EXECS=false
+
+while [ -n "$1" ]; do
+    case "$1" in
+        -v)
+            VERBOSE=true
+            ;;
+        -vv)
+            VERBOSE=true
+            SHOW_DIFFS=true
+            ;;
+        -o)
+            OTHER=$2
+            shift
+            ;;
+        -all)
+            CMP_NAMES=true
+            if [ "$OPENJDK_TARGET_OS" != "windows" ]; then
+                CMP_PERMS=true
+            fi
+            CMP_TYPES=true
+            CMP_GENERAL=true
+            CMP_ZIPS=true
+            CMP_JARS=true
+            CMP_LIBS=true
+            CMP_EXECS=true
+            ;;
+        -names)
+            CMP_NAMES=true
+            ;;
+        -perms)
+            CMP_PERMS=true
+            ;;
+        -types)
+            CMP_TYPES=true
+            ;;
+        -general)
+            CMP_GENERAL=true
+            ;;
+        -zips)
+            CMP_ZIPS=true
+            ;;
+        -jars)
+            CMP_JARS=true
+            ;;
+        -libs)
+            CMP_LIBS=true
+            ;;
+        -execs)
+            CMP_EXECS=true
+            ;;
+        *)
+            CMP_NAMES=false
+            CMP_PERMS=false
+            CMP_TYPES=false
+            CMP_ZIPS=true
+            CMP_JARS=true
+            CMP_LIBS=true
+            CMP_EXECS=true
+            
+            if [ -z "$FILTER" ]; then
+                FILTER="$GREP"
+            fi
+            FILTER="$FILTER -e $1"
+            ;;
+    esac
+    shift
+done
+
+if [ "$CMP_NAMES" = "false" ] && [ "$CMP_TYPES" = "false" ] && [ "$CMP_PERMS" = "false" ] && [ "$CMP_GENERAL" = "false" ] && [ "$CMP_ZIPS" = "false" ] && [ "$CMP_JARS" = "false" ] && [ "$CMP_LIBS" = "false" ] && [ "$CMP_EXECS" = "false" ]; then
+    CMP_NAMES=true
+    CMP_PERMS=true
+    CMP_TYPES=true
+    CMP_GENERAL=true
+    CMP_ZIPS=true
+    CMP_JARS=true
+    CMP_LIBS=true
+    CMP_EXECS=true
+fi
+
+if [ -z "$FILTER" ]; then
+    FILTER="$CAT"
+fi
+
+if [ -z "$OTHER" ]; then
+    OTHER="$THIS/../$LEGACY_BUILD_DIR"
+    if [ -d "$OTHER" ]; then
+        OTHER="$( cd "$OTHER" && pwd )"
+    else
+        echo "Default old build directory does not exist:"
+        echo "$OTHER"
+    fi
+    echo "Comparing to default old build:"
+    echo "$OTHER"
+    echo
+else
+    echo "Comparing to:"
+    echo "$OTHER"
+    echo
+fi
+
+if [ ! -d "$OTHER" ]; then
+    echo "Other build directory does not exist:"
+    echo "$OTHER"
+    exit 1;
+fi
+
+# Figure out the layout of the new build. Which kinds of images have been produced
+if [ -d "$THIS/images/j2sdk-image" ]; then
+    THIS_J2SDK="$THIS/images/j2sdk-image"
+    THIS_J2RE="$THIS/images/j2re-image"
+fi
+if [ -d "$THIS/images/j2sdk-overlay-image" ]; then
+    THIS_J2SDK_OVERLAY="$THIS/images/j2sdk-overlay-image"
+    THIS_J2RE_OVERLAY="$THIS/images/j2re-overlay-image"
+fi
+
+# Figure out the layout of the other build (old or new, normal or overlay image)
+if [ -d "$OTHER/j2sdk-image" ]; then
+    if [ -f "$OTHER/j2sdk-image/LICENSE" ]; then
+        OTHER_J2SDK="$OTHER/j2sdk-image"
+        OTHER_J2RE="$OTHER/j2re-image"
+    else
+        OTHER_J2SDK_OVERLAY="$OTHER/j2sdk-image"
+        OTHER_J2RE_OVERLAY="$OTHER/j2re-image"
+    fi
+
+fi
+
+if [ -z "$OTHER_J2SDK" ] && [ -n "$OTHER_J2SDK_OVERLAY" ] && [ -z "$THIS_J2SDK_OVERLAY" ]; then
+    echo "OTHER build only has an overlay image while this build does not. Nothing to compare!"
+    exit 1
+fi
+
+
+##########################################################################################
+# Do the work
+
+if [ "$CMP_NAMES" = "true" ]; then
+    if [ -n "$THIS_J2SDK" ] && [ -n "$OTHER_J2SDK" ]; then
+        echo -n "J2SDK "
+        compare_dirs $THIS_J2SDK $OTHER_J2SDK $COMPARE_ROOT/j2sdk
+        echo -n "J2RE  "
+        compare_dirs $THIS_J2RE $OTHER_J2RE $COMPARE_ROOT/j2re
+        
+        echo -n "J2SDK "
+        compare_files $THIS_J2SDK $OTHER_J2SDK $COMPARE_ROOT/j2sdk
+        echo -n "J2RE  "
+        compare_files $THIS_J2RE $OTHER_J2RE $COMPARE_ROOT/j2re
+    fi
+    if [ -n "$THIS_J2SDK_OVERLAY" ] && [ -n "$OTHER_J2SDK_OVERLAY" ]; then
+        echo -n "J2SDK Overlay "
+        compare_dirs $THIS_J2SDK_OVERLAY $OTHER_J2SDK_OVERLAY $COMPARE_ROOT/j2sdk-overlay
+        echo -n "J2RE  Overlay "
+        compare_dirs $THIS_J2RE_OVERLAY $OTHER_J2RE_OVERLAY $COMPARE_ROOT/j2re-overlay
+        
+        echo -n "J2SDK Overlay "
+        compare_files $THIS_J2SDK_OVERLAY $OTHER_J2SDK_OVERLAY $COMPARE_ROOT/j2sdk-overlay
+        echo -n "J2RE  Overlay "
+        compare_files $THIS_J2RE_OVERLAY $OTHER_J2RE_OVERLAY $COMPARE_ROOT/j2re-overlay
+    fi
+fi
+
+if [ "$CMP_PERMS" = "true" ]; then
+    if [ -n "$THIS_J2SDK" ] && [ -n "$OTHER_J2SDK" ]; then
+        echo -n "J2SDK "
+        compare_permissions $THIS_J2SDK $OTHER_J2SDK $COMPARE_ROOT/j2sdk
+        echo -n "J2RE  "
+        compare_permissions $THIS_J2RE $OTHER_J2RE $COMPARE_ROOT/j2re
+    fi
+    if [ -n "$THIS_J2SDK_OVERLAY" ] && [ -n "$OTHER_J2SDK_OVERLAY" ]; then
+        echo -n "J2SDK Overlay "
+        compare_permissions $THIS_J2SDK_OVERLAY $OTHER_J2SDK_OVERLAY $COMPARE_ROOT/j2sdk-overlay
+        echo -n "J2RE  Overlay "
+        compare_permissions $THIS_J2RE_OVERLAY $OTHER_J2RE_OVERLAY $COMPARE_ROOT/j2re-overlay
+    fi
+fi
+
+if [ "$CMP_TYPES" = "true" ]; then
+    if [ -n "$THIS_J2SDK" ] && [ -n "$OTHER_J2SDK" ]; then
+        echo -n "J2SDK "
+        compare_file_types $THIS_J2SDK $OTHER_J2SDK $COMPARE_ROOT/j2sdk
+        echo -n "J2RE  "
+        compare_file_types $THIS_J2RE $OTHER_J2RE $COMPARE_ROOT/j2re
+    fi
+    if [ -n "$THIS_J2SDK_OVERLAY" ] && [ -n "$OTHER_J2SDK_OVERLAY" ]; then
+        echo -n "J2SDK Overlay "
+        compare_file_types $THIS_J2SDK_OVERLAY $OTHER_J2SDK_OVERLAY $COMPARE_ROOT/j2sdk-overlay
+        echo -n "J2RE  Overlay "
+        compare_file_types $THIS_J2RE_OVERLAY $OTHER_J2RE_OVERLAY $COMPARE_ROOT/j2re-overlay
+    fi
+fi
+
+if [ "$CMP_GENERAL" = "true" ]; then
+    if [ -n "$THIS_J2SDK" ] && [ -n "$OTHER_J2SDK" ]; then
+        echo -n "J2SDK "
+        compare_general_files $THIS_J2SDK $OTHER_J2SDK $COMPARE_ROOT/j2sdk
+        echo -n "J2RE  "
+        compare_general_files $THIS_J2RE $OTHER_J2RE $COMPARE_ROOT/j2re
+    fi
+    if [ -n "$THIS_J2SDK_OVERLAY" ] && [ -n "$OTHER_J2SDK_OVERLAY" ]; then
+        echo -n "J2SDK Overlay "
+        compare_general_files $THIS_J2SDK_OVERLAY $OTHER_J2SDK_OVERLAY $COMPARE_ROOT/j2sdk-overlay
+        echo -n "J2RE  Overlay "
+        compare_general_files $THIS_J2RE_OVERLAY $OTHER_J2RE_OVERLAY $COMPARE_ROOT/j2re-overlay
+    fi
+fi
+
+if [ "$CMP_ZIPS" = "true" ]; then
+    if [ -n "$THIS_J2SDK" ] && [ -n "$OTHER_J2SDK" ]; then
+        compare_all_zip_files $THIS_J2SDK $OTHER_J2SDK $COMPARE_ROOT/j2sdk
+    fi
+fi
+
+if [ "$CMP_JARS" = "true" ]; then
+    if [ -n "$THIS_J2SDK" ] && [ -n "$OTHER_J2SDK" ]; then
+        compare_all_jar_files $THIS_J2SDK $OTHER_J2SDK $COMPARE_ROOT/j2sdk
+    fi
+fi
+
+if [ "$CMP_LIBS" = "true" ]; then
+    if [ -n "$THIS_J2SDK" ] && [ -n "$OTHER_J2SDK" ]; then
+        compare_all_libs $THIS_J2SDK $OTHER_J2SDK $COMPARE_ROOT/j2sdk
+    fi
+    if [ -n "$THIS_J2SDK_OVERLAY" ] && [ -n "$OTHER_J2SDK_OVERLAY" ]; then
+        echo -n "Overlay "
+        compare_all_libs $THIS_J2SDK_OVERLAY $OTHER_J2SDK_OVERLAY $COMPARE_ROOT/j2sdk-overlay
+    fi
+fi
+
+if [ "$CMP_EXECS" = "true" ]; then
+    if [ -n "$THIS_J2SDK" ] && [ -n "$OTHER_J2SDK" ]; then
+        compare_all_execs $THIS_J2SDK $OTHER_J2SDK $COMPARE_ROOT/j2sdk
+    fi
+    if [ -n "$THIS_J2SDK_OVERLAY" ] && [ -n "$OTHER_J2SDK_OVERLAY" ]; then
+        echo -n "Overlay "
+        compare_all_execs $THIS_J2SDK_OVERLAY $OTHER_J2SDK_OVERLAY $COMPARE_ROOT/j2sdk-overlay
+    fi
+fi
+
+echo
+
+if [ -n "$REGRESSIONS" ]; then
+    echo "REGRESSIONS FOUND!"
+    echo
+    exit 1
+else
+    echo "No regressions found"
+    echo
+    exit 0
+fi
--- a/common/autoconf/configure	Wed Jul 05 18:22:17 2017 +0200
+++ b/common/autoconf/configure	Wed Jul 05 18:22:52 2017 +0200
@@ -2,7 +2,12 @@
 
 CONFIGURE_COMMAND_LINE="$@"
 conf_script_dir=`dirname $0`
-conf_closed_script_dir="$conf_script_dir/../../jdk/make/closed/autoconf"
+
+if [ "$CUSTOM_CONFIG_DIR" = "" ]; then
+  conf_custom_script_dir="$conf_script_dir/../../jdk/make/closed/autoconf"
+else
+  conf_custom_script_dir=$CUSTOM_CONFIG_DIR
+fi
 
 ###
 ### Test that the generated configure is up-to-date
@@ -14,8 +19,12 @@
 print_error_not_up_to_date() {
   echo "Error: The configure source files is newer than the generated files."
   echo "Please run 'sh autogen.sh' to update the generated files."
+  echo "Note that this test might trigger incorrectly sometimes due to hg timestamps".
 }
 
+# NOTE: This test can occasionally go wrong due to the way mercurial handles
+# timestamps. It it supposed to aid during development of build-infra, but should
+# go away before making this the default build system.
 for file in configure.ac *.m4 ; do
   if $TEST $file -nt generated-configure.sh; then
     print_error_not_up_to_date
@@ -23,26 +32,32 @@
   fi
 done
 
-if $TEST -e $conf_closed_script_dir/generated-configure.sh; then
-  # If closed source configure is available, make sure it is up-to-date as well.
-  for file in configure.ac *.m4 $conf_closed_script_dir/*.m4; do
-    if $TEST $file -nt $conf_closed_script_dir/generated-configure.sh; then
+if $TEST -e $conf_custom_script_dir/generated-configure.sh; then
+  # If custom source configure is available, make sure it is up-to-date as well.
+  for file in configure.ac *.m4 $conf_custom_script_dir/*.m4; do
+    if $TEST $file -nt $conf_custom_script_dir/generated-configure.sh; then
       print_error_not_up_to_date
       exit 1
     fi
   done
 
-  # Test if open configure is newer than closed configure, if so, closed needs to
-  # be regenerated.
+  # Test if open configure is newer than custom configure, if so, custom needs to
+  # be regenerated. This test is required to ensure consistency with custom source.
   conf_open_configure_timestamp=`grep DATE_WHEN_GENERATED: $conf_script_dir/generated-configure.sh  | cut -d" " -f 3`
-  conf_closed_configure_timestamp=`grep DATE_WHEN_GENERATED: $conf_closed_script_dir/generated-configure.sh  | cut -d" " -f 3`
-  if $TEST $conf_open_configure_timestamp -gt $conf_closed_configure_timestamp; then
-    print_error_not_up_to_date
+  conf_custom_configure_timestamp=`grep DATE_WHEN_GENERATED: $conf_custom_script_dir/generated-configure.sh  | cut -d" " -f 3`
+  if $TEST $conf_open_configure_timestamp -gt $conf_custom_configure_timestamp; then
+    echo "Error: The generated configure file contains changes not present in the custom generated file."
+    echo "Please run 'sh autogen.sh' to update the generated files."
     exit 1
   fi
   
 fi
 
+# Autoconf calls the configure script recursively sometimes. 
+# Don't start logging twice in that case
+if $TEST "x$conf_debug_configure" = xtrue; then
+  conf_debug_configure=recursive
+fi
 ###
 ### Process command-line arguments
 ###
@@ -63,6 +78,12 @@
   --with-extra-cxxflags=*)
     conf_extra_cxxflags=`expr "X$conf_option" : '[^=]*=\(.*\)'`
     continue ;;
+  --debug-configure)
+    if $TEST "x$conf_debug_configure" != xrecursive; then
+      conf_debug_configure=true
+      export conf_debug_configure
+    fi
+    continue ;;
   *)
     conf_processed_arguments="$conf_processed_arguments $conf_option" ;;
   esac
@@ -104,13 +125,29 @@
 ###
 ### Call the configure script
 ###
-if $TEST -e $conf_closed_script_dir/generated-configure.sh; then
-  # Closed source configure available; run that instead
-  . $conf_closed_script_dir/generated-configure.sh $conf_processed_arguments --with-extra-cflags="$conf_extra_cflags" --with-extra-cxxflags="$conf_extra_cxxflags"
+if $TEST -e $conf_custom_script_dir/generated-configure.sh; then
+  # Custom source configure available; run that instead
+  echo Running custom generated-configure.sh
+  conf_script_to_run=$conf_custom_script_dir/generated-configure.sh
 else
-  . $conf_script_dir/generated-configure.sh $conf_processed_arguments --with-extra-cflags="$conf_extra_cflags" --with-extra-cxxflags="$conf_extra_cxxflags"
+  echo Running generated-configure.sh
+  conf_script_to_run=$conf_script_dir/generated-configure.sh
+fi  
+
+if $TEST "x$conf_debug_configure" != x; then
+  # Turn on shell debug output if requested (initial or recursive)
+  set -x
 fi
 
+if $TEST "x$conf_debug_configure" = xtrue; then
+  # Turn on logging, but don't turn on twice when called recursive
+  conf_debug_logfile=./debug-configure.log
+  (exec 3>&1 ; (. $conf_script_to_run $conf_processed_arguments --with-extra-cflags="$conf_extra_cflags" --with-extra-cxxflags="$conf_extra_cxxflags" 2>&1 1>&3 ) | tee -a $conf_debug_logfile 1>&2 ; exec 3>&-) | tee -a $conf_debug_logfile
+else
+  . $conf_script_to_run $conf_processed_arguments --with-extra-cflags="$conf_extra_cflags" --with-extra-cxxflags="$conf_extra_cxxflags"
+fi
+
+conf_result_code=$?
 ###
 ### Post-processing
 ###
@@ -119,3 +156,5 @@
 if $TEST -d "$OUTPUT_ROOT"; then
   mv -f config.log "$OUTPUT_ROOT" 2> /dev/null
 fi
+
+exit $conf_result_code
--- a/common/autoconf/configure.ac	Wed Jul 05 18:22:17 2017 +0200
+++ b/common/autoconf/configure.ac	Wed Jul 05 18:22:52 2017 +0200
@@ -53,9 +53,9 @@
 m4_include([toolchain.m4])
 
 # This line needs to be here, verbatim, after all includes.
-# It is replaced with closed functionality when building
-# closed sources.
-AC_DEFUN_ONCE([CLOSED_HOOK])
+# It is replaced with custom functionality when building
+# custom sources.
+AC_DEFUN_ONCE([CUSTOM_HOOK])
 
 ###############################################################################
 #
@@ -65,6 +65,12 @@
 
 # Basic initialization that must happen first of all
 BASIC_INIT
+
+# Now we can determine OpenJDK build and target platforms. This is required to
+# have early on.
+PLATFORM_SETUP_OPENJDK_BUILD_AND_TARGET
+
+# Continue setting up basic stuff.
 BASIC_SETUP_PATHS
 BASIC_SETUP_LOGGING
 
@@ -75,28 +81,18 @@
 # Without these, we can't properly run the rest of the configure script.
 BASIC_SETUP_TOOLS
 
+# Check if pkg-config is available.
+PKG_PROG_PKG_CONFIG
+
+# After basic tools have been setup, we can check build os specific details.
+PLATFORM_SETUP_OPENJDK_BUILD_OS_VERSION
+
 # Setup builddeps, for automatic downloading of tools we need.
 # This is needed before we can call BDEPS_CHECK_MODULE, which is done in
 # boot-jdk setup, but we need to have basic tools setup first.
 BDEPS_CONFIGURE_BUILDDEPS
 BDEPS_SCAN_FOR_BUILDDEPS
 
-# Check if pkg-config is available.
-PKG_PROG_PKG_CONFIG
-
-###############################################################################
-#
-# Determine OpenJDK build and target platforms.
-#
-###############################################################################
-
-PLATFORM_SETUP_OPENJDK_BUILD_AND_TARGET
-PLATFORM_SETUP_OPENJDK_BUILD_OS_VERSION
-
-# With knowledge of the build platform, setup more basic things.
-BASIC_SETUP_PATH_SEP
-BASIC_SETUP_SEARCHPATH
-
 ###############################################################################
 #
 # Determine OpenJDK variants, options and version numbers.
@@ -148,7 +144,7 @@
 # FIXME: Currently we must test this after paths but before flags. Fix!
 
 # And we can test some aspects on the target using configure macros.
-PLATFORM_TEST_OPENJDK_TARGET_BITS
+PLATFORM_SETUP_OPENJDK_TARGET_BITS
 PLATFORM_SETUP_OPENJDK_TARGET_ENDIANNESS
 
 # Configure flags for the tools
@@ -213,8 +209,8 @@
 # Check for some common pitfalls
 BASIC_TEST_USABILITY_ISSUES
 
-# At the end, call the closed hook. (Dummy macro if no closed sources available)
-CLOSED_HOOK
+# At the end, call the custom hook. (Dummy macro if no custom sources available)
+CUSTOM_HOOK
 
 # We're messing a bit with internal autoconf variables to put the config.status
 # in the output directory instead of the current directory.
@@ -222,5 +218,8 @@
 # Create the actual output files. Now the main work of configure is done.
 AC_OUTPUT
 
+# Make the compare script executable
+$CHMOD +x $OUTPUT_ROOT/compare.sh
+
 # Finally output some useful information to the user
 HELP_PRINT_SUMMARY_AND_WARNINGS
--- a/common/autoconf/generated-configure.sh	Wed Jul 05 18:22:17 2017 +0200
+++ b/common/autoconf/generated-configure.sh	Wed Jul 05 18:22:52 2017 +0200
@@ -597,13 +597,10 @@
 LIBOBJS
 CCACHE
 USE_PRECOMPILED_HEADER
+SJAVAC_SERVER_DIR
 ENABLE_SJAVAC
-JAVAC_USE_MODE
-JAVAC_USE_DEPS
-JAVAC_SERVER_CORES
-JAVAC_SERVERS
-JAVAC_USE_REMOTE
-SERVER_JAVA
+SJAVAC_SERVER_CORES
+SJAVAC_SERVER_JAVA
 MEMORY_SIZE
 CONCURRENT_BUILD_JOBS
 NUM_CORES
@@ -635,6 +632,7 @@
 ZIP_DEBUGINFO_FILES
 ENABLE_DEBUG_SYMBOLS
 UNCYGDRIVE
+LDFLAGS_CXX_JDK
 LDFLAGS_JDKEXE_SUFFIX
 LDFLAGS_JDKLIB_SUFFIX
 LDFLAGS_JDKEXE
@@ -644,6 +642,9 @@
 CFLAGS_JDKEXE
 CFLAGS_JDKLIB
 PACKAGE_PATH
+LEGACY_EXTRA_LDFLAGS
+LEGACY_EXTRA_CXXFLAGS
+LEGACY_EXTRA_CFLAGS
 CXX_FLAG_DEPS
 C_FLAG_DEPS
 CXX_O_FLAG_NONE
@@ -656,6 +657,7 @@
 C_O_FLAG_HIGHEST
 POST_MCS_CMD
 POST_STRIP_CMD
+SET_EXECUTABLE_ORIGIN
 SET_SHARED_LIBRARY_ORIGIN
 CXX_FLAG_REORDER
 C_FLAG_REORDER
@@ -669,14 +671,11 @@
 STATIC_LIBRARY
 SHARED_LIBRARY
 OBJ_SUFFIX
-ENDIAN
-ARCH_DATA_MODEL
-LP64
+LIPO
 OBJCOPY
 MCS
 STRIP
 NM
-ASFLAGS
 AS
 CXXCPP
 CPP
@@ -706,30 +705,18 @@
 LDFLAGS
 CFLAGS
 CC
-HOSTLD
-HOSTCXX
-HOSTCC
-DEFINE_CROSS_COMPILE_ARCH
+BUILD_LD
+BUILD_CXX
+BUILD_CC
 MSVCR100DLL
 CHECK_FOR_VCINSTALLDIR
 SETUPDEVENV
+CYGWIN_LINK
 AR_OUT_OPTION
 LD_OUT_OPTION
 EXE_OUT_OPTION
 CC_OUT_OPTION
-SYS_ROOT
-HOTSPOT_DIST
-JAXWS_DIST
-JAXP_DIST
-CORBA_DIST
-LANGTOOLS_DIST
-IMAGES_OUTPUTDIR
-JDK_OUTPUTDIR
-HOTSPOT_OUTPUTDIR
-JAXWS_OUTPUTDIR
-JAXP_OUTPUTDIR
-CORBA_OUTPUTDIR
-LANGTOOLS_OUTPUTDIR
+BUILD_OUTPUT
 OVERRIDE_SRC_ROOT
 ADD_SRC_ROOT
 JDK_TOPDIR
@@ -739,17 +726,11 @@
 CORBA_TOPDIR
 LANGTOOLS_TOPDIR
 BOOT_JDK_JVMARGS
-NATIVE2ASCII
-RMIC
-JAR
-JAVAH
 JAVAC_FLAGS
-JAVAC
 BOOT_JDK_SOURCETARGET
-JAVA
+BOOT_JDK
 BOOT_TOOLSJAR
 BOOT_RTJAR
-BOOT_JDK
 JAVA_CHECK
 JAVAC_CHECK
 OUTPUT_ROOT
@@ -777,9 +758,6 @@
 CACERTS_FILE
 TEST_IN_BUILD
 DISABLE_NIMBUS
-GENERATE_DOCS
-ENABLE_DOCS
-BUILD_HEADLESS_ONLY
 BUILD_HEADLESS
 SUPPORT_HEADFUL
 SUPPORT_HEADLESS
@@ -790,6 +768,7 @@
 FASTDEBUG
 VARIANT
 DEBUG_LEVEL
+MACOSX_UNIVERSAL
 JVM_VARIANT_ZEROSHARK
 JVM_VARIANT_ZERO
 JVM_VARIANT_KERNEL
@@ -797,39 +776,98 @@
 JVM_VARIANT_SERVER
 JVM_VARIANTS
 JDK_VARIANT
-MINIMIZE_RAM_USAGE
-JAVASE_EMBEDDED
-PATH_SEP
-CYGPATH
+BDEPS_FTP
+BDEPS_UNZIP
 OS_VERSION_MICRO
 OS_VERSION_MINOR
 OS_VERSION_MAJOR
+PKG_CONFIG
+HG
+OBJDUMP
+READELF
+OTOOL
+LDD
+THEPWDCMD
+FIND_DELETE
+RM
+MAKE
+CHECK_TOOLSDIR_MAKE
+CHECK_TOOLSDIR_GMAKE
+CHECK_MAKE
+CHECK_GMAKE
+NAWK
+SED
+FGREP
+EGREP
+GREP
+AWK
+ZIP
+XARGS
+WC
+UNZIP
+UNIQ
+TR
+TOUCH
+TEE
+TAR
+TAIL
+SORT
+SH
+PRINTF
+MV
+MKDIR
+LS
+LN
+HEAD
+FIND
+FILE
+EXPR
+ECHO
+DIFF
+DF
+DATE
+CUT
+CPIO
+CP
+CMP
+CHMOD
+CAT
+BASENAME
+PKGHANDLER
+BUILD_LOG_WRAPPER
+BUILD_LOG_PREVIOUS
+BUILD_LOG
+SYS_ROOT
+PATH_SEP
+CYGPATH
+SRC_ROOT
+READLINK
+DEFINE_CROSS_COMPILE_ARCH
+LP64
+OPENJDK_TARGET_OS_API_DIR
+OPENJDK_TARGET_CPU_JLI_CFLAGS
+OPENJDK_TARGET_CPU_OSARCH
+OPENJDK_TARGET_CPU_ISADIR
+OPENJDK_TARGET_CPU_LIBDIR
+OPENJDK_TARGET_CPU_LEGACY_LIB
+OPENJDK_TARGET_CPU_LEGACY
 REQUIRED_OS_VERSION
 REQUIRED_OS_NAME
-LEGACY_OPENJDK_BUILD_CPU3
-LEGACY_OPENJDK_BUILD_CPU2
-LEGACY_OPENJDK_BUILD_CPU1
+COMPILE_TYPE
 OPENJDK_BUILD_CPU_ENDIAN
 OPENJDK_BUILD_CPU_BITS
 OPENJDK_BUILD_CPU_ARCH
 OPENJDK_BUILD_CPU
-LEGACY_OPENJDK_BUILD_OS_API
 OPENJDK_BUILD_OS_API
-OPENJDK_BUILD_OS_FAMILY
 OPENJDK_BUILD_OS
-LEGACY_OPENJDK_TARGET_CPU3
-LEGACY_OPENJDK_TARGET_CPU2
-LEGACY_OPENJDK_TARGET_CPU1
 OPENJDK_TARGET_CPU_ENDIAN
 OPENJDK_TARGET_CPU_BITS
 OPENJDK_TARGET_CPU_ARCH
 OPENJDK_TARGET_CPU
-LEGACY_OPENJDK_TARGET_OS_API
 OPENJDK_TARGET_OS_API
-OPENJDK_TARGET_OS_FAMILY
 OPENJDK_TARGET_OS
-OPENJDK_BUILD_SYSTEM
-OPENJDK_TARGET_SYSTEM
+OPENJDK_BUILD_AUTOCONF_NAME
+OPENJDK_TARGET_AUTOCONF_NAME
 target_os
 target_vendor
 target_cpu
@@ -842,60 +880,9 @@
 build_vendor
 build_cpu
 build
-PKG_CONFIG
-BDEPS_FTP
-BDEPS_UNZIP
-HG
-FILE
-EXPR
-READELF
-OTOOL
-LDD
-UNZIP
-ZIP
-XARGS
-WC
-TOUCH
-TR
-TEE
-TAIL
-TAR
-SORT
-SH
-SED
-RM
-THEPWDCMD
-PRINTF
-NAWK
-MV
-MKDIR
-MAKE
-LS
-LN
-HEAD
-FIND_DELETE
-FIND
-FGREP
-EGREP
-GREP
-ECHO
-DIFF
-DF
-DATE
-CUT
-CPIO
-CP
-CHMOD
-CAT
-AWK
-PKGHANDLER
-BUILD_LOG_WRAPPER
-BUILD_LOG_PREVIOUS
-BUILD_LOG
-SRC_ROOT
-READLINK
 DATE_WHEN_CONFIGURED
 CONFIGURE_COMMAND_LINE
+CUSTOM_MAKE_DIR
 target_alias
 host_alias
 build_alias
@@ -937,12 +924,16 @@
 ac_subst_files=''
 ac_user_opts='
 enable_option_checking
+with_custom_make_dir
+with_target_bits
+with_sys_root
+with_tools_dir
+with_devkit
 with_builddeps_conf
 with_builddeps_server
 with_builddeps_dir
 with_builddeps_group
 enable_list_builddeps
-with_target_bits
 with_jdk_variant
 with_jvm_variants
 enable_debug
@@ -950,7 +941,6 @@
 enable_openjdk_only
 enable_jigsaw
 enable_headful
-enable_docs
 enable_nimbus
 enable_hotspot_test_in_build
 with_cacerts_file
@@ -968,9 +958,6 @@
 with_override_hotspot
 with_override_jdk
 with_msvcr100dll
-with_sys_root
-with_tools_dir
-with_devkit
 with_extra_cflags
 with_extra_cxxflags
 with_extra_ldflags
@@ -989,11 +976,8 @@
 enable_static_link_stdc__
 with_num_cores
 with_memory_size
-with_server_java
-enable_javac_server
-with_javac_server_cores
-enable_javac_deps
-enable_javac_multi_core
+with_sjavac_server_java
+with_sjavac_server_cores
 enable_sjavac
 enable_precompiled_headers
 enable_ccache
@@ -1649,8 +1633,6 @@
   --enable-jigsaw         build Jigsaw images (not yet available) [disabled]
   --disable-headful       build headful support (graphical UI support)
                           [enabled]
-  --enable-docs           enable generation of Javadoc documentation
-                          [disabled]
   --disable-nimbus        disable Nimbus L&F [enabled]
   --enable-hotspot-test-in-build
                           enable running of Queens test after Hotspot build
@@ -1666,12 +1648,6 @@
   --disable-static-link-stdc++
                           disable static linking of the C++ runtime on Linux
                           [enabled]
-  --enable-javac-server   enable the shared javac server during the build
-                          process [disabled]
-  --enable-javac-deps     enable the dependency tracking between Java packages
-                          [disabled]
-  --enable-javac-multi-core
-                          compile Java packages concurrently [disabled]
   --enable-sjavac         use sjavac to do fast incremental compiles
                           [disabled]
   --disable-precompiled-headers
@@ -1681,6 +1657,16 @@
 Optional Packages:
   --with-PACKAGE[=ARG]    use PACKAGE [ARG=yes]
   --without-PACKAGE       do not use PACKAGE (same as --with-PACKAGE=no)
+  --with-custom-make-dir  directory containing custom build/make files
+  --with-target-bits      build 32-bit or 64-bit binaries (for platforms that
+                          support it), e.g. --with-target-bits=32 [guessed]
+  --with-sys-root         pass this sys-root to the compilers and linker
+                          (useful if the sys-root encoded in the cross
+                          compiler tools is incorrect)
+  --with-tools-dir        search this directory for (cross-compiling)
+                          compilers and tools
+  --with-devkit           use this directory as base for tools-dir and
+                          sys-root (for cross-compiling)
   --with-builddeps-conf   use this configuration file for the builddeps
   --with-builddeps-server download and use build dependencies from this server
                           url, e.g.
@@ -1689,9 +1675,7 @@
                           [d/localhome/builddeps]
   --with-builddeps-group  chgrp the downloaded build dependencies to this
                           group
-  --with-target-bits      build 32-bit or 64-bit binaries (for platforms that
-                          support it), e.g. --with-target-bits=32 [guessed]
-  --with-jdk-variant      JDK variant to build (normal, embedded) [normal]
+  --with-jdk-variant      JDK variant to build (normal) [normal]
   --with-jvm-variants     JVM variants (separated by commas) to build (server,
                           client, kernel, zero, zeroshark) [server]
   --with-debug-level      set the debug level (release, fastdebug, slowdebug)
@@ -1724,12 +1708,6 @@
   --with-override-hotspot use this hotspot dir for the build
   --with-override-jdk     use this jdk dir for the build
   --with-msvcr100dll      copy this msvcr100.dll into the built JDK
-  --with-sys-root         pass this sys-root to the compilers and linker
-                          (useful if the sys-root encoded in the cross
-                          compiler tools is incorrect)
-  --with-tools-dir        search this directory for compilers and tools
-  --with-devkit           use this directory as base for tools-dir and
-                          sys-root
   --with-extra-cflags     extra flags to be used when compiling jdk c-files
   --with-extra-cxxflags   extra flags to be used when compiling jdk c++-files
   --with-extra-ldflags    extra flags to be used when linking jdk
@@ -1753,13 +1731,15 @@
                           --with-num-cores=8 [probed]
   --with-memory-size      memory (in MB) available in the build system, e.g.
                           --with-memory-size=1024 [probed]
-  --with-server-java      use this java binary for running the javac
+  --with-sjavac-server-java
+                          use this java binary for running the sjavac
                           background server and other long running java tasks
                           in the build process, e.g.
-                          ---with-server-java="/opt/jrockit/bin/java -server"
-  --with-javac-server-cores
+                          ---with-sjavac-server-java="/opt/jrockit/bin/java
+                          -server"
+  --with-sjavac-server-cores
                           use at most this number of concurrent threads on the
-                          javac server [probed]
+                          sjavac server [probed]
   --with-ccache-dir       where to store ccache files [~/.ccache]
 
 Some influential environment variables:
@@ -2053,6 +2033,97 @@
 
 } # ac_fn_cxx_try_cpp
 
+# ac_fn_cxx_check_header_mongrel LINENO HEADER VAR INCLUDES
+# ---------------------------------------------------------
+# Tests whether HEADER exists, giving a warning if it cannot be compiled using
+# the include files in INCLUDES and setting the cache variable VAR
+# accordingly.
+ac_fn_cxx_check_header_mongrel ()
+{
+  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+  if eval "test \"\${$3+set}\"" = set; then :
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
+$as_echo_n "checking for $2... " >&6; }
+if eval "test \"\${$3+set}\"" = set; then :
+  $as_echo_n "(cached) " >&6
+fi
+eval ac_res=\$$3
+	       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+else
+  # Is the header compilable?
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 usability" >&5
+$as_echo_n "checking $2 usability... " >&6; }
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+$4
+#include <$2>
+_ACEOF
+if ac_fn_cxx_try_compile "$LINENO"; then :
+  ac_header_compiler=yes
+else
+  ac_header_compiler=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_compiler" >&5
+$as_echo "$ac_header_compiler" >&6; }
+
+# Is the header present?
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 presence" >&5
+$as_echo_n "checking $2 presence... " >&6; }
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <$2>
+_ACEOF
+if ac_fn_cxx_try_cpp "$LINENO"; then :
+  ac_header_preproc=yes
+else
+  ac_header_preproc=no
+fi
+rm -f conftest.err conftest.i conftest.$ac_ext
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_preproc" >&5
+$as_echo "$ac_header_preproc" >&6; }
+
+# So?  What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_cxx_preproc_warn_flag in #((
+  yes:no: )
+    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&5
+$as_echo "$as_me: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&2;}
+    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5
+$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;}
+    ;;
+  no:yes:* )
+    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: present but cannot be compiled" >&5
+$as_echo "$as_me: WARNING: $2: present but cannot be compiled" >&2;}
+    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2:     check for missing prerequisite headers?" >&5
+$as_echo "$as_me: WARNING: $2:     check for missing prerequisite headers?" >&2;}
+    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: see the Autoconf documentation" >&5
+$as_echo "$as_me: WARNING: $2: see the Autoconf documentation" >&2;}
+    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2:     section \"Present But Cannot Be Compiled\"" >&5
+$as_echo "$as_me: WARNING: $2:     section \"Present But Cannot Be Compiled\"" >&2;}
+    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5
+$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;}
+( $as_echo "## ----------------------------------------- ##
+## Report this to build-dev@openjdk.java.net ##
+## ----------------------------------------- ##"
+     ) | sed "s/^/$as_me: WARNING:     /" >&2
+    ;;
+esac
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
+$as_echo_n "checking for $2... " >&6; }
+if eval "test \"\${$3+set}\"" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  eval "$3=\$ac_header_compiler"
+fi
+eval ac_res=\$$3
+	       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+fi
+  eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
+
+} # ac_fn_cxx_check_header_mongrel
+
 # ac_fn_cxx_try_run LINENO
 # ------------------------
 # Try to link conftest.$ac_ext, and return whether this succeeded. Assumes
@@ -2095,6 +2166,37 @@
 
 } # ac_fn_cxx_try_run
 
+# ac_fn_cxx_check_header_compile LINENO HEADER VAR INCLUDES
+# ---------------------------------------------------------
+# Tests whether HEADER exists and can be compiled using the include files in
+# INCLUDES, setting the cache variable VAR accordingly.
+ac_fn_cxx_check_header_compile ()
+{
+  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
+$as_echo_n "checking for $2... " >&6; }
+if eval "test \"\${$3+set}\"" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+$4
+#include <$2>
+_ACEOF
+if ac_fn_cxx_try_compile "$LINENO"; then :
+  eval "$3=yes"
+else
+  eval "$3=no"
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+eval ac_res=\$$3
+	       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+  eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
+
+} # ac_fn_cxx_check_header_compile
+
 # ac_fn_cxx_compute_int LINENO EXPR VAR INCLUDES
 # ----------------------------------------------
 # Tries to find the compile-time value of EXPR in a program that includes
@@ -2273,37 +2375,6 @@
 
 } # ac_fn_cxx_compute_int
 
-# ac_fn_cxx_check_header_compile LINENO HEADER VAR INCLUDES
-# ---------------------------------------------------------
-# Tests whether HEADER exists and can be compiled using the include files in
-# INCLUDES, setting the cache variable VAR accordingly.
-ac_fn_cxx_check_header_compile ()
-{
-  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
-$as_echo_n "checking for $2... " >&6; }
-if eval "test \"\${$3+set}\"" = set; then :
-  $as_echo_n "(cached) " >&6
-else
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-$4
-#include <$2>
-_ACEOF
-if ac_fn_cxx_try_compile "$LINENO"; then :
-  eval "$3=yes"
-else
-  eval "$3=no"
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-eval ac_res=\$$3
-	       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-  eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
-
-} # ac_fn_cxx_check_header_compile
-
 # ac_fn_cxx_try_link LINENO
 # -------------------------
 # Try to link conftest.$ac_ext, and return whether this succeeded.
@@ -2507,97 +2578,6 @@
   eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
 
 } # ac_fn_c_check_header_mongrel
-
-# ac_fn_cxx_check_header_mongrel LINENO HEADER VAR INCLUDES
-# ---------------------------------------------------------
-# Tests whether HEADER exists, giving a warning if it cannot be compiled using
-# the include files in INCLUDES and setting the cache variable VAR
-# accordingly.
-ac_fn_cxx_check_header_mongrel ()
-{
-  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
-  if eval "test \"\${$3+set}\"" = set; then :
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
-$as_echo_n "checking for $2... " >&6; }
-if eval "test \"\${$3+set}\"" = set; then :
-  $as_echo_n "(cached) " >&6
-fi
-eval ac_res=\$$3
-	       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-else
-  # Is the header compilable?
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 usability" >&5
-$as_echo_n "checking $2 usability... " >&6; }
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-$4
-#include <$2>
-_ACEOF
-if ac_fn_cxx_try_compile "$LINENO"; then :
-  ac_header_compiler=yes
-else
-  ac_header_compiler=no
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_compiler" >&5
-$as_echo "$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 presence" >&5
-$as_echo_n "checking $2 presence... " >&6; }
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-#include <$2>
-_ACEOF
-if ac_fn_cxx_try_cpp "$LINENO"; then :
-  ac_header_preproc=yes
-else
-  ac_header_preproc=no
-fi
-rm -f conftest.err conftest.i conftest.$ac_ext
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_preproc" >&5
-$as_echo "$ac_header_preproc" >&6; }
-
-# So?  What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_cxx_preproc_warn_flag in #((
-  yes:no: )
-    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&5
-$as_echo "$as_me: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5
-$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;}
-    ;;
-  no:yes:* )
-    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: present but cannot be compiled" >&5
-$as_echo "$as_me: WARNING: $2: present but cannot be compiled" >&2;}
-    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2:     check for missing prerequisite headers?" >&5
-$as_echo "$as_me: WARNING: $2:     check for missing prerequisite headers?" >&2;}
-    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: see the Autoconf documentation" >&5
-$as_echo "$as_me: WARNING: $2: see the Autoconf documentation" >&2;}
-    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2:     section \"Present But Cannot Be Compiled\"" >&5
-$as_echo "$as_me: WARNING: $2:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5
-$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;}
-( $as_echo "## ----------------------------------------- ##
-## Report this to build-dev@openjdk.java.net ##
-## ----------------------------------------- ##"
-     ) | sed "s/^/$as_me: WARNING:     /" >&2
-    ;;
-esac
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
-$as_echo_n "checking for $2... " >&6; }
-if eval "test \"\${$3+set}\"" = set; then :
-  $as_echo_n "(cached) " >&6
-else
-  eval "$3=\$ac_header_compiler"
-fi
-eval ac_res=\$$3
-	       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-fi
-  eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
-
-} # ac_fn_cxx_check_header_mongrel
 cat >config.log <<_ACEOF
 This file contains any messages produced by compilers while
 running configure, to aid debugging if configure makes a mistake.
@@ -2952,7 +2932,7 @@
 
 
 # Do not change or remove the following line, it is needed for consistency checks:
-# DATE_WHEN_GENERATED: 1341161875
+# DATE_WHEN_GENERATED: 1347963060
 
 ac_aux_dir=
 for ac_dir in build-aux "$srcdir"/build-aux; do
@@ -3083,10 +3063,7 @@
 
 
 
-
-
-
-
+# Setup basic configuration paths, and platform-specific stuff related to PATHs.
 
 
 
@@ -3096,10 +3073,25 @@
 
 #%%% Simple tools %%%
 
-
-
-
-
+# Check if we have found a usable version of make
+# $1: the path to a potential make binary (or empty)
+# $2: the description on how we found this
+
+
+# Goes looking for a usable version of GNU make.
+
+
+
+
+# Test that variable $1 denoting a program is not empty. If empty, exit with an error.
+# $1: variable to check
+# $2: executable name to print in warning (optional)
+
+
+# Does AC_PATH_PROG followed by CHECK_NONEMPTY.
+# Arguments as AC_PATH_PROG:
+# $1: variable to set
+# $2: executable name to look for
 
 
 
@@ -3176,9 +3168,43 @@
 # questions.
 #
 
-# Fixes paths on windows to be mixed mode short.
-
-
+# Execute the check given as argument, and verify the result
+# If the Boot JDK was previously found, do nothing
+# $1 A command line (typically autoconf macro) to execute
+
+
+# Test: Is bootjdk explicitely set by command line arguments?
+
+
+# Test: Is bootjdk available from builddeps?
+
+
+# Test: Is $JAVA_HOME set?
+
+
+# Test: Is there a java or javac in the PATH, which is a symlink to the JDK?
+
+
+# Test: Is there a /usr/libexec/java_home? (Typically on MacOSX)
+
+
+# Look for a jdk in the given path. If there are multiple, try to select the newest.
+# If found, set BOOT_JDK and BOOT_JDK_FOUND.
+# $1 = Path to directory containing jdk installations.
+# $2 = String to append to the found JDK directory to get the proper JDK home
+
+
+# Call BOOTJDK_FIND_BEST_JDK_IN_DIRECTORY, but use the given
+# environmental variable as base for where to look.
+# $1 Name of an environmal variable, assumed to point to the Program Files directory.
+
+
+# Test: Is there a JDK installed in default, well-known locations?
+
+
+# Check that a command-line tool in the Boot JDK is correct
+# $1 = name of variable to assign
+# $2 = name of binary
 
 
 ###############################################################################
@@ -3360,6 +3386,18 @@
 
 
 
+# Support for customization of the build process. Some build files
+# will include counterparts from this location, if they exist. This allows
+# for a degree of customization of the build targets and the rules/recipes
+# to create them
+
+# Check whether --with-custom-make-dir was given.
+if test "${with_custom_make_dir+set}" = set; then :
+  withval=$with_custom_make_dir; CUSTOM_MAKE_DIR=$with_custom_make_dir
+fi
+
+
+
 #
 # Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -3424,14 +3462,31 @@
 # questions.
 #
 
-
-
-
-
-
-
-
-
+# Support macro for PLATFORM_EXTRACT_TARGET_AND_BUILD.
+# Converts autoconf style CPU name to OpenJDK style, into
+# VAR_CPU, VAR_CPU_ARCH, VAR_CPU_BITS and VAR_CPU_ENDIAN.
+
+
+# Support macro for PLATFORM_EXTRACT_TARGET_AND_BUILD.
+# Converts autoconf style OS name to OpenJDK style, into
+# VAR_OS and VAR_OS_API.
+
+
+# Expects $host_os $host_cpu $build_os and $build_cpu
+# and $with_target_bits to have been setup!
+#
+# Translate the standard triplet(quadruplet) definition
+# of the target/build system into OPENJDK_TARGET_OS, OPENJDK_TARGET_CPU,
+# OPENJDK_BUILD_OS, etc.
+
+
+# Check if a reduced build (32-bit on 64-bit platforms) is requested, and modify behaviour
+# accordingly. Must be done after setting up build and target system, but before
+# doing anything else with these values.
+
+
+    # Setup the legacy variables, for controlling the old makefiles.
+    #
 
 
 
@@ -3441,6 +3496,8 @@
 
 
 
+# Support macro for PLATFORM_SETUP_OPENJDK_TARGET_BITS.
+# Add -mX to various FLAGS variables.
 
 
 
@@ -3519,8 +3576,8 @@
 
 
 # This line needs to be here, verbatim, after all includes.
-# It is replaced with closed functionality when building
-# closed sources.
+# It is replaced with custom functionality when building
+# custom sources.
 
 
 ###############################################################################
@@ -3536,6 +3593,501 @@
 DATE_WHEN_CONFIGURED=`LANG=C date`
 
 
+
+# Now we can determine OpenJDK build and target platforms. This is required to
+# have early on.
+# Make sure we can run config.sub.
+$SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 ||
+  as_fn_error $? "cannot run $SHELL $ac_aux_dir/config.sub" "$LINENO" 5
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking build system type" >&5
+$as_echo_n "checking build system type... " >&6; }
+if test "${ac_cv_build+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_build_alias=$build_alias
+test "x$ac_build_alias" = x &&
+  ac_build_alias=`$SHELL "$ac_aux_dir/config.guess"`
+test "x$ac_build_alias" = x &&
+  as_fn_error $? "cannot guess build type; you must specify one" "$LINENO" 5
+ac_cv_build=`$SHELL "$ac_aux_dir/config.sub" $ac_build_alias` ||
+  as_fn_error $? "$SHELL $ac_aux_dir/config.sub $ac_build_alias failed" "$LINENO" 5
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_build" >&5
+$as_echo "$ac_cv_build" >&6; }
+case $ac_cv_build in
+*-*-*) ;;
+*) as_fn_error $? "invalid value of canonical build" "$LINENO" 5 ;;
+esac
+build=$ac_cv_build
+ac_save_IFS=$IFS; IFS='-'
+set x $ac_cv_build
+shift
+build_cpu=$1
+build_vendor=$2
+shift; shift
+# Remember, the first character of IFS is used to create $*,
+# except with old shells:
+build_os=$*
+IFS=$ac_save_IFS
+case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking host system type" >&5
+$as_echo_n "checking host system type... " >&6; }
+if test "${ac_cv_host+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test "x$host_alias" = x; then
+  ac_cv_host=$ac_cv_build
+else
+  ac_cv_host=`$SHELL "$ac_aux_dir/config.sub" $host_alias` ||
+    as_fn_error $? "$SHELL $ac_aux_dir/config.sub $host_alias failed" "$LINENO" 5
+fi
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_host" >&5
+$as_echo "$ac_cv_host" >&6; }
+case $ac_cv_host in
+*-*-*) ;;
+*) as_fn_error $? "invalid value of canonical host" "$LINENO" 5 ;;
+esac
+host=$ac_cv_host
+ac_save_IFS=$IFS; IFS='-'
+set x $ac_cv_host
+shift
+host_cpu=$1
+host_vendor=$2
+shift; shift
+# Remember, the first character of IFS is used to create $*,
+# except with old shells:
+host_os=$*
+IFS=$ac_save_IFS
+case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking target system type" >&5
+$as_echo_n "checking target system type... " >&6; }
+if test "${ac_cv_target+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test "x$target_alias" = x; then
+  ac_cv_target=$ac_cv_host
+else
+  ac_cv_target=`$SHELL "$ac_aux_dir/config.sub" $target_alias` ||
+    as_fn_error $? "$SHELL $ac_aux_dir/config.sub $target_alias failed" "$LINENO" 5
+fi
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_target" >&5
+$as_echo "$ac_cv_target" >&6; }
+case $ac_cv_target in
+*-*-*) ;;
+*) as_fn_error $? "invalid value of canonical target" "$LINENO" 5 ;;
+esac
+target=$ac_cv_target
+ac_save_IFS=$IFS; IFS='-'
+set x $ac_cv_target
+shift
+target_cpu=$1
+target_vendor=$2
+shift; shift
+# Remember, the first character of IFS is used to create $*,
+# except with old shells:
+target_os=$*
+IFS=$ac_save_IFS
+case $target_os in *\ *) target_os=`echo "$target_os" | sed 's/ /-/g'`;; esac
+
+
+# The aliases save the names the user supplied, while $host etc.
+# will get canonicalized.
+test -n "$target_alias" &&
+  test "$program_prefix$program_suffix$program_transform_name" = \
+    NONENONEs,x,x, &&
+  program_prefix=${target_alias}-
+
+# Figure out the build and target systems. # Note that in autoconf terminology, "build" is obvious, but "target"
+# is confusing; it assumes you are cross-compiling a cross-compiler (!)  and "target" is thus the target of the
+# product you're building. The target of this build is called "host". Since this is confusing to most people, we
+# have not adopted that system, but use "target" as the platform we are building for. In some places though we need
+# to use the configure naming style.
+
+
+
+
+
+    # Copy the autoconf trip/quadruplet verbatim to OPENJDK_TARGET_AUTOCONF_NAME
+    # (from the autoconf "host") and OPENJDK_BUILD_AUTOCONF_NAME
+    # Note that we might later on rewrite e.g. OPENJDK_TARGET_CPU due to reduced build,
+    # but this will not change the value of OPENJDK_TARGET_AUTOCONF_NAME.
+    OPENJDK_TARGET_AUTOCONF_NAME="$host"
+    OPENJDK_BUILD_AUTOCONF_NAME="$build"
+
+
+
+    # Convert the autoconf OS/CPU value to our own data, into the VAR_OS/CPU variables.
+
+  case "$host_os" in
+    *linux*)
+      VAR_OS=linux
+      VAR_OS_API=posix
+      ;;
+    *solaris*)
+      VAR_OS=solaris
+      VAR_OS_API=posix
+      ;;
+    *darwin*)
+      VAR_OS=macosx
+      VAR_OS_API=posix
+      ;;
+    *bsd*)
+      VAR_OS=bsd
+      VAR_OS_API=posix
+      ;;
+    *cygwin*|*windows*)
+      VAR_OS=windows
+      VAR_OS_API=winapi
+      ;;
+    *)
+      as_fn_error $? "unsupported operating system $host_os" "$LINENO" 5
+      ;;
+  esac
+
+
+  # First argument is the cpu name from the trip/quad
+  case "$host_cpu" in
+    x86_64)
+      VAR_CPU=x86_64
+      VAR_CPU_ARCH=x86
+      VAR_CPU_BITS=64
+      VAR_CPU_ENDIAN=little
+      ;;
+    i?86)
+      VAR_CPU=x86
+      VAR_CPU_ARCH=x86
+      VAR_CPU_BITS=32
+      VAR_CPU_ENDIAN=little
+      ;;
+    arm*)
+      VAR_CPU=arm
+      VAR_CPU_ARCH=arm
+      VAR_CPU_BITS=32
+      VAR_CPU_ENDIAN=little
+      ;;
+    powerpc)
+      VAR_CPU=ppc
+      VAR_CPU_ARCH=ppc
+      VAR_CPU_BITS=32
+      VAR_CPU_ENDIAN=big
+       ;;
+    powerpc64)
+      VAR_CPU=ppc64
+      VAR_CPU_ARCH=ppc
+      VAR_CPU_BITS=64
+      VAR_CPU_ENDIAN=big
+       ;;
+    sparc)
+      VAR_CPU=sparc
+      VAR_CPU_ARCH=sparc
+      VAR_CPU_BITS=32
+      VAR_CPU_ENDIAN=big
+       ;;
+    sparcv9)
+      VAR_CPU=sparcv9
+      VAR_CPU_ARCH=sparc
+      VAR_CPU_BITS=64
+      VAR_CPU_ENDIAN=big
+       ;;
+    *)
+      as_fn_error $? "unsupported cpu $host_cpu" "$LINENO" 5
+      ;;
+  esac
+
+    # ... and setup our own variables. (Do this explicitely to facilitate searching)
+    OPENJDK_TARGET_OS="$VAR_OS"
+    OPENJDK_TARGET_OS_API="$VAR_OS_API"
+    OPENJDK_TARGET_CPU="$VAR_CPU"
+    OPENJDK_TARGET_CPU_ARCH="$VAR_CPU_ARCH"
+    OPENJDK_TARGET_CPU_BITS="$VAR_CPU_BITS"
+    OPENJDK_TARGET_CPU_ENDIAN="$VAR_CPU_ENDIAN"
+
+
+
+
+
+
+
+    # Convert the autoconf OS/CPU value to our own data, into the VAR_OS/CPU variables.
+
+  case "$build_os" in
+    *linux*)
+      VAR_OS=linux
+      VAR_OS_API=posix
+      ;;
+    *solaris*)
+      VAR_OS=solaris
+      VAR_OS_API=posix
+      ;;
+    *darwin*)
+      VAR_OS=macosx
+      VAR_OS_API=posix
+      ;;
+    *bsd*)
+      VAR_OS=bsd
+      VAR_OS_API=posix
+      ;;
+    *cygwin*|*windows*)
+      VAR_OS=windows
+      VAR_OS_API=winapi
+      ;;
+    *)
+      as_fn_error $? "unsupported operating system $build_os" "$LINENO" 5
+      ;;
+  esac
+
+
+  # First argument is the cpu name from the trip/quad
+  case "$build_cpu" in
+    x86_64)
+      VAR_CPU=x86_64
+      VAR_CPU_ARCH=x86
+      VAR_CPU_BITS=64
+      VAR_CPU_ENDIAN=little
+      ;;
+    i?86)
+      VAR_CPU=x86
+      VAR_CPU_ARCH=x86
+      VAR_CPU_BITS=32
+      VAR_CPU_ENDIAN=little
+      ;;
+    arm*)
+      VAR_CPU=arm
+      VAR_CPU_ARCH=arm
+      VAR_CPU_BITS=32
+      VAR_CPU_ENDIAN=little
+      ;;
+    powerpc)
+      VAR_CPU=ppc
+      VAR_CPU_ARCH=ppc
+      VAR_CPU_BITS=32
+      VAR_CPU_ENDIAN=big
+       ;;
+    powerpc64)
+      VAR_CPU=ppc64
+      VAR_CPU_ARCH=ppc
+      VAR_CPU_BITS=64
+      VAR_CPU_ENDIAN=big
+       ;;
+    sparc)
+      VAR_CPU=sparc
+      VAR_CPU_ARCH=sparc
+      VAR_CPU_BITS=32
+      VAR_CPU_ENDIAN=big
+       ;;
+    sparcv9)
+      VAR_CPU=sparcv9
+      VAR_CPU_ARCH=sparc
+      VAR_CPU_BITS=64
+      VAR_CPU_ENDIAN=big
+       ;;
+    *)
+      as_fn_error $? "unsupported cpu $build_cpu" "$LINENO" 5
+      ;;
+  esac
+
+    # ..and setup our own variables. (Do this explicitely to facilitate searching)
+    OPENJDK_BUILD_OS="$VAR_OS"
+    OPENJDK_BUILD_OS_API="$VAR_OS_API"
+    OPENJDK_BUILD_CPU="$VAR_CPU"
+    OPENJDK_BUILD_CPU_ARCH="$VAR_CPU_ARCH"
+    OPENJDK_BUILD_CPU_BITS="$VAR_CPU_BITS"
+    OPENJDK_BUILD_CPU_ENDIAN="$VAR_CPU_ENDIAN"
+
+
+
+
+
+
+
+
+
+# Check whether --with-target-bits was given.
+if test "${with_target_bits+set}" = set; then :
+  withval=$with_target_bits;
+fi
+
+
+  # We have three types of compiles:
+  # native  == normal compilation, target system == build system
+  # cross   == traditional cross compilation, target system != build system; special toolchain needed
+  # reduced == using native compilers, but with special flags (e.g. -m32) to produce 32-bit builds on 64-bit machines
+  #
+  if test "x$OPENJDK_BUILD_AUTOCONF_NAME" != "x$OPENJDK_TARGET_AUTOCONF_NAME"; then
+    # We're doing a proper cross-compilation
+    COMPILE_TYPE="cross"
+  else
+    COMPILE_TYPE="native"
+  fi
+
+  if test "x$with_target_bits" != x; then
+    if test "x$COMPILE_TYPE" = "xcross"; then
+      as_fn_error $? "It is not possible to combine --with-target-bits=X and proper cross-compilation. Choose either." "$LINENO" 5
+    fi
+
+    if test "x$with_target_bits" = x32 && test "x$OPENJDK_TARGET_CPU_BITS" = x64; then
+      # A reduced build is requested
+      COMPILE_TYPE="reduced"
+      OPENJDK_TARGET_CPU_BITS=32
+      if test "x$OPENJDK_TARGET_CPU_ARCH" = "xx86"; then
+        OPENJDK_TARGET_CPU=x86
+      elif test "x$OPENJDK_TARGET_CPU_ARCH" = "xsparc"; then
+        OPENJDK_TARGET_CPU=sparc
+      else
+        as_fn_error $? "Reduced build (--with-target-bits=32) is only supported on x86_64 and sparcv9" "$LINENO" 5
+      fi
+    elif test "x$with_target_bits" = x64 && test "x$OPENJDK_TARGET_CPU_BITS" = x32; then
+      as_fn_error $? "It is not possible to use --with-target-bits=64 on a 32 bit system. Use proper cross-compilation instead." "$LINENO" 5
+    elif test "x$with_target_bits" = "x$OPENJDK_TARGET_CPU_BITS"; then
+      { $as_echo "$as_me:${as_lineno-$LINENO}: --with-target-bits are set to build platform address size; argument has no meaning" >&5
+$as_echo "$as_me: --with-target-bits are set to build platform address size; argument has no meaning" >&6;}
+    else
+      as_fn_error $? "--with-target-bits can only be 32 or 64, you specified $with_target_bits!" "$LINENO" 5
+    fi
+  fi
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for compilation type" >&5
+$as_echo_n "checking for compilation type... " >&6; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $COMPILE_TYPE" >&5
+$as_echo "$COMPILE_TYPE" >&6; }
+
+
+    if test "x$OPENJDK_TARGET_OS" = "xsolaris"; then
+       REQUIRED_OS_NAME=SunOS
+       REQUIRED_OS_VERSION=5.10
+    fi
+    if test "x$OPENJDK_TARGET_OS" = "xlinux"; then
+       REQUIRED_OS_NAME=Linux
+       REQUIRED_OS_VERSION=2.6
+    fi
+    if test "x$OPENJDK_TARGET_OS" = "xwindows"; then
+        REQUIRED_OS_NAME=Windows
+        if test "x$OPENJDK_TARGET_CPU_BITS" = "x64"; then
+            REQUIRED_OS_VERSION=5.2
+        else
+            REQUIRED_OS_VERSION=5.1
+        fi
+    fi
+    if test "x$OPENJDK_TARGET_OS" = "xmacosx"; then
+        REQUIRED_OS_NAME=Darwin
+        REQUIRED_OS_VERSION=11.2
+    fi
+
+
+
+
+
+    # Also store the legacy naming of the cpu.
+    # Ie i586 and amd64 instead of x86 and x86_64
+    OPENJDK_TARGET_CPU_LEGACY="$OPENJDK_TARGET_CPU"
+    if test "x$OPENJDK_TARGET_CPU" = xx86; then
+      OPENJDK_TARGET_CPU_LEGACY="i586"
+    elif test "x$OPENJDK_TARGET_OS" != xmacosx && test "x$OPENJDK_TARGET_CPU" = xx86_64; then
+      # On all platforms except MacOSX replace x86_64 with amd64.
+      OPENJDK_TARGET_CPU_LEGACY="amd64"
+    fi
+
+
+    # And the second legacy naming of the cpu.
+    # Ie i386 and amd64 instead of x86 and x86_64.
+    OPENJDK_TARGET_CPU_LEGACY_LIB="$OPENJDK_TARGET_CPU"
+    if test "x$OPENJDK_TARGET_CPU" = xx86; then
+      OPENJDK_TARGET_CPU_LEGACY_LIB="i386"
+    elif test "x$OPENJDK_TARGET_CPU" = xx86_64; then
+      OPENJDK_TARGET_CPU_LEGACY_LIB="amd64"
+    fi
+
+
+    # This is the name of the cpu (but using i386 and amd64 instead of
+    # x86 and x86_64, respectively), preceeded by a /, to be used when
+    # locating libraries. On macosx, it's empty, though.
+    OPENJDK_TARGET_CPU_LIBDIR="/$OPENJDK_TARGET_CPU_LEGACY_LIB"
+    if test "x$OPENJDK_TARGET_OS" = xmacosx; then
+        OPENJDK_TARGET_CPU_LIBDIR=""
+    fi
+
+
+    # OPENJDK_TARGET_CPU_ISADIR is normally empty. On 64-bit Solaris systems, it is set to
+    # /amd64 or /sparcv9. This string is appended to some library paths, like this:
+    # /usr/lib${OPENJDK_TARGET_CPU_ISADIR}/libexample.so
+    OPENJDK_TARGET_CPU_ISADIR=""
+    if test "x$OPENJDK_TARGET_OS" = xsolaris; then
+      if test "x$OPENJDK_TARGET_CPU" = xx86_64; then
+          OPENJDK_TARGET_CPU_ISADIR="/amd64"
+      elif test "x$OPENJDK_TARGET_CPU" = xsparcv9; then
+          OPENJDK_TARGET_CPU_ISADIR="/sparcv9"
+      fi
+    fi
+
+
+    # Setup OPENJDK_TARGET_CPU_OSARCH, which is used to set the os.arch Java system property
+    OPENJDK_TARGET_CPU_OSARCH="$OPENJDK_TARGET_CPU"
+    if test "x$OPENJDK_TARGET_OS" = xlinux && test "x$OPENJDK_TARGET_CPU" = xx86; then
+      # On linux only, we replace x86 with i386.
+      OPENJDK_TARGET_CPU_OSARCH="i386"
+    elif test "x$OPENJDK_TARGET_OS" != xmacosx && test "x$OPENJDK_TARGET_CPU" = xx86_64; then
+      # On all platforms except macosx, we replace x86_64 with amd64.
+      OPENJDK_TARGET_CPU_OSARCH="amd64"
+    fi
+
+
+    OPENJDK_TARGET_CPU_JLI="$OPENJDK_TARGET_CPU"
+    if test "x$OPENJDK_TARGET_CPU" = xx86; then
+      OPENJDK_TARGET_CPU_JLI="i386"
+    elif test "x$OPENJDK_TARGET_OS" != xmacosx && test "x$OPENJDK_TARGET_CPU" = xx86_64; then
+      # On all platforms except macosx, we replace x86_64 with amd64.
+      OPENJDK_TARGET_CPU_JLI="amd64"
+    fi
+    # Now setup the -D flags for building libjli.
+    OPENJDK_TARGET_CPU_JLI_CFLAGS="-DLIBARCHNAME='\"$OPENJDK_TARGET_CPU_JLI\"'"
+    if test "x$OPENJDK_TARGET_OS" = xsolaris; then
+      if test "x$OPENJDK_TARGET_CPU_ARCH" = xsparc; then
+        OPENJDK_TARGET_CPU_JLI_CFLAGS="$OPENJDK_TARGET_CPU_JLI_CFLAGS -DLIBARCH32NAME='\"sparc\"' -DLIBARCH64NAME='\"sparcv9\"'"
+      elif test "x$OPENJDK_TARGET_CPU_ARCH" = xx86; then
+        OPENJDK_TARGET_CPU_JLI_CFLAGS="$OPENJDK_TARGET_CPU_JLI_CFLAGS -DLIBARCH32NAME='\"i386\"' -DLIBARCH64NAME='\"amd64\"'"
+      fi
+    fi
+
+
+    # Setup OPENJDK_TARGET_OS_API_DIR, used in source paths.
+    if test "x$OPENJDK_TARGET_OS_API" = xposix; then
+        OPENJDK_TARGET_OS_API_DIR="solaris"
+    fi
+    if test "x$OPENJDK_TARGET_OS_API" = xwinapi; then
+        OPENJDK_TARGET_OS_API_DIR="windows"
+    fi
+
+
+    if test "x$OPENJDK_TARGET_CPU_BITS" = x64; then
+        A_LP64="LP64:="
+        ADD_LP64="-D_LP64=1"
+    fi
+    LP64=$A_LP64
+
+
+    if test "x$COMPILE_TYPE" = "xcross"; then
+      # FIXME: ... or should this include reduced builds..?
+      DEFINE_CROSS_COMPILE_ARCH="CROSS_COMPILE_ARCH:=$OPENJDK_TARGET_CPU_LEGACY"
+    else
+      DEFINE_CROSS_COMPILE_ARCH=""
+    fi
+
+
+
+
+# Continue setting up basic stuff.
+
 # Locate the directory of this script.
 SCRIPT="$0"
 
@@ -3622,7 +4174,6 @@
 
 AUTOCONF_DIR=`dirname $0`
 
-
 # Where is the source? It is located two levels above the configure script.
 CURDIR="$PWD"
 cd "$AUTOCONF_DIR/../.."
@@ -3642,7 +4193,11 @@
     HAS_SPACE=`echo "$SRC_ROOT" | grep " "`
     if test "x$HAS_SPACE" != x; then
         if test "x$OPENJDK_BUILD_OS" = "xwindows"; then
+            # First convert it to DOS-style, short mode (no spaces)
             SRC_ROOT=`$CYGPATH -s -m -a "$SRC_ROOT"`
+            # Now it's case insensitive; let's make it lowercase to improve readability
+            SRC_ROOT=`$ECHO "$SRC_ROOT" | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvqxyz'`
+            # Now convert it back to Unix-stile (cygpath)
             SRC_ROOT=`$CYGPATH -u "$SRC_ROOT"`
         else
             as_fn_error $? "You cannot have spaces in the path to the source root! \"$SRC_ROOT\"" "$LINENO" 5
@@ -3655,7 +4210,11 @@
     HAS_SPACE=`echo "$CURDIR" | grep " "`
     if test "x$HAS_SPACE" != x; then
         if test "x$OPENJDK_BUILD_OS" = "xwindows"; then
+            # First convert it to DOS-style, short mode (no spaces)
             CURDIR=`$CYGPATH -s -m -a "$CURDIR"`
+            # Now it's case insensitive; let's make it lowercase to improve readability
+            CURDIR=`$ECHO "$CURDIR" | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvqxyz'`
+            # Now convert it back to Unix-stile (cygpath)
             CURDIR=`$CYGPATH -u "$CURDIR"`
         else
             as_fn_error $? "You cannot have spaces in the path to the current directory! \"$CURDIR\"" "$LINENO" 5
@@ -3663,6 +4222,101 @@
     fi
 
 
+if test "x$OPENJDK_BUILD_OS" = "xsolaris"; then
+    # Add extra search paths on solaris for utilities like ar and as etc...
+    PATH="$PATH:/usr/ccs/bin:/usr/sfw/bin:/opt/csw/bin"
+fi
+
+# For cygwin we need cygpath first, since it is used everywhere.
+# Extract the first word of "cygpath", so it can be a program name with args.
+set dummy cygpath; 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_CYGPATH+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  case $CYGPATH in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_CYGPATH="$CYGPATH" # 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_CYGPATH="$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
+CYGPATH=$ac_cv_path_CYGPATH
+if test -n "$CYGPATH"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CYGPATH" >&5
+$as_echo "$CYGPATH" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+PATH_SEP=":"
+if test "x$OPENJDK_BUILD_OS" = "xwindows"; then
+    if test "x$CYGPATH" = x; then
+        as_fn_error $? "Something is wrong with your cygwin installation since I cannot find cygpath.exe in your path" "$LINENO" 5
+    fi
+    PATH_SEP=";"
+fi
+
+
+# You can force the sys-root if the sys-root encoded into the cross compiler tools
+# is not correct.
+
+# Check whether --with-sys-root was given.
+if test "${with_sys_root+set}" = set; then :
+  withval=$with_sys_root;
+fi
+
+
+if test "x$with_sys_root" != x; then
+  SYS_ROOT=$with_sys_root
+else
+  SYS_ROOT=/
+fi
+
+
+
+# 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
+
+
+
+# Check whether --with-devkit was given.
+if test "${with_devkit+set}" = set; then :
+  withval=$with_devkit;
+    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
+
+
+
 
 # Setup default logging of stdout and stderr to build.log in the output root.
 BUILD_LOG='$(OUTPUT_ROOT)/build.log'
@@ -3721,6 +4375,1958 @@
 
 # Setup simple tools, that do not need have cross compilation support.
 # Without these, we can't properly run the rest of the configure script.
+
+# Start with tools that do not need have cross compilation support
+# and can be expected to be found in the default PATH. These tools are
+# used by configure. Nor are these tools expected to be found in the
+# devkit from the builddeps server either, since they are
+# needed to download the devkit.
+
+# First are all the simple required tools.
+
+    for ac_prog in basename
+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_BASENAME+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  case $BASENAME in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_BASENAME="$BASENAME" # 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_BASENAME="$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
+BASENAME=$ac_cv_path_BASENAME
+if test -n "$BASENAME"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BASENAME" >&5
+$as_echo "$BASENAME" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+  test -n "$BASENAME" && break
+done
+
+
+    if test "x$BASENAME" = x; then
+        if test "xbasename" = x; then
+          PROG_NAME=basename
+        else
+          PROG_NAME=basename
+        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 cat
+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_CAT+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  case $CAT in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_CAT="$CAT" # 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_CAT="$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
+CAT=$ac_cv_path_CAT
+if test -n "$CAT"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CAT" >&5
+$as_echo "$CAT" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+  test -n "$CAT" && break
+done
+
+
+    if test "x$CAT" = x; then
+        if test "xcat" = x; then
+          PROG_NAME=cat
+        else
+          PROG_NAME=cat
+        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 chmod
+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_CHMOD+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  case $CHMOD in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_CHMOD="$CHMOD" # 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_CHMOD="$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
+CHMOD=$ac_cv_path_CHMOD
+if test -n "$CHMOD"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CHMOD" >&5
+$as_echo "$CHMOD" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+  test -n "$CHMOD" && break
+done
+
+
+    if test "x$CHMOD" = x; then
+        if test "xchmod" = x; then
+          PROG_NAME=chmod
+        else
+          PROG_NAME=chmod
+        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 cmp
+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_CMP+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  case $CMP in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_CMP="$CMP" # 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_CMP="$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
+CMP=$ac_cv_path_CMP
+if test -n "$CMP"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CMP" >&5
+$as_echo "$CMP" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+  test -n "$CMP" && break
+done
+
+
+    if test "x$CMP" = x; then
+        if test "xcmp" = x; then
+          PROG_NAME=cmp
+        else
+          PROG_NAME=cmp
+        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 cp
+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_CP+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  case $CP in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_CP="$CP" # 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_CP="$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
+CP=$ac_cv_path_CP
+if test -n "$CP"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CP" >&5
+$as_echo "$CP" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+  test -n "$CP" && break
+done
+
+
+    if test "x$CP" = x; then
+        if test "xcp" = x; then
+          PROG_NAME=cp
+        else
+          PROG_NAME=cp
+        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 cpio
+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_CPIO+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  case $CPIO in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_CPIO="$CPIO" # 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_CPIO="$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
+CPIO=$ac_cv_path_CPIO
+if test -n "$CPIO"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CPIO" >&5
+$as_echo "$CPIO" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+  test -n "$CPIO" && break
+done
+
+
+    if test "x$CPIO" = x; then
+        if test "xcpio" = x; then
+          PROG_NAME=cpio
+        else
+          PROG_NAME=cpio
+        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 cut
+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_CUT+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  case $CUT in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_CUT="$CUT" # 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_CUT="$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
+CUT=$ac_cv_path_CUT
+if test -n "$CUT"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CUT" >&5
+$as_echo "$CUT" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+  test -n "$CUT" && break
+done
+
+
+    if test "x$CUT" = x; then
+        if test "xcut" = x; then
+          PROG_NAME=cut
+        else
+          PROG_NAME=cut
+        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 date
+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_DATE+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  case $DATE in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_DATE="$DATE" # 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_DATE="$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
+DATE=$ac_cv_path_DATE
+if test -n "$DATE"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DATE" >&5
+$as_echo "$DATE" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+  test -n "$DATE" && break
+done
+
+
+    if test "x$DATE" = x; then
+        if test "xdate" = x; then
+          PROG_NAME=date
+        else
+          PROG_NAME=date
+        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 df
+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_DF+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  case $DF in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_DF="$DF" # 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_DF="$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
+DF=$ac_cv_path_DF
+if test -n "$DF"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DF" >&5
+$as_echo "$DF" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+  test -n "$DF" && break
+done
+
+
+    if test "x$DF" = x; then
+        if test "xdf" = x; then
+          PROG_NAME=df
+        else
+          PROG_NAME=df
+        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 gdiff diff
+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_DIFF+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  case $DIFF in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_DIFF="$DIFF" # 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_DIFF="$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
+DIFF=$ac_cv_path_DIFF
+if test -n "$DIFF"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DIFF" >&5
+$as_echo "$DIFF" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+  test -n "$DIFF" && break
+done
+
+
+    if test "x$DIFF" = x; then
+        if test "xgdiff diff" = x; then
+          PROG_NAME=diff
+        else
+          PROG_NAME=gdiff diff
+        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 echo
+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_ECHO+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  case $ECHO in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_ECHO="$ECHO" # 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_ECHO="$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
+ECHO=$ac_cv_path_ECHO
+if test -n "$ECHO"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ECHO" >&5
+$as_echo "$ECHO" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+  test -n "$ECHO" && break
+done
+
+
+    if test "x$ECHO" = x; then
+        if test "xecho" = x; then
+          PROG_NAME=echo
+        else
+          PROG_NAME=echo
+        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 expr
+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_EXPR+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  case $EXPR in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_EXPR="$EXPR" # 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_EXPR="$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
+EXPR=$ac_cv_path_EXPR
+if test -n "$EXPR"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $EXPR" >&5
+$as_echo "$EXPR" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+  test -n "$EXPR" && break
+done
+
+
+    if test "x$EXPR" = x; then
+        if test "xexpr" = x; then
+          PROG_NAME=expr
+        else
+          PROG_NAME=expr
+        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 file
+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_FILE+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  case $FILE in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_FILE="$FILE" # 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_FILE="$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
+FILE=$ac_cv_path_FILE
+if test -n "$FILE"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $FILE" >&5
+$as_echo "$FILE" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+  test -n "$FILE" && break
+done
+
+
+    if test "x$FILE" = x; then
+        if test "xfile" = x; then
+          PROG_NAME=file
+        else
+          PROG_NAME=file
+        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 find
+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_FIND+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  case $FIND in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_FIND="$FIND" # 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_FIND="$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
+FIND=$ac_cv_path_FIND
+if test -n "$FIND"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $FIND" >&5
+$as_echo "$FIND" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+  test -n "$FIND" && break
+done
+
+
+    if test "x$FIND" = x; then
+        if test "xfind" = x; then
+          PROG_NAME=find
+        else
+          PROG_NAME=find
+        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 head
+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_HEAD+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  case $HEAD in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_HEAD="$HEAD" # 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_HEAD="$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
+HEAD=$ac_cv_path_HEAD
+if test -n "$HEAD"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $HEAD" >&5
+$as_echo "$HEAD" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+  test -n "$HEAD" && break
+done
+
+
+    if test "x$HEAD" = x; then
+        if test "xhead" = x; then
+          PROG_NAME=head
+        else
+          PROG_NAME=head
+        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 ln
+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_LN+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  case $LN in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_LN="$LN" # 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_LN="$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
+LN=$ac_cv_path_LN
+if test -n "$LN"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LN" >&5
+$as_echo "$LN" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+  test -n "$LN" && break
+done
+
+
+    if test "x$LN" = x; then
+        if test "xln" = x; then
+          PROG_NAME=ln
+        else
+          PROG_NAME=ln
+        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 ls
+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_LS+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  case $LS in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_LS="$LS" # 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_LS="$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
+LS=$ac_cv_path_LS
+if test -n "$LS"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LS" >&5
+$as_echo "$LS" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+  test -n "$LS" && break
+done
+
+
+    if test "x$LS" = x; then
+        if test "xls" = x; then
+          PROG_NAME=ls
+        else
+          PROG_NAME=ls
+        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 mkdir
+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_MKDIR+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  case $MKDIR in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_MKDIR="$MKDIR" # 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_MKDIR="$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
+MKDIR=$ac_cv_path_MKDIR
+if test -n "$MKDIR"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MKDIR" >&5
+$as_echo "$MKDIR" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+  test -n "$MKDIR" && break
+done
+
+
+    if test "x$MKDIR" = x; then
+        if test "xmkdir" = x; then
+          PROG_NAME=mkdir
+        else
+          PROG_NAME=mkdir
+        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 mv
+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_MV+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  case $MV in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_MV="$MV" # 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_MV="$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
+MV=$ac_cv_path_MV
+if test -n "$MV"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MV" >&5
+$as_echo "$MV" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+  test -n "$MV" && break
+done
+
+
+    if test "x$MV" = x; then
+        if test "xmv" = x; then
+          PROG_NAME=mv
+        else
+          PROG_NAME=mv
+        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 printf
+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_PRINTF+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  case $PRINTF in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_PRINTF="$PRINTF" # 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_PRINTF="$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
+PRINTF=$ac_cv_path_PRINTF
+if test -n "$PRINTF"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PRINTF" >&5
+$as_echo "$PRINTF" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+  test -n "$PRINTF" && break
+done
+
+
+    if test "x$PRINTF" = x; then
+        if test "xprintf" = x; then
+          PROG_NAME=printf
+        else
+          PROG_NAME=printf
+        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 sh
+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_SH+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  case $SH in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_SH="$SH" # 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_SH="$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
+SH=$ac_cv_path_SH
+if test -n "$SH"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $SH" >&5
+$as_echo "$SH" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+  test -n "$SH" && break
+done
+
+
+    if test "x$SH" = x; then
+        if test "xsh" = x; then
+          PROG_NAME=sh
+        else
+          PROG_NAME=sh
+        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 sort
+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_SORT+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  case $SORT in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_SORT="$SORT" # 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_SORT="$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
+SORT=$ac_cv_path_SORT
+if test -n "$SORT"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $SORT" >&5
+$as_echo "$SORT" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+  test -n "$SORT" && break
+done
+
+
+    if test "x$SORT" = x; then
+        if test "xsort" = x; then
+          PROG_NAME=sort
+        else
+          PROG_NAME=sort
+        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 tail
+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_TAIL+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  case $TAIL in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_TAIL="$TAIL" # 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_TAIL="$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
+TAIL=$ac_cv_path_TAIL
+if test -n "$TAIL"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $TAIL" >&5
+$as_echo "$TAIL" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+  test -n "$TAIL" && break
+done
+
+
+    if test "x$TAIL" = x; then
+        if test "xtail" = x; then
+          PROG_NAME=tail
+        else
+          PROG_NAME=tail
+        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 tar
+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_TAR+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  case $TAR in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_TAR="$TAR" # 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_TAR="$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
+TAR=$ac_cv_path_TAR
+if test -n "$TAR"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $TAR" >&5
+$as_echo "$TAR" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+  test -n "$TAR" && break
+done
+
+
+    if test "x$TAR" = x; then
+        if test "xtar" = x; then
+          PROG_NAME=tar
+        else
+          PROG_NAME=tar
+        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 tee
+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_TEE+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  case $TEE in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_TEE="$TEE" # 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_TEE="$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
+TEE=$ac_cv_path_TEE
+if test -n "$TEE"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $TEE" >&5
+$as_echo "$TEE" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+  test -n "$TEE" && break
+done
+
+
+    if test "x$TEE" = x; then
+        if test "xtee" = x; then
+          PROG_NAME=tee
+        else
+          PROG_NAME=tee
+        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 touch
+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_TOUCH+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  case $TOUCH in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_TOUCH="$TOUCH" # 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_TOUCH="$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
+TOUCH=$ac_cv_path_TOUCH
+if test -n "$TOUCH"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $TOUCH" >&5
+$as_echo "$TOUCH" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+  test -n "$TOUCH" && break
+done
+
+
+    if test "x$TOUCH" = x; then
+        if test "xtouch" = x; then
+          PROG_NAME=touch
+        else
+          PROG_NAME=touch
+        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 tr
+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_TR+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  case $TR in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_TR="$TR" # 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_TR="$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
+TR=$ac_cv_path_TR
+if test -n "$TR"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $TR" >&5
+$as_echo "$TR" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+  test -n "$TR" && break
+done
+
+
+    if test "x$TR" = x; then
+        if test "xtr" = x; then
+          PROG_NAME=tr
+        else
+          PROG_NAME=tr
+        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 uniq
+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_UNIQ+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  case $UNIQ in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_UNIQ="$UNIQ" # 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_UNIQ="$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
+UNIQ=$ac_cv_path_UNIQ
+if test -n "$UNIQ"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $UNIQ" >&5
+$as_echo "$UNIQ" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+  test -n "$UNIQ" && break
+done
+
+
+    if test "x$UNIQ" = x; then
+        if test "xuniq" = x; then
+          PROG_NAME=uniq
+        else
+          PROG_NAME=uniq
+        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 unzip
+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_UNZIP+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  case $UNZIP in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_UNZIP="$UNZIP" # 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_UNZIP="$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
+UNZIP=$ac_cv_path_UNZIP
+if test -n "$UNZIP"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $UNZIP" >&5
+$as_echo "$UNZIP" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+  test -n "$UNZIP" && break
+done
+
+
+    if test "x$UNZIP" = x; then
+        if test "xunzip" = x; then
+          PROG_NAME=unzip
+        else
+          PROG_NAME=unzip
+        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 wc
+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_WC+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  case $WC in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_WC="$WC" # 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_WC="$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
+WC=$ac_cv_path_WC
+if test -n "$WC"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $WC" >&5
+$as_echo "$WC" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+  test -n "$WC" && break
+done
+
+
+    if test "x$WC" = x; then
+        if test "xwc" = x; then
+          PROG_NAME=wc
+        else
+          PROG_NAME=wc
+        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 xargs
+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_XARGS+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  case $XARGS in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_XARGS="$XARGS" # 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_XARGS="$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
+XARGS=$ac_cv_path_XARGS
+if test -n "$XARGS"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $XARGS" >&5
+$as_echo "$XARGS" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+  test -n "$XARGS" && break
+done
+
+
+    if test "x$XARGS" = x; then
+        if test "xxargs" = x; then
+          PROG_NAME=xargs
+        else
+          PROG_NAME=xargs
+        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 zip
+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_ZIP+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  case $ZIP in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_ZIP="$ZIP" # 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_ZIP="$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
+ZIP=$ac_cv_path_ZIP
+if test -n "$ZIP"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ZIP" >&5
+$as_echo "$ZIP" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+  test -n "$ZIP" && break
+done
+
+
+    if test "x$ZIP" = x; then
+        if test "xzip" = x; then
+          PROG_NAME=zip
+        else
+          PROG_NAME=zip
+        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
+
+
+
+# Then required tools that require some special treatment.
+for ac_prog in gawk mawk nawk awk
+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_prog_AWK+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$AWK"; then
+  ac_cv_prog_AWK="$AWK" # Let the user override the test.
+else
+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_prog_AWK="$ac_prog"
+    $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
+
+fi
+fi
+AWK=$ac_cv_prog_AWK
+if test -n "$AWK"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AWK" >&5
+$as_echo "$AWK" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+  test -n "$AWK" && break
+done
+
+
+    if test "x$AWK" = x; then
+        if test "x" = x; then
+          PROG_NAME=awk
+        else
+          PROG_NAME=
+        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
+
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5
 $as_echo_n "checking for grep that handles long lines and -e... " >&6; }
 if test "${ac_cv_path_GREP+set}" = set; then :
@@ -3785,455 +6391,16 @@
 
 
 
-# Start with tools that do not need have cross compilation support
-# and can be expected to be found in the default PATH. These tools are
-# used by configure. Nor are these tools expected to be found in the
-# devkit from the builddeps server either, since they are
-# needed to download the devkit.
-for ac_prog in gawk mawk nawk awk
-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_prog_AWK+set}" = set; then :
-  $as_echo_n "(cached) " >&6
-else
-  if test -n "$AWK"; then
-  ac_cv_prog_AWK="$AWK" # Let the user override the test.
-else
-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_prog_AWK="$ac_prog"
-    $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
-
-fi
-fi
-AWK=$ac_cv_prog_AWK
-if test -n "$AWK"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AWK" >&5
-$as_echo "$AWK" >&6; }
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-
-  test -n "$AWK" && break
-done
-
-
-    # Test that variable AWK is not empty.
-    if test "" = "$AWK"; then as_fn_error $? "Could not find awk !" "$LINENO" 5 ; fi
-
-# Extract the first word of "cat", so it can be a program name with args.
-set dummy cat; 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_CAT+set}" = set; then :
-  $as_echo_n "(cached) " >&6
-else
-  case $CAT in
-  [\\/]* | ?:[\\/]*)
-  ac_cv_path_CAT="$CAT" # 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_CAT="$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
-CAT=$ac_cv_path_CAT
-if test -n "$CAT"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CAT" >&5
-$as_echo "$CAT" >&6; }
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-
-
-    # Test that variable CAT is not empty.
-    if test "" = "$CAT"; then as_fn_error $? "Could not find cat !" "$LINENO" 5 ; fi
-
-# Extract the first word of "chmod", so it can be a program name with args.
-set dummy chmod; 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_CHMOD+set}" = set; then :
-  $as_echo_n "(cached) " >&6
-else
-  case $CHMOD in
-  [\\/]* | ?:[\\/]*)
-  ac_cv_path_CHMOD="$CHMOD" # 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_CHMOD="$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
-CHMOD=$ac_cv_path_CHMOD
-if test -n "$CHMOD"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CHMOD" >&5
-$as_echo "$CHMOD" >&6; }
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-
-
-    # Test that variable CHMOD is not empty.
-    if test "" = "$CHMOD"; then as_fn_error $? "Could not find chmod !" "$LINENO" 5 ; fi
-
-# Extract the first word of "cp", so it can be a program name with args.
-set dummy cp; 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_CP+set}" = set; then :
-  $as_echo_n "(cached) " >&6
-else
-  case $CP in
-  [\\/]* | ?:[\\/]*)
-  ac_cv_path_CP="$CP" # 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_CP="$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
-CP=$ac_cv_path_CP
-if test -n "$CP"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CP" >&5
-$as_echo "$CP" >&6; }
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-
-
-    # Test that variable CP is not empty.
-    if test "" = "$CP"; then as_fn_error $? "Could not find cp !" "$LINENO" 5 ; fi
-
-# Extract the first word of "cpio", so it can be a program name with args.
-set dummy cpio; 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_CPIO+set}" = set; then :
-  $as_echo_n "(cached) " >&6
-else
-  case $CPIO in
-  [\\/]* | ?:[\\/]*)
-  ac_cv_path_CPIO="$CPIO" # 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_CPIO="$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
-CPIO=$ac_cv_path_CPIO
-if test -n "$CPIO"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CPIO" >&5
-$as_echo "$CPIO" >&6; }
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-
-
-    # Test that variable CPIO is not empty.
-    if test "" = "$CPIO"; then as_fn_error $? "Could not find cpio !" "$LINENO" 5 ; fi
-
-# Extract the first word of "cut", so it can be a program name with args.
-set dummy cut; 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_CUT+set}" = set; then :
-  $as_echo_n "(cached) " >&6
-else
-  case $CUT in
-  [\\/]* | ?:[\\/]*)
-  ac_cv_path_CUT="$CUT" # 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_CUT="$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
-CUT=$ac_cv_path_CUT
-if test -n "$CUT"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CUT" >&5
-$as_echo "$CUT" >&6; }
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-
-
-    # Test that variable CUT is not empty.
-    if test "" = "$CUT"; then as_fn_error $? "Could not find cut !" "$LINENO" 5 ; fi
-
-# Extract the first word of "date", so it can be a program name with args.
-set dummy date; 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_DATE+set}" = set; then :
-  $as_echo_n "(cached) " >&6
-else
-  case $DATE in
-  [\\/]* | ?:[\\/]*)
-  ac_cv_path_DATE="$DATE" # 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_DATE="$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
-DATE=$ac_cv_path_DATE
-if test -n "$DATE"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DATE" >&5
-$as_echo "$DATE" >&6; }
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-
-
-    # Test that variable DATE is not empty.
-    if test "" = "$DATE"; then as_fn_error $? "Could not find date !" "$LINENO" 5 ; fi
-
-# Extract the first word of "df", so it can be a program name with args.
-set dummy df; 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_DF+set}" = set; then :
-  $as_echo_n "(cached) " >&6
-else
-  case $DF in
-  [\\/]* | ?:[\\/]*)
-  ac_cv_path_DF="$DF" # 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_DF="$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
-DF=$ac_cv_path_DF
-if test -n "$DF"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DF" >&5
-$as_echo "$DF" >&6; }
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-
-
-    # Test that variable DF is not empty.
-    if test "" = "$DF"; then as_fn_error $? "Could not find df !" "$LINENO" 5 ; fi
-
-# Extract the first word of "diff", so it can be a program name with args.
-set dummy diff; 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_DIFF+set}" = set; then :
-  $as_echo_n "(cached) " >&6
-else
-  case $DIFF in
-  [\\/]* | ?:[\\/]*)
-  ac_cv_path_DIFF="$DIFF" # 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_DIFF="$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
-DIFF=$ac_cv_path_DIFF
-if test -n "$DIFF"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DIFF" >&5
-$as_echo "$DIFF" >&6; }
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-
-
-    # Test that variable DIFF is not empty.
-    if test "" = "$DIFF"; then as_fn_error $? "Could not find diff !" "$LINENO" 5 ; fi
-
-# Warning echo is really, really unportable!!!!! Different
-# behaviour in bash and dash and in a lot of other shells!
-# Use printf for serious work!
-# Extract the first word of "echo", so it can be a program name with args.
-set dummy echo; 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_ECHO+set}" = set; then :
-  $as_echo_n "(cached) " >&6
-else
-  case $ECHO in
-  [\\/]* | ?:[\\/]*)
-  ac_cv_path_ECHO="$ECHO" # 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_ECHO="$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
-ECHO=$ac_cv_path_ECHO
-if test -n "$ECHO"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ECHO" >&5
-$as_echo "$ECHO" >&6; }
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-
-
-    # Test that variable ECHO is not empty.
-    if test "" = "$ECHO"; then as_fn_error $? "Could not find echo !" "$LINENO" 5 ; fi
+    if test "x$GREP" = x; then
+        if test "x" = x; then
+          PROG_NAME=grep
+        else
+          PROG_NAME=
+        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
 
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5
 $as_echo_n "checking for egrep... " >&6; }
@@ -4303,8 +6470,16 @@
 
 
 
-    # Test that variable EGREP is not empty.
-    if test "" = "$EGREP"; then as_fn_error $? "Could not find egrep !" "$LINENO" 5 ; fi
+    if test "x$EGREP" = x; then
+        if test "x" = x; then
+          PROG_NAME=egrep
+        else
+          PROG_NAME=
+        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
 
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for fgrep" >&5
 $as_echo_n "checking for fgrep... " >&6; }
@@ -4374,597 +6549,17 @@
 
 
 
-    # Test that variable FGREP is not empty.
-    if test "" = "$FGREP"; then as_fn_error $? "Could not find fgrep !" "$LINENO" 5 ; fi
-
-
-# Extract the first word of "find", so it can be a program name with args.
-set dummy find; 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_FIND+set}" = set; then :
-  $as_echo_n "(cached) " >&6
-else
-  case $FIND in
-  [\\/]* | ?:[\\/]*)
-  ac_cv_path_FIND="$FIND" # 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_FIND="$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
-FIND=$ac_cv_path_FIND
-if test -n "$FIND"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $FIND" >&5
-$as_echo "$FIND" >&6; }
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-
-
-    # Test that variable FIND is not empty.
-    if test "" = "$FIND"; then as_fn_error $? "Could not find find !" "$LINENO" 5 ; fi
-
-
-    # Test if find supports -delete
-    { $as_echo "$as_me:${as_lineno-$LINENO}: checking if find supports -delete" >&5
-$as_echo_n "checking if find supports -delete... " >&6; }
-    FIND_DELETE="-delete"
-
-    DELETEDIR=`mktemp -d tmp.XXXXXXXXXX` || (echo Could not create temporary directory!; exit $?)
-
-    echo Hejsan > $DELETEDIR/TestIfFindSupportsDelete
-
-    TEST_DELETE=`$FIND "$DELETEDIR" -name TestIfFindSupportsDelete $FIND_DELETE 2>&1`
-    if test -f $DELETEDIR/TestIfFindSupportsDelete; then
-        # No, it does not.
-        rm $DELETEDIR/TestIfFindSupportsDelete
-        FIND_DELETE="-exec rm \{\} \+"
-        { $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
-    rmdir $DELETEDIR
-
-
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5
-$as_echo_n "checking for grep that handles long lines and -e... " >&6; }
-if test "${ac_cv_path_GREP+set}" = set; then :
-  $as_echo_n "(cached) " >&6
-else
-  if test -z "$GREP"; then
-  ac_path_GREP_found=false
-  # Loop through the user's path and test for each of PROGNAME-LIST
-  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-    for ac_prog in grep ggrep; do
-    for ac_exec_ext in '' $ac_executable_extensions; do
-      ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext"
-      { test -f "$ac_path_GREP" && $as_test_x "$ac_path_GREP"; } || continue
-# Check for GNU ac_path_GREP and select it if it is found.
-  # Check for GNU $ac_path_GREP
-case `"$ac_path_GREP" --version 2>&1` in
-*GNU*)
-  ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;;
-*)
-  ac_count=0
-  $as_echo_n 0123456789 >"conftest.in"
-  while :
-  do
-    cat "conftest.in" "conftest.in" >"conftest.tmp"
-    mv "conftest.tmp" "conftest.in"
-    cp "conftest.in" "conftest.nl"
-    $as_echo 'GREP' >> "conftest.nl"
-    "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break
-    diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
-    as_fn_arith $ac_count + 1 && ac_count=$as_val
-    if test $ac_count -gt ${ac_path_GREP_max-0}; then
-      # Best one so far, save it but keep looking for a better one
-      ac_cv_path_GREP="$ac_path_GREP"
-      ac_path_GREP_max=$ac_count
-    fi
-    # 10*(2^10) chars as input seems more than enough
-    test $ac_count -gt 10 && break
-  done
-  rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
-esac
-
-      $ac_path_GREP_found && break 3
-    done
-  done
-  done
-IFS=$as_save_IFS
-  if test -z "$ac_cv_path_GREP"; then
-    as_fn_error $? "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5
-  fi
-else
-  ac_cv_path_GREP=$GREP
-fi
-
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5
-$as_echo "$ac_cv_path_GREP" >&6; }
- GREP="$ac_cv_path_GREP"
-
-
-
-    # Test that variable GREP is not empty.
-    if test "" = "$GREP"; then as_fn_error $? "Could not find grep !" "$LINENO" 5 ; fi
-
-# Extract the first word of "head", so it can be a program name with args.
-set dummy head; 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_HEAD+set}" = set; then :
-  $as_echo_n "(cached) " >&6
-else
-  case $HEAD in
-  [\\/]* | ?:[\\/]*)
-  ac_cv_path_HEAD="$HEAD" # 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_HEAD="$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
-HEAD=$ac_cv_path_HEAD
-if test -n "$HEAD"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $HEAD" >&5
-$as_echo "$HEAD" >&6; }
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-
-
-    # Test that variable HEAD is not empty.
-    if test "" = "$HEAD"; then as_fn_error $? "Could not find head !" "$LINENO" 5 ; fi
-
-# Extract the first word of "ln", so it can be a program name with args.
-set dummy ln; 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_LN+set}" = set; then :
-  $as_echo_n "(cached) " >&6
-else
-  case $LN in
-  [\\/]* | ?:[\\/]*)
-  ac_cv_path_LN="$LN" # 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_LN="$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
-LN=$ac_cv_path_LN
-if test -n "$LN"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LN" >&5
-$as_echo "$LN" >&6; }
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-
-
-    # Test that variable LN is not empty.
-    if test "" = "$LN"; then as_fn_error $? "Could not find ln !" "$LINENO" 5 ; fi
-
-# Extract the first word of "ls", so it can be a program name with args.
-set dummy ls; 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_LS+set}" = set; then :
-  $as_echo_n "(cached) " >&6
-else
-  case $LS in
-  [\\/]* | ?:[\\/]*)
-  ac_cv_path_LS="$LS" # 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_LS="$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
-LS=$ac_cv_path_LS
-if test -n "$LS"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LS" >&5
-$as_echo "$LS" >&6; }
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-
-
-    # Test that variable LS is not empty.
-    if test "" = "$LS"; then as_fn_error $? "Could not find ls !" "$LINENO" 5 ; fi
-
-for ac_prog in gmake make
-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_MAKE+set}" = set; then :
-  $as_echo_n "(cached) " >&6
-else
-  case $MAKE in
-  [\\/]* | ?:[\\/]*)
-  ac_cv_path_MAKE="$MAKE" # 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_MAKE="$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
-MAKE=$ac_cv_path_MAKE
-if test -n "$MAKE"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MAKE" >&5
-$as_echo "$MAKE" >&6; }
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-
-  test -n "$MAKE" && break
-done
-
-
-    # Test that variable MAKE is not empty.
-    if test "" = "$MAKE"; then as_fn_error $? "Could not find make !" "$LINENO" 5 ; fi
-
-MAKE_VERSION=`$MAKE --version | head -n 1 | grep '3.8[12346789]'`
-if test "x$MAKE_VERSION" = x; then
-    as_fn_error $? "You must use GNU make 3.81 or newer! Please put it in the path, or add e.g. MAKE=/opt/gmake3.81/make as argument to configure." "$LINENO" 5
-fi
-# Extract the first word of "mkdir", so it can be a program name with args.
-set dummy mkdir; 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_MKDIR+set}" = set; then :
-  $as_echo_n "(cached) " >&6
-else
-  case $MKDIR in
-  [\\/]* | ?:[\\/]*)
-  ac_cv_path_MKDIR="$MKDIR" # 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_MKDIR="$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
-MKDIR=$ac_cv_path_MKDIR
-if test -n "$MKDIR"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MKDIR" >&5
-$as_echo "$MKDIR" >&6; }
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-
-
-    # Test that variable MKDIR is not empty.
-    if test "" = "$MKDIR"; then as_fn_error $? "Could not find mkdir !" "$LINENO" 5 ; fi
-
-# Extract the first word of "mv", so it can be a program name with args.
-set dummy mv; 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_MV+set}" = set; then :
-  $as_echo_n "(cached) " >&6
-else
-  case $MV in
-  [\\/]* | ?:[\\/]*)
-  ac_cv_path_MV="$MV" # 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_MV="$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
-MV=$ac_cv_path_MV
-if test -n "$MV"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MV" >&5
-$as_echo "$MV" >&6; }
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-
-
-    # Test that variable MV is not empty.
-    if test "" = "$MV"; then as_fn_error $? "Could not find mv !" "$LINENO" 5 ; fi
-
-for ac_prog in nawk gawk awk
-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_NAWK+set}" = set; then :
-  $as_echo_n "(cached) " >&6
-else
-  case $NAWK in
-  [\\/]* | ?:[\\/]*)
-  ac_cv_path_NAWK="$NAWK" # 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_NAWK="$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
-NAWK=$ac_cv_path_NAWK
-if test -n "$NAWK"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $NAWK" >&5
-$as_echo "$NAWK" >&6; }
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-
-  test -n "$NAWK" && break
-done
-
-
-    # Test that variable NAWK is not empty.
-    if test "" = "$NAWK"; then as_fn_error $? "Could not find nawk !" "$LINENO" 5 ; fi
-
-# Extract the first word of "printf", so it can be a program name with args.
-set dummy printf; 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_PRINTF+set}" = set; then :
-  $as_echo_n "(cached) " >&6
-else
-  case $PRINTF in
-  [\\/]* | ?:[\\/]*)
-  ac_cv_path_PRINTF="$PRINTF" # 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_PRINTF="$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
-PRINTF=$ac_cv_path_PRINTF
-if test -n "$PRINTF"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PRINTF" >&5
-$as_echo "$PRINTF" >&6; }
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-
-
-    # Test that variable PRINTF is not empty.
-    if test "" = "$PRINTF"; then as_fn_error $? "Could not find printf !" "$LINENO" 5 ; fi
-
-# Extract the first word of "pwd", so it can be a program name with args.
-set dummy pwd; 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
-
-
-# Extract the first word of "rm", so it can be a program name with args.
-set dummy rm; 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_RM+set}" = set; then :
-  $as_echo_n "(cached) " >&6
-else
-  case $RM in
-  [\\/]* | ?:[\\/]*)
-  ac_cv_path_RM="$RM" # 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_RM="$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
-RM=$ac_cv_path_RM
-if test -n "$RM"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $RM" >&5
-$as_echo "$RM" >&6; }
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-
-
-    # Test that variable RM is not empty.
-    if test "" = "$RM"; then as_fn_error $? "Could not find rm !" "$LINENO" 5 ; fi
-
-RM="$RM -f"
+    if test "x$FGREP" = x; then
+        if test "x" = x; then
+          PROG_NAME=fgrep
+        else
+          PROG_NAME=
+        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
+
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a sed that does not truncate output" >&5
 $as_echo_n "checking for a sed that does not truncate output... " >&6; }
 if test "${ac_cv_path_SED+set}" = set; then :
@@ -5035,492 +6630,746 @@
   rm -f conftest.sed
 
 
-    # Test that variable SED is not empty.
-    if test "" = "$SED"; then as_fn_error $? "Could not find sed !" "$LINENO" 5 ; fi
-
-# Extract the first word of "sh", so it can be a program name with args.
-set dummy sh; 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_SH+set}" = set; then :
-  $as_echo_n "(cached) " >&6
-else
-  case $SH in
-  [\\/]* | ?:[\\/]*)
-  ac_cv_path_SH="$SH" # 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_SH="$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
-SH=$ac_cv_path_SH
-if test -n "$SH"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $SH" >&5
-$as_echo "$SH" >&6; }
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-
-
-    # Test that variable SH is not empty.
-    if test "" = "$SH"; then as_fn_error $? "Could not find sh !" "$LINENO" 5 ; fi
-
-# Extract the first word of "sort", so it can be a program name with args.
-set dummy sort; 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_SORT+set}" = set; then :
-  $as_echo_n "(cached) " >&6
-else
-  case $SORT in
-  [\\/]* | ?:[\\/]*)
-  ac_cv_path_SORT="$SORT" # 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_SORT="$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
-SORT=$ac_cv_path_SORT
-if test -n "$SORT"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $SORT" >&5
-$as_echo "$SORT" >&6; }
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-
-
-    # Test that variable SORT is not empty.
-    if test "" = "$SORT"; then as_fn_error $? "Could not find sort !" "$LINENO" 5 ; fi
-
-# Extract the first word of "tar", so it can be a program name with args.
-set dummy tar; 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_TAR+set}" = set; then :
-  $as_echo_n "(cached) " >&6
-else
-  case $TAR in
-  [\\/]* | ?:[\\/]*)
-  ac_cv_path_TAR="$TAR" # 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_TAR="$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
-TAR=$ac_cv_path_TAR
-if test -n "$TAR"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $TAR" >&5
-$as_echo "$TAR" >&6; }
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-
-
-    # Test that variable TAR is not empty.
-    if test "" = "$TAR"; then as_fn_error $? "Could not find tar !" "$LINENO" 5 ; fi
-
-# Extract the first word of "tail", so it can be a program name with args.
-set dummy tail; 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_TAIL+set}" = set; then :
-  $as_echo_n "(cached) " >&6
-else
-  case $TAIL in
-  [\\/]* | ?:[\\/]*)
-  ac_cv_path_TAIL="$TAIL" # 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_TAIL="$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
-TAIL=$ac_cv_path_TAIL
-if test -n "$TAIL"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $TAIL" >&5
-$as_echo "$TAIL" >&6; }
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-
-
-    # Test that variable TAIL is not empty.
-    if test "" = "$TAIL"; then as_fn_error $? "Could not find tail !" "$LINENO" 5 ; fi
-
-# Extract the first word of "tee", so it can be a program name with args.
-set dummy tee; 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_TEE+set}" = set; then :
-  $as_echo_n "(cached) " >&6
-else
-  case $TEE in
-  [\\/]* | ?:[\\/]*)
-  ac_cv_path_TEE="$TEE" # 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_TEE="$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
-TEE=$ac_cv_path_TEE
-if test -n "$TEE"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $TEE" >&5
-$as_echo "$TEE" >&6; }
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-
-
-    # Test that variable TEE is not empty.
-    if test "" = "$TEE"; then as_fn_error $? "Could not find tee !" "$LINENO" 5 ; fi
-
-# Extract the first word of "tr", so it can be a program name with args.
-set dummy tr; 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_TR+set}" = set; then :
-  $as_echo_n "(cached) " >&6
-else
-  case $TR in
-  [\\/]* | ?:[\\/]*)
-  ac_cv_path_TR="$TR" # 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_TR="$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
-TR=$ac_cv_path_TR
-if test -n "$TR"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $TR" >&5
-$as_echo "$TR" >&6; }
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-
-
-    # Test that variable TR is not empty.
-    if test "" = "$TR"; then as_fn_error $? "Could not find tr !" "$LINENO" 5 ; fi
-
-# Extract the first word of "touch", so it can be a program name with args.
-set dummy touch; 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_TOUCH+set}" = set; then :
-  $as_echo_n "(cached) " >&6
-else
-  case $TOUCH in
-  [\\/]* | ?:[\\/]*)
-  ac_cv_path_TOUCH="$TOUCH" # 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_TOUCH="$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
-TOUCH=$ac_cv_path_TOUCH
-if test -n "$TOUCH"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $TOUCH" >&5
-$as_echo "$TOUCH" >&6; }
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-
-
-    # Test that variable TOUCH is not empty.
-    if test "" = "$TOUCH"; then as_fn_error $? "Could not find touch !" "$LINENO" 5 ; fi
-
-# Extract the first word of "wc", so it can be a program name with args.
-set dummy wc; 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_WC+set}" = set; then :
-  $as_echo_n "(cached) " >&6
-else
-  case $WC in
-  [\\/]* | ?:[\\/]*)
-  ac_cv_path_WC="$WC" # 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_WC="$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
-WC=$ac_cv_path_WC
-if test -n "$WC"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $WC" >&5
-$as_echo "$WC" >&6; }
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-
-
-    # Test that variable WC is not empty.
-    if test "" = "$WC"; then as_fn_error $? "Could not find wc !" "$LINENO" 5 ; fi
-
-# Extract the first word of "xargs", so it can be a program name with args.
-set dummy xargs; 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_XARGS+set}" = set; then :
-  $as_echo_n "(cached) " >&6
-else
-  case $XARGS in
-  [\\/]* | ?:[\\/]*)
-  ac_cv_path_XARGS="$XARGS" # 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_XARGS="$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
-XARGS=$ac_cv_path_XARGS
-if test -n "$XARGS"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $XARGS" >&5
-$as_echo "$XARGS" >&6; }
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-
-
-    # Test that variable XARGS is not empty.
-    if test "" = "$XARGS"; then as_fn_error $? "Could not find xargs !" "$LINENO" 5 ; fi
-
-# Extract the first word of "zip", so it can be a program name with args.
-set dummy zip; 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_ZIP+set}" = set; then :
-  $as_echo_n "(cached) " >&6
-else
-  case $ZIP in
-  [\\/]* | ?:[\\/]*)
-  ac_cv_path_ZIP="$ZIP" # 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_ZIP="$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
-ZIP=$ac_cv_path_ZIP
-if test -n "$ZIP"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ZIP" >&5
-$as_echo "$ZIP" >&6; }
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-
-
-    # Test that variable ZIP is not empty.
-    if test "" = "$ZIP"; then as_fn_error $? "Could not find zip !" "$LINENO" 5 ; fi
-
-# Extract the first word of "unzip", so it can be a program name with args.
-set dummy unzip; 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_UNZIP+set}" = set; then :
-  $as_echo_n "(cached) " >&6
-else
-  case $UNZIP in
-  [\\/]* | ?:[\\/]*)
-  ac_cv_path_UNZIP="$UNZIP" # 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_UNZIP="$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
-UNZIP=$ac_cv_path_UNZIP
-if test -n "$UNZIP"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $UNZIP" >&5
-$as_echo "$UNZIP" >&6; }
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-
-
-    # Test that variable UNZIP is not empty.
-    if test "" = "$UNZIP"; then as_fn_error $? "Could not find unzip !" "$LINENO" 5 ; fi
+    if test "x$SED" = x; then
+        if test "x" = x; then
+          PROG_NAME=sed
+        else
+          PROG_NAME=
+        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 nawk gawk awk
+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_NAWK+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  case $NAWK in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_NAWK="$NAWK" # 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_NAWK="$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
+NAWK=$ac_cv_path_NAWK
+if test -n "$NAWK"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $NAWK" >&5
+$as_echo "$NAWK" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+  test -n "$NAWK" && break
+done
+
+
+    if test "x$NAWK" = x; then
+        if test "x" = x; then
+          PROG_NAME=nawk
+        else
+          PROG_NAME=
+        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
+
+
+
+  # We need to find a recent version of GNU make. Especially on Solaris, this can be tricky.
+  if test "x$MAKE" != x; then
+    # User has supplied a make, test it.
+    if test ! -f "$MAKE"; then
+      as_fn_error $? "The specified make (by MAKE=$MAKE) is not found." "$LINENO" 5
+    fi
+
+  MAKE_CANDIDATE=""$MAKE""
+  DESCRIPTION="user supplied MAKE="
+  if test "x$MAKE_CANDIDATE" != x; then
+    { $as_echo "$as_me:${as_lineno-$LINENO}: Testing potential make at $MAKE_CANDIDATE, found using $DESCRIPTION" >&5
+$as_echo "$as_me: Testing potential make at $MAKE_CANDIDATE, found using $DESCRIPTION" >&6;}
+
+    # Translate "gcc -E" into "`which gcc` -E" ie
+    # extract the full path to the binary and at the
+    # same time maintain any arguments passed to it.
+    # The command MUST exist in the path, or else!
+    tmp="$MAKE_CANDIDATE"
+    car="${tmp%% *}"
+    tmp="$MAKE_CANDIDATE EOL"
+    cdr="${tmp#* }"
+    # On windows we want paths without spaces.
+    if test "x$OPENJDK_BUILD_OS" = "xwindows"; then
+
+    # Translate long cygdrive or C:\sdfsf path
+    # into a short mixed mode path that has no
+    # spaces in it.
+    tmp="$car"
+
+    if test "x$OPENJDK_BUILD_OS" = "xwindows"; then
+        tmp=`$CYGPATH -u "$car"`
+        tmp=`which "$tmp"`
+        # If file exists with .exe appended, that's the real filename
+        # and cygpath needs that to convert to short style path.
+        if test -f "${tmp}.exe"; then
+           tmp="${tmp}.exe"
+        elif test -f "${tmp}.cmd"; then
+           tmp="${tmp}.cmd"
+        fi
+        # Convert to C:/ mixed style path without spaces.
+         tmp=`$CYGPATH -s -m "$tmp"`
+    fi
+    car="$tmp"
+
+    else
+        # "which" is not portable, but is used here
+        # because we know that the command exists!
+        car=`which $car`
+    fi
+    if test "x$cdr" != xEOL; then
+        MAKE_CANDIDATE="$car ${cdr% *}"
+    else
+        MAKE_CANDIDATE="$car"
+    fi
+
+    MAKE_VERSION_STRING=`$MAKE_CANDIDATE --version | $HEAD -n 1`
+    IS_GNU_MAKE=`$ECHO $MAKE_VERSION_STRING | $GREP 'GNU Make'`
+    if test "x$IS_GNU_MAKE" = x; then
+      { $as_echo "$as_me:${as_lineno-$LINENO}: Found potential make at $MAKE_CANDIDATE, however, this is not GNU Make. Ignoring." >&5
+$as_echo "$as_me: Found potential make at $MAKE_CANDIDATE, however, this is not GNU Make. Ignoring." >&6;}
+    else
+      IS_MODERN_MAKE=`$ECHO $MAKE_VERSION_STRING | $GREP '3.8[12346789]'`
+      if test "x$IS_MODERN_MAKE" = x; then
+        { $as_echo "$as_me:${as_lineno-$LINENO}: Found GNU make at $MAKE_CANDIDATE, however this is not version 3.81 or later. (it is: $MAKE_VERSION_STRING). Ignoring." >&5
+$as_echo "$as_me: Found GNU make at $MAKE_CANDIDATE, however this is not version 3.81 or later. (it is: $MAKE_VERSION_STRING). Ignoring." >&6;}
+      else
+        FOUND_MAKE=$MAKE_CANDIDATE
+      fi
+    fi
+  fi
+
+    if test "x$FOUND_MAKE" = x; then
+      as_fn_error $? "The specified make (by MAKE=$MAKE) is not GNU make 3.81 or newer." "$LINENO" 5
+    fi
+  else
+    # Try our hardest to locate a correct version of GNU make
+    for ac_prog in gmake
+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_CHECK_GMAKE+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  case $CHECK_GMAKE in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_CHECK_GMAKE="$CHECK_GMAKE" # 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_CHECK_GMAKE="$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
+CHECK_GMAKE=$ac_cv_path_CHECK_GMAKE
+if test -n "$CHECK_GMAKE"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CHECK_GMAKE" >&5
+$as_echo "$CHECK_GMAKE" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+  test -n "$CHECK_GMAKE" && break
+done
+
+
+  MAKE_CANDIDATE=""$CHECK_GMAKE""
+  DESCRIPTION="gmake in PATH"
+  if test "x$MAKE_CANDIDATE" != x; then
+    { $as_echo "$as_me:${as_lineno-$LINENO}: Testing potential make at $MAKE_CANDIDATE, found using $DESCRIPTION" >&5
+$as_echo "$as_me: Testing potential make at $MAKE_CANDIDATE, found using $DESCRIPTION" >&6;}
+
+    # Translate "gcc -E" into "`which gcc` -E" ie
+    # extract the full path to the binary and at the
+    # same time maintain any arguments passed to it.
+    # The command MUST exist in the path, or else!
+    tmp="$MAKE_CANDIDATE"
+    car="${tmp%% *}"
+    tmp="$MAKE_CANDIDATE EOL"
+    cdr="${tmp#* }"
+    # On windows we want paths without spaces.
+    if test "x$OPENJDK_BUILD_OS" = "xwindows"; then
+
+    # Translate long cygdrive or C:\sdfsf path
+    # into a short mixed mode path that has no
+    # spaces in it.
+    tmp="$car"
+
+    if test "x$OPENJDK_BUILD_OS" = "xwindows"; then
+        tmp=`$CYGPATH -u "$car"`
+        tmp=`which "$tmp"`
+        # If file exists with .exe appended, that's the real filename
+        # and cygpath needs that to convert to short style path.
+        if test -f "${tmp}.exe"; then
+           tmp="${tmp}.exe"
+        elif test -f "${tmp}.cmd"; then
+           tmp="${tmp}.cmd"
+        fi
+        # Convert to C:/ mixed style path without spaces.
+         tmp=`$CYGPATH -s -m "$tmp"`
+    fi
+    car="$tmp"
+
+    else
+        # "which" is not portable, but is used here
+        # because we know that the command exists!
+        car=`which $car`
+    fi
+    if test "x$cdr" != xEOL; then
+        MAKE_CANDIDATE="$car ${cdr% *}"
+    else
+        MAKE_CANDIDATE="$car"
+    fi
+
+    MAKE_VERSION_STRING=`$MAKE_CANDIDATE --version | $HEAD -n 1`
+    IS_GNU_MAKE=`$ECHO $MAKE_VERSION_STRING | $GREP 'GNU Make'`
+    if test "x$IS_GNU_MAKE" = x; then
+      { $as_echo "$as_me:${as_lineno-$LINENO}: Found potential make at $MAKE_CANDIDATE, however, this is not GNU Make. Ignoring." >&5
+$as_echo "$as_me: Found potential make at $MAKE_CANDIDATE, however, this is not GNU Make. Ignoring." >&6;}
+    else
+      IS_MODERN_MAKE=`$ECHO $MAKE_VERSION_STRING | $GREP '3.8[12346789]'`
+      if test "x$IS_MODERN_MAKE" = x; then
+        { $as_echo "$as_me:${as_lineno-$LINENO}: Found GNU make at $MAKE_CANDIDATE, however this is not version 3.81 or later. (it is: $MAKE_VERSION_STRING). Ignoring." >&5
+$as_echo "$as_me: Found GNU make at $MAKE_CANDIDATE, however this is not version 3.81 or later. (it is: $MAKE_VERSION_STRING). Ignoring." >&6;}
+      else
+        FOUND_MAKE=$MAKE_CANDIDATE
+      fi
+    fi
+  fi
+
+
+    if test "x$FOUND_MAKE" = x; then
+      for ac_prog in make
+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_CHECK_MAKE+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  case $CHECK_MAKE in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_CHECK_MAKE="$CHECK_MAKE" # 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_CHECK_MAKE="$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
+CHECK_MAKE=$ac_cv_path_CHECK_MAKE
+if test -n "$CHECK_MAKE"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CHECK_MAKE" >&5
+$as_echo "$CHECK_MAKE" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+  test -n "$CHECK_MAKE" && break
+done
+
+
+  MAKE_CANDIDATE=""$CHECK_MAKE""
+  DESCRIPTION="make in PATH"
+  if test "x$MAKE_CANDIDATE" != x; then
+    { $as_echo "$as_me:${as_lineno-$LINENO}: Testing potential make at $MAKE_CANDIDATE, found using $DESCRIPTION" >&5
+$as_echo "$as_me: Testing potential make at $MAKE_CANDIDATE, found using $DESCRIPTION" >&6;}
+
+    # Translate "gcc -E" into "`which gcc` -E" ie
+    # extract the full path to the binary and at the
+    # same time maintain any arguments passed to it.
+    # The command MUST exist in the path, or else!
+    tmp="$MAKE_CANDIDATE"
+    car="${tmp%% *}"
+    tmp="$MAKE_CANDIDATE EOL"
+    cdr="${tmp#* }"
+    # On windows we want paths without spaces.
+    if test "x$OPENJDK_BUILD_OS" = "xwindows"; then
+
+    # Translate long cygdrive or C:\sdfsf path
+    # into a short mixed mode path that has no
+    # spaces in it.
+    tmp="$car"
+
+    if test "x$OPENJDK_BUILD_OS" = "xwindows"; then
+        tmp=`$CYGPATH -u "$car"`
+        tmp=`which "$tmp"`
+        # If file exists with .exe appended, that's the real filename
+        # and cygpath needs that to convert to short style path.
+        if test -f "${tmp}.exe"; then
+           tmp="${tmp}.exe"
+        elif test -f "${tmp}.cmd"; then
+           tmp="${tmp}.cmd"
+        fi
+        # Convert to C:/ mixed style path without spaces.
+         tmp=`$CYGPATH -s -m "$tmp"`
+    fi
+    car="$tmp"
+
+    else
+        # "which" is not portable, but is used here
+        # because we know that the command exists!
+        car=`which $car`
+    fi
+    if test "x$cdr" != xEOL; then
+        MAKE_CANDIDATE="$car ${cdr% *}"
+    else
+        MAKE_CANDIDATE="$car"
+    fi
+
+    MAKE_VERSION_STRING=`$MAKE_CANDIDATE --version | $HEAD -n 1`
+    IS_GNU_MAKE=`$ECHO $MAKE_VERSION_STRING | $GREP 'GNU Make'`
+    if test "x$IS_GNU_MAKE" = x; then
+      { $as_echo "$as_me:${as_lineno-$LINENO}: Found potential make at $MAKE_CANDIDATE, however, this is not GNU Make. Ignoring." >&5
+$as_echo "$as_me: Found potential make at $MAKE_CANDIDATE, however, this is not GNU Make. Ignoring." >&6;}
+    else
+      IS_MODERN_MAKE=`$ECHO $MAKE_VERSION_STRING | $GREP '3.8[12346789]'`
+      if test "x$IS_MODERN_MAKE" = x; then
+        { $as_echo "$as_me:${as_lineno-$LINENO}: Found GNU make at $MAKE_CANDIDATE, however this is not version 3.81 or later. (it is: $MAKE_VERSION_STRING). Ignoring." >&5
+$as_echo "$as_me: Found GNU make at $MAKE_CANDIDATE, however this is not version 3.81 or later. (it is: $MAKE_VERSION_STRING). Ignoring." >&6;}
+      else
+        FOUND_MAKE=$MAKE_CANDIDATE
+      fi
+    fi
+  fi
+
+    fi
+
+    if test "x$FOUND_MAKE" = x; then
+      if test "x$TOOLS_DIR" != x; then
+        # We have a tools-dir, check that as well before giving up.
+        OLD_PATH=$PATH
+        PATH=$TOOLS_DIR:$PATH
+        for ac_prog in gmake
+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_CHECK_TOOLSDIR_GMAKE+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  case $CHECK_TOOLSDIR_GMAKE in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_CHECK_TOOLSDIR_GMAKE="$CHECK_TOOLSDIR_GMAKE" # 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_CHECK_TOOLSDIR_GMAKE="$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
+CHECK_TOOLSDIR_GMAKE=$ac_cv_path_CHECK_TOOLSDIR_GMAKE
+if test -n "$CHECK_TOOLSDIR_GMAKE"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CHECK_TOOLSDIR_GMAKE" >&5
+$as_echo "$CHECK_TOOLSDIR_GMAKE" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+  test -n "$CHECK_TOOLSDIR_GMAKE" && break
+done
+
+
+  MAKE_CANDIDATE=""$CHECK_TOOLSDIR_GMAKE""
+  DESCRIPTION="gmake in tools-dir"
+  if test "x$MAKE_CANDIDATE" != x; then
+    { $as_echo "$as_me:${as_lineno-$LINENO}: Testing potential make at $MAKE_CANDIDATE, found using $DESCRIPTION" >&5
+$as_echo "$as_me: Testing potential make at $MAKE_CANDIDATE, found using $DESCRIPTION" >&6;}
+
+    # Translate "gcc -E" into "`which gcc` -E" ie
+    # extract the full path to the binary and at the
+    # same time maintain any arguments passed to it.
+    # The command MUST exist in the path, or else!
+    tmp="$MAKE_CANDIDATE"
+    car="${tmp%% *}"
+    tmp="$MAKE_CANDIDATE EOL"
+    cdr="${tmp#* }"
+    # On windows we want paths without spaces.
+    if test "x$OPENJDK_BUILD_OS" = "xwindows"; then
+
+    # Translate long cygdrive or C:\sdfsf path
+    # into a short mixed mode path that has no
+    # spaces in it.
+    tmp="$car"
+
+    if test "x$OPENJDK_BUILD_OS" = "xwindows"; then
+        tmp=`$CYGPATH -u "$car"`
+        tmp=`which "$tmp"`
+        # If file exists with .exe appended, that's the real filename
+        # and cygpath needs that to convert to short style path.
+        if test -f "${tmp}.exe"; then
+           tmp="${tmp}.exe"
+        elif test -f "${tmp}.cmd"; then
+           tmp="${tmp}.cmd"
+        fi
+        # Convert to C:/ mixed style path without spaces.
+         tmp=`$CYGPATH -s -m "$tmp"`
+    fi
+    car="$tmp"
+
+    else
+        # "which" is not portable, but is used here
+        # because we know that the command exists!
+        car=`which $car`
+    fi
+    if test "x$cdr" != xEOL; then
+        MAKE_CANDIDATE="$car ${cdr% *}"
+    else
+        MAKE_CANDIDATE="$car"
+    fi
+
+    MAKE_VERSION_STRING=`$MAKE_CANDIDATE --version | $HEAD -n 1`
+    IS_GNU_MAKE=`$ECHO $MAKE_VERSION_STRING | $GREP 'GNU Make'`
+    if test "x$IS_GNU_MAKE" = x; then
+      { $as_echo "$as_me:${as_lineno-$LINENO}: Found potential make at $MAKE_CANDIDATE, however, this is not GNU Make. Ignoring." >&5
+$as_echo "$as_me: Found potential make at $MAKE_CANDIDATE, however, this is not GNU Make. Ignoring." >&6;}
+    else
+      IS_MODERN_MAKE=`$ECHO $MAKE_VERSION_STRING | $GREP '3.8[12346789]'`
+      if test "x$IS_MODERN_MAKE" = x; then
+        { $as_echo "$as_me:${as_lineno-$LINENO}: Found GNU make at $MAKE_CANDIDATE, however this is not version 3.81 or later. (it is: $MAKE_VERSION_STRING). Ignoring." >&5
+$as_echo "$as_me: Found GNU make at $MAKE_CANDIDATE, however this is not version 3.81 or later. (it is: $MAKE_VERSION_STRING). Ignoring." >&6;}
+      else
+        FOUND_MAKE=$MAKE_CANDIDATE
+      fi
+    fi
+  fi
+
+        if test "x$FOUND_MAKE" = x; then
+          for ac_prog in make
+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_CHECK_TOOLSDIR_MAKE+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  case $CHECK_TOOLSDIR_MAKE in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_CHECK_TOOLSDIR_MAKE="$CHECK_TOOLSDIR_MAKE" # 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_CHECK_TOOLSDIR_MAKE="$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
+CHECK_TOOLSDIR_MAKE=$ac_cv_path_CHECK_TOOLSDIR_MAKE
+if test -n "$CHECK_TOOLSDIR_MAKE"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CHECK_TOOLSDIR_MAKE" >&5
+$as_echo "$CHECK_TOOLSDIR_MAKE" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+  test -n "$CHECK_TOOLSDIR_MAKE" && break
+done
+
+
+  MAKE_CANDIDATE=""$CHECK_TOOLSDIR_MAKE""
+  DESCRIPTION="make in tools-dir"
+  if test "x$MAKE_CANDIDATE" != x; then
+    { $as_echo "$as_me:${as_lineno-$LINENO}: Testing potential make at $MAKE_CANDIDATE, found using $DESCRIPTION" >&5
+$as_echo "$as_me: Testing potential make at $MAKE_CANDIDATE, found using $DESCRIPTION" >&6;}
+
+    # Translate "gcc -E" into "`which gcc` -E" ie
+    # extract the full path to the binary and at the
+    # same time maintain any arguments passed to it.
+    # The command MUST exist in the path, or else!
+    tmp="$MAKE_CANDIDATE"
+    car="${tmp%% *}"
+    tmp="$MAKE_CANDIDATE EOL"
+    cdr="${tmp#* }"
+    # On windows we want paths without spaces.
+    if test "x$OPENJDK_BUILD_OS" = "xwindows"; then
+
+    # Translate long cygdrive or C:\sdfsf path
+    # into a short mixed mode path that has no
+    # spaces in it.
+    tmp="$car"
+
+    if test "x$OPENJDK_BUILD_OS" = "xwindows"; then
+        tmp=`$CYGPATH -u "$car"`
+        tmp=`which "$tmp"`
+        # If file exists with .exe appended, that's the real filename
+        # and cygpath needs that to convert to short style path.
+        if test -f "${tmp}.exe"; then
+           tmp="${tmp}.exe"
+        elif test -f "${tmp}.cmd"; then
+           tmp="${tmp}.cmd"
+        fi
+        # Convert to C:/ mixed style path without spaces.
+         tmp=`$CYGPATH -s -m "$tmp"`
+    fi
+    car="$tmp"
+
+    else
+        # "which" is not portable, but is used here
+        # because we know that the command exists!
+        car=`which $car`
+    fi
+    if test "x$cdr" != xEOL; then
+        MAKE_CANDIDATE="$car ${cdr% *}"
+    else
+        MAKE_CANDIDATE="$car"
+    fi
+
+    MAKE_VERSION_STRING=`$MAKE_CANDIDATE --version | $HEAD -n 1`
+    IS_GNU_MAKE=`$ECHO $MAKE_VERSION_STRING | $GREP 'GNU Make'`
+    if test "x$IS_GNU_MAKE" = x; then
+      { $as_echo "$as_me:${as_lineno-$LINENO}: Found potential make at $MAKE_CANDIDATE, however, this is not GNU Make. Ignoring." >&5
+$as_echo "$as_me: Found potential make at $MAKE_CANDIDATE, however, this is not GNU Make. Ignoring." >&6;}
+    else
+      IS_MODERN_MAKE=`$ECHO $MAKE_VERSION_STRING | $GREP '3.8[12346789]'`
+      if test "x$IS_MODERN_MAKE" = x; then
+        { $as_echo "$as_me:${as_lineno-$LINENO}: Found GNU make at $MAKE_CANDIDATE, however this is not version 3.81 or later. (it is: $MAKE_VERSION_STRING). Ignoring." >&5
+$as_echo "$as_me: Found GNU make at $MAKE_CANDIDATE, however this is not version 3.81 or later. (it is: $MAKE_VERSION_STRING). Ignoring." >&6;}
+      else
+        FOUND_MAKE=$MAKE_CANDIDATE
+      fi
+    fi
+  fi
+
+        fi
+        PATH=$OLD_PATH
+      fi
+    fi
+
+    if test "x$FOUND_MAKE" = x; then
+      as_fn_error $? "Cannot find GNU make 3.81 or newer! Please put it in the path, or add e.g. MAKE=/opt/gmake3.81/make as argument to configure." "$LINENO" 5
+    fi
+  fi
+
+  MAKE=$FOUND_MAKE
+
+  { $as_echo "$as_me:${as_lineno-$LINENO}: Using GNU make 3.81 (or later) at $FOUND_MAKE (version: $MAKE_VERSION_STRING)" >&5
+$as_echo "$as_me: Using GNU make 3.81 (or later) at $FOUND_MAKE (version: $MAKE_VERSION_STRING)" >&6;}
+
+
+
+    for ac_prog in rm
+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_RM+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  case $RM in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_RM="$RM" # 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_RM="$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
+RM=$ac_cv_path_RM
+if test -n "$RM"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $RM" >&5
+$as_echo "$RM" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+  test -n "$RM" && break
+done
+
+
+    if test "x$RM" = x; then
+        if test "xrm" = x; then
+          PROG_NAME=rm
+        else
+          PROG_NAME=rm
+        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
+
+
+RM="$RM -f"
+
+
+    # Test if find supports -delete
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking if find supports -delete" >&5
+$as_echo_n "checking if find supports -delete... " >&6; }
+    FIND_DELETE="-delete"
+
+    DELETEDIR=`mktemp -d tmp.XXXXXXXXXX` || (echo Could not create temporary directory!; exit $?)
+
+    echo Hejsan > $DELETEDIR/TestIfFindSupportsDelete
+
+    TEST_DELETE=`$FIND "$DELETEDIR" -name TestIfFindSupportsDelete $FIND_DELETE 2>&1`
+    if test -f $DELETEDIR/TestIfFindSupportsDelete; then
+        # No, it does not.
+        rm $DELETEDIR/TestIfFindSupportsDelete
+        FIND_DELETE="-exec rm \{\} \+"
+        { $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
+    rmdir $DELETEDIR
+
+
+
+# Non-required basic tools
+
+# Extract the first word of "pwd", so it can be a program name with args.
+set dummy pwd; 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
+
 
 # Extract the first word of "ldd", so it can be a program name with args.
 set dummy ldd; ac_word=$2
@@ -5611,8 +7460,10 @@
 if test "x$OTOOL" = "x"; then
    OTOOL="true"
 fi
-# Extract the first word of "readelf", so it can be a program name with args.
-set dummy readelf; ac_word=$2
+for ac_prog in readelf greadelf
+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_READELF+set}" = set; then :
@@ -5651,93 +7502,53 @@
 fi
 
 
-# Extract the first word of "expr", so it can be a program name with args.
-set dummy expr; 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_EXPR+set}" = set; then :
-  $as_echo_n "(cached) " >&6
-else
-  case $EXPR in
-  [\\/]* | ?:[\\/]*)
-  ac_cv_path_EXPR="$EXPR" # 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_EXPR="$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
-EXPR=$ac_cv_path_EXPR
-if test -n "$EXPR"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $EXPR" >&5
-$as_echo "$EXPR" >&6; }
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-
-
-    # Test that variable EXPR is not empty.
-    if test "" = "$EXPR"; then as_fn_error $? "Could not find expr !" "$LINENO" 5 ; fi
-
-# Extract the first word of "file", so it can be a program name with args.
-set dummy file; 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_FILE+set}" = set; then :
-  $as_echo_n "(cached) " >&6
-else
-  case $FILE in
-  [\\/]* | ?:[\\/]*)
-  ac_cv_path_FILE="$FILE" # 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_FILE="$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
-FILE=$ac_cv_path_FILE
-if test -n "$FILE"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $FILE" >&5
-$as_echo "$FILE" >&6; }
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-
-
-    # Test that variable FILE is not empty.
-    if test "" = "$FILE"; then as_fn_error $? "Could not find file !" "$LINENO" 5 ; fi
+  test -n "$READELF" && break
+done
+
+for ac_prog in objdump gobjdump
+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_OBJDUMP+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  case $OBJDUMP in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_OBJDUMP="$OBJDUMP" # 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_OBJDUMP="$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
+OBJDUMP=$ac_cv_path_OBJDUMP
+if test -n "$OBJDUMP"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OBJDUMP" >&5
+$as_echo "$OBJDUMP" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+  test -n "$OBJDUMP" && break
+done
 
 # Extract the first word of "hg", so it can be a program name with args.
 set dummy hg; ac_word=$2
@@ -5781,199 +7592,6 @@
 
 
 
-# Setup builddeps, for automatic downloading of tools we need.
-# This is needed before we can call BDEPS_CHECK_MODULE, which is done in
-# boot-jdk setup, but we need to have basic tools setup first.
-
-
-# Check whether --with-builddeps-conf was given.
-if test "${with_builddeps_conf+set}" = set; then :
-  withval=$with_builddeps_conf;
-fi
-
-
-
-# Check whether --with-builddeps-server was given.
-if test "${with_builddeps_server+set}" = set; then :
-  withval=$with_builddeps_server;
-fi
-
-
-
-# Check whether --with-builddeps-dir was given.
-if test "${with_builddeps_dir+set}" = set; then :
-  withval=$with_builddeps_dir;
-else
-  with_builddeps_dir=/localhome/builddeps
-fi
-
-
-
-# Check whether --with-builddeps-group was given.
-if test "${with_builddeps_group+set}" = set; then :
-  withval=$with_builddeps_group;
-fi
-
-
-# Check whether --enable-list-builddeps was given.
-if test "${enable_list_builddeps+set}" = set; then :
-  enableval=$enable_list_builddeps; LIST_BUILDDEPS="${enableval}"
-else
-  LIST_BUILDDEPS='no'
-fi
-
-
-if test "x$LIST_BUILDDEPS" = xyes; then
-    echo
-    echo List of build dependencies known to the configure script,
-    echo that can be used in builddeps.conf files:
-    cat $AUTOCONF_DIR/*.ac $AUTOCONF_DIR/*.m4 | grep BDEPS_CHECK_MODULE\( | cut -f 2 -d ',' | tr -d ' ' | sort
-    echo
-    exit 1
-fi
-
-
-
-    if test "x$with_builddeps_server" != x || test "x$with_builddeps_conf" != x; then
-        if test "x$with_builddeps_conf" != x; then
-            { $as_echo "$as_me:${as_lineno-$LINENO}: checking for supplied builddeps configuration file" >&5
-$as_echo_n "checking for supplied builddeps configuration file... " >&6; }
-            builddepsfile=$with_builddeps_conf
-            if test -s $builddepsfile; then
-                . $builddepsfile
-                { $as_echo "$as_me:${as_lineno-$LINENO}: result: loaded!" >&5
-$as_echo "loaded!" >&6; }
-            else
-               as_fn_error $? "The given builddeps conf file $with_builddeps_conf could not be loaded!" "$LINENO" 5
-           fi
-        else
-            { $as_echo "$as_me:${as_lineno-$LINENO}: checking for builddeps.conf files in sources..." >&5
-$as_echo_n "checking for builddeps.conf files in sources...... " >&6; }
-            builddepsfile=`mktemp`
-            touch $builddepsfile
-            # Put all found confs into a single file.
-            find ${SRC_ROOT} -name builddeps.conf -exec cat \{\} \; >> $builddepsfile
-            # Source the file to acquire the variables
-            if test -s $builddepsfile; then
-                . $builddepsfile
-                { $as_echo "$as_me:${as_lineno-$LINENO}: result: found at least one!" >&5
-$as_echo "found at least one!" >&6; }
-            else
-               as_fn_error $? "Could not find any builddeps.conf at all!" "$LINENO" 5
-           fi
-        fi
-        # Create build and target names that use _ instead of "-" and ".".
-        # This is necessary to use them in variable names.
-        build_var=`echo ${OPENJDK_BUILD_SYSTEM} | tr '-' '_' | tr '.' '_'`
-        target_var=`echo ${OPENJDK_TARGET_SYSTEM} | tr '-' '_' | tr '.' '_'`
-        # Extract rewrite information for build and target
-        eval rewritten_build=\${REWRITE_${build_var}}
-        if test "x$rewritten_build" = x; then
-            rewritten_build=${OPENJDK_BUILD_SYSTEM}
-            echo Build stays the same $rewritten_build
-        else
-            echo Rewriting build for builddeps into $rewritten_build
-        fi
-        eval rewritten_target=\${REWRITE_${target_var}}
-        if test "x$rewritten_target" = x; then
-            rewritten_target=${OPENJDK_TARGET_SYSTEM}
-            echo Target stays the same $rewritten_target
-        else
-            echo Rewriting target for builddeps into $rewritten_target
-        fi
-        rewritten_build_var=`echo ${rewritten_build} | tr '-' '_' | tr '.' '_'`
-        rewritten_target_var=`echo ${rewritten_target} | tr '-' '_' | tr '.' '_'`
-    fi
-    for ac_prog in 7z unzip
-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_prog_BDEPS_UNZIP+set}" = set; then :
-  $as_echo_n "(cached) " >&6
-else
-  if test -n "$BDEPS_UNZIP"; then
-  ac_cv_prog_BDEPS_UNZIP="$BDEPS_UNZIP" # Let the user override the test.
-else
-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_prog_BDEPS_UNZIP="$ac_prog"
-    $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
-
-fi
-fi
-BDEPS_UNZIP=$ac_cv_prog_BDEPS_UNZIP
-if test -n "$BDEPS_UNZIP"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BDEPS_UNZIP" >&5
-$as_echo "$BDEPS_UNZIP" >&6; }
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-
-  test -n "$BDEPS_UNZIP" && break
-done
-
-    if test "x$BDEPS_UNZIP" = x7z; then
-        BDEPS_UNZIP="7z x"
-    fi
-
-    for ac_prog in wget lftp ftp
-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_prog_BDEPS_FTP+set}" = set; then :
-  $as_echo_n "(cached) " >&6
-else
-  if test -n "$BDEPS_FTP"; then
-  ac_cv_prog_BDEPS_FTP="$BDEPS_FTP" # Let the user override the test.
-else
-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_prog_BDEPS_FTP="$ac_prog"
-    $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
-
-fi
-fi
-BDEPS_FTP=$ac_cv_prog_BDEPS_FTP
-if test -n "$BDEPS_FTP"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BDEPS_FTP" >&5
-$as_echo "$BDEPS_FTP" >&6; }
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-
-  test -n "$BDEPS_FTP" && break
-done
-
-
-
 # Check if pkg-config is available.
 
 
@@ -6092,676 +7710,7 @@
 
 fi
 
-###############################################################################
-#
-# Determine OpenJDK build and target platforms.
-#
-###############################################################################
-
-# Make sure we can run config.sub.
-$SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 ||
-  as_fn_error $? "cannot run $SHELL $ac_aux_dir/config.sub" "$LINENO" 5
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking build system type" >&5
-$as_echo_n "checking build system type... " >&6; }
-if test "${ac_cv_build+set}" = set; then :
-  $as_echo_n "(cached) " >&6
-else
-  ac_build_alias=$build_alias
-test "x$ac_build_alias" = x &&
-  ac_build_alias=`$SHELL "$ac_aux_dir/config.guess"`
-test "x$ac_build_alias" = x &&
-  as_fn_error $? "cannot guess build type; you must specify one" "$LINENO" 5
-ac_cv_build=`$SHELL "$ac_aux_dir/config.sub" $ac_build_alias` ||
-  as_fn_error $? "$SHELL $ac_aux_dir/config.sub $ac_build_alias failed" "$LINENO" 5
-
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_build" >&5
-$as_echo "$ac_cv_build" >&6; }
-case $ac_cv_build in
-*-*-*) ;;
-*) as_fn_error $? "invalid value of canonical build" "$LINENO" 5 ;;
-esac
-build=$ac_cv_build
-ac_save_IFS=$IFS; IFS='-'
-set x $ac_cv_build
-shift
-build_cpu=$1
-build_vendor=$2
-shift; shift
-# Remember, the first character of IFS is used to create $*,
-# except with old shells:
-build_os=$*
-IFS=$ac_save_IFS
-case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac
-
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking host system type" >&5
-$as_echo_n "checking host system type... " >&6; }
-if test "${ac_cv_host+set}" = set; then :
-  $as_echo_n "(cached) " >&6
-else
-  if test "x$host_alias" = x; then
-  ac_cv_host=$ac_cv_build
-else
-  ac_cv_host=`$SHELL "$ac_aux_dir/config.sub" $host_alias` ||
-    as_fn_error $? "$SHELL $ac_aux_dir/config.sub $host_alias failed" "$LINENO" 5
-fi
-
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_host" >&5
-$as_echo "$ac_cv_host" >&6; }
-case $ac_cv_host in
-*-*-*) ;;
-*) as_fn_error $? "invalid value of canonical host" "$LINENO" 5 ;;
-esac
-host=$ac_cv_host
-ac_save_IFS=$IFS; IFS='-'
-set x $ac_cv_host
-shift
-host_cpu=$1
-host_vendor=$2
-shift; shift
-# Remember, the first character of IFS is used to create $*,
-# except with old shells:
-host_os=$*
-IFS=$ac_save_IFS
-case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac
-
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking target system type" >&5
-$as_echo_n "checking target system type... " >&6; }
-if test "${ac_cv_target+set}" = set; then :
-  $as_echo_n "(cached) " >&6
-else
-  if test "x$target_alias" = x; then
-  ac_cv_target=$ac_cv_host
-else
-  ac_cv_target=`$SHELL "$ac_aux_dir/config.sub" $target_alias` ||
-    as_fn_error $? "$SHELL $ac_aux_dir/config.sub $target_alias failed" "$LINENO" 5
-fi
-
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_target" >&5
-$as_echo "$ac_cv_target" >&6; }
-case $ac_cv_target in
-*-*-*) ;;
-*) as_fn_error $? "invalid value of canonical target" "$LINENO" 5 ;;
-esac
-target=$ac_cv_target
-ac_save_IFS=$IFS; IFS='-'
-set x $ac_cv_target
-shift
-target_cpu=$1
-target_vendor=$2
-shift; shift
-# Remember, the first character of IFS is used to create $*,
-# except with old shells:
-target_os=$*
-IFS=$ac_save_IFS
-case $target_os in *\ *) target_os=`echo "$target_os" | sed 's/ /-/g'`;; esac
-
-
-# The aliases save the names the user supplied, while $host etc.
-# will get canonicalized.
-test -n "$target_alias" &&
-  test "$program_prefix$program_suffix$program_transform_name" = \
-    NONENONEs,x,x, &&
-  program_prefix=${target_alias}-
-
-# Figure out the build and target systems. # Note that in autoconf terminology, "build" is obvious, but "target"
-# is confusing; it assumes you are cross-compiling a cross-compiler (!)  and "target" is thus the target of the
-# product you're building. The target of this build is called "host". Since this is confusing to most people, we
-# have not adopted that system, but use "target" as the platform we are building for. In some places though we need
-# to use the configure naming style.
-
-
-
-
-
-# Check whether --with-target-bits was given.
-if test "${with_target_bits+set}" = set; then :
-  withval=$with_target_bits;
-fi
-
-
-if test "x$with_target_bits" != x && \
-   test "x$with_target_bits" != x32 && \
-   test "x$with_target_bits" != x64 ; then
-    as_fn_error $? "--with-target-bits can only be 32 or 64, you specified $with_target_bits!" "$LINENO" 5
-fi
-# Translate the standard cpu-vendor-kernel-os quadruplets into
-# the new TARGET_.... and BUILD_... and the legacy names used by
-# the openjdk build.
-# It uses $host_os $host_cpu $build_os $build_cpu and $with_target_bits
-
-    # Expects $host_os $host_cpu $build_os and $build_cpu
-    # and $with_target_bits to have been setup!
-    #
-    # Translate the standard triplet(quadruplet) definition
-    # of the target/build system into
-    # OPENJDK_TARGET_OS=aix,bsd,hpux,linux,macosx,solaris,windows
-    # OPENJDK_TARGET_OS_FAMILY=bsd,gnu,sysv,win32,wince
-    # OPENJDK_TARGET_OS_API=posix,winapi
-    #
-    # OPENJDK_TARGET_CPU=ia32,x64,sparc,sparcv9,arm,arm64,ppc,ppc64
-    # OPENJDK_TARGET_CPU_ARCH=x86,sparc,pcc,arm
-    # OPENJDK_TARGET_CPU_BITS=32,64
-    # OPENJDK_TARGET_CPU_ENDIAN=big,little
-    #
-    # The same values are setup for BUILD_...
-    #
-    # And the legacy variables, for controlling the old makefiles.
-    # LEGACY_OPENJDK_TARGET_CPU1=i586,amd64/x86_64,sparc,sparcv9,arm,arm64...
-    # LEGACY_OPENJDK_TARGET_CPU2=i386,amd64,sparc,sparcv9,arm,arm64...
-    # LEGACY_OPENJDK_TARGET_CPU3=sparcv9,amd64 (but only on solaris)
-    # LEGACY_OPENJDK_TARGET_OS_API=solaris,windows
-    #
-    # We also copy the autoconf trip/quadruplet
-    # verbatim to OPENJDK_TARGET_SYSTEM (from the autoconf "host") and OPENJDK_BUILD_SYSTEM
-    OPENJDK_TARGET_SYSTEM="$host"
-    OPENJDK_BUILD_SYSTEM="$build"
-
-
-
-
-
-  case "$host_os" in
-    *linux*)
-      VAR_OS=linux
-      VAR_OS_API=posix
-      VAR_OS_FAMILY=gnu
-      ;;
-    *solaris*)
-      VAR_OS=solaris
-      VAR_OS_API=posix
-      VAR_OS_FAMILY=sysv
-      ;;
-    *darwin*)
-      VAR_OS=macosx
-      VAR_OS_API=posix
-      VAR_OS_FAMILY=bsd
-      ;;
-    *bsd*)
-      VAR_OS=bsd
-      VAR_OS_API=posix
-      VAR_OS_FAMILY=bsd
-      ;;
-    *cygwin*|*windows*)
-      VAR_OS=windows
-      VAR_OS_API=winapi
-      VAR_OS_FAMILY=windows
-      ;;
-    *)
-      as_fn_error $? "unsupported operating system $host_os" "$LINENO" 5
-      ;;
-  esac
-
-    OPENJDK_TARGET_OS="$VAR_OS"
-    OPENJDK_TARGET_OS_FAMILY="$VAR_OS_FAMILY"
-    OPENJDK_TARGET_OS_API="$VAR_OS_API"
-
-
-
-
-
-    if test "x$OPENJDK_TARGET_OS_API" = xposix; then
-        LEGACY_OPENJDK_TARGET_OS_API="solaris"
-    fi
-    if test "x$OPENJDK_TARGET_OS_API" = xwinapi; then
-        LEGACY_OPENJDK_TARGET_OS_API="windows"
-    fi
-
-
-
-
-  # First argument is the cpu name from the trip/quad
-  case "$host_cpu" in
-    x86_64)
-      VAR_CPU=x64
-      VAR_CPU_ARCH=x86
-      VAR_CPU_BITS=64
-      VAR_CPU_ENDIAN=little
-      VAR_LEGACY_CPU=amd64
-      ;;
-    i?86)
-      VAR_CPU=ia32
-      VAR_CPU_ARCH=x86
-      VAR_CPU_BITS=32
-      VAR_CPU_ENDIAN=little
-      VAR_LEGACY_CPU=i586
-      ;;
-    alpha*)
-      VAR_CPU=alpha
-      VAR_CPU_ARCH=alpha
-      VAR_CPU_BITS=64
-      VAR_CPU_ENDIAN=big
-      VAR_LEGACY_CPU=alpha
-      ;;
-    arm*)
-      VAR_CPU=arm
-      VAR_CPU_ARCH=arm
-      VAR_CPU_BITS=32
-      VAR_CPU_ENDIAN=little
-      VAR_LEGACY_CPU=arm
-      ;;
-    mips)
-      VAR_CPU=mips
-      VAR_CPU_ARCH=mips
-      VAR_CPU_BITS=woot
-      VAR_CPU_ENDIAN=woot
-      VAR_LEGACY_CPU=mips
-       ;;
-    mipsel)
-      VAR_CPU=mipsel
-      VAR_CPU_ARCH=mips
-      VAR_CPU_BITS=woot
-      VAR_CPU_ENDIAN=woot
-      VAR_LEGACY_CPU=mipsel
-       ;;
-    powerpc)
-      VAR_CPU=ppc
-      VAR_CPU_ARCH=ppc
-      VAR_CPU_BITS=32
-      VAR_CPU_ENDIAN=big
-      VAR_LEGACY_CPU=ppc
-       ;;
-    powerpc64)
-      VAR_CPU=ppc64
-      VAR_CPU_ARCH=ppc
-      VAR_CPU_BITS=64
-      VAR_CPU_ENDIAN=big
-      VAR_LEGACY_CPU=ppc64
-       ;;
-    sparc)
-      VAR_CPU=sparc
-      VAR_CPU_ARCH=sparc
-      VAR_CPU_BITS=32
-      VAR_CPU_ENDIAN=big
-      VAR_LEGACY_CPU=sparc
-       ;;
-    sparc64)
-      VAR_CPU=sparcv9
-      VAR_CPU_ARCH=sparc
-      VAR_CPU_BITS=64
-      VAR_CPU_ENDIAN=big
-      VAR_LEGACY_CPU=sparcv9
-       ;;
-    s390)
-      VAR_CPU=s390
-      VAR_CPU_ARCH=s390
-      VAR_CPU_BITS=32
-      VAR_CPU_ENDIAN=woot
-      VAR_LEGACY_CPU=s390
-      VAR_LEGACY_CPU=s390
-       ;;
-    s390x)
-      VAR_CPU=s390x
-      VAR_CPU_ARCH=s390
-      VAR_CPU_BITS=64
-      VAR_CPU_ENDIAN=woot
-      VAR_LEGACY_CPU=s390x
-       ;;
-    *)
-      as_fn_error $? "unsupported cpu $host_cpu" "$LINENO" 5
-      ;;
-  esac
-
-  # Workaround cygwin not knowing about 64 bit.
-  if test "x$VAR_OS" = "xwindows"; then
-      if test "x$PROCESSOR_IDENTIFIER" != "x"; then
-          PROC_ARCH=`echo $PROCESSOR_IDENTIFIER | $CUT -f1 -d' '`
-          case "$PROC_ARCH" in
-            intel64|Intel64|INTEL64|em64t|EM64T|amd64|AMD64|8664|x86_64)
-              VAR_CPU=x64
-              VAR_CPU_BITS=64
-              VAR_LEGACY_CPU=amd64
-              ;;
-          esac
-      fi
-  fi
-
-  # on solaris x86...default seems to be 32-bit
-  if test "x$VAR_OS" = "xsolaris" && \
-     test "x$with_target_bits" = "x" && \
-     test "x$VAR_CPU_ARCH" = "xx86"
-  then
-      with_target_bits=32
-  fi
-
-  if test "x$VAR_CPU_ARCH" = "xx86"; then
-      if test "x$with_target_bits" = "x64"; then
-          VAR_CPU=x64
-          VAR_CPU_BITS=64
-          VAR_LEGACY_CPU=amd64
-      fi
-      if test "x$with_target_bits" = "x32"; then
-          VAR_CPU=ia32
-          VAR_CPU_BITS=32
-          VAR_LEGACY_CPU=i586
-      fi
-  fi
-
-  if test "x$VAR_CPU_ARCH" = "xsparc"; then
-      if test "x$with_target_bits" = "x64"; then
-          VAR_CPU=sparcv9
-          VAR_CPU_BITS=64
-          VAR_LEGACY_CPU=sparcv9
-      fi
-  fi
-
-    OPENJDK_TARGET_CPU="$VAR_CPU"
-    OPENJDK_TARGET_CPU_ARCH="$VAR_CPU_ARCH"
-    OPENJDK_TARGET_CPU_BITS="$VAR_CPU_BITS"
-    OPENJDK_TARGET_CPU_ENDIAN="$VAR_CPU_ENDIAN"
-
-
-
-
-
-
-    # Also store the legacy naming of the cpu.
-    # Ie i586 and amd64 instead of ia32 and x64
-    LEGACY_OPENJDK_TARGET_CPU1="$VAR_LEGACY_CPU"
-
-
-    # And the second legacy naming of the cpu.
-    # Ie i386 and amd64 instead of ia32 and x64.
-    LEGACY_OPENJDK_TARGET_CPU2="$LEGACY_OPENJDK_TARGET_CPU1"
-    if test "x$LEGACY_OPENJDK_TARGET_CPU1" = xi586; then
-        LEGACY_OPENJDK_TARGET_CPU2=i386
-    fi
-
-
-    # And the third legacy naming of the cpu.
-    # Ie only amd64 or sparcv9, used for the ISA_DIR on Solaris.
-    LEGACY_OPENJDK_TARGET_CPU3=""
-    if test "x$OPENJDK_TARGET_CPU" = xx64; then
-        LEGACY_OPENJDK_TARGET_CPU3=amd64
-    fi
-    if test "x$OPENJDK_TARGET_CPU" = xsparcv9; then
-        LEGACY_OPENJDK_TARGET_CPU3=sparcv9
-    fi
-
-
-
-
-
-  case "$build_os" in
-    *linux*)
-      VAR_OS=linux
-      VAR_OS_API=posix
-      VAR_OS_FAMILY=gnu
-      ;;
-    *solaris*)
-      VAR_OS=solaris
-      VAR_OS_API=posix
-      VAR_OS_FAMILY=sysv
-      ;;
-    *darwin*)
-      VAR_OS=macosx
-      VAR_OS_API=posix
-      VAR_OS_FAMILY=bsd
-      ;;
-    *bsd*)
-      VAR_OS=bsd
-      VAR_OS_API=posix
-      VAR_OS_FAMILY=bsd
-      ;;
-    *cygwin*|*windows*)
-      VAR_OS=windows
-      VAR_OS_API=winapi
-      VAR_OS_FAMILY=windows
-      ;;
-    *)
-      as_fn_error $? "unsupported operating system $build_os" "$LINENO" 5
-      ;;
-  esac
-
-    OPENJDK_BUILD_OS="$VAR_OS"
-    OPENJDK_BUILD_OS_FAMILY="$VAR_OS_FAMILY"
-    OPENJDK_BUILD_OS_API="$VAR_OS_API"
-
-
-
-
-
-    if test "x$OPENJDK_BUILD_OS_API" = xposix; then
-        LEGACY_OPENJDK_BUILD_OS_API="solaris"
-    fi
-    if test "x$OPENJDK_BUILD_OS_API" = xwinapi; then
-        LEGACY_OPENJDK_BUILD_OS_API="windows"
-    fi
-
-
-
-
-  # First argument is the cpu name from the trip/quad
-  case "$build_cpu" in
-    x86_64)
-      VAR_CPU=x64
-      VAR_CPU_ARCH=x86
-      VAR_CPU_BITS=64
-      VAR_CPU_ENDIAN=little
-      VAR_LEGACY_CPU=amd64
-      ;;
-    i?86)
-      VAR_CPU=ia32
-      VAR_CPU_ARCH=x86
-      VAR_CPU_BITS=32
-      VAR_CPU_ENDIAN=little
-      VAR_LEGACY_CPU=i586
-      ;;
-    alpha*)
-      VAR_CPU=alpha
-      VAR_CPU_ARCH=alpha
-      VAR_CPU_BITS=64
-      VAR_CPU_ENDIAN=big
-      VAR_LEGACY_CPU=alpha
-      ;;
-    arm*)
-      VAR_CPU=arm
-      VAR_CPU_ARCH=arm
-      VAR_CPU_BITS=32
-      VAR_CPU_ENDIAN=little
-      VAR_LEGACY_CPU=arm
-      ;;
-    mips)
-      VAR_CPU=mips
-      VAR_CPU_ARCH=mips
-      VAR_CPU_BITS=woot
-      VAR_CPU_ENDIAN=woot
-      VAR_LEGACY_CPU=mips
-       ;;
-    mipsel)
-      VAR_CPU=mipsel
-      VAR_CPU_ARCH=mips
-      VAR_CPU_BITS=woot
-      VAR_CPU_ENDIAN=woot
-      VAR_LEGACY_CPU=mipsel
-       ;;
-    powerpc)
-      VAR_CPU=ppc
-      VAR_CPU_ARCH=ppc
-      VAR_CPU_BITS=32
-      VAR_CPU_ENDIAN=big
-      VAR_LEGACY_CPU=ppc
-       ;;
-    powerpc64)
-      VAR_CPU=ppc64
-      VAR_CPU_ARCH=ppc
-      VAR_CPU_BITS=64
-      VAR_CPU_ENDIAN=big
-      VAR_LEGACY_CPU=ppc64
-       ;;
-    sparc)
-      VAR_CPU=sparc
-      VAR_CPU_ARCH=sparc
-      VAR_CPU_BITS=32
-      VAR_CPU_ENDIAN=big
-      VAR_LEGACY_CPU=sparc
-       ;;
-    sparc64)
-      VAR_CPU=sparcv9
-      VAR_CPU_ARCH=sparc
-      VAR_CPU_BITS=64
-      VAR_CPU_ENDIAN=big
-      VAR_LEGACY_CPU=sparcv9
-       ;;
-    s390)
-      VAR_CPU=s390
-      VAR_CPU_ARCH=s390
-      VAR_CPU_BITS=32
-      VAR_CPU_ENDIAN=woot
-      VAR_LEGACY_CPU=s390
-      VAR_LEGACY_CPU=s390
-       ;;
-    s390x)
-      VAR_CPU=s390x
-      VAR_CPU_ARCH=s390
-      VAR_CPU_BITS=64
-      VAR_CPU_ENDIAN=woot
-      VAR_LEGACY_CPU=s390x
-       ;;
-    *)
-      as_fn_error $? "unsupported cpu $build_cpu" "$LINENO" 5
-      ;;
-  esac
-
-  # Workaround cygwin not knowing about 64 bit.
-  if test "x$VAR_OS" = "xwindows"; then
-      if test "x$PROCESSOR_IDENTIFIER" != "x"; then
-          PROC_ARCH=`echo $PROCESSOR_IDENTIFIER | $CUT -f1 -d' '`
-          case "$PROC_ARCH" in
-            intel64|Intel64|INTEL64|em64t|EM64T|amd64|AMD64|8664|x86_64)
-              VAR_CPU=x64
-              VAR_CPU_BITS=64
-              VAR_LEGACY_CPU=amd64
-              ;;
-          esac
-      fi
-  fi
-
-  # on solaris x86...default seems to be 32-bit
-  if test "x$VAR_OS" = "xsolaris" && \
-     test "x$with_target_bits" = "x" && \
-     test "x$VAR_CPU_ARCH" = "xx86"
-  then
-      with_target_bits=32
-  fi
-
-  if test "x$VAR_CPU_ARCH" = "xx86"; then
-      if test "x$with_target_bits" = "x64"; then
-          VAR_CPU=x64
-          VAR_CPU_BITS=64
-          VAR_LEGACY_CPU=amd64
-      fi
-      if test "x$with_target_bits" = "x32"; then
-          VAR_CPU=ia32
-          VAR_CPU_BITS=32
-          VAR_LEGACY_CPU=i586
-      fi
-  fi
-
-  if test "x$VAR_CPU_ARCH" = "xsparc"; then
-      if test "x$with_target_bits" = "x64"; then
-          VAR_CPU=sparcv9
-          VAR_CPU_BITS=64
-          VAR_LEGACY_CPU=sparcv9
-      fi
-  fi
-
-    OPENJDK_BUILD_CPU="$VAR_CPU"
-    OPENJDK_BUILD_CPU_ARCH="$VAR_CPU_ARCH"
-    OPENJDK_BUILD_CPU_BITS="$VAR_CPU_BITS"
-    OPENJDK_BUILD_CPU_ENDIAN="$VAR_CPU_ENDIAN"
-
-
-
-
-
-
-    # Also store the legacy naming of the cpu.
-    # Ie i586 and amd64 instead of ia32 and x64
-    LEGACY_OPENJDK_BUILD_CPU1="$VAR_LEGACY_CPU"
-
-
-    # And the second legacy naming of the cpu.
-    # Ie i386 and amd64 instead of ia32 and x64.
-    LEGACY_OPENJDK_BUILD_CPU2="$LEGACY_OPENJDK_BUILD_CPU1"
-    if test "x$LEGACY_OPENJDK_BUILD_CPU1" = xi586; then
-        LEGACY_OPENJDK_BUILD_CPU2=i386
-    fi
-
-
-    # And the third legacy naming of the cpu.
-    # Ie only amd64 or sparcv9, used for the ISA_DIR on Solaris.
-    LEGACY_OPENJDK_BUILD_CPU3=""
-    if test "x$OPENJDK_BUILD_CPU" = xx64; then
-        LEGACY_OPENJDK_BUILD_CPU3=amd64
-    fi
-    if test "x$OPENJDK_BUILD_CPU" = xsparcv9; then
-        LEGACY_OPENJDK_BUILD_CPU3=sparcv9
-    fi
-
-
-
-    if test "x$OPENJDK_TARGET_OS" != xsolaris; then
-        LEGACY_OPENJDK_TARGET_CPU3=""
-        LEGACY_OPENJDK_BUILD_CPU3=""
-    fi
-
-    # On MacOSX and MacOSX only, we have a different name for the x64 CPU in ARCH (LEGACY_OPENJDK_TARGET_CPU1) ...
-    if test "x$OPENJDK_TARGET_OS" = xmacosx && test "x$OPENJDK_TARGET_CPU" = xx64; then
-        LEGACY_OPENJDK_TARGET_CPU1="x86_64"
-    fi
-
-
-    if test "x$OPENJDK_TARGET_OS" = "xsolaris"; then
-       REQUIRED_OS_NAME=SunOS
-       REQUIRED_OS_VERSION=5.10
-    fi
-    if test "x$OPENJDK_TARGET_OS" = "xlinux"; then
-       REQUIRED_OS_NAME=Linux
-       REQUIRED_OS_VERSION=2.6
-    fi
-    if test "x$OPENJDK_TARGET_OS" = "xwindows"; then
-        REQUIRED_OS_NAME=Windows
-        REQUIRED_OS_VERSION=5.1
-    fi
-    if test "x$OPENJDK_TARGET_OS" = "xmacosx"; then
-        REQUIRED_OS_NAME=Darwin
-        REQUIRED_OS_VERSION=11.2
-    fi
-
-
-
-
-
-
-# The LEGACY_OPENJDK_TARGET_CPU3 is the setting for ISA_DIR.
-if test "x$LEGACY_OPENJDK_TARGET_CPU3" != x; then
-   LEGACY_OPENJDK_TARGET_CPU3="/${LEGACY_OPENJDK_TARGET_CPU3}"
-fi
-
-# Now the following vars are defined.
-# OPENJDK_TARGET_OS=aix,bsd,hpux,linux,macosx,solaris,windows
-# OPENJDK_TARGET_OS_FAMILY=bsd,gnu,sysv,win32,wince
-# OPENJDK_TARGET_OS_API=posix,winapi
-#
-# OPENJDK_TARGET_CPU=ia32,x64,sparc,sparcv9,arm,arm64,ppc,ppc64
-# OPENJDK_TARGET_CPU_ARCH=x86,sparc,pcc,arm
-# OPENJDK_TARGET_CPU_BITS=32,64
-# OPENJDK_TARGET_CPU_ENDIAN=big,little
-#
-# There is also a:
-# LEGACY_OPENJDK_TARGET_CPU1=i586,amd64,....  # used to set the old var ARCH
-# LEGACY_OPENJDK_TARGET_CPU2=i386,amd64,.... # used to set the old var LIBARCH
-# LEGACY_OPENJDK_TARGET_CPU3=only sparcv9,amd64 # used to set the ISA_DIR on Solaris
-# There was also a BUILDARCH that had i486,amd64,... but we do not use that
-# in the new build.
-# LEGACY_OPENJDK_TARGET_OS_API=solaris,windows # used to select source roots
-
+# After basic tools have been setup, we can check build os specific details.
 
 ###############################################################################
 
@@ -6776,63 +7725,197 @@
 
 
 
-# With knowledge of the build platform, setup more basic things.
-
-# For cygwin we need cygpath first, since it is used everywhere.
-# Extract the first word of "cygpath", so it can be a program name with args.
-set dummy cygpath; 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_CYGPATH+set}" = set; then :
-  $as_echo_n "(cached) " >&6
-else
-  case $CYGPATH in
-  [\\/]* | ?:[\\/]*)
-  ac_cv_path_CYGPATH="$CYGPATH" # 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_CYGPATH="$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
-CYGPATH=$ac_cv_path_CYGPATH
-if test -n "$CYGPATH"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CYGPATH" >&5
-$as_echo "$CYGPATH" >&6; }
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-
-PATH_SEP=":"
-if test "x$OPENJDK_BUILD_OS" = "xwindows"; then
-    if test "x$CYGPATH" = x; then
-        as_fn_error $? "Something is wrong with your cygwin installation since I cannot find cygpath.exe in your path" "$LINENO" 5
-    fi
-    PATH_SEP=";"
-fi
-
-
-
-if test "x$OPENJDK_BUILD_OS" = "xsolaris"; then
-    # Add extra search paths on solaris for utilities like ar and as etc...
-    PATH="$PATH:/usr/ccs/bin:/usr/sfw/bin:/opt/csw/bin"
-fi
+# Setup builddeps, for automatic downloading of tools we need.
+# This is needed before we can call BDEPS_CHECK_MODULE, which is done in
+# boot-jdk setup, but we need to have basic tools setup first.
+
+
+# Check whether --with-builddeps-conf was given.
+if test "${with_builddeps_conf+set}" = set; then :
+  withval=$with_builddeps_conf;
+fi
+
+
+
+# Check whether --with-builddeps-server was given.
+if test "${with_builddeps_server+set}" = set; then :
+  withval=$with_builddeps_server;
+fi
+
+
+
+# Check whether --with-builddeps-dir was given.
+if test "${with_builddeps_dir+set}" = set; then :
+  withval=$with_builddeps_dir;
+else
+  with_builddeps_dir=/localhome/builddeps
+fi
+
+
+
+# Check whether --with-builddeps-group was given.
+if test "${with_builddeps_group+set}" = set; then :
+  withval=$with_builddeps_group;
+fi
+
+
+# Check whether --enable-list-builddeps was given.
+if test "${enable_list_builddeps+set}" = set; then :
+  enableval=$enable_list_builddeps; LIST_BUILDDEPS="${enableval}"
+else
+  LIST_BUILDDEPS='no'
+fi
+
+
+if test "x$LIST_BUILDDEPS" = xyes; then
+    echo
+    echo List of build dependencies known to the configure script,
+    echo that can be used in builddeps.conf files:
+    cat $AUTOCONF_DIR/*.ac $AUTOCONF_DIR/*.m4 | grep BDEPS_CHECK_MODULE\( | cut -f 2 -d ',' | tr -d ' ' | sort
+    echo
+    exit 1
+fi
+
+
+
+    if test "x$with_builddeps_server" != x || test "x$with_builddeps_conf" != x; then
+        if test "x$with_builddeps_conf" != x; then
+            { $as_echo "$as_me:${as_lineno-$LINENO}: checking for supplied builddeps configuration file" >&5
+$as_echo_n "checking for supplied builddeps configuration file... " >&6; }
+            builddepsfile=$with_builddeps_conf
+            if test -s $builddepsfile; then
+                . $builddepsfile
+                { $as_echo "$as_me:${as_lineno-$LINENO}: result: loaded!" >&5
+$as_echo "loaded!" >&6; }
+            else
+               as_fn_error $? "The given builddeps conf file $with_builddeps_conf could not be loaded!" "$LINENO" 5
+           fi
+        else
+            { $as_echo "$as_me:${as_lineno-$LINENO}: checking for builddeps.conf files in sources..." >&5
+$as_echo_n "checking for builddeps.conf files in sources...... " >&6; }
+            builddepsfile=`mktemp`
+            touch $builddepsfile
+            # Put all found confs into a single file.
+            find ${SRC_ROOT} -name builddeps.conf -exec cat \{\} \; >> $builddepsfile
+            # Source the file to acquire the variables
+            if test -s $builddepsfile; then
+                . $builddepsfile
+                { $as_echo "$as_me:${as_lineno-$LINENO}: result: found at least one!" >&5
+$as_echo "found at least one!" >&6; }
+            else
+               as_fn_error $? "Could not find any builddeps.conf at all!" "$LINENO" 5
+           fi
+        fi
+        # Create build and target names that use _ instead of "-" and ".".
+        # This is necessary to use them in variable names.
+        build_var=`echo ${OPENJDK_BUILD_AUTOCONF_NAME} | tr '-' '_' | tr '.' '_'`
+        target_var=`echo ${OPENJDK_TARGET_AUTOCONF_NAME} | tr '-' '_' | tr '.' '_'`
+        # Extract rewrite information for build and target
+        eval rewritten_build=\${REWRITE_${build_var}}
+        if test "x$rewritten_build" = x; then
+            rewritten_build=${OPENJDK_BUILD_AUTOCONF_NAME}
+            echo Build stays the same $rewritten_build
+        else
+            echo Rewriting build for builddeps into $rewritten_build
+        fi
+        eval rewritten_target=\${REWRITE_${target_var}}
+        if test "x$rewritten_target" = x; then
+            rewritten_target=${OPENJDK_TARGET_AUTOCONF_NAME}
+            echo Target stays the same $rewritten_target
+        else
+            echo Rewriting target for builddeps into $rewritten_target
+        fi
+        rewritten_build_var=`echo ${rewritten_build} | tr '-' '_' | tr '.' '_'`
+        rewritten_target_var=`echo ${rewritten_target} | tr '-' '_' | tr '.' '_'`
+    fi
+    for ac_prog in 7z unzip
+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_prog_BDEPS_UNZIP+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$BDEPS_UNZIP"; then
+  ac_cv_prog_BDEPS_UNZIP="$BDEPS_UNZIP" # Let the user override the test.
+else
+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_prog_BDEPS_UNZIP="$ac_prog"
+    $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
+
+fi
+fi
+BDEPS_UNZIP=$ac_cv_prog_BDEPS_UNZIP
+if test -n "$BDEPS_UNZIP"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BDEPS_UNZIP" >&5
+$as_echo "$BDEPS_UNZIP" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+  test -n "$BDEPS_UNZIP" && break
+done
+
+    if test "x$BDEPS_UNZIP" = x7z; then
+        BDEPS_UNZIP="7z x"
+    fi
+
+    for ac_prog in wget lftp ftp
+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_prog_BDEPS_FTP+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$BDEPS_FTP"; then
+  ac_cv_prog_BDEPS_FTP="$BDEPS_FTP" # Let the user override the test.
+else
+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_prog_BDEPS_FTP="$ac_prog"
+    $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
+
+fi
+fi
+BDEPS_FTP=$ac_cv_prog_BDEPS_FTP
+if test -n "$BDEPS_FTP"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BDEPS_FTP" >&5
+$as_echo "$BDEPS_FTP" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+  test -n "$BDEPS_FTP" && break
+done
+
 
 
 ###############################################################################
@@ -6848,7 +7931,7 @@
 # Check which variant of the JDK that we want to build.
 # Currently we have:
 #    normal:   standard edition
-#    embedded: cut down to a smaller footprint
+# but the custom make system may add other variants
 #
 # Effectively the JDK variant gives a name to a specific set of
 # modules to compile into the JDK. In the future, these modules
@@ -6864,18 +7947,10 @@
 
 
 if test "x$with_jdk_variant" = xnormal || test "x$with_jdk_variant" = x; then
-    JAVASE_EMBEDDED=""
-    MINIMIZE_RAM_USAGE=""
     JDK_VARIANT="normal"
-elif test "x$with_jdk_variant" = xembedded; then
-    JAVASE_EMBEDDED="JAVASE_EMBEDDED:=true"
-    MINIMIZE_RAM_USAGE="MINIMIZE_RAM_USAGE:=true"
-    JDK_VARIANT="embedded"
-else
-    as_fn_error $? "The available JDK variants are: normal, embedded" "$LINENO" 5
-fi
-
-
+else
+    as_fn_error $? "The available JDK variants are: normal" "$LINENO" 5
+fi
 
 
 
@@ -6904,11 +7979,7 @@
 
 
 if test "x$with_jvm_variants" = x; then
-    if test "x$JDK_VARIANT" = xembedded; then
-        with_jvm_variants="client"
-    else
-        with_jvm_variants="server"
-    fi
+     with_jvm_variants="server"
 fi
 
 JVM_VARIANTS=",$with_jvm_variants,"
@@ -6953,6 +8024,11 @@
 
 
 
+if test "x$OPENJDK_TARGET_OS" = "xmacosx"; then
+   MACOSX_UNIVERSAL="true"
+fi
+
+
 
 
 
@@ -7058,6 +8134,14 @@
 
 HOTSPOT_TARGET="$HOTSPOT_TARGET docs export_$HOTSPOT_EXPORT"
 
+# On Macosx universal binaries are produced, but they only contain
+# 64 bit intel. This invalidates control of which jvms are built
+# from configure, but only server is valid anyway. Fix this
+# when hotspot makefiles are rewritten.
+if test "x$MACOSX_UNIVERSAL" = xtrue; then
+    HOTSPOT_TARGET=universal_product
+fi
+
 #####
 
 
@@ -7133,14 +8217,12 @@
 
 if test "x$SUPPORT_HEADFUL" = xyes; then
     # We are building both headful and headless.
-    BUILD_HEADLESS_ONLY=""
     headful_msg="inlude support for both headful and headless"
 fi
 
 if test "x$SUPPORT_HEADFUL" = xno; then
     # Thus we are building headless only.
     BUILD_HEADLESS="BUILD_HEADLESS:=true"
-    BUILD_HEADLESS_ONLY="BUILD_HEADLESS_ONLY:=true"
     headful_msg="headless only"
 fi
 
@@ -7151,29 +8233,6 @@
 
 
 
-
-###############################################################################
-#
-# Should we run the painfully slow javadoc tool?
-#
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build documentation" >&5
-$as_echo_n "checking whether to build documentation... " >&6; }
-# Check whether --enable-docs was given.
-if test "${enable_docs+set}" = set; then :
-  enableval=$enable_docs; ENABLE_DOCS="${enableval}"
-else
-  ENABLE_DOCS='no'
-fi
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ENABLE_DOCS" >&5
-$as_echo "$ENABLE_DOCS" >&6; }
-
-GENERATE_DOCS=false
-if test "x$ENABLE_DOCS" = xyes; then
-    GENERATE_DOCS=true
-fi
-
-
 ###############################################################################
 #
 # Should we compile nimbus swing L&F? We can probably remove this option
@@ -7238,25 +8297,21 @@
 #
 COMPRESS_JARS=false
 
-# default for embedded is yes...
-if test "x$JDK_VARIANT" = "xembedded"; then
-   COMPRESS_JARS=true
-fi
 
 
 ###############################################################################
 #
 # Should we compile JFR
-#   default no, except for on closed-jdk and !embedded
+#   default no, except for on closed-jdk
 #
 ENABLE_JFR=no
 
 # Is the JFR source present
 
 #
-# For closed && !embedded default is yes if the source is present
-#
-if test "x${OPENJDK}" != "xtrue" && test "x$JDK_VARIANT" != "xembedded" && test -d "$SRC_ROOT/jdk/src/closed/share/native/oracle/jfr"; then
+# For closed default is yes
+#
+if test "x${OPENJDK}" != "xtrue"; then
    ENABLE_JFR=yes
 fi
 
@@ -7374,7 +8429,11 @@
     HAS_SPACE=`echo "$OUTPUT_ROOT" | grep " "`
     if test "x$HAS_SPACE" != x; then
         if test "x$OPENJDK_BUILD_OS" = "xwindows"; then
+            # First convert it to DOS-style, short mode (no spaces)
             OUTPUT_ROOT=`$CYGPATH -s -m -a "$OUTPUT_ROOT"`
+            # Now it's case insensitive; let's make it lowercase to improve readability
+            OUTPUT_ROOT=`$ECHO "$OUTPUT_ROOT" | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvqxyz'`
+            # Now convert it back to Unix-stile (cygpath)
             OUTPUT_ROOT=`$CYGPATH -u "$OUTPUT_ROOT"`
         else
             as_fn_error $? "You cannot have spaces in the path to the output root! \"$OUTPUT_ROOT\"" "$LINENO" 5
@@ -7395,7 +8454,16 @@
 # The spec.gmk file contains all variables for the make system.
 ac_config_files="$ac_config_files $OUTPUT_ROOT/spec.gmk:$AUTOCONF_DIR/spec.gmk.in"
 
-# The spec.sh file contains variables for compare{images|-objects}.sh scrips.
+# The hotspot-spec.gmk file contains legacy variables for the hotspot make system.
+ac_config_files="$ac_config_files $OUTPUT_ROOT/hotspot-spec.gmk:$AUTOCONF_DIR/hotspot-spec.gmk.in"
+
+# The bootcycle-spec.gmk file contains support for boot cycle builds.
+ac_config_files="$ac_config_files $OUTPUT_ROOT/bootcycle-spec.gmk:$AUTOCONF_DIR/bootcycle-spec.gmk.in"
+
+# The compare.sh is used to compare the build output to other builds.
+ac_config_files="$ac_config_files $OUTPUT_ROOT/compare.sh:$AUTOCONF_DIR/compare.sh.in"
+
+# Spec.sh is currently used by compare-objects.sh
 ac_config_files="$ac_config_files $OUTPUT_ROOT/spec.sh:$AUTOCONF_DIR/spec.sh.in"
 
 # The generated Makefile knows where the spec.gmk is and where the source is.
@@ -7423,41 +8491,129 @@
 fi
 
 
+# We look for the Boot JDK through various means, going from more certain to
+# more of a guess-work. After each test, BOOT_JDK_FOUND is set to "yes" if
+# we detected something (if so, the path to the jdk is in BOOT_JDK). But we
+# must check if this is indeed valid; otherwise we'll continue looking.
+
+# Test: Is bootjdk explicitely set by command line arguments?
+
+  if test "x$BOOT_JDK_FOUND" = xno; then
+    # Now execute the test
+
 if test "x$with_boot_jdk" != x; then
     BOOT_JDK=$with_boot_jdk
-    BOOT_JDK_FOUND=yes
-fi
-if test "x$BOOT_JDK_FOUND" = xno; then
+    BOOT_JDK_FOUND=maybe
+    { $as_echo "$as_me:${as_lineno-$LINENO}: Found potential Boot JDK using configure arguments" >&5
+$as_echo "$as_me: Found potential Boot JDK using configure arguments" >&6;}
+fi
+
+
+    # If previous step claimed to have found a JDK, check it to see if it seems to be valid.
+    if test "x$BOOT_JDK_FOUND" = xmaybe; then
+      # Do we have a bin/java?
+      if test ! -x "$BOOT_JDK/bin/java"; then
+        { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK did not contain bin/java; ignoring" >&5
+$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK did not contain bin/java; ignoring" >&6;}
+        BOOT_JDK_FOUND=no
+      else
+        # Do we have a bin/javac?
+        if test ! -x "$BOOT_JDK/bin/javac"; then
+          { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK did not contain bin/javac; ignoring" >&5
+$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK did not contain bin/javac; ignoring" >&6;}
+          { $as_echo "$as_me:${as_lineno-$LINENO}: (This might be an JRE instead of an JDK)" >&5
+$as_echo "$as_me: (This might be an JRE instead of an JDK)" >&6;}
+          BOOT_JDK_FOUND=no
+        else
+          # Do we have an rt.jar? (On MacOSX it is called classes.jar)
+          if test ! -f "$BOOT_JDK/jre/lib/rt.jar" && test ! -f "$BOOT_JDK/../Classes/classes.jar"; then
+            { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK did not contain an rt.jar; ignoring" >&5
+$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK did not contain an rt.jar; ignoring" >&6;}
+            BOOT_JDK_FOUND=no
+          else
+            # Oh, this is looking good! We probably have found a proper JDK. Is it the correct version?
+            BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | head -n 1`
+
+            # Extra M4 quote needed to protect [] in grep expression.
+            FOUND_VERSION_78=`echo $BOOT_JDK_VERSION | grep  '\"1\.[78]\.'`
+            if test "x$FOUND_VERSION_78" = x; then
+              { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5
+$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;}
+              { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 7 or 8)" >&5
+$as_echo "$as_me: (Your Boot JDK must be version 7 or 8)" >&6;}
+              BOOT_JDK_FOUND=no
+            else
+              # We're done! :-)
+              BOOT_JDK_FOUND=yes
+
+    # Fail with message the path to the Boot JDK if var BOOT_JDK contains a path with no spaces in it.
+    # Unless on Windows, where we can rewrite the path.
+    HAS_SPACE=`echo "$BOOT_JDK" | grep " "`
+    if test "x$HAS_SPACE" != x; then
+        if test "x$OPENJDK_BUILD_OS" = "xwindows"; then
+            # First convert it to DOS-style, short mode (no spaces)
+            BOOT_JDK=`$CYGPATH -s -m -a "$BOOT_JDK"`
+            # Now it's case insensitive; let's make it lowercase to improve readability
+            BOOT_JDK=`$ECHO "$BOOT_JDK" | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvqxyz'`
+            # Now convert it back to Unix-stile (cygpath)
+            BOOT_JDK=`$CYGPATH -u "$BOOT_JDK"`
+        else
+            as_fn_error $? "You cannot have spaces in the path to the Boot JDK! \"$BOOT_JDK\"" "$LINENO" 5
+        fi
+    fi
+
+              { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Boot JDK" >&5
+$as_echo_n "checking for Boot JDK... " >&6; }
+              { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BOOT_JDK ($BOOT_JDK_VERSION)" >&5
+$as_echo "$BOOT_JDK ($BOOT_JDK_VERSION)" >&6; }
+            fi # end check jdk version
+          fi # end check rt.jar
+        fi # end check javac
+      fi # end check java
+    fi # end check boot jdk found
+  fi
+
+if test "x$with_boot_jdk" != x && test "x$BOOT_JDK_FOUND" = xno; then
+  # Having specified an argument which is incorrect will produce an instant failure;
+  # we should not go on looking
+  as_fn_error $? "The path given by --with-boot-jdk does not contain a valid Boot JDK" "$LINENO" 5
+fi
+
+# Test: Is bootjdk available from builddeps?
+
+  if test "x$BOOT_JDK_FOUND" = xno; then
+    # Now execute the test
+
 
 
     if test "x$with_builddeps_server" != x || test "x$with_builddeps_conf" != x; then
         # Source the builddeps file again, to make sure it uses the latest variables!
         . $builddepsfile
         # Look for a target and build machine specific resource!
-        eval resource=\${builddep_boot-jdk_BUILD_${rewritten_build_var}_TARGET_${rewritten_target_var}}
+        eval resource=\${builddep_bootjdk_BUILD_${rewritten_build_var}_TARGET_${rewritten_target_var}}
         if test "x$resource" = x; then
             # Ok, lets instead look for a target specific resource
-            eval resource=\${builddep_boot-jdk_TARGET_${rewritten_target_var}}
+            eval resource=\${builddep_bootjdk_TARGET_${rewritten_target_var}}
         fi
         if test "x$resource" = x; then
             # Ok, lets instead look for a build specific resource
-            eval resource=\${builddep_boot-jdk_BUILD_${rewritten_build_var}}
+            eval resource=\${builddep_bootjdk_BUILD_${rewritten_build_var}}
         fi
         if test "x$resource" = x; then
             # Ok, lets instead look for a generic resource
-            # (The boot-jdk comes from M4 and not the shell, thus no need for eval here.)
-            resource=${builddep_boot-jdk}
+            # (The bootjdk comes from M4 and not the shell, thus no need for eval here.)
+            resource=${builddep_bootjdk}
         fi
         if test "x$resource" != x; then
-            { $as_echo "$as_me:${as_lineno-$LINENO}: Using builddeps $resource for boot-jdk" >&5
-$as_echo "$as_me: Using builddeps $resource for boot-jdk" >&6;}
+            { $as_echo "$as_me:${as_lineno-$LINENO}: Using builddeps $resource for bootjdk" >&5
+$as_echo "$as_me: Using builddeps $resource for bootjdk" >&6;}
 	    # If the resource in the builddeps.conf file is an existing directory,
 	    # for example /java/linux/cups
 	    if test -d ${resource}; then
 	       depdir=${resource}
 	    else
 
-# boot-jdk is for example mymodule
+# bootjdk is for example mymodule
 # $resource is for example libs/general/libmymod_1_2_3.zip
 # $with_builddeps_server is for example ftp://mybuilddeps.myserver.com/builddeps
 # $with_builddeps_dir is for example /localhome/builddeps
@@ -7470,15 +8626,15 @@
     extension=${filename#*.}
     installdir=$with_builddeps_dir/$filebase
     if test ! -f $installdir/$filename.unpacked; then
-        { $as_echo "$as_me:${as_lineno-$LINENO}: Downloading build dependency boot-jdk from $with_builddeps_server/$resource and installing into $installdir" >&5
-$as_echo "$as_me: Downloading build dependency boot-jdk from $with_builddeps_server/$resource and installing into $installdir" >&6;}
+        { $as_echo "$as_me:${as_lineno-$LINENO}: Downloading build dependency bootjdk from $with_builddeps_server/$resource and installing into $installdir" >&5
+$as_echo "$as_me: Downloading build dependency bootjdk from $with_builddeps_server/$resource and installing into $installdir" >&6;}
         if test ! -d $installdir; then
             mkdir -p $installdir
         fi
         if test ! -d $installdir; then
             as_fn_error $? "Could not create directory $installdir" "$LINENO" 5
         fi
-        tmpfile=`mktemp $installdir/boot-jdk.XXXXXXXXX`
+        tmpfile=`mktemp $installdir/bootjdk.XXXXXXXXX`
         touch $tmpfile
         if test ! -f $tmpfile; then
             as_fn_error $? "Could not create files in directory $installdir" "$LINENO" 5
@@ -7549,11 +8705,11 @@
             # was updated to point at the current build dependency install directory.
             . $builddepsfile
             # Now extract variables from the builddeps.conf files.
-            theroot=${builddep_boot-jdk_ROOT}
-            thecflags=${builddep_boot-jdk_CFLAGS}
-            thelibs=${builddep_boot-jdk_LIBS}
+            theroot=${builddep_bootjdk_ROOT}
+            thecflags=${builddep_bootjdk_CFLAGS}
+            thelibs=${builddep_bootjdk_LIBS}
             if test "x$depdir" = x; then
-                as_fn_error $? "Could not download build dependency boot-jdk" "$LINENO" 5
+                as_fn_error $? "Could not download build dependency bootjdk" "$LINENO" 5
             fi
             BOOT_JDK=$depdir
             if test "x$theroot" != x; then
@@ -7565,7 +8721,7 @@
             if test "x$thelibs" != x; then
                BOOT_JDK_LIBS="$thelibs"
             fi
-            BOOT_JDK_FOUND=yes
+            BOOT_JDK_FOUND=maybe
             else BOOT_JDK_FOUND=no
 
         fi
@@ -7573,41 +8729,247 @@
 
     fi
 
-fi
-
-if test "x$BOOT_JDK_FOUND" = xno; then
+
+
+    # If previous step claimed to have found a JDK, check it to see if it seems to be valid.
+    if test "x$BOOT_JDK_FOUND" = xmaybe; then
+      # Do we have a bin/java?
+      if test ! -x "$BOOT_JDK/bin/java"; then
+        { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK did not contain bin/java; ignoring" >&5
+$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK did not contain bin/java; ignoring" >&6;}
+        BOOT_JDK_FOUND=no
+      else
+        # Do we have a bin/javac?
+        if test ! -x "$BOOT_JDK/bin/javac"; then
+          { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK did not contain bin/javac; ignoring" >&5
+$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK did not contain bin/javac; ignoring" >&6;}
+          { $as_echo "$as_me:${as_lineno-$LINENO}: (This might be an JRE instead of an JDK)" >&5
+$as_echo "$as_me: (This might be an JRE instead of an JDK)" >&6;}
+          BOOT_JDK_FOUND=no
+        else
+          # Do we have an rt.jar? (On MacOSX it is called classes.jar)
+          if test ! -f "$BOOT_JDK/jre/lib/rt.jar" && test ! -f "$BOOT_JDK/../Classes/classes.jar"; then
+            { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK did not contain an rt.jar; ignoring" >&5
+$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK did not contain an rt.jar; ignoring" >&6;}
+            BOOT_JDK_FOUND=no
+          else
+            # Oh, this is looking good! We probably have found a proper JDK. Is it the correct version?
+            BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | head -n 1`
+
+            # Extra M4 quote needed to protect [] in grep expression.
+            FOUND_VERSION_78=`echo $BOOT_JDK_VERSION | grep  '\"1\.[78]\.'`
+            if test "x$FOUND_VERSION_78" = x; then
+              { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5
+$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;}
+              { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 7 or 8)" >&5
+$as_echo "$as_me: (Your Boot JDK must be version 7 or 8)" >&6;}
+              BOOT_JDK_FOUND=no
+            else
+              # We're done! :-)
+              BOOT_JDK_FOUND=yes
+
+    # Fail with message the path to the Boot JDK if var BOOT_JDK contains a path with no spaces in it.
+    # Unless on Windows, where we can rewrite the path.
+    HAS_SPACE=`echo "$BOOT_JDK" | grep " "`
+    if test "x$HAS_SPACE" != x; then
+        if test "x$OPENJDK_BUILD_OS" = "xwindows"; then
+            # First convert it to DOS-style, short mode (no spaces)
+            BOOT_JDK=`$CYGPATH -s -m -a "$BOOT_JDK"`
+            # Now it's case insensitive; let's make it lowercase to improve readability
+            BOOT_JDK=`$ECHO "$BOOT_JDK" | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvqxyz'`
+            # Now convert it back to Unix-stile (cygpath)
+            BOOT_JDK=`$CYGPATH -u "$BOOT_JDK"`
+        else
+            as_fn_error $? "You cannot have spaces in the path to the Boot JDK! \"$BOOT_JDK\"" "$LINENO" 5
+        fi
+    fi
+
+              { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Boot JDK" >&5
+$as_echo_n "checking for Boot JDK... " >&6; }
+              { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BOOT_JDK ($BOOT_JDK_VERSION)" >&5
+$as_echo "$BOOT_JDK ($BOOT_JDK_VERSION)" >&6; }
+            fi # end check jdk version
+          fi # end check rt.jar
+        fi # end check javac
+      fi # end check java
+    fi # end check boot jdk found
+  fi
+
+
+# Test: Is $JAVA_HOME set?
+
+  if test "x$BOOT_JDK_FOUND" = xno; then
+    # Now execute the test
+
     if test "x$JAVA_HOME" != x; then
-        if test ! -d "$JAVA_HOME"; then
+        if test "x$OPENJDK_TARGET_OS" = xwindows; then
+          # On Windows, JAVA_HOME is likely in DOS-style
+          JAVA_HOME_PROCESSED="`$CYGPATH -u "$JAVA_HOME"`"
+        else
+          JAVA_HOME_PROCESSED="$JAVA_HOME"
+        fi
+        if test ! -d "$JAVA_HOME_PROCESSED"; then
             { $as_echo "$as_me:${as_lineno-$LINENO}: Your JAVA_HOME points to a non-existing directory!" >&5
 $as_echo "$as_me: Your JAVA_HOME points to a non-existing directory!" >&6;}
-
-    { $as_echo "$as_me:${as_lineno-$LINENO}: This might be fixed by explicitely setting --with-boot-jdk" >&5
-$as_echo "$as_me: This might be fixed by explicitely setting --with-boot-jdk" >&6;}
-    as_fn_error $? "Cannot continue" "$LINENO" 5
-
-        fi
-        # Aha, the user has set a JAVA_HOME
-        # let us use that as the Boot JDK.
-        BOOT_JDK="$JAVA_HOME"
-        BOOT_JDK_FOUND=yes
-        # To be on the safe side, lets check that it is a JDK.
-        if test -x "$BOOT_JDK/bin/javac" && test -x "$BOOT_JDK/bin/java"; then
-            JAVAC="$BOOT_JDK/bin/javac"
-            JAVA="$BOOT_JDK/bin/java"
-            BOOT_JDK_FOUND=yes
-        else
-            { $as_echo "$as_me:${as_lineno-$LINENO}: Your JAVA_HOME points to a JRE! The build needs a JDK! Please point JAVA_HOME to a JDK. JAVA_HOME=$JAVA_HOME" >&5
-$as_echo "$as_me: Your JAVA_HOME points to a JRE! The build needs a JDK! Please point JAVA_HOME to a JDK. JAVA_HOME=$JAVA_HOME" >&6;}
-
-    { $as_echo "$as_me:${as_lineno-$LINENO}: This might be fixed by explicitely setting --with-boot-jdk" >&5
-$as_echo "$as_me: This might be fixed by explicitely setting --with-boot-jdk" >&6;}
-    as_fn_error $? "Cannot continue" "$LINENO" 5
-
-        fi
-    fi
-fi
-
-if test "x$BOOT_JDK_FOUND" = xno; then
+        else
+          # Aha, the user has set a JAVA_HOME
+          # let us use that as the Boot JDK.
+          BOOT_JDK="$JAVA_HOME_PROCESSED"
+          BOOT_JDK_FOUND=maybe
+          { $as_echo "$as_me:${as_lineno-$LINENO}: Found potential Boot JDK using JAVA_HOME" >&5
+$as_echo "$as_me: Found potential Boot JDK using JAVA_HOME" >&6;}
+        fi
+    fi
+
+
+    # If previous step claimed to have found a JDK, check it to see if it seems to be valid.
+    if test "x$BOOT_JDK_FOUND" = xmaybe; then
+      # Do we have a bin/java?
+      if test ! -x "$BOOT_JDK/bin/java"; then
+        { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK did not contain bin/java; ignoring" >&5
+$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK did not contain bin/java; ignoring" >&6;}
+        BOOT_JDK_FOUND=no
+      else
+        # Do we have a bin/javac?
+        if test ! -x "$BOOT_JDK/bin/javac"; then
+          { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK did not contain bin/javac; ignoring" >&5
+$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK did not contain bin/javac; ignoring" >&6;}
+          { $as_echo "$as_me:${as_lineno-$LINENO}: (This might be an JRE instead of an JDK)" >&5
+$as_echo "$as_me: (This might be an JRE instead of an JDK)" >&6;}
+          BOOT_JDK_FOUND=no
+        else
+          # Do we have an rt.jar? (On MacOSX it is called classes.jar)
+          if test ! -f "$BOOT_JDK/jre/lib/rt.jar" && test ! -f "$BOOT_JDK/../Classes/classes.jar"; then
+            { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK did not contain an rt.jar; ignoring" >&5
+$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK did not contain an rt.jar; ignoring" >&6;}
+            BOOT_JDK_FOUND=no
+          else
+            # Oh, this is looking good! We probably have found a proper JDK. Is it the correct version?
+            BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | head -n 1`
+
+            # Extra M4 quote needed to protect [] in grep expression.
+            FOUND_VERSION_78=`echo $BOOT_JDK_VERSION | grep  '\"1\.[78]\.'`
+            if test "x$FOUND_VERSION_78" = x; then
+              { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5
+$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;}
+              { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 7 or 8)" >&5
+$as_echo "$as_me: (Your Boot JDK must be version 7 or 8)" >&6;}
+              BOOT_JDK_FOUND=no
+            else
+              # We're done! :-)
+              BOOT_JDK_FOUND=yes
+
+    # Fail with message the path to the Boot JDK if var BOOT_JDK contains a path with no spaces in it.
+    # Unless on Windows, where we can rewrite the path.
+    HAS_SPACE=`echo "$BOOT_JDK" | grep " "`
+    if test "x$HAS_SPACE" != x; then
+        if test "x$OPENJDK_BUILD_OS" = "xwindows"; then
+            # First convert it to DOS-style, short mode (no spaces)
+            BOOT_JDK=`$CYGPATH -s -m -a "$BOOT_JDK"`
+            # Now it's case insensitive; let's make it lowercase to improve readability
+            BOOT_JDK=`$ECHO "$BOOT_JDK" | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvqxyz'`
+            # Now convert it back to Unix-stile (cygpath)
+            BOOT_JDK=`$CYGPATH -u "$BOOT_JDK"`
+        else
+            as_fn_error $? "You cannot have spaces in the path to the Boot JDK! \"$BOOT_JDK\"" "$LINENO" 5
+        fi
+    fi
+
+              { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Boot JDK" >&5
+$as_echo_n "checking for Boot JDK... " >&6; }
+              { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BOOT_JDK ($BOOT_JDK_VERSION)" >&5
+$as_echo "$BOOT_JDK ($BOOT_JDK_VERSION)" >&6; }
+            fi # end check jdk version
+          fi # end check rt.jar
+        fi # end check javac
+      fi # end check java
+    fi # end check boot jdk found
+  fi
+
+
+# Test: Is there a /usr/libexec/java_home? (Typically on MacOSX)
+
+  if test "x$BOOT_JDK_FOUND" = xno; then
+    # Now execute the test
+
+    if test -x /usr/libexec/java_home; then
+        BOOT_JDK=`/usr/libexec/java_home`
+        BOOT_JDK_FOUND=maybe
+        { $as_echo "$as_me:${as_lineno-$LINENO}: Found potential Boot JDK using /usr/libexec/java_home" >&5
+$as_echo "$as_me: Found potential Boot JDK using /usr/libexec/java_home" >&6;}
+    fi
+
+
+    # If previous step claimed to have found a JDK, check it to see if it seems to be valid.
+    if test "x$BOOT_JDK_FOUND" = xmaybe; then
+      # Do we have a bin/java?
+      if test ! -x "$BOOT_JDK/bin/java"; then
+        { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK did not contain bin/java; ignoring" >&5
+$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK did not contain bin/java; ignoring" >&6;}
+        BOOT_JDK_FOUND=no
+      else
+        # Do we have a bin/javac?
+        if test ! -x "$BOOT_JDK/bin/javac"; then
+          { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK did not contain bin/javac; ignoring" >&5
+$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK did not contain bin/javac; ignoring" >&6;}
+          { $as_echo "$as_me:${as_lineno-$LINENO}: (This might be an JRE instead of an JDK)" >&5
+$as_echo "$as_me: (This might be an JRE instead of an JDK)" >&6;}
+          BOOT_JDK_FOUND=no
+        else
+          # Do we have an rt.jar? (On MacOSX it is called classes.jar)
+          if test ! -f "$BOOT_JDK/jre/lib/rt.jar" && test ! -f "$BOOT_JDK/../Classes/classes.jar"; then
+            { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK did not contain an rt.jar; ignoring" >&5
+$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK did not contain an rt.jar; ignoring" >&6;}
+            BOOT_JDK_FOUND=no
+          else
+            # Oh, this is looking good! We probably have found a proper JDK. Is it the correct version?
+            BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | head -n 1`
+
+            # Extra M4 quote needed to protect [] in grep expression.
+            FOUND_VERSION_78=`echo $BOOT_JDK_VERSION | grep  '\"1\.[78]\.'`
+            if test "x$FOUND_VERSION_78" = x; then
+              { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5
+$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;}
+              { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 7 or 8)" >&5
+$as_echo "$as_me: (Your Boot JDK must be version 7 or 8)" >&6;}
+              BOOT_JDK_FOUND=no
+            else
+              # We're done! :-)
+              BOOT_JDK_FOUND=yes
+
+    # Fail with message the path to the Boot JDK if var BOOT_JDK contains a path with no spaces in it.
+    # Unless on Windows, where we can rewrite the path.
+    HAS_SPACE=`echo "$BOOT_JDK" | grep " "`
+    if test "x$HAS_SPACE" != x; then
+        if test "x$OPENJDK_BUILD_OS" = "xwindows"; then
+            # First convert it to DOS-style, short mode (no spaces)
+            BOOT_JDK=`$CYGPATH -s -m -a "$BOOT_JDK"`
+            # Now it's case insensitive; let's make it lowercase to improve readability
+            BOOT_JDK=`$ECHO "$BOOT_JDK" | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvqxyz'`
+            # Now convert it back to Unix-stile (cygpath)
+            BOOT_JDK=`$CYGPATH -u "$BOOT_JDK"`
+        else
+            as_fn_error $? "You cannot have spaces in the path to the Boot JDK! \"$BOOT_JDK\"" "$LINENO" 5
+        fi
+    fi
+
+              { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Boot JDK" >&5
+$as_echo_n "checking for Boot JDK... " >&6; }
+              { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BOOT_JDK ($BOOT_JDK_VERSION)" >&5
+$as_echo "$BOOT_JDK ($BOOT_JDK_VERSION)" >&6; }
+            fi # end check jdk version
+          fi # end check rt.jar
+        fi # end check javac
+      fi # end check java
+    fi # end check boot jdk found
+  fi
+
+
+# Test: Is there a java or javac in the PATH, which is a symlink to the JDK?
+
+  if test "x$BOOT_JDK_FOUND" = xno; then
+    # Now execute the test
+
     # Extract the first word of "javac", so it can be a program name with args.
 set dummy javac; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
@@ -7800,116 +9162,742 @@
         fi
     fi
 
-        BOOT_JDK=`dirname $BINARY`
-        BOOT_JDK=`cd $BOOT_JDK/..; pwd`
-        if test -x $BOOT_JDK/bin/javac && test -x $BOOT_JDK/bin/java; then
-            JAVAC=$BOOT_JDK/bin/javac
-            JAVA=$BOOT_JDK/bin/java
-            BOOT_JDK_FOUND=yes
-        fi
-    fi
-fi
-
-if test "x$BOOT_JDK_FOUND" = xno; then
-    # Try the MacOSX way.
-    if test -x /usr/libexec/java_home; then
-        BOOT_JDK=`/usr/libexec/java_home`
-        if test -x $BOOT_JDK/bin/javac && test -x $BOOT_JDK/bin/java; then
-            JAVAC=$BOOT_JDK/bin/javac
-            JAVA=$BOOT_JDK/bin/java
-            BOOT_JDK_FOUND=yes
-        fi
-    fi
-fi
-
+        BOOT_JDK=`dirname "$BINARY"`
+        BOOT_JDK=`cd "$BOOT_JDK/.."; pwd`
+        if test -x "$BOOT_JDK/bin/javac" && test -x "$BOOT_JDK/bin/java"; then
+            # Looks like we found ourselves an JDK
+            BOOT_JDK_FOUND=maybe
+            { $as_echo "$as_me:${as_lineno-$LINENO}: Found potential Boot JDK using java(c) in PATH" >&5
+$as_echo "$as_me: Found potential Boot JDK using java(c) in PATH" >&6;}
+        fi
+    fi
+
+
+    # If previous step claimed to have found a JDK, check it to see if it seems to be valid.
+    if test "x$BOOT_JDK_FOUND" = xmaybe; then
+      # Do we have a bin/java?
+      if test ! -x "$BOOT_JDK/bin/java"; then
+        { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK did not contain bin/java; ignoring" >&5
+$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK did not contain bin/java; ignoring" >&6;}
+        BOOT_JDK_FOUND=no
+      else
+        # Do we have a bin/javac?
+        if test ! -x "$BOOT_JDK/bin/javac"; then
+          { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK did not contain bin/javac; ignoring" >&5
+$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK did not contain bin/javac; ignoring" >&6;}
+          { $as_echo "$as_me:${as_lineno-$LINENO}: (This might be an JRE instead of an JDK)" >&5
+$as_echo "$as_me: (This might be an JRE instead of an JDK)" >&6;}
+          BOOT_JDK_FOUND=no
+        else
+          # Do we have an rt.jar? (On MacOSX it is called classes.jar)
+          if test ! -f "$BOOT_JDK/jre/lib/rt.jar" && test ! -f "$BOOT_JDK/../Classes/classes.jar"; then
+            { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK did not contain an rt.jar; ignoring" >&5
+$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK did not contain an rt.jar; ignoring" >&6;}
+            BOOT_JDK_FOUND=no
+          else
+            # Oh, this is looking good! We probably have found a proper JDK. Is it the correct version?
+            BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | head -n 1`
+
+            # Extra M4 quote needed to protect [] in grep expression.
+            FOUND_VERSION_78=`echo $BOOT_JDK_VERSION | grep  '\"1\.[78]\.'`
+            if test "x$FOUND_VERSION_78" = x; then
+              { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5
+$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;}
+              { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 7 or 8)" >&5
+$as_echo "$as_me: (Your Boot JDK must be version 7 or 8)" >&6;}
+              BOOT_JDK_FOUND=no
+            else
+              # We're done! :-)
+              BOOT_JDK_FOUND=yes
+
+    # Fail with message the path to the Boot JDK if var BOOT_JDK contains a path with no spaces in it.
+    # Unless on Windows, where we can rewrite the path.
+    HAS_SPACE=`echo "$BOOT_JDK" | grep " "`
+    if test "x$HAS_SPACE" != x; then
+        if test "x$OPENJDK_BUILD_OS" = "xwindows"; then
+            # First convert it to DOS-style, short mode (no spaces)
+            BOOT_JDK=`$CYGPATH -s -m -a "$BOOT_JDK"`
+            # Now it's case insensitive; let's make it lowercase to improve readability
+            BOOT_JDK=`$ECHO "$BOOT_JDK" | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvqxyz'`
+            # Now convert it back to Unix-stile (cygpath)
+            BOOT_JDK=`$CYGPATH -u "$BOOT_JDK"`
+        else
+            as_fn_error $? "You cannot have spaces in the path to the Boot JDK! \"$BOOT_JDK\"" "$LINENO" 5
+        fi
+    fi
+
+              { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Boot JDK" >&5
+$as_echo_n "checking for Boot JDK... " >&6; }
+              { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BOOT_JDK ($BOOT_JDK_VERSION)" >&5
+$as_echo "$BOOT_JDK ($BOOT_JDK_VERSION)" >&6; }
+            fi # end check jdk version
+          fi # end check rt.jar
+        fi # end check javac
+      fi # end check java
+    fi # end check boot jdk found
+  fi
+
+
+# Test: Is there a JDK installed in default, well-known locations?
+
+  if test "x$BOOT_JDK_FOUND" = xno; then
+    # Now execute the test
+
+  if test "x$OPENJDK_TARGET_OS" = xwindows; then
+
+  if test "x$BOOT_JDK_FOUND" = xno; then
+    # Now execute the test
+
+  if test "x$ProgramW6432" != x; then
+
+  BOOT_JDK_PREFIX="`$CYGPATH -u "$ProgramW6432"`/Java"
+  BOOT_JDK_SUFFIX=""
+  BEST_JDK_FOUND=`$LS "$BOOT_JDK_PREFIX" 2> /dev/null | $GREP jdk | $SORT -r | $HEAD -n 1 `
+  if test "x$BEST_JDK_FOUND" != x; then
+    BOOT_JDK="${BOOT_JDK_PREFIX}/${BEST_JDK_FOUND}${BOOT_JDK_SUFFIX}"
+    if test -d "$BOOT_JDK"; then
+      BOOT_JDK_FOUND=maybe
+      { $as_echo "$as_me:${as_lineno-$LINENO}: Found potential Boot JDK using well-known locations (in $BOOT_JDK_PREFIX)" >&5
+$as_echo "$as_me: Found potential Boot JDK using well-known locations (in $BOOT_JDK_PREFIX)" >&6;}
+    fi
+  fi
+
+  fi
+
+
+    # If previous step claimed to have found a JDK, check it to see if it seems to be valid.
+    if test "x$BOOT_JDK_FOUND" = xmaybe; then
+      # Do we have a bin/java?
+      if test ! -x "$BOOT_JDK/bin/java"; then
+        { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK did not contain bin/java; ignoring" >&5
+$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK did not contain bin/java; ignoring" >&6;}
+        BOOT_JDK_FOUND=no
+      else
+        # Do we have a bin/javac?
+        if test ! -x "$BOOT_JDK/bin/javac"; then
+          { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK did not contain bin/javac; ignoring" >&5
+$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK did not contain bin/javac; ignoring" >&6;}
+          { $as_echo "$as_me:${as_lineno-$LINENO}: (This might be an JRE instead of an JDK)" >&5
+$as_echo "$as_me: (This might be an JRE instead of an JDK)" >&6;}
+          BOOT_JDK_FOUND=no
+        else
+          # Do we have an rt.jar? (On MacOSX it is called classes.jar)
+          if test ! -f "$BOOT_JDK/jre/lib/rt.jar" && test ! -f "$BOOT_JDK/../Classes/classes.jar"; then
+            { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK did not contain an rt.jar; ignoring" >&5
+$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK did not contain an rt.jar; ignoring" >&6;}
+            BOOT_JDK_FOUND=no
+          else
+            # Oh, this is looking good! We probably have found a proper JDK. Is it the correct version?
+            BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | head -n 1`
+
+            # Extra M4 quote needed to protect [] in grep expression.
+            FOUND_VERSION_78=`echo $BOOT_JDK_VERSION | grep  '\"1\.[78]\.'`
+            if test "x$FOUND_VERSION_78" = x; then
+              { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5
+$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;}
+              { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 7 or 8)" >&5
+$as_echo "$as_me: (Your Boot JDK must be version 7 or 8)" >&6;}
+              BOOT_JDK_FOUND=no
+            else
+              # We're done! :-)
+              BOOT_JDK_FOUND=yes
+
+    # Fail with message the path to the Boot JDK if var BOOT_JDK contains a path with no spaces in it.
+    # Unless on Windows, where we can rewrite the path.
+    HAS_SPACE=`echo "$BOOT_JDK" | grep " "`
+    if test "x$HAS_SPACE" != x; then
+        if test "x$OPENJDK_BUILD_OS" = "xwindows"; then
+            # First convert it to DOS-style, short mode (no spaces)
+            BOOT_JDK=`$CYGPATH -s -m -a "$BOOT_JDK"`
+            # Now it's case insensitive; let's make it lowercase to improve readability
+            BOOT_JDK=`$ECHO "$BOOT_JDK" | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvqxyz'`
+            # Now convert it back to Unix-stile (cygpath)
+            BOOT_JDK=`$CYGPATH -u "$BOOT_JDK"`
+        else
+            as_fn_error $? "You cannot have spaces in the path to the Boot JDK! \"$BOOT_JDK\"" "$LINENO" 5
+        fi
+    fi
+
+              { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Boot JDK" >&5
+$as_echo_n "checking for Boot JDK... " >&6; }
+              { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BOOT_JDK ($BOOT_JDK_VERSION)" >&5
+$as_echo "$BOOT_JDK ($BOOT_JDK_VERSION)" >&6; }
+            fi # end check jdk version
+          fi # end check rt.jar
+        fi # end check javac
+      fi # end check java
+    fi # end check boot jdk found
+  fi
+
+
+  if test "x$BOOT_JDK_FOUND" = xno; then
+    # Now execute the test
+
+  if test "x$PROGRAMW6432" != x; then
+
+  BOOT_JDK_PREFIX="`$CYGPATH -u "$PROGRAMW6432"`/Java"
+  BOOT_JDK_SUFFIX=""
+  BEST_JDK_FOUND=`$LS "$BOOT_JDK_PREFIX" 2> /dev/null | $GREP jdk | $SORT -r | $HEAD -n 1 `
+  if test "x$BEST_JDK_FOUND" != x; then
+    BOOT_JDK="${BOOT_JDK_PREFIX}/${BEST_JDK_FOUND}${BOOT_JDK_SUFFIX}"
+    if test -d "$BOOT_JDK"; then
+      BOOT_JDK_FOUND=maybe
+      { $as_echo "$as_me:${as_lineno-$LINENO}: Found potential Boot JDK using well-known locations (in $BOOT_JDK_PREFIX)" >&5
+$as_echo "$as_me: Found potential Boot JDK using well-known locations (in $BOOT_JDK_PREFIX)" >&6;}
+    fi
+  fi
+
+  fi
+
+
+    # If previous step claimed to have found a JDK, check it to see if it seems to be valid.
+    if test "x$BOOT_JDK_FOUND" = xmaybe; then
+      # Do we have a bin/java?
+      if test ! -x "$BOOT_JDK/bin/java"; then
+        { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK did not contain bin/java; ignoring" >&5
+$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK did not contain bin/java; ignoring" >&6;}
+        BOOT_JDK_FOUND=no
+      else
+        # Do we have a bin/javac?
+        if test ! -x "$BOOT_JDK/bin/javac"; then
+          { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK did not contain bin/javac; ignoring" >&5
+$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK did not contain bin/javac; ignoring" >&6;}
+          { $as_echo "$as_me:${as_lineno-$LINENO}: (This might be an JRE instead of an JDK)" >&5
+$as_echo "$as_me: (This might be an JRE instead of an JDK)" >&6;}
+          BOOT_JDK_FOUND=no
+        else
+          # Do we have an rt.jar? (On MacOSX it is called classes.jar)
+          if test ! -f "$BOOT_JDK/jre/lib/rt.jar" && test ! -f "$BOOT_JDK/../Classes/classes.jar"; then
+            { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK did not contain an rt.jar; ignoring" >&5
+$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK did not contain an rt.jar; ignoring" >&6;}
+            BOOT_JDK_FOUND=no
+          else
+            # Oh, this is looking good! We probably have found a proper JDK. Is it the correct version?
+            BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | head -n 1`
+
+            # Extra M4 quote needed to protect [] in grep expression.
+            FOUND_VERSION_78=`echo $BOOT_JDK_VERSION | grep  '\"1\.[78]\.'`
+            if test "x$FOUND_VERSION_78" = x; then
+              { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5
+$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;}
+              { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 7 or 8)" >&5
+$as_echo "$as_me: (Your Boot JDK must be version 7 or 8)" >&6;}
+              BOOT_JDK_FOUND=no
+            else
+              # We're done! :-)
+              BOOT_JDK_FOUND=yes
+
+    # Fail with message the path to the Boot JDK if var BOOT_JDK contains a path with no spaces in it.
+    # Unless on Windows, where we can rewrite the path.
+    HAS_SPACE=`echo "$BOOT_JDK" | grep " "`
+    if test "x$HAS_SPACE" != x; then
+        if test "x$OPENJDK_BUILD_OS" = "xwindows"; then
+            # First convert it to DOS-style, short mode (no spaces)
+            BOOT_JDK=`$CYGPATH -s -m -a "$BOOT_JDK"`
+            # Now it's case insensitive; let's make it lowercase to improve readability
+            BOOT_JDK=`$ECHO "$BOOT_JDK" | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvqxyz'`
+            # Now convert it back to Unix-stile (cygpath)
+            BOOT_JDK=`$CYGPATH -u "$BOOT_JDK"`
+        else
+            as_fn_error $? "You cannot have spaces in the path to the Boot JDK! \"$BOOT_JDK\"" "$LINENO" 5
+        fi
+    fi
+
+              { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Boot JDK" >&5
+$as_echo_n "checking for Boot JDK... " >&6; }
+              { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BOOT_JDK ($BOOT_JDK_VERSION)" >&5
+$as_echo "$BOOT_JDK ($BOOT_JDK_VERSION)" >&6; }
+            fi # end check jdk version
+          fi # end check rt.jar
+        fi # end check javac
+      fi # end check java
+    fi # end check boot jdk found
+  fi
+
+
+  if test "x$BOOT_JDK_FOUND" = xno; then
+    # Now execute the test
+
+  if test "x$PROGRAMFILES" != x; then
+
+  BOOT_JDK_PREFIX="`$CYGPATH -u "$PROGRAMFILES"`/Java"
+  BOOT_JDK_SUFFIX=""
+  BEST_JDK_FOUND=`$LS "$BOOT_JDK_PREFIX" 2> /dev/null | $GREP jdk | $SORT -r | $HEAD -n 1 `
+  if test "x$BEST_JDK_FOUND" != x; then
+    BOOT_JDK="${BOOT_JDK_PREFIX}/${BEST_JDK_FOUND}${BOOT_JDK_SUFFIX}"
+    if test -d "$BOOT_JDK"; then
+      BOOT_JDK_FOUND=maybe
+      { $as_echo "$as_me:${as_lineno-$LINENO}: Found potential Boot JDK using well-known locations (in $BOOT_JDK_PREFIX)" >&5
+$as_echo "$as_me: Found potential Boot JDK using well-known locations (in $BOOT_JDK_PREFIX)" >&6;}
+    fi
+  fi
+
+  fi
+
+
+    # If previous step claimed to have found a JDK, check it to see if it seems to be valid.
+    if test "x$BOOT_JDK_FOUND" = xmaybe; then
+      # Do we have a bin/java?
+      if test ! -x "$BOOT_JDK/bin/java"; then
+        { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK did not contain bin/java; ignoring" >&5
+$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK did not contain bin/java; ignoring" >&6;}
+        BOOT_JDK_FOUND=no
+      else
+        # Do we have a bin/javac?
+        if test ! -x "$BOOT_JDK/bin/javac"; then
+          { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK did not contain bin/javac; ignoring" >&5
+$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK did not contain bin/javac; ignoring" >&6;}
+          { $as_echo "$as_me:${as_lineno-$LINENO}: (This might be an JRE instead of an JDK)" >&5
+$as_echo "$as_me: (This might be an JRE instead of an JDK)" >&6;}
+          BOOT_JDK_FOUND=no
+        else
+          # Do we have an rt.jar? (On MacOSX it is called classes.jar)
+          if test ! -f "$BOOT_JDK/jre/lib/rt.jar" && test ! -f "$BOOT_JDK/../Classes/classes.jar"; then
+            { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK did not contain an rt.jar; ignoring" >&5
+$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK did not contain an rt.jar; ignoring" >&6;}
+            BOOT_JDK_FOUND=no
+          else
+            # Oh, this is looking good! We probably have found a proper JDK. Is it the correct version?
+            BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | head -n 1`
+
+            # Extra M4 quote needed to protect [] in grep expression.
+            FOUND_VERSION_78=`echo $BOOT_JDK_VERSION | grep  '\"1\.[78]\.'`
+            if test "x$FOUND_VERSION_78" = x; then
+              { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5
+$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;}
+              { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 7 or 8)" >&5
+$as_echo "$as_me: (Your Boot JDK must be version 7 or 8)" >&6;}
+              BOOT_JDK_FOUND=no
+            else
+              # We're done! :-)
+              BOOT_JDK_FOUND=yes
+
+    # Fail with message the path to the Boot JDK if var BOOT_JDK contains a path with no spaces in it.
+    # Unless on Windows, where we can rewrite the path.
+    HAS_SPACE=`echo "$BOOT_JDK" | grep " "`
+    if test "x$HAS_SPACE" != x; then
+        if test "x$OPENJDK_BUILD_OS" = "xwindows"; then
+            # First convert it to DOS-style, short mode (no spaces)
+            BOOT_JDK=`$CYGPATH -s -m -a "$BOOT_JDK"`
+            # Now it's case insensitive; let's make it lowercase to improve readability
+            BOOT_JDK=`$ECHO "$BOOT_JDK" | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvqxyz'`
+            # Now convert it back to Unix-stile (cygpath)
+            BOOT_JDK=`$CYGPATH -u "$BOOT_JDK"`
+        else
+            as_fn_error $? "You cannot have spaces in the path to the Boot JDK! \"$BOOT_JDK\"" "$LINENO" 5
+        fi
+    fi
+
+              { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Boot JDK" >&5
+$as_echo_n "checking for Boot JDK... " >&6; }
+              { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BOOT_JDK ($BOOT_JDK_VERSION)" >&5
+$as_echo "$BOOT_JDK ($BOOT_JDK_VERSION)" >&6; }
+            fi # end check jdk version
+          fi # end check rt.jar
+        fi # end check javac
+      fi # end check java
+    fi # end check boot jdk found
+  fi
+
+
+  if test "x$BOOT_JDK_FOUND" = xno; then
+    # Now execute the test
+
+  if test "x$ProgramFiles" != x; then
+
+  BOOT_JDK_PREFIX="`$CYGPATH -u "$ProgramFiles"`/Java"
+  BOOT_JDK_SUFFIX=""
+  BEST_JDK_FOUND=`$LS "$BOOT_JDK_PREFIX" 2> /dev/null | $GREP jdk | $SORT -r | $HEAD -n 1 `
+  if test "x$BEST_JDK_FOUND" != x; then
+    BOOT_JDK="${BOOT_JDK_PREFIX}/${BEST_JDK_FOUND}${BOOT_JDK_SUFFIX}"
+    if test -d "$BOOT_JDK"; then
+      BOOT_JDK_FOUND=maybe
+      { $as_echo "$as_me:${as_lineno-$LINENO}: Found potential Boot JDK using well-known locations (in $BOOT_JDK_PREFIX)" >&5
+$as_echo "$as_me: Found potential Boot JDK using well-known locations (in $BOOT_JDK_PREFIX)" >&6;}
+    fi
+  fi
+
+  fi
+
+
+    # If previous step claimed to have found a JDK, check it to see if it seems to be valid.
+    if test "x$BOOT_JDK_FOUND" = xmaybe; then
+      # Do we have a bin/java?
+      if test ! -x "$BOOT_JDK/bin/java"; then
+        { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK did not contain bin/java; ignoring" >&5
+$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK did not contain bin/java; ignoring" >&6;}
+        BOOT_JDK_FOUND=no
+      else
+        # Do we have a bin/javac?
+        if test ! -x "$BOOT_JDK/bin/javac"; then
+          { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK did not contain bin/javac; ignoring" >&5
+$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK did not contain bin/javac; ignoring" >&6;}
+          { $as_echo "$as_me:${as_lineno-$LINENO}: (This might be an JRE instead of an JDK)" >&5
+$as_echo "$as_me: (This might be an JRE instead of an JDK)" >&6;}
+          BOOT_JDK_FOUND=no
+        else
+          # Do we have an rt.jar? (On MacOSX it is called classes.jar)
+          if test ! -f "$BOOT_JDK/jre/lib/rt.jar" && test ! -f "$BOOT_JDK/../Classes/classes.jar"; then
+            { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK did not contain an rt.jar; ignoring" >&5
+$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK did not contain an rt.jar; ignoring" >&6;}
+            BOOT_JDK_FOUND=no
+          else
+            # Oh, this is looking good! We probably have found a proper JDK. Is it the correct version?
+            BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | head -n 1`
+
+            # Extra M4 quote needed to protect [] in grep expression.
+            FOUND_VERSION_78=`echo $BOOT_JDK_VERSION | grep  '\"1\.[78]\.'`
+            if test "x$FOUND_VERSION_78" = x; then
+              { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5
+$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;}
+              { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 7 or 8)" >&5
+$as_echo "$as_me: (Your Boot JDK must be version 7 or 8)" >&6;}
+              BOOT_JDK_FOUND=no
+            else
+              # We're done! :-)
+              BOOT_JDK_FOUND=yes
+
+    # Fail with message the path to the Boot JDK if var BOOT_JDK contains a path with no spaces in it.
+    # Unless on Windows, where we can rewrite the path.
+    HAS_SPACE=`echo "$BOOT_JDK" | grep " "`
+    if test "x$HAS_SPACE" != x; then
+        if test "x$OPENJDK_BUILD_OS" = "xwindows"; then
+            # First convert it to DOS-style, short mode (no spaces)
+            BOOT_JDK=`$CYGPATH -s -m -a "$BOOT_JDK"`
+            # Now it's case insensitive; let's make it lowercase to improve readability
+            BOOT_JDK=`$ECHO "$BOOT_JDK" | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvqxyz'`
+            # Now convert it back to Unix-stile (cygpath)
+            BOOT_JDK=`$CYGPATH -u "$BOOT_JDK"`
+        else
+            as_fn_error $? "You cannot have spaces in the path to the Boot JDK! \"$BOOT_JDK\"" "$LINENO" 5
+        fi
+    fi
+
+              { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Boot JDK" >&5
+$as_echo_n "checking for Boot JDK... " >&6; }
+              { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BOOT_JDK ($BOOT_JDK_VERSION)" >&5
+$as_echo "$BOOT_JDK ($BOOT_JDK_VERSION)" >&6; }
+            fi # end check jdk version
+          fi # end check rt.jar
+        fi # end check javac
+      fi # end check java
+    fi # end check boot jdk found
+  fi
+
+
+  if test "x$BOOT_JDK_FOUND" = xno; then
+    # Now execute the test
+
+  BOOT_JDK_PREFIX="/cygdrive/c/Program Files/Java"
+  BOOT_JDK_SUFFIX=""
+  BEST_JDK_FOUND=`$LS "$BOOT_JDK_PREFIX" 2> /dev/null | $GREP jdk | $SORT -r | $HEAD -n 1 `
+  if test "x$BEST_JDK_FOUND" != x; then
+    BOOT_JDK="${BOOT_JDK_PREFIX}/${BEST_JDK_FOUND}${BOOT_JDK_SUFFIX}"
+    if test -d "$BOOT_JDK"; then
+      BOOT_JDK_FOUND=maybe
+      { $as_echo "$as_me:${as_lineno-$LINENO}: Found potential Boot JDK using well-known locations (in $BOOT_JDK_PREFIX)" >&5
+$as_echo "$as_me: Found potential Boot JDK using well-known locations (in $BOOT_JDK_PREFIX)" >&6;}
+    fi
+  fi
+
+
+    # If previous step claimed to have found a JDK, check it to see if it seems to be valid.
+    if test "x$BOOT_JDK_FOUND" = xmaybe; then
+      # Do we have a bin/java?
+      if test ! -x "$BOOT_JDK/bin/java"; then
+        { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK did not contain bin/java; ignoring" >&5
+$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK did not contain bin/java; ignoring" >&6;}
+        BOOT_JDK_FOUND=no
+      else
+        # Do we have a bin/javac?
+        if test ! -x "$BOOT_JDK/bin/javac"; then
+          { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK did not contain bin/javac; ignoring" >&5
+$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK did not contain bin/javac; ignoring" >&6;}
+          { $as_echo "$as_me:${as_lineno-$LINENO}: (This might be an JRE instead of an JDK)" >&5
+$as_echo "$as_me: (This might be an JRE instead of an JDK)" >&6;}
+          BOOT_JDK_FOUND=no
+        else
+          # Do we have an rt.jar? (On MacOSX it is called classes.jar)
+          if test ! -f "$BOOT_JDK/jre/lib/rt.jar" && test ! -f "$BOOT_JDK/../Classes/classes.jar"; then
+            { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK did not contain an rt.jar; ignoring" >&5
+$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK did not contain an rt.jar; ignoring" >&6;}
+            BOOT_JDK_FOUND=no
+          else
+            # Oh, this is looking good! We probably have found a proper JDK. Is it the correct version?
+            BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | head -n 1`
+
+            # Extra M4 quote needed to protect [] in grep expression.
+            FOUND_VERSION_78=`echo $BOOT_JDK_VERSION | grep  '\"1\.[78]\.'`
+            if test "x$FOUND_VERSION_78" = x; then
+              { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5
+$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;}
+              { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 7 or 8)" >&5
+$as_echo "$as_me: (Your Boot JDK must be version 7 or 8)" >&6;}
+              BOOT_JDK_FOUND=no
+            else
+              # We're done! :-)
+              BOOT_JDK_FOUND=yes
+
+    # Fail with message the path to the Boot JDK if var BOOT_JDK contains a path with no spaces in it.
+    # Unless on Windows, where we can rewrite the path.
+    HAS_SPACE=`echo "$BOOT_JDK" | grep " "`
+    if test "x$HAS_SPACE" != x; then
+        if test "x$OPENJDK_BUILD_OS" = "xwindows"; then
+            # First convert it to DOS-style, short mode (no spaces)
+            BOOT_JDK=`$CYGPATH -s -m -a "$BOOT_JDK"`
+            # Now it's case insensitive; let's make it lowercase to improve readability
+            BOOT_JDK=`$ECHO "$BOOT_JDK" | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvqxyz'`
+            # Now convert it back to Unix-stile (cygpath)
+            BOOT_JDK=`$CYGPATH -u "$BOOT_JDK"`
+        else
+            as_fn_error $? "You cannot have spaces in the path to the Boot JDK! \"$BOOT_JDK\"" "$LINENO" 5
+        fi
+    fi
+
+              { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Boot JDK" >&5
+$as_echo_n "checking for Boot JDK... " >&6; }
+              { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BOOT_JDK ($BOOT_JDK_VERSION)" >&5
+$as_echo "$BOOT_JDK ($BOOT_JDK_VERSION)" >&6; }
+            fi # end check jdk version
+          fi # end check rt.jar
+        fi # end check javac
+      fi # end check java
+    fi # end check boot jdk found
+  fi
+
+  elif test "x$OPENJDK_TARGET_OS" = xmacosx; then
+
+  if test "x$BOOT_JDK_FOUND" = xno; then
+    # Now execute the test
+
+  BOOT_JDK_PREFIX="/Library/Java/JavaVirtualMachines"
+  BOOT_JDK_SUFFIX="/Contents/Home"
+  BEST_JDK_FOUND=`$LS "$BOOT_JDK_PREFIX" 2> /dev/null | $GREP jdk | $SORT -r | $HEAD -n 1 `
+  if test "x$BEST_JDK_FOUND" != x; then
+    BOOT_JDK="${BOOT_JDK_PREFIX}/${BEST_JDK_FOUND}${BOOT_JDK_SUFFIX}"
+    if test -d "$BOOT_JDK"; then
+      BOOT_JDK_FOUND=maybe
+      { $as_echo "$as_me:${as_lineno-$LINENO}: Found potential Boot JDK using well-known locations (in $BOOT_JDK_PREFIX)" >&5
+$as_echo "$as_me: Found potential Boot JDK using well-known locations (in $BOOT_JDK_PREFIX)" >&6;}
+    fi
+  fi
+
+
+    # If previous step claimed to have found a JDK, check it to see if it seems to be valid.
+    if test "x$BOOT_JDK_FOUND" = xmaybe; then
+      # Do we have a bin/java?
+      if test ! -x "$BOOT_JDK/bin/java"; then
+        { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK did not contain bin/java; ignoring" >&5
+$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK did not contain bin/java; ignoring" >&6;}
+        BOOT_JDK_FOUND=no
+      else
+        # Do we have a bin/javac?
+        if test ! -x "$BOOT_JDK/bin/javac"; then
+          { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK did not contain bin/javac; ignoring" >&5
+$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK did not contain bin/javac; ignoring" >&6;}
+          { $as_echo "$as_me:${as_lineno-$LINENO}: (This might be an JRE instead of an JDK)" >&5
+$as_echo "$as_me: (This might be an JRE instead of an JDK)" >&6;}
+          BOOT_JDK_FOUND=no
+        else
+          # Do we have an rt.jar? (On MacOSX it is called classes.jar)
+          if test ! -f "$BOOT_JDK/jre/lib/rt.jar" && test ! -f "$BOOT_JDK/../Classes/classes.jar"; then
+            { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK did not contain an rt.jar; ignoring" >&5
+$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK did not contain an rt.jar; ignoring" >&6;}
+            BOOT_JDK_FOUND=no
+          else
+            # Oh, this is looking good! We probably have found a proper JDK. Is it the correct version?
+            BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | head -n 1`
+
+            # Extra M4 quote needed to protect [] in grep expression.
+            FOUND_VERSION_78=`echo $BOOT_JDK_VERSION | grep  '\"1\.[78]\.'`
+            if test "x$FOUND_VERSION_78" = x; then
+              { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5
+$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;}
+              { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 7 or 8)" >&5
+$as_echo "$as_me: (Your Boot JDK must be version 7 or 8)" >&6;}
+              BOOT_JDK_FOUND=no
+            else
+              # We're done! :-)
+              BOOT_JDK_FOUND=yes
+
+    # Fail with message the path to the Boot JDK if var BOOT_JDK contains a path with no spaces in it.
+    # Unless on Windows, where we can rewrite the path.
+    HAS_SPACE=`echo "$BOOT_JDK" | grep " "`
+    if test "x$HAS_SPACE" != x; then
+        if test "x$OPENJDK_BUILD_OS" = "xwindows"; then
+            # First convert it to DOS-style, short mode (no spaces)
+            BOOT_JDK=`$CYGPATH -s -m -a "$BOOT_JDK"`
+            # Now it's case insensitive; let's make it lowercase to improve readability
+            BOOT_JDK=`$ECHO "$BOOT_JDK" | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvqxyz'`
+            # Now convert it back to Unix-stile (cygpath)
+            BOOT_JDK=`$CYGPATH -u "$BOOT_JDK"`
+        else
+            as_fn_error $? "You cannot have spaces in the path to the Boot JDK! \"$BOOT_JDK\"" "$LINENO" 5
+        fi
+    fi
+
+              { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Boot JDK" >&5
+$as_echo_n "checking for Boot JDK... " >&6; }
+              { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BOOT_JDK ($BOOT_JDK_VERSION)" >&5
+$as_echo "$BOOT_JDK ($BOOT_JDK_VERSION)" >&6; }
+            fi # end check jdk version
+          fi # end check rt.jar
+        fi # end check javac
+      fi # end check java
+    fi # end check boot jdk found
+  fi
+
+
+  if test "x$BOOT_JDK_FOUND" = xno; then
+    # Now execute the test
+
+  BOOT_JDK_PREFIX="/System/Library/Java/JavaVirtualMachines"
+  BOOT_JDK_SUFFIX="/Contents/Home"
+  BEST_JDK_FOUND=`$LS "$BOOT_JDK_PREFIX" 2> /dev/null | $GREP jdk | $SORT -r | $HEAD -n 1 `
+  if test "x$BEST_JDK_FOUND" != x; then
+    BOOT_JDK="${BOOT_JDK_PREFIX}/${BEST_JDK_FOUND}${BOOT_JDK_SUFFIX}"
+    if test -d "$BOOT_JDK"; then
+      BOOT_JDK_FOUND=maybe
+      { $as_echo "$as_me:${as_lineno-$LINENO}: Found potential Boot JDK using well-known locations (in $BOOT_JDK_PREFIX)" >&5
+$as_echo "$as_me: Found potential Boot JDK using well-known locations (in $BOOT_JDK_PREFIX)" >&6;}
+    fi
+  fi
+
+
+    # If previous step claimed to have found a JDK, check it to see if it seems to be valid.
+    if test "x$BOOT_JDK_FOUND" = xmaybe; then
+      # Do we have a bin/java?
+      if test ! -x "$BOOT_JDK/bin/java"; then
+        { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK did not contain bin/java; ignoring" >&5
+$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK did not contain bin/java; ignoring" >&6;}
+        BOOT_JDK_FOUND=no
+      else
+        # Do we have a bin/javac?
+        if test ! -x "$BOOT_JDK/bin/javac"; then
+          { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK did not contain bin/javac; ignoring" >&5
+$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK did not contain bin/javac; ignoring" >&6;}
+          { $as_echo "$as_me:${as_lineno-$LINENO}: (This might be an JRE instead of an JDK)" >&5
+$as_echo "$as_me: (This might be an JRE instead of an JDK)" >&6;}
+          BOOT_JDK_FOUND=no
+        else
+          # Do we have an rt.jar? (On MacOSX it is called classes.jar)
+          if test ! -f "$BOOT_JDK/jre/lib/rt.jar" && test ! -f "$BOOT_JDK/../Classes/classes.jar"; then
+            { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK did not contain an rt.jar; ignoring" >&5
+$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK did not contain an rt.jar; ignoring" >&6;}
+            BOOT_JDK_FOUND=no
+          else
+            # Oh, this is looking good! We probably have found a proper JDK. Is it the correct version?
+            BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | head -n 1`
+
+            # Extra M4 quote needed to protect [] in grep expression.
+            FOUND_VERSION_78=`echo $BOOT_JDK_VERSION | grep  '\"1\.[78]\.'`
+            if test "x$FOUND_VERSION_78" = x; then
+              { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5
+$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;}
+              { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 7 or 8)" >&5
+$as_echo "$as_me: (Your Boot JDK must be version 7 or 8)" >&6;}
+              BOOT_JDK_FOUND=no
+            else
+              # We're done! :-)
+              BOOT_JDK_FOUND=yes
+
+    # Fail with message the path to the Boot JDK if var BOOT_JDK contains a path with no spaces in it.
+    # Unless on Windows, where we can rewrite the path.
+    HAS_SPACE=`echo "$BOOT_JDK" | grep " "`
+    if test "x$HAS_SPACE" != x; then
+        if test "x$OPENJDK_BUILD_OS" = "xwindows"; then
+            # First convert it to DOS-style, short mode (no spaces)
+            BOOT_JDK=`$CYGPATH -s -m -a "$BOOT_JDK"`
+            # Now it's case insensitive; let's make it lowercase to improve readability
+            BOOT_JDK=`$ECHO "$BOOT_JDK" | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvqxyz'`
+            # Now convert it back to Unix-stile (cygpath)
+            BOOT_JDK=`$CYGPATH -u "$BOOT_JDK"`
+        else
+            as_fn_error $? "You cannot have spaces in the path to the Boot JDK! \"$BOOT_JDK\"" "$LINENO" 5
+        fi
+    fi
+
+              { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Boot JDK" >&5
+$as_echo_n "checking for Boot JDK... " >&6; }
+              { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BOOT_JDK ($BOOT_JDK_VERSION)" >&5
+$as_echo "$BOOT_JDK ($BOOT_JDK_VERSION)" >&6; }
+            fi # end check jdk version
+          fi # end check rt.jar
+        fi # end check javac
+      fi # end check java
+    fi # end check boot jdk found
+  fi
+
+  fi
+
+
+    # If previous step claimed to have found a JDK, check it to see if it seems to be valid.
+    if test "x$BOOT_JDK_FOUND" = xmaybe; then
+      # Do we have a bin/java?
+      if test ! -x "$BOOT_JDK/bin/java"; then
+        { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK did not contain bin/java; ignoring" >&5
+$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK did not contain bin/java; ignoring" >&6;}
+        BOOT_JDK_FOUND=no
+      else
+        # Do we have a bin/javac?
+        if test ! -x "$BOOT_JDK/bin/javac"; then
+          { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK did not contain bin/javac; ignoring" >&5
+$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK did not contain bin/javac; ignoring" >&6;}
+          { $as_echo "$as_me:${as_lineno-$LINENO}: (This might be an JRE instead of an JDK)" >&5
+$as_echo "$as_me: (This might be an JRE instead of an JDK)" >&6;}
+          BOOT_JDK_FOUND=no
+        else
+          # Do we have an rt.jar? (On MacOSX it is called classes.jar)
+          if test ! -f "$BOOT_JDK/jre/lib/rt.jar" && test ! -f "$BOOT_JDK/../Classes/classes.jar"; then
+            { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK did not contain an rt.jar; ignoring" >&5
+$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK did not contain an rt.jar; ignoring" >&6;}
+            BOOT_JDK_FOUND=no
+          else
+            # Oh, this is looking good! We probably have found a proper JDK. Is it the correct version?
+            BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | head -n 1`
+
+            # Extra M4 quote needed to protect [] in grep expression.
+            FOUND_VERSION_78=`echo $BOOT_JDK_VERSION | grep  '\"1\.[78]\.'`
+            if test "x$FOUND_VERSION_78" = x; then
+              { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5
+$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;}
+              { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 7 or 8)" >&5
+$as_echo "$as_me: (Your Boot JDK must be version 7 or 8)" >&6;}
+              BOOT_JDK_FOUND=no
+            else
+              # We're done! :-)
+              BOOT_JDK_FOUND=yes
+
+    # Fail with message the path to the Boot JDK if var BOOT_JDK contains a path with no spaces in it.
+    # Unless on Windows, where we can rewrite the path.
+    HAS_SPACE=`echo "$BOOT_JDK" | grep " "`
+    if test "x$HAS_SPACE" != x; then
+        if test "x$OPENJDK_BUILD_OS" = "xwindows"; then
+            # First convert it to DOS-style, short mode (no spaces)
+            BOOT_JDK=`$CYGPATH -s -m -a "$BOOT_JDK"`
+            # Now it's case insensitive; let's make it lowercase to improve readability
+            BOOT_JDK=`$ECHO "$BOOT_JDK" | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvqxyz'`
+            # Now convert it back to Unix-stile (cygpath)
+            BOOT_JDK=`$CYGPATH -u "$BOOT_JDK"`
+        else
+            as_fn_error $? "You cannot have spaces in the path to the Boot JDK! \"$BOOT_JDK\"" "$LINENO" 5
+        fi
+    fi
+
+              { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Boot JDK" >&5
+$as_echo_n "checking for Boot JDK... " >&6; }
+              { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BOOT_JDK ($BOOT_JDK_VERSION)" >&5
+$as_echo "$BOOT_JDK ($BOOT_JDK_VERSION)" >&6; }
+            fi # end check jdk version
+          fi # end check rt.jar
+        fi # end check javac
+      fi # end check java
+    fi # end check boot jdk found
+  fi
+
+
+# If we haven't found anything yet, we've truly lost. Give up.
 if test "x$BOOT_JDK_FOUND" = xno; then
-    # Extract the first word of "java", so it can be a program name with args.
-set dummy java; 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_JAVA_CHECK+set}" = set; then :
-  $as_echo_n "(cached) " >&6
-else
-  case $JAVA_CHECK in
-  [\\/]* | ?:[\\/]*)
-  ac_cv_path_JAVA_CHECK="$JAVA_CHECK" # 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_JAVA_CHECK="$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
-JAVA_CHECK=$ac_cv_path_JAVA_CHECK
-if test -n "$JAVA_CHECK"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $JAVA_CHECK" >&5
-$as_echo "$JAVA_CHECK" >&6; }
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-
-    if test "x$JAVA_CHECK" != x; then
-        # There is a java in the path. But apparently we have not found a javac
-        # in the path, since that would have been tested earlier.
-        if test "x$OPENJDK_TARGET_OS" = xwindows; then
-            # Now if this is a windows platform. The default installation of a JDK
-            # actually puts the JRE in the path and keeps the JDK out of the path!
-            # Go look in the default installation location.
-            BOOT_JDK=/cygdrive/c/Program\ Files/Java/`ls /cygdrive/c/Program\ Files/Java | grep jdk | sort -r | head --lines 1`
-            if test -d "$BOOT_JDK"; then
-                BOOT_JDK_FOUND=yes
-            fi
-        fi
-        if test "x$BOOT_JDK_FOUND" = xno; then
-
-    # Print a helpful message on how to acquire the necessary build dependency.
-    # openjdk is the help tag: freetyp2, cups, pulse, alsa etc
-    MISSING_DEPENDENCY=openjdk
-    PKGHANDLER_COMMAND=
-
-    case $PKGHANDLER in
-	apt-get)
-                apt_help     $MISSING_DEPENDENCY ;;
-    yum)
-                yum_help     $MISSING_DEPENDENCY ;;
-	port)
-                port_help    $MISSING_DEPENDENCY ;;
-	pkgutil)
-                pkgutil_help $MISSING_DEPENDENCY ;;
-	pkgadd)
-                pkgadd_help  $MISSING_DEPENDENCY ;;
-    * )
-      break ;;
-    esac
-
-    if test "x$PKGHANDLER_COMMAND" != x; then
-        HELP_MSG="You might be able to fix this by running '$PKGHANDLER_COMMAND'."
-    fi
-
-            { $as_echo "$as_me:${as_lineno-$LINENO}: Found a JRE, not not a JDK! Please remove the JRE from your path and put a JDK there instead. $HELP_MSG" >&5
-$as_echo "$as_me: Found a JRE, not not a JDK! Please remove the JRE from your path and put a JDK there instead. $HELP_MSG" >&6;}
-
-    { $as_echo "$as_me:${as_lineno-$LINENO}: This might be fixed by explicitely setting --with-boot-jdk" >&5
-$as_echo "$as_me: This might be fixed by explicitely setting --with-boot-jdk" >&6;}
-    as_fn_error $? "Cannot continue" "$LINENO" 5
-
-        fi
-    else
 
     # Print a helpful message on how to acquire the necessary build dependency.
     # openjdk is the help tag: freetyp2, cups, pulse, alsa etc
@@ -7935,270 +9923,135 @@
         HELP_MSG="You might be able to fix this by running '$PKGHANDLER_COMMAND'."
     fi
 
-        { $as_echo "$as_me:${as_lineno-$LINENO}: Could not find a JDK. $HELP_MSG" >&5
-$as_echo "$as_me: Could not find a JDK. $HELP_MSG" >&6;}
-
-    { $as_echo "$as_me:${as_lineno-$LINENO}: This might be fixed by explicitely setting --with-boot-jdk" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: Could not find a valid Boot JDK. $HELP_MSG" >&5
+$as_echo "$as_me: Could not find a valid Boot JDK. $HELP_MSG" >&6;}
+  { $as_echo "$as_me:${as_lineno-$LINENO}: This might be fixed by explicitely setting --with-boot-jdk" >&5
 $as_echo "$as_me: This might be fixed by explicitely setting --with-boot-jdk" >&6;}
-    as_fn_error $? "Cannot continue" "$LINENO" 5
-
-    fi
-fi
-
-
-    if test "x$OPENJDK_BUILD_OS" = "xwindows"; then
-        # Extract the first word of "cygpath", so it can be a program name with args.
-set dummy cygpath; 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_CYGPATH+set}" = set; then :
-  $as_echo_n "(cached) " >&6
-else
-  case $CYGPATH in
-  [\\/]* | ?:[\\/]*)
-  ac_cv_path_CYGPATH="$CYGPATH" # 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_CYGPATH="$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
-CYGPATH=$ac_cv_path_CYGPATH
-if test -n "$CYGPATH"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CYGPATH" >&5
-$as_echo "$CYGPATH" >&6; }
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-
-        tmp="$BOOT_JDK"
-        # Convert to C:/ mixed style path without spaces.
-        tmp=`$CYGPATH -s -m "$tmp"`
-        BOOT_JDK="$tmp"
-    fi
-
-
-# Now see if we can find the rt.jar, or its nearest equivalent.
+  as_fn_error $? "Cannot continue" "$LINENO" 5
+fi
+
+# Setup proper paths for what we found
 BOOT_RTJAR="$BOOT_JDK/jre/lib/rt.jar"
-
-    # Fail with message the path to the Boot JDK rt.jar (or nearest equivalent) if var BOOT_RTJAR contains a path with no spaces in it.
-    # Unless on Windows, where we can rewrite the path.
-    HAS_SPACE=`echo "$BOOT_RTJAR" | grep " "`
-    if test "x$HAS_SPACE" != x; then
-        if test "x$OPENJDK_BUILD_OS" = "xwindows"; then
-            BOOT_RTJAR=`$CYGPATH -s -m -a "$BOOT_RTJAR"`
-            BOOT_RTJAR=`$CYGPATH -u "$BOOT_RTJAR"`
-        else
-            as_fn_error $? "You cannot have spaces in the path to the Boot JDK rt.jar (or nearest equivalent)! \"$BOOT_RTJAR\"" "$LINENO" 5
-        fi
-    fi
-
-
+if test ! -f "$BOOT_RTJAR"; then
+    # On MacOSX it is called classes.jar
+    BOOT_RTJAR="$BOOT_JDK/../Classes/classes.jar"
+    if test -f "$BOOT_RTJAR"; then
+      # Remove the ..
+      BOOT_RTJAR="`cd ${BOOT_RTJAR%/*} && pwd`/${BOOT_RTJAR##*/}"
+    fi
+fi
 BOOT_TOOLSJAR="$BOOT_JDK/lib/tools.jar"
-
-    # Fail with message the path to the Boot JDK tools.jar (or nearest equivalent) if var BOOT_TOOLSJAR contains a path with no spaces in it.
-    # Unless on Windows, where we can rewrite the path.
-    HAS_SPACE=`echo "$BOOT_TOOLSJAR" | grep " "`
-    if test "x$HAS_SPACE" != x; then
-        if test "x$OPENJDK_BUILD_OS" = "xwindows"; then
-            BOOT_TOOLSJAR=`$CYGPATH -s -m -a "$BOOT_TOOLSJAR"`
-            BOOT_TOOLSJAR=`$CYGPATH -u "$BOOT_TOOLSJAR"`
-        else
-            as_fn_error $? "You cannot have spaces in the path to the Boot JDK tools.jar (or nearest equivalent)! \"$BOOT_TOOLSJAR\"" "$LINENO" 5
-        fi
-    fi
-
-
-if test ! -f $BOOT_RTJAR; then
-    # On MacOSX it is called classes.jar
-    BOOT_RTJAR=$BOOT_JDK/../Classes/classes.jar
-    if test ! -f $BOOT_RTJAR; then
-        { $as_echo "$as_me:${as_lineno-$LINENO}: Cannot find the rt.jar or its equivalent!" >&5
-$as_echo "$as_me: Cannot find the rt.jar or its equivalent!" >&6;}
-        { $as_echo "$as_me:${as_lineno-$LINENO}: This typically means that configure failed to automatically find a suitable Boot JDK" >&5
-$as_echo "$as_me: This typically means that configure failed to automatically find a suitable Boot JDK" >&6;}
-
-    { $as_echo "$as_me:${as_lineno-$LINENO}: This might be fixed by explicitely setting --with-boot-jdk" >&5
-$as_echo "$as_me: This might be fixed by explicitely setting --with-boot-jdk" >&6;}
-    as_fn_error $? "Cannot continue" "$LINENO" 5
-
-    fi
-    # Remove the ..
-    BOOT_RTJAR="`cd ${BOOT_RTJAR%/*} && pwd`/${BOOT_RTJAR##*/}"
-    # The tools.jar is part of classes.jar
-    BOOT_TOOLSJAR="$BOOT_RTJAR"
-fi
-
-
-
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for Boot JDK" >&5
-$as_echo_n "checking for Boot JDK... " >&6; }
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $BOOT_JDK" >&5
-$as_echo "$BOOT_JDK" >&6; }
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for Boot rt.jar" >&5
-$as_echo_n "checking for Boot rt.jar... " >&6; }
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $BOOT_RTJAR" >&5
-$as_echo "$BOOT_RTJAR" >&6; }
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for Boot tools.jar" >&5
-$as_echo_n "checking for Boot tools.jar... " >&6; }
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $BOOT_TOOLSJAR" >&5
-$as_echo "$BOOT_TOOLSJAR" >&6; }
-
-# Use the java tool from the Boot JDK.
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for java in Boot JDK" >&5
+BOOT_JDK="$BOOT_JDK"
+
+
+
+
+# Setup tools from the Boot JDK.
+
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for java in Boot JDK" >&5
 $as_echo_n "checking for java in Boot JDK... " >&6; }
-JAVA=$BOOT_JDK/bin/java
-if test ! -x $JAVA; then
-    { $as_echo "$as_me:${as_lineno-$LINENO}: Could not find a working java" >&5
-$as_echo "$as_me: Could not find a working java" >&6;}
-
-    { $as_echo "$as_me:${as_lineno-$LINENO}: This might be fixed by explicitely setting --with-boot-jdk" >&5
-$as_echo "$as_me: This might be fixed by explicitely setting --with-boot-jdk" >&6;}
-    as_fn_error $? "Cannot continue" "$LINENO" 5
-
-fi
-BOOT_JDK_VERSION=`$JAVA -version 2>&1 | head -n 1`
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes $BOOT_JDK_VERSION" >&5
-$as_echo "yes $BOOT_JDK_VERSION" >&6; }
-
-
-# Extra M4 quote needed to protect [] in grep expression.
-FOUND_VERSION_78=`echo $BOOT_JDK_VERSION | grep  '\"1\.[78]\.'`
-if test "x$FOUND_VERSION_78" = x; then
-
-    # Print a helpful message on how to acquire the necessary build dependency.
-    # openjdk is the help tag: freetyp2, cups, pulse, alsa etc
-    MISSING_DEPENDENCY=openjdk
-    PKGHANDLER_COMMAND=
-
-    case $PKGHANDLER in
-	apt-get)
-                apt_help     $MISSING_DEPENDENCY ;;
-    yum)
-                yum_help     $MISSING_DEPENDENCY ;;
-	port)
-                port_help    $MISSING_DEPENDENCY ;;
-	pkgutil)
-                pkgutil_help $MISSING_DEPENDENCY ;;
-	pkgadd)
-                pkgadd_help  $MISSING_DEPENDENCY ;;
-    * )
-      break ;;
-    esac
-
-    if test "x$PKGHANDLER_COMMAND" != x; then
-        HELP_MSG="You might be able to fix this by running '$PKGHANDLER_COMMAND'."
-    fi
-
-    { $as_echo "$as_me:${as_lineno-$LINENO}: Your boot-jdk must be version 7 or 8. $HELP_MSG" >&5
-$as_echo "$as_me: Your boot-jdk must be version 7 or 8. $HELP_MSG" >&6;}
-
-    { $as_echo "$as_me:${as_lineno-$LINENO}: This might be fixed by explicitely setting --with-boot-jdk" >&5
-$as_echo "$as_me: This might be fixed by explicitely setting --with-boot-jdk" >&6;}
-    as_fn_error $? "Cannot continue" "$LINENO" 5
-
-fi
+  JAVA=$BOOT_JDK/bin/java
+  if test ! -x $JAVA; then
+      { $as_echo "$as_me:${as_lineno-$LINENO}: result: not found" >&5
+$as_echo "not found" >&6; }
+      { $as_echo "$as_me:${as_lineno-$LINENO}: Your Boot JDK seems broken. This might be fixed by explicitely setting --with-boot-jdk" >&5
+$as_echo "$as_me: Your Boot JDK seems broken. This might be fixed by explicitely setting --with-boot-jdk" >&6;}
+      as_fn_error $? "Could not find java in the Boot JDK" "$LINENO" 5
+  fi
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: ok" >&5
+$as_echo "ok" >&6; }
+
+
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for javac in Boot JDK" >&5
+$as_echo_n "checking for javac in Boot JDK... " >&6; }
+  JAVAC=$BOOT_JDK/bin/javac
+  if test ! -x $JAVAC; then
+      { $as_echo "$as_me:${as_lineno-$LINENO}: result: not found" >&5
+$as_echo "not found" >&6; }
+      { $as_echo "$as_me:${as_lineno-$LINENO}: Your Boot JDK seems broken. This might be fixed by explicitely setting --with-boot-jdk" >&5
+$as_echo "$as_me: Your Boot JDK seems broken. This might be fixed by explicitely setting --with-boot-jdk" >&6;}
+      as_fn_error $? "Could not find javac in the Boot JDK" "$LINENO" 5
+  fi
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: ok" >&5
+$as_echo "ok" >&6; }
+
+
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for javah in Boot JDK" >&5
+$as_echo_n "checking for javah in Boot JDK... " >&6; }
+  JAVAH=$BOOT_JDK/bin/javah
+  if test ! -x $JAVAH; then
+      { $as_echo "$as_me:${as_lineno-$LINENO}: result: not found" >&5
+$as_echo "not found" >&6; }
+      { $as_echo "$as_me:${as_lineno-$LINENO}: Your Boot JDK seems broken. This might be fixed by explicitely setting --with-boot-jdk" >&5
+$as_echo "$as_me: Your Boot JDK seems broken. This might be fixed by explicitely setting --with-boot-jdk" >&6;}
+      as_fn_error $? "Could not find javah in the Boot JDK" "$LINENO" 5
+  fi
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: ok" >&5
+$as_echo "ok" >&6; }
+
+
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for javap in Boot JDK" >&5
+$as_echo_n "checking for javap in Boot JDK... " >&6; }
+  JAVAP=$BOOT_JDK/bin/javap
+  if test ! -x $JAVAP; then
+      { $as_echo "$as_me:${as_lineno-$LINENO}: result: not found" >&5
+$as_echo "not found" >&6; }
+      { $as_echo "$as_me:${as_lineno-$LINENO}: Your Boot JDK seems broken. This might be fixed by explicitely setting --with-boot-jdk" >&5
+$as_echo "$as_me: Your Boot JDK seems broken. This might be fixed by explicitely setting --with-boot-jdk" >&6;}
+      as_fn_error $? "Could not find javap in the Boot JDK" "$LINENO" 5
+  fi
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: ok" >&5
+$as_echo "ok" >&6; }
+
+
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for jar in Boot JDK" >&5
+$as_echo_n "checking for jar in Boot JDK... " >&6; }
+  JAR=$BOOT_JDK/bin/jar
+  if test ! -x $JAR; then
+      { $as_echo "$as_me:${as_lineno-$LINENO}: result: not found" >&5
+$as_echo "not found" >&6; }
+      { $as_echo "$as_me:${as_lineno-$LINENO}: Your Boot JDK seems broken. This might be fixed by explicitely setting --with-boot-jdk" >&5
+$as_echo "$as_me: Your Boot JDK seems broken. This might be fixed by explicitely setting --with-boot-jdk" >&6;}
+      as_fn_error $? "Could not find jar in the Boot JDK" "$LINENO" 5
+  fi
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: ok" >&5
+$as_echo "ok" >&6; }
+
+
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for rmic in Boot JDK" >&5
+$as_echo_n "checking for rmic in Boot JDK... " >&6; }
+  RMIC=$BOOT_JDK/bin/rmic
+  if test ! -x $RMIC; then
+      { $as_echo "$as_me:${as_lineno-$LINENO}: result: not found" >&5
+$as_echo "not found" >&6; }
+      { $as_echo "$as_me:${as_lineno-$LINENO}: Your Boot JDK seems broken. This might be fixed by explicitely setting --with-boot-jdk" >&5
+$as_echo "$as_me: Your Boot JDK seems broken. This might be fixed by explicitely setting --with-boot-jdk" >&6;}
+      as_fn_error $? "Could not find rmic in the Boot JDK" "$LINENO" 5
+  fi
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: ok" >&5
+$as_echo "ok" >&6; }
+
+
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for native2ascii in Boot JDK" >&5
+$as_echo_n "checking for native2ascii in Boot JDK... " >&6; }
+  NATIVE2ASCII=$BOOT_JDK/bin/native2ascii
+  if test ! -x $NATIVE2ASCII; then
+      { $as_echo "$as_me:${as_lineno-$LINENO}: result: not found" >&5
+$as_echo "not found" >&6; }
+      { $as_echo "$as_me:${as_lineno-$LINENO}: Your Boot JDK seems broken. This might be fixed by explicitely setting --with-boot-jdk" >&5
+$as_echo "$as_me: Your Boot JDK seems broken. This might be fixed by explicitely setting --with-boot-jdk" >&6;}
+      as_fn_error $? "Could not find native2ascii in the Boot JDK" "$LINENO" 5
+  fi
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: ok" >&5
+$as_echo "ok" >&6; }
+
+
+# Finally, set some other options...
 
 # When compiling code to be executed by the Boot JDK, force jdk7 compatibility.
 BOOT_JDK_SOURCETARGET="-source 7 -target 7"
 
 
-# Use the javac tool from the Boot JDK.
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for javac in Boot JDK" >&5
-$as_echo_n "checking for javac in Boot JDK... " >&6; }
-JAVAC=$BOOT_JDK/bin/javac
-if test ! -x $JAVAC; then
-    as_fn_error $? "Could not find a working javac" "$LINENO" 5
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-$as_echo "yes" >&6; }
-
-
-
-# Use the javah tool from the Boot JDK.
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for javah in Boot JDK" >&5
-$as_echo_n "checking for javah in Boot JDK... " >&6; }
-JAVAH=$BOOT_JDK/bin/javah
-if test ! -x $JAVAH; then
-    { $as_echo "$as_me:${as_lineno-$LINENO}: Could not find a working javah" >&5
-$as_echo "$as_me: Could not find a working javah" >&6;}
-
-    { $as_echo "$as_me:${as_lineno-$LINENO}: This might be fixed by explicitely setting --with-boot-jdk" >&5
-$as_echo "$as_me: This might be fixed by explicitely setting --with-boot-jdk" >&6;}
-    as_fn_error $? "Cannot continue" "$LINENO" 5
-
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-$as_echo "yes" >&6; }
-
-
-# Use the jar tool from the Boot JDK.
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for jar in Boot JDK" >&5
-$as_echo_n "checking for jar in Boot JDK... " >&6; }
-JAR=$BOOT_JDK/bin/jar
-if test ! -x $JAR; then
-    { $as_echo "$as_me:${as_lineno-$LINENO}: Could not find a working jar" >&5
-$as_echo "$as_me: Could not find a working jar" >&6;}
-
-    { $as_echo "$as_me:${as_lineno-$LINENO}: This might be fixed by explicitely setting --with-boot-jdk" >&5
-$as_echo "$as_me: This might be fixed by explicitely setting --with-boot-jdk" >&6;}
-    as_fn_error $? "Cannot continue" "$LINENO" 5
-
-fi
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-$as_echo "yes" >&6; }
-
-# Use the rmic tool from the Boot JDK.
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for rmic in Boot JDK" >&5
-$as_echo_n "checking for rmic in Boot JDK... " >&6; }
-RMIC=$BOOT_JDK/bin/rmic
-if test ! -x $RMIC; then
-    { $as_echo "$as_me:${as_lineno-$LINENO}: Could not find a working rmic" >&5
-$as_echo "$as_me: Could not find a working rmic" >&6;}
-
-    { $as_echo "$as_me:${as_lineno-$LINENO}: This might be fixed by explicitely setting --with-boot-jdk" >&5
-$as_echo "$as_me: This might be fixed by explicitely setting --with-boot-jdk" >&6;}
-    as_fn_error $? "Cannot continue" "$LINENO" 5
-
-fi
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-$as_echo "yes" >&6; }
-
-# Use the native2ascii tool from the Boot JDK.
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for native2ascii in Boot JDK" >&5
-$as_echo_n "checking for native2ascii in Boot JDK... " >&6; }
-NATIVE2ASCII=$BOOT_JDK/bin/native2ascii
-if test ! -x $NATIVE2ASCII; then
-    { $as_echo "$as_me:${as_lineno-$LINENO}: Could not find a working native2ascii" >&5
-$as_echo "$as_me: Could not find a working native2ascii" >&6;}
-
-    { $as_echo "$as_me:${as_lineno-$LINENO}: This might be fixed by explicitely setting --with-boot-jdk" >&5
-$as_echo "$as_me: This might be fixed by explicitely setting --with-boot-jdk" >&6;}
-    as_fn_error $? "Cannot continue" "$LINENO" 5
-
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-$as_echo "yes" >&6; }
-
 
 
 ##############################################################################
@@ -8573,33 +10426,10 @@
 
 
 
-LANGTOOLS_OUTPUTDIR="$OUTPUT_ROOT/langtools"
-CORBA_OUTPUTDIR="$OUTPUT_ROOT/corba"
-JAXP_OUTPUTDIR="$OUTPUT_ROOT/jaxp"
-JAXWS_OUTPUTDIR="$OUTPUT_ROOT/jaxws"
-HOTSPOT_OUTPUTDIR="$OUTPUT_ROOT/hotspot"
+BUILD_OUTPUT="$OUTPUT_ROOT"
+
+
 JDK_OUTPUTDIR="$OUTPUT_ROOT/jdk"
-IMAGES_OUTPUTDIR="$OUTPUT_ROOT/images"
-
-
-
-
-
-
-
-
-
-LANGTOOLS_DIST="$OUTPUT_ROOT/langtools/dist"
-CORBA_DIST="$OUTPUT_ROOT/corba/dist"
-JAXP_DIST="$OUTPUT_ROOT/jaxp/dist"
-JAXWS_DIST="$OUTPUT_ROOT/jaxws/dist"
-HOTSPOT_DIST="$OUTPUT_ROOT/hotspot/dist"
-
-
-
-
-
-
 
 
 ###############################################################################
@@ -8620,9 +10450,6 @@
 ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
 ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
 
-DEVKIT=
-SYS_ROOT=/
-
 
 # The option used to specify the target .o,.a or .so file.
 # When compiling, how to specify the to be created object file.
@@ -8645,6 +10472,61 @@
 # the set env variables into the spec file.
 SETUPDEVENV="# No special vars"
 if test "x$OPENJDK_BUILD_OS" = "xwindows"; then
+    # Store path to cygwin link.exe to help excluding it when searching for
+    # VS linker.
+    # Extract the first word of "link", so it can be a program name with args.
+set dummy link; 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_CYGWIN_LINK+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  case $CYGWIN_LINK in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_CYGWIN_LINK="$CYGWIN_LINK" # 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_CYGWIN_LINK="$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
+CYGWIN_LINK=$ac_cv_path_CYGWIN_LINK
+if test -n "$CYGWIN_LINK"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CYGWIN_LINK" >&5
+$as_echo "$CYGWIN_LINK" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking if the first found link.exe is actually the Cygwin link tool" >&5
+$as_echo_n "checking if the first found link.exe is actually the Cygwin link tool... " >&6; }
+    "$CYGWIN_LINK" --version > /dev/null
+    if test $? -eq 0 ; then
+      { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+    else
+      { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+      # This might be the VS linker. Don't exclude it later on.
+      CYGWIN_LINK=""
+    fi
+
     # If vcvarsall.bat has been run, then VCINSTALLDIR is set.
     if test "x$VCINSTALLDIR" != x; then
         # No further setup is needed. The build will happen from this kind
@@ -8675,12 +10557,12 @@
 $as_echo "no" >&6; }
             as_fn_error $? "Tried to find a VS installation using both $SEARCH_ROOT but failed. Please run \"c:\\cygwin\\bin\\bash.exe -l\" from a VS command prompt and then run configure/make from there." "$LINENO" 5
         fi
-        case "$LEGACY_OPENJDK_TARGET_CPU1" in
-          i?86)
+        case "$OPENJDK_TARGET_CPU" in
+          x86)
             VARSBAT_ARCH=x86
             ;;
-          *)
-            VARSBAT_ARCH=$LEGACY_OPENJDK_TARGET_CPU1
+          x86_64)
+            VARSBAT_ARCH=amd64
             ;;
         esac
         # Lets extract the variables that are set by vcvarsall.bat/vsvars32.bat/vsvars64.bat
@@ -8743,7 +10625,11 @@
     HAS_SPACE=`echo "$MSVCR100DLL" | grep " "`
     if test "x$HAS_SPACE" != x; then
         if test "x$OPENJDK_BUILD_OS" = "xwindows"; then
+            # First convert it to DOS-style, short mode (no spaces)
             MSVCR100DLL=`$CYGPATH -s -m -a "$MSVCR100DLL"`
+            # Now it's case insensitive; let's make it lowercase to improve readability
+            MSVCR100DLL=`$ECHO "$MSVCR100DLL" | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvqxyz'`
+            # Now convert it back to Unix-stile (cygpath)
             MSVCR100DLL=`$CYGPATH -u "$MSVCR100DLL"`
         else
             as_fn_error $? "You cannot have spaces in the path to msvcr100.dll! \"$MSVCR100DLL\"" "$LINENO" 5
@@ -8768,64 +10654,56 @@
 # Setting only --host, does not seem to be really supported.
 # Please set both --build and --host if you want to cross compile.
 
-DEFINE_CROSS_COMPILE_ARCH=""
-HOSTCC=""
-HOSTCXX=""
-HOSTLD=""
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if this is a cross compile" >&5
-$as_echo_n "checking if this is a cross compile... " >&6; }
-if test "x$OPENJDK_BUILD_SYSTEM" != "x$OPENJDK_TARGET_SYSTEM"; then
-    { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes, from $OPENJDK_BUILD_SYSTEM to $OPENJDK_TARGET_SYSTEM" >&5
-$as_echo "yes, from $OPENJDK_BUILD_SYSTEM to $OPENJDK_TARGET_SYSTEM" >&6; }
-    # We have detected a cross compile!
-    DEFINE_CROSS_COMPILE_ARCH="CROSS_COMPILE_ARCH:=$LEGACY_OPENJDK_TARGET_CPU1"
+if test "x$COMPILE_TYPE" = "xcross"; then
     # Now we to find a C/C++ compiler that can build executables for the build
     # platform. We can't use the AC_PROG_CC macro, since it can only be used
-    # once.
+    # once. Also, we need to do this before adding a tools dir to the path,
+    # otherwise we might pick up cross-compilers which don't use standard naming.
+    # Otherwise, we'll set the BUILD_tools to the native tools, but that'll have
+    # to wait until they are properly discovered.
     for ac_prog in cl cc gcc
 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_HOSTCC+set}" = set; then :
-  $as_echo_n "(cached) " >&6
-else
-  case $HOSTCC in
-  [\\/]* | ?:[\\/]*)
-  ac_cv_path_HOSTCC="$HOSTCC" # 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_HOSTCC="$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
-HOSTCC=$ac_cv_path_HOSTCC
-if test -n "$HOSTCC"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $HOSTCC" >&5
-$as_echo "$HOSTCC" >&6; }
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-
-  test -n "$HOSTCC" && break
+if test "${ac_cv_path_BUILD_CC+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  case $BUILD_CC in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_BUILD_CC="$BUILD_CC" # 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_BUILD_CC="$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
+BUILD_CC=$ac_cv_path_BUILD_CC
+if test -n "$BUILD_CC"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BUILD_CC" >&5
+$as_echo "$BUILD_CC" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+  test -n "$BUILD_CC" && break
 done
 
 
@@ -8833,9 +10711,9 @@
     # extract the full path to the binary and at the
     # same time maintain any arguments passed to it.
     # The command MUST exist in the path, or else!
-    tmp="$HOSTCC"
+    tmp="$BUILD_CC"
     car="${tmp%% *}"
-    tmp="$HOSTCC EOL"
+    tmp="$BUILD_CC EOL"
     cdr="${tmp#* }"
     # On windows we want paths without spaces.
     if test "x$OPENJDK_BUILD_OS" = "xwindows"; then
@@ -8866,9 +10744,9 @@
         car=`which $car`
     fi
     if test "x$cdr" != xEOL; then
-        HOSTCC="$car ${cdr% *}"
-    else
-        HOSTCC="$car"
+        BUILD_CC="$car ${cdr% *}"
+    else
+        BUILD_CC="$car"
     fi
 
     for ac_prog in cl CC g++
@@ -8877,43 +10755,43 @@
 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_HOSTCXX+set}" = set; then :
-  $as_echo_n "(cached) " >&6
-else
-  case $HOSTCXX in
-  [\\/]* | ?:[\\/]*)
-  ac_cv_path_HOSTCXX="$HOSTCXX" # 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_HOSTCXX="$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
-HOSTCXX=$ac_cv_path_HOSTCXX
-if test -n "$HOSTCXX"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $HOSTCXX" >&5
-$as_echo "$HOSTCXX" >&6; }
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-
-  test -n "$HOSTCXX" && break
+if test "${ac_cv_path_BUILD_CXX+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  case $BUILD_CXX in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_BUILD_CXX="$BUILD_CXX" # 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_BUILD_CXX="$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
+BUILD_CXX=$ac_cv_path_BUILD_CXX
+if test -n "$BUILD_CXX"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BUILD_CXX" >&5
+$as_echo "$BUILD_CXX" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+  test -n "$BUILD_CXX" && break
 done
 
 
@@ -8921,9 +10799,9 @@
     # extract the full path to the binary and at the
     # same time maintain any arguments passed to it.
     # The command MUST exist in the path, or else!
-    tmp="$HOSTCXX"
+    tmp="$BUILD_CXX"
     car="${tmp%% *}"
-    tmp="$HOSTCXX EOL"
+    tmp="$BUILD_CXX EOL"
     cdr="${tmp#* }"
     # On windows we want paths without spaces.
     if test "x$OPENJDK_BUILD_OS" = "xwindows"; then
@@ -8954,45 +10832,45 @@
         car=`which $car`
     fi
     if test "x$cdr" != xEOL; then
-        HOSTCXX="$car ${cdr% *}"
-    else
-        HOSTCXX="$car"
+        BUILD_CXX="$car ${cdr% *}"
+    else
+        BUILD_CXX="$car"
     fi
 
     # Extract the first word of "ld", so it can be a program name with args.
 set dummy ld; 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_HOSTLD+set}" = set; then :
-  $as_echo_n "(cached) " >&6
-else
-  case $HOSTLD in
-  [\\/]* | ?:[\\/]*)
-  ac_cv_path_HOSTLD="$HOSTLD" # 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_HOSTLD="$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
-HOSTLD=$ac_cv_path_HOSTLD
-if test -n "$HOSTLD"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $HOSTLD" >&5
-$as_echo "$HOSTLD" >&6; }
+if test "${ac_cv_path_BUILD_LD+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  case $BUILD_LD in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_BUILD_LD="$BUILD_LD" # 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_BUILD_LD="$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
+BUILD_LD=$ac_cv_path_BUILD_LD
+if test -n "$BUILD_LD"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BUILD_LD" >&5
+$as_echo "$BUILD_LD" >&6; }
 else
   { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
@@ -9004,9 +10882,9 @@
     # extract the full path to the binary and at the
     # same time maintain any arguments passed to it.
     # The command MUST exist in the path, or else!
-    tmp="$HOSTLD"
+    tmp="$BUILD_LD"
     car="${tmp%% *}"
-    tmp="$HOSTLD EOL"
+    tmp="$BUILD_LD EOL"
     cdr="${tmp#* }"
     # On windows we want paths without spaces.
     if test "x$OPENJDK_BUILD_OS" = "xwindows"; then
@@ -9037,34 +10915,20 @@
         car=`which $car`
     fi
     if test "x$cdr" != xEOL; then
-        HOSTLD="$car ${cdr% *}"
-    else
-        HOSTLD="$car"
-    fi
-
-    # Building for the build platform should be easy. Therefore
-    # we do not need any linkers or assemblers etc.
-else
-    { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-# You can force the sys-root if the sys-root encoded into the cross compiler tools
-# is not correct.
-
-# Check whether --with-sys-root was given.
-if test "${with_sys_root+set}" = set; then :
-  withval=$with_sys_root;
-fi
-
-
-if test "x$with_sys_root" != x; then
-    SYS_ROOT=$with_sys_root
-fi
+        BUILD_LD="$car ${cdr% *}"
+    else
+        BUILD_LD="$car"
+    fi
+
+fi
+
+
+
 
 # If a devkit is found on the builddeps server, then prepend its path to the
 # PATH variable. If there are cross compilers available in the devkit, these
 # will be found by AC_PROG_CC et al.
+DEVKIT=
 
 
     if test "x$with_builddeps_server" != x || test "x$with_builddeps_conf" != x; then
@@ -9232,29 +11096,6 @@
 ORG_CXXFLAGS="$CXXFLAGS"
 ORG_OBJCFLAGS="$OBJCFLAGS"
 
-
-# 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
-
-
-
-# Check whether --with-devkit was given.
-if test "${with_devkit+set}" = set; then :
-  withval=$with_devkit;
-    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
-
-
 # autoconf magic only relies on PATH, so update it if tools dir is specified
 OLD_PATH="$PATH"
 if test "x$TOOLS_DIR" != x; then
@@ -10578,152 +12419,11 @@
 CXXFLAGS="$ORG_CXXFLAGS"
 OBJCFLAGS="$ORG_OBJCFLAGS"
 
-# If we are not cross compiling, use the same compilers for
-# building the build platform executables.
-if test "x$DEFINE_CROSS_COMPILE_ARCH" = x; then
-    HOSTCC="$CC"
-    HOSTCXX="$CXX"
-fi
-
-if test -n "$ac_tool_prefix"; then
-  # Extract the first word of "${ac_tool_prefix}ld", so it can be a program name with args.
-set dummy ${ac_tool_prefix}ld; 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_prog_LD+set}" = set; then :
-  $as_echo_n "(cached) " >&6
-else
-  if test -n "$LD"; then
-  ac_cv_prog_LD="$LD" # Let the user override the test.
-else
-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_prog_LD="${ac_tool_prefix}ld"
-    $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
-
-fi
-fi
-LD=$ac_cv_prog_LD
-if test -n "$LD"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LD" >&5
-$as_echo "$LD" >&6; }
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-
-fi
-if test -z "$ac_cv_prog_LD"; then
-  ac_ct_LD=$LD
-  # Extract the first word of "ld", so it can be a program name with args.
-set dummy ld; 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_prog_ac_ct_LD+set}" = set; then :
-  $as_echo_n "(cached) " >&6
-else
-  if test -n "$ac_ct_LD"; then
-  ac_cv_prog_ac_ct_LD="$ac_ct_LD" # Let the user override the test.
-else
-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_prog_ac_ct_LD="ld"
-    $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
-
-fi
-fi
-ac_ct_LD=$ac_cv_prog_ac_ct_LD
-if test -n "$ac_ct_LD"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_LD" >&5
-$as_echo "$ac_ct_LD" >&6; }
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-  if test "x$ac_ct_LD" = x; then
-    LD=""
-  else
-    case $cross_compiling:$ac_tool_warned in
-yes:)
-{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
-$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
-ac_tool_warned=yes ;;
-esac
-    LD=$ac_ct_LD
-  fi
-else
-  LD="$ac_cv_prog_LD"
-fi
-
-
-    # Translate "gcc -E" into "`which gcc` -E" ie
-    # extract the full path to the binary and at the
-    # same time maintain any arguments passed to it.
-    # The command MUST exist in the path, or else!
-    tmp="$LD"
-    car="${tmp%% *}"
-    tmp="$LD EOL"
-    cdr="${tmp#* }"
-    # On windows we want paths without spaces.
-    if test "x$OPENJDK_BUILD_OS" = "xwindows"; then
-
-    # Translate long cygdrive or C:\sdfsf path
-    # into a short mixed mode path that has no
-    # spaces in it.
-    tmp="$car"
-
-    if test "x$OPENJDK_BUILD_OS" = "xwindows"; then
-        tmp=`$CYGPATH -u "$car"`
-        tmp=`which "$tmp"`
-        # If file exists with .exe appended, that's the real filename
-        # and cygpath needs that to convert to short style path.
-        if test -f "${tmp}.exe"; then
-           tmp="${tmp}.exe"
-        elif test -f "${tmp}.cmd"; then
-           tmp="${tmp}.cmd"
-        fi
-        # Convert to C:/ mixed style path without spaces.
-         tmp=`$CYGPATH -s -m "$tmp"`
-    fi
-    car="$tmp"
-
-    else
-        # "which" is not portable, but is used here
-        # because we know that the command exists!
-        car=`which $car`
-    fi
-    if test "x$cdr" != xEOL; then
-        LD="$car ${cdr% *}"
-    else
-        LD="$car"
-    fi
-
 LD="$CC"
 LDEXE="$CC"
 LDCXX="$CXX"
 LDEXECXX="$CXX"
+
 # LDEXE is the linker to use, when creating executables.
 
 # Linking C++ libraries.
@@ -10731,7 +12431,8 @@
 # Linking C++ executables.
 
 
-if test -n "$ac_tool_prefix"; then
+if test "x$OPENJDK_BUILD_OS" != xwindows; then
+    if test -n "$ac_tool_prefix"; then
   # Extract the first word of "${ac_tool_prefix}ar", so it can be a program name with args.
 set dummy ${ac_tool_prefix}ar; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
@@ -10866,6 +12567,7 @@
         AR="$car"
     fi
 
+fi
 if test "x$OPENJDK_BUILD_OS" = xmacosx; then
     ARFLAGS="-r"
 else
@@ -10882,7 +12584,7 @@
     EXE_OUT_OPTION=-out:
     LD_OUT_OPTION=-out:
     AR_OUT_OPTION=-out:
-    # On Windows, reject /usr/bin/link, which is a cygwin
+    # On Windows, reject /usr/bin/link (as determined in CYGWIN_LINK), which is a cygwin
     # program for something completely different.
     # Extract the first word of "link", so it can be a program name with args.
 set dummy link; ac_word=$2
@@ -10902,7 +12604,7 @@
   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
-    if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/bin/link"; then
+    if test "$as_dir/$ac_word$ac_exec_ext" = "$CYGWIN_LINK"; then
        ac_prog_rejected=yes
        continue
      fi
@@ -10961,13 +12663,22 @@
     fi
     WINLD="$tmp"
 
+    printf "Windows linker was found at $WINLD\n"
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking if the found link.exe is actually the Visual Studio linker" >&5
+$as_echo_n "checking if the found link.exe is actually the Visual Studio linker... " >&6; }
+    "$WINLD" --version > /dev/null
+    if test $? -eq 0 ; then
+      { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+      as_fn_error $? "This is the Cygwin link tool. Please check your PATH and rerun configure." "$LINENO" 5
+    else
+      { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+    fi
     LD="$WINLD"
     LDEXE="$WINLD"
     LDCXX="$WINLD"
     LDEXECXX="$WINLD"
-    # Set HOSTLD to same as LD until we fully support cross compilation
-    # on windows.
-    HOSTLD="$WINLD"
 
     # Extract the first word of "mt", so it can be a program name with args.
 set dummy mt; ac_word=$2
@@ -11627,6 +13338,16 @@
     fi
 
 
+if test "x$COMPILE_TYPE" != "xcross"; then
+    # If we are not cross compiling, use the same compilers for
+    # building the build platform executables. The cross-compilation
+    # case needed to be done earlier, but this can only be done after
+    # the native tools have been localized.
+    BUILD_CC="$CC"
+    BUILD_CXX="$CXX"
+    BUILD_LD="$LD"
+fi
+
 # for solaris we really need solaris tools, and not gnu equivalent
 #   these seems to normally reside in /usr/ccs/bin so add that to path before
 #   starting to probe
@@ -11722,17 +13443,16 @@
         AS="$car"
     fi
 
-    ASFLAGS=" "
 else
     AS="$CC -c"
-    ASFLAGS=" "
-fi
-
+fi
 
 
 if test "x$OPENJDK_BUILD_OS" = xsolaris; then
-    # Extract the first word of "nm", so it can be a program name with args.
-set dummy nm; ac_word=$2
+    for ac_prog in gnm nm
+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_NM+set}" = set; then :
@@ -11771,6 +13491,9 @@
 fi
 
 
+  test -n "$NM" && break
+done
+
 
     # Translate "gcc -E" into "`which gcc` -E" ie
     # extract the full path to the binary and at the
@@ -11980,7 +13703,7 @@
         MCS="$car"
     fi
 
-else
+elif test "x$OPENJDK_BUILD_OS" != xwindows; then
     if test -n "$ac_tool_prefix"; then
   # Extract the first word of "${ac_tool_prefix}nm", so it can be a program name with args.
 set dummy ${ac_tool_prefix}nm; ac_word=$2
@@ -12459,6 +14182,92 @@
 
 fi
 
+if test "x$OPENJDK_TARGET_OS" = "xmacosx"; then
+   # Extract the first word of "lipo", so it can be a program name with args.
+set dummy lipo; 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_LIPO+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  case $LIPO in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_LIPO="$LIPO" # 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_LIPO="$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
+LIPO=$ac_cv_path_LIPO
+if test -n "$LIPO"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LIPO" >&5
+$as_echo "$LIPO" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+
+    # Translate "gcc -E" into "`which gcc` -E" ie
+    # extract the full path to the binary and at the
+    # same time maintain any arguments passed to it.
+    # The command MUST exist in the path, or else!
+    tmp="$LIPO"
+    car="${tmp%% *}"
+    tmp="$LIPO EOL"
+    cdr="${tmp#* }"
+    # On windows we want paths without spaces.
+    if test "x$OPENJDK_BUILD_OS" = "xwindows"; then
+
+    # Translate long cygdrive or C:\sdfsf path
+    # into a short mixed mode path that has no
+    # spaces in it.
+    tmp="$car"
+
+    if test "x$OPENJDK_BUILD_OS" = "xwindows"; then
+        tmp=`$CYGPATH -u "$car"`
+        tmp=`which "$tmp"`
+        # If file exists with .exe appended, that's the real filename
+        # and cygpath needs that to convert to short style path.
+        if test -f "${tmp}.exe"; then
+           tmp="${tmp}.exe"
+        elif test -f "${tmp}.cmd"; then
+           tmp="${tmp}.cmd"
+        fi
+        # Convert to C:/ mixed style path without spaces.
+         tmp=`$CYGPATH -s -m "$tmp"`
+    fi
+    car="$tmp"
+
+    else
+        # "which" is not portable, but is used here
+        # because we know that the command exists!
+        car=`which $car`
+    fi
+    if test "x$cdr" != xEOL; then
+        LIPO="$car ${cdr% *}"
+    else
+        LIPO="$car"
+    fi
+
+fi
+
 # Restore old path without tools dir
 PATH="$OLD_PATH"
 
@@ -12604,16 +14413,71 @@
 # (The JVM can use 32 or 64 bit Java pointers but that decision
 # is made at runtime.)
 #
-ac_ext=cpp
-ac_cpp='$CXXCPP $CPPFLAGS'
-ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
-ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
-ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
-
-OLD_CXXFLAGS="$CXXFLAGS"
-if test "x$OPENJDK_TARGET_OS" != xwindows && test "x$with_target_bits" != x; then
-	CXXFLAGS="-m${with_target_bits} $CXXFLAGS"
-fi
+if test "x$OPENJDK_TARGET_OS" = xsolaris; then
+  # Always specify -m flags on Solaris
+
+  # keep track of c/cxx flags that we added outselves...
+  #   to prevent emitting warning...
+  ADDED_CFLAGS=" -m${OPENJDK_TARGET_CPU_BITS}"
+  ADDED_CXXFLAGS=" -m${OPENJDK_TARGET_CPU_BITS}"
+  ADDED_LDFLAGS=" -m${OPENJDK_TARGET_CPU_BITS}"
+
+  CFLAGS="${CFLAGS}${ADDED_CFLAGS}"
+  CXXFLAGS="${CXXFLAGS}${ADDED_CXXFLAGS}"
+  LDFLAGS="${LDFLAGS}${ADDED_LDFLAGS}"
+
+  CFLAGS_JDK="${CFLAGS_JDK}${ADDED_CFLAGS}"
+  CXXFLAGS_JDK="${CXXFLAGS_JDK}${ADDED_CXXFLAGS}"
+  LDFLAGS_JDK="${LDFLAGS_JDK}${ADDED_LDFLAGS}"
+
+elif test "x$COMPILE_TYPE" = xreduced; then
+  if test "x$OPENJDK_TARGET_OS" != xwindows; then
+    # Specify -m if running reduced on other Posix platforms
+
+  # keep track of c/cxx flags that we added outselves...
+  #   to prevent emitting warning...
+  ADDED_CFLAGS=" -m${OPENJDK_TARGET_CPU_BITS}"
+  ADDED_CXXFLAGS=" -m${OPENJDK_TARGET_CPU_BITS}"
+  ADDED_LDFLAGS=" -m${OPENJDK_TARGET_CPU_BITS}"
+
+  CFLAGS="${CFLAGS}${ADDED_CFLAGS}"
+  CXXFLAGS="${CXXFLAGS}${ADDED_CXXFLAGS}"
+  LDFLAGS="${LDFLAGS}${ADDED_LDFLAGS}"
+
+  CFLAGS_JDK="${CFLAGS_JDK}${ADDED_CFLAGS}"
+  CXXFLAGS_JDK="${CXXFLAGS_JDK}${ADDED_CXXFLAGS}"
+  LDFLAGS_JDK="${LDFLAGS_JDK}${ADDED_LDFLAGS}"
+
+  fi
+fi
+
+# Make compilation sanity check
+for ac_header in stdio.h
+do :
+  ac_fn_cxx_check_header_mongrel "$LINENO" "stdio.h" "ac_cv_header_stdio_h" "$ac_includes_default"
+if test "x$ac_cv_header_stdio_h" = x""yes; then :
+  cat >>confdefs.h <<_ACEOF
+#define HAVE_STDIO_H 1
+_ACEOF
+
+else
+
+  { $as_echo "$as_me:${as_lineno-$LINENO}: Failed to compile stdio.h. This likely implies missing compile dependencies." >&5
+$as_echo "$as_me: Failed to compile stdio.h. This likely implies missing compile dependencies." >&6;}
+  if test "x$COMPILE_TYPE" = xreduced; then
+    { $as_echo "$as_me:${as_lineno-$LINENO}: You are doing a reduced build. Check that you have 32-bit libraries installed." >&5
+$as_echo "$as_me: You are doing a reduced build. Check that you have 32-bit libraries installed." >&6;}
+  elif test "x$COMPILE_TYPE" = xcross; then
+    { $as_echo "$as_me:${as_lineno-$LINENO}: You are doing a cross-compilation. Check that you have all target platform libraries installed." >&5
+$as_echo "$as_me: You are doing a cross-compilation. Check that you have all target platform libraries installed." >&6;}
+  fi
+  as_fn_error $? "Cannot continue." "$LINENO" 5
+
+fi
+
+done
+
+
 # The cast to long int works around a bug in the HP C Compiler
 # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
 # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
@@ -12647,85 +14511,28 @@
 _ACEOF
 
 
-CXXFLAGS="$OLD_CXXFLAGS"
-ac_ext=cpp
-ac_cpp='$CXXCPP $CPPFLAGS'
-ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
-ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
-ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
-
-
-# keep track of c/cxx flags that we added outselves...
-#   to prevent emitting warning...
-ADDED_CFLAGS=
-ADDED_CXXFLAGS=
-ADDED_LDFLAGS=
-
-if test "x$ac_cv_sizeof_int_p" = x0; then
-    # The test failed, lets pick the assumed value.
-    ARCH_DATA_MODEL=$OPENJDK_TARGET_CPU_BITS
-else
-    ARCH_DATA_MODEL=`expr 8 \* $ac_cv_sizeof_int_p`
-
-    if test "x$OPENJDK_TARGET_OS" != xwindows && test "x$with_target_bits" != x; then
-       ADDED_CFLAGS=" -m${with_target_bits}"
-       ADDED_CXXFLAGS=" -m${with_target_bits}"
-       ADDED_LDFLAGS=" -m${with_target_bits}"
-
-       CFLAGS="${CFLAGS}${ADDED_CFLAGS}"
-       CXXFLAGS="${CXXFLAGS}${ADDED_CXXFLAGS}"
-       LDFLAGS="${LDFLAGS}${ADDED_LDFLAGS}"
-
-       CFLAGS_JDK="${CFLAGS_JDK}${ADDED_CFLAGS}"
-       CXXFLAGS_JDK="${CXXFLAGS_JDK}${ADDED_CXXFLAGS}"
-       LDFLAGS_JDK="${LDFLAGS_JDK}${ADDED_LDFLAGS}"
-    fi
-fi
-
-if test "x$ARCH_DATA_MODEL" = x64; then
-    A_LP64="LP64:="
-    ADD_LP64="-D_LP64=1"
-fi
+
+if test "x$SIZEOF_INT_P" != "x$ac_cv_sizeof_int_p"; then
+  # Workaround autoconf bug, see http://lists.gnu.org/archive/html/autoconf/2010-07/msg00004.html
+  SIZEOF_INT_P="$ac_cv_sizeof_int_p"
+fi
+
+if test "x$SIZEOF_INT_P" = x; then
+    # The test failed, lets stick to the assumed value.
+    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: The number of bits in the target could not be determined, using $OPENJDK_TARGET_CPU_BITS." >&5
+$as_echo "$as_me: WARNING: The number of bits in the target could not be determined, using $OPENJDK_TARGET_CPU_BITS." >&2;}
+else
+    TESTED_TARGET_CPU_BITS=`expr 8 \* $SIZEOF_INT_P`
+
+    if test "x$TESTED_TARGET_CPU_BITS" != "x$OPENJDK_TARGET_CPU_BITS"; then
+        as_fn_error $? "The tested number of bits in the target ($TESTED_TARGET_CPU_BITS) differs from the number of bits expected to be found in the target ($OPENJDK_TARGET_CPU_BITS)" "$LINENO" 5
+    fi
+fi
+
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for target address size" >&5
 $as_echo_n "checking for target address size... " >&6; }
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ARCH_DATA_MODEL bits" >&5
-$as_echo "$ARCH_DATA_MODEL bits" >&6; }
-LP64=$A_LP64
-
-
-
-if test "x$ARCH_DATA_MODEL" != "x$OPENJDK_TARGET_CPU_BITS"; then
-    as_fn_error $? "The tested number of bits in the target ($ARCH_DATA_MODEL) differs from the number of bits expected to be found in the target ($OPENJDK_TARGET_CPU_BITS)" "$LINENO" 5
-fi
-
-#
-# NOTE: check for -mstackrealign needs to be below potential addition of -m32
-#
-if test "x$OPENJDK_TARGET_CPU_BITS" = x32 && test "x$OPENJDK_TARGET_OS" = xmacosx; then
-    # On 32-bit MacOSX the OS requires C-entry points to be 16 byte aligned.
-    # While waiting for a better solution, the current workaround is to use -mstackrealign.
-    CFLAGS="$CFLAGS -mstackrealign"
-    { $as_echo "$as_me:${as_lineno-$LINENO}: checking if 32-bit compiler supports -mstackrealign" >&5
-$as_echo_n "checking if 32-bit compiler supports -mstackrealign... " >&6; }
-    cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-int main() { return 0; }
-_ACEOF
-if ac_fn_cxx_try_link "$LINENO"; then :
-
-		        { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-$as_echo "yes" >&6; }
-
-else
-
-		        { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-	                as_fn_error $? "The selected compiler $CXX does not support -mstackrealign! Try to put another compiler in the path." "$LINENO" 5
-
-fi
-rm -f core conftest.err conftest.$ac_objext \
-    conftest$ac_exeext conftest.$ac_ext
-fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $OPENJDK_TARGET_CPU_BITS bits" >&5
+$as_echo "$OPENJDK_TARGET_CPU_BITS bits" >&6; }
 
 
 ###############################################################################
@@ -12956,15 +14763,9 @@
 if test "x$ENDIAN" = xuniversal_endianness; then
     as_fn_error $? "Building with both big and little endianness is not supported" "$LINENO" 5
 fi
-if test "x$ENDIAN" = xunknown; then
-    ENDIAN="$OPENJDK_TARGET_CPU_ENDIAN"
-fi
 if test "x$ENDIAN" != "x$OPENJDK_TARGET_CPU_ENDIAN"; then
-    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: The tested endian in the target ($ENDIAN) differs from the endian expected to be found in the target ($OPENJDK_TARGET_CPU_ENDIAN)" >&5
-$as_echo "$as_me: WARNING: The tested endian in the target ($ENDIAN) differs from the endian expected to be found in the target ($OPENJDK_TARGET_CPU_ENDIAN)" >&2;}
-    ENDIAN="$OPENJDK_TARGET_CPU_ENDIAN"
-fi
-
+    as_fn_error $? "The tested endian in the target ($ENDIAN) differs from the endian expected to be found in the target ($OPENJDK_TARGET_CPU_ENDIAN)" "$LINENO" 5
+fi
 
 
 # Configure flags for the tools
@@ -12990,15 +14791,13 @@
     SET_SHARED_LIBRARY_MAPFILE='-Xlinker -version-script=$1'
     C_FLAG_REORDER=''
     CXX_FLAG_REORDER=''
-    SET_SHARED_LIBRARY_ORIGIN='-Xlinker -z -Xlinker origin -Xlinker -rpath -Xlinker \$$$$ORIGIN/$1'
+    SET_SHARED_LIBRARY_ORIGIN='-Xlinker -z -Xlinker origin -Xlinker -rpath -Xlinker \$$$$ORIGIN$1'
+    SET_EXECUTABLE_ORIGIN='-Xlinker -rpath -Xlinker \$$$$ORIGIN$1'
     LD="$CC"
     LDEXE="$CC"
     LDCXX="$CXX"
     LDEXECXX="$CXX"
     POST_STRIP_CMD="$STRIP -g"
-    if test "x$JDK_VARIANT" = xembedded; then
-        POST_STRIP_CMD="$STRIP --strip-unneeded"
-    fi
 
     # Linking is different on MacOSX
     if test "x$OPENJDK_BUILD_OS" = xmacosx; then
@@ -13011,6 +14810,7 @@
         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"
         POST_STRIP_CMD="$STRIP -S"
     fi
 else
@@ -13021,7 +14821,7 @@
         LIBRARY_PREFIX=lib
         SHARED_LIBRARY='lib$1.so'
         STATIC_LIBRARY='lib$1.a'
-        SHARED_LIBRARY_FLAGS="-z defs -xildoff -ztext -G"
+        SHARED_LIBRARY_FLAGS="-G"
         SHARED_LIBRARY_SUFFIX='.so'
         STATIC_LIBRARY_SUFFIX='.a'
         OBJ_SUFFIX='.o'
@@ -13030,7 +14830,8 @@
         SET_SHARED_LIBRARY_MAPFILE='-M$1'
 	C_FLAG_REORDER='-xF'
 	CXX_FLAG_REORDER='-xF'
-        SET_SHARED_LIBRARY_ORIGIN='-R \$$$$ORIGIN/$1'
+        SET_SHARED_LIBRARY_ORIGIN='-R\$$$$ORIGIN$1'
+        SET_EXECUTABLE_ORIGIN="$SET_SHARED_LIBRARY_ORIGIN"
         CFLAGS_JDK="${CFLAGS_JDK} -D__solaris__"
         CXXFLAGS_JDK="${CXXFLAGS_JDK} -D__solaris__"
         CFLAGS_JDKLIB_EXTRA='-xstrconst'
@@ -13052,8 +14853,10 @@
         SET_SHARED_LIBRARY_NAME=''
         SET_SHARED_LIBRARY_MAPFILE=''
         SET_SHARED_LIBRARY_ORIGIN=''
-    fi
-fi
+        SET_EXECUTABLE_ORIGIN=''
+    fi
+fi
+
 
 
 
@@ -13081,6 +14884,36 @@
 # Setup the opt flags for different compilers
 # and different operating systems.
 #
+
+#
+# NOTE: check for -mstackrealign needs to be below potential addition of -m32
+#
+if test "x$OPENJDK_TARGET_CPU_BITS" = x32 && test "x$OPENJDK_TARGET_OS" = xmacosx; then
+    # On 32-bit MacOSX the OS requires C-entry points to be 16 byte aligned.
+    # While waiting for a better solution, the current workaround is to use -mstackrealign.
+    CFLAGS="$CFLAGS -mstackrealign"
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking if 32-bit compiler supports -mstackrealign" >&5
+$as_echo_n "checking if 32-bit compiler supports -mstackrealign... " >&6; }
+    cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+int main() { return 0; }
+_ACEOF
+if ac_fn_cxx_try_link "$LINENO"; then :
+
+		        { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+
+else
+
+		        { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+	                as_fn_error $? "The selected compiler $CXX does not support -mstackrealign! Try to put another compiler in the path." "$LINENO" 5
+
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+fi
+
 C_FLAG_DEPS="-MMD -MF"
 CXX_FLAG_DEPS="-MMD -MF"
 
@@ -13105,7 +14938,7 @@
 	    CXXFLAGS_DEBUG_SYMBOLS="-g"
 	    if test "x$OPENJDK_TARGET_CPU_BITS" = "x64" && test "x$DEBUG_LEVEL" = "xfastdebug"; then
 	       CFLAGS_DEBUG_SYMBOLS="-g1"
-	       CXXFLAGS_DEBUG_SYMBOLSG="-g1"
+	       CXXFLAGS_DEBUG_SYMBOLS="-g1"
 	    fi
 	    ;;
 	esac
@@ -13117,52 +14950,56 @@
         #
         # Forte has different names for this with their C++ compiler...
         #
-	C_FLAG_DEPS="-xMMD -xMF"
-	CXX_FLAG_DEPS="-xMMD -xMF"
-
-# Extra options used with HIGHEST
-#
-# WARNING: Use of OPTIMIZATION_LEVEL=HIGHEST in your Makefile needs to be
-#          done with care, there are some assumptions below that need to
-#          be understood about the use of pointers, and IEEE behavior.
-#
-# Use non-standard floating point mode (not IEEE 754)
-CC_HIGHEST="$CC_HIGHEST -fns"
-# Do some simplification of floating point arithmetic (not IEEE 754)
-CC_HIGHEST="$CC_HIGHEST -fsimple"
-# 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
-#    pointer types are not recommended)
-CC_HIGHEST="$CC_HIGHEST -xalias_level=basic"
-# Use intrinsic or inline versions for math/std functions
-#   (If you expect perfect errno behavior, do not use this)
-CC_HIGHEST="$CC_HIGHEST -xbuiltin=%all"
-# Loop data dependency optimizations (need -xO3 or higher)
-CC_HIGHEST="$CC_HIGHEST -xdepend"
-# Pointer parameters to functions do not overlap
-#   (Similar to -xalias_level=basic usage, but less obvious sometimes.
-#    If you pass in multiple pointers to the same data, do not use this)
-CC_HIGHEST="$CC_HIGHEST -xrestrict"
-# Inline some library routines
-#   (If you expect perfect errno behavior, do not use this)
-CC_HIGHEST="$CC_HIGHEST -xlibmil"
-# Use optimized math routines
-#   (If you expect perfect errno behavior, do not use this)
-#  Can cause undefined external on Solaris 8 X86 on __sincos, removing for now
-#CC_HIGHEST="$CC_HIGHEST -xlibmopt"
-
-        case $LEGACY_OPENJDK_TARGET_CPU1 in
-          i586)
-            C_O_FLAG_HIGHEST="-xO4 -Wu,-O4~yz $CC_HIGHEST -xchip=pentium"
-            C_O_FLAG_HI="-xO4 -Wu,-O4~yz"
-            C_O_FLAG_NORM="-xO2 -Wu,-O2~yz"
-            C_O_FLAG_NONE=""
-            CXX_O_FLAG_HIGHEST="-xO4 -Qoption ube -O4~yz $CC_HIGHEST -xchip=pentium"
-            CXX_O_FLAG_HI="-xO4 -Qoption ube -O4~yz"
-            CXX_O_FLAG_NORM="-xO2 -Qoption ube -O2~yz"
-            CXX_O_FLAG_NONE=""
+        C_FLAG_DEPS="-xMMD -xMF"
+        CXX_FLAG_DEPS="-xMMD -xMF"
+
+        # Extra options used with HIGHEST
+        #
+        # WARNING: Use of OPTIMIZATION_LEVEL=HIGHEST in your Makefile needs to be
+        #          done with care, there are some assumptions below that need to
+        #          be understood about the use of pointers, and IEEE behavior.
+        #
+        # Use non-standard floating point mode (not IEEE 754)
+        CC_HIGHEST="$CC_HIGHEST -fns"
+        # Do some simplification of floating point arithmetic (not IEEE 754)
+        CC_HIGHEST="$CC_HIGHEST -fsimple"
+        # 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
+        #    pointer types are not recommended)
+        CC_HIGHEST="$CC_HIGHEST -xalias_level=basic"
+        # Use intrinsic or inline versions for math/std functions
+        #   (If you expect perfect errno behavior, do not use this)
+        CC_HIGHEST="$CC_HIGHEST -xbuiltin=%all"
+        # Loop data dependency optimizations (need -xO3 or higher)
+        CC_HIGHEST="$CC_HIGHEST -xdepend"
+        # Pointer parameters to functions do not overlap
+        #   (Similar to -xalias_level=basic usage, but less obvious sometimes.
+        #    If you pass in multiple pointers to the same data, do not use this)
+        CC_HIGHEST="$CC_HIGHEST -xrestrict"
+        # Inline some library routines
+        #   (If you expect perfect errno behavior, do not use this)
+        CC_HIGHEST="$CC_HIGHEST -xlibmil"
+        # Use optimized math routines
+        #   (If you expect perfect errno behavior, do not use this)
+        #  Can cause undefined external on Solaris 8 X86 on __sincos, removing for now
+        #CC_HIGHEST="$CC_HIGHEST -xlibmopt"
+
+        case $OPENJDK_TARGET_CPU_ARCH in
+          x86)
+            C_O_FLAG_HIGHEST="-xO4 -Wu,-O4~yz $CC_HIGHEST -xregs=no%frameptr"
+            C_O_FLAG_HI="-xO4 -Wu,-O4~yz -xregs=no%frameptr"
+            C_O_FLAG_NORM="-xO2 -Wu,-O2~yz -xregs=no%frameptr"
+            C_O_FLAG_NONE="-xregs=no%frameptr"
+            CXX_O_FLAG_HIGHEST="-xO4 -Qoption ube -O4~yz $CC_HIGHEST -xregs=no%frameptr"
+            CXX_O_FLAG_HI="-xO4 -Qoption ube -O4~yz -xregs=no%frameptr"
+            CXX_O_FLAG_NORM="-xO2 -Qoption ube -O2~yz -xregs=no%frameptr"
+            CXX_O_FLAG_NONE="-xregs=no%frameptr"
+            if test "x$OPENJDK_TARGET_CPU" = xx86; then
+               C_O_FLAG_HIGHEST="$C_O_FLAG_HIGHEST -xchip=pentium"
+               CXX_O_FLAG_HIGHEST="$CXX_O_FLAG_HIGHEST -xchip=pentium"
+            fi
             ;;
           sparc)
             CFLAGS_JDK="${CFLAGS_JDK} -xmemalign=4s"
@@ -13186,9 +15023,11 @@
     ;;
   CL )
     D_FLAG=
-    C_O_FLAG_HI="-O2"
+    C_O_FLAG_HIGHEST="-O2"
+    C_O_FLAG_HI="-O1"
     C_O_FLAG_NORM="-O1"
     C_O_FLAG_NONE="-Od"
+    CXX_O_FLAG_HIGHEST="$C_O_FLAG_HIGHEST"
     CXX_O_FLAG_HI="$C_O_FLAG_HI"
     CXX_O_FLAG_NORM="$C_O_FLAG_NORM"
     CXX_O_FLAG_NONE="$C_O_FLAG_NONE"
@@ -13217,18 +15056,18 @@
 
 
 if test "x$CFLAGS" != "x${ADDED_CFLAGS}"; then
-   { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Ignoring CFLAGS($CFLAGS) found in environment. Use --with-extra-cflags\"" >&5
-$as_echo "$as_me: WARNING: Ignoring CFLAGS($CFLAGS) found in environment. Use --with-extra-cflags\"" >&2;}
+   { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Ignoring CFLAGS($CFLAGS) found in environment. Use --with-extra-cflags" >&5
+$as_echo "$as_me: WARNING: Ignoring CFLAGS($CFLAGS) found in environment. Use --with-extra-cflags" >&2;}
 fi
 
 if test "x$CXXFLAGS" != "x${ADDED_CXXFLAGS}"; then
-   { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Ignoring CXXFLAGS($CXXFLAGS) found in environment. Use --with-extra-cxxflags\"" >&5
-$as_echo "$as_me: WARNING: Ignoring CXXFLAGS($CXXFLAGS) found in environment. Use --with-extra-cxxflags\"" >&2;}
+   { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Ignoring CXXFLAGS($CXXFLAGS) found in environment. Use --with-extra-cxxflags" >&5
+$as_echo "$as_me: WARNING: Ignoring CXXFLAGS($CXXFLAGS) found in environment. Use --with-extra-cxxflags" >&2;}
 fi
 
 if test "x$LDFLAGS" != "x${ADDED_LDFLAGS}"; then
-   { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Ignoring LDFLAGS($LDFLAGS) found in environment. Use --with-extra-ldflags\"" >&5
-$as_echo "$as_me: WARNING: Ignoring LDFLAGS($LDFLAGS) found in environment. Use --with-extra-ldflags\"" >&2;}
+   { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Ignoring LDFLAGS($LDFLAGS) found in environment. Use --with-extra-ldflags" >&5
+$as_echo "$as_me: WARNING: Ignoring LDFLAGS($LDFLAGS) found in environment. Use --with-extra-ldflags" >&2;}
 fi
 
 
@@ -13256,6 +15095,15 @@
 CXXFLAGS_JDK="${CXXFLAGS_JDK} $with_extra_cxxflags"
 LDFLAGS_JDK="${LDFLAGS_JDK} $with_extra_ldflags"
 
+# Hotspot needs these set in their legacy form
+LEGACY_EXTRA_CFLAGS=$with_extra_cflags
+LEGACY_EXTRA_CXXFLAGS=$with_extra_cxxflags
+LEGACY_EXTRA_LDFLAGS=$with_extra_ldflags
+
+
+
+
+
 ###############################################################################
 #
 # Now setup the CFLAGS and LDFLAGS for the JDK build.
@@ -13281,19 +15129,30 @@
 	  esac
           ;;
       ossc )
-      	  CFLAGS_JDK="$CFLAGS_JDK -xc99=%none -xCC -errshort=tags -Xa -v -mt -norunpath -xnolib"
-      	  CXXFLAGS_JDK="$CXXFLAGS_JDK -errtags=yes +w -mt -features=no%except -DCC_NOEX"
+          CCXXFLAGS_JDK="$CCXXFLAGS $CCXXFLAGS_JDK -DTRACING -DMACRO_MEMSYS_OPS -DBREAKPTS"
+          case $OPENJDK_TARGET_CPU_ARCH in
+          x86 )
+            CCXXFLAGS_JDK="$CCXXFLAGS_JDK -DcpuIntel -Di586 -Di386"
+       	    CFLAGS_JDK="$CFLAGS_JDK -erroff=E_BAD_PRAGMA_PACK_VALUE"
+          ;;
+          esac
+
+      	  CFLAGS_JDK="$CFLAGS_JDK -xc99=%none -xCC -errshort=tags -Xa -v -mt -W0,-noglobal"
+      	  CXXFLAGS_JDK="$CXXFLAGS_JDK -errtags=yes +w -mt -features=no%except -DCC_NOEX -norunpath -xnolib"
+
+          LDFLAGS_JDK="$LDFLAGS_JDK -z defs -xildoff -ztext"
+          LDFLAGS_CXX_JDK="$LDFLAGS_CXX_JDK -norunpath -xnolib"
           ;;
       cl )
           CCXXFLAGS_JDK="$CCXXFLAGS $CCXXFLAGS_JDK -Zi -MD -Zc:wchar_t- -W3 -wd4800 \
                -D_STATIC_CPPLIB -D_DISABLE_DEPRECATE_STATIC_CPPLIB -DWIN32_LEAN_AND_MEAN \
 	       -D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE \
 	       -DWIN32 -DIAL"
-          case $LEGACY_OPENJDK_TARGET_CPU1 in
-              i?86 )
+          case $OPENJDK_TARGET_CPU in
+              x86 )
                   CCXXFLAGS_JDK="$CCXXFLAGS_JDK -D_X86_ -Dx86"
                   ;;
-              amd64 )
+              x86_64 )
                   CCXXFLAGS_JDK="$CCXXFLAGS_JDK -D_AMD64_ -Damd64"
                   ;;
           esac
@@ -13301,24 +15160,6 @@
 esac
 
 ###############################################################################
-#
-# Cross-compile arch specific flags
-
-#
-if test "x$JDK_VARIANT" = "xembedded"; then
-   CCXXFLAGS_JDK="$CCXXFLAGS_JDK -DJAVASE_EMBEDDED"
-fi
-
-case $OPENJDK_TARGET_CPU_ARCH in
-arm )
-    CCXXFLAGS_JDK="$CCXXFLAGS_JDK -fsigned-char"
-    ;;
-ppc )
-    CCXXFLAGS_JDK="$CCXXFLAGS_JDK -fsigned-char"
-    ;;
-esac
-
-###############################################################################
 
 CCXXFLAGS_JDK="$CCXXFLAGS_JDK $ADD_LP64"
 
@@ -13326,11 +15167,17 @@
 PACKAGE_PATH=/opt/local
 
 
-# Sometimes we use a cpu dir (.../lib/amd64/server)
-# Sometimes not (.../lib/server)
-LIBARCHDIR="$LEGACY_OPENJDK_TARGET_CPU2/"
-if test "x$ENDIAN" = xlittle; then
-    CCXXFLAGS_JDK="$CCXXFLAGS_JDK -D_LITTLE_ENDIAN"
+if test "x$OPENJDK_TARGET_CPU_ENDIAN" = xlittle; then
+    # The macro _LITTLE_ENDIAN needs to be defined the same to avoid the
+    #   Sun C compiler warning message: warning: macro redefined: _LITTLE_ENDIAN
+    #   (The Solaris X86 system defines this in file /usr/include/sys/isa_defs.h).
+    #   Note: -Dmacro         is the same as    #define macro 1
+    #         -Dmacro=	    is the same as    #define macro
+    if test "x$OPENJDK_TARGET_OS" = xsolaris; then
+        CCXXFLAGS_JDK="$CCXXFLAGS_JDK -D_LITTLE_ENDIAN="
+    else
+        CCXXFLAGS_JDK="$CCXXFLAGS_JDK -D_LITTLE_ENDIAN"
+    fi
 else
     CCXXFLAGS_JDK="$CCXXFLAGS_JDK -D_BIG_ENDIAN"
 fi
@@ -13345,27 +15192,29 @@
 fi
 if test "x$OPENJDK_TARGET_OS" = xmacosx; then
     CCXXFLAGS_JDK="$CCXXFLAGS_JDK -DMACOSX -D_ALLBSD_SOURCE"
-    LIBARCHDIR=""
 fi
 if test "x$OPENJDK_TARGET_OS" = xbsd; then
     CCXXFLAGS_JDK="$CCXXFLAGS_JDK -DBSD -D_ALLBSD_SOURCE"
 fi
 if test "x$DEBUG_LEVEL" = xrelease; then
     CCXXFLAGS_JDK="$CCXXFLAGS_JDK -DNDEBUG"
+    if test "x$OPENJDK_TARGET_OS" = xsolaris; then
+        CCXXFLAGS_JDK="$CCXXFLAGS_JDK -DTRIMMED"
+    fi
 else
     CCXXFLAGS_JDK="$CCXXFLAGS_JDK -DDEBUG"
 fi
 
-CCXXFLAGS_JDK="$CCXXFLAGS_JDK -DARCH='\"$LEGACY_OPENJDK_TARGET_CPU1\"' -D$LEGACY_OPENJDK_TARGET_CPU1"
+CCXXFLAGS_JDK="$CCXXFLAGS_JDK -DARCH='\"$OPENJDK_TARGET_CPU_LEGACY\"' -D$OPENJDK_TARGET_CPU_LEGACY"
 CCXXFLAGS_JDK="$CCXXFLAGS_JDK -DRELEASE='\"$RELEASE\"'"
 
 CCXXFLAGS_JDK="$CCXXFLAGS_JDK \
         -I${JDK_OUTPUTDIR}/include \
         -I${JDK_OUTPUTDIR}/include/$OPENJDK_TARGET_OS \
         -I${JDK_TOPDIR}/src/share/javavm/export \
-        -I${JDK_TOPDIR}/src/$LEGACY_OPENJDK_TARGET_OS_API/javavm/export \
+        -I${JDK_TOPDIR}/src/$OPENJDK_TARGET_OS_API_DIR/javavm/export \
         -I${JDK_TOPDIR}/src/share/native/common \
-        -I${JDK_TOPDIR}/src/$LEGACY_OPENJDK_TARGET_OS_API/native/common"
+        -I${JDK_TOPDIR}/src/$OPENJDK_TARGET_OS_API_DIR/native/common"
 
 # The shared libraries are compiled using the picflag.
 CFLAGS_JDKLIB="$CCXXFLAGS_JDK $CFLAGS_JDK $PICFLAG $CFLAGS_JDKLIB_EXTRA"
@@ -13385,7 +15234,7 @@
 # Thus we offer the compiler to find libjvm.so first in server then in client. It works. Ugh.
 if test "x$COMPILER_TYPE" = xCL; then
     LDFLAGS_JDK="$LDFLAGS_JDK -nologo -opt:ref -incremental:no"
-    if test "x$LEGACY_OPENJDK_TARGET_CPU1" = xi586; then
+    if test "x$OPENJDK_TARGET_CPU" = xx86; then
         LDFLAGS_JDK="$LDFLAGS_JDK -safeseh"
     fi
     # TODO: make -debug optional "--disable-full-debug-symbols"
@@ -13413,20 +15262,18 @@
     fi
 
     LDFLAGS_JDKLIB="${LDFLAGS_JDK} $SHARED_LIBRARY_FLAGS \
-                    -L${JDK_OUTPUTDIR}/lib/${LIBARCHDIR}server \
-                    -L${JDK_OUTPUTDIR}/lib/${LIBARCHDIR}client \
-  	            -L${JDK_OUTPUTDIR}/lib/${LIBARCHDIR}"
-    LDFLAGS_JDKLIB_SUFFIX="-ljvm -ljava"
+                    -L${JDK_OUTPUTDIR}/lib${OPENJDK_TARGET_CPU_LIBDIR}/server \
+                    -L${JDK_OUTPUTDIR}/lib${OPENJDK_TARGET_CPU_LIBDIR}/client \
+                    -L${JDK_OUTPUTDIR}/lib${OPENJDK_TARGET_CPU_LIBDIR}"
+
+    LDFLAGS_JDKLIB_SUFFIX="-ljava -ljvm"
     if test "x$COMPILER_NAME" = xossc; then
         LDFLAGS_JDKLIB_SUFFIX="$LDFLAGS_JDKLIB_SUFFIX -lc"
     fi
 
-    # Only the jli library is explicitly linked when the launchers are built.
-    # The libjvm is then dynamically loaded/linked by the launcher.
     LDFLAGS_JDKEXE="${LDFLAGS_JDK}"
-    if test "x$OPENJDK_TARGET_OS" != "xmacosx"; then
-       LDFLAGS_JDKEXE="$LDFLAGS_JDKEXE -L${JDK_OUTPUTDIR}/lib/${LIBARCHDIR}jli"
-       LDFLAGS_JDKEXE_SUFFIX="-ljli"
+    if test "x$OPENJDK_TARGET_OS" = xlinux; then
+        LDFLAGS_JDKEXE="$LDFLAGS_JDKEXE -Xlinker --allow-shlib-undefined"
     fi
 fi
 
@@ -13459,6 +15306,7 @@
 
 
 
+
 # After we have toolchain, we can compile the uncygdrive helper
 
 # When using cygwin, we need a wrapper binary that renames
@@ -13498,6 +15346,8 @@
     { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
 $as_echo "yes" >&6; }
     rm -f $OUTPUT_ROOT/uncygdrive?.??? $OUTPUT_ROOT/uncygdrive.obj
+    # The path to uncygdrive to use should be Unix-style
+    UNCYGDRIVE="$OUTPUT_ROOT/uncygdrive.exe"
 fi
 
 
@@ -13517,11 +15367,6 @@
    ENABLE_DEBUG_SYMBOLS=no
 fi
 
-# default for embedded is no...
-if test "x$JDK_VARIANT" = "xembedded"; then
-   ENABLE_DEBUG_SYMBOLS=no
-fi
-
 # Check whether --enable-debug-symbols was given.
 if test "${enable_debug_symbols+set}" = set; then :
   enableval=$enable_debug_symbols; ENABLE_DEBUG_SYMBOLS=${enable_debug_symbols}
@@ -13644,6 +15489,10 @@
     FREETYPE2_NOT_NEEDED=yes
 fi
 
+if test "x$SUPPORT_HEADFUL" = xno; then
+    X11_NOT_NEEDED=yes
+fi
+
 ###############################################################################
 #
 # Check for MacOSX support for OpenJDK. If this exists, try to build a JVM
@@ -14817,7 +16666,11 @@
     HAS_SPACE=`echo "$with_freetype" | grep " "`
     if test "x$HAS_SPACE" != x; then
         if test "x$OPENJDK_BUILD_OS" = "xwindows"; then
+            # First convert it to DOS-style, short mode (no spaces)
             with_freetype=`$CYGPATH -s -m -a "$with_freetype"`
+            # Now it's case insensitive; let's make it lowercase to improve readability
+            with_freetype=`$ECHO "$with_freetype" | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvqxyz'`
+            # Now convert it back to Unix-stile (cygpath)
             with_freetype=`$CYGPATH -u "$with_freetype"`
         else
             as_fn_error $? "You cannot have spaces in the path to freetype! \"$with_freetype\"" "$LINENO" 5
@@ -15677,9 +17530,7 @@
 
 ###############################################################################
 LIBZIP_CAN_USE_MMAP=true
-if test "x$JDK_VARIANT" = "xembedded"; then
-   LIBZIP_CAN_USE_MMAP=false
-fi
+
 
 
 ###############################################################################
@@ -15956,7 +17807,7 @@
 
 # libCrun is the c++ runtime-library with SunStudio (roughly the equivalent of gcc's libstdc++.so)
 if test "x$OPENJDK_TARGET_OS" = xsolaris && test "x$LIBCXX" = x; then
-    LIBCXX="/usr/lib${LEGACY_OPENJDK_TARGET_CPU3}/libCrun.so.1"
+    LIBCXX="/usr/lib${OPENJDK_TARGET_CPU_ISADIR}/libCrun.so.1"
 fi
 
 # TODO better (platform agnostic) test
@@ -15975,7 +17826,7 @@
 ###############################################################################
 
 
-HOTSPOT_MAKE_ARGS="ALT_OUTPUTDIR=$HOTSPOT_OUTPUTDIR ALT_EXPORT_PATH=$HOTSPOT_DIST $HOTSPOT_TARGET"
+HOTSPOT_MAKE_ARGS="$HOTSPOT_TARGET"
 
 
 # The name of the Service Agent jar.
@@ -16011,27 +17862,19 @@
     FOUND_CORES=no
 
     if test -f /proc/cpuinfo; then
-        # Looks like a Linux system
+        # Looks like a Linux (or cygwin) system
         NUM_CORES=`cat /proc/cpuinfo  | grep -c processor`
         FOUND_CORES=yes
-    fi
-
-    if test -x /usr/sbin/psrinfo; then
+    elif test -x /usr/sbin/psrinfo; then
         # Looks like a Solaris system
         NUM_CORES=`LC_MESSAGES=C /usr/sbin/psrinfo -v | grep -c on-line`
         FOUND_CORES=yes
-    fi
-
-    if test -x /usr/sbin/system_profiler; then
+    elif test -x /usr/sbin/system_profiler; then
         # Looks like a MacOSX system
         NUM_CORES=`/usr/sbin/system_profiler -detailLevel full SPHardwareDataType | grep 'Cores' | awk  '{print $5}'`
         FOUND_CORES=yes
     fi
 
-    if test "x$build_os" = xwindows; then
-        NUM_CORES=4
-    fi
-
     # For c/c++ code we run twice as many concurrent build
     # jobs than we have cores, otherwise we will stall on io.
     CONCURRENT_BUILD_JOBS=`expr $NUM_CORES \* 2`
@@ -16065,31 +17908,26 @@
 
     { $as_echo "$as_me:${as_lineno-$LINENO}: checking for memory size" >&5
 $as_echo_n "checking for memory size... " >&6; }
-    # Default to 1024MB
+    # Default to 1024 MB
     MEMORY_SIZE=1024
     FOUND_MEM=no
 
-    if test -f /proc/cpuinfo; then
-        # Looks like a Linux system
+    if test -f /proc/meminfo; then
+        # Looks like a Linux (or cygwin) system
         MEMORY_SIZE=`cat /proc/meminfo | grep MemTotal | awk '{print $2}'`
         MEMORY_SIZE=`expr $MEMORY_SIZE / 1024`
         FOUND_MEM=yes
-    fi
-
-    if test -x /usr/sbin/prtconf; then
+    elif test -x /usr/sbin/prtconf; then
         # Looks like a Solaris system
         MEMORY_SIZE=`/usr/sbin/prtconf | grep "Memory size" | awk '{ print $3 }'`
         FOUND_MEM=yes
-    fi
-
-    if test -x /usr/sbin/system_profiler; then
+    elif test -x /usr/sbin/system_profiler; then
         # Looks like a MacOSX system
         MEMORY_SIZE=`/usr/sbin/system_profiler -detailLevel full SPHardwareDataType | grep 'Memory' | awk  '{print $2}'`
         MEMORY_SIZE=`expr $MEMORY_SIZE \* 1024`
         FOUND_MEM=yes
-    fi
-
-    if test "x$build_os" = xwindows; then
+    elif test "x$build_os" = xwindows; then
+        # Windows, but without cygwin
         MEMORY_SIZE=`systeminfo | grep 'Total Physical Memory:' | awk '{ print $4 }' | sed 's/,//'`
         FOUND_MEM=yes
     fi
@@ -16098,8 +17936,8 @@
         { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MEMORY_SIZE MB" >&5
 $as_echo "$MEMORY_SIZE MB" >&6; }
     else
-        { $as_echo "$as_me:${as_lineno-$LINENO}: result: could not detect memory size defaulting to 1024MB!" >&5
-$as_echo "could not detect memory size defaulting to 1024MB!" >&6; }
+        { $as_echo "$as_me:${as_lineno-$LINENO}: result: could not detect memory size defaulting to 1024 MB!" >&5
+$as_echo "could not detect memory size defaulting to 1024 MB!" >&6; }
     fi
 
 else
@@ -16111,82 +17949,52 @@
 # Setup smart javac (after cores and memory have been setup)
 
 
-# Check whether --with-server-java was given.
-if test "${with_server_java+set}" = set; then :
-  withval=$with_server_java;
-fi
-
-
-if test "x$with_server_java" != x; then
-    SERVER_JAVA="$with_server_java"
-    FOUND_VERSION=`$SERVER_JAVA -version 2>&1 | grep " version \""`
+# Check whether --with-sjavac-server-java was given.
+if test "${with_sjavac_server_java+set}" = set; then :
+  withval=$with_sjavac_server_java;
+fi
+
+
+if test "x$with_sjavac_server_java" != x; then
+    SJAVAC_SERVER_JAVA="$with_sjavac_server_java"
+    FOUND_VERSION=`$SJAVAC_SERVER_JAVA -version 2>&1 | grep " version \""`
     if test "x$FOUND_VERSION" = x; then
-        as_fn_error $? "Could not execute server java: $SERVER_JAVA" "$LINENO" 5
-    fi
-else
-    SERVER_JAVA=""
+        as_fn_error $? "Could not execute server java: $SJAVAC_SERVER_JAVA" "$LINENO" 5
+    fi
+else
+    SJAVAC_SERVER_JAVA=""
     # Hotspot specific options.
 
-    # Test if -XX:+UseParallelOldGC is a valid argument to $JAVA (often is $JAVA passed as $JAVA)
-    # If so, then append -XX:+UseParallelOldGC to SERVER_JAVA
-    FOUND_WARN=`$JAVA -XX:+UseParallelOldGC -version 2>&1 | grep -i warn`
-    FOUND_VERSION=`$JAVA -XX:+UseParallelOldGC -version 2>&1 | grep " version \""`
-    if test "x$FOUND_VERSION" != x && test "x$FOUND_WARN" = x; then
-        SERVER_JAVA="$SERVER_JAVA -XX:+UseParallelOldGC"
-    fi
-
-
     # Test if -verbosegc is a valid argument to $JAVA (often is $JAVA passed as $JAVA)
-    # If so, then append -verbosegc to SERVER_JAVA
+    # If so, then append -verbosegc to SJAVAC_SERVER_JAVA
     FOUND_WARN=`$JAVA -verbosegc -version 2>&1 | grep -i warn`
     FOUND_VERSION=`$JAVA -verbosegc -version 2>&1 | grep " version \""`
     if test "x$FOUND_VERSION" != x && test "x$FOUND_WARN" = x; then
-        SERVER_JAVA="$SERVER_JAVA -verbosegc"
+        SJAVAC_SERVER_JAVA="$SJAVAC_SERVER_JAVA -verbosegc"
     fi
 
     # JRockit specific options.
 
     # Test if -Xverbose:gc is a valid argument to $JAVA (often is $JAVA passed as $JAVA)
-    # If so, then append -Xverbose:gc to SERVER_JAVA
+    # If so, then append -Xverbose:gc to SJAVAC_SERVER_JAVA
     FOUND_WARN=`$JAVA -Xverbose:gc -version 2>&1 | grep -i warn`
     FOUND_VERSION=`$JAVA -Xverbose:gc -version 2>&1 | grep " version \""`
     if test "x$FOUND_VERSION" != x && test "x$FOUND_WARN" = x; then
-        SERVER_JAVA="$SERVER_JAVA -Xverbose:gc"
-    fi
-
-    SERVER_JAVA="$JAVA $SERVER_JAVA"
-fi
-
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to use shared server for javac" >&5
-$as_echo_n "checking whether to use shared server for javac... " >&6; }
-# Check whether --enable-javac-server was given.
-if test "${enable_javac_server+set}" = set; then :
-  enableval=$enable_javac_server; ENABLE_JAVAC_SERVER="${enableval}"
-else
-  ENABLE_JAVAC_SERVER='no'
-fi
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ENABLE_JAVAC_SERVER" >&5
-$as_echo "$ENABLE_JAVAC_SERVER" >&6; }
-if test "x$ENABLE_JAVAC_SERVER" = xyes; then
-    JAVAC_USE_REMOTE=true
-    JAVAC_SERVERS="$OUTPUT_ROOT/javacservers"
-else
-    JAVAC_USE_REMOTE=false
-    JAVAC_SERVERS=
-fi
-
-
-
-
-# Check whether --with-javac-server-cores was given.
-if test "${with_javac_server_cores+set}" = set; then :
-  withval=$with_javac_server_cores;
-fi
-
-if test "x$with_javac_server_cores" != x; then
-    JAVAC_SERVER_CORES="$with_javac_server_cores"
+        SJAVAC_SERVER_JAVA="$SJAVAC_SERVER_JAVA -Xverbose:gc"
+    fi
+
+    SJAVAC_SERVER_JAVA="$JAVA $SJAVAC_SERVER_JAVA"
+fi
+
+
+
+# Check whether --with-sjavac-server-cores was given.
+if test "${with_sjavac_server_cores+set}" = set; then :
+  withval=$with_sjavac_server_cores;
+fi
+
+if test "x$with_sjavac_server_cores" != x; then
+    SJAVAC_SERVER_CORES="$with_sjavac_server_cores"
 else
     if test "$NUM_CORES" -gt 16; then
         # We set this arbitrary limit because we want to limit the heap
@@ -16194,237 +18002,152 @@
         # In the future we will make the javac compilers in the server
         # share more and more state, thus enabling us to use more and
         # more concurrent threads in the server.
-        JAVAC_SERVER_CORES="16"
-    else
-        JAVAC_SERVER_CORES="$NUM_CORES"
+        SJAVAC_SERVER_CORES="16"
+    else
+        SJAVAC_SERVER_CORES="$NUM_CORES"
     fi
 
     if test "$MEMORY_SIZE" -gt "17000"; then
         MAX_HEAP_MEM=10000
 
-    # Test if -d64 is a valid argument to $SERVER_JAVA (often is $JAVA passed as $SERVER_JAVA)
-    # If so, then append -d64 to SERVER_JAVA
-    FOUND_WARN=`$SERVER_JAVA -d64 -version 2>&1 | grep -i warn`
-    FOUND_VERSION=`$SERVER_JAVA -d64 -version 2>&1 | grep " version \""`
+    # Test if -d64 is a valid argument to $SJAVAC_SERVER_JAVA (often is $JAVA passed as $SJAVAC_SERVER_JAVA)
+    # If so, then append -d64 to SJAVAC_SERVER_JAVA
+    FOUND_WARN=`$SJAVAC_SERVER_JAVA -d64 -version 2>&1 | grep -i warn`
+    FOUND_VERSION=`$SJAVAC_SERVER_JAVA -d64 -version 2>&1 | grep " version \""`
     if test "x$FOUND_VERSION" != x && test "x$FOUND_WARN" = x; then
-        SERVER_JAVA="$SERVER_JAVA -d64"
-    fi
-
-
-    # Test if -Xms10G -Xmx10G is a valid argument to $SERVER_JAVA (often is $JAVA passed as $SERVER_JAVA)
-    # If so, then append -Xms10G -Xmx10G to SERVER_JAVA
-    FOUND_WARN=`$SERVER_JAVA -Xms10G -Xmx10G -version 2>&1 | grep -i warn`
-    FOUND_VERSION=`$SERVER_JAVA -Xms10G -Xmx10G -version 2>&1 | grep " version \""`
+        SJAVAC_SERVER_JAVA="$SJAVAC_SERVER_JAVA -d64"
+    fi
+
+
+    # Test if -Xms10G -Xmx10G is a valid argument to $SJAVAC_SERVER_JAVA (often is $JAVA passed as $SJAVAC_SERVER_JAVA)
+    # If so, then append -Xms10G -Xmx10G to SJAVAC_SERVER_JAVA
+    FOUND_WARN=`$SJAVAC_SERVER_JAVA -Xms10G -Xmx10G -version 2>&1 | grep -i warn`
+    FOUND_VERSION=`$SJAVAC_SERVER_JAVA -Xms10G -Xmx10G -version 2>&1 | grep " version \""`
     if test "x$FOUND_VERSION" != x && test "x$FOUND_WARN" = x; then
-        SERVER_JAVA="$SERVER_JAVA -Xms10G -Xmx10G"
-    fi
-
-
-    # Test if -Xmn2G is a valid argument to $SERVER_JAVA (often is $JAVA passed as $SERVER_JAVA)
-    # If so, then append -Xmn2G to SERVER_JAVA
-    FOUND_WARN=`$SERVER_JAVA -Xmn2G -version 2>&1 | grep -i warn`
-    FOUND_VERSION=`$SERVER_JAVA -Xmn2G -version 2>&1 | grep " version \""`
-    if test "x$FOUND_VERSION" != x && test "x$FOUND_WARN" = x; then
-        SERVER_JAVA="$SERVER_JAVA -Xmn2G"
+        SJAVAC_SERVER_JAVA="$SJAVAC_SERVER_JAVA -Xms10G -Xmx10G"
     fi
 
     elif test "$MEMORY_SIZE" -gt "10000"; then
         MAX_HEAP_MEM=6000
 
-    # Test if -d64 is a valid argument to $SERVER_JAVA (often is $JAVA passed as $SERVER_JAVA)
-    # If so, then append -d64 to SERVER_JAVA
-    FOUND_WARN=`$SERVER_JAVA -d64 -version 2>&1 | grep -i warn`
-    FOUND_VERSION=`$SERVER_JAVA -d64 -version 2>&1 | grep " version \""`
+    # Test if -d64 is a valid argument to $SJAVAC_SERVER_JAVA (often is $JAVA passed as $SJAVAC_SERVER_JAVA)
+    # If so, then append -d64 to SJAVAC_SERVER_JAVA
+    FOUND_WARN=`$SJAVAC_SERVER_JAVA -d64 -version 2>&1 | grep -i warn`
+    FOUND_VERSION=`$SJAVAC_SERVER_JAVA -d64 -version 2>&1 | grep " version \""`
     if test "x$FOUND_VERSION" != x && test "x$FOUND_WARN" = x; then
-        SERVER_JAVA="$SERVER_JAVA -d64"
-    fi
-
-
-    # Test if -Xms6G -Xmx6G is a valid argument to $SERVER_JAVA (often is $JAVA passed as $SERVER_JAVA)
-    # If so, then append -Xms6G -Xmx6G to SERVER_JAVA
-    FOUND_WARN=`$SERVER_JAVA -Xms6G -Xmx6G -version 2>&1 | grep -i warn`
-    FOUND_VERSION=`$SERVER_JAVA -Xms6G -Xmx6G -version 2>&1 | grep " version \""`
+        SJAVAC_SERVER_JAVA="$SJAVAC_SERVER_JAVA -d64"
+    fi
+
+
+    # Test if -Xms6G -Xmx6G is a valid argument to $SJAVAC_SERVER_JAVA (often is $JAVA passed as $SJAVAC_SERVER_JAVA)
+    # If so, then append -Xms6G -Xmx6G to SJAVAC_SERVER_JAVA
+    FOUND_WARN=`$SJAVAC_SERVER_JAVA -Xms6G -Xmx6G -version 2>&1 | grep -i warn`
+    FOUND_VERSION=`$SJAVAC_SERVER_JAVA -Xms6G -Xmx6G -version 2>&1 | grep " version \""`
     if test "x$FOUND_VERSION" != x && test "x$FOUND_WARN" = x; then
-        SERVER_JAVA="$SERVER_JAVA -Xms6G -Xmx6G"
-    fi
-
-
-    # Test if -Xmn1G is a valid argument to $SERVER_JAVA (often is $JAVA passed as $SERVER_JAVA)
-    # If so, then append -Xmn1G to SERVER_JAVA
-    FOUND_WARN=`$SERVER_JAVA -Xmn1G -version 2>&1 | grep -i warn`
-    FOUND_VERSION=`$SERVER_JAVA -Xmn1G -version 2>&1 | grep " version \""`
-    if test "x$FOUND_VERSION" != x && test "x$FOUND_WARN" = x; then
-        SERVER_JAVA="$SERVER_JAVA -Xmn1G"
+        SJAVAC_SERVER_JAVA="$SJAVAC_SERVER_JAVA -Xms6G -Xmx6G"
     fi
 
     elif test "$MEMORY_SIZE" -gt "5000"; then
         MAX_HEAP_MEM=3000
 
-    # Test if -d64 is a valid argument to $SERVER_JAVA (often is $JAVA passed as $SERVER_JAVA)
-    # If so, then append -d64 to SERVER_JAVA
-    FOUND_WARN=`$SERVER_JAVA -d64 -version 2>&1 | grep -i warn`
-    FOUND_VERSION=`$SERVER_JAVA -d64 -version 2>&1 | grep " version \""`
+    # Test if -d64 is a valid argument to $SJAVAC_SERVER_JAVA (often is $JAVA passed as $SJAVAC_SERVER_JAVA)
+    # If so, then append -d64 to SJAVAC_SERVER_JAVA
+    FOUND_WARN=`$SJAVAC_SERVER_JAVA -d64 -version 2>&1 | grep -i warn`
+    FOUND_VERSION=`$SJAVAC_SERVER_JAVA -d64 -version 2>&1 | grep " version \""`
     if test "x$FOUND_VERSION" != x && test "x$FOUND_WARN" = x; then
-        SERVER_JAVA="$SERVER_JAVA -d64"
-    fi
-
-
-    # Test if -Xms1G -Xmx3G is a valid argument to $SERVER_JAVA (often is $JAVA passed as $SERVER_JAVA)
-    # If so, then append -Xms1G -Xmx3G to SERVER_JAVA
-    FOUND_WARN=`$SERVER_JAVA -Xms1G -Xmx3G -version 2>&1 | grep -i warn`
-    FOUND_VERSION=`$SERVER_JAVA -Xms1G -Xmx3G -version 2>&1 | grep " version \""`
+        SJAVAC_SERVER_JAVA="$SJAVAC_SERVER_JAVA -d64"
+    fi
+
+
+    # Test if -Xms1G -Xmx3G is a valid argument to $SJAVAC_SERVER_JAVA (often is $JAVA passed as $SJAVAC_SERVER_JAVA)
+    # If so, then append -Xms1G -Xmx3G to SJAVAC_SERVER_JAVA
+    FOUND_WARN=`$SJAVAC_SERVER_JAVA -Xms1G -Xmx3G -version 2>&1 | grep -i warn`
+    FOUND_VERSION=`$SJAVAC_SERVER_JAVA -Xms1G -Xmx3G -version 2>&1 | grep " version \""`
     if test "x$FOUND_VERSION" != x && test "x$FOUND_WARN" = x; then
-        SERVER_JAVA="$SERVER_JAVA -Xms1G -Xmx3G"
-    fi
-
-
-    # Test if -Xmn256M is a valid argument to $SERVER_JAVA (often is $JAVA passed as $SERVER_JAVA)
-    # If so, then append -Xmn256M to SERVER_JAVA
-    FOUND_WARN=`$SERVER_JAVA -Xmn256M -version 2>&1 | grep -i warn`
-    FOUND_VERSION=`$SERVER_JAVA -Xmn256M -version 2>&1 | grep " version \""`
-    if test "x$FOUND_VERSION" != x && test "x$FOUND_WARN" = x; then
-        SERVER_JAVA="$SERVER_JAVA -Xmn256M"
+        SJAVAC_SERVER_JAVA="$SJAVAC_SERVER_JAVA -Xms1G -Xmx3G"
     fi
 
     elif test "$MEMORY_SIZE" -gt "3800"; then
         MAX_HEAP_MEM=2500
 
-    # Test if -Xms1G -Xmx2500M is a valid argument to $SERVER_JAVA (often is $JAVA passed as $SERVER_JAVA)
-    # If so, then append -Xms1G -Xmx2500M to SERVER_JAVA
-    FOUND_WARN=`$SERVER_JAVA -Xms1G -Xmx2500M -version 2>&1 | grep -i warn`
-    FOUND_VERSION=`$SERVER_JAVA -Xms1G -Xmx2500M -version 2>&1 | grep " version \""`
+    # Test if -Xms1G -Xmx2500M is a valid argument to $SJAVAC_SERVER_JAVA (often is $JAVA passed as $SJAVAC_SERVER_JAVA)
+    # If so, then append -Xms1G -Xmx2500M to SJAVAC_SERVER_JAVA
+    FOUND_WARN=`$SJAVAC_SERVER_JAVA -Xms1G -Xmx2500M -version 2>&1 | grep -i warn`
+    FOUND_VERSION=`$SJAVAC_SERVER_JAVA -Xms1G -Xmx2500M -version 2>&1 | grep " version \""`
     if test "x$FOUND_VERSION" != x && test "x$FOUND_WARN" = x; then
-        SERVER_JAVA="$SERVER_JAVA -Xms1G -Xmx2500M"
-    fi
-
-
-    # Test if -Xmn256M is a valid argument to $SERVER_JAVA (often is $JAVA passed as $SERVER_JAVA)
-    # If so, then append -Xmn256M to SERVER_JAVA
-    FOUND_WARN=`$SERVER_JAVA -Xmn256M -version 2>&1 | grep -i warn`
-    FOUND_VERSION=`$SERVER_JAVA -Xmn256M -version 2>&1 | grep " version \""`
-    if test "x$FOUND_VERSION" != x && test "x$FOUND_WARN" = x; then
-        SERVER_JAVA="$SERVER_JAVA -Xmn256M"
+        SJAVAC_SERVER_JAVA="$SJAVAC_SERVER_JAVA -Xms1G -Xmx2500M"
     fi
 
     elif test "$MEMORY_SIZE" -gt "1900"; then
         MAX_HEAP_MEM=1200
 
-    # Test if -Xms700M -Xmx1200M is a valid argument to $SERVER_JAVA (often is $JAVA passed as $SERVER_JAVA)
-    # If so, then append -Xms700M -Xmx1200M to SERVER_JAVA
-    FOUND_WARN=`$SERVER_JAVA -Xms700M -Xmx1200M -version 2>&1 | grep -i warn`
-    FOUND_VERSION=`$SERVER_JAVA -Xms700M -Xmx1200M -version 2>&1 | grep " version \""`
+    # Test if -Xms700M -Xmx1400M is a valid argument to $SJAVAC_SERVER_JAVA (often is $JAVA passed as $SJAVAC_SERVER_JAVA)
+    # If so, then append -Xms700M -Xmx1400M to SJAVAC_SERVER_JAVA
+    FOUND_WARN=`$SJAVAC_SERVER_JAVA -Xms700M -Xmx1400M -version 2>&1 | grep -i warn`
+    FOUND_VERSION=`$SJAVAC_SERVER_JAVA -Xms700M -Xmx1400M -version 2>&1 | grep " version \""`
     if test "x$FOUND_VERSION" != x && test "x$FOUND_WARN" = x; then
-        SERVER_JAVA="$SERVER_JAVA -Xms700M -Xmx1200M"
-    fi
-
-
-    # Test if -Xmn256M is a valid argument to $SERVER_JAVA (often is $JAVA passed as $SERVER_JAVA)
-    # If so, then append -Xmn256M to SERVER_JAVA
-    FOUND_WARN=`$SERVER_JAVA -Xmn256M -version 2>&1 | grep -i warn`
-    FOUND_VERSION=`$SERVER_JAVA -Xmn256M -version 2>&1 | grep " version \""`
-    if test "x$FOUND_VERSION" != x && test "x$FOUND_WARN" = x; then
-        SERVER_JAVA="$SERVER_JAVA -Xmn256M"
+        SJAVAC_SERVER_JAVA="$SJAVAC_SERVER_JAVA -Xms700M -Xmx1400M"
     fi
 
     elif test "$MEMORY_SIZE" -gt "1000"; then
         MAX_HEAP_MEM=900
 
-    # Test if -Xms400M -Xmx900M is a valid argument to $SERVER_JAVA (often is $JAVA passed as $SERVER_JAVA)
-    # If so, then append -Xms400M -Xmx900M to SERVER_JAVA
-    FOUND_WARN=`$SERVER_JAVA -Xms400M -Xmx900M -version 2>&1 | grep -i warn`
-    FOUND_VERSION=`$SERVER_JAVA -Xms400M -Xmx900M -version 2>&1 | grep " version \""`
+    # Test if -Xms400M -Xmx1100M is a valid argument to $SJAVAC_SERVER_JAVA (often is $JAVA passed as $SJAVAC_SERVER_JAVA)
+    # If so, then append -Xms400M -Xmx1100M to SJAVAC_SERVER_JAVA
+    FOUND_WARN=`$SJAVAC_SERVER_JAVA -Xms400M -Xmx1100M -version 2>&1 | grep -i warn`
+    FOUND_VERSION=`$SJAVAC_SERVER_JAVA -Xms400M -Xmx1100M -version 2>&1 | grep " version \""`
     if test "x$FOUND_VERSION" != x && test "x$FOUND_WARN" = x; then
-        SERVER_JAVA="$SERVER_JAVA -Xms400M -Xmx900M"
-    fi
-
-
-    # Test if -Xmn128M is a valid argument to $SERVER_JAVA (often is $JAVA passed as $SERVER_JAVA)
-    # If so, then append -Xmn128M to SERVER_JAVA
-    FOUND_WARN=`$SERVER_JAVA -Xmn128M -version 2>&1 | grep -i warn`
-    FOUND_VERSION=`$SERVER_JAVA -Xmn128M -version 2>&1 | grep " version \""`
-    if test "x$FOUND_VERSION" != x && test "x$FOUND_WARN" = x; then
-        SERVER_JAVA="$SERVER_JAVA -Xmn128M"
+        SJAVAC_SERVER_JAVA="$SJAVAC_SERVER_JAVA -Xms400M -Xmx1100M"
     fi
 
     else
         MAX_HEAP_MEM=512
 
-    # Test if -Xms256M -Xmx512M is a valid argument to $SERVER_JAVA (often is $JAVA passed as $SERVER_JAVA)
-    # If so, then append -Xms256M -Xmx512M to SERVER_JAVA
-    FOUND_WARN=`$SERVER_JAVA -Xms256M -Xmx512M -version 2>&1 | grep -i warn`
-    FOUND_VERSION=`$SERVER_JAVA -Xms256M -Xmx512M -version 2>&1 | grep " version \""`
+    # Test if -Xms256M -Xmx512M is a valid argument to $SJAVAC_SERVER_JAVA (often is $JAVA passed as $SJAVAC_SERVER_JAVA)
+    # If so, then append -Xms256M -Xmx512M to SJAVAC_SERVER_JAVA
+    FOUND_WARN=`$SJAVAC_SERVER_JAVA -Xms256M -Xmx512M -version 2>&1 | grep -i warn`
+    FOUND_VERSION=`$SJAVAC_SERVER_JAVA -Xms256M -Xmx512M -version 2>&1 | grep " version \""`
+    if test "x$FOUND_VERSION" != x && test "x$FOUND_WARN" = x; then
+        SJAVAC_SERVER_JAVA="$SJAVAC_SERVER_JAVA -Xms256M -Xmx512M"
+    fi
+
+    fi
+
+
+    # Test if -XX:PermSize=32m is a valid argument to $SJAVAC_SERVER_JAVA (often is $JAVA passed as $SJAVAC_SERVER_JAVA)
+    # If so, then append -XX:PermSize=32m to SJAVAC_SERVER_JAVA
+    FOUND_WARN=`$SJAVAC_SERVER_JAVA -XX:PermSize=32m -version 2>&1 | grep -i warn`
+    FOUND_VERSION=`$SJAVAC_SERVER_JAVA -XX:PermSize=32m -version 2>&1 | grep " version \""`
     if test "x$FOUND_VERSION" != x && test "x$FOUND_WARN" = x; then
-        SERVER_JAVA="$SERVER_JAVA -Xms256M -Xmx512M"
-    fi
-
-
-    # Test if -Xmn128M is a valid argument to $SERVER_JAVA (often is $JAVA passed as $SERVER_JAVA)
-    # If so, then append -Xmn128M to SERVER_JAVA
-    FOUND_WARN=`$SERVER_JAVA -Xmn128M -version 2>&1 | grep -i warn`
-    FOUND_VERSION=`$SERVER_JAVA -Xmn128M -version 2>&1 | grep " version \""`
+        SJAVAC_SERVER_JAVA="$SJAVAC_SERVER_JAVA -XX:PermSize=32m"
+    fi
+
+
+    # Test if -XX:MaxPermSize=160m is a valid argument to $SJAVAC_SERVER_JAVA (often is $JAVA passed as $SJAVAC_SERVER_JAVA)
+    # If so, then append -XX:MaxPermSize=160m to SJAVAC_SERVER_JAVA
+    FOUND_WARN=`$SJAVAC_SERVER_JAVA -XX:MaxPermSize=160m -version 2>&1 | grep -i warn`
+    FOUND_VERSION=`$SJAVAC_SERVER_JAVA -XX:MaxPermSize=160m -version 2>&1 | grep " version \""`
     if test "x$FOUND_VERSION" != x && test "x$FOUND_WARN" = x; then
-        SERVER_JAVA="$SERVER_JAVA -Xmn128M"
-    fi
-
-    fi
+        SJAVAC_SERVER_JAVA="$SJAVAC_SERVER_JAVA -XX:MaxPermSize=160m"
+    fi
+
+
+    # Test if -XX:ThreadStackSize=$STACK_SIZE is a valid argument to $SJAVAC_SERVER_JAVA (often is $JAVA passed as $SJAVAC_SERVER_JAVA)
+    # If so, then append -XX:ThreadStackSize=$STACK_SIZE to SJAVAC_SERVER_JAVA
+    FOUND_WARN=`$SJAVAC_SERVER_JAVA -XX:ThreadStackSize=$STACK_SIZE -version 2>&1 | grep -i warn`
+    FOUND_VERSION=`$SJAVAC_SERVER_JAVA -XX:ThreadStackSize=$STACK_SIZE -version 2>&1 | grep " version \""`
+    if test "x$FOUND_VERSION" != x && test "x$FOUND_WARN" = x; then
+        SJAVAC_SERVER_JAVA="$SJAVAC_SERVER_JAVA -XX:ThreadStackSize=$STACK_SIZE"
+    fi
+
 
     MAX_COMPILERS_IN_HEAP=`expr $MAX_HEAP_MEM / 501`
-    if test "$JAVAC_SERVER_CORES" -gt "$MAX_COMPILERS_IN_HEAP"; then
+    if test "$SJAVAC_SERVER_CORES" -gt "$MAX_COMPILERS_IN_HEAP"; then
         { $as_echo "$as_me:${as_lineno-$LINENO}: checking if number of server cores must be reduced" >&5
 $as_echo_n "checking if number of server cores must be reduced... " >&6; }
-        JAVAC_SERVER_CORES="$MAX_COMPILERS_IN_HEAP"
-        { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes, to $JAVAC_SERVER_CORES with max heap size $MAX_HEAP_MEM MB" >&5
-$as_echo "yes, to $JAVAC_SERVER_CORES with max heap size $MAX_HEAP_MEM MB" >&6; }
-    fi
-fi
-
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to track dependencies between Java packages" >&5
-$as_echo_n "checking whether to track dependencies between Java packages... " >&6; }
-# Check whether --enable-javac-deps was given.
-if test "${enable_javac_deps+set}" = set; then :
-  enableval=$enable_javac_deps; ENABLE_JAVAC_DEPS="${enableval}"
-else
-  ENABLE_JAVAC_DEPS='no'
-fi
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ENABLE_JAVAC_DEPS" >&5
-$as_echo "$ENABLE_JAVAC_DEPS" >&6; }
-if test "x$ENABLE_JAVAC_DEPS" = xyes; then
-    JAVAC_USE_DEPS=true
-else
-    JAVAC_USE_DEPS=false
-fi
-
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to use multiple cores for javac compilation" >&5
-$as_echo_n "checking whether to use multiple cores for javac compilation... " >&6; }
-# Check whether --enable-javac-multi-core was given.
-if test "${enable_javac_multi_core+set}" = set; then :
-  enableval=$enable_javac_multi_core; ENABLE_JAVAC_MULTICORE="${enableval}"
-else
-  ENABLE_JAVAC_MULTICORE='no'
-fi
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ENABLE_JAVAC_MULTICORE" >&5
-$as_echo "$ENABLE_JAVAC_MULTICORE" >&6; }
-if test "x$ENABLE_JAVAC_MULTICORE" = xyes; then
-    JAVAC_USE_MODE=MULTI_CORE_CONCURRENT
-else
-    JAVAC_USE_MODE=SINGLE_THREADED_BATCH
-    if test "x$ENABLE_JAVAC_DEPS" = xyes; then
-        { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Dependency tracking is not supported with single threaded batch compiles of Java source roots. Please add --disable-javac-deps to your configure options." >&5
-$as_echo "$as_me: WARNING: Dependency tracking is not supported with single threaded batch compiles of Java source roots. Please add --disable-javac-deps to your configure options." >&2;}
-        { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Disabling dependency tracking for you now." >&5
-$as_echo "$as_me: WARNING: Disabling dependency tracking for you now." >&2;}
-        JAVAC_USE_DEPS=false
-    fi
-    if test "x$ENABLE_JAVAC_SERVER" = xyes; then
-        { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: The javac server will not be used since single threaded batch compiles are run within their own JVM. Please add --disable-javac-server to your configure options." >&5
-$as_echo "$as_me: WARNING: The javac server will not be used since single threaded batch compiles are run within their own JVM. Please add --disable-javac-server to your configure options." >&2;}
-        { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Disabling javac server for you now." >&5
-$as_echo "$as_me: WARNING: Disabling javac server for you now." >&2;}
-        JAVAC_USE_REMOTE=false
+        SJAVAC_SERVER_CORES="$MAX_COMPILERS_IN_HEAP"
+        { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes, to $SJAVAC_SERVER_CORES with max heap size $MAX_HEAP_MEM MB" >&5
+$as_echo "yes, to $SJAVAC_SERVER_CORES with max heap size $MAX_HEAP_MEM MB" >&6; }
     fi
 fi
 
@@ -16442,6 +18165,13 @@
 $as_echo "$ENABLE_SJAVAC" >&6; }
 
 
+if test "x$ENABLE_SJAVAC" = xyes; then
+    SJAVAC_SERVER_DIR="$OUTPUT_ROOT/javacservers"
+else
+    SJAVAC_SERVER_DIR=
+fi
+
+
 
 
 # Can the C/C++ compiler use precompiled headers?
@@ -16666,7 +18396,7 @@
 
 
 
-# At the end, call the closed hook. (Dummy macro if no closed sources available)
+# At the end, call the custom hook. (Dummy macro if no custom sources available)
 
 
 # We're messing a bit with internal autoconf variables to put the config.status
@@ -17365,6 +19095,9 @@
   case $ac_config_target in
     "$OUTPUT_ROOT/config.h") CONFIG_HEADERS="$CONFIG_HEADERS $OUTPUT_ROOT/config.h:$AUTOCONF_DIR/config.h.in" ;;
     "$OUTPUT_ROOT/spec.gmk") CONFIG_FILES="$CONFIG_FILES $OUTPUT_ROOT/spec.gmk:$AUTOCONF_DIR/spec.gmk.in" ;;
+    "$OUTPUT_ROOT/hotspot-spec.gmk") CONFIG_FILES="$CONFIG_FILES $OUTPUT_ROOT/hotspot-spec.gmk:$AUTOCONF_DIR/hotspot-spec.gmk.in" ;;
+    "$OUTPUT_ROOT/bootcycle-spec.gmk") CONFIG_FILES="$CONFIG_FILES $OUTPUT_ROOT/bootcycle-spec.gmk:$AUTOCONF_DIR/bootcycle-spec.gmk.in" ;;
+    "$OUTPUT_ROOT/compare.sh") CONFIG_FILES="$CONFIG_FILES $OUTPUT_ROOT/compare.sh:$AUTOCONF_DIR/compare.sh.in" ;;
     "$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" ;;
 
@@ -17946,6 +19679,9 @@
 fi
 
 
+# Make the compare script executable
+$CHMOD +x $OUTPUT_ROOT/compare.sh
+
 # Finally output some useful information to the user
 
 # Finally output some useful information to the user
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/common/autoconf/hotspot-spec.gmk.in	Wed Jul 05 18:22:52 2017 +0200
@@ -0,0 +1,90 @@
+#
+# Copyright (c) 2011, 2012, 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.
+#
+
+
+# Chaining of spec files
+HOTSPOT_SPEC:=$(dir $(SPEC))hotspot-spec.gmk
+override SPEC=$(HOTSPOT_SPEC)
+# Now include the base spec.gmk file
+include $(BASE_SPEC)
+
+# Additional legacy variables defined for Hotspot
+
+@SET_OPENJDK@
+
+# Legacy defines controlled by the SUPPORT_HEADLESS and SUPPORT_HEADFUL options.
+@BUILD_HEADLESS@
+
+# Legacy setting: OPT or DBG
+VARIANT:=@VARIANT@
+# Legacy setting: true or false
+FASTDEBUG:=@FASTDEBUG@
+# Legacy setting: debugging the class files?
+DEBUG_CLASSFILES:=@DEBUG_CLASSFILES@
+
+ALT_CUPS_HEADERS_PATH:=$(patsubst -I%,%,$(filter -I%,@CUPS_CFLAGS@))
+
+# The HOSTCC/HOSTCXX is Hotspot terminology for the BUILD_CC/BUILD_CXX, i.e. the
+# compiler that produces code that can be run on the build platform.
+HOSTCC:=@UNCYGDRIVE@ @BUILD_CC@
+HOSTCXX:=@UNCYGDRIVE@ @BUILD_CXX@
+
+####################################################
+#
+# Legacy Hotspot support
+
+# If cross compiling, then define CROSS_COMPILE_ARCH:=cpu_name here.
+@DEFINE_CROSS_COMPILE_ARCH@
+
+# Old name for OPENJDK_TARGET_OS (aix,bsd,hpux,linux,macosx,solaris,windows etc)
+PLATFORM=$(OPENJDK_TARGET_OS)
+# 32 or 64 bit
+ARCH_DATA_MODEL=$(OPENJDK_TARGET_CPU_BITS)
+
+ALT_BOOTDIR=$(BOOT_JDK)
+# Can be /sparcv9 or /amd64 on Solaris
+ISA_DIR=$(OPENJDK_TARGET_CPU_ISADIR)
+# Yet another name for arch used for an extra subdir below the jvm lib.
+# Uses i386 and amd64, instead of x86 and x86_64.
+LIBARCH=$(OPENJDK_TARGET_CPU_LEGACY_LIB)
+# Old name for OPENJDK_TARGET_CPU, uses i586 and amd64, instead of x86 and x86_64.
+ARCH=$(OPENJDK_TARGET_CPU_LEGACY)
+# Legacy setting for building for a 64 bit machine.
+# If yes then this expands to _LP64:=1
+@LP64@
+
+ALT_OUTPUTDIR=$(HOTSPOT_OUTPUTDIR)
+ALT_EXPORT_PATH=$(HOTSPOT_DIST)
+
+HOTSPOT_MAKE_ARGS:=@HOTSPOT_MAKE_ARGS@
+# This is used from the libjvm build for C/C++ code.
+HOTSPOT_BUILD_JOBS:=@CONCURRENT_BUILD_JOBS@
+# Control wether Hotspot runs Queens test after building
+TEST_IN_BUILD=@TEST_IN_BUILD@
+
+
+EXTRA_CFLAGS=@LEGACY_EXTRA_CFLAGS@
+EXTRA_CXXFLAGS=@LEGACY_EXTRA_CXXFLAGS@
+EXTRA_LDFLAGS=@LEGACY_EXTRA_LDFLAGS@
--- a/common/autoconf/jdk-options.m4	Wed Jul 05 18:22:17 2017 +0200
+++ b/common/autoconf/jdk-options.m4	Wed Jul 05 18:22:52 2017 +0200
@@ -30,7 +30,7 @@
 # Check which variant of the JDK that we want to build.
 # Currently we have:
 #    normal:   standard edition   
-#    embedded: cut down to a smaller footprint
+# but the custom make system may add other variants
 #
 # Effectively the JDK variant gives a name to a specific set of
 # modules to compile into the JDK. In the future, these modules
@@ -38,22 +38,14 @@
 #
 AC_MSG_CHECKING([which variant of the JDK to build])
 AC_ARG_WITH([jdk-variant], [AS_HELP_STRING([--with-jdk-variant],
-	[JDK variant to build (normal, embedded) @<:@normal@:>@])])
+	[JDK variant to build (normal) @<:@normal@:>@])])
 
 if test "x$with_jdk_variant" = xnormal || test "x$with_jdk_variant" = x; then
-    JAVASE_EMBEDDED=""
-    MINIMIZE_RAM_USAGE=""
     JDK_VARIANT="normal"
-elif test "x$with_jdk_variant" = xembedded; then
-    JAVASE_EMBEDDED="JAVASE_EMBEDDED:=true"
-    MINIMIZE_RAM_USAGE="MINIMIZE_RAM_USAGE:=true"
-    JDK_VARIANT="embedded"
 else
-    AC_MSG_ERROR([The available JDK variants are: normal, embedded])
+    AC_MSG_ERROR([The available JDK variants are: normal])
 fi
-                              
-AC_SUBST(JAVASE_EMBEDDED)
-AC_SUBST(MINIMIZE_RAM_USAGE)
+
 AC_SUBST(JDK_VARIANT)
 
 AC_MSG_RESULT([$JDK_VARIANT])
@@ -77,11 +69,7 @@
 	[JVM variants (separated by commas) to build (server, client, kernel, zero, zeroshark) @<:@server@:>@])])
 
 if test "x$with_jvm_variants" = x; then
-    if test "x$JDK_VARIANT" = xembedded; then
-        with_jvm_variants="client"
-    else
-        with_jvm_variants="server"
-    fi
+     with_jvm_variants="server"
 fi
 
 JVM_VARIANTS=",$with_jvm_variants,"
@@ -125,6 +113,11 @@
 AC_SUBST(JVM_VARIANT_ZERO)
 AC_SUBST(JVM_VARIANT_ZEROSHARK)
 
+if test "x$OPENJDK_TARGET_OS" = "xmacosx"; then
+   MACOSX_UNIVERSAL="true"
+fi
+
+AC_SUBST(MACOSX_UNIVERSAL)
 
 ])
 
@@ -223,6 +216,14 @@
 
 HOTSPOT_TARGET="$HOTSPOT_TARGET docs export_$HOTSPOT_EXPORT"
 
+# On Macosx universal binaries are produced, but they only contain
+# 64 bit intel. This invalidates control of which jvms are built
+# from configure, but only server is valid anyway. Fix this
+# when hotspot makefiles are rewritten.
+if test "x$MACOSX_UNIVERSAL" = xtrue; then
+    HOTSPOT_TARGET=universal_product
+fi
+
 #####
 
 AC_SUBST(DEBUG_LEVEL)
@@ -289,14 +290,12 @@
 
 if test "x$SUPPORT_HEADFUL" = xyes; then
     # We are building both headful and headless.
-    BUILD_HEADLESS_ONLY=""
     headful_msg="inlude support for both headful and headless"
 fi
 
 if test "x$SUPPORT_HEADFUL" = xno; then
     # Thus we are building headless only.
     BUILD_HEADLESS="BUILD_HEADLESS:=true"
-    BUILD_HEADLESS_ONLY="BUILD_HEADLESS_ONLY:=true"
     headful_msg="headless only"
 fi
 
@@ -305,23 +304,6 @@
 AC_SUBST(SUPPORT_HEADLESS)
 AC_SUBST(SUPPORT_HEADFUL)
 AC_SUBST(BUILD_HEADLESS)
-AC_SUBST(BUILD_HEADLESS_ONLY)
-
-###############################################################################
-#
-# Should we run the painfully slow javadoc tool?
-#
-AC_MSG_CHECKING([whether to build documentation])
-AC_ARG_ENABLE([docs], [AS_HELP_STRING([--enable-docs],
-	[enable generation of Javadoc documentation @<:@disabled@:>@])],
-	[ENABLE_DOCS="${enableval}"], [ENABLE_DOCS='no'])
-AC_MSG_RESULT([$ENABLE_DOCS])
-AC_SUBST(ENABLE_DOCS)
-GENERATE_DOCS=false
-if test "x$ENABLE_DOCS" = xyes; then
-    GENERATE_DOCS=true
-fi
-AC_SUBST(GENERATE_DOCS)
 
 ###############################################################################
 #
@@ -373,25 +355,21 @@
 #
 COMPRESS_JARS=false
 
-# default for embedded is yes...
-if test "x$JDK_VARIANT" = "xembedded"; then
-   COMPRESS_JARS=true
-fi
 AC_SUBST(COMPRESS_JARS)
 
 ###############################################################################
 #
 # Should we compile JFR
-#   default no, except for on closed-jdk and !embedded
+#   default no, except for on closed-jdk
 #
 ENABLE_JFR=no
 
 # Is the JFR source present
 
 #
-# For closed && !embedded default is yes if the source is present
+# For closed default is yes
 #
-if test "x${OPENJDK}" != "xtrue" && test "x$JDK_VARIANT" != "xembedded" && test -d "$SRC_ROOT/jdk/src/closed/share/native/oracle/jfr"; then
+if test "x${OPENJDK}" != "xtrue"; then
    ENABLE_JFR=yes
 fi
 
@@ -469,7 +447,7 @@
 
 AC_DEFUN_ONCE([JDKOPT_SETUP_BUILD_TWEAKS],
 [
-HOTSPOT_MAKE_ARGS="ALT_OUTPUTDIR=$HOTSPOT_OUTPUTDIR ALT_EXPORT_PATH=$HOTSPOT_DIST $HOTSPOT_TARGET"
+HOTSPOT_MAKE_ARGS="$HOTSPOT_TARGET"
 AC_SUBST(HOTSPOT_MAKE_ARGS)
 
 # The name of the Service Agent jar.
@@ -494,11 +472,6 @@
    ENABLE_DEBUG_SYMBOLS=no
 fi
 
-# default for embedded is no...
-if test "x$JDK_VARIANT" = "xembedded"; then
-   ENABLE_DEBUG_SYMBOLS=no
-fi
-
 AC_ARG_ENABLE([debug-symbols],
               [AS_HELP_STRING([--disable-debug-symbols],[disable generation of debug symbols (@<:@enabled@:>@)])],
               [ENABLE_DEBUG_SYMBOLS=${enable_debug_symbols}],
@@ -549,3 +522,11 @@
 AC_SUBST(CFLAGS_DEBUG_SYMBOLS)
 AC_SUBST(CXXFLAGS_DEBUG_SYMBOLS)
 ])
+
+# Support for customization of the build process. Some build files
+# will include counterparts from this location, if they exist. This allows
+# for a degree of customization of the build targets and the rules/recipes
+# to create them
+AC_ARG_WITH([custom-make-dir], [AS_HELP_STRING([--with-custom-make-dir],
+    [directory containing custom build/make files])], [CUSTOM_MAKE_DIR=$with_custom_make_dir])
+AC_SUBST(CUSTOM_MAKE_DIR)
--- a/common/autoconf/libraries.m4	Wed Jul 05 18:22:17 2017 +0200
+++ b/common/autoconf/libraries.m4	Wed Jul 05 18:22:52 2017 +0200
@@ -73,6 +73,10 @@
     FREETYPE2_NOT_NEEDED=yes
 fi
 
+if test "x$SUPPORT_HEADFUL" = xno; then
+    X11_NOT_NEEDED=yes
+fi
+
 ###############################################################################
 #
 # Check for MacOSX support for OpenJDK. If this exists, try to build a JVM
@@ -518,9 +522,7 @@
 
 ###############################################################################
 LIBZIP_CAN_USE_MMAP=true
-if test "x$JDK_VARIANT" = "xembedded"; then
-   LIBZIP_CAN_USE_MMAP=false
-fi
+
 AC_SUBST(LIBZIP_CAN_USE_MMAP)
 
 ###############################################################################
@@ -629,7 +631,7 @@
 
 # libCrun is the c++ runtime-library with SunStudio (roughly the equivalent of gcc's libstdc++.so)
 if test "x$OPENJDK_TARGET_OS" = xsolaris && test "x$LIBCXX" = x; then
-    LIBCXX="/usr/lib${LEGACY_OPENJDK_TARGET_CPU3}/libCrun.so.1"
+    LIBCXX="/usr/lib${OPENJDK_TARGET_CPU_ISADIR}/libCrun.so.1"
 fi
 
 # TODO better (platform agnostic) test
--- a/common/autoconf/platform.m4	Wed Jul 05 18:22:17 2017 +0200
+++ b/common/autoconf/platform.m4	Wed Jul 05 18:22:52 2017 +0200
@@ -23,279 +23,86 @@
 # questions.
 #
 
-AC_DEFUN([PLATFORM_EXTRACT_TARGET_AND_BUILD_AND_LEGACY_VARS],
-[
-    # Expects $host_os $host_cpu $build_os and $build_cpu
-    # and $with_target_bits to have been setup!
-    #
-    # Translate the standard triplet(quadruplet) definition
-    # of the target/build system into
-    # OPENJDK_TARGET_OS=aix,bsd,hpux,linux,macosx,solaris,windows
-    # OPENJDK_TARGET_OS_FAMILY=bsd,gnu,sysv,win32,wince
-    # OPENJDK_TARGET_OS_API=posix,winapi
-    # 
-    # OPENJDK_TARGET_CPU=ia32,x64,sparc,sparcv9,arm,arm64,ppc,ppc64
-    # OPENJDK_TARGET_CPU_ARCH=x86,sparc,pcc,arm
-    # OPENJDK_TARGET_CPU_BITS=32,64
-    # OPENJDK_TARGET_CPU_ENDIAN=big,little
-    #
-    # The same values are setup for BUILD_...
-    # 
-    # And the legacy variables, for controlling the old makefiles.
-    # LEGACY_OPENJDK_TARGET_CPU1=i586,amd64/x86_64,sparc,sparcv9,arm,arm64...
-    # LEGACY_OPENJDK_TARGET_CPU2=i386,amd64,sparc,sparcv9,arm,arm64...
-    # LEGACY_OPENJDK_TARGET_CPU3=sparcv9,amd64 (but only on solaris)
-    # LEGACY_OPENJDK_TARGET_OS_API=solaris,windows
-    #
-    # We also copy the autoconf trip/quadruplet
-    # verbatim to OPENJDK_TARGET_SYSTEM (from the autoconf "host") and OPENJDK_BUILD_SYSTEM
-    OPENJDK_TARGET_SYSTEM="$host"
-    OPENJDK_BUILD_SYSTEM="$build"
-    AC_SUBST(OPENJDK_TARGET_SYSTEM)
-    AC_SUBST(OPENJDK_BUILD_SYSTEM)
-    
-    PLATFORM_EXTRACT_VARS_FROM_OS_TO(OPENJDK_TARGET,$host_os)
-    PLATFORM_EXTRACT_VARS_FROM_CPU_TO(OPENJDK_TARGET,$host_cpu)
-
-    PLATFORM_EXTRACT_VARS_FROM_OS_TO(OPENJDK_BUILD,$build_os)
-    PLATFORM_EXTRACT_VARS_FROM_CPU_TO(OPENJDK_BUILD,$build_cpu)
-
-    if test "x$OPENJDK_TARGET_OS" != xsolaris; then
-        LEGACY_OPENJDK_TARGET_CPU3=""
-        LEGACY_OPENJDK_BUILD_CPU3=""
-    fi
-
-    # On MacOSX and MacOSX only, we have a different name for the x64 CPU in ARCH (LEGACY_OPENJDK_TARGET_CPU1) ...
-    if test "x$OPENJDK_TARGET_OS" = xmacosx && test "x$OPENJDK_TARGET_CPU" = xx64; then
-        LEGACY_OPENJDK_TARGET_CPU1="x86_64"
-    fi
-
-    PLATFORM_SET_RELEASE_FILE_OS_VALUES
-])
-
-AC_DEFUN([PLATFORM_EXTRACT_VARS_FROM_OS_TO],
-[
-    PLATFORM_EXTRACT_VARS_FROM_OS($2)
-    $1_OS="$VAR_OS"
-    $1_OS_FAMILY="$VAR_OS_FAMILY"
-    $1_OS_API="$VAR_OS_API"
-
-    AC_SUBST($1_OS)
-    AC_SUBST($1_OS_FAMILY)
-    AC_SUBST($1_OS_API)
-
-    if test "x$$1_OS_API" = xposix; then
-        LEGACY_$1_OS_API="solaris"
-    fi
-    if test "x$$1_OS_API" = xwinapi; then
-        LEGACY_$1_OS_API="windows"
-    fi
-    AC_SUBST(LEGACY_$1_OS_API)    
-])
-
-AC_DEFUN([PLATFORM_EXTRACT_VARS_FROM_CPU_TO],
-[
-    PLATFORM_EXTRACT_VARS_FROM_CPU($2)
-    $1_CPU="$VAR_CPU"
-    $1_CPU_ARCH="$VAR_CPU_ARCH"
-    $1_CPU_BITS="$VAR_CPU_BITS"
-    $1_CPU_ENDIAN="$VAR_CPU_ENDIAN"
-
-    AC_SUBST($1_CPU)
-    AC_SUBST($1_CPU_ARCH)
-    AC_SUBST($1_CPU_BITS)
-    AC_SUBST($1_CPU_ENDIAN)
-    
-    # Also store the legacy naming of the cpu.
-    # Ie i586 and amd64 instead of ia32 and x64
-    LEGACY_$1_CPU1="$VAR_LEGACY_CPU"
-    AC_SUBST(LEGACY_$1_CPU1)
-
-    # And the second legacy naming of the cpu.
-    # Ie i386 and amd64 instead of ia32 and x64.
-    LEGACY_$1_CPU2="$LEGACY_$1_CPU1"
-    if test "x$LEGACY_$1_CPU1" = xi586; then 
-        LEGACY_$1_CPU2=i386
-    fi
-    AC_SUBST(LEGACY_$1_CPU2)
-
-    # And the third legacy naming of the cpu.
-    # Ie only amd64 or sparcv9, used for the ISA_DIR on Solaris.
-    LEGACY_$1_CPU3=""
-    if test "x$$1_CPU" = xx64; then 
-        LEGACY_$1_CPU3=amd64
-    fi
-    if test "x$$1_CPU" = xsparcv9; then 
-        LEGACY_$1_CPU3=sparcv9
-    fi
-    AC_SUBST(LEGACY_$1_CPU3)
-])
-
+# Support macro for PLATFORM_EXTRACT_TARGET_AND_BUILD.
+# Converts autoconf style CPU name to OpenJDK style, into
+# VAR_CPU, VAR_CPU_ARCH, VAR_CPU_BITS and VAR_CPU_ENDIAN.
 AC_DEFUN([PLATFORM_EXTRACT_VARS_FROM_CPU],
 [
   # First argument is the cpu name from the trip/quad
   case "$1" in
     x86_64)
-      VAR_CPU=x64
+      VAR_CPU=x86_64
       VAR_CPU_ARCH=x86
       VAR_CPU_BITS=64
       VAR_CPU_ENDIAN=little
-      VAR_LEGACY_CPU=amd64
       ;;
     i?86)
-      VAR_CPU=ia32
+      VAR_CPU=x86
       VAR_CPU_ARCH=x86
       VAR_CPU_BITS=32
       VAR_CPU_ENDIAN=little
-      VAR_LEGACY_CPU=i586
-      ;;
-    alpha*)
-      VAR_CPU=alpha
-      VAR_CPU_ARCH=alpha
-      VAR_CPU_BITS=64
-      VAR_CPU_ENDIAN=big
-      VAR_LEGACY_CPU=alpha
       ;;
     arm*)
       VAR_CPU=arm
       VAR_CPU_ARCH=arm
       VAR_CPU_BITS=32
       VAR_CPU_ENDIAN=little
-      VAR_LEGACY_CPU=arm
       ;;
-    mips)
-      VAR_CPU=mips
-      VAR_CPU_ARCH=mips
-      VAR_CPU_BITS=woot
-      VAR_CPU_ENDIAN=woot
-      VAR_LEGACY_CPU=mips
-       ;;
-    mipsel)
-      VAR_CPU=mipsel
-      VAR_CPU_ARCH=mips
-      VAR_CPU_BITS=woot
-      VAR_CPU_ENDIAN=woot
-      VAR_LEGACY_CPU=mipsel
-       ;;
     powerpc)
       VAR_CPU=ppc
       VAR_CPU_ARCH=ppc
       VAR_CPU_BITS=32
       VAR_CPU_ENDIAN=big
-      VAR_LEGACY_CPU=ppc
        ;;
     powerpc64)
       VAR_CPU=ppc64
       VAR_CPU_ARCH=ppc
       VAR_CPU_BITS=64
       VAR_CPU_ENDIAN=big
-      VAR_LEGACY_CPU=ppc64
        ;;
     sparc)
       VAR_CPU=sparc
       VAR_CPU_ARCH=sparc
       VAR_CPU_BITS=32
       VAR_CPU_ENDIAN=big
-      VAR_LEGACY_CPU=sparc
        ;;
-    sparc64)
+    sparcv9)
       VAR_CPU=sparcv9
       VAR_CPU_ARCH=sparc
       VAR_CPU_BITS=64
       VAR_CPU_ENDIAN=big
-      VAR_LEGACY_CPU=sparcv9
-       ;;
-    s390)
-      VAR_CPU=s390
-      VAR_CPU_ARCH=s390
-      VAR_CPU_BITS=32
-      VAR_CPU_ENDIAN=woot
-      VAR_LEGACY_CPU=s390
-      VAR_LEGACY_CPU=s390
-       ;;
-    s390x)
-      VAR_CPU=s390x
-      VAR_CPU_ARCH=s390
-      VAR_CPU_BITS=64
-      VAR_CPU_ENDIAN=woot
-      VAR_LEGACY_CPU=s390x
        ;;
     *)
       AC_MSG_ERROR([unsupported cpu $1])
       ;;
   esac
-
-  # Workaround cygwin not knowing about 64 bit.
-  if test "x$VAR_OS" = "xwindows"; then
-      if test "x$PROCESSOR_IDENTIFIER" != "x"; then
-          PROC_ARCH=`echo $PROCESSOR_IDENTIFIER | $CUT -f1 -d' '`
-          case "$PROC_ARCH" in
-            intel64|Intel64|INTEL64|em64t|EM64T|amd64|AMD64|8664|x86_64)
-              VAR_CPU=x64
-              VAR_CPU_BITS=64
-              VAR_LEGACY_CPU=amd64
-              ;;
-          esac
-      fi
-  fi
-
-  # on solaris x86...default seems to be 32-bit
-  if test "x$VAR_OS" = "xsolaris" && \
-     test "x$with_target_bits" = "x" && \
-     test "x$VAR_CPU_ARCH" = "xx86"
-  then
-      with_target_bits=32
-  fi
-
-  if test "x$VAR_CPU_ARCH" = "xx86"; then
-      if test "x$with_target_bits" = "x64"; then
-          VAR_CPU=x64
-          VAR_CPU_BITS=64
-          VAR_LEGACY_CPU=amd64
-      fi
-      if test "x$with_target_bits" = "x32"; then
-          VAR_CPU=ia32
-          VAR_CPU_BITS=32
-          VAR_LEGACY_CPU=i586
-      fi
-  fi 
-
-  if test "x$VAR_CPU_ARCH" = "xsparc"; then
-      if test "x$with_target_bits" = "x64"; then
-          VAR_CPU=sparcv9
-          VAR_CPU_BITS=64
-          VAR_LEGACY_CPU=sparcv9
-      fi
-  fi 
 ])
 
+# Support macro for PLATFORM_EXTRACT_TARGET_AND_BUILD.
+# Converts autoconf style OS name to OpenJDK style, into
+# VAR_OS and VAR_OS_API.
 AC_DEFUN([PLATFORM_EXTRACT_VARS_FROM_OS],
 [
   case "$1" in
     *linux*)
       VAR_OS=linux
       VAR_OS_API=posix
-      VAR_OS_FAMILY=gnu
       ;;
     *solaris*)
       VAR_OS=solaris
       VAR_OS_API=posix
-      VAR_OS_FAMILY=sysv
       ;;
     *darwin*)
       VAR_OS=macosx
       VAR_OS_API=posix
-      VAR_OS_FAMILY=bsd
       ;;
     *bsd*)
       VAR_OS=bsd
       VAR_OS_API=posix
-      VAR_OS_FAMILY=bsd
       ;;
     *cygwin*|*windows*)
       VAR_OS=windows
       VAR_OS_API=winapi
-      VAR_OS_FAMILY=windows
       ;;
     *)
       AC_MSG_ERROR([unsupported operating system $1])
@@ -303,6 +110,208 @@
   esac
 ])
 
+# Expects $host_os $host_cpu $build_os and $build_cpu
+# and $with_target_bits to have been setup!
+#
+# Translate the standard triplet(quadruplet) definition
+# of the target/build system into OPENJDK_TARGET_OS, OPENJDK_TARGET_CPU,
+# OPENJDK_BUILD_OS, etc.
+AC_DEFUN([PLATFORM_EXTRACT_TARGET_AND_BUILD],
+[
+    # Copy the autoconf trip/quadruplet verbatim to OPENJDK_TARGET_AUTOCONF_NAME
+    # (from the autoconf "host") and OPENJDK_BUILD_AUTOCONF_NAME
+    # Note that we might later on rewrite e.g. OPENJDK_TARGET_CPU due to reduced build,
+    # but this will not change the value of OPENJDK_TARGET_AUTOCONF_NAME.     
+    OPENJDK_TARGET_AUTOCONF_NAME="$host"
+    OPENJDK_BUILD_AUTOCONF_NAME="$build"
+    AC_SUBST(OPENJDK_TARGET_AUTOCONF_NAME)
+    AC_SUBST(OPENJDK_BUILD_AUTOCONF_NAME)
+
+    # Convert the autoconf OS/CPU value to our own data, into the VAR_OS/CPU variables.
+    PLATFORM_EXTRACT_VARS_FROM_OS($host_os)
+    PLATFORM_EXTRACT_VARS_FROM_CPU($host_cpu)
+    # ... and setup our own variables. (Do this explicitely to facilitate searching)
+    OPENJDK_TARGET_OS="$VAR_OS"
+    OPENJDK_TARGET_OS_API="$VAR_OS_API"
+    OPENJDK_TARGET_CPU="$VAR_CPU"
+    OPENJDK_TARGET_CPU_ARCH="$VAR_CPU_ARCH"
+    OPENJDK_TARGET_CPU_BITS="$VAR_CPU_BITS"
+    OPENJDK_TARGET_CPU_ENDIAN="$VAR_CPU_ENDIAN"
+    AC_SUBST(OPENJDK_TARGET_OS)
+    AC_SUBST(OPENJDK_TARGET_OS_API)
+    AC_SUBST(OPENJDK_TARGET_CPU)
+    AC_SUBST(OPENJDK_TARGET_CPU_ARCH)
+    AC_SUBST(OPENJDK_TARGET_CPU_BITS)
+    AC_SUBST(OPENJDK_TARGET_CPU_ENDIAN)
+
+    # Convert the autoconf OS/CPU value to our own data, into the VAR_OS/CPU variables.
+    PLATFORM_EXTRACT_VARS_FROM_OS($build_os)
+    PLATFORM_EXTRACT_VARS_FROM_CPU($build_cpu)
+    # ..and setup our own variables. (Do this explicitely to facilitate searching)
+    OPENJDK_BUILD_OS="$VAR_OS"
+    OPENJDK_BUILD_OS_API="$VAR_OS_API"
+    OPENJDK_BUILD_CPU="$VAR_CPU"
+    OPENJDK_BUILD_CPU_ARCH="$VAR_CPU_ARCH"
+    OPENJDK_BUILD_CPU_BITS="$VAR_CPU_BITS"
+    OPENJDK_BUILD_CPU_ENDIAN="$VAR_CPU_ENDIAN"
+    AC_SUBST(OPENJDK_BUILD_OS)
+    AC_SUBST(OPENJDK_BUILD_OS_API)
+    AC_SUBST(OPENJDK_BUILD_CPU)
+    AC_SUBST(OPENJDK_BUILD_CPU_ARCH)
+    AC_SUBST(OPENJDK_BUILD_CPU_BITS)
+    AC_SUBST(OPENJDK_BUILD_CPU_ENDIAN)
+])
+
+# Check if a reduced build (32-bit on 64-bit platforms) is requested, and modify behaviour
+# accordingly. Must be done after setting up build and target system, but before
+# doing anything else with these values.
+AC_DEFUN([PLATFORM_SETUP_TARGET_CPU_BITS],
+[
+  AC_ARG_WITH(target-bits, [AS_HELP_STRING([--with-target-bits],
+     [build 32-bit or 64-bit binaries (for platforms that support it), e.g. --with-target-bits=32 @<:@guessed@:>@])])
+
+  # We have three types of compiles:
+  # native  == normal compilation, target system == build system
+  # cross   == traditional cross compilation, target system != build system; special toolchain needed
+  # reduced == using native compilers, but with special flags (e.g. -m32) to produce 32-bit builds on 64-bit machines
+  #
+  if test "x$OPENJDK_BUILD_AUTOCONF_NAME" != "x$OPENJDK_TARGET_AUTOCONF_NAME"; then
+    # We're doing a proper cross-compilation
+    COMPILE_TYPE="cross"
+  else
+    COMPILE_TYPE="native"
+  fi
+
+  if test "x$with_target_bits" != x; then
+    if test "x$COMPILE_TYPE" = "xcross"; then
+      AC_MSG_ERROR([It is not possible to combine --with-target-bits=X and proper cross-compilation. Choose either.])
+    fi
+
+    if test "x$with_target_bits" = x32 && test "x$OPENJDK_TARGET_CPU_BITS" = x64; then
+      # A reduced build is requested
+      COMPILE_TYPE="reduced"
+      OPENJDK_TARGET_CPU_BITS=32
+      if test "x$OPENJDK_TARGET_CPU_ARCH" = "xx86"; then
+        OPENJDK_TARGET_CPU=x86
+      elif test "x$OPENJDK_TARGET_CPU_ARCH" = "xsparc"; then
+        OPENJDK_TARGET_CPU=sparc
+      else
+        AC_MSG_ERROR([Reduced build (--with-target-bits=32) is only supported on x86_64 and sparcv9])
+      fi 
+    elif test "x$with_target_bits" = x64 && test "x$OPENJDK_TARGET_CPU_BITS" = x32; then
+      AC_MSG_ERROR([It is not possible to use --with-target-bits=64 on a 32 bit system. Use proper cross-compilation instead.])
+    elif test "x$with_target_bits" = "x$OPENJDK_TARGET_CPU_BITS"; then
+      AC_MSG_NOTICE([--with-target-bits are set to build platform address size; argument has no meaning])
+    else
+      AC_MSG_ERROR([--with-target-bits can only be 32 or 64, you specified $with_target_bits!])
+    fi
+  fi
+  AC_SUBST(COMPILE_TYPE)
+
+AC_MSG_CHECKING([for compilation type])
+AC_MSG_RESULT([$COMPILE_TYPE])
+])
+
+    # Setup the legacy variables, for controlling the old makefiles.
+    #
+AC_DEFUN([PLATFORM_SETUP_LEGACY_VARS],
+[
+    # Also store the legacy naming of the cpu.
+    # Ie i586 and amd64 instead of x86 and x86_64
+    OPENJDK_TARGET_CPU_LEGACY="$OPENJDK_TARGET_CPU"
+    if test "x$OPENJDK_TARGET_CPU" = xx86; then 
+      OPENJDK_TARGET_CPU_LEGACY="i586"
+    elif test "x$OPENJDK_TARGET_OS" != xmacosx && test "x$OPENJDK_TARGET_CPU" = xx86_64; then 
+      # On all platforms except MacOSX replace x86_64 with amd64.
+      OPENJDK_TARGET_CPU_LEGACY="amd64"
+    fi
+    AC_SUBST(OPENJDK_TARGET_CPU_LEGACY)
+
+    # And the second legacy naming of the cpu.
+    # Ie i386 and amd64 instead of x86 and x86_64.
+    OPENJDK_TARGET_CPU_LEGACY_LIB="$OPENJDK_TARGET_CPU"
+    if test "x$OPENJDK_TARGET_CPU" = xx86; then 
+      OPENJDK_TARGET_CPU_LEGACY_LIB="i386"
+    elif test "x$OPENJDK_TARGET_CPU" = xx86_64; then 
+      OPENJDK_TARGET_CPU_LEGACY_LIB="amd64"
+    fi
+    AC_SUBST(OPENJDK_TARGET_CPU_LEGACY_LIB)
+
+    # This is the name of the cpu (but using i386 and amd64 instead of
+    # x86 and x86_64, respectively), preceeded by a /, to be used when
+    # locating libraries. On macosx, it's empty, though.
+    OPENJDK_TARGET_CPU_LIBDIR="/$OPENJDK_TARGET_CPU_LEGACY_LIB"
+    if test "x$OPENJDK_TARGET_OS" = xmacosx; then
+        OPENJDK_TARGET_CPU_LIBDIR=""
+    fi
+    AC_SUBST(OPENJDK_TARGET_CPU_LIBDIR)
+
+    # OPENJDK_TARGET_CPU_ISADIR is normally empty. On 64-bit Solaris systems, it is set to
+    # /amd64 or /sparcv9. This string is appended to some library paths, like this:
+    # /usr/lib${OPENJDK_TARGET_CPU_ISADIR}/libexample.so
+    OPENJDK_TARGET_CPU_ISADIR=""
+    if test "x$OPENJDK_TARGET_OS" = xsolaris; then
+      if test "x$OPENJDK_TARGET_CPU" = xx86_64; then 
+          OPENJDK_TARGET_CPU_ISADIR="/amd64"
+      elif test "x$OPENJDK_TARGET_CPU" = xsparcv9; then 
+          OPENJDK_TARGET_CPU_ISADIR="/sparcv9"
+      fi
+    fi
+    AC_SUBST(OPENJDK_TARGET_CPU_ISADIR)
+
+    # Setup OPENJDK_TARGET_CPU_OSARCH, which is used to set the os.arch Java system property
+    OPENJDK_TARGET_CPU_OSARCH="$OPENJDK_TARGET_CPU"
+    if test "x$OPENJDK_TARGET_OS" = xlinux && test "x$OPENJDK_TARGET_CPU" = xx86; then
+      # On linux only, we replace x86 with i386.
+      OPENJDK_TARGET_CPU_OSARCH="i386"
+    elif test "x$OPENJDK_TARGET_OS" != xmacosx && test "x$OPENJDK_TARGET_CPU" = xx86_64; then
+      # On all platforms except macosx, we replace x86_64 with amd64.
+      OPENJDK_TARGET_CPU_OSARCH="amd64"
+    fi
+    AC_SUBST(OPENJDK_TARGET_CPU_OSARCH)
+
+    OPENJDK_TARGET_CPU_JLI="$OPENJDK_TARGET_CPU"
+    if test "x$OPENJDK_TARGET_CPU" = xx86; then 
+      OPENJDK_TARGET_CPU_JLI="i386"
+    elif test "x$OPENJDK_TARGET_OS" != xmacosx && test "x$OPENJDK_TARGET_CPU" = xx86_64; then
+      # On all platforms except macosx, we replace x86_64 with amd64.
+      OPENJDK_TARGET_CPU_JLI="amd64"
+    fi
+    # Now setup the -D flags for building libjli.
+    OPENJDK_TARGET_CPU_JLI_CFLAGS="-DLIBARCHNAME='\"$OPENJDK_TARGET_CPU_JLI\"'"
+    if test "x$OPENJDK_TARGET_OS" = xsolaris; then
+      if test "x$OPENJDK_TARGET_CPU_ARCH" = xsparc; then
+        OPENJDK_TARGET_CPU_JLI_CFLAGS="$OPENJDK_TARGET_CPU_JLI_CFLAGS -DLIBARCH32NAME='\"sparc\"' -DLIBARCH64NAME='\"sparcv9\"'"
+      elif test "x$OPENJDK_TARGET_CPU_ARCH" = xx86; then 
+        OPENJDK_TARGET_CPU_JLI_CFLAGS="$OPENJDK_TARGET_CPU_JLI_CFLAGS -DLIBARCH32NAME='\"i386\"' -DLIBARCH64NAME='\"amd64\"'"
+      fi
+    fi
+    AC_SUBST(OPENJDK_TARGET_CPU_JLI_CFLAGS)
+
+    # Setup OPENJDK_TARGET_OS_API_DIR, used in source paths.
+    if test "x$OPENJDK_TARGET_OS_API" = xposix; then
+        OPENJDK_TARGET_OS_API_DIR="solaris"
+    fi
+    if test "x$OPENJDK_TARGET_OS_API" = xwinapi; then
+        OPENJDK_TARGET_OS_API_DIR="windows"
+    fi
+    AC_SUBST(OPENJDK_TARGET_OS_API_DIR)
+
+    if test "x$OPENJDK_TARGET_CPU_BITS" = x64; then
+        A_LP64="LP64:="
+        ADD_LP64="-D_LP64=1"
+    fi
+    AC_SUBST(LP64,$A_LP64)
+
+    if test "x$COMPILE_TYPE" = "xcross"; then
+      # FIXME: ... or should this include reduced builds..?
+      DEFINE_CROSS_COMPILE_ARCH="CROSS_COMPILE_ARCH:=$OPENJDK_TARGET_CPU_LEGACY"
+    else
+      DEFINE_CROSS_COMPILE_ARCH=""
+    fi
+    AC_SUBST(DEFINE_CROSS_COMPILE_ARCH)
+])
+
 AC_DEFUN([PLATFORM_SET_RELEASE_FILE_OS_VALUES],
 [
     if test "x$OPENJDK_TARGET_OS" = "xsolaris"; then
@@ -315,7 +324,11 @@
     fi
     if test "x$OPENJDK_TARGET_OS" = "xwindows"; then
         REQUIRED_OS_NAME=Windows
-        REQUIRED_OS_VERSION=5.1
+        if test "x$OPENJDK_TARGET_CPU_BITS" = "x64"; then
+            REQUIRED_OS_VERSION=5.2
+        else
+            REQUIRED_OS_VERSION=5.1
+        fi
     fi
     if test "x$OPENJDK_TARGET_OS" = "xmacosx"; then
         REQUIRED_OS_NAME=Darwin
@@ -338,42 +351,10 @@
 AC_CANONICAL_HOST
 AC_CANONICAL_TARGET
 
-AC_ARG_WITH(target-bits, [AS_HELP_STRING([--with-target-bits],
-   [build 32-bit or 64-bit binaries (for platforms that support it), e.g. --with-target-bits=32 @<:@guessed@:>@])])
-
-if test "x$with_target_bits" != x && \
-   test "x$with_target_bits" != x32 && \
-   test "x$with_target_bits" != x64 ; then
-    AC_MSG_ERROR([--with-target-bits can only be 32 or 64, you specified $with_target_bits!])
-fi
-# Translate the standard cpu-vendor-kernel-os quadruplets into
-# the new TARGET_.... and BUILD_... and the legacy names used by
-# the openjdk build.
-# It uses $host_os $host_cpu $build_os $build_cpu and $with_target_bits
-PLATFORM_EXTRACT_TARGET_AND_BUILD_AND_LEGACY_VARS
-
-# The LEGACY_OPENJDK_TARGET_CPU3 is the setting for ISA_DIR.
-if test "x$LEGACY_OPENJDK_TARGET_CPU3" != x; then
-   LEGACY_OPENJDK_TARGET_CPU3="/${LEGACY_OPENJDK_TARGET_CPU3}"
-fi
-
-# Now the following vars are defined.
-# OPENJDK_TARGET_OS=aix,bsd,hpux,linux,macosx,solaris,windows
-# OPENJDK_TARGET_OS_FAMILY=bsd,gnu,sysv,win32,wince
-# OPENJDK_TARGET_OS_API=posix,winapi
-#
-# OPENJDK_TARGET_CPU=ia32,x64,sparc,sparcv9,arm,arm64,ppc,ppc64
-# OPENJDK_TARGET_CPU_ARCH=x86,sparc,pcc,arm
-# OPENJDK_TARGET_CPU_BITS=32,64
-# OPENJDK_TARGET_CPU_ENDIAN=big,little
-#
-# There is also a:
-# LEGACY_OPENJDK_TARGET_CPU1=i586,amd64,....  # used to set the old var ARCH
-# LEGACY_OPENJDK_TARGET_CPU2=i386,amd64,.... # used to set the old var LIBARCH
-# LEGACY_OPENJDK_TARGET_CPU3=only sparcv9,amd64 # used to set the ISA_DIR on Solaris
-# There was also a BUILDARCH that had i486,amd64,... but we do not use that
-# in the new build.
-# LEGACY_OPENJDK_TARGET_OS_API=solaris,windows # used to select source roots
+PLATFORM_EXTRACT_TARGET_AND_BUILD
+PLATFORM_SETUP_TARGET_CPU_BITS
+PLATFORM_SET_RELEASE_FILE_OS_VALUES
+PLATFORM_SETUP_LEGACY_VARS
 ])
 
 AC_DEFUN_ONCE([PLATFORM_SETUP_OPENJDK_BUILD_OS_VERSION],
@@ -391,7 +372,26 @@
 AC_SUBST(OS_VERSION_MICRO)
 ])
 
-AC_DEFUN_ONCE([PLATFORM_TEST_OPENJDK_TARGET_BITS],
+# Support macro for PLATFORM_SETUP_OPENJDK_TARGET_BITS.
+# Add -mX to various FLAGS variables.
+AC_DEFUN([PLATFORM_SET_COMPILER_TARGET_BITS_FLAGS],
+[
+  # keep track of c/cxx flags that we added outselves...
+  #   to prevent emitting warning...
+  ADDED_CFLAGS=" -m${OPENJDK_TARGET_CPU_BITS}"
+  ADDED_CXXFLAGS=" -m${OPENJDK_TARGET_CPU_BITS}"
+  ADDED_LDFLAGS=" -m${OPENJDK_TARGET_CPU_BITS}"
+
+  CFLAGS="${CFLAGS}${ADDED_CFLAGS}"
+  CXXFLAGS="${CXXFLAGS}${ADDED_CXXFLAGS}"
+  LDFLAGS="${LDFLAGS}${ADDED_LDFLAGS}"
+
+  CFLAGS_JDK="${CFLAGS_JDK}${ADDED_CFLAGS}"
+  CXXFLAGS_JDK="${CXXFLAGS_JDK}${ADDED_CXXFLAGS}"
+  LDFLAGS_JDK="${LDFLAGS_JDK}${ADDED_LDFLAGS}"
+])
+
+AC_DEFUN_ONCE([PLATFORM_SETUP_OPENJDK_TARGET_BITS],
 [
 ###############################################################################
 #
@@ -399,72 +399,47 @@
 # (The JVM can use 32 or 64 bit Java pointers but that decision
 # is made at runtime.)
 #
-AC_LANG_PUSH(C++)
-OLD_CXXFLAGS="$CXXFLAGS"
-if test "x$OPENJDK_TARGET_OS" != xwindows && test "x$with_target_bits" != x; then
-	CXXFLAGS="-m${with_target_bits} $CXXFLAGS"
+if test "x$OPENJDK_TARGET_OS" = xsolaris; then
+  # Always specify -m flags on Solaris
+  PLATFORM_SET_COMPILER_TARGET_BITS_FLAGS
+elif test "x$COMPILE_TYPE" = xreduced; then
+  if test "x$OPENJDK_TARGET_OS" != xwindows; then
+    # Specify -m if running reduced on other Posix platforms
+    PLATFORM_SET_COMPILER_TARGET_BITS_FLAGS
+  fi
 fi
-AC_CHECK_SIZEOF([int *], [1111])
-CXXFLAGS="$OLD_CXXFLAGS"
-AC_LANG_POP(C++)
-
-# keep track of c/cxx flags that we added outselves...
-#   to prevent emitting warning...
-ADDED_CFLAGS=
-ADDED_CXXFLAGS=
-ADDED_LDFLAGS=
 
-if test "x$ac_cv_sizeof_int_p" = x0; then 
-    # The test failed, lets pick the assumed value.
-    ARCH_DATA_MODEL=$OPENJDK_TARGET_CPU_BITS
-else
-    ARCH_DATA_MODEL=`expr 8 \* $ac_cv_sizeof_int_p`
+# Make compilation sanity check
+AC_CHECK_HEADERS([stdio.h], , [
+  AC_MSG_NOTICE([Failed to compile stdio.h. This likely implies missing compile dependencies.])
+  if test "x$COMPILE_TYPE" = xreduced; then
+    AC_MSG_NOTICE([You are doing a reduced build. Check that you have 32-bit libraries installed.])
+  elif test "x$COMPILE_TYPE" = xcross; then
+    AC_MSG_NOTICE([You are doing a cross-compilation. Check that you have all target platform libraries installed.])
+  fi
+  AC_MSG_ERROR([Cannot continue.])
+])
+
+AC_CHECK_SIZEOF([int *], [1111])
 
-    if test "x$OPENJDK_TARGET_OS" != xwindows && test "x$with_target_bits" != x; then
-       ADDED_CFLAGS=" -m${with_target_bits}"
-       ADDED_CXXFLAGS=" -m${with_target_bits}"
-       ADDED_LDFLAGS=" -m${with_target_bits}"
+if test "x$SIZEOF_INT_P" != "x$ac_cv_sizeof_int_p"; then
+  # Workaround autoconf bug, see http://lists.gnu.org/archive/html/autoconf/2010-07/msg00004.html
+  SIZEOF_INT_P="$ac_cv_sizeof_int_p"
+fi
 
-       CFLAGS="${CFLAGS}${ADDED_CFLAGS}"
-       CXXFLAGS="${CXXFLAGS}${ADDED_CXXFLAGS}"
-       LDFLAGS="${LDFLAGS}${ADDED_LDFLAGS}"
+if test "x$SIZEOF_INT_P" = x; then 
+    # The test failed, lets stick to the assumed value.
+    AC_MSG_WARN([The number of bits in the target could not be determined, using $OPENJDK_TARGET_CPU_BITS.])
+else
+    TESTED_TARGET_CPU_BITS=`expr 8 \* $SIZEOF_INT_P`
 
-       CFLAGS_JDK="${CFLAGS_JDK}${ADDED_CFLAGS}"
-       CXXFLAGS_JDK="${CXXFLAGS_JDK}${ADDED_CXXFLAGS}"
-       LDFLAGS_JDK="${LDFLAGS_JDK}${ADDED_LDFLAGS}"
+    if test "x$TESTED_TARGET_CPU_BITS" != "x$OPENJDK_TARGET_CPU_BITS"; then
+        AC_MSG_ERROR([The tested number of bits in the target ($TESTED_TARGET_CPU_BITS) differs from the number of bits expected to be found in the target ($OPENJDK_TARGET_CPU_BITS)])
     fi
 fi
 
-if test "x$ARCH_DATA_MODEL" = x64; then
-    A_LP64="LP64:="
-    ADD_LP64="-D_LP64=1"
-fi
 AC_MSG_CHECKING([for target address size])
-AC_MSG_RESULT([$ARCH_DATA_MODEL bits])
-AC_SUBST(LP64,$A_LP64)
-AC_SUBST(ARCH_DATA_MODEL)
-
-if test "x$ARCH_DATA_MODEL" != "x$OPENJDK_TARGET_CPU_BITS"; then
-    AC_MSG_ERROR([The tested number of bits in the target ($ARCH_DATA_MODEL) differs from the number of bits expected to be found in the target ($OPENJDK_TARGET_CPU_BITS)])
-fi
-
-#
-# NOTE: check for -mstackrealign needs to be below potential addition of -m32
-#
-if test "x$OPENJDK_TARGET_CPU_BITS" = x32 && test "x$OPENJDK_TARGET_OS" = xmacosx; then
-    # On 32-bit MacOSX the OS requires C-entry points to be 16 byte aligned.
-    # While waiting for a better solution, the current workaround is to use -mstackrealign.
-    CFLAGS="$CFLAGS -mstackrealign"
-    AC_MSG_CHECKING([if 32-bit compiler supports -mstackrealign])
-    AC_LINK_IFELSE([AC_LANG_SOURCE([[int main() { return 0; }]])],
-                   [
-		        AC_MSG_RESULT([yes])
-                   ],
-	           [
-		        AC_MSG_RESULT([no])
-	                AC_MSG_ERROR([The selected compiler $CXX does not support -mstackrealign! Try to put another compiler in the path.])
-	           ])
-fi
+AC_MSG_RESULT([$OPENJDK_TARGET_CPU_BITS bits])
 ])
 
 AC_DEFUN_ONCE([PLATFORM_SETUP_OPENJDK_TARGET_ENDIANNESS],
@@ -478,21 +453,7 @@
 if test "x$ENDIAN" = xuniversal_endianness; then
     AC_MSG_ERROR([Building with both big and little endianness is not supported])
 fi
-if test "x$ENDIAN" = xunknown; then
-    ENDIAN="$OPENJDK_TARGET_CPU_ENDIAN"
+if test "x$ENDIAN" != "x$OPENJDK_TARGET_CPU_ENDIAN"; then
+    AC_MSG_ERROR([The tested endian in the target ($ENDIAN) differs from the endian expected to be found in the target ($OPENJDK_TARGET_CPU_ENDIAN)])
 fi
-if test "x$ENDIAN" != "x$OPENJDK_TARGET_CPU_ENDIAN"; then
-    AC_MSG_WARN([The tested endian in the target ($ENDIAN) differs from the endian expected to be found in the target ($OPENJDK_TARGET_CPU_ENDIAN)])
-    ENDIAN="$OPENJDK_TARGET_CPU_ENDIAN"
-fi
-AC_SUBST(ENDIAN)
 ])
-
-AC_DEFUN_ONCE([PLATFORM_SETUP_OPENJDK_TARGET_ISADIR],
-[
-###############################################################################
-#
-# Could someone enlighten this configure script with a comment about libCrun?
-#
-#
-])
--- a/common/autoconf/source-dirs.m4	Wed Jul 05 18:22:17 2017 +0200
+++ b/common/autoconf/source-dirs.m4	Wed Jul 05 18:22:52 2017 +0200
@@ -250,31 +250,8 @@
 
 AC_DEFUN_ONCE([SRCDIRS_SETUP_OUTPUT_DIRS],
 [
-LANGTOOLS_OUTPUTDIR="$OUTPUT_ROOT/langtools"
-CORBA_OUTPUTDIR="$OUTPUT_ROOT/corba"
-JAXP_OUTPUTDIR="$OUTPUT_ROOT/jaxp"
-JAXWS_OUTPUTDIR="$OUTPUT_ROOT/jaxws"
-HOTSPOT_OUTPUTDIR="$OUTPUT_ROOT/hotspot"
-JDK_OUTPUTDIR="$OUTPUT_ROOT/jdk"
-IMAGES_OUTPUTDIR="$OUTPUT_ROOT/images"
+BUILD_OUTPUT="$OUTPUT_ROOT"
+AC_SUBST(BUILD_OUTPUT)
 
-AC_SUBST(LANGTOOLS_OUTPUTDIR)
-AC_SUBST(CORBA_OUTPUTDIR)
-AC_SUBST(JAXP_OUTPUTDIR)
-AC_SUBST(JAXWS_OUTPUTDIR)
-AC_SUBST(HOTSPOT_OUTPUTDIR)
-AC_SUBST(JDK_OUTPUTDIR)
-AC_SUBST(IMAGES_OUTPUTDIR)
-
-LANGTOOLS_DIST="$OUTPUT_ROOT/langtools/dist"
-CORBA_DIST="$OUTPUT_ROOT/corba/dist"
-JAXP_DIST="$OUTPUT_ROOT/jaxp/dist"
-JAXWS_DIST="$OUTPUT_ROOT/jaxws/dist"
-HOTSPOT_DIST="$OUTPUT_ROOT/hotspot/dist"
-
-AC_SUBST(LANGTOOLS_DIST)
-AC_SUBST(CORBA_DIST)
-AC_SUBST(JAXP_DIST)
-AC_SUBST(JAXWS_DIST)
-AC_SUBST(HOTSPOT_DIST)
+JDK_OUTPUTDIR="$OUTPUT_ROOT/jdk"
 ])
--- a/common/autoconf/spec.gmk.in	Wed Jul 05 18:22:17 2017 +0200
+++ b/common/autoconf/spec.gmk.in	Wed Jul 05 18:22:52 2017 +0200
@@ -23,7 +23,11 @@
 # questions.
 #
 
-# Configured @DATE_WHEN_CONFIGURED@ to build for a @OPENJDK_TARGET_SYSTEM@ system,
+# Configured @DATE_WHEN_CONFIGURED@ to build
+# for target system @OPENJDK_TARGET_OS@-@OPENJDK_TARGET_CPU@
+#   (called @OPENJDK_TARGET_AUTOCONF_NAME@ by autoconf)
+# on build system @OPENJDK_BUILD_OS@-@OPENJDK_BUILD_CPU@
+#   (called @OPENJDK_BUILD_AUTOCONF_NAME@ by autoconf)
 # using 'configure @CONFIGURE_COMMAND_LINE@'
 
 # When calling macros, the spaces between arguments are 
@@ -40,6 +44,17 @@
 define NEWLINE:=
 endef
 
+# A self-referential reference to this file.
+SPEC:=@SPEC@
+
+# Specify where the spec file is.
+MAKE_ARGS="SPEC=$(SPEC)"
+
+# TODO The logic for finding and setting MAKE is currently not working 
+# well on windows. Disable it TEMPORARILY there for now.
+ifneq (@OPENJDK_TARGET_OS@,windows)
+    MAKE:=@MAKE@
+endif
 
 # Pass along the verbosity setting.
 ifeq (,$(findstring VERBOSE=,$(MAKE)))
@@ -51,27 +66,16 @@
     MAKE:=$(MAKE) -R
 endif
 
-# Specify where the spec file is.
-ifeq (,$(findstring SPEC=,$(MAKE)))
-    MAKE:=$(MAKE) SPEC=@SPEC@
-endif
-
 # Specify where the common include directory for makefiles is.
 ifeq (,$(findstring -I @SRC_ROOT@/common/makefiles,$(MAKE)))
     MAKE:=$(MAKE) -I @SRC_ROOT@/common/makefiles
 endif
 
-# A self-referential reference to this file.
-SPEC:=@SPEC@
-
 # The "human readable" name of this configuration
 CONF_NAME:=@CONF_NAME@
 
 # The built jdk will run in this target system.
-OPENJDK_TARGET_SYSTEM:=@OPENJDK_TARGET_SYSTEM@
-
 OPENJDK_TARGET_OS:=@OPENJDK_TARGET_OS@
-OPENJDK_TARGET_OS_FAMILY:=@OPENJDK_TARGET_OS_FAMILY@
 OPENJDK_TARGET_OS_API:=@OPENJDK_TARGET_OS_API@
 
 OPENJDK_TARGET_CPU:=@OPENJDK_TARGET_CPU@
@@ -79,12 +83,20 @@
 OPENJDK_TARGET_CPU_BITS:=@OPENJDK_TARGET_CPU_BITS@
 OPENJDK_TARGET_CPU_ENDIAN:=@OPENJDK_TARGET_CPU_ENDIAN@
 
+COMPILE_TYPE:=@COMPILE_TYPE@
+
+# Legacy support
+OPENJDK_TARGET_CPU_ISADIR:=@OPENJDK_TARGET_CPU_ISADIR@
+OPENJDK_TARGET_CPU_LIBDIR:=@OPENJDK_TARGET_CPU_LIBDIR@
+OPENJDK_TARGET_CPU_LEGACY:=@OPENJDK_TARGET_CPU_LEGACY@
+OPENJDK_TARGET_CPU_LEGACY_LIB:=@OPENJDK_TARGET_CPU_LEGACY_LIB@
+OPENJDK_TARGET_CPU_OSARCH:=@OPENJDK_TARGET_CPU_OSARCH@
+OPENJDK_TARGET_CPU_JLI_CFLAGS:=@OPENJDK_TARGET_CPU_JLI_CFLAGS@
+OPENJDK_TARGET_OS_API_DIR:=@OPENJDK_TARGET_OS_API_DIR@
+
 # We are building on this build system.
 # When not cross-compiling, it is the same as the target.
-OPENJDK_BUILD_SYSTEM:=@OPENJDK_BUILD_SYSTEM@
-
 OPENJDK_BUILD_OS:=@OPENJDK_BUILD_OS@
-OPENJDK_BUILD_OS_FAMILY:=@OPENJDK_BUILD_OS_FAMILY@
 OPENJDK_BUILD_OS_API:=@OPENJDK_BUILD_OS_API@
 
 OPENJDK_BUILD_CPU:=@OPENJDK_BUILD_CPU@
@@ -96,21 +108,6 @@
 REQUIRED_OS_NAME:=@REQUIRED_OS_NAME@
 REQUIRED_OS_VERSION:=@REQUIRED_OS_VERSION@
 
-# Old name for OPENJDK_TARGET_OS (aix,bsd,hpux,linux,macosx,solaris,windows etc)
-PLATFORM:=@OPENJDK_TARGET_OS@
-# Old name for OPENJDK_TARGET_CPU, uses i586 and amd64, instead of ia32 and x64.
-ARCH:=@LEGACY_OPENJDK_TARGET_CPU1@
-# Yet another name for arch used for an extra subdir below the jvm lib.
-# Uses i386 and amd64, instead of ia32 and x64.
-LIBARCH:=@LEGACY_OPENJDK_TARGET_CPU2@
-# Use to switch between solaris and windows subdirs in the jdk.
-LEGACY_OPENJDK_TARGET_OS_API:=@LEGACY_OPENJDK_TARGET_OS_API@
-# 32 or 64 bit
-ARCH_DATA_MODEL:=@OPENJDK_TARGET_CPU_BITS@
-# Legacy setting for building for a 64 bit machine.
-# If yes then this expands to _LP64:=1
-@LP64@
-ENDIAN:=@OPENJDK_TARGET_CPU_ENDIAN@
 @SET_OPENJDK@
 JIGSAW:=@JIGSAW@
 LIBM:=-lm
@@ -143,6 +140,9 @@
 HOTSPOT_TOPDIR:=@HOTSPOT_TOPDIR@
 COPYRIGHT_YEAR:=@COPYRIGHT_YEAR@
 
+# Location where build customization files may be found
+CUSTOM_MAKE_DIR:=@CUSTOM_MAKE_DIR@
+
 # Information gathered from the version.numbers file.
 JDK_MAJOR_VERSION:=@JDK_MAJOR_VERSION@
 JDK_MINOR_VERSION:=@JDK_MINOR_VERSION@
@@ -171,17 +171,12 @@
 # The JDK variant is a name for a specific set of modules to be compiled for the JDK.
 JDK_VARIANT:=@JDK_VARIANT@
 
-# Legacy defines controlling the JDK variant embedded.
-@JAVASE_EMBEDDED@
-@MINIMIZE_RAM_USAGE@
-
 # Should we compile support for running with a graphical UI? (ie headful)
 # Should we compile support for running without? (ie headless)
 SUPPORT_HEADFUL:=@SUPPORT_HEADFUL@
 SUPPORT_HEADLESS:=@SUPPORT_HEADLESS@
 # Legacy defines controlled by the SUPPORT_HEADLESS and SUPPORT_HEADFUL options.
 @BUILD_HEADLESS@
-@BUILD_HEADLESS_ONLY@
 
 # These are the libjvms that we want to build.
 # The java launcher uses the default.
@@ -194,53 +189,43 @@
 JVM_VARIANT_ZERO:=@JVM_VARIANT_ZERO@
 JVM_VARIANT_ZEROSHARK:=@JVM_VARIANT_ZEROSHARK@
 
-# Legacy setting: OPT or DBG
-VARIANT:=@VARIANT@
-# Legacy setting: true or false
-FASTDEBUG:=@FASTDEBUG@
-# Legacy setting: debugging the class files?
-DEBUG_CLASSFILES:=@DEBUG_CLASSFILES@
+# Universal binaries on macosx
+MACOSX_UNIVERSAL=@MACOSX_UNIVERSAL@
+
 # Legacy setting: -debug or -fastdebug
+# Still used in version string...
 BUILD_VARIANT_RELEASE:=@BUILD_VARIANT_RELEASE@
 
-LANGTOOLS_OUTPUTDIR:=@LANGTOOLS_OUTPUTDIR@
-CORBA_OUTPUTDIR:=@CORBA_OUTPUTDIR@
-JAXP_OUTPUTDIR:=@JAXP_OUTPUTDIR@
-JAXWS_OUTPUTDIR:=@JAXWS_OUTPUTDIR@
-HOTSPOT_OUTPUTDIR:=@HOTSPOT_OUTPUTDIR@
-
-# This where a working jvm is built.
+# JDK_OUTPUTDIR specifies where a working jvm is built.
 # You can run $(JDK_OUTPUTDIR)/bin/java
 # Though the layout of the contents of $(JDK_OUTPUTDIR) is not
 # yet the same as a default installation.
-JDK_OUTPUTDIR:=@OUTPUT_ROOT@/jdk
-
+#
 # When you run "make install" it will create the standardized
-# layout for the jdk and the jre inside the images subdir.
+# layout for the jdk and the jre inside the IMAGES_OUTPUTDIR subdir.
 # Then it will copy the contents of the jdk into the installation
 # directory.
-IMAGES_OUTPUTDIR:=@OUTPUT_ROOT@/images
-
-LANGTOOLS_DIST:=@LANGTOOLS_DIST@
-CORBA_DIST:=@CORBA_DIST@
-JAXP_DIST:=@JAXP_DIST@
-JAXWS_DIST:=@JAXWS_DIST@
-HOTSPOT_DIST:=@HOTSPOT_DIST@
 
-# Legacy variables used by Release.gmk
-JDK_IMAGE_DIR:=$(IMAGES_OUTPUTDIR)/j2sdk-image
-JRE_IMAGE_DIR:=$(IMAGES_OUTPUTDIR)/j2re-image
+BUILD_OUTPUT:=@BUILD_OUTPUT@
+LANGTOOLS_OUTPUTDIR=$(BUILD_OUTPUT)/langtools
+CORBA_OUTPUTDIR=$(BUILD_OUTPUT)/corba
+JAXP_OUTPUTDIR=$(BUILD_OUTPUT)/jaxp
+JAXWS_OUTPUTDIR=$(BUILD_OUTPUT)/jaxws
+HOTSPOT_OUTPUTDIR=$(BUILD_OUTPUT)/hotspot
+JDK_OUTPUTDIR=$(BUILD_OUTPUT)/jdk
+IMAGES_OUTPUTDIR=$(BUILD_OUTPUT)/images
 
-# Can be /sparcv9 or /amd64 on Solaris
-ISA_DIR:=@LEGACY_OPENJDK_TARGET_CPU3@
-BINDIR:=$(JDK_OUTPUTDIR)/bin$(ISA_DIR)
+LANGTOOLS_DIST=$(LANGTOOLS_OUTPUTDIR)/dist
+CORBA_DIST=$(CORBA_OUTPUTDIR)/dist
+JAXP_DIST=$(JAXP_OUTPUTDIR)/dist
+JAXWS_DIST=$(JAXWS_OUTPUTDIR)/dist
+HOTSPOT_DIST=$(HOTSPOT_OUTPUTDIR)/dist
 
 # The boot jdk to use
-ALT_BOOTDIR:=@BOOT_JDK@
 BOOT_JDK:=@BOOT_JDK@
 BOOT_JDK_JVMARGS:=@BOOT_JDK_JVMARGS@
 BOOT_RTJAR:=@BOOT_RTJAR@
-BOOT_TOOLSJAR:=@BOOT_TOOLSJAR@
+BOOT_TOOLSJAR=$(BOOT_JDK)/lib/tools.jar
 
 # When compiling Java source to be run by the boot jdk
 # use these extra flags, eg -source 6 -target 6
@@ -248,30 +233,18 @@
 
 # Information about the build system
 NUM_CORES:=@NUM_CORES@
-# This is used from the jdk build for C/C++ code.
-PARALLEL_COMPILE_JOBS:=@CONCURRENT_BUILD_JOBS@
-# Store javac server synchronization files here, and
-# the javac server log files.
-JAVAC_SERVERS:=@JAVAC_SERVERS@
-# Should we use a javac server or not? The javac server gives
-# an enormous performance improvement since it reduces the
-# startup costs of javac and reuses as much as possible of intermediate
-# compilation work. But if we want to compile with a non-Java
-# javac compiler, like gcj. Then we cannot use javac server and
-# this variable is set to false.
-JAVAC_USE_REMOTE:=@JAVAC_USE_REMOTE@
+# Enable sjavac support = use a javac server,
+# multi core javac compilation and dependency tracking.
+ENABLE_SJAVAC:=@ENABLE_SJAVAC@
+# Store sjavac server synchronization files here, and
+# the sjavac server log files.
+SJAVAC_SERVER_DIR:=@SJAVAC_SERVER_DIR@
 # We can block the Javac server to never use more cores than this.
 # This is not for performance reasons, but for memory usage, since each
 # core requires its own JavaCompiler. We might have 64 cores and 4GB
 # of memory, 64 JavaCompilers will currently not fit in a 3GB heap.
 # Since there is no sharing of data between the JavaCompilers.
-JAVAC_SERVER_CORES:=@JAVAC_SERVER_CORES@
-# Should we use dependency tracking between Java packages? true or false.
-JAVAC_USE_DEPS:=@JAVAC_USE_DEPS@
-# We can invoke javac: SINGLE_THREADED_BATCH or MULTI_CORE_CONCURRENT
-JAVAC_USE_MODE:=@JAVAC_USE_MODE@
-# Enable not yet complete sjavac support.
-ENABLE_SJAVAC:=@ENABLE_SJAVAC@
+SJAVAC_SERVER_CORES:=@SJAVAC_SERVER_CORES@
 
 # The OpenJDK makefiles should be changed to using the standard
 # configure output ..._CFLAGS and ..._LIBS. In the meantime we
@@ -280,7 +253,6 @@
 FREETYPE2_LIBS:=@FREETYPE2_LIBS@
 FREETYPE2_CFLAGS:=@FREETYPE2_CFLAGS@
 USING_SYSTEM_FT_LIB=@USING_SYSTEM_FT_LIB@
-ALT_CUPS_HEADERS_PATH:=$(patsubst -I%,%,$(filter -I%,@CUPS_CFLAGS@))
 CUPS_CFLAGS:=@CUPS_CFLAGS@
 
 PACKAGE_PATH=@PACKAGE_PATH@
@@ -288,8 +260,6 @@
 # Source file for cacerts
 CACERTS_FILE=@CACERTS_FILE@
 
-#MOZILLA_HEADERS_PATH:=
-
 # Necessary additional compiler flags to compile X11 
 X_CFLAGS:=@X_CFLAGS@
 X_LIBS:=@X_LIBS@
@@ -338,7 +308,7 @@
 CPP:=@UNCYGDRIVE@ @CPP@
 #CPPFLAGS:=@CPPFLAGS@
 
-# The linker can be gcc or ld on posix systems, or link.exe on winapi systems.
+# The linker can be gcc or ld on posix systems, or link.exe on windows systems.
 LD:=@UNCYGDRIVE@ @LD@
 
 # LDFLAGS used to link the jdk native libraries (C-code)
@@ -353,6 +323,9 @@
 LDFLAGS_JDKEXE:=@LDFLAGS_JDKEXE@
 LDFLAGS_JDKEXE_SUFFIX:=@LDFLAGS_JDKEXE_SUFFIX@
 
+# LDFLAGS specific to C++ linking.
+LDFLAGS_CXX_JDK:=@LDFLAGS_CXX_JDK@
+
 # Sometimes a different linker is needed for c++ libs
 LDCXX:=@UNCYGDRIVE@ @LDCXX@
 # The flags for linking libstdc++ linker.
@@ -361,28 +334,22 @@
 # Sometimes a different linker is needed for c++ executables
 LDEXECXX:=@UNCYGDRIVE@ @LDEXECXX@
 
-# If cross compiling, then define CROSS_COMPILE_ARCH:=cpu_name here.
-@DEFINE_CROSS_COMPILE_ARCH@
-# The HOSTCC should really be named BUILDCC, ie build executable for
-# the build platform. Same as CC when not cross compiling.
-HOSTCC:=@UNCYGDRIVE@ @HOSTCC@
-HOSTCXX:=@UNCYGDRIVE@ @HOSTCXX@
-# And of course, the jdk spells HOSTCC as NIO_CC/HOST_CC 
-HOST_CC:=@UNCYGDRIVE@ @HOSTCC@
-NIO_CC:=@UNCYGDRIVE@ @HOSTCC@
-
-HOST_LD:=@UNCYGDRIVE@ @HOSTLD@
+# BUILD_CC/BUILD_LD is a compiler/linker that generates code that is runnable on the
+# build platform.
+BUILD_CC:=@UNCYGDRIVE@ @BUILD_CC@
+BUILD_LD:=@UNCYGDRIVE@ @BUILD_LD@
 
 AS:=@UNCYGDRIVE@ @AS@
-ASFLAGS:=@ASFLAGS@
 
-# AR is used to create a static library (is ar in posix, lib.exe in winapi)
+# AR is used to create a static library (is ar in posix, lib.exe in windows)
 AR:=@UNCYGDRIVE@ @AR@
 ARFLAGS:=@ARFLAGS@
 
-NM:=@UNCYGDRIVE@ @NM@
-STRIP:=@UNCYGDRIVE@ @STRIP@
-MCS:=@UNCYGDRIVE@ @MCS@
+NM:=@NM@
+STRIP:=@STRIP@
+MCS:=@MCS@
+
+LIPO:=@LIPO@
 
 # Command to create a shared library
 SHARED_LIBRARY_FLAGS:=@SHARED_LIBRARY_FLAGS@
@@ -414,6 +381,7 @@
 # Set origin using the linker, ie use the relative path to the dependent library to find the dependees.
 # (Note absence of := assignment, because we do not want to evaluate the macro body here)
 SET_SHARED_LIBRARY_ORIGIN=@SET_SHARED_LIBRARY_ORIGIN@
+SET_EXECUTABLE_ORIGIN=@SET_EXECUTABLE_ORIGIN@
 
 # Different OS:es have different ways of naming shared libraries.
 # The SHARED_LIBRARY macro takes "verify" as and argument and returns:
@@ -432,21 +400,20 @@
 
 JAVA_FLAGS:=@BOOT_JDK_JVMARGS@
 
-JAVA=@UNCYGDRIVE@ @JAVA@ $(JAVA_FLAGS)
+JAVA=@UNCYGDRIVE@ $(BOOT_JDK)/bin/java $(JAVA_FLAGS)
 
-JAVAC:=@UNCYGDRIVE@ @JAVAC@
-JAVAC_FLAGS:=@JAVAC_FLAGS@
-
-JAVAH:=@UNCYGDRIVE@ @JAVAH@
+JAVAC=@UNCYGDRIVE@ $(BOOT_JDK)/bin/javac
+# Hotspot sets this variable before reading the SPEC when compiling sa-jdi.jar. Avoid
+# overriding that value by using ?=.
+JAVAC_FLAGS?=@JAVAC_FLAGS@
 
-JAR:=@UNCYGDRIVE@ @JAR@
+JAVAH=@UNCYGDRIVE@ $(BOOT_JDK)/bin/javah
 
-RMIC:=@UNCYGDRIVE@ @RMIC@
+JAR=@UNCYGDRIVE@ $(BOOT_JDK)/bin/jar
 
-NATIVE2ASCII:=@UNCYGDRIVE@ @NATIVE2ASCII@
+RMIC=@UNCYGDRIVE@ $(BOOT_JDK)/bin/rmic
 
-BOOT_JAR_CMD:=@UNCYGDRIVE@ @JAR@
-BOOT_JAR_JFLAGS:=
+NATIVE2ASCII=@UNCYGDRIVE@ $(BOOT_JDK)/bin/native2ascii
 
 # Base flags for RC
 # Guarding this against resetting value. Legacy make files include spec multiple
@@ -456,11 +423,12 @@
 endif
 
 # A specific java binary with specific options can be used to run
-# the long running background javac server and other long running tasks.
-SERVER_JAVA:=@UNCYGDRIVE@ @SERVER_JAVA@
+# the long running background sjavac servers and other long running tasks.
+SJAVAC_SERVER_JAVA:=@UNCYGDRIVE@ @SJAVAC_SERVER_JAVA@
 
 # Tools adhering to a minimal and common standard of posix compliance.
 AWK:=@AWK@
+BASENAME:=@BASENAME@
 CAT:=@CAT@
 CCACHE:=@CCACHE@
 # CD is going away, but remains to cater for legacy makefiles.
@@ -520,8 +488,6 @@
 BUILD_LOG_WRAPPER:=@BUILD_LOG_WRAPPER@
 
 # Build setup
-ENABLE_DOCS:=@ENABLE_DOCS@
-GENERATE_DOCS:=@ENABLE_DOCS@
 DISABLE_NIMBUS:=@DISABLE_NIMBUS@
 ENABLE_JFR=@ENABLE_JFR@
 USE_EXTERNAL_LIBJPEG:=@USE_EXTERNAL_LIBJPEG@
@@ -561,17 +527,6 @@
 
 ####################################################
 #
-# Legacy Hotspot support
-
-HOTSPOT_DIST:=@HOTSPOT_DIST@
-HOTSPOT_MAKE_ARGS:=@HOTSPOT_MAKE_ARGS@
-# This is used from the libjvm build for C/C++ code.
-HOTSPOT_BUILD_JOBS:=@CONCURRENT_BUILD_JOBS@
-# Control wether Hotspot runs Queens test after building
-TEST_IN_BUILD=@TEST_IN_BUILD@
-
-####################################################
-#
 # INSTALLATION
 #
 
@@ -634,5 +589,5 @@
 OS_VERSION_MINOR:=@OS_VERSION_MINOR@
 OS_VERSION_MICRO:=@OS_VERSION_MICRO@
 
-# Include the closed-spec.gmk file if it exists
--include $(dir @SPEC@)/closed-spec.gmk
+# Include the custom-spec.gmk file if it exists
+-include $(dir @SPEC@)/custom-spec.gmk
--- a/common/autoconf/spec.sh.in	Wed Jul 05 18:22:17 2017 +0200
+++ b/common/autoconf/spec.sh.in	Wed Jul 05 18:22:52 2017 +0200
@@ -23,505 +23,14 @@
 # questions.
 #
 
-# Configured"@DATE_WHEN_CONFIGURED@ to build for a @OPENJDK_TARGET_SYSTEM@ system,
-# using 'configure @CONFIGURE_COMMAND_LINE@'
-
-# The "human readable" name of this configuration
-CONF_NAME="@CONF_NAME@"
-
-# The built jdk will run in this target system.
-OPENJDK_TARGET_SYSTEM="@OPENJDK_TARGET_SYSTEM@"
-
-OPENJDK_TARGET_OS="@OPENJDK_TARGET_OS@"
-OPENJDK_TARGET_OS_FAMILY="@OPENJDK_TARGET_OS_FAMILY@"
-OPENJDK_TARGET_OS_API="@OPENJDK_TARGET_OS_API@"
-
-OPENJDK_TARGET_CPU="@OPENJDK_TARGET_CPU@"
-OPENJDK_TARGET_CPU_ARCH="@OPENJDK_TARGET_CPU_ARCH@"
-OPENJDK_TARGET_CPU_BITS="@OPENJDK_TARGET_CPU_BITS@"
-OPENJDK_TARGET_CPU_ENDIAN="@OPENJDK_TARGET_CPU_ENDIAN@"
-
-# We are building on this build system.
-# When not cross-compiling, it is the same as the target.
-OPENJDK_BUILD_SYSTEM="@OPENJDK_BUILD_SYSTEM@"
-
-OPENJDK_BUILD_OS="@OPENJDK_BUILD_OS@"
-OPENJDK_BUILD_OS_FAMILY="@OPENJDK_BUILD_OS_FAMILY@"
-OPENJDK_BUILD_OS_API="@OPENJDK_BUILD_OS_API@"
-
-OPENJDK_BUILD_CPU="@OPENJDK_BUILD_CPU@"
-OPENJDK_BUILD_CPU_ARCH="@OPENJDK_BUILD_CPU_ARCH@"
-OPENJDK_BUILD_CPU_BITS="@OPENJDK_BUILD_CPU_BITS@"
-OPENJDK_BUILD_CPU_ENDIAN="@OPENJDK_BUILD_CPU_ENDIAN@"
-
-# Legacy OS values for use in release file.
-REQUIRED_OS_NAME="@REQUIRED_OS_NAME@"
-REQUIRED_OS_VERSION="@REQUIRED_OS_VERSION@"
-
-# Old name for OPENJDK_TARGET_OS (aix,bsd,hpux,linux,macosx,solaris,windows etc)
-PLATFORM="@OPENJDK_TARGET_OS@"
-# Old name for OPENJDK_TARGET_CPU, uses i586 and amd64, instead of ia32 and x64.
-ARCH="@LEGACY_OPENJDK_TARGET_CPU1@"
-# Yet another name for arch used for an extra subdir below the jvm lib.
-# Uses i386 and amd64, instead of ia32 and x64.
-LIBARCH="@LEGACY_OPENJDK_TARGET_CPU2@"
-# Use to switch between solaris and windows subdirs in the jdk.
-LEGACY_OPENJDK_TARGET_OS_API="@LEGACY_OPENJDK_TARGET_OS_API@"
-# 32 or 64 bit
-ARCH_DATA_MODEL="@OPENJDK_TARGET_CPU_BITS@"
-# Legacy setting for building for a 64 bit machine.
-# If yes then this expands to _LP64=1
-ENDIAN="@OPENJDK_TARGET_CPU_ENDIAN@"
-JIGSAW="@JIGSAW@"
-LIBM=-lm
-LIBDL="@LIBDL@"
-
-# colon or semicolon
-PATH_SEP="@PATH_SEP@"
-
-# The sys root where standard headers and libraries are found.
-# Usually not needed since the configure script should have
-# taken it into account already when setting CFLAGS et al.
-SYS_ROOT="@SYS_ROOT@"
-
-# Paths to the source code
-SRC_ROOT="@SRC_ROOT@"
-ADD_SRC_ROOT="@ADD_SRC_ROOT@"
-OVERRIDE_SRC_ROOT="@OVERRIDE_SRC_ROOT@"
-TOPDIR="@SRC_ROOT@"
-OUTPUT_ROOT="@OUTPUT_ROOT@"
-JDK_MAKE_SHARED_DIR="@JDK_TOPDIR@"/makefiles/common/shared
-JDK_TOPDIR="@JDK_TOPDIR@"
-LANGTOOLS_TOPDIR="@LANGTOOLS_TOPDIR@"
-CORBA_TOPDIR="@CORBA_TOPDIR@"
-JAXP_TOPDIR="@JAXP_TOPDIR@"
-JAXWS_TOPDIR="@JAXWS_TOPDIR@"
-HOTSPOT_TOPDIR="@HOTSPOT_TOPDIR@"
-COPYRIGHT_YEAR="@COPYRIGHT_YEAR@"
-
-# Information gathered from the version.numbers file.
-JDK_MAJOR_VERSION="@JDK_MAJOR_VERSION@"
-JDK_MINOR_VERSION="@JDK_MINOR_VERSION@"
-JDK_MICRO_VERSION="@JDK_MICRO_VERSION@"
-JDK_UPDATE_VERSION="@JDK_UPDATE_VERSION@"
-JDK_BUILD_NUMBER="@JDK_BUILD_NUMBER@"
-MILESTONE="@MILESTONE@"
-LAUNCHER_NAME="@LAUNCHER_NAME@"
-PRODUCT_NAME="@PRODUCT_NAME@"
-PRODUCT_SUFFIX="@PRODUCT_SUFFIX@"
-JDK_RC_PLATFORM_NAME="@JDK_RC_PLATFORM_NAME@"
-COMPANY_NAME="@COMPANY_NAME@"
-
-# Different version strings generated from the above information.
-JDK_VERSION="@JDK_VERSION@"
-RUNTIME_NAME="@RUNTIME_NAME@"
-FULL_VERSION="@FULL_VERSION@"
-JRE_RELEASE_VERSION="@FULL_VERSION@"
-RELEASE="@RELEASE@"
-COOKED_BUILD_NUMBER="@COOKED_BUILD_NUMBER@"
-
-# How to compile the code: release, fastdebug or slowdebug
-DEBUG_LEVEL="@DEBUG_LEVEL@"
-
-# This is the JDK variant to build.
-# The JDK variant is a name for a specific set of modules to be compiled for the JDK.
-JDK_VARIANT="@JDK_VARIANT@"
-
-# Should we compile support for running with a graphical UI? (ie headful)
-# Should we compile support for running without? (ie headless)
-SUPPORT_HEADFUL="@SUPPORT_HEADFUL@"
-SUPPORT_HEADLESS="@SUPPORT_HEADLESS@"
-
-# These are the libjvms that we want to build.
-# The java launcher uses the default.
-# The other can be selected by specifying -client -server -kernel -zero or -zeroshark
-# on the java launcher command line.
-JVM_VARIANTS="@JVM_VARIANTS@"
-JVM_VARIANT_SERVER="@JVM_VARIANT_SERVER@"
-JVM_VARIANT_CLIENT="@JVM_VARIANT_CLIENT@"
-JVM_VARIANT_KERNEL="@JVM_VARIANT_KERNEL@"
-JVM_VARIANT_ZERO="@JVM_VARIANT_ZERO@"
-JVM_VARIANT_ZEROSHARK="@JVM_VARIANT_ZEROSHARK@"
-
-# Legacy setting: OPT or DBG
-VARIANT="@VARIANT@"
-# Legacy setting: true or false
-FASTDEBUG="@FASTDEBUG@"
-# Legacy setting: debugging the class files?
-DEBUG_CLASSFILES="@DEBUG_CLASSFILES@"
-# Legacy setting: -debug or -fastdebug
-BUILD_VARIANT_RELEASE="@BUILD_VARIANT_RELEASE@"
-
-LANGTOOLS_OUTPUTDIR="@LANGTOOLS_OUTPUTDIR@"
-CORBA_OUTPUTDIR="@CORBA_OUTPUTDIR@"
-JAXP_OUTPUTDIR="@JAXP_OUTPUTDIR@"
-JAXWS_OUTPUTDIR="@JAXWS_OUTPUTDIR@"
-HOTSPOT_OUTPUTDIR="@HOTSPOT_OUTPUTDIR@"
-
-# This where a working jvm is built.
-# You can run ${JDK_OUTPUTDIR}/bin/java
-# Though the layout of the contents of ${JDK_OUTPUTDIR} is not
-# yet the same as a default installation.
-JDK_OUTPUTDIR="@OUTPUT_ROOT@"/jdk
-
-# When you run "make install" it will create the standardized
-# layout for the jdk and the jre inside the images subdir.
-# Then it will copy the contents of the jdk into the installation
-# directory.
-IMAGES_OUTPUTDIR="@OUTPUT_ROOT@"/images
-
-LANGTOOLS_DIST="@LANGTOOLS_DIST@"
-CORBA_DIST="@CORBA_DIST@"
-JAXP_DIST="@JAXP_DIST@"
-JAXWS_DIST="@JAXWS_DIST@"
-HOTSPOT_DIST="@HOTSPOT_DIST@"
-
-# Legacy variables used by Release.gmk
-JDK_IMAGE_DIR=${IMAGES_OUTPUTDIR}/j2sdk-image
-JRE_IMAGE_DIR=${IMAGES_OUTPUTDIR}/j2re-image
-
-# Can be /sparcv9 or /amd64 on Solaris
-ISA_DIR="@LEGACY_OPENJDK_TARGET_CPU3@"
-BINDIR="${JDK_OUTPUTDIR}/bin${ISA_DIR}"
-
-# The boot jdk to use
-ALT_BOOTDIR="@BOOT_JDK@"
-BOOT_JDK="@BOOT_JDK@"
-BOOT_JDK_JVMARGS="@BOOT_JDK_JVMARGS@"
-BOOT_RTJAR="@BOOT_RTJAR@"
-BOOT_TOOLSJAR="@BOOT_TOOLSJAR@"
-
-# When compiling Java source to be run by the boot jdk
-# use these extra flags, eg -source 6 -target 6
-BOOT_JDK_SOURCETARGET="@BOOT_JDK_SOURCETARGET@"
-
-# Information about the build system
-NUM_CORES="@NUM_CORES@"
-# This is used from the jdk build for C/C++ code.
-PARALLEL_COMPILE_JOBS="@CONCURRENT_BUILD_JOBS@"
-# Store javac server synchronization files here, and
-# the javac server log files.
-JAVAC_SERVERS="@JAVAC_SERVERS@"
-# Should we use a javac server or not? The javac server gives
-# an enormous performance improvement since it reduces the
-# startup costs of javac and reuses as much as possible of intermediate
-# compilation work. But if we want to compile with a non-Java
-# javac compiler, like gcj. Then we cannot use javac server and
-# this variable is set to false.
-JAVAC_USE_REMOTE="@JAVAC_USE_REMOTE@"
-# We can block the Javac server to never use more cores than this.
-# This is not for performance reasons, but for memory usage, since each
-# core requires its own JavaCompiler. We might have 64 cores and 4GB
-# of memory, 64 JavaCompilers will currently not fit in a 3GB heap.
-# Since there is no sharing of data between the JavaCompilers.
-JAVAC_SERVER_CORES="@JAVAC_SERVER_CORES@"
-# Should we use dependency tracking between Java packages? true or false.
-JAVAC_USE_DEPS="@JAVAC_USE_DEPS@"
-# We can invoke javac: SINGLE_THREADED_BATCH or MULTI_CORE_CONCURRENT
-JAVAC_USE_MODE="@JAVAC_USE_MODE@"
-# Enable not yet complete sjavac support.
-ENABLE_SJAVAC="@ENABLE_SJAVAC@"
-
-# The OpenJDK makefiles should be changed to using the standard
-# configure output ..._CFLAGS and ..._LIBS. In the meantime we
-# extract the information here.
-FREETYPE2_LIB_PATH="@FREETYPE2_LIB_PATH@"
-FREETYPE2_LIBS="@FREETYPE2_LIBS@"
-FREETYPE2_CFLAGS="@FREETYPE2_CFLAGS@"
-USING_SYSTEM_FT_LIB="@USING_SYSTEM_FT_LIB@"
-CUPS_CFLAGS="@CUPS_CFLAGS@"
-
-PACKAGE_PATH="@PACKAGE_PATH@"
-
-# Source file for cacerts
-CACERTS_FILE="@CACERTS_FILE@"
-
-#MOZILLA_HEADERS_PATH=
-
-# Necessary additional compiler flags to compile X11 
-X_CFLAGS="@X_CFLAGS@"
-X_LIBS="@X_LIBS@"
-OPENWIN_HOME="@OPENWIN_HOME@"
-
-# There are two types: CC or CL
-# CC is gcc and others behaving reasonably similar.
-# CL is cl.exe only.
-COMPILER_TYPE="@COMPILER_TYPE@"
-
-# Flags used for overriding the default opt setting for a C/C++ source file.
-C_O_FLAG_HIGHEST="@C_O_FLAG_HIGHEST@"
-C_O_FLAG_HI="@C_O_FLAG_HI@"
-C_O_FLAG_NORM="@C_O_FLAG_NORM@"
-C_O_FLAG_NONE="@C_O_FLAG_NONE@"
-CXX_O_FLAG_HIGHEST="@CXX_O_FLAG_HIGHEST@"
-CXX_O_FLAG_HI="@CXX_O_FLAG_HI@"
-CXX_O_FLAG_NORM="@CXX_O_FLAG_NORM@"
-CXX_O_FLAG_NONE="@CXX_O_FLAG_NONE@"
-
-C_FLAG_DEPS="@C_FLAG_DEPS@"
-CXX_FLAG_DEPS="@CXX_FLAG_DEPS@"
-
-# Tools that potentially need to be cross compilation aware.
-CC="@UNCYGDRIVE@ @CCACHE@ @CC@"
-
-# CFLAGS used to compile the jdk native libraries (C-code)
-CFLAGS_JDKLIB="@CFLAGS_JDKLIB@"
-CXXFLAGS_JDKLIB="@CXXFLAGS_JDKLIB@"
-
-# CFLAGS used to compile the jdk native launchers (C-code)
-CFLAGS_JDKEXE="@CFLAGS_JDKEXE@"
-CXXFLAGS_JDKEXE="@CXXFLAGS_JDKEXE@"
-
-CXX="@UNCYGDRIVE@ @CCACHE@ @CXX@"
-#CXXFLAGS="@CXXFLAGS@"
-
-OBJC="@CCACHE@ @OBJC@"
-#OBJCFLAGS="@OBJCFLAGS@"
-
-CPP="@UNCYGDRIVE@ @CPP@"
-#CPPFLAGS="@CPPFLAGS@"
-
-# The linker can be gcc or ld on posix systems, or link.exe on winapi systems.
-LD="@UNCYGDRIVE@ @LD@"
-
-# LDFLAGS used to link the jdk native libraries (C-code)
-LDFLAGS_JDKLIB="@LDFLAGS_JDKLIB@"
-LDFLAGS_JDKLIB_SUFFIX="@LDFLAGS_JDKLIB_SUFFIX@"
-
-# On some platforms the linker cannot be used to create executables, thus
-# the need for a separate LDEXE command.
-LDEXE="@UNCYGDRIVE@ @LDEXE@"
-
-# LDFLAGS used to link the jdk native launchers (C-code)
-LDFLAGS_JDKEXE="@LDFLAGS_JDKEXE@"
-LDFLAGS_JDKEXE_SUFFIX="@LDFLAGS_JDKEXE_SUFFIX@"
-
-# Sometimes a different linker is needed for c++ libs
-LDCXX="@UNCYGDRIVE@ @LDCXX@"
-# The flags for linking libstdc++ linker.
-LIBCXX="@LIBCXX@"
-
-# Sometimes a different linker is needed for c++ executables
-LDEXECXX="@UNCYGDRIVE@ @LDEXECXX@"
-
-# If cross compiling, then define CROSS_COMPILE_ARCH=cpu_name here.
-# The HOSTCC should really be named BUILDCC, ie build executable for
-# the build platform. Same as CC when not cross compiling.
-HOSTCC="@HOSTCC@"
-HOSTCXX="@HOSTCXX@"
-# And of course, the jdk spells HOSTCC as NIO_CC/HOST_CC 
-HOST_CC="@HOSTCC@"
-NIO_CC="@HOSTCC@"
-
-AS="@AS@"
-ASFLAGS="@ASFLAGS@"
-
-# AR is used to create a static library (is ar in posix, lib.exe in winapi)
-AR="@UNCYGDRIVE@ @AR@"
-ARFLAGS="@ARFLAGS@"
-
-NM="@NM@"
-STRIP="@STRIP@"
-MCS="@MCS@"
-
-# Command to create a shared library
-SHARED_LIBRARY_FLAGS="@SHARED_LIBRARY_FLAGS@"
-
-# Options to linker to specify a mapfile. 
-# (Note absence of = assignment, because we do not want to evaluate the macro body here)
-SET_SHARED_LIBRARY_MAPFILE="@SET_SHARED_LIBRARY_MAPFILE@"
-
-# Options for C/CXX compiler to be used if linking is performed
-#   using reorder file
-C_FLAG_REORDER="@C_FLAG_REORDER@"
-CXX_FLAG_REORDER="@CXX_FLAG_REORDER@"
-
-#
-# Options for generating debug symbols
-ENABLE_DEBUG_SYMBOLS="@ENABLE_DEBUG_SYMBOLS@"
-CFLAGS_DEBUG_SYMBOLS="@CFLAGS_DEBUG_SYMBOLS@"
-CXXFLAGS_DEBUG_SYMBOLS="@CXXFLAGS_DEBUG_SYMBOLS@"
-ZIP_DEBUGINFO_FILES="@ZIP_DEBUGINFO_FILES@"
-
-# Options to linker to specify the library name.
-# (Note absence of = assignment, because we do not want to evaluate the macro body here)
-SET_SHARED_LIBRARY_NAME="@SET_SHARED_LIBRARY_NAME@"
-
-# Set origin using the linker, ie use the relative path to the dependent library to find the dependees.
-# (Note absence of = assignment, because we do not want to evaluate the macro body here)
-SET_SHARED_LIBRARY_ORIGIN="@SET_SHARED_LIBRARY_ORIGIN@"
-
-# Different OS:es have different ways of naming shared libraries.
-# The SHARED_LIBRARY macro takes "verify" as and argument and returns:
-#    "libverify.so" or "libverify.dylib" or "verify.dll" depending on platform.
-# (Note absence of = assignment, because we do not want to evaluate the macro body here)
-SHARED_LIBRARY="@SHARED_LIBRARY@"
-STATIC_LIBRARY="@STATIC_LIBRARY@"
-LIBRARY_PREFIX="@LIBRARY_PREFIX@"
-SHARED_LIBRARY_SUFFIX="@SHARED_LIBRARY_SUFFIX@"
-STATIC_LIBRARY_SUFFIX="@STATIC_LIBRARY_SUFFIX@"
-EXE_SUFFIX="@EXE_SUFFIX@"
-OBJ_SUFFIX="@OBJ_SUFFIX@"
+CAT="@CAT@"
+CD=cd
+CP="@CP@"
+DIFF="@DIFF@"
+ECHO="@ECHO@"
+FIND="@FIND@"
+GREP="@GREP@"
+RM="@RM@"
+SED="@SED@"
 
 POST_STRIP_CMD="@POST_STRIP_CMD@"
-POST_MCS_CMD='@POST_MCS_CMD@'
-
-JAVA_FLAGS="@BOOT_JDK_JVMARGS@"
-
-JAVA="@UNCYGDRIVE@ @JAVA@ ${JAVA_FLAGS}"
-
-JAVAC="@UNCYGDRIVE@ @JAVAC@"
-JAVAC_FLAGS="@JAVAC_FLAGS@"
-
-JAVAH="@UNCYGDRIVE@ @JAVAH@"
-
-JAR="@UNCYGDRIVE@ @JAR@"
-
-RMIC="@UNCYGDRIVE@ @RMIC@"
-
-NATIVE2ASCII="@UNCYGDRIVE@ @NATIVE2ASCII@"
-
-BOOT_JAR_CMD="@UNCYGDRIVE@ @JAR@"
-BOOT_JAR_JFLAGS=
-
-# Tools adhering to a minimal and common standard of posix compliance.
-AWK="@AWK@"
-CAT="@CAT@"
-CCACHE="@CCACHE@"
-# CD is going away, but remains to cater for legacy makefiles.
-CD=cd
-CHMOD="@CHMOD@"
-CP="@CP@"
-CPIO="@CPIO@"
-CUT="@CUT@"
-DATE="@DATE@"
-DF="@DF@"
-DIFF="@DIFF@"
-FIND="@FIND@"
-FIND_DELETE="@FIND_DELETE@"
-ECHO="@ECHO@"
-EGREP="@EGREP@"
-FGREP="@FGREP@"
-GREP="@GREP@"
-HEAD="@HEAD@"
-LS="@LS@"
-LN="@LN@"
-MKDIR="@MKDIR@"
-MV="@MV@"
-NAWK="@NAWK@"
-PRINTF="@PRINTF@"
-PWD="@THEPWDCMD@"
-RM="@RM@"
-SED="@SED@"
-SH="@SH@"
-SORT="@SORT@"
-TAR="@TAR@"
-TAIL="@TAIL@"
-TEE="@TEE@"
-TR="@TR@"
-TOUCH="@TOUCH@"
-WC="@WC@"
-XARGS="@XARGS@"
-ZIPEXE="@ZIP@"
-ZIP="@ZIP@"
-UNZIP="@UNZIP@"
-MT="@UNCYGDRIVE@ @MT@"
-RC="@UNCYGDRIVE@ @RC@"
-DUMPBIN="@UNCYGDRIVE@ @DUMPBIN@"
-CYGPATH="@CYGPATH@"
-LDD="@LDD@"
-OTOOL="@OTOOL@"
-READELF="@READELF@"
-EXPR="@EXPR@"
-FILE="@FILE@"
-HG="@HG@"
-OBJCOPY="@OBJCOPY@"
-
-UNCYGDRIVE="@UNCYGDRIVE@"
-
-# Build setup
-ENABLE_DOCS="@ENABLE_DOCS@"
-GENERATE_DOCS="@ENABLE_DOCS@"
-DISABLE_NIMBUS="@DISABLE_NIMBUS@"
-USE_EXTERNAL_LIBJPEG="@USE_EXTERNAL_LIBJPEG@"
-USE_EXTERNAL_LIBGIF="@USE_EXTERNAL_LIBGIF@"
-USE_EXTERNAL_LIBZ="@USE_EXTERNAL_LIBZ@"
-LIBZIP_CAN_USE_MMAP="@LIBZIP_CAN_USE_MMAP@"
-CHECK_FOR_VCINSTALLDIR="@CHECK_FOR_VCINSTALLDIR@"
-MSVCRNN_DLL="@MSVCR100DLL@"
-
-
-####################################################
-#
-# Legacy Hotspot support
-
-HOTSPOT_DIST="@HOTSPOT_DIST@"
-HOTSPOT_MAKE_ARGS="@HOTSPOT_MAKE_ARGS@"
-# This is used from the libjvm build for C/C++ code.
-HOTSPOT_BUILD_JOBS="@CONCURRENT_BUILD_JOBS@"
-# Control wether Hotspot runs Queens test after building
-TEST_IN_BUILD="@TEST_IN_BUILD@"
-
-####################################################
-#
-# INSTALLATION
-#
-
-# Common prefix for all installed files. Defaults to /usr/local,
-# but /opt/myjdk is another common version. 
-INSTALL_PREFIX="@prefix@"
-
-# Directories containing architecture-dependent files should be relative to exec_prefix
-INSTALL_EXECPREFIX="@exec_prefix@"
-
-# java,javac,javah,javap etc are installed here.
-INSTALL_BINDIR="@bindir@"
-
-# Read only architecture-independent data
-INSTALL_DATADIR="@datadir@"
-
-# Root of above.
-INSTALL_DATAROOTDIR="@datarootdir@"
-
-# Doc files, other than info and man.
-INSTALL_DOCDIR="@docdir@"
-
-# Html documentation
-INSTALL_HTMLDIR="@htmldir@"
-
-# Installing C header files, JNI headers for example.
-INSTALL_INCLUDEDIR="@includedir@"
-
-# Installing library files....
-INSTALL_INCLUDEDIR="@libdir@"
-
-# Executables that other programs run.
-INSTALL_LIBEXECDIR="@libexecdir@"
-
-# Locale-dependent but architecture-independent data, such as message catalogs. 
-INSTALL_LOCALEDIR="@localedir@"
-
-# Modifiable single-machine data
-INSTALL_LOCALSTATEDIR="@localstatedir@"
-
-# Man pages
-INSTALL_MANDIR="@mandir@"
-
-# Modifiable architecture-independent data.
-INSTALL_SHAREDSTATEDIR="@sharedstatedir@"
-
-# Read-only single-machine data
-INSTALL_SYSCONFDIR="@sysconfdir@"
-
-
-####################################################
-#
-# Misc
-#
-
-# Name of Service Agent library
-SALIB_NAME="@SALIB_NAME@"
-
-OS_VERSION_MAJOR="@OS_VERSION_MAJOR@"
-OS_VERSION_MINOR="@OS_VERSION_MINOR@"
-OS_VERSION_MICRO="@OS_VERSION_MICRO@"
--- a/common/autoconf/toolchain.m4	Wed Jul 05 18:22:17 2017 +0200
+++ b/common/autoconf/toolchain.m4	Wed Jul 05 18:22:52 2017 +0200
@@ -31,6 +31,19 @@
 # the set env variables into the spec file.
 SETUPDEVENV="# No special vars"
 if test "x$OPENJDK_BUILD_OS" = "xwindows"; then
+    # Store path to cygwin link.exe to help excluding it when searching for 
+    # VS linker.
+    AC_PATH_PROG(CYGWIN_LINK, link)
+    AC_MSG_CHECKING([if the first found link.exe is actually the Cygwin link tool])
+    "$CYGWIN_LINK" --version > /dev/null
+    if test $? -eq 0 ; then
+      AC_MSG_RESULT([yes])
+    else
+      AC_MSG_RESULT([no])
+      # This might be the VS linker. Don't exclude it later on.
+      CYGWIN_LINK=""
+    fi
+    
     # If vcvarsall.bat has been run, then VCINSTALLDIR is set.
     if test "x$VCINSTALLDIR" != x; then
         # No further setup is needed. The build will happen from this kind
@@ -57,12 +70,12 @@
             AC_MSG_RESULT([no])
             AC_MSG_ERROR([Tried to find a VS installation using both $SEARCH_ROOT but failed. Please run "c:\\cygwin\\bin\\bash.exe -l" from a VS command prompt and then run configure/make from there.])
         fi
-        case "$LEGACY_OPENJDK_TARGET_CPU1" in
-          i?86)
+        case "$OPENJDK_TARGET_CPU" in
+          x86)
             VARSBAT_ARCH=x86
             ;;
-          *)
-            VARSBAT_ARCH=$LEGACY_OPENJDK_TARGET_CPU1
+          x86_64)
+            VARSBAT_ARCH=amd64
             ;;
         esac
         # Lets extract the variables that are set by vcvarsall.bat/vsvars32.bat/vsvars64.bat
@@ -122,9 +135,6 @@
 # Configure the development tool paths and potential sysroot.
 #
 AC_LANG(C++)
-DEVKIT=
-SYS_ROOT=/
-AC_SUBST(SYS_ROOT)
 
 # The option used to specify the target .o,.a or .so file.
 # When compiling, how to specify the to be created object file.
@@ -153,44 +163,28 @@
 # Setting only --host, does not seem to be really supported.
 # Please set both --build and --host if you want to cross compile.
 
-DEFINE_CROSS_COMPILE_ARCH=""
-HOSTCC=""
-HOSTCXX=""
-HOSTLD=""
-AC_SUBST(DEFINE_CROSS_COMPILE_ARCH)
-AC_MSG_CHECKING([if this is a cross compile])
-if test "x$OPENJDK_BUILD_SYSTEM" != "x$OPENJDK_TARGET_SYSTEM"; then
-    AC_MSG_RESULT([yes, from $OPENJDK_BUILD_SYSTEM to $OPENJDK_TARGET_SYSTEM])
-    # We have detected a cross compile!
-    DEFINE_CROSS_COMPILE_ARCH="CROSS_COMPILE_ARCH:=$LEGACY_OPENJDK_TARGET_CPU1"
+if test "x$COMPILE_TYPE" = "xcross"; then
     # Now we to find a C/C++ compiler that can build executables for the build
     # platform. We can't use the AC_PROG_CC macro, since it can only be used
-    # once.
-    AC_PATH_PROGS(HOSTCC, [cl cc gcc])
-    WHICHCMD(HOSTCC)
-    AC_PATH_PROGS(HOSTCXX, [cl CC g++])
-    WHICHCMD(HOSTCXX)
-    AC_PATH_PROG(HOSTLD, ld)
-    WHICHCMD(HOSTLD)
-    # Building for the build platform should be easy. Therefore
-    # we do not need any linkers or assemblers etc.    
-else
-    AC_MSG_RESULT([no])
+    # once. Also, we need to do this before adding a tools dir to the path,
+    # otherwise we might pick up cross-compilers which don't use standard naming.
+    # Otherwise, we'll set the BUILD_tools to the native tools, but that'll have
+    # to wait until they are properly discovered.
+    AC_PATH_PROGS(BUILD_CC, [cl cc gcc])
+    SET_FULL_PATH(BUILD_CC)
+    AC_PATH_PROGS(BUILD_CXX, [cl CC g++])
+    SET_FULL_PATH(BUILD_CXX)
+    AC_PATH_PROG(BUILD_LD, ld)
+    SET_FULL_PATH(BUILD_LD)
 fi
+AC_SUBST(BUILD_CC)
+AC_SUBST(BUILD_CXX)
+AC_SUBST(BUILD_LD)
 
-# You can force the sys-root if the sys-root encoded into the cross compiler tools
-# is not correct.
-AC_ARG_WITH(sys-root, [AS_HELP_STRING([--with-sys-root],
-    [pass this sys-root to the compilers and linker (useful if the sys-root encoded in
-     the cross compiler tools is incorrect)])])
-
-if test "x$with_sys_root" != x; then
-    SYS_ROOT=$with_sys_root
-fi
-                     
 # If a devkit is found on the builddeps server, then prepend its path to the
 # PATH variable. If there are cross compilers available in the devkit, these
 # will be found by AC_PROG_CC et al.
+DEVKIT=
 BDEPS_CHECK_MODULE(DEVKIT, devkit, xxx,
                     [# Found devkit
                      PATH="$DEVKIT/bin:$PATH"
@@ -218,21 +212,6 @@
 ORG_CXXFLAGS="$CXXFLAGS"
 ORG_OBJCFLAGS="$OBJCFLAGS"
 
-AC_ARG_WITH([tools-dir], [AS_HELP_STRING([--with-tools-dir],
-	[search this directory for compilers and tools])], [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])], [
-    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])
-    fi
-    TOOLS_DIR=$with_devkit/bin
-    SYS_ROOT=$with_devkit/$host_alias/libc
-    ])
-
 # autoconf magic only relies on PATH, so update it if tools dir is specified
 OLD_PATH="$PATH"
 if test "x$TOOLS_DIR" != x; then
@@ -251,7 +230,7 @@
     # Do not use cc on MacOSX use gcc instead.
     CC="gcc"
 fi
-WHICHCMD(CC)
+SET_FULL_PATH(CC)
 
 AC_PROG_CXX([cl CC g++])
 if test "x$CXX" = xCC && test "x$OPENJDK_BUILD_OS" = xmacosx; then
@@ -259,7 +238,7 @@
     # c++ code. Override.
     CXX="g++"
 fi
-WHICHCMD(CXX)
+SET_FULL_PATH(CXX)
 
 if test "x$CXX" = x || test "x$CC" = x; then
     HELP_MSG_MISSING_DEPENDENCY([devkit])
@@ -268,7 +247,7 @@
 
 if test "x$OPENJDK_BUILD_OS" != xwindows; then
     AC_PROG_OBJC
-    WHICHCMD(OBJC)
+    SET_FULL_PATH(OBJC)
 else
     OBJC=
 fi
@@ -279,19 +258,11 @@
 CXXFLAGS="$ORG_CXXFLAGS"
 OBJCFLAGS="$ORG_OBJCFLAGS"
 
-# If we are not cross compiling, use the same compilers for
-# building the build platform executables.
-if test "x$DEFINE_CROSS_COMPILE_ARCH" = x; then
-    HOSTCC="$CC"
-    HOSTCXX="$CXX"
-fi
-
-AC_CHECK_TOOL(LD, ld)
-WHICHCMD(LD)
 LD="$CC"
 LDEXE="$CC"
 LDCXX="$CXX"
 LDEXECXX="$CXX"
+AC_SUBST(LD)
 # LDEXE is the linker to use, when creating executables.
 AC_SUBST(LDEXE)
 # Linking C++ libraries.
@@ -299,8 +270,10 @@
 # Linking C++ executables.
 AC_SUBST(LDEXECXX)
 
-AC_CHECK_TOOL(AR, ar)
-WHICHCMD(AR)
+if test "x$OPENJDK_BUILD_OS" != xwindows; then
+    AC_CHECK_TOOL(AR, ar)
+    SET_FULL_PATH(AR)
+fi
 if test "x$OPENJDK_BUILD_OS" = xmacosx; then
     ARFLAGS="-r"
 else
@@ -316,25 +289,31 @@
     EXE_OUT_OPTION=-out:
     LD_OUT_OPTION=-out:
     AR_OUT_OPTION=-out:
-    # On Windows, reject /usr/bin/link, which is a cygwin
+    # On Windows, reject /usr/bin/link (as determined in CYGWIN_LINK), which is a cygwin
     # program for something completely different.
-    AC_CHECK_PROG([WINLD], [link],[link],,, [/usr/bin/link])
+    AC_CHECK_PROG([WINLD], [link],[link],,, [$CYGWIN_LINK])
     # Since we must ignore the first found link, WINLD will contain
     # the full path to the link.exe program.
-    WHICHCMD_SPACESAFE([WINLD])
+    SET_FULL_PATH_SPACESAFE([WINLD])
+    printf "Windows linker was found at $WINLD\n"
+    AC_MSG_CHECKING([if the found link.exe is actually the Visual Studio linker])
+    "$WINLD" --version > /dev/null
+    if test $? -eq 0 ; then
+      AC_MSG_RESULT([no])
+      AC_MSG_ERROR([This is the Cygwin link tool. Please check your PATH and rerun configure.])
+    else
+      AC_MSG_RESULT([yes])
+    fi
     LD="$WINLD"
     LDEXE="$WINLD"
     LDCXX="$WINLD"
     LDEXECXX="$WINLD"
-    # Set HOSTLD to same as LD until we fully support cross compilation
-    # on windows.
-    HOSTLD="$WINLD"
 
     AC_CHECK_PROG([MT], [mt], [mt],,, [/usr/bin/mt])
-    WHICHCMD_SPACESAFE([MT])
+    SET_FULL_PATH_SPACESAFE([MT])
     # The resource compiler
     AC_CHECK_PROG([RC], [rc], [rc],,, [/usr/bin/rc])
-    WHICHCMD_SPACESAFE([RC])
+    SET_FULL_PATH_SPACESAFE([RC])
 
     RC_FLAGS="-nologo /l 0x409 /r"
     AS_IF([test "x$VARIANT" = xOPT], [
@@ -354,12 +333,12 @@
 
     # lib.exe is used to create static libraries.
     AC_CHECK_PROG([WINAR], [lib],[lib],,,)
-    WHICHCMD_SPACESAFE([WINAR])
+    SET_FULL_PATH_SPACESAFE([WINAR])
     AR="$WINAR"
     ARFLAGS="-nologo -NODEFAULTLIB:MSVCRT"
 
     AC_CHECK_PROG([DUMPBIN], [dumpbin], [dumpbin],,,)
-    WHICHCMD_SPACESAFE([DUMPBIN])
+    SET_FULL_PATH_SPACESAFE([DUMPBIN])
 
     COMPILER_TYPE=CL
     CCXXFLAGS="$CCXXFLAGS -nologo"
@@ -368,10 +347,20 @@
 AC_SUBST(COMPILER_TYPE)
 
 AC_PROG_CPP
-WHICHCMD(CPP)
+SET_FULL_PATH(CPP)
 
 AC_PROG_CXXCPP
-WHICHCMD(CXXCPP)
+SET_FULL_PATH(CXXCPP)
+
+if test "x$COMPILE_TYPE" != "xcross"; then
+    # If we are not cross compiling, use the same compilers for
+    # building the build platform executables. The cross-compilation
+    # case needed to be done earlier, but this can only be done after
+    # the native tools have been localized.
+    BUILD_CC="$CC"
+    BUILD_CXX="$CXX"
+    BUILD_LD="$LD"
+fi
 
 # for solaris we really need solaris tools, and not gnu equivalent
 #   these seems to normally reside in /usr/ccs/bin so add that to path before
@@ -386,27 +375,24 @@
 # Find the right assembler.
 if test "x$OPENJDK_BUILD_OS" = xsolaris; then
     AC_PATH_PROG(AS, as)
-    WHICHCMD(AS)
-    ASFLAGS=" "
+    SET_FULL_PATH(AS)
 else
     AS="$CC -c"
-    ASFLAGS=" "
 fi
 AC_SUBST(AS)
-AC_SUBST(ASFLAGS)
 
 if test "x$OPENJDK_BUILD_OS" = xsolaris; then
-    AC_PATH_PROG(NM, nm)
-    WHICHCMD(NM)
+    AC_PATH_PROGS(NM, [gnm nm])
+    SET_FULL_PATH(NM)
     AC_PATH_PROG(STRIP, strip)
-    WHICHCMD(STRIP)
+    SET_FULL_PATH(STRIP)
     AC_PATH_PROG(MCS, mcs)
-    WHICHCMD(MCS)
-else
+    SET_FULL_PATH(MCS)
+elif test "x$OPENJDK_BUILD_OS" != xwindows; then
     AC_CHECK_TOOL(NM, nm)
-    WHICHCMD(NM)
+    SET_FULL_PATH(NM)
     AC_CHECK_TOOL(STRIP, strip)
-    WHICHCMD(STRIP)
+    SET_FULL_PATH(STRIP)
 fi
 
 ###
@@ -421,6 +407,11 @@
    AC_PATH_TOOL(OBJCOPY, objcopy)
 fi
 
+if test "x$OPENJDK_TARGET_OS" = "xmacosx"; then
+   AC_PATH_PROG(LIPO, lipo)
+   SET_FULL_PATH(LIPO)
+fi
+
 # Restore old path without tools dir
 PATH="$OLD_PATH"
 ])
@@ -449,15 +440,13 @@
     SET_SHARED_LIBRARY_MAPFILE='-Xlinker -version-script=[$]1'
     C_FLAG_REORDER=''
     CXX_FLAG_REORDER=''
-    SET_SHARED_LIBRARY_ORIGIN='-Xlinker -z -Xlinker origin -Xlinker -rpath -Xlinker \$$$$ORIGIN/[$]1'
+    SET_SHARED_LIBRARY_ORIGIN='-Xlinker -z -Xlinker origin -Xlinker -rpath -Xlinker \$$$$ORIGIN[$]1'
+    SET_EXECUTABLE_ORIGIN='-Xlinker -rpath -Xlinker \$$$$ORIGIN[$]1'
     LD="$CC"
     LDEXE="$CC"
     LDCXX="$CXX"
     LDEXECXX="$CXX"
     POST_STRIP_CMD="$STRIP -g"
-    if test "x$JDK_VARIANT" = xembedded; then
-        POST_STRIP_CMD="$STRIP --strip-unneeded"
-    fi
 
     # Linking is different on MacOSX
     if test "x$OPENJDK_BUILD_OS" = xmacosx; then
@@ -470,6 +459,7 @@
         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"
         POST_STRIP_CMD="$STRIP -S"
     fi
 else
@@ -480,7 +470,7 @@
         LIBRARY_PREFIX=lib
         SHARED_LIBRARY='lib[$]1.so'
         STATIC_LIBRARY='lib[$]1.a'
-        SHARED_LIBRARY_FLAGS="-z defs -xildoff -ztext -G"
+        SHARED_LIBRARY_FLAGS="-G"
         SHARED_LIBRARY_SUFFIX='.so'
         STATIC_LIBRARY_SUFFIX='.a'
         OBJ_SUFFIX='.o'
@@ -489,7 +479,8 @@
         SET_SHARED_LIBRARY_MAPFILE='-M[$]1'
 	C_FLAG_REORDER='-xF'
 	CXX_FLAG_REORDER='-xF'
-        SET_SHARED_LIBRARY_ORIGIN='-R \$$$$ORIGIN/[$]1'
+        SET_SHARED_LIBRARY_ORIGIN='-R\$$$$ORIGIN[$]1'
+        SET_EXECUTABLE_ORIGIN="$SET_SHARED_LIBRARY_ORIGIN"
         CFLAGS_JDK="${CFLAGS_JDK} -D__solaris__"
         CXXFLAGS_JDK="${CXXFLAGS_JDK} -D__solaris__"
         CFLAGS_JDKLIB_EXTRA='-xstrconst'
@@ -511,6 +502,7 @@
         SET_SHARED_LIBRARY_NAME=''
         SET_SHARED_LIBRARY_MAPFILE=''
         SET_SHARED_LIBRARY_ORIGIN=''
+        SET_EXECUTABLE_ORIGIN=''
     fi
 fi
 
@@ -527,6 +519,7 @@
 AC_SUBST(C_FLAG_REORDER)
 AC_SUBST(CXX_FLAG_REORDER)
 AC_SUBST(SET_SHARED_LIBRARY_ORIGIN)
+AC_SUBST(SET_EXECUTABLE_ORIGIN)
 AC_SUBST(POST_STRIP_CMD)
 AC_SUBST(POST_MCS_CMD)
 
@@ -542,6 +535,25 @@
 # Setup the opt flags for different compilers
 # and different operating systems.
 #
+
+#
+# NOTE: check for -mstackrealign needs to be below potential addition of -m32
+#
+if test "x$OPENJDK_TARGET_CPU_BITS" = x32 && test "x$OPENJDK_TARGET_OS" = xmacosx; then
+    # On 32-bit MacOSX the OS requires C-entry points to be 16 byte aligned.
+    # While waiting for a better solution, the current workaround is to use -mstackrealign.
+    CFLAGS="$CFLAGS -mstackrealign"
+    AC_MSG_CHECKING([if 32-bit compiler supports -mstackrealign])
+    AC_LINK_IFELSE([AC_LANG_SOURCE([[int main() { return 0; }]])],
+                   [
+		        AC_MSG_RESULT([yes])
+                   ],
+	           [
+		        AC_MSG_RESULT([no])
+	                AC_MSG_ERROR([The selected compiler $CXX does not support -mstackrealign! Try to put another compiler in the path.])
+	           ])
+fi
+
 C_FLAG_DEPS="-MMD -MF"
 CXX_FLAG_DEPS="-MMD -MF"
 
@@ -566,7 +578,7 @@
 	    CXXFLAGS_DEBUG_SYMBOLS="-g"
 	    if test "x$OPENJDK_TARGET_CPU_BITS" = "x64" && test "x$DEBUG_LEVEL" = "xfastdebug"; then
 	       CFLAGS_DEBUG_SYMBOLS="-g1"
-	       CXXFLAGS_DEBUG_SYMBOLSG="-g1"
+	       CXXFLAGS_DEBUG_SYMBOLS="-g1"
 	    fi
 	    ;;
 	esac
@@ -578,52 +590,56 @@
         #
         # Forte has different names for this with their C++ compiler...
         #
-	C_FLAG_DEPS="-xMMD -xMF"
-	CXX_FLAG_DEPS="-xMMD -xMF"
+        C_FLAG_DEPS="-xMMD -xMF"
+        CXX_FLAG_DEPS="-xMMD -xMF"
 
-# Extra options used with HIGHEST
-#
-# WARNING: Use of OPTIMIZATION_LEVEL=HIGHEST in your Makefile needs to be
-#          done with care, there are some assumptions below that need to
-#          be understood about the use of pointers, and IEEE behavior.
-#
-# Use non-standard floating point mode (not IEEE 754)
-CC_HIGHEST="$CC_HIGHEST -fns"
-# Do some simplification of floating point arithmetic (not IEEE 754)
-CC_HIGHEST="$CC_HIGHEST -fsimple"
-# 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 
-#    pointer types are not recommended)
-CC_HIGHEST="$CC_HIGHEST -xalias_level=basic"
-# Use intrinsic or inline versions for math/std functions
-#   (If you expect perfect errno behavior, do not use this)
-CC_HIGHEST="$CC_HIGHEST -xbuiltin=%all"
-# Loop data dependency optimizations (need -xO3 or higher)
-CC_HIGHEST="$CC_HIGHEST -xdepend"
-# Pointer parameters to functions do not overlap
-#   (Similar to -xalias_level=basic usage, but less obvious sometimes.
-#    If you pass in multiple pointers to the same data, do not use this)
-CC_HIGHEST="$CC_HIGHEST -xrestrict"
-# Inline some library routines
-#   (If you expect perfect errno behavior, do not use this)
-CC_HIGHEST="$CC_HIGHEST -xlibmil"
-# Use optimized math routines
-#   (If you expect perfect errno behavior, do not use this)
-#  Can cause undefined external on Solaris 8 X86 on __sincos, removing for now
-#CC_HIGHEST="$CC_HIGHEST -xlibmopt"
+        # Extra options used with HIGHEST
+        #
+        # WARNING: Use of OPTIMIZATION_LEVEL=HIGHEST in your Makefile needs to be
+        #          done with care, there are some assumptions below that need to
+        #          be understood about the use of pointers, and IEEE behavior.
+        #
+        # Use non-standard floating point mode (not IEEE 754)
+        CC_HIGHEST="$CC_HIGHEST -fns"
+        # Do some simplification of floating point arithmetic (not IEEE 754)
+        CC_HIGHEST="$CC_HIGHEST -fsimple"
+        # 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 
+        #    pointer types are not recommended)
+        CC_HIGHEST="$CC_HIGHEST -xalias_level=basic"
+        # Use intrinsic or inline versions for math/std functions
+        #   (If you expect perfect errno behavior, do not use this)
+        CC_HIGHEST="$CC_HIGHEST -xbuiltin=%all"
+        # Loop data dependency optimizations (need -xO3 or higher)
+        CC_HIGHEST="$CC_HIGHEST -xdepend"
+        # Pointer parameters to functions do not overlap
+        #   (Similar to -xalias_level=basic usage, but less obvious sometimes.
+        #    If you pass in multiple pointers to the same data, do not use this)
+        CC_HIGHEST="$CC_HIGHEST -xrestrict"
+        # Inline some library routines
+        #   (If you expect perfect errno behavior, do not use this)
+        CC_HIGHEST="$CC_HIGHEST -xlibmil"
+        # Use optimized math routines
+        #   (If you expect perfect errno behavior, do not use this)
+        #  Can cause undefined external on Solaris 8 X86 on __sincos, removing for now
+        #CC_HIGHEST="$CC_HIGHEST -xlibmopt"
 
-        case $LEGACY_OPENJDK_TARGET_CPU1 in
-          i586)
-            C_O_FLAG_HIGHEST="-xO4 -Wu,-O4~yz $CC_HIGHEST -xchip=pentium"
-            C_O_FLAG_HI="-xO4 -Wu,-O4~yz"
-            C_O_FLAG_NORM="-xO2 -Wu,-O2~yz"
-            C_O_FLAG_NONE=""
-            CXX_O_FLAG_HIGHEST="-xO4 -Qoption ube -O4~yz $CC_HIGHEST -xchip=pentium"
-            CXX_O_FLAG_HI="-xO4 -Qoption ube -O4~yz"
-            CXX_O_FLAG_NORM="-xO2 -Qoption ube -O2~yz"
-            CXX_O_FLAG_NONE=""
+        case $OPENJDK_TARGET_CPU_ARCH in
+          x86)
+            C_O_FLAG_HIGHEST="-xO4 -Wu,-O4~yz $CC_HIGHEST -xregs=no%frameptr"
+            C_O_FLAG_HI="-xO4 -Wu,-O4~yz -xregs=no%frameptr"
+            C_O_FLAG_NORM="-xO2 -Wu,-O2~yz -xregs=no%frameptr"
+            C_O_FLAG_NONE="-xregs=no%frameptr"
+            CXX_O_FLAG_HIGHEST="-xO4 -Qoption ube -O4~yz $CC_HIGHEST -xregs=no%frameptr"
+            CXX_O_FLAG_HI="-xO4 -Qoption ube -O4~yz -xregs=no%frameptr"
+            CXX_O_FLAG_NORM="-xO2 -Qoption ube -O2~yz -xregs=no%frameptr"
+            CXX_O_FLAG_NONE="-xregs=no%frameptr"
+            if test "x$OPENJDK_TARGET_CPU" = xx86; then
+               C_O_FLAG_HIGHEST="$C_O_FLAG_HIGHEST -xchip=pentium"
+               CXX_O_FLAG_HIGHEST="$CXX_O_FLAG_HIGHEST -xchip=pentium"
+            fi
             ;;
           sparc)
             CFLAGS_JDK="${CFLAGS_JDK} -xmemalign=4s"
@@ -647,9 +663,11 @@
     ;;
   CL )
     D_FLAG=
-    C_O_FLAG_HI="-O2"
+    C_O_FLAG_HIGHEST="-O2"
+    C_O_FLAG_HI="-O1"
     C_O_FLAG_NORM="-O1"
     C_O_FLAG_NONE="-Od"
+    CXX_O_FLAG_HIGHEST="$C_O_FLAG_HIGHEST"
     CXX_O_FLAG_HI="$C_O_FLAG_HI"
     CXX_O_FLAG_NORM="$C_O_FLAG_NORM"
     CXX_O_FLAG_NONE="$C_O_FLAG_NONE"
@@ -680,15 +698,15 @@
 [
 
 if test "x$CFLAGS" != "x${ADDED_CFLAGS}"; then
-   AC_MSG_WARN([Ignoring CFLAGS($CFLAGS) found in environment. Use --with-extra-cflags"])
+   AC_MSG_WARN([Ignoring CFLAGS($CFLAGS) found in environment. Use --with-extra-cflags])
 fi
 
 if test "x$CXXFLAGS" != "x${ADDED_CXXFLAGS}"; then
-   AC_MSG_WARN([Ignoring CXXFLAGS($CXXFLAGS) found in environment. Use --with-extra-cxxflags"])
+   AC_MSG_WARN([Ignoring CXXFLAGS($CXXFLAGS) found in environment. Use --with-extra-cxxflags])
 fi
 
 if test "x$LDFLAGS" != "x${ADDED_LDFLAGS}"; then
-   AC_MSG_WARN([Ignoring LDFLAGS($LDFLAGS) found in environment. Use --with-extra-ldflags"])
+   AC_MSG_WARN([Ignoring LDFLAGS($LDFLAGS) found in environment. Use --with-extra-ldflags])
 fi
 
 AC_ARG_WITH(extra-cflags, [AS_HELP_STRING([--with-extra-cflags],
@@ -704,6 +722,15 @@
 CXXFLAGS_JDK="${CXXFLAGS_JDK} $with_extra_cxxflags"
 LDFLAGS_JDK="${LDFLAGS_JDK} $with_extra_ldflags"
 
+# Hotspot needs these set in their legacy form
+LEGACY_EXTRA_CFLAGS=$with_extra_cflags
+LEGACY_EXTRA_CXXFLAGS=$with_extra_cxxflags
+LEGACY_EXTRA_LDFLAGS=$with_extra_ldflags
+
+AC_SUBST(LEGACY_EXTRA_CFLAGS)
+AC_SUBST(LEGACY_EXTRA_CXXFLAGS)
+AC_SUBST(LEGACY_EXTRA_LDFLAGS)
+
 ###############################################################################
 #
 # Now setup the CFLAGS and LDFLAGS for the JDK build.
@@ -729,19 +756,30 @@
 	  esac
           ;;
       ossc )
-      	  CFLAGS_JDK="$CFLAGS_JDK -xc99=%none -xCC -errshort=tags -Xa -v -mt -norunpath -xnolib"
-      	  CXXFLAGS_JDK="$CXXFLAGS_JDK -errtags=yes +w -mt -features=no%except -DCC_NOEX"
+          CCXXFLAGS_JDK="$CCXXFLAGS $CCXXFLAGS_JDK -DTRACING -DMACRO_MEMSYS_OPS -DBREAKPTS"
+          case $OPENJDK_TARGET_CPU_ARCH in
+          x86 )
+            CCXXFLAGS_JDK="$CCXXFLAGS_JDK -DcpuIntel -Di586 -Di386"
+       	    CFLAGS_JDK="$CFLAGS_JDK -erroff=E_BAD_PRAGMA_PACK_VALUE"
+          ;;
+          esac
+
+      	  CFLAGS_JDK="$CFLAGS_JDK -xc99=%none -xCC -errshort=tags -Xa -v -mt -W0,-noglobal"
+      	  CXXFLAGS_JDK="$CXXFLAGS_JDK -errtags=yes +w -mt -features=no%except -DCC_NOEX -norunpath -xnolib"
+
+          LDFLAGS_JDK="$LDFLAGS_JDK -z defs -xildoff -ztext"
+          LDFLAGS_CXX_JDK="$LDFLAGS_CXX_JDK -norunpath -xnolib"
           ;;
       cl )
           CCXXFLAGS_JDK="$CCXXFLAGS $CCXXFLAGS_JDK -Zi -MD -Zc:wchar_t- -W3 -wd4800 \
                -D_STATIC_CPPLIB -D_DISABLE_DEPRECATE_STATIC_CPPLIB -DWIN32_LEAN_AND_MEAN \
 	       -D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE \
 	       -DWIN32 -DIAL"
-          case $LEGACY_OPENJDK_TARGET_CPU1 in
-              i?86 )
+          case $OPENJDK_TARGET_CPU in
+              x86 )
                   CCXXFLAGS_JDK="$CCXXFLAGS_JDK -D_X86_ -Dx86"
                   ;;
-              amd64 )
+              x86_64 )
                   CCXXFLAGS_JDK="$CCXXFLAGS_JDK -D_AMD64_ -Damd64"
                   ;;
           esac
@@ -749,24 +787,6 @@
 esac
 
 ###############################################################################
-#
-# Cross-compile arch specific flags
-
-#
-if test "x$JDK_VARIANT" = "xembedded"; then
-   CCXXFLAGS_JDK="$CCXXFLAGS_JDK -DJAVASE_EMBEDDED"
-fi
-
-case $OPENJDK_TARGET_CPU_ARCH in
-arm )
-    CCXXFLAGS_JDK="$CCXXFLAGS_JDK -fsigned-char"
-    ;;
-ppc )
-    CCXXFLAGS_JDK="$CCXXFLAGS_JDK -fsigned-char"
-    ;;
-esac
-
-###############################################################################
 
 CCXXFLAGS_JDK="$CCXXFLAGS_JDK $ADD_LP64"
 
@@ -774,11 +794,17 @@
 PACKAGE_PATH=/opt/local
 AC_SUBST(PACKAGE_PATH)
 
-# Sometimes we use a cpu dir (.../lib/amd64/server) 
-# Sometimes not (.../lib/server) 
-LIBARCHDIR="$LEGACY_OPENJDK_TARGET_CPU2/"
-if test "x$ENDIAN" = xlittle; then
-    CCXXFLAGS_JDK="$CCXXFLAGS_JDK -D_LITTLE_ENDIAN"
+if test "x$OPENJDK_TARGET_CPU_ENDIAN" = xlittle; then
+    # The macro _LITTLE_ENDIAN needs to be defined the same to avoid the
+    #   Sun C compiler warning message: warning: macro redefined: _LITTLE_ENDIAN
+    #   (The Solaris X86 system defines this in file /usr/include/sys/isa_defs.h).
+    #   Note: -Dmacro         is the same as    #define macro 1
+    #         -Dmacro=	    is the same as    #define macro
+    if test "x$OPENJDK_TARGET_OS" = xsolaris; then
+        CCXXFLAGS_JDK="$CCXXFLAGS_JDK -D_LITTLE_ENDIAN="
+    else
+        CCXXFLAGS_JDK="$CCXXFLAGS_JDK -D_LITTLE_ENDIAN"
+    fi
 else
     CCXXFLAGS_JDK="$CCXXFLAGS_JDK -D_BIG_ENDIAN"
 fi
@@ -793,27 +819,29 @@
 fi
 if test "x$OPENJDK_TARGET_OS" = xmacosx; then
     CCXXFLAGS_JDK="$CCXXFLAGS_JDK -DMACOSX -D_ALLBSD_SOURCE"
-    LIBARCHDIR=""
 fi
 if test "x$OPENJDK_TARGET_OS" = xbsd; then
     CCXXFLAGS_JDK="$CCXXFLAGS_JDK -DBSD -D_ALLBSD_SOURCE"
 fi
 if test "x$DEBUG_LEVEL" = xrelease; then
     CCXXFLAGS_JDK="$CCXXFLAGS_JDK -DNDEBUG"
+    if test "x$OPENJDK_TARGET_OS" = xsolaris; then
+        CCXXFLAGS_JDK="$CCXXFLAGS_JDK -DTRIMMED"
+    fi
 else
     CCXXFLAGS_JDK="$CCXXFLAGS_JDK -DDEBUG"
 fi
 
-CCXXFLAGS_JDK="$CCXXFLAGS_JDK -DARCH='\"$LEGACY_OPENJDK_TARGET_CPU1\"' -D$LEGACY_OPENJDK_TARGET_CPU1"
+CCXXFLAGS_JDK="$CCXXFLAGS_JDK -DARCH='\"$OPENJDK_TARGET_CPU_LEGACY\"' -D$OPENJDK_TARGET_CPU_LEGACY"
 CCXXFLAGS_JDK="$CCXXFLAGS_JDK -DRELEASE='\"$RELEASE\"'"
 
 CCXXFLAGS_JDK="$CCXXFLAGS_JDK \
         -I${JDK_OUTPUTDIR}/include \
         -I${JDK_OUTPUTDIR}/include/$OPENJDK_TARGET_OS \
         -I${JDK_TOPDIR}/src/share/javavm/export \
-        -I${JDK_TOPDIR}/src/$LEGACY_OPENJDK_TARGET_OS_API/javavm/export \
+        -I${JDK_TOPDIR}/src/$OPENJDK_TARGET_OS_API_DIR/javavm/export \
         -I${JDK_TOPDIR}/src/share/native/common \
-        -I${JDK_TOPDIR}/src/$LEGACY_OPENJDK_TARGET_OS_API/native/common"
+        -I${JDK_TOPDIR}/src/$OPENJDK_TARGET_OS_API_DIR/native/common"
 
 # The shared libraries are compiled using the picflag.
 CFLAGS_JDKLIB="$CCXXFLAGS_JDK $CFLAGS_JDK $PICFLAG $CFLAGS_JDKLIB_EXTRA"
@@ -833,7 +861,7 @@
 # Thus we offer the compiler to find libjvm.so first in server then in client. It works. Ugh.
 if test "x$COMPILER_TYPE" = xCL; then
     LDFLAGS_JDK="$LDFLAGS_JDK -nologo -opt:ref -incremental:no"
-    if test "x$LEGACY_OPENJDK_TARGET_CPU1" = xi586; then 
+    if test "x$OPENJDK_TARGET_CPU" = xx86; then 
         LDFLAGS_JDK="$LDFLAGS_JDK -safeseh"
     fi
     # TODO: make -debug optional "--disable-full-debug-symbols"
@@ -861,20 +889,18 @@
     fi
 
     LDFLAGS_JDKLIB="${LDFLAGS_JDK} $SHARED_LIBRARY_FLAGS \
-                    -L${JDK_OUTPUTDIR}/lib/${LIBARCHDIR}server \
-                    -L${JDK_OUTPUTDIR}/lib/${LIBARCHDIR}client \
-  	            -L${JDK_OUTPUTDIR}/lib/${LIBARCHDIR}"
-    LDFLAGS_JDKLIB_SUFFIX="-ljvm -ljava"
+                    -L${JDK_OUTPUTDIR}/lib${OPENJDK_TARGET_CPU_LIBDIR}/server \
+                    -L${JDK_OUTPUTDIR}/lib${OPENJDK_TARGET_CPU_LIBDIR}/client \
+                    -L${JDK_OUTPUTDIR}/lib${OPENJDK_TARGET_CPU_LIBDIR}"
+
+    LDFLAGS_JDKLIB_SUFFIX="-ljava -ljvm"
     if test "x$COMPILER_NAME" = xossc; then
         LDFLAGS_JDKLIB_SUFFIX="$LDFLAGS_JDKLIB_SUFFIX -lc"
     fi
 
-    # Only the jli library is explicitly linked when the launchers are built.
-    # The libjvm is then dynamically loaded/linked by the launcher.
     LDFLAGS_JDKEXE="${LDFLAGS_JDK}"
-    if test "x$OPENJDK_TARGET_OS" != "xmacosx"; then
-       LDFLAGS_JDKEXE="$LDFLAGS_JDKEXE -L${JDK_OUTPUTDIR}/lib/${LIBARCHDIR}jli"
-       LDFLAGS_JDKEXE_SUFFIX="-ljli"
+    if test "x$OPENJDK_TARGET_OS" = xlinux; then
+        LDFLAGS_JDKEXE="$LDFLAGS_JDKEXE -Xlinker --allow-shlib-undefined"
     fi
 fi
 
@@ -905,4 +931,5 @@
 AC_SUBST(LDFLAGS_JDKEXE)
 AC_SUBST(LDFLAGS_JDKLIB_SUFFIX)
 AC_SUBST(LDFLAGS_JDKEXE_SUFFIX)
+AC_SUBST(LDFLAGS_CXX_JDK)
 ])
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/common/bin/boot_cycle.sh	Wed Jul 05 18:22:52 2017 +0200
@@ -0,0 +1,77 @@
+#!/bin/bash
+#
+# Copyright (c) 2012, 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.
+#
+# 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.
+#
+
+# The boot_cycle.sh script performs two complete image builds (no javadoc though....)
+# where the second build uses the first build as the boot jdk.
+#
+# This is useful to verify that the build is self hoisting and assists
+# in flushing out bugs. You can follow up with compare_objects.sh to check
+# that the two boot_cycle_?/images/j2sdk are identical. They should be.
+#
+# Usage:
+# Specify the configure arguments to boot_cycle.sh, for example:
+#
+#    sh common/bin/boot_cycle.sh --enable-debug --with-jvm-variants=server
+#
+# The same arguments will be used for both builds, except of course --with-boot-jdk
+# that will be adjusted to boot_cycle_1 for the second build.
+
+SCRIPT_DIR=`pwd`/`dirname $0`
+ROOT_DIR=`(cd $SCRIPT_DIR/../.. ; pwd)`
+BUILD_DIR=$ROOT_DIR/build
+mkdir -p $BUILD_DIR
+AUTOCONF_DIR=`(cd $SCRIPT_DIR/../autoconf ; pwd)`
+BOOT_CYCLE_1_DIR=$BUILD_DIR/boot_cycle_1
+BOOT_CYCLE_2_DIR=$BUILD_DIR/boot_cycle_2
+
+# Create the boot cycle dirs in the build directory.
+mkdir -p $BOOT_CYCLE_1_DIR
+mkdir -p $BOOT_CYCLE_2_DIR
+
+cd $BOOT_CYCLE_1_DIR
+# Configure!
+sh $AUTOCONF_DIR/configure "$@"
+# Now build!
+make images
+
+if ! test -x $BOOT_CYCLE_1_DIR/images/j2sdk-image/bin/java ; then
+    echo Failed to build the executable $BOOT_CYCLE_1_DIR/images/j2sdk-image/bin/java
+    exit 1
+fi
+
+cd $BOOT_CYCLE_2_DIR
+# Pickup the configure arguments, but drop any --with-boot-jdk=....
+# and add the correct --with-boot-jdk=...boot_cycle_1... at the end.
+ARGUMENTS="`cat $BOOT_CYCLE_1_DIR/configure-arguments|sed 's/--with-boot-jdk=[^ ]*//'` --with-boot-jdk=$BOOT_CYCLE_1_DIR/images/j2sdk-image"
+# Configure using these adjusted arguments.
+sh $AUTOCONF_DIR/configure $ARGUMENTS
+# Now build!
+make images
+
+if ! test -x $BOOT_CYCLE_2_DIR/images/j2sdk-image/bin/java ; then
+    echo Failed to build the final executable $BOOT_CYCLE_2_DIR/images/j2sdk-image/bin/java
+    exit 1
+fi
+
+
--- a/common/bin/compare-objects.sh	Wed Jul 05 18:22:17 2017 +0200
+++ b/common/bin/compare-objects.sh	Wed Jul 05 18:22:52 2017 +0200
@@ -30,7 +30,7 @@
 #
 
 if [ "x$1" = "x-h" ] || [ "x$1" = "x--help" ] || [ "x$1" == "x" ]; then
-    echo "bash ./common/bin/compare-build.sh old_jdk_build_dir new_jdk_build_dir"
+    echo "bash ./common/bin/compare-objects.sh old_jdk_build_dir new_jdk_build_dir <pattern>"
     echo ""
     echo "Compare object files"
     echo ""
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/common/bin/test_builds.sh	Wed Jul 05 18:22:52 2017 +0200
@@ -0,0 +1,184 @@
+#!/bin/bash
+
+set -x
+set -e
+
+options="$*"
+option="$1"
+
+tmp=/tmp/test_builds.$$
+rm -f -r ${tmp}
+mkdir -p ${tmp}
+
+errMessages=${tmp}/error_messages.txt
+
+#######
+# Error function
+error() # message
+{
+   echo "ERROR: $1" | tee -a ${errMessages}
+}
+# Check errors
+checkErrors()
+{
+    if [ -s ${errMessages} ] ; then
+        cat ${errMessages}
+	exit 1
+    fi
+}
+#######
+
+os="`uname -s`"
+arch="`uname -p`"
+make=make
+
+if [ "${os}" = "SunOS" ] ; then
+  make=gmake
+  export J7="/opt/java/jdk1.7.0"
+elif [ "${os}" = "Darwin" ] ; then
+  export J7="/Library/Java/JavaVirtualMachines/1.7.0.jdk/Contents/Home"
+elif [ "${os}" = "Linux" -a "${arch}" = "x86_64" ] ; then
+  export J7="/usr/lib/jvm/java-7-openjdk-amd64/"
+else
+  echo "What os/arch is this: ${os}/${arch}"
+  exit 1
+fi
+
+# Must have a jdk7
+if [ ! -d ${J7} ] ; then
+  echo "No JDK7 found at: ${J7}"
+  exit 1
+fi
+
+# What sources we use
+fromroot="http://hg.openjdk.java.net/build-infra/jdk8"
+
+# Where we do it
+root="testbuilds"
+mkdir -p ${root}
+
+# Three areas, last three are cloned from first to insure sameness
+t0=${root}/t0
+t1=${root}/t1
+t2=${root}/t2
+t3=${root}/t3
+repolist="${t0} ${t1} ${t2} ${t3}"
+
+# Optional complete clobber
+if [ "${option}" = "clobber" ] ; then
+  for i in ${repolist} ; do
+    rm -f -r ${i}
+  done
+fi
+
+# Get top repos
+if [ ! -d ${t0}/.hg ] ; then
+  rm -f -r ${t0}
+  hg clone ${fromroot} ${t0}
+fi
+for i in ${t1} ${t2} ${t3} ; do
+  if [ ! -d ${i}/.hg ] ; then
+    hg clone ${t0} ${i}
+  fi
+done
+
+# Get repos updated
+for i in ${repolist} ; do
+  ( \
+    set -e \
+    && cd ${i} \
+    && sh ./get_source.sh \
+    || error "Cannot get source" \
+  ) 2>&1 | tee ${i}.get_source.txt
+  checkErrors
+done
+
+# Optional clean
+if [ "${option}" = "clean" ] ; then
+  for i in ${repolist} ; do
+    rm -f -r ${i}/build
+    rm -f -r ${i}/*/build
+    rm -f -r ${i}/*/dist
+  done
+fi
+
+# Check changes on working set files
+for i in ${repolist} ; do
+  ( \
+    set -e \
+    && cd ${i} \
+    && sh ./make/scripts/hgforest.sh status \
+    || error "Cannot check status" \
+  ) 2>&1 | tee ${i}.hg.status.txt
+  checkErrors
+done
+
+# Configure for build-infra building
+for i in ${t1} ${t2} ; do
+  ( \
+    set -e \
+    && cd ${i}/common/makefiles \
+    && sh ../autoconf/configure --with-boot-jdk=${J7} \
+    || error "Cannot configure" \
+  ) 2>&1 | tee ${i}.config.txt
+  checkErrors
+done
+
+# Do build-infra builds
+for i in ${t1} ${t2} ; do
+  ( \
+    set -e \
+    && cd ${i}/common/makefiles \
+    && ${make}  \
+      FULL_VERSION:=1.8.0-internal-b00 \
+      JRE_RELEASE_VERSION:=1.8.0-internal-b00 \
+      USER_RELEASE_SUFFIX:=compare \
+      RELEASE:=1.8.0-internal \
+      VERBOSE= \
+      LIBARCH= \
+         all images \
+    || error "Cannot build" \
+  ) 2>&1 | tee ${i}.build.txt
+  checkErrors
+done
+
+# Compare build-infra builds
+( \
+  sh ${t0}/common/bin/compareimage.sh \
+    ${t1}/build/*/images/j2sdk-image \
+    ${t2}/build/*/images/j2sdk-image \
+    || error "Cannot compare" \
+) 2>&1 | tee ${root}/build-infra-comparison.txt
+checkErrors
+
+# Do old build
+unset JAVA_HOME
+export ALT_BOOTDIR="${J7}"
+( \
+  cd ${t3} \
+  && ${make} FULL_VERSION='"1.8.0-internal" sanity \
+  || error "Cannot sanity" \
+) 2>&1 | tee ${t3}.sanity.txt
+checkErrors
+( \
+  cd ${t3} \
+  && ${make} \
+      FULL_VERSION='"1.8.0-internal" \
+      JRE_RELEASE_VERSION:=1.8.0-internal-b00 \
+      USER_RELEASE_SUFFIX:=compare \
+      RELEASE:=1.8.0-internal \
+  || error "Cannot build old way" \
+) 2>&1 | tee ${t3}.build.txt
+checkErrors
+
+# Compare old build to build-infra build 
+( \
+  sh ${t0}/common/bin/compareimage.sh \
+    ${t3}/build/*/j2sdk-image \
+    ${t1}/build/*/images/j2sdk-image \
+    || error "Cannot compare" \
+) 2>&1 | tee ${root}/build-comparison.txt
+checkErrors
+
+exit 0
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/common/bin/unicode2x.sed	Wed Jul 05 18:22:52 2017 +0200
@@ -0,0 +1,100 @@
+s/\\u0020/\x20/g
+s/\\u003A/\x3A/g
+s/\\u006B/\x6B/g
+s/\\u0075/\x75/g
+s/\\u00A0/\xA0/g
+s/\\u00A3/\xA3/g
+s/\\u00B0/\xB0/g
+s/\\u00B7/\xB7/g
+s/\\u00BA/\xBA/g
+s/\\u00BF/\xBF/g
+s/\\u00C0/\xC0/g
+s/\\u00C1/\xC1/g
+s/\\u00C2/\xC2/g
+s/\\u00C4/\xC4/g
+s/\\u00C5/\xC5/g
+s/\\u00C8/\xC8/g
+s/\\u00C9/\xC9/g
+s/\\u00CA/\xCA/g
+s/\\u00CD/\xCD/g
+s/\\u00CE/\xCE/g
+s/\\u00D3/\xD3/g
+s/\\u00D4/\xD4/g
+s/\\u00D6/\xD6/g
+s/\\u00DA/\xDA/g
+s/\\u00DC/\xDC/g
+s/\\u00DD/\xDD/g
+s/\\u00DF/\xDF/g
+s/\\u00E0/\xE0/g
+s/\\u00E1/\xE1/g
+s/\\u00E2/\xE2/g
+s/\\u00E3/\xE3/g
+s/\\u00E4/\xE4/g
+s/\\u00E5/\xE5/g
+s/\\u00E6/\xE6/g
+s/\\u00E7/\xE7/g
+s/\\u00E8/\xE8/g
+s/\\u00E9/\xE9/g
+s/\\u00EA/\xEA/g
+s/\\u00EB/\xEB/g
+s/\\u00EC/\xEC/g
+s/\\u00ED/\xED/g
+s/\\u00EE/\xEE/g
+s/\\u00EF/\xEF/g
+s/\\u00F1/\xF1/g
+s/\\u00F2/\xF2/g
+s/\\u00F3/\xF3/g
+s/\\u00F4/\xF4/g
+s/\\u00F5/\xF5/g
+s/\\u00F6/\xF6/g
+s/\\u00F9/\xF9/g
+s/\\u00FA/\xFA/g
+s/\\u00FC/\xFC/g
+s/\\u0020/\x20/g
+s/\\u003f/\x3f/g
+s/\\u006f/\x6f/g
+s/\\u0075/\x75/g
+s/\\u00a0/\xa0/g
+s/\\u00a3/\xa3/g
+s/\\u00b0/\xb0/g
+s/\\u00ba/\xba/g
+s/\\u00bf/\xbf/g
+s/\\u00c1/\xc1/g
+s/\\u00c4/\xc4/g
+s/\\u00c5/\xc5/g
+s/\\u00c8/\xc8/g
+s/\\u00c9/\xc9/g
+s/\\u00ca/\xca/g
+s/\\u00cd/\xcd/g
+s/\\u00d6/\xd6/g
+s/\\u00dc/\xdc/g
+s/\\u00dd/\xdd/g
+s/\\u00df/\xdf/g
+s/\\u00e0/\xe0/g
+s/\\u00e1/\xe1/g
+s/\\u00e2/\xe2/g
+s/\\u00e3/\xe3/g
+s/\\u00e4/\xe4/g
+s/\\u00e5/\xe5/g
+s/\\u00e7/\xe7/g
+s/\\u00e8/\xe8/g
+s/\\u00e9/\xe9/g
+s/\\u00ea/\xea/g
+s/\\u00eb/\xeb/g
+s/\\u00ec/\xec/g
+s/\\u00ed/\xed/g
+s/\\u00ee/\xee/g
+s/\\u00ef/\xef/g
+s/\\u00f0/\xf0/g
+s/\\u00f1/\xf1/g
+s/\\u00f2/\xf2/g
+s/\\u00f3/\xf3/g
+s/\\u00f4/\xf4/g
+s/\\u00f5/\xf5/g
+s/\\u00f6/\xf6/g
+s/\\u00f7/\xf7/g
+s/\\u00f8/\xf8/g
+s/\\u00f9/\xf9/g
+s/\\u00fa/\xfa/g
+s/\\u00fc/\xfc/g
+s/\\u00ff/\xff/g
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/common/makefiles/HotspotWrapper.gmk	Wed Jul 05 18:22:52 2017 +0200
@@ -0,0 +1,49 @@
+#
+# Copyright (c) 2011, 2012, 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.
+#
+
+# Include the legacy hotspot-spec.gmk (which in turns includes spec.gmk)
+BASE_SPEC:=$(SPEC)
+include $(dir $(SPEC))hotspot-spec.gmk
+include MakeBase.gmk
+
+# Inclusion of this pseudo-target will cause make to execute this file
+# serially, regardless of -j. Recursively called makefiles will not be
+# affected, however. This is required for correct dependency management.
+.NOTPARALLEL:
+
+default: all
+
+# Get all files except .hg in the hotspot directory.
+HOTSPOT_FILES :=  $(shell $(FIND) $(HOTSPOT_TOPDIR) -name ".hg" -prune -o -print)
+
+$(HOTSPOT_OUTPUTDIR)/_hotspot.timestamp: $(HOTSPOT_FILES)
+	@($(CD) $(HOTSPOT_TOPDIR)/make && $(MAKE) -j1 $(HOTSPOT_MAKE_ARGS) SPEC=$(HOTSPOT_SPEC) BASE_SPEC=$(BASE_SPEC))
+	$(TOUCH) $@
+
+hotspot: $(HOTSPOT_OUTPUTDIR)/_hotspot.timestamp
+
+all: hotspot
+
+.PHONY: default all hotspot
--- a/common/makefiles/JavaCompilation.gmk	Wed Jul 05 18:22:17 2017 +0200
+++ b/common/makefiles/JavaCompilation.gmk	Wed Jul 05 18:22:52 2017 +0200
@@ -23,40 +23,14 @@
 # questions.
 #
 
-# The complexity of this makefile is not the fault of make, but the fault
-# of javac and javah. The basic problems are:
-#
-#    1) Compiling a single Java source file unpredictably generates anything
-#       between zero (0!) and an infinite number of .class files!
-#    2) There is no hint, for which classes javah needs to be run,
-#       and it happily generates .h files for classes with no native methods.
-#    3) javac and javah do not cleanup anything, for example if an internal
-#       class (potentially with native methods) is removed from a Java source file.
-#
-# This makefile is a tribute to GNU make. And yes, it was harder to write than it is
-# to read. The include/excludes of directories and files are only a temporary measure
-# to work around the messy jdk sources that put platform specific code in src/share/classes.
-#
-# We should move most of the functionality of this makefile into a
-# smart javac/javah/javadoc/jar combo tool. sjavac ?
-#
-# I.e. 1) It always generates a single output, a zip-file from a number of source roots.
-#         The zip file contains information that enable incremental builds with full 
-#         dependency tracking between packages.
-#      2) It automatically generates the right .h files.
-#      3) It keeps its house clean.
-#      *) Generates intermediate files to be used for javadoc generation later.
-#      and does all the other useful things that this makefile does, such as:
-#          use all cores for compilation, reuse the running JVM for all compilations,
-#          and has pubapi dependency tracking to minimize the number of files
-#          that need to be recompiled during an incremental build.
-# 
-# A zip file, or several zip files combined, can then be converted to a .jar file, or to a .jmod file.
-#
-# This would make this makefile much much simpler. I.e. make can be used
-# for its real purpose, track dependencies and trigger a recompile if a
-# dependency has changed.
-#
+# This makefile is much simpler now that it can use the smart javac wrapper
+# for dependency tracking between java packages and incremental compiles.
+# It could be even more simple if we added support for incremental jar updates
+# directly from the smart javac wrapper.
+
+# Cleaning/copying properties here is not a good solution. The properties
+# should be cleaned/copied by a annotation processor in sjavac.
+
 # When you read this source. Remember that $(sort ...) has the side effect
 # of removing duplicates. It is actually this side effect that is
 # desired whenever sort is used below!
@@ -67,25 +41,15 @@
 
 FALSE_FIND_PATTERN:=-name FILE_NAME_THAT_DOESNT_EXIST
 
-# If compilation of java package fails, then the public api file for that
-# package will not be genereated. We add this fallback rule to generate
-# an empty pubapi file. 
-%.api:
-	if test ! -f $@; then $(MKDIR) -p $(@D); $(TOUCH) $@; fi
-
 define SetupJavaCompiler
     # param 1 is for example BOOT_JAVAC or NEW_JAVAC
     # This is the name later used to decide which java compiler to use.
     # param 2-9 are named args.
     #   JVM:=The jvm used to run the javac/javah command
     #   JAVAC:=The javac jar and bootstrap classpath changes, or just bin/javac if JVM is left out
-    #   JAVAH:=The javah jar and bootstrap classpath changes, or just bin/javah if JVM is left out
     #   FLAGS:=Flags to be supplied to javac
-    #   MODE:=SINGLE_THREADED_BATCH (primarily for old javac) or MULTI_CORE_CONCURRENT
-    #      only for MULTI_CORE_CONCURRENT are the options below relevant:
     #   SERVER_DIR:=Use a javac server (-XDserver) and store the server related files here
     #   SERVER_JVM:=Use this JVM for the server. Defaults to the JVM above.
-    #   USE_DEPS:=true means use -XDdeps,-XDpubapi and -XDnativeapi to track java dependencies
     $(if $2,$1_$(strip $2))
     $(if $3,$1_$(strip $3))
     $(if $4,$1_$(strip $4))
@@ -96,21 +60,17 @@
     $(if $9,$1_$(strip $9))
     $(if $(10),$(error Internal makefile error: Too many arguments to SetupJavaCompiler, please update JavaCompilation.gmk))
 
-    ifeq ($$($1_MODE),MULTI_CORE_CONCURRENT)
-	ifneq (,$$($1_SERVER_DIR))
-            # A javac server has been requested.
-            # The port file contains the tcp/ip on which the server listens
-            # and the cookie necessary to talk to the server.
-            $1_JAVAC_PORTFILE:=$$($1_SERVER_DIR)/$1.port
-            ifeq ($$($1_SERVER_JVM),)
-                # You can use a different JVM to run the background javac server.
-                # But if not set, it defaults to the same JVM that is used to start
-                # the javac command.
-                $1_SERVER_JVM:=$$($1_JVM)
-            endif
-            # Set the $1_REMOTE to spawn a background javac server.
-	    $1_REMOTE:=-XDserver:portfile=$$($1_JAVAC_PORTFILE),poolsize=$(JAVAC_SERVER_CORES),javac=$$(subst $$(SPACE),%20,$$(subst $$(COMMA),%2C,$$(strip $$($1_SERVER_JVM) $$($1_JAVAC))))
+    ifeq ($$(ENABLE_SJAVAC),yes)
+        # The port file contains the tcp/ip on which the server listens
+        # and the cookie necessary to talk to the server.
+        $1_JAVAC_PORTFILE:=$$($1_SERVER_DIR)/server.port
+        # You can use a different JVM to run the background javac server.
+        ifeq ($$($1_SERVER_JVM),)
+            # It defaults to the same JVM that is used to start the javac command.
+            $1_SERVER_JVM:=$$($1_JVM)
         endif
+        # Set the $1_REMOTE to spawn a background javac server.
+        $1_REMOTE:=-XDserver:portfile=$$($1_JAVAC_PORTFILE),poolsize=$(SJAVAC_SERVER_CORES),id=$1,javac=$$(subst $$(SPACE),%20,$$(subst $$(COMMA),%2C,$$(strip $$($1_SERVER_JVM) $$($1_JAVAC))))
     endif
 endef
 
@@ -127,7 +87,7 @@
     #    JAR:=Jar file to create
     #    MANIFEST:=Optional manifest file template.
     #    JARMAIN:=Optional main class to add to manifest
-    #    JARINDEX := 
+    #    JARINDEX:=true means generate the index in the jar file.
     #    SKIP_METAINF:=Set to prevent contents of an META-INF directory to be automatically 
     #                  added to the archive.
     #    EXTRA_MANIFEST_ATTR:=Extra attribute to add to manifest.
@@ -152,9 +112,6 @@
     $1_MANIFEST_FILE:=$$(dir $$($1_JAR))_the.$$($1_JARNAME)_manifest
     $1_DELETESS_FILE:=$$(dir $$($1_JAR))_the.$$($1_JARNAME)_deletess
     $1_DELETES_FILE:=$$(dir $$($1_JAR))_the.$$($1_JARNAME)_deletes
-    $1_PUBAPI_NOTIFICATIONS_FILE:=$$(dir $$($1_JAR))_the.$$($1_JARNAME)_pubapi_notifications
-    $1_NATIVEAPI_NOTIFICATIONS_FILE:=$$(dir $$($1_JAR))_the.$$($1_JARNAME)_native_notifications
-    $1_NATIVEAPI_FILE:=$$(dir $$($1_JAR))_the.$$($1_JARNAME)_native
     $1_BIN:=$$(dir $$($1_JAR))
 
     ifeq (,$$($1_SUFFIXES))
@@ -180,6 +137,7 @@
         $1_GREP_EXCLUDES:=| $(GREP) -v -f $$($1_BIN)/_the.$$($1_JARNAME)_exclude
     endif
 
+    # Check if this jar needs to have its index generated.
     ifneq (,$$($1_JARINDEX))
       $1_JARINDEX = (cd $$(dir $$@) && $(JAR) -i $$(notdir $$@))
     else
@@ -188,14 +146,17 @@
     # When this macro is run in the same makefile as the java compilation, dependencies are transfered
     # in make variables. When the macro is run in a different makefile than the java compilation, the 
     # dependencies need to be found in the filesystem.
-    $1_ALL_SRCS:=$$(foreach src,$$($1_SRCS),$$(shell ($(FIND) $$(src) -type f \
+    ifneq (,$2)
+        $1_DEPS:=$2
+    else
+        $1_DEPS:=$$(foreach src,$$($1_SRCS),$$(shell ($(FIND) $$(src) -type f \
 			-a \( $$($1_FIND_PATTERNS) \) $$($1_GREP_INCLUDES) \
-			$$($1_GREP_EXCLUDES) && $(ECHO) $$($1_EXTRA_FILES))))
-    ifeq (,$$($1_SKIP_METAINF))
-        $1_ALL_SRCS+=$$(foreach src,$$($1_SRCS),$$(shell $(FIND) $$(src)/META-INF -type f 2> /dev/null))
+			$$($1_GREP_EXCLUDES) && $(ECHO) $$(addprefix $$(src)/,$$($1_EXTRA_FILES)))))
+        ifeq (,$$($1_SKIP_METAINF))
+            $1_DEPS+=$$(foreach src,$$($1_SRCS),$$(shell $(FIND) $$(src)/META-INF -type f 2> /dev/null))
+        endif
     endif
 
-
     # Utility macros, to make the shell script receipt somewhat easier to dechipher.
 
     # The capture contents macro finds all files (matching the patterns, typically
@@ -208,19 +169,12 @@
     # The capture deletes macro finds all deleted files and concatenates them. The resulting file
     # tells us what to remove from the jar-file.
     $1_CAPTURE_DELETES=$$(foreach src,$$($1_SRCS),($(FIND) $$(src) -name _the.package.deleted -newer $$@ -exec $(SED) 's|$$(src)||g' \{\} >> $$($1_DELETES_FILE) \;) &&)
-    # The capture pubapi notifications scans for pubapi change notifications. If such notifications are
-    # found, then we will build the classes leading up to the jar again, to take into account the new timestamps
-    # on the changed pubapi files.
-    $1_CAPTURE_PUBAPI_NOTIFICATIONS=$$(foreach src,$$($1_SRCS),\
-                    (cd $$(src) && \
-                    $(FIND) . -name _the.package.api.notify -exec dirname \{\} \; >> $$($1_PUBAPI_NOTIFICATIONS_FILE) ; \
-                    true) &&)
     # The update contents macro updates the jar file with the previously capture contents.
     $1_UPDATE_CONTENTS=$$(foreach src,$$($1_SRCS),\
                     (cd $$(src) && \
                      if [ -s _the.$$($1_JARNAME)_contents ]; then \
                          $(ECHO) "  updating" `$(WC) -l _the.$$($1_JARNAME)_contents | $(AWK) '{ print $$$$1 }'` files && \
-                         $(JAR) uf $$@ @_the.$$($1_JARNAME)_contents; \
+                         $(JAR) $$($1_JAR_UPDATE_OPTIONS) $$@ @_the.$$($1_JARNAME)_contents; \
                      fi) &&)
     # The s-variants of the above macros are used when the jar is created from scratch.
     $1_SCAPTURE_CONTENTS=$$(foreach src,$$($1_SRCS),\
@@ -234,30 +188,25 @@
 			$$(src)/_the.$$($1_JARNAME)_contents) && )
     endif
     $1_SUPDATE_CONTENTS=$$(foreach src,$$($1_SRCS),\
-                    (cd $$(src) && $(JAR) uf $$@ @$$(src)/_the.$$($1_JARNAME)_contents) &&)
+                    (cd $$(src) && $(JAR) $$($1_JAR_UPDATE_OPTIONS) $$@ @$$(src)/_the.$$($1_JARNAME)_contents) &&)
 
-    # The TOUCH macro is used to make sure all timestamps are identical for package files and the pubapi files.
-    # If we do not do this, we get random recompilations, the next time we run make, since the order of package building is random,
-    # ie independent of package --dependes on-> public api of another package. This is of course
-    # due to the fact that Java source often (always?) has circular dependencies. (Thus there is no correct order
-    # to compile packages, and we can just as well do them in a random order. Which we do.)
-    $1_TOUCH_API_FILES=$$(foreach src,$$($1_SRCS),\
-                    ($(FIND) $$(src) -name _the.package.api -exec $(TOUCH) -r $$($1_JAR) \{\} \; ; true) && \
-                    ($(FIND) $$(src) -name _the.package -exec $(TOUCH) -r $$($1_JAR) \{\} \; ; true) &&)
     # Use a slightly shorter name for logging, but with enough path to identify this jar.
     $1_NAME:=$$(subst $$(OUTPUT_ROOT)/,,$$($1_JAR))
 
     ifneq (,$$($1_CHECK_COMPRESS_JAR))
         $1_JAR_CREATE_OPTIONS := c0fm
+        $1_JAR_UPDATE_OPTIONS := u0f
         ifeq ($(COMPRESS_JARS), true)
             $1_JAR_CREATE_OPTIONS := cfm
+            $1_JAR_UPDATE_OPTIONS := uf
         endif
     else
         $1_JAR_CREATE_OPTIONS := cfm
+        $1_JAR_UPDATE_OPTIONS := uf
     endif
 
     # Here is the rule that creates/updates the jar file.
-    $$($1_JAR) : $2 $$($1_ALL_SRC)
+    $$($1_JAR) : $$($1_DEPS)
 	$(MKDIR) -p $$($1_BIN)
 	if [ -n "$$($1_MANIFEST)" ]; then \
 		$(SED) -e "s#@@RELEASE@@#$(RELEASE)#"           \
@@ -272,46 +221,28 @@
 		$(PRINTF) "$$($1_EXTRA_MANIFEST_ATTR)\n" >> $$($1_MANIFEST_FILE); \
 	fi
 	+if [ -s $$@ ]; then \
-		$(RM) -r $$($1_PUBAPI_NOTIFICATIONS_FILE) && \
-		$$($1_CAPTURE_PUBAPI_NOTIFICATIONS) \
-		if [ -s $$($1_PUBAPI_NOTIFICATIONS_FILE) ]; then \
-			$(ECHO) Public api change detected in: && \
-			$(CAT) $$($1_PUBAPI_NOTIFICATIONS_FILE) | $(TR) '/' '.' | $(SED) 's|^..||g' | $(SED) 's|\.$$$$||g' | $(AWK) '{print "  "$$$$1}' && \
-			$$(foreach src,$$($1_SRCS),($(FIND) $$(src) -name _the.package.api.notify $(FIND_DELETE); true) &&) \
-			$(MAKE) -f $(word 1,$(MAKEFILE_LIST)) $$($1_JAR) ; \
-		else \
-			$(ECHO) Modifying $$($1_NAME) && \
-			$$($1_CAPTURE_CONTENTS) \
-			$$($1_CAPTURE_METAINF) \
-			$(RM) $$($1_DELETES_FILE) && \
-			$$($1_CAPTURE_DELETES) \
-			$(CAT) $$($1_DELETES_FILE) > $$($1_DELETESS_FILE) && \
-			if [ -s $$($1_DELETESS_FILE) ]; then \
-				$(ECHO) "  deleting" `$(WC) -l $$($1_DELETESS_FILE) | $(AWK) '{ print $$$$1 }'` files && \
-	                        $(ZIP) -q -d $$@ `$(CAT) $$($1_DELETESS_FILE)` ; \
-			fi && \
-			$$($1_UPDATE_CONTENTS) true && \
-			$$($1_JARINDEX) && \
-			$$($1_TOUCH_API_FILES) true && \
-			$$(foreach src,$$($1_SRCS),($(FIND) $$(src) -name _the.package.api.notify $(FIND_DELETE); true) &&) true ; \
-		fi ; \
+		$(ECHO) Modifying $$($1_NAME) && \
+		$$($1_CAPTURE_CONTENTS) \
+		$$($1_CAPTURE_METAINF) \
+		$(RM) $$($1_DELETES_FILE) && \
+		$$($1_CAPTURE_DELETES) \
+		$(CAT) $$($1_DELETES_FILE) > $$($1_DELETESS_FILE) && \
+		if [ -s $$($1_DELETESS_FILE) ]; then \
+			$(ECHO) "  deleting" `$(WC) -l $$($1_DELETESS_FILE) | $(AWK) '{ print $$$$1 }'` files && \
+	                       $(ZIP) -q -d $$@ `$(CAT) $$($1_DELETESS_FILE)` ; \
+		fi && \
+		$$($1_UPDATE_CONTENTS) true && \
+		$$($1_JARINDEX) && true ; \
 	else \
 		$(ECHO) Creating $$($1_NAME) && $(JAR) $$($1_JAR_CREATE_OPTIONS) $$@ $$($1_MANIFEST_FILE) && \
 	        $$($1_SCAPTURE_CONTENTS) \
 		$$($1_SCAPTURE_METAINF) \
 		$$($1_SUPDATE_CONTENTS) \
-		$$($1_JARINDEX) && \
-		$$($1_TOUCH_API_FILES) true && \
-		$(RM) -r $$($1_NATIVEAPI_NOTIFICATIONS_FILE) $$($1_NATIVEAPI_FILE) && \
-		$$(foreach src,$$($1_SRCS),($(FIND) $$(src) -name "*.notify" $(FIND_DELETE); true) &&) true ; \
+		$$($1_JARINDEX) && true ; \
 	fi; 
 
 endef
 
-define append_to
-    $(ECHO) "$1" >> $2
-endef
-
 define SetupZipArchive
     # param 1 is for example ZIP_MYSOURCE
     # param 2,3,4,5,6,7,8,9 are named args.
@@ -343,7 +274,7 @@
     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)))
-        $1_ALL_SRCS     := $$(filter-out $$($1_SRC_EXCLUDES),$$($1_SRCS))
+        $1_ALL_SRCS     := $$(filter-out $$($1_SRC_EXCLUDES),$$($1_SRC))
     endif
 
     # Use a slightly shorter name for logging, but with enough path to identify this zip.
@@ -381,7 +312,8 @@
 # This macro is used only for properties files that are to be
 # copied over to the classes directory in cleaned form:
 # Previously this was inconsistently done in different repositories.
-# This is the new clean standard.
+# This is the new clean standard. Though it is to be superseded by
+# a standard annotation processor from with sjavac.
 define add_file_to_copy_and_clean
     # param 1 = BUILD_MYPACKAGE
     # parma 2 = The source file to copy and clean.
@@ -391,109 +323,8 @@
     # Now we can setup the depency that will trigger the copying.
     $$($1_BIN)$$($2_TARGET) : $2
 	$(MKDIR) -p $$(@D)
-	$(ECHO) Cleaning $$($2_TARGET)
 	$(CAT) $$< | $(SED) -e 's/\([^\\]\):/\1\\:/g' -e  's/\([^\\]\)=/\1\\=/g' -e 's/#.*/#/g' \
-                   | $(SED) \
--e 's/\\u0020/\x20/g' \
--e 's/\\u003A/\x3A/g' \
--e 's/\\u006B/\x6B/g' \
--e 's/\\u0075/\x75/g' \
--e 's/\\u00A0/\xA0/g' \
--e 's/\\u00A3/\xA3/g' \
--e 's/\\u00B0/\xB0/g' \
--e 's/\\u00B7/\xB7/g' \
--e 's/\\u00BA/\xBA/g' \
--e 's/\\u00BF/\xBF/g' \
--e 's/\\u00C0/\xC0/g' \
--e 's/\\u00C1/\xC1/g' \
--e 's/\\u00C2/\xC2/g' \
--e 's/\\u00C4/\xC4/g' \
--e 's/\\u00C5/\xC5/g' \
--e 's/\\u00C8/\xC8/g' \
--e 's/\\u00C9/\xC9/g' \
--e 's/\\u00CA/\xCA/g' \
--e 's/\\u00CD/\xCD/g' \
--e 's/\\u00CE/\xCE/g' \
--e 's/\\u00D3/\xD3/g' \
--e 's/\\u00D4/\xD4/g' \
--e 's/\\u00D6/\xD6/g' \
--e 's/\\u00DA/\xDA/g' \
--e 's/\\u00DC/\xDC/g' \
--e 's/\\u00DD/\xDD/g' \
--e 's/\\u00DF/\xDF/g' \
--e 's/\\u00E0/\xE0/g' \
--e 's/\\u00E1/\xE1/g' \
--e 's/\\u00E2/\xE2/g' \
--e 's/\\u00E3/\xE3/g' \
--e 's/\\u00E4/\xE4/g' \
--e 's/\\u00E5/\xE5/g' \
--e 's/\\u00E6/\xE6/g' \
--e 's/\\u00E7/\xE7/g' \
--e 's/\\u00E8/\xE8/g' \
--e 's/\\u00E9/\xE9/g' \
--e 's/\\u00EA/\xEA/g' \
--e 's/\\u00EB/\xEB/g' \
--e 's/\\u00EC/\xEC/g' \
--e 's/\\u00ED/\xED/g' \
--e 's/\\u00EE/\xEE/g' \
--e 's/\\u00EF/\xEF/g' \
--e 's/\\u00F1/\xF1/g' \
--e 's/\\u00F2/\xF2/g' \
--e 's/\\u00F3/\xF3/g' \
--e 's/\\u00F4/\xF4/g' \
--e 's/\\u00F5/\xF5/g' \
--e 's/\\u00F6/\xF6/g' \
--e 's/\\u00F9/\xF9/g' \
--e 's/\\u00FA/\xFA/g' \
--e 's/\\u00FC/\xFC/g' \
--e 's/\\u0020/\x20/g' \
--e 's/\\u003f/\x3f/g' \
--e 's/\\u006f/\x6f/g' \
--e 's/\\u0075/\x75/g' \
--e 's/\\u00a0/\xa0/g' \
--e 's/\\u00a3/\xa3/g' \
--e 's/\\u00b0/\xb0/g' \
--e 's/\\u00ba/\xba/g' \
--e 's/\\u00bf/\xbf/g' \
--e 's/\\u00c1/\xc1/g' \
--e 's/\\u00c4/\xc4/g' \
--e 's/\\u00c5/\xc5/g' \
--e 's/\\u00c8/\xc8/g' \
--e 's/\\u00c9/\xc9/g' \
--e 's/\\u00ca/\xca/g' \
--e 's/\\u00cd/\xcd/g' \
--e 's/\\u00d6/\xd6/g' \
--e 's/\\u00dc/\xdc/g' \
--e 's/\\u00dd/\xdd/g' \
--e 's/\\u00df/\xdf/g' \
--e 's/\\u00e0/\xe0/g' \
--e 's/\\u00e1/\xe1/g' \
--e 's/\\u00e2/\xe2/g' \
--e 's/\\u00e3/\xe3/g' \
--e 's/\\u00e4/\xe4/g' \
--e 's/\\u00e5/\xe5/g' \
--e 's/\\u00e7/\xe7/g' \
--e 's/\\u00e8/\xe8/g' \
--e 's/\\u00e9/\xe9/g' \
--e 's/\\u00ea/\xea/g' \
--e 's/\\u00eb/\xeb/g' \
--e 's/\\u00ec/\xec/g' \
--e 's/\\u00ed/\xed/g' \
--e 's/\\u00ee/\xee/g' \
--e 's/\\u00ef/\xef/g' \
--e 's/\\u00f0/\xf0/g' \
--e 's/\\u00f1/\xf1/g' \
--e 's/\\u00f2/\xf2/g' \
--e 's/\\u00f3/\xf3/g' \
--e 's/\\u00f4/\xf4/g' \
--e 's/\\u00f5/\xf5/g' \
--e 's/\\u00f6/\xf6/g' \
--e 's/\\u00f7/\xf7/g' \
--e 's/\\u00f8/\xf8/g' \
--e 's/\\u00f9/\xf9/g' \
--e 's/\\u00fa/\xfa/g' \
--e 's/\\u00fc/\xfc/g' \
--e 's/\\u00ff/\xff/g' \
+                   | $(SED) -f "$(SRC_ROOT)/common/bin/unicode2x.sed" \
 		   | $(SED) -e '/^#/d' -e '/^$$$$/d' \
 		            -e :a -e '/\\$$$$/N; s/\\\n//; ta' \
 			    -e 's/^[ \t]*//;s/[ \t]*$$$$//' \
@@ -504,122 +335,6 @@
     $1_ALL_COPY_CLEAN_TARGETS += $$($1_BIN)$$($2_TARGET)
 endef
 
-define add_java_package
-    # param 1 = BUILD_MYPACKAGE
-    # param 2 = the package target file (_the.package)
-    # param 3 = src roots, all of them, separated with space
-    # param 4 = bin root
-    # param 5 = include these dependecies
-    # param 6 = not used
-    # param 7 = if non-empty, then use -Xdeps and -Xpubapi
-    # param 8 = xremote configuration, or empty.
-    # param 9 = javac command
-    # param 10 = javac flags
-    # param 11 = exclude these files!
-    # param 12 = only include these files!
-    # param 13 = javah command
-    # param 14 = override src roots to be passed into -sourcepath, ugly ugly ugly, do not use this!
-    #            it is only here to workaround ugly things in the source code in the jdk that ought
-    #            to be fixed instead!
-    ifdef $2_USED_BY
-        $$(error Attempting to add the package $2 from $3 which is already added with sources from $$($2_USED_BY))
-    endif
-    $2_USED_BY:=$3
-    # Remove the _the.package file to get the target bin dir for the classes in this package.
-    $2_PACKAGE_BDIR:=$(dir $2)
-    # The source roots separated with a path separator (: or ; depending on os)
-    # (The patsubst is necessary to trim away unnecessary spaces.)
-    ifneq ($(14),)
-      $2_SRCROOTSC:=$(subst $(SPACE),$(PATH_SEP),$(strip $(patsubst %,%,$(14))))
-    else
-      $2_SRCROOTSC:=$(subst $(SPACE),$(PATH_SEP),$(strip $(patsubst %,%,$3)))
-    endif
-    # Suffix the package path to the src roots, to get a list of all possible source locations
-    # for this package.
-    $2_PACKAGE_SDIRS:=$$(foreach i,$3,$$(subst $4,$$i,$$($2_PACKAGE_BDIR)))
-    # Use wildcard in all potential source locations to find the actual sources.
-    $2_PACKAGE_SRCS:=$$(filter-out $(11),$$(wildcard $$(addsuffix *.java,$$($2_PACKAGE_SDIRS))))
-    ifneq ($(12),)
-      # Filter on include file filter if set.
-      $2_PACKAGE_SRCS:=$$(filter $(12),$$($2_PACKAGE_SRCS))
-    endif
-    # Generate a proper package name from the file name.
-    $2_PACKAGE:=$(patsubst .%.,%,$(subst /,.,$(subst $4,,$(dir $2))))
-    # Use a javac server for this package?
-    $2_REMOTE:=$8
-
-    # Include previously generated information about what classes are output by this package
-    # and what sources were used for the compile.
-    -include $$($2_PACKAGE_BDIR)_the.package.d
-
-    # Include the notify, file, that exists if the package has been compiled during a previous make round.
-    # I.e. we are now dealing with a compile triggered by a pubapi change.
-    -include $$($2_PACKAGE_BDIR)_the.package.notify
-
-    # If the notify file existed, then $$($2_NOTIFIED) will be equal to true.
-    # Use this information to block dependency tracking for this package. 
-    # This is necessary to cut the circular dependency chains that are so common in Java sources.
-
-    ifneq ($$($2_NOTIFIED),true)
-        # No need to block, since this package has not yet been recompiled.
-        # Thus include previously generated dependency information. (if it exists)
-        -include $$($2_PACKAGE_BDIR)_the.package.dddd
-#    else
-#        $$(info WAS NOTIFIED $2)
-    endif
-
-    # Should we create proper dependencies between packages?
-    ifneq ($7,)
-      # The flag: -XDpubapi:file=foo,package=mypack,notify writes a file foo that contains a 
-      # database of the public api of the classes supplied on the command line and are
-      # inside the package mypack. If foo already exists, javac will only write to foo,
-      # if there is a change in the pubapi. I.e. we can use the timestamp of this file
-      # for triggering dependencies. "notify" means create a "file" suffixed with notify
-      # if the pubapi really changed. 
-      $2_PUBAPI=-XDpubapi=file=$$($2_PACKAGE_BDIR)_the.package.api,notify,package=$$($2_PACKAGE)
-      # The flag: -XDnativeapi:file=foo,package=mypack,notify works similar to pubabi, but
-      # instead tracks native methods. This file can be used to trigger dependencies for
-      # native compilations.
-      $2_NATIVEAPI=-XDnativeapi=file=$$($2_PACKAGE_BDIR)_the.package.native,notify,package=$$($2_PACKAGE)
-      # The flag -XDdeps:file=foo.deps,groupon=package writes a foo.deps file containing packages dependencies:
-      #     java.net : java.io java.lang
-      # I.e. the classes in .net depend on the public apis of java.io and java.lang
-      # The dependencies can be grouped on classes instead (groupon=class)
-      #     java.net.Bar : java.io.Socket java.lang.String
-      $2_DEPS:=-XDdeps=file=$$($2_PACKAGE_BDIR)_the.package.deps,groupon=package
-      # The next command rewrites the deps output from javac into a proper makefile dependency.
-      # The dependencies are always to an .api file generated by the pubapi option above.
-      # This is necessary since java package dependencies are almost always circular.
-      $2_APPEND_DEPS:=($(CAT) $$($2_PACKAGE_BDIR)_the.package.deps | $(TR) '.' '/' | $(AWK) '{ print "$4/" $$$$3 }' | sort > $$($2_PACKAGE_BDIR)_the.package.ddd && $(GREP) -f $$($2_PACKAGE_BDIR)_the.package.ddd $5 | $(AWK) '{ print "$(dir $2)_the.package : " $$$$1 "_the.package.api" }' > $$($2_PACKAGE_BDIR)_the.package.dddd ; true)
-    else
-        # If not using dependencies, use $2 as fallback to trigger regeneration of javah header files.
-        # This will generate a surplus of header files, but this does not hurt compilation.
-        $2_NATIVEAPICHANGE_TRIGGER:=$2
-        $2_FETCH_NATIVEAPICHANGE_CLASSES:=$(CAT) $$($2_PACKAGE_BDIR)_the.package.now|$(GREP) -v '\$$$$'|$(SED) -e 's|$4/||g'|$(SED) 's|.class||g'| $(TR) '/' '.'
-    endif 
-
-    # The _the.package file is dependent on the java files inside the package.
-    # Fill the _the.package file with a list of the java files and compile them
-    # to class files.
-    $2 : $$($2_PACKAGE_SRCS)
-	$(MKDIR) -p $$($2_PACKAGE_BDIR)
-	$(RM) $2.tmp
-	$$(call ListPathsSafely,$2_PACKAGE_SRCS,\n, >> $2.tmp)
-	$(ECHO) $$($2_PACKAGE_BDIR)*.class | $(GREP) -v \*.class | $(TR) ' ' '\n' > $$($2_PACKAGE_BDIR)_the.package.prev
-	$(RM) $$($2_PACKAGE_BDIR)*.class $$($2_PACKAGE_BDIR)*.notify $$($2_PACKAGE_BDIR)*.deleted
-	$(ECHO) Compiling `$(WC) $2.tmp | $(TR) -s ' ' | $(CUT) -f 2 -d ' '` files in package $(patsubst $4/%/,%,$(dir $2.tmp))
-	$9 $$($2_REMOTE) $$($2_DEPS) $$($2_PUBAPI) $$($2_NATIVEAPI) $(10) -implicit:none -sourcepath "$$($2_SRCROOTSC)" -d $4 @$2.tmp
-	$(ECHO) $$($2_PACKAGE_BDIR)*.class | $(GREP) -v \*.class | $(TR) ' ' '\n' > $$($2_PACKAGE_BDIR)_the.package.now
-	($(GREP) -xvf $$($2_PACKAGE_BDIR)_the.package.now $$($2_PACKAGE_BDIR)_the.package.prev > $$($2_PACKAGE_BDIR)_the.package.deleted;true)
-	$(ECHO) $1_CLASSES += `$(CAT) $$($2_PACKAGE_BDIR)_the.package.now` | \
-		$(SED) 's/\$$$$/\$$$$\$$$$/g' > $$($2_PACKAGE_BDIR)_the.package.d
-	$(ECHO) $1_JAVAS += $$($2_PACKAGE_SRCS) >> $$($2_PACKAGE_BDIR)_the.package.d
-	$(ECHO) $2_NOTIFIED:=true > $$($2_PACKAGE_BDIR)_the.package.notify
-	$$($2_APPEND_DEPS)
-	$$($2_COPY_FILES)
-	$(MV) -f $2.tmp $2
-endef
-
 define remove_string
     $2 := $$(subst $1,,$$($2))
 endef
@@ -664,140 +379,101 @@
     $(if $(14),$1_$(strip $(14)))
     $(if $(15),$(error Internal makefile error: Too many arguments to SetupJavaCompilation, please update JavaCompilation.gmk))
 
-# Extract the info from the java compiler setup.
-$1_MODE := $$($$($1_SETUP)_MODE)
-ifneq (SINGLE_THREADED_BATCH,$$($1_MODE))
-    ifneq (MULTI_CORE_CONCURRENT,$$($1_MODE))
+    # Extract the info from the java compiler setup.
+    $1_REMOTE := $$($$($1_SETUP)_REMOTE)
+    $1_JVM   := $$($$($1_SETUP)_JVM)
+    $1_JAVAC := $$($$($1_SETUP)_JAVAC)
+    $1_FLAGS := $$($$($1_SETUP)_FLAGS) $(JAVAC_FLAGS) $$($1_ADD_JAVAC_FLAGS)
+    ifeq ($$($1_JAVAC),)
         $$(error The Java compilation $1 refers to a non-existant java compiler setup $$($1_SETUP))
     endif
-endif
-$1_USE_DEPS := $$($$($1_SETUP)_USE_DEPS)
-$1_REMOTE := $$($$($1_SETUP)_REMOTE)
-$1_JVM   := $$($$($1_SETUP)_JVM)
-$1_JAVAC := $$($$($1_SETUP)_JAVAC)
-$1_JAVAH := $$($$($1_SETUP)_JAVAH)
-$1_FLAGS := $$($$($1_SETUP)_FLAGS) $(JAVAC_FLAGS) $$($1_ADD_JAVAC_FLAGS)
+
+    # Handle addons and overrides.
+    $1_SRC:=$$(call ADD_SRCS,$$($1_SRC))
+    # Make sure the dirs exist.
+    $$(shell $(MKDIR) -p $$($1_SRC) $$($1_BIN))
+    # Find all files in the source trees.
+    $1_ALL_SRCS := $$(filter-out $(OVR_SRCS),$$(foreach i,$$($1_SRC),$$(shell $(FIND) $$i -type f)))
+    # Extract the java files.
+    ifneq ($$($1_EXCLUDE_FILES),)
+        $1_EXCLUDE_FILES_PATTERN:=$$(addprefix %,$$($1_EXCLUDE_FILES))
+    endif
+    $1_SRCS     := $$(filter-out $$($1_EXCLUDE_FILES_PATTERN),$$(filter %.java,$$($1_ALL_SRCS)))
+    ifneq ($$($1_INCLUDE_FILES),)
+        $1_INCLUDE_FILES:=$$(foreach i,$$($1_SRC),$$(addprefix $$i/,$$($1_INCLUDE_FILES)))
+        $1_SRCS := $$(filter $$($1_INCLUDE_FILES), $$($1_SRCS))
+    endif
 
-# Handle addons and overrides.
-$1_SRC:=$$(call ADD_SRCS,$$($1_SRC))
-# Make sure the dirs exist.
-$$(shell $(MKDIR) -p $$($1_SRC) $$($1_BIN))
-# Find all files in the source trees.
-$1_ALL_SRCS := $$(filter-out $(OVR_SRCS),$$(foreach i,$$($1_SRC),$$(shell $(FIND) $$i -type f)))
-# Extract the java files.
-ifneq ($$($1_EXCLUDE_FILES),)
-  $1_EXCLUDE_FILES_PATTERN:=$$(addprefix %,$$($1_EXCLUDE_FILES))
-endif
-$1_SRCS     := $$(filter-out $$($1_EXCLUDE_FILES_PATTERN),$$(filter %.java,$$($1_ALL_SRCS)))
-ifneq ($$($1_INCLUDE_FILES),)
-  $1_INCLUDE_FILES:=$$(foreach i,$$($1_SRC),$$(addprefix $$i/,$$($1_INCLUDE_FILES)))
-  $1_SRCS := $$(filter $$($1_INCLUDE_FILES), $$($1_SRCS))
-endif
-$1_PKGS     := $$(sort $$(dir $$($1_SRCS)))
-# Remove the source root from each found path.
-$$(foreach i,$$($1_SRC),$$(eval $$(call remove_string,$$i,$1_PKGS)))
-$1_PKGS     := $$(sort $$($1_PKGS))
-# There can be only a single bin dir root, no need to foreach over the roots.
-$1_BINS     := $$(shell $(FIND) $$($1_BIN) -name "*.class")
+    # Now we have a list of all java files to compile: $$($1_SRCS)
+
+    # Create the corresponding smart javac wrapper command line.
+    $1_SJAVAC_ARGS:=$$(addprefix -x ,$$(addsuffix .*,$$(subst /,.,$$($1_EXCLUDES)))) \
+		$$(addprefix -i ,$$(addsuffix .*,$$(subst /,.,$$($1_INCLUDES)))) \
+		$$(addprefix -xf *,$$(strip $$($1_EXCLUDE_FILES))) \
+		$$(addprefix -if *,$$(strip $$($1_INCLUDE_FILES))) \
+		-src "$$(subst $$(SPACE),$$(PATH_SEP),$$(strip $$($1_SRC)))"
 
-# Now we have a list of all java files to compile: $$($1_SRCS)
-# and we have a list of all existing class files: $$($1_BINS)
-
-# Create the corresponding smart javac wrapper command line.
-$1_SJAVAC_ARGS:=$$(addprefix -x ,$$(addsuffix .*,$$(subst /,.,$$($1_EXCLUDES)))) \
-$$(addprefix -i ,$$(addsuffix .*,$$(subst /,.,$$($1_INCLUDES)))) \
-$$(addprefix -xf *,$$(strip $$($1_EXCLUDE_FILES))) \
-$$(addprefix -if *,$$(strip $$($1_INCLUDE_FILES))) -src $$(subst $$(SPACE),$$(PATH_SEP),$$(strip $$($1_SRC)))
-
-# Prepend the source/bin path to the filter expressions.
-ifneq ($$($1_INCLUDES),)
-  $1_SRC_INCLUDES := $$(foreach i,$$($1_SRC),$$(addprefix $$i/,$$(addsuffix /%,$$($1_INCLUDES))))
-  $1_PKG_INCLUDES := $$(addprefix /,$$(addsuffix /%,$$($1_INCLUDES)))
-  $1_BIN_INCLUDES := $$(addprefix $$($1_BIN)/,$$(addsuffix /%,$$($1_INCLUDES)))
-  $1_SRCS     := $$(filter $$($1_SRC_INCLUDES),$$($1_SRCS))
-  $1_PKGS     := $$(filter $$($1_PKG_INCLUDES),$$($1_PKGS))
-  $1_BINS     := $$(filter $$($1_BIN_INCLUDES),$$($1_BINS))
-endif
-ifneq ($$($1_EXCLUDES),)
-  $1_SRC_EXCLUDES := $$(foreach i,$$($1_SRC),$$(addprefix $$i/,$$(addsuffix /%,$$($1_EXCLUDES))))
-  $1_PKG_EXCLUDES := $$(addprefix /,$$(addsuffix /%,$$($1_EXCLUDES)))
-  $1_BIN_EXCLUDES := $$(addprefix $$($1_BIN)/,$$(addsuffix /%,$$($1_EXCLUDES)))
-  $1_SRCS     := $$(filter-out $$($1_SRC_EXCLUDES),$$($1_SRCS))
-  $1_PKGS     := $$(filter-out $$($1_PKG_EXCLUDES),$$($1_PKGS))
-  $1_BINS     := $$(filter-out $$($1_BIN_EXCLUDES),$$($1_BINS))
-endif
+    # Prepend the source/bin path to the filter expressions.
+    ifneq ($$($1_INCLUDES),)
+        $1_SRC_INCLUDES := $$(foreach i,$$($1_SRC),$$(addprefix $$i/,$$(addsuffix /%,$$($1_INCLUDES))))
+        $1_SRCS     := $$(filter $$($1_SRC_INCLUDES),$$($1_SRCS))
+    endif
+    ifneq ($$($1_EXCLUDES),)
+        $1_SRC_EXCLUDES := $$(foreach i,$$($1_SRC),$$(addprefix $$i/,$$(addsuffix /%,$$($1_EXCLUDES))))
+        $1_SRCS     := $$(filter-out $$($1_SRC_EXCLUDES),$$($1_SRCS))
+    endif
 
-# Find all files to be copied from source to bin.
-ifneq (,$$($1_COPY))
-    # Rewrite list of patterns into a find statement.
-    $1_COPY_PATTERN:=$(FALSE_FIND_PATTERN) $$(patsubst %,$(SPACE)-o$(SPACE)-name$(SPACE)$(DQUOTE)*%$(DQUOTE),$$($1_COPY))
-    # Search for all files to be copied.
-    $1_ALL_COPIES := $$(foreach i,$$($1_SRC), $$(shell $(FIND) $$i \( $$($1_COPY_PATTERN) \) -a -type f))
-    # Copy these explicitly
-    $1_ALL_COPIES += $$($1_COPY_FILES)
-    # Copy must also respect filters.
-    ifneq (,$$($1_INCLUDES))
-        $1_ALL_COPIES := $$(filter $$($1_SRC_INCLUDES),$$($1_ALL_COPIES))
+    # Find all files to be copied from source to bin.
+    ifneq (,$$($1_COPY))
+        # Rewrite list of patterns into a find statement.
+        $1_COPY_PATTERN:=$(FALSE_FIND_PATTERN) $$(patsubst %,$(SPACE)-o$(SPACE)-name$(SPACE)$(DQUOTE)*%$(DQUOTE),$$($1_COPY))
+        # Search for all files to be copied.
+        $1_ALL_COPIES := $$(foreach i,$$($1_SRC), $$(shell $(FIND) $$i \( $$($1_COPY_PATTERN) \) -a -type f))
+        # Copy these explicitly
+        $1_ALL_COPIES += $$($1_COPY_FILES)
+        # Copy must also respect filters.
+        ifneq (,$$($1_INCLUDES))
+            $1_ALL_COPIES := $$(filter $$($1_SRC_INCLUDES),$$($1_ALL_COPIES))
+        endif
+        ifneq (,$$($1_EXCLUDES))
+            $1_ALL_COPIES := $$(filter-out $$($1_SRC_EXCLUDES),$$($1_ALL_COPIES))
+        endif
+        ifneq (,$$($1_EXCLUDE_FILES))
+            $1_ALL_COPIES := $$(filter-out $$($1_EXCLUDE_FILES_PATTERN),$$($1_ALL_COPIES))
+        endif
+        # All files below META-INF are always copied.
+        $1_ALL_COPIES += $$(foreach i,$$($1_SRC), $$(shell $(FIND) $$i/META-INF -type f 2> /dev/null))
+        ifneq (,$$($1_ALL_COPIES))
+            # Yep, there are files to be copied!
+            $1_ALL_COPY_TARGETS:=
+            $$(foreach i,$$($1_ALL_COPIES),$$(eval $$(call add_file_to_copy,$1,$$i)))
+            # Now we can depend on $$($1_ALL_COPY_TARGETS) to copy all files!
+        endif
     endif
-    ifneq (,$$($1_EXCLUDES))
-        $1_ALL_COPIES := $$(filter-out $$($1_SRC_EXCLUDES),$$($1_ALL_COPIES))
-    endif
-    ifneq (,$$($1_EXCLUDE_FILES))
-        $1_ALL_COPIES := $$(filter-out $$($1_EXCLUDE_FILES_PATTERN),$$($1_ALL_COPIES))
-    endif
-    # All files below META-INF are always copied.
-    $1_ALL_COPIES += $$(foreach i,$$($1_SRC), $$(shell $(FIND) $$i/META-INF -type f 2> /dev/null))
-    ifneq (,$$($1_ALL_COPIES))
-        # Yep, there are files to be copied!
-        $1_ALL_COPY_TARGETS:=
-        $$(foreach i,$$($1_ALL_COPIES),$$(eval $$(call add_file_to_copy,$1,$$i)))
-        # Now we can depend on $$($1_ALL_COPY_TARGETS) to copy all files!
-    endif
-endif
 
-# Find all property files to be copied and cleaned from source to bin.
-ifneq (,$$($1_CLEAN))
-    # Rewrite list of patterns into a find statement.
-    $1_CLEAN_PATTERN:=$(FALSE_FIND_PATTERN) $$(patsubst %,$(SPACE)-o$(SPACE)-name$(SPACE)$(DQUOTE)*%$(DQUOTE),$$($1_CLEAN))
-    # Search for all files to be copied.
-    $1_ALL_CLEANS := $$(foreach i,$$($1_SRC), $$(shell $(FIND) $$i \( $$($1_CLEAN_PATTERN) \) -a -type f))
-    # Copy and clean must also respect filters.
-    ifneq (,$$($1_INCLUDES))
-        $1_ALL_CLEANS := $$(filter $$($1_SRC_INCLUDES),$$($1_ALL_CLEANS))
-    endif
-    ifneq (,$$($1_EXCLUDES))
-        $1_ALL_CLEANS := $$(filter-out $$($1_SRC_EXCLUDES),$$($1_ALL_CLEANS))
-    endif
-    ifneq (,$$($1_EXCLUDE_FILES))
-        $1_ALL_CLEANS := $$(filter-out $$($1_EXCLUDE_FILES_PATTERN),$$($1_ALL_CLEANS))
-    endif
-    ifneq (,$$($1_ALL_CLEANS))
-        # Yep, there are files to be copied and cleaned!
-        $1_ALL_COPY_CLEAN_TARGETS:=
-        $$(foreach i,$$($1_ALL_CLEANS),$$(eval $$(call add_file_to_copy_and_clean,$1,$$i)))
-        # Now we can depend on $$($1_ALL_COPY_CLEAN_TARGETS) to copy all files!
+    # Find all property files to be copied and cleaned from source to bin.
+    ifneq (,$$($1_CLEAN))
+        # Rewrite list of patterns into a find statement.
+        $1_CLEAN_PATTERN:=$(FALSE_FIND_PATTERN) $$(patsubst %,$(SPACE)-o$(SPACE)-name$(SPACE)$(DQUOTE)*%$(DQUOTE),$$($1_CLEAN))
+        # Search for all files to be copied.
+        $1_ALL_CLEANS := $$(foreach i,$$($1_SRC), $$(shell $(FIND) $$i \( $$($1_CLEAN_PATTERN) \) -a -type f))
+        # Copy and clean must also respect filters.
+        ifneq (,$$($1_INCLUDES))
+            $1_ALL_CLEANS := $$(filter $$($1_SRC_INCLUDES),$$($1_ALL_CLEANS))
+        endif
+        ifneq (,$$($1_EXCLUDES))
+            $1_ALL_CLEANS := $$(filter-out $$($1_SRC_EXCLUDES),$$($1_ALL_CLEANS))
+        endif
+        ifneq (,$$($1_EXCLUDE_FILES))
+            $1_ALL_CLEANS := $$(filter-out $$($1_EXCLUDE_FILES_PATTERN),$$($1_ALL_CLEANS))
+        endif
+        ifneq (,$$($1_ALL_CLEANS))
+            # Yep, there are files to be copied and cleaned!
+            $1_ALL_COPY_CLEAN_TARGETS:=
+            $$(foreach i,$$($1_ALL_CLEANS),$$(eval $$(call add_file_to_copy_and_clean,$1,$$i)))
+            # Now we can depend on $$($1_ALL_COPY_CLEAN_TARGETS) to copy all files!
+        endif
     endif
-endif
-
-# Find all the directories that contain java sources, each directory
-# corresponds to a package because we expect the source
-# code to be organized in this standardized way!
-$1_SDIRS := $$(sort $$(dir $$($1_SRCS)))
-# Now prefix each package with the bin root.
-$1_BDIRS := $$(foreach i,$$($1_PKGS),$$(addprefix $$($1_BIN),$$i))
-# Now create a list of the packages that are about to compile. This list is
-# later used to filter out dependencies that point outside of this set.
-$$(shell $(RM) $$($1_BIN)/_the.list_of_packages)
-$$(eval $$(call ListPathsSafelyNow,$1_BDIRS,\n, >> $$($1_BIN)/_the.list_of_packages))
-
-ifeq ($$($1_MODE),SINGLE_THREADED_BATCH)
-    # Ok, we will feed all the found java files into a single javac invocation.
-    # There can be no dependency checking, nor incremental builds. It is
-    # the best we can do with the old javac. If the javac supports a javac server
-    # then we can use the javac server.
-
-    # We can depend on this target file to trigger a regeneration of all the sources
-    $1 := $$($1_ALL_COPY_TARGETS) $$($1_ALL_COPY_CLEAN_TARGETS) $$($1_BIN)/_the.batch
 
     # Prep the source paths.
     ifneq ($$($1_JAVAC_SOURCE_PATH_UGLY_OVERRIDE),)
@@ -807,113 +483,73 @@
     endif
 
     ifneq (,$$($1_HEADERS))
-      $1_HEADERS_ARG := -h $$($1_HEADERS)
+        $1_HEADERS_ARG := -h $$($1_HEADERS)
     endif
 
     # Create a sed expression to remove the source roots and to replace / with .
     # and remove .java at the end. 
     $1_REWRITE_INTO_CLASSES:=$$(foreach i,$$($1_SRC),-e 's|$$i/||g') -e 's|/|.|g' -e 's|.java$$$$||g'
 
-    # Here is the batch rules that depends on all the sources.
-    $$($1_BIN)/_the.batch: $$($1_SRCS) $$($1_DEPENDS)
-	$(MKDIR) -p $$(@D)
-	$(RM) $$($1_BIN)/_the.batch $$($1_BIN)/_the.batch.tmp
-	$$(call ListPathsSafely,$1_SRCS,\n, >> $$($1_BIN)/_the.batch.tmp)
-	$(ECHO) Compiling `$(WC) $$($1_BIN)/_the.batch.tmp | $(TR) -s ' ' | $(CUT) -f 2 -d ' '` files in batch $1
-ifeq ($$($1_NOSJAVAC),)
-ifeq ($$(ENABLE_SJAVAC),yes)
-	mkdir -p $$($1_BIN)_sjavac
-	$$($1_JVM) $$(word 1,$$($1_JAVAC)) com.sun.tools.javac.smart.Main $$($1_SJAVAC_ARGS) -mfl $$($1_BIN)/_the.batch.tmp -d $$($1_BIN)_sjavac
-endif
-endif
-	($$($1_JVM) $$($1_JAVAC) $$($1_FLAGS) -implicit:none -sourcepath "$$($1_SRCROOTSC)" -d $$($1_BIN) $$($1_HEADERS_ARG) @$$($1_BIN)/_the.batch.tmp && \
-         $(MV) $$($1_BIN)/_the.batch.tmp $$($1_BIN)/_the.batch)
-else
-    # Ok, we have a modern javac server running!
-    # Since a single Java file can generate zero to an infinity number of .class files
-    # the exact number and names of the .class files will only be known after the compile.
-    # Thus after the compile, a list of the generated classes will be stored in _the.package.d
-    # which is included by the makefile during the next compile. These .d files will
-    # add the generated class names to the BUILD_MYPACKAGE_CLASSES variable and used java file names
-    # to the BUILD_MYPACKAGE_JAVAS variable.
-    $1_CLASSES := 
-    $1_JAVAS   := 
-    # Create a file in each package that represents the package dependency.
-    # This file (_the.package) will also contain a list of the source files
-    # to be compiled for this package.
-    $1 := $$(sort $$(patsubst %,%_the.package,$$($1_BDIRS)))
-    # Now call add_java_package for each package to create the dependencies.
-    $$(foreach p,$$($1),$$(eval $$(call add_java_package,$1,$$p,$$($1_SRC),$$($1_BIN),$$($1_BIN)/_the.list_of_packages,NOTUSED,$$($1_USE_DEPS),$$($1_REMOTE),$$($1_JVM) $$($1_JAVAC),$$($1_FLAGS),$$($1_EXCLUDE_FILES_PATTERN) $(OVR_SRCS),$$($1_INCLUDE_FILES),$$($1_JVM) $$($1_JAVAH),$$($1_JAVAC_SOURCE_PATH_UGLY_OVERRIDE))))
-    # All dependencies are setup, now we only need to depend on $1 (aka $(BUILD_MYPACKAGE))
-    # and they will automatically be built!
+    ifeq ($$($1_DISABLE_SJAVAC)x$$(ENABLE_SJAVAC),xyes)
+        # Using sjavac to compile. 
+        $1 := $$($1_ALL_COPY_TARGETS) $$($1_ALL_COPY_CLEAN_TARGETS) $$($1_BIN)/javac_state
 
-    # Now add on any files to copy targets
-    $1 := $$($1_ALL_COPY_TARGETS) $$($1_ALL_COPY_CLEAN_TARGETS) $$($1)
-    # Remove the set of found classes from the set of all previously known classes
-    # and the remainder is the set of missing classes.
-    $1_MISSING_CLASSES:=$$(filter-out $$($1_BINS),$$($1_CLASSES))
-    $1_PKGS_MISSING_CLASSES:=$$(sort $$(dir $$($1_MISSING_CLASSES)))
-    # Remove the set of found java files from the set of all previously known java files
-    # the remainder is Java files that have gone missing.
-    $1_MISSING_JAVAS:=$$(filter-out $$($1_SRCS),$$($1_JAVAS))
-    $1_PKGS_MISSING_JAVAS:=$$(sort $$(dir $$($1_MISSING_JAVAS)))
-    # Remove each source root from the found paths.
-    $$(foreach i,$$($1_SRC),$$(eval $$(call remove_string,$$i,$1_PKGS_MISSING_JAVAS)))
-    # Finally remove duplicates and prefix with the binary path instead.
-    $1_PKGS_MISSING_JAVAS:= $$(addprefix $$($1_BIN),$$(sort $$($1_PKGS_MISSING_JAVAS)))
-
-    # Remove the set of all theoretical classes from the set of found classes.
-    # the remainder is the set of superfluous classes.
-    $1_SUPERFLUOUS_CLASSES:=$$(sort $$(filter-out $$($1_CLASSES),$$($1_BINS)))
-    $1_PKGS_SUPERFLUOUS_CLASSES:=$$(sort $$(dir $$($1_SUPERFLUOUS_CLASSES)))
+        $$($1_BIN)/javac_state: $$($1_SRCS) $$($1_DEPENDS)
+		$(MKDIR) -p $$(@D)
+		$$(call ListPathsSafely,$1_SRCS,\n, >> $$($1_BIN)/_the.batch.tmp)
+		$(ECHO) Compiling $1
+		$$($1_JVM) $$(word 1,$$($1_JAVAC)) com.sun.tools.sjavac.Main \
+			$$($1_REMOTE) $$($1_SJAVAC_ARGS) --permit-unidentified-artifacts -mfl $$($1_BIN)/_the.batch.tmp \
+			$$($1_FLAGS) \
+			-implicit:none -d $$($1_BIN) $$($1_HEADERS_ARG)
+    else
+        # Using plain javac to batch compile everything.
+        $1 := $$($1_ALL_COPY_TARGETS) $$($1_ALL_COPY_CLEAN_TARGETS) $$($1_BIN)/_the.batch
 
-    # Now delete the _the.package files inside the problematic dirs.
-    # This will force a rebuild of these packages!
-    $1_FOO:=$$(sort $$($1_PKGS_MISSING_CLASSES) \
-                                                 $$($1_PKGS_SUPERFLUOUS_CLASSES) \
-                                                 $$($1_PKGS_MISSING_JAVAS))
-#    ifneq (,$$($1_FOO))
-#            $$(info MESSED UP PACKAGES $$($1_FOO))
-#    endif
-
-    $$(shell $(RM) $$(addsuffix _the.package,$$(sort $$($1_PKGS_MISSING_CLASSES) \
-                                                 $$($1_PKGS_SUPERFLUOUS_CLASSES) \
-                                                 $$($1_PKGS_MISSING_JAVAS))))
-
-    # Normal makefile dependencies based on timestamps will detect the normal use case
-    # when Java files are simply added or modified.
-endif
-
-ifneq (,$$($1_JAR))
-
-    ifeq (,$$($1_SUFFIXES))
-        $1_SUFFIXES:=.class $$($1_CLEAN) $$($1_COPY)
+        # When not using sjavac, pass along all sources to javac using an @file.
+        $$($1_BIN)/_the.batch: $$($1_SRCS) $$($1_DEPENDS)
+		$(MKDIR) -p $$(@D)
+		$(RM) $$($1_BIN)/_the.batch $$($1_BIN)/_the.batch.tmp
+		$$(call ListPathsSafely,$1_SRCS,\n, >> $$($1_BIN)/_the.batch.tmp)
+		$(ECHO) Compiling `$(WC) $$($1_BIN)/_the.batch.tmp | $(TR) -s ' ' | $(CUT) -f 2 -d ' '` files for $1
+		($$($1_JVM) $$($1_JAVAC) $$($1_FLAGS) \
+			-implicit:none -sourcepath "$$($1_SRCROOTSC)" \
+			-d $$($1_BIN) $$($1_HEADERS_ARG) @$$($1_BIN)/_the.batch.tmp && \
+			$(MV) $$($1_BIN)/_the.batch.tmp $$($1_BIN)/_the.batch)
     endif
 
-    # A jar file was specified. Set it up.
-    $$(eval $$(call SetupArchive,ARCHIVE_$1,$$($1),\
-	SRCS:=$$($1_BIN),\
-	SUFFIXES:=$$($1_SUFFIXES),\
-	EXCLUDE:=$$($1_EXCLUDES),\
-	INCLUDES:=$$($1_INCLUDES),\
-	EXTRA_FILES:=$$($1_ALL_COPY_TARGETS) $$($1_ALL_COPY_CLEAN_TARGETS),\
-	JAR:=$$($1_JAR),\
-	JARMAIN:=$$($1_JARMAIN),\
-	MANIFEST:=$$($1_MANIFEST),\
-	EXTRA_MANIFEST_ATTR:=$$($1_EXTRA_MANIFEST_ATTR),\
-	JARINDEX:=$$($1_JARINDEX),\
-	HEADERS:=$$($1_HEADERS),\
-	SETUP:=$$($1_SETUP)))
-endif
+    # Check if a jar file was specified, then setup the rules for the jar.
+    ifneq (,$$($1_JAR))
+        # If no suffixes was explicitly set for this jar file.
+        # Use class and the cleaned/copied properties file suffixes as the default
+        # for the types of files to be put into the jar.
+        ifeq (,$$($1_SUFFIXES))
+            $1_SUFFIXES:=.class $$($1_CLEAN) $$($1_COPY)
+        endif
 
-ifneq (,$$($1_SRCZIP))
-    # A srczip file was specified. Set it up.
-    $$(eval $$(call SetupZipArchive,ARCHIVE_$1,\
+        $$(eval $$(call SetupArchive,ARCHIVE_$1,$$($1),\
+		SRCS:=$$($1_BIN),\
+		SUFFIXES:=$$($1_SUFFIXES),\
+		EXCLUDE:=$$($1_EXCLUDES),\
+		INCLUDES:=$$($1_INCLUDES),\
+		EXTRA_FILES:=$$($1_ALL_COPY_TARGETS) $$($1_ALL_COPY_CLEAN_TARGETS),\
+		JAR:=$$($1_JAR),\
+		JARMAIN:=$$($1_JARMAIN),\
+		MANIFEST:=$$($1_MANIFEST),\
+		EXTRA_MANIFEST_ATTR:=$$($1_EXTRA_MANIFEST_ATTR),\
+		JARINDEX:=$$($1_JARINDEX),\
+		HEADERS:=$$($1_HEADERS),\
+		SETUP:=$$($1_SETUP)))
+    endif
+
+    # Check if a srczip was specified, then setup the rules for the srczip.
+    ifneq (,$$($1_SRCZIP))
+        $$(eval $$(call SetupZipArchive,ARCHIVE_$1,\
 		SRC:=$$($1_SRC),\
 		ZIP:=$$($1_SRCZIP),\
 		INCLUDES:=$$($1_INCLUDES),\
 		EXCLUDES:=$$($1_EXCLUDES),\
 		EXCLUDE_FILES:=$$($1_EXCLUDE_FILES)))
-endif
+    endif
 
 endef
--- a/common/makefiles/MakeBase.gmk	Wed Jul 05 18:22:17 2017 +0200
+++ b/common/makefiles/MakeBase.gmk	Wed Jul 05 18:22:52 2017 +0200
@@ -138,7 +138,7 @@
 
 # Hook to be called as the very first thing when running a normal build
 define AtRootMakeStart
-	$(if $(findstring -j,$(MAKEFLAGS)), $(error make -j is not supported, use make JOBS=n))
+	$(if $(findstring --jobserver,$(MAKEFLAGS)), $(error make -j is not supported, use make JOBS=n))
 	$(call PrintStartMessage)
 	$(call StartTimer)
 endef
--- a/common/makefiles/MakeHelpers.gmk	Wed Jul 05 18:22:17 2017 +0200
+++ b/common/makefiles/MakeHelpers.gmk	Wed Jul 05 18:22:52 2017 +0200
@@ -57,9 +57,25 @@
 define ParseLogLevel
     ifeq ($$(origin VERBOSE),undefined)
         # Setup logging according to LOG (but only if VERBOSE is not given)
+        
+       # If the "nofile" argument is given, act on it and strip it away
+        ifneq ($$(findstring nofile,$$(LOG)),)
+          # Reset the build log wrapper, regardless of other values
+          override BUILD_LOG_WRAPPER=
+          # COMMA is defined in spec.gmk, but that is not included yet
+          COMMA=,
+          # First try to remove ",nofile" if it exists
+          LOG_STRIPPED1=$$(subst $$(COMMA)nofile,,$$(LOG))
+          # Otherwise just remove "nofile"
+          LOG_STRIPPED2=$$(subst nofile,,$$(LOG_STRIPPED1))
+          # We might have ended up with a leading comma. Remove it
+          LOG_STRIPPED3=$$(strip $$(patsubst $$(COMMA)%,%,$$(LOG_STRIPPED2)))
+          override LOG:=$$(LOG_STRIPPED3)
+        endif
+
         ifeq ($$(LOG),)
             # Set LOG to "warn" as default if not set (and no VERBOSE given)
-            LOG=warn
+            override LOG=warn
         endif
         ifeq ($$(LOG),warn)
             VERBOSE=-s
@@ -182,4 +198,11 @@
     $(call CheckEnvironment)
 endef
 
+# Cleans the component given as $1
+define CleanComponent
+    @$(PRINTF) "Cleaning $1 build artifacts ..."
+    @($(CD) $(OUTPUT_ROOT) && $(RM) -r $1)
+    @$(PRINTF) " done\n"
+endef
+
 endif # _MAKEHELPERS_GMK
--- a/common/makefiles/Makefile	Wed Jul 05 18:22:17 2017 +0200
+++ b/common/makefiles/Makefile	Wed Jul 05 18:22:52 2017 +0200
@@ -26,6 +26,11 @@
 # This must be the first rule
 default: all
 
+# Inclusion of this pseudo-target will cause make to execute this file
+# serially, regardless of -j. Recursively called makefiles will not be
+# affected, however. This is required for correct dependency management.
+.NOTPARALLEL:
+
 # Locate this Makefile
 ifeq ($(filter /%,$(lastword $(MAKEFILE_LIST))),)
     makefile_path:=$(CURDIR)/$(lastword $(MAKEFILE_LIST))
@@ -41,18 +46,18 @@
 $(eval $(call SetupLogging))
 $(eval $(call ParseConfAndSpec))
 
-# Setup number of jobs to use. -jN is unfortunately not available for us to parse from the command line,
-# hence this workaround.
-ifeq ($(JOBS),)
-    JOBS=$(NUM_CORES)
-endif
-
 ifneq ($(words $(SPEC)),1)
 ### We have multiple configurations to build, call make repeatedly
-all jdk hotspot jaxws jaxp corba langtools install images clean dist-clean:
-	@$(foreach spec,$(SPEC),($(MAKE) -f $(makefile_path) SPEC=$(spec) $(VERBOSE) VERBOSE=$(VERBOSE) $@ $(MAKE_ARGS)) &&) true
+all clean dist-clean:
+langtools corba jaxp jaxws hotspot jdk images overlay-images install:
+langtools-only corba-only jaxp-only jaxws-only hotspot-only jdk-only images-only overlay-images-only install-only:
+clean-langtools clean-corba clean-jaxp clean-jaxws clean-hotspot clean-jdk clean-images:
+	@$(foreach spec,$(SPEC),($(MAKE) -f $(makefile_path) SPEC=$(spec) $(VERBOSE) VERBOSE=$(VERBOSE) $@) &&) true
 
-.PHONY: all jdk hotspot jaxws jaxp corba langtools install images clean dist-clean
+.PHONY: all clean dist-clean
+.PHONY: langtools corba jaxp jaxws hotspot jdk images overlay-images install
+.PHONY: langtools-only corba-only jaxp-only jaxws-only hotspot-only jdk-only images-only overlay-images-only install-only
+.PHONY: clean-langtools clean-corba clean-jaxp clean-jaxws clean-hotspot clean-jdk clean-images
 
 else
 ### This is the main part of the Makefile, for the normal case with SPEC specifying a single existing spec.gmk file.
@@ -77,77 +82,110 @@
 endif
 # Remove any javac server logs and port files. This
 # prevents a new make run to reuse the previous servers.
-ifneq (,$(JAVAC_SERVERS))
-    $(shell mkdir -p $(JAVAC_SERVERS) && rm -rf $(JAVAC_SERVERS)/*)
+ifneq (,$(SJAVAC_SERVER_DIR))
+    $(shell $(MKDIR) -p $(SJAVAC_SERVER_DIR) && $(RM) -rf $(SJAVAC_SERVER_DIR)/*)
 endif
 # Clean out any notifications from the previous build.
-$(shell find $(OUTPUT_ROOT) -name "_the.*.notify" $(FIND_DELETE))
+$(shell $(FIND) $(OUTPUT_ROOT) -name "_the.*.notify" $(FIND_DELETE))
 
 # Reset the build timers.
 $(eval $(call ResetTimers))
 
+# Setup number of jobs to use. -jN is unfortunately not available for us to parse from the command line,
+# hence this workaround.
+ifeq ($(JOBS),)
+    JOBS=$(NUM_CORES)
+endif
+MAKE_ARGS:=$(MAKE_ARGS) -j$(JOBS)
+
 ### Main targets
 
 all: jdk
-	@$(if $(JAVAC_SERVERS),rm -rf $(JAVAC_SERVERS)/*.port)
+	@$(if $(SJAVAC_SERVER_DIR),$(RM) -rf $(SJAVAC_SERVER_DIR)/*.port)
 	@$(call AtRootMakeEnd)
+.PHONY: all
 
 langtools: start-make langtools-only
 langtools-only:
 	@$(call MakeStart,langtools,all)
-	@($(CD) $(LANGTOOLS_TOPDIR)/makefiles && $(BUILD_LOG_WRAPPER) $(MAKE) -j$(JOBS) $(MAKE_ARGS))
+	@($(CD) $(LANGTOOLS_TOPDIR)/makefiles && $(BUILD_LOG_WRAPPER) $(MAKE) $(MAKE_ARGS))
 	@$(call MakeFinish,langtools,all)
 
 corba: langtools corba-only
 corba-only:
 	@$(call MakeStart,corba,all)
-	@($(CD) $(CORBA_TOPDIR)/makefiles && $(BUILD_LOG_WRAPPER) $(MAKE) -j$(JOBS) $(MAKE_ARGS))
+	@($(CD) $(CORBA_TOPDIR)/makefiles && $(BUILD_LOG_WRAPPER) $(MAKE) $(MAKE_ARGS))
 	@$(call MakeFinish,corba,all)
 
 jaxp: langtools jaxp-only
 jaxp-only:
 	@$(call MakeStart,jaxp,all)
-	@($(CD) $(JAXP_TOPDIR)/makefiles && $(BUILD_LOG_WRAPPER) $(MAKE) -j$(JOBS) $(MAKE_ARGS))
+	@($(CD) $(JAXP_TOPDIR)/makefiles && $(BUILD_LOG_WRAPPER) $(MAKE) $(MAKE_ARGS))
 	@$(call MakeFinish,jaxp,all)
 
 jaxws: langtools jaxp jaxws-only
 jaxws-only:
 	@$(call MakeStart,jaxws,all)
-	@($(CD) $(JAXWS_TOPDIR)/makefiles && $(BUILD_LOG_WRAPPER) $(MAKE) -j$(JOBS) $(MAKE_ARGS))
+	@($(CD) $(JAXWS_TOPDIR)/makefiles && $(BUILD_LOG_WRAPPER) $(MAKE) $(MAKE_ARGS))
 	@$(call MakeFinish,jaxws,all)
 
 hotspot: langtools hotspot-only
 hotspot-only:
 	@$(call MakeStart,hotspot,all)
-	@($(CD) $(HOTSPOT_TOPDIR)/make && $(BUILD_LOG_WRAPPER) $(MAKE) -j1 $(HOTSPOT_MAKE_ARGS) $(MAKE_ARGS))
+	@($(CD) $(SRC_ROOT)/common/makefiles && $(BUILD_LOG_WRAPPER) $(MAKE) $(MAKE_ARGS) -f HotspotWrapper.gmk)
 	@$(call MakeFinish,hotspot,all)
 
 jdk: langtools corba jaxp jaxws hotspot jdk-only
 jdk-only:
 	@$(call MakeStart,jdk,all)
-	@($(CD) $(JDK_TOPDIR)/makefiles && $(BUILD_LOG_WRAPPER) $(MAKE) -j$(JOBS) $(MAKE_ARGS))
+	@($(CD) $(JDK_TOPDIR)/makefiles && $(BUILD_LOG_WRAPPER) $(MAKE) $(MAKE_ARGS) $(JDK_TARGET))
 	@$(call MakeFinish,jdk,all)
 
 images: source-tips start-make jdk langtools corba jaxp jaxws hotspot images-only
 images-only:
 	@$(call MakeStart,jdk-images,$@)
-	@($(CD) $(JDK_TOPDIR)/makefiles && $(BUILD_LOG_WRAPPER) $(MAKE) -j$(JOBS) $(JDK_MAKE_ARGS) $(MAKE_ARGS) images)
+	@($(CD) $(JDK_TOPDIR)/makefiles && $(BUILD_LOG_WRAPPER) $(MAKE) $(MAKE_ARGS) images)
 	@$(call MakeFinish,jdk-images,$@)
-	@$(if $(JAVAC_SERVERS),rm -rf $(JAVAC_SERVERS)/*.port)
+	@$(if $(SJAVAC_SERVER_DIR),$(RM) -rf $(SJAVAC_SERVER_DIR)/*.port)
+	@$(call AtRootMakeEnd)
+
+overlay-images: source-tips start-make jdk langtools corba jaxp jaxws hotspot overlay-images-only
+overlay-images-only:
+	@$(call MakeStart,jdk-overlay-images,$@)
+	@($(CD) $(JDK_TOPDIR)/makefiles && $(BUILD_LOG_WRAPPER) $(MAKE) $(MAKE_ARGS) overlay-images)
+	@$(call MakeFinish,jdk-overlay-images,$@)
+	@$(if $(SJAVAC_SERVER_DIR),$(RM) -rf $(SJAVAC_SERVER_DIR)/*.port)
 	@$(call AtRootMakeEnd)
 
 install: source-tips start-make jdk langtools corba jaxp jaxws hotspot install-only
 install-only:
 	@$(call MakeStart,jdk-images,$@)
-	@($(CD) $(JDK_TOPDIR)/makefiles && $(BUILD_LOG_WRAPPER) $(MAKE) -j$(JOBS) $(JDK_MAKE_ARGS) $(MAKE_ARGS) install)
+	@($(CD) $(JDK_TOPDIR)/makefiles && $(BUILD_LOG_WRAPPER) $(MAKE) $(MAKE_ARGS) install)
 	@$(call MakeFinish,jdk-images,$@)
-	@$(if $(JAVAC_SERVERS),rm -rf $(JAVAC_SERVERS)/*.port)
+	@$(if $(SJAVAC_SERVER_DIR),$(RM) -rf $(SJAVAC_SERVER_DIR)/*.port)
 	@$(call AtRootMakeEnd)
 
+docs: start-make jdk docs-only
+docs-only:
+	@$(call MakeStart,docs,$@)
+	@($(CD) $(SRC_ROOT)/common/makefiles/javadoc && $(BUILD_LOG_WRAPPER) $(MAKE) $(MAKE_ARGS) -f Javadoc.gmk docs)
+	@$(call MakeFinish,docs,$@)
+	@$(if $(SJAVAC_SERVER_DIR),$(RM) -rf $(SJAVAC_SERVER_DIR)/*.port)
+	@$(call AtRootMakeEnd)
+
+
+.PHONY: langtools corba jaxp jaxws hotspot jdk images install
+.PHONY: langtools-only corba-only jaxp-only jaxws-only hotspot-only jdk-only images-only install-only
+
 start-make:
 	@$(call AtRootMakeStart)
+.PHONY: start-make
 
-.PHONY: jdk hotspot jaxws jaxp corba langtools install images start-make
+bootcycle-images:
+	@$(ECHO) Boot cycle build step 1: Building the JDK image normally
+	@($(CD) $(SRC_ROOT)/common/makefiles && $(BUILD_LOG_WRAPPER) $(MAKE) SPEC=$(SPEC) images)
+	@$(ECHO) Boot cycle build step 2: Building a new JDK image using previously built image
+	@($(CD) $(SRC_ROOT)/common/makefiles && $(BUILD_LOG_WRAPPER) $(MAKE) SPEC=$(dir $(SPEC))bootcycle-spec.gmk images)
 
 test: start-make
 	@$(call MakeStart,test,$(if $(TEST),$(TEST),all))
@@ -167,8 +205,8 @@
 
 
 # Remove everything, except the output from configure.
-clean:
-	@(cd $(OUTPUT_ROOT) && $(RM) -r `$(LS) $(OUTPUT_ROOT) | grep -v spec.gmk | grep -v spec.sh | grep -v Makefile | grep -v config.status | grep -v config.log | grep -v config.h | grep -v configure-arguments | grep -v "localdevenv.*" | grep -v uncygdrive.exe`)
+clean: clean-langtools clean-corba clean-jaxp clean-jaxws clean-hotspot clean-jdk clean-images clean-bootcycle-build
+	@($(CD) $(OUTPUT_ROOT) && $(RM) -r tmp source_tips build.log*)
 	@$(ECHO) Cleaned everything except the build configuration.
 .PHONY: clean
 
@@ -178,11 +216,24 @@
 	@$(ECHO) Cleaned everything, you will have to re-run configure.
 .PHONY: dist-clean
 
+clean-langtools:
+	$(call CleanComponent,langtools)
+clean-corba:
+	$(call CleanComponent,corba)
+clean-jaxp:
+	$(call CleanComponent,jaxp)
+clean-jaxws:
+	$(call CleanComponent,jaxws)
+clean-hotspot:
+	$(call CleanComponent,hotspot)
 clean-jdk:
-	@(cd $(OUTPUT_ROOT) && $(RM) -r `$(LS) $(OUTPUT_ROOT) | grep -v spec.gmk | grep -v spec.sh | grep -v Makefile | grep -v config.status | grep -v config.log |  grep -v config.h | grep -v configure-arguments | \
-                               grep -v langtools | grep -v corba | grep -v jaxp | grep -v jaxws | grep -v hotspot`)
-	@$(ECHO) "Cleaned jdk build artifacts (but not langtools,corba,jaxp,jaxws,hotspot nor the build configuration)"
-.PHONY: clean
+	$(call CleanComponent,jdk)
+clean-images:
+	$(call CleanComponent,images)
+clean-bootcycle-build:
+	$(call CleanComponent,bootcycle-build)
+
+.PHONY: clean-langtools clean-corba clean-jaxp clean-jaxws clean-hotspot clean-jdk clean-images
 
 endif
 
@@ -195,24 +246,39 @@
 	$(info =====================)
 	$(info )
 	$(info Common make targets)
-	$(info .  make [all]            # Compile all code but do not create images)
-	$(info .  make images           # Create complete j2sdk and j2re images)
-	$(info .  make install          # Install the generated images locally)
-	$(info .  make clean            # Remove all files generated by make, but not those generated by configure)
-	$(info .  make dist-clean       # Remove all files generated by both make and configure)
-	$(info .  make help             # Give some help on using make)
-	$(info .  make test             # Run tests, default is all tests (see TEST below))
+	$(info .  make [all]             # Compile all code but do not create images)
+	$(info .  make images            # Create complete j2sdk and j2re images)
+	$(info .  make overlay-images    # Create limited images for sparc 64 bit platforms)
+	$(info .  make bootcycle-images  # Build images twice, second time with newly build JDK)
+	$(info .  make install           # Install the generated images locally)
+	$(info .  make clean             # Remove all files generated by make, but not those)
+	$(info .                         # generated by configure)
+	$(info .  make dist-clean        # Remove all files, including configuration)
+	$(info .  make help              # Give some help on using make)
+	$(info .  make test              # Run tests, default is all tests (see TEST below))
+	$(info )
+	$(info Targets for specific components)
+	$(info (Component is any of langtools, corba, jaxp, jaxws, hotspot, jdk or images))
+	$(info .  make <component>       # Build <component> and everything it depends on. )
+	$(info .  make <component>-only  # Build <component> only, without dependencies. This)
+	$(info .                         # is faster but can result in incorrect build results!)
+	$(info .  make clean-<component> # Remove files generated by make for <component>)
 	$(info )
 	$(info Useful make variables)
-	$(info .  make CONF=            # Build all configurations (note, assignment is empty))
-	$(info .  make CONF=<substring> # Build the configuration(s) with a name matching the given substring)
+	$(info .  make CONF=             # Build all configurations (note, assignment is empty))
+	$(info .  make CONF=<substring>  # Build the configuration(s) with a name matching)
+	$(info .                         # <substring>)
 	$(info )
-	$(info .  make LOG=<loglevel>   # Change loglevel from warn (default) to the given loglevel)
-	$(info .                        # Available loglevels are: warn, info, debug and trace)
-	$(info .                        # To see executed command lines, use LOG=info)
+	$(info .  make LOG=<loglevel>    # Change the log level from warn to <loglevel>)
+	$(info .                         # Available log levels are:)
+	$(info .                         # 'warn' (default), 'info', 'debug' and 'trace')
+	$(info .                         # To see executed command lines, use LOG=info)
 	$(info )
-	$(info .  make test TEST=<test> # Only run the given test or tests, e.g.)
-	$(info .                        # make test TEST="jdk_lang jdk_net")
+	$(info .  make JOBS=<n>          # Run <n> parallel make jobs)
+	$(info .                         # Note that -jN does not work as expected!)
+	$(info )
+	$(info .  make test TEST=<test>  # Only run the given test or tests, e.g.)
+	$(info .                         # make test TEST="jdk_lang jdk_net")
 	$(info )
 .PHONY: help
 FRC: # Force target
--- a/common/makefiles/NativeCompilation.gmk	Wed Jul 05 18:22:17 2017 +0200
+++ b/common/makefiles/NativeCompilation.gmk	Wed Jul 05 18:22:52 2017 +0200
@@ -55,22 +55,22 @@
 
     ifneq (,$$(filter %.c,$2))
         # Compile as a C file
-        $1_$2_FLAGS=$4 $$($1_$(notdir $2)_CFLAGS) -c
+        $1_$2_FLAGS=$4 $$($1_$(notdir $2)_CFLAGS) -DTHIS_FILE='"$$(<F)"' -c
         $1_$2_COMP=$5
         $1_$2_DEP_FLAG:=$(C_FLAG_DEPS)
     else ifneq (,$$(filter %.m,$2))
         # Compile as a objective-c file
-        $1_$2_FLAGS=-x objective-c $4 $$($1_$(notdir $2)_CFLAGS) -c
+        $1_$2_FLAGS=-x objective-c $4 $$($1_$(notdir $2)_CFLAGS) -DTHIS_FILE='"$$(<F)"' -c
         $1_$2_COMP=$5
         $1_$2_DEP_FLAG:=$(C_FLAG_DEPS)
     else ifneq (,$$(filter %.s,$2))
         # Compile as assembler file
-        $1_$2_FLAGS=$8
+        $1_$2_FLAGS=$8 -DTHIS_FILE='"$$(<F)"'
         $1_$2_COMP=$(AS)
         $1_$2_DEP_FLAG:=
     else
         # Compile as a C++ file
-        $1_$2_FLAGS=$6 $$($1_$(notdir $2)_CXXFLAGS) -c
+        $1_$2_FLAGS=$6 $$($1_$(notdir $2)_CXXFLAGS) -DTHIS_FILE='"$$(<F)"' -c
         $1_$2_COMP=$7
         $1_$2_DEP_FLAG:=$(CXX_FLAG_DEPS)
     endif
@@ -98,7 +98,6 @@
 		$$($1_$2_COMP) $$($1_$2_FLAGS) $$($1_$2_DEP_FLAG) $$($1_$2_DEP) $(CC_OUT_OPTION)$$($1_$2_OBJ) $2
         endif
         ifeq ($(COMPILER_TYPE),CL)
-		$$(call COMPILING_MSG,$$(notdir $2))
 		$$($1_$2_COMP) $$($1_$2_FLAGS) $$($1_$2_DEBUG_OUT_FLAGS) $(CC_OUT_OPTION)$$($1_$2_OBJ) $2
         endif
     endif
@@ -129,6 +128,7 @@
     #    DEBUG_SYMBOLS add debug symbols (if configured on)
     #    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
     $(if $2,$1_$(strip $2))
     $(if $3,$1_$(strip $3))
     $(if $4,$1_$(strip $4))
@@ -149,7 +149,11 @@
     $(if $(19),$1_$(strip $(19)))
     $(if $(20),$1_$(strip $(20)))
     $(if $(21),$1_$(strip $(21)))
-    $(if $(22),$(error Internal makefile error: Too many arguments to SetupNativeCompilation, please update NativeCompilation.gmk))
+    $(if $(22),$1_$(strip $(22)))
+    $(if $(23),$1_$(strip $(23)))
+    $(if $(24),$1_$(strip $(24)))
+    $(if $(25),$1_$(strip $(25)))
+    $(if $(26),$(error Internal makefile error: Too many arguments to SetupNativeCompilation, please update NativeCompilation.gmk))
 
     ifneq (,$$($1_BIN))
         $$(error BIN has been replaced with OBJECT_DIR)
@@ -315,6 +319,17 @@
         $1_EXTRA_CXXFLAGS+=$$($1_CXXFLAGS_$(OPENJDK_TARGET_OS)_release)
     endif
 
+    ifneq (,$$($1_DEBUG_SYMBOLS))	
+        ifeq ($(ENABLE_DEBUG_SYMBOLS), yes)
+            # Programs don't get the debug symbols added in the old build. It's not clear if
+            # this is intentional.
+            ifeq ($$($1_PROGRAM),)
+                $1_EXTRA_CFLAGS+=$(CFLAGS_DEBUG_SYMBOLS)
+                $1_EXTRA_CXXFLAGS+=$(CXXFLAGS_DEBUG_SYMBOLS)
+            endif
+        endif
+    endif
+
     ifeq ($$($1_CXXFLAGS),)
         $1_CXXFLAGS:=$$($1_CFLAGS)
     endif
@@ -327,40 +342,20 @@
           $1_EXTRA_CXXFLAGS += $$(CXX_FLAG_REORDER)
     endif
 
-    ifneq (no, $(ENABLE_DEBUG_SYMBOLS))
-	ifneq ($(OPENJDK_TARGET_OS), solaris)
-# <weird code />
-# There is very weird code in Defs-solaris.gmk that first sets variables as decribed below
-#   and then a couple of hundreds of line below resets them...
-#   this feels like a sure bug...but before this is confirmed, mimic this behaviour
-# (note: skip indenting this as it will surely be removed anyway)
-# <weird code />
-
-        ifneq (,$$($1_DEBUG_SYMBOLS))
-		$1_OPTIMIZATION := LOW
-		$1_EXTRA_CFLAGS += $(CFLAGS_DEBUG_SYMBOLS)
-		$1_EXTRA_CXXFLAGS += $(CXXFLAGS_DEBUG_SYMBOLS)
-        endif
-
-# <weird code />
-	endif
-# <weird code />
-    endif
-
     ifeq (NONE, $$($1_OPTIMIZATION))
-	$1_EXTRA_CFLAGS += $$(C_O_FLAG_NONE)
-	$1_EXTRA_CXXFLAGS += $$(CXX_O_FLAG_NONE)
+        $1_EXTRA_CFLAGS += $(C_O_FLAG_NONE)
+        $1_EXTRA_CXXFLAGS += $(CXX_O_FLAG_NONE)
     else ifeq (LOW, $$($1_OPTIMIZATION))
-	$1_EXTRA_CFLAGS += $$(C_O_FLAG_NORM)
-	$1_EXTRA_CXXFLAGS += $$(CXX_O_FLAG_NORM)
+        $1_EXTRA_CFLAGS += $(C_O_FLAG_NORM)
+        $1_EXTRA_CXXFLAGS += $(CXX_O_FLAG_NORM)
     else ifeq (HIGH, $$($1_OPTIMIZATION))
-	$1_EXTRA_CFLAGS += $$(C_O_FLAG_HI)
-	$1_EXTRA_CXXFLAGS += $$(CXX_O_FLAG_HI)
+        $1_EXTRA_CFLAGS += $(C_O_FLAG_HI)
+        $1_EXTRA_CXXFLAGS += $(CXX_O_FLAG_HI)
     else ifeq (HIGHEST, $$($1_OPTIMIZATION))
-	$1_EXTRA_CFLAGS += $$(C_O_FLAG_HIGHEST)
-	$1_EXTRA_CXXFLAGS += $$(CXX_O_FLAG_HIGHEST)
+        $1_EXTRA_CFLAGS += $(C_O_FLAG_HIGHEST)
+        $1_EXTRA_CXXFLAGS += $(CXX_O_FLAG_HIGHEST)
     else ifneq (, $$($1_OPTIMIZATION))
-	$$(error Unknown value for OPTIMIZATION: $$($1_OPTIMIZATION))
+        $$(error Unknown value for OPTIMIZATION: $$($1_OPTIMIZATION))
     endif
 
     # Now create a list of the packages that are about to compile. Used when sending source
@@ -375,7 +370,7 @@
 			$$($1_CXXFLAGS) $$($1_EXTRA_CXXFLAGS),$(CXX),$$($1_ASFLAGS))))
 
     # On windows we need to create a resource file
-    ifeq ($(OPENJDK_TARGET_OS_API), winapi)
+    ifeq ($(OPENJDK_TARGET_OS), windows)
         ifneq (,$$($1_VERSIONINFO_RESOURCE))
             $1_RES:=$$($1_OBJECT_DIR)/$$($1_BASENAME).res
             $$($1_RES): $$($1_VERSIONINFO_RESOURCE)
@@ -409,8 +404,8 @@
     endif
     endif
 
-    # Pickup extra OPENJDK_TARGET_OS_API dependent variables (posix or winapi) and 
-    # (linux,solaris,windows,bsd) for LDFLAGS and LDFLAGS_SUFFIX
+    # Pickup extra OPENJDK_TARGET_OS_API and/or OPENJDK_TARGET_OS dependent variables
+    # for LDFLAGS and LDFLAGS_SUFFIX
     $1_EXTRA_LDFLAGS:=$$($1_LDFLAGS_$(OPENJDK_TARGET_OS_API)) $$($1_LDFLAGS_$(OPENJDK_TARGET_OS))
     $1_EXTRA_LDFLAGS_SUFFIX:=$$($1_LDFLAGS_SUFFIX_$(OPENJDK_TARGET_OS_API)) $$($1_LDFLAGS_SUFFIX_$(OPENJDK_TARGET_OS))
     ifneq (,$$($1_REAL_MAPFILE))
@@ -432,9 +427,10 @@
 				      "-map:$$($1_OBJECT_DIR)/$$($1_LIBRARY).map"
                 endif
 
-                $$($1_OUTPUT_DIR)/% : $$($1_OBJECT_DIR)/%
+                ifneq ($$($1_OUTPUT_DIR),$$($1_OBJECT_DIR))
+                    $$($1_OUTPUT_DIR)/% : $$($1_OBJECT_DIR)/%
 			$(CP) $$< $$@
-
+                endif
 
                 ifeq ($(OPENJDK_TARGET_OS), solaris)
                     # gobjcopy crashes on "empty" section headers with the SHF_ALLOC flag set.
@@ -509,8 +505,10 @@
 				      "-map:$$($1_OBJECT_DIR)/$$($1_PROGRAM).map"
                 endif
 
-                $$($1_OUTPUT_DIR)/% : $$($1_OBJECT_DIR)/%
+                ifneq ($$($1_OUTPUT_DIR),$$($1_OBJECT_DIR))
+                    $$($1_OUTPUT_DIR)/% : $$($1_OBJECT_DIR)/%
 			$(CP) $$< $$@
+                endif
 
                 ifeq ($(OPENJDK_TARGET_OS), solaris)
                     # gobjcopy crashes on "empty" section headers with the SHF_ALLOC flag set.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/common/makefiles/javadoc/CORE_PKGS.gmk	Wed Jul 05 18:22:52 2017 +0200
@@ -0,0 +1,293 @@
+#
+# Copyright (c) 2001, 2011, 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.
+#
+
+# EXCLUDE_PKGS is the list of packages to exclude from the
+# Java API Specification.  Do not add these to CORE_PKGS.
+# The concatenation of EXCLUDE_PKGS and CORE_PKGS
+# should make up the list of all packages under the
+# src/shared/classes directory of the JDK source tree.
+#
+EXCLUDE_PKGS =             \
+  java.awt.peer            \
+  java.awt.dnd.peer        \
+  sun.*                    \
+  com.sun.*                \
+  org.apache.*             \
+  org.jcp.*		   \
+  org.w3c.dom.css          \
+  org.w3c.dom.html         \
+  org.w3c.dom.stylesheets  \
+  org.w3c.dom.traversal    \
+  org.w3c.dom.ranges       \
+  org.w3c.dom.views        \
+  org.omg.stub.javax.management.remote.rmi
+
+#
+# ACTIVE_JSR_PKGS are packages that are part of an active JSR process--
+# one that is doing its own review. These packages are not included when
+# creating diff pages for the platform's JCP process.
+# 
+#       (see /java/pubs/apisrc/jdk/6.0/beta/make/docs/active_jsr_pkgs)
+# Note:
+# This is a list of regular expressions. So foo.* matches "foo" and "foo.bar".
+#
+ACTIVE_JSR_PKGS= \
+  java.lang.invoke \
+  java.sql  \
+  javax.activation  \
+  javax.annotation.*  \
+  javax.jws.*  \
+  javax.lang.*  \
+  javax.management.*  \
+  javax.script  \
+  javax.sql.*  \
+  javax.tools.*  \
+  javax.xml.*  \
+  org.w3c.*  \
+  org.xml.sax
+
+#
+# CORE_PKGS is the list of packages that form the
+# Java API Specification.
+#
+### ***IMPORTANT NOTE***
+### There is also a "REGEXP" variable in the docs/makefile that
+### determines which table the packages go in on the main page.
+### Currently, there is only table ("Platform Packages") and
+### everything goes in it, so REGEXP is "*". But if that policy
+### changes, packages added will need to be reflected in  that
+### list of wildcard expressions, as well.
+###
+CORE_PKGS =                                      \
+  java.applet                                    \
+  java.awt                                       \
+  java.awt.color                                 \
+  java.awt.datatransfer                          \
+  java.awt.dnd                                   \
+  java.awt.event                                 \
+  java.awt.font                                  \
+  java.awt.geom                                  \
+  java.awt.im                                    \
+  java.awt.im.spi                                \
+  java.awt.image                                 \
+  java.awt.image.renderable                      \
+  java.awt.print                                 \
+  java.beans                                     \
+  java.beans.beancontext                         \
+  java.io                                        \
+  java.lang                                      \
+  java.lang.annotation                           \
+  java.lang.instrument                           \
+  java.lang.invoke                               \
+  java.lang.management                           \
+  java.lang.ref                                  \
+  java.lang.reflect                              \
+  java.math                                      \
+  java.net                                       \
+  java.nio                                       \
+  java.nio.channels                              \
+  java.nio.channels.spi                          \
+  java.nio.charset                               \
+  java.nio.charset.spi                           \
+  java.nio.file					 \
+  java.nio.file.attribute			 \
+  java.nio.file.spi				 \
+  java.rmi                                       \
+  java.rmi.activation                            \
+  java.rmi.dgc                                   \
+  java.rmi.registry                              \
+  java.rmi.server                                \
+  java.security                                  \
+  java.security.acl                              \
+  java.security.cert                             \
+  java.security.interfaces                       \
+  java.security.spec                             \
+  java.sql                                       \
+  java.text                                      \
+  java.text.spi                                  \
+  java.util                                      \
+  java.util.concurrent                           \
+  java.util.concurrent.atomic                    \
+  java.util.concurrent.locks                     \
+  java.util.jar                                  \
+  java.util.logging                              \
+  java.util.prefs                                \
+  java.util.regex                                \
+  java.util.spi                                  \
+  java.util.zip                                  \
+  javax.accessibility                            \
+  javax.activation                               \
+  javax.activity                                 \
+  javax.annotation                               \
+  javax.annotation.processing                    \
+  javax.crypto                                   \
+  javax.crypto.interfaces                        \
+  javax.crypto.spec                              \
+  javax.imageio                                  \
+  javax.imageio.event                            \
+  javax.imageio.metadata                         \
+  javax.imageio.plugins.jpeg                     \
+  javax.imageio.plugins.bmp                      \
+  javax.imageio.spi                              \
+  javax.imageio.stream                           \
+  javax.jws                                      \
+  javax.jws.soap                                 \
+  javax.lang.model                               \
+  javax.lang.model.element                       \
+  javax.lang.model.type                          \
+  javax.lang.model.util                          \
+  javax.management                               \
+  javax.management.loading                       \
+  javax.management.monitor                       \
+  javax.management.relation                      \
+  javax.management.openmbean                     \
+  javax.management.timer                         \
+  javax.management.modelmbean                    \
+  javax.management.remote                        \
+  javax.management.remote.rmi                    \
+  javax.naming                                   \
+  javax.naming.directory                         \
+  javax.naming.event                             \
+  javax.naming.ldap                              \
+  javax.naming.spi                               \
+  javax.net                                      \
+  javax.net.ssl                                  \
+  javax.print                                    \
+  javax.print.attribute                          \
+  javax.print.attribute.standard                 \
+  javax.print.event                              \
+  javax.rmi                                      \
+  javax.rmi.CORBA                                \
+  javax.rmi.ssl                                  \
+  javax.script                                   \
+  javax.security.auth                            \
+  javax.security.auth.callback                   \
+  javax.security.auth.kerberos                   \
+  javax.security.auth.login                      \
+  javax.security.auth.spi                        \
+  javax.security.auth.x500                       \
+  javax.security.cert                            \
+  javax.security.sasl                            \
+  javax.sound.sampled                            \
+  javax.sound.sampled.spi                        \
+  javax.sound.midi                               \
+  javax.sound.midi.spi                           \
+  javax.sql                                      \
+  javax.sql.rowset                               \
+  javax.sql.rowset.serial                        \
+  javax.sql.rowset.spi                           \
+  javax.swing                                    \
+  javax.swing.border                             \
+  javax.swing.colorchooser                       \
+  javax.swing.filechooser                        \
+  javax.swing.event                              \
+  javax.swing.table                              \
+  javax.swing.text                               \
+  javax.swing.text.html                          \
+  javax.swing.text.html.parser                   \
+  javax.swing.text.rtf                           \
+  javax.swing.tree                               \
+  javax.swing.undo                               \
+  javax.swing.plaf                               \
+  javax.swing.plaf.basic                         \
+  javax.swing.plaf.metal                         \
+  javax.swing.plaf.multi                         \
+  javax.swing.plaf.nimbus                        \
+  javax.swing.plaf.synth                         \
+  javax.tools                                    \
+  javax.tools.annotation                         \
+  javax.transaction                              \
+  javax.transaction.xa                           \
+  javax.xml.parsers                              \
+  javax.xml.bind                                 \
+  javax.xml.bind.annotation                      \
+  javax.xml.bind.annotation.adapters             \
+  javax.xml.bind.attachment                      \
+  javax.xml.bind.helpers                         \
+  javax.xml.bind.util                            \
+  javax.xml.soap                                 \
+  javax.xml.ws                                   \
+  javax.xml.ws.handler                           \
+  javax.xml.ws.handler.soap                      \
+  javax.xml.ws.http                              \
+  javax.xml.ws.soap                              \
+  javax.xml.ws.spi                               \
+  javax.xml.ws.spi.http                          \
+  javax.xml.ws.wsaddressing                      \
+  javax.xml.transform                            \
+  javax.xml.transform.sax                        \
+  javax.xml.transform.dom                        \
+  javax.xml.transform.stax                       \
+  javax.xml.transform.stream                     \
+  javax.xml                                      \
+  javax.xml.crypto				 \
+  javax.xml.crypto.dom				 \
+  javax.xml.crypto.dsig				 \
+  javax.xml.crypto.dsig.dom			 \
+  javax.xml.crypto.dsig.keyinfo			 \
+  javax.xml.crypto.dsig.spec			 \
+  javax.xml.datatype                             \
+  javax.xml.validation                           \
+  javax.xml.namespace                            \
+  javax.xml.xpath                                \
+  javax.xml.stream                               \
+  javax.xml.stream.events                        \
+  javax.xml.stream.util                          \
+  org.ietf.jgss                                  \
+  org.omg.CORBA                                  \
+  org.omg.CORBA.DynAnyPackage                    \
+  org.omg.CORBA.ORBPackage                       \
+  org.omg.CORBA.TypeCodePackage                  \
+  org.omg.stub.java.rmi                          \
+  org.omg.CORBA.portable                         \
+  org.omg.CORBA_2_3                              \
+  org.omg.CORBA_2_3.portable                     \
+  org.omg.CosNaming                              \
+  org.omg.CosNaming.NamingContextExtPackage      \
+  org.omg.CosNaming.NamingContextPackage         \
+  org.omg.SendingContext                         \
+  org.omg.PortableServer                         \
+  org.omg.PortableServer.CurrentPackage          \
+  org.omg.PortableServer.POAPackage              \
+  org.omg.PortableServer.POAManagerPackage       \
+  org.omg.PortableServer.ServantLocatorPackage   \
+  org.omg.PortableServer.portable                \
+  org.omg.PortableInterceptor                    \
+  org.omg.PortableInterceptor.ORBInitInfoPackage \
+  org.omg.Messaging                              \
+  org.omg.IOP                                    \
+  org.omg.IOP.CodecFactoryPackage                \
+  org.omg.IOP.CodecPackage                       \
+  org.omg.Dynamic                                \
+  org.omg.DynamicAny                             \
+  org.omg.DynamicAny.DynAnyPackage               \
+  org.omg.DynamicAny.DynAnyFactoryPackage        \
+  org.w3c.dom                                    \
+  org.w3c.dom.events                             \
+  org.w3c.dom.bootstrap                          \
+  org.w3c.dom.ls                                 \
+  org.xml.sax                                    \
+  org.xml.sax.ext                                \
+  org.xml.sax.helpers
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/common/makefiles/javadoc/Javadoc.gmk	Wed Jul 05 18:22:52 2017 +0200
@@ -0,0 +1,1184 @@
+# Copyright (c) 1997, 2012, 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.
+#
+
+include $(SPEC)
+include MakeBase.gmk
+
+.SUFFIXES: # Delete the default suffixes
+.SUFFIXES: .java
+
+#
+# Definitions for $(DOCSDIR), $(MKDIR), $(BINDIR), etc.
+#
+
+CLASSPATH_SEPARATOR = :
+
+DOCSDIR=$(OUTPUT_ROOT)/docs
+TEMPDIR=$(OUTPUT_ROOT)/docstemp
+
+JDK_SHARE_SRC=$(JDK_TOPDIR)/src/share
+JDK_SHARE_CLASSES=$(JDK_SHARE_SRC)/classes
+
+JDK_IMPSRC = $(JDK_OUTPUTDIR)/impsrc
+
+JDK_GENSRC = $(JDK_OUTPUTDIR)/gensrc
+
+HOTSPOT_DOCS_IMPORT_PATH=$(HOTSPOT_OUTPUTDIR)/docs
+
+BUILD_NUMBER=$(JDK_BUILD_NUMBER)
+
+BOOT_JAVA_CMD=$(JAVA)
+
+# Langtools
+JAVAC_JAR   = $(LANGTOOLS_DIST)/bootstrap/lib/javac.jar
+JAVADOC_JAR = $(LANGTOOLS_DIST)/bootstrap/lib/javadoc.jar
+DOCLETS_JAR = $(LANGTOOLS_DIST)/bootstrap/lib/doclets.jar
+JAVADOC_CMD = $(BOOT_JAVA_CMD) \
+              -Xmx1024m \
+	      -Djava.awt.headless=true \
+              "-Xbootclasspath/p:$(JAVADOC_JAR)$(CLASSPATH_SEPARATOR)$(JAVAC_JAR)$(CLASSPATH_SEPARATOR)$(DOCLETS_JAR)" \
+              -jar $(JAVADOC_JAR)
+
+JAVADOC_CMD = javadoc 
+
+# Copyright year for beginning of Java and some of the apis
+#   (Needed when creating the javadocs)
+FIRST_COPYRIGHT_YEAR                = 1993
+DOMAPI_FIRST_COPYRIGHT_YEAR         = 2005
+MIRROR_FIRST_COPYRIGHT_YEAR         = 2004
+DOCLETAPI_FIRST_COPYRIGHT_YEAR      = 1993
+TAGLETAPI_FIRST_COPYRIGHT_YEAR      = 1993
+JDI_FIRST_COPYRIGHT_YEAR            = 1999
+JAAS_FIRST_COPYRIGHT_YEAR           = 1998
+JGSS_FIRST_COPYRIGHT_YEAR           = 2000
+SMARTCARDIO_FIRST_COPYRIGHT_YEAR    = 2005
+HTTPSERVER_FIRST_COPYRIGHT_YEAR     = 2005
+MGMT_FIRST_COPYRIGHT_YEAR           = 2003
+ATTACH_FIRST_COPYRIGHT_YEAR         = 2005
+JCONSOLE_FIRST_COPYRIGHT_YEAR       = 2006
+SCTPAPI_FIRST_COPYRIGHT_YEAR        = 2009
+TRACING_FIRST_COPYRIGHT_YEAR        = 2008
+TREEAPI_FIRST_COPYRIGHT_YEAR        = 2005
+JNLP_FIRST_COPYRIGHT_YEAR           = 1998
+PLUGIN2_FIRST_COPYRIGHT_YEAR        = 2007
+
+# Oracle name
+FULL_COMPANY_NAME = Oracle and/or its affiliates
+
+# Copyright address
+COMPANY_ADDRESS = 500 Oracle Parkway<br>Redwood Shores, CA 94065 USA.
+
+# The trademark symbol
+TRADEMARK = &trade;
+
+# Common copyright lines used
+#   The word "Copyright" might optionally be a link to the file cpyr.html.
+#   The first year of copyright may vary or not be available.
+#   The address to the company might be optional.
+COMMA:= ,
+EMPTY:=
+SPACE:=$(EMPTY) $(EMPTY)
+COPYRIGHT_SYMBOL = &\#x00a9;
+# Macro to construct the copyright line
+#   (The GNU make 3.78.1 "if" conditional is broken, fixed in GNU make 3.81)
+define CopyrightLine # optionalurl optionalfirstyear optionaladdress
+$(if $(strip $1),<a href="$(strip $1)">Copyright</a>,Copyright) \
+$(COPYRIGHT_SYMBOL) $(if $2,$2${COMMA},) $(COPYRIGHT_YEAR),\
+$(FULL_COMPANY_NAME). $3 All rights reserved.
+endef
+
+# Url to root of documents
+DOCSDIR_URL = {@docroot}/$(GET2DOCSDIR)
+
+# Url to copyright html file
+COPYRIGHT_URL-7 = $(DOCSDIR_URL)/legal/cpyr.html
+COPYRIGHT_URL-8 = $(DOCSDIR_URL)/legal/cpyr.html
+COPYRIGHT_URL = $(COPYRIGHT_URL-$(JDK_MINOR_VERSION))
+
+# Url to bug filing site
+BUG_SUBMIT_URL = http://bugreport.sun.com/bugreport/
+
+# Common line for how to submit a bug or rfe
+BUG_SUBMIT_LINE = <a href="$(BUG_SUBMIT_URL)">Submit a bug or feature</a>
+
+# Url to devdocs page
+#   Was: http://java.sun.com/javase/6/webnotes/devdocs-vs-specs.html
+DEV_DOCS_URL-7 = http://download.oracle.com/javase/7/docs/index.html
+DEV_DOCS_URL-8 = http://download.oracle.com/javase/7/docs/index.html
+DEV_DOCS_URL = $(DEV_DOCS_URL-$(JDK_MINOR_VERSION))
+DOCS_BASE_URL = http://download.oracle.com/javase/7/docs
+
+# Common Java trademark line
+JAVA_TRADEMARK_LINE = Java is a trademark or registered trademark of \
+$(FULL_COMPANY_NAME) in the US and other countries.
+
+#################################################################
+# Macros:
+
+
+# List of all possible directories for javadoc to look for sources
+#    NOTE: Quotes are required around sourcepath argument only on Windows.
+#          Otherwise, you get "No packages or classes specified." due 
+#          to $(CLASSPATH_SEPARATOR) being interpreted as an end of 
+#          command (newline or shell ; character)
+ALL_SOURCE_DIRS = $(JDK_IMPSRC) \
+                  $(JDK_GENSRC) \
+                  $(JDK_SHARE_CLASSES) \
+                  $(JDK_TOPDIR)/src/solaris/classes \
+                  $(JDK_TOPDIR)/src/windows/classes \
+		  $(JDK_SHARE_SRC)/doc/stub
+
+# List of directories that actually exist
+ALL_EXISTING_SOURCE_DIRS := $(wildcard $(ALL_SOURCE_DIRS))
+
+# List with classpath separator between them
+EMPTY:=
+SPACE:= $(EMPTY) $(EMPTY)
+RELEASEDOCS_SOURCEPATH = \
+    $(subst $(SPACE),$(CLASSPATH_SEPARATOR),$(strip $(ALL_SOURCE_DIRS)))
+
+define prep-target
+$(MKDIR) -p $(@D)
+$(RM) $@
+endef
+
+# Prep for javadoc creation, assumes $@ is an index.html file
+define prep-javadoc
+@if [ -f "$@" -a "$?" != "" ] ; then \
+  $(ECHO) "# Dependencies have changed: $?"; \
+fi
+$(RM) -r $(@D)
+$(MKDIR) -p $(@D)
+endef
+
+# A cache of the directories in ALL_SOURCE_DIRS
+DIRECTORY_CACHE = $(DOCSTMPDIR)/directory.cache
+
+# Given a list of packages, return a list of files or dirs to be dependent on
+#   (Currently only returning a list of directories)
+define PackageDependencies # packages
+$(shell							\
+  if [ "$1" != "" -a -f $(DIRECTORY_CACHE) ] ; then	\
+    for p in $1 ; do 					\
+      pd=`$(ECHO) $${p} | $(SED) -e 's@[.]@/@g'`;	\
+      $(CAT) $(DIRECTORY_CACHE) | $(GREP) "/$${pd}/" ; 	\
+    done; 						\
+  fi							\
+)
+endef
+
+# Given a list of packages, add packages that exist to $@, print summary
+define PackageFilter # packages
+@if [ "$1" != "" ] ; then 				\
+  for p in $1 ; do 					\
+    pd=`$(ECHO) $${p} | $(SED) -e 's@[.]@/@g'`; 	\
+    found="false"; 					\
+    for cp in $(ALL_SOURCE_DIRS) ; do 			\
+      if [ -d $${cp}/$${pd} ] ; then 			\
+        $(ECHO) "$${p}" >> $@; 				\
+	found="true";					\
+	break; 						\
+      fi; 						\
+    done; 						\
+    if [ "$${found}" = "false" ] ; then 		\
+      $(ECHO) "WARNING: Package not found: $${p}"; 	\
+    fi; 						\
+  done; 						\
+fi
+endef
+
+# Print out a summary of the javadoc command about to be run
+define JavadocSummary # optionsfile packagesfile
+@$(ECHO) "# Summary for $@";\
+ $(ECHO) "# Options (`$(BASENAME) $1`):"; $(SED) -e 's@^@#   @' $1; \
+ $(ECHO) "# Packages (`$(BASENAME) $2`):";$(SED) -e 's@^@#   @' $2
+endef
+
+#
+# Temporary directory for javadoc creation
+#
+DOCSTMPDIR = $(TEMPDIR)/doctmp
+
+#
+# Different api directories created from root directory
+#
+COREAPI_DOCSDIR   = $(DOCSDIR)/api
+JDK_API_DOCSDIR   = $(DOCSDIR)/jdk/api
+JRE_API_DOCSDIR   = $(DOCSDIR)/jre/api
+PLATFORM_DOCSDIR  = $(DOCSDIR)/platform
+
+# The non-core api javadocs need to be able to access the root of the core
+#   api directory, so for jdk/api or jre/api to get to the core api/
+#   directory we would use this:
+JDKJRE2COREAPI    = ../../api
+
+# Common bottom argument
+define CommonBottom # year
+<font size="-1"><br> $(call CopyrightLine,,$1,)</font>
+endef
+
+# Common trademark bottom argument (Not sure why this is used sometimes)
+define CommonTrademarkBottom # year
+<font size="-1">\
+$(BUG_SUBMIT_LINE)<br>$(JAVA_TRADEMARK_LINE)<br>\
+$(call CopyrightLine,,$1,$(COMPANY_ADDRESS))\
+</font>
+endef
+
+# Common echo of option
+define OptionOnly # opt
+$(PRINTF) "%s\n" "$1"
+endef
+define OptionPair # opt arg
+$(PRINTF) "%s '%s'\n" "$1" '$2'
+endef
+define OptionTrip # opt arg arg
+$(PRINTF) "%s '%s' '%s'\n" "$1" '$2' '$3'
+endef
+
+# Core api bottom argument (with special sauce)
+COREAPI_BOTTOM = <font size="-1"> $(BUG_SUBMIT_LINE)\
+<br>For further API reference and developer documentation, \
+see <a href="$(DEV_DOCS_URL)" target="_blank">Java SE Documentation</a>. \
+That documentation contains more detailed, developer-targeted descriptions, \
+with conceptual overviews, definitions of terms, workarounds, \
+and working code examples.<br>\
+$(call CopyrightLine,$(COPYRIGHT_URL),$(FIRST_COPYRIGHT_YEAR),)\
+</font>
+
+# Common javadoc options used by all
+COMMON_JAVADOCFLAGS =					\
+                -XDignore.symbol.file=true              \
+		-quiet					\
+                -use					\
+                -keywords				\
+		$(ADDITIONAL_JAVADOCFLAGS)
+
+ifdef OPENJDK
+  ADDITIONAL_JAVADOCFLAGS =				\
+                -Xdocrootparent $(DOCS_BASE_URL)
+else
+  ADDITIONAL_JAVADOCFLAGS =
+endif
+
+# Draft used for non-fcs documents
+DRAFT_HEADER =
+ifneq ($(MILESTONE), fcs)
+    DRAFT_HEADER = <br><strong>DRAFT&nbsp;$(MILESTONE)-$(BUILD_NUMBER)</strong>
+    DRAFT_BOTTOM = <br><strong>DRAFT&nbsp;$(MILESTONE)-$(BUILD_NUMBER)</strong>
+    DRAFT_WINTITLE = $(BUILD_NUMBER)
+    # Early access top text (not used in FCS releases)
+    COREAPI_TOP_EARLYACCESS = \
+<div style="background-color: \#EEEEEE"> \
+<div style="padding: 6px; margin-top: 2px; margin-bottom: 6px; \
+margin-left: 6px; margin-right: 6px; text-align: justify; \
+font-size: 80%; font-family: Helvetica, Arial, sans-serif; \
+font-weight: normal;"> \
+Please note that the specifications and other information \
+contained herein are not final and are subject to change. \
+The information is being made available to you solely for purpose of \
+evaluation. \
+</div> </div>
+endif
+
+#################################################################
+
+#
+# CORE_PKGS environment variable has been moved to the following file
+#
+include CORE_PKGS.gmk
+
+#
+# Load environment variables for API package names that are not part of
+# the Java SE platform
+#
+include NON_CORE_PKGS.gmk
+
+#################################################################
+
+#
+# Default target is same as docs target, create core api and all others it can
+#
+
+all: docs
+docs: coredocs otherdocs
+
+#################################################################
+# Production Targets -- USE THESE TARGETS WHEN:
+#    a) You're generating docs outside of release engineering's
+#       standard control build.
+#    b) The docs will be pushed to the web and/or included in
+#       the downloaded doc bundle.
+#
+# See:  Notes.html#releaseTargets
+# Note: Spaces precede ifdef/ifndef indents. Tabs precede target commands (!)
+#
+
+sanitycheckcoredocs:
+	@$(ECHO) ""
+	@$(ECHO) "Building core api docs with these values:"
+	@$(ECHO) "    BUILD_NUMBER = $(BUILD_NUMBER)"
+	@$(ECHO) "    MILESTONE = $(MILESTONE)"
+	@$(ECHO) ""
+  ifeq ($(BUILD_NUMBER), b00)
+	@$(ECHO) "ERROR: Build number must be defined"
+	@$(ECHO) "MILESTONE is set to $(MILESTONE)"
+	@$(ECHO) ""
+	exit 1
+  endif
+
+#############################################################
+#
+# coredocs
+#
+COREAPI_DOCTITLE  = Java$(TRADEMARK) Platform, Standard Edition \
+$(JDK_MINOR_VERSION)<br>API Specification
+COREAPI_WINDOWTITLE  = Java Platform SE $(JDK_MINOR_VERSION)
+COREAPI_HEADER = \
+<strong>Java$(TRADEMARK)&nbsp;Platform<br>Standard&nbsp;Ed.&nbsp;$(JDK_MINOR_VERSION)</strong>
+
+# Java language specification cite
+TAG_JLS = jls:a:See <cite> \
+The Java&trade; Language Specification</cite>:
+
+# Overview file for core apis
+COREAPI_OVERVIEW = $(JDK_SHARE_CLASSES)/overview-core.html
+
+# The index.html, options, and packages files
+COREAPI_INDEX_FILE    = $(COREAPI_DOCSDIR)/index.html
+COREAPI_OPTIONS_FILE  = $(DOCSTMPDIR)/coredocs.options
+COREAPI_PACKAGES_FILE = $(DOCSTMPDIR)/coredocs.packages
+
+coredocs: $(COREAPI_INDEX_FILE)
+
+# Set relative location to core api document root
+$(COREAPI_INDEX_FILE): GET2DOCSDIR=..
+
+# Run javadoc if the index file is out of date or missing
+$(COREAPI_INDEX_FILE): $(COREAPI_OPTIONS_FILE) $(COREAPI_PACKAGES_FILE)
+	$(prep-javadoc)
+	$(call JavadocSummary,$(COREAPI_OPTIONS_FILE),$(COREAPI_PACKAGES_FILE))
+	$(JAVADOC_CMD) -d $(@D) \
+	  @$(COREAPI_OPTIONS_FILE) @$(COREAPI_PACKAGES_FILE)
+
+# Create file with javadoc options in it
+$(COREAPI_OPTIONS_FILE): $(COREAPI_OVERVIEW)
+	$(prep-target)
+	@($(call OptionOnly,$(COMMON_JAVADOCFLAGS))			; \
+	  $(call OptionPair,-sourcepath,$(RELEASEDOCS_SOURCEPATH))	; \
+	  $(call OptionPair,-encoding,ISO-8859-1)			; \
+	  $(call OptionPair,-tag,beaninfo:X)				; \
+	  $(call OptionPair,-tag,revised:X)				; \
+	  $(call OptionPair,-tag,since.unbundled:X)			; \
+	  $(call OptionPair,-tag,spec:X)				; \
+	  $(call OptionPair,-tag,specdefault:X)				; \
+	  $(call OptionPair,-tag,Note:X)				; \
+	  $(call OptionPair,-tag,ToDo:X)				; \
+          $(call OptionPair,-tag,$(TAG_JLS)) 				; \
+	  $(call OptionOnly,-splitIndex)				; \
+	  $(call OptionPair,-overview,$(COREAPI_OVERVIEW))		; \
+	  $(call OptionPair,-doctitle,$(COREAPI_DOCTITLE))		; \
+	  $(call OptionPair,-windowtitle,$(COREAPI_WINDOWTITLE) $(DRAFT_WINTITLE)) ;\
+	  $(call OptionPair,-header,$(COREAPI_HEADER)$(DRAFT_HEADER))	; \
+	  $(call OptionPair,-bottom,$(COREAPI_BOTTOM)$(DRAFT_BOTTOM))	; \
+        ) >> $@
+ifdef COREAPI_TOP_EARLYACCESS
+	@$(call OptionPair,-top,$(COREAPI_TOP_EARLYACCESS)) >> $@
+endif
+
+# Create a file with the package names in it
+$(COREAPI_PACKAGES_FILE): $(DIRECTORY_CACHE) $(call PackageDependencies,$(CORE_PKGS))
+	$(prep-target)
+	$(call PackageFilter,$(CORE_PKGS))
+
+#############################################################
+#
+# docletapidocs
+#
+
+ALL_OTHER_TARGETS += docletapidocs
+
+DOCLETAPI_DOCDIR       := $(JDK_API_DOCSDIR)/javadoc/doclet
+DOCLETAPI2COREAPI      := ../../$(JDKJRE2COREAPI)
+DOCLETAPI_DOCTITLE     := Doclet API
+DOCLETAPI_WINDOWTITLE  := Doclet API
+DOCLETAPI_HEADER       := <strong>Doclet API</strong>
+DOCLETAPI_BOTTOM       := $(call CommonTrademarkBottom,$(DOCLETAPI_FIRST_COPYRIGHT_YEAR))
+DOCLETAPI_GROUPNAME    := Packages
+DOCLETAPI_REGEXP       := com.sun.javadoc
+# DOCLETAPI_PKGS is located in NON_CORE_PKGS.gmk
+
+# The index.html, options, and packages files
+DOCLETAPI_INDEX_FILE    = $(DOCLETAPI_DOCDIR)/index.html
+DOCLETAPI_OPTIONS_FILE  = $(DOCSTMPDIR)/docletapi.options
+DOCLETAPI_PACKAGES_FILE = $(DOCSTMPDIR)/docletapi.packages
+
+docletapidocs: $(DOCLETAPI_INDEX_FILE)
+
+# Set relative location to core api document root
+$(DOCLETAPI_INDEX_FILE): GET2DOCSDIR=$(DOCLETAPI2COREAPI)/..
+
+# Run javadoc if the index file is out of date or missing
+$(DOCLETAPI_INDEX_FILE): $(DOCLETAPI_OPTIONS_FILE) $(DOCLETAPI_PACKAGES_FILE)
+	$(prep-javadoc)
+	$(call JavadocSummary,$(DOCLETAPI_OPTIONS_FILE),$(DOCLETAPI_PACKAGES_FILE))
+	$(JAVADOC_CMD) -d $(@D) \
+	  @$(DOCLETAPI_OPTIONS_FILE) @$(DOCLETAPI_PACKAGES_FILE)
+
+# Create file with javadoc options in it
+$(DOCLETAPI_OPTIONS_FILE):
+	$(prep-target)
+	@($(call OptionOnly,$(COMMON_JAVADOCFLAGS))			; \
+	  $(call OptionPair,-sourcepath,$(RELEASEDOCS_SOURCEPATH))	; \
+	  $(call OptionPair,-encoding,ascii)				; \
+	  $(call OptionOnly,-breakiterator)				; \
+	  $(call OptionPair,-doctitle,$(DOCLETAPI_DOCTITLE))		; \
+	  $(call OptionPair,-windowtitle,$(DOCLETAPI_WINDOWTITLE) $(DRAFT_WINTITLE));\
+	  $(call OptionPair,-header,$(DOCLETAPI_HEADER)$(DRAFT_HEADER))	; \
+	  $(call OptionPair,-bottom,$(DOCLETAPI_BOTTOM)$(DRAFT_BOTTOM))	; \
+	  $(call OptionTrip,-group,$(DOCLETAPI_GROUPNAME),$(DOCLETAPI_REGEXP)); \
+	  $(call OptionTrip,-linkoffline,$(DOCLETAPI2COREAPI),$(COREAPI_DOCSDIR)/); \
+        ) >> $@
+
+# Create a file with the package names in it
+$(DOCLETAPI_PACKAGES_FILE): $(DIRECTORY_CACHE) $(call PackageDependencies,$(DOCLETAPI_PKGS))
+	$(prep-target)
+	$(call PackageFilter,$(DOCLETAPI_PKGS))
+
+#############################################################
+#
+# tagletapidocs
+#
+
+ALL_OTHER_TARGETS += tagletapidocs
+TAGLETAPI_DOCDIR   := $(JDK_API_DOCSDIR)/javadoc/taglet
+TAGLETAPI2COREAPI  := ../../$(JDKJRE2COREAPI)
+TAGLETAPI_BOTTOM   := $(call CommonTrademarkBottom,$(TAGLETAPI_FIRST_COPYRIGHT_YEAR))
+# TAGLETAPI_FILE is located in NON_CORE_PKGS.gmk
+
+# Temporary directory (special generation rules)
+TAGLETAPI_TEMPDIR       = $(DOCSTMPDIR)/taglets_temp
+
+# The index.html, options, and packages files
+TAGLETAPI_INDEX_FILE    = $(TAGLETAPI_DOCDIR)/com/sun/tools/doclets/Taglet.html
+TAGLETAPI_OPTIONS_FILE  = $(DOCSTMPDIR)/tagletapi.options
+TAGLETAPI_PACKAGES_FILE = $(DOCSTMPDIR)/tagletapi.packages
+
+tagletapidocs: $(TAGLETAPI_INDEX_FILE)
+
+# Set relative location to core api document root
+$(TAGLETAPI_INDEX_FILE): GET2DOCSDIR=$(TAGLETAPI2COREAPI)/..
+
+# Run javadoc if the index file is out of date or missing
+$(TAGLETAPI_INDEX_FILE): $(TAGLETAPI_OPTIONS_FILE) $(TAGLETAPI_PACKAGES_FILE)
+	$(prep-javadoc)
+	$(RM) -r $(TAGLETAPI_TEMPDIR)
+	$(MKDIR) -p $(TAGLETAPI_TEMPDIR)
+	$(call JavadocSummary,$(TAGLETAPI_OPTIONS_FILE),$(TAGLETAPI_PACKAGES_FILE))
+	$(JAVADOC_CMD) -d $(TAGLETAPI_TEMPDIR) \
+	  @$(TAGLETAPI_OPTIONS_FILE) @$(TAGLETAPI_PACKAGES_FILE)
+	cp -r $(TAGLETAPI_TEMPDIR)/com $(@D)
+	cp $(TAGLETAPI_TEMPDIR)/stylesheet.css $(@D)
+	$(RM) -r $(TAGLETAPI_TEMPDIR)
+
+# Create file with javadoc options in it
+$(TAGLETAPI_OPTIONS_FILE):
+	$(prep-target)
+	@($(call OptionOnly,$(COMMON_JAVADOCFLAGS))			; \
+	  $(call OptionPair,-sourcepath,$(RELEASEDOCS_SOURCEPATH))	; \
+	  $(call OptionPair,-encoding,ascii)				; \
+	  $(call OptionOnly,-nonavbar)					; \
+          $(call OptionOnly,-noindex)                                   ; \
+	  $(call OptionPair,-bottom,$(TAGLETAPI_BOTTOM)$(DRAFT_BOTTOM))	; \
+	  $(call OptionTrip,-linkoffline,$(TAGLETAPI2COREAPI),$(COREAPI_DOCSDIR)/); \
+        ) >> $@
+
+# Create a file with the package names in it
+$(TAGLETAPI_PACKAGES_FILE): $(DIRECTORY_CACHE) $(call PackageDependencies,$(TAGLETAPI_PKGS))
+	$(prep-target)
+	$(call PackageFilter,$(TAGLETAPI_PKGS))
+	$(GREP) "$(TAGLETAPI_FILE)" $@ > $@.tmp
+	$(MV) $@.tmp $@
+
+#############################################################
+#
+# domapidocs
+#
+
+ALL_OTHER_TARGETS += domapidocs
+
+DOMAPI_DOCDIR       := $(JRE_API_DOCSDIR)/plugin/dom
+DOMAPI2COREAPI      := ../../$(JDKJRE2COREAPI)
+DOMAPI_DOCTITLE     := Common DOM API
+DOMAPI_WINDOWTITLE  := Common DOM API
+DOMAPI_HEADER       := <strong>Common DOM API</strong>
+DOMAPI_BOTTOM       := $(call CommonTrademarkBottom,$(DOMAPI_FIRST_COPYRIGHT_YEAR))
+DOMAPI_GROUPNAME    := Packages
+DOMAPI_REGEXP       := com.sun.java.browser.dom:org.w3c.dom*
+# DOMAPI_PKGS is located in NON_CORE_PKGS.gmk
+
+# The index.html, options, and packages files
+DOMAPI_INDEX_FILE    = $(DOMAPI_DOCDIR)/index.html
+DOMAPI_OPTIONS_FILE  = $(DOCSTMPDIR)/domapi.options
+DOMAPI_PACKAGES_FILE = $(DOCSTMPDIR)/domapi.packages
+
+domapidocs: $(DOMAPI_INDEX_FILE)
+
+# Set relative location to core api document root
+$(DOMAPI_INDEX_FILE): GET2DOCSDIR=$(DOMAPI2COREAPI)/..
+
+# Run javadoc if the index file is out of date or missing
+$(DOMAPI_INDEX_FILE): $(DOMAPI_OPTIONS_FILE) $(DOMAPI_PACKAGES_FILE)
+	$(prep-javadoc)
+	$(call JavadocSummary,$(DOMAPI_OPTIONS_FILE),$(DOMAPI_PACKAGES_FILE))
+	$(JAVADOC_CMD) -d $(@D) \
+	  @$(DOMAPI_OPTIONS_FILE) @$(DOMAPI_PACKAGES_FILE)
+
+# Create file with javadoc options in it
+$(DOMAPI_OPTIONS_FILE):
+	$(prep-target)
+	@($(call OptionOnly,$(COMMON_JAVADOCFLAGS))			; \
+	  $(call OptionPair,-sourcepath,$(RELEASEDOCS_SOURCEPATH))	; \
+	  $(call OptionPair,-encoding,ascii)				; \
+	  $(call OptionOnly,-splitIndex)				; \
+	  $(call OptionPair,-doctitle,$(DOMAPI_DOCTITLE))		; \
+	  $(call OptionPair,-windowtitle,$(DOMAPI_WINDOWTITLE) $(DRAFT_WINTITLE));\
+	  $(call OptionPair,-header,$(DOMAPI_HEADER)$(DRAFT_HEADER))	; \
+	  $(call OptionPair,-bottom,$(DOMAPI_BOTTOM)$(DRAFT_BOTTOM))	; \
+	  $(call OptionTrip,-group,$(DOMAPI_GROUPNAME),$(DOMAPI_REGEXP)); \
+	  $(call OptionTrip,-linkoffline,$(DOMAPI2COREAPI),$(COREAPI_DOCSDIR)/); \
+        ) >> $@
+
+# Create a file with the package names in it
+$(DOMAPI_PACKAGES_FILE): $(DIRECTORY_CACHE) $(call PackageDependencies,$(DOMAPI_PKGS))
+	$(prep-target)
+	$(call PackageFilter,$(DOMAPI_PKGS))
+
+#############################################################
+#
+# jpdadocs
+#
+
+ALL_OTHER_TARGETS += jpdadocs
+
+jpdadocs: jdidocs jdwpdocs jvmtidocs
+
+#############################################################
+#
+# jdidocs
+#
+
+ALL_OTHER_TARGETS += jdidocs
+
+JDI_DOCDIR      := $(JDK_API_DOCSDIR)/jpda/jdi
+JDI2COREAPI     := ../../$(JDKJRE2COREAPI)
+JDI_DOCTITLE    := Java$(TRADEMARK) Debug Interface
+JDI_WINDOWTITLE := Java Debug Interface
+JDI_HEADER      := <strong>Java Debug Interface</strong>
+JDI_BOTTOM      := $(call CommonBottom,$(JDI_FIRST_COPYRIGHT_YEAR))
+JDI_OVERVIEW    := $(JDK_SHARE_CLASSES)/jdi-overview.html
+# JDI_PKGS is located in NON_CORE_PKGS.gmk
+
+# The index.html, options, and packages files
+JDI_INDEX_FILE    = $(JDI_DOCDIR)/index.html
+JDI_OPTIONS_FILE  = $(DOCSTMPDIR)/jdi.options
+JDI_PACKAGES_FILE = $(DOCSTMPDIR)/jdi.packages
+
+jdidocs: $(JDI_INDEX_FILE)
+
+# Set relative location to core api document root
+$(JDI_INDEX_FILE): GET2DOCSDIR=$(JDI2COREAPI)/..
+
+# Run javadoc if the index file is out of date or missing
+$(JDI_INDEX_FILE): $(JDI_OPTIONS_FILE) $(JDI_PACKAGES_FILE)
+	$(prep-javadoc)
+	$(call JavadocSummary,$(JDI_OPTIONS_FILE),$(JDI_PACKAGES_FILE))
+	$(JAVADOC_CMD) -d $(@D) \
+	  @$(JDI_OPTIONS_FILE) @$(JDI_PACKAGES_FILE)
+
+# Create file with javadoc options in it
+$(JDI_OPTIONS_FILE): $(JDI_OVERVIEW)
+	$(prep-target)
+	@($(call OptionOnly,$(COMMON_JAVADOCFLAGS))			; \
+	  $(call OptionPair,-sourcepath,$(RELEASEDOCS_SOURCEPATH))	; \
+	  $(call OptionPair,-encoding,ascii)				; \
+	  $(call OptionPair,-overview,$(JDI_OVERVIEW))			; \
+	  $(call OptionPair,-doctitle,$(JDI_DOCTITLE))			; \
+	  $(call OptionPair,-windowtitle,$(JDI_WINDOWTITLE) $(DRAFT_WINTITLE)); \
+	  $(call OptionPair,-header,$(JDI_HEADER)$(DRAFT_HEADER))	; \
+	  $(call OptionPair,-bottom,$(JDI_BOTTOM)$(DRAFT_BOTTOM))	; \
+	  $(call OptionTrip,-linkoffline,$(JDI2COREAPI),$(COREAPI_DOCSDIR)/); \
+        ) >> $@
+
+# Create a file with the package names in it
+$(JDI_PACKAGES_FILE): $(DIRECTORY_CACHE) $(call PackageDependencies,$(JDI_PKGS))
+	$(prep-target)
+	$(call PackageFilter,$(JDI_PKGS))
+
+#############################################################
+#
+# jdwpdocs
+#
+
+ALL_OTHER_TARGETS += jdwpdocs
+
+JDWP_DOCDIR     = $(PLATFORM_DOCSDIR)/jpda/jdwp
+
+jdwpdocs: $(JDWP_DOCDIR)/jdwp-protocol.html
+$(JDWP_DOCDIR)/jdwp-protocol.html : $(JDK_OUTPUTDIR)/gensrc_jdwp_doc/jdwp-protocol.html
+	$(MKDIR) -p $(@D)
+	$(RM) $@
+	$(CP) $< $@
+
+#############################################################
+#
+# jvmtidocs
+#
+
+ALL_OTHER_TARGETS += jvmtidocs
+
+JVMTI_DOCDIR      = $(PLATFORM_DOCSDIR)/jvmti
+JVMTI_HTML        = $(HOTSPOT_DIST)/docs/platform/jvmti/jvmti.html
+
+jvmtidocs:  $(JVMTI_DOCDIR)/jvmti.html
+$(JVMTI_DOCDIR)/jvmti.html:
+	@$(prep-javadoc)
+	@if [ -f $(JVMTI_HTML) ] ; then		                           \
+	  $(ECHO) "$(CP) $(JVMTI_HTML) $@";                 	           \
+	  $(CP) $(JVMTI_HTML) $@; 	                 	           \
+	else 						                   \
+	  $(ECHO) "WARNING: Generated file does not exist: $(JVMTI_HTML)"; \
+	fi
+
+#############################################################
+#
+# jaasdocs
+#
+
+ALL_OTHER_TARGETS += jaasdocs
+
+JAAS_DOCDIR	 := $(JRE_API_DOCSDIR)/security/jaas/spec
+JAAS2COREAPI     := ../../../$(JDKJRE2COREAPI)
+JAAS_DOCTITLE    := Java$(TRADEMARK) Authentication and Authorization Service
+JAAS_WINDOWTITLE := Java Authentication and Authorization Service
+JAAS_HEADER      := <strong>Java Authentication and Authorization Service</strong>
+JAAS_BOTTOM      := $(call CommonBottom,$(JAAS_FIRST_COPYRIGHT_YEAR))
+# JAAS_PKGS is located in NON_CORE_PKGS.gmk
+JAAS_OVERVIEW    := $(JDK_SHARE_CLASSES)/com/sun/security/auth/jaas-overview.html
+
+# The index.html, options, and packages files
+JAAS_INDEX_FILE    = $(JAAS_DOCDIR)/index.html
+JAAS_OPTIONS_FILE  = $(DOCSTMPDIR)/jaas.options
+JAAS_PACKAGES_FILE = $(DOCSTMPDIR)/jaas.packages
+
+jaasdocs: $(JAAS_INDEX_FILE)
+
+# Set relative location to core api document root
+$(JAAS_INDEX_FILE): GET2DOCSDIR=$(JAAS2COREAPI)/..
+
+# Run javadoc if the index file is out of date or missing
+$(JAAS_INDEX_FILE): $(JAAS_OPTIONS_FILE) $(JAAS_PACKAGES_FILE)
+	$(prep-javadoc)
+	$(call JavadocSummary,$(JAAS_OPTIONS_FILE),$(JAAS_PACKAGES_FILE))
+	$(JAVADOC_CMD) -d $(@D) \
+	  @$(JAAS_OPTIONS_FILE) @$(JAAS_PACKAGES_FILE)
+
+# Create file with javadoc options in it
+$(JAAS_OPTIONS_FILE): $(JAAS_OVERVIEW)
+	$(prep-target)
+	@($(call OptionOnly,$(COMMON_JAVADOCFLAGS))			; \
+	  $(call OptionPair,-sourcepath,$(RELEASEDOCS_SOURCEPATH))	; \
+	  $(call OptionPair,-encoding,ascii)				; \
+	  $(call OptionPair,-overview,$(JAAS_OVERVIEW))			; \
+	  $(call OptionPair,-doctitle,$(JAAS_DOCTITLE))			; \
+	  $(call OptionPair,-windowtitle,$(JAAS_WINDOWTITLE) $(DRAFT_WINTITLE)); \
+	  $(call OptionPair,-header,$(JAAS_HEADER)$(DRAFT_HEADER))	; \
+	  $(call OptionPair,-bottom,$(JAAS_BOTTOM)$(DRAFT_BOTTOM))	; \
+	  $(call OptionTrip,-linkoffline,$(JAAS2COREAPI),$(COREAPI_DOCSDIR)/); \
+        ) >> $@
+
+# Create a file with the package names in it
+$(JAAS_PACKAGES_FILE): $(DIRECTORY_CACHE) $(call PackageDependencies,$(JAAS_PKGS))
+	$(prep-target)
+	$(call PackageFilter,$(JAAS_PKGS))
+
+#############################################################
+#
+# jgssdocs
+#
+
+ALL_OTHER_TARGETS += jgssdocs
+
+JGSS_DOCDIR	 := $(JRE_API_DOCSDIR)/security/jgss/spec
+JGSS2COREAPI     := ../../../$(JDKJRE2COREAPI)
+JGSS_DOCTITLE    := Java$(TRADEMARK) GSS-API Utilities
+JGSS_WINDOWTITLE := Java GSS-API Utilities
+JGSS_HEADER      := <strong>Java GSS-API Utilities</strong>
+JGSS_BOTTOM      := $(call CommonBottom,$(JGSS_FIRST_COPYRIGHT_YEAR))
+JGSS_OVERVIEW    := $(JDK_SHARE_CLASSES)/com/sun/security/jgss/jgss-overview.html
+# JGSS_PKGS is located in NON_CORE_PKGS.gmk
+
+# The index.html, options, and packages files
+JGSS_INDEX_FILE    = $(JGSS_DOCDIR)/index.html
+JGSS_OPTIONS_FILE  = $(DOCSTMPDIR)/jgss.options
+JGSS_PACKAGES_FILE = $(DOCSTMPDIR)/jgss.packages
+
+jgssdocs: $(JGSS_INDEX_FILE)
+
+# Set relative location to core api document root
+$(JGSS_INDEX_FILE): GET2DOCSDIR=$(JGSS2COREAPI)/..
+
+# Run javadoc if the index file is out of date or missing
+$(JGSS_INDEX_FILE): $(JGSS_OPTIONS_FILE) $(JGSS_PACKAGES_FILE)
+	$(prep-javadoc)
+	$(call JavadocSummary,$(JGSS_OPTIONS_FILE),$(JGSS_PACKAGES_FILE))
+	$(JAVADOC_CMD) -d $(@D) \
+	  @$(JGSS_OPTIONS_FILE) @$(JGSS_PACKAGES_FILE)
+
+# Create file with javadoc options in it
+$(JGSS_OPTIONS_FILE): $(JGSS_OVERVIEW)
+	$(prep-target)
+	@($(call OptionOnly,$(COMMON_JAVADOCFLAGS))			; \
+	  $(call OptionPair,-sourcepath,$(RELEASEDOCS_SOURCEPATH))	; \
+	  $(call OptionPair,-encoding,ascii)				; \
+	  $(call OptionOnly,-nodeprecatedlist)				; \
+	  $(call OptionPair,-overview,$(JGSS_OVERVIEW))			; \
+	  $(call OptionPair,-doctitle,$(JGSS_DOCTITLE))			; \
+	  $(call OptionPair,-windowtitle,$(JGSS_WINDOWTITLE) $(DRAFT_WINTITLE)); \
+	  $(call OptionPair,-header,$(JGSS_HEADER)$(DRAFT_HEADER))	; \
+	  $(call OptionPair,-bottom,$(JGSS_BOTTOM)$(DRAFT_BOTTOM))	; \
+	  $(call OptionTrip,-linkoffline,$(JGSS2COREAPI),$(COREAPI_DOCSDIR)/); \
+        ) >> $@
+
+# Create a file with the package names in it
+$(JGSS_PACKAGES_FILE): $(DIRECTORY_CACHE) $(call PackageDependencies,$(JGSS_PKGS))
+	$(prep-target)
+	$(call PackageFilter,$(JGSS_PKGS))
+
+#############################################################
+#
+# smartcardiodocs
+#
+
+ALL_OTHER_TARGETS += smartcardiodocs
+
+SMARTCARDIO_DOCDIR	:= $(JRE_API_DOCSDIR)/security/smartcardio/spec
+SMARTCARDIO2COREAPI     := ../../../$(JDKJRE2COREAPI)
+SMARTCARDIO_DOCTITLE    := Java$(TRADEMARK) Smart Card I/O
+SMARTCARDIO_WINDOWTITLE := Java Smart Card I/O
+SMARTCARDIO_HEADER      := <strong>Java Smart Card I/O</strong>
+SMARTCARDIO_BOTTOM      := $(call CommonBottom,$(SMARTCARDIO_FIRST_COPYRIGHT_YEAR))
+# SMARTCARDIO_PKGS is located in NON_CORE_PKGS.gmk
+
+# The index.html, options, and packages files
+SMARTCARDIO_INDEX_FILE    = $(SMARTCARDIO_DOCDIR)/index.html
+SMARTCARDIO_OPTIONS_FILE  = $(DOCSTMPDIR)/smartcardio.options
+SMARTCARDIO_PACKAGES_FILE = $(DOCSTMPDIR)/smartcardio.packages
+
+smartcardiodocs: $(SMARTCARDIO_INDEX_FILE)
+
+# Set relative location to core api document root
+$(SMARTCARDIO_INDEX_FILE): GET2DOCSDIR=$(SMARTCARDIO2COREAPI)/..
+
+# Run javadoc if the index file is out of date or missing
+$(SMARTCARDIO_INDEX_FILE): $(SMARTCARDIO_OPTIONS_FILE) $(SMARTCARDIO_PACKAGES_FILE)
+	$(prep-javadoc)
+	$(call JavadocSummary,$(SMARTCARDIO_OPTIONS_FILE),$(SMARTCARDIO_PACKAGES_FILE))
+	$(JAVADOC_CMD) -d $(@D) \
+	  @$(SMARTCARDIO_OPTIONS_FILE) @$(SMARTCARDIO_PACKAGES_FILE)
+
+# Create file with javadoc options in it
+$(SMARTCARDIO_OPTIONS_FILE):
+	$(prep-target)
+	@($(call OptionOnly,$(COMMON_JAVADOCFLAGS))			; \
+	  $(call OptionPair,-sourcepath,$(RELEASEDOCS_SOURCEPATH))	; \
+	  $(call OptionPair,-encoding,ascii)				; \
+	  $(call OptionOnly,-nodeprecatedlist)				; \
+	  $(call OptionPair,-doctitle,$(SMARTCARDIO_DOCTITLE))		; \
+	  $(call OptionPair,-windowtitle,$(SMARTCARDIO_WINDOWTITLE) $(DRAFT_WINTITLE));\
+	  $(call OptionPair,-header,$(SMARTCARDIO_HEADER)$(DRAFT_HEADER)); \
+	  $(call OptionPair,-bottom,$(SMARTCARDIO_BOTTOM)$(DRAFT_BOTTOM)); \
+	  $(call OptionTrip,-linkoffline,$(SMARTCARDIO2COREAPI),$(COREAPI_DOCSDIR)/); \
+        ) >> $@
+
+# Create a file with the package names in it
+$(SMARTCARDIO_PACKAGES_FILE): $(DIRECTORY_CACHE) $(call PackageDependencies,$(SMARTCARDIO_PKGS))
+	$(prep-target)
+	$(call PackageFilter,$(SMARTCARDIO_PKGS))
+
+#############################################################
+#
+# httpserverdocs
+#
+
+ALL_OTHER_TARGETS += httpserverdocs
+
+HTTPSERVER_DOCDIR      := $(JRE_API_DOCSDIR)/net/httpserver/spec
+HTTPSERVER2COREAPI     := ../../../$(JDKJRE2COREAPI)
+HTTPSERVER_DOCTITLE    := Java$(TRADEMARK) HTTP Server
+HTTPSERVER_WINDOWTITLE := Java HTTP Server
+HTTPSERVER_HEADER      := <strong>Java HTTP Server</strong>
+HTTPSERVER_BOTTOM      := $(call CommonBottom,$(HTTPSERVER_FIRST_COPYRIGHT_YEAR))
+# HTTPSERVER_PKGS is located in NON_CORE_PKGS.gmk
+
+HTTPSERVER_INDEX_HTML    = $(HTTPSERVER_DOCDIR)/index.html
+HTTPSERVER_OPTIONS_FILE  = $(DOCSTMPDIR)/httpserver.options
+HTTPSERVER_PACKAGES_FILE = $(DOCSTMPDIR)/httpserver.packages
+
+httpserverdocs: $(HTTPSERVER_INDEX_HTML)
+
+# Set relative location to core api document root
+$(HTTPSERVER_INDEX_HTML): GET2DOCSDIR=$(HTTPSERVER2COREAPI)/..
+
+# Run javadoc if the index file is out of date or missing
+$(HTTPSERVER_INDEX_HTML): $(HTTPSERVER_OPTIONS_FILE) $(HTTPSERVER_PACKAGES_FILE)
+	$(prep-javadoc)
+	$(call JavadocSummary,$(HTTPSERVER_OPTIONS_FILE),$(HTTPSERVER_PACKAGES_FILE))
+	$(JAVADOC_CMD) -d $(@D) \
+	  @$(HTTPSERVER_OPTIONS_FILE) @$(HTTPSERVER_PACKAGES_FILE)
+
+# Create file with javadoc options in it
+$(HTTPSERVER_OPTIONS_FILE):
+	$(prep-target)
+	@($(call OptionOnly,$(COMMON_JAVADOCFLAGS))			; \
+	  $(call OptionPair,-sourcepath,$(RELEASEDOCS_SOURCEPATH))	; \
+	  $(call OptionPair,-encoding,ascii)				; \
+	  $(call OptionOnly,-nodeprecatedlist)				; \
+	  $(call OptionPair,-doctitle,$(HTTPSERVER_DOCTITLE))		; \
+	  $(call OptionPair,-windowtitle,$(HTTPSERVER_WINDOWTITLE) $(DRAFT_WINTITLE));\
+	  $(call OptionPair,-header,$(HTTPSERVER_HEADER)$(DRAFT_HEADER)); \
+	  $(call OptionPair,-bottom,$(HTTPSERVER_BOTTOM)$(DRAFT_BOTTOM)); \
+	  $(call OptionTrip,-linkoffline,$(HTTPSERVER2COREAPI),$(COREAPI_DOCSDIR)/); \
+        ) >> $@
+
+# Create a file with the package names in it
+$(HTTPSERVER_PACKAGES_FILE): $(DIRECTORY_CACHE) $(call PackageDependencies,$(HTTPSERVER_PKGS))
+	$(prep-target)
+	$(call PackageFilter,$(HTTPSERVER_PKGS))
+
+#############################################################
+#
+# mgmtdocs
+#
+
+ALL_OTHER_TARGETS += mgmtdocs
+
+MGMT_DOCDIR	 := $(JRE_API_DOCSDIR)/management/extension
+MGMT2COREAPI     := ../../$(JDKJRE2COREAPI)
+JVM_MIB_NAME     := JVM-MANAGEMENT-MIB.mib
+JVM_MIB_SRC      := $(CLOSED_SRC)/share/classes/sun/management/snmp/$(JVM_MIB_NAME)
+MGMT_DOCTITLE    := Monitoring and Management Interface for the Java$(TRADEMARK) Platform
+MGMT_WINDOWTITLE := Monitoring and Management Interface for the Java Platform
+MGMT_HEADER      := <strong>Monitoring and Management Interface for the Java Platform</strong>
+MGMT_BOTTOM      := $(call CommonBottom,$(MGMT_FIRST_COPYRIGHT_YEAR))
+MGMT_OVERVIEW    := $(JDK_SHARE_CLASSES)/com/sun/management/mgmt-overview.html
+# MGMT_PKGS is located in NON_CORE_PKGS.gmk
+
+# The index.html, options, and packages files
+MGMT_INDEX_FILE    = $(MGMT_DOCDIR)/index.html
+MGMT_OPTIONS_FILE  = $(DOCSTMPDIR)/mgmt.options
+MGMT_PACKAGES_FILE = $(DOCSTMPDIR)/mgmt.packages
+
+mgmtdocs: $(MGMT_INDEX_FILE)
+
+# Set relative location to core api document root
+$(MGMT_INDEX_FILE): GET2DOCSDIR=$(MGMT2COREAPI)/..
+
+# Run javadoc if the index file is out of date or missing
+$(MGMT_INDEX_FILE): $(MGMT_OPTIONS_FILE) $(MGMT_PACKAGES_FILE)
+	$(prep-javadoc)
+	@if [ -f $(JVM_MIB_SRC) ] ; then 				\
+	  $(ECHO) "$(CP) $(JVM_MIB_SRC) $(@D)/.."; 			\
+	  $(CP) $(JVM_MIB_SRC) $(@D)/.. ; 				\
+	else 								\
+	  $(ECHO) "WARNING: File $(JVM_MIB_NAME) not available."; 	\
+	fi
+	$(call JavadocSummary,$(MGMT_OPTIONS_FILE),$(MGMT_PACKAGES_FILE))
+	$(JAVADOC_CMD) -d $(@D) \
+	  @$(MGMT_OPTIONS_FILE) @$(MGMT_PACKAGES_FILE)
+
+# Create file with javadoc options in it
+$(MGMT_OPTIONS_FILE): $(MGMT_OVERVIEW)
+	$(prep-target)
+	@($(call OptionOnly,$(COMMON_JAVADOCFLAGS))			; \
+	  $(call OptionPair,-sourcepath,$(RELEASEDOCS_SOURCEPATH))	; \
+	  $(call OptionPair,-encoding,ascii)				; \
+	  $(call OptionOnly,-nodeprecatedlist)				; \
+	  $(call OptionPair,-overview,$(MGMT_OVERVIEW))			; \
+	  $(call OptionPair,-doctitle,$(MGMT_DOCTITLE))			; \
+	  $(call OptionPair,-windowtitle,$(MGMT_WINDOWTITLE) $(DRAFT_WINTITLE)); \
+	  $(call OptionPair,-header,$(MGMT_HEADER)$(DRAFT_HEADER))	; \
+	  $(call OptionPair,-bottom,$(MGMT_BOTTOM)$(DRAFT_BOTTOM))	; \
+	  $(call OptionTrip,-linkoffline,$(MGMT2COREAPI),$(COREAPI_DOCSDIR)/); \
+        ) >> $@
+
+# Create a file with the package names in it
+$(MGMT_PACKAGES_FILE): $(DIRECTORY_CACHE) $(call PackageDependencies,$(MGMT_PKGS))
+	$(prep-target)
+	$(call PackageFilter,$(MGMT_PKGS))
+
+#############################################################
+#
+# attachdocs
+#
+
+ALL_OTHER_TARGETS += attachdocs
+
+ATTACH_DOCDIR      := $(JDK_API_DOCSDIR)/attach/spec
+ATTACH2COREAPI     := ../../$(JDKJRE2COREAPI)
+ATTACH_DOCTITLE    := Attach API
+ATTACH_WINDOWTITLE := Attach API
+ATTACH_HEADER      := <strong>Attach API</strong>
+ATTACH_BOTTOM      := $(call CommonBottom,$(ATTACH_FIRST_COPYRIGHT_YEAR))
+# ATTACH_PKGS is located in NON_CORE_PKGS.gmk
+
+ATTACH_INDEX_HTML    = $(ATTACH_DOCDIR)/index.html
+ATTACH_OPTIONS_FILE  = $(DOCSTMPDIR)/attach.options
+ATTACH_PACKAGES_FILE = $(DOCSTMPDIR)/attach.packages
+
+attachdocs: $(ATTACH_INDEX_HTML)
+
+# Set relative location to core api document root
+$(ATTACH_INDEX_HTML): GET2DOCSDIR=$(ATTACH2COREAPI)/..
+
+# Run javadoc if the index file is out of date or missing
+$(ATTACH_INDEX_HTML): $(ATTACH_OPTIONS_FILE) $(ATTACH_PACKAGES_FILE)
+	$(prep-javadoc)
+	$(call JavadocSummary,$(ATTACH_OPTIONS_FILE),$(ATTACH_PACKAGES_FILE))
+	$(JAVADOC_CMD) -d $(@D) \
+	  @$(ATTACH_OPTIONS_FILE) @$(ATTACH_PACKAGES_FILE)
+
+# Create file with javadoc options in it
+$(ATTACH_OPTIONS_FILE):
+	$(prep-target)
+	@($(call OptionOnly,$(COMMON_JAVADOCFLAGS))			; \
+	  $(call OptionPair,-sourcepath,$(RELEASEDOCS_SOURCEPATH))	; \
+	  $(call OptionPair,-encoding,ascii)				; \
+	  $(call OptionOnly,-nodeprecatedlist)				; \
+	  $(call OptionPair,-doctitle,$(ATTACH_DOCTITLE))		; \
+	  $(call OptionPair,-windowtitle,$(ATTACH_WINDOWTITLE) $(DRAFT_WINTITLE));\
+	  $(call OptionPair,-header,$(ATTACH_HEADER)$(DRAFT_HEADER))	; \
+	  $(call OptionPair,-bottom,$(ATTACH_BOTTOM)$(DRAFT_BOTTOM))	; \
+	  $(call OptionTrip,-linkoffline,$(ATTACH2COREAPI),$(COREAPI_DOCSDIR)/); \
+        ) >> $@
+
+# Create a file with the package names in it
+$(ATTACH_PACKAGES_FILE): $(DIRECTORY_CACHE) $(call PackageDependencies,$(ATTACH_PKGS))
+	$(prep-target)
+	$(call PackageFilter,$(ATTACH_PKGS))
+
+#############################################################
+#
+# jconsoledocs
+#
+
+ALL_OTHER_TARGETS += jconsoledocs
+
+JCONSOLE_DOCDIR      := $(JDK_API_DOCSDIR)/jconsole/spec
+JCONSOLE2COREAPI     := ../../$(JDKJRE2COREAPI)
+JCONSOLE_DOCTITLE    := JConsole API
+JCONSOLE_WINDOWTITLE := JConsole API
+JCONSOLE_HEADER      := <strong>JConsole API</strong>
+JCONSOLE_BOTTOM      := $(call CommonBottom,$(JCONSOLE_FIRST_COPYRIGHT_YEAR))
+# JCONSOLE_PKGS is located in NON_CORE_PKGS.gmk
+
+JCONSOLE_INDEX_HTML    = $(JCONSOLE_DOCDIR)/index.html
+JCONSOLE_OPTIONS_FILE  = $(DOCSTMPDIR)/jconsole.options
+JCONSOLE_PACKAGES_FILE = $(DOCSTMPDIR)/jconsole.packages
+
+jconsoledocs: $(JCONSOLE_INDEX_HTML)
+
+# Set relative location to core api document root
+$(JCONSOLE_INDEX_HTML): GET2DOCSDIR=$(JCONSOLE2COREAPI)/..
+
+# Run javadoc if the index file is out of date or missing
+$(JCONSOLE_INDEX_HTML): $(JCONSOLE_OPTIONS_FILE) $(JCONSOLE_PACKAGES_FILE)
+	$(prep-javadoc)
+	$(call JavadocSummary,$(JCONSOLE_OPTIONS_FILE),$(JCONSOLE_PACKAGES_FILE))
+	$(JAVADOC_CMD) -d $(@D) \
+	  @$(JCONSOLE_OPTIONS_FILE) @$(JCONSOLE_PACKAGES_FILE)
+
+# Create file with javadoc options in it
+$(JCONSOLE_OPTIONS_FILE):
+	$(prep-target)
+	@($(call OptionOnly,$(COMMON_JAVADOCFLAGS))			; \
+	  $(call OptionPair,-sourcepath,$(RELEASEDOCS_SOURCEPATH))	; \
+	  $(call OptionPair,-encoding,ascii)				; \
+	  $(call OptionOnly,-nodeprecatedlist)				; \
+	  $(call OptionPair,-doctitle,$(JCONSOLE_DOCTITLE))		; \
+	  $(call OptionPair,-windowtitle,$(JCONSOLE_WINDOWTITLE) $(DRAFT_WINTITLE));\
+	  $(call OptionPair,-header,$(JCONSOLE_HEADER)$(DRAFT_HEADER))	; \
+	  $(call OptionPair,-bottom,$(JCONSOLE_BOTTOM)$(DRAFT_BOTTOM))	; \
+	  $(call OptionTrip,-linkoffline,$(JCONSOLE2COREAPI),$(COREAPI_DOCSDIR)/); \
+        ) >> $@
+
+# Create a file with the package names in it
+$(JCONSOLE_PACKAGES_FILE): $(DIRECTORY_CACHE) $(call PackageDependencies,$(JCONSOLE_PKGS))
+	$(prep-target)
+	$(call PackageFilter,$(JCONSOLE_PKGS))
+
+#############################################################
+#
+# treeapidocs
+#
+
+ALL_OTHER_TARGETS += treeapidocs
+
+TREEAPI_DOCDIR       := $(JDK_API_DOCSDIR)/javac/tree
+TREEAPI2COREAPI      := ../../$(JDKJRE2COREAPI)
+TREEAPI_DOCTITLE     := Compiler Tree API
+TREEAPI_WINDOWTITLE  := Compiler Tree API
+TREEAPI_HEADER       := <strong>Compiler Tree API</strong>
+TREEAPI_BOTTOM       := $(call CommonBottom,$(TREEAPI_FIRST_COPYRIGHT_YEAR))
+TREEAPI_GROUPNAME    := Packages
+TREEAPI_REGEXP       := com.sun.source.*
+# TREEAPI_PKGS is located in NON_CORE_PKGS.gmk
+
+TREEAPI_INDEX_HTML    = $(TREEAPI_DOCDIR)/index.html
+TREEAPI_OPTIONS_FILE  = $(DOCSTMPDIR)/treeapi.options
+TREEAPI_PACKAGES_FILE = $(DOCSTMPDIR)/treeapi.packages
+
+treeapidocs: $(TREEAPI_INDEX_HTML)
+
+# Set relative location to core api document root
+$(TREEAPI_INDEX_HTML): GET2DOCSDIR=$(TREEAPI2COREAPI)/..
+
+# Run javadoc if the index file is out of date or missing
+$(TREEAPI_INDEX_HTML): $(TREEAPI_OPTIONS_FILE) $(TREEAPI_PACKAGES_FILE)
+	$(prep-javadoc)
+	$(call JavadocSummary,$(TREEAPI_OPTIONS_FILE),$(TREEAPI_PACKAGES_FILE))
+	$(JAVADOC_CMD) -d $(@D) \
+	  @$(TREEAPI_OPTIONS_FILE) @$(TREEAPI_PACKAGES_FILE)
+
+# Create file with javadoc options in it
+$(TREEAPI_OPTIONS_FILE):
+	$(prep-target)
+	@($(call OptionOnly,$(COMMON_JAVADOCFLAGS))			; \
+	  $(call OptionPair,-sourcepath,$(RELEASEDOCS_SOURCEPATH))	; \
+	  $(call OptionPair,-encoding,ascii)				; \
+	  $(call OptionPair,-doctitle,$(TREEAPI_DOCTITLE))		; \
+	  $(call OptionPair,-windowtitle,$(TREEAPI_WINDOWTITLE) $(DRAFT_WINTITLE));\
+	  $(call OptionPair,-header,$(TREEAPI_HEADER)$(DRAFT_HEADER))	; \
+          $(call OptionPair,-tag,$(TAG_JLS)) 				; \
+	  $(call OptionPair,-bottom,$(TREEAPI_BOTTOM)$(DRAFT_BOTTOM))	; \
+	  $(call OptionTrip,-group,$(TREEAPI_GROUPNAME),$(TREEAPI_REGEXP)); \
+	  $(call OptionTrip,-linkoffline,$(TREEAPI2COREAPI),$(COREAPI_DOCSDIR)/); \
+        ) >> $@
+
+# Create a file with the package names in it
+$(TREEAPI_PACKAGES_FILE): $(DIRECTORY_CACHE) $(call PackageDependencies,$(TREEAPI_PKGS))
+	$(prep-target)
+	$(call PackageFilter,$(TREEAPI_PKGS))
+
+#############################################################
+#
+# sctpdocs
+#
+
+ALL_OTHER_TARGETS += sctpdocs
+
+SCTPAPI_DOCDIR      := $(JRE_API_DOCSDIR)/nio/sctp/spec
+SCTPAPI2COREAPI     := ../../../$(JDKJRE2COREAPI)
+SCTPAPI_DOCTITLE    := SCTP API
+SCTPAPI_WINDOWTITLE := SCTP API
+SCTPAPI_HEADER      := <strong>SCTP API</strong>
+SCTPAPI_BOTTOM      := $(call CommonBottom,$(SCTPAPI_FIRST_COPYRIGHT_YEAR))
+# SCTPAPI_PKGS is located in NON_CORE_PKGS.gmk
+
+SCTPAPI_INDEX_HTML    = $(SCTPAPI_DOCDIR)/index.html
+SCTPAPI_OPTIONS_FILE  = $(DOCSTMPDIR)/sctp.options
+SCTPAPI_PACKAGES_FILE = $(DOCSTMPDIR)/sctp.packages
+
+sctpdocs: $(SCTPAPI_INDEX_HTML)
+
+# Set relative location to core api document root
+$(SCTPAPI_INDEX_HTML): GET2DOCSDIR=$(SCTPAPI2COREAPI)/..
+
+# Run javadoc if the index file is out of date or missing
+$(SCTPAPI_INDEX_HTML): $(SCTPAPI_OPTIONS_FILE) $(SCTPAPI_PACKAGES_FILE)
+	$(prep-javadoc)
+	$(call JavadocSummary,$(SCTPAPI_OPTIONS_FILE),$(SCTPAPI_PACKAGES_FILE))
+	$(JAVADOC_CMD) -d $(@D) \
+	  @$(SCTPAPI_OPTIONS_FILE) @$(SCTPAPI_PACKAGES_FILE)
+
+# Create file with javadoc options in it
+$(SCTPAPI_OPTIONS_FILE):
+	$(prep-target)
+	@($(call OptionOnly,$(COMMON_JAVADOCFLAGS))			; \
+	  $(call OptionPair,-sourcepath,$(RELEASEDOCS_SOURCEPATH))	; \
+	  $(call OptionPair,-encoding,ascii)				; \
+	  $(call OptionOnly,-nodeprecatedlist)				; \
+	  $(call OptionPair,-doctitle,$(SCTPAPI_DOCTITLE))		; \
+	  $(call OptionPair,-windowtitle,$(SCTPAPI_WINDOWTITLE) $(DRAFT_WINTITLE));\
+	  $(call OptionPair,-header,$(SCTPAPI_HEADER)$(DRAFT_HEADER))	; \
+	  $(call OptionPair,-bottom,$(SCTPAPI_BOTTOM)$(DRAFT_BOTTOM))	; \
+	  $(call OptionTrip,-linkoffline,$(SCTPAPI2COREAPI),$(COREAPI_DOCSDIR)/); \
+        ) >> $@
+
+# Create a file with the package names in it
+$(SCTPAPI_PACKAGES_FILE): $(DIRECTORY_CACHE) $(call PackageDependencies,$(SCTPAPI_PKGS))
+	$(prep-target)
+	$(call PackageFilter,$(SCTPAPI_PKGS))
+
+#############################################################
+#
+# Get a cache of all the directories
+
+$(DIRECTORY_CACHE): $(ALL_EXISTING_SOURCE_DIRS)
+	$(prep-target)
+	@for cp in $(ALL_EXISTING_SOURCE_DIRS) ; do 	\
+	  $(ECHO) "$(FIND) $${cp} -type f >> $@"; 	\
+	  $(FIND) $${cp} -type f >> $@; 		\
+	done
+
+#############################################################
+#release version of core packages ########
+# Maximize performance and ensure that build number & milestone are set.
+
+rel-coredocs: sanitycheckcoredocs
+	$(MAKE) coredocs
+
+rel-docs: rel-coredocs $(ALL_OTHER_TARGETS)
+#
+# end of production targets
+
+otherdocs: $(ALL_OTHER_TARGETS)
+
+clean:
+	$(RM) -r $(DOCSDIR) $(DOCSTMPDIR)
+
+#############################################################
+# DEBUG TARGET
+# List the values defined in the makefile hierarchy, to make sure everything
+# is set properly, and to help identify values we can use instead of making new ones.
+# (Most of them come from common/shared/Defs.gmk)
+#
+#  Notes:
+#    * BUILD_NUMBER defaults to b00 if not set on command line with BUILD_NUMBER=<value>
+#    * MILESTONE defaults to internal unless set to beta, rc, or fcs on command line
+#
+
+#############################################################
+.PHONY: all docs coredocs rel-docs otherdocs rel-coredocs \
+        sanitycheckcoredocs $(ALL_OTHER_TARGETS)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/common/makefiles/javadoc/NON_CORE_PKGS.gmk	Wed Jul 05 18:22:52 2017 +0200
@@ -0,0 +1,106 @@
+#
+# Copyright (c) 2002, 2012, 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 file contains the package names of all the "non-core" 
+# API published in the Java 2 SDK documentation.  "Non-core" means
+# it includes all published API outside of the JDK API specification.
+#
+# These environment variables are used by javadoc in 
+# make/docs/Makefile and are referenced by the localization
+# team when determining which APIs to extract javadoc
+# comments from.
+
+DOMAPI_PKGS      = com.sun.java.browser.dom   \
+                   org.w3c.dom                \
+                   org.w3c.dom.bootstrap      \
+                   org.w3c.dom.ls             \
+                   org.w3c.dom.ranges         \
+                   org.w3c.dom.traversal      \
+                   org.w3c.dom.html           \
+                   org.w3c.dom.stylesheets    \
+                   org.w3c.dom.css            \
+                   org.w3c.dom.events         \
+                   org.w3c.dom.views
+
+JDI_PKGS         = com.sun.jdi                \
+                   com.sun.jdi.event          \
+                   com.sun.jdi.request        \
+                   com.sun.jdi.connect        \
+                   com.sun.jdi.connect.spi
+
+MGMT_PKGS        = com.sun.management
+
+JAAS_PKGS        = com.sun.security.auth          \
+                   com.sun.security.auth.callback \
+                   com.sun.security.auth.login    \
+                   com.sun.security.auth.module
+
+JGSS_PKGS        = com.sun.security.jgss
+
+OLD_JSSE_PKGS    = com.sun.net.ssl
+
+HTTPSERVER_PKGS  = com.sun.net.httpserver       \
+                   com.sun.net.httpserver.spi 
+
+NIO_PKGS         = com.sun.nio.file
+
+DOCLETAPI_PKGS   = com.sun.javadoc
+
+TAGLETAPI_FILE   = com/sun/tools/doclets/Taglet.java
+
+TAGLETAPI_PKGS   = com.sun.tools.doclets
+
+ATTACH_PKGS      = com.sun.tools.attach         \
+                   com.sun.tools.attach.spi
+
+JCONSOLE_PKGS    = com.sun.tools.jconsole
+
+TREEAPI_PKGS 	 = com.sun.source.tree \
+		   com.sun.source.util
+
+SMARTCARDIO_PKGS = javax.smartcardio
+
+SCTPAPI_PKGS     = com.sun.nio.sctp
+
+ifeq ($(PLATFORM), macosx)
+APPLE_EXT_PKGS   = com.apple.concurrent   \
+                   com.apple.eawt         \
+                   com.apple.eawt.event   \
+                   com.apple.eio
+endif
+
+# non-core packages in rt.jar
+NON_CORE_PKGS    = $(DOMAPI_PKGS) \
+                   $(MGMT_PKGS) \
+                   $(JAAS_PKGS) \
+                   $(JGSS_PKGS) \
+                   $(NIO_PKGS) \
+                   $(OLD_JSSE_PKGS) \
+                   $(HTTPSERVER_PKGS) \
+                   $(SMARTCARDIO_PKGS) \
+                   $(SCTPAPI_PKGS) \
+                   $(APPLE_EXT_PKGS)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/common/makefiles/javadoc/Notes.html	Wed Jul 05 18:22:52 2017 +0200
@@ -0,0 +1,49 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html>
+<head>
+<title>Doc Process Notes</title>
+<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+</head>
+
+<body>
+<h3><a name="REGEXP"></a><br>
+REGEXP</h3>
+<p> REGEXP is a list of wildcard patterns that determines which packages listed 
+  in CORE_PKGS.gmk go into which summary-table on the main API index page. It 
+  was motivated by the need to divide the world into &quot;core packages&quot; 
+  (java.*) and &quot;extension packages&quot; (javax.*). In time, the distinction 
+  went away. The whole table is now called &quot;Platform Packages&quot;--which 
+  eliminated the need for this list of regular expressions. But it lingered on, 
+  accreting all of the packages in the JVM, one by one. I pruned it back to &quot;*&quot;, 
+  so it now covers every package in the Java platform API docs. If some separation 
+  is needed in the future, it can grow back into a colon-separated list, starting 
+  with this, which is in all respects equivalent to &quot;*&quot; at this point 
+  in time:</p>
+<blockquote> 
+  <pre>REGEXP = &quot;java.*:javax.*:org.ietf*:org.omg.</pre>
+</blockquote>
+<h3><a name="releaseTargets"></a><br>
+  Release Targets</h3>
+<p> (Thanks to Kelly O'Hair for this info.)</p>
+<p> The <tt>rel-coredocs</tt> and <tt>rel-docs</tt> targets were added by Eric 
+  Armstrong. <tt>rel-coredocs</tt> assumes the kind of large, 32-bit machine used 
+  in the javapubs group's docs-release process. It specifies memory settings accordingly 
+  to maximize performance.</p>
+<p> The performance settings, like the sanity check, are most important for the 
+  core docs--the platform APIs. Running javadoc on those APIs takes a significant 
+  amount of time and memory. Setting the initial heap size as large as possible 
+  is important to prevent thrashing as the heap grows. Setting the maximum as 
+  large as necessary is also important to keep the job from failing.</p>
+<blockquote>
+  <p> <tt>-J-Xmx512</tt> sets a maximum of 512, which became necessary in 6.0<br>
+    <tt>-J-Xms256</tt> sets starting size to 256 (default is 8)</p>
+</blockquote>
+<p> <tt>rel-coredocs</tt> also includes a sanity check to help ensure that <tt>BUILD_NUMBER</tt> 
+  and <tt>MILESTONE</tt> are specified properly when docs are built outside of 
+  the normal release engineering process, with the intention of releasing them 
+  on the web or in a downloaded docs bundle. (When invoked in release engineering's 
+  control build, the values are always set properly. But when the targets are 
+  run by themselves, they default to b00 and &quot;internal&quot;--which silently 
+  sabotage the result of a build that can take many hours to complete.</p>
+</body>
+</html>
--- a/corba/.hgtags	Wed Jul 05 18:22:17 2017 +0200
+++ b/corba/.hgtags	Wed Jul 05 18:22:52 2017 +0200
@@ -177,3 +177,4 @@
 63aeb7a2472fb299134ad7388e0a111a5340b02d jdk8-b53
 16c82fc74695bab9b9e0fb05c086a5a08ba0082f jdk8-b54
 e8a0e84383d6fbd303ce44bd355fb25972b13286 jdk8-b55
+bf1bb47414e178beff67dc255fc3b97bf401f679 jdk8-b56
--- a/corba/makefiles/Makefile	Wed Jul 05 18:22:17 2017 +0200
+++ b/corba/makefiles/Makefile	Wed Jul 05 18:22:52 2017 +0200
@@ -48,10 +48,8 @@
      JVM:=$(JAVA),\
      JAVAC:=$(JAVAC_JARS),\
      FLAGS:=$(BOOT_JDK_SOURCETARGET) -bootclasspath $(BOOT_RTJAR) $(DISABLE_CORBA_WARNINGS),\
-     SERVER_DIR:=$(JAVAC_SERVERS),\
-     SERVER_JVM:=$(SERVER_JAVA),\
-     MODE:=$(JAVAC_USE_MODE),\
-     USE_DEPS:=$(JAVAC_USE_DEPS)))
+     SERVER_DIR:=$(SJAVAC_SERVER_DIR),\
+     SERVER_JVM:=$(SJAVAC_SERVER_JAVA)))
 
 # The "generate new bytecode" uses the new compiler to generate bytecode
 # for the new jdk that is being built. The code compiled by this setup
@@ -59,13 +57,9 @@
 $(eval $(call SetupJavaCompiler,GENERATE_NEWBYTECODE,\
      JVM:=$(JAVA),\
      JAVAC:=$(JAVAC_JARS),\
-     FLAGS:=-Xprefer:source -XDignore.symbol.file=true \
-		-cp $(BOOT_JDK)/lib/tools.jar \
-		$(DISABLE_CORBA_WARNINGS),\
-     SERVER_DIR:=$(JAVAC_SERVERS),\
-     SERVER_JVM:=$(SERVER_JAVA),\
-     MODE:=$(JAVAC_USE_MODE),\
-     USE_DEPS:=$(JAVAC_USE_DEPS)))
+     FLAGS:=-cp $(BOOT_TOOLSJAR) -XDignore.symbol.file=true $(DISABLE_CORBA_WARNINGS),\
+     SERVER_DIR:=$(SJAVAC_SERVER_DIR),\
+     SERVER_JVM:=$(SJAVAC_SERVER_JAVA)))
 
 $(eval $(call SetupJavaCompilation,BUILD_STRIPPROP,\
 		SETUP:=GENERATE_OLDBYTECODE,\
--- a/hotspot/.hgtags	Wed Jul 05 18:22:17 2017 +0200
+++ b/hotspot/.hgtags	Wed Jul 05 18:22:52 2017 +0200
@@ -275,3 +275,4 @@
 e8fb566b94667f88462164defa654203f0ab6820 jdk8-b54
 09ea7e0752b306b8ae74713aeb4eb6263e1c6836 hs24-b22
 af0c8a0808516317333dcf9af15567cdd52761ce jdk8-b55
+6124ff4218296c91e4a72f1a76c064892d39d61b jdk8-b56
--- a/jaxp/.hgtags	Wed Jul 05 18:22:17 2017 +0200
+++ b/jaxp/.hgtags	Wed Jul 05 18:22:52 2017 +0200
@@ -177,3 +177,4 @@
 2c566f25c39f0087464b73e3bcf1c1421d0f2a7e jdk8-b53
 7dd81ccb7c1134df70969b3068b1e98def701746 jdk8-b54
 7c2363666890c6675194948fbcd74d81ddb84298 jdk8-b55
+f19d63b2119a0092f016203981ffef5cc31bc3c5 jdk8-b56
--- a/jaxp/makefiles/Makefile	Wed Jul 05 18:22:17 2017 +0200
+++ b/jaxp/makefiles/Makefile	Wed Jul 05 18:22:52 2017 +0200
@@ -40,11 +40,9 @@
 $(eval $(call SetupJavaCompiler,GENERATE_NEWBYTECODE_DEBUG,\
      JVM:=$(JAVA),\
      JAVAC:=$(JAVAC_JARS),\
-     FLAGS:=-Xprefer:source -XDignore.symbol.file=true $(DISABLE_JAXP_WARNINGS) -g,\
-     SERVER_DIR:=$(JAVAC_SERVERS),\
-     SERVER_JVM:=$(SERVER_JAVA),\
-     MODE:=$(JAVAC_USE_MODE),\
-     USE_DEPS:=$(JAVAC_USE_DEPS)))
+     FLAGS:=-XDignore.symbol.file=true $(DISABLE_JAXP_WARNINGS) -g,\
+     SERVER_DIR:=$(SJAVAC_SERVER_DIR),\
+     SERVER_JVM:=$(SJAVAC_SERVER_JAVA)))
 
 $(eval $(call SetupJavaCompilation,BUILD_JAXP,\
 		SETUP:=GENERATE_NEWBYTECODE_DEBUG,\
--- a/jaxws/.hgtags	Wed Jul 05 18:22:17 2017 +0200
+++ b/jaxws/.hgtags	Wed Jul 05 18:22:52 2017 +0200
@@ -177,3 +177,4 @@
 8a35fd644d3c0b75813ff0236adef8a1c6f895c6 jdk8-b53
 91970935926a20f19a5cbbf20931745ac1975e91 jdk8-b54
 109c9e1f2d8546e9954e1b7be9a37a4396434544 jdk8-b55
+7813455ccdb08c3ee6051161176821325a5d44d7 jdk8-b56
--- a/jaxws/makefiles/Makefile	Wed Jul 05 18:22:17 2017 +0200
+++ b/jaxws/makefiles/Makefile	Wed Jul 05 18:22:52 2017 +0200
@@ -40,12 +40,9 @@
 $(eval $(call SetupJavaCompiler,GENERATE_NEWBYTECODE_DEBUG,\
      JVM:=$(JAVA),\
      JAVAC:=$(JAVAC_JARS),\
-     FLAGS:=-Xprefer:source -XDignore.symbol.file=true -cp $(BOOT_JDK)/lib/tools.jar \
-		$(DISABLE_JAXWS_WARNINGS) -g,\
-     SERVER_DIR:=$(JAVAC_SERVERS),\
-     SERVER_JVM:=$(SERVER_JAVA),\
-     MODE:=$(JAVAC_USE_MODE),\
-     USE_DEPS:=$(JAVAC_USE_DEPS)))
+     FLAGS:=-XDignore.symbol.file=true $(DISABLE_JAXWS_WARNINGS) -g,\
+     SERVER_DIR:=$(SJAVAC_SERVER_DIR),\
+     SERVER_JVM:=$(SJAVAC_SERVER_JAVA)))
 
 # Dummy here is needed to trigger copying of META-INF
 $(eval $(call SetupJavaCompilation,BUILD_JAF,\
--- a/jdk/.hgtags	Wed Jul 05 18:22:17 2017 +0200
+++ b/jdk/.hgtags	Wed Jul 05 18:22:52 2017 +0200
@@ -177,3 +177,4 @@
 2c6933c5106b81a8578b70996fe5b735fb3adb60 jdk8-b53
 70ad0ed1d6cef0e7712690d1bab21e4769708aad jdk8-b54
 1f3f4b333341873f00da3dee85e4879f0e89c9bb jdk8-b55
+2e9eeef2909b33c9224a024afddb61ccb0b77f14 jdk8-b56
--- a/jdk/make/Makefile	Wed Jul 05 18:22:17 2017 +0200
+++ b/jdk/make/Makefile	Wed Jul 05 18:22:52 2017 +0200
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 1995, 2011, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 1995, 2012, 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
@@ -29,6 +29,7 @@
 #
 
 BUILDDIR=.
+
 include $(BUILDDIR)/common/Defs.gmk
 
 #
@@ -273,6 +274,7 @@
 # Release engineering targets.
 #
 include $(BUILDDIR)/common/Release.gmk
+-include $(CUSTOM_MAKE_DIR)/Release.gmk
 
 #
 # Cscope targets.
--- a/jdk/make/com/sun/java/pack/Makefile	Wed Jul 05 18:22:17 2017 +0200
+++ b/jdk/make/com/sun/java/pack/Makefile	Wed Jul 05 18:22:52 2017 +0200
@@ -159,7 +159,7 @@
 	$(prep-target)
 	$(RM) $(TEMPDIR)/mapfile-vers
 	$(CP) mapfile-vers-unpack200 $(TEMPDIR)/mapfile-vers
-	$(LINKER)  $(LDDFLAGS) $(UNPACK_EXE_FILES_o) $(RES) $(LIBCXX) $(LDOUTPUT)$(TEMPDIR)/unpack200$(EXE_SUFFIX)
+	$(LINKER)  $(LDDFLAGS) $(sort $(UNPACK_EXE_FILES_o)) $(RES) $(LIBCXX) $(LDOUTPUT)$(TEMPDIR)/unpack200$(EXE_SUFFIX)
 ifdef MT
 	$(MT) /manifest $(OBJDIR)/unpack200$(EXE_SUFFIX).manifest /outputresource:$(TEMPDIR)/unpack200$(EXE_SUFFIX);#1
 endif
--- a/jdk/make/common/Defs-embedded.gmk	Wed Jul 05 18:22:17 2017 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,76 +0,0 @@
-#
-# Copyright (c) 2011, 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.
-#
-
-#
-# Variable definitions for SE Embedded builds.  This file should
-# not contain rules.
-#
-ifdef JAVASE_EMBEDDED
-
-# Compress jar files
-COMPRESS_JARS = true
-
-# Don't mmap zip files
-LIBZIP_CAN_USE_MMAP = false
-
-# Disable ALSA version check
-REQUIRED_ALSA_VERSION =
-
-# Compilation settings
-OTHER_CPPFLAGS += -DJAVASE_EMBEDDED
-
-# Product naming
-PRODUCT_SUFFIX = SE Embedded Runtime Environment
-RUNTIME_NAME = $(PRODUCT_NAME) $(PRODUCT_SUFFIX)
-
-# Reduced JRE locations
-JRE_REDUCED_HEADLESS_IMAGE_DIR = $(ABS_OUTPUTDIR)/j2re-reduced-headless-image
-JRE_REDUCED_IMAGE_DIR = $(ABS_OUTPUTDIR)/j2re-reduced-image
-
-# Override on linux to further reduce binary/lib sizes in product build
-ifeq ($(PLATFORM), linux)
-  ifeq ($(VARIANT), OPT)
-    ifneq ($(NO_STRIP), true)
-      ifneq ($(DEBUG_BINARIES), true)
-        POST_STRIP_PROCESS = $(STRIP) --strip-unneeded
-      endif
-    endif
-  endif
-endif
-
-# NIO Platform specific source file location
-ifdef CROSS_COMPILE_ARCH
-  NIO_PLATFORM_CLASSES_ROOT_DIR = $(CLOSED_PLATFORM_SRC)/classes/
-endif
-
-# For ARM sflt we need to link to a library with improved FP accuracy
-# and it must be linked after fdlibm - this places it at the end after libc
-# -z muldefs avoids linker errors for duplicate symbols.
-ifeq ($(CROSS_COMPILE_ARCH), arm)
-  EXTRA_LIBS +=  $(EXT_LIBS_PATH)/sflt_glibc_jdk.a -Xlinker -z -Xlinker muldefs
-endif
-
-endif # JAVASE_EMBEDDED
-
--- a/jdk/make/common/Defs.gmk	Wed Jul 05 18:22:17 2017 +0200
+++ b/jdk/make/common/Defs.gmk	Wed Jul 05 18:22:52 2017 +0200
@@ -109,6 +109,21 @@
   endif
 endif
 
+# We allow for potential specialization of build files. This has to be
+# done on a file-by-file, case-by-case basis. Here we define the basic control
+# over where custom files are being used. Later we will -include the custom
+# Defs.gmk if present. This works best because all Makefiles include defs.gmk.
+# In other cases we can either have foo.gmk include custom/foo.gmk, or
+# a Makefile can do:
+#  include foo.gmk
+#  -include $CUSTOM_MAKE_DIR/foo.gmk
+#
+# For non-OpenJDK builds the default location is the make/closed repository.
+# For OpenJDK builds a real value has to be supplied externally.
+ifneq ($(OPENJDK),true)
+  CUSTOM_MAKE_DIR = $(BUILDDIR)/closed
+endif
+
 #
 # Get platform definitions
 #
@@ -116,12 +131,6 @@
 include $(JDK_TOPDIR)/make/common/Defs-$(PLATFORM).gmk
 
 #
-# SE-Embedded support, if enabled
-#
-
-include $(JDK_TOPDIR)/make/common/Defs-embedded.gmk
-
-#
 # Cross-compilation Settings
 #
 ifdef CROSS_COMPILE_ARCH
@@ -611,4 +620,6 @@
 $(install-importonly-file)
 endef
 
+-include $(CUSTOM_MAKE_DIR)/Defs.gmk
+
 .PHONY: all build clean clobber
--- a/jdk/make/common/Release-embedded.gmk	Wed Jul 05 18:22:17 2017 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,230 +0,0 @@
-#
-# Copyright (c) 2011, 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.
-#
-
-#
-# SE-Embedded Reduced JRE targets
-#
-ifdef JAVASE_EMBEDDED
-
-reduced-image-jre reduced-headless-image-jre ::
-	@$(ECHO) ">>>Making "$@" @ `$(DATE)` ..."
-
-# Add the reduced-jre images as pre-reqs. These will be processed last
-images:: reduced-image-jre reduced-headless-image-jre
-
-
-######################################################
-# Create the headless rt.jar
-######################################################
-
-NOT_HEADLESS_RT_JAR_LIST = $(ABS_TEMPDIR)/not_hl_rt_jar.list
-HEADLESS_RT_JAR_FILELIST=$(JARFILELISTS_TEMPDIR)/hl_rt_jar_list
-TOTAL_HEADLESS_JAR_FILELIST=$(REORDER_TEMPDIR)/hl_file_list
-HEADLESS_CLASSLIST=$(ABS_TEMPDIR)/headless_classlist
-
-# Add the jar file directories that we don't want in the
-# headless JRE.  If you want to remove most classes in a
-# directory, put the directory in the NOT_HEADLESS_RT_JAR_LIST
-# and put the individual classes you want to keep in the 
-# HEADLESS_CLASSLIST file. 
-$(NOT_HEADLESS_RT_JAR_LIST): $(NOT_RT_JAR_LIST)
-	$(RM) $(HEADLESS_CLASSLIST)
-	$(RM) $(NOT_HEADLESS_RT_JAR_LIST)
-	$(CP) $(NOT_RT_JAR_LIST) $(NOT_HEADLESS_RT_JAR_LIST)
-# List all the packages to be excluded
-	$(ECHO) "sun/awt/motif/" >> $@
-	$(ECHO) "sun/awt/X11/" >> $@
-	$(ECHO) "sun/applet/" >> $@
-	$(ECHO) "sun/java2d/opengl/" >> $@
-	$(ECHO) "com/sun/java/swing/plaf/" >> $@
-# List all the individual classes to be included
-	$(ECHO) "sun/awt/motif/MFontConfiguration.class" >$(HEADLESS_CLASSLIST)
-	$(ECHO) "sun/applet/AppContextCreator.class" >>$(HEADLESS_CLASSLIST)
-	$(ECHO) "sun/applet/AppletAudioClip.class" >>$(HEADLESS_CLASSLIST)
-	$(ECHO) "sun/java2d/opengl/GLXSurfaceData.class" >>$(HEADLESS_CLASSLIST)
-	$(ECHO) "sun/java2d/opengl/GLXSurfaceData"\$$"GLXOffScreenSurfaceData.class" >>$(HEADLESS_CLASSLIST)
-	$(ECHO) "sun/java2d/opengl/GLXVolatileSurfaceManager.class" >>$(HEADLESS_CLASSLIST)
-	$(ECHO) "sun/java2d/opengl/OGLSurfaceData.class" >>$(HEADLESS_CLASSLIST)
-
-
-$(TOTAL_HEADLESS_JAR_FILELIST): $(JARREORDER_JARFILE) $(NOT_HEADLESS_RT_JAR_LIST)
-	$(prep-target)
-	$(RM) $@.temp
-	$(CD) $(CLASSBINDIR) ; \
-		$(BOOT_JAVA_CMD) -jar $(JARREORDER_JARFILE) \
-		-o  $@.temp - $(NOT_HEADLESS_RT_JAR_LIST)  .
-# Add on the explicitly included class files from the otherwise excluded packages
-	$(CAT) $(HEADLESS_CLASSLIST) >> $@.temp
-	$(MV) $@.temp $@
-	@$(CD) $(CLASSBINDIR); $(java-vm-cleanup)
-
-# Create the headless rt.jar file list & non-class files list
-MakeHeadlessJarFileList: $(TOTAL_HEADLESS_JAR_FILELIST) $(JARSPLIT_JARFILE)
-	@$(RM) $(HEADLESS_RT_JAR_FILELIST) $(RES_JAR_FILELIST)
-	$(BOOT_JAVA_CMD) -jar $(JARSPLIT_JARFILE) $(TOTAL_HEADLESS_JAR_FILELIST) \
-		-o  $(HEADLESS_RT_JAR_FILELIST) $(RES_JAR_FILELIST)
-	@$(java-vm-cleanup)
-
-# Create headless rt.jar
-HL_RT_JAR=$(ABS_TEMPDIR)/rt-hl-orig.jar
-$(HL_RT_JAR): MakeHeadlessJarFileList $(RT_JAR_MANIFEST_FILE)
-	$(prep-target)
-	$(CD) $(CLASSBINDIR) ; \
-		$(BOOT_JAR_CMD) $(CREATE_JAR_OPTS) $(RT_JAR_MANIFEST_FILE) $@ @$(HEADLESS_RT_JAR_FILELIST) \
-		 $(JAR_JFLAGS)
-	@$(CD) $(CLASSBINDIR); $(java-vm-cleanup)
-
-
-#
-# Produce a reduced Headful JRE for Embedded Devices
-#
-# The deployment binaries are added during the deployment build process
-#
-
-# Binaries that don't get included in reduced jre image bin directory
-NOT_REDUCEDJRE_BIN = \
- java_vm \
- kinit \
- klist \
- ktab \
- orbd \
- policytool \
- rmid \
- rmiregistry \
- servertool \
- tnameserv \
- pack200 \
- unpack200
-
-# jars/resources/libs that don't get included in reduced jre image lib directory
-NOT_REDUCEDJRE_LIB = \
- charsets.jar \
- ext/dnsns.jar \
- ext/localedata.jar \
- $(LIBARCH)/client/classes.jsa \
- $(LIBARCH)/libjavaplugin_jni.so \
- $(LIBARCH)/libjavaplugin_nscp_gcc29.so \
- $(LIBARCH)/libjavaplugin_nscp.so \
- $(LIBARCH)/libjavaplugin_oji.so
-
-# JRE docs that don't get included in reduced jre image top directory
-NOT_REDUCEDJRE_DOC = \
- Welcome.html
-
-reduced-image-jre::
-	@$(ECHO) Starting to Produce Reduced JRE
-	@#
-	@# First make a copy of the full JRE
-	@#
-	$(RM) -r $(JRE_REDUCED_IMAGE_DIR)
-	$(MKDIR) -p $(JRE_REDUCED_IMAGE_DIR)
-	$(CD) $(JRE_IMAGE_DIR); \
-	    $(TAR) cf - . | ($(CD) $(JRE_REDUCED_IMAGE_DIR); $(TAR) xf - ); 
-
-	@#
-	@# Remove all of the files that are not needed for the
-	@# reduced JRE
-	@#
-	for l in $(NOT_REDUCEDJRE_BIN) ; do \
-	    $(RM) $(JRE_REDUCED_IMAGE_DIR)/bin/$$l ; \
-	done
-	for l in $(NOT_REDUCEDJRE_LIB) ; do \
-	    $(RM) $(JRE_REDUCED_IMAGE_DIR)/lib/$$l ; \
-	done
-	for l in $(NOT_REDUCEDJRE_DOC) ; do \
-	    $(RM) $(JRE_REDUCED_IMAGE_DIR)/$$l ; \
-	done
-
-	@# Remove misc. other files
-	$(RM) -r $(JRE_REDUCED_IMAGE_DIR)/man
-	$(RM) -f $(JRE_REDUCED_IMAGE_DIR)/CHANGES
-
-	@$(ECHO) Done Creating Reduced JRE
-
-#
-# Produce a reduced Headless JRE
-#
-reduced-headless-image-jre:: $(RT_JAR) $(RESOURCES_JAR) $(BUILD_META_INDEX) $(HL_RT_JAR)
-	@$(ECHO) Starting to Produce Reduced Headless JRE
-	@#
-	@# First make a copy of the reduced JRE we just built
-	@#
-	$(RM) -r $(JRE_REDUCED_HEADLESS_IMAGE_DIR)
-	$(MKDIR) -p $(JRE_REDUCED_HEADLESS_IMAGE_DIR)
-	$(CD) $(JRE_REDUCED_IMAGE_DIR); \
-	    $(TAR) cf - . | ($(CD) $(JRE_REDUCED_HEADLESS_IMAGE_DIR); $(TAR) xf - ); 
-
-	@# Replace the full rt.jar with the headless rt.jar
-	$(RM) -f $(JRE_REDUCED_HEADLESS_IMAGE_DIR)/lib/rt.jar
-	$(CP) $(HL_RT_JAR) $(JRE_REDUCED_HEADLESS_IMAGE_DIR)/lib/rt.jar
-
-	@#
-	@# Remove all of the files that are not needed for the
-	@# reduced Headless JRE
-	@#
-	$(RM) -f $(JRE_REDUCED_HEADLESS_IMAGE_DIR)/lib/$(LIBARCH)/gtkhelper
-	$(RM)  $(JRE_REDUCED_HEADLESS_IMAGE_DIR)/lib/$(LIBARCH)/libjsoundalsa.so
-	$(RM) -r $(JRE_REDUCED_HEADLESS_IMAGE_DIR)/lib/audio
-	$(RM) -fr $(JRE_REDUCED_HEADLESS_IMAGE_DIR)/lib/applet
-	$(RM)  $(JRE_REDUCED_HEADLESS_IMAGE_DIR)/lib/$(LIBARCH)/awt_robot
-	$(RM)  $(JRE_REDUCED_HEADLESS_IMAGE_DIR)/lib/$(LIBARCH)/libawt_xawt.so
-	$(RM) -r $(JRE_REDUCED_HEADLESS_IMAGE_DIR)/lib/$(LIBARCH)/libsplashscreen.so
-	@# Remove oblique fonts and reduce font support to LucidaSansRegular only
-	$(RM) -fr $(JRE_REDUCED_HEADLESS_IMAGE_DIR)/lib/oblique-fonts
-	$(RM) -f $(JRE_REDUCED_HEADLESS_IMAGE_DIR)/lib/fonts/LucidaBrightDemiBold.ttf
-	$(RM) -f $(JRE_REDUCED_HEADLESS_IMAGE_DIR)/lib/fonts/LucidaBrightDemiItalic.ttf
-	$(RM) -f $(JRE_REDUCED_HEADLESS_IMAGE_DIR)/lib/fonts/LucidaBrightItalic.ttf
-	$(RM) -f $(JRE_REDUCED_HEADLESS_IMAGE_DIR)/lib/fonts/LucidaBrightRegular.ttf
-	$(RM) -f $(JRE_REDUCED_HEADLESS_IMAGE_DIR)/lib/fonts/LucidaSansDemiBold.ttf
-	$(RM) -f $(JRE_REDUCED_HEADLESS_IMAGE_DIR)/lib/fonts/LucidaTypewriterBold.ttf
-	$(RM) -f $(JRE_REDUCED_HEADLESS_IMAGE_DIR)/lib/fonts/LucidaTypewriterRegular.ttf
-
-ifeq ($(PLATFORM), linux)
-# put out minimal fonts.dir file for the remaining font
-	$(RM) -f $(JRE_REDUCED_HEADLESS_IMAGE_DIR)/lib/fonts/fonts.dir
-	$(ECHO) 6>$(JRE_REDUCED_HEADLESS_IMAGE_DIR)/lib/fonts/fonts.dir
-	$(ECHO) "LucidaSansRegular.ttf -b&h-lucidasans-medium-r-normal-sans-0-0-0-0-p-0-iso8859-1">>$(JRE_REDUCED_HEADLESS_IMAGE_DIR)/lib/fonts/fonts.dir
-	$(ECHO) "LucidaSansRegular.ttf -b&h-lucidasans-medium-r-normal-sans-0-0-0-0-p-0-iso8859-2">>$(JRE_REDUCED_HEADLESS_IMAGE_DIR)/lib/fonts/fonts.dir
-	$(ECHO) "LucidaSansRegular.ttf -b&h-lucidasans-medium-r-normal-sans-0-0-0-0-p-0-iso8859-4">>$(JRE_REDUCED_HEADLESS_IMAGE_DIR)/lib/fonts/fonts.dir
-	$(ECHO) "LucidaSansRegular.ttf -b&h-lucidasans-medium-r-normal-sans-0-0-0-0-p-0-iso8859-5">>$(JRE_REDUCED_HEADLESS_IMAGE_DIR)/lib/fonts/fonts.dir
-	$(ECHO) "LucidaSansRegular.ttf -b&h-lucidasans-medium-r-normal-sans-0-0-0-0-p-0-iso8859-7">>$(JRE_REDUCED_HEADLESS_IMAGE_DIR)/lib/fonts/fonts.dir
-	$(ECHO) "LucidaSansRegular.ttf -b&h-lucidasans-medium-r-normal-sans-0-0-0-0-p-0-iso8859-9">>$(JRE_REDUCED_HEADLESS_IMAGE_DIR)/lib/fonts/fonts.dir
-
-endif # Linux
-
-	@#
-	@# all done with JRE reduced headless image
-	@#
-
-	@$(ECHO) Done Creating Reduced Headless JRE
-
-images-clobber::
-	$(RM) -r $(JRE_REDUCED_IMAGE_DIR)
-	$(RM) -r $(JRE_REDUCED_HEADLESS_IMAGE_DIR)
-
-.PHONY: reduced-image-jre reduced-headless-image-jre 
-
-endif # JAVASE_EMBEDDED
-
--- a/jdk/make/common/Release.gmk	Wed Jul 05 18:22:17 2017 +0200
+++ b/jdk/make/common/Release.gmk	Wed Jul 05 18:22:52 2017 +0200
@@ -750,10 +750,6 @@
 
 BUILDMETAINDEX_JARFILE = $(ABS_BUILDTOOLJARDIR)/buildmetaindex.jar
 
-# SE-Embedded targets if enabled
-include $(JDK_TOPDIR)/make/common/Release-embedded.gmk
-
-
 ######################################################
 # JRE Image
 ######################################################
--- a/jdk/make/java/jli/Makefile	Wed Jul 05 18:22:17 2017 +0200
+++ b/jdk/make/java/jli/Makefile	Wed Jul 05 18:22:52 2017 +0200
@@ -190,7 +190,7 @@
 
   $(STATIC_LIBRARY): $(FILES_o)
 	@$(prep-target)
-	$(LIBEXE) -nologo -out:$@ $(FILES_o)
+	$(LIBEXE) -nologo -out:$@ $(sort $(FILES_o))
 
   library:: $(STATIC_LIBRARY)
 endif # PLATFORM
@@ -216,7 +216,7 @@
 
 $(STATIC_LIBRARY): $(STATIC_LIBRARY_DIR)
 	@$(prep-target)
-	$(AR) $(ARFLAGS) $@ $(FILES_o)
+	$(AR) $(ARFLAGS) $@ $(sort $(FILES_o))
 
 library:: $(STATIC_LIBRARY)
 
--- a/jdk/makefiles/CompileDemos.gmk	Wed Jul 05 18:22:17 2017 +0200
+++ b/jdk/makefiles/CompileDemos.gmk	Wed Jul 05 18:22:52 2017 +0200
@@ -44,10 +44,11 @@
 
 define SetupAppletDemo
      $$(eval $$(call SetupJavaCompilation,BUILD_DEMO_APPLET_$1,\
-                SETUP:=GENERATE_USINGJDKBYTECODE$2,\
+                SETUP:=GENERATE_USINGJDKBYTECODE,\
 		SRC:=$(JDK_TOPDIR)/src/$3share/demo/applets/$1,\
-		BIN:=$(JDK_OUTPUTDIR)/newdemo/applets/$1,\
-		COPY:=.html .java .xyz .obj .au .gif))
+		BIN:=$(JDK_OUTPUTDIR)/demo/applets/$1,\
+		COPY:=.html .java .xyz .obj .au .gif,\
+		DISABLE_SJAVAC:=$2))
      BUILD_DEMOS += $$(BUILD_DEMO_APPLET_$1)
 endef
 
@@ -67,11 +68,11 @@
 $(eval $(call SetupAppletDemo,SpreadSheet))
 # Build WireFrame without a server since it
 # has a class Matrix3D that also exists in MoleculeViewer.
-$(eval $(call SetupAppletDemo,WireFrame,_NOSERV))
+$(eval $(call SetupAppletDemo,WireFrame,true))
 
 ifndef OPENJDK
     $(eval $(call SetupAppletDemo,Animator,,closed/))
-    $(eval $(call SetupAppletDemo,GraphLayout,_NOSERV,closed/))
+    $(eval $(call SetupAppletDemo,GraphLayout,true,closed/))
     $(eval $(call SetupAppletDemo,JumpingBox,,closed/))
     $(eval $(call SetupAppletDemo,TicTacToe,,closed/))
 endif
@@ -111,29 +112,30 @@
 
     ifneq ($$($1_JAVA_FILES_EXIST),)
         $$(eval $$(call SetupJavaCompilation,BUILD_DEMO_$1,\
-                SETUP:=GENERATE_USINGJDKBYTECODE$(12),\
+                SETUP:=GENERATE_USINGJDKBYTECODE,\
                 ADD_JAVAC_FLAGS:=$3,\
 		SRC:=$$($1_MAIN_SRC) $5,\
-		BIN:=$(JDK_OUTPUTDIR)/newdemoclasses/$2/$1,\
+		BIN:=$(JDK_OUTPUTDIR)/democlasses/$2/$1,\
 		COPY:=$(PATTERNS_TO_COPY) $(10),\
-		JAR:=$(JDK_OUTPUTDIR)/newdemo/$2/$1/$$($1_JARFILE),\
+		JAR:=$(JDK_OUTPUTDIR)/demo/$2/$1/$$($1_JARFILE),\
 		JARMAIN:=$4,\
 		MANIFEST:=$(JDK_TOPDIR)/make/tools/manifest.mf,\
 		EXTRA_MANIFEST_ATTR:=$(11),\
-		SRCZIP:=$(JDK_OUTPUTDIR)/newdemo/$2/$1/src.zip,\
-		EXCLUDE_FILES:=$9))
+		SRCZIP:=$(JDK_OUTPUTDIR)/demo/$2/$1/src.zip,\
+		EXCLUDE_FILES:=$9,\
+		DISABLE_SJAVAC:=$(12)))
 
         BUILD_DEMOS +=  $$(BUILD_DEMO_$1) \
-			$(JDK_OUTPUTDIR)/newdemo/$2/$1/$$($1_JARFILE) \
-			$(JDK_OUTPUTDIR)/newdemo/$2/$1/src.zip 
+			$(JDK_OUTPUTDIR)/demo/$2/$1/$$($1_JARFILE) \
+			$(JDK_OUTPUTDIR)/demo/$2/$1/src.zip 
     endif
 
     # Copy files.
     $1_COPY_TARGETS :=  $$(patsubst $(JDK_TOPDIR)/src/$6share/demo/$2/$1/%,\
-			$(JDK_OUTPUTDIR)/newdemo/$2/$1/%,\
+			$(JDK_OUTPUTDIR)/demo/$2/$1/%,\
 			$$(wildcard $$(addprefix $(JDK_TOPDIR)/src/$6share/demo/$2/$1/,$7)))
     ifneq ($7,)
-        $(JDK_OUTPUTDIR)/newdemo/$2/$1/% : $(JDK_TOPDIR)/src/$6share/demo/$2/$1/%
+        $(JDK_OUTPUTDIR)/demo/$2/$1/% : $(JDK_TOPDIR)/src/$6share/demo/$2/$1/%
 		$(MKDIR) -p $$(@D)
 		$(CP) $$< $$@
 		$(CHMOD) -f ug+w $$@
@@ -144,20 +146,20 @@
 endef
 
 $(eval $(call SetupDemo,CodePointIM,jfc,,CodePointIM,,,*.html))
-$(JDK_OUTPUTDIR)/newdemo/jfc/CodePointIM/_the.services : \
-			$(JDK_OUTPUTDIR)/newdemo/jfc/CodePointIM/CodePointIM.jar \
+$(JDK_OUTPUTDIR)/demo/jfc/CodePointIM/_the.services : \
+			$(JDK_OUTPUTDIR)/demo/jfc/CodePointIM/CodePointIM.jar \
 			$(JDK_TOPDIR)/src/share/demo/jfc/CodePointIM/java.awt.im.spi.InputMethodDescriptor
-	(cd $(JDK_OUTPUTDIR)/newdemo/jfc/CodePointIM && \
+	(cd $(JDK_OUTPUTDIR)/demo/jfc/CodePointIM && \
 		$(MKDIR) -p _the.tmp/META-INF/services && \
 		$(CP) $(JDK_TOPDIR)/src/share/demo/jfc/CodePointIM/java.awt.im.spi.InputMethodDescriptor _the.tmp/META-INF/services && \
 		cd _the.tmp && \
-		$(JAR) uf $(JDK_OUTPUTDIR)/newdemo/jfc/CodePointIM/CodePointIM.jar META-INF/services/java.awt.im.spi.InputMethodDescriptor && \
+		$(JAR) uf $(JDK_OUTPUTDIR)/demo/jfc/CodePointIM/CodePointIM.jar META-INF/services/java.awt.im.spi.InputMethodDescriptor && \
 		cd META-INF/services && \
-		$(JAR) uf $(JDK_OUTPUTDIR)/newdemo/jfc/CodePointIM/CodePointIM.jar java.awt.im.spi.InputMethodDescriptor)
-	$(RM) -r $(JDK_OUTPUTDIR)/newdemo/jfc/CodePointIM/_the.tmp
+		$(JAR) uf $(JDK_OUTPUTDIR)/demo/jfc/CodePointIM/CodePointIM.jar java.awt.im.spi.InputMethodDescriptor)
+	$(RM) -r $(JDK_OUTPUTDIR)/demo/jfc/CodePointIM/_the.tmp
 	$(TOUCH) $@
 
-BUILD_DEMOS+=$(JDK_OUTPUTDIR)/newdemo/jfc/CodePointIM/_the.services
+BUILD_DEMOS+=$(JDK_OUTPUTDIR)/demo/jfc/CodePointIM/_the.services
 
 $(eval $(call SetupDemo,FileChooserDemo,jfc,,FileChooserDemo,,,README*))
 $(eval $(call SetupDemo,Font2DTest,jfc,,Font2DTest,,,*.html *.txt))
@@ -182,12 +184,12 @@
     $(eval $(call SetupDemo,Stylepad,jfc,,Stylepad,\
 		$(JDK_TOPDIR)/src/share/demo/jfc/Notepad,closed/,*.txt,,$(JDK_TOPDIR)/src/share/demo/jfc/Notepad/README.txt))
     $(eval $(call SetupDemo,SwingSet2,jfc,,SwingSet2,,closed/,README* *.html,,,.java COPYRIGHT,\
-		SplashScreen-Image: resources/images/splash.png,_NOSERV))
+		SplashScreen-Image: resources/images/splash.png,true))
 
     BUILD_DEMOS += $(patsubst $(JDK_TOPDIR)/src/closed/share/demo/nbproject/%,\
-			$(JDK_OUTPUTDIR)/newdemo/nbproject/%,\
+			$(JDK_OUTPUTDIR)/demo/nbproject/%,\
 			$(shell $(FIND) $(JDK_TOPDIR)/src/closed/share/demo/nbproject/ -type f))
-    $(JDK_OUTPUTDIR)/newdemo/nbproject/% : $(JDK_TOPDIR)/src/closed/share/demo/nbproject/%
+    $(JDK_OUTPUTDIR)/demo/nbproject/% : $(JDK_TOPDIR)/src/closed/share/demo/nbproject/%
 		$(MKDIR) -p $(@D)
 		$(CP) $< $@
 		$(CHMOD) -f ug+w $@
@@ -196,7 +198,7 @@
 ##################################################################################################
 
 # Why do we install a demo jar into the main jre/lib/ext????????????????
-$(JDK_OUTPUTDIR)/lib/ext/zipfs.jar : $(JDK_OUTPUTDIR)/newdemo/nio/zipfs/zipfs.jar
+$(JDK_OUTPUTDIR)/lib/ext/zipfs.jar : $(JDK_OUTPUTDIR)/demo/nio/zipfs/zipfs.jar
 		$(MKDIR) -p $(@D)
 		$(CP) $< $@
 
@@ -207,52 +209,74 @@
 # In the old makefiles, j2dbench was not compiled. 
 #$(eval $(call SetupDemo,J2DBench,java2d,/src,,j2dbench/J2DBench))
 
+# JVMTI demos are a bit strange and share some files, but be careful the
+#    shared files are just the *.c and *.h files, not the README or sample
+#    makefiles. So we always exclude the README.txt and sample.makefile.txt
+#    from the extra sources.
 define SetupJVMTIDemo
      # Param 1 = Name of the demo
      # Param 2 = add these directories to the includes, default is agent_util
      # Param 3 = extra CFLAGS
      # Param 4 = C or C++ (defaults to C)
      # Param 5 = libs for posix
-     # Param 6 = libs for winapi
+     # Param 6 = libs for windows
      # Param 7 = libs for solaris
-     BUILD_DEMO_JVMTI_$1_EXTRA_SRC:=	$$(wildcard $(JDK_TOPDIR)/src/$(LEGACY_OPENJDK_TARGET_OS_API)/demo/jvmti/$1) \
-					$$(wildcard $$(addprefix $(JDK_TOPDIR)/src/share/demo/jvmti/,$2))
+     BUILD_DEMO_JVMTI_$1_EXTRA_SRC:= \
+        $$(wildcard $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/demo/jvmti/$1) \
+	$$(wildcard $$(addprefix $(JDK_TOPDIR)/src/share/demo/jvmti/,$2))
+     BUILD_DEMO_JVMTI_$1_EXTRA_SRC_EXCLUDE:= \
+	$$(wildcard $$(addprefix $(JDK_TOPDIR)/src/share/demo/jvmti/,$2)/README.txt) \
+	$$(wildcard $$(addprefix $(JDK_TOPDIR)/src/share/demo/jvmti/,$2)/sample.makefile.txt)
      BUILD_DEMO_JVMTI_$1_EXTRA_INC:=$$(addprefix -I,$$(BUILD_DEMO_JVMTI_$1_EXTRA_SRC))
      BUILD_DEMO_JVMTI_$1_LANG:=C
-     BUILD_DEMO_JVMTI_$1_O_FLAG:=$(C_O_FLAG_NORM)
      ifneq (,$4)
          BUILD_DEMO_JVMTI_$1_LANG:=$4
      endif
      ifeq (C++,$4)
-         $1_EXTRA_CXX:=$(LIBCXX)
-         BUILD_DEMO_JVMTI_$1_O_FLAG:=$(CXX_O_FLAG_NORM)
+         $1_EXTRA_CXX:=$(LDFLAGS_CXX_JDK) $(LIBCXX)
      endif
 
-     $1_CXXFLAGS:=$(CXXFLAGS_JDKLIB) $$(BUILD_DEMO_JVMTI_$1_O_FLAG) -I$(JDK_TOPDIR)/src/share/demo/jvmti/$1 $$(BUILD_DEMO_JVMTI_$1_EXTRA_INC) $3
+     $1_CXXFLAGS:=$(CXXFLAGS_JDKLIB) -I$(JDK_TOPDIR)/src/share/demo/jvmti/$1 \
+		  $$(BUILD_DEMO_JVMTI_$1_EXTRA_INC) $3 \
+		  $(CXXFLAGS_DEBUG_SYMBOLS)
      ifeq ($1-$(OPENJDK_TARGET_CPU_ARCH),waiters-sparc)
-       $1_FILTER:=-xregs=no%appl
-       $1_CXXFLAGS:=$$(filter-out $$($1_FILTER),$$($1_CXXFLAGS))
+         $1_FILTER:=-xregs=no%appl
+         $1_CXXFLAGS:=$$(filter-out $$($1_FILTER),$$($1_CXXFLAGS))
      endif
 
+     # Workaround for CFLAGS_JDKLIB containing ',' on solaris. If this is added as 'CFLAGS' to the
+     # eval call below, the comma gets expanded too early.
+     BUILD_DEMO_JVMTI_$1_CFLAGS:=$(CFLAGS_JDKLIB) $(CFLAGS_DEBUG_SYMBOLS) \
+		-I$(JDK_TOPDIR)/src/share/demo/jvmti/$1 $$(BUILD_DEMO_JVMTI_$1_EXTRA_INC) $3
+
+     # Remove the -incremental:no setting to get .ilk-files like in the old build.
      $$(eval $$(call SetupNativeCompilation,BUILD_DEMO_JVMTI_$1,\
 		SRC:=$(JDK_TOPDIR)/src/share/demo/jvmti/$1 $$(BUILD_DEMO_JVMTI_$1_EXTRA_SRC),\
 		LANG:=$$(BUILD_DEMO_JVMTI_$1_LANG),\
-		CFLAGS:=$(CFLAGS_JDKLIB) $$(BUILD_DEMO_JVMTI_$1_O_FLAG) -I$(JDK_TOPDIR)/src/share/demo/jvmti/$1 $$(BUILD_DEMO_JVMTI_$1_EXTRA_INC) $3,\
+		OPTIMIZATION:=LOW,\
 		CXXFLAGS:=$$($1_CXXFLAGS),\
-		LDFLAGS:=$(LDFLAGS_JDKLIB),\
+		LDFLAGS:=$(filter-out -incremental:no -opt:ref,$(LDFLAGS_JDKLIB)),\
+		LDFLAGS_macosx:=$(call SET_EXECUTABLE_ORIGIN),\
 		LDFLAGS_SUFFIX:=$$($1_EXTRA_CXX),\
 		LDFLAGS_SUFFIX_posix:=$5,\
-		LDFLAGS_SUFFIX_winapi:=$6,\
-		LDFLAGS_SUFFIX_solaris:=-lc $7,\
-		OBJECT_DIR:=$(JDK_OUTPUTDIR)/newdemoobjs/jvmti/$1,\
-		OUTPUT_DIR:=$(JDK_OUTPUTDIR)/newdemo/jvmti/$1/lib,\
+		LDFLAGS_SUFFIX_windows:=$6,\
+		LDFLAGS_SUFFIX_solaris:=$7 -lc,\
+		LDFLAGS_SUFFIX_linux:=$8,\
+		VERSIONINFO_RESOURCE:=$(JDK_TOPDIR)/src/windows/resource/version.rc,\
+		RC_FLAGS:=$$(RC_FLAGS) \
+			  /D "JDK_FNAME=$1.dll" \
+			  /D "JDK_INTERNAL_NAME=$1" \
+			  /D "JDK_FTYPE=0x2L",\
+		OBJECT_DIR:=$(JDK_OUTPUTDIR)/demoobjs/jvmti/$1,\
+		OUTPUT_DIR:=$(JDK_OUTPUTDIR)/demo/jvmti/$1/lib,\
 		LIBRARY:=$1))
 
     $$(eval $$(call SetupZipArchive,BUILD_DEMO_JVMTI_SRC_$1,\
 		SRC:=$(JDK_TOPDIR)/src/share/demo/jvmti/$1 $$(BUILD_DEMO_JVMTI_$1_EXTRA_SRC),\
-		ZIP:=$(JDK_OUTPUTDIR)/newdemo/jvmti/$1/src.zip))
+		EXCLUDE_FILES:=$$(BUILD_DEMO_JVMTI_$1_EXTRA_SRC_EXCLUDE), \
+		ZIP:=$(JDK_OUTPUTDIR)/demo/jvmti/$1/src.zip))
 
-     $(JDK_OUTPUTDIR)/newdemo/jvmti/$1/README.txt : $(JDK_TOPDIR)/src/share/demo/jvmti/$1/README.txt
+     $(JDK_OUTPUTDIR)/demo/jvmti/$1/README.txt : $(JDK_TOPDIR)/src/share/demo/jvmti/$1/README.txt
 		$(MKDIR) -p $$(@D)
 		$(CP) $$< $$@
 		$(CHMOD) -f ug+w $$@
@@ -261,29 +285,40 @@
          $$(eval $$(call SetupJavaCompilation,BUILD_DEMO_JVMTI_$1_JAVA,\
                 SETUP:=GENERATE_USINGJDKBYTECODE,\
 		SRC:=$(JDK_TOPDIR)/src/share/demo/jvmti/$1,\
-		BIN:=$(JDK_OUTPUTDIR)/newdemoclasses/jvmti/$1,\
+		BIN:=$(JDK_OUTPUTDIR)/democlasses/jvmti/$1,\
 		COPY:=$(PATTERNS_TO_COPY),\
-		JAR:=$(JDK_OUTPUTDIR)/newdemo/jvmti/$1/$1.jar,\
+		JAR:=$(JDK_OUTPUTDIR)/demo/jvmti/$1/$1.jar,\
 		EXTRA_MANIFEST_ATTR:=Main-Class: \n,\
 		MANIFEST:=$(JDK_TOPDIR)/make/tools/manifest.mf))
 
-         BUILD_DEMOS += $(JDK_OUTPUTDIR)/newdemo/jvmti/$1/$1.jar
+         BUILD_DEMOS += $(JDK_OUTPUTDIR)/demo/jvmti/$1/$1.jar
      endif
 
      BUILD_DEMOS += 	$$(BUILD_DEMO_JVMTI_$1) \
-			$(JDK_OUTPUTDIR)/newdemo/jvmti/$1/src.zip \
-			$(JDK_OUTPUTDIR)/newdemo/jvmti/$1/README.txt
+			$(JDK_OUTPUTDIR)/demo/jvmti/$1/src.zip \
+			$(JDK_OUTPUTDIR)/demo/jvmti/$1/README.txt
+
+     ifeq ($(OPENJDK_TARGET_OS),windows)
+         # These files normally end up in OBJECT_DIR but for demos they
+         # are supposed to be included in the distro.
+         $(JDK_OUTPUTDIR)/demo/jvmti/$1/lib/$1.lib: $$(BUILD_DEMO_JVMTI_$1)
+		$(CP) $(JDK_OUTPUTDIR)/demoobjs/jvmti/$1/$1.lib $$@
+
+         $(JDK_OUTPUTDIR)/demo/jvmti/$1/lib/$1.exp: $$(BUILD_DEMO_JVMTI_$1)
+		$(CP) $(JDK_OUTPUTDIR)/demoobjs/jvmti/$1/$1.exp $$@
+
+         BUILD_DEMOS += $(JDK_OUTPUTDIR)/demo/jvmti/$1/lib/$1.lib \
+			$(JDK_OUTPUTDIR)/demo/jvmti/$1/lib/$1.exp
+     endif
 endef
 
 $(eval $(call SetupJVMTIDemo,compiledMethodLoad,	agent_util))
 $(eval $(call SetupJVMTIDemo,gctest,			agent_util))
 $(eval $(call SetupJVMTIDemo,heapTracker,		agent_util java_crw_demo))
 $(eval $(call SetupJVMTIDemo,heapViewer,		agent_util))
-# hprof contains error messages using __FILE__ macro. These expand to the absolute path
-# in the new build system and relative in the old, causing the binaries to differ.
 $(eval $(call SetupJVMTIDemo,hprof,			java_crw_demo,\
-		-I$(JDK_TOPDIR)/src/share/npt -I$(JDK_TOPDIR)/src/$(LEGACY_OPENJDK_TARGET_OS_API)/npt,C,\
-		-ldl,ws2_32.lib winmm.lib,-lsocket -lnsl))
+		-I$(JDK_TOPDIR)/src/share/npt -I$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/npt,C,\
+		-ldl,ws2_32.lib winmm.lib,-lsocket -lnsl,-lpthread))
 
 $(eval $(call SetupJVMTIDemo,minst,			agent_util java_crw_demo))
 $(eval $(call SetupJVMTIDemo,mtrace,			agent_util java_crw_demo))
@@ -298,11 +333,11 @@
 # The number of files are few enough so that we can use echo safely below to list them.
 JPDA_FILES:=$(subst $(JDK_TOPDIR)/src/share/classes/,,$(JPDA_SOURCES))
 
-$(JDK_OUTPUTDIR)/newdemo/jpda/src.zip : $(JPDA_SOURCES)
+$(JDK_OUTPUTDIR)/demo/jpda/src.zip : $(JPDA_SOURCES)
 		$(MKDIR) -p $(@D)
 		(cd $(JDK_TOPDIR)/src/share/classes && $(ZIP) -qru $@ com -i "com/sun/tools/example/*")
 
-$(JDK_OUTPUTDIR)/newdemo/jpda/examples.jar : $(JPDA_SOURCES)
+$(JDK_OUTPUTDIR)/demo/jpda/examples.jar : $(JPDA_SOURCES)
 		$(MKDIR) -p $(@D)
 		$(RM) $(@D)/_the.sources
 		$(call ListPathsSafely,JPDA_FILES,\n, >> $(@D)/_the.sources)
@@ -312,103 +347,104 @@
 		(cd $(JDK_TOPDIR)/src/share/classes && $(JAR) cfm  $@ $(@D)/_the.manifest @$(@D)/_the.sources)
 		(cd $(JDK_TOPDIR)/src/share/classes/com/sun/tools/example && $(JAR) uf $@ README)
 
-$(JDK_OUTPUTDIR)/newdemo/jpda/com/sun/tools/example/README : $(JDK_TOPDIR)/src/share/classes/com/sun/tools/example/README
+$(JDK_OUTPUTDIR)/demo/jpda/com/sun/tools/example/README : $(JDK_TOPDIR)/src/share/classes/com/sun/tools/example/README
 		$(MKDIR) -p $(@D)
 		$(CP) $< $@
 		$(CHMOD) -f ug+w $@
 
-BUILD_DEMOS += $(JDK_OUTPUTDIR)/newdemo/jpda/src.zip $(JDK_OUTPUTDIR)/newdemo/jpda/examples.jar \
-		$(JDK_OUTPUTDIR)/newdemo/jpda/com/sun/tools/example/README
+BUILD_DEMOS += $(JDK_OUTPUTDIR)/demo/jpda/src.zip $(JDK_OUTPUTDIR)/demo/jpda/examples.jar \
+		$(JDK_OUTPUTDIR)/demo/jpda/com/sun/tools/example/README
 
 ##################################################################################################
 
-$(JDK_OUTPUTDIR)/newdemo/management/index.html : $(JDK_TOPDIR)/src/share/demo/management/index.html
+$(JDK_OUTPUTDIR)/demo/management/index.html : $(JDK_TOPDIR)/src/share/demo/management/index.html
 		$(MKDIR) -p $(@D)
 		$(CP) $< $@
 		$(CHMOD) -f ug+w $@
 
-$(JDK_OUTPUTDIR)/newdemo/jvmti/index.html : $(JDK_TOPDIR)/src/share/demo/jvmti/index.html
+$(JDK_OUTPUTDIR)/demo/jvmti/index.html : $(JDK_TOPDIR)/src/share/demo/jvmti/index.html
 		$(MKDIR) -p $(@D)
 		$(CP) $< $@
 		$(CHMOD) -f ug+w $@
 
-BUILD_DEMOS += $(JDK_OUTPUTDIR)/newdemo/management/index.html \
-		$(JDK_OUTPUTDIR)/newdemo/jvmti/index.html
+BUILD_DEMOS += $(JDK_OUTPUTDIR)/demo/management/index.html \
+		$(JDK_OUTPUTDIR)/demo/jvmti/index.html
 
 ##################################################################################################
 
 # The netbeans project files are copied into the demo directory.
 BUILD_DEMOS += $(patsubst $(JDK_TOPDIR)/src/share/demo/nbproject/%,\
-		$(JDK_OUTPUTDIR)/newdemo/nbproject/%,\
+		$(JDK_OUTPUTDIR)/demo/nbproject/%,\
 		$(shell $(FIND) $(JDK_TOPDIR)/src/share/demo/nbproject/ -type f))
 
-$(JDK_OUTPUTDIR)/newdemo/nbproject/% : $(JDK_TOPDIR)/src/share/demo/nbproject/%
+$(JDK_OUTPUTDIR)/demo/nbproject/% : $(JDK_TOPDIR)/src/share/demo/nbproject/%
 	$(MKDIR) -p $(@D)
 	$(CP) $< $@
 	$(CHMOD) -f ug+w $@
 
 ##################################################################################################
 
-$(JDK_OUTPUTDIR)/newdemo/README: $(JDK_TOPDIR)/src/share/demo/README
+$(JDK_OUTPUTDIR)/demo/README: $(JDK_TOPDIR)/src/share/demo/README
 	$(MKDIR) -p $(@D)
 	$(CP) $< $@
 
-BUILD_DEMOS += $(JDK_OUTPUTDIR)/newdemo/README
+BUILD_DEMOS += $(JDK_OUTPUTDIR)/demo/README
 
 ##################################################################################################
 
 ifeq ($(OPENJDK_TARGET_OS), solaris)
 
-$(JDK_OUTPUTDIR)/newdemoclasses/jni/Poller/% : $(JDK_TOPDIR)/src/solaris/demo/jni/Poller/%
+$(JDK_OUTPUTDIR)/democlasses/jni/Poller/% : $(JDK_TOPDIR)/src/solaris/demo/jni/Poller/%
 		$(MKDIR) -p $(@D)
 		$(CP) $< $@
 		$(CHMOD) -f ug+w $@
 
-$(JDK_OUTPUTDIR)/newdemo/jni/Poller/README.txt : $(JDK_TOPDIR)/src/solaris/demo/jni/Poller/README.txt
+$(JDK_OUTPUTDIR)/demo/jni/Poller/README.txt : $(JDK_TOPDIR)/src/solaris/demo/jni/Poller/README.txt
 		$(MKDIR) -p $(@D)
 		$(CP) $< $@
 		$(CHMOD) -f ug+w $@
 
-$(JDK_OUTPUTDIR)/newdemo/jni/Poller/Poller.jar : \
-  $(JDK_OUTPUTDIR)/newdemoclasses/jni/Poller/README.txt $(JDK_OUTPUTDIR)/newdemoclasses/jni/Poller/Poller.c
+$(JDK_OUTPUTDIR)/demo/jni/Poller/Poller.jar : \
+  $(JDK_OUTPUTDIR)/democlasses/jni/Poller/README.txt $(JDK_OUTPUTDIR)/democlasses/jni/Poller/Poller.c
 
 $(eval $(call SetupJavaCompilation,BUILD_DEMO_POLLER_JAR,\
 		SETUP:=GENERATE_USINGJDKBYTECODE, \
 		SRC:=$(JDK_TOPDIR)/src/solaris/demo/jni/Poller, \
-		BIN:=$(JDK_OUTPUTDIR)/newdemoclasses/jni/Poller, \
-		HEADERS:=$(JDK_OUTPUTDIR)/newdemoclasses/jni/Poller, \
-		JAR:=$(JDK_OUTPUTDIR)/newdemo/jni/Poller/Poller.jar, \
+		BIN:=$(JDK_OUTPUTDIR)/democlasses/jni/Poller, \
+		HEADERS:=$(JDK_OUTPUTDIR)/democlasses/jni/Poller, \
+		JAR:=$(JDK_OUTPUTDIR)/demo/jni/Poller/Poller.jar, \
 		MANIFEST:=$(JDK_TOPDIR)/make/tools/manifest.mf, \
-		SRCZIP:=$(JDK_OUTPUTDIR)/newdemo/jni/Poller/src.zip, \
-		COPY := README.txt Poller.c, \
-		JARMAIN := Client))
+		SRCZIP:=$(JDK_OUTPUTDIR)/demo/jni/Poller/src.zip, \
+		COPY:=README.txt Poller.c, \
+		JARMAIN:=Client))
 
 
 
-BUILD_DEMOS += $(JDK_OUTPUTDIR)/newdemo/jni/Poller/Poller.jar $(JDK_OUTPUTDIR)/newdemo/jni/Poller/src.zip \
-               $(JDK_OUTPUTDIR)/newdemo/jni/Poller/README.txt
+BUILD_DEMOS += $(JDK_OUTPUTDIR)/demo/jni/Poller/Poller.jar $(JDK_OUTPUTDIR)/demo/jni/Poller/src.zip \
+               $(JDK_OUTPUTDIR)/demo/jni/Poller/README.txt
 
 $(eval $(call SetupNativeCompilation,BUILD_LIBPOLLER,\
 		SRC:=$(JDK_TOPDIR)/src/solaris/demo/jni/Poller, \
-		LANG := C, \
-		CFLAGS:=$(CFLAGS_JDKLIB) $(C_O_FLAG_NORM) $(SHARED_LIBRARY_FLAGS) \
-                        -I$(JDK_OUTPUTDIR)/newdemoclasses/jni/Poller, \
+		LANG:=C,\
+		OPTIMIZATION:=LOW,\
+		CFLAGS:=$(CFLAGS_JDKLIB) $(SHARED_LIBRARY_FLAGS) \
+                        -I$(JDK_OUTPUTDIR)/democlasses/jni/Poller, \
 		LDFLAGS:=$(LDFLAGS_JDKLIB), \
-		OBJECT_DIR:=$(JDK_OUTPUTDIR)/newdemoobjs/jni/Poller,\
-                OUTPUT_DIR:=$(JDK_OUTPUTDIR)/newdemoobjs, \
+		OBJECT_DIR:=$(JDK_OUTPUTDIR)/demoobjs/jni/Poller,\
+                OUTPUT_DIR:=$(JDK_OUTPUTDIR)/demoobjs, \
 		LIBRARY:=Poller))
 
 #
 # We can only compile native code after jar has been build (since we depend on generated .h files)
 #
-$(JDK_OUTPUTDIR)/newdemoobjs/jni/Poller/Poller.o : $(JDK_OUTPUTDIR)/newdemo/jni/Poller/Poller.jar
+$(JDK_OUTPUTDIR)/demoobjs/jni/Poller/Poller.o : $(JDK_OUTPUTDIR)/demo/jni/Poller/Poller.jar
 
-$(JDK_OUTPUTDIR)/newdemo/jni/Poller/lib/$(LIBRARY_PREFIX)Poller$(SHARED_LIBRARY_SUFFIX) : \
-  $(JDK_OUTPUTDIR)/newdemoobjs/$(LIBRARY_PREFIX)Poller$(SHARED_LIBRARY_SUFFIX)
+$(JDK_OUTPUTDIR)/demo/jni/Poller/lib/$(LIBRARY_PREFIX)Poller$(SHARED_LIBRARY_SUFFIX) : \
+  $(JDK_OUTPUTDIR)/demoobjs/$(LIBRARY_PREFIX)Poller$(SHARED_LIBRARY_SUFFIX)
 	$(MKDIR) -p $(@D)
 	$(CP) $< $@
 
-BUILD_DEMOS += $(JDK_OUTPUTDIR)/newdemo/jni/Poller/lib/$(LIBRARY_PREFIX)Poller$(SHARED_LIBRARY_SUFFIX)
+BUILD_DEMOS += $(JDK_OUTPUTDIR)/demo/jni/Poller/lib/$(LIBRARY_PREFIX)Poller$(SHARED_LIBRARY_SUFFIX)
 
 endif
 
@@ -417,20 +453,20 @@
 ifndef OPENJDK
     DB_DEMO_ZIPFILE := $(shell $(FIND) $(JDK_TOPDIR)/src/closed/share/db -name "*demo*.zip")
 
-    $(JDK_OUTPUTDIR)/newdemo/_the.db.unzipped: $(DB_DEMO_ZIPFILE)
+    $(JDK_OUTPUTDIR)/demo/_the.db.unzipped: $(DB_DEMO_ZIPFILE)
 	$(MKDIR) -p $(@D)
-	$(RM) -rf $(JDK_OUTPUTDIR)/newdemo/db $(JDK_OUTPUTDIR)/newdemo/demo
-	$(CD) $(JDK_OUTPUTDIR)/newdemo && $(UNZIP) -o $<
-	$(MV) $(JDK_OUTPUTDIR)/newdemo/demo $(JDK_OUTPUTDIR)/newdemo/db
+	$(RM) -r $(JDK_OUTPUTDIR)/demo/db $(JDK_OUTPUTDIR)/demo/demo
+	$(CD) $(JDK_OUTPUTDIR)/demo && $(UNZIP) -o $<
+	$(MV) $(JDK_OUTPUTDIR)/demo/demo $(JDK_OUTPUTDIR)/demo/db
 	$(TOUCH) $@
 
 #    Copy this after the unzip above to avoid race with directory creation and mv command.
-     $(JDK_OUTPUTDIR)/newdemo/db/README-JDK-DEMOS.html: \
+     $(JDK_OUTPUTDIR)/demo/db/README-JDK-DEMOS.html: \
 		$(JDK_TOPDIR)/src/closed/share/db/README-JDK-DEMOS.html \
-		| $(JDK_OUTPUTDIR)/newdemo/_the.db.unzipped
+		| $(JDK_OUTPUTDIR)/demo/_the.db.unzipped
 	$(MKDIR) -p $(@D)
 	$(CP) '$<' '$@'
-     BUILD_DEMOS += $(JDK_OUTPUTDIR)/newdemo/_the.db.unzipped $(JDK_OUTPUTDIR)/newdemo/db/README-JDK-DEMOS.html
+     BUILD_DEMOS += $(JDK_OUTPUTDIR)/demo/_the.db.unzipped $(JDK_OUTPUTDIR)/demo/db/README-JDK-DEMOS.html
 endif
 
 ##################################################################################################
--- a/jdk/makefiles/CompileJavaClasses.gmk	Wed Jul 05 18:22:17 2017 +0200
+++ b/jdk/makefiles/CompileJavaClasses.gmk	Wed Jul 05 18:22:52 2017 +0200
@@ -45,10 +45,6 @@
 		com/sun/tools/example/debug/gui \
 		com/oracle/security
 
-ifeq ($(OPENJDK_TARGET_OS)-$(ARCH_DATA_MODEL),windows-64)
-     EXCLUDES += sun/security/pkcs11
-endif
-
 ifdef OPENJDK
     EXCLUDES+=	sun/dc \
 		com/sun/jmx/snmp \
@@ -59,6 +55,13 @@
 ifndef OPENJDK
    # There exists two versions of this file...
    EXFILES := $(JDK_TOPDIR)/src/share/classes/javax/crypto/JarVerifier.java
+
+   ifeq ($(OPENJDK_TARGET_OS),windows)
+      # This gets built on unix platforms implicitly in the old build even though
+      # it's excluded in the closed build.
+      EXCLUDES+=sun/java2d/pisces
+   endif
+
 endif
 
 ifneq ($(OPENJDK_TARGET_OS),solaris)
@@ -90,12 +93,14 @@
     # Exclude Window security related files in src/share/classes
     EXFILES+=NTLoginModule.java \
              NTSystem.java
-
+else
+    EXFILES+=UnixLoginModule.java \
+	     UnixSystem.java
 endif
 
 ifeq ($(OPENJDK_TARGET_OS),windows)
     # Don't build GTK L&F on Windows
-    EXCLUDES+=	com/sun/java/swing/plaf/gtk
+    EXCLUDES+=com/sun/java/swing/plaf/gtk
 endif
 
 ifneq ($(OPENJDK_TARGET_OS),linux)
@@ -115,6 +120,9 @@
 	     sun/nio/fs/BsdFileSystem.java \
              sun/nio/fs/BsdFileSystemProvider.java \
              sun/nio/fs/BsdNativeDispatcher.java \
+             sun/nio/fs/MacOSXFileSystemProvider.java \
+             sun/nio/fs/MacOSXFileSystem.java \
+             sun/nio/fs/MacOSXNativeDispatcher.java \
              sun/tools/attach/BsdAttachProvider.java \
              sun/tools/attach/BsdVirtualMachine.java
 endif
@@ -122,7 +130,7 @@
 # Exclude BreakIterator classes that are just used in compile process to generate
 # data files and shouldn't go in the product
 EXFILES+=sun/text/resources/BreakIteratorRules.java \
-	sun/text/resources/BreakIteratorRules_th.java
+	 sun/text/resources/BreakIteratorRules_th.java
 
 # TODO: Add BUILD_HEADLESS_ONLY to configure?
 ifdef BUILD_HEADLESS_ONLY
@@ -245,7 +253,7 @@
 
 ifndef OPENJDK
     CLOSED_SRC_DIRS:=$(JDK_TOPDIR)/src/closed/share/classes \
-		     $(JDK_TOPDIR)/src/closed/$(LEGACY_OPENJDK_TARGET_OS_API)/classes
+		     $(JDK_TOPDIR)/src/closed/$(OPENJDK_TARGET_OS_API_DIR)/classes
 endif
 
 MACOSX_SRC_DIRS :=
@@ -257,7 +265,8 @@
                $(JDK_TOPDIR)/src/solaris/classes/sun/java2d/BackBufferCapsProvider.java \
                $(JDK_TOPDIR)/src/solaris/classes/java/net/DefaultInterface.java \
                $(JDK_TOPDIR)/src/solaris/classes/java/lang/ClassLoaderHelper.java \
-               $(JDK_TOPDIR)/src/solaris/classes/sun/util/locale/provider/HostLocaleProviderAdapterImpl.java
+               $(JDK_TOPDIR)/src/solaris/classes/sun/util/locale/provider/HostLocaleProviderAdapterImpl.java \
+               $(JDK_TOPDIR)/src/solaris/classes/sun/nio/fs/GnomeFileTypeDetector.java
 
      # JObjC.jar contains 1.5 byte-code...so skip it here :-(
      # MACOSX_SRC_DIRS += $(JDK_TOPDIR)/src/macosx/native/jobjc/src
@@ -273,14 +282,21 @@
 	$(MKDIR) -p $(@D)
 	$(CP) $< $@
 
+# The JDK_USER_DEFINED_FILTER is a poor man's incremental build: by specifying
+# JDK_FILTER at the make command line, only a subset of the JDK java files will
+# be recompiled. If multiple paths are separated by comma, convert that into a
+# space separated list.
+JDK_USER_DEFINED_FILTER:=$(strip $(subst $(COMMA),$(SPACE),$(JDK_FILTER)))
+
 $(eval $(call SetupJavaCompilation,BUILD_JDK,\
                 SETUP:=GENERATE_JDKBYTECODE,\
 		SRC:=$(JDK_TOPDIR)/src/share/classes \
-		     $(JDK_TOPDIR)/src/$(LEGACY_OPENJDK_TARGET_OS_API)/classes \
+		     $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/classes \
 		     $(MACOSX_SRC_DIRS) \
 		     $(JDK_OUTPUTDIR)/gensrc \
 		     $(JDK_OUTPUTDIR)/gensrc_swing/javax/swing/beaninfo \
 		     $(CLOSED_SRC_DIRS),\
+		INCLUDES:=$(JDK_USER_DEFINED_FILTER),\
 		EXCLUDES:=$(EXCLUDES),\
 		EXCLUDE_FILES:=$(EXFILES),\
 		BIN:=$(JDK_OUTPUTDIR)/classes,\
@@ -360,13 +376,12 @@
 $(eval $(call SetupJavaCompiler,GENERATE_15BYTECODE,\
      JAVAC:=$(JAVAC),\
      FLAGS:=-source 1.5 -target 1.5 -g -bootclasspath $(BOOT_RTJAR) -cp $(JDK_OUTPUTDIR)/../langtools/dist/lib/classes.jar $(DISABLE_WARNINGS),\
-     SERVER_DIR:=$(JAVAC_SERVERS),\
-     SERVER_JVM:=$(SERVER_JAVA),\
-     MODE:=$(JAVAC_USE_MODE),\
-     USE_DEPS:=$(JAVAC_USE_DEPS)))
+     SERVER_DIR:=$(SJAVAC_SERVER_DIR),\
+     SERVER_JVM:=$(SJAVAC_SERVER_JAVA)))
 
 $(eval $(call SetupJavaCompilation,BUILD_JOBJC_JAR,\
 		SETUP:=GENERATE_15BYTECODE,\
+		DISABLE_SJAVAC:=true,\
 		SRC:=$(JDK_TOPDIR)/src/macosx/native/jobjc/src/core/java \
 		     $(JDK_TOPDIR)/src/macosx/native/jobjc/src/runtime-additions/java \
 		     $(JDK_OUTPUTDIR)/gensrc, \
--- a/jdk/makefiles/CompileLaunchers.gmk	Wed Jul 05 18:22:17 2017 +0200
+++ b/jdk/makefiles/CompileLaunchers.gmk	Wed Jul 05 18:22:52 2017 +0200
@@ -1,511 +1,557 @@
-#
-# Copyright (c) 2011, 2012, 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.
-#
-
-defalt: all
-
-include $(SPEC)
-include MakeBase.gmk
-include NativeCompilation.gmk
-
-# Setup the java compilers for the JDK build.
-include Setup.gmk
-
-# Build tools
-include Tools.gmk
-
-BUILD_LAUNCHERS=
-
-define SetupLauncher
-    # TODO: Fix mapfile on solaris. Won't work with ld as linker.
-    # Parameter 1 is the name of the launcher (java,javac,jar...)
-    # Parameter 2 is extra CFLAGS
-    # Parameter 3 is extra LDFLAGS
-    # Parameter 4 is extra LDFLAGS_SUFFIX_posix
-    # Parameter 5 is extra LDFLAGS_SUFFIX_winapi
-    # Parameter 6 is optional Windows JLI library (full path)
-    # Parameter 7 is optional Windows resource (RC) flags
-    # Parameter 8 is optional Windows version resource file (.rc)
-    # Parameter 9  is different output dir
-    # Parameter 10 is FULL DEBUG SYMBOLS (set value to turn OFF, since most(all) seems to have it)
-
-    $1_WINDOWS_JLI_LIB:=$(JDK_OUTPUTDIR)/objs/libjli/jli.lib
-    ifneq ($6,)
-        $1_WINDOWS_JLI_LIB:=$6
-    endif
-    $1_VERSION_INFO_RESOURCE:=$(JDK_TOPDIR)/src/windows/resource/version.rc
-    ifneq ($8,)
-        $1_VERSION_INFO_RESOURCE:=$8
-    endif
-
-    $1_LDFLAGS := $3
-    ifeq ($(OPENJDK_TARGET_OS), macosx)
-        $1_LDFLAGS += -F/System/Library/Frameworks/JavaVM.framework/Frameworks \
-                       -F/System/Library/Frameworks/ApplicationServices.framework/Frameworks
-    endif
-
-    $1_LDFLAGS_SUFFIX :=
-    ifeq ($(USE_EXTERNAL_LIBZ), true)
-        $1_LDFLAGS_SUFFIX += -lz
-    endif
-
-    ifeq ($(OPENJDK_TARGET_OS), macosx)
-        $1_LDFLAGS_SUFFIX += -Wl,-all_load $(JDK_OUTPUTDIR)/objs/libjli_static.a \
-                             -framework Cocoa -framework Security -framework ApplicationServices \
-                             -sectcreate __TEXT __info_plist $(JDK_TOPDIR)/src/macosx/lib/Info-cmdline.plist
-    endif
-
-
-    $1_OUTPUT_DIR_ARG:=$9
-    ifeq (,$$($1_OUTPUT_DIR_ARG))
-        $1_OUTPUT_DIR_ARG:=$(JDK_OUTPUTDIR)/bin
-    endif
-
-    $1_DEBUG_SYMBOLS:=yes
-    ifneq (,$(10))
-      $1_DEBUG_SYMBOLS:=
-    endif
-
-    $1_OPTIMIZATION:= LOW
-
-    # TODO: maybe it's better to move this if-statement out of this function
-    ifeq ($(1),java)
-      $1_OPTIMIZATION:=HIGH
-    endif
-
-    $(call SetupNativeCompilation,BUILD_LAUNCHER_$1,\
-	SRC:=$(JDK_TOPDIR)/src/share/bin,\
-	INCLUDE_FILES:=main.c,\
-	LANG:=C,\
-	OPTIMIZATION :=$$($1_OPTIMIZATION), \
-	CFLAGS:=$(CFLAGS_JDKEXE) \
-		-I$(JDK_TOPDIR)/src/share/bin \
-		-I$(JDK_TOPDIR)/src/$(LEGACY_OPENJDK_TARGET_OS_API)/bin \
-		-I$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS)/bin \
-                -DFULL_VERSION='"$(FULL_VERSION)"' \
-                -DJDK_MAJOR_VERSION='"$(JDK_MAJOR_VERSION)"' \
-                -DJDK_MINOR_VERSION='"$(JDK_MINOR_VERSION)"' \
-		-DLIBARCHNAME='"$(ARCH)"' \
-		-DLAUNCHER_NAME='"java"' \
-		-DPROGNAME='"$1"' $(DPACKAGEPATH) \
-		$2,\
-	CFLAGS_linux:=-fPIC,\
-        CFLAGS_solaris:=-KPIC -DHAVE_GETHRTIME,\
-	LDFLAGS:=$(LDFLAGS_JDKEXE) \
-                 $(call SET_SHARED_LIBRARY_ORIGIN,../lib/$(LIBARCH)/jli) \
-                 $(call SET_SHARED_LIBRARY_ORIGIN,../jre/lib/$(LIBARCH)/jli) \
-		 $$($1_LDFLAGS),\
-	MAPFILE := $(JDK_TOPDIR)/makefiles/mapfiles/launchers/mapfile-$(ARCH), \
-        LDFLAGS_SUFFIX:=$(LDFLAGS_JDKEXE_SUFFIX) $$($1_LDFLAGS_SUFFIX),\
-	LDFLAGS_SUFFIX_posix:=$4 -lc,\
-	LDFLAGS_SUFFIX_winapi:=$$($1_WINDOWS_JLI_LIB) \
-			       $(JDK_OUTPUTDIR)/objs/libjava/java.lib advapi32.lib $5,\
-	LDFLAGS_SUFFIX_solaris := -lthread $(LIBDL), \
-	OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/$1_objs,\
-	OUTPUT_DIR:=$$($1_OUTPUT_DIR_ARG),\
-	PROGRAM:=$1,\
-	DEBUG_SYMBOLS:=$$($1_DEBUG_SYMBOLS),\
-	VERSIONINFO_RESOURCE:=$$($1_VERSION_INFO_RESOURCE),\
-	RC_FLAGS:=$(RC_FLAGS)\
-		  /D "JDK_FNAME=$1$(EXE_SUFFIX)" \
-		  /D "JDK_INTERNAL_NAME=$1" \
-		  /D "JDK_FTYPE=0x1L" \
-		  $7,\
-	MANIFEST:=$(JDK_TOPDIR)/src/windows/resource/java.manifest)
-
-    BUILD_LAUNCHERS += $$(BUILD_LAUNCHER_$1)
-
-    ifeq ($(OPENJDK_TARGET_OS),macosx)
-        $$(BUILD_LAUNCHER_$1) : $(JDK_OUTPUTDIR)/objs/libjli_static.a
-    endif
-
-    ifeq ($(OPENJDK_TARGET_OS),windows)
-        $$(BUILD_LAUNCHER_$1) : $(JDK_OUTPUTDIR)/objs/libjava/java.lib \
-				$$($1_WINDOWS_JLI_LIB)
-    endif    	 
-endef
-
-##########################################################################################
-
-XLIBS:=$(X_LIBS) -lX11
-ifeq ($(OPENJDK_TARGET_OS),macosx)
-    DPACKAGEPATH:=-DPACKAGE_PATH='"$(PACKAGE_PATH)"'
-    XLIBS:=
-endif
-
-ifdef OPENJDK
-    JAVA_RC_FLAGS += -i "$(JDK_TOPDIR)/src/windows/resource/icons"
-else
-    JAVA_RC_FLAGS += -i "$(JDK_TOPDIR)/src/closed/windows/native/sun/windows"
-endif
-
-$(eval $(call SetupLauncher,java,\
-    -DEXPAND_CLASSPATH_WILDCARDS,,,user32.lib comctl32.lib,\
-    $(JDK_OUTPUTDIR)/objs/jli_static.lib,$(JAVA_RC_FLAGS),\
-    $(JDK_TOPDIR)/src/windows/resource/java.rc))
-
-ifeq ($(OPENJDK_TARGET_OS),windows)
-    $(eval $(call SetupLauncher,javaw,\
-        -DEXPAND_CLASSPATH_WILDCARDS,,,user32.lib comctl32.lib,\
-        $(JDK_OUTPUTDIR)/objs/jli_static.lib,$(JAVA_RC_FLAGS),\
-        $(JDK_TOPDIR)/src/windows/resource/java.rc))
-endif
-
-ifeq ($(OPENJDK_TARGET_OS),solaris)
-    THREAD_LIB:=-lthread
-endif
-ifeq ($(OPENJDK_TARGET_OS),linux)
-    THREAD_LIB:=-lpthread
-endif
-
-ifndef BUILD_HEADLESS_ONLY
-$(eval $(call SetupLauncher,appletviewer,\
-    -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "sun.applet.Main"$(COMMA) }',,\
-    $(THREAD_LIB) $(XLIBS) -ldl))
-endif
-
-$(eval $(call SetupLauncher,extcheck,\
-    -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "com.sun.tools.extcheck.Main"$(COMMA) }'))
-
-$(eval $(call SetupLauncher,idlj,\
-    -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "com.sun.tools.corba.se.idl.toJavaPortable.Compile"$(COMMA) }'))
-
-$(eval $(call SetupLauncher,jar,\
-    -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "sun.tools.jar.Main"$(COMMA) }'))
-
-$(eval $(call SetupLauncher,jarsigner,\
-    -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "sun.security.tools.JarSigner"$(COMMA) }'))
-
-$(eval $(call SetupLauncher,javac,\
-    -DEXPAND_CLASSPATH_WILDCARDS \
-    -DNEVER_ACT_AS_SERVER_CLASS_MACHINE \
-    -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "com.sun.tools.javac.Main"$(COMMA) }'))
-
-$(eval $(call SetupLauncher,javadoc,\
-    -DEXPAND_CLASSPATH_WILDCARDS \
-    -DNEVER_ACT_AS_SERVER_CLASS_MACHINE \
-    -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "com.sun.tools.javadoc.Main"$(COMMA) }'))
-
-$(eval $(call SetupLauncher,javah,\
-    -DEXPAND_CLASSPATH_WILDCARDS \
-    -DNEVER_ACT_AS_SERVER_CLASS_MACHINE \
-    -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "com.sun.tools.javah.Main"$(COMMA) }'))
-
-$(eval $(call SetupLauncher,javap,\
-    -DEXPAND_CLASSPATH_WILDCARDS \
-    -DNEVER_ACT_AS_SERVER_CLASS_MACHINE \
-    -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "com.sun.tools.javap.Main"$(COMMA) }'))
-
-BUILD_LAUNCHER_jconsole_CPPFLAGS_windows:=-DJAVAW
-BUILD_LAUNCHER_jconsole_LDFLAGS_windows:=user32.lib
-
-$(eval $(call SetupLauncher,jconsole,\
-    -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "-J-Djconsole.showOutputViewer"$(COMMA) "sun.tools.jconsole.JConsole"$(COMMA) }' \
-    -DAPP_CLASSPATH='{ "/lib/jconsole.jar"$(COMMA) "/lib/tools.jar"$(COMMA) "/classes" }'))
-
-$(eval $(call SetupLauncher,jdb,\
-    -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "com.sun.tools.example.debug.tty.TTY"$(COMMA) }' \
-    -DAPP_CLASSPATH='{ "/lib/tools.jar"$(COMMA) "/lib/sa-jdi.jar"$(COMMA) "/classes" }'))
-
-$(eval $(call SetupLauncher,jhat,\
-    -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "com.sun.tools.hat.Main"$(COMMA) }'))
-
-$(eval $(call SetupLauncher,jinfo,\
-    -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) \
-		   "-J-Dsun.jvm.hotspot.debugger.useProcDebugger"$(COMMA) \
-		   "-J-Dsun.jvm.hotspot.debugger.useWindbgDebugger"$(COMMA) \
-		   "sun.tools.jinfo.JInfo"$(COMMA) }' \
-    -DAPP_CLASSPATH='{ "/lib/tools.jar"$(COMMA) "/lib/sa-jdi.jar"$(COMMA) "/classes" }'))
-
-$(eval $(call SetupLauncher,jmap,\
-    -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) \
-		   "-J-Dsun.jvm.hotspot.debugger.useProcDebugger"$(COMMA) \
-		   "-J-Dsun.jvm.hotspot.debugger.useWindbgDebugger"$(COMMA) \
-		   "sun.tools.jmap.JMap"$(COMMA) }' \
-    -DAPP_CLASSPATH='{ "/lib/tools.jar"$(COMMA) "/lib/sa-jdi.jar"$(COMMA) "/classes" }'))
-
-$(eval $(call SetupLauncher,jps,\
-    -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "sun.tools.jps.Jps"$(COMMA) }'))
-
-$(eval $(call SetupLauncher,jrunscript,\
-    -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "com.sun.tools.script.shell.Main"$(COMMA) }'))
-
-$(eval $(call SetupLauncher,jsadebugd,\
-    -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "sun.jvm.hotspot.jdi.SADebugServer"$(COMMA) }' \
-    -DAPP_CLASSPATH='{ "/lib/tools.jar"$(COMMA) "/lib/sa-jdi.jar"$(COMMA) "/classes" }'))
-
-$(eval $(call SetupLauncher,jstack,\
-    -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) \
-		   "-J-Dsun.jvm.hotspot.debugger.useProcDebugger"$(COMMA) \
-		   "-J-Dsun.jvm.hotspot.debugger.useWindbgDebugger"$(COMMA) \
-		   "sun.tools.jstack.JStack"$(COMMA) }' \
-    -DAPP_CLASSPATH='{ "/lib/tools.jar"$(COMMA) "/lib/sa-jdi.jar"$(COMMA) "/classes" }'))
-
-$(eval $(call SetupLauncher,jstat,\
-    -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "sun.tools.jstat.Jstat"$(COMMA) }'))
-
-$(eval $(call SetupLauncher,jstatd,\
-    -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "sun.tools.jstatd.Jstatd"$(COMMA) }'))
-
-$(eval $(call SetupLauncher,keytool,\
-    -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "sun.security.tools.KeyTool"$(COMMA) }'))
-
-$(eval $(call SetupLauncher,native2ascii,\
-    -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "sun.tools.native2ascii.Main"$(COMMA) }'))
-
-ifndef BUILD_HEADLESS_ONLY
-$(eval $(call SetupLauncher,policytool,\
-    -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "sun.security.tools.policytool.PolicyTool"$(COMMA) }'))
-endif
-
-$(eval $(call SetupLauncher,rmic,\
-    -DEXPAND_CLASSPATH_WILDCARDS \
-    -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "sun.rmi.rmic.Main"$(COMMA) }'))
-
-$(eval $(call SetupLauncher,schemagen,\
-    -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "com.sun.tools.internal.jxc.SchemaGenerator"$(COMMA) }'))
-
-$(eval $(call SetupLauncher,serialver,\
-    -DEXPAND_CLASSPATH_WILDCARDS \
-    -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "sun.tools.serialver.SerialVer"$(COMMA) }'))
-
-$(eval $(call SetupLauncher,xjc,\
-    -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "com.sun.tools.internal.xjc.Driver"$(COMMA) }'))
-
-$(eval $(call SetupLauncher,wsgen,\
-    -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "com.sun.tools.internal.ws.WsGen"$(COMMA) }'))
-
-$(eval $(call SetupLauncher,wsimport,\
-    -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "com.sun.tools.internal.ws.WsImport"$(COMMA) }'))
-
-$(eval $(call SetupLauncher,orbd,\
-    -DJAVA_ARGS='{ 	"-J-ms8m"$(COMMA) \
-			"-J-Dcom.sun.CORBA.activation.DbDir=./orb.db"$(COMMA) \
-			"-J-Dcom.sun.CORBA.activation.Port=1049"$(COMMA) \
-			"-J-Dcom.sun.CORBA.POA.ORBServerId=1"$(COMMA) \
-			"com.sun.corba.se.impl.activation.ORBD"$(COMMA) }'))
-
-$(eval $(call SetupLauncher,servertool,\
-    -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "com.sun.corba.se.impl.activation.ServerTool"$(COMMA) }'))
-
-$(eval $(call SetupLauncher,tnameserv,\
-    -DJAVA_ARGS='{ 	"-J-ms8m"$(COMMA) \
-			"-J-Dcom.sun.CORBA.activation.DbDir=./orb.db"$(COMMA) \
-			"-J-Djava.util.logging.LoggingPermission=contol"$(COMMA) \
-			"-J-Dcom.sun.CORBA.POA.ORBServerId=1"$(COMMA) \
-			"com.sun.corba.se.impl.naming.cosnaming.TransientNameServer"$(COMMA) }'))
-
-$(eval $(call SetupLauncher,pack200,\
-    -DJAVA_ARGS='{	"-J-ms8m"$(COMMA) "com.sun.java.util.jar.pack.Driver"$(COMMA) "--pack" }'))
-
-$(eval $(call SetupLauncher,rmid,\
-    -DJAVA_ARGS='{	"-J-ms8m"$(COMMA) "sun.rmi.server.Activation"$(COMMA) }'))
-
-$(eval $(call SetupLauncher,rmiregistry,\
-    -DJAVA_ARGS='{	"-J-ms8m"$(COMMA) "sun.rmi.registry.RegistryImpl"$(COMMA) }'))
-
-$(eval $(call SetupLauncher,jcmd,\
-    -DJAVA_ARGS='{	"-J-ms8m"$(COMMA) "sun.tools.jcmd.JCmd"$(COMMA) }'))
-
-ifeq ($(OPENJDK_TARGET_OS),windows)
-    $(eval $(call SetupLauncher,kinit,\
-        -DJAVA_ARGS='{	"-J-ms8m"$(COMMA) "sun.security.krb5.internal.tools.Kinit"$(COMMA) }'))
-
-    $(eval $(call SetupLauncher,klist,\
-        -DJAVA_ARGS='{	"-J-ms8m"$(COMMA) "sun.security.krb5.internal.tools.Klist"$(COMMA) }'))
-
-    $(eval $(call SetupLauncher,ktab,\
-        -DJAVA_ARGS='{	"-J-ms8m"$(COMMA) "sun.security.krb5.internal.tools.Ktab"$(COMMA) }'))
-endif
-
-##########################################################################################
-# The order of the object files on the link command line affects the size of the resulting
-# binary (at least on linux) which causes the size to differ between old and new build.
-ifeq ($(USE_EXTERNAL_LIBZ), true)
-UNPACKEXE_CFLAGS := -DSYSTEM_ZLIB
-UNPACKEXE_ZIPOBJS := -lz
-else
-UNPACKEXE_CFLAGS := -I$(JDK_TOPDIR)/src/share/native/java/util/zip/zlib-1.2.5
-UNPACKEXE_ZIPOBJS := 	$(JDK_OUTPUTDIR)/objs/libzip/zcrc32$(OBJ_SUFFIX) \
-		     	$(JDK_OUTPUTDIR)/objs/libzip/deflate$(OBJ_SUFFIX) \
-			$(JDK_OUTPUTDIR)/objs/libzip/trees$(OBJ_SUFFIX) \
-			$(JDK_OUTPUTDIR)/objs/libzip/zadler32$(OBJ_SUFFIX) \
-			$(JDK_OUTPUTDIR)/objs/libzip/compress$(OBJ_SUFFIX) \
-			$(JDK_OUTPUTDIR)/objs/libzip/zutil$(OBJ_SUFFIX) \
-			$(JDK_OUTPUTDIR)/objs/libzip/inflate$(OBJ_SUFFIX) \
-			$(JDK_OUTPUTDIR)/objs/libzip/infback$(OBJ_SUFFIX) \
-			$(JDK_OUTPUTDIR)/objs/libzip/inftrees$(OBJ_SUFFIX) \
-			$(JDK_OUTPUTDIR)/objs/libzip/inffast$(OBJ_SUFFIX)
-
-endif
-
-ifeq ($(OPENJDK_TARGET_CPU_ARCH), sparc)
-     UNPACKEXE_CFLAGS += -xregs=no%appl
-endif
-
-$(eval $(call SetupNativeCompilation,BUILD_UNPACKEXE,\
-                SRC:=$(JDK_TOPDIR)/src/share/native/com/sun/java/util/jar/pack,\
-		EXCLUDE_FILES:=jni.cpp,\
-		LANG:=C,\
-		OPTIMIZATION := LOW, \
-		CFLAGS:=$(UNPACKEXE_CFLAGS) $(CXXFLAGS_JDKEXE)\
-			 -DFULL, \
-		CFLAGS_release:=-DPRODUCT,\
-		CFLAGS_linux:=-fPIC,\
-		CFLAGS_solaris := -KPIC, \
-		CFLAGS_macosx := -fPIC, \
-		MAPFILE:=$(JDK_TOPDIR)/makefiles/mapfiles/libunpack/mapfile-vers-unpack200, \
-		LDFLAGS:=$(LDFLAGS_JDKEXE) \
-			 $(call SET_SHARED_LIBRARY_ORIGIN), \
-		LDFLAGS_SUFFIX:=$(UNPACKEXE_ZIPOBJS) $(LIBCXX),\
-		LDFLAGS_SUFFIX_solaris:=-lc,\
-		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/unpackexe,\
-		OUTPUT_DIR:=$(JDK_OUTPUTDIR)/bin,\
-		PROGRAM:=unpack200,\
-		VERSIONINFO_RESOURCE:=$(JDK_TOPDIR)/src/windows/resource/version.rc,\
-		RC_FLAGS:=$(RC_FLAGS)\
-			  /D "JDK_FNAME=unpack200.exe" \
-			  /D "JDK_INTERNAL_NAME=unpack200" \
-			  /D "JDK_FTYPE=0x1L",\
-		MANIFEST:=$(JDK_TOPDIR)/src/windows/resource/unpack200_proto.exe.manifest))
-
-ifneq ($(USE_EXTERNAL_LIBZ), true)
-
-$(BUILD_UNPACKEXE) : $(UNPACKEXE_ZIPOBJS)
-
-endif
-
-BUILD_LAUNCHERS += $(BUILD_UNPACKEXE)
-
-##########################################################################################
-
-
-BUILD_JEXEC := 
-BUILD_JEXEC_SRC :=
-BUILD_JEXEC_INC :=
-BUILD_JEXEC_DST_DIR := $(JDK_OUTPUTDIR)/lib/$(LIBARCH)
-
-#
-# UNHANDLED:
-# - COMPILE_APPROACH = normal
-#
-
-#
-# jdk/make/java/Makefile
-#
-ifeq ($(OPENJDK_TARGET_OS), solaris)
-	ifeq ($(ARCH_DATA_MODEL), 32)
-		BUILD_JEXEC := 1
-	endif
-endif
-
-ifeq ($(OPENJDK_TARGET_OS), linux)
-	BUILD_JEXEC := 1
-endif # OPENJDK_TARGET_OS
-
-#
-# jdk/make/java/jexec/Makefile
-#
-ifeq ($(BUILD_JEXEC), 1)
-
-	ifeq ($(OPENJDK_TARGET_OS),windows)
-	else ifeq ($(OPENJDK_TARGET_OS),macosx)
-		BUILD_JEXEC_SRC := $(JDK_TOPDIR)/src/macosx/bin
-	else
-		BUILD_JEXEC_SRC := $(JDK_TOPDIR)/src/solaris/bin
-	endif
-
-	ifeq ($(OPENJDK_TARGET_OS), linux)
-                BUILD_JEXEC_DST_DIR := $(JDK_OUTPUTDIR)/lib
-		BUILD_JEXEC_INC += -I$(JDK_TOPDIR)/src/share/bin
-	endif
-endif
-
-#
-# Note that the two Makefile's seems to contradict each other,
-#   and that src/macosx/bin/jexec.c seems unused
-#
-ifneq ($(BUILD_JEXEC_SRC),)
-        $(eval $(call SetupNativeCompilation,BUILD_JEXEC,\
-		SRC:=$(BUILD_JEXEC_SRC),\
-		INCLUDE_FILES:=jexec.c,\
-		LANG:=C,\
-		OPTIMIZATION := LOW, \
-		CFLAGS:=$(CFLAGS_JDKEXE)\
-                        $(BUILD_JEXEC_INC), \
-		LDFLAGS:=$(LDFLAGS_JDKEXE), \
-		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/jexec_obj,\
-		OUTPUT_DIR:=$(BUILD_JEXEC_DST_DIR),\
-		PROGRAM:=jexec))
-
-	BUILD_LAUNCHERS += $(BUILD_JEXEC)
-endif
-
-##########################################################################################
-
-#
-# The java-rmi.cgi script in bin/ only gets delivered in certain situations
-#
-JAVA_RMI_CGI:=$(JDK_OUTPUTDIR)/bin/java-rmi.cgi
-ifeq ($(OPENJDK_TARGET_OS), linux)
-  BUILD_LAUNCHERS += $(JAVA_RMI_CGI)
-endif
-ifeq ($(OPENJDK_TARGET_OS), solaris)
-  ifeq ($(ARCH_DATA_MODEL), 32)
-    BUILD_LAUNCHERS += $(JAVA_RMI_CGI)
-  endif
-endif
-
-# TODO: 
-# On windows java-rmi.cgi shouldn't be bundled since Java 1.2, but has been built all
-# this time anyway. Since jdk6, it has been built from the wrong source and resulted
-# in a copy of the standard java launcher named "java-rmi.exe" ending up in the final
-# images bin dir. This weird behavior is mimicked here in the converted makefiles for
-# now. Should probably just be deleted.
-# http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6512052
-ifeq ($(OPENJDK_TARGET_OS_API),winapi)
-    $(eval $(call SetupLauncher,java-rmi,\
-        -DEXPAND_CLASSPATH_WILDCARDS,\
-        $(call SET_SHARED_LIBRARY_MAPFILE,$(JDK_TOPDIR)/makefiles/java/main/java/mapfile-$(ARCH)),\
-        ,,,,,$(JDK_OUTPUTDIR)/objs))
-
-    $(JAVA_RMI_CGI): $(BUILD_LAUNCHER_java-rmi)
-	$(MKDIR) -p $(@D)
-	$(CP) $< $@
-
-    BUILD_LAUNCHERS += $(JAVA_RMI_CGI)
-else
-    $(JAVA_RMI_CGI): $(JDK_TOPDIR)/src/solaris/bin/java-rmi.cgi.sh
-	$(MKDIR) -p $(@D)
-	$(CP) $< $@
-	$(CHMOD) a+x $@
-endif
-
-##########################################################################################
-
-$(BUILD_LAUNCHERS) : $(JDK_TOPDIR)/makefiles/CompileLaunchers.gmk
-
-all: $(BUILD_LAUNCHERS)
-
-.PHONY: all
+#
+# Copyright (c) 2011, 2012, 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.
+#
+
+defalt: all
+
+include $(SPEC)
+include MakeBase.gmk
+include NativeCompilation.gmk
+
+# Setup the java compilers for the JDK build.
+include Setup.gmk
+
+# Build tools
+include Tools.gmk
+
+BUILD_LAUNCHERS=
+
+# When building a legacy overlay image (on solaris 64 bit), the launchers 
+# need to be built with a different rpath and a different output dir.
+ifeq ($(OVERLAY_IMAGES),true)
+    ORIGIN_ROOT:=/../..
+    OUTPUT_SUBDIR:=$(OPENJDK_TARGET_CPU_ISADIR)
+else
+    ORIGIN_ROOT:=/..
+endif
+
+ifeq ($(OPENJDK_TARGET_OS), macosx)
+    ORIGIN_ARG:=$(call SET_EXECUTABLE_ORIGIN)
+else
+    ORIGIN_ARG:=$(call SET_EXECUTABLE_ORIGIN,$(ORIGIN_ROOT)/lib$(OPENJDK_TARGET_CPU_LIBDIR)/jli) \
+                $(call SET_EXECUTABLE_ORIGIN,$(ORIGIN_ROOT)/jre/lib$(OPENJDK_TARGET_CPU_LIBDIR)/jli)
+endif
+
+#
+# Applications expect to be able to link against libjawt without invoking
+# System.loadLibrary("jawt") first. This was the behaviour described in the
+# devloper documentation of JAWT and what worked with OpenJDK6.
+#
+ifneq ($(findstring $(OPENJDK_TARGET_OS), linux solaris),)
+    ORIGIN_ARG+=$(call SET_EXECUTABLE_ORIGIN,$(ORIGIN_ROOT)/lib$(OPENJDK_TARGET_CPU_LIBDIR)) \
+                $(call SET_EXECUTABLE_ORIGIN,$(ORIGIN_ROOT)/jre/lib$(OPENJDK_TARGET_CPU_LIBDIR)) 
+endif
+
+define SetupLauncher
+    # TODO: Fix mapfile on solaris. Won't work with ld as linker.
+    # Parameter 1 is the name of the launcher (java,javac,jar...)
+    # Parameter 2 is extra CFLAGS
+    # Parameter 3 is extra LDFLAGS
+    # Parameter 4 is extra LDFLAGS_SUFFIX_posix
+    # Parameter 5 is extra LDFLAGS_SUFFIX_windows
+    # Parameter 6 is optional Windows JLI library (full path)
+    # Parameter 7 is optional Windows resource (RC) flags
+    # Parameter 8 is optional Windows version resource file (.rc)
+    # Parameter 9  is different output dir
+    # Parameter 10 if set, link statically with c runtime on windows.
+    # Parameter 11 if set, override plist file on macosx.
+
+    $1_WINDOWS_JLI_LIB:=$(JDK_OUTPUTDIR)/objs/libjli/jli.lib
+    ifneq ($6,)
+        $1_WINDOWS_JLI_LIB:=$6
+    endif
+    $1_VERSION_INFO_RESOURCE:=$(JDK_TOPDIR)/src/windows/resource/version.rc
+    ifneq ($8,)
+        $1_VERSION_INFO_RESOURCE:=$8
+    endif
+
+    $1_LDFLAGS := $3
+    $1_LDFLAGS_SUFFIX :=
+    ifeq ($(OPENJDK_TARGET_OS), macosx)
+        $1_PLIST_FILE:=Info-cmdline.plist
+        ifneq ($(11),)
+            $1_PLIST_FILE:=$(11)
+        endif
+
+        $1_LDFLAGS += -Wl,-all_load $(JDK_OUTPUTDIR)/objs/libjli_static.a \
+                      -framework Cocoa -framework Security -framework ApplicationServices \
+                      -sectcreate __TEXT __info_plist $(JDK_TOPDIR)/src/macosx/lib/$$($1_PLIST_FILE)
+        $1_LDFLAGS_SUFFIX += -pthread
+    endif
+
+    ifeq ($(USE_EXTERNAL_LIBZ), true)
+        $1_LDFLAGS_SUFFIX += -lz
+    endif
+
+    $1_OUTPUT_DIR_ARG:=$9
+    ifeq (,$$($1_OUTPUT_DIR_ARG))
+        $1_OUTPUT_DIR_ARG:=$(JDK_OUTPUTDIR)/bin
+    endif
+
+    # TODO: maybe it's better to move this if-statement out of this function
+    ifeq ($1,java)
+        $1_OPTIMIZATION_ARG:=HIGH
+	$1_LDFLAGS_solaris:=-R$(OPENWIN_HOME)/lib$(OPENJDK_TARGET_CPU_ISADIR)
+    else
+        $1_OPTIMIZATION_ARG:=LOW
+    endif
+
+    $1_CFLAGS:=$(CFLAGS_JDKEXE)
+    ifeq ($(10),true)
+        $1_CFLAGS:=$(filter-out -MD,$(CFLAGS_JDKEXE))
+    endif
+
+    $(call SetupNativeCompilation,BUILD_LAUNCHER_$1,\
+	SRC:=$(JDK_TOPDIR)/src/share/bin,\
+	INCLUDE_FILES:=main.c,\
+	LANG:=C,\
+	OPTIMIZATION:=$$($1_OPTIMIZATION_ARG), \
+	CFLAGS:=$$($1_CFLAGS) \
+		-I$(JDK_TOPDIR)/src/share/bin \
+		-I$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/bin \
+		-I$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS)/bin \
+                -DFULL_VERSION='"$(FULL_VERSION)"' \
+                -DJDK_MAJOR_VERSION='"$(JDK_MAJOR_VERSION)"' \
+                -DJDK_MINOR_VERSION='"$(JDK_MINOR_VERSION)"' \
+		-DLIBARCHNAME='"$(OPENJDK_TARGET_CPU_LEGACY)"' \
+		-DLAUNCHER_NAME='"$(LAUNCHER_NAME)"' \
+		-DPROGNAME='"$1"' $(DPACKAGEPATH) \
+		$2,\
+	CFLAGS_linux:=-fPIC,\
+        CFLAGS_solaris:=-KPIC -DHAVE_GETHRTIME,\
+	LDFLAGS:=$(LDFLAGS_JDKEXE) \
+                 $(ORIGIN_ARG) \
+		 $$($1_LDFLAGS),\
+	LDFLAGS_macosx:=$(call SET_SHARED_LIBRARY_NAME,$1),\
+	LDFLAGS_linux:=-lpthread \
+                       $(call SET_SHARED_LIBRARY_NAME,$(LIBRARY_PREFIX)$(SHARED_LIBRARY_SUFFIX)),\
+	LDFLAGS_solaris:=$$($1_LDFLAGS_solaris) \
+                       $(call SET_SHARED_LIBRARY_NAME,$(LIBRARY_PREFIX)$(SHARED_LIBRARY_SUFFIX)),\
+	MAPFILE := $(JDK_TOPDIR)/makefiles/mapfiles/launchers/mapfile-$(OPENJDK_TARGET_CPU), \
+        LDFLAGS_SUFFIX:=$(LDFLAGS_JDKEXE_SUFFIX) $$($1_LDFLAGS_SUFFIX),\
+	LDFLAGS_SUFFIX_posix:=$4,\
+	LDFLAGS_SUFFIX_windows:=$$($1_WINDOWS_JLI_LIB) \
+			       $(JDK_OUTPUTDIR)/objs/libjava/java.lib advapi32.lib $5,\
+	LDFLAGS_SUFFIX_linux:=-L$(JDK_OUTPUTDIR)/lib$(OPENJDK_TARGET_CPU_LIBDIR)/jli -ljli $(LIBDL) -lc, \
+	LDFLAGS_SUFFIX_solaris:=-L$(JDK_OUTPUTDIR)/lib$(OPENJDK_TARGET_CPU_LIBDIR)/jli -ljli -lthread $(LIBDL) -lc, \
+	OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/$1_objs$(OUTPUT_SUBDIR),\
+	OUTPUT_DIR:=$$($1_OUTPUT_DIR_ARG)$(OUTPUT_SUBDIR),\
+	PROGRAM:=$1,\
+	DEBUG_SYMBOLS:=true,\
+	VERSIONINFO_RESOURCE:=$$($1_VERSION_INFO_RESOURCE),\
+	RC_FLAGS:=$(RC_FLAGS)\
+		  /D "JDK_FNAME=$1$(EXE_SUFFIX)" \
+		  /D "JDK_INTERNAL_NAME=$1" \
+		  /D "JDK_FTYPE=0x1L" \
+		  $7,\
+	MANIFEST:=$(JDK_TOPDIR)/src/windows/resource/java.manifest)
+
+    BUILD_LAUNCHERS += $$(BUILD_LAUNCHER_$1)
+
+    ifeq ($(OPENJDK_TARGET_OS),macosx)
+        $$(BUILD_LAUNCHER_$1) : $(JDK_OUTPUTDIR)/objs/libjli_static.a
+    endif
+
+    ifeq ($(OPENJDK_TARGET_OS),windows)
+        $$(BUILD_LAUNCHER_$1) : $(JDK_OUTPUTDIR)/objs/libjava/java.lib \
+				$$($1_WINDOWS_JLI_LIB)
+    endif    	 
+endef
+
+##########################################################################################
+
+XLIBS:=$(X_LIBS) -lX11
+ifeq ($(OPENJDK_TARGET_OS),macosx)
+    DPACKAGEPATH:=-DPACKAGE_PATH='"$(PACKAGE_PATH)"'
+    XLIBS:=
+endif
+
+ifdef OPENJDK
+    JAVA_RC_FLAGS += -i "$(JDK_TOPDIR)/src/windows/resource/icons"
+else
+    JAVA_RC_FLAGS += -i "$(JDK_TOPDIR)/src/closed/windows/native/sun/windows"
+endif
+
+# On windows, the debuginfo files get the same name as for java.dll. Build
+# into another dir and copy selectively so debuginfo for java.dll isn't
+# overwritten.
+$(eval $(call SetupLauncher,java,\
+    -DEXPAND_CLASSPATH_WILDCARDS,,,user32.lib comctl32.lib,\
+    $(JDK_OUTPUTDIR)/objs/jli_static.lib,$(JAVA_RC_FLAGS),\
+    $(JDK_TOPDIR)/src/windows/resource/java.rc,$(JDK_OUTPUTDIR)/objs/java_objs,true))
+
+$(JDK_OUTPUTDIR)/bin$(OUTPUT_SUBDIR)/java$(EXE_SUFFIX): $(BUILD_LAUNCHER_java)
+	$(MKDIR) -p $(@D)
+	$(RM) $@
+	$(CP) $(JDK_OUTPUTDIR)/objs/java_objs$(OUTPUT_SUBDIR)/java$(EXE_SUFFIX) $@
+
+BUILD_LAUNCHERS += $(JDK_OUTPUTDIR)/bin$(OUTPUT_SUBDIR)/java$(EXE_SUFFIX)
+
+ifeq ($(OPENJDK_TARGET_OS),windows)
+    $(eval $(call SetupLauncher,javaw,\
+        -DJAVAW -DEXPAND_CLASSPATH_WILDCARDS,,,user32.lib comctl32.lib,\
+        $(JDK_OUTPUTDIR)/objs/jli_static.lib,$(JAVA_RC_FLAGS),\
+        $(JDK_TOPDIR)/src/windows/resource/java.rc,,true))
+endif
+
+
+ifndef BUILD_HEADLESS_ONLY
+$(eval $(call SetupLauncher,appletviewer,\
+    -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "sun.applet.Main"$(COMMA) }',,\
+    $(XLIBS)))
+endif
+
+$(eval $(call SetupLauncher,extcheck,\
+    -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "com.sun.tools.extcheck.Main"$(COMMA) }'))
+
+$(eval $(call SetupLauncher,idlj,\
+    -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "com.sun.tools.corba.se.idl.toJavaPortable.Compile"$(COMMA) }'))
+
+$(eval $(call SetupLauncher,jar,\
+    -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "sun.tools.jar.Main"$(COMMA) }'))
+
+$(eval $(call SetupLauncher,jarsigner,\
+    -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "sun.security.tools.JarSigner"$(COMMA) }'))
+
+$(eval $(call SetupLauncher,javac,\
+    -DEXPAND_CLASSPATH_WILDCARDS \
+    -DNEVER_ACT_AS_SERVER_CLASS_MACHINE \
+    -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "com.sun.tools.javac.Main"$(COMMA) }'))
+
+$(eval $(call SetupLauncher,javadoc,\
+    -DEXPAND_CLASSPATH_WILDCARDS \
+    -DNEVER_ACT_AS_SERVER_CLASS_MACHINE \
+    -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "com.sun.tools.javadoc.Main"$(COMMA) }'))
+
+$(eval $(call SetupLauncher,javah,\
+    -DEXPAND_CLASSPATH_WILDCARDS \
+    -DNEVER_ACT_AS_SERVER_CLASS_MACHINE \
+    -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "com.sun.tools.javah.Main"$(COMMA) }'))
+
+$(eval $(call SetupLauncher,javap,\
+    -DEXPAND_CLASSPATH_WILDCARDS \
+    -DNEVER_ACT_AS_SERVER_CLASS_MACHINE \
+    -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "com.sun.tools.javap.Main"$(COMMA) }'))
+
+BUILD_LAUNCHER_jconsole_CFLAGS_windows:=-DJAVAW
+BUILD_LAUNCHER_jconsole_LDFLAGS_windows:=user32.lib
+
+$(eval $(call SetupLauncher,jconsole,\
+    -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "-J-Djconsole.showOutputViewer"$(COMMA) "sun.tools.jconsole.JConsole"$(COMMA) }' \
+    -DAPP_CLASSPATH='{ "/lib/jconsole.jar"$(COMMA) "/lib/tools.jar"$(COMMA) "/classes" }'))
+
+$(eval $(call SetupLauncher,jdb,\
+    -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "com.sun.tools.example.debug.tty.TTY"$(COMMA) }' \
+    -DAPP_CLASSPATH='{ "/lib/tools.jar"$(COMMA) "/lib/sa-jdi.jar"$(COMMA) "/classes" }'))
+
+$(eval $(call SetupLauncher,jhat,\
+    -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "com.sun.tools.hat.Main"$(COMMA) }'))
+
+$(eval $(call SetupLauncher,jinfo,\
+    -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) \
+		   "-J-Dsun.jvm.hotspot.debugger.useProcDebugger"$(COMMA) \
+		   "-J-Dsun.jvm.hotspot.debugger.useWindbgDebugger"$(COMMA) \
+		   "sun.tools.jinfo.JInfo"$(COMMA) }' \
+    -DAPP_CLASSPATH='{ "/lib/tools.jar"$(COMMA) "/lib/sa-jdi.jar"$(COMMA) "/classes" }' \
+    ,,,,,,,,,Info-privileged.plist))
+
+$(eval $(call SetupLauncher,jmap,\
+    -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) \
+		   "-J-Dsun.jvm.hotspot.debugger.useProcDebugger"$(COMMA) \
+		   "-J-Dsun.jvm.hotspot.debugger.useWindbgDebugger"$(COMMA) \
+		   "sun.tools.jmap.JMap"$(COMMA) }' \
+    -DAPP_CLASSPATH='{ "/lib/tools.jar"$(COMMA) "/lib/sa-jdi.jar"$(COMMA) "/classes" }' \
+    ,,,,,,,,,Info-privileged.plist))
+
+$(eval $(call SetupLauncher,jps,\
+    -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "sun.tools.jps.Jps"$(COMMA) }'))
+
+$(eval $(call SetupLauncher,jrunscript,\
+    -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "com.sun.tools.script.shell.Main"$(COMMA) }'))
+
+$(eval $(call SetupLauncher,jsadebugd,\
+    -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "sun.jvm.hotspot.jdi.SADebugServer"$(COMMA) }' \
+    -DAPP_CLASSPATH='{ "/lib/tools.jar"$(COMMA) "/lib/sa-jdi.jar"$(COMMA) "/classes" }' \
+    ,,,,,,,,,Info-privileged.plist))
+
+$(eval $(call SetupLauncher,jstack,\
+    -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) \
+		   "-J-Dsun.jvm.hotspot.debugger.useProcDebugger"$(COMMA) \
+		   "-J-Dsun.jvm.hotspot.debugger.useWindbgDebugger"$(COMMA) \
+		   "sun.tools.jstack.JStack"$(COMMA) }' \
+    -DAPP_CLASSPATH='{ "/lib/tools.jar"$(COMMA) "/lib/sa-jdi.jar"$(COMMA) "/classes" }' \
+    ,,,,,,,,,Info-privileged.plist))
+
+$(eval $(call SetupLauncher,jstat,\
+    -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "sun.tools.jstat.Jstat"$(COMMA) }'))
+
+$(eval $(call SetupLauncher,jstatd,\
+    -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "sun.tools.jstatd.Jstatd"$(COMMA) }'))
+
+$(eval $(call SetupLauncher,keytool,\
+    -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "sun.security.tools.KeyTool"$(COMMA) }'))
+
+$(eval $(call SetupLauncher,native2ascii,\
+    -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "sun.tools.native2ascii.Main"$(COMMA) }'))
+
+ifndef BUILD_HEADLESS_ONLY
+$(eval $(call SetupLauncher,policytool,\
+    -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "sun.security.tools.policytool.PolicyTool"$(COMMA) }',,\
+    $(XLIBS)))
+endif
+
+$(eval $(call SetupLauncher,rmic,\
+    -DEXPAND_CLASSPATH_WILDCARDS \
+    -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "sun.rmi.rmic.Main"$(COMMA) }'))
+
+$(eval $(call SetupLauncher,schemagen,\
+    -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "com.sun.tools.internal.jxc.SchemaGenerator"$(COMMA) }'))
+
+$(eval $(call SetupLauncher,serialver,\
+    -DEXPAND_CLASSPATH_WILDCARDS \
+    -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "sun.tools.serialver.SerialVer"$(COMMA) }'))
+
+$(eval $(call SetupLauncher,xjc,\
+    -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "com.sun.tools.internal.xjc.Driver"$(COMMA) }'))
+
+$(eval $(call SetupLauncher,wsgen,\
+    -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "com.sun.tools.internal.ws.WsGen"$(COMMA) }'))
+
+$(eval $(call SetupLauncher,wsimport,\
+    -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "com.sun.tools.internal.ws.WsImport"$(COMMA) }'))
+
+$(eval $(call SetupLauncher,orbd,\
+    -DJAVA_ARGS='{ 	"-J-ms8m"$(COMMA) \
+			"-J-Dcom.sun.CORBA.activation.DbDir=./orb.db"$(COMMA) \
+			"-J-Dcom.sun.CORBA.activation.Port=1049"$(COMMA) \
+			"-J-Dcom.sun.CORBA.POA.ORBServerId=1"$(COMMA) \
+			"com.sun.corba.se.impl.activation.ORBD"$(COMMA) }'))
+
+$(eval $(call SetupLauncher,servertool,\
+    -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "com.sun.corba.se.impl.activation.ServerTool"$(COMMA) }'))
+
+$(eval $(call SetupLauncher,tnameserv,\
+    -DJAVA_ARGS='{ 	"-J-ms8m"$(COMMA) \
+			"-J-Dcom.sun.CORBA.activation.DbDir=./orb.db"$(COMMA) \
+			"-J-Djava.util.logging.LoggingPermission=contol"$(COMMA) \
+			"-J-Dcom.sun.CORBA.POA.ORBServerId=1"$(COMMA) \
+			"com.sun.corba.se.impl.naming.cosnaming.TransientNameServer"$(COMMA) }'))
+
+$(eval $(call SetupLauncher,pack200,\
+    -DJAVA_ARGS='{	"-J-ms8m"$(COMMA) "com.sun.java.util.jar.pack.Driver"$(COMMA) "--pack" }'))
+
+$(eval $(call SetupLauncher,rmid,\
+    -DJAVA_ARGS='{	"-J-ms8m"$(COMMA) "sun.rmi.server.Activation"$(COMMA) }'))
+
+$(eval $(call SetupLauncher,rmiregistry,\
+    -DJAVA_ARGS='{	"-J-ms8m"$(COMMA) "sun.rmi.registry.RegistryImpl"$(COMMA) }'))
+
+$(eval $(call SetupLauncher,jcmd,\
+    -DJAVA_ARGS='{	"-J-ms8m"$(COMMA) "sun.tools.jcmd.JCmd"$(COMMA) }'))
+
+ifeq ($(OPENJDK_TARGET_OS),windows)
+    $(eval $(call SetupLauncher,kinit,\
+        -DJAVA_ARGS='{	"-J-ms8m"$(COMMA) "sun.security.krb5.internal.tools.Kinit"$(COMMA) }'))
+
+    $(eval $(call SetupLauncher,klist,\
+        -DJAVA_ARGS='{	"-J-ms8m"$(COMMA) "sun.security.krb5.internal.tools.Klist"$(COMMA) }'))
+
+    $(eval $(call SetupLauncher,ktab,\
+        -DJAVA_ARGS='{	"-J-ms8m"$(COMMA) "sun.security.krb5.internal.tools.Ktab"$(COMMA) }'))
+endif
+
+##########################################################################################
+# The order of the object files on the link command line affects the size of the resulting
+# binary (at least on linux) which causes the size to differ between old and new build.
+ifeq ($(USE_EXTERNAL_LIBZ), true)
+UNPACKEXE_CFLAGS := -DSYSTEM_ZLIB
+UNPACKEXE_ZIPOBJS := -lz
+else
+UNPACKEXE_CFLAGS := -I$(JDK_TOPDIR)/src/share/native/java/util/zip/zlib-1.2.5
+UNPACKEXE_ZIPOBJS := 	$(JDK_OUTPUTDIR)/objs/libzip/zcrc32$(OBJ_SUFFIX) \
+		     	$(JDK_OUTPUTDIR)/objs/libzip/deflate$(OBJ_SUFFIX) \
+			$(JDK_OUTPUTDIR)/objs/libzip/trees$(OBJ_SUFFIX) \
+			$(JDK_OUTPUTDIR)/objs/libzip/zadler32$(OBJ_SUFFIX) \
+			$(JDK_OUTPUTDIR)/objs/libzip/compress$(OBJ_SUFFIX) \
+			$(JDK_OUTPUTDIR)/objs/libzip/zutil$(OBJ_SUFFIX) \
+			$(JDK_OUTPUTDIR)/objs/libzip/inflate$(OBJ_SUFFIX) \
+			$(JDK_OUTPUTDIR)/objs/libzip/infback$(OBJ_SUFFIX) \
+			$(JDK_OUTPUTDIR)/objs/libzip/inftrees$(OBJ_SUFFIX) \
+			$(JDK_OUTPUTDIR)/objs/libzip/inffast$(OBJ_SUFFIX)
+
+endif
+
+ifeq ($(OPENJDK_TARGET_CPU_ARCH), sparc)
+    UNPACKEXE_CFLAGS += -xregs=no%appl
+endif
+
+UNPACKEXE_LANG:=C
+ifeq ($(OPENJDK_TARGET_OS),solaris)
+    UNPACKEXE_LANG:=C++
+endif
+
+$(eval $(call SetupNativeCompilation,BUILD_UNPACKEXE,\
+                SRC:=$(JDK_TOPDIR)/src/share/native/com/sun/java/util/jar/pack,\
+		EXCLUDE_FILES:=jni.cpp,\
+		LANG:=$(UNPACKEXE_LANG),\
+		OPTIMIZATION := LOW, \
+		CFLAGS:=$(UNPACKEXE_CFLAGS) $(CXXFLAGS_JDKEXE)\
+                        -DFULL, \
+		CFLAGS_release:=-DPRODUCT,\
+		CFLAGS_linux:=-fPIC,\
+		CFLAGS_solaris := -KPIC, \
+		CFLAGS_macosx := -fPIC, \
+		MAPFILE:=$(JDK_TOPDIR)/makefiles/mapfiles/libunpack/mapfile-vers-unpack200, \
+		LDFLAGS:=$(LDFLAGS_JDKEXE) $(LDFLAGS_CXX_JDK) \
+			 $(call SET_SHARED_LIBRARY_NAME,$(LIBRARY_PREFIX)unpack$(SHARED_LIBRARY_SUFFIX)) \
+			 $(call SET_SHARED_LIBRARY_ORIGIN) \
+			 $(UNPACKEXE_ZIPOBJS),\
+		LDFLAGS_linux:=-lc,\
+		LDFLAGS_SUFFIX:=$(LIBCXX),\
+		LDFLAGS_SUFFIX_solaris:=-lc,\
+		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/unpackexe$(OUTPUT_SUBDIR),\
+		OUTPUT_DIR:=$(JDK_OUTPUTDIR)/bin$(OUTPUT_SUBDIR),\
+		PROGRAM:=unpack200,\
+		VERSIONINFO_RESOURCE:=$(JDK_TOPDIR)/src/windows/resource/version.rc,\
+		RC_FLAGS:=$(RC_FLAGS)\
+			  /D "JDK_FNAME=unpack200.exe" \
+			  /D "JDK_INTERNAL_NAME=unpack200" \
+			  /D "JDK_FTYPE=0x1L",\
+		MANIFEST:=$(JDK_TOPDIR)/src/windows/resource/unpack200_proto.exe.manifest))
+
+ifneq ($(USE_EXTERNAL_LIBZ), true)
+
+$(BUILD_UNPACKEXE) : $(UNPACKEXE_ZIPOBJS)
+
+endif
+
+BUILD_LAUNCHERS += $(BUILD_UNPACKEXE)
+
+##########################################################################################
+
+
+BUILD_JEXEC := 
+BUILD_JEXEC_SRC :=
+BUILD_JEXEC_INC :=
+BUILD_JEXEC_DST_DIR := $(JDK_OUTPUTDIR)/lib$(OPENJDK_TARGET_CPU_LIBDIR)
+
+#
+# UNHANDLED:
+# - COMPILE_APPROACH = normal
+#
+
+#
+# jdk/make/java/Makefile
+#
+ifeq ($(OPENJDK_TARGET_OS), solaris)
+	ifeq ($(OPENJDK_TARGET_CPU_BITS), 32)
+		BUILD_JEXEC := 1
+	endif
+endif
+
+ifeq ($(OPENJDK_TARGET_OS), linux)
+	BUILD_JEXEC := 1
+endif # OPENJDK_TARGET_OS
+
+#
+# jdk/make/java/jexec/Makefile
+#
+ifeq ($(BUILD_JEXEC), 1)
+
+	ifeq ($(OPENJDK_TARGET_OS),windows)
+	else ifeq ($(OPENJDK_TARGET_OS),macosx)
+		BUILD_JEXEC_SRC := $(JDK_TOPDIR)/src/macosx/bin
+	else
+		BUILD_JEXEC_SRC := $(JDK_TOPDIR)/src/solaris/bin
+	endif
+
+	ifeq ($(OPENJDK_TARGET_OS), linux)
+                BUILD_JEXEC_DST_DIR := $(JDK_OUTPUTDIR)/lib
+		BUILD_JEXEC_INC += -I$(JDK_TOPDIR)/src/share/bin
+	endif
+endif
+
+#
+# Note that the two Makefile's seems to contradict each other,
+#   and that src/macosx/bin/jexec.c seems unused
+#
+ifneq ($(BUILD_JEXEC_SRC),)
+        $(eval $(call SetupNativeCompilation,BUILD_JEXEC,\
+		SRC:=$(BUILD_JEXEC_SRC),\
+		INCLUDE_FILES:=jexec.c,\
+		LANG:=C,\
+		OPTIMIZATION := LOW, \
+		CFLAGS:=$(CFLAGS_JDKEXE)\
+                        $(BUILD_JEXEC_INC), \
+		CFLAGS_linux:=-fPIC,\
+		CFLAGS_solaris:=-KPIC,\
+		LDFLAGS:=$(LDFLAGS_JDKEXE) \
+			 $(call SET_SHARED_LIBRARY_NAME,$(LIBRARY_PREFIX)$(SHARED_LIBRARY_SUFFIX)), \
+		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/jexec_obj,\
+		OUTPUT_DIR:=$(BUILD_JEXEC_DST_DIR),\
+		PROGRAM:=jexec))
+
+	BUILD_LAUNCHERS += $(BUILD_JEXEC)
+endif
+
+##########################################################################################
+
+#
+# The java-rmi.cgi script in bin/ only gets delivered in certain situations
+#
+JAVA_RMI_CGI:=$(JDK_OUTPUTDIR)/bin$(OUTPUT_SUBDIR)/java-rmi.cgi
+ifeq ($(OPENJDK_TARGET_OS), linux)
+  BUILD_LAUNCHERS += $(JAVA_RMI_CGI)
+endif
+ifeq ($(OPENJDK_TARGET_OS), solaris)
+  ifeq ($(OPENJDK_TARGET_CPU_BITS), 32)
+    BUILD_LAUNCHERS += $(JAVA_RMI_CGI)
+  endif
+endif
+
+# TODO: 
+# On windows java-rmi.cgi shouldn't be bundled since Java 1.2, but has been built all
+# this time anyway. Since jdk6, it has been built from the wrong source and resulted
+# in a copy of the standard java launcher named "java-rmi.exe" ending up in the final
+# images bin dir. This weird behavior is mimicked here in the converted makefiles for
+# now. Should probably just be deleted.
+# http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6512052
+ifeq ($(OPENJDK_TARGET_OS),windows)
+    $(eval $(call SetupLauncher,java-rmi,\
+        -DEXPAND_CLASSPATH_WILDCARDS,\
+        $(call SET_SHARED_LIBRARY_MAPFILE,$(JDK_TOPDIR)/makefiles/java/main/java/mapfile-$(OPENJDK_TARGET_CPU))))
+else
+    $(JAVA_RMI_CGI): $(JDK_TOPDIR)/src/solaris/bin/java-rmi.cgi.sh
+	$(MKDIR) -p $(@D)
+	$(CP) $< $@
+	$(CHMOD) a+x $@
+endif
+
+##########################################################################################
+
+$(BUILD_LAUNCHERS) : $(JDK_TOPDIR)/makefiles/CompileLaunchers.gmk
+
+all: $(BUILD_LAUNCHERS)
+
+.PHONY: all
--- a/jdk/makefiles/CompileNativeLibraries.gmk	Wed Jul 05 18:22:17 2017 +0200
+++ b/jdk/makefiles/CompileNativeLibraries.gmk	Wed Jul 05 18:22:52 2017 +0200
@@ -44,13 +44,7 @@
 
 # Put the libraries here. Different locations for different target apis.
 ifeq ($(OPENJDK_TARGET_OS_API),posix)
-    ifneq ($(OPENJDK_TARGET_OS),macosx)
-        INSTALL_LIBRARIES_HERE:=$(JDK_OUTPUTDIR)/lib/$(LIBARCH)
-        LIBARCHDIR=$(LIBARCH)/
-    else
-        INSTALL_LIBRARIES_HERE:=$(JDK_OUTPUTDIR)/lib
-        LIBARCHDIR=/
-    endif
+    INSTALL_LIBRARIES_HERE:=$(JDK_OUTPUTDIR)/lib$(OPENJDK_TARGET_CPU_LIBDIR)
 else
     INSTALL_LIBRARIES_HERE:=$(JDK_OUTPUTDIR)/bin
 endif
@@ -63,6 +57,18 @@
 WIN_JAVA_LIB := $(JDK_OUTPUTDIR)/objs/libjava/java.lib
 WIN_AWT_LIB := $(JDK_OUTPUTDIR)/objs/libawt/awt.lib
 
+# Use this variable to set DEBUG_SYMBOLS true on windows for all libraries, but
+# not on other platforms.
+ifeq ($(OPENJDK_TARGET_OS), windows)
+    WINDOWS_ONLY := true
+endif
+
+#
+# TODO replace with X_FLAGS / X_LIBS
+#   and add them to configure
+#
+OPENWIN_LIB:=$(OPENWIN_HOME)/lib
+
 ##########################################################################################
 
 BUILD_LIBFDLIBM_OPTIMIZATION:=HIGH
@@ -80,7 +86,7 @@
 		OPTIMIZATION:=$(BUILD_LIBFDLIBM_OPTIMIZATION), \
 		CFLAGS:=$(CFLAGS_JDKLIB) \
 			-I$(JDK_TOPDIR)/src/share/native/java/lang/fdlibm/include,\
-		CFLAGS_winapi_debug:=-DLOGGING,\
+		CFLAGS_windows_debug:=-DLOGGING,\
 		ARFLAGS:=$(ARFLAGS),\
 		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libfdlibm))
 
@@ -98,7 +104,7 @@
 		LANG:=C,\
 		CFLAGS:=$(CFLAGS_JDKLIB) \
 			-I$(JDK_TOPDIR)/src/share/native/java/lang/fdlibm/include,\
-		LDFLAGS:=-nostdlib -r,\
+		LDFLAGS:=-nostdlib -r -arch i386 -arch x86_64,\
 		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libfdlibm))
 
 $(JDK_OUTPUTDIR)/objs/$(LIBRARY_PREFIX)fdlibm$(STATIC_LIBRARY_SUFFIX) : $(BUILD_LIBFDLIBM)
@@ -112,11 +118,18 @@
 BUILD_LIBVERIFY_SRC:=check_code.c check_format.c
 
 ifeq ($(OPENJDK_TARGET_OS), solaris)
-	ifneq ($(ARCH), amd64)
-		BUILD_LIBVERIFY_REORDER:=$(JDK_TOPDIR)/makefiles/mapfiles/libverify/reorder-$(ARCH)
+	ifneq ($(OPENJDK_TARGET_CPU), x86_64)
+		BUILD_LIBVERIFY_REORDER:=$(JDK_TOPDIR)/makefiles/mapfiles/libverify/reorder-$(OPENJDK_TARGET_CPU)
 	endif
 endif
 
+LIBVERIFY_OPTIMIZATION:=HIGH
+ifneq ($(findstring $(OPENJDK_TARGET_OS),solaris linux),)
+    ifeq ($(ENABLE_DEBUG_SYMBOLS), yes)
+        LIBVERIFY_OPTIMIZATION:=LOW
+    endif
+endif
+
 
 $(eval $(call SetupNativeCompilation,BUILD_LIBVERIFY,\
 		LIBRARY:=verify, \
@@ -124,13 +137,18 @@
 		SRC:=$(JDK_TOPDIR)/src/share/native/common,\
 		INCLUDE_FILES:=$(BUILD_LIBVERIFY_SRC),\
 		LANG:=C,\
-		OPTIMIZATION:=HIGH, \
+		OPTIMIZATION:=$(LIBVERIFY_OPTIMIZATION), \
 		CFLAGS:=$(CFLAGS_JDKLIB),\
 		MAPFILE:=$(JDK_TOPDIR)/makefiles/mapfiles/libverify/mapfile-vers, \
 		LDFLAGS:=$(LDFLAGS_JDKLIB) \
 			 $(call SET_SHARED_LIBRARY_ORIGIN), \
 		LDFLAGS_SUFFIX_posix:=-ljvm -lc,\
 		LDFLAGS_SUFFIX_windows:=jvm.lib,\
+		VERSIONINFO_RESOURCE:=$(JDK_TOPDIR)/src/windows/resource/version.rc,\
+		RC_FLAGS:=$(RC_FLAGS) \
+			  /D "JDK_FNAME=verify.dll" \
+			  /D "JDK_INTERNAL_NAME=verify" \
+			  /D "JDK_FTYPE=0x2L",\
 		REORDER:=$(BUILD_LIBVERIFY_REORDER),\
 		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libverify,\
 		DEBUG_SYMBOLS:=true))
@@ -139,40 +157,32 @@
 
 ##########################################################################################
 
-LIBJAVA_SRC_DIRS:=$(JDK_TOPDIR)/src/$(LEGACY_OPENJDK_TARGET_OS_API)/native/java/lang \
+LIBJAVA_SRC_DIRS:=$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/java/lang \
 		$(JDK_TOPDIR)/src/share/native/java/lang \
 		$(JDK_TOPDIR)/src/share/native/java/lang/ref \
 		$(JDK_TOPDIR)/src/share/native/java/lang/reflect \
 		$(JDK_TOPDIR)/src/share/native/java/io \
-		$(JDK_TOPDIR)/src/$(LEGACY_OPENJDK_TARGET_OS_API)/native/java/io \
+		$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/java/io \
 		$(JDK_TOPDIR)/src/share/native/java/nio \
 		$(JDK_TOPDIR)/src/share/native/java/security \
 		$(JDK_TOPDIR)/src/share/native/common \
 		$(JDK_TOPDIR)/src/share/native/sun/misc \
 		$(JDK_TOPDIR)/src/share/native/sun/reflect \
-		$(JDK_TOPDIR)/src/share/native/java/sql \
 		$(JDK_TOPDIR)/src/share/native/java/util \
 		$(JDK_TOPDIR)/src/share/native/java/util/concurrent/atomic \
-		$(JDK_TOPDIR)/src/$(LEGACY_OPENJDK_TARGET_OS_API)/native/common \
-		$(JDK_TOPDIR)/src/$(LEGACY_OPENJDK_TARGET_OS_API)/native/java/util \
-		$(JDK_TOPDIR)/src/$(LEGACY_OPENJDK_TARGET_OS_API)/native/sun/security/provider \
-		$(JDK_TOPDIR)/src/$(LEGACY_OPENJDK_TARGET_OS_API)/native/sun/io
-
-#
-# TODO
-#
-ARCHPROPNAME:=$(LIBARCH)
-ifeq ($(OPENJDK_TARGET_OS)-$(ARCH), solaris-i586)
-     ARCHPROPNAME:=x86
-else ifeq ($(OPENJDK_TARGET_OS)-$(ARCH_DATA_MODEL), windows-32)
-     ARCHPROPNAME:=x86
-else ifeq ($(OPENJDK_TARGET_OS), macosx)
-     ARCHPROPNAME:=$(ARCH)
+		$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/common \
+		$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/java/util \
+		$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/security/provider \
+		$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/io
+ifneq ($(OPENJDK_TARGET_OS),macosx)
+    LIBJAVA_SRC_DIRS+=$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/util/locale/provider
+else
+    LIBJAVA_SRC_DIRS+=$(JDK_TOPDIR)/src/macosx/native/sun/util/locale/provider
 endif
 
 LIBJAVA_CFLAGS:=$(foreach dir,$(LIBJAVA_SRC_DIRS),-I$(dir)) \
 		  -I$(JDK_TOPDIR)/src/share/native/java/lang/fdlibm/include \
-                  -DARCHPROPNAME='"$(ARCHPROPNAME)"'
+                  -DARCHPROPNAME='"$(OPENJDK_TARGET_CPU_OSARCH)"'
 
 LIBJAVA_CFLAGS += -DJDK_MAJOR_VERSION='"$(JDK_MAJOR_VERSION)"' \
                   -DJDK_MINOR_VERSION='"$(JDK_MINOR_VERSION)"' \
@@ -208,8 +218,8 @@
 endif
 
 ifeq ($(OPENJDK_TARGET_OS), solaris)
-    ifneq ($(ARCH), amd64)
-        LIBJAVA_REORDER:=$(JDK_TOPDIR)/makefiles/mapfiles/libjava/reorder-$(ARCH)
+    ifneq ($(OPENJDK_TARGET_CPU), x86_64)
+        LIBJAVA_REORDER:=$(JDK_TOPDIR)/makefiles/mapfiles/libjava/reorder-$(OPENJDK_TARGET_CPU)
     endif
 endif
 
@@ -233,11 +243,17 @@
 		LDFLAGS_SUFFIX_posix:=-ljvm -lverify, \
 		LDFLAGS_SUFFIX_solaris:=-lnsl -lsocket -lscf $(LIBDL) $(BUILD_LIBFDLIBM) -lc,\
 		LDFLAGS_SUFFIX_linux:=$(LIBDL) $(BUILD_LIBFDLIBM),\
-		LDFLAGS_SUFFIX_macosx:=$(BUILD_LIBFDLIBM) \
+		LDFLAGS_SUFFIX_macosx:=-L$(JDK_OUTPUTDIR)/objs/ -lfdlibm \
                                          -framework CoreFoundation \
                                          -framework Security -framework SystemConfiguration, \
+		VERSIONINFO_RESOURCE:=$(JDK_TOPDIR)/src/windows/resource/version.rc,\
+		RC_FLAGS:=$(RC_FLAGS)\
+			  /D "JDK_FNAME=java.dll" \
+			  /D "JDK_INTERNAL_NAME=java" \
+			  /D "JDK_FTYPE=0x2L",\
 		REORDER:=$(LIBJAVA_REORDER), \
-		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libjava))
+		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libjava,\
+		DEBUG_SYMBOLS:=$(WINDOWS_ONLY)))
 
 BUILD_LIBRARIES += $(BUILD_LIBJAVA)
 
@@ -252,20 +268,14 @@
 BUILD_LIBMLIB_SRC:=$(JDK_TOPDIR)/src/share/native/sun/awt/medialib
 BUILD_LIBMLIB_CFLAGS:=-D__USE_J2D_NAMES -D__MEDIALIB_OLD_NAMES \
 			-I$(BUILD_LIBMLIB_SRC) \
-			-I$(JDK_TOPDIR)/src/$(LEGACY_OPENJDK_TARGET_OS_API)/native/sun/awt/medialib 
+			-I$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/awt/medialib 
 
 BUILD_LIBMLIB_LDLIBS:=
 BUILD_LIBMLIB_IMAGE_MAPFILE:=$(JDK_TOPDIR)/makefiles/mapfiles/libmlib_image/mapfile-vers
 
-ifneq ($(OPENJDK_TARGET_OS), sparc)
-#
-# Yes, this will always be true (until someone makes an OS called sparc)
-#   but this is how it was writtin in old system...keep it like this for now
-#
-	BUILD_LIBMLIB_CFLAGS += -DMLIB_NO_LIBSUNMATH
-endif
-
-ifeq ($(ARCH_DATA_MODEL), 64)
+BUILD_LIBMLIB_CFLAGS += -DMLIB_NO_LIBSUNMATH
+
+ifeq ($(OPENJDK_TARGET_CPU_BITS), 64)
 	BUILD_LIBMLIB_CFLAGS += -DMLIB_OS64BIT
 endif
 
@@ -284,11 +294,16 @@
                         $(BUILD_LIBMLIB_CFLAGS),\
 		MAPFILE:=$(BUILD_LIBMLIB_IMAGE_MAPFILE), \
 		LDFLAGS:=$(LDFLAGS_JDKLIB) \
-                         $(BUILD_LIBMLIB_LDLIBS) \
 			 $(call SET_SHARED_LIBRARY_ORIGIN),\
-		LDFLAGS_SUFFIX:=$(LDFLAGS_JDKLIB_SUFFIX),\
-                LDFLAGS_SUFFIX_posix:=-lm,\
-		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libmlib_image))
+		LDFLAGS_SUFFIX:=$(BUILD_LIBMLIB_LDLIBS) \
+				$(LDFLAGS_JDKLIB_SUFFIX),\
+		VERSIONINFO_RESOURCE:=$(JDK_TOPDIR)/src/windows/resource/version.rc,\
+		RC_FLAGS:=$(RC_FLAGS)\
+			  /D "JDK_FNAME=mlib_image.dll" \
+			  /D "JDK_INTERNAL_NAME=mlib_image" \
+			  /D "JDK_FTYPE=0x2L",\
+		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libmlib_image,\
+		DEBUG_SYMBOLS:=$(WINDOWS_ONLY)))
 
 $(BUILD_LIBMLIB_IMAGE) : $(BUILD_LIBJAVA)
 
@@ -296,15 +311,7 @@
 
 ##########################################################################################
 
-ifeq ($(OPENJDK_TARGET_OS),solaris)
-ifeq ($(ARCH),sparc)
-	BUILD_LIBMLIB_IMAGE_V:=1
-else ifeq ($(ARCH), sparcv9)
-	BUILD_LIBMLIB_IMAGE_V:=1
-endif
-endif
-
-ifeq ($(BUILD_LIBMLIB_IMAGE_V), 1)
+ifeq ($(OPENJDK_TARGET_OS)-$(OPENJDK_TARGET_CPU_ARCH),solaris-sparc)
 
 BUILD_LIBMLIB_IMAGE_V_FILES:=\
         mlib_v_ImageLookUp.c \
@@ -411,7 +418,7 @@
 		INCLUDE_FILES:=$(BUILD_LIBMLIB_IMAGE_V_FILES),\
 		OPTIMIZATION:=HIGHEST, \
 		CFLAGS:=-xarch=sparcvis \
-                      $(JDK_TOPDIR)/src/solaris/native/sun/awt/medialib/vis_$(ARCH_DATA_MODEL).il\
+                      $(JDK_TOPDIR)/src/solaris/native/sun/awt/medialib/vis_$(OPENJDK_TARGET_CPU_BITS).il\
                       $(BUILD_LIBMLIB_V_CFLAGS) \
                       $(CFLAGS_JDKLIB), \
 		MAPFILE:=$(BUILD_LIBMLIB_IMAGE_MAPFILE), \
@@ -428,7 +435,7 @@
 
 LIBAWT_DIRS:=\
 	$(JDK_TOPDIR)/src/share/native/sun/awt \
-	$(JDK_TOPDIR)/src/$(LEGACY_OPENJDK_TARGET_OS_API)/native/sun/awt \
+	$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/awt \
 	$(JDK_TOPDIR)/src/share/native/sun/awt/image \
 	$(JDK_TOPDIR)/src/share/native/sun/awt/image/gif \
 	$(JDK_TOPDIR)/src/share/native/sun/awt/image/cvutils \
@@ -437,17 +444,17 @@
 	$(JDK_TOPDIR)/src/share/native/sun/awt/debug \
 	$(JDK_TOPDIR)/src/share/native/sun/awt/utility \
 	$(JDK_TOPDIR)/src/share/native/sun/java2d \
-	$(JDK_TOPDIR)/src/$(LEGACY_OPENJDK_TARGET_OS_API)/native/sun/java2d \
+	$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/java2d \
 	$(JDK_TOPDIR)/src/share/native/sun/java2d/loops \
 	$(JDK_TOPDIR)/src/share/native/sun/java2d/pipe \
 	$(JDK_TOPDIR)/src/share/native/sun/awt/image \
 	$(JDK_TOPDIR)/src/share/native/sun/java2d/opengl \
-	$(JDK_TOPDIR)/src/$(LEGACY_OPENJDK_TARGET_OS_API)/native/sun/java2d/opengl \
-	$(JDK_TOPDIR)/src/$(LEGACY_OPENJDK_TARGET_OS_API)/native/sun/java2d/x11 \
+	$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/java2d/opengl \
+	$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/java2d/x11 \
 	$(JDK_TOPDIR)/src/share/native/sun/font \
-	$(JDK_TOPDIR)/src/$(LEGACY_OPENJDK_TARGET_OS_API)/native/sun/windows \
-	$(JDK_TOPDIR)/src/$(LEGACY_OPENJDK_TARGET_OS_API)/native/sun/java2d/windows \
-	$(JDK_TOPDIR)/src/$(LEGACY_OPENJDK_TARGET_OS_API)/native/sun/java2d/d3d
+	$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/windows \
+	$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/java2d/windows \
+	$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/java2d/d3d
 
 
 LIBAWT_CFLAGS:=-D__MEDIALIB_OLD_NAMES -D__USE_J2D_NAMES \
@@ -524,11 +531,12 @@
 	debug_trace.c \
 	debug_util.c
 
-ifneq (,$(filter $(OPENJDK_TARGET_OS), solaris linux macosx))
+ifneq (,$(filter $(OPENJDK_TARGET_OS), solaris linux))
 	LIBAWT_FILES += awt_LoadLibrary.c initIDs.c img_colors.c
 endif
 
 ifeq ($(OPENJDK_TARGET_OS),macosx)
+	LIBAWT_FILES += awt_LoadLibrary.c img_colors.c
 	LIBAWT_DIRS += $(JDK_TOPDIR)/src/macosx/native/com/apple/resources
 	LIBAWT_FILES += awt_LoadLibrary.c MacOSXResourceBundle.m
 	LIBAWT_CFLAGS += -F/System/Library/Frameworks/JavaVM.framework/Frameworks
@@ -539,7 +547,7 @@
 ifeq ($(OPENJDK_TARGET_OS)-$(OPENJDK_TARGET_CPU_ARCH), solaris-sparc)
         LIBAWT_CFLAGS += -DMLIB_ADD_SUFF
         LIBAWT_CFLAGS += -xarch=sparcvis
-	LIBAWT_CFLAGS += $(JDK_TOPDIR)/src/solaris/native/sun/awt/medialib/vis_$(ARCH_DATA_MODEL).il
+	LIBAWT_CFLAGS += $(JDK_TOPDIR)/src/solaris/native/sun/awt/medialib/vis_$(OPENJDK_TARGET_CPU_BITS).il
         LIBAWT_CFLAGS += \
             -I$(JDK_TOPDIR)/src/solaris/native/sun/awt/medialib \
             -I$(JDK_TOPDIR)/src/solaris/native/sun/java2d/medialib \
@@ -591,7 +599,7 @@
                 vis_XorBlit.c             \
                 mlib_v_ImageCopy_blk.s
 
-	ifeq ($(OPENJDK_TARGET_CPU_BITS),64)
+	ifeq ($(OPENJDK_TARGET_CPU),sparcv9)
 		LIBAWT_ASFLAGS=-P -xarch=v9a
 	else
 		LIBAWT_ASFLAGS=-P -xarch=v8plusa
@@ -644,8 +652,8 @@
 			MouseInfo.cpp \
 			rect.c
 	LIBAWT_LANG:=C++
-	LIBAWT_CFLAGS += $(GX_OPTION) -DUNICODE -D_UNICODE
-	ifeq ($(ARCH_DATA_MODEL), 64)
+	LIBAWT_CFLAGS += -EHsc -DUNICODE -D_UNICODE
+	ifeq ($(OPENJDK_TARGET_CPU_BITS), 64)
 		LIBAWT_CFLAGS += -DMLIB_OS64BIT
 	endif
 
@@ -686,22 +694,25 @@
 				 /DELAYLOAD:winspool.drv /DELAYLOAD:imm32.dll \
 				 /DELAYLOAD:ole32.dll /DELAYLOAD:comdlg32.dll \
 				 /DELAYLOAD:comctl32.dll /DELAYLOAD:shlwapi.dll,\
-		LDFLAGS_macosx:=-lmlib_image \
-                                 -framework Cocoa \
-				 -framework OpenGL \
-				 -F/System/Library/Frameworks/JavaVM.framework/Frameworks \
-				 -framework JavaNativeFoundation \
-				 -framework JavaRuntimeSupport \
-				 -framework ApplicationServices \
-				 -framework AudioToolbox,\
-		LDFLAGS_solaris:=-R/usr/dt/lib$(ISA_DIR) -R$(OPENWIN_LIB)$(ISA_DIR),\
-		LDFLAGS_SUFFIX_posix:=-ljvm $(LIBM) -ljava $(LIBDL),\
+		LDFLAGS_solaris:=-R/usr/dt/lib$(OPENJDK_TARGET_CPU_ISADIR) -R$(OPENWIN_LIB)$(OPENJDK_TARGET_CPU_ISADIR),\
+		LDFLAGS_SUFFIX_linux:=-ljvm $(LIBM) $(LIBDL) -ljava,\
+		LDFLAGS_SUFFIX_solaris:=-ljvm $(LIBM) $(LIBDL) -ljava,\
+		LDFLAGS_SUFFIX_macosx:=-lmlib_image -ljvm $(LIBM) \
+				       -framework Cocoa \
+				       -framework OpenGL \
+				       -F/System/Library/Frameworks/JavaVM.framework/Frameworks \
+				       -framework JavaNativeFoundation \
+				       -framework JavaRuntimeSupport \
+				       -framework ApplicationServices \
+				       -framework AudioToolbox \
+				       -ljava,\
 		VERSIONINFO_RESOURCE:=$(LIBAWT_VERSIONINFO_RESOURCE),\
 		RC_FLAGS:=$(RC_FLAGS) $(LIBAWT_RC_FLAGS) \
 			  /D "JDK_FNAME=awt.dll" \
 			  /D "JDK_INTERNAL_NAME=awt" \
 			  /D "JDK_FTYPE=0x2L",\
-		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libawt))
+		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libawt,\
+		DEBUG_SYMBOLS:=$(WINDOWS_ONLY)))
 
 $(BUILD_LIBAWT) : $(BUILD_LIBJAVA)
 
@@ -728,25 +739,25 @@
 		$(JDK_TOPDIR)/src/share/native/sun/awt/debug \
 		$(JDK_TOPDIR)/src/share/native/sun/awt/utility \
 		$(JDK_TOPDIR)/src/share/native/sun/font \
-		$(JDK_TOPDIR)/src/$(LEGACY_OPENJDK_TARGET_OS_API)/native/sun/font \
+		$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/font \
 		$(JDK_TOPDIR)/src/share/native/sun/java2d/opengl \
-		$(JDK_TOPDIR)/src/$(LEGACY_OPENJDK_TARGET_OS_API)/native/sun/awt \
-		$(JDK_TOPDIR)/src/$(LEGACY_OPENJDK_TARGET_OS_API)/native/sun/java2d/opengl \
-		$(JDK_TOPDIR)/src/$(LEGACY_OPENJDK_TARGET_OS_API)/native/sun/java2d/x11 \
-		$(JDK_TOPDIR)/src/$(LEGACY_OPENJDK_TARGET_OS_API)/native/sun/xawt \
+		$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/awt \
+		$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/java2d/opengl \
+		$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/java2d/x11 \
+		$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/xawt \
 
 LIBAWT_XAWT_CFLAGS:=-DXAWT -DXAWT_HACK \
         -DX11_PATH=\"$(X11_PATH)\" -DPACKAGE_PATH=\"$(PACKAGE_PATH)\" \
 	$(CUPS_CFLAGS) \
 	$(foreach dir,$(LIBAWT_XAWT_DIRS),-I$(dir)) \
 	-I$(JDK_TOPDIR)/src/share/native/sun/java2d \
-	-I$(JDK_TOPDIR)/src/$(LEGACY_OPENJDK_TARGET_OS_API)/native/sun/java2d \
+	-I$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/java2d \
 	-I$(JDK_TOPDIR)/src/share/native/sun/java2d/loops \
 	-I$(JDK_TOPDIR)/src/share/native/sun/java2d/pipe \
 	-I$(JDK_TOPDIR)/src/share/native/sun/awt/image \
 	-I$(JDK_TOPDIR)/src/share/native/sun/awt/image/cvutils \
 	-I$(JDK_TOPDIR)/src/share/native/sun/awt/debug \
-	-I$(JDK_TOPDIR)/src/$(LEGACY_OPENJDK_TARGET_OS_API)/native/sun/jdga
+	-I$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/jdga
 
 ifeq ($(OPENJDK_TARGET_OS),solaris)
 	LIBAWT_XAWT_CFLAGS += -DFUNCPROTO=15
@@ -816,13 +827,15 @@
 LIBAWT_XAWT_LDFLAGS_SUFFIX:=$(LIBM) -lawt -lXext -lX11 -lXrender $(LIBDL) -lXtst -lXi  -ljava -ljvm -lc
 
 ifeq ($(OPENJDK_TARGET_OS), linux)
-	LIBAWT_XAWT_LDFLAGS_SUFFIX += -lpthread
+        # To match old build, add this to LDFLAGS instead of suffix.
+	LIBAWT_XAWT_LDFLAGS += -lpthread
 endif
 
 ifeq ($(OPENJDK_TARGET_OS), macosx)
 	LIBAWT_XAWT_LDFLAGS_SUFFIX += -lpthread
 endif
 
+# On macosx, the shared library origin is set twice for this lib.
 $(eval $(call SetupNativeCompilation,BUILD_LIBAWT_XAWT,\
 		LIBRARY:=awt_xawt,\
                 OUTPUT_DIR:=$(INSTALL_LIBRARIES_HERE),\
@@ -834,12 +847,26 @@
                         $(X_CFLAGS),\
 		MAPFILE:=$(JDK_TOPDIR)/makefiles/mapfiles/libawt_xawt/mapfile-vers, \
 		LDFLAGS:=$(LDFLAGS_JDKLIB) \
-			 $(call SET_SHARED_LIBRARY_ORIGIN) \
-			 $(X_LIBS),\
-		LDFLAGS_solaris:=-L$(OPENWIN_HOME)/sfw/lib$(ISA_DIR) -L$(OPENWIN_HOME)/lib$(ISA_DIR) \
-				 -R$(OPENWIN_HOME)/sfw/lib$(ISA_DIR) -R$(OPENWIN_HOME)/lib$(ISA_DIR) \
-				 -R/usr/dt/lib$(ISA_DIR),\
+			 $(X_LIBS) $(LIBAWT_XAWT_LDFLAGS),\
+		LDFLAGS_linux:=$(call SET_SHARED_LIBRARY_ORIGIN) \
+			       $(call SET_SHARED_LIBRARY_ORIGIN,/..),\
+		LDFLAGS_solaris:=-L$(OPENWIN_HOME)/sfw/lib$(OPENJDK_TARGET_CPU_ISADIR) \
+				 -L$(OPENWIN_LIB)$(OPENJDK_TARGET_CPU_ISADIR) \
+				 -R$(OPENWIN_HOME)/sfw/lib$(OPENJDK_TARGET_CPU_ISADIR) \
+				 -R$(OPENWIN_LIB)$(OPENJDK_TARGET_CPU_ISADIR) \
+				 -R/usr/dt/lib$(OPENJDK_TARGET_CPU_ISADIR) \
+			 	 $(call SET_SHARED_LIBRARY_ORIGIN) \
+			 	 $(call SET_SHARED_LIBRARY_ORIGIN,/..),\
+		LDFLAGS_macosx:=$(call SET_SHARED_LIBRARY_ORIGIN) \
+				$(call SET_SHARED_LIBRARY_ORIGIN). \
+				$(call SET_SHARED_LIBRARY_ORIGIN) \
+				$(call SET_SHARED_LIBRARY_ORIGIN).,\
 		LDFLAGS_SUFFIX:=$(LIBAWT_XAWT_LDFLAGS_SUFFIX),\
+		VERSIONINFO_RESOURCE:=$(JDK_TOPDIR)/src/windows/resource/version.rc,\
+		RC_FLAGS:=$(RC_FLAGS)\
+			  /D "JDK_FNAME=xawt.dll" \
+			  /D "JDK_INTERNAL_NAME=xawt" \
+			  /D "JDK_FTYPE=0x2L",\
 		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libawt_xawt))
 
 $(BUILD_LIBAWT_XAWT) : $(BUILD_LIBJAVA)
@@ -885,8 +912,8 @@
 
 BUILD_LIBZIP_REORDER:=
 ifeq ($(OPENJDK_TARGET_OS), solaris)
-    ifneq ($(ARCH), amd64)
-        BUILD_LIBZIP_REORDER:=$(JDK_TOPDIR)/makefiles/mapfiles/libzip/reorder-$(ARCH)
+    ifneq ($(OPENJDK_TARGET_CPU), x86_64)
+        BUILD_LIBZIP_REORDER:=$(JDK_TOPDIR)/makefiles/mapfiles/libzip/reorder-$(OPENJDK_TARGET_CPU)
     endif
 endif
 
@@ -905,17 +932,26 @@
 		CFLAGS:=$(CFLAGS_JDKLIB) \
                         $(LIBZ_INCLUDE) \
 		        -I$(JDK_TOPDIR)/src/share/native/java/io \
-                        -I$(JDK_TOPDIR)/src/$(LEGACY_OPENJDK_TARGET_OS_API)/native/java/io,\
+                        -I$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/java/io,\
 		CFLAGS_posix:=$(BUILD_LIBZIP_MMAP) -UDEBUG,\
 		MAPFILE:=$(JDK_TOPDIR)/makefiles/mapfiles/libzip/mapfile-vers, \
 		REORDER:=$(BUILD_LIBZIP_REORDER), \
 		LDFLAGS:=$(LDFLAGS_JDKLIB) \
+			 $(call SET_SHARED_LIBRARY_ORIGIN) \
 			 $(EXPORT_ZIP_FUNCS), \
-		LDFLAGS_winapi:=-export:ZIP_Open -export:ZIP_Close -export:ZIP_FindEntry \
+		LDFLAGS_windows:=-export:ZIP_Open -export:ZIP_Close -export:ZIP_FindEntry \
                                 -export:ZIP_ReadEntry -export:ZIP_GetNextEntry jvm.lib \
                                 $(WIN_JAVA_LIB),\
-		LDFLAGS_SUFFIX:=$(LDFLAGS_JDKLIB_SUFFIX) $(LIBZ),\
-		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libzip))
+		LDFLAGS_SUFFIX_linux:=-ljvm -ljava $(LIBZ),\
+		LDFLAGS_SUFFIX_solaris:=-ljvm -ljava $(LIBZ),\
+		LDFLAGS_SUFFIX_macosx:=$(LIBZ) -ljava -ljvm,\
+		VERSIONINFO_RESOURCE:=$(JDK_TOPDIR)/src/windows/resource/version.rc,\
+		RC_FLAGS:=$(RC_FLAGS)\
+			  /D "JDK_FNAME=zip.dll" \
+			  /D "JDK_INTERNAL_NAME=zip" \
+			  /D "JDK_FTYPE=0x2L",\
+		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libzip,\
+		DEBUG_SYMBOLS:=$(WINDOWS_ONLY)))
 
 $(BUILD_LIBZIP) : $(BUILD_LIBJAVA)
 
@@ -934,24 +970,24 @@
 			 -DNO_ZLIB -DUNPACK_JNI -DFULL,\
 		CFLAGS_release:=-DPRODUCT,\
 		MAPFILE:=$(JDK_TOPDIR)/makefiles/mapfiles/libunpack/mapfile-vers, \
-		LDFLAGS:=$(LDFLAGS_JDKLIB)\
+		LDFLAGS:=$(LDFLAGS_JDKLIB) $(LDFLAGS_CXX_JDK) \
 			 $(call SET_SHARED_LIBRARY_ORIGIN),\
-		LDFLAGS_winapi:=-map:$(JDK_OUTPUTDIR)/objs/unpack.map /debug \
+		LDFLAGS_windows:=-map:$(JDK_OUTPUTDIR)/objs/unpack.map /debug \
 				jvm.lib $(WIN_JAVA_LIB),\
-		LDFLAGS_SUFFIX:=$(LDFLAGS_JDKLIB_SUFFIX),\
-		LDFLAGS_SUFFIX_posix:=$(LIBCXX),\
+		LDFLAGS_SUFFIX_posix:=-ljvm $(LIBCXX) -ljava -lc,\
 		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libunpack,\
 		VERSIONINFO_RESOURCE:=$(JDK_TOPDIR)/src/windows/resource/version.rc,\
 		RC_FLAGS:=$(RC_FLAGS)\
 			  /D "JDK_FNAME=unpack.dll" \
 			  /D "JDK_INTERNAL_NAME=unpack" \
-			  /D "JDK_FTYPE=0x2L"))
+			  /D "JDK_FTYPE=0x2L",\
+		DEBUG_SYMBOLS:=$(WINDOWS_ONLY)))
 
 $(BUILD_LIBUNPACK) : $(BUILD_LIBJAVA)
 
 BUILD_LIBRARIES += $(BUILD_LIBUNPACK)
 
-ifeq ($(OPENJDK_TARGET_OS_API),winapi)
+ifeq ($(OPENJDK_TARGET_OS),windows)
     $(INSTALL_LIBRARIES_HERE)/$(LIBRARY_PREFIX)unpack.map: $(BUILD_LIBUNPACK)
 	$(ECHO) Copying $(@F)
 	$(CP) $(patsubst %$(SHARED_LIBRARY_SUFFIX),%.map,$<) $@
@@ -977,16 +1013,21 @@
 $(eval $(call SetupNativeCompilation,BUILD_LIBATTACH,\
 		LIBRARY:=attach, \
                 OUTPUT_DIR:=$(INSTALL_LIBRARIES_HERE),\
-                SRC:=$(JDK_TOPDIR)/src/$(LEGACY_OPENJDK_TARGET_OS_API)/native/sun/tools/attach,\
+                SRC:=$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/tools/attach,\
 		EXCLUDE_FILES:=$(LIBATTACH_EXCLUDE_FILES),\
 		LANG:=C,\
 		OPTIMIZATION:=LOW, \
 		CFLAGS:=$(CFLAGS_JDKLIB),\
 		MAPFILE:=$(JDK_TOPDIR)/makefiles/mapfiles/libattach/mapfile-$(OPENJDK_TARGET_OS), \
+		VERSIONINFO_RESOURCE:=$(JDK_TOPDIR)/src/windows/resource/version.rc,\
+		RC_FLAGS:=$(RC_FLAGS) \
+			  /D "JDK_FNAME=attach.dll" \
+			  /D "JDK_INTERNAL_NAME=attach" \
+			  /D "JDK_FTYPE=0x2L",\
 		LDFLAGS:=$(LDFLAGS_JDKLIB) \
 			 $(call SET_SHARED_LIBRARY_ORIGIN),\
 		LDFLAGS_solaris:=-ldoor,\
-		LDFLAGS_winapi:=psapi.lib advapi32.lib $(WIN_JAVA_LIB) jvm.lib,\
+		LDFLAGS_windows:=psapi.lib advapi32.lib $(WIN_JAVA_LIB) jvm.lib,\
 		LDFLAGS_SUFFIX:=$(LDFLAGS_JDKLIB_SUFFIX),\
 		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libattach,\
 		DEBUG_SYMBOLS:=true))
@@ -1001,21 +1042,26 @@
 		LIBRARY:=dt_socket,\
                 OUTPUT_DIR:=$(INSTALL_LIBRARIES_HERE),\
                 SRC:=$(JDK_TOPDIR)/src/share/transport/socket \
-			$(JDK_TOPDIR)/src/$(LEGACY_OPENJDK_TARGET_OS_API)/transport/socket,\
+			$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/transport/socket,\
 		LANG:=C,\
 		OPTIMIZATION:=LOW, \
 		CFLAGS:=$(CFLAGS_JDKLIB) -DUSE_MMAP \
                         -I$(INCLUDEDIR) -I$(JDK_OUTPUTDIR)/include/$(OPENJDK_TARGET_OS) \
                         -I$(JDK_TOPDIR)/src/share/transport/socket \
-		        -I$(JDK_TOPDIR)/src/$(LEGACY_OPENJDK_TARGET_OS_API)/transport/socket \
+		        -I$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/transport/socket \
                         -I$(JDK_TOPDIR)/src/share/back/export \
                         -I$(JDK_TOPDIR)/src/share/back,\
 		MAPFILE:=$(JDK_TOPDIR)/makefiles/mapfiles/libdt_socket/mapfile-vers, \
-		LDFLAGS:=$(LDFLAGS_JDKLIB), \
-		LDFLAGS_SUFFIX_linux:=$(LDFLAGS_JDKLIB_SUFFIX) -lpthread,\
+		LDFLAGS:=$(LDFLAGS_JDKLIB) \
+			 $(call SET_SHARED_LIBRARY_ORIGIN), \
+		LDFLAGS_SUFFIX_linux:=-lpthread,\
 		LDFLAGS_SUFFIX_solaris:=-lnsl -lsocket,\
-		LDFLAGS_SUFFIX_winapi:=$(LDFLAGS_JDKLIB_SUFFIX) -export:jdwpTransport_OnLoad ws2_32.lib,\
-		LDFLAGS_SUFFIX:=,\
+		LDFLAGS_SUFFIX_windows:=$(LDFLAGS_JDKLIB_SUFFIX) -export:jdwpTransport_OnLoad ws2_32.lib,\
+		VERSIONINFO_RESOURCE:=$(JDK_TOPDIR)/src/windows/resource/version.rc,\
+		RC_FLAGS:=$(RC_FLAGS)\
+			  /D "JDK_FNAME=dt_socket.dll" \
+			  /D "JDK_INTERNAL_NAME=dt_socket" \
+			  /D "JDK_FTYPE=0x2L",\
 		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libdt_socket,\
 		DEBUG_SYMBOLS:=true))
 
@@ -1025,55 +1071,66 @@
 
 ##########################################################################################
 
-ifeq ($(OPENJDK_TARGET_OS_API),winapi)
+ifeq ($(OPENJDK_TARGET_OS),windows)
 
   $(eval $(call SetupNativeCompilation,BUILD_LIBDT_SHMEM,\
 		LIBRARY:=dt_shmem,\
                 OUTPUT_DIR:=$(INSTALL_LIBRARIES_HERE),\
                 SRC:=$(JDK_TOPDIR)/src/share/native/com/sun/tools/jdi \
 			$(JDK_TOPDIR)/src/share/transport/shmem \
-			$(JDK_TOPDIR)/src/$(LEGACY_OPENJDK_TARGET_OS_API)/transport/shmem,\
+			$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/transport/shmem,\
 		LANG:=C,\
 		OPTIMIZATION:=LOW, \
 		CFLAGS:=$(CFLAGS_JDKLIB) -DUSE_MMAP\
                         -I$(INCLUDEDIR) -I$(JDK_OUTPUTDIR)/include/$(OPENJDK_TARGET_OS) \
                         -I$(JDK_TOPDIR)/src/share/transport/shmem \
-		        -I$(JDK_TOPDIR)/src/$(LEGACY_OPENJDK_TARGET_OS_API)/transport/shmem \
+		        -I$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/transport/shmem \
                         -I$(JDK_TOPDIR)/src/share/back/export, \
 		LDFLAGS:=$(LDFLAGS_JDKLIB),\
-		LDFLAGS_winapi:=-export:jdwpTransport_OnLoad,\
+		LDFLAGS_windows:=-export:jdwpTransport_OnLoad,\
 		LDFLAGS_SUFFIX:=$(LDFLAGS_JDKLIB_SUFFIX),\
-		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libdt_shmem))
+		VERSIONINFO_RESOURCE:=$(JDK_TOPDIR)/src/windows/resource/version.rc,\
+		RC_FLAGS:=$(RC_FLAGS)\
+			  /D "JDK_FNAME=dt_shmem.dll" \
+			  /D "JDK_INTERNAL_NAME=dt_shmem" \
+			  /D "JDK_FTYPE=0x2L",\
+		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libdt_shmem,\
+		DEBUG_SYMBOLS:=$(WINDOWS_ONLY)))
 
   BUILD_LIBRARIES += $(BUILD_LIBDT_SHMEM)
 
 endif # OPENJDK_TARGET_OS
 
 ##########################################################################################
-# JDWP_LOGGING causes log messages to be compiled into the library. These reference the 
-# __FILE__ macro which here expands to the absolute path of the file while the old build 
-# system used a relative path. This causes the binaries to differ in size.
+# JDWP_LOGGING causes log messages to be compiled into the library.
 $(eval $(call SetupNativeCompilation,BUILD_LIBJDWP,\
 		LIBRARY:=jdwp, \
                 OUTPUT_DIR:=$(INSTALL_LIBRARIES_HERE),\
-                SRC:=$(JDK_TOPDIR)/src/share/back $(JDK_TOPDIR)/src/$(LEGACY_OPENJDK_TARGET_OS_API)/back,\
+                SRC:=$(JDK_TOPDIR)/src/share/back $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/back,\
 		LANG:=C,\
 		OPTIMIZATION:=LOW, \
 		CFLAGS:=$(CFLAGS_JDKLIB) -DJDWP_LOGGING\
 		 -I$(JDK_TOPDIR)/src/share/transport/export \
                  -I$(JDK_TOPDIR)/src/share/back/export \
                  -I$(JDK_TOPDIR)/src/share/npt \
-                 -I$(JDK_TOPDIR)/src/$(LEGACY_OPENJDK_TARGET_OS_API)/npt \
+                 -I$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/npt \
                  -I$(JDK_TOPDIR)/src/share/back \
-                 -I$(JDK_TOPDIR)/src/$(LEGACY_OPENJDK_TARGET_OS_API)/back \
+                 -I$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/back \
 		 -I$(JDK_OUTPUTDIR)/gensrc_jdwp_headers,\
 		MAPFILE:=$(JDK_TOPDIR)/makefiles/mapfiles/libjdwp/mapfile-vers, \
-		LDFLAGS:=$(filter-out -ljava,$(LDFLAGS_JDKLIB)), \
-		LDFLAGS_SUFFIX_linux:=$(LDFLAGS_JDKLIB_SUFFIX) $(LIBDL),\
+		LDFLAGS:=$(LDFLAGS_JDKLIB) \
+			 $(call SET_SHARED_LIBRARY_ORIGIN),\
+		LDFLAGS_SUFFIX_linux:=$(LIBDL),\
 		LDFLAGS_SUFFIX_solaris:=$(LIBDL),\
 		LDFLAGS_SUFFIX_windows:=$(LDFLAGS_JDKLIB_SUFFIX),\
 		LDFLAGS_SUFFIX:=,\
-		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libjdwp))
+		VERSIONINFO_RESOURCE:=$(JDK_TOPDIR)/src/windows/resource/version.rc,\
+		RC_FLAGS:=$(RC_FLAGS)\
+			  /D "JDK_FNAME=jdwp.dll" \
+			  /D "JDK_INTERNAL_NAME=jdwp" \
+			  /D "JDK_FTYPE=0x2L",\
+		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libjdwp,\
+		DEBUG_SYMBOLS:=$(WINDOWS_ONLY)))
 
 $(BUILD_LIBJDWP) : $(BUILD_LIBJAVA)
 
@@ -1097,19 +1154,24 @@
 $(eval $(call SetupNativeCompilation,BUILD_LIBJAAS,\
 		LIBRARY:=$(LIBJAAS_NAME),\
                 OUTPUT_DIR:=$(INSTALL_LIBRARIES_HERE),\
-                SRC:=$(JDK_TOPDIR)/src/$(LEGACY_OPENJDK_TARGET_OS_API)/native/com/sun/security/auth/module,\
+                SRC:=$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/com/sun/security/auth/module,\
 		LANG:=C,\
 		OPTIMIZATION:=LOW, \
 		CFLAGS:=$(CFLAGS_JDKLIB),\
 		MAPFILE:=$(LIBJAAS_MAPFILE),\
 		LDFLAGS:=$(filter-out -ljava,$(LDFLAGS_JDKLIB)) \
 			 $(call SET_SHARED_LIBRARY_ORIGIN),\
-		LDFLAGS_winapi:=netapi32.lib user32.lib mpr.lib advapi32.lib,\
-		LDFLAGS_SUFFIX_linux:=$(LDFLAGS_JDKLIB_SUFFIX),\
+		LDFLAGS_windows:=netapi32.lib user32.lib mpr.lib advapi32.lib,\
 		LDFLAGS_SUFFIX_windows:=$(LDFLAGS_JDKLIB_SUFFIX),\
 		LDFLAGS_SUFFIX:=,\
 		EXCLUDE_FILES:=$(LIBJAAS_EXCLUDE_FILES),\
-		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libjaas))
+		VERSIONINFO_RESOURCE:=$(JDK_TOPDIR)/src/windows/resource/version.rc,\
+		RC_FLAGS:=$(RC_FLAGS) \
+			  /D "JDK_FNAME=$(LIBJAAS_NAME).dll" \
+			  /D "JDK_INTERNAL_NAME=$(LIBJAAS_NAME)" \
+			  /D "JDK_FTYPE=0x2L",\
+		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libjaas,\
+		DEBUG_SYMBOLS:=$(WINDOWS_ONLY)))
 
 $(BUILD_LIBJAAS) : $(BUILD_LIBJAVA)
 
@@ -1121,7 +1183,7 @@
 		LIBRARY:=jsdt,\
                 OUTPUT_DIR:=$(INSTALL_LIBRARIES_HERE),\
                 SRC:=$(JDK_TOPDIR)/src/share/native/sun/tracing/dtrace\
-			$(JDK_TOPDIR)/src/$(LEGACY_OPENJDK_TARGET_OS_API)/native/sun/tracing/dtrace,\
+			$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/tracing/dtrace,\
 		LANG:=C,\
 		OPTIMIZATION:=LOW, \
 		CFLAGS:=$(CFLAGS_JDKLIB)\
@@ -1129,12 +1191,17 @@
 		MAPFILE:=$(JDK_TOPDIR)/makefiles/mapfiles/libjsdt/mapfile-vers, \
 		LDFLAGS:=$(LDFLAGS_JDKLIB) \
 			 $(call SET_SHARED_LIBRARY_ORIGIN),\
-		LDFLAGS_SUFFIX_linux:=$(LDFLAGS_JDKLIB_SUFFIX)  $(LIBDL),\
-		LDFLAGS_SUFFIX_winapi:=$(LDFLAGS_JDKLIB_SUFFIX) $(LIBDL),\
+		LDFLAGS_SUFFIX_linux:=$(LIBDL),\
+		LDFLAGS_SUFFIX_windows:=$(LDFLAGS_JDKLIB_SUFFIX) $(LIBDL),\
 		LDFLAGS_SUFFIX_macosx:=                         $(LIBDL),\
 		LDFLAGS_SUFFIX:=,\
+		VERSIONINFO_RESOURCE:=$(JDK_TOPDIR)/src/windows/resource/version.rc,\
+		RC_FLAGS:=$(RC_FLAGS)\
+			  /D "JDK_FNAME=jsdt.dll" \
+			  /D "JDK_INTERNAL_NAME=jsdt" \
+			  /D "JDK_FTYPE=0x2L",\
 		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libjsdt, \
-                DEBUG_SYMBOLS:= yes))
+                DEBUG_SYMBOLS:=true))
 
 $(BUILD_LIBJSDT) : $(BUILD_LIBJAVA)
 
@@ -1163,14 +1230,20 @@
 			-I$(JDK_TOPDIR)/src/share/native/sun/java2d \
 			-I$(JDK_TOPDIR)/src/share/native/sun/awt/debug,\
 		CFLAGS_solaris:=-xc99=no_lib,\
-		CFLAGS_winapi:=-DCMS_IS_WINDOWS_,\
+		CFLAGS_windows:=-DCMS_IS_WINDOWS_,\
 		MAPFILE:=$(JDK_TOPDIR)/makefiles/mapfiles/liblcms/mapfile-vers, \
-		LDFLAGS:=$(LDFLAGS_JDKLIB), \
-		LDFLAGS_solaris:=/usr/lib$(ISA_DIR)/libm.so.2,\
-		LDFLAGS_winapi:=$(WIN_AWT_LIB) $(WIN_JAVA_LIB),\
-		LDFLAGS_SUFFIX:=$(LDFLAGS_JDKLIB_SUFFIX),\
-		LDFLAGS_SUFFIX_posix:=-lawt,\
-		LDFLAGS_SUFFIX_linux:=-lm,\
+		LDFLAGS:=$(LDFLAGS_JDKLIB) \
+                         $(call SET_SHARED_LIBRARY_ORIGIN), \
+		LDFLAGS_solaris:=/usr/lib$(OPENJDK_TARGET_CPU_ISADIR)/libm.so.2,\
+		LDFLAGS_windows:=$(WIN_AWT_LIB) $(WIN_JAVA_LIB),\
+		LDFLAGS_SUFFIX_solaris:=-lawt -ljava -ljvm,\
+		LDFLAGS_SUFFIX_macosx:=$(LIBM) -lawt -ljava -ljvm,\
+		LDFLAGS_SUFFIX_linux:=-lm -lawt -ljava -ljvm,\
+		VERSIONINFO_RESOURCE:=$(JDK_TOPDIR)/src/windows/resource/version.rc,\
+		RC_FLAGS:=$(RC_FLAGS)\
+			  /D "JDK_FNAME=lcms.dll" \
+			  /D "JDK_INTERNAL_NAME=lcms" \
+			  /D "JDK_FTYPE=0x2L",\
 		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/liblcms))
 
     BUILD_LIBRARIES += $(BUILD_LIBLCMS)
@@ -1190,8 +1263,8 @@
 
 BUILD_LIBJPEG_REORDER:=
 ifeq ($(OPENJDK_TARGET_OS), solaris)
-    ifneq ($(ARCH), amd64)
-        BUILD_LIBJPEG_REORDER:=$(JDK_TOPDIR)/makefiles/mapfiles/libjpeg/reorder-$(ARCH)
+    ifneq ($(OPENJDK_TARGET_CPU), x86_64)
+        BUILD_LIBJPEG_REORDER:=$(JDK_TOPDIR)/makefiles/mapfiles/libjpeg/reorder-$(OPENJDK_TARGET_CPU)
     endif
 endif
 
@@ -1223,11 +1296,16 @@
 		MAPFILE:=$(BUILD_LIBJPEG_MAPFILE), \
 		LDFLAGS:=$(LDFLAGS_JDKLIB) \
 			 $(call SET_SHARED_LIBRARY_ORIGIN),\
-		LDFLAGS_linux:=$(LIBDL),\
-		LDFLAGS_winapi:=$(WIN_JAVA_LIB) jvm.lib,\
+		LDFLAGS_windows:=$(WIN_JAVA_LIB) jvm.lib,\
 		LDFLAGS_SUFFIX:=$(LDFLAGS_JDKLIB_SUFFIX),\
+		VERSIONINFO_RESOURCE:=$(JDK_TOPDIR)/src/windows/resource/version.rc,\
+		RC_FLAGS:=$(RC_FLAGS)\
+			  /D "JDK_FNAME=jpeg.dll" \
+			  /D "JDK_INTERNAL_NAME=jpeg" \
+			  /D "JDK_FTYPE=0x2L",\
 		REORDER:=$(BUILD_LIBJPEG_REORDER),\
-		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libjpeg))
+		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libjpeg,\
+		DEBUG_SYMBOLS:=$(WINDOWS_ONLY)))
 
 $(BUILD_LIBJPEG) : $(BUILD_LIBJAVA)
 
@@ -1263,11 +1341,11 @@
 			-I$(JDK_TOPDIR)/src/share/native/sun/font \
 			-I$(JDK_TOPDIR)/src/share/native/sun/font/layout \
 			-I$(JDK_TOPDIR)/src/share/native/sun/awt/image/cvutils \
-			-I$(JDK_TOPDIR)/src/$(LEGACY_OPENJDK_TARGET_OS_API)/native/sun/awt \
+			-I$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/awt \
 			-I$(JDK_TOPDIR)/src/share/native/sun/awt/debug \
 			-I$(JDK_TOPDIR)/src/share/native/sun/java2d/loops \
 			-I$(JDK_TOPDIR)/src/share/native/sun/java2d/pipe \
-			-I$(JDK_TOPDIR)/src/$(LEGACY_OPENJDK_TARGET_OS_API)/native/sun/java2d \
+			-I$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/java2d \
 			-I$(JDK_TOPDIR)/src/share/native/sun/java2d
 
 # Turn off aliasing with GCC for ExtensionSubtables.cpp
@@ -1279,25 +1357,30 @@
 		LIBRARY:=fontmanager, \
                 OUTPUT_DIR:=$(INSTALL_LIBRARIES_HERE),\
                 SRC:=$(JDK_TOPDIR)/src/share/native/sun/font\
-		     $(JDK_TOPDIR)/src/$(LEGACY_OPENJDK_TARGET_OS_API)/native/sun/font,\
+		     $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/font,\
 		EXCLUDE_FILES:=$(LIBFONTMANAGER_EXCLUDE_FILES) \
 			       AccelGlyphCache.c,\
 		LANG:=C++,\
 		CFLAGS:=$(CFLAGS_JDKLIB) $(BUILD_LIBFONTMANAGER_CFLAGS_COMMON),\
 		CXXFLAGS:=$(CXXFLAGS_JDKLIB) $(BUILD_LIBFONTMANAGER_CFLAGS_COMMON),\
 		OPTIMIZATION:=$(LIBFONTMANAGER_OPTIMIZATION), \
-		CFLAGS_windows= -I$(JDK_TOPDIR)/src/$(LEGACY_OPENJDK_TARGET_OS_API)/native/sun/windows \
+		CFLAGS_windows= -I$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/windows \
 				-DCC_NOEX, \
 		MAPFILE:=$(BUILD_LIBFONTMANAGER_MAPFILE), \
-		LDFLAGS:=$(subst -Xlinker -z -Xlinker defs,,$(LDFLAGS_JDKLIB)) \
+		LDFLAGS:=$(subst -Xlinker -z -Xlinker defs,,$(LDFLAGS_JDKLIB)) $(LDFLAGS_CXX_JDK) \
 			 $(call SET_SHARED_LIBRARY_ORIGIN),\
 		LDFLAGS_windows:=advapi32.lib user32.lib gdi32.lib $(WIN_AWT_LIB) $(WIN_JAVA_LIB),\
-		LDFLAGS_SUFFIX:=$(LDFLAGS_JDKLIB_SUFFIX) \
-				$(BUILD_LIBFONTMANAGER_FONTLIB),\
-		LDFLAGS_SUFFIX_linux:=-lawt $(LIBM) $(LIBCXX),\
-		LDFLAGS_SUFFIX_solaris:=-lawt -lawt_xawt -lc $(LIBM) $(LIBCXX),\
-		LDFLAGS_SUFFIX_macosx:=-lawt $(LIBM) $(LIBCXX) -undefined dynamic_lookup,\
-		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libfontmanager))
+		LDFLAGS_SUFFIX:=$(BUILD_LIBFONTMANAGER_FONTLIB),\
+		LDFLAGS_SUFFIX_linux:=-lawt $(LIBM) $(LIBCXX) -ljava -ljvm -lc,\
+		LDFLAGS_SUFFIX_solaris:=-lawt -lawt_xawt -lc $(LIBM) $(LIBCXX) -ljava -ljvm,\
+		LDFLAGS_SUFFIX_macosx:=-lawt $(LIBM) $(LIBCXX) -undefined dynamic_lookup -ljava -ljvm,\
+		VERSIONINFO_RESOURCE:=$(JDK_TOPDIR)/src/windows/resource/version.rc,\
+		RC_FLAGS:=$(RC_FLAGS)\
+			  /D "JDK_FNAME=fontmanager.dll" \
+			  /D "JDK_INTERNAL_NAME=fontmanager" \
+			  /D "JDK_FTYPE=0x2L",\
+		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libfontmanager,\
+		DEBUG_SYMBOLS:=$(WINDOWS_ONLY)))
 
 $(BUILD_LIBFONTMANAGER) : $(BUILD_LIBAWT)
 
@@ -1323,10 +1406,10 @@
 		            -I$(JDK_TOPDIR)/src/closed/share/native/sun/font/t2k \
 		            -I$(JDK_TOPDIR)/src/closed/share/native/sun/font \
 		            -I$(JDK_TOPDIR)/src/share/share/native/sun/font \
-		            -I$(JDK_TOPDIR)/src/$(LEGACY_OPENJDK_TARGET_OS_API)/native/sun/font \
+		            -I$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/font \
 		            -I$(JDK_TOPDIR)/src/share/native/sun/java2d/loops \
 		            -I$(JDK_TOPDIR)/src/share/native/sun/java2d/pipe \
-		            -I$(JDK_TOPDIR)/src/$(LEGACY_OPENJDK_TARGET_OS_API)/native/sun/java2d \
+		            -I$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/java2d \
 		            -I$(JDK_TOPDIR)/src/share/native/sun/java2d
 
     $(eval $(call SetupNativeCompilation,BUILD_LIBT2K,\
@@ -1343,15 +1426,18 @@
 		CFLAGS_windows=-DCC_NOEX, \
 		CXXFLAGS_windows=-DCC_NOEX, \
 		MAPFILE:=$(JDK_TOPDIR)/makefiles/mapfiles/libt2k/mapfile-vers, \
-		LDFLAGS:=$(LDFLAGS_JDKLIB) \
+		LDFLAGS:=$(LDFLAGS_JDKLIB) $(LDFLAGS_CXX_JDK) \
 			 $(call SET_SHARED_LIBRARY_ORIGIN),\
 		LDFLAGS_windows:=user32.lib $(JDK_OUTPUTDIR)/objs/libfontmanager/fontmanager.lib,\
-		LDFLAGS_SUFFIX:=$(LDFLAGS_JDKLIB_SUFFIX),\
-		LDFLAGS_SUFFIX_macosx:=$(LIBCXX) $(LIBM) -lfontmanager,\
-		LDFLAGS_SUFFIX_linux:=$(LIBCXX) $(LIBM) -lfontmanager,\
-		LDFLAGS_SUFFIX_solaris:=$(LIBCXX) $(LIBM) -lfontmanager -lawt \
-					-lawt_xawt,\
-		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libt2k))
+		LDFLAGS_SUFFIX_posix:=$(LIBM) $(LIBCXX) -lfontmanager -ljava -ljvm -lc,\
+		LDFLAGS_SUFFIX_solaris:=-lawt -lawt_xawt,\
+		VERSIONINFO_RESOURCE:=$(JDK_TOPDIR)/src/windows/resource/version.rc,\
+		RC_FLAGS:=$(RC_FLAGS)\
+			  /D "JDK_FNAME=t2k.dll" \
+			  /D "JDK_INTERNAL_NAME=t2k" \
+			  /D "JDK_FTYPE=0x2L",\
+		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libt2k,\
+		DEBUG_SYMBOLS:=$(WINDOWS_ONLY)))
 
     # t2k is linked against fontmanager
     $(BUILD_LIBT2K) : $(BUILD_LIBFONTMANAGER)
@@ -1361,40 +1447,40 @@
 
 ##########################################################################################
 
-#
-# TODO replace with X_FLAGS / X_LIBS
-#   and add them to configure
-#
-OPENWIN_LIB:=$(OPENWIN_HOME)/lib
-
 ifeq ($(OPENJDK_TARGET_OS), windows)
-    ifeq ($(ARCH_DATA_MODEL), 32)
+    ifeq ($(OPENJDK_TARGET_CPU), x86)
         KERNEL32_LIB:=kernel32.lib
     endif
     $(eval $(call SetupNativeCompilation,BUILD_LIBJAWT,\
                 LIBRARY:=jawt, \
                 OUTPUT_DIR:=$(INSTALL_LIBRARIES_HERE),\
-                SRC:=$(JDK_TOPDIR)/src/$(LEGACY_OPENJDK_TARGET_OS_API)/native/sun/windows,\
+                SRC:=$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/windows,\
 		INCLUDE_FILES:=jawt.cpp,\
 		LANG:=C++,\
 		OPTIMIZATION:=LOW, \
 		CFLAGS:=$(CXXFLAGS_JDKLIB) \
 			-EHsc -DUNICODE -D_UNICODE \
-			-I$(JDK_TOPDIR)/src/$(LEGACY_OPENJDK_TARGET_OS_API)/native/sun/windows \
+			-I$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/windows \
 		        -I$(JDK_TOPDIR)/src/share/native/sun/awt/debug \
 		        -I$(JDK_TOPDIR)/src/share/native/sun/java2d \
 			-I$(JDK_TOPDIR)/src/share/native/sun/awt/image/cvutils \
-			-I$(JDK_TOPDIR)/src/$(LEGACY_OPENJDK_TARGET_OS_API)/native/sun/java2d/windows, \
-		LDFLAGS:=$(LDFLAGS_JDKLIB) $(KERNEL32_LIB) \
+			-I$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/java2d/windows, \
+		LDFLAGS:=$(LDFLAGS_JDKLIB) $(KERNEL32_LIB) $(LDFLAGS_CXX_JDK) \
 			 advapi32.lib $(WIN_AWT_LIB),\
 		LDFLAGS_SUFFIX:=$(LDFLAGS_JDKLIB_SUFFIX),\
-		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libjawt))
+		VERSIONINFO_RESOURCE:=$(JDK_TOPDIR)/src/windows/resource/version.rc,\
+		RC_FLAGS:=$(RC_FLAGS)\
+			  /D "JDK_FNAME=jawt.dll" \
+			  /D "JDK_INTERNAL_NAME=jawt" \
+			  /D "JDK_FTYPE=0x2L",\
+		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libjawt,\
+		DEBUG_SYMBOLS:=$(WINDOWS_ONLY)))
 
 $(BUILD_LIBJAWT) : $(BUILD_LIBAWT)
 
 $(JDK_OUTPUTDIR)/lib/$(LIBRARY_PREFIX)jawt$(STATIC_LIBRARY_SUFFIX): $(BUILD_LIBJAWT)
 	$(ECHO) Copying $(@F)
-	$(CP) $< $@
+	$(CP) $(JDK_OUTPUTDIR)/objs/libjawt/$(LIBRARY_PREFIX)jawt$(STATIC_LIBRARY_SUFFIX) $@
 
 BUILD_LIBRARIES += $(JDK_OUTPUTDIR)/lib/$(LIBRARY_PREFIX)jawt$(STATIC_LIBRARY_SUFFIX)
 
@@ -1421,7 +1507,7 @@
     $(eval $(call SetupNativeCompilation,BUILD_LIBJAWT,\
                 LIBRARY:=jawt, \
                 OUTPUT_DIR:=$(INSTALL_LIBRARIES_HERE),\
-                SRC:=$(JDK_TOPDIR)/src/$(LEGACY_OPENJDK_TARGET_OS_API)/native/sun/awt \
+                SRC:=$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/awt \
                      $(JDK_TOPDIR)/src/macosx/native/sun/awt,\
 		INCLUDE_FILES:=$(JAWT_FILES),\
 		LANG:=C,\
@@ -1432,10 +1518,11 @@
 		MAPFILE:=$(JDK_TOPDIR)/makefiles/mapfiles/libjawt/mapfile-vers, \
 		LDFLAGS:=$(LDFLAGS_JDKLIB) \
 			 $(call SET_SHARED_LIBRARY_ORIGIN),\
-		LDFLAGS_solaris:=-L$(OPENWIN_HOME)/sfw/lib$(ISA_DIR) -L$(OPENWIN_LIB)$(ISA_DIR),\
-		LDFLAGS_SUFFIX:=$(LDFLAGS_JDKLIB_SUFFIX) $(JAWT_LIBS),\
-		LDFLAGS_SUFFIX_solaris:=-lXrender,\
-		LDFLAGS_SUFFIX_macosx:=-framework Cocoa, \
+		LDFLAGS_solaris:=-L$(OPENWIN_HOME)/sfw/lib$(OPENJDK_TARGET_CPU_ISADIR) -L$(OPENWIN_LIB)$(OPENJDK_TARGET_CPU_ISADIR),\
+		LDFLAGS_SUFFIX_linux:=$(JAWT_LIBS) $(LDFLAGS_JDKLIB_SUFFIX),\
+		LDFLAGS_SUFFIX_solaris:=$(JAWT_LIBS) $(LDFLAGS_JDKLIB_SUFFIX) -lXrender,\
+		LDFLAGS_SUFFIX_macosx:=-Xlinker -rpath -Xlinker @loader_path $(JAWT_LIBS) \
+				       -framework Cocoa $(LDFLAGS_JDKLIB_SUFFIX),\
 		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libjawt))
 
 ifndef BUILD_HEADLESS_ONLY
@@ -1494,7 +1581,13 @@
 		LDFLAGS:=$(LIBJDBCODBC_LDFLAGS) \
 			 $(call SET_SHARED_LIBRARY_ORIGIN) $(LIBJDBCODBC_LIBS),\
 		LDFLAGS_SUFFIX:=$(LDFLAGS_JDKLIB_SUFFIX) $(LIBJDBCODBC_SONAME),\
-		OBJECT_DIR:=$(LIBJDBCODBC_DIR)))
+		VERSIONINFO_RESOURCE:=$(JDK_TOPDIR)/src/windows/resource/version.rc,\
+		RC_FLAGS:=$(RC_FLAGS)\
+			  /D "JDK_FNAME=JdbcOdbc.dll" \
+			  /D "JDK_INTERNAL_NAME=JdbcOdbc" \
+			  /D "JDK_FTYPE=0x2L",\
+		OBJECT_DIR:=$(LIBJDBCODBC_DIR),\
+		DEBUG_SYMBOLS:=$(WINDOWS_ONLY)))
 
 $(BUILD_LIBJDBCODBC) : $(BUILD_LIBJAVA)
 
@@ -1538,11 +1631,11 @@
 
 ##########################################################################################
 
-BUILD_LIBINSTRUMENT_SRC   :=$(JDK_TOPDIR)/src/share/instrument \
-                               $(JDK_TOPDIR)/src/$(LEGACY_OPENJDK_TARGET_OS_API)/native/java/io \
-                               $(JDK_TOPDIR)/src/$(LEGACY_OPENJDK_TARGET_OS_API)/instrument
-
-BUILD_LIBINSTRUMENT_FILES :=\
+LIBINSTRUMENT_SRC   :=$(JDK_TOPDIR)/src/share/instrument \
+                      $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/java/io \
+                      $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/instrument
+
+LIBINSTRUMENT_FILES :=\
 	EncodingSupport.c \
 	EncodingSupport_md.c \
 	FileSystemSupport_md.c \
@@ -1557,50 +1650,54 @@
 	Utilities.c \
 	canonicalize_md.c
 
-BUILD_LIBINSTRUMENT_DIR   :=$(JDK_OUTPUTDIR)/objs/libinstrument
-BUILD_LIBINSTRUMENT_CFLAGS:=-I$(JDK_TOPDIR)/src/share/instrument \
-                               -I$(JDK_TOPDIR)/src/$(LEGACY_OPENJDK_TARGET_OS_API)/instrument \
-                               -I$(JDK_TOPDIR)/src/share/bin
-
-BUILD_LIBINSTRUMENT_LDFLAGS:=
-BUILD_LIBINSTRUMENT_LDFLAGS_SUFFIX:=
+LIBINSTRUMENT_DIR   :=$(JDK_OUTPUTDIR)/objs/libinstrument
+LIBINSTRUMENT_CFLAGS:=$(CFLAGS_JDKLIB) \
+                      -I$(JDK_TOPDIR)/src/share/instrument \
+                      -I$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/instrument \
+                      -I$(JDK_TOPDIR)/src/share/bin
+
+LIBINSTRUMENT_LDFLAGS:=
+LIBINSTRUMENT_LDFLAGS_SUFFIX:=
 
 ifeq ($(OPENJDK_TARGET_OS), windows)
-  BUILD_LIBINSTRUMENT_LDFLAGS += $(JDK_OUTPUTDIR)/objs/jli_static.lib $(WIN_JAVA_LIB) \
-				 -export:Agent_OnAttach
-  # equivalent of strcasecmp is stricmp on Windows
-  BUILD_LIBINSTRUMENT_CFLAGS += -Dstrcasecmp=stricmp
-else ifneq (,$(findstring $(OPENJDK_TARGET_OS), macosx))
-	ifneq ($(ARCH), universal)
-		BUILD_LIBINSTRUMENT_LDFLAGS += -Wl,-all_load
-	endif
-
-	BUILD_LIBINSTRUMENT_LDFLAGS += $(JDK_OUTPUTDIR)/objs/libjli_static.a
-	BUILD_LIBINSTRUMENT_LDFLAGS += -liconv
-	BUILD_LIBINSTRUMENT_LDFLAGS += -framework Cocoa -framework Security -framework ApplicationServices
-	BUILD_LIBINSTRUMENT_LDFLAGS += $(LIBZ)
-else
-	BUILD_LIBINSTRUMENT_LDFLAGS += -L $(INSTALL_LIBRARIES_HERE)/jli
-	BUILD_LIBINSTRUMENT_LDFLAGS_SUFFIX += -ljli $(LIBDL)
+    LIBINSTRUMENT_LDFLAGS += $(JDK_OUTPUTDIR)/objs/jli_static.lib $(WIN_JAVA_LIB) \
+				 -export:Agent_OnAttach advapi32.lib
+    # Statically link the C runtime so that there are not dependencies on modules 
+    # not on the search patch when invoked from the Windows system directory 
+    # (or elsewhere).
+    LIBINSTRUMENT_CFLAGS := $(filter-out -MD,$(LIBINSTRUMENT_CFLAGS))
+    # equivalent of strcasecmp is stricmp on Windows
+    LIBINSTRUMENT_CFLAGS += -Dstrcasecmp=stricmp
 endif
 
 $(eval $(call SetupNativeCompilation,BUILD_LIBINSTRUMENT,\
 		LIBRARY:=instrument, \
                 OUTPUT_DIR:=$(INSTALL_LIBRARIES_HERE),\
-		SRC:=$(BUILD_LIBINSTRUMENT_SRC),\
-		INCLUDE_FILES:=$(BUILD_LIBINSTRUMENT_FILES),\
+		SRC:=$(LIBINSTRUMENT_SRC),\
+		INCLUDE_FILES:=$(LIBINSTRUMENT_FILES),\
 		LANG:=C,\
 		OPTIMIZATION:=LOW, \
-		CFLAGS:=$(CFLAGS_JDKLIB) \
-                        $(BUILD_LIBINSTRUMENT_CFLAGS),\
+		CFLAGS:=$(LIBINSTRUMENT_CFLAGS),\
 		CFLAGS_debug:=-DJPLIS_LOGGING,\
 		CFLAGS_release:=-DNO_JPLIS_LOGGING,\
 		MAPFILE:=$(JDK_TOPDIR)/makefiles/mapfiles/libinstrument/mapfile-vers, \
-		LDFLAGS:=$(LDFLAGS_JDKLIB) $(call SET_SHARED_LIBRARY_ORIGIN)\
-			 $(call SET_SHARED_LIBRARY_ORIGIN,jli) \
-                         $(BUILD_LIBINSTRUMENT_LDFLAGS),\
-		LDFLAGS_SUFFIX:=$(LIBZ) $(BUILD_LIBINSTRUMENT_LDFLAGS_SUFFIX),\
-		OBJECT_DIR:=$(BUILD_LIBINSTRUMENT_DIR),\
+		LDFLAGS:=$(LDFLAGS_JDKLIB) \
+			 $(call SET_SHARED_LIBRARY_ORIGIN) \
+                         $(LIBINSTRUMENT_LDFLAGS),\
+		LDFLAGS_linux:=$(call SET_SHARED_LIBRARY_ORIGIN,/jli),\
+		LDFLAGS_solaris:= $(call SET_SHARED_LIBRARY_ORIGIN,/jli),\
+		LDFLAGS_macosx:=-Xlinker -all_load $(JDK_OUTPUTDIR)/objs/libjli_static.a \
+				-framework Cocoa -framework Security -framework ApplicationServices,\
+		LDFLAGS_SUFFIX:=$(LIBINSTRUMENT_LDFLAGS_SUFFIX),\
+		LDFLAGS_SUFFIX_macosx:=-liconv $(LIBZ),\
+		LDFLAGS_SUFFIX_solaris:=$(LIBZ) -L $(INSTALL_LIBRARIES_HERE)/jli -ljli $(LIBDL),\
+		LDFLAGS_SUFFIX_linux:=$(LIBZ) -L $(INSTALL_LIBRARIES_HERE)/jli -ljli $(LIBDL),\
+		VERSIONINFO_RESOURCE:=$(JDK_TOPDIR)/src/windows/resource/version.rc,\
+		RC_FLAGS:=$(RC_FLAGS)\
+			  /D "JDK_FNAME=instrument.dll" \
+			  /D "JDK_INTERNAL_NAME=instrument" \
+			  /D "JDK_FTYPE=0x2L",\
+		OBJECT_DIR:=$(LIBINSTRUMENT_DIR),\
 		DEBUG_SYMBOLS:=true))
 
 ifneq (,$(findstring $(OPENJDK_TARGET_OS), macosx windows))
@@ -1615,8 +1712,8 @@
 ##########################################################################################
 
 BUILD_LIBMANAGEMENT_SRC:=$(JDK_TOPDIR)/src/share/native/sun/management \
-                           $(JDK_TOPDIR)/src/$(LEGACY_OPENJDK_TARGET_OS_API)/native/sun/management \
-                           $(JDK_TOPDIR)/src/$(LEGACY_OPENJDK_TARGET_OS_API)/native/com/sun/management
+                           $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/management \
+                           $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/com/sun/management
 
 BUILD_LIBMANAGEMENT_EXCLUDES:=
 
@@ -1640,6 +1737,12 @@
 	BUILD_LIBMANAGEMENT_EXCLUDES += MacosxOperatingSystem.c
 endif
 
+LIBMANAGEMENT_OPTIMIZATION:=HIGH
+ifneq ($(findstring $(OPENJDK_TARGET_OS),solaris linux),)
+    ifeq ($(ENABLE_DEBUG_SYMBOLS), yes)
+        LIBMANAGEMENT_OPTIMIZATION:=LOW
+    endif
+endif
 
 $(eval $(call SetupNativeCompilation,BUILD_LIBMANAGEMENT,\
 		LIBRARY:=management,\
@@ -1647,7 +1750,7 @@
 		SRC:=$(BUILD_LIBMANAGEMENT_SRC),\
 		EXCLUDE_FILES:=$(BUILD_LIBMANAGEMENT_EXCLUDES),\
 		LANG:=C,\
-		OPTIMIZATION:=HIGH, \
+		OPTIMIZATION:=$(LIBMANAGEMENT_OPTIMIZATION), \
 		CFLAGS:=$(CFLAGS_JDKLIB) $(BUILD_LIBMANAGEMENT_CFLAGS),\
 		MAPFILE:=$(JDK_TOPDIR)/makefiles/mapfiles/libmanagement/mapfile-vers, \
 		LDFLAGS:=$(LDFLAGS_JDKLIB) \
@@ -1655,6 +1758,11 @@
 		LDFLAGS_windows:=$(WIN_JAVA_LIB) jvm.lib advapi32.lib psapi.lib,\
 		LDFLAGS_solaris:=-lkstat,\
 		LDFLAGS_SUFFIX:=$(LDFLAGS_JDKLIB_SUFFIX),\
+		VERSIONINFO_RESOURCE:=$(JDK_TOPDIR)/src/windows/resource/version.rc,\
+		RC_FLAGS:=$(RC_FLAGS)\
+			  /D "JDK_FNAME=management.dll" \
+			  /D "JDK_INTERNAL_NAME=management" \
+			  /D "JDK_FTYPE=0x2L",\
 		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libmanagement,\
 		DEBUG_SYMBOLS:=true))
 
@@ -1664,10 +1772,10 @@
 
 ##########################################################################################
 
-BUILD_LIBHPROF_SRC:=$(JDK_TOPDIR)/src/share/demo/jvmti/hprof $(JDK_TOPDIR)/src/$(LEGACY_OPENJDK_TARGET_OS_API)/demo/jvmti/hprof
+BUILD_LIBHPROF_SRC:=$(JDK_TOPDIR)/src/share/demo/jvmti/hprof $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/demo/jvmti/hprof
 BUILD_LIBHPROF_CFLAGS:=-I$(JDK_TOPDIR)/src/share/demo/jvmti/hprof \
                          -I$(JDK_TOPDIR)/src/share/npt \
-                         -I$(JDK_TOPDIR)/src/$(LEGACY_OPENJDK_TARGET_OS_API)/npt \
+                         -I$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/npt \
                          -I$(JDK_TOPDIR)/src/share/demo/jvmti/java_crw_demo
 
 BUILD_LIBHPROF_LDFLAGS:=
@@ -1676,6 +1784,13 @@
      BUILD_LIBHPROF_LDFLAGS += -lsocket -lnsl
 endif
 
+LIBHPROF_OPTIMIZATION:=HIGHEST
+ifneq ($(findstring $(OPENJDK_TARGET_OS),solaris linux),)
+    ifeq ($(ENABLE_DEBUG_SYMBOLS), yes)
+        LIBHPROF_OPTIMIZATION:=LOW
+    endif
+endif
+
 ifneq ($(OPENJDK_TARGET_OS),windows)
      BUILD_LIBHPROF_LDFLAGS += $(LIBDL)
 endif
@@ -1685,7 +1800,7 @@
                 OUTPUT_DIR:=$(INSTALL_LIBRARIES_HERE),\
 		SRC:=$(BUILD_LIBHPROF_SRC),\
 		LANG:=C,\
-		OPTIMIZATION:=HIGHEST, \
+		OPTIMIZATION:=$(LIBHPROF_OPTIMIZATION), \
 		CFLAGS:=$(CFLAGS_JDKLIB) \
                          $(BUILD_LIBHPROF_CFLAGS),\
 		CFLAGS_debug:=-DHPROF_LOGGING,\
@@ -1694,6 +1809,11 @@
 			 $(call SET_SHARED_LIBRARY_ORIGIN),\
 		LDFLAGS_windows:=wsock32.lib winmm.lib advapi32.lib,\
 		LDFLAGS_SUFFIX:=$(BUILD_LIBHPROF_LDFLAGS),\
+		VERSIONINFO_RESOURCE:=$(JDK_TOPDIR)/src/windows/resource/version.rc,\
+		RC_FLAGS:=$(RC_FLAGS)\
+			  /D "JDK_FNAME=hprof.dll" \
+			  /D "JDK_INTERNAL_NAME=hprof" \
+			  /D "JDK_FTYPE=0x2L",\
 		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libhprof_jvmti,\
 		DEBUG_SYMBOLS:=true))
 
@@ -1712,7 +1832,11 @@
 		MAPFILE:=$(JDK_TOPDIR)/makefiles/mapfiles/libjava_crw_demo/mapfile-vers, \
 		LDFLAGS:=$(LDFLAGS_JDKLIB) \
 			 $(call SET_SHARED_LIBRARY_ORIGIN),\
-		LDFLAGS_SUFFIX:=,\
+		VERSIONINFO_RESOURCE:=$(JDK_TOPDIR)/src/windows/resource/version.rc,\
+		RC_FLAGS:=$(RC_FLAGS)\
+			  /D "JDK_FNAME=java_crw_demo.dll" \
+			  /D "JDK_INTERNAL_NAME=java_crw_demo" \
+			  /D "JDK_FTYPE=0x2L",\
 		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libjava_crw_demo,\
 		DEBUG_SYMBOLS:=true))
 
@@ -1723,17 +1847,22 @@
 $(eval $(call SetupNativeCompilation,BUILD_LIBNPT,\
 		LIBRARY:=npt, \
                 OUTPUT_DIR:=$(INSTALL_LIBRARIES_HERE),\
-		SRC:=$(JDK_TOPDIR)/src/share/npt $(JDK_TOPDIR)/src/$(LEGACY_OPENJDK_TARGET_OS_API)/npt,\
+		SRC:=$(JDK_TOPDIR)/src/share/npt $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/npt,\
 		LANG:=C,\
 		OPTIMIZATION:=LOW, \
 		CFLAGS:=$(CFLAGS_JDKLIB) \
                         -I$(JDK_TOPDIR)/src/share/npt \
-                        -I$(JDK_TOPDIR)/src/$(LEGACY_OPENJDK_TARGET_OS_API)/npt,\
+                        -I$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/npt,\
 		MAPFILE:=$(JDK_TOPDIR)/makefiles/mapfiles/libnpt/mapfile-vers, \
 		LDFLAGS:=$(LDFLAGS_JDKLIB) \
 			 $(call SET_SHARED_LIBRARY_ORIGIN),\
 		LDFLAGS_macosx:=-liconv,\
 		LDFLAGS_SUFFIX_windows:=-export:nptInitialize -export:nptTerminate,\
+		VERSIONINFO_RESOURCE:=$(JDK_TOPDIR)/src/windows/resource/version.rc,\
+		RC_FLAGS:=$(RC_FLAGS)\
+			  /D "JDK_FNAME=npt.dll" \
+			  /D "JDK_INTERNAL_NAME=npt" \
+			  /D "JDK_FTYPE=0x2L",\
 		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libnpt,\
 		DEBUG_SYMBOLS:=true))
 
@@ -1742,11 +1871,11 @@
 ##########################################################################################
 
 LIBNET_SRC_DIRS:=$(JDK_TOPDIR)/src/share/native/java/net \
-                   $(JDK_TOPDIR)/src/$(LEGACY_OPENJDK_TARGET_OS_API)/native/java/net \
-                   $(JDK_TOPDIR)/src/$(LEGACY_OPENJDK_TARGET_OS_API)/native/sun/net/dns \
-                   $(JDK_TOPDIR)/src/$(LEGACY_OPENJDK_TARGET_OS_API)/native/sun/net/www/protocol/http/ntlm \
-                   $(JDK_TOPDIR)/src/$(LEGACY_OPENJDK_TARGET_OS_API)/native/sun/net/sdp \
-                   $(JDK_TOPDIR)/src/$(LEGACY_OPENJDK_TARGET_OS_API)/native/sun/net/spi
+                   $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/java/net \
+                   $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/net/dns \
+                   $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/net/www/protocol/http/ntlm \
+                   $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/net/sdp \
+                   $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/net/spi
 
 LIBNET_CFLAGS:=$(foreach dir,$(LIBNET_SRC_DIRS),-I$(dir))
 
@@ -1767,8 +1896,6 @@
 				NTLMAuthSequence.c NetworkInterface_winXP.c
 endif
 
-LIBNET_LDFLAGS_SUFFIX:=
-
 $(eval $(call SetupNativeCompilation,BUILD_LIBNET,\
 		LIBRARY:=net,\
                 OUTPUT_DIR:=$(INSTALL_LIBRARIES_HERE),\
@@ -1781,13 +1908,19 @@
 		MAPFILE:=$(JDK_TOPDIR)/makefiles/mapfiles/libnet/mapfile-vers, \
 		LDFLAGS:=$(LDFLAGS_JDKLIB) \
 			 $(call SET_SHARED_LIBRARY_ORIGIN),\
-		LDFLAGS_SUFFIX:=$(LDFLAGS_JDKLIB_SUFFIX) $(LIBNET_LDFLAGS_SUFFIX),\
-		LDFLAGS_SUFFIX_solaris:=-lnsl -lsocket $(LIBDL) ,\
-		LDFLAGS_SUFFIX_linux:=$(LIBDL) -lpthread ,\
+		LDFLAGS_SUFFIX_macosx:=-ljvm -ljava,\
+		LDFLAGS_SUFFIX_solaris:=-ljvm -ljava -lnsl -lsocket $(LIBDL) ,\
+		LDFLAGS_SUFFIX_linux:=$(LIBDL) -ljvm -lpthread -ljava,\
 		LDFLAGS_SUFFIX_windows:=ws2_32.lib $(JVMLIB) secur32.lib iphlpapi.lib \
 					  delayimp.lib $(WIN_JAVA_LIB) jvm.lib advapi32.lib \
                                           /DELAYLOAD:secur32.dll /DELAYLOAD:iphlpapi.dll, \
-		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libnet))
+		VERSIONINFO_RESOURCE:=$(JDK_TOPDIR)/src/windows/resource/version.rc,\
+		RC_FLAGS:=$(RC_FLAGS)\
+			  /D "JDK_FNAME=net.dll" \
+			  /D "JDK_INTERNAL_NAME=net" \
+			  /D "JDK_FTYPE=0x2L",\
+		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libnet,\
+		DEBUG_SYMBOLS:=$(WINDOWS_ONLY)))
 
 $(BUILD_LIBNET) : $(BUILD_LIBJAVA)
 
@@ -1801,7 +1934,7 @@
 COPY_FILES += $(JDK_OUTPUTDIR)/lib/net.properties
 
 ifeq ($(OPENJDK_TARGET_OS), solaris)
-$(JDK_OUTPUTDIR)/lib/sdp/sdp.conf.template : $(JDK_TOPDIR)/src/${LEGACY_OPENJDK_TARGET_OS_API}/lib/sdp/sdp.conf.template
+$(JDK_OUTPUTDIR)/lib/sdp/sdp.conf.template : $(JDK_TOPDIR)/src/${OPENJDK_TARGET_OS_API_DIR}/lib/sdp/sdp.conf.template
 	$(ECHO) Copying $(@F)
 	$(MKDIR) -p $(@D)
 	$(CP) $< $@
@@ -1812,15 +1945,15 @@
 ##########################################################################################
 
 BUILD_LIBNIO_SRC:=\
-        $(JDK_TOPDIR)/src/$(LEGACY_OPENJDK_TARGET_OS_API)/native/java/nio \
-	$(JDK_TOPDIR)/src/$(LEGACY_OPENJDK_TARGET_OS_API)/native/sun/nio/ch \
-	$(JDK_TOPDIR)/src/$(LEGACY_OPENJDK_TARGET_OS_API)/native/sun/nio/fs
+        $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/java/nio \
+	$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/nio/ch \
+	$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/nio/fs
 
 BUILD_LIBNIO_CFLAGS:=\
 	-I$(JDK_TOPDIR)/src/share/native/sun/nio/ch \
 	-I$(JDK_TOPDIR)/src/share/native/java/io \
 	-I$(JDK_TOPDIR)/src/share/native/java/net \
-        -I$(JDK_TOPDIR)/src/$(LEGACY_OPENJDK_TARGET_OS_API)/native/java/net
+        -I$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/java/net
 
 BUILD_LIBNIO_FILES:=\
         DatagramChannelImpl.c \
@@ -1847,14 +1980,14 @@
 endif
 
 ifeq ($(OPENJDK_TARGET_OS), linux)
-	BUILD_LIBNIO_MAPFILE:=$(JDK_TOPDIR)/makefiles/mapfiles/libnio/mapfile-linux
+	BUILD_LIBNIO_MAPFILE:=$(JDK_TOPDIR)/makefiles/mapfiles/libnio/mapfile-$(OPENJDK_TARGET_OS)
 	BUILD_LIBNIO_FILES += \
 		EPoll.c \
 		EPollArrayWrapper.c \
 		EPollPort.c \
 		InheritedChannel.c \
 		NativeThread.c \
-	        PollArrayWrapper.c \
+		PollArrayWrapper.c \
 		UnixAsynchronousServerSocketChannelImpl.c \
 		UnixAsynchronousSocketChannelImpl.c \
 		GnomeFileTypeDetector.c \
@@ -1865,7 +1998,7 @@
 endif
 
 ifeq ($(OPENJDK_TARGET_OS), macosx)
-	BUILD_LIBNIO_MAPFILE:=$(JDK_TOPDIR)/makefiles/mapfiles/libnio/mapfile-bsd
+	BUILD_LIBNIO_MAPFILE:=$(JDK_TOPDIR)/makefiles/mapfiles/libnio/mapfile-$(OPENJDK_TARGET_OS)
 	BUILD_LIBNIO_SRC += $(JDK_TOPDIR)/src/macosx/native/sun/nio/ch
 	BUILD_LIBNIO_FILES += \
 		InheritedChannel.c \
@@ -1873,8 +2006,8 @@
 	        PollArrayWrapper.c \
 		UnixAsynchronousServerSocketChannelImpl.c \
 		UnixAsynchronousSocketChannelImpl.c \
-		GnomeFileTypeDetector.c \
 		BsdNativeDispatcher.c \
+		MacOSXNativeDispatcher.c \
 		UnixCopyFile.c \
 		UnixNativeDispatcher.c \
 		KQueue.c \
@@ -1883,7 +2016,7 @@
 endif
 
 ifeq ($(OPENJDK_TARGET_OS), solaris)
-	BUILD_LIBNIO_MAPFILE:=$(JDK_TOPDIR)/makefiles/mapfiles/libnio/mapfile-solaris
+	BUILD_LIBNIO_MAPFILE:=$(JDK_TOPDIR)/makefiles/mapfiles/libnio/mapfile-$(OPENJDK_TARGET_OS)
 	BUILD_LIBNIO_FILES += \
 		DevPollArrayWrapper.c \
 		InheritedChannel.c \
@@ -1912,17 +2045,22 @@
 		LDFLAGS:=$(LDFLAGS_JDKLIB) $(BUILD_LIBNIO_LDFLAGS) \
 			 $(call SET_SHARED_LIBRARY_ORIGIN),\
 		LDFLAGS_SUFFIX_linux:=-ljava -lnet -lpthread $(LIBDL),\
-		LDFLAGS_SUFFIX_solaris:=$(LDFLAGS_JDKLIB_SUFFIX) \
-                                        $(JVMLIB) -lsocket -lposix4 $(LIBDL) -lsendfile \
-		                        -ljava -lnet,\
+		LDFLAGS_SUFFIX_solaris:=-ljvm -lsocket -lposix4 $(LIBDL) \
+				        -lsendfile -ljava -lnet -lc,\
 		LDFLAGS_SUFFIX_windows:=$(LDFLAGS_JDKLIB_SUFFIX) \
                                         $(WIN_JAVA_LIB) $(JDK_OUTPUTDIR)/objs/libnet/net.lib \
 					advapi32.lib jvm.lib ws2_32.lib\
                                         $(JDK_OUTPUTDIR)/objs/libjava/io_util.obj \
 		                        $(JDK_OUTPUTDIR)/objs/libjava/FileDescriptor_md.obj ,\
-		LDFLAGS_SUFFIX_macosx:=-ljava -lnet -pthread,\
+		LDFLAGS_SUFFIX_macosx:=-ljava -lnet -pthread -framework CoreFoundation,\
 		LDFLAGS_SUFFIX:=,\
-		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libnio))
+		VERSIONINFO_RESOURCE:=$(JDK_TOPDIR)/src/windows/resource/version.rc,\
+		RC_FLAGS:=$(RC_FLAGS)\
+			  /D "JDK_FNAME=nio.dll" \
+			  /D "JDK_INTERNAL_NAME=nio" \
+			  /D "JDK_FTYPE=0x2L",\
+		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libnio,\
+		DEBUG_SYMBOLS:=$(WINDOWS_ONLY)))
 
 BUILD_LIBRARIES += $(BUILD_LIBNIO)
 
@@ -1942,23 +2080,23 @@
     $(eval $(call SetupNativeCompilation,BUILD_LIBSCTP,\
                 LIBRARY:=sctp,\
                 OUTPUT_DIR:=$(INSTALL_LIBRARIES_HERE),\
-                SRC:=$(JDK_TOPDIR)/src/$(LEGACY_OPENJDK_TARGET_OS_API)/native/sun/nio/ch/sctp,\
+                SRC:=$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/nio/ch/sctp,\
 		LANG:=C,\
 		OPTIMIZATION:=LOW, \
 		CFLAGS:=$(CFLAGS_JDKLIB)\
 			-I$(JDK_TOPDIR)/src/share/native/sun/nio/ch \
 			-I$(JDK_TOPDIR)/src/share/native/sun/nio/ch/sctp \
 			-I$(JDK_TOPDIR)/src/share/native/java/net \
-			-I$(JDK_TOPDIR)/src/$(LEGACY_OPENJDK_TARGET_OS_API)/native/sun/nio/ch \
-			-I$(JDK_TOPDIR)/src/$(LEGACY_OPENJDK_TARGET_OS_API)/native/java/net,\
+			-I$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/nio/ch \
+			-I$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/java/net,\
 		CFLAGS_linux:=$(SCTP_WERROR),\
 		MAPFILE:=$(JDK_TOPDIR)/makefiles/mapfiles/libsctp/mapfile-vers, \
 		LDFLAGS:=$(LDFLAGS_JDKLIB) \
 			 $(call SET_SHARED_LIBRARY_ORIGIN),\
-		LDFLAGS_SUFFIX_linux:=$(LIBDL) -lpthread,\
+		LDFLAGS_SUFFIX_linux:=-lpthread $(LIBDL) -ljava -ljvm,\
 		LDFLAGS_SUFFIX_posix:=-lnio -lnet,\
-		LDFLAGS_SUFFIX_solaris:=-lsocket,\
-		LDFLAGS_SUFFIX:=$(LDFLAGS_JDKLIB_SUFFIX),\
+		LDFLAGS_SUFFIX_solaris:=-lsocket -ljava -ljvm,\
+		LDFLAGS_SUFFIX_macosx:=-ljava -ljvm,\
 		INCLUDE_FILES:=SctpNet.c SctpChannelImpl.c SctpServerChannelImpl.c,\
 		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libsctp))
 
@@ -1970,8 +2108,8 @@
 
 ##########################################################################################
 
-BUILD_LIBJLI_SRC_DIRS:=$(JDK_TOPDIR)/src/share/bin $(JDK_TOPDIR)/src/$(LEGACY_OPENJDK_TARGET_OS_API)/bin
-BUILD_LIBJLI_CFLAGS:=$(foreach dir,$(BUILD_LIBJLI_SRC_DIRS),-I$(dir))
+BUILD_LIBJLI_SRC_DIRS:=$(JDK_TOPDIR)/src/share/bin $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/bin
+LIBJLI_CFLAGS:=$(CFLAGS_JDKLIB) $(foreach dir,$(BUILD_LIBJLI_SRC_DIRS),-I$(dir))
 
 BUILD_LIBJLI_FILES:=\
 	java.c \
@@ -1983,16 +2121,16 @@
 
 ifeq ($(JVM_VARIANT_ZERO), true)
 	ERGO_FAMILY:=zero
-else # !ZERO_BUILD
-	ifneq (,$(findstring $(ARCH), amd64 x86_64))
+else
+	ifeq ($(OPENJDK_TARGET_CPU_ARCH), x86)
 		ERGO_FAMILY:=i586
-	else # !X86 FAMILY
-		ERGO_FAMILY:=$(ARCH)
-	endif #ARCH_FAMILY
-endif # ZERO_BUILD
+	else
+		ERGO_FAMILY:=$(OPENJDK_TARGET_CPU_ARCH)
+	endif
+endif
 
 ifeq ($(OPENJDK_TARGET_OS), macosx)
-	BUILD_LIBJLI_CFLAGS += -I$(JDK_TOPDIR)/src/macosx/bin
+	LIBJLI_CFLAGS += -I$(JDK_TOPDIR)/src/macosx/bin
 	BUILD_LIBJLI_SRC_DIRS += $(JDK_TOPDIR)/src/macosx/bin
 	BUILD_LIBJLI_FILES += java_md_common.c java_md_macosx.c
 
@@ -2001,7 +2139,10 @@
 endif
 
 ifeq ($(OPENJDK_TARGET_OS), windows)
-	BUILD_LIBJLI_FILES += java_md.c
+	BUILD_LIBJLI_FILES += java_md.c \
+			      cmdtoargs.c
+        # Staticically link with c runtime on windows.
+	LIBJLI_CFLAGS:=$(filter-out -MD,$(LIBJLI_CFLAGS))
 else ifneq ($(OPENJDK_TARGET_OS), macosx)
 
 	BUILD_LIBJLI_FILES += java_md_common.c
@@ -2011,36 +2152,23 @@
 
         # if the architecture specific ergo file exists then
         # use it, else use the generic definitions from ergo.c
-	ifneq ($(wildcard $(JDK_TOPDIR)/src/$(LEGACY_OPENJDK_TARGET_OS_API)/bin/$(ERGO_ARCH_FILE)),)
+	ifneq ($(wildcard $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/bin/$(ERGO_ARCH_FILE)),)
 		BUILD_LIBJLI_FILES += $(ERGO_ARCH_FILE)
 	else # !ERGO_ARCH_FILE
-		BUILD_LIBJLI_CFLAGS += -DUSE_GENERIC_ERGO
+		LIBJLI_CFLAGS += -DUSE_GENERIC_ERGO
 	endif # ERGO_ARCH_FILE
 endif #WINDOWS
 
-# Names of arch directories
-ifneq ($(OPENJDK_TARGET_OS), macosx)
-	BUILD_LIBJLI_CFLAGS += -DLIBARCHNAME='"$(LIBARCH)"'
-else
-	BUILD_LIBJLI_CFLAGS += -DLIBARCHNAME='"$(ARCH)"'
-endif
-ifeq ($(OPENJDK_TARGET_OS), solaris)
-	ifeq ($(OPENJDK_TARGET_CPU_ARCH), sparc)
-		BUILD_LIBJLI_CFLAGS += -DLIBARCH32NAME='"sparc"'
-		BUILD_LIBJLI_CFLAGS += -DLIBARCH64NAME='"sparcv9"'
-	else
-		BUILD_LIBJLI_CFLAGS += -DLIBARCH32NAME='"i386"'
-		BUILD_LIBJLI_CFLAGS += -DLIBARCH64NAME='"amd64"'
-	endif
-endif # OPENJDK_TARGET_OS
+# Append defines depending on target platform
+LIBJLI_CFLAGS += $(OPENJDK_TARGET_CPU_JLI_CFLAGS)
 
 ifeq ($(OPENJDK_TARGET_OS), macosx)
-	BUILD_LIBJLI_CFLAGS += -DPACKAGE_PATH=\"$(PACKAGE_PATH)\"
+	LIBJLI_CFLAGS += -DPACKAGE_PATH=\"$(PACKAGE_PATH)\"
 endif
 
 ifneq ($(USE_EXTERNAL_LIBZ),true)
 	BUILD_LIBJLI_SRC_DIRS += $(JDK_TOPDIR)/src/share/native/java/util/zip/zlib-1.2.5
-	BUILD_LIBJLI_CFLAGS += $(LIBZ_INCLUDE)
+	LIBJLI_CFLAGS += $(LIBZ_INCLUDE)
 	BUILD_LIBJLI_FILES += \
 		inflate.c \
 		inftrees.c \
@@ -2063,13 +2191,16 @@
 		INCLUDE_FILES:=$(BUILD_LIBJLI_FILES),\
 		LANG:=C,\
 		OPTIMIZATION:=HIGH, \
-		CFLAGS:=$(CFLAGS_JDKLIB) $(BUILD_LIBJLI_CFLAGS),\
+		CFLAGS:=$(LIBJLI_CFLAGS),\
 		MAPFILE:=$(JDK_TOPDIR)/makefiles/mapfiles/libjli/mapfile-vers, \
 		LDFLAGS:=$(LDFLAGS_JDKLIB) \
 			 $(call SET_SHARED_LIBRARY_ORIGIN),\
-		LDFLAGS_SUFFIX:=$(LIBZ),\
-		LDFLAGS_SUFFIX_posix:=$(LIBDL) -lc,\
-		LDFLAGS_SUFFIX_linux:=-lpthread,\
+		LDFLAGS_linux:=$(call SET_SHARED_LIBRARY_ORIGIN,/..),\
+		LDFLAGS_solaris:=$(call SET_SHARED_LIBRARY_ORIGIN,/..),\
+		LDFLAGS_macosx:=-framework Cocoa -framework Security -framework ApplicationServices,\
+		LDFLAGS_SUFFIX_solaris:=$(LIBZ) $(LIBDL) -lc,\
+		LDFLAGS_SUFFIX_linux:=$(LIBZ) $(LIBDL) -lc -lpthread,\
+		LDFLAGS_SUFFIX_macosx:=$(LIBZ),\
 		LDFLAGS_SUFFIX_windows:=\
 			-export:JLI_Launch \
 			-export:JLI_ManifestIterate \
@@ -2078,11 +2209,20 @@
 			-export:JLI_ReportErrorMessageSys \
 			-export:JLI_ReportMessage \
 			-export:JLI_ReportExceptionDescription \
+			-export:JLI_MemAlloc \
+			-export:JLI_CmdToArgs \
+			-export:JLI_GetStdArgc \
+			-export:JLI_GetStdArgs \
 			advapi32.lib \
 			comctl32.lib \
 			user32.lib,\
-		LDFLAGS_SUFFIX_macosx:=-framework Cocoa -framework Security -framework ApplicationServices, \
-		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libjli))
+		VERSIONINFO_RESOURCE:=$(JDK_TOPDIR)/src/windows/resource/version.rc,\
+		RC_FLAGS:=$(RC_FLAGS) \
+			  /D "JDK_FNAME=jli.dll" \
+			  /D "JDK_INTERNAL_NAME=jli" \
+			  /D "JDK_FTYPE=0x2L",\
+		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libjli,\
+		DEBUG_SYMBOLS:=$(WINDOWS_ONLY)))
 
 BUILD_LIBRARIES += $(BUILD_LIBJLI)
 
@@ -2097,7 +2237,7 @@
 		INCLUDE_FILES:=$(BUILD_LIBJLI_FILES),\
 		LANG:=C,\
 		OPTIMIZATION:=HIGH, \
-		CFLAGS:=$(CFLAGS_JDKLIB) $(STATIC_LIBRARY_FLAGS) $(BUILD_LIBJLI_CFLAGS),\
+		CFLAGS:=$(STATIC_LIBRARY_FLAGS) $(LIBJLI_CFLAGS),\
 		ARFLAGS:=$(ARFLAGS),\
 		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libjli_static))
 
@@ -2115,7 +2255,7 @@
 		INCLUDE_FILES:=$(BUILD_LIBJLI_FILES),\
 		LANG:=C,\
 		OPTIMIZATION:=HIGH, \
-		CFLAGS:=$(CFLAGS_JDKLIB) $(BUILD_LIBJLI_CFLAGS),\
+		CFLAGS:=$(CFLAGS_JDKLIB) $(LIBJLI_CFLAGS),\
 		LDFLAGS:=-nostdlib -r,\
 		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libjli_static))
 
@@ -2140,7 +2280,13 @@
 		MAPFILE:=$(JDK_TOPDIR)/makefiles/mapfiles/libjfr/mapfile-vers, \
 		LDFLAGS:=$(LDFLAGS_JDKLIB) \
 			 $(call SET_SHARED_LIBRARY_ORIGIN),\
-		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libjfr))
+		VERSIONINFO_RESOURCE:=$(JDK_TOPDIR)/src/windows/resource/version.rc,\
+		RC_FLAGS:=$(RC_FLAGS)\
+			  /D "JDK_FNAME=jfr.dll" \
+			  /D "JDK_INTERNAL_NAME=jfr" \
+			  /D "JDK_FTYPE=0x2L",\
+		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libjfr,\
+		DEBUG_SYMBOLS:=$(WINDOWS_ONLY)))
 
 BUILD_LIBRARIES += $(BUILD_LIBJFR)
 
@@ -2180,11 +2326,17 @@
 		MAPFILE:=$(JDK_TOPDIR)/makefiles/mapfiles/libkcms/mapfile-vers, \
 		LDFLAGS:=$(LDFLAGS_JDKLIB) \
 			 $(call SET_SHARED_LIBRARY_ORIGIN),\
-		LDFLAGS_SUFFIX_linux:=-lpthread,\
+		LDFLAGS_SUFFIX_linux:=-lc -lpthread,\
 		LDFLAGS_SUFFIX_windows:=$(WIN_JAVA_LIB) advapi32.lib user32.lib version.lib, \
 		LDFLAGS_SUFFIX:=-lm $(LDFLAGS_JDKLIB_SUFFIX),\
 		VERSIONINFO_RESOURCE:=$(JDK_TOPDIR)/src/closed/share/native/sun/java2d/cmm/kcms/cmm.rc,\
-		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libkcms))
+		VERSIONINFO_RESOURCE:=$(JDK_TOPDIR)/src/closed/share/native/sun/java2d/cmm/kcms/cmm.rc,\
+		RC_FLAGS:=$(RC_FLAGS)\
+			  /D "JDK_FNAME=kcms.dll" \
+			  /D "JDK_INTERNAL_NAME=kcms" \
+			  /D "JDK_FTYPE=0x2L",\
+		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libkcms,\
+		DEBUG_SYMBOLS:=$(WINDOWS_ONLY)))
 
 $(BUILD_LIBKCMS) : $(BUILD_LIBJAVA)
 
@@ -2196,12 +2348,12 @@
 
 ifndef OPENJDK
 ifeq ($(OPENJDK_TARGET_OS), solaris)
-ifneq ($(ARCH), amd64)
+ifneq ($(OPENJDK_TARGET_CPU), x86_64)
 
 ifeq ($(shell if test "$(OS_VERSION_MAJOR)" -eq 5 -a "$(OS_VERSION_MINOR)" -le 10; then $(ECHO) ok; fi), ok)
 
 SUNWJDGA_MAPFILE:=
-ifneq (,$(findstring $(ARCH),sparc))
+ifeq ($(OPENJDK_TARGET_CPU_ARCH), sparc)
 	SUNWJDGA_MAPFILE:=$(JDK_TOPDIR)/makefiles/mapfiles/libjdga/mapfile-vers
 endif
 
@@ -2213,12 +2365,12 @@
 		OPTIMIZATION:=LOW, \
 		CFLAGS:=$(CFLAGS_JDKLIB) \
 			-I$(JDK_TOPDIR)/src/share/javavm/export \
-			-I$(JDK_TOPDIR)/src/$(LEGACY_OPENJDK_TARGET_OS_API)/javavm/export \
+			-I$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/javavm/export \
 			-I$(OPENWIN_HOME)/include, \
 		MAPFILE:=$(SUNWJDGA_MAPFILE), \
 		LDFLAGS:=$(LDFLAGS_JDKLIB) \
 			 $(call SET_SHARED_LIBRARY_ORIGIN), \
-		LDFLAGS_SUFFIX:=-L$(OPENWIN_LIB)$(ISA_DIR) -R$(OPENWIN_LIB)$(ISA_DIR) -ldga -lX11 $(LIBDL) -lc, \
+		LDFLAGS_SUFFIX:=-L$(OPENWIN_LIB)$(OPENJDK_TARGET_CPU_ISADIR) -R$(OPENWIN_LIB)$(OPENJDK_TARGET_CPU_ISADIR) -ldga -lX11 $(LIBDL) -lc, \
 		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libsunwjdga))
 
 BUILD_LIBRARIES += $(BUILD_LIBSUNWJDGA)
@@ -2245,13 +2397,13 @@
 			  $(CUPS_CFLAGS) \
 			  $(X_CFLAGS) \
 			  -I$(JDK_TOPDIR)/src/share/native/sun/java2d \
-			  -I$(JDK_TOPDIR)/src/$(LEGACY_OPENJDK_TARGET_OS_API)/native/sun/java2d \
+			  -I$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/java2d \
 			  -I$(JDK_TOPDIR)/src/share/native/sun/java2d/loops \
 			  -I$(JDK_TOPDIR)/src/share/native/sun/java2d/pipe \
 			  -I$(JDK_TOPDIR)/src/share/native/sun/awt/image \
 			  -I$(JDK_TOPDIR)/src/share/native/sun/awt/image/cvutils \
 			  -I$(JDK_TOPDIR)/src/share/native/sun/awt/debug \
-			  -I$(JDK_TOPDIR)/src/$(LEGACY_OPENJDK_TARGET_OS_API)/native/sun/jdga \
+			  -I$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/jdga \
                           $(foreach dir,$(LIBAWT_HEADLESS_DIRS),-I$(dir))
 
 LIBAWT_HEADLESS_FILES:=\
@@ -2282,12 +2434,10 @@
         AccelGlyphCache.c \
 	CUPSfuncs.c
 
-LIBAWT_HEADLESS_LDFLAGS_SUFFIX:=$(LDFLAGS_JDKLIB_SUFFIX) -lawt -lm
-
 LIBAWT_HEADLESS_REORDER:=
 ifeq ($(OPENJDK_TARGET_OS), solaris)
-	ifneq ($(ARCH), amd64)
-		LIBAWT_HEADLESS_REORDER:=$(JDK_TOPDIR)/makefiles/mapfiles/libawt_headless/reorder-$(ARCH)
+	ifneq ($(OPENJDK_TARGET_CPU), x86_64)
+		LIBAWT_HEADLESS_REORDER:=$(JDK_TOPDIR)/makefiles/mapfiles/libawt_headless/reorder-$(OPENJDK_TARGET_CPU)
 	endif
 endif
 
@@ -2302,11 +2452,15 @@
 		MAPFILE:=$(JDK_TOPDIR)/makefiles/mapfiles/libawt_headless/mapfile-vers, \
 		LDFLAGS:=$(LDFLAGS_JDKLIB) \
 			 $(call SET_SHARED_LIBRARY_ORIGIN),\
+		LDFLAGS_linux:=$(call SET_SHARED_LIBRARY_ORIGIN,/..),\
+		LDFLAGS_solaris:=$(call SET_SHARED_LIBRARY_ORIGIN,/..) \
+				 -R/usr/dt/lib$(OPENJDK_TARGET_CPU_ISADIR) \
+				 -R$(OPENWIN_LIB)$(OPENJDK_TARGET_CPU_ISADIR),\
+		LDFLAGS_macosx:=$(call SET_SHARED_LIBRARY_ORIGIN).,\
 		REORDER:=$(LIBAWT_HEADLESS_REORDER), \
-		LDFLAGS_SUFFIX:=$(LIBAWT_HEADLESS_LDFLAGS_SUFFIX),\
-		LDFLAGS_SUFFIX_posix:=$(LIBDL),\
-		LDFLAGS_SUFFIX_macosx:=$(LIBCXX), \
-		LDFLAGS_SUFFIX_solaris:=$(LIBCXX), \
+		LDFLAGS_SUFFIX_linux:=-ljvm -lawt -lm $(LIBDL) -ljava,\
+		LDFLAGS_SUFFIX_solaris:=$(LIBDL) -ljvm -lawt -lm -ljava $(LIBCXX), \
+		LDFLAGS_SUFFIX_macosx:=-ljvm $(LIBCXX) -lawt $(LIBDL) -ljava, \
 		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libawt_headless))
 
 $(BUILD_LIBAWT_HEADLESS) : $(BUILD_LIBAWT)
@@ -2324,7 +2478,7 @@
 	$(JDK_TOPDIR)/src/share/native/sun/awt/image/jpeg \
 	$(JDK_TOPDIR)/src/share/native/sun/awt/libpng \
 	$(JDK_TOPDIR)/src/share/native/sun/awt/splashscreen \
-        $(JDK_TOPDIR)/src/$(LEGACY_OPENJDK_TARGET_OS_API)/native/sun/awt/splashscreen
+        $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/awt/splashscreen
 
 LIBSPLASHSCREEN_CFLAGS:=-DSPLASHSCREEN -DPNG_NO_MMX_CODE \
 	$(foreach dir,$(LIBSPLASHSCREEN_DIRS),-I$(dir))
@@ -2458,7 +2612,7 @@
                                   -F/System/Library/Frameworks/JavaVM.framework/Frameworks \
 				  -framework JavaNativeFoundation
 else ifneq ($(OPENJDK_TARGET_OS), windows)
-	LIBSPLASHSCREEN_LDFLAGS_SUFFIX += -L$(OPENWIN_LIB)$(ISA_DIR) -lX11 -lXext $(LIBM) -lpthread
+	LIBSPLASHSCREEN_LDFLAGS_SUFFIX += -L$(OPENWIN_LIB)$(OPENJDK_TARGET_CPU_ISADIR) -lX11 -lXext $(LIBM) -lpthread
 else # OPENJDK_TARGET_OS
 	LIBSPLASHSCREEN_LDFLAGS_SUFFIX += kernel32.lib user32.lib gdi32.lib delayimp.lib /DELAYLOAD:user32.dll
 endif # OPENJDK_TARGET_OS
@@ -2474,9 +2628,14 @@
 		MAPFILE:=$(JDK_TOPDIR)/makefiles/mapfiles/libsplashscreen/mapfile-vers, \
 		LDFLAGS:=$(LDFLAGS_JDKLIB) \
 			 $(call SET_SHARED_LIBRARY_ORIGIN),\
-		LDFLAGS_SUFFIX_linux:=$(LIBDL), \
 		LDFLAGS_SUFFIX:=$(LIBSPLASHSCREEN_LDFLAGS_SUFFIX) $(LIBZ),\
-		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libsplashscreen))
+		VERSIONINFO_RESOURCE:=$(JDK_TOPDIR)/src/windows/resource/version.rc,\
+		RC_FLAGS:=$(RC_FLAGS)\
+			  /D "JDK_FNAME=splashscreen.dll" \
+			  /D "JDK_INTERNAL_NAME=splashscreen" \
+			  /D "JDK_FTYPE=0x2L",\
+		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libsplashscreen,\
+		DEBUG_SYMBOLS:=$(WINDOWS_ONLY)))
 
 BUILD_LIBRARIES += $(LIBSPLASHSCREEN)
 
@@ -2508,11 +2667,17 @@
 		CFLAGS:=$(CFLAGS_JDKLIB) \
 			$(LIBDCPR_CFLAGS), \
 		MAPFILE:=$(JDK_TOPDIR)/makefiles/mapfiles/libdcpr/mapfile-vers, \
-		LDFLAGS:=$(LDFLAGS_JDKLIB) $(LIBM)\
+		LDFLAGS:=$(LDFLAGS_JDKLIB) \
 			 $(call SET_SHARED_LIBRARY_ORIGIN),\
-		LDFLAGS_SUFFIX:=$(LDFLAGS_JDKLIB_SUFFIX),\
+		LDFLAGS_SUFFIX:=$(LIBM) $(LDFLAGS_JDKLIB_SUFFIX),\
 		LDFLAGS_SUFFIX_posix:=-lm,\
-		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libdcpr))
+		VERSIONINFO_RESOURCE:=$(JDK_TOPDIR)/src/windows/resource/version.rc,\
+		RC_FLAGS:=$(RC_FLAGS)\
+			  /D "JDK_FNAME=dcpr.dll" \
+			  /D "JDK_INTERNAL_NAME=dcpr" \
+			  /D "JDK_FTYPE=0x2L",\
+		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libdcpr,\
+		DEBUG_SYMBOLS:=$(WINDOWS_ONLY)))
 
 $(BUILD_LIBDCPR) : $(BUILD_LIBJAVA)
 
@@ -2526,20 +2691,26 @@
 		LIBRARY:=j2pcsc,\
                 OUTPUT_DIR:=$(INSTALL_LIBRARIES_HERE),\
 		SRC:=$(JDK_TOPDIR)/src/share/native/sun/security/smartcardio \
-                     $(JDK_TOPDIR)/src/$(LEGACY_OPENJDK_TARGET_OS_API)/native/sun/security/smartcardio,\
+                     $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/security/smartcardio,\
 		LANG:=C,\
 		CFLAGS_posix:=-D__sun_jdk,\
 		OPTIMIZATION:=LOW, \
 		CFLAGS:=$(CFLAGS_JDKLIB) \
                      -I$(JDK_TOPDIR)/src/share/native/sun/security/smartcardio \
-                     -I$(JDK_TOPDIR)/src/$(LEGACY_OPENJDK_TARGET_OS_API)/native/sun/security/smartcardio\
-                     -I$(JDK_TOPDIR)/src/$(LEGACY_OPENJDK_TARGET_OS_API)/native/sun/security/smartcardio/MUSCLE,\
+                     -I$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/security/smartcardio\
+                     -I$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/security/smartcardio/MUSCLE,\
 		MAPFILE:=$(JDK_TOPDIR)/makefiles/mapfiles/libj2pcsc/mapfile-vers, \
 		LDFLAGS:=$(LDFLAGS_JDKLIB) \
 			 $(call SET_SHARED_LIBRARY_ORIGIN),\
 		LDFLAGS_SUFFIX_posix:=$(LIBDL), \
 		LDFLAGS_SUFFIX_windows:=winscard.lib,\
-		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libj2pcsc))
+		VERSIONINFO_RESOURCE:=$(JDK_TOPDIR)/src/windows/resource/version.rc,\
+		RC_FLAGS:=$(RC_FLAGS)\
+			  /D "JDK_FNAME=j2pcsc.dll" \
+			  /D "JDK_INTERNAL_NAME=j2pcsc" \
+			  /D "JDK_FTYPE=0x2L",\
+		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libj2pcsc,\
+		DEBUG_SYMBOLS:=$(WINDOWS_ONLY)))
 
 BUILD_LIBRARIES += $(BUILD_LIBJ2PCSC)
 
@@ -2550,12 +2721,12 @@
 		LIBRARY:=j2gss,\
                 OUTPUT_DIR:=$(INSTALL_LIBRARIES_HERE),\
 		SRC:=$(JDK_TOPDIR)/src/share/native/sun/security/jgss/wrapper \
-                     $(JDK_TOPDIR)/src/$(LEGACY_OPENJDK_TARGET_OS_API)/native/sun/security/jgss/wrapper,\
+                     $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/security/jgss/wrapper,\
 		LANG:=C,\
 		OPTIMIZATION:=LOW, \
 		CFLAGS:=$(CFLAGS_JDKLIB) \
                      -I$(JDK_TOPDIR)/src/share/native/sun/security/jgss/wrapper \
-                     -I$(JDK_TOPDIR)/src/$(LEGACY_OPENJDK_TARGET_OS_API)/native/sun/security/jgss/wrapper,\
+                     -I$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/security/jgss/wrapper,\
 		MAPFILE:=$(JDK_TOPDIR)/makefiles/mapfiles/libj2gss/mapfile-vers, \
 		LDFLAGS:=$(LDFLAGS_JDKLIB) \
 			 $(call SET_SHARED_LIBRARY_ORIGIN),\
@@ -2571,7 +2742,7 @@
 ifeq ($(OPENJDK_TARGET_OS), windows)
      BUILD_LIBKRB5_NAME:=w2k_lsa_auth
      BUILD_LIBKRB5_FILES:=NativeCreds.c WindowsDirectory.c
-     BUILD_LIBKRB5_SRC:=$(JDK_TOPDIR)/src/$(LEGACY_OPENJDK_TARGET_OS_API)/native/sun/security/krb5
+     BUILD_LIBKRB5_SRC:=$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/security/krb5
      BUILD_LIBKRB5_LIBS:=Secur32.lib netapi32.lib \
 	kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib \
 	advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib \
@@ -2593,11 +2764,17 @@
 		OPTIMIZATION:=LOW, \
 		CFLAGS:=$(CFLAGS_JDKLIB) \
 		        -I$(JDK_TOPDIR)/src/share/native/sun/security/krb5 \
-                        -I$(JDK_TOPDIR)/src/$(LEGACY_OPENJDK_TARGET_OS_API)/native/sun/security/krb5 ,\
+                        -I$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/security/krb5 ,\
 		LDFLAGS:=$(LDFLAGS_JDKLIB) \
 			 $(call SET_SHARED_LIBRARY_ORIGIN),\
 		LDFLAGS_SUFFIX:=$(BUILD_LIBKRB5_LIBS) ,\
-		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libkrb5))
+		VERSIONINFO_RESOURCE:=$(JDK_TOPDIR)/src/windows/resource/version.rc,\
+		RC_FLAGS:=$(RC_FLAGS)\
+			  /D "JDK_FNAME=$(BUILD_LIBKRB5_NAME).dll" \
+			  /D "JDK_INTERNAL_NAME=$(BUILD_LIBKRB5_NAME)" \
+			  /D "JDK_FTYPE=0x2L",\
+		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libkrb5,\
+		DEBUG_SYMBOLS:=$(WINDOWS_ONLY)))
 
 BUILD_LIBRARIES += $(BUILD_LIBKRB5)
 endif
@@ -2610,46 +2787,56 @@
 		LIBRARY:=sunmscapi,\
                 OUTPUT_DIR:=$(INSTALL_LIBRARIES_HERE),\
 		SRC:=$(JDK_TOPDIR)/src/share/native/sun/security/mscapi \
-		     $(JDK_TOPDIR)/src/$(LEGACY_OPENJDK_TARGET_OS_API)/native/sun/security/mscapi,\
+		     $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/security/mscapi,\
 		INCLUDE_FILES:=security.cpp, \
 		LANG:=C++,\
 		OPTIMIZATION:=LOW, \
 		CFLAGS:=$(CFLAGS_JDKLIB) \
 		        -I$(JDK_TOPDIR)/src/share/native/sun/security/mscapi \
-                        -I$(JDK_TOPDIR)/src/$(LEGACY_OPENJDK_TARGET_OS_API)/native/sun/security/mscapi ,\
-		LDFLAGS:=$(LDFLAGS_JDKLIB) \
+                        -I$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/security/mscapi ,\
+		LDFLAGS:=$(LDFLAGS_JDKLIB) $(LDFLAGS_CXX_JDK) \
 			 $(call SET_SHARED_LIBRARY_ORIGIN),\
 		LDFLAGS_SUFFIX:=Crypt32.Lib advapi32.lib,\
-		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libsunmscapi))
+		VERSIONINFO_RESOURCE:=$(JDK_TOPDIR)/src/windows/resource/version.rc,\
+		RC_FLAGS:=$(RC_FLAGS)\
+			  /D "JDK_FNAME=sunmscapi.dll" \
+			  /D "JDK_INTERNAL_NAME=sunmscapi" \
+			  /D "JDK_FTYPE=0x2L",\
+		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libsunmscapi,\
+		DEBUG_SYMBOLS:=$(WINDOWS_ONLY)))
 
 BUILD_LIBRARIES += $(BUILD_LIBSUNMSCAPI)
 endif
 
 ##########################################################################################
 
-ifneq ($(OPENJDK_TARGET_OS)-$(ARCH_DATA_MODEL), windows-64)
 $(eval $(call SetupNativeCompilation,BUILD_LIBJ2PKCS11,\
 		LIBRARY:=j2pkcs11,\
                 OUTPUT_DIR:=$(INSTALL_LIBRARIES_HERE),\
 		SRC:=$(JDK_TOPDIR)/src/share/native/sun/security/pkcs11 \
-                     $(JDK_TOPDIR)/src/$(LEGACY_OPENJDK_TARGET_OS_API)/native/sun/security/pkcs11 \
+                     $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/security/pkcs11 \
                      $(JDK_TOPDIR)/src/share/native/sun/security/pkcs11/wrapper \
-                     $(JDK_TOPDIR)/src/$(LEGACY_OPENJDK_TARGET_OS_API)/native/sun/security/pkcs11/wrapper,\
+                     $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/security/pkcs11/wrapper,\
 		LANG:=C,\
 		OPTIMIZATION:=LOW, \
 		CFLAGS:=$(CFLAGS_JDKLIB) \
 		        -I$(JDK_TOPDIR)/src/share/native/sun/security/pkcs11 \
-		        -I$(JDK_TOPDIR)/src/$(LEGACY_OPENJDK_TARGET_OS_API)/native/sun/security/pkcs11 \
+		        -I$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/security/pkcs11 \
 		        -I$(JDK_TOPDIR)/src/share/native/sun/security/pkcs11/wrapper \
-                        -I$(JDK_TOPDIR)/src/$(LEGACY_OPENJDK_TARGET_OS_API)/native/sun/security/pkcs11/wrapper,\
+                        -I$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/security/pkcs11/wrapper,\
 		MAPFILE:=$(JDK_TOPDIR)/makefiles/mapfiles/libj2pkcs11/mapfile-vers, \
 		LDFLAGS:=$(LDFLAGS_JDKLIB) \
 			 $(call SET_SHARED_LIBRARY_ORIGIN),\
 		LDFLAGS_SUFFIX_posix:=$(LIBDL), \
-		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libj2pkcs11))
+		VERSIONINFO_RESOURCE:=$(JDK_TOPDIR)/src/windows/resource/version.rc,\
+		RC_FLAGS:=$(RC_FLAGS)\
+			  /D "JDK_FNAME=j2pkcs11.dll" \
+			  /D "JDK_INTERNAL_NAME=j2pkcs11" \
+			  /D "JDK_FTYPE=0x2L",\
+		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libj2pkcs11,\
+		DEBUG_SYMBOLS:=$(WINDOWS_ONLY)))
 
 BUILD_LIBRARIES += $(BUILD_LIBJ2PKCS11)
-endif
 
 ##########################################################################################
 
@@ -2685,11 +2872,18 @@
 		CXXFLAGS:=$(filter-out $(ECC_JNI_SOLSPARC_FILTER), $(CXXFLAGS_JDKLIB)) \
                           $(BUILD_LIBSUNEC_FLAGS),\
 		MAPFILE:=$(JDK_TOPDIR)/makefiles/mapfiles/libsunec/mapfile-vers, \
-		LDFLAGS:=$(LDFLAGS_JDKLIB) \
-			 $(call SET_SHARED_LIBRARY_ORIGIN),\
+		LDFLAGS:=$(LDFLAGS_JDKLIB) $(LDFLAGS_CXX_JDK),\
+		LDFLAGS_macosx:=$(call SET_SHARED_LIBRARY_ORIGIN),\
 		LDFLAGS_SUFFIX:=$(LIBCXX),\
+                LDFLAGS_SUFFIX_linux:=-lc ,\
                 LDFLAGS_SUFFIX_solaris:=-lc ,\
-		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libsunec))
+		VERSIONINFO_RESOURCE:=$(JDK_TOPDIR)/src/windows/resource/version.rc,\
+		RC_FLAGS:=$(RC_FLAGS)\
+			  /D "JDK_FNAME=sunec.dll" \
+			  /D "JDK_INTERNAL_NAME=sunec" \
+			  /D "JDK_FTYPE=0x2L",\
+		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libsunec,\
+		DEBUG_SYMBOLS:=$(WINDOWS_ONLY)))
 
 BUILD_LIBRARIES += $(BUILD_LIBSUNEC)
 endif
@@ -2698,7 +2892,7 @@
 
 LIBJSOUND_SRC_DIRS:=\
 	$(JDK_TOPDIR)/src/share/native/com/sun/media/sound \
-	$(JDK_TOPDIR)/src/$(LEGACY_OPENJDK_TARGET_OS_API)/native/com/sun/media/sound
+	$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/com/sun/media/sound
 
 LIBJSOUND_SRC_FILES:=Utilities.c Platform.c
 
@@ -2781,29 +2975,29 @@
 ifeq ($(JVM_VARIANT_ZERO), true)
 	LIBJSOUND_CFLAGS += -DX_ARCH=X_ZERO
 else
-  ifeq ($(ARCH), i586)
+  ifeq ($(OPENJDK_TARGET_CPU), x86)
 	LIBJSOUND_CFLAGS += -DX_ARCH=X_I586
-  endif # ARCH i586
-
-  ifeq ($(ARCH), sparc)
+  endif
+
+  ifeq ($(OPENJDK_TARGET_CPU), sparc)
 	LIBJSOUND_CFLAGS += -DX_ARCH=X_SPARC
-  endif # ARCH sparc
-
-  ifeq ($(ARCH), sparcv9)
+  endif
+
+  ifeq ($(OPENJDK_TARGET_CPU), sparcv9)
 	LIBJSOUND_CFLAGS += -DX_ARCH=X_SPARCV9
-  endif # ARCH sparcv9
-
-  ifeq ($(ARCH), amd64)
+  endif
+
+  ifeq ($(OPENJDK_TARGET_CPU), x86_64)
 	LIBJSOUND_CFLAGS += -DX_ARCH=X_AMD64
-  endif # ARCH amd64
-
-  ifeq ($(ARCH), arm)
+  endif
+
+  ifeq ($(OPENJDK_TARGET_CPU), arm)
 	LIBJSOUND_CFLAGS += -DX_ARCH=X_ARM
-  endif # ARCH arm
-
-  ifeq ($(ARCH), ppc)
+  endif
+
+  ifeq ($(OPENJDK_TARGET_CPU), ppc)
 	LIBJSOUND_CFLAGS += -DX_ARCH=X_PPC
-  endif # ARCH ppc
+  endif
 endif
 
 LIBJSOUND_CFLAGS += -DEXTRA_SOUND_JNI_LIBS='"$(EXTRA_SOUND_JNI_LIBS)"'
@@ -2815,18 +3009,25 @@
 		INCLUDE_FILES:=$(LIBJSOUND_SRC_FILES),\
 		LANG:=$(LIBJSOUND_LANG),\
 		OPTIMIZATION:=LOW, \
-		CFLAGS:=$(CFLAGS_JDKLIB) $(LIBJSOUND_CFLAGS), \
+		CFLAGS:=$(CFLAGS_JDKLIB) \
+		        $(LIBJSOUND_CFLAGS), \
 		CXXFLAGS:=$(CXXFLAGS_JDKLIB) $(LIBJSOUND_CFLAGS), \
 		MAPFILE:=$(JDK_TOPDIR)/makefiles/mapfiles/libjsound/mapfile-vers, \
 		LDFLAGS:=$(LDFLAGS_JDKLIB)\
 			 $(call SET_SHARED_LIBRARY_ORIGIN),\
+		LDFLAGS_macosx:=-framework CoreAudio -framework CoreFoundation \
+				-framework CoreServices -framework AudioUnit $(LIBCXX) \
+				-framework CoreMIDI -framework AudioToolbox,\
 		LDFLAGS_windows:=$(WIN_JAVA_LIB) advapi32.lib winmm.lib,\
-		LDFLAGS_SUFFIX:=$(LDFLAGS_JDKLIB_SUFFIX),\
+		LDFLAGS_SUFFIX:=-ljava -ljvm,\
 		LDFLAGS_SUFFIX_solaris:=-lc ,\
-		LDFLAGS_SUFFIX_macosx:=-framework CoreAudio -framework CoreFoundation \
-             -framework CoreServices -framework AudioUnit $(LIBCXX) \
-             -framework CoreMIDI -framework AudioToolbox ,\
-		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libjsound))
+		VERSIONINFO_RESOURCE:=$(JDK_TOPDIR)/src/windows/resource/version.rc,\
+		RC_FLAGS:=$(RC_FLAGS)\
+			  /D "JDK_FNAME=jsound.dll" \
+			  /D "JDK_INTERNAL_NAME=jsound" \
+			  /D "JDK_FTYPE=0x2L",\
+		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libjsound,\
+		DEBUG_SYMBOLS:=$(WINDOWS_ONLY)))
 
 $(BUILD_LIBJSOUND) : $(BUILD_LIBJAVA)
 
@@ -2860,7 +3061,7 @@
 		MAPFILE:=$(JDK_TOPDIR)/makefiles/mapfiles/libjsoundalsa/mapfile-vers, \
 		LDFLAGS:=$(LDFLAGS_JDKLIB)\
 			 $(call SET_SHARED_LIBRARY_ORIGIN),\
-		LDFLAGS_SUFFIX:=$(LDFLAGS_JDKLIB_SUFFIX) -lasound,\
+		LDFLAGS_SUFFIX:=-lasound -ljava -ljvm,\
 		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libjsoundalsa))
 
 $(BUILD_LIBJSOUNDALSA) : $(BUILD_LIBJAVA)
@@ -2884,10 +3085,16 @@
 		CFLAGS:=$(CFLAGS_JDKLIB) \
 			$(LIBJSOUND_CFLAGS) \
 			-DUSE_DAUDIO=TRUE, \
-		LDFLAGS:=$(LDFLAGS_JDKLIB)\
+		LDFLAGS:=$(LDFLAGS_JDKLIB) $(LDFLAGS_CXX_JDK) \
 			 $(call SET_SHARED_LIBRARY_ORIGIN),\
 		LDFLAGS_SUFFIX:=$(LDFLAGS_JDKLIB_SUFFIX) dsound.lib winmm.lib user32.lib ole32.lib,\
-		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libjsoundds))
+		VERSIONINFO_RESOURCE:=$(JDK_TOPDIR)/src/windows/resource/version.rc,\
+		RC_FLAGS:=$(RC_FLAGS)\
+			  /D "JDK_FNAME=jsoundds.dll" \
+			  /D "JDK_INTERNAL_NAME=jsoundds" \
+			  /D "JDK_FTYPE=0x2L",\
+		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libjsoundds,\
+		DEBUG_SYMBOLS:=$(WINDOWS_ONLY)))
 
 $(BUILD_LIBJSOUNDDS) : $(BUILD_LIBJAVA)
 
@@ -2909,8 +3116,7 @@
 		CFLAGS:=$(CFLAGS_JDKLIB) \
 			-I$(JDK_TOPDIR)/src/closed/solaris/native/com/oracle/security/ucrypto ,\
 		MAPFILE:=$(JDK_TOPDIR)/makefiles/mapfiles/libj2ucrypto/mapfile-vers, \
-		LDFLAGS:=$(LDFLAGS_JDKLIB)\
-			 $(call SET_SHARED_LIBRARY_ORIGIN), \
+		LDFLAGS:=$(LDFLAGS_JDKLIB),\
 		LDFLAGS_SUFFIX:=$(LIBDL),\
 		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libj2ucrypto))
 
@@ -2944,11 +3150,11 @@
                         -F/System/Library/Frameworks/ApplicationServices.framework/Frameworks, \
 		LDFLAGS:=$(LDFLAGS_JDKLIB)\
 			 $(call SET_SHARED_LIBRARY_ORIGIN), \
-		LDFLAGS_SUFFIX:=$(LDFLAGS_JDKLIB_SUFFIX) \
-    -framework Cocoa \
-    -framework Carbon \
-    -F/System/Library/Frameworks/JavaVM.framework/Frameworks \
-    -framework JavaNativeFoundation, \
+		LDFLAGS_SUFFIX:=-framework Cocoa \
+                                -framework Carbon \
+                                -F/System/Library/Frameworks/JavaVM.framework/Frameworks \
+                                -framework JavaNativeFoundation \
+                                $(LDFLAGS_JDKLIB_SUFFIX),\
 		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libAppleScriptEngine))
 
 $(BUILD_LIBAPPLESCRIPTENGINE) : $(BUILD_LIBJAVA)
@@ -3161,20 +3367,19 @@
                         -F/System/Library/Frameworks/ApplicationServices.framework/Frameworks,\
 		LDFLAGS:=$(LDFLAGS_JDKLIB)\
 			 $(call SET_SHARED_LIBRARY_ORIGIN), \
-		LDFLAGS_SUFFIX_macosx:=\
-	-lawt -lmlib_image -losxapp $(LDFLAGS_JDKLIB_SUFFIX) $(LIBM) \
-	-framework Accelerate \
-	-framework ApplicationServices \
-	-framework AudioToolbox \
-	-framework Carbon \
-	-framework Cocoa \
-	-framework Security \
-	-framework ExceptionHandling \
-        -F/System/Library/Frameworks/JavaVM.framework/Frameworks \
-	-framework JavaNativeFoundation \
-	-framework JavaRuntimeSupport \
-	-framework OpenGL \
-        -framework QuartzCore ,\
+		LDFLAGS_SUFFIX_macosx:=-lawt -lmlib_image -losxapp -ljvm $(LIBM) \
+				       -framework Accelerate \
+				       -framework ApplicationServices \
+				       -framework AudioToolbox \
+				       -framework Carbon \
+				       -framework Cocoa \
+				       -framework Security \
+				       -framework ExceptionHandling \
+				       -F/System/Library/Frameworks/JavaVM.framework/Frameworks \
+				       -framework JavaNativeFoundation \
+				       -framework JavaRuntimeSupport \
+				       -framework OpenGL \
+				       -framework QuartzCore -ljava,\
 		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libawt_lwawt))
 
 BUILD_LIBRARIES += $(BUILD_LIBAWT_LWAWT)
@@ -3216,16 +3421,16 @@
 			-I$(JDK_TOPDIR)/src/macosx/native/sun/awt \
                         -F/System/Library/Frameworks/JavaVM.framework/Frameworks, \
 		LDFLAGS:=$(LDFLAGS_JDKLIB)\
-			 $(call SET_SHARED_LIBRARY_ORIGIN), \
-		LDFLAGS_SUFFIX_macosx:=\
-    $(LDFLAGS_JDKLIB_SUFFIX) \
-    -lawt -losxapp -lawt_lwawt \
-    -framework Cocoa \
-    -framework Carbon \
-    -framework ApplicationServices \
-    -F/System/Library/Frameworks/JavaVM.framework/Frameworks \
-    -framework JavaNativeFoundation \
-    -framework JavaRuntimeSupport, \
+			 $(call SET_SHARED_LIBRARY_ORIGIN) \
+			 -Xlinker -rpath -Xlinker @loader_path,\
+		LDFLAGS_SUFFIX_macosx:=-lawt -losxapp -lawt_lwawt \
+				       -framework Cocoa \
+				       -framework Carbon \
+				       -framework ApplicationServices \
+				       -F/System/Library/Frameworks/JavaVM.framework/Frameworks \
+				       -framework JavaNativeFoundation \
+				       -framework JavaRuntimeSupport \
+				       -ljava -ljvm,\
 		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libosxui))
 
 BUILD_LIBRARIES += $(BUILD_LIBOSXUI)
@@ -3244,9 +3449,33 @@
 
 ifeq ($(OPENJDK_TARGET_OS), macosx)
 
-$(eval $(call SetupNativeCompilation,BUILD_LIBJOBJC,\
+# Ugly hack to mimic behaviour in old build where this is built as an xcode project.
+SET_SHARED_LIBRARY_NAME=-Xlinker -install_name -Xlinker /usr/local/lib/libJObjC.dylib
+
+$(eval $(call SetupNativeCompilation,BUILD_LIBJOBJC32,\
 		LIBRARY:=JObjC,\
-                OUTPUT_DIR:=$(INSTALL_LIBRARIES_HERE),\
+                OUTPUT_DIR:=$(JDK_OUTPUTDIR)/objs/libjobjc32,\
+		SRC:=$(JDK_TOPDIR)/src/macosx/native/jobjc/src/core/native \
+                     $(JDK_TOPDIR)/src/macosx/native/jobjc/src/runtime-additions/native ,\
+		LANG:=C,\
+		OPTIMIZATION:=LOW, \
+		CFLAGS:=-fpascal-strings \
+                        -fobjc-gc \
+                        -gdwarf-2 \
+                        $(CFLAGS_JDKLIB) \
+                        -F/System/Library/Frameworks/JavaVM.framework/Frameworks \
+			-m32,\
+		LDFLAGS:=$(LDFLAGS_JDKLIB)\
+			-m32, \
+		LDFLAGS_SUFFIX:=-framework Foundation -framework JavaVM \
+                                  -F/System/Library/Frameworks/JavaVM.framework/Frameworks \
+                                  -framework JavaNativeFoundation \
+                                  -lffi, \
+		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libjobjc32))
+
+$(eval $(call SetupNativeCompilation,BUILD_LIBJOBJC64,\
+		LIBRARY:=JObjC,\
+                OUTPUT_DIR:=$(JDK_OUTPUTDIR)/objs/libjobjc64,\
 		SRC:=$(JDK_TOPDIR)/src/macosx/native/jobjc/src/core/native \
                      $(JDK_TOPDIR)/src/macosx/native/jobjc/src/runtime-additions/native ,\
 		LANG:=C,\
@@ -3266,9 +3495,12 @@
                                   -F/System/Library/Frameworks/JavaVM.framework/Frameworks \
                                   -framework JavaNativeFoundation \
                                   -lffi, \
-		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libjobjc))
-
-BUILD_LIBRARIES += $(BUILD_LIBJOBJC)
+		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libjobjc64))
+
+$(INSTALL_LIBRARIES_HERE)/$(LIBRARY_PREFIX)JObjC$(SHARED_LIBRARY_SUFFIX): $(BUILD_LIBJOBJC32) $(BUILD_LIBJOBJC64)
+	$(LIPO) -create -output $@ $(BUILD_LIBJOBJC32) $(BUILD_LIBJOBJC64)
+
+BUILD_LIBRARIES += $(INSTALL_LIBRARIES_HERE)/$(LIBRARY_PREFIX)JObjC$(SHARED_LIBRARY_SUFFIX)
 
 endif
 
--- a/jdk/makefiles/CopyFiles.gmk	Wed Jul 05 18:22:17 2017 +0200
+++ b/jdk/makefiles/CopyFiles.gmk	Wed Jul 05 18:22:52 2017 +0200
@@ -47,12 +47,12 @@
 
 $(INCLUDEDIR)/%.h: $(JDK_TOPDIR)/src/share/javavm/export/%.h
 	$(MKDIR) -p $(@D)
-	$(RM) -f $@
+	$(RM) $@
 	$(CP) $< $@
 
-$(OPENJDK_TARGET_OS_INCLUDE)/%.h: $(JDK_TOPDIR)/src/$(LEGACY_OPENJDK_TARGET_OS_API)/javavm/export/%.h
+$(OPENJDK_TARGET_OS_INCLUDE)/%.h: $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/javavm/export/%.h
 	$(MKDIR) -p $(@D)
-	$(RM) -f $@
+	$(RM) $@
 	$(CP) $< $@
 
 COPY_FILES = $(H_TARGET_FILES)
@@ -64,7 +64,7 @@
 
 $(SERVICETAG_LIBDIR)/jdk_header.png: $(JDK_TOPDIR)/src/share/classes/com/sun/servicetag/resources/jdk_header.png
 	$(MKDIR) -p $(@D)
-	$(RM) -f $@
+	$(RM) $@
 	$(CP) $< $@
 	$(CHMOD) 444 $@
 
@@ -79,20 +79,20 @@
 
 $(MGMT_LIBDIR)/management.properties: $(MGMT_LIB_SRC)/management.properties
 	$(MKDIR) -p $(@D)
-	$(RM) -f $@
+	$(RM) $@
 	$(CP) $< $@
 	$(CHMOD) 644 $@
 
 # this file has different permissions...don't know why...
 $(MGMT_LIBDIR)/jmxremote.access: $(MGMT_LIB_SRC)/jmxremote.access
 	$(MKDIR) -p $(@D)
-	$(RM) -f $@
+	$(RM) $@
 	$(CP) $< $@
 	$(CHMOD) 644 $@
 
 $(MGMT_LIBDIR)/%: $(MGMT_LIB_SRC)/%
 	$(MKDIR) -p $(@D)
-	$(RM) -f $@
+	$(RM) $@
 	$(CP) $< $@
 	$(CHMOD) 444 $@
 
@@ -104,7 +104,7 @@
 
 $(LIBDIR)/logging.properties: $(LOGGING_LIB_SRC)/logging.properties
 	$(MKDIR) -p $(@D)
-	$(RM) -f $@
+	$(RM) $@
 	$(CP) $< $@
 
 COPY_FILES += $(LIBDIR)/logging.properties
@@ -119,7 +119,7 @@
 
 $(LIBDIR)/%: $(PSFONTPROPFILE_SRC_DIR)/%
 	$(MKDIR) -p $(@D)
-	$(RM) -f $@
+	$(RM) $@
 	$(CP) $< $@
 
 COPY_FILES += $(PSFONTPROPFILE_TARGET_FILES)
@@ -129,24 +129,24 @@
 # Copy flavormap.properties, cursor.properties and cursors gif files to LIBDIR
 #
 ifneq ($(OPENJDK_TARGET_OS), macosx)
-OPENJDK_TARGET_OS_LIB_SRC = $(JDK_TOPDIR)/src/$(LEGACY_OPENJDK_TARGET_OS_API)/lib
+OPENJDK_TARGET_OS_LIB_SRC = $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/lib
 else
 OPENJDK_TARGET_OS_LIB_SRC = $(JDK_TOPDIR)/src/macosx/lib
 endif
 
 $(LIBDIR)/flavormap.properties: $(OPENJDK_TARGET_OS_LIB_SRC)/flavormap.properties
 	$(MKDIR) -p $(@D)
-	$(RM) -f $@
+	$(RM) $@
 	$(CP) $< $@
 
 COPY_FILES += $(LIBDIR)/flavormap.properties
 
 CURSORS_DEST_DIR = $(LIBDIR)/images/cursors
-CURSORS_OPENJDK_TARGET_OS_LIB_SRC = $(JDK_TOPDIR)/src/$(LEGACY_OPENJDK_TARGET_OS_API)/lib/images/cursors
+CURSORS_OPENJDK_TARGET_OS_LIB_SRC = $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/lib/images/cursors
 
 $(CURSORS_DEST_DIR)/cursors.properties: $(CURSORS_OPENJDK_TARGET_OS_LIB_SRC)/cursors.properties
 	$(MKDIR) -p $(@D)
-	$(RM) -f $@
+	$(RM) $@
 	$(CP) $< $@
 
 COPY_FILES += $(CURSORS_DEST_DIR)/cursors.properties
@@ -161,18 +161,18 @@
 
 $(CURSORS_DEST_DIR)/%: $(CURSORS_LIB_SRC)/%
 	$(MKDIR) -p $(@D)
-	$(RM) -f $@
+	$(RM) $@
 	$(CP) $< $@
 
 COPY_FILES += $(CURSORS_TARGET_FILES)
 
 ##########################################################################################
 
-CONTENT_TYPES_SRC=$(JDK_TOPDIR)/src/$(LEGACY_OPENJDK_TARGET_OS_API)/lib
+CONTENT_TYPES_SRC=$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/lib
 
 $(LIBDIR)/content-types.properties: $(CONTENT_TYPES_SRC)/content-types.properties
 	$(MKDIR) -p $(@D)
-	$(RM) -f $@
+	$(RM) $@
 	$(CP) $< $@
 
 COPY_FILES += $(LIBDIR)/content-types.properties
@@ -183,7 +183,7 @@
 
 $(LIBDIR)/calendars.properties: $(CALENDARS_SRC)/calendars.properties
 	$(MKDIR) -p $(@D)
-	$(RM) -f $@
+	$(RM) $@
 	$(CP) $< $@
 
 COPY_FILES += $(LIBDIR)/calendars.properties
@@ -192,11 +192,11 @@
 
 ifeq ($(OPENJDK_TARGET_OS),windows)
 
-TZMAPPINGS_SRC := $(JDK_TOPDIR)/src/$(LEGACY_OPENJDK_TARGET_OS_API)/lib
+TZMAPPINGS_SRC := $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/lib
 
 $(LIBDIR)/tzmappings: $(TZMAPPINGS_SRC)/tzmappings
 	$(MKDIR) -p $(@D)
-	$(RM) -f $@
+	$(RM) $@
 	$(CP) $< $@
 
 COPY_FILES += $(LIBDIR)/tzmappings
@@ -218,7 +218,7 @@
 
 $(ICCPROFILE_DEST_DIR)%.pf: $(ICCPROFILE_SRC_DIR)%.pf
 	$(MKDIR) -p $(@D)
-	$(RM) -f $@
+	$(RM) $@
 	$(CP) $< $@
 	$(CHMOD) 444 $@
 
@@ -248,7 +248,7 @@
         FREETYPE_LIB = $(JDK_OUTPUTDIR)/bin/$(call SHARED_LIBRARY,freetype)
     else 
         ifeq ($(USING_SYSTEM_FT_LIB), false)
-            FREETYPE_LIB = $(JDK_OUTPUTDIR)/lib/$(LIBARCH)/$(call SHARED_LIBRARY,freetype).6
+            FREETYPE_LIB = $(JDK_OUTPUTDIR)/lib$(OPENJDK_TARGET_CPU_LIBDIR)/$(call SHARED_LIBRARY,freetype).6
         endif
     endif 
 
@@ -269,7 +269,7 @@
     MSVCRNN_TARGET := $(JDK_OUTPUTDIR)/bin/$(notdir $(MSVCRNN_DLL))
     $(MSVCRNN_TARGET): $(MSVCRNN_DLL)
 	$(MKDIR) -p $(@D)
-	$(RM) -f $@
+	$(RM) $@
 	$(CP) $< $@
 
     COPY_FILES += $(MSVCRNN_TARGET)
@@ -281,7 +281,7 @@
 
 $(LIBDIR)/jvm.hprof.txt : $(HPROF_SRC)
 	$(MKDIR) -p $(@D)
-	$(RM) -f $@
+	$(RM) $@
 	$(CP) $< $@
 
 COPY_FILES += $(LIBDIR)/jvm.hprof.txt
@@ -292,26 +292,21 @@
 # How to install jvm.cfg.
 #
 ifeq ($(JVM_VARIANT_ZERO), true)
-JVMCFG_ARCH := zero
+    JVMCFG_ARCH := zero
 else
-    JVMCFG_ARCH := $(ARCH)
+    JVMCFG_ARCH := $(OPENJDK_TARGET_CPU_LEGACY)
 endif
 
 ifeq ($(OPENJDK_TARGET_OS),macosx)
-  ifeq ($(JVMCFG_ARCH),amd64)
-      JVMCFG_ARCH := x86_64
-  endif
   JVMCFG_SRC := $(JDK_TOPDIR)/src/macosx/bin/$(JVMCFG_ARCH)/jvm.cfg
-  JVMCFG_DIR := $(JDK_OUTPUTDIR)/lib
 else
-  JVMCFG_SRC := $(JDK_TOPDIR)/src/$(LEGACY_OPENJDK_TARGET_OS_API)/bin/$(JVMCFG_ARCH)/jvm.cfg
-  JVMCFG_DIR := $(JDK_OUTPUTDIR)/lib/$(LIBARCH)
+  JVMCFG_SRC := $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/bin/$(JVMCFG_ARCH)/jvm.cfg
 endif
-
+JVMCFG_DIR := $(JDK_OUTPUTDIR)/lib$(OPENJDK_TARGET_CPU_LIBDIR)
 JVMCFG := $(JVMCFG_DIR)/jvm.cfg
 
 
-ifeq ($(ARCH_DATA_MODEL),32)
+ifeq ($(OPENJDK_TARGET_CPU_BITS),32)
     # On 32 bit machines, we can have client and/or server libjvms installed.
     # Since the currently committed jvm.cfg expects clientANDserver, we need 
     # to patch the jvm.cfg when we have built only a client or only a server.
@@ -320,7 +315,7 @@
         # Create a patched jvm.cfg to use -client by default and alias -server to -client.
         $(JVMCFG):
 		$(MKDIR) -p $(@D)
-		$(RM) -f $(JVMCFG)
+		$(RM) $(JVMCFG)
 		$(PRINTF) "-client KNOWN\n">$(JVMCFG)
 		$(PRINTF) "-server IGNORE\n">>$(JVMCFG)
 		$(PRINTF) "-hotspot ALIASED_TO -client\n">>$(JVMCFG)
@@ -334,7 +329,7 @@
 
             $(JVMCFG):
 		$(MKDIR) -p $(@D)
-		$(RM) -f $(JVMCFG)
+		$(RM) $(JVMCFG)
 		$(PRINTF) "-server KNOWN\n">$(JVMCFG)
 		$(PRINTF) "-client IGNORE\n">>$(JVMCFG)
 		$(PRINTF) "-hotspot IGNORE\n">>$(JVMCFG)
@@ -345,7 +340,7 @@
             # Use the default jvm.cfg for this 32 bit setup. 
             $(JVMCFG): $(JVMCFG_SRC)
 	    	$(MKDIR) -p $(@D)
-		$(RM) -f $@
+		$(RM) $@
 		$(CP) $< $@
         endif
     endif
@@ -353,7 +348,7 @@
     # Use the default jvm.cfg for this 64 bit setup.
     $(JVMCFG): $(JVMCFG_SRC)
 		$(MKDIR) -p $(@D)
-		$(RM) -f $@
+		$(RM) $@
 		$(CP) $< $@
 endif
 
@@ -378,7 +373,7 @@
 
 $(PROPS_DST): $(PROPS_SRC)
 	$(MKDIR) -p $(@D)
-	$(RM) -f $@
+	$(RM) $@
 	$(CP) $< $@
 
 COPY_FILES += $(PROPS_DST)
@@ -390,7 +385,7 @@
 
 $(POLICY_DST): $(POLICY_SRC)
 	$(MKDIR) -p $(@D)
-	$(RM) -f $@
+	$(RM) $@
 	$(CP) $< $@
 
 COPY_FILES += $(POLICY_DST)
@@ -402,7 +397,7 @@
 
 $(CACERTS_DST): $(CACERTS_SRC)
 	$(MKDIR) -p $(@D)
-	$(RM) -f $@
+	$(RM) $@
 	$(CP) $< $@
 
 COPY_FILES += $(CACERTS_DST)
@@ -419,14 +414,14 @@
 
 $(BLACKLIST_DST): $(BLACKLIST_SRC)
 	$(MKDIR) -p $(@D)
-	$(RM) -f $@
+	$(RM) $@
 	$(CP) $< $@
 
 COPY_FILES += $(BLACKLIST_DST)
 
 $(TRUSTEDLIBS_DST): $(TRUSTEDLIBS_SRC)
 	$(MKDIR) -p $(@D)
-	$(RM) -f $@
+	$(RM) $@
 	$(CP) $< $@
 
 COPY_FILES += $(TRUSTEDLIBS_DST)
@@ -462,7 +457,11 @@
 	$(RM) $@
 	$(CP) $< $@
 
-COPY_FILES += $(SHARED_FONTS_DST) $(SHARED_FONTS_DST_DIR)/fonts.dir
+COPY_FILES += $(SHARED_FONTS_DST)
+
+ifneq ($(OPENJDK_TARGET_OS), windows)
+    COPY_FILES += $(SHARED_FONTS_DST_DIR)/fonts.dir
+endif
 
 ifeq ($(OPENJDK_TARGET_OS), linux)
 
@@ -537,21 +536,21 @@
 
 _DGALIBS_amd64 = 	# no amd64 library yet
 
-DGALIBS = $(_DGALIBS_$(ARCH):%=$(JDK_OUTPUTDIR)/lib/$(LIBARCH)/%)
+DGALIBS = $(_DGALIBS_$(OPENJDK_TARGET_CPU_LEGACY):%=$(JDK_OUTPUTDIR)/lib$(OPENJDK_TARGET_CPU_LIBDIR)/%)
 
-$(JDK_OUTPUTDIR)/lib/$(LIBARCH)/libxinerama.so: $(JDK_TOPDIR)/src/closed/solaris/lib/$(ARCH)/libxinerama.so
+$(JDK_OUTPUTDIR)/lib$(OPENJDK_TARGET_CPU_LIBDIR)/libxinerama.so: $(JDK_TOPDIR)/src/closed/solaris/lib/$(OPENJDK_TARGET_CPU_LEGACY)/libxinerama.so
 	$(MKDIR) -p $(@D)
 	$(RM) $@
 	$(CP) $< $@
 	$(CHMOD) 755 $@
 
-$(JDK_OUTPUTDIR)/lib/$(LIBARCH)/libjdgaSUNW%.so: $(JDK_TOPDIR)/src/closed/solaris/lib/$(ARCH)/libjdgaSUNW%.so
+$(JDK_OUTPUTDIR)/lib$(OPENJDK_TARGET_CPU_LIBDIR)/libjdgaSUNW%.so: $(JDK_TOPDIR)/src/closed/solaris/lib/$(OPENJDK_TARGET_CPU_LEGACY)/libjdgaSUNW%.so
 	$(MKDIR) -p $(@D)
 	$(RM) $@
 	$(CP) $< $@
 	$(CHMOD) 755 $@
 
-$(JDK_OUTPUTDIR)/lib/$(LIBARCH)/libjdgaSUNWafb.so: $(JDK_OUTPUTDIR)/lib/$(LIBARCH)/libjdgaSUNWffb.so
+$(JDK_OUTPUTDIR)/lib$(OPENJDK_TARGET_CPU_LIBDIR)/libjdgaSUNWafb.so: $(JDK_OUTPUTDIR)/lib$(OPENJDK_TARGET_CPU_LIBDIR)/libjdgaSUNWffb.so
 	$(MKDIR) -p $(@D)
 	$(RM) $@
 	$(LN) -s $< $@
--- a/jdk/makefiles/CopyIntoClasses.gmk	Wed Jul 05 18:22:17 2017 +0200
+++ b/jdk/makefiles/CopyIntoClasses.gmk	Wed Jul 05 18:22:52 2017 +0200
@@ -174,11 +174,11 @@
 $(shell $(MKDIR) -p $(JDK_OUTPUTDIR)/classes/META-INF/services)
 # Find all META-INF/services/* files
 ALL_META-INF_DIRS_share:=$(shell $(FIND) $(JDK_TOPDIR)/src/share/classes -type d -a -name META-INF)
-ALL_META-INF_DIRS_targetapi:=$(shell $(FIND) $(JDK_TOPDIR)/src/$(LEGACY_OPENJDK_TARGET_OS_API)/classes -type d -a -name META-INF)
+ALL_META-INF_DIRS_targetapi:=$(shell $(FIND) $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/classes -type d -a -name META-INF)
 # Platform specific overrides shared
 ifneq ($(ALL_META-INF_DIRS_targetapi),)
     ALL_META-INF_DIRS:=$(ALL_META-INF_DIRS_targetapi) \
-	$(filter-out %$(patsubst $(JDK_TOPDIR)/src/$(LEGACY_OPENJDK_TARGET_OS_API)/classes%,%,$(ALL_META-INF_DIRS_targetapi)),\
+	$(filter-out %$(patsubst $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/classes%,%,$(ALL_META-INF_DIRS_targetapi)),\
 		$(ALL_META-INF_DIRS_share))
 else
     ALL_META-INF_DIRS:=$(ALL_META-INF_DIRS_share)
@@ -216,9 +216,9 @@
 	$(shell $(PRINTF) "$(SRC_SERVICES_FILES)\n" | $(SED) -e 's|/[^ ]*/META-INF/services/||g'))
 OUT_SERVICES_FILES_COLON:=$(addsuffix :,$(OUT_SERVICES_FILES))
 # Exception handling for print services with no META-INF directory
-SRC_SERVICES_FILES_PRINT = $(wildcard $(JDK_TOPDIR)/src/$(LEGACY_OPENJDK_TARGET_OS_API)/classes/sun/print/services/*)
+SRC_SERVICES_FILES_PRINT = $(wildcard $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/classes/sun/print/services/*)
 OUT_SERVICES_FILES_PRINT = $(addprefix $(JDK_OUTPUTDIR)/classes/META-INF/services/,\
-	$(patsubst $(JDK_TOPDIR)/src/$(LEGACY_OPENJDK_TARGET_OS_API)/classes/sun/print/services/%,%,\
+	$(patsubst $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/classes/sun/print/services/%,%,\
 		$(SRC_SERVICES_FILES_PRINT)))
 OUT_SERVICES_FILES_PRINT_COLON = $(addsuffix :,$(OUT_SERVICES_FILES_PRINT))
 RULES_SERVICES_PRINT = $(join $(OUT_SERVICES_FILES_PRINT_COLON),$(SRC_SERVICES_FILES_PRINT))
@@ -257,23 +257,10 @@
             javax.sound.midi.spi.SoundbankReader \
             javax.sound.sampled.spi.AudioFileReader \
             javax.sound.sampled.spi.AudioFileWriter \
-            javax.sound.sampled.spi.FormatConversionProvider
-
-COPY_EXTRA += $(foreach F,$(notdir $(JAVAX_SOUND_SRC_FILES)),$(JDK_OUTPUTDIR)/classes/META-INF/services/${F})
+            javax.sound.sampled.spi.FormatConversionProvider \
+            javax.sound.sampled.spi.MixerProvider
 
-ifeq ($(OPENJDK_TARGET_OS)-$(ARCH),windows-ia64)
-	JAVAX_SOUND_SRC_FILES += windows-ia64/javax.sound.sampled.spi.MixerProvider
-	COPY_EXTRA += $(JDK_OUTPUTDIR)/classes/META-INF/services/javax.sound.sampled.spi.MixerProvider
-else ifeq ($(OPENJDK_TARGET_OS),windows)
-	JAVAX_SOUND_SRC_FILES += windows-i586/javax.sound.sampled.spi.MixerProvider
-	COPY_EXTRA += $(JDK_OUTPUTDIR)/classes/META-INF/services/javax.sound.sampled.spi.MixerProvider
-else ifeq ($(OPENJDK_TARGET_OS)-$(ARCH),linux-i586)
-	JAVAX_SOUND_SRC_FILES += linux-i586/javax.sound.sampled.spi.MixerProvider
-	COPY_EXTRA += $(JDK_OUTPUTDIR)/classes/META-INF/services/javax.sound.sampled.spi.MixerProvider
-else
-	JAVAX_SOUND_SRC_FILES += javax.sound.sampled.spi.MixerProvider
-	COPY_EXTRA += $(JDK_OUTPUTDIR)/classes/META-INF/services/javax.sound.sampled.spi.MixerProvider
-endif
+COPY_EXTRA += $(addprefix $(JDK_OUTPUTDIR)/classes/META-INF/services/,$(JAVAX_SOUND_SRC_FILES))
 
 JAVAX_SOUND_RULES := $(foreach F,$(JAVAX_SOUND_SRC_FILES),$(JDK_OUTPUTDIR)/classes/META-INF/services/$(notdir $F):$(JAVAX_SOUND_SRC)/$F)
 
--- a/jdk/makefiles/CopySamples.gmk	Wed Jul 05 18:22:17 2017 +0200
+++ b/jdk/makefiles/CopySamples.gmk	Wed Jul 05 18:22:52 2017 +0200
@@ -54,17 +54,17 @@
 
 $(SAMPLE_TARGET_DIR)/dtrace/%: $(SAMPLE_SOLARIS_SOURCE_DIR)/dtrace/%
 	$(MKDIR) -p $(@D)
-	$(RM) -f $@
+	$(RM) $@
 	$(CP) $< $@
 
 $(SAMPLE_TARGET_DIR)/webservices/%: $(SAMPLE_CLOSED_SOURCE_DIR)/webservices/%
 	$(MKDIR) -p $(@D)
-	$(RM) -f $@
+	$(RM) $@
 	$(CP) $< $@
 
 $(SAMPLE_TARGET_DIR)/%: $(SAMPLE_SOURCE_DIR)/%
 	$(MKDIR) -p $(@D)
-	$(RM) -f $@
+	$(RM) $@
 	$(CP) $< $@
 
 COPY_FILES += $(SAMPLE_TARGET)
--- a/jdk/makefiles/CreateJars.gmk	Wed Jul 05 18:22:17 2017 +0200
+++ b/jdk/makefiles/CreateJars.gmk	Wed Jul 05 18:22:52 2017 +0200
@@ -151,10 +151,12 @@
 	sun/security/ec/ECDSASignature\$$$$SHA384.class \
 	sun/security/ec/ECDSASignature\$$$$SHA512.class \
 	sun/security/ec/ECDSASignature.class \
+	sun/security/ec/ECKeyFactory.class \
 	sun/security/ec/ECKeyPairGenerator.class \
 	sun/security/ec/SunEC\$$$$1.class \
 	sun/security/ec/SunEC.class \
 	sun/security/ec/SunECEntries.class \
+	sun/security/mscapi \
 	sun/security/pkcs11 \
 	com/sun/net/ssl/internal/ssl \
 	javax/crypto \
@@ -260,50 +262,64 @@
 
 # Find all files in the classes dir to use as dependencies. This could be more fine granular.
 ALL_FILES_IN_CLASSES := $(shell $(FIND) $(JDK_OUTPUTDIR)/classes -type f \
-			| $(GREP) -v -e '/_the\.*' -e '^_the\.*')
+			| $(GREP) -v -e '/_the\.*' -e '^_the\.*' -e 'javac_state')
 
 RT_JAR_MANIFEST_FILE := $(JDK_OUTPUTDIR)/lib/_the.rt.jar_manifest
 RESOURCE_JAR_MANIFEST_FILE := $(JDK_OUTPUTDIR)/lib/_the.resources.jar_manifest
 
 $(RT_JAR_MANIFEST_FILE): $(MAINMANIFEST) $(BEANMANIFEST)
 	$(MKDIR) -p $(@D)
+	$(RM) $@ $@.tmp
 	$(SED) -e "s#@@RELEASE@@#$(RELEASE)#" 		\
 	       -e "s#@@COMPANY_NAME@@#$(COMPANY_NAME)#" \
-	       $(MAINMANIFEST) >> $@
-	$(ECHO) >> $@
-	$(CAT) $(BEANMANIFEST) >> $@
+	       $(MAINMANIFEST) >> $@.tmp
+	$(ECHO) >> $@.tmp
+	$(CAT) $(BEANMANIFEST) >> $@.tmp
+	$(MV) $@.tmp $@
 
 $(RESOURCE_JAR_MANIFEST_FILE): $(MAINMANIFEST)
 	$(MKDIR) -p $(@D)
+	$(RM) $@ $@.tmp
 	$(SED) -e "s#@@RELEASE@@#$(RELEASE)#" 		\
 	       -e "s#@@COMPANY_NAME@@#$(COMPANY_NAME)#" \
-	       $(MAINMANIFEST) >> $@
+	       $(MAINMANIFEST) >> $@.tmp
+	$(MV) $@.tmp $@
 
 $(JDK_OUTPUTDIR)/lib/_the.jars.exclude: $(MAKEFILE)
 	$(MKDIR) -p $(@D)
-	$(call ListPathsSafely,RT_JAR_EXCLUDES,\n, >> $@)
+	$(RM) $@ $@.tmp
+	$(call ListPathsSafely,RT_JAR_EXCLUDES,\n, >> $@.tmp)
+	$(MV) $@.tmp $@
 
 $(JDK_OUTPUTDIR)/lib/classlist : $(JDK_TOPDIR)/make/tools/sharing/classlist.$(OPENJDK_TARGET_OS) \
   $(MAKEFILE)
 	$(MKDIR) -p $(@D)
-	$(RM) -f $@.temp
-	$(TOOL_ADDJSUM) $< $@.temp
-	$(MV) $@.temp $@
+	$(RM) $@ $@.tmp
+	$(TOOL_ADDJSUM) $< $@.tmp
+	$(MV) $@.tmp $@
 
 $(JDK_OUTPUTDIR)/lib/_the.jars.contents: $(BUILD_TOOLS) $(JDK_OUTPUTDIR)/lib/_the.jars.exclude \
 					 $(ALL_FILES_IN_CLASSES) $(JDK_OUTPUTDIR)/lib/classlist
 	$(MKDIR) -p $(@D)
-	$(RM) $@.temp
+	$(RM) $@ $@.tmp
 	($(CD) $(JDK_OUTPUTDIR)/classes && \
 	    $(TOOL_JARREORDER) \
-		-o  $@.temp $(JDK_OUTPUTDIR)/lib/classlist $(JDK_OUTPUTDIR)/lib/_the.jars.exclude . )
-	$(MV) $@.temp $@
+		-o  $@.tmp $(JDK_OUTPUTDIR)/lib/classlist $(JDK_OUTPUTDIR)/lib/_the.jars.exclude . )
+	$(MV) $@.tmp $@
 
 $(JDK_OUTPUTDIR)/lib/_the.rt.jar.contents: $(JDK_OUTPUTDIR)/lib/_the.jars.contents
-	$(GREP) -e '\.class$$' $(JDK_OUTPUTDIR)/lib/_the.jars.contents > $@
+	$(MKDIR) -p $(@D)
+	$(RM) $@ $@.tmp
+	$(GREP) -e '\.class$$' $(JDK_OUTPUTDIR)/lib/_the.jars.contents > $@.tmp
+	$(MV) $@.tmp $@
 
 $(JDK_OUTPUTDIR)/lib/_the.resources.jar.contents: $(JDK_OUTPUTDIR)/lib/_the.jars.contents
-	$(GREP) -v -e '\.class$$' -e '/_the\.*' -e '^_the\.*' $(JDK_OUTPUTDIR)/lib/_the.jars.contents > $@
+	$(MKDIR) -p $(@D)
+	$(RM) $@ $@.tmp
+	$(GREP) -v -e '\.class$$' \
+	    -e '/_the\.*' -e '^_the\.*' -e '\\_the\.*' -e 'javac_state' \
+	    $(JDK_OUTPUTDIR)/lib/_the.jars.contents > $@.tmp
+	$(MV) $@.tmp $@
 
 RT_JAR_CREATE_OPTIONS := c0fm
 ifeq ($(COMPRESS_JARS), true)
@@ -312,16 +328,22 @@
 
 $(JDK_OUTPUTDIR)/lib/rt.jar: $(JDK_OUTPUTDIR)/lib/_the.rt.jar.contents $(RT_JAR_MANIFEST_FILE)
 	$(ECHO) Creating rt.jar
+	$(MKDIR) -p $(@D)
+	$(RM) $@ $@.tmp
 	$(CD) $(JDK_OUTPUTDIR)/classes && \
-	    $(JAR) $(RT_JAR_CREATE_OPTIONS) $@ $(RT_JAR_MANIFEST_FILE) \
+	    $(JAR) $(RT_JAR_CREATE_OPTIONS) $@.tmp $(RT_JAR_MANIFEST_FILE) \
 	        @$(JDK_OUTPUTDIR)/lib/_the.rt.jar.contents
+	$(MV) $@.tmp $@
 
 $(JDK_OUTPUTDIR)/lib/resources.jar: $(JDK_OUTPUTDIR)/lib/_the.resources.jar.contents \
 				    $(RESOURCE_JAR_MANIFEST_FILE)
 	$(ECHO) Creating resources.jar
+	$(MKDIR) -p $(@D)
+	$(RM) $@ $@.tmp
 	$(CD) $(JDK_OUTPUTDIR)/classes && \
-	    $(JAR) $(RT_JAR_CREATE_OPTIONS) $@ $(RESOURCE_JAR_MANIFEST_FILE) \
+	    $(JAR) $(RT_JAR_CREATE_OPTIONS) $@.tmp $(RESOURCE_JAR_MANIFEST_FILE) \
 	        @$(JDK_OUTPUTDIR)/lib/_the.resources.jar.contents
+	$(MV) $@.tmp $@
 
 JARS+=$(JDK_OUTPUTDIR)/lib/rt.jar $(JDK_OUTPUTDIR)/lib/resources.jar
 
@@ -385,31 +407,30 @@
 
 ##########################################################################################
 
-ifneq ($(OPENJDK_TARGET_OS)-$(ARCH_DATA_MODEL),windows-64)
-    SUNPKCS11_JAR_DST := $(JDK_OUTPUTDIR)/lib/ext/sunpkcs11.jar
+SUNPKCS11_JAR_DST := $(JDK_OUTPUTDIR)/lib/ext/sunpkcs11.jar
 
-    ifndef OPENJDK
+ifndef OPENJDK
+
+    SUNPKCS11_JAR_SRC := $(JDK_TOPDIR)/make/closed/tools/crypto/pkcs11/sunpkcs11.jar
 
-        SUNPKCS11_JAR_SRC := $(JDK_TOPDIR)/make/closed/tools/crypto/pkcs11/sunpkcs11.jar
-
-        $(SUNPKCS11_JAR_DST) : $(SUNPKCS11_JAR_SRC)
-		@$(ECHO) "\n>>>Installing prebuilt SunPKCS11 provider..."
-		$(RM) $@
-		$(CP) $< $@
+    $(SUNPKCS11_JAR_DST) : $(SUNPKCS11_JAR_SRC)
+	@$(ECHO) "\n>>>Installing prebuilt SunPKCS11 provider..."
+	$(MKDIR) -p $(@D)
+	$(RM) $@
+	$(CP) $< $@
 
-    else
+else
 
-         $(eval $(call SetupArchive,BUILD_SUNPKCS11_JAR,$(SUNPKCS11_JAR_DEPS),\
-		SRCS:=$(JDK_OUTPUTDIR)/classes, \
-		SUFFIXES:=.class,\
-		INCLUDES:=sun/security/pkcs11,\
-		JAR:=$(SUNPKCS11_JAR_DST), \
-		SKIP_METAINF := true))
+    $(eval $(call SetupArchive,BUILD_SUNPKCS11_JAR,$(SUNPKCS11_JAR_DEPS),\
+	SRCS:=$(JDK_OUTPUTDIR)/classes, \
+	SUFFIXES:=.class,\
+	INCLUDES:=sun/security/pkcs11,\
+	JAR:=$(SUNPKCS11_JAR_DST), \
+	SKIP_METAINF := true))
 
-    endif
+endif
 
-    JARS += $(SUNPKCS11_JAR_DST)
-endif
+JARS += $(SUNPKCS11_JAR_DST)
 
 ##########################################################################################
 
@@ -421,6 +442,7 @@
 
 $(SUNEC_JAR_DST) : $(SUNEC_JAR_SRC)
 	@$(ECHO) "\n>>>Installing prebuilt SunEC provider..."
+	$(MKDIR) -p $(@D)
 	$(RM) $@
 	$(CP) $< $@
 
@@ -430,12 +452,6 @@
 		SRCS:=$(JDK_OUTPUTDIR)/classes, \
 		SUFFIXES:=.class,\
 		INCLUDES:=sun/security/ec,\
-		EXCLUDE_FILES := sun/security/ec/ECKeyFactory.class \
-			sun/security/ec/ECParameters.class \
-			sun/security/ec/ECPrivateKeyImpl.class \
-			sun/security/ec/ECPublicKeyImpl.class \
-			sun/security/ec/NamedCurve.class \
-			sun/security/ec/ECKeyFactory*,\
 		JAR:=$(SUNEC_JAR_DST), \
 		SKIP_METAINF := true))
 
@@ -465,6 +481,7 @@
 
     $(SUNJCE_PROVIDER_JAR_DST) : $(SUNJCE_PROVIDER_JAR_SRC)
 	@$(ECHO) "\n>>>Installing prebuilt SunJCE provider..."
+	$(MKDIR) -p $(@D)
 	$(RM) $@
 	$(CP) $< $@
 else
@@ -489,6 +506,7 @@
 
 $(JCE_JAR_DST) : $(JCE_JAR_SRC)
 	@$(ECHO) "\n>>>Installing prebuilt jce.jar..."
+	$(MKDIR) -p $(@D)
 	$(RM) $@
 	$(CP) $< $@
 
@@ -520,6 +538,7 @@
 
 $(US_EXPORT_POLICY_JAR_TMP)/% : $(US_EXPORT_POLICY_JAR_SRC_DIR)/%
 	$(MKDIR) -p $(@D)
+	$(RM) $@
 	$(CP) $< $@
 
 US_EXPORT_POLICY_JAR_DEPS := $(US_EXPORT_POLICY_JAR_TMP)/default_US_export.policy
@@ -552,6 +571,7 @@
 
 $(LOCAL_POLICY_JAR_TMP)/% : $(LOCAL_POLICY_JAR_SRC_DIR)/%
 	$(MKDIR) -p $(@D)
+	$(RM) $@
 	$(CP) $< $@
 
 $(eval $(call SetupArchive,BUILD_LOCAL_POLICY_JAR,$(LOCAL_POLICY_JAR_DEPS),\
@@ -576,6 +596,7 @@
 
 $(SUNMSCAPI_JAR_DST) : $(SUNMSCAPI_JAR_SRC)
 	@$(ECHO) "\n>>>Installing prebuilt SunMSCAPI provider..."
+	$(MKDIR) -p $(@D)
 	$(RM) $@
 	$(CP) $< $@
 
@@ -586,9 +607,9 @@
 		SUFFIXES:=.class,\
 		INCLUDES:= sun/security/mscapi,\
 		JAR:=$(SUNMSCAPI_JAR_DST), \
-		MANIFEST := $(JDK_TOPDIR)/make/tools/manifest.mf, \
-		EXTRA_MANIFEST_ATTR := Extension-Name: javax.crypto\nImplementation-Vendor-Id: com.sun, \
-		SKIP_METAINF := true))
+		MANIFEST:=$(JDK_TOPDIR)/make/tools/manifest.mf, \
+		EXTRA_MANIFEST_ATTR:=Extension-Name: javax.crypto\nImplementation-Vendor-Id: com.sun, \
+		SKIP_METAINF:=true))
 endif
 
 JARS += $(SUNMSCAPI_JAR_DST)
@@ -605,6 +626,7 @@
 
 $(UCRYPTO_JAR_DST) : $(UCRYPTO_JAR_SRC)
 	@$(ECHO) "\n>>>Installing prebuilt OracleUcrypto provider..."
+	$(MKDIR) -p $(@D)
 	$(RM) $@
 	$(CP) $< $@
 
@@ -711,8 +733,8 @@
 
 ##########################################################################################
 
-include $(JDK_TOPDIR)/makefiles/docs/CORE_PKGS.gmk
-include $(JDK_TOPDIR)/makefiles/docs/NON_CORE_PKGS.gmk
+include javadoc/CORE_PKGS.gmk
+include javadoc/NON_CORE_PKGS.gmk
 
 # The compiler should not issue a "Proprietary" warning when compiling
 # classes in the com.sun.java.swing.plaf packages, since we've always
@@ -740,7 +762,7 @@
                         com.oracle.nio
 
 $(IMAGES_OUTPUTDIR)/symbols/_the.symbols: $(JDK_OUTPUTDIR)/lib/rt.jar
-	$(RM) -rf $(IMAGES_OUTPUTDIR)/symbols/META-INF/sym
+	$(RM) -r $(IMAGES_OUTPUTDIR)/symbols/META-INF/sym
 	$(MKDIR) -p $(IMAGES_OUTPUTDIR)/symbols/META-INF/sym
 	$(JAVA) \
 		-Xbootclasspath/a:$(JDK_OUTPUTDIR)/classes \
@@ -808,9 +830,10 @@
 	org/ietf			\
 	org/omg				\
 	org/w3c/dom			\
-	org/xml/sax
+	org/xml/sax			\
+	sunw
 
-SRC_ZIP_SRCS = $(JDK_TOPDIR)/src/share/classes $(JDK_TOPDIR)/src/$(LEGACY_OPENJDK_TARGET_OS_API)/classes
+SRC_ZIP_SRCS = $(JDK_TOPDIR)/src/share/classes $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/classes
 SRC_ZIP_SRCS += $(JDK_OUTPUTDIR)/gensrc
 SRC_ZIP_SRCS += $(JDK_OUTPUTDIR)/impsrc
 SRC_ZIP_SRCS += $(JDK_OUTPUTDIR)/gendocsrc_rmic
@@ -821,17 +844,19 @@
 # Need to copy launcher src files into desired directory structure
 # before zipping the sources.
 LAUNCHER_SRC_FILES := $(wildcard $(JDK_TOPDIR)/src/share/bin/*) \
-                      $(wildcard $(JDK_TOPDIR)/src/$(LEGACY_OPENJDK_TARGET_OS_API)/bin/java_md*)
+                      $(wildcard $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/bin/java_md*)
 LAUNCHER_ZIP_SRC := $(patsubst $(JDK_TOPDIR)/src/share/bin/%,$(IMAGES_OUTPUTDIR)/src/launcher/%,\
-		    $(patsubst $(JDK_TOPDIR)/src/$(LEGACY_OPENJDK_TARGET_OS_API)/bin/%,$(IMAGES_OUTPUTDIR)/src/launcher/%,\
+		    $(patsubst $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/bin/%,$(IMAGES_OUTPUTDIR)/src/launcher/%,\
 			$(LAUNCHER_SRC_FILES)))
 
 $(IMAGES_OUTPUTDIR)/src/launcher/%: $(JDK_TOPDIR)/src/share/bin/%
 	$(MKDIR) -p $(@D)
+	$(RM) $@
 	$(CP) $< $@
 
-$(IMAGES_OUTPUTDIR)/src/launcher/%: $(JDK_TOPDIR)/src/$(LEGACY_OPENJDK_TARGET_OS_API)/bin/%
+$(IMAGES_OUTPUTDIR)/src/launcher/%: $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/bin/%
 	$(MKDIR) -p $(@D)
+	$(RM) $@
 	$(CP) $< $@
 
 $(IMAGES_OUTPUTDIR)/src.zip: $(LAUNCHER_ZIP_SRC)
@@ -849,6 +874,10 @@
 
 ##########################################################################################
 
+-include $(CUSTOM_MAKE_DIR)/CreateJars.gmk
+
+##########################################################################################
+
 all: $(JARS)
 
 .PHONY: default all
--- a/jdk/makefiles/GendataBreakIterator.gmk	Wed Jul 05 18:22:17 2017 +0200
+++ b/jdk/makefiles/GendataBreakIterator.gmk	Wed Jul 05 18:22:52 2017 +0200
@@ -48,10 +48,12 @@
 # two files in that directory and not get anything implicit from
 # surrounding directories which aren't jdk 6 compatible. 
 # Because we are targeting jdk 6, but the surrounding source code is jdk 7. Ugh.
-# These two files should be moved out to a build tool!
+# These two files should be moved out to a build tool! We have to disable
+# sjavac here as well.
 $(eval $(call SetupJavaCompilation,BUILD_BREAKITERATOR,\
 		SETUP:=GENERATE_OLDBYTECODE,\
 		SRC:=$(TEXT_SRCDIR),\
+		DISABLE_SJAVAC:=true,\
 		JAVAC_SOURCE_PATH_UGLY_OVERRIDE:=$(TEXT_SRCDIR)/$(TEXT_PKG),\
 		INCLUDES:=$(TEXT_PKG),\
 		INCLUDE_FILES:=$(TEXT_SOURCES),\
@@ -70,23 +72,23 @@
 BIFILES_TH =	$(DATA_PKG_DIR)/th/WordBreakIteratorData_th \
 		$(DATA_PKG_DIR)/th/LineBreakIteratorData_th
 
-$(BIFILES): $(BREAK_ITERATOR_DIR)/_the.bifiles
-$(BREAK_ITERATOR_DIR)/_the.bifiles: JAVA_FLAGS += -Xbootclasspath/p:$(BREAK_ITERATOR_CLASSES)
-$(BREAK_ITERATOR_DIR)/_the.bifiles: $(BUILD_TOOLS) $(UNICODEDATA) $(BUILD_BREAKITERATOR)
+$(BIFILES): $(DATA_PKG_DIR)/_the.bifiles
+$(DATA_PKG_DIR)/_the.bifiles: JAVA_FLAGS += -Xbootclasspath/p:$(BREAK_ITERATOR_CLASSES)
+$(DATA_PKG_DIR)/_the.bifiles: $(BUILD_TOOLS) $(UNICODEDATA) $(BUILD_BREAKITERATOR)
 	$(ECHO) "Generating BreakIteratorData"
 	$(MKDIR) -p  $(DATA_PKG_DIR)
-	$(RM) -f $(BIFILES)
+	$(RM) $(BIFILES)
 	$(TOOL_GENERATEBREAKITERATORDATA) \
 		-o $(DATA_PKG_DIR) \
 		-spec $(UNICODEDATA)
 	$(TOUCH) $@
 
-$(BIFILES_TH): $(BREAK_ITERATOR_DIR)/_the.bifiles_th
-$(BREAK_ITERATOR_DIR)/_the.bifiles_th: JAVA_FLAGS += -Xbootclasspath/p:$(BREAK_ITERATOR_CLASSES)
-$(BREAK_ITERATOR_DIR)/_the.bifiles_th: $(BUILD_TOOLS) $(UNICODEDATA) $(BUILD_BREAKITERATOR)
+$(BIFILES_TH): $(DATA_PKG_DIR)/_the.bifiles_th
+$(DATA_PKG_DIR)/_the.bifiles_th: JAVA_FLAGS += -Xbootclasspath/p:$(BREAK_ITERATOR_CLASSES)
+$(DATA_PKG_DIR)/_the.bifiles_th: $(BUILD_TOOLS) $(UNICODEDATA) $(BUILD_BREAKITERATOR)
 	$(ECHO) "Generating BreakIteratorData_th"
 	$(MKDIR) -p  $(DATA_PKG_DIR)/th
-	$(RM) -f $(BIFILES_TH)
+	$(RM) $(BIFILES_TH)
 	$(TOOL_GENERATEBREAKITERATORDATA) \
 		-o $(DATA_PKG_DIR) \
 		-spec $(UNICODEDATA) \
--- a/jdk/makefiles/GendataFontConfig.gmk	Wed Jul 05 18:22:17 2017 +0200
+++ b/jdk/makefiles/GendataFontConfig.gmk	Wed Jul 05 18:22:52 2017 +0200
@@ -26,53 +26,61 @@
 GENDATA_FONT_CONFIG_DST := $(JDK_OUTPUTDIR)/lib
 
 ifeq ($(OPENJDK_TARGET_OS), windows)
-GENDATA_FONT_CONFIG_SRC_DIR    := $(JDK_TOPDIR)/src/windows/classes/sun/awt/windows
-GENDATA_FONT_CONFIG_SRC_FILES  := fontconfig.properties
-GENDATA_FONT_CONFIG_SRC_PREFIX := 
+  GENDATA_FONT_CONFIG_SRC_DIR    := $(JDK_TOPDIR)/src/windows/classes/sun/awt/windows
+  GENDATA_FONT_CONFIG_SRC_FILES  := fontconfig.properties
+  GENDATA_FONT_CONFIG_SRC_PREFIX := 
 endif
 
 ifeq ($(OPENJDK_TARGET_OS), linux)
-GENDATA_FONT_CONFIG_SRC_PREFIX := linux.
-ifdef OPENJDK
-GENDATA_FONT_CONFIG_SRC_DIR   := $(JDK_TOPDIR)/src/solaris/classes/sun/awt/fontconfigs
-GENDATA_FONT_CONFIG_SRC_FILES := \
+  GENDATA_FONT_CONFIG_SRC_PREFIX := linux.
+  ifdef OPENJDK
+    GENDATA_FONT_CONFIG_SRC_DIR   := \
+        $(JDK_TOPDIR)/src/solaris/classes/sun/awt/fontconfigs
+    GENDATA_FONT_CONFIG_SRC_FILES := \
 	fontconfig.properties \
 	fontconfig.SuSE.properties \
 	fontconfig.Ubuntu.properties \
 	fontconfig.Fedora.properties
-else
-GENDATA_FONT_CONFIG_SRC_DIR   := $(JDK_TOPDIR)/src/closed/solaris/classes/sun/awt/fontconfigs
-GENDATA_FONT_CONFIG_SRC_FILES := \
+  else
+    GENDATA_FONT_CONFIG_SRC_DIR   := \
+        $(JDK_TOPDIR)/src/closed/solaris/classes/sun/awt/fontconfigs
+    GENDATA_FONT_CONFIG_SRC_FILES := \
 	fontconfig.properties				\
 	fontconfig.RedHat.5.properties			\
 	fontconfig.RedHat.6.properties			\
 	fontconfig.Turbo.properties			\
 	fontconfig.SuSE.10.properties                   \
 	fontconfig.SuSE.11.properties
-endif
+  endif
 endif
 
 ifeq ($(OPENJDK_TARGET_OS), solaris)
-GENDATA_FONT_CONFIG_SRC_DIR    := $(JDK_TOPDIR)/src/solaris/classes/sun/awt/fontconfigs
-GENDATA_FONT_CONFIG_SRC_FILES  := fontconfig.properties
-GENDATA_FONT_CONFIG_SRC_PREFIX := solaris.
+  GENDATA_FONT_CONFIG_SRC_DIR    := \
+      $(JDK_TOPDIR)/src/solaris/classes/sun/awt/fontconfigs
+  GENDATA_FONT_CONFIG_SRC_FILES  := fontconfig.properties
+  GENDATA_FONT_CONFIG_SRC_PREFIX := solaris.
 endif
 
 ifeq ($(OPENJDK_TARGET_OS), macosx)
-GENDATA_FONT_CONFIG_SRC_DIR    := $(JDK_TOPDIR)/src/macosx/classes/sun/awt/fontconfigs
-GENDATA_FONT_CONFIG_SRC_FILES  := fontconfig.properties
-GENDATA_FONT_CONFIG_SRC_PREFIX := macosx.
-endif # OPENJDK_TARGET_OS
+  GENDATA_FONT_CONFIG_SRC_DIR    := \
+      $(JDK_TOPDIR)/src/macosx/classes/sun/awt/fontconfigs
+  GENDATA_FONT_CONFIG_SRC_FILES  := fontconfig.properties
+  GENDATA_FONT_CONFIG_SRC_PREFIX := macosx.
+endif
 
 ###
 
-$(GENDATA_FONT_CONFIG_DST)/%.src : $(GENDATA_FONT_CONFIG_SRC_DIR)/$(GENDATA_FONT_CONFIG_SRC_PREFIX)%
+$(GENDATA_FONT_CONFIG_DST)/%.src : \
+    $(GENDATA_FONT_CONFIG_SRC_DIR)/$(GENDATA_FONT_CONFIG_SRC_PREFIX)%
+	$(RM) $@
 	$(MKDIR) -p $(@D)
 	$(CP) $< $@
 	$(CHMOD) 644 $@
 
-$(GENDATA_FONT_CONFIG_DST)/%.bfc : $(GENDATA_FONT_CONFIG_SRC_DIR)/$(GENDATA_FONT_CONFIG_SRC_PREFIX)%.properties
+$(GENDATA_FONT_CONFIG_DST)/%.bfc : \
+    $(GENDATA_FONT_CONFIG_SRC_DIR)/$(GENDATA_FONT_CONFIG_SRC_PREFIX)%.properties
 	$(MKDIR) -p $(@D)
+	$(RM) $@
 	$(TOOL_COMPILEFONTCONFIG) $< $@
 	$(CHMOD) 444 $@
 
@@ -84,3 +92,4 @@
 GENDATA_FONT_CONFIG := $(GENDATA_FONT_CONFIGS) $(GENDATA_BFONT_CONFIGS)
 
 ###
+
--- a/jdk/makefiles/GendataTimeZone.gmk	Wed Jul 05 18:22:17 2017 +0200
+++ b/jdk/makefiles/GendataTimeZone.gmk	Wed Jul 05 18:22:52 2017 +0200
@@ -46,9 +46,9 @@
 GENDATA_TIMEZONE_MAPFILE:=ZoneInfoMappings
 
 $(GENDATA_TIMEZONE_DST)/$(GENDATA_TIMEZONE_MAPFILE) : $(TZFILES)
-	$(RM) -rf $(GENDATA_TIMEZONE_TMP)
+	$(RM) -r $(GENDATA_TIMEZONE_TMP)
 	$(MKDIR) -p $(GENDATA_TIMEZONE_TMP)
-	$(RM) -rf $(GENDATA_TIMEZONE_DST)
+	$(RM) -r $(GENDATA_TIMEZONE_DST)
 	$(MKDIR) -p $(GENDATA_TIMEZONE_DST)
 	$(TOOL_JAVAZIC) -V "$(GENDATA_TIMEZONE_VERSION)" -d $(GENDATA_TIMEZONE_TMP) $(TZFILES)
 	$(CP) -r $(GENDATA_TIMEZONE_TMP)/* $(GENDATA_TIMEZONE_DST)/
--- a/jdk/makefiles/GenerateClasses.gmk	Wed Jul 05 18:22:17 2017 +0200
+++ b/jdk/makefiles/GenerateClasses.gmk	Wed Jul 05 18:22:52 2017 +0200
@@ -31,7 +31,7 @@
 
 # To ensure the latest stub generator files are picked up from corba repo
 # when available, we need to run with latest rmic version available. 
-ifeq ($(CROSS_COMPILE_ARCH),)
+ifneq ($(COMPILE_TYPE),cross)
     RMIC := $(UNCYGDRIVE) $(JDK_OUTPUTDIR)/bin/rmic
 endif  
 
--- a/jdk/makefiles/GenerateData.gmk	Wed Jul 05 18:22:17 2017 +0200
+++ b/jdk/makefiles/GenerateData.gmk	Wed Jul 05 18:22:52 2017 +0200
@@ -67,8 +67,8 @@
 $(GENDATA_CURDATA): $(JDK_TOPDIR)/src/share/classes/java/util/CurrencyData.properties $(BUILD_TOOLS)
 	$(MKDIR) -p $(@D)
 	$(RM) $@
-	$(TOOL_GENERATECURRENCYDATA) -o $@.temp < $<
-	$(MV) $@.temp $@
+	$(TOOL_GENERATECURRENCYDATA) -o $@.tmp < $<
+	$(MV) $@.tmp $@
 	$(CHMOD) 444 $@
 
 GENDATA += $(GENDATA_CURDATA)
@@ -77,6 +77,9 @@
 
 $(GENDATA) : $(BUILD_TOOLS)
 
-all: $(GENDATA)
+$(JDK_OUTPUTDIR)/classes/_the.gendata : $(GENDATA)
+	$(TOUCH) $@
+
+all: $(JDK_OUTPUTDIR)/classes/_the.gendata
 
 .PHONY: all
--- a/jdk/makefiles/GensrcBuffer.gmk	Wed Jul 05 18:22:17 2017 +0200
+++ b/jdk/makefiles/GensrcBuffer.gmk	Wed Jul 05 18:22:52 2017 +0200
@@ -226,7 +226,7 @@
 	endif
 
 $$($1_DST) : $$($1_DEP) $(GENSRC_BUFFER_DST)/_the.dir
-	$(TOOL_SPP) < $$($1_SRC) > $$($1_OUT).temp \
+	$(TOOL_SPP) < $$($1_SRC) > $$($1_OUT).tmp \
 		-K$$($1_type) \
 		-K$$($1_category) \
 		-Dtype=$$($1_type) \
@@ -248,19 +248,19 @@
 		-Da=$$($1_a) \
 		-DA=$$($1_A) \
 		-Kbo$$($1_BO)
-		$(MV) $$($1_OUT).temp $$($1_OUT)
+		$(MV) $$($1_OUT).tmp $$($1_OUT)
 # Do the extra bin thing
 ifeq ($$($1_BIN),1)
-	$(SED) -e '/#BIN/,$$$$d' < $$($1_OUT) > $$($1_DST).temp
+	$(SED) -e '/#BIN/,$$$$d' < $$($1_OUT) > $$($1_DST).tmp
 	$(RM) $$($1_OUT)
-	$$($1_char_CMD) < $$($1_SRC_BIN) >> $$($1_DST).temp
-	$$($1_short_CMD) < $$($1_SRC_BIN) >> $$($1_DST).temp
-	$$($1_int_CMD) < $$($1_SRC_BIN) >> $$($1_DST).temp
-	$$($1_long_CMD) < $$($1_SRC_BIN) >> $$($1_DST).temp
-	$$($1_float_CMD) < $$($1_SRC_BIN) >> $$($1_DST).temp
-	$$($1_double_CMD) < $$($1_SRC_BIN) >> $$($1_DST).temp
-	$(PRINTF) "}\n" >> $$($1_DST).temp
-	mv $$($1_DST).temp $$($1_DST)
+	$$($1_char_CMD) < $$($1_SRC_BIN) >> $$($1_DST).tmp
+	$$($1_short_CMD) < $$($1_SRC_BIN) >> $$($1_DST).tmp
+	$$($1_int_CMD) < $$($1_SRC_BIN) >> $$($1_DST).tmp
+	$$($1_long_CMD) < $$($1_SRC_BIN) >> $$($1_DST).tmp
+	$$($1_float_CMD) < $$($1_SRC_BIN) >> $$($1_DST).tmp
+	$$($1_double_CMD) < $$($1_SRC_BIN) >> $$($1_DST).tmp
+	$(PRINTF) "}\n" >> $$($1_DST).tmp
+	mv $$($1_DST).tmp $$($1_DST)
 endif
 
 GENSRC_BUFFER += $$($1_DST)
--- a/jdk/makefiles/GensrcCharsetCoder.gmk	Wed Jul 05 18:22:17 2017 +0200
+++ b/jdk/makefiles/GensrcCharsetCoder.gmk	Wed Jul 05 18:22:52 2017 +0200
@@ -36,8 +36,8 @@
 
 $(GENSRC_CHARSETCODER_DST)/CharsetDecoder.java : $(GENSRC_CHARSETCODER_TEMPLATE)
 	$(MKDIR) -p $(@D)
-	-$(RM) $@.temp
-	$(TOOL_SPP) < $< >$@.temp \
+	-$(RM) $@.tmp
+	$(TOOL_SPP) < $< >$@.tmp \
 		-Kdecoder \
 		-DA='A' \
 		-Da='a' \
@@ -63,7 +63,7 @@
 		-DnotLegal='not legal for this charset' \
 		-Dotypes-per-itype='chars-per-byte' \
 		-DoutSequence='Unicode character'
-	$(MV) $@.temp $@
+	$(MV) $@.tmp $@
 
 GENSRC_CHARSETCODER += $(GENSRC_CHARSETCODER_DST)/CharsetDecoder.java
 
@@ -71,8 +71,8 @@
 
 $(GENSRC_CHARSETCODER_DST)/CharsetEncoder.java : $(GENSRC_CHARSETCODER_TEMPLATE)
 	$(MKDIR) -p $(@D)
-	-$(RM) $@.temp
-	$(TOOL_SPP) < $< >$@.temp \
+	-$(RM) $@.tmp
+	$(TOOL_SPP) < $< >$@.tmp \
 		-Kencoder \
 		-DA='An' \
 		-Da='an' \
@@ -98,7 +98,7 @@
 		-DnotLegal='not a legal sixteen-bit Unicode sequence' \
 		-Dotypes-per-itype='bytes-per-char' \
 		-DoutSequence='byte sequence in the given charset'
-	$(MV) $@.temp $@
+	$(MV) $@.tmp $@
 
 GENSRC_CHARSETCODER += $(GENSRC_CHARSETCODER_DST)/CharsetEncoder.java
 
--- a/jdk/makefiles/GensrcIcons.gmk	Wed Jul 05 18:22:17 2017 +0200
+++ b/jdk/makefiles/GensrcIcons.gmk	Wed Jul 05 18:22:52 2017 +0200
@@ -29,7 +29,7 @@
 GENSRC_ICONS_DST := $(GENSRC_ICONS_TMP)/sun/awt/X11
 
 ifdef OPENJDK
-	ICONS_PATH_PREFIX := $(JDK_TOPDIR)/src/$(LEGACY_OPENJDK_TARGET_OS_API)
+	ICONS_PATH_PREFIX := $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)
 else
 	ICONS_PATH_PREFIX := $(JDK_TOPDIR)/src/closed/solaris
 endif
@@ -41,7 +41,7 @@
     $(ICONS_PATH_PREFIX)/classes/sun/awt/X11/java-icon48.png
 
 
-ICONPATH := $(JDK_TOPDIR)/src/$(LEGACY_OPENJDK_TARGET_OS_API)/classes/sun/awt/X11
+ICONPATH := $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/classes/sun/awt/X11
 
 GENSRC_ICONS_SRC += \
    $(ICONPATH)/security-icon-bw16.png \
@@ -85,10 +85,7 @@
 	$(ECHO) "package sun.awt.X11;" > $$@.tmp
 	$(ECHO) "public class $$($1_NAME32) {" >> $$@.tmp
 	$(ECHO) "public static int[] $$($1_SHORTNAME) = { " >> $$@.tmp
-# TODO FIX FIX FIX
-ifneq ($(OPENJDK_TARGET_OS),macosx)
 	$(CAT) $$< | $(TOOL_TOBIN) >> $$@.tmp
-endif
 	$(ECHO) "}; }" >> $$@.tmp
 	$(MV) $$@.tmp $$@
 
@@ -99,10 +96,7 @@
 	$(ECHO) "package sun.awt.X11;" > $$@.tmp
 	$(ECHO) "public class $$($1_NAME64) {" >> $$@.tmp
 	$(ECHO) "public static long[] $$($1_SHORTNAME) = { " >> $$@.tmp
-# TODO FIX FIX FIX
-ifneq ($(OPENJDK_TARGET_OS),macosx)
 	$(CAT) $$< | $(TOOL_TOBIN) >> $$@.tmp
-endif
 	$(ECHO) "}; }" >> $$@.tmp
 	$(MV) $$@.tmp $$@
 
--- a/jdk/makefiles/GensrcJDWP.gmk	Wed Jul 05 18:22:17 2017 +0200
+++ b/jdk/makefiles/GensrcJDWP.gmk	Wed Jul 05 18:22:52 2017 +0200
@@ -31,8 +31,17 @@
 $(JDK_OUTPUTDIR)/gensrc_jdwp/com/sun/tools/jdi/JDWP.java : $(JDK_TOPDIR)/makefiles/jpda/jdwp/jdwp.spec
 	$(MKDIR) -p $(@D)
 	$(MKDIR) -p $(JDK_OUTPUTDIR)/gensrc_jdwp_headers
+	$(RM) $@ $(JDK_OUTPUTDIR)/gensrc_jdwp_headers/JDWPCommands.h
 	$(ECHO) Creating JDWP.java and JDWPCommands.h from jdwp.spec
 	$(TOOL_JDWPGEN) $< -jdi $@ -include $(JDK_OUTPUTDIR)/gensrc_jdwp_headers/JDWPCommands.h
 
+$(JDK_OUTPUTDIR)/gensrc_jdwp_doc/jdwp-protocol.html : $(JDK_TOPDIR)/makefiles/jpda/jdwp/jdwp.spec
+	$(MKDIR) -p $(@D)
+	$(RM) $@
+	$(ECHO) Creating $(@F) from jdwp.spec
+	$(TOOL_JDWPGEN) $< -doc $@
+
 GENSRC_JDWP:=	$(JDK_OUTPUTDIR)/gensrc_jdwp/com/sun/tools/jdi/JDWP.java \
-		$(JDK_OUTPUTDIR)/gensrc_jdwp_headers/JDWPCommands.h
+		$(JDK_OUTPUTDIR)/gensrc_jdwp_headers/JDWPCommands.h \
+		$(JDK_OUTPUTDIR)/gensrc_jdwp_doc/jdwp-protocol.html
+
--- a/jdk/makefiles/GensrcJObjC.gmk	Wed Jul 05 18:22:17 2017 +0200
+++ b/jdk/makefiles/GensrcJObjC.gmk	Wed Jul 05 18:22:52 2017 +0200
@@ -38,43 +38,71 @@
 #
 $(eval $(call SetupJavaCompilation,BUILD_JOBJC_PRIMITIVE_CODER,\
 		SETUP:=GENERATE_OLDBYTECODE,\
+		DISABLE_SJAVAC:=true,\
 		INCLUDES:=core/java \
                           com/apple,\
-                HEADERS :=$(JOBJC_DST)/jni_headers/core ,\
+                HEADERS:=$(JOBJC_DST)/jni_headers/core ,\
 		SRC:=$(JOBJC_SRC)/src \
                      $(JOBJC_SRC)/src/generator/java, \
 		BIN:=$(JOBJC_TMP)/bin))
 
-GENSRC_JOBJC += $(JOBJC_TMP)/bin/_the.batch
+GENSRC_JOBJC += $(BUILD_JOBJC_PRIMITIVE_CODER)
 
 #
-# Generate bridge support
+# Generate bridge support for select frameworks
 #
 BRIDGESUPPORT := $(addprefix $(JOBJC_TMP)/bridge/,$(addsuffix Full.bridgesupport,$(JOBJC_FRAMEWORKS)))
 
-$(JOBJC_TMP)/bridge/%Full.bridgesupport : $(FRAMEWORKS_DIR)/%.framework/Headers/*.h
-	$(MKDIR) -p $(@D)
-	if [ -f $(FRAMEWORKS_DIR)/$*.framework/Resources/BridgeSupport/$(@F) ]; then \
-		cp $(FRAMEWORKS_DIR)/$*.framework/Resources/BridgeSupport/$(@F) $@ ;\
-	else \
-		$(GBM) -F complete --framework $* -o $@ ; \
-	fi
+#
+# Define macro for rules to create bridge support
+#    Not sure why, but if the system has this framework bridge support,
+#    we appear to copy that, otherwise we run GBM which can be very slow.
+#
+define CreateBridgeSupport # Framework
+$(RM) $@ $@.tmp
+$(MKDIR) -p $(@D)
+if [ -f $(FRAMEWORKS_DIR)/$1.framework/Resources/BridgeSupport/$(@F) ]; then \
+    $(CP) $(FRAMEWORKS_DIR)/$1.framework/Resources/BridgeSupport/$(@F) $@.tmp ;\
+else \
+    $(GBM) -F complete --framework $1 -o $@.tmp ; \
+fi
+$(MV) $@.tmp $@
+endef
 
 #
-# Find Xbootclasspath
+# Currently 3 frameworks, avoid pattern rule due to the names being conflicting
 #
-$(JOBJC_TMP)/_the.generator_bootclasspath : $(JOBJC_TMP)/bin/_the.batch
+$(JOBJC_TMP)/bridge/FoundationFull.bridgesupport : \
+		$(wildcard $(FRAMEWORKS_DIR)/Foundation.framework/Headers/*.h)
+	$(call CreateBridgeSupport,Foundation)
+$(JOBJC_TMP)/bridge/CoreFoundationFull.bridgesupport : \
+		$(wildcard $(FRAMEWORKS_DIR)/CoreFoundation.framework/Headers/*.h)
+	$(call CreateBridgeSupport,CoreFoundation)
+$(JOBJC_TMP)/bridge/AppKitFull.bridgesupport : \
+		$(wildcard $(FRAMEWORKS_DIR)/AppKit.framework/Headers/*.h)
+	$(call CreateBridgeSupport,AppKit)
+
+#
+# Find Xbootclasspath, for some reason, this involves firing up Java just
+#     so we can get the boot classpath, so we can remove anything in that
+#     classpath that ends with "JObjC.jar", and emit the new bootclasspath.
+#
+$(JOBJC_TMP)/_the.generator_bootclasspath : $(BUILD_JOBJC_PRIMITIVE_CODER)
+	$(RM) $@
 	$(JAVA) -cp $(JOBJC_TMP)/bin com.apple.internal.jobjc.generator.BootClassPathMinus JObjC.jar > $@.tmp
 	$(MV) $@.tmp $@
 
-
 #
 # Run generator
+#    Now we use bootclasspath to run java again, with the bridge support to
+#    generate more source.
+#    Note the use of the | (order-only) on the BRIDGESUPPORT, should serialize
+#    them just in case GBM run in parallel has issues.
 #
-TOOL_JOBJC := $(JAVA) -cp $(JOBJC_TMP)/bin -ea com.apple.internal.jobjc.generator.Generator
-
-$(JOBJC_TMP)/_the.generator : $(JOBJC_TMP)/bin/_the.batch $(JOBJC_TMP)/_the.generator_bootclasspath $(BRIDGESUPPORT)
+$(JOBJC_TMP)/_the.generator : $(JOBJC_TMP)/_the.generator_bootclasspath | $(BRIDGESUPPORT)
+	$(RM) $@
 	$(JAVA) -d64 -Xbootclasspath:`$(CAT) $(JOBJC_TMP)/_the.generator_bootclasspath` -cp $(JOBJC_TMP)/bin -ea com.apple.internal.jobjc.generator.Generator dst=$(JOBJC_DST) frameworks=$(JOBJC_TMP)/bridge
 	$(TOUCH) $@
 
 GENSRC_JOBJC += $(JOBJC_TMP)/_the.generator
+
--- a/jdk/makefiles/GensrcMisc.gmk	Wed Jul 05 18:22:17 2017 +0200
+++ b/jdk/makefiles/GensrcMisc.gmk	Wed Jul 05 18:22:52 2017 +0200
@@ -31,12 +31,14 @@
 $(JDK_OUTPUTDIR)/gensrc_misc/sun/misc/Version.java: \
 	$(JDK_TOPDIR)/src/share/classes/sun/misc/Version.java.template
 	$(MKDIR) -p $(@D)
+	$(RM) $@ $@.tmp
 	$(ECHO) Generating sun/misc/Version.java
 	$(SED) -e 's/@@launcher_name@@/$(LAUNCHER_NAME)/g' \
 	       -e 's/@@java_version@@/$(RELEASE)/g' \
 	       -e 's/@@java_runtime_version@@/$(FULL_VERSION)/g' \
 	       -e 's/@@java_runtime_name@@/$(RUNTIME_NAME)/g' \
-            $< > $@
+            $< > $@.tmp
+	$(MV) $@.tmp $@
 
 GENSRC_MISC += $(JDK_OUTPUTDIR)/gensrc_misc/sun/misc/Version.java
 
@@ -46,8 +48,10 @@
 $(JDK_OUTPUTDIR)/gensrc_misc/sun/tools/jconsole/Version.java: \
                 $(JDK_TOPDIR)/src/share/classes/sun/tools/jconsole/Version.java.template
 	$(MKDIR) -p $(@D)
+	$(RM) $@ $@.tmp
 	$(ECHO) Generating sun/tools/jconsole/Version.java
-	$(SED) -e 's/@@jconsole_version@@/$(FULL_VERSION)/g' $< > $@
+	$(SED) -e 's/@@jconsole_version@@/$(FULL_VERSION)/g' $< > $@.tmp
+	$(MV) $@.tmp $@
 
 GENSRC_MISC += $(JDK_OUTPUTDIR)/gensrc_misc/sun/tools/jconsole/Version.java
 
@@ -80,12 +84,14 @@
 
     $(JDK_OUTPUTDIR)/gensrc_c/libjdbcodbc/dummyodbc1.c : 
 	$(MKDIR) -p $(@D)
+	$(RM) $@
 	$(ECHO) Creating $@
 	$(PRINTF) "void dummyOdbc(void){}\n" > $@
 	$(ECHO) Created $@
 
     $(JDK_OUTPUTDIR)/gensrc_c/libjdbcodbc/dummyodbc2.c : 
 	$(MKDIR) -p $(@D)
+	$(RM) $@
 	$(ECHO) Creating $@
 	$(PRINTF) "void dummyOdbc(void){}\n" > $@
 	$(ECHO) Created $@
@@ -110,21 +116,27 @@
 		SRC:=$(GENSRC_SOR_SRC),\
 		INCLUDE_FILES:=$(GENSRC_SOR_SRC_FILE),\
 		LANG:=C,\
-		CC:=$(HOST_CC),\
-		LDEXE:=$(HOST_LD),\
+		CC:=$(BUILD_CC),\
+		LDEXE:=$(BUILD_LD),\
 		OBJECT_DIR:=$(GENSRC_SOR_BIN),\
 		OUTPUT_DIR:=$(GENSRC_SOR_BIN),\
                 PROGRAM:=genSocketOptionRegistry))
 
-ifneq ($(JAVASE_EMBEDDED), true)
+ifneq ($(wildcard $(JDK_TOPDIR)/src/closed/solaris/classes/sun/nio/ch/SocketOptionRegistry-$(OPENJDK_TARGET_OS)-$(OPENJDK_TARGET_CPU_ARCH).java),)
+  HAS_SOCKET_OPTION_REGISTRY:=true
+endif
+
+ifneq ($(HAS_SOCKET_OTION_REGISTRY),true)
 $(JDK_OUTPUTDIR)/gensrc_misc/sun/nio/ch/SocketOptionRegistry.java : $(BUILD_GENSRC_SOR_EXE)
 	$(MKDIR) -p $(@D)
+	$(RM) $@ $@.tmp
 	NAWK="$(NAWK)" SH="$(SH)" $(SH) -e $(JDK_TOPDIR)/makefiles/scripts/addNotices.sh "$(SOR_COPYRIGHT_YEARS)" > $@.tmp
 	$(BUILD_GENSRC_SOR_EXE) >> $@.tmp
 	$(MV) $@.tmp $@
 else
 $(JDK_OUTPUTDIR)/gensrc_misc/sun/nio/ch/SocketOptionRegistry.java : $(JDK_TOPDIR)/src/closed/solaris/classes/sun/nio/ch/SocketOptionRegistry-$(OPENJDK_TARGET_OS)-$(OPENJDK_TARGET_CPU_ARCH).java
 	$(MKDIR) -p $(@D)
+	$(RM) $@
 	$(CP) $< $@
 endif
 
@@ -134,7 +146,7 @@
 
 GENSRC_MISC += $(JDK_OUTPUTDIR)/gensrc_misc/sun/nio/fs/UnixConstants.java
 
-GENSRC_UC_SRC := $(JDK_TOPDIR)/src/$(LEGACY_OPENJDK_TARGET_OS_API)/native/sun/nio/fs
+GENSRC_UC_SRC := $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/nio/fs
 GENSRC_UC_SRC_FILE := genUnixConstants.c
 GENSRC_UC_BIN := $(JDK_OUTPUTDIR)/gensrc_misc/genUnixConstants
 
@@ -145,21 +157,27 @@
 		SRC:=$(GENSRC_UC_SRC),\
 		INCLUDE_FILES:=$(GENSRC_UC_SRC_FILE),\
 		LANG:=C,\
-		CC:=$(HOST_CC),\
-		LDEXE:=$(HOST_CC),\
+		CC:=$(BUILD_CC),\
+		LDEXE:=$(BUILD_CC),\
 		OBJECT_DIR:=$(GENSRC_UC_BIN),\
                 OUTPUT_DIR:=$(GENSRC_UC_BIN),\
 		PROGRAM:=genUnixConstants))
 
-ifneq ($(JAVASE_EMBEDDED), true)
+ifneq ($(wildcard $(JDK_TOPDIR)/src/closed/solaris/classes/sun/nio/fs/UnixConstants-$(OPENJDK_TARGET_OS)-$(OPENJDK_TARGET_CPU_ARCH).java),)
+  HAS_UNIX_CONSTANTS:=true
+endif
+
+ifneq ($(HAS_UNIX_CONSTANTS),true)
 $(JDK_OUTPUTDIR)/gensrc_misc/sun/nio/fs/UnixConstants.java : $(BUILD_GENSRC_UC_EXE)
 	$(MKDIR) -p $(@D)
+	$(RM) $@ $@.tmp
 	NAWK="$(NAWK)" SH="$(SH)" $(SH) -e $(JDK_TOPDIR)/makefiles/scripts/addNotices.sh "$(UC_COPYRIGHT_YEARS)" > $@.tmp
 	$(BUILD_GENSRC_UC_EXE) >> $@.tmp
 	$(MV) $@.tmp $@
 else
 $(JDK_OUTPUTDIR)/gensrc_misc/sun/nio/fs/UnixConstants.java : $(JDK_TOPDIR)/src/closed/solaris/classes/sun/nio/fs/UnixConstants-$(OPENJDK_TARGET_OS)-$(OPENJDK_TARGET_CPU_ARCH).java
 	$(MKDIR) -p $(@D)
+	$(RM) $@
 	$(CP) $< $@
 endif
 
@@ -171,7 +189,7 @@
 
 GENSRC_MISC += $(JDK_OUTPUTDIR)/gensrc_misc/sun/nio/fs/SolarisConstants.java
 
-GENSRC_SOL_SRC := $(JDK_TOPDIR)/src/$(LEGACY_OPENJDK_TARGET_OS_API)/native/sun/nio/fs
+GENSRC_SOL_SRC := $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/nio/fs
 GENSRC_SOL_SRC_FILE := genSolarisConstants.c
 GENSRC_SOL_BIN := $(JDK_OUTPUTDIR)/gensrc_misc/genSolarisConstants
 
@@ -182,14 +200,15 @@
 		SRC:=$(GENSRC_SOL_SRC),\
 		INCLUDE_FILES:=$(GENSRC_SOL_SRC_FILE),\
 		LANG:=C,\
-		CC:=$(HOST_CC),\
-		LDEXE:=$(HOST_CC),\
+		CC:=$(BUILD_CC),\
+		LDEXE:=$(BUILD_CC),\
 		OBJECT_DIR:=$(GENSRC_SOL_BIN),\
 		OUTPUT_DIR:=$(GENSRC_SOL_BIN),\
 		PROGRAM:=genSolarisConstants))
 
 $(JDK_OUTPUTDIR)/gensrc_misc/sun/nio/fs/SolarisConstants.java : $(BUILD_GENSRC_SOL_EXE)
 	$(MKDIR) -p $(@D)
+	$(RM) $@ $@.tmp
 	NAWK="$(NAWK)" SH="$(SH)" $(SH) -e $(JDK_TOPDIR)/makefiles/scripts/addNotices.sh "$(SOL_COPYRIGHT_YEARS)" > $@.tmp
 	$(BUILD_GENSRC_SOL_EXE) >> $@.tmp
 	$(MV) $@.tmp $@
--- a/jdk/makefiles/GensrcProperties.gmk	Wed Jul 05 18:22:17 2017 +0200
+++ b/jdk/makefiles/GensrcProperties.gmk	Wed Jul 05 18:22:52 2017 +0200
@@ -46,8 +46,9 @@
 
   # Strip away prefix and suffix,
   # leaving for example: sun/util/resources/CurrencyNames_sv
-  $1_PROPPATHS:=$$(patsubst $(JDK_TOPDIR)/src/$(LEGACY_OPENJDK_TARGET_OS_API)/classes/%.properties,%,\
-                $$(patsubst $(JDK_TOPDIR)/src/share/classes/%.properties,%,$2))
+  $1_PROPPATHS:=$$(patsubst $(JDK_TOPDIR)/src/windows/classes/%.properties,%,\
+		$$(patsubst $(JDK_TOPDIR)/src/macosx/classes/%.properties,%,\
+                $$(patsubst $(JDK_TOPDIR)/src/share/classes/%.properties,%,$2)))
 
   # Apply optional name transformation, example: hz_TW -> hz_HK
   $(if $4,$1_PROPPATHS:=$$(patsubst $4,$5,$$($1_PROPPATHS)))
@@ -75,7 +76,7 @@
 
   # Strip away prefix and suffix,
   # leaving for example: sun/util/resources/CurrencyNames_sv
-  $1_PROPPATHS:=$$(patsubst $(JDK_TOPDIR)/src/$(LEGACY_OPENJDK_TARGET_OS_API)/classes/%.properties,%,\
+  $1_PROPPATHS:=$$(patsubst $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/classes/%.properties,%,\
                 $$(patsubst $(JDK_TOPDIR)/src/share/classes/%.properties,%,$2))
 
   # Apply optional name transformation, example: hz_TW -> hz_HK
@@ -113,6 +114,13 @@
 
 # Some packages have properties that need to be converted to java source files.
 
+#com/apple/laf/resources
+ifeq ($(OPENJDK_TARGET_OS),macosx)
+    $(eval $(call add_properties_to_compile,COM_APPLE_LAF,\
+	$(shell find $(JDK_TOPDIR)/src/macosx/classes/com/apple/laf/resources -name "*.properties"),\
+		ListResourceBundle))
+endif
+
 #com/sun/accessibility/internal/resources
 $(eval $(call add_properties_to_compile,COM_SUN_ACCESSIBILITY,\
 	$(shell find $(JDK_TOPDIR)/src/share/classes/com/sun/accessibility/internal/resources -name "*.properties"),\
@@ -210,6 +218,16 @@
 $(eval $(call add_properties_to_compile,SUN_AWT_HK,\
 	$(shell find $(JDK_TOPDIR)/src/share/classes/sun/awt/resources -name "*.properties"),\
 		ListResourceBundle,%zh_TW,%zh_HK))
+#sun/awt/windows/
+ifeq ($(OPENJDK_TARGET_OS),windows)
+    $(eval $(call add_properties_to_compile,SUN_AWT,\
+	$(shell find $(JDK_TOPDIR)/src/windows/classes/sun/awt/windows -name "awtLocalization*.properties"),\
+		ListResourceBundle))
+    $(eval $(call add_properties_to_compile,SUN_AWT_HK,\
+	$(shell find $(JDK_TOPDIR)/src/windows/classes/sun/awt/windows -name "awtLocalization*.properties"),\
+		ListResourceBundle,%zh_TW,%zh_HK))
+endif
+
 #sun/launcher/resources
 $(eval $(call add_properties_to_compile,SUN_LAUNCHER,\
 	$(shell find $(JDK_TOPDIR)/src/share/classes/sun/launcher/resources -name "*.properties"),\
@@ -286,7 +304,7 @@
 
 # Now setup the rule for the generation of the resource bundles.
 $(JDK_OUTPUTDIR)/gensrc_properties/_the.compiled_properties : $(ALL_COMPILED_PROPSOURCES) $(BUILD_TOOLS)
-	$(RM) -rf $(JDK_OUTPUTDIR)/gensrc_properties/*
+	$(RM) -r $(JDK_OUTPUTDIR)/gensrc_properties/*
 #	Generate all output directories in advance since the build tool does not do that...
 	$(MKDIR) -p $(sort $(dir $(ALL_COMPILED_PROPJAVAS)))
 	$(ECHO) Compiling $(words $(ALL_COMPILED_PROPSOURCES)) properties into resource bundles
@@ -297,7 +315,7 @@
 # Now setup the rule for the generation of the cleaned properties.
 # FIXME: We currently don't handle removed properties incrementally. 
 $(JDK_OUTPUTDIR)/classes/_the.cleaned_properties : $(ALL_CLEANED_PROPSOURCES) $(BUILD_TOOLS)
-	$(RM) -f $(JDK_OUTPUTDIR)/classes/_the.cleaned_properties.cmdline
+	$(RM) $(JDK_OUTPUTDIR)/classes/_the.cleaned_properties.cmdline
 #	Generate all output directories in advance since the build tool does not do that...
 	$(MKDIR) -p $(sort $(dir $(ALL_CLEANED_PROPOUTPUT)))
 	$(ECHO) Copying and cleaning $(words $(ALL_CLEANED_PROPSOURCES)) properties 
--- a/jdk/makefiles/GensrcX11Wrappers.gmk	Wed Jul 05 18:22:17 2017 +0200
+++ b/jdk/makefiles/GensrcX11Wrappers.gmk	Wed Jul 05 18:22:52 2017 +0200
@@ -23,36 +23,33 @@
 # questions.
 #
 
+
+# This file is responsible for extracting the x11 native struct offsets to
+# the xawt Java library. This is done by compiling and running a native
+# binary, which dumps output to a text file. The offsets differ on 32 and 64
+# bit systems, so care must be taken here.
+
+# Note: Some of the more complex logic here is most likely not needed anymore.
+
 GENSRC_X11WRAPPERS :=
 GENSRC_X11WRAPPERS_TMP := $(JDK_OUTPUTDIR)/gensrc_x11wrappers
 
 GENSRC_SIZER_SRC := $(JDK_TOPDIR)/src/solaris/classes/sun/awt/X11/generator
 
-GENSRC_SIZES :=
+# Normal case is to generate version according to target bits
+GENSRC_SIZES := sizes.$(OPENJDK_TARGET_CPU_BITS)
 
-ifeq ($(OPENJDK_TARGET_OS)-$(LIBARCH), solaris-i386)
-GENSRC_SIZES := sizes.32 sizes.64
-else ifeq ($(OPENJDK_TARGET_OS), solaris)
-isalist:=$(shell isainfo)
-ifneq (,$(findstring sparcv9, $(isalist)))
-# On sparcv9 we generate both 32 and 64-bit sizers in spite of ARCH_DATA_MODEL.
-GENSRC_SIZES := sizes.32 sizes.64
-else
-ifneq (,$(findstring amd64, $(isalist)))
-# On amd64 we generate both 32 and 64-bit sizers in spite of ARCH_DATA_MODEL.
+ifeq ($(OPENJDK_TARGET_CPU_BITS), 64)
+ifneq ($(OPENJDK_TARGET_OS), linux)
+# On all 64-bit systems except Linux, generate both 32 and 64 bit versions
 GENSRC_SIZES := sizes.32 sizes.64
-else # !sparcv9 : includes (32-bit) sparc, i586
-GENSRC_SIZES := sizes.32
-endif # amd64
-endif # sparcv9
-else # !solaris
-ifeq ($(OPENJDK_TARGET_OS), macosx)
+endif
+else
+ifeq ($(OPENJDK_TARGET_OS)-$(OPENJDK_TARGET_CPU), solaris-x86)
+# As a special case, solaris on x86 (32-bit) also generates the 64-bit version
 GENSRC_SIZES := sizes.32 sizes.64
-else # !macosx
-GENSRC_SIZES := sizes.$(ARCH_DATA_MODEL)
-endif # !macosx
-endif # solaris
-
+endif
+endif
 
 ##########################################################################################
 
@@ -62,40 +59,44 @@
 	$(TOOL_WRAPPERGENERATOR) $(@D) $< "sizer" $*
 
 $(GENSRC_X11WRAPPERS_TMP)/sizer/sizer.%.exe : $(GENSRC_X11WRAPPERS_TMP)/sizer/sizer.%.c
-	(cd $(@D) && $(HOST_CC) -m$* -o $@ $< \
+	$(MKDIR) -p $(@D)
+	$(RM) $@ $@.tmp
+	(cd $(@D) && $(BUILD_CC) -m$* -o $@.tmp $< \
               -I$(JDK_OUTPUTDIR)/include \
               -I$(JDK_TOPDIR)/src/share/javavm/export \
-              -I$(JDK_TOPDIR)/src/$(LEGACY_OPENJDK_TARGET_OS_API)/javavm/export \
+              -I$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/javavm/export \
               -I$(JDK_TOPDIR)//src/share/native/common \
-              -I$(JDK_TOPDIR)/src/$(LEGACY_OPENJDK_TARGET_OS_API)/native/common \
+              -I$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/common \
               -I$(JDK_TOPDIR)/src/solaris/native/sun/awt \
 	      -I$(JDK_TOPDIR)/src/share/native/sun/awt/debug \
 	      -I$(JDK_TOPDIR)/src/share/native/sun/awt/image/cvutils -lc)
+	$(MV) $@.tmp $@
 
-ifeq ($(OPENJDK_TARGET_OS)-$(LIBARCH), solaris-i386)
-
-$(GENSRC_X11WRAPPERS_TMP)/sizer/sizes.32 : $(GENSRC_X11WRAPPERS_TMP)/sizer/sizer.32.exe
+# Run the generated sizer binary to create the sizes text file
+$(GENSRC_X11WRAPPERS_TMP)/sizer/sizes.% : $(GENSRC_X11WRAPPERS_TMP)/sizer/sizer.%.exe
+	$(MKDIR) -p $(@D)
+	$(RM) $@ $@.tmp
 	$< > $@.tmp
 	$(MV) $@.tmp $@
 
-$(GENSRC_X11WRAPPERS_TMP)/sizer/sizes.64 : $(JDK_TOPDIR)/src/$(LEGACY_OPENJDK_TARGET_OS_API)/classes/sun/awt/X11/generator/sizes.64-$(OPENJDK_TARGET_OS)-$(LIBARCH)
+ifeq ($(OPENJDK_TARGET_OS)-$(OPENJDK_TARGET_CPU), solaris-x86)
+  # On solaris-x86 we also need to create the 64-bit version, but we can't run a 64-bit binary
+  # As a workaround, copy this from a pre-generated file.
+$(GENSRC_X11WRAPPERS_TMP)/sizer/sizes.64 : $(JDK_TOPDIR)/src/solaris/classes/sun/awt/X11/generator/sizes.64-solaris-i386
 	$(MKDIR) -p $(@D)
+	$(RM) $@
 	$(CP) $< $@
-else
-
-$(GENSRC_X11WRAPPERS_TMP)/sizer/sizes.% : $(GENSRC_X11WRAPPERS_TMP)/sizer/sizer.%.exe
-	$< > $@.tmp
-	$(MV) $@.tmp $@
-
 endif
 
 $(GENSRC_X11WRAPPERS_TMP)/classes/_the.classes : $(foreach S,$(GENSRC_SIZES),$(GENSRC_X11WRAPPERS_TMP)/sizer/$(S))
+	$(RM) $@
 	$(MKDIR) -p $(@D)/sun/awt/X11
 	$(RM) $(@D)/sun/awt/X11/*
 	$(TOOL_WRAPPERGENERATOR) $(@D)/sun/awt/X11 $(GENSRC_SIZER_SRC)/xlibtypes.txt "gen" $(GENSRC_X11WRAPPERS_TMP)/sizer/sizes
-ifeq ($(OPENJDK_TARGET_OS)-$(LIBARCH), solaris-amd64)
-	$(ECHO) COMPARING $(GENSRC_X11WRAPPERS_TMP)/sizer/sizes.64 and $(GENSRC_SIZER_SRC)/sizes.64-$(OPENJDK_TARGET_OS)-i386
-	$(DIFF) $(GENSRC_X11WRAPPERS_TMP)/sizer/sizes.64 $(GENSRC_SIZER_SRC)/sizes.64-$(OPENJDK_TARGET_OS)-i386
+ifeq ($(OPENJDK_TARGET_OS)-$(OPENJDK_TARGET_CPU), solaris-x86_64)
+  # On solaris-x86_64, as a safety measure, compare the generated file with the checked-in version 
+	$(ECHO) COMPARING $(GENSRC_X11WRAPPERS_TMP)/sizer/sizes.64 and $(GENSRC_SIZER_SRC)/sizes.64-solaris-i386
+	$(DIFF) $(GENSRC_X11WRAPPERS_TMP)/sizer/sizes.64 $(GENSRC_SIZER_SRC)/sizes.64-solaris-i386
 endif
 	$(TOUCH) $@
 
--- a/jdk/makefiles/Images.gmk	Wed Jul 05 18:22:17 2017 +0200
+++ b/jdk/makefiles/Images.gmk	Wed Jul 05 18:22:52 2017 +0200
@@ -32,11 +32,21 @@
 
 include Tools.gmk
 
-images: jre-image jdk-image
+# Note: This double-colon rule is intentional, to support
+# custom make file integration.
+images:: jre-image jdk-image
+
+overlay-images: jre-overlay-image jdk-overlay-image
+
+
+-include $(CUSTOM_MAKE_DIR)/Images.gmk
+
 
 ifeq ($(OPENJDK_TARGET_OS),solaris)
+# On Solaris, if the target is a symlink and exists, cp won't overwrite.
 define install-file
 	$(MKDIR) -p $(@D)
+	$(RM) '$@'
 	$(CP) -f -r -P '$<' '$(@D)'
 endef
 else ifeq ($(OPENJDK_TARGET_OS),macosx)
@@ -51,11 +61,34 @@
 endef
 endif
 
+# Processing license files from source area to image area
+# These will be modified to have the platform specific EOL chars.
+define process-doc-file
+	$(ECHO) Processing $(patsubst $(OUTPUT_ROOT)/%,%,$@)
+	$(MKDIR) -p $(@D)
+	$(RM) $@
+	$(SED) 's/$$//g' $< > $@
+	$(CHMOD) 444 $@
+endef
+
+
+JDK_IMAGE_DIR:=$(IMAGES_OUTPUTDIR)/j2sdk-image
+JRE_IMAGE_DIR:=$(IMAGES_OUTPUTDIR)/j2re-image
+
+JDK_OVERLAY_IMAGE_DIR:=$(IMAGES_OUTPUTDIR)/j2sdk-overlay-image
+JRE_OVERLAY_IMAGE_DIR:=$(IMAGES_OUTPUTDIR)/j2re-overlay-image
+
 ################################################################################
 #
 # JRE and JDK build rules
 #
 ################################################################################
+#
+# Variable prefixes explained:
+# JRE_ refers to files in the j2re-image.
+# JDK_ refers to files in the j2sdk-image outside of the jre subdir.
+# JDKJRE_ refers to files in the j2sdk-image inside the jre subdir.
+#
 
 ################################################################################
 # /bin dir
@@ -72,6 +105,19 @@
 	$(ECHO) Copying $(patsubst $(OUTPUT_ROOT)/%,%,$@)
 	$(install-file)
 
+# Overaly image targets
+$(JRE_OVERLAY_IMAGE_DIR)/bin/%: $(JDK_OUTPUTDIR)/bin/%
+	$(ECHO) Copying $(patsubst $(OUTPUT_ROOT)/%,%,$@)
+	$(install-file)
+
+$(JDK_OVERLAY_IMAGE_DIR)/bin/%: $(JDK_OUTPUTDIR)/bin/%
+	$(ECHO) Copying $(patsubst $(OUTPUT_ROOT)/%,%,$@)
+	$(install-file)
+
+$(JDK_OVERLAY_IMAGE_DIR)/jre/bin/%: $(JDK_OUTPUTDIR)/bin/%
+	$(ECHO) Copying $(patsubst $(OUTPUT_ROOT)/%,%,$@)
+	$(install-file)
+
 NOT_JRE_BIN_FILES := \
 	appletviewer$(EXE_SUFFIX) \
 	extcheck$(EXE_SUFFIX) \
@@ -107,26 +153,54 @@
 
 WINDOWS_JDK_BIN_FILES = \
 	$(EXE_SUFFIX) \
-	$(LIB_PREFIX)jli$(SHARED_LIBRARY_SUFFIX) \
-	$(MSVCRNN_DLL)
+	$(LIBRARY_PREFIX)jli$(SHARED_LIBRARY_SUFFIX) \
+	$(notdir $(MSVCRNN_DLL))
+
+WINDOWS_JDKJRE_BIN_FILES := \
+	$(LIBRARY_PREFIX)attach$(SHARED_LIBRARY_SUFFIX) \
+	$(SALIB_NAME)
 
 # Find all files in bin dir
 ALL_BIN_LIST := $(shell $(FIND) $(JDK_OUTPUTDIR)/bin -type f)
 
-# For unknown reason the debuginfo files for binaries are not put into images
+# For unknown reason the debuginfo files for executables are not put into images
 # e.g filter them out
-ALL_BIN_LIST := $(filter-out %.debuginfo %.diz, $(ALL_BIN_LIST))
+ifneq ($(OPENJDK_TARGET_OS),windows)
+    ALL_BIN_LIST := $(filter-out %.debuginfo %.diz, $(ALL_BIN_LIST))
+else
+# On windows, the libraries are in the bin dir, only filter out debuginfo files
+# for executables. "java" is both a library and executable.
+    ALL_BIN_EXEC_FILES := $(filter-out java.exe,$(notdir $(shell $(FIND) $(JDK_OUTPUTDIR)/bin -type f -name "*.exe")))
+    ALL_BIN_DEBUG_FILTER := $(addprefix %,$(patsubst %.exe,%.debuginfo,$(ALL_BIN_EXEC_FILES)) \
+					   $(patsubst %.exe,%.diz,$(ALL_BIN_EXEC_FILES))) %.pdb
+    ALL_BIN_LIST := $(filter-out $(ALL_BIN_DEBUG_FILTER),$(ALL_BIN_LIST))
+endif
 
 ifeq ($(OPENJDK_TARGET_OS),windows)
     JDK_BIN_LIST := $(filter $(addprefix %,$(WINDOWS_JDK_BIN_FILES)), $(ALL_BIN_LIST))
 else
     JDK_BIN_LIST := $(ALL_BIN_LIST)
 endif
-JRE_BIN_LIST := $(filter-out $(addprefix %,$(NOT_JRE_BIN_FILES)), $(ALL_BIN_LIST))
+JDKJRE_BIN_LIST := $(filter-out $(addprefix %,$(NOT_JRE_BIN_FILES)), $(ALL_BIN_LIST))
+JRE_BIN_LIST := $(filter-out $(addprefix %,$(WINDOWS_JDKJRE_BIN_FILES)), $(JDKJRE_BIN_LIST))
+
+ifneq ($(OPENJDK_TARGET_CPU_ISADIR),)
+    OVERLAY_FILTER := $(JDK_OUTPUTDIR)/bin$(OPENJDK_TARGET_CPU_ISADIR)%
+endif
 
-JRE_BIN_TARGETS := $(patsubst $(JDK_OUTPUTDIR)/%,$(JRE_IMAGE_DIR)/%, $(JRE_BIN_LIST))
-JDK_BIN_TARGETS := $(patsubst $(JDK_OUTPUTDIR)/%,$(JDK_IMAGE_DIR)/%, $(JDK_BIN_LIST))
-JDKJRE_BIN_TARGETS := $(patsubst $(JDK_OUTPUTDIR)/%,$(JDK_IMAGE_DIR)/jre/%, $(JRE_BIN_LIST))
+JRE_BIN_TARGETS := $(patsubst $(JDK_OUTPUTDIR)/%,$(JRE_IMAGE_DIR)/%, \
+			$(filter-out $(OVERLAY_FILTER),$(JRE_BIN_LIST)))
+JDK_BIN_TARGETS := $(patsubst $(JDK_OUTPUTDIR)/%,$(JDK_IMAGE_DIR)/%, \
+			$(filter-out $(OVERLAY_FILTER),$(JDK_BIN_LIST)))
+JDKJRE_BIN_TARGETS := $(patsubst $(JDK_OUTPUTDIR)/%,$(JDK_IMAGE_DIR)/jre/%, \
+			$(filter-out $(OVERLAY_FILTER),$(JDKJRE_BIN_LIST)))
+
+JRE_OVERLAY_BIN_TARGETS := $(patsubst $(JDK_OUTPUTDIR)/%,$(JRE_OVERLAY_IMAGE_DIR)/%, \
+				$(filter $(OVERLAY_FILTER),$(JRE_BIN_LIST)))
+JDK_OVERLAY_BIN_TARGETS := $(patsubst $(JDK_OUTPUTDIR)/%,$(JDK_OVERLAY_IMAGE_DIR)/%, \
+				$(filter $(OVERLAY_FILTER),$(JDK_BIN_LIST)))
+JDKJRE_OVERLAY_BIN_TARGETS := $(patsubst $(JDK_OUTPUTDIR)/%,$(JDK_OVERLAY_IMAGE_DIR)/jre/%, \
+				$(filter $(OVERLAY_FILTER),$(JDKJRE_BIN_LIST)))
 
 ################################################################################
 # /lib dir
@@ -143,9 +217,24 @@
 	$(ECHO) Copying $(patsubst $(OUTPUT_ROOT)/%,%,$@)
 	$(install-file)
 
-JDKJRE_LIB_FILES := \
-	$(LIB_PREFIX)attach$(SHARED_LIBRARY_SUFFIX) \
+# Overlay image targets
+$(JRE_OVERLAY_IMAGE_DIR)/lib/%: $(JDK_OUTPUTDIR)/lib/%
+	$(ECHO) Copying $(patsubst $(OUTPUT_ROOT)/%,%,$@)
+	$(install-file)
+
+$(JDK_OVERLAY_IMAGE_DIR)/lib/%: $(JDK_OUTPUTDIR)/lib/%
+	$(ECHO) Copying $(patsubst $(OUTPUT_ROOT)/%,%,$@)
+	$(install-file)
+
+$(JDK_OVERLAY_IMAGE_DIR)/jre/lib/%: $(JDK_OUTPUTDIR)/lib/%
+	$(ECHO) Copying $(patsubst $(OUTPUT_ROOT)/%,%,$@)
+	$(install-file)
+
+ifneq ($(OPENJDK_TARGET_OS), macosx)
+    JDKJRE_LIB_FILES := \
+	$(LIBRARY_PREFIX)attach$(SHARED_LIBRARY_SUFFIX) \
 	$(SALIB_NAME)
+endif
 
 NOT_JRE_LIB_FILES := \
 	tools.jar \
@@ -156,12 +245,16 @@
 	ir.idl \
 	ct.sym
 
+ifeq ($(OPENJDK_TARGET_OS), windows)
+    NOT_JRE_LIB_FILES += jawt.lib jvm.lib
+endif
+
 JDK_LIB_FILES := $(NOT_JRE_LIB_FILES)
 ifeq ($(OPENJDK_TARGET_OS), linux)
     JDK_LIB_FILES += jexec
 endif
 
-ALL_LIB_LIST := $(shell $(FIND) $(JDK_OUTPUTDIR)/lib \( -type f -o -type l \) ! -name "_the*")
+ALL_LIB_LIST := $(shell $(FIND) $(JDK_OUTPUTDIR)/lib \( -type f -o -type l \) -a ! \( -name "_the*" -o -name "javac_state " \) )
 JRE_LIB_LIST := $(filter-out $(addprefix %,$(NOT_JRE_LIB_FILES) $(JDKJRE_LIB_FILES)),$(ALL_LIB_LIST))
 JDKJRE_LIB_LIST := $(filter-out $(addprefix %,$(NOT_JRE_LIB_FILES)),$(ALL_LIB_LIST))
 JDK_LIB_LIST := $(filter $(addprefix %,$(JDK_LIB_FILES)),$(ALL_LIB_LIST))
@@ -170,6 +263,13 @@
 JDK_LIB_TARGETS := $(patsubst $(JDK_OUTPUTDIR)/%,$(JDK_IMAGE_DIR)/%,$(JDK_LIB_LIST))
 JDKJRE_LIB_TARGETS := $(patsubst $(JDK_OUTPUTDIR)/%,$(JDK_IMAGE_DIR)/jre/%,$(JDKJRE_LIB_LIST))
 
+JRE_OVERLAY_LIB_TARGETS := $(subst $(JRE_IMAGE_DIR),$(JRE_OVERLAY_IMAGE_DIR),\
+				$(filter $(JRE_IMAGE_DIR)/lib$(OPENJDK_TARGET_CPU_ISADIR)/%,$(JRE_LIB_TARGETS)))
+JDK_OVERLAY_LIB_TARGETS := $(subst $(JDK_IMAGE_DIR),$(JDK_OVERLAY_IMAGE_DIR),\
+				$(filter $(JDK_IMAGE_DIR)/lib$(OPENJDK_TARGET_CPU_ISADIR)/%,$(JDK_LIB_TARGETS)))
+JDKJRE_OVERLAY_LIB_TARGETS := $(subst $(JDK_IMAGE_DIR),$(JDK_OVERLAY_IMAGE_DIR),\
+				$(filter $(JDK_IMAGE_DIR)/jre/lib$(OPENJDK_TARGET_CPU_ISADIR)/%,$(JDKJRE_LIB_TARGETS)))
+
 # CTE plugin security change require new empty directory lib/applet
 $(JRE_IMAGE_DIR)/lib/applet: 
 	$(ECHO) Creating $(patsubst $(OUTPUT_ROOT)/%,%,$@)
@@ -179,19 +279,20 @@
 	$(ECHO) Creating $(patsubst $(OUTPUT_ROOT)/%,%,$@)
 	$(MKDIR) -p $@
 
+# In the old build, JObjC.jar is not part of the meta-index
 $(JRE_IMAGE_DIR)/lib/meta-index: $(JRE_LIB_TARGETS)
 	$(ECHO) Generating $(patsubst $(OUTPUT_ROOT)/%,%,$@)
-	$(CD) $(@D) && $(TOOL_BUILDMETAINDEX) -o meta-index *.jar
+	$(CD) $(@D) && $(TOOL_BUILDMETAINDEX) -o meta-index `$(LS) *.jar | $(SED) 's/JObjC\.jar//g'`
 
 $(JDK_IMAGE_DIR)/jre/lib/meta-index: $(JDKJRE_LIB_TARGETS)
 	$(ECHO) Generating $(patsubst $(OUTPUT_ROOT)/%,%,$@)
-	$(CD) $(@D) && $(TOOL_BUILDMETAINDEX) -o meta-index *.jar
+	$(CD) $(@D) && $(TOOL_BUILDMETAINDEX) -o meta-index `$(LS) *.jar | $(SED) 's/JObjC\.jar//g'`
 
 $(JRE_IMAGE_DIR)/lib/ext/meta-index: $(JRE_LIB_TARGETS)
 	$(ECHO) Generating $(patsubst $(OUTPUT_ROOT)/%,%,$@)
 	$(CD) $(@D) && $(TOOL_BUILDMETAINDEX) -o meta-index *.jar
 
-$(JDK_IMAGE_DIR)/jre/lib/ext/meta-index: $(JRE_LIB_TARGETS)
+$(JDK_IMAGE_DIR)/jre/lib/ext/meta-index: $(JDKJRE_LIB_TARGETS)
 	$(ECHO) Generating $(patsubst $(OUTPUT_ROOT)/%,%,$@)
 	$(CD) $(@D) && $(TOOL_BUILDMETAINDEX) -o meta-index *.jar
 
@@ -378,12 +479,12 @@
 # /demo dir
 
 ifndef NO_DEMOS
-# FIXME: newdemo/applets/GraphLayout/GraphPanel$2.class is sometimes not copied.
+# FIXME: demo/applets/GraphLayout/GraphPanel$2.class is sometimes not copied.
 
 #   The db demo contains an empty dir that needs to be copied. The other 
 #   directories will always trigger the rule for recompile since 
 #   _the.list_of_packages files are touched.
-    $(JDK_IMAGE_DIR)/demo/%: $(JDK_OUTPUTDIR)/newdemo/%
+    $(JDK_IMAGE_DIR)/demo/%: $(JDK_OUTPUTDIR)/demo/%
 	if [ ! -d "$@" ]; then \
 	  $(ECHO) Copying '$(patsubst $(OUTPUT_ROOT)/%,%,$@)'; \
 	  $(MKDIR) -p $(@D); \
@@ -391,8 +492,25 @@
 	fi
 
 #   Find all files including directories
-    JDK_DEMO_TARGETS := $(patsubst $(JDK_OUTPUTDIR)/newdemo/%,$(JDK_IMAGE_DIR)/demo/%,\
-			$(shell $(FIND) $(JDK_OUTPUTDIR)/newdemo ! -name "_the.*"))
+    JDK_DEMO_TARGETS := $(patsubst $(JDK_OUTPUTDIR)/demo/%,$(JDK_IMAGE_DIR)/demo/%,\
+			$(shell $(FIND) $(JDK_OUTPUTDIR)/demo ! \( -name "_the*" -o -name "javac_state" \) ))
+
+
+
+    # Param 1 is source file
+    define CreateOverlayDemoRule
+        $1_TARGET:=$$(subst $(JDK_OUTPUTDIR),$(JDK_OVERLAY_IMAGE_DIR),\
+			$$(dir $1)$(OPENJDK_TARGET_CPU_ISADIR)/$$(notdir $1))
+        $$($1_TARGET): $1
+		$(ECHO) Copying '$$(patsubst $(OUTPUT_ROOT)/%,%,$$@)'
+		$(MKDIR) -p $$(@D)
+		$(RM) $$@
+		$(CP) -f '$$<' '$$@'
+
+        JDK_OVERLAY_DEMO_TARGETS += $$($1_TARGET)
+    endef
+    JDK_OVERLAY_DEMO_SOURCES := $(shell $(FIND) $(JDK_OUTPUTDIR)/demo -name "*$(SHARED_LIBRARY_SUFFIX)")
+    $(foreach lib,$(JDK_OVERLAY_DEMO_SOURCES),$(eval $(call CreateOverlayDemoRule,$(lib))))
 
 endif
 
@@ -471,50 +589,47 @@
 JDK_DOC_TARGETS := $(addprefix $(JDK_IMAGE_DIR)/,$(JDK_DOC_FILES))
 
 $(JRE_IMAGE_DIR)/%: $(JRE_DOC_LOCATION)/%
-	$(ECHO) Copying $(patsubst $(OUTPUT_ROOT)/%,%,$@)
-	$(install-file)
-	$(CHMOD) 444 $(@)
+	$(process-doc-file)
 
 $(JDK_IMAGE_DIR)/jre/%: $(JRE_DOC_LOCATION)/%
-	$(ECHO) Copying $(patsubst $(OUTPUT_ROOT)/%,%,$@)
-	$(install-file)
-	$(CHMOD) 444 $(@)
+	$(process-doc-file)
 
 $(JRE_IMAGE_DIR)/README.txt: $(JRE_DOC_LOCATION)/README
-	$(ECHO) Copying $(patsubst $(OUTPUT_ROOT)/%,%,$@)
-	$(MKDIR) -p $(@D)
-	$(CP) $< $@
-	$(CHMOD) 444 $(@)
+	$(process-doc-file)
 
 $(JDK_IMAGE_DIR)/jre/README.txt: $(JRE_DOC_LOCATION)/README
-	$(ECHO) Copying $(patsubst $(OUTPUT_ROOT)/%,%,$@)
-	$(MKDIR) -p $(@D)
-	$(CP) $< $@
-	$(CHMOD) 444 $(@)
+	$(process-doc-file)
 
 $(JDK_IMAGE_DIR)/%: $(JDK_DOC_LOCATION)/%
-	$(ECHO) Copying $(patsubst $(OUTPUT_ROOT)/%,%,$@)
-	$(install-file)
-	$(CHMOD) 444 $(@)
+	$(process-doc-file)
 
 $(JDK_IMAGE_DIR)/demo/%: $(JDK_DOC_LOCATION)/%
-	$(ECHO) Copying $(patsubst $(OUTPUT_ROOT)/%,%,$@)
-	$(install-file)
-	$(CHMOD) 444 $(@)
+	$(process-doc-file)
 
 $(JDK_IMAGE_DIR)/sample/%: $(JDK_DOC_LOCATION)/%
-	$(ECHO) Copying $(patsubst $(OUTPUT_ROOT)/%,%,$@)
-	$(install-file)
-	$(CHMOD) 444 $(@)
+	$(process-doc-file)
 
 JRE_INFO_FILE := $(JRE_IMAGE_DIR)/release
 JDK_INFO_FILE := $(JDK_IMAGE_DIR)/release
 
+JRE_OVERLAY_INFO_FILE := $(JRE_OVERLAY_IMAGE_DIR)/release
+JDK_OVERLAY_INFO_FILE := $(JDK_OVERLAY_IMAGE_DIR)/release
+
 # Common way to emit a line into the release or info file
 define info-file-item # name value
 $(PRINTF) '%s="%s"\n' $1 $2 >> $@
 endef
 
+define create-info-file
+	$(MKDIR) -p $(@D)
+	$(RM) $@
+	$(call info-file-item, "JAVA_VERSION", "$(JDK_VERSION)")
+	$(call info-file-item, "OS_NAME",      "$(REQUIRED_OS_NAME)")
+	$(call info-file-item, "OS_VERSION",   "$(REQUIRED_OS_VERSION)")
+	$(call info-file-item, "OS_ARCH",      "$(OPENJDK_TARGET_CPU_LEGACY)")
+	$(call info-file-item, "SOURCE",       "$(ALL_SOURCE_TIPS)")
+endef
+
 ALL_SOURCE_TIPS = $(shell \
   if [ -f $(OUTPUT_ROOT)/source_tips ] ; then \
     $(CAT) $(OUTPUT_ROOT)/source_tips ; \
@@ -522,23 +637,19 @@
 
 $(JRE_INFO_FILE): $(OUTPUT_ROOT)/spec.gmk $(OUTPUT_ROOT)/source_tips
 	$(ECHO) Generating $(patsubst $(OUTPUT_ROOT)/%,%,$@)
-	$(MKDIR) -p $(@D)
-	$(RM) $@
-	$(call info-file-item, "JAVA_VERSION", "$(JDK_VERSION)")
-	$(call info-file-item, "OS_NAME",      "$(REQUIRED_OS_NAME)")
-	$(call info-file-item, "OS_VERSION",   "$(REQUIRED_OS_VERSION)")
-	$(call info-file-item, "OS_ARCH",      "$(ARCH)")
-	$(call info-file-item, "SOURCE",       "$(ALL_SOURCE_TIPS)")
+	$(call create-info-file)
 
 $(JDK_INFO_FILE): $(OUTPUT_ROOT)/spec.gmk $(OUTPUT_ROOT)/source_tips
 	$(ECHO) Generating $(patsubst $(OUTPUT_ROOT)/%,%,$@)
-	$(MKDIR) -p $(@D)
-	$(RM) $@
-	$(call info-file-item, "JAVA_VERSION", "$(JDK_VERSION)")
-	$(call info-file-item, "OS_NAME",      "$(REQUIRED_OS_NAME)")
-	$(call info-file-item, "OS_VERSION",   "$(REQUIRED_OS_VERSION)")
-	$(call info-file-item, "OS_ARCH",      "$(ARCH)")
-	$(call info-file-item, "SOURCE",       "$(ALL_SOURCE_TIPS)")
+	$(call create-info-file)
+
+$(JRE_OVERLAY_INFO_FILE): $(OUTPUT_ROOT)/spec.gmk $(OUTPUT_ROOT)/source_tips
+	$(ECHO) Generating $(patsubst $(OUTPUT_ROOT)/%,%,$@)
+	$(call create-info-file)
+
+$(JDK_OVERLAY_INFO_FILE): $(OUTPUT_ROOT)/spec.gmk $(OUTPUT_ROOT)/source_tips
+	$(ECHO) Generating $(patsubst $(OUTPUT_ROOT)/%,%,$@)
+	$(call create-info-file)
 
 $(JDK_IMAGE_DIR)/src.zip: $(IMAGES_OUTPUTDIR)/src.zip
 	$(ECHO) Copying $(patsubst $(OUTPUT_ROOT)/%,%,$@)
@@ -549,51 +660,75 @@
 
 ifneq ($(POST_STRIP_CMD),)
     ifeq ($(OPENJDK_TARGET_OS), windows)
-        EXEC_LIST:=$(shell $(FIND) $(JDK_OUTPUTDIR)/bin -type f -name \*.exe \
+        EXEC_LIST_BIN:=$(shell $(FIND) $(JDK_OUTPUTDIR)/bin -type f -name \*.exe \
 		-o -name \*.dll | $(EGREP) -v -i "$(MSVCRNN_DLL)")
     else
         # Find all executables in JDK_OUTPUTDIR since they exist when this makefile is parsed
-        EXEC_LIST:=$(shell $(FIND) $(JDK_OUTPUTDIR)/lib -type f -name \*$(SHARED_LIBRARY_SUFFIX) && \
-		$(FILE) `$(FIND) $(JDK_OUTPUTDIR)/bin -type f -name \*$(EXE_SUFFIX)` \
+        EXEC_LIST_BIN:=$(shell $(FILE) `$(FIND) $(JDK_OUTPUTDIR)/bin -type f -name \*$(EXE_SUFFIX)` \
 		| $(EGREP) 'ELF' | $(CUT) -d':' -f1)
+        # On mac, the old build searches for static libraries for stripping instead of shared.
+        # Not clear if it's intentional.
+	ifneq ($(OPENJDK_TARGET_OS), macosx)
+            EXEC_LIST_LIB:=$(shell $(FIND) $(JDK_OUTPUTDIR)/lib -type f -name \*$(SHARED_LIBRARY_SUFFIX))
+	endif
     endif
+
+    # Filter out the overlay specific bin files
+    EXEC_LIST:=$(filter-out $(OVERLAY_FILTER),$(EXEC_LIST_BIN)) $(EXEC_LIST_LIB)
+    EXEC_LIST_OVERLAY:=$(filter $(OVERLAY_FILTER),$(EXEC_LIST_BIN)) $(EXEC_LIST_LIB)
+
     # Filter out non JRE files and convert to unique touch files to depend on
-    JRE_EXEC_TOUCH_LIST:=$(patsubst $(JDK_OUTPUTDIR)/%,$(IMAGES_OUTPUTDIR)/_strip_jre/%.stripped,\
-			$(filter-out $(addprefix %,$(NOT_JRE_BIN_FILES) $(NOT_JRE_LIB_FILES)), $(EXEC_LIST)))
+    JRE_STRIP_LIST:=$(patsubst $(JDK_OUTPUTDIR)/%,$(IMAGES_OUTPUTDIR)/_strip_jre/%.stripped,\
+			$(filter-out $(addprefix %,$(NOT_JRE_BIN_FILES) $(NOT_JRE_LIB_FILES) $(JDKJRE_LIB_FILES)),\
+				 $(EXEC_LIST)))
 
-    JDK_JRE_EXEC_TOUCH_LIST:=$(patsubst $(JDK_OUTPUTDIR)/%, \
+    JDKJRE_STRIP_LIST:=$(patsubst $(JDK_OUTPUTDIR)/%, \
                         $(IMAGES_OUTPUTDIR)/_strip_jdk/jre/%.stripped, \
 			$(filter-out $(addprefix %,$(NOT_JRE_BIN_FILES) $(NOT_JRE_LIB_FILES)), $(EXEC_LIST)))
 
-    JDK_BIN_EXEC_TOUCH_LIST := $(patsubst $(JDK_OUTPUTDIR)/%, \
+    JDK_BIN_STRIP_LIST:=$(patsubst $(JDK_OUTPUTDIR)/%, \
                           $(IMAGES_OUTPUTDIR)/_strip_jdk/%.stripped, \
                           $(filter-out $(JDK_OUTPUTDIR)/lib/%, $(EXEC_LIST)))
 
+    # Do the same for overlay image
+    JRE_OVERLAY_STRIP_LIST:=$(patsubst $(JDK_OUTPUTDIR)/%,$(IMAGES_OUTPUTDIR)/_strip_jre_overlay/%.stripped,\
+			$(filter-out $(addprefix %,$(NOT_JRE_BIN_FILES) $(NOT_JRE_LIB_FILES) $(JDKJRE_LIB_FILES)),\
+				 $(EXEC_LIST_OVERLAY)))
+
+    JDKJRE_OVERLAY_STRIP_LIST:=$(patsubst $(JDK_OUTPUTDIR)/%, \
+                        $(IMAGES_OUTPUTDIR)/_strip_jdk_overlay/jre/%.stripped, \
+			$(filter-out $(addprefix %,$(NOT_JRE_BIN_FILES) $(NOT_JRE_LIB_FILES)), $(EXEC_LIST_OVERLAY)))
+
+    JDK_OVERLAY_BIN_STRIP_LIST:=$(patsubst $(JDK_OUTPUTDIR)/%, \
+                          $(IMAGES_OUTPUTDIR)/_strip_jdk_overlay/%.stripped, \
+                          $(filter-out $(JDK_OUTPUTDIR)/lib/%, $(EXEC_LIST_OVERLAY)))
+
+    define mcs-file
+	$(if $(POST_MCS_CMD),$(POST_MCS_CMD) $<)
+    endef
+
+    define strip-file
+	$(ECHO) Stripping $(patsubst $(OUTPUT_ROOT)/%,%,$<)
+	$(CHMOD) u+w $<
+	$(POST_STRIP_CMD) $<
+	$(call mcs-file)
+	$(CHMOD) go-w $<
+	$(MKDIR) -p $(@D)
+	$(TOUCH) $@
+    endef
+
     # Setup a rule for stripping files based on touch files
     $(IMAGES_OUTPUTDIR)/_strip_jre/%.stripped: $(JRE_IMAGE_DIR)/%
-	$(ECHO) Stripping $(patsubst $(OUTPUT_ROOT)/%,%,$<)
-	$(CHMOD) u+w $<
-	$(POST_STRIP_CMD) $<
-	$(CHMOD) go-w $<
-	$(MKDIR) -p $(@D)
-	$(TOUCH) $@
+	$(call strip-file)
+
+    $(IMAGES_OUTPUTDIR)/_strip_jdk/%.stripped: $(JDK_IMAGE_DIR)/%
+	$(call strip-file)
 
-    $(IMAGES_OUTPUTDIR)/_strip_jdk/bin/%.stripped: $(JDK_IMAGE_DIR)/bin/%
-	$(ECHO) Stripping $(patsubst $(OUTPUT_ROOT)/%,%,$<)
-	$(CHMOD) u+w $<
-	$(POST_STRIP_CMD) $<
-	$(CHMOD) go-w $<
-	$(MKDIR) -p $(@D)
-	$(TOUCH) $@
+    $(IMAGES_OUTPUTDIR)/_strip_jre_overlay/%.stripped: $(JRE_OVERLAY_IMAGE_DIR)/%
+	$(call strip-file)
 
-    # Setup a rule for stripping files based on touch files
-    $(IMAGES_OUTPUTDIR)/_strip_jdk/jre/%.stripped: $(JDK_IMAGE_DIR)/jre/%
-	$(ECHO) Stripping $(patsubst $(OUTPUT_ROOT)/%,%,$<)
-	$(CHMOD) u+w $<
-	$(POST_STRIP_CMD) $<
-	$(CHMOD) go-w $<
-	$(MKDIR) -p $(@D)
-	$(TOUCH) $@
+    $(IMAGES_OUTPUTDIR)/_strip_jdk_overlay/%.stripped: $(JDK_OVERLAY_IMAGE_DIR)/%
+	$(call strip-file)
 
 endif
 
@@ -602,7 +737,7 @@
 
 jre-image: $(JRE_BIN_TARGETS) $(JRE_LIB_TARGETS) $(JRE_IMAGE_DIR)/lib/applet \
 	$(JRE_IMAGE_DIR)/lib/meta-index $(JRE_IMAGE_DIR)/lib/ext/meta-index \
-	$(JRE_MAN_PAGE_LIST) $(JRE_DOC_TARGETS) $(JRE_INFO_FILE) $(JRE_EXEC_TOUCH_LIST)
+	$(JRE_MAN_PAGE_LIST) $(JRE_DOC_TARGETS) $(JRE_INFO_FILE) $(JRE_STRIP_LIST)
 
 jdk-image: $(JDK_BIN_TARGETS) $(JDKJRE_BIN_TARGETS) \
 	$(JDK_LIB_TARGETS) $(JDKJRE_LIB_TARGETS) \
@@ -612,9 +747,17 @@
 	$(JDK_MAN_PAGE_LIST) $(JDK_SAMPLE_TARGETS) \
 	$(JDK_DB_TARGETS) $(JDK_INCLUDE_TARGETS) \
 	$(JDKJRE_DOC_TARGETS) $(JDK_DOC_TARGETS) \
-	$(JDK_INFO_FILE) $(JDK_JRE_EXEC_TOUCH_LIST) $(JDK_BIN_EXEC_TOUCH_LIST) \
+	$(JDK_INFO_FILE) $(JDKJRE_STRIP_LIST) $(JDK_BIN_STRIP_LIST) \
         $(JDK_IMAGE_DIR)/src.zip
 
+jre-overlay-image: $(JRE_OVERLAY_BIN_TARGETS) $(JRE_OVERLAY_LIB_TARGETS) \
+	 $(JRE_OVERLAY_INFO_FILE) $(JRE_OVERLAY_STRIP_LIST)
+
+jdk-overlay-image: $(JDK_OVERLAY_BIN_TARGETS) $(JDKJRE_OVERLAY_BIN_TARGETS) \
+	$(JDK_OVERLAY_LIB_TARGETS) $(JDKJRE_OVERLAY_LIB_TARGETS) \
+	$(JDK_OVERLAY_DEMO_TARGETS) $(JDK_OVERLAY_INFO_FILE) \
+	$(JDKJRE_OVERLAY_STRIP_LIST) $(JDK_OVERLAY_BIN_STRIP_LIST) 
+
 ################################################################################
 
 .PHONY: default images jre-image jdk-image
--- a/jdk/makefiles/Import.gmk	Wed Jul 05 18:22:17 2017 +0200
+++ b/jdk/makefiles/Import.gmk	Wed Jul 05 18:22:52 2017 +0200
@@ -41,12 +41,8 @@
 
 # Put the libraries here. Different locations for different target apis.
 ifeq ($(OPENJDK_TARGET_OS_API),posix)
-    ifneq ($(OPENJDK_TARGET_OS),macosx)
-        INSTALL_LIBRARIES_HERE:=$(JDK_OUTPUTDIR)/lib/$(LIBARCH)
-    else
-        INSTALL_LIBRARIES_HERE:=$(JDK_OUTPUTDIR)/lib
-    endif
-    HOTSPOT_LIB_DIR:=$(HOTSPOT_DIST)/jre/lib/$(LIBARCH)
+    INSTALL_LIBRARIES_HERE:=$(JDK_OUTPUTDIR)/lib$(OPENJDK_TARGET_CPU_LIBDIR)
+    HOTSPOT_LIB_DIR:=$(HOTSPOT_DIST)/jre/lib$(OPENJDK_TARGET_CPU_LIBDIR)
 else
     INSTALL_LIBRARIES_HERE:=$(JDK_OUTPUTDIR)/bin
     HOTSPOT_LIB_DIR:=$(HOTSPOT_DIST)/jre/bin
@@ -65,6 +61,7 @@
 $(JDK_OUTPUTDIR)/classes/_the.$1.classes.imported : $$($1_DIST)/lib/classes.jar $$($1_CLASSES_DEP)
 	$(ECHO) Importing $1 classes.jar
 	$(MKDIR) -p $$(@D)
+	$(RM) $$@ $$@.tmp
 	($(CD) $$(@D) && $(JAR) xvf $$< > $$@.tmp)
 	$(MV) $$@.tmp $$@
 endef
@@ -76,6 +73,7 @@
 $(JDK_OUTPUTDIR)/impsrc/_the.$1.src.imported : $$($1_DIST)/lib/src.zip $$($1_SOURCES_DEP)
 	$(ECHO) Importing $1 src.zip
 	$(MKDIR) -p $$(@D)
+	$(RM) $$@ $$@.tmp
 	($(CD) $$(@D) && $(JAR) xvf $$< > $$@.tmp)
 	$(MV) $$@.tmp $$@
 endef
@@ -87,6 +85,7 @@
 $(JDK_OUTPUTDIR)/_the.$1.binaries.imported : $$($1_DIST)/lib/bin.zip $$($1_BINARIES_DEP)
 	$(ECHO) Importing $1 bin.zip
 	$(MKDIR) -p $$(@D)
+	$(RM) $$@ $$@.tmp
 	($(CD) $$(@D) && $(JAR) xvf $$< > $$@.tmp)
 	$(MV) $$@.tmp $$@
 endef
@@ -103,23 +102,26 @@
 
 ifeq ($(OPENJDK_TARGET_OS),solaris)
 define do-install-file
-	$(MKDIR) -p $$(@D)
+	$(MKDIR) -p '$$(@D)'
+	$(RM) '$$@'
 	$(CP) -r -P '$$<' '$$(@D)'
 endef
 else ifeq ($(OPENJDK_TARGET_OS),macosx)
 define do-install-file
-	$(MKDIR) -p $$(@D)
+	$(MKDIR) -p '$$(@D)'
+	$(RM) '$$@'
 	$(CP) -pRP '$$<' '$$@'
 endef
 else
 define do-install-file
-	$(MKDIR) -p $$(@D)
+	$(MKDIR) -p '$$(@D)'
+	$(RM) '$$@'
 	$(CP) -P '$$<' '$$@'
 endef
 endif
 
 define CopyDir
-        $1_SRC_FILES := $(shell $(FIND) $2 -type f)
+        $1_SRC_FILES := $(shell $(FIND) $2 -type f -a ! -name "wb.jar")
         $1_DST_FILES := $$(patsubst $2/%,$3/%,$$($1_SRC_FILES))
         IMPORT_TARGET_FILES += $$($1_DST_FILES)
 $3/% : $2/%
@@ -136,8 +138,8 @@
 $(eval $(call CopyDir,HOTSPOT0, $(HOTSPOT_LIB_DIR), $(INSTALL_LIBRARIES_HERE)))
 $(eval $(call CopyDir,HOTSPOT1, $(HOTSPOT_DIST)/lib, $(JDK_OUTPUTDIR)/lib))
 
-JSIG_DEBUGINFO := $(wildcard $(HOTSPOT_DIST)/jre/lib/$(LIBARCH)/libjsig.debuginfo) \
-                  $(wildcard $(HOTSPOT_DIST)/jre/lib/$(LIBARCH)/libjsig.diz)
+JSIG_DEBUGINFO := $(strip $(wildcard $(HOTSPOT_DIST)/jre/lib$(OPENJDK_TARGET_CPU_LIBDIR)/libjsig.debuginfo) \
+                  $(wildcard $(HOTSPOT_DIST)/jre/lib$(OPENJDK_TARGET_CPU_LIBDIR)/libjsig.diz) )
 
 ifneq ($(OPENJDK_TARGET_OS), windows)
     ifeq ($(JVM_VARIANT_SERVER), true)
@@ -155,64 +157,75 @@
 endif
 
 $(INSTALL_LIBRARIES_HERE)/server/%$(SHARED_LIBRARY_SUFFIX) : $(INSTALL_LIBRARIES_HERE)/%$(SHARED_LIBRARY_SUFFIX)
-	$(RM) -f $@
+	$(MKDIR) -p $(@D)
+	$(RM) $@
 	$(LN) -s ../$(@F) $@
 
 $(INSTALL_LIBRARIES_HERE)/server/%.debuginfo : $(INSTALL_LIBRARIES_HERE)/%.debuginfo
-	$(RM) -f $@
+	$(MKDIR) -p $(@D)
+	$(RM) $@
 	$(LN) -s ../$(@F) $@
 
 $(INSTALL_LIBRARIES_HERE)/server/%.diz : $(INSTALL_LIBRARIES_HERE)/%.diz
-	$(RM) -f $@
+	$(MKDIR) -p $(@D)
+	$(RM) $@
 ifeq (REALLY_WEIRD,1)
 	$(LN) -s ../$(@F) $@
 else
 #
 # TODO: Check if this is what they really want...a zip containing a symlink
 #
-	$(RM) -f $(basename $@).debuginfo
+	$(RM) $@.tmp $(basename $@).debuginfo
 	$(LN) -s ../$(basename $(@F)).debuginfo $(basename $@).debuginfo
-	$(ZIP) -q -y $@ $(basename $@).debuginfo
-	$(RM) -f $(basename $@).debuginfo
+	$(ZIP) -q -y $@.tmp $(basename $@).debuginfo
+	$(RM) $(basename $@).debuginfo
+	$(MV) $@.tmp $@
 endif
 
 $(INSTALL_LIBRARIES_HERE)/client/%$(SHARED_LIBRARY_SUFFIX) : $(INSTALL_LIBRARIES_HERE)/%$(SHARED_LIBRARY_SUFFIX)
-	$(RM) -f $@
+	$(MKDIR) -p $(@D)
+	$(RM) $@
 	$(LN) -s ../$(@F) $@
 
 $(INSTALL_LIBRARIES_HERE)/client/%.debuginfo : $(INSTALL_LIBRARIES_HERE)/%.debuginfo
-	$(RM) -f $@
+	$(MKDIR) -p $(@D)
+	$(RM) $@
 	$(LN) -s ../$(@F) $@
 
 $(INSTALL_LIBRARIES_HERE)/client/%.diz : $(INSTALL_LIBRARIES_HERE)/%.diz
-	$(RM) -f $@
+	$(MKDIR) -p $(@D)
+	$(RM) $@
 ifeq (REALLY_WEIRD,1)
 	$(LN) -s ../$(@F) $@
 else
 #
 # TODO: Check if this is what they really want...a zip containing a symlink
 #
-	$(RM) -f $(basename $@).debuginfo
+	$(RM) $@.tmp $(basename $@).debuginfo
 	$(LN) -s ../$(basename $(@F)).debuginfo $(basename $@).debuginfo
-	$(ZIP) -q -y $@ $(basename $@).debuginfo
-	$(RM) -f $(basename $@).debuginfo
+	$(ZIP) -q -y $@.tmp $(basename $@).debuginfo
+	$(RM) $(basename $@).debuginfo
+	$(MV) $@.tmp $@
 endif
 
 #######
 
 ifeq ($(OPENJDK_TARGET_OS),solaris)
 define install-file
-	$(MKDIR) -p $(@D)
+	$(MKDIR) -p '$(@D)'
+	$(RM) '$@'
 	$(CP) -r -P '$<' '$(@D)'
 endef
 else ifeq ($(OPENJDK_TARGET_OS),macosx)
 define install-file
-	$(MKDIR) -p $(@D)
+	$(MKDIR) -p '$(@D)'
+	$(RM) '$@'
 	$(CP) -pRP '$<' '$@'
 endef
 else
 define install-file
-	$(MKDIR) -p $(@D)
+	$(MKDIR) -p '$(@D)'
+	$(RM) '$@'
 	$(CP) -P '$<' '$@'
 endef
 endif
--- a/jdk/makefiles/Makefile	Wed Jul 05 18:22:17 2017 +0200
+++ b/jdk/makefiles/Makefile	Wed Jul 05 18:22:52 2017 +0200
@@ -26,6 +26,11 @@
 # This must be the first rule
 default: all
 
+# Inclusion of this pseudo-target will cause make to execute this file
+# serially, regardless of -j. Recursively called makefiles will not be
+# affected, however. This is required for correct dependency management.
+.NOTPARALLEL:
+
 include $(SPEC)
 include MakeBase.gmk
 include JavaCompilation.gmk
@@ -37,39 +42,72 @@
 # Setup the build tools.
 include Tools.gmk
 
-all: $(BUILD_TOOLS)
+import: $(BUILD_TOOLS) import-only
+import-only:
 #       Import (corba jaxp jaxws langtools hotspot)
 	+$(MAKE) -f Import.gmk
-#
+
+gensrc: import gensrc-only
+gensrc-only:
 	+$(MAKE) -f GenerateJavaSources.gmk
 #       Ok, now gensrc is fully populated.
+
+gendata: gensrc gendata-only
+gendata-only:
 	+$(MAKE) -f GenerateData.gmk
+
+classes: gendata classes-only
+classes-only:
 	+$(MAKE) -f CompileJavaClasses.gmk
 #       The classes are now built and
 #       any javah files have now been generated.
+
+libs: classes libs-only
+libs-only:
 	+$(MAKE) -f CompileNativeLibraries.gmk
+
+launchers: libs launchers-only
+launchers-only:
 #       Finally compile the launchers.
 	+$(MAKE) -f CompileLaunchers.gmk
+
+genclasses: launchers genclasses-only
+genclasses-only:
 #	Generate classes that have other sources. Needs
 #       to execute launchers.
 	+$(MAKE) -f GenerateClasses.gmk
+
+demos: genclasses demos-only
+demos-only:
 #       Now we have a complete jdk, which you can run.
 #       It is not yet wrapped up as an installed image.
 #       The demos are compiled against this jdk.
 ifndef NO_DEMOS
 	+$(MAKE) -f CompileDemos.gmk
 endif
+
+samples: demos samples-only
+samples-only:
 #	Now copy the sample sources into the jdk.
 ifndef NO_SAMPLES
 	+$(MAKE) -f CopySamples.gmk
 endif
 
+# The all target builds the JDK, but not the images
+all: import gensrc gendata classes libs launchers genclasses demos samples
+
+.PHONY: all images install overlay-images import-only gensrc-only gendata-only classes-only 
+.PHONY: libs-only launchers-only genclasses-only demos-only samples-only
+
 # Create the final jdk and jre images, to be wrapped up
 # into packages, or installed.
 images:
 	+$(MAKE) -f CreateJars.gmk
 	+$(MAKE) -f Images.gmk 
 
+overlay-images:
+	+$(MAKE) -f CompileLaunchers.gmk OVERLAY_IMAGES=true
+	+$(MAKE) -f Images.gmk overlay-images
 
 BINARIES:=$(shell if test -d $(IMAGES_OUTPUTDIR)/j2sdk-image/bin; then cd $(IMAGES_OUTPUTDIR)/j2sdk-image/bin && $(LS) ; fi)
 INSTALLDIR:=openjdk-$(RELEASE)
@@ -84,5 +122,3 @@
 	$(CP) -rp $(IMAGES_OUTPUTDIR)/j2sdk-image/* $(INSTALL_PREFIX)/jvm/$(INSTALLDIR)
 	$(RM) $(addprefix $(INSTALL_PREFIX)/bin/,$(BINARIES))
 	$(foreach b,$(BINARIES),$(LN) -s $(INSTALL_PREFIX)/jvm/$(INSTALLDIR)/bin/$b $(INSTALL_PREFIX)/bin/$b &&) true
-
-.PHONY: all install images
--- a/jdk/makefiles/Setup.gmk	Wed Jul 05 18:22:17 2017 +0200
+++ b/jdk/makefiles/Setup.gmk	Wed Jul 05 18:22:52 2017 +0200
@@ -36,10 +36,8 @@
      JVM:=$(JAVA),\
      JAVAC:=$(JAVAC_JARS),\
      FLAGS:=-source 7 -target 7 -bootclasspath $(BOOT_RTJAR) $(DISABLE_WARNINGS),\
-     SERVER_DIR:=$(JAVAC_SERVERS),\
-     SERVER_JVM:=$(SERVER_JAVA),\
-     MODE:=$(JAVAC_USE_MODE),\
-     USE_DEPS:=$(JAVAC_USE_DEPS)))
+     SERVER_DIR:=$(SJAVAC_SERVER_DIR),\
+     SERVER_JVM:=$(SJAVAC_SERVER_JAVA)))
 
 # The generate new bytecode javac setup uses the new compiler to compile for the
 # new jdk. This new bytecode might only be possible to run using the new jvm.
@@ -47,11 +45,9 @@
      JVM:=$(JAVA),\
      JAVAC:=$(JAVAC_JARS),\
      JAVAH:=$(JAVAH_JARS),\
-     FLAGS:=-bootclasspath "$(JDK_OUTPUTDIR)/classes" -Xprefer:source -XDignore.symbol.file=true $(DISABLE_WARNINGS),\
-     SERVER_DIR:=$(JAVAC_SERVERS),\
-     SERVER_JVM:=$(SERVER_JAVA),\
-     MODE:=$(JAVAC_USE_MODE),\
-     USE_DEPS:=$(JAVAC_USE_DEPS)))
+     FLAGS:=-bootclasspath $(JDK_OUTPUTDIR)/classes -source 7 -target 7 -encoding ascii -XDignore.symbol.file=true $(DISABLE_WARNINGS),\
+     SERVER_DIR:=$(SJAVAC_SERVER_DIR),\
+     SERVER_JVM:=$(SJAVAC_SERVER_JAVA)))
 
 # After the jdk is built, we want to build demos using only the recently
 # generated jdk classes and nothing else, no jdk source, etc etc.
@@ -60,19 +56,6 @@
 $(eval $(call SetupJavaCompiler,GENERATE_USINGJDKBYTECODE,\
      JVM:=$(JAVA),\
      JAVAC:=$(JAVAC_JARS),\
-     FLAGS:= -Xbootclasspath:$(JDK_OUTPUTDIR)/classes $(DISABLE_WARNINGS),\
-     SERVER_DIR:=$(JAVAC_SERVERS),\
-     SERVER_JVM:=$(SERVER_JAVA),\
-     MODE:=$(JAVAC_USE_MODE),\
-     USE_DEPS:=$(JAVAC_USE_DEPS)))
-
-# A temporary solution to work around the fact that Matrix3D.java
-# exists in several applets. The javacserver does not like to be
-# fed the same class twice. Thus we compile one applet outside of the
-# javacserver.
-$(eval $(call SetupJavaCompiler,GENERATE_USINGJDKBYTECODE_NOSERV,\
-     JVM:=$(JAVA),\
-     JAVAC:=$(JAVAC_JARS),\
-     FLAGS:= -Xbootclasspath:$(JDK_OUTPUTDIR)/classes $(DISABLE_WARNINGS),\
-     MODE:=SINGLE_THREADED_BATCH,\
-     USE_DEPS:=FALSE))
+     FLAGS:=-bootclasspath $(JDK_OUTPUTDIR)/classes $(DISABLE_WARNINGS),\
+     SERVER_DIR:=$(SJAVAC_SERVER_DIR),\
+     SERVER_JVM:=$(SJAVAC_SERVER_JAVA)))
--- a/jdk/makefiles/Tools.gmk	Wed Jul 05 18:22:17 2017 +0200
+++ b/jdk/makefiles/Tools.gmk	Wed Jul 05 18:22:52 2017 +0200
@@ -134,8 +134,8 @@
 $(eval $(call SetupNativeCompilation,ADD_GNU_DEBUGLINK,\
 		SRC:=$(JDK_TOPDIR)/make/tools/add_gnu_debuglink,\
 		LANG:=C,\
-		CC:=$(HOST_CC),\
-		LDEXE:=$(HOST_LD),\
+		CC:=$(BUILD_CC),\
+		LDEXE:=$(BUILD_LD),\
 		LDFLAGS:=-lelf,\
 		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/add_gnu_debuglink,\
 		OUTPUT_DIR:=$(JDK_OUTPUTDIR)/btbin,\
@@ -144,8 +144,8 @@
 $(eval $(call SetupNativeCompilation,FIX_EMPTY_SEC_HDR_FLAGS,\
 		SRC:=$(JDK_TOPDIR)/make/tools/fix_empty_sec_hdr_flags,\
 		LANG:=C,\
-		CC:=$(HOST_CC),\
-		LDEXE:=$(HOST_LD),\
+		CC:=$(BUILD_CC),\
+		LDEXE:=$(BUILD_LD),\
 		LDFLAGS:=-lelf,\
 		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/fix_empty_sec_hdr_flags,\
 		OUTPUT_DIR:=$(JDK_OUTPUTDIR)/btbin,\
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/makefiles/mapfiles/launchers/mapfile-x86	Wed Jul 05 18:22:52 2017 +0200
@@ -0,0 +1,48 @@
+#
+# Copyright (c) 2004, 2011, 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.
+#
+#
+# Specify what global symbols we export.  Note that we're not really
+# interested in declaring a version, simply scoping the file is sufficient.
+#
+
+SUNWprivate_1.1 {
+	global:
+		main;		# Provides basic adb symbol offsets
+		environ;	# Public symbols and required by Java run time
+		_environ;
+		__environ_lock;
+		___Argv;	# The following are private, but as they are
+		_start;		# exported from ctr1/crtn, the clever hacker
+		_init;		# might know about them.  However note, that
+		_fini;		# their use is strictly not supported.
+		_lib_version;
+#		_mcount;
+		__fsr;
+		__fsr_init_value;
+		__longdouble_used;
+
+	local:
+		*;
+};
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/makefiles/mapfiles/launchers/mapfile-x86_64	Wed Jul 05 18:22:52 2017 +0200
@@ -0,0 +1,39 @@
+#
+# Copyright (c) 2004, 2011, 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.
+#
+#
+# Specify what global symbols we export.  Note that we're not really
+# interested in declaring a version, simply scoping the file is sufficient.
+#
+
+SUNWprivate_1.1 {
+	global:
+		main;		# Provides basic adb symbol offsets
+		environ;	# Public symbols and required by Java run time
+		_environ;
+		__environ_lock;
+
+	local:
+		*;
+};
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/makefiles/mapfiles/libawt_headless/reorder-x86	Wed Jul 05 18:22:52 2017 +0200
@@ -0,0 +1,1 @@
+# Temporary file for headless
--- a/jdk/makefiles/mapfiles/libjava/mapfile-vers	Wed Jul 05 18:22:17 2017 +0200
+++ b/jdk/makefiles/mapfiles/libjava/mapfile-vers	Wed Jul 05 18:22:52 2017 +0200
@@ -285,6 +285,8 @@
 #		Java_sun_misc_VM_unsuspendSomeThreads;		threads.c
 #		Java_sun_misc_VM_unsuspendThreads;		threads.c
 
+		Java_sun_util_locale_provider_HostLocaleProviderAdapterImpl_getPattern;
+
 	# Outcalls from libjvm done using dlsym().
 
 		VerifyClassCodes;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/makefiles/mapfiles/libjava/reorder-x86	Wed Jul 05 18:22:52 2017 +0200
@@ -0,0 +1,109 @@
+data = R0x2000;
+text = LOAD ?RXO;
+# Test Null
+text: .text%_init;
+text: .text%init64IO: OUTPUTDIR/UnixFileSystem_md.o;
+text: .text%JNI_OnLoad;
+text: .text%Canonicalize;
+text: .text%canonicalize;
+text: .text%collapse: OUTPUTDIR/canonicalize_md.o;
+text: .text%Java_java_lang_Object_registerNatives;
+text: .text%Java_java_lang_System_registerNatives;
+text: .text%Java_java_lang_Thread_registerNatives;
+text: .text%Java_java_security_AccessController_getStackAccessControlContext;
+text: .text%Java_java_security_AccessController_getInheritedAccessControlContext;
+text: .text%Java_java_lang_ClassLoader_registerNatives;
+text: .text%Java_java_security_AccessController_doPrivileged__Ljava_security_PrivilegedAction_2;
+text: .text%Java_java_lang_Class_registerNatives;
+text: .text%Java_java_lang_Class_getPrimitiveClass;
+text: .text%Java_java_lang_System_initProperties;
+text: .text%GetJavaProperties;
+text: .text%uname: OUTPUTDIR/java_props_md.o;
+text: .text%mapLookup: OUTPUTDIR/java_props_md.o;
+text: .text%setPathEnvironment: OUTPUTDIR/java_props_md.o;
+text: .text%JNU_NewStringPlatform;
+text: .text%JNU_CallStaticMethodByName;
+text: .text%NewStringPlatform;
+text: .text%Java_java_io_FileInputStream_initIDs;
+text: .text%Java_java_io_FileDescriptor_initIDs;
+text: .text%Java_java_io_FileOutputStream_initIDs;
+text: .text%Java_java_lang_System_setIn0;
+text: .text%Java_sun_reflect_Reflection_getCallerClass;
+text: .text%Java_java_lang_Class_forName0;
+text: .text%Java_java_lang_String_intern;
+text: .text%Java_sun_reflect_NativeConstructorAccessorImpl_newInstance0;
+text: .text%Java_java_lang_Throwable_fillInStackTrace;
+text: .text%Java_java_lang_System_setOut0;
+text: .text%Java_java_lang_System_setErr0;
+text: .text%Java_java_lang_Compiler_registerNatives;
+text: .text%Java_java_io_FileSystem_getFileSystem;
+text: .text%JNU_NewObjectByName;
+text: .text%Java_java_io_UnixFileSystem_initIDs;
+text: .text%Java_java_security_AccessController_doPrivileged__Ljava_security_PrivilegedExceptionAction_2;
+text: .text%Java_java_io_UnixFileSystem_list;
+text: .text%JNU_GetStringPlatformChars;
+text: .text%JNU_ReleaseStringPlatformChars;
+text: .text%JNU_ClassString;
+text: .text%JNU_CopyObjectArray;
+text: .text%Java_java_io_UnixFileSystem_canonicalize;
+text: .text%Java_java_io_UnixFileSystem_getBooleanAttributes0;
+text: .text%Java_java_lang_ClassLoader_findLoadedClass;
+text: .text%Java_java_lang_ClassLoader_findBootstrapClass;
+text: .text%Java_java_security_AccessController_doPrivileged__Ljava_security_PrivilegedExceptionAction_2Ljava_security_AccessControlContext_2;
+text: .text%Java_java_lang_System_mapLibraryName;
+text: .text%cpchars: OUTPUTDIR/System.o;
+text: .text%Java_java_lang_ClassLoader_00024NativeLibrary_load;
+text: .text%Java_java_lang_ClassLoader_00024NativeLibrary_find;
+text: .text%Java_java_lang_Float_floatToIntBits;
+text: .text%Java_java_lang_Double_doubleToLongBits;
+text: .text%Java_java_io_FileInputStream_open;
+text: .text%fileOpen;
+text: .text%Java_java_io_UnixFileSystem_getLength;
+text: .text%Java_java_io_FileInputStream_readBytes;
+text: .text%readBytes;
+text: .text%Java_java_io_FileInputStream_close0;
+text: .text%Java_java_lang_Object_getClass;
+text: .text%Java_java_lang_ClassLoader_defineClass0;
+text: .text%VerifyClassCodes;
+# Test Exit
+text: .text%Java_java_lang_Shutdown_halt;
+# Test Hello
+text: .text%Java_java_io_FileOutputStream_writeBytes;
+text: .text%writeBytes;
+# Test Sleep
+# Test IntToString
+# Test LoadToolkit
+text: .text%Java_java_util_ResourceBundle_getClassContext;
+text: .text%Java_java_security_AccessController_doPrivileged__Ljava_security_PrivilegedAction_2Ljava_security_AccessControlContext_2;
+text: .text%JNU_GetEnv;
+text: .text%Java_java_io_UnixFileSystem_checkAccess;
+text: .text%Java_sun_reflect_NativeMethodAccessorImpl_invoke0;
+text: .text%Java_java_lang_ref_Finalizer_invokeFinalizeMethod;
+text: .text%Java_java_io_FileInputStream_available;
+text: .text%Java_java_lang_reflect_Array_newArray;
+text: .text%Java_java_lang_Throwable_getStackTraceDepth;
+text: .text%Java_java_lang_Throwable_getStackTraceElement;
+text: .text%Java_java_lang_System_identityHashCode;
+text: .text%Java_sun_misc_Signal_findSignal;
+text: .text%Java_sun_misc_Signal_handle0;
+text: .text%JNU_NotifyAll;
+# Test LoadFrame
+text: .text%JNU_CallMethodByName;
+text: .text%JNU_CallMethodByNameV;
+text: .text%Java_java_util_logging_FileHandler_lockFile;
+text: .text%Java_java_io_FileOutputStream_open;
+text: .text%Java_java_io_UnixFileSystem_createDirectory;
+text: .text%Java_java_io_UnixFileSystem_getLastModifiedTime;
+text: .text%Java_java_util_prefs_FileSystemPreferences_lockFile0;
+text: .text%Java_java_io_UnixFileSystem_setLastModifiedTime;
+text: .text%Java_java_util_prefs_FileSystemPreferences_unlockFile0;
+text: .text%Java_java_io_FileOutputStream_close0;
+text: .text%Java_java_util_logging_FileHandler_unlockFile;
+# Test LoadJFrame
+text: .text%Java_java_lang_Class_isAssignableFrom;
+text: .text%Java_java_lang_Class_isInstance;
+# Test JHello
+# SwingSet
+text: .text%Java_java_util_TimeZone_getSystemTimeZoneID;
+text: .text%findJavaTZ_md;
+text: .text%Java_java_lang_StrictMath_log;
--- a/jdk/makefiles/mapfiles/libjli/mapfile-vers	Wed Jul 05 18:22:17 2017 +0200
+++ b/jdk/makefiles/mapfiles/libjli/mapfile-vers	Wed Jul 05 18:22:52 2017 +0200
@@ -34,6 +34,8 @@
 		JLI_ReportErrorMessageSys;
 		JLI_ReportMessage;
 		JLI_ReportExceptionDescription;
+		JLI_GetStdArgs;
+		JLI_GetStdArgc;
 	local:
 		*;
 };
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/makefiles/mapfiles/libjpeg/reorder-x86	Wed Jul 05 18:22:52 2017 +0200
@@ -0,0 +1,119 @@
+data = R0x2000;
+text = LOAD ?RXO;
+# Test Null
+# Test Exit
+# Test Hello
+# Test Sleep
+# Test IntToString
+# Test LoadToolkit
+# Test LoadFrame
+# Test LoadJFrame
+# Test JHello
+# SwingSet
+text: .text%JNI_OnLoad;
+text: .text%Java_sun_awt_image_JPEGImageDecoder_initIDs;
+text: .text%Java_sun_awt_image_JPEGImageDecoder_readImage;
+text: .text%jStdError;
+text: .text%jCreaDecompress;
+text: .text%jIMemMgr;
+text: .text%jMemInit;
+text: .text%jGetSmall;
+text: .text%jIMReader;
+text: .text%alloc_small: OUTPUTDIR/jmemmgr.o;
+text: .text%reset_marker_reader: OUTPUTDIR/jdmarker.o;
+text: .text%jIInCtlr;
+# text: .text%GET_ARRAYS: OUTPUTDIR/jpegdecoder.o;
+text: .text%jReadHeader;
+text: .text%jConsumeInput;
+text: .text%reset_input_controller: OUTPUTDIR/jdinput.o;
+text: .text%reset_error_mgr: OUTPUTDIR/jerror.o;
+text: .text%sun_jpeg_init_source;
+text: .text%consume_markers: OUTPUTDIR/jdinput.o;
+text: .text%read_markers: OUTPUTDIR/jdmarker.o;
+# text: .text%first_marker: OUTPUTDIR/jdmarker.o;
+text: .text%sun_jpeg_fill_input_buffer;
+# text: .text%RELEASE_ARRAYS: OUTPUTDIR/jpegdecoder.o;
+# text: .text%get_soi: OUTPUTDIR/jdmarker.o;
+text: .text%emit_message: OUTPUTDIR/jerror.o;
+# text: .text%next_marker: OUTPUTDIR/jdmarker.o;
+text: .text%get_interesting_appn: OUTPUTDIR/jdmarker.o;
+# text: .text%examine_app0: OUTPUTDIR/jdmarker.o;
+text: .text%skip_variable: OUTPUTDIR/jdmarker.o;
+text: .text%sun_jpeg_skip_input_data;
+# text: .text%examine_app14: OUTPUTDIR/jdmarker.o;
+text: .text%get_dqt: OUTPUTDIR/jdmarker.o;
+text: .text%jAlcQTable;
+text: .text%get_sof: OUTPUTDIR/jdmarker.o;
+# text: .text%get_dri: OUTPUTDIR/jdmarker.o;
+text: .text%get_dht: OUTPUTDIR/jdmarker.o;
+text: .text%jAlcHTable;
+text: .text%get_sos: OUTPUTDIR/jdmarker.o;
+# text: .text%initial_setup: OUTPUTDIR/jdinput.o;
+text: .text%jDivRound;
+# text: .text%default_decompress_parms: OUTPUTDIR/jdapimin.o;
+text: .text%jHasMultScn;
+text: .text%jStrtDecompress;
+text: .text%jIDMaster;
+# text: .text%master_selection: OUTPUTDIR/jdmaster.o;
+text: .text%jCalcDimensions;
+# text: .text%use_merged_upsample: OUTPUTDIR/jdmaster.o;
+# text: .text%prepare_range_limit_table: OUTPUTDIR/jdmaster.o;
+text: .text%jIDColor;
+# text: .text%build_ycc_rgb_table: OUTPUTDIR/jdcolor.o;
+text: .text%jIUpsampler;
+text: .text%jRound;
+text: .text%alloc_sarray: OUTPUTDIR/jmemmgr.o;
+text: .text%alloc_large: OUTPUTDIR/jmemmgr.o;
+text: .text%jGetLarge;
+text: .text%jIDPostC;
+text: .text%jIIDCT;
+text: .text%jIHDecoder;
+text: .text%jIDCoefC;
+text: .text%jIDMainC;
+# text: .text%alloc_funny_pointers: OUTPUTDIR/jdmainct.o;
+text: .text%realize_virt_arrays: OUTPUTDIR/jmemmgr.o;
+text: .text%start_input_pass: OUTPUTDIR/jdinput.o;
+# text: .text%per_scan_setup: OUTPUTDIR/jdinput.o;
+# text: .text%latch_quant_tables: OUTPUTDIR/jdinput.o;
+text: .text%start_pass_huff_decoder: OUTPUTDIR/jdhuff.o;
+text: .text%jMkDDerived;
+text: .text%start_input_pass: OUTPUTDIR/jdcoefct.o;
+# text: .text%start_iMCU_row: OUTPUTDIR/jdcoefct.o;
+# text: .text%output_pass_setup: OUTPUTDIR/jdapistd.o;
+text: .text%prepare_for_output_pass: OUTPUTDIR/jdmaster.o;
+text: .text%start_pass: OUTPUTDIR/jddctmgr.o;
+text: .text%start_output_pass: OUTPUTDIR/jdcoefct.o;
+text: .text%start_pass_dcolor: OUTPUTDIR/jdcolor.o;
+text: .text%start_pass_upsample: OUTPUTDIR/jdsample.o;
+text: .text%start_pass_dpost: OUTPUTDIR/jdpostct.o;
+text: .text%start_pass_main: OUTPUTDIR/jdmainct.o;
+# text: .text%make_funny_pointers: OUTPUTDIR/jdmainct.o;
+text: .text%jReadScanlines;
+text: .text%process_data_context_main: OUTPUTDIR/jdmainct.o;
+text: .text%decompress_onepass: OUTPUTDIR/jdcoefct.o;
+text: .text%jZeroFar;
+text: .text%decode_mcu: OUTPUTDIR/jdhuff.o;
+text: .text%jFilBitBuf;
+text: .text%jHufDecode;
+text: .text%jRDislow;
+text: .text%sep_upsample: OUTPUTDIR/jdsample.o;
+text: .text%fullsize_upsample: OUTPUTDIR/jdsample.o;
+text: .text%h2v2_fancy_upsample: OUTPUTDIR/jdsample.o;
+text: .text%ycc_rgb_convert: OUTPUTDIR/jdcolor.o;
+# text: .text%set_wraparound_pointers: OUTPUTDIR/jdmainct.o;
+# text: .text%process_restart: OUTPUTDIR/jdhuff.o;
+text: .text%read_restart_marker: OUTPUTDIR/jdmarker.o;
+text: .text%finish_input_pass: OUTPUTDIR/jdinput.o;
+# text: .text%set_bottom_pointers: OUTPUTDIR/jdmainct.o;
+text: .text%jFinDecompress;
+text: .text%finish_output_pass: OUTPUTDIR/jdmaster.o;
+text: .text%sun_jpeg_term_source;
+text: .text%jAbort;
+text: .text%free_pool: OUTPUTDIR/jmemmgr.o;
+text: .text%jFreeLarge;
+text: .text%jFreeSmall;
+text: .text%jDestDecompress;
+text: .text%jDestroy;
+text: .text%self_destruct: OUTPUTDIR/jmemmgr.o;
+text: .text%jMemTerm;
+text: .text%process_data_simple_main: OUTPUTDIR/jdmainct.o;
--- a/jdk/makefiles/mapfiles/libnio/mapfile-linux	Wed Jul 05 18:22:17 2017 +0200
+++ b/jdk/makefiles/mapfiles/libnio/mapfile-linux	Wed Jul 05 18:22:52 2017 +0200
@@ -143,6 +143,7 @@
 		Java_sun_nio_fs_LinuxNativeDispatcher_fsetxattr0;
 		Java_sun_nio_fs_LinuxNativeDispatcher_fremovexattr0;
 		Java_sun_nio_fs_LinuxNativeDispatcher_setmntent0;
+                Java_sun_nio_fs_LinuxNativeDispatcher_getmntent;
 		Java_sun_nio_fs_LinuxNativeDispatcher_endmntent;
 		Java_sun_nio_fs_UnixNativeDispatcher_init;
 		Java_sun_nio_fs_UnixNativeDispatcher_getcwd;
@@ -189,7 +190,6 @@
 		Java_sun_nio_fs_UnixNativeDispatcher_getgrgid;
 		Java_sun_nio_fs_UnixNativeDispatcher_getpwnam0;
 		Java_sun_nio_fs_UnixNativeDispatcher_getgrnam0;
-		Java_sun_nio_fs_UnixNativeDispatcher_getextmntent;
 		Java_sun_nio_fs_UnixCopyFile_transfer;
 		handleSocketError;
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/makefiles/mapfiles/libnio/mapfile-macosx	Wed Jul 05 18:22:52 2017 +0200
@@ -0,0 +1,174 @@
+#
+# Copyright (c) 2001, 2011, 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.
+#
+
+SUNWprivate_1.1 {
+	global:
+                Java_java_nio_MappedByteBuffer_force0;
+                Java_java_nio_MappedByteBuffer_isLoaded0;
+                Java_java_nio_MappedByteBuffer_load0;
+                Java_sun_nio_ch_DatagramChannelImpl_disconnect0;
+                Java_sun_nio_ch_DatagramChannelImpl_initIDs;
+                Java_sun_nio_ch_DatagramChannelImpl_receive0;
+                Java_sun_nio_ch_DatagramChannelImpl_send0;
+                Java_sun_nio_ch_DatagramDispatcher_read0;
+                Java_sun_nio_ch_DatagramDispatcher_readv0;
+                Java_sun_nio_ch_DatagramDispatcher_write0;
+                Java_sun_nio_ch_DatagramDispatcher_writev0;
+                Java_sun_nio_ch_FileChannelImpl_close0;
+                Java_sun_nio_ch_FileChannelImpl_initIDs;
+                Java_sun_nio_ch_FileChannelImpl_map0;
+                Java_sun_nio_ch_FileChannelImpl_position0;
+                Java_sun_nio_ch_FileChannelImpl_transferTo0;
+                Java_sun_nio_ch_FileChannelImpl_unmap0;
+                Java_sun_nio_ch_FileDispatcherImpl_close0;
+                Java_sun_nio_ch_FileDispatcherImpl_closeIntFD;
+		Java_sun_nio_ch_FileDispatcherImpl_force0;
+                Java_sun_nio_ch_FileDispatcherImpl_init;
+		Java_sun_nio_ch_FileDispatcherImpl_lock0;
+                Java_sun_nio_ch_FileDispatcherImpl_preClose0;
+                Java_sun_nio_ch_FileDispatcherImpl_pread0;
+                Java_sun_nio_ch_FileDispatcherImpl_pwrite0;
+                Java_sun_nio_ch_FileDispatcherImpl_read0;
+                Java_sun_nio_ch_FileDispatcherImpl_readv0;
+		Java_sun_nio_ch_FileDispatcherImpl_release0;
+		Java_sun_nio_ch_FileDispatcherImpl_size0;
+		Java_sun_nio_ch_FileDispatcherImpl_truncate0;
+                Java_sun_nio_ch_FileDispatcherImpl_write0;
+                Java_sun_nio_ch_FileDispatcherImpl_writev0;
+                Java_sun_nio_ch_FileKey_init;
+                Java_sun_nio_ch_FileKey_initIDs;
+		Java_sun_nio_ch_InheritedChannel_close0;
+		Java_sun_nio_ch_InheritedChannel_dup;
+		Java_sun_nio_ch_InheritedChannel_dup2;
+		Java_sun_nio_ch_InheritedChannel_open0;
+		Java_sun_nio_ch_InheritedChannel_peerAddress0;
+		Java_sun_nio_ch_InheritedChannel_peerPort0;
+		Java_sun_nio_ch_InheritedChannel_soType0;
+                Java_sun_nio_ch_IOUtil_configureBlocking;
+                Java_sun_nio_ch_IOUtil_drain;
+                Java_sun_nio_ch_IOUtil_fdVal;
+                Java_sun_nio_ch_IOUtil_initIDs;
+                Java_sun_nio_ch_IOUtil_makePipe;
+                Java_sun_nio_ch_IOUtil_randomBytes;
+                Java_sun_nio_ch_IOUtil_setfdVal;
+		Java_sun_nio_ch_KQueue_kqueue;
+		Java_sun_nio_ch_KQueue_keventRegister;
+		Java_sun_nio_ch_KQueue_keventPoll;
+		Java_sun_nio_ch_KQueue_keventSize;
+		Java_sun_nio_ch_KQueue_identOffset;
+		Java_sun_nio_ch_KQueue_filterOffset;
+		Java_sun_nio_ch_KQueue_flagsOffset;
+		Java_sun_nio_ch_KQueuePort_socketpair;
+		Java_sun_nio_ch_KQueuePort_interrupt;
+		Java_sun_nio_ch_KQueuePort_drain1;
+		Java_sun_nio_ch_KQueuePort_close0;
+		Java_sun_nio_ch_NativeThread_current;
+		Java_sun_nio_ch_NativeThread_init;
+		Java_sun_nio_ch_NativeThread_signal;
+		Java_sun_nio_ch_Net_canIPv6SocketJoinIPv4Group0;
+		Java_sun_nio_ch_Net_canJoin6WithIPv4Group0;
+		Java_sun_nio_ch_Net_socket0;
+		Java_sun_nio_ch_Net_bind0;
+		Java_sun_nio_ch_Net_connect0;
+		Java_sun_nio_ch_Net_listen;
+		Java_sun_nio_ch_Net_localPort;
+		Java_sun_nio_ch_Net_localInetAddress;
+		Java_sun_nio_ch_Net_getIntOption0;
+		Java_sun_nio_ch_Net_setIntOption0;
+                Java_sun_nio_ch_Net_initIDs;
+		Java_sun_nio_ch_Net_isIPv6Available0;
+		Java_sun_nio_ch_Net_joinOrDrop4;
+		Java_sun_nio_ch_Net_blockOrUnblock4;
+		Java_sun_nio_ch_Net_joinOrDrop6;
+		Java_sun_nio_ch_Net_blockOrUnblock6;
+		Java_sun_nio_ch_Net_setInterface4;
+		Java_sun_nio_ch_Net_getInterface4;
+		Java_sun_nio_ch_Net_setInterface6;
+		Java_sun_nio_ch_Net_getInterface6;
+		Java_sun_nio_ch_Net_shutdown;
+                Java_sun_nio_ch_PollArrayWrapper_interrupt;
+                Java_sun_nio_ch_PollArrayWrapper_poll0;
+                Java_sun_nio_ch_ServerSocketChannelImpl_accept0;
+                Java_sun_nio_ch_ServerSocketChannelImpl_initIDs;
+                Java_sun_nio_ch_SocketChannelImpl_checkConnect;
+		Java_sun_nio_ch_SocketChannelImpl_sendOutOfBandData;
+		Java_sun_nio_ch_UnixAsynchronousServerSocketChannelImpl_accept0;
+		Java_sun_nio_ch_UnixAsynchronousServerSocketChannelImpl_initIDs;
+		Java_sun_nio_ch_UnixAsynchronousSocketChannelImpl_checkConnect;
+		Java_sun_nio_fs_BsdNativeDispatcher_initIDs;
+		Java_sun_nio_fs_BsdNativeDispatcher_getfsstat;
+		Java_sun_nio_fs_BsdNativeDispatcher_fsstatEntry;
+		Java_sun_nio_fs_BsdNativeDispatcher_endfsstat;
+		Java_sun_nio_fs_UnixNativeDispatcher_init;
+		Java_sun_nio_fs_UnixNativeDispatcher_getcwd;
+		Java_sun_nio_fs_UnixNativeDispatcher_strerror;
+		Java_sun_nio_fs_UnixNativeDispatcher_dup;
+		Java_sun_nio_fs_UnixNativeDispatcher_access0;
+		Java_sun_nio_fs_UnixNativeDispatcher_stat0;
+		Java_sun_nio_fs_UnixNativeDispatcher_lstat0;
+		Java_sun_nio_fs_UnixNativeDispatcher_fstat;
+		Java_sun_nio_fs_UnixNativeDispatcher_fstatat0;
+		Java_sun_nio_fs_UnixNativeDispatcher_chmod0;
+		Java_sun_nio_fs_UnixNativeDispatcher_fchmod;
+		Java_sun_nio_fs_UnixNativeDispatcher_chown0;
+		Java_sun_nio_fs_UnixNativeDispatcher_lchown0;
+		Java_sun_nio_fs_UnixNativeDispatcher_fchown;
+		Java_sun_nio_fs_UnixNativeDispatcher_utimes0;
+		Java_sun_nio_fs_UnixNativeDispatcher_futimes;
+		Java_sun_nio_fs_UnixNativeDispatcher_open0;
+		Java_sun_nio_fs_UnixNativeDispatcher_openat0;
+		Java_sun_nio_fs_UnixNativeDispatcher_close;
+		Java_sun_nio_fs_UnixNativeDispatcher_read;
+		Java_sun_nio_fs_UnixNativeDispatcher_write;
+		Java_sun_nio_fs_UnixNativeDispatcher_fopen0;
+		Java_sun_nio_fs_UnixNativeDispatcher_fclose;
+		Java_sun_nio_fs_UnixNativeDispatcher_opendir0;
+		Java_sun_nio_fs_UnixNativeDispatcher_fdopendir;
+		Java_sun_nio_fs_UnixNativeDispatcher_readdir;
+		Java_sun_nio_fs_UnixNativeDispatcher_closedir;
+		Java_sun_nio_fs_UnixNativeDispatcher_link0;
+		Java_sun_nio_fs_UnixNativeDispatcher_unlink0;
+		Java_sun_nio_fs_UnixNativeDispatcher_unlinkat0;
+		Java_sun_nio_fs_UnixNativeDispatcher_rename0;
+		Java_sun_nio_fs_UnixNativeDispatcher_renameat0;
+		Java_sun_nio_fs_UnixNativeDispatcher_mkdir0;
+		Java_sun_nio_fs_UnixNativeDispatcher_rmdir0;
+		Java_sun_nio_fs_UnixNativeDispatcher_symlink0;
+		Java_sun_nio_fs_UnixNativeDispatcher_readlink0;
+		Java_sun_nio_fs_UnixNativeDispatcher_realpath0;
+		Java_sun_nio_fs_UnixNativeDispatcher_statvfs0;
+		Java_sun_nio_fs_UnixNativeDispatcher_pathconf0;
+		Java_sun_nio_fs_UnixNativeDispatcher_fpathconf;
+		Java_sun_nio_fs_UnixNativeDispatcher_mknod0;
+		Java_sun_nio_fs_UnixNativeDispatcher_getpwuid;
+		Java_sun_nio_fs_UnixNativeDispatcher_getgrgid;
+		Java_sun_nio_fs_UnixNativeDispatcher_getpwnam0;
+		Java_sun_nio_fs_UnixNativeDispatcher_getgrnam0;
+		Java_sun_nio_fs_UnixCopyFile_transfer;
+		handleSocketError;
+
+	local:
+		*;
+};
--- a/jdk/makefiles/mapfiles/libnio/mapfile-solaris	Wed Jul 05 18:22:17 2017 +0200
+++ b/jdk/makefiles/mapfiles/libnio/mapfile-solaris	Wed Jul 05 18:22:52 2017 +0200
@@ -169,10 +169,10 @@
 		Java_sun_nio_fs_UnixNativeDispatcher_getgrgid;
 		Java_sun_nio_fs_UnixNativeDispatcher_getpwnam0;
 		Java_sun_nio_fs_UnixNativeDispatcher_getgrnam0;
-		Java_sun_nio_fs_UnixNativeDispatcher_getextmntent;
 		Java_sun_nio_fs_UnixCopyFile_transfer;
 		Java_sun_nio_fs_SolarisNativeDispatcher_init;
 		Java_sun_nio_fs_SolarisNativeDispatcher_facl;
+		Java_sun_nio_fs_SolarisNativeDispatcher_getextmntent;
 		Java_sun_nio_fs_SolarisWatchService_init;
 		Java_sun_nio_fs_SolarisWatchService_portCreate;
 		Java_sun_nio_fs_SolarisWatchService_portAssociate;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/makefiles/mapfiles/libnio/reorder-x86	Wed Jul 05 18:22:52 2017 +0200
@@ -0,0 +1,17 @@
+data = R0x2000;
+text = LOAD ?RXO;
+# Test Null
+# Test Exit
+# Test Hello
+# Test Sleep
+# Test IntToString
+# Test LoadToolkit
+text: .text%Java_sun_nio_ch_FileChannelImpl_initIDs;
+text: .text%Java_sun_nio_ch_FileDispatcher_initIDs;
+text: .text%Java_sun_nio_ch_IOUtil_initIDs;
+text: .text%Java_sun_nio_ch_FileDispatcher_read0;
+text: .text%convertReturnVal;
+# Test LoadFrame
+# Test LoadJFrame
+# Test JHello
+# SwingSet
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/makefiles/mapfiles/libverify/reorder-x86	Wed Jul 05 18:22:52 2017 +0200
@@ -0,0 +1,40 @@
+data = R0x2000;
+text = LOAD ?RXO;
+# Test Null
+text: .text%VerifyFixClassname;
+text: .text%VerifyClassname;
+text: .text%skip_over_fieldname: OUTPUTDIR/check_format.o;
+text: .text%skip_over_field_signature: OUTPUTDIR/check_format.o;
+text: .text%VerifyClass;
+text: .text%make_class_info_from_name: OUTPUTDIR/check_code.o;
+text: .text%class_name_to_ID: OUTPUTDIR/check_code.o;
+text: .text%make_class_info: OUTPUTDIR/check_code.o;
+text: .text%free_block: OUTPUTDIR/check_code.o;
+text: .text%verify_method: OUTPUTDIR/check_code.o;
+text: .text%verify_opcode_operands: OUTPUTDIR/check_code.o;
+text: .text%initialize_dataflow: OUTPUTDIR/check_code.o;
+text: .text%signature_to_fieldtype: OUTPUTDIR/check_code.o;
+text: .text%check_register_values: OUTPUTDIR/check_code.o;
+text: .text%pop_stack: OUTPUTDIR/check_code.o;
+text: .text%update_registers: OUTPUTDIR/check_code.o;
+text: .text%push_stack: OUTPUTDIR/check_code.o;
+text: .text%merge_into_successors: OUTPUTDIR/check_code.o;
+text: .text%cp_index_to_class_fullinfo: OUTPUTDIR/check_code.o;
+text: .text%set_protected: OUTPUTDIR/check_code.o;
+text: .text%merge_into_one_successor: OUTPUTDIR/check_code.o;
+text: .text%merge_registers: OUTPUTDIR/check_code.o;
+# Test Exit
+# Test Hello
+text: .text%merge_fullinfo_types: OUTPUTDIR/check_code.o;
+text: .text%isAssignableTo: OUTPUTDIR/check_code.o;
+# Test Sleep
+text: .text%isLegalTarget: OUTPUTDIR/check_code.o;
+text: .text%verify_constant_pool_type: OUTPUTDIR/check_code.o;
+# Test IntToString
+# Test LoadToolkit
+# Test LoadFrame
+# Test LoadJFrame
+# Test JHello
+# SwingSet
+text: .text%copy_stack: OUTPUTDIR/check_code.o;
+text: .text%ntohl: OUTPUTDIR/check_code.o;
--- a/jdk/makefiles/mapfiles/libzip/mapfile-vers	Wed Jul 05 18:22:17 2017 +0200
+++ b/jdk/makefiles/mapfiles/libzip/mapfile-vers	Wed Jul 05 18:22:52 2017 +0200
@@ -37,16 +37,12 @@
 		Java_java_util_zip_Deflater_deflateBytes;
 		Java_java_util_zip_Deflater_end;
 		Java_java_util_zip_Deflater_getAdler;
-		Java_java_util_zip_Deflater_getBytesRead;
-		Java_java_util_zip_Deflater_getBytesWritten;
 		Java_java_util_zip_Deflater_init;
 		Java_java_util_zip_Deflater_initIDs;
 		Java_java_util_zip_Deflater_reset;
 		Java_java_util_zip_Deflater_setDictionary;
 		Java_java_util_zip_Inflater_end;
 		Java_java_util_zip_Inflater_getAdler;
-		Java_java_util_zip_Inflater_getBytesRead;
-		Java_java_util_zip_Inflater_getBytesWritten;
 		Java_java_util_zip_Inflater_inflateBytes;
 		Java_java_util_zip_Inflater_init;
 		Java_java_util_zip_Inflater_initIDs;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/makefiles/mapfiles/libzip/reorder-x86	Wed Jul 05 18:22:52 2017 +0200
@@ -0,0 +1,49 @@
+data = R0x2000;
+text = LOAD ?RXO;
+# Test Null
+text: .text%ZIP_Open;
+text: .text%ZIP_Open_Generic;
+text: .text%InitializeZip;
+text: .text%allocZip;
+text: .text%readCEN: OUTPUTDIR/zip_util.o;
+text: .text%findEND: OUTPUTDIR/zip_util.o;
+text: .text%hash: OUTPUTDIR/zip_util.o;
+text: .text%isMetaName: OUTPUTDIR/zip_util.o;
+text: .text%addMetaName: OUTPUTDIR/zip_util.o;
+text: .text%ZIP_FindEntry;
+text: .text%ZIP_GetEntry;
+text: .text%ZIP_Lock;
+text: .text%readLOC: OUTPUTDIR/zip_util.o;
+text: .text%ZIP_Unlock;
+text: .text%ZIP_FreeEntry;
+text: .text%Java_java_util_zip_ZipFile_initIDs;
+text: .text%Java_java_util_zip_ZipFile_open;
+text: .text%Java_java_util_zip_ZipFile_getTotal;
+text: .text%Java_java_util_zip_ZipFile_getEntry;
+text: .text%Java_java_util_zip_ZipFile_freeEntry;
+text: .text%Java_java_util_zip_ZipFile_getEntryTime;
+text: .text%Java_java_util_zip_ZipFile_getEntryCrc;
+text: .text%Java_java_util_zip_ZipFile_getEntryCSize;
+text: .text%Java_java_util_zip_ZipFile_getEntrySize;
+text: .text%Java_java_util_zip_ZipFile_getEntryFlag;
+text: .text%Java_java_util_zip_ZipFile_getEntryMethod;
+text: .text%Java_java_util_zip_ZipFile_getEntryBytes;
+text: .text%Java_java_util_zip_Inflater_initIDs;
+text: .text%Java_java_util_zip_Inflater_init;
+text: .text%inflateInit2_;
+text: .text%zcalloc;
+text: .text%inflateReset;
+text: .text%Java_java_util_zip_Inflater_inflateBytes;
+text: .text%inflate;
+text: .text%Java_java_util_zip_ZipFile_read;
+text: .text%ZIP_Read;
+text: .text%huft_build: OUTPUTDIR/inftrees.o;
+text: .text%zcfree;
+text: .text%Java_java_util_jar_JarFile_getMetaInfEntryNames;
+text: .text%ZIP_ReadEntry;
+text: .text%InflateFully;
+text: .text%inflateEnd;
+text: .text%Java_java_util_zip_Inflater_reset;
+text: .text%Java_java_util_zip_ZipFile_close;
+text: .text%ZIP_Close;
+text: .text%Java_java_util_zip_Inflater_end;
--- a/langtools/.hgtags	Wed Jul 05 18:22:17 2017 +0200
+++ b/langtools/.hgtags	Wed Jul 05 18:22:52 2017 +0200
@@ -177,3 +177,4 @@
 d3d0b9cd76e04bf9e381b402630ac3cfe464bb38 jdk8-b53
 9cf72631baf5cb1ebd8736c5efeab7746977ea68 jdk8-b54
 e48e7e1f026b82d921433150180799898c088890 jdk8-b55
+363e9198b9de68ebf37a3e2c2f3f23543d3915cd jdk8-b56
--- a/langtools/makefiles/Makefile	Wed Jul 05 18:22:17 2017 +0200
+++ b/langtools/makefiles/Makefile	Wed Jul 05 18:22:52 2017 +0200
@@ -34,8 +34,9 @@
 # and the bootstrap javac, to be run by the bootdir jvm.
 $(eval $(call SetupJavaCompiler,BOOT_JAVAC,\
 	JAVAC:=$(JAVAC),\
-        FLAGS:=-Xprefer:source -XDignore.symbol.file=true -g,\
-        MODE:=SINGLE_THREADED_BATCH))
+        SERVER_DIR:=$(SJAVAC_SERVER_DIR),\
+        SERVER_JVM:=$(SJAVAC_SERVER_JAVA),\
+        FLAGS:=-XDignore.symbol.file=true -g -Xlint:all$(COMMA)-deprecation -Werror))
 
 # Now setup the compilation of the properties compilation tool. You can depend
 # upon $(BUILD_TOOLS) to trigger a compilation of the tools. Note that we
@@ -43,6 +44,8 @@
 # program needs to be linked and run towards the new javac sources.
 $(eval $(call SetupJavaCompilation,BUILD_TOOLS,\
 		SETUP:=BOOT_JAVAC,\
+		DISABLE_SJAVAC:=true,\
+                ADD_JAVAC_FLAGS:=-Xprefer:source,\
 		SRC:=$(LANGTOOLS_TOPDIR)/make/tools $(LANGTOOLS_TOPDIR)/src/share/classes,\
 		INCLUDES:=compileproperties genstubs,\
 		BIN:=$(LANGTOOLS_OUTPUTDIR)/btclasses))
@@ -93,6 +96,7 @@
         # to compile javac again and to build the complete new jdk.
         $(eval $(call SetupJavaCompilation,BUILD_BOOTSTRAP_LANGTOOLS,\
 		SETUP:=BOOT_JAVAC,\
+		DISABLE_SJAVAC:=true,\
 		SRC:=$(LANGTOOLS_TOPDIR)/src/share/classes $(LANGTOOLS_OUTPUTDIR)/gensrc,\
 		EXCLUDES:=com/sun/tools/javac/nio,\
 		BIN:=$(LANGTOOLS_OUTPUTDIR)/btclasses/bootstrap))
@@ -122,7 +126,7 @@
         # exercises the functionality to verify that it works.
         TOOL_GENSTUBS_CMD=$(JAVA) \
              "-Xbootclasspath/p:$(LANGTOOLS_OUTPUTDIR)/dist/bootstrap/lib/javac.jar" \
-             -cp "$(LANGTOOLS_OUTPUTDIR)/dist/bootstrap/lib/javac.jar$(PATH_SEP)$(LANGTOOLS_OUTPUTDIR)/btclasses" \
+             -classpath $(LANGTOOLS_OUTPUTDIR)/btclasses \
              genstubs.GenStubs
         # We fetch source from the JDK...
         JDKS=$(JDK_TOPDIR)/src/share/classes
@@ -164,11 +168,9 @@
                   JVM:=$(JAVA),\
                   JAVAC:="-Xbootclasspath/p:$(LANGTOOLS_OUTPUTDIR)/dist/bootstrap/lib/javac.jar" \
 			 -jar $(LANGTOOLS_OUTPUTDIR)/dist/bootstrap/lib/javac.jar,\
-                  FLAGS:=-Xprefer:source -XDignore.symbol.file=true,\
-                  SERVER_DIR:=$(JAVAC_SERVERS),\
-                  SERVER_JVM:=$(SERVER_JAVA),\
-                  MODE:=$(JAVAC_USE_MODE),\
-		  USE_DEPS:=$(JAVAC_USE_DEPS)))
+                  FLAGS:=-XDignore.symbol.file=true -Xlint:all$(COMMA)-deprecation -Werror,\
+                  SERVER_DIR:=$(SJAVAC_SERVER_DIR),\
+                  SERVER_JVM:=$(SJAVAC_SERVER_JAVA)))
 
                 # javax.tools.JavaCompilerTool isn't really a suffix but this gets the file copied.
 		RESOURCE_SUFFIXES:=.gif .xml .css javax.tools.JavaCompilerTool