ltmain.sh
changeset 68 6f1441b1b5a9
parent 26 25edca541dc9
child 90 d9c74495dd0b
     1.1 --- a/ltmain.sh	Wed Jul 05 16:48:42 2000 +0000
     1.2 +++ b/ltmain.sh	Thu Aug 10 05:52:07 2000 +0000
     1.3 @@ -54,8 +54,8 @@
     1.4  # Constants.
     1.5  PROGRAM=ltmain.sh
     1.6  PACKAGE=libtool
     1.7 -VERSION=1.3c
     1.8 -TIMESTAMP=" (1.620 1999/10/07 15:40:07)"
     1.9 +VERSION=1.3.5
    1.10 +TIMESTAMP=" (1.385.2.206 2000/05/27 11:12:27)"
    1.11  
    1.12  default_mode=
    1.13  help="Try \`$progname --help' for more information."
    1.14 @@ -434,13 +434,8 @@
    1.15        # Without this assignment, base_compile gets emptied.
    1.16        fbsd_hideous_sh_bug=$base_compile
    1.17  
    1.18 -      if test "$pic_mode" != no; then
    1.19 -	# All platforms use -DPIC, to notify preprocessed assembler code.
    1.20 -	command="$base_compile $pic_flag -DPIC $srcfile"
    1.21 -      else
    1.22 -	# Don't build PIC code
    1.23 -	command="$base_compile $srcfile"
    1.24 -      fi
    1.25 +      # All platforms use -DPIC, to notify preprocessed assembler code.
    1.26 +      command="$base_compile $srcfile $pic_flag -DPIC"
    1.27        if test "$build_old_libs" = yes; then
    1.28  	lo_libobj="$libobj"
    1.29  	dir=`$echo "X$libobj" | $Xsed -e 's%/[^/]*$%%'`
    1.30 @@ -511,8 +506,7 @@
    1.31        fi
    1.32  
    1.33        # If we have no pic_flag, then copy the object into place and finish.
    1.34 -      if (test -z "$pic_flag" || test "$pic_mode" != default) &&
    1.35 -	 test "$build_old_libs" = yes; then
    1.36 +      if test -z "$pic_flag" && test "$build_old_libs" = yes; then
    1.37  	# Rename the .lo from within objdir to obj
    1.38  	if test -f $obj; then
    1.39  	  $show $rm $obj
    1.40 @@ -552,13 +546,7 @@
    1.41  
    1.42      # Only build a position-dependent object if we build old libraries.
    1.43      if test "$build_old_libs" = yes; then
    1.44 -      if test "$pic_mode" != yes; then
    1.45 -	# Don't build PIC code
    1.46 -	command="$base_compile $srcfile"
    1.47 -      else
    1.48 -	# All platforms use -DPIC, to notify preprocessed assembler code.
    1.49 -	command="$base_compile $pic_flag -DPIC $srcfile"
    1.50 -      fi
    1.51 +      command="$base_compile $srcfile"
    1.52        if test "$compiler_c_o" = yes; then
    1.53  	command="$command -o $obj"
    1.54  	output_obj="$obj"
    1.55 @@ -631,10 +619,8 @@
    1.56      ;;
    1.57  
    1.58    # libtool link mode
    1.59 -  link | relink)
    1.60 +  link)
    1.61      modename="$modename: link"
    1.62 -    relink=no
    1.63 -    test "$mode" = "relink" && relink=yes
    1.64      case "$host" in
    1.65      *-*-cygwin* | *-*-mingw* | *-*-os2*)
    1.66        # It is impossible to link a dll without this setting, and
    1.67 @@ -649,12 +635,179 @@
    1.68        # -no-undefined on the libtool link line when we can be certain
    1.69        # that all symbols are satisfied, otherwise we get a static library.
    1.70        allow_undefined=yes
    1.71 +
    1.72 +      # This is a source program that is used to create dlls on Windows
    1.73 +      # Don't remove nor modify the starting and closing comments
    1.74 +# /* ltdll.c starts here */
    1.75 +# #define WIN32_LEAN_AND_MEAN
    1.76 +# #include <windows.h>
    1.77 +# #undef WIN32_LEAN_AND_MEAN
    1.78 +# #include <stdio.h>
    1.79 +#
    1.80 +# #ifndef __CYGWIN__
    1.81 +# #  ifdef __CYGWIN32__
    1.82 +# #    define __CYGWIN__ __CYGWIN32__
    1.83 +# #  endif
    1.84 +# #endif
    1.85 +#
    1.86 +# #ifdef __cplusplus
    1.87 +# extern "C" {
    1.88 +# #endif
    1.89 +# BOOL APIENTRY DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved);
    1.90 +# #ifdef __cplusplus
    1.91 +# }
    1.92 +# #endif
    1.93 +#
    1.94 +# #ifdef __CYGWIN__
    1.95 +# #include <cygwin/cygwin_dll.h>
    1.96 +# DECLARE_CYGWIN_DLL( DllMain );
    1.97 +# #endif
    1.98 +# HINSTANCE __hDllInstance_base;
    1.99 +#
   1.100 +# BOOL APIENTRY
   1.101 +# DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved)
   1.102 +# {
   1.103 +#   __hDllInstance_base = hInst;
   1.104 +#   return TRUE;
   1.105 +# }
   1.106 +# /* ltdll.c ends here */
   1.107 +      # This is a source program that is used to create import libraries
   1.108 +      # on Windows for dlls which lack them. Don't remove nor modify the
   1.109 +      # starting and closing comments
   1.110 +# /* impgen.c starts here */
   1.111 +# /*   Copyright (C) 1999 Free Software Foundation, Inc.
   1.112 +# 
   1.113 +#  This file is part of GNU libtool.
   1.114 +# 
   1.115 +#  This program is free software; you can redistribute it and/or modify
   1.116 +#  it under the terms of the GNU General Public License as published by
   1.117 +#  the Free Software Foundation; either version 2 of the License, or
   1.118 +#  (at your option) any later version.
   1.119 +# 
   1.120 +#  This program is distributed in the hope that it will be useful,
   1.121 +#  but WITHOUT ANY WARRANTY; without even the implied warranty of
   1.122 +#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   1.123 +#  GNU General Public License for more details.
   1.124 +# 
   1.125 +#  You should have received a copy of the GNU General Public License
   1.126 +#  along with this program; if not, write to the Free Software
   1.127 +#  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
   1.128 +#  */
   1.129 +# 
   1.130 +#  #include <stdio.h>		/* for printf() */
   1.131 +#  #include <unistd.h>		/* for open(), lseek(), read() */
   1.132 +#  #include <fcntl.h>		/* for O_RDONLY, O_BINARY */
   1.133 +#  #include <string.h>		/* for strdup() */
   1.134 +# 
   1.135 +#  static unsigned int
   1.136 +#  pe_get16 (fd, offset)
   1.137 +#       int fd;
   1.138 +#       int offset;
   1.139 +#  {
   1.140 +#    unsigned char b[2];
   1.141 +#    lseek (fd, offset, SEEK_SET);
   1.142 +#    read (fd, b, 2);
   1.143 +#    return b[0] + (b[1]<<8);
   1.144 +#  }
   1.145 +# 
   1.146 +#  static unsigned int
   1.147 +#  pe_get32 (fd, offset)
   1.148 +#      int fd;
   1.149 +#      int offset;
   1.150 +#  {
   1.151 +#    unsigned char b[4];
   1.152 +#    lseek (fd, offset, SEEK_SET);
   1.153 +#    read (fd, b, 4);
   1.154 +#    return b[0] + (b[1]<<8) + (b[2]<<16) + (b[3]<<24);
   1.155 +#  }
   1.156 +# 
   1.157 +#  static unsigned int
   1.158 +#  pe_as32 (ptr)
   1.159 +#       void *ptr;
   1.160 +#  {
   1.161 +#    unsigned char *b = ptr;
   1.162 +#    return b[0] + (b[1]<<8) + (b[2]<<16) + (b[3]<<24);
   1.163 +#  }
   1.164 +# 
   1.165 +#  int
   1.166 +#  main (argc, argv)
   1.167 +#      int argc;
   1.168 +#      char *argv[];
   1.169 +#  {
   1.170 +#      int dll;
   1.171 +#      unsigned long pe_header_offset, opthdr_ofs, num_entries, i;
   1.172 +#      unsigned long export_rva, export_size, nsections, secptr, expptr;
   1.173 +#      unsigned long name_rvas, nexp;
   1.174 +#      unsigned char *expdata, *erva;
   1.175 +#      char *filename, *dll_name;
   1.176 +# 
   1.177 +#      filename = argv[1];
   1.178 +# 
   1.179 +#      dll = open(filename, O_RDONLY|O_BINARY);
   1.180 +#      if (!dll)
   1.181 +#  	return 1;
   1.182 +# 
   1.183 +#      dll_name = filename;
   1.184 +#    
   1.185 +#      for (i=0; filename[i]; i++)
   1.186 +#  	if (filename[i] == '/' || filename[i] == '\\'  || filename[i] == ':')
   1.187 +#  	    dll_name = filename + i +1;
   1.188 +# 
   1.189 +#      pe_header_offset = pe_get32 (dll, 0x3c);
   1.190 +#      opthdr_ofs = pe_header_offset + 4 + 20;
   1.191 +#      num_entries = pe_get32 (dll, opthdr_ofs + 92);
   1.192 +# 
   1.193 +#      if (num_entries < 1) /* no exports */
   1.194 +#  	return 1;
   1.195 +# 
   1.196 +#      export_rva = pe_get32 (dll, opthdr_ofs + 96);
   1.197 +#      export_size = pe_get32 (dll, opthdr_ofs + 100);
   1.198 +#      nsections = pe_get16 (dll, pe_header_offset + 4 +2);
   1.199 +#      secptr = (pe_header_offset + 4 + 20 +
   1.200 +#  	      pe_get16 (dll, pe_header_offset + 4 + 16));
   1.201 +# 
   1.202 +#      expptr = 0;
   1.203 +#      for (i = 0; i < nsections; i++)
   1.204 +#      {
   1.205 +#  	char sname[8];
   1.206 +#  	unsigned long secptr1 = secptr + 40 * i;
   1.207 +#  	unsigned long vaddr = pe_get32 (dll, secptr1 + 12);
   1.208 +#  	unsigned long vsize = pe_get32 (dll, secptr1 + 16);
   1.209 +#  	unsigned long fptr = pe_get32 (dll, secptr1 + 20);
   1.210 +#  	lseek(dll, secptr1, SEEK_SET);
   1.211 +#  	read(dll, sname, 8);
   1.212 +#  	if (vaddr <= export_rva && vaddr+vsize > export_rva)
   1.213 +#  	{
   1.214 +#  	    expptr = fptr + (export_rva - vaddr);
   1.215 +#  	    if (export_rva + export_size > vaddr + vsize)
   1.216 +#  		export_size = vsize - (export_rva - vaddr);
   1.217 +#  	    break;
   1.218 +#  	}
   1.219 +#      }
   1.220 +# 
   1.221 +#      expdata = (unsigned char*)malloc(export_size);
   1.222 +#      lseek (dll, expptr, SEEK_SET);
   1.223 +#      read (dll, expdata, export_size);
   1.224 +#      erva = expdata - export_rva;
   1.225 +# 
   1.226 +#      nexp = pe_as32 (expdata+24);
   1.227 +#      name_rvas = pe_as32 (expdata+32);
   1.228 +# 
   1.229 +#      printf ("EXPORTS\n");
   1.230 +#      for (i = 0; i<nexp; i++)
   1.231 +#      {
   1.232 +#  	unsigned long name_rva = pe_as32 (erva+name_rvas+i*4);
   1.233 +#  	printf ("\t%s @ %ld ;\n", erva+name_rva, 1+ i);
   1.234 +#      }
   1.235 +# 
   1.236 +#      return 0;
   1.237 +#  }
   1.238 +# /* impgen.c ends here */
   1.239        ;;
   1.240      *)
   1.241        allow_undefined=yes
   1.242        ;;
   1.243      esac
   1.244 -    libtool_args="$nonopt"
   1.245      compile_command="$nonopt"
   1.246      finalize_command="$nonopt"
   1.247  
   1.248 @@ -665,12 +818,18 @@
   1.249      convenience=
   1.250      old_convenience=
   1.251      deplibs=
   1.252 -    old_deplibs=
   1.253 -    compiler_flags=
   1.254 -    linker_flags=
   1.255 -    dllsearchpath=
   1.256 -    lib_search_path=`pwd`
   1.257 -
   1.258 +    linkopts=
   1.259 +
   1.260 +    if test -n "$shlibpath_var"; then
   1.261 +      # get the directories listed in $shlibpath_var
   1.262 +      eval lib_search_path=\`\$echo \"X \${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\`
   1.263 +    else
   1.264 +      lib_search_path=
   1.265 +    fi
   1.266 +    # now prepend the system-specific ones
   1.267 +    eval lib_search_path=\"$sys_lib_search_path_spec\$lib_search_path\"
   1.268 +    eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\"
   1.269 +    
   1.270      avoid_version=no
   1.271      dlfiles=
   1.272      dlprefiles=
   1.273 @@ -680,9 +839,9 @@
   1.274      export_symbols_regex=
   1.275      generated=
   1.276      libobjs=
   1.277 +    link_against_libtool_libs=
   1.278      ltlibs=
   1.279      module=no
   1.280 -    no_install=no
   1.281      objs=
   1.282      prefer_static_libs=no
   1.283      preload=no
   1.284 @@ -728,7 +887,6 @@
   1.285      while test $# -gt 0; do
   1.286        arg="$1"
   1.287        shift
   1.288 -      libtool_args="$libtool_args $arg"
   1.289  
   1.290        # If the previous option needs an argument, assign it.
   1.291        if test -n "$prev"; then
   1.292 @@ -821,29 +979,6 @@
   1.293  	  prev=
   1.294  	  continue
   1.295  	  ;;
   1.296 -	xcompiler)
   1.297 -	  arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
   1.298 -	  case "$arg" in
   1.299 -	  *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*)
   1.300 -	    arg="\"$arg\""
   1.301 -	    ;;
   1.302 -	  esac
   1.303 -	  compiler_flags="$compiler_flags $arg"
   1.304 -	  prev=
   1.305 -	  continue
   1.306 -	  ;;
   1.307 -	xlinker)
   1.308 -	  arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
   1.309 -	  case "$arg" in
   1.310 -	  *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*)
   1.311 -	    arg="\"$arg\""
   1.312 -	    ;;
   1.313 -	  esac
   1.314 -	  linker_flags="$linker_flags $arg"
   1.315 -	  compiler_flags="$compiler_flags $wl$arg"
   1.316 -	  prev=
   1.317 -	  continue
   1.318 -	  ;;
   1.319  	*)
   1.320  	  eval "$prev=\"\$arg\""
   1.321  	  prev=
   1.322 @@ -910,34 +1045,37 @@
   1.323  	*)
   1.324  	  absdir=`cd "$dir" && pwd`
   1.325  	  if test -z "$absdir"; then
   1.326 -	    $echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2
   1.327 -	    exit 1
   1.328 +	    $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2
   1.329 +	    $echo "$modename: passing it literally to the linker, although it might fail" 1>&2
   1.330 +	    absdir="$dir"
   1.331  	  fi
   1.332  	  dir="$absdir"
   1.333  	  ;;
   1.334  	esac
   1.335 -	case "$deplibs " in
   1.336 -	*" -L$dir "*) ;;
   1.337 -	*)
   1.338 -	  deplibs="$deplibs -L$dir"
   1.339 -	  lib_search_path="$lib_search_path $dir"
   1.340 -	  ;;
   1.341 +	case " $deplibs " in
   1.342 +	*" $arg "*) ;;
   1.343 +	*) deplibs="$deplibs $arg";;
   1.344 +	esac
   1.345 +	case " $lib_search_path " in
   1.346 +	*" $dir "*) ;;
   1.347 +	*) lib_search_path="$lib_search_path $dir";;
   1.348  	esac
   1.349  	case "$host" in
   1.350  	*-*-cygwin* | *-*-mingw* | *-*-os2*)
   1.351 +	  dllsearchdir=`cd "$dir" && pwd || echo "$dir"`
   1.352  	  case ":$dllsearchpath:" in
   1.353 -	  *":$dir:"*) ;;
   1.354 -	  *) dllsearchpath="$dllsearchpath:$dir";;
   1.355 +	  ::) dllsearchpath="$dllsearchdir";;
   1.356 +	  *":$dllsearchdir:"*) ;;
   1.357 +	  *) dllsearchpath="$dllsearchpath:$dllsearchdir";;
   1.358  	  esac
   1.359  	  ;;
   1.360  	esac
   1.361 -	continue
   1.362  	;;
   1.363  
   1.364        -l*)
   1.365  	if test "$arg" = "-lc"; then
   1.366  	  case "$host" in
   1.367 -	  *-*-cygwin* | *-*-mingw* | *-*-os2* | *-*-beos*)
   1.368 +	  *-*-cygwin* | *-*-mingw* | *-*-os2* | *-*-beos* |*-*-freebsd* )
   1.369  	    # These systems don't actually have c library (as such)
   1.370  	    continue
   1.371  	    ;;
   1.372 @@ -951,7 +1089,6 @@
   1.373  	  esac
   1.374  	fi
   1.375  	deplibs="$deplibs $arg"
   1.376 -	continue
   1.377  	;;
   1.378  
   1.379        -module)
   1.380 @@ -959,27 +1096,6 @@
   1.381  	continue
   1.382  	;;
   1.383  
   1.384 -      -no-fast-install)
   1.385 -	fast_install=no
   1.386 -	continue
   1.387 -	;;
   1.388 -
   1.389 -      -no-install)
   1.390 -	case "$host" in
   1.391 -	*-*-cygwin* | *-*-mingw* | *-*-os2*)
   1.392 -	  # The PATH hackery in wrapper scripts is required on Windows
   1.393 -	  # in order for the loader to find any dlls it needs.
   1.394 -	  $echo "$modename: warning: \`-no-install' is ignored for $host" 1>&2
   1.395 -	  $echo "$modename: warning: assuming \`-no-fast-install' instead" 1>&2
   1.396 -	  fast_install=no
   1.397 -	  ;;
   1.398 -	*)
   1.399 -	  no_install=yes
   1.400 -	  ;;
   1.401 -	esac
   1.402 -	continue
   1.403 -	;;
   1.404 -
   1.405        -no-undefined)
   1.406  	allow_undefined=no
   1.407  	continue
   1.408 @@ -1037,39 +1153,6 @@
   1.409  	prev=vinfo
   1.410  	continue
   1.411  	;;
   1.412 -	
   1.413 -      -Wc,*)
   1.414 -	arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
   1.415 -	case "$arg" in
   1.416 -	*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*)
   1.417 -	  arg="\"$arg\""
   1.418 -	  ;;
   1.419 -	esac
   1.420 -	flag=`$echo "X$arg" | $Xsed -e 's/^-Wc,//'`
   1.421 -	compiler_flags="$compiler_flags $flag"
   1.422 -	;;
   1.423 -
   1.424 -      -Wl,*)
   1.425 -	arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
   1.426 -	case "$arg" in
   1.427 -	*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*)
   1.428 -	  arg="\"$arg\""
   1.429 -	  ;;
   1.430 -	esac
   1.431 -	flag=`$echo "X$arg" | $Xsed -e 's/^-Wl,//'`
   1.432 -	linker_flags="$linker_flags $flag"
   1.433 -	compiler_flags="$compiler_flags $wl$flag"
   1.434 -	;;
   1.435 -
   1.436 -      -Xcompiler)
   1.437 -	prev=xcompiler
   1.438 -	continue
   1.439 -	;;
   1.440 -
   1.441 -      -Xlinker)
   1.442 -	prev=xlinker
   1.443 -	continue
   1.444 -	;;
   1.445  
   1.446        # Some other compiler flag.
   1.447        -* | +*)
   1.448 @@ -1083,7 +1166,7 @@
   1.449  	esac
   1.450  	;;
   1.451  
   1.452 -      *.o | *.obj)
   1.453 +      *.o | *.obj | *.a | *.lib)
   1.454  	# A standard object.
   1.455  	objs="$objs $arg"
   1.456  	;;
   1.457 @@ -1109,13 +1192,6 @@
   1.458  	libobjs="$libobjs $arg"
   1.459  	;;
   1.460  
   1.461 -      *.a | *.lib)
   1.462 -	# An archive.
   1.463 -	deplibs="$deplibs $arg"
   1.464 -	old_deplibs="$old_deplibs $arg"
   1.465 -	continue
   1.466 -	;;
   1.467 -
   1.468        *.la)
   1.469  	# A libtool-controlled library.
   1.470  
   1.471 @@ -1153,6 +1229,9 @@
   1.472  	  exit 1
   1.473  	fi
   1.474  
   1.475 +	# Find the relevant object directory and library name.
   1.476 +	name=`$echo "X$arg" | $Xsed -e 's%^.*/%%' -e 's/\.la$//' -e 's/^lib//'`
   1.477 +
   1.478  	if test "X$installed" = Xyes; then
   1.479  	  dir="$libdir"
   1.480  	else
   1.481 @@ -1164,6 +1243,42 @@
   1.482  	  fi
   1.483  	fi
   1.484  
   1.485 +	if test -n "$dependency_libs"; then
   1.486 +	  # Extract -R and -L from dependency_libs
   1.487 +	  temp_deplibs=
   1.488 +	  for deplib in $dependency_libs; do
   1.489 +	    case "$deplib" in
   1.490 +	    -R*) temp_xrpath=`$echo "X$deplib" | $Xsed -e 's/^-R//'`
   1.491 +		 case " $rpath $xrpath " in
   1.492 +		 *" $temp_xrpath "*) ;;
   1.493 +		 *) xrpath="$xrpath $temp_xrpath";;
   1.494 +		 esac;;
   1.495 +	    -L*) case "$compile_command $temp_deplibs " in
   1.496 +		 *" $deplib "*) ;;
   1.497 +		 *) temp_deplibs="$temp_deplibs $deplib";;
   1.498 +		 esac
   1.499 +		 temp_dir=`$echo "X$deplib" | $Xsed -e 's/^-L//'`
   1.500 +		 case " $lib_search_path " in
   1.501 +		 *" $temp_dir "*) ;;
   1.502 +		 *) lib_search_path="$lib_search_path $temp_dir";;
   1.503 +		 esac
   1.504 +		 ;;
   1.505 +	    *) temp_deplibs="$temp_deplibs $deplib";;
   1.506 +	    esac
   1.507 +	  done
   1.508 +	  dependency_libs="$temp_deplibs"
   1.509 +	fi
   1.510 +
   1.511 +	if test -z "$libdir"; then
   1.512 +	  # It is a libtool convenience library, so add in its objects.
   1.513 +	  convenience="$convenience $dir/$old_library"
   1.514 +	  old_convenience="$old_convenience $dir/$old_library"
   1.515 +	  deplibs="$deplibs$dependency_libs"
   1.516 +	  compile_command="$compile_command $dir/$old_library$dependency_libs"
   1.517 +	  finalize_command="$finalize_command $dir/$old_library$dependency_libs"
   1.518 +	  continue
   1.519 +	fi
   1.520 +
   1.521  	# This library was specified with -dlopen.
   1.522  	if test "$prev" = dlfiles; then
   1.523  	  dlfiles="$dlfiles $arg"
   1.524 @@ -1172,7 +1287,10 @@
   1.525  	    # we need to preload.
   1.526  	    prev=dlprefiles
   1.527  	  else
   1.528 -	    # We should not create a dependency on this library
   1.529 +	    # We should not create a dependency on this library, but we
   1.530 +	    # may need any libraries it requires.
   1.531 +	    compile_command="$compile_command$dependency_libs"
   1.532 +	    finalize_command="$finalize_command$dependency_libs"
   1.533  	    prev=
   1.534  	    continue
   1.535  	  fi
   1.536 @@ -1190,7 +1308,180 @@
   1.537  	  prev=
   1.538  	fi
   1.539  
   1.540 -	deplibs="$deplibs $arg"
   1.541 +	if test -n "$library_names" &&
   1.542 +	   { test "$prefer_static_libs" = no || test -z "$old_library"; }; then
   1.543 +	  link_against_libtool_libs="$link_against_libtool_libs $arg"
   1.544 +	  if test -n "$shlibpath_var"; then
   1.545 +	    # Make sure the rpath contains only unique directories.
   1.546 +	    case "$temp_rpath " in
   1.547 +	    *" $dir "*) ;;
   1.548 +	    *) temp_rpath="$temp_rpath $dir" ;;
   1.549 +	    esac
   1.550 +	  fi
   1.551 +
   1.552 +	  # We need an absolute path.
   1.553 +	  case "$dir" in
   1.554 +	  [\\/] | [A-Za-z]:[\\/]*) absdir="$dir" ;;
   1.555 +	  *)
   1.556 +	    absdir=`cd "$dir" && pwd`
   1.557 +	    if test -z "$absdir"; then
   1.558 +	      $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2
   1.559 +	      $echo "$modename: passing it literally to the linker, although it might fail" 1>&2
   1.560 +	      absdir="$dir"
   1.561 +	    fi
   1.562 +	    ;;
   1.563 +	  esac
   1.564 +	  
   1.565 +	  # This is the magic to use -rpath.
   1.566 +	  # Skip directories that are in the system default run-time
   1.567 +	  # search path, unless they have been requested with -R.
   1.568 +	  case " $sys_lib_dlsearch_path " in
   1.569 +	  *" $absdir "*) ;;
   1.570 +	  *)
   1.571 +	    case "$compile_rpath " in
   1.572 +	    *" $absdir "*) ;;
   1.573 +	    *) compile_rpath="$compile_rpath $absdir" 
   1.574 +	    esac
   1.575 +	    ;;
   1.576 +	  esac
   1.577 +
   1.578 +	  case " $sys_lib_dlsearch_path " in
   1.579 +	  *" $libdir "*) ;;
   1.580 +	  *)
   1.581 +	    case "$finalize_rpath " in
   1.582 +	    *" $libdir "*) ;;
   1.583 +	    *) finalize_rpath="$finalize_rpath $libdir"
   1.584 +	    esac
   1.585 +	    ;;
   1.586 +	  esac
   1.587 +
   1.588 +	  lib_linked=yes
   1.589 +	  case "$hardcode_action" in
   1.590 +	  immediate | unsupported)
   1.591 +	    if test "$hardcode_direct" = no; then
   1.592 +	      compile_command="$compile_command $dir/$linklib"
   1.593 +	      deplibs="$deplibs $dir/$linklib"
   1.594 +	      case "$host" in
   1.595 +	      *-*-cygwin* | *-*-mingw* | *-*-os2*)
   1.596 +		dllsearchdir=`cd "$dir" && pwd || echo "$dir"`
   1.597 +		if test -n "$dllsearchpath"; then
   1.598 +		  dllsearchpath="$dllsearchpath:$dllsearchdir"
   1.599 +		else
   1.600 +		  dllsearchpath="$dllsearchdir"
   1.601 +		fi
   1.602 +		;;
   1.603 +	      esac
   1.604 +	    elif test "$hardcode_minus_L" = no; then
   1.605 +	      case "$host" in
   1.606 +	      *-*-sunos*)
   1.607 +		compile_shlibpath="$compile_shlibpath$dir:"
   1.608 +		;;
   1.609 +	      esac
   1.610 +	      case "$compile_command " in
   1.611 +	      *" -L$dir "*) ;;
   1.612 +	      *) compile_command="$compile_command -L$dir";;
   1.613 +	      esac
   1.614 +	      compile_command="$compile_command -l$name"
   1.615 +	      deplibs="$deplibs -L$dir -l$name"
   1.616 +	    elif test "$hardcode_shlibpath_var" = no; then
   1.617 +	      case ":$compile_shlibpath:" in
   1.618 +	      *":$dir:"*) ;;
   1.619 +	      *) compile_shlibpath="$compile_shlibpath$dir:";;
   1.620 +	      esac
   1.621 +	      compile_command="$compile_command -l$name"
   1.622 +	      deplibs="$deplibs -l$name"
   1.623 +	    else
   1.624 +	      lib_linked=no
   1.625 +	    fi
   1.626 +	    ;;
   1.627 +
   1.628 +	  relink)
   1.629 +	    if test "$hardcode_direct" = yes; then
   1.630 +	      compile_command="$compile_command $absdir/$linklib"
   1.631 +	      deplibs="$deplibs $absdir/$linklib"
   1.632 +	    elif test "$hardcode_minus_L" = yes; then
   1.633 +	      case "$compile_command " in
   1.634 +	      *" -L$absdir "*) ;;
   1.635 +	      *) compile_command="$compile_command -L$absdir";;
   1.636 +	      esac
   1.637 +	      compile_command="$compile_command -l$name"
   1.638 +	      deplibs="$deplibs -L$absdir -l$name"
   1.639 +	    elif test "$hardcode_shlibpath_var" = yes; then
   1.640 +	      case ":$compile_shlibpath:" in
   1.641 +	      *":$absdir:"*) ;;
   1.642 +	      *) compile_shlibpath="$compile_shlibpath$absdir:";;
   1.643 +	      esac
   1.644 +	      compile_command="$compile_command -l$name"
   1.645 +	      deplibs="$deplibs -l$name"
   1.646 +	    else
   1.647 +	      lib_linked=no
   1.648 +	    fi
   1.649 +	    ;;
   1.650 +
   1.651 +	  *)
   1.652 +	    lib_linked=no
   1.653 +	    ;;
   1.654 +	  esac
   1.655 +
   1.656 +	  if test "$lib_linked" != yes; then
   1.657 +	    $echo "$modename: configuration error: unsupported hardcode properties"
   1.658 +	    exit 1
   1.659 +	  fi
   1.660 +
   1.661 +	  # Finalize command for both is simple: just hardcode it.
   1.662 +	  if test "$hardcode_direct" = yes; then
   1.663 +	    finalize_command="$finalize_command $libdir/$linklib"
   1.664 +	  elif test "$hardcode_minus_L" = yes; then
   1.665 +	    case "$finalize_command " in
   1.666 +	    *" -L$libdir "*) ;;
   1.667 +	    *) finalize_command="$finalize_command -L$libdir";;
   1.668 +	    esac
   1.669 +	    finalize_command="$finalize_command -l$name"
   1.670 +	  elif test "$hardcode_shlibpath_var" = yes; then
   1.671 +	    case ":$finalize_shlibpath:" in
   1.672 +	    *":$libdir:"*) ;;
   1.673 +	    *) finalize_shlibpath="$finalize_shlibpath$libdir:";;
   1.674 +	    esac
   1.675 +	    finalize_command="$finalize_command -l$name"
   1.676 +	  else
   1.677 +	    # We cannot seem to hardcode it, guess we'll fake it.
   1.678 +	    case "$finalize_command " in
   1.679 +	    *" -L$dir "*) ;;
   1.680 +	    *) finalize_command="$finalize_command -L$libdir";;
   1.681 +	    esac
   1.682 +	    finalize_command="$finalize_command -l$name"
   1.683 +	  fi
   1.684 +	else
   1.685 +	  # Transform directly to old archives if we don't build new libraries.
   1.686 +	  if test -n "$pic_flag" && test -z "$old_library"; then
   1.687 +	    $echo "$modename: cannot find static library for \`$arg'" 1>&2
   1.688 +	    exit 1
   1.689 +	  fi
   1.690 +
   1.691 +	  # Here we assume that one of hardcode_direct or hardcode_minus_L
   1.692 +	  # is not unsupported.  This is valid on all known static and
   1.693 +	  # shared platforms.
   1.694 +	  if test "$hardcode_direct" != unsupported; then
   1.695 +	    test -n "$old_library" && linklib="$old_library"
   1.696 +	    compile_command="$compile_command $dir/$linklib"
   1.697 +	    finalize_command="$finalize_command $dir/$linklib"
   1.698 +	  else
   1.699 +	    case "$compile_command " in
   1.700 +	    *" -L$dir "*) ;;
   1.701 +	    *) compile_command="$compile_command -L$dir";;
   1.702 +	    esac
   1.703 +	    compile_command="$compile_command -l$name"
   1.704 +	    case "$finalize_command " in
   1.705 +	    *" -L$dir "*) ;;
   1.706 +	    *) finalize_command="$finalize_command -L$dir";;
   1.707 +	    esac
   1.708 +	    finalize_command="$finalize_command -l$name"
   1.709 +	  fi
   1.710 +	fi
   1.711 +
   1.712 +	# Add in any libraries that this one depends upon.
   1.713 +	compile_command="$compile_command$dependency_libs"
   1.714 +	finalize_command="$finalize_command$dependency_libs"
   1.715  	continue
   1.716  	;;
   1.717  
   1.718 @@ -1231,99 +1522,19 @@
   1.719      outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'`
   1.720      libobjs_save="$libobjs"
   1.721  
   1.722 -    if test -n "$shlibpath_var"; then
   1.723 -      # get the directories listed in $shlibpath_var
   1.724 -      eval shlib_search_path=\`\$echo \"X \${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\`
   1.725 -    else
   1.726 -      shlib_search_path=
   1.727 -    fi
   1.728 -    eval sys_lib_search_path=\"$sys_lib_search_path_spec\"
   1.729 -    eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\"
   1.730 -    lib_search_path="$lib_search_path $sys_lib_search_path $shlib_search_path"
   1.731 -
   1.732      case "$output" in
   1.733      "")
   1.734        $echo "$modename: you must specify an output file" 1>&2
   1.735        $echo "$help" 1>&2
   1.736        exit 1
   1.737        ;;
   1.738 +
   1.739      *.a | *.lib)
   1.740 -      linkmode=oldlib ;;
   1.741 -    *.lo | *.o | *.obj)
   1.742 -      linkmode=obj ;;
   1.743 -    *.la)
   1.744 -      linkmode=lib ;;
   1.745 -    *) # Anything else should be a program.
   1.746 -      linkmode=prog ;;
   1.747 -    esac
   1.748 -    
   1.749 -    output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'`
   1.750 -    if test "X$output_objdir" = "X$output"; then
   1.751 -      output_objdir="$objdir"
   1.752 -    else
   1.753 -      output_objdir="$output_objdir/$objdir"
   1.754 -    fi
   1.755 -
   1.756 -    # Create the object directory.
   1.757 -    if test ! -d $output_objdir; then
   1.758 -      $show "$mkdir $output_objdir"
   1.759 -      $run $mkdir $output_objdir
   1.760 -      status=$?
   1.761 -      if test $status -ne 0 && test ! -d $output_objdir; then
   1.762 -	exit $status
   1.763 +      if test -n "$link_against_libtool_libs"; then
   1.764 +	$echo "$modename: error: cannot link libtool libraries into archives" 1>&2
   1.765 +	exit 1
   1.766        fi
   1.767 -    fi
   1.768 -    if test $linkmode != lib && test $linkmode != prog; then
   1.769 -      # Find libtool convenience libraries
   1.770 -      for deplib in $deplibs; do
   1.771 -	case "$deplib" in
   1.772 -	-l* | -L*)
   1.773 -	  $echo "$modename: warning: \`-l' and \`-L' are ignored for archives/objects" 1>&2
   1.774 -	  continue
   1.775 -	  ;;
   1.776 -	esac
   1.777 -	if test -f "$deplib"; then :
   1.778 -	else
   1.779 -	  $echo "$modename: cannot find the library \`$deplib'" 1>&2
   1.780 -	  exit 1
   1.781 -	fi
   1.782 -	libdir=
   1.783 -	old_library=
   1.784 -
   1.785 -	# Check to see that this really is a libtool archive.
   1.786 -	if (sed -e '2q' $deplib | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
   1.787 -	else
   1.788 -	  $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
   1.789 -	  exit 1
   1.790 -	fi
   1.791 -
   1.792 -	ladir=`$echo "X$deplib" | $Xsed -e 's%/[^/]*$%%'`
   1.793 -	test "X$ladir" = "X$deplib" && ladir="."
   1.794 -
   1.795 -	# Read the .la file
   1.796 -	case "$deplib" in
   1.797 -	*/* | *\\*) . $deplib ;;
   1.798 -	*) . ./$deplib ;;
   1.799 -	esac
   1.800 -
   1.801 -	if test -z "$old_library"; then
   1.802 -	  $echo "$modename: cannot find name of link library for \`$deplib'" 1>&2
   1.803 -	  exit 1
   1.804 -	fi
   1.805 -
   1.806 -	if test -n "$libdir"; then
   1.807 -	  $echo "$modename: \`$deplib' is not a convenience library" 1>&2
   1.808 -	  exit 1
   1.809 -	fi
   1.810 -	
   1.811 -	# It is a libtool convenience library, so add in its objects.
   1.812 -	convenience="$convenience $ladir/$objdir/$old_library"
   1.813 -	old_convenience="$old_convenience $ladir/$objdir/$old_library"
   1.814 -      done
   1.815 -    fi
   1.816 -
   1.817 -    case $linkmode in
   1.818 -    oldlib)
   1.819 +
   1.820        if test -n "$deplibs"; then
   1.821  	$echo "$modename: warning: \`-l' and \`-L' are ignored for archives" 1>&2
   1.822        fi
   1.823 @@ -1355,10 +1566,9 @@
   1.824        # Now set the variables for building old libraries.
   1.825        build_libtool_libs=no
   1.826        oldlibs="$output"
   1.827 -      objs="$objs$old_deplibs"
   1.828        ;;
   1.829  
   1.830 -    lib)
   1.831 +    *.la)
   1.832        # Make sure we only generate libraries of the form `libNAME.la'.
   1.833        case "$outputname" in
   1.834        lib*)
   1.835 @@ -1381,11 +1591,24 @@
   1.836  	;;
   1.837        esac
   1.838  
   1.839 -      if test -n "$objs$old_deplibs"; then
   1.840 +      output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'`
   1.841 +      if test "X$output_objdir" = "X$output"; then
   1.842 +	output_objdir="$objdir"
   1.843 +      else
   1.844 +	output_objdir="$output_objdir/$objdir"
   1.845 +      fi
   1.846 +
   1.847 +      if test -n "$objs"; then
   1.848  	$echo "$modename: cannot build libtool library \`$output' from non-libtool objects:$objs" 2>&1
   1.849  	exit 1
   1.850        fi
   1.851  
   1.852 +      # How the heck are we supposed to write a wrapper for a shared library?
   1.853 +      if test -n "$link_against_libtool_libs"; then
   1.854 +	 $echo "$modename: error: cannot link shared libraries into libtool libraries" 1>&2
   1.855 +	 exit 1
   1.856 +      fi
   1.857 +
   1.858        if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
   1.859  	$echo "$modename: warning: \`-dlopen' is ignored for libtool libraries" 1>&2
   1.860        fi
   1.861 @@ -1405,6 +1628,7 @@
   1.862  	  build_libtool_libs=convenience
   1.863  	  build_old_libs=yes
   1.864  	fi
   1.865 +	dependency_libs="$deplibs"
   1.866  
   1.867  	if test -n "$vinfo"; then
   1.868  	  $echo "$modename: warning: \`-version-info' is ignored for convenience libraries" 1>&2
   1.869 @@ -1565,12 +1789,34 @@
   1.870  	  # Don't allow undefined symbols.
   1.871  	  allow_undefined_flag="$no_undefined_flag"
   1.872  	fi
   1.873 +
   1.874 +	dependency_libs="$deplibs"
   1.875 +	case "$host" in
   1.876 +	*-*-cygwin* | *-*-mingw* | *-*-os2* | *-*-beos* | *-*-freebsd* )
   1.877 +	  # these systems don't actually have a c library (as such)!
   1.878 +	  ;;
   1.879 +        *-*-rhapsody*)
   1.880 +	  # rhapsody is a little odd...
   1.881 +	  deplibs="$deplibs -framework System"
   1.882 +	  ;;
   1.883 +	*)
   1.884 +	  # Add libc to deplibs on all other systems.
   1.885 +	  deplibs="$deplibs -lc"
   1.886 +	  ;;
   1.887 +	esac
   1.888        fi
   1.889  
   1.890 -      if test "$relink" = no; then
   1.891 -	# Remove our outputs.
   1.892 +      # Create the output directory, or remove our outputs if we need to.
   1.893 +      if test -d $output_objdir; then
   1.894  	$show "${rm}r $output_objdir/$outputname $output_objdir/$libname.* $output_objdir/${libname}${release}.*"
   1.895  	$run ${rm}r $output_objdir/$outputname $output_objdir/$libname.* $output_objdir/${libname}${release}.*
   1.896 +      else
   1.897 +	$show "$mkdir $output_objdir"
   1.898 +	$run $mkdir $output_objdir
   1.899 +	status=$?
   1.900 +	if test $status -ne 0 && test ! -d $output_objdir; then
   1.901 +	  exit $status
   1.902 +	fi
   1.903        fi
   1.904  
   1.905        # Now set the variables for building old libraries.
   1.906 @@ -1581,428 +1827,7 @@
   1.907  	oldobjs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP`
   1.908        fi
   1.909  
   1.910 -      # Save some variables
   1.911 -      name_save=$name
   1.912 -      libname_save=$libname
   1.913 -	
   1.914 -      # Find libtool libraries and add their dependencies and directories
   1.915 -      save_deplibs="$deplibs"
   1.916 -      deplibs=            # libraries to link (used in archive_cmds)
   1.917 -      newdependency_libs= # all dependency libraries
   1.918 -      uninst_path=        # paths that contain uninstalled libtool libraries
   1.919 -      new_lib_search_path=
   1.920 -      for deplib in $save_deplibs; do
   1.921 -	lib=
   1.922 -	case "$deplib" in
   1.923 -	-L*)
   1.924 -	  case "$deplibs " in
   1.925 -	  *" $deplib "*) ;;
   1.926 -	  *)
   1.927 -	    deplibs="$deplibs $deplib"
   1.928 -	    newdependency_libs="$newdependency_libs $deplib"
   1.929 -	    new_lib_search_path="$new_lib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
   1.930 -	    ;;
   1.931 -	  esac
   1.932 -	  continue
   1.933 -	  ;;
   1.934 -	-l*)
   1.935 -	  name=`$echo "X$deplib" | $Xsed -e 's/^-l//'`
   1.936 -	  found=no
   1.937 -	  for searchdir in $lib_search_path; do
   1.938 -	    # Search the libtool library
   1.939 -	    lib="$searchdir/lib${name}.la"
   1.940 -	    if test -f "$lib"; then
   1.941 -	      found=yes
   1.942 -	      break
   1.943 -	    fi
   1.944 -	  done
   1.945 -	  if test "$found" != yes; then
   1.946 -	    deplibs="$deplibs $deplib"
   1.947 -	    newdependency_libs="$newdependency_libs $deplib"
   1.948 -	    continue
   1.949 -	  fi
   1.950 -	  ;;
   1.951 -	*)
   1.952 -	  lib="$deplib"
   1.953 -	  if test -f "$lib"; then :
   1.954 -	  else
   1.955 -	    $echo "$modename: cannot find the library \`$lib'" 1>&2
   1.956 -	    exit 1
   1.957 -	  fi
   1.958 -	  ;;
   1.959 -	esac
   1.960 -	libdir=
   1.961 -	library_names=
   1.962 -	old_library=
   1.963 -
   1.964 -	# Check to see that this really is a libtool archive.
   1.965 -	if (sed -e '2q' $lib | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
   1.966 -	else
   1.967 -	  $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
   1.968 -	  exit 1
   1.969 -	fi
   1.970 -
   1.971 -	ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'`
   1.972 -	test "X$ladir" = "X$lib" && ladir="."
   1.973 -	# We need an absolute path.
   1.974 -	case "$ladir" in
   1.975 -	[\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;;
   1.976 -	*)
   1.977 -	  abs_ladir=`cd "$ladir" && pwd`
   1.978 -	  if test -z "$abs_ladir"; then
   1.979 -	    $echo "$modename: warning: cannot determine absolute directory name of \`$ladir'" 1>&2
   1.980 -	    $echo "$modename: passing it literally to the linker, although it might fail" 1>&2
   1.981 -	    abs_ladir="$ladir"
   1.982 -	  fi
   1.983 -	  ;;
   1.984 -	esac
   1.985 -	laname=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
   1.986 -
   1.987 -	# If the library was installed with an old release of libtool,
   1.988 -	# it will not redefine variable installed.
   1.989 -	installed=yes
   1.990 -
   1.991 -	# Read the .la file
   1.992 -	case "$lib" in
   1.993 -	*/* | *\\*) . $lib ;;
   1.994 -	*) . ./$lib ;;
   1.995 -	esac
   1.996 -
   1.997 -	# Get the name of the library we link against.
   1.998 -	linklib=
   1.999 -	for l in $old_library $library_names; do
  1.1000 -	  linklib="$l"
  1.1001 -	done
  1.1002 -
  1.1003 -	if test -z "$linklib"; then
  1.1004 -	  $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
  1.1005 -	  exit 1
  1.1006 -	fi
  1.1007 -
  1.1008 -	if test -z "$libdir"; then
  1.1009 -	  # It is a libtool convenience library, so add in its objects.
  1.1010 -	  convenience="$convenience $ladir/$objdir/$old_library"
  1.1011 -	  old_convenience="$old_convenience $ladir/$objdir/$old_library"
  1.1012 -	  deplibs="$deplibs $ladir/$objdir/$old_library"
  1.1013 -	  newdependency_libs="$newdependency_libs $dependency_libs"
  1.1014 -	  continue
  1.1015 -	fi
  1.1016 -
  1.1017 -	# Find the relevant object directory and library name.
  1.1018 -	if test "X$installed" = Xyes; then
  1.1019 -	  if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then
  1.1020 -	    $echo "$modename: warning: library \`$lib' was moved." 1>&2
  1.1021 -	    dir="$ladir"
  1.1022 -	    absdir="$abs_ladir"
  1.1023 -	    libdir="$abs_ladir"
  1.1024 -	  else
  1.1025 -	    dir="$libdir"
  1.1026 -	    absdir="$libdir"
  1.1027 -	  fi
  1.1028 -	else
  1.1029 -	  dir="$ladir/$objdir"
  1.1030 -	  absdir="$abs_ladir/$objdir"
  1.1031 -	  # Remove this search path later
  1.1032 -	  uninst_path="$uninst_path $abs_ladir"
  1.1033 -	fi
  1.1034 -	name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
  1.1035 -	link_static=no # Whether this library is linked statically
  1.1036 -
  1.1037 -	if test -n "$library_names" &&
  1.1038 -	   { test "$prefer_static_libs" = no || test -z "$old_library"; }; then
  1.1039 -	  # This is a shared library
  1.1040 -	  if test "$hardcode_into_libs" = yes; then
  1.1041 -	    # Hardcode the library path.
  1.1042 -	    # Skip directories that are in the system default run-time
  1.1043 -	    # search path.
  1.1044 -	    case " $sys_lib_dlsearch_path " in
  1.1045 -	    *" $absdir "*) ;;
  1.1046 -	    *)
  1.1047 -	      case "$compile_rpath " in
  1.1048 -	      *" $absdir "*) ;;
  1.1049 -	      *) compile_rpath="$compile_rpath $absdir" 
  1.1050 -	      esac
  1.1051 -	      ;;
  1.1052 -	    esac
  1.1053 -	    case " $sys_lib_dlsearch_path " in
  1.1054 -	    *" $libdir "*) ;;
  1.1055 -	    *)
  1.1056 -	      case "$finalize_rpath " in
  1.1057 -	      *" $libdir "*) ;;
  1.1058 -	      *) finalize_rpath="$finalize_rpath $libdir"
  1.1059 -	      esac
  1.1060 -	      ;;
  1.1061 -	    esac
  1.1062 -	  fi
  1.1063 -	    
  1.1064 -	  if test -n "$old_archive_from_expsyms_cmds"; then
  1.1065 -	    # figure out the soname
  1.1066 -	    set dummy $library_names
  1.1067 -	    realname="$2"
  1.1068 -	    shift; shift
  1.1069 -	    libname=`eval \\$echo \"$libname_spec\"`
  1.1070 -	    if test -n "$soname_spec"; then
  1.1071 -	      eval soname=\"$soname_spec\"
  1.1072 -	    else
  1.1073 -	      soname="$realname"
  1.1074 -	    fi
  1.1075 -
  1.1076 -	    # Make a new name for the extract_expsyms_cmds to use
  1.1077 -	    newlib="libimp-`echo $soname | sed 's/^lib//;s/\.dll$//'`.a"
  1.1078 -	  
  1.1079 -	    # If the library has no export list, then create one now
  1.1080 -	    if test -f "$output_objdir/$soname-def"; then :
  1.1081 -	    else
  1.1082 -	      $show "extracting exported symbol list from \`$soname'"
  1.1083 -	      IFS="${IFS= 	}"; save_ifs="$IFS"; IFS='~'
  1.1084 -	      eval cmds=\"$extract_expsyms_cmds\"
  1.1085 -	      for cmd in $cmds; do
  1.1086 -		IFS="$save_ifs"
  1.1087 -		$show "$cmd"
  1.1088 -		$run eval "$cmd" || exit $?
  1.1089 -	      done
  1.1090 -	      IFS="$save_ifs"
  1.1091 -	    fi
  1.1092 - 
  1.1093 -	    # Create $newlib
  1.1094 -	    if test -f "$output_objdir/$newlib"; then :; else
  1.1095 -	      $show "generating import library for \`$soname'"
  1.1096 -	      IFS="${IFS= 	}"; save_ifs="$IFS"; IFS='~'
  1.1097 -	      eval cmds=\"$old_archive_from_expsyms_cmds\"
  1.1098 -	      for cmd in $cmds; do
  1.1099 -		IFS="$save_ifs"
  1.1100 -		$show "$cmd"
  1.1101 -		$run eval "$cmd" || exit $?
  1.1102 -	      done
  1.1103 -	      IFS="$save_ifs"
  1.1104 -	    fi
  1.1105 -	    # make sure the library variables are pointing to the new library
  1.1106 -	    dir=$output_objdir
  1.1107 -	    linklib=$newlib
  1.1108 -	  fi
  1.1109 -
  1.1110 -	  add_dir=
  1.1111 -	  add_shlibpath=
  1.1112 -	  add_name=no
  1.1113 -	  if test "$relink" = no; then
  1.1114 -	    lib_linked=yes
  1.1115 -	    case "$hardcode_action" in
  1.1116 -	    immediate | unsupported)
  1.1117 -	      if test "$hardcode_direct" = no; then
  1.1118 -		deplibs="$deplibs $dir/$linklib"
  1.1119 -	      elif test "$hardcode_minus_L" = no; then
  1.1120 -		case "$host" in
  1.1121 -		*-*-sunos*) add_shlibpath="$dir" ;;
  1.1122 -		esac
  1.1123 -		add_dir="-L$dir"
  1.1124 -		add_name=yes
  1.1125 -	      elif test "$hardcode_shlibpath_var" = no; then
  1.1126 -		add_shlibpath="$dir"
  1.1127 -		add_name=yes
  1.1128 -	      else
  1.1129 -		lib_linked=no
  1.1130 -	      fi
  1.1131 -	      ;;
  1.1132 -	    relink)
  1.1133 -	      if test "$hardcode_direct" = yes; then
  1.1134 -		deplibs="$deplibs $dir/$linklib"
  1.1135 -	      elif test "$hardcode_minus_L" = yes; then
  1.1136 -		add_dir="-L$dir"
  1.1137 -		add_name=yes
  1.1138 -	      elif test "$hardcode_shlibpath_var" = yes; then
  1.1139 -		add_shlibpath="$dir"
  1.1140 -		add_name=yes
  1.1141 -	      else
  1.1142 -		lib_linked=no
  1.1143 -	      fi
  1.1144 -	      ;;
  1.1145 -	    *) lib_linked=no ;;
  1.1146 -	    esac
  1.1147 -
  1.1148 -	    if test "$lib_linked" != yes; then
  1.1149 -	      $echo "$modename: configuration error: unsupported hardcode properties"
  1.1150 -	      exit 1
  1.1151 -	    fi
  1.1152 -	    if test -n "$add_shlibpath"; then
  1.1153 -	      case ":$compile_shlibpath:" in
  1.1154 -	      *":$add_shlibpath:"*) ;;
  1.1155 -	      *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;;
  1.1156 -	      esac
  1.1157 -	    fi
  1.1158 -	  else
  1.1159 -	    # Install command for both is simple: just hardcode it.
  1.1160 -	    if test "$hardcode_direct" = yes; then
  1.1161 -	      deplibs="$deplibs $libdir/$linklib"
  1.1162 -	    elif test "$hardcode_minus_L" = yes; then
  1.1163 -	      add_dir="-L$libdir"
  1.1164 -	      add_name=yes
  1.1165 -	    elif test "$hardcode_shlibpath_var" = yes; then
  1.1166 -	      add_name=yes
  1.1167 -	    else
  1.1168 -	      # We cannot seem to hardcode it, guess we'll fake it.
  1.1169 -	      add_dir="-L$libdir"
  1.1170 -	      add_name=yes
  1.1171 -	    fi
  1.1172 -	  fi
  1.1173 -	  if test "$hardcode_direct" != yes && \
  1.1174 -	     test "$hardcode_minus_L" != yes && \
  1.1175 -	     test "$hardcode_shlibpath_var" = yes; then
  1.1176 -	      case ":$finalize_shlibpath:" in
  1.1177 -	      *":$libdir:"*) ;;
  1.1178 -	      *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
  1.1179 -	      esac
  1.1180 -	  fi
  1.1181 -	  if test -n "$add_dir"; then
  1.1182 -	    case "$deplibs " in
  1.1183 -	    *" $add_dir "*) ;;
  1.1184 -	    *) deplibs="$deplibs $add_dir" ;;
  1.1185 -	    esac
  1.1186 -	  fi
  1.1187 -	  test "$add_name" = yes && deplibs="$deplibs -l$name"
  1.1188 -	elif test "$build_libtool_libs" = yes; then
  1.1189 -	  # Not a shared library
  1.1190 -	  if test "$deplibs_check_method" != pass_all; then
  1.1191 -	    # We're trying link a shared library against a static one
  1.1192 -	    # but the system doesn't support it.
  1.1193 -	    # Just print a warning and add the library to dependency_libs so
  1.1194 -	    # that the program can be linked against the static library.
  1.1195 -	    echo
  1.1196 -	    echo "*** Warning: This library needs some functionality provided by $libname."
  1.1197 -	    echo "*** I have the capability to make that library automatically link in when"
  1.1198 -	    echo "*** you link to this library.  But I can only do this if you have a"
  1.1199 -	    echo "*** shared version of the library, which you do not appear to have."
  1.1200 -	  else
  1.1201 -	    convenience="$convenience $dir/$old_library"
  1.1202 -	    old_convenience="$old_convenience $dir/$old_library"
  1.1203 -	    deplibs="$deplibs $dir/$old_library"
  1.1204 -	    link_static=yes
  1.1205 -	  fi
  1.1206 -	fi
  1.1207 -
  1.1208 -	if test -n "$dependency_libs"; then
  1.1209 -	  # Extract -R from dependency_libs
  1.1210 -	  temp_deplibs=
  1.1211 -	  for libdir in $dependency_libs; do
  1.1212 -	    case "$libdir" in
  1.1213 -	    -R*) temp_xrpath=`$echo "X$libdir" | $Xsed -e 's/^-R//'`
  1.1214 -		 case " $xrpath " in
  1.1215 -		 *" $temp_xrpath "*) ;;
  1.1216 -		 *) xrpath="$xrpath $temp_xrpath";;
  1.1217 -		 esac;;
  1.1218 -	    *) temp_deplibs="$temp_deplibs $libdir";;
  1.1219 -	    esac
  1.1220 -	  done
  1.1221 -	  dependency_libs="$temp_deplibs"
  1.1222 -	fi
  1.1223 -
  1.1224 -	new_lib_search_path="$new_lib_search_path $absdir"
  1.1225 -	# Link against this library
  1.1226 -	test "$link_static" = no && newdependency_libs="$newdependency_libs $abs_ladir/$laname"
  1.1227 -	# ... and its dependency_libs
  1.1228 -	newdependency_libs="$newdependency_libs $dependency_libs"
  1.1229 -
  1.1230 -	if test $link_all_deplibs != no; then
  1.1231 -	  # Add the search paths of all dependency libraries
  1.1232 -	  for deplib in $dependency_libs; do
  1.1233 -	    case "$deplib" in
  1.1234 -	    -L*) path="$deplib" ;;
  1.1235 -	    *.la) 
  1.1236 -	      if grep "^installed=no" $deplib > /dev/null; then
  1.1237 -		dir=`$echo "X$deplib" | $Xsed -e 's%/[^/]*$%%'`
  1.1238 -		test "X$dir" = "X$deplib" && dir="."
  1.1239 -		# We need an absolute path.
  1.1240 -		case "$dir" in
  1.1241 -		[\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;;
  1.1242 -		*)
  1.1243 -		  absdir=`cd "$dir" && pwd`
  1.1244 -		  if test -z "$absdir"; then
  1.1245 -		    $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2
  1.1246 -		    absdir="$dir"
  1.1247 -		  fi
  1.1248 -		  ;;
  1.1249 -		esac
  1.1250 -		path="-L$absdir/$objdir"
  1.1251 -	      else
  1.1252 -		eval libdir=`sed -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
  1.1253 -		if test -z "$libdir"; then
  1.1254 -		  $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
  1.1255 -		  exit 1
  1.1256 -		fi
  1.1257 -		path="-L$libdir"
  1.1258 -	      fi
  1.1259 -	      ;;
  1.1260 -	    *)
  1.1261 -	      continue
  1.1262 -	      ;;
  1.1263 -	    esac
  1.1264 -	    case "$deplibs " in
  1.1265 -	    *" $path "*) ;;
  1.1266 -	    *) deplibs="$path $deplibs" ;;
  1.1267 -	    esac
  1.1268 -	  done
  1.1269 -	fi
  1.1270 -      done
  1.1271 -
  1.1272 -      # Make sure lib_search_path contains only unique directories.
  1.1273 -      lib_search_path=
  1.1274 -      for dir in $new_lib_search_path; do
  1.1275 -	case "$lib_search_path " in
  1.1276 -	*" $dir "*) ;;
  1.1277 -	*) lib_search_path="$lib_search_path $dir" ;;
  1.1278 -	esac
  1.1279 -      done
  1.1280 -      lib_search_path="$lib_search_path $sys_lib_search_path"
  1.1281 -      
  1.1282 -      # Make sure newdependency_libs contains only unique libraries and directories.
  1.1283 -      dependency_libs=
  1.1284 -      for deplib in $newdependency_libs; do
  1.1285 -	case "$dependency_libs " in
  1.1286 -	*" $deplib "*) ;;
  1.1287 -	*) dependency_libs="$dependency_libs $deplib" ;;
  1.1288 -	esac
  1.1289 -      done
  1.1290 -      
  1.1291 -      # Eliminate all temporary directories.
  1.1292 -      for path in $uninst_path; do
  1.1293 -	lib_search_path=`echo "$lib_search_path " | sed -e 's% $path % %g'`
  1.1294 -	deplibs=`echo "$deplibs " | sed -e 's% -L$path % %g'`
  1.1295 -	dependency_libs=`echo "$dependency_libs " | sed -e 's% -L$path % %g'`
  1.1296 -      done
  1.1297 -      
  1.1298 -      if test -n "$xrpath"; then
  1.1299 -	# If the user specified any rpath flags, then add them.
  1.1300 -	temp_xrpath=
  1.1301 -	for libdir in $xrpath; do
  1.1302 -	  temp_xrpath="$temp_xrpath -R$libdir"
  1.1303 -	  case "$compile_rpath " in
  1.1304 -	  *" $libdir "*) ;;
  1.1305 -	  *) compile_rpath="$compile_rpath $libdir" ;;
  1.1306 -	  esac
  1.1307 -	  case "$finalize_rpath " in
  1.1308 -	  *" $libdir "*) ;;
  1.1309 -	  *) finalize_rpath="$finalize_rpath $libdir" ;;
  1.1310 -	  esac
  1.1311 -	done
  1.1312 -	dependency_libs="$temp_xrpath $dependency_libs"
  1.1313 -      fi
  1.1314 -
  1.1315 -      # Restore the variables
  1.1316 -      libname=$libname_save
  1.1317 -      name=$name_save
  1.1318 -
  1.1319        if test "$build_libtool_libs" = yes; then
  1.1320 -	if test -n "$rpath"; then
  1.1321 -	  case "$host" in
  1.1322 -	  *-*-cygwin* | *-*-mingw* | *-*-os2* | *-*-beos*)
  1.1323 -	    # these systems don't actually have a c library (as such)!
  1.1324 -	    ;;
  1.1325 -	  *)
  1.1326 -	    # Add libc to deplibs on all other systems.
  1.1327 -	    deplibs="$deplibs -lc"
  1.1328 -	    ;;
  1.1329 -	  esac
  1.1330 -	fi
  1.1331 -
  1.1332  	# Transform deplibs into only deplibs that can be linked in shared.
  1.1333  	name_save=$name
  1.1334  	libname_save=$libname
  1.1335 @@ -2213,61 +2038,6 @@
  1.1336        
  1.1337        # Test again, we may have decided not to build it any more
  1.1338        if test "$build_libtool_libs" = yes; then
  1.1339 -	if test "$hardcode_into_libs" = yes; then
  1.1340 -	  # Hardcode the library paths
  1.1341 -	  hardcode_libdirs=
  1.1342 -	  dep_rpath=
  1.1343 -	  rpath="$finalize_rpath"
  1.1344 -	  test "$relink" = no && rpath="$compile_rpath$rpath"
  1.1345 -	  for libdir in $rpath; do
  1.1346 -	    if test -n "$hardcode_libdir_flag_spec"; then
  1.1347 -	      if test -n "$hardcode_libdir_separator"; then
  1.1348 -		if test -z "$hardcode_libdirs"; then
  1.1349 -		  hardcode_libdirs="$libdir"
  1.1350 -		else
  1.1351 -		  # Just accumulate the unique libdirs.
  1.1352 -		  case "$hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator" in
  1.1353 -		  *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
  1.1354 -		    ;;
  1.1355 -		  *)
  1.1356 -		    hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
  1.1357 -		    ;;
  1.1358 -		  esac
  1.1359 -		fi
  1.1360 -	      else
  1.1361 -		eval flag=\"$hardcode_libdir_flag_spec\"
  1.1362 -		dep_rpath="$dep_rpath $flag"
  1.1363 -	      fi
  1.1364 -	    elif test -n "$runpath_var"; then
  1.1365 -	      case "$perm_rpath " in
  1.1366 -	      *" $libdir "*) ;;
  1.1367 -	      *) perm_rpath="$perm_rpath $libdir" ;;
  1.1368 -	      esac
  1.1369 -	    fi
  1.1370 -	  done
  1.1371 -	  # Substitute the hardcoded libdirs into the rpath.
  1.1372 -	  if test -n "$hardcode_libdir_separator" &&
  1.1373 -	     test -n "$hardcode_libdirs"; then
  1.1374 -	    libdir="$hardcode_libdirs"
  1.1375 -	    eval dep_rpath=\"$hardcode_libdir_flag_spec\"
  1.1376 -	  fi
  1.1377 -	  if test -n "$runpath_var" && test -n "$perm_rpath"; then
  1.1378 -	    # We should set the runpath_var.
  1.1379 -	    rpath=
  1.1380 -	    for dir in $perm_rpath; do
  1.1381 -	      rpath="$rpath$dir:"
  1.1382 -	    done
  1.1383 -	    eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var"
  1.1384 -	  fi
  1.1385 -	  test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs"
  1.1386 -	fi
  1.1387 -
  1.1388 -	shlibpath="$finalize_shlibpath"	
  1.1389 -	test "$relink" = no && shlibpath="$compile_shlibpath$shlibpath"	
  1.1390 -	if test -n "$shlibpath"; then
  1.1391 -	  eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var"
  1.1392 -	fi
  1.1393 -  
  1.1394  	# Get the real and link names of the library.
  1.1395  	eval library_names=\"$library_names_spec\"
  1.1396  	set dummy $library_names
  1.1397 @@ -2287,7 +2057,7 @@
  1.1398  	done
  1.1399  
  1.1400  	# Ensure that we have .o objects for linkers which dislike .lo
  1.1401 -	# (e.g. aix) incase we are running --disable-static
  1.1402 +	# (e.g. aix) in case we are running --disable-static
  1.1403  	for obj in $libobjs; do
  1.1404  	  xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'`
  1.1405  	  if test "X$xdir" = "X$obj"; then
  1.1406 @@ -2375,12 +2145,7 @@
  1.1407  
  1.1408  	if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then
  1.1409  	  eval flag=\"$thread_safe_flag_spec\"
  1.1410 -	  linker_flags="$linker_flags $flag"
  1.1411 -	fi
  1.1412 -
  1.1413 -	# Make a backup of the uninstalled library when relinking
  1.1414 -	if test "$relink" = yes && test "$hardcode_into_libs" = yes ; then
  1.1415 -	  $run eval '(cd $output_objdir && $rm ${realname}U && $mv $realname ${realname}U)' || exit $?
  1.1416 +	  linkopts="$linkopts $flag"
  1.1417  	fi
  1.1418  
  1.1419  	# Do each of the archive commands.
  1.1420 @@ -2397,12 +2162,6 @@
  1.1421  	done
  1.1422  	IFS="$save_ifs"
  1.1423  
  1.1424 -	# Restore the uninstalled library and exit
  1.1425 -	if test "$relink" = yes && test "$hardcode_into_libs" = yes; then
  1.1426 -	  $run eval '(cd $output_objdir && $rm ${realname}T && $mv $realname ${realname}T && $mv "$realname"U $realname)' || exit $?
  1.1427 -	  exit 0
  1.1428 -	fi
  1.1429 -
  1.1430  	# Create links to the real library.
  1.1431  	for linkname in $linknames; do
  1.1432  	  if test "$realname" != "$linkname"; then
  1.1433 @@ -2419,7 +2178,12 @@
  1.1434        fi
  1.1435        ;;
  1.1436  
  1.1437 -    obj)
  1.1438 +    *.lo | *.o | *.obj)
  1.1439 +      if test -n "$link_against_libtool_libs"; then
  1.1440 +	$echo "$modename: error: cannot link libtool libraries into objects" 1>&2
  1.1441 +	exit 1
  1.1442 +      fi
  1.1443 +
  1.1444        if test -n "$deplibs"; then
  1.1445  	$echo "$modename: warning: \`-l' and \`-L' are ignored for objects" 1>&2
  1.1446        fi
  1.1447 @@ -2446,7 +2210,7 @@
  1.1448  
  1.1449        case "$output" in
  1.1450        *.lo)
  1.1451 -	if test -n "$objs$old_deplibs"; then
  1.1452 +	if test -n "$objs"; then
  1.1453  	  $echo "$modename: cannot build library object \`$output' from non-libtool objects" 1>&2
  1.1454  	  exit 1
  1.1455  	fi
  1.1456 @@ -2513,7 +2277,7 @@
  1.1457        fi
  1.1458  
  1.1459        # Create the old-style object.
  1.1460 -      reload_objs="$objs$old_deplibs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}$'/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`" $reload_conv_objs"
  1.1461 +      reload_objs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}$'/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`" $reload_conv_objs"
  1.1462  
  1.1463        output="$obj"
  1.1464        eval cmds=\"$reload_cmds\"
  1.1465 @@ -2548,7 +2312,7 @@
  1.1466  	exit 0
  1.1467        fi
  1.1468  
  1.1469 -      if test -n "$pic_flag" || test "$pic_mode" != default; then
  1.1470 +      if test -n "$pic_flag"; then
  1.1471  	# Only do commands if we really have different PIC objects.
  1.1472  	reload_objs="$libobjs $reload_conv_objs"
  1.1473  	output="$libobj"
  1.1474 @@ -2584,7 +2348,8 @@
  1.1475        exit 0
  1.1476        ;;
  1.1477  
  1.1478 -    prog)
  1.1479 +    # Anything else should be a program.
  1.1480 +    *)
  1.1481        if test -n "$vinfo"; then
  1.1482  	$echo "$modename: warning: \`-version-info' is ignored for programs" 1>&2
  1.1483        fi
  1.1484 @@ -2600,450 +2365,6 @@
  1.1485  	fi 
  1.1486        fi
  1.1487      
  1.1488 -      # Find libtool libraries and add their dependencies
  1.1489 -      save_deplibs="$deplibs"
  1.1490 -      deplibs=
  1.1491 -      newdependency_libs=
  1.1492 -      new_lib_search_path=
  1.1493 -      for deplib in $save_deplibs; do
  1.1494 -	lib=
  1.1495 -	case "$deplib" in
  1.1496 -	*.a | *.lib)
  1.1497 -	  deplibs="$deplibs $deplib"
  1.1498 -	  continue
  1.1499 -	  ;;
  1.1500 -	-L*)
  1.1501 -	  deplibs="$deplibs $deplib"
  1.1502 -	  new_lib_search_path="$new_lib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
  1.1503 -	  continue
  1.1504 -	  ;;
  1.1505 -	-l*)
  1.1506 -	  name=`$echo "X$deplib" | $Xsed -e 's/^-l//'`
  1.1507 -	  found=no
  1.1508 -	  for searchdir in $lib_search_path; do
  1.1509 -	    # Search the libtool library
  1.1510 -	    lib="$searchdir/lib${name}.la"
  1.1511 -	    if test -f "$lib"; then
  1.1512 -	      found=yes
  1.1513 -	      break
  1.1514 -	    fi
  1.1515 -	  done
  1.1516 -	  if test "$found" != yes; then
  1.1517 -	    deplibs="$deplibs $deplib"
  1.1518 -	    continue
  1.1519 -	  fi
  1.1520 -	  ;;
  1.1521 -	*)
  1.1522 -	  lib="$deplib"
  1.1523 -	  if test -f "$lib"; then :
  1.1524 -	  else
  1.1525 -	    $echo "$modename: cannot find the library \`$lib'" 1>&2
  1.1526 -	    exit 1
  1.1527 -	  fi
  1.1528 -	  ;;
  1.1529 -	esac
  1.1530 -	libdir=
  1.1531 -	library_names=
  1.1532 -	old_library=
  1.1533 -
  1.1534 -	# Check to see that this really is a libtool archive.
  1.1535 -	if (sed -e '2q' $lib | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
  1.1536 -	else
  1.1537 -	  $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
  1.1538 -	  exit 1
  1.1539 -	fi
  1.1540 -
  1.1541 -	# If the library was installed with an old release of libtool,
  1.1542 -	# it will not redefine variable installed.
  1.1543 -	installed=yes
  1.1544 -
  1.1545 -	# Read the .la file
  1.1546 -	case "$lib" in
  1.1547 -	*/* | *\\*) . $lib ;;
  1.1548 -	*) . ./$lib ;;
  1.1549 -	esac
  1.1550 -
  1.1551 -	# Get the name of the library we link against.
  1.1552 -	linklib=
  1.1553 -	for l in $old_library $library_names; do
  1.1554 -	  linklib="$l"
  1.1555 -	done
  1.1556 -
  1.1557 -	if test -z "$linklib"; then
  1.1558 -	  $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
  1.1559 -	  exit 1
  1.1560 -	fi
  1.1561 -
  1.1562 -	new_lib_search_path="$new_lib_search_path `$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'`"
  1.1563 -	deplibs="$deplibs $lib"
  1.1564 -
  1.1565 -	for deplib in $dependency_libs; do
  1.1566 -	  case "$deplib" in
  1.1567 -	  -L*)
  1.1568 -	    new_lib_search_path="$new_lib_search_path `$echo "X$deplib" | $Xsed -e 's/^-L//'`"
  1.1569 -	    ;;
  1.1570 -	  esac
  1.1571 -	  
  1.1572 -	  if test "$link_all_deplibs" != no || \
  1.1573 -	     test "$fast_install" != no || \
  1.1574 -	     test "$build_libtool_libs" = no || \
  1.1575 -	     test -z "$library_names"; then
  1.1576 -	    # Need to link against all dependency_libs
  1.1577 -	    deplibs="$deplibs $deplib"
  1.1578 -	  else
  1.1579 -	    # Need to hardcode shared library paths
  1.1580 -	    # or/and link against static libraries
  1.1581 -	    newdependency_libs="$newdependency_libs $deplib"
  1.1582 -	  fi
  1.1583 -	done
  1.1584 -      done
  1.1585 -      
  1.1586 -      # Eliminate all dependency_libs that are already contained in deplibs
  1.1587 -      dependency_libs=
  1.1588 -      for deplib in $newdependency_libs; do
  1.1589 -	case "$deplibs " in
  1.1590 -	*" $deplib "*) ;;
  1.1591 -	*) dependency_libs="$dependency_libs $deplib" ;;
  1.1592 -	esac
  1.1593 -      done
  1.1594 -
  1.1595 -      # Make sure lib_search_path contains only unique directories.
  1.1596 -      lib_search_path=
  1.1597 -      for dir in $new_lib_search_path; do
  1.1598 -	case "$lib_search_path " in
  1.1599 -	*" $dir "*) ;;
  1.1600 -	*) lib_search_path="$lib_search_path $dir" ;;
  1.1601 -	esac
  1.1602 -      done
  1.1603 -      lib_search_path="$lib_search_path $sys_lib_search_path"
  1.1604 -      
  1.1605 -      # Find libtool libraries and add their directories
  1.1606 -      alldeplibs=no
  1.1607 -      link_against_libtool_libs=
  1.1608 -      
  1.1609 -      for deplib in $deplibs @DEPLIBS@ $dependency_libs; do
  1.1610 -	lib=
  1.1611 -	case "$deplib" in
  1.1612 -	-L* | *.a | *.lib)
  1.1613 -	  compile_command="$compile_command $deplib"
  1.1614 -	  finalize_command="$finalize_command $deplib"
  1.1615 -	  continue
  1.1616 -	  ;;
  1.1617 -	-R*)
  1.1618 -	  dir=`$echo "X$deplib" | $Xsed -e 's/^-R//'`
  1.1619 -	  # Make sure the xrpath contains only unique directories.
  1.1620 -	  case "$xrpath " in
  1.1621 -	  *" $dir "*) ;;
  1.1622 -	  *) xrpath="$xrpath $dir" ;;
  1.1623 -	  esac
  1.1624 -	  continue
  1.1625 -	  ;;
  1.1626 -	@DEPLIBS@)
  1.1627 -	  alldeplibs=yes
  1.1628 -	  continue
  1.1629 -	  ;;
  1.1630 -	-l*)
  1.1631 -	  name=`$echo "X$deplib" | $Xsed -e 's/^-l//'`
  1.1632 -	  found=no
  1.1633 -	  for searchdir in $lib_search_path; do
  1.1634 -	    # Search the libtool library
  1.1635 -	    lib="$searchdir/lib${name}.la"
  1.1636 -	    if test -f "$lib"; then
  1.1637 -	      found=yes
  1.1638 -	      break
  1.1639 -	    fi
  1.1640 -	  done
  1.1641 -	  if test "$found" != yes; then
  1.1642 -	    compile_command="$compile_command $deplib"
  1.1643 -	    finalize_command="$finalize_command $deplib"
  1.1644 -	    continue
  1.1645 -	  fi
  1.1646 -	  ;;
  1.1647 -	*)
  1.1648 -	  lib="$deplib"
  1.1649 -	  if test -f "$lib"; then :
  1.1650 -	  else
  1.1651 -	    $echo "$modename: cannot find the library \`$lib'" 1>&2
  1.1652 -	    exit 1
  1.1653 -	  fi
  1.1654 -	  ;;
  1.1655 -	esac
  1.1656 -	libdir=
  1.1657 -	library_names=
  1.1658 -	old_library=
  1.1659 -
  1.1660 -	# Check to see that this really is a libtool archive.
  1.1661 -	if (sed -e '2q' $lib | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
  1.1662 -	else
  1.1663 -	  $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
  1.1664 -	  exit 1
  1.1665 -	fi
  1.1666 -
  1.1667 -	ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'`
  1.1668 -	test "X$ladir" = "X$lib" && ladir="."
  1.1669 -	# We need an absolute path.
  1.1670 -	case "$ladir" in
  1.1671 -	[\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;;
  1.1672 -	*)
  1.1673 -	  abs_ladir=`cd "$ladir" && pwd`
  1.1674 -	  if test -z "$abs_ladir"; then
  1.1675 -	    $echo "$modename: warning: cannot determine absolute directory name of \`$abs_ladir'" 1>&2
  1.1676 -	    $echo "$modename: passing it literally to the linker, although it might fail" 1>&2
  1.1677 -	    abs_ladir="$ladir"
  1.1678 -	  fi
  1.1679 -	  ;;
  1.1680 -	esac
  1.1681 -	laname=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
  1.1682 -
  1.1683 -	# If the library was installed with an old release of libtool,
  1.1684 -	# it will not redefine variable installed.
  1.1685 -	installed=yes
  1.1686 -
  1.1687 -	# Read the .la file
  1.1688 -	case "$lib" in
  1.1689 -	*/* | *\\*) . $lib ;;
  1.1690 -	*) . ./$lib ;;
  1.1691 -	esac
  1.1692 -
  1.1693 -	# Get the name of the library we link against.
  1.1694 -	linklib=
  1.1695 -	for l in $old_library $library_names; do
  1.1696 -	  linklib="$l"
  1.1697 -	done
  1.1698 -
  1.1699 -	if test -z "$linklib"; then
  1.1700 -	  $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
  1.1701 -	  exit 1
  1.1702 -	fi
  1.1703 -
  1.1704 -	# Find the relevant object directory and library name.
  1.1705 -	if test "X$installed" = Xyes; then
  1.1706 -	  if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then
  1.1707 -	    $echo "$modename: warning: library \`$lib' was moved." 1>&2
  1.1708 -	    dir="$ladir"
  1.1709 -	    absdir="$abs_ladir"
  1.1710 -	    libdir="$abs_ladir"
  1.1711 -	  else
  1.1712 -	    dir="$libdir"
  1.1713 -	    absdir="$libdir"
  1.1714 -	  fi
  1.1715 -	else
  1.1716 -	  dir="$ladir/$objdir"
  1.1717 -	  absdir="$abs_ladir/$objdir"
  1.1718 -	fi
  1.1719 -	name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
  1.1720 -
  1.1721 -	hardcode=yes
  1.1722 -	test "$hardcode_into_libs" = yes && test "$alldeplibs" = yes && hardcode=no
  1.1723 -	if test "$hardcode" = yes && test -n "$library_names" &&
  1.1724 -	   { test "$prefer_static_libs" = no || test -z "$old_library"; }; then
  1.1725 -	  # We need to hardcode the library path
  1.1726 -	  if test -n "$shlibpath_var"; then
  1.1727 -	    # Make sure the rpath contains only unique directories.
  1.1728 -	    case "$temp_rpath " in
  1.1729 -	    *" $dir "*) ;;
  1.1730 -	    *" $absdir "*) ;;
  1.1731 -	    *) temp_rpath="$temp_rpath $dir" ;;
  1.1732 -	    esac
  1.1733 -	  fi
  1.1734 -
  1.1735 -	  # Hardcode the library path.
  1.1736 -	  # Skip directories that are in the system default run-time
  1.1737 -	  # search path.
  1.1738 -	  case " $sys_lib_dlsearch_path " in
  1.1739 -	  *" $absdir "*) ;;
  1.1740 -	  *)
  1.1741 -	    case "$compile_rpath " in
  1.1742 -	    *" $absdir "*) ;;
  1.1743 -	    *) compile_rpath="$compile_rpath $absdir" 
  1.1744 -	    esac
  1.1745 -	    ;;
  1.1746 -	  esac
  1.1747 -
  1.1748 -	  case " $sys_lib_dlsearch_path " in
  1.1749 -	  *" $libdir "*) ;;
  1.1750 -	  *)
  1.1751 -	    case "$finalize_rpath " in
  1.1752 -	    *" $libdir "*) ;;
  1.1753 -	    *) finalize_rpath="$finalize_rpath $libdir"
  1.1754 -	    esac
  1.1755 -	    ;;
  1.1756 -	  esac
  1.1757 -	fi
  1.1758 -
  1.1759 -	if test "$alldeplibs" = yes &&
  1.1760 -	   { test "$deplibs_check_method" = pass_all ||
  1.1761 -	     { test "$build_libtool_libs" = yes &&
  1.1762 -	       test -n "$library_names"; }; }; then
  1.1763 -	  # Do we only need to link against static libraries?
  1.1764 -	  continue
  1.1765 -	fi
  1.1766 -	
  1.1767 -	if test -z "$libdir"; then
  1.1768 -	  # It is a libtool convenience library, so add in its objects.
  1.1769 -	  convenience="$convenience $dir/$old_library"
  1.1770 -	  old_convenience="$old_convenience $dir/$old_library"
  1.1771 -	  compile_command="$compile_command $dir/$old_library"
  1.1772 -	  finalize_command="$finalize_command $dir/$old_library"
  1.1773 -	  continue
  1.1774 -	fi
  1.1775 -
  1.1776 -	if test -n "$library_names" &&
  1.1777 -	   { test "$prefer_static_libs" = no || test -z "$old_library"; }; then
  1.1778 -	  link_against_libtool_libs="$link_against_libtool_libs $lib"
  1.1779 -
  1.1780 -	  if test -n "$old_archive_from_expsyms_cmds"; then
  1.1781 -	    # figure out the soname
  1.1782 -	    set dummy $library_names
  1.1783 -	    realname="$2"
  1.1784 -	    shift; shift
  1.1785 -	    libname=`eval \\$echo \"$libname_spec\"`
  1.1786 -	    if test -n "$soname_spec"; then
  1.1787 -	      eval soname=\"$soname_spec\"
  1.1788 -	    else
  1.1789 -	      soname="$realname"
  1.1790 -	    fi
  1.1791 -
  1.1792 -	    # Make a new name for the extract_expsyms_cmds to use
  1.1793 -	    newlib="libimp-`echo $soname | sed 's/^lib//;s/\.dll$//'`.a"
  1.1794 -	  
  1.1795 -	    # If the library has no export list, then create one now
  1.1796 -	    if test -f "$output_objdir/$soname-def"; then :
  1.1797 -	    else
  1.1798 -	      $show "extracting exported symbol list from \`$soname'"
  1.1799 -	      IFS="${IFS= 	}"; save_ifs="$IFS"; IFS='~'
  1.1800 -	      eval cmds=\"$extract_expsyms_cmds\"
  1.1801 -	      for cmd in $cmds; do
  1.1802 -		IFS="$save_ifs"
  1.1803 -		$show "$cmd"
  1.1804 -		$run eval "$cmd" || exit $?
  1.1805 -	      done
  1.1806 -	      IFS="$save_ifs"
  1.1807 -	    fi
  1.1808 - 
  1.1809 -	    # Create $newlib
  1.1810 -	    if test -f "$output_objdir/$newlib"; then :; else
  1.1811 -	      $show "generating import library for \`$soname'"
  1.1812 -	      IFS="${IFS= 	}"; save_ifs="$IFS"; IFS='~'
  1.1813 -	      eval cmds=\"$old_archive_from_expsyms_cmds\"
  1.1814 -	      for cmd in $cmds; do
  1.1815 -		IFS="$save_ifs"
  1.1816 -		$show "$cmd"
  1.1817 -		$run eval "$cmd" || exit $?
  1.1818 -	      done
  1.1819 -	      IFS="$save_ifs"
  1.1820 -	    fi
  1.1821 -	    # make sure the library variables are pointing to the new library
  1.1822 -	    dir=$output_objdir
  1.1823 -	    linklib=$newlib
  1.1824 -	  fi
  1.1825 -
  1.1826 -	  lib_linked=yes
  1.1827 -	  add_dir=
  1.1828 -	  add_shlibpath=
  1.1829 -	  add_name=no
  1.1830 -	  case "$hardcode_action" in
  1.1831 -	  immediate | unsupported)
  1.1832 -	    if test "$hardcode_direct" = no; then
  1.1833 -	      compile_command="$compile_command $dir/$linklib"
  1.1834 -	    elif test "$hardcode_minus_L" = no; then
  1.1835 -	      case "$host" in
  1.1836 -	      *-*-sunos*) add_shlibpath="$dir" ;;
  1.1837 -	      esac
  1.1838 -	      add_dir="-L$dir"
  1.1839 -	      add_name=yes
  1.1840 -	    elif test "$hardcode_shlibpath_var" = no; then
  1.1841 -	      add_shlibpath="$dir"
  1.1842 -	      add_name=yes
  1.1843 -	    else
  1.1844 -	      lib_linked=no
  1.1845 -	    fi
  1.1846 -	    ;;
  1.1847 -
  1.1848 -	  relink)
  1.1849 -	    if test "$hardcode_direct" = yes; then
  1.1850 -	      compile_command="$compile_command $absdir/$linklib"
  1.1851 -	    elif test "$hardcode_minus_L" = yes; then
  1.1852 -	      add_dir="-L$absdir"
  1.1853 -	      add_name=yes
  1.1854 -	    elif test "$hardcode_shlibpath_var" = yes; then
  1.1855 -	      add_shlibpath="$absdir"
  1.1856 -	      add_name=yes
  1.1857 -	    else
  1.1858 -	      lib_linked=no
  1.1859 -	    fi
  1.1860 -	    ;;
  1.1861 -
  1.1862 -	  *) lib_linked=no ;;
  1.1863 -	  esac
  1.1864 -
  1.1865 -	  if test "$lib_linked" != yes; then
  1.1866 -	    $echo "$modename: configuration error: unsupported hardcode properties"
  1.1867 -	    exit 1
  1.1868 -	  fi
  1.1869 -	  if test -n "$add_dir"; then
  1.1870 -	    case "$compile_command " in
  1.1871 -	    *" $add_dir "*) ;;
  1.1872 -	    *) compile_command="$compile_command $add_dir" ;;
  1.1873 -	    esac
  1.1874 -	  fi
  1.1875 -	  if test -n "$add_shlibpath"; then
  1.1876 -	    case ":$compile_shlibpath:" in
  1.1877 -	    *":$add_shlibpath:"*) ;;
  1.1878 -	    *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;;
  1.1879 -	    esac
  1.1880 -	  fi
  1.1881 -	  test "$add_name" = yes && compile_command="$compile_command -l$name"
  1.1882 -
  1.1883 -	  add_dir=
  1.1884 -	  add_name=no
  1.1885 -	  # Finalize command for both is simple: just hardcode it.
  1.1886 -	  if test "$hardcode_direct" = yes; then
  1.1887 -	    finalize_command="$finalize_command $libdir/$linklib"
  1.1888 -	  elif test "$hardcode_minus_L" = yes; then
  1.1889 -	    add_dir="-L$libdir"
  1.1890 -	    add_name=yes
  1.1891 -	  elif test "$hardcode_shlibpath_var" = yes; then
  1.1892 -	    case ":$finalize_shlibpath:" in
  1.1893 -	    *":$libdir:"*) ;;
  1.1894 -	    *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
  1.1895 -	    esac
  1.1896 -	    add_name=yes
  1.1897 -	  else
  1.1898 -	    # We cannot seem to hardcode it, guess we'll fake it.
  1.1899 -	    add_dir="-L$libdir"
  1.1900 -	    add_name=yes
  1.1901 -	  fi
  1.1902 -	  if test -n "$add_dir"; then
  1.1903 -	    case "$finalize_command " in
  1.1904 -	    *" $add_dir "*) ;;
  1.1905 -	    *) finalize_command="$finalize_command $add_dir" ;;
  1.1906 -	    esac
  1.1907 -	  fi
  1.1908 -	  test "$add_name" = yes && finalize_command="$finalize_command -l$name"
  1.1909 -	else
  1.1910 -	  # Here we assume that one of hardcode_direct or hardcode_minus_L
  1.1911 -	  # is not unsupported.  This is valid on all known static and
  1.1912 -	  # shared platforms.
  1.1913 -	  if test "$hardcode_direct" != unsupported; then
  1.1914 -	    test -n "$old_library" && linklib="$old_library"
  1.1915 -	    compile_command="$compile_command $dir/$linklib"
  1.1916 -	    finalize_command="$finalize_command $dir/$linklib"
  1.1917 -	  else
  1.1918 -	    case "$compile_command " in
  1.1919 -	    *" -L$dir "*) ;;
  1.1920 -	    *) compile_command="$compile_command -L$dir";;
  1.1921 -	    esac
  1.1922 -	    compile_command="$compile_command -l$name"
  1.1923 -	    case "$finalize_command " in
  1.1924 -	    *" -L$dir "*) ;;
  1.1925 -	    *) finalize_command="$finalize_command -L$dir";;
  1.1926 -	    esac
  1.1927 -	    finalize_command="$finalize_command -l$name"
  1.1928 -	  fi
  1.1929 -	fi
  1.1930 -      done
  1.1931 -      
  1.1932        if test -n "$rpath$xrpath"; then
  1.1933  	# If the user specified any rpath flags, then add them.
  1.1934  	for libdir in $rpath $xrpath; do
  1.1935 @@ -3087,14 +2408,6 @@
  1.1936  	  *) perm_rpath="$perm_rpath $libdir" ;;
  1.1937  	  esac
  1.1938  	fi
  1.1939 -	case "$host" in
  1.1940 -	*-*-cygwin* | *-*-mingw* | *-*-os2*)
  1.1941 -	  case ":$dllsearchpath:" in
  1.1942 -	  *":$libdir:"*) ;;
  1.1943 -	  *) dllsearchpath="$dllsearchpath:$libdir";;
  1.1944 -	  esac
  1.1945 -	  ;;
  1.1946 -	esac
  1.1947        done
  1.1948        # Substitute the hardcoded libdirs into the rpath.
  1.1949        if test -n "$hardcode_libdir_separator" &&
  1.1950 @@ -3140,6 +2453,23 @@
  1.1951        fi
  1.1952        finalize_rpath="$rpath"
  1.1953  
  1.1954 +      output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'`
  1.1955 +      if test "X$output_objdir" = "X$output"; then
  1.1956 +	output_objdir="$objdir"
  1.1957 +      else
  1.1958 +	output_objdir="$output_objdir/$objdir"
  1.1959 +      fi
  1.1960 +
  1.1961 +      # Create the binary in the object directory, then wrap it.
  1.1962 +      if test ! -d $output_objdir; then
  1.1963 +	$show "$mkdir $output_objdir"
  1.1964 +	$run $mkdir $output_objdir
  1.1965 +	status=$?
  1.1966 +	if test $status -ne 0 && test ! -d $output_objdir; then
  1.1967 +	  exit $status
  1.1968 +	fi
  1.1969 +      fi
  1.1970 +
  1.1971        if test -n "$libobjs" && test "$build_old_libs" = yes; then
  1.1972  	# Transform all the library objects into standard objects.
  1.1973  	compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
  1.1974 @@ -3188,7 +2518,7 @@
  1.1975  	    test -z "$run" && $echo ': @PROGRAM@ ' > "$nlist"
  1.1976  
  1.1977  	    # Add our own program objects to the symbol list.
  1.1978 -	    progfiles=`$echo "X$objs$old_deplibs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
  1.1979 +	    progfiles=`$echo "X$objs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
  1.1980  	    for arg in $progfiles; do
  1.1981  	      $show "extracting global C symbols from \`$arg'"
  1.1982  	      $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
  1.1983 @@ -3397,20 +2727,7 @@
  1.1984  	fi
  1.1985        fi
  1.1986  
  1.1987 -      if test "$no_install" = yes; then
  1.1988 -	# We don't need to create a wrapper script.
  1.1989 -	link_command="$compile_var$compile_command$compile_rpath"
  1.1990 -	# Replace the output file specification.
  1.1991 -	link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
  1.1992 -	# Delete the old output file.
  1.1993 -	$run $rm $output
  1.1994 -	# Link the executable and exit
  1.1995 -	$show "$link_command"
  1.1996 -	$run eval "$link_command" || exit $?
  1.1997 -	exit 0
  1.1998 -      fi
  1.1999 -
  1.2000 -      if test "$hardcode_action" = relink || test "$hardcode_into_libs" = yes; then
  1.2001 +      if test "$hardcode_action" = relink; then
  1.2002  	# Fast installation is not supported
  1.2003  	link_command="$compile_var$compile_command$compile_rpath"
  1.2004  	relink_command="$finalize_var$finalize_command$finalize_rpath"
  1.2005 @@ -3614,13 +2931,21 @@
  1.2006        # Run the actual program with our arguments.
  1.2007  "
  1.2008  	case $host in
  1.2009 -	*-*-cygwin* | *-*-mingw | *-*-os2*)
  1.2010  	  # win32 systems need to use the prog path for dll
  1.2011  	  # lookup to work
  1.2012 +	*-*-cygwin*)
  1.2013 +	  $echo >> $output "\
  1.2014 +      exec \$progdir/\$program \${1+\"\$@\"}
  1.2015 +"
  1.2016 +	  ;;
  1.2017 +
  1.2018 +	# Backslashes separate directories on plain windows
  1.2019 +	*-*-mingw | *-*-os2*)
  1.2020  	  $echo >> $output "\
  1.2021        exec \$progdir\\\\\$program \${1+\"\$@\"}
  1.2022  "
  1.2023  	  ;;
  1.2024 +
  1.2025  	*)
  1.2026  	  $echo >> $output "\
  1.2027        # Export the path to the program.
  1.2028 @@ -3662,7 +2987,7 @@
  1.2029  	  oldobjs="$libobjs_save"
  1.2030  	  build_libtool_libs=no
  1.2031  	else
  1.2032 -	  oldobjs="$objs$old_deplibs "`$echo "X$libobjs_save" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`
  1.2033 +	  oldobjs="$objs "`$echo "X$libobjs_save" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`
  1.2034  	fi
  1.2035  	addlibs="$old_convenience"
  1.2036        fi
  1.2037 @@ -3749,10 +3074,14 @@
  1.2038        test "$build_old_libs" = yes && old_library="$libname.$libext"
  1.2039        $show "creating $output"
  1.2040  
  1.2041 -      # Quote the link command for shipping.
  1.2042 -      relink_command="cd `pwd`; $SHELL $0 --mode=relink $libtool_args"
  1.2043 -      relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"`
  1.2044 -      
  1.2045 +      if test -n "$xrpath"; then
  1.2046 +	temp_xrpath=
  1.2047 +	for libdir in $xrpath; do
  1.2048 +	  temp_xrpath="$temp_xrpath -R$libdir"
  1.2049 +	done
  1.2050 +	dependency_libs="$temp_xrpath $dependency_libs"
  1.2051 +      fi
  1.2052 +
  1.2053        # Only create the output if not a dry run.
  1.2054        if test -z "$run"; then
  1.2055  	for installed in no yes; do
  1.2056 @@ -3761,23 +3090,6 @@
  1.2057  	      break
  1.2058  	    fi
  1.2059  	    output="$output_objdir/$outputname"i
  1.2060 -	    # Replace all uninstalled libtool libraries with the installed ones
  1.2061 -	    newdependency_libs=
  1.2062 -	    for deplib in $dependency_libs; do
  1.2063 -	      case "$deplib" in
  1.2064 -	      *.la) 
  1.2065 -		name=`$echo "X$deplib" | $Xsed -e 's%^.*/%%'`
  1.2066 -		eval libdir=`sed -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
  1.2067 -		if test -z "$libdir"; then
  1.2068 -		  $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
  1.2069 -		  exit 1
  1.2070 -		fi
  1.2071 -		newdependency_libs="$newdependency_libs $libdir/$name"
  1.2072 -		;;
  1.2073 -	      *) newdependency_libs="$newdependency_libs $deplib" ;;
  1.2074 -	      esac
  1.2075 -	    done
  1.2076 -	    dependency_libs="$newdependency_libs"
  1.2077  	  fi
  1.2078  	  $rm $output
  1.2079  	  $echo > $output "\
  1.2080 @@ -3808,18 +3120,15 @@
  1.2081  installed=$installed
  1.2082  
  1.2083  # Directory that this library needs to be installed in:
  1.2084 -libdir='$install_libdir'"
  1.2085 -	  if test "$installed" = no; then
  1.2086 -	    $echo >> $output "\
  1.2087 -relink_command=\"$relink_command\""
  1.2088 -	  fi
  1.2089 +libdir='$install_libdir'\
  1.2090 +"
  1.2091  	done
  1.2092        fi
  1.2093  
  1.2094        # Do a symbolic link so that the libtool archive can be found in
  1.2095        # LD_LIBRARY_PATH before the program is installed.
  1.2096        $show "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)"
  1.2097 -      $run eval '(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)' || exit $?
  1.2098 +      $run eval "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)" || exit $?
  1.2099        ;;
  1.2100      esac
  1.2101      exit 0
  1.2102 @@ -3992,7 +3301,6 @@
  1.2103  
  1.2104  	library_names=
  1.2105  	old_library=
  1.2106 -	relink_command=
  1.2107  	# If there is no directory component, then add one.
  1.2108  	case "$file" in
  1.2109  	*/* | *\\*) . $file ;;
  1.2110 @@ -4017,20 +3325,6 @@
  1.2111  	test "X$dir" = "X$file/" && dir=
  1.2112  	dir="$dir$objdir"
  1.2113  
  1.2114 -	if test "$hardcode_into_libs" = yes; then
  1.2115 -	  if test -z "$relink_command"; then
  1.2116 -	    $echo "$modename: invalid libtool pseudo library \`$file'" 1>&2
  1.2117 -	    exit 1
  1.2118 -	  fi
  1.2119 -	  $echo "$modename: warning: relinking \`$file'" 1>&2
  1.2120 -	  $show "$relink_command"
  1.2121 -	  if $run eval "$relink_command"; then :
  1.2122 -	  else
  1.2123 -	    $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
  1.2124 -	    continue
  1.2125 -	  fi
  1.2126 -	fi
  1.2127 -	
  1.2128  	# See the names of the shared library.
  1.2129  	set dummy $library_names
  1.2130  	if test -n "$2"; then
  1.2131 @@ -4038,16 +3332,9 @@
  1.2132  	  shift
  1.2133  	  shift
  1.2134  
  1.2135 -	  srcname="$realname"
  1.2136 -	  test "$hardcode_into_libs" = yes && srcname="$realname"T
  1.2137 -
  1.2138  	  # Install the shared library and build the symlinks.
  1.2139 -	  $show "$install_prog $dir/$srcname $destdir/$realname"
  1.2140 -	  $run eval "$install_prog $dir/$srcname $destdir/$realname" || exit $?
  1.2141 -	  if test -n "$stripme" && test -n "$striplib"; then
  1.2142 -	    $show "$striplib $destdir/$realname"
  1.2143 -	    $run eval "$striplib $destdir/$realname" || exit $?
  1.2144 -	  fi
  1.2145 +	  $show "$install_prog $dir/$realname $destdir/$realname"
  1.2146 +	  $run eval "$install_prog $dir/$realname $destdir/$realname" || exit $?
  1.2147  
  1.2148  	  if test $# -gt 0; then
  1.2149  	    # Delete the old symlinks, and create new ones.
  1.2150 @@ -4170,13 +3457,6 @@
  1.2151  	    fi
  1.2152  	  done
  1.2153  
  1.2154 -	  relink_command=
  1.2155 -	  # If there is no directory component, then add one.
  1.2156 -	  case "$file" in
  1.2157 -	  */* | *\\*) . $file ;;
  1.2158 -	  *) . ./$file ;;
  1.2159 -	  esac
  1.2160 -
  1.2161  	  outputname=
  1.2162  	  if test "$fast_install" = no && test -n "$relink_command"; then
  1.2163  	    if test "$finalize" = yes && test -z "$run"; then
  1.2164 @@ -4225,11 +3505,6 @@
  1.2165        $show "$install_prog $file $oldlib"
  1.2166        $run eval "$install_prog \$file \$oldlib" || exit $?
  1.2167  
  1.2168 -      if test -n "$stripme" && test -n "$striplib"; then
  1.2169 -	$show "$old_striplib $oldlib"
  1.2170 -	$run eval "$old_striplib $oldlib" || exit $?
  1.2171 -      fi
  1.2172 -      
  1.2173        # Do each command in the postinstall commands.
  1.2174        eval cmds=\"$old_postinstall_cmds\"
  1.2175        IFS="${IFS= 	}"; save_ifs="$IFS"; IFS='~'
  1.2176 @@ -4329,83 +3604,6 @@
  1.2177      exit 0
  1.2178      ;;
  1.2179  
  1.2180 -  # libtool clean mode
  1.2181 -  clean)
  1.2182 -    modename="$modename: clean"
  1.2183 -    rm="$nonopt"
  1.2184 -    files=
  1.2185 -
  1.2186 -    # This variable tells wrapper scripts just to set variables rather
  1.2187 -    # than running their programs.
  1.2188 -    libtool_install_magic="$magic"
  1.2189 -
  1.2190 -    for arg
  1.2191 -    do
  1.2192 -      case "$arg" in
  1.2193 -      -*) rm="$rm $arg" ;;
  1.2194 -      *) files="$files $arg" ;;
  1.2195 -      esac
  1.2196 -    done
  1.2197 -
  1.2198 -    if test -z "$rm"; then
  1.2199 -      $echo "$modename: you must specify an RM program" 1>&2
  1.2200 -      $echo "$help" 1>&2
  1.2201 -      exit 1
  1.2202 -    fi
  1.2203 -
  1.2204 -    for file in $files; do
  1.2205 -      dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
  1.2206 -      if test "X$dir" = "X$file"; then
  1.2207 -	dir=.
  1.2208 -	objdir="$objdir"
  1.2209 -      else
  1.2210 -	objdir="$dir/$objdir"
  1.2211 -      fi
  1.2212 -      name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
  1.2213 -
  1.2214 -      rmfiles="$file"
  1.2215 -
  1.2216 -      case "$file" in
  1.2217 -      *.la)
  1.2218 -	# Possibly a libtool archive, so verify it.
  1.2219 -	if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
  1.2220 -	  . ./$file
  1.2221 -
  1.2222 -	  # Delete the libtool libraries and symlinks.
  1.2223 -	  for n in $library_names; do
  1.2224 -	    rmfiles="$rmfiles $objdir/$n"
  1.2225 -	  done
  1.2226 -	  test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library"
  1.2227 -	  rmfiles="$rmfiles $objdir/$name $objdir/${name}i"
  1.2228 -	fi
  1.2229 -	;;
  1.2230 -
  1.2231 -      *.lo)
  1.2232 -	if test "$build_old_libs" = yes; then
  1.2233 -	  oldobj=`$echo "X$name" | $Xsed -e "$lo2o"`
  1.2234 -	  rmfiles="$rmfiles $dir/$oldobj"
  1.2235 -	fi
  1.2236 -	;;
  1.2237 -
  1.2238 -      *)
  1.2239 -	# Do a test to see if this is a libtool program.
  1.2240 -	if (sed -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
  1.2241 -	  relink_command=
  1.2242 -	  . $dir/$file
  1.2243 -
  1.2244 -	  rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}"
  1.2245 -	  if test "$fast_install" = yes && test -n "$relink_command"; then
  1.2246 -	    rmfiles="$rmfiles $objdir/lt-$name"
  1.2247 -	  fi
  1.2248 -	fi
  1.2249 -	;;
  1.2250 -      esac
  1.2251 -      $show "$rm $rmfiles"
  1.2252 -      $run $rm $rmfiles
  1.2253 -    done
  1.2254 -    exit 0
  1.2255 -    ;;
  1.2256 -
  1.2257    # libtool execute mode
  1.2258    execute)
  1.2259      modename="$modename: execute"
  1.2260 @@ -4668,7 +3866,6 @@
  1.2261  
  1.2262  MODE must be one of the following:
  1.2263  
  1.2264 -      clean           remove files from the build directory
  1.2265        compile         compile a source file into a libtool object
  1.2266        execute         automatically set library path, then run a program
  1.2267        finish          complete the installation of libtool libraries
  1.2268 @@ -4681,20 +3878,6 @@
  1.2269    exit 0
  1.2270    ;;
  1.2271  
  1.2272 -clean)
  1.2273 -  $echo \
  1.2274 -"Usage: $modename [OPTION]... --mode=clean RM [RM-OPTION]... FILE...
  1.2275 -
  1.2276 -Remove files from the build directory.
  1.2277 -
  1.2278 -RM is the name of the program to use to delete files associated with each FILE
  1.2279 -(typically \`/bin/rm').  RM-OPTIONS are options (such as \`-f') to be passed
  1.2280 -to RM.
  1.2281 -
  1.2282 -If FILE is a libtool library, object or program, all the files associated
  1.2283 -with it are deleted. Otherwise, only FILE itself is deleted using RM."
  1.2284 -  ;;
  1.2285 -
  1.2286  compile)
  1.2287    $echo \
  1.2288  "Usage: $modename [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE
  1.2289 @@ -4783,8 +3966,6 @@
  1.2290    -LLIBDIR          search LIBDIR for required installed libraries
  1.2291    -lNAME            OUTPUT-FILE requires the installed library libNAME
  1.2292    -module           build a library that can dlopened
  1.2293 -  -no-fast-install  disable the fast-install mode
  1.2294 -  -no-install       link a not-installable executable
  1.2295    -no-undefined     declare that a library does not refer to external symbols
  1.2296    -o OUTPUT-FILE    create OUTPUT-FILE from the specified objects
  1.2297    -release RELEASE  specify package release information