common/autoconf/basics_windows.m4

Thu, 31 Aug 2017 15:40:18 +0800

author
aoqi
date
Thu, 31 Aug 2017 15:40:18 +0800
changeset 1133
50aaf272884f
parent 839
174a54ce39c4
parent 0
75a576e87639
child 1482
8fb429038513
permissions
-rw-r--r--

merge

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

mercurial