ltmain.sh
changeset 248 b347450523a6
parent 240 df2d45dbed91
child 292 bc9ab72cd7ff
     1.1 --- a/ltmain.sh	Tue Aug 24 07:49:17 2004 +0000
     1.2 +++ b/ltmain.sh	Tue Aug 24 07:54:43 2004 +0000
     1.3 @@ -1,7 +1,8 @@
     1.4 +# Based on libtool-1.5.8
     1.5  # ltmain.sh - Provide generalized library-building support services.
     1.6  # NOTE: Changing this file will not affect anything until you rerun configure.
     1.7  #
     1.8 -# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003
     1.9 +# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004
    1.10  # Free Software Foundation, Inc.
    1.11  # Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
    1.12  #
    1.13 @@ -24,6 +25,34 @@
    1.14  # configuration script generated by Autoconf, you may include it under
    1.15  # the same distribution terms that you use for the rest of that program.
    1.16  
    1.17 +basename="s,^.*/,,g"
    1.18 +
    1.19 +# Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh
    1.20 +# is ksh but when the shell is invoked as "sh" and the current value of
    1.21 +# the _XPG environment variable is not equal to 1 (one), the special
    1.22 +# positional parameter $0, within a function call, is the name of the
    1.23 +# function.
    1.24 +progpath="$0"
    1.25 +
    1.26 +# The name of this program:
    1.27 +progname=`echo "$progpath" | $SED $basename`
    1.28 +modename="$progname"
    1.29 +
    1.30 +# Global variables:
    1.31 +EXIT_SUCCESS=0
    1.32 +EXIT_FAILURE=1
    1.33 +
    1.34 +PROGRAM=ltmain.sh
    1.35 +PACKAGE=libtool
    1.36 +VERSION=1.5.8
    1.37 +TIMESTAMP=" (1.1220.2.117 2004/08/04 14:12:05)"
    1.38 +
    1.39 +# See if we are running on zsh, and set the options which allow our
    1.40 +# commands through without removal of \ escapes.
    1.41 +if test -n "${ZSH_VERSION+set}" ; then
    1.42 +  setopt NO_GLOB_SUBST
    1.43 +fi
    1.44 +
    1.45  # Check that we have a working $echo.
    1.46  if test "X$1" = X--no-reexec; then
    1.47    # Discard the --no-reexec flag, and continue.
    1.48 @@ -36,7 +65,7 @@
    1.49    :
    1.50  else
    1.51    # Restart under the correct shell, and then maybe $echo will work.
    1.52 -  exec $SHELL "$0" --no-reexec ${1+"$@"}
    1.53 +  exec $SHELL "$progpath" --no-reexec ${1+"$@"}
    1.54  fi
    1.55  
    1.56  if test "X$1" = X--fallback-echo; then
    1.57 @@ -45,19 +74,9 @@
    1.58    cat <<EOF
    1.59  $*
    1.60  EOF
    1.61 -  exit 0
    1.62 +  exit $EXIT_SUCCESS
    1.63  fi
    1.64  
    1.65 -# The name of this program.
    1.66 -progname=`$echo "$0" | ${SED} 's%^.*/%%'`
    1.67 -modename="$progname"
    1.68 -
    1.69 -# Constants.
    1.70 -PROGRAM=ltmain.sh
    1.71 -PACKAGE=libtool
    1.72 -VERSION=1.5
    1.73 -TIMESTAMP=" (1.1220.2.1 2003/04/14 22:48:00)"
    1.74 -
    1.75  default_mode=
    1.76  help="Try \`$progname --help' for more information."
    1.77  magic="%%%MAGIC variable%%%"
    1.78 @@ -70,8 +89,8 @@
    1.79  Xsed="${SED}"' -e 1s/^X//'
    1.80  sed_quote_subst='s/\([\\`\\"$\\\\]\)/\\\1/g'
    1.81  # test EBCDIC or ASCII
    1.82 -case `echo A|od -x` in
    1.83 - *[Cc]1*) # EBCDIC based system
    1.84 +case `echo A|tr A '\301'` in
    1.85 + A) # EBCDIC based system
    1.86    SP2NL="tr '\100' '\n'"
    1.87    NL2SP="tr '\r\n' '\100\100'"
    1.88    ;;
    1.89 @@ -94,12 +113,13 @@
    1.90  fi
    1.91  
    1.92  # Make sure IFS has a sensible default
    1.93 -: ${IFS=" 	"}
    1.94 +: ${IFS=" 	
    1.95 +"}
    1.96  
    1.97  if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
    1.98    $echo "$modename: not configured to build any kind of library" 1>&2
    1.99    $echo "Fatal configuration error.  See the $PACKAGE docs for more information." 1>&2
   1.100 -  exit 1
   1.101 +  exit $EXIT_FAILURE
   1.102  fi
   1.103  
   1.104  # Global variables.
   1.105 @@ -118,10 +138,13 @@
   1.106  # Shell function definitions:
   1.107  # This seems to be the best place for them
   1.108  
   1.109 +# func_win32_libid arg
   1.110 +# return the library type of file 'arg'
   1.111 +#
   1.112  # Need a lot of goo to handle *both* DLLs and import libs
   1.113  # Has to be a shell function in order to 'eat' the argument
   1.114  # that is supplied when $file_magic_command is called.
   1.115 -win32_libid () {
   1.116 +func_win32_libid () {
   1.117    win32_libid_type="unknown"
   1.118    win32_fileres=`file -L $1 2>/dev/null`
   1.119    case $win32_fileres in
   1.120 @@ -130,7 +153,7 @@
   1.121      ;;
   1.122    *ar\ archive*) # could be an import, or static
   1.123      if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | \
   1.124 -      grep -E 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then
   1.125 +      $EGREP -e 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then
   1.126        win32_nmres=`eval $NM -f posix -A $1 | \
   1.127  	sed -n -e '1,100{/ I /{x;/import/!{s/^/import/;h;p;};x;};}'`
   1.128        if test "X$win32_nmres" = "Ximport" ; then
   1.129 @@ -140,7 +163,7 @@
   1.130        fi
   1.131      fi
   1.132      ;;
   1.133 -  *DLL*) 
   1.134 +  *DLL*)
   1.135      win32_libid_type="x86 DLL"
   1.136      ;;
   1.137    *executable*) # but shell scripts are "executable" too...
   1.138 @@ -154,9 +177,192 @@
   1.139    $echo $win32_libid_type
   1.140  }
   1.141  
   1.142 +
   1.143 +# func_infer_tag arg
   1.144 +# Infer tagged configuration to use if any are available and
   1.145 +# if one wasn't chosen via the "--tag" command line option.
   1.146 +# Only attempt this if the compiler in the base compile
   1.147 +# command doesn't match the default compiler.
   1.148 +# arg is usually of the form 'gcc ...'
   1.149 +func_infer_tag () {
   1.150 +    if test -n "$available_tags" && test -z "$tagname"; then
   1.151 +      CC_quoted=
   1.152 +      for arg in $CC; do
   1.153 +	case $arg in
   1.154 +	  *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
   1.155 +	  arg="\"$arg\""
   1.156 +	  ;;
   1.157 +	esac
   1.158 +	CC_quoted="$CC_quoted $arg"
   1.159 +      done
   1.160 +      case $@ in
   1.161 +      # Blanks in the command may have been stripped by the calling shell,
   1.162 +      # but not from the CC environment variable when configure was run.
   1.163 +      " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*) ;;
   1.164 +      # Blanks at the start of $base_compile will cause this to fail
   1.165 +      # if we don't check for them as well.
   1.166 +      *)
   1.167 +	for z in $available_tags; do
   1.168 +	  if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then
   1.169 +	    # Evaluate the configuration.
   1.170 +	    eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`"
   1.171 +	    CC_quoted=
   1.172 +	    for arg in $CC; do
   1.173 +	    # Double-quote args containing other shell metacharacters.
   1.174 +	    case $arg in
   1.175 +	      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
   1.176 +	      arg="\"$arg\""
   1.177 +	      ;;
   1.178 +	    esac
   1.179 +	    CC_quoted="$CC_quoted $arg"
   1.180 +	  done
   1.181 +	    case "$@ " in
   1.182 +	      " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*)
   1.183 +	      # The compiler in the base compile command matches
   1.184 +	      # the one in the tagged configuration.
   1.185 +	      # Assume this is the tagged configuration we want.
   1.186 +	      tagname=$z
   1.187 +	      break
   1.188 +	      ;;
   1.189 +	    esac
   1.190 +	  fi
   1.191 +	done
   1.192 +	# If $tagname still isn't set, then no tagged configuration
   1.193 +	# was found and let the user know that the "--tag" command
   1.194 +	# line option must be used.
   1.195 +	if test -z "$tagname"; then
   1.196 +	  $echo "$modename: unable to infer tagged configuration"
   1.197 +	  $echo "$modename: specify a tag with \`--tag'" 1>&2
   1.198 +	  exit $EXIT_FAILURE
   1.199 +#        else
   1.200 +#          $echo "$modename: using $tagname tagged configuration"
   1.201 +	fi
   1.202 +	;;
   1.203 +      esac
   1.204 +    fi
   1.205 +}
   1.206 +
   1.207 +
   1.208 +# func_extract_archives gentop oldlib ...
   1.209 +func_extract_archives () {
   1.210 +    my_gentop="$1"; shift
   1.211 +    my_oldlibs=${1+"$@"}
   1.212 +    my_oldobjs=""
   1.213 +    my_xlib=""
   1.214 +    my_xabs=""
   1.215 +    my_xdir=""
   1.216 +    my_status=""
   1.217 +
   1.218 +    $show "${rm}r $my_gentop"
   1.219 +    $run ${rm}r "$my_gentop"
   1.220 +    $show "$mkdir $my_gentop"
   1.221 +    $run $mkdir "$my_gentop"
   1.222 +    my_status=$?
   1.223 +    if test "$my_status" -ne 0 && test ! -d "$my_gentop"; then
   1.224 +      exit $my_status
   1.225 +    fi
   1.226 +
   1.227 +    for my_xlib in $my_oldlibs; do
   1.228 +      # Extract the objects.
   1.229 +      case $my_xlib in
   1.230 +	[\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;;
   1.231 +	*) my_xabs=`pwd`"/$my_xlib" ;;
   1.232 +      esac
   1.233 +      my_xlib=`$echo "X$my_xlib" | $Xsed -e 's%^.*/%%'`
   1.234 +      my_xdir="$my_gentop/$my_xlib"
   1.235 +
   1.236 +      $show "${rm}r $my_xdir"
   1.237 +      $run ${rm}r "$my_xdir"
   1.238 +      $show "$mkdir $my_xdir"
   1.239 +      $run $mkdir "$my_xdir"
   1.240 +      status=$?
   1.241 +      if test "$status" -ne 0 && test ! -d "$my_xdir"; then
   1.242 +	exit $status
   1.243 +      fi
   1.244 +      case $host in
   1.245 +      *-darwin*)
   1.246 +	$show "Extracting $my_xabs"
   1.247 +	# Do not bother doing anything if just a dry run
   1.248 +	if test -z "$run"; then
   1.249 +	  darwin_orig_dir=`pwd`
   1.250 +	  cd $my_xdir || exit $?
   1.251 +	  darwin_archive=$my_xabs
   1.252 +	  darwin_curdir=`pwd`
   1.253 +	  darwin_base_archive=`basename $darwin_archive`
   1.254 +	  darwin_arches=`lipo -info "$darwin_archive" 2>/dev/null | $EGREP Architectures 2>/dev/null`
   1.255 +	  if test -n "$darwin_arches"; then 
   1.256 +	    darwin_arches=`echo "$darwin_arches" | $SED -e 's/.*are://'`
   1.257 +	    darwin_arch=
   1.258 +	    $show "$darwin_base_archive has multiple architectures $darwin_arches"
   1.259 +	    for darwin_arch in  $darwin_arches ; do
   1.260 +	      mkdir -p "unfat-$$/${darwin_base_archive}-${darwin_arch}"
   1.261 +	      lipo -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}"
   1.262 +	      # Remove the table of contents from the thin files.
   1.263 +	      $AR -d "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" __.SYMDEF 2>/dev/null || true
   1.264 +	      $AR -d "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" __.SYMDEF\ SORTED 2>/dev/null || true
   1.265 +	      cd "unfat-$$/${darwin_base_archive}-${darwin_arch}"
   1.266 +	      $AR -xo "${darwin_base_archive}"
   1.267 +	      rm "${darwin_base_archive}"
   1.268 +	      cd "$darwin_curdir"
   1.269 +	    done # $darwin_arches
   1.270 +      ## Okay now we have a bunch of thin objects, gotta fatten them up :)
   1.271 +	    darwin_filelist=`find unfat-$$ -type f | xargs basename | sort -u | $NL2SP`
   1.272 +	    darwin_file=
   1.273 +	    darwin_files=
   1.274 +	    for darwin_file in $darwin_filelist; do
   1.275 +	      darwin_files=`find unfat-$$ -name $darwin_file -print | $NL2SP`
   1.276 +	      lipo -create -output "$darwin_file" $darwin_files
   1.277 +	    done # $darwin_filelist
   1.278 +	    rm -rf unfat-$$
   1.279 +	    cd "$darwin_orig_dir"
   1.280 +	  else
   1.281 +	    cd $darwin_orig_dir
   1.282 +	    (cd $my_xdir && $AR x $my_xabs) || exit $?
   1.283 +	  fi # $darwin_arches
   1.284 +	fi # $run
   1.285 +      ;;
   1.286 +      *)
   1.287 +	# We will extract separately just the conflicting names and we will
   1.288 +	# no longer touch any unique names. It is faster to leave these
   1.289 +	# extract automatically by $AR in one run.
   1.290 +	$show "(cd $my_xdir && $AR x $my_xabs)"
   1.291 +	$run eval "(cd \$my_xdir && $AR x \$my_xabs)" || exit $?
   1.292 +	if ($AR t "$my_xabs" | sort | sort -uc >/dev/null 2>&1); then
   1.293 +	  :
   1.294 +	else
   1.295 +	  $echo "$modename: warning: object name conflicts; renaming object files" 1>&2
   1.296 +	  $echo "$modename: warning: to ensure that they will not overwrite" 1>&2
   1.297 +	  $AR t "$my_xabs" | sort | uniq -cd | while read -r count name
   1.298 +	  do
   1.299 +	    i=1
   1.300 +	    while test "$i" -le "$count"
   1.301 +	    do
   1.302 +	      # Put our $i before any first dot (extension)
   1.303 +	      # Never overwrite any file
   1.304 +	      name_to="$name"
   1.305 +	      while test "X$name_to" = "X$name" || test -f "$my_xdir/$name_to"
   1.306 +	      do
   1.307 +		name_to=`$echo "X$name_to" | $Xsed -e "s/\([^.]*\)/\1-$i/"`
   1.308 +	      done
   1.309 +	      $show "(cd $my_xdir && $AR xN $i $my_xabs '$name' && $mv '$name' '$name_to')"
   1.310 +	      $run eval "(cd \$my_xdir && $AR xN $i \$my_xabs '$name' && $mv '$name' '$name_to')" || exit $?
   1.311 +	      i=`expr $i + 1`
   1.312 +	    done
   1.313 +	  done
   1.314 +	fi
   1.315 +	;;
   1.316 +      esac
   1.317 +      my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP`
   1.318 +    done
   1.319 +
   1.320 +    func_extract_archives_result="$my_oldobjs"
   1.321 +}
   1.322  # End of Shell function definitions
   1.323  #####################################
   1.324  
   1.325 +# Darwin sucks
   1.326 +eval std_shrext=\"$shrext_cmds\"
   1.327 +
   1.328  # Parse our command line options once, thoroughly.
   1.329  while test "$#" -gt 0
   1.330  do
   1.331 @@ -176,12 +382,13 @@
   1.332        ;;
   1.333      tag)
   1.334        tagname="$arg"
   1.335 +      preserve_args="${preserve_args}=$arg"
   1.336  
   1.337        # Check whether tagname contains only valid characters
   1.338        case $tagname in
   1.339        *[!-_A-Za-z0-9,/]*)
   1.340  	$echo "$progname: invalid tag name: $tagname" 1>&2
   1.341 -	exit 1
   1.342 +	exit $EXIT_FAILURE
   1.343  	;;
   1.344        esac
   1.345  
   1.346 @@ -191,10 +398,10 @@
   1.347  	# not specially marked.
   1.348  	;;
   1.349        *)
   1.350 -	if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "$0" > /dev/null; then
   1.351 +	if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "$progpath" > /dev/null; then
   1.352  	  taglist="$taglist $tagname"
   1.353  	  # Evaluate the configuration.
   1.354 -	  eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$tagname'$/,/^# ### END LIBTOOL TAG CONFIG: '$tagname'$/p' < $0`"
   1.355 +	  eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$tagname'$/,/^# ### END LIBTOOL TAG CONFIG: '$tagname'$/p' < $progpath`"
   1.356  	else
   1.357  	  $echo "$progname: ignoring unknown tag $tagname" 1>&2
   1.358  	fi
   1.359 @@ -223,21 +430,22 @@
   1.360      $echo "Copyright (C) 2003  Free Software Foundation, Inc."
   1.361      $echo "This is free software; see the source for copying conditions.  There is NO"
   1.362      $echo "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
   1.363 -    exit 0
   1.364 +    exit $EXIT_SUCCESS
   1.365      ;;
   1.366  
   1.367    --config)
   1.368 -    ${SED} -e '1,/^# ### BEGIN LIBTOOL CONFIG/d' -e '/^# ### END LIBTOOL CONFIG/,$d' $0
   1.369 +    ${SED} -e '1,/^# ### BEGIN LIBTOOL CONFIG/d' -e '/^# ### END LIBTOOL CONFIG/,$d' $progpath
   1.370      # Now print the configurations for the tags.
   1.371      for tagname in $taglist; do
   1.372 -      ${SED} -n -e "/^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$/,/^# ### END LIBTOOL TAG CONFIG: $tagname$/p" < "$0"
   1.373 +      ${SED} -n -e "/^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$/,/^# ### END LIBTOOL TAG CONFIG: $tagname$/p" < "$progpath"
   1.374      done
   1.375 -    exit 0
   1.376 +    exit $EXIT_SUCCESS
   1.377      ;;
   1.378  
   1.379    --debug)
   1.380      $echo "$progname: enabling shell trace mode"
   1.381      set -x
   1.382 +    preserve_args="$preserve_args $arg"
   1.383      ;;
   1.384  
   1.385    --dry-run | -n)
   1.386 @@ -256,7 +464,7 @@
   1.387      else
   1.388        $echo "disable static libraries"
   1.389      fi
   1.390 -    exit 0
   1.391 +    exit $EXIT_SUCCESS
   1.392      ;;
   1.393  
   1.394    --finish) mode="finish" ;;
   1.395 @@ -268,6 +476,7 @@
   1.396  
   1.397    --quiet | --silent)
   1.398      show=:
   1.399 +    preserve_args="$preserve_args $arg"
   1.400      ;;
   1.401  
   1.402    --tag) prevopt="--tag" prev=tag ;;
   1.403 @@ -275,6 +484,7 @@
   1.404      set tag "$optarg" ${1+"$@"}
   1.405      shift
   1.406      prev=tag
   1.407 +    preserve_args="$preserve_args --tag"
   1.408      ;;
   1.409  
   1.410    -dlopen)
   1.411 @@ -285,7 +495,7 @@
   1.412    -*)
   1.413      $echo "$modename: unrecognized option \`$arg'" 1>&2
   1.414      $echo "$help" 1>&2
   1.415 -    exit 1
   1.416 +    exit $EXIT_FAILURE
   1.417      ;;
   1.418  
   1.419    *)
   1.420 @@ -298,7 +508,7 @@
   1.421  if test -n "$prevopt"; then
   1.422    $echo "$modename: option \`$prevopt' requires an argument" 1>&2
   1.423    $echo "$help" 1>&2
   1.424 -  exit 1
   1.425 +  exit $EXIT_FAILURE
   1.426  fi
   1.427  
   1.428  # If this variable is set in any of the actions, the command in it
   1.429 @@ -354,7 +564,7 @@
   1.430    if test -n "$execute_dlfiles" && test "$mode" != execute; then
   1.431      $echo "$modename: unrecognized option \`-dlopen'" 1>&2
   1.432      $echo "$help" 1>&2
   1.433 -    exit 1
   1.434 +    exit $EXIT_FAILURE
   1.435    fi
   1.436  
   1.437    # Change the help message to a mode-specific one.
   1.438 @@ -369,9 +579,11 @@
   1.439      # Get the compilation command and the source file.
   1.440      base_compile=
   1.441      srcfile="$nonopt"  #  always keep a non-empty value in "srcfile"
   1.442 +    suppress_opt=yes
   1.443      suppress_output=
   1.444      arg_mode=normal
   1.445      libobj=
   1.446 +    later=
   1.447  
   1.448      for arg
   1.449      do
   1.450 @@ -394,24 +606,19 @@
   1.451  	-o)
   1.452  	  if test -n "$libobj" ; then
   1.453  	    $echo "$modename: you cannot specify \`-o' more than once" 1>&2
   1.454 -	    exit 1
   1.455 +	    exit $EXIT_FAILURE
   1.456  	  fi
   1.457  	  arg_mode=target
   1.458  	  continue
   1.459  	  ;;
   1.460  
   1.461 -	-static)
   1.462 -	  build_old_libs=yes
   1.463 +	-static | -prefer-pic | -prefer-non-pic)
   1.464 +	  later="$later $arg"
   1.465  	  continue
   1.466  	  ;;
   1.467  
   1.468 -	-prefer-pic)
   1.469 -	  pic_mode=yes
   1.470 -	  continue
   1.471 -	  ;;
   1.472 -
   1.473 -	-prefer-non-pic)
   1.474 -	  pic_mode=no
   1.475 +	-no-suppress)
   1.476 +	  suppress_opt=no
   1.477  	  continue
   1.478  	  ;;
   1.479  
   1.480 @@ -424,7 +631,7 @@
   1.481  	  args=`$echo "X$arg" | $Xsed -e "s/^-Wc,//"`
   1.482  	  lastarg=
   1.483  	  save_ifs="$IFS"; IFS=','
   1.484 -	  for arg in $args; do
   1.485 + 	  for arg in $args; do
   1.486  	    IFS="$save_ifs"
   1.487  
   1.488  	    # Double-quote args containing other shell metacharacters.
   1.489 @@ -474,11 +681,11 @@
   1.490      case $arg_mode in
   1.491      arg)
   1.492        $echo "$modename: you must specify an argument for -Xcompile"
   1.493 -      exit 1
   1.494 +      exit $EXIT_FAILURE
   1.495        ;;
   1.496      target)
   1.497        $echo "$modename: you must specify a target with \`-o'" 1>&2
   1.498 -      exit 1
   1.499 +      exit $EXIT_FAILURE
   1.500        ;;
   1.501      *)
   1.502        # Get the name of the library object.
   1.503 @@ -511,50 +718,30 @@
   1.504      *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;;
   1.505      *)
   1.506        $echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2
   1.507 -      exit 1
   1.508 +      exit $EXIT_FAILURE
   1.509        ;;
   1.510      esac
   1.511  
   1.512 -    # Infer tagged configuration to use if any are available and
   1.513 -    # if one wasn't chosen via the "--tag" command line option.
   1.514 -    # Only attempt this if the compiler in the base compile
   1.515 -    # command doesn't match the default compiler.
   1.516 -    if test -n "$available_tags" && test -z "$tagname"; then
   1.517 -      case $base_compile in
   1.518 -      # Blanks in the command may have been stripped by the calling shell,
   1.519 -      # but not from the CC environment variable when configure was run.
   1.520 -      " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "*) ;;
   1.521 -      # Blanks at the start of $base_compile will cause this to fail
   1.522 -      # if we don't check for them as well.
   1.523 -      *)
   1.524 -	for z in $available_tags; do
   1.525 -	  if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$0" > /dev/null; then
   1.526 -	    # Evaluate the configuration.
   1.527 -	    eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $0`"
   1.528 -	    case "$base_compile " in
   1.529 -	    "$CC "* | " $CC "* | "`$echo $CC` "* | " `$echo $CC` "*)
   1.530 -	      # The compiler in the base compile command matches
   1.531 -	      # the one in the tagged configuration.
   1.532 -	      # Assume this is the tagged configuration we want.
   1.533 -	      tagname=$z
   1.534 -	      break
   1.535 -	      ;;
   1.536 -	    esac
   1.537 -	  fi
   1.538 -	done
   1.539 -	# If $tagname still isn't set, then no tagged configuration
   1.540 -	# was found and let the user know that the "--tag" command
   1.541 -	# line option must be used.
   1.542 -	if test -z "$tagname"; then
   1.543 -	  $echo "$modename: unable to infer tagged configuration"
   1.544 -	  $echo "$modename: specify a tag with \`--tag'" 1>&2
   1.545 -	  exit 1
   1.546 -#        else
   1.547 -#          $echo "$modename: using $tagname tagged configuration"
   1.548 -	fi
   1.549 +    func_infer_tag $base_compile
   1.550 +
   1.551 +    for arg in $later; do
   1.552 +      case $arg in
   1.553 +      -static)
   1.554 +	build_old_libs=yes
   1.555 +	continue
   1.556 +	;;
   1.557 +
   1.558 +      -prefer-pic)
   1.559 +	pic_mode=yes
   1.560 +	continue
   1.561 +	;;
   1.562 +
   1.563 +      -prefer-non-pic)
   1.564 +	pic_mode=no
   1.565 +	continue
   1.566  	;;
   1.567        esac
   1.568 -    fi
   1.569 +    done
   1.570  
   1.571      objname=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
   1.572      xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'`
   1.573 @@ -568,7 +755,7 @@
   1.574      if test -z "$base_compile"; then
   1.575        $echo "$modename: you must specify a compilation command" 1>&2
   1.576        $echo "$help" 1>&2
   1.577 -      exit 1
   1.578 +      exit $EXIT_FAILURE
   1.579      fi
   1.580  
   1.581      # Delete any leftover library objects.
   1.582 @@ -579,7 +766,7 @@
   1.583      fi
   1.584  
   1.585      $run $rm $removelist
   1.586 -    trap "$run $rm $removelist; exit 1" 1 2 15
   1.587 +    trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15
   1.588  
   1.589      # On Cygwin there's no "real" PIC flag so we must build both object types
   1.590      case $host_os in
   1.591 @@ -598,7 +785,7 @@
   1.592        output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext}
   1.593        lockfile="$output_obj.lock"
   1.594        removelist="$removelist $output_obj $lockfile"
   1.595 -      trap "$run $rm $removelist; exit 1" 1 2 15
   1.596 +      trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15
   1.597      else
   1.598        output_obj=
   1.599        need_locks=no
   1.600 @@ -608,7 +795,7 @@
   1.601      # Lock this critical section if it is needed
   1.602      # We use this script file to make the link, it avoids creating a new file
   1.603      if test "$need_locks" = yes; then
   1.604 -      until $run ln "$0" "$lockfile" 2>/dev/null; do
   1.605 +      until $run ln "$progpath" "$lockfile" 2>/dev/null; do
   1.606  	$show "Waiting for $lockfile to be removed"
   1.607  	sleep 2
   1.608        done
   1.609 @@ -626,7 +813,7 @@
   1.610  compiler."
   1.611  
   1.612  	$run $rm $removelist
   1.613 -	exit 1
   1.614 +	exit $EXIT_FAILURE
   1.615        fi
   1.616        $echo $srcfile > "$lockfile"
   1.617      fi
   1.618 @@ -681,7 +868,7 @@
   1.619        if $run eval "$command"; then :
   1.620        else
   1.621  	test -n "$output_obj" && $run $rm $removelist
   1.622 -	exit 1
   1.623 +	exit $EXIT_FAILURE
   1.624        fi
   1.625  
   1.626        if test "$need_locks" = warn &&
   1.627 @@ -701,7 +888,7 @@
   1.628  compiler."
   1.629  
   1.630  	$run $rm $removelist
   1.631 -	exit 1
   1.632 +	exit $EXIT_FAILURE
   1.633        fi
   1.634  
   1.635        # Just move the object if needed, then go on to compile the next one
   1.636 @@ -722,7 +909,9 @@
   1.637  EOF
   1.638  
   1.639        # Allow error messages only from the first compilation.
   1.640 -      suppress_output=' >/dev/null 2>&1'
   1.641 +      if test "$suppress_opt" = yes; then
   1.642 +        suppress_output=' >/dev/null 2>&1'
   1.643 +      fi
   1.644      else
   1.645        # No PIC object so indicate it doesn't exist in the libtool
   1.646        # object file.
   1.647 @@ -751,7 +940,7 @@
   1.648        if $run eval "$command"; then :
   1.649        else
   1.650  	$run $rm $removelist
   1.651 -	exit 1
   1.652 +	exit $EXIT_FAILURE
   1.653        fi
   1.654  
   1.655        if test "$need_locks" = warn &&
   1.656 @@ -771,7 +960,7 @@
   1.657  compiler."
   1.658  
   1.659  	$run $rm $removelist
   1.660 -	exit 1
   1.661 +	exit $EXIT_FAILURE
   1.662        fi
   1.663  
   1.664        # Just move the object if needed
   1.665 @@ -809,7 +998,7 @@
   1.666        $run $rm "$lockfile"
   1.667      fi
   1.668  
   1.669 -    exit 0
   1.670 +    exit $EXIT_SUCCESS
   1.671      ;;
   1.672  
   1.673    # libtool link mode
   1.674 @@ -835,7 +1024,7 @@
   1.675        ;;
   1.676      esac
   1.677      libtool_args="$nonopt"
   1.678 -    base_compile="$nonopt"
   1.679 +    base_compile="$nonopt $@"
   1.680      compile_command="$nonopt"
   1.681      finalize_command="$nonopt"
   1.682  
   1.683 @@ -867,6 +1056,7 @@
   1.684      no_install=no
   1.685      objs=
   1.686      non_pic_objects=
   1.687 +    precious_files_regex=
   1.688      prefer_static_libs=no
   1.689      preload=no
   1.690      prev=
   1.691 @@ -880,6 +1070,8 @@
   1.692      vinfo=
   1.693      vinfo_number=no
   1.694  
   1.695 +    func_infer_tag $base_compile
   1.696 +
   1.697      # We need to know -static, to get the right output filenames.
   1.698      for arg
   1.699      do
   1.700 @@ -911,7 +1103,6 @@
   1.701      # Go through the arguments, transforming them on the way.
   1.702      while test "$#" -gt 0; do
   1.703        arg="$1"
   1.704 -      base_compile="$base_compile $arg"
   1.705        shift
   1.706        case $arg in
   1.707        *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
   1.708 @@ -975,7 +1166,7 @@
   1.709  	  export_symbols="$arg"
   1.710  	  if test ! -f "$arg"; then
   1.711  	    $echo "$modename: symbol file \`$arg' does not exist"
   1.712 -	    exit 1
   1.713 +	    exit $EXIT_FAILURE
   1.714  	  fi
   1.715  	  prev=
   1.716  	  continue
   1.717 @@ -990,6 +1181,11 @@
   1.718  	  prev=
   1.719  	  continue
   1.720  	  ;;
   1.721 +	precious_regex)
   1.722 +	  precious_files_regex="$arg"
   1.723 +	  prev=
   1.724 +	  continue
   1.725 +	  ;;
   1.726  	release)
   1.727  	  release="-$arg"
   1.728  	  prev=
   1.729 @@ -1022,7 +1218,7 @@
   1.730  		   test "$pic_object" = none && \
   1.731  		   test "$non_pic_object" = none; then
   1.732  		  $echo "$modename: cannot find name of object for \`$arg'" 1>&2
   1.733 -		  exit 1
   1.734 +		  exit $EXIT_FAILURE
   1.735  		fi
   1.736  
   1.737  		# Extract subdirectory from the argument.
   1.738 @@ -1075,7 +1271,7 @@
   1.739  		# Only an error if not doing a dry-run.
   1.740  		if test -z "$run"; then
   1.741  		  $echo "$modename: \`$arg' is not a valid libtool object" 1>&2
   1.742 -		  exit 1
   1.743 +		  exit $EXIT_FAILURE
   1.744  		else
   1.745  		  # Dry-run case.
   1.746  
   1.747 @@ -1096,7 +1292,7 @@
   1.748  	    done
   1.749  	  else
   1.750  	    $echo "$modename: link input file \`$save_arg' does not exist"
   1.751 -	    exit 1
   1.752 +	    exit $EXIT_FAILURE
   1.753  	  fi
   1.754  	  arg=$save_arg
   1.755  	  prev=
   1.756 @@ -1108,7 +1304,7 @@
   1.757  	  [\\/]* | [A-Za-z]:[\\/]*) ;;
   1.758  	  *)
   1.759  	    $echo "$modename: only absolute run-paths are allowed" 1>&2
   1.760 -	    exit 1
   1.761 +	    exit $EXIT_FAILURE
   1.762  	    ;;
   1.763  	  esac
   1.764  	  if test "$prev" = rpath; then
   1.765 @@ -1158,6 +1354,11 @@
   1.766                esac
   1.767                ;;
   1.768     	  esac
   1.769 + 	  prev=
   1.770 + 	  continue
   1.771 + 	  ;;
   1.772 +	shrext)
   1.773 +  	  shrext_cmds="$arg"
   1.774  	  prev=
   1.775  	  continue
   1.776  	  ;;
   1.777 @@ -1209,7 +1410,7 @@
   1.778        -export-symbols | -export-symbols-regex)
   1.779  	if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
   1.780  	  $echo "$modename: more than one -exported-symbols argument is not allowed"
   1.781 -	  exit 1
   1.782 +	  exit $EXIT_FAILURE
   1.783  	fi
   1.784  	if test "X$arg" = "X-export-symbols"; then
   1.785  	  prev=expsyms
   1.786 @@ -1245,7 +1446,7 @@
   1.787  	  absdir=`cd "$dir" && pwd`
   1.788  	  if test -z "$absdir"; then
   1.789  	    $echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2
   1.790 -	    exit 1
   1.791 +	    exit $EXIT_FAILURE
   1.792  	  fi
   1.793  	  dir="$absdir"
   1.794  	  ;;
   1.795 @@ -1300,6 +1501,11 @@
   1.796  	continue
   1.797  	;;
   1.798  
   1.799 +     -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe)
   1.800 +	deplibs="$deplibs $arg"
   1.801 +	continue
   1.802 +	;;
   1.803 +
   1.804        -module)
   1.805  	module=yes
   1.806  	continue
   1.807 @@ -1364,6 +1570,11 @@
   1.808  
   1.809        -o) prev=output ;;
   1.810  
   1.811 +      -precious-files-regex)
   1.812 +	prev=precious_regex
   1.813 +	continue
   1.814 +	;;
   1.815 +
   1.816        -release)
   1.817  	prev=release
   1.818  	continue
   1.819 @@ -1386,7 +1597,7 @@
   1.820  	[\\/]* | [A-Za-z]:[\\/]*) ;;
   1.821  	*)
   1.822  	  $echo "$modename: only absolute run-paths are allowed" 1>&2
   1.823 -	  exit 1
   1.824 +	  exit $EXIT_FAILURE
   1.825  	  ;;
   1.826  	esac
   1.827  	case "$xrpath " in
   1.828 @@ -1514,7 +1725,7 @@
   1.829  	     test "$pic_object" = none && \
   1.830  	     test "$non_pic_object" = none; then
   1.831  	    $echo "$modename: cannot find name of object for \`$arg'" 1>&2
   1.832 -	    exit 1
   1.833 +	    exit $EXIT_FAILURE
   1.834  	  fi
   1.835  
   1.836  	  # Extract subdirectory from the argument.
   1.837 @@ -1567,7 +1778,7 @@
   1.838  	  # Only an error if not doing a dry-run.
   1.839  	  if test -z "$run"; then
   1.840  	    $echo "$modename: \`$arg' is not a valid libtool object" 1>&2
   1.841 -	    exit 1
   1.842 +	    exit $EXIT_FAILURE
   1.843  	  else
   1.844  	    # Dry-run case.
   1.845  
   1.846 @@ -1634,48 +1845,7 @@
   1.847      if test -n "$prev"; then
   1.848        $echo "$modename: the \`$prevarg' option requires an argument" 1>&2
   1.849        $echo "$help" 1>&2
   1.850 -      exit 1
   1.851 -    fi
   1.852 -
   1.853 -    # Infer tagged configuration to use if any are available and
   1.854 -    # if one wasn't chosen via the "--tag" command line option.
   1.855 -    # Only attempt this if the compiler in the base link
   1.856 -    # command doesn't match the default compiler.
   1.857 -    if test -n "$available_tags" && test -z "$tagname"; then
   1.858 -      case $base_compile in
   1.859 -      # Blanks in the command may have been stripped by the calling shell,
   1.860 -      # but not from the CC environment variable when configure was run.
   1.861 -      "$CC "* | " $CC "* | "`$echo $CC` "* | " `$echo $CC` "*) ;;
   1.862 -      # Blanks at the start of $base_compile will cause this to fail
   1.863 -      # if we don't check for them as well.
   1.864 -      *)
   1.865 -	for z in $available_tags; do
   1.866 -	  if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$0" > /dev/null; then
   1.867 -	    # Evaluate the configuration.
   1.868 -	    eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $0`"
   1.869 -	    case $base_compile in
   1.870 -	    "$CC "* | " $CC "* | "`$echo $CC` "* | " `$echo $CC` "*)
   1.871 -	      # The compiler in $compile_command matches
   1.872 -	      # the one in the tagged configuration.
   1.873 -	      # Assume this is the tagged configuration we want.
   1.874 -	      tagname=$z
   1.875 -	      break
   1.876 -	      ;;
   1.877 -	    esac
   1.878 -	  fi
   1.879 -	done
   1.880 -	# If $tagname still isn't set, then no tagged configuration
   1.881 -	# was found and let the user know that the "--tag" command
   1.882 -	# line option must be used.
   1.883 -	if test -z "$tagname"; then
   1.884 -	  $echo "$modename: unable to infer tagged configuration"
   1.885 -	  $echo "$modename: specify a tag with \`--tag'" 1>&2
   1.886 -	  exit 1
   1.887 -#       else
   1.888 -#         $echo "$modename: using $tagname tagged configuration"
   1.889 -	fi
   1.890 -	;;
   1.891 -      esac
   1.892 +      exit $EXIT_FAILURE
   1.893      fi
   1.894  
   1.895      if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then
   1.896 @@ -1719,7 +1889,7 @@
   1.897      "")
   1.898        $echo "$modename: you must specify an output file" 1>&2
   1.899        $echo "$help" 1>&2
   1.900 -      exit 1
   1.901 +      exit $EXIT_FAILURE
   1.902        ;;
   1.903      *.$libext) linkmode=oldlib ;;
   1.904      *.lo | *.$objext) linkmode=obj ;;
   1.905 @@ -1729,7 +1899,7 @@
   1.906  
   1.907      case $host in
   1.908      *cygwin* | *mingw* | *pw32*)
   1.909 -      # don't eliminate duplcations in $postdeps and $predeps
   1.910 +      # don't eliminate duplications in $postdeps and $predeps
   1.911        duplicate_compiler_generated_deps=yes
   1.912        ;;
   1.913      *)
   1.914 @@ -1782,7 +1952,7 @@
   1.915  	  *.la) ;;
   1.916  	  *)
   1.917  	    $echo "$modename: libraries can \`-dlopen' only libtool libraries: $file" 1>&2
   1.918 -	    exit 1
   1.919 +	    exit $EXIT_FAILURE
   1.920  	    ;;
   1.921  	  esac
   1.922  	done
   1.923 @@ -1820,6 +1990,15 @@
   1.924  	lib=
   1.925  	found=no
   1.926  	case $deplib in
   1.927 +	-mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe)
   1.928 +	  if test "$linkmode,$pass" = "prog,link"; then
   1.929 +	    compile_deplibs="$deplib $compile_deplibs"
   1.930 +	    finalize_deplibs="$deplib $finalize_deplibs"
   1.931 +	  else
   1.932 +	    deplibs="$deplib $deplibs"
   1.933 +	  fi
   1.934 +	  continue
   1.935 +	  ;;
   1.936  	-l*)
   1.937  	  if test "$linkmode" != lib && test "$linkmode" != prog; then
   1.938  	    $echo "$modename: warning: \`-l' is ignored for archives/objects" 1>&2
   1.939 @@ -1831,12 +2010,18 @@
   1.940  	  fi
   1.941  	  name=`$echo "X$deplib" | $Xsed -e 's/^-l//'`
   1.942  	  for searchdir in $newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path; do
   1.943 -	    # Search the libtool library
   1.944 -	    lib="$searchdir/lib${name}.la"
   1.945 -	    if test -f "$lib"; then
   1.946 -	      found=yes
   1.947 -	      break
   1.948 -	    fi
   1.949 +	    for search_ext in .la $std_shrext .so .a; do
   1.950 +	      # Search the libtool library
   1.951 +	      lib="$searchdir/lib${name}${search_ext}"
   1.952 +	      if test -f "$lib"; then
   1.953 +		if test "$search_ext" = ".la"; then
   1.954 +		  found=yes
   1.955 +		else
   1.956 +		  found=no
   1.957 +		fi
   1.958 +		break 2
   1.959 +	      fi
   1.960 +	    done
   1.961  	  done
   1.962  	  if test "$found" != yes; then
   1.963  	    # deplib doesn't seem to be a libtool library
   1.964 @@ -1913,11 +2098,11 @@
   1.965  	    fi
   1.966  	    if test "$pass" = scan; then
   1.967  	      deplibs="$deplib $deplibs"
   1.968 -	      newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
   1.969  	    else
   1.970  	      compile_deplibs="$deplib $compile_deplibs"
   1.971  	      finalize_deplibs="$deplib $finalize_deplibs"
   1.972  	    fi
   1.973 +	    newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
   1.974  	    ;;
   1.975  	  *)
   1.976  	    $echo "$modename: warning: \`-L' is ignored for archives/objects" 1>&2
   1.977 @@ -1945,7 +2130,22 @@
   1.978  	  fi
   1.979  	  case $linkmode in
   1.980  	  lib)
   1.981 -	    if test "$deplibs_check_method" != pass_all; then
   1.982 +	    valid_a_lib=no
   1.983 +	    case $deplibs_check_method in
   1.984 +	      match_pattern*)
   1.985 +		set dummy $deplibs_check_method
   1.986 +	        match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
   1.987 +		if eval $echo \"$deplib\" 2>/dev/null \
   1.988 +		    | $SED 10q \
   1.989 +		    | $EGREP "$match_pattern_regex" > /dev/null; then
   1.990 +		  valid_a_lib=yes
   1.991 +		fi
   1.992 +		;;
   1.993 +	      pass_all)
   1.994 +		valid_a_lib=yes
   1.995 +		;;
   1.996 +            esac
   1.997 +	    if test "$valid_a_lib" != yes; then
   1.998  	      $echo
   1.999  	      $echo "*** Warning: Trying to link with static lib archive $deplib."
  1.1000  	      $echo "*** I have the capability to make that library automatically link in when"
  1.1001 @@ -1996,14 +2196,14 @@
  1.1002  	if test "$found" = yes || test -f "$lib"; then :
  1.1003  	else
  1.1004  	  $echo "$modename: cannot find the library \`$lib'" 1>&2
  1.1005 -	  exit 1
  1.1006 +	  exit $EXIT_FAILURE
  1.1007  	fi
  1.1008  
  1.1009  	# Check to see that this really is a libtool archive.
  1.1010  	if (${SED} -e '2q' $lib | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
  1.1011  	else
  1.1012  	  $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
  1.1013 -	  exit 1
  1.1014 +	  exit $EXIT_FAILURE
  1.1015  	fi
  1.1016  
  1.1017  	ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'`
  1.1018 @@ -2046,7 +2246,7 @@
  1.1019  	  if test -z "$libdir"; then
  1.1020  	    if test -z "$old_library"; then
  1.1021  	      $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
  1.1022 -	      exit 1
  1.1023 +	      exit $EXIT_FAILURE
  1.1024  	    fi
  1.1025  	    # It is a libtool convenience library, so add in its objects.
  1.1026  	    convenience="$convenience $ladir/$objdir/$old_library"
  1.1027 @@ -2063,12 +2263,12 @@
  1.1028  	    done
  1.1029  	  elif test "$linkmode" != prog && test "$linkmode" != lib; then
  1.1030  	    $echo "$modename: \`$lib' is not a convenience library" 1>&2
  1.1031 -	    exit 1
  1.1032 +	    exit $EXIT_FAILURE
  1.1033  	  fi
  1.1034  	  continue
  1.1035  	fi # $pass = conv
  1.1036  
  1.1037 -    
  1.1038 +
  1.1039  	# Get the name of the library we link against.
  1.1040  	linklib=
  1.1041  	for l in $old_library $library_names; do
  1.1042 @@ -2076,16 +2276,18 @@
  1.1043  	done
  1.1044  	if test -z "$linklib"; then
  1.1045  	  $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
  1.1046 -	  exit 1
  1.1047 +	  exit $EXIT_FAILURE
  1.1048  	fi
  1.1049  
  1.1050  	# This library was specified with -dlopen.
  1.1051  	if test "$pass" = dlopen; then
  1.1052  	  if test -z "$libdir"; then
  1.1053  	    $echo "$modename: cannot -dlopen a convenience library: \`$lib'" 1>&2
  1.1054 -	    exit 1
  1.1055 +	    exit $EXIT_FAILURE
  1.1056  	  fi
  1.1057 -	  if test -z "$dlname" || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
  1.1058 +	  if test -z "$dlname" ||
  1.1059 +	     test "$dlopen_support" != yes ||
  1.1060 +	     test "$build_libtool_libs" = no; then
  1.1061  	    # If there is no dlname, no dlopen support or we're linking
  1.1062  	    # statically, we need to preload.  We also need to preload any
  1.1063  	    # dependent libraries so libltdl's deplib preloader doesn't
  1.1064 @@ -2123,10 +2325,17 @@
  1.1065  	    absdir="$libdir"
  1.1066  	  fi
  1.1067  	else
  1.1068 -	  dir="$ladir/$objdir"
  1.1069 -	  absdir="$abs_ladir/$objdir"
  1.1070 -	  # Remove this search path later
  1.1071 -	  notinst_path="$notinst_path $abs_ladir"
  1.1072 +	  if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then
  1.1073 +	    dir="$ladir"
  1.1074 +	    absdir="$abs_ladir"
  1.1075 +	    # Remove this search path later
  1.1076 +	    notinst_path="$notinst_path $abs_ladir"
  1.1077 +	  else
  1.1078 +	    dir="$ladir/$objdir"
  1.1079 +	    absdir="$abs_ladir/$objdir"
  1.1080 +	    # Remove this search path later
  1.1081 +	    notinst_path="$notinst_path $abs_ladir"
  1.1082 +	  fi
  1.1083  	fi # $installed = yes
  1.1084  	name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
  1.1085  
  1.1086 @@ -2134,7 +2343,7 @@
  1.1087  	if test "$pass" = dlpreopen; then
  1.1088  	  if test -z "$libdir"; then
  1.1089  	    $echo "$modename: cannot -dlpreopen a convenience library: \`$lib'" 1>&2
  1.1090 -	    exit 1
  1.1091 +	    exit $EXIT_FAILURE
  1.1092  	  fi
  1.1093  	  # Prefer using a static library (so that no silly _DYNAMIC symbols
  1.1094  	  # are required to link).
  1.1095 @@ -2161,7 +2370,7 @@
  1.1096  	  continue
  1.1097  	fi
  1.1098  
  1.1099 -    
  1.1100 +
  1.1101  	if test "$linkmode" = prog && test "$pass" != link; then
  1.1102  	  newlib_search_path="$newlib_search_path $ladir"
  1.1103  	  deplibs="$lib $deplibs"
  1.1104 @@ -2248,17 +2457,18 @@
  1.1105  	    need_relink=yes
  1.1106  	  fi
  1.1107  	  # This is a shared library
  1.1108 -	
  1.1109 -      # Warn about portability, can't link against -module's on some systems (darwin)
  1.1110 -      if test "$shouldnotlink" = yes && test "$pass" = link ; then
  1.1111 +
  1.1112 +	  # Warn about portability, can't link against -module's on
  1.1113 +	  # some systems (darwin)
  1.1114 +	  if test "$shouldnotlink" = yes && test "$pass" = link ; then
  1.1115  	    $echo
  1.1116  	    if test "$linkmode" = prog; then
  1.1117  	      $echo "*** Warning: Linking the executable $output against the loadable module"
  1.1118  	    else
  1.1119  	      $echo "*** Warning: Linking the shared library $output against the loadable module"
  1.1120  	    fi
  1.1121 -	    $echo "*** $linklib is not portable!"    
  1.1122 -      fi	  
  1.1123 +	    $echo "*** $linklib is not portable!"
  1.1124 +	  fi
  1.1125  	  if test "$linkmode" = lib &&
  1.1126  	     test "$hardcode_into_libs" = yes; then
  1.1127  	    # Hardcode the library path.
  1.1128 @@ -2316,9 +2526,10 @@
  1.1129  	    else
  1.1130  	      $show "extracting exported symbol list from \`$soname'"
  1.1131  	      save_ifs="$IFS"; IFS='~'
  1.1132 -	      eval cmds=\"$extract_expsyms_cmds\"
  1.1133 +	      cmds=$extract_expsyms_cmds
  1.1134  	      for cmd in $cmds; do
  1.1135  		IFS="$save_ifs"
  1.1136 +		eval cmd=\"$cmd\"
  1.1137  		$show "$cmd"
  1.1138  		$run eval "$cmd" || exit $?
  1.1139  	      done
  1.1140 @@ -2329,9 +2540,10 @@
  1.1141  	    if test -f "$output_objdir/$newlib"; then :; else
  1.1142  	      $show "generating import library for \`$soname'"
  1.1143  	      save_ifs="$IFS"; IFS='~'
  1.1144 -	      eval cmds=\"$old_archive_from_expsyms_cmds\"
  1.1145 +	      cmds=$old_archive_from_expsyms_cmds
  1.1146  	      for cmd in $cmds; do
  1.1147  		IFS="$save_ifs"
  1.1148 +		eval cmd=\"$cmd\"
  1.1149  		$show "$cmd"
  1.1150  		$run eval "$cmd" || exit $?
  1.1151  	      done
  1.1152 @@ -2354,9 +2566,9 @@
  1.1153  		case $host in
  1.1154  		  *-*-sco3.2v5* ) add_dir="-L$dir" ;;
  1.1155  		  *-*-darwin* )
  1.1156 -		    # if the lib is a module then we can not link against it, someone
  1.1157 -		    # is ignoring the new warnings I added
  1.1158 -		    if /usr/bin/file -L $add 2> /dev/null | grep "bundle" >/dev/null ; then
  1.1159 +		    # if the lib is a module then we can not link against
  1.1160 +		    # it, someone is ignoring the new warnings I added
  1.1161 +		    if /usr/bin/file -L $add 2> /dev/null | $EGREP "bundle" >/dev/null ; then
  1.1162  		      $echo "** Warning, lib $linklib is a module, not a shared library"
  1.1163  		      if test -z "$old_library" ; then
  1.1164  		        $echo
  1.1165 @@ -2364,7 +2576,7 @@
  1.1166  		        $echo "** The link will probably fail, sorry"
  1.1167  		      else
  1.1168  		        add="$dir/$old_library"
  1.1169 -		      fi 
  1.1170 +		      fi
  1.1171  		    fi
  1.1172  		esac
  1.1173  	      elif test "$hardcode_minus_L" = no; then
  1.1174 @@ -2389,7 +2601,7 @@
  1.1175  		if test -n "$inst_prefix_dir"; then
  1.1176  		  case "$libdir" in
  1.1177  		    [\\/]*)
  1.1178 -		      add_dir="-L$inst_prefix_dir$libdir $add_dir"
  1.1179 +		      add_dir="$add_dir -L$inst_prefix_dir$libdir"
  1.1180  		      ;;
  1.1181  		  esac
  1.1182  		fi
  1.1183 @@ -2406,7 +2618,7 @@
  1.1184  
  1.1185  	    if test "$lib_linked" != yes; then
  1.1186  	      $echo "$modename: configuration error: unsupported hardcode properties"
  1.1187 -	      exit 1
  1.1188 +	      exit $EXIT_FAILURE
  1.1189  	    fi
  1.1190  
  1.1191  	    if test -n "$add_shlibpath"; then
  1.1192 @@ -2449,7 +2661,8 @@
  1.1193  	      esac
  1.1194  	      add="-l$name"
  1.1195  	    elif test "$hardcode_automatic" = yes; then
  1.1196 -	      if test -n "$inst_prefix_dir" && test -f "$inst_prefix_dir$libdir/$linklib" ; then
  1.1197 +	      if test -n "$inst_prefix_dir" &&
  1.1198 +		 test -f "$inst_prefix_dir$libdir/$linklib" ; then
  1.1199  	        add="$inst_prefix_dir$libdir/$linklib"
  1.1200  	      else
  1.1201  	        add="$libdir/$linklib"
  1.1202 @@ -2461,7 +2674,7 @@
  1.1203  	      if test -n "$inst_prefix_dir"; then
  1.1204  		case "$libdir" in
  1.1205  		  [\\/]*)
  1.1206 -		    add_dir="-L$inst_prefix_dir$libdir $add_dir"
  1.1207 +		    add_dir="$add_dir -L$inst_prefix_dir$libdir"
  1.1208  		    ;;
  1.1209  		esac
  1.1210  	      fi
  1.1211 @@ -2529,7 +2742,8 @@
  1.1212  
  1.1213  	if test "$linkmode" = lib; then
  1.1214  	  if test -n "$dependency_libs" &&
  1.1215 -	     { test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes ||
  1.1216 +	     { test "$hardcode_into_libs" != yes ||
  1.1217 +	       test "$build_old_libs" = yes ||
  1.1218  	       test "$link_static" = yes; }; then
  1.1219  	    # Extract -R from dependency_libs
  1.1220  	    temp_deplibs=
  1.1221 @@ -2586,7 +2800,7 @@
  1.1222  		  eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
  1.1223  		  if test -z "$libdir"; then
  1.1224  		    $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
  1.1225 -		    exit 1
  1.1226 +		    exit $EXIT_FAILURE
  1.1227  		  fi
  1.1228  		  if test "$absdir" != "$libdir"; then
  1.1229  		    $echo "$modename: warning: \`$deplib' seems to be moved" 1>&2
  1.1230 @@ -2596,7 +2810,8 @@
  1.1231  		depdepl=
  1.1232  		case $host in
  1.1233  		*-*-darwin*)
  1.1234 -		  # we do not want to link against static libs, but need to link against shared
  1.1235 +		  # we do not want to link against static libs,
  1.1236 +		  # but need to link against shared
  1.1237  		  eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib`
  1.1238  		  if test -n "$deplibrary_names" ; then
  1.1239  		    for tmp in $deplibrary_names ; do
  1.1240 @@ -2604,7 +2819,7 @@
  1.1241  		    done
  1.1242  		    if test -f "$path/$depdepl" ; then
  1.1243  		      depdepl="$path/$depdepl"
  1.1244 -		   fi
  1.1245 +		    fi
  1.1246  		    # do not add paths which are already there
  1.1247  		    case " $newlib_search_path " in
  1.1248  		    *" $path "*) ;;
  1.1249 @@ -2614,28 +2829,23 @@
  1.1250  		  path=""
  1.1251  		  ;;
  1.1252  		*)
  1.1253 -		path="-L$path"
  1.1254 -		;;
  1.1255 +		  path="-L$path"
  1.1256 +		  ;;
  1.1257  		esac
  1.1258 -		
  1.1259  		;;
  1.1260 -		  -l*)
  1.1261 +	      -l*)
  1.1262  		case $host in
  1.1263  		*-*-darwin*)
  1.1264 -		 # Again, we only want to link against shared libraries
  1.1265 -		 eval tmp_libs=`$echo "X$deplib" | $Xsed -e "s,^\-l,,"`
  1.1266 -		 for tmp in $newlib_search_path ; do
  1.1267 -		     if test -f "$tmp/lib$tmp_libs.dylib" ; then
  1.1268 -		       eval depdepl="$tmp/lib$tmp_libs.dylib"
  1.1269 -		       break
  1.1270 -		     fi  
  1.1271 -         done
  1.1272 -         path=""
  1.1273 +		  # Again, we only want to link against shared libraries
  1.1274 +		  eval tmp_libs=`$echo "X$deplib" | $Xsed -e "s,^\-l,,"`
  1.1275 +		  for tmp in $newlib_search_path ; do
  1.1276 +		    if test -f "$tmp/lib$tmp_libs.dylib" ; then
  1.1277 +		      eval depdepl="$tmp/lib$tmp_libs.dylib"
  1.1278 +		      break
  1.1279 +		    fi
  1.1280 +		  done
  1.1281 +		  path=""
  1.1282  		  ;;
  1.1283 -		*) continue ;;
  1.1284 -		esac  		  
  1.1285 -		;;
  1.1286 -
  1.1287  	      *.framework)
  1.1288  		case $host in
  1.1289  		  *-*-darwin*)
  1.1290 @@ -2643,13 +2853,15 @@
  1.1291  		    ;;
  1.1292  		esac
  1.1293  		;;
  1.1294 -
  1.1295 +		*) continue ;;
  1.1296 +		esac
  1.1297 +		;;
  1.1298  	      *) continue ;;
  1.1299  	      esac
  1.1300  	      case " $deplibs " in
  1.1301  	      *" $depdepl "*) ;;
  1.1302 -	      *) deplibs="$deplibs $depdepl" ;;
  1.1303 -	      esac	      
  1.1304 +	      *) deplibs="$depdepl $deplibs" ;;
  1.1305 +	      esac
  1.1306  	      case " $deplibs " in
  1.1307  	      *" $path "*) ;;
  1.1308  	      *) deplibs="$deplibs $path" ;;
  1.1309 @@ -2739,7 +2951,8 @@
  1.1310  	  eval $var=\"$tmp_libs\"
  1.1311  	done # for var
  1.1312        fi
  1.1313 -      # Last step: remove runtime libs from dependency_libs (they stay in deplibs)
  1.1314 +      # Last step: remove runtime libs from dependency_libs
  1.1315 +      # (they stay in deplibs)
  1.1316        tmp_libs=
  1.1317        for i in $dependency_libs ; do
  1.1318  	case " $predeps $postdeps $compiler_lib_search_path " in
  1.1319 @@ -2799,19 +3012,19 @@
  1.1320        case $outputname in
  1.1321        lib*)
  1.1322  	name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
  1.1323 -	eval shared_ext=\"$shrext\"
  1.1324 +	eval shared_ext=\"$shrext_cmds\"
  1.1325  	eval libname=\"$libname_spec\"
  1.1326  	;;
  1.1327        *)
  1.1328  	if test "$module" = no; then
  1.1329  	  $echo "$modename: libtool library \`$output' must begin with \`lib'" 1>&2
  1.1330  	  $echo "$help" 1>&2
  1.1331 -	  exit 1
  1.1332 +	  exit $EXIT_FAILURE
  1.1333  	fi
  1.1334  	if test "$need_lib_prefix" != no; then
  1.1335  	  # Add the "lib" prefix for modules if required
  1.1336  	  name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
  1.1337 -	  eval shared_ext=\"$shrext\"
  1.1338 +	  eval shared_ext=\"$shrext_cmds\"
  1.1339  	  eval libname=\"$libname_spec\"
  1.1340  	else
  1.1341  	  libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
  1.1342 @@ -2822,7 +3035,7 @@
  1.1343        if test -n "$objs"; then
  1.1344  	if test "$deplibs_check_method" != pass_all; then
  1.1345  	  $echo "$modename: cannot build libtool library \`$output' from non-libtool objects on this host:$objs" 2>&1
  1.1346 -	  exit 1
  1.1347 +	  exit $EXIT_FAILURE
  1.1348  	else
  1.1349  	  $echo
  1.1350  	  $echo "*** Warning: Linking the shared library $output against the non-libtool"
  1.1351 @@ -2870,13 +3083,13 @@
  1.1352  	if test -n "$8"; then
  1.1353  	  $echo "$modename: too many parameters to \`-version-info'" 1>&2
  1.1354  	  $echo "$help" 1>&2
  1.1355 -	  exit 1
  1.1356 +	  exit $EXIT_FAILURE
  1.1357  	fi
  1.1358  
  1.1359  	# convert absolute version numbers to libtool ages
  1.1360  	# this retains compatibility with .la files and attempts
  1.1361  	# to make the code below a bit more comprehensible
  1.1362 -	
  1.1363 +
  1.1364  	case $vinfo_number in
  1.1365  	yes)
  1.1366  	  number_major="$2"
  1.1367 @@ -2920,7 +3133,7 @@
  1.1368  	*)
  1.1369  	  $echo "$modename: CURRENT \`$current' is not a nonnegative integer" 1>&2
  1.1370  	  $echo "$modename: \`$vinfo' is not valid version information" 1>&2
  1.1371 -	  exit 1
  1.1372 +	  exit $EXIT_FAILURE
  1.1373  	  ;;
  1.1374  	esac
  1.1375  
  1.1376 @@ -2929,7 +3142,7 @@
  1.1377  	*)
  1.1378  	  $echo "$modename: REVISION \`$revision' is not a nonnegative integer" 1>&2
  1.1379  	  $echo "$modename: \`$vinfo' is not valid version information" 1>&2
  1.1380 -	  exit 1
  1.1381 +	  exit $EXIT_FAILURE
  1.1382  	  ;;
  1.1383  	esac
  1.1384  
  1.1385 @@ -2938,14 +3151,14 @@
  1.1386  	*)
  1.1387  	  $echo "$modename: AGE \`$age' is not a nonnegative integer" 1>&2
  1.1388  	  $echo "$modename: \`$vinfo' is not valid version information" 1>&2
  1.1389 -	  exit 1
  1.1390 +	  exit $EXIT_FAILURE
  1.1391  	  ;;
  1.1392  	esac
  1.1393  
  1.1394  	if test "$age" -gt "$current"; then
  1.1395  	  $echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2
  1.1396  	  $echo "$modename: \`$vinfo' is not valid version information" 1>&2
  1.1397 -	  exit 1
  1.1398 +	  exit $EXIT_FAILURE
  1.1399  	fi
  1.1400  
  1.1401  	# Calculate the version variables.
  1.1402 @@ -2962,7 +3175,7 @@
  1.1403  	  versuffix="$major.$age.$revision"
  1.1404  	  # Darwin ld doesn't like 0 for these options...
  1.1405  	  minor_current=`expr $current + 1`
  1.1406 -	  verstring="-compatibility_version $minor_current -current_version $minor_current.$revision"
  1.1407 +	  verstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision"
  1.1408  	  ;;
  1.1409  
  1.1410  	freebsd-aout)
  1.1411 @@ -3034,7 +3247,7 @@
  1.1412  	*)
  1.1413  	  $echo "$modename: unknown library version type \`$version_type'" 1>&2
  1.1414  	  $echo "Fatal configuration error.  See the $PACKAGE docs for more information." 1>&2
  1.1415 -	  exit 1
  1.1416 +	  exit $EXIT_FAILURE
  1.1417  	  ;;
  1.1418  	esac
  1.1419  
  1.1420 @@ -3088,6 +3301,12 @@
  1.1421  	    *.$objext)
  1.1422  	       ;;
  1.1423  	    $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*)
  1.1424 +	       if test "X$precious_files_regex" != "X"; then
  1.1425 +	         if echo $p | $EGREP -e "$precious_files_regex" >/dev/null 2>&1
  1.1426 +	         then
  1.1427 +		   continue
  1.1428 +		 fi
  1.1429 +	       fi
  1.1430  	       removelist="$removelist $p"
  1.1431  	       ;;
  1.1432  	    *) ;;
  1.1433 @@ -3500,7 +3719,7 @@
  1.1434  	case $host in
  1.1435  	  *-*-darwin*)
  1.1436  	    newdeplibs=`$echo "X $newdeplibs" | $Xsed -e 's% \([^ $]*\).framework% -framework \1%g'`
  1.1437 -	    dependency_libs=`$echo "X $dependency_libs" | $Xsed -e 's% \([^ $]*\).framework% -framework \1%g'`
  1.1438 +	    dependency_libs=`$echo "X $dependency_libs" | $Xsed -e 's% \([^ $]*\).framework%%g'`
  1.1439  	    ;;
  1.1440  	esac
  1.1441  	# Done checking deplibs!
  1.1442 @@ -3574,7 +3793,7 @@
  1.1443  	fi
  1.1444  
  1.1445  	# Get the real and link names of the library.
  1.1446 -	eval shared_ext=\"$shrext\"
  1.1447 +	eval shared_ext=\"$shrext_cmds\"
  1.1448  	eval library_names=\"$library_names_spec\"
  1.1449  	set dummy $library_names
  1.1450  	realname="$2"
  1.1451 @@ -3604,10 +3823,11 @@
  1.1452  	    $show "generating symbol list for \`$libname.la'"
  1.1453  	    export_symbols="$output_objdir/$libname.exp"
  1.1454  	    $run $rm $export_symbols
  1.1455 -	    eval cmds=\"$export_symbols_cmds\"
  1.1456 +	    cmds=$export_symbols_cmds
  1.1457  	    save_ifs="$IFS"; IFS='~'
  1.1458  	    for cmd in $cmds; do
  1.1459  	      IFS="$save_ifs"
  1.1460 +	      eval cmd=\"$cmd\"
  1.1461  	      if len=`expr "X$cmd" : ".*"` &&
  1.1462  	       test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
  1.1463  	        $show "$cmd"
  1.1464 @@ -3637,12 +3857,12 @@
  1.1465  	for test_deplib in $deplibs; do
  1.1466  		case " $convenience " in
  1.1467  		*" $test_deplib "*) ;;
  1.1468 -		*) 
  1.1469 +		*)
  1.1470  			tmp_deplibs="$tmp_deplibs $test_deplib"
  1.1471  			;;
  1.1472  		esac
  1.1473  	done
  1.1474 -	deplibs="$tmp_deplibs" 
  1.1475 +	deplibs="$tmp_deplibs"
  1.1476  
  1.1477  	if test -n "$convenience"; then
  1.1478  	  if test -n "$whole_archive_flag_spec"; then
  1.1479 @@ -3650,67 +3870,13 @@
  1.1480  	    eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
  1.1481  	  else
  1.1482  	    gentop="$output_objdir/${outputname}x"
  1.1483 -	    $show "${rm}r $gentop"
  1.1484 -	    $run ${rm}r "$gentop"
  1.1485 -	    $show "$mkdir $gentop"
  1.1486 -	    $run $mkdir "$gentop"
  1.1487 -	    status=$?
  1.1488 -	    if test "$status" -ne 0 && test ! -d "$gentop"; then
  1.1489 -	      exit $status
  1.1490 -	    fi
  1.1491  	    generated="$generated $gentop"
  1.1492  
  1.1493 -	    for xlib in $convenience; do
  1.1494 -	      # Extract the objects.
  1.1495 -	      case $xlib in
  1.1496 -	      [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
  1.1497 -	      *) xabs=`pwd`"/$xlib" ;;
  1.1498 -	      esac
  1.1499 -	      xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
  1.1500 -	      xdir="$gentop/$xlib"
  1.1501 -
  1.1502 -	      $show "${rm}r $xdir"
  1.1503 -	      $run ${rm}r "$xdir"
  1.1504 -	      $show "$mkdir $xdir"
  1.1505 -	      $run $mkdir "$xdir"
  1.1506 -	      status=$?
  1.1507 -	      if test "$status" -ne 0 && test ! -d "$xdir"; then
  1.1508 -		exit $status
  1.1509 -	      fi
  1.1510 -	      # We will extract separately just the conflicting names and we will no
  1.1511 -	      # longer touch any unique names. It is faster to leave these extract
  1.1512 -	      # automatically by $AR in one run.
  1.1513 -	      $show "(cd $xdir && $AR x $xabs)"
  1.1514 -	      $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
  1.1515 -	      if ($AR t "$xabs" | sort | sort -uc >/dev/null 2>&1); then
  1.1516 -		:
  1.1517 -	      else
  1.1518 -		$echo "$modename: warning: object name conflicts; renaming object files" 1>&2
  1.1519 -		$echo "$modename: warning: to ensure that they will not overwrite" 1>&2
  1.1520 -		$AR t "$xabs" | sort | uniq -cd | while read -r count name
  1.1521 -		do
  1.1522 -		  i=1
  1.1523 -		  while test "$i" -le "$count"
  1.1524 -		  do
  1.1525 -		   # Put our $i before any first dot (extension)
  1.1526 -		   # Never overwrite any file
  1.1527 -		   name_to="$name"
  1.1528 -		   while test "X$name_to" = "X$name" || test -f "$xdir/$name_to"
  1.1529 -		   do
  1.1530 -		     name_to=`$echo "X$name_to" | $Xsed -e "s/\([^.]*\)/\1-$i/"`
  1.1531 -		   done
  1.1532 -		   $show "(cd $xdir && $AR xN $i $xabs '$name' && $mv '$name' '$name_to')"
  1.1533 -		   $run eval "(cd \$xdir && $AR xN $i \$xabs '$name' && $mv '$name' '$name_to')" || exit $?
  1.1534 -		   i=`expr $i + 1`
  1.1535 -		  done
  1.1536 -		done
  1.1537 -	      fi
  1.1538 -
  1.1539 -	      libobjs="$libobjs "`find $xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP`
  1.1540 -	    done
  1.1541 +	    func_extract_archives $gentop $convenience
  1.1542 +	    libobjs="$libobjs $func_extract_archives_result"
  1.1543  	  fi
  1.1544  	fi
  1.1545 -
  1.1546 +	
  1.1547  	if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then
  1.1548  	  eval flag=\"$thread_safe_flag_spec\"
  1.1549  	  linker_flags="$linker_flags $flag"
  1.1550 @@ -3724,19 +3890,23 @@
  1.1551  	# Do each of the archive commands.
  1.1552  	if test "$module" = yes && test -n "$module_cmds" ; then
  1.1553  	  if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
  1.1554 -	    eval cmds=\"$module_expsym_cmds\"
  1.1555 +	    eval test_cmds=\"$module_expsym_cmds\"
  1.1556 +	    cmds=$module_expsym_cmds
  1.1557  	  else
  1.1558 -	    eval cmds=\"$module_cmds\"
  1.1559 +	    eval test_cmds=\"$module_cmds\"
  1.1560 +	    cmds=$module_cmds
  1.1561  	  fi
  1.1562  	else
  1.1563  	if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
  1.1564 -	  eval cmds=\"$archive_expsym_cmds\"
  1.1565 +	  eval test_cmds=\"$archive_expsym_cmds\"
  1.1566 +	  cmds=$archive_expsym_cmds
  1.1567  	else
  1.1568 -	  eval cmds=\"$archive_cmds\"
  1.1569 +	  eval test_cmds=\"$archive_cmds\"
  1.1570 +	  cmds=$archive_cmds
  1.1571  	  fi
  1.1572  	fi
  1.1573  
  1.1574 -	if test "X$skipped_export" != "X:" && len=`expr "X$cmds" : ".*"` &&
  1.1575 +	if test "X$skipped_export" != "X:" && len=`expr "X$test_cmds" : ".*"` &&
  1.1576  	   test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
  1.1577  	  :
  1.1578  	else
  1.1579 @@ -3837,19 +4007,28 @@
  1.1580  	  # value of $libobjs for piecewise linking.
  1.1581  
  1.1582  	  # Do each of the archive commands.
  1.1583 +	  if test "$module" = yes && test -n "$module_cmds" ; then
  1.1584 +	    if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
  1.1585 +	      cmds=$module_expsym_cmds
  1.1586 +	    else
  1.1587 +	      cmds=$module_cmds
  1.1588 +	    fi
  1.1589 +	  else
  1.1590  	  if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
  1.1591 -	    eval cmds=\"$archive_expsym_cmds\"
  1.1592 +	    cmds=$archive_expsym_cmds
  1.1593  	  else
  1.1594 -	    eval cmds=\"$archive_cmds\"
  1.1595 +	    cmds=$archive_cmds
  1.1596 +	    fi
  1.1597  	  fi
  1.1598  
  1.1599  	  # Append the command to remove the reloadable object files
  1.1600  	  # to the just-reset $cmds.
  1.1601 -	  eval cmds=\"\$cmds~$rm $delfiles\"
  1.1602 +	  eval cmds=\"\$cmds~\$rm $delfiles\"
  1.1603  	fi
  1.1604  	save_ifs="$IFS"; IFS='~'
  1.1605  	for cmd in $cmds; do
  1.1606  	  IFS="$save_ifs"
  1.1607 +	  eval cmd=\"$cmd\"
  1.1608  	  $show "$cmd"
  1.1609  	  $run eval "$cmd" || exit $?
  1.1610  	done
  1.1611 @@ -3858,7 +4037,7 @@
  1.1612  	# Restore the uninstalled library and exit
  1.1613  	if test "$mode" = relink; then
  1.1614  	  $run eval '(cd $output_objdir && $rm ${realname}T && $mv $realname ${realname}T && $mv "$realname"U $realname)' || exit $?
  1.1615 -	  exit 0
  1.1616 +	  exit $EXIT_SUCCESS
  1.1617  	fi
  1.1618  
  1.1619  	# Create links to the real library.
  1.1620 @@ -3906,7 +4085,7 @@
  1.1621        *.lo)
  1.1622  	if test -n "$objs$old_deplibs"; then
  1.1623  	  $echo "$modename: cannot build library object \`$output' from non-libtool objects" 1>&2
  1.1624 -	  exit 1
  1.1625 +	  exit $EXIT_FAILURE
  1.1626  	fi
  1.1627  	libobj="$output"
  1.1628  	obj=`$echo "X$output" | $Xsed -e "$lo2o"`
  1.1629 @@ -3935,64 +4114,10 @@
  1.1630  	  eval reload_conv_objs=\"\$reload_objs $whole_archive_flag_spec\"
  1.1631  	else
  1.1632  	  gentop="$output_objdir/${obj}x"
  1.1633 -	  $show "${rm}r $gentop"
  1.1634 -	  $run ${rm}r "$gentop"
  1.1635 -	  $show "$mkdir $gentop"
  1.1636 -	  $run $mkdir "$gentop"
  1.1637 -	  status=$?
  1.1638 -	  if test "$status" -ne 0 && test ! -d "$gentop"; then
  1.1639 -	    exit $status
  1.1640 -	  fi
  1.1641  	  generated="$generated $gentop"
  1.1642  
  1.1643 -	  for xlib in $convenience; do
  1.1644 -	    # Extract the objects.
  1.1645 -	    case $xlib in
  1.1646 -	    [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
  1.1647 -	    *) xabs=`pwd`"/$xlib" ;;
  1.1648 -	    esac
  1.1649 -	    xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
  1.1650 -	    xdir="$gentop/$xlib"
  1.1651 -
  1.1652 -	    $show "${rm}r $xdir"
  1.1653 -	    $run ${rm}r "$xdir"
  1.1654 -	    $show "$mkdir $xdir"
  1.1655 -	    $run $mkdir "$xdir"
  1.1656 -	    status=$?
  1.1657 -	    if test "$status" -ne 0 && test ! -d "$xdir"; then
  1.1658 -	      exit $status
  1.1659 -	    fi
  1.1660 -	    # We will extract separately just the conflicting names and we will no
  1.1661 -	    # longer touch any unique names. It is faster to leave these extract
  1.1662 -	    # automatically by $AR in one run.
  1.1663 -	    $show "(cd $xdir && $AR x $xabs)"
  1.1664 -	    $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
  1.1665 -	    if ($AR t "$xabs" | sort | sort -uc >/dev/null 2>&1); then
  1.1666 -	      :
  1.1667 -	    else
  1.1668 -	      $echo "$modename: warning: object name conflicts; renaming object files" 1>&2
  1.1669 -	      $echo "$modename: warning: to ensure that they will not overwrite" 1>&2
  1.1670 -	      $AR t "$xabs" | sort | uniq -cd | while read -r count name
  1.1671 -	      do
  1.1672 -		i=1
  1.1673 -		while test "$i" -le "$count"
  1.1674 -		do
  1.1675 -		 # Put our $i before any first dot (extension)
  1.1676 -		 # Never overwrite any file
  1.1677 -		 name_to="$name"
  1.1678 -		 while test "X$name_to" = "X$name" || test -f "$xdir/$name_to"
  1.1679 -		 do
  1.1680 -		   name_to=`$echo "X$name_to" | $Xsed -e "s/\([^.]*\)/\1-$i/"`
  1.1681 -		 done
  1.1682 -		 $show "(cd $xdir && $AR xN $i $xabs '$name' && $mv '$name' '$name_to')"
  1.1683 -		 $run eval "(cd \$xdir && $AR xN $i \$xabs '$name' && $mv '$name' '$name_to')" || exit $?
  1.1684 -		 i=`expr $i + 1`
  1.1685 -		done
  1.1686 -	      done
  1.1687 -	    fi
  1.1688 -
  1.1689 -	    reload_conv_objs="$reload_objs "`find $xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP`
  1.1690 -	  done
  1.1691 +	  func_extract_archives $gentop $convenience
  1.1692 +	  reload_conv_objs="$reload_objs $func_extract_archives_result"
  1.1693  	fi
  1.1694        fi
  1.1695  
  1.1696 @@ -4000,10 +4125,11 @@
  1.1697        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.1698  
  1.1699        output="$obj"
  1.1700 -      eval cmds=\"$reload_cmds\"
  1.1701 +      cmds=$reload_cmds
  1.1702        save_ifs="$IFS"; IFS='~'
  1.1703        for cmd in $cmds; do
  1.1704  	IFS="$save_ifs"
  1.1705 +	eval cmd=\"$cmd\"
  1.1706  	$show "$cmd"
  1.1707  	$run eval "$cmd" || exit $?
  1.1708        done
  1.1709 @@ -4016,7 +4142,7 @@
  1.1710  	  $run ${rm}r $gentop
  1.1711  	fi
  1.1712  
  1.1713 -	exit 0
  1.1714 +	exit $EXIT_SUCCESS
  1.1715        fi
  1.1716  
  1.1717        if test "$build_libtool_libs" != yes; then
  1.1718 @@ -4029,17 +4155,18 @@
  1.1719  	# accidentally link it into a program.
  1.1720  	# $show "echo timestamp > $libobj"
  1.1721  	# $run eval "echo timestamp > $libobj" || exit $?
  1.1722 -	exit 0
  1.1723 +	exit $EXIT_SUCCESS
  1.1724        fi
  1.1725  
  1.1726        if test -n "$pic_flag" || test "$pic_mode" != default; then
  1.1727  	# Only do commands if we really have different PIC objects.
  1.1728  	reload_objs="$libobjs $reload_conv_objs"
  1.1729  	output="$libobj"
  1.1730 -	eval cmds=\"$reload_cmds\"
  1.1731 +	cmds=$reload_cmds
  1.1732  	save_ifs="$IFS"; IFS='~'
  1.1733  	for cmd in $cmds; do
  1.1734  	  IFS="$save_ifs"
  1.1735 +	  eval cmd=\"$cmd\"
  1.1736  	  $show "$cmd"
  1.1737  	  $run eval "$cmd" || exit $?
  1.1738  	done
  1.1739 @@ -4051,7 +4178,7 @@
  1.1740  	$run ${rm}r $gentop
  1.1741        fi
  1.1742  
  1.1743 -      exit 0
  1.1744 +      exit $EXIT_SUCCESS
  1.1745        ;;
  1.1746  
  1.1747      prog)
  1.1748 @@ -4372,7 +4499,7 @@
  1.1749  	  ;;
  1.1750  	*)
  1.1751  	  $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2
  1.1752 -	  exit 1
  1.1753 +	  exit $EXIT_FAILURE
  1.1754  	  ;;
  1.1755  	esac
  1.1756        else
  1.1757 @@ -4460,7 +4587,7 @@
  1.1758  	# Link the executable and exit
  1.1759  	$show "$link_command"
  1.1760  	$run eval "$link_command" || exit $?
  1.1761 -	exit 0
  1.1762 +	exit $EXIT_SUCCESS
  1.1763        fi
  1.1764  
  1.1765        if test "$hardcode_action" = relink; then
  1.1766 @@ -4515,10 +4642,10 @@
  1.1767        fi
  1.1768  
  1.1769        # Quote $echo for shipping.
  1.1770 -      if test "X$echo" = "X$SHELL $0 --fallback-echo"; then
  1.1771 -	case $0 in
  1.1772 -	[\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $0 --fallback-echo";;
  1.1773 -	*) qecho="$SHELL `pwd`/$0 --fallback-echo";;
  1.1774 +      if test "X$echo" = "X$SHELL $progpath --fallback-echo"; then
  1.1775 +	case $progpath in
  1.1776 +	[\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $progpath --fallback-echo";;
  1.1777 +	*) qecho="$SHELL `pwd`/$progpath --fallback-echo";;
  1.1778  	esac
  1.1779  	qecho=`$echo "X$qecho" | $Xsed -e "$sed_quote_subst"`
  1.1780        else
  1.1781 @@ -4544,7 +4671,7 @@
  1.1782  	    cwrappersource=`$echo ${objdir}/lt-${output}.c`
  1.1783  	    cwrapper=`$echo ${output}.exe`
  1.1784  	    $rm $cwrappersource $cwrapper
  1.1785 -	    trap "$rm $cwrappersource $cwrapper; exit 1" 1 2 15
  1.1786 +	    trap "$rm $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15
  1.1787  
  1.1788  	    cat > $cwrappersource <<EOF
  1.1789  
  1.1790 @@ -4553,7 +4680,7 @@
  1.1791  
  1.1792     The $output program cannot be directly executed until all the libtool
  1.1793     libraries that it depends on are installed.
  1.1794 -   
  1.1795 +
  1.1796     This wrapper executable should never be moved out of the build directory.
  1.1797     If it is, it will not operate correctly.
  1.1798  
  1.1799 @@ -4569,7 +4696,6 @@
  1.1800  #include <malloc.h>
  1.1801  #include <stdarg.h>
  1.1802  #include <assert.h>
  1.1803 -#include <sys/stat.h>
  1.1804  
  1.1805  #if defined(PATH_MAX)
  1.1806  # define LT_PATHMAX PATH_MAX
  1.1807 @@ -4580,19 +4706,15 @@
  1.1808  #endif
  1.1809  
  1.1810  #ifndef DIR_SEPARATOR
  1.1811 -# define DIR_SEPARATOR '/'
  1.1812 -# define PATH_SEPARATOR ':'
  1.1813 +#define DIR_SEPARATOR '/'
  1.1814  #endif
  1.1815  
  1.1816  #if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \
  1.1817    defined (__OS2__)
  1.1818 -# define HAVE_DOS_BASED_FILE_SYSTEM
  1.1819 -# ifndef DIR_SEPARATOR_2 
  1.1820 -#  define DIR_SEPARATOR_2 '\\'
  1.1821 -# endif
  1.1822 -# ifndef PATH_SEPARATOR_2 
  1.1823 -#  define PATH_SEPARATOR_2 ';'
  1.1824 -# endif
  1.1825 +#define HAVE_DOS_BASED_FILE_SYSTEM
  1.1826 +#ifndef DIR_SEPARATOR_2
  1.1827 +#define DIR_SEPARATOR_2 '\\'
  1.1828 +#endif
  1.1829  #endif
  1.1830  
  1.1831  #ifndef DIR_SEPARATOR_2
  1.1832 @@ -4602,30 +4724,17 @@
  1.1833          (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2))
  1.1834  #endif /* DIR_SEPARATOR_2 */
  1.1835  
  1.1836 -#ifndef PATH_SEPARATOR_2
  1.1837 -# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR)
  1.1838 -#else /* PATH_SEPARATOR_2 */
  1.1839 -# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2)
  1.1840 -#endif /* PATH_SEPARATOR_2 */
  1.1841 -
  1.1842  #define XMALLOC(type, num)      ((type *) xmalloc ((num) * sizeof(type)))
  1.1843  #define XFREE(stale) do { \
  1.1844    if (stale) { free ((void *) stale); stale = 0; } \
  1.1845  } while (0)
  1.1846  
  1.1847 -#if defined DEBUGWRAPPER
  1.1848 -# define DEBUG(format, ...) fprintf(stderr, format, __VA_ARGS__)
  1.1849 -#else
  1.1850 -# define DEBUG(format, ...) 
  1.1851 -#endif
  1.1852 -
  1.1853  const char *program_name = NULL;
  1.1854  
  1.1855  void * xmalloc (size_t num);
  1.1856  char * xstrdup (const char *string);
  1.1857  char * basename (const char *name);
  1.1858 -char * find_executable(const char *wrapper);
  1.1859 -int    check_executable(const char *path);
  1.1860 +char * fnqualify(const char *path);
  1.1861  char * strendzap(char *str, const char *pat);
  1.1862  void lt_fatal (const char *message, ...);
  1.1863  
  1.1864 @@ -4634,10 +4743,8 @@
  1.1865  {
  1.1866    char **newargz;
  1.1867    int i;
  1.1868 -  
  1.1869 +
  1.1870    program_name = (char *) xstrdup ((char *) basename (argv[0]));
  1.1871 -  DEBUG("(main) argv[0]      : %s\n",argv[0]);
  1.1872 -  DEBUG("(main) program_name : %s\n",program_name);
  1.1873    newargz = XMALLOC(char *, argc+2);
  1.1874  EOF
  1.1875  
  1.1876 @@ -4646,23 +4753,13 @@
  1.1877  EOF
  1.1878  
  1.1879  	    cat >> $cwrappersource <<"EOF"
  1.1880 -  newargz[1] = find_executable(argv[0]);
  1.1881 -  if (newargz[1] == NULL)
  1.1882 -    lt_fatal("Couldn't find %s", argv[0]);
  1.1883 -  DEBUG("(main) found exe at : %s\n",newargz[1]);
  1.1884 +  newargz[1] = fnqualify(argv[0]);
  1.1885    /* we know the script has the same name, without the .exe */
  1.1886    /* so make sure newargz[1] doesn't end in .exe */
  1.1887 -  strendzap(newargz[1],".exe"); 
  1.1888 +  strendzap(newargz[1],".exe");
  1.1889    for (i = 1; i < argc; i++)
  1.1890      newargz[i+1] = xstrdup(argv[i]);
  1.1891    newargz[argc+1] = NULL;
  1.1892 -
  1.1893 -  for (i=0; i<argc+1; i++)
  1.1894 -  {
  1.1895 -    DEBUG("(main) newargz[%d]   : %s\n",i,newargz[i]);
  1.1896 -    ;
  1.1897 -  }
  1.1898 -
  1.1899  EOF
  1.1900  
  1.1901  	    cat >> $cwrappersource <<EOF
  1.1902 @@ -4682,7 +4779,7 @@
  1.1903    return p;
  1.1904  }
  1.1905  
  1.1906 -char * 
  1.1907 +char *
  1.1908  xstrdup (const char *string)
  1.1909  {
  1.1910    return string ? strcpy ((char *) xmalloc (strlen (string) + 1), string) : NULL
  1.1911 @@ -4696,7 +4793,7 @@
  1.1912  
  1.1913  #if defined (HAVE_DOS_BASED_FILE_SYSTEM)
  1.1914    /* Skip over the disk name in MSDOS pathnames. */
  1.1915 -  if (isalpha (name[0]) && name[1] == ':') 
  1.1916 +  if (isalpha (name[0]) && name[1] == ':')
  1.1917      name += 2;
  1.1918  #endif
  1.1919  
  1.1920 @@ -4706,134 +4803,35 @@
  1.1921    return (char *) base;
  1.1922  }
  1.1923  
  1.1924 -int
  1.1925 -check_executable(const char * path)
  1.1926 +char *
  1.1927 +fnqualify(const char *path)
  1.1928  {
  1.1929 -  struct stat st;
  1.1930 -
  1.1931 -  DEBUG("(check_executable)  : %s\n", path ? (*path ? path : "EMPTY!") : "NULL!");
  1.1932 -  if ((!path) || (!*path))
  1.1933 -    return 0;
  1.1934 -
  1.1935 -  if ((stat (path, &st) >= 0) &&
  1.1936 -      (
  1.1937 -#ifdef S_IXOTH
  1.1938 -       ((st.st_mode & S_IXOTH) == S_IXOTH) ||
  1.1939 -#endif
  1.1940 -#ifdef S_IXGRP
  1.1941 -       ((st.st_mode & S_IXGRP) == S_IXGRP) ||
  1.1942 -#endif
  1.1943 -       ((st.st_mode & S_IXUSR) == S_IXUSR)))
  1.1944 -    return 1;
  1.1945 -  else
  1.1946 -    return 0;
  1.1947 -}
  1.1948 -
  1.1949 -/* Searches for the full path of the wrapper.  Returns
  1.1950 -   newly allocated full path name if found, NULL otherwise */
  1.1951 -char *
  1.1952 -find_executable (const char* wrapper)
  1.1953 -{
  1.1954 -  int has_slash = 0;
  1.1955 -  const char* p;
  1.1956 -  const char* p_next;
  1.1957 -  struct stat st;
  1.1958 -  /* static buffer for getcwd */
  1.1959 +  size_t size;
  1.1960 +  char *p;
  1.1961    char tmp[LT_PATHMAX + 1];
  1.1962 -  int tmp_len;
  1.1963 -  char* concat_name;
  1.1964 -
  1.1965 -  DEBUG("(find_executable)  : %s\n", wrapper ? (*wrapper ? wrapper : "EMPTY!") : "NULL!");
  1.1966 -  
  1.1967 -  if ((wrapper == NULL) || (*wrapper == '\0'))
  1.1968 -    return NULL;
  1.1969 -
  1.1970 -  /* Absolute path? */
  1.1971 +
  1.1972 +  assert(path != NULL);
  1.1973 +
  1.1974 +  /* Is it qualified already? */
  1.1975  #if defined (HAVE_DOS_BASED_FILE_SYSTEM)
  1.1976 -  if (isalpha (wrapper[0]) && wrapper[1] == ':')
  1.1977 -  {
  1.1978 -    concat_name = xstrdup (wrapper);
  1.1979 -    if (check_executable(concat_name))
  1.1980 -      return concat_name;
  1.1981 -    XFREE(concat_name);
  1.1982 -  }
  1.1983 -  else
  1.1984 -  {
  1.1985 +  if (isalpha (path[0]) && path[1] == ':')
  1.1986 +    return xstrdup (path);
  1.1987  #endif
  1.1988 -    if (IS_DIR_SEPARATOR (wrapper[0]))
  1.1989 -    {
  1.1990 -      concat_name = xstrdup (wrapper);
  1.1991 -      if (check_executable(concat_name))
  1.1992 -        return concat_name;
  1.1993 -      XFREE(concat_name);
  1.1994 -    }
  1.1995 -#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
  1.1996 -  }
  1.1997 -#endif
  1.1998 -
  1.1999 -  for (p = wrapper; *p; p++)
  1.2000 -    if (*p == '/')
  1.2001 -    {
  1.2002 -      has_slash = 1;
  1.2003 -      break;
  1.2004 -    }
  1.2005 -  if (!has_slash)
  1.2006 -  {
  1.2007 -    /* no slashes; search PATH */
  1.2008 -    const char* path = getenv ("PATH");
  1.2009 -    if (path != NULL)
  1.2010 -    {
  1.2011 -      for (p = path; *p; p = p_next)
  1.2012 -      {
  1.2013 -        const char* q;
  1.2014 -        size_t p_len;
  1.2015 -        for (q = p; *q; q++)
  1.2016 -          if (IS_PATH_SEPARATOR(*q))
  1.2017 -            break;
  1.2018 -        p_len = q - p;
  1.2019 -        p_next = (*q == '\0' ? q : q + 1);
  1.2020 -        if (p_len == 0)
  1.2021 -        {
  1.2022 -          /* empty path: current directory */
  1.2023 -          if (getcwd (tmp, LT_PATHMAX) == NULL)
  1.2024 -            lt_fatal ("getcwd failed");
  1.2025 -          tmp_len = strlen(tmp);
  1.2026 -          concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1);
  1.2027 -          memcpy (concat_name, tmp, tmp_len);
  1.2028 -          concat_name[tmp_len] = '/';
  1.2029 -          strcpy (concat_name + tmp_len + 1, wrapper);
  1.2030 -        }
  1.2031 -        else
  1.2032 -        {
  1.2033 -          concat_name = XMALLOC(char, p_len + 1 + strlen(wrapper) + 1);
  1.2034 -          memcpy (concat_name, p, p_len);
  1.2035 -          concat_name[p_len] = '/';
  1.2036 -          strcpy (concat_name + p_len + 1, wrapper);
  1.2037 -        }
  1.2038 -        if (check_executable(concat_name))
  1.2039 -          return concat_name;
  1.2040 -        XFREE(concat_name);
  1.2041 -      }
  1.2042 -    }
  1.2043 -    /* not found in PATH; assume curdir */
  1.2044 -  }
  1.2045 -  /* Relative path | not found in path: prepend cwd */
  1.2046 +  if (IS_DIR_SEPARATOR (path[0]))
  1.2047 +    return xstrdup (path);
  1.2048 +
  1.2049 +  /* prepend the current directory */
  1.2050 +  /* doesn't handle '~' */
  1.2051    if (getcwd (tmp, LT_PATHMAX) == NULL)
  1.2052      lt_fatal ("getcwd failed");
  1.2053 -  tmp_len = strlen(tmp);
  1.2054 -  concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1);
  1.2055 -  memcpy (concat_name, tmp, tmp_len);
  1.2056 -  concat_name[tmp_len] = '/';
  1.2057 -  strcpy (concat_name + tmp_len + 1, wrapper);
  1.2058 -
  1.2059 -  if (check_executable(concat_name))
  1.2060 -    return concat_name;
  1.2061 -  XFREE(concat_name);
  1.2062 -  return NULL;
  1.2063 +  size = strlen(tmp) + 1 + strlen(path) + 1; /* +2 for '/' and '\0' */
  1.2064 +  p = XMALLOC(char, size);
  1.2065 +  sprintf(p, "%s%c%s", tmp, DIR_SEPARATOR, path);
  1.2066 +  return p;
  1.2067  }
  1.2068  
  1.2069  char *
  1.2070 -strendzap(char *str, const char *pat) 
  1.2071 +strendzap(char *str, const char *pat)
  1.2072  {
  1.2073    size_t len, patlen;
  1.2074  
  1.2075 @@ -4853,7 +4851,7 @@
  1.2076  }
  1.2077  
  1.2078  static void
  1.2079 -lt_error_core (int exit_status, const char * mode, 
  1.2080 +lt_error_core (int exit_status, const char * mode,
  1.2081            const char * message, va_list ap)
  1.2082  {
  1.2083    fprintf (stderr, "%s: %s: ", program_name, mode);
  1.2084 @@ -4882,7 +4880,7 @@
  1.2085  	  ;;
  1.2086  	esac
  1.2087  	$rm $output
  1.2088 -	trap "$rm $output; exit 1" 1 2 15
  1.2089 +	trap "$rm $output; exit $EXIT_FAILURE" 1 2 15
  1.2090  
  1.2091  	$echo > $output "\
  1.2092  #! $SHELL
  1.2093 @@ -4903,7 +4901,7 @@
  1.2094  
  1.2095  # The HP-UX ksh and POSIX shell print the target directory to stdout
  1.2096  # if CDPATH is set.
  1.2097 -if test \"\${CDPATH+set}\" = set; then CDPATH=:; export CDPATH; fi
  1.2098 +(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
  1.2099  
  1.2100  relink_command=\"$relink_command\"
  1.2101  
  1.2102 @@ -4982,7 +4980,7 @@
  1.2103        else
  1.2104  	$echo \"\$relink_command_output\" >&2
  1.2105  	$rm \"\$progdir/\$file\"
  1.2106 -	exit 1
  1.2107 +	exit $EXIT_FAILURE
  1.2108        fi
  1.2109      fi
  1.2110  
  1.2111 @@ -5044,20 +5042,20 @@
  1.2112  	esac
  1.2113  	$echo >> $output "\
  1.2114        \$echo \"\$0: cannot exec \$program \${1+\"\$@\"}\"
  1.2115 -      exit 1
  1.2116 +      exit $EXIT_FAILURE
  1.2117      fi
  1.2118    else
  1.2119      # The program doesn't exist.
  1.2120      \$echo \"\$0: error: \$progdir/\$program does not exist\" 1>&2
  1.2121      \$echo \"This script is just a wrapper for \$program.\" 1>&2
  1.2122      $echo \"See the $PACKAGE documentation for more information.\" 1>&2
  1.2123 -    exit 1
  1.2124 +    exit $EXIT_FAILURE
  1.2125    fi
  1.2126  fi\
  1.2127  "
  1.2128  	chmod +x $output
  1.2129        fi
  1.2130 -      exit 0
  1.2131 +      exit $EXIT_SUCCESS
  1.2132        ;;
  1.2133      esac
  1.2134  
  1.2135 @@ -5080,76 +5078,21 @@
  1.2136  
  1.2137        if test -n "$addlibs"; then
  1.2138  	gentop="$output_objdir/${outputname}x"
  1.2139 -	$show "${rm}r $gentop"
  1.2140 -	$run ${rm}r "$gentop"
  1.2141 -	$show "$mkdir $gentop"
  1.2142 -	$run $mkdir "$gentop"
  1.2143 -	status=$?
  1.2144 -	if test "$status" -ne 0 && test ! -d "$gentop"; then
  1.2145 -	  exit $status
  1.2146 -	fi
  1.2147  	generated="$generated $gentop"
  1.2148  
  1.2149 -	# Add in members from convenience archives.
  1.2150 -	for xlib in $addlibs; do
  1.2151 -	  # Extract the objects.
  1.2152 -	  case $xlib in
  1.2153 -	  [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
  1.2154 -	  *) xabs=`pwd`"/$xlib" ;;
  1.2155 -	  esac
  1.2156 -	  xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
  1.2157 -	  xdir="$gentop/$xlib"
  1.2158 -
  1.2159 -	  $show "${rm}r $xdir"
  1.2160 -	  $run ${rm}r "$xdir"
  1.2161 -	  $show "$mkdir $xdir"
  1.2162 -	  $run $mkdir "$xdir"
  1.2163 -	  status=$?
  1.2164 -	  if test "$status" -ne 0 && test ! -d "$xdir"; then
  1.2165 -	    exit $status
  1.2166 -	  fi
  1.2167 -	  # We will extract separately just the conflicting names and we will no
  1.2168 -	  # longer touch any unique names. It is faster to leave these extract
  1.2169 -	  # automatically by $AR in one run.
  1.2170 -	  $show "(cd $xdir && $AR x $xabs)"
  1.2171 -	  $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
  1.2172 -	  if ($AR t "$xabs" | sort | sort -uc >/dev/null 2>&1); then
  1.2173 -	    :
  1.2174 -	  else
  1.2175 -	    $echo "$modename: warning: object name conflicts; renaming object files" 1>&2
  1.2176 -	    $echo "$modename: warning: to ensure that they will not overwrite" 1>&2
  1.2177 -	    $AR t "$xabs" | sort | uniq -cd | while read -r count name
  1.2178 -	    do
  1.2179 -	      i=1
  1.2180 -	      while test "$i" -le "$count"
  1.2181 -	      do
  1.2182 -	       # Put our $i before any first dot (extension)
  1.2183 -	       # Never overwrite any file
  1.2184 -	       name_to="$name"
  1.2185 -	       while test "X$name_to" = "X$name" || test -f "$xdir/$name_to"
  1.2186 -	       do
  1.2187 -		 name_to=`$echo "X$name_to" | $Xsed -e "s/\([^.]*\)/\1-$i/"`
  1.2188 -	       done
  1.2189 -	       $show "(cd $xdir && $AR xN $i $xabs '$name' && $mv '$name' '$name_to')"
  1.2190 -	       $run eval "(cd \$xdir && $AR xN $i \$xabs '$name' && $mv '$name' '$name_to')" || exit $?
  1.2191 -	       i=`expr $i + 1`
  1.2192 -	      done
  1.2193 -	    done
  1.2194 -	  fi
  1.2195 -
  1.2196 -	  oldobjs="$oldobjs "`find $xdir -name \*.${objext} -print -o -name \*.lo -print | $NL2SP`
  1.2197 -	done
  1.2198 +	func_extract_archives $gentop $addlibs
  1.2199 +	oldobjs="$oldobjs $func_extract_archives_result"
  1.2200        fi
  1.2201  
  1.2202        # Do each command in the archive commands.
  1.2203        if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then
  1.2204 -	eval cmds=\"$old_archive_from_new_cmds\"
  1.2205 +       cmds=$old_archive_from_new_cmds
  1.2206        else
  1.2207  	eval cmds=\"$old_archive_cmds\"
  1.2208  
  1.2209  	if len=`expr "X$cmds" : ".*"` &&
  1.2210  	     test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
  1.2211 -	  :
  1.2212 +	  cmds=$old_archive_cmds
  1.2213  	else
  1.2214  	  # the command line is too long to link in one step, link in parts
  1.2215  	  $echo "using piecewise archive linking..."
  1.2216 @@ -5176,7 +5119,7 @@
  1.2217  	  for obj in $save_oldobjs
  1.2218  	  do
  1.2219  	    last_oldobj=$obj
  1.2220 -	  done  
  1.2221 +	  done
  1.2222  	  for obj in $save_oldobjs
  1.2223  	  do
  1.2224  	    oldobjs="$objlist $obj"
  1.2225 @@ -5190,7 +5133,7 @@
  1.2226  	      oldobjs=$objlist
  1.2227  	      if test "$obj" = "$last_oldobj" ; then
  1.2228  	        RANLIB=$save_RANLIB
  1.2229 -	      fi  
  1.2230 +	      fi
  1.2231  	      test -z "$concat_cmds" || concat_cmds=$concat_cmds~
  1.2232  	      eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\"
  1.2233  	      objlist=
  1.2234 @@ -5201,12 +5144,13 @@
  1.2235  	  if test "X$oldobjs" = "X" ; then
  1.2236  	    eval cmds=\"\$concat_cmds\"
  1.2237  	  else
  1.2238 -	    eval cmds=\"\$concat_cmds~$old_archive_cmds\"
  1.2239 +	    eval cmds=\"\$concat_cmds~\$old_archive_cmds\"
  1.2240  	  fi
  1.2241  	fi
  1.2242        fi
  1.2243        save_ifs="$IFS"; IFS='~'
  1.2244        for cmd in $cmds; do
  1.2245 +        eval cmd=\"$cmd\"
  1.2246  	IFS="$save_ifs"
  1.2247  	$show "$cmd"
  1.2248  	$run eval "$cmd" || exit $?
  1.2249 @@ -5238,8 +5182,12 @@
  1.2250  	fi
  1.2251        done
  1.2252        # Quote the link command for shipping.
  1.2253 -      relink_command="(cd `pwd`; $SHELL $0 --mode=relink $libtool_args @inst_prefix_dir@)"
  1.2254 +      relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)"
  1.2255        relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"`
  1.2256 +      if test "$hardcode_automatic" = yes ; then
  1.2257 +	relink_command=
  1.2258 +      fi
  1.2259 +
  1.2260  
  1.2261        # Only create the output if not a dry run.
  1.2262        if test -z "$run"; then
  1.2263 @@ -5258,7 +5206,7 @@
  1.2264  		eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
  1.2265  		if test -z "$libdir"; then
  1.2266  		  $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
  1.2267 -		  exit 1
  1.2268 +		  exit $EXIT_FAILURE
  1.2269  		fi
  1.2270  		newdependency_libs="$newdependency_libs $libdir/$name"
  1.2271  		;;
  1.2272 @@ -5272,7 +5220,7 @@
  1.2273  	      eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
  1.2274  	      if test -z "$libdir"; then
  1.2275  		$echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
  1.2276 -		exit 1
  1.2277 +		exit $EXIT_FAILURE
  1.2278  	      fi
  1.2279  	      newdlfiles="$newdlfiles $libdir/$name"
  1.2280  	    done
  1.2281 @@ -5283,11 +5231,30 @@
  1.2282  	      eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
  1.2283  	      if test -z "$libdir"; then
  1.2284  		$echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
  1.2285 -		exit 1
  1.2286 +		exit $EXIT_FAILURE
  1.2287  	      fi
  1.2288  	      newdlprefiles="$newdlprefiles $libdir/$name"
  1.2289  	    done
  1.2290  	    dlprefiles="$newdlprefiles"
  1.2291 +	  else
  1.2292 +	    newdlfiles=
  1.2293 +	    for lib in $dlfiles; do
  1.2294 +	      case $lib in
  1.2295 +		[\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
  1.2296 +		*) abs=`pwd`"/$lib" ;;
  1.2297 +	      esac
  1.2298 +	      newdlfiles="$newdlfiles $abs"
  1.2299 +	    done
  1.2300 +	    dlfiles="$newdlfiles"
  1.2301 +	    newdlprefiles=
  1.2302 +	    for lib in $dlprefiles; do
  1.2303 +	      case $lib in
  1.2304 +		[\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
  1.2305 +		*) abs=`pwd`"/$lib" ;;
  1.2306 +	      esac
  1.2307 +	      newdlprefiles="$newdlprefiles $abs"
  1.2308 +	    done
  1.2309 +	    dlprefiles="$newdlprefiles"
  1.2310  	  fi
  1.2311  	  $rm $output
  1.2312  	  # place dlname in correct position for cygwin
  1.2313 @@ -5344,7 +5311,7 @@
  1.2314        $run eval '(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)' || exit $?
  1.2315        ;;
  1.2316      esac
  1.2317 -    exit 0
  1.2318 +    exit $EXIT_SUCCESS
  1.2319      ;;
  1.2320  
  1.2321    # libtool install mode
  1.2322 @@ -5433,13 +5400,13 @@
  1.2323      if test -z "$install_prog"; then
  1.2324        $echo "$modename: you must specify an install program" 1>&2
  1.2325        $echo "$help" 1>&2
  1.2326 -      exit 1
  1.2327 +      exit $EXIT_FAILURE
  1.2328      fi
  1.2329  
  1.2330      if test -n "$prev"; then
  1.2331        $echo "$modename: the \`$prev' option requires an argument" 1>&2
  1.2332        $echo "$help" 1>&2
  1.2333 -      exit 1
  1.2334 +      exit $EXIT_FAILURE
  1.2335      fi
  1.2336  
  1.2337      if test -z "$files"; then
  1.2338 @@ -5449,7 +5416,7 @@
  1.2339  	$echo "$modename: you must specify a destination" 1>&2
  1.2340        fi
  1.2341        $echo "$help" 1>&2
  1.2342 -      exit 1
  1.2343 +      exit $EXIT_FAILURE
  1.2344      fi
  1.2345  
  1.2346      # Strip any trailing slash from the destination.
  1.2347 @@ -5470,7 +5437,7 @@
  1.2348        if test "$#" -gt 2; then
  1.2349  	$echo "$modename: \`$dest' is not a directory" 1>&2
  1.2350  	$echo "$help" 1>&2
  1.2351 -	exit 1
  1.2352 +	exit $EXIT_FAILURE
  1.2353        fi
  1.2354      fi
  1.2355      case $destdir in
  1.2356 @@ -5482,7 +5449,7 @@
  1.2357  	*)
  1.2358  	  $echo "$modename: \`$destdir' must be an absolute directory name" 1>&2
  1.2359  	  $echo "$help" 1>&2
  1.2360 -	  exit 1
  1.2361 +	  exit $EXIT_FAILURE
  1.2362  	  ;;
  1.2363  	esac
  1.2364        done
  1.2365 @@ -5511,7 +5478,7 @@
  1.2366  	else
  1.2367  	  $echo "$modename: \`$file' is not a valid libtool archive" 1>&2
  1.2368  	  $echo "$help" 1>&2
  1.2369 -	  exit 1
  1.2370 +	  exit $EXIT_FAILURE
  1.2371  	fi
  1.2372  
  1.2373  	library_names=
  1.2374 @@ -5553,7 +5520,7 @@
  1.2375  	  # but it's something to keep an eye on.
  1.2376  	  if test "$inst_prefix_dir" = "$destdir"; then
  1.2377  	    $echo "$modename: error: cannot install \`$file' to a directory not ending in $libdir" 1>&2
  1.2378 -	    exit 1
  1.2379 +	    exit $EXIT_FAILURE
  1.2380  	  fi
  1.2381  
  1.2382  	  if test -n "$inst_prefix_dir"; then
  1.2383 @@ -5568,7 +5535,7 @@
  1.2384  	  if $run eval "$relink_command"; then :
  1.2385  	  else
  1.2386  	    $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
  1.2387 -	    exit 1
  1.2388 +	    exit $EXIT_FAILURE
  1.2389  	  fi
  1.2390  	fi
  1.2391  
  1.2392 @@ -5603,10 +5570,11 @@
  1.2393  
  1.2394  	  # Do each command in the postinstall commands.
  1.2395  	  lib="$destdir/$realname"
  1.2396 -	  eval cmds=\"$postinstall_cmds\"
  1.2397 +	  cmds=$postinstall_cmds
  1.2398  	  save_ifs="$IFS"; IFS='~'
  1.2399  	  for cmd in $cmds; do
  1.2400  	    IFS="$save_ifs"
  1.2401 +	    eval cmd=\"$cmd\"
  1.2402  	    $show "$cmd"
  1.2403  	    $run eval "$cmd" || exit $?
  1.2404  	  done
  1.2405 @@ -5646,7 +5614,7 @@
  1.2406  	*)
  1.2407  	  $echo "$modename: cannot copy a libtool object to \`$destfile'" 1>&2
  1.2408  	  $echo "$help" 1>&2
  1.2409 -	  exit 1
  1.2410 +	  exit $EXIT_FAILURE
  1.2411  	  ;;
  1.2412  	esac
  1.2413  
  1.2414 @@ -5664,7 +5632,7 @@
  1.2415  	  $show "$install_prog $staticobj $staticdest"
  1.2416  	  $run eval "$install_prog \$staticobj \$staticdest" || exit $?
  1.2417  	fi
  1.2418 -	exit 0
  1.2419 +	exit $EXIT_SUCCESS
  1.2420  	;;
  1.2421  
  1.2422        *)
  1.2423 @@ -5718,7 +5686,7 @@
  1.2424  	  # Check the variables that should have been set.
  1.2425  	  if test -z "$notinst_deplibs"; then
  1.2426  	    $echo "$modename: invalid libtool wrapper script \`$wrapper'" 1>&2
  1.2427 -	    exit 1
  1.2428 +	    exit $EXIT_FAILURE
  1.2429  	  fi
  1.2430  
  1.2431  	  finalize=yes
  1.2432 @@ -5759,8 +5727,12 @@
  1.2433  	      tmpdir="/tmp"
  1.2434  	      test -n "$TMPDIR" && tmpdir="$TMPDIR"
  1.2435  	      tmpdir="$tmpdir/libtool-$$"
  1.2436 -	      if $mkdir -p "$tmpdir" && chmod 700 "$tmpdir"; then :
  1.2437 +	      save_umask=`umask`
  1.2438 +	      umask 0077
  1.2439 +	      if $mkdir "$tmpdir"; then
  1.2440 +	        umask $save_umask
  1.2441  	      else
  1.2442 +	        umask $save_umask
  1.2443  		$echo "$modename: error: cannot create temporary directory \`$tmpdir'" 1>&2
  1.2444  		continue
  1.2445  	      fi
  1.2446 @@ -5819,16 +5791,17 @@
  1.2447        $show "$install_prog $file $oldlib"
  1.2448        $run eval "$install_prog \$file \$oldlib" || exit $?
  1.2449  
  1.2450 -      if test -n "$stripme" && test -n "$striplib"; then
  1.2451 +      if test -n "$stripme" && test -n "$old_striplib"; then
  1.2452  	$show "$old_striplib $oldlib"
  1.2453  	$run eval "$old_striplib $oldlib" || exit $?
  1.2454        fi
  1.2455  
  1.2456        # Do each command in the postinstall commands.
  1.2457 -      eval cmds=\"$old_postinstall_cmds\"
  1.2458 +      cmds=$old_postinstall_cmds
  1.2459        save_ifs="$IFS"; IFS='~'
  1.2460        for cmd in $cmds; do
  1.2461  	IFS="$save_ifs"
  1.2462 +	eval cmd=\"$cmd\"
  1.2463  	$show "$cmd"
  1.2464  	$run eval "$cmd" || exit $?
  1.2465        done
  1.2466 @@ -5842,9 +5815,9 @@
  1.2467      if test -n "$current_libdirs"; then
  1.2468        # Maybe just do a dry run.
  1.2469        test -n "$run" && current_libdirs=" -n$current_libdirs"
  1.2470 -      exec_cmd='$SHELL $0 --finish$current_libdirs'
  1.2471 +      exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs'
  1.2472      else
  1.2473 -      exit 0
  1.2474 +      exit $EXIT_SUCCESS
  1.2475      fi
  1.2476      ;;
  1.2477  
  1.2478 @@ -5863,10 +5836,11 @@
  1.2479        for libdir in $libdirs; do
  1.2480  	if test -n "$finish_cmds"; then
  1.2481  	  # Do each command in the finish commands.
  1.2482 -	  eval cmds=\"$finish_cmds\"
  1.2483 +	  cmds=$finish_cmds
  1.2484  	  save_ifs="$IFS"; IFS='~'
  1.2485  	  for cmd in $cmds; do
  1.2486  	    IFS="$save_ifs"
  1.2487 +	    eval cmd=\"$cmd\"
  1.2488  	    $show "$cmd"
  1.2489  	    $run eval "$cmd" || admincmds="$admincmds
  1.2490         $cmd"
  1.2491 @@ -5883,7 +5857,7 @@
  1.2492      fi
  1.2493  
  1.2494      # Exit here if they wanted silent mode.
  1.2495 -    test "$show" = : && exit 0
  1.2496 +    test "$show" = : && exit $EXIT_SUCCESS
  1.2497  
  1.2498      $echo "----------------------------------------------------------------------"
  1.2499      $echo "Libraries have been installed in:"
  1.2500 @@ -5919,7 +5893,7 @@
  1.2501      $echo "See any operating system documentation about shared libraries for"
  1.2502      $echo "more information, such as the ld(1) and ld.so(8) manual pages."
  1.2503      $echo "----------------------------------------------------------------------"
  1.2504 -    exit 0
  1.2505 +    exit $EXIT_SUCCESS
  1.2506      ;;
  1.2507  
  1.2508    # libtool execute mode
  1.2509 @@ -5931,7 +5905,7 @@
  1.2510      if test -z "$cmd"; then
  1.2511        $echo "$modename: you must specify a COMMAND" 1>&2
  1.2512        $echo "$help"
  1.2513 -      exit 1
  1.2514 +      exit $EXIT_FAILURE
  1.2515      fi
  1.2516  
  1.2517      # Handle -dlopen flags immediately.
  1.2518 @@ -5939,7 +5913,7 @@
  1.2519        if test ! -f "$file"; then
  1.2520  	$echo "$modename: \`$file' is not a file" 1>&2
  1.2521  	$echo "$help" 1>&2
  1.2522 -	exit 1
  1.2523 +	exit $EXIT_FAILURE
  1.2524        fi
  1.2525  
  1.2526        dir=
  1.2527 @@ -5950,7 +5924,7 @@
  1.2528  	else
  1.2529  	  $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
  1.2530  	  $echo "$help" 1>&2
  1.2531 -	  exit 1
  1.2532 +	  exit $EXIT_FAILURE
  1.2533  	fi
  1.2534  
  1.2535  	# Read the libtool library.
  1.2536 @@ -5977,7 +5951,7 @@
  1.2537  	  dir="$dir/$objdir"
  1.2538  	else
  1.2539  	  $echo "$modename: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2
  1.2540 -	  exit 1
  1.2541 +	  exit $EXIT_FAILURE
  1.2542  	fi
  1.2543  	;;
  1.2544  
  1.2545 @@ -6057,7 +6031,7 @@
  1.2546  	$echo "export $shlibpath_var"
  1.2547        fi
  1.2548        $echo "$cmd$args"
  1.2549 -      exit 0
  1.2550 +      exit $EXIT_SUCCESS
  1.2551      fi
  1.2552      ;;
  1.2553  
  1.2554 @@ -6085,7 +6059,7 @@
  1.2555      if test -z "$rm"; then
  1.2556        $echo "$modename: you must specify an RM program" 1>&2
  1.2557        $echo "$help" 1>&2
  1.2558 -      exit 1
  1.2559 +      exit $EXIT_FAILURE
  1.2560      fi
  1.2561  
  1.2562      rmdirs=
  1.2563 @@ -6140,10 +6114,11 @@
  1.2564  	  if test "$mode" = uninstall; then
  1.2565  	    if test -n "$library_names"; then
  1.2566  	      # Do each command in the postuninstall commands.
  1.2567 -	      eval cmds=\"$postuninstall_cmds\"
  1.2568 +	      cmds=$postuninstall_cmds
  1.2569  	      save_ifs="$IFS"; IFS='~'
  1.2570  	      for cmd in $cmds; do
  1.2571  		IFS="$save_ifs"
  1.2572 +		eval cmd=\"$cmd\"
  1.2573  		$show "$cmd"
  1.2574  		$run eval "$cmd"
  1.2575  		if test "$?" -ne 0 && test "$rmforce" != yes; then
  1.2576 @@ -6155,10 +6130,11 @@
  1.2577  
  1.2578  	    if test -n "$old_library"; then
  1.2579  	      # Do each command in the old_postuninstall commands.
  1.2580 -	      eval cmds=\"$old_postuninstall_cmds\"
  1.2581 +	      cmds=$old_postuninstall_cmds
  1.2582  	      save_ifs="$IFS"; IFS='~'
  1.2583  	      for cmd in $cmds; do
  1.2584  		IFS="$save_ifs"
  1.2585 +		eval cmd=\"$cmd\"
  1.2586  		$show "$cmd"
  1.2587  		$run eval "$cmd"
  1.2588  		if test "$?" -ne 0 && test "$rmforce" != yes; then
  1.2589 @@ -6197,7 +6173,7 @@
  1.2590  	if test "$mode" = clean ; then
  1.2591  	  noexename=$name
  1.2592  	  case $file in
  1.2593 -	  *.exe) 
  1.2594 +	  *.exe)
  1.2595  	    file=`$echo $file|${SED} 's,.exe$,,'`
  1.2596  	    noexename=`$echo $name|${SED} 's,.exe$,,'`
  1.2597  	    # $file with .exe has already been added to rmfiles,
  1.2598 @@ -6242,20 +6218,20 @@
  1.2599    "")
  1.2600      $echo "$modename: you must specify a MODE" 1>&2
  1.2601      $echo "$generic_help" 1>&2
  1.2602 -    exit 1
  1.2603 +    exit $EXIT_FAILURE
  1.2604      ;;
  1.2605    esac
  1.2606  
  1.2607    if test -z "$exec_cmd"; then
  1.2608      $echo "$modename: invalid operation mode \`$mode'" 1>&2
  1.2609      $echo "$generic_help" 1>&2
  1.2610 -    exit 1
  1.2611 +    exit $EXIT_FAILURE
  1.2612    fi
  1.2613  fi # test -z "$show_help"
  1.2614  
  1.2615  if test -n "$exec_cmd"; then
  1.2616    eval exec $exec_cmd
  1.2617 -  exit 1
  1.2618 +  exit $EXIT_FAILURE
  1.2619  fi
  1.2620  
  1.2621  # We need to display help for each of the modes.
  1.2622 @@ -6291,7 +6267,7 @@
  1.2623  a more detailed description of MODE.
  1.2624  
  1.2625  Report bugs to <bug-libtool@gnu.org>."
  1.2626 -  exit 0
  1.2627 +  exit $EXIT_SUCCESS
  1.2628    ;;
  1.2629  
  1.2630  clean)
  1.2631 @@ -6403,6 +6379,8 @@
  1.2632    -no-undefined     declare that a library does not refer to external symbols
  1.2633    -o OUTPUT-FILE    create OUTPUT-FILE from the specified objects
  1.2634    -objectlist FILE  Use a list of object files found in FILE to specify objects
  1.2635 +  -precious-files-regex REGEX
  1.2636 +                    don't remove output files matching REGEX
  1.2637    -release RELEASE  specify package release information
  1.2638    -rpath LIBDIR     the created library will eventually be installed in LIBDIR
  1.2639    -R[ ]LIBDIR       add LIBDIR to the runtime path of programs and libraries
  1.2640 @@ -6444,14 +6422,14 @@
  1.2641  *)
  1.2642    $echo "$modename: invalid operation mode \`$mode'" 1>&2
  1.2643    $echo "$help" 1>&2
  1.2644 -  exit 1
  1.2645 +  exit $EXIT_FAILURE
  1.2646    ;;
  1.2647  esac
  1.2648  
  1.2649  $echo
  1.2650  $echo "Try \`$modename --help' for more information about other modes."
  1.2651  
  1.2652 -exit 0
  1.2653 +exit $EXIT_SUCCESS
  1.2654  
  1.2655  # The TAGs below are defined such that we never get into a situation
  1.2656  # in which we disable both kinds of libraries.  Given conflicting