ltmain.sh
changeset 729 dac996d69abb
parent 608 d0fecf67cd93
child 730 0f4f974d0201
     1.1 --- a/ltmain.sh	Fri Oct 03 18:26:39 2003 +0000
     1.2 +++ b/ltmain.sh	Mon Oct 06 07:13:16 2003 +0000
     1.3 @@ -1,7 +1,8 @@
     1.4  # ltmain.sh - Provide generalized library-building support services.
     1.5 -# NOTE: Changing this file will not affect anything until you rerun ltconfig.
     1.6 +# NOTE: Changing this file will not affect anything until you rerun configure.
     1.7  #
     1.8 -# Copyright (C) 1996-1999 Free Software Foundation, Inc.
     1.9 +# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003
    1.10 +# Free Software Foundation, Inc.
    1.11  # Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
    1.12  #
    1.13  # This program is free software; you can redistribute it and/or modify
    1.14 @@ -48,14 +49,14 @@
    1.15  fi
    1.16  
    1.17  # The name of this program.
    1.18 -progname=`$echo "$0" | sed 's%^.*/%%'`
    1.19 +progname=`$echo "$0" | ${SED} 's%^.*/%%'`
    1.20  modename="$progname"
    1.21  
    1.22  # Constants.
    1.23  PROGRAM=ltmain.sh
    1.24  PACKAGE=libtool
    1.25 -VERSION=1.3.5
    1.26 -TIMESTAMP=" (1.385.2.206 2000/05/27 11:12:27)"
    1.27 +VERSION=1.5
    1.28 +TIMESTAMP=" (1.1220.2.1 2003/04/14 22:48:00)"
    1.29  
    1.30  default_mode=
    1.31  help="Try \`$progname --help' for more information."
    1.32 @@ -66,10 +67,19 @@
    1.33  
    1.34  # Sed substitution that helps us do robust quoting.  It backslashifies
    1.35  # metacharacters that are still active within double-quoted strings.
    1.36 -Xsed='sed -e 1s/^X//'
    1.37 +Xsed="${SED}"' -e 1s/^X//'
    1.38  sed_quote_subst='s/\([\\`\\"$\\\\]\)/\\\1/g'
    1.39 -SP2NL='tr \040 \012'
    1.40 -NL2SP='tr \015\012 \040\040'
    1.41 +# test EBCDIC or ASCII
    1.42 +case `echo A|od -x` in
    1.43 + *[Cc]1*) # EBCDIC based system
    1.44 +  SP2NL="tr '\100' '\n'"
    1.45 +  NL2SP="tr '\r\n' '\100\100'"
    1.46 +  ;;
    1.47 + *) # Assume ASCII based system
    1.48 +  SP2NL="tr '\040' '\012'"
    1.49 +  NL2SP="tr '\015\012' '\040\040'"
    1.50 +  ;;
    1.51 +esac
    1.52  
    1.53  # NLS nuisances.
    1.54  # Only set LANG and LC_ALL to C if already set.
    1.55 @@ -83,15 +93,12 @@
    1.56    save_LANG="$LANG"; LANG=C; export LANG
    1.57  fi
    1.58  
    1.59 -if test "$LTCONFIG_VERSION" != "$VERSION"; then
    1.60 -  echo "$modename: ltconfig version \`$LTCONFIG_VERSION' does not match $PROGRAM version \`$VERSION'" 1>&2
    1.61 -  echo "Fatal configuration error.  See the $PACKAGE docs for more information." 1>&2
    1.62 -  exit 1
    1.63 -fi
    1.64 +# Make sure IFS has a sensible default
    1.65 +: ${IFS=" 	"}
    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 -  echo "Fatal configuration error.  See the $PACKAGE docs for more information." 1>&2
    1.70 +  $echo "$modename: not configured to build any kind of library" 1>&2
    1.71 +  $echo "Fatal configuration error.  See the $PACKAGE docs for more information." 1>&2
    1.72    exit 1
    1.73  fi
    1.74  
    1.75 @@ -107,22 +114,92 @@
    1.76  lo2o="s/\\.lo\$/.${objext}/"
    1.77  o2lo="s/\\.${objext}\$/.lo/"
    1.78  
    1.79 +#####################################
    1.80 +# Shell function definitions:
    1.81 +# This seems to be the best place for them
    1.82 +
    1.83 +# Need a lot of goo to handle *both* DLLs and import libs
    1.84 +# Has to be a shell function in order to 'eat' the argument
    1.85 +# that is supplied when $file_magic_command is called.
    1.86 +win32_libid () {
    1.87 +  win32_libid_type="unknown"
    1.88 +  win32_fileres=`file -L $1 2>/dev/null`
    1.89 +  case $win32_fileres in
    1.90 +  *ar\ archive\ import\ library*) # definitely import
    1.91 +    win32_libid_type="x86 archive import"
    1.92 +    ;;
    1.93 +  *ar\ archive*) # could be an import, or static
    1.94 +    if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | \
    1.95 +      grep -E 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then
    1.96 +      win32_nmres=`eval $NM -f posix -A $1 | \
    1.97 +	sed -n -e '1,100{/ I /{x;/import/!{s/^/import/;h;p;};x;};}'`
    1.98 +      if test "X$win32_nmres" = "Ximport" ; then
    1.99 +        win32_libid_type="x86 archive import"
   1.100 +      else
   1.101 +        win32_libid_type="x86 archive static"
   1.102 +      fi
   1.103 +    fi
   1.104 +    ;;
   1.105 +  *DLL*) 
   1.106 +    win32_libid_type="x86 DLL"
   1.107 +    ;;
   1.108 +  *executable*) # but shell scripts are "executable" too...
   1.109 +    case $win32_fileres in
   1.110 +    *MS\ Windows\ PE\ Intel*)
   1.111 +      win32_libid_type="x86 DLL"
   1.112 +      ;;
   1.113 +    esac
   1.114 +    ;;
   1.115 +  esac
   1.116 +  $echo $win32_libid_type
   1.117 +}
   1.118 +
   1.119 +# End of Shell function definitions
   1.120 +#####################################
   1.121 +
   1.122  # Parse our command line options once, thoroughly.
   1.123 -while test $# -gt 0
   1.124 +while test "$#" -gt 0
   1.125  do
   1.126    arg="$1"
   1.127    shift
   1.128  
   1.129 -  case "$arg" in
   1.130 +  case $arg in
   1.131    -*=*) optarg=`$echo "X$arg" | $Xsed -e 's/[-_a-zA-Z0-9]*=//'` ;;
   1.132    *) optarg= ;;
   1.133    esac
   1.134  
   1.135    # If the previous option needs an argument, assign it.
   1.136    if test -n "$prev"; then
   1.137 -    case "$prev" in
   1.138 +    case $prev in
   1.139      execute_dlfiles)
   1.140 -      eval "$prev=\"\$$prev \$arg\""
   1.141 +      execute_dlfiles="$execute_dlfiles $arg"
   1.142 +      ;;
   1.143 +    tag)
   1.144 +      tagname="$arg"
   1.145 +
   1.146 +      # Check whether tagname contains only valid characters
   1.147 +      case $tagname in
   1.148 +      *[!-_A-Za-z0-9,/]*)
   1.149 +	$echo "$progname: invalid tag name: $tagname" 1>&2
   1.150 +	exit 1
   1.151 +	;;
   1.152 +      esac
   1.153 +
   1.154 +      case $tagname in
   1.155 +      CC)
   1.156 +	# Don't test for the "default" C tag, as we know, it's there, but
   1.157 +	# not specially marked.
   1.158 +	;;
   1.159 +      *)
   1.160 +	if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "$0" > /dev/null; then
   1.161 +	  taglist="$taglist $tagname"
   1.162 +	  # Evaluate the configuration.
   1.163 +	  eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$tagname'$/,/^# ### END LIBTOOL TAG CONFIG: '$tagname'$/p' < $0`"
   1.164 +	else
   1.165 +	  $echo "$progname: ignoring unknown tag $tagname" 1>&2
   1.166 +	fi
   1.167 +	;;
   1.168 +      esac
   1.169        ;;
   1.170      *)
   1.171        eval "$prev=\$arg"
   1.172 @@ -135,23 +212,31 @@
   1.173    fi
   1.174  
   1.175    # Have we seen a non-optional argument yet?
   1.176 -  case "$arg" in
   1.177 +  case $arg in
   1.178    --help)
   1.179      show_help=yes
   1.180      ;;
   1.181  
   1.182    --version)
   1.183 -    echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP"
   1.184 +    $echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP"
   1.185 +    $echo
   1.186 +    $echo "Copyright (C) 2003  Free Software Foundation, Inc."
   1.187 +    $echo "This is free software; see the source for copying conditions.  There is NO"
   1.188 +    $echo "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
   1.189      exit 0
   1.190      ;;
   1.191  
   1.192    --config)
   1.193 -    sed -e '1,/^### BEGIN LIBTOOL CONFIG/d' -e '/^### END LIBTOOL CONFIG/,$d' $0
   1.194 +    ${SED} -e '1,/^# ### BEGIN LIBTOOL CONFIG/d' -e '/^# ### END LIBTOOL CONFIG/,$d' $0
   1.195 +    # Now print the configurations for the tags.
   1.196 +    for tagname in $taglist; do
   1.197 +      ${SED} -n -e "/^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$/,/^# ### END LIBTOOL TAG CONFIG: $tagname$/p" < "$0"
   1.198 +    done
   1.199      exit 0
   1.200      ;;
   1.201  
   1.202    --debug)
   1.203 -    echo "$progname: enabling shell trace mode"
   1.204 +    $echo "$progname: enabling shell trace mode"
   1.205      set -x
   1.206      ;;
   1.207  
   1.208 @@ -160,16 +245,16 @@
   1.209      ;;
   1.210  
   1.211    --features)
   1.212 -    echo "host: $host"
   1.213 +    $echo "host: $host"
   1.214      if test "$build_libtool_libs" = yes; then
   1.215 -      echo "enable shared libraries"
   1.216 +      $echo "enable shared libraries"
   1.217      else
   1.218 -      echo "disable shared libraries"
   1.219 +      $echo "disable shared libraries"
   1.220      fi
   1.221      if test "$build_old_libs" = yes; then
   1.222 -      echo "enable static libraries"
   1.223 +      $echo "enable static libraries"
   1.224      else
   1.225 -      echo "disable static libraries"
   1.226 +      $echo "disable static libraries"
   1.227      fi
   1.228      exit 0
   1.229      ;;
   1.230 @@ -179,10 +264,19 @@
   1.231    --mode) prevopt="--mode" prev=mode ;;
   1.232    --mode=*) mode="$optarg" ;;
   1.233  
   1.234 +  --preserve-dup-deps) duplicate_deps="yes" ;;
   1.235 +
   1.236    --quiet | --silent)
   1.237      show=:
   1.238      ;;
   1.239  
   1.240 +  --tag) prevopt="--tag" prev=tag ;;
   1.241 +  --tag=*)
   1.242 +    set tag "$optarg" ${1+"$@"}
   1.243 +    shift
   1.244 +    prev=tag
   1.245 +    ;;
   1.246 +
   1.247    -dlopen)
   1.248      prevopt="-dlopen"
   1.249      prev=execute_dlfiles
   1.250 @@ -207,16 +301,23 @@
   1.251    exit 1
   1.252  fi
   1.253  
   1.254 +# If this variable is set in any of the actions, the command in it
   1.255 +# will be execed at the end.  This prevents here-documents from being
   1.256 +# left over by shells.
   1.257 +exec_cmd=
   1.258 +
   1.259  if test -z "$show_help"; then
   1.260  
   1.261    # Infer the operation mode.
   1.262    if test -z "$mode"; then
   1.263 -    case "$nonopt" in
   1.264 -    *cc | *++ | gcc* | *-gcc*)
   1.265 +    $echo "*** Warning: inferring the mode of operation is deprecated." 1>&2
   1.266 +    $echo "*** Future versions of Libtool will require -mode=MODE be specified." 1>&2
   1.267 +    case $nonopt in
   1.268 +    *cc | cc* | *++ | gcc* | *-gcc* | g++* | xlc*)
   1.269        mode=link
   1.270        for arg
   1.271        do
   1.272 -	case "$arg" in
   1.273 +	case $arg in
   1.274  	-c)
   1.275  	   mode=compile
   1.276  	   break
   1.277 @@ -261,109 +362,152 @@
   1.278    help="Try \`$modename --help --mode=$mode' for more information."
   1.279  
   1.280    # These modes are in order of execution frequency so that they run quickly.
   1.281 -  case "$mode" in
   1.282 +  case $mode in
   1.283    # libtool compile mode
   1.284    compile)
   1.285      modename="$modename: compile"
   1.286      # Get the compilation command and the source file.
   1.287      base_compile=
   1.288 -    lastarg=
   1.289 -    srcfile="$nonopt"
   1.290 +    srcfile="$nonopt"  #  always keep a non-empty value in "srcfile"
   1.291      suppress_output=
   1.292 -
   1.293 -    user_target=no
   1.294 +    arg_mode=normal
   1.295 +    libobj=
   1.296 +
   1.297      for arg
   1.298      do
   1.299 -      # Accept any command-line options.
   1.300 -      case "$arg" in
   1.301 -      -o)
   1.302 -	if test "$user_target" != "no"; then
   1.303 -	  $echo "$modename: you cannot specify \`-o' more than once" 1>&2
   1.304 -	  exit 1
   1.305 -	fi
   1.306 -	user_target=next
   1.307 +      case "$arg_mode" in
   1.308 +      arg  )
   1.309 +	# do not "continue".  Instead, add this to base_compile
   1.310 +	lastarg="$arg"
   1.311 +	arg_mode=normal
   1.312  	;;
   1.313  
   1.314 -      -static)
   1.315 -	build_old_libs=yes
   1.316 +      target )
   1.317 +	libobj="$arg"
   1.318 +	arg_mode=normal
   1.319  	continue
   1.320  	;;
   1.321 -      esac
   1.322 -
   1.323 -      case "$user_target" in
   1.324 -      next)
   1.325 -	# The next one is the -o target name
   1.326 -	user_target=yes
   1.327 -	continue
   1.328 +
   1.329 +      normal )
   1.330 +	# Accept any command-line options.
   1.331 +	case $arg in
   1.332 +	-o)
   1.333 +	  if test -n "$libobj" ; then
   1.334 +	    $echo "$modename: you cannot specify \`-o' more than once" 1>&2
   1.335 +	    exit 1
   1.336 +	  fi
   1.337 +	  arg_mode=target
   1.338 +	  continue
   1.339 +	  ;;
   1.340 +
   1.341 +	-static)
   1.342 +	  build_old_libs=yes
   1.343 +	  continue
   1.344 +	  ;;
   1.345 +
   1.346 +	-prefer-pic)
   1.347 +	  pic_mode=yes
   1.348 +	  continue
   1.349 +	  ;;
   1.350 +
   1.351 +	-prefer-non-pic)
   1.352 +	  pic_mode=no
   1.353 +	  continue
   1.354 +	  ;;
   1.355 +
   1.356 +	-Xcompiler)
   1.357 +	  arg_mode=arg  #  the next one goes into the "base_compile" arg list
   1.358 +	  continue      #  The current "srcfile" will either be retained or
   1.359 +	  ;;            #  replaced later.  I would guess that would be a bug.
   1.360 +
   1.361 +	-Wc,*)
   1.362 +	  args=`$echo "X$arg" | $Xsed -e "s/^-Wc,//"`
   1.363 +	  lastarg=
   1.364 +	  save_ifs="$IFS"; IFS=','
   1.365 +	  for arg in $args; do
   1.366 +	    IFS="$save_ifs"
   1.367 +
   1.368 +	    # Double-quote args containing other shell metacharacters.
   1.369 +	    # Many Bourne shells cannot handle close brackets correctly
   1.370 +	    # in scan sets, so we specify it separately.
   1.371 +	    case $arg in
   1.372 +	      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
   1.373 +	      arg="\"$arg\""
   1.374 +	      ;;
   1.375 +	    esac
   1.376 +	    lastarg="$lastarg $arg"
   1.377 +	  done
   1.378 +	  IFS="$save_ifs"
   1.379 +	  lastarg=`$echo "X$lastarg" | $Xsed -e "s/^ //"`
   1.380 +
   1.381 +	  # Add the arguments to base_compile.
   1.382 +	  base_compile="$base_compile $lastarg"
   1.383 +	  continue
   1.384 +	  ;;
   1.385 +
   1.386 +	* )
   1.387 +	  # Accept the current argument as the source file.
   1.388 +	  # The previous "srcfile" becomes the current argument.
   1.389 +	  #
   1.390 +	  lastarg="$srcfile"
   1.391 +	  srcfile="$arg"
   1.392 +	  ;;
   1.393 +	esac  #  case $arg
   1.394  	;;
   1.395 -      yes)
   1.396 -	# We got the output file
   1.397 -	user_target=set
   1.398 -	libobj="$arg"
   1.399 -	continue
   1.400 -	;;
   1.401 -      esac
   1.402 -
   1.403 -      # Accept the current argument as the source file.
   1.404 -      lastarg="$srcfile"
   1.405 -      srcfile="$arg"
   1.406 +      esac    #  case $arg_mode
   1.407  
   1.408        # Aesthetically quote the previous argument.
   1.409 -
   1.410 -      # Backslashify any backslashes, double quotes, and dollar signs.
   1.411 -      # These are the only characters that are still specially
   1.412 -      # interpreted inside of double-quoted scrings.
   1.413        lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"`
   1.414  
   1.415 +      case $lastarg in
   1.416        # Double-quote args containing other shell metacharacters.
   1.417 -      # Many Bourne shells cannot handle close brackets correctly in scan
   1.418 -      # sets, so we specify it separately.
   1.419 -      case "$lastarg" in
   1.420 -      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*)
   1.421 +      # Many Bourne shells cannot handle close brackets correctly
   1.422 +      # in scan sets, so we specify it separately.
   1.423 +      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
   1.424  	lastarg="\"$lastarg\""
   1.425  	;;
   1.426        esac
   1.427  
   1.428 -      # Add the previous argument to base_compile.
   1.429 -      if test -z "$base_compile"; then
   1.430 -	base_compile="$lastarg"
   1.431 -      else
   1.432 -	base_compile="$base_compile $lastarg"
   1.433 -      fi
   1.434 -    done
   1.435 -
   1.436 -    case "$user_target" in
   1.437 -    set)
   1.438 +      base_compile="$base_compile $lastarg"
   1.439 +    done # for arg
   1.440 +
   1.441 +    case $arg_mode in
   1.442 +    arg)
   1.443 +      $echo "$modename: you must specify an argument for -Xcompile"
   1.444 +      exit 1
   1.445        ;;
   1.446 -    no)
   1.447 -      # Get the name of the library object.
   1.448 -      libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'`
   1.449 -      ;;
   1.450 -    *)
   1.451 +    target)
   1.452        $echo "$modename: you must specify a target with \`-o'" 1>&2
   1.453        exit 1
   1.454        ;;
   1.455 +    *)
   1.456 +      # Get the name of the library object.
   1.457 +      [ -z "$libobj" ] && libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'`
   1.458 +      ;;
   1.459      esac
   1.460  
   1.461      # Recognize several different file suffixes.
   1.462      # If the user specifies -o file.o, it is replaced with file.lo
   1.463 -    xform='[cCFSfmso]'
   1.464 -    case "$libobj" in
   1.465 +    xform='[cCFSifmso]'
   1.466 +    case $libobj in
   1.467      *.ada) xform=ada ;;
   1.468      *.adb) xform=adb ;;
   1.469      *.ads) xform=ads ;;
   1.470      *.asm) xform=asm ;;
   1.471      *.c++) xform=c++ ;;
   1.472      *.cc) xform=cc ;;
   1.473 +    *.ii) xform=ii ;;
   1.474 +    *.class) xform=class ;;
   1.475      *.cpp) xform=cpp ;;
   1.476      *.cxx) xform=cxx ;;
   1.477      *.f90) xform=f90 ;;
   1.478      *.for) xform=for ;;
   1.479 +    *.java) xform=java ;;
   1.480      esac
   1.481  
   1.482      libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"`
   1.483  
   1.484 -    case "$libobj" in
   1.485 +    case $libobj in
   1.486      *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;;
   1.487      *)
   1.488        $echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2
   1.489 @@ -371,6 +515,56 @@
   1.490        ;;
   1.491      esac
   1.492  
   1.493 +    # Infer tagged configuration to use if any are available and
   1.494 +    # if one wasn't chosen via the "--tag" command line option.
   1.495 +    # Only attempt this if the compiler in the base compile
   1.496 +    # command doesn't match the default compiler.
   1.497 +    if test -n "$available_tags" && test -z "$tagname"; then
   1.498 +      case $base_compile in
   1.499 +      # Blanks in the command may have been stripped by the calling shell,
   1.500 +      # but not from the CC environment variable when configure was run.
   1.501 +      " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "*) ;;
   1.502 +      # Blanks at the start of $base_compile will cause this to fail
   1.503 +      # if we don't check for them as well.
   1.504 +      *)
   1.505 +	for z in $available_tags; do
   1.506 +	  if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$0" > /dev/null; then
   1.507 +	    # Evaluate the configuration.
   1.508 +	    eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $0`"
   1.509 +	    case "$base_compile " in
   1.510 +	    "$CC "* | " $CC "* | "`$echo $CC` "* | " `$echo $CC` "*)
   1.511 +	      # The compiler in the base compile command matches
   1.512 +	      # the one in the tagged configuration.
   1.513 +	      # Assume this is the tagged configuration we want.
   1.514 +	      tagname=$z
   1.515 +	      break
   1.516 +	      ;;
   1.517 +	    esac
   1.518 +	  fi
   1.519 +	done
   1.520 +	# If $tagname still isn't set, then no tagged configuration
   1.521 +	# was found and let the user know that the "--tag" command
   1.522 +	# line option must be used.
   1.523 +	if test -z "$tagname"; then
   1.524 +	  $echo "$modename: unable to infer tagged configuration"
   1.525 +	  $echo "$modename: specify a tag with \`--tag'" 1>&2
   1.526 +	  exit 1
   1.527 +#        else
   1.528 +#          $echo "$modename: using $tagname tagged configuration"
   1.529 +	fi
   1.530 +	;;
   1.531 +      esac
   1.532 +    fi
   1.533 +
   1.534 +    objname=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
   1.535 +    xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'`
   1.536 +    if test "X$xdir" = "X$obj"; then
   1.537 +      xdir=
   1.538 +    else
   1.539 +      xdir=$xdir/
   1.540 +    fi
   1.541 +    lobj=${xdir}$objdir/$objname
   1.542 +
   1.543      if test -z "$base_compile"; then
   1.544        $echo "$modename: you must specify a compilation command" 1>&2
   1.545        $echo "$help" 1>&2
   1.546 @@ -379,22 +573,34 @@
   1.547  
   1.548      # Delete any leftover library objects.
   1.549      if test "$build_old_libs" = yes; then
   1.550 -      removelist="$obj $libobj"
   1.551 +      removelist="$obj $lobj $libobj ${libobj}T"
   1.552      else
   1.553 -      removelist="$libobj"
   1.554 +      removelist="$lobj $libobj ${libobj}T"
   1.555      fi
   1.556  
   1.557      $run $rm $removelist
   1.558      trap "$run $rm $removelist; exit 1" 1 2 15
   1.559  
   1.560 +    # On Cygwin there's no "real" PIC flag so we must build both object types
   1.561 +    case $host_os in
   1.562 +    cygwin* | mingw* | pw32* | os2*)
   1.563 +      pic_mode=default
   1.564 +      ;;
   1.565 +    esac
   1.566 +    if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then
   1.567 +      # non-PIC code in shared libraries is not supported
   1.568 +      pic_mode=default
   1.569 +    fi
   1.570 +
   1.571      # Calculate the filename of the output object if compiler does
   1.572      # not support -o with -c
   1.573      if test "$compiler_c_o" = no; then
   1.574 -      output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\..*$%%'`.${objext}
   1.575 +      output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext}
   1.576        lockfile="$output_obj.lock"
   1.577        removelist="$removelist $output_obj $lockfile"
   1.578        trap "$run $rm $removelist; exit 1" 1 2 15
   1.579      else
   1.580 +      output_obj=
   1.581        need_locks=no
   1.582        lockfile=
   1.583      fi
   1.584 @@ -402,13 +608,13 @@
   1.585      # Lock this critical section if it is needed
   1.586      # We use this script file to make the link, it avoids creating a new file
   1.587      if test "$need_locks" = yes; then
   1.588 -      until ln "$0" "$lockfile" 2>/dev/null; do
   1.589 +      until $run ln "$0" "$lockfile" 2>/dev/null; do
   1.590  	$show "Waiting for $lockfile to be removed"
   1.591  	sleep 2
   1.592        done
   1.593      elif test "$need_locks" = warn; then
   1.594        if test -f "$lockfile"; then
   1.595 -	echo "\
   1.596 +	$echo "\
   1.597  *** ERROR, $lockfile exists and contains:
   1.598  `cat $lockfile 2>/dev/null`
   1.599  
   1.600 @@ -422,51 +628,55 @@
   1.601  	$run $rm $removelist
   1.602  	exit 1
   1.603        fi
   1.604 -      echo $srcfile > "$lockfile"
   1.605 +      $echo $srcfile > "$lockfile"
   1.606      fi
   1.607  
   1.608      if test -n "$fix_srcfile_path"; then
   1.609        eval srcfile=\"$fix_srcfile_path\"
   1.610      fi
   1.611  
   1.612 +    $run $rm "$libobj" "${libobj}T"
   1.613 +
   1.614 +    # Create a libtool object file (analogous to a ".la" file),
   1.615 +    # but don't create it if we're doing a dry run.
   1.616 +    test -z "$run" && cat > ${libobj}T <<EOF
   1.617 +# $libobj - a libtool object file
   1.618 +# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
   1.619 +#
   1.620 +# Please DO NOT delete this file!
   1.621 +# It is necessary for linking the library.
   1.622 +
   1.623 +# Name of the PIC object.
   1.624 +EOF
   1.625 +
   1.626      # Only build a PIC object if we are building libtool libraries.
   1.627      if test "$build_libtool_libs" = yes; then
   1.628        # Without this assignment, base_compile gets emptied.
   1.629        fbsd_hideous_sh_bug=$base_compile
   1.630  
   1.631 -      # All platforms use -DPIC, to notify preprocessed assembler code.
   1.632 -      command="$base_compile $srcfile $pic_flag -DPIC"
   1.633 -      if test "$build_old_libs" = yes; then
   1.634 -	lo_libobj="$libobj"
   1.635 -	dir=`$echo "X$libobj" | $Xsed -e 's%/[^/]*$%%'`
   1.636 -	if test "X$dir" = "X$libobj"; then
   1.637 -	  dir="$objdir"
   1.638 -	else
   1.639 -	  dir="$dir/$objdir"
   1.640 -	fi
   1.641 -	libobj="$dir/"`$echo "X$libobj" | $Xsed -e 's%^.*/%%'`
   1.642 -
   1.643 -	if test -d "$dir"; then
   1.644 -	  $show "$rm $libobj"
   1.645 -	  $run $rm $libobj
   1.646 -	else
   1.647 -	  $show "$mkdir $dir"
   1.648 -	  $run $mkdir $dir
   1.649 -	  status=$?
   1.650 -	  if test $status -ne 0 && test ! -d $dir; then
   1.651 -	    exit $status
   1.652 -	  fi
   1.653 +      if test "$pic_mode" != no; then
   1.654 +	command="$base_compile $srcfile $pic_flag"
   1.655 +      else
   1.656 +	# Don't build PIC code
   1.657 +	command="$base_compile $srcfile"
   1.658 +      fi
   1.659 +
   1.660 +      if test ! -d "${xdir}$objdir"; then
   1.661 +	$show "$mkdir ${xdir}$objdir"
   1.662 +	$run $mkdir ${xdir}$objdir
   1.663 +	status=$?
   1.664 +	if test "$status" -ne 0 && test ! -d "${xdir}$objdir"; then
   1.665 +	  exit $status
   1.666  	fi
   1.667        fi
   1.668 -      if test "$compiler_o_lo" = yes; then
   1.669 -	output_obj="$libobj"
   1.670 -	command="$command -o $output_obj"
   1.671 -      elif test "$compiler_c_o" = yes; then
   1.672 -	output_obj="$obj"
   1.673 -	command="$command -o $output_obj"
   1.674 +
   1.675 +      if test -z "$output_obj"; then
   1.676 +	# Place PIC objects in $objdir
   1.677 +	command="$command -o $lobj"
   1.678        fi
   1.679  
   1.680 -      $run $rm "$output_obj"
   1.681 +      $run $rm "$lobj" "$output_obj"
   1.682 +
   1.683        $show "$command"
   1.684        if $run eval "$command"; then :
   1.685        else
   1.686 @@ -475,8 +685,8 @@
   1.687        fi
   1.688  
   1.689        if test "$need_locks" = warn &&
   1.690 -	 test x"`cat $lockfile 2>/dev/null`" != x"$srcfile"; then
   1.691 -	echo "\
   1.692 +	 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
   1.693 +	$echo "\
   1.694  *** ERROR, $lockfile contains:
   1.695  `cat $lockfile 2>/dev/null`
   1.696  
   1.697 @@ -495,9 +705,9 @@
   1.698        fi
   1.699  
   1.700        # Just move the object if needed, then go on to compile the next one
   1.701 -      if test x"$output_obj" != x"$libobj"; then
   1.702 -	$show "$mv $output_obj $libobj"
   1.703 -	if $run $mv $output_obj $libobj; then :
   1.704 +      if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then
   1.705 +	$show "$mv $output_obj $lobj"
   1.706 +	if $run $mv $output_obj $lobj; then :
   1.707  	else
   1.708  	  error=$?
   1.709  	  $run $rm $removelist
   1.710 @@ -505,56 +715,38 @@
   1.711  	fi
   1.712        fi
   1.713  
   1.714 -      # If we have no pic_flag, then copy the object into place and finish.
   1.715 -      if test -z "$pic_flag" && test "$build_old_libs" = yes; then
   1.716 -	# Rename the .lo from within objdir to obj
   1.717 -	if test -f $obj; then
   1.718 -	  $show $rm $obj
   1.719 -	  $run $rm $obj
   1.720 -	fi
   1.721 -
   1.722 -	$show "$mv $libobj $obj"
   1.723 -	if $run $mv $libobj $obj; then :
   1.724 -	else
   1.725 -	  error=$?
   1.726 -	  $run $rm $removelist
   1.727 -	  exit $error
   1.728 -	fi
   1.729 -
   1.730 -	xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'`
   1.731 -	if test "X$xdir" = "X$obj"; then
   1.732 -	  xdir="."
   1.733 -	else
   1.734 -	  xdir="$xdir"
   1.735 -	fi
   1.736 -	baseobj=`$echo "X$obj" | $Xsed -e "s%.*/%%"`
   1.737 -	libobj=`$echo "X$baseobj" | $Xsed -e "$o2lo"`
   1.738 -	# Now arrange that obj and lo_libobj become the same file
   1.739 -	$show "(cd $xdir && $LN_S $baseobj $libobj)"
   1.740 -	if $run eval '(cd $xdir && $LN_S $baseobj $libobj)'; then
   1.741 -	  exit 0
   1.742 -	else
   1.743 -	  error=$?
   1.744 -	  $run $rm $removelist
   1.745 -	  exit $error
   1.746 -	fi
   1.747 -      fi
   1.748 +      # Append the name of the PIC object to the libtool object file.
   1.749 +      test -z "$run" && cat >> ${libobj}T <<EOF
   1.750 +pic_object='$objdir/$objname'
   1.751 +
   1.752 +EOF
   1.753  
   1.754        # Allow error messages only from the first compilation.
   1.755        suppress_output=' >/dev/null 2>&1'
   1.756 +    else
   1.757 +      # No PIC object so indicate it doesn't exist in the libtool
   1.758 +      # object file.
   1.759 +      test -z "$run" && cat >> ${libobj}T <<EOF
   1.760 +pic_object=none
   1.761 +
   1.762 +EOF
   1.763      fi
   1.764  
   1.765      # Only build a position-dependent object if we build old libraries.
   1.766      if test "$build_old_libs" = yes; then
   1.767 -      command="$base_compile $srcfile"
   1.768 +      if test "$pic_mode" != yes; then
   1.769 +	# Don't build PIC code
   1.770 +	command="$base_compile $srcfile"
   1.771 +      else
   1.772 +	command="$base_compile $srcfile $pic_flag"
   1.773 +      fi
   1.774        if test "$compiler_c_o" = yes; then
   1.775  	command="$command -o $obj"
   1.776 -	output_obj="$obj"
   1.777        fi
   1.778  
   1.779        # Suppress compiler output if we already did a PIC compilation.
   1.780        command="$command$suppress_output"
   1.781 -      $run $rm "$output_obj"
   1.782 +      $run $rm "$obj" "$output_obj"
   1.783        $show "$command"
   1.784        if $run eval "$command"; then :
   1.785        else
   1.786 @@ -563,8 +755,8 @@
   1.787        fi
   1.788  
   1.789        if test "$need_locks" = warn &&
   1.790 -	 test x"`cat $lockfile 2>/dev/null`" != x"$srcfile"; then
   1.791 -	echo "\
   1.792 +	 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
   1.793 +	$echo "\
   1.794  *** ERROR, $lockfile contains:
   1.795  `cat $lockfile 2>/dev/null`
   1.796  
   1.797 @@ -583,7 +775,7 @@
   1.798        fi
   1.799  
   1.800        # Just move the object if needed
   1.801 -      if test x"$output_obj" != x"$obj"; then
   1.802 +      if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then
   1.803  	$show "$mv $output_obj $obj"
   1.804  	if $run $mv $output_obj $obj; then :
   1.805  	else
   1.806 @@ -593,40 +785,42 @@
   1.807  	fi
   1.808        fi
   1.809  
   1.810 -      # Create an invalid libtool object if no PIC, so that we do not
   1.811 -      # accidentally link it into a program.
   1.812 -      if test "$build_libtool_libs" != yes; then
   1.813 -	$show "echo timestamp > $libobj"
   1.814 -	$run eval "echo timestamp > \$libobj" || exit $?
   1.815 -      else
   1.816 -	# Move the .lo from within objdir
   1.817 -	$show "$mv $libobj $lo_libobj"
   1.818 -	if $run $mv $libobj $lo_libobj; then :
   1.819 -	else
   1.820 -	  error=$?
   1.821 -	  $run $rm $removelist
   1.822 -	  exit $error
   1.823 -	fi
   1.824 -      fi
   1.825 +      # Append the name of the non-PIC object the libtool object file.
   1.826 +      # Only append if the libtool object file exists.
   1.827 +      test -z "$run" && cat >> ${libobj}T <<EOF
   1.828 +# Name of the non-PIC object.
   1.829 +non_pic_object='$objname'
   1.830 +
   1.831 +EOF
   1.832 +    else
   1.833 +      # Append the name of the non-PIC object the libtool object file.
   1.834 +      # Only append if the libtool object file exists.
   1.835 +      test -z "$run" && cat >> ${libobj}T <<EOF
   1.836 +# Name of the non-PIC object.
   1.837 +non_pic_object=none
   1.838 +
   1.839 +EOF
   1.840      fi
   1.841  
   1.842 +    $run $mv "${libobj}T" "${libobj}"
   1.843 +
   1.844      # Unlock the critical section if it was locked
   1.845      if test "$need_locks" != no; then
   1.846 -      $rm "$lockfile"
   1.847 +      $run $rm "$lockfile"
   1.848      fi
   1.849  
   1.850      exit 0
   1.851      ;;
   1.852  
   1.853    # libtool link mode
   1.854 -  link)
   1.855 +  link | relink)
   1.856      modename="$modename: link"
   1.857 -    case "$host" in
   1.858 -    *-*-cygwin* | *-*-mingw* | *-*-os2*)
   1.859 +    case $host in
   1.860 +    *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
   1.861        # It is impossible to link a dll without this setting, and
   1.862        # we shouldn't force the makefile maintainer to figure out
   1.863        # which system we are compiling for in order to pass an extra
   1.864 -      # flag for every libtool invokation.
   1.865 +      # flag for every libtool invocation.
   1.866        # allow_undefined=no
   1.867  
   1.868        # FIXME: Unfortunately, there are problems with the above when trying
   1.869 @@ -635,179 +829,13 @@
   1.870        # -no-undefined on the libtool link line when we can be certain
   1.871        # that all symbols are satisfied, otherwise we get a static library.
   1.872        allow_undefined=yes
   1.873 -
   1.874 -      # This is a source program that is used to create dlls on Windows
   1.875 -      # Don't remove nor modify the starting and closing comments
   1.876 -# /* ltdll.c starts here */
   1.877 -# #define WIN32_LEAN_AND_MEAN
   1.878 -# #include <windows.h>
   1.879 -# #undef WIN32_LEAN_AND_MEAN
   1.880 -# #include <stdio.h>
   1.881 -#
   1.882 -# #ifndef __CYGWIN__
   1.883 -# #  ifdef __CYGWIN32__
   1.884 -# #    define __CYGWIN__ __CYGWIN32__
   1.885 -# #  endif
   1.886 -# #endif
   1.887 -#
   1.888 -# #ifdef __cplusplus
   1.889 -# extern "C" {
   1.890 -# #endif
   1.891 -# BOOL APIENTRY DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved);
   1.892 -# #ifdef __cplusplus
   1.893 -# }
   1.894 -# #endif
   1.895 -#
   1.896 -# #ifdef __CYGWIN__
   1.897 -# #include <cygwin/cygwin_dll.h>
   1.898 -# DECLARE_CYGWIN_DLL( DllMain );
   1.899 -# #endif
   1.900 -# HINSTANCE __hDllInstance_base;
   1.901 -#
   1.902 -# BOOL APIENTRY
   1.903 -# DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved)
   1.904 -# {
   1.905 -#   __hDllInstance_base = hInst;
   1.906 -#   return TRUE;
   1.907 -# }
   1.908 -# /* ltdll.c ends here */
   1.909 -      # This is a source program that is used to create import libraries
   1.910 -      # on Windows for dlls which lack them. Don't remove nor modify the
   1.911 -      # starting and closing comments
   1.912 -# /* impgen.c starts here */
   1.913 -# /*   Copyright (C) 1999 Free Software Foundation, Inc.
   1.914 -# 
   1.915 -#  This file is part of GNU libtool.
   1.916 -# 
   1.917 -#  This program is free software; you can redistribute it and/or modify
   1.918 -#  it under the terms of the GNU General Public License as published by
   1.919 -#  the Free Software Foundation; either version 2 of the License, or
   1.920 -#  (at your option) any later version.
   1.921 -# 
   1.922 -#  This program is distributed in the hope that it will be useful,
   1.923 -#  but WITHOUT ANY WARRANTY; without even the implied warranty of
   1.924 -#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   1.925 -#  GNU General Public License for more details.
   1.926 -# 
   1.927 -#  You should have received a copy of the GNU General Public License
   1.928 -#  along with this program; if not, write to the Free Software
   1.929 -#  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
   1.930 -#  */
   1.931 -# 
   1.932 -#  #include <stdio.h>		/* for printf() */
   1.933 -#  #include <unistd.h>		/* for open(), lseek(), read() */
   1.934 -#  #include <fcntl.h>		/* for O_RDONLY, O_BINARY */
   1.935 -#  #include <string.h>		/* for strdup() */
   1.936 -# 
   1.937 -#  static unsigned int
   1.938 -#  pe_get16 (fd, offset)
   1.939 -#       int fd;
   1.940 -#       int offset;
   1.941 -#  {
   1.942 -#    unsigned char b[2];
   1.943 -#    lseek (fd, offset, SEEK_SET);
   1.944 -#    read (fd, b, 2);
   1.945 -#    return b[0] + (b[1]<<8);
   1.946 -#  }
   1.947 -# 
   1.948 -#  static unsigned int
   1.949 -#  pe_get32 (fd, offset)
   1.950 -#      int fd;
   1.951 -#      int offset;
   1.952 -#  {
   1.953 -#    unsigned char b[4];
   1.954 -#    lseek (fd, offset, SEEK_SET);
   1.955 -#    read (fd, b, 4);
   1.956 -#    return b[0] + (b[1]<<8) + (b[2]<<16) + (b[3]<<24);
   1.957 -#  }
   1.958 -# 
   1.959 -#  static unsigned int
   1.960 -#  pe_as32 (ptr)
   1.961 -#       void *ptr;
   1.962 -#  {
   1.963 -#    unsigned char *b = ptr;
   1.964 -#    return b[0] + (b[1]<<8) + (b[2]<<16) + (b[3]<<24);
   1.965 -#  }
   1.966 -# 
   1.967 -#  int
   1.968 -#  main (argc, argv)
   1.969 -#      int argc;
   1.970 -#      char *argv[];
   1.971 -#  {
   1.972 -#      int dll;
   1.973 -#      unsigned long pe_header_offset, opthdr_ofs, num_entries, i;
   1.974 -#      unsigned long export_rva, export_size, nsections, secptr, expptr;
   1.975 -#      unsigned long name_rvas, nexp;
   1.976 -#      unsigned char *expdata, *erva;
   1.977 -#      char *filename, *dll_name;
   1.978 -# 
   1.979 -#      filename = argv[1];
   1.980 -# 
   1.981 -#      dll = open(filename, O_RDONLY|O_BINARY);
   1.982 -#      if (!dll)
   1.983 -#  	return 1;
   1.984 -# 
   1.985 -#      dll_name = filename;
   1.986 -#    
   1.987 -#      for (i=0; filename[i]; i++)
   1.988 -#  	if (filename[i] == '/' || filename[i] == '\\'  || filename[i] == ':')
   1.989 -#  	    dll_name = filename + i +1;
   1.990 -# 
   1.991 -#      pe_header_offset = pe_get32 (dll, 0x3c);
   1.992 -#      opthdr_ofs = pe_header_offset + 4 + 20;
   1.993 -#      num_entries = pe_get32 (dll, opthdr_ofs + 92);
   1.994 -# 
   1.995 -#      if (num_entries < 1) /* no exports */
   1.996 -#  	return 1;
   1.997 -# 
   1.998 -#      export_rva = pe_get32 (dll, opthdr_ofs + 96);
   1.999 -#      export_size = pe_get32 (dll, opthdr_ofs + 100);
  1.1000 -#      nsections = pe_get16 (dll, pe_header_offset + 4 +2);
  1.1001 -#      secptr = (pe_header_offset + 4 + 20 +
  1.1002 -#  	      pe_get16 (dll, pe_header_offset + 4 + 16));
  1.1003 -# 
  1.1004 -#      expptr = 0;
  1.1005 -#      for (i = 0; i < nsections; i++)
  1.1006 -#      {
  1.1007 -#  	char sname[8];
  1.1008 -#  	unsigned long secptr1 = secptr + 40 * i;
  1.1009 -#  	unsigned long vaddr = pe_get32 (dll, secptr1 + 12);
  1.1010 -#  	unsigned long vsize = pe_get32 (dll, secptr1 + 16);
  1.1011 -#  	unsigned long fptr = pe_get32 (dll, secptr1 + 20);
  1.1012 -#  	lseek(dll, secptr1, SEEK_SET);
  1.1013 -#  	read(dll, sname, 8);
  1.1014 -#  	if (vaddr <= export_rva && vaddr+vsize > export_rva)
  1.1015 -#  	{
  1.1016 -#  	    expptr = fptr + (export_rva - vaddr);
  1.1017 -#  	    if (export_rva + export_size > vaddr + vsize)
  1.1018 -#  		export_size = vsize - (export_rva - vaddr);
  1.1019 -#  	    break;
  1.1020 -#  	}
  1.1021 -#      }
  1.1022 -# 
  1.1023 -#      expdata = (unsigned char*)malloc(export_size);
  1.1024 -#      lseek (dll, expptr, SEEK_SET);
  1.1025 -#      read (dll, expdata, export_size);
  1.1026 -#      erva = expdata - export_rva;
  1.1027 -# 
  1.1028 -#      nexp = pe_as32 (expdata+24);
  1.1029 -#      name_rvas = pe_as32 (expdata+32);
  1.1030 -# 
  1.1031 -#      printf ("EXPORTS\n");
  1.1032 -#      for (i = 0; i<nexp; i++)
  1.1033 -#      {
  1.1034 -#  	unsigned long name_rva = pe_as32 (erva+name_rvas+i*4);
  1.1035 -#  	printf ("\t%s @ %ld ;\n", erva+name_rva, 1+ i);
  1.1036 -#      }
  1.1037 -# 
  1.1038 -#      return 0;
  1.1039 -#  }
  1.1040 -# /* impgen.c ends here */
  1.1041        ;;
  1.1042      *)
  1.1043        allow_undefined=yes
  1.1044        ;;
  1.1045      esac
  1.1046 +    libtool_args="$nonopt"
  1.1047 +    base_compile="$nonopt"
  1.1048      compile_command="$nonopt"
  1.1049      finalize_command="$nonopt"
  1.1050  
  1.1051 @@ -818,18 +846,13 @@
  1.1052      convenience=
  1.1053      old_convenience=
  1.1054      deplibs=
  1.1055 -    linkopts=
  1.1056 -
  1.1057 -    if test -n "$shlibpath_var"; then
  1.1058 -      # get the directories listed in $shlibpath_var
  1.1059 -      eval lib_search_path=\`\$echo \"X \${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\`
  1.1060 -    else
  1.1061 -      lib_search_path=
  1.1062 -    fi
  1.1063 -    # now prepend the system-specific ones
  1.1064 -    eval lib_search_path=\"$sys_lib_search_path_spec\$lib_search_path\"
  1.1065 -    eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\"
  1.1066 -    
  1.1067 +    old_deplibs=
  1.1068 +    compiler_flags=
  1.1069 +    linker_flags=
  1.1070 +    dllsearchpath=
  1.1071 +    lib_search_path=`pwd`
  1.1072 +    inst_prefix_dir=
  1.1073 +
  1.1074      avoid_version=no
  1.1075      dlfiles=
  1.1076      dlprefiles=
  1.1077 @@ -839,10 +862,11 @@
  1.1078      export_symbols_regex=
  1.1079      generated=
  1.1080      libobjs=
  1.1081 -    link_against_libtool_libs=
  1.1082      ltlibs=
  1.1083      module=no
  1.1084 +    no_install=no
  1.1085      objs=
  1.1086 +    non_pic_objects=
  1.1087      prefer_static_libs=no
  1.1088      preload=no
  1.1089      prev=
  1.1090 @@ -854,11 +878,12 @@
  1.1091      temp_rpath=
  1.1092      thread_safe=no
  1.1093      vinfo=
  1.1094 +    vinfo_number=no
  1.1095  
  1.1096      # We need to know -static, to get the right output filenames.
  1.1097      for arg
  1.1098      do
  1.1099 -      case "$arg" in
  1.1100 +      case $arg in
  1.1101        -all-static | -static)
  1.1102  	if test "X$arg" = "X-all-static"; then
  1.1103  	  if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then
  1.1104 @@ -884,20 +909,28 @@
  1.1105      test -n "$old_archive_from_new_cmds" && build_old_libs=yes
  1.1106  
  1.1107      # Go through the arguments, transforming them on the way.
  1.1108 -    while test $# -gt 0; do
  1.1109 +    while test "$#" -gt 0; do
  1.1110        arg="$1"
  1.1111 +      base_compile="$base_compile $arg"
  1.1112        shift
  1.1113 +      case $arg in
  1.1114 +      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
  1.1115 +	qarg=\"`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`\" ### testsuite: skip nested quoting test
  1.1116 +	;;
  1.1117 +      *) qarg=$arg ;;
  1.1118 +      esac
  1.1119 +      libtool_args="$libtool_args $qarg"
  1.1120  
  1.1121        # If the previous option needs an argument, assign it.
  1.1122        if test -n "$prev"; then
  1.1123 -	case "$prev" in
  1.1124 +	case $prev in
  1.1125  	output)
  1.1126  	  compile_command="$compile_command @OUTPUT@"
  1.1127  	  finalize_command="$finalize_command @OUTPUT@"
  1.1128  	  ;;
  1.1129  	esac
  1.1130  
  1.1131 -	case "$prev" in
  1.1132 +	case $prev in
  1.1133  	dlfiles|dlprefiles)
  1.1134  	  if test "$preload" = no; then
  1.1135  	    # Add the symbol object into the linking commands.
  1.1136 @@ -905,7 +938,7 @@
  1.1137  	    finalize_command="$finalize_command @SYMFILE@"
  1.1138  	    preload=yes
  1.1139  	  fi
  1.1140 -	  case "$arg" in
  1.1141 +	  case $arg in
  1.1142  	  *.la | *.lo) ;;  # We handle these cases below.
  1.1143  	  force)
  1.1144  	    if test "$dlself" = no; then
  1.1145 @@ -934,6 +967,7 @@
  1.1146  	      dlprefiles="$dlprefiles $arg"
  1.1147  	    fi
  1.1148  	    prev=
  1.1149 +	    continue
  1.1150  	    ;;
  1.1151  	  esac
  1.1152  	  ;;
  1.1153 @@ -951,9 +985,8 @@
  1.1154  	  prev=
  1.1155  	  continue
  1.1156  	  ;;
  1.1157 -	framework)
  1.1158 -	  linkopts="$linkopts -framework $arg"
  1.1159 -	  compile_command="$compile_command -framework $arg"
  1.1160 +	inst_prefix)
  1.1161 +	  inst_prefix_dir="$arg"
  1.1162  	  prev=
  1.1163  	  continue
  1.1164  	  ;;
  1.1165 @@ -962,9 +995,116 @@
  1.1166  	  prev=
  1.1167  	  continue
  1.1168  	  ;;
  1.1169 +	objectlist)
  1.1170 +	  if test -f "$arg"; then
  1.1171 +	    save_arg=$arg
  1.1172 +	    moreargs=
  1.1173 +	    for fil in `cat $save_arg`
  1.1174 +	    do
  1.1175 +#	      moreargs="$moreargs $fil"
  1.1176 +	      arg=$fil
  1.1177 +	      # A libtool-controlled object.
  1.1178 +
  1.1179 +	      # Check to see that this really is a libtool object.
  1.1180 +	      if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
  1.1181 +		pic_object=
  1.1182 +		non_pic_object=
  1.1183 +
  1.1184 +		# Read the .lo file
  1.1185 +		# If there is no directory component, then add one.
  1.1186 +		case $arg in
  1.1187 +		*/* | *\\*) . $arg ;;
  1.1188 +		*) . ./$arg ;;
  1.1189 +		esac
  1.1190 +
  1.1191 +		if test -z "$pic_object" || \
  1.1192 +		   test -z "$non_pic_object" ||
  1.1193 +		   test "$pic_object" = none && \
  1.1194 +		   test "$non_pic_object" = none; then
  1.1195 +		  $echo "$modename: cannot find name of object for \`$arg'" 1>&2
  1.1196 +		  exit 1
  1.1197 +		fi
  1.1198 +
  1.1199 +		# Extract subdirectory from the argument.
  1.1200 +		xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
  1.1201 +		if test "X$xdir" = "X$arg"; then
  1.1202 +		  xdir=
  1.1203 +		else
  1.1204 +		  xdir="$xdir/"
  1.1205 +		fi
  1.1206 +
  1.1207 +		if test "$pic_object" != none; then
  1.1208 +		  # Prepend the subdirectory the object is found in.
  1.1209 +		  pic_object="$xdir$pic_object"
  1.1210 +
  1.1211 +		  if test "$prev" = dlfiles; then
  1.1212 +		    if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
  1.1213 +		      dlfiles="$dlfiles $pic_object"
  1.1214 +		      prev=
  1.1215 +		      continue
  1.1216 +		    else
  1.1217 +		      # If libtool objects are unsupported, then we need to preload.
  1.1218 +		      prev=dlprefiles
  1.1219 +		    fi
  1.1220 +		  fi
  1.1221 +
  1.1222 +		  # CHECK ME:  I think I busted this.  -Ossama
  1.1223 +		  if test "$prev" = dlprefiles; then
  1.1224 +		    # Preload the old-style object.
  1.1225 +		    dlprefiles="$dlprefiles $pic_object"
  1.1226 +		    prev=
  1.1227 +		  fi
  1.1228 +
  1.1229 +		  # A PIC object.
  1.1230 +		  libobjs="$libobjs $pic_object"
  1.1231 +		  arg="$pic_object"
  1.1232 +		fi
  1.1233 +
  1.1234 +		# Non-PIC object.
  1.1235 +		if test "$non_pic_object" != none; then
  1.1236 +		  # Prepend the subdirectory the object is found in.
  1.1237 +		  non_pic_object="$xdir$non_pic_object"
  1.1238 +
  1.1239 +		  # A standard non-PIC object
  1.1240 +		  non_pic_objects="$non_pic_objects $non_pic_object"
  1.1241 +		  if test -z "$pic_object" || test "$pic_object" = none ; then
  1.1242 +		    arg="$non_pic_object"
  1.1243 +		  fi
  1.1244 +		fi
  1.1245 +	      else
  1.1246 +		# Only an error if not doing a dry-run.
  1.1247 +		if test -z "$run"; then
  1.1248 +		  $echo "$modename: \`$arg' is not a valid libtool object" 1>&2
  1.1249 +		  exit 1
  1.1250 +		else
  1.1251 +		  # Dry-run case.
  1.1252 +
  1.1253 +		  # Extract subdirectory from the argument.
  1.1254 +		  xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
  1.1255 +		  if test "X$xdir" = "X$arg"; then
  1.1256 +		    xdir=
  1.1257 +		  else
  1.1258 +		    xdir="$xdir/"
  1.1259 +		  fi
  1.1260 +
  1.1261 +		  pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"`
  1.1262 +		  non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"`
  1.1263 +		  libobjs="$libobjs $pic_object"
  1.1264 +		  non_pic_objects="$non_pic_objects $non_pic_object"
  1.1265 +		fi
  1.1266 +	      fi
  1.1267 +	    done
  1.1268 +	  else
  1.1269 +	    $echo "$modename: link input file \`$save_arg' does not exist"
  1.1270 +	    exit 1
  1.1271 +	  fi
  1.1272 +	  arg=$save_arg
  1.1273 +	  prev=
  1.1274 +	  continue
  1.1275 +	  ;;
  1.1276  	rpath | xrpath)
  1.1277  	  # We need an absolute path.
  1.1278 -	  case "$arg" in
  1.1279 +	  case $arg in
  1.1280  	  [\\/]* | [A-Za-z]:[\\/]*) ;;
  1.1281  	  *)
  1.1282  	    $echo "$modename: only absolute run-paths are allowed" 1>&2
  1.1283 @@ -985,17 +1125,40 @@
  1.1284  	  prev=
  1.1285  	  continue
  1.1286  	  ;;
  1.1287 +	xcompiler)
  1.1288 +	  compiler_flags="$compiler_flags $qarg"
  1.1289 +	  prev=
  1.1290 +	  compile_command="$compile_command $qarg"
  1.1291 +	  finalize_command="$finalize_command $qarg"
  1.1292 +	  continue
  1.1293 +	  ;;
  1.1294 +	xlinker)
  1.1295 +	  linker_flags="$linker_flags $qarg"
  1.1296 +	  compiler_flags="$compiler_flags $wl$qarg"
  1.1297 +	  prev=
  1.1298 +	  compile_command="$compile_command $wl$qarg"
  1.1299 +	  finalize_command="$finalize_command $wl$qarg"
  1.1300 +	  continue
  1.1301 +	  ;;
  1.1302 +	xcclinker)
  1.1303 +	  linker_flags="$linker_flags $qarg"
  1.1304 +	  compiler_flags="$compiler_flags $qarg"
  1.1305 +	  prev=
  1.1306 +	  compile_command="$compile_command $qarg"
  1.1307 +	  finalize_command="$finalize_command $qarg"
  1.1308 +	  continue
  1.1309 +	  ;;
  1.1310  	*)
  1.1311  	  eval "$prev=\"\$arg\""
  1.1312  	  prev=
  1.1313  	  continue
  1.1314  	  ;;
  1.1315  	esac
  1.1316 -      fi
  1.1317 +      fi # test -n "$prev"
  1.1318  
  1.1319        prevarg="$arg"
  1.1320  
  1.1321 -      case "$arg" in
  1.1322 +      case $arg in
  1.1323        -all-static)
  1.1324  	if test -n "$link_static_flag"; then
  1.1325  	  compile_command="$compile_command $link_static_flag"
  1.1326 @@ -1032,7 +1195,7 @@
  1.1327  
  1.1328        -export-symbols | -export-symbols-regex)
  1.1329  	if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
  1.1330 -	  $echo "$modename: not more than one -exported-symbols argument allowed"
  1.1331 +	  $echo "$modename: more than one -exported-symbols argument is not allowed"
  1.1332  	  exit 1
  1.1333  	fi
  1.1334  	if test "X$arg" = "X-export-symbols"; then
  1.1335 @@ -1043,90 +1206,149 @@
  1.1336  	continue
  1.1337  	;;
  1.1338  
  1.1339 -      -framework)
  1.1340 -	prev=framework
  1.1341 +      -inst-prefix-dir)
  1.1342 +	prev=inst_prefix
  1.1343 +	continue
  1.1344 +	;;
  1.1345 +
  1.1346 +      # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:*
  1.1347 +      # so, if we see these flags be careful not to treat them like -L
  1.1348 +      -L[A-Z][A-Z]*:*)
  1.1349 +	case $with_gcc/$host in
  1.1350 +	no/*-*-irix* | /*-*-irix*)
  1.1351 +	  compile_command="$compile_command $arg"
  1.1352 +	  finalize_command="$finalize_command $arg"
  1.1353 +	  ;;
  1.1354 +	esac
  1.1355  	continue
  1.1356  	;;
  1.1357  
  1.1358        -L*)
  1.1359  	dir=`$echo "X$arg" | $Xsed -e 's/^-L//'`
  1.1360  	# We need an absolute path.
  1.1361 -	case "$dir" in
  1.1362 +	case $dir in
  1.1363  	[\\/]* | [A-Za-z]:[\\/]*) ;;
  1.1364  	*)
  1.1365  	  absdir=`cd "$dir" && pwd`
  1.1366  	  if test -z "$absdir"; then
  1.1367 -	    $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2
  1.1368 -	    $echo "$modename: passing it literally to the linker, although it might fail" 1>&2
  1.1369 -	    absdir="$dir"
  1.1370 +	    $echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2
  1.1371 +	    exit 1
  1.1372  	  fi
  1.1373  	  dir="$absdir"
  1.1374  	  ;;
  1.1375  	esac
  1.1376 -	case " $deplibs " in
  1.1377 -	*" $arg "*) ;;
  1.1378 -	*) deplibs="$deplibs $arg";;
  1.1379 +	case "$deplibs " in
  1.1380 +	*" -L$dir "*) ;;
  1.1381 +	*)
  1.1382 +	  deplibs="$deplibs -L$dir"
  1.1383 +	  lib_search_path="$lib_search_path $dir"
  1.1384 +	  ;;
  1.1385  	esac
  1.1386 -	case " $lib_search_path " in
  1.1387 -	*" $dir "*) ;;
  1.1388 -	*) lib_search_path="$lib_search_path $dir";;
  1.1389 -	esac
  1.1390 -	case "$host" in
  1.1391 -	*-*-cygwin* | *-*-mingw* | *-*-os2*)
  1.1392 -	  dllsearchdir=`cd "$dir" && pwd || echo "$dir"`
  1.1393 -	  case ":$dllsearchpath:" in
  1.1394 -	  ::) dllsearchpath="$dllsearchdir";;
  1.1395 -	  *":$dllsearchdir:"*) ;;
  1.1396 -	  *) dllsearchpath="$dllsearchpath:$dllsearchdir";;
  1.1397 +	case $host in
  1.1398 +	*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
  1.1399 +	  case :$dllsearchpath: in
  1.1400 +	  *":$dir:"*) ;;
  1.1401 +	  *) dllsearchpath="$dllsearchpath:$dir";;
  1.1402  	  esac
  1.1403  	  ;;
  1.1404  	esac
  1.1405 +	continue
  1.1406  	;;
  1.1407  
  1.1408        -l*)
  1.1409 -	if test "$arg" = "-lc"; then
  1.1410 -	  case "$host" in
  1.1411 -	  *-*-cygwin* | *-*-mingw* | *-*-os2* | *-*-beos* |*-*-freebsd* )
  1.1412 -	    # These systems don't actually have c library (as such)
  1.1413 +	if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then
  1.1414 +	  case $host in
  1.1415 +	  *-*-cygwin* | *-*-pw32* | *-*-beos*)
  1.1416 +	    # These systems don't actually have a C or math library (as such)
  1.1417  	    continue
  1.1418  	    ;;
  1.1419 -          *-*-openbsd*)
  1.1420 -            # Do not include libc due to us having libc/libc_r.
  1.1421 -            continue
  1.1422 -            ;;
  1.1423 +	  *-*-mingw* | *-*-os2*)
  1.1424 +	    # These systems don't actually have a C library (as such)
  1.1425 +	    test "X$arg" = "X-lc" && continue
  1.1426 +	    ;;
  1.1427 +	  *-*-openbsd* | *-*-freebsd*)
  1.1428 +	    # Do not include libc due to us having libc/libc_r.
  1.1429 +	    test "X$arg" = "X-lc" && continue
  1.1430 +	    ;;
  1.1431 +	  *-*-rhapsody* | *-*-darwin1.[012])
  1.1432 +	    # Rhapsody C and math libraries are in the System framework
  1.1433 +	    deplibs="$deplibs -framework System"
  1.1434 +	    continue
  1.1435  	  esac
  1.1436 -        elif test "$arg" = "-lc_r"; then
  1.1437 -          case "$host" in
  1.1438 -          *-*-openbsd*)
  1.1439 -            # Do not include libc_r directly, use -pthread flag.
  1.1440 -            continue
  1.1441 -            ;;
  1.1442 -          esac
  1.1443 -	elif test "$arg" = "-lm"; then
  1.1444 -	  case "$host" in
  1.1445 -	  *-*-cygwin* | *-*-beos*)
  1.1446 -	    # These systems don't actually have math library (as such)
  1.1447 -	    continue
  1.1448 -	    ;;
  1.1449 -	  esac
  1.1450 +	elif test "X$arg" = "X-lc_r"; then
  1.1451 +	 case $host in
  1.1452 +	 *-*-openbsd* | *-*-freebsd*)
  1.1453 +	   # Do not include libc_r directly, use -pthread flag.
  1.1454 +	   continue
  1.1455 +	   ;;
  1.1456 +	 esac
  1.1457  	fi
  1.1458  	deplibs="$deplibs $arg"
  1.1459 +	continue
  1.1460  	;;
  1.1461  
  1.1462 -      -?thread)
  1.1463 -        deplibs="$deplibs $arg"
  1.1464 -        ;;
  1.1465 -
  1.1466        -module)
  1.1467  	module=yes
  1.1468  	continue
  1.1469  	;;
  1.1470  
  1.1471 +      # gcc -m* arguments should be passed to the linker via $compiler_flags
  1.1472 +      # in order to pass architecture information to the linker
  1.1473 +      # (e.g. 32 vs 64-bit).  This may also be accomplished via -Wl,-mfoo
  1.1474 +      # but this is not reliable with gcc because gcc may use -mfoo to
  1.1475 +      # select a different linker, different libraries, etc, while
  1.1476 +      # -Wl,-mfoo simply passes -mfoo to the linker.
  1.1477 +      -m*)
  1.1478 +	# Unknown arguments in both finalize_command and compile_command need
  1.1479 +	# to be aesthetically quoted because they are evaled later.
  1.1480 +	arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
  1.1481 +	case $arg in
  1.1482 +	*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
  1.1483 +	  arg="\"$arg\""
  1.1484 +	  ;;
  1.1485 +	esac
  1.1486 +        compile_command="$compile_command $arg"
  1.1487 +        finalize_command="$finalize_command $arg"
  1.1488 +        if test "$with_gcc" = "yes" ; then
  1.1489 +          compiler_flags="$compiler_flags $arg"
  1.1490 +        fi
  1.1491 +        continue
  1.1492 +        ;;
  1.1493 +
  1.1494 +      -shrext)
  1.1495 +	prev=shrext
  1.1496 +	continue
  1.1497 +	;;
  1.1498 +
  1.1499 +      -no-fast-install)
  1.1500 +	fast_install=no
  1.1501 +	continue
  1.1502 +	;;
  1.1503 +
  1.1504 +      -no-install)
  1.1505 +	case $host in
  1.1506 +	*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
  1.1507 +	  # The PATH hackery in wrapper scripts is required on Windows
  1.1508 +	  # in order for the loader to find any dlls it needs.
  1.1509 +	  $echo "$modename: warning: \`-no-install' is ignored for $host" 1>&2
  1.1510 +	  $echo "$modename: warning: assuming \`-no-fast-install' instead" 1>&2
  1.1511 +	  fast_install=no
  1.1512 +	  ;;
  1.1513 +	*) no_install=yes ;;
  1.1514 +	esac
  1.1515 +	continue
  1.1516 +	;;
  1.1517 +
  1.1518        -no-undefined)
  1.1519  	allow_undefined=no
  1.1520  	continue
  1.1521  	;;
  1.1522  
  1.1523 +      -objectlist)
  1.1524 +	prev=objectlist
  1.1525 +	continue
  1.1526 +	;;
  1.1527 +
  1.1528        -o) prev=output ;;
  1.1529  
  1.1530        -release)
  1.1531 @@ -1147,7 +1369,7 @@
  1.1532        -R*)
  1.1533  	dir=`$echo "X$arg" | $Xsed -e 's/^-R//'`
  1.1534  	# We need an absolute path.
  1.1535 -	case "$dir" in
  1.1536 +	case $dir in
  1.1537  	[\\/]* | [A-Za-z]:[\\/]*) ;;
  1.1538  	*)
  1.1539  	  $echo "$modename: only absolute run-paths are allowed" 1>&2
  1.1540 @@ -1162,11 +1384,11 @@
  1.1541  	;;
  1.1542  
  1.1543        -static)
  1.1544 -	# If we have no pic_flag, then this is the same as -all-static.
  1.1545 -	if test -z "$pic_flag" && test -n "$link_static_flag"; then
  1.1546 -	  compile_command="$compile_command $link_static_flag"
  1.1547 -	  finalize_command="$finalize_command $link_static_flag"
  1.1548 -	fi
  1.1549 +	# The effects of -static are defined in a previous loop.
  1.1550 +	# We used to do the same as -all-static on platforms that
  1.1551 +	# didn't have a PIC flag, but the assumption that the effects
  1.1552 +	# would be equivalent was wrong.  It would break on at least
  1.1553 +	# Digital Unix and AIX.
  1.1554  	continue
  1.1555  	;;
  1.1556  
  1.1557 @@ -1179,388 +1401,1315 @@
  1.1558  	prev=vinfo
  1.1559  	continue
  1.1560  	;;
  1.1561 +      -version-number)
  1.1562 +	prev=vinfo
  1.1563 +	vinfo_number=yes
  1.1564 +	continue
  1.1565 +	;;
  1.1566 +
  1.1567 +      -Wc,*)
  1.1568 +	args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wc,//'`
  1.1569 +	arg=
  1.1570 +	save_ifs="$IFS"; IFS=','
  1.1571 +	for flag in $args; do
  1.1572 +	  IFS="$save_ifs"
  1.1573 +	  case $flag in
  1.1574 +	    *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
  1.1575 +	    flag="\"$flag\""
  1.1576 +	    ;;
  1.1577 +	  esac
  1.1578 +	  arg="$arg $wl$flag"
  1.1579 +	  compiler_flags="$compiler_flags $flag"
  1.1580 +	done
  1.1581 +	IFS="$save_ifs"
  1.1582 +	arg=`$echo "X$arg" | $Xsed -e "s/^ //"`
  1.1583 +	;;
  1.1584 +
  1.1585 +      -Wl,*)
  1.1586 +	args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wl,//'`
  1.1587 +	arg=
  1.1588 +	save_ifs="$IFS"; IFS=','
  1.1589 +	for flag in $args; do
  1.1590 +	  IFS="$save_ifs"
  1.1591 +	  case $flag in
  1.1592 +	    *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
  1.1593 +	    flag="\"$flag\""
  1.1594 +	    ;;
  1.1595 +	  esac
  1.1596 +	  arg="$arg $wl$flag"
  1.1597 +	  compiler_flags="$compiler_flags $wl$flag"
  1.1598 +	  linker_flags="$linker_flags $flag"
  1.1599 +	done
  1.1600 +	IFS="$save_ifs"
  1.1601 +	arg=`$echo "X$arg" | $Xsed -e "s/^ //"`
  1.1602 +	;;
  1.1603 +
  1.1604 +      -Xcompiler)
  1.1605 +	prev=xcompiler
  1.1606 +	continue
  1.1607 +	;;
  1.1608 +
  1.1609 +      -Xlinker)
  1.1610 +	prev=xlinker
  1.1611 +	continue
  1.1612 +	;;
  1.1613 +
  1.1614 +      -XCClinker)
  1.1615 +	prev=xcclinker
  1.1616 +	continue
  1.1617 +	;;
  1.1618  
  1.1619        # Some other compiler flag.
  1.1620        -* | +*)
  1.1621  	# Unknown arguments in both finalize_command and compile_command need
  1.1622  	# to be aesthetically quoted because they are evaled later.
  1.1623  	arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
  1.1624 -	case "$arg" in
  1.1625 -	*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*)
  1.1626 +	case $arg in
  1.1627 +	*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
  1.1628  	  arg="\"$arg\""
  1.1629  	  ;;
  1.1630  	esac
  1.1631  	;;
  1.1632  
  1.1633 -      *.o | *.obj | *.a | *.lib)
  1.1634 +      *.$objext)
  1.1635  	# A standard object.
  1.1636  	objs="$objs $arg"
  1.1637  	;;
  1.1638  
  1.1639        *.lo)
  1.1640 -	# A library object.
  1.1641 -	if test "$prev" = dlfiles; then
  1.1642 -	  dlfiles="$dlfiles $arg"
  1.1643 -	  if test "$build_libtool_libs" = yes && test "$dlopen" = yes; then
  1.1644 -	    prev=
  1.1645 -	    continue
  1.1646 +	# A libtool-controlled object.
  1.1647 +
  1.1648 +	# Check to see that this really is a libtool object.
  1.1649 +	if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
  1.1650 +	  pic_object=
  1.1651 +	  non_pic_object=
  1.1652 +
  1.1653 +	  # Read the .lo file
  1.1654 +	  # If there is no directory component, then add one.
  1.1655 +	  case $arg in
  1.1656 +	  */* | *\\*) . $arg ;;
  1.1657 +	  *) . ./$arg ;;
  1.1658 +	  esac
  1.1659 +
  1.1660 +	  if test -z "$pic_object" || \
  1.1661 +	     test -z "$non_pic_object" ||
  1.1662 +	     test "$pic_object" = none && \
  1.1663 +	     test "$non_pic_object" = none; then
  1.1664 +	    $echo "$modename: cannot find name of object for \`$arg'" 1>&2
  1.1665 +	    exit 1
  1.1666 +	  fi
  1.1667 +
  1.1668 +	  # Extract subdirectory from the argument.
  1.1669 +	  xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
  1.1670 +	  if test "X$xdir" = "X$arg"; then
  1.1671 +	    xdir=
  1.1672 + 	  else
  1.1673 +	    xdir="$xdir/"
  1.1674 +	  fi
  1.1675 +
  1.1676 +	  if test "$pic_object" != none; then
  1.1677 +	    # Prepend the subdirectory the object is found in.
  1.1678 +	    pic_object="$xdir$pic_object"
  1.1679 +
  1.1680 +	    if test "$prev" = dlfiles; then
  1.1681 +	      if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
  1.1682 +		dlfiles="$dlfiles $pic_object"
  1.1683 +		prev=
  1.1684 +		continue
  1.1685 +	      else
  1.1686 +		# If libtool objects are unsupported, then we need to preload.
  1.1687 +		prev=dlprefiles
  1.1688 +	      fi
  1.1689 +	    fi
  1.1690 +
  1.1691 +	    # CHECK ME:  I think I busted this.  -Ossama
  1.1692 +	    if test "$prev" = dlprefiles; then
  1.1693 +	      # Preload the old-style object.
  1.1694 +	      dlprefiles="$dlprefiles $pic_object"
  1.1695 +	      prev=
  1.1696 +	    fi
  1.1697 +
  1.1698 +	    # A PIC object.
  1.1699 +	    libobjs="$libobjs $pic_object"
  1.1700 +	    arg="$pic_object"
  1.1701 +	  fi
  1.1702 +
  1.1703 +	  # Non-PIC object.
  1.1704 +	  if test "$non_pic_object" != none; then
  1.1705 +	    # Prepend the subdirectory the object is found in.
  1.1706 +	    non_pic_object="$xdir$non_pic_object"
  1.1707 +
  1.1708 +	    # A standard non-PIC object
  1.1709 +	    non_pic_objects="$non_pic_objects $non_pic_object"
  1.1710 +	    if test -z "$pic_object" || test "$pic_object" = none ; then
  1.1711 +	      arg="$non_pic_object"
  1.1712 +	    fi
  1.1713 +	  fi
  1.1714 +	else
  1.1715 +	  # Only an error if not doing a dry-run.
  1.1716 +	  if test -z "$run"; then
  1.1717 +	    $echo "$modename: \`$arg' is not a valid libtool object" 1>&2
  1.1718 +	    exit 1
  1.1719  	  else
  1.1720 -	    # If libtool objects are unsupported, then we need to preload.
  1.1721 -	    prev=dlprefiles
  1.1722 +	    # Dry-run case.
  1.1723 +
  1.1724 +	    # Extract subdirectory from the argument.
  1.1725 +	    xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
  1.1726 +	    if test "X$xdir" = "X$arg"; then
  1.1727 +	      xdir=
  1.1728 +	    else
  1.1729 +	      xdir="$xdir/"
  1.1730 +	    fi
  1.1731 +
  1.1732 +	    pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"`
  1.1733 +	    non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"`
  1.1734 +	    libobjs="$libobjs $pic_object"
  1.1735 +	    non_pic_objects="$non_pic_objects $non_pic_object"
  1.1736  	  fi
  1.1737  	fi
  1.1738 -
  1.1739 -	if test "$prev" = dlprefiles; then
  1.1740 -	  # Preload the old-style object.
  1.1741 -	  dlprefiles="$dlprefiles "`$echo "X$arg" | $Xsed -e "$lo2o"`
  1.1742 -	  prev=
  1.1743 -	fi
  1.1744 -	libobjs="$libobjs $arg"
  1.1745 +	;;
  1.1746 +
  1.1747 +      *.$libext)
  1.1748 +	# An archive.
  1.1749 +	deplibs="$deplibs $arg"
  1.1750 +	old_deplibs="$old_deplibs $arg"
  1.1751 +	continue
  1.1752  	;;
  1.1753  
  1.1754        *.la)
  1.1755  	# A libtool-controlled library.
  1.1756  
  1.1757 +	if test "$prev" = dlfiles; then
  1.1758 +	  # This library was specified with -dlopen.
  1.1759 +	  dlfiles="$dlfiles $arg"
  1.1760 +	  prev=
  1.1761 +	elif test "$prev" = dlprefiles; then
  1.1762 +	  # The library was specified with -dlpreopen.
  1.1763 +	  dlprefiles="$dlprefiles $arg"
  1.1764 +	  prev=
  1.1765 +	else
  1.1766 +	  deplibs="$deplibs $arg"
  1.1767 +	fi
  1.1768 +	continue
  1.1769 +	;;
  1.1770 +
  1.1771 +      # Some other compiler argument.
  1.1772 +      *)
  1.1773 +	# Unknown arguments in both finalize_command and compile_command need
  1.1774 +	# to be aesthetically quoted because they are evaled later.
  1.1775 +	arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
  1.1776 +	case $arg in
  1.1777 +	*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
  1.1778 +	  arg="\"$arg\""
  1.1779 +	  ;;
  1.1780 +	esac
  1.1781 +	;;
  1.1782 +      esac # arg
  1.1783 +
  1.1784 +      # Now actually substitute the argument into the commands.
  1.1785 +      if test -n "$arg"; then
  1.1786 +	compile_command="$compile_command $arg"
  1.1787 +	finalize_command="$finalize_command $arg"
  1.1788 +      fi
  1.1789 +    done # argument parsing loop
  1.1790 +
  1.1791 +    if test -n "$prev"; then
  1.1792 +      $echo "$modename: the \`$prevarg' option requires an argument" 1>&2
  1.1793 +      $echo "$help" 1>&2
  1.1794 +      exit 1
  1.1795 +    fi
  1.1796 +
  1.1797 +    # Infer tagged configuration to use if any are available and
  1.1798 +    # if one wasn't chosen via the "--tag" command line option.
  1.1799 +    # Only attempt this if the compiler in the base link
  1.1800 +    # command doesn't match the default compiler.
  1.1801 +    if test -n "$available_tags" && test -z "$tagname"; then
  1.1802 +      case $base_compile in
  1.1803 +      # Blanks in the command may have been stripped by the calling shell,
  1.1804 +      # but not from the CC environment variable when configure was run.
  1.1805 +      "$CC "* | " $CC "* | "`$echo $CC` "* | " `$echo $CC` "*) ;;
  1.1806 +      # Blanks at the start of $base_compile will cause this to fail
  1.1807 +      # if we don't check for them as well.
  1.1808 +      *)
  1.1809 +	for z in $available_tags; do
  1.1810 +	  if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$0" > /dev/null; then
  1.1811 +	    # Evaluate the configuration.
  1.1812 +	    eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $0`"
  1.1813 +	    case $base_compile in
  1.1814 +	    "$CC "* | " $CC "* | "`$echo $CC` "* | " `$echo $CC` "*)
  1.1815 +	      # The compiler in $compile_command matches
  1.1816 +	      # the one in the tagged configuration.
  1.1817 +	      # Assume this is the tagged configuration we want.
  1.1818 +	      tagname=$z
  1.1819 +	      break
  1.1820 +	      ;;
  1.1821 +	    esac
  1.1822 +	  fi
  1.1823 +	done
  1.1824 +	# If $tagname still isn't set, then no tagged configuration
  1.1825 +	# was found and let the user know that the "--tag" command
  1.1826 +	# line option must be used.
  1.1827 +	if test -z "$tagname"; then
  1.1828 +	  $echo "$modename: unable to infer tagged configuration"
  1.1829 +	  $echo "$modename: specify a tag with \`--tag'" 1>&2
  1.1830 +	  exit 1
  1.1831 +#       else
  1.1832 +#         $echo "$modename: using $tagname tagged configuration"
  1.1833 +	fi
  1.1834 +	;;
  1.1835 +      esac
  1.1836 +    fi
  1.1837 +
  1.1838 +    if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then
  1.1839 +      eval arg=\"$export_dynamic_flag_spec\"
  1.1840 +      compile_command="$compile_command $arg"
  1.1841 +      finalize_command="$finalize_command $arg"
  1.1842 +    fi
  1.1843 +
  1.1844 +    oldlibs=
  1.1845 +    # calculate the name of the file, without its directory
  1.1846 +    outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'`
  1.1847 +    libobjs_save="$libobjs"
  1.1848 +
  1.1849 +    if test -n "$shlibpath_var"; then
  1.1850 +      # get the directories listed in $shlibpath_var
  1.1851 +      eval shlib_search_path=\`\$echo \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\`
  1.1852 +    else
  1.1853 +      shlib_search_path=
  1.1854 +    fi
  1.1855 +    eval sys_lib_search_path=\"$sys_lib_search_path_spec\"
  1.1856 +    eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\"
  1.1857 +
  1.1858 +    output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'`
  1.1859 +    if test "X$output_objdir" = "X$output"; then
  1.1860 +      output_objdir="$objdir"
  1.1861 +    else
  1.1862 +      output_objdir="$output_objdir/$objdir"
  1.1863 +    fi
  1.1864 +    # Create the object directory.
  1.1865 +    if test ! -d "$output_objdir"; then
  1.1866 +      $show "$mkdir $output_objdir"
  1.1867 +      $run $mkdir $output_objdir
  1.1868 +      status=$?
  1.1869 +      if test "$status" -ne 0 && test ! -d "$output_objdir"; then
  1.1870 +	exit $status
  1.1871 +      fi
  1.1872 +    fi
  1.1873 +
  1.1874 +    # Determine the type of output
  1.1875 +    case $output in
  1.1876 +    "")
  1.1877 +      $echo "$modename: you must specify an output file" 1>&2
  1.1878 +      $echo "$help" 1>&2
  1.1879 +      exit 1
  1.1880 +      ;;
  1.1881 +    *.$libext) linkmode=oldlib ;;
  1.1882 +    *.lo | *.$objext) linkmode=obj ;;
  1.1883 +    *.la) linkmode=lib ;;
  1.1884 +    *) linkmode=prog ;; # Anything else should be a program.
  1.1885 +    esac
  1.1886 +
  1.1887 +    case $host in
  1.1888 +    *cygwin* | *mingw* | *pw32*)
  1.1889 +      # don't eliminate duplcations in $postdeps and $predeps
  1.1890 +      duplicate_compiler_generated_deps=yes
  1.1891 +      ;;
  1.1892 +    *)
  1.1893 +      duplicate_compiler_generated_deps=$duplicate_deps
  1.1894 +      ;;
  1.1895 +    esac
  1.1896 +    specialdeplibs=
  1.1897 +
  1.1898 +    libs=
  1.1899 +    # Find all interdependent deplibs by searching for libraries
  1.1900 +    # that are linked more than once (e.g. -la -lb -la)
  1.1901 +    for deplib in $deplibs; do
  1.1902 +      if test "X$duplicate_deps" = "Xyes" ; then
  1.1903 +	case "$libs " in
  1.1904 +	*" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
  1.1905 +	esac
  1.1906 +      fi
  1.1907 +      libs="$libs $deplib"
  1.1908 +    done
  1.1909 +
  1.1910 +    if test "$linkmode" = lib; then
  1.1911 +      libs="$predeps $libs $compiler_lib_search_path $postdeps"
  1.1912 +
  1.1913 +      # Compute libraries that are listed more than once in $predeps
  1.1914 +      # $postdeps and mark them as special (i.e., whose duplicates are
  1.1915 +      # not to be eliminated).
  1.1916 +      pre_post_deps=
  1.1917 +      if test "X$duplicate_compiler_generated_deps" = "Xyes" ; then
  1.1918 +	for pre_post_dep in $predeps $postdeps; do
  1.1919 +	  case "$pre_post_deps " in
  1.1920 +	  *" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;;
  1.1921 +	  esac
  1.1922 +	  pre_post_deps="$pre_post_deps $pre_post_dep"
  1.1923 +	done
  1.1924 +      fi
  1.1925 +      pre_post_deps=
  1.1926 +    fi
  1.1927 +
  1.1928 +    deplibs=
  1.1929 +    newdependency_libs=
  1.1930 +    newlib_search_path=
  1.1931 +    need_relink=no # whether we're linking any uninstalled libtool libraries
  1.1932 +    notinst_deplibs= # not-installed libtool libraries
  1.1933 +    notinst_path= # paths that contain not-installed libtool libraries
  1.1934 +    case $linkmode in
  1.1935 +    lib)
  1.1936 +	passes="conv link"
  1.1937 +	for file in $dlfiles $dlprefiles; do
  1.1938 +	  case $file in
  1.1939 +	  *.la) ;;
  1.1940 +	  *)
  1.1941 +	    $echo "$modename: libraries can \`-dlopen' only libtool libraries: $file" 1>&2
  1.1942 +	    exit 1
  1.1943 +	    ;;
  1.1944 +	  esac
  1.1945 +	done
  1.1946 +	;;
  1.1947 +    prog)
  1.1948 +	compile_deplibs=
  1.1949 +	finalize_deplibs=
  1.1950 +	alldeplibs=no
  1.1951 +	newdlfiles=
  1.1952 +	newdlprefiles=
  1.1953 +	passes="conv scan dlopen dlpreopen link"
  1.1954 +	;;
  1.1955 +    *)  passes="conv"
  1.1956 +	;;
  1.1957 +    esac
  1.1958 +    for pass in $passes; do
  1.1959 +      if test "$linkmode,$pass" = "lib,link" ||
  1.1960 +	 test "$linkmode,$pass" = "prog,scan"; then
  1.1961 +	libs="$deplibs"
  1.1962 +	deplibs=
  1.1963 +      fi
  1.1964 +      if test "$linkmode" = prog; then
  1.1965 +	case $pass in
  1.1966 +	dlopen) libs="$dlfiles" ;;
  1.1967 +	dlpreopen) libs="$dlprefiles" ;;
  1.1968 +	link) libs="$deplibs %DEPLIBS% $dependency_libs" ;;
  1.1969 +	esac
  1.1970 +      fi
  1.1971 +      if test "$pass" = dlopen; then
  1.1972 +	# Collect dlpreopened libraries
  1.1973 +	save_deplibs="$deplibs"
  1.1974 +	deplibs=
  1.1975 +      fi
  1.1976 +      for deplib in $libs; do
  1.1977 +	lib=
  1.1978 +	found=no
  1.1979 +	case $deplib in
  1.1980 +	-l*)
  1.1981 +	  if test "$linkmode" != lib && test "$linkmode" != prog; then
  1.1982 +	    $echo "$modename: warning: \`-l' is ignored for archives/objects" 1>&2
  1.1983 +	    continue
  1.1984 +	  fi
  1.1985 +	  if test "$pass" = conv; then
  1.1986 +	    deplibs="$deplib $deplibs"
  1.1987 +	    continue
  1.1988 +	  fi
  1.1989 +	  name=`$echo "X$deplib" | $Xsed -e 's/^-l//'`
  1.1990 +	  for searchdir in $newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path; do
  1.1991 +	    # Search the libtool library
  1.1992 +	    lib="$searchdir/lib${name}.la"
  1.1993 +	    if test -f "$lib"; then
  1.1994 +	      found=yes
  1.1995 +	      break
  1.1996 +	    fi
  1.1997 +	  done
  1.1998 +	  if test "$found" != yes; then
  1.1999 +	    # deplib doesn't seem to be a libtool library
  1.2000 +	    if test "$linkmode,$pass" = "prog,link"; then
  1.2001 +	      compile_deplibs="$deplib $compile_deplibs"
  1.2002 +	      finalize_deplibs="$deplib $finalize_deplibs"
  1.2003 +	    else
  1.2004 +	      deplibs="$deplib $deplibs"
  1.2005 +	      test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
  1.2006 +	    fi
  1.2007 +	    continue
  1.2008 +	  else # deplib is a libtool library
  1.2009 +	    # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib,
  1.2010 +	    # We need to do some special things here, and not later.
  1.2011 +	    if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
  1.2012 +	      case " $predeps $postdeps " in
  1.2013 +	      *" $deplib "*)
  1.2014 +		if (${SED} -e '2q' $lib |
  1.2015 +                    grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
  1.2016 +		  library_names=
  1.2017 +		  old_library=
  1.2018 +		  case $lib in
  1.2019 +		  */* | *\\*) . $lib ;;
  1.2020 +		  *) . ./$lib ;;
  1.2021 +		  esac
  1.2022 +		  for l in $old_library $library_names; do
  1.2023 +		    ll="$l"
  1.2024 +		  done
  1.2025 +		  if test "X$ll" = "X$old_library" ; then # only static version available
  1.2026 +		    found=no
  1.2027 +		    ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'`
  1.2028 +		    test "X$ladir" = "X$lib" && ladir="."
  1.2029 +		    lib=$ladir/$old_library
  1.2030 +		    if test "$linkmode,$pass" = "prog,link"; then
  1.2031 +		      compile_deplibs="$deplib $compile_deplibs"
  1.2032 +		      finalize_deplibs="$deplib $finalize_deplibs"
  1.2033 +		    else
  1.2034 +		      deplibs="$deplib $deplibs"
  1.2035 +		      test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
  1.2036 +		    fi
  1.2037 +		    continue
  1.2038 +		  fi
  1.2039 +		fi
  1.2040 +	        ;;
  1.2041 +	      *) ;;
  1.2042 +	      esac
  1.2043 +	    fi
  1.2044 +	  fi
  1.2045 +	  ;; # -l
  1.2046 +	-L*)
  1.2047 +	  case $linkmode in
  1.2048 +	  lib)
  1.2049 +	    deplibs="$deplib $deplibs"
  1.2050 +	    test "$pass" = conv && continue
  1.2051 +	    newdependency_libs="$deplib $newdependency_libs"
  1.2052 +	    newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
  1.2053 +	    ;;
  1.2054 +	  prog)
  1.2055 +	    if test "$pass" = conv; then
  1.2056 +	      deplibs="$deplib $deplibs"
  1.2057 +	      continue
  1.2058 +	    fi
  1.2059 +	    if test "$pass" = scan; then
  1.2060 +	      deplibs="$deplib $deplibs"
  1.2061 +	      newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
  1.2062 +	    else
  1.2063 +	      compile_deplibs="$deplib $compile_deplibs"
  1.2064 +	      finalize_deplibs="$deplib $finalize_deplibs"
  1.2065 +	    fi
  1.2066 +	    ;;
  1.2067 +	  *)
  1.2068 +	    $echo "$modename: warning: \`-L' is ignored for archives/objects" 1>&2
  1.2069 +	    ;;
  1.2070 +	  esac # linkmode
  1.2071 +	  continue
  1.2072 +	  ;; # -L
  1.2073 +	-R*)
  1.2074 +	  if test "$pass" = link; then
  1.2075 +	    dir=`$echo "X$deplib" | $Xsed -e 's/^-R//'`
  1.2076 +	    # Make sure the xrpath contains only unique directories.
  1.2077 +	    case "$xrpath " in
  1.2078 +	    *" $dir "*) ;;
  1.2079 +	    *) xrpath="$xrpath $dir" ;;
  1.2080 +	    esac
  1.2081 +	  fi
  1.2082 +	  deplibs="$deplib $deplibs"
  1.2083 +	  continue
  1.2084 +	  ;;
  1.2085 +	*.la) lib="$deplib" ;;
  1.2086 +	*.$libext)
  1.2087 +	  if test "$pass" = conv; then
  1.2088 +	    deplibs="$deplib $deplibs"
  1.2089 +	    continue
  1.2090 +	  fi
  1.2091 +	  case $linkmode in
  1.2092 +	  lib)
  1.2093 +	    if test "$deplibs_check_method" != pass_all; then
  1.2094 +	      $echo
  1.2095 +	      $echo "*** Warning: Trying to link with static lib archive $deplib."
  1.2096 +	      $echo "*** I have the capability to make that library automatically link in when"
  1.2097 +	      $echo "*** you link to this library.  But I can only do this if you have a"
  1.2098 +	      $echo "*** shared version of the library, which you do not appear to have"
  1.2099 +	      $echo "*** because the file extensions .$libext of this argument makes me believe"
  1.2100 +	      $echo "*** that it is just a static archive that I should not used here."
  1.2101 +	    else
  1.2102 +	      $echo
  1.2103 +	      $echo "*** Warning: Linking the shared library $output against the"
  1.2104 +	      $echo "*** static library $deplib is not portable!"
  1.2105 +	      deplibs="$deplib $deplibs"
  1.2106 +	    fi
  1.2107 +	    continue
  1.2108 +	    ;;
  1.2109 +	  prog)
  1.2110 +	    if test "$pass" != link; then
  1.2111 +	      deplibs="$deplib $deplibs"
  1.2112 +	    else
  1.2113 +	      compile_deplibs="$deplib $compile_deplibs"
  1.2114 +	      finalize_deplibs="$deplib $finalize_deplibs"
  1.2115 +	    fi
  1.2116 +	    continue
  1.2117 +	    ;;
  1.2118 +	  esac # linkmode
  1.2119 +	  ;; # *.$libext
  1.2120 +	*.lo | *.$objext)
  1.2121 +	  if test "$pass" = conv; then
  1.2122 +	    deplibs="$deplib $deplibs"
  1.2123 +	  elif test "$linkmode" = prog; then
  1.2124 +	    if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
  1.2125 +	      # If there is no dlopen support or we're linking statically,
  1.2126 +	      # we need to preload.
  1.2127 +	      newdlprefiles="$newdlprefiles $deplib"
  1.2128 +	      compile_deplibs="$deplib $compile_deplibs"
  1.2129 +	      finalize_deplibs="$deplib $finalize_deplibs"
  1.2130 +	    else
  1.2131 +	      newdlfiles="$newdlfiles $deplib"
  1.2132 +	    fi
  1.2133 +	  fi
  1.2134 +	  continue
  1.2135 +	  ;;
  1.2136 +	%DEPLIBS%)
  1.2137 +	  alldeplibs=yes
  1.2138 +	  continue
  1.2139 +	  ;;
  1.2140 +	esac # case $deplib
  1.2141 +	if test "$found" = yes || test -f "$lib"; then :
  1.2142 +	else
  1.2143 +	  $echo "$modename: cannot find the library \`$lib'" 1>&2
  1.2144 +	  exit 1
  1.2145 +	fi
  1.2146 +
  1.2147 +	# Check to see that this really is a libtool archive.
  1.2148 +	if (${SED} -e '2q' $lib | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
  1.2149 +	else
  1.2150 +	  $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
  1.2151 +	  exit 1
  1.2152 +	fi
  1.2153 +
  1.2154 +	ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'`
  1.2155 +	test "X$ladir" = "X$lib" && ladir="."
  1.2156 +
  1.2157  	dlname=
  1.2158 +	dlopen=
  1.2159 +	dlpreopen=
  1.2160  	libdir=
  1.2161  	library_names=
  1.2162  	old_library=
  1.2163 -
  1.2164 -	# Check to see that this really is a libtool archive.
  1.2165 -	if (sed -e '2q' $arg | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
  1.2166 -	else
  1.2167 -	  $echo "$modename: \`$arg' is not a valid libtool archive" 1>&2
  1.2168 -	  exit 1
  1.2169 +	# If the library was installed with an old release of libtool,
  1.2170 +	# it will not redefine variables installed, or shouldnotlink
  1.2171 +	installed=yes
  1.2172 +	shouldnotlink=no
  1.2173 +
  1.2174 +	# Read the .la file
  1.2175 +	case $lib in
  1.2176 +	*/* | *\\*) . $lib ;;
  1.2177 +	*) . ./$lib ;;
  1.2178 +	esac
  1.2179 +
  1.2180 +	if test "$linkmode,$pass" = "lib,link" ||
  1.2181 +	   test "$linkmode,$pass" = "prog,scan" ||
  1.2182 +	   { test "$linkmode" != prog && test "$linkmode" != lib; }; then
  1.2183 +	  test -n "$dlopen" && dlfiles="$dlfiles $dlopen"
  1.2184 +	  test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen"
  1.2185  	fi
  1.2186  
  1.2187 -	# If the library was installed with an old release of libtool,
  1.2188 -	# it will not redefine variable installed.
  1.2189 -	installed=yes
  1.2190 -
  1.2191 -	# Read the .la file
  1.2192 -	# If there is no directory component, then add one.
  1.2193 -	case "$arg" in
  1.2194 -	*/* | *\\*) . $arg ;;
  1.2195 -	*) . ./$arg ;;
  1.2196 -	esac
  1.2197 -
  1.2198 +	if test "$pass" = conv; then
  1.2199 +	  # Only check for convenience libraries
  1.2200 +	  deplibs="$lib $deplibs"
  1.2201 +	  if test -z "$libdir"; then
  1.2202 +	    if test -z "$old_library"; then
  1.2203 +	      $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
  1.2204 +	      exit 1
  1.2205 +	    fi
  1.2206 +	    # It is a libtool convenience library, so add in its objects.
  1.2207 +	    convenience="$convenience $ladir/$objdir/$old_library"
  1.2208 +	    old_convenience="$old_convenience $ladir/$objdir/$old_library"
  1.2209 +	    tmp_libs=
  1.2210 +	    for deplib in $dependency_libs; do
  1.2211 +	      deplibs="$deplib $deplibs"
  1.2212 +              if test "X$duplicate_deps" = "Xyes" ; then
  1.2213 +	        case "$tmp_libs " in
  1.2214 +	        *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
  1.2215 +	        esac
  1.2216 +              fi
  1.2217 +	      tmp_libs="$tmp_libs $deplib"
  1.2218 +	    done
  1.2219 +	  elif test "$linkmode" != prog && test "$linkmode" != lib; then
  1.2220 +	    $echo "$modename: \`$lib' is not a convenience library" 1>&2
  1.2221 +	    exit 1
  1.2222 +	  fi
  1.2223 +	  continue
  1.2224 +	fi # $pass = conv
  1.2225 +
  1.2226 +    
  1.2227  	# Get the name of the library we link against.
  1.2228  	linklib=
  1.2229  	for l in $old_library $library_names; do
  1.2230  	  linklib="$l"
  1.2231  	done
  1.2232 -
  1.2233  	if test -z "$linklib"; then
  1.2234 -	  $echo "$modename: cannot find name of link library for \`$arg'" 1>&2
  1.2235 +	  $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
  1.2236  	  exit 1
  1.2237  	fi
  1.2238  
  1.2239 +	# This library was specified with -dlopen.
  1.2240 +	if test "$pass" = dlopen; then
  1.2241 +	  if test -z "$libdir"; then
  1.2242 +	    $echo "$modename: cannot -dlopen a convenience library: \`$lib'" 1>&2
  1.2243 +	    exit 1
  1.2244 +	  fi
  1.2245 +	  if test -z "$dlname" || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
  1.2246 +	    # If there is no dlname, no dlopen support or we're linking
  1.2247 +	    # statically, we need to preload.  We also need to preload any
  1.2248 +	    # dependent libraries so libltdl's deplib preloader doesn't
  1.2249 +	    # bomb out in the load deplibs phase.
  1.2250 +	    dlprefiles="$dlprefiles $lib $dependency_libs"
  1.2251 +	  else
  1.2252 +	    newdlfiles="$newdlfiles $lib"
  1.2253 +	  fi
  1.2254 +	  continue
  1.2255 +	fi # $pass = dlopen
  1.2256 +
  1.2257 +	# We need an absolute path.
  1.2258 +	case $ladir in
  1.2259 +	[\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;;
  1.2260 +	*)
  1.2261 +	  abs_ladir=`cd "$ladir" && pwd`
  1.2262 +	  if test -z "$abs_ladir"; then
  1.2263 +	    $echo "$modename: warning: cannot determine absolute directory name of \`$ladir'" 1>&2
  1.2264 +	    $echo "$modename: passing it literally to the linker, although it might fail" 1>&2
  1.2265 +	    abs_ladir="$ladir"
  1.2266 +	  fi
  1.2267 +	  ;;
  1.2268 +	esac
  1.2269 +	laname=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
  1.2270 +
  1.2271  	# Find the relevant object directory and library name.
  1.2272 -	name=`$echo "X$arg" | $Xsed -e 's%^.*/%%' -e 's/\.la$//' -e 's/^lib//'`
  1.2273 -
  1.2274  	if test "X$installed" = Xyes; then
  1.2275 -	  dir="$libdir"
  1.2276 +	  if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then
  1.2277 +	    $echo "$modename: warning: library \`$lib' was moved." 1>&2
  1.2278 +	    dir="$ladir"
  1.2279 +	    absdir="$abs_ladir"
  1.2280 +	    libdir="$abs_ladir"
  1.2281 +	  else
  1.2282 +	    dir="$libdir"
  1.2283 +	    absdir="$libdir"
  1.2284 +	  fi
  1.2285  	else
  1.2286 -	  dir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
  1.2287 -	  if test "X$dir" = "X$arg"; then
  1.2288 -	    dir="$objdir"
  1.2289 +	  dir="$ladir/$objdir"
  1.2290 +	  absdir="$abs_ladir/$objdir"
  1.2291 +	  # Remove this search path later
  1.2292 +	  notinst_path="$notinst_path $abs_ladir"
  1.2293 +	fi # $installed = yes
  1.2294 +	name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
  1.2295 +
  1.2296 +	# This library was specified with -dlpreopen.
  1.2297 +	if test "$pass" = dlpreopen; then
  1.2298 +	  if test -z "$libdir"; then
  1.2299 +	    $echo "$modename: cannot -dlpreopen a convenience library: \`$lib'" 1>&2
  1.2300 +	    exit 1
  1.2301 +	  fi
  1.2302 +	  # Prefer using a static library (so that no silly _DYNAMIC symbols
  1.2303 +	  # are required to link).
  1.2304 +	  if test -n "$old_library"; then
  1.2305 +	    newdlprefiles="$newdlprefiles $dir/$old_library"
  1.2306 +	  # Otherwise, use the dlname, so that lt_dlopen finds it.
  1.2307 +	  elif test -n "$dlname"; then
  1.2308 +	    newdlprefiles="$newdlprefiles $dir/$dlname"
  1.2309  	  else
  1.2310 -	    dir="$dir/$objdir"
  1.2311 +	    newdlprefiles="$newdlprefiles $dir/$linklib"
  1.2312  	  fi
  1.2313 -	fi
  1.2314 -
  1.2315 -	if test -n "$dependency_libs"; then
  1.2316 -	  # Extract -R and -L from dependency_libs
  1.2317 -	  temp_deplibs=
  1.2318 -	  for deplib in $dependency_libs; do
  1.2319 -	    case "$deplib" in
  1.2320 -	    -R*) temp_xrpath=`$echo "X$deplib" | $Xsed -e 's/^-R//'`
  1.2321 -		 case " $rpath $xrpath " in
  1.2322 -		 *" $temp_xrpath "*) ;;
  1.2323 -		 *) xrpath="$xrpath $temp_xrpath";;
  1.2324 -		 esac;;
  1.2325 -	    -L*) case "$compile_command $temp_deplibs " in
  1.2326 -		 *" $deplib "*) ;;
  1.2327 -		 *) temp_deplibs="$temp_deplibs $deplib";;
  1.2328 -		 esac
  1.2329 -		 temp_dir=`$echo "X$deplib" | $Xsed -e 's/^-L//'`
  1.2330 -		 case " $lib_search_path " in
  1.2331 -		 *" $temp_dir "*) ;;
  1.2332 -		 *) lib_search_path="$lib_search_path $temp_dir";;
  1.2333 -		 esac
  1.2334 -		 ;;
  1.2335 -	    *) temp_deplibs="$temp_deplibs $deplib";;
  1.2336 -	    esac
  1.2337 -	  done
  1.2338 -	  dependency_libs="$temp_deplibs"
  1.2339 -	fi
  1.2340 +	fi # $pass = dlpreopen
  1.2341  
  1.2342  	if test -z "$libdir"; then
  1.2343 -	  # It is a libtool convenience library, so add in its objects.
  1.2344 -	  convenience="$convenience $dir/$old_library"
  1.2345 -	  old_convenience="$old_convenience $dir/$old_library"
  1.2346 -	  deplibs="$deplibs$dependency_libs"
  1.2347 -	  compile_command="$compile_command $dir/$old_library$dependency_libs"
  1.2348 -	  finalize_command="$finalize_command $dir/$old_library$dependency_libs"
  1.2349 +	  # Link the convenience library
  1.2350 +	  if test "$linkmode" = lib; then
  1.2351 +	    deplibs="$dir/$old_library $deplibs"
  1.2352 +	  elif test "$linkmode,$pass" = "prog,link"; then
  1.2353 +	    compile_deplibs="$dir/$old_library $compile_deplibs"
  1.2354 +	    finalize_deplibs="$dir/$old_library $finalize_deplibs"
  1.2355 +	  else
  1.2356 +	    deplibs="$lib $deplibs" # used for prog,scan pass
  1.2357 +	  fi
  1.2358  	  continue
  1.2359  	fi
  1.2360  
  1.2361 -	# This library was specified with -dlopen.
  1.2362 -	if test "$prev" = dlfiles; then
  1.2363 -	  dlfiles="$dlfiles $arg"
  1.2364 -	  if test -z "$dlname" || test "$dlopen" != yes || test "$build_libtool_libs" = no; then
  1.2365 -	    # If there is no dlname, no dlopen support or we're linking statically,
  1.2366 -	    # we need to preload.
  1.2367 -	    prev=dlprefiles
  1.2368 -	  else
  1.2369 -	    # We should not create a dependency on this library, but we
  1.2370 -	    # may need any libraries it requires.
  1.2371 -	    compile_command="$compile_command$dependency_libs"
  1.2372 -	    finalize_command="$finalize_command$dependency_libs"
  1.2373 -	    prev=
  1.2374 +    
  1.2375 +	if test "$linkmode" = prog && test "$pass" != link; then
  1.2376 +	  newlib_search_path="$newlib_search_path $ladir"
  1.2377 +	  deplibs="$lib $deplibs"
  1.2378 +
  1.2379 +	  linkalldeplibs=no
  1.2380 +	  if test "$link_all_deplibs" != no || test -z "$library_names" ||
  1.2381 +	     test "$build_libtool_libs" = no; then
  1.2382 +	    linkalldeplibs=yes
  1.2383 +	  fi
  1.2384 +
  1.2385 +	  tmp_libs=
  1.2386 +	  for deplib in $dependency_libs; do
  1.2387 +	    case $deplib in
  1.2388 +	    -L*) newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`;; ### testsuite: skip nested quoting test
  1.2389 +	    esac
  1.2390 +	    # Need to link against all dependency_libs?
  1.2391 +	    if test "$linkalldeplibs" = yes; then
  1.2392 +	      deplibs="$deplib $deplibs"
  1.2393 +	    else
  1.2394 +	      # Need to hardcode shared library paths
  1.2395 +	      # or/and link against static libraries
  1.2396 +	      newdependency_libs="$deplib $newdependency_libs"
  1.2397 +	    fi
  1.2398 +	    if test "X$duplicate_deps" = "Xyes" ; then
  1.2399 +	      case "$tmp_libs " in
  1.2400 +	      *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
  1.2401 +	      esac
  1.2402 +	    fi
  1.2403 +	    tmp_libs="$tmp_libs $deplib"
  1.2404 +	  done # for deplib
  1.2405 +	  continue
  1.2406 +	fi # $linkmode = prog...
  1.2407 +
  1.2408 +	if test "$linkmode,$pass" = "prog,link"; then
  1.2409 +	  if test -n "$library_names" &&
  1.2410 +	     { test "$prefer_static_libs" = no || test -z "$old_library"; }; then
  1.2411 +	    # We need to hardcode the library path
  1.2412 +	    if test -n "$shlibpath_var"; then
  1.2413 +	      # Make sure the rpath contains only unique directories.
  1.2414 +	      case "$temp_rpath " in
  1.2415 +	      *" $dir "*) ;;
  1.2416 +	      *" $absdir "*) ;;
  1.2417 +	      *) temp_rpath="$temp_rpath $dir" ;;
  1.2418 +	      esac
  1.2419 +	    fi
  1.2420 +
  1.2421 +	    # Hardcode the library path.
  1.2422 +	    # Skip directories that are in the system default run-time
  1.2423 +	    # search path.
  1.2424 +	    case " $sys_lib_dlsearch_path " in
  1.2425 +	    *" $absdir "*) ;;
  1.2426 +	    *)
  1.2427 +	      case "$compile_rpath " in
  1.2428 +	      *" $absdir "*) ;;
  1.2429 +	      *) compile_rpath="$compile_rpath $absdir"
  1.2430 +	      esac
  1.2431 +	      ;;
  1.2432 +	    esac
  1.2433 +	    case " $sys_lib_dlsearch_path " in
  1.2434 +	    *" $libdir "*) ;;
  1.2435 +	    *)
  1.2436 +	      case "$finalize_rpath " in
  1.2437 +	      *" $libdir "*) ;;
  1.2438 +	      *) finalize_rpath="$finalize_rpath $libdir"
  1.2439 +	      esac
  1.2440 +	      ;;
  1.2441 +	    esac
  1.2442 +	  fi # $linkmode,$pass = prog,link...
  1.2443 +
  1.2444 +	  if test "$alldeplibs" = yes &&
  1.2445 +	     { test "$deplibs_check_method" = pass_all ||
  1.2446 +	       { test "$build_libtool_libs" = yes &&
  1.2447 +		 test -n "$library_names"; }; }; then
  1.2448 +	    # We only need to search for static libraries
  1.2449  	    continue
  1.2450  	  fi
  1.2451  	fi
  1.2452  
  1.2453 -	# The library was specified with -dlpreopen.
  1.2454 -	if test "$prev" = dlprefiles; then
  1.2455 -	  # Prefer using a static library (so that no silly _DYNAMIC symbols
  1.2456 -	  # are required to link).
  1.2457 -	  if test -n "$old_library"; then
  1.2458 -	    dlprefiles="$dlprefiles $dir/$old_library"
  1.2459 -	  else
  1.2460 -	    dlprefiles="$dlprefiles $dir/$linklib"
  1.2461 -	  fi
  1.2462 -	  prev=
  1.2463 -	fi
  1.2464 -
  1.2465 +	link_static=no # Whether the deplib will be linked statically
  1.2466  	if test -n "$library_names" &&
  1.2467  	   { test "$prefer_static_libs" = no || test -z "$old_library"; }; then
  1.2468 -	  link_against_libtool_libs="$link_against_libtool_libs $arg"
  1.2469 -	  if test -n "$shlibpath_var"; then
  1.2470 -	    # Make sure the rpath contains only unique directories.
  1.2471 -	    case "$temp_rpath " in
  1.2472 -	    *" $dir "*) ;;
  1.2473 -	    *) temp_rpath="$temp_rpath $dir" ;;
  1.2474 +	  if test "$installed" = no; then
  1.2475 +	    notinst_deplibs="$notinst_deplibs $lib"
  1.2476 +	    need_relink=yes
  1.2477 +	  fi
  1.2478 +	  # This is a shared library
  1.2479 +	
  1.2480 +      # Warn about portability, can't link against -module's on some systems (darwin)
  1.2481 +      if test "$shouldnotlink" = yes && test "$pass" = link ; then
  1.2482 +	    $echo
  1.2483 +	    if test "$linkmode" = prog; then
  1.2484 +	      $echo "*** Warning: Linking the executable $output against the loadable module"
  1.2485 +	    else
  1.2486 +	      $echo "*** Warning: Linking the shared library $output against the loadable module"
  1.2487 +	    fi
  1.2488 +	    $echo "*** $linklib is not portable!"    
  1.2489 +      fi	  
  1.2490 +	  if test "$linkmode" = lib &&
  1.2491 +	     test "$hardcode_into_libs" = yes; then
  1.2492 +	    # Hardcode the library path.
  1.2493 +	    # Skip directories that are in the system default run-time
  1.2494 +	    # search path.
  1.2495 +	    case " $sys_lib_dlsearch_path " in
  1.2496 +	    *" $absdir "*) ;;
  1.2497 +	    *)
  1.2498 +	      case "$compile_rpath " in
  1.2499 +	      *" $absdir "*) ;;
  1.2500 +	      *) compile_rpath="$compile_rpath $absdir"
  1.2501 +	      esac
  1.2502 +	      ;;
  1.2503 +	    esac
  1.2504 +	    case " $sys_lib_dlsearch_path " in
  1.2505 +	    *" $libdir "*) ;;
  1.2506 +	    *)
  1.2507 +	      case "$finalize_rpath " in
  1.2508 +	      *" $libdir "*) ;;
  1.2509 +	      *) finalize_rpath="$finalize_rpath $libdir"
  1.2510 +	      esac
  1.2511 +	      ;;
  1.2512  	    esac
  1.2513  	  fi
  1.2514  
  1.2515 -	  # We need an absolute path.
  1.2516 -	  case "$dir" in
  1.2517 -	  [\\/] | [A-Za-z]:[\\/]*) absdir="$dir" ;;
  1.2518 -	  *)
  1.2519 -	    absdir=`cd "$dir" && pwd`
  1.2520 -	    if test -z "$absdir"; then
  1.2521 -	      $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2
  1.2522 -	      $echo "$modename: passing it literally to the linker, although it might fail" 1>&2
  1.2523 -	      absdir="$dir"
  1.2524 -	    fi
  1.2525 -	    ;;
  1.2526 -	  esac
  1.2527 -	  
  1.2528 -	  # This is the magic to use -rpath.
  1.2529 -	  # Skip directories that are in the system default run-time
  1.2530 -	  # search path, unless they have been requested with -R.
  1.2531 -	  case " $sys_lib_dlsearch_path " in
  1.2532 -	  *" $absdir "*) ;;
  1.2533 -	  *)
  1.2534 -	    case "$compile_rpath " in
  1.2535 -	    *" $absdir "*) ;;
  1.2536 -	    *) compile_rpath="$compile_rpath $absdir" 
  1.2537 -	    esac
  1.2538 -	    ;;
  1.2539 -	  esac
  1.2540 -
  1.2541 -	  case " $sys_lib_dlsearch_path " in
  1.2542 -	  *" $libdir "*) ;;
  1.2543 -	  *)
  1.2544 -	    case "$finalize_rpath " in
  1.2545 -	    *" $libdir "*) ;;
  1.2546 -	    *) finalize_rpath="$finalize_rpath $libdir"
  1.2547 -	    esac
  1.2548 -	    ;;
  1.2549 -	  esac
  1.2550 -
  1.2551 -	  lib_linked=yes
  1.2552 -	  case "$hardcode_action" in
  1.2553 -	  immediate | unsupported)
  1.2554 -	    if test "$hardcode_direct" = no; then
  1.2555 -	      compile_command="$compile_command $dir/$linklib"
  1.2556 -	      deplibs="$deplibs $dir/$linklib"
  1.2557 -	      case "$host" in
  1.2558 -	      *-*-cygwin* | *-*-mingw* | *-*-os2*)
  1.2559 -		dllsearchdir=`cd "$dir" && pwd || echo "$dir"`
  1.2560 -		if test -n "$dllsearchpath"; then
  1.2561 -		  dllsearchpath="$dllsearchpath:$dllsearchdir"
  1.2562 -		else
  1.2563 -		  dllsearchpath="$dllsearchdir"
  1.2564 -		fi
  1.2565 +	  if test -n "$old_archive_from_expsyms_cmds"; then
  1.2566 +	    # figure out the soname
  1.2567 +	    set dummy $library_names
  1.2568 +	    realname="$2"
  1.2569 +	    shift; shift
  1.2570 +	    libname=`eval \\$echo \"$libname_spec\"`
  1.2571 +	    # use dlname if we got it. it's perfectly good, no?
  1.2572 +	    if test -n "$dlname"; then
  1.2573 +	      soname="$dlname"
  1.2574 +	    elif test -n "$soname_spec"; then
  1.2575 +	      # bleh windows
  1.2576 +	      case $host in
  1.2577 +	      *cygwin* | mingw*)
  1.2578 +		major=`expr $current - $age`
  1.2579 +		versuffix="-$major"
  1.2580  		;;
  1.2581  	      esac
  1.2582 -	    elif test "$hardcode_minus_L" = no; then
  1.2583 -	      case "$host" in
  1.2584 -	      *-*-sunos*)
  1.2585 -		compile_shlibpath="$compile_shlibpath$dir:"
  1.2586 -		;;
  1.2587 +	      eval soname=\"$soname_spec\"
  1.2588 +	    else
  1.2589 +	      soname="$realname"
  1.2590 +	    fi
  1.2591 +
  1.2592 +	    # Make a new name for the extract_expsyms_cmds to use
  1.2593 +	    soroot="$soname"
  1.2594 +	    soname=`$echo $soroot | ${SED} -e 's/^.*\///'`
  1.2595 +	    newlib="libimp-`$echo $soname | ${SED} 's/^lib//;s/\.dll$//'`.a"
  1.2596 +
  1.2597 +	    # If the library has no export list, then create one now
  1.2598 +	    if test -f "$output_objdir/$soname-def"; then :
  1.2599 +	    else
  1.2600 +	      $show "extracting exported symbol list from \`$soname'"
  1.2601 +	      save_ifs="$IFS"; IFS='~'
  1.2602 +	      eval cmds=\"$extract_expsyms_cmds\"
  1.2603 +	      for cmd in $cmds; do
  1.2604 +		IFS="$save_ifs"
  1.2605 +		$show "$cmd"
  1.2606 +		$run eval "$cmd" || exit $?
  1.2607 +	      done
  1.2608 +	      IFS="$save_ifs"
  1.2609 +	    fi
  1.2610 +
  1.2611 +	    # Create $newlib
  1.2612 +	    if test -f "$output_objdir/$newlib"; then :; else
  1.2613 +	      $show "generating import library for \`$soname'"
  1.2614 +	      save_ifs="$IFS"; IFS='~'
  1.2615 +	      eval cmds=\"$old_archive_from_expsyms_cmds\"
  1.2616 +	      for cmd in $cmds; do
  1.2617 +		IFS="$save_ifs"
  1.2618 +		$show "$cmd"
  1.2619 +		$run eval "$cmd" || exit $?
  1.2620 +	      done
  1.2621 +	      IFS="$save_ifs"
  1.2622 +	    fi
  1.2623 +	    # make sure the library variables are pointing to the new library
  1.2624 +	    dir=$output_objdir
  1.2625 +	    linklib=$newlib
  1.2626 +	  fi # test -n "$old_archive_from_expsyms_cmds"
  1.2627 +
  1.2628 +	  if test "$linkmode" = prog || test "$mode" != relink; then
  1.2629 +	    add_shlibpath=
  1.2630 +	    add_dir=
  1.2631 +	    add=
  1.2632 +	    lib_linked=yes
  1.2633 +	    case $hardcode_action in
  1.2634 +	    immediate | unsupported)
  1.2635 +	      if test "$hardcode_direct" = no; then
  1.2636 +		add="$dir/$linklib"
  1.2637 +		case $host in
  1.2638 +		  *-*-sco3.2v5* ) add_dir="-L$dir" ;;
  1.2639 +		  *-*-darwin* )
  1.2640 +		    # if the lib is a module then we can not link against it, someone
  1.2641 +		    # is ignoring the new warnings I added
  1.2642 +		    if /usr/bin/file -L $add 2> /dev/null | grep "bundle" >/dev/null ; then
  1.2643 +		      $echo "** Warning, lib $linklib is a module, not a shared library"
  1.2644 +		      if test -z "$old_library" ; then
  1.2645 +		        $echo
  1.2646 +		        $echo "** And there doesn't seem to be a static archive available"
  1.2647 +		        $echo "** The link will probably fail, sorry"
  1.2648 +		      else
  1.2649 +		        add="$dir/$old_library"
  1.2650 +		      fi 
  1.2651 +		    fi
  1.2652 +		esac
  1.2653 +	      elif test "$hardcode_minus_L" = no; then
  1.2654 +		case $host in
  1.2655 +		*-*-sunos*) add_shlibpath="$dir" ;;
  1.2656 +		esac
  1.2657 +		add_dir="-L$dir"
  1.2658 +		add="-l$name"
  1.2659 +	      elif test "$hardcode_shlibpath_var" = no; then
  1.2660 +		add_shlibpath="$dir"
  1.2661 +		add="-l$name"
  1.2662 +	      else
  1.2663 +		lib_linked=no
  1.2664 +	      fi
  1.2665 +	      ;;
  1.2666 +	    relink)
  1.2667 +	      if test "$hardcode_direct" = yes; then
  1.2668 +		add="$dir/$linklib"
  1.2669 +	      elif test "$hardcode_minus_L" = yes; then
  1.2670 +		add_dir="-L$dir"
  1.2671 +		# Try looking first in the location we're being installed to.
  1.2672 +		if test -n "$inst_prefix_dir"; then
  1.2673 +		  case "$libdir" in
  1.2674 +		    [\\/]*)
  1.2675 +		      add_dir="-L$inst_prefix_dir$libdir $add_dir"
  1.2676 +		      ;;
  1.2677 +		  esac
  1.2678 +		fi
  1.2679 +		add="-l$name"
  1.2680 +	      elif test "$hardcode_shlibpath_var" = yes; then
  1.2681 +		add_shlibpath="$dir"
  1.2682 +		add="-l$name"
  1.2683 +	      else
  1.2684 +		lib_linked=no
  1.2685 +	      fi
  1.2686 +	      ;;
  1.2687 +	    *) lib_linked=no ;;
  1.2688 +	    esac
  1.2689 +
  1.2690 +	    if test "$lib_linked" != yes; then
  1.2691 +	      $echo "$modename: configuration error: unsupported hardcode properties"
  1.2692 +	      exit 1
  1.2693 +	    fi
  1.2694 +
  1.2695 +	    if test -n "$add_shlibpath"; then
  1.2696 +	      case :$compile_shlibpath: in
  1.2697 +	      *":$add_shlibpath:"*) ;;
  1.2698 +	      *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;;
  1.2699  	      esac
  1.2700 -	      case "$compile_command " in
  1.2701 -	      *" -L$dir "*) ;;
  1.2702 -	      *) compile_command="$compile_command -L$dir";;
  1.2703 +	    fi
  1.2704 +	    if test "$linkmode" = prog; then
  1.2705 +	      test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs"
  1.2706 +	      test -n "$add" && compile_deplibs="$add $compile_deplibs"
  1.2707 +	    else
  1.2708 +	      test -n "$add_dir" && deplibs="$add_dir $deplibs"
  1.2709 +	      test -n "$add" && deplibs="$add $deplibs"
  1.2710 +	      if test "$hardcode_direct" != yes && \
  1.2711 +		 test "$hardcode_minus_L" != yes && \
  1.2712 +		 test "$hardcode_shlibpath_var" = yes; then
  1.2713 +		case :$finalize_shlibpath: in
  1.2714 +		*":$libdir:"*) ;;
  1.2715 +		*) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
  1.2716 +		esac
  1.2717 +	      fi
  1.2718 +	    fi
  1.2719 +	  fi
  1.2720 +
  1.2721 +	  if test "$linkmode" = prog || test "$mode" = relink; then
  1.2722 +	    add_shlibpath=
  1.2723 +	    add_dir=
  1.2724 +	    add=
  1.2725 +	    # Finalize command for both is simple: just hardcode it.
  1.2726 +	    if test "$hardcode_direct" = yes; then
  1.2727 +	      add="$libdir/$linklib"
  1.2728 +	    elif test "$hardcode_minus_L" = yes; then
  1.2729 +	      add_dir="-L$libdir"
  1.2730 +	      add="-l$name"
  1.2731 +	    elif test "$hardcode_shlibpath_var" = yes; then
  1.2732 +	      case :$finalize_shlibpath: in
  1.2733 +	      *":$libdir:"*) ;;
  1.2734 +	      *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
  1.2735  	      esac
  1.2736 -	      compile_command="$compile_command -l$name"
  1.2737 -	      deplibs="$deplibs -L$dir -l$name"
  1.2738 -	    elif test "$hardcode_shlibpath_var" = no; then
  1.2739 -	      case ":$compile_shlibpath:" in
  1.2740 -	      *":$dir:"*) ;;
  1.2741 -	      *) compile_shlibpath="$compile_shlibpath$dir:";;
  1.2742 -	      esac
  1.2743 -	      compile_command="$compile_command -l$name"
  1.2744 -	      deplibs="$deplibs -l$name"
  1.2745 +	      add="-l$name"
  1.2746 +	    elif test "$hardcode_automatic" = yes; then
  1.2747 +	      if test -n "$inst_prefix_dir" && test -f "$inst_prefix_dir$libdir/$linklib" ; then
  1.2748 +	        add="$inst_prefix_dir$libdir/$linklib"
  1.2749 +	      else
  1.2750 +	        add="$libdir/$linklib"
  1.2751 +	      fi
  1.2752  	    else
  1.2753 -	      lib_linked=no
  1.2754 +	      # We cannot seem to hardcode it, guess we'll fake it.
  1.2755 +	      add_dir="-L$libdir"
  1.2756 +	      # Try looking first in the location we're being installed to.
  1.2757 +	      if test -n "$inst_prefix_dir"; then
  1.2758 +		case "$libdir" in
  1.2759 +		  [\\/]*)
  1.2760 +		    add_dir="-L$inst_prefix_dir$libdir $add_dir"
  1.2761 +		    ;;
  1.2762 +		esac
  1.2763 +	      fi
  1.2764 +	      add="-l$name"
  1.2765  	    fi
  1.2766 -	    ;;
  1.2767 -
  1.2768 -	  relink)
  1.2769 -	    if test "$hardcode_direct" = yes; then
  1.2770 -	      compile_command="$compile_command $absdir/$linklib"
  1.2771 -	      deplibs="$deplibs $absdir/$linklib"
  1.2772 -	    elif test "$hardcode_minus_L" = yes; then
  1.2773 -	      case "$compile_command " in
  1.2774 -	      *" -L$absdir "*) ;;
  1.2775 -	      *) compile_command="$compile_command -L$absdir";;
  1.2776 -	      esac
  1.2777 -	      compile_command="$compile_command -l$name"
  1.2778 -	      deplibs="$deplibs -L$absdir -l$name"
  1.2779 -	    elif test "$hardcode_shlibpath_var" = yes; then
  1.2780 -	      case ":$compile_shlibpath:" in
  1.2781 -	      *":$absdir:"*) ;;
  1.2782 -	      *) compile_shlibpath="$compile_shlibpath$absdir:";;
  1.2783 -	      esac
  1.2784 -	      compile_command="$compile_command -l$name"
  1.2785 -	      deplibs="$deplibs -l$name"
  1.2786 +
  1.2787 +	    if test "$linkmode" = prog; then
  1.2788 +	      test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs"
  1.2789 +	      test -n "$add" && finalize_deplibs="$add $finalize_deplibs"
  1.2790  	    else
  1.2791 -	      lib_linked=no
  1.2792 +	      test -n "$add_dir" && deplibs="$add_dir $deplibs"
  1.2793 +	      test -n "$add" && deplibs="$add $deplibs"
  1.2794  	    fi
  1.2795 -	    ;;
  1.2796 -
  1.2797 -	  *)
  1.2798 -	    lib_linked=no
  1.2799 -	    ;;
  1.2800 -	  esac
  1.2801 -
  1.2802 -	  if test "$lib_linked" != yes; then
  1.2803 -	    $echo "$modename: configuration error: unsupported hardcode properties"
  1.2804 -	    exit 1
  1.2805  	  fi
  1.2806 -
  1.2807 -	  # Finalize command for both is simple: just hardcode it.
  1.2808 -	  if test "$hardcode_direct" = yes; then
  1.2809 -	    finalize_command="$finalize_command $libdir/$linklib"
  1.2810 -	  elif test "$hardcode_minus_L" = yes; then
  1.2811 -	    case "$finalize_command " in
  1.2812 -	    *" -L$libdir "*) ;;
  1.2813 -	    *) finalize_command="$finalize_command -L$libdir";;
  1.2814 -	    esac
  1.2815 -	    finalize_command="$finalize_command -l$name"
  1.2816 -	  elif test "$hardcode_shlibpath_var" = yes; then
  1.2817 -	    case ":$finalize_shlibpath:" in
  1.2818 -	    *":$libdir:"*) ;;
  1.2819 -	    *) finalize_shlibpath="$finalize_shlibpath$libdir:";;
  1.2820 -	    esac
  1.2821 -	    finalize_command="$finalize_command -l$name"
  1.2822 -	  else
  1.2823 -	    # We cannot seem to hardcode it, guess we'll fake it.
  1.2824 -	    case "$finalize_command " in
  1.2825 -	    *" -L$dir "*) ;;
  1.2826 -	    *) finalize_command="$finalize_command -L$libdir";;
  1.2827 -	    esac
  1.2828 -	    finalize_command="$finalize_command -l$name"
  1.2829 -	  fi
  1.2830 -	else
  1.2831 -	  # Transform directly to old archives if we don't build new libraries.
  1.2832 -	  if test -n "$pic_flag" && test -z "$old_library"; then
  1.2833 -	    $echo "$modename: cannot find static library for \`$arg'" 1>&2
  1.2834 -	    exit 1
  1.2835 -	  fi
  1.2836 -
  1.2837 +	elif test "$linkmode" = prog; then
  1.2838  	  # Here we assume that one of hardcode_direct or hardcode_minus_L
  1.2839  	  # is not unsupported.  This is valid on all known static and
  1.2840  	  # shared platforms.
  1.2841  	  if test "$hardcode_direct" != unsupported; then
  1.2842  	    test -n "$old_library" && linklib="$old_library"
  1.2843 -	    compile_command="$compile_command $dir/$linklib"
  1.2844 -	    finalize_command="$finalize_command $dir/$linklib"
  1.2845 +	    compile_deplibs="$dir/$linklib $compile_deplibs"
  1.2846 +	    finalize_deplibs="$dir/$linklib $finalize_deplibs"
  1.2847  	  else
  1.2848 -	    case "$compile_command " in
  1.2849 -	    *" -L$dir "*) ;;
  1.2850 -	    *) compile_command="$compile_command -L$dir";;
  1.2851 +	    compile_deplibs="-l$name -L$dir $compile_deplibs"
  1.2852 +	    finalize_deplibs="-l$name -L$dir $finalize_deplibs"
  1.2853 +	  fi
  1.2854 +	elif test "$build_libtool_libs" = yes; then
  1.2855 +	  # Not a shared library
  1.2856 +	  if test "$deplibs_check_method" != pass_all; then
  1.2857 +	    # We're trying link a shared library against a static one
  1.2858 +	    # but the system doesn't support it.
  1.2859 +
  1.2860 +	    # Just print a warning and add the library to dependency_libs so
  1.2861 +	    # that the program can be linked against the static library.
  1.2862 +	    $echo
  1.2863 +	    $echo "*** Warning: This system can not link to static lib archive $lib."
  1.2864 +	    $echo "*** I have the capability to make that library automatically link in when"
  1.2865 +	    $echo "*** you link to this library.  But I can only do this if you have a"
  1.2866 +	    $echo "*** shared version of the library, which you do not appear to have."
  1.2867 +	    if test "$module" = yes; then
  1.2868 +	      $echo "*** But as you try to build a module library, libtool will still create "
  1.2869 +	      $echo "*** a static module, that should work as long as the dlopening application"
  1.2870 +	      $echo "*** is linked with the -dlopen flag to resolve symbols at runtime."
  1.2871 +	      if test -z "$global_symbol_pipe"; then
  1.2872 +		$echo
  1.2873 +		$echo "*** However, this would only work if libtool was able to extract symbol"
  1.2874 +		$echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
  1.2875 +		$echo "*** not find such a program.  So, this module is probably useless."
  1.2876 +		$echo "*** \`nm' from GNU binutils and a full rebuild may help."
  1.2877 +	      fi
  1.2878 +	      if test "$build_old_libs" = no; then
  1.2879 +		build_libtool_libs=module
  1.2880 +		build_old_libs=yes
  1.2881 +	      else
  1.2882 +		build_libtool_libs=no
  1.2883 +	      fi
  1.2884 +	    fi
  1.2885 +	  else
  1.2886 +	    convenience="$convenience $dir/$old_library"
  1.2887 +	    old_convenience="$old_convenience $dir/$old_library"
  1.2888 +	    deplibs="$dir/$old_library $deplibs"
  1.2889 +	    link_static=yes
  1.2890 +	  fi
  1.2891 +	fi # link shared/static library?
  1.2892 +
  1.2893 +	if test "$linkmode" = lib; then
  1.2894 +	  if test -n "$dependency_libs" &&
  1.2895 +	     { test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes ||
  1.2896 +	       test "$link_static" = yes; }; then
  1.2897 +	    # Extract -R from dependency_libs
  1.2898 +	    temp_deplibs=
  1.2899 +	    for libdir in $dependency_libs; do
  1.2900 +	      case $libdir in
  1.2901 +	      -R*) temp_xrpath=`$echo "X$libdir" | $Xsed -e 's/^-R//'`
  1.2902 +		   case " $xrpath " in
  1.2903 +		   *" $temp_xrpath "*) ;;
  1.2904 +		   *) xrpath="$xrpath $temp_xrpath";;
  1.2905 +		   esac;;
  1.2906 +	      *) temp_deplibs="$temp_deplibs $libdir";;
  1.2907 +	      esac
  1.2908 +	    done
  1.2909 +	    dependency_libs="$temp_deplibs"
  1.2910 +	  fi
  1.2911 +
  1.2912 +	  newlib_search_path="$newlib_search_path $absdir"
  1.2913 +	  # Link against this library
  1.2914 +	  test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs"
  1.2915 +	  # ... and its dependency_libs
  1.2916 +	  tmp_libs=
  1.2917 +	  for deplib in $dependency_libs; do
  1.2918 +	    newdependency_libs="$deplib $newdependency_libs"
  1.2919 +	    if test "X$duplicate_deps" = "Xyes" ; then
  1.2920 +	      case "$tmp_libs " in
  1.2921 +	      *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
  1.2922 +	      esac
  1.2923 +	    fi
  1.2924 +	    tmp_libs="$tmp_libs $deplib"
  1.2925 +	  done
  1.2926 +
  1.2927 +	  if test "$link_all_deplibs" != no; then
  1.2928 +	    # Add the search paths of all dependency libraries
  1.2929 +	    for deplib in $dependency_libs; do
  1.2930 +	      case $deplib in
  1.2931 +	      -L*) path="$deplib" ;;
  1.2932 +	      *.la)
  1.2933 +		dir=`$echo "X$deplib" | $Xsed -e 's%/[^/]*$%%'`
  1.2934 +		test "X$dir" = "X$deplib" && dir="."
  1.2935 +		# We need an absolute path.
  1.2936 +		case $dir in
  1.2937 +		[\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;;
  1.2938 +		*)
  1.2939 +		  absdir=`cd "$dir" && pwd`
  1.2940 +		  if test -z "$absdir"; then
  1.2941 +		    $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2
  1.2942 +		    absdir="$dir"
  1.2943 +		  fi
  1.2944 +		  ;;
  1.2945 +		esac
  1.2946 +		if grep "^installed=no" $deplib > /dev/null; then
  1.2947 +		  path="$absdir/$objdir"
  1.2948 +		else
  1.2949 +		  eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
  1.2950 +		  if test -z "$libdir"; then
  1.2951 +		    $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
  1.2952 +		    exit 1
  1.2953 +		  fi
  1.2954 +		  if test "$absdir" != "$libdir"; then
  1.2955 +		    $echo "$modename: warning: \`$deplib' seems to be moved" 1>&2
  1.2956 +		  fi
  1.2957 +		  path="$absdir"
  1.2958 +		fi
  1.2959 +		depdepl=
  1.2960 +		case $host in
  1.2961 +		*-*-darwin*)
  1.2962 +		  # we do not want to link against static libs, but need to link against shared
  1.2963 +		  eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib`
  1.2964 +		  if test -n "$deplibrary_names" ; then
  1.2965 +		    for tmp in $deplibrary_names ; do
  1.2966 +		      depdepl=$tmp
  1.2967 +		    done
  1.2968 +		    if test -f "$path/$depdepl" ; then
  1.2969 +		      depdepl="$path/$depdepl"
  1.2970 +		   fi
  1.2971 +		    newlib_search_path="$newlib_search_path $path"
  1.2972 +		    path=""
  1.2973 +		  fi
  1.2974 +		  ;;
  1.2975 +		*)
  1.2976 +		path="-L$path"
  1.2977 +		;;
  1.2978 +		esac 
  1.2979 +		
  1.2980 +		;;
  1.2981 +		  -l*)
  1.2982 +		case $host in
  1.2983 +		*-*-darwin*)
  1.2984 +		 # Again, we only want to link against shared libraries
  1.2985 +		 eval tmp_libs=`$echo "X$deplib" | $Xsed -e "s,^\-l,,"`
  1.2986 +		 for tmp in $newlib_search_path ; do
  1.2987 +		     if test -f "$tmp/lib$tmp_libs.dylib" ; then
  1.2988 +		       eval depdepl="$tmp/lib$tmp_libs.dylib"
  1.2989 +		       break
  1.2990 +		     fi  
  1.2991 +         done
  1.2992 +         path=""
  1.2993 +		  ;;
  1.2994 +		*) continue ;;
  1.2995 +		esac  		  
  1.2996 +		;;
  1.2997 +	      *) continue ;;
  1.2998 +	      esac
  1.2999 +	      case " $deplibs " in
  1.3000 +	      *" $depdepl "*) ;;
  1.3001 +	      *) deplibs="$deplibs $depdepl" ;;
  1.3002 +	      esac	      
  1.3003 +	      case " $deplibs " in
  1.3004 +	      *" $path "*) ;;
  1.3005 +	      *) deplibs="$deplibs $path" ;;
  1.3006 +	      esac
  1.3007 +	    done
  1.3008 +	  fi # link_all_deplibs != no
  1.3009 +	fi # linkmode = lib
  1.3010 +      done # for deplib in $libs
  1.3011 +      dependency_libs="$newdependency_libs"
  1.3012 +      if test "$pass" = dlpreopen; then
  1.3013 +	# Link the dlpreopened libraries before other libraries
  1.3014 +	for deplib in $save_deplibs; do
  1.3015 +	  deplibs="$deplib $deplibs"
  1.3016 +	done
  1.3017 +      fi
  1.3018 +      if test "$pass" != dlopen; then
  1.3019 +	if test "$pass" != conv; then
  1.3020 +	  # Make sure lib_search_path contains only unique directories.
  1.3021 +	  lib_search_path=
  1.3022 +	  for dir in $newlib_search_path; do
  1.3023 +	    case "$lib_search_path " in
  1.3024 +	    *" $dir "*) ;;
  1.3025 +	    *) lib_search_path="$lib_search_path $dir" ;;
  1.3026  	    esac
  1.3027 -	    compile_command="$compile_command -l$name"
  1.3028 -	    case "$finalize_command " in
  1.3029 -	    *" -L$dir "*) ;;
  1.3030 -	    *) finalize_command="$finalize_command -L$dir";;
  1.3031 +	  done
  1.3032 +	  newlib_search_path=
  1.3033 +	fi
  1.3034 +
  1.3035 +	if test "$linkmode,$pass" != "prog,link"; then
  1.3036 +	  vars="deplibs"
  1.3037 +	else
  1.3038 +	  vars="compile_deplibs finalize_deplibs"
  1.3039 +	fi
  1.3040 +	for var in $vars dependency_libs; do
  1.3041 +	  # Add libraries to $var in reverse order
  1.3042 +	  eval tmp_libs=\"\$$var\"
  1.3043 +	  new_libs=
  1.3044 +	  for deplib in $tmp_libs; do
  1.3045 +	    # FIXME: Pedantically, this is the right thing to do, so
  1.3046 +	    #        that some nasty dependency loop isn't accidentally
  1.3047 +	    #        broken:
  1.3048 +	    #new_libs="$deplib $new_libs"
  1.3049 +	    # Pragmatically, this seems to cause very few problems in
  1.3050 +	    # practice:
  1.3051 +	    case $deplib in
  1.3052 +	    -L*) new_libs="$deplib $new_libs" ;;
  1.3053 +	    -R*) ;;
  1.3054 +	    *)
  1.3055 +	      # And here is the reason: when a library appears more
  1.3056 +	      # than once as an explicit dependence of a library, or
  1.3057 +	      # is implicitly linked in more than once by the
  1.3058 +	      # compiler, it is considered special, and multiple
  1.3059 +	      # occurrences thereof are not removed.  Compare this
  1.3060 +	      # with having the same library being listed as a
  1.3061 +	      # dependency of multiple other libraries: in this case,
  1.3062 +	      # we know (pedantically, we assume) the library does not
  1.3063 +	      # need to be listed more than once, so we keep only the
  1.3064 +	      # last copy.  This is not always right, but it is rare
  1.3065 +	      # enough that we require users that really mean to play
  1.3066 +	      # such unportable linking tricks to link the library
  1.3067 +	      # using -Wl,-lname, so that libtool does not consider it
  1.3068 +	      # for duplicate removal.
  1.3069 +	      case " $specialdeplibs " in
  1.3070 +	      *" $deplib "*) new_libs="$deplib $new_libs" ;;
  1.3071 +	      *)
  1.3072 +		case " $new_libs " in
  1.3073 +		*" $deplib "*) ;;
  1.3074 +		*) new_libs="$deplib $new_libs" ;;
  1.3075 +		esac
  1.3076 +		;;
  1.3077 +	      esac
  1.3078 +	      ;;
  1.3079  	    esac
  1.3080 -	    finalize_command="$finalize_command -l$name"
  1.3081 -	  fi
  1.3082 -	fi
  1.3083 -
  1.3084 -	# Add in any libraries that this one depends upon.
  1.3085 -	compile_command="$compile_command$dependency_libs"
  1.3086 -	finalize_command="$finalize_command$dependency_libs"
  1.3087 -	continue
  1.3088 -	;;
  1.3089 -
  1.3090 -      # Some other compiler argument.
  1.3091 -      *)
  1.3092 -	# Unknown arguments in both finalize_command and compile_command need
  1.3093 -	# to be aesthetically quoted because they are evaled later.
  1.3094 -	arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
  1.3095 -	case "$arg" in
  1.3096 -	*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*)
  1.3097 -	  arg="\"$arg\""
  1.3098 +	  done
  1.3099 +	  tmp_libs=
  1.3100 +	  for deplib in $new_libs; do
  1.3101 +	    case $deplib in
  1.3102 +	    -L*)
  1.3103 +	      case " $tmp_libs " in
  1.3104 +	      *" $deplib "*) ;;
  1.3105 +	      *) tmp_libs="$tmp_libs $deplib" ;;
  1.3106 +	      esac
  1.3107 +	      ;;
  1.3108 +	    *) tmp_libs="$tmp_libs $deplib" ;;
  1.3109 +	    esac
  1.3110 +	  done
  1.3111 +	  eval $var=\"$tmp_libs\"
  1.3112 +	done # for var
  1.3113 +      fi
  1.3114 +      # Last step: remove runtime libs from dependency_libs (they stay in deplibs)
  1.3115 +      tmp_libs=
  1.3116 +      for i in $dependency_libs ; do
  1.3117 +	case " $predeps $postdeps $compiler_lib_search_path " in
  1.3118 +	*" $i "*)
  1.3119 +	  i=""
  1.3120  	  ;;
  1.3121  	esac
  1.3122 -	;;
  1.3123 -      esac
  1.3124 -
  1.3125 -      # Now actually substitute the argument into the commands.
  1.3126 -      if test -n "$arg"; then
  1.3127 -	compile_command="$compile_command $arg"
  1.3128 -	finalize_command="$finalize_command $arg"
  1.3129 -      fi
  1.3130 -    done
  1.3131 -
  1.3132 -    if test -n "$prev"; then
  1.3133 -      $echo "$modename: the \`$prevarg' option requires an argument" 1>&2
  1.3134 -      $echo "$help" 1>&2
  1.3135 -      exit 1
  1.3136 +	if test -n "$i" ; then
  1.3137 +	  tmp_libs="$tmp_libs $i"
  1.3138 +	fi
  1.3139 +      done
  1.3140 +      dependency_libs=$tmp_libs
  1.3141 +    done # for pass
  1.3142 +    if test "$linkmode" = prog; then
  1.3143 +      dlfiles="$newdlfiles"
  1.3144 +      dlprefiles="$newdlprefiles"
  1.3145      fi
  1.3146  
  1.3147 -    if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then
  1.3148 -      eval arg=\"$export_dynamic_flag_spec\"
  1.3149 -      compile_command="$compile_command $arg"
  1.3150 -      finalize_command="$finalize_command $arg"
  1.3151 -    fi
  1.3152 -
  1.3153 -    oldlibs=
  1.3154 -    # calculate the name of the file, without its directory
  1.3155 -    outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'`
  1.3156 -    libobjs_save="$libobjs"
  1.3157 -
  1.3158 -    case "$output" in
  1.3159 -    "")
  1.3160 -      $echo "$modename: you must specify an output file" 1>&2
  1.3161 -      $echo "$help" 1>&2
  1.3162 -      exit 1
  1.3163 -      ;;
  1.3164 -
  1.3165 -    *.a | *.lib)
  1.3166 -      if test -n "$link_against_libtool_libs"; then
  1.3167 -	$echo "$modename: error: cannot link libtool libraries into archives" 1>&2
  1.3168 -	exit 1
  1.3169 -      fi
  1.3170 -
  1.3171 +    case $linkmode in
  1.3172 +    oldlib)
  1.3173        if test -n "$deplibs"; then
  1.3174  	$echo "$modename: warning: \`-l' and \`-L' are ignored for archives" 1>&2
  1.3175        fi
  1.3176 @@ -1578,7 +2727,7 @@
  1.3177        fi
  1.3178  
  1.3179        if test -n "$vinfo"; then
  1.3180 -	$echo "$modename: warning: \`-version-info' is ignored for archives" 1>&2
  1.3181 +	$echo "$modename: warning: \`-version-info/-version-number' is ignored for archives" 1>&2
  1.3182        fi
  1.3183  
  1.3184        if test -n "$release"; then
  1.3185 @@ -1592,13 +2741,15 @@
  1.3186        # Now set the variables for building old libraries.
  1.3187        build_libtool_libs=no
  1.3188        oldlibs="$output"
  1.3189 +      objs="$objs$old_deplibs"
  1.3190        ;;
  1.3191  
  1.3192 -    *.la)
  1.3193 +    lib)
  1.3194        # Make sure we only generate libraries of the form `libNAME.la'.
  1.3195 -      case "$outputname" in
  1.3196 +      case $outputname in
  1.3197        lib*)
  1.3198  	name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
  1.3199 +	eval shared_ext=\"$shrext\"
  1.3200  	eval libname=\"$libname_spec\"
  1.3201  	;;
  1.3202        *)
  1.3203 @@ -1610,6 +2761,7 @@
  1.3204  	if test "$need_lib_prefix" != no; then
  1.3205  	  # Add the "lib" prefix for modules if required
  1.3206  	  name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
  1.3207 +	  eval shared_ext=\"$shrext\"
  1.3208  	  eval libname=\"$libname_spec\"
  1.3209  	else
  1.3210  	  libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
  1.3211 @@ -1617,30 +2769,24 @@
  1.3212  	;;
  1.3213        esac
  1.3214  
  1.3215 -      output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'`
  1.3216 -      if test "X$output_objdir" = "X$output"; then
  1.3217 -	output_objdir="$objdir"
  1.3218 -      else
  1.3219 -	output_objdir="$output_objdir/$objdir"
  1.3220 +      if test -n "$objs"; then
  1.3221 +	if test "$deplibs_check_method" != pass_all; then
  1.3222 +	  $echo "$modename: cannot build libtool library \`$output' from non-libtool objects on this host:$objs" 2>&1
  1.3223 +	  exit 1
  1.3224 +	else
  1.3225 +	  $echo
  1.3226 +	  $echo "*** Warning: Linking the shared library $output against the non-libtool"
  1.3227 +	  $echo "*** objects $objs is not portable!"
  1.3228 +	  libobjs="$libobjs $objs"
  1.3229 +	fi
  1.3230        fi
  1.3231  
  1.3232 -      if test -n "$objs"; then
  1.3233 -	$echo "$modename: cannot build libtool library \`$output' from non-libtool objects:$objs" 2>&1
  1.3234 -	exit 1
  1.3235 +      if test "$dlself" != no; then
  1.3236 +	$echo "$modename: warning: \`-dlopen self' is ignored for libtool libraries" 1>&2
  1.3237        fi
  1.3238  
  1.3239 -      # How the heck are we supposed to write a wrapper for a shared library?
  1.3240 -      if test -n "$link_against_libtool_libs"; then
  1.3241 -	 $echo "$modename: error: cannot link shared libraries into libtool libraries" 1>&2
  1.3242 -	 exit 1
  1.3243 -      fi
  1.3244 -
  1.3245 -      if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
  1.3246 -	$echo "$modename: warning: \`-dlopen' is ignored for libtool libraries" 1>&2
  1.3247 -      fi
  1.3248 -
  1.3249        set dummy $rpath
  1.3250 -      if test $# -gt 2; then
  1.3251 +      if test "$#" -gt 2; then
  1.3252  	$echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2
  1.3253        fi
  1.3254        install_libdir="$2"
  1.3255 @@ -1649,15 +2795,16 @@
  1.3256        if test -z "$rpath"; then
  1.3257  	if test "$build_libtool_libs" = yes; then
  1.3258  	  # Building a libtool convenience library.
  1.3259 -	  libext=al
  1.3260 +	  # Some compilers have problems with a `.al' extension so
  1.3261 +	  # convenience libraries should have the same extension an
  1.3262 +	  # archive normally would.
  1.3263  	  oldlibs="$output_objdir/$libname.$libext $oldlibs"
  1.3264  	  build_libtool_libs=convenience
  1.3265  	  build_old_libs=yes
  1.3266  	fi
  1.3267 -	dependency_libs="$deplibs"
  1.3268  
  1.3269  	if test -n "$vinfo"; then
  1.3270 -	  $echo "$modename: warning: \`-version-info' is ignored for convenience libraries" 1>&2
  1.3271 +	  $echo "$modename: warning: \`-version-info/-version-number' is ignored for convenience libraries" 1>&2
  1.3272  	fi
  1.3273  
  1.3274  	if test -n "$release"; then
  1.3275 @@ -1666,7 +2813,7 @@
  1.3276        else
  1.3277  
  1.3278  	# Parse the version information argument.
  1.3279 -	IFS="${IFS= 	}"; save_ifs="$IFS"; IFS=':'
  1.3280 +	save_ifs="$IFS"; IFS=':'
  1.3281  	set dummy $vinfo 0 0 0
  1.3282  	IFS="$save_ifs"
  1.3283  
  1.3284 @@ -1676,13 +2823,50 @@
  1.3285  	  exit 1
  1.3286  	fi
  1.3287  
  1.3288 -	current="$2"
  1.3289 -	revision="$3"
  1.3290 -	age="$4"
  1.3291 +	# convert absolute version numbers to libtool ages
  1.3292 +	# this retains compatibility with .la files and attempts
  1.3293 +	# to make the code below a bit more comprehensible
  1.3294 +	
  1.3295 +	case $vinfo_number in
  1.3296 +	yes)
  1.3297 +	  number_major="$2"
  1.3298 +	  number_minor="$3"
  1.3299 +	  number_revision="$4"
  1.3300 +	  #
  1.3301 +	  # There are really only two kinds -- those that
  1.3302 +	  # use the current revision as the major version
  1.3303 +	  # and those that subtract age and use age as
  1.3304 +	  # a minor version.  But, then there is irix
  1.3305 +	  # which has an extra 1 added just for fun
  1.3306 +	  #
  1.3307 +	  case $version_type in
  1.3308 +	  darwin|linux|osf|windows)
  1.3309 +	    current=`expr $number_major + $number_minor`
  1.3310 +	    age="$number_minor"
  1.3311 +	    revision="$number_revision"
  1.3312 +	    ;;
  1.3313 +	  freebsd-aout|freebsd-elf|sunos)
  1.3314 +	    current="$number_major"
  1.3315 +	    revision="$number_minor"
  1.3316 +	    age="0"
  1.3317 +	    ;;
  1.3318 +	  irix|nonstopux)
  1.3319 +	    current=`expr $number_major + $number_minor - 1`
  1.3320 +	    age="$number_minor"
  1.3321 +	    revision="$number_minor"
  1.3322 +	    ;;
  1.3323 +	  esac
  1.3324 +	  ;;
  1.3325 +	no)
  1.3326 +	  current="$2"
  1.3327 +	  revision="$3"
  1.3328 +	  age="$4"
  1.3329 +	  ;;
  1.3330 +	esac
  1.3331  
  1.3332  	# Check that each of the things are valid numbers.
  1.3333 -	case "$current" in
  1.3334 -	0 | [1-9] | [1-9][0-9]*) ;;
  1.3335 +	case $current in
  1.3336 +	0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;;
  1.3337  	*)
  1.3338  	  $echo "$modename: CURRENT \`$current' is not a nonnegative integer" 1>&2
  1.3339  	  $echo "$modename: \`$vinfo' is not valid version information" 1>&2
  1.3340 @@ -1690,8 +2874,8 @@
  1.3341  	  ;;
  1.3342  	esac
  1.3343  
  1.3344 -	case "$revision" in
  1.3345 -	0 | [1-9] | [1-9][0-9]*) ;;
  1.3346 +	case $revision in
  1.3347 +	0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;;
  1.3348  	*)
  1.3349  	  $echo "$modename: REVISION \`$revision' is not a nonnegative integer" 1>&2
  1.3350  	  $echo "$modename: \`$vinfo' is not valid version information" 1>&2
  1.3351 @@ -1699,8 +2883,8 @@
  1.3352  	  ;;
  1.3353  	esac
  1.3354  
  1.3355 -	case "$age" in
  1.3356 -	0 | [1-9] | [1-9][0-9]*) ;;
  1.3357 +	case $age in
  1.3358 +	0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;;
  1.3359  	*)
  1.3360  	  $echo "$modename: AGE \`$age' is not a nonnegative integer" 1>&2
  1.3361  	  $echo "$modename: \`$vinfo' is not valid version information" 1>&2
  1.3362 @@ -1708,7 +2892,7 @@
  1.3363  	  ;;
  1.3364  	esac
  1.3365  
  1.3366 -	if test $age -gt $current; then
  1.3367 +	if test "$age" -gt "$current"; then
  1.3368  	  $echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2
  1.3369  	  $echo "$modename: \`$vinfo' is not valid version information" 1>&2
  1.3370  	  exit 1
  1.3371 @@ -1718,67 +2902,9 @@
  1.3372  	major=
  1.3373  	versuffix=
  1.3374  	verstring=
  1.3375 -	case "$version_type" in
  1.3376 +	case $version_type in
  1.3377  	none) ;;
  1.3378  
  1.3379 -	irix)
  1.3380 -	  major=`expr $current - $age + 1`
  1.3381 -	  versuffix="$major.$revision"
  1.3382 -	  verstring="sgi$major.$revision"
  1.3383 -
  1.3384 -	  # Add in all the interfaces that we are compatible with.
  1.3385 -	  loop=$revision
  1.3386 -	  while test $loop != 0; do
  1.3387 -	    iface=`expr $revision - $loop`
  1.3388 -	    loop=`expr $loop - 1`
  1.3389 -	    verstring="sgi$major.$iface:$verstring"
  1.3390 -	  done
  1.3391 -	  ;;
  1.3392 -
  1.3393 -	linux)
  1.3394 -	  major=.`expr $current - $age`
  1.3395 -	  versuffix="$major.$age.$revision"
  1.3396 -	  ;;
  1.3397 -
  1.3398 -	osf)
  1.3399 -	  major=`expr $current - $age`
  1.3400 -	  versuffix=".$current.$age.$revision"
  1.3401 -	  verstring="$current.$age.$revision"
  1.3402 -
  1.3403 -	  # Add in all the interfaces that we are compatible with.
  1.3404 -	  loop=$age
  1.3405 -	  while test $loop != 0; do
  1.3406 -	    iface=`expr $current - $loop`
  1.3407 -	    loop=`expr $loop - 1`
  1.3408 -	    verstring="$verstring:${iface}.0"
  1.3409 -	  done
  1.3410 -
  1.3411 -	  # Make executables depend on our current version.
  1.3412 -	  verstring="$verstring:${current}.0"
  1.3413 -	  ;;
  1.3414 -
  1.3415 -	sunos)
  1.3416 -	  major=".$current"
  1.3417 -	  versuffix=".$current.$revision"
  1.3418 -	  ;;
  1.3419 -
  1.3420 -	freebsd-aout)
  1.3421 -	  major=".$current"
  1.3422 -	  versuffix=".$current.$revision";
  1.3423 -	  ;;
  1.3424 -
  1.3425 -	freebsd-elf)
  1.3426 -	  major=".$current"
  1.3427 -	  versuffix=".$current";
  1.3428 -	  ;;
  1.3429 -
  1.3430 -	windows)
  1.3431 -	  # Like Linux, but with '-' rather than '.', since we only
  1.3432 -	  # want one extension on Windows 95.
  1.3433 -	  major=`expr $current - $age`
  1.3434 -	  versuffix="-$major-$age-$revision"
  1.3435 -	  ;;
  1.3436 -
  1.3437  	darwin)
  1.3438  	  # Like Linux, but with the current version available in
  1.3439  	  # verstring for coding it into the library header
  1.3440 @@ -1789,9 +2915,75 @@
  1.3441  	  verstring="-compatibility_version $minor_current -current_version $minor_current.$revision"
  1.3442  	  ;;
  1.3443  
  1.3444 +	freebsd-aout)
  1.3445 +	  major=".$current"
  1.3446 +	  versuffix=".$current.$revision";
  1.3447 +	  ;;
  1.3448 +
  1.3449 +	freebsd-elf)
  1.3450 +	  major=".$current"
  1.3451 +	  versuffix=".$current";
  1.3452 +	  ;;
  1.3453 +
  1.3454 +	irix | nonstopux)
  1.3455 +	  major=`expr $current - $age + 1`
  1.3456 +
  1.3457 +	  case $version_type in
  1.3458 +	    nonstopux) verstring_prefix=nonstopux ;;
  1.3459 +	    *)         verstring_prefix=sgi ;;
  1.3460 +	  esac
  1.3461 +	  verstring="$verstring_prefix$major.$revision"
  1.3462 +
  1.3463 +	  # Add in all the interfaces that we are compatible with.
  1.3464 +	  loop=$revision
  1.3465 +	  while test "$loop" -ne 0; do
  1.3466 +	    iface=`expr $revision - $loop`
  1.3467 +	    loop=`expr $loop - 1`
  1.3468 +	    verstring="$verstring_prefix$major.$iface:$verstring"
  1.3469 +	  done
  1.3470 +
  1.3471 +	  # Before this point, $major must not contain `.'.
  1.3472 +	  major=.$major
  1.3473 +	  versuffix="$major.$revision"
  1.3474 +	  ;;
  1.3475 +
  1.3476 +	linux)
  1.3477 +	  major=.`expr $current - $age`
  1.3478 +	  versuffix="$major.$age.$revision"
  1.3479 +	  ;;
  1.3480 +
  1.3481 +	osf)
  1.3482 +	  major=.`expr $current - $age`
  1.3483 +	  versuffix=".$current.$age.$revision"
  1.3484 +	  verstring="$current.$age.$revision"
  1.3485 +
  1.3486 +	  # Add in all the interfaces that we are compatible with.
  1.3487 +	  loop=$age
  1.3488 +	  while test "$loop" -ne 0; do
  1.3489 +	    iface=`expr $current - $loop`
  1.3490 +	    loop=`expr $loop - 1`
  1.3491 +	    verstring="$verstring:${iface}.0"
  1.3492 +	  done
  1.3493 +
  1.3494 +	  # Make executables depend on our current version.
  1.3495 +	  verstring="$verstring:${current}.0"
  1.3496 +	  ;;
  1.3497 +
  1.3498 +	sunos)
  1.3499 +	  major=".$current"
  1.3500 +	  versuffix=".$current.$revision"
  1.3501 +	  ;;
  1.3502 +
  1.3503 +	windows)
  1.3504 +	  # Use '-' rather than '.', since we only want one
  1.3505 +	  # extension on DOS 8.3 filesystems.
  1.3506 +	  major=`expr $current - $age`
  1.3507 +	  versuffix="-$major"
  1.3508 +	  ;;
  1.3509 +
  1.3510  	*)
  1.3511  	  $echo "$modename: unknown library version type \`$version_type'" 1>&2
  1.3512 -	  echo "Fatal configuration error.  See the $PACKAGE docs for more information." 1>&2
  1.3513 +	  $echo "Fatal configuration error.  See the $PACKAGE docs for more information." 1>&2
  1.3514  	  exit 1
  1.3515  	  ;;
  1.3516  	esac
  1.3517 @@ -1799,14 +2991,14 @@
  1.3518  	# Clear the version info if we defaulted, and they specified a release.
  1.3519  	if test -z "$vinfo" && test -n "$release"; then
  1.3520  	  major=
  1.3521 -	  case "$version_type" in
  1.3522 +	  case $version_type in
  1.3523  	  darwin)
  1.3524  	    # we can't check for "0.0" in archive_cmds due to quoting
  1.3525  	    # problems, so we reset it completely
  1.3526 -	    verstring=""
  1.3527 +	    verstring=
  1.3528  	    ;;
  1.3529  	  *)
  1.3530 -	  verstring="0.0"
  1.3531 +	    verstring="0.0"
  1.3532  	    ;;
  1.3533  	  esac
  1.3534  	  if test "$need_version" = no; then
  1.3535 @@ -1822,7 +3014,7 @@
  1.3536  	  versuffix=
  1.3537  	  verstring=""
  1.3538  	fi
  1.3539 -	
  1.3540 +
  1.3541  	# Check to see if the archive will have undefined symbols.
  1.3542  	if test "$allow_undefined" = yes; then
  1.3543  	  if test "$allow_undefined_flag" = unsupported; then
  1.3544 @@ -1834,36 +3026,26 @@
  1.3545  	  # Don't allow undefined symbols.
  1.3546  	  allow_undefined_flag="$no_undefined_flag"
  1.3547  	fi
  1.3548 -
  1.3549 -	dependency_libs="$deplibs"
  1.3550 -	case "$host" in
  1.3551 -	*-*-cygwin* | *-*-mingw* | *-*-os2* | *-*-beos* | *-*-freebsd* )
  1.3552 -	  # these systems don't actually have a c library (as such)!
  1.3553 -	  ;;
  1.3554 -        *-*-rhapsody*)
  1.3555 -	  # rhapsody is a little odd...
  1.3556 -	  deplibs="$deplibs -framework System"
  1.3557 -	  ;;
  1.3558 -	*-*-openbsd*)
  1.3559 -	  # do not include libc due to us having libc/libc_r.
  1.3560 -	  ;;
  1.3561 -	*)
  1.3562 -	  # Add libc to deplibs on all other systems.
  1.3563 -	  deplibs="$deplibs -lc"
  1.3564 -	  ;;
  1.3565 -	esac
  1.3566        fi
  1.3567  
  1.3568 -      # Create the output directory, or remove our outputs if we need to.
  1.3569 -      if test -d $output_objdir; then
  1.3570 -	$show "${rm}r $output_objdir/$outputname $output_objdir/$libname.* $output_objdir/${libname}${release}.*"
  1.3571 -	$run ${rm}r $output_objdir/$outputname $output_objdir/$libname.* $output_objdir/${libname}${release}.*
  1.3572 -      else
  1.3573 -	$show "$mkdir $output_objdir"
  1.3574 -	$run $mkdir $output_objdir
  1.3575 -	status=$?
  1.3576 -	if test $status -ne 0 && test ! -d $output_objdir; then
  1.3577 -	  exit $status
  1.3578 +      if test "$mode" != relink; then
  1.3579 +	# Remove our outputs, but don't remove object files since they
  1.3580 +	# may have been created when compiling PIC objects.
  1.3581 +	removelist=
  1.3582 +	tempremovelist=`$echo "$output_objdir/*"`
  1.3583 +	for p in $tempremovelist; do
  1.3584 +	  case $p in
  1.3585 +	    *.$objext)
  1.3586 +	       ;;
  1.3587 +	    $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*)
  1.3588 +	       removelist="$removelist $p"
  1.3589 +	       ;;
  1.3590 +	    *) ;;
  1.3591 +	  esac
  1.3592 +	done
  1.3593 +	if test -n "$removelist"; then
  1.3594 +	  $show "${rm}r $removelist"
  1.3595 +	  $run ${rm}r $removelist
  1.3596  	fi
  1.3597        fi
  1.3598  
  1.3599 @@ -1875,7 +3057,74 @@
  1.3600  	oldobjs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP`
  1.3601        fi
  1.3602  
  1.3603 +      # Eliminate all temporary directories.
  1.3604 +      for path in $notinst_path; do
  1.3605 +	lib_search_path=`$echo "$lib_search_path " | ${SED} -e 's% $path % %g'`
  1.3606 +	deplibs=`$echo "$deplibs " | ${SED} -e 's% -L$path % %g'`
  1.3607 +	dependency_libs=`$echo "$dependency_libs " | ${SED} -e 's% -L$path % %g'`
  1.3608 +      done
  1.3609 +
  1.3610 +      if test -n "$xrpath"; then
  1.3611 +	# If the user specified any rpath flags, then add them.
  1.3612 +	temp_xrpath=
  1.3613 +	for libdir in $xrpath; do
  1.3614 +	  temp_xrpath="$temp_xrpath -R$libdir"
  1.3615 +	  case "$finalize_rpath " in
  1.3616 +	  *" $libdir "*) ;;
  1.3617 +	  *) finalize_rpath="$finalize_rpath $libdir" ;;
  1.3618 +	  esac
  1.3619 +	done
  1.3620 +	if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then
  1.3621 +	  dependency_libs="$temp_xrpath $dependency_libs"
  1.3622 +	fi
  1.3623 +      fi
  1.3624 +
  1.3625 +      # Make sure dlfiles contains only unique files that won't be dlpreopened
  1.3626 +      old_dlfiles="$dlfiles"
  1.3627 +      dlfiles=
  1.3628 +      for lib in $old_dlfiles; do
  1.3629 +	case " $dlprefiles $dlfiles " in
  1.3630 +	*" $lib "*) ;;
  1.3631 +	*) dlfiles="$dlfiles $lib" ;;
  1.3632 +	esac
  1.3633 +      done
  1.3634 +
  1.3635 +      # Make sure dlprefiles contains only unique files
  1.3636 +      old_dlprefiles="$dlprefiles"
  1.3637 +      dlprefiles=
  1.3638 +      for lib in $old_dlprefiles; do
  1.3639 +	case "$dlprefiles " in
  1.3640 +	*" $lib "*) ;;
  1.3641 +	*) dlprefiles="$dlprefiles $lib" ;;
  1.3642 +	esac
  1.3643 +      done
  1.3644 +
  1.3645        if test "$build_libtool_libs" = yes; then
  1.3646 +	if test -n "$rpath"; then
  1.3647 +	  case $host in
  1.3648 +	  *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos*)
  1.3649 +	    # these systems don't actually have a c library (as such)!
  1.3650 +	    ;;
  1.3651 +	  *-*-rhapsody* | *-*-darwin1.[012])
  1.3652 +	    # Rhapsody C library is in the System framework
  1.3653 +	    deplibs="$deplibs -framework System"
  1.3654 +	    ;;
  1.3655 +	  *-*-netbsd*)
  1.3656 +	    # Don't link with libc until the a.out ld.so is fixed.
  1.3657 +	    ;;
  1.3658 +	  *-*-openbsd* | *-*-freebsd*)
  1.3659 +	    # Do not include libc due to us having libc/libc_r.
  1.3660 +	    test "X$arg" = "X-lc" && continue
  1.3661 +	    ;;
  1.3662 + 	  *)
  1.3663 +	    # Add libc to deplibs on all other systems if necessary.
  1.3664 +	    if test "$build_libtool_need_lc" = "yes"; then
  1.3665 +	      deplibs="$deplibs -lc"
  1.3666 +	    fi
  1.3667 +	    ;;
  1.3668 +	  esac
  1.3669 +	fi
  1.3670 +
  1.3671  	# Transform deplibs into only deplibs that can be linked in shared.
  1.3672  	name_save=$name
  1.3673  	libname_save=$libname
  1.3674 @@ -1890,13 +3139,13 @@
  1.3675  	major=""
  1.3676  	newdeplibs=
  1.3677  	droppeddeps=no
  1.3678 -	case "$deplibs_check_method" in
  1.3679 +	case $deplibs_check_method in
  1.3680  	pass_all)
  1.3681  	  # Don't check for shared/static.  Everything works.
  1.3682  	  # This might be a little naive.  We might want to check
  1.3683  	  # whether the library exists or not.  But this is on
  1.3684  	  # osf3 & osf4 and I'm not really sure... Just
  1.3685 -	  # implementing what was already the behaviour.
  1.3686 +	  # implementing what was already the behavior.
  1.3687  	  newdeplibs=$deplibs
  1.3688  	  ;;
  1.3689  	test_compile)
  1.3690 @@ -1909,43 +3158,22 @@
  1.3691  	  int main() { return 0; }
  1.3692  EOF
  1.3693  	  $rm conftest
  1.3694 -	  $CC -o conftest conftest.c $deplibs
  1.3695 -	  if test $? -eq 0 ; then
  1.3696 +	  $LTCC -o conftest conftest.c $deplibs
  1.3697 +	  if test "$?" -eq 0 ; then
  1.3698  	    ldd_output=`ldd conftest`
  1.3699  	    for i in $deplibs; do
  1.3700  	      name="`expr $i : '-l\(.*\)'`"
  1.3701  	      # If $name is empty we are operating on a -L argument.
  1.3702 -	      if test "$name" != "" ; then
  1.3703 -		libname=`eval \\$echo \"$libname_spec\"`
  1.3704 -		deplib_matches=`eval \\$echo \"$library_names_spec\"`
  1.3705 -		set dummy $deplib_matches
  1.3706 -		deplib_match=$2
  1.3707 -		if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
  1.3708 -		  newdeplibs="$newdeplibs $i"
  1.3709 -		else
  1.3710 -		  droppeddeps=yes
  1.3711 -		  echo
  1.3712 -		  echo "*** Warning: This library needs some functionality provided by $i."
  1.3713 -		  echo "*** I have the capability to make that library automatically link in when"
  1.3714 -		  echo "*** you link to this library.  But I can only do this if you have a"
  1.3715 -		  echo "*** shared version of the library, which you do not appear to have."
  1.3716 -		fi
  1.3717 -	      else
  1.3718 -		newdeplibs="$newdeplibs $i"
  1.3719 -	      fi
  1.3720 -	    done
  1.3721 -	  else
  1.3722 -	    # Error occured in the first compile.  Let's try to salvage the situation:
  1.3723 -	    # Compile a seperate program for each library.
  1.3724 -	    for i in $deplibs; do
  1.3725 -	      name="`expr $i : '-l\(.*\)'`"
  1.3726 -	     # If $name is empty we are operating on a -L argument.
  1.3727 -	      if test "$name" != "" ; then
  1.3728 -		$rm conftest
  1.3729 -		$CC -o conftest conftest.c $i
  1.3730 -		# Did it work?
  1.3731 -		if test $? -eq 0 ; then
  1.3732 -		  ldd_output=`ldd conftest`
  1.3733 +              if test "$name" != "" && test "$name" -ne "0"; then
  1.3734 +		if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
  1.3735 +		  case " $predeps $postdeps " in
  1.3736 +		  *" $i "*)
  1.3737 +		    newdeplibs="$newdeplibs $i"
  1.3738 +		    i=""
  1.3739 +		    ;;
  1.3740 +		  esac
  1.3741 +	        fi
  1.3742 +		if test -n "$i" ; then
  1.3743  		  libname=`eval \\$echo \"$libname_spec\"`
  1.3744  		  deplib_matches=`eval \\$echo \"$library_names_spec\"`
  1.3745  		  set dummy $deplib_matches
  1.3746 @@ -1954,19 +3182,64 @@
  1.3747  		    newdeplibs="$newdeplibs $i"
  1.3748  		  else
  1.3749  		    droppeddeps=yes
  1.3750 -		    echo
  1.3751 -		    echo "*** Warning: This library needs some functionality provided by $i."
  1.3752 -		    echo "*** I have the capability to make that library automatically link in when"
  1.3753 -		    echo "*** you link to this library.  But I can only do this if you have a"
  1.3754 -		    echo "*** shared version of the library, which you do not appear to have."
  1.3755 +		    $echo
  1.3756 +		    $echo "*** Warning: dynamic linker does not accept needed library $i."
  1.3757 +		    $echo "*** I have the capability to make that library automatically link in when"
  1.3758 +		    $echo "*** you link to this library.  But I can only do this if you have a"
  1.3759 +		    $echo "*** shared version of the library, which I believe you do not have"
  1.3760 +		    $echo "*** because a test_compile did reveal that the linker did not use it for"
  1.3761 +		    $echo "*** its dynamic dependency list that programs get resolved with at runtime."
  1.3762 +		  fi
  1.3763 +		fi
  1.3764 +	      else
  1.3765 +		newdeplibs="$newdeplibs $i"
  1.3766 +	      fi
  1.3767 +	    done
  1.3768 +	  else
  1.3769 +	    # Error occurred in the first compile.  Let's try to salvage
  1.3770 +	    # the situation: Compile a separate program for each library.
  1.3771 +	    for i in $deplibs; do
  1.3772 +	      name="`expr $i : '-l\(.*\)'`"
  1.3773 +	      # If $name is empty we are operating on a -L argument.
  1.3774 +              if test "$name" != "" && test "$name" != "0"; then
  1.3775 +		$rm conftest
  1.3776 +		$LTCC -o conftest conftest.c $i
  1.3777 +		# Did it work?
  1.3778 +		if test "$?" -eq 0 ; then
  1.3779 +		  ldd_output=`ldd conftest`
  1.3780 +		  if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
  1.3781 +		    case " $predeps $postdeps " in
  1.3782 +		    *" $i "*)
  1.3783 +		      newdeplibs="$newdeplibs $i"
  1.3784 +		      i=""
  1.3785 +		      ;;
  1.3786 +		    esac
  1.3787 +		  fi
  1.3788 +		  if test -n "$i" ; then
  1.3789 +		    libname=`eval \\$echo \"$libname_spec\"`
  1.3790 +		    deplib_matches=`eval \\$echo \"$library_names_spec\"`
  1.3791 +		    set dummy $deplib_matches
  1.3792 +		    deplib_match=$2
  1.3793 +		    if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
  1.3794 +		      newdeplibs="$newdeplibs $i"
  1.3795 +		    else
  1.3796 +		      droppeddeps=yes
  1.3797 +		      $echo
  1.3798 +		      $echo "*** Warning: dynamic linker does not accept needed library $i."
  1.3799 +		      $echo "*** I have the capability to make that library automatically link in when"
  1.3800 +		      $echo "*** you link to this library.  But I can only do this if you have a"
  1.3801 +		      $echo "*** shared version of the library, which you do not appear to have"
  1.3802 +		      $echo "*** because a test_compile did reveal that the linker did not use this one"
  1.3803 +		      $echo "*** as a dynamic dependency that programs can get resolved with at runtime."
  1.3804 +		    fi
  1.3805  		  fi
  1.3806  		else
  1.3807  		  droppeddeps=yes
  1.3808 -		  echo
  1.3809 -		  echo "*** Warning!  Library $i is needed by this library but I was not able to"
  1.3810 -		  echo "***  make it link in!  You will probably need to install it or some"
  1.3811 -		  echo "*** library that it depends on before this library will be fully"
  1.3812 -		  echo "*** functional.  Installing it before continuing would be even better."
  1.3813 +		  $echo
  1.3814 +		  $echo "*** Warning!  Library $i is needed by this library but I was not able to"
  1.3815 +		  $echo "***  make it link in!  You will probably need to install it or some"
  1.3816 +		  $echo "*** library that it depends on before this library will be fully"
  1.3817 +		  $echo "*** functional.  Installing it before continuing would be even better."
  1.3818  		fi
  1.3819  	      else
  1.3820  		newdeplibs="$newdeplibs $i"
  1.3821 @@ -1976,19 +3249,28 @@
  1.3822  	  ;;
  1.3823  	file_magic*)
  1.3824  	  set dummy $deplibs_check_method
  1.3825 -	  file_magic_regex="`expr \"$deplibs_check_method\" : \"$2 \(.*\)\"`"
  1.3826 +	  file_magic_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
  1.3827  	  for a_deplib in $deplibs; do
  1.3828  	    name="`expr $a_deplib : '-l\(.*\)'`"
  1.3829  	    # If $name is empty we are operating on a -L argument.
  1.3830 -	    if test "$name" != "" ; then
  1.3831 -	      libname=`eval \\$echo \"$libname_spec\"`
  1.3832 -	      for i in $lib_search_path; do
  1.3833 -		    potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
  1.3834 -		    for potent_lib in $potential_libs; do
  1.3835 +            if test "$name" != "" && test  "$name" != "0"; then
  1.3836 +	      if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
  1.3837 +		case " $predeps $postdeps " in
  1.3838 +		*" $a_deplib "*)
  1.3839 +		  newdeplibs="$newdeplibs $a_deplib"
  1.3840 +		  a_deplib=""
  1.3841 +		  ;;
  1.3842 +		esac
  1.3843 +	      fi
  1.3844 +	      if test -n "$a_deplib" ; then
  1.3845 +		libname=`eval \\$echo \"$libname_spec\"`
  1.3846 +		for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
  1.3847 +		  potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
  1.3848 +		  for potent_lib in $potential_libs; do
  1.3849  		      # Follow soft links.
  1.3850  		      if ls -lLd "$potent_lib" 2>/dev/null \
  1.3851  			 | grep " -> " >/dev/null; then
  1.3852 -			continue 
  1.3853 +			continue
  1.3854  		      fi
  1.3855  		      # The statement above tries to avoid entering an
  1.3856  		      # endless loop below, in case of cyclic links.
  1.3857 @@ -1997,28 +3279,88 @@
  1.3858  		      # but so what?
  1.3859  		      potlib="$potent_lib"
  1.3860  		      while test -h "$potlib" 2>/dev/null; do
  1.3861 -			potliblink=`ls -ld $potlib | sed 's/.* -> //'`
  1.3862 -			case "$potliblink" in
  1.3863 +			potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'`
  1.3864 +			case $potliblink in
  1.3865  			[\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";;
  1.3866  			*) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";;
  1.3867  			esac
  1.3868  		      done
  1.3869  		      if eval $file_magic_cmd \"\$potlib\" 2>/dev/null \
  1.3870 -			 | sed 10q \
  1.3871 -			 | egrep "$file_magic_regex" > /dev/null; then
  1.3872 +			 | ${SED} 10q \
  1.3873 +			 | $EGREP "$file_magic_regex" > /dev/null; then
  1.3874  			newdeplibs="$newdeplibs $a_deplib"
  1.3875  			a_deplib=""
  1.3876  			break 2
  1.3877  		      fi
  1.3878 -		    done
  1.3879 -	      done
  1.3880 +		  done
  1.3881 +		done
  1.3882 +	      fi
  1.3883  	      if test -n "$a_deplib" ; then
  1.3884  		droppeddeps=yes
  1.3885 -		echo
  1.3886 -		echo "*** Warning: This library needs some functionality provided by $a_deplib."
  1.3887 -		echo "*** I have the capability to make that library automatically link in when"
  1.3888 -		echo "*** you link to this library.  But I can only do this if you have a"
  1.3889 -		echo "*** shared version of the library, which you do not appear to have."
  1.3890 +		$echo
  1.3891 +		$echo "*** Warning: linker path does not have real file for library $a_deplib."
  1.3892 +		$echo "*** I have the capability to make that library automatically link in when"
  1.3893 +		$echo "*** you link to this library.  But I can only do this if you have a"
  1.3894 +		$echo "*** shared version of the library, which you do not appear to have"
  1.3895 +		$echo "*** because I did check the linker path looking for a file starting"
  1.3896 +		if test -z "$potlib" ; then
  1.3897 +		  $echo "*** with $libname but no candidates were found. (...for file magic test)"
  1.3898 +		else
  1.3899 +		  $echo "*** with $libname and none of the candidates passed a file format test"
  1.3900 +		  $echo "*** using a file magic. Last file checked: $potlib"
  1.3901 +		fi
  1.3902 +	      fi
  1.3903 +	    else
  1.3904 +	      # Add a -L argument.
  1.3905 +	      newdeplibs="$newdeplibs $a_deplib"
  1.3906 +	    fi
  1.3907 +	  done # Gone through all deplibs.
  1.3908 +	  ;;
  1.3909 +	match_pattern*)
  1.3910 +	  set dummy $deplibs_check_method
  1.3911 +	  match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
  1.3912 +	  for a_deplib in $deplibs; do
  1.3913 +	    name="`expr $a_deplib : '-l\(.*\)'`"
  1.3914 +	    # If $name is empty we are operating on a -L argument.
  1.3915 +	    if test -n "$name" && test "$name" != "0"; then
  1.3916 +	      if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
  1.3917 +		case " $predeps $postdeps " in
  1.3918 +		*" $a_deplib "*)
  1.3919 +		  newdeplibs="$newdeplibs $a_deplib"
  1.3920 +		  a_deplib=""
  1.3921 +		  ;;
  1.3922 +		esac
  1.3923 +	      fi
  1.3924 +	      if test -n "$a_deplib" ; then
  1.3925 +		libname=`eval \\$echo \"$libname_spec\"`
  1.3926 +		for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
  1.3927 +		  potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
  1.3928 +		  for potent_lib in $potential_libs; do
  1.3929 +		    potlib="$potent_lib" # see symlink-check above in file_magic test
  1.3930 +		    if eval $echo \"$potent_lib\" 2>/dev/null \
  1.3931 +		        | ${SED} 10q \
  1.3932 +		        | $EGREP "$match_pattern_regex" > /dev/null; then
  1.3933 +		      newdeplibs="$newdeplibs $a_deplib"
  1.3934 +		      a_deplib=""
  1.3935 +		      break 2
  1.3936 +		    fi
  1.3937 +		  done
  1.3938 +		done
  1.3939 +	      fi
  1.3940 +	      if test -n "$a_deplib" ; then
  1.3941 +		droppeddeps=yes
  1.3942 +		$echo
  1.3943 +		$echo "*** Warning: linker path does not have real file for library $a_deplib."
  1.3944 +		$echo "*** I have the capability to make that library automatically link in when"
  1.3945 +		$echo "*** you link to this library.  But I can only do this if you have a"
  1.3946 +		$echo "*** shared version of the library, which you do not appear to have"
  1.3947 +		$echo "*** because I did check the linker path looking for a file starting"
  1.3948 +		if test -z "$potlib" ; then
  1.3949 +		  $echo "*** with $libname but no candidates were found. (...for regex pattern test)"
  1.3950 +		else
  1.3951 +		  $echo "*** with $libname and none of the candidates passed a file format test"
  1.3952 +		  $echo "*** using a regex pattern. Last file checked: $potlib"
  1.3953 +		fi
  1.3954  	      fi
  1.3955  	    else
  1.3956  	      # Add a -L argument.
  1.3957 @@ -2028,16 +3370,23 @@
  1.3958  	  ;;
  1.3959  	none | unknown | *)
  1.3960  	  newdeplibs=""
  1.3961 -	  if $echo "X $deplibs" | $Xsed -e 's/ -lc$//' \
  1.3962 -	       -e 's/ -[LR][^ ]*//g' -e 's/[ 	]//g' |
  1.3963 -	     grep . >/dev/null; then
  1.3964 -	    echo
  1.3965 +	  tmp_deplibs=`$echo "X $deplibs" | $Xsed -e 's/ -lc$//' \
  1.3966 +	    -e 's/ -[LR][^ ]*//g'`
  1.3967 +	  if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
  1.3968 +	    for i in $predeps $postdeps ; do
  1.3969 +	      # can't use Xsed below, because $i might contain '/'
  1.3970 +	      tmp_deplibs=`$echo "X $tmp_deplibs" | ${SED} -e "1s,^X,," -e "s,$i,,"`
  1.3971 +	    done
  1.3972 +	  fi
  1.3973 +	  if $echo "X $tmp_deplibs" | $Xsed -e 's/[ 	]//g' \
  1.3974 +	    | grep . >/dev/null; then
  1.3975 +	    $echo
  1.3976  	    if test "X$deplibs_check_method" = "Xnone"; then
  1.3977 -	      echo "*** Warning: inter-library dependencies are not supported in this platform."
  1.3978 +	      $echo "*** Warning: inter-library dependencies are not supported in this platform."
  1.3979  	    else
  1.3980 -	      echo "*** Warning: inter-library dependencies are not known to be supported."
  1.3981 +	      $echo "*** Warning: inter-library dependencies are not known to be supported."
  1.3982  	    fi
  1.3983 -	    echo "*** All declared inter-library dependencies are being dropped."
  1.3984 +	    $echo "*** All declared inter-library dependencies are being dropped."
  1.3985  	    droppeddeps=yes
  1.3986  	  fi
  1.3987  	  ;;
  1.3988 @@ -2048,19 +3397,26 @@
  1.3989  	libname=$libname_save
  1.3990  	name=$name_save
  1.3991  
  1.3992 +	case $host in
  1.3993 +	*-*-rhapsody* | *-*-darwin1.[012])
  1.3994 +	  # On Rhapsody replace the C library is the System framework
  1.3995 +	  newdeplibs=`$echo "X $newdeplibs" | $Xsed -e 's/ -lc / -framework System /'`
  1.3996 +	  ;;
  1.3997 +	esac
  1.3998 +
  1.3999  	if test "$droppeddeps" = yes; then
  1.4000  	  if test "$module" = yes; then
  1.4001 -	    echo
  1.4002 -	    echo "*** Warning: libtool could not satisfy all declared inter-library"
  1.4003 -	    echo "*** dependencies of module $libname.  Therefore, libtool will create"
  1.4004 -	    echo "*** a static module, that should work as long as the dlopening"
  1.4005 -	    echo "*** application is linked with the -dlopen flag."
  1.4006 +	    $echo
  1.4007 +	    $echo "*** Warning: libtool could not satisfy all declared inter-library"
  1.4008 +	    $echo "*** dependencies of module $libname.  Therefore, libtool will create"
  1.4009 +	    $echo "*** a static module, that should work as long as the dlopening"
  1.4010 +	    $echo "*** application is linked with the -dlopen flag."
  1.4011  	    if test -z "$global_symbol_pipe"; then
  1.4012 -	      echo
  1.4013 -	      echo "*** However, this would only work if libtool was able to extract symbol"
  1.4014 -	      echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
  1.4015 -	      echo "*** not find such a program.  So, this module is probably useless."
  1.4016 -	      echo "*** \`nm' from GNU binutils and a full rebuild may help."
  1.4017 +	      $echo
  1.4018 +	      $echo "*** However, this would only work if libtool was able to extract symbol"
  1.4019 +	      $echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
  1.4020 +	      $echo "*** not find such a program.  So, this module is probably useless."
  1.4021 +	      $echo "*** \`nm' from GNU binutils and a full rebuild may help."
  1.4022  	    fi
  1.4023  	    if test "$build_old_libs" = no; then
  1.4024  	      oldlibs="$output_objdir/$libname.$libext"
  1.4025 @@ -2070,9 +3426,24 @@
  1.4026  	      build_libtool_libs=no
  1.4027  	    fi
  1.4028  	  else
  1.4029 -	    echo "*** The inter-library dependencies that have been dropped here will be"
  1.4030 -	    echo "*** automatically added whenever a program is linked with this library"
  1.4031 -	    echo "*** or is declared to -dlopen it."
  1.4032 +	    $echo "*** The inter-library dependencies that have been dropped here will be"
  1.4033 +	    $echo "*** automatically added whenever a program is linked with this library"
  1.4034 +	    $echo "*** or is declared to -dlopen it."
  1.4035 +
  1.4036 +	    if test "$allow_undefined" = no; then
  1.4037 +	      $echo
  1.4038 +	      $echo "*** Since this library must not contain undefined symbols,"
  1.4039 +	      $echo "*** because either the platform does not support them or"
  1.4040 +	      $echo "*** it was explicitly requested with -no-undefined,"
  1.4041 +	      $echo "*** libtool will only create a static version of it."
  1.4042 +	      if test "$build_old_libs" = no; then
  1.4043 +		oldlibs="$output_objdir/$libname.$libext"
  1.4044 +		build_libtool_libs=module
  1.4045 +		build_old_libs=yes
  1.4046 +	      else
  1.4047 +		build_libtool_libs=no
  1.4048 +	      fi
  1.4049 +	    fi
  1.4050  	  fi
  1.4051  	fi
  1.4052  	# Done checking deplibs!
  1.4053 @@ -2083,10 +3454,70 @@
  1.4054        library_names=
  1.4055        old_library=
  1.4056        dlname=
  1.4057 -      
  1.4058 +
  1.4059        # Test again, we may have decided not to build it any more
  1.4060        if test "$build_libtool_libs" = yes; then
  1.4061 +	if test "$hardcode_into_libs" = yes; then
  1.4062 +	  # Hardcode the library paths
  1.4063 +	  hardcode_libdirs=
  1.4064 +	  dep_rpath=
  1.4065 +	  rpath="$finalize_rpath"
  1.4066 +	  test "$mode" != relink && rpath="$compile_rpath$rpath"
  1.4067 +	  for libdir in $rpath; do
  1.4068 +	    if test -n "$hardcode_libdir_flag_spec"; then
  1.4069 +	      if test -n "$hardcode_libdir_separator"; then
  1.4070 +		if test -z "$hardcode_libdirs"; then
  1.4071 +		  hardcode_libdirs="$libdir"
  1.4072 +		else
  1.4073 +		  # Just accumulate the unique libdirs.
  1.4074 +		  case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
  1.4075 +		  *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
  1.4076 +		    ;;
  1.4077 +		  *)
  1.4078 +		    hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
  1.4079 +		    ;;
  1.4080 +		  esac
  1.4081 +		fi
  1.4082 +	      else
  1.4083 +		eval flag=\"$hardcode_libdir_flag_spec\"
  1.4084 +		dep_rpath="$dep_rpath $flag"
  1.4085 +	      fi
  1.4086 +	    elif test -n "$runpath_var"; then
  1.4087 +	      case "$perm_rpath " in
  1.4088 +	      *" $libdir "*) ;;
  1.4089 +	      *) perm_rpath="$perm_rpath $libdir" ;;
  1.4090 +	      esac
  1.4091 +	    fi
  1.4092 +	  done
  1.4093 +	  # Substitute the hardcoded libdirs into the rpath.
  1.4094 +	  if test -n "$hardcode_libdir_separator" &&
  1.4095 +	     test -n "$hardcode_libdirs"; then
  1.4096 +	    libdir="$hardcode_libdirs"
  1.4097 +	    if test -n "$hardcode_libdir_flag_spec_ld"; then
  1.4098 +	      eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\"
  1.4099 +	    else
  1.4100 +	      eval dep_rpath=\"$hardcode_libdir_flag_spec\"
  1.4101 +	    fi
  1.4102 +	  fi
  1.4103 +	  if test -n "$runpath_var" && test -n "$perm_rpath"; then
  1.4104 +	    # We should set the runpath_var.
  1.4105 +	    rpath=
  1.4106 +	    for dir in $perm_rpath; do
  1.4107 +	      rpath="$rpath$dir:"
  1.4108 +	    done
  1.4109 +	    eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var"
  1.4110 +	  fi
  1.4111 +	  test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs"
  1.4112 +	fi
  1.4113 +
  1.4114 +	shlibpath="$finalize_shlibpath"
  1.4115 +	test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath"
  1.4116 +	if test -n "$shlibpath"; then
  1.4117 +	  eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var"
  1.4118 +	fi
  1.4119 +
  1.4120  	# Get the real and link names of the library.
  1.4121 +	eval shared_ext=\"$shrext\"
  1.4122  	eval library_names=\"$library_names_spec\"
  1.4123  	set dummy $library_names
  1.4124  	realname="$2"
  1.4125 @@ -2097,6 +3528,9 @@
  1.4126  	else
  1.4127  	  soname="$realname"
  1.4128  	fi
  1.4129 +	if test -z "$dlname"; then
  1.4130 +	  dlname=$soname
  1.4131 +	fi
  1.4132  
  1.4133  	lib="$output_objdir/$realname"
  1.4134  	for link
  1.4135 @@ -2104,23 +3538,6 @@
  1.4136  	  linknames="$linknames $link"
  1.4137  	done
  1.4138  
  1.4139 -	# Ensure that we have .o objects for linkers which dislike .lo
  1.4140 -	# (e.g. aix) in case we are running --disable-static
  1.4141 -	for obj in $libobjs; do
  1.4142 -	  xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'`
  1.4143 -	  if test "X$xdir" = "X$obj"; then
  1.4144 -	    xdir="."
  1.4145 -	  else
  1.4146 -	    xdir="$xdir"
  1.4147 -	  fi
  1.4148 -	  baseobj=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
  1.4149 -	  oldobj=`$echo "X$baseobj" | $Xsed -e "$lo2o"`
  1.4150 -	  if test ! -f $xdir/$oldobj; then
  1.4151 -	    $show "(cd $xdir && ${LN_S} $baseobj $oldobj)"
  1.4152 -	    $run eval '(cd $xdir && ${LN_S} $baseobj $oldobj)' || exit $?
  1.4153 -	  fi
  1.4154 -	done
  1.4155 -
  1.4156  	# Use standard objects if they are pic
  1.4157  	test -z "$pic_flag" && libobjs=`$echo "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
  1.4158  
  1.4159 @@ -2131,16 +3548,24 @@
  1.4160  	    export_symbols="$output_objdir/$libname.exp"
  1.4161  	    $run $rm $export_symbols
  1.4162  	    eval cmds=\"$export_symbols_cmds\"
  1.4163 -	    IFS="${IFS= 	}"; save_ifs="$IFS"; IFS='~'
  1.4164 +	    save_ifs="$IFS"; IFS='~'
  1.4165  	    for cmd in $cmds; do
  1.4166  	      IFS="$save_ifs"
  1.4167 -	      $show "$cmd"
  1.4168 -	      $run eval "$cmd" || exit $?
  1.4169 +	      if len=`expr "X$cmd" : ".*"` &&
  1.4170 +	       test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
  1.4171 +	        $show "$cmd"
  1.4172 +	        $run eval "$cmd" || exit $?
  1.4173 +	        skipped_export=false
  1.4174 +	      else
  1.4175 +	        # The command line is too long to execute in one step.
  1.4176 +	        $show "using reloadable object file for export list..."
  1.4177 +	        skipped_export=:
  1.4178 +	      fi
  1.4179  	    done
  1.4180  	    IFS="$save_ifs"
  1.4181  	    if test -n "$export_symbols_regex"; then
  1.4182 -	      $show "egrep -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\""
  1.4183 -	      $run eval 'egrep -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
  1.4184 +	      $show "$EGREP -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\""
  1.4185 +	      $run eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
  1.4186  	      $show "$mv \"${export_symbols}T\" \"$export_symbols\""
  1.4187  	      $run eval '$mv "${export_symbols}T" "$export_symbols"'
  1.4188  	    fi
  1.4189 @@ -2151,24 +3576,36 @@
  1.4190  	  $run eval '$echo "X$include_expsyms" | $SP2NL >> "$export_symbols"'
  1.4191  	fi
  1.4192  
  1.4193 +	tmp_deplibs=
  1.4194 +	for test_deplib in $deplibs; do
  1.4195 +		case " $convenience " in
  1.4196 +		*" $test_deplib "*) ;;
  1.4197 +		*) 
  1.4198 +			tmp_deplibs="$tmp_deplibs $test_deplib"
  1.4199 +			;;
  1.4200 +		esac
  1.4201 +	done
  1.4202 +	deplibs="$tmp_deplibs" 
  1.4203 +
  1.4204  	if test -n "$convenience"; then
  1.4205  	  if test -n "$whole_archive_flag_spec"; then
  1.4206 +	    save_libobjs=$libobjs
  1.4207  	    eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
  1.4208  	  else
  1.4209  	    gentop="$output_objdir/${outputname}x"
  1.4210  	    $show "${rm}r $gentop"
  1.4211  	    $run ${rm}r "$gentop"
  1.4212 -	    $show "mkdir $gentop"
  1.4213 -	    $run mkdir "$gentop"
  1.4214 +	    $show "$mkdir $gentop"
  1.4215 +	    $run $mkdir "$gentop"
  1.4216  	    status=$?
  1.4217 -	    if test $status -ne 0 && test ! -d "$gentop"; then
  1.4218 +	    if test "$status" -ne 0 && test ! -d "$gentop"; then
  1.4219  	      exit $status
  1.4220  	    fi
  1.4221  	    generated="$generated $gentop"
  1.4222  
  1.4223  	    for xlib in $convenience; do
  1.4224  	      # Extract the objects.
  1.4225 -	      case "$xlib" in
  1.4226 +	      case $xlib in
  1.4227  	      [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
  1.4228  	      *) xabs=`pwd`"/$xlib" ;;
  1.4229  	      esac
  1.4230 @@ -2177,43 +3614,183 @@
  1.4231  
  1.4232  	      $show "${rm}r $xdir"
  1.4233  	      $run ${rm}r "$xdir"
  1.4234 -	      $show "mkdir $xdir"
  1.4235 -	      $run mkdir "$xdir"
  1.4236 +	      $show "$mkdir $xdir"
  1.4237 +	      $run $mkdir "$xdir"
  1.4238  	      status=$?
  1.4239 -	      if test $status -ne 0 && test ! -d "$xdir"; then
  1.4240 +	      if test "$status" -ne 0 && test ! -d "$xdir"; then
  1.4241  		exit $status
  1.4242  	      fi
  1.4243 +	      # We will extract separately just the conflicting names and we will no
  1.4244 +	      # longer touch any unique names. It is faster to leave these extract
  1.4245 +	      # automatically by $AR in one run.
  1.4246  	      $show "(cd $xdir && $AR x $xabs)"
  1.4247  	      $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
  1.4248 -
  1.4249 -	      libobjs="$libobjs "`find $xdir -name \*.o -print -o -name \*.lo -print | $NL2SP`
  1.4250 +	      if ($AR t "$xabs" | sort | sort -uc >/dev/null 2>&1); then
  1.4251 +		:
  1.4252 +	      else
  1.4253 +		$echo "$modename: warning: object name conflicts; renaming object files" 1>&2
  1.4254 +		$echo "$modename: warning: to ensure that they will not overwrite" 1>&2
  1.4255 +		$AR t "$xabs" | sort | uniq -cd | while read -r count name
  1.4256 +		do
  1.4257 +		  i=1
  1.4258 +		  while test "$i" -le "$count"
  1.4259 +		  do
  1.4260 +		   # Put our $i before any first dot (extension)
  1.4261 +		   # Never overwrite any file
  1.4262 +		   name_to="$name"
  1.4263 +		   while test "X$name_to" = "X$name" || test -f "$xdir/$name_to"
  1.4264 +		   do
  1.4265 +		     name_to=`$echo "X$name_to" | $Xsed -e "s/\([^.]*\)/\1-$i/"`
  1.4266 +		   done
  1.4267 +		   $show "(cd $xdir && $AR xN $i $xabs '$name' && $mv '$name' '$name_to')"
  1.4268 +		   $run eval "(cd \$xdir && $AR xN $i \$xabs '$name' && $mv '$name' '$name_to')" || exit $?
  1.4269 +		   i=`expr $i + 1`
  1.4270 +		  done
  1.4271 +		done
  1.4272 +	      fi
  1.4273 +
  1.4274 +	      libobjs="$libobjs "`find $xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP`
  1.4275  	    done
  1.4276  	  fi
  1.4277  	fi
  1.4278  
  1.4279  	if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then
  1.4280  	  eval flag=\"$thread_safe_flag_spec\"
  1.4281 -	  linkopts="$linkopts $flag"
  1.4282 +	  linker_flags="$linker_flags $flag"
  1.4283  	fi
  1.4284  
  1.4285 +	# Make a backup of the uninstalled library when relinking
  1.4286 +	if test "$mode" = relink; then
  1.4287 +	  $run eval '(cd $output_objdir && $rm ${realname}U && $mv $realname ${realname}U)' || exit $?
  1.4288 +	fi
  1.4289 +
  1.4290  	# Do each of the archive commands.
  1.4291 +	if test "$module" = yes && test -n "$module_cmds" ; then
  1.4292 +	  if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
  1.4293 +	    eval cmds=\"$module_expsym_cmds\"
  1.4294 +	  else
  1.4295 +	    eval cmds=\"$module_cmds\"
  1.4296 +	  fi
  1.4297 +	else
  1.4298  	if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
  1.4299  	  eval cmds=\"$archive_expsym_cmds\"
  1.4300  	else
  1.4301 -	  save_deplibs="$deplibs"
  1.4302 -	  for conv in $convenience; do
  1.4303 -	    tmp_deplibs=
  1.4304 -	    for test_deplib in $deplibs; do
  1.4305 -	      if test "$test_deplib" != "$conv"; then
  1.4306 -	        tmp_deplibs="$tmp_deplibs $test_deplib"
  1.4307 +	  eval cmds=\"$archive_cmds\"
  1.4308 +	  fi
  1.4309 +	fi
  1.4310 +
  1.4311 +	if test "X$skipped_export" != "X:" && len=`expr "X$cmds" : ".*"` &&
  1.4312 +	   test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
  1.4313 +	  :
  1.4314 +	else
  1.4315 +	  # The command line is too long to link in one step, link piecewise.
  1.4316 +	  $echo "creating reloadable object files..."
  1.4317 +
  1.4318 +	  # Save the value of $output and $libobjs because we want to
  1.4319 +	  # use them later.  If we have whole_archive_flag_spec, we
  1.4320 +	  # want to use save_libobjs as it was before
  1.4321 +	  # whole_archive_flag_spec was expanded, because we can't
  1.4322 +	  # assume the linker understands whole_archive_flag_spec.
  1.4323 +	  # This may have to be revisited, in case too many
  1.4324 +	  # convenience libraries get linked in and end up exceeding
  1.4325 +	  # the spec.
  1.4326 +	  if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then
  1.4327 +	    save_libobjs=$libobjs
  1.4328 +	  fi
  1.4329 +	  save_output=$output
  1.4330 +
  1.4331 +	  # Clear the reloadable object creation command queue and
  1.4332 +	  # initialize k to one.
  1.4333 +	  test_cmds=
  1.4334 +	  concat_cmds=
  1.4335 +	  objlist=
  1.4336 +	  delfiles=
  1.4337 +	  last_robj=
  1.4338 +	  k=1
  1.4339 +	  output=$output_objdir/$save_output-${k}.$objext
  1.4340 +	  # Loop over the list of objects to be linked.
  1.4341 +	  for obj in $save_libobjs
  1.4342 +	  do
  1.4343 +	    eval test_cmds=\"$reload_cmds $objlist $last_robj\"
  1.4344 +	    if test "X$objlist" = X ||
  1.4345 +	       { len=`expr "X$test_cmds" : ".*"` &&
  1.4346 +		 test "$len" -le "$max_cmd_len"; }; then
  1.4347 +	      objlist="$objlist $obj"
  1.4348 +	    else
  1.4349 +	      # The command $test_cmds is almost too long, add a
  1.4350 +	      # command to the queue.
  1.4351 +	      if test "$k" -eq 1 ; then
  1.4352 +		# The first file doesn't have a previous command to add.
  1.4353 +		eval concat_cmds=\"$reload_cmds $objlist $last_robj\"
  1.4354 +	      else
  1.4355 +		# All subsequent reloadable object files will link in
  1.4356 +		# the last one created.
  1.4357 +		eval concat_cmds=\"\$concat_cmds~$reload_cmds $objlist $last_robj\"
  1.4358  	      fi
  1.4359 -	    done
  1.4360 -	    deplibs="$tmp_deplibs"
  1.4361 +	      last_robj=$output_objdir/$save_output-${k}.$objext
  1.4362 +	      k=`expr $k + 1`
  1.4363 +	      output=$output_objdir/$save_output-${k}.$objext
  1.4364 +	      objlist=$obj
  1.4365 +	      len=1
  1.4366 +	    fi
  1.4367  	  done
  1.4368 - 	  eval cmds=\"$archive_cmds\"
  1.4369 -	  deplibs="$save_deplibs"
  1.4370 +	  # Handle the remaining objects by creating one last
  1.4371 +	  # reloadable object file.  All subsequent reloadable object
  1.4372 +	  # files will link in the last one created.
  1.4373 +	  test -z "$concat_cmds" || concat_cmds=$concat_cmds~
  1.4374 +	  eval concat_cmds=\"\${concat_cmds}$reload_cmds $objlist $last_robj\"
  1.4375 +
  1.4376 +	  if ${skipped_export-false}; then
  1.4377 +	    $show "generating symbol list for \`$libname.la'"
  1.4378 +	    export_symbols="$output_objdir/$libname.exp"
  1.4379 +	    $run $rm $export_symbols
  1.4380 +	    libobjs=$output
  1.4381 +	    # Append the command to create the export file.
  1.4382 +	    eval concat_cmds=\"\$concat_cmds~$export_symbols_cmds\"
  1.4383 +          fi
  1.4384 +
  1.4385 +	  # Set up a command to remove the reloadale object files
  1.4386 +	  # after they are used.
  1.4387 +	  i=0
  1.4388 +	  while test "$i" -lt "$k"
  1.4389 +	  do
  1.4390 +	    i=`expr $i + 1`
  1.4391 +	    delfiles="$delfiles $output_objdir/$save_output-${i}.$objext"
  1.4392 +	  done
  1.4393 +
  1.4394 +	  $echo "creating a temporary reloadable object file: $output"
  1.4395 +
  1.4396 +	  # Loop through the commands generated above and execute them.
  1.4397 +	  save_ifs="$IFS"; IFS='~'
  1.4398 +	  for cmd in $concat_cmds; do
  1.4399 +	    IFS="$save_ifs"
  1.4400 +	    $show "$cmd"
  1.4401 +	    $run eval "$cmd" || exit $?
  1.4402 +	  done
  1.4403 +	  IFS="$save_ifs"
  1.4404 +
  1.4405 +	  libobjs=$output
  1.4406 +	  # Restore the value of output.
  1.4407 +	  output=$save_output
  1.4408 +
  1.4409 +	  if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then
  1.4410 +	    eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
  1.4411 +	  fi
  1.4412 +	  # Expand the library linking commands again to reset the
  1.4413 +	  # value of $libobjs for piecewise linking.
  1.4414 +
  1.4415 +	  # Do each of the archive commands.
  1.4416 +	  if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
  1.4417 +	    eval cmds=\"$archive_expsym_cmds\"
  1.4418 +	  else
  1.4419 +	    eval cmds=\"$archive_cmds\"
  1.4420 +	  fi
  1.4421 +
  1.4422 +	  # Append the command to remove the reloadable object files
  1.4423 +	  # to the just-reset $cmds.
  1.4424 +	  eval cmds=\"\$cmds~$rm $delfiles\"
  1.4425  	fi
  1.4426 -	IFS="${IFS= 	}"; save_ifs="$IFS"; IFS='~'
  1.4427 +	save_ifs="$IFS"; IFS='~'
  1.4428  	for cmd in $cmds; do
  1.4429  	  IFS="$save_ifs"
  1.4430  	  $show "$cmd"
  1.4431 @@ -2221,6 +3798,12 @@
  1.4432  	done
  1.4433  	IFS="$save_ifs"
  1.4434  
  1.4435 +	# Restore the uninstalled library and exit
  1.4436 +	if test "$mode" = relink; then
  1.4437 +	  $run eval '(cd $output_objdir && $rm ${realname}T && $mv $realname ${realname}T && $mv "$realname"U $realname)' || exit $?
  1.4438 +	  exit 0
  1.4439 +	fi
  1.4440 +
  1.4441  	# Create links to the real library.
  1.4442  	for linkname in $linknames; do
  1.4443  	  if test "$realname" != "$linkname"; then
  1.4444 @@ -2237,12 +3820,7 @@
  1.4445        fi
  1.4446        ;;
  1.4447  
  1.4448 -    *.lo | *.o | *.obj)
  1.4449 -      if test -n "$link_against_libtool_libs"; then
  1.4450 -	$echo "$modename: error: cannot link libtool libraries into objects" 1>&2
  1.4451 -	exit 1
  1.4452 -      fi
  1.4453 -
  1.4454 +    obj)
  1.4455        if test -n "$deplibs"; then
  1.4456  	$echo "$modename: warning: \`-l' and \`-L' are ignored for objects" 1>&2
  1.4457        fi
  1.4458 @@ -2267,9 +3845,9 @@
  1.4459  	$echo "$modename: warning: \`-release' is ignored for objects" 1>&2
  1.4460        fi
  1.4461  
  1.4462 -      case "$output" in
  1.4463 +      case $output in
  1.4464        *.lo)
  1.4465 -	if test -n "$objs"; then
  1.4466 +	if test -n "$objs$old_deplibs"; then
  1.4467  	  $echo "$modename: cannot build library object \`$output' from non-libtool objects" 1>&2
  1.4468  	  exit 1
  1.4469  	fi
  1.4470 @@ -2293,7 +3871,7 @@
  1.4471        gentop=
  1.4472        # reload_cmds runs $LD directly, so let us get rid of
  1.4473        # -Wl from whole_archive_flag_spec
  1.4474 -      wl= 
  1.4475 +      wl=
  1.4476  
  1.4477        if test -n "$convenience"; then
  1.4478  	if test -n "$whole_archive_flag_spec"; then
  1.4479 @@ -2302,17 +3880,17 @@
  1.4480  	  gentop="$output_objdir/${obj}x"
  1.4481  	  $show "${rm}r $gentop"
  1.4482  	  $run ${rm}r "$gentop"
  1.4483 -	  $show "mkdir $gentop"
  1.4484 -	  $run mkdir "$gentop"
  1.4485 +	  $show "$mkdir $gentop"
  1.4486 +	  $run $mkdir "$gentop"
  1.4487  	  status=$?
  1.4488 -	  if test $status -ne 0 && test ! -d "$gentop"; then
  1.4489 +	  if test "$status" -ne 0 && test ! -d "$gentop"; then
  1.4490  	    exit $status
  1.4491  	  fi
  1.4492  	  generated="$generated $gentop"
  1.4493  
  1.4494  	  for xlib in $convenience; do
  1.4495  	    # Extract the objects.
  1.4496 -	    case "$xlib" in
  1.4497 +	    case $xlib in
  1.4498  	    [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
  1.4499  	    *) xabs=`pwd`"/$xlib" ;;
  1.4500  	    esac
  1.4501 @@ -2321,26 +3899,52 @@
  1.4502  
  1.4503  	    $show "${rm}r $xdir"
  1.4504  	    $run ${rm}r "$xdir"
  1.4505 -	    $show "mkdir $xdir"
  1.4506 -	    $run mkdir "$xdir"
  1.4507 +	    $show "$mkdir $xdir"
  1.4508 +	    $run $mkdir "$xdir"
  1.4509  	    status=$?
  1.4510 -	    if test $status -ne 0 && test ! -d "$xdir"; then
  1.4511 +	    if test "$status" -ne 0 && test ! -d "$xdir"; then
  1.4512  	      exit $status
  1.4513  	    fi
  1.4514 +	    # We will extract separately just the conflicting names and we will no
  1.4515 +	    # longer touch any unique names. It is faster to leave these extract
  1.4516 +	    # automatically by $AR in one run.
  1.4517  	    $show "(cd $xdir && $AR x $xabs)"
  1.4518  	    $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
  1.4519 -
  1.4520 -	    reload_conv_objs="$reload_objs "`find $xdir -name \*.o -print -o -name \*.lo -print | $NL2SP`
  1.4521 +	    if ($AR t "$xabs" | sort | sort -uc >/dev/null 2>&1); then
  1.4522 +	      :
  1.4523 +	    else
  1.4524 +	      $echo "$modename: warning: object name conflicts; renaming object files" 1>&2
  1.4525 +	      $echo "$modename: warning: to ensure that they will not overwrite" 1>&2
  1.4526 +	      $AR t "$xabs" | sort | uniq -cd | while read -r count name
  1.4527 +	      do
  1.4528 +		i=1
  1.4529 +		while test "$i" -le "$count"
  1.4530 +		do
  1.4531 +		 # Put our $i before any first dot (extension)
  1.4532 +		 # Never overwrite any file
  1.4533 +		 name_to="$name"
  1.4534 +		 while test "X$name_to" = "X$name" || test -f "$xdir/$name_to"
  1.4535 +		 do
  1.4536 +		   name_to=`$echo "X$name_to" | $Xsed -e "s/\([^.]*\)/\1-$i/"`
  1.4537 +		 done
  1.4538 +		 $show "(cd $xdir && $AR xN $i $xabs '$name' && $mv '$name' '$name_to')"
  1.4539 +		 $run eval "(cd \$xdir && $AR xN $i \$xabs '$name' && $mv '$name' '$name_to')" || exit $?
  1.4540 +		 i=`expr $i + 1`
  1.4541 +		done
  1.4542 +	      done
  1.4543 +	    fi
  1.4544 +
  1.4545 +	    reload_conv_objs="$reload_objs "`find $xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP`
  1.4546  	  done
  1.4547  	fi
  1.4548        fi
  1.4549  
  1.4550        # Create the old-style object.
  1.4551 -      reload_objs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}$'/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`" $reload_conv_objs"
  1.4552 +      reload_objs="$objs$old_deplibs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}$'/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test
  1.4553  
  1.4554        output="$obj"
  1.4555        eval cmds=\"$reload_cmds\"
  1.4556 -      IFS="${IFS= 	}"; save_ifs="$IFS"; IFS='~'
  1.4557 +      save_ifs="$IFS"; IFS='~'
  1.4558        for cmd in $cmds; do
  1.4559  	IFS="$save_ifs"
  1.4560  	$show "$cmd"
  1.4561 @@ -2366,37 +3970,23 @@
  1.4562  
  1.4563  	# Create an invalid libtool object if no PIC, so that we don't
  1.4564  	# accidentally link it into a program.
  1.4565 -	$show "echo timestamp > $libobj"
  1.4566 -	$run eval "echo timestamp > $libobj" || exit $?
  1.4567 +	# $show "echo timestamp > $libobj"
  1.4568 +	# $run eval "echo timestamp > $libobj" || exit $?
  1.4569  	exit 0
  1.4570        fi
  1.4571  
  1.4572 -      if test -n "$pic_flag"; then
  1.4573 +      if test -n "$pic_flag" || test "$pic_mode" != default; then
  1.4574  	# Only do commands if we really have different PIC objects.
  1.4575  	reload_objs="$libobjs $reload_conv_objs"
  1.4576  	output="$libobj"
  1.4577  	eval cmds=\"$reload_cmds\"
  1.4578 -	IFS="${IFS= 	}"; save_ifs="$IFS"; IFS='~'
  1.4579 +	save_ifs="$IFS"; IFS='~'
  1.4580  	for cmd in $cmds; do
  1.4581  	  IFS="$save_ifs"
  1.4582  	  $show "$cmd"
  1.4583  	  $run eval "$cmd" || exit $?
  1.4584  	done
  1.4585  	IFS="$save_ifs"
  1.4586 -      else
  1.4587 -	# Just create a symlink.
  1.4588 -	$show $rm $libobj
  1.4589 -	$run $rm $libobj
  1.4590 -	xdir=`$echo "X$libobj" | $Xsed -e 's%/[^/]*$%%'`
  1.4591 -	if test "X$xdir" = "X$libobj"; then
  1.4592 -	  xdir="."
  1.4593 -	else
  1.4594 -	  xdir="$xdir"
  1.4595 -	fi
  1.4596 -	baseobj=`$echo "X$libobj" | $Xsed -e 's%^.*/%%'`
  1.4597 -	oldobj=`$echo "X$baseobj" | $Xsed -e "$lo2o"`
  1.4598 -	$show "(cd $xdir && $LN_S $oldobj $baseobj)"
  1.4599 -	$run eval '(cd $xdir && $LN_S $oldobj $baseobj)' || exit $?
  1.4600        fi
  1.4601  
  1.4602        if test -n "$gentop"; then
  1.4603 @@ -2407,8 +3997,10 @@
  1.4604        exit 0
  1.4605        ;;
  1.4606  
  1.4607 -    # Anything else should be a program.
  1.4608 -    *)
  1.4609 +    prog)
  1.4610 +      case $host in
  1.4611 +	*cygwin*) output=`$echo $output | ${SED} -e 's,.exe$,,;s,$,.exe,'` ;;
  1.4612 +      esac
  1.4613        if test -n "$vinfo"; then
  1.4614  	$echo "$modename: warning: \`-version-info' is ignored for programs" 1>&2
  1.4615        fi
  1.4616 @@ -2418,20 +4010,37 @@
  1.4617        fi
  1.4618  
  1.4619        if test "$preload" = yes; then
  1.4620 -	if test "$dlopen" = unknown && test "$dlopen_self" = unknown &&
  1.4621 +	if test "$dlopen_support" = unknown && test "$dlopen_self" = unknown &&
  1.4622  	   test "$dlopen_self_static" = unknown; then
  1.4623  	  $echo "$modename: warning: \`AC_LIBTOOL_DLOPEN' not used. Assuming no dlopen support."
  1.4624 -	fi 
  1.4625 +	fi
  1.4626        fi
  1.4627 -    
  1.4628 +
  1.4629 +      case $host in
  1.4630 +      *-*-rhapsody* | *-*-darwin1.[012])
  1.4631 +	# On Rhapsody replace the C library is the System framework
  1.4632 +	compile_deplibs=`$echo "X $compile_deplibs" | $Xsed -e 's/ -lc / -framework System /'`
  1.4633 +	finalize_deplibs=`$echo "X $finalize_deplibs" | $Xsed -e 's/ -lc / -framework System /'`
  1.4634 +	;;
  1.4635 +      esac
  1.4636 +
  1.4637 +      case $host in
  1.4638 +      *darwin*)
  1.4639 +        # Don't allow lazy linking, it breaks C++ global constructors
  1.4640 +        if test "$tagname" = CXX ; then
  1.4641 +        compile_command="$compile_command ${wl}-bind_at_load"
  1.4642 +        finalize_command="$finalize_command ${wl}-bind_at_load"
  1.4643 +        fi
  1.4644 +        ;;
  1.4645 +      esac
  1.4646 +
  1.4647 +      compile_command="$compile_command $compile_deplibs"
  1.4648 +      finalize_command="$finalize_command $finalize_deplibs"
  1.4649 +
  1.4650        if test -n "$rpath$xrpath"; then
  1.4651  	# If the user specified any rpath flags, then add them.
  1.4652  	for libdir in $rpath $xrpath; do
  1.4653  	  # This is the magic to use -rpath.
  1.4654 -	  case "$compile_rpath " in
  1.4655 -	  *" $libdir "*) ;;
  1.4656 -	  *) compile_rpath="$compile_rpath $libdir" ;;
  1.4657 -	  esac
  1.4658  	  case "$finalize_rpath " in
  1.4659  	  *" $libdir "*) ;;
  1.4660  	  *) finalize_rpath="$finalize_rpath $libdir" ;;
  1.4661 @@ -2449,7 +4058,7 @@
  1.4662  	      hardcode_libdirs="$libdir"
  1.4663  	    else
  1.4664  	      # Just accumulate the unique libdirs.
  1.4665 -	      case "$hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator" in
  1.4666 +	      case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
  1.4667  	      *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
  1.4668  		;;
  1.4669  	      *)
  1.4670 @@ -2467,6 +4076,14 @@
  1.4671  	  *) perm_rpath="$perm_rpath $libdir" ;;
  1.4672  	  esac
  1.4673  	fi
  1.4674 +	case $host in
  1.4675 +	*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
  1.4676 +	  case :$dllsearchpath: in
  1.4677 +	  *":$libdir:"*) ;;
  1.4678 +	  *) dllsearchpath="$dllsearchpath:$libdir";;
  1.4679 +	  esac
  1.4680 +	  ;;
  1.4681 +	esac
  1.4682        done
  1.4683        # Substitute the hardcoded libdirs into the rpath.
  1.4684        if test -n "$hardcode_libdir_separator" &&
  1.4685 @@ -2485,7 +4102,7 @@
  1.4686  	      hardcode_libdirs="$libdir"
  1.4687  	    else
  1.4688  	      # Just accumulate the unique libdirs.
  1.4689 -	      case "$hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator" in
  1.4690 +	      case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
  1.4691  	      *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
  1.4692  		;;
  1.4693  	      *)
  1.4694 @@ -2512,23 +4129,6 @@
  1.4695        fi
  1.4696        finalize_rpath="$rpath"
  1.4697  
  1.4698 -      output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'`
  1.4699 -      if test "X$output_objdir" = "X$output"; then
  1.4700 -	output_objdir="$objdir"
  1.4701 -      else
  1.4702 -	output_objdir="$output_objdir/$objdir"
  1.4703 -      fi
  1.4704 -
  1.4705 -      # Create the binary in the object directory, then wrap it.
  1.4706 -      if test ! -d $output_objdir; then
  1.4707 -	$show "$mkdir $output_objdir"
  1.4708 -	$run $mkdir $output_objdir
  1.4709 -	status=$?
  1.4710 -	if test $status -ne 0 && test ! -d $output_objdir; then
  1.4711 -	  exit $status
  1.4712 -	fi
  1.4713 -      fi
  1.4714 -
  1.4715        if test -n "$libobjs" && test "$build_old_libs" = yes; then
  1.4716  	# Transform all the library objects into standard objects.
  1.4717  	compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
  1.4718 @@ -2545,7 +4145,7 @@
  1.4719        fi
  1.4720  
  1.4721        if test -n "$dlsyms"; then
  1.4722 -	case "$dlsyms" in
  1.4723 +	case $dlsyms in
  1.4724  	"") ;;
  1.4725  	*.c)
  1.4726  	  # Discover the nlist of each of the dlfiles.
  1.4727 @@ -2577,19 +4177,19 @@
  1.4728  	    test -z "$run" && $echo ': @PROGRAM@ ' > "$nlist"
  1.4729  
  1.4730  	    # Add our own program objects to the symbol list.
  1.4731 -	    progfiles=`$echo "X$objs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
  1.4732 +	    progfiles=`$echo "X$objs$old_deplibs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
  1.4733  	    for arg in $progfiles; do
  1.4734  	      $show "extracting global C symbols from \`$arg'"
  1.4735  	      $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
  1.4736  	    done
  1.4737  
  1.4738  	    if test -n "$exclude_expsyms"; then
  1.4739 -	      $run eval 'egrep -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
  1.4740 +	      $run eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
  1.4741  	      $run eval '$mv "$nlist"T "$nlist"'
  1.4742  	    fi
  1.4743 -	    
  1.4744 +
  1.4745  	    if test -n "$export_symbols_regex"; then
  1.4746 -	      $run eval 'egrep -e "$export_symbols_regex" "$nlist" > "$nlist"T'
  1.4747 +	      $run eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T'
  1.4748  	      $run eval '$mv "$nlist"T "$nlist"'
  1.4749  	    fi
  1.4750  
  1.4751 @@ -2597,9 +4197,9 @@
  1.4752  	    if test -z "$export_symbols"; then
  1.4753  	      export_symbols="$output_objdir/$output.exp"
  1.4754  	      $run $rm $export_symbols
  1.4755 -	      $run eval "sed -n -e '/^: @PROGRAM@$/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
  1.4756 +	      $run eval "${SED} -n -e '/^: @PROGRAM@$/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
  1.4757  	    else
  1.4758 -	      $run eval "sed -e 's/\([][.*^$]\)/\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$output.exp"'
  1.4759 +	      $run eval "${SED} -e 's/\([][.*^$]\)/\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$output.exp"'
  1.4760  	      $run eval 'grep -f "$output_objdir/$output.exp" < "$nlist" > "$nlist"T'
  1.4761  	      $run eval 'mv "$nlist"T "$nlist"'
  1.4762  	    fi
  1.4763 @@ -2607,8 +4207,8 @@
  1.4764  
  1.4765  	  for arg in $dlprefiles; do
  1.4766  	    $show "extracting global C symbols from \`$arg'"
  1.4767 -	    name=`echo "$arg" | sed -e 's%^.*/%%'`
  1.4768 -	    $run eval 'echo ": $name " >> "$nlist"'
  1.4769 +	    name=`$echo "$arg" | ${SED} -e 's%^.*/%%'`
  1.4770 +	    $run eval '$echo ": $name " >> "$nlist"'
  1.4771  	    $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
  1.4772  	  done
  1.4773  
  1.4774 @@ -2617,12 +4217,18 @@
  1.4775  	    test -f "$nlist" || : > "$nlist"
  1.4776  
  1.4777  	    if test -n "$exclude_expsyms"; then
  1.4778 -	      egrep -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T
  1.4779 +	      $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T
  1.4780  	      $mv "$nlist"T "$nlist"
  1.4781  	    fi
  1.4782  
  1.4783  	    # Try sorting and uniquifying the output.
  1.4784 -	    if grep -v "^: " < "$nlist" | sort +2 | uniq > "$nlist"S; then
  1.4785 +	    if grep -v "^: " < "$nlist" |
  1.4786 +		if sort -k 3 </dev/null >/dev/null 2>&1; then
  1.4787 +		  sort -k 3
  1.4788 +		else
  1.4789 +		  sort +2
  1.4790 +		fi |
  1.4791 +		uniq > "$nlist"S; then
  1.4792  	      :
  1.4793  	    else
  1.4794  	      grep -v "^: " < "$nlist" > "$nlist"S
  1.4795 @@ -2631,7 +4237,7 @@
  1.4796  	    if test -f "$nlist"S; then
  1.4797  	      eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$dlsyms"'
  1.4798  	    else
  1.4799 -	      echo '/* NONE */' >> "$output_objdir/$dlsyms"
  1.4800 +	      $echo '/* NONE */' >> "$output_objdir/$dlsyms"
  1.4801  	    fi
  1.4802  
  1.4803  	    $echo >> "$output_objdir/$dlsyms" "\
  1.4804 @@ -2639,27 +4245,25 @@
  1.4805  #undef lt_preloaded_symbols
  1.4806  
  1.4807  #if defined (__STDC__) && __STDC__
  1.4808 -# define lt_ptr_t void *
  1.4809 +# define lt_ptr void *
  1.4810  #else
  1.4811 -# define lt_ptr_t char *
  1.4812 +# define lt_ptr char *
  1.4813  # define const
  1.4814  #endif
  1.4815  
  1.4816  /* The mapping between symbol names and symbols. */
  1.4817  const struct {
  1.4818    const char *name;
  1.4819 -  lt_ptr_t address;
  1.4820 +  lt_ptr address;
  1.4821  }
  1.4822  lt_preloaded_symbols[] =
  1.4823  {\
  1.4824  "
  1.4825  
  1.4826 -	    sed -n -e 's/^: \([^ ]*\) $/  {\"\1\", (lt_ptr_t) 0},/p' \
  1.4827 -		-e 's/^. \([^ ]*\) \([^ ]*\)$/  {"\2", (lt_ptr_t) \&\2},/p' \
  1.4828 -		  < "$nlist" >> "$output_objdir/$dlsyms"
  1.4829 +	    eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$dlsyms"
  1.4830  
  1.4831  	    $echo >> "$output_objdir/$dlsyms" "\
  1.4832 -  {0, (lt_ptr_t) 0}
  1.4833 +  {0, (lt_ptr) 0}
  1.4834  };
  1.4835  
  1.4836  /* This works around a problem in FreeBSD linker */
  1.4837 @@ -2676,7 +4280,7 @@
  1.4838  	  fi
  1.4839  
  1.4840  	  pic_flag_for_symtable=
  1.4841 -	  case "$host" in
  1.4842 +	  case $host in
  1.4843  	  # compiling the symbol table file with pic_flag works around
  1.4844  	  # a FreeBSD bug that causes programs to crash when -lm is
  1.4845  	  # linked before any other PIC object.  But we must not use
  1.4846 @@ -2685,18 +4289,18 @@
  1.4847  	  *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)
  1.4848  	    case "$compile_command " in
  1.4849  	    *" -static "*) ;;
  1.4850 -	    *) pic_flag_for_symtable=" $pic_flag -DPIC -DFREEBSD_WORKAROUND";;
  1.4851 +	    *) pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND";;
  1.4852  	    esac;;
  1.4853  	  *-*-hpux*)
  1.4854  	    case "$compile_command " in
  1.4855  	    *" -static "*) ;;
  1.4856 -	    *) pic_flag_for_symtable=" $pic_flag -DPIC";;
  1.4857 +	    *) pic_flag_for_symtable=" $pic_flag";;
  1.4858  	    esac
  1.4859  	  esac
  1.4860  
  1.4861  	  # Now compile the dynamic symbol file.
  1.4862 -	  $show "(cd $output_objdir && $CC -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")"
  1.4863 -	  $run eval '(cd $output_objdir && $CC -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $?
  1.4864 +	  $show "(cd $output_objdir && $LTCC -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")"
  1.4865 +	  $run eval '(cd $output_objdir && $LTCC -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $?
  1.4866  
  1.4867  	  # Clean up the generated files.
  1.4868  	  $show "$rm $output_objdir/$dlsyms $nlist ${nlist}S ${nlist}T"
  1.4869 @@ -2721,7 +4325,7 @@
  1.4870  	finalize_command=`$echo "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"`
  1.4871        fi
  1.4872  
  1.4873 -      if test -z "$link_against_libtool_libs" || test "$build_libtool_libs" != yes; then
  1.4874 +      if test "$need_relink" = no || test "$build_libtool_libs" != yes; then
  1.4875  	# Replace the output file specification.
  1.4876  	compile_command=`$echo "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
  1.4877  	link_command="$compile_command$compile_rpath"
  1.4878 @@ -2730,7 +4334,7 @@
  1.4879  	$show "$link_command"
  1.4880  	$run eval "$link_command"
  1.4881  	status=$?
  1.4882 -	
  1.4883 +
  1.4884  	# Delete the generated files.
  1.4885  	if test -n "$dlsyms"; then
  1.4886  	  $show "$rm $output_objdir/${outputname}S.${objext}"
  1.4887 @@ -2744,7 +4348,7 @@
  1.4888  	# We should set the shlibpath_var
  1.4889  	rpath=
  1.4890  	for dir in $temp_rpath; do
  1.4891 -	  case "$dir" in
  1.4892 +	  case $dir in
  1.4893  	  [\\/]* | [A-Za-z]:[\\/]*)
  1.4894  	    # Absolute path.
  1.4895  	    rpath="$rpath$dir:"
  1.4896 @@ -2786,11 +4390,24 @@
  1.4897  	fi
  1.4898        fi
  1.4899  
  1.4900 +      if test "$no_install" = yes; then
  1.4901 +	# We don't need to create a wrapper script.
  1.4902 +	link_command="$compile_var$compile_command$compile_rpath"
  1.4903 +	# Replace the output file specification.
  1.4904 +	link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
  1.4905 +	# Delete the old output file.
  1.4906 +	$run $rm $output
  1.4907 +	# Link the executable and exit
  1.4908 +	$show "$link_command"
  1.4909 +	$run eval "$link_command" || exit $?
  1.4910 +	exit 0
  1.4911 +      fi
  1.4912 +
  1.4913        if test "$hardcode_action" = relink; then
  1.4914  	# Fast installation is not supported
  1.4915  	link_command="$compile_var$compile_command$compile_rpath"
  1.4916  	relink_command="$finalize_var$finalize_command$finalize_rpath"
  1.4917 -	
  1.4918 +
  1.4919  	$echo "$modename: warning: this platform does not like uninstalled shared libraries" 1>&2
  1.4920  	$echo "$modename: \`$output' will be relinked during installation" 1>&2
  1.4921        else
  1.4922 @@ -2810,7 +4427,7 @@
  1.4923  
  1.4924        # Replace the output file specification.
  1.4925        link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`
  1.4926 -      
  1.4927 +
  1.4928        # Delete the old output files.
  1.4929        $run $rm $output $output_objdir/$outputname $output_objdir/lt-$outputname
  1.4930  
  1.4931 @@ -2822,12 +4439,24 @@
  1.4932  
  1.4933        # Quote the relink command for shipping.
  1.4934        if test -n "$relink_command"; then
  1.4935 +	# Preserve any variables that may affect compiler behavior
  1.4936 +	for var in $variables_saved_for_relink; do
  1.4937 +	  if eval test -z \"\${$var+set}\"; then
  1.4938 +	    relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command"
  1.4939 +	  elif eval var_value=\$$var; test -z "$var_value"; then
  1.4940 +	    relink_command="$var=; export $var; $relink_command"
  1.4941 +	  else
  1.4942 +	    var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"`
  1.4943 +	    relink_command="$var=\"$var_value\"; export $var; $relink_command"
  1.4944 +	  fi
  1.4945 +	done
  1.4946 +	relink_command="(cd `pwd`; $relink_command)"
  1.4947  	relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"`
  1.4948        fi
  1.4949  
  1.4950        # Quote $echo for shipping.
  1.4951        if test "X$echo" = "X$SHELL $0 --fallback-echo"; then
  1.4952 -	case "$0" in
  1.4953 +	case $0 in
  1.4954  	[\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $0 --fallback-echo";;
  1.4955  	*) qecho="$SHELL `pwd`/$0 --fallback-echo";;
  1.4956  	esac
  1.4957 @@ -2841,7 +4470,351 @@
  1.4958  	# win32 will think the script is a binary if it has
  1.4959  	# a .exe suffix, so we strip it off here.
  1.4960  	case $output in
  1.4961 -	  *.exe) output=`echo $output|sed 's,.exe$,,'` ;;
  1.4962 +	  *.exe) output=`$echo $output|${SED} 's,.exe$,,'` ;;
  1.4963 +	esac
  1.4964 +	# test for cygwin because mv fails w/o .exe extensions
  1.4965 +	case $host in
  1.4966 +	  *cygwin*)
  1.4967 +	    exeext=.exe
  1.4968 +	    outputname=`$echo $outputname|${SED} 's,.exe$,,'` ;;
  1.4969 +	  *) exeext= ;;
  1.4970 +	esac
  1.4971 +	case $host in
  1.4972 +	  *cygwin* | *mingw* )
  1.4973 +	    cwrappersource=`$echo ${objdir}/lt-${output}.c`
  1.4974 +	    cwrapper=`$echo ${output}.exe`
  1.4975 +	    $rm $cwrappersource $cwrapper
  1.4976 +	    trap "$rm $cwrappersource $cwrapper; exit 1" 1 2 15
  1.4977 +
  1.4978 +	    cat > $cwrappersource <<EOF
  1.4979 +
  1.4980 +/* $cwrappersource - temporary wrapper executable for $objdir/$outputname
  1.4981 +   Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
  1.4982 +
  1.4983 +   The $output program cannot be directly executed until all the libtool
  1.4984 +   libraries that it depends on are installed.
  1.4985 +   
  1.4986 +   This wrapper executable should never be moved out of the build directory.
  1.4987 +   If it is, it will not operate correctly.
  1.4988 +
  1.4989 +   Currently, it simply execs the wrapper *script* "/bin/sh $output",
  1.4990 +   but could eventually absorb all of the scripts functionality and
  1.4991 +   exec $objdir/$outputname directly.
  1.4992 +*/
  1.4993 +EOF
  1.4994 +	    cat >> $cwrappersource<<"EOF"
  1.4995 +#include <stdio.h>
  1.4996 +#include <stdlib.h>
  1.4997 +#include <unistd.h>
  1.4998 +#include <malloc.h>
  1.4999 +#include <stdarg.h>
  1.5000 +#include <assert.h>
  1.5001 +#include <sys/stat.h>
  1.5002 +
  1.5003 +#if defined(PATH_MAX)
  1.5004 +# define LT_PATHMAX PATH_MAX
  1.5005 +#elif defined(MAXPATHLEN)
  1.5006 +# define LT_PATHMAX MAXPATHLEN
  1.5007 +#else
  1.5008 +# define LT_PATHMAX 1024
  1.5009 +#endif
  1.5010 +
  1.5011 +#ifndef DIR_SEPARATOR
  1.5012 +# define DIR_SEPARATOR '/'
  1.5013 +# define PATH_SEPARATOR ':'
  1.5014 +#endif
  1.5015 +
  1.5016 +#if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \
  1.5017 +  defined (__OS2__)
  1.5018 +# define HAVE_DOS_BASED_FILE_SYSTEM
  1.5019 +# ifndef DIR_SEPARATOR_2 
  1.5020 +#  define DIR_SEPARATOR_2 '\\'
  1.5021 +# endif
  1.5022 +# ifndef PATH_SEPARATOR_2 
  1.5023 +#  define PATH_SEPARATOR_2 ';'
  1.5024 +# endif
  1.5025 +#endif
  1.5026 +
  1.5027 +#ifndef DIR_SEPARATOR_2
  1.5028 +# define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR)
  1.5029 +#else /* DIR_SEPARATOR_2 */
  1.5030 +# define IS_DIR_SEPARATOR(ch) \
  1.5031 +        (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2))
  1.5032 +#endif /* DIR_SEPARATOR_2 */
  1.5033 +
  1.5034 +#ifndef PATH_SEPARATOR_2
  1.5035 +# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR)
  1.5036 +#else /* PATH_SEPARATOR_2 */
  1.5037 +# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2)
  1.5038 +#endif /* PATH_SEPARATOR_2 */
  1.5039 +
  1.5040 +#define XMALLOC(type, num)      ((type *) xmalloc ((num) * sizeof(type)))
  1.5041 +#define XFREE(stale) do { \
  1.5042 +  if (stale) { free ((void *) stale); stale = 0; } \
  1.5043 +} while (0)
  1.5044 +
  1.5045 +#if defined DEBUGWRAPPER
  1.5046 +# define DEBUG(format, ...) fprintf(stderr, format, __VA_ARGS__)
  1.5047 +#else
  1.5048 +# define DEBUG(format, ...) 
  1.5049 +#endif
  1.5050 +
  1.5051 +const char *program_name = NULL;
  1.5052 +
  1.5053 +void * xmalloc (size_t num);
  1.5054 +char * xstrdup (const char *string);
  1.5055 +char * basename (const char *name);
  1.5056 +char * find_executable(const char *wrapper);
  1.5057 +int    check_executable(const char *path);
  1.5058 +char * strendzap(char *str, const char *pat);
  1.5059 +void lt_fatal (const char *message, ...);
  1.5060 +
  1.5061 +int
  1.5062 +main (int argc, char *argv[])
  1.5063 +{
  1.5064 +  char **newargz;
  1.5065 +  int i;
  1.5066 +  
  1.5067 +  program_name = (char *) xstrdup ((char *) basename (argv[0]));
  1.5068 +  DEBUG("(main) argv[0]      : %s\n",argv[0]);
  1.5069 +  DEBUG("(main) program_name : %s\n",program_name);
  1.5070 +  newargz = XMALLOC(char *, argc+2);
  1.5071 +EOF
  1.5072 +
  1.5073 +	    cat >> $cwrappersource <<EOF
  1.5074 +  newargz[0] = "$SHELL";
  1.5075 +EOF
  1.5076 +
  1.5077 +	    cat >> $cwrappersource <<"EOF"
  1.5078 +  newargz[1] = find_executable(argv[0]);
  1.5079 +  if (newargz[1] == NULL)
  1.5080 +    lt_fatal("Couldn't find %s", argv[0]);
  1.5081 +  DEBUG("(main) found exe at : %s\n",newargz[1]);
  1.5082 +  /* we know the script has the same name, without the .exe */
  1.5083 +  /* so make sure newargz[1] doesn't end in .exe */
  1.5084 +  strendzap(newargz[1],".exe"); 
  1.5085 +  for (i = 1; i < argc; i++)
  1.5086 +    newargz[i+1] = xstrdup(argv[i]);
  1.5087 +  newargz[argc+1] = NULL;
  1.5088 +
  1.5089 +  for (i=0; i<argc+1; i++)
  1.5090 +  {
  1.5091 +    DEBUG("(main) newargz[%d]   : %s\n",i,newargz[i]);
  1.5092 +    ;
  1.5093 +  }
  1.5094 +
  1.5095 +EOF
  1.5096 +
  1.5097 +	    cat >> $cwrappersource <<EOF
  1.5098 +  execv("$SHELL",newargz);
  1.5099 +EOF
  1.5100 +
  1.5101 +	    cat >> $cwrappersource <<"EOF"
  1.5102 +}
  1.5103 +
  1.5104 +void *
  1.5105 +xmalloc (size_t num)
  1.5106 +{
  1.5107 +  void * p = (void *) malloc (num);
  1.5108 +  if (!p)
  1.5109 +    lt_fatal ("Memory exhausted");
  1.5110 +
  1.5111 +  return p;
  1.5112 +}
  1.5113 +
  1.5114 +char * 
  1.5115 +xstrdup (const char *string)
  1.5116 +{
  1.5117 +  return string ? strcpy ((char *) xmalloc (strlen (string) + 1), string) : NULL
  1.5118 +;
  1.5119 +}
  1.5120 +
  1.5121 +char *
  1.5122 +basename (const char *name)
  1.5123 +{
  1.5124 +  const char *base;
  1.5125 +
  1.5126 +#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
  1.5127 +  /* Skip over the disk name in MSDOS pathnames. */
  1.5128 +  if (isalpha (name[0]) && name[1] == ':') 
  1.5129 +    name += 2;
  1.5130 +#endif
  1.5131 +
  1.5132 +  for (base = name; *name; name++)
  1.5133 +    if (IS_DIR_SEPARATOR (*name))
  1.5134 +      base = name + 1;
  1.5135 +  return (char *) base;
  1.5136 +}
  1.5137 +
  1.5138 +int
  1.5139 +check_executable(const char * path)
  1.5140 +{
  1.5141 +  struct stat st;
  1.5142 +
  1.5143 +  DEBUG("(check_executable)  : %s\n", path ? (*path ? path : "EMPTY!") : "NULL!");
  1.5144 +  if ((!path) || (!*path))
  1.5145 +    return 0;
  1.5146 +
  1.5147 +  if ((stat (path, &st) >= 0) &&
  1.5148 +      (((st.st_mode & S_IXOTH) == S_IXOTH) ||
  1.5149 +       ((st.st_mode & S_IXGRP) == S_IXGRP) ||
  1.5150 +       ((st.st_mode & S_IXUSR) == S_IXUSR)))
  1.5151 +    return 1;
  1.5152 +  else
  1.5153 +    return 0;
  1.5154 +}
  1.5155 +
  1.5156 +/* Searches for the full path of the wrapper.  Returns
  1.5157 +   newly allocated full path name if found, NULL otherwise */
  1.5158 +char *
  1.5159 +find_executable (const char* wrapper)
  1.5160 +{
  1.5161 +  int has_slash = 0;
  1.5162 +  const char* p;
  1.5163 +  const char* p_next;
  1.5164 +  struct stat st;
  1.5165 +  /* static buffer for getcwd */
  1.5166 +  char tmp[LT_PATHMAX + 1];
  1.5167 +  int tmp_len;
  1.5168 +  char* concat_name;
  1.5169 +
  1.5170 +  DEBUG("(find_executable)  : %s\n", wrapper ? (*wrapper ? wrapper : "EMPTY!") : "NULL!");
  1.5171 +  
  1.5172 +  if ((wrapper == NULL) || (*wrapper == '\0'))
  1.5173 +    return NULL;
  1.5174 +
  1.5175 +  /* Absolute path? */
  1.5176 +#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
  1.5177 +  if (isalpha (wrapper[0]) && wrapper[1] == ':')
  1.5178 +  {
  1.5179 +    concat_name = xstrdup (wrapper);
  1.5180 +    if (check_executable(concat_name))
  1.5181 +      return concat_name;
  1.5182 +    XFREE(concat_name);
  1.5183 +  }
  1.5184 +  else
  1.5185 +  {
  1.5186 +#endif
  1.5187 +    if (IS_DIR_SEPARATOR (wrapper[0]))
  1.5188 +    {
  1.5189 +      concat_name = xstrdup (wrapper);
  1.5190 +      if (check_executable(concat_name))
  1.5191 +        return concat_name;
  1.5192 +      XFREE(concat_name);
  1.5193 +    }
  1.5194 +#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
  1.5195 +  }
  1.5196 +#endif
  1.5197 +
  1.5198 +  for (p = wrapper; *p; p++)
  1.5199 +    if (*p == '/')
  1.5200 +    {
  1.5201 +      has_slash = 1;
  1.5202 +      break;
  1.5203 +    }
  1.5204 +  if (!has_slash)
  1.5205 +  {
  1.5206 +    /* no slashes; search PATH */
  1.5207 +    const char* path = getenv ("PATH");
  1.5208 +    if (path != NULL)
  1.5209 +    {
  1.5210 +      for (p = path; *p; p = p_next)
  1.5211 +      {
  1.5212 +        const char* q;
  1.5213 +        size_t p_len;
  1.5214 +        for (q = p; *q; q++)
  1.5215 +          if (IS_PATH_SEPARATOR(*q))
  1.5216 +            break;
  1.5217 +        p_len = q - p;
  1.5218 +        p_next = (*q == '\0' ? q : q + 1);
  1.5219 +        if (p_len == 0)
  1.5220 +        {
  1.5221 +          /* empty path: current directory */
  1.5222 +          if (getcwd (tmp, LT_PATHMAX) == NULL)
  1.5223 +            lt_fatal ("getcwd failed");
  1.5224 +          tmp_len = strlen(tmp);
  1.5225 +          concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1);
  1.5226 +          memcpy (concat_name, tmp, tmp_len);
  1.5227 +          concat_name[tmp_len] = '/';
  1.5228 +          strcpy (concat_name + tmp_len + 1, wrapper);
  1.5229 +        }
  1.5230 +        else
  1.5231 +        {
  1.5232 +          concat_name = XMALLOC(char, p_len + 1 + strlen(wrapper) + 1);
  1.5233 +          memcpy (concat_name, p, p_len);
  1.5234 +          concat_name[p_len] = '/';
  1.5235 +          strcpy (concat_name + p_len + 1, wrapper);
  1.5236 +        }
  1.5237 +        if (check_executable(concat_name))
  1.5238 +          return concat_name;
  1.5239 +        XFREE(concat_name);
  1.5240 +      }
  1.5241 +    }
  1.5242 +    /* not found in PATH; assume curdir */
  1.5243 +  }
  1.5244 +  /* Relative path | not found in path: prepend cwd */
  1.5245 +  if (getcwd (tmp, LT_PATHMAX) == NULL)
  1.5246 +    lt_fatal ("getcwd failed");
  1.5247 +  tmp_len = strlen(tmp);
  1.5248 +  concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1);
  1.5249 +  memcpy (concat_name, tmp, tmp_len);
  1.5250 +  concat_name[tmp_len] = '/';
  1.5251 +  strcpy (concat_name + tmp_len + 1, wrapper);
  1.5252 +
  1.5253 +  if (check_executable(concat_name))
  1.5254 +    return concat_name;
  1.5255 +  XFREE(concat_name);
  1.5256 +  return NULL;
  1.5257 +}
  1.5258 +
  1.5259 +char *
  1.5260 +strendzap(char *str, const char *pat) 
  1.5261 +{
  1.5262 +  size_t len, patlen;
  1.5263 +
  1.5264 +  assert(str != NULL);
  1.5265 +  assert(pat != NULL);
  1.5266 +
  1.5267 +  len = strlen(str);
  1.5268 +  patlen = strlen(pat);
  1.5269 +
  1.5270 +  if (patlen <= len)
  1.5271 +  {
  1.5272 +    str += len - patlen;
  1.5273 +    if (strcmp(str, pat) == 0)
  1.5274 +      *str = '\0';
  1.5275 +  }
  1.5276 +  return str;
  1.5277 +}
  1.5278 +
  1.5279 +static void
  1.5280 +lt_error_core (int exit_status, const char * mode, 
  1.5281 +          const char * message, va_list ap)
  1.5282 +{
  1.5283 +  fprintf (stderr, "%s: %s: ", program_name, mode);
  1.5284 +  vfprintf (stderr, message, ap);
  1.5285 +  fprintf (stderr, ".\n");
  1.5286 +
  1.5287 +  if (exit_status >= 0)
  1.5288 +    exit (exit_status);
  1.5289 +}
  1.5290 +
  1.5291 +void
  1.5292 +lt_fatal (const char *message, ...)
  1.5293 +{
  1.5294 +  va_list ap;
  1.5295 +  va_start (ap, message);
  1.5296 +  lt_error_core (EXIT_FAILURE, "FATAL", message, ap);
  1.5297 +  va_end (ap);
  1.5298 +}
  1.5299 +EOF
  1.5300 +	  # we should really use a build-platform specific compiler
  1.5301 +	  # here, but OTOH, the wrappers (shell script and this C one)
  1.5302 +	  # are only useful if you want to execute the "real" binary.
  1.5303 +	  # Since the "real" binary is built for $host, then this
  1.5304 +	  # wrapper might as well be built for $host, too.
  1.5305 +	  $run $LTCC -s -o $cwrapper $cwrappersource
  1.5306 +	  ;;
  1.5307  	esac
  1.5308  	$rm $output
  1.5309  	trap "$rm $output; exit 1" 1 2 15
  1.5310 @@ -2860,7 +4833,7 @@
  1.5311  
  1.5312  # Sed substitution that helps us do robust quoting.  It backslashifies
  1.5313  # metacharacters that are still active within double-quoted strings.
  1.5314 -Xsed='sed -e 1s/^X//'
  1.5315 +Xsed='${SED} -e 1s/^X//'
  1.5316  sed_quote_subst='$sed_quote_subst'
  1.5317  
  1.5318  # The HP-UX ksh and POSIX shell print the target directory to stdout
  1.5319 @@ -2872,7 +4845,7 @@
  1.5320  # This environment variable determines our operation mode.
  1.5321  if test \"\$libtool_install_magic\" = \"$magic\"; then
  1.5322    # install mode needs the following variable:
  1.5323 -  link_against_libtool_libs='$link_against_libtool_libs'
  1.5324 +  notinst_deplibs='$notinst_deplibs'
  1.5325  else
  1.5326    # When we are sourced in execute mode, \$file and \$echo are already set.
  1.5327    if test \"\$libtool_execute_magic\" != \"$magic\"; then
  1.5328 @@ -2898,20 +4871,20 @@
  1.5329    test \"x\$thisdir\" = \"x\$file\" && thisdir=.
  1.5330  
  1.5331    # Follow symbolic links until we get to the real thisdir.
  1.5332 -  file=\`ls -ld \"\$file\" | sed -n 's/.*-> //p'\`
  1.5333 +  file=\`ls -ld \"\$file\" | ${SED} -n 's/.*-> //p'\`
  1.5334    while test -n \"\$file\"; do
  1.5335      destdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\`
  1.5336  
  1.5337      # If there was a directory component, then change thisdir.
  1.5338      if test \"x\$destdir\" != \"x\$file\"; then
  1.5339        case \"\$destdir\" in
  1.5340 -      [\\/]* | [A-Za-z]:[\\/]*) thisdir=\"\$destdir\" ;;
  1.5341 +      [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;;
  1.5342        *) thisdir=\"\$thisdir/\$destdir\" ;;
  1.5343        esac
  1.5344      fi
  1.5345  
  1.5346      file=\`\$echo \"X\$file\" | \$Xsed -e 's%^.*/%%'\`
  1.5347 -    file=\`ls -ld \"\$thisdir/\$file\" | sed -n 's/.*-> //p'\`
  1.5348 +    file=\`ls -ld \"\$thisdir/\$file\" | ${SED} -n 's/.*-> //p'\`
  1.5349    done
  1.5350  
  1.5351    # Try to get the absolute directory name.
  1.5352 @@ -2920,12 +4893,12 @@
  1.5353  "
  1.5354  
  1.5355  	if test "$fast_install" = yes; then
  1.5356 -	  echo >> $output "\
  1.5357 -  program=lt-'$outputname'
  1.5358 +	  $echo >> $output "\
  1.5359 +  program=lt-'$outputname'$exeext
  1.5360    progdir=\"\$thisdir/$objdir\"
  1.5361 -  
  1.5362 +
  1.5363    if test ! -f \"\$progdir/\$program\" || \\
  1.5364 -     { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | sed 1q\`; \\
  1.5365 +     { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\
  1.5366         test \"X\$file\" != \"X\$progdir/\$program\"; }; then
  1.5367  
  1.5368      file=\"\$\$-\$program\"
  1.5369 @@ -2936,12 +4909,13 @@
  1.5370        $rm \"\$progdir/\$file\"
  1.5371      fi"
  1.5372  
  1.5373 -	  echo >> $output "\
  1.5374 +	  $echo >> $output "\
  1.5375  
  1.5376      # relink executable if necessary
  1.5377      if test -n \"\$relink_command\"; then
  1.5378 -      if (cd \"\$thisdir\" && eval \$relink_command); then :
  1.5379 +      if relink_command_output=\`eval \$relink_command 2>&1\`; then :
  1.5380        else
  1.5381 +	$echo \"\$relink_command_output\" >&2
  1.5382  	$rm \"\$progdir/\$file\"
  1.5383  	exit 1
  1.5384        fi
  1.5385 @@ -2953,13 +4927,13 @@
  1.5386      $rm \"\$progdir/\$file\"
  1.5387    fi"
  1.5388  	else
  1.5389 -	  echo >> $output "\
  1.5390 +	  $echo >> $output "\
  1.5391    program='$outputname'
  1.5392    progdir=\"\$thisdir/$objdir\"
  1.5393  "
  1.5394  	fi
  1.5395  
  1.5396 -	echo >> $output "\
  1.5397 +	$echo >> $output "\
  1.5398  
  1.5399    if test -f \"\$progdir/\$program\"; then"
  1.5400  
  1.5401 @@ -2990,14 +4964,6 @@
  1.5402        # Run the actual program with our arguments.
  1.5403  "
  1.5404  	case $host in
  1.5405 -	  # win32 systems need to use the prog path for dll
  1.5406 -	  # lookup to work
  1.5407 -	*-*-cygwin*)
  1.5408 -	  $echo >> $output "\
  1.5409 -      exec \$progdir/\$program \${1+\"\$@\"}
  1.5410 -"
  1.5411 -	  ;;
  1.5412 -
  1.5413  	# Backslashes separate directories on plain windows
  1.5414  	*-*-mingw | *-*-os2*)
  1.5415  	  $echo >> $output "\
  1.5416 @@ -3007,11 +4973,7 @@
  1.5417  
  1.5418  	*)
  1.5419  	  $echo >> $output "\
  1.5420 -      # Export the path to the program.
  1.5421 -      PATH=\"\$progdir:\$PATH\"
  1.5422 -      export PATH
  1.5423 -
  1.5424 -      exec \$program \${1+\"\$@\"}
  1.5425 +      exec \$progdir/\$program \${1+\"\$@\"}
  1.5426  "
  1.5427  	  ;;
  1.5428  	esac
  1.5429 @@ -3023,7 +4985,7 @@
  1.5430      # The program doesn't exist.
  1.5431      \$echo \"\$0: error: \$progdir/\$program does not exist\" 1>&2
  1.5432      \$echo \"This script is just a wrapper for \$program.\" 1>&2
  1.5433 -    echo \"See the $PACKAGE documentation for more information.\" 1>&2
  1.5434 +    $echo \"See the $PACKAGE documentation for more information.\" 1>&2
  1.5435      exit 1
  1.5436    fi
  1.5437  fi\
  1.5438 @@ -3046,7 +5008,7 @@
  1.5439  	  oldobjs="$libobjs_save"
  1.5440  	  build_libtool_libs=no
  1.5441  	else
  1.5442 -	  oldobjs="$objs "`$echo "X$libobjs_save" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`
  1.5443 +	  oldobjs="$old_deplibs $non_pic_objects"
  1.5444  	fi
  1.5445  	addlibs="$old_convenience"
  1.5446        fi
  1.5447 @@ -3055,18 +5017,18 @@
  1.5448  	gentop="$output_objdir/${outputname}x"
  1.5449  	$show "${rm}r $gentop"
  1.5450  	$run ${rm}r "$gentop"
  1.5451 -	$show "mkdir $gentop"
  1.5452 -	$run mkdir "$gentop"
  1.5453 +	$show "$mkdir $gentop"
  1.5454 +	$run $mkdir "$gentop"
  1.5455  	status=$?
  1.5456 -	if test $status -ne 0 && test ! -d "$gentop"; then
  1.5457 +	if test "$status" -ne 0 && test ! -d "$gentop"; then
  1.5458  	  exit $status
  1.5459  	fi
  1.5460  	generated="$generated $gentop"
  1.5461 -	  
  1.5462 +
  1.5463  	# Add in members from convenience archives.
  1.5464  	for xlib in $addlibs; do
  1.5465  	  # Extract the objects.
  1.5466 -	  case "$xlib" in
  1.5467 +	  case $xlib in
  1.5468  	  [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
  1.5469  	  *) xabs=`pwd`"/$xlib" ;;
  1.5470  	  esac
  1.5471 @@ -3075,14 +5037,40 @@
  1.5472  
  1.5473  	  $show "${rm}r $xdir"
  1.5474  	  $run ${rm}r "$xdir"
  1.5475 -	  $show "mkdir $xdir"
  1.5476 -	  $run mkdir "$xdir"
  1.5477 +	  $show "$mkdir $xdir"
  1.5478 +	  $run $mkdir "$xdir"
  1.5479  	  status=$?
  1.5480 -	  if test $status -ne 0 && test ! -d "$xdir"; then
  1.5481 +	  if test "$status" -ne 0 && test ! -d "$xdir"; then
  1.5482  	    exit $status
  1.5483  	  fi
  1.5484 +	  # We will extract separately just the conflicting names and we will no
  1.5485 +	  # longer touch any unique names. It is faster to leave these extract
  1.5486 +	  # automatically by $AR in one run.
  1.5487  	  $show "(cd $xdir && $AR x $xabs)"
  1.5488  	  $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
  1.5489 +	  if ($AR t "$xabs" | sort | sort -uc >/dev/null 2>&1); then
  1.5490 +	    :
  1.5491 +	  else
  1.5492 +	    $echo "$modename: warning: object name conflicts; renaming object files" 1>&2
  1.5493 +	    $echo "$modename: warning: to ensure that they will not overwrite" 1>&2
  1.5494 +	    $AR t "$xabs" | sort | uniq -cd | while read -r count name
  1.5495 +	    do
  1.5496 +	      i=1
  1.5497 +	      while test "$i" -le "$count"
  1.5498 +	      do
  1.5499 +	       # Put our $i before any first dot (extension)
  1.5500 +	       # Never overwrite any file
  1.5501 +	       name_to="$name"
  1.5502 +	       while test "X$name_to" = "X$name" || test -f "$xdir/$name_to"
  1.5503 +	       do
  1.5504 +		 name_to=`$echo "X$name_to" | $Xsed -e "s/\([^.]*\)/\1-$i/"`
  1.5505 +	       done
  1.5506 +	       $show "(cd $xdir && $AR xN $i $xabs '$name' && $mv '$name' '$name_to')"
  1.5507 +	       $run eval "(cd \$xdir && $AR xN $i \$xabs '$name' && $mv '$name' '$name_to')" || exit $?
  1.5508 +	       i=`expr $i + 1`
  1.5509 +	      done
  1.5510 +	    done
  1.5511 +	  fi
  1.5512  
  1.5513  	  oldobjs="$oldobjs "`find $xdir -name \*.${objext} -print -o -name \*.lo -print | $NL2SP`
  1.5514  	done
  1.5515 @@ -3092,27 +5080,67 @@
  1.5516        if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then
  1.5517  	eval cmds=\"$old_archive_from_new_cmds\"
  1.5518        else
  1.5519 -	# Ensure that we have .o objects in place in case we decided
  1.5520 -	# not to build a shared library, and have fallen back to building
  1.5521 -	# static libs even though --disable-static was passed!
  1.5522 -	for oldobj in $oldobjs; do
  1.5523 -	  if test ! -f $oldobj; then
  1.5524 -	    xdir=`$echo "X$oldobj" | $Xsed -e 's%/[^/]*$%%'`
  1.5525 -	    if test "X$xdir" = "X$oldobj"; then
  1.5526 -	      xdir="."
  1.5527 +	eval cmds=\"$old_archive_cmds\"
  1.5528 +
  1.5529 +	if len=`expr "X$cmds" : ".*"` &&
  1.5530 +	     test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
  1.5531 +	  :
  1.5532 +	else
  1.5533 +	  # the command line is too long to link in one step, link in parts
  1.5534 +	  $echo "using piecewise archive linking..."
  1.5535 +	  save_RANLIB=$RANLIB
  1.5536 +	  RANLIB=:
  1.5537 +	  objlist=
  1.5538 +	  concat_cmds=
  1.5539 +	  save_oldobjs=$oldobjs
  1.5540 +	  # GNU ar 2.10+ was changed to match POSIX; thus no paths are
  1.5541 +	  # encoded into archives.  This makes 'ar r' malfunction in
  1.5542 +	  # this piecewise linking case whenever conflicting object
  1.5543 +	  # names appear in distinct ar calls; check, warn and compensate.
  1.5544 +	    if (for obj in $save_oldobjs
  1.5545 +	    do
  1.5546 +	      $echo "X$obj" | $Xsed -e 's%^.*/%%'
  1.5547 +	    done | sort | sort -uc >/dev/null 2>&1); then
  1.5548 +	    :
  1.5549 +	  else
  1.5550 +	    $echo "$modename: warning: object name conflicts; overriding AR_FLAGS to 'cq'" 1>&2
  1.5551 +	    $echo "$modename: warning: to ensure that POSIX-compatible ar will work" 1>&2
  1.5552 +	    AR_FLAGS=cq
  1.5553 +	  fi
  1.5554 +	  # Is there a better way of finding the last object in the list?
  1.5555 +	  for obj in $save_oldobjs
  1.5556 +	  do
  1.5557 +	    last_oldobj=$obj
  1.5558 +	  done  
  1.5559 +	  for obj in $save_oldobjs
  1.5560 +	  do
  1.5561 +	    oldobjs="$objlist $obj"
  1.5562 +	    objlist="$objlist $obj"
  1.5563 +	    eval test_cmds=\"$old_archive_cmds\"
  1.5564 +	    if len=`expr "X$test_cmds" : ".*"` &&
  1.5565 +	       test "$len" -le "$max_cmd_len"; then
  1.5566 +	      :
  1.5567  	    else
  1.5568 -	      xdir="$xdir"
  1.5569 +	      # the above command should be used before it gets too long
  1.5570 +	      oldobjs=$objlist
  1.5571 +	      if test "$obj" = "$last_oldobj" ; then
  1.5572 +	        RANLIB=$save_RANLIB
  1.5573 +	      fi  
  1.5574 +	      test -z "$concat_cmds" || concat_cmds=$concat_cmds~
  1.5575 +	      eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\"
  1.5576 +	      objlist=
  1.5577  	    fi
  1.5578 -	    baseobj=`$echo "X$oldobj" | $Xsed -e 's%^.*/%%'`
  1.5579 -	    obj=`$echo "X$baseobj" | $Xsed -e "$o2lo"`
  1.5580 -	    $show "(cd $xdir && ${LN_S} $obj $baseobj)"
  1.5581 -	    $run eval '(cd $xdir && ${LN_S} $obj $baseobj)' || exit $?
  1.5582 +	  done
  1.5583 +	  RANLIB=$save_RANLIB
  1.5584 +	  oldobjs=$objlist
  1.5585 +	  if test "X$oldobjs" = "X" ; then
  1.5586 +	    eval cmds=\"\$concat_cmds\"
  1.5587 +	  else
  1.5588 +	    eval cmds=\"\$concat_cmds~$old_archive_cmds\"
  1.5589  	  fi
  1.5590 -	done
  1.5591 -
  1.5592 -	eval cmds=\"$old_archive_cmds\"
  1.5593 +	fi
  1.5594        fi
  1.5595 -      IFS="${IFS= 	}"; save_ifs="$IFS"; IFS='~'
  1.5596 +      save_ifs="$IFS"; IFS='~'
  1.5597        for cmd in $cmds; do
  1.5598  	IFS="$save_ifs"
  1.5599  	$show "$cmd"
  1.5600 @@ -3127,19 +5155,26 @@
  1.5601      fi
  1.5602  
  1.5603      # Now create the libtool archive.
  1.5604 -    case "$output" in
  1.5605 +    case $output in
  1.5606      *.la)
  1.5607        old_library=
  1.5608        test "$build_old_libs" = yes && old_library="$libname.$libext"
  1.5609        $show "creating $output"
  1.5610  
  1.5611 -      if test -n "$xrpath"; then
  1.5612 -	temp_xrpath=
  1.5613 -	for libdir in $xrpath; do
  1.5614 -	  temp_xrpath="$temp_xrpath -R$libdir"
  1.5615 -	done
  1.5616 -	dependency_libs="$temp_xrpath $dependency_libs"
  1.5617 -      fi
  1.5618 +      # Preserve any variables that may affect compiler behavior
  1.5619 +      for var in $variables_saved_for_relink; do
  1.5620 +	if eval test -z \"\${$var+set}\"; then
  1.5621 +	  relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command"
  1.5622 +	elif eval var_value=\$$var; test -z "$var_value"; then
  1.5623 +	  relink_command="$var=; export $var; $relink_command"
  1.5624 +	else
  1.5625 +	  var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"`
  1.5626 +	  relink_command="$var=\"$var_value\"; export $var; $relink_command"
  1.5627 +	fi
  1.5628 +      done
  1.5629 +      # Quote the link command for shipping.
  1.5630 +      relink_command="(cd `pwd`; $SHELL $0 --mode=relink $libtool_args @inst_prefix_dir@)"
  1.5631 +      relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"`
  1.5632  
  1.5633        # Only create the output if not a dry run.
  1.5634        if test -z "$run"; then
  1.5635 @@ -3149,8 +5184,52 @@
  1.5636  	      break
  1.5637  	    fi
  1.5638  	    output="$output_objdir/$outputname"i
  1.5639 +	    # Replace all uninstalled libtool libraries with the installed ones
  1.5640 +	    newdependency_libs=
  1.5641 +	    for deplib in $dependency_libs; do
  1.5642 +	      case $deplib in
  1.5643 +	      *.la)
  1.5644 +		name=`$echo "X$deplib" | $Xsed -e 's%^.*/%%'`
  1.5645 +		eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
  1.5646 +		if test -z "$libdir"; then
  1.5647 +		  $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
  1.5648 +		  exit 1
  1.5649 +		fi
  1.5650 +		newdependency_libs="$newdependency_libs $libdir/$name"
  1.5651 +		;;
  1.5652 +	      *) newdependency_libs="$newdependency_libs $deplib" ;;
  1.5653 +	      esac
  1.5654 +	    done
  1.5655 +	    dependency_libs="$newdependency_libs"
  1.5656 +	    newdlfiles=
  1.5657 +	    for lib in $dlfiles; do
  1.5658 +	      name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
  1.5659 +	      eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
  1.5660 +	      if test -z "$libdir"; then
  1.5661 +		$echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
  1.5662 +		exit 1
  1.5663 +	      fi
  1.5664 +	      newdlfiles="$newdlfiles $libdir/$name"
  1.5665 +	    done
  1.5666 +	    dlfiles="$newdlfiles"
  1.5667 +	    newdlprefiles=
  1.5668 +	    for lib in $dlprefiles; do
  1.5669 +	      name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
  1.5670 +	      eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
  1.5671 +	      if test -z "$libdir"; then
  1.5672 +		$echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
  1.5673 +		exit 1
  1.5674 +	      fi
  1.5675 +	      newdlprefiles="$newdlprefiles $libdir/$name"
  1.5676 +	    done
  1.5677 +	    dlprefiles="$newdlprefiles"
  1.5678  	  fi
  1.5679  	  $rm $output
  1.5680 +	  # place dlname in correct position for cygwin
  1.5681 +	  tdlname=$dlname
  1.5682 +	  case $host,$output,$installed,$module,$dlname in
  1.5683 +	    *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;;
  1.5684 +	  esac
  1.5685  	  $echo > $output "\
  1.5686  # $outputname - a libtool library file
  1.5687  # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
  1.5688 @@ -3159,7 +5238,7 @@
  1.5689  # It is necessary for linking the library.
  1.5690  
  1.5691  # The name that we can dlopen(3).
  1.5692 -dlname='$dlname'
  1.5693 +dlname='$tdlname'
  1.5694  
  1.5695  # Names of this library.
  1.5696  library_names='$library_names'
  1.5697 @@ -3178,16 +5257,26 @@
  1.5698  # Is this an already installed library?
  1.5699  installed=$installed
  1.5700  
  1.5701 +# Should we warn about portability when linking against -modules?
  1.5702 +shouldnotlink=$module
  1.5703 +
  1.5704 +# Files to dlopen/dlpreopen
  1.5705 +dlopen='$dlfiles'
  1.5706 +dlpreopen='$dlprefiles'
  1.5707 +
  1.5708  # Directory that this library needs to be installed in:
  1.5709 -libdir='$install_libdir'\
  1.5710 -"
  1.5711 +libdir='$install_libdir'"
  1.5712 +	  if test "$installed" = no && test "$need_relink" = yes; then
  1.5713 +	    $echo >> $output "\
  1.5714 +relink_command=\"$relink_command\""
  1.5715 +	  fi
  1.5716  	done
  1.5717        fi
  1.5718  
  1.5719        # Do a symbolic link so that the libtool archive can be found in
  1.5720        # LD_LIBRARY_PATH before the program is installed.
  1.5721        $show "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)"
  1.5722 -      $run eval "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)" || exit $?
  1.5723 +      $run eval '(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)' || exit $?
  1.5724        ;;
  1.5725      esac
  1.5726      exit 0
  1.5727 @@ -3199,10 +5288,12 @@
  1.5728  
  1.5729      # There may be an optional sh(1) argument at the beginning of
  1.5730      # install_prog (especially on Windows NT).
  1.5731 -    if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh; then
  1.5732 +    if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh ||
  1.5733 +       # Allow the use of GNU shtool's install command.
  1.5734 +       $echo "X$nonopt" | $Xsed | grep shtool > /dev/null; then
  1.5735        # Aesthetically quote it.
  1.5736        arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"`
  1.5737 -      case "$arg" in
  1.5738 +      case $arg in
  1.5739        *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*)
  1.5740  	arg="\"$arg\""
  1.5741  	;;
  1.5742 @@ -3218,7 +5309,7 @@
  1.5743      # The real first argument should be the name of the installation program.
  1.5744      # Aesthetically quote it.
  1.5745      arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
  1.5746 -    case "$arg" in
  1.5747 +    case $arg in
  1.5748      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*)
  1.5749        arg="\"$arg\""
  1.5750        ;;
  1.5751 @@ -3241,7 +5332,7 @@
  1.5752  	continue
  1.5753        fi
  1.5754  
  1.5755 -      case "$arg" in
  1.5756 +      case $arg in
  1.5757        -d) isdir=yes ;;
  1.5758        -f) prev="-f" ;;
  1.5759        -g) prev="-g" ;;
  1.5760 @@ -3266,7 +5357,7 @@
  1.5761  
  1.5762        # Aesthetically quote the argument.
  1.5763        arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
  1.5764 -      case "$arg" in
  1.5765 +      case $arg in
  1.5766        *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*)
  1.5767  	arg="\"$arg\""
  1.5768  	;;
  1.5769 @@ -3311,17 +5402,17 @@
  1.5770  
  1.5771        # Not a directory, so check to see that there is only one file specified.
  1.5772        set dummy $files
  1.5773 -      if test $# -gt 2; then
  1.5774 +      if test "$#" -gt 2; then
  1.5775  	$echo "$modename: \`$dest' is not a directory" 1>&2
  1.5776  	$echo "$help" 1>&2
  1.5777  	exit 1
  1.5778        fi
  1.5779      fi
  1.5780 -    case "$destdir" in
  1.5781 +    case $destdir in
  1.5782      [\\/]* | [A-Za-z]:[\\/]*) ;;
  1.5783      *)
  1.5784        for file in $files; do
  1.5785 -	case "$file" in
  1.5786 +	case $file in
  1.5787  	*.lo) ;;
  1.5788  	*)
  1.5789  	  $echo "$modename: \`$destdir' must be an absolute directory name" 1>&2
  1.5790 @@ -3343,15 +5434,15 @@
  1.5791      for file in $files; do
  1.5792  
  1.5793        # Do each installation.
  1.5794 -      case "$file" in
  1.5795 -      *.a | *.lib)
  1.5796 +      case $file in
  1.5797 +      *.$libext)
  1.5798  	# Do the static libraries later.
  1.5799  	staticlibs="$staticlibs $file"
  1.5800  	;;
  1.5801  
  1.5802        *.la)
  1.5803  	# Check to see that this really is a libtool archive.
  1.5804 -	if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
  1.5805 +	if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
  1.5806  	else
  1.5807  	  $echo "$modename: \`$file' is not a valid libtool archive" 1>&2
  1.5808  	  $echo "$help" 1>&2
  1.5809 @@ -3360,8 +5451,9 @@
  1.5810  
  1.5811  	library_names=
  1.5812  	old_library=
  1.5813 +	relink_command=
  1.5814  	# If there is no directory component, then add one.
  1.5815 -	case "$file" in
  1.5816 +	case $file in
  1.5817  	*/* | *\\*) . $file ;;
  1.5818  	*) . ./$file ;;
  1.5819  	esac
  1.5820 @@ -3380,10 +5472,41 @@
  1.5821  	  esac
  1.5822  	fi
  1.5823  
  1.5824 -	dir="`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`/"
  1.5825 +	dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`/
  1.5826  	test "X$dir" = "X$file/" && dir=
  1.5827  	dir="$dir$objdir"
  1.5828  
  1.5829 +	if test -n "$relink_command"; then
  1.5830 +	  # Determine the prefix the user has applied to our future dir.
  1.5831 +	  inst_prefix_dir=`$echo "$destdir" | $SED "s%$libdir\$%%"`
  1.5832 +
  1.5833 +	  # Don't allow the user to place us outside of our expected
  1.5834 +	  # location b/c this prevents finding dependent libraries that
  1.5835 +	  # are installed to the same prefix.
  1.5836 +	  # At present, this check doesn't affect windows .dll's that
  1.5837 +	  # are installed into $libdir/../bin (currently, that works fine)
  1.5838 +	  # but it's something to keep an eye on.
  1.5839 +	  if test "$inst_prefix_dir" = "$destdir"; then
  1.5840 +	    $echo "$modename: error: cannot install \`$file' to a directory not ending in $libdir" 1>&2
  1.5841 +	    exit 1
  1.5842 +	  fi
  1.5843 +
  1.5844 +	  if test -n "$inst_prefix_dir"; then
  1.5845 +	    # Stick the inst_prefix_dir data into the link command.
  1.5846 +	    relink_command=`$echo "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"`
  1.5847 +	  else
  1.5848 +	    relink_command=`$echo "$relink_command" | $SED "s%@inst_prefix_dir@%%"`
  1.5849 +	  fi
  1.5850 +
  1.5851 +	  $echo "$modename: warning: relinking \`$file'" 1>&2
  1.5852 +	  $show "$relink_command"
  1.5853 +	  if $run eval "$relink_command"; then :
  1.5854 +	  else
  1.5855 +	    $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
  1.5856 +	    exit 1
  1.5857 +	  fi
  1.5858 +	fi
  1.5859 +
  1.5860  	# See the names of the shared library.
  1.5861  	set dummy $library_names
  1.5862  	if test -n "$2"; then
  1.5863 @@ -3391,11 +5514,18 @@
  1.5864  	  shift
  1.5865  	  shift
  1.5866  
  1.5867 +	  srcname="$realname"
  1.5868 +	  test -n "$relink_command" && srcname="$realname"T
  1.5869 +
  1.5870  	  # Install the shared library and build the symlinks.
  1.5871 -	  $show "$install_prog $dir/$realname $destdir/$realname"
  1.5872 -	  $run eval "$install_prog $dir/$realname $destdir/$realname" || exit $?
  1.5873 -
  1.5874 -	  if test $# -gt 0; then
  1.5875 +	  $show "$install_prog $dir/$srcname $destdir/$realname"
  1.5876 +	  $run eval "$install_prog $dir/$srcname $destdir/$realname" || exit $?
  1.5877 +	  if test -n "$stripme" && test -n "$striplib"; then
  1.5878 +	    $show "$striplib $destdir/$realname"
  1.5879 +	    $run eval "$striplib $destdir/$realname" || exit $?
  1.5880 +	  fi
  1.5881 +
  1.5882 +	  if test "$#" -gt 0; then
  1.5883  	    # Delete the old symlinks, and create new ones.
  1.5884  	    for linkname
  1.5885  	    do
  1.5886 @@ -3409,7 +5539,7 @@
  1.5887  	  # Do each command in the postinstall commands.
  1.5888  	  lib="$destdir/$realname"
  1.5889  	  eval cmds=\"$postinstall_cmds\"
  1.5890 -	  IFS="${IFS= 	}"; save_ifs="$IFS"; IFS='~'
  1.5891 +	  save_ifs="$IFS"; IFS='~'
  1.5892  	  for cmd in $cmds; do
  1.5893  	    IFS="$save_ifs"
  1.5894  	    $show "$cmd"
  1.5895 @@ -3440,11 +5570,11 @@
  1.5896  	fi
  1.5897  
  1.5898  	# Deduce the name of the destination old-style object file.
  1.5899 -	case "$destfile" in
  1.5900 +	case $destfile in
  1.5901  	*.lo)
  1.5902  	  staticdest=`$echo "X$destfile" | $Xsed -e "$lo2o"`
  1.5903  	  ;;
  1.5904 -	*.o | *.obj)
  1.5905 +	*.$objext)
  1.5906  	  staticdest="$destfile"
  1.5907  	  destfile=
  1.5908  	  ;;
  1.5909 @@ -3481,41 +5611,83 @@
  1.5910  	  destfile="$destdir/$destfile"
  1.5911  	fi
  1.5912  
  1.5913 +	# If the file is missing, and there is a .exe on the end, strip it
  1.5914 +	# because it is most likely a libtool script we actually want to
  1.5915 +	# install
  1.5916 +	stripped_ext=""
  1.5917 +	case $file in
  1.5918 +	  *.exe)
  1.5919 +	    if test ! -f "$file"; then
  1.5920 +	      file=`$echo $file|${SED} 's,.exe$,,'`
  1.5921 +	      stripped_ext=".exe"
  1.5922 +	    fi
  1.5923 +	    ;;
  1.5924 +	esac
  1.5925 +
  1.5926  	# Do a test to see if this is really a libtool program.
  1.5927 -	if (sed -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
  1.5928 -	  link_against_libtool_libs=
  1.5929 +	case $host in
  1.5930 +	*cygwin*|*mingw*)
  1.5931 +	    wrapper=`$echo $file | ${SED} -e 's,.exe$,,'`
  1.5932 +	    ;;
  1.5933 +	*)
  1.5934 +	    wrapper=$file
  1.5935 +	    ;;
  1.5936 +	esac
  1.5937 +	if (${SED} -e '4q' $wrapper | grep "^# Generated by .*$PACKAGE")>/dev/null 2>&1; then
  1.5938 +	  notinst_deplibs=
  1.5939  	  relink_command=
  1.5940  
  1.5941 +	  # To insure that "foo" is sourced, and not "foo.exe",
  1.5942 +	  # finese the cygwin/MSYS system by explicitly sourcing "foo."
  1.5943 +	  # which disallows the automatic-append-.exe behavior.
  1.5944 +	  case $build in
  1.5945 +	  *cygwin* | *mingw*) wrapperdot=${wrapper}. ;;
  1.5946 +	  *) wrapperdot=${wrapper} ;;
  1.5947 +	  esac
  1.5948  	  # If there is no directory component, then add one.
  1.5949 -	  case "$file" in
  1.5950 -	  */* | *\\*) . $file ;;
  1.5951 -	  *) . ./$file ;;
  1.5952 +	  case $file in
  1.5953 +	  */* | *\\*) . ${wrapperdot} ;;
  1.5954 +	  *) . ./${wrapperdot} ;;
  1.5955  	  esac
  1.5956  
  1.5957  	  # Check the variables that should have been set.
  1.5958 -	  if test -z "$link_against_libtool_libs"; then
  1.5959 -	    $echo "$modename: invalid libtool wrapper script \`$file'" 1>&2
  1.5960 +	  if test -z "$notinst_deplibs"; then
  1.5961 +	    $echo "$modename: invalid libtool wrapper script \`$wrapper'" 1>&2
  1.5962  	    exit 1
  1.5963  	  fi
  1.5964  
  1.5965  	  finalize=yes
  1.5966 -	  for lib in $link_against_libtool_libs; do
  1.5967 +	  for lib in $notinst_deplibs; do
  1.5968  	    # Check to see that each library is installed.
  1.5969  	    libdir=
  1.5970  	    if test -f "$lib"; then
  1.5971  	      # If there is no directory component, then add one.
  1.5972 -	      case "$lib" in
  1.5973 +	      case $lib in
  1.5974  	      */* | *\\*) . $lib ;;
  1.5975  	      *) . ./$lib ;;
  1.5976  	      esac
  1.5977  	    fi
  1.5978 -	    libfile="$libdir/`$echo "X$lib" | $Xsed -e 's%^.*/%%g'`"
  1.5979 +	    libfile="$libdir/"`$echo "X$lib" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test
  1.5980  	    if test -n "$libdir" && test ! -f "$libfile"; then
  1.5981  	      $echo "$modename: warning: \`$lib' has not been installed in \`$libdir'" 1>&2
  1.5982  	      finalize=no
  1.5983  	    fi
  1.5984  	  done
  1.5985  
  1.5986 +	  relink_command=
  1.5987 +	  # To insure that "foo" is sourced, and not "foo.exe",
  1.5988 +	  # finese the cygwin/MSYS system by explicitly sourcing "foo."
  1.5989 +	  # which disallows the automatic-append-.exe behavior.
  1.5990 +	  case $build in
  1.5991 +	  *cygwin* | *mingw*) wrapperdot=${wrapper}. ;;
  1.5992 +	  *) wrapperdot=${wrapper} ;;
  1.5993 +	  esac
  1.5994 +	  # If there is no directory component, then add one.
  1.5995 +	  case $file in
  1.5996 +	  */* | *\\*) . ${wrapperdot} ;;
  1.5997 +	  *) . ./${wrapperdot} ;;
  1.5998 +	  esac
  1.5999 +
  1.6000  	  outputname=
  1.6001  	  if test "$fast_install" = no && test -n "$relink_command"; then
  1.6002  	    if test "$finalize" = yes && test -z "$run"; then
  1.6003 @@ -3527,6 +5699,7 @@
  1.6004  		$echo "$modename: error: cannot create temporary directory \`$tmpdir'" 1>&2
  1.6005  		continue
  1.6006  	      fi
  1.6007 +	      file=`$echo "X$file$stripped_ext" | $Xsed -e 's%^.*/%%'`
  1.6008  	      outputname="$tmpdir/$file"
  1.6009  	      # Replace the output file specification.
  1.6010  	      relink_command=`$echo "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'`
  1.6011 @@ -3544,10 +5717,27 @@
  1.6012  	    fi
  1.6013  	  else
  1.6014  	    # Install the binary that we compiled earlier.
  1.6015 -	    file=`$echo "X$file" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"`
  1.6016 +	    file=`$echo "X$file$stripped_ext" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"`
  1.6017  	  fi
  1.6018  	fi
  1.6019  
  1.6020 +	# remove .exe since cygwin /usr/bin/install will append another
  1.6021 +	# one anyways
  1.6022 +	case $install_prog,$host in
  1.6023 +	*/usr/bin/install*,*cygwin*)
  1.6024 +	  case $file:$destfile in
  1.6025 +	  *.exe:*.exe)
  1.6026 +	    # this is ok
  1.6027 +	    ;;
  1.6028 +	  *.exe:*)
  1.6029 +	    destfile=$destfile.exe
  1.6030 +	    ;;
  1.6031 +	  *:*.exe)
  1.6032 +	    destfile=`$echo $destfile | ${SED} -e 's,.exe$,,'`
  1.6033 +	    ;;
  1.6034 +	  esac
  1.6035 +	  ;;
  1.6036 +	esac
  1.6037  	$show "$install_prog$stripme $file $destfile"
  1.6038  	$run eval "$install_prog\$stripme \$file \$destfile" || exit $?
  1.6039  	test -n "$outputname" && ${rm}r "$tmpdir"
  1.6040 @@ -3564,9 +5754,14 @@
  1.6041        $show "$install_prog $file $oldlib"
  1.6042        $run eval "$install_prog \$file \$oldlib" || exit $?
  1.6043  
  1.6044 +      if test -n "$stripme" && test -n "$striplib"; then
  1.6045 +	$show "$old_striplib $oldlib"
  1.6046 +	$run eval "$old_striplib $oldlib" || exit $?
  1.6047 +      fi
  1.6048 +
  1.6049        # Do each command in the postinstall commands.
  1.6050        eval cmds=\"$old_postinstall_cmds\"
  1.6051 -      IFS="${IFS= 	}"; save_ifs="$IFS"; IFS='~'
  1.6052 +      save_ifs="$IFS"; IFS='~'
  1.6053        for cmd in $cmds; do
  1.6054  	IFS="$save_ifs"
  1.6055  	$show "$cmd"
  1.6056 @@ -3582,11 +5777,10 @@
  1.6057      if test -n "$current_libdirs"; then
  1.6058        # Maybe just do a dry run.
  1.6059        test -n "$run" && current_libdirs=" -n$current_libdirs"
  1.6060 -      exec $SHELL $0 --finish$current_libdirs
  1.6061 -      exit 1
  1.6062 +      exec_cmd='$SHELL $0 --finish$current_libdirs'
  1.6063 +    else
  1.6064 +      exit 0
  1.6065      fi
  1.6066 -
  1.6067 -    exit 0
  1.6068      ;;
  1.6069  
  1.6070    # libtool finish mode
  1.6071 @@ -3605,7 +5799,7 @@
  1.6072  	if test -n "$finish_cmds"; then
  1.6073  	  # Do each command in the finish commands.
  1.6074  	  eval cmds=\"$finish_cmds\"
  1.6075 -	  IFS="${IFS= 	}"; save_ifs="$IFS"; IFS='~'
  1.6076 +	  save_ifs="$IFS"; IFS='~'
  1.6077  	  for cmd in $cmds; do
  1.6078  	    IFS="$save_ifs"
  1.6079  	    $show "$cmd"
  1.6080 @@ -3626,40 +5820,40 @@
  1.6081      # Exit here if they wanted silent mode.
  1.6082      test "$show" = : && exit 0
  1.6083  
  1.6084 -    echo "----------------------------------------------------------------------"
  1.6085 -    echo "Libraries have been installed in:"
  1.6086 +    $echo "----------------------------------------------------------------------"
  1.6087 +    $echo "Libraries have been installed in:"
  1.6088      for libdir in $libdirs; do
  1.6089 -      echo "   $libdir"
  1.6090 +      $echo "   $libdir"
  1.6091      done
  1.6092 -    echo
  1.6093 -    echo "If you ever happen to want to link against installed libraries"
  1.6094 -    echo "in a given directory, LIBDIR, you must either use libtool, and"
  1.6095 -    echo "specify the full pathname of the library, or use \`-LLIBDIR'"
  1.6096 -    echo "flag during linking and do at least one of the following:"
  1.6097 +    $echo
  1.6098 +    $echo "If you ever happen to want to link against installed libraries"
  1.6099 +    $echo "in a given directory, LIBDIR, you must either use libtool, and"
  1.6100 +    $echo "specify the full pathname of the library, or use the \`-LLIBDIR'"
  1.6101 +    $echo "flag during linking and do at least one of the following:"
  1.6102      if test -n "$shlibpath_var"; then
  1.6103 -      echo "   - add LIBDIR to the \`$shlibpath_var' environment variable"
  1.6104 -      echo "     during execution"
  1.6105 +      $echo "   - add LIBDIR to the \`$shlibpath_var' environment variable"
  1.6106 +      $echo "     during execution"
  1.6107      fi
  1.6108      if test -n "$runpath_var"; then
  1.6109 -      echo "   - add LIBDIR to the \`$runpath_var' environment variable"
  1.6110 -      echo "     during linking"
  1.6111 +      $echo "   - add LIBDIR to the \`$runpath_var' environment variable"
  1.6112 +      $echo "     during linking"
  1.6113      fi
  1.6114      if test -n "$hardcode_libdir_flag_spec"; then
  1.6115        libdir=LIBDIR
  1.6116        eval flag=\"$hardcode_libdir_flag_spec\"
  1.6117  
  1.6118 -      echo "   - use the \`$flag' linker flag"
  1.6119 +      $echo "   - use the \`$flag' linker flag"
  1.6120      fi
  1.6121      if test -n "$admincmds"; then
  1.6122 -      echo "   - have your system administrator run these commands:$admincmds"
  1.6123 +      $echo "   - have your system administrator run these commands:$admincmds"
  1.6124      fi
  1.6125      if test -f /etc/ld.so.conf; then
  1.6126 -      echo "   - have your system administrator add LIBDIR to \`/etc/ld.so.conf'"
  1.6127 +      $echo "   - have your system administrator add LIBDIR to \`/etc/ld.so.conf'"
  1.6128      fi
  1.6129 -    echo
  1.6130 -    echo "See any operating system documentation about shared libraries for"
  1.6131 -    echo "more information, such as the ld(1) and ld.so(8) manual pages."
  1.6132 -    echo "----------------------------------------------------------------------"
  1.6133 +    $echo
  1.6134 +    $echo "See any operating system documentation about shared libraries for"
  1.6135 +    $echo "more information, such as the ld(1) and ld.so(8) manual pages."
  1.6136 +    $echo "----------------------------------------------------------------------"
  1.6137      exit 0
  1.6138      ;;
  1.6139  
  1.6140 @@ -3684,10 +5878,10 @@
  1.6141        fi
  1.6142  
  1.6143        dir=
  1.6144 -      case "$file" in
  1.6145 +      case $file in
  1.6146        *.la)
  1.6147  	# Check to see that this really is a libtool archive.
  1.6148 -	if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
  1.6149 +	if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
  1.6150  	else
  1.6151  	  $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
  1.6152  	  $echo "$help" 1>&2
  1.6153 @@ -3699,7 +5893,7 @@
  1.6154  	library_names=
  1.6155  
  1.6156  	# If there is no directory component, then add one.
  1.6157 -	case "$file" in
  1.6158 +	case $file in
  1.6159  	*/* | *\\*) . $file ;;
  1.6160  	*) . ./$file ;;
  1.6161  	esac
  1.6162 @@ -3754,13 +5948,13 @@
  1.6163      args=
  1.6164      for file
  1.6165      do
  1.6166 -      case "$file" in
  1.6167 +      case $file in
  1.6168        -*) ;;
  1.6169        *)
  1.6170  	# Do a test to see if this is really a libtool program.
  1.6171 -	if (sed -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
  1.6172 +	if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
  1.6173  	  # If there is no directory component, then add one.
  1.6174 -	  case "$file" in
  1.6175 +	  case $file in
  1.6176  	  */* | *\\*) . $file ;;
  1.6177  	  *) . ./$file ;;
  1.6178  	  esac
  1.6179 @@ -3777,11 +5971,11 @@
  1.6180  
  1.6181      if test -z "$run"; then
  1.6182        if test -n "$shlibpath_var"; then
  1.6183 -        # Export the shlibpath_var.
  1.6184 -        eval "export $shlibpath_var"
  1.6185 +	# Export the shlibpath_var.
  1.6186 +	eval "export $shlibpath_var"
  1.6187        fi
  1.6188  
  1.6189 -      # Restore saved enviroment variables
  1.6190 +      # Restore saved environment variables
  1.6191        if test "${save_LC_ALL+set}" = set; then
  1.6192  	LC_ALL="$save_LC_ALL"; export LC_ALL
  1.6193        fi
  1.6194 @@ -3789,31 +5983,35 @@
  1.6195  	LANG="$save_LANG"; export LANG
  1.6196        fi
  1.6197  
  1.6198 -      # Now actually exec the command.
  1.6199 -      eval "exec \$cmd$args"
  1.6200 -
  1.6201 -      $echo "$modename: cannot exec \$cmd$args"
  1.6202 -      exit 1
  1.6203 +      # Now prepare to actually exec the command.
  1.6204 +      exec_cmd="\$cmd$args"
  1.6205      else
  1.6206        # Display what would be done.
  1.6207        if test -n "$shlibpath_var"; then
  1.6208 -        eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\""
  1.6209 -        $echo "export $shlibpath_var"
  1.6210 +	eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\""
  1.6211 +	$echo "export $shlibpath_var"
  1.6212        fi
  1.6213        $echo "$cmd$args"
  1.6214        exit 0
  1.6215      fi
  1.6216      ;;
  1.6217  
  1.6218 -  # libtool uninstall mode
  1.6219 -  uninstall)
  1.6220 -    modename="$modename: uninstall"
  1.6221 +  # libtool clean and uninstall mode
  1.6222 +  clean | uninstall)
  1.6223 +    modename="$modename: $mode"
  1.6224      rm="$nonopt"
  1.6225      files=
  1.6226 +    rmforce=
  1.6227 +    exit_status=0
  1.6228 +
  1.6229 +    # This variable tells wrapper scripts just to set variables rather
  1.6230 +    # than running their programs.
  1.6231 +    libtool_install_magic="$magic"
  1.6232  
  1.6233      for arg
  1.6234      do
  1.6235 -      case "$arg" in
  1.6236 +      case $arg in
  1.6237 +      -f) rm="$rm $arg"; rmforce=yes ;;
  1.6238        -*) rm="$rm $arg" ;;
  1.6239        *) files="$files $arg" ;;
  1.6240        esac
  1.6241 @@ -3825,72 +6023,155 @@
  1.6242        exit 1
  1.6243      fi
  1.6244  
  1.6245 +    rmdirs=
  1.6246 +
  1.6247 +    origobjdir="$objdir"
  1.6248      for file in $files; do
  1.6249        dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
  1.6250 -      test "X$dir" = "X$file" && dir=.
  1.6251 +      if test "X$dir" = "X$file"; then
  1.6252 +	dir=.
  1.6253 +	objdir="$origobjdir"
  1.6254 +      else
  1.6255 +	objdir="$dir/$origobjdir"
  1.6256 +      fi
  1.6257        name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
  1.6258 +      test "$mode" = uninstall && objdir="$dir"
  1.6259 +
  1.6260 +      # Remember objdir for removal later, being careful to avoid duplicates
  1.6261 +      if test "$mode" = clean; then
  1.6262 +	case " $rmdirs " in
  1.6263 +	  *" $objdir "*) ;;
  1.6264 +	  *) rmdirs="$rmdirs $objdir" ;;
  1.6265 +	esac
  1.6266 +      fi
  1.6267 +
  1.6268 +      # Don't error if the file doesn't exist and rm -f was used.
  1.6269 +      if (test -L "$file") >/dev/null 2>&1 \
  1.6270 +	|| (test -h "$file") >/dev/null 2>&1 \
  1.6271 +	|| test -f "$file"; then
  1.6272 +	:
  1.6273 +      elif test -d "$file"; then
  1.6274 +	exit_status=1
  1.6275 +	continue
  1.6276 +      elif test "$rmforce" = yes; then
  1.6277 +	continue
  1.6278 +      fi
  1.6279  
  1.6280        rmfiles="$file"
  1.6281  
  1.6282 -      case "$name" in
  1.6283 +      case $name in
  1.6284        *.la)
  1.6285  	# Possibly a libtool archive, so verify it.
  1.6286 -	if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
  1.6287 +	if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
  1.6288  	  . $dir/$name
  1.6289  
  1.6290  	  # Delete the libtool libraries and symlinks.
  1.6291  	  for n in $library_names; do
  1.6292 -	    rmfiles="$rmfiles $dir/$n"
  1.6293 +	    rmfiles="$rmfiles $objdir/$n"
  1.6294  	  done
  1.6295 -	  test -n "$old_library" && rmfiles="$rmfiles $dir/$old_library"
  1.6296 -
  1.6297 -	  $show "$rm $rmfiles"
  1.6298 -	  $run $rm $rmfiles
  1.6299 -
  1.6300 -	  if test -n "$library_names"; then
  1.6301 -	    # Do each command in the postuninstall commands.
  1.6302 -	    eval cmds=\"$postuninstall_cmds\"
  1.6303 -	    IFS="${IFS= 	}"; save_ifs="$IFS"; IFS='~'
  1.6304 -	    for cmd in $cmds; do
  1.6305 +	  test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library"
  1.6306 +	  test "$mode" = clean && rmfiles="$rmfiles $objdir/$name $objdir/${name}i"
  1.6307 +
  1.6308 +	  if test "$mode" = uninstall; then
  1.6309 +	    if test -n "$library_names"; then
  1.6310 +	      # Do each command in the postuninstall commands.
  1.6311 +	      eval cmds=\"$postuninstall_cmds\"
  1.6312 +	      save_ifs="$IFS"; IFS='~'
  1.6313 +	      for cmd in $cmds; do
  1.6314 +		IFS="$save_ifs"
  1.6315 +		$show "$cmd"
  1.6316 +		$run eval "$cmd"
  1.6317 +		if test "$?" -ne 0 && test "$rmforce" != yes; then
  1.6318 +		  exit_status=1
  1.6319 +		fi
  1.6320 +	      done
  1.6321  	      IFS="$save_ifs"
  1.6322 -	      $show "$cmd"
  1.6323 -	      $run eval "$cmd"
  1.6324 -	    done
  1.6325 -	    IFS="$save_ifs"
  1.6326 +	    fi
  1.6327 +
  1.6328 +	    if test -n "$old_library"; then
  1.6329 +	      # Do each command in the old_postuninstall commands.
  1.6330 +	      eval cmds=\"$old_postuninstall_cmds\"
  1.6331 +	      save_ifs="$IFS"; IFS='~'
  1.6332 +	      for cmd in $cmds; do
  1.6333 +		IFS="$save_ifs"
  1.6334 +		$show "$cmd"
  1.6335 +		$run eval "$cmd"
  1.6336 +		if test "$?" -ne 0 && test "$rmforce" != yes; then
  1.6337 +		  exit_status=1
  1.6338 +		fi
  1.6339 +	      done
  1.6340 +	      IFS="$save_ifs"
  1.6341 +	    fi
  1.6342 +	    # FIXME: should reinstall the best remaining shared library.
  1.6343  	  fi
  1.6344 -
  1.6345 -	  if test -n "$old_library"; then
  1.6346 -	    # Do each command in the old_postuninstall commands.
  1.6347 -	    eval cmds=\"$old_postuninstall_cmds\"
  1.6348 -	    IFS="${IFS= 	}"; save_ifs="$IFS"; IFS='~'
  1.6349 -	    for cmd in $cmds; do
  1.6350 -	      IFS="$save_ifs"
  1.6351 -	      $show "$cmd"
  1.6352 -	      $run eval "$cmd"
  1.6353 -	    done
  1.6354 -	    IFS="$save_ifs"
  1.6355 -	  fi
  1.6356 -
  1.6357 -	  # FIXME: should reinstall the best remaining shared library.
  1.6358  	fi
  1.6359  	;;
  1.6360  
  1.6361        *.lo)
  1.6362 -	if test "$build_old_libs" = yes; then
  1.6363 -	  oldobj=`$echo "X$name" | $Xsed -e "$lo2o"`
  1.6364 -	  rmfiles="$rmfiles $dir/$oldobj"
  1.6365 +	# Possibly a libtool object, so verify it.
  1.6366 +	if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
  1.6367 +
  1.6368 +	  # Read the .lo file
  1.6369 +	  . $dir/$name
  1.6370 +
  1.6371 +	  # Add PIC object to the list of files to remove.
  1.6372 +	  if test -n "$pic_object" \
  1.6373 +	     && test "$pic_object" != none; then
  1.6374 +	    rmfiles="$rmfiles $dir/$pic_object"
  1.6375 +	  fi
  1.6376 +
  1.6377 +	  # Add non-PIC object to the list of files to remove.
  1.6378 +	  if test -n "$non_pic_object" \
  1.6379 +	     && test "$non_pic_object" != none; then
  1.6380 +	    rmfiles="$rmfiles $dir/$non_pic_object"
  1.6381 +	  fi
  1.6382  	fi
  1.6383 -	$show "$rm $rmfiles"
  1.6384 -	$run $rm $rmfiles
  1.6385  	;;
  1.6386  
  1.6387        *)
  1.6388 -	$show "$rm $rmfiles"
  1.6389 -	$run $rm $rmfiles
  1.6390 +	if test "$mode" = clean ; then
  1.6391 +	  noexename=$name
  1.6392 +	  case $file in
  1.6393 +	  *.exe) 
  1.6394 +	    file=`$echo $file|${SED} 's,.exe$,,'`
  1.6395 +	    noexename=`$echo $name|${SED} 's,.exe$,,'`
  1.6396 +	    # $file with .exe has already been added to rmfiles,
  1.6397 +	    # add $file without .exe
  1.6398 +	    rmfiles="$rmfiles $file"
  1.6399 +	    ;;
  1.6400 +	  esac
  1.6401 +	  # Do a test to see if this is a libtool program.
  1.6402 +	  if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
  1.6403 +	    relink_command=
  1.6404 +	    . $dir/$noexename
  1.6405 +
  1.6406 +	    # note $name still contains .exe if it was in $file originally
  1.6407 +	    # as does the version of $file that was added into $rmfiles
  1.6408 +	    rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}"
  1.6409 +	    if test "$fast_install" = yes && test -n "$relink_command"; then
  1.6410 +	      rmfiles="$rmfiles $objdir/lt-$name"
  1.6411 +	    fi
  1.6412 +	    if test "X$noexename" != "X$name" ; then
  1.6413 +	      rmfiles="$rmfiles $objdir/lt-${noexename}.c"
  1.6414 +	    fi
  1.6415 +	  fi
  1.6416 +	fi
  1.6417  	;;
  1.6418        esac
  1.6419 +      $show "$rm $rmfiles"
  1.6420 +      $run $rm $rmfiles || exit_status=1
  1.6421      done
  1.6422 -    exit 0
  1.6423 +    objdir="$origobjdir"
  1.6424 +
  1.6425 +    # Try to remove the ${objdir}s in the directories where we deleted files
  1.6426 +    for dir in $rmdirs; do
  1.6427 +      if test -d "$dir"; then
  1.6428 +	$show "rmdir $dir"
  1.6429 +	$run rmdir $dir >/dev/null 2>&1
  1.6430 +      fi
  1.6431 +    done
  1.6432 +
  1.6433 +    exit $exit_status
  1.6434      ;;
  1.6435  
  1.6436    "")
  1.6437 @@ -3900,13 +6181,20 @@
  1.6438      ;;
  1.6439    esac
  1.6440  
  1.6441 -  $echo "$modename: invalid operation mode \`$mode'" 1>&2
  1.6442 -  $echo "$generic_help" 1>&2
  1.6443 +  if test -z "$exec_cmd"; then
  1.6444 +    $echo "$modename: invalid operation mode \`$mode'" 1>&2
  1.6445 +    $echo "$generic_help" 1>&2
  1.6446 +    exit 1
  1.6447 +  fi
  1.6448 +fi # test -z "$show_help"
  1.6449 +
  1.6450 +if test -n "$exec_cmd"; then
  1.6451 +  eval exec $exec_cmd
  1.6452    exit 1
  1.6453 -fi # test -z "$show_help"
  1.6454 +fi
  1.6455  
  1.6456  # We need to display help for each of the modes.
  1.6457 -case "$mode" in
  1.6458 +case $mode in
  1.6459  "") $echo \
  1.6460  "Usage: $modename [OPTION]... [MODE-ARG]...
  1.6461  
  1.6462 @@ -3921,10 +6209,12 @@
  1.6463      --mode=MODE       use operation mode MODE [default=inferred from MODE-ARGS]
  1.6464      --quiet           same as \`--silent'
  1.6465      --silent          don't print informational messages
  1.6466 +    --tag=TAG         use configuration variables from tag TAG
  1.6467      --version         print version information
  1.6468  
  1.6469  MODE must be one of the following:
  1.6470  
  1.6471 +      clean           remove files from the build directory
  1.6472        compile         compile a source file into a libtool object
  1.6473        execute         automatically set library path, then run a program
  1.6474        finish          complete the installation of libtool libraries
  1.6475 @@ -3933,10 +6223,26 @@
  1.6476        uninstall       remove libraries from an installed directory
  1.6477  
  1.6478  MODE-ARGS vary depending on the MODE.  Try \`$modename --help --mode=MODE' for
  1.6479 -a more detailed description of MODE."
  1.6480 +a more detailed description of MODE.
  1.6481 +
  1.6482 +Report bugs to <bug-libtool@gnu.org>."
  1.6483    exit 0
  1.6484    ;;
  1.6485  
  1.6486 +clean)
  1.6487 +  $echo \
  1.6488 +"Usage: $modename [OPTION]... --mode=clean RM [RM-OPTION]... FILE...
  1.6489 +
  1.6490 +Remove files from the build directory.
  1.6491 +
  1.6492 +RM is the name of the program to use to delete files associated with each FILE
  1.6493 +(typically \`/bin/rm').  RM-OPTIONS are options (such as \`-f') to be passed
  1.6494 +to RM.
  1.6495 +
  1.6496 +If FILE is a libtool library, object or program, all the files associated
  1.6497 +with it are deleted. Otherwise, only FILE itself is deleted using RM."
  1.6498 +  ;;
  1.6499 +
  1.6500  compile)
  1.6501    $echo \
  1.6502  "Usage: $modename [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE
  1.6503 @@ -3946,6 +6252,8 @@
  1.6504  This mode accepts the following additional options:
  1.6505  
  1.6506    -o OUTPUT-FILE    set the output file name to OUTPUT-FILE
  1.6507 +  -prefer-pic       try to building PIC objects only
  1.6508 +  -prefer-non-pic   try to building non-PIC objects only
  1.6509    -static           always build a \`.o' file suitable for static linking
  1.6510  
  1.6511  COMPILE-COMMAND is a command to be used in creating a \`standard' object file
  1.6512 @@ -4025,8 +6333,11 @@
  1.6513    -LLIBDIR          search LIBDIR for required installed libraries
  1.6514    -lNAME            OUTPUT-FILE requires the installed library libNAME
  1.6515    -module           build a library that can dlopened
  1.6516 +  -no-fast-install  disable the fast-install mode
  1.6517 +  -no-install       link a not-installable executable
  1.6518    -no-undefined     declare that a library does not refer to external symbols
  1.6519    -o OUTPUT-FILE    create OUTPUT-FILE from the specified objects
  1.6520 +  -objectlist FILE  Use a list of object files found in FILE to specify objects
  1.6521    -release RELEASE  specify package release information
  1.6522    -rpath LIBDIR     the created library will eventually be installed in LIBDIR
  1.6523    -R[ ]LIBDIR       add LIBDIR to the runtime path of programs and libraries
  1.6524 @@ -4072,11 +6383,31 @@
  1.6525    ;;
  1.6526  esac
  1.6527  
  1.6528 -echo
  1.6529 +$echo
  1.6530  $echo "Try \`$modename --help' for more information about other modes."
  1.6531  
  1.6532  exit 0
  1.6533  
  1.6534 +# The TAGs below are defined such that we never get into a situation
  1.6535 +# in which we disable both kinds of libraries.  Given conflicting
  1.6536 +# choices, we go for a static library, that is the most portable,
  1.6537 +# since we can't tell whether shared libraries were disabled because
  1.6538 +# the user asked for that or because the platform doesn't support
  1.6539 +# them.  This is particularly important on AIX, because we don't
  1.6540 +# support having both static and shared libraries enabled at the same
  1.6541 +# time on that platform, so we default to a shared-only configuration.
  1.6542 +# If a disable-shared tag is given, we'll fallback to a static-only
  1.6543 +# configuration.  But we'll never go from static-only to shared-only.
  1.6544 +
  1.6545 +# ### BEGIN LIBTOOL TAG CONFIG: disable-shared
  1.6546 +build_libtool_libs=no
  1.6547 +build_old_libs=yes
  1.6548 +# ### END LIBTOOL TAG CONFIG: disable-shared
  1.6549 +
  1.6550 +# ### BEGIN LIBTOOL TAG CONFIG: disable-static
  1.6551 +build_old_libs=`case $build_libtool_libs in yes) $echo no;; *) $echo yes;; esac`
  1.6552 +# ### END LIBTOOL TAG CONFIG: disable-static
  1.6553 +
  1.6554  # Local Variables:
  1.6555  # mode:shell-script
  1.6556  # sh-indentation:2