annotate common/autoconf/basics_windows.m4 @ 928:c90c89d6f35a

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