common/autoconf/basics_windows.m4

changeset 839
174a54ce39c4
parent 802
9286a6e61291
child 1133
50aaf272884f
child 1395
ff2690c06dd8
equal deleted inserted replaced
838:ec48d637778a 839:174a54ce39c4
143 new_path="$path" 143 new_path="$path"
144 if test "x$has_colon" = x; then 144 if test "x$has_colon" = x; then
145 # Not in mixed or Windows style, start by that. 145 # Not in mixed or Windows style, start by that.
146 new_path=`cmd //c echo $path` 146 new_path=`cmd //c echo $path`
147 fi 147 fi
148 148
149 BASIC_MAKE_WINDOWS_SPACE_SAFE_MSYS([$new_path]) 149 BASIC_MAKE_WINDOWS_SPACE_SAFE_MSYS([$new_path])
150 BASIC_WINDOWS_REWRITE_AS_UNIX_PATH(new_path) 150 BASIC_WINDOWS_REWRITE_AS_UNIX_PATH(new_path)
151 if test "x$path" != "x$new_path"; then 151 if test "x$path" != "x$new_path"; then
152 $1="$new_path" 152 $1="$new_path"
153 AC_MSG_NOTICE([Rewriting $1 to "$new_path"]) 153 AC_MSG_NOTICE([Rewriting $1 to "$new_path"])
173 # Now try to locate executable using which 173 # Now try to locate executable using which
174 new_path=`$WHICH "$new_path" 2> /dev/null` 174 new_path=`$WHICH "$new_path" 2> /dev/null`
175 # bat and cmd files are not always considered executable in cygwin causing which 175 # bat and cmd files are not always considered executable in cygwin causing which
176 # to not find them 176 # to not find them
177 if test "x$new_path" = x \ 177 if test "x$new_path" = x \
178 && test "x`$ECHO \"$path\" | $GREP -i -e \"\\.bat$\" -e \"\\.cmd$\"`" != x \ 178 && test "x`$ECHO \"$path\" | $GREP -i -e \"\\.bat$\" -e \"\\.cmd$\"`" != x \
179 && test "x`$LS \"$path\" 2>/dev/null`" != x; then 179 && test "x`$LS \"$path\" 2>/dev/null`" != x; then
180 new_path=`$CYGPATH -u "$path"` 180 new_path=`$CYGPATH -u "$path"`
181 fi 181 fi
182 if test "x$new_path" = x; then 182 if test "x$new_path" = x; then
183 # Oops. Which didn't find the executable. 183 # Oops. Which didn't find the executable.
184 # The splitting of arguments from the executable at a space might have been incorrect, 184 # The splitting of arguments from the executable at a space might have been incorrect,
189 new_path=`$CYGPATH -u "$path"` 189 new_path=`$CYGPATH -u "$path"`
190 new_path=`$WHICH "$new_path" 2> /dev/null` 190 new_path=`$WHICH "$new_path" 2> /dev/null`
191 # bat and cmd files are not always considered executable in cygwin causing which 191 # bat and cmd files are not always considered executable in cygwin causing which
192 # to not find them 192 # to not find them
193 if test "x$new_path" = x \ 193 if test "x$new_path" = x \
194 && test "x`$ECHO \"$path\" | $GREP -i -e \"\\.bat$\" -e \"\\.cmd$\"`" != x \ 194 && test "x`$ECHO \"$path\" | $GREP -i -e \"\\.bat$\" -e \"\\.cmd$\"`" != x \
195 && test "x`$LS \"$path\" 2>/dev/null`" != x; then 195 && test "x`$LS \"$path\" 2>/dev/null`" != x; then
196 new_path=`$CYGPATH -u "$path"` 196 new_path=`$CYGPATH -u "$path"`
197 fi 197 fi
198 if test "x$new_path" = x; then 198 if test "x$new_path" = x; then
199 # It's still not found. Now this is an unrecoverable error. 199 # It's still not found. Now this is an unrecoverable error.
200 AC_MSG_NOTICE([The path of $1, which resolves as "$complete", is not found.]) 200 AC_MSG_NOTICE([The path of $1, which resolves as "$complete", is not found.])
216 test_shortpath=`$CYGPATH -s -m "$new_path" 2> /dev/null` 216 test_shortpath=`$CYGPATH -s -m "$new_path" 2> /dev/null`
217 if test "x$test_shortpath" = x; then 217 if test "x$test_shortpath" = x; then
218 # Short path failed, file does not exist as specified. 218 # Short path failed, file does not exist as specified.
219 # Try adding .exe or .cmd 219 # Try adding .exe or .cmd
220 if test -f "${new_path}.exe"; then 220 if test -f "${new_path}.exe"; then
221 input_to_shortpath="${new_path}.exe" 221 input_to_shortpath="${new_path}.exe"
222 elif test -f "${new_path}.cmd"; then 222 elif test -f "${new_path}.cmd"; then
223 input_to_shortpath="${new_path}.cmd" 223 input_to_shortpath="${new_path}.cmd"
224 else 224 else
225 AC_MSG_NOTICE([The path of $1, which resolves as "$new_path", is invalid.]) 225 AC_MSG_NOTICE([The path of $1, which resolves as "$new_path", is invalid.])
226 AC_MSG_NOTICE([Neither "$new_path" nor "$new_path.exe/cmd" can be found]) 226 AC_MSG_NOTICE([Neither "$new_path" nor "$new_path.exe/cmd" can be found])
227 AC_MSG_ERROR([Cannot locate the the path of $1]) 227 AC_MSG_ERROR([Cannot locate the the path of $1])
228 fi 228 fi
252 new_path="$path" 252 new_path="$path"
253 BASIC_WINDOWS_REWRITE_AS_UNIX_PATH(new_path) 253 BASIC_WINDOWS_REWRITE_AS_UNIX_PATH(new_path)
254 254
255 # Now try to locate executable using which 255 # Now try to locate executable using which
256 new_path=`$WHICH "$new_path" 2> /dev/null` 256 new_path=`$WHICH "$new_path" 2> /dev/null`
257 257
258 if test "x$new_path" = x; then 258 if test "x$new_path" = x; then
259 # Oops. Which didn't find the executable. 259 # Oops. Which didn't find the executable.
260 # The splitting of arguments from the executable at a space might have been incorrect, 260 # The splitting of arguments from the executable at a space might have been incorrect,
261 # since paths with space are more likely in Windows. Give it another try with the whole 261 # since paths with space are more likely in Windows. Give it another try with the whole
262 # argument. 262 # argument.
263 path="$complete" 263 path="$complete"
264 arguments="EOL" 264 arguments="EOL"
265 new_path="$path" 265 new_path="$path"
266 BASIC_WINDOWS_REWRITE_AS_UNIX_PATH(new_path) 266 BASIC_WINDOWS_REWRITE_AS_UNIX_PATH(new_path)
267 267
268 new_path=`$WHICH "$new_path" 2> /dev/null` 268 new_path=`$WHICH "$new_path" 2> /dev/null`
269 269
270 if test "x$new_path" = x; then 270 if test "x$new_path" = x; then
271 # It's still not found. Now this is an unrecoverable error. 271 # It's still not found. Now this is an unrecoverable error.
272 AC_MSG_NOTICE([The path of $1, which resolves as "$complete", is not found.]) 272 AC_MSG_NOTICE([The path of $1, which resolves as "$complete", is not found.])
273 has_space=`$ECHO "$complete" | $GREP " "` 273 has_space=`$ECHO "$complete" | $GREP " "`
274 if test "x$has_space" != x; then 274 if test "x$has_space" != x; then
300 # Setup basic configuration paths, and platform-specific stuff related to PATHs. 300 # Setup basic configuration paths, and platform-specific stuff related to PATHs.
301 AC_DEFUN([BASIC_CHECK_PATHS_WINDOWS], 301 AC_DEFUN([BASIC_CHECK_PATHS_WINDOWS],
302 [ 302 [
303 SRC_ROOT_LENGTH=`$THEPWDCMD -L|$WC -m` 303 SRC_ROOT_LENGTH=`$THEPWDCMD -L|$WC -m`
304 if test $SRC_ROOT_LENGTH -gt 100; then 304 if test $SRC_ROOT_LENGTH -gt 100; then
305 AC_MSG_ERROR([Your base path is too long. It is $SRC_ROOT_LENGTH characters long, but only 100 is supported]) 305 AC_MSG_ERROR([Your base path is too long. It is $SRC_ROOT_LENGTH characters long, but only 100 is supported])
306 fi 306 fi
307 307
308 if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then 308 if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
309 AC_MSG_CHECKING([cygwin release]) 309 AC_MSG_CHECKING([cygwin release])
310 CYGWIN_VERSION=`$UNAME -r` 310 CYGWIN_VERSION=`$UNAME -r`
311 AC_MSG_RESULT([$CYGWIN_VERSION]) 311 AC_MSG_RESULT([$CYGWIN_VERSION])
312 WINDOWS_ENV_VENDOR='cygwin' 312 WINDOWS_ENV_VENDOR='cygwin'
313 WINDOWS_ENV_VERSION="$CYGWIN_VERSION" 313 WINDOWS_ENV_VERSION="$CYGWIN_VERSION"
314 314
315 CYGWIN_VERSION_OK=`$ECHO $CYGWIN_VERSION | $GREP ^1.7.` 315 CYGWIN_VERSION_OK=`$ECHO $CYGWIN_VERSION | $GREP ^1.7.`
316 if test "x$CYGWIN_VERSION_OK" = x; then 316 if test "x$CYGWIN_VERSION_OK" = x; then
317 AC_MSG_NOTICE([Your cygwin is too old. You are running $CYGWIN_VERSION, but at least cygwin 1.7 is required. Please upgrade.]) 317 AC_MSG_NOTICE([Your cygwin is too old. You are running $CYGWIN_VERSION, but at least cygwin 1.7 is required. Please upgrade.])
318 AC_MSG_ERROR([Cannot continue]) 318 AC_MSG_ERROR([Cannot continue])
319 fi 319 fi
320 if test "x$CYGPATH" = x; then 320 if test "x$CYGPATH" = x; then
321 AC_MSG_ERROR([Something is wrong with your cygwin installation since I cannot find cygpath.exe in your path]) 321 AC_MSG_ERROR([Something is wrong with your cygwin installation since I cannot find cygpath.exe in your path])
322 fi 322 fi
323 AC_MSG_CHECKING([cygwin root directory as unix-style path]) 323 AC_MSG_CHECKING([cygwin root directory as unix-style path])
324 # The cmd output ends with Windows line endings (CR/LF), the grep command will strip that away 324 # The cmd output ends with Windows line endings (CR/LF), the grep command will strip that away
325 cygwin_winpath_root=`cd / ; cmd /c cd | grep ".*"` 325 cygwin_winpath_root=`cd / ; cmd /c cd | grep ".*"`
326 # Force cygpath to report the proper root by including a trailing space, and then stripping it off again. 326 # Force cygpath to report the proper root by including a trailing space, and then stripping it off again.
327 CYGWIN_ROOT_PATH=`$CYGPATH -u "$cygwin_winpath_root " | $CUT -f 1 -d " "` 327 CYGWIN_ROOT_PATH=`$CYGPATH -u "$cygwin_winpath_root " | $CUT -f 1 -d " "`
328 AC_MSG_RESULT([$CYGWIN_ROOT_PATH]) 328 AC_MSG_RESULT([$CYGWIN_ROOT_PATH])
329 WINDOWS_ENV_ROOT_PATH="$CYGWIN_ROOT_PATH" 329 WINDOWS_ENV_ROOT_PATH="$CYGWIN_ROOT_PATH"
330 test_cygdrive_prefix=`$ECHO $CYGWIN_ROOT_PATH | $GREP ^/cygdrive/` 330 test_cygdrive_prefix=`$ECHO $CYGWIN_ROOT_PATH | $GREP ^/cygdrive/`
331 if test "x$test_cygdrive_prefix" = x; then 331 if test "x$test_cygdrive_prefix" = x; then
332 AC_MSG_ERROR([Your cygdrive prefix is not /cygdrive. This is currently not supported. Change with mount -c.]) 332 AC_MSG_ERROR([Your cygdrive prefix is not /cygdrive. This is currently not supported. Change with mount -c.])
333 fi 333 fi
334 elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then 334 elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then
335 AC_MSG_CHECKING([msys release]) 335 AC_MSG_CHECKING([msys release])
336 MSYS_VERSION=`$UNAME -r` 336 MSYS_VERSION=`$UNAME -r`
337 AC_MSG_RESULT([$MSYS_VERSION]) 337 AC_MSG_RESULT([$MSYS_VERSION])
338 338
339 WINDOWS_ENV_VENDOR='msys' 339 WINDOWS_ENV_VENDOR='msys'
340 WINDOWS_ENV_VERSION="$MSYS_VERSION" 340 WINDOWS_ENV_VERSION="$MSYS_VERSION"
341 341
342 AC_MSG_CHECKING([msys root directory as unix-style path]) 342 AC_MSG_CHECKING([msys root directory as unix-style path])
343 # The cmd output ends with Windows line endings (CR/LF), the grep command will strip that away 343 # The cmd output ends with Windows line endings (CR/LF), the grep command will strip that away
365 fi 365 fi
366 ]) 366 ])
367 367
368 AC_DEFUN_ONCE([BASIC_COMPILE_FIXPATH], 368 AC_DEFUN_ONCE([BASIC_COMPILE_FIXPATH],
369 [ 369 [
370 # When using cygwin or msys, we need a wrapper binary that renames 370 # When using cygwin or msys, we need a wrapper binary that renames
371 # /cygdrive/c/ arguments into c:/ arguments and peeks into 371 # /cygdrive/c/ arguments into c:/ arguments and peeks into
372 # @files and rewrites these too! This wrapper binary is 372 # @files and rewrites these too! This wrapper binary is
373 # called fixpath. 373 # called fixpath.
374 FIXPATH= 374 FIXPATH=
375 if test "x$OPENJDK_BUILD_OS" = xwindows; then 375 if test "x$OPENJDK_BUILD_OS" = xwindows; then
376 AC_MSG_CHECKING([if fixpath can be created]) 376 AC_MSG_CHECKING([if fixpath can be created])
377 FIXPATH_SRC="$SRC_ROOT/common/src/fixpath.c" 377 FIXPATH_SRC="$SRC_ROOT/common/src/fixpath.c"
378 FIXPATH_BIN="$OUTPUT_ROOT/fixpath.exe" 378 FIXPATH_BIN="$OUTPUT_ROOT/fixpath.exe"
379 if test "x$OPENJDK_BUILD_OS_ENV" = xwindows.cygwin; then 379 if test "x$OPENJDK_BUILD_OS_ENV" = xwindows.cygwin; then
380 FIXPATH_SRC=`$CYGPATH -m $FIXPATH_SRC` 380 FIXPATH_SRC=`$CYGPATH -m $FIXPATH_SRC`
387 387
388 # Take all collected prefixes and turn them into a -m/c/foo@/c/bar@... command line 388 # Take all collected prefixes and turn them into a -m/c/foo@/c/bar@... command line
389 # @ was chosen as separator to minimize risk of other tools messing around with it 389 # @ was chosen as separator to minimize risk of other tools messing around with it
390 all_unique_prefixes=`echo "${all_fixpath_prefixes@<:@@@:>@}" | tr ' ' '\n' | grep '^/./' | sort | uniq` 390 all_unique_prefixes=`echo "${all_fixpath_prefixes@<:@@@:>@}" | tr ' ' '\n' | grep '^/./' | sort | uniq`
391 fixpath_argument_list=`echo $all_unique_prefixes | tr ' ' '@'` 391 fixpath_argument_list=`echo $all_unique_prefixes | tr ' ' '@'`
392 392
393 FIXPATH="$OUTPUT_ROOT/fixpath -m$fixpath_argument_list" 393 FIXPATH="$OUTPUT_ROOT/fixpath -m$fixpath_argument_list"
394 fi 394 fi
395 rm -f $OUTPUT_ROOT/fixpath* 395 rm -f $OUTPUT_ROOT/fixpath*
396 cd $OUTPUT_ROOT 396 cd $OUTPUT_ROOT
397 $CC $FIXPATH_SRC -Fe$FIXPATH_BIN > $OUTPUT_ROOT/fixpath1.log 2>&1 397 $CC $FIXPATH_SRC -Fe$FIXPATH_BIN > $OUTPUT_ROOT/fixpath1.log 2>&1
398 cd $CURDIR 398 cd $CURDIR
399 399
400 if test ! -x $OUTPUT_ROOT/fixpath.exe; then 400 if test ! -x $OUTPUT_ROOT/fixpath.exe; then
401 AC_MSG_RESULT([no]) 401 AC_MSG_RESULT([no])
402 cat $OUTPUT_ROOT/fixpath1.log 402 cat $OUTPUT_ROOT/fixpath1.log
403 AC_MSG_ERROR([Could not create $OUTPUT_ROOT/fixpath.exe]) 403 AC_MSG_ERROR([Could not create $OUTPUT_ROOT/fixpath.exe])
404 fi 404 fi
405 AC_MSG_RESULT([yes]) 405 AC_MSG_RESULT([yes])
406 AC_MSG_CHECKING([if fixpath.exe works]) 406 AC_MSG_CHECKING([if fixpath.exe works])
407 cd $OUTPUT_ROOT 407 cd $OUTPUT_ROOT
408 $FIXPATH $CC $SRC_ROOT/common/src/fixpath.c -Fe$OUTPUT_ROOT/fixpath2.exe > $OUTPUT_ROOT/fixpath2.log 2>&1 408 $FIXPATH $CC $SRC_ROOT/common/src/fixpath.c -Fe$OUTPUT_ROOT/fixpath2.exe > $OUTPUT_ROOT/fixpath2.log 2>&1
409 cd $CURDIR 409 cd $CURDIR
410 if test ! -x $OUTPUT_ROOT/fixpath2.exe; then 410 if test ! -x $OUTPUT_ROOT/fixpath2.exe; then
411 AC_MSG_RESULT([no]) 411 AC_MSG_RESULT([no])
412 cat $OUTPUT_ROOT/fixpath2.log 412 cat $OUTPUT_ROOT/fixpath2.log
413 AC_MSG_ERROR([fixpath did not work!]) 413 AC_MSG_ERROR([fixpath did not work!])
414 fi 414 fi
415 AC_MSG_RESULT([yes]) 415 AC_MSG_RESULT([yes])
416 rm -f $OUTPUT_ROOT/fixpath?.??? $OUTPUT_ROOT/fixpath.obj 416 rm -f $OUTPUT_ROOT/fixpath?.??? $OUTPUT_ROOT/fixpath.obj
417 fi 417 fi
418 418
419 AC_SUBST(FIXPATH) 419 AC_SUBST(FIXPATH)
420 ]) 420 ])

mercurial