< prev index next >

common/autoconf/basics_windows.m4

Print this page




  49 
  50 # Helper function which possibly converts a path using DOS-style short mode.
  51 # If so, the updated path is stored in $new_path.
  52 # $1: The path to check
  53 AC_DEFUN([BASIC_MAKE_WINDOWS_SPACE_SAFE_CYGWIN],
  54 [
  55   input_path="$1"
  56   # Check if we need to convert this using DOS-style short mode. If the path
  57   # contains just simple characters, use it. Otherwise (spaces, weird characters),
  58   # take no chances and rewrite it.
  59   # Note: m4 eats our [], so we need to use @<:@ and @:>@ instead.
  60   has_forbidden_chars=`$ECHO "$input_path" | $GREP @<:@^-._/a-zA-Z0-9@:>@`
  61   if test "x$has_forbidden_chars" != x; then
  62     # Now convert it to mixed DOS-style, short mode (no spaces, and / instead of \)
  63     shortmode_path=`$CYGPATH -s -m -a "$input_path"`
  64     path_after_shortmode=`$CYGPATH -u "$shortmode_path"`
  65     if test "x$path_after_shortmode" != "x$input_to_shortpath"; then
  66       # Going to short mode and back again did indeed matter. Since short mode is
  67       # case insensitive, let's make it lowercase to improve readability.
  68       shortmode_path=`$ECHO "$shortmode_path" | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
  69       # Now convert it back to Unix-stile (cygpath)
  70       input_path=`$CYGPATH -u "$shortmode_path"`
  71       new_path="$input_path"
  72     fi
  73   fi
  74 
  75   test_cygdrive_prefix=`$ECHO $input_path | $GREP ^/cygdrive/`
  76   if test "x$test_cygdrive_prefix" = x; then
  77     # As a simple fix, exclude /usr/bin since it's not a real path.
  78     if test "x`$ECHO $1 | $GREP ^/usr/bin/`" = x; then
  79       # The path is in a Cygwin special directory (e.g. /home). We need this converted to
  80       # a path prefixed by /cygdrive for fixpath to work.
  81       new_path="$CYGWIN_ROOT_PATH$input_path"
  82     fi
  83   fi
  84 ])
  85 
  86 # Helper function which possibly converts a path using DOS-style short mode.
  87 # If so, the updated path is stored in $new_path.
  88 # $1: The path to check
  89 AC_DEFUN([BASIC_MAKE_WINDOWS_SPACE_SAFE_MSYS],




  49 
  50 # Helper function which possibly converts a path using DOS-style short mode.
  51 # If so, the updated path is stored in $new_path.
  52 # $1: The path to check
  53 AC_DEFUN([BASIC_MAKE_WINDOWS_SPACE_SAFE_CYGWIN],
  54 [
  55   input_path="$1"
  56   # Check if we need to convert this using DOS-style short mode. If the path
  57   # contains just simple characters, use it. Otherwise (spaces, weird characters),
  58   # take no chances and rewrite it.
  59   # Note: m4 eats our [], so we need to use @<:@ and @:>@ instead.
  60   has_forbidden_chars=`$ECHO "$input_path" | $GREP @<:@^-._/a-zA-Z0-9@:>@`
  61   if test "x$has_forbidden_chars" != x; then
  62     # Now convert it to mixed DOS-style, short mode (no spaces, and / instead of \)
  63     shortmode_path=`$CYGPATH -s -m -a "$input_path"`
  64     path_after_shortmode=`$CYGPATH -u "$shortmode_path"`
  65     if test "x$path_after_shortmode" != "x$input_to_shortpath"; then
  66       # Going to short mode and back again did indeed matter. Since short mode is
  67       # case insensitive, let's make it lowercase to improve readability.
  68       shortmode_path=`$ECHO "$shortmode_path" | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
  69       # Now convert it back to Unix-style (cygpath)
  70       input_path=`$CYGPATH -u "$shortmode_path"`
  71       new_path="$input_path"
  72     fi
  73   fi
  74 
  75   test_cygdrive_prefix=`$ECHO $input_path | $GREP ^/cygdrive/`
  76   if test "x$test_cygdrive_prefix" = x; then
  77     # As a simple fix, exclude /usr/bin since it's not a real path.
  78     if test "x`$ECHO $1 | $GREP ^/usr/bin/`" = x; then
  79       # The path is in a Cygwin special directory (e.g. /home). We need this converted to
  80       # a path prefixed by /cygdrive for fixpath to work.
  81       new_path="$CYGWIN_ROOT_PATH$input_path"
  82     fi
  83   fi
  84 ])
  85 
  86 # Helper function which possibly converts a path using DOS-style short mode.
  87 # If so, the updated path is stored in $new_path.
  88 # $1: The path to check
  89 AC_DEFUN([BASIC_MAKE_WINDOWS_SPACE_SAFE_MSYS],


< prev index next >