changeset 60507:64490f533d62

8250876: Fix issues with cross-compile on macos Reviewed-by: erikj, ihse
author vkempik
date Mon, 10 Aug 2020 22:42:09 +0300
parents 46d275822d8c
children de681c97bceb
files make/autoconf/flags.m4 make/autoconf/toolchain.m4
diffstat 2 files changed, 13 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/make/autoconf/flags.m4	Tue Aug 04 17:19:21 2020 -0300
+++ b/make/autoconf/flags.m4	Mon Aug 10 22:42:09 2020 +0300
@@ -218,10 +218,12 @@
     # We also need -iframework<path>/System/Library/Frameworks
     $1SYSROOT_CFLAGS="[$]$1SYSROOT_CFLAGS -iframework [$]$1SYSROOT/System/Library/Frameworks"
     $1SYSROOT_LDFLAGS="[$]$1SYSROOT_LDFLAGS -iframework [$]$1SYSROOT/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
-    $1SYSROOT_CFLAGS="[$]$1SYSROOT_CFLAGS -F [$]$1SYSROOT/System/Library/Frameworks/JavaVM.framework/Frameworks"
-    $1SYSROOT_LDFLAGS="[$]$1SYSROOT_LDFLAGS -F [$]$1SYSROOT/System/Library/Frameworks/JavaVM.framework/Frameworks"
+    if test -d "[$]$1SYSROOT/System/Library/Frameworks/JavaVM.framework/Frameworks" ; then
+      # These always need to be set on macOS 10.X, 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
+      $1SYSROOT_CFLAGS="[$]$1SYSROOT_CFLAGS -F [$]$1SYSROOT/System/Library/Frameworks/JavaVM.framework/Frameworks"
+      $1SYSROOT_LDFLAGS="[$]$1SYSROOT_LDFLAGS -F [$]$1SYSROOT/System/Library/Frameworks/JavaVM.framework/Frameworks"
+    fi
   fi
 
   AC_SUBST($1SYSROOT_CFLAGS)
--- a/make/autoconf/toolchain.m4	Tue Aug 04 17:19:21 2020 -0300
+++ b/make/autoconf/toolchain.m4	Mon Aug 10 22:42:09 2020 +0300
@@ -902,9 +902,14 @@
     # FIXME: we should list the discovered compilers as an exclude pattern!
     # If we do that, we can do this detection before POST_DETECTION, and still
     # find the build compilers in the tools dir, if needed.
-    UTIL_REQUIRE_PROGS(BUILD_CC, [cl cc gcc])
+    if test "x$OPENJDK_BUILD_OS" = xmacosx; then
+      UTIL_REQUIRE_PROGS(BUILD_CC, [clang cl cc gcc])
+      UTIL_REQUIRE_PROGS(BUILD_CXX, [clang++ cl CC g++])
+    else
+      UTIL_REQUIRE_PROGS(BUILD_CC, [cl cc gcc])
+      UTIL_REQUIRE_PROGS(BUILD_CXX, [cl CC g++])
+    fi
     UTIL_FIXUP_EXECUTABLE(BUILD_CC)
-    UTIL_REQUIRE_PROGS(BUILD_CXX, [cl CC g++])
     UTIL_FIXUP_EXECUTABLE(BUILD_CXX)
     UTIL_PATH_PROGS(BUILD_NM, nm gcc-nm)
     UTIL_FIXUP_EXECUTABLE(BUILD_NM)