From 0e672b6be3f214cf0fd941398b41a2014c4d8921 Mon Sep 17 00:00:00 2001 From: "Gary V. Vaughan" Date: Fri, 27 Nov 1998 16:52:37 +0000 Subject: [PATCH] Added LD path canonicalization. --- ChangeLog | 5 +++++ libtool.m4 | 46 ++++++++++++++++++++++++++++++++++++++++++---- ltconfig.in | 40 ++++++++++++++++++++++++++++++++++++++-- 3 files changed, 85 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index a14f7353..0ae69fb7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,10 @@ 1998-11-27 Gary V. Vaughan + * libtool.m4 (AM_PROG_LD): Cannonicalize the absolute path for the + ld program; The order is funny to provide canonicalization to + paths with '\\' separators as well as '/'. + * ltconfig.in: ditto. + * AUTHORS: Added myself as a co-maintainer. * ltconfig.in (archive_cmds): The `;\' in a compound statement is diff --git a/libtool.m4 b/libtool.m4 index 09cba0c6..0e058d28 100644 --- a/libtool.m4 +++ b/libtool.m4 @@ -189,12 +189,50 @@ if test "$ac_cv_prog_gcc" = yes; then AC_MSG_CHECKING([for ld used by GCC]) ac_prog=`($CC -print-prog-name=ld) 2>&5` case "$ac_prog" in - # Accept absolute paths. + # Accept absolute paths. changequote(,)dnl - /* | [A-Za-z]:\\*) + /* | [A-Za-z]:/*) + # Canonicalize the path of ld + re_direlt='/[^/]*/\.\./' + sub_uncdrive='s%^\([A-Za-z]\):/%//\1/%' changequote([,])dnl - test -z "$LD" && LD="$ac_prog" - ;; + while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do + ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%g"` + done + case "$host_os" in + cygwin*) + # Convert to a UNC path for cygwin + test -z "$LD" && LD=`echo X$ac_prog | $Xsed -e "$sub_uncdrive"` + ;; + *) + test -z "$LD" && LD="$ac_prog" + ;; + esac + ;; + ## + ## FIXME: The code fails later on if we try to use an $LD with + ## '\\' path separators. + ## +changequote(,)dnl + [A-Za-z]:[\\]*) + # Canonicalize the path of ld + re_direlt='\\[^\\]*\\\.\.\(\\\)' + sub_uncdrive='s%^\([A-Za-z]\):\\%//\1/%' +changequote([,])dnl + sub_uncdir='s%\\%/%g' + while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do + ac_prog=`echo $ac_prog| sed "s%$re_direlt%\1%g"` + done + case "$host_os" in + cygwin*) + # Convert to a UNC path for cygwin + test -z "$LD" && LD=`echo X$ac_prog | sed -e 's%^X%%' -e "$sub_uncdrive" -e "$sub_uncdir"` + ;; + *) + test -z "$LD" && LD="$ac_prog" + ;; + esac + ;; "") # If it fails, then pretend we aren't using GCC. ac_prog=ld diff --git a/ltconfig.in b/ltconfig.in index c17fc41b..0ad5f3fa 100755 --- a/ltconfig.in +++ b/ltconfig.in @@ -867,8 +867,44 @@ if test -z "$LD"; then ac_prog=`($CC -print-prog-name=ld) 2>&5` case "$ac_prog" in # Accept absolute paths. - /* | [A-Za-z]:[/\\]*) - test -z "$LD" && LD="$ac_prog" + /* | [A-Za-z]:/*) + re_direlt='/[^/]*/\.\./' + sub_uncdrive='s%^\([A-Za-z]\):/%//\1/%' + # Canonicalize the path of ld + while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do + ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%g"` + done + case "$host_os" in + cygwin*) + # Convert to a UNC path for cygwin + test -z "$LD" && LD=`echo X$ac_prog | $Xsed -e "$sub_uncdrive"` + ;; + *) + test -z "$LD" && LD="$ac_prog" + ;; + esac + ;; + ## + ## FIXME: The code fails later on if we try to use an $LD with + ## '\\' path separators. + ## + [A-Za-z]:[\\]*) + re_direlt='\\[^\\]*\\\.\.\(\\\)' + sub_uncdrive='s%^\([A-Za-z]\):\\%//\1/%' + sub_uncdir='s%\\%/%g' + # Canonicalize the path of ld + while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do + ac_prog=`echo $ac_prog| sed "s%$re_direlt%\1%g"` + done + case "$host_os" in + cygwin*) + # Convert to a UNC path for cygwin + test -z "$LD" && LD=`echo X$ac_prog | $Xsed -e "$sub_uncdrive" -e "$sub_uncdir"` + ;; + *) + test -z "$LD" && LD="$ac_prog" + ;; + esac ;; "") # If it fails, then pretend we are not using GCC.