build-scripts/ltmain.sh
changeset 1570 a740bca2a1b1
parent 1361 19418e4422cb
child 1611 ec3466b08f17
     1.1 --- a/build-scripts/ltmain.sh	Tue Mar 21 09:51:33 2006 +0000
     1.2 +++ b/build-scripts/ltmain.sh	Tue Mar 21 10:20:44 2006 +0000
     1.3 @@ -1,8 +1,8 @@
     1.4 -# Based on libtool-1.5.8
     1.5 +# Based on libtool-1.5.22
     1.6  # ltmain.sh - Provide generalized library-building support services.
     1.7  # NOTE: Changing this file will not affect anything until you rerun configure.
     1.8  #
     1.9 -# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004
    1.10 +# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005
    1.11  # Free Software Foundation, Inc.
    1.12  # Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
    1.13  #
    1.14 @@ -18,7 +18,7 @@
    1.15  #
    1.16  # You should have received a copy of the GNU General Public License
    1.17  # along with this program; if not, write to the Free Software
    1.18 -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
    1.19 +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
    1.20  #
    1.21  # As a special exception to the GNU General Public License, if you
    1.22  # distribute this file as part of a program that contains a
    1.23 @@ -44,8 +44,8 @@
    1.24  
    1.25  PROGRAM=ltmain.sh
    1.26  PACKAGE=libtool
    1.27 -VERSION=1.5.8
    1.28 -TIMESTAMP=" (1.1220.2.117 2004/08/04 14:12:05)"
    1.29 +VERSION=1.5.22
    1.30 +TIMESTAMP=" (1.1220.2.365 2005/12/18 22:14:06)"
    1.31  
    1.32  # See if we are running on zsh, and set the options which allow our
    1.33  # commands through without removal of \ escapes.
    1.34 @@ -89,14 +89,15 @@
    1.35  Xsed="${SED}"' -e 1s/^X//'
    1.36  sed_quote_subst='s/\([\\`\\"$\\\\]\)/\\\1/g'
    1.37  # test EBCDIC or ASCII
    1.38 -case `echo A|tr A '\301'` in
    1.39 - A) # EBCDIC based system
    1.40 -  SP2NL="tr '\100' '\n'"
    1.41 -  NL2SP="tr '\r\n' '\100\100'"
    1.42 +case `echo X|tr X '\101'` in
    1.43 + A) # ASCII based system
    1.44 +    # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr
    1.45 +  SP2NL='tr \040 \012'
    1.46 +  NL2SP='tr \015\012 \040\040'
    1.47    ;;
    1.48 - *) # Assume ASCII based system
    1.49 -  SP2NL="tr '\040' '\012'"
    1.50 -  NL2SP="tr '\015\012' '\040\040'"
    1.51 + *) # EBCDIC based system
    1.52 +  SP2NL='tr \100 \n'
    1.53 +  NL2SP='tr \r\n \100\100'
    1.54    ;;
    1.55  esac
    1.56  
    1.57 @@ -113,8 +114,9 @@
    1.58  fi
    1.59  
    1.60  # Make sure IFS has a sensible default
    1.61 -: ${IFS=" 	
    1.62 -"}
    1.63 +lt_nl='
    1.64 +'
    1.65 +IFS=" 	$lt_nl"
    1.66  
    1.67  if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
    1.68    $echo "$modename: not configured to build any kind of library" 1>&2
    1.69 @@ -131,6 +133,8 @@
    1.70  show="$echo"
    1.71  show_help=
    1.72  execute_dlfiles=
    1.73 +duplicate_deps=no
    1.74 +preserve_args=
    1.75  lo2o="s/\\.lo\$/.${objext}/"
    1.76  o2lo="s/\\.${objext}\$/.lo/"
    1.77  
    1.78 @@ -138,13 +142,51 @@
    1.79  # Shell function definitions:
    1.80  # This seems to be the best place for them
    1.81  
    1.82 +# func_mktempdir [string]
    1.83 +# Make a temporary directory that won't clash with other running
    1.84 +# libtool processes, and avoids race conditions if possible.  If
    1.85 +# given, STRING is the basename for that directory.
    1.86 +func_mktempdir ()
    1.87 +{
    1.88 +    my_template="${TMPDIR-/tmp}/${1-$progname}"
    1.89 +
    1.90 +    if test "$run" = ":"; then
    1.91 +      # Return a directory name, but don't create it in dry-run mode
    1.92 +      my_tmpdir="${my_template}-$$"
    1.93 +    else
    1.94 +
    1.95 +      # If mktemp works, use that first and foremost
    1.96 +      my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null`
    1.97 +
    1.98 +      if test ! -d "$my_tmpdir"; then
    1.99 +	# Failing that, at least try and use $RANDOM to avoid a race
   1.100 +	my_tmpdir="${my_template}-${RANDOM-0}$$"
   1.101 +
   1.102 +	save_mktempdir_umask=`umask`
   1.103 +	umask 0077
   1.104 +	$mkdir "$my_tmpdir"
   1.105 +	umask $save_mktempdir_umask
   1.106 +      fi
   1.107 +
   1.108 +      # If we're not in dry-run mode, bomb out on failure
   1.109 +      test -d "$my_tmpdir" || {
   1.110 +        $echo "cannot create temporary directory \`$my_tmpdir'" 1>&2
   1.111 +	exit $EXIT_FAILURE
   1.112 +      }
   1.113 +    fi
   1.114 +
   1.115 +    $echo "X$my_tmpdir" | $Xsed
   1.116 +}
   1.117 +
   1.118 +
   1.119  # func_win32_libid arg
   1.120  # return the library type of file 'arg'
   1.121  #
   1.122  # Need a lot of goo to handle *both* DLLs and import libs
   1.123  # Has to be a shell function in order to 'eat' the argument
   1.124  # that is supplied when $file_magic_command is called.
   1.125 -func_win32_libid () {
   1.126 +func_win32_libid ()
   1.127 +{
   1.128    win32_libid_type="unknown"
   1.129    win32_fileres=`file -L $1 2>/dev/null`
   1.130    case $win32_fileres in
   1.131 @@ -155,12 +197,11 @@
   1.132      if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | \
   1.133        $EGREP -e 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then
   1.134        win32_nmres=`eval $NM -f posix -A $1 | \
   1.135 -	sed -n -e '1,100{/ I /{x;/import/!{s/^/import/;h;p;};x;};}'`
   1.136 -      if test "X$win32_nmres" = "Ximport" ; then
   1.137 -        win32_libid_type="x86 archive import"
   1.138 -      else
   1.139 -        win32_libid_type="x86 archive static"
   1.140 -      fi
   1.141 +	$SED -n -e '1,100{/ I /{s,.*,import,;p;q;};}'`
   1.142 +      case $win32_nmres in
   1.143 +      import*)  win32_libid_type="x86 archive import";;
   1.144 +      *)        win32_libid_type="x86 archive static";;
   1.145 +      esac
   1.146      fi
   1.147      ;;
   1.148    *DLL*)
   1.149 @@ -184,7 +225,8 @@
   1.150  # Only attempt this if the compiler in the base compile
   1.151  # command doesn't match the default compiler.
   1.152  # arg is usually of the form 'gcc ...'
   1.153 -func_infer_tag () {
   1.154 +func_infer_tag ()
   1.155 +{
   1.156      if test -n "$available_tags" && test -z "$tagname"; then
   1.157        CC_quoted=
   1.158        for arg in $CC; do
   1.159 @@ -243,8 +285,25 @@
   1.160  }
   1.161  
   1.162  
   1.163 +# func_extract_an_archive dir oldlib
   1.164 +func_extract_an_archive ()
   1.165 +{
   1.166 +    f_ex_an_ar_dir="$1"; shift
   1.167 +    f_ex_an_ar_oldlib="$1"
   1.168 +
   1.169 +    $show "(cd $f_ex_an_ar_dir && $AR x $f_ex_an_ar_oldlib)"
   1.170 +    $run eval "(cd \$f_ex_an_ar_dir && $AR x \$f_ex_an_ar_oldlib)" || exit $?
   1.171 +    if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then
   1.172 +     :
   1.173 +    else
   1.174 +      $echo "$modename: ERROR: object name conflicts: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib" 1>&2
   1.175 +      exit $EXIT_FAILURE
   1.176 +    fi
   1.177 +}
   1.178 +
   1.179  # func_extract_archives gentop oldlib ...
   1.180 -func_extract_archives () {
   1.181 +func_extract_archives ()
   1.182 +{
   1.183      my_gentop="$1"; shift
   1.184      my_oldlibs=${1+"$@"}
   1.185      my_oldobjs=""
   1.186 @@ -275,9 +334,9 @@
   1.187        $run ${rm}r "$my_xdir"
   1.188        $show "$mkdir $my_xdir"
   1.189        $run $mkdir "$my_xdir"
   1.190 -      status=$?
   1.191 -      if test "$status" -ne 0 && test ! -d "$my_xdir"; then
   1.192 -	exit $status
   1.193 +      exit_status=$?
   1.194 +      if test "$exit_status" -ne 0 && test ! -d "$my_xdir"; then
   1.195 +	exit $exit_status
   1.196        fi
   1.197        case $host in
   1.198        *-darwin*)
   1.199 @@ -288,7 +347,7 @@
   1.200  	  cd $my_xdir || exit $?
   1.201  	  darwin_archive=$my_xabs
   1.202  	  darwin_curdir=`pwd`
   1.203 -	  darwin_base_archive=`basename $darwin_archive`
   1.204 +	  darwin_base_archive=`$echo "X$darwin_archive" | $Xsed -e 's%^.*/%%'`
   1.205  	  darwin_arches=`lipo -info "$darwin_archive" 2>/dev/null | $EGREP Architectures 2>/dev/null`
   1.206  	  if test -n "$darwin_arches"; then 
   1.207  	    darwin_arches=`echo "$darwin_arches" | $SED -e 's/.*are://'`
   1.208 @@ -297,64 +356,33 @@
   1.209  	    for darwin_arch in  $darwin_arches ; do
   1.210  	      mkdir -p "unfat-$$/${darwin_base_archive}-${darwin_arch}"
   1.211  	      lipo -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}"
   1.212 -	      # Remove the table of contents from the thin files.
   1.213 -	      $AR -d "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" __.SYMDEF 2>/dev/null || true
   1.214 -	      $AR -d "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" __.SYMDEF\ SORTED 2>/dev/null || true
   1.215  	      cd "unfat-$$/${darwin_base_archive}-${darwin_arch}"
   1.216 -	      $AR -xo "${darwin_base_archive}"
   1.217 -	      rm "${darwin_base_archive}"
   1.218 +	      func_extract_an_archive "`pwd`" "${darwin_base_archive}"
   1.219  	      cd "$darwin_curdir"
   1.220 +	      $rm "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}"
   1.221  	    done # $darwin_arches
   1.222        ## Okay now we have a bunch of thin objects, gotta fatten them up :)
   1.223 -	    darwin_filelist=`find unfat-$$ -type f | xargs basename | sort -u | $NL2SP`
   1.224 +	    darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print| xargs basename | sort -u | $NL2SP`
   1.225  	    darwin_file=
   1.226  	    darwin_files=
   1.227  	    for darwin_file in $darwin_filelist; do
   1.228  	      darwin_files=`find unfat-$$ -name $darwin_file -print | $NL2SP`
   1.229  	      lipo -create -output "$darwin_file" $darwin_files
   1.230  	    done # $darwin_filelist
   1.231 -	    rm -rf unfat-$$
   1.232 +	    ${rm}r unfat-$$
   1.233  	    cd "$darwin_orig_dir"
   1.234  	  else
   1.235 -	    cd $darwin_orig_dir
   1.236 -	    (cd $my_xdir && $AR x $my_xabs) || exit $?
   1.237 +	    cd "$darwin_orig_dir"
   1.238 + 	    func_extract_an_archive "$my_xdir" "$my_xabs"
   1.239  	  fi # $darwin_arches
   1.240  	fi # $run
   1.241 -      ;;
   1.242 +	;;
   1.243        *)
   1.244 -	# We will extract separately just the conflicting names and we will
   1.245 -	# no longer touch any unique names. It is faster to leave these
   1.246 -	# extract automatically by $AR in one run.
   1.247 -	$show "(cd $my_xdir && $AR x $my_xabs)"
   1.248 -	$run eval "(cd \$my_xdir && $AR x \$my_xabs)" || exit $?
   1.249 -	if ($AR t "$my_xabs" | sort | sort -uc >/dev/null 2>&1); then
   1.250 -	  :
   1.251 -	else
   1.252 -	  $echo "$modename: warning: object name conflicts; renaming object files" 1>&2
   1.253 -	  $echo "$modename: warning: to ensure that they will not overwrite" 1>&2
   1.254 -	  $AR t "$my_xabs" | sort | uniq -cd | while read -r count name
   1.255 -	  do
   1.256 -	    i=1
   1.257 -	    while test "$i" -le "$count"
   1.258 -	    do
   1.259 -	      # Put our $i before any first dot (extension)
   1.260 -	      # Never overwrite any file
   1.261 -	      name_to="$name"
   1.262 -	      while test "X$name_to" = "X$name" || test -f "$my_xdir/$name_to"
   1.263 -	      do
   1.264 -		name_to=`$echo "X$name_to" | $Xsed -e "s/\([^.]*\)/\1-$i/"`
   1.265 -	      done
   1.266 -	      $show "(cd $my_xdir && $AR xN $i $my_xabs '$name' && $mv '$name' '$name_to')"
   1.267 -	      $run eval "(cd \$my_xdir && $AR xN $i \$my_xabs '$name' && $mv '$name' '$name_to')" || exit $?
   1.268 -	      i=`expr $i + 1`
   1.269 -	    done
   1.270 -	  done
   1.271 -	fi
   1.272 -	;;
   1.273 +        func_extract_an_archive "$my_xdir" "$my_xabs"
   1.274 +        ;;
   1.275        esac
   1.276        my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP`
   1.277      done
   1.278 -
   1.279      func_extract_archives_result="$my_oldobjs"
   1.280  }
   1.281  # End of Shell function definitions
   1.282 @@ -363,6 +391,8 @@
   1.283  # Darwin sucks
   1.284  eval std_shrext=\"$shrext_cmds\"
   1.285  
   1.286 +disable_libs=no
   1.287 +
   1.288  # Parse our command line options once, thoroughly.
   1.289  while test "$#" -gt 0
   1.290  do
   1.291 @@ -427,10 +457,10 @@
   1.292    --version)
   1.293      $echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP"
   1.294      $echo
   1.295 -    $echo "Copyright (C) 2003  Free Software Foundation, Inc."
   1.296 +    $echo "Copyright (C) 2005  Free Software Foundation, Inc."
   1.297      $echo "This is free software; see the source for copying conditions.  There is NO"
   1.298      $echo "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
   1.299 -    exit $EXIT_SUCCESS
   1.300 +    exit $?
   1.301      ;;
   1.302  
   1.303    --config)
   1.304 @@ -439,7 +469,7 @@
   1.305      for tagname in $taglist; do
   1.306        ${SED} -n -e "/^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$/,/^# ### END LIBTOOL TAG CONFIG: $tagname$/p" < "$progpath"
   1.307      done
   1.308 -    exit $EXIT_SUCCESS
   1.309 +    exit $?
   1.310      ;;
   1.311  
   1.312    --debug)
   1.313 @@ -464,7 +494,7 @@
   1.314      else
   1.315        $echo "disable static libraries"
   1.316      fi
   1.317 -    exit $EXIT_SUCCESS
   1.318 +    exit $?
   1.319      ;;
   1.320  
   1.321    --finish) mode="finish" ;;
   1.322 @@ -479,7 +509,11 @@
   1.323      preserve_args="$preserve_args $arg"
   1.324      ;;
   1.325  
   1.326 -  --tag) prevopt="--tag" prev=tag ;;
   1.327 +  --tag)
   1.328 +    prevopt="--tag"
   1.329 +    prev=tag
   1.330 +    preserve_args="$preserve_args --tag"
   1.331 +    ;;
   1.332    --tag=*)
   1.333      set tag "$optarg" ${1+"$@"}
   1.334      shift
   1.335 @@ -511,6 +545,18 @@
   1.336    exit $EXIT_FAILURE
   1.337  fi
   1.338  
   1.339 +case $disable_libs in
   1.340 +no) 
   1.341 +  ;;
   1.342 +shared)
   1.343 +  build_libtool_libs=no
   1.344 +  build_old_libs=yes
   1.345 +  ;;
   1.346 +static)
   1.347 +  build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac`
   1.348 +  ;;
   1.349 +esac
   1.350 +
   1.351  # If this variable is set in any of the actions, the command in it
   1.352  # will be execed at the end.  This prevents here-documents from being
   1.353  # left over by shells.
   1.354 @@ -521,7 +567,7 @@
   1.355    # Infer the operation mode.
   1.356    if test -z "$mode"; then
   1.357      $echo "*** Warning: inferring the mode of operation is deprecated." 1>&2
   1.358 -    $echo "*** Future versions of Libtool will require -mode=MODE be specified." 1>&2
   1.359 +    $echo "*** Future versions of Libtool will require --mode=MODE be specified." 1>&2
   1.360      case $nonopt in
   1.361      *cc | cc* | *++ | gcc* | *-gcc* | g++* | xlc*)
   1.362        mode=link
   1.363 @@ -587,7 +633,7 @@
   1.364  
   1.365      for arg
   1.366      do
   1.367 -      case "$arg_mode" in
   1.368 +      case $arg_mode in
   1.369        arg  )
   1.370  	# do not "continue".  Instead, add this to base_compile
   1.371  	lastarg="$arg"
   1.372 @@ -669,7 +715,10 @@
   1.373        case $lastarg in
   1.374        # Double-quote args containing other shell metacharacters.
   1.375        # Many Bourne shells cannot handle close brackets correctly
   1.376 -      # in scan sets, so we specify it separately.
   1.377 +      # in scan sets, and some SunOS ksh mistreat backslash-escaping
   1.378 +      # in scan sets (worked around with variable expansion),
   1.379 +      # and furthermore cannot handle '|' '&' '(' ')' in scan sets 
   1.380 +      # at all, so we specify them separately.
   1.381        *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
   1.382  	lastarg="\"$lastarg\""
   1.383  	;;
   1.384 @@ -743,6 +792,14 @@
   1.385        esac
   1.386      done
   1.387  
   1.388 +    qlibobj=`$echo "X$libobj" | $Xsed -e "$sed_quote_subst"`
   1.389 +    case $qlibobj in
   1.390 +      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
   1.391 +	qlibobj="\"$qlibobj\"" ;;
   1.392 +    esac
   1.393 +    test "X$libobj" != "X$qlibobj" \
   1.394 +	&& $echo "X$libobj" | grep '[]~#^*{};<>?"'"'"' 	&()|`$[]' \
   1.395 +	&& $echo "$modename: libobj name \`$libobj' may not contain shell special characters."
   1.396      objname=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
   1.397      xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'`
   1.398      if test "X$xdir" = "X$obj"; then
   1.399 @@ -815,12 +872,17 @@
   1.400  	$run $rm $removelist
   1.401  	exit $EXIT_FAILURE
   1.402        fi
   1.403 -      $echo $srcfile > "$lockfile"
   1.404 +      $echo "$srcfile" > "$lockfile"
   1.405      fi
   1.406  
   1.407      if test -n "$fix_srcfile_path"; then
   1.408        eval srcfile=\"$fix_srcfile_path\"
   1.409      fi
   1.410 +    qsrcfile=`$echo "X$srcfile" | $Xsed -e "$sed_quote_subst"`
   1.411 +    case $qsrcfile in
   1.412 +      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
   1.413 +      qsrcfile="\"$qsrcfile\"" ;;
   1.414 +    esac
   1.415  
   1.416      $run $rm "$libobj" "${libobj}T"
   1.417  
   1.418 @@ -842,18 +904,18 @@
   1.419        fbsd_hideous_sh_bug=$base_compile
   1.420  
   1.421        if test "$pic_mode" != no; then
   1.422 -	command="$base_compile $srcfile $pic_flag"
   1.423 +	command="$base_compile $qsrcfile $pic_flag"
   1.424        else
   1.425  	# Don't build PIC code
   1.426 -	command="$base_compile $srcfile"
   1.427 +	command="$base_compile $qsrcfile"
   1.428        fi
   1.429  
   1.430        if test ! -d "${xdir}$objdir"; then
   1.431  	$show "$mkdir ${xdir}$objdir"
   1.432  	$run $mkdir ${xdir}$objdir
   1.433 -	status=$?
   1.434 -	if test "$status" -ne 0 && test ! -d "${xdir}$objdir"; then
   1.435 -	  exit $status
   1.436 +	exit_status=$?
   1.437 +	if test "$exit_status" -ne 0 && test ! -d "${xdir}$objdir"; then
   1.438 +	  exit $exit_status
   1.439  	fi
   1.440        fi
   1.441  
   1.442 @@ -925,9 +987,9 @@
   1.443      if test "$build_old_libs" = yes; then
   1.444        if test "$pic_mode" != yes; then
   1.445  	# Don't build PIC code
   1.446 -	command="$base_compile $srcfile"
   1.447 +	command="$base_compile $qsrcfile"
   1.448        else
   1.449 -	command="$base_compile $srcfile $pic_flag"
   1.450 +	command="$base_compile $qsrcfile $pic_flag"
   1.451        fi
   1.452        if test "$compiler_c_o" = yes; then
   1.453  	command="$command -o $obj"
   1.454 @@ -1056,6 +1118,7 @@
   1.455      no_install=no
   1.456      objs=
   1.457      non_pic_objects=
   1.458 +    notinst_path= # paths that contain not-installed libtool libraries
   1.459      precious_files_regex=
   1.460      prefer_static_libs=no
   1.461      preload=no
   1.462 @@ -1084,14 +1147,15 @@
   1.463  	  if test -n "$link_static_flag"; then
   1.464  	    dlopen_self=$dlopen_self_static
   1.465  	  fi
   1.466 +	  prefer_static_libs=yes
   1.467  	else
   1.468  	  if test -z "$pic_flag" && test -n "$link_static_flag"; then
   1.469  	    dlopen_self=$dlopen_self_static
   1.470  	  fi
   1.471 +	  prefer_static_libs=built
   1.472  	fi
   1.473  	build_libtool_libs=no
   1.474  	build_old_libs=yes
   1.475 -	prefer_static_libs=yes
   1.476  	break
   1.477  	;;
   1.478        esac
   1.479 @@ -1266,6 +1330,11 @@
   1.480  		  if test -z "$pic_object" || test "$pic_object" = none ; then
   1.481  		    arg="$non_pic_object"
   1.482  		  fi
   1.483 +		else
   1.484 +		  # If the PIC object exists, use it instead.
   1.485 +		  # $xdir was prepended to $pic_object above.
   1.486 +		  non_pic_object="$pic_object"
   1.487 +		  non_pic_objects="$non_pic_objects $non_pic_object"
   1.488  		fi
   1.489  	      else
   1.490  		# Only an error if not doing a dry-run.
   1.491 @@ -1362,6 +1431,13 @@
   1.492  	  prev=
   1.493  	  continue
   1.494  	  ;;
   1.495 +	darwin_framework|darwin_framework_skip)
   1.496 +	  test "$prev" = "darwin_framework" && compiler_flags="$compiler_flags $arg"
   1.497 +	  compile_command="$compile_command $arg"
   1.498 +	  finalize_command="$finalize_command $arg"
   1.499 +	  prev=
   1.500 +	  continue
   1.501 +	  ;;
   1.502  	*)
   1.503  	  eval "$prev=\"\$arg\""
   1.504  	  prev=
   1.505 @@ -1420,6 +1496,18 @@
   1.506  	continue
   1.507  	;;
   1.508  
   1.509 +      -framework|-arch|-isysroot)
   1.510 +	case " $CC " in
   1.511 +	  *" ${arg} ${1} "* | *" ${arg}	${1} "*) 
   1.512 +		prev=darwin_framework_skip ;;
   1.513 +	  *) compiler_flags="$compiler_flags $arg"
   1.514 +	     prev=darwin_framework ;;
   1.515 +	esac
   1.516 +	compile_command="$compile_command $arg"
   1.517 +	finalize_command="$finalize_command $arg"
   1.518 +	continue
   1.519 +	;;
   1.520 +
   1.521        -inst-prefix-dir)
   1.522  	prev=inst_prefix
   1.523  	continue
   1.524 @@ -1446,7 +1534,8 @@
   1.525  	  absdir=`cd "$dir" && pwd`
   1.526  	  if test -z "$absdir"; then
   1.527  	    $echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2
   1.528 -	    exit $EXIT_FAILURE
   1.529 +	    absdir="$dir"
   1.530 +	    notinst_path="$notinst_path $dir"
   1.531  	  fi
   1.532  	  dir="$absdir"
   1.533  	  ;;
   1.534 @@ -1460,10 +1549,15 @@
   1.535  	esac
   1.536  	case $host in
   1.537  	*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
   1.538 +	  testbindir=`$echo "X$dir" | $Xsed -e 's*/lib$*/bin*'`
   1.539  	  case :$dllsearchpath: in
   1.540  	  *":$dir:"*) ;;
   1.541  	  *) dllsearchpath="$dllsearchpath:$dir";;
   1.542  	  esac
   1.543 +	  case :$dllsearchpath: in
   1.544 +	  *":$testbindir:"*) ;;
   1.545 +	  *) dllsearchpath="$dllsearchpath:$testbindir";;
   1.546 +	  esac
   1.547  	  ;;
   1.548  	esac
   1.549  	continue
   1.550 @@ -1472,15 +1566,15 @@
   1.551        -l*)
   1.552  	if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then
   1.553  	  case $host in
   1.554 -	  *-*-cygwin* | *-*-pw32* | *-*-beos*)
   1.555 +	  *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos*)
   1.556  	    # These systems don't actually have a C or math library (as such)
   1.557  	    continue
   1.558  	    ;;
   1.559 -	  *-*-mingw* | *-*-os2*)
   1.560 +	  *-*-os2*)
   1.561  	    # These systems don't actually have a C library (as such)
   1.562  	    test "X$arg" = "X-lc" && continue
   1.563  	    ;;
   1.564 -	  *-*-openbsd* | *-*-freebsd*)
   1.565 +	  *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
   1.566  	    # Do not include libc due to us having libc/libc_r.
   1.567  	    test "X$arg" = "X-lc" && continue
   1.568  	    ;;
   1.569 @@ -1488,10 +1582,19 @@
   1.570  	    # Rhapsody C and math libraries are in the System framework
   1.571  	    deplibs="$deplibs -framework System"
   1.572  	    continue
   1.573 +	    ;;
   1.574 +	  *-*-sco3.2v5* | *-*-sco5v6*)
   1.575 +	    # Causes problems with __ctype
   1.576 +	    test "X$arg" = "X-lc" && continue
   1.577 +	    ;;
   1.578 +	  *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
   1.579 +	    # Compiler inserts libc in the correct place for threads to work
   1.580 +	    test "X$arg" = "X-lc" && continue
   1.581 +	    ;;
   1.582  	  esac
   1.583  	elif test "X$arg" = "X-lc_r"; then
   1.584  	 case $host in
   1.585 -	 *-*-openbsd* | *-*-freebsd*)
   1.586 +	 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
   1.587  	   # Do not include libc_r directly, use -pthread flag.
   1.588  	   continue
   1.589  	   ;;
   1.590 @@ -1501,8 +1604,20 @@
   1.591  	continue
   1.592  	;;
   1.593  
   1.594 +      # Tru64 UNIX uses -model [arg] to determine the layout of C++
   1.595 +      # classes, name mangling, and exception handling.
   1.596 +      -model)
   1.597 +	compile_command="$compile_command $arg"
   1.598 +	compiler_flags="$compiler_flags $arg"
   1.599 +	finalize_command="$finalize_command $arg"
   1.600 +	prev=xcompiler
   1.601 +	continue
   1.602 +	;;
   1.603 +
   1.604       -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe)
   1.605 -	deplibs="$deplibs $arg"
   1.606 +	compiler_flags="$compiler_flags $arg"
   1.607 +	compile_command="$compile_command $arg"
   1.608 +	finalize_command="$finalize_command $arg"
   1.609  	continue
   1.610  	;;
   1.611  
   1.612 @@ -1511,13 +1626,19 @@
   1.613  	continue
   1.614  	;;
   1.615  
   1.616 -      # gcc -m* arguments should be passed to the linker via $compiler_flags
   1.617 -      # in order to pass architecture information to the linker
   1.618 -      # (e.g. 32 vs 64-bit).  This may also be accomplished via -Wl,-mfoo
   1.619 -      # but this is not reliable with gcc because gcc may use -mfoo to
   1.620 -      # select a different linker, different libraries, etc, while
   1.621 -      # -Wl,-mfoo simply passes -mfoo to the linker.
   1.622 -      -m*)
   1.623 +      # -64, -mips[0-9] enable 64-bit mode on the SGI compiler
   1.624 +      # -r[0-9][0-9]* specifies the processor on the SGI compiler
   1.625 +      # -xarch=*, -xtarget=* enable 64-bit mode on the Sun compiler
   1.626 +      # +DA*, +DD* enable 64-bit mode on the HP compiler
   1.627 +      # -q* pass through compiler args for the IBM compiler
   1.628 +      # -m* pass through architecture-specific compiler args for GCC
   1.629 +      # -m*, -t[45]*, -txscale* pass through architecture-specific
   1.630 +      # compiler args for GCC
   1.631 +      # -pg pass through profiling flag for GCC
   1.632 +      # @file GCC response files
   1.633 +      -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*|-pg| \
   1.634 +      -t[45]*|-txscale*|@*)
   1.635 +
   1.636  	# Unknown arguments in both finalize_command and compile_command need
   1.637  	# to be aesthetically quoted because they are evaled later.
   1.638  	arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
   1.639 @@ -1528,9 +1649,7 @@
   1.640  	esac
   1.641          compile_command="$compile_command $arg"
   1.642          finalize_command="$finalize_command $arg"
   1.643 -        if test "$with_gcc" = "yes" ; then
   1.644 -          compiler_flags="$compiler_flags $arg"
   1.645 -        fi
   1.646 +        compiler_flags="$compiler_flags $arg"
   1.647          continue
   1.648          ;;
   1.649  
   1.650 @@ -1773,6 +1892,11 @@
   1.651  	    if test -z "$pic_object" || test "$pic_object" = none ; then
   1.652  	      arg="$non_pic_object"
   1.653  	    fi
   1.654 +	  else
   1.655 +	    # If the PIC object exists, use it instead.
   1.656 +	    # $xdir was prepended to $pic_object above.
   1.657 +	    non_pic_object="$pic_object"
   1.658 +	    non_pic_objects="$non_pic_objects $non_pic_object"
   1.659  	  fi
   1.660  	else
   1.661  	  # Only an error if not doing a dry-run.
   1.662 @@ -1878,9 +2002,9 @@
   1.663      if test ! -d "$output_objdir"; then
   1.664        $show "$mkdir $output_objdir"
   1.665        $run $mkdir $output_objdir
   1.666 -      status=$?
   1.667 -      if test "$status" -ne 0 && test ! -d "$output_objdir"; then
   1.668 -	exit $status
   1.669 +      exit_status=$?
   1.670 +      if test "$exit_status" -ne 0 && test ! -d "$output_objdir"; then
   1.671 +	exit $exit_status
   1.672        fi
   1.673      fi
   1.674  
   1.675 @@ -1943,7 +2067,6 @@
   1.676      newlib_search_path=
   1.677      need_relink=no # whether we're linking any uninstalled libtool libraries
   1.678      notinst_deplibs= # not-installed libtool libraries
   1.679 -    notinst_path= # paths that contain not-installed libtool libraries
   1.680      case $linkmode in
   1.681      lib)
   1.682  	passes="conv link"
   1.683 @@ -1995,7 +2118,7 @@
   1.684  	    compile_deplibs="$deplib $compile_deplibs"
   1.685  	    finalize_deplibs="$deplib $finalize_deplibs"
   1.686  	  else
   1.687 -	    deplibs="$deplib $deplibs"
   1.688 +	    compiler_flags="$compiler_flags $deplib"
   1.689  	  fi
   1.690  	  continue
   1.691  	  ;;
   1.692 @@ -2004,10 +2127,6 @@
   1.693  	    $echo "$modename: warning: \`-l' is ignored for archives/objects" 1>&2
   1.694  	    continue
   1.695  	  fi
   1.696 -	  if test "$pass" = conv; then
   1.697 -	    deplibs="$deplib $deplibs"
   1.698 -	    continue
   1.699 -	  fi
   1.700  	  name=`$echo "X$deplib" | $Xsed -e 's/^-l//'`
   1.701  	  for searchdir in $newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path; do
   1.702  	    for search_ext in .la $std_shrext .so .a; do
   1.703 @@ -2195,7 +2314,7 @@
   1.704  	esac # case $deplib
   1.705  	if test "$found" = yes || test -f "$lib"; then :
   1.706  	else
   1.707 -	  $echo "$modename: cannot find the library \`$lib'" 1>&2
   1.708 +	  $echo "$modename: cannot find the library \`$lib' or unhandled argument \`$deplib'" 1>&2
   1.709  	  exit $EXIT_FAILURE
   1.710  	fi
   1.711  
   1.712 @@ -2219,6 +2338,8 @@
   1.713  	# it will not redefine variables installed, or shouldnotlink
   1.714  	installed=yes
   1.715  	shouldnotlink=no
   1.716 +	avoidtemprpath=
   1.717 +
   1.718  
   1.719  	# Read the .la file
   1.720  	case $lib in
   1.721 @@ -2324,6 +2445,7 @@
   1.722  	    dir="$libdir"
   1.723  	    absdir="$libdir"
   1.724  	  fi
   1.725 +	  test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes
   1.726  	else
   1.727  	  if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then
   1.728  	    dir="$ladir"
   1.729 @@ -2408,12 +2530,12 @@
   1.730  	  if test -n "$library_names" &&
   1.731  	     { test "$prefer_static_libs" = no || test -z "$old_library"; }; then
   1.732  	    # We need to hardcode the library path
   1.733 -	    if test -n "$shlibpath_var"; then
   1.734 +	    if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then
   1.735  	      # Make sure the rpath contains only unique directories.
   1.736  	      case "$temp_rpath " in
   1.737  	      *" $dir "*) ;;
   1.738  	      *" $absdir "*) ;;
   1.739 -	      *) temp_rpath="$temp_rpath $dir" ;;
   1.740 +	      *) temp_rpath="$temp_rpath $absdir" ;;
   1.741  	      esac
   1.742  	    fi
   1.743  
   1.744 @@ -2450,8 +2572,12 @@
   1.745  	fi
   1.746  
   1.747  	link_static=no # Whether the deplib will be linked statically
   1.748 +	use_static_libs=$prefer_static_libs
   1.749 +	if test "$use_static_libs" = built && test "$installed" = yes ; then
   1.750 +	  use_static_libs=no
   1.751 +	fi
   1.752  	if test -n "$library_names" &&
   1.753 -	   { test "$prefer_static_libs" = no || test -z "$old_library"; }; then
   1.754 +	   { test "$use_static_libs" = no || test -z "$old_library"; }; then
   1.755  	  if test "$installed" = no; then
   1.756  	    notinst_deplibs="$notinst_deplibs $lib"
   1.757  	    need_relink=yes
   1.758 @@ -2564,11 +2690,15 @@
   1.759  	      if test "$hardcode_direct" = no; then
   1.760  		add="$dir/$linklib"
   1.761  		case $host in
   1.762 -		  *-*-sco3.2v5* ) add_dir="-L$dir" ;;
   1.763 +		  *-*-sco3.2v5.0.[024]*) add_dir="-L$dir" ;;
   1.764 +		  *-*-sysv4*uw2*) add_dir="-L$dir" ;;
   1.765 +		  *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \
   1.766 +		    *-*-unixware7*) add_dir="-L$dir" ;;
   1.767  		  *-*-darwin* )
   1.768  		    # if the lib is a module then we can not link against
   1.769  		    # it, someone is ignoring the new warnings I added
   1.770 -		    if /usr/bin/file -L $add 2> /dev/null | $EGREP "bundle" >/dev/null ; then
   1.771 +		    if /usr/bin/file -L $add 2> /dev/null |
   1.772 +                      $EGREP ": [^:]* bundle" >/dev/null ; then
   1.773  		      $echo "** Warning, lib $linklib is a module, not a shared library"
   1.774  		      if test -z "$old_library" ; then
   1.775  		        $echo
   1.776 @@ -2599,7 +2729,7 @@
   1.777  		add_dir="-L$dir"
   1.778  		# Try looking first in the location we're being installed to.
   1.779  		if test -n "$inst_prefix_dir"; then
   1.780 -		  case "$libdir" in
   1.781 +		  case $libdir in
   1.782  		    [\\/]*)
   1.783  		      add_dir="$add_dir -L$inst_prefix_dir$libdir"
   1.784  		      ;;
   1.785 @@ -2672,7 +2802,7 @@
   1.786  	      add_dir="-L$libdir"
   1.787  	      # Try looking first in the location we're being installed to.
   1.788  	      if test -n "$inst_prefix_dir"; then
   1.789 -		case "$libdir" in
   1.790 +		case $libdir in
   1.791  		  [\\/]*)
   1.792  		    add_dir="$add_dir -L$inst_prefix_dir$libdir"
   1.793  		    ;;
   1.794 @@ -2733,8 +2863,6 @@
   1.795  	      fi
   1.796  	    fi
   1.797  	  else
   1.798 -	    convenience="$convenience $dir/$old_library"
   1.799 -	    old_convenience="$old_convenience $dir/$old_library"
   1.800  	    deplibs="$dir/$old_library $deplibs"
   1.801  	    link_static=yes
   1.802  	  fi
   1.803 @@ -2859,13 +2987,13 @@
   1.804  	      *) continue ;;
   1.805  	      esac
   1.806  	      case " $deplibs " in
   1.807 +	      *" $path "*) ;;
   1.808 +	      *) deplibs="$path $deplibs" ;;
   1.809 +	      esac
   1.810 +	      case " $deplibs " in
   1.811  	      *" $depdepl "*) ;;
   1.812  	      *) deplibs="$depdepl $deplibs" ;;
   1.813  	      esac
   1.814 -	      case " $deplibs " in
   1.815 -	      *" $path "*) ;;
   1.816 -	      *) deplibs="$deplibs $path" ;;
   1.817 -	      esac
   1.818  	    done
   1.819  	  fi # link_all_deplibs != no
   1.820  	fi # linkmode = lib
   1.821 @@ -3129,27 +3257,27 @@
   1.822  
   1.823  	# Check that each of the things are valid numbers.
   1.824  	case $current in
   1.825 -	0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;;
   1.826 +	0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;;
   1.827  	*)
   1.828 -	  $echo "$modename: CURRENT \`$current' is not a nonnegative integer" 1>&2
   1.829 +	  $echo "$modename: CURRENT \`$current' must be a nonnegative integer" 1>&2
   1.830  	  $echo "$modename: \`$vinfo' is not valid version information" 1>&2
   1.831  	  exit $EXIT_FAILURE
   1.832  	  ;;
   1.833  	esac
   1.834  
   1.835  	case $revision in
   1.836 -	0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;;
   1.837 +	0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;;
   1.838  	*)
   1.839 -	  $echo "$modename: REVISION \`$revision' is not a nonnegative integer" 1>&2
   1.840 +	  $echo "$modename: REVISION \`$revision' must be a nonnegative integer" 1>&2
   1.841  	  $echo "$modename: \`$vinfo' is not valid version information" 1>&2
   1.842  	  exit $EXIT_FAILURE
   1.843  	  ;;
   1.844  	esac
   1.845  
   1.846  	case $age in
   1.847 -	0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;;
   1.848 +	0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;;
   1.849  	*)
   1.850 -	  $echo "$modename: AGE \`$age' is not a nonnegative integer" 1>&2
   1.851 +	  $echo "$modename: AGE \`$age' must be a nonnegative integer" 1>&2
   1.852  	  $echo "$modename: \`$vinfo' is not valid version information" 1>&2
   1.853  	  exit $EXIT_FAILURE
   1.854  	  ;;
   1.855 @@ -3328,9 +3456,9 @@
   1.856  
   1.857        # Eliminate all temporary directories.
   1.858        for path in $notinst_path; do
   1.859 -	lib_search_path=`$echo "$lib_search_path " | ${SED} -e 's% $path % %g'`
   1.860 -	deplibs=`$echo "$deplibs " | ${SED} -e 's% -L$path % %g'`
   1.861 -	dependency_libs=`$echo "$dependency_libs " | ${SED} -e 's% -L$path % %g'`
   1.862 +	lib_search_path=`$echo "$lib_search_path " | ${SED} -e "s% $path % %g"`
   1.863 +	deplibs=`$echo "$deplibs " | ${SED} -e "s% -L$path % %g"`
   1.864 +	dependency_libs=`$echo "$dependency_libs " | ${SED} -e "s% -L$path % %g"`
   1.865        done
   1.866  
   1.867        if test -n "$xrpath"; then
   1.868 @@ -3381,9 +3509,14 @@
   1.869  	  *-*-netbsd*)
   1.870  	    # Don't link with libc until the a.out ld.so is fixed.
   1.871  	    ;;
   1.872 -	  *-*-openbsd* | *-*-freebsd*)
   1.873 +	  *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
   1.874  	    # Do not include libc due to us having libc/libc_r.
   1.875 -	    test "X$arg" = "X-lc" && continue
   1.876 +	    ;;
   1.877 +	  *-*-sco3.2v5* | *-*-sco5v6*)
   1.878 +	    # Causes problems with __ctype
   1.879 +	    ;;
   1.880 +	  *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
   1.881 +	    # Compiler inserts libc in the correct place for threads to work
   1.882  	    ;;
   1.883   	  *)
   1.884  	    # Add libc to deplibs on all other systems if necessary.
   1.885 @@ -3427,11 +3560,11 @@
   1.886  	  int main() { return 0; }
   1.887  EOF
   1.888  	  $rm conftest
   1.889 -	  $LTCC -o conftest conftest.c $deplibs
   1.890 +	  $LTCC $LTCFLAGS -o conftest conftest.c $deplibs
   1.891  	  if test "$?" -eq 0 ; then
   1.892  	    ldd_output=`ldd conftest`
   1.893  	    for i in $deplibs; do
   1.894 -	      name="`expr $i : '-l\(.*\)'`"
   1.895 +	      name=`expr $i : '-l\(.*\)'`
   1.896  	      # If $name is empty we are operating on a -L argument.
   1.897                if test "$name" != "" && test "$name" -ne "0"; then
   1.898  		if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
   1.899 @@ -3468,11 +3601,11 @@
   1.900  	    # Error occurred in the first compile.  Let's try to salvage
   1.901  	    # the situation: Compile a separate program for each library.
   1.902  	    for i in $deplibs; do
   1.903 -	      name="`expr $i : '-l\(.*\)'`"
   1.904 +	      name=`expr $i : '-l\(.*\)'`
   1.905  	      # If $name is empty we are operating on a -L argument.
   1.906                if test "$name" != "" && test "$name" != "0"; then
   1.907  		$rm conftest
   1.908 -		$LTCC -o conftest conftest.c $i
   1.909 +		$LTCC $LTCFLAGS -o conftest conftest.c $i
   1.910  		# Did it work?
   1.911  		if test "$?" -eq 0 ; then
   1.912  		  ldd_output=`ldd conftest`
   1.913 @@ -3520,7 +3653,7 @@
   1.914  	  set dummy $deplibs_check_method
   1.915  	  file_magic_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
   1.916  	  for a_deplib in $deplibs; do
   1.917 -	    name="`expr $a_deplib : '-l\(.*\)'`"
   1.918 +	    name=`expr $a_deplib : '-l\(.*\)'`
   1.919  	    # If $name is empty we are operating on a -L argument.
   1.920              if test "$name" != "" && test  "$name" != "0"; then
   1.921  	      if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
   1.922 @@ -3589,7 +3722,7 @@
   1.923  	  set dummy $deplibs_check_method
   1.924  	  match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
   1.925  	  for a_deplib in $deplibs; do
   1.926 -	    name="`expr $a_deplib : '-l\(.*\)'`"
   1.927 +	    name=`expr $a_deplib : '-l\(.*\)'`
   1.928  	    # If $name is empty we are operating on a -L argument.
   1.929  	    if test -n "$name" && test "$name" != "0"; then
   1.930  	      if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
   1.931 @@ -3726,6 +3859,35 @@
   1.932  	deplibs=$newdeplibs
   1.933        fi
   1.934  
   1.935 +
   1.936 +      # move library search paths that coincide with paths to not yet
   1.937 +      # installed libraries to the beginning of the library search list
   1.938 +      new_libs=
   1.939 +      for path in $notinst_path; do
   1.940 +	case " $new_libs " in
   1.941 +	*" -L$path/$objdir "*) ;;
   1.942 +	*)
   1.943 +	  case " $deplibs " in
   1.944 +	  *" -L$path/$objdir "*)
   1.945 +	    new_libs="$new_libs -L$path/$objdir" ;;
   1.946 +	  esac
   1.947 +	  ;;
   1.948 +	esac
   1.949 +      done
   1.950 +      for deplib in $deplibs; do
   1.951 +	case $deplib in
   1.952 +	-L*)
   1.953 +	  case " $new_libs " in
   1.954 +	  *" $deplib "*) ;;
   1.955 +	  *) new_libs="$new_libs $deplib" ;;
   1.956 +	  esac
   1.957 +	  ;;
   1.958 +	*) new_libs="$new_libs $deplib" ;;
   1.959 +	esac
   1.960 +      done
   1.961 +      deplibs="$new_libs"
   1.962 +
   1.963 +
   1.964        # All the library-specific variables (install_libdir is set above).
   1.965        library_names=
   1.966        old_library=
   1.967 @@ -3809,6 +3971,7 @@
   1.968  	fi
   1.969  
   1.970  	lib="$output_objdir/$realname"
   1.971 +	linknames=
   1.972  	for link
   1.973  	do
   1.974  	  linknames="$linknames $link"
   1.975 @@ -3837,6 +4000,9 @@
   1.976  	        # The command line is too long to execute in one step.
   1.977  	        $show "using reloadable object file for export list..."
   1.978  	        skipped_export=:
   1.979 +		# Break out early, otherwise skipped_export may be
   1.980 +		# set to false by a later but shorter cmd.
   1.981 +		break
   1.982  	      fi
   1.983  	    done
   1.984  	    IFS="$save_ifs"
   1.985 @@ -3906,7 +4072,8 @@
   1.986  	  fi
   1.987  	fi
   1.988  
   1.989 -	if test "X$skipped_export" != "X:" && len=`expr "X$test_cmds" : ".*"` &&
   1.990 +	if test "X$skipped_export" != "X:" &&
   1.991 +	   len=`expr "X$test_cmds" : ".*" 2>/dev/null` &&
   1.992  	   test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
   1.993  	  :
   1.994  	else
   1.995 @@ -3925,6 +4092,7 @@
   1.996  	    save_libobjs=$libobjs
   1.997  	  fi
   1.998  	  save_output=$output
   1.999 +	  output_la=`$echo "X$output" | $Xsed -e "$basename"`
  1.1000  
  1.1001  	  # Clear the reloadable object creation command queue and
  1.1002  	  # initialize k to one.
  1.1003 @@ -3934,13 +4102,13 @@
  1.1004  	  delfiles=
  1.1005  	  last_robj=
  1.1006  	  k=1
  1.1007 -	  output=$output_objdir/$save_output-${k}.$objext
  1.1008 +	  output=$output_objdir/$output_la-${k}.$objext
  1.1009  	  # Loop over the list of objects to be linked.
  1.1010  	  for obj in $save_libobjs
  1.1011  	  do
  1.1012  	    eval test_cmds=\"$reload_cmds $objlist $last_robj\"
  1.1013  	    if test "X$objlist" = X ||
  1.1014 -	       { len=`expr "X$test_cmds" : ".*"` &&
  1.1015 +	       { len=`expr "X$test_cmds" : ".*" 2>/dev/null` &&
  1.1016  		 test "$len" -le "$max_cmd_len"; }; then
  1.1017  	      objlist="$objlist $obj"
  1.1018  	    else
  1.1019 @@ -3954,9 +4122,9 @@
  1.1020  		# the last one created.
  1.1021  		eval concat_cmds=\"\$concat_cmds~$reload_cmds $objlist $last_robj\"
  1.1022  	      fi
  1.1023 -	      last_robj=$output_objdir/$save_output-${k}.$objext
  1.1024 +	      last_robj=$output_objdir/$output_la-${k}.$objext
  1.1025  	      k=`expr $k + 1`
  1.1026 -	      output=$output_objdir/$save_output-${k}.$objext
  1.1027 +	      output=$output_objdir/$output_la-${k}.$objext
  1.1028  	      objlist=$obj
  1.1029  	      len=1
  1.1030  	    fi
  1.1031 @@ -3976,13 +4144,13 @@
  1.1032  	    eval concat_cmds=\"\$concat_cmds~$export_symbols_cmds\"
  1.1033            fi
  1.1034  
  1.1035 -	  # Set up a command to remove the reloadale object files
  1.1036 +	  # Set up a command to remove the reloadable object files
  1.1037  	  # after they are used.
  1.1038  	  i=0
  1.1039  	  while test "$i" -lt "$k"
  1.1040  	  do
  1.1041  	    i=`expr $i + 1`
  1.1042 -	    delfiles="$delfiles $output_objdir/$save_output-${i}.$objext"
  1.1043 +	    delfiles="$delfiles $output_objdir/$output_la-${i}.$objext"
  1.1044  	  done
  1.1045  
  1.1046  	  $echo "creating a temporary reloadable object file: $output"
  1.1047 @@ -4030,13 +4198,30 @@
  1.1048  	  IFS="$save_ifs"
  1.1049  	  eval cmd=\"$cmd\"
  1.1050  	  $show "$cmd"
  1.1051 -	  $run eval "$cmd" || exit $?
  1.1052 +	  $run eval "$cmd" || {
  1.1053 +	    lt_exit=$?
  1.1054 +
  1.1055 +	    # Restore the uninstalled library and exit
  1.1056 +	    if test "$mode" = relink; then
  1.1057 +	      $run eval '(cd $output_objdir && $rm ${realname}T && $mv ${realname}U $realname)'
  1.1058 +	    fi
  1.1059 +
  1.1060 +	    exit $lt_exit
  1.1061 +	  }
  1.1062  	done
  1.1063  	IFS="$save_ifs"
  1.1064  
  1.1065  	# Restore the uninstalled library and exit
  1.1066  	if test "$mode" = relink; then
  1.1067  	  $run eval '(cd $output_objdir && $rm ${realname}T && $mv $realname ${realname}T && $mv "$realname"U $realname)' || exit $?
  1.1068 +
  1.1069 +	  if test -n "$convenience"; then
  1.1070 +	    if test -z "$whole_archive_flag_spec"; then
  1.1071 +	      $show "${rm}r $gentop"
  1.1072 +	      $run ${rm}r "$gentop"
  1.1073 +	    fi
  1.1074 +	  fi
  1.1075 +
  1.1076  	  exit $EXIT_SUCCESS
  1.1077  	fi
  1.1078  
  1.1079 @@ -4221,6 +4406,35 @@
  1.1080          ;;
  1.1081        esac
  1.1082  
  1.1083 +
  1.1084 +      # move library search paths that coincide with paths to not yet
  1.1085 +      # installed libraries to the beginning of the library search list
  1.1086 +      new_libs=
  1.1087 +      for path in $notinst_path; do
  1.1088 +	case " $new_libs " in
  1.1089 +	*" -L$path/$objdir "*) ;;
  1.1090 +	*)
  1.1091 +	  case " $compile_deplibs " in
  1.1092 +	  *" -L$path/$objdir "*)
  1.1093 +	    new_libs="$new_libs -L$path/$objdir" ;;
  1.1094 +	  esac
  1.1095 +	  ;;
  1.1096 +	esac
  1.1097 +      done
  1.1098 +      for deplib in $compile_deplibs; do
  1.1099 +	case $deplib in
  1.1100 +	-L*)
  1.1101 +	  case " $new_libs " in
  1.1102 +	  *" $deplib "*) ;;
  1.1103 +	  *) new_libs="$new_libs $deplib" ;;
  1.1104 +	  esac
  1.1105 +	  ;;
  1.1106 +	*) new_libs="$new_libs $deplib" ;;
  1.1107 +	esac
  1.1108 +      done
  1.1109 +      compile_deplibs="$new_libs"
  1.1110 +
  1.1111 +
  1.1112        compile_command="$compile_command $compile_deplibs"
  1.1113        finalize_command="$finalize_command $finalize_deplibs"
  1.1114  
  1.1115 @@ -4265,10 +4479,15 @@
  1.1116  	fi
  1.1117  	case $host in
  1.1118  	*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
  1.1119 +	  testbindir=`$echo "X$libdir" | $Xsed -e 's*/lib$*/bin*'`
  1.1120  	  case :$dllsearchpath: in
  1.1121  	  *":$libdir:"*) ;;
  1.1122  	  *) dllsearchpath="$dllsearchpath:$libdir";;
  1.1123  	  esac
  1.1124 +	  case :$dllsearchpath: in
  1.1125 +	  *":$testbindir:"*) ;;
  1.1126 +	  *) dllsearchpath="$dllsearchpath:$testbindir";;
  1.1127 +	  esac
  1.1128  	  ;;
  1.1129  	esac
  1.1130        done
  1.1131 @@ -4382,13 +4601,25 @@
  1.1132  
  1.1133  	    # Prepare the list of exported symbols
  1.1134  	    if test -z "$export_symbols"; then
  1.1135 -	      export_symbols="$output_objdir/$output.exp"
  1.1136 +	      export_symbols="$output_objdir/$outputname.exp"
  1.1137  	      $run $rm $export_symbols
  1.1138 -	      $run eval "${SED} -n -e '/^: @PROGRAM@$/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
  1.1139 +	      $run eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
  1.1140 +              case $host in
  1.1141 +              *cygwin* | *mingw* )
  1.1142 +	        $run eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
  1.1143 +		$run eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"'
  1.1144 +                ;;
  1.1145 +              esac
  1.1146  	    else
  1.1147 -	      $run eval "${SED} -e 's/\([][.*^$]\)/\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$output.exp"'
  1.1148 -	      $run eval 'grep -f "$output_objdir/$output.exp" < "$nlist" > "$nlist"T'
  1.1149 +	      $run eval "${SED} -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"'
  1.1150 +	      $run eval 'grep -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T'
  1.1151  	      $run eval 'mv "$nlist"T "$nlist"'
  1.1152 +              case $host in
  1.1153 +              *cygwin* | *mingw* )
  1.1154 +	        $run eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
  1.1155 +		$run eval 'cat "$nlist" >> "$output_objdir/$outputname.def"'
  1.1156 +                ;;
  1.1157 +              esac
  1.1158  	    fi
  1.1159  	  fi
  1.1160  
  1.1161 @@ -4439,7 +4670,26 @@
  1.1162  #endif
  1.1163  
  1.1164  /* The mapping between symbol names and symbols. */
  1.1165 +"
  1.1166 +
  1.1167 +	    case $host in
  1.1168 +	    *cygwin* | *mingw* )
  1.1169 +	  $echo >> "$output_objdir/$dlsyms" "\
  1.1170 +/* DATA imports from DLLs on WIN32 can't be const, because
  1.1171 +   runtime relocations are performed -- see ld's documentation
  1.1172 +   on pseudo-relocs */
  1.1173 +struct {
  1.1174 +"
  1.1175 +	      ;;
  1.1176 +	    * )
  1.1177 +	  $echo >> "$output_objdir/$dlsyms" "\
  1.1178  const struct {
  1.1179 +"
  1.1180 +	      ;;
  1.1181 +	    esac
  1.1182 +
  1.1183 +
  1.1184 +	  $echo >> "$output_objdir/$dlsyms" "\
  1.1185    const char *name;
  1.1186    lt_ptr address;
  1.1187  }
  1.1188 @@ -4486,16 +4736,29 @@
  1.1189  	  esac
  1.1190  
  1.1191  	  # Now compile the dynamic symbol file.
  1.1192 -	  $show "(cd $output_objdir && $LTCC -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")"
  1.1193 -	  $run eval '(cd $output_objdir && $LTCC -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $?
  1.1194 +	  $show "(cd $output_objdir && $LTCC  $LTCFLAGS -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")"
  1.1195 +	  $run eval '(cd $output_objdir && $LTCC  $LTCFLAGS -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $?
  1.1196  
  1.1197  	  # Clean up the generated files.
  1.1198  	  $show "$rm $output_objdir/$dlsyms $nlist ${nlist}S ${nlist}T"
  1.1199  	  $run $rm "$output_objdir/$dlsyms" "$nlist" "${nlist}S" "${nlist}T"
  1.1200  
  1.1201  	  # Transform the symbol file into the correct name.
  1.1202 -	  compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
  1.1203 -	  finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
  1.1204 +          case $host in
  1.1205 +          *cygwin* | *mingw* )
  1.1206 +            if test -f "$output_objdir/${outputname}.def" ; then
  1.1207 +              compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}.def $output_objdir/${outputname}S.${objext}%"`
  1.1208 +              finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}.def $output_objdir/${outputname}S.${objext}%"`
  1.1209 +            else
  1.1210 +              compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
  1.1211 +              finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
  1.1212 +             fi
  1.1213 +            ;;
  1.1214 +          * )
  1.1215 +            compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
  1.1216 +            finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
  1.1217 +            ;;
  1.1218 +          esac
  1.1219  	  ;;
  1.1220  	*)
  1.1221  	  $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2
  1.1222 @@ -4520,7 +4783,7 @@
  1.1223  	# We have no uninstalled library dependencies, so finalize right now.
  1.1224  	$show "$link_command"
  1.1225  	$run eval "$link_command"
  1.1226 -	status=$?
  1.1227 +	exit_status=$?
  1.1228  
  1.1229  	# Delete the generated files.
  1.1230  	if test -n "$dlsyms"; then
  1.1231 @@ -4528,7 +4791,7 @@
  1.1232  	  $run $rm "$output_objdir/${outputname}S.${objext}"
  1.1233  	fi
  1.1234  
  1.1235 -	exit $status
  1.1236 +	exit $exit_status
  1.1237        fi
  1.1238  
  1.1239        if test -n "$shlibpath_var"; then
  1.1240 @@ -4668,10 +4931,12 @@
  1.1241  	esac
  1.1242  	case $host in
  1.1243  	  *cygwin* | *mingw* )
  1.1244 -	    cwrappersource=`$echo ${objdir}/lt-${output}.c`
  1.1245 -	    cwrapper=`$echo ${output}.exe`
  1.1246 -	    $rm $cwrappersource $cwrapper
  1.1247 -	    trap "$rm $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15
  1.1248 +            output_name=`basename $output`
  1.1249 +            output_path=`dirname $output`
  1.1250 +            cwrappersource="$output_path/$objdir/lt-$output_name.c"
  1.1251 +            cwrapper="$output_path/$output_name.exe"
  1.1252 +            $rm $cwrappersource $cwrapper
  1.1253 +            trap "$rm $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15
  1.1254  
  1.1255  	    cat > $cwrappersource <<EOF
  1.1256  
  1.1257 @@ -4696,6 +4961,9 @@
  1.1258  #include <malloc.h>
  1.1259  #include <stdarg.h>
  1.1260  #include <assert.h>
  1.1261 +#include <string.h>
  1.1262 +#include <ctype.h>
  1.1263 +#include <sys/stat.h>
  1.1264  
  1.1265  #if defined(PATH_MAX)
  1.1266  # define LT_PATHMAX PATH_MAX
  1.1267 @@ -4706,15 +4974,19 @@
  1.1268  #endif
  1.1269  
  1.1270  #ifndef DIR_SEPARATOR
  1.1271 -#define DIR_SEPARATOR '/'
  1.1272 +# define DIR_SEPARATOR '/'
  1.1273 +# define PATH_SEPARATOR ':'
  1.1274  #endif
  1.1275  
  1.1276  #if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \
  1.1277    defined (__OS2__)
  1.1278 -#define HAVE_DOS_BASED_FILE_SYSTEM
  1.1279 -#ifndef DIR_SEPARATOR_2
  1.1280 -#define DIR_SEPARATOR_2 '\\'
  1.1281 -#endif
  1.1282 +# define HAVE_DOS_BASED_FILE_SYSTEM
  1.1283 +# ifndef DIR_SEPARATOR_2
  1.1284 +#  define DIR_SEPARATOR_2 '\\'
  1.1285 +# endif
  1.1286 +# ifndef PATH_SEPARATOR_2
  1.1287 +#  define PATH_SEPARATOR_2 ';'
  1.1288 +# endif
  1.1289  #endif
  1.1290  
  1.1291  #ifndef DIR_SEPARATOR_2
  1.1292 @@ -4724,17 +4996,32 @@
  1.1293          (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2))
  1.1294  #endif /* DIR_SEPARATOR_2 */
  1.1295  
  1.1296 +#ifndef PATH_SEPARATOR_2
  1.1297 +# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR)
  1.1298 +#else /* PATH_SEPARATOR_2 */
  1.1299 +# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2)
  1.1300 +#endif /* PATH_SEPARATOR_2 */
  1.1301 +
  1.1302  #define XMALLOC(type, num)      ((type *) xmalloc ((num) * sizeof(type)))
  1.1303  #define XFREE(stale) do { \
  1.1304    if (stale) { free ((void *) stale); stale = 0; } \
  1.1305  } while (0)
  1.1306  
  1.1307 +/* -DDEBUG is fairly common in CFLAGS.  */
  1.1308 +#undef DEBUG
  1.1309 +#if defined DEBUGWRAPPER
  1.1310 +# define DEBUG(format, ...) fprintf(stderr, format, __VA_ARGS__)
  1.1311 +#else
  1.1312 +# define DEBUG(format, ...)
  1.1313 +#endif
  1.1314 +
  1.1315  const char *program_name = NULL;
  1.1316  
  1.1317  void * xmalloc (size_t num);
  1.1318  char * xstrdup (const char *string);
  1.1319 -char * basename (const char *name);
  1.1320 -char * fnqualify(const char *path);
  1.1321 +const char * base_name (const char *name);
  1.1322 +char * find_executable(const char *wrapper);
  1.1323 +int    check_executable(const char *path);
  1.1324  char * strendzap(char *str, const char *pat);
  1.1325  void lt_fatal (const char *message, ...);
  1.1326  
  1.1327 @@ -4744,29 +5031,51 @@
  1.1328    char **newargz;
  1.1329    int i;
  1.1330  
  1.1331 -  program_name = (char *) xstrdup ((char *) basename (argv[0]));
  1.1332 +  program_name = (char *) xstrdup (base_name (argv[0]));
  1.1333 +  DEBUG("(main) argv[0]      : %s\n",argv[0]);
  1.1334 +  DEBUG("(main) program_name : %s\n",program_name);
  1.1335    newargz = XMALLOC(char *, argc+2);
  1.1336  EOF
  1.1337  
  1.1338 -	    cat >> $cwrappersource <<EOF
  1.1339 -  newargz[0] = "$SHELL";
  1.1340 +            cat >> $cwrappersource <<EOF
  1.1341 +  newargz[0] = (char *) xstrdup("$SHELL");
  1.1342  EOF
  1.1343  
  1.1344 -	    cat >> $cwrappersource <<"EOF"
  1.1345 -  newargz[1] = fnqualify(argv[0]);
  1.1346 +            cat >> $cwrappersource <<"EOF"
  1.1347 +  newargz[1] = find_executable(argv[0]);
  1.1348 +  if (newargz[1] == NULL)
  1.1349 +    lt_fatal("Couldn't find %s", argv[0]);
  1.1350 +  DEBUG("(main) found exe at : %s\n",newargz[1]);
  1.1351    /* we know the script has the same name, without the .exe */
  1.1352    /* so make sure newargz[1] doesn't end in .exe */
  1.1353    strendzap(newargz[1],".exe");
  1.1354    for (i = 1; i < argc; i++)
  1.1355      newargz[i+1] = xstrdup(argv[i]);
  1.1356    newargz[argc+1] = NULL;
  1.1357 +
  1.1358 +  for (i=0; i<argc+1; i++)
  1.1359 +  {
  1.1360 +    DEBUG("(main) newargz[%d]   : %s\n",i,newargz[i]);
  1.1361 +    ;
  1.1362 +  }
  1.1363 +
  1.1364  EOF
  1.1365  
  1.1366 -	    cat >> $cwrappersource <<EOF
  1.1367 +            case $host_os in
  1.1368 +              mingw*)
  1.1369 +                cat >> $cwrappersource <<EOF
  1.1370 +  execv("$SHELL",(char const **)newargz);
  1.1371 +EOF
  1.1372 +              ;;
  1.1373 +              *)
  1.1374 +                cat >> $cwrappersource <<EOF
  1.1375    execv("$SHELL",newargz);
  1.1376  EOF
  1.1377 -
  1.1378 -	    cat >> $cwrappersource <<"EOF"
  1.1379 +              ;;
  1.1380 +            esac
  1.1381 +
  1.1382 +            cat >> $cwrappersource <<"EOF"
  1.1383 +  return 127;
  1.1384  }
  1.1385  
  1.1386  void *
  1.1387 @@ -4786,48 +5095,148 @@
  1.1388  ;
  1.1389  }
  1.1390  
  1.1391 -char *
  1.1392 -basename (const char *name)
  1.1393 +const char *
  1.1394 +base_name (const char *name)
  1.1395  {
  1.1396    const char *base;
  1.1397  
  1.1398  #if defined (HAVE_DOS_BASED_FILE_SYSTEM)
  1.1399    /* Skip over the disk name in MSDOS pathnames. */
  1.1400 -  if (isalpha (name[0]) && name[1] == ':')
  1.1401 +  if (isalpha ((unsigned char)name[0]) && name[1] == ':')
  1.1402      name += 2;
  1.1403  #endif
  1.1404  
  1.1405    for (base = name; *name; name++)
  1.1406      if (IS_DIR_SEPARATOR (*name))
  1.1407        base = name + 1;
  1.1408 -  return (char *) base;
  1.1409 +  return base;
  1.1410  }
  1.1411  
  1.1412 +int
  1.1413 +check_executable(const char * path)
  1.1414 +{
  1.1415 +  struct stat st;
  1.1416 +
  1.1417 +  DEBUG("(check_executable)  : %s\n", path ? (*path ? path : "EMPTY!") : "NULL!");
  1.1418 +  if ((!path) || (!*path))
  1.1419 +    return 0;
  1.1420 +
  1.1421 +  if ((stat (path, &st) >= 0) &&
  1.1422 +      (
  1.1423 +        /* MinGW & native WIN32 do not support S_IXOTH or S_IXGRP */
  1.1424 +#if defined (S_IXOTH)
  1.1425 +       ((st.st_mode & S_IXOTH) == S_IXOTH) ||
  1.1426 +#endif
  1.1427 +#if defined (S_IXGRP)
  1.1428 +       ((st.st_mode & S_IXGRP) == S_IXGRP) ||
  1.1429 +#endif
  1.1430 +       ((st.st_mode & S_IXUSR) == S_IXUSR))
  1.1431 +      )
  1.1432 +    return 1;
  1.1433 +  else
  1.1434 +    return 0;
  1.1435 +}
  1.1436 +
  1.1437 +/* Searches for the full path of the wrapper.  Returns
  1.1438 +   newly allocated full path name if found, NULL otherwise */
  1.1439  char *
  1.1440 -fnqualify(const char *path)
  1.1441 +find_executable (const char* wrapper)
  1.1442  {
  1.1443 -  size_t size;
  1.1444 -  char *p;
  1.1445 +  int has_slash = 0;
  1.1446 +  const char* p;
  1.1447 +  const char* p_next;
  1.1448 +  /* static buffer for getcwd */
  1.1449    char tmp[LT_PATHMAX + 1];
  1.1450 -
  1.1451 -  assert(path != NULL);
  1.1452 -
  1.1453 -  /* Is it qualified already? */
  1.1454 +  int tmp_len;
  1.1455 +  char* concat_name;
  1.1456 +
  1.1457 +  DEBUG("(find_executable)  : %s\n", wrapper ? (*wrapper ? wrapper : "EMPTY!") : "NULL!");
  1.1458 +
  1.1459 +  if ((wrapper == NULL) || (*wrapper == '\0'))
  1.1460 +    return NULL;
  1.1461 +
  1.1462 +  /* Absolute path? */
  1.1463  #if defined (HAVE_DOS_BASED_FILE_SYSTEM)
  1.1464 -  if (isalpha (path[0]) && path[1] == ':')
  1.1465 -    return xstrdup (path);
  1.1466 +  if (isalpha ((unsigned char)wrapper[0]) && wrapper[1] == ':')
  1.1467 +  {
  1.1468 +    concat_name = xstrdup (wrapper);
  1.1469 +    if (check_executable(concat_name))
  1.1470 +      return concat_name;
  1.1471 +    XFREE(concat_name);
  1.1472 +  }
  1.1473 +  else
  1.1474 +  {
  1.1475  #endif
  1.1476 -  if (IS_DIR_SEPARATOR (path[0]))
  1.1477 -    return xstrdup (path);
  1.1478 -
  1.1479 -  /* prepend the current directory */
  1.1480 -  /* doesn't handle '~' */
  1.1481 +    if (IS_DIR_SEPARATOR (wrapper[0]))
  1.1482 +    {
  1.1483 +      concat_name = xstrdup (wrapper);
  1.1484 +      if (check_executable(concat_name))
  1.1485 +        return concat_name;
  1.1486 +      XFREE(concat_name);
  1.1487 +    }
  1.1488 +#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
  1.1489 +  }
  1.1490 +#endif
  1.1491 +
  1.1492 +  for (p = wrapper; *p; p++)
  1.1493 +    if (*p == '/')
  1.1494 +    {
  1.1495 +      has_slash = 1;
  1.1496 +      break;
  1.1497 +    }
  1.1498 +  if (!has_slash)
  1.1499 +  {
  1.1500 +    /* no slashes; search PATH */
  1.1501 +    const char* path = getenv ("PATH");
  1.1502 +    if (path != NULL)
  1.1503 +    {
  1.1504 +      for (p = path; *p; p = p_next)
  1.1505 +      {
  1.1506 +        const char* q;
  1.1507 +        size_t p_len;
  1.1508 +        for (q = p; *q; q++)
  1.1509 +          if (IS_PATH_SEPARATOR(*q))
  1.1510 +            break;
  1.1511 +        p_len = q - p;
  1.1512 +        p_next = (*q == '\0' ? q : q + 1);
  1.1513 +        if (p_len == 0)
  1.1514 +        {
  1.1515 +          /* empty path: current directory */
  1.1516 +          if (getcwd (tmp, LT_PATHMAX) == NULL)
  1.1517 +            lt_fatal ("getcwd failed");
  1.1518 +          tmp_len = strlen(tmp);
  1.1519 +          concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1);
  1.1520 +          memcpy (concat_name, tmp, tmp_len);
  1.1521 +          concat_name[tmp_len] = '/';
  1.1522 +          strcpy (concat_name + tmp_len + 1, wrapper);
  1.1523 +        }
  1.1524 +        else
  1.1525 +        {
  1.1526 +          concat_name = XMALLOC(char, p_len + 1 + strlen(wrapper) + 1);
  1.1527 +          memcpy (concat_name, p, p_len);
  1.1528 +          concat_name[p_len] = '/';
  1.1529 +          strcpy (concat_name + p_len + 1, wrapper);
  1.1530 +        }
  1.1531 +        if (check_executable(concat_name))
  1.1532 +          return concat_name;
  1.1533 +        XFREE(concat_name);
  1.1534 +      }
  1.1535 +    }
  1.1536 +    /* not found in PATH; assume curdir */
  1.1537 +  }
  1.1538 +  /* Relative path | not found in path: prepend cwd */
  1.1539    if (getcwd (tmp, LT_PATHMAX) == NULL)
  1.1540      lt_fatal ("getcwd failed");
  1.1541 -  size = strlen(tmp) + 1 + strlen(path) + 1; /* +2 for '/' and '\0' */
  1.1542 -  p = XMALLOC(char, size);
  1.1543 -  sprintf(p, "%s%c%s", tmp, DIR_SEPARATOR, path);
  1.1544 -  return p;
  1.1545 +  tmp_len = strlen(tmp);
  1.1546 +  concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1);
  1.1547 +  memcpy (concat_name, tmp, tmp_len);
  1.1548 +  concat_name[tmp_len] = '/';
  1.1549 +  strcpy (concat_name + tmp_len + 1, wrapper);
  1.1550 +
  1.1551 +  if (check_executable(concat_name))
  1.1552 +    return concat_name;
  1.1553 +  XFREE(concat_name);
  1.1554 +  return NULL;
  1.1555  }
  1.1556  
  1.1557  char *
  1.1558 @@ -4871,16 +5280,16 @@
  1.1559    va_end (ap);
  1.1560  }
  1.1561  EOF
  1.1562 -	  # we should really use a build-platform specific compiler
  1.1563 -	  # here, but OTOH, the wrappers (shell script and this C one)
  1.1564 -	  # are only useful if you want to execute the "real" binary.
  1.1565 -	  # Since the "real" binary is built for $host, then this
  1.1566 -	  # wrapper might as well be built for $host, too.
  1.1567 -	  $run $LTCC -s -o $cwrapper $cwrappersource
  1.1568 -	  ;;
  1.1569 -	esac
  1.1570 -	$rm $output
  1.1571 -	trap "$rm $output; exit $EXIT_FAILURE" 1 2 15
  1.1572 +          # we should really use a build-platform specific compiler
  1.1573 +          # here, but OTOH, the wrappers (shell script and this C one)
  1.1574 +          # are only useful if you want to execute the "real" binary.
  1.1575 +          # Since the "real" binary is built for $host, then this
  1.1576 +          # wrapper might as well be built for $host, too.
  1.1577 +          $run $LTCC $LTCFLAGS -s -o $cwrapper $cwrappersource
  1.1578 +          ;;
  1.1579 +        esac
  1.1580 +        $rm $output
  1.1581 +        trap "$rm $output; exit $EXIT_FAILURE" 1 2 15
  1.1582  
  1.1583  	$echo > $output "\
  1.1584  #! $SHELL
  1.1585 @@ -5030,13 +5439,13 @@
  1.1586  	# Backslashes separate directories on plain windows
  1.1587  	*-*-mingw | *-*-os2*)
  1.1588  	  $echo >> $output "\
  1.1589 -      exec \$progdir\\\\\$program \${1+\"\$@\"}
  1.1590 +      exec \"\$progdir\\\\\$program\" \${1+\"\$@\"}
  1.1591  "
  1.1592  	  ;;
  1.1593  
  1.1594  	*)
  1.1595  	  $echo >> $output "\
  1.1596 -      exec \$progdir/\$program \${1+\"\$@\"}
  1.1597 +      exec \"\$progdir/\$program\" \${1+\"\$@\"}
  1.1598  "
  1.1599  	  ;;
  1.1600  	esac
  1.1601 @@ -5046,7 +5455,7 @@
  1.1602      fi
  1.1603    else
  1.1604      # The program doesn't exist.
  1.1605 -    \$echo \"\$0: error: \$progdir/\$program does not exist\" 1>&2
  1.1606 +    \$echo \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2
  1.1607      \$echo \"This script is just a wrapper for \$program.\" 1>&2
  1.1608      $echo \"See the $PACKAGE documentation for more information.\" 1>&2
  1.1609      exit $EXIT_FAILURE
  1.1610 @@ -5088,6 +5497,63 @@
  1.1611        if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then
  1.1612         cmds=$old_archive_from_new_cmds
  1.1613        else
  1.1614 +	# POSIX demands no paths to be encoded in archives.  We have
  1.1615 +	# to avoid creating archives with duplicate basenames if we
  1.1616 +	# might have to extract them afterwards, e.g., when creating a
  1.1617 +	# static archive out of a convenience library, or when linking
  1.1618 +	# the entirety of a libtool archive into another (currently
  1.1619 +	# not supported by libtool).
  1.1620 +	if (for obj in $oldobjs
  1.1621 +	    do
  1.1622 +	      $echo "X$obj" | $Xsed -e 's%^.*/%%'
  1.1623 +	    done | sort | sort -uc >/dev/null 2>&1); then
  1.1624 +	  :
  1.1625 +	else
  1.1626 +	  $echo "copying selected object files to avoid basename conflicts..."
  1.1627 +
  1.1628 +	  if test -z "$gentop"; then
  1.1629 +	    gentop="$output_objdir/${outputname}x"
  1.1630 +	    generated="$generated $gentop"
  1.1631 +
  1.1632 +	    $show "${rm}r $gentop"
  1.1633 +	    $run ${rm}r "$gentop"
  1.1634 +	    $show "$mkdir $gentop"
  1.1635 +	    $run $mkdir "$gentop"
  1.1636 +	    exit_status=$?
  1.1637 +	    if test "$exit_status" -ne 0 && test ! -d "$gentop"; then
  1.1638 +	      exit $exit_status
  1.1639 +	    fi
  1.1640 +	  fi
  1.1641 +
  1.1642 +	  save_oldobjs=$oldobjs
  1.1643 +	  oldobjs=
  1.1644 +	  counter=1
  1.1645 +	  for obj in $save_oldobjs
  1.1646 +	  do
  1.1647 +	    objbase=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
  1.1648 +	    case " $oldobjs " in
  1.1649 +	    " ") oldobjs=$obj ;;
  1.1650 +	    *[\ /]"$objbase "*)
  1.1651 +	      while :; do
  1.1652 +		# Make sure we don't pick an alternate name that also
  1.1653 +		# overlaps.
  1.1654 +		newobj=lt$counter-$objbase
  1.1655 +		counter=`expr $counter + 1`
  1.1656 +		case " $oldobjs " in
  1.1657 +		*[\ /]"$newobj "*) ;;
  1.1658 +		*) if test ! -f "$gentop/$newobj"; then break; fi ;;
  1.1659 +		esac
  1.1660 +	      done
  1.1661 +	      $show "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj"
  1.1662 +	      $run ln "$obj" "$gentop/$newobj" ||
  1.1663 +	      $run cp "$obj" "$gentop/$newobj"
  1.1664 +	      oldobjs="$oldobjs $gentop/$newobj"
  1.1665 +	      ;;
  1.1666 +	    *) oldobjs="$oldobjs $obj" ;;
  1.1667 +	    esac
  1.1668 +	  done
  1.1669 +	fi
  1.1670 +
  1.1671  	eval cmds=\"$old_archive_cmds\"
  1.1672  
  1.1673  	if len=`expr "X$cmds" : ".*"` &&
  1.1674 @@ -5101,20 +5567,7 @@
  1.1675  	  objlist=
  1.1676  	  concat_cmds=
  1.1677  	  save_oldobjs=$oldobjs
  1.1678 -	  # GNU ar 2.10+ was changed to match POSIX; thus no paths are
  1.1679 -	  # encoded into archives.  This makes 'ar r' malfunction in
  1.1680 -	  # this piecewise linking case whenever conflicting object
  1.1681 -	  # names appear in distinct ar calls; check, warn and compensate.
  1.1682 -	    if (for obj in $save_oldobjs
  1.1683 -	    do
  1.1684 -	      $echo "X$obj" | $Xsed -e 's%^.*/%%'
  1.1685 -	    done | sort | sort -uc >/dev/null 2>&1); then
  1.1686 -	    :
  1.1687 -	  else
  1.1688 -	    $echo "$modename: warning: object name conflicts; overriding AR_FLAGS to 'cq'" 1>&2
  1.1689 -	    $echo "$modename: warning: to ensure that POSIX-compatible ar will work" 1>&2
  1.1690 -	    AR_FLAGS=cq
  1.1691 -	  fi
  1.1692 +
  1.1693  	  # Is there a better way of finding the last object in the list?
  1.1694  	  for obj in $save_oldobjs
  1.1695  	  do
  1.1696 @@ -5125,7 +5578,7 @@
  1.1697  	    oldobjs="$objlist $obj"
  1.1698  	    objlist="$objlist $obj"
  1.1699  	    eval test_cmds=\"$old_archive_cmds\"
  1.1700 -	    if len=`expr "X$test_cmds" : ".*"` &&
  1.1701 +	    if len=`expr "X$test_cmds" : ".*" 2>/dev/null` &&
  1.1702  	       test "$len" -le "$max_cmd_len"; then
  1.1703  	      :
  1.1704  	    else
  1.1705 @@ -5322,11 +5775,11 @@
  1.1706      # install_prog (especially on Windows NT).
  1.1707      if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh ||
  1.1708         # Allow the use of GNU shtool's install command.
  1.1709 -       $echo "X$nonopt" | $Xsed | grep shtool > /dev/null; then
  1.1710 +       $echo "X$nonopt" | grep shtool > /dev/null; then
  1.1711        # Aesthetically quote it.
  1.1712        arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"`
  1.1713        case $arg in
  1.1714 -      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*)
  1.1715 +      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
  1.1716  	arg="\"$arg\""
  1.1717  	;;
  1.1718        esac
  1.1719 @@ -5335,14 +5788,14 @@
  1.1720        shift
  1.1721      else
  1.1722        install_prog=
  1.1723 -      arg="$nonopt"
  1.1724 +      arg=$nonopt
  1.1725      fi
  1.1726  
  1.1727      # The real first argument should be the name of the installation program.
  1.1728      # Aesthetically quote it.
  1.1729      arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
  1.1730      case $arg in
  1.1731 -    *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*)
  1.1732 +    *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
  1.1733        arg="\"$arg\""
  1.1734        ;;
  1.1735      esac
  1.1736 @@ -5360,28 +5813,31 @@
  1.1737      do
  1.1738        if test -n "$dest"; then
  1.1739  	files="$files $dest"
  1.1740 -	dest="$arg"
  1.1741 +	dest=$arg
  1.1742  	continue
  1.1743        fi
  1.1744  
  1.1745        case $arg in
  1.1746        -d) isdir=yes ;;
  1.1747 -      -f) prev="-f" ;;
  1.1748 -      -g) prev="-g" ;;
  1.1749 -      -m) prev="-m" ;;
  1.1750 -      -o) prev="-o" ;;
  1.1751 +      -f) 
  1.1752 +      	case " $install_prog " in
  1.1753 +	*[\\\ /]cp\ *) ;;
  1.1754 +	*) prev=$arg ;;
  1.1755 +	esac
  1.1756 +	;;
  1.1757 +      -g | -m | -o) prev=$arg ;;
  1.1758        -s)
  1.1759  	stripme=" -s"
  1.1760  	continue
  1.1761  	;;
  1.1762 -      -*) ;;
  1.1763 -
  1.1764 +      -*)
  1.1765 +	;;
  1.1766        *)
  1.1767  	# If the previous option needed an argument, then skip it.
  1.1768  	if test -n "$prev"; then
  1.1769  	  prev=
  1.1770  	else
  1.1771 -	  dest="$arg"
  1.1772 +	  dest=$arg
  1.1773  	  continue
  1.1774  	fi
  1.1775  	;;
  1.1776 @@ -5390,7 +5846,7 @@
  1.1777        # Aesthetically quote the argument.
  1.1778        arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
  1.1779        case $arg in
  1.1780 -      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*)
  1.1781 +      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
  1.1782  	arg="\"$arg\""
  1.1783  	;;
  1.1784        esac
  1.1785 @@ -5559,11 +6015,14 @@
  1.1786  
  1.1787  	  if test "$#" -gt 0; then
  1.1788  	    # Delete the old symlinks, and create new ones.
  1.1789 +	    # Try `ln -sf' first, because the `ln' binary might depend on
  1.1790 +	    # the symlink we replace!  Solaris /bin/ln does not understand -f,
  1.1791 +	    # so we also need to try rm && ln -s.
  1.1792  	    for linkname
  1.1793  	    do
  1.1794  	      if test "$linkname" != "$realname"; then
  1.1795 -		$show "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)"
  1.1796 -		$run eval "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)"
  1.1797 +                $show "(cd $destdir && { $LN_S -f $realname $linkname || { $rm $linkname && $LN_S $realname $linkname; }; })"
  1.1798 +                $run eval "(cd $destdir && { $LN_S -f $realname $linkname || { $rm $linkname && $LN_S $realname $linkname; }; })"
  1.1799  	      fi
  1.1800  	    done
  1.1801  	  fi
  1.1802 @@ -5576,7 +6035,16 @@
  1.1803  	    IFS="$save_ifs"
  1.1804  	    eval cmd=\"$cmd\"
  1.1805  	    $show "$cmd"
  1.1806 -	    $run eval "$cmd" || exit $?
  1.1807 +	    $run eval "$cmd" || {
  1.1808 +	      lt_exit=$?
  1.1809 +
  1.1810 +	      # Restore the uninstalled library and exit
  1.1811 +	      if test "$mode" = relink; then
  1.1812 +		$run eval '(cd $output_objdir && $rm ${realname}T && $mv ${realname}U $realname)'
  1.1813 +	      fi
  1.1814 +
  1.1815 +	      exit $lt_exit
  1.1816 +	    }
  1.1817  	  done
  1.1818  	  IFS="$save_ifs"
  1.1819  	fi
  1.1820 @@ -5670,17 +6138,15 @@
  1.1821  	  notinst_deplibs=
  1.1822  	  relink_command=
  1.1823  
  1.1824 -	  # To insure that "foo" is sourced, and not "foo.exe",
  1.1825 -	  # finese the cygwin/MSYS system by explicitly sourcing "foo."
  1.1826 -	  # which disallows the automatic-append-.exe behavior.
  1.1827 -	  case $build in
  1.1828 -	  *cygwin* | *mingw*) wrapperdot=${wrapper}. ;;
  1.1829 -	  *) wrapperdot=${wrapper} ;;
  1.1830 -	  esac
  1.1831 +	  # Note that it is not necessary on cygwin/mingw to append a dot to
  1.1832 +	  # foo even if both foo and FILE.exe exist: automatic-append-.exe
  1.1833 +	  # behavior happens only for exec(3), not for open(2)!  Also, sourcing
  1.1834 +	  # `FILE.' does not work on cygwin managed mounts.
  1.1835 +	  #
  1.1836  	  # If there is no directory component, then add one.
  1.1837 -	  case $file in
  1.1838 -	  */* | *\\*) . ${wrapperdot} ;;
  1.1839 -	  *) . ./${wrapperdot} ;;
  1.1840 +	  case $wrapper in
  1.1841 +	  */* | *\\*) . ${wrapper} ;;
  1.1842 +	  *) . ./${wrapper} ;;
  1.1843  	  esac
  1.1844  
  1.1845  	  # Check the variables that should have been set.
  1.1846 @@ -5708,34 +6174,21 @@
  1.1847  	  done
  1.1848  
  1.1849  	  relink_command=
  1.1850 -	  # To insure that "foo" is sourced, and not "foo.exe",
  1.1851 -	  # finese the cygwin/MSYS system by explicitly sourcing "foo."
  1.1852 -	  # which disallows the automatic-append-.exe behavior.
  1.1853 -	  case $build in
  1.1854 -	  *cygwin* | *mingw*) wrapperdot=${wrapper}. ;;
  1.1855 -	  *) wrapperdot=${wrapper} ;;
  1.1856 -	  esac
  1.1857 +	  # Note that it is not necessary on cygwin/mingw to append a dot to
  1.1858 +	  # foo even if both foo and FILE.exe exist: automatic-append-.exe
  1.1859 +	  # behavior happens only for exec(3), not for open(2)!  Also, sourcing
  1.1860 +	  # `FILE.' does not work on cygwin managed mounts.
  1.1861 +	  #
  1.1862  	  # If there is no directory component, then add one.
  1.1863 -	  case $file in
  1.1864 -	  */* | *\\*) . ${wrapperdot} ;;
  1.1865 -	  *) . ./${wrapperdot} ;;
  1.1866 +	  case $wrapper in
  1.1867 +	  */* | *\\*) . ${wrapper} ;;
  1.1868 +	  *) . ./${wrapper} ;;
  1.1869  	  esac
  1.1870  
  1.1871  	  outputname=
  1.1872  	  if test "$fast_install" = no && test -n "$relink_command"; then
  1.1873  	    if test "$finalize" = yes && test -z "$run"; then
  1.1874 -	      tmpdir="/tmp"
  1.1875 -	      test -n "$TMPDIR" && tmpdir="$TMPDIR"
  1.1876 -	      tmpdir="$tmpdir/libtool-$$"
  1.1877 -	      save_umask=`umask`
  1.1878 -	      umask 0077
  1.1879 -	      if $mkdir "$tmpdir"; then
  1.1880 -	        umask $save_umask
  1.1881 -	      else
  1.1882 -	        umask $save_umask
  1.1883 -		$echo "$modename: error: cannot create temporary directory \`$tmpdir'" 1>&2
  1.1884 -		continue
  1.1885 -	      fi
  1.1886 +	      tmpdir=`func_mktempdir`
  1.1887  	      file=`$echo "X$file$stripped_ext" | $Xsed -e 's%^.*/%%'`
  1.1888  	      outputname="$tmpdir/$file"
  1.1889  	      # Replace the output file specification.
  1.1890 @@ -5759,7 +6212,7 @@
  1.1891  	fi
  1.1892  
  1.1893  	# remove .exe since cygwin /usr/bin/install will append another
  1.1894 -	# one anyways
  1.1895 +	# one anyway 
  1.1896  	case $install_prog,$host in
  1.1897  	*/usr/bin/install*,*cygwin*)
  1.1898  	  case $file:$destfile in
  1.1899 @@ -5859,7 +6312,7 @@
  1.1900      # Exit here if they wanted silent mode.
  1.1901      test "$show" = : && exit $EXIT_SUCCESS
  1.1902  
  1.1903 -    $echo "----------------------------------------------------------------------"
  1.1904 +    $echo "X----------------------------------------------------------------------" | $Xsed
  1.1905      $echo "Libraries have been installed in:"
  1.1906      for libdir in $libdirs; do
  1.1907        $echo "   $libdir"
  1.1908 @@ -5892,7 +6345,7 @@
  1.1909      $echo
  1.1910      $echo "See any operating system documentation about shared libraries for"
  1.1911      $echo "more information, such as the ld(1) and ld.so(8) manual pages."
  1.1912 -    $echo "----------------------------------------------------------------------"
  1.1913 +    $echo "X----------------------------------------------------------------------" | $Xsed
  1.1914      exit $EXIT_SUCCESS
  1.1915      ;;
  1.1916  
  1.1917 @@ -6109,9 +6562,17 @@
  1.1918  	    rmfiles="$rmfiles $objdir/$n"
  1.1919  	  done
  1.1920  	  test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library"
  1.1921 -	  test "$mode" = clean && rmfiles="$rmfiles $objdir/$name $objdir/${name}i"
  1.1922 -
  1.1923 -	  if test "$mode" = uninstall; then
  1.1924 +
  1.1925 +	  case "$mode" in
  1.1926 +	  clean)
  1.1927 +	    case "  $library_names " in
  1.1928 +	    # "  " in the beginning catches empty $dlname
  1.1929 +	    *" $dlname "*) ;;
  1.1930 +	    *) rmfiles="$rmfiles $objdir/$dlname" ;;
  1.1931 +	    esac
  1.1932 +	     test -n "$libdir" && rmfiles="$rmfiles $objdir/$name $objdir/${name}i"
  1.1933 +	    ;;
  1.1934 +	  uninstall)
  1.1935  	    if test -n "$library_names"; then
  1.1936  	      # Do each command in the postuninstall commands.
  1.1937  	      cmds=$postuninstall_cmds
  1.1938 @@ -6144,7 +6605,8 @@
  1.1939  	      IFS="$save_ifs"
  1.1940  	    fi
  1.1941  	    # FIXME: should reinstall the best remaining shared library.
  1.1942 -	  fi
  1.1943 +	    ;;
  1.1944 +	  esac
  1.1945  	fi
  1.1946  	;;
  1.1947  
  1.1948 @@ -6429,7 +6891,7 @@
  1.1949  $echo
  1.1950  $echo "Try \`$modename --help' for more information about other modes."
  1.1951  
  1.1952 -exit $EXIT_SUCCESS
  1.1953 +exit $?
  1.1954  
  1.1955  # The TAGs below are defined such that we never get into a situation
  1.1956  # in which we disable both kinds of libraries.  Given conflicting
  1.1957 @@ -6443,12 +6905,11 @@
  1.1958  # configuration.  But we'll never go from static-only to shared-only.
  1.1959  
  1.1960  # ### BEGIN LIBTOOL TAG CONFIG: disable-shared
  1.1961 -build_libtool_libs=no
  1.1962 -build_old_libs=yes
  1.1963 +disable_libs=shared
  1.1964  # ### END LIBTOOL TAG CONFIG: disable-shared
  1.1965  
  1.1966  # ### BEGIN LIBTOOL TAG CONFIG: disable-static
  1.1967 -build_old_libs=`case $build_libtool_libs in yes) $echo no;; *) $echo yes;; esac`
  1.1968 +disable_libs=static
  1.1969  # ### END LIBTOOL TAG CONFIG: disable-static
  1.1970  
  1.1971  # Local Variables: