Gmane
From: Keith MARSHALL <keith.marshall@...>
Subject: Re: Path transformation
Newsgroups: gmane.comp.gnu.mingw.msys
Date: 2005-07-28 12:52:02 GMT (3 years, 48 weeks, 5 days, 17 hours and 27 minutes ago)
> Thank you very much everybody!
> It fits perfectly my needs for my configure.ac.

If you are using this in an autoconf script, you might find my
actual autoconf macro even more useful; (I put it in aclocal.m4,
for each of my projects, so it gets distributed -- it could just
as well go in acsite.m4, for local only use):

<macro name="MSYS_AC_CANONICAL_PATH">
# MSYS_AC_CANONICAL_PATH( VAR, PATHNAME )
# ---------------------------------------
# Set VAR to the canonically resolved absolute equivalent of PATHNAME,
# (which may be a relative path, and need not refer to any existing 
entity).
#
# On Win32-MSYS build hosts, the returned path is resolved to its true
# native Win32 path name, (but with slashes, not backslashes).
#
# On any other system, it is simply the result which would be obtained
# if PATHNAME represented an existing directory, and the pwd command was
# executed in that directory.
#
AC_DEFUN([MSYS_AC_CANONICAL_PATH],
[ac_dir="$2"
 pwd -W >/dev/null 2>&1 && ac_pwd_w="pwd -W" || ac_pwd_w=pwd
 until ac_val=`exec 2>/dev/null; cd "$ac_dir" && $ac_pwd_w`
 do
   ac_dir=`AS_DIRNAME(["$ac_dir"])`
 done
 ac_dir=`echo "$ac_dir" | sed 's?^[[./]]*??'`
 ac_val=`echo "$ac_val" | sed 's?/*$[]??'`
 $1=`echo "$2" | sed "s?^[[./]]*$ac_dir/*?$ac_val/?"'
   s?/*$[]??'`
])
</macro>

Again, take care of the quoting -- the SourceForge archive doesn't
show it correctly!

  -  Backquotes are correct, as shown.
  -  All sed substitutions should be in SINGLE quotes, EXCEPT
     for the first of the pair in the final sed command, which
     MUST be in DOUBLE quotes;  the archive replaces all single
     quotes with double, which breaks the script.
  -  Other than these, DOUBLE quotes are correct.

HTH.

Keith.

-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO September
19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf