--- old/common/autoconf/basics.m4 2016-09-13 07:53:23.702937067 -0400 +++ new/common/autoconf/basics.m4 2016-09-13 07:53:23.238910735 -0400 @@ -662,6 +662,11 @@ [SYSROOT=$with_sysroot] ) + AC_ARG_WITH(build_sysroot, [AS_HELP_STRING([--with-build-sysroot], + [use this directory as build_sysroot])], + [BUILD_SYSROOT=$with_build_sysroot] + ) + AC_ARG_WITH([tools-dir], [AS_HELP_STRING([--with-tools-dir], [alias for --with-toolchain-path for backwards compatibility])], [BASIC_PREPEND_TO_PATH([TOOLCHAIN_PATH],$with_tools_dir)] --- old/common/autoconf/generated-configure.sh 2016-09-13 07:53:25.231023761 -0400 +++ new/common/autoconf/generated-configure.sh 2016-09-13 07:53:24.702993803 -0400 @@ -1152,6 +1152,7 @@ with_devkit with_sys_root with_sysroot +with_build_sysroot with_tools_dir with_toolchain_path with_extra_path @@ -2049,6 +2050,7 @@ --with-devkit use this devkit for compilers, tools and resources --with-sys-root alias for --with-sysroot for backwards compatability --with-sysroot use this directory as sysroot + --with-build-sysroot use this directory as build_sysroot --with-tools-dir alias for --with-toolchain-path for backwards compatibility --with-toolchain-path prepend these directories when searching for @@ -5108,7 +5110,7 @@ #CUSTOM_AUTOCONF_INCLUDE # Do not change or remove the following line, it is needed for consistency checks: -DATE_WHEN_GENERATED=1471531493 +DATE_WHEN_GENERATED=1473766817 ############################################################################### # @@ -17083,6 +17085,14 @@ +# Check whether --with-build_sysroot was given. +if test "${with_build_sysroot+set}" = set; then : + withval=$with_build_sysroot; BUILD_SYSROOT=$with_build_sysroot + +fi + + + # Check whether --with-tools-dir was given. if test "${with_tools_dir+set}" = set; then : withval=$with_tools_dir; @@ -47310,8 +47320,55 @@ BUILD_AS="$AS" BUILD_OBJCOPY="$OBJCOPY" BUILD_STRIP="$STRIP" - BUILD_SYSROOT_CFLAGS="$SYSROOT_CFLAGS" - BUILD_SYSROOT_LDFLAGS="$SYSROOT_LDFLAGS" + if test "x$BUILD_SYSROOT" != "x"; then + + if test "x$BUILD_SYSROOT" != "x"; then + if test "x$TOOLCHAIN_TYPE" = xsolstudio; then + if test "x$OPENJDK_TARGET_OS" = xsolaris; then + # Solaris Studio does not have a concept of sysroot. Instead we must + # make sure the default include and lib dirs are appended to each + # compile and link command line. Must also add -I-xbuiltin to enable + # inlining of system functions and intrinsics. + BUILD_SYSROOT_CFLAGS="-I-xbuiltin -I$BUILD_SYSROOT/usr/include" + BUILD_SYSROOT_LDFLAGS="-L$BUILD_SYSROOT/usr/lib$OPENJDK_TARGET_CPU_ISADIR \ + -L$BUILD_SYSROOT/lib$OPENJDK_TARGET_CPU_ISADIR \ + -L$BUILD_SYSROOT/usr/ccs/lib$OPENJDK_TARGET_CPU_ISADIR" + fi + elif test "x$TOOLCHAIN_TYPE" = xgcc; then + BUILD_SYSROOT_CFLAGS="--sysroot=$BUILD_SYSROOT" + BUILD_SYSROOT_LDFLAGS="--sysroot=$BUILD_SYSROOT" + elif test "x$TOOLCHAIN_TYPE" = xclang; then + BUILD_SYSROOT_CFLAGS="-isysroot $BUILD_SYSROOT" + BUILD_SYSROOT_LDFLAGS="-isysroot $BUILD_SYSROOT" + fi + # Propagate the sysroot args to hotspot + BUILD_LEGACY_EXTRA_CFLAGS="$BUILD_LEGACY_EXTRA_CFLAGS $BUILD_SYSROOT_CFLAGS" + BUILD_LEGACY_EXTRA_CXXFLAGS="$BUILD_LEGACY_EXTRA_CXXFLAGS $BUILD_SYSROOT_CFLAGS" + BUILD_LEGACY_EXTRA_LDFLAGS="$BUILD_LEGACY_EXTRA_LDFLAGS $BUILD_SYSROOT_LDFLAGS" + # The global CFLAGS and LDFLAGS variables need these for configure to function + BUILD_CFLAGS="$BUILD_CFLAGS $BUILD_SYSROOT_CFLAGS" + BUILD_CPPFLAGS="$BUILD_CPPFLAGS $BUILD_EXTRA_CFLAGS $BUILD_SYSROOT_CFLAGS" + BUILD_CXXFLAGS="$BUILD_CXXFLAGS $BUILD_SYSROOT_CFLAGS" + BUILD_LDFLAGS="$BUILD_LDFLAGS $BUILD_SYSROOT_LDFLAGS" + fi + + if test "x$OPENJDK_BUILD_OS" = xmacosx; then + # We also need -iframework/System/Library/Frameworks + BUILD_SYSROOT_CFLAGS="$BUILD_SYSROOT_CFLAGS -iframework $BUILD_SYSROOT/System/Library/Frameworks" + BUILD_SYSROOT_LDFLAGS="$BUILD_SYSROOT_LDFLAGS -iframework $BUILD_SYSROOT/System/Library/Frameworks" + # These always need to be set, or we can't find the frameworks embedded in JavaVM.framework + # set this here so it doesn't have to be peppered throughout the forest + BUILD_SYSROOT_CFLAGS="$BUILD_SYSROOT_CFLAGS -F $BUILD_SYSROOT/System/Library/Frameworks/JavaVM.framework/Frameworks" + BUILD_SYSROOT_LDFLAGS="$BUILD_SYSROOT_LDFLAGS -F $BUILD_SYSROOT/System/Library/Frameworks/JavaVM.framework/Frameworks" + fi + + + + + else + BUILD_SYSROOT_CFLAGS="$SYSROOT_CFLAGS" + BUILD_SYSROOT_LDFLAGS="$SYSROOT_LDFLAGS" + fi BUILD_AR="$AR" --- old/common/autoconf/toolchain.m4 2016-09-13 07:53:27.479151314 -0400 +++ new/common/autoconf/toolchain.m4 2016-09-13 07:53:27.031125894 -0400 @@ -841,8 +841,12 @@ BUILD_AS="$AS" BUILD_OBJCOPY="$OBJCOPY" BUILD_STRIP="$STRIP" - BUILD_SYSROOT_CFLAGS="$SYSROOT_CFLAGS" - BUILD_SYSROOT_LDFLAGS="$SYSROOT_LDFLAGS" + if test "x$BUILD_SYSROOT" != "x"; then + FLAGS_SETUP_SYSROOT_FLAGS([BUILD_]) + else + BUILD_SYSROOT_CFLAGS="$SYSROOT_CFLAGS" + BUILD_SYSROOT_LDFLAGS="$SYSROOT_LDFLAGS" + fi BUILD_AR="$AR" TOOLCHAIN_PREPARE_FOR_VERSION_COMPARISONS([], [OPENJDK_BUILD_])