Thu, 01 Aug 2013 17:24:26 -0700
Merge
ohair@494 | 1 | # |
ohair@494 | 2 | # Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved. |
ohair@494 | 3 | # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
ohair@494 | 4 | # |
ohair@494 | 5 | # This code is free software; you can redistribute it and/or modify it |
ohair@494 | 6 | # under the terms of the GNU General Public License version 2 only, as |
ohair@494 | 7 | # published by the Free Software Foundation. Oracle designates this |
ohair@494 | 8 | # particular file as subject to the "Classpath" exception as provided |
ohair@494 | 9 | # by Oracle in the LICENSE file that accompanied this code. |
ohair@494 | 10 | # |
ohair@494 | 11 | # This code is distributed in the hope that it will be useful, but WITHOUT |
ohair@494 | 12 | # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
ohair@494 | 13 | # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
ohair@494 | 14 | # version 2 for more details (a copy is included in the LICENSE file that |
ohair@494 | 15 | # accompanied this code). |
ohair@494 | 16 | # |
ohair@494 | 17 | # You should have received a copy of the GNU General Public License version |
ohair@494 | 18 | # 2 along with this work; if not, write to the Free Software Foundation, |
ohair@494 | 19 | # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
ohair@494 | 20 | # |
ohair@494 | 21 | # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
ohair@494 | 22 | # or visit www.oracle.com if you need additional information or have any |
ohair@494 | 23 | # questions. |
ohair@494 | 24 | # |
ohair@494 | 25 | |
ohair@494 | 26 | AC_DEFUN([BASIC_WINDOWS_REWRITE_AS_UNIX_PATH], |
ohair@494 | 27 | [ |
ohair@494 | 28 | windows_path="[$]$1" |
ohair@494 | 29 | if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then |
ohair@494 | 30 | unix_path=`$CYGPATH -u "$windows_path"` |
ohair@494 | 31 | $1="$unix_path" |
ohair@494 | 32 | elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then |
ohair@494 | 33 | unix_path=`$ECHO "$windows_path" | $SED -e 's,^\\(.\\):,/\\1,g' -e 's,\\\\,/,g'` |
ohair@494 | 34 | $1="$unix_path" |
ohair@494 | 35 | fi |
ohair@494 | 36 | ]) |
ohair@494 | 37 | |
ohair@494 | 38 | AC_DEFUN([BASIC_WINDOWS_REWRITE_AS_WINDOWS_MIXED_PATH], |
ohair@494 | 39 | [ |
ohair@494 | 40 | unix_path="[$]$1" |
ohair@494 | 41 | if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then |
ohair@494 | 42 | windows_path=`$CYGPATH -m "$unix_path"` |
ohair@494 | 43 | $1="$windows_path" |
ohair@494 | 44 | elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then |
ohair@494 | 45 | windows_path=`cmd //c echo $unix_path` |
ohair@494 | 46 | $1="$windows_path" |
ohair@494 | 47 | fi |
ohair@494 | 48 | ]) |
ohair@494 | 49 | |
ohair@494 | 50 | # Helper function which possibly converts a path using DOS-style short mode. |
ohair@494 | 51 | # If so, the updated path is stored in $new_path. |
ohair@494 | 52 | # $1: The path to check |
ohair@494 | 53 | AC_DEFUN([BASIC_MAKE_WINDOWS_SPACE_SAFE_CYGWIN], |
ohair@494 | 54 | [ |
ohair@494 | 55 | input_path="$1" |
ohair@494 | 56 | # Check if we need to convert this using DOS-style short mode. If the path |
ohair@494 | 57 | # contains just simple characters, use it. Otherwise (spaces, weird characters), |
ohair@494 | 58 | # take no chances and rewrite it. |
ohair@494 | 59 | # Note: m4 eats our [], so we need to use @<:@ and @:>@ instead. |
ohair@494 | 60 | has_forbidden_chars=`$ECHO "$input_path" | $GREP @<:@^-._/a-zA-Z0-9@:>@` |
ohair@494 | 61 | if test "x$has_forbidden_chars" != x; then |
ohair@494 | 62 | # Now convert it to mixed DOS-style, short mode (no spaces, and / instead of \) |
ohair@494 | 63 | shortmode_path=`$CYGPATH -s -m -a "$input_path"` |
ohair@494 | 64 | path_after_shortmode=`$CYGPATH -u "$shortmode_path"` |
ohair@494 | 65 | if test "x$path_after_shortmode" != "x$input_to_shortpath"; then |
ohair@494 | 66 | # Going to short mode and back again did indeed matter. Since short mode is |
ohair@494 | 67 | # case insensitive, let's make it lowercase to improve readability. |
ohair@494 | 68 | shortmode_path=`$ECHO "$shortmode_path" | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` |
ohair@494 | 69 | # Now convert it back to Unix-stile (cygpath) |
ohair@494 | 70 | input_path=`$CYGPATH -u "$shortmode_path"` |
ohair@494 | 71 | new_path="$input_path" |
ohair@494 | 72 | fi |
ohair@494 | 73 | fi |
ohair@494 | 74 | |
ohair@494 | 75 | test_cygdrive_prefix=`$ECHO $input_path | $GREP ^/cygdrive/` |
ohair@494 | 76 | if test "x$test_cygdrive_prefix" = x; then |
ohair@494 | 77 | # As a simple fix, exclude /usr/bin since it's not a real path. |
ohair@494 | 78 | if test "x`$ECHO $1 | $GREP ^/usr/bin/`" = x; then |
ohair@494 | 79 | # The path is in a Cygwin special directory (e.g. /home). We need this converted to |
ohair@494 | 80 | # a path prefixed by /cygdrive for fixpath to work. |
ohair@494 | 81 | new_path="$CYGWIN_ROOT_PATH$input_path" |
ohair@494 | 82 | fi |
ohair@494 | 83 | fi |
ohair@494 | 84 | ]) |
ohair@494 | 85 | |
ohair@494 | 86 | # Helper function which possibly converts a path using DOS-style short mode. |
ohair@494 | 87 | # If so, the updated path is stored in $new_path. |
ohair@494 | 88 | # $1: The path to check |
ohair@494 | 89 | AC_DEFUN([BASIC_MAKE_WINDOWS_SPACE_SAFE_MSYS], |
ohair@494 | 90 | [ |
ohair@494 | 91 | input_path="$1" |
ohair@494 | 92 | # Check if we need to convert this using DOS-style short mode. If the path |
ohair@494 | 93 | # contains just simple characters, use it. Otherwise (spaces, weird characters), |
ohair@494 | 94 | # take no chances and rewrite it. |
ohair@494 | 95 | # Note: m4 eats our [], so we need to use @<:@ and @:>@ instead. |
ohair@494 | 96 | has_forbidden_chars=`$ECHO "$input_path" | $GREP @<:@^-_/:a-zA-Z0-9@:>@` |
ohair@494 | 97 | if test "x$has_forbidden_chars" != x; then |
ohair@494 | 98 | # Now convert it to mixed DOS-style, short mode (no spaces, and / instead of \) |
ohair@494 | 99 | new_path=`cmd /c "for %A in (\"$input_path\") do @echo %~sA"|$TR \\\\\\\\ / | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` |
ohair@494 | 100 | fi |
ohair@494 | 101 | ]) |
ohair@494 | 102 | |
ohair@494 | 103 | # FIXME: The BASIC_FIXUP_*_CYGWIN/MSYS is most likely too convoluted |
ohair@494 | 104 | # and could probably be heavily simplified. However, all changes in this |
ohair@494 | 105 | # area tend to need lot of testing in different scenarios, and in lack of |
ohair@494 | 106 | # proper unit testing, cleaning this up has not been deemed worth the effort |
ohair@494 | 107 | # at the moment. |
ohair@494 | 108 | |
ohair@494 | 109 | AC_DEFUN([BASIC_FIXUP_PATH_CYGWIN], |
ohair@494 | 110 | [ |
ohair@494 | 111 | # Input might be given as Windows format, start by converting to |
ohair@494 | 112 | # unix format. |
ohair@494 | 113 | path="[$]$1" |
ohair@494 | 114 | new_path=`$CYGPATH -u "$path"` |
ohair@494 | 115 | |
ohair@494 | 116 | # Cygwin tries to hide some aspects of the Windows file system, such that binaries are |
ohair@494 | 117 | # named .exe but called without that suffix. Therefore, "foo" and "foo.exe" are considered |
ohair@494 | 118 | # the same file, most of the time (as in "test -f"). But not when running cygpath -s, then |
ohair@494 | 119 | # "foo.exe" is OK but "foo" is an error. |
ohair@494 | 120 | # |
ohair@494 | 121 | # This test is therefore slightly more accurate than "test -f" to check for file precense. |
ohair@494 | 122 | # It is also a way to make sure we got the proper file name for the real test later on. |
ohair@494 | 123 | test_shortpath=`$CYGPATH -s -m "$new_path" 2> /dev/null` |
ohair@494 | 124 | if test "x$test_shortpath" = x; then |
ohair@494 | 125 | AC_MSG_NOTICE([The path of $1, which resolves as "$path", is invalid.]) |
ohair@494 | 126 | AC_MSG_ERROR([Cannot locate the the path of $1]) |
ohair@494 | 127 | fi |
ohair@494 | 128 | |
ohair@494 | 129 | # Call helper function which possibly converts this using DOS-style short mode. |
ohair@494 | 130 | # If so, the updated path is stored in $new_path. |
ohair@494 | 131 | BASIC_MAKE_WINDOWS_SPACE_SAFE_CYGWIN([$new_path]) |
ohair@494 | 132 | |
ohair@494 | 133 | if test "x$path" != "x$new_path"; then |
ohair@494 | 134 | $1="$new_path" |
ohair@494 | 135 | AC_MSG_NOTICE([Rewriting $1 to "$new_path"]) |
ohair@494 | 136 | fi |
ohair@494 | 137 | ]) |
ohair@494 | 138 | |
ohair@494 | 139 | AC_DEFUN([BASIC_FIXUP_PATH_MSYS], |
ohair@494 | 140 | [ |
ohair@494 | 141 | path="[$]$1" |
ohair@494 | 142 | has_colon=`$ECHO $path | $GREP ^.:` |
ohair@494 | 143 | new_path="$path" |
ohair@494 | 144 | if test "x$has_colon" = x; then |
ohair@494 | 145 | # Not in mixed or Windows style, start by that. |
ohair@494 | 146 | new_path=`cmd //c echo $path` |
ohair@494 | 147 | fi |
ohair@494 | 148 | |
ohair@494 | 149 | BASIC_MAKE_WINDOWS_SPACE_SAFE_MSYS([$new_path]) |
ohair@494 | 150 | BASIC_WINDOWS_REWRITE_AS_UNIX_PATH(new_path) |
ohair@494 | 151 | if test "x$path" != "x$new_path"; then |
ohair@494 | 152 | $1="$new_path" |
ohair@494 | 153 | AC_MSG_NOTICE([Rewriting $1 to "$new_path"]) |
ohair@494 | 154 | fi |
ohair@494 | 155 | |
ohair@494 | 156 | # Save the first 10 bytes of this path to the storage, so fixpath can work. |
ohair@494 | 157 | all_fixpath_prefixes=("${all_fixpath_prefixes@<:@@@:>@}" "${new_path:0:10}") |
ohair@494 | 158 | ]) |
ohair@494 | 159 | |
ohair@494 | 160 | AC_DEFUN([BASIC_FIXUP_EXECUTABLE_CYGWIN], |
ohair@494 | 161 | [ |
ohair@494 | 162 | # First separate the path from the arguments. This will split at the first |
ohair@494 | 163 | # space. |
ohair@494 | 164 | complete="[$]$1" |
ohair@494 | 165 | path="${complete%% *}" |
ohair@494 | 166 | tmp="$complete EOL" |
ohair@494 | 167 | arguments="${tmp#* }" |
ohair@494 | 168 | |
ohair@494 | 169 | # Input might be given as Windows format, start by converting to |
ohair@494 | 170 | # unix format. |
ohair@494 | 171 | new_path=`$CYGPATH -u "$path"` |
ohair@494 | 172 | |
ohair@494 | 173 | # Now try to locate executable using which |
ohair@494 | 174 | new_path=`$WHICH "$new_path" 2> /dev/null` |
erikj@502 | 175 | # bat and cmd files are not always considered executable in cygwin causing which |
erikj@502 | 176 | # to not find them |
erikj@502 | 177 | if test "x$new_path" = x \ |
erikj@577 | 178 | && test "x`$ECHO \"$path\" | $GREP -i -e \"\\.bat$\" -e \"\\.cmd$\"`" != x \ |
erikj@502 | 179 | && test "x`$LS \"$path\" 2>/dev/null`" != x; then |
erikj@502 | 180 | new_path=`$CYGPATH -u "$path"` |
erikj@502 | 181 | fi |
ohair@494 | 182 | if test "x$new_path" = x; then |
ohair@494 | 183 | # Oops. Which didn't find the executable. |
ohair@494 | 184 | # The splitting of arguments from the executable at a space might have been incorrect, |
ohair@494 | 185 | # since paths with space are more likely in Windows. Give it another try with the whole |
ohair@494 | 186 | # argument. |
ohair@494 | 187 | path="$complete" |
ohair@494 | 188 | arguments="EOL" |
ohair@494 | 189 | new_path=`$CYGPATH -u "$path"` |
ohair@494 | 190 | new_path=`$WHICH "$new_path" 2> /dev/null` |
erikj@502 | 191 | # bat and cmd files are not always considered executable in cygwin causing which |
erikj@502 | 192 | # to not find them |
erikj@502 | 193 | if test "x$new_path" = x \ |
erikj@577 | 194 | && test "x`$ECHO \"$path\" | $GREP -i -e \"\\.bat$\" -e \"\\.cmd$\"`" != x \ |
erikj@502 | 195 | && test "x`$LS \"$path\" 2>/dev/null`" != x; then |
erikj@502 | 196 | new_path=`$CYGPATH -u "$path"` |
erikj@502 | 197 | fi |
ohair@494 | 198 | if test "x$new_path" = x; then |
ohair@494 | 199 | # It's still not found. Now this is an unrecoverable error. |
ohair@494 | 200 | AC_MSG_NOTICE([The path of $1, which resolves as "$complete", is not found.]) |
ohair@494 | 201 | has_space=`$ECHO "$complete" | $GREP " "` |
ohair@494 | 202 | if test "x$has_space" != x; then |
ohair@494 | 203 | AC_MSG_NOTICE([You might be mixing spaces in the path and extra arguments, which is not allowed.]) |
ohair@494 | 204 | fi |
ohair@494 | 205 | AC_MSG_ERROR([Cannot locate the the path of $1]) |
ohair@494 | 206 | fi |
ohair@494 | 207 | fi |
ohair@494 | 208 | |
ohair@494 | 209 | # Cygwin tries to hide some aspects of the Windows file system, such that binaries are |
ohair@494 | 210 | # named .exe but called without that suffix. Therefore, "foo" and "foo.exe" are considered |
ohair@494 | 211 | # the same file, most of the time (as in "test -f"). But not when running cygpath -s, then |
ohair@494 | 212 | # "foo.exe" is OK but "foo" is an error. |
ohair@494 | 213 | # |
ohair@494 | 214 | # This test is therefore slightly more accurate than "test -f" to check for file precense. |
ohair@494 | 215 | # It is also a way to make sure we got the proper file name for the real test later on. |
ohair@494 | 216 | test_shortpath=`$CYGPATH -s -m "$new_path" 2> /dev/null` |
ohair@494 | 217 | if test "x$test_shortpath" = x; then |
ohair@494 | 218 | # Short path failed, file does not exist as specified. |
ohair@494 | 219 | # Try adding .exe or .cmd |
ohair@494 | 220 | if test -f "${new_path}.exe"; then |
ohair@494 | 221 | input_to_shortpath="${new_path}.exe" |
ohair@494 | 222 | elif test -f "${new_path}.cmd"; then |
ohair@494 | 223 | input_to_shortpath="${new_path}.cmd" |
ohair@494 | 224 | else |
ohair@494 | 225 | AC_MSG_NOTICE([The path of $1, which resolves as "$new_path", is invalid.]) |
ohair@494 | 226 | AC_MSG_NOTICE([Neither "$new_path" nor "$new_path.exe/cmd" can be found]) |
ohair@494 | 227 | AC_MSG_ERROR([Cannot locate the the path of $1]) |
ohair@494 | 228 | fi |
ohair@494 | 229 | else |
ohair@494 | 230 | input_to_shortpath="$new_path" |
ohair@494 | 231 | fi |
ohair@494 | 232 | |
ohair@494 | 233 | # Call helper function which possibly converts this using DOS-style short mode. |
ohair@494 | 234 | # If so, the updated path is stored in $new_path. |
ohair@494 | 235 | new_path="$input_to_shortpath" |
ohair@494 | 236 | BASIC_MAKE_WINDOWS_SPACE_SAFE_CYGWIN([$input_to_shortpath]) |
ohair@494 | 237 | # remove trailing .exe if any |
ohair@494 | 238 | new_path="${new_path/%.exe/}" |
ohair@494 | 239 | ]) |
ohair@494 | 240 | |
ohair@494 | 241 | AC_DEFUN([BASIC_FIXUP_EXECUTABLE_MSYS], |
ohair@494 | 242 | [ |
ohair@494 | 243 | # First separate the path from the arguments. This will split at the first |
ohair@494 | 244 | # space. |
ohair@494 | 245 | complete="[$]$1" |
ohair@494 | 246 | path="${complete%% *}" |
ohair@494 | 247 | tmp="$complete EOL" |
ohair@494 | 248 | arguments="${tmp#* }" |
ohair@494 | 249 | |
ohair@494 | 250 | # Input might be given as Windows format, start by converting to |
ohair@494 | 251 | # unix format. |
ohair@494 | 252 | new_path="$path" |
ohair@494 | 253 | BASIC_WINDOWS_REWRITE_AS_UNIX_PATH(new_path) |
ohair@494 | 254 | |
ohair@494 | 255 | # Now try to locate executable using which |
ohair@494 | 256 | new_path=`$WHICH "$new_path" 2> /dev/null` |
ohair@494 | 257 | |
ohair@494 | 258 | if test "x$new_path" = x; then |
ohair@494 | 259 | # Oops. Which didn't find the executable. |
ohair@494 | 260 | # The splitting of arguments from the executable at a space might have been incorrect, |
ohair@494 | 261 | # since paths with space are more likely in Windows. Give it another try with the whole |
ohair@494 | 262 | # argument. |
ohair@494 | 263 | path="$complete" |
ohair@494 | 264 | arguments="EOL" |
ohair@494 | 265 | new_path="$path" |
ohair@494 | 266 | BASIC_WINDOWS_REWRITE_AS_UNIX_PATH(new_path) |
ohair@494 | 267 | |
ohair@494 | 268 | new_path=`$WHICH "$new_path" 2> /dev/null` |
ohair@494 | 269 | |
ohair@494 | 270 | if test "x$new_path" = x; then |
ohair@494 | 271 | # It's still not found. Now this is an unrecoverable error. |
ohair@494 | 272 | AC_MSG_NOTICE([The path of $1, which resolves as "$complete", is not found.]) |
ohair@494 | 273 | has_space=`$ECHO "$complete" | $GREP " "` |
ohair@494 | 274 | if test "x$has_space" != x; then |
ohair@494 | 275 | AC_MSG_NOTICE([You might be mixing spaces in the path and extra arguments, which is not allowed.]) |
ohair@494 | 276 | fi |
ohair@494 | 277 | AC_MSG_ERROR([Cannot locate the the path of $1]) |
ohair@494 | 278 | fi |
ohair@494 | 279 | fi |
ohair@494 | 280 | |
ohair@494 | 281 | # Now new_path has a complete unix path to the binary |
ohair@494 | 282 | if test "x`$ECHO $new_path | $GREP ^/bin/`" != x; then |
ohair@494 | 283 | # Keep paths in /bin as-is, but remove trailing .exe if any |
ohair@494 | 284 | new_path="${new_path/%.exe/}" |
ohair@494 | 285 | # Do not save /bin paths to all_fixpath_prefixes! |
ohair@494 | 286 | else |
ohair@494 | 287 | # Not in mixed or Windows style, start by that. |
ohair@494 | 288 | new_path=`cmd //c echo $new_path` |
ohair@494 | 289 | BASIC_MAKE_WINDOWS_SPACE_SAFE_MSYS([$new_path]) |
ohair@494 | 290 | # Output is in $new_path |
ohair@494 | 291 | BASIC_WINDOWS_REWRITE_AS_UNIX_PATH(new_path) |
ohair@494 | 292 | # remove trailing .exe if any |
ohair@494 | 293 | new_path="${new_path/%.exe/}" |
ohair@494 | 294 | |
ohair@494 | 295 | # Save the first 10 bytes of this path to the storage, so fixpath can work. |
ohair@494 | 296 | all_fixpath_prefixes=("${all_fixpath_prefixes@<:@@@:>@}" "${new_path:0:10}") |
ohair@494 | 297 | fi |
ohair@494 | 298 | ]) |
ohair@494 | 299 | |
ohair@494 | 300 | # Setup basic configuration paths, and platform-specific stuff related to PATHs. |
ohair@494 | 301 | AC_DEFUN([BASIC_CHECK_PATHS_WINDOWS], |
ohair@494 | 302 | [ |
erikj@726 | 303 | SRC_ROOT_LENGTH=`$THEPWDCMD -L|$WC -m` |
ohair@494 | 304 | if test $SRC_ROOT_LENGTH -gt 100; then |
ohair@494 | 305 | AC_MSG_ERROR([Your base path is too long. It is $SRC_ROOT_LENGTH characters long, but only 100 is supported]) |
ohair@494 | 306 | fi |
ohair@494 | 307 | |
ohair@494 | 308 | if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then |
ohair@494 | 309 | AC_MSG_CHECKING([cygwin release]) |
ohair@494 | 310 | CYGWIN_VERSION=`$UNAME -r` |
ohair@494 | 311 | AC_MSG_RESULT([$CYGWIN_VERSION]) |
ohair@494 | 312 | WINDOWS_ENV_VENDOR='cygwin' |
ohair@494 | 313 | WINDOWS_ENV_VERSION="$CYGWIN_VERSION" |
ohair@494 | 314 | |
ohair@494 | 315 | CYGWIN_VERSION_OK=`$ECHO $CYGWIN_VERSION | $GREP ^1.7.` |
ohair@494 | 316 | if test "x$CYGWIN_VERSION_OK" = x; then |
ohair@494 | 317 | AC_MSG_NOTICE([Your cygwin is too old. You are running $CYGWIN_VERSION, but at least cygwin 1.7 is required. Please upgrade.]) |
ohair@494 | 318 | AC_MSG_ERROR([Cannot continue]) |
ohair@494 | 319 | fi |
ohair@494 | 320 | if test "x$CYGPATH" = x; then |
ohair@494 | 321 | AC_MSG_ERROR([Something is wrong with your cygwin installation since I cannot find cygpath.exe in your path]) |
ohair@494 | 322 | fi |
ohair@494 | 323 | AC_MSG_CHECKING([cygwin root directory as unix-style path]) |
ohair@494 | 324 | # The cmd output ends with Windows line endings (CR/LF), the grep command will strip that away |
ohair@494 | 325 | cygwin_winpath_root=`cd / ; cmd /c cd | grep ".*"` |
ohair@494 | 326 | # Force cygpath to report the proper root by including a trailing space, and then stripping it off again. |
ohair@494 | 327 | CYGWIN_ROOT_PATH=`$CYGPATH -u "$cygwin_winpath_root " | $CUT -f 1 -d " "` |
ohair@494 | 328 | AC_MSG_RESULT([$CYGWIN_ROOT_PATH]) |
ohair@494 | 329 | WINDOWS_ENV_ROOT_PATH="$CYGWIN_ROOT_PATH" |
ohair@494 | 330 | test_cygdrive_prefix=`$ECHO $CYGWIN_ROOT_PATH | $GREP ^/cygdrive/` |
ohair@494 | 331 | if test "x$test_cygdrive_prefix" = x; then |
ohair@494 | 332 | AC_MSG_ERROR([Your cygdrive prefix is not /cygdrive. This is currently not supported. Change with mount -c.]) |
ohair@494 | 333 | fi |
ohair@494 | 334 | elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then |
ohair@494 | 335 | AC_MSG_CHECKING([msys release]) |
ohair@494 | 336 | MSYS_VERSION=`$UNAME -r` |
ohair@494 | 337 | AC_MSG_RESULT([$MSYS_VERSION]) |
ohair@494 | 338 | |
ohair@494 | 339 | WINDOWS_ENV_VENDOR='msys' |
ohair@494 | 340 | WINDOWS_ENV_VERSION="$MSYS_VERSION" |
ohair@494 | 341 | |
ohair@494 | 342 | AC_MSG_CHECKING([msys root directory as unix-style path]) |
ohair@494 | 343 | # The cmd output ends with Windows line endings (CR/LF), the grep command will strip that away |
ohair@494 | 344 | MSYS_ROOT_PATH=`cd / ; cmd /c cd | grep ".*"` |
ohair@494 | 345 | BASIC_WINDOWS_REWRITE_AS_UNIX_PATH(MSYS_ROOT_PATH) |
ohair@494 | 346 | AC_MSG_RESULT([$MSYS_ROOT_PATH]) |
ohair@494 | 347 | WINDOWS_ENV_ROOT_PATH="$MSYS_ROOT_PATH" |
ohair@494 | 348 | else |
ohair@494 | 349 | AC_MSG_ERROR([Unknown Windows environment. Neither cygwin nor msys was detected.]) |
ohair@494 | 350 | fi |
ohair@494 | 351 | |
ohair@494 | 352 | # Test if windows or unix (cygwin/msys) find is first in path. |
ohair@494 | 353 | AC_MSG_CHECKING([what kind of 'find' is first on the PATH]) |
ohair@494 | 354 | FIND_BINARY_OUTPUT=`find --version 2>&1` |
ohair@494 | 355 | if test "x`echo $FIND_BINARY_OUTPUT | $GREP GNU`" != x; then |
ohair@494 | 356 | AC_MSG_RESULT([unix style]) |
ohair@494 | 357 | elif test "x`echo $FIND_BINARY_OUTPUT | $GREP FIND`" != x; then |
ohair@494 | 358 | AC_MSG_RESULT([Windows]) |
ohair@494 | 359 | AC_MSG_NOTICE([Your path contains Windows tools (C:\Windows\system32) before your unix (cygwin or msys) tools.]) |
ohair@494 | 360 | AC_MSG_NOTICE([This will not work. Please correct and make sure /usr/bin (or similar) is first in path.]) |
ohair@494 | 361 | AC_MSG_ERROR([Cannot continue]) |
ohair@494 | 362 | else |
ohair@494 | 363 | AC_MSG_RESULT([unknown]) |
ohair@494 | 364 | AC_MSG_WARN([It seems that your find utility is non-standard.]) |
ohair@494 | 365 | fi |
ohair@494 | 366 | ]) |
ohair@494 | 367 | |
ohair@494 | 368 | AC_DEFUN_ONCE([BASIC_COMPILE_FIXPATH], |
ohair@494 | 369 | [ |
ohair@494 | 370 | # When using cygwin or msys, we need a wrapper binary that renames |
ohair@494 | 371 | # /cygdrive/c/ arguments into c:/ arguments and peeks into |
ohair@494 | 372 | # @files and rewrites these too! This wrapper binary is |
ohair@494 | 373 | # called fixpath. |
ohair@494 | 374 | FIXPATH= |
ohair@494 | 375 | if test "x$OPENJDK_BUILD_OS" = xwindows; then |
ohair@494 | 376 | AC_MSG_CHECKING([if fixpath can be created]) |
ohair@494 | 377 | FIXPATH_SRC="$SRC_ROOT/common/src/fixpath.c" |
ohair@494 | 378 | FIXPATH_BIN="$OUTPUT_ROOT/fixpath.exe" |
ohair@494 | 379 | if test "x$OPENJDK_BUILD_OS_ENV" = xwindows.cygwin; then |
ohair@494 | 380 | FIXPATH_SRC=`$CYGPATH -m $FIXPATH_SRC` |
ohair@494 | 381 | FIXPATH_BIN=`$CYGPATH -m $FIXPATH_BIN` |
ohair@494 | 382 | # Important to keep the .exe suffix on Cygwin for Hotspot makefiles |
ohair@494 | 383 | FIXPATH="$OUTPUT_ROOT/fixpath.exe -c" |
ohair@494 | 384 | elif test "x$OPENJDK_BUILD_OS_ENV" = xwindows.msys; then |
ohair@494 | 385 | FIXPATH_SRC=`cmd //c echo $FIXPATH_SRC` |
ohair@494 | 386 | FIXPATH_BIN=`cmd //c echo $FIXPATH_BIN` |
ohair@494 | 387 | |
ohair@494 | 388 | # Take all collected prefixes and turn them into a -m/c/foo@/c/bar@... command line |
ohair@494 | 389 | # @ was chosen as separator to minimize risk of other tools messing around with it |
ohair@494 | 390 | all_unique_prefixes=`echo "${all_fixpath_prefixes@<:@@@:>@}" | tr ' ' '\n' | grep '^/./' | sort | uniq` |
ohair@494 | 391 | fixpath_argument_list=`echo $all_unique_prefixes | tr ' ' '@'` |
ohair@494 | 392 | |
ohair@494 | 393 | FIXPATH="$OUTPUT_ROOT/fixpath -m$fixpath_argument_list" |
ohair@494 | 394 | fi |
ohair@494 | 395 | rm -f $OUTPUT_ROOT/fixpath* |
ohair@494 | 396 | cd $OUTPUT_ROOT |
ohair@494 | 397 | $CC $FIXPATH_SRC -Fe$FIXPATH_BIN > $OUTPUT_ROOT/fixpath1.log 2>&1 |
ohair@494 | 398 | cd $CURDIR |
ohair@494 | 399 | |
ohair@494 | 400 | if test ! -x $OUTPUT_ROOT/fixpath.exe; then |
ohair@494 | 401 | AC_MSG_RESULT([no]) |
ohair@494 | 402 | cat $OUTPUT_ROOT/fixpath1.log |
ohair@494 | 403 | AC_MSG_ERROR([Could not create $OUTPUT_ROOT/fixpath.exe]) |
ohair@494 | 404 | fi |
ohair@494 | 405 | AC_MSG_RESULT([yes]) |
ohair@494 | 406 | AC_MSG_CHECKING([if fixpath.exe works]) |
ohair@494 | 407 | cd $OUTPUT_ROOT |
ohair@494 | 408 | $FIXPATH $CC $SRC_ROOT/common/src/fixpath.c -Fe$OUTPUT_ROOT/fixpath2.exe > $OUTPUT_ROOT/fixpath2.log 2>&1 |
ohair@494 | 409 | cd $CURDIR |
ohair@494 | 410 | if test ! -x $OUTPUT_ROOT/fixpath2.exe; then |
ohair@494 | 411 | AC_MSG_RESULT([no]) |
ohair@494 | 412 | cat $OUTPUT_ROOT/fixpath2.log |
ohair@494 | 413 | AC_MSG_ERROR([fixpath did not work!]) |
ohair@494 | 414 | fi |
ohair@494 | 415 | AC_MSG_RESULT([yes]) |
ohair@494 | 416 | rm -f $OUTPUT_ROOT/fixpath?.??? $OUTPUT_ROOT/fixpath.obj |
ohair@494 | 417 | fi |
ohair@494 | 418 | |
ohair@494 | 419 | AC_SUBST(FIXPATH) |
ohair@494 | 420 | ]) |