8038340: Cleanup and fix sysroot and devkit handling on Linux and Solaris

Mon, 16 Apr 2018 00:48:00 -0700

author
kevinw
date
Mon, 16 Apr 2018 00:48:00 -0700
changeset 2215
7a73b8b4ac8a
parent 2214
fda76d0c4b84
child 2216
0c4c976612d3
child 2217
310b1d9c5772

8038340: Cleanup and fix sysroot and devkit handling on Linux and Solaris
Reviewed-by: erikj, ihse

common/autoconf/basics.m4 file | annotate | diff | comparison | revisions
common/autoconf/build-performance.m4 file | annotate | diff | comparison | revisions
common/autoconf/configure.ac file | annotate | diff | comparison | revisions
common/autoconf/flags.m4 file | annotate | diff | comparison | revisions
common/autoconf/generated-configure.sh file | annotate | diff | comparison | revisions
common/autoconf/libraries.m4 file | annotate | diff | comparison | revisions
common/autoconf/spec.gmk.in file | annotate | diff | comparison | revisions
common/autoconf/toolchain.m4 file | annotate | diff | comparison | revisions
common/bin/compare.sh file | annotate | diff | comparison | revisions
make/common/NativeCompilation.gmk file | annotate | diff | comparison | revisions
make/devkit/Makefile file | annotate | diff | comparison | revisions
make/devkit/Tools.gmk file | annotate | diff | comparison | revisions
     1.1 --- a/common/autoconf/basics.m4	Thu Apr 12 02:54:38 2018 -0700
     1.2 +++ b/common/autoconf/basics.m4	Mon Apr 16 00:48:00 2018 -0700
     1.3 @@ -46,10 +46,24 @@
     1.4  # Appends a string to a path variable, only adding the : when needed.
     1.5  AC_DEFUN([BASIC_APPEND_TO_PATH],
     1.6  [
     1.7 -  if test "x[$]$1" = x; then
     1.8 -    $1="$2"
     1.9 -  else
    1.10 -    $1="[$]$1:$2"
    1.11 +  if test "x$2" != x; then
    1.12 +    if test "x[$]$1" = x; then
    1.13 +      $1="$2"
    1.14 +    else
    1.15 +      $1="[$]$1:$2"
    1.16 +    fi
    1.17 +  fi
    1.18 +])
    1.19 +
    1.20 +# Prepends a string to a path variable, only adding the : when needed.
    1.21 +AC_DEFUN([BASIC_PREPEND_TO_PATH],
    1.22 +[
    1.23 +  if test "x$2" != x; then
    1.24 +    if test "x[$]$1" = x; then
    1.25 +      $1="$2"
    1.26 +    else
    1.27 +      $1="$2:[$]$1"
    1.28 +    fi
    1.29    fi
    1.30  ])
    1.31  
    1.32 @@ -442,49 +456,101 @@
    1.33  
    1.34    # Locate the directory of this script.
    1.35    AUTOCONF_DIR=$TOPDIR/common/autoconf
    1.36 +])
    1.37 +
    1.38 +AC_DEFUN_ONCE([BASIC_SETUP_DEVKIT],
    1.39 +[
    1.40 +  AC_ARG_WITH([devkit], [AS_HELP_STRING([--with-devkit],
    1.41 +      [use this devkit for compilers, tools and resources])],
    1.42 +      [
    1.43 +        BASIC_FIXUP_PATH([with_devkit])
    1.44 +        DEVKIT_ROOT="$with_devkit"
    1.45 +        # Check for a meta data info file in the root of the devkit
    1.46 +        if test -f "$DEVKIT_ROOT/devkit.info"; then
    1.47 +          # This potentially sets the following:
    1.48 +          # DEVKIT_NAME: A descriptive name of the devkit
    1.49 +          # DEVKIT_TOOLCHAIN_PATH: Corresponds to --with-toolchain-path
    1.50 +          # DEVKIT_EXTRA_PATH: Corresponds to --with-extra-path
    1.51 +          # DEVKIT_SYSROOT: Corresponds to --with-sysroot
    1.52 +          . $DEVKIT_ROOT/devkit.info
    1.53 +        fi
    1.54 +
    1.55 +        AC_MSG_CHECKING([for devkit])
    1.56 +        if test "x$DEVKIT_NAME" != x; then
    1.57 +          AC_MSG_RESULT([$DEVKIT_NAME in $DEVKIT_ROOT])
    1.58 +        else
    1.59 +          AC_MSG_RESULT([$DEVKIT_ROOT])
    1.60 +        fi
    1.61 +
    1.62 +        if test "x$DEVKIT_EXTRA_PATH" != x; then
    1.63 +          BASIC_PREPEND_TO_PATH([EXTRA_PATH],$DEVKIT_EXTRA_PATH)
    1.64 +        fi
    1.65 +
    1.66 +        # Fallback default of just /bin if DEVKIT_PATH is not defined
    1.67 +        if test "x$DEVKIT_TOOLCHAIN_PATH" = x; then
    1.68 +          DEVKIT_TOOLCHAIN_PATH="$DEVKIT_ROOT/bin"
    1.69 +        fi
    1.70 +        BASIC_PREPEND_TO_PATH([TOOLCHAIN_PATH],$DEVKIT_TOOLCHAIN_PATH)
    1.71 +
    1.72 +        # If DEVKIT_SYSROOT is set, use that, otherwise try a couple of known
    1.73 +        # places for backwards compatiblity.
    1.74 +        if test "x$DEVKIT_SYSROOT" != x; then
    1.75 +          SYSROOT="$DEVKIT_SYSROOT"
    1.76 +        elif test -d "$DEVKIT_ROOT/$host_alias/libc"; then
    1.77 +          SYSROOT="$DEVKIT_ROOT/$host_alias/libc"
    1.78 +        elif test -d "$DEVKIT_ROOT/$host/sys-root"; then
    1.79 +          SYSROOT="$DEVKIT_ROOT/$host/sys-root"
    1.80 +        fi
    1.81 +      ]
    1.82 +  )
    1.83 +
    1.84 +  # You can force the sysroot if the sysroot encoded into the compiler tools
    1.85 +  # is not correct.
    1.86 +  AC_ARG_WITH(sys-root, [AS_HELP_STRING([--with-sys-root],
    1.87 +      [alias for --with-sysroot for backwards compatability])],
    1.88 +      [SYSROOT=$with_sys_root]
    1.89 +  )
    1.90 +
    1.91 +  AC_ARG_WITH(sysroot, [AS_HELP_STRING([--with-sysroot],
    1.92 +      [use this directory as sysroot)])],
    1.93 +      [SYSROOT=$with_sysroot]
    1.94 +  )
    1.95 +
    1.96 +  AC_ARG_WITH([tools-dir], [AS_HELP_STRING([--with-tools-dir],
    1.97 +      [alias for --with-toolchain-path for backwards compatibility])],
    1.98 +      [BASIC_PREPEND_TO_PATH([TOOLCHAIN_PATH],$with_tools_dir)]
    1.99 +  )
   1.100 +
   1.101 +  AC_ARG_WITH([toolchain-path], [AS_HELP_STRING([--with-toolchain-path],
   1.102 +      [prepend these directories when searching for toolchain binaries (compilers etc)])],
   1.103 +      [BASIC_PREPEND_TO_PATH([TOOLCHAIN_PATH],$with_toolchain_path)]
   1.104 +  )
   1.105 +
   1.106 +  AC_ARG_WITH([extra-path], [AS_HELP_STRING([--with-extra-path],
   1.107 +      [prepend these directories to the default path])],
   1.108 +      [BASIC_PREPEND_TO_PATH([EXTRA_PATH],$with_extra_path)]
   1.109 +  )
   1.110 +
   1.111 +  # Prepend the extra path to the global path
   1.112 +  BASIC_PREPEND_TO_PATH([PATH],$EXTRA_PATH)
   1.113  
   1.114    if test "x$OPENJDK_BUILD_OS" = "xsolaris"; then
   1.115      # Add extra search paths on solaris for utilities like ar and as etc...
   1.116      PATH="$PATH:/usr/ccs/bin:/usr/sfw/bin:/opt/csw/bin"
   1.117    fi
   1.118  
   1.119 -  # You can force the sys-root if the sys-root encoded into the cross compiler tools
   1.120 -  # is not correct.
   1.121 -  AC_ARG_WITH(sys-root, [AS_HELP_STRING([--with-sys-root],
   1.122 -      [pass this sys-root to the compilers and tools (for cross-compiling)])])
   1.123 -
   1.124 -  if test "x$with_sys_root" != x; then
   1.125 -    SYS_ROOT=$with_sys_root
   1.126 -  else
   1.127 -    SYS_ROOT=/
   1.128 -  fi
   1.129 -  AC_SUBST(SYS_ROOT)
   1.130 -
   1.131 -  AC_ARG_WITH([tools-dir], [AS_HELP_STRING([--with-tools-dir],
   1.132 -      [search this directory for compilers and tools (for cross-compiling)])],
   1.133 -      [TOOLS_DIR=$with_tools_dir]
   1.134 -  )
   1.135 -
   1.136    # Xcode version will be validated later
   1.137    AC_ARG_WITH([xcode-path], [AS_HELP_STRING([--with-xcode-path],
   1.138        [explicit path to Xcode 4 (generally for building on 10.9 and later)])],
   1.139        [XCODE_PATH=$with_xcode_path]
   1.140    )
   1.141  
   1.142 -  AC_ARG_WITH([devkit], [AS_HELP_STRING([--with-devkit],
   1.143 -      [use this directory as base for tools-dir and sys-root (for cross-compiling)])],
   1.144 -      [
   1.145 -        if test "x$with_sys_root" != x; then
   1.146 -          AC_MSG_ERROR([Cannot specify both --with-devkit and --with-sys-root at the same time])
   1.147 -        fi
   1.148 -        BASIC_FIXUP_PATH([with_devkit])
   1.149 -        BASIC_APPEND_TO_PATH([TOOLS_DIR],$with_devkit/bin)
   1.150 -        if test -d "$with_devkit/$host_alias/libc"; then
   1.151 -          SYS_ROOT=$with_devkit/$host_alias/libc
   1.152 -        elif test -d "$with_devkit/$host/sys-root"; then
   1.153 -          SYS_ROOT=$with_devkit/$host/sys-root
   1.154 -        fi
   1.155 -      ])
   1.156 +  AC_MSG_CHECKING([for sysroot])
   1.157 +  AC_MSG_RESULT([$SYSROOT])
   1.158 +  AC_MSG_CHECKING([for toolchain path])
   1.159 +  AC_MSG_RESULT([$TOOLCHAIN_PATH])
   1.160 +  AC_MSG_CHECKING([for extra path])
   1.161 +  AC_MSG_RESULT([$EXTRA_PATH])
   1.162  ])
   1.163  
   1.164  AC_DEFUN_ONCE([BASIC_SETUP_OUTPUT_DIR],
   1.165 @@ -654,10 +720,10 @@
   1.166      fi
   1.167  
   1.168      if test "x$FOUND_MAKE" = x; then
   1.169 -      if test "x$TOOLS_DIR" != x; then
   1.170 -        # We have a tools-dir, check that as well before giving up.
   1.171 +      if test "x$TOOLCHAIN_PATH" != x; then
   1.172 +        # We have a toolchain path, check that as well before giving up.
   1.173          OLD_PATH=$PATH
   1.174 -        PATH=$TOOLS_DIR:$PATH
   1.175 +        PATH=$TOOLCHAIN_PATH:$PATH
   1.176          AC_PATH_PROGS(CHECK_TOOLSDIR_GMAKE, gmake)
   1.177          BASIC_CHECK_MAKE_VERSION("$CHECK_TOOLSDIR_GMAKE", [gmake in tools-dir])
   1.178          if test "x$FOUND_MAKE" = x; then
     2.1 --- a/common/autoconf/build-performance.m4	Thu Apr 12 02:54:38 2018 -0700
     2.2 +++ b/common/autoconf/build-performance.m4	Mon Apr 16 00:48:00 2018 -0700
     2.3 @@ -169,8 +169,8 @@
     2.4    if test "x$enable_ccache" = xyes; then
     2.5      AC_MSG_RESULT([yes])
     2.6      OLD_PATH="$PATH"
     2.7 -    if test "x$TOOLS_DIR" != x; then
     2.8 -      PATH=$TOOLS_DIR:$PATH
     2.9 +    if test "x$TOOLCHAIN_PATH" != x; then
    2.10 +      PATH=$TOOLCHAIN_PATH:$PATH
    2.11      fi
    2.12      BASIC_REQUIRE_PROGS(CCACHE, ccache)
    2.13      CCACHE_STATUS="enabled"
     3.1 --- a/common/autoconf/configure.ac	Thu Apr 12 02:54:38 2018 -0700
     3.2 +++ b/common/autoconf/configure.ac	Mon Apr 16 00:48:00 2018 -0700
     3.3 @@ -101,6 +101,9 @@
     3.4  # With basic setup done, call the custom early hook.
     3.5  CUSTOM_EARLY_HOOK
     3.6  
     3.7 +# Check if we have devkits, extra paths or sysroot set.
     3.8 +BASIC_SETUP_DEVKIT
     3.9 +
    3.10  # To properly create a configuration name, we need to have the OpenJDK target
    3.11  # and options (variants and debug level) parsed.
    3.12  BASIC_SETUP_OUTPUT_DIR
     4.1 --- a/common/autoconf/flags.m4	Thu Apr 12 02:54:38 2018 -0700
     4.2 +++ b/common/autoconf/flags.m4	Mon Apr 16 00:48:00 2018 -0700
     4.3 @@ -119,6 +119,32 @@
     4.4      # FIXME: likely bug, should be CCXXFLAGS_JDK? or one for C or CXX.
     4.5      CCXXFLAGS="$CCXXFLAGS -nologo"
     4.6    fi
     4.7 +
     4.8 +  if test "x$SYSROOT" != "x"; then
     4.9 +    if test "x$TOOLCHAIN_TYPE" = xsolstudio; then
    4.10 +      if test "x$OPENJDK_TARGET_OS" = xsolaris; then
    4.11 +        # Solaris Studio does not have a concept of sysroot. Instead we must
    4.12 +        # make sure the default include and lib dirs are appended to each 
    4.13 +        # compile and link command line.
    4.14 +        SYSROOT_CFLAGS="-I$SYSROOT/usr/include"
    4.15 +        SYSROOT_LDFLAGS="-L$SYSROOT/usr/lib$OPENJDK_TARGET_CPU_ISADIR \
    4.16 +            -L$SYSROOT/lib$OPENJDK_TARGET_CPU_ISADIR \
    4.17 +            -L$SYSROOT/usr/ccs/lib$OPENJDK_TARGET_CPU_ISADIR"
    4.18 +      fi
    4.19 +    elif test "x$TOOLCHAIN_TYPE" = xgcc; then
    4.20 +      SYSROOT_CFLAGS="--sysroot=\"$SYSROOT\""
    4.21 +      SYSROOT_LDFLAGS="--sysroot=\"$SYSROOT\""
    4.22 +    elif test "x$TOOLCHAIN_TYPE" = xclang; then
    4.23 +      SYSROOT_CFLAGS="-isysroot \"$SYSROOT\""
    4.24 +      SYSROOT_LDFLAGS="-isysroot \"$SYSROOT\""
    4.25 +    fi
    4.26 +    # Propagate the sysroot args to hotspot
    4.27 +    LEGACY_EXTRA_CFLAGS="$LEGACY_EXTRA_CFLAGS $SYSROOT_CFLAGS"
    4.28 +    LEGACY_EXTRA_CXXFLAGS="$LEGACY_EXTRA_CXXFLAGS $SYSROOT_CFLAGS"
    4.29 +    LEGACY_EXTRA_LDFLAGS="$LEGACY_EXTRA_LDFLAGS $SYSROOT_LDFLAGS"
    4.30 +  fi
    4.31 +  AC_SUBST(SYSROOT_CFLAGS)
    4.32 +  AC_SUBST(SYSROOT_LDFLAGS)
    4.33  ])
    4.34  
    4.35  AC_DEFUN_ONCE([FLAGS_SETUP_COMPILER_FLAGS_FOR_LIBS],
    4.36 @@ -389,9 +415,9 @@
    4.37    LDFLAGS_JDK="${LDFLAGS_JDK} $with_extra_ldflags"
    4.38  
    4.39    # Hotspot needs these set in their legacy form
    4.40 -  LEGACY_EXTRA_CFLAGS=$with_extra_cflags
    4.41 -  LEGACY_EXTRA_CXXFLAGS=$with_extra_cxxflags
    4.42 -  LEGACY_EXTRA_LDFLAGS=$with_extra_ldflags
    4.43 +  LEGACY_EXTRA_CFLAGS="$LEGACY_EXTRA_CFLAGS $with_extra_cflags"
    4.44 +  LEGACY_EXTRA_CXXFLAGS="$LEGACY_EXTRA_CXXFLAGS $with_extra_cxxflags"
    4.45 +  LEGACY_EXTRA_LDFLAGS="$LEGACY_EXTRA_LDFLAGS $with_extra_ldflags"
    4.46  
    4.47    AC_SUBST(LEGACY_EXTRA_CFLAGS)
    4.48    AC_SUBST(LEGACY_EXTRA_CXXFLAGS)
    4.49 @@ -490,7 +516,13 @@
    4.50        CCXXFLAGS_JDK="$CCXXFLAGS_JDK -D_LITTLE_ENDIAN"
    4.51      fi
    4.52    else
    4.53 -    CCXXFLAGS_JDK="$CCXXFLAGS_JDK -D_BIG_ENDIAN"
    4.54 +    # Same goes for _BIG_ENDIAN. Do we really need to set *ENDIAN on Solaris if they
    4.55 +    # are defined in the system?
    4.56 +    if test "x$OPENJDK_TARGET_OS" = xsolaris; then
    4.57 +      CCXXFLAGS_JDK="$CCXXFLAGS_JDK -D_BIG_ENDIAN="
    4.58 +    else
    4.59 +      CCXXFLAGS_JDK="$CCXXFLAGS_JDK -D_BIG_ENDIAN"
    4.60 +    fi
    4.61    fi
    4.62    
    4.63    # Setup target OS define. Use OS target name but in upper case.
     5.1 --- a/common/autoconf/generated-configure.sh	Thu Apr 12 02:54:38 2018 -0700
     5.2 +++ b/common/autoconf/generated-configure.sh	Mon Apr 16 00:48:00 2018 -0700
     5.3 @@ -661,7 +661,6 @@
     5.4  FREETYPE_LIBS
     5.5  FREETYPE_CFLAGS
     5.6  CUPS_CFLAGS
     5.7 -OPENWIN_HOME
     5.8  X_EXTRA_LIBS
     5.9  X_LIBS
    5.10  X_PRE_LIBS
    5.11 @@ -707,6 +706,8 @@
    5.12  SHARED_LIBRARY_FLAGS
    5.13  CXX_FLAG_REORDER
    5.14  C_FLAG_REORDER
    5.15 +SYSROOT_LDFLAGS
    5.16 +SYSROOT_CFLAGS
    5.17  RC_FLAGS
    5.18  AR_OUT_OPTION
    5.19  LD_OUT_OPTION
    5.20 @@ -762,7 +763,7 @@
    5.21  CXX
    5.22  ac_ct_PROPER_COMPILER_CXX
    5.23  PROPER_COMPILER_CXX
    5.24 -TOOLS_DIR_CXX
    5.25 +TOOLCHAIN_PATH_CXX
    5.26  POTENTIAL_CXX
    5.27  OBJEXT
    5.28  EXEEXT
    5.29 @@ -773,7 +774,7 @@
    5.30  CC
    5.31  ac_ct_PROPER_COMPILER_CC
    5.32  PROPER_COMPILER_CC
    5.33 -TOOLS_DIR_CC
    5.34 +TOOLCHAIN_PATH_CC
    5.35  POTENTIAL_CC
    5.36  SDKPATH
    5.37  XCODEBUILD
    5.38 @@ -886,7 +887,6 @@
    5.39  BUILD_LOG_WRAPPER
    5.40  BUILD_LOG_PREVIOUS
    5.41  BUILD_LOG
    5.42 -SYS_ROOT
    5.43  TOPDIR
    5.44  PATH_SEP
    5.45  ZERO_ARCHDEF
    5.46 @@ -1021,16 +1021,19 @@
    5.47  enable_option_checking
    5.48  with_custom_make_dir
    5.49  with_target_bits
    5.50 -with_sys_root
    5.51 -with_tools_dir
    5.52 -with_xcode_path
    5.53 -with_devkit
    5.54  enable_openjdk_only
    5.55  with_jdk_variant
    5.56  with_jvm_interpreter
    5.57  with_jvm_variants
    5.58  enable_debug
    5.59  with_debug_level
    5.60 +with_devkit
    5.61 +with_sys_root
    5.62 +with_sysroot
    5.63 +with_tools_dir
    5.64 +with_toolchain_path
    5.65 +with_extra_path
    5.66 +with_xcode_path
    5.67  with_conf_name
    5.68  with_builddeps_conf
    5.69  with_builddeps_server
    5.70 @@ -1837,14 +1840,6 @@
    5.71    --with-custom-make-dir  use this directory for custom build/make files
    5.72    --with-target-bits      build 32-bit or 64-bit binaries (for platforms that
    5.73                            support it), e.g. --with-target-bits=32 [guessed]
    5.74 -  --with-sys-root         pass this sys-root to the compilers and tools (for
    5.75 -                          cross-compiling)
    5.76 -  --with-tools-dir        search this directory for compilers and tools (for
    5.77 -                          cross-compiling)
    5.78 -  --with-xcode-path       explicit path to Xcode 4 (generally for building on
    5.79 -                          10.9 and later)
    5.80 -  --with-devkit           use this directory as base for tools-dir and
    5.81 -                          sys-root (for cross-compiling)
    5.82    --with-jdk-variant      JDK variant to build (normal) [normal]
    5.83    --with-jvm-interpreter  JVM interpreter to build (template, cpp) [template]
    5.84    --with-jvm-variants     JVM variants (separated by commas) to build (server,
    5.85 @@ -1852,6 +1847,16 @@
    5.86                            [server]
    5.87    --with-debug-level      set the debug level (release, fastdebug, slowdebug)
    5.88                            [release]
    5.89 +  --with-devkit           use this devkit for compilers, tools and resources
    5.90 +  --with-sys-root         alias for --with-sysroot for backwards compatability
    5.91 +  --with-sysroot          use this directory as sysroot)
    5.92 +  --with-tools-dir        alias for --with-toolchain-path for backwards
    5.93 +                          compatibility
    5.94 +  --with-toolchain-path   prepend these directories when searching for
    5.95 +                          toolchain binaries (compilers etc)
    5.96 +  --with-extra-path       prepend these directories to the default path
    5.97 +  --with-xcode-path       explicit path to Xcode 4 (generally for building on
    5.98 +                          10.9 and later)
    5.99    --with-conf-name        use this as the name of the configuration [generated
   5.100                            from important configuration options]
   5.101    --with-builddeps-conf   use this configuration file for the builddeps
   5.102 @@ -3303,6 +3308,9 @@
   5.103  # Appends a string to a path variable, only adding the : when needed.
   5.104  
   5.105  
   5.106 +# Prepends a string to a path variable, only adding the : when needed.
   5.107 +
   5.108 +
   5.109  # This will make sure the given variable points to a full and proper
   5.110  # path. This means:
   5.111  # 1) There will be no spaces in the path. On posix platforms,
   5.112 @@ -3385,6 +3393,8 @@
   5.113  
   5.114  
   5.115  
   5.116 +
   5.117 +
   5.118  #%%% Simple tools %%%
   5.119  
   5.120  # Check if we have found a usable version of make
   5.121 @@ -4225,7 +4235,7 @@
   5.122  #CUSTOM_AUTOCONF_INCLUDE
   5.123  
   5.124  # Do not change or remove the following line, it is needed for consistency checks:
   5.125 -DATE_WHEN_GENERATED=1523526861
   5.126 +DATE_WHEN_GENERATED=1523864865
   5.127  
   5.128  ###############################################################################
   5.129  #
   5.130 @@ -14257,189 +14267,6 @@
   5.131    # Locate the directory of this script.
   5.132    AUTOCONF_DIR=$TOPDIR/common/autoconf
   5.133  
   5.134 -  if test "x$OPENJDK_BUILD_OS" = "xsolaris"; then
   5.135 -    # Add extra search paths on solaris for utilities like ar and as etc...
   5.136 -    PATH="$PATH:/usr/ccs/bin:/usr/sfw/bin:/opt/csw/bin"
   5.137 -  fi
   5.138 -
   5.139 -  # You can force the sys-root if the sys-root encoded into the cross compiler tools
   5.140 -  # is not correct.
   5.141 -
   5.142 -# Check whether --with-sys-root was given.
   5.143 -if test "${with_sys_root+set}" = set; then :
   5.144 -  withval=$with_sys_root;
   5.145 -fi
   5.146 -
   5.147 -
   5.148 -  if test "x$with_sys_root" != x; then
   5.149 -    SYS_ROOT=$with_sys_root
   5.150 -  else
   5.151 -    SYS_ROOT=/
   5.152 -  fi
   5.153 -
   5.154 -
   5.155 -
   5.156 -# Check whether --with-tools-dir was given.
   5.157 -if test "${with_tools_dir+set}" = set; then :
   5.158 -  withval=$with_tools_dir; TOOLS_DIR=$with_tools_dir
   5.159 -
   5.160 -fi
   5.161 -
   5.162 -
   5.163 -  # Xcode version will be validated later
   5.164 -
   5.165 -# Check whether --with-xcode-path was given.
   5.166 -if test "${with_xcode_path+set}" = set; then :
   5.167 -  withval=$with_xcode_path; XCODE_PATH=$with_xcode_path
   5.168 -
   5.169 -fi
   5.170 -
   5.171 -
   5.172 -
   5.173 -# Check whether --with-devkit was given.
   5.174 -if test "${with_devkit+set}" = set; then :
   5.175 -  withval=$with_devkit;
   5.176 -        if test "x$with_sys_root" != x; then
   5.177 -          as_fn_error $? "Cannot specify both --with-devkit and --with-sys-root at the same time" "$LINENO" 5
   5.178 -        fi
   5.179 -
   5.180 -  if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
   5.181 -
   5.182 -  # Input might be given as Windows format, start by converting to
   5.183 -  # unix format.
   5.184 -  path="$with_devkit"
   5.185 -  new_path=`$CYGPATH -u "$path"`
   5.186 -
   5.187 -  # Cygwin tries to hide some aspects of the Windows file system, such that binaries are
   5.188 -  # named .exe but called without that suffix. Therefore, "foo" and "foo.exe" are considered
   5.189 -  # the same file, most of the time (as in "test -f"). But not when running cygpath -s, then
   5.190 -  # "foo.exe" is OK but "foo" is an error.
   5.191 -  #
   5.192 -  # This test is therefore slightly more accurate than "test -f" to check for file precense.
   5.193 -  # It is also a way to make sure we got the proper file name for the real test later on.
   5.194 -  test_shortpath=`$CYGPATH -s -m "$new_path" 2> /dev/null`
   5.195 -  if test "x$test_shortpath" = x; then
   5.196 -    { $as_echo "$as_me:${as_lineno-$LINENO}: The path of with_devkit, which resolves as \"$path\", is invalid." >&5
   5.197 -$as_echo "$as_me: The path of with_devkit, which resolves as \"$path\", is invalid." >&6;}
   5.198 -    as_fn_error $? "Cannot locate the the path of with_devkit" "$LINENO" 5
   5.199 -  fi
   5.200 -
   5.201 -  # Call helper function which possibly converts this using DOS-style short mode.
   5.202 -  # If so, the updated path is stored in $new_path.
   5.203 -
   5.204 -  input_path="$new_path"
   5.205 -  # Check if we need to convert this using DOS-style short mode. If the path
   5.206 -  # contains just simple characters, use it. Otherwise (spaces, weird characters),
   5.207 -  # take no chances and rewrite it.
   5.208 -  # Note: m4 eats our [], so we need to use [ and ] instead.
   5.209 -  has_forbidden_chars=`$ECHO "$input_path" | $GREP [^-._/a-zA-Z0-9]`
   5.210 -  if test "x$has_forbidden_chars" != x; then
   5.211 -    # Now convert it to mixed DOS-style, short mode (no spaces, and / instead of \)
   5.212 -    shortmode_path=`$CYGPATH -s -m -a "$input_path"`
   5.213 -    path_after_shortmode=`$CYGPATH -u "$shortmode_path"`
   5.214 -    if test "x$path_after_shortmode" != "x$input_to_shortpath"; then
   5.215 -      # Going to short mode and back again did indeed matter. Since short mode is
   5.216 -      # case insensitive, let's make it lowercase to improve readability.
   5.217 -      shortmode_path=`$ECHO "$shortmode_path" | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
   5.218 -      # Now convert it back to Unix-stile (cygpath)
   5.219 -      input_path=`$CYGPATH -u "$shortmode_path"`
   5.220 -      new_path="$input_path"
   5.221 -    fi
   5.222 -  fi
   5.223 -
   5.224 -  test_cygdrive_prefix=`$ECHO $input_path | $GREP ^/cygdrive/`
   5.225 -  if test "x$test_cygdrive_prefix" = x; then
   5.226 -    # As a simple fix, exclude /usr/bin since it's not a real path.
   5.227 -    if test "x`$ECHO $new_path | $GREP ^/usr/bin/`" = x; then
   5.228 -      # The path is in a Cygwin special directory (e.g. /home). We need this converted to
   5.229 -      # a path prefixed by /cygdrive for fixpath to work.
   5.230 -      new_path="$CYGWIN_ROOT_PATH$input_path"
   5.231 -    fi
   5.232 -  fi
   5.233 -
   5.234 -
   5.235 -  if test "x$path" != "x$new_path"; then
   5.236 -    with_devkit="$new_path"
   5.237 -    { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting with_devkit to \"$new_path\"" >&5
   5.238 -$as_echo "$as_me: Rewriting with_devkit to \"$new_path\"" >&6;}
   5.239 -  fi
   5.240 -
   5.241 -  elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then
   5.242 -
   5.243 -  path="$with_devkit"
   5.244 -  has_colon=`$ECHO $path | $GREP ^.:`
   5.245 -  new_path="$path"
   5.246 -  if test "x$has_colon" = x; then
   5.247 -    # Not in mixed or Windows style, start by that.
   5.248 -    new_path=`cmd //c echo $path`
   5.249 -  fi
   5.250 -
   5.251 -
   5.252 -  input_path="$new_path"
   5.253 -  # Check if we need to convert this using DOS-style short mode. If the path
   5.254 -  # contains just simple characters, use it. Otherwise (spaces, weird characters),
   5.255 -  # take no chances and rewrite it.
   5.256 -  # Note: m4 eats our [], so we need to use [ and ] instead.
   5.257 -  has_forbidden_chars=`$ECHO "$input_path" | $GREP [^-_/:a-zA-Z0-9]`
   5.258 -  if test "x$has_forbidden_chars" != x; then
   5.259 -    # Now convert it to mixed DOS-style, short mode (no spaces, and / instead of \)
   5.260 -    new_path=`cmd /c "for %A in (\"$input_path\") do @echo %~sA"|$TR \\\\\\\\ / | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
   5.261 -  fi
   5.262 -
   5.263 -
   5.264 -  windows_path="$new_path"
   5.265 -  if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
   5.266 -    unix_path=`$CYGPATH -u "$windows_path"`
   5.267 -    new_path="$unix_path"
   5.268 -  elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then
   5.269 -    unix_path=`$ECHO "$windows_path" | $SED -e 's,^\\(.\\):,/\\1,g' -e 's,\\\\,/,g'`
   5.270 -    new_path="$unix_path"
   5.271 -  fi
   5.272 -
   5.273 -  if test "x$path" != "x$new_path"; then
   5.274 -    with_devkit="$new_path"
   5.275 -    { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting with_devkit to \"$new_path\"" >&5
   5.276 -$as_echo "$as_me: Rewriting with_devkit to \"$new_path\"" >&6;}
   5.277 -  fi
   5.278 -
   5.279 -  # Save the first 10 bytes of this path to the storage, so fixpath can work.
   5.280 -  all_fixpath_prefixes=("${all_fixpath_prefixes[@]}" "${new_path:0:10}")
   5.281 -
   5.282 -  else
   5.283 -    # We're on a posix platform. Hooray! :)
   5.284 -    path="$with_devkit"
   5.285 -    has_space=`$ECHO "$path" | $GREP " "`
   5.286 -    if test "x$has_space" != x; then
   5.287 -      { $as_echo "$as_me:${as_lineno-$LINENO}: The path of with_devkit, which resolves as \"$path\", is invalid." >&5
   5.288 -$as_echo "$as_me: The path of with_devkit, which resolves as \"$path\", is invalid." >&6;}
   5.289 -      as_fn_error $? "Spaces are not allowed in this path." "$LINENO" 5
   5.290 -    fi
   5.291 -
   5.292 -    # Use eval to expand a potential ~
   5.293 -    eval path="$path"
   5.294 -    if test ! -f "$path" && test ! -d "$path"; then
   5.295 -      as_fn_error $? "The path of with_devkit, which resolves as \"$path\", is not found." "$LINENO" 5
   5.296 -    fi
   5.297 -
   5.298 -    with_devkit="`cd "$path"; $THEPWDCMD -L`"
   5.299 -  fi
   5.300 -
   5.301 -
   5.302 -  if test "x$TOOLS_DIR" = x; then
   5.303 -    TOOLS_DIR="$with_devkit/bin"
   5.304 -  else
   5.305 -    TOOLS_DIR="$TOOLS_DIR:$with_devkit/bin"
   5.306 -  fi
   5.307 -
   5.308 -        if test -d "$with_devkit/$host_alias/libc"; then
   5.309 -          SYS_ROOT=$with_devkit/$host_alias/libc
   5.310 -        elif test -d "$with_devkit/$host/sys-root"; then
   5.311 -          SYS_ROOT=$with_devkit/$host/sys-root
   5.312 -        fi
   5.313 -
   5.314 -fi
   5.315 -
   5.316 -
   5.317  
   5.318    # Setup default logging of stdout and stderr to build.log in the output root.
   5.319    BUILD_LOG='$(OUTPUT_ROOT)/build.log'
   5.320 @@ -14793,6 +14620,300 @@
   5.321  # With basic setup done, call the custom early hook.
   5.322  
   5.323  
   5.324 +# Check if we have devkits, extra paths or sysroot set.
   5.325 +
   5.326 +
   5.327 +# Check whether --with-devkit was given.
   5.328 +if test "${with_devkit+set}" = set; then :
   5.329 +  withval=$with_devkit;
   5.330 +
   5.331 +  if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
   5.332 +
   5.333 +  # Input might be given as Windows format, start by converting to
   5.334 +  # unix format.
   5.335 +  path="$with_devkit"
   5.336 +  new_path=`$CYGPATH -u "$path"`
   5.337 +
   5.338 +  # Cygwin tries to hide some aspects of the Windows file system, such that binaries are
   5.339 +  # named .exe but called without that suffix. Therefore, "foo" and "foo.exe" are considered
   5.340 +  # the same file, most of the time (as in "test -f"). But not when running cygpath -s, then
   5.341 +  # "foo.exe" is OK but "foo" is an error.
   5.342 +  #
   5.343 +  # This test is therefore slightly more accurate than "test -f" to check for file precense.
   5.344 +  # It is also a way to make sure we got the proper file name for the real test later on.
   5.345 +  test_shortpath=`$CYGPATH -s -m "$new_path" 2> /dev/null`
   5.346 +  if test "x$test_shortpath" = x; then
   5.347 +    { $as_echo "$as_me:${as_lineno-$LINENO}: The path of with_devkit, which resolves as \"$path\", is invalid." >&5
   5.348 +$as_echo "$as_me: The path of with_devkit, which resolves as \"$path\", is invalid." >&6;}
   5.349 +    as_fn_error $? "Cannot locate the the path of with_devkit" "$LINENO" 5
   5.350 +  fi
   5.351 +
   5.352 +  # Call helper function which possibly converts this using DOS-style short mode.
   5.353 +  # If so, the updated path is stored in $new_path.
   5.354 +
   5.355 +  input_path="$new_path"
   5.356 +  # Check if we need to convert this using DOS-style short mode. If the path
   5.357 +  # contains just simple characters, use it. Otherwise (spaces, weird characters),
   5.358 +  # take no chances and rewrite it.
   5.359 +  # Note: m4 eats our [], so we need to use [ and ] instead.
   5.360 +  has_forbidden_chars=`$ECHO "$input_path" | $GREP [^-._/a-zA-Z0-9]`
   5.361 +  if test "x$has_forbidden_chars" != x; then
   5.362 +    # Now convert it to mixed DOS-style, short mode (no spaces, and / instead of \)
   5.363 +    shortmode_path=`$CYGPATH -s -m -a "$input_path"`
   5.364 +    path_after_shortmode=`$CYGPATH -u "$shortmode_path"`
   5.365 +    if test "x$path_after_shortmode" != "x$input_to_shortpath"; then
   5.366 +      # Going to short mode and back again did indeed matter. Since short mode is
   5.367 +      # case insensitive, let's make it lowercase to improve readability.
   5.368 +      shortmode_path=`$ECHO "$shortmode_path" | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
   5.369 +      # Now convert it back to Unix-stile (cygpath)
   5.370 +      input_path=`$CYGPATH -u "$shortmode_path"`
   5.371 +      new_path="$input_path"
   5.372 +    fi
   5.373 +  fi
   5.374 +
   5.375 +  test_cygdrive_prefix=`$ECHO $input_path | $GREP ^/cygdrive/`
   5.376 +  if test "x$test_cygdrive_prefix" = x; then
   5.377 +    # As a simple fix, exclude /usr/bin since it's not a real path.
   5.378 +    if test "x`$ECHO $new_path | $GREP ^/usr/bin/`" = x; then
   5.379 +      # The path is in a Cygwin special directory (e.g. /home). We need this converted to
   5.380 +      # a path prefixed by /cygdrive for fixpath to work.
   5.381 +      new_path="$CYGWIN_ROOT_PATH$input_path"
   5.382 +    fi
   5.383 +  fi
   5.384 +
   5.385 +
   5.386 +  if test "x$path" != "x$new_path"; then
   5.387 +    with_devkit="$new_path"
   5.388 +    { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting with_devkit to \"$new_path\"" >&5
   5.389 +$as_echo "$as_me: Rewriting with_devkit to \"$new_path\"" >&6;}
   5.390 +  fi
   5.391 +
   5.392 +  elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then
   5.393 +
   5.394 +  path="$with_devkit"
   5.395 +  has_colon=`$ECHO $path | $GREP ^.:`
   5.396 +  new_path="$path"
   5.397 +  if test "x$has_colon" = x; then
   5.398 +    # Not in mixed or Windows style, start by that.
   5.399 +    new_path=`cmd //c echo $path`
   5.400 +  fi
   5.401 +
   5.402 +
   5.403 +  input_path="$new_path"
   5.404 +  # Check if we need to convert this using DOS-style short mode. If the path
   5.405 +  # contains just simple characters, use it. Otherwise (spaces, weird characters),
   5.406 +  # take no chances and rewrite it.
   5.407 +  # Note: m4 eats our [], so we need to use [ and ] instead.
   5.408 +  has_forbidden_chars=`$ECHO "$input_path" | $GREP [^-_/:a-zA-Z0-9]`
   5.409 +  if test "x$has_forbidden_chars" != x; then
   5.410 +    # Now convert it to mixed DOS-style, short mode (no spaces, and / instead of \)
   5.411 +    new_path=`cmd /c "for %A in (\"$input_path\") do @echo %~sA"|$TR \\\\\\\\ / | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
   5.412 +  fi
   5.413 +
   5.414 +
   5.415 +  windows_path="$new_path"
   5.416 +  if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
   5.417 +    unix_path=`$CYGPATH -u "$windows_path"`
   5.418 +    new_path="$unix_path"
   5.419 +  elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then
   5.420 +    unix_path=`$ECHO "$windows_path" | $SED -e 's,^\\(.\\):,/\\1,g' -e 's,\\\\,/,g'`
   5.421 +    new_path="$unix_path"
   5.422 +  fi
   5.423 +
   5.424 +  if test "x$path" != "x$new_path"; then
   5.425 +    with_devkit="$new_path"
   5.426 +    { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting with_devkit to \"$new_path\"" >&5
   5.427 +$as_echo "$as_me: Rewriting with_devkit to \"$new_path\"" >&6;}
   5.428 +  fi
   5.429 +
   5.430 +  # Save the first 10 bytes of this path to the storage, so fixpath can work.
   5.431 +  all_fixpath_prefixes=("${all_fixpath_prefixes[@]}" "${new_path:0:10}")
   5.432 +
   5.433 +  else
   5.434 +    # We're on a posix platform. Hooray! :)
   5.435 +    path="$with_devkit"
   5.436 +    has_space=`$ECHO "$path" | $GREP " "`
   5.437 +    if test "x$has_space" != x; then
   5.438 +      { $as_echo "$as_me:${as_lineno-$LINENO}: The path of with_devkit, which resolves as \"$path\", is invalid." >&5
   5.439 +$as_echo "$as_me: The path of with_devkit, which resolves as \"$path\", is invalid." >&6;}
   5.440 +      as_fn_error $? "Spaces are not allowed in this path." "$LINENO" 5
   5.441 +    fi
   5.442 +
   5.443 +    # Use eval to expand a potential ~
   5.444 +    eval path="$path"
   5.445 +    if test ! -f "$path" && test ! -d "$path"; then
   5.446 +      as_fn_error $? "The path of with_devkit, which resolves as \"$path\", is not found." "$LINENO" 5
   5.447 +    fi
   5.448 +
   5.449 +    with_devkit="`cd "$path"; $THEPWDCMD -L`"
   5.450 +  fi
   5.451 +
   5.452 +        DEVKIT_ROOT="$with_devkit"
   5.453 +        # Check for a meta data info file in the root of the devkit
   5.454 +        if test -f "$DEVKIT_ROOT/devkit.info"; then
   5.455 +          # This potentially sets the following:
   5.456 +          # DEVKIT_NAME: A descriptive name of the devkit
   5.457 +          # DEVKIT_TOOLCHAIN_PATH: Corresponds to --with-toolchain-path
   5.458 +          # DEVKIT_EXTRA_PATH: Corresponds to --with-extra-path
   5.459 +          # DEVKIT_SYSROOT: Corresponds to --with-sysroot
   5.460 +          . $DEVKIT_ROOT/devkit.info
   5.461 +        fi
   5.462 +
   5.463 +        { $as_echo "$as_me:${as_lineno-$LINENO}: checking for devkit" >&5
   5.464 +$as_echo_n "checking for devkit... " >&6; }
   5.465 +        if test "x$DEVKIT_NAME" != x; then
   5.466 +          { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DEVKIT_NAME in $DEVKIT_ROOT" >&5
   5.467 +$as_echo "$DEVKIT_NAME in $DEVKIT_ROOT" >&6; }
   5.468 +        else
   5.469 +          { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DEVKIT_ROOT" >&5
   5.470 +$as_echo "$DEVKIT_ROOT" >&6; }
   5.471 +        fi
   5.472 +
   5.473 +        if test "x$DEVKIT_EXTRA_PATH" != x; then
   5.474 +
   5.475 +  if test "x$DEVKIT_EXTRA_PATH" != x; then
   5.476 +    if test "x$EXTRA_PATH" = x; then
   5.477 +      EXTRA_PATH="$DEVKIT_EXTRA_PATH"
   5.478 +    else
   5.479 +      EXTRA_PATH="$DEVKIT_EXTRA_PATH:$EXTRA_PATH"
   5.480 +    fi
   5.481 +  fi
   5.482 +
   5.483 +        fi
   5.484 +
   5.485 +        # Fallback default of just /bin if DEVKIT_PATH is not defined
   5.486 +        if test "x$DEVKIT_TOOLCHAIN_PATH" = x; then
   5.487 +          DEVKIT_TOOLCHAIN_PATH="$DEVKIT_ROOT/bin"
   5.488 +        fi
   5.489 +
   5.490 +  if test "x$DEVKIT_TOOLCHAIN_PATH" != x; then
   5.491 +    if test "x$TOOLCHAIN_PATH" = x; then
   5.492 +      TOOLCHAIN_PATH="$DEVKIT_TOOLCHAIN_PATH"
   5.493 +    else
   5.494 +      TOOLCHAIN_PATH="$DEVKIT_TOOLCHAIN_PATH:$TOOLCHAIN_PATH"
   5.495 +    fi
   5.496 +  fi
   5.497 +
   5.498 +
   5.499 +        # If DEVKIT_SYSROOT is set, use that, otherwise try a couple of known
   5.500 +        # places for backwards compatiblity.
   5.501 +        if test "x$DEVKIT_SYSROOT" != x; then
   5.502 +          SYSROOT="$DEVKIT_SYSROOT"
   5.503 +        elif test -d "$DEVKIT_ROOT/$host_alias/libc"; then
   5.504 +          SYSROOT="$DEVKIT_ROOT/$host_alias/libc"
   5.505 +        elif test -d "$DEVKIT_ROOT/$host/sys-root"; then
   5.506 +          SYSROOT="$DEVKIT_ROOT/$host/sys-root"
   5.507 +        fi
   5.508 +
   5.509 +
   5.510 +fi
   5.511 +
   5.512 +
   5.513 +  # You can force the sysroot if the sysroot encoded into the compiler tools
   5.514 +  # is not correct.
   5.515 +
   5.516 +# Check whether --with-sys-root was given.
   5.517 +if test "${with_sys_root+set}" = set; then :
   5.518 +  withval=$with_sys_root; SYSROOT=$with_sys_root
   5.519 +
   5.520 +fi
   5.521 +
   5.522 +
   5.523 +
   5.524 +# Check whether --with-sysroot was given.
   5.525 +if test "${with_sysroot+set}" = set; then :
   5.526 +  withval=$with_sysroot; SYSROOT=$with_sysroot
   5.527 +
   5.528 +fi
   5.529 +
   5.530 +
   5.531 +
   5.532 +# Check whether --with-tools-dir was given.
   5.533 +if test "${with_tools_dir+set}" = set; then :
   5.534 +  withval=$with_tools_dir;
   5.535 +  if test "x$with_tools_dir" != x; then
   5.536 +    if test "x$TOOLCHAIN_PATH" = x; then
   5.537 +      TOOLCHAIN_PATH="$with_tools_dir"
   5.538 +    else
   5.539 +      TOOLCHAIN_PATH="$with_tools_dir:$TOOLCHAIN_PATH"
   5.540 +    fi
   5.541 +  fi
   5.542 +
   5.543 +
   5.544 +fi
   5.545 +
   5.546 +
   5.547 +
   5.548 +# Check whether --with-toolchain-path was given.
   5.549 +if test "${with_toolchain_path+set}" = set; then :
   5.550 +  withval=$with_toolchain_path;
   5.551 +  if test "x$with_toolchain_path" != x; then
   5.552 +    if test "x$TOOLCHAIN_PATH" = x; then
   5.553 +      TOOLCHAIN_PATH="$with_toolchain_path"
   5.554 +    else
   5.555 +      TOOLCHAIN_PATH="$with_toolchain_path:$TOOLCHAIN_PATH"
   5.556 +    fi
   5.557 +  fi
   5.558 +
   5.559 +
   5.560 +fi
   5.561 +
   5.562 +
   5.563 +
   5.564 +# Check whether --with-extra-path was given.
   5.565 +if test "${with_extra_path+set}" = set; then :
   5.566 +  withval=$with_extra_path;
   5.567 +  if test "x$with_extra_path" != x; then
   5.568 +    if test "x$EXTRA_PATH" = x; then
   5.569 +      EXTRA_PATH="$with_extra_path"
   5.570 +    else
   5.571 +      EXTRA_PATH="$with_extra_path:$EXTRA_PATH"
   5.572 +    fi
   5.573 +  fi
   5.574 +
   5.575 +
   5.576 +fi
   5.577 +
   5.578 +
   5.579 +  # Prepend the extra path to the global path
   5.580 +
   5.581 +  if test "x$EXTRA_PATH" != x; then
   5.582 +    if test "x$PATH" = x; then
   5.583 +      PATH="$EXTRA_PATH"
   5.584 +    else
   5.585 +      PATH="$EXTRA_PATH:$PATH"
   5.586 +    fi
   5.587 +  fi
   5.588 +
   5.589 +
   5.590 +  if test "x$OPENJDK_BUILD_OS" = "xsolaris"; then
   5.591 +    # Add extra search paths on solaris for utilities like ar and as etc...
   5.592 +    PATH="$PATH:/usr/ccs/bin:/usr/sfw/bin:/opt/csw/bin"
   5.593 +  fi
   5.594 +
   5.595 +  # Xcode version will be validated later
   5.596 +
   5.597 +# Check whether --with-xcode-path was given.
   5.598 +if test "${with_xcode_path+set}" = set; then :
   5.599 +  withval=$with_xcode_path; XCODE_PATH=$with_xcode_path
   5.600 +
   5.601 +fi
   5.602 +
   5.603 +
   5.604 +  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for sysroot" >&5
   5.605 +$as_echo_n "checking for sysroot... " >&6; }
   5.606 +  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $SYSROOT" >&5
   5.607 +$as_echo "$SYSROOT" >&6; }
   5.608 +  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for toolchain path" >&5
   5.609 +$as_echo_n "checking for toolchain path... " >&6; }
   5.610 +  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $TOOLCHAIN_PATH" >&5
   5.611 +$as_echo "$TOOLCHAIN_PATH" >&6; }
   5.612 +  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for extra path" >&5
   5.613 +$as_echo_n "checking for extra path... " >&6; }
   5.614 +  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $EXTRA_PATH" >&5
   5.615 +$as_echo "$EXTRA_PATH" >&6; }
   5.616 +
   5.617 +
   5.618  # To properly create a configuration name, we need to have the OpenJDK target
   5.619  # and options (variants and debug level) parsed.
   5.620  
   5.621 @@ -16100,10 +16221,10 @@
   5.622      fi
   5.623  
   5.624      if test "x$FOUND_MAKE" = x; then
   5.625 -      if test "x$TOOLS_DIR" != x; then
   5.626 -        # We have a tools-dir, check that as well before giving up.
   5.627 +      if test "x$TOOLCHAIN_PATH" != x; then
   5.628 +        # We have a toolchain path, check that as well before giving up.
   5.629          OLD_PATH=$PATH
   5.630 -        PATH=$TOOLS_DIR:$PATH
   5.631 +        PATH=$TOOLCHAIN_PATH:$PATH
   5.632          for ac_prog in gmake
   5.633  do
   5.634    # Extract the first word of "$ac_prog", so it can be a program name with args.
   5.635 @@ -25923,169 +26044,11 @@
   5.636      PATH="/usr/ccs/bin:$PATH"
   5.637    fi
   5.638  
   5.639 -  # Finally add TOOLS_DIR at the beginning, to allow --with-tools-dir to
   5.640 +  # Finally add TOOLCHAIN_PATH at the beginning, to allow --with-tools-dir to
   5.641    # override all other locations.
   5.642 -  if test "x$TOOLS_DIR" != x; then
   5.643 -    PATH=$TOOLS_DIR:$PATH
   5.644 -  fi
   5.645 -
   5.646 -  # If a devkit is found on the builddeps server, then prepend its path to the
   5.647 -  # PATH variable. If there are cross compilers available in the devkit, these
   5.648 -  # will be found by AC_PROG_CC et al.
   5.649 -  DEVKIT=
   5.650 -
   5.651 -
   5.652 -  if test "x$with_builddeps_server" != x || test "x$with_builddeps_conf" != x; then
   5.653 -    # Source the builddeps file again, to make sure it uses the latest variables!
   5.654 -    . $builddepsfile
   5.655 -    # Look for a target and build machine specific resource!
   5.656 -    eval resource=\${builddep_devkit_BUILD_${rewritten_build_var}_TARGET_${rewritten_target_var}}
   5.657 -    if test "x$resource" = x; then
   5.658 -      # Ok, lets instead look for a target specific resource
   5.659 -      eval resource=\${builddep_devkit_TARGET_${rewritten_target_var}}
   5.660 -    fi
   5.661 -    if test "x$resource" = x; then
   5.662 -      # Ok, lets instead look for a build specific resource
   5.663 -      eval resource=\${builddep_devkit_BUILD_${rewritten_build_var}}
   5.664 -    fi
   5.665 -    if test "x$resource" = x; then
   5.666 -      # Ok, lets instead look for a generic resource
   5.667 -      # (The devkit comes from M4 and not the shell, thus no need for eval here.)
   5.668 -      resource=${builddep_devkit}
   5.669 -    fi
   5.670 -    if test "x$resource" != x; then
   5.671 -      { $as_echo "$as_me:${as_lineno-$LINENO}: Using builddeps $resource for devkit" >&5
   5.672 -$as_echo "$as_me: Using builddeps $resource for devkit" >&6;}
   5.673 -      # If the resource in the builddeps.conf file is an existing directory,
   5.674 -      # for example /java/linux/cups
   5.675 -      if test -d ${resource}; then
   5.676 -        depdir=${resource}
   5.677 -      else
   5.678 -
   5.679 -  # devkit is for example mymodule
   5.680 -  # $resource is for example libs/general/libmymod_1_2_3.zip
   5.681 -  # $with_builddeps_server is for example ftp://mybuilddeps.myserver.com/builddeps
   5.682 -  # $with_builddeps_dir is for example /localhome/builddeps
   5.683 -  # depdir is the name of the variable into which we store the depdir, eg MYMOD
   5.684 -  # Will download ftp://mybuilddeps.myserver.com/builddeps/libs/general/libmymod_1_2_3.zip and
   5.685 -  # unzip into the directory: /localhome/builddeps/libmymod_1_2_3
   5.686 -  filename=`basename $resource`
   5.687 -  filebase=`echo $filename | sed 's/\.[^\.]*$//'`
   5.688 -  filebase=${filename%%.*}
   5.689 -  extension=${filename#*.}
   5.690 -  installdir=$with_builddeps_dir/$filebase
   5.691 -  if test ! -f $installdir/$filename.unpacked; then
   5.692 -    { $as_echo "$as_me:${as_lineno-$LINENO}: Downloading build dependency devkit from $with_builddeps_server/$resource and installing into $installdir" >&5
   5.693 -$as_echo "$as_me: Downloading build dependency devkit from $with_builddeps_server/$resource and installing into $installdir" >&6;}
   5.694 -    if test ! -d $installdir; then
   5.695 -      mkdir -p $installdir
   5.696 -    fi
   5.697 -    if test ! -d $installdir; then
   5.698 -      as_fn_error $? "Could not create directory $installdir" "$LINENO" 5
   5.699 -    fi
   5.700 -    tmpfile=`mktemp $installdir/devkit.XXXXXXXXX`
   5.701 -    touch $tmpfile
   5.702 -    if test ! -f $tmpfile; then
   5.703 -      as_fn_error $? "Could not create files in directory $installdir" "$LINENO" 5
   5.704 -    fi
   5.705 -
   5.706 -  # $with_builddeps_server/$resource  is the ftp://abuilddeps.server.com/libs/cups.zip
   5.707 -  # $tmpfile is the local file name for the downloaded file.
   5.708 -  VALID_TOOL=no
   5.709 -  if test "x$BDEPS_FTP" = xwget; then
   5.710 -    VALID_TOOL=yes
   5.711 -    wget -O $tmpfile $with_builddeps_server/$resource
   5.712 -  fi
   5.713 -  if test "x$BDEPS_FTP" = xlftp; then
   5.714 -    VALID_TOOL=yes
   5.715 -    lftp -c "get $with_builddeps_server/$resource  -o $tmpfile"
   5.716 -  fi
   5.717 -  if test "x$BDEPS_FTP" = xftp; then
   5.718 -    VALID_TOOL=yes
   5.719 -    FTPSERVER=`echo $with_builddeps_server/$resource  | cut -f 3 -d '/'`
   5.720 -    FTPPATH=`echo $with_builddeps_server/$resource  | cut -f 4- -d '/'`
   5.721 -    FTPUSERPWD=${FTPSERVER%%@*}
   5.722 -    if test "x$FTPSERVER" != "x$FTPUSERPWD"; then
   5.723 -      FTPUSER=${userpwd%%:*}
   5.724 -      FTPPWD=${userpwd#*@}
   5.725 -      FTPSERVER=${FTPSERVER#*@}
   5.726 -    else
   5.727 -      FTPUSER=ftp
   5.728 -      FTPPWD=ftp
   5.729 -    fi
   5.730 -    # the "pass" command does not work on some
   5.731 -    # ftp clients (read ftp.exe) but if it works,
   5.732 -    # passive mode is better!
   5.733 -    ( \
   5.734 -        echo "user $FTPUSER $FTPPWD"        ; \
   5.735 -        echo "pass"                         ; \
   5.736 -        echo "bin"                          ; \
   5.737 -        echo "get $FTPPATH $tmpfile"              ; \
   5.738 -    ) | ftp -in $FTPSERVER
   5.739 -  fi
   5.740 -  if test "x$VALID_TOOL" != xyes; then
   5.741 -    as_fn_error $? "I do not know how to use the tool: $BDEPS_FTP" "$LINENO" 5
   5.742 -  fi
   5.743 -
   5.744 -    mv $tmpfile $installdir/$filename
   5.745 -    if test ! -s $installdir/$filename; then
   5.746 -      as_fn_error $? "Could not download $with_builddeps_server/$resource" "$LINENO" 5
   5.747 -    fi
   5.748 -    case "$extension" in
   5.749 -      zip)  echo "Unzipping $installdir/$filename..."
   5.750 -        (cd $installdir ; rm -f $installdir/$filename.unpacked ; $BDEPS_UNZIP $installdir/$filename > /dev/null && touch $installdir/$filename.unpacked)
   5.751 -        ;;
   5.752 -      tar.gz) echo "Untaring $installdir/$filename..."
   5.753 -        (cd $installdir ; rm -f $installdir/$filename.unpacked ; tar xzf $installdir/$filename && touch $installdir/$filename.unpacked)
   5.754 -        ;;
   5.755 -      tgz) echo "Untaring $installdir/$filename..."
   5.756 -        (cd $installdir ; rm -f $installdir/$filename.unpacked ; tar xzf $installdir/$filename && touch $installdir/$filename.unpacked)
   5.757 -        ;;
   5.758 -      *) as_fn_error $? "Cannot handle build depency archive with extension $extension" "$LINENO" 5
   5.759 -        ;;
   5.760 -    esac
   5.761 -  fi
   5.762 -  if test -f $installdir/$filename.unpacked; then
   5.763 -    depdir=$installdir
   5.764 -  fi
   5.765 -
   5.766 -      fi
   5.767 -      # Source the builddeps file again, because in the previous command, the depdir
   5.768 -      # was updated to point at the current build dependency install directory.
   5.769 -      . $builddepsfile
   5.770 -      # Now extract variables from the builddeps.conf files.
   5.771 -      theroot=${builddep_devkit_ROOT}
   5.772 -      thecflags=${builddep_devkit_CFLAGS}
   5.773 -      thelibs=${builddep_devkit_LIBS}
   5.774 -      if test "x$depdir" = x; then
   5.775 -        as_fn_error $? "Could not download build dependency devkit" "$LINENO" 5
   5.776 -      fi
   5.777 -      DEVKIT=$depdir
   5.778 -      if test "x$theroot" != x; then
   5.779 -        DEVKIT="$theroot"
   5.780 -      fi
   5.781 -      if test "x$thecflags" != x; then
   5.782 -        DEVKIT_CFLAGS="$thecflags"
   5.783 -      fi
   5.784 -      if test "x$thelibs" != x; then
   5.785 -        DEVKIT_LIBS="$thelibs"
   5.786 -      fi
   5.787 -
   5.788 -        # Found devkit
   5.789 -        PATH="$DEVKIT/bin:$PATH"
   5.790 -        SYS_ROOT="$DEVKIT/${rewritten_target}/sys-root"
   5.791 -        if test "x$x_includes" = "xNONE"; then
   5.792 -          x_includes="$SYS_ROOT/usr/include/X11"
   5.793 -        fi
   5.794 -        if test "x$x_libraries" = "xNONE"; then
   5.795 -          x_libraries="$SYS_ROOT/usr/lib"
   5.796 -        fi
   5.797 -
   5.798 -
   5.799 -    fi
   5.800 -
   5.801 -  fi
   5.802 -
   5.803 +  if test "x$TOOLCHAIN_PATH" != x; then
   5.804 +    PATH=$TOOLCHAIN_PATH:$PATH
   5.805 +  fi
   5.806  
   5.807  
   5.808    #
   5.809 @@ -26169,59 +26132,59 @@
   5.810      # used.
   5.811  
   5.812      CC=
   5.813 -    # If TOOLS_DIR is set, check for all compiler names in there first
   5.814 +    # If TOOLCHAIN_PATH is set, check for all compiler names in there first
   5.815      # before checking the rest of the PATH.
   5.816      # FIXME: Now that we prefix the TOOLS_DIR to the PATH in the PRE_DETECTION
   5.817      # step, this should not be necessary.
   5.818 -    if test -n "$TOOLS_DIR"; then
   5.819 +    if test -n "$TOOLCHAIN_PATH"; then
   5.820        PATH_save="$PATH"
   5.821 -      PATH="$TOOLS_DIR"
   5.822 -      for ac_prog in $TOOLCHAIN_CC_BINARY
   5.823 -do
   5.824 -  # Extract the first word of "$ac_prog", so it can be a program name with args.
   5.825 -set dummy $ac_prog; ac_word=$2
   5.826 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
   5.827 -$as_echo_n "checking for $ac_word... " >&6; }
   5.828 -if ${ac_cv_path_TOOLS_DIR_CC+:} false; then :
   5.829 -  $as_echo_n "(cached) " >&6
   5.830 -else
   5.831 -  case $TOOLS_DIR_CC in
   5.832 -  [\\/]* | ?:[\\/]*)
   5.833 -  ac_cv_path_TOOLS_DIR_CC="$TOOLS_DIR_CC" # Let the user override the test with a path.
   5.834 -  ;;
   5.835 -  *)
   5.836 -  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
   5.837 -for as_dir in $PATH
   5.838 -do
   5.839 -  IFS=$as_save_IFS
   5.840 -  test -z "$as_dir" && as_dir=.
   5.841 -    for ac_exec_ext in '' $ac_executable_extensions; do
   5.842 -  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
   5.843 -    ac_cv_path_TOOLS_DIR_CC="$as_dir/$ac_word$ac_exec_ext"
   5.844 -    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
   5.845 -    break 2
   5.846 -  fi
   5.847 -done
   5.848 -  done
   5.849 -IFS=$as_save_IFS
   5.850 -
   5.851 -  ;;
   5.852 -esac
   5.853 -fi
   5.854 -TOOLS_DIR_CC=$ac_cv_path_TOOLS_DIR_CC
   5.855 -if test -n "$TOOLS_DIR_CC"; then
   5.856 -  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $TOOLS_DIR_CC" >&5
   5.857 -$as_echo "$TOOLS_DIR_CC" >&6; }
   5.858 -else
   5.859 -  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
   5.860 -$as_echo "no" >&6; }
   5.861 -fi
   5.862 -
   5.863 -
   5.864 -  test -n "$TOOLS_DIR_CC" && break
   5.865 -done
   5.866 -
   5.867 -      CC=$TOOLS_DIR_CC
   5.868 +      PATH="$TOOLCHAIN_PATH"
   5.869 +      for ac_prog in $SEARCH_LIST
   5.870 +do
   5.871 +  # Extract the first word of "$ac_prog", so it can be a program name with args.
   5.872 +set dummy $ac_prog; ac_word=$2
   5.873 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
   5.874 +$as_echo_n "checking for $ac_word... " >&6; }
   5.875 +if ${ac_cv_path_TOOLCHAIN_PATH_CC+:} false; then :
   5.876 +  $as_echo_n "(cached) " >&6
   5.877 +else
   5.878 +  case $TOOLCHAIN_PATH_CC in
   5.879 +  [\\/]* | ?:[\\/]*)
   5.880 +  ac_cv_path_TOOLCHAIN_PATH_CC="$TOOLCHAIN_PATH_CC" # Let the user override the test with a path.
   5.881 +  ;;
   5.882 +  *)
   5.883 +  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
   5.884 +for as_dir in $PATH
   5.885 +do
   5.886 +  IFS=$as_save_IFS
   5.887 +  test -z "$as_dir" && as_dir=.
   5.888 +    for ac_exec_ext in '' $ac_executable_extensions; do
   5.889 +  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
   5.890 +    ac_cv_path_TOOLCHAIN_PATH_CC="$as_dir/$ac_word$ac_exec_ext"
   5.891 +    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
   5.892 +    break 2
   5.893 +  fi
   5.894 +done
   5.895 +  done
   5.896 +IFS=$as_save_IFS
   5.897 +
   5.898 +  ;;
   5.899 +esac
   5.900 +fi
   5.901 +TOOLCHAIN_PATH_CC=$ac_cv_path_TOOLCHAIN_PATH_CC
   5.902 +if test -n "$TOOLCHAIN_PATH_CC"; then
   5.903 +  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $TOOLCHAIN_PATH_CC" >&5
   5.904 +$as_echo "$TOOLCHAIN_PATH_CC" >&6; }
   5.905 +else
   5.906 +  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
   5.907 +$as_echo "no" >&6; }
   5.908 +fi
   5.909 +
   5.910 +
   5.911 +  test -n "$TOOLCHAIN_PATH_CC" && break
   5.912 +done
   5.913 +
   5.914 +      CC=$TOOLCHAIN_PATH_CC
   5.915        PATH="$PATH_save"
   5.916      fi
   5.917  
   5.918 @@ -27877,59 +27840,59 @@
   5.919      # used.
   5.920  
   5.921      CXX=
   5.922 -    # If TOOLS_DIR is set, check for all compiler names in there first
   5.923 +    # If TOOLCHAIN_PATH is set, check for all compiler names in there first
   5.924      # before checking the rest of the PATH.
   5.925      # FIXME: Now that we prefix the TOOLS_DIR to the PATH in the PRE_DETECTION
   5.926      # step, this should not be necessary.
   5.927 -    if test -n "$TOOLS_DIR"; then
   5.928 +    if test -n "$TOOLCHAIN_PATH"; then
   5.929        PATH_save="$PATH"
   5.930 -      PATH="$TOOLS_DIR"
   5.931 -      for ac_prog in $TOOLCHAIN_CXX_BINARY
   5.932 -do
   5.933 -  # Extract the first word of "$ac_prog", so it can be a program name with args.
   5.934 -set dummy $ac_prog; ac_word=$2
   5.935 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
   5.936 -$as_echo_n "checking for $ac_word... " >&6; }
   5.937 -if ${ac_cv_path_TOOLS_DIR_CXX+:} false; then :
   5.938 -  $as_echo_n "(cached) " >&6
   5.939 -else
   5.940 -  case $TOOLS_DIR_CXX in
   5.941 -  [\\/]* | ?:[\\/]*)
   5.942 -  ac_cv_path_TOOLS_DIR_CXX="$TOOLS_DIR_CXX" # Let the user override the test with a path.
   5.943 -  ;;
   5.944 -  *)
   5.945 -  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
   5.946 -for as_dir in $PATH
   5.947 -do
   5.948 -  IFS=$as_save_IFS
   5.949 -  test -z "$as_dir" && as_dir=.
   5.950 -    for ac_exec_ext in '' $ac_executable_extensions; do
   5.951 -  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
   5.952 -    ac_cv_path_TOOLS_DIR_CXX="$as_dir/$ac_word$ac_exec_ext"
   5.953 -    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
   5.954 -    break 2
   5.955 -  fi
   5.956 -done
   5.957 -  done
   5.958 -IFS=$as_save_IFS
   5.959 -
   5.960 -  ;;
   5.961 -esac
   5.962 -fi
   5.963 -TOOLS_DIR_CXX=$ac_cv_path_TOOLS_DIR_CXX
   5.964 -if test -n "$TOOLS_DIR_CXX"; then
   5.965 -  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $TOOLS_DIR_CXX" >&5
   5.966 -$as_echo "$TOOLS_DIR_CXX" >&6; }
   5.967 -else
   5.968 -  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
   5.969 -$as_echo "no" >&6; }
   5.970 -fi
   5.971 -
   5.972 -
   5.973 -  test -n "$TOOLS_DIR_CXX" && break
   5.974 -done
   5.975 -
   5.976 -      CXX=$TOOLS_DIR_CXX
   5.977 +      PATH="$TOOLCHAIN_PATH"
   5.978 +      for ac_prog in $SEARCH_LIST
   5.979 +do
   5.980 +  # Extract the first word of "$ac_prog", so it can be a program name with args.
   5.981 +set dummy $ac_prog; ac_word=$2
   5.982 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
   5.983 +$as_echo_n "checking for $ac_word... " >&6; }
   5.984 +if ${ac_cv_path_TOOLCHAIN_PATH_CXX+:} false; then :
   5.985 +  $as_echo_n "(cached) " >&6
   5.986 +else
   5.987 +  case $TOOLCHAIN_PATH_CXX in
   5.988 +  [\\/]* | ?:[\\/]*)
   5.989 +  ac_cv_path_TOOLCHAIN_PATH_CXX="$TOOLCHAIN_PATH_CXX" # Let the user override the test with a path.
   5.990 +  ;;
   5.991 +  *)
   5.992 +  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
   5.993 +for as_dir in $PATH
   5.994 +do
   5.995 +  IFS=$as_save_IFS
   5.996 +  test -z "$as_dir" && as_dir=.
   5.997 +    for ac_exec_ext in '' $ac_executable_extensions; do
   5.998 +  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
   5.999 +    ac_cv_path_TOOLCHAIN_PATH_CXX="$as_dir/$ac_word$ac_exec_ext"
  5.1000 +    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
  5.1001 +    break 2
  5.1002 +  fi
  5.1003 +done
  5.1004 +  done
  5.1005 +IFS=$as_save_IFS
  5.1006 +
  5.1007 +  ;;
  5.1008 +esac
  5.1009 +fi
  5.1010 +TOOLCHAIN_PATH_CXX=$ac_cv_path_TOOLCHAIN_PATH_CXX
  5.1011 +if test -n "$TOOLCHAIN_PATH_CXX"; then
  5.1012 +  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $TOOLCHAIN_PATH_CXX" >&5
  5.1013 +$as_echo "$TOOLCHAIN_PATH_CXX" >&6; }
  5.1014 +else
  5.1015 +  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
  5.1016 +$as_echo "no" >&6; }
  5.1017 +fi
  5.1018 +
  5.1019 +
  5.1020 +  test -n "$TOOLCHAIN_PATH_CXX" && break
  5.1021 +done
  5.1022 +
  5.1023 +      CXX=$TOOLCHAIN_PATH_CXX
  5.1024        PATH="$PATH_save"
  5.1025      fi
  5.1026  
  5.1027 @@ -39404,6 +39367,32 @@
  5.1028      CCXXFLAGS="$CCXXFLAGS -nologo"
  5.1029    fi
  5.1030  
  5.1031 +  if test "x$SYSROOT" != "x"; then
  5.1032 +    if test "x$TOOLCHAIN_TYPE" = xsolstudio; then
  5.1033 +      if test "x$OPENJDK_TARGET_OS" = xsolaris; then
  5.1034 +        # Solaris Studio does not have a concept of sysroot. Instead we must
  5.1035 +        # make sure the default include and lib dirs are appended to each
  5.1036 +        # compile and link command line.
  5.1037 +        SYSROOT_CFLAGS="-I$SYSROOT/usr/include"
  5.1038 +        SYSROOT_LDFLAGS="-L$SYSROOT/usr/lib$OPENJDK_TARGET_CPU_ISADIR \
  5.1039 +            -L$SYSROOT/lib$OPENJDK_TARGET_CPU_ISADIR \
  5.1040 +            -L$SYSROOT/usr/ccs/lib$OPENJDK_TARGET_CPU_ISADIR"
  5.1041 +      fi
  5.1042 +    elif test "x$TOOLCHAIN_TYPE" = xgcc; then
  5.1043 +      SYSROOT_CFLAGS="--sysroot=\"$SYSROOT\""
  5.1044 +      SYSROOT_LDFLAGS="--sysroot=\"$SYSROOT\""
  5.1045 +    elif test "x$TOOLCHAIN_TYPE" = xclang; then
  5.1046 +      SYSROOT_CFLAGS="-isysroot \"$SYSROOT\""
  5.1047 +      SYSROOT_LDFLAGS="-isysroot \"$SYSROOT\""
  5.1048 +    fi
  5.1049 +    # Propagate the sysroot args to hotspot
  5.1050 +    LEGACY_EXTRA_CFLAGS="$LEGACY_EXTRA_CFLAGS $SYSROOT_CFLAGS"
  5.1051 +    LEGACY_EXTRA_CXXFLAGS="$LEGACY_EXTRA_CXXFLAGS $SYSROOT_CFLAGS"
  5.1052 +    LEGACY_EXTRA_LDFLAGS="$LEGACY_EXTRA_LDFLAGS $SYSROOT_LDFLAGS"
  5.1053 +  fi
  5.1054 +
  5.1055 +
  5.1056 +
  5.1057  
  5.1058  # FIXME: Currently we must test this after toolchain but before flags. Fix!
  5.1059  
  5.1060 @@ -40257,9 +40246,9 @@
  5.1061    LDFLAGS_JDK="${LDFLAGS_JDK} $with_extra_ldflags"
  5.1062  
  5.1063    # Hotspot needs these set in their legacy form
  5.1064 -  LEGACY_EXTRA_CFLAGS=$with_extra_cflags
  5.1065 -  LEGACY_EXTRA_CXXFLAGS=$with_extra_cxxflags
  5.1066 -  LEGACY_EXTRA_LDFLAGS=$with_extra_ldflags
  5.1067 +  LEGACY_EXTRA_CFLAGS="$LEGACY_EXTRA_CFLAGS $with_extra_cflags"
  5.1068 +  LEGACY_EXTRA_CXXFLAGS="$LEGACY_EXTRA_CXXFLAGS $with_extra_cxxflags"
  5.1069 +  LEGACY_EXTRA_LDFLAGS="$LEGACY_EXTRA_LDFLAGS $with_extra_ldflags"
  5.1070  
  5.1071  
  5.1072  
  5.1073 @@ -40575,7 +40564,13 @@
  5.1074        CCXXFLAGS_JDK="$CCXXFLAGS_JDK -D_LITTLE_ENDIAN"
  5.1075      fi
  5.1076    else
  5.1077 -    CCXXFLAGS_JDK="$CCXXFLAGS_JDK -D_BIG_ENDIAN"
  5.1078 +    # Same goes for _BIG_ENDIAN. Do we really need to set *ENDIAN on Solaris if they
  5.1079 +    # are defined in the system?
  5.1080 +    if test "x$OPENJDK_TARGET_OS" = xsolaris; then
  5.1081 +      CCXXFLAGS_JDK="$CCXXFLAGS_JDK -D_BIG_ENDIAN="
  5.1082 +    else
  5.1083 +      CCXXFLAGS_JDK="$CCXXFLAGS_JDK -D_BIG_ENDIAN"
  5.1084 +    fi
  5.1085    fi
  5.1086  
  5.1087    # Setup target OS define. Use OS target name but in upper case.
  5.1088 @@ -41161,21 +41156,23 @@
  5.1089    # Check if the user has specified sysroot, but not --x-includes or --x-libraries.
  5.1090    # Make a simple check for the libraries at the sysroot, and setup --x-includes and
  5.1091    # --x-libraries for the sysroot, if that seems to be correct.
  5.1092 -  if test "x$SYS_ROOT" != "x/"; then
  5.1093 -    if test "x$x_includes" = xNONE; then
  5.1094 -      if test -f "$SYS_ROOT/usr/X11R6/include/X11/Xlib.h"; then
  5.1095 -        x_includes="$SYS_ROOT/usr/X11R6/include"
  5.1096 -      elif test -f "$SYS_ROOT/usr/include/X11/Xlib.h"; then
  5.1097 -        x_includes="$SYS_ROOT/usr/include"
  5.1098 -      fi
  5.1099 -    fi
  5.1100 -    if test "x$x_libraries" = xNONE; then
  5.1101 -      if test -f "$SYS_ROOT/usr/X11R6/lib/libX11.so"; then
  5.1102 -        x_libraries="$SYS_ROOT/usr/X11R6/lib"
  5.1103 -      elif test "$SYS_ROOT/usr/lib64/libX11.so" && test "x$OPENJDK_TARGET_CPU_BITS" = x64; then
  5.1104 -        x_libraries="$SYS_ROOT/usr/lib64"
  5.1105 -      elif test -f "$SYS_ROOT/usr/lib/libX11.so"; then
  5.1106 -        x_libraries="$SYS_ROOT/usr/lib"
  5.1107 +  if test "x$OPENJDK_TARGET_OS" = "xlinux"; then
  5.1108 +    if test "x$SYSROOT" != "x"; then
  5.1109 +      if test "x$x_includes" = xNONE; then
  5.1110 +        if test -f "$SYSROOT/usr/X11R6/include/X11/Xlib.h"; then
  5.1111 +          x_includes="$SYSROOT/usr/X11R6/include"
  5.1112 +        elif test -f "$SYSROOT/usr/include/X11/Xlib.h"; then
  5.1113 +          x_includes="$SYSROOT/usr/include"
  5.1114 +        fi
  5.1115 +      fi
  5.1116 +      if test "x$x_libraries" = xNONE; then
  5.1117 +        if test -f "$SYSROOT/usr/X11R6/lib/libX11.so"; then
  5.1118 +          x_libraries="$SYSROOT/usr/X11R6/lib"
  5.1119 +        elif test "$SYSROOT/usr/lib64/libX11.so" && test "x$OPENJDK_TARGET_CPU_BITS" = x64; then
  5.1120 +          x_libraries="$SYSROOT/usr/lib64"
  5.1121 +        elif test -f "$SYSROOT/usr/lib/libX11.so"; then
  5.1122 +          x_libraries="$SYSROOT/usr/lib"
  5.1123 +        fi
  5.1124        fi
  5.1125      fi
  5.1126    fi
  5.1127 @@ -41905,11 +41902,15 @@
  5.1128      as_fn_error $? "Could not find X11 libraries. $HELP_MSG" "$LINENO" 5
  5.1129    fi
  5.1130  
  5.1131 +
  5.1132    if test "x$OPENJDK_TARGET_OS" = xsolaris; then
  5.1133      OPENWIN_HOME="/usr/openwin"
  5.1134 -  fi
  5.1135 -
  5.1136 -
  5.1137 +    X_CFLAGS="-I$SYSROOT$OPENWIN_HOME/include -I$SYSROOT$OPENWIN_HOME/include/X11/extensions"
  5.1138 +    X_LIBS="-L$SYSROOT$OPENWIN_HOME/sfw/lib$OPENJDK_TARGET_CPU_ISADIR \
  5.1139 +        -L$SYSROOT$OPENWIN_HOME/lib$OPENJDK_TARGET_CPU_ISADIR \
  5.1140 +        -R$OPENWIN_HOME/sfw/lib$OPENJDK_TARGET_CPU_ISADIR \
  5.1141 +        -R$OPENWIN_HOME/lib$OPENJDK_TARGET_CPU_ISADIR"
  5.1142 +  fi
  5.1143  
  5.1144    #
  5.1145    # Weird Sol10 something check...TODO change to try compile
  5.1146 @@ -42209,14 +42210,14 @@
  5.1147        # package installation locations.
  5.1148        { $as_echo "$as_me:${as_lineno-$LINENO}: checking for cups headers" >&5
  5.1149  $as_echo_n "checking for cups headers... " >&6; }
  5.1150 -      if test -s /opt/sfw/cups/include/cups/cups.h; then
  5.1151 +      if test -s $SYSROOT/opt/sfw/cups/include/cups/cups.h; then
  5.1152          # An SFW package seems to be installed!
  5.1153          CUPS_FOUND=yes
  5.1154 -        CUPS_CFLAGS="-I/opt/sfw/cups/include"
  5.1155 -      elif test -s /opt/csw/include/cups/cups.h; then
  5.1156 +        CUPS_CFLAGS="-I$SYSROOT/opt/sfw/cups/include"
  5.1157 +      elif test -s $SYSROOT/opt/csw/include/cups/cups.h; then
  5.1158          # A CSW package seems to be installed!
  5.1159          CUPS_FOUND=yes
  5.1160 -        CUPS_CFLAGS="-I/opt/csw/include"
  5.1161 +        CUPS_CFLAGS="-I$SYSROOT/opt/csw/include"
  5.1162        fi
  5.1163        { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CUPS_FOUND" >&5
  5.1164  $as_echo "$CUPS_FOUND" >&6; }
  5.1165 @@ -42809,9 +42810,11 @@
  5.1166          fi
  5.1167        fi
  5.1168  
  5.1169 -      if test "x$FOUND_FREETYPE" != xyes; then
  5.1170 -        # Check modules using pkg-config, but only if we have it (ugly output results otherwise)
  5.1171 -        if test "x$PKG_CONFIG" != x; then
  5.1172 +      # If we have a sysroot, assume that's where we are supposed to look and skip pkg-config.
  5.1173 +      if test "x$SYSROOT" = x; then
  5.1174 +        if test "x$FOUND_FREETYPE" != xyes; then
  5.1175 +          # Check modules using pkg-config, but only if we have it (ugly output results otherwise)
  5.1176 +          if test "x$PKG_CONFIG" != x; then
  5.1177  
  5.1178  pkg_failed=no
  5.1179  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for FREETYPE" >&5
  5.1180 @@ -42879,23 +42882,24 @@
  5.1181  $as_echo "yes" >&6; }
  5.1182  	FOUND_FREETYPE=yes
  5.1183  fi
  5.1184 -          if test "x$FOUND_FREETYPE" = xyes; then
  5.1185 -            # On solaris, pkg_check adds -lz to freetype libs, which isn't necessary for us.
  5.1186 -            FREETYPE_LIBS=`$ECHO $FREETYPE_LIBS | $SED 's/-lz//g'`
  5.1187 -            # 64-bit libs for Solaris x86 are installed in the amd64 subdirectory, change lib to lib/amd64
  5.1188 -            if test "x$OPENJDK_TARGET_OS" = xsolaris && test "x$OPENJDK_TARGET_CPU" = xx86_64; then
  5.1189 -              FREETYPE_LIBS=`$ECHO $FREETYPE_LIBS | $SED 's?/lib?/lib/amd64?g'`
  5.1190 -            fi
  5.1191 -            # BDEPS_CHECK_MODULE will set FREETYPE_CFLAGS and _LIBS, but we don't get a lib path for bundling.
  5.1192 -            if test "x$BUNDLE_FREETYPE" = xyes; then
  5.1193 -              { $as_echo "$as_me:${as_lineno-$LINENO}: Found freetype using pkg-config, but ignoring since we can not bundle that" >&5
  5.1194 +            if test "x$FOUND_FREETYPE" = xyes; then
  5.1195 +              # On solaris, pkg_check adds -lz to freetype libs, which isn't necessary for us.
  5.1196 +              FREETYPE_LIBS=`$ECHO $FREETYPE_LIBS | $SED 's/-lz//g'`
  5.1197 +              # 64-bit libs for Solaris x86 are installed in the amd64 subdirectory, change lib to lib/amd64
  5.1198 +              if test "x$OPENJDK_TARGET_OS" = xsolaris && test "x$OPENJDK_TARGET_CPU" = xx86_64; then
  5.1199 +                FREETYPE_LIBS=`$ECHO $FREETYPE_LIBS | $SED 's?/lib?/lib/amd64?g'`
  5.1200 +              fi
  5.1201 +              # BDEPS_CHECK_MODULE will set FREETYPE_CFLAGS and _LIBS, but we don't get a lib path for bundling.
  5.1202 +              if test "x$BUNDLE_FREETYPE" = xyes; then
  5.1203 +                { $as_echo "$as_me:${as_lineno-$LINENO}: Found freetype using pkg-config, but ignoring since we can not bundle that" >&5
  5.1204  $as_echo "$as_me: Found freetype using pkg-config, but ignoring since we can not bundle that" >&6;}
  5.1205 -              FOUND_FREETYPE=no
  5.1206 -            else
  5.1207 -              { $as_echo "$as_me:${as_lineno-$LINENO}: checking for freetype" >&5
  5.1208 +                FOUND_FREETYPE=no
  5.1209 +              else
  5.1210 +                { $as_echo "$as_me:${as_lineno-$LINENO}: checking for freetype" >&5
  5.1211  $as_echo_n "checking for freetype... " >&6; }
  5.1212 -              { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes (using pkg-config)" >&5
  5.1213 +                { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes (using pkg-config)" >&5
  5.1214  $as_echo "yes (using pkg-config)" >&6; }
  5.1215 +              fi
  5.1216              fi
  5.1217            fi
  5.1218          fi
  5.1219 @@ -43509,12 +43513,7 @@
  5.1220  
  5.1221            fi
  5.1222          else
  5.1223 -          if test "x$SYS_ROOT" = "x/"; then
  5.1224 -            FREETYPE_ROOT=
  5.1225 -          else
  5.1226 -            FREETYPE_ROOT="$SYS_ROOT"
  5.1227 -          fi
  5.1228 -          FREETYPE_BASE_DIR="$FREETYPE_ROOT/usr"
  5.1229 +          FREETYPE_BASE_DIR="$SYSROOT/usr"
  5.1230  
  5.1231    POTENTIAL_FREETYPE_INCLUDE_PATH="$FREETYPE_BASE_DIR/include"
  5.1232    POTENTIAL_FREETYPE_LIB_PATH="$FREETYPE_BASE_DIR/lib"
  5.1233 @@ -43807,7 +43806,7 @@
  5.1234  
  5.1235  
  5.1236            if test "x$FOUND_FREETYPE" != xyes; then
  5.1237 -            FREETYPE_BASE_DIR="$FREETYPE_ROOT/usr/X11"
  5.1238 +            FREETYPE_BASE_DIR="$SYSROOT/usr/X11"
  5.1239  
  5.1240    POTENTIAL_FREETYPE_INCLUDE_PATH="$FREETYPE_BASE_DIR/include"
  5.1241    POTENTIAL_FREETYPE_LIB_PATH="$FREETYPE_BASE_DIR/lib"
  5.1242 @@ -44101,7 +44100,301 @@
  5.1243            fi
  5.1244  
  5.1245            if test "x$FOUND_FREETYPE" != xyes; then
  5.1246 -            FREETYPE_BASE_DIR="$FREETYPE_ROOT/usr"
  5.1247 +            FREETYPE_BASE_DIR="$SYSROOT/usr/sfw"
  5.1248 +
  5.1249 +  POTENTIAL_FREETYPE_INCLUDE_PATH="$FREETYPE_BASE_DIR/include"
  5.1250 +  POTENTIAL_FREETYPE_LIB_PATH="$FREETYPE_BASE_DIR/lib"
  5.1251 +  METHOD="well-known location"
  5.1252 +
  5.1253 +  # First check if the files exists.
  5.1254 +  if test -s "$POTENTIAL_FREETYPE_INCLUDE_PATH/ft2build.h"; then
  5.1255 +    # We found an arbitrary include file. That's a good sign.
  5.1256 +    { $as_echo "$as_me:${as_lineno-$LINENO}: Found freetype include files at $POTENTIAL_FREETYPE_INCLUDE_PATH using $METHOD" >&5
  5.1257 +$as_echo "$as_me: Found freetype include files at $POTENTIAL_FREETYPE_INCLUDE_PATH using $METHOD" >&6;}
  5.1258 +    FOUND_FREETYPE=yes
  5.1259 +
  5.1260 +    FREETYPE_LIB_NAME="${LIBRARY_PREFIX}freetype${SHARED_LIBRARY_SUFFIX}"
  5.1261 +    if ! test -s "$POTENTIAL_FREETYPE_LIB_PATH/$FREETYPE_LIB_NAME"; then
  5.1262 +      { $as_echo "$as_me:${as_lineno-$LINENO}: Could not find $POTENTIAL_FREETYPE_LIB_PATH/$FREETYPE_LIB_NAME. Ignoring location." >&5
  5.1263 +$as_echo "$as_me: Could not find $POTENTIAL_FREETYPE_LIB_PATH/$FREETYPE_LIB_NAME. Ignoring location." >&6;}
  5.1264 +      FOUND_FREETYPE=no
  5.1265 +    else
  5.1266 +      if test "x$OPENJDK_TARGET_OS" = xwindows; then
  5.1267 +        # On Windows, we will need both .lib and .dll file.
  5.1268 +        if ! test -s "$POTENTIAL_FREETYPE_LIB_PATH/freetype.lib"; then
  5.1269 +          { $as_echo "$as_me:${as_lineno-$LINENO}: Could not find $POTENTIAL_FREETYPE_LIB_PATH/freetype.lib. Ignoring location." >&5
  5.1270 +$as_echo "$as_me: Could not find $POTENTIAL_FREETYPE_LIB_PATH/freetype.lib. Ignoring location." >&6;}
  5.1271 +          FOUND_FREETYPE=no
  5.1272 +        fi
  5.1273 +      elif test "x$OPENJDK_TARGET_OS" = xsolaris && test "x$OPENJDK_TARGET_CPU" = xx86_64 && test -s "$POTENTIAL_FREETYPE_LIB_PATH/amd64/$FREETYPE_LIB_NAME"; then
  5.1274 +        # On solaris-x86_86, default is (normally) PATH/lib/amd64. Update our guess!
  5.1275 +        POTENTIAL_FREETYPE_LIB_PATH="$POTENTIAL_FREETYPE_LIB_PATH/amd64"
  5.1276 +      fi
  5.1277 +    fi
  5.1278 +  fi
  5.1279 +
  5.1280 +  if test "x$FOUND_FREETYPE" = xyes; then
  5.1281 +
  5.1282 +  if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
  5.1283 +
  5.1284 +  # Input might be given as Windows format, start by converting to
  5.1285 +  # unix format.
  5.1286 +  path="$POTENTIAL_FREETYPE_INCLUDE_PATH"
  5.1287 +  new_path=`$CYGPATH -u "$path"`
  5.1288 +
  5.1289 +  # Cygwin tries to hide some aspects of the Windows file system, such that binaries are
  5.1290 +  # named .exe but called without that suffix. Therefore, "foo" and "foo.exe" are considered
  5.1291 +  # the same file, most of the time (as in "test -f"). But not when running cygpath -s, then
  5.1292 +  # "foo.exe" is OK but "foo" is an error.
  5.1293 +  #
  5.1294 +  # This test is therefore slightly more accurate than "test -f" to check for file precense.
  5.1295 +  # It is also a way to make sure we got the proper file name for the real test later on.
  5.1296 +  test_shortpath=`$CYGPATH -s -m "$new_path" 2> /dev/null`
  5.1297 +  if test "x$test_shortpath" = x; then
  5.1298 +    { $as_echo "$as_me:${as_lineno-$LINENO}: The path of POTENTIAL_FREETYPE_INCLUDE_PATH, which resolves as \"$path\", is invalid." >&5
  5.1299 +$as_echo "$as_me: The path of POTENTIAL_FREETYPE_INCLUDE_PATH, which resolves as \"$path\", is invalid." >&6;}
  5.1300 +    as_fn_error $? "Cannot locate the the path of POTENTIAL_FREETYPE_INCLUDE_PATH" "$LINENO" 5
  5.1301 +  fi
  5.1302 +
  5.1303 +  # Call helper function which possibly converts this using DOS-style short mode.
  5.1304 +  # If so, the updated path is stored in $new_path.
  5.1305 +
  5.1306 +  input_path="$new_path"
  5.1307 +  # Check if we need to convert this using DOS-style short mode. If the path
  5.1308 +  # contains just simple characters, use it. Otherwise (spaces, weird characters),
  5.1309 +  # take no chances and rewrite it.
  5.1310 +  # Note: m4 eats our [], so we need to use [ and ] instead.
  5.1311 +  has_forbidden_chars=`$ECHO "$input_path" | $GREP [^-._/a-zA-Z0-9]`
  5.1312 +  if test "x$has_forbidden_chars" != x; then
  5.1313 +    # Now convert it to mixed DOS-style, short mode (no spaces, and / instead of \)
  5.1314 +    shortmode_path=`$CYGPATH -s -m -a "$input_path"`
  5.1315 +    path_after_shortmode=`$CYGPATH -u "$shortmode_path"`
  5.1316 +    if test "x$path_after_shortmode" != "x$input_to_shortpath"; then
  5.1317 +      # Going to short mode and back again did indeed matter. Since short mode is
  5.1318 +      # case insensitive, let's make it lowercase to improve readability.
  5.1319 +      shortmode_path=`$ECHO "$shortmode_path" | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
  5.1320 +      # Now convert it back to Unix-stile (cygpath)
  5.1321 +      input_path=`$CYGPATH -u "$shortmode_path"`
  5.1322 +      new_path="$input_path"
  5.1323 +    fi
  5.1324 +  fi
  5.1325 +
  5.1326 +  test_cygdrive_prefix=`$ECHO $input_path | $GREP ^/cygdrive/`
  5.1327 +  if test "x$test_cygdrive_prefix" = x; then
  5.1328 +    # As a simple fix, exclude /usr/bin since it's not a real path.
  5.1329 +    if test "x`$ECHO $new_path | $GREP ^/usr/bin/`" = x; then
  5.1330 +      # The path is in a Cygwin special directory (e.g. /home). We need this converted to
  5.1331 +      # a path prefixed by /cygdrive for fixpath to work.
  5.1332 +      new_path="$CYGWIN_ROOT_PATH$input_path"
  5.1333 +    fi
  5.1334 +  fi
  5.1335 +
  5.1336 +
  5.1337 +  if test "x$path" != "x$new_path"; then
  5.1338 +    POTENTIAL_FREETYPE_INCLUDE_PATH="$new_path"
  5.1339 +    { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting POTENTIAL_FREETYPE_INCLUDE_PATH to \"$new_path\"" >&5
  5.1340 +$as_echo "$as_me: Rewriting POTENTIAL_FREETYPE_INCLUDE_PATH to \"$new_path\"" >&6;}
  5.1341 +  fi
  5.1342 +
  5.1343 +  elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then
  5.1344 +
  5.1345 +  path="$POTENTIAL_FREETYPE_INCLUDE_PATH"
  5.1346 +  has_colon=`$ECHO $path | $GREP ^.:`
  5.1347 +  new_path="$path"
  5.1348 +  if test "x$has_colon" = x; then
  5.1349 +    # Not in mixed or Windows style, start by that.
  5.1350 +    new_path=`cmd //c echo $path`
  5.1351 +  fi
  5.1352 +
  5.1353 +
  5.1354 +  input_path="$new_path"
  5.1355 +  # Check if we need to convert this using DOS-style short mode. If the path
  5.1356 +  # contains just simple characters, use it. Otherwise (spaces, weird characters),
  5.1357 +  # take no chances and rewrite it.
  5.1358 +  # Note: m4 eats our [], so we need to use [ and ] instead.
  5.1359 +  has_forbidden_chars=`$ECHO "$input_path" | $GREP [^-_/:a-zA-Z0-9]`
  5.1360 +  if test "x$has_forbidden_chars" != x; then
  5.1361 +    # Now convert it to mixed DOS-style, short mode (no spaces, and / instead of \)
  5.1362 +    new_path=`cmd /c "for %A in (\"$input_path\") do @echo %~sA"|$TR \\\\\\\\ / | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
  5.1363 +  fi
  5.1364 +
  5.1365 +
  5.1366 +  windows_path="$new_path"
  5.1367 +  if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
  5.1368 +    unix_path=`$CYGPATH -u "$windows_path"`
  5.1369 +    new_path="$unix_path"
  5.1370 +  elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then
  5.1371 +    unix_path=`$ECHO "$windows_path" | $SED -e 's,^\\(.\\):,/\\1,g' -e 's,\\\\,/,g'`
  5.1372 +    new_path="$unix_path"
  5.1373 +  fi
  5.1374 +
  5.1375 +  if test "x$path" != "x$new_path"; then
  5.1376 +    POTENTIAL_FREETYPE_INCLUDE_PATH="$new_path"
  5.1377 +    { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting POTENTIAL_FREETYPE_INCLUDE_PATH to \"$new_path\"" >&5
  5.1378 +$as_echo "$as_me: Rewriting POTENTIAL_FREETYPE_INCLUDE_PATH to \"$new_path\"" >&6;}
  5.1379 +  fi
  5.1380 +
  5.1381 +  # Save the first 10 bytes of this path to the storage, so fixpath can work.
  5.1382 +  all_fixpath_prefixes=("${all_fixpath_prefixes[@]}" "${new_path:0:10}")
  5.1383 +
  5.1384 +  else
  5.1385 +    # We're on a posix platform. Hooray! :)
  5.1386 +    path="$POTENTIAL_FREETYPE_INCLUDE_PATH"
  5.1387 +    has_space=`$ECHO "$path" | $GREP " "`
  5.1388 +    if test "x$has_space" != x; then
  5.1389 +      { $as_echo "$as_me:${as_lineno-$LINENO}: The path of POTENTIAL_FREETYPE_INCLUDE_PATH, which resolves as \"$path\", is invalid." >&5
  5.1390 +$as_echo "$as_me: The path of POTENTIAL_FREETYPE_INCLUDE_PATH, which resolves as \"$path\", is invalid." >&6;}
  5.1391 +      as_fn_error $? "Spaces are not allowed in this path." "$LINENO" 5
  5.1392 +    fi
  5.1393 +
  5.1394 +    # Use eval to expand a potential ~
  5.1395 +    eval path="$path"
  5.1396 +    if test ! -f "$path" && test ! -d "$path"; then
  5.1397 +      as_fn_error $? "The path of POTENTIAL_FREETYPE_INCLUDE_PATH, which resolves as \"$path\", is not found." "$LINENO" 5
  5.1398 +    fi
  5.1399 +
  5.1400 +    POTENTIAL_FREETYPE_INCLUDE_PATH="`cd "$path"; $THEPWDCMD -L`"
  5.1401 +  fi
  5.1402 +
  5.1403 +
  5.1404 +  if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
  5.1405 +
  5.1406 +  # Input might be given as Windows format, start by converting to
  5.1407 +  # unix format.
  5.1408 +  path="$POTENTIAL_FREETYPE_LIB_PATH"
  5.1409 +  new_path=`$CYGPATH -u "$path"`
  5.1410 +
  5.1411 +  # Cygwin tries to hide some aspects of the Windows file system, such that binaries are
  5.1412 +  # named .exe but called without that suffix. Therefore, "foo" and "foo.exe" are considered
  5.1413 +  # the same file, most of the time (as in "test -f"). But not when running cygpath -s, then
  5.1414 +  # "foo.exe" is OK but "foo" is an error.
  5.1415 +  #
  5.1416 +  # This test is therefore slightly more accurate than "test -f" to check for file precense.
  5.1417 +  # It is also a way to make sure we got the proper file name for the real test later on.
  5.1418 +  test_shortpath=`$CYGPATH -s -m "$new_path" 2> /dev/null`
  5.1419 +  if test "x$test_shortpath" = x; then
  5.1420 +    { $as_echo "$as_me:${as_lineno-$LINENO}: The path of POTENTIAL_FREETYPE_LIB_PATH, which resolves as \"$path\", is invalid." >&5
  5.1421 +$as_echo "$as_me: The path of POTENTIAL_FREETYPE_LIB_PATH, which resolves as \"$path\", is invalid." >&6;}
  5.1422 +    as_fn_error $? "Cannot locate the the path of POTENTIAL_FREETYPE_LIB_PATH" "$LINENO" 5
  5.1423 +  fi
  5.1424 +
  5.1425 +  # Call helper function which possibly converts this using DOS-style short mode.
  5.1426 +  # If so, the updated path is stored in $new_path.
  5.1427 +
  5.1428 +  input_path="$new_path"
  5.1429 +  # Check if we need to convert this using DOS-style short mode. If the path
  5.1430 +  # contains just simple characters, use it. Otherwise (spaces, weird characters),
  5.1431 +  # take no chances and rewrite it.
  5.1432 +  # Note: m4 eats our [], so we need to use [ and ] instead.
  5.1433 +  has_forbidden_chars=`$ECHO "$input_path" | $GREP [^-._/a-zA-Z0-9]`
  5.1434 +  if test "x$has_forbidden_chars" != x; then
  5.1435 +    # Now convert it to mixed DOS-style, short mode (no spaces, and / instead of \)
  5.1436 +    shortmode_path=`$CYGPATH -s -m -a "$input_path"`
  5.1437 +    path_after_shortmode=`$CYGPATH -u "$shortmode_path"`
  5.1438 +    if test "x$path_after_shortmode" != "x$input_to_shortpath"; then
  5.1439 +      # Going to short mode and back again did indeed matter. Since short mode is
  5.1440 +      # case insensitive, let's make it lowercase to improve readability.
  5.1441 +      shortmode_path=`$ECHO "$shortmode_path" | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
  5.1442 +      # Now convert it back to Unix-stile (cygpath)
  5.1443 +      input_path=`$CYGPATH -u "$shortmode_path"`
  5.1444 +      new_path="$input_path"
  5.1445 +    fi
  5.1446 +  fi
  5.1447 +
  5.1448 +  test_cygdrive_prefix=`$ECHO $input_path | $GREP ^/cygdrive/`
  5.1449 +  if test "x$test_cygdrive_prefix" = x; then
  5.1450 +    # As a simple fix, exclude /usr/bin since it's not a real path.
  5.1451 +    if test "x`$ECHO $new_path | $GREP ^/usr/bin/`" = x; then
  5.1452 +      # The path is in a Cygwin special directory (e.g. /home). We need this converted to
  5.1453 +      # a path prefixed by /cygdrive for fixpath to work.
  5.1454 +      new_path="$CYGWIN_ROOT_PATH$input_path"
  5.1455 +    fi
  5.1456 +  fi
  5.1457 +
  5.1458 +
  5.1459 +  if test "x$path" != "x$new_path"; then
  5.1460 +    POTENTIAL_FREETYPE_LIB_PATH="$new_path"
  5.1461 +    { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting POTENTIAL_FREETYPE_LIB_PATH to \"$new_path\"" >&5
  5.1462 +$as_echo "$as_me: Rewriting POTENTIAL_FREETYPE_LIB_PATH to \"$new_path\"" >&6;}
  5.1463 +  fi
  5.1464 +
  5.1465 +  elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then
  5.1466 +
  5.1467 +  path="$POTENTIAL_FREETYPE_LIB_PATH"
  5.1468 +  has_colon=`$ECHO $path | $GREP ^.:`
  5.1469 +  new_path="$path"
  5.1470 +  if test "x$has_colon" = x; then
  5.1471 +    # Not in mixed or Windows style, start by that.
  5.1472 +    new_path=`cmd //c echo $path`
  5.1473 +  fi
  5.1474 +
  5.1475 +
  5.1476 +  input_path="$new_path"
  5.1477 +  # Check if we need to convert this using DOS-style short mode. If the path
  5.1478 +  # contains just simple characters, use it. Otherwise (spaces, weird characters),
  5.1479 +  # take no chances and rewrite it.
  5.1480 +  # Note: m4 eats our [], so we need to use [ and ] instead.
  5.1481 +  has_forbidden_chars=`$ECHO "$input_path" | $GREP [^-_/:a-zA-Z0-9]`
  5.1482 +  if test "x$has_forbidden_chars" != x; then
  5.1483 +    # Now convert it to mixed DOS-style, short mode (no spaces, and / instead of \)
  5.1484 +    new_path=`cmd /c "for %A in (\"$input_path\") do @echo %~sA"|$TR \\\\\\\\ / | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
  5.1485 +  fi
  5.1486 +
  5.1487 +
  5.1488 +  windows_path="$new_path"
  5.1489 +  if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
  5.1490 +    unix_path=`$CYGPATH -u "$windows_path"`
  5.1491 +    new_path="$unix_path"
  5.1492 +  elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then
  5.1493 +    unix_path=`$ECHO "$windows_path" | $SED -e 's,^\\(.\\):,/\\1,g' -e 's,\\\\,/,g'`
  5.1494 +    new_path="$unix_path"
  5.1495 +  fi
  5.1496 +
  5.1497 +  if test "x$path" != "x$new_path"; then
  5.1498 +    POTENTIAL_FREETYPE_LIB_PATH="$new_path"
  5.1499 +    { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting POTENTIAL_FREETYPE_LIB_PATH to \"$new_path\"" >&5
  5.1500 +$as_echo "$as_me: Rewriting POTENTIAL_FREETYPE_LIB_PATH to \"$new_path\"" >&6;}
  5.1501 +  fi
  5.1502 +
  5.1503 +  # Save the first 10 bytes of this path to the storage, so fixpath can work.
  5.1504 +  all_fixpath_prefixes=("${all_fixpath_prefixes[@]}" "${new_path:0:10}")
  5.1505 +
  5.1506 +  else
  5.1507 +    # We're on a posix platform. Hooray! :)
  5.1508 +    path="$POTENTIAL_FREETYPE_LIB_PATH"
  5.1509 +    has_space=`$ECHO "$path" | $GREP " "`
  5.1510 +    if test "x$has_space" != x; then
  5.1511 +      { $as_echo "$as_me:${as_lineno-$LINENO}: The path of POTENTIAL_FREETYPE_LIB_PATH, which resolves as \"$path\", is invalid." >&5
  5.1512 +$as_echo "$as_me: The path of POTENTIAL_FREETYPE_LIB_PATH, which resolves as \"$path\", is invalid." >&6;}
  5.1513 +      as_fn_error $? "Spaces are not allowed in this path." "$LINENO" 5
  5.1514 +    fi
  5.1515 +
  5.1516 +    # Use eval to expand a potential ~
  5.1517 +    eval path="$path"
  5.1518 +    if test ! -f "$path" && test ! -d "$path"; then
  5.1519 +      as_fn_error $? "The path of POTENTIAL_FREETYPE_LIB_PATH, which resolves as \"$path\", is not found." "$LINENO" 5
  5.1520 +    fi
  5.1521 +
  5.1522 +    POTENTIAL_FREETYPE_LIB_PATH="`cd "$path"; $THEPWDCMD -L`"
  5.1523 +  fi
  5.1524 +
  5.1525 +
  5.1526 +    FREETYPE_INCLUDE_PATH="$POTENTIAL_FREETYPE_INCLUDE_PATH"
  5.1527 +    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for freetype includes" >&5
  5.1528 +$as_echo_n "checking for freetype includes... " >&6; }
  5.1529 +    { $as_echo "$as_me:${as_lineno-$LINENO}: result: $FREETYPE_INCLUDE_PATH" >&5
  5.1530 +$as_echo "$FREETYPE_INCLUDE_PATH" >&6; }
  5.1531 +    FREETYPE_LIB_PATH="$POTENTIAL_FREETYPE_LIB_PATH"
  5.1532 +    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for freetype libraries" >&5
  5.1533 +$as_echo_n "checking for freetype libraries... " >&6; }
  5.1534 +    { $as_echo "$as_me:${as_lineno-$LINENO}: result: $FREETYPE_LIB_PATH" >&5
  5.1535 +$as_echo "$FREETYPE_LIB_PATH" >&6; }
  5.1536 +  fi
  5.1537 +
  5.1538 +          fi
  5.1539 +
  5.1540 +          if test "x$FOUND_FREETYPE" != xyes; then
  5.1541 +            FREETYPE_BASE_DIR="$SYSROOT/usr"
  5.1542              if test "x$OPENJDK_TARGET_CPU_BITS" = x64; then
  5.1543  
  5.1544    POTENTIAL_FREETYPE_INCLUDE_PATH="$FREETYPE_BASE_DIR/include"
  5.1545 @@ -45577,7 +45870,9 @@
  5.1546    fi
  5.1547  
  5.1548      fi
  5.1549 -    if test "x$ALSA_FOUND" = xno; then
  5.1550 +    # Do not try pkg-config if we have a sysroot set.
  5.1551 +    if test "x$SYSROOT" = x; then
  5.1552 +      if test "x$ALSA_FOUND" = xno; then
  5.1553  
  5.1554  pkg_failed=no
  5.1555  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ALSA" >&5
  5.1556 @@ -45645,6 +45940,7 @@
  5.1557  $as_echo "yes" >&6; }
  5.1558  	ALSA_FOUND=yes
  5.1559  fi
  5.1560 +      fi
  5.1561      fi
  5.1562      if test "x$ALSA_FOUND" = xno; then
  5.1563        for ac_header in alsa/asoundlib.h
  5.1564 @@ -46412,7 +46708,7 @@
  5.1565  
  5.1566    # libCrun is the c++ runtime-library with SunStudio (roughly the equivalent of gcc's libstdc++.so)
  5.1567    if test "x$TOOLCHAIN_TYPE" = xsolstudio && test "x$LIBCXX" = x; then
  5.1568 -    LIBCXX="/usr/lib${OPENJDK_TARGET_CPU_ISADIR}/libCrun.so.1"
  5.1569 +    LIBCXX="${SYSROOT}/usr/lib${OPENJDK_TARGET_CPU_ISADIR}/libCrun.so.1"
  5.1570    fi
  5.1571  
  5.1572    # TODO better (platform agnostic) test
  5.1573 @@ -47337,8 +47633,8 @@
  5.1574      { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
  5.1575  $as_echo "yes" >&6; }
  5.1576      OLD_PATH="$PATH"
  5.1577 -    if test "x$TOOLS_DIR" != x; then
  5.1578 -      PATH=$TOOLS_DIR:$PATH
  5.1579 +    if test "x$TOOLCHAIN_PATH" != x; then
  5.1580 +      PATH=$TOOLCHAIN_PATH:$PATH
  5.1581      fi
  5.1582  
  5.1583  
     6.1 --- a/common/autoconf/libraries.m4	Thu Apr 12 02:54:38 2018 -0700
     6.2 +++ b/common/autoconf/libraries.m4	Mon Apr 16 00:48:00 2018 -0700
     6.3 @@ -97,21 +97,23 @@
     6.4    # Check if the user has specified sysroot, but not --x-includes or --x-libraries.
     6.5    # Make a simple check for the libraries at the sysroot, and setup --x-includes and
     6.6    # --x-libraries for the sysroot, if that seems to be correct.
     6.7 -  if test "x$SYS_ROOT" != "x/"; then
     6.8 -    if test "x$x_includes" = xNONE; then
     6.9 -      if test -f "$SYS_ROOT/usr/X11R6/include/X11/Xlib.h"; then
    6.10 -        x_includes="$SYS_ROOT/usr/X11R6/include"
    6.11 -      elif test -f "$SYS_ROOT/usr/include/X11/Xlib.h"; then
    6.12 -        x_includes="$SYS_ROOT/usr/include"
    6.13 +  if test "x$OPENJDK_TARGET_OS" = "xlinux"; then
    6.14 +    if test "x$SYSROOT" != "x"; then
    6.15 +      if test "x$x_includes" = xNONE; then
    6.16 +        if test -f "$SYSROOT/usr/X11R6/include/X11/Xlib.h"; then
    6.17 +          x_includes="$SYSROOT/usr/X11R6/include"
    6.18 +        elif test -f "$SYSROOT/usr/include/X11/Xlib.h"; then
    6.19 +          x_includes="$SYSROOT/usr/include"
    6.20 +        fi
    6.21        fi
    6.22 -    fi
    6.23 -    if test "x$x_libraries" = xNONE; then
    6.24 -      if test -f "$SYS_ROOT/usr/X11R6/lib/libX11.so"; then
    6.25 -        x_libraries="$SYS_ROOT/usr/X11R6/lib"
    6.26 -      elif test "$SYS_ROOT/usr/lib64/libX11.so" && test "x$OPENJDK_TARGET_CPU_BITS" = x64; then
    6.27 -        x_libraries="$SYS_ROOT/usr/lib64"
    6.28 -      elif test -f "$SYS_ROOT/usr/lib/libX11.so"; then
    6.29 -        x_libraries="$SYS_ROOT/usr/lib"
    6.30 +      if test "x$x_libraries" = xNONE; then
    6.31 +        if test -f "$SYSROOT/usr/X11R6/lib/libX11.so"; then
    6.32 +          x_libraries="$SYSROOT/usr/X11R6/lib"
    6.33 +        elif test "$SYSROOT/usr/lib64/libX11.so" && test "x$OPENJDK_TARGET_CPU_BITS" = x64; then
    6.34 +          x_libraries="$SYSROOT/usr/lib64"
    6.35 +        elif test -f "$SYSROOT/usr/lib/libX11.so"; then
    6.36 +          x_libraries="$SYSROOT/usr/lib"
    6.37 +        fi
    6.38        fi
    6.39      fi
    6.40    fi
    6.41 @@ -131,11 +133,15 @@
    6.42      AC_MSG_ERROR([Could not find X11 libraries. $HELP_MSG])
    6.43    fi
    6.44  
    6.45 +
    6.46    if test "x$OPENJDK_TARGET_OS" = xsolaris; then
    6.47      OPENWIN_HOME="/usr/openwin"
    6.48 +    X_CFLAGS="-I$SYSROOT$OPENWIN_HOME/include -I$SYSROOT$OPENWIN_HOME/include/X11/extensions"
    6.49 +    X_LIBS="-L$SYSROOT$OPENWIN_HOME/sfw/lib$OPENJDK_TARGET_CPU_ISADIR \
    6.50 +        -L$SYSROOT$OPENWIN_HOME/lib$OPENJDK_TARGET_CPU_ISADIR \
    6.51 +        -R$OPENWIN_HOME/sfw/lib$OPENJDK_TARGET_CPU_ISADIR \
    6.52 +        -R$OPENWIN_HOME/lib$OPENJDK_TARGET_CPU_ISADIR"
    6.53    fi
    6.54 -  AC_SUBST(OPENWIN_HOME)
    6.55 -
    6.56  
    6.57    #
    6.58    # Weird Sol10 something check...TODO change to try compile
    6.59 @@ -224,14 +230,14 @@
    6.60        # Getting nervous now? Lets poke around for standard Solaris third-party
    6.61        # package installation locations.
    6.62        AC_MSG_CHECKING([for cups headers])
    6.63 -      if test -s /opt/sfw/cups/include/cups/cups.h; then
    6.64 +      if test -s $SYSROOT/opt/sfw/cups/include/cups/cups.h; then
    6.65          # An SFW package seems to be installed!
    6.66          CUPS_FOUND=yes
    6.67 -        CUPS_CFLAGS="-I/opt/sfw/cups/include"
    6.68 -      elif test -s /opt/csw/include/cups/cups.h; then
    6.69 +        CUPS_CFLAGS="-I$SYSROOT/opt/sfw/cups/include"
    6.70 +      elif test -s $SYSROOT/opt/csw/include/cups/cups.h; then
    6.71          # A CSW package seems to be installed!
    6.72          CUPS_FOUND=yes
    6.73 -        CUPS_CFLAGS="-I/opt/csw/include"
    6.74 +        CUPS_CFLAGS="-I$SYSROOT/opt/csw/include"
    6.75        fi
    6.76        AC_MSG_RESULT([$CUPS_FOUND])
    6.77      fi
    6.78 @@ -385,24 +391,27 @@
    6.79          fi
    6.80        fi
    6.81  
    6.82 -      if test "x$FOUND_FREETYPE" != xyes; then
    6.83 -        # Check modules using pkg-config, but only if we have it (ugly output results otherwise)
    6.84 -        if test "x$PKG_CONFIG" != x; then
    6.85 -          PKG_CHECK_MODULES(FREETYPE, freetype2, [FOUND_FREETYPE=yes], [FOUND_FREETYPE=no])
    6.86 -          if test "x$FOUND_FREETYPE" = xyes; then
    6.87 -            # On solaris, pkg_check adds -lz to freetype libs, which isn't necessary for us.
    6.88 -            FREETYPE_LIBS=`$ECHO $FREETYPE_LIBS | $SED 's/-lz//g'`
    6.89 -            # 64-bit libs for Solaris x86 are installed in the amd64 subdirectory, change lib to lib/amd64
    6.90 -            if test "x$OPENJDK_TARGET_OS" = xsolaris && test "x$OPENJDK_TARGET_CPU" = xx86_64; then
    6.91 -              FREETYPE_LIBS=`$ECHO $FREETYPE_LIBS | $SED 's?/lib?/lib/amd64?g'`
    6.92 -            fi
    6.93 -            # BDEPS_CHECK_MODULE will set FREETYPE_CFLAGS and _LIBS, but we don't get a lib path for bundling.
    6.94 -            if test "x$BUNDLE_FREETYPE" = xyes; then
    6.95 -              AC_MSG_NOTICE([Found freetype using pkg-config, but ignoring since we can not bundle that])
    6.96 -              FOUND_FREETYPE=no
    6.97 -            else
    6.98 -              AC_MSG_CHECKING([for freetype])
    6.99 -              AC_MSG_RESULT([yes (using pkg-config)])
   6.100 +      # If we have a sysroot, assume that's where we are supposed to look and skip pkg-config.
   6.101 +      if test "x$SYSROOT" = x; then
   6.102 +        if test "x$FOUND_FREETYPE" != xyes; then
   6.103 +          # Check modules using pkg-config, but only if we have it (ugly output results otherwise)
   6.104 +          if test "x$PKG_CONFIG" != x; then
   6.105 +            PKG_CHECK_MODULES(FREETYPE, freetype2, [FOUND_FREETYPE=yes], [FOUND_FREETYPE=no])
   6.106 +            if test "x$FOUND_FREETYPE" = xyes; then
   6.107 +              # On solaris, pkg_check adds -lz to freetype libs, which isn't necessary for us.
   6.108 +              FREETYPE_LIBS=`$ECHO $FREETYPE_LIBS | $SED 's/-lz//g'`
   6.109 +              # 64-bit libs for Solaris x86 are installed in the amd64 subdirectory, change lib to lib/amd64
   6.110 +              if test "x$OPENJDK_TARGET_OS" = xsolaris && test "x$OPENJDK_TARGET_CPU" = xx86_64; then
   6.111 +                FREETYPE_LIBS=`$ECHO $FREETYPE_LIBS | $SED 's?/lib?/lib/amd64?g'`
   6.112 +              fi
   6.113 +              # BDEPS_CHECK_MODULE will set FREETYPE_CFLAGS and _LIBS, but we don't get a lib path for bundling.
   6.114 +              if test "x$BUNDLE_FREETYPE" = xyes; then
   6.115 +                AC_MSG_NOTICE([Found freetype using pkg-config, but ignoring since we can not bundle that])
   6.116 +                FOUND_FREETYPE=no
   6.117 +              else
   6.118 +                AC_MSG_CHECKING([for freetype])
   6.119 +                AC_MSG_RESULT([yes (using pkg-config)])
   6.120 +              fi
   6.121              fi
   6.122            fi
   6.123          fi
   6.124 @@ -420,21 +429,21 @@
   6.125              LIB_CHECK_POTENTIAL_FREETYPE([$FREETYPE_BASE_DIR/include], [$FREETYPE_BASE_DIR/lib], [well-known location])
   6.126            fi
   6.127          else
   6.128 -          if test "x$SYS_ROOT" = "x/"; then
   6.129 -            FREETYPE_ROOT=
   6.130 -          else
   6.131 -            FREETYPE_ROOT="$SYS_ROOT"
   6.132 -          fi
   6.133 -          FREETYPE_BASE_DIR="$FREETYPE_ROOT/usr"
   6.134 +          FREETYPE_BASE_DIR="$SYSROOT/usr"
   6.135            LIB_CHECK_POTENTIAL_FREETYPE([$FREETYPE_BASE_DIR/include], [$FREETYPE_BASE_DIR/lib], [well-known location])
   6.136  
   6.137            if test "x$FOUND_FREETYPE" != xyes; then
   6.138 -            FREETYPE_BASE_DIR="$FREETYPE_ROOT/usr/X11"
   6.139 +            FREETYPE_BASE_DIR="$SYSROOT/usr/X11"
   6.140              LIB_CHECK_POTENTIAL_FREETYPE([$FREETYPE_BASE_DIR/include], [$FREETYPE_BASE_DIR/lib], [well-known location])
   6.141            fi
   6.142  
   6.143            if test "x$FOUND_FREETYPE" != xyes; then
   6.144 -            FREETYPE_BASE_DIR="$FREETYPE_ROOT/usr"
   6.145 +            FREETYPE_BASE_DIR="$SYSROOT/usr/sfw"
   6.146 +            LIB_CHECK_POTENTIAL_FREETYPE([$FREETYPE_BASE_DIR/include], [$FREETYPE_BASE_DIR/lib], [well-known location])
   6.147 +          fi
   6.148 +
   6.149 +          if test "x$FOUND_FREETYPE" != xyes; then
   6.150 +            FREETYPE_BASE_DIR="$SYSROOT/usr"
   6.151              if test "x$OPENJDK_TARGET_CPU_BITS" = x64; then
   6.152                LIB_CHECK_POTENTIAL_FREETYPE([$FREETYPE_BASE_DIR/include], [$FREETYPE_BASE_DIR/lib/x86_64-linux-gnu], [well-known location])
   6.153              else
   6.154 @@ -564,8 +573,11 @@
   6.155      if test "x$ALSA_FOUND" = xno; then
   6.156        BDEPS_CHECK_MODULE(ALSA, alsa, xxx, [ALSA_FOUND=yes], [ALSA_FOUND=no])
   6.157      fi
   6.158 -    if test "x$ALSA_FOUND" = xno; then
   6.159 -      PKG_CHECK_MODULES(ALSA, alsa, [ALSA_FOUND=yes], [ALSA_FOUND=no])
   6.160 +    # Do not try pkg-config if we have a sysroot set.
   6.161 +    if test "x$SYSROOT" = x; then
   6.162 +      if test "x$ALSA_FOUND" = xno; then
   6.163 +        PKG_CHECK_MODULES(ALSA, alsa, [ALSA_FOUND=yes], [ALSA_FOUND=no])
   6.164 +      fi
   6.165      fi
   6.166      if test "x$ALSA_FOUND" = xno; then
   6.167        AC_CHECK_HEADERS([alsa/asoundlib.h],
   6.168 @@ -864,7 +876,7 @@
   6.169  
   6.170    # libCrun is the c++ runtime-library with SunStudio (roughly the equivalent of gcc's libstdc++.so)
   6.171    if test "x$TOOLCHAIN_TYPE" = xsolstudio && test "x$LIBCXX" = x; then
   6.172 -    LIBCXX="/usr/lib${OPENJDK_TARGET_CPU_ISADIR}/libCrun.so.1"
   6.173 +    LIBCXX="${SYSROOT}/usr/lib${OPENJDK_TARGET_CPU_ISADIR}/libCrun.so.1"
   6.174    fi
   6.175  
   6.176    # TODO better (platform agnostic) test
     7.1 --- a/common/autoconf/spec.gmk.in	Thu Apr 12 02:54:38 2018 -0700
     7.2 +++ b/common/autoconf/spec.gmk.in	Mon Apr 16 00:48:00 2018 -0700
     7.3 @@ -128,10 +128,8 @@
     7.4    export LIB:=@VS_LIB@
     7.5  endif
     7.6  
     7.7 -# The sys root where standard headers and libraries are found.
     7.8 -# Usually not needed since the configure script should have
     7.9 -# taken it into account already when setting CFLAGS et al.
    7.10 -SYS_ROOT:=@SYS_ROOT@
    7.11 +SYSROOT_CFLAGS := @SYSROOT_CFLAGS@
    7.12 +SYSROOT_LDFLAGS := @SYSROOT_LDFLAGS@
    7.13  
    7.14  # Paths to the source code
    7.15  ADD_SRC_ROOT:=@ADD_SRC_ROOT@
    7.16 @@ -293,7 +291,6 @@
    7.17  # Necessary additional compiler flags to compile X11
    7.18  X_CFLAGS:=@X_CFLAGS@
    7.19  X_LIBS:=@X_LIBS@
    7.20 -OPENWIN_HOME:=@OPENWIN_HOME@
    7.21  
    7.22  # The lowest required version of macosx to enforce compatiblity for
    7.23  MACOSX_VERSION_MIN=@MACOSX_VERSION_MIN@
     8.1 --- a/common/autoconf/toolchain.m4	Thu Apr 12 02:54:38 2018 -0700
     8.2 +++ b/common/autoconf/toolchain.m4	Mon Apr 16 00:48:00 2018 -0700
     8.3 @@ -323,29 +323,11 @@
     8.4      PATH="/usr/ccs/bin:$PATH"
     8.5    fi
     8.6  
     8.7 -  # Finally add TOOLS_DIR at the beginning, to allow --with-tools-dir to 
     8.8 +  # Finally add TOOLCHAIN_PATH at the beginning, to allow --with-tools-dir to 
     8.9    # override all other locations.
    8.10 -  if test "x$TOOLS_DIR" != x; then
    8.11 -    PATH=$TOOLS_DIR:$PATH
    8.12 +  if test "x$TOOLCHAIN_PATH" != x; then
    8.13 +    PATH=$TOOLCHAIN_PATH:$PATH
    8.14    fi
    8.15 -
    8.16 -  # If a devkit is found on the builddeps server, then prepend its path to the
    8.17 -  # PATH variable. If there are cross compilers available in the devkit, these
    8.18 -  # will be found by AC_PROG_CC et al.
    8.19 -  DEVKIT=
    8.20 -  BDEPS_CHECK_MODULE(DEVKIT, devkit, xxx,
    8.21 -      [
    8.22 -        # Found devkit
    8.23 -        PATH="$DEVKIT/bin:$PATH"
    8.24 -        SYS_ROOT="$DEVKIT/${rewritten_target}/sys-root"
    8.25 -        if test "x$x_includes" = "xNONE"; then
    8.26 -          x_includes="$SYS_ROOT/usr/include/X11"
    8.27 -        fi
    8.28 -        if test "x$x_libraries" = "xNONE"; then
    8.29 -          x_libraries="$SYS_ROOT/usr/lib"
    8.30 -        fi
    8.31 -      ],
    8.32 -      [])
    8.33  ])
    8.34  
    8.35  # Restore path, etc
    8.36 @@ -519,15 +501,15 @@
    8.37      # used.
    8.38  
    8.39      $1=
    8.40 -    # If TOOLS_DIR is set, check for all compiler names in there first
    8.41 +    # If TOOLCHAIN_PATH is set, check for all compiler names in there first
    8.42      # before checking the rest of the PATH.
    8.43      # FIXME: Now that we prefix the TOOLS_DIR to the PATH in the PRE_DETECTION
    8.44      # step, this should not be necessary.
    8.45 -    if test -n "$TOOLS_DIR"; then
    8.46 +    if test -n "$TOOLCHAIN_PATH"; then
    8.47        PATH_save="$PATH"
    8.48 -      PATH="$TOOLS_DIR"
    8.49 -      AC_PATH_PROGS(TOOLS_DIR_$1, $3)
    8.50 -      $1=$TOOLS_DIR_$1
    8.51 +      PATH="$TOOLCHAIN_PATH"
    8.52 +      AC_PATH_PROGS(TOOLCHAIN_PATH_$1, $SEARCH_LIST)
    8.53 +      $1=$TOOLCHAIN_PATH_$1
    8.54        PATH="$PATH_save"
    8.55      fi
    8.56  
     9.1 --- a/common/bin/compare.sh	Thu Apr 12 02:54:38 2018 -0700
     9.2 +++ b/common/bin/compare.sh	Mon Apr 16 00:48:00 2018 -0700
     9.3 @@ -114,7 +114,7 @@
     9.4      fi
     9.5      if test "x$SUFFIX" = "xproperties"; then
     9.6          # Run through nawk to add possibly missing newline at end of file.
     9.7 -        $CAT $OTHER_FILE | $NAWK '{ print }' > $OTHER_FILE.cleaned
     9.8 +        $CAT $OTHER_FILE | $NAWK '{ print }' | LC_ALL=C $SORT > $OTHER_FILE.cleaned
     9.9  # Disable this exception since we aren't changing the properties cleaning method yet.
    9.10  #        $CAT $OTHER_FILE | $SED -e 's/\([^\\]\):/\1\\:/g' -e  's/\([^\\]\)=/\1\\=/g' -e 's/#.*/#/g' \
    9.11  #            | $SED -f "$SRC_ROOT/common/makefiles/support/unicode2x.sed" \
    10.1 --- a/make/common/NativeCompilation.gmk	Thu Apr 12 02:54:38 2018 -0700
    10.2 +++ b/make/common/NativeCompilation.gmk	Mon Apr 16 00:48:00 2018 -0700
    10.3 @@ -372,6 +372,10 @@
    10.4      $$(error Unknown value for OPTIMIZATION: $$($1_OPTIMIZATION))
    10.5    endif
    10.6  
    10.7 +  # Add sys root specific cflags last
    10.8 +  $1_EXTRA_CFLAGS += $(SYSROOT_CFLAGS)
    10.9 +  $1_EXTRA_CXXFLAGS += $(SYSROOT_CFLAGS)
   10.10 +
   10.11    # Now call add_native_source for each source file we are going to compile.
   10.12    $$(foreach p,$$($1_SRCS), \
   10.13        $$(eval $$(call add_native_source,$1,$$p,$$($1_OBJECT_DIR), \
   10.14 @@ -417,6 +421,8 @@
   10.15      $1_EXTRA_LDFLAGS += $(call SET_SHARED_LIBRARY_MAPFILE,$$($1_REAL_MAPFILE))
   10.16    endif
   10.17  
   10.18 +  $1_EXTRA_LDFLAGS += $(SYSROOT_LDFLAGS)
   10.19 +
   10.20    $1 := $$($1_TARGET)
   10.21    ifneq (,$$($1_LIBRARY))
   10.22      # Generating a dynamic library.
    11.1 --- a/make/devkit/Makefile	Thu Apr 12 02:54:38 2018 -0700
    11.2 +++ b/make/devkit/Makefile	Mon Apr 16 00:48:00 2018 -0700
    11.3 @@ -75,7 +75,7 @@
    11.4    $(foreach p,$(filter-out $(me),$(platforms)),$(eval $(p) : $$(me)))
    11.5  endif
    11.6  
    11.7 -OUTPUT_ROOT = $(abspath ../../../build/devkit)
    11.8 +OUTPUT_ROOT = $(abspath ../../build/devkit)
    11.9  RESULT = $(OUTPUT_ROOT)/result
   11.10  
   11.11  submakevars = HOST=$@ BUILD=$(me) \
    12.1 --- a/make/devkit/Tools.gmk	Thu Apr 12 02:54:38 2018 -0700
    12.2 +++ b/make/devkit/Tools.gmk	Mon Apr 16 00:48:00 2018 -0700
    12.3 @@ -49,8 +49,8 @@
    12.4  # Define external dependencies
    12.5  
    12.6  # Latest that could be made to work.
    12.7 -gcc_ver := gcc-4.7.3
    12.8 -binutils_ver := binutils-2.22
    12.9 +gcc_ver := gcc-4.8.2
   12.10 +binutils_ver := binutils-2.24
   12.11  ccache_ver := ccache-3.1.9
   12.12  mpfr_ver := mpfr-3.0.1
   12.13  gmp_ver := gmp-4.3.2
   12.14 @@ -64,6 +64,7 @@
   12.15  MPC := http://www.multiprecision.org/mpc/download/${mpc_ver}.tar.gz
   12.16  
   12.17  # RPMs in OEL5.5
   12.18 +LINUX_VERSION := OEL5.5
   12.19  RPM_LIST := \
   12.20      kernel-headers \
   12.21      glibc-2 glibc-headers glibc-devel \
   12.22 @@ -121,7 +122,7 @@
   12.23  BUILDDIR := $(OUTPUT_ROOT)/$(HOST)/$(TARGET)
   12.24  PREFIX := $(RESULT)/$(HOST)
   12.25  TARGETDIR := $(PREFIX)/$(TARGET)
   12.26 -SYSROOT := $(TARGETDIR)/sys-root
   12.27 +SYSROOT := $(TARGETDIR)/sysroot
   12.28  DOWNLOAD := $(OUTPUT_ROOT)/download
   12.29  SRCDIR := $(OUTPUT_ROOT)/src
   12.30  
   12.31 @@ -184,7 +185,7 @@
   12.32  
   12.33  ##########################################################################################
   12.34  
   12.35 -# Note: MUST create a <sys-root>/usr/lib even if not really needed.
   12.36 +# Note: MUST create a <sysroot>/usr/lib even if not really needed.
   12.37  # gcc will use a path relative to it to resolve lib64. (x86_64).
   12.38  # we're creating multi-lib compiler with 32bit libc as well, so we should
   12.39  # have it anyway, but just to make sure...
   12.40 @@ -459,15 +460,31 @@
   12.41  
   12.42  ##########################################################################################
   12.43  
   12.44 +$(PREFIX)/devkit.info: FRC
   12.45 +	@echo 'Creating devkit.info in the root of the kit'
   12.46 +	rm -f $@
   12.47 +	touch $@
   12.48 +	echo '# This file describes to configure how to interpret the contents of this' >> $@
   12.49 +	echo '# devkit' >> $@
   12.50 +	echo '' >> $@
   12.51 +	echo 'DEVKIT_NAME="$(gcc_ver) - $(LINUX_VERSION)"' >> $@
   12.52 +	echo 'DEVKIT_TOOLCHAIN_PATH="$$DEVKIT_ROOT/bin"' >> $@
   12.53 +	echo 'DEVKIT_SYSROOT="$$DEVKIT_ROOT/$$host/sysroot"' >> $@
   12.54 +
   12.55 +##########################################################################################
   12.56 +
   12.57  bfdlib : $(bfdlib)
   12.58  binutils : $(binutils)
   12.59  rpms : $(rpms)
   12.60  libs : $(libs)
   12.61  sysroot : rpms libs
   12.62  gcc : sysroot $(gcc) $(gccpatch)
   12.63 -all : binutils gcc bfdlib
   12.64 +all : binutils gcc bfdlib $(PREFIX)/devkit.info
   12.65  
   12.66  # this is only built for host. so separate.
   12.67  ccache : $(ccache)
   12.68  
   12.69 +# Force target
   12.70 +FRC:
   12.71 +
   12.72  .PHONY : gcc all binutils bfdlib link_libs rpms libs sysroot

mercurial