7197849: Update new build-infra makefiles
authorohair
Tue, 18 Sep 2012 11:29:16 -0700
changeset 13697 5262b00bc10c
parent 13694 ffe6bce5a521
child 13698 b3dd9df01aa0
7197849: Update new build-infra makefiles Reviewed-by: ihse, erikj, ohrstrom, tbell
.hgignore
Makefile
NewMakefile.gmk
common/autoconf/autogen.sh
common/autoconf/basics.m4
common/autoconf/boot-jdk.m4
common/autoconf/bootcycle-spec.gmk.in
common/autoconf/build-aux/config.guess
common/autoconf/build-performance.m4
common/autoconf/builddeps.conf.example
common/autoconf/builddeps.m4
common/autoconf/compare.sh.in
common/autoconf/configure
common/autoconf/configure.ac
common/autoconf/generated-configure.sh
common/autoconf/hotspot-spec.gmk.in
common/autoconf/jdk-options.m4
common/autoconf/libraries.m4
common/autoconf/platform.m4
common/autoconf/source-dirs.m4
common/autoconf/spec.gmk.in
common/autoconf/spec.sh.in
common/autoconf/toolchain.m4
common/bin/boot_cycle.sh
common/bin/compare-objects.sh
common/bin/test_builds.sh
common/bin/unicode2x.sed
common/makefiles/HotspotWrapper.gmk
common/makefiles/JavaCompilation.gmk
common/makefiles/MakeBase.gmk
common/makefiles/MakeHelpers.gmk
common/makefiles/Makefile
common/makefiles/NativeCompilation.gmk
common/makefiles/javadoc/CORE_PKGS.gmk
common/makefiles/javadoc/Javadoc.gmk
common/makefiles/javadoc/NON_CORE_PKGS.gmk
common/makefiles/javadoc/Notes.html
--- a/.hgignore	Wed Jul 05 18:22:17 2017 +0200
+++ b/.hgignore	Tue Sep 18 11:29:16 2012 -0700
@@ -1,6 +1,7 @@
 ^build/
 ^dist/
-/nbproject/private/
+nbproject/private/
 ^webrev
 ^.hgtip
+^.bridge2
 .DS_Store
--- a/Makefile	Wed Jul 05 18:22:17 2017 +0200
+++ b/Makefile	Tue Sep 18 11:29:16 2012 -0700
@@ -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	Tue Sep 18 11:29:16 2012 -0700
@@ -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	Tue Sep 18 11:29:16 2012 -0700
@@ -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	Tue Sep 18 11:29:16 2012 -0700
@@ -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	Tue Sep 18 11:29:16 2012 -0700
@@ -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	Tue Sep 18 11:29:16 2012 -0700
@@ -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	Tue Sep 18 11:29:16 2012 -0700
@@ -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	Tue Sep 18 11:29:16 2012 -0700
@@ -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	Tue Sep 18 11:29:16 2012 -0700
@@ -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	Tue Sep 18 11:29:16 2012 -0700
@@ -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	Tue Sep 18 11:29:16 2012 -0700
@@ -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	Tue Sep 18 11:29:16 2012 -0700
@@ -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	Tue Sep 18 11:29:16 2012 -0700
@@ -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	Tue Sep 18 11:29:16 2012 -0700
@@ -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	Tue Sep 18 11:29:16 2012 -0700
@@ -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	Tue Sep 18 11:29:16 2012 -0700
@@ -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	Tue Sep 18 11:29:16 2012 -0700
@@ -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	Tue Sep 18 11:29:16 2012 -0700
@@ -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	Tue Sep 18 11:29:16 2012 -0700
@@ -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	Tue Sep 18 11:29:16 2012 -0700
@@ -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	Tue Sep 18 11:29:16 2012 -0700
@@ -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	Tue Sep 18 11:29:16 2012 -0700
@@ -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	Tue Sep 18 11:29:16 2012 -0700
@@ -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	Tue Sep 18 11:29:16 2012 -0700
@@ -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	Tue Sep 18 11:29:16 2012 -0700
@@ -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	Tue Sep 18 11:29:16 2012 -0700
@@ -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	Tue Sep 18 11:29:16 2012 -0700
@@ -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	Tue Sep 18 11:29:16 2012 -0700
@@ -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	Tue Sep 18 11:29:16 2012 -0700
@@ -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	Tue Sep 18 11:29:16 2012 -0700
@@ -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	Tue Sep 18 11:29:16 2012 -0700
@@ -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	Tue Sep 18 11:29:16 2012 -0700
@@ -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	Tue Sep 18 11:29:16 2012 -0700
@@ -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	Tue Sep 18 11:29:16 2012 -0700
@@ -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	Tue Sep 18 11:29:16 2012 -0700
@@ -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	Tue Sep 18 11:29:16 2012 -0700
@@ -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>