Index: trunk/psLib/ltmain.sh
===================================================================
--- trunk/psLib/ltmain.sh	(revision 3123)
+++ trunk/psLib/ltmain.sh	(revision 3199)
@@ -2,5 +2,5 @@
 # NOTE: Changing this file will not affect anything until you rerun configure.
 #
-# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004
+# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003
 # Free Software Foundation, Inc.
 # Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
@@ -25,32 +25,4 @@
 # the same distribution terms that you use for the rest of that program.
 
-basename="s,^.*/,,g"
-
-# Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh
-# is ksh but when the shell is invoked as "sh" and the current value of
-# the _XPG environment variable is not equal to 1 (one), the special
-# positional parameter $0, within a function call, is the name of the
-# function.
-progpath="$0"
-
-# The name of this program:
-progname=`echo "$progpath" | $SED $basename`
-modename="$progname"
-
-# Global variables:
-EXIT_SUCCESS=0
-EXIT_FAILURE=1
-
-PROGRAM=ltmain.sh
-PACKAGE=libtool
-VERSION=1.5.8
-TIMESTAMP=" (1.1220.2.118 2004/08/07 12:24:38)"
-
-# See if we are running on zsh, and set the options which allow our
-# commands through without removal of \ escapes.
-if test -n "${ZSH_VERSION+set}" ; then
-  setopt NO_GLOB_SUBST
-fi
-
 # Check that we have a working $echo.
 if test "X$1" = X--no-reexec; then
@@ -65,5 +37,5 @@
 else
   # Restart under the correct shell, and then maybe $echo will work.
-  exec $SHELL "$progpath" --no-reexec ${1+"$@"}
+  exec $SHELL "$0" --no-reexec ${1+"$@"}
 fi
 
@@ -74,6 +46,16 @@
 $*
 EOF
-  exit $EXIT_SUCCESS
+  exit 0
 fi
+
+# The name of this program.
+progname=`$echo "$0" | ${SED} 's%^.*/%%'`
+modename="$progname"
+
+# Constants.
+PROGRAM=ltmain.sh
+PACKAGE=libtool
+VERSION=1.5
+TIMESTAMP=" (1.1220 2003/04/05 19:32:58)"
 
 default_mode=
@@ -89,6 +71,6 @@
 sed_quote_subst='s/\([\\`\\"$\\\\]\)/\\\1/g'
 # test EBCDIC or ASCII
-case `echo A|tr A '\301'` in
- A) # EBCDIC based system
+case `echo A|od -x` in
+ *[Cc]1*) # EBCDIC based system
   SP2NL="tr '\100' '\n'"
   NL2SP="tr '\r\n' '\100\100'"
@@ -113,11 +95,10 @@
 
 # Make sure IFS has a sensible default
-: ${IFS=" 	
-"}
+: ${IFS=" 	"}
 
 if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
   $echo "$modename: not configured to build any kind of library" 1>&2
   $echo "Fatal configuration error.  See the $PACKAGE docs for more information." 1>&2
-  exit $EXIT_FAILURE
+  exit 1
 fi
 
@@ -138,11 +119,8 @@
 # This seems to be the best place for them
 
-# func_win32_libid arg
-# return the library type of file 'arg'
-#
 # Need a lot of goo to handle *both* DLLs and import libs
 # Has to be a shell function in order to 'eat' the argument
 # that is supplied when $file_magic_command is called.
-func_win32_libid () {
+win32_libid () {
   win32_libid_type="unknown"
   win32_fileres=`file -L $1 2>/dev/null`
@@ -153,5 +131,5 @@
   *ar\ archive*) # could be an import, or static
     if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | \
-      $EGREP -e 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then
+      grep -E 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then
       win32_nmres=`eval $NM -f posix -A $1 | \
 	sed -n -e '1,100{/ I /{x;/import/!{s/^/import/;h;p;};x;};}'`
@@ -163,5 +141,5 @@
     fi
     ;;
-  *DLL*)
+  *DLL*) 
     win32_libid_type="x86 DLL"
     ;;
@@ -177,189 +155,6 @@
 }
 
-
-# func_infer_tag arg
-# Infer tagged configuration to use if any are available and
-# if one wasn't chosen via the "--tag" command line option.
-# Only attempt this if the compiler in the base compile
-# command doesn't match the default compiler.
-# arg is usually of the form 'gcc ...'
-func_infer_tag () {
-    if test -n "$available_tags" && test -z "$tagname"; then
-      CC_quoted=
-      for arg in $CC; do
-	case $arg in
-	  *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
-	  arg="\"$arg\""
-	  ;;
-	esac
-	CC_quoted="$CC_quoted $arg"
-      done
-      case $@ in
-      # Blanks in the command may have been stripped by the calling shell,
-      # but not from the CC environment variable when configure was run.
-      " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*) ;;
-      # Blanks at the start of $base_compile will cause this to fail
-      # if we don't check for them as well.
-      *)
-	for z in $available_tags; do
-	  if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then
-	    # Evaluate the configuration.
-	    eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`"
-	    CC_quoted=
-	    for arg in $CC; do
-	    # Double-quote args containing other shell metacharacters.
-	    case $arg in
-	      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
-	      arg="\"$arg\""
-	      ;;
-	    esac
-	    CC_quoted="$CC_quoted $arg"
-	  done
-	    case "$@ " in
-	      " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*)
-	      # The compiler in the base compile command matches
-	      # the one in the tagged configuration.
-	      # Assume this is the tagged configuration we want.
-	      tagname=$z
-	      break
-	      ;;
-	    esac
-	  fi
-	done
-	# If $tagname still isn't set, then no tagged configuration
-	# was found and let the user know that the "--tag" command
-	# line option must be used.
-	if test -z "$tagname"; then
-	  $echo "$modename: unable to infer tagged configuration"
-	  $echo "$modename: specify a tag with \`--tag'" 1>&2
-	  exit $EXIT_FAILURE
-#        else
-#          $echo "$modename: using $tagname tagged configuration"
-	fi
-	;;
-      esac
-    fi
-}
-
-
-# func_extract_archives gentop oldlib ...
-func_extract_archives () {
-    my_gentop="$1"; shift
-    my_oldlibs=${1+"$@"}
-    my_oldobjs=""
-    my_xlib=""
-    my_xabs=""
-    my_xdir=""
-    my_status=""
-
-    $show "${rm}r $my_gentop"
-    $run ${rm}r "$my_gentop"
-    $show "$mkdir $my_gentop"
-    $run $mkdir "$my_gentop"
-    my_status=$?
-    if test "$my_status" -ne 0 && test ! -d "$my_gentop"; then
-      exit $my_status
-    fi
-
-    for my_xlib in $my_oldlibs; do
-      # Extract the objects.
-      case $my_xlib in
-	[\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;;
-	*) my_xabs=`pwd`"/$my_xlib" ;;
-      esac
-      my_xlib=`$echo "X$my_xlib" | $Xsed -e 's%^.*/%%'`
-      my_xdir="$my_gentop/$my_xlib"
-
-      $show "${rm}r $my_xdir"
-      $run ${rm}r "$my_xdir"
-      $show "$mkdir $my_xdir"
-      $run $mkdir "$my_xdir"
-      status=$?
-      if test "$status" -ne 0 && test ! -d "$my_xdir"; then
-	exit $status
-      fi
-      case $host in
-      *-darwin*)
-	$show "Extracting $my_xabs"
-	# Do not bother doing anything if just a dry run
-	if test -z "$run"; then
-	  darwin_orig_dir=`pwd`
-	  cd $my_xdir || exit $?
-	  darwin_archive=$my_xabs
-	  darwin_curdir=`pwd`
-	  darwin_base_archive=`basename $darwin_archive`
-	  darwin_arches=`lipo -info "$darwin_archive" 2>/dev/null | $EGREP Architectures 2>/dev/null`
-	  if test -n "$darwin_arches"; then 
-	    darwin_arches=`echo "$darwin_arches" | $SED -e 's/.*are://'`
-	    darwin_arch=
-	    $show "$darwin_base_archive has multiple architectures $darwin_arches"
-	    for darwin_arch in  $darwin_arches ; do
-	      mkdir -p "unfat-$$/${darwin_base_archive}-${darwin_arch}"
-	      lipo -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}"
-	      # Remove the table of contents from the thin files.
-	      $AR -d "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" __.SYMDEF 2>/dev/null || true
-	      $AR -d "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" __.SYMDEF\ SORTED 2>/dev/null || true
-	      cd "unfat-$$/${darwin_base_archive}-${darwin_arch}"
-	      $AR -xo "${darwin_base_archive}"
-	      rm "${darwin_base_archive}"
-	      cd "$darwin_curdir"
-	    done # $darwin_arches
-      ## Okay now we have a bunch of thin objects, gotta fatten them up :)
-	    darwin_filelist=`find unfat-$$ -type f | xargs basename | sort -u | $NL2SP`
-	    darwin_file=
-	    darwin_files=
-	    for darwin_file in $darwin_filelist; do
-	      darwin_files=`find unfat-$$ -name $darwin_file -print | $NL2SP`
-	      lipo -create -output "$darwin_file" $darwin_files
-	    done # $darwin_filelist
-	    rm -rf unfat-$$
-	    cd "$darwin_orig_dir"
-	  else
-	    cd $darwin_orig_dir
-	    (cd $my_xdir && $AR x $my_xabs) || exit $?
-	  fi # $darwin_arches
-	fi # $run
-      ;;
-      *)
-	# We will extract separately just the conflicting names and we will
-	# no longer touch any unique names. It is faster to leave these
-	# extract automatically by $AR in one run.
-	$show "(cd $my_xdir && $AR x $my_xabs)"
-	$run eval "(cd \$my_xdir && $AR x \$my_xabs)" || exit $?
-	if ($AR t "$my_xabs" | sort | sort -uc >/dev/null 2>&1); then
-	  :
-	else
-	  $echo "$modename: warning: object name conflicts; renaming object files" 1>&2
-	  $echo "$modename: warning: to ensure that they will not overwrite" 1>&2
-	  $AR t "$my_xabs" | sort | uniq -cd | while read -r count name
-	  do
-	    i=1
-	    while test "$i" -le "$count"
-	    do
-	      # Put our $i before any first dot (extension)
-	      # Never overwrite any file
-	      name_to="$name"
-	      while test "X$name_to" = "X$name" || test -f "$my_xdir/$name_to"
-	      do
-		name_to=`$echo "X$name_to" | $Xsed -e "s/\([^.]*\)/\1-$i/"`
-	      done
-	      $show "(cd $my_xdir && $AR xN $i $my_xabs '$name' && $mv '$name' '$name_to')"
-	      $run eval "(cd \$my_xdir && $AR xN $i \$my_xabs '$name' && $mv '$name' '$name_to')" || exit $?
-	      i=`expr $i + 1`
-	    done
-	  done
-	fi
-	;;
-      esac
-      my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP`
-    done
-
-    func_extract_archives_result="$my_oldobjs"
-}
 # End of Shell function definitions
 #####################################
-
-# Darwin sucks
-eval std_shrext=\"$shrext_cmds\"
 
 # Parse our command line options once, thoroughly.
@@ -382,5 +177,4 @@
     tag)
       tagname="$arg"
-      preserve_args="${preserve_args}=$arg"
 
       # Check whether tagname contains only valid characters
@@ -388,5 +182,5 @@
       *[!-_A-Za-z0-9,/]*)
 	$echo "$progname: invalid tag name: $tagname" 1>&2
-	exit $EXIT_FAILURE
+	exit 1
 	;;
       esac
@@ -398,8 +192,8 @@
 	;;
       *)
-	if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "$progpath" > /dev/null; then
+	if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "$0" > /dev/null; then
 	  taglist="$taglist $tagname"
 	  # Evaluate the configuration.
-	  eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$tagname'$/,/^# ### END LIBTOOL TAG CONFIG: '$tagname'$/p' < $progpath`"
+	  eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$tagname'$/,/^# ### END LIBTOOL TAG CONFIG: '$tagname'$/p' < $0`"
 	else
 	  $echo "$progname: ignoring unknown tag $tagname" 1>&2
@@ -430,14 +224,14 @@
     $echo "This is free software; see the source for copying conditions.  There is NO"
     $echo "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
-    exit $EXIT_SUCCESS
+    exit 0
     ;;
 
   --config)
-    ${SED} -e '1,/^# ### BEGIN LIBTOOL CONFIG/d' -e '/^# ### END LIBTOOL CONFIG/,$d' $progpath
+    ${SED} -e '1,/^# ### BEGIN LIBTOOL CONFIG/d' -e '/^# ### END LIBTOOL CONFIG/,$d' $0
     # Now print the configurations for the tags.
     for tagname in $taglist; do
-      ${SED} -n -e "/^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$/,/^# ### END LIBTOOL TAG CONFIG: $tagname$/p" < "$progpath"
+      ${SED} -n -e "/^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$/,/^# ### END LIBTOOL TAG CONFIG: $tagname$/p" < "$0"
     done
-    exit $EXIT_SUCCESS
+    exit 0
     ;;
 
@@ -445,5 +239,4 @@
     $echo "$progname: enabling shell trace mode"
     set -x
-    preserve_args="$preserve_args $arg"
     ;;
 
@@ -464,5 +257,5 @@
       $echo "disable static libraries"
     fi
-    exit $EXIT_SUCCESS
+    exit 0
     ;;
 
@@ -476,5 +269,4 @@
   --quiet | --silent)
     show=:
-    preserve_args="$preserve_args $arg"
     ;;
 
@@ -484,5 +276,4 @@
     shift
     prev=tag
-    preserve_args="$preserve_args --tag"
     ;;
 
@@ -495,5 +286,5 @@
     $echo "$modename: unrecognized option \`$arg'" 1>&2
     $echo "$help" 1>&2
-    exit $EXIT_FAILURE
+    exit 1
     ;;
 
@@ -508,5 +299,5 @@
   $echo "$modename: option \`$prevopt' requires an argument" 1>&2
   $echo "$help" 1>&2
-  exit $EXIT_FAILURE
+  exit 1
 fi
 
@@ -517,4 +308,21 @@
 
 if test -z "$show_help"; then
+  archargs=
+  case $host in
+  *-*-darwin*)
+    # For darwin, separate arch arguments and apply them to all compile/link
+    # commands
+    doarch=
+    for arg; do
+      if test -n "$doarch"; then
+        archargs="$archargs -arch $arg"
+        doarch=
+        continue
+      fi
+      case $arg in
+      -arch) doarch=y;;
+      esac
+    done
+  esac
 
   # Infer the operation mode.
@@ -564,5 +372,5 @@
     $echo "$modename: unrecognized option \`-dlopen'" 1>&2
     $echo "$help" 1>&2
-    exit $EXIT_FAILURE
+    exit 1
   fi
 
@@ -579,9 +387,7 @@
     base_compile=
     srcfile="$nonopt"  #  always keep a non-empty value in "srcfile"
-    suppress_opt=yes
     suppress_output=
     arg_mode=normal
     libobj=
-    later=
 
     for arg
@@ -606,5 +412,5 @@
 	  if test -n "$libobj" ; then
 	    $echo "$modename: you cannot specify \`-o' more than once" 1>&2
-	    exit $EXIT_FAILURE
+	    exit 1
 	  fi
 	  arg_mode=target
@@ -612,11 +418,16 @@
 	  ;;
 
-	-static | -prefer-pic | -prefer-non-pic)
-	  later="$later $arg"
+	-static)
+	  build_old_libs=yes
 	  continue
 	  ;;
 
-	-no-suppress)
-	  suppress_opt=no
+	-prefer-pic)
+	  pic_mode=yes
+	  continue
+	  ;;
+
+	-prefer-non-pic)
+	  pic_mode=no
 	  continue
 	  ;;
@@ -631,5 +442,5 @@
 	  lastarg=
 	  save_ifs="$IFS"; IFS=','
- 	  for arg in $args; do
+	  for arg in $args; do
 	    IFS="$save_ifs"
 
@@ -681,9 +492,9 @@
     arg)
       $echo "$modename: you must specify an argument for -Xcompile"
-      exit $EXIT_FAILURE
+      exit 1
       ;;
     target)
       $echo "$modename: you must specify a target with \`-o'" 1>&2
-      exit $EXIT_FAILURE
+      exit 1
       ;;
     *)
@@ -718,28 +529,48 @@
     *)
       $echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2
-      exit $EXIT_FAILURE
+      exit 1
       ;;
     esac
 
-    func_infer_tag $base_compile
-
-    for arg in $later; do
-      case $arg in
-      -static)
-	build_old_libs=yes
-	continue
-	;;
-
-      -prefer-pic)
-	pic_mode=yes
-	continue
-	;;
-
-      -prefer-non-pic)
-	pic_mode=no
-	continue
+    # Infer tagged configuration to use if any are available and
+    # if one wasn't chosen via the "--tag" command line option.
+    # Only attempt this if the compiler in the base compile
+    # command doesn't match the default compiler.
+    if test -n "$available_tags" && test -z "$tagname"; then
+      case $base_compile in
+      # Blanks in the command may have been stripped by the calling shell,
+      # but not from the CC environment variable when configure was run.
+      " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "*) ;;
+      # Blanks at the start of $base_compile will cause this to fail
+      # if we don't check for them as well.
+      *)
+	for z in $available_tags; do
+	  if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$0" > /dev/null; then
+	    # Evaluate the configuration.
+	    eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $0`"
+	    case "$base_compile " in
+	    "$CC "* | " $CC "* | "`$echo $CC` "* | " `$echo $CC` "*)
+	      # The compiler in the base compile command matches
+	      # the one in the tagged configuration.
+	      # Assume this is the tagged configuration we want.
+	      tagname=$z
+	      break
+	      ;;
+	    esac
+	  fi
+	done
+	# If $tagname still isn't set, then no tagged configuration
+	# was found and let the user know that the "--tag" command
+	# line option must be used.
+	if test -z "$tagname"; then
+	  $echo "$modename: unable to infer tagged configuration"
+	  $echo "$modename: specify a tag with \`--tag'" 1>&2
+	  exit 1
+#        else
+#          $echo "$modename: using $tagname tagged configuration"
+	fi
 	;;
       esac
-    done
+    fi
 
     objname=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
@@ -755,5 +586,5 @@
       $echo "$modename: you must specify a compilation command" 1>&2
       $echo "$help" 1>&2
-      exit $EXIT_FAILURE
+      exit 1
     fi
 
@@ -766,5 +597,5 @@
 
     $run $rm $removelist
-    trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15
+    trap "$run $rm $removelist; exit 1" 1 2 15
 
     # On Cygwin there's no "real" PIC flag so we must build both object types
@@ -785,5 +616,5 @@
       lockfile="$output_obj.lock"
       removelist="$removelist $output_obj $lockfile"
-      trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15
+      trap "$run $rm $removelist; exit 1" 1 2 15
     else
       output_obj=
@@ -795,5 +626,5 @@
     # We use this script file to make the link, it avoids creating a new file
     if test "$need_locks" = yes; then
-      until $run ln "$progpath" "$lockfile" 2>/dev/null; do
+      until $run ln "$0" "$lockfile" 2>/dev/null; do
 	$show "Waiting for $lockfile to be removed"
 	sleep 2
@@ -813,5 +644,5 @@
 
 	$run $rm $removelist
-	exit $EXIT_FAILURE
+	exit 1
       fi
       $echo $srcfile > "$lockfile"
@@ -868,5 +699,5 @@
       else
 	test -n "$output_obj" && $run $rm $removelist
-	exit $EXIT_FAILURE
+	exit 1
       fi
 
@@ -888,5 +719,5 @@
 
 	$run $rm $removelist
-	exit $EXIT_FAILURE
+	exit 1
       fi
 
@@ -909,7 +740,5 @@
 
       # Allow error messages only from the first compilation.
-      if test "$suppress_opt" = yes; then
-        suppress_output=' >/dev/null 2>&1'
-      fi
+      suppress_output=' >/dev/null 2>&1'
     else
       # No PIC object so indicate it doesn't exist in the libtool
@@ -940,5 +769,5 @@
       else
 	$run $rm $removelist
-	exit $EXIT_FAILURE
+	exit 1
       fi
 
@@ -960,5 +789,5 @@
 
 	$run $rm $removelist
-	exit $EXIT_FAILURE
+	exit 1
       fi
 
@@ -998,5 +827,5 @@
     fi
 
-    exit $EXIT_SUCCESS
+    exit 0
     ;;
 
@@ -1024,5 +853,5 @@
     esac
     libtool_args="$nonopt"
-    base_compile="$nonopt $@"
+    base_compile="$nonopt"
     compile_command="$nonopt"
     finalize_command="$nonopt"
@@ -1056,5 +885,4 @@
     objs=
     non_pic_objects=
-    precious_files_regex=
     prefer_static_libs=no
     preload=no
@@ -1070,6 +898,4 @@
     vinfo_number=no
 
-    func_infer_tag $base_compile
-
     # We need to know -static, to get the right output filenames.
     for arg
@@ -1103,4 +929,5 @@
     while test "$#" -gt 0; do
       arg="$1"
+      base_compile="$base_compile $arg"
       shift
       case $arg in
@@ -1166,5 +993,5 @@
 	  if test ! -f "$arg"; then
 	    $echo "$modename: symbol file \`$arg' does not exist"
-	    exit $EXIT_FAILURE
+	    exit 1
 	  fi
 	  prev=
@@ -1178,9 +1005,4 @@
 	inst_prefix)
 	  inst_prefix_dir="$arg"
-	  prev=
-	  continue
-	  ;;
-	precious_regex)
-	  precious_files_regex="$arg"
 	  prev=
 	  continue
@@ -1218,5 +1040,5 @@
 		   test "$non_pic_object" = none; then
 		  $echo "$modename: cannot find name of object for \`$arg'" 1>&2
-		  exit $EXIT_FAILURE
+		  exit 1
 		fi
 
@@ -1271,5 +1093,5 @@
 		if test -z "$run"; then
 		  $echo "$modename: \`$arg' is not a valid libtool object" 1>&2
-		  exit $EXIT_FAILURE
+		  exit 1
 		else
 		  # Dry-run case.
@@ -1292,5 +1114,5 @@
 	  else
 	    $echo "$modename: link input file \`$save_arg' does not exist"
-	    exit $EXIT_FAILURE
+	    exit 1
 	  fi
 	  arg=$save_arg
@@ -1304,5 +1126,5 @@
 	  *)
 	    $echo "$modename: only absolute run-paths are allowed" 1>&2
-	    exit $EXIT_FAILURE
+	    exit 1
 	    ;;
 	  esac
@@ -1344,9 +1166,4 @@
 	  continue
 	  ;;
-	shrext)
-  	  shrext_cmds="$arg"
-	  prev=
-	  continue
-	  ;;
 	*)
 	  eval "$prev=\"\$arg\""
@@ -1397,5 +1214,5 @@
 	if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
 	  $echo "$modename: more than one -exported-symbols argument is not allowed"
-	  exit $EXIT_FAILURE
+	  exit 1
 	fi
 	if test "X$arg" = "X-export-symbols"; then
@@ -1433,5 +1250,5 @@
 	  if test -z "$absdir"; then
 	    $echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2
-	    exit $EXIT_FAILURE
+	    exit 1
 	  fi
 	  dir="$absdir"
@@ -1488,9 +1305,4 @@
 	;;
 
-     -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe)
-	deplibs="$deplibs $arg"
-	continue
-	;;
-
       -module)
 	module=yes
@@ -1557,9 +1369,4 @@
       -o) prev=output ;;
 
-      -precious-files-regex)
-	prev=precious_regex
-	continue
-	;;
-
       -release)
 	prev=release
@@ -1584,5 +1391,5 @@
 	*)
 	  $echo "$modename: only absolute run-paths are allowed" 1>&2
-	  exit $EXIT_FAILURE
+	  exit 1
 	  ;;
 	esac
@@ -1707,5 +1514,5 @@
 	     test "$non_pic_object" = none; then
 	    $echo "$modename: cannot find name of object for \`$arg'" 1>&2
-	    exit $EXIT_FAILURE
+	    exit 1
 	  fi
 
@@ -1760,5 +1567,5 @@
 	  if test -z "$run"; then
 	    $echo "$modename: \`$arg' is not a valid libtool object" 1>&2
-	    exit $EXIT_FAILURE
+	    exit 1
 	  else
 	    # Dry-run case.
@@ -1827,5 +1634,46 @@
       $echo "$modename: the \`$prevarg' option requires an argument" 1>&2
       $echo "$help" 1>&2
-      exit $EXIT_FAILURE
+      exit 1
+    fi
+
+    # Infer tagged configuration to use if any are available and
+    # if one wasn't chosen via the "--tag" command line option.
+    # Only attempt this if the compiler in the base link
+    # command doesn't match the default compiler.
+    if test -n "$available_tags" && test -z "$tagname"; then
+      case $base_compile in
+      # Blanks in the command may have been stripped by the calling shell,
+      # but not from the CC environment variable when configure was run.
+      "$CC "* | " $CC "* | "`$echo $CC` "* | " `$echo $CC` "*) ;;
+      # Blanks at the start of $base_compile will cause this to fail
+      # if we don't check for them as well.
+      *)
+	for z in $available_tags; do
+	  if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$0" > /dev/null; then
+	    # Evaluate the configuration.
+	    eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $0`"
+	    case $base_compile in
+	    "$CC "* | " $CC "* | "`$echo $CC` "* | " `$echo $CC` "*)
+	      # The compiler in $compile_command matches
+	      # the one in the tagged configuration.
+	      # Assume this is the tagged configuration we want.
+	      tagname=$z
+	      break
+	      ;;
+	    esac
+	  fi
+	done
+	# If $tagname still isn't set, then no tagged configuration
+	# was found and let the user know that the "--tag" command
+	# line option must be used.
+	if test -z "$tagname"; then
+	  $echo "$modename: unable to infer tagged configuration"
+	  $echo "$modename: specify a tag with \`--tag'" 1>&2
+	  exit 1
+#       else
+#         $echo "$modename: using $tagname tagged configuration"
+	fi
+	;;
+      esac
     fi
 
@@ -1871,5 +1719,5 @@
       $echo "$modename: you must specify an output file" 1>&2
       $echo "$help" 1>&2
-      exit $EXIT_FAILURE
+      exit 1
       ;;
     *.$libext) linkmode=oldlib ;;
@@ -1881,5 +1729,5 @@
     case $host in
     *cygwin* | *mingw* | *pw32*)
-      # don't eliminate duplications in $postdeps and $predeps
+      # don't eliminate duplcations in $postdeps and $predeps
       duplicate_compiler_generated_deps=yes
       ;;
@@ -1934,5 +1782,5 @@
 	  *)
 	    $echo "$modename: libraries can \`-dlopen' only libtool libraries: $file" 1>&2
-	    exit $EXIT_FAILURE
+	    exit 1
 	    ;;
 	  esac
@@ -1972,13 +1820,4 @@
 	found=no
 	case $deplib in
-	-mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe)
-	  if test "$linkmode,$pass" = "prog,link"; then
-	    compile_deplibs="$deplib $compile_deplibs"
-	    finalize_deplibs="$deplib $finalize_deplibs"
-	  else
-	    deplibs="$deplib $deplibs"
-	  fi
-	  continue
-	  ;;
 	-l*)
 	  if test "$linkmode" != lib && test "$linkmode" != prog; then
@@ -1992,16 +1831,10 @@
 	  name=`$echo "X$deplib" | $Xsed -e 's/^-l//'`
 	  for searchdir in $newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path; do
-	    for search_ext in .la $std_shrext .so .a; do
-	      # Search the libtool library
-	      lib="$searchdir/lib${name}${search_ext}"
-	      if test -f "$lib"; then
-		if test "$search_ext" = ".la"; then
-		  found=yes
-		else
-		  found=no
-		fi
-		break 2
-	      fi
-	    done
+	    # Search the libtool library
+	    lib="$searchdir/lib${name}.la"
+	    if test -f "$lib"; then
+	      found=yes
+	      break
+	    fi
 	  done
 	  if test "$found" != yes; then
@@ -2068,9 +1901,9 @@
 	    if test "$pass" = scan; then
 	      deplibs="$deplib $deplibs"
+	      newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
 	    else
 	      compile_deplibs="$deplib $compile_deplibs"
 	      finalize_deplibs="$deplib $finalize_deplibs"
 	    fi
-	    newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
 	    ;;
 	  *)
@@ -2100,20 +1933,5 @@
 	  case $linkmode in
 	  lib)
-	    valid_a_lib=no
-	    case $deplibs_check_method in
-	      match_pattern*)
-		set dummy $deplibs_check_method
-	        match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
-		if eval $echo \"$deplib\" 2>/dev/null \
-		    | $SED 10q \
-		    | $EGREP "$match_pattern_regex" > /dev/null; then
-		  valid_a_lib=yes
-		fi
-		;;
-	      pass_all)
-		valid_a_lib=yes
-		;;
-            esac
-	    if test "$valid_a_lib" != yes; then
+	    if test "$deplibs_check_method" != pass_all; then
 	      $echo
 	      $echo "*** Warning: Trying to link with static lib archive $deplib."
@@ -2166,5 +1984,5 @@
 	else
 	  $echo "$modename: cannot find the library \`$lib'" 1>&2
-	  exit $EXIT_FAILURE
+	  exit 1
 	fi
 
@@ -2173,5 +1991,5 @@
 	else
 	  $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
-	  exit $EXIT_FAILURE
+	  exit 1
 	fi
 
@@ -2209,5 +2027,5 @@
 	    if test -z "$old_library"; then
 	      $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
-	      exit $EXIT_FAILURE
+	      exit 1
 	    fi
 	    # It is a libtool convenience library, so add in its objects.
@@ -2226,10 +2044,10 @@
 	  elif test "$linkmode" != prog && test "$linkmode" != lib; then
 	    $echo "$modename: \`$lib' is not a convenience library" 1>&2
-	    exit $EXIT_FAILURE
+	    exit 1
 	  fi
 	  continue
 	fi # $pass = conv
 
-
+    
 	# Get the name of the library we link against.
 	linklib=
@@ -2239,5 +2057,5 @@
 	if test -z "$linklib"; then
 	  $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
-	  exit $EXIT_FAILURE
+	  exit 1
 	fi
 
@@ -2246,9 +2064,7 @@
 	  if test -z "$libdir"; then
 	    $echo "$modename: cannot -dlopen a convenience library: \`$lib'" 1>&2
-	    exit $EXIT_FAILURE
-	  fi
-	  if test -z "$dlname" ||
-	     test "$dlopen_support" != yes ||
-	     test "$build_libtool_libs" = no; then
+	    exit 1
+	  fi
+	  if test -z "$dlname" || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
 	    # If there is no dlname, no dlopen support or we're linking
 	    # statically, we need to preload.  We also need to preload any
@@ -2288,15 +2104,8 @@
 	  fi
 	else
-	  if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then
-	    dir="$ladir"
-	    absdir="$abs_ladir"
-	    # Remove this search path later
-	    notinst_path="$notinst_path $abs_ladir"
-	  else
-	    dir="$ladir/$objdir"
-	    absdir="$abs_ladir/$objdir"
-	    # Remove this search path later
-	    notinst_path="$notinst_path $abs_ladir"
-	  fi
+	  dir="$ladir/$objdir"
+	  absdir="$abs_ladir/$objdir"
+	  # Remove this search path later
+	  notinst_path="$notinst_path $abs_ladir"
 	fi # $installed = yes
 	name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
@@ -2306,5 +2115,5 @@
 	  if test -z "$libdir"; then
 	    $echo "$modename: cannot -dlpreopen a convenience library: \`$lib'" 1>&2
-	    exit $EXIT_FAILURE
+	    exit 1
 	  fi
 	  # Prefer using a static library (so that no silly _DYNAMIC symbols
@@ -2333,5 +2142,5 @@
 	fi
 
-
+    
 	if test "$linkmode" = prog && test "$pass" != link; then
 	  newlib_search_path="$newlib_search_path $ladir"
@@ -2420,8 +2229,7 @@
 	  fi
 	  # This is a shared library
-
-	  # Warn about portability, can't link against -module's on
-	  # some systems (darwin)
-	  if test "$shouldnotlink" = yes && test "$pass" = link ; then
+	
+      # Warn about portability, can't link against -module's on some systems (darwin)
+      if test "$shouldnotlink" = yes && test "$pass" = link ; then
 	    $echo
 	    if test "$linkmode" = prog; then
@@ -2430,6 +2238,6 @@
 	      $echo "*** Warning: Linking the shared library $output against the loadable module"
 	    fi
-	    $echo "*** $linklib is not portable!"
-	  fi
+	    $echo "*** $linklib is not portable!"    
+      fi	  
 	  if test "$linkmode" = lib &&
 	     test "$hardcode_into_libs" = yes; then
@@ -2488,9 +2296,8 @@
 	    else
 	      $show "extracting exported symbol list from \`$soname'"
-	      save_ifs="$IFS"; IFS='~'
-	      cmds=$extract_expsyms_cmds
+	      save_ifs="$IFS"; IFS=$_S_
+	      eval cmds=\"$extract_expsyms_cmds\"
 	      for cmd in $cmds; do
 		IFS="$save_ifs"
-		eval cmd=\"$cmd\"
 		$show "$cmd"
 		$run eval "$cmd" || exit $?
@@ -2502,9 +2309,8 @@
 	    if test -f "$output_objdir/$newlib"; then :; else
 	      $show "generating import library for \`$soname'"
-	      save_ifs="$IFS"; IFS='~'
-	      cmds=$old_archive_from_expsyms_cmds
+	      save_ifs="$IFS"; IFS=$_S_
+	      eval cmds=\"$old_archive_from_expsyms_cmds\"
 	      for cmd in $cmds; do
 		IFS="$save_ifs"
-		eval cmd=\"$cmd\"
 		$show "$cmd"
 		$run eval "$cmd" || exit $?
@@ -2529,7 +2335,7 @@
 		  *-*-sco3.2v5* ) add_dir="-L$dir" ;;
 		  *-*-darwin* )
-		    # if the lib is a module then we can not link against
-		    # it, someone is ignoring the new warnings I added
-		    if /usr/bin/file -L $add 2> /dev/null | $EGREP "bundle" >/dev/null ; then
+		    # if the lib is a module then we can not link against it, someone
+		    # is ignoring the new warnings I added
+		    if /usr/bin/file -L $add 2> /dev/null | grep "bundle" >/dev/null ; then
 		      $echo "** Warning, lib $linklib is a module, not a shared library"
 		      if test -z "$old_library" ; then
@@ -2539,5 +2345,5 @@
 		      else
 		        add="$dir/$old_library"
-		      fi
+		      fi 
 		    fi
 		esac
@@ -2564,5 +2370,5 @@
 		  case "$libdir" in
 		    [\\/]*)
-		      add_dir="$add_dir -L$inst_prefix_dir$libdir"
+		      add_dir="-L$inst_prefix_dir$libdir $add_dir"
 		      ;;
 		  esac
@@ -2581,5 +2387,5 @@
 	    if test "$lib_linked" != yes; then
 	      $echo "$modename: configuration error: unsupported hardcode properties"
-	      exit $EXIT_FAILURE
+	      exit 1
 	    fi
 
@@ -2624,6 +2430,5 @@
 	      add="-l$name"
 	    elif test "$hardcode_automatic" = yes; then
-	      if test -n "$inst_prefix_dir" &&
-		 test -f "$inst_prefix_dir$libdir/$linklib" ; then
+	      if test -n "$inst_prefix_dir" && test -f "$inst_prefix_dir$libdir/$linklib" ; then
 	        add="$inst_prefix_dir$libdir/$linklib"
 	      else
@@ -2637,5 +2442,5 @@
 		case "$libdir" in
 		  [\\/]*)
-		    add_dir="$add_dir -L$inst_prefix_dir$libdir"
+		    add_dir="-L$inst_prefix_dir$libdir $add_dir"
 		    ;;
 		esac
@@ -2705,6 +2510,5 @@
 	if test "$linkmode" = lib; then
 	  if test -n "$dependency_libs" &&
-	     { test "$hardcode_into_libs" != yes ||
-	       test "$build_old_libs" = yes ||
+	     { test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes ||
 	       test "$link_static" = yes; }; then
 	    # Extract -R from dependency_libs
@@ -2763,5 +2567,5 @@
 		  if test -z "$libdir"; then
 		    $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
-		    exit $EXIT_FAILURE
+		    exit 1
 		  fi
 		  if test "$absdir" != "$libdir"; then
@@ -2773,6 +2577,5 @@
 		case $host in
 		*-*-darwin*)
-		  # we do not want to link against static libs,
-		  # but need to link against shared
+		  # we do not want to link against static libs, but need to link against shared
 		  eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib`
 		  if test -n "$deplibrary_names" ; then
@@ -2782,33 +2585,30 @@
 		    if test -f "$path/$depdepl" ; then
 		      depdepl="$path/$depdepl"
-		    fi
-		    # do not add paths which are already there
-		    case " $newlib_search_path " in
-		    *" $path "*) ;;
-		    *) newlib_search_path="$newlib_search_path $path";;
-		    esac
+		   fi
+		    newlib_search_path="$newlib_search_path $path"
+		    path=""
 		  fi
-		  path=""
 		  ;;
 		*)
-		  path="-L$path"
-		  ;;
-		esac
+		path="-L$path"
 		;;
-	      -l*)
+		esac 
+		
+		;;
+		  -l*)
 		case $host in
 		*-*-darwin*)
-		  # Again, we only want to link against shared libraries
-		  eval tmp_libs=`$echo "X$deplib" | $Xsed -e "s,^\-l,,"`
-		  for tmp in $newlib_search_path ; do
-		    if test -f "$tmp/lib$tmp_libs.dylib" ; then
-		      eval depdepl="$tmp/lib$tmp_libs.dylib"
-		      break
-		    fi
-		  done
-		  path=""
+		 # Again, we only want to link against shared libraries
+		 eval tmp_libs=`$echo "X$deplib" | $Xsed -e "s,^\-l,,"`
+		 for tmp in $newlib_search_path ; do
+		     if test -f "$tmp/lib$tmp_libs.dylib" ; then
+		       eval depdepl="$tmp/lib$tmp_libs.dylib"
+		       break
+		     fi  
+         done
+         path=""
 		  ;;
 		*) continue ;;
-		esac
+		esac  		  
 		;;
 	      *) continue ;;
@@ -2816,6 +2616,6 @@
 	      case " $deplibs " in
 	      *" $depdepl "*) ;;
-	      *) deplibs="$depdepl $deplibs" ;;
-	      esac
+	      *) deplibs="$deplibs $depdepl" ;;
+	      esac	      
 	      case " $deplibs " in
 	      *" $path "*) ;;
@@ -2907,6 +2707,5 @@
 	done # for var
       fi
-      # Last step: remove runtime libs from dependency_libs
-      # (they stay in deplibs)
+      # Last step: remove runtime libs from dependency_libs (they stay in deplibs)
       tmp_libs=
       for i in $dependency_libs ; do
@@ -2968,5 +2767,5 @@
       lib*)
 	name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
-	eval shared_ext=\"$shrext_cmds\"
+	eval shared_ext=\"$shrext\"
 	eval libname=\"$libname_spec\"
 	;;
@@ -2975,10 +2774,10 @@
 	  $echo "$modename: libtool library \`$output' must begin with \`lib'" 1>&2
 	  $echo "$help" 1>&2
-	  exit $EXIT_FAILURE
+	  exit 1
 	fi
 	if test "$need_lib_prefix" != no; then
 	  # Add the "lib" prefix for modules if required
 	  name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
-	  eval shared_ext=\"$shrext_cmds\"
+	  eval shared_ext=\"$shrext\"
 	  eval libname=\"$libname_spec\"
 	else
@@ -2991,5 +2790,5 @@
 	if test "$deplibs_check_method" != pass_all; then
 	  $echo "$modename: cannot build libtool library \`$output' from non-libtool objects on this host:$objs" 2>&1
-	  exit $EXIT_FAILURE
+	  exit 1
 	else
 	  $echo
@@ -3039,5 +2838,5 @@
 	  $echo "$modename: too many parameters to \`-version-info'" 1>&2
 	  $echo "$help" 1>&2
-	  exit $EXIT_FAILURE
+	  exit 1
 	fi
 
@@ -3045,5 +2844,5 @@
 	# this retains compatibility with .la files and attempts
 	# to make the code below a bit more comprehensible
-
+	
 	case $vinfo_number in
 	yes)
@@ -3089,5 +2888,5 @@
 	  $echo "$modename: CURRENT \`$current' is not a nonnegative integer" 1>&2
 	  $echo "$modename: \`$vinfo' is not valid version information" 1>&2
-	  exit $EXIT_FAILURE
+	  exit 1
 	  ;;
 	esac
@@ -3098,5 +2897,5 @@
 	  $echo "$modename: REVISION \`$revision' is not a nonnegative integer" 1>&2
 	  $echo "$modename: \`$vinfo' is not valid version information" 1>&2
-	  exit $EXIT_FAILURE
+	  exit 1
 	  ;;
 	esac
@@ -3107,5 +2906,5 @@
 	  $echo "$modename: AGE \`$age' is not a nonnegative integer" 1>&2
 	  $echo "$modename: \`$vinfo' is not valid version information" 1>&2
-	  exit $EXIT_FAILURE
+	  exit 1
 	  ;;
 	esac
@@ -3114,5 +2913,5 @@
 	  $echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2
 	  $echo "$modename: \`$vinfo' is not valid version information" 1>&2
-	  exit $EXIT_FAILURE
+	  exit 1
 	fi
 
@@ -3131,5 +2930,5 @@
 	  # Darwin ld doesn't like 0 for these options...
 	  minor_current=`expr $current + 1`
-	  verstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision"
+	  verstring="-compatibility_version $minor_current -current_version $minor_current.$revision"
 	  ;;
 
@@ -3203,5 +3002,5 @@
 	  $echo "$modename: unknown library version type \`$version_type'" 1>&2
 	  $echo "Fatal configuration error.  See the $PACKAGE docs for more information." 1>&2
-	  exit $EXIT_FAILURE
+	  exit 1
 	  ;;
 	esac
@@ -3257,10 +3056,4 @@
 	       ;;
 	    $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*)
-	       if test "X$precious_files_regex" != "X"; then
-	         if echo $p | $EGREP -e "$precious_files_regex" >/dev/null 2>&1
-	         then
-		   continue
-		 fi
-	       fi
 	       removelist="$removelist $p"
 	       ;;
@@ -3383,5 +3176,5 @@
 EOF
 	  $rm conftest
-	  $LTCC -o conftest conftest.c $deplibs
+	  $LTCC $archargs -o conftest conftest.c $deplibs
 	  if test "$?" -eq 0 ; then
 	    ldd_output=`ldd conftest`
@@ -3428,5 +3221,5 @@
               if test "$name" != "" && test "$name" != "0"; then
 		$rm conftest
-		$LTCC -o conftest conftest.c $i
+		$LTCC $archargs -o conftest conftest.c $i
 		# Did it work?
 		if test "$?" -eq 0 ; then
@@ -3742,5 +3535,5 @@
 
 	# Get the real and link names of the library.
-	eval shared_ext=\"$shrext_cmds\"
+	eval shared_ext=\"$shrext\"
 	eval library_names=\"$library_names_spec\"
 	set dummy $library_names
@@ -3772,9 +3565,8 @@
 	    export_symbols="$output_objdir/$libname.exp"
 	    $run $rm $export_symbols
-	    cmds=$export_symbols_cmds
-	    save_ifs="$IFS"; IFS='~'
+	    eval cmds=\"$export_symbols_cmds\"
+	    save_ifs="$IFS"; IFS=$_S_
 	    for cmd in $cmds; do
 	      IFS="$save_ifs"
-	      eval cmd=\"$cmd\"
 	      if len=`expr "X$cmd" : ".*"` &&
 	       test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
@@ -3806,10 +3598,10 @@
 		case " $convenience " in
 		*" $test_deplib "*) ;;
-		*)
+		*) 
 			tmp_deplibs="$tmp_deplibs $test_deplib"
 			;;
 		esac
 	done
-	deplibs="$tmp_deplibs"
+	deplibs="$tmp_deplibs" 
 
 	if test -n "$convenience"; then
@@ -3819,11 +3611,111 @@
 	  else
 	    gentop="$output_objdir/${outputname}x"
+	    $show "${rm}r $gentop"
+	    $run ${rm}r "$gentop"
+	    $show "$mkdir $gentop"
+	    $run $mkdir "$gentop"
+	    status=$?
+	    if test "$status" -ne 0 && test ! -d "$gentop"; then
+	      exit $status
+	    fi
 	    generated="$generated $gentop"
 
-	    func_extract_archives $gentop $convenience
-	    libobjs="$libobjs $func_extract_archives_result"
-	  fi
-	fi
-	
+	    for xlib in $convenience; do
+	      # Extract the objects.
+	      case $xlib in
+	      [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
+	      *) xabs=`pwd`"/$xlib" ;;
+	      esac
+	      xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
+	      xdir="$gentop/$xlib"
+
+	      $show "${rm}r $xdir"
+	      $run ${rm}r "$xdir"
+	      $show "$mkdir $xdir"
+	      $run $mkdir "$xdir"
+	      status=$?
+	      if test "$status" -ne 0 && test ! -d "$xdir"; then
+		exit $status
+	      fi
+	      case $host in
+	      *-*-darwin*)
+		# ranlib-ed archives of fat binaries are converted to a fat xabs that
+		# ar can't use.  So we to split the fat xabs into non-fat ones to unpack.
+		# We can't deal with duplicate names, since 'ar xN' and 'uniq -cd' don't work.
+		d_archs=`lipo -info $xabs 2> /dev/null | grep '^Architectures' | sed 's/^.*: //'`
+		if test -n "$d_archs"; then
+		  $echo "$modename: manually unpacking fat archive $xabs" 1>&2
+		  d_name=`basename $xabs`
+		  d_dir="/tmp/fat_ar.$$"
+		  d_files=''
+
+		  for d_arch in $d_archs; do
+		    d_archdir="$d_dir/$d_arch"
+		    $show "$mkdir -p $d_archdir"
+		    $run $mkdir -p "$d_archdir"
+
+		    $show "lipo -thin $d_arch $xabs -o $d_dir/$d_name"
+		    $run lipo -thin $d_arch "$xabs" -o "$d_dir/$d_name"
+
+		    $show "(cd $d_archdir && $AR x $d_dir/$d_name)"
+		    $run eval "(cd \$d_archdir && \$AR x \$d_dir/\$d_name)" || exit $?
+
+		    $show "${rm} $d_dir/$d_name"
+		    $run ${rm} "$d_dir/$d_name"
+		  done
+
+		  # Can't deal with blanks in file names
+		  $run eval "d_files=\`find \$d_dir -type f | sed -e 's,.*/,,' -e '/ /d' | sort -u\`" || exit $?
+
+		  for d_file in $d_files; do
+		    $run eval "d_f=\`find \$d_dir -name \$d_file -print\`" || exit $?
+		    $show "lipo -create $d_f -o $xdir/$d_file"
+		    $run eval "lipo -create \$d_f -o \"\$xdir/\$d_file\"" || exit $?
+		  done
+
+		  $show "${rm}r $d_dir"
+		  $run ${rm}r "$d_dir"
+		else
+		  $show "(cd $xdir && $AR x $xabs)"
+		  $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
+		fi
+		;;
+	      *)
+		# We will extract separately just the conflicting names and we will no
+		# longer touch any unique names. It is faster to leave these extract
+		# automatically by $AR in one run.
+		$show "(cd $xdir && $AR x $xabs)"
+		$run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
+		if ($AR t "$xabs" | sort | sort -uc >/dev/null 2>&1); then
+		  :
+		else
+		  $echo "$modename: warning: object name conflicts; renaming object files" 1>&2
+		  $echo "$modename: warning: to ensure that they will not overwrite" 1>&2
+		  $AR t "$xabs" | sort | uniq -cd | while read -r count name
+		  do
+		    i=1
+		    while test "$i" -le "$count"
+		    do
+		     # Put our $i before any first dot (extension)
+		     # Never overwrite any file
+		     name_to="$name"
+		     while test "X$name_to" = "X$name" || test -f "$xdir/$name_to"
+		     do
+		       name_to=`$echo "X$name_to" | $Xsed -e "s/\([^.]*\)/\1-$i/"`
+		     done
+		     $show "(cd $xdir && $AR xN $i $xabs '$name' && $mv '$name' '$name_to')"
+		     $run eval "(cd \$xdir && $AR xN $i \$xabs '$name' && $mv '$name' '$name_to')" || exit $?
+		     i=`expr $i + 1`
+		    done
+		  done
+		fi
+		;;
+	      esac
+
+	      libobjs="$libobjs "`find $xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP`
+	    done
+	  fi
+	fi
+
 	if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then
 	  eval flag=\"$thread_safe_flag_spec\"
@@ -3839,21 +3731,17 @@
 	if test "$module" = yes && test -n "$module_cmds" ; then
 	  if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
-	    eval test_cmds=\"$module_expsym_cmds\"
-	    cmds=$module_expsym_cmds
+	    eval cmds=\"$module_expsym_cmds\"
 	  else
-	    eval test_cmds=\"$module_cmds\"
-	    cmds=$module_cmds
+	    eval cmds=\"$module_cmds\"
 	  fi
 	else
 	if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
-	  eval test_cmds=\"$archive_expsym_cmds\"
-	  cmds=$archive_expsym_cmds
+	  eval cmds=\"$archive_expsym_cmds\"
 	else
-	  eval test_cmds=\"$archive_cmds\"
-	  cmds=$archive_cmds
-	  fi
-	fi
-
-	if test "X$skipped_export" != "X:" && len=`expr "X$test_cmds" : ".*"` &&
+	  eval cmds=\"$archive_cmds\"
+	  fi
+	fi
+
+	if test "X$skipped_export" != "X:" && len=`expr "X$cmds" : ".*"` &&
 	   test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
 	  :
@@ -3901,5 +3789,5 @@
 		# All subsequent reloadable object files will link in
 		# the last one created.
-		eval concat_cmds=\"\$concat_cmds~$reload_cmds $objlist $last_robj\"
+		eval concat_cmds=\"\$concat_cmds${_S_}$reload_cmds $objlist $last_robj\"
 	      fi
 	      last_robj=$output_objdir/$save_output-${k}.$objext
@@ -3913,5 +3801,5 @@
 	  # reloadable object file.  All subsequent reloadable object
 	  # files will link in the last one created.
-	  test -z "$concat_cmds" || concat_cmds=$concat_cmds~
+	  test -z "$concat_cmds" || concat_cmds=$concat_cmds${_S_}
 	  eval concat_cmds=\"\${concat_cmds}$reload_cmds $objlist $last_robj\"
 
@@ -3922,5 +3810,5 @@
 	    libobjs=$output
 	    # Append the command to create the export file.
-	    eval concat_cmds=\"\$concat_cmds~$export_symbols_cmds\"
+	    eval concat_cmds=\"\$concat_cmds${_S_}$export_symbols_cmds\"
           fi
 
@@ -3937,5 +3825,5 @@
 
 	  # Loop through the commands generated above and execute them.
-	  save_ifs="$IFS"; IFS='~'
+	  save_ifs="$IFS"; IFS=$_S_
 	  for cmd in $concat_cmds; do
 	    IFS="$save_ifs"
@@ -3956,26 +3844,17 @@
 
 	  # Do each of the archive commands.
-	  if test "$module" = yes && test -n "$module_cmds" ; then
-	    if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
-	      cmds=$module_expsym_cmds
-	    else
-	      cmds=$module_cmds
-	    fi
+	  if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
+	    eval cmds=\"$archive_expsym_cmds\"
 	  else
-	  if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
-	    cmds=$archive_expsym_cmds
-	  else
-	    cmds=$archive_cmds
-	    fi
+	    eval cmds=\"$archive_cmds\"
 	  fi
 
 	  # Append the command to remove the reloadable object files
 	  # to the just-reset $cmds.
-	  eval cmds=\"\$cmds~\$rm $delfiles\"
-	fi
-	save_ifs="$IFS"; IFS='~'
+	  eval cmds=\"\$cmds${_S_}$rm $delfiles\"
+	fi
+	save_ifs="$IFS"; IFS=$_S_
 	for cmd in $cmds; do
 	  IFS="$save_ifs"
-	  eval cmd=\"$cmd\"
 	  $show "$cmd"
 	  $run eval "$cmd" || exit $?
@@ -3986,5 +3865,5 @@
 	if test "$mode" = relink; then
 	  $run eval '(cd $output_objdir && $rm ${realname}T && $mv $realname ${realname}T && $mv "$realname"U $realname)' || exit $?
-	  exit $EXIT_SUCCESS
+	  exit 0
 	fi
 
@@ -4034,5 +3913,5 @@
 	if test -n "$objs$old_deplibs"; then
 	  $echo "$modename: cannot build library object \`$output' from non-libtool objects" 1>&2
-	  exit $EXIT_FAILURE
+	  exit 1
 	fi
 	libobj="$output"
@@ -4063,8 +3942,108 @@
 	else
 	  gentop="$output_objdir/${obj}x"
+	  $show "${rm}r $gentop"
+	  $run ${rm}r "$gentop"
+	  $show "$mkdir $gentop"
+	  $run $mkdir "$gentop"
+	  status=$?
+	  if test "$status" -ne 0 && test ! -d "$gentop"; then
+	    exit $status
+	  fi
 	  generated="$generated $gentop"
 
-	  func_extract_archives $gentop $convenience
-	  reload_conv_objs="$reload_objs $func_extract_archives_result"
+	  for xlib in $convenience; do
+	    # Extract the objects.
+	    case $xlib in
+	    [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
+	    *) xabs=`pwd`"/$xlib" ;;
+	    esac
+	    xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
+	    xdir="$gentop/$xlib"
+
+	    $show "${rm}r $xdir"
+	    $run ${rm}r "$xdir"
+	    $show "$mkdir $xdir"
+	    $run $mkdir "$xdir"
+	    status=$?
+	    if test "$status" -ne 0 && test ! -d "$xdir"; then
+	      exit $status
+	    fi
+	    case $host in
+	    *-*-darwin*)
+	      # ranlib-ed archives of fat binaries are converted to a fat xabs that
+	      # ar can't use.  So we to split the fat xabs into non-fat ones to unpack.
+	      # We can't deal with duplicate names, since 'ar xN' and 'uniq -cd' don't work.
+	      d_archs=`lipo -info $xabs 2> /dev/null | grep '^Architectures' | sed 's/^.*: //'`
+	      if test -n "$d_archs"; then
+		$echo "$modename: manually unpacking fat archive $xabs" 1>&2
+		d_name=`basename $xabs`
+		d_dir="/tmp/fat_ar.$$"
+		d_files=''
+
+		for d_arch in $d_archs; do
+		  d_archdir="$d_dir/$d_arch"
+		  $show "$mkdir -p $d_archdir"
+		  $run $mkdir -p "$d_archdir"
+
+		  $show "lipo -thin $d_arch $xabs -o $d_dir/$d_name"
+		  $run lipo -thin $d_arch "$xabs" -o "$d_dir/$d_name"
+
+		  $show "(cd $d_archdir && $AR x $d_dir/$d_name)"
+		  $run eval "(cd \$d_archdir && \$AR x \$d_dir/\$d_name)" || exit $?
+
+		  $show "${rm} $d_dir/$d_name"
+		  $run ${rm} "$d_dir/$d_name"
+		done
+
+		# Can't deal with blanks in file names
+		$run eval "d_files=\`find \$d_dir -type f | sed -e 's,.*/,,' -e '/ /d' | sort -u\`" || exit $?
+
+		for d_file in $d_files; do
+		  $run eval "d_f=\`find \$d_dir -name \$d_file -print\`" || exit $?
+		  $show "lipo -create $d_f -o $xdir/$d_file"
+		  $run eval "lipo -create \$d_f -o \"\$xdir/\$d_file\"" || exit $?
+		done
+
+		$show "${rm}r $d_dir"
+		$run ${rm}r "$d_dir"
+	      else
+		$show "(cd $xdir && $AR x $xabs)"
+		$run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
+	      fi
+	      ;;
+	    *)
+	      # We will extract separately just the conflicting names and we will no
+	      # longer touch any unique names. It is faster to leave these extract
+	      # automatically by $AR in one run.
+	      $show "(cd $xdir && $AR x $xabs)"
+	      $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
+	      if ($AR t "$xabs" | sort | sort -uc >/dev/null 2>&1); then
+		:
+	      else
+		$echo "$modename: warning: object name conflicts; renaming object files" 1>&2
+		$echo "$modename: warning: to ensure that they will not overwrite" 1>&2
+		$AR t "$xabs" | sort | uniq -cd | while read -r count name
+		do
+		  i=1
+		  while test "$i" -le "$count"
+		  do
+		   # Put our $i before any first dot (extension)
+		   # Never overwrite any file
+		   name_to="$name"
+		   while test "X$name_to" = "X$name" || test -f "$xdir/$name_to"
+		   do
+		     name_to=`$echo "X$name_to" | $Xsed -e "s/\([^.]*\)/\1-$i/"`
+		   done
+		   $show "(cd $xdir && $AR xN $i $xabs '$name' && $mv '$name' '$name_to')"
+		   $run eval "(cd \$xdir && $AR xN $i \$xabs '$name' && $mv '$name' '$name_to')" || exit $?
+		   i=`expr $i + 1`
+		  done
+		done
+	      fi
+	      ;;
+	    esac
+
+	    reload_conv_objs="$reload_objs "`find $xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP`
+	  done
 	fi
       fi
@@ -4074,9 +4053,8 @@
 
       output="$obj"
-      cmds=$reload_cmds
-      save_ifs="$IFS"; IFS='~'
+      eval cmds=\"$reload_cmds\"
+      save_ifs="$IFS"; IFS=$_S_
       for cmd in $cmds; do
 	IFS="$save_ifs"
-	eval cmd=\"$cmd\"
 	$show "$cmd"
 	$run eval "$cmd" || exit $?
@@ -4091,5 +4069,5 @@
 	fi
 
-	exit $EXIT_SUCCESS
+	exit 0
       fi
 
@@ -4104,5 +4082,5 @@
 	# $show "echo timestamp > $libobj"
 	# $run eval "echo timestamp > $libobj" || exit $?
-	exit $EXIT_SUCCESS
+	exit 0
       fi
 
@@ -4111,9 +4089,8 @@
 	reload_objs="$libobjs $reload_conv_objs"
 	output="$libobj"
-	cmds=$reload_cmds
-	save_ifs="$IFS"; IFS='~'
+	eval cmds=\"$reload_cmds\"
+	save_ifs="$IFS"; IFS=$_S_
 	for cmd in $cmds; do
 	  IFS="$save_ifs"
-	  eval cmd=\"$cmd\"
 	  $show "$cmd"
 	  $run eval "$cmd" || exit $?
@@ -4127,5 +4104,5 @@
       fi
 
-      exit $EXIT_SUCCESS
+      exit 0
       ;;
 
@@ -4432,6 +4409,6 @@
 
 	  # Now compile the dynamic symbol file.
-	  $show "(cd $output_objdir && $LTCC -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")"
-	  $run eval '(cd $output_objdir && $LTCC -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $?
+	  $show "(cd $output_objdir && $LTCC $archargs -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")"
+	  $run eval '(cd $output_objdir && $LTCC $archargs -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $?
 
 	  # Clean up the generated files.
@@ -4445,5 +4422,5 @@
 	*)
 	  $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2
-	  exit $EXIT_FAILURE
+	  exit 1
 	  ;;
 	esac
@@ -4533,5 +4510,5 @@
 	$show "$link_command"
 	$run eval "$link_command" || exit $?
-	exit $EXIT_SUCCESS
+	exit 0
       fi
 
@@ -4588,8 +4565,8 @@
 
       # Quote $echo for shipping.
-      if test "X$echo" = "X$SHELL $progpath --fallback-echo"; then
-	case $progpath in
-	[\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $progpath --fallback-echo";;
-	*) qecho="$SHELL `pwd`/$progpath --fallback-echo";;
+      if test "X$echo" = "X$SHELL $0 --fallback-echo"; then
+	case $0 in
+	[\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $0 --fallback-echo";;
+	*) qecho="$SHELL `pwd`/$0 --fallback-echo";;
 	esac
 	qecho=`$echo "X$qecho" | $Xsed -e "$sed_quote_subst"`
@@ -4617,5 +4594,5 @@
 	    cwrapper=`$echo ${output}.exe`
 	    $rm $cwrappersource $cwrapper
-	    trap "$rm $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15
+	    trap "$rm $cwrappersource $cwrapper; exit 1" 1 2 15
 
 	    cat > $cwrappersource <<EOF
@@ -4626,5 +4603,5 @@
    The $output program cannot be directly executed until all the libtool
    libraries that it depends on are installed.
-
+   
    This wrapper executable should never be moved out of the build directory.
    If it is, it will not operate correctly.
@@ -4658,5 +4635,5 @@
   defined (__OS2__)
 #define HAVE_DOS_BASED_FILE_SYSTEM
-#ifndef DIR_SEPARATOR_2
+#ifndef DIR_SEPARATOR_2 
 #define DIR_SEPARATOR_2 '\\'
 #endif
@@ -4689,5 +4666,5 @@
   char **newargz;
   int i;
-
+  
   program_name = (char *) xstrdup ((char *) basename (argv[0]));
   newargz = XMALLOC(char *, argc+2);
@@ -4702,5 +4679,5 @@
   /* we know the script has the same name, without the .exe */
   /* so make sure newargz[1] doesn't end in .exe */
-  strendzap(newargz[1],".exe");
+  strendzap(newargz[1],".exe"); 
   for (i = 1; i < argc; i++)
     newargz[i+1] = xstrdup(argv[i]);
@@ -4725,5 +4702,5 @@
 }
 
-char *
+char * 
 xstrdup (const char *string)
 {
@@ -4739,5 +4716,5 @@
 #if defined (HAVE_DOS_BASED_FILE_SYSTEM)
   /* Skip over the disk name in MSDOS pathnames. */
-  if (isalpha (name[0]) && name[1] == ':')
+  if (isalpha (name[0]) && name[1] == ':') 
     name += 2;
 #endif
@@ -4749,5 +4726,5 @@
 }
 
-char *
+char * 
 fnqualify(const char *path)
 {
@@ -4777,5 +4754,5 @@
 
 char *
-strendzap(char *str, const char *pat)
+strendzap(char *str, const char *pat) 
 {
   size_t len, patlen;
@@ -4797,5 +4774,5 @@
 
 static void
-lt_error_core (int exit_status, const char * mode,
+lt_error_core (int exit_status, const char * mode, 
           const char * message, va_list ap)
 {
@@ -4822,9 +4799,9 @@
 	  # Since the "real" binary is built for $host, then this
 	  # wrapper might as well be built for $host, too.
-	  $run $LTCC -s -o $cwrapper $cwrappersource
+	  $run $LTCC $archargs -s -o $cwrapper $cwrappersource
 	  ;;
 	esac
 	$rm $output
-	trap "$rm $output; exit $EXIT_FAILURE" 1 2 15
+	trap "$rm $output; exit 1" 1 2 15
 
 	$echo > $output "\
@@ -4847,5 +4824,5 @@
 # The HP-UX ksh and POSIX shell print the target directory to stdout
 # if CDPATH is set.
-(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
+if test \"\${CDPATH+set}\" = set; then CDPATH=:; export CDPATH; fi
 
 relink_command=\"$relink_command\"
@@ -4926,5 +4903,5 @@
 	$echo \"\$relink_command_output\" >&2
 	$rm \"\$progdir/\$file\"
-	exit $EXIT_FAILURE
+	exit 1
       fi
     fi
@@ -4988,5 +4965,5 @@
 	$echo >> $output "\
       \$echo \"\$0: cannot exec \$program \${1+\"\$@\"}\"
-      exit $EXIT_FAILURE
+      exit 1
     fi
   else
@@ -4995,5 +4972,5 @@
     \$echo \"This script is just a wrapper for \$program.\" 1>&2
     $echo \"See the $PACKAGE documentation for more information.\" 1>&2
-    exit $EXIT_FAILURE
+    exit 1
   fi
 fi\
@@ -5001,5 +4978,5 @@
 	chmod +x $output
       fi
-      exit $EXIT_SUCCESS
+      exit 0
       ;;
     esac
@@ -5024,13 +5001,114 @@
       if test -n "$addlibs"; then
 	gentop="$output_objdir/${outputname}x"
+	$show "${rm}r $gentop"
+	$run ${rm}r "$gentop"
+	$show "$mkdir $gentop"
+	$run $mkdir "$gentop"
+	status=$?
+	if test "$status" -ne 0 && test ! -d "$gentop"; then
+	  exit $status
+	fi
 	generated="$generated $gentop"
 
-	func_extract_archives $gentop $addlibs
-	oldobjs="$oldobjs $func_extract_archives_result"
+	# Add in members from convenience archives.
+	for xlib in $addlibs; do
+	  # Extract the objects.
+	  case $xlib in
+	  [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
+	  *) xabs=`pwd`"/$xlib" ;;
+	  esac
+	  xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
+	  xdir="$gentop/$xlib"
+
+	  $show "${rm}r $xdir"
+	  $run ${rm}r "$xdir"
+	  $show "$mkdir $xdir"
+	  $run $mkdir "$xdir"
+	  status=$?
+	  if test "$status" -ne 0 && test ! -d "$xdir"; then
+	    exit $status
+	  fi
+	  case $host in
+	  *-*-darwin*)
+	    # ranlib-ed archives of fat binaries are converted to a fat xabs that
+	    # ar can't use.  So we to split the fat xabs into non-fat ones to unpack.
+	    # We can't deal with duplicate names, since 'ar xN' and 'uniq -cd' don't work.
+	    d_archs=`lipo -info $xabs 2> /dev/null | grep '^Architectures' | sed 's/^.*: //'`
+	    if test -n "$d_archs"; then
+	      $echo "$modename: manually unpacking fat archive $xabs" 1>&2
+	      d_name=`basename $xabs`
+	      d_dir="/tmp/fat_ar.$$"
+	      d_files=''
+
+	      for d_arch in $d_archs; do
+		d_archdir="$d_dir/$d_arch"
+		$show "$mkdir -p $d_archdir"
+		$run $mkdir -p "$d_archdir"
+
+		$show "lipo -thin $d_arch $xabs -o $d_dir/$d_name"
+		$run lipo -thin $d_arch "$xabs" -o "$d_dir/$d_name"
+
+		$show "(cd $d_archdir && $AR x $d_dir/$d_name)"
+		$run eval "(cd \$d_archdir && \$AR x \$d_dir/\$d_name)" || exit $?
+
+		$show "${rm} $d_dir/$d_name"
+		$run ${rm} "$d_dir/$d_name"
+	      done
+
+	      # Can't deal with blanks in file names
+	      $run eval "d_files=\`find \$d_dir -type f | sed -e 's,.*/,,' -e '/ /d' | sort -u\`" || exit $?
+
+	      for d_file in $d_files; do
+		$run eval "d_f=\`find \$d_dir -name \$d_file -print\`" || exit $?
+		$show "lipo -create $d_f -o $xdir/$d_file"
+		$run eval "lipo -create \$d_f -o \"\$xdir/\$d_file\"" || exit $?
+	      done
+
+	      $show "${rm}r $d_dir"
+	      $run ${rm}r "$d_dir"
+	    else
+	      $show "(cd $xdir && $AR x $xabs)"
+	      $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
+	    fi
+	    ;;
+	  *)
+	    # We will extract separately just the conflicting names and we will no
+	    # longer touch any unique names. It is faster to leave these extract
+	    # automatically by $AR in one run.
+	    $show "(cd $xdir && $AR x $xabs)"
+	    $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
+	    if ($AR t "$xabs" | sort | sort -uc >/dev/null 2>&1); then
+	      :
+	    else
+	      $echo "$modename: warning: object name conflicts; renaming object files" 1>&2
+	      $echo "$modename: warning: to ensure that they will not overwrite" 1>&2
+	      $AR t "$xabs" | sort | uniq -cd | while read -r count name
+	      do
+		i=1
+		while test "$i" -le "$count"
+		do
+		 # Put our $i before any first dot (extension)
+		 # Never overwrite any file
+		 name_to="$name"
+		 while test "X$name_to" = "X$name" || test -f "$xdir/$name_to"
+		 do
+		   name_to=`$echo "X$name_to" | $Xsed -e "s/\([^.]*\)/\1-$i/"`
+		 done
+		 $show "(cd $xdir && $AR xN $i $xabs '$name' && $mv '$name' '$name_to')"
+		 $run eval "(cd \$xdir && $AR xN $i \$xabs '$name' && $mv '$name' '$name_to')" || exit $?
+		 i=`expr $i + 1`
+		done
+	      done
+	    fi
+	    ;;
+	  esac
+
+	  oldobjs="$oldobjs "`find $xdir -name \*.${objext} -print -o -name \*.lo -print | $NL2SP`
+	done
       fi
 
       # Do each command in the archive commands.
       if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then
-       cmds=$old_archive_from_new_cmds
+	eval cmds=\"$old_archive_from_new_cmds\"
       else
 	eval cmds=\"$old_archive_cmds\"
@@ -5038,5 +5116,5 @@
 	if len=`expr "X$cmds" : ".*"` &&
 	     test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
-	  cmds=$old_archive_cmds
+	  :
 	else
 	  # the command line is too long to link in one step, link in parts
@@ -5065,5 +5143,5 @@
 	  do
 	    last_oldobj=$obj
-	  done
+	  done  
 	  for obj in $save_oldobjs
 	  do
@@ -5079,6 +5157,6 @@
 	      if test "$obj" = "$last_oldobj" ; then
 	        RANLIB=$save_RANLIB
-	      fi
-	      test -z "$concat_cmds" || concat_cmds=$concat_cmds~
+	      fi  
+	      test -z "$concat_cmds" || concat_cmds=$concat_cmds${_S_}
 	      eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\"
 	      objlist=
@@ -5090,11 +5168,10 @@
 	    eval cmds=\"\$concat_cmds\"
 	  else
-	    eval cmds=\"\$concat_cmds~\$old_archive_cmds\"
-	  fi
-	fi
-      fi
-      save_ifs="$IFS"; IFS='~'
+	    eval cmds=\"\$concat_cmds${_S_}$old_archive_cmds\"
+	  fi
+	fi
+      fi
+      save_ifs="$IFS"; IFS=$_S_
       for cmd in $cmds; do
-        eval cmd=\"$cmd\"
 	IFS="$save_ifs"
 	$show "$cmd"
@@ -5128,10 +5205,6 @@
       done
       # Quote the link command for shipping.
-      relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)"
+      relink_command="(cd `pwd`; $SHELL $0 --mode=relink $libtool_args @inst_prefix_dir@)"
       relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"`
-      if test "$hardcode_automatic" = yes ; then
-	relink_command=
-      fi
-
 
       # Only create the output if not a dry run.
@@ -5152,5 +5225,5 @@
 		if test -z "$libdir"; then
 		  $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
-		  exit $EXIT_FAILURE
+		  exit 1
 		fi
 		newdependency_libs="$newdependency_libs $libdir/$name"
@@ -5166,5 +5239,5 @@
 	      if test -z "$libdir"; then
 		$echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
-		exit $EXIT_FAILURE
+		exit 1
 	      fi
 	      newdlfiles="$newdlfiles $libdir/$name"
@@ -5177,26 +5250,7 @@
 	      if test -z "$libdir"; then
 		$echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
-		exit $EXIT_FAILURE
+		exit 1
 	      fi
 	      newdlprefiles="$newdlprefiles $libdir/$name"
-	    done
-	    dlprefiles="$newdlprefiles"
-	  else
-	    newdlfiles=
-	    for lib in $dlfiles; do
-	      case $lib in
-		[\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
-		*) abs=`pwd`"/$lib" ;;
-	      esac
-	      newdlfiles="$newdlfiles $abs"
-	    done
-	    dlfiles="$newdlfiles"
-	    newdlprefiles=
-	    for lib in $dlprefiles; do
-	      case $lib in
-		[\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
-		*) abs=`pwd`"/$lib" ;;
-	      esac
-	      newdlprefiles="$newdlprefiles $abs"
 	    done
 	    dlprefiles="$newdlprefiles"
@@ -5257,5 +5311,5 @@
       ;;
     esac
-    exit $EXIT_SUCCESS
+    exit 0
     ;;
 
@@ -5346,5 +5400,5 @@
       $echo "$modename: you must specify an install program" 1>&2
       $echo "$help" 1>&2
-      exit $EXIT_FAILURE
+      exit 1
     fi
 
@@ -5352,5 +5406,5 @@
       $echo "$modename: the \`$prev' option requires an argument" 1>&2
       $echo "$help" 1>&2
-      exit $EXIT_FAILURE
+      exit 1
     fi
 
@@ -5362,5 +5416,5 @@
       fi
       $echo "$help" 1>&2
-      exit $EXIT_FAILURE
+      exit 1
     fi
 
@@ -5383,5 +5437,5 @@
 	$echo "$modename: \`$dest' is not a directory" 1>&2
 	$echo "$help" 1>&2
-	exit $EXIT_FAILURE
+	exit 1
       fi
     fi
@@ -5395,5 +5449,5 @@
 	  $echo "$modename: \`$destdir' must be an absolute directory name" 1>&2
 	  $echo "$help" 1>&2
-	  exit $EXIT_FAILURE
+	  exit 1
 	  ;;
 	esac
@@ -5424,5 +5478,5 @@
 	  $echo "$modename: \`$file' is not a valid libtool archive" 1>&2
 	  $echo "$help" 1>&2
-	  exit $EXIT_FAILURE
+	  exit 1
 	fi
 
@@ -5466,5 +5520,5 @@
 	  if test "$inst_prefix_dir" = "$destdir"; then
 	    $echo "$modename: error: cannot install \`$file' to a directory not ending in $libdir" 1>&2
-	    exit $EXIT_FAILURE
+	    exit 1
 	  fi
 
@@ -5481,5 +5535,5 @@
 	  else
 	    $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
-	    exit $EXIT_FAILURE
+	    exit 1
 	  fi
 	fi
@@ -5516,9 +5570,8 @@
 	  # Do each command in the postinstall commands.
 	  lib="$destdir/$realname"
-	  cmds=$postinstall_cmds
-	  save_ifs="$IFS"; IFS='~'
+	  eval cmds=\"$postinstall_cmds\"
+	  save_ifs="$IFS"; IFS=$_S_
 	  for cmd in $cmds; do
 	    IFS="$save_ifs"
-	    eval cmd=\"$cmd\"
 	    $show "$cmd"
 	    $run eval "$cmd" || exit $?
@@ -5560,5 +5613,5 @@
 	  $echo "$modename: cannot copy a libtool object to \`$destfile'" 1>&2
 	  $echo "$help" 1>&2
-	  exit $EXIT_FAILURE
+	  exit 1
 	  ;;
 	esac
@@ -5578,5 +5631,5 @@
 	  $run eval "$install_prog \$staticobj \$staticdest" || exit $?
 	fi
-	exit $EXIT_SUCCESS
+	exit 0
 	;;
 
@@ -5632,5 +5685,5 @@
 	  if test -z "$notinst_deplibs"; then
 	    $echo "$modename: invalid libtool wrapper script \`$wrapper'" 1>&2
-	    exit $EXIT_FAILURE
+	    exit 1
 	  fi
 
@@ -5673,10 +5726,6 @@
 	      test -n "$TMPDIR" && tmpdir="$TMPDIR"
 	      tmpdir="$tmpdir/libtool-$$"
-	      save_umask=`umask`
-	      umask 0077
-	      if $mkdir "$tmpdir"; then
-	        umask $save_umask
+	      if $mkdir -p "$tmpdir" && chmod 700 "$tmpdir"; then :
 	      else
-	        umask $save_umask
 		$echo "$modename: error: cannot create temporary directory \`$tmpdir'" 1>&2
 		continue
@@ -5737,5 +5786,5 @@
       $run eval "$install_prog \$file \$oldlib" || exit $?
 
-      if test -n "$stripme" && test -n "$old_striplib"; then
+      if test -n "$stripme" && test -n "$striplib"; then
 	$show "$old_striplib $oldlib"
 	$run eval "$old_striplib $oldlib" || exit $?
@@ -5743,9 +5792,8 @@
 
       # Do each command in the postinstall commands.
-      cmds=$old_postinstall_cmds
-      save_ifs="$IFS"; IFS='~'
+      eval cmds=\"$old_postinstall_cmds\"
+      save_ifs="$IFS"; IFS=$_S_
       for cmd in $cmds; do
 	IFS="$save_ifs"
-	eval cmd=\"$cmd\"
 	$show "$cmd"
 	$run eval "$cmd" || exit $?
@@ -5761,7 +5809,7 @@
       # Maybe just do a dry run.
       test -n "$run" && current_libdirs=" -n$current_libdirs"
-      exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs'
+      exec_cmd='$SHELL $0 --finish$current_libdirs'
     else
-      exit $EXIT_SUCCESS
+      exit 0
     fi
     ;;
@@ -5782,9 +5830,8 @@
 	if test -n "$finish_cmds"; then
 	  # Do each command in the finish commands.
-	  cmds=$finish_cmds
-	  save_ifs="$IFS"; IFS='~'
+	  eval cmds=\"$finish_cmds\"
+	  save_ifs="$IFS"; IFS=$_S_
 	  for cmd in $cmds; do
 	    IFS="$save_ifs"
-	    eval cmd=\"$cmd\"
 	    $show "$cmd"
 	    $run eval "$cmd" || admincmds="$admincmds
@@ -5803,5 +5850,5 @@
 
     # Exit here if they wanted silent mode.
-    test "$show" = : && exit $EXIT_SUCCESS
+    test "$show" = : && exit 0
 
     $echo "----------------------------------------------------------------------"
@@ -5839,5 +5886,5 @@
     $echo "more information, such as the ld(1) and ld.so(8) manual pages."
     $echo "----------------------------------------------------------------------"
-    exit $EXIT_SUCCESS
+    exit 0
     ;;
 
@@ -5851,5 +5898,5 @@
       $echo "$modename: you must specify a COMMAND" 1>&2
       $echo "$help"
-      exit $EXIT_FAILURE
+      exit 1
     fi
 
@@ -5859,5 +5906,5 @@
 	$echo "$modename: \`$file' is not a file" 1>&2
 	$echo "$help" 1>&2
-	exit $EXIT_FAILURE
+	exit 1
       fi
 
@@ -5870,5 +5917,5 @@
 	  $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
 	  $echo "$help" 1>&2
-	  exit $EXIT_FAILURE
+	  exit 1
 	fi
 
@@ -5897,5 +5944,5 @@
 	else
 	  $echo "$modename: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2
-	  exit $EXIT_FAILURE
+	  exit 1
 	fi
 	;;
@@ -5969,5 +6016,5 @@
 
       # Now prepare to actually exec the command.
-      exec_cmd="\"\$cmd\"$args"
+      exec_cmd="\$cmd$args"
     else
       # Display what would be done.
@@ -5976,6 +6023,6 @@
 	$echo "export $shlibpath_var"
       fi
-      eval \$echo \"\$cmd\"$args
-      exit $EXIT_SUCCESS
+      $echo "$cmd$args"
+      exit 0
     fi
     ;;
@@ -6005,5 +6052,5 @@
       $echo "$modename: you must specify an RM program" 1>&2
       $echo "$help" 1>&2
-      exit $EXIT_FAILURE
+      exit 1
     fi
 
@@ -6060,9 +6107,8 @@
 	    if test -n "$library_names"; then
 	      # Do each command in the postuninstall commands.
-	      cmds=$postuninstall_cmds
-	      save_ifs="$IFS"; IFS='~'
+	      eval cmds=\"$postuninstall_cmds\"
+	      save_ifs="$IFS"; IFS=$_S_
 	      for cmd in $cmds; do
 		IFS="$save_ifs"
-		eval cmd=\"$cmd\"
 		$show "$cmd"
 		$run eval "$cmd"
@@ -6076,9 +6122,8 @@
 	    if test -n "$old_library"; then
 	      # Do each command in the old_postuninstall commands.
-	      cmds=$old_postuninstall_cmds
-	      save_ifs="$IFS"; IFS='~'
+	      eval cmds=\"$old_postuninstall_cmds\"
+	      save_ifs="$IFS"; IFS=$_S_
 	      for cmd in $cmds; do
 		IFS="$save_ifs"
-		eval cmd=\"$cmd\"
 		$show "$cmd"
 		$run eval "$cmd"
@@ -6119,5 +6164,5 @@
 	  noexename=$name
 	  case $file in
-	  *.exe)
+	  *.exe) 
 	    file=`$echo $file|${SED} 's,.exe$,,'`
 	    noexename=`$echo $name|${SED} 's,.exe$,,'`
@@ -6164,5 +6209,5 @@
     $echo "$modename: you must specify a MODE" 1>&2
     $echo "$generic_help" 1>&2
-    exit $EXIT_FAILURE
+    exit 1
     ;;
   esac
@@ -6171,5 +6216,5 @@
     $echo "$modename: invalid operation mode \`$mode'" 1>&2
     $echo "$generic_help" 1>&2
-    exit $EXIT_FAILURE
+    exit 1
   fi
 fi # test -z "$show_help"
@@ -6177,5 +6222,5 @@
 if test -n "$exec_cmd"; then
   eval exec $exec_cmd
-  exit $EXIT_FAILURE
+  exit 1
 fi
 
@@ -6213,5 +6258,5 @@
 
 Report bugs to <bug-libtool@gnu.org>."
-  exit $EXIT_SUCCESS
+  exit 0
   ;;
 
@@ -6325,6 +6370,4 @@
   -o OUTPUT-FILE    create OUTPUT-FILE from the specified objects
   -objectlist FILE  Use a list of object files found in FILE to specify objects
-  -precious-files-regex REGEX
-                    don't remove output files matching REGEX
   -release RELEASE  specify package release information
   -rpath LIBDIR     the created library will eventually be installed in LIBDIR
@@ -6368,5 +6411,5 @@
   $echo "$modename: invalid operation mode \`$mode'" 1>&2
   $echo "$help" 1>&2
-  exit $EXIT_FAILURE
+  exit 1
   ;;
 esac
@@ -6375,5 +6418,5 @@
 $echo "Try \`$modename --help' for more information about other modes."
 
-exit $EXIT_SUCCESS
+exit 0
 
 # The TAGs below are defined such that we never get into a situation
