diff --git a/make/autoconf/flags-cflags.m4 b/make/autoconf/flags-cflags.m4 index 6d6e75bca16..b13b210165f 100644 --- a/make/autoconf/flags-cflags.m4 +++ b/make/autoconf/flags-cflags.m4 @@ -843,6 +843,17 @@ AC_DEFUN([FLAGS_SETUP_CFLAGS_CPU_DEP], FILE_MACRO_CFLAGS= ] ) + if test "x$FILE_MACRO_CFLAGS" != x; then + # Add -pathmap for all VS system include paths using Windows + # full Long path name that is generated by the compiler + for ipath in ${$3SYSROOT_CFLAGS}; do + if test "x${ipath:0:2}" == "x-I"; then + ipath_path=${ipath#"-I"} + UTIL_FIXUP_WIN_LONG_PATH(ipath_path) + FILE_MACRO_CFLAGS="$FILE_MACRO_CFLAGS -pathmap:\"$ipath_path\"=vsi" + fi + done + fi fi AC_MSG_CHECKING([how to prevent absolute paths in output]) diff --git a/make/autoconf/util_paths.m4 b/make/autoconf/util_paths.m4 index 3dd6ea7b489..902eb6707e1 100644 --- a/make/autoconf/util_paths.m4 +++ b/make/autoconf/util_paths.m4 @@ -118,6 +118,23 @@ AC_DEFUN([UTIL_FIXUP_PATH], fi ]) +############################################################################## +# Fixup path to be a Windows full long path +AC_DEFUN([UTIL_FIXUP_WIN_LONG_PATH], +[ + # Only process if variable expands to non-empty + path="[$]$1" + if test "x$path" != x; then + if test "x$OPENJDK_BUILD_OS" = "xwindows"; then + win_path=$($PATHTOOL -wl "$path") + if test "x$win_path" != "x$path"; then + $1="$win_path" + fi + fi + fi +]) + + ############################################################################### # Check if the given file is a unix-style or windows-style executable, that is, # if it expects paths in unix-style or windows-style.