Re: Fwd: Re: [Mingw-users] Autoconf MSYS_PREFIX_HACK

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, 29 Mar 2005, Keith Marshall wrote:

Below is a message I posted earlier today, on the MinGW-users list at
SourceForge.

The topic relates to getting autoconf generated configure scripts to provide
an appropriate default ${prefix} value, for native Win32 builds of autoconf
managed packages, when using MSYS/MinGW as the build environment.

Dealing with Windows paths from the unixish environment is a real problem. For my package, I use a home-brewed shell script which obtains the actual Windows path based on the Cygwin/MinGW mount and applies the desired amount of backslash escaping to survive any remaining configure script processing.


The problem is not specific to the installation prefix.

I have attached the script for reference.

Bob
======================================
Bob Friesenhahn
bfriesen@xxxxxxxxxxxxxxxxxxx, http://www.simplesystems.org/users/bfriesen/
GraphicsMagick Maintainer,    http://www.GraphicsMagick.org/
#!/bin/sh
# Copyright (C) 2003 GraphicsMagick Group
#
# This program is covered by multiple licenses, which are described in
# Copyright.txt. You should have received a copy of Copyright.txt with this
# package; otherwise see http://www.graphicsmagick.org/www/Copyright.html.
#
# Convert the specified POSIX path to a Windows path under MinGW and Cygwin
# The optional second parameter specifies the level of backslash escaping
# to apply for each Windows backslash position in order to support varying
# levels of variable substitutions in scripts.
#
# Note that Cygwin includes the 'cygpath' utility, which already provides
# path translation capability.
#
# Written by Bob Friesenhahn <bfriesen@xxxxxxxxxxxxxxxxxxx> June 2002
#
arg="$1"
escapes=0
if test -n "$2"
then
  escapes="$2"
fi
if test $escapes -gt 3
then
  echo "$0: escape level must in range 0 - 3"
  exit 1
fi
result=''
length=0
max_length=0
mount | sed -e 's:\\:/:g'  | (
  IFS="\n"
  while read mount_entry
  do
    win_mount_path=`echo "$mount_entry" | sed -e 's: .*::g'`
    unix_mount_path=`echo "$mount_entry" | sed -e 's:.* on ::;s: type .*::'`
    temp=`echo "$arg" | sed -e "s!^$unix_mount_path!$win_mount_path!"`
    if test "$temp" != "$arg"
    then
      candidate="$temp"
      length=${#unix_mount_path}
      if test $length -gt $max_length
      then
        result=$candidate
        max_length=$length
      fi
    fi
  done
  if test -z "$result"
  then
    echo "$0: path \"$arg\" is not mounted"
    exit 1
  fi
  case $escapes in
    0)
     echo "$result" | sed -e 's:/:\\:g'
     ;;
    1)
     echo "$result" | sed -e 's:/:\\\\:g'
     ;;
    2)
     echo "$result" | sed -e 's:/:\\\\\\\\:g'
     ;;
    3)
     echo "$result" | sed -e 's:/:\\\\\\\\\\\\\\\\:g'
     ;;
  esac
  exit 0;
 )
_______________________________________________
Autoconf mailing list
Autoconf@xxxxxxx
http://lists.gnu.org/mailman/listinfo/autoconf

[Index of Archives]     [GCC Help]     [Kernel Discussion]     [RPM Discussion]     [Red Hat Development]     [Yosemite News]     [Linux USB]     [Samba]

  Powered by Linux