$NetBSD: patch-ac,v 1.13 2004/10/03 00:13:31 tv Exp $ --- ltmain.sh.orig 2004-09-19 08:34:44.000000000 -0400 +++ ltmain.sh @@ -197,10 +197,26 @@ func_infer_tag () { case $@ in # Blanks in the command may have been stripped by the calling shell, # but not from the CC environment variable when configure was run. - " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*) ;; + " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*) + tagname=CC + ;; # Blanks at the start of $base_compile will cause this to fail # if we don't check for them as well. *) + base_compiler=`$echo $base_compile | awk '{ print $1 }'` + case $base_compiler in + *cc) + tagname=CC + ;; + *++) + tagname=CXX + eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$tagname'$/,/^# ### END LIBTOOL TAG CONFIG: '$tagname'$/p' < $0`" + ;; + esac + ;; + esac + fi + if test -n "$available_tags" && test -z "$tagname"; then for z in $available_tags; do if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then # Evaluate the configuration. @@ -236,8 +252,6 @@ func_infer_tag () { # else # $echo "$modename: using $tagname tagged configuration" fi - ;; - esac fi } @@ -522,7 +536,7 @@ if test -z "$show_help"; then $echo "*** Warning: inferring the mode of operation is deprecated." 1>&2 $echo "*** Future versions of Libtool will require -mode=MODE be specified." 1>&2 case $nonopt in - *cc | cc* | *++ | gcc* | *-gcc* | g++* | xlc*) + *cc | cc* | *++ | gcc* | *-gcc* | g++* | xlc* | *CC) mode=link for arg do @@ -1306,6 +1320,13 @@ EOF exit $EXIT_FAILURE ;; esac + # Canonicalise the pathname + tmp="" + while test "$arg" != "$tmp" + do + tmp=$arg + arg=`$echo "X$arg" | $Xsed -e 's%[^/.][^/.]*/\.\.%%g' -e 's%/\./%/%g' -e 's%//*%/%g' -e 's%/$%%g'` + done if test "$prev" = rpath; then case "$rpath " in *" $arg "*) ;; @@ -3168,6 +3189,7 @@ EOF linux) major=.`expr $current - $age` versuffix="$major.$age.$revision" + versuffix2="$major.$age" ;; osf) @@ -5364,8 +5386,16 @@ relink_command=\"$relink_command\"" exit $EXIT_FAILURE fi - # Strip any trailing slash from the destination. - dest=`$echo "X$dest" | $Xsed -e 's%/$%%'` + # Canonicalise the pathname: + # - remove foo/../ + # - replace // + # - remove /./ + # - strip any trailing / + tmp="" + while test "$dest" != "$tmp"; do + tmp=$dest + dest=`$echo "X$dest" | $Xsed -e 's%[^/.][^/.]*/\.\.%%g' -e 's%/\./%/%g' -e 's%//*%/%g' -e 's%/$%%g'` + done # Check to see that the destination is a directory. test -d "$dest" && isdir=yes