common/autoconf/basics_windows.m4
author dholmes
Thu, 24 Oct 2013 20:45:43 -0400
changeset 21055 d52217bb8e80
parent 20363 fa7663fc5d50
child 25882 bd4315f0084b
permissions -rw-r--r--
8016096: [macosx] jawt_md.h shipped with jdk is outdated Summary: Revised build system and added platform specific headers for Mac OS X Reviewed-by: ihse, erikj Contributed-by: david.dehaven@oracle.com
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
14111
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
     1
#
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
     2
# Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
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"
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    35
  fi
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    36
])
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    37
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    38
AC_DEFUN([BASIC_WINDOWS_REWRITE_AS_WINDOWS_MIXED_PATH],
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    39
[
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    40
  unix_path="[$]$1"
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    41
  if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    42
    windows_path=`$CYGPATH -m "$unix_path"`
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    43
    $1="$windows_path"
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    44
  elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    45
    windows_path=`cmd //c echo $unix_path`
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    46
    $1="$windows_path"
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    47
  fi
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    48
])
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    49
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    50
# Helper function which possibly converts a path using DOS-style short mode.
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    51
# If so, the updated path is stored in $new_path.
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    52
# $1: The path to check
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    53
AC_DEFUN([BASIC_MAKE_WINDOWS_SPACE_SAFE_CYGWIN],
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    54
[
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    55
  input_path="$1"
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    56
  # 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
    57
  # contains just simple characters, use it. Otherwise (spaces, weird characters),
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    58
  # take no chances and rewrite it.
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    59
  # Note: m4 eats our [], so we need to use @<:@ and @:>@ instead.
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    60
  has_forbidden_chars=`$ECHO "$input_path" | $GREP @<:@^-._/a-zA-Z0-9@:>@`
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    61
  if test "x$has_forbidden_chars" != x; then
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    62
    # 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
    63
    shortmode_path=`$CYGPATH -s -m -a "$input_path"`
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    64
    path_after_shortmode=`$CYGPATH -u "$shortmode_path"`
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    65
    if test "x$path_after_shortmode" != "x$input_to_shortpath"; then
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    66
      # 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
    67
      # case insensitive, let's make it lowercase to improve readability.
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    68
      shortmode_path=`$ECHO "$shortmode_path" | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    69
      # Now convert it back to Unix-stile (cygpath)
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    70
      input_path=`$CYGPATH -u "$shortmode_path"`
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    71
      new_path="$input_path"
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    72
    fi
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    73
  fi
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    74
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    75
  test_cygdrive_prefix=`$ECHO $input_path | $GREP ^/cygdrive/`
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    76
  if test "x$test_cygdrive_prefix" = x; then
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    77
    # 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
    78
    if test "x`$ECHO $1 | $GREP ^/usr/bin/`" = x; then
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    79
      # 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
    80
      # a path prefixed by /cygdrive for fixpath to work.
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    81
      new_path="$CYGWIN_ROOT_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
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    86
# Helper function which possibly converts a path using DOS-style short mode.
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    87
# If so, the updated path is stored in $new_path.
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    88
# $1: The path to check
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    89
AC_DEFUN([BASIC_MAKE_WINDOWS_SPACE_SAFE_MSYS],
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    90
[
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    91
  input_path="$1"
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    92
  # 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
    93
  # contains just simple characters, use it. Otherwise (spaces, weird characters),
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    94
  # take no chances and rewrite it.
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    95
  # Note: m4 eats our [], so we need to use @<:@ and @:>@ instead.
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    96
  has_forbidden_chars=`$ECHO "$input_path" | $GREP @<:@^-_/:a-zA-Z0-9@:>@`
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    97
  if test "x$has_forbidden_chars" != x; then
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    98
    # 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
    99
    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
   100
  fi
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   101
])
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   102
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   103
# FIXME: The BASIC_FIXUP_*_CYGWIN/MSYS is most likely too convoluted
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   104
# and could probably be heavily simplified. However, all changes in this
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   105
# 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
   106
# proper unit testing, cleaning this up has not been deemed worth the effort
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   107
# at the moment.
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   108
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   109
AC_DEFUN([BASIC_FIXUP_PATH_CYGWIN],
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   110
[
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   111
  # Input might be given as Windows format, start by converting to
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   112
  # unix format.
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   113
  path="[$]$1"
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   114
  new_path=`$CYGPATH -u "$path"`
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   115
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   116
  # 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
   117
  # 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
   118
  # 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
   119
  # "foo.exe" is OK but "foo" is an error.
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   120
  #
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   121
  # 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
   122
  # 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
   123
  test_shortpath=`$CYGPATH -s -m "$new_path" 2> /dev/null`
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   124
  if test "x$test_shortpath" = x; then
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   125
    AC_MSG_NOTICE([The path of $1, which resolves as "$path", is invalid.])
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   126
    AC_MSG_ERROR([Cannot locate the the path of $1])
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   127
  fi
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   128
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   129
  # Call helper function which possibly converts this using DOS-style short mode.
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   130
  # If so, the updated path is stored in $new_path.
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   131
  BASIC_MAKE_WINDOWS_SPACE_SAFE_CYGWIN([$new_path])
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   132
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   133
  if test "x$path" != "x$new_path"; then
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   134
    $1="$new_path"
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   135
    AC_MSG_NOTICE([Rewriting $1 to "$new_path"])
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   136
  fi
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   137
])
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   138
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   139
AC_DEFUN([BASIC_FIXUP_PATH_MSYS],
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   140
[
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   141
  path="[$]$1"
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   142
  has_colon=`$ECHO $path | $GREP ^.:`
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   143
  new_path="$path"
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   144
  if test "x$has_colon" = x; then
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   145
    # Not in mixed or Windows style, start by that.
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   146
    new_path=`cmd //c echo $path`
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   147
  fi
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 19764
diff changeset
   148
14111
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   149
  BASIC_MAKE_WINDOWS_SPACE_SAFE_MSYS([$new_path])
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   150
  BASIC_WINDOWS_REWRITE_AS_UNIX_PATH(new_path)
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   151
  if test "x$path" != "x$new_path"; then
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   152
    $1="$new_path"
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   153
    AC_MSG_NOTICE([Rewriting $1 to "$new_path"])
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   154
  fi
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   155
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   156
  # 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
   157
  all_fixpath_prefixes=("${all_fixpath_prefixes@<:@@@:>@}" "${new_path:0:10}")
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   158
])
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   159
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   160
AC_DEFUN([BASIC_FIXUP_EXECUTABLE_CYGWIN],
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   161
[
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   162
  # First separate the path from the arguments. This will split at the first
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   163
  # space.
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   164
  complete="[$]$1"
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   165
  path="${complete%% *}"
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   166
  tmp="$complete EOL"
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   167
  arguments="${tmp#* }"
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   168
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   169
  # Input might be given as Windows format, start by converting to
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   170
  # unix format.
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   171
  new_path=`$CYGPATH -u "$path"`
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   172
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   173
  # Now try to locate executable using which
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   174
  new_path=`$WHICH "$new_path" 2> /dev/null`
14280
7d8ad47b2dbf 8002220: build-infra: update for mac, solaris 11 issues
erikj
parents: 14111
diff changeset
   175
  # 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
   176
  # to not find them
7d8ad47b2dbf 8002220: build-infra: update for mac, solaris 11 issues
erikj
parents: 14111
diff changeset
   177
  if test "x$new_path" = x \
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 19764
diff changeset
   178
      && test "x`$ECHO \"$path\" | $GREP -i -e \"\\.bat$\" -e \"\\.cmd$\"`" != x \
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 19764
diff changeset
   179
      && 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
   180
    new_path=`$CYGPATH -u "$path"`
7d8ad47b2dbf 8002220: build-infra: update for mac, solaris 11 issues
erikj
parents: 14111
diff changeset
   181
  fi
14111
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   182
  if test "x$new_path" = x; then
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   183
    # Oops. Which didn't find the executable.
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   184
    # 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
   185
    # 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
   186
    # argument.
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   187
    path="$complete"
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   188
    arguments="EOL"
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   189
    new_path=`$CYGPATH -u "$path"`
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   190
    new_path=`$WHICH "$new_path" 2> /dev/null`
14280
7d8ad47b2dbf 8002220: build-infra: update for mac, solaris 11 issues
erikj
parents: 14111
diff changeset
   191
    # 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
   192
    # to not find them
7d8ad47b2dbf 8002220: build-infra: update for mac, solaris 11 issues
erikj
parents: 14111
diff changeset
   193
    if test "x$new_path" = x \
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 19764
diff changeset
   194
        && test "x`$ECHO \"$path\" | $GREP -i -e \"\\.bat$\" -e \"\\.cmd$\"`" != x \
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 19764
diff changeset
   195
        && 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
   196
      new_path=`$CYGPATH -u "$path"`
7d8ad47b2dbf 8002220: build-infra: update for mac, solaris 11 issues
erikj
parents: 14111
diff changeset
   197
    fi
14111
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   198
    if test "x$new_path" = x; then
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   199
      # It's still not found. Now this is an unrecoverable error.
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   200
      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
   201
      has_space=`$ECHO "$complete" | $GREP " "`
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   202
      if test "x$has_space" != x; then
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   203
        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
   204
      fi
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   205
      AC_MSG_ERROR([Cannot locate the the path of $1])
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   206
    fi
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   207
  fi
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   208
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   209
  # 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
   210
  # 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
   211
  # 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
   212
  # "foo.exe" is OK but "foo" is an error.
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   213
  #
19764
345aa6f8d18a 8024849: Don't remove upper case letters from username when setting USER_RELEASE_SUFFIX
ihse
parents: 17662
diff changeset
   214
  # 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
   215
  # 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
   216
  test_shortpath=`$CYGPATH -s -m "$new_path" 2> /dev/null`
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   217
  if test "x$test_shortpath" = x; then
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   218
    # Short path failed, file does not exist as specified.
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   219
    # Try adding .exe or .cmd
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   220
    if test -f "${new_path}.exe"; then
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 19764
diff changeset
   221
      input_to_shortpath="${new_path}.exe"
14111
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   222
    elif test -f "${new_path}.cmd"; then
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 19764
diff changeset
   223
      input_to_shortpath="${new_path}.cmd"
14111
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   224
    else
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   225
      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
   226
      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
   227
      AC_MSG_ERROR([Cannot locate the the path of $1])
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   228
    fi
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   229
  else
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   230
    input_to_shortpath="$new_path"
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   231
  fi
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   232
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   233
  # Call helper function which possibly converts this using DOS-style short mode.
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   234
  # If so, the updated path is stored in $new_path.
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   235
  new_path="$input_to_shortpath"
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   236
  BASIC_MAKE_WINDOWS_SPACE_SAFE_CYGWIN([$input_to_shortpath])
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   237
  # remove trailing .exe if any
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   238
  new_path="${new_path/%.exe/}"
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   239
])
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   240
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   241
AC_DEFUN([BASIC_FIXUP_EXECUTABLE_MSYS],
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   242
[
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   243
  # First separate the path from the arguments. This will split at the first
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   244
  # space.
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   245
  complete="[$]$1"
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   246
  path="${complete%% *}"
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   247
  tmp="$complete EOL"
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   248
  arguments="${tmp#* }"
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   249
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   250
  # Input might be given as Windows format, start by converting to
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   251
  # unix format.
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   252
  new_path="$path"
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   253
  BASIC_WINDOWS_REWRITE_AS_UNIX_PATH(new_path)
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   254
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   255
  # Now try to locate executable using which
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   256
  new_path=`$WHICH "$new_path" 2> /dev/null`
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 19764
diff changeset
   257
14111
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   258
  if test "x$new_path" = x; then
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   259
    # Oops. Which didn't find the executable.
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   260
    # 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
   261
    # 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
   262
    # argument.
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   263
    path="$complete"
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   264
    arguments="EOL"
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   265
    new_path="$path"
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   266
    BASIC_WINDOWS_REWRITE_AS_UNIX_PATH(new_path)
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 19764
diff changeset
   267
14111
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   268
    new_path=`$WHICH "$new_path" 2> /dev/null`
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 19764
diff changeset
   269
14111
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   270
    if test "x$new_path" = x; then
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   271
      # It's still not found. Now this is an unrecoverable error.
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   272
      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
   273
      has_space=`$ECHO "$complete" | $GREP " "`
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   274
      if test "x$has_space" != x; then
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   275
        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
   276
      fi
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   277
      AC_MSG_ERROR([Cannot locate the the path of $1])
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   278
    fi
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   279
  fi
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   280
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   281
  # Now new_path has a complete unix path to the binary
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   282
  if test "x`$ECHO $new_path | $GREP ^/bin/`" != x; then
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   283
    # Keep paths in /bin as-is, but remove trailing .exe if any
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   284
    new_path="${new_path/%.exe/}"
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   285
    # Do not save /bin paths to all_fixpath_prefixes!
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   286
  else
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   287
    # Not in mixed or Windows style, start by that.
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   288
    new_path=`cmd //c echo $new_path`
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   289
    BASIC_MAKE_WINDOWS_SPACE_SAFE_MSYS([$new_path])
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   290
    # Output is in $new_path
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   291
    BASIC_WINDOWS_REWRITE_AS_UNIX_PATH(new_path)
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   292
    # remove trailing .exe if any
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   293
    new_path="${new_path/%.exe/}"
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   294
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   295
    # 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
   296
    all_fixpath_prefixes=("${all_fixpath_prefixes@<:@@@:>@}" "${new_path:0:10}")
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   297
  fi
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   298
])
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   299
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   300
# Setup basic configuration paths, and platform-specific stuff related to PATHs.
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   301
AC_DEFUN([BASIC_CHECK_PATHS_WINDOWS],
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   302
[
17662
8cae100e6f14 8014003: New build does not handle symlinks in workspace path
erikj
parents: 15071
diff changeset
   303
  SRC_ROOT_LENGTH=`$THEPWDCMD -L|$WC -m`
14111
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   304
  if test $SRC_ROOT_LENGTH -gt 100; then
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 19764
diff changeset
   305
    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
   306
  fi
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   307
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   308
  if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   309
    AC_MSG_CHECKING([cygwin release])
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   310
    CYGWIN_VERSION=`$UNAME -r`
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   311
    AC_MSG_RESULT([$CYGWIN_VERSION])
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   312
    WINDOWS_ENV_VENDOR='cygwin'
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   313
    WINDOWS_ENV_VERSION="$CYGWIN_VERSION"
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 19764
diff changeset
   314
14111
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   315
    CYGWIN_VERSION_OK=`$ECHO $CYGWIN_VERSION | $GREP ^1.7.`
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   316
    if test "x$CYGWIN_VERSION_OK" = x; then
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   317
      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
   318
      AC_MSG_ERROR([Cannot continue])
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   319
    fi
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   320
    if test "x$CYGPATH" = x; then
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 19764
diff changeset
   321
      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
   322
    fi
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   323
    AC_MSG_CHECKING([cygwin root directory as unix-style path])
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   324
    # The cmd output ends with Windows line endings (CR/LF), the grep command will strip that away
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   325
    cygwin_winpath_root=`cd / ; cmd /c cd | grep ".*"`
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   326
    # 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
   327
    CYGWIN_ROOT_PATH=`$CYGPATH -u "$cygwin_winpath_root " | $CUT -f 1 -d " "`
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   328
    AC_MSG_RESULT([$CYGWIN_ROOT_PATH])
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   329
    WINDOWS_ENV_ROOT_PATH="$CYGWIN_ROOT_PATH"
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   330
    test_cygdrive_prefix=`$ECHO $CYGWIN_ROOT_PATH | $GREP ^/cygdrive/`
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   331
    if test "x$test_cygdrive_prefix" = x; then
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 19764
diff changeset
   332
      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
   333
    fi
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   334
  elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   335
    AC_MSG_CHECKING([msys release])
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   336
    MSYS_VERSION=`$UNAME -r`
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   337
    AC_MSG_RESULT([$MSYS_VERSION])
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 19764
diff changeset
   338
14111
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   339
    WINDOWS_ENV_VENDOR='msys'
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   340
    WINDOWS_ENV_VERSION="$MSYS_VERSION"
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   341
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   342
    AC_MSG_CHECKING([msys root directory as unix-style path])
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   343
    # The cmd output ends with Windows line endings (CR/LF), the grep command will strip that away
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   344
    MSYS_ROOT_PATH=`cd / ; cmd /c cd | grep ".*"`
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   345
    BASIC_WINDOWS_REWRITE_AS_UNIX_PATH(MSYS_ROOT_PATH)
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   346
    AC_MSG_RESULT([$MSYS_ROOT_PATH])
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   347
    WINDOWS_ENV_ROOT_PATH="$MSYS_ROOT_PATH"
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   348
  else
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   349
    AC_MSG_ERROR([Unknown Windows environment. Neither cygwin nor msys was detected.])
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   350
  fi
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   351
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   352
  # Test if windows or unix (cygwin/msys) find is first in path.
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   353
  AC_MSG_CHECKING([what kind of 'find' is first on the PATH])
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   354
  FIND_BINARY_OUTPUT=`find --version 2>&1`
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   355
  if test "x`echo $FIND_BINARY_OUTPUT | $GREP GNU`" != x; then
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   356
    AC_MSG_RESULT([unix style])
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   357
  elif test "x`echo $FIND_BINARY_OUTPUT | $GREP FIND`" != x; then
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   358
    AC_MSG_RESULT([Windows])
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   359
    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
   360
    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
   361
    AC_MSG_ERROR([Cannot continue])
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   362
  else
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   363
    AC_MSG_RESULT([unknown])
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   364
    AC_MSG_WARN([It seems that your find utility is non-standard.])
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   365
  fi
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   366
])
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   367
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   368
AC_DEFUN_ONCE([BASIC_COMPILE_FIXPATH],
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   369
[
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 19764
diff changeset
   370
  # 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
   371
  # /cygdrive/c/ arguments into c:/ arguments and peeks into
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 19764
diff changeset
   372
  # @files and rewrites these too! This wrapper binary is
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 19764
diff changeset
   373
  # called fixpath.
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 19764
diff changeset
   374
  FIXPATH=
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 19764
diff changeset
   375
  if test "x$OPENJDK_BUILD_OS" = xwindows; then
14111
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   376
    AC_MSG_CHECKING([if fixpath can be created])
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   377
    FIXPATH_SRC="$SRC_ROOT/common/src/fixpath.c"
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   378
    FIXPATH_BIN="$OUTPUT_ROOT/fixpath.exe"
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   379
    if test "x$OPENJDK_BUILD_OS_ENV" = xwindows.cygwin; then
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   380
      FIXPATH_SRC=`$CYGPATH -m $FIXPATH_SRC`
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   381
      FIXPATH_BIN=`$CYGPATH -m $FIXPATH_BIN`
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   382
      # Important to keep the .exe suffix on Cygwin for Hotspot makefiles
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   383
      FIXPATH="$OUTPUT_ROOT/fixpath.exe -c"
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   384
    elif test "x$OPENJDK_BUILD_OS_ENV" = xwindows.msys; then
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   385
      FIXPATH_SRC=`cmd //c echo $FIXPATH_SRC`
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   386
      FIXPATH_BIN=`cmd //c echo $FIXPATH_BIN`
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   387
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   388
      # 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
   389
      # @ was chosen as separator to minimize risk of other tools messing around with it
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   390
      all_unique_prefixes=`echo "${all_fixpath_prefixes@<:@@@:>@}" | tr ' ' '\n' | grep '^/./' | sort | uniq`
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   391
      fixpath_argument_list=`echo $all_unique_prefixes  | tr ' ' '@'`
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 19764
diff changeset
   392
14111
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   393
      FIXPATH="$OUTPUT_ROOT/fixpath -m$fixpath_argument_list"
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   394
    fi
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   395
    rm -f $OUTPUT_ROOT/fixpath*
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   396
    cd $OUTPUT_ROOT
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   397
    $CC $FIXPATH_SRC -Fe$FIXPATH_BIN > $OUTPUT_ROOT/fixpath1.log 2>&1
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   398
    cd $CURDIR
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   399
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 19764
diff changeset
   400
    if test ! -x $OUTPUT_ROOT/fixpath.exe; then
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 19764
diff changeset
   401
      AC_MSG_RESULT([no])
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 19764
diff changeset
   402
      cat $OUTPUT_ROOT/fixpath1.log
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 19764
diff changeset
   403
      AC_MSG_ERROR([Could not create $OUTPUT_ROOT/fixpath.exe])
14111
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   404
    fi
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   405
    AC_MSG_RESULT([yes])
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   406
    AC_MSG_CHECKING([if fixpath.exe works])
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   407
    cd $OUTPUT_ROOT
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 19764
diff changeset
   408
    $FIXPATH $CC $SRC_ROOT/common/src/fixpath.c -Fe$OUTPUT_ROOT/fixpath2.exe > $OUTPUT_ROOT/fixpath2.log 2>&1
14111
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   409
    cd $CURDIR
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 19764
diff changeset
   410
    if test ! -x $OUTPUT_ROOT/fixpath2.exe; then
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 19764
diff changeset
   411
      AC_MSG_RESULT([no])
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 19764
diff changeset
   412
      cat $OUTPUT_ROOT/fixpath2.log
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 19764
diff changeset
   413
      AC_MSG_ERROR([fixpath did not work!])
14111
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   414
    fi
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   415
    AC_MSG_RESULT([yes])
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   416
    rm -f $OUTPUT_ROOT/fixpath?.??? $OUTPUT_ROOT/fixpath.obj
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 19764
diff changeset
   417
  fi
14111
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   418
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 19764
diff changeset
   419
  AC_SUBST(FIXPATH)
14111
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   420
])