ltmain.sh
changeset 292 bc9ab72cd7ff
parent 248 b347450523a6
     1.1 --- a/ltmain.sh	Sun Apr 30 04:37:24 2006 +0000
     1.2 +++ b/ltmain.sh	Sun Apr 30 04:53:56 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 @@ -1344,24 +1413,18 @@
   1.492  	  finalize_command="$finalize_command $qarg"
   1.493  	  continue
   1.494  	  ;;
   1.495 -	framework)
   1.496 -	  case $host in
   1.497 -	    *-*-darwin*)
   1.498 -	      case "$deplibs " in
   1.499 -	        *" $qarg.framework "*) ;;
   1.500 -		*) deplibs="$deplibs $qarg.framework" # this is fixed later
   1.501 -		   ;;
   1.502 -              esac
   1.503 -              ;;
   1.504 -   	  esac
   1.505 - 	  prev=
   1.506 - 	  continue
   1.507 - 	  ;;
   1.508  	shrext)
   1.509    	  shrext_cmds="$arg"
   1.510  	  prev=
   1.511  	  continue
   1.512  	  ;;
   1.513 +	darwin_framework|darwin_framework_skip)
   1.514 +	  test "$prev" = "darwin_framework" && compiler_flags="$compiler_flags $arg"
   1.515 +	  compile_command="$compile_command $arg"
   1.516 +	  finalize_command="$finalize_command $arg"
   1.517 +	  prev=
   1.518 +	  continue
   1.519 +	  ;;
   1.520  	*)
   1.521  	  eval "$prev=\"\$arg\""
   1.522  	  prev=
   1.523 @@ -1420,6 +1483,18 @@
   1.524  	continue
   1.525  	;;
   1.526  
   1.527 +      -framework|-arch|-isysroot)
   1.528 +	case " $CC " in
   1.529 +	  *" ${arg} ${1} "* | *" ${arg}	${1} "*) 
   1.530 +		prev=darwin_framework_skip ;;
   1.531 +	  *) compiler_flags="$compiler_flags $arg"
   1.532 +	     prev=darwin_framework ;;
   1.533 +	esac
   1.534 +	compile_command="$compile_command $arg"
   1.535 +	finalize_command="$finalize_command $arg"
   1.536 +	continue
   1.537 +	;;
   1.538 +
   1.539        -inst-prefix-dir)
   1.540  	prev=inst_prefix
   1.541  	continue
   1.542 @@ -1446,7 +1521,8 @@
   1.543  	  absdir=`cd "$dir" && pwd`
   1.544  	  if test -z "$absdir"; then
   1.545  	    $echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2
   1.546 -	    exit $EXIT_FAILURE
   1.547 +	    absdir="$dir"
   1.548 +	    notinst_path="$notinst_path $dir"
   1.549  	  fi
   1.550  	  dir="$absdir"
   1.551  	  ;;
   1.552 @@ -1460,10 +1536,15 @@
   1.553  	esac
   1.554  	case $host in
   1.555  	*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
   1.556 +	  testbindir=`$echo "X$dir" | $Xsed -e 's*/lib$*/bin*'`
   1.557  	  case :$dllsearchpath: in
   1.558  	  *":$dir:"*) ;;
   1.559  	  *) dllsearchpath="$dllsearchpath:$dir";;
   1.560  	  esac
   1.561 +	  case :$dllsearchpath: in
   1.562 +	  *":$testbindir:"*) ;;
   1.563 +	  *) dllsearchpath="$dllsearchpath:$testbindir";;
   1.564 +	  esac
   1.565  	  ;;
   1.566  	esac
   1.567  	continue
   1.568 @@ -1472,15 +1553,15 @@
   1.569        -l*)
   1.570  	if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then
   1.571  	  case $host in
   1.572 -	  *-*-cygwin* | *-*-pw32* | *-*-beos*)
   1.573 +	  *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos*)
   1.574  	    # These systems don't actually have a C or math library (as such)
   1.575  	    continue
   1.576  	    ;;
   1.577 -	  *-*-mingw* | *-*-os2*)
   1.578 +	  *-*-os2*)
   1.579  	    # These systems don't actually have a C library (as such)
   1.580  	    test "X$arg" = "X-lc" && continue
   1.581  	    ;;
   1.582 -	  *-*-openbsd* | *-*-freebsd*)
   1.583 +	  *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
   1.584  	    # Do not include libc due to us having libc/libc_r.
   1.585  	    test "X$arg" = "X-lc" && continue
   1.586  	    ;;
   1.587 @@ -1488,10 +1569,19 @@
   1.588  	    # Rhapsody C and math libraries are in the System framework
   1.589  	    deplibs="$deplibs -framework System"
   1.590  	    continue
   1.591 +	    ;;
   1.592 +	  *-*-sco3.2v5* | *-*-sco5v6*)
   1.593 +	    # Causes problems with __ctype
   1.594 +	    test "X$arg" = "X-lc" && continue
   1.595 +	    ;;
   1.596 +	  *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
   1.597 +	    # Compiler inserts libc in the correct place for threads to work
   1.598 +	    test "X$arg" = "X-lc" && continue
   1.599 +	    ;;
   1.600  	  esac
   1.601  	elif test "X$arg" = "X-lc_r"; then
   1.602  	 case $host in
   1.603 -	 *-*-openbsd* | *-*-freebsd*)
   1.604 +	 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
   1.605  	   # Do not include libc_r directly, use -pthread flag.
   1.606  	   continue
   1.607  	   ;;
   1.608 @@ -1501,8 +1591,20 @@
   1.609  	continue
   1.610  	;;
   1.611  
   1.612 +      # Tru64 UNIX uses -model [arg] to determine the layout of C++
   1.613 +      # classes, name mangling, and exception handling.
   1.614 +      -model)
   1.615 +	compile_command="$compile_command $arg"
   1.616 +	compiler_flags="$compiler_flags $arg"
   1.617 +	finalize_command="$finalize_command $arg"
   1.618 +	prev=xcompiler
   1.619 +	continue
   1.620 +	;;
   1.621 +
   1.622       -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe)
   1.623 -	deplibs="$deplibs $arg"
   1.624 +	compiler_flags="$compiler_flags $arg"
   1.625 +	compile_command="$compile_command $arg"
   1.626 +	finalize_command="$finalize_command $arg"
   1.627  	continue
   1.628  	;;
   1.629  
   1.630 @@ -1511,13 +1613,19 @@
   1.631  	continue
   1.632  	;;
   1.633  
   1.634 -      # gcc -m* arguments should be passed to the linker via $compiler_flags
   1.635 -      # in order to pass architecture information to the linker
   1.636 -      # (e.g. 32 vs 64-bit).  This may also be accomplished via -Wl,-mfoo
   1.637 -      # but this is not reliable with gcc because gcc may use -mfoo to
   1.638 -      # select a different linker, different libraries, etc, while
   1.639 -      # -Wl,-mfoo simply passes -mfoo to the linker.
   1.640 -      -m*)
   1.641 +      # -64, -mips[0-9] enable 64-bit mode on the SGI compiler
   1.642 +      # -r[0-9][0-9]* specifies the processor on the SGI compiler
   1.643 +      # -xarch=*, -xtarget=* enable 64-bit mode on the Sun compiler
   1.644 +      # +DA*, +DD* enable 64-bit mode on the HP compiler
   1.645 +      # -q* pass through compiler args for the IBM compiler
   1.646 +      # -m* pass through architecture-specific compiler args for GCC
   1.647 +      # -m*, -t[45]*, -txscale* pass through architecture-specific
   1.648 +      # compiler args for GCC
   1.649 +      # -pg pass through profiling flag for GCC
   1.650 +      # @file GCC response files
   1.651 +      -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*|-pg| \
   1.652 +      -t[45]*|-txscale*|@*)
   1.653 +
   1.654  	# Unknown arguments in both finalize_command and compile_command need
   1.655  	# to be aesthetically quoted because they are evaled later.
   1.656  	arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
   1.657 @@ -1528,9 +1636,7 @@
   1.658  	esac
   1.659          compile_command="$compile_command $arg"
   1.660          finalize_command="$finalize_command $arg"
   1.661 -        if test "$with_gcc" = "yes" ; then
   1.662 -          compiler_flags="$compiler_flags $arg"
   1.663 -        fi
   1.664 +        compiler_flags="$compiler_flags $arg"
   1.665          continue
   1.666          ;;
   1.667  
   1.668 @@ -1683,11 +1789,6 @@
   1.669  	continue
   1.670  	;;
   1.671  
   1.672 -      -framework)
   1.673 -        prev=framework
   1.674 -	continue
   1.675 -	;;
   1.676 -
   1.677        # Some other compiler flag.
   1.678        -* | +*)
   1.679  	# Unknown arguments in both finalize_command and compile_command need
   1.680 @@ -1773,6 +1874,11 @@
   1.681  	    if test -z "$pic_object" || test "$pic_object" = none ; then
   1.682  	      arg="$non_pic_object"
   1.683  	    fi
   1.684 +	  else
   1.685 +	    # If the PIC object exists, use it instead.
   1.686 +	    # $xdir was prepended to $pic_object above.
   1.687 +	    non_pic_object="$pic_object"
   1.688 +	    non_pic_objects="$non_pic_objects $non_pic_object"
   1.689  	  fi
   1.690  	else
   1.691  	  # Only an error if not doing a dry-run.
   1.692 @@ -1878,9 +1984,9 @@
   1.693      if test ! -d "$output_objdir"; then
   1.694        $show "$mkdir $output_objdir"
   1.695        $run $mkdir $output_objdir
   1.696 -      status=$?
   1.697 -      if test "$status" -ne 0 && test ! -d "$output_objdir"; then
   1.698 -	exit $status
   1.699 +      exit_status=$?
   1.700 +      if test "$exit_status" -ne 0 && test ! -d "$output_objdir"; then
   1.701 +	exit $exit_status
   1.702        fi
   1.703      fi
   1.704  
   1.705 @@ -1943,7 +2049,6 @@
   1.706      newlib_search_path=
   1.707      need_relink=no # whether we're linking any uninstalled libtool libraries
   1.708      notinst_deplibs= # not-installed libtool libraries
   1.709 -    notinst_path= # paths that contain not-installed libtool libraries
   1.710      case $linkmode in
   1.711      lib)
   1.712  	passes="conv link"
   1.713 @@ -1995,7 +2100,7 @@
   1.714  	    compile_deplibs="$deplib $compile_deplibs"
   1.715  	    finalize_deplibs="$deplib $finalize_deplibs"
   1.716  	  else
   1.717 -	    deplibs="$deplib $deplibs"
   1.718 +	    compiler_flags="$compiler_flags $deplib"
   1.719  	  fi
   1.720  	  continue
   1.721  	  ;;
   1.722 @@ -2004,10 +2109,6 @@
   1.723  	    $echo "$modename: warning: \`-l' is ignored for archives/objects" 1>&2
   1.724  	    continue
   1.725  	  fi
   1.726 -	  if test "$pass" = conv; then
   1.727 -	    deplibs="$deplib $deplibs"
   1.728 -	    continue
   1.729 -	  fi
   1.730  	  name=`$echo "X$deplib" | $Xsed -e 's/^-l//'`
   1.731  	  for searchdir in $newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path; do
   1.732  	    for search_ext in .la $std_shrext .so .a; do
   1.733 @@ -2071,18 +2172,6 @@
   1.734  	    fi
   1.735  	  fi
   1.736  	  ;; # -l
   1.737 -	*.framework)
   1.738 -	  if test "$linkmode,$pass" = "prog,link"; then
   1.739 -	    compile_deplibs="$deplib $compile_deplibs"
   1.740 -	    finalize_deplibs="$deplib $finalize_deplibs"
   1.741 -	  else
   1.742 -	    deplibs="$deplib $deplibs"
   1.743 -	    if test "$linkmode" = lib ; then
   1.744 -	      newdependency_libs="$deplib $newdependency_libs"
   1.745 -	    fi
   1.746 -	  fi
   1.747 -	  continue
   1.748 -	  ;;
   1.749  	-L*)
   1.750  	  case $linkmode in
   1.751  	  lib)
   1.752 @@ -2195,7 +2284,7 @@
   1.753  	esac # case $deplib
   1.754  	if test "$found" = yes || test -f "$lib"; then :
   1.755  	else
   1.756 -	  $echo "$modename: cannot find the library \`$lib'" 1>&2
   1.757 +	  $echo "$modename: cannot find the library \`$lib' or unhandled argument \`$deplib'" 1>&2
   1.758  	  exit $EXIT_FAILURE
   1.759  	fi
   1.760  
   1.761 @@ -2219,6 +2308,8 @@
   1.762  	# it will not redefine variables installed, or shouldnotlink
   1.763  	installed=yes
   1.764  	shouldnotlink=no
   1.765 +	avoidtemprpath=
   1.766 +
   1.767  
   1.768  	# Read the .la file
   1.769  	case $lib in
   1.770 @@ -2226,13 +2317,6 @@
   1.771  	*) . ./$lib ;;
   1.772  	esac
   1.773  
   1.774 -	case $host in
   1.775 -	*-*-darwin*)
   1.776 -	  # Convert "-framework foo" to "foo.framework" in dependency_libs
   1.777 -	  test -n "$dependency_libs" && dependency_libs=`$echo "X$dependency_libs" | $Xsed -e 's/-framework \([^ $]*\)/\1.framework/g'`
   1.778 -	  ;;
   1.779 -	esac
   1.780 -
   1.781  	if test "$linkmode,$pass" = "lib,link" ||
   1.782  	   test "$linkmode,$pass" = "prog,scan" ||
   1.783  	   { test "$linkmode" != prog && test "$linkmode" != lib; }; then
   1.784 @@ -2324,6 +2408,7 @@
   1.785  	    dir="$libdir"
   1.786  	    absdir="$libdir"
   1.787  	  fi
   1.788 +	  test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes
   1.789  	else
   1.790  	  if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then
   1.791  	    dir="$ladir"
   1.792 @@ -2408,12 +2493,12 @@
   1.793  	  if test -n "$library_names" &&
   1.794  	     { test "$prefer_static_libs" = no || test -z "$old_library"; }; then
   1.795  	    # We need to hardcode the library path
   1.796 -	    if test -n "$shlibpath_var"; then
   1.797 +	    if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then
   1.798  	      # Make sure the rpath contains only unique directories.
   1.799  	      case "$temp_rpath " in
   1.800  	      *" $dir "*) ;;
   1.801  	      *" $absdir "*) ;;
   1.802 -	      *) temp_rpath="$temp_rpath $dir" ;;
   1.803 +	      *) temp_rpath="$temp_rpath $absdir" ;;
   1.804  	      esac
   1.805  	    fi
   1.806  
   1.807 @@ -2450,8 +2535,12 @@
   1.808  	fi
   1.809  
   1.810  	link_static=no # Whether the deplib will be linked statically
   1.811 +	use_static_libs=$prefer_static_libs
   1.812 +	if test "$use_static_libs" = built && test "$installed" = yes ; then
   1.813 +	  use_static_libs=no
   1.814 +	fi
   1.815  	if test -n "$library_names" &&
   1.816 -	   { test "$prefer_static_libs" = no || test -z "$old_library"; }; then
   1.817 +	   { test "$use_static_libs" = no || test -z "$old_library"; }; then
   1.818  	  if test "$installed" = no; then
   1.819  	    notinst_deplibs="$notinst_deplibs $lib"
   1.820  	    need_relink=yes
   1.821 @@ -2564,11 +2653,15 @@
   1.822  	      if test "$hardcode_direct" = no; then
   1.823  		add="$dir/$linklib"
   1.824  		case $host in
   1.825 -		  *-*-sco3.2v5* ) add_dir="-L$dir" ;;
   1.826 +		  *-*-sco3.2v5.0.[024]*) add_dir="-L$dir" ;;
   1.827 +		  *-*-sysv4*uw2*) add_dir="-L$dir" ;;
   1.828 +		  *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \
   1.829 +		    *-*-unixware7*) add_dir="-L$dir" ;;
   1.830  		  *-*-darwin* )
   1.831  		    # if the lib is a module then we can not link against
   1.832  		    # it, someone is ignoring the new warnings I added
   1.833 -		    if /usr/bin/file -L $add 2> /dev/null | $EGREP "bundle" >/dev/null ; then
   1.834 +		    if /usr/bin/file -L $add 2> /dev/null |
   1.835 +                      $EGREP ": [^:]* bundle" >/dev/null ; then
   1.836  		      $echo "** Warning, lib $linklib is a module, not a shared library"
   1.837  		      if test -z "$old_library" ; then
   1.838  		        $echo
   1.839 @@ -2599,7 +2692,7 @@
   1.840  		add_dir="-L$dir"
   1.841  		# Try looking first in the location we're being installed to.
   1.842  		if test -n "$inst_prefix_dir"; then
   1.843 -		  case "$libdir" in
   1.844 +		  case $libdir in
   1.845  		    [\\/]*)
   1.846  		      add_dir="$add_dir -L$inst_prefix_dir$libdir"
   1.847  		      ;;
   1.848 @@ -2672,7 +2765,7 @@
   1.849  	      add_dir="-L$libdir"
   1.850  	      # Try looking first in the location we're being installed to.
   1.851  	      if test -n "$inst_prefix_dir"; then
   1.852 -		case "$libdir" in
   1.853 +		case $libdir in
   1.854  		  [\\/]*)
   1.855  		    add_dir="$add_dir -L$inst_prefix_dir$libdir"
   1.856  		    ;;
   1.857 @@ -2733,8 +2826,6 @@
   1.858  	      fi
   1.859  	    fi
   1.860  	  else
   1.861 -	    convenience="$convenience $dir/$old_library"
   1.862 -	    old_convenience="$old_convenience $dir/$old_library"
   1.863  	    deplibs="$dir/$old_library $deplibs"
   1.864  	    link_static=yes
   1.865  	  fi
   1.866 @@ -2846,26 +2937,19 @@
   1.867  		  done
   1.868  		  path=""
   1.869  		  ;;
   1.870 -	      *.framework)
   1.871 -		case $host in
   1.872 -		  *-*-darwin*)
   1.873 -		    depdepl="$deplib"
   1.874 -		    ;;
   1.875 -		esac
   1.876 -		;;
   1.877  		*) continue ;;
   1.878  		esac
   1.879  		;;
   1.880  	      *) continue ;;
   1.881  	      esac
   1.882  	      case " $deplibs " in
   1.883 +	      *" $path "*) ;;
   1.884 +	      *) deplibs="$path $deplibs" ;;
   1.885 +	      esac
   1.886 +	      case " $deplibs " in
   1.887  	      *" $depdepl "*) ;;
   1.888  	      *) deplibs="$depdepl $deplibs" ;;
   1.889  	      esac
   1.890 -	      case " $deplibs " in
   1.891 -	      *" $path "*) ;;
   1.892 -	      *) deplibs="$deplibs $path" ;;
   1.893 -	      esac
   1.894  	    done
   1.895  	  fi # link_all_deplibs != no
   1.896  	fi # linkmode = lib
   1.897 @@ -3129,27 +3213,27 @@
   1.898  
   1.899  	# Check that each of the things are valid numbers.
   1.900  	case $current in
   1.901 -	0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;;
   1.902 +	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.903  	*)
   1.904 -	  $echo "$modename: CURRENT \`$current' is not a nonnegative integer" 1>&2
   1.905 +	  $echo "$modename: CURRENT \`$current' must be a nonnegative integer" 1>&2
   1.906  	  $echo "$modename: \`$vinfo' is not valid version information" 1>&2
   1.907  	  exit $EXIT_FAILURE
   1.908  	  ;;
   1.909  	esac
   1.910  
   1.911  	case $revision in
   1.912 -	0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;;
   1.913 +	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.914  	*)
   1.915 -	  $echo "$modename: REVISION \`$revision' is not a nonnegative integer" 1>&2
   1.916 +	  $echo "$modename: REVISION \`$revision' must be a nonnegative integer" 1>&2
   1.917  	  $echo "$modename: \`$vinfo' is not valid version information" 1>&2
   1.918  	  exit $EXIT_FAILURE
   1.919  	  ;;
   1.920  	esac
   1.921  
   1.922  	case $age in
   1.923 -	0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;;
   1.924 +	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.925  	*)
   1.926 -	  $echo "$modename: AGE \`$age' is not a nonnegative integer" 1>&2
   1.927 +	  $echo "$modename: AGE \`$age' must be a nonnegative integer" 1>&2
   1.928  	  $echo "$modename: \`$vinfo' is not valid version information" 1>&2
   1.929  	  exit $EXIT_FAILURE
   1.930  	  ;;
   1.931 @@ -3328,9 +3412,9 @@
   1.932  
   1.933        # Eliminate all temporary directories.
   1.934        for path in $notinst_path; do
   1.935 -	lib_search_path=`$echo "$lib_search_path " | ${SED} -e 's% $path % %g'`
   1.936 -	deplibs=`$echo "$deplibs " | ${SED} -e 's% -L$path % %g'`
   1.937 -	dependency_libs=`$echo "$dependency_libs " | ${SED} -e 's% -L$path % %g'`
   1.938 +	lib_search_path=`$echo "$lib_search_path " | ${SED} -e "s% $path % %g"`
   1.939 +	deplibs=`$echo "$deplibs " | ${SED} -e "s% -L$path % %g"`
   1.940 +	dependency_libs=`$echo "$dependency_libs " | ${SED} -e "s% -L$path % %g"`
   1.941        done
   1.942  
   1.943        if test -n "$xrpath"; then
   1.944 @@ -3381,9 +3465,14 @@
   1.945  	  *-*-netbsd*)
   1.946  	    # Don't link with libc until the a.out ld.so is fixed.
   1.947  	    ;;
   1.948 -	  *-*-openbsd* | *-*-freebsd*)
   1.949 +	  *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
   1.950  	    # Do not include libc due to us having libc/libc_r.
   1.951 -	    test "X$arg" = "X-lc" && continue
   1.952 +	    ;;
   1.953 +	  *-*-sco3.2v5* | *-*-sco5v6*)
   1.954 +	    # Causes problems with __ctype
   1.955 +	    ;;
   1.956 +	  *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
   1.957 +	    # Compiler inserts libc in the correct place for threads to work
   1.958  	    ;;
   1.959   	  *)
   1.960  	    # Add libc to deplibs on all other systems if necessary.
   1.961 @@ -3427,11 +3516,11 @@
   1.962  	  int main() { return 0; }
   1.963  EOF
   1.964  	  $rm conftest
   1.965 -	  $LTCC -o conftest conftest.c $deplibs
   1.966 +	  $LTCC $LTCFLAGS -o conftest conftest.c $deplibs
   1.967  	  if test "$?" -eq 0 ; then
   1.968  	    ldd_output=`ldd conftest`
   1.969  	    for i in $deplibs; do
   1.970 -	      name="`expr $i : '-l\(.*\)'`"
   1.971 +	      name=`expr $i : '-l\(.*\)'`
   1.972  	      # If $name is empty we are operating on a -L argument.
   1.973                if test "$name" != "" && test "$name" -ne "0"; then
   1.974  		if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
   1.975 @@ -3468,11 +3557,11 @@
   1.976  	    # Error occurred in the first compile.  Let's try to salvage
   1.977  	    # the situation: Compile a separate program for each library.
   1.978  	    for i in $deplibs; do
   1.979 -	      name="`expr $i : '-l\(.*\)'`"
   1.980 +	      name=`expr $i : '-l\(.*\)'`
   1.981  	      # If $name is empty we are operating on a -L argument.
   1.982                if test "$name" != "" && test "$name" != "0"; then
   1.983  		$rm conftest
   1.984 -		$LTCC -o conftest conftest.c $i
   1.985 +		$LTCC $LTCFLAGS -o conftest conftest.c $i
   1.986  		# Did it work?
   1.987  		if test "$?" -eq 0 ; then
   1.988  		  ldd_output=`ldd conftest`
   1.989 @@ -3520,7 +3609,7 @@
   1.990  	  set dummy $deplibs_check_method
   1.991  	  file_magic_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
   1.992  	  for a_deplib in $deplibs; do
   1.993 -	    name="`expr $a_deplib : '-l\(.*\)'`"
   1.994 +	    name=`expr $a_deplib : '-l\(.*\)'`
   1.995  	    # If $name is empty we are operating on a -L argument.
   1.996              if test "$name" != "" && test  "$name" != "0"; then
   1.997  	      if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
   1.998 @@ -3589,7 +3678,7 @@
   1.999  	  set dummy $deplibs_check_method
  1.1000  	  match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
  1.1001  	  for a_deplib in $deplibs; do
  1.1002 -	    name="`expr $a_deplib : '-l\(.*\)'`"
  1.1003 +	    name=`expr $a_deplib : '-l\(.*\)'`
  1.1004  	    # If $name is empty we are operating on a -L argument.
  1.1005  	    if test -n "$name" && test "$name" != "0"; then
  1.1006  	      if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
  1.1007 @@ -3715,17 +3804,39 @@
  1.1008  	    fi
  1.1009  	  fi
  1.1010  	fi
  1.1011 -	# Time to change all our "foo.framework" stuff back to "-framework foo"
  1.1012 -	case $host in
  1.1013 -	  *-*-darwin*)
  1.1014 -	    newdeplibs=`$echo "X $newdeplibs" | $Xsed -e 's% \([^ $]*\).framework% -framework \1%g'`
  1.1015 -	    dependency_libs=`$echo "X $dependency_libs" | $Xsed -e 's% \([^ $]*\).framework%%g'`
  1.1016 -	    ;;
  1.1017 -	esac
  1.1018  	# Done checking deplibs!
  1.1019  	deplibs=$newdeplibs
  1.1020        fi
  1.1021  
  1.1022 +
  1.1023 +      # move library search paths that coincide with paths to not yet
  1.1024 +      # installed libraries to the beginning of the library search list
  1.1025 +      new_libs=
  1.1026 +      for path in $notinst_path; do
  1.1027 +	case " $new_libs " in
  1.1028 +	*" -L$path/$objdir "*) ;;
  1.1029 +	*)
  1.1030 +	  case " $deplibs " in
  1.1031 +	  *" -L$path/$objdir "*)
  1.1032 +	    new_libs="$new_libs -L$path/$objdir" ;;
  1.1033 +	  esac
  1.1034 +	  ;;
  1.1035 +	esac
  1.1036 +      done
  1.1037 +      for deplib in $deplibs; do
  1.1038 +	case $deplib in
  1.1039 +	-L*)
  1.1040 +	  case " $new_libs " in
  1.1041 +	  *" $deplib "*) ;;
  1.1042 +	  *) new_libs="$new_libs $deplib" ;;
  1.1043 +	  esac
  1.1044 +	  ;;
  1.1045 +	*) new_libs="$new_libs $deplib" ;;
  1.1046 +	esac
  1.1047 +      done
  1.1048 +      deplibs="$new_libs"
  1.1049 +
  1.1050 +
  1.1051        # All the library-specific variables (install_libdir is set above).
  1.1052        library_names=
  1.1053        old_library=
  1.1054 @@ -3809,6 +3920,7 @@
  1.1055  	fi
  1.1056  
  1.1057  	lib="$output_objdir/$realname"
  1.1058 +	linknames=
  1.1059  	for link
  1.1060  	do
  1.1061  	  linknames="$linknames $link"
  1.1062 @@ -3837,6 +3949,9 @@
  1.1063  	        # The command line is too long to execute in one step.
  1.1064  	        $show "using reloadable object file for export list..."
  1.1065  	        skipped_export=:
  1.1066 +		# Break out early, otherwise skipped_export may be
  1.1067 +		# set to false by a later but shorter cmd.
  1.1068 +		break
  1.1069  	      fi
  1.1070  	    done
  1.1071  	    IFS="$save_ifs"
  1.1072 @@ -3906,7 +4021,8 @@
  1.1073  	  fi
  1.1074  	fi
  1.1075  
  1.1076 -	if test "X$skipped_export" != "X:" && len=`expr "X$test_cmds" : ".*"` &&
  1.1077 +	if test "X$skipped_export" != "X:" &&
  1.1078 +	   len=`expr "X$test_cmds" : ".*" 2>/dev/null` &&
  1.1079  	   test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
  1.1080  	  :
  1.1081  	else
  1.1082 @@ -3925,6 +4041,7 @@
  1.1083  	    save_libobjs=$libobjs
  1.1084  	  fi
  1.1085  	  save_output=$output
  1.1086 +	  output_la=`$echo "X$output" | $Xsed -e "$basename"`
  1.1087  
  1.1088  	  # Clear the reloadable object creation command queue and
  1.1089  	  # initialize k to one.
  1.1090 @@ -3934,13 +4051,13 @@
  1.1091  	  delfiles=
  1.1092  	  last_robj=
  1.1093  	  k=1
  1.1094 -	  output=$output_objdir/$save_output-${k}.$objext
  1.1095 +	  output=$output_objdir/$output_la-${k}.$objext
  1.1096  	  # Loop over the list of objects to be linked.
  1.1097  	  for obj in $save_libobjs
  1.1098  	  do
  1.1099  	    eval test_cmds=\"$reload_cmds $objlist $last_robj\"
  1.1100  	    if test "X$objlist" = X ||
  1.1101 -	       { len=`expr "X$test_cmds" : ".*"` &&
  1.1102 +	       { len=`expr "X$test_cmds" : ".*" 2>/dev/null` &&
  1.1103  		 test "$len" -le "$max_cmd_len"; }; then
  1.1104  	      objlist="$objlist $obj"
  1.1105  	    else
  1.1106 @@ -3954,9 +4071,9 @@
  1.1107  		# the last one created.
  1.1108  		eval concat_cmds=\"\$concat_cmds~$reload_cmds $objlist $last_robj\"
  1.1109  	      fi
  1.1110 -	      last_robj=$output_objdir/$save_output-${k}.$objext
  1.1111 +	      last_robj=$output_objdir/$output_la-${k}.$objext
  1.1112  	      k=`expr $k + 1`
  1.1113 -	      output=$output_objdir/$save_output-${k}.$objext
  1.1114 +	      output=$output_objdir/$output_la-${k}.$objext
  1.1115  	      objlist=$obj
  1.1116  	      len=1
  1.1117  	    fi
  1.1118 @@ -3976,13 +4093,13 @@
  1.1119  	    eval concat_cmds=\"\$concat_cmds~$export_symbols_cmds\"
  1.1120            fi
  1.1121  
  1.1122 -	  # Set up a command to remove the reloadale object files
  1.1123 +	  # Set up a command to remove the reloadable object files
  1.1124  	  # after they are used.
  1.1125  	  i=0
  1.1126  	  while test "$i" -lt "$k"
  1.1127  	  do
  1.1128  	    i=`expr $i + 1`
  1.1129 -	    delfiles="$delfiles $output_objdir/$save_output-${i}.$objext"
  1.1130 +	    delfiles="$delfiles $output_objdir/$output_la-${i}.$objext"
  1.1131  	  done
  1.1132  
  1.1133  	  $echo "creating a temporary reloadable object file: $output"
  1.1134 @@ -4030,13 +4147,30 @@
  1.1135  	  IFS="$save_ifs"
  1.1136  	  eval cmd=\"$cmd\"
  1.1137  	  $show "$cmd"
  1.1138 -	  $run eval "$cmd" || exit $?
  1.1139 +	  $run eval "$cmd" || {
  1.1140 +	    lt_exit=$?
  1.1141 +
  1.1142 +	    # Restore the uninstalled library and exit
  1.1143 +	    if test "$mode" = relink; then
  1.1144 +	      $run eval '(cd $output_objdir && $rm ${realname}T && $mv ${realname}U $realname)'
  1.1145 +	    fi
  1.1146 +
  1.1147 +	    exit $lt_exit
  1.1148 +	  }
  1.1149  	done
  1.1150  	IFS="$save_ifs"
  1.1151  
  1.1152  	# Restore the uninstalled library and exit
  1.1153  	if test "$mode" = relink; then
  1.1154  	  $run eval '(cd $output_objdir && $rm ${realname}T && $mv $realname ${realname}T && $mv "$realname"U $realname)' || exit $?
  1.1155 +
  1.1156 +	  if test -n "$convenience"; then
  1.1157 +	    if test -z "$whole_archive_flag_spec"; then
  1.1158 +	      $show "${rm}r $gentop"
  1.1159 +	      $run ${rm}r "$gentop"
  1.1160 +	    fi
  1.1161 +	  fi
  1.1162 +
  1.1163  	  exit $EXIT_SUCCESS
  1.1164  	fi
  1.1165  
  1.1166 @@ -4209,18 +4343,44 @@
  1.1167        esac
  1.1168  
  1.1169        case $host in
  1.1170 -      *-*-darwin*)
  1.1171 +      *darwin*)
  1.1172          # Don't allow lazy linking, it breaks C++ global constructors
  1.1173          if test "$tagname" = CXX ; then
  1.1174          compile_command="$compile_command ${wl}-bind_at_load"
  1.1175          finalize_command="$finalize_command ${wl}-bind_at_load"
  1.1176          fi
  1.1177 -	# Time to change all our "foo.framework" stuff back to "-framework foo"
  1.1178 -	compile_deplibs=`$echo "X $compile_deplibs" | $Xsed -e 's% \([^ $]*\).framework% -framework \1%g'`
  1.1179 -	finalize_deplibs=`$echo "X $finalize_deplibs" | $Xsed -e 's% \([^ $]*\).framework% -framework \1%g'`
  1.1180          ;;
  1.1181        esac
  1.1182  
  1.1183 +
  1.1184 +      # move library search paths that coincide with paths to not yet
  1.1185 +      # installed libraries to the beginning of the library search list
  1.1186 +      new_libs=
  1.1187 +      for path in $notinst_path; do
  1.1188 +	case " $new_libs " in
  1.1189 +	*" -L$path/$objdir "*) ;;
  1.1190 +	*)
  1.1191 +	  case " $compile_deplibs " in
  1.1192 +	  *" -L$path/$objdir "*)
  1.1193 +	    new_libs="$new_libs -L$path/$objdir" ;;
  1.1194 +	  esac
  1.1195 +	  ;;
  1.1196 +	esac
  1.1197 +      done
  1.1198 +      for deplib in $compile_deplibs; do
  1.1199 +	case $deplib in
  1.1200 +	-L*)
  1.1201 +	  case " $new_libs " in
  1.1202 +	  *" $deplib "*) ;;
  1.1203 +	  *) new_libs="$new_libs $deplib" ;;
  1.1204 +	  esac
  1.1205 +	  ;;
  1.1206 +	*) new_libs="$new_libs $deplib" ;;
  1.1207 +	esac
  1.1208 +      done
  1.1209 +      compile_deplibs="$new_libs"
  1.1210 +
  1.1211 +
  1.1212        compile_command="$compile_command $compile_deplibs"
  1.1213        finalize_command="$finalize_command $finalize_deplibs"
  1.1214  
  1.1215 @@ -4265,10 +4425,15 @@
  1.1216  	fi
  1.1217  	case $host in
  1.1218  	*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
  1.1219 +	  testbindir=`$echo "X$libdir" | $Xsed -e 's*/lib$*/bin*'`
  1.1220  	  case :$dllsearchpath: in
  1.1221  	  *":$libdir:"*) ;;
  1.1222  	  *) dllsearchpath="$dllsearchpath:$libdir";;
  1.1223  	  esac
  1.1224 +	  case :$dllsearchpath: in
  1.1225 +	  *":$testbindir:"*) ;;
  1.1226 +	  *) dllsearchpath="$dllsearchpath:$testbindir";;
  1.1227 +	  esac
  1.1228  	  ;;
  1.1229  	esac
  1.1230        done
  1.1231 @@ -4382,13 +4547,25 @@
  1.1232  
  1.1233  	    # Prepare the list of exported symbols
  1.1234  	    if test -z "$export_symbols"; then
  1.1235 -	      export_symbols="$output_objdir/$output.exp"
  1.1236 +	      export_symbols="$output_objdir/$outputname.exp"
  1.1237  	      $run $rm $export_symbols
  1.1238 -	      $run eval "${SED} -n -e '/^: @PROGRAM@$/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
  1.1239 +	      $run eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
  1.1240 +              case $host in
  1.1241 +              *cygwin* | *mingw* )
  1.1242 +	        $run eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
  1.1243 +		$run eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"'
  1.1244 +                ;;
  1.1245 +              esac
  1.1246  	    else
  1.1247 -	      $run eval "${SED} -e 's/\([][.*^$]\)/\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$output.exp"'
  1.1248 -	      $run eval 'grep -f "$output_objdir/$output.exp" < "$nlist" > "$nlist"T'
  1.1249 +	      $run eval "${SED} -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"'
  1.1250 +	      $run eval 'grep -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T'
  1.1251  	      $run eval 'mv "$nlist"T "$nlist"'
  1.1252 +              case $host in
  1.1253 +              *cygwin* | *mingw* )
  1.1254 +	        $run eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
  1.1255 +		$run eval 'cat "$nlist" >> "$output_objdir/$outputname.def"'
  1.1256 +                ;;
  1.1257 +              esac
  1.1258  	    fi
  1.1259  	  fi
  1.1260  
  1.1261 @@ -4439,7 +4616,26 @@
  1.1262  #endif
  1.1263  
  1.1264  /* The mapping between symbol names and symbols. */
  1.1265 +"
  1.1266 +
  1.1267 +	    case $host in
  1.1268 +	    *cygwin* | *mingw* )
  1.1269 +	  $echo >> "$output_objdir/$dlsyms" "\
  1.1270 +/* DATA imports from DLLs on WIN32 can't be const, because
  1.1271 +   runtime relocations are performed -- see ld's documentation
  1.1272 +   on pseudo-relocs */
  1.1273 +struct {
  1.1274 +"
  1.1275 +	      ;;
  1.1276 +	    * )
  1.1277 +	  $echo >> "$output_objdir/$dlsyms" "\
  1.1278  const struct {
  1.1279 +"
  1.1280 +	      ;;
  1.1281 +	    esac
  1.1282 +
  1.1283 +
  1.1284 +	  $echo >> "$output_objdir/$dlsyms" "\
  1.1285    const char *name;
  1.1286    lt_ptr address;
  1.1287  }
  1.1288 @@ -4486,16 +4682,29 @@
  1.1289  	  esac
  1.1290  
  1.1291  	  # Now compile the dynamic symbol file.
  1.1292 -	  $show "(cd $output_objdir && $LTCC -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")"
  1.1293 -	  $run eval '(cd $output_objdir && $LTCC -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $?
  1.1294 +	  $show "(cd $output_objdir && $LTCC  $LTCFLAGS -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")"
  1.1295 +	  $run eval '(cd $output_objdir && $LTCC  $LTCFLAGS -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $?
  1.1296  
  1.1297  	  # Clean up the generated files.
  1.1298  	  $show "$rm $output_objdir/$dlsyms $nlist ${nlist}S ${nlist}T"
  1.1299  	  $run $rm "$output_objdir/$dlsyms" "$nlist" "${nlist}S" "${nlist}T"
  1.1300  
  1.1301  	  # Transform the symbol file into the correct name.
  1.1302 -	  compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
  1.1303 -	  finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
  1.1304 +          case $host in
  1.1305 +          *cygwin* | *mingw* )
  1.1306 +            if test -f "$output_objdir/${outputname}.def" ; then
  1.1307 +              compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}.def $output_objdir/${outputname}S.${objext}%"`
  1.1308 +              finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}.def $output_objdir/${outputname}S.${objext}%"`
  1.1309 +            else
  1.1310 +              compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
  1.1311 +              finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
  1.1312 +             fi
  1.1313 +            ;;
  1.1314 +          * )
  1.1315 +            compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
  1.1316 +            finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
  1.1317 +            ;;
  1.1318 +          esac
  1.1319  	  ;;
  1.1320  	*)
  1.1321  	  $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2
  1.1322 @@ -4520,7 +4729,7 @@
  1.1323  	# We have no uninstalled library dependencies, so finalize right now.
  1.1324  	$show "$link_command"
  1.1325  	$run eval "$link_command"
  1.1326 -	status=$?
  1.1327 +	exit_status=$?
  1.1328  
  1.1329  	# Delete the generated files.
  1.1330  	if test -n "$dlsyms"; then
  1.1331 @@ -4528,7 +4737,7 @@
  1.1332  	  $run $rm "$output_objdir/${outputname}S.${objext}"
  1.1333  	fi
  1.1334  
  1.1335 -	exit $status
  1.1336 +	exit $exit_status
  1.1337        fi
  1.1338  
  1.1339        if test -n "$shlibpath_var"; then
  1.1340 @@ -4668,10 +4877,12 @@
  1.1341  	esac
  1.1342  	case $host in
  1.1343  	  *cygwin* | *mingw* )
  1.1344 -	    cwrappersource=`$echo ${objdir}/lt-${output}.c`
  1.1345 -	    cwrapper=`$echo ${output}.exe`
  1.1346 -	    $rm $cwrappersource $cwrapper
  1.1347 -	    trap "$rm $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15
  1.1348 +            output_name=`basename $output`
  1.1349 +            output_path=`dirname $output`
  1.1350 +            cwrappersource="$output_path/$objdir/lt-$output_name.c"
  1.1351 +            cwrapper="$output_path/$output_name.exe"
  1.1352 +            $rm $cwrappersource $cwrapper
  1.1353 +            trap "$rm $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15
  1.1354  
  1.1355  	    cat > $cwrappersource <<EOF
  1.1356  
  1.1357 @@ -4696,6 +4907,9 @@
  1.1358  #include <malloc.h>
  1.1359  #include <stdarg.h>
  1.1360  #include <assert.h>
  1.1361 +#include <string.h>
  1.1362 +#include <ctype.h>
  1.1363 +#include <sys/stat.h>
  1.1364  
  1.1365  #if defined(PATH_MAX)
  1.1366  # define LT_PATHMAX PATH_MAX
  1.1367 @@ -4706,15 +4920,19 @@
  1.1368  #endif
  1.1369  
  1.1370  #ifndef DIR_SEPARATOR
  1.1371 -#define DIR_SEPARATOR '/'
  1.1372 +# define DIR_SEPARATOR '/'
  1.1373 +# define PATH_SEPARATOR ':'
  1.1374  #endif
  1.1375  
  1.1376  #if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \
  1.1377    defined (__OS2__)
  1.1378 -#define HAVE_DOS_BASED_FILE_SYSTEM
  1.1379 -#ifndef DIR_SEPARATOR_2
  1.1380 -#define DIR_SEPARATOR_2 '\\'
  1.1381 -#endif
  1.1382 +# define HAVE_DOS_BASED_FILE_SYSTEM
  1.1383 +# ifndef DIR_SEPARATOR_2
  1.1384 +#  define DIR_SEPARATOR_2 '\\'
  1.1385 +# endif
  1.1386 +# ifndef PATH_SEPARATOR_2
  1.1387 +#  define PATH_SEPARATOR_2 ';'
  1.1388 +# endif
  1.1389  #endif
  1.1390  
  1.1391  #ifndef DIR_SEPARATOR_2
  1.1392 @@ -4724,17 +4942,32 @@
  1.1393          (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2))
  1.1394  #endif /* DIR_SEPARATOR_2 */
  1.1395  
  1.1396 +#ifndef PATH_SEPARATOR_2
  1.1397 +# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR)
  1.1398 +#else /* PATH_SEPARATOR_2 */
  1.1399 +# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2)
  1.1400 +#endif /* PATH_SEPARATOR_2 */
  1.1401 +
  1.1402  #define XMALLOC(type, num)      ((type *) xmalloc ((num) * sizeof(type)))
  1.1403  #define XFREE(stale) do { \
  1.1404    if (stale) { free ((void *) stale); stale = 0; } \
  1.1405  } while (0)
  1.1406  
  1.1407 +/* -DDEBUG is fairly common in CFLAGS.  */
  1.1408 +#undef DEBUG
  1.1409 +#if defined DEBUGWRAPPER
  1.1410 +# define DEBUG(format, ...) fprintf(stderr, format, __VA_ARGS__)
  1.1411 +#else
  1.1412 +# define DEBUG(format, ...)
  1.1413 +#endif
  1.1414 +
  1.1415  const char *program_name = NULL;
  1.1416  
  1.1417  void * xmalloc (size_t num);
  1.1418  char * xstrdup (const char *string);
  1.1419 -char * basename (const char *name);
  1.1420 -char * fnqualify(const char *path);
  1.1421 +const char * base_name (const char *name);
  1.1422 +char * find_executable(const char *wrapper);
  1.1423 +int    check_executable(const char *path);
  1.1424  char * strendzap(char *str, const char *pat);
  1.1425  void lt_fatal (const char *message, ...);
  1.1426  
  1.1427 @@ -4744,29 +4977,51 @@
  1.1428    char **newargz;
  1.1429    int i;
  1.1430  
  1.1431 -  program_name = (char *) xstrdup ((char *) basename (argv[0]));
  1.1432 +  program_name = (char *) xstrdup (base_name (argv[0]));
  1.1433 +  DEBUG("(main) argv[0]      : %s\n",argv[0]);
  1.1434 +  DEBUG("(main) program_name : %s\n",program_name);
  1.1435    newargz = XMALLOC(char *, argc+2);
  1.1436  EOF
  1.1437  
  1.1438 -	    cat >> $cwrappersource <<EOF
  1.1439 -  newargz[0] = "$SHELL";
  1.1440 +            cat >> $cwrappersource <<EOF
  1.1441 +  newargz[0] = (char *) xstrdup("$SHELL");
  1.1442  EOF
  1.1443  
  1.1444 -	    cat >> $cwrappersource <<"EOF"
  1.1445 -  newargz[1] = fnqualify(argv[0]);
  1.1446 +            cat >> $cwrappersource <<"EOF"
  1.1447 +  newargz[1] = find_executable(argv[0]);
  1.1448 +  if (newargz[1] == NULL)
  1.1449 +    lt_fatal("Couldn't find %s", argv[0]);
  1.1450 +  DEBUG("(main) found exe at : %s\n",newargz[1]);
  1.1451    /* we know the script has the same name, without the .exe */
  1.1452    /* so make sure newargz[1] doesn't end in .exe */
  1.1453    strendzap(newargz[1],".exe");
  1.1454    for (i = 1; i < argc; i++)
  1.1455      newargz[i+1] = xstrdup(argv[i]);
  1.1456    newargz[argc+1] = NULL;
  1.1457 +
  1.1458 +  for (i=0; i<argc+1; i++)
  1.1459 +  {
  1.1460 +    DEBUG("(main) newargz[%d]   : %s\n",i,newargz[i]);
  1.1461 +    ;
  1.1462 +  }
  1.1463 +
  1.1464  EOF
  1.1465  
  1.1466 -	    cat >> $cwrappersource <<EOF
  1.1467 +            case $host_os in
  1.1468 +              mingw*)
  1.1469 +                cat >> $cwrappersource <<EOF
  1.1470 +  execv("$SHELL",(char const **)newargz);
  1.1471 +EOF
  1.1472 +              ;;
  1.1473 +              *)
  1.1474 +                cat >> $cwrappersource <<EOF
  1.1475    execv("$SHELL",newargz);
  1.1476  EOF
  1.1477 -
  1.1478 -	    cat >> $cwrappersource <<"EOF"
  1.1479 +              ;;
  1.1480 +            esac
  1.1481 +
  1.1482 +            cat >> $cwrappersource <<"EOF"
  1.1483 +  return 127;
  1.1484  }
  1.1485  
  1.1486  void *
  1.1487 @@ -4786,48 +5041,148 @@
  1.1488  ;
  1.1489  }
  1.1490  
  1.1491 -char *
  1.1492 -basename (const char *name)
  1.1493 +const char *
  1.1494 +base_name (const char *name)
  1.1495  {
  1.1496    const char *base;
  1.1497  
  1.1498  #if defined (HAVE_DOS_BASED_FILE_SYSTEM)
  1.1499    /* Skip over the disk name in MSDOS pathnames. */
  1.1500 -  if (isalpha (name[0]) && name[1] == ':')
  1.1501 +  if (isalpha ((unsigned char)name[0]) && name[1] == ':')
  1.1502      name += 2;
  1.1503  #endif
  1.1504  
  1.1505    for (base = name; *name; name++)
  1.1506      if (IS_DIR_SEPARATOR (*name))
  1.1507        base = name + 1;
  1.1508 -  return (char *) base;
  1.1509 +  return base;
  1.1510  }
  1.1511  
  1.1512 +int
  1.1513 +check_executable(const char * path)
  1.1514 +{
  1.1515 +  struct stat st;
  1.1516 +
  1.1517 +  DEBUG("(check_executable)  : %s\n", path ? (*path ? path : "EMPTY!") : "NULL!");
  1.1518 +  if ((!path) || (!*path))
  1.1519 +    return 0;
  1.1520 +
  1.1521 +  if ((stat (path, &st) >= 0) &&
  1.1522 +      (
  1.1523 +        /* MinGW & native WIN32 do not support S_IXOTH or S_IXGRP */
  1.1524 +#if defined (S_IXOTH)
  1.1525 +       ((st.st_mode & S_IXOTH) == S_IXOTH) ||
  1.1526 +#endif
  1.1527 +#if defined (S_IXGRP)
  1.1528 +       ((st.st_mode & S_IXGRP) == S_IXGRP) ||
  1.1529 +#endif
  1.1530 +       ((st.st_mode & S_IXUSR) == S_IXUSR))
  1.1531 +      )
  1.1532 +    return 1;
  1.1533 +  else
  1.1534 +    return 0;
  1.1535 +}
  1.1536 +
  1.1537 +/* Searches for the full path of the wrapper.  Returns
  1.1538 +   newly allocated full path name if found, NULL otherwise */
  1.1539  char *
  1.1540 -fnqualify(const char *path)
  1.1541 +find_executable (const char* wrapper)
  1.1542  {
  1.1543 -  size_t size;
  1.1544 -  char *p;
  1.1545 +  int has_slash = 0;
  1.1546 +  const char* p;
  1.1547 +  const char* p_next;
  1.1548 +  /* static buffer for getcwd */
  1.1549    char tmp[LT_PATHMAX + 1];
  1.1550 -
  1.1551 -  assert(path != NULL);
  1.1552 -
  1.1553 -  /* Is it qualified already? */
  1.1554 +  int tmp_len;
  1.1555 +  char* concat_name;
  1.1556 +
  1.1557 +  DEBUG("(find_executable)  : %s\n", wrapper ? (*wrapper ? wrapper : "EMPTY!") : "NULL!");
  1.1558 +
  1.1559 +  if ((wrapper == NULL) || (*wrapper == '\0'))
  1.1560 +    return NULL;
  1.1561 +
  1.1562 +  /* Absolute path? */
  1.1563 +#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
  1.1564 +  if (isalpha ((unsigned char)wrapper[0]) && wrapper[1] == ':')
  1.1565 +  {
  1.1566 +    concat_name = xstrdup (wrapper);
  1.1567 +    if (check_executable(concat_name))
  1.1568 +      return concat_name;
  1.1569 +    XFREE(concat_name);
  1.1570 +  }
  1.1571 +  else
  1.1572 +  {
  1.1573 +#endif
  1.1574 +    if (IS_DIR_SEPARATOR (wrapper[0]))
  1.1575 +    {
  1.1576 +      concat_name = xstrdup (wrapper);
  1.1577 +      if (check_executable(concat_name))
  1.1578 +        return concat_name;
  1.1579 +      XFREE(concat_name);
  1.1580 +    }
  1.1581  #if defined (HAVE_DOS_BASED_FILE_SYSTEM)
  1.1582 -  if (isalpha (path[0]) && path[1] == ':')
  1.1583 -    return xstrdup (path);
  1.1584 +  }
  1.1585  #endif
  1.1586 -  if (IS_DIR_SEPARATOR (path[0]))
  1.1587 -    return xstrdup (path);
  1.1588 -
  1.1589 -  /* prepend the current directory */
  1.1590 -  /* doesn't handle '~' */
  1.1591 +
  1.1592 +  for (p = wrapper; *p; p++)
  1.1593 +    if (*p == '/')
  1.1594 +    {
  1.1595 +      has_slash = 1;
  1.1596 +      break;
  1.1597 +    }
  1.1598 +  if (!has_slash)
  1.1599 +  {
  1.1600 +    /* no slashes; search PATH */
  1.1601 +    const char* path = getenv ("PATH");
  1.1602 +    if (path != NULL)
  1.1603 +    {
  1.1604 +      for (p = path; *p; p = p_next)
  1.1605 +      {
  1.1606 +        const char* q;
  1.1607 +        size_t p_len;
  1.1608 +        for (q = p; *q; q++)
  1.1609 +          if (IS_PATH_SEPARATOR(*q))
  1.1610 +            break;
  1.1611 +        p_len = q - p;
  1.1612 +        p_next = (*q == '\0' ? q : q + 1);
  1.1613 +        if (p_len == 0)
  1.1614 +        {
  1.1615 +          /* empty path: current directory */
  1.1616 +          if (getcwd (tmp, LT_PATHMAX) == NULL)
  1.1617 +            lt_fatal ("getcwd failed");
  1.1618 +          tmp_len = strlen(tmp);
  1.1619 +          concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1);
  1.1620 +          memcpy (concat_name, tmp, tmp_len);
  1.1621 +          concat_name[tmp_len] = '/';
  1.1622 +          strcpy (concat_name + tmp_len + 1, wrapper);
  1.1623 +        }
  1.1624 +        else
  1.1625 +        {
  1.1626 +          concat_name = XMALLOC(char, p_len + 1 + strlen(wrapper) + 1);
  1.1627 +          memcpy (concat_name, p, p_len);
  1.1628 +          concat_name[p_len] = '/';
  1.1629 +          strcpy (concat_name + p_len + 1, wrapper);
  1.1630 +        }
  1.1631 +        if (check_executable(concat_name))
  1.1632 +          return concat_name;
  1.1633 +        XFREE(concat_name);
  1.1634 +      }
  1.1635 +    }
  1.1636 +    /* not found in PATH; assume curdir */
  1.1637 +  }
  1.1638 +  /* Relative path | not found in path: prepend cwd */
  1.1639    if (getcwd (tmp, LT_PATHMAX) == NULL)
  1.1640      lt_fatal ("getcwd failed");
  1.1641 -  size = strlen(tmp) + 1 + strlen(path) + 1; /* +2 for '/' and '\0' */
  1.1642 -  p = XMALLOC(char, size);
  1.1643 -  sprintf(p, "%s%c%s", tmp, DIR_SEPARATOR, path);
  1.1644 -  return p;
  1.1645 +  tmp_len = strlen(tmp);
  1.1646 +  concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1);
  1.1647 +  memcpy (concat_name, tmp, tmp_len);
  1.1648 +  concat_name[tmp_len] = '/';
  1.1649 +  strcpy (concat_name + tmp_len + 1, wrapper);
  1.1650 +
  1.1651 +  if (check_executable(concat_name))
  1.1652 +    return concat_name;
  1.1653 +  XFREE(concat_name);
  1.1654 +  return NULL;
  1.1655  }
  1.1656  
  1.1657  char *
  1.1658 @@ -4871,16 +5226,16 @@
  1.1659    va_end (ap);
  1.1660  }
  1.1661  EOF
  1.1662 -	  # we should really use a build-platform specific compiler
  1.1663 -	  # here, but OTOH, the wrappers (shell script and this C one)
  1.1664 -	  # are only useful if you want to execute the "real" binary.
  1.1665 -	  # Since the "real" binary is built for $host, then this
  1.1666 -	  # wrapper might as well be built for $host, too.
  1.1667 -	  $run $LTCC -s -o $cwrapper $cwrappersource
  1.1668 -	  ;;
  1.1669 -	esac
  1.1670 -	$rm $output
  1.1671 -	trap "$rm $output; exit $EXIT_FAILURE" 1 2 15
  1.1672 +          # we should really use a build-platform specific compiler
  1.1673 +          # here, but OTOH, the wrappers (shell script and this C one)
  1.1674 +          # are only useful if you want to execute the "real" binary.
  1.1675 +          # Since the "real" binary is built for $host, then this
  1.1676 +          # wrapper might as well be built for $host, too.
  1.1677 +          $run $LTCC $LTCFLAGS -s -o $cwrapper $cwrappersource
  1.1678 +          ;;
  1.1679 +        esac
  1.1680 +        $rm $output
  1.1681 +        trap "$rm $output; exit $EXIT_FAILURE" 1 2 15
  1.1682  
  1.1683  	$echo > $output "\
  1.1684  #! $SHELL
  1.1685 @@ -5030,13 +5385,13 @@
  1.1686  	# Backslashes separate directories on plain windows
  1.1687  	*-*-mingw | *-*-os2*)
  1.1688  	  $echo >> $output "\
  1.1689 -      exec \$progdir\\\\\$program \${1+\"\$@\"}
  1.1690 +      exec \"\$progdir\\\\\$program\" \${1+\"\$@\"}
  1.1691  "
  1.1692  	  ;;
  1.1693  
  1.1694  	*)
  1.1695  	  $echo >> $output "\
  1.1696 -      exec \$progdir/\$program \${1+\"\$@\"}
  1.1697 +      exec \"\$progdir/\$program\" \${1+\"\$@\"}
  1.1698  "
  1.1699  	  ;;
  1.1700  	esac
  1.1701 @@ -5046,7 +5401,7 @@
  1.1702      fi
  1.1703    else
  1.1704      # The program doesn't exist.
  1.1705 -    \$echo \"\$0: error: \$progdir/\$program does not exist\" 1>&2
  1.1706 +    \$echo \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2
  1.1707      \$echo \"This script is just a wrapper for \$program.\" 1>&2
  1.1708      $echo \"See the $PACKAGE documentation for more information.\" 1>&2
  1.1709      exit $EXIT_FAILURE
  1.1710 @@ -5088,6 +5443,63 @@
  1.1711        if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then
  1.1712         cmds=$old_archive_from_new_cmds
  1.1713        else
  1.1714 +	# POSIX demands no paths to be encoded in archives.  We have
  1.1715 +	# to avoid creating archives with duplicate basenames if we
  1.1716 +	# might have to extract them afterwards, e.g., when creating a
  1.1717 +	# static archive out of a convenience library, or when linking
  1.1718 +	# the entirety of a libtool archive into another (currently
  1.1719 +	# not supported by libtool).
  1.1720 +	if (for obj in $oldobjs
  1.1721 +	    do
  1.1722 +	      $echo "X$obj" | $Xsed -e 's%^.*/%%'
  1.1723 +	    done | sort | sort -uc >/dev/null 2>&1); then
  1.1724 +	  :
  1.1725 +	else
  1.1726 +	  $echo "copying selected object files to avoid basename conflicts..."
  1.1727 +
  1.1728 +	  if test -z "$gentop"; then
  1.1729 +	    gentop="$output_objdir/${outputname}x"
  1.1730 +	    generated="$generated $gentop"
  1.1731 +
  1.1732 +	    $show "${rm}r $gentop"
  1.1733 +	    $run ${rm}r "$gentop"
  1.1734 +	    $show "$mkdir $gentop"
  1.1735 +	    $run $mkdir "$gentop"
  1.1736 +	    exit_status=$?
  1.1737 +	    if test "$exit_status" -ne 0 && test ! -d "$gentop"; then
  1.1738 +	      exit $exit_status
  1.1739 +	    fi
  1.1740 +	  fi
  1.1741 +
  1.1742 +	  save_oldobjs=$oldobjs
  1.1743 +	  oldobjs=
  1.1744 +	  counter=1
  1.1745 +	  for obj in $save_oldobjs
  1.1746 +	  do
  1.1747 +	    objbase=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
  1.1748 +	    case " $oldobjs " in
  1.1749 +	    " ") oldobjs=$obj ;;
  1.1750 +	    *[\ /]"$objbase "*)
  1.1751 +	      while :; do
  1.1752 +		# Make sure we don't pick an alternate name that also
  1.1753 +		# overlaps.
  1.1754 +		newobj=lt$counter-$objbase
  1.1755 +		counter=`expr $counter + 1`
  1.1756 +		case " $oldobjs " in
  1.1757 +		*[\ /]"$newobj "*) ;;
  1.1758 +		*) if test ! -f "$gentop/$newobj"; then break; fi ;;
  1.1759 +		esac
  1.1760 +	      done
  1.1761 +	      $show "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj"
  1.1762 +	      $run ln "$obj" "$gentop/$newobj" ||
  1.1763 +	      $run cp "$obj" "$gentop/$newobj"
  1.1764 +	      oldobjs="$oldobjs $gentop/$newobj"
  1.1765 +	      ;;
  1.1766 +	    *) oldobjs="$oldobjs $obj" ;;
  1.1767 +	    esac
  1.1768 +	  done
  1.1769 +	fi
  1.1770 +
  1.1771  	eval cmds=\"$old_archive_cmds\"
  1.1772  
  1.1773  	if len=`expr "X$cmds" : ".*"` &&
  1.1774 @@ -5101,20 +5513,7 @@
  1.1775  	  objlist=
  1.1776  	  concat_cmds=
  1.1777  	  save_oldobjs=$oldobjs
  1.1778 -	  # GNU ar 2.10+ was changed to match POSIX; thus no paths are
  1.1779 -	  # encoded into archives.  This makes 'ar r' malfunction in
  1.1780 -	  # this piecewise linking case whenever conflicting object
  1.1781 -	  # names appear in distinct ar calls; check, warn and compensate.
  1.1782 -	    if (for obj in $save_oldobjs
  1.1783 -	    do
  1.1784 -	      $echo "X$obj" | $Xsed -e 's%^.*/%%'
  1.1785 -	    done | sort | sort -uc >/dev/null 2>&1); then
  1.1786 -	    :
  1.1787 -	  else
  1.1788 -	    $echo "$modename: warning: object name conflicts; overriding AR_FLAGS to 'cq'" 1>&2
  1.1789 -	    $echo "$modename: warning: to ensure that POSIX-compatible ar will work" 1>&2
  1.1790 -	    AR_FLAGS=cq
  1.1791 -	  fi
  1.1792 +
  1.1793  	  # Is there a better way of finding the last object in the list?
  1.1794  	  for obj in $save_oldobjs
  1.1795  	  do
  1.1796 @@ -5125,7 +5524,7 @@
  1.1797  	    oldobjs="$objlist $obj"
  1.1798  	    objlist="$objlist $obj"
  1.1799  	    eval test_cmds=\"$old_archive_cmds\"
  1.1800 -	    if len=`expr "X$test_cmds" : ".*"` &&
  1.1801 +	    if len=`expr "X$test_cmds" : ".*" 2>/dev/null` &&
  1.1802  	       test "$len" -le "$max_cmd_len"; then
  1.1803  	      :
  1.1804  	    else
  1.1805 @@ -5322,11 +5721,11 @@
  1.1806      # install_prog (especially on Windows NT).
  1.1807      if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh ||
  1.1808         # Allow the use of GNU shtool's install command.
  1.1809 -       $echo "X$nonopt" | $Xsed | grep shtool > /dev/null; then
  1.1810 +       $echo "X$nonopt" | grep shtool > /dev/null; then
  1.1811        # Aesthetically quote it.
  1.1812        arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"`
  1.1813        case $arg in
  1.1814 -      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*)
  1.1815 +      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
  1.1816  	arg="\"$arg\""
  1.1817  	;;
  1.1818        esac
  1.1819 @@ -5335,14 +5734,14 @@
  1.1820        shift
  1.1821      else
  1.1822        install_prog=
  1.1823 -      arg="$nonopt"
  1.1824 +      arg=$nonopt
  1.1825      fi
  1.1826  
  1.1827      # The real first argument should be the name of the installation program.
  1.1828      # Aesthetically quote it.
  1.1829      arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
  1.1830      case $arg in
  1.1831 -    *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*)
  1.1832 +    *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
  1.1833        arg="\"$arg\""
  1.1834        ;;
  1.1835      esac
  1.1836 @@ -5360,28 +5759,31 @@
  1.1837      do
  1.1838        if test -n "$dest"; then
  1.1839  	files="$files $dest"
  1.1840 -	dest="$arg"
  1.1841 +	dest=$arg
  1.1842  	continue
  1.1843        fi
  1.1844  
  1.1845        case $arg in
  1.1846        -d) isdir=yes ;;
  1.1847 -      -f) prev="-f" ;;
  1.1848 -      -g) prev="-g" ;;
  1.1849 -      -m) prev="-m" ;;
  1.1850 -      -o) prev="-o" ;;
  1.1851 +      -f) 
  1.1852 +      	case " $install_prog " in
  1.1853 +	*[\\\ /]cp\ *) ;;
  1.1854 +	*) prev=$arg ;;
  1.1855 +	esac
  1.1856 +	;;
  1.1857 +      -g | -m | -o) prev=$arg ;;
  1.1858        -s)
  1.1859  	stripme=" -s"
  1.1860  	continue
  1.1861  	;;
  1.1862 -      -*) ;;
  1.1863 -
  1.1864 +      -*)
  1.1865 +	;;
  1.1866        *)
  1.1867  	# If the previous option needed an argument, then skip it.
  1.1868  	if test -n "$prev"; then
  1.1869  	  prev=
  1.1870  	else
  1.1871 -	  dest="$arg"
  1.1872 +	  dest=$arg
  1.1873  	  continue
  1.1874  	fi
  1.1875  	;;
  1.1876 @@ -5390,7 +5792,7 @@
  1.1877        # Aesthetically quote the argument.
  1.1878        arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
  1.1879        case $arg in
  1.1880 -      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*)
  1.1881 +      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
  1.1882  	arg="\"$arg\""
  1.1883  	;;
  1.1884        esac
  1.1885 @@ -5559,11 +5961,14 @@
  1.1886  
  1.1887  	  if test "$#" -gt 0; then
  1.1888  	    # Delete the old symlinks, and create new ones.
  1.1889 +	    # Try `ln -sf' first, because the `ln' binary might depend on
  1.1890 +	    # the symlink we replace!  Solaris /bin/ln does not understand -f,
  1.1891 +	    # so we also need to try rm && ln -s.
  1.1892  	    for linkname
  1.1893  	    do
  1.1894  	      if test "$linkname" != "$realname"; then
  1.1895 -		$show "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)"
  1.1896 -		$run eval "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)"
  1.1897 +                $show "(cd $destdir && { $LN_S -f $realname $linkname || { $rm $linkname && $LN_S $realname $linkname; }; })"
  1.1898 +                $run eval "(cd $destdir && { $LN_S -f $realname $linkname || { $rm $linkname && $LN_S $realname $linkname; }; })"
  1.1899  	      fi
  1.1900  	    done
  1.1901  	  fi
  1.1902 @@ -5576,7 +5981,16 @@
  1.1903  	    IFS="$save_ifs"
  1.1904  	    eval cmd=\"$cmd\"
  1.1905  	    $show "$cmd"
  1.1906 -	    $run eval "$cmd" || exit $?
  1.1907 +	    $run eval "$cmd" || {
  1.1908 +	      lt_exit=$?
  1.1909 +
  1.1910 +	      # Restore the uninstalled library and exit
  1.1911 +	      if test "$mode" = relink; then
  1.1912 +		$run eval '(cd $output_objdir && $rm ${realname}T && $mv ${realname}U $realname)'
  1.1913 +	      fi
  1.1914 +
  1.1915 +	      exit $lt_exit
  1.1916 +	    }
  1.1917  	  done
  1.1918  	  IFS="$save_ifs"
  1.1919  	fi
  1.1920 @@ -5670,17 +6084,15 @@
  1.1921  	  notinst_deplibs=
  1.1922  	  relink_command=
  1.1923  
  1.1924 -	  # To insure that "foo" is sourced, and not "foo.exe",
  1.1925 -	  # finese the cygwin/MSYS system by explicitly sourcing "foo."
  1.1926 -	  # which disallows the automatic-append-.exe behavior.
  1.1927 -	  case $build in
  1.1928 -	  *cygwin* | *mingw*) wrapperdot=${wrapper}. ;;
  1.1929 -	  *) wrapperdot=${wrapper} ;;
  1.1930 -	  esac
  1.1931 +	  # Note that it is not necessary on cygwin/mingw to append a dot to
  1.1932 +	  # foo even if both foo and FILE.exe exist: automatic-append-.exe
  1.1933 +	  # behavior happens only for exec(3), not for open(2)!  Also, sourcing
  1.1934 +	  # `FILE.' does not work on cygwin managed mounts.
  1.1935 +	  #
  1.1936  	  # If there is no directory component, then add one.
  1.1937 -	  case $file in
  1.1938 -	  */* | *\\*) . ${wrapperdot} ;;
  1.1939 -	  *) . ./${wrapperdot} ;;
  1.1940 +	  case $wrapper in
  1.1941 +	  */* | *\\*) . ${wrapper} ;;
  1.1942 +	  *) . ./${wrapper} ;;
  1.1943  	  esac
  1.1944  
  1.1945  	  # Check the variables that should have been set.
  1.1946 @@ -5708,34 +6120,21 @@
  1.1947  	  done
  1.1948  
  1.1949  	  relink_command=
  1.1950 -	  # To insure that "foo" is sourced, and not "foo.exe",
  1.1951 -	  # finese the cygwin/MSYS system by explicitly sourcing "foo."
  1.1952 -	  # which disallows the automatic-append-.exe behavior.
  1.1953 -	  case $build in
  1.1954 -	  *cygwin* | *mingw*) wrapperdot=${wrapper}. ;;
  1.1955 -	  *) wrapperdot=${wrapper} ;;
  1.1956 -	  esac
  1.1957 +	  # Note that it is not necessary on cygwin/mingw to append a dot to
  1.1958 +	  # foo even if both foo and FILE.exe exist: automatic-append-.exe
  1.1959 +	  # behavior happens only for exec(3), not for open(2)!  Also, sourcing
  1.1960 +	  # `FILE.' does not work on cygwin managed mounts.
  1.1961 +	  #
  1.1962  	  # If there is no directory component, then add one.
  1.1963 -	  case $file in
  1.1964 -	  */* | *\\*) . ${wrapperdot} ;;
  1.1965 -	  *) . ./${wrapperdot} ;;
  1.1966 +	  case $wrapper in
  1.1967 +	  */* | *\\*) . ${wrapper} ;;
  1.1968 +	  *) . ./${wrapper} ;;
  1.1969  	  esac
  1.1970  
  1.1971  	  outputname=
  1.1972  	  if test "$fast_install" = no && test -n "$relink_command"; then
  1.1973  	    if test "$finalize" = yes && test -z "$run"; then
  1.1974 -	      tmpdir="/tmp"
  1.1975 -	      test -n "$TMPDIR" && tmpdir="$TMPDIR"
  1.1976 -	      tmpdir="$tmpdir/libtool-$$"
  1.1977 -	      save_umask=`umask`
  1.1978 -	      umask 0077
  1.1979 -	      if $mkdir "$tmpdir"; then
  1.1980 -	        umask $save_umask
  1.1981 -	      else
  1.1982 -	        umask $save_umask
  1.1983 -		$echo "$modename: error: cannot create temporary directory \`$tmpdir'" 1>&2
  1.1984 -		continue
  1.1985 -	      fi
  1.1986 +	      tmpdir=`func_mktempdir`
  1.1987  	      file=`$echo "X$file$stripped_ext" | $Xsed -e 's%^.*/%%'`
  1.1988  	      outputname="$tmpdir/$file"
  1.1989  	      # Replace the output file specification.
  1.1990 @@ -5759,7 +6158,7 @@
  1.1991  	fi
  1.1992  
  1.1993  	# remove .exe since cygwin /usr/bin/install will append another
  1.1994 -	# one anyways
  1.1995 +	# one anyway 
  1.1996  	case $install_prog,$host in
  1.1997  	*/usr/bin/install*,*cygwin*)
  1.1998  	  case $file:$destfile in
  1.1999 @@ -5859,7 +6258,7 @@
  1.2000      # Exit here if they wanted silent mode.
  1.2001      test "$show" = : && exit $EXIT_SUCCESS
  1.2002  
  1.2003 -    $echo "----------------------------------------------------------------------"
  1.2004 +    $echo "X----------------------------------------------------------------------" | $Xsed
  1.2005      $echo "Libraries have been installed in:"
  1.2006      for libdir in $libdirs; do
  1.2007        $echo "   $libdir"
  1.2008 @@ -5892,7 +6291,7 @@
  1.2009      $echo
  1.2010      $echo "See any operating system documentation about shared libraries for"
  1.2011      $echo "more information, such as the ld(1) and ld.so(8) manual pages."
  1.2012 -    $echo "----------------------------------------------------------------------"
  1.2013 +    $echo "X----------------------------------------------------------------------" | $Xsed
  1.2014      exit $EXIT_SUCCESS
  1.2015      ;;
  1.2016  
  1.2017 @@ -6109,9 +6508,17 @@
  1.2018  	    rmfiles="$rmfiles $objdir/$n"
  1.2019  	  done
  1.2020  	  test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library"
  1.2021 -	  test "$mode" = clean && rmfiles="$rmfiles $objdir/$name $objdir/${name}i"
  1.2022 -
  1.2023 -	  if test "$mode" = uninstall; then
  1.2024 +
  1.2025 +	  case "$mode" in
  1.2026 +	  clean)
  1.2027 +	    case "  $library_names " in
  1.2028 +	    # "  " in the beginning catches empty $dlname
  1.2029 +	    *" $dlname "*) ;;
  1.2030 +	    *) rmfiles="$rmfiles $objdir/$dlname" ;;
  1.2031 +	    esac
  1.2032 +	     test -n "$libdir" && rmfiles="$rmfiles $objdir/$name $objdir/${name}i"
  1.2033 +	    ;;
  1.2034 +	  uninstall)
  1.2035  	    if test -n "$library_names"; then
  1.2036  	      # Do each command in the postuninstall commands.
  1.2037  	      cmds=$postuninstall_cmds
  1.2038 @@ -6144,7 +6551,8 @@
  1.2039  	      IFS="$save_ifs"
  1.2040  	    fi
  1.2041  	    # FIXME: should reinstall the best remaining shared library.
  1.2042 -	  fi
  1.2043 +	    ;;
  1.2044 +	  esac
  1.2045  	fi
  1.2046  	;;
  1.2047  
  1.2048 @@ -6429,7 +6837,7 @@
  1.2049  $echo
  1.2050  $echo "Try \`$modename --help' for more information about other modes."
  1.2051  
  1.2052 -exit $EXIT_SUCCESS
  1.2053 +exit $?
  1.2054  
  1.2055  # The TAGs below are defined such that we never get into a situation
  1.2056  # in which we disable both kinds of libraries.  Given conflicting
  1.2057 @@ -6443,12 +6851,11 @@
  1.2058  # configuration.  But we'll never go from static-only to shared-only.
  1.2059  
  1.2060  # ### BEGIN LIBTOOL TAG CONFIG: disable-shared
  1.2061 -build_libtool_libs=no
  1.2062 -build_old_libs=yes
  1.2063 +disable_libs=shared
  1.2064  # ### END LIBTOOL TAG CONFIG: disable-shared
  1.2065  
  1.2066  # ### BEGIN LIBTOOL TAG CONFIG: disable-static
  1.2067 -build_old_libs=`case $build_libtool_libs in yes) $echo no;; *) $echo yes;; esac`
  1.2068 +disable_libs=static
  1.2069  # ### END LIBTOOL TAG CONFIG: disable-static
  1.2070  
  1.2071  # Local Variables: