common/autoconf/basics_windows.m4

Mon, 29 Jun 2020 21:30:12 +0100

author
andrew
date
Mon, 29 Jun 2020 21:30:12 +0100
changeset 2537
a8da94d779b3
parent 2224
20daa32eec6f
child 2316
64a3eeabf6e5
permissions
-rw-r--r--

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'`
kevinw@2224 69 # Now convert it back to Unix-style (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
ihse@839 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 \
ihse@839 178 && test "x`$ECHO \"$path\" | $GREP -i -e \"\\.bat$\" -e \"\\.cmd$\"`" != x \
ihse@839 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 \
ihse@839 194 && test "x`$ECHO \"$path\" | $GREP -i -e \"\\.bat$\" -e \"\\.cmd$\"`" != x \
ihse@839 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 #
ihse@802 214 # This test is therefore slightly more accurate than "test -f" to check for file presence.
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
ihse@839 221 input_to_shortpath="${new_path}.exe"
ohair@494 222 elif test -f "${new_path}.cmd"; then
ihse@839 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`
ihse@839 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)
ihse@839 267
ohair@494 268 new_path=`$WHICH "$new_path" 2> /dev/null`
kevinw@2219 269 # bat and cmd files are not always considered executable in MSYS causing which
kevinw@2219 270 # to not find them
kevinw@2219 271 if test "x$new_path" = x \
kevinw@2219 272 && test "x`$ECHO \"$path\" | $GREP -i -e \"\\.bat$\" -e \"\\.cmd$\"`" != x \
kevinw@2219 273 && test "x`$LS \"$path\" 2>/dev/null`" != x; then
kevinw@2219 274 new_path="$path"
kevinw@2219 275 BASIC_WINDOWS_REWRITE_AS_UNIX_PATH(new_path)
kevinw@2219 276 fi
ihse@839 277
ohair@494 278 if test "x$new_path" = x; then
ohair@494 279 # It's still not found. Now this is an unrecoverable error.
ohair@494 280 AC_MSG_NOTICE([The path of $1, which resolves as "$complete", is not found.])
ohair@494 281 has_space=`$ECHO "$complete" | $GREP " "`
ohair@494 282 if test "x$has_space" != x; then
ohair@494 283 AC_MSG_NOTICE([You might be mixing spaces in the path and extra arguments, which is not allowed.])
ohair@494 284 fi
ohair@494 285 AC_MSG_ERROR([Cannot locate the the path of $1])
ohair@494 286 fi
ohair@494 287 fi
ohair@494 288
ohair@494 289 # Now new_path has a complete unix path to the binary
ohair@494 290 if test "x`$ECHO $new_path | $GREP ^/bin/`" != x; then
ohair@494 291 # Keep paths in /bin as-is, but remove trailing .exe if any
ohair@494 292 new_path="${new_path/%.exe/}"
ohair@494 293 # Do not save /bin paths to all_fixpath_prefixes!
ohair@494 294 else
ohair@494 295 # Not in mixed or Windows style, start by that.
ohair@494 296 new_path=`cmd //c echo $new_path`
ohair@494 297 BASIC_MAKE_WINDOWS_SPACE_SAFE_MSYS([$new_path])
ohair@494 298 # Output is in $new_path
ohair@494 299 BASIC_WINDOWS_REWRITE_AS_UNIX_PATH(new_path)
ohair@494 300 # remove trailing .exe if any
ohair@494 301 new_path="${new_path/%.exe/}"
ohair@494 302
ohair@494 303 # Save the first 10 bytes of this path to the storage, so fixpath can work.
ohair@494 304 all_fixpath_prefixes=("${all_fixpath_prefixes@<:@@@:>@}" "${new_path:0:10}")
ohair@494 305 fi
ohair@494 306 ])
ohair@494 307
ohair@494 308 # Setup basic configuration paths, and platform-specific stuff related to PATHs.
ohair@494 309 AC_DEFUN([BASIC_CHECK_PATHS_WINDOWS],
ohair@494 310 [
erikj@726 311 SRC_ROOT_LENGTH=`$THEPWDCMD -L|$WC -m`
ohair@494 312 if test $SRC_ROOT_LENGTH -gt 100; then
ihse@839 313 AC_MSG_ERROR([Your base path is too long. It is $SRC_ROOT_LENGTH characters long, but only 100 is supported])
ohair@494 314 fi
ohair@494 315
ohair@494 316 if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
ohair@494 317 AC_MSG_CHECKING([cygwin release])
ohair@494 318 CYGWIN_VERSION=`$UNAME -r`
ohair@494 319 AC_MSG_RESULT([$CYGWIN_VERSION])
ohair@494 320 WINDOWS_ENV_VENDOR='cygwin'
ohair@494 321 WINDOWS_ENV_VERSION="$CYGWIN_VERSION"
ihse@839 322
erikj@1395 323 CYGWIN_VERSION_OLD=`$ECHO $CYGWIN_VERSION | $GREP -e '^1\.[0-6]'`
erikj@1395 324 if test "x$CYGWIN_VERSION_OLD" != x; then
ohair@494 325 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 326 AC_MSG_ERROR([Cannot continue])
ohair@494 327 fi
ohair@494 328 if test "x$CYGPATH" = x; then
ihse@839 329 AC_MSG_ERROR([Something is wrong with your cygwin installation since I cannot find cygpath.exe in your path])
ohair@494 330 fi
ohair@494 331 AC_MSG_CHECKING([cygwin root directory as unix-style path])
kevinw@2210 332 # The cmd output ends with Windows line endings (CR/LF)
kevinw@2210 333 cygwin_winpath_root=`cd / ; cmd /c cd | $TR -d '\r\n'`
ohair@494 334 # Force cygpath to report the proper root by including a trailing space, and then stripping it off again.
ohair@494 335 CYGWIN_ROOT_PATH=`$CYGPATH -u "$cygwin_winpath_root " | $CUT -f 1 -d " "`
ohair@494 336 AC_MSG_RESULT([$CYGWIN_ROOT_PATH])
ohair@494 337 WINDOWS_ENV_ROOT_PATH="$CYGWIN_ROOT_PATH"
ohair@494 338 test_cygdrive_prefix=`$ECHO $CYGWIN_ROOT_PATH | $GREP ^/cygdrive/`
ohair@494 339 if test "x$test_cygdrive_prefix" = x; then
ihse@839 340 AC_MSG_ERROR([Your cygdrive prefix is not /cygdrive. This is currently not supported. Change with mount -c.])
ohair@494 341 fi
ohair@494 342 elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then
ohair@494 343 AC_MSG_CHECKING([msys release])
ohair@494 344 MSYS_VERSION=`$UNAME -r`
ohair@494 345 AC_MSG_RESULT([$MSYS_VERSION])
ihse@839 346
ohair@494 347 WINDOWS_ENV_VENDOR='msys'
ohair@494 348 WINDOWS_ENV_VERSION="$MSYS_VERSION"
ohair@494 349
ohair@494 350 AC_MSG_CHECKING([msys root directory as unix-style path])
ohair@494 351 # The cmd output ends with Windows line endings (CR/LF), the grep command will strip that away
ohair@494 352 MSYS_ROOT_PATH=`cd / ; cmd /c cd | grep ".*"`
ohair@494 353 BASIC_WINDOWS_REWRITE_AS_UNIX_PATH(MSYS_ROOT_PATH)
ohair@494 354 AC_MSG_RESULT([$MSYS_ROOT_PATH])
ohair@494 355 WINDOWS_ENV_ROOT_PATH="$MSYS_ROOT_PATH"
ohair@494 356 else
ohair@494 357 AC_MSG_ERROR([Unknown Windows environment. Neither cygwin nor msys was detected.])
ohair@494 358 fi
ohair@494 359
ohair@494 360 # Test if windows or unix (cygwin/msys) find is first in path.
ohair@494 361 AC_MSG_CHECKING([what kind of 'find' is first on the PATH])
ohair@494 362 FIND_BINARY_OUTPUT=`find --version 2>&1`
ohair@494 363 if test "x`echo $FIND_BINARY_OUTPUT | $GREP GNU`" != x; then
ohair@494 364 AC_MSG_RESULT([unix style])
ohair@494 365 elif test "x`echo $FIND_BINARY_OUTPUT | $GREP FIND`" != x; then
ohair@494 366 AC_MSG_RESULT([Windows])
ohair@494 367 AC_MSG_NOTICE([Your path contains Windows tools (C:\Windows\system32) before your unix (cygwin or msys) tools.])
ohair@494 368 AC_MSG_NOTICE([This will not work. Please correct and make sure /usr/bin (or similar) is first in path.])
ohair@494 369 AC_MSG_ERROR([Cannot continue])
ohair@494 370 else
ohair@494 371 AC_MSG_RESULT([unknown])
ohair@494 372 AC_MSG_WARN([It seems that your find utility is non-standard.])
ohair@494 373 fi
ohair@494 374 ])
ohair@494 375
ohair@494 376 AC_DEFUN_ONCE([BASIC_COMPILE_FIXPATH],
ohair@494 377 [
ihse@839 378 # When using cygwin or msys, we need a wrapper binary that renames
ihse@839 379 # /cygdrive/c/ arguments into c:/ arguments and peeks into
ihse@839 380 # @files and rewrites these too! This wrapper binary is
ihse@839 381 # called fixpath.
ihse@839 382 FIXPATH=
ihse@839 383 if test "x$OPENJDK_BUILD_OS" = xwindows; then
ohair@494 384 AC_MSG_CHECKING([if fixpath can be created])
ohair@494 385 FIXPATH_SRC="$SRC_ROOT/common/src/fixpath.c"
ohair@494 386 FIXPATH_BIN="$OUTPUT_ROOT/fixpath.exe"
ohair@494 387 if test "x$OPENJDK_BUILD_OS_ENV" = xwindows.cygwin; then
ohair@494 388 FIXPATH_SRC=`$CYGPATH -m $FIXPATH_SRC`
ohair@494 389 FIXPATH_BIN=`$CYGPATH -m $FIXPATH_BIN`
ohair@494 390 # Important to keep the .exe suffix on Cygwin for Hotspot makefiles
ohair@494 391 FIXPATH="$OUTPUT_ROOT/fixpath.exe -c"
ohair@494 392 elif test "x$OPENJDK_BUILD_OS_ENV" = xwindows.msys; then
ohair@494 393 FIXPATH_SRC=`cmd //c echo $FIXPATH_SRC`
ohair@494 394 FIXPATH_BIN=`cmd //c echo $FIXPATH_BIN`
ohair@494 395
ohair@494 396 # Take all collected prefixes and turn them into a -m/c/foo@/c/bar@... command line
ohair@494 397 # @ was chosen as separator to minimize risk of other tools messing around with it
ohair@494 398 all_unique_prefixes=`echo "${all_fixpath_prefixes@<:@@@:>@}" | tr ' ' '\n' | grep '^/./' | sort | uniq`
ohair@494 399 fixpath_argument_list=`echo $all_unique_prefixes | tr ' ' '@'`
ihse@839 400
ohair@494 401 FIXPATH="$OUTPUT_ROOT/fixpath -m$fixpath_argument_list"
ohair@494 402 fi
ohair@494 403 rm -f $OUTPUT_ROOT/fixpath*
ohair@494 404 cd $OUTPUT_ROOT
ohair@494 405 $CC $FIXPATH_SRC -Fe$FIXPATH_BIN > $OUTPUT_ROOT/fixpath1.log 2>&1
ohair@494 406 cd $CURDIR
ohair@494 407
ihse@839 408 if test ! -x $OUTPUT_ROOT/fixpath.exe; then
ihse@839 409 AC_MSG_RESULT([no])
ihse@839 410 cat $OUTPUT_ROOT/fixpath1.log
ihse@839 411 AC_MSG_ERROR([Could not create $OUTPUT_ROOT/fixpath.exe])
ohair@494 412 fi
ohair@494 413 AC_MSG_RESULT([yes])
ohair@494 414 AC_MSG_CHECKING([if fixpath.exe works])
ohair@494 415 cd $OUTPUT_ROOT
ihse@839 416 $FIXPATH $CC $SRC_ROOT/common/src/fixpath.c -Fe$OUTPUT_ROOT/fixpath2.exe > $OUTPUT_ROOT/fixpath2.log 2>&1
ohair@494 417 cd $CURDIR
ihse@839 418 if test ! -x $OUTPUT_ROOT/fixpath2.exe; then
ihse@839 419 AC_MSG_RESULT([no])
ihse@839 420 cat $OUTPUT_ROOT/fixpath2.log
ihse@839 421 AC_MSG_ERROR([fixpath did not work!])
ohair@494 422 fi
ohair@494 423 AC_MSG_RESULT([yes])
ohair@494 424 rm -f $OUTPUT_ROOT/fixpath?.??? $OUTPUT_ROOT/fixpath.obj
ihse@839 425 fi
ohair@494 426
ihse@839 427 AC_SUBST(FIXPATH)
ohair@494 428 ])

mercurial