make/autoconf/basics_windows.m4
author dlong
Thu, 31 Oct 2019 16:54:16 -0700
changeset 58877 aec7bf35d6f5
parent 58270 2921ee5e9881
permissions -rw-r--r--
8233273: Update Graal Reviewed-by: kvn
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
14111
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
     1
#
41458
f285e333e8db 8167424: Various trivial fixes in build system
ihse
parents: 38843
diff changeset
     2
# Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved.
14111
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
     3
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
     4
#
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
     5
# This code is free software; you can redistribute it and/or modify it
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
     6
# under the terms of the GNU General Public License version 2 only, as
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
     7
# published by the Free Software Foundation.  Oracle designates this
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
     8
# particular file as subject to the "Classpath" exception as provided
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
     9
# by Oracle in the LICENSE file that accompanied this code.
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    10
#
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    11
# This code is distributed in the hope that it will be useful, but WITHOUT
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    12
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    13
# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    14
# version 2 for more details (a copy is included in the LICENSE file that
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    15
# accompanied this code).
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    16
#
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    17
# You should have received a copy of the GNU General Public License version
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    18
# 2 along with this work; if not, write to the Free Software Foundation,
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    19
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    20
#
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    21
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    22
# or visit www.oracle.com if you need additional information or have any
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    23
# questions.
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    24
#
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    25
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    26
AC_DEFUN([BASIC_WINDOWS_REWRITE_AS_UNIX_PATH],
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    27
[
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    28
  windows_path="[$]$1"
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    29
  if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    30
    unix_path=`$CYGPATH -u "$windows_path"`
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    31
    $1="$unix_path"
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    32
  elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    33
    unix_path=`$ECHO "$windows_path" | $SED -e 's,^\\(.\\):,/\\1,g' -e 's,\\\\,/,g'`
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    34
    $1="$unix_path"
53110
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 47252
diff changeset
    35
  elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.wsl"; then
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 47252
diff changeset
    36
    # wslpath does not check the input, only call if an actual windows path was
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 47252
diff changeset
    37
    # given.
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 47252
diff changeset
    38
    if $ECHO "$windows_path" | $GREP -q ["^[a-zA-Z]:[\\\\/]"]; then
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 47252
diff changeset
    39
      unix_path=`$WSLPATH -u "$windows_path"`
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 47252
diff changeset
    40
      $1="$unix_path"
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 47252
diff changeset
    41
    fi
14111
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    42
  fi
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    43
])
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    44
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    45
AC_DEFUN([BASIC_WINDOWS_REWRITE_AS_WINDOWS_MIXED_PATH],
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    46
[
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    47
  unix_path="[$]$1"
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    48
  if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    49
    windows_path=`$CYGPATH -m "$unix_path"`
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    50
    $1="$windows_path"
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    51
  elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    52
    windows_path=`cmd //c echo $unix_path`
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    53
    $1="$windows_path"
53110
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 47252
diff changeset
    54
  elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.wsl"; then
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 47252
diff changeset
    55
    windows_path=`$WSLPATH -m "$unix_path"`
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 47252
diff changeset
    56
    $1="$windows_path"
14111
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    57
  fi
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    58
])
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    59
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    60
# Helper function which possibly converts a path using DOS-style short mode.
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    61
# If so, the updated path is stored in $new_path.
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    62
# $1: The path to check
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    63
AC_DEFUN([BASIC_MAKE_WINDOWS_SPACE_SAFE_CYGWIN],
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    64
[
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    65
  input_path="$1"
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    66
  # Check if we need to convert this using DOS-style short mode. If the path
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    67
  # contains just simple characters, use it. Otherwise (spaces, weird characters),
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    68
  # take no chances and rewrite it.
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    69
  # Note: m4 eats our [], so we need to use @<:@ and @:>@ instead.
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    70
  has_forbidden_chars=`$ECHO "$input_path" | $GREP @<:@^-._/a-zA-Z0-9@:>@`
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    71
  if test "x$has_forbidden_chars" != x; then
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    72
    # Now convert it to mixed DOS-style, short mode (no spaces, and / instead of \)
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    73
    shortmode_path=`$CYGPATH -s -m -a "$input_path"`
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    74
    path_after_shortmode=`$CYGPATH -u "$shortmode_path"`
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    75
    if test "x$path_after_shortmode" != "x$input_to_shortpath"; then
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    76
      # Going to short mode and back again did indeed matter. Since short mode is
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    77
      # case insensitive, let's make it lowercase to improve readability.
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    78
      shortmode_path=`$ECHO "$shortmode_path" | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
30022
362d77fbf008 8078437: Enable use of devkits for Windows
erikj
parents: 29790
diff changeset
    79
      # Now convert it back to Unix-style (cygpath)
14111
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    80
      input_path=`$CYGPATH -u "$shortmode_path"`
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    81
      new_path="$input_path"
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    82
    fi
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    83
  fi
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    84
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    85
  test_cygdrive_prefix=`$ECHO $input_path | $GREP ^/cygdrive/`
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    86
  if test "x$test_cygdrive_prefix" = x; then
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    87
    # As a simple fix, exclude /usr/bin since it's not a real path.
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    88
    if test "x`$ECHO $1 | $GREP ^/usr/bin/`" = x; then
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    89
      # The path is in a Cygwin special directory (e.g. /home). We need this converted to
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    90
      # a path prefixed by /cygdrive for fixpath to work.
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    91
      new_path="$CYGWIN_ROOT_PATH$input_path"
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    92
    fi
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    93
  fi
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    94
])
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    95
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    96
# Helper function which possibly converts a path using DOS-style short mode.
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    97
# If so, the updated path is stored in $new_path.
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    98
# $1: The path to check
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    99
AC_DEFUN([BASIC_MAKE_WINDOWS_SPACE_SAFE_MSYS],
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   100
[
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   101
  input_path="$1"
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   102
  # Check if we need to convert this using DOS-style short mode. If the path
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   103
  # contains just simple characters, use it. Otherwise (spaces, weird characters),
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   104
  # take no chances and rewrite it.
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   105
  # Note: m4 eats our [], so we need to use @<:@ and @:>@ instead.
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   106
  has_forbidden_chars=`$ECHO "$input_path" | $GREP @<:@^-_/:a-zA-Z0-9@:>@`
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   107
  if test "x$has_forbidden_chars" != x; then
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   108
    # Now convert it to mixed DOS-style, short mode (no spaces, and / instead of \)
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   109
    new_path=`cmd /c "for %A in (\"$input_path\") do @echo %~sA"|$TR \\\\\\\\ / | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   110
  fi
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   111
])
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   112
53110
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 47252
diff changeset
   113
# Helper function which possibly converts a path using DOS-style short mode.
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 47252
diff changeset
   114
# If so, the updated path is stored in $new_path.
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 47252
diff changeset
   115
# $1: The path to check
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 47252
diff changeset
   116
AC_DEFUN([BASIC_MAKE_WINDOWS_SPACE_SAFE_WSL],
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 47252
diff changeset
   117
[
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 47252
diff changeset
   118
  input_path="$1"
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 47252
diff changeset
   119
  # Check if we need to convert this using DOS-style short mode. If the path
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 47252
diff changeset
   120
  # contains just simple characters, use it. Otherwise (spaces, weird characters),
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 47252
diff changeset
   121
  # take no chances and rewrite it.
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 47252
diff changeset
   122
  # Note: m4 eats our [], so we need to use @<:@ and @:>@ instead.
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 47252
diff changeset
   123
  has_forbidden_chars=`$ECHO "$input_path" | $GREP [[^-_/:a-zA-Z0-9\\.]]`
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 47252
diff changeset
   124
  if test "x$has_forbidden_chars" != x; then
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 47252
diff changeset
   125
    # Now convert it to mixed DOS-style, short mode (no spaces, and / instead of \)
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 47252
diff changeset
   126
    TOPDIR_windows="$TOPDIR"
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 47252
diff changeset
   127
    BASIC_WINDOWS_REWRITE_AS_WINDOWS_MIXED_PATH([TOPDIR_windows])
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 47252
diff changeset
   128
    # First convert to Windows path to make input valid for cmd
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 47252
diff changeset
   129
    BASIC_WINDOWS_REWRITE_AS_WINDOWS_MIXED_PATH([input_path])
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 47252
diff changeset
   130
    new_path=`$CMD /c $TOPDIR_windows/make/scripts/windowsShortName.bat "$input_path" \
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 47252
diff changeset
   131
        | $SED -e 's|\r||g' \
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 47252
diff changeset
   132
        | $TR \\\\\\\\ / | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 47252
diff changeset
   133
    # Rewrite back to unix style
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 47252
diff changeset
   134
    BASIC_WINDOWS_REWRITE_AS_UNIX_PATH([new_path])
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 47252
diff changeset
   135
  fi
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 47252
diff changeset
   136
])
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 47252
diff changeset
   137
14111
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   138
# FIXME: The BASIC_FIXUP_*_CYGWIN/MSYS is most likely too convoluted
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   139
# and could probably be heavily simplified. However, all changes in this
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   140
# area tend to need lot of testing in different scenarios, and in lack of
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   141
# proper unit testing, cleaning this up has not been deemed worth the effort
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   142
# at the moment.
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   143
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   144
AC_DEFUN([BASIC_FIXUP_PATH_CYGWIN],
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   145
[
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   146
  # Input might be given as Windows format, start by converting to
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   147
  # unix format.
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   148
  path="[$]$1"
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   149
  new_path=`$CYGPATH -u "$path"`
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   150
58270
2921ee5e9881 8206125: [windows] cannot pass relative path to --with-boot-jdk
erikj
parents: 54455
diff changeset
   151
  BASIC_ABSOLUTE_PATH(new_path)
2921ee5e9881 8206125: [windows] cannot pass relative path to --with-boot-jdk
erikj
parents: 54455
diff changeset
   152
14111
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   153
  # Cygwin tries to hide some aspects of the Windows file system, such that binaries are
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   154
  # named .exe but called without that suffix. Therefore, "foo" and "foo.exe" are considered
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   155
  # the same file, most of the time (as in "test -f"). But not when running cygpath -s, then
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   156
  # "foo.exe" is OK but "foo" is an error.
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   157
  #
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   158
  # This test is therefore slightly more accurate than "test -f" to check for file precense.
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   159
  # It is also a way to make sure we got the proper file name for the real test later on.
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   160
  test_shortpath=`$CYGPATH -s -m "$new_path" 2> /dev/null`
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   161
  if test "x$test_shortpath" = x; then
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   162
    AC_MSG_NOTICE([The path of $1, which resolves as "$path", is invalid.])
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   163
    AC_MSG_ERROR([Cannot locate the the path of $1])
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   164
  fi
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   165
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   166
  # Call helper function which possibly converts this using DOS-style short mode.
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   167
  # If so, the updated path is stored in $new_path.
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   168
  BASIC_MAKE_WINDOWS_SPACE_SAFE_CYGWIN([$new_path])
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   169
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   170
  if test "x$path" != "x$new_path"; then
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   171
    $1="$new_path"
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   172
    AC_MSG_NOTICE([Rewriting $1 to "$new_path"])
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   173
  fi
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   174
])
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   175
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   176
AC_DEFUN([BASIC_FIXUP_PATH_MSYS],
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   177
[
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   178
  path="[$]$1"
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   179
  has_colon=`$ECHO $path | $GREP ^.:`
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   180
  new_path="$path"
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   181
  if test "x$has_colon" = x; then
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   182
    # Not in mixed or Windows style, start by that.
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   183
    new_path=`cmd //c echo $path`
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   184
  fi
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 19764
diff changeset
   185
58270
2921ee5e9881 8206125: [windows] cannot pass relative path to --with-boot-jdk
erikj
parents: 54455
diff changeset
   186
  BASIC_ABSOLUTE_PATH(new_path)
2921ee5e9881 8206125: [windows] cannot pass relative path to --with-boot-jdk
erikj
parents: 54455
diff changeset
   187
14111
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   188
  BASIC_MAKE_WINDOWS_SPACE_SAFE_MSYS([$new_path])
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   189
  BASIC_WINDOWS_REWRITE_AS_UNIX_PATH(new_path)
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   190
  if test "x$path" != "x$new_path"; then
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   191
    $1="$new_path"
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   192
    AC_MSG_NOTICE([Rewriting $1 to "$new_path"])
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   193
  fi
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   194
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   195
  # Save the first 10 bytes of this path to the storage, so fixpath can work.
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   196
  all_fixpath_prefixes=("${all_fixpath_prefixes@<:@@@:>@}" "${new_path:0:10}")
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   197
])
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   198
53110
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 47252
diff changeset
   199
AC_DEFUN([BASIC_FIXUP_PATH_WSL],
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 47252
diff changeset
   200
[
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 47252
diff changeset
   201
  # Input might be given as Windows format, start by converting to
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 47252
diff changeset
   202
  # unix format.
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 47252
diff changeset
   203
  new_path="[$]$1"
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 47252
diff changeset
   204
  BASIC_WINDOWS_REWRITE_AS_UNIX_PATH([new_path])
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 47252
diff changeset
   205
58270
2921ee5e9881 8206125: [windows] cannot pass relative path to --with-boot-jdk
erikj
parents: 54455
diff changeset
   206
  BASIC_ABSOLUTE_PATH(new_path)
2921ee5e9881 8206125: [windows] cannot pass relative path to --with-boot-jdk
erikj
parents: 54455
diff changeset
   207
53110
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 47252
diff changeset
   208
  # Call helper function which possibly converts this using DOS-style short mode.
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 47252
diff changeset
   209
  # If so, the updated path is stored in $new_path.
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 47252
diff changeset
   210
  BASIC_MAKE_WINDOWS_SPACE_SAFE_WSL([$new_path])
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 47252
diff changeset
   211
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 47252
diff changeset
   212
  if test "x$path" != "x$new_path"; then
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 47252
diff changeset
   213
    $1="$new_path"
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 47252
diff changeset
   214
    AC_MSG_NOTICE([Rewriting $1 to "$new_path"])
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 47252
diff changeset
   215
  fi
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 47252
diff changeset
   216
])
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 47252
diff changeset
   217
14111
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   218
AC_DEFUN([BASIC_FIXUP_EXECUTABLE_CYGWIN],
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   219
[
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   220
  # First separate the path from the arguments. This will split at the first
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   221
  # space.
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   222
  complete="[$]$1"
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   223
  path="${complete%% *}"
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   224
  tmp="$complete EOL"
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   225
  arguments="${tmp#* }"
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   226
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   227
  # Input might be given as Windows format, start by converting to
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   228
  # unix format.
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   229
  new_path=`$CYGPATH -u "$path"`
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   230
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   231
  # Now try to locate executable using which
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   232
  new_path=`$WHICH "$new_path" 2> /dev/null`
14280
7d8ad47b2dbf 8002220: build-infra: update for mac, solaris 11 issues
erikj
parents: 14111
diff changeset
   233
  # bat and cmd files are not always considered executable in cygwin causing which
7d8ad47b2dbf 8002220: build-infra: update for mac, solaris 11 issues
erikj
parents: 14111
diff changeset
   234
  # to not find them
7d8ad47b2dbf 8002220: build-infra: update for mac, solaris 11 issues
erikj
parents: 14111
diff changeset
   235
  if test "x$new_path" = x \
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 19764
diff changeset
   236
      && test "x`$ECHO \"$path\" | $GREP -i -e \"\\.bat$\" -e \"\\.cmd$\"`" != x \
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 19764
diff changeset
   237
      && test "x`$LS \"$path\" 2>/dev/null`" != x; then
14280
7d8ad47b2dbf 8002220: build-infra: update for mac, solaris 11 issues
erikj
parents: 14111
diff changeset
   238
    new_path=`$CYGPATH -u "$path"`
7d8ad47b2dbf 8002220: build-infra: update for mac, solaris 11 issues
erikj
parents: 14111
diff changeset
   239
  fi
14111
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   240
  if test "x$new_path" = x; then
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   241
    # Oops. Which didn't find the executable.
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   242
    # The splitting of arguments from the executable at a space might have been incorrect,
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   243
    # since paths with space are more likely in Windows. Give it another try with the whole
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   244
    # argument.
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   245
    path="$complete"
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   246
    arguments="EOL"
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   247
    new_path=`$CYGPATH -u "$path"`
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   248
    new_path=`$WHICH "$new_path" 2> /dev/null`
14280
7d8ad47b2dbf 8002220: build-infra: update for mac, solaris 11 issues
erikj
parents: 14111
diff changeset
   249
    # bat and cmd files are not always considered executable in cygwin causing which
7d8ad47b2dbf 8002220: build-infra: update for mac, solaris 11 issues
erikj
parents: 14111
diff changeset
   250
    # to not find them
7d8ad47b2dbf 8002220: build-infra: update for mac, solaris 11 issues
erikj
parents: 14111
diff changeset
   251
    if test "x$new_path" = x \
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 19764
diff changeset
   252
        && test "x`$ECHO \"$path\" | $GREP -i -e \"\\.bat$\" -e \"\\.cmd$\"`" != x \
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 19764
diff changeset
   253
        && test "x`$LS \"$path\" 2>/dev/null`" != x; then
14280
7d8ad47b2dbf 8002220: build-infra: update for mac, solaris 11 issues
erikj
parents: 14111
diff changeset
   254
      new_path=`$CYGPATH -u "$path"`
7d8ad47b2dbf 8002220: build-infra: update for mac, solaris 11 issues
erikj
parents: 14111
diff changeset
   255
    fi
14111
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   256
    if test "x$new_path" = x; then
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   257
      # It's still not found. Now this is an unrecoverable error.
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   258
      AC_MSG_NOTICE([The path of $1, which resolves as "$complete", is not found.])
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   259
      has_space=`$ECHO "$complete" | $GREP " "`
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   260
      if test "x$has_space" != x; then
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   261
        AC_MSG_NOTICE([You might be mixing spaces in the path and extra arguments, which is not allowed.])
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   262
      fi
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   263
      AC_MSG_ERROR([Cannot locate the the path of $1])
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   264
    fi
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   265
  fi
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   266
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   267
  # Cygwin tries to hide some aspects of the Windows file system, such that binaries are
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   268
  # named .exe but called without that suffix. Therefore, "foo" and "foo.exe" are considered
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   269
  # the same file, most of the time (as in "test -f"). But not when running cygpath -s, then
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   270
  # "foo.exe" is OK but "foo" is an error.
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   271
  #
19764
345aa6f8d18a 8024849: Don't remove upper case letters from username when setting USER_RELEASE_SUFFIX
ihse
parents: 17662
diff changeset
   272
  # This test is therefore slightly more accurate than "test -f" to check for file presence.
14111
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   273
  # It is also a way to make sure we got the proper file name for the real test later on.
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   274
  test_shortpath=`$CYGPATH -s -m "$new_path" 2> /dev/null`
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   275
  if test "x$test_shortpath" = x; then
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   276
    # Short path failed, file does not exist as specified.
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   277
    # Try adding .exe or .cmd
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   278
    if test -f "${new_path}.exe"; then
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 19764
diff changeset
   279
      input_to_shortpath="${new_path}.exe"
14111
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   280
    elif test -f "${new_path}.cmd"; then
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 19764
diff changeset
   281
      input_to_shortpath="${new_path}.cmd"
14111
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   282
    else
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   283
      AC_MSG_NOTICE([The path of $1, which resolves as "$new_path", is invalid.])
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   284
      AC_MSG_NOTICE([Neither "$new_path" nor "$new_path.exe/cmd" can be found])
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   285
      AC_MSG_ERROR([Cannot locate the the path of $1])
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   286
    fi
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   287
  else
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   288
    input_to_shortpath="$new_path"
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   289
  fi
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   290
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   291
  # Call helper function which possibly converts this using DOS-style short mode.
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   292
  # If so, the updated path is stored in $new_path.
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   293
  new_path="$input_to_shortpath"
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   294
  BASIC_MAKE_WINDOWS_SPACE_SAFE_CYGWIN([$input_to_shortpath])
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   295
  # remove trailing .exe if any
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   296
  new_path="${new_path/%.exe/}"
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   297
])
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   298
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   299
AC_DEFUN([BASIC_FIXUP_EXECUTABLE_MSYS],
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   300
[
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   301
  # First separate the path from the arguments. This will split at the first
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   302
  # space.
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   303
  complete="[$]$1"
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   304
  path="${complete%% *}"
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   305
  tmp="$complete EOL"
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   306
  arguments="${tmp#* }"
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   307
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   308
  # Input might be given as Windows format, start by converting to
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   309
  # unix format.
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   310
  new_path="$path"
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   311
  BASIC_WINDOWS_REWRITE_AS_UNIX_PATH(new_path)
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   312
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   313
  # Now try to locate executable using which
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   314
  new_path=`$WHICH "$new_path" 2> /dev/null`
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 19764
diff changeset
   315
14111
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   316
  if test "x$new_path" = x; then
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   317
    # Oops. Which didn't find the executable.
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   318
    # The splitting of arguments from the executable at a space might have been incorrect,
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   319
    # since paths with space are more likely in Windows. Give it another try with the whole
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   320
    # argument.
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   321
    path="$complete"
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   322
    arguments="EOL"
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   323
    new_path="$path"
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   324
    BASIC_WINDOWS_REWRITE_AS_UNIX_PATH(new_path)
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 19764
diff changeset
   325
14111
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   326
    new_path=`$WHICH "$new_path" 2> /dev/null`
25882
bd4315f0084b 8022177: Windows/MSYS builds broken
erikj
parents: 20363
diff changeset
   327
    # bat and cmd files are not always considered executable in MSYS causing which
bd4315f0084b 8022177: Windows/MSYS builds broken
erikj
parents: 20363
diff changeset
   328
    # to not find them
bd4315f0084b 8022177: Windows/MSYS builds broken
erikj
parents: 20363
diff changeset
   329
    if test "x$new_path" = x \
bd4315f0084b 8022177: Windows/MSYS builds broken
erikj
parents: 20363
diff changeset
   330
        && test "x`$ECHO \"$path\" | $GREP -i -e \"\\.bat$\" -e \"\\.cmd$\"`" != x \
bd4315f0084b 8022177: Windows/MSYS builds broken
erikj
parents: 20363
diff changeset
   331
        && test "x`$LS \"$path\" 2>/dev/null`" != x; then
bd4315f0084b 8022177: Windows/MSYS builds broken
erikj
parents: 20363
diff changeset
   332
      new_path="$path"
bd4315f0084b 8022177: Windows/MSYS builds broken
erikj
parents: 20363
diff changeset
   333
      BASIC_WINDOWS_REWRITE_AS_UNIX_PATH(new_path)
bd4315f0084b 8022177: Windows/MSYS builds broken
erikj
parents: 20363
diff changeset
   334
    fi
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 19764
diff changeset
   335
14111
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   336
    if test "x$new_path" = x; then
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   337
      # It's still not found. Now this is an unrecoverable error.
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   338
      AC_MSG_NOTICE([The path of $1, which resolves as "$complete", is not found.])
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   339
      has_space=`$ECHO "$complete" | $GREP " "`
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   340
      if test "x$has_space" != x; then
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   341
        AC_MSG_NOTICE([You might be mixing spaces in the path and extra arguments, which is not allowed.])
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   342
      fi
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   343
      AC_MSG_ERROR([Cannot locate the the path of $1])
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   344
    fi
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   345
  fi
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   346
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   347
  # Now new_path has a complete unix path to the binary
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   348
  if test "x`$ECHO $new_path | $GREP ^/bin/`" != x; then
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   349
    # Keep paths in /bin as-is, but remove trailing .exe if any
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   350
    new_path="${new_path/%.exe/}"
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   351
    # Do not save /bin paths to all_fixpath_prefixes!
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   352
  else
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   353
    # Not in mixed or Windows style, start by that.
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   354
    new_path=`cmd //c echo $new_path`
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   355
    BASIC_MAKE_WINDOWS_SPACE_SAFE_MSYS([$new_path])
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   356
    # Output is in $new_path
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   357
    BASIC_WINDOWS_REWRITE_AS_UNIX_PATH(new_path)
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   358
    # remove trailing .exe if any
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   359
    new_path="${new_path/%.exe/}"
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   360
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   361
    # Save the first 10 bytes of this path to the storage, so fixpath can work.
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   362
    all_fixpath_prefixes=("${all_fixpath_prefixes@<:@@@:>@}" "${new_path:0:10}")
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   363
  fi
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   364
])
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   365
53110
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 47252
diff changeset
   366
AC_DEFUN([BASIC_FIXUP_EXECUTABLE_WSL],
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 47252
diff changeset
   367
[
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 47252
diff changeset
   368
  # First separate the path from the arguments. This will split at the first
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 47252
diff changeset
   369
  # space.
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 47252
diff changeset
   370
  complete="[$]$1"
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 47252
diff changeset
   371
  path="${complete%% *}"
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 47252
diff changeset
   372
  tmp="$complete EOL"
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 47252
diff changeset
   373
  arguments="${tmp#* }"
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 47252
diff changeset
   374
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 47252
diff changeset
   375
  # Input might be given as Windows format, start by converting to
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 47252
diff changeset
   376
  # unix format.
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 47252
diff changeset
   377
  new_path="$path"
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 47252
diff changeset
   378
  BASIC_WINDOWS_REWRITE_AS_UNIX_PATH([new_path])
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 47252
diff changeset
   379
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 47252
diff changeset
   380
  # Now try to locate executable using which
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 47252
diff changeset
   381
  new_path_bak="$new_path"
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 47252
diff changeset
   382
  new_path=`$WHICH "$new_path" 2> /dev/null`
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 47252
diff changeset
   383
  # bat and cmd files are not considered executable in WSL
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 47252
diff changeset
   384
  if test "x$new_path" = x \
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 47252
diff changeset
   385
      && test "x`$ECHO \"$path\" | $GREP -i -e \"\\.bat$\" -e \"\\.cmd$\"`" != x \
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 47252
diff changeset
   386
      && test "x`$LS \"$path\" 2>/dev/null`" != x; then
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 47252
diff changeset
   387
    new_path="$new_path_back"
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 47252
diff changeset
   388
  fi
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 47252
diff changeset
   389
  if test "x$new_path" = x; then
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 47252
diff changeset
   390
    # Oops. Which didn't find the executable.
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 47252
diff changeset
   391
    # The splitting of arguments from the executable at a space might have been incorrect,
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 47252
diff changeset
   392
    # since paths with space are more likely in Windows. Give it another try with the whole
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 47252
diff changeset
   393
    # argument.
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 47252
diff changeset
   394
    path="$complete"
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 47252
diff changeset
   395
    arguments="EOL"
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 47252
diff changeset
   396
    new_path="$path"
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 47252
diff changeset
   397
    BASIC_WINDOWS_REWRITE_AS_UNIX_PATH([new_path])
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 47252
diff changeset
   398
    new_path_bak="$new_path"
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 47252
diff changeset
   399
    new_path=`$WHICH "$new_path" 2> /dev/null`
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 47252
diff changeset
   400
    # bat and cmd files are not considered executable in WSL
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 47252
diff changeset
   401
    if test "x$new_path" = x \
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 47252
diff changeset
   402
        && test "x`$ECHO \"$path\" | $GREP -i -e \"\\.bat$\" -e \"\\.cmd$\"`" != x \
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 47252
diff changeset
   403
        && test "x`$LS \"$path\" 2>/dev/null`" != x; then
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 47252
diff changeset
   404
      new_path="$new_path_bak"
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 47252
diff changeset
   405
    fi
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 47252
diff changeset
   406
    if test "x$new_path" = x; then
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 47252
diff changeset
   407
      # It's still not found. Now this is an unrecoverable error.
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 47252
diff changeset
   408
      AC_MSG_NOTICE([The path of $1, which resolves as "$complete", is not found.])
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 47252
diff changeset
   409
      has_space=`$ECHO "$complete" | $GREP " "`
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 47252
diff changeset
   410
      if test "x$has_space" != x; then
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 47252
diff changeset
   411
        AC_MSG_NOTICE([You might be mixing spaces in the path and extra arguments, which is not allowed.])
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 47252
diff changeset
   412
      fi
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 47252
diff changeset
   413
      AC_MSG_ERROR([Cannot locate the the path of $1])
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 47252
diff changeset
   414
    fi
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 47252
diff changeset
   415
  fi
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 47252
diff changeset
   416
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 47252
diff changeset
   417
  # In WSL, suffixes must be present for Windows executables
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 47252
diff changeset
   418
  if test ! -f "$new_path"; then
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 47252
diff changeset
   419
    # Try adding .exe or .cmd
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 47252
diff changeset
   420
    if test -f "${new_path}.exe"; then
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 47252
diff changeset
   421
      input_to_shortpath="${new_path}.exe"
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 47252
diff changeset
   422
    elif test -f "${new_path}.cmd"; then
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 47252
diff changeset
   423
      input_to_shortpath="${new_path}.cmd"
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 47252
diff changeset
   424
    else
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 47252
diff changeset
   425
      AC_MSG_NOTICE([The path of $1, which resolves as "$new_path", is invalid.])
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 47252
diff changeset
   426
      AC_MSG_NOTICE([Neither "$new_path" nor "$new_path.exe/cmd" can be found])
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 47252
diff changeset
   427
      AC_MSG_ERROR([Cannot locate the the path of $1])
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 47252
diff changeset
   428
    fi
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 47252
diff changeset
   429
  else
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 47252
diff changeset
   430
    input_to_shortpath="$new_path"
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 47252
diff changeset
   431
  fi
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 47252
diff changeset
   432
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 47252
diff changeset
   433
  # Call helper function which possibly converts this using DOS-style short mode.
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 47252
diff changeset
   434
  # If so, the updated path is stored in $new_path.
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 47252
diff changeset
   435
  new_path="$input_to_shortpath"
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 47252
diff changeset
   436
  BASIC_MAKE_WINDOWS_SPACE_SAFE_WSL([$input_to_shortpath])
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 47252
diff changeset
   437
])
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 47252
diff changeset
   438
14111
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   439
# Setup basic configuration paths, and platform-specific stuff related to PATHs.
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   440
AC_DEFUN([BASIC_CHECK_PATHS_WINDOWS],
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   441
[
17662
8cae100e6f14 8014003: New build does not handle symlinks in workspace path
erikj
parents: 15071
diff changeset
   442
  SRC_ROOT_LENGTH=`$THEPWDCMD -L|$WC -m`
14111
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   443
  if test $SRC_ROOT_LENGTH -gt 100; then
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 19764
diff changeset
   444
    AC_MSG_ERROR([Your base path is too long. It is $SRC_ROOT_LENGTH characters long, but only 100 is supported])
14111
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   445
  fi
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   446
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   447
  if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   448
    AC_MSG_CHECKING([cygwin release])
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   449
    CYGWIN_VERSION=`$UNAME -r`
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   450
    AC_MSG_RESULT([$CYGWIN_VERSION])
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   451
    WINDOWS_ENV_VENDOR='cygwin'
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   452
    WINDOWS_ENV_VERSION="$CYGWIN_VERSION"
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 19764
diff changeset
   453
30076
55f2f5bc0f2a 8079087: Add support for Cygwin 2.0
erikj
parents: 30022
diff changeset
   454
    CYGWIN_VERSION_OLD=`$ECHO $CYGWIN_VERSION | $GREP -e '^1\.[0-6]'`
55f2f5bc0f2a 8079087: Add support for Cygwin 2.0
erikj
parents: 30022
diff changeset
   455
    if test "x$CYGWIN_VERSION_OLD" != x; then
14111
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   456
      AC_MSG_NOTICE([Your cygwin is too old. You are running $CYGWIN_VERSION, but at least cygwin 1.7 is required. Please upgrade.])
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   457
      AC_MSG_ERROR([Cannot continue])
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   458
    fi
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   459
    if test "x$CYGPATH" = x; then
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 19764
diff changeset
   460
      AC_MSG_ERROR([Something is wrong with your cygwin installation since I cannot find cygpath.exe in your path])
14111
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   461
    fi
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   462
    AC_MSG_CHECKING([cygwin root directory as unix-style path])
44025
34389f09ea47 8176033: New cygwin grep does not match \r as newline
erikj
parents: 41458
diff changeset
   463
    # The cmd output ends with Windows line endings (CR/LF)
34389f09ea47 8176033: New cygwin grep does not match \r as newline
erikj
parents: 41458
diff changeset
   464
    cygwin_winpath_root=`cd / ; cmd /c cd | $TR -d '\r\n'`
14111
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   465
    # Force cygpath to report the proper root by including a trailing space, and then stripping it off again.
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   466
    CYGWIN_ROOT_PATH=`$CYGPATH -u "$cygwin_winpath_root " | $CUT -f 1 -d " "`
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   467
    AC_MSG_RESULT([$CYGWIN_ROOT_PATH])
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   468
    WINDOWS_ENV_ROOT_PATH="$CYGWIN_ROOT_PATH"
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   469
    test_cygdrive_prefix=`$ECHO $CYGWIN_ROOT_PATH | $GREP ^/cygdrive/`
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   470
    if test "x$test_cygdrive_prefix" = x; then
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 19764
diff changeset
   471
      AC_MSG_ERROR([Your cygdrive prefix is not /cygdrive. This is currently not supported. Change with mount -c.])
14111
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   472
    fi
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   473
  elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   474
    AC_MSG_CHECKING([msys release])
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   475
    MSYS_VERSION=`$UNAME -r`
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   476
    AC_MSG_RESULT([$MSYS_VERSION])
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 19764
diff changeset
   477
14111
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   478
    WINDOWS_ENV_VENDOR='msys'
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   479
    WINDOWS_ENV_VERSION="$MSYS_VERSION"
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   480
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   481
    AC_MSG_CHECKING([msys root directory as unix-style path])
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   482
    # The cmd output ends with Windows line endings (CR/LF), the grep command will strip that away
38843
2b141e8e916f 8158535: Configure script uses basic tools directly in many places
erikj
parents: 34101
diff changeset
   483
    MSYS_ROOT_PATH=`cd / ; cmd /c cd | $GREP ".*"`
14111
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   484
    BASIC_WINDOWS_REWRITE_AS_UNIX_PATH(MSYS_ROOT_PATH)
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   485
    AC_MSG_RESULT([$MSYS_ROOT_PATH])
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   486
    WINDOWS_ENV_ROOT_PATH="$MSYS_ROOT_PATH"
53110
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 47252
diff changeset
   487
  elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.wsl"; then
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 47252
diff changeset
   488
    AC_MSG_CHECKING([Windows version])
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 47252
diff changeset
   489
    # m4 replaces [ and ] so we use @<:@ and @:>@ instead
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 47252
diff changeset
   490
    WINDOWS_VERSION=`$CMD /c ver.exe | $EGREP -o '(@<:@0-9@:>@+\.)+@<:@0-9@:>@+'`
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 47252
diff changeset
   491
    AC_MSG_RESULT([$WINDOWS_VERSION])
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 47252
diff changeset
   492
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 47252
diff changeset
   493
    AC_MSG_CHECKING([WSL kernel version])
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 47252
diff changeset
   494
    WSL_KERNEL_VERSION=`$UNAME -v`
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 47252
diff changeset
   495
    AC_MSG_RESULT([$WSL_KERNEL_VERSION])
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 47252
diff changeset
   496
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 47252
diff changeset
   497
    AC_MSG_CHECKING([WSL kernel release])
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 47252
diff changeset
   498
    WSL_KERNEL_RELEASE=`$UNAME -r`
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 47252
diff changeset
   499
    AC_MSG_RESULT([$WSL_KERNEL_RELEASE])
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 47252
diff changeset
   500
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 47252
diff changeset
   501
    AC_MSG_CHECKING([WSL distribution])
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 47252
diff changeset
   502
    WSL_DISTRIBUTION=`$LSB_RELEASE -d | sed 's/Description:\t//'`
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 47252
diff changeset
   503
    AC_MSG_RESULT([$WSL_DISTRIBUTION])
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 47252
diff changeset
   504
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 47252
diff changeset
   505
    WINDOWS_ENV_VENDOR='WSL'
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 47252
diff changeset
   506
    WINDOWS_ENV_VERSION="$WSL_DISTRIBUTION $WSL_KERNEL_VERSION $WSL_KERNEL_RELEASE (on Windows build $WINDOWS_VERSION)"
14111
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   507
  else
53110
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 47252
diff changeset
   508
    AC_MSG_ERROR([Unknown Windows environment. Neither cygwin, msys, nor wsl was detected.])
14111
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   509
  fi
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   510
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   511
  # Test if windows or unix (cygwin/msys) find is first in path.
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   512
  AC_MSG_CHECKING([what kind of 'find' is first on the PATH])
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   513
  FIND_BINARY_OUTPUT=`find --version 2>&1`
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   514
  if test "x`echo $FIND_BINARY_OUTPUT | $GREP GNU`" != x; then
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   515
    AC_MSG_RESULT([unix style])
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   516
  elif test "x`echo $FIND_BINARY_OUTPUT | $GREP FIND`" != x; then
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   517
    AC_MSG_RESULT([Windows])
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   518
    AC_MSG_NOTICE([Your path contains Windows tools (C:\Windows\system32) before your unix (cygwin or msys) tools.])
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   519
    AC_MSG_NOTICE([This will not work. Please correct and make sure /usr/bin (or similar) is first in path.])
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   520
    AC_MSG_ERROR([Cannot continue])
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   521
  else
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   522
    AC_MSG_RESULT([unknown])
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   523
    AC_MSG_WARN([It seems that your find utility is non-standard.])
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   524
  fi
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   525
])
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   526
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   527
AC_DEFUN_ONCE([BASIC_COMPILE_FIXPATH],
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   528
[
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 19764
diff changeset
   529
  # When using cygwin or msys, we need a wrapper binary that renames
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 19764
diff changeset
   530
  # /cygdrive/c/ arguments into c:/ arguments and peeks into
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 19764
diff changeset
   531
  # @files and rewrites these too! This wrapper binary is
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 19764
diff changeset
   532
  # called fixpath.
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 19764
diff changeset
   533
  FIXPATH=
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 19764
diff changeset
   534
  if test "x$OPENJDK_BUILD_OS" = xwindows; then
14111
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   535
    AC_MSG_CHECKING([if fixpath can be created])
47252
fdac20095dff 8187543: Replace SRC_ROOT with TOPDIR
ihse
parents: 47217
diff changeset
   536
    FIXPATH_SRC="$TOPDIR/make/src/native/fixpath.c"
29790
79641c886929 8073634: Improve clean targets
erikj
parents: 25882
diff changeset
   537
    FIXPATH_BIN="$CONFIGURESUPPORT_OUTPUTDIR/bin/fixpath.exe"
79641c886929 8073634: Improve clean targets
erikj
parents: 25882
diff changeset
   538
    FIXPATH_DIR="$CONFIGURESUPPORT_OUTPUTDIR/fixpath"
14111
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   539
    if test "x$OPENJDK_BUILD_OS_ENV" = xwindows.cygwin; then
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   540
      # Important to keep the .exe suffix on Cygwin for Hotspot makefiles
29790
79641c886929 8073634: Improve clean targets
erikj
parents: 25882
diff changeset
   541
      FIXPATH="$FIXPATH_BIN -c"
14111
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   542
    elif test "x$OPENJDK_BUILD_OS_ENV" = xwindows.msys; then
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   543
      # Take all collected prefixes and turn them into a -m/c/foo@/c/bar@... command line
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   544
      # @ was chosen as separator to minimize risk of other tools messing around with it
29790
79641c886929 8073634: Improve clean targets
erikj
parents: 25882
diff changeset
   545
      all_unique_prefixes=`echo "${all_fixpath_prefixes@<:@@@:>@}" \
38843
2b141e8e916f 8158535: Configure script uses basic tools directly in many places
erikj
parents: 34101
diff changeset
   546
          | tr ' ' '\n' | $GREP '^/./' | $SORT | $UNIQ`
14111
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   547
      fixpath_argument_list=`echo $all_unique_prefixes  | tr ' ' '@'`
29790
79641c886929 8073634: Improve clean targets
erikj
parents: 25882
diff changeset
   548
      FIXPATH="$FIXPATH_BIN -m$fixpath_argument_list"
53110
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 47252
diff changeset
   549
    elif test "x$OPENJDK_BUILD_OS_ENV" = xwindows.wsl; then
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 47252
diff changeset
   550
      FIXPATH="$FIXPATH_BIN -w"
14111
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   551
    fi
29790
79641c886929 8073634: Improve clean targets
erikj
parents: 25882
diff changeset
   552
    FIXPATH_SRC_W="$FIXPATH_SRC"
79641c886929 8073634: Improve clean targets
erikj
parents: 25882
diff changeset
   553
    FIXPATH_BIN_W="$FIXPATH_BIN"
79641c886929 8073634: Improve clean targets
erikj
parents: 25882
diff changeset
   554
    BASIC_WINDOWS_REWRITE_AS_WINDOWS_MIXED_PATH([FIXPATH_SRC_W])
79641c886929 8073634: Improve clean targets
erikj
parents: 25882
diff changeset
   555
    BASIC_WINDOWS_REWRITE_AS_WINDOWS_MIXED_PATH([FIXPATH_BIN_W])
79641c886929 8073634: Improve clean targets
erikj
parents: 25882
diff changeset
   556
    $RM -rf $FIXPATH_BIN $FIXPATH_DIR
79641c886929 8073634: Improve clean targets
erikj
parents: 25882
diff changeset
   557
    $MKDIR -p $FIXPATH_DIR $CONFIGURESUPPORT_OUTPUTDIR/bin
79641c886929 8073634: Improve clean targets
erikj
parents: 25882
diff changeset
   558
    cd $FIXPATH_DIR
79641c886929 8073634: Improve clean targets
erikj
parents: 25882
diff changeset
   559
    $CC $FIXPATH_SRC_W -Fe$FIXPATH_BIN_W > $FIXPATH_DIR/fixpath1.log 2>&1
54455
542735f2a53e 8221907: make reconfigure breaks when configured with relative paths
erikj
parents: 53110
diff changeset
   560
    cd $CONFIGURE_START_DIR
14111
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   561
29790
79641c886929 8073634: Improve clean targets
erikj
parents: 25882
diff changeset
   562
    if test ! -x $FIXPATH_BIN; then
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 19764
diff changeset
   563
      AC_MSG_RESULT([no])
29790
79641c886929 8073634: Improve clean targets
erikj
parents: 25882
diff changeset
   564
      cat $FIXPATH_DIR/fixpath1.log
79641c886929 8073634: Improve clean targets
erikj
parents: 25882
diff changeset
   565
      AC_MSG_ERROR([Could not create $FIXPATH_BIN])
14111
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   566
    fi
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   567
    AC_MSG_RESULT([yes])
53110
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 47252
diff changeset
   568
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 47252
diff changeset
   569
    if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.wsl"; then
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 47252
diff changeset
   570
      OLD_WSLENV="$WSLENV"
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 47252
diff changeset
   571
      WSLENV=`$ECHO $WSLENV | $SED 's/PATH\/l://'`
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 47252
diff changeset
   572
      BASIC_APPEND_TO_PATH(WSLENV, "FIXPATH_PATH")
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 47252
diff changeset
   573
      export WSLENV
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 47252
diff changeset
   574
      export FIXPATH_PATH=$VS_PATH_WINDOWS
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 47252
diff changeset
   575
      AC_MSG_NOTICE([FIXPATH_PATH is $FIXPATH_PATH])
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 47252
diff changeset
   576
      AC_MSG_NOTICE([Rewriting WSLENV from $OLD_WSLENV to $WSLENV])
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 47252
diff changeset
   577
    fi
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 47252
diff changeset
   578
14111
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   579
    AC_MSG_CHECKING([if fixpath.exe works])
29790
79641c886929 8073634: Improve clean targets
erikj
parents: 25882
diff changeset
   580
    cd $FIXPATH_DIR
79641c886929 8073634: Improve clean targets
erikj
parents: 25882
diff changeset
   581
    $FIXPATH $CC $FIXPATH_SRC -Fe$FIXPATH_DIR/fixpath2.exe \
79641c886929 8073634: Improve clean targets
erikj
parents: 25882
diff changeset
   582
        > $FIXPATH_DIR/fixpath2.log 2>&1
54455
542735f2a53e 8221907: make reconfigure breaks when configured with relative paths
erikj
parents: 53110
diff changeset
   583
    cd $CONFIGURE_START_DIR
29790
79641c886929 8073634: Improve clean targets
erikj
parents: 25882
diff changeset
   584
    if test ! -x $FIXPATH_DIR/fixpath2.exe; then
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 19764
diff changeset
   585
      AC_MSG_RESULT([no])
29790
79641c886929 8073634: Improve clean targets
erikj
parents: 25882
diff changeset
   586
      cat $FIXPATH_DIR/fixpath2.log
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 19764
diff changeset
   587
      AC_MSG_ERROR([fixpath did not work!])
14111
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   588
    fi
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   589
    AC_MSG_RESULT([yes])
34101
a1db3b482137 8143296: javac-server/sjavac not compatible with LogFailures on Windows
erikj
parents: 30076
diff changeset
   590
a1db3b482137 8143296: javac-server/sjavac not compatible with LogFailures on Windows
erikj
parents: 30076
diff changeset
   591
    FIXPATH_DETACH_FLAG="--detach"
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 19764
diff changeset
   592
  fi
14111
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   593
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 19764
diff changeset
   594
  AC_SUBST(FIXPATH)
34101
a1db3b482137 8143296: javac-server/sjavac not compatible with LogFailures on Windows
erikj
parents: 30076
diff changeset
   595
  AC_SUBST(FIXPATH_DETACH_FLAG)
14111
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   596
])