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 +    target)
   1.450 +      $echo "$modename: you must specify a target with \`-o'" 1>&2
   1.451 +      exit 1
   1.452        ;;
   1.453      *)
   1.454 -      $echo "$modename: you must specify a target with \`-o'" 1>&2
   1.455 -      exit 1
   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 -	esac
  1.1380 -	case " $lib_search_path " in
  1.1381 -	*" $dir "*) ;;
  1.1382 -	*) lib_search_path="$lib_search_path $dir";;
  1.1383 +	case "$deplibs " in
  1.1384 +	*" -L$dir "*) ;;
  1.1385 +	*)
  1.1386 +	  deplibs="$deplibs -L$dir"
  1.1387 +	  lib_search_path="$lib_search_path $dir"
  1.1388 +	  ;;
  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,335 +1401,195 @@
  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 -	dlname=
  1.1758 -	libdir=
  1.1759 -	library_names=
  1.1760 -	old_library=
  1.1761 -
  1.1762 -	# Check to see that this really is a libtool archive.
  1.1763 -	if (sed -e '2q' $arg | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
  1.1764 -	else
  1.1765 -	  $echo "$modename: \`$arg' is not a valid libtool archive" 1>&2
  1.1766 -	  exit 1
  1.1767 -	fi
  1.1768 -
  1.1769 -	# If the library was installed with an old release of libtool,
  1.1770 -	# it will not redefine variable installed.
  1.1771 -	installed=yes
  1.1772 -
  1.1773 -	# Read the .la file
  1.1774 -	# If there is no directory component, then add one.
  1.1775 -	case "$arg" in
  1.1776 -	*/* | *\\*) . $arg ;;
  1.1777 -	*) . ./$arg ;;
  1.1778 -	esac
  1.1779 -
  1.1780 -	# Get the name of the library we link against.
  1.1781 -	linklib=
  1.1782 -	for l in $old_library $library_names; do
  1.1783 -	  linklib="$l"
  1.1784 -	done
  1.1785 -
  1.1786 -	if test -z "$linklib"; then
  1.1787 -	  $echo "$modename: cannot find name of link library for \`$arg'" 1>&2
  1.1788 -	  exit 1
  1.1789 -	fi
  1.1790 -
  1.1791 -	# Find the relevant object directory and library name.
  1.1792 -	name=`$echo "X$arg" | $Xsed -e 's%^.*/%%' -e 's/\.la$//' -e 's/^lib//'`
  1.1793 -
  1.1794 -	if test "X$installed" = Xyes; then
  1.1795 -	  dir="$libdir"
  1.1796 +	if test "$prev" = dlfiles; then
  1.1797 +	  # This library was specified with -dlopen.
  1.1798 +	  dlfiles="$dlfiles $arg"
  1.1799 +	  prev=
  1.1800 +	elif test "$prev" = dlprefiles; then
  1.1801 +	  # The library was specified with -dlpreopen.
  1.1802 +	  dlprefiles="$dlprefiles $arg"
  1.1803 +	  prev=
  1.1804  	else
  1.1805 -	  dir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
  1.1806 -	  if test "X$dir" = "X$arg"; then
  1.1807 -	    dir="$objdir"
  1.1808 -	  else
  1.1809 -	    dir="$dir/$objdir"
  1.1810 -	  fi
  1.1811 -	fi
  1.1812 -
  1.1813 -	if test -n "$dependency_libs"; then
  1.1814 -	  # Extract -R and -L from dependency_libs
  1.1815 -	  temp_deplibs=
  1.1816 -	  for deplib in $dependency_libs; do
  1.1817 -	    case "$deplib" in
  1.1818 -	    -R*) temp_xrpath=`$echo "X$deplib" | $Xsed -e 's/^-R//'`
  1.1819 -		 case " $rpath $xrpath " in
  1.1820 -		 *" $temp_xrpath "*) ;;
  1.1821 -		 *) xrpath="$xrpath $temp_xrpath";;
  1.1822 -		 esac;;
  1.1823 -	    -L*) case "$compile_command $temp_deplibs " in
  1.1824 -		 *" $deplib "*) ;;
  1.1825 -		 *) temp_deplibs="$temp_deplibs $deplib";;
  1.1826 -		 esac
  1.1827 -		 temp_dir=`$echo "X$deplib" | $Xsed -e 's/^-L//'`
  1.1828 -		 case " $lib_search_path " in
  1.1829 -		 *" $temp_dir "*) ;;
  1.1830 -		 *) lib_search_path="$lib_search_path $temp_dir";;
  1.1831 -		 esac
  1.1832 -		 ;;
  1.1833 -	    *) temp_deplibs="$temp_deplibs $deplib";;
  1.1834 -	    esac
  1.1835 -	  done
  1.1836 -	  dependency_libs="$temp_deplibs"
  1.1837 -	fi
  1.1838 -
  1.1839 -	if test -z "$libdir"; then
  1.1840 -	  # It is a libtool convenience library, so add in its objects.
  1.1841 -	  convenience="$convenience $dir/$old_library"
  1.1842 -	  old_convenience="$old_convenience $dir/$old_library"
  1.1843 -	  deplibs="$deplibs$dependency_libs"
  1.1844 -	  compile_command="$compile_command $dir/$old_library$dependency_libs"
  1.1845 -	  finalize_command="$finalize_command $dir/$old_library$dependency_libs"
  1.1846 -	  continue
  1.1847 -	fi
  1.1848 -
  1.1849 -	# This library was specified with -dlopen.
  1.1850 -	if test "$prev" = dlfiles; then
  1.1851 -	  dlfiles="$dlfiles $arg"
  1.1852 -	  if test -z "$dlname" || test "$dlopen" != yes || test "$build_libtool_libs" = no; then
  1.1853 -	    # If there is no dlname, no dlopen support or we're linking statically,
  1.1854 -	    # we need to preload.
  1.1855 -	    prev=dlprefiles
  1.1856 -	  else
  1.1857 -	    # We should not create a dependency on this library, but we
  1.1858 -	    # may need any libraries it requires.
  1.1859 -	    compile_command="$compile_command$dependency_libs"
  1.1860 -	    finalize_command="$finalize_command$dependency_libs"
  1.1861 -	    prev=
  1.1862 -	    continue
  1.1863 -	  fi
  1.1864 -	fi
  1.1865 -
  1.1866 -	# The library was specified with -dlpreopen.
  1.1867 -	if test "$prev" = dlprefiles; then
  1.1868 -	  # Prefer using a static library (so that no silly _DYNAMIC symbols
  1.1869 -	  # are required to link).
  1.1870 -	  if test -n "$old_library"; then
  1.1871 -	    dlprefiles="$dlprefiles $dir/$old_library"
  1.1872 -	  else
  1.1873 -	    dlprefiles="$dlprefiles $dir/$linklib"
  1.1874 -	  fi
  1.1875 -	  prev=
  1.1876 +	  deplibs="$deplibs $arg"
  1.1877  	fi
  1.1878 -
  1.1879 -	if test -n "$library_names" &&
  1.1880 -	   { test "$prefer_static_libs" = no || test -z "$old_library"; }; then
  1.1881 -	  link_against_libtool_libs="$link_against_libtool_libs $arg"
  1.1882 -	  if test -n "$shlibpath_var"; then
  1.1883 -	    # Make sure the rpath contains only unique directories.
  1.1884 -	    case "$temp_rpath " in
  1.1885 -	    *" $dir "*) ;;
  1.1886 -	    *) temp_rpath="$temp_rpath $dir" ;;
  1.1887 -	    esac
  1.1888 -	  fi
  1.1889 -
  1.1890 -	  # We need an absolute path.
  1.1891 -	  case "$dir" in
  1.1892 -	  [\\/] | [A-Za-z]:[\\/]*) absdir="$dir" ;;
  1.1893 -	  *)
  1.1894 -	    absdir=`cd "$dir" && pwd`
  1.1895 -	    if test -z "$absdir"; then
  1.1896 -	      $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2
  1.1897 -	      $echo "$modename: passing it literally to the linker, although it might fail" 1>&2
  1.1898 -	      absdir="$dir"
  1.1899 -	    fi
  1.1900 -	    ;;
  1.1901 -	  esac
  1.1902 -	  
  1.1903 -	  # This is the magic to use -rpath.
  1.1904 -	  # Skip directories that are in the system default run-time
  1.1905 -	  # search path, unless they have been requested with -R.
  1.1906 -	  case " $sys_lib_dlsearch_path " in
  1.1907 -	  *" $absdir "*) ;;
  1.1908 -	  *)
  1.1909 -	    case "$compile_rpath " in
  1.1910 -	    *" $absdir "*) ;;
  1.1911 -	    *) compile_rpath="$compile_rpath $absdir" 
  1.1912 -	    esac
  1.1913 -	    ;;
  1.1914 -	  esac
  1.1915 -
  1.1916 -	  case " $sys_lib_dlsearch_path " in
  1.1917 -	  *" $libdir "*) ;;
  1.1918 -	  *)
  1.1919 -	    case "$finalize_rpath " in
  1.1920 -	    *" $libdir "*) ;;
  1.1921 -	    *) finalize_rpath="$finalize_rpath $libdir"
  1.1922 -	    esac
  1.1923 -	    ;;
  1.1924 -	  esac
  1.1925 -
  1.1926 -	  lib_linked=yes
  1.1927 -	  case "$hardcode_action" in
  1.1928 -	  immediate | unsupported)
  1.1929 -	    if test "$hardcode_direct" = no; then
  1.1930 -	      compile_command="$compile_command $dir/$linklib"
  1.1931 -	      deplibs="$deplibs $dir/$linklib"
  1.1932 -	      case "$host" in
  1.1933 -	      *-*-cygwin* | *-*-mingw* | *-*-os2*)
  1.1934 -		dllsearchdir=`cd "$dir" && pwd || echo "$dir"`
  1.1935 -		if test -n "$dllsearchpath"; then
  1.1936 -		  dllsearchpath="$dllsearchpath:$dllsearchdir"
  1.1937 -		else
  1.1938 -		  dllsearchpath="$dllsearchdir"
  1.1939 -		fi
  1.1940 -		;;
  1.1941 -	      esac
  1.1942 -	    elif test "$hardcode_minus_L" = no; then
  1.1943 -	      case "$host" in
  1.1944 -	      *-*-sunos*)
  1.1945 -		compile_shlibpath="$compile_shlibpath$dir:"
  1.1946 -		;;
  1.1947 -	      esac
  1.1948 -	      case "$compile_command " in
  1.1949 -	      *" -L$dir "*) ;;
  1.1950 -	      *) compile_command="$compile_command -L$dir";;
  1.1951 -	      esac
  1.1952 -	      compile_command="$compile_command -l$name"
  1.1953 -	      deplibs="$deplibs -L$dir -l$name"
  1.1954 -	    elif test "$hardcode_shlibpath_var" = no; then
  1.1955 -	      case ":$compile_shlibpath:" in
  1.1956 -	      *":$dir:"*) ;;
  1.1957 -	      *) compile_shlibpath="$compile_shlibpath$dir:";;
  1.1958 -	      esac
  1.1959 -	      compile_command="$compile_command -l$name"
  1.1960 -	      deplibs="$deplibs -l$name"
  1.1961 -	    else
  1.1962 -	      lib_linked=no
  1.1963 -	    fi
  1.1964 -	    ;;
  1.1965 -
  1.1966 -	  relink)
  1.1967 -	    if test "$hardcode_direct" = yes; then
  1.1968 -	      compile_command="$compile_command $absdir/$linklib"
  1.1969 -	      deplibs="$deplibs $absdir/$linklib"
  1.1970 -	    elif test "$hardcode_minus_L" = yes; then
  1.1971 -	      case "$compile_command " in
  1.1972 -	      *" -L$absdir "*) ;;
  1.1973 -	      *) compile_command="$compile_command -L$absdir";;
  1.1974 -	      esac
  1.1975 -	      compile_command="$compile_command -l$name"
  1.1976 -	      deplibs="$deplibs -L$absdir -l$name"
  1.1977 -	    elif test "$hardcode_shlibpath_var" = yes; then
  1.1978 -	      case ":$compile_shlibpath:" in
  1.1979 -	      *":$absdir:"*) ;;
  1.1980 -	      *) compile_shlibpath="$compile_shlibpath$absdir:";;
  1.1981 -	      esac
  1.1982 -	      compile_command="$compile_command -l$name"
  1.1983 -	      deplibs="$deplibs -l$name"
  1.1984 -	    else
  1.1985 -	      lib_linked=no
  1.1986 -	    fi
  1.1987 -	    ;;
  1.1988 -
  1.1989 -	  *)
  1.1990 -	    lib_linked=no
  1.1991 -	    ;;
  1.1992 -	  esac
  1.1993 -
  1.1994 -	  if test "$lib_linked" != yes; then
  1.1995 -	    $echo "$modename: configuration error: unsupported hardcode properties"
  1.1996 -	    exit 1
  1.1997 -	  fi
  1.1998 -
  1.1999 -	  # Finalize command for both is simple: just hardcode it.
  1.2000 -	  if test "$hardcode_direct" = yes; then
  1.2001 -	    finalize_command="$finalize_command $libdir/$linklib"
  1.2002 -	  elif test "$hardcode_minus_L" = yes; then
  1.2003 -	    case "$finalize_command " in
  1.2004 -	    *" -L$libdir "*) ;;
  1.2005 -	    *) finalize_command="$finalize_command -L$libdir";;
  1.2006 -	    esac
  1.2007 -	    finalize_command="$finalize_command -l$name"
  1.2008 -	  elif test "$hardcode_shlibpath_var" = yes; then
  1.2009 -	    case ":$finalize_shlibpath:" in
  1.2010 -	    *":$libdir:"*) ;;
  1.2011 -	    *) finalize_shlibpath="$finalize_shlibpath$libdir:";;
  1.2012 -	    esac
  1.2013 -	    finalize_command="$finalize_command -l$name"
  1.2014 -	  else
  1.2015 -	    # We cannot seem to hardcode it, guess we'll fake it.
  1.2016 -	    case "$finalize_command " in
  1.2017 -	    *" -L$dir "*) ;;
  1.2018 -	    *) finalize_command="$finalize_command -L$libdir";;
  1.2019 -	    esac
  1.2020 -	    finalize_command="$finalize_command -l$name"
  1.2021 -	  fi
  1.2022 -	else
  1.2023 -	  # Transform directly to old archives if we don't build new libraries.
  1.2024 -	  if test -n "$pic_flag" && test -z "$old_library"; then
  1.2025 -	    $echo "$modename: cannot find static library for \`$arg'" 1>&2
  1.2026 -	    exit 1
  1.2027 -	  fi
  1.2028 -
  1.2029 -	  # Here we assume that one of hardcode_direct or hardcode_minus_L
  1.2030 -	  # is not unsupported.  This is valid on all known static and
  1.2031 -	  # shared platforms.
  1.2032 -	  if test "$hardcode_direct" != unsupported; then
  1.2033 -	    test -n "$old_library" && linklib="$old_library"
  1.2034 -	    compile_command="$compile_command $dir/$linklib"
  1.2035 -	    finalize_command="$finalize_command $dir/$linklib"
  1.2036 -	  else
  1.2037 -	    case "$compile_command " in
  1.2038 -	    *" -L$dir "*) ;;
  1.2039 -	    *) compile_command="$compile_command -L$dir";;
  1.2040 -	    esac
  1.2041 -	    compile_command="$compile_command -l$name"
  1.2042 -	    case "$finalize_command " in
  1.2043 -	    *" -L$dir "*) ;;
  1.2044 -	    *) finalize_command="$finalize_command -L$dir";;
  1.2045 -	    esac
  1.2046 -	    finalize_command="$finalize_command -l$name"
  1.2047 -	  fi
  1.2048 -	fi
  1.2049 -
  1.2050 -	# Add in any libraries that this one depends upon.
  1.2051 -	compile_command="$compile_command$dependency_libs"
  1.2052 -	finalize_command="$finalize_command$dependency_libs"
  1.2053  	continue
  1.2054  	;;
  1.2055  
  1.2056 @@ -1516,20 +1598,20 @@
  1.2057  	# Unknown arguments in both finalize_command and compile_command need
  1.2058  	# to be aesthetically quoted because they are evaled later.
  1.2059  	arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
  1.2060 -	case "$arg" in
  1.2061 -	*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*)
  1.2062 +	case $arg in
  1.2063 +	*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
  1.2064  	  arg="\"$arg\""
  1.2065  	  ;;
  1.2066  	esac
  1.2067  	;;
  1.2068 -      esac
  1.2069 +      esac # arg
  1.2070  
  1.2071        # Now actually substitute the argument into the commands.
  1.2072        if test -n "$arg"; then
  1.2073  	compile_command="$compile_command $arg"
  1.2074  	finalize_command="$finalize_command $arg"
  1.2075        fi
  1.2076 -    done
  1.2077 +    done # argument parsing loop
  1.2078  
  1.2079      if test -n "$prev"; then
  1.2080        $echo "$modename: the \`$prevarg' option requires an argument" 1>&2
  1.2081 @@ -1537,6 +1619,47 @@
  1.2082        exit 1
  1.2083      fi
  1.2084  
  1.2085 +    # Infer tagged configuration to use if any are available and
  1.2086 +    # if one wasn't chosen via the "--tag" command line option.
  1.2087 +    # Only attempt this if the compiler in the base link
  1.2088 +    # command doesn't match the default compiler.
  1.2089 +    if test -n "$available_tags" && test -z "$tagname"; then
  1.2090 +      case $base_compile in
  1.2091 +      # Blanks in the command may have been stripped by the calling shell,
  1.2092 +      # but not from the CC environment variable when configure was run.
  1.2093 +      "$CC "* | " $CC "* | "`$echo $CC` "* | " `$echo $CC` "*) ;;
  1.2094 +      # Blanks at the start of $base_compile will cause this to fail
  1.2095 +      # if we don't check for them as well.
  1.2096 +      *)
  1.2097 +	for z in $available_tags; do
  1.2098 +	  if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$0" > /dev/null; then
  1.2099 +	    # Evaluate the configuration.
  1.2100 +	    eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $0`"
  1.2101 +	    case $base_compile in
  1.2102 +	    "$CC "* | " $CC "* | "`$echo $CC` "* | " `$echo $CC` "*)
  1.2103 +	      # The compiler in $compile_command matches
  1.2104 +	      # the one in the tagged configuration.
  1.2105 +	      # Assume this is the tagged configuration we want.
  1.2106 +	      tagname=$z
  1.2107 +	      break
  1.2108 +	      ;;
  1.2109 +	    esac
  1.2110 +	  fi
  1.2111 +	done
  1.2112 +	# If $tagname still isn't set, then no tagged configuration
  1.2113 +	# was found and let the user know that the "--tag" command
  1.2114 +	# line option must be used.
  1.2115 +	if test -z "$tagname"; then
  1.2116 +	  $echo "$modename: unable to infer tagged configuration"
  1.2117 +	  $echo "$modename: specify a tag with \`--tag'" 1>&2
  1.2118 +	  exit 1
  1.2119 +#       else
  1.2120 +#         $echo "$modename: using $tagname tagged configuration"
  1.2121 +	fi
  1.2122 +	;;
  1.2123 +      esac
  1.2124 +    fi
  1.2125 +
  1.2126      if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then
  1.2127        eval arg=\"$export_dynamic_flag_spec\"
  1.2128        compile_command="$compile_command $arg"
  1.2129 @@ -1548,19 +1671,1045 @@
  1.2130      outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'`
  1.2131      libobjs_save="$libobjs"
  1.2132  
  1.2133 -    case "$output" in
  1.2134 +    if test -n "$shlibpath_var"; then
  1.2135 +      # get the directories listed in $shlibpath_var
  1.2136 +      eval shlib_search_path=\`\$echo \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\`
  1.2137 +    else
  1.2138 +      shlib_search_path=
  1.2139 +    fi
  1.2140 +    eval sys_lib_search_path=\"$sys_lib_search_path_spec\"
  1.2141 +    eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\"
  1.2142 +
  1.2143 +    output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'`
  1.2144 +    if test "X$output_objdir" = "X$output"; then
  1.2145 +      output_objdir="$objdir"
  1.2146 +    else
  1.2147 +      output_objdir="$output_objdir/$objdir"
  1.2148 +    fi
  1.2149 +    # Create the object directory.
  1.2150 +    if test ! -d "$output_objdir"; then
  1.2151 +      $show "$mkdir $output_objdir"
  1.2152 +      $run $mkdir $output_objdir
  1.2153 +      status=$?
  1.2154 +      if test "$status" -ne 0 && test ! -d "$output_objdir"; then
  1.2155 +	exit $status
  1.2156 +      fi
  1.2157 +    fi
  1.2158 +
  1.2159 +    # Determine the type of output
  1.2160 +    case $output in
  1.2161      "")
  1.2162        $echo "$modename: you must specify an output file" 1>&2
  1.2163        $echo "$help" 1>&2
  1.2164        exit 1
  1.2165        ;;
  1.2166 -
  1.2167 -    *.a | *.lib)
  1.2168 -      if test -n "$link_against_libtool_libs"; then
  1.2169 -	$echo "$modename: error: cannot link libtool libraries into archives" 1>&2
  1.2170 -	exit 1
  1.2171 +    *.$libext) linkmode=oldlib ;;
  1.2172 +    *.lo | *.$objext) linkmode=obj ;;
  1.2173 +    *.la) linkmode=lib ;;
  1.2174 +    *) linkmode=prog ;; # Anything else should be a program.
  1.2175 +    esac
  1.2176 +
  1.2177 +    case $host in
  1.2178 +    *cygwin* | *mingw* | *pw32*)
  1.2179 +      # don't eliminate duplcations in $postdeps and $predeps
  1.2180 +      duplicate_compiler_generated_deps=yes
  1.2181 +      ;;
  1.2182 +    *)
  1.2183 +      duplicate_compiler_generated_deps=$duplicate_deps
  1.2184 +      ;;
  1.2185 +    esac
  1.2186 +    specialdeplibs=
  1.2187 +
  1.2188 +    libs=
  1.2189 +    # Find all interdependent deplibs by searching for libraries
  1.2190 +    # that are linked more than once (e.g. -la -lb -la)
  1.2191 +    for deplib in $deplibs; do
  1.2192 +      if test "X$duplicate_deps" = "Xyes" ; then
  1.2193 +	case "$libs " in
  1.2194 +	*" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
  1.2195 +	esac
  1.2196 +      fi
  1.2197 +      libs="$libs $deplib"
  1.2198 +    done
  1.2199 +
  1.2200 +    if test "$linkmode" = lib; then
  1.2201 +      libs="$predeps $libs $compiler_lib_search_path $postdeps"
  1.2202 +
  1.2203 +      # Compute libraries that are listed more than once in $predeps
  1.2204 +      # $postdeps and mark them as special (i.e., whose duplicates are
  1.2205 +      # not to be eliminated).
  1.2206 +      pre_post_deps=
  1.2207 +      if test "X$duplicate_compiler_generated_deps" = "Xyes" ; then
  1.2208 +	for pre_post_dep in $predeps $postdeps; do
  1.2209 +	  case "$pre_post_deps " in
  1.2210 +	  *" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;;
  1.2211 +	  esac
  1.2212 +	  pre_post_deps="$pre_post_deps $pre_post_dep"
  1.2213 +	done
  1.2214 +      fi
  1.2215 +      pre_post_deps=
  1.2216 +    fi
  1.2217 +
  1.2218 +    deplibs=
  1.2219 +    newdependency_libs=
  1.2220 +    newlib_search_path=
  1.2221 +    need_relink=no # whether we're linking any uninstalled libtool libraries
  1.2222 +    notinst_deplibs= # not-installed libtool libraries
  1.2223 +    notinst_path= # paths that contain not-installed libtool libraries
  1.2224 +    case $linkmode in
  1.2225 +    lib)
  1.2226 +	passes="conv link"
  1.2227 +	for file in $dlfiles $dlprefiles; do
  1.2228 +	  case $file in
  1.2229 +	  *.la) ;;
  1.2230 +	  *)
  1.2231 +	    $echo "$modename: libraries can \`-dlopen' only libtool libraries: $file" 1>&2
  1.2232 +	    exit 1
  1.2233 +	    ;;
  1.2234 +	  esac
  1.2235 +	done
  1.2236 +	;;
  1.2237 +    prog)
  1.2238 +	compile_deplibs=
  1.2239 +	finalize_deplibs=
  1.2240 +	alldeplibs=no
  1.2241 +	newdlfiles=
  1.2242 +	newdlprefiles=
  1.2243 +	passes="conv scan dlopen dlpreopen link"
  1.2244 +	;;
  1.2245 +    *)  passes="conv"
  1.2246 +	;;
  1.2247 +    esac
  1.2248 +    for pass in $passes; do
  1.2249 +      if test "$linkmode,$pass" = "lib,link" ||
  1.2250 +	 test "$linkmode,$pass" = "prog,scan"; then
  1.2251 +	libs="$deplibs"
  1.2252 +	deplibs=
  1.2253 +      fi
  1.2254 +      if test "$linkmode" = prog; then
  1.2255 +	case $pass in
  1.2256 +	dlopen) libs="$dlfiles" ;;
  1.2257 +	dlpreopen) libs="$dlprefiles" ;;
  1.2258 +	link) libs="$deplibs %DEPLIBS% $dependency_libs" ;;
  1.2259 +	esac
  1.2260 +      fi
  1.2261 +      if test "$pass" = dlopen; then
  1.2262 +	# Collect dlpreopened libraries
  1.2263 +	save_deplibs="$deplibs"
  1.2264 +	deplibs=
  1.2265        fi
  1.2266 -
  1.2267 +      for deplib in $libs; do
  1.2268 +	lib=
  1.2269 +	found=no
  1.2270 +	case $deplib in
  1.2271 +	-l*)
  1.2272 +	  if test "$linkmode" != lib && test "$linkmode" != prog; then
  1.2273 +	    $echo "$modename: warning: \`-l' is ignored for archives/objects" 1>&2
  1.2274 +	    continue
  1.2275 +	  fi
  1.2276 +	  if test "$pass" = conv; then
  1.2277 +	    deplibs="$deplib $deplibs"
  1.2278 +	    continue
  1.2279 +	  fi
  1.2280 +	  name=`$echo "X$deplib" | $Xsed -e 's/^-l//'`
  1.2281 +	  for searchdir in $newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path; do
  1.2282 +	    # Search the libtool library
  1.2283 +	    lib="$searchdir/lib${name}.la"
  1.2284 +	    if test -f "$lib"; then
  1.2285 +	      found=yes
  1.2286 +	      break
  1.2287 +	    fi
  1.2288 +	  done
  1.2289 +	  if test "$found" != yes; then
  1.2290 +	    # deplib doesn't seem to be a libtool library
  1.2291 +	    if test "$linkmode,$pass" = "prog,link"; then
  1.2292 +	      compile_deplibs="$deplib $compile_deplibs"
  1.2293 +	      finalize_deplibs="$deplib $finalize_deplibs"
  1.2294 +	    else
  1.2295 +	      deplibs="$deplib $deplibs"
  1.2296 +	      test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
  1.2297 +	    fi
  1.2298 +	    continue
  1.2299 +	  else # deplib is a libtool library
  1.2300 +	    # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib,
  1.2301 +	    # We need to do some special things here, and not later.
  1.2302 +	    if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
  1.2303 +	      case " $predeps $postdeps " in
  1.2304 +	      *" $deplib "*)
  1.2305 +		if (${SED} -e '2q' $lib |
  1.2306 +                    grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
  1.2307 +		  library_names=
  1.2308 +		  old_library=
  1.2309 +		  case $lib in
  1.2310 +		  */* | *\\*) . $lib ;;
  1.2311 +		  *) . ./$lib ;;
  1.2312 +		  esac
  1.2313 +		  for l in $old_library $library_names; do
  1.2314 +		    ll="$l"
  1.2315 +		  done
  1.2316 +		  if test "X$ll" = "X$old_library" ; then # only static version available
  1.2317 +		    found=no
  1.2318 +		    ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'`
  1.2319 +		    test "X$ladir" = "X$lib" && ladir="."
  1.2320 +		    lib=$ladir/$old_library
  1.2321 +		    if test "$linkmode,$pass" = "prog,link"; then
  1.2322 +		      compile_deplibs="$deplib $compile_deplibs"
  1.2323 +		      finalize_deplibs="$deplib $finalize_deplibs"
  1.2324 +		    else
  1.2325 +		      deplibs="$deplib $deplibs"
  1.2326 +		      test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
  1.2327 +		    fi
  1.2328 +		    continue
  1.2329 +		  fi
  1.2330 +		fi
  1.2331 +	        ;;
  1.2332 +	      *) ;;
  1.2333 +	      esac
  1.2334 +	    fi
  1.2335 +	  fi
  1.2336 +	  ;; # -l
  1.2337 +	-L*)
  1.2338 +	  case $linkmode in
  1.2339 +	  lib)
  1.2340 +	    deplibs="$deplib $deplibs"
  1.2341 +	    test "$pass" = conv && continue
  1.2342 +	    newdependency_libs="$deplib $newdependency_libs"
  1.2343 +	    newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
  1.2344 +	    ;;
  1.2345 +	  prog)
  1.2346 +	    if test "$pass" = conv; then
  1.2347 +	      deplibs="$deplib $deplibs"
  1.2348 +	      continue
  1.2349 +	    fi
  1.2350 +	    if test "$pass" = scan; then
  1.2351 +	      deplibs="$deplib $deplibs"
  1.2352 +	      newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
  1.2353 +	    else
  1.2354 +	      compile_deplibs="$deplib $compile_deplibs"
  1.2355 +	      finalize_deplibs="$deplib $finalize_deplibs"
  1.2356 +	    fi
  1.2357 +	    ;;
  1.2358 +	  *)
  1.2359 +	    $echo "$modename: warning: \`-L' is ignored for archives/objects" 1>&2
  1.2360 +	    ;;
  1.2361 +	  esac # linkmode
  1.2362 +	  continue
  1.2363 +	  ;; # -L
  1.2364 +	-R*)
  1.2365 +	  if test "$pass" = link; then
  1.2366 +	    dir=`$echo "X$deplib" | $Xsed -e 's/^-R//'`
  1.2367 +	    # Make sure the xrpath contains only unique directories.
  1.2368 +	    case "$xrpath " in
  1.2369 +	    *" $dir "*) ;;
  1.2370 +	    *) xrpath="$xrpath $dir" ;;
  1.2371 +	    esac
  1.2372 +	  fi
  1.2373 +	  deplibs="$deplib $deplibs"
  1.2374 +	  continue
  1.2375 +	  ;;
  1.2376 +	*.la) lib="$deplib" ;;
  1.2377 +	*.$libext)
  1.2378 +	  if test "$pass" = conv; then
  1.2379 +	    deplibs="$deplib $deplibs"
  1.2380 +	    continue
  1.2381 +	  fi
  1.2382 +	  case $linkmode in
  1.2383 +	  lib)
  1.2384 +	    if test "$deplibs_check_method" != pass_all; then
  1.2385 +	      $echo
  1.2386 +	      $echo "*** Warning: Trying to link with static lib archive $deplib."
  1.2387 +	      $echo "*** I have the capability to make that library automatically link in when"
  1.2388 +	      $echo "*** you link to this library.  But I can only do this if you have a"
  1.2389 +	      $echo "*** shared version of the library, which you do not appear to have"
  1.2390 +	      $echo "*** because the file extensions .$libext of this argument makes me believe"
  1.2391 +	      $echo "*** that it is just a static archive that I should not used here."
  1.2392 +	    else
  1.2393 +	      $echo
  1.2394 +	      $echo "*** Warning: Linking the shared library $output against the"
  1.2395 +	      $echo "*** static library $deplib is not portable!"
  1.2396 +	      deplibs="$deplib $deplibs"
  1.2397 +	    fi
  1.2398 +	    continue
  1.2399 +	    ;;
  1.2400 +	  prog)
  1.2401 +	    if test "$pass" != link; then
  1.2402 +	      deplibs="$deplib $deplibs"
  1.2403 +	    else
  1.2404 +	      compile_deplibs="$deplib $compile_deplibs"
  1.2405 +	      finalize_deplibs="$deplib $finalize_deplibs"
  1.2406 +	    fi
  1.2407 +	    continue
  1.2408 +	    ;;
  1.2409 +	  esac # linkmode
  1.2410 +	  ;; # *.$libext
  1.2411 +	*.lo | *.$objext)
  1.2412 +	  if test "$pass" = conv; then
  1.2413 +	    deplibs="$deplib $deplibs"
  1.2414 +	  elif test "$linkmode" = prog; then
  1.2415 +	    if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
  1.2416 +	      # If there is no dlopen support or we're linking statically,
  1.2417 +	      # we need to preload.
  1.2418 +	      newdlprefiles="$newdlprefiles $deplib"
  1.2419 +	      compile_deplibs="$deplib $compile_deplibs"
  1.2420 +	      finalize_deplibs="$deplib $finalize_deplibs"
  1.2421 +	    else
  1.2422 +	      newdlfiles="$newdlfiles $deplib"
  1.2423 +	    fi
  1.2424 +	  fi
  1.2425 +	  continue
  1.2426 +	  ;;
  1.2427 +	%DEPLIBS%)
  1.2428 +	  alldeplibs=yes
  1.2429 +	  continue
  1.2430 +	  ;;
  1.2431 +	esac # case $deplib
  1.2432 +	if test "$found" = yes || test -f "$lib"; then :
  1.2433 +	else
  1.2434 +	  $echo "$modename: cannot find the library \`$lib'" 1>&2
  1.2435 +	  exit 1
  1.2436 +	fi
  1.2437 +
  1.2438 +	# Check to see that this really is a libtool archive.
  1.2439 +	if (${SED} -e '2q' $lib | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
  1.2440 +	else
  1.2441 +	  $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
  1.2442 +	  exit 1
  1.2443 +	fi
  1.2444 +
  1.2445 +	ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'`
  1.2446 +	test "X$ladir" = "X$lib" && ladir="."
  1.2447 +
  1.2448 +	dlname=
  1.2449 +	dlopen=
  1.2450 +	dlpreopen=
  1.2451 +	libdir=
  1.2452 +	library_names=
  1.2453 +	old_library=
  1.2454 +	# If the library was installed with an old release of libtool,
  1.2455 +	# it will not redefine variables installed, or shouldnotlink
  1.2456 +	installed=yes
  1.2457 +	shouldnotlink=no
  1.2458 +
  1.2459 +	# Read the .la file
  1.2460 +	case $lib in
  1.2461 +	*/* | *\\*) . $lib ;;
  1.2462 +	*) . ./$lib ;;
  1.2463 +	esac
  1.2464 +
  1.2465 +	if test "$linkmode,$pass" = "lib,link" ||
  1.2466 +	   test "$linkmode,$pass" = "prog,scan" ||
  1.2467 +	   { test "$linkmode" != prog && test "$linkmode" != lib; }; then
  1.2468 +	  test -n "$dlopen" && dlfiles="$dlfiles $dlopen"
  1.2469 +	  test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen"
  1.2470 +	fi
  1.2471 +
  1.2472 +	if test "$pass" = conv; then
  1.2473 +	  # Only check for convenience libraries
  1.2474 +	  deplibs="$lib $deplibs"
  1.2475 +	  if test -z "$libdir"; then
  1.2476 +	    if test -z "$old_library"; then
  1.2477 +	      $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
  1.2478 +	      exit 1
  1.2479 +	    fi
  1.2480 +	    # It is a libtool convenience library, so add in its objects.
  1.2481 +	    convenience="$convenience $ladir/$objdir/$old_library"
  1.2482 +	    old_convenience="$old_convenience $ladir/$objdir/$old_library"
  1.2483 +	    tmp_libs=
  1.2484 +	    for deplib in $dependency_libs; do
  1.2485 +	      deplibs="$deplib $deplibs"
  1.2486 +              if test "X$duplicate_deps" = "Xyes" ; then
  1.2487 +	        case "$tmp_libs " in
  1.2488 +	        *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
  1.2489 +	        esac
  1.2490 +              fi
  1.2491 +	      tmp_libs="$tmp_libs $deplib"
  1.2492 +	    done
  1.2493 +	  elif test "$linkmode" != prog && test "$linkmode" != lib; then
  1.2494 +	    $echo "$modename: \`$lib' is not a convenience library" 1>&2
  1.2495 +	    exit 1
  1.2496 +	  fi
  1.2497 +	  continue
  1.2498 +	fi # $pass = conv
  1.2499 +
  1.2500 +    
  1.2501 +	# Get the name of the library we link against.
  1.2502 +	linklib=
  1.2503 +	for l in $old_library $library_names; do
  1.2504 +	  linklib="$l"
  1.2505 +	done
  1.2506 +	if test -z "$linklib"; then
  1.2507 +	  $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
  1.2508 +	  exit 1
  1.2509 +	fi
  1.2510 +
  1.2511 +	# This library was specified with -dlopen.
  1.2512 +	if test "$pass" = dlopen; then
  1.2513 +	  if test -z "$libdir"; then
  1.2514 +	    $echo "$modename: cannot -dlopen a convenience library: \`$lib'" 1>&2
  1.2515 +	    exit 1
  1.2516 +	  fi
  1.2517 +	  if test -z "$dlname" || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
  1.2518 +	    # If there is no dlname, no dlopen support or we're linking
  1.2519 +	    # statically, we need to preload.  We also need to preload any
  1.2520 +	    # dependent libraries so libltdl's deplib preloader doesn't
  1.2521 +	    # bomb out in the load deplibs phase.
  1.2522 +	    dlprefiles="$dlprefiles $lib $dependency_libs"
  1.2523 +	  else
  1.2524 +	    newdlfiles="$newdlfiles $lib"
  1.2525 +	  fi
  1.2526 +	  continue
  1.2527 +	fi # $pass = dlopen
  1.2528 +
  1.2529 +	# We need an absolute path.
  1.2530 +	case $ladir in
  1.2531 +	[\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;;
  1.2532 +	*)
  1.2533 +	  abs_ladir=`cd "$ladir" && pwd`
  1.2534 +	  if test -z "$abs_ladir"; then
  1.2535 +	    $echo "$modename: warning: cannot determine absolute directory name of \`$ladir'" 1>&2
  1.2536 +	    $echo "$modename: passing it literally to the linker, although it might fail" 1>&2
  1.2537 +	    abs_ladir="$ladir"
  1.2538 +	  fi
  1.2539 +	  ;;
  1.2540 +	esac
  1.2541 +	laname=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
  1.2542 +
  1.2543 +	# Find the relevant object directory and library name.
  1.2544 +	if test "X$installed" = Xyes; then
  1.2545 +	  if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then
  1.2546 +	    $echo "$modename: warning: library \`$lib' was moved." 1>&2
  1.2547 +	    dir="$ladir"
  1.2548 +	    absdir="$abs_ladir"
  1.2549 +	    libdir="$abs_ladir"
  1.2550 +	  else
  1.2551 +	    dir="$libdir"
  1.2552 +	    absdir="$libdir"
  1.2553 +	  fi
  1.2554 +	else
  1.2555 +	  dir="$ladir/$objdir"
  1.2556 +	  absdir="$abs_ladir/$objdir"
  1.2557 +	  # Remove this search path later
  1.2558 +	  notinst_path="$notinst_path $abs_ladir"
  1.2559 +	fi # $installed = yes
  1.2560 +	name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
  1.2561 +
  1.2562 +	# This library was specified with -dlpreopen.
  1.2563 +	if test "$pass" = dlpreopen; then
  1.2564 +	  if test -z "$libdir"; then
  1.2565 +	    $echo "$modename: cannot -dlpreopen a convenience library: \`$lib'" 1>&2
  1.2566 +	    exit 1
  1.2567 +	  fi
  1.2568 +	  # Prefer using a static library (so that no silly _DYNAMIC symbols
  1.2569 +	  # are required to link).
  1.2570 +	  if test -n "$old_library"; then
  1.2571 +	    newdlprefiles="$newdlprefiles $dir/$old_library"
  1.2572 +	  # Otherwise, use the dlname, so that lt_dlopen finds it.
  1.2573 +	  elif test -n "$dlname"; then
  1.2574 +	    newdlprefiles="$newdlprefiles $dir/$dlname"
  1.2575 +	  else
  1.2576 +	    newdlprefiles="$newdlprefiles $dir/$linklib"
  1.2577 +	  fi
  1.2578 +	fi # $pass = dlpreopen
  1.2579 +
  1.2580 +	if test -z "$libdir"; then
  1.2581 +	  # Link the convenience library
  1.2582 +	  if test "$linkmode" = lib; then
  1.2583 +	    deplibs="$dir/$old_library $deplibs"
  1.2584 +	  elif test "$linkmode,$pass" = "prog,link"; then
  1.2585 +	    compile_deplibs="$dir/$old_library $compile_deplibs"
  1.2586 +	    finalize_deplibs="$dir/$old_library $finalize_deplibs"
  1.2587 +	  else
  1.2588 +	    deplibs="$lib $deplibs" # used for prog,scan pass
  1.2589 +	  fi
  1.2590 +	  continue
  1.2591 +	fi
  1.2592 +
  1.2593 +    
  1.2594 +	if test "$linkmode" = prog && test "$pass" != link; then
  1.2595 +	  newlib_search_path="$newlib_search_path $ladir"
  1.2596 +	  deplibs="$lib $deplibs"
  1.2597 +
  1.2598 +	  linkalldeplibs=no
  1.2599 +	  if test "$link_all_deplibs" != no || test -z "$library_names" ||
  1.2600 +	     test "$build_libtool_libs" = no; then
  1.2601 +	    linkalldeplibs=yes
  1.2602 +	  fi
  1.2603 +
  1.2604 +	  tmp_libs=
  1.2605 +	  for deplib in $dependency_libs; do
  1.2606 +	    case $deplib in
  1.2607 +	    -L*) newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`;; ### testsuite: skip nested quoting test
  1.2608 +	    esac
  1.2609 +	    # Need to link against all dependency_libs?
  1.2610 +	    if test "$linkalldeplibs" = yes; then
  1.2611 +	      deplibs="$deplib $deplibs"
  1.2612 +	    else
  1.2613 +	      # Need to hardcode shared library paths
  1.2614 +	      # or/and link against static libraries
  1.2615 +	      newdependency_libs="$deplib $newdependency_libs"
  1.2616 +	    fi
  1.2617 +	    if test "X$duplicate_deps" = "Xyes" ; then
  1.2618 +	      case "$tmp_libs " in
  1.2619 +	      *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
  1.2620 +	      esac
  1.2621 +	    fi
  1.2622 +	    tmp_libs="$tmp_libs $deplib"
  1.2623 +	  done # for deplib
  1.2624 +	  continue
  1.2625 +	fi # $linkmode = prog...
  1.2626 +
  1.2627 +	if test "$linkmode,$pass" = "prog,link"; then
  1.2628 +	  if test -n "$library_names" &&
  1.2629 +	     { test "$prefer_static_libs" = no || test -z "$old_library"; }; then
  1.2630 +	    # We need to hardcode the library path
  1.2631 +	    if test -n "$shlibpath_var"; then
  1.2632 +	      # Make sure the rpath contains only unique directories.
  1.2633 +	      case "$temp_rpath " in
  1.2634 +	      *" $dir "*) ;;
  1.2635 +	      *" $absdir "*) ;;
  1.2636 +	      *) temp_rpath="$temp_rpath $dir" ;;
  1.2637 +	      esac
  1.2638 +	    fi
  1.2639 +
  1.2640 +	    # Hardcode the library path.
  1.2641 +	    # Skip directories that are in the system default run-time
  1.2642 +	    # search path.
  1.2643 +	    case " $sys_lib_dlsearch_path " in
  1.2644 +	    *" $absdir "*) ;;
  1.2645 +	    *)
  1.2646 +	      case "$compile_rpath " in
  1.2647 +	      *" $absdir "*) ;;
  1.2648 +	      *) compile_rpath="$compile_rpath $absdir"
  1.2649 +	      esac
  1.2650 +	      ;;
  1.2651 +	    esac
  1.2652 +	    case " $sys_lib_dlsearch_path " in
  1.2653 +	    *" $libdir "*) ;;
  1.2654 +	    *)
  1.2655 +	      case "$finalize_rpath " in
  1.2656 +	      *" $libdir "*) ;;
  1.2657 +	      *) finalize_rpath="$finalize_rpath $libdir"
  1.2658 +	      esac
  1.2659 +	      ;;
  1.2660 +	    esac
  1.2661 +	  fi # $linkmode,$pass = prog,link...
  1.2662 +
  1.2663 +	  if test "$alldeplibs" = yes &&
  1.2664 +	     { test "$deplibs_check_method" = pass_all ||
  1.2665 +	       { test "$build_libtool_libs" = yes &&
  1.2666 +		 test -n "$library_names"; }; }; then
  1.2667 +	    # We only need to search for static libraries
  1.2668 +	    continue
  1.2669 +	  fi
  1.2670 +	fi
  1.2671 +
  1.2672 +	link_static=no # Whether the deplib will be linked statically
  1.2673 +	if test -n "$library_names" &&
  1.2674 +	   { test "$prefer_static_libs" = no || test -z "$old_library"; }; then
  1.2675 +	  if test "$installed" = no; then
  1.2676 +	    notinst_deplibs="$notinst_deplibs $lib"
  1.2677 +	    need_relink=yes
  1.2678 +	  fi
  1.2679 +	  # This is a shared library
  1.2680 +	
  1.2681 +      # Warn about portability, can't link against -module's on some systems (darwin)
  1.2682 +      if test "$shouldnotlink" = yes && test "$pass" = link ; then
  1.2683 +	    $echo
  1.2684 +	    if test "$linkmode" = prog; then
  1.2685 +	      $echo "*** Warning: Linking the executable $output against the loadable module"
  1.2686 +	    else
  1.2687 +	      $echo "*** Warning: Linking the shared library $output against the loadable module"
  1.2688 +	    fi
  1.2689 +	    $echo "*** $linklib is not portable!"    
  1.2690 +      fi	  
  1.2691 +	  if test "$linkmode" = lib &&
  1.2692 +	     test "$hardcode_into_libs" = yes; then
  1.2693 +	    # Hardcode the library path.
  1.2694 +	    # Skip directories that are in the system default run-time
  1.2695 +	    # search path.
  1.2696 +	    case " $sys_lib_dlsearch_path " in
  1.2697 +	    *" $absdir "*) ;;
  1.2698 +	    *)
  1.2699 +	      case "$compile_rpath " in
  1.2700 +	      *" $absdir "*) ;;
  1.2701 +	      *) compile_rpath="$compile_rpath $absdir"
  1.2702 +	      esac
  1.2703 +	      ;;
  1.2704 +	    esac
  1.2705 +	    case " $sys_lib_dlsearch_path " in
  1.2706 +	    *" $libdir "*) ;;
  1.2707 +	    *)
  1.2708 +	      case "$finalize_rpath " in
  1.2709 +	      *" $libdir "*) ;;
  1.2710 +	      *) finalize_rpath="$finalize_rpath $libdir"
  1.2711 +	      esac
  1.2712 +	      ;;
  1.2713 +	    esac
  1.2714 +	  fi
  1.2715 +
  1.2716 +	  if test -n "$old_archive_from_expsyms_cmds"; then
  1.2717 +	    # figure out the soname
  1.2718 +	    set dummy $library_names
  1.2719 +	    realname="$2"
  1.2720 +	    shift; shift
  1.2721 +	    libname=`eval \\$echo \"$libname_spec\"`
  1.2722 +	    # use dlname if we got it. it's perfectly good, no?
  1.2723 +	    if test -n "$dlname"; then
  1.2724 +	      soname="$dlname"
  1.2725 +	    elif test -n "$soname_spec"; then
  1.2726 +	      # bleh windows
  1.2727 +	      case $host in
  1.2728 +	      *cygwin* | mingw*)
  1.2729 +		major=`expr $current - $age`
  1.2730 +		versuffix="-$major"
  1.2731 +		;;
  1.2732 +	      esac
  1.2733 +	      eval soname=\"$soname_spec\"
  1.2734 +	    else
  1.2735 +	      soname="$realname"
  1.2736 +	    fi
  1.2737 +
  1.2738 +	    # Make a new name for the extract_expsyms_cmds to use
  1.2739 +	    soroot="$soname"
  1.2740 +	    soname=`$echo $soroot | ${SED} -e 's/^.*\///'`
  1.2741 +	    newlib="libimp-`$echo $soname | ${SED} 's/^lib//;s/\.dll$//'`.a"
  1.2742 +
  1.2743 +	    # If the library has no export list, then create one now
  1.2744 +	    if test -f "$output_objdir/$soname-def"; then :
  1.2745 +	    else
  1.2746 +	      $show "extracting exported symbol list from \`$soname'"
  1.2747 +	      save_ifs="$IFS"; IFS='~'
  1.2748 +	      eval cmds=\"$extract_expsyms_cmds\"
  1.2749 +	      for cmd in $cmds; do
  1.2750 +		IFS="$save_ifs"
  1.2751 +		$show "$cmd"
  1.2752 +		$run eval "$cmd" || exit $?
  1.2753 +	      done
  1.2754 +	      IFS="$save_ifs"
  1.2755 +	    fi
  1.2756 +
  1.2757 +	    # Create $newlib
  1.2758 +	    if test -f "$output_objdir/$newlib"; then :; else
  1.2759 +	      $show "generating import library for \`$soname'"
  1.2760 +	      save_ifs="$IFS"; IFS='~'
  1.2761 +	      eval cmds=\"$old_archive_from_expsyms_cmds\"
  1.2762 +	      for cmd in $cmds; do
  1.2763 +		IFS="$save_ifs"
  1.2764 +		$show "$cmd"
  1.2765 +		$run eval "$cmd" || exit $?
  1.2766 +	      done
  1.2767 +	      IFS="$save_ifs"
  1.2768 +	    fi
  1.2769 +	    # make sure the library variables are pointing to the new library
  1.2770 +	    dir=$output_objdir
  1.2771 +	    linklib=$newlib
  1.2772 +	  fi # test -n "$old_archive_from_expsyms_cmds"
  1.2773 +
  1.2774 +	  if test "$linkmode" = prog || test "$mode" != relink; then
  1.2775 +	    add_shlibpath=
  1.2776 +	    add_dir=
  1.2777 +	    add=
  1.2778 +	    lib_linked=yes
  1.2779 +	    case $hardcode_action in
  1.2780 +	    immediate | unsupported)
  1.2781 +	      if test "$hardcode_direct" = no; then
  1.2782 +		add="$dir/$linklib"
  1.2783 +		case $host in
  1.2784 +		  *-*-sco3.2v5* ) add_dir="-L$dir" ;;
  1.2785 +		  *-*-darwin* )
  1.2786 +		    # if the lib is a module then we can not link against it, someone
  1.2787 +		    # is ignoring the new warnings I added
  1.2788 +		    if /usr/bin/file -L $add 2> /dev/null | grep "bundle" >/dev/null ; then
  1.2789 +		      $echo "** Warning, lib $linklib is a module, not a shared library"
  1.2790 +		      if test -z "$old_library" ; then
  1.2791 +		        $echo
  1.2792 +		        $echo "** And there doesn't seem to be a static archive available"
  1.2793 +		        $echo "** The link will probably fail, sorry"
  1.2794 +		      else
  1.2795 +		        add="$dir/$old_library"
  1.2796 +		      fi 
  1.2797 +		    fi
  1.2798 +		esac
  1.2799 +	      elif test "$hardcode_minus_L" = no; then
  1.2800 +		case $host in
  1.2801 +		*-*-sunos*) add_shlibpath="$dir" ;;
  1.2802 +		esac
  1.2803 +		add_dir="-L$dir"
  1.2804 +		add="-l$name"
  1.2805 +	      elif test "$hardcode_shlibpath_var" = no; then
  1.2806 +		add_shlibpath="$dir"
  1.2807 +		add="-l$name"
  1.2808 +	      else
  1.2809 +		lib_linked=no
  1.2810 +	      fi
  1.2811 +	      ;;
  1.2812 +	    relink)
  1.2813 +	      if test "$hardcode_direct" = yes; then
  1.2814 +		add="$dir/$linklib"
  1.2815 +	      elif test "$hardcode_minus_L" = yes; then
  1.2816 +		add_dir="-L$dir"
  1.2817 +		# Try looking first in the location we're being installed to.
  1.2818 +		if test -n "$inst_prefix_dir"; then
  1.2819 +		  case "$libdir" in
  1.2820 +		    [\\/]*)
  1.2821 +		      add_dir="-L$inst_prefix_dir$libdir $add_dir"
  1.2822 +		      ;;
  1.2823 +		  esac
  1.2824 +		fi
  1.2825 +		add="-l$name"
  1.2826 +	      elif test "$hardcode_shlibpath_var" = yes; then
  1.2827 +		add_shlibpath="$dir"
  1.2828 +		add="-l$name"
  1.2829 +	      else
  1.2830 +		lib_linked=no
  1.2831 +	      fi
  1.2832 +	      ;;
  1.2833 +	    *) lib_linked=no ;;
  1.2834 +	    esac
  1.2835 +
  1.2836 +	    if test "$lib_linked" != yes; then
  1.2837 +	      $echo "$modename: configuration error: unsupported hardcode properties"
  1.2838 +	      exit 1
  1.2839 +	    fi
  1.2840 +
  1.2841 +	    if test -n "$add_shlibpath"; then
  1.2842 +	      case :$compile_shlibpath: in
  1.2843 +	      *":$add_shlibpath:"*) ;;
  1.2844 +	      *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;;
  1.2845 +	      esac
  1.2846 +	    fi
  1.2847 +	    if test "$linkmode" = prog; then
  1.2848 +	      test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs"
  1.2849 +	      test -n "$add" && compile_deplibs="$add $compile_deplibs"
  1.2850 +	    else
  1.2851 +	      test -n "$add_dir" && deplibs="$add_dir $deplibs"
  1.2852 +	      test -n "$add" && deplibs="$add $deplibs"
  1.2853 +	      if test "$hardcode_direct" != yes && \
  1.2854 +		 test "$hardcode_minus_L" != yes && \
  1.2855 +		 test "$hardcode_shlibpath_var" = yes; then
  1.2856 +		case :$finalize_shlibpath: in
  1.2857 +		*":$libdir:"*) ;;
  1.2858 +		*) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
  1.2859 +		esac
  1.2860 +	      fi
  1.2861 +	    fi
  1.2862 +	  fi
  1.2863 +
  1.2864 +	  if test "$linkmode" = prog || test "$mode" = relink; then
  1.2865 +	    add_shlibpath=
  1.2866 +	    add_dir=
  1.2867 +	    add=
  1.2868 +	    # Finalize command for both is simple: just hardcode it.
  1.2869 +	    if test "$hardcode_direct" = yes; then
  1.2870 +	      add="$libdir/$linklib"
  1.2871 +	    elif test "$hardcode_minus_L" = yes; then
  1.2872 +	      add_dir="-L$libdir"
  1.2873 +	      add="-l$name"
  1.2874 +	    elif test "$hardcode_shlibpath_var" = yes; then
  1.2875 +	      case :$finalize_shlibpath: in
  1.2876 +	      *":$libdir:"*) ;;
  1.2877 +	      *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
  1.2878 +	      esac
  1.2879 +	      add="-l$name"
  1.2880 +	    elif test "$hardcode_automatic" = yes; then
  1.2881 +	      if test -n "$inst_prefix_dir" && test -f "$inst_prefix_dir$libdir/$linklib" ; then
  1.2882 +	        add="$inst_prefix_dir$libdir/$linklib"
  1.2883 +	      else
  1.2884 +	        add="$libdir/$linklib"
  1.2885 +	      fi
  1.2886 +	    else
  1.2887 +	      # We cannot seem to hardcode it, guess we'll fake it.
  1.2888 +	      add_dir="-L$libdir"
  1.2889 +	      # Try looking first in the location we're being installed to.
  1.2890 +	      if test -n "$inst_prefix_dir"; then
  1.2891 +		case "$libdir" in
  1.2892 +		  [\\/]*)
  1.2893 +		    add_dir="-L$inst_prefix_dir$libdir $add_dir"
  1.2894 +		    ;;
  1.2895 +		esac
  1.2896 +	      fi
  1.2897 +	      add="-l$name"
  1.2898 +	    fi
  1.2899 +
  1.2900 +	    if test "$linkmode" = prog; then
  1.2901 +	      test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs"
  1.2902 +	      test -n "$add" && finalize_deplibs="$add $finalize_deplibs"
  1.2903 +	    else
  1.2904 +	      test -n "$add_dir" && deplibs="$add_dir $deplibs"
  1.2905 +	      test -n "$add" && deplibs="$add $deplibs"
  1.2906 +	    fi
  1.2907 +	  fi
  1.2908 +	elif test "$linkmode" = prog; then
  1.2909 +	  # Here we assume that one of hardcode_direct or hardcode_minus_L
  1.2910 +	  # is not unsupported.  This is valid on all known static and
  1.2911 +	  # shared platforms.
  1.2912 +	  if test "$hardcode_direct" != unsupported; then
  1.2913 +	    test -n "$old_library" && linklib="$old_library"
  1.2914 +	    compile_deplibs="$dir/$linklib $compile_deplibs"
  1.2915 +	    finalize_deplibs="$dir/$linklib $finalize_deplibs"
  1.2916 +	  else
  1.2917 +	    compile_deplibs="-l$name -L$dir $compile_deplibs"
  1.2918 +	    finalize_deplibs="-l$name -L$dir $finalize_deplibs"
  1.2919 +	  fi
  1.2920 +	elif test "$build_libtool_libs" = yes; then
  1.2921 +	  # Not a shared library
  1.2922 +	  if test "$deplibs_check_method" != pass_all; then
  1.2923 +	    # We're trying link a shared library against a static one
  1.2924 +	    # but the system doesn't support it.
  1.2925 +
  1.2926 +	    # Just print a warning and add the library to dependency_libs so
  1.2927 +	    # that the program can be linked against the static library.
  1.2928 +	    $echo
  1.2929 +	    $echo "*** Warning: This system can not link to static lib archive $lib."
  1.2930 +	    $echo "*** I have the capability to make that library automatically link in when"
  1.2931 +	    $echo "*** you link to this library.  But I can only do this if you have a"
  1.2932 +	    $echo "*** shared version of the library, which you do not appear to have."
  1.2933 +	    if test "$module" = yes; then
  1.2934 +	      $echo "*** But as you try to build a module library, libtool will still create "
  1.2935 +	      $echo "*** a static module, that should work as long as the dlopening application"
  1.2936 +	      $echo "*** is linked with the -dlopen flag to resolve symbols at runtime."
  1.2937 +	      if test -z "$global_symbol_pipe"; then
  1.2938 +		$echo
  1.2939 +		$echo "*** However, this would only work if libtool was able to extract symbol"
  1.2940 +		$echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
  1.2941 +		$echo "*** not find such a program.  So, this module is probably useless."
  1.2942 +		$echo "*** \`nm' from GNU binutils and a full rebuild may help."
  1.2943 +	      fi
  1.2944 +	      if test "$build_old_libs" = no; then
  1.2945 +		build_libtool_libs=module
  1.2946 +		build_old_libs=yes
  1.2947 +	      else
  1.2948 +		build_libtool_libs=no
  1.2949 +	      fi
  1.2950 +	    fi
  1.2951 +	  else
  1.2952 +	    convenience="$convenience $dir/$old_library"
  1.2953 +	    old_convenience="$old_convenience $dir/$old_library"
  1.2954 +	    deplibs="$dir/$old_library $deplibs"
  1.2955 +	    link_static=yes
  1.2956 +	  fi
  1.2957 +	fi # link shared/static library?
  1.2958 +
  1.2959 +	if test "$linkmode" = lib; then
  1.2960 +	  if test -n "$dependency_libs" &&
  1.2961 +	     { test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes ||
  1.2962 +	       test "$link_static" = yes; }; then
  1.2963 +	    # Extract -R from dependency_libs
  1.2964 +	    temp_deplibs=
  1.2965 +	    for libdir in $dependency_libs; do
  1.2966 +	      case $libdir in
  1.2967 +	      -R*) temp_xrpath=`$echo "X$libdir" | $Xsed -e 's/^-R//'`
  1.2968 +		   case " $xrpath " in
  1.2969 +		   *" $temp_xrpath "*) ;;
  1.2970 +		   *) xrpath="$xrpath $temp_xrpath";;
  1.2971 +		   esac;;
  1.2972 +	      *) temp_deplibs="$temp_deplibs $libdir";;
  1.2973 +	      esac
  1.2974 +	    done
  1.2975 +	    dependency_libs="$temp_deplibs"
  1.2976 +	  fi
  1.2977 +
  1.2978 +	  newlib_search_path="$newlib_search_path $absdir"
  1.2979 +	  # Link against this library
  1.2980 +	  test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs"
  1.2981 +	  # ... and its dependency_libs
  1.2982 +	  tmp_libs=
  1.2983 +	  for deplib in $dependency_libs; do
  1.2984 +	    newdependency_libs="$deplib $newdependency_libs"
  1.2985 +	    if test "X$duplicate_deps" = "Xyes" ; then
  1.2986 +	      case "$tmp_libs " in
  1.2987 +	      *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
  1.2988 +	      esac
  1.2989 +	    fi
  1.2990 +	    tmp_libs="$tmp_libs $deplib"
  1.2991 +	  done
  1.2992 +
  1.2993 +	  if test "$link_all_deplibs" != no; then
  1.2994 +	    # Add the search paths of all dependency libraries
  1.2995 +	    for deplib in $dependency_libs; do
  1.2996 +	      case $deplib in
  1.2997 +	      -L*) path="$deplib" ;;
  1.2998 +	      *.la)
  1.2999 +		dir=`$echo "X$deplib" | $Xsed -e 's%/[^/]*$%%'`
  1.3000 +		test "X$dir" = "X$deplib" && dir="."
  1.3001 +		# We need an absolute path.
  1.3002 +		case $dir in
  1.3003 +		[\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;;
  1.3004 +		*)
  1.3005 +		  absdir=`cd "$dir" && pwd`
  1.3006 +		  if test -z "$absdir"; then
  1.3007 +		    $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2
  1.3008 +		    absdir="$dir"
  1.3009 +		  fi
  1.3010 +		  ;;
  1.3011 +		esac
  1.3012 +		if grep "^installed=no" $deplib > /dev/null; then
  1.3013 +		  path="$absdir/$objdir"
  1.3014 +		else
  1.3015 +		  eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
  1.3016 +		  if test -z "$libdir"; then
  1.3017 +		    $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
  1.3018 +		    exit 1
  1.3019 +		  fi
  1.3020 +		  if test "$absdir" != "$libdir"; then
  1.3021 +		    $echo "$modename: warning: \`$deplib' seems to be moved" 1>&2
  1.3022 +		  fi
  1.3023 +		  path="$absdir"
  1.3024 +		fi
  1.3025 +		depdepl=
  1.3026 +		case $host in
  1.3027 +		*-*-darwin*)
  1.3028 +		  # we do not want to link against static libs, but need to link against shared
  1.3029 +		  eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib`
  1.3030 +		  if test -n "$deplibrary_names" ; then
  1.3031 +		    for tmp in $deplibrary_names ; do
  1.3032 +		      depdepl=$tmp
  1.3033 +		    done
  1.3034 +		    if test -f "$path/$depdepl" ; then
  1.3035 +		      depdepl="$path/$depdepl"
  1.3036 +		   fi
  1.3037 +		    newlib_search_path="$newlib_search_path $path"
  1.3038 +		    path=""
  1.3039 +		  fi
  1.3040 +		  ;;
  1.3041 +		*)
  1.3042 +		path="-L$path"
  1.3043 +		;;
  1.3044 +		esac 
  1.3045 +		
  1.3046 +		;;
  1.3047 +		  -l*)
  1.3048 +		case $host in
  1.3049 +		*-*-darwin*)
  1.3050 +		 # Again, we only want to link against shared libraries
  1.3051 +		 eval tmp_libs=`$echo "X$deplib" | $Xsed -e "s,^\-l,,"`
  1.3052 +		 for tmp in $newlib_search_path ; do
  1.3053 +		     if test -f "$tmp/lib$tmp_libs.dylib" ; then
  1.3054 +		       eval depdepl="$tmp/lib$tmp_libs.dylib"
  1.3055 +		       break
  1.3056 +		     fi  
  1.3057 +         done
  1.3058 +         path=""
  1.3059 +		  ;;
  1.3060 +		*) continue ;;
  1.3061 +		esac  		  
  1.3062 +		;;
  1.3063 +	      *) continue ;;
  1.3064 +	      esac
  1.3065 +	      case " $deplibs " in
  1.3066 +	      *" $depdepl "*) ;;
  1.3067 +	      *) deplibs="$deplibs $depdepl" ;;
  1.3068 +	      esac	      
  1.3069 +	      case " $deplibs " in
  1.3070 +	      *" $path "*) ;;
  1.3071 +	      *) deplibs="$deplibs $path" ;;
  1.3072 +	      esac
  1.3073 +	    done
  1.3074 +	  fi # link_all_deplibs != no
  1.3075 +	fi # linkmode = lib
  1.3076 +      done # for deplib in $libs
  1.3077 +      dependency_libs="$newdependency_libs"
  1.3078 +      if test "$pass" = dlpreopen; then
  1.3079 +	# Link the dlpreopened libraries before other libraries
  1.3080 +	for deplib in $save_deplibs; do
  1.3081 +	  deplibs="$deplib $deplibs"
  1.3082 +	done
  1.3083 +      fi
  1.3084 +      if test "$pass" != dlopen; then
  1.3085 +	if test "$pass" != conv; then
  1.3086 +	  # Make sure lib_search_path contains only unique directories.
  1.3087 +	  lib_search_path=
  1.3088 +	  for dir in $newlib_search_path; do
  1.3089 +	    case "$lib_search_path " in
  1.3090 +	    *" $dir "*) ;;
  1.3091 +	    *) lib_search_path="$lib_search_path $dir" ;;
  1.3092 +	    esac
  1.3093 +	  done
  1.3094 +	  newlib_search_path=
  1.3095 +	fi
  1.3096 +
  1.3097 +	if test "$linkmode,$pass" != "prog,link"; then
  1.3098 +	  vars="deplibs"
  1.3099 +	else
  1.3100 +	  vars="compile_deplibs finalize_deplibs"
  1.3101 +	fi
  1.3102 +	for var in $vars dependency_libs; do
  1.3103 +	  # Add libraries to $var in reverse order
  1.3104 +	  eval tmp_libs=\"\$$var\"
  1.3105 +	  new_libs=
  1.3106 +	  for deplib in $tmp_libs; do
  1.3107 +	    # FIXME: Pedantically, this is the right thing to do, so
  1.3108 +	    #        that some nasty dependency loop isn't accidentally
  1.3109 +	    #        broken:
  1.3110 +	    #new_libs="$deplib $new_libs"
  1.3111 +	    # Pragmatically, this seems to cause very few problems in
  1.3112 +	    # practice:
  1.3113 +	    case $deplib in
  1.3114 +	    -L*) new_libs="$deplib $new_libs" ;;
  1.3115 +	    -R*) ;;
  1.3116 +	    *)
  1.3117 +	      # And here is the reason: when a library appears more
  1.3118 +	      # than once as an explicit dependence of a library, or
  1.3119 +	      # is implicitly linked in more than once by the
  1.3120 +	      # compiler, it is considered special, and multiple
  1.3121 +	      # occurrences thereof are not removed.  Compare this
  1.3122 +	      # with having the same library being listed as a
  1.3123 +	      # dependency of multiple other libraries: in this case,
  1.3124 +	      # we know (pedantically, we assume) the library does not
  1.3125 +	      # need to be listed more than once, so we keep only the
  1.3126 +	      # last copy.  This is not always right, but it is rare
  1.3127 +	      # enough that we require users that really mean to play
  1.3128 +	      # such unportable linking tricks to link the library
  1.3129 +	      # using -Wl,-lname, so that libtool does not consider it
  1.3130 +	      # for duplicate removal.
  1.3131 +	      case " $specialdeplibs " in
  1.3132 +	      *" $deplib "*) new_libs="$deplib $new_libs" ;;
  1.3133 +	      *)
  1.3134 +		case " $new_libs " in
  1.3135 +		*" $deplib "*) ;;
  1.3136 +		*) new_libs="$deplib $new_libs" ;;
  1.3137 +		esac
  1.3138 +		;;
  1.3139 +	      esac
  1.3140 +	      ;;
  1.3141 +	    esac
  1.3142 +	  done
  1.3143 +	  tmp_libs=
  1.3144 +	  for deplib in $new_libs; do
  1.3145 +	    case $deplib in
  1.3146 +	    -L*)
  1.3147 +	      case " $tmp_libs " in
  1.3148 +	      *" $deplib "*) ;;
  1.3149 +	      *) tmp_libs="$tmp_libs $deplib" ;;
  1.3150 +	      esac
  1.3151 +	      ;;
  1.3152 +	    *) tmp_libs="$tmp_libs $deplib" ;;
  1.3153 +	    esac
  1.3154 +	  done
  1.3155 +	  eval $var=\"$tmp_libs\"
  1.3156 +	done # for var
  1.3157 +      fi
  1.3158 +      # Last step: remove runtime libs from dependency_libs (they stay in deplibs)
  1.3159 +      tmp_libs=
  1.3160 +      for i in $dependency_libs ; do
  1.3161 +	case " $predeps $postdeps $compiler_lib_search_path " in
  1.3162 +	*" $i "*)
  1.3163 +	  i=""
  1.3164 +	  ;;
  1.3165 +	esac
  1.3166 +	if test -n "$i" ; then
  1.3167 +	  tmp_libs="$tmp_libs $i"
  1.3168 +	fi
  1.3169 +      done
  1.3170 +      dependency_libs=$tmp_libs
  1.3171 +    done # for pass
  1.3172 +    if test "$linkmode" = prog; then
  1.3173 +      dlfiles="$newdlfiles"
  1.3174 +      dlprefiles="$newdlprefiles"
  1.3175 +    fi
  1.3176 +
  1.3177 +    case $linkmode in
  1.3178 +    oldlib)
  1.3179        if test -n "$deplibs"; then
  1.3180  	$echo "$modename: warning: \`-l' and \`-L' are ignored for archives" 1>&2
  1.3181        fi
  1.3182 @@ -1578,7 +2727,7 @@
  1.3183        fi
  1.3184  
  1.3185        if test -n "$vinfo"; then
  1.3186 -	$echo "$modename: warning: \`-version-info' is ignored for archives" 1>&2
  1.3187 +	$echo "$modename: warning: \`-version-info/-version-number' is ignored for archives" 1>&2
  1.3188        fi
  1.3189  
  1.3190        if test -n "$release"; then
  1.3191 @@ -1592,13 +2741,15 @@
  1.3192        # Now set the variables for building old libraries.
  1.3193        build_libtool_libs=no
  1.3194        oldlibs="$output"
  1.3195 +      objs="$objs$old_deplibs"
  1.3196        ;;
  1.3197  
  1.3198 -    *.la)
  1.3199 +    lib)
  1.3200        # Make sure we only generate libraries of the form `libNAME.la'.
  1.3201 -      case "$outputname" in
  1.3202 +      case $outputname in
  1.3203        lib*)
  1.3204  	name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
  1.3205 +	eval shared_ext=\"$shrext\"
  1.3206  	eval libname=\"$libname_spec\"
  1.3207  	;;
  1.3208        *)
  1.3209 @@ -1610,6 +2761,7 @@
  1.3210  	if test "$need_lib_prefix" != no; then
  1.3211  	  # Add the "lib" prefix for modules if required
  1.3212  	  name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
  1.3213 +	  eval shared_ext=\"$shrext\"
  1.3214  	  eval libname=\"$libname_spec\"
  1.3215  	else
  1.3216  	  libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
  1.3217 @@ -1617,30 +2769,24 @@
  1.3218  	;;
  1.3219        esac
  1.3220  
  1.3221 -      output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'`
  1.3222 -      if test "X$output_objdir" = "X$output"; then
  1.3223 -	output_objdir="$objdir"
  1.3224 -      else
  1.3225 -	output_objdir="$output_objdir/$objdir"
  1.3226 +      if test -n "$objs"; then
  1.3227 +	if test "$deplibs_check_method" != pass_all; then
  1.3228 +	  $echo "$modename: cannot build libtool library \`$output' from non-libtool objects on this host:$objs" 2>&1
  1.3229 +	  exit 1
  1.3230 +	else
  1.3231 +	  $echo
  1.3232 +	  $echo "*** Warning: Linking the shared library $output against the non-libtool"
  1.3233 +	  $echo "*** objects $objs is not portable!"
  1.3234 +	  libobjs="$libobjs $objs"
  1.3235 +	fi
  1.3236        fi
  1.3237  
  1.3238 -      if test -n "$objs"; then
  1.3239 -	$echo "$modename: cannot build libtool library \`$output' from non-libtool objects:$objs" 2>&1
  1.3240 -	exit 1
  1.3241 -      fi
  1.3242 -
  1.3243 -      # How the heck are we supposed to write a wrapper for a shared library?
  1.3244 -      if test -n "$link_against_libtool_libs"; then
  1.3245 -	 $echo "$modename: error: cannot link shared libraries into libtool libraries" 1>&2
  1.3246 -	 exit 1
  1.3247 -      fi
  1.3248 -
  1.3249 -      if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
  1.3250 -	$echo "$modename: warning: \`-dlopen' is ignored for libtool libraries" 1>&2
  1.3251 +      if test "$dlself" != no; then
  1.3252 +	$echo "$modename: warning: \`-dlopen self' is ignored for libtool libraries" 1>&2
  1.3253        fi
  1.3254  
  1.3255        set dummy $rpath
  1.3256 -      if test $# -gt 2; then
  1.3257 +      if test "$#" -gt 2; then
  1.3258  	$echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2
  1.3259        fi
  1.3260        install_libdir="$2"
  1.3261 @@ -1649,15 +2795,16 @@
  1.3262        if test -z "$rpath"; then
  1.3263  	if test "$build_libtool_libs" = yes; then
  1.3264  	  # Building a libtool convenience library.
  1.3265 -	  libext=al
  1.3266 +	  # Some compilers have problems with a `.al' extension so
  1.3267 +	  # convenience libraries should have the same extension an
  1.3268 +	  # archive normally would.
  1.3269  	  oldlibs="$output_objdir/$libname.$libext $oldlibs"
  1.3270  	  build_libtool_libs=convenience
  1.3271  	  build_old_libs=yes
  1.3272  	fi
  1.3273 -	dependency_libs="$deplibs"
  1.3274  
  1.3275  	if test -n "$vinfo"; then
  1.3276 -	  $echo "$modename: warning: \`-version-info' is ignored for convenience libraries" 1>&2
  1.3277 +	  $echo "$modename: warning: \`-version-info/-version-number' is ignored for convenience libraries" 1>&2
  1.3278  	fi
  1.3279  
  1.3280  	if test -n "$release"; then
  1.3281 @@ -1666,7 +2813,7 @@
  1.3282        else
  1.3283  
  1.3284  	# Parse the version information argument.
  1.3285 -	IFS="${IFS= 	}"; save_ifs="$IFS"; IFS=':'
  1.3286 +	save_ifs="$IFS"; IFS=':'
  1.3287  	set dummy $vinfo 0 0 0
  1.3288  	IFS="$save_ifs"
  1.3289  
  1.3290 @@ -1676,13 +2823,50 @@
  1.3291  	  exit 1
  1.3292  	fi
  1.3293  
  1.3294 -	current="$2"
  1.3295 -	revision="$3"
  1.3296 -	age="$4"
  1.3297 +	# convert absolute version numbers to libtool ages
  1.3298 +	# this retains compatibility with .la files and attempts
  1.3299 +	# to make the code below a bit more comprehensible
  1.3300 +	
  1.3301 +	case $vinfo_number in
  1.3302 +	yes)
  1.3303 +	  number_major="$2"
  1.3304 +	  number_minor="$3"
  1.3305 +	  number_revision="$4"
  1.3306 +	  #
  1.3307 +	  # There are really only two kinds -- those that
  1.3308 +	  # use the current revision as the major version
  1.3309 +	  # and those that subtract age and use age as
  1.3310 +	  # a minor version.  But, then there is irix
  1.3311 +	  # which has an extra 1 added just for fun
  1.3312 +	  #
  1.3313 +	  case $version_type in
  1.3314 +	  darwin|linux|osf|windows)
  1.3315 +	    current=`expr $number_major + $number_minor`
  1.3316 +	    age="$number_minor"
  1.3317 +	    revision="$number_revision"
  1.3318 +	    ;;
  1.3319 +	  freebsd-aout|freebsd-elf|sunos)
  1.3320 +	    current="$number_major"
  1.3321 +	    revision="$number_minor"
  1.3322 +	    age="0"
  1.3323 +	    ;;
  1.3324 +	  irix|nonstopux)
  1.3325 +	    current=`expr $number_major + $number_minor - 1`
  1.3326 +	    age="$number_minor"
  1.3327 +	    revision="$number_minor"
  1.3328 +	    ;;
  1.3329 +	  esac
  1.3330 +	  ;;
  1.3331 +	no)
  1.3332 +	  current="$2"
  1.3333 +	  revision="$3"
  1.3334 +	  age="$4"
  1.3335 +	  ;;
  1.3336 +	esac
  1.3337  
  1.3338  	# Check that each of the things are valid numbers.
  1.3339 -	case "$current" in
  1.3340 -	0 | [1-9] | [1-9][0-9]*) ;;
  1.3341 +	case $current in
  1.3342 +	0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;;
  1.3343  	*)
  1.3344  	  $echo "$modename: CURRENT \`$current' is not a nonnegative integer" 1>&2
  1.3345  	  $echo "$modename: \`$vinfo' is not valid version information" 1>&2
  1.3346 @@ -1690,8 +2874,8 @@
  1.3347  	  ;;
  1.3348  	esac
  1.3349  
  1.3350 -	case "$revision" in
  1.3351 -	0 | [1-9] | [1-9][0-9]*) ;;
  1.3352 +	case $revision in
  1.3353 +	0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;;
  1.3354  	*)
  1.3355  	  $echo "$modename: REVISION \`$revision' is not a nonnegative integer" 1>&2
  1.3356  	  $echo "$modename: \`$vinfo' is not valid version information" 1>&2
  1.3357 @@ -1699,8 +2883,8 @@
  1.3358  	  ;;
  1.3359  	esac
  1.3360  
  1.3361 -	case "$age" in
  1.3362 -	0 | [1-9] | [1-9][0-9]*) ;;
  1.3363 +	case $age in
  1.3364 +	0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;;
  1.3365  	*)
  1.3366  	  $echo "$modename: AGE \`$age' is not a nonnegative integer" 1>&2
  1.3367  	  $echo "$modename: \`$vinfo' is not valid version information" 1>&2
  1.3368 @@ -1708,7 +2892,7 @@
  1.3369  	  ;;
  1.3370  	esac
  1.3371  
  1.3372 -	if test $age -gt $current; then
  1.3373 +	if test "$age" -gt "$current"; then
  1.3374  	  $echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2
  1.3375  	  $echo "$modename: \`$vinfo' is not valid version information" 1>&2
  1.3376  	  exit 1
  1.3377 @@ -1718,21 +2902,49 @@
  1.3378  	major=
  1.3379  	versuffix=
  1.3380  	verstring=
  1.3381 -	case "$version_type" in
  1.3382 +	case $version_type in
  1.3383  	none) ;;
  1.3384  
  1.3385 -	irix)
  1.3386 +	darwin)
  1.3387 +	  # Like Linux, but with the current version available in
  1.3388 +	  # verstring for coding it into the library header
  1.3389 +	  major=.`expr $current - $age`
  1.3390 +	  versuffix="$major.$age.$revision"
  1.3391 +	  # Darwin ld doesn't like 0 for these options...
  1.3392 +	  minor_current=`expr $current + 1`
  1.3393 +	  verstring="-compatibility_version $minor_current -current_version $minor_current.$revision"
  1.3394 +	  ;;
  1.3395 +
  1.3396 +	freebsd-aout)
  1.3397 +	  major=".$current"
  1.3398 +	  versuffix=".$current.$revision";
  1.3399 +	  ;;
  1.3400 +
  1.3401 +	freebsd-elf)
  1.3402 +	  major=".$current"
  1.3403 +	  versuffix=".$current";
  1.3404 +	  ;;
  1.3405 +
  1.3406 +	irix | nonstopux)
  1.3407  	  major=`expr $current - $age + 1`
  1.3408 -	  versuffix="$major.$revision"
  1.3409 -	  verstring="sgi$major.$revision"
  1.3410 +
  1.3411 +	  case $version_type in
  1.3412 +	    nonstopux) verstring_prefix=nonstopux ;;
  1.3413 +	    *)         verstring_prefix=sgi ;;
  1.3414 +	  esac
  1.3415 +	  verstring="$verstring_prefix$major.$revision"
  1.3416  
  1.3417  	  # Add in all the interfaces that we are compatible with.
  1.3418  	  loop=$revision
  1.3419 -	  while test $loop != 0; do
  1.3420 +	  while test "$loop" -ne 0; do
  1.3421  	    iface=`expr $revision - $loop`
  1.3422  	    loop=`expr $loop - 1`
  1.3423 -	    verstring="sgi$major.$iface:$verstring"
  1.3424 +	    verstring="$verstring_prefix$major.$iface:$verstring"
  1.3425  	  done
  1.3426 +
  1.3427 +	  # Before this point, $major must not contain `.'.
  1.3428 +	  major=.$major
  1.3429 +	  versuffix="$major.$revision"
  1.3430  	  ;;
  1.3431  
  1.3432  	linux)
  1.3433 @@ -1741,13 +2953,13 @@
  1.3434  	  ;;
  1.3435  
  1.3436  	osf)
  1.3437 -	  major=`expr $current - $age`
  1.3438 +	  major=.`expr $current - $age`
  1.3439  	  versuffix=".$current.$age.$revision"
  1.3440  	  verstring="$current.$age.$revision"
  1.3441  
  1.3442  	  # Add in all the interfaces that we are compatible with.
  1.3443  	  loop=$age
  1.3444 -	  while test $loop != 0; do
  1.3445 +	  while test "$loop" -ne 0; do
  1.3446  	    iface=`expr $current - $loop`
  1.3447  	    loop=`expr $loop - 1`
  1.3448  	    verstring="$verstring:${iface}.0"
  1.3449 @@ -1762,36 +2974,16 @@
  1.3450  	  versuffix=".$current.$revision"
  1.3451  	  ;;
  1.3452  
  1.3453 -	freebsd-aout)
  1.3454 -	  major=".$current"
  1.3455 -	  versuffix=".$current.$revision";
  1.3456 -	  ;;
  1.3457 -
  1.3458 -	freebsd-elf)
  1.3459 -	  major=".$current"
  1.3460 -	  versuffix=".$current";
  1.3461 -	  ;;
  1.3462 -
  1.3463  	windows)
  1.3464 -	  # Like Linux, but with '-' rather than '.', since we only
  1.3465 -	  # want one extension on Windows 95.
  1.3466 +	  # Use '-' rather than '.', since we only want one
  1.3467 +	  # extension on DOS 8.3 filesystems.
  1.3468  	  major=`expr $current - $age`
  1.3469 -	  versuffix="-$major-$age-$revision"
  1.3470 -	  ;;
  1.3471 -
  1.3472 -	darwin)
  1.3473 -	  # Like Linux, but with the current version available in
  1.3474 -	  # verstring for coding it into the library header
  1.3475 -	  major=.`expr $current - $age`
  1.3476 -	  versuffix="$major.$age.$revision"
  1.3477 -	  # Darwin ld doesn't like 0 for these options...
  1.3478 -	  minor_current=`expr $current + 1`
  1.3479 -	  verstring="-compatibility_version $minor_current -current_version $minor_current.$revision"
  1.3480 +	  versuffix="-$major"
  1.3481  	  ;;
  1.3482  
  1.3483  	*)
  1.3484  	  $echo "$modename: unknown library version type \`$version_type'" 1>&2
  1.3485 -	  echo "Fatal configuration error.  See the $PACKAGE docs for more information." 1>&2
  1.3486 +	  $echo "Fatal configuration error.  See the $PACKAGE docs for more information." 1>&2
  1.3487  	  exit 1
  1.3488  	  ;;
  1.3489  	esac
  1.3490 @@ -1799,14 +2991,14 @@
  1.3491  	# Clear the version info if we defaulted, and they specified a release.
  1.3492  	if test -z "$vinfo" && test -n "$release"; then
  1.3493  	  major=
  1.3494 -	  case "$version_type" in
  1.3495 +	  case $version_type in
  1.3496  	  darwin)
  1.3497  	    # we can't check for "0.0" in archive_cmds due to quoting
  1.3498  	    # problems, so we reset it completely
  1.3499 -	    verstring=""
  1.3500 +	    verstring=
  1.3501  	    ;;
  1.3502  	  *)
  1.3503 -	  verstring="0.0"
  1.3504 +	    verstring="0.0"
  1.3505  	    ;;
  1.3506  	  esac
  1.3507  	  if test "$need_version" = no; then
  1.3508 @@ -1822,7 +3014,7 @@
  1.3509  	  versuffix=
  1.3510  	  verstring=""
  1.3511  	fi
  1.3512 -	
  1.3513 +
  1.3514  	# Check to see if the archive will have undefined symbols.
  1.3515  	if test "$allow_undefined" = yes; then
  1.3516  	  if test "$allow_undefined_flag" = unsupported; then
  1.3517 @@ -1834,36 +3026,26 @@
  1.3518  	  # Don't allow undefined symbols.
  1.3519  	  allow_undefined_flag="$no_undefined_flag"
  1.3520  	fi
  1.3521 -
  1.3522 -	dependency_libs="$deplibs"
  1.3523 -	case "$host" in
  1.3524 -	*-*-cygwin* | *-*-mingw* | *-*-os2* | *-*-beos* | *-*-freebsd* )
  1.3525 -	  # these systems don't actually have a c library (as such)!
  1.3526 -	  ;;
  1.3527 -        *-*-rhapsody*)
  1.3528 -	  # rhapsody is a little odd...
  1.3529 -	  deplibs="$deplibs -framework System"
  1.3530 -	  ;;
  1.3531 -	*-*-openbsd*)
  1.3532 -	  # do not include libc due to us having libc/libc_r.
  1.3533 -	  ;;
  1.3534 -	*)
  1.3535 -	  # Add libc to deplibs on all other systems.
  1.3536 -	  deplibs="$deplibs -lc"
  1.3537 -	  ;;
  1.3538 -	esac
  1.3539        fi
  1.3540  
  1.3541 -      # Create the output directory, or remove our outputs if we need to.
  1.3542 -      if test -d $output_objdir; then
  1.3543 -	$show "${rm}r $output_objdir/$outputname $output_objdir/$libname.* $output_objdir/${libname}${release}.*"
  1.3544 -	$run ${rm}r $output_objdir/$outputname $output_objdir/$libname.* $output_objdir/${libname}${release}.*
  1.3545 -      else
  1.3546 -	$show "$mkdir $output_objdir"
  1.3547 -	$run $mkdir $output_objdir
  1.3548 -	status=$?
  1.3549 -	if test $status -ne 0 && test ! -d $output_objdir; then
  1.3550 -	  exit $status
  1.3551 +      if test "$mode" != relink; then
  1.3552 +	# Remove our outputs, but don't remove object files since they
  1.3553 +	# may have been created when compiling PIC objects.
  1.3554 +	removelist=
  1.3555 +	tempremovelist=`$echo "$output_objdir/*"`
  1.3556 +	for p in $tempremovelist; do
  1.3557 +	  case $p in
  1.3558 +	    *.$objext)
  1.3559 +	       ;;
  1.3560 +	    $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*)
  1.3561 +	       removelist="$removelist $p"
  1.3562 +	       ;;
  1.3563 +	    *) ;;
  1.3564 +	  esac
  1.3565 +	done
  1.3566 +	if test -n "$removelist"; then
  1.3567 +	  $show "${rm}r $removelist"
  1.3568 +	  $run ${rm}r $removelist
  1.3569  	fi
  1.3570        fi
  1.3571  
  1.3572 @@ -1875,7 +3057,74 @@
  1.3573  	oldobjs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP`
  1.3574        fi
  1.3575  
  1.3576 +      # Eliminate all temporary directories.
  1.3577 +      for path in $notinst_path; do
  1.3578 +	lib_search_path=`$echo "$lib_search_path " | ${SED} -e 's% $path % %g'`
  1.3579 +	deplibs=`$echo "$deplibs " | ${SED} -e 's% -L$path % %g'`
  1.3580 +	dependency_libs=`$echo "$dependency_libs " | ${SED} -e 's% -L$path % %g'`
  1.3581 +      done
  1.3582 +
  1.3583 +      if test -n "$xrpath"; then
  1.3584 +	# If the user specified any rpath flags, then add them.
  1.3585 +	temp_xrpath=
  1.3586 +	for libdir in $xrpath; do
  1.3587 +	  temp_xrpath="$temp_xrpath -R$libdir"
  1.3588 +	  case "$finalize_rpath " in
  1.3589 +	  *" $libdir "*) ;;
  1.3590 +	  *) finalize_rpath="$finalize_rpath $libdir" ;;
  1.3591 +	  esac
  1.3592 +	done
  1.3593 +	if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then
  1.3594 +	  dependency_libs="$temp_xrpath $dependency_libs"
  1.3595 +	fi
  1.3596 +      fi
  1.3597 +
  1.3598 +      # Make sure dlfiles contains only unique files that won't be dlpreopened
  1.3599 +      old_dlfiles="$dlfiles"
  1.3600 +      dlfiles=
  1.3601 +      for lib in $old_dlfiles; do
  1.3602 +	case " $dlprefiles $dlfiles " in
  1.3603 +	*" $lib "*) ;;
  1.3604 +	*) dlfiles="$dlfiles $lib" ;;
  1.3605 +	esac
  1.3606 +      done
  1.3607 +
  1.3608 +      # Make sure dlprefiles contains only unique files
  1.3609 +      old_dlprefiles="$dlprefiles"
  1.3610 +      dlprefiles=
  1.3611 +      for lib in $old_dlprefiles; do
  1.3612 +	case "$dlprefiles " in
  1.3613 +	*" $lib "*) ;;
  1.3614 +	*) dlprefiles="$dlprefiles $lib" ;;
  1.3615 +	esac
  1.3616 +      done
  1.3617 +
  1.3618        if test "$build_libtool_libs" = yes; then
  1.3619 +	if test -n "$rpath"; then
  1.3620 +	  case $host in
  1.3621 +	  *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos*)
  1.3622 +	    # these systems don't actually have a c library (as such)!
  1.3623 +	    ;;
  1.3624 +	  *-*-rhapsody* | *-*-darwin1.[012])
  1.3625 +	    # Rhapsody C library is in the System framework
  1.3626 +	    deplibs="$deplibs -framework System"
  1.3627 +	    ;;
  1.3628 +	  *-*-netbsd*)
  1.3629 +	    # Don't link with libc until the a.out ld.so is fixed.
  1.3630 +	    ;;
  1.3631 +	  *-*-openbsd* | *-*-freebsd*)
  1.3632 +	    # Do not include libc due to us having libc/libc_r.
  1.3633 +	    test "X$arg" = "X-lc" && continue
  1.3634 +	    ;;
  1.3635 + 	  *)
  1.3636 +	    # Add libc to deplibs on all other systems if necessary.
  1.3637 +	    if test "$build_libtool_need_lc" = "yes"; then
  1.3638 +	      deplibs="$deplibs -lc"
  1.3639 +	    fi
  1.3640 +	    ;;
  1.3641 +	  esac
  1.3642 +	fi
  1.3643 +
  1.3644  	# Transform deplibs into only deplibs that can be linked in shared.
  1.3645  	name_save=$name
  1.3646  	libname_save=$libname
  1.3647 @@ -1890,13 +3139,13 @@
  1.3648  	major=""
  1.3649  	newdeplibs=
  1.3650  	droppeddeps=no
  1.3651 -	case "$deplibs_check_method" in
  1.3652 +	case $deplibs_check_method in
  1.3653  	pass_all)
  1.3654  	  # Don't check for shared/static.  Everything works.
  1.3655  	  # This might be a little naive.  We might want to check
  1.3656  	  # whether the library exists or not.  But this is on
  1.3657  	  # osf3 & osf4 and I'm not really sure... Just
  1.3658 -	  # implementing what was already the behaviour.
  1.3659 +	  # implementing what was already the behavior.
  1.3660  	  newdeplibs=$deplibs
  1.3661  	  ;;
  1.3662  	test_compile)
  1.3663 @@ -1909,43 +3158,22 @@
  1.3664  	  int main() { return 0; }
  1.3665  EOF
  1.3666  	  $rm conftest
  1.3667 -	  $CC -o conftest conftest.c $deplibs
  1.3668 -	  if test $? -eq 0 ; then
  1.3669 +	  $LTCC -o conftest conftest.c $deplibs
  1.3670 +	  if test "$?" -eq 0 ; then
  1.3671  	    ldd_output=`ldd conftest`
  1.3672  	    for i in $deplibs; do
  1.3673  	      name="`expr $i : '-l\(.*\)'`"
  1.3674  	      # If $name is empty we are operating on a -L argument.
  1.3675 -	      if test "$name" != "" ; then
  1.3676 -		libname=`eval \\$echo \"$libname_spec\"`
  1.3677 -		deplib_matches=`eval \\$echo \"$library_names_spec\"`
  1.3678 -		set dummy $deplib_matches
  1.3679 -		deplib_match=$2
  1.3680 -		if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
  1.3681 -		  newdeplibs="$newdeplibs $i"
  1.3682 -		else
  1.3683 -		  droppeddeps=yes
  1.3684 -		  echo
  1.3685 -		  echo "*** Warning: This library needs some functionality provided by $i."
  1.3686 -		  echo "*** I have the capability to make that library automatically link in when"
  1.3687 -		  echo "*** you link to this library.  But I can only do this if you have a"
  1.3688 -		  echo "*** shared version of the library, which you do not appear to have."
  1.3689 -		fi
  1.3690 -	      else
  1.3691 -		newdeplibs="$newdeplibs $i"
  1.3692 -	      fi
  1.3693 -	    done
  1.3694 -	  else
  1.3695 -	    # Error occured in the first compile.  Let's try to salvage the situation:
  1.3696 -	    # Compile a seperate program for each library.
  1.3697 -	    for i in $deplibs; do
  1.3698 -	      name="`expr $i : '-l\(.*\)'`"
  1.3699 -	     # If $name is empty we are operating on a -L argument.
  1.3700 -	      if test "$name" != "" ; then
  1.3701 -		$rm conftest
  1.3702 -		$CC -o conftest conftest.c $i
  1.3703 -		# Did it work?
  1.3704 -		if test $? -eq 0 ; then
  1.3705 -		  ldd_output=`ldd conftest`
  1.3706 +              if test "$name" != "" && test "$name" -ne "0"; then
  1.3707 +		if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
  1.3708 +		  case " $predeps $postdeps " in
  1.3709 +		  *" $i "*)
  1.3710 +		    newdeplibs="$newdeplibs $i"
  1.3711 +		    i=""
  1.3712 +		    ;;
  1.3713 +		  esac
  1.3714 +	        fi
  1.3715 +		if test -n "$i" ; then
  1.3716  		  libname=`eval \\$echo \"$libname_spec\"`
  1.3717  		  deplib_matches=`eval \\$echo \"$library_names_spec\"`
  1.3718  		  set dummy $deplib_matches
  1.3719 @@ -1954,19 +3182,64 @@
  1.3720  		    newdeplibs="$newdeplibs $i"
  1.3721  		  else
  1.3722  		    droppeddeps=yes
  1.3723 -		    echo
  1.3724 -		    echo "*** Warning: This library needs some functionality provided by $i."
  1.3725 -		    echo "*** I have the capability to make that library automatically link in when"
  1.3726 -		    echo "*** you link to this library.  But I can only do this if you have a"
  1.3727 -		    echo "*** shared version of the library, which you do not appear to have."
  1.3728 +		    $echo
  1.3729 +		    $echo "*** Warning: dynamic linker does not accept needed library $i."
  1.3730 +		    $echo "*** I have the capability to make that library automatically link in when"
  1.3731 +		    $echo "*** you link to this library.  But I can only do this if you have a"
  1.3732 +		    $echo "*** shared version of the library, which I believe you do not have"
  1.3733 +		    $echo "*** because a test_compile did reveal that the linker did not use it for"
  1.3734 +		    $echo "*** its dynamic dependency list that programs get resolved with at runtime."
  1.3735 +		  fi
  1.3736 +		fi
  1.3737 +	      else
  1.3738 +		newdeplibs="$newdeplibs $i"
  1.3739 +	      fi
  1.3740 +	    done
  1.3741 +	  else
  1.3742 +	    # Error occurred in the first compile.  Let's try to salvage
  1.3743 +	    # the situation: Compile a separate program for each library.
  1.3744 +	    for i in $deplibs; do
  1.3745 +	      name="`expr $i : '-l\(.*\)'`"
  1.3746 +	      # If $name is empty we are operating on a -L argument.
  1.3747 +              if test "$name" != "" && test "$name" != "0"; then
  1.3748 +		$rm conftest
  1.3749 +		$LTCC -o conftest conftest.c $i
  1.3750 +		# Did it work?
  1.3751 +		if test "$?" -eq 0 ; then
  1.3752 +		  ldd_output=`ldd conftest`
  1.3753 +		  if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
  1.3754 +		    case " $predeps $postdeps " in
  1.3755 +		    *" $i "*)
  1.3756 +		      newdeplibs="$newdeplibs $i"
  1.3757 +		      i=""
  1.3758 +		      ;;
  1.3759 +		    esac
  1.3760 +		  fi
  1.3761 +		  if test -n "$i" ; then
  1.3762 +		    libname=`eval \\$echo \"$libname_spec\"`
  1.3763 +		    deplib_matches=`eval \\$echo \"$library_names_spec\"`
  1.3764 +		    set dummy $deplib_matches
  1.3765 +		    deplib_match=$2
  1.3766 +		    if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
  1.3767 +		      newdeplibs="$newdeplibs $i"
  1.3768 +		    else
  1.3769 +		      droppeddeps=yes
  1.3770 +		      $echo
  1.3771 +		      $echo "*** Warning: dynamic linker does not accept needed library $i."
  1.3772 +		      $echo "*** I have the capability to make that library automatically link in when"
  1.3773 +		      $echo "*** you link to this library.  But I can only do this if you have a"
  1.3774 +		      $echo "*** shared version of the library, which you do not appear to have"
  1.3775 +		      $echo "*** because a test_compile did reveal that the linker did not use this one"
  1.3776 +		      $echo "*** as a dynamic dependency that programs can get resolved with at runtime."
  1.3777 +		    fi
  1.3778  		  fi
  1.3779  		else
  1.3780  		  droppeddeps=yes
  1.3781 -		  echo
  1.3782 -		  echo "*** Warning!  Library $i is needed by this library but I was not able to"
  1.3783 -		  echo "***  make it link in!  You will probably need to install it or some"
  1.3784 -		  echo "*** library that it depends on before this library will be fully"
  1.3785 -		  echo "*** functional.  Installing it before continuing would be even better."
  1.3786 +		  $echo
  1.3787 +		  $echo "*** Warning!  Library $i is needed by this library but I was not able to"
  1.3788 +		  $echo "***  make it link in!  You will probably need to install it or some"
  1.3789 +		  $echo "*** library that it depends on before this library will be fully"
  1.3790 +		  $echo "*** functional.  Installing it before continuing would be even better."
  1.3791  		fi
  1.3792  	      else
  1.3793  		newdeplibs="$newdeplibs $i"
  1.3794 @@ -1976,19 +3249,28 @@
  1.3795  	  ;;
  1.3796  	file_magic*)
  1.3797  	  set dummy $deplibs_check_method
  1.3798 -	  file_magic_regex="`expr \"$deplibs_check_method\" : \"$2 \(.*\)\"`"
  1.3799 +	  file_magic_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
  1.3800  	  for a_deplib in $deplibs; do
  1.3801  	    name="`expr $a_deplib : '-l\(.*\)'`"
  1.3802  	    # If $name is empty we are operating on a -L argument.
  1.3803 -	    if test "$name" != "" ; then
  1.3804 -	      libname=`eval \\$echo \"$libname_spec\"`
  1.3805 -	      for i in $lib_search_path; do
  1.3806 -		    potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
  1.3807 -		    for potent_lib in $potential_libs; do
  1.3808 +            if test "$name" != "" && test  "$name" != "0"; then
  1.3809 +	      if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
  1.3810 +		case " $predeps $postdeps " in
  1.3811 +		*" $a_deplib "*)
  1.3812 +		  newdeplibs="$newdeplibs $a_deplib"
  1.3813 +		  a_deplib=""
  1.3814 +		  ;;
  1.3815 +		esac
  1.3816 +	      fi
  1.3817 +	      if test -n "$a_deplib" ; then
  1.3818 +		libname=`eval \\$echo \"$libname_spec\"`
  1.3819 +		for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
  1.3820 +		  potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
  1.3821 +		  for potent_lib in $potential_libs; do
  1.3822  		      # Follow soft links.
  1.3823  		      if ls -lLd "$potent_lib" 2>/dev/null \
  1.3824  			 | grep " -> " >/dev/null; then
  1.3825 -			continue 
  1.3826 +			continue
  1.3827  		      fi
  1.3828  		      # The statement above tries to avoid entering an
  1.3829  		      # endless loop below, in case of cyclic links.
  1.3830 @@ -1997,28 +3279,88 @@
  1.3831  		      # but so what?
  1.3832  		      potlib="$potent_lib"
  1.3833  		      while test -h "$potlib" 2>/dev/null; do
  1.3834 -			potliblink=`ls -ld $potlib | sed 's/.* -> //'`
  1.3835 -			case "$potliblink" in
  1.3836 +			potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'`
  1.3837 +			case $potliblink in
  1.3838  			[\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";;
  1.3839  			*) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";;
  1.3840  			esac
  1.3841  		      done
  1.3842  		      if eval $file_magic_cmd \"\$potlib\" 2>/dev/null \
  1.3843 -			 | sed 10q \
  1.3844 -			 | egrep "$file_magic_regex" > /dev/null; then
  1.3845 +			 | ${SED} 10q \
  1.3846 +			 | $EGREP "$file_magic_regex" > /dev/null; then
  1.3847  			newdeplibs="$newdeplibs $a_deplib"
  1.3848  			a_deplib=""
  1.3849  			break 2
  1.3850  		      fi
  1.3851 -		    done
  1.3852 -	      done
  1.3853 +		  done
  1.3854 +		done
  1.3855 +	      fi
  1.3856  	      if test -n "$a_deplib" ; then
  1.3857  		droppeddeps=yes
  1.3858 -		echo
  1.3859 -		echo "*** Warning: This library needs some functionality provided by $a_deplib."
  1.3860 -		echo "*** I have the capability to make that library automatically link in when"
  1.3861 -		echo "*** you link to this library.  But I can only do this if you have a"
  1.3862 -		echo "*** shared version of the library, which you do not appear to have."
  1.3863 +		$echo
  1.3864 +		$echo "*** Warning: linker path does not have real file for library $a_deplib."
  1.3865 +		$echo "*** I have the capability to make that library automatically link in when"
  1.3866 +		$echo "*** you link to this library.  But I can only do this if you have a"
  1.3867 +		$echo "*** shared version of the library, which you do not appear to have"
  1.3868 +		$echo "*** because I did check the linker path looking for a file starting"
  1.3869 +		if test -z "$potlib" ; then
  1.3870 +		  $echo "*** with $libname but no candidates were found. (...for file magic test)"
  1.3871 +		else
  1.3872 +		  $echo "*** with $libname and none of the candidates passed a file format test"
  1.3873 +		  $echo "*** using a file magic. Last file checked: $potlib"
  1.3874 +		fi
  1.3875 +	      fi
  1.3876 +	    else
  1.3877 +	      # Add a -L argument.
  1.3878 +	      newdeplibs="$newdeplibs $a_deplib"
  1.3879 +	    fi
  1.3880 +	  done # Gone through all deplibs.
  1.3881 +	  ;;
  1.3882 +	match_pattern*)
  1.3883 +	  set dummy $deplibs_check_method
  1.3884 +	  match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
  1.3885 +	  for a_deplib in $deplibs; do
  1.3886 +	    name="`expr $a_deplib : '-l\(.*\)'`"
  1.3887 +	    # If $name is empty we are operating on a -L argument.
  1.3888 +	    if test -n "$name" && test "$name" != "0"; then
  1.3889 +	      if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
  1.3890 +		case " $predeps $postdeps " in
  1.3891 +		*" $a_deplib "*)
  1.3892 +		  newdeplibs="$newdeplibs $a_deplib"
  1.3893 +		  a_deplib=""
  1.3894 +		  ;;
  1.3895 +		esac
  1.3896 +	      fi
  1.3897 +	      if test -n "$a_deplib" ; then
  1.3898 +		libname=`eval \\$echo \"$libname_spec\"`
  1.3899 +		for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
  1.3900 +		  potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
  1.3901 +		  for potent_lib in $potential_libs; do
  1.3902 +		    potlib="$potent_lib" # see symlink-check above in file_magic test
  1.3903 +		    if eval $echo \"$potent_lib\" 2>/dev/null \
  1.3904 +		        | ${SED} 10q \
  1.3905 +		        | $EGREP "$match_pattern_regex" > /dev/null; then
  1.3906 +		      newdeplibs="$newdeplibs $a_deplib"
  1.3907 +		      a_deplib=""
  1.3908 +		      break 2
  1.3909 +		    fi
  1.3910 +		  done
  1.3911 +		done
  1.3912 +	      fi
  1.3913 +	      if test -n "$a_deplib" ; then
  1.3914 +		droppeddeps=yes
  1.3915 +		$echo
  1.3916 +		$echo "*** Warning: linker path does not have real file for library $a_deplib."
  1.3917 +		$echo "*** I have the capability to make that library automatically link in when"
  1.3918 +		$echo "*** you link to this library.  But I can only do this if you have a"
  1.3919 +		$echo "*** shared version of the library, which you do not appear to have"
  1.3920 +		$echo "*** because I did check the linker path looking for a file starting"
  1.3921 +		if test -z "$potlib" ; then
  1.3922 +		  $echo "*** with $libname but no candidates were found. (...for regex pattern test)"
  1.3923 +		else
  1.3924 +		  $echo "*** with $libname and none of the candidates passed a file format test"
  1.3925 +		  $echo "*** using a regex pattern. Last file checked: $potlib"
  1.3926 +		fi
  1.3927  	      fi
  1.3928  	    else
  1.3929  	      # Add a -L argument.
  1.3930 @@ -2028,16 +3370,23 @@
  1.3931  	  ;;
  1.3932  	none | unknown | *)
  1.3933  	  newdeplibs=""
  1.3934 -	  if $echo "X $deplibs" | $Xsed -e 's/ -lc$//' \
  1.3935 -	       -e 's/ -[LR][^ ]*//g' -e 's/[ 	]//g' |
  1.3936 -	     grep . >/dev/null; then
  1.3937 -	    echo
  1.3938 +	  tmp_deplibs=`$echo "X $deplibs" | $Xsed -e 's/ -lc$//' \
  1.3939 +	    -e 's/ -[LR][^ ]*//g'`
  1.3940 +	  if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
  1.3941 +	    for i in $predeps $postdeps ; do
  1.3942 +	      # can't use Xsed below, because $i might contain '/'
  1.3943 +	      tmp_deplibs=`$echo "X $tmp_deplibs" | ${SED} -e "1s,^X,," -e "s,$i,,"`
  1.3944 +	    done
  1.3945 +	  fi
  1.3946 +	  if $echo "X $tmp_deplibs" | $Xsed -e 's/[ 	]//g' \
  1.3947 +	    | grep . >/dev/null; then
  1.3948 +	    $echo
  1.3949  	    if test "X$deplibs_check_method" = "Xnone"; then
  1.3950 -	      echo "*** Warning: inter-library dependencies are not supported in this platform."
  1.3951 +	      $echo "*** Warning: inter-library dependencies are not supported in this platform."
  1.3952  	    else
  1.3953 -	      echo "*** Warning: inter-library dependencies are not known to be supported."
  1.3954 +	      $echo "*** Warning: inter-library dependencies are not known to be supported."
  1.3955  	    fi
  1.3956 -	    echo "*** All declared inter-library dependencies are being dropped."
  1.3957 +	    $echo "*** All declared inter-library dependencies are being dropped."
  1.3958  	    droppeddeps=yes
  1.3959  	  fi
  1.3960  	  ;;
  1.3961 @@ -2048,19 +3397,26 @@
  1.3962  	libname=$libname_save
  1.3963  	name=$name_save
  1.3964  
  1.3965 +	case $host in
  1.3966 +	*-*-rhapsody* | *-*-darwin1.[012])
  1.3967 +	  # On Rhapsody replace the C library is the System framework
  1.3968 +	  newdeplibs=`$echo "X $newdeplibs" | $Xsed -e 's/ -lc / -framework System /'`
  1.3969 +	  ;;
  1.3970 +	esac
  1.3971 +
  1.3972  	if test "$droppeddeps" = yes; then
  1.3973  	  if test "$module" = yes; then
  1.3974 -	    echo
  1.3975 -	    echo "*** Warning: libtool could not satisfy all declared inter-library"
  1.3976 -	    echo "*** dependencies of module $libname.  Therefore, libtool will create"
  1.3977 -	    echo "*** a static module, that should work as long as the dlopening"
  1.3978 -	    echo "*** application is linked with the -dlopen flag."
  1.3979 +	    $echo
  1.3980 +	    $echo "*** Warning: libtool could not satisfy all declared inter-library"
  1.3981 +	    $echo "*** dependencies of module $libname.  Therefore, libtool will create"
  1.3982 +	    $echo "*** a static module, that should work as long as the dlopening"
  1.3983 +	    $echo "*** application is linked with the -dlopen flag."
  1.3984  	    if test -z "$global_symbol_pipe"; then
  1.3985 -	      echo
  1.3986 -	      echo "*** However, this would only work if libtool was able to extract symbol"
  1.3987 -	      echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
  1.3988 -	      echo "*** not find such a program.  So, this module is probably useless."
  1.3989 -	      echo "*** \`nm' from GNU binutils and a full rebuild may help."
  1.3990 +	      $echo
  1.3991 +	      $echo "*** However, this would only work if libtool was able to extract symbol"
  1.3992 +	      $echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
  1.3993 +	      $echo "*** not find such a program.  So, this module is probably useless."
  1.3994 +	      $echo "*** \`nm' from GNU binutils and a full rebuild may help."
  1.3995  	    fi
  1.3996  	    if test "$build_old_libs" = no; then
  1.3997  	      oldlibs="$output_objdir/$libname.$libext"
  1.3998 @@ -2070,9 +3426,24 @@
  1.3999  	      build_libtool_libs=no
  1.4000  	    fi
  1.4001  	  else
  1.4002 -	    echo "*** The inter-library dependencies that have been dropped here will be"
  1.4003 -	    echo "*** automatically added whenever a program is linked with this library"
  1.4004 -	    echo "*** or is declared to -dlopen it."
  1.4005 +	    $echo "*** The inter-library dependencies that have been dropped here will be"
  1.4006 +	    $echo "*** automatically added whenever a program is linked with this library"
  1.4007 +	    $echo "*** or is declared to -dlopen it."
  1.4008 +
  1.4009 +	    if test "$allow_undefined" = no; then
  1.4010 +	      $echo
  1.4011 +	      $echo "*** Since this library must not contain undefined symbols,"
  1.4012 +	      $echo "*** because either the platform does not support them or"
  1.4013 +	      $echo "*** it was explicitly requested with -no-undefined,"
  1.4014 +	      $echo "*** libtool will only create a static version of it."
  1.4015 +	      if test "$build_old_libs" = no; then
  1.4016 +		oldlibs="$output_objdir/$libname.$libext"
  1.4017 +		build_libtool_libs=module
  1.4018 +		build_old_libs=yes
  1.4019 +	      else
  1.4020 +		build_libtool_libs=no
  1.4021 +	      fi
  1.4022 +	    fi
  1.4023  	  fi
  1.4024  	fi
  1.4025  	# Done checking deplibs!
  1.4026 @@ -2083,10 +3454,70 @@
  1.4027        library_names=
  1.4028        old_library=
  1.4029        dlname=
  1.4030 -      
  1.4031 +
  1.4032        # Test again, we may have decided not to build it any more
  1.4033        if test "$build_libtool_libs" = yes; then
  1.4034 +	if test "$hardcode_into_libs" = yes; then
  1.4035 +	  # Hardcode the library paths
  1.4036 +	  hardcode_libdirs=
  1.4037 +	  dep_rpath=
  1.4038 +	  rpath="$finalize_rpath"
  1.4039 +	  test "$mode" != relink && rpath="$compile_rpath$rpath"
  1.4040 +	  for libdir in $rpath; do
  1.4041 +	    if test -n "$hardcode_libdir_flag_spec"; then
  1.4042 +	      if test -n "$hardcode_libdir_separator"; then
  1.4043 +		if test -z "$hardcode_libdirs"; then
  1.4044 +		  hardcode_libdirs="$libdir"
  1.4045 +		else
  1.4046 +		  # Just accumulate the unique libdirs.
  1.4047 +		  case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
  1.4048 +		  *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
  1.4049 +		    ;;
  1.4050 +		  *)
  1.4051 +		    hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
  1.4052 +		    ;;
  1.4053 +		  esac
  1.4054 +		fi
  1.4055 +	      else
  1.4056 +		eval flag=\"$hardcode_libdir_flag_spec\"
  1.4057 +		dep_rpath="$dep_rpath $flag"
  1.4058 +	      fi
  1.4059 +	    elif test -n "$runpath_var"; then
  1.4060 +	      case "$perm_rpath " in
  1.4061 +	      *" $libdir "*) ;;
  1.4062 +	      *) perm_rpath="$perm_rpath $libdir" ;;
  1.4063 +	      esac
  1.4064 +	    fi
  1.4065 +	  done
  1.4066 +	  # Substitute the hardcoded libdirs into the rpath.
  1.4067 +	  if test -n "$hardcode_libdir_separator" &&
  1.4068 +	     test -n "$hardcode_libdirs"; then
  1.4069 +	    libdir="$hardcode_libdirs"
  1.4070 +	    if test -n "$hardcode_libdir_flag_spec_ld"; then
  1.4071 +	      eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\"
  1.4072 +	    else
  1.4073 +	      eval dep_rpath=\"$hardcode_libdir_flag_spec\"
  1.4074 +	    fi
  1.4075 +	  fi
  1.4076 +	  if test -n "$runpath_var" && test -n "$perm_rpath"; then
  1.4077 +	    # We should set the runpath_var.
  1.4078 +	    rpath=
  1.4079 +	    for dir in $perm_rpath; do
  1.4080 +	      rpath="$rpath$dir:"
  1.4081 +	    done
  1.4082 +	    eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var"
  1.4083 +	  fi
  1.4084 +	  test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs"
  1.4085 +	fi
  1.4086 +
  1.4087 +	shlibpath="$finalize_shlibpath"
  1.4088 +	test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath"
  1.4089 +	if test -n "$shlibpath"; then
  1.4090 +	  eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var"
  1.4091 +	fi
  1.4092 +
  1.4093  	# Get the real and link names of the library.
  1.4094 +	eval shared_ext=\"$shrext\"
  1.4095  	eval library_names=\"$library_names_spec\"
  1.4096  	set dummy $library_names
  1.4097  	realname="$2"
  1.4098 @@ -2097,6 +3528,9 @@
  1.4099  	else
  1.4100  	  soname="$realname"
  1.4101  	fi
  1.4102 +	if test -z "$dlname"; then
  1.4103 +	  dlname=$soname
  1.4104 +	fi
  1.4105  
  1.4106  	lib="$output_objdir/$realname"
  1.4107  	for link
  1.4108 @@ -2104,23 +3538,6 @@
  1.4109  	  linknames="$linknames $link"
  1.4110  	done
  1.4111  
  1.4112 -	# Ensure that we have .o objects for linkers which dislike .lo
  1.4113 -	# (e.g. aix) in case we are running --disable-static
  1.4114 -	for obj in $libobjs; do
  1.4115 -	  xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'`
  1.4116 -	  if test "X$xdir" = "X$obj"; then
  1.4117 -	    xdir="."
  1.4118 -	  else
  1.4119 -	    xdir="$xdir"
  1.4120 -	  fi
  1.4121 -	  baseobj=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
  1.4122 -	  oldobj=`$echo "X$baseobj" | $Xsed -e "$lo2o"`
  1.4123 -	  if test ! -f $xdir/$oldobj; then
  1.4124 -	    $show "(cd $xdir && ${LN_S} $baseobj $oldobj)"
  1.4125 -	    $run eval '(cd $xdir && ${LN_S} $baseobj $oldobj)' || exit $?
  1.4126 -	  fi
  1.4127 -	done
  1.4128 -
  1.4129  	# Use standard objects if they are pic
  1.4130  	test -z "$pic_flag" && libobjs=`$echo "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
  1.4131  
  1.4132 @@ -2131,16 +3548,24 @@
  1.4133  	    export_symbols="$output_objdir/$libname.exp"
  1.4134  	    $run $rm $export_symbols
  1.4135  	    eval cmds=\"$export_symbols_cmds\"
  1.4136 -	    IFS="${IFS= 	}"; save_ifs="$IFS"; IFS='~'
  1.4137 +	    save_ifs="$IFS"; IFS='~'
  1.4138  	    for cmd in $cmds; do
  1.4139  	      IFS="$save_ifs"
  1.4140 -	      $show "$cmd"
  1.4141 -	      $run eval "$cmd" || exit $?
  1.4142 +	      if len=`expr "X$cmd" : ".*"` &&
  1.4143 +	       test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
  1.4144 +	        $show "$cmd"
  1.4145 +	        $run eval "$cmd" || exit $?
  1.4146 +	        skipped_export=false
  1.4147 +	      else
  1.4148 +	        # The command line is too long to execute in one step.
  1.4149 +	        $show "using reloadable object file for export list..."
  1.4150 +	        skipped_export=:
  1.4151 +	      fi
  1.4152  	    done
  1.4153  	    IFS="$save_ifs"
  1.4154  	    if test -n "$export_symbols_regex"; then
  1.4155 -	      $show "egrep -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\""
  1.4156 -	      $run eval 'egrep -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
  1.4157 +	      $show "$EGREP -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\""
  1.4158 +	      $run eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
  1.4159  	      $show "$mv \"${export_symbols}T\" \"$export_symbols\""
  1.4160  	      $run eval '$mv "${export_symbols}T" "$export_symbols"'
  1.4161  	    fi
  1.4162 @@ -2151,24 +3576,36 @@
  1.4163  	  $run eval '$echo "X$include_expsyms" | $SP2NL >> "$export_symbols"'
  1.4164  	fi
  1.4165  
  1.4166 +	tmp_deplibs=
  1.4167 +	for test_deplib in $deplibs; do
  1.4168 +		case " $convenience " in
  1.4169 +		*" $test_deplib "*) ;;
  1.4170 +		*) 
  1.4171 +			tmp_deplibs="$tmp_deplibs $test_deplib"
  1.4172 +			;;
  1.4173 +		esac
  1.4174 +	done
  1.4175 +	deplibs="$tmp_deplibs" 
  1.4176 +
  1.4177  	if test -n "$convenience"; then
  1.4178  	  if test -n "$whole_archive_flag_spec"; then
  1.4179 +	    save_libobjs=$libobjs
  1.4180  	    eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
  1.4181  	  else
  1.4182  	    gentop="$output_objdir/${outputname}x"
  1.4183  	    $show "${rm}r $gentop"
  1.4184  	    $run ${rm}r "$gentop"
  1.4185 -	    $show "mkdir $gentop"
  1.4186 -	    $run mkdir "$gentop"
  1.4187 +	    $show "$mkdir $gentop"
  1.4188 +	    $run $mkdir "$gentop"
  1.4189  	    status=$?
  1.4190 -	    if test $status -ne 0 && test ! -d "$gentop"; then
  1.4191 +	    if test "$status" -ne 0 && test ! -d "$gentop"; then
  1.4192  	      exit $status
  1.4193  	    fi
  1.4194  	    generated="$generated $gentop"
  1.4195  
  1.4196  	    for xlib in $convenience; do
  1.4197  	      # Extract the objects.
  1.4198 -	      case "$xlib" in
  1.4199 +	      case $xlib in
  1.4200  	      [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
  1.4201  	      *) xabs=`pwd`"/$xlib" ;;
  1.4202  	      esac
  1.4203 @@ -2177,43 +3614,183 @@
  1.4204  
  1.4205  	      $show "${rm}r $xdir"
  1.4206  	      $run ${rm}r "$xdir"
  1.4207 -	      $show "mkdir $xdir"
  1.4208 -	      $run mkdir "$xdir"
  1.4209 +	      $show "$mkdir $xdir"
  1.4210 +	      $run $mkdir "$xdir"
  1.4211  	      status=$?
  1.4212 -	      if test $status -ne 0 && test ! -d "$xdir"; then
  1.4213 +	      if test "$status" -ne 0 && test ! -d "$xdir"; then
  1.4214  		exit $status
  1.4215  	      fi
  1.4216 +	      # We will extract separately just the conflicting names and we will no
  1.4217 +	      # longer touch any unique names. It is faster to leave these extract
  1.4218 +	      # automatically by $AR in one run.
  1.4219  	      $show "(cd $xdir && $AR x $xabs)"
  1.4220  	      $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
  1.4221 -
  1.4222 -	      libobjs="$libobjs "`find $xdir -name \*.o -print -o -name \*.lo -print | $NL2SP`
  1.4223 +	      if ($AR t "$xabs" | sort | sort -uc >/dev/null 2>&1); then
  1.4224 +		:
  1.4225 +	      else
  1.4226 +		$echo "$modename: warning: object name conflicts; renaming object files" 1>&2
  1.4227 +		$echo "$modename: warning: to ensure that they will not overwrite" 1>&2
  1.4228 +		$AR t "$xabs" | sort | uniq -cd | while read -r count name
  1.4229 +		do
  1.4230 +		  i=1
  1.4231 +		  while test "$i" -le "$count"
  1.4232 +		  do
  1.4233 +		   # Put our $i before any first dot (extension)
  1.4234 +		   # Never overwrite any file
  1.4235 +		   name_to="$name"
  1.4236 +		   while test "X$name_to" = "X$name" || test -f "$xdir/$name_to"
  1.4237 +		   do
  1.4238 +		     name_to=`$echo "X$name_to" | $Xsed -e "s/\([^.]*\)/\1-$i/"`
  1.4239 +		   done
  1.4240 +		   $show "(cd $xdir && $AR xN $i $xabs '$name' && $mv '$name' '$name_to')"
  1.4241 +		   $run eval "(cd \$xdir && $AR xN $i \$xabs '$name' && $mv '$name' '$name_to')" || exit $?
  1.4242 +		   i=`expr $i + 1`
  1.4243 +		  done
  1.4244 +		done
  1.4245 +	      fi
  1.4246 +
  1.4247 +	      libobjs="$libobjs "`find $xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP`
  1.4248  	    done
  1.4249  	  fi
  1.4250  	fi
  1.4251  
  1.4252  	if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then
  1.4253  	  eval flag=\"$thread_safe_flag_spec\"
  1.4254 -	  linkopts="$linkopts $flag"
  1.4255 +	  linker_flags="$linker_flags $flag"
  1.4256 +	fi
  1.4257 +
  1.4258 +	# Make a backup of the uninstalled library when relinking
  1.4259 +	if test "$mode" = relink; then
  1.4260 +	  $run eval '(cd $output_objdir && $rm ${realname}U && $mv $realname ${realname}U)' || exit $?
  1.4261  	fi
  1.4262  
  1.4263  	# Do each of the archive commands.
  1.4264 +	if test "$module" = yes && test -n "$module_cmds" ; then
  1.4265 +	  if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
  1.4266 +	    eval cmds=\"$module_expsym_cmds\"
  1.4267 +	  else
  1.4268 +	    eval cmds=\"$module_cmds\"
  1.4269 +	  fi
  1.4270 +	else
  1.4271  	if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
  1.4272  	  eval cmds=\"$archive_expsym_cmds\"
  1.4273  	else
  1.4274 -	  save_deplibs="$deplibs"
  1.4275 -	  for conv in $convenience; do
  1.4276 -	    tmp_deplibs=
  1.4277 -	    for test_deplib in $deplibs; do
  1.4278 -	      if test "$test_deplib" != "$conv"; then
  1.4279 -	        tmp_deplibs="$tmp_deplibs $test_deplib"
  1.4280 +	  eval cmds=\"$archive_cmds\"
  1.4281 +	  fi
  1.4282 +	fi
  1.4283 +
  1.4284 +	if test "X$skipped_export" != "X:" && len=`expr "X$cmds" : ".*"` &&
  1.4285 +	   test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
  1.4286 +	  :
  1.4287 +	else
  1.4288 +	  # The command line is too long to link in one step, link piecewise.
  1.4289 +	  $echo "creating reloadable object files..."
  1.4290 +
  1.4291 +	  # Save the value of $output and $libobjs because we want to
  1.4292 +	  # use them later.  If we have whole_archive_flag_spec, we
  1.4293 +	  # want to use save_libobjs as it was before
  1.4294 +	  # whole_archive_flag_spec was expanded, because we can't
  1.4295 +	  # assume the linker understands whole_archive_flag_spec.
  1.4296 +	  # This may have to be revisited, in case too many
  1.4297 +	  # convenience libraries get linked in and end up exceeding
  1.4298 +	  # the spec.
  1.4299 +	  if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then
  1.4300 +	    save_libobjs=$libobjs
  1.4301 +	  fi
  1.4302 +	  save_output=$output
  1.4303 +
  1.4304 +	  # Clear the reloadable object creation command queue and
  1.4305 +	  # initialize k to one.
  1.4306 +	  test_cmds=
  1.4307 +	  concat_cmds=
  1.4308 +	  objlist=
  1.4309 +	  delfiles=
  1.4310 +	  last_robj=
  1.4311 +	  k=1
  1.4312 +	  output=$output_objdir/$save_output-${k}.$objext
  1.4313 +	  # Loop over the list of objects to be linked.
  1.4314 +	  for obj in $save_libobjs
  1.4315 +	  do
  1.4316 +	    eval test_cmds=\"$reload_cmds $objlist $last_robj\"
  1.4317 +	    if test "X$objlist" = X ||
  1.4318 +	       { len=`expr "X$test_cmds" : ".*"` &&
  1.4319 +		 test "$len" -le "$max_cmd_len"; }; then
  1.4320 +	      objlist="$objlist $obj"
  1.4321 +	    else
  1.4322 +	      # The command $test_cmds is almost too long, add a
  1.4323 +	      # command to the queue.
  1.4324 +	      if test "$k" -eq 1 ; then
  1.4325 +		# The first file doesn't have a previous command to add.
  1.4326 +		eval concat_cmds=\"$reload_cmds $objlist $last_robj\"
  1.4327 +	      else
  1.4328 +		# All subsequent reloadable object files will link in
  1.4329 +		# the last one created.
  1.4330 +		eval concat_cmds=\"\$concat_cmds~$reload_cmds $objlist $last_robj\"
  1.4331  	      fi
  1.4332 -	    done
  1.4333 -	    deplibs="$tmp_deplibs"
  1.4334 +	      last_robj=$output_objdir/$save_output-${k}.$objext
  1.4335 +	      k=`expr $k + 1`
  1.4336 +	      output=$output_objdir/$save_output-${k}.$objext
  1.4337 +	      objlist=$obj
  1.4338 +	      len=1
  1.4339 +	    fi
  1.4340 +	  done
  1.4341 +	  # Handle the remaining objects by creating one last
  1.4342 +	  # reloadable object file.  All subsequent reloadable object
  1.4343 +	  # files will link in the last one created.
  1.4344 +	  test -z "$concat_cmds" || concat_cmds=$concat_cmds~
  1.4345 +	  eval concat_cmds=\"\${concat_cmds}$reload_cmds $objlist $last_robj\"
  1.4346 +
  1.4347 +	  if ${skipped_export-false}; then
  1.4348 +	    $show "generating symbol list for \`$libname.la'"
  1.4349 +	    export_symbols="$output_objdir/$libname.exp"
  1.4350 +	    $run $rm $export_symbols
  1.4351 +	    libobjs=$output
  1.4352 +	    # Append the command to create the export file.
  1.4353 +	    eval concat_cmds=\"\$concat_cmds~$export_symbols_cmds\"
  1.4354 +          fi
  1.4355 +
  1.4356 +	  # Set up a command to remove the reloadale object files
  1.4357 +	  # after they are used.
  1.4358 +	  i=0
  1.4359 +	  while test "$i" -lt "$k"
  1.4360 +	  do
  1.4361 +	    i=`expr $i + 1`
  1.4362 +	    delfiles="$delfiles $output_objdir/$save_output-${i}.$objext"
  1.4363  	  done
  1.4364 - 	  eval cmds=\"$archive_cmds\"
  1.4365 -	  deplibs="$save_deplibs"
  1.4366 +
  1.4367 +	  $echo "creating a temporary reloadable object file: $output"
  1.4368 +
  1.4369 +	  # Loop through the commands generated above and execute them.
  1.4370 +	  save_ifs="$IFS"; IFS='~'
  1.4371 +	  for cmd in $concat_cmds; do
  1.4372 +	    IFS="$save_ifs"
  1.4373 +	    $show "$cmd"
  1.4374 +	    $run eval "$cmd" || exit $?
  1.4375 +	  done
  1.4376 +	  IFS="$save_ifs"
  1.4377 +
  1.4378 +	  libobjs=$output
  1.4379 +	  # Restore the value of output.
  1.4380 +	  output=$save_output
  1.4381 +
  1.4382 +	  if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then
  1.4383 +	    eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
  1.4384 +	  fi
  1.4385 +	  # Expand the library linking commands again to reset the
  1.4386 +	  # value of $libobjs for piecewise linking.
  1.4387 +
  1.4388 +	  # Do each of the archive commands.
  1.4389 +	  if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
  1.4390 +	    eval cmds=\"$archive_expsym_cmds\"
  1.4391 +	  else
  1.4392 +	    eval cmds=\"$archive_cmds\"
  1.4393 +	  fi
  1.4394 +
  1.4395 +	  # Append the command to remove the reloadable object files
  1.4396 +	  # to the just-reset $cmds.
  1.4397 +	  eval cmds=\"\$cmds~$rm $delfiles\"
  1.4398  	fi
  1.4399 -	IFS="${IFS= 	}"; save_ifs="$IFS"; IFS='~'
  1.4400 +	save_ifs="$IFS"; IFS='~'
  1.4401  	for cmd in $cmds; do
  1.4402  	  IFS="$save_ifs"
  1.4403  	  $show "$cmd"
  1.4404 @@ -2221,6 +3798,12 @@
  1.4405  	done
  1.4406  	IFS="$save_ifs"
  1.4407  
  1.4408 +	# Restore the uninstalled library and exit
  1.4409 +	if test "$mode" = relink; then
  1.4410 +	  $run eval '(cd $output_objdir && $rm ${realname}T && $mv $realname ${realname}T && $mv "$realname"U $realname)' || exit $?
  1.4411 +	  exit 0
  1.4412 +	fi
  1.4413 +
  1.4414  	# Create links to the real library.
  1.4415  	for linkname in $linknames; do
  1.4416  	  if test "$realname" != "$linkname"; then
  1.4417 @@ -2237,12 +3820,7 @@
  1.4418        fi
  1.4419        ;;
  1.4420  
  1.4421 -    *.lo | *.o | *.obj)
  1.4422 -      if test -n "$link_against_libtool_libs"; then
  1.4423 -	$echo "$modename: error: cannot link libtool libraries into objects" 1>&2
  1.4424 -	exit 1
  1.4425 -      fi
  1.4426 -
  1.4427 +    obj)
  1.4428        if test -n "$deplibs"; then
  1.4429  	$echo "$modename: warning: \`-l' and \`-L' are ignored for objects" 1>&2
  1.4430        fi
  1.4431 @@ -2267,9 +3845,9 @@
  1.4432  	$echo "$modename: warning: \`-release' is ignored for objects" 1>&2
  1.4433        fi
  1.4434  
  1.4435 -      case "$output" in
  1.4436 +      case $output in
  1.4437        *.lo)
  1.4438 -	if test -n "$objs"; then
  1.4439 +	if test -n "$objs$old_deplibs"; then
  1.4440  	  $echo "$modename: cannot build library object \`$output' from non-libtool objects" 1>&2
  1.4441  	  exit 1
  1.4442  	fi
  1.4443 @@ -2293,7 +3871,7 @@
  1.4444        gentop=
  1.4445        # reload_cmds runs $LD directly, so let us get rid of
  1.4446        # -Wl from whole_archive_flag_spec
  1.4447 -      wl= 
  1.4448 +      wl=
  1.4449  
  1.4450        if test -n "$convenience"; then
  1.4451  	if test -n "$whole_archive_flag_spec"; then
  1.4452 @@ -2302,17 +3880,17 @@
  1.4453  	  gentop="$output_objdir/${obj}x"
  1.4454  	  $show "${rm}r $gentop"
  1.4455  	  $run ${rm}r "$gentop"
  1.4456 -	  $show "mkdir $gentop"
  1.4457 -	  $run mkdir "$gentop"
  1.4458 +	  $show "$mkdir $gentop"
  1.4459 +	  $run $mkdir "$gentop"
  1.4460  	  status=$?
  1.4461 -	  if test $status -ne 0 && test ! -d "$gentop"; then
  1.4462 +	  if test "$status" -ne 0 && test ! -d "$gentop"; then
  1.4463  	    exit $status
  1.4464  	  fi
  1.4465  	  generated="$generated $gentop"
  1.4466  
  1.4467  	  for xlib in $convenience; do
  1.4468  	    # Extract the objects.
  1.4469 -	    case "$xlib" in
  1.4470 +	    case $xlib in
  1.4471  	    [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
  1.4472  	    *) xabs=`pwd`"/$xlib" ;;
  1.4473  	    esac
  1.4474 @@ -2321,26 +3899,52 @@
  1.4475  
  1.4476  	    $show "${rm}r $xdir"
  1.4477  	    $run ${rm}r "$xdir"
  1.4478 -	    $show "mkdir $xdir"
  1.4479 -	    $run mkdir "$xdir"
  1.4480 +	    $show "$mkdir $xdir"
  1.4481 +	    $run $mkdir "$xdir"
  1.4482  	    status=$?
  1.4483 -	    if test $status -ne 0 && test ! -d "$xdir"; then
  1.4484 +	    if test "$status" -ne 0 && test ! -d "$xdir"; then
  1.4485  	      exit $status
  1.4486  	    fi
  1.4487 +	    # We will extract separately just the conflicting names and we will no
  1.4488 +	    # longer touch any unique names. It is faster to leave these extract
  1.4489 +	    # automatically by $AR in one run.
  1.4490  	    $show "(cd $xdir && $AR x $xabs)"
  1.4491  	    $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
  1.4492 -
  1.4493 -	    reload_conv_objs="$reload_objs "`find $xdir -name \*.o -print -o -name \*.lo -print | $NL2SP`
  1.4494 +	    if ($AR t "$xabs" | sort | sort -uc >/dev/null 2>&1); then
  1.4495 +	      :
  1.4496 +	    else
  1.4497 +	      $echo "$modename: warning: object name conflicts; renaming object files" 1>&2
  1.4498 +	      $echo "$modename: warning: to ensure that they will not overwrite" 1>&2
  1.4499 +	      $AR t "$xabs" | sort | uniq -cd | while read -r count name
  1.4500 +	      do
  1.4501 +		i=1
  1.4502 +		while test "$i" -le "$count"
  1.4503 +		do
  1.4504 +		 # Put our $i before any first dot (extension)
  1.4505 +		 # Never overwrite any file
  1.4506 +		 name_to="$name"
  1.4507 +		 while test "X$name_to" = "X$name" || test -f "$xdir/$name_to"
  1.4508 +		 do
  1.4509 +		   name_to=`$echo "X$name_to" | $Xsed -e "s/\([^.]*\)/\1-$i/"`
  1.4510 +		 done
  1.4511 +		 $show "(cd $xdir && $AR xN $i $xabs '$name' && $mv '$name' '$name_to')"
  1.4512 +		 $run eval "(cd \$xdir && $AR xN $i \$xabs '$name' && $mv '$name' '$name_to')" || exit $?
  1.4513 +		 i=`expr $i + 1`
  1.4514 +		done
  1.4515 +	      done
  1.4516 +	    fi
  1.4517 +
  1.4518 +	    reload_conv_objs="$reload_objs "`find $xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP`
  1.4519  	  done
  1.4520  	fi
  1.4521        fi
  1.4522  
  1.4523        # Create the old-style object.
  1.4524 -      reload_objs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}$'/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`" $reload_conv_objs"
  1.4525 +      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.4526  
  1.4527        output="$obj"
  1.4528        eval cmds=\"$reload_cmds\"
  1.4529 -      IFS="${IFS= 	}"; save_ifs="$IFS"; IFS='~'
  1.4530 +      save_ifs="$IFS"; IFS='~'
  1.4531        for cmd in $cmds; do
  1.4532  	IFS="$save_ifs"
  1.4533  	$show "$cmd"
  1.4534 @@ -2366,37 +3970,23 @@
  1.4535  
  1.4536  	# Create an invalid libtool object if no PIC, so that we don't
  1.4537  	# accidentally link it into a program.
  1.4538 -	$show "echo timestamp > $libobj"
  1.4539 -	$run eval "echo timestamp > $libobj" || exit $?
  1.4540 +	# $show "echo timestamp > $libobj"
  1.4541 +	# $run eval "echo timestamp > $libobj" || exit $?
  1.4542  	exit 0
  1.4543        fi
  1.4544  
  1.4545 -      if test -n "$pic_flag"; then
  1.4546 +      if test -n "$pic_flag" || test "$pic_mode" != default; then
  1.4547  	# Only do commands if we really have different PIC objects.
  1.4548  	reload_objs="$libobjs $reload_conv_objs"
  1.4549  	output="$libobj"
  1.4550  	eval cmds=\"$reload_cmds\"
  1.4551 -	IFS="${IFS= 	}"; save_ifs="$IFS"; IFS='~'
  1.4552 +	save_ifs="$IFS"; IFS='~'
  1.4553  	for cmd in $cmds; do
  1.4554  	  IFS="$save_ifs"
  1.4555  	  $show "$cmd"
  1.4556  	  $run eval "$cmd" || exit $?
  1.4557  	done
  1.4558  	IFS="$save_ifs"
  1.4559 -      else
  1.4560 -	# Just create a symlink.
  1.4561 -	$show $rm $libobj
  1.4562 -	$run $rm $libobj
  1.4563 -	xdir=`$echo "X$libobj" | $Xsed -e 's%/[^/]*$%%'`
  1.4564 -	if test "X$xdir" = "X$libobj"; then
  1.4565 -	  xdir="."
  1.4566 -	else
  1.4567 -	  xdir="$xdir"
  1.4568 -	fi
  1.4569 -	baseobj=`$echo "X$libobj" | $Xsed -e 's%^.*/%%'`
  1.4570 -	oldobj=`$echo "X$baseobj" | $Xsed -e "$lo2o"`
  1.4571 -	$show "(cd $xdir && $LN_S $oldobj $baseobj)"
  1.4572 -	$run eval '(cd $xdir && $LN_S $oldobj $baseobj)' || exit $?
  1.4573        fi
  1.4574  
  1.4575        if test -n "$gentop"; then
  1.4576 @@ -2407,8 +3997,10 @@
  1.4577        exit 0
  1.4578        ;;
  1.4579  
  1.4580 -    # Anything else should be a program.
  1.4581 -    *)
  1.4582 +    prog)
  1.4583 +      case $host in
  1.4584 +	*cygwin*) output=`$echo $output | ${SED} -e 's,.exe$,,;s,$,.exe,'` ;;
  1.4585 +      esac
  1.4586        if test -n "$vinfo"; then
  1.4587  	$echo "$modename: warning: \`-version-info' is ignored for programs" 1>&2
  1.4588        fi
  1.4589 @@ -2418,20 +4010,37 @@
  1.4590        fi
  1.4591  
  1.4592        if test "$preload" = yes; then
  1.4593 -	if test "$dlopen" = unknown && test "$dlopen_self" = unknown &&
  1.4594 +	if test "$dlopen_support" = unknown && test "$dlopen_self" = unknown &&
  1.4595  	   test "$dlopen_self_static" = unknown; then
  1.4596  	  $echo "$modename: warning: \`AC_LIBTOOL_DLOPEN' not used. Assuming no dlopen support."
  1.4597 -	fi 
  1.4598 +	fi
  1.4599        fi
  1.4600 -    
  1.4601 +
  1.4602 +      case $host in
  1.4603 +      *-*-rhapsody* | *-*-darwin1.[012])
  1.4604 +	# On Rhapsody replace the C library is the System framework
  1.4605 +	compile_deplibs=`$echo "X $compile_deplibs" | $Xsed -e 's/ -lc / -framework System /'`
  1.4606 +	finalize_deplibs=`$echo "X $finalize_deplibs" | $Xsed -e 's/ -lc / -framework System /'`
  1.4607 +	;;
  1.4608 +      esac
  1.4609 +
  1.4610 +      case $host in
  1.4611 +      *darwin*)
  1.4612 +        # Don't allow lazy linking, it breaks C++ global constructors
  1.4613 +        if test "$tagname" = CXX ; then
  1.4614 +        compile_command="$compile_command ${wl}-bind_at_load"
  1.4615 +        finalize_command="$finalize_command ${wl}-bind_at_load"
  1.4616 +        fi
  1.4617 +        ;;
  1.4618 +      esac
  1.4619 +
  1.4620 +      compile_command="$compile_command $compile_deplibs"
  1.4621 +      finalize_command="$finalize_command $finalize_deplibs"
  1.4622 +
  1.4623        if test -n "$rpath$xrpath"; then
  1.4624  	# If the user specified any rpath flags, then add them.
  1.4625  	for libdir in $rpath $xrpath; do
  1.4626  	  # This is the magic to use -rpath.
  1.4627 -	  case "$compile_rpath " in
  1.4628 -	  *" $libdir "*) ;;
  1.4629 -	  *) compile_rpath="$compile_rpath $libdir" ;;
  1.4630 -	  esac
  1.4631  	  case "$finalize_rpath " in
  1.4632  	  *" $libdir "*) ;;
  1.4633  	  *) finalize_rpath="$finalize_rpath $libdir" ;;
  1.4634 @@ -2449,7 +4058,7 @@
  1.4635  	      hardcode_libdirs="$libdir"
  1.4636  	    else
  1.4637  	      # Just accumulate the unique libdirs.
  1.4638 -	      case "$hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator" in
  1.4639 +	      case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
  1.4640  	      *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
  1.4641  		;;
  1.4642  	      *)
  1.4643 @@ -2467,6 +4076,14 @@
  1.4644  	  *) perm_rpath="$perm_rpath $libdir" ;;
  1.4645  	  esac
  1.4646  	fi
  1.4647 +	case $host in
  1.4648 +	*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
  1.4649 +	  case :$dllsearchpath: in
  1.4650 +	  *":$libdir:"*) ;;
  1.4651 +	  *) dllsearchpath="$dllsearchpath:$libdir";;
  1.4652 +	  esac
  1.4653 +	  ;;
  1.4654 +	esac
  1.4655        done
  1.4656        # Substitute the hardcoded libdirs into the rpath.
  1.4657        if test -n "$hardcode_libdir_separator" &&
  1.4658 @@ -2485,7 +4102,7 @@
  1.4659  	      hardcode_libdirs="$libdir"
  1.4660  	    else
  1.4661  	      # Just accumulate the unique libdirs.
  1.4662 -	      case "$hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator" in
  1.4663 +	      case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
  1.4664  	      *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
  1.4665  		;;
  1.4666  	      *)
  1.4667 @@ -2512,23 +4129,6 @@
  1.4668        fi
  1.4669        finalize_rpath="$rpath"
  1.4670  
  1.4671 -      output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'`
  1.4672 -      if test "X$output_objdir" = "X$output"; then
  1.4673 -	output_objdir="$objdir"
  1.4674 -      else
  1.4675 -	output_objdir="$output_objdir/$objdir"
  1.4676 -      fi
  1.4677 -
  1.4678 -      # Create the binary in the object directory, then wrap it.
  1.4679 -      if test ! -d $output_objdir; then
  1.4680 -	$show "$mkdir $output_objdir"
  1.4681 -	$run $mkdir $output_objdir
  1.4682 -	status=$?
  1.4683 -	if test $status -ne 0 && test ! -d $output_objdir; then
  1.4684 -	  exit $status
  1.4685 -	fi
  1.4686 -      fi
  1.4687 -
  1.4688        if test -n "$libobjs" && test "$build_old_libs" = yes; then
  1.4689  	# Transform all the library objects into standard objects.
  1.4690  	compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
  1.4691 @@ -2545,7 +4145,7 @@
  1.4692        fi
  1.4693  
  1.4694        if test -n "$dlsyms"; then
  1.4695 -	case "$dlsyms" in
  1.4696 +	case $dlsyms in
  1.4697  	"") ;;
  1.4698  	*.c)
  1.4699  	  # Discover the nlist of each of the dlfiles.
  1.4700 @@ -2577,19 +4177,19 @@
  1.4701  	    test -z "$run" && $echo ': @PROGRAM@ ' > "$nlist"
  1.4702  
  1.4703  	    # Add our own program objects to the symbol list.
  1.4704 -	    progfiles=`$echo "X$objs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
  1.4705 +	    progfiles=`$echo "X$objs$old_deplibs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
  1.4706  	    for arg in $progfiles; do
  1.4707  	      $show "extracting global C symbols from \`$arg'"
  1.4708  	      $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
  1.4709  	    done
  1.4710  
  1.4711  	    if test -n "$exclude_expsyms"; then
  1.4712 -	      $run eval 'egrep -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
  1.4713 +	      $run eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
  1.4714  	      $run eval '$mv "$nlist"T "$nlist"'
  1.4715  	    fi
  1.4716 -	    
  1.4717 +
  1.4718  	    if test -n "$export_symbols_regex"; then
  1.4719 -	      $run eval 'egrep -e "$export_symbols_regex" "$nlist" > "$nlist"T'
  1.4720 +	      $run eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T'
  1.4721  	      $run eval '$mv "$nlist"T "$nlist"'
  1.4722  	    fi
  1.4723  
  1.4724 @@ -2597,9 +4197,9 @@
  1.4725  	    if test -z "$export_symbols"; then
  1.4726  	      export_symbols="$output_objdir/$output.exp"
  1.4727  	      $run $rm $export_symbols
  1.4728 -	      $run eval "sed -n -e '/^: @PROGRAM@$/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
  1.4729 +	      $run eval "${SED} -n -e '/^: @PROGRAM@$/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
  1.4730  	    else
  1.4731 -	      $run eval "sed -e 's/\([][.*^$]\)/\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$output.exp"'
  1.4732 +	      $run eval "${SED} -e 's/\([][.*^$]\)/\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$output.exp"'
  1.4733  	      $run eval 'grep -f "$output_objdir/$output.exp" < "$nlist" > "$nlist"T'
  1.4734  	      $run eval 'mv "$nlist"T "$nlist"'
  1.4735  	    fi
  1.4736 @@ -2607,8 +4207,8 @@
  1.4737  
  1.4738  	  for arg in $dlprefiles; do
  1.4739  	    $show "extracting global C symbols from \`$arg'"
  1.4740 -	    name=`echo "$arg" | sed -e 's%^.*/%%'`
  1.4741 -	    $run eval 'echo ": $name " >> "$nlist"'
  1.4742 +	    name=`$echo "$arg" | ${SED} -e 's%^.*/%%'`
  1.4743 +	    $run eval '$echo ": $name " >> "$nlist"'
  1.4744  	    $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
  1.4745  	  done
  1.4746  
  1.4747 @@ -2617,12 +4217,18 @@
  1.4748  	    test -f "$nlist" || : > "$nlist"
  1.4749  
  1.4750  	    if test -n "$exclude_expsyms"; then
  1.4751 -	      egrep -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T
  1.4752 +	      $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T
  1.4753  	      $mv "$nlist"T "$nlist"
  1.4754  	    fi
  1.4755  
  1.4756  	    # Try sorting and uniquifying the output.
  1.4757 -	    if grep -v "^: " < "$nlist" | sort +2 | uniq > "$nlist"S; then
  1.4758 +	    if grep -v "^: " < "$nlist" |
  1.4759 +		if sort -k 3 </dev/null >/dev/null 2>&1; then
  1.4760 +		  sort -k 3
  1.4761 +		else
  1.4762 +		  sort +2
  1.4763 +		fi |
  1.4764 +		uniq > "$nlist"S; then
  1.4765  	      :
  1.4766  	    else
  1.4767  	      grep -v "^: " < "$nlist" > "$nlist"S
  1.4768 @@ -2631,7 +4237,7 @@
  1.4769  	    if test -f "$nlist"S; then
  1.4770  	      eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$dlsyms"'
  1.4771  	    else
  1.4772 -	      echo '/* NONE */' >> "$output_objdir/$dlsyms"
  1.4773 +	      $echo '/* NONE */' >> "$output_objdir/$dlsyms"
  1.4774  	    fi
  1.4775  
  1.4776  	    $echo >> "$output_objdir/$dlsyms" "\
  1.4777 @@ -2639,27 +4245,25 @@
  1.4778  #undef lt_preloaded_symbols
  1.4779  
  1.4780  #if defined (__STDC__) && __STDC__
  1.4781 -# define lt_ptr_t void *
  1.4782 +# define lt_ptr void *
  1.4783  #else
  1.4784 -# define lt_ptr_t char *
  1.4785 +# define lt_ptr char *
  1.4786  # define const
  1.4787  #endif
  1.4788  
  1.4789  /* The mapping between symbol names and symbols. */
  1.4790  const struct {
  1.4791    const char *name;
  1.4792 -  lt_ptr_t address;
  1.4793 +  lt_ptr address;
  1.4794  }
  1.4795  lt_preloaded_symbols[] =
  1.4796  {\
  1.4797  "
  1.4798  
  1.4799 -	    sed -n -e 's/^: \([^ ]*\) $/  {\"\1\", (lt_ptr_t) 0},/p' \
  1.4800 -		-e 's/^. \([^ ]*\) \([^ ]*\)$/  {"\2", (lt_ptr_t) \&\2},/p' \
  1.4801 -		  < "$nlist" >> "$output_objdir/$dlsyms"
  1.4802 +	    eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$dlsyms"
  1.4803  
  1.4804  	    $echo >> "$output_objdir/$dlsyms" "\
  1.4805 -  {0, (lt_ptr_t) 0}
  1.4806 +  {0, (lt_ptr) 0}
  1.4807  };
  1.4808  
  1.4809  /* This works around a problem in FreeBSD linker */
  1.4810 @@ -2676,7 +4280,7 @@
  1.4811  	  fi
  1.4812  
  1.4813  	  pic_flag_for_symtable=
  1.4814 -	  case "$host" in
  1.4815 +	  case $host in
  1.4816  	  # compiling the symbol table file with pic_flag works around
  1.4817  	  # a FreeBSD bug that causes programs to crash when -lm is
  1.4818  	  # linked before any other PIC object.  But we must not use
  1.4819 @@ -2685,18 +4289,18 @@
  1.4820  	  *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)
  1.4821  	    case "$compile_command " in
  1.4822  	    *" -static "*) ;;
  1.4823 -	    *) pic_flag_for_symtable=" $pic_flag -DPIC -DFREEBSD_WORKAROUND";;
  1.4824 +	    *) pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND";;
  1.4825  	    esac;;
  1.4826  	  *-*-hpux*)
  1.4827  	    case "$compile_command " in
  1.4828  	    *" -static "*) ;;
  1.4829 -	    *) pic_flag_for_symtable=" $pic_flag -DPIC";;
  1.4830 +	    *) pic_flag_for_symtable=" $pic_flag";;
  1.4831  	    esac
  1.4832  	  esac
  1.4833  
  1.4834  	  # Now compile the dynamic symbol file.
  1.4835 -	  $show "(cd $output_objdir && $CC -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")"
  1.4836 -	  $run eval '(cd $output_objdir && $CC -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $?
  1.4837 +	  $show "(cd $output_objdir && $LTCC -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")"
  1.4838 +	  $run eval '(cd $output_objdir && $LTCC -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $?
  1.4839  
  1.4840  	  # Clean up the generated files.
  1.4841  	  $show "$rm $output_objdir/$dlsyms $nlist ${nlist}S ${nlist}T"
  1.4842 @@ -2721,7 +4325,7 @@
  1.4843  	finalize_command=`$echo "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"`
  1.4844        fi
  1.4845  
  1.4846 -      if test -z "$link_against_libtool_libs" || test "$build_libtool_libs" != yes; then
  1.4847 +      if test "$need_relink" = no || test "$build_libtool_libs" != yes; then
  1.4848  	# Replace the output file specification.
  1.4849  	compile_command=`$echo "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
  1.4850  	link_command="$compile_command$compile_rpath"
  1.4851 @@ -2730,7 +4334,7 @@
  1.4852  	$show "$link_command"
  1.4853  	$run eval "$link_command"
  1.4854  	status=$?
  1.4855 -	
  1.4856 +
  1.4857  	# Delete the generated files.
  1.4858  	if test -n "$dlsyms"; then
  1.4859  	  $show "$rm $output_objdir/${outputname}S.${objext}"
  1.4860 @@ -2744,7 +4348,7 @@
  1.4861  	# We should set the shlibpath_var
  1.4862  	rpath=
  1.4863  	for dir in $temp_rpath; do
  1.4864 -	  case "$dir" in
  1.4865 +	  case $dir in
  1.4866  	  [\\/]* | [A-Za-z]:[\\/]*)
  1.4867  	    # Absolute path.
  1.4868  	    rpath="$rpath$dir:"
  1.4869 @@ -2786,11 +4390,24 @@
  1.4870  	fi
  1.4871        fi
  1.4872  
  1.4873 +      if test "$no_install" = yes; then
  1.4874 +	# We don't need to create a wrapper script.
  1.4875 +	link_command="$compile_var$compile_command$compile_rpath"
  1.4876 +	# Replace the output file specification.
  1.4877 +	link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
  1.4878 +	# Delete the old output file.
  1.4879 +	$run $rm $output
  1.4880 +	# Link the executable and exit
  1.4881 +	$show "$link_command"
  1.4882 +	$run eval "$link_command" || exit $?
  1.4883 +	exit 0
  1.4884 +      fi
  1.4885 +
  1.4886        if test "$hardcode_action" = relink; then
  1.4887  	# Fast installation is not supported
  1.4888  	link_command="$compile_var$compile_command$compile_rpath"
  1.4889  	relink_command="$finalize_var$finalize_command$finalize_rpath"
  1.4890 -	
  1.4891 +
  1.4892  	$echo "$modename: warning: this platform does not like uninstalled shared libraries" 1>&2
  1.4893  	$echo "$modename: \`$output' will be relinked during installation" 1>&2
  1.4894        else
  1.4895 @@ -2810,7 +4427,7 @@
  1.4896  
  1.4897        # Replace the output file specification.
  1.4898        link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`
  1.4899 -      
  1.4900 +
  1.4901        # Delete the old output files.
  1.4902        $run $rm $output $output_objdir/$outputname $output_objdir/lt-$outputname
  1.4903  
  1.4904 @@ -2822,12 +4439,24 @@
  1.4905  
  1.4906        # Quote the relink command for shipping.
  1.4907        if test -n "$relink_command"; then
  1.4908 +	# Preserve any variables that may affect compiler behavior
  1.4909 +	for var in $variables_saved_for_relink; do
  1.4910 +	  if eval test -z \"\${$var+set}\"; then
  1.4911 +	    relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command"
  1.4912 +	  elif eval var_value=\$$var; test -z "$var_value"; then
  1.4913 +	    relink_command="$var=; export $var; $relink_command"
  1.4914 +	  else
  1.4915 +	    var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"`
  1.4916 +	    relink_command="$var=\"$var_value\"; export $var; $relink_command"
  1.4917 +	  fi
  1.4918 +	done
  1.4919 +	relink_command="(cd `pwd`; $relink_command)"
  1.4920  	relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"`
  1.4921        fi
  1.4922  
  1.4923        # Quote $echo for shipping.
  1.4924        if test "X$echo" = "X$SHELL $0 --fallback-echo"; then
  1.4925 -	case "$0" in
  1.4926 +	case $0 in
  1.4927  	[\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $0 --fallback-echo";;
  1.4928  	*) qecho="$SHELL `pwd`/$0 --fallback-echo";;
  1.4929  	esac
  1.4930 @@ -2841,7 +4470,351 @@
  1.4931  	# win32 will think the script is a binary if it has
  1.4932  	# a .exe suffix, so we strip it off here.
  1.4933  	case $output in
  1.4934 -	  *.exe) output=`echo $output|sed 's,.exe$,,'` ;;
  1.4935 +	  *.exe) output=`$echo $output|${SED} 's,.exe$,,'` ;;
  1.4936 +	esac
  1.4937 +	# test for cygwin because mv fails w/o .exe extensions
  1.4938 +	case $host in
  1.4939 +	  *cygwin*)
  1.4940 +	    exeext=.exe
  1.4941 +	    outputname=`$echo $outputname|${SED} 's,.exe$,,'` ;;
  1.4942 +	  *) exeext= ;;
  1.4943 +	esac
  1.4944 +	case $host in
  1.4945 +	  *cygwin* | *mingw* )
  1.4946 +	    cwrappersource=`$echo ${objdir}/lt-${output}.c`
  1.4947 +	    cwrapper=`$echo ${output}.exe`
  1.4948 +	    $rm $cwrappersource $cwrapper
  1.4949 +	    trap "$rm $cwrappersource $cwrapper; exit 1" 1 2 15
  1.4950 +
  1.4951 +	    cat > $cwrappersource <<EOF
  1.4952 +
  1.4953 +/* $cwrappersource - temporary wrapper executable for $objdir/$outputname
  1.4954 +   Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
  1.4955 +
  1.4956 +   The $output program cannot be directly executed until all the libtool
  1.4957 +   libraries that it depends on are installed.
  1.4958 +   
  1.4959 +   This wrapper executable should never be moved out of the build directory.
  1.4960 +   If it is, it will not operate correctly.
  1.4961 +
  1.4962 +   Currently, it simply execs the wrapper *script* "/bin/sh $output",
  1.4963 +   but could eventually absorb all of the scripts functionality and
  1.4964 +   exec $objdir/$outputname directly.
  1.4965 +*/
  1.4966 +EOF
  1.4967 +	    cat >> $cwrappersource<<"EOF"
  1.4968 +#include <stdio.h>
  1.4969 +#include <stdlib.h>
  1.4970 +#include <unistd.h>
  1.4971 +#include <malloc.h>
  1.4972 +#include <stdarg.h>
  1.4973 +#include <assert.h>
  1.4974 +#include <sys/stat.h>
  1.4975 +
  1.4976 +#if defined(PATH_MAX)
  1.4977 +# define LT_PATHMAX PATH_MAX
  1.4978 +#elif defined(MAXPATHLEN)
  1.4979 +# define LT_PATHMAX MAXPATHLEN
  1.4980 +#else
  1.4981 +# define LT_PATHMAX 1024
  1.4982 +#endif
  1.4983 +
  1.4984 +#ifndef DIR_SEPARATOR
  1.4985 +# define DIR_SEPARATOR '/'
  1.4986 +# define PATH_SEPARATOR ':'
  1.4987 +#endif
  1.4988 +
  1.4989 +#if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \
  1.4990 +  defined (__OS2__)
  1.4991 +# define HAVE_DOS_BASED_FILE_SYSTEM
  1.4992 +# ifndef DIR_SEPARATOR_2 
  1.4993 +#  define DIR_SEPARATOR_2 '\\'
  1.4994 +# endif
  1.4995 +# ifndef PATH_SEPARATOR_2 
  1.4996 +#  define PATH_SEPARATOR_2 ';'
  1.4997 +# endif
  1.4998 +#endif
  1.4999 +
  1.5000 +#ifndef DIR_SEPARATOR_2
  1.5001 +# define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR)
  1.5002 +#else /* DIR_SEPARATOR_2 */
  1.5003 +# define IS_DIR_SEPARATOR(ch) \
  1.5004 +        (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2))
  1.5005 +#endif /* DIR_SEPARATOR_2 */
  1.5006 +
  1.5007 +#ifndef PATH_SEPARATOR_2
  1.5008 +# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR)
  1.5009 +#else /* PATH_SEPARATOR_2 */
  1.5010 +# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2)
  1.5011 +#endif /* PATH_SEPARATOR_2 */
  1.5012 +
  1.5013 +#define XMALLOC(type, num)      ((type *) xmalloc ((num) * sizeof(type)))
  1.5014 +#define XFREE(stale) do { \
  1.5015 +  if (stale) { free ((void *) stale); stale = 0; } \
  1.5016 +} while (0)
  1.5017 +
  1.5018 +#if defined DEBUGWRAPPER
  1.5019 +# define DEBUG(format, ...) fprintf(stderr, format, __VA_ARGS__)
  1.5020 +#else
  1.5021 +# define DEBUG(format, ...) 
  1.5022 +#endif
  1.5023 +
  1.5024 +const char *program_name = NULL;
  1.5025 +
  1.5026 +void * xmalloc (size_t num);
  1.5027 +char * xstrdup (const char *string);
  1.5028 +char * basename (const char *name);
  1.5029 +char * find_executable(const char *wrapper);
  1.5030 +int    check_executable(const char *path);
  1.5031 +char * strendzap(char *str, const char *pat);
  1.5032 +void lt_fatal (const char *message, ...);
  1.5033 +
  1.5034 +int
  1.5035 +main (int argc, char *argv[])
  1.5036 +{
  1.5037 +  char **newargz;
  1.5038 +  int i;
  1.5039 +  
  1.5040 +  program_name = (char *) xstrdup ((char *) basename (argv[0]));
  1.5041 +  DEBUG("(main) argv[0]      : %s\n",argv[0]);
  1.5042 +  DEBUG("(main) program_name : %s\n",program_name);
  1.5043 +  newargz = XMALLOC(char *, argc+2);
  1.5044 +EOF
  1.5045 +
  1.5046 +	    cat >> $cwrappersource <<EOF
  1.5047 +  newargz[0] = "$SHELL";
  1.5048 +EOF
  1.5049 +
  1.5050 +	    cat >> $cwrappersource <<"EOF"
  1.5051 +  newargz[1] = find_executable(argv[0]);
  1.5052 +  if (newargz[1] == NULL)
  1.5053 +    lt_fatal("Couldn't find %s", argv[0]);
  1.5054 +  DEBUG("(main) found exe at : %s\n",newargz[1]);
  1.5055 +  /* we know the script has the same name, without the .exe */
  1.5056 +  /* so make sure newargz[1] doesn't end in .exe */
  1.5057 +  strendzap(newargz[1],".exe"); 
  1.5058 +  for (i = 1; i < argc; i++)
  1.5059 +    newargz[i+1] = xstrdup(argv[i]);
  1.5060 +  newargz[argc+1] = NULL;
  1.5061 +
  1.5062 +  for (i=0; i<argc+1; i++)
  1.5063 +  {
  1.5064 +    DEBUG("(main) newargz[%d]   : %s\n",i,newargz[i]);
  1.5065 +    ;
  1.5066 +  }
  1.5067 +
  1.5068 +EOF
  1.5069 +
  1.5070 +	    cat >> $cwrappersource <<EOF
  1.5071 +  execv("$SHELL",newargz);
  1.5072 +EOF
  1.5073 +
  1.5074 +	    cat >> $cwrappersource <<"EOF"
  1.5075 +}
  1.5076 +
  1.5077 +void *
  1.5078 +xmalloc (size_t num)
  1.5079 +{
  1.5080 +  void * p = (void *) malloc (num);
  1.5081 +  if (!p)
  1.5082 +    lt_fatal ("Memory exhausted");
  1.5083 +
  1.5084 +  return p;
  1.5085 +}
  1.5086 +
  1.5087 +char * 
  1.5088 +xstrdup (const char *string)
  1.5089 +{
  1.5090 +  return string ? strcpy ((char *) xmalloc (strlen (string) + 1), string) : NULL
  1.5091 +;
  1.5092 +}
  1.5093 +
  1.5094 +char *
  1.5095 +basename (const char *name)
  1.5096 +{
  1.5097 +  const char *base;
  1.5098 +
  1.5099 +#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
  1.5100 +  /* Skip over the disk name in MSDOS pathnames. */
  1.5101 +  if (isalpha (name[0]) && name[1] == ':') 
  1.5102 +    name += 2;
  1.5103 +#endif
  1.5104 +
  1.5105 +  for (base = name; *name; name++)
  1.5106 +    if (IS_DIR_SEPARATOR (*name))
  1.5107 +      base = name + 1;
  1.5108 +  return (char *) base;
  1.5109 +}
  1.5110 +
  1.5111 +int
  1.5112 +check_executable(const char * path)
  1.5113 +{
  1.5114 +  struct stat st;
  1.5115 +
  1.5116 +  DEBUG("(check_executable)  : %s\n", path ? (*path ? path : "EMPTY!") : "NULL!");
  1.5117 +  if ((!path) || (!*path))
  1.5118 +    return 0;
  1.5119 +
  1.5120 +  if ((stat (path, &st) >= 0) &&
  1.5121 +      (((st.st_mode & S_IXOTH) == S_IXOTH) ||
  1.5122 +       ((st.st_mode & S_IXGRP) == S_IXGRP) ||
  1.5123 +       ((st.st_mode & S_IXUSR) == S_IXUSR)))
  1.5124 +    return 1;
  1.5125 +  else
  1.5126 +    return 0;
  1.5127 +}
  1.5128 +
  1.5129 +/* Searches for the full path of the wrapper.  Returns
  1.5130 +   newly allocated full path name if found, NULL otherwise */
  1.5131 +char *
  1.5132 +find_executable (const char* wrapper)
  1.5133 +{
  1.5134 +  int has_slash = 0;
  1.5135 +  const char* p;
  1.5136 +  const char* p_next;
  1.5137 +  struct stat st;
  1.5138 +  /* static buffer for getcwd */
  1.5139 +  char tmp[LT_PATHMAX + 1];
  1.5140 +  int tmp_len;
  1.5141 +  char* concat_name;
  1.5142 +
  1.5143 +  DEBUG("(find_executable)  : %s\n", wrapper ? (*wrapper ? wrapper : "EMPTY!") : "NULL!");
  1.5144 +  
  1.5145 +  if ((wrapper == NULL) || (*wrapper == '\0'))
  1.5146 +    return NULL;
  1.5147 +
  1.5148 +  /* Absolute path? */
  1.5149 +#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
  1.5150 +  if (isalpha (wrapper[0]) && wrapper[1] == ':')
  1.5151 +  {
  1.5152 +    concat_name = xstrdup (wrapper);
  1.5153 +    if (check_executable(concat_name))
  1.5154 +      return concat_name;
  1.5155 +    XFREE(concat_name);
  1.5156 +  }
  1.5157 +  else
  1.5158 +  {
  1.5159 +#endif
  1.5160 +    if (IS_DIR_SEPARATOR (wrapper[0]))
  1.5161 +    {
  1.5162 +      concat_name = xstrdup (wrapper);
  1.5163 +      if (check_executable(concat_name))
  1.5164 +        return concat_name;
  1.5165 +      XFREE(concat_name);
  1.5166 +    }
  1.5167 +#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
  1.5168 +  }
  1.5169 +#endif
  1.5170 +
  1.5171 +  for (p = wrapper; *p; p++)
  1.5172 +    if (*p == '/')
  1.5173 +    {
  1.5174 +      has_slash = 1;
  1.5175 +      break;
  1.5176 +    }
  1.5177 +  if (!has_slash)
  1.5178 +  {
  1.5179 +    /* no slashes; search PATH */
  1.5180 +    const char* path = getenv ("PATH");
  1.5181 +    if (path != NULL)
  1.5182 +    {
  1.5183 +      for (p = path; *p; p = p_next)
  1.5184 +      {
  1.5185 +        const char* q;
  1.5186 +        size_t p_len;
  1.5187 +        for (q = p; *q; q++)
  1.5188 +          if (IS_PATH_SEPARATOR(*q))
  1.5189 +            break;
  1.5190 +        p_len = q - p;
  1.5191 +        p_next = (*q == '\0' ? q : q + 1);
  1.5192 +        if (p_len == 0)
  1.5193 +        {
  1.5194 +          /* empty path: current directory */
  1.5195 +          if (getcwd (tmp, LT_PATHMAX) == NULL)
  1.5196 +            lt_fatal ("getcwd failed");
  1.5197 +          tmp_len = strlen(tmp);
  1.5198 +          concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1);
  1.5199 +          memcpy (concat_name, tmp, tmp_len);
  1.5200 +          concat_name[tmp_len] = '/';
  1.5201 +          strcpy (concat_name + tmp_len + 1, wrapper);
  1.5202 +        }
  1.5203 +        else
  1.5204 +        {
  1.5205 +          concat_name = XMALLOC(char, p_len + 1 + strlen(wrapper) + 1);
  1.5206 +          memcpy (concat_name, p, p_len);
  1.5207 +          concat_name[p_len] = '/';
  1.5208 +          strcpy (concat_name + p_len + 1, wrapper);
  1.5209 +        }
  1.5210 +        if (check_executable(concat_name))
  1.5211 +          return concat_name;
  1.5212 +        XFREE(concat_name);
  1.5213 +      }
  1.5214 +    }
  1.5215 +    /* not found in PATH; assume curdir */
  1.5216 +  }
  1.5217 +  /* Relative path | not found in path: prepend cwd */
  1.5218 +  if (getcwd (tmp, LT_PATHMAX) == NULL)
  1.5219 +    lt_fatal ("getcwd failed");
  1.5220 +  tmp_len = strlen(tmp);
  1.5221 +  concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1);
  1.5222 +  memcpy (concat_name, tmp, tmp_len);
  1.5223 +  concat_name[tmp_len] = '/';
  1.5224 +  strcpy (concat_name + tmp_len + 1, wrapper);
  1.5225 +
  1.5226 +  if (check_executable(concat_name))
  1.5227 +    return concat_name;
  1.5228 +  XFREE(concat_name);
  1.5229 +  return NULL;
  1.5230 +}
  1.5231 +
  1.5232 +char *
  1.5233 +strendzap(char *str, const char *pat) 
  1.5234 +{
  1.5235 +  size_t len, patlen;
  1.5236 +
  1.5237 +  assert(str != NULL);
  1.5238 +  assert(pat != NULL);
  1.5239 +
  1.5240 +  len = strlen(str);
  1.5241 +  patlen = strlen(pat);
  1.5242 +
  1.5243 +  if (patlen <= len)
  1.5244 +  {
  1.5245 +    str += len - patlen;
  1.5246 +    if (strcmp(str, pat) == 0)
  1.5247 +      *str = '\0';
  1.5248 +  }
  1.5249 +  return str;
  1.5250 +}
  1.5251 +
  1.5252 +static void
  1.5253 +lt_error_core (int exit_status, const char * mode, 
  1.5254 +          const char * message, va_list ap)
  1.5255 +{
  1.5256 +  fprintf (stderr, "%s: %s: ", program_name, mode);
  1.5257 +  vfprintf (stderr, message, ap);
  1.5258 +  fprintf (stderr, ".\n");
  1.5259 +
  1.5260 +  if (exit_status >= 0)
  1.5261 +    exit (exit_status);
  1.5262 +}
  1.5263 +
  1.5264 +void
  1.5265 +lt_fatal (const char *message, ...)
  1.5266 +{
  1.5267 +  va_list ap;
  1.5268 +  va_start (ap, message);
  1.5269 +  lt_error_core (EXIT_FAILURE, "FATAL", message, ap);
  1.5270 +  va_end (ap);
  1.5271 +}
  1.5272 +EOF
  1.5273 +	  # we should really use a build-platform specific compiler
  1.5274 +	  # here, but OTOH, the wrappers (shell script and this C one)
  1.5275 +	  # are only useful if you want to execute the "real" binary.
  1.5276 +	  # Since the "real" binary is built for $host, then this
  1.5277 +	  # wrapper might as well be built for $host, too.
  1.5278 +	  $run $LTCC -s -o $cwrapper $cwrappersource
  1.5279 +	  ;;
  1.5280  	esac
  1.5281  	$rm $output
  1.5282  	trap "$rm $output; exit 1" 1 2 15
  1.5283 @@ -2860,7 +4833,7 @@
  1.5284  
  1.5285  # Sed substitution that helps us do robust quoting.  It backslashifies
  1.5286  # metacharacters that are still active within double-quoted strings.
  1.5287 -Xsed='sed -e 1s/^X//'
  1.5288 +Xsed='${SED} -e 1s/^X//'
  1.5289  sed_quote_subst='$sed_quote_subst'
  1.5290  
  1.5291  # The HP-UX ksh and POSIX shell print the target directory to stdout
  1.5292 @@ -2872,7 +4845,7 @@
  1.5293  # This environment variable determines our operation mode.
  1.5294  if test \"\$libtool_install_magic\" = \"$magic\"; then
  1.5295    # install mode needs the following variable:
  1.5296 -  link_against_libtool_libs='$link_against_libtool_libs'
  1.5297 +  notinst_deplibs='$notinst_deplibs'
  1.5298  else
  1.5299    # When we are sourced in execute mode, \$file and \$echo are already set.
  1.5300    if test \"\$libtool_execute_magic\" != \"$magic\"; then
  1.5301 @@ -2898,20 +4871,20 @@
  1.5302    test \"x\$thisdir\" = \"x\$file\" && thisdir=.
  1.5303  
  1.5304    # Follow symbolic links until we get to the real thisdir.
  1.5305 -  file=\`ls -ld \"\$file\" | sed -n 's/.*-> //p'\`
  1.5306 +  file=\`ls -ld \"\$file\" | ${SED} -n 's/.*-> //p'\`
  1.5307    while test -n \"\$file\"; do
  1.5308      destdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\`
  1.5309  
  1.5310      # If there was a directory component, then change thisdir.
  1.5311      if test \"x\$destdir\" != \"x\$file\"; then
  1.5312        case \"\$destdir\" in
  1.5313 -      [\\/]* | [A-Za-z]:[\\/]*) thisdir=\"\$destdir\" ;;
  1.5314 +      [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;;
  1.5315        *) thisdir=\"\$thisdir/\$destdir\" ;;
  1.5316        esac
  1.5317      fi
  1.5318  
  1.5319      file=\`\$echo \"X\$file\" | \$Xsed -e 's%^.*/%%'\`
  1.5320 -    file=\`ls -ld \"\$thisdir/\$file\" | sed -n 's/.*-> //p'\`
  1.5321 +    file=\`ls -ld \"\$thisdir/\$file\" | ${SED} -n 's/.*-> //p'\`
  1.5322    done
  1.5323  
  1.5324    # Try to get the absolute directory name.
  1.5325 @@ -2920,12 +4893,12 @@
  1.5326  "
  1.5327  
  1.5328  	if test "$fast_install" = yes; then
  1.5329 -	  echo >> $output "\
  1.5330 -  program=lt-'$outputname'
  1.5331 +	  $echo >> $output "\
  1.5332 +  program=lt-'$outputname'$exeext
  1.5333    progdir=\"\$thisdir/$objdir\"
  1.5334 -  
  1.5335 +
  1.5336    if test ! -f \"\$progdir/\$program\" || \\
  1.5337 -     { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | sed 1q\`; \\
  1.5338 +     { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\
  1.5339         test \"X\$file\" != \"X\$progdir/\$program\"; }; then
  1.5340  
  1.5341      file=\"\$\$-\$program\"
  1.5342 @@ -2936,12 +4909,13 @@
  1.5343        $rm \"\$progdir/\$file\"
  1.5344      fi"
  1.5345  
  1.5346 -	  echo >> $output "\
  1.5347 +	  $echo >> $output "\
  1.5348  
  1.5349      # relink executable if necessary
  1.5350      if test -n \"\$relink_command\"; then
  1.5351 -      if (cd \"\$thisdir\" && eval \$relink_command); then :
  1.5352 +      if relink_command_output=\`eval \$relink_command 2>&1\`; then :
  1.5353        else
  1.5354 +	$echo \"\$relink_command_output\" >&2
  1.5355  	$rm \"\$progdir/\$file\"
  1.5356  	exit 1
  1.5357        fi
  1.5358 @@ -2953,13 +4927,13 @@
  1.5359      $rm \"\$progdir/\$file\"
  1.5360    fi"
  1.5361  	else
  1.5362 -	  echo >> $output "\
  1.5363 +	  $echo >> $output "\
  1.5364    program='$outputname'
  1.5365    progdir=\"\$thisdir/$objdir\"
  1.5366  "
  1.5367  	fi
  1.5368  
  1.5369 -	echo >> $output "\
  1.5370 +	$echo >> $output "\
  1.5371  
  1.5372    if test -f \"\$progdir/\$program\"; then"
  1.5373  
  1.5374 @@ -2990,14 +4964,6 @@
  1.5375        # Run the actual program with our arguments.
  1.5376  "
  1.5377  	case $host in
  1.5378 -	  # win32 systems need to use the prog path for dll
  1.5379 -	  # lookup to work
  1.5380 -	*-*-cygwin*)
  1.5381 -	  $echo >> $output "\
  1.5382 -      exec \$progdir/\$program \${1+\"\$@\"}
  1.5383 -"
  1.5384 -	  ;;
  1.5385 -
  1.5386  	# Backslashes separate directories on plain windows
  1.5387  	*-*-mingw | *-*-os2*)
  1.5388  	  $echo >> $output "\
  1.5389 @@ -3007,11 +4973,7 @@
  1.5390  
  1.5391  	*)
  1.5392  	  $echo >> $output "\
  1.5393 -      # Export the path to the program.
  1.5394 -      PATH=\"\$progdir:\$PATH\"
  1.5395 -      export PATH
  1.5396 -
  1.5397 -      exec \$program \${1+\"\$@\"}
  1.5398 +      exec \$progdir/\$program \${1+\"\$@\"}
  1.5399  "
  1.5400  	  ;;
  1.5401  	esac
  1.5402 @@ -3023,7 +4985,7 @@
  1.5403      # The program doesn't exist.
  1.5404      \$echo \"\$0: error: \$progdir/\$program does not exist\" 1>&2
  1.5405      \$echo \"This script is just a wrapper for \$program.\" 1>&2
  1.5406 -    echo \"See the $PACKAGE documentation for more information.\" 1>&2
  1.5407 +    $echo \"See the $PACKAGE documentation for more information.\" 1>&2
  1.5408      exit 1
  1.5409    fi
  1.5410  fi\
  1.5411 @@ -3046,7 +5008,7 @@
  1.5412  	  oldobjs="$libobjs_save"
  1.5413  	  build_libtool_libs=no
  1.5414  	else
  1.5415 -	  oldobjs="$objs "`$echo "X$libobjs_save" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`
  1.5416 +	  oldobjs="$old_deplibs $non_pic_objects"
  1.5417  	fi
  1.5418  	addlibs="$old_convenience"
  1.5419        fi
  1.5420 @@ -3055,18 +5017,18 @@
  1.5421  	gentop="$output_objdir/${outputname}x"
  1.5422  	$show "${rm}r $gentop"
  1.5423  	$run ${rm}r "$gentop"
  1.5424 -	$show "mkdir $gentop"
  1.5425 -	$run mkdir "$gentop"
  1.5426 +	$show "$mkdir $gentop"
  1.5427 +	$run $mkdir "$gentop"
  1.5428  	status=$?
  1.5429 -	if test $status -ne 0 && test ! -d "$gentop"; then
  1.5430 +	if test "$status" -ne 0 && test ! -d "$gentop"; then
  1.5431  	  exit $status
  1.5432  	fi
  1.5433  	generated="$generated $gentop"
  1.5434 -	  
  1.5435 +
  1.5436  	# Add in members from convenience archives.
  1.5437  	for xlib in $addlibs; do
  1.5438  	  # Extract the objects.
  1.5439 -	  case "$xlib" in
  1.5440 +	  case $xlib in
  1.5441  	  [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
  1.5442  	  *) xabs=`pwd`"/$xlib" ;;
  1.5443  	  esac
  1.5444 @@ -3075,14 +5037,40 @@
  1.5445  
  1.5446  	  $show "${rm}r $xdir"
  1.5447  	  $run ${rm}r "$xdir"
  1.5448 -	  $show "mkdir $xdir"
  1.5449 -	  $run mkdir "$xdir"
  1.5450 +	  $show "$mkdir $xdir"
  1.5451 +	  $run $mkdir "$xdir"
  1.5452  	  status=$?
  1.5453 -	  if test $status -ne 0 && test ! -d "$xdir"; then
  1.5454 +	  if test "$status" -ne 0 && test ! -d "$xdir"; then
  1.5455  	    exit $status
  1.5456  	  fi
  1.5457 +	  # We will extract separately just the conflicting names and we will no
  1.5458 +	  # longer touch any unique names. It is faster to leave these extract
  1.5459 +	  # automatically by $AR in one run.
  1.5460  	  $show "(cd $xdir && $AR x $xabs)"
  1.5461  	  $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
  1.5462 +	  if ($AR t "$xabs" | sort | sort -uc >/dev/null 2>&1); then
  1.5463 +	    :
  1.5464 +	  else
  1.5465 +	    $echo "$modename: warning: object name conflicts; renaming object files" 1>&2
  1.5466 +	    $echo "$modename: warning: to ensure that they will not overwrite" 1>&2
  1.5467 +	    $AR t "$xabs" | sort | uniq -cd | while read -r count name
  1.5468 +	    do
  1.5469 +	      i=1
  1.5470 +	      while test "$i" -le "$count"
  1.5471 +	      do
  1.5472 +	       # Put our $i before any first dot (extension)
  1.5473 +	       # Never overwrite any file
  1.5474 +	       name_to="$name"
  1.5475 +	       while test "X$name_to" = "X$name" || test -f "$xdir/$name_to"
  1.5476 +	       do
  1.5477 +		 name_to=`$echo "X$name_to" | $Xsed -e "s/\([^.]*\)/\1-$i/"`
  1.5478 +	       done
  1.5479 +	       $show "(cd $xdir && $AR xN $i $xabs '$name' && $mv '$name' '$name_to')"
  1.5480 +	       $run eval "(cd \$xdir && $AR xN $i \$xabs '$name' && $mv '$name' '$name_to')" || exit $?
  1.5481 +	       i=`expr $i + 1`
  1.5482 +	      done
  1.5483 +	    done
  1.5484 +	  fi
  1.5485  
  1.5486  	  oldobjs="$oldobjs "`find $xdir -name \*.${objext} -print -o -name \*.lo -print | $NL2SP`
  1.5487  	done
  1.5488 @@ -3092,27 +5080,67 @@
  1.5489        if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then
  1.5490  	eval cmds=\"$old_archive_from_new_cmds\"
  1.5491        else
  1.5492 -	# Ensure that we have .o objects in place in case we decided
  1.5493 -	# not to build a shared library, and have fallen back to building
  1.5494 -	# static libs even though --disable-static was passed!
  1.5495 -	for oldobj in $oldobjs; do
  1.5496 -	  if test ! -f $oldobj; then
  1.5497 -	    xdir=`$echo "X$oldobj" | $Xsed -e 's%/[^/]*$%%'`
  1.5498 -	    if test "X$xdir" = "X$oldobj"; then
  1.5499 -	      xdir="."
  1.5500 +	eval cmds=\"$old_archive_cmds\"
  1.5501 +
  1.5502 +	if len=`expr "X$cmds" : ".*"` &&
  1.5503 +	     test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
  1.5504 +	  :
  1.5505 +	else
  1.5506 +	  # the command line is too long to link in one step, link in parts
  1.5507 +	  $echo "using piecewise archive linking..."
  1.5508 +	  save_RANLIB=$RANLIB
  1.5509 +	  RANLIB=:
  1.5510 +	  objlist=
  1.5511 +	  concat_cmds=
  1.5512 +	  save_oldobjs=$oldobjs
  1.5513 +	  # GNU ar 2.10+ was changed to match POSIX; thus no paths are
  1.5514 +	  # encoded into archives.  This makes 'ar r' malfunction in
  1.5515 +	  # this piecewise linking case whenever conflicting object
  1.5516 +	  # names appear in distinct ar calls; check, warn and compensate.
  1.5517 +	    if (for obj in $save_oldobjs
  1.5518 +	    do
  1.5519 +	      $echo "X$obj" | $Xsed -e 's%^.*/%%'
  1.5520 +	    done | sort | sort -uc >/dev/null 2>&1); then
  1.5521 +	    :
  1.5522 +	  else
  1.5523 +	    $echo "$modename: warning: object name conflicts; overriding AR_FLAGS to 'cq'" 1>&2
  1.5524 +	    $echo "$modename: warning: to ensure that POSIX-compatible ar will work" 1>&2
  1.5525 +	    AR_FLAGS=cq
  1.5526 +	  fi
  1.5527 +	  # Is there a better way of finding the last object in the list?
  1.5528 +	  for obj in $save_oldobjs
  1.5529 +	  do
  1.5530 +	    last_oldobj=$obj
  1.5531 +	  done  
  1.5532 +	  for obj in $save_oldobjs
  1.5533 +	  do
  1.5534 +	    oldobjs="$objlist $obj"
  1.5535 +	    objlist="$objlist $obj"
  1.5536 +	    eval test_cmds=\"$old_archive_cmds\"
  1.5537 +	    if len=`expr "X$test_cmds" : ".*"` &&
  1.5538 +	       test "$len" -le "$max_cmd_len"; then
  1.5539 +	      :
  1.5540  	    else
  1.5541 -	      xdir="$xdir"
  1.5542 +	      # the above command should be used before it gets too long
  1.5543 +	      oldobjs=$objlist
  1.5544 +	      if test "$obj" = "$last_oldobj" ; then
  1.5545 +	        RANLIB=$save_RANLIB
  1.5546 +	      fi  
  1.5547 +	      test -z "$concat_cmds" || concat_cmds=$concat_cmds~
  1.5548 +	      eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\"
  1.5549 +	      objlist=
  1.5550  	    fi
  1.5551 -	    baseobj=`$echo "X$oldobj" | $Xsed -e 's%^.*/%%'`
  1.5552 -	    obj=`$echo "X$baseobj" | $Xsed -e "$o2lo"`
  1.5553 -	    $show "(cd $xdir && ${LN_S} $obj $baseobj)"
  1.5554 -	    $run eval '(cd $xdir && ${LN_S} $obj $baseobj)' || exit $?
  1.5555 +	  done
  1.5556 +	  RANLIB=$save_RANLIB
  1.5557 +	  oldobjs=$objlist
  1.5558 +	  if test "X$oldobjs" = "X" ; then
  1.5559 +	    eval cmds=\"\$concat_cmds\"
  1.5560 +	  else
  1.5561 +	    eval cmds=\"\$concat_cmds~$old_archive_cmds\"
  1.5562  	  fi
  1.5563 -	done
  1.5564 -
  1.5565 -	eval cmds=\"$old_archive_cmds\"
  1.5566 +	fi
  1.5567        fi
  1.5568 -      IFS="${IFS= 	}"; save_ifs="$IFS"; IFS='~'
  1.5569 +      save_ifs="$IFS"; IFS='~'
  1.5570        for cmd in $cmds; do
  1.5571  	IFS="$save_ifs"
  1.5572  	$show "$cmd"
  1.5573 @@ -3127,19 +5155,26 @@
  1.5574      fi
  1.5575  
  1.5576      # Now create the libtool archive.
  1.5577 -    case "$output" in
  1.5578 +    case $output in
  1.5579      *.la)
  1.5580        old_library=
  1.5581        test "$build_old_libs" = yes && old_library="$libname.$libext"
  1.5582        $show "creating $output"
  1.5583  
  1.5584 -      if test -n "$xrpath"; then
  1.5585 -	temp_xrpath=
  1.5586 -	for libdir in $xrpath; do
  1.5587 -	  temp_xrpath="$temp_xrpath -R$libdir"
  1.5588 -	done
  1.5589 -	dependency_libs="$temp_xrpath $dependency_libs"
  1.5590 -      fi
  1.5591 +      # Preserve any variables that may affect compiler behavior
  1.5592 +      for var in $variables_saved_for_relink; do
  1.5593 +	if eval test -z \"\${$var+set}\"; then
  1.5594 +	  relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command"
  1.5595 +	elif eval var_value=\$$var; test -z "$var_value"; then
  1.5596 +	  relink_command="$var=; export $var; $relink_command"
  1.5597 +	else
  1.5598 +	  var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"`
  1.5599 +	  relink_command="$var=\"$var_value\"; export $var; $relink_command"
  1.5600 +	fi
  1.5601 +      done
  1.5602 +      # Quote the link command for shipping.
  1.5603 +      relink_command="(cd `pwd`; $SHELL $0 --mode=relink $libtool_args @inst_prefix_dir@)"
  1.5604 +      relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"`
  1.5605  
  1.5606        # Only create the output if not a dry run.
  1.5607        if test -z "$run"; then
  1.5608 @@ -3149,8 +5184,52 @@
  1.5609  	      break
  1.5610  	    fi
  1.5611  	    output="$output_objdir/$outputname"i
  1.5612 +	    # Replace all uninstalled libtool libraries with the installed ones
  1.5613 +	    newdependency_libs=
  1.5614 +	    for deplib in $dependency_libs; do
  1.5615 +	      case $deplib in
  1.5616 +	      *.la)
  1.5617 +		name=`$echo "X$deplib" | $Xsed -e 's%^.*/%%'`
  1.5618 +		eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
  1.5619 +		if test -z "$libdir"; then
  1.5620 +		  $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
  1.5621 +		  exit 1
  1.5622 +		fi
  1.5623 +		newdependency_libs="$newdependency_libs $libdir/$name"
  1.5624 +		;;
  1.5625 +	      *) newdependency_libs="$newdependency_libs $deplib" ;;
  1.5626 +	      esac
  1.5627 +	    done
  1.5628 +	    dependency_libs="$newdependency_libs"
  1.5629 +	    newdlfiles=
  1.5630 +	    for lib in $dlfiles; do
  1.5631 +	      name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
  1.5632 +	      eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
  1.5633 +	      if test -z "$libdir"; then
  1.5634 +		$echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
  1.5635 +		exit 1
  1.5636 +	      fi
  1.5637 +	      newdlfiles="$newdlfiles $libdir/$name"
  1.5638 +	    done
  1.5639 +	    dlfiles="$newdlfiles"
  1.5640 +	    newdlprefiles=
  1.5641 +	    for lib in $dlprefiles; do
  1.5642 +	      name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
  1.5643 +	      eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
  1.5644 +	      if test -z "$libdir"; then
  1.5645 +		$echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
  1.5646 +		exit 1
  1.5647 +	      fi
  1.5648 +	      newdlprefiles="$newdlprefiles $libdir/$name"
  1.5649 +	    done
  1.5650 +	    dlprefiles="$newdlprefiles"
  1.5651  	  fi
  1.5652  	  $rm $output
  1.5653 +	  # place dlname in correct position for cygwin
  1.5654 +	  tdlname=$dlname
  1.5655 +	  case $host,$output,$installed,$module,$dlname in
  1.5656 +	    *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;;
  1.5657 +	  esac
  1.5658  	  $echo > $output "\
  1.5659  # $outputname - a libtool library file
  1.5660  # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
  1.5661 @@ -3159,7 +5238,7 @@
  1.5662  # It is necessary for linking the library.
  1.5663  
  1.5664  # The name that we can dlopen(3).
  1.5665 -dlname='$dlname'
  1.5666 +dlname='$tdlname'
  1.5667  
  1.5668  # Names of this library.
  1.5669  library_names='$library_names'
  1.5670 @@ -3178,16 +5257,26 @@
  1.5671  # Is this an already installed library?
  1.5672  installed=$installed
  1.5673  
  1.5674 +# Should we warn about portability when linking against -modules?
  1.5675 +shouldnotlink=$module
  1.5676 +
  1.5677 +# Files to dlopen/dlpreopen
  1.5678 +dlopen='$dlfiles'
  1.5679 +dlpreopen='$dlprefiles'
  1.5680 +
  1.5681  # Directory that this library needs to be installed in:
  1.5682 -libdir='$install_libdir'\
  1.5683 -"
  1.5684 +libdir='$install_libdir'"
  1.5685 +	  if test "$installed" = no && test "$need_relink" = yes; then
  1.5686 +	    $echo >> $output "\
  1.5687 +relink_command=\"$relink_command\""
  1.5688 +	  fi
  1.5689  	done
  1.5690        fi
  1.5691  
  1.5692        # Do a symbolic link so that the libtool archive can be found in
  1.5693        # LD_LIBRARY_PATH before the program is installed.
  1.5694        $show "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)"
  1.5695 -      $run eval "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)" || exit $?
  1.5696 +      $run eval '(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)' || exit $?
  1.5697        ;;
  1.5698      esac
  1.5699      exit 0
  1.5700 @@ -3199,10 +5288,12 @@
  1.5701  
  1.5702      # There may be an optional sh(1) argument at the beginning of
  1.5703      # install_prog (especially on Windows NT).
  1.5704 -    if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh; then
  1.5705 +    if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh ||
  1.5706 +       # Allow the use of GNU shtool's install command.
  1.5707 +       $echo "X$nonopt" | $Xsed | grep shtool > /dev/null; then
  1.5708        # Aesthetically quote it.
  1.5709        arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"`
  1.5710 -      case "$arg" in
  1.5711 +      case $arg in
  1.5712        *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*)
  1.5713  	arg="\"$arg\""
  1.5714  	;;
  1.5715 @@ -3218,7 +5309,7 @@
  1.5716      # The real first argument should be the name of the installation program.
  1.5717      # Aesthetically quote it.
  1.5718      arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
  1.5719 -    case "$arg" in
  1.5720 +    case $arg in
  1.5721      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*)
  1.5722        arg="\"$arg\""
  1.5723        ;;
  1.5724 @@ -3241,7 +5332,7 @@
  1.5725  	continue
  1.5726        fi
  1.5727  
  1.5728 -      case "$arg" in
  1.5729 +      case $arg in
  1.5730        -d) isdir=yes ;;
  1.5731        -f) prev="-f" ;;
  1.5732        -g) prev="-g" ;;
  1.5733 @@ -3266,7 +5357,7 @@
  1.5734  
  1.5735        # Aesthetically quote the argument.
  1.5736        arg=`$echo "X$arg" | $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 @@ -3311,17 +5402,17 @@
  1.5743  
  1.5744        # Not a directory, so check to see that there is only one file specified.
  1.5745        set dummy $files
  1.5746 -      if test $# -gt 2; then
  1.5747 +      if test "$#" -gt 2; then
  1.5748  	$echo "$modename: \`$dest' is not a directory" 1>&2
  1.5749  	$echo "$help" 1>&2
  1.5750  	exit 1
  1.5751        fi
  1.5752      fi
  1.5753 -    case "$destdir" in
  1.5754 +    case $destdir in
  1.5755      [\\/]* | [A-Za-z]:[\\/]*) ;;
  1.5756      *)
  1.5757        for file in $files; do
  1.5758 -	case "$file" in
  1.5759 +	case $file in
  1.5760  	*.lo) ;;
  1.5761  	*)
  1.5762  	  $echo "$modename: \`$destdir' must be an absolute directory name" 1>&2
  1.5763 @@ -3343,15 +5434,15 @@
  1.5764      for file in $files; do
  1.5765  
  1.5766        # Do each installation.
  1.5767 -      case "$file" in
  1.5768 -      *.a | *.lib)
  1.5769 +      case $file in
  1.5770 +      *.$libext)
  1.5771  	# Do the static libraries later.
  1.5772  	staticlibs="$staticlibs $file"
  1.5773  	;;
  1.5774  
  1.5775        *.la)
  1.5776  	# Check to see that this really is a libtool archive.
  1.5777 -	if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
  1.5778 +	if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
  1.5779  	else
  1.5780  	  $echo "$modename: \`$file' is not a valid libtool archive" 1>&2
  1.5781  	  $echo "$help" 1>&2
  1.5782 @@ -3360,8 +5451,9 @@
  1.5783  
  1.5784  	library_names=
  1.5785  	old_library=
  1.5786 +	relink_command=
  1.5787  	# If there is no directory component, then add one.
  1.5788 -	case "$file" in
  1.5789 +	case $file in
  1.5790  	*/* | *\\*) . $file ;;
  1.5791  	*) . ./$file ;;
  1.5792  	esac
  1.5793 @@ -3380,10 +5472,41 @@
  1.5794  	  esac
  1.5795  	fi
  1.5796  
  1.5797 -	dir="`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`/"
  1.5798 +	dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`/
  1.5799  	test "X$dir" = "X$file/" && dir=
  1.5800  	dir="$dir$objdir"
  1.5801  
  1.5802 +	if test -n "$relink_command"; then
  1.5803 +	  # Determine the prefix the user has applied to our future dir.
  1.5804 +	  inst_prefix_dir=`$echo "$destdir" | $SED "s%$libdir\$%%"`
  1.5805 +
  1.5806 +	  # Don't allow the user to place us outside of our expected
  1.5807 +	  # location b/c this prevents finding dependent libraries that
  1.5808 +	  # are installed to the same prefix.
  1.5809 +	  # At present, this check doesn't affect windows .dll's that
  1.5810 +	  # are installed into $libdir/../bin (currently, that works fine)
  1.5811 +	  # but it's something to keep an eye on.
  1.5812 +	  if test "$inst_prefix_dir" = "$destdir"; then
  1.5813 +	    $echo "$modename: error: cannot install \`$file' to a directory not ending in $libdir" 1>&2
  1.5814 +	    exit 1
  1.5815 +	  fi
  1.5816 +
  1.5817 +	  if test -n "$inst_prefix_dir"; then
  1.5818 +	    # Stick the inst_prefix_dir data into the link command.
  1.5819 +	    relink_command=`$echo "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"`
  1.5820 +	  else
  1.5821 +	    relink_command=`$echo "$relink_command" | $SED "s%@inst_prefix_dir@%%"`
  1.5822 +	  fi
  1.5823 +
  1.5824 +	  $echo "$modename: warning: relinking \`$file'" 1>&2
  1.5825 +	  $show "$relink_command"
  1.5826 +	  if $run eval "$relink_command"; then :
  1.5827 +	  else
  1.5828 +	    $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
  1.5829 +	    exit 1
  1.5830 +	  fi
  1.5831 +	fi
  1.5832 +
  1.5833  	# See the names of the shared library.
  1.5834  	set dummy $library_names
  1.5835  	if test -n "$2"; then
  1.5836 @@ -3391,11 +5514,18 @@
  1.5837  	  shift
  1.5838  	  shift
  1.5839  
  1.5840 +	  srcname="$realname"
  1.5841 +	  test -n "$relink_command" && srcname="$realname"T
  1.5842 +
  1.5843  	  # Install the shared library and build the symlinks.
  1.5844 -	  $show "$install_prog $dir/$realname $destdir/$realname"
  1.5845 -	  $run eval "$install_prog $dir/$realname $destdir/$realname" || exit $?
  1.5846 -
  1.5847 -	  if test $# -gt 0; then
  1.5848 +	  $show "$install_prog $dir/$srcname $destdir/$realname"
  1.5849 +	  $run eval "$install_prog $dir/$srcname $destdir/$realname" || exit $?
  1.5850 +	  if test -n "$stripme" && test -n "$striplib"; then
  1.5851 +	    $show "$striplib $destdir/$realname"
  1.5852 +	    $run eval "$striplib $destdir/$realname" || exit $?
  1.5853 +	  fi
  1.5854 +
  1.5855 +	  if test "$#" -gt 0; then
  1.5856  	    # Delete the old symlinks, and create new ones.
  1.5857  	    for linkname
  1.5858  	    do
  1.5859 @@ -3409,7 +5539,7 @@
  1.5860  	  # Do each command in the postinstall commands.
  1.5861  	  lib="$destdir/$realname"
  1.5862  	  eval cmds=\"$postinstall_cmds\"
  1.5863 -	  IFS="${IFS= 	}"; save_ifs="$IFS"; IFS='~'
  1.5864 +	  save_ifs="$IFS"; IFS='~'
  1.5865  	  for cmd in $cmds; do
  1.5866  	    IFS="$save_ifs"
  1.5867  	    $show "$cmd"
  1.5868 @@ -3440,11 +5570,11 @@
  1.5869  	fi
  1.5870  
  1.5871  	# Deduce the name of the destination old-style object file.
  1.5872 -	case "$destfile" in
  1.5873 +	case $destfile in
  1.5874  	*.lo)
  1.5875  	  staticdest=`$echo "X$destfile" | $Xsed -e "$lo2o"`
  1.5876  	  ;;
  1.5877 -	*.o | *.obj)
  1.5878 +	*.$objext)
  1.5879  	  staticdest="$destfile"
  1.5880  	  destfile=
  1.5881  	  ;;
  1.5882 @@ -3481,41 +5611,83 @@
  1.5883  	  destfile="$destdir/$destfile"
  1.5884  	fi
  1.5885  
  1.5886 +	# If the file is missing, and there is a .exe on the end, strip it
  1.5887 +	# because it is most likely a libtool script we actually want to
  1.5888 +	# install
  1.5889 +	stripped_ext=""
  1.5890 +	case $file in
  1.5891 +	  *.exe)
  1.5892 +	    if test ! -f "$file"; then
  1.5893 +	      file=`$echo $file|${SED} 's,.exe$,,'`
  1.5894 +	      stripped_ext=".exe"
  1.5895 +	    fi
  1.5896 +	    ;;
  1.5897 +	esac
  1.5898 +
  1.5899  	# Do a test to see if this is really a libtool program.
  1.5900 -	if (sed -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
  1.5901 -	  link_against_libtool_libs=
  1.5902 +	case $host in
  1.5903 +	*cygwin*|*mingw*)
  1.5904 +	    wrapper=`$echo $file | ${SED} -e 's,.exe$,,'`
  1.5905 +	    ;;
  1.5906 +	*)
  1.5907 +	    wrapper=$file
  1.5908 +	    ;;
  1.5909 +	esac
  1.5910 +	if (${SED} -e '4q' $wrapper | grep "^# Generated by .*$PACKAGE")>/dev/null 2>&1; then
  1.5911 +	  notinst_deplibs=
  1.5912  	  relink_command=
  1.5913  
  1.5914 +	  # To insure that "foo" is sourced, and not "foo.exe",
  1.5915 +	  # finese the cygwin/MSYS system by explicitly sourcing "foo."
  1.5916 +	  # which disallows the automatic-append-.exe behavior.
  1.5917 +	  case $build in
  1.5918 +	  *cygwin* | *mingw*) wrapperdot=${wrapper}. ;;
  1.5919 +	  *) wrapperdot=${wrapper} ;;
  1.5920 +	  esac
  1.5921  	  # If there is no directory component, then add one.
  1.5922 -	  case "$file" in
  1.5923 -	  */* | *\\*) . $file ;;
  1.5924 -	  *) . ./$file ;;
  1.5925 +	  case $file in
  1.5926 +	  */* | *\\*) . ${wrapperdot} ;;
  1.5927 +	  *) . ./${wrapperdot} ;;
  1.5928  	  esac
  1.5929  
  1.5930  	  # Check the variables that should have been set.
  1.5931 -	  if test -z "$link_against_libtool_libs"; then
  1.5932 -	    $echo "$modename: invalid libtool wrapper script \`$file'" 1>&2
  1.5933 +	  if test -z "$notinst_deplibs"; then
  1.5934 +	    $echo "$modename: invalid libtool wrapper script \`$wrapper'" 1>&2
  1.5935  	    exit 1
  1.5936  	  fi
  1.5937  
  1.5938  	  finalize=yes
  1.5939 -	  for lib in $link_against_libtool_libs; do
  1.5940 +	  for lib in $notinst_deplibs; do
  1.5941  	    # Check to see that each library is installed.
  1.5942  	    libdir=
  1.5943  	    if test -f "$lib"; then
  1.5944  	      # If there is no directory component, then add one.
  1.5945 -	      case "$lib" in
  1.5946 +	      case $lib in
  1.5947  	      */* | *\\*) . $lib ;;
  1.5948  	      *) . ./$lib ;;
  1.5949  	      esac
  1.5950  	    fi
  1.5951 -	    libfile="$libdir/`$echo "X$lib" | $Xsed -e 's%^.*/%%g'`"
  1.5952 +	    libfile="$libdir/"`$echo "X$lib" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test
  1.5953  	    if test -n "$libdir" && test ! -f "$libfile"; then
  1.5954  	      $echo "$modename: warning: \`$lib' has not been installed in \`$libdir'" 1>&2
  1.5955  	      finalize=no
  1.5956  	    fi
  1.5957  	  done
  1.5958  
  1.5959 +	  relink_command=
  1.5960 +	  # To insure that "foo" is sourced, and not "foo.exe",
  1.5961 +	  # finese the cygwin/MSYS system by explicitly sourcing "foo."
  1.5962 +	  # which disallows the automatic-append-.exe behavior.
  1.5963 +	  case $build in
  1.5964 +	  *cygwin* | *mingw*) wrapperdot=${wrapper}. ;;
  1.5965 +	  *) wrapperdot=${wrapper} ;;
  1.5966 +	  esac
  1.5967 +	  # If there is no directory component, then add one.
  1.5968 +	  case $file in
  1.5969 +	  */* | *\\*) . ${wrapperdot} ;;
  1.5970 +	  *) . ./${wrapperdot} ;;
  1.5971 +	  esac
  1.5972 +
  1.5973  	  outputname=
  1.5974  	  if test "$fast_install" = no && test -n "$relink_command"; then
  1.5975  	    if test "$finalize" = yes && test -z "$run"; then
  1.5976 @@ -3527,6 +5699,7 @@
  1.5977  		$echo "$modename: error: cannot create temporary directory \`$tmpdir'" 1>&2
  1.5978  		continue
  1.5979  	      fi
  1.5980 +	      file=`$echo "X$file$stripped_ext" | $Xsed -e 's%^.*/%%'`
  1.5981  	      outputname="$tmpdir/$file"
  1.5982  	      # Replace the output file specification.
  1.5983  	      relink_command=`$echo "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'`
  1.5984 @@ -3544,10 +5717,27 @@
  1.5985  	    fi
  1.5986  	  else
  1.5987  	    # Install the binary that we compiled earlier.
  1.5988 -	    file=`$echo "X$file" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"`
  1.5989 +	    file=`$echo "X$file$stripped_ext" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"`
  1.5990  	  fi
  1.5991  	fi
  1.5992  
  1.5993 +	# remove .exe since cygwin /usr/bin/install will append another
  1.5994 +	# one anyways
  1.5995 +	case $install_prog,$host in
  1.5996 +	*/usr/bin/install*,*cygwin*)
  1.5997 +	  case $file:$destfile in
  1.5998 +	  *.exe:*.exe)
  1.5999 +	    # this is ok
  1.6000 +	    ;;
  1.6001 +	  *.exe:*)
  1.6002 +	    destfile=$destfile.exe
  1.6003 +	    ;;
  1.6004 +	  *:*.exe)
  1.6005 +	    destfile=`$echo $destfile | ${SED} -e 's,.exe$,,'`
  1.6006 +	    ;;
  1.6007 +	  esac
  1.6008 +	  ;;
  1.6009 +	esac
  1.6010  	$show "$install_prog$stripme $file $destfile"
  1.6011  	$run eval "$install_prog\$stripme \$file \$destfile" || exit $?
  1.6012  	test -n "$outputname" && ${rm}r "$tmpdir"
  1.6013 @@ -3564,9 +5754,14 @@
  1.6014        $show "$install_prog $file $oldlib"
  1.6015        $run eval "$install_prog \$file \$oldlib" || exit $?
  1.6016  
  1.6017 +      if test -n "$stripme" && test -n "$striplib"; then
  1.6018 +	$show "$old_striplib $oldlib"
  1.6019 +	$run eval "$old_striplib $oldlib" || exit $?
  1.6020 +      fi
  1.6021 +
  1.6022        # Do each command in the postinstall commands.
  1.6023        eval cmds=\"$old_postinstall_cmds\"
  1.6024 -      IFS="${IFS= 	}"; save_ifs="$IFS"; IFS='~'
  1.6025 +      save_ifs="$IFS"; IFS='~'
  1.6026        for cmd in $cmds; do
  1.6027  	IFS="$save_ifs"
  1.6028  	$show "$cmd"
  1.6029 @@ -3582,11 +5777,10 @@
  1.6030      if test -n "$current_libdirs"; then
  1.6031        # Maybe just do a dry run.
  1.6032        test -n "$run" && current_libdirs=" -n$current_libdirs"
  1.6033 -      exec $SHELL $0 --finish$current_libdirs
  1.6034 -      exit 1
  1.6035 +      exec_cmd='$SHELL $0 --finish$current_libdirs'
  1.6036 +    else
  1.6037 +      exit 0
  1.6038      fi
  1.6039 -
  1.6040 -    exit 0
  1.6041      ;;
  1.6042  
  1.6043    # libtool finish mode
  1.6044 @@ -3605,7 +5799,7 @@
  1.6045  	if test -n "$finish_cmds"; then
  1.6046  	  # Do each command in the finish commands.
  1.6047  	  eval cmds=\"$finish_cmds\"
  1.6048 -	  IFS="${IFS= 	}"; save_ifs="$IFS"; IFS='~'
  1.6049 +	  save_ifs="$IFS"; IFS='~'
  1.6050  	  for cmd in $cmds; do
  1.6051  	    IFS="$save_ifs"
  1.6052  	    $show "$cmd"
  1.6053 @@ -3626,40 +5820,40 @@
  1.6054      # Exit here if they wanted silent mode.
  1.6055      test "$show" = : && exit 0
  1.6056  
  1.6057 -    echo "----------------------------------------------------------------------"
  1.6058 -    echo "Libraries have been installed in:"
  1.6059 +    $echo "----------------------------------------------------------------------"
  1.6060 +    $echo "Libraries have been installed in:"
  1.6061      for libdir in $libdirs; do
  1.6062 -      echo "   $libdir"
  1.6063 +      $echo "   $libdir"
  1.6064      done
  1.6065 -    echo
  1.6066 -    echo "If you ever happen to want to link against installed libraries"
  1.6067 -    echo "in a given directory, LIBDIR, you must either use libtool, and"
  1.6068 -    echo "specify the full pathname of the library, or use \`-LLIBDIR'"
  1.6069 -    echo "flag during linking and do at least one of the following:"
  1.6070 +    $echo
  1.6071 +    $echo "If you ever happen to want to link against installed libraries"
  1.6072 +    $echo "in a given directory, LIBDIR, you must either use libtool, and"
  1.6073 +    $echo "specify the full pathname of the library, or use the \`-LLIBDIR'"
  1.6074 +    $echo "flag during linking and do at least one of the following:"
  1.6075      if test -n "$shlibpath_var"; then
  1.6076 -      echo "   - add LIBDIR to the \`$shlibpath_var' environment variable"
  1.6077 -      echo "     during execution"
  1.6078 +      $echo "   - add LIBDIR to the \`$shlibpath_var' environment variable"
  1.6079 +      $echo "     during execution"
  1.6080      fi
  1.6081      if test -n "$runpath_var"; then
  1.6082 -      echo "   - add LIBDIR to the \`$runpath_var' environment variable"
  1.6083 -      echo "     during linking"
  1.6084 +      $echo "   - add LIBDIR to the \`$runpath_var' environment variable"
  1.6085 +      $echo "     during linking"
  1.6086      fi
  1.6087      if test -n "$hardcode_libdir_flag_spec"; then
  1.6088        libdir=LIBDIR
  1.6089        eval flag=\"$hardcode_libdir_flag_spec\"
  1.6090  
  1.6091 -      echo "   - use the \`$flag' linker flag"
  1.6092 +      $echo "   - use the \`$flag' linker flag"
  1.6093      fi
  1.6094      if test -n "$admincmds"; then
  1.6095 -      echo "   - have your system administrator run these commands:$admincmds"
  1.6096 +      $echo "   - have your system administrator run these commands:$admincmds"
  1.6097      fi
  1.6098      if test -f /etc/ld.so.conf; then
  1.6099 -      echo "   - have your system administrator add LIBDIR to \`/etc/ld.so.conf'"
  1.6100 +      $echo "   - have your system administrator add LIBDIR to \`/etc/ld.so.conf'"
  1.6101      fi
  1.6102 -    echo
  1.6103 -    echo "See any operating system documentation about shared libraries for"
  1.6104 -    echo "more information, such as the ld(1) and ld.so(8) manual pages."
  1.6105 -    echo "----------------------------------------------------------------------"
  1.6106 +    $echo
  1.6107 +    $echo "See any operating system documentation about shared libraries for"
  1.6108 +    $echo "more information, such as the ld(1) and ld.so(8) manual pages."
  1.6109 +    $echo "----------------------------------------------------------------------"
  1.6110      exit 0
  1.6111      ;;
  1.6112  
  1.6113 @@ -3684,10 +5878,10 @@
  1.6114        fi
  1.6115  
  1.6116        dir=
  1.6117 -      case "$file" in
  1.6118 +      case $file in
  1.6119        *.la)
  1.6120  	# Check to see that this really is a libtool archive.
  1.6121 -	if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
  1.6122 +	if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
  1.6123  	else
  1.6124  	  $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
  1.6125  	  $echo "$help" 1>&2
  1.6126 @@ -3699,7 +5893,7 @@
  1.6127  	library_names=
  1.6128  
  1.6129  	# If there is no directory component, then add one.
  1.6130 -	case "$file" in
  1.6131 +	case $file in
  1.6132  	*/* | *\\*) . $file ;;
  1.6133  	*) . ./$file ;;
  1.6134  	esac
  1.6135 @@ -3754,13 +5948,13 @@
  1.6136      args=
  1.6137      for file
  1.6138      do
  1.6139 -      case "$file" in
  1.6140 +      case $file in
  1.6141        -*) ;;
  1.6142        *)
  1.6143  	# Do a test to see if this is really a libtool program.
  1.6144 -	if (sed -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
  1.6145 +	if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
  1.6146  	  # If there is no directory component, then add one.
  1.6147 -	  case "$file" in
  1.6148 +	  case $file in
  1.6149  	  */* | *\\*) . $file ;;
  1.6150  	  *) . ./$file ;;
  1.6151  	  esac
  1.6152 @@ -3777,11 +5971,11 @@
  1.6153  
  1.6154      if test -z "$run"; then
  1.6155        if test -n "$shlibpath_var"; then
  1.6156 -        # Export the shlibpath_var.
  1.6157 -        eval "export $shlibpath_var"
  1.6158 +	# Export the shlibpath_var.
  1.6159 +	eval "export $shlibpath_var"
  1.6160        fi
  1.6161  
  1.6162 -      # Restore saved enviroment variables
  1.6163 +      # Restore saved environment variables
  1.6164        if test "${save_LC_ALL+set}" = set; then
  1.6165  	LC_ALL="$save_LC_ALL"; export LC_ALL
  1.6166        fi
  1.6167 @@ -3789,31 +5983,35 @@
  1.6168  	LANG="$save_LANG"; export LANG
  1.6169        fi
  1.6170  
  1.6171 -      # Now actually exec the command.
  1.6172 -      eval "exec \$cmd$args"
  1.6173 -
  1.6174 -      $echo "$modename: cannot exec \$cmd$args"
  1.6175 -      exit 1
  1.6176 +      # Now prepare to actually exec the command.
  1.6177 +      exec_cmd="\$cmd$args"
  1.6178      else
  1.6179        # Display what would be done.
  1.6180        if test -n "$shlibpath_var"; then
  1.6181 -        eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\""
  1.6182 -        $echo "export $shlibpath_var"
  1.6183 +	eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\""
  1.6184 +	$echo "export $shlibpath_var"
  1.6185        fi
  1.6186        $echo "$cmd$args"
  1.6187        exit 0
  1.6188      fi
  1.6189      ;;
  1.6190  
  1.6191 -  # libtool uninstall mode
  1.6192 -  uninstall)
  1.6193 -    modename="$modename: uninstall"
  1.6194 +  # libtool clean and uninstall mode
  1.6195 +  clean | uninstall)
  1.6196 +    modename="$modename: $mode"
  1.6197      rm="$nonopt"
  1.6198      files=
  1.6199 +    rmforce=
  1.6200 +    exit_status=0
  1.6201 +
  1.6202 +    # This variable tells wrapper scripts just to set variables rather
  1.6203 +    # than running their programs.
  1.6204 +    libtool_install_magic="$magic"
  1.6205  
  1.6206      for arg
  1.6207      do
  1.6208 -      case "$arg" in
  1.6209 +      case $arg in
  1.6210 +      -f) rm="$rm $arg"; rmforce=yes ;;
  1.6211        -*) rm="$rm $arg" ;;
  1.6212        *) files="$files $arg" ;;
  1.6213        esac
  1.6214 @@ -3825,72 +6023,155 @@
  1.6215        exit 1
  1.6216      fi
  1.6217  
  1.6218 +    rmdirs=
  1.6219 +
  1.6220 +    origobjdir="$objdir"
  1.6221      for file in $files; do
  1.6222        dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
  1.6223 -      test "X$dir" = "X$file" && dir=.
  1.6224 +      if test "X$dir" = "X$file"; then
  1.6225 +	dir=.
  1.6226 +	objdir="$origobjdir"
  1.6227 +      else
  1.6228 +	objdir="$dir/$origobjdir"
  1.6229 +      fi
  1.6230        name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
  1.6231 +      test "$mode" = uninstall && objdir="$dir"
  1.6232 +
  1.6233 +      # Remember objdir for removal later, being careful to avoid duplicates
  1.6234 +      if test "$mode" = clean; then
  1.6235 +	case " $rmdirs " in
  1.6236 +	  *" $objdir "*) ;;
  1.6237 +	  *) rmdirs="$rmdirs $objdir" ;;
  1.6238 +	esac
  1.6239 +      fi
  1.6240 +
  1.6241 +      # Don't error if the file doesn't exist and rm -f was used.
  1.6242 +      if (test -L "$file") >/dev/null 2>&1 \
  1.6243 +	|| (test -h "$file") >/dev/null 2>&1 \
  1.6244 +	|| test -f "$file"; then
  1.6245 +	:
  1.6246 +      elif test -d "$file"; then
  1.6247 +	exit_status=1
  1.6248 +	continue
  1.6249 +      elif test "$rmforce" = yes; then
  1.6250 +	continue
  1.6251 +      fi
  1.6252  
  1.6253        rmfiles="$file"
  1.6254  
  1.6255 -      case "$name" in
  1.6256 +      case $name in
  1.6257        *.la)
  1.6258  	# Possibly a libtool archive, so verify it.
  1.6259 -	if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
  1.6260 +	if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
  1.6261  	  . $dir/$name
  1.6262  
  1.6263  	  # Delete the libtool libraries and symlinks.
  1.6264  	  for n in $library_names; do
  1.6265 -	    rmfiles="$rmfiles $dir/$n"
  1.6266 +	    rmfiles="$rmfiles $objdir/$n"
  1.6267  	  done
  1.6268 -	  test -n "$old_library" && rmfiles="$rmfiles $dir/$old_library"
  1.6269 -
  1.6270 -	  $show "$rm $rmfiles"
  1.6271 -	  $run $rm $rmfiles
  1.6272 -
  1.6273 -	  if test -n "$library_names"; then
  1.6274 -	    # Do each command in the postuninstall commands.
  1.6275 -	    eval cmds=\"$postuninstall_cmds\"
  1.6276 -	    IFS="${IFS= 	}"; save_ifs="$IFS"; IFS='~'
  1.6277 -	    for cmd in $cmds; do
  1.6278 +	  test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library"
  1.6279 +	  test "$mode" = clean && rmfiles="$rmfiles $objdir/$name $objdir/${name}i"
  1.6280 +
  1.6281 +	  if test "$mode" = uninstall; then
  1.6282 +	    if test -n "$library_names"; then
  1.6283 +	      # Do each command in the postuninstall commands.
  1.6284 +	      eval cmds=\"$postuninstall_cmds\"
  1.6285 +	      save_ifs="$IFS"; IFS='~'
  1.6286 +	      for cmd in $cmds; do
  1.6287 +		IFS="$save_ifs"
  1.6288 +		$show "$cmd"
  1.6289 +		$run eval "$cmd"
  1.6290 +		if test "$?" -ne 0 && test "$rmforce" != yes; then
  1.6291 +		  exit_status=1
  1.6292 +		fi
  1.6293 +	      done
  1.6294  	      IFS="$save_ifs"
  1.6295 -	      $show "$cmd"
  1.6296 -	      $run eval "$cmd"
  1.6297 -	    done
  1.6298 -	    IFS="$save_ifs"
  1.6299 +	    fi
  1.6300 +
  1.6301 +	    if test -n "$old_library"; then
  1.6302 +	      # Do each command in the old_postuninstall commands.
  1.6303 +	      eval cmds=\"$old_postuninstall_cmds\"
  1.6304 +	      save_ifs="$IFS"; IFS='~'
  1.6305 +	      for cmd in $cmds; do
  1.6306 +		IFS="$save_ifs"
  1.6307 +		$show "$cmd"
  1.6308 +		$run eval "$cmd"
  1.6309 +		if test "$?" -ne 0 && test "$rmforce" != yes; then
  1.6310 +		  exit_status=1
  1.6311 +		fi
  1.6312 +	      done
  1.6313 +	      IFS="$save_ifs"
  1.6314 +	    fi
  1.6315 +	    # FIXME: should reinstall the best remaining shared library.
  1.6316  	  fi
  1.6317 -
  1.6318 -	  if test -n "$old_library"; then
  1.6319 -	    # Do each command in the old_postuninstall commands.
  1.6320 -	    eval cmds=\"$old_postuninstall_cmds\"
  1.6321 -	    IFS="${IFS= 	}"; save_ifs="$IFS"; IFS='~'
  1.6322 -	    for cmd in $cmds; do
  1.6323 -	      IFS="$save_ifs"
  1.6324 -	      $show "$cmd"
  1.6325 -	      $run eval "$cmd"
  1.6326 -	    done
  1.6327 -	    IFS="$save_ifs"
  1.6328 -	  fi
  1.6329 -
  1.6330 -	  # FIXME: should reinstall the best remaining shared library.
  1.6331  	fi
  1.6332  	;;
  1.6333  
  1.6334        *.lo)
  1.6335 -	if test "$build_old_libs" = yes; then
  1.6336 -	  oldobj=`$echo "X$name" | $Xsed -e "$lo2o"`
  1.6337 -	  rmfiles="$rmfiles $dir/$oldobj"
  1.6338 +	# Possibly a libtool object, so verify it.
  1.6339 +	if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
  1.6340 +
  1.6341 +	  # Read the .lo file
  1.6342 +	  . $dir/$name
  1.6343 +
  1.6344 +	  # Add PIC object to the list of files to remove.
  1.6345 +	  if test -n "$pic_object" \
  1.6346 +	     && test "$pic_object" != none; then
  1.6347 +	    rmfiles="$rmfiles $dir/$pic_object"
  1.6348 +	  fi
  1.6349 +
  1.6350 +	  # Add non-PIC object to the list of files to remove.
  1.6351 +	  if test -n "$non_pic_object" \
  1.6352 +	     && test "$non_pic_object" != none; then
  1.6353 +	    rmfiles="$rmfiles $dir/$non_pic_object"
  1.6354 +	  fi
  1.6355  	fi
  1.6356 -	$show "$rm $rmfiles"
  1.6357 -	$run $rm $rmfiles
  1.6358  	;;
  1.6359  
  1.6360        *)
  1.6361 -	$show "$rm $rmfiles"
  1.6362 -	$run $rm $rmfiles
  1.6363 +	if test "$mode" = clean ; then
  1.6364 +	  noexename=$name
  1.6365 +	  case $file in
  1.6366 +	  *.exe) 
  1.6367 +	    file=`$echo $file|${SED} 's,.exe$,,'`
  1.6368 +	    noexename=`$echo $name|${SED} 's,.exe$,,'`
  1.6369 +	    # $file with .exe has already been added to rmfiles,
  1.6370 +	    # add $file without .exe
  1.6371 +	    rmfiles="$rmfiles $file"
  1.6372 +	    ;;
  1.6373 +	  esac
  1.6374 +	  # Do a test to see if this is a libtool program.
  1.6375 +	  if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
  1.6376 +	    relink_command=
  1.6377 +	    . $dir/$noexename
  1.6378 +
  1.6379 +	    # note $name still contains .exe if it was in $file originally
  1.6380 +	    # as does the version of $file that was added into $rmfiles
  1.6381 +	    rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}"
  1.6382 +	    if test "$fast_install" = yes && test -n "$relink_command"; then
  1.6383 +	      rmfiles="$rmfiles $objdir/lt-$name"
  1.6384 +	    fi
  1.6385 +	    if test "X$noexename" != "X$name" ; then
  1.6386 +	      rmfiles="$rmfiles $objdir/lt-${noexename}.c"
  1.6387 +	    fi
  1.6388 +	  fi
  1.6389 +	fi
  1.6390  	;;
  1.6391        esac
  1.6392 +      $show "$rm $rmfiles"
  1.6393 +      $run $rm $rmfiles || exit_status=1
  1.6394      done
  1.6395 -    exit 0
  1.6396 +    objdir="$origobjdir"
  1.6397 +
  1.6398 +    # Try to remove the ${objdir}s in the directories where we deleted files
  1.6399 +    for dir in $rmdirs; do
  1.6400 +      if test -d "$dir"; then
  1.6401 +	$show "rmdir $dir"
  1.6402 +	$run rmdir $dir >/dev/null 2>&1
  1.6403 +      fi
  1.6404 +    done
  1.6405 +
  1.6406 +    exit $exit_status
  1.6407      ;;
  1.6408  
  1.6409    "")
  1.6410 @@ -3900,13 +6181,20 @@
  1.6411      ;;
  1.6412    esac
  1.6413  
  1.6414 -  $echo "$modename: invalid operation mode \`$mode'" 1>&2
  1.6415 -  $echo "$generic_help" 1>&2
  1.6416 +  if test -z "$exec_cmd"; then
  1.6417 +    $echo "$modename: invalid operation mode \`$mode'" 1>&2
  1.6418 +    $echo "$generic_help" 1>&2
  1.6419 +    exit 1
  1.6420 +  fi
  1.6421 +fi # test -z "$show_help"
  1.6422 +
  1.6423 +if test -n "$exec_cmd"; then
  1.6424 +  eval exec $exec_cmd
  1.6425    exit 1
  1.6426 -fi # test -z "$show_help"
  1.6427 +fi
  1.6428  
  1.6429  # We need to display help for each of the modes.
  1.6430 -case "$mode" in
  1.6431 +case $mode in
  1.6432  "") $echo \
  1.6433  "Usage: $modename [OPTION]... [MODE-ARG]...
  1.6434  
  1.6435 @@ -3921,10 +6209,12 @@
  1.6436      --mode=MODE       use operation mode MODE [default=inferred from MODE-ARGS]
  1.6437      --quiet           same as \`--silent'
  1.6438      --silent          don't print informational messages
  1.6439 +    --tag=TAG         use configuration variables from tag TAG
  1.6440      --version         print version information
  1.6441  
  1.6442  MODE must be one of the following:
  1.6443  
  1.6444 +      clean           remove files from the build directory
  1.6445        compile         compile a source file into a libtool object
  1.6446        execute         automatically set library path, then run a program
  1.6447        finish          complete the installation of libtool libraries
  1.6448 @@ -3933,10 +6223,26 @@
  1.6449        uninstall       remove libraries from an installed directory
  1.6450  
  1.6451  MODE-ARGS vary depending on the MODE.  Try \`$modename --help --mode=MODE' for
  1.6452 -a more detailed description of MODE."
  1.6453 +a more detailed description of MODE.
  1.6454 +
  1.6455 +Report bugs to <bug-libtool@gnu.org>."
  1.6456    exit 0
  1.6457    ;;
  1.6458  
  1.6459 +clean)
  1.6460 +  $echo \
  1.6461 +"Usage: $modename [OPTION]... --mode=clean RM [RM-OPTION]... FILE...
  1.6462 +
  1.6463 +Remove files from the build directory.
  1.6464 +
  1.6465 +RM is the name of the program to use to delete files associated with each FILE
  1.6466 +(typically \`/bin/rm').  RM-OPTIONS are options (such as \`-f') to be passed
  1.6467 +to RM.
  1.6468 +
  1.6469 +If FILE is a libtool library, object or program, all the files associated
  1.6470 +with it are deleted. Otherwise, only FILE itself is deleted using RM."
  1.6471 +  ;;
  1.6472 +
  1.6473  compile)
  1.6474    $echo \
  1.6475  "Usage: $modename [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE
  1.6476 @@ -3946,6 +6252,8 @@
  1.6477  This mode accepts the following additional options:
  1.6478  
  1.6479    -o OUTPUT-FILE    set the output file name to OUTPUT-FILE
  1.6480 +  -prefer-pic       try to building PIC objects only
  1.6481 +  -prefer-non-pic   try to building non-PIC objects only
  1.6482    -static           always build a \`.o' file suitable for static linking
  1.6483  
  1.6484  COMPILE-COMMAND is a command to be used in creating a \`standard' object file
  1.6485 @@ -4025,8 +6333,11 @@
  1.6486    -LLIBDIR          search LIBDIR for required installed libraries
  1.6487    -lNAME            OUTPUT-FILE requires the installed library libNAME
  1.6488    -module           build a library that can dlopened
  1.6489 +  -no-fast-install  disable the fast-install mode
  1.6490 +  -no-install       link a not-installable executable
  1.6491    -no-undefined     declare that a library does not refer to external symbols
  1.6492    -o OUTPUT-FILE    create OUTPUT-FILE from the specified objects
  1.6493 +  -objectlist FILE  Use a list of object files found in FILE to specify objects
  1.6494    -release RELEASE  specify package release information
  1.6495    -rpath LIBDIR     the created library will eventually be installed in LIBDIR
  1.6496    -R[ ]LIBDIR       add LIBDIR to the runtime path of programs and libraries
  1.6497 @@ -4072,11 +6383,31 @@
  1.6498    ;;
  1.6499  esac
  1.6500  
  1.6501 -echo
  1.6502 +$echo
  1.6503  $echo "Try \`$modename --help' for more information about other modes."
  1.6504  
  1.6505  exit 0
  1.6506  
  1.6507 +# The TAGs below are defined such that we never get into a situation
  1.6508 +# in which we disable both kinds of libraries.  Given conflicting
  1.6509 +# choices, we go for a static library, that is the most portable,
  1.6510 +# since we can't tell whether shared libraries were disabled because
  1.6511 +# the user asked for that or because the platform doesn't support
  1.6512 +# them.  This is particularly important on AIX, because we don't
  1.6513 +# support having both static and shared libraries enabled at the same
  1.6514 +# time on that platform, so we default to a shared-only configuration.
  1.6515 +# If a disable-shared tag is given, we'll fallback to a static-only
  1.6516 +# configuration.  But we'll never go from static-only to shared-only.
  1.6517 +
  1.6518 +# ### BEGIN LIBTOOL TAG CONFIG: disable-shared
  1.6519 +build_libtool_libs=no
  1.6520 +build_old_libs=yes
  1.6521 +# ### END LIBTOOL TAG CONFIG: disable-shared
  1.6522 +
  1.6523 +# ### BEGIN LIBTOOL TAG CONFIG: disable-static
  1.6524 +build_old_libs=`case $build_libtool_libs in yes) $echo no;; *) $echo yes;; esac`
  1.6525 +# ### END LIBTOOL TAG CONFIG: disable-static
  1.6526 +
  1.6527  # Local Variables:
  1.6528  # mode:shell-script
  1.6529  # sh-indentation:2