build-scripts/ltmain.sh
author Sam Lantinga <slouken@libsdl.org>
Tue, 21 Mar 2006 10:20:44 +0000
changeset 1570 a740bca2a1b1
parent 1361 19418e4422cb
child 1611 ec3466b08f17
permissions -rw-r--r--
Updated to libtool-1.5.22
     1 # Based on libtool-1.5.22
     2 # ltmain.sh - Provide generalized library-building support services.
     3 # NOTE: Changing this file will not affect anything until you rerun configure.
     4 #
     5 # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005
     6 # Free Software Foundation, Inc.
     7 # Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
     8 #
     9 # This program is free software; you can redistribute it and/or modify
    10 # it under the terms of the GNU General Public License as published by
    11 # the Free Software Foundation; either version 2 of the License, or
    12 # (at your option) any later version.
    13 #
    14 # This program is distributed in the hope that it will be useful, but
    15 # WITHOUT ANY WARRANTY; without even the implied warranty of
    16 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    17 # General Public License for more details.
    18 #
    19 # You should have received a copy of the GNU General Public License
    20 # along with this program; if not, write to the Free Software
    21 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
    22 #
    23 # As a special exception to the GNU General Public License, if you
    24 # distribute this file as part of a program that contains a
    25 # configuration script generated by Autoconf, you may include it under
    26 # the same distribution terms that you use for the rest of that program.
    27 
    28 basename="s,^.*/,,g"
    29 
    30 # Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh
    31 # is ksh but when the shell is invoked as "sh" and the current value of
    32 # the _XPG environment variable is not equal to 1 (one), the special
    33 # positional parameter $0, within a function call, is the name of the
    34 # function.
    35 progpath="$0"
    36 
    37 # The name of this program:
    38 progname=`echo "$progpath" | $SED $basename`
    39 modename="$progname"
    40 
    41 # Global variables:
    42 EXIT_SUCCESS=0
    43 EXIT_FAILURE=1
    44 
    45 PROGRAM=ltmain.sh
    46 PACKAGE=libtool
    47 VERSION=1.5.22
    48 TIMESTAMP=" (1.1220.2.365 2005/12/18 22:14:06)"
    49 
    50 # See if we are running on zsh, and set the options which allow our
    51 # commands through without removal of \ escapes.
    52 if test -n "${ZSH_VERSION+set}" ; then
    53   setopt NO_GLOB_SUBST
    54 fi
    55 
    56 # Check that we have a working $echo.
    57 if test "X$1" = X--no-reexec; then
    58   # Discard the --no-reexec flag, and continue.
    59   shift
    60 elif test "X$1" = X--fallback-echo; then
    61   # Avoid inline document here, it may be left over
    62   :
    63 elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then
    64   # Yippee, $echo works!
    65   :
    66 else
    67   # Restart under the correct shell, and then maybe $echo will work.
    68   exec $SHELL "$progpath" --no-reexec ${1+"$@"}
    69 fi
    70 
    71 if test "X$1" = X--fallback-echo; then
    72   # used as fallback echo
    73   shift
    74   cat <<EOF
    75 $*
    76 EOF
    77   exit $EXIT_SUCCESS
    78 fi
    79 
    80 default_mode=
    81 help="Try \`$progname --help' for more information."
    82 magic="%%%MAGIC variable%%%"
    83 mkdir="mkdir"
    84 mv="mv -f"
    85 rm="rm -f"
    86 
    87 # Sed substitution that helps us do robust quoting.  It backslashifies
    88 # metacharacters that are still active within double-quoted strings.
    89 Xsed="${SED}"' -e 1s/^X//'
    90 sed_quote_subst='s/\([\\`\\"$\\\\]\)/\\\1/g'
    91 # test EBCDIC or ASCII
    92 case `echo X|tr X '\101'` in
    93  A) # ASCII based system
    94     # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr
    95   SP2NL='tr \040 \012'
    96   NL2SP='tr \015\012 \040\040'
    97   ;;
    98  *) # EBCDIC based system
    99   SP2NL='tr \100 \n'
   100   NL2SP='tr \r\n \100\100'
   101   ;;
   102 esac
   103 
   104 # NLS nuisances.
   105 # Only set LANG and LC_ALL to C if already set.
   106 # These must not be set unconditionally because not all systems understand
   107 # e.g. LANG=C (notably SCO).
   108 # We save the old values to restore during execute mode.
   109 if test "${LC_ALL+set}" = set; then
   110   save_LC_ALL="$LC_ALL"; LC_ALL=C; export LC_ALL
   111 fi
   112 if test "${LANG+set}" = set; then
   113   save_LANG="$LANG"; LANG=C; export LANG
   114 fi
   115 
   116 # Make sure IFS has a sensible default
   117 lt_nl='
   118 '
   119 IFS=" 	$lt_nl"
   120 
   121 if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
   122   $echo "$modename: not configured to build any kind of library" 1>&2
   123   $echo "Fatal configuration error.  See the $PACKAGE docs for more information." 1>&2
   124   exit $EXIT_FAILURE
   125 fi
   126 
   127 # Global variables.
   128 mode=$default_mode
   129 nonopt=
   130 prev=
   131 prevopt=
   132 run=
   133 show="$echo"
   134 show_help=
   135 execute_dlfiles=
   136 duplicate_deps=no
   137 preserve_args=
   138 lo2o="s/\\.lo\$/.${objext}/"
   139 o2lo="s/\\.${objext}\$/.lo/"
   140 
   141 #####################################
   142 # Shell function definitions:
   143 # This seems to be the best place for them
   144 
   145 # func_mktempdir [string]
   146 # Make a temporary directory that won't clash with other running
   147 # libtool processes, and avoids race conditions if possible.  If
   148 # given, STRING is the basename for that directory.
   149 func_mktempdir ()
   150 {
   151     my_template="${TMPDIR-/tmp}/${1-$progname}"
   152 
   153     if test "$run" = ":"; then
   154       # Return a directory name, but don't create it in dry-run mode
   155       my_tmpdir="${my_template}-$$"
   156     else
   157 
   158       # If mktemp works, use that first and foremost
   159       my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null`
   160 
   161       if test ! -d "$my_tmpdir"; then
   162 	# Failing that, at least try and use $RANDOM to avoid a race
   163 	my_tmpdir="${my_template}-${RANDOM-0}$$"
   164 
   165 	save_mktempdir_umask=`umask`
   166 	umask 0077
   167 	$mkdir "$my_tmpdir"
   168 	umask $save_mktempdir_umask
   169       fi
   170 
   171       # If we're not in dry-run mode, bomb out on failure
   172       test -d "$my_tmpdir" || {
   173         $echo "cannot create temporary directory \`$my_tmpdir'" 1>&2
   174 	exit $EXIT_FAILURE
   175       }
   176     fi
   177 
   178     $echo "X$my_tmpdir" | $Xsed
   179 }
   180 
   181 
   182 # func_win32_libid arg
   183 # return the library type of file 'arg'
   184 #
   185 # Need a lot of goo to handle *both* DLLs and import libs
   186 # Has to be a shell function in order to 'eat' the argument
   187 # that is supplied when $file_magic_command is called.
   188 func_win32_libid ()
   189 {
   190   win32_libid_type="unknown"
   191   win32_fileres=`file -L $1 2>/dev/null`
   192   case $win32_fileres in
   193   *ar\ archive\ import\ library*) # definitely import
   194     win32_libid_type="x86 archive import"
   195     ;;
   196   *ar\ archive*) # could be an import, or static
   197     if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | \
   198       $EGREP -e 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then
   199       win32_nmres=`eval $NM -f posix -A $1 | \
   200 	$SED -n -e '1,100{/ I /{s,.*,import,;p;q;};}'`
   201       case $win32_nmres in
   202       import*)  win32_libid_type="x86 archive import";;
   203       *)        win32_libid_type="x86 archive static";;
   204       esac
   205     fi
   206     ;;
   207   *DLL*)
   208     win32_libid_type="x86 DLL"
   209     ;;
   210   *executable*) # but shell scripts are "executable" too...
   211     case $win32_fileres in
   212     *MS\ Windows\ PE\ Intel*)
   213       win32_libid_type="x86 DLL"
   214       ;;
   215     esac
   216     ;;
   217   esac
   218   $echo $win32_libid_type
   219 }
   220 
   221 
   222 # func_infer_tag arg
   223 # Infer tagged configuration to use if any are available and
   224 # if one wasn't chosen via the "--tag" command line option.
   225 # Only attempt this if the compiler in the base compile
   226 # command doesn't match the default compiler.
   227 # arg is usually of the form 'gcc ...'
   228 func_infer_tag ()
   229 {
   230     if test -n "$available_tags" && test -z "$tagname"; then
   231       CC_quoted=
   232       for arg in $CC; do
   233 	case $arg in
   234 	  *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
   235 	  arg="\"$arg\""
   236 	  ;;
   237 	esac
   238 	CC_quoted="$CC_quoted $arg"
   239       done
   240       case $@ in
   241       # Blanks in the command may have been stripped by the calling shell,
   242       # but not from the CC environment variable when configure was run.
   243       " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*) ;;
   244       # Blanks at the start of $base_compile will cause this to fail
   245       # if we don't check for them as well.
   246       *)
   247 	for z in $available_tags; do
   248 	  if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then
   249 	    # Evaluate the configuration.
   250 	    eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`"
   251 	    CC_quoted=
   252 	    for arg in $CC; do
   253 	    # Double-quote args containing other shell metacharacters.
   254 	    case $arg in
   255 	      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
   256 	      arg="\"$arg\""
   257 	      ;;
   258 	    esac
   259 	    CC_quoted="$CC_quoted $arg"
   260 	  done
   261 	    case "$@ " in
   262 	      " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*)
   263 	      # The compiler in the base compile command matches
   264 	      # the one in the tagged configuration.
   265 	      # Assume this is the tagged configuration we want.
   266 	      tagname=$z
   267 	      break
   268 	      ;;
   269 	    esac
   270 	  fi
   271 	done
   272 	# If $tagname still isn't set, then no tagged configuration
   273 	# was found and let the user know that the "--tag" command
   274 	# line option must be used.
   275 	if test -z "$tagname"; then
   276 	  $echo "$modename: unable to infer tagged configuration"
   277 	  $echo "$modename: specify a tag with \`--tag'" 1>&2
   278 	  exit $EXIT_FAILURE
   279 #        else
   280 #          $echo "$modename: using $tagname tagged configuration"
   281 	fi
   282 	;;
   283       esac
   284     fi
   285 }
   286 
   287 
   288 # func_extract_an_archive dir oldlib
   289 func_extract_an_archive ()
   290 {
   291     f_ex_an_ar_dir="$1"; shift
   292     f_ex_an_ar_oldlib="$1"
   293 
   294     $show "(cd $f_ex_an_ar_dir && $AR x $f_ex_an_ar_oldlib)"
   295     $run eval "(cd \$f_ex_an_ar_dir && $AR x \$f_ex_an_ar_oldlib)" || exit $?
   296     if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then
   297      :
   298     else
   299       $echo "$modename: ERROR: object name conflicts: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib" 1>&2
   300       exit $EXIT_FAILURE
   301     fi
   302 }
   303 
   304 # func_extract_archives gentop oldlib ...
   305 func_extract_archives ()
   306 {
   307     my_gentop="$1"; shift
   308     my_oldlibs=${1+"$@"}
   309     my_oldobjs=""
   310     my_xlib=""
   311     my_xabs=""
   312     my_xdir=""
   313     my_status=""
   314 
   315     $show "${rm}r $my_gentop"
   316     $run ${rm}r "$my_gentop"
   317     $show "$mkdir $my_gentop"
   318     $run $mkdir "$my_gentop"
   319     my_status=$?
   320     if test "$my_status" -ne 0 && test ! -d "$my_gentop"; then
   321       exit $my_status
   322     fi
   323 
   324     for my_xlib in $my_oldlibs; do
   325       # Extract the objects.
   326       case $my_xlib in
   327 	[\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;;
   328 	*) my_xabs=`pwd`"/$my_xlib" ;;
   329       esac
   330       my_xlib=`$echo "X$my_xlib" | $Xsed -e 's%^.*/%%'`
   331       my_xdir="$my_gentop/$my_xlib"
   332 
   333       $show "${rm}r $my_xdir"
   334       $run ${rm}r "$my_xdir"
   335       $show "$mkdir $my_xdir"
   336       $run $mkdir "$my_xdir"
   337       exit_status=$?
   338       if test "$exit_status" -ne 0 && test ! -d "$my_xdir"; then
   339 	exit $exit_status
   340       fi
   341       case $host in
   342       *-darwin*)
   343 	$show "Extracting $my_xabs"
   344 	# Do not bother doing anything if just a dry run
   345 	if test -z "$run"; then
   346 	  darwin_orig_dir=`pwd`
   347 	  cd $my_xdir || exit $?
   348 	  darwin_archive=$my_xabs
   349 	  darwin_curdir=`pwd`
   350 	  darwin_base_archive=`$echo "X$darwin_archive" | $Xsed -e 's%^.*/%%'`
   351 	  darwin_arches=`lipo -info "$darwin_archive" 2>/dev/null | $EGREP Architectures 2>/dev/null`
   352 	  if test -n "$darwin_arches"; then 
   353 	    darwin_arches=`echo "$darwin_arches" | $SED -e 's/.*are://'`
   354 	    darwin_arch=
   355 	    $show "$darwin_base_archive has multiple architectures $darwin_arches"
   356 	    for darwin_arch in  $darwin_arches ; do
   357 	      mkdir -p "unfat-$$/${darwin_base_archive}-${darwin_arch}"
   358 	      lipo -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}"
   359 	      cd "unfat-$$/${darwin_base_archive}-${darwin_arch}"
   360 	      func_extract_an_archive "`pwd`" "${darwin_base_archive}"
   361 	      cd "$darwin_curdir"
   362 	      $rm "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}"
   363 	    done # $darwin_arches
   364       ## Okay now we have a bunch of thin objects, gotta fatten them up :)
   365 	    darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print| xargs basename | sort -u | $NL2SP`
   366 	    darwin_file=
   367 	    darwin_files=
   368 	    for darwin_file in $darwin_filelist; do
   369 	      darwin_files=`find unfat-$$ -name $darwin_file -print | $NL2SP`
   370 	      lipo -create -output "$darwin_file" $darwin_files
   371 	    done # $darwin_filelist
   372 	    ${rm}r unfat-$$
   373 	    cd "$darwin_orig_dir"
   374 	  else
   375 	    cd "$darwin_orig_dir"
   376  	    func_extract_an_archive "$my_xdir" "$my_xabs"
   377 	  fi # $darwin_arches
   378 	fi # $run
   379 	;;
   380       *)
   381         func_extract_an_archive "$my_xdir" "$my_xabs"
   382         ;;
   383       esac
   384       my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP`
   385     done
   386     func_extract_archives_result="$my_oldobjs"
   387 }
   388 # End of Shell function definitions
   389 #####################################
   390 
   391 # Darwin sucks
   392 eval std_shrext=\"$shrext_cmds\"
   393 
   394 disable_libs=no
   395 
   396 # Parse our command line options once, thoroughly.
   397 while test "$#" -gt 0
   398 do
   399   arg="$1"
   400   shift
   401 
   402   case $arg in
   403   -*=*) optarg=`$echo "X$arg" | $Xsed -e 's/[-_a-zA-Z0-9]*=//'` ;;
   404   *) optarg= ;;
   405   esac
   406 
   407   # If the previous option needs an argument, assign it.
   408   if test -n "$prev"; then
   409     case $prev in
   410     execute_dlfiles)
   411       execute_dlfiles="$execute_dlfiles $arg"
   412       ;;
   413     tag)
   414       tagname="$arg"
   415       preserve_args="${preserve_args}=$arg"
   416 
   417       # Check whether tagname contains only valid characters
   418       case $tagname in
   419       *[!-_A-Za-z0-9,/]*)
   420 	$echo "$progname: invalid tag name: $tagname" 1>&2
   421 	exit $EXIT_FAILURE
   422 	;;
   423       esac
   424 
   425       case $tagname in
   426       CC)
   427 	# Don't test for the "default" C tag, as we know, it's there, but
   428 	# not specially marked.
   429 	;;
   430       *)
   431 	if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "$progpath" > /dev/null; then
   432 	  taglist="$taglist $tagname"
   433 	  # Evaluate the configuration.
   434 	  eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$tagname'$/,/^# ### END LIBTOOL TAG CONFIG: '$tagname'$/p' < $progpath`"
   435 	else
   436 	  $echo "$progname: ignoring unknown tag $tagname" 1>&2
   437 	fi
   438 	;;
   439       esac
   440       ;;
   441     *)
   442       eval "$prev=\$arg"
   443       ;;
   444     esac
   445 
   446     prev=
   447     prevopt=
   448     continue
   449   fi
   450 
   451   # Have we seen a non-optional argument yet?
   452   case $arg in
   453   --help)
   454     show_help=yes
   455     ;;
   456 
   457   --version)
   458     $echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP"
   459     $echo
   460     $echo "Copyright (C) 2005  Free Software Foundation, Inc."
   461     $echo "This is free software; see the source for copying conditions.  There is NO"
   462     $echo "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
   463     exit $?
   464     ;;
   465 
   466   --config)
   467     ${SED} -e '1,/^# ### BEGIN LIBTOOL CONFIG/d' -e '/^# ### END LIBTOOL CONFIG/,$d' $progpath
   468     # Now print the configurations for the tags.
   469     for tagname in $taglist; do
   470       ${SED} -n -e "/^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$/,/^# ### END LIBTOOL TAG CONFIG: $tagname$/p" < "$progpath"
   471     done
   472     exit $?
   473     ;;
   474 
   475   --debug)
   476     $echo "$progname: enabling shell trace mode"
   477     set -x
   478     preserve_args="$preserve_args $arg"
   479     ;;
   480 
   481   --dry-run | -n)
   482     run=:
   483     ;;
   484 
   485   --features)
   486     $echo "host: $host"
   487     if test "$build_libtool_libs" = yes; then
   488       $echo "enable shared libraries"
   489     else
   490       $echo "disable shared libraries"
   491     fi
   492     if test "$build_old_libs" = yes; then
   493       $echo "enable static libraries"
   494     else
   495       $echo "disable static libraries"
   496     fi
   497     exit $?
   498     ;;
   499 
   500   --finish) mode="finish" ;;
   501 
   502   --mode) prevopt="--mode" prev=mode ;;
   503   --mode=*) mode="$optarg" ;;
   504 
   505   --preserve-dup-deps) duplicate_deps="yes" ;;
   506 
   507   --quiet | --silent)
   508     show=:
   509     preserve_args="$preserve_args $arg"
   510     ;;
   511 
   512   --tag)
   513     prevopt="--tag"
   514     prev=tag
   515     preserve_args="$preserve_args --tag"
   516     ;;
   517   --tag=*)
   518     set tag "$optarg" ${1+"$@"}
   519     shift
   520     prev=tag
   521     preserve_args="$preserve_args --tag"
   522     ;;
   523 
   524   -dlopen)
   525     prevopt="-dlopen"
   526     prev=execute_dlfiles
   527     ;;
   528 
   529   -*)
   530     $echo "$modename: unrecognized option \`$arg'" 1>&2
   531     $echo "$help" 1>&2
   532     exit $EXIT_FAILURE
   533     ;;
   534 
   535   *)
   536     nonopt="$arg"
   537     break
   538     ;;
   539   esac
   540 done
   541 
   542 if test -n "$prevopt"; then
   543   $echo "$modename: option \`$prevopt' requires an argument" 1>&2
   544   $echo "$help" 1>&2
   545   exit $EXIT_FAILURE
   546 fi
   547 
   548 case $disable_libs in
   549 no) 
   550   ;;
   551 shared)
   552   build_libtool_libs=no
   553   build_old_libs=yes
   554   ;;
   555 static)
   556   build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac`
   557   ;;
   558 esac
   559 
   560 # If this variable is set in any of the actions, the command in it
   561 # will be execed at the end.  This prevents here-documents from being
   562 # left over by shells.
   563 exec_cmd=
   564 
   565 if test -z "$show_help"; then
   566 
   567   # Infer the operation mode.
   568   if test -z "$mode"; then
   569     $echo "*** Warning: inferring the mode of operation is deprecated." 1>&2
   570     $echo "*** Future versions of Libtool will require --mode=MODE be specified." 1>&2
   571     case $nonopt in
   572     *cc | cc* | *++ | gcc* | *-gcc* | g++* | xlc*)
   573       mode=link
   574       for arg
   575       do
   576 	case $arg in
   577 	-c)
   578 	   mode=compile
   579 	   break
   580 	   ;;
   581 	esac
   582       done
   583       ;;
   584     *db | *dbx | *strace | *truss)
   585       mode=execute
   586       ;;
   587     *install*|cp|mv)
   588       mode=install
   589       ;;
   590     *rm)
   591       mode=uninstall
   592       ;;
   593     *)
   594       # If we have no mode, but dlfiles were specified, then do execute mode.
   595       test -n "$execute_dlfiles" && mode=execute
   596 
   597       # Just use the default operation mode.
   598       if test -z "$mode"; then
   599 	if test -n "$nonopt"; then
   600 	  $echo "$modename: warning: cannot infer operation mode from \`$nonopt'" 1>&2
   601 	else
   602 	  $echo "$modename: warning: cannot infer operation mode without MODE-ARGS" 1>&2
   603 	fi
   604       fi
   605       ;;
   606     esac
   607   fi
   608 
   609   # Only execute mode is allowed to have -dlopen flags.
   610   if test -n "$execute_dlfiles" && test "$mode" != execute; then
   611     $echo "$modename: unrecognized option \`-dlopen'" 1>&2
   612     $echo "$help" 1>&2
   613     exit $EXIT_FAILURE
   614   fi
   615 
   616   # Change the help message to a mode-specific one.
   617   generic_help="$help"
   618   help="Try \`$modename --help --mode=$mode' for more information."
   619 
   620   # These modes are in order of execution frequency so that they run quickly.
   621   case $mode in
   622   # libtool compile mode
   623   compile)
   624     modename="$modename: compile"
   625     # Get the compilation command and the source file.
   626     base_compile=
   627     srcfile="$nonopt"  #  always keep a non-empty value in "srcfile"
   628     suppress_opt=yes
   629     suppress_output=
   630     arg_mode=normal
   631     libobj=
   632     later=
   633 
   634     for arg
   635     do
   636       case $arg_mode in
   637       arg  )
   638 	# do not "continue".  Instead, add this to base_compile
   639 	lastarg="$arg"
   640 	arg_mode=normal
   641 	;;
   642 
   643       target )
   644 	libobj="$arg"
   645 	arg_mode=normal
   646 	continue
   647 	;;
   648 
   649       normal )
   650 	# Accept any command-line options.
   651 	case $arg in
   652 	-o)
   653 	  if test -n "$libobj" ; then
   654 	    $echo "$modename: you cannot specify \`-o' more than once" 1>&2
   655 	    exit $EXIT_FAILURE
   656 	  fi
   657 	  arg_mode=target
   658 	  continue
   659 	  ;;
   660 
   661 	-static | -prefer-pic | -prefer-non-pic)
   662 	  later="$later $arg"
   663 	  continue
   664 	  ;;
   665 
   666 	-no-suppress)
   667 	  suppress_opt=no
   668 	  continue
   669 	  ;;
   670 
   671 	-Xcompiler)
   672 	  arg_mode=arg  #  the next one goes into the "base_compile" arg list
   673 	  continue      #  The current "srcfile" will either be retained or
   674 	  ;;            #  replaced later.  I would guess that would be a bug.
   675 
   676 	-Wc,*)
   677 	  args=`$echo "X$arg" | $Xsed -e "s/^-Wc,//"`
   678 	  lastarg=
   679 	  save_ifs="$IFS"; IFS=','
   680  	  for arg in $args; do
   681 	    IFS="$save_ifs"
   682 
   683 	    # Double-quote args containing other shell metacharacters.
   684 	    # Many Bourne shells cannot handle close brackets correctly
   685 	    # in scan sets, so we specify it separately.
   686 	    case $arg in
   687 	      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
   688 	      arg="\"$arg\""
   689 	      ;;
   690 	    esac
   691 	    lastarg="$lastarg $arg"
   692 	  done
   693 	  IFS="$save_ifs"
   694 	  lastarg=`$echo "X$lastarg" | $Xsed -e "s/^ //"`
   695 
   696 	  # Add the arguments to base_compile.
   697 	  base_compile="$base_compile $lastarg"
   698 	  continue
   699 	  ;;
   700 
   701 	* )
   702 	  # Accept the current argument as the source file.
   703 	  # The previous "srcfile" becomes the current argument.
   704 	  #
   705 	  lastarg="$srcfile"
   706 	  srcfile="$arg"
   707 	  ;;
   708 	esac  #  case $arg
   709 	;;
   710       esac    #  case $arg_mode
   711 
   712       # Aesthetically quote the previous argument.
   713       lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"`
   714 
   715       case $lastarg in
   716       # Double-quote args containing other shell metacharacters.
   717       # Many Bourne shells cannot handle close brackets correctly
   718       # in scan sets, and some SunOS ksh mistreat backslash-escaping
   719       # in scan sets (worked around with variable expansion),
   720       # and furthermore cannot handle '|' '&' '(' ')' in scan sets 
   721       # at all, so we specify them separately.
   722       *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
   723 	lastarg="\"$lastarg\""
   724 	;;
   725       esac
   726 
   727       base_compile="$base_compile $lastarg"
   728     done # for arg
   729 
   730     case $arg_mode in
   731     arg)
   732       $echo "$modename: you must specify an argument for -Xcompile"
   733       exit $EXIT_FAILURE
   734       ;;
   735     target)
   736       $echo "$modename: you must specify a target with \`-o'" 1>&2
   737       exit $EXIT_FAILURE
   738       ;;
   739     *)
   740       # Get the name of the library object.
   741       [ -z "$libobj" ] && libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'`
   742       ;;
   743     esac
   744 
   745     # Recognize several different file suffixes.
   746     # If the user specifies -o file.o, it is replaced with file.lo
   747     xform='[cCFSifmso]'
   748     case $libobj in
   749     *.ada) xform=ada ;;
   750     *.adb) xform=adb ;;
   751     *.ads) xform=ads ;;
   752     *.asm) xform=asm ;;
   753     *.c++) xform=c++ ;;
   754     *.cc) xform=cc ;;
   755     *.ii) xform=ii ;;
   756     *.class) xform=class ;;
   757     *.cpp) xform=cpp ;;
   758     *.cxx) xform=cxx ;;
   759     *.f90) xform=f90 ;;
   760     *.for) xform=for ;;
   761     *.java) xform=java ;;
   762     esac
   763 
   764     libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"`
   765 
   766     case $libobj in
   767     *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;;
   768     *)
   769       $echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2
   770       exit $EXIT_FAILURE
   771       ;;
   772     esac
   773 
   774     func_infer_tag $base_compile
   775 
   776     for arg in $later; do
   777       case $arg in
   778       -static)
   779 	build_old_libs=yes
   780 	continue
   781 	;;
   782 
   783       -prefer-pic)
   784 	pic_mode=yes
   785 	continue
   786 	;;
   787 
   788       -prefer-non-pic)
   789 	pic_mode=no
   790 	continue
   791 	;;
   792       esac
   793     done
   794 
   795     qlibobj=`$echo "X$libobj" | $Xsed -e "$sed_quote_subst"`
   796     case $qlibobj in
   797       *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
   798 	qlibobj="\"$qlibobj\"" ;;
   799     esac
   800     test "X$libobj" != "X$qlibobj" \
   801 	&& $echo "X$libobj" | grep '[]~#^*{};<>?"'"'"' 	&()|`$[]' \
   802 	&& $echo "$modename: libobj name \`$libobj' may not contain shell special characters."
   803     objname=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
   804     xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'`
   805     if test "X$xdir" = "X$obj"; then
   806       xdir=
   807     else
   808       xdir=$xdir/
   809     fi
   810     lobj=${xdir}$objdir/$objname
   811 
   812     if test -z "$base_compile"; then
   813       $echo "$modename: you must specify a compilation command" 1>&2
   814       $echo "$help" 1>&2
   815       exit $EXIT_FAILURE
   816     fi
   817 
   818     # Delete any leftover library objects.
   819     if test "$build_old_libs" = yes; then
   820       removelist="$obj $lobj $libobj ${libobj}T"
   821     else
   822       removelist="$lobj $libobj ${libobj}T"
   823     fi
   824 
   825     $run $rm $removelist
   826     trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15
   827 
   828     # On Cygwin there's no "real" PIC flag so we must build both object types
   829     case $host_os in
   830     cygwin* | mingw* | pw32* | os2*)
   831       pic_mode=default
   832       ;;
   833     esac
   834     if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then
   835       # non-PIC code in shared libraries is not supported
   836       pic_mode=default
   837     fi
   838 
   839     # Calculate the filename of the output object if compiler does
   840     # not support -o with -c
   841     if test "$compiler_c_o" = no; then
   842       output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext}
   843       lockfile="$output_obj.lock"
   844       removelist="$removelist $output_obj $lockfile"
   845       trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15
   846     else
   847       output_obj=
   848       need_locks=no
   849       lockfile=
   850     fi
   851 
   852     # Lock this critical section if it is needed
   853     # We use this script file to make the link, it avoids creating a new file
   854     if test "$need_locks" = yes; then
   855       until $run ln "$progpath" "$lockfile" 2>/dev/null; do
   856 	$show "Waiting for $lockfile to be removed"
   857 	sleep 2
   858       done
   859     elif test "$need_locks" = warn; then
   860       if test -f "$lockfile"; then
   861 	$echo "\
   862 *** ERROR, $lockfile exists and contains:
   863 `cat $lockfile 2>/dev/null`
   864 
   865 This indicates that another process is trying to use the same
   866 temporary object file, and libtool could not work around it because
   867 your compiler does not support \`-c' and \`-o' together.  If you
   868 repeat this compilation, it may succeed, by chance, but you had better
   869 avoid parallel builds (make -j) in this platform, or get a better
   870 compiler."
   871 
   872 	$run $rm $removelist
   873 	exit $EXIT_FAILURE
   874       fi
   875       $echo "$srcfile" > "$lockfile"
   876     fi
   877 
   878     if test -n "$fix_srcfile_path"; then
   879       eval srcfile=\"$fix_srcfile_path\"
   880     fi
   881     qsrcfile=`$echo "X$srcfile" | $Xsed -e "$sed_quote_subst"`
   882     case $qsrcfile in
   883       *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
   884       qsrcfile="\"$qsrcfile\"" ;;
   885     esac
   886 
   887     $run $rm "$libobj" "${libobj}T"
   888 
   889     # Create a libtool object file (analogous to a ".la" file),
   890     # but don't create it if we're doing a dry run.
   891     test -z "$run" && cat > ${libobj}T <<EOF
   892 # $libobj - a libtool object file
   893 # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
   894 #
   895 # Please DO NOT delete this file!
   896 # It is necessary for linking the library.
   897 
   898 # Name of the PIC object.
   899 EOF
   900 
   901     # Only build a PIC object if we are building libtool libraries.
   902     if test "$build_libtool_libs" = yes; then
   903       # Without this assignment, base_compile gets emptied.
   904       fbsd_hideous_sh_bug=$base_compile
   905 
   906       if test "$pic_mode" != no; then
   907 	command="$base_compile $qsrcfile $pic_flag"
   908       else
   909 	# Don't build PIC code
   910 	command="$base_compile $qsrcfile"
   911       fi
   912 
   913       if test ! -d "${xdir}$objdir"; then
   914 	$show "$mkdir ${xdir}$objdir"
   915 	$run $mkdir ${xdir}$objdir
   916 	exit_status=$?
   917 	if test "$exit_status" -ne 0 && test ! -d "${xdir}$objdir"; then
   918 	  exit $exit_status
   919 	fi
   920       fi
   921 
   922       if test -z "$output_obj"; then
   923 	# Place PIC objects in $objdir
   924 	command="$command -o $lobj"
   925       fi
   926 
   927       $run $rm "$lobj" "$output_obj"
   928 
   929       $show "$command"
   930       if $run eval "$command"; then :
   931       else
   932 	test -n "$output_obj" && $run $rm $removelist
   933 	exit $EXIT_FAILURE
   934       fi
   935 
   936       if test "$need_locks" = warn &&
   937 	 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
   938 	$echo "\
   939 *** ERROR, $lockfile contains:
   940 `cat $lockfile 2>/dev/null`
   941 
   942 but it should contain:
   943 $srcfile
   944 
   945 This indicates that another process is trying to use the same
   946 temporary object file, and libtool could not work around it because
   947 your compiler does not support \`-c' and \`-o' together.  If you
   948 repeat this compilation, it may succeed, by chance, but you had better
   949 avoid parallel builds (make -j) in this platform, or get a better
   950 compiler."
   951 
   952 	$run $rm $removelist
   953 	exit $EXIT_FAILURE
   954       fi
   955 
   956       # Just move the object if needed, then go on to compile the next one
   957       if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then
   958 	$show "$mv $output_obj $lobj"
   959 	if $run $mv $output_obj $lobj; then :
   960 	else
   961 	  error=$?
   962 	  $run $rm $removelist
   963 	  exit $error
   964 	fi
   965       fi
   966 
   967       # Append the name of the PIC object to the libtool object file.
   968       test -z "$run" && cat >> ${libobj}T <<EOF
   969 pic_object='$objdir/$objname'
   970 
   971 EOF
   972 
   973       # Allow error messages only from the first compilation.
   974       if test "$suppress_opt" = yes; then
   975         suppress_output=' >/dev/null 2>&1'
   976       fi
   977     else
   978       # No PIC object so indicate it doesn't exist in the libtool
   979       # object file.
   980       test -z "$run" && cat >> ${libobj}T <<EOF
   981 pic_object=none
   982 
   983 EOF
   984     fi
   985 
   986     # Only build a position-dependent object if we build old libraries.
   987     if test "$build_old_libs" = yes; then
   988       if test "$pic_mode" != yes; then
   989 	# Don't build PIC code
   990 	command="$base_compile $qsrcfile"
   991       else
   992 	command="$base_compile $qsrcfile $pic_flag"
   993       fi
   994       if test "$compiler_c_o" = yes; then
   995 	command="$command -o $obj"
   996       fi
   997 
   998       # Suppress compiler output if we already did a PIC compilation.
   999       command="$command$suppress_output"
  1000       $run $rm "$obj" "$output_obj"
  1001       $show "$command"
  1002       if $run eval "$command"; then :
  1003       else
  1004 	$run $rm $removelist
  1005 	exit $EXIT_FAILURE
  1006       fi
  1007 
  1008       if test "$need_locks" = warn &&
  1009 	 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
  1010 	$echo "\
  1011 *** ERROR, $lockfile contains:
  1012 `cat $lockfile 2>/dev/null`
  1013 
  1014 but it should contain:
  1015 $srcfile
  1016 
  1017 This indicates that another process is trying to use the same
  1018 temporary object file, and libtool could not work around it because
  1019 your compiler does not support \`-c' and \`-o' together.  If you
  1020 repeat this compilation, it may succeed, by chance, but you had better
  1021 avoid parallel builds (make -j) in this platform, or get a better
  1022 compiler."
  1023 
  1024 	$run $rm $removelist
  1025 	exit $EXIT_FAILURE
  1026       fi
  1027 
  1028       # Just move the object if needed
  1029       if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then
  1030 	$show "$mv $output_obj $obj"
  1031 	if $run $mv $output_obj $obj; then :
  1032 	else
  1033 	  error=$?
  1034 	  $run $rm $removelist
  1035 	  exit $error
  1036 	fi
  1037       fi
  1038 
  1039       # Append the name of the non-PIC object the libtool object file.
  1040       # Only append if the libtool object file exists.
  1041       test -z "$run" && cat >> ${libobj}T <<EOF
  1042 # Name of the non-PIC object.
  1043 non_pic_object='$objname'
  1044 
  1045 EOF
  1046     else
  1047       # Append the name of the non-PIC object the libtool object file.
  1048       # Only append if the libtool object file exists.
  1049       test -z "$run" && cat >> ${libobj}T <<EOF
  1050 # Name of the non-PIC object.
  1051 non_pic_object=none
  1052 
  1053 EOF
  1054     fi
  1055 
  1056     $run $mv "${libobj}T" "${libobj}"
  1057 
  1058     # Unlock the critical section if it was locked
  1059     if test "$need_locks" != no; then
  1060       $run $rm "$lockfile"
  1061     fi
  1062 
  1063     exit $EXIT_SUCCESS
  1064     ;;
  1065 
  1066   # libtool link mode
  1067   link | relink)
  1068     modename="$modename: link"
  1069     case $host in
  1070     *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
  1071       # It is impossible to link a dll without this setting, and
  1072       # we shouldn't force the makefile maintainer to figure out
  1073       # which system we are compiling for in order to pass an extra
  1074       # flag for every libtool invocation.
  1075       # allow_undefined=no
  1076 
  1077       # FIXME: Unfortunately, there are problems with the above when trying
  1078       # to make a dll which has undefined symbols, in which case not
  1079       # even a static library is built.  For now, we need to specify
  1080       # -no-undefined on the libtool link line when we can be certain
  1081       # that all symbols are satisfied, otherwise we get a static library.
  1082       allow_undefined=yes
  1083       ;;
  1084     *)
  1085       allow_undefined=yes
  1086       ;;
  1087     esac
  1088     libtool_args="$nonopt"
  1089     base_compile="$nonopt $@"
  1090     compile_command="$nonopt"
  1091     finalize_command="$nonopt"
  1092 
  1093     compile_rpath=
  1094     finalize_rpath=
  1095     compile_shlibpath=
  1096     finalize_shlibpath=
  1097     convenience=
  1098     old_convenience=
  1099     deplibs=
  1100     old_deplibs=
  1101     compiler_flags=
  1102     linker_flags=
  1103     dllsearchpath=
  1104     lib_search_path=`pwd`
  1105     inst_prefix_dir=
  1106 
  1107     avoid_version=no
  1108     dlfiles=
  1109     dlprefiles=
  1110     dlself=no
  1111     export_dynamic=no
  1112     export_symbols=
  1113     export_symbols_regex=
  1114     generated=
  1115     libobjs=
  1116     ltlibs=
  1117     module=no
  1118     no_install=no
  1119     objs=
  1120     non_pic_objects=
  1121     notinst_path= # paths that contain not-installed libtool libraries
  1122     precious_files_regex=
  1123     prefer_static_libs=no
  1124     preload=no
  1125     prev=
  1126     prevarg=
  1127     release=
  1128     rpath=
  1129     xrpath=
  1130     perm_rpath=
  1131     temp_rpath=
  1132     thread_safe=no
  1133     vinfo=
  1134     vinfo_number=no
  1135 
  1136     func_infer_tag $base_compile
  1137 
  1138     # We need to know -static, to get the right output filenames.
  1139     for arg
  1140     do
  1141       case $arg in
  1142       -all-static | -static)
  1143 	if test "X$arg" = "X-all-static"; then
  1144 	  if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then
  1145 	    $echo "$modename: warning: complete static linking is impossible in this configuration" 1>&2
  1146 	  fi
  1147 	  if test -n "$link_static_flag"; then
  1148 	    dlopen_self=$dlopen_self_static
  1149 	  fi
  1150 	  prefer_static_libs=yes
  1151 	else
  1152 	  if test -z "$pic_flag" && test -n "$link_static_flag"; then
  1153 	    dlopen_self=$dlopen_self_static
  1154 	  fi
  1155 	  prefer_static_libs=built
  1156 	fi
  1157 	build_libtool_libs=no
  1158 	build_old_libs=yes
  1159 	break
  1160 	;;
  1161       esac
  1162     done
  1163 
  1164     # See if our shared archives depend on static archives.
  1165     test -n "$old_archive_from_new_cmds" && build_old_libs=yes
  1166 
  1167     # Go through the arguments, transforming them on the way.
  1168     while test "$#" -gt 0; do
  1169       arg="$1"
  1170       shift
  1171       case $arg in
  1172       *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
  1173 	qarg=\"`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`\" ### testsuite: skip nested quoting test
  1174 	;;
  1175       *) qarg=$arg ;;
  1176       esac
  1177       libtool_args="$libtool_args $qarg"
  1178 
  1179       # If the previous option needs an argument, assign it.
  1180       if test -n "$prev"; then
  1181 	case $prev in
  1182 	output)
  1183 	  compile_command="$compile_command @OUTPUT@"
  1184 	  finalize_command="$finalize_command @OUTPUT@"
  1185 	  ;;
  1186 	esac
  1187 
  1188 	case $prev in
  1189 	dlfiles|dlprefiles)
  1190 	  if test "$preload" = no; then
  1191 	    # Add the symbol object into the linking commands.
  1192 	    compile_command="$compile_command @SYMFILE@"
  1193 	    finalize_command="$finalize_command @SYMFILE@"
  1194 	    preload=yes
  1195 	  fi
  1196 	  case $arg in
  1197 	  *.la | *.lo) ;;  # We handle these cases below.
  1198 	  force)
  1199 	    if test "$dlself" = no; then
  1200 	      dlself=needless
  1201 	      export_dynamic=yes
  1202 	    fi
  1203 	    prev=
  1204 	    continue
  1205 	    ;;
  1206 	  self)
  1207 	    if test "$prev" = dlprefiles; then
  1208 	      dlself=yes
  1209 	    elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then
  1210 	      dlself=yes
  1211 	    else
  1212 	      dlself=needless
  1213 	      export_dynamic=yes
  1214 	    fi
  1215 	    prev=
  1216 	    continue
  1217 	    ;;
  1218 	  *)
  1219 	    if test "$prev" = dlfiles; then
  1220 	      dlfiles="$dlfiles $arg"
  1221 	    else
  1222 	      dlprefiles="$dlprefiles $arg"
  1223 	    fi
  1224 	    prev=
  1225 	    continue
  1226 	    ;;
  1227 	  esac
  1228 	  ;;
  1229 	expsyms)
  1230 	  export_symbols="$arg"
  1231 	  if test ! -f "$arg"; then
  1232 	    $echo "$modename: symbol file \`$arg' does not exist"
  1233 	    exit $EXIT_FAILURE
  1234 	  fi
  1235 	  prev=
  1236 	  continue
  1237 	  ;;
  1238 	expsyms_regex)
  1239 	  export_symbols_regex="$arg"
  1240 	  prev=
  1241 	  continue
  1242 	  ;;
  1243 	inst_prefix)
  1244 	  inst_prefix_dir="$arg"
  1245 	  prev=
  1246 	  continue
  1247 	  ;;
  1248 	precious_regex)
  1249 	  precious_files_regex="$arg"
  1250 	  prev=
  1251 	  continue
  1252 	  ;;
  1253 	release)
  1254 	  release="-$arg"
  1255 	  prev=
  1256 	  continue
  1257 	  ;;
  1258 	objectlist)
  1259 	  if test -f "$arg"; then
  1260 	    save_arg=$arg
  1261 	    moreargs=
  1262 	    for fil in `cat $save_arg`
  1263 	    do
  1264 #	      moreargs="$moreargs $fil"
  1265 	      arg=$fil
  1266 	      # A libtool-controlled object.
  1267 
  1268 	      # Check to see that this really is a libtool object.
  1269 	      if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
  1270 		pic_object=
  1271 		non_pic_object=
  1272 
  1273 		# Read the .lo file
  1274 		# If there is no directory component, then add one.
  1275 		case $arg in
  1276 		*/* | *\\*) . $arg ;;
  1277 		*) . ./$arg ;;
  1278 		esac
  1279 
  1280 		if test -z "$pic_object" || \
  1281 		   test -z "$non_pic_object" ||
  1282 		   test "$pic_object" = none && \
  1283 		   test "$non_pic_object" = none; then
  1284 		  $echo "$modename: cannot find name of object for \`$arg'" 1>&2
  1285 		  exit $EXIT_FAILURE
  1286 		fi
  1287 
  1288 		# Extract subdirectory from the argument.
  1289 		xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
  1290 		if test "X$xdir" = "X$arg"; then
  1291 		  xdir=
  1292 		else
  1293 		  xdir="$xdir/"
  1294 		fi
  1295 
  1296 		if test "$pic_object" != none; then
  1297 		  # Prepend the subdirectory the object is found in.
  1298 		  pic_object="$xdir$pic_object"
  1299 
  1300 		  if test "$prev" = dlfiles; then
  1301 		    if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
  1302 		      dlfiles="$dlfiles $pic_object"
  1303 		      prev=
  1304 		      continue
  1305 		    else
  1306 		      # If libtool objects are unsupported, then we need to preload.
  1307 		      prev=dlprefiles
  1308 		    fi
  1309 		  fi
  1310 
  1311 		  # CHECK ME:  I think I busted this.  -Ossama
  1312 		  if test "$prev" = dlprefiles; then
  1313 		    # Preload the old-style object.
  1314 		    dlprefiles="$dlprefiles $pic_object"
  1315 		    prev=
  1316 		  fi
  1317 
  1318 		  # A PIC object.
  1319 		  libobjs="$libobjs $pic_object"
  1320 		  arg="$pic_object"
  1321 		fi
  1322 
  1323 		# Non-PIC object.
  1324 		if test "$non_pic_object" != none; then
  1325 		  # Prepend the subdirectory the object is found in.
  1326 		  non_pic_object="$xdir$non_pic_object"
  1327 
  1328 		  # A standard non-PIC object
  1329 		  non_pic_objects="$non_pic_objects $non_pic_object"
  1330 		  if test -z "$pic_object" || test "$pic_object" = none ; then
  1331 		    arg="$non_pic_object"
  1332 		  fi
  1333 		else
  1334 		  # If the PIC object exists, use it instead.
  1335 		  # $xdir was prepended to $pic_object above.
  1336 		  non_pic_object="$pic_object"
  1337 		  non_pic_objects="$non_pic_objects $non_pic_object"
  1338 		fi
  1339 	      else
  1340 		# Only an error if not doing a dry-run.
  1341 		if test -z "$run"; then
  1342 		  $echo "$modename: \`$arg' is not a valid libtool object" 1>&2
  1343 		  exit $EXIT_FAILURE
  1344 		else
  1345 		  # Dry-run case.
  1346 
  1347 		  # Extract subdirectory from the argument.
  1348 		  xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
  1349 		  if test "X$xdir" = "X$arg"; then
  1350 		    xdir=
  1351 		  else
  1352 		    xdir="$xdir/"
  1353 		  fi
  1354 
  1355 		  pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"`
  1356 		  non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"`
  1357 		  libobjs="$libobjs $pic_object"
  1358 		  non_pic_objects="$non_pic_objects $non_pic_object"
  1359 		fi
  1360 	      fi
  1361 	    done
  1362 	  else
  1363 	    $echo "$modename: link input file \`$save_arg' does not exist"
  1364 	    exit $EXIT_FAILURE
  1365 	  fi
  1366 	  arg=$save_arg
  1367 	  prev=
  1368 	  continue
  1369 	  ;;
  1370 	rpath | xrpath)
  1371 	  # We need an absolute path.
  1372 	  case $arg in
  1373 	  [\\/]* | [A-Za-z]:[\\/]*) ;;
  1374 	  *)
  1375 	    $echo "$modename: only absolute run-paths are allowed" 1>&2
  1376 	    exit $EXIT_FAILURE
  1377 	    ;;
  1378 	  esac
  1379 	  if test "$prev" = rpath; then
  1380 	    case "$rpath " in
  1381 	    *" $arg "*) ;;
  1382 	    *) rpath="$rpath $arg" ;;
  1383 	    esac
  1384 	  else
  1385 	    case "$xrpath " in
  1386 	    *" $arg "*) ;;
  1387 	    *) xrpath="$xrpath $arg" ;;
  1388 	    esac
  1389 	  fi
  1390 	  prev=
  1391 	  continue
  1392 	  ;;
  1393 	xcompiler)
  1394 	  compiler_flags="$compiler_flags $qarg"
  1395 	  prev=
  1396 	  compile_command="$compile_command $qarg"
  1397 	  finalize_command="$finalize_command $qarg"
  1398 	  continue
  1399 	  ;;
  1400 	xlinker)
  1401 	  linker_flags="$linker_flags $qarg"
  1402 	  compiler_flags="$compiler_flags $wl$qarg"
  1403 	  prev=
  1404 	  compile_command="$compile_command $wl$qarg"
  1405 	  finalize_command="$finalize_command $wl$qarg"
  1406 	  continue
  1407 	  ;;
  1408 	xcclinker)
  1409 	  linker_flags="$linker_flags $qarg"
  1410 	  compiler_flags="$compiler_flags $qarg"
  1411 	  prev=
  1412 	  compile_command="$compile_command $qarg"
  1413 	  finalize_command="$finalize_command $qarg"
  1414 	  continue
  1415 	  ;;
  1416 	framework)
  1417 	  case $host in
  1418 	    *-*-darwin*)
  1419 	      case "$deplibs " in
  1420 	        *" $qarg.framework "*) ;;
  1421 		*) deplibs="$deplibs $qarg.framework" # this is fixed later
  1422 		   ;;
  1423               esac
  1424               ;;
  1425    	  esac
  1426  	  prev=
  1427  	  continue
  1428  	  ;;
  1429 	shrext)
  1430   	  shrext_cmds="$arg"
  1431 	  prev=
  1432 	  continue
  1433 	  ;;
  1434 	darwin_framework|darwin_framework_skip)
  1435 	  test "$prev" = "darwin_framework" && compiler_flags="$compiler_flags $arg"
  1436 	  compile_command="$compile_command $arg"
  1437 	  finalize_command="$finalize_command $arg"
  1438 	  prev=
  1439 	  continue
  1440 	  ;;
  1441 	*)
  1442 	  eval "$prev=\"\$arg\""
  1443 	  prev=
  1444 	  continue
  1445 	  ;;
  1446 	esac
  1447       fi # test -n "$prev"
  1448 
  1449       prevarg="$arg"
  1450 
  1451       case $arg in
  1452       -all-static)
  1453 	if test -n "$link_static_flag"; then
  1454 	  compile_command="$compile_command $link_static_flag"
  1455 	  finalize_command="$finalize_command $link_static_flag"
  1456 	fi
  1457 	continue
  1458 	;;
  1459 
  1460       -allow-undefined)
  1461 	# FIXME: remove this flag sometime in the future.
  1462 	$echo "$modename: \`-allow-undefined' is deprecated because it is the default" 1>&2
  1463 	continue
  1464 	;;
  1465 
  1466       -avoid-version)
  1467 	avoid_version=yes
  1468 	continue
  1469 	;;
  1470 
  1471       -dlopen)
  1472 	prev=dlfiles
  1473 	continue
  1474 	;;
  1475 
  1476       -dlpreopen)
  1477 	prev=dlprefiles
  1478 	continue
  1479 	;;
  1480 
  1481       -export-dynamic)
  1482 	export_dynamic=yes
  1483 	continue
  1484 	;;
  1485 
  1486       -export-symbols | -export-symbols-regex)
  1487 	if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
  1488 	  $echo "$modename: more than one -exported-symbols argument is not allowed"
  1489 	  exit $EXIT_FAILURE
  1490 	fi
  1491 	if test "X$arg" = "X-export-symbols"; then
  1492 	  prev=expsyms
  1493 	else
  1494 	  prev=expsyms_regex
  1495 	fi
  1496 	continue
  1497 	;;
  1498 
  1499       -framework|-arch|-isysroot)
  1500 	case " $CC " in
  1501 	  *" ${arg} ${1} "* | *" ${arg}	${1} "*) 
  1502 		prev=darwin_framework_skip ;;
  1503 	  *) compiler_flags="$compiler_flags $arg"
  1504 	     prev=darwin_framework ;;
  1505 	esac
  1506 	compile_command="$compile_command $arg"
  1507 	finalize_command="$finalize_command $arg"
  1508 	continue
  1509 	;;
  1510 
  1511       -inst-prefix-dir)
  1512 	prev=inst_prefix
  1513 	continue
  1514 	;;
  1515 
  1516       # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:*
  1517       # so, if we see these flags be careful not to treat them like -L
  1518       -L[A-Z][A-Z]*:*)
  1519 	case $with_gcc/$host in
  1520 	no/*-*-irix* | /*-*-irix*)
  1521 	  compile_command="$compile_command $arg"
  1522 	  finalize_command="$finalize_command $arg"
  1523 	  ;;
  1524 	esac
  1525 	continue
  1526 	;;
  1527 
  1528       -L*)
  1529 	dir=`$echo "X$arg" | $Xsed -e 's/^-L//'`
  1530 	# We need an absolute path.
  1531 	case $dir in
  1532 	[\\/]* | [A-Za-z]:[\\/]*) ;;
  1533 	*)
  1534 	  absdir=`cd "$dir" && pwd`
  1535 	  if test -z "$absdir"; then
  1536 	    $echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2
  1537 	    absdir="$dir"
  1538 	    notinst_path="$notinst_path $dir"
  1539 	  fi
  1540 	  dir="$absdir"
  1541 	  ;;
  1542 	esac
  1543 	case "$deplibs " in
  1544 	*" -L$dir "*) ;;
  1545 	*)
  1546 	  deplibs="$deplibs -L$dir"
  1547 	  lib_search_path="$lib_search_path $dir"
  1548 	  ;;
  1549 	esac
  1550 	case $host in
  1551 	*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
  1552 	  testbindir=`$echo "X$dir" | $Xsed -e 's*/lib$*/bin*'`
  1553 	  case :$dllsearchpath: in
  1554 	  *":$dir:"*) ;;
  1555 	  *) dllsearchpath="$dllsearchpath:$dir";;
  1556 	  esac
  1557 	  case :$dllsearchpath: in
  1558 	  *":$testbindir:"*) ;;
  1559 	  *) dllsearchpath="$dllsearchpath:$testbindir";;
  1560 	  esac
  1561 	  ;;
  1562 	esac
  1563 	continue
  1564 	;;
  1565 
  1566       -l*)
  1567 	if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then
  1568 	  case $host in
  1569 	  *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos*)
  1570 	    # These systems don't actually have a C or math library (as such)
  1571 	    continue
  1572 	    ;;
  1573 	  *-*-os2*)
  1574 	    # These systems don't actually have a C library (as such)
  1575 	    test "X$arg" = "X-lc" && continue
  1576 	    ;;
  1577 	  *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
  1578 	    # Do not include libc due to us having libc/libc_r.
  1579 	    test "X$arg" = "X-lc" && continue
  1580 	    ;;
  1581 	  *-*-rhapsody* | *-*-darwin1.[012])
  1582 	    # Rhapsody C and math libraries are in the System framework
  1583 	    deplibs="$deplibs -framework System"
  1584 	    continue
  1585 	    ;;
  1586 	  *-*-sco3.2v5* | *-*-sco5v6*)
  1587 	    # Causes problems with __ctype
  1588 	    test "X$arg" = "X-lc" && continue
  1589 	    ;;
  1590 	  *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
  1591 	    # Compiler inserts libc in the correct place for threads to work
  1592 	    test "X$arg" = "X-lc" && continue
  1593 	    ;;
  1594 	  esac
  1595 	elif test "X$arg" = "X-lc_r"; then
  1596 	 case $host in
  1597 	 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
  1598 	   # Do not include libc_r directly, use -pthread flag.
  1599 	   continue
  1600 	   ;;
  1601 	 esac
  1602 	fi
  1603 	deplibs="$deplibs $arg"
  1604 	continue
  1605 	;;
  1606 
  1607       # Tru64 UNIX uses -model [arg] to determine the layout of C++
  1608       # classes, name mangling, and exception handling.
  1609       -model)
  1610 	compile_command="$compile_command $arg"
  1611 	compiler_flags="$compiler_flags $arg"
  1612 	finalize_command="$finalize_command $arg"
  1613 	prev=xcompiler
  1614 	continue
  1615 	;;
  1616 
  1617      -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe)
  1618 	compiler_flags="$compiler_flags $arg"
  1619 	compile_command="$compile_command $arg"
  1620 	finalize_command="$finalize_command $arg"
  1621 	continue
  1622 	;;
  1623 
  1624       -module)
  1625 	module=yes
  1626 	continue
  1627 	;;
  1628 
  1629       # -64, -mips[0-9] enable 64-bit mode on the SGI compiler
  1630       # -r[0-9][0-9]* specifies the processor on the SGI compiler
  1631       # -xarch=*, -xtarget=* enable 64-bit mode on the Sun compiler
  1632       # +DA*, +DD* enable 64-bit mode on the HP compiler
  1633       # -q* pass through compiler args for the IBM compiler
  1634       # -m* pass through architecture-specific compiler args for GCC
  1635       # -m*, -t[45]*, -txscale* pass through architecture-specific
  1636       # compiler args for GCC
  1637       # -pg pass through profiling flag for GCC
  1638       # @file GCC response files
  1639       -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*|-pg| \
  1640       -t[45]*|-txscale*|@*)
  1641 
  1642 	# Unknown arguments in both finalize_command and compile_command need
  1643 	# to be aesthetically quoted because they are evaled later.
  1644 	arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
  1645 	case $arg in
  1646 	*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
  1647 	  arg="\"$arg\""
  1648 	  ;;
  1649 	esac
  1650         compile_command="$compile_command $arg"
  1651         finalize_command="$finalize_command $arg"
  1652         compiler_flags="$compiler_flags $arg"
  1653         continue
  1654         ;;
  1655 
  1656       -shrext)
  1657 	prev=shrext
  1658 	continue
  1659 	;;
  1660 
  1661       -no-fast-install)
  1662 	fast_install=no
  1663 	continue
  1664 	;;
  1665 
  1666       -no-install)
  1667 	case $host in
  1668 	*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
  1669 	  # The PATH hackery in wrapper scripts is required on Windows
  1670 	  # in order for the loader to find any dlls it needs.
  1671 	  $echo "$modename: warning: \`-no-install' is ignored for $host" 1>&2
  1672 	  $echo "$modename: warning: assuming \`-no-fast-install' instead" 1>&2
  1673 	  fast_install=no
  1674 	  ;;
  1675 	*) no_install=yes ;;
  1676 	esac
  1677 	continue
  1678 	;;
  1679 
  1680       -no-undefined)
  1681 	allow_undefined=no
  1682 	continue
  1683 	;;
  1684 
  1685       -objectlist)
  1686 	prev=objectlist
  1687 	continue
  1688 	;;
  1689 
  1690       -o) prev=output ;;
  1691 
  1692       -precious-files-regex)
  1693 	prev=precious_regex
  1694 	continue
  1695 	;;
  1696 
  1697       -release)
  1698 	prev=release
  1699 	continue
  1700 	;;
  1701 
  1702       -rpath)
  1703 	prev=rpath
  1704 	continue
  1705 	;;
  1706 
  1707       -R)
  1708 	prev=xrpath
  1709 	continue
  1710 	;;
  1711 
  1712       -R*)
  1713 	dir=`$echo "X$arg" | $Xsed -e 's/^-R//'`
  1714 	# We need an absolute path.
  1715 	case $dir in
  1716 	[\\/]* | [A-Za-z]:[\\/]*) ;;
  1717 	*)
  1718 	  $echo "$modename: only absolute run-paths are allowed" 1>&2
  1719 	  exit $EXIT_FAILURE
  1720 	  ;;
  1721 	esac
  1722 	case "$xrpath " in
  1723 	*" $dir "*) ;;
  1724 	*) xrpath="$xrpath $dir" ;;
  1725 	esac
  1726 	continue
  1727 	;;
  1728 
  1729       -static)
  1730 	# The effects of -static are defined in a previous loop.
  1731 	# We used to do the same as -all-static on platforms that
  1732 	# didn't have a PIC flag, but the assumption that the effects
  1733 	# would be equivalent was wrong.  It would break on at least
  1734 	# Digital Unix and AIX.
  1735 	continue
  1736 	;;
  1737 
  1738       -thread-safe)
  1739 	thread_safe=yes
  1740 	continue
  1741 	;;
  1742 
  1743       -version-info)
  1744 	prev=vinfo
  1745 	continue
  1746 	;;
  1747       -version-number)
  1748 	prev=vinfo
  1749 	vinfo_number=yes
  1750 	continue
  1751 	;;
  1752 
  1753       -Wc,*)
  1754 	args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wc,//'`
  1755 	arg=
  1756 	save_ifs="$IFS"; IFS=','
  1757 	for flag in $args; do
  1758 	  IFS="$save_ifs"
  1759 	  case $flag in
  1760 	    *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
  1761 	    flag="\"$flag\""
  1762 	    ;;
  1763 	  esac
  1764 	  arg="$arg $wl$flag"
  1765 	  compiler_flags="$compiler_flags $flag"
  1766 	done
  1767 	IFS="$save_ifs"
  1768 	arg=`$echo "X$arg" | $Xsed -e "s/^ //"`
  1769 	;;
  1770 
  1771       -Wl,*)
  1772 	args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wl,//'`
  1773 	arg=
  1774 	save_ifs="$IFS"; IFS=','
  1775 	for flag in $args; do
  1776 	  IFS="$save_ifs"
  1777 	  case $flag in
  1778 	    *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
  1779 	    flag="\"$flag\""
  1780 	    ;;
  1781 	  esac
  1782 	  arg="$arg $wl$flag"
  1783 	  compiler_flags="$compiler_flags $wl$flag"
  1784 	  linker_flags="$linker_flags $flag"
  1785 	done
  1786 	IFS="$save_ifs"
  1787 	arg=`$echo "X$arg" | $Xsed -e "s/^ //"`
  1788 	;;
  1789 
  1790       -Xcompiler)
  1791 	prev=xcompiler
  1792 	continue
  1793 	;;
  1794 
  1795       -Xlinker)
  1796 	prev=xlinker
  1797 	continue
  1798 	;;
  1799 
  1800       -XCClinker)
  1801 	prev=xcclinker
  1802 	continue
  1803 	;;
  1804 
  1805       -framework)
  1806         prev=framework
  1807 	continue
  1808 	;;
  1809 
  1810       # Some other compiler flag.
  1811       -* | +*)
  1812 	# Unknown arguments in both finalize_command and compile_command need
  1813 	# to be aesthetically quoted because they are evaled later.
  1814 	arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
  1815 	case $arg in
  1816 	*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
  1817 	  arg="\"$arg\""
  1818 	  ;;
  1819 	esac
  1820 	;;
  1821 
  1822       *.$objext)
  1823 	# A standard object.
  1824 	objs="$objs $arg"
  1825 	;;
  1826 
  1827       *.lo)
  1828 	# A libtool-controlled object.
  1829 
  1830 	# Check to see that this really is a libtool object.
  1831 	if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
  1832 	  pic_object=
  1833 	  non_pic_object=
  1834 
  1835 	  # Read the .lo file
  1836 	  # If there is no directory component, then add one.
  1837 	  case $arg in
  1838 	  */* | *\\*) . $arg ;;
  1839 	  *) . ./$arg ;;
  1840 	  esac
  1841 
  1842 	  if test -z "$pic_object" || \
  1843 	     test -z "$non_pic_object" ||
  1844 	     test "$pic_object" = none && \
  1845 	     test "$non_pic_object" = none; then
  1846 	    $echo "$modename: cannot find name of object for \`$arg'" 1>&2
  1847 	    exit $EXIT_FAILURE
  1848 	  fi
  1849 
  1850 	  # Extract subdirectory from the argument.
  1851 	  xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
  1852 	  if test "X$xdir" = "X$arg"; then
  1853 	    xdir=
  1854  	  else
  1855 	    xdir="$xdir/"
  1856 	  fi
  1857 
  1858 	  if test "$pic_object" != none; then
  1859 	    # Prepend the subdirectory the object is found in.
  1860 	    pic_object="$xdir$pic_object"
  1861 
  1862 	    if test "$prev" = dlfiles; then
  1863 	      if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
  1864 		dlfiles="$dlfiles $pic_object"
  1865 		prev=
  1866 		continue
  1867 	      else
  1868 		# If libtool objects are unsupported, then we need to preload.
  1869 		prev=dlprefiles
  1870 	      fi
  1871 	    fi
  1872 
  1873 	    # CHECK ME:  I think I busted this.  -Ossama
  1874 	    if test "$prev" = dlprefiles; then
  1875 	      # Preload the old-style object.
  1876 	      dlprefiles="$dlprefiles $pic_object"
  1877 	      prev=
  1878 	    fi
  1879 
  1880 	    # A PIC object.
  1881 	    libobjs="$libobjs $pic_object"
  1882 	    arg="$pic_object"
  1883 	  fi
  1884 
  1885 	  # Non-PIC object.
  1886 	  if test "$non_pic_object" != none; then
  1887 	    # Prepend the subdirectory the object is found in.
  1888 	    non_pic_object="$xdir$non_pic_object"
  1889 
  1890 	    # A standard non-PIC object
  1891 	    non_pic_objects="$non_pic_objects $non_pic_object"
  1892 	    if test -z "$pic_object" || test "$pic_object" = none ; then
  1893 	      arg="$non_pic_object"
  1894 	    fi
  1895 	  else
  1896 	    # If the PIC object exists, use it instead.
  1897 	    # $xdir was prepended to $pic_object above.
  1898 	    non_pic_object="$pic_object"
  1899 	    non_pic_objects="$non_pic_objects $non_pic_object"
  1900 	  fi
  1901 	else
  1902 	  # Only an error if not doing a dry-run.
  1903 	  if test -z "$run"; then
  1904 	    $echo "$modename: \`$arg' is not a valid libtool object" 1>&2
  1905 	    exit $EXIT_FAILURE
  1906 	  else
  1907 	    # Dry-run case.
  1908 
  1909 	    # Extract subdirectory from the argument.
  1910 	    xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
  1911 	    if test "X$xdir" = "X$arg"; then
  1912 	      xdir=
  1913 	    else
  1914 	      xdir="$xdir/"
  1915 	    fi
  1916 
  1917 	    pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"`
  1918 	    non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"`
  1919 	    libobjs="$libobjs $pic_object"
  1920 	    non_pic_objects="$non_pic_objects $non_pic_object"
  1921 	  fi
  1922 	fi
  1923 	;;
  1924 
  1925       *.$libext)
  1926 	# An archive.
  1927 	deplibs="$deplibs $arg"
  1928 	old_deplibs="$old_deplibs $arg"
  1929 	continue
  1930 	;;
  1931 
  1932       *.la)
  1933 	# A libtool-controlled library.
  1934 
  1935 	if test "$prev" = dlfiles; then
  1936 	  # This library was specified with -dlopen.
  1937 	  dlfiles="$dlfiles $arg"
  1938 	  prev=
  1939 	elif test "$prev" = dlprefiles; then
  1940 	  # The library was specified with -dlpreopen.
  1941 	  dlprefiles="$dlprefiles $arg"
  1942 	  prev=
  1943 	else
  1944 	  deplibs="$deplibs $arg"
  1945 	fi
  1946 	continue
  1947 	;;
  1948 
  1949       # Some other compiler argument.
  1950       *)
  1951 	# Unknown arguments in both finalize_command and compile_command need
  1952 	# to be aesthetically quoted because they are evaled later.
  1953 	arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
  1954 	case $arg in
  1955 	*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
  1956 	  arg="\"$arg\""
  1957 	  ;;
  1958 	esac
  1959 	;;
  1960       esac # arg
  1961 
  1962       # Now actually substitute the argument into the commands.
  1963       if test -n "$arg"; then
  1964 	compile_command="$compile_command $arg"
  1965 	finalize_command="$finalize_command $arg"
  1966       fi
  1967     done # argument parsing loop
  1968 
  1969     if test -n "$prev"; then
  1970       $echo "$modename: the \`$prevarg' option requires an argument" 1>&2
  1971       $echo "$help" 1>&2
  1972       exit $EXIT_FAILURE
  1973     fi
  1974 
  1975     if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then
  1976       eval arg=\"$export_dynamic_flag_spec\"
  1977       compile_command="$compile_command $arg"
  1978       finalize_command="$finalize_command $arg"
  1979     fi
  1980 
  1981     oldlibs=
  1982     # calculate the name of the file, without its directory
  1983     outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'`
  1984     libobjs_save="$libobjs"
  1985 
  1986     if test -n "$shlibpath_var"; then
  1987       # get the directories listed in $shlibpath_var
  1988       eval shlib_search_path=\`\$echo \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\`
  1989     else
  1990       shlib_search_path=
  1991     fi
  1992     eval sys_lib_search_path=\"$sys_lib_search_path_spec\"
  1993     eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\"
  1994 
  1995     output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'`
  1996     if test "X$output_objdir" = "X$output"; then
  1997       output_objdir="$objdir"
  1998     else
  1999       output_objdir="$output_objdir/$objdir"
  2000     fi
  2001     # Create the object directory.
  2002     if test ! -d "$output_objdir"; then
  2003       $show "$mkdir $output_objdir"
  2004       $run $mkdir $output_objdir
  2005       exit_status=$?
  2006       if test "$exit_status" -ne 0 && test ! -d "$output_objdir"; then
  2007 	exit $exit_status
  2008       fi
  2009     fi
  2010 
  2011     # Determine the type of output
  2012     case $output in
  2013     "")
  2014       $echo "$modename: you must specify an output file" 1>&2
  2015       $echo "$help" 1>&2
  2016       exit $EXIT_FAILURE
  2017       ;;
  2018     *.$libext) linkmode=oldlib ;;
  2019     *.lo | *.$objext) linkmode=obj ;;
  2020     *.la) linkmode=lib ;;
  2021     *) linkmode=prog ;; # Anything else should be a program.
  2022     esac
  2023 
  2024     case $host in
  2025     *cygwin* | *mingw* | *pw32*)
  2026       # don't eliminate duplications in $postdeps and $predeps
  2027       duplicate_compiler_generated_deps=yes
  2028       ;;
  2029     *)
  2030       duplicate_compiler_generated_deps=$duplicate_deps
  2031       ;;
  2032     esac
  2033     specialdeplibs=
  2034 
  2035     libs=
  2036     # Find all interdependent deplibs by searching for libraries
  2037     # that are linked more than once (e.g. -la -lb -la)
  2038     for deplib in $deplibs; do
  2039       if test "X$duplicate_deps" = "Xyes" ; then
  2040 	case "$libs " in
  2041 	*" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
  2042 	esac
  2043       fi
  2044       libs="$libs $deplib"
  2045     done
  2046 
  2047     if test "$linkmode" = lib; then
  2048       libs="$predeps $libs $compiler_lib_search_path $postdeps"
  2049 
  2050       # Compute libraries that are listed more than once in $predeps
  2051       # $postdeps and mark them as special (i.e., whose duplicates are
  2052       # not to be eliminated).
  2053       pre_post_deps=
  2054       if test "X$duplicate_compiler_generated_deps" = "Xyes" ; then
  2055 	for pre_post_dep in $predeps $postdeps; do
  2056 	  case "$pre_post_deps " in
  2057 	  *" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;;
  2058 	  esac
  2059 	  pre_post_deps="$pre_post_deps $pre_post_dep"
  2060 	done
  2061       fi
  2062       pre_post_deps=
  2063     fi
  2064 
  2065     deplibs=
  2066     newdependency_libs=
  2067     newlib_search_path=
  2068     need_relink=no # whether we're linking any uninstalled libtool libraries
  2069     notinst_deplibs= # not-installed libtool libraries
  2070     case $linkmode in
  2071     lib)
  2072 	passes="conv link"
  2073 	for file in $dlfiles $dlprefiles; do
  2074 	  case $file in
  2075 	  *.la) ;;
  2076 	  *)
  2077 	    $echo "$modename: libraries can \`-dlopen' only libtool libraries: $file" 1>&2
  2078 	    exit $EXIT_FAILURE
  2079 	    ;;
  2080 	  esac
  2081 	done
  2082 	;;
  2083     prog)
  2084 	compile_deplibs=
  2085 	finalize_deplibs=
  2086 	alldeplibs=no
  2087 	newdlfiles=
  2088 	newdlprefiles=
  2089 	passes="conv scan dlopen dlpreopen link"
  2090 	;;
  2091     *)  passes="conv"
  2092 	;;
  2093     esac
  2094     for pass in $passes; do
  2095       if test "$linkmode,$pass" = "lib,link" ||
  2096 	 test "$linkmode,$pass" = "prog,scan"; then
  2097 	libs="$deplibs"
  2098 	deplibs=
  2099       fi
  2100       if test "$linkmode" = prog; then
  2101 	case $pass in
  2102 	dlopen) libs="$dlfiles" ;;
  2103 	dlpreopen) libs="$dlprefiles" ;;
  2104 	link) libs="$deplibs %DEPLIBS% $dependency_libs" ;;
  2105 	esac
  2106       fi
  2107       if test "$pass" = dlopen; then
  2108 	# Collect dlpreopened libraries
  2109 	save_deplibs="$deplibs"
  2110 	deplibs=
  2111       fi
  2112       for deplib in $libs; do
  2113 	lib=
  2114 	found=no
  2115 	case $deplib in
  2116 	-mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe)
  2117 	  if test "$linkmode,$pass" = "prog,link"; then
  2118 	    compile_deplibs="$deplib $compile_deplibs"
  2119 	    finalize_deplibs="$deplib $finalize_deplibs"
  2120 	  else
  2121 	    compiler_flags="$compiler_flags $deplib"
  2122 	  fi
  2123 	  continue
  2124 	  ;;
  2125 	-l*)
  2126 	  if test "$linkmode" != lib && test "$linkmode" != prog; then
  2127 	    $echo "$modename: warning: \`-l' is ignored for archives/objects" 1>&2
  2128 	    continue
  2129 	  fi
  2130 	  name=`$echo "X$deplib" | $Xsed -e 's/^-l//'`
  2131 	  for searchdir in $newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path; do
  2132 	    for search_ext in .la $std_shrext .so .a; do
  2133 	      # Search the libtool library
  2134 	      lib="$searchdir/lib${name}${search_ext}"
  2135 	      if test -f "$lib"; then
  2136 		if test "$search_ext" = ".la"; then
  2137 		  found=yes
  2138 		else
  2139 		  found=no
  2140 		fi
  2141 		break 2
  2142 	      fi
  2143 	    done
  2144 	  done
  2145 	  if test "$found" != yes; then
  2146 	    # deplib doesn't seem to be a libtool library
  2147 	    if test "$linkmode,$pass" = "prog,link"; then
  2148 	      compile_deplibs="$deplib $compile_deplibs"
  2149 	      finalize_deplibs="$deplib $finalize_deplibs"
  2150 	    else
  2151 	      deplibs="$deplib $deplibs"
  2152 	      test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
  2153 	    fi
  2154 	    continue
  2155 	  else # deplib is a libtool library
  2156 	    # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib,
  2157 	    # We need to do some special things here, and not later.
  2158 	    if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
  2159 	      case " $predeps $postdeps " in
  2160 	      *" $deplib "*)
  2161 		if (${SED} -e '2q' $lib |
  2162                     grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
  2163 		  library_names=
  2164 		  old_library=
  2165 		  case $lib in
  2166 		  */* | *\\*) . $lib ;;
  2167 		  *) . ./$lib ;;
  2168 		  esac
  2169 		  for l in $old_library $library_names; do
  2170 		    ll="$l"
  2171 		  done
  2172 		  if test "X$ll" = "X$old_library" ; then # only static version available
  2173 		    found=no
  2174 		    ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'`
  2175 		    test "X$ladir" = "X$lib" && ladir="."
  2176 		    lib=$ladir/$old_library
  2177 		    if test "$linkmode,$pass" = "prog,link"; then
  2178 		      compile_deplibs="$deplib $compile_deplibs"
  2179 		      finalize_deplibs="$deplib $finalize_deplibs"
  2180 		    else
  2181 		      deplibs="$deplib $deplibs"
  2182 		      test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
  2183 		    fi
  2184 		    continue
  2185 		  fi
  2186 		fi
  2187 	        ;;
  2188 	      *) ;;
  2189 	      esac
  2190 	    fi
  2191 	  fi
  2192 	  ;; # -l
  2193 	*.framework)
  2194 	  if test "$linkmode,$pass" = "prog,link"; then
  2195 	    compile_deplibs="$deplib $compile_deplibs"
  2196 	    finalize_deplibs="$deplib $finalize_deplibs"
  2197 	  else
  2198 	    deplibs="$deplib $deplibs"
  2199 	    if test "$linkmode" = lib ; then
  2200 	      newdependency_libs="$deplib $newdependency_libs"
  2201 	    fi
  2202 	  fi
  2203 	  continue
  2204 	  ;;
  2205 	-L*)
  2206 	  case $linkmode in
  2207 	  lib)
  2208 	    deplibs="$deplib $deplibs"
  2209 	    test "$pass" = conv && continue
  2210 	    newdependency_libs="$deplib $newdependency_libs"
  2211 	    newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
  2212 	    ;;
  2213 	  prog)
  2214 	    if test "$pass" = conv; then
  2215 	      deplibs="$deplib $deplibs"
  2216 	      continue
  2217 	    fi
  2218 	    if test "$pass" = scan; then
  2219 	      deplibs="$deplib $deplibs"
  2220 	    else
  2221 	      compile_deplibs="$deplib $compile_deplibs"
  2222 	      finalize_deplibs="$deplib $finalize_deplibs"
  2223 	    fi
  2224 	    newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
  2225 	    ;;
  2226 	  *)
  2227 	    $echo "$modename: warning: \`-L' is ignored for archives/objects" 1>&2
  2228 	    ;;
  2229 	  esac # linkmode
  2230 	  continue
  2231 	  ;; # -L
  2232 	-R*)
  2233 	  if test "$pass" = link; then
  2234 	    dir=`$echo "X$deplib" | $Xsed -e 's/^-R//'`
  2235 	    # Make sure the xrpath contains only unique directories.
  2236 	    case "$xrpath " in
  2237 	    *" $dir "*) ;;
  2238 	    *) xrpath="$xrpath $dir" ;;
  2239 	    esac
  2240 	  fi
  2241 	  deplibs="$deplib $deplibs"
  2242 	  continue
  2243 	  ;;
  2244 	*.la) lib="$deplib" ;;
  2245 	*.$libext)
  2246 	  if test "$pass" = conv; then
  2247 	    deplibs="$deplib $deplibs"
  2248 	    continue
  2249 	  fi
  2250 	  case $linkmode in
  2251 	  lib)
  2252 	    valid_a_lib=no
  2253 	    case $deplibs_check_method in
  2254 	      match_pattern*)
  2255 		set dummy $deplibs_check_method
  2256 	        match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
  2257 		if eval $echo \"$deplib\" 2>/dev/null \
  2258 		    | $SED 10q \
  2259 		    | $EGREP "$match_pattern_regex" > /dev/null; then
  2260 		  valid_a_lib=yes
  2261 		fi
  2262 		;;
  2263 	      pass_all)
  2264 		valid_a_lib=yes
  2265 		;;
  2266             esac
  2267 	    if test "$valid_a_lib" != yes; then
  2268 	      $echo
  2269 	      $echo "*** Warning: Trying to link with static lib archive $deplib."
  2270 	      $echo "*** I have the capability to make that library automatically link in when"
  2271 	      $echo "*** you link to this library.  But I can only do this if you have a"
  2272 	      $echo "*** shared version of the library, which you do not appear to have"
  2273 	      $echo "*** because the file extensions .$libext of this argument makes me believe"
  2274 	      $echo "*** that it is just a static archive that I should not used here."
  2275 	    else
  2276 	      $echo
  2277 	      $echo "*** Warning: Linking the shared library $output against the"
  2278 	      $echo "*** static library $deplib is not portable!"
  2279 	      deplibs="$deplib $deplibs"
  2280 	    fi
  2281 	    continue
  2282 	    ;;
  2283 	  prog)
  2284 	    if test "$pass" != link; then
  2285 	      deplibs="$deplib $deplibs"
  2286 	    else
  2287 	      compile_deplibs="$deplib $compile_deplibs"
  2288 	      finalize_deplibs="$deplib $finalize_deplibs"
  2289 	    fi
  2290 	    continue
  2291 	    ;;
  2292 	  esac # linkmode
  2293 	  ;; # *.$libext
  2294 	*.lo | *.$objext)
  2295 	  if test "$pass" = conv; then
  2296 	    deplibs="$deplib $deplibs"
  2297 	  elif test "$linkmode" = prog; then
  2298 	    if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
  2299 	      # If there is no dlopen support or we're linking statically,
  2300 	      # we need to preload.
  2301 	      newdlprefiles="$newdlprefiles $deplib"
  2302 	      compile_deplibs="$deplib $compile_deplibs"
  2303 	      finalize_deplibs="$deplib $finalize_deplibs"
  2304 	    else
  2305 	      newdlfiles="$newdlfiles $deplib"
  2306 	    fi
  2307 	  fi
  2308 	  continue
  2309 	  ;;
  2310 	%DEPLIBS%)
  2311 	  alldeplibs=yes
  2312 	  continue
  2313 	  ;;
  2314 	esac # case $deplib
  2315 	if test "$found" = yes || test -f "$lib"; then :
  2316 	else
  2317 	  $echo "$modename: cannot find the library \`$lib' or unhandled argument \`$deplib'" 1>&2
  2318 	  exit $EXIT_FAILURE
  2319 	fi
  2320 
  2321 	# Check to see that this really is a libtool archive.
  2322 	if (${SED} -e '2q' $lib | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
  2323 	else
  2324 	  $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
  2325 	  exit $EXIT_FAILURE
  2326 	fi
  2327 
  2328 	ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'`
  2329 	test "X$ladir" = "X$lib" && ladir="."
  2330 
  2331 	dlname=
  2332 	dlopen=
  2333 	dlpreopen=
  2334 	libdir=
  2335 	library_names=
  2336 	old_library=
  2337 	# If the library was installed with an old release of libtool,
  2338 	# it will not redefine variables installed, or shouldnotlink
  2339 	installed=yes
  2340 	shouldnotlink=no
  2341 	avoidtemprpath=
  2342 
  2343 
  2344 	# Read the .la file
  2345 	case $lib in
  2346 	*/* | *\\*) . $lib ;;
  2347 	*) . ./$lib ;;
  2348 	esac
  2349 
  2350 	case $host in
  2351 	*-*-darwin*)
  2352 	  # Convert "-framework foo" to "foo.framework" in dependency_libs
  2353 	  test -n "$dependency_libs" && dependency_libs=`$echo "X$dependency_libs" | $Xsed -e 's/-framework \([^ $]*\)/\1.framework/g'`
  2354 	  ;;
  2355 	esac
  2356 
  2357 	if test "$linkmode,$pass" = "lib,link" ||
  2358 	   test "$linkmode,$pass" = "prog,scan" ||
  2359 	   { test "$linkmode" != prog && test "$linkmode" != lib; }; then
  2360 	  test -n "$dlopen" && dlfiles="$dlfiles $dlopen"
  2361 	  test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen"
  2362 	fi
  2363 
  2364 	if test "$pass" = conv; then
  2365 	  # Only check for convenience libraries
  2366 	  deplibs="$lib $deplibs"
  2367 	  if test -z "$libdir"; then
  2368 	    if test -z "$old_library"; then
  2369 	      $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
  2370 	      exit $EXIT_FAILURE
  2371 	    fi
  2372 	    # It is a libtool convenience library, so add in its objects.
  2373 	    convenience="$convenience $ladir/$objdir/$old_library"
  2374 	    old_convenience="$old_convenience $ladir/$objdir/$old_library"
  2375 	    tmp_libs=
  2376 	    for deplib in $dependency_libs; do
  2377 	      deplibs="$deplib $deplibs"
  2378               if test "X$duplicate_deps" = "Xyes" ; then
  2379 	        case "$tmp_libs " in
  2380 	        *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
  2381 	        esac
  2382               fi
  2383 	      tmp_libs="$tmp_libs $deplib"
  2384 	    done
  2385 	  elif test "$linkmode" != prog && test "$linkmode" != lib; then
  2386 	    $echo "$modename: \`$lib' is not a convenience library" 1>&2
  2387 	    exit $EXIT_FAILURE
  2388 	  fi
  2389 	  continue
  2390 	fi # $pass = conv
  2391 
  2392 
  2393 	# Get the name of the library we link against.
  2394 	linklib=
  2395 	for l in $old_library $library_names; do
  2396 	  linklib="$l"
  2397 	done
  2398 	if test -z "$linklib"; then
  2399 	  $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
  2400 	  exit $EXIT_FAILURE
  2401 	fi
  2402 
  2403 	# This library was specified with -dlopen.
  2404 	if test "$pass" = dlopen; then
  2405 	  if test -z "$libdir"; then
  2406 	    $echo "$modename: cannot -dlopen a convenience library: \`$lib'" 1>&2
  2407 	    exit $EXIT_FAILURE
  2408 	  fi
  2409 	  if test -z "$dlname" ||
  2410 	     test "$dlopen_support" != yes ||
  2411 	     test "$build_libtool_libs" = no; then
  2412 	    # If there is no dlname, no dlopen support or we're linking
  2413 	    # statically, we need to preload.  We also need to preload any
  2414 	    # dependent libraries so libltdl's deplib preloader doesn't
  2415 	    # bomb out in the load deplibs phase.
  2416 	    dlprefiles="$dlprefiles $lib $dependency_libs"
  2417 	  else
  2418 	    newdlfiles="$newdlfiles $lib"
  2419 	  fi
  2420 	  continue
  2421 	fi # $pass = dlopen
  2422 
  2423 	# We need an absolute path.
  2424 	case $ladir in
  2425 	[\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;;
  2426 	*)
  2427 	  abs_ladir=`cd "$ladir" && pwd`
  2428 	  if test -z "$abs_ladir"; then
  2429 	    $echo "$modename: warning: cannot determine absolute directory name of \`$ladir'" 1>&2
  2430 	    $echo "$modename: passing it literally to the linker, although it might fail" 1>&2
  2431 	    abs_ladir="$ladir"
  2432 	  fi
  2433 	  ;;
  2434 	esac
  2435 	laname=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
  2436 
  2437 	# Find the relevant object directory and library name.
  2438 	if test "X$installed" = Xyes; then
  2439 	  if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then
  2440 	    $echo "$modename: warning: library \`$lib' was moved." 1>&2
  2441 	    dir="$ladir"
  2442 	    absdir="$abs_ladir"
  2443 	    libdir="$abs_ladir"
  2444 	  else
  2445 	    dir="$libdir"
  2446 	    absdir="$libdir"
  2447 	  fi
  2448 	  test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes
  2449 	else
  2450 	  if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then
  2451 	    dir="$ladir"
  2452 	    absdir="$abs_ladir"
  2453 	    # Remove this search path later
  2454 	    notinst_path="$notinst_path $abs_ladir"
  2455 	  else
  2456 	    dir="$ladir/$objdir"
  2457 	    absdir="$abs_ladir/$objdir"
  2458 	    # Remove this search path later
  2459 	    notinst_path="$notinst_path $abs_ladir"
  2460 	  fi
  2461 	fi # $installed = yes
  2462 	name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
  2463 
  2464 	# This library was specified with -dlpreopen.
  2465 	if test "$pass" = dlpreopen; then
  2466 	  if test -z "$libdir"; then
  2467 	    $echo "$modename: cannot -dlpreopen a convenience library: \`$lib'" 1>&2
  2468 	    exit $EXIT_FAILURE
  2469 	  fi
  2470 	  # Prefer using a static library (so that no silly _DYNAMIC symbols
  2471 	  # are required to link).
  2472 	  if test -n "$old_library"; then
  2473 	    newdlprefiles="$newdlprefiles $dir/$old_library"
  2474 	  # Otherwise, use the dlname, so that lt_dlopen finds it.
  2475 	  elif test -n "$dlname"; then
  2476 	    newdlprefiles="$newdlprefiles $dir/$dlname"
  2477 	  else
  2478 	    newdlprefiles="$newdlprefiles $dir/$linklib"
  2479 	  fi
  2480 	fi # $pass = dlpreopen
  2481 
  2482 	if test -z "$libdir"; then
  2483 	  # Link the convenience library
  2484 	  if test "$linkmode" = lib; then
  2485 	    deplibs="$dir/$old_library $deplibs"
  2486 	  elif test "$linkmode,$pass" = "prog,link"; then
  2487 	    compile_deplibs="$dir/$old_library $compile_deplibs"
  2488 	    finalize_deplibs="$dir/$old_library $finalize_deplibs"
  2489 	  else
  2490 	    deplibs="$lib $deplibs" # used for prog,scan pass
  2491 	  fi
  2492 	  continue
  2493 	fi
  2494 
  2495 
  2496 	if test "$linkmode" = prog && test "$pass" != link; then
  2497 	  newlib_search_path="$newlib_search_path $ladir"
  2498 	  deplibs="$lib $deplibs"
  2499 
  2500 	  linkalldeplibs=no
  2501 	  if test "$link_all_deplibs" != no || test -z "$library_names" ||
  2502 	     test "$build_libtool_libs" = no; then
  2503 	    linkalldeplibs=yes
  2504 	  fi
  2505 
  2506 	  tmp_libs=
  2507 	  for deplib in $dependency_libs; do
  2508 	    case $deplib in
  2509 	    -L*) newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`;; ### testsuite: skip nested quoting test
  2510 	    esac
  2511 	    # Need to link against all dependency_libs?
  2512 	    if test "$linkalldeplibs" = yes; then
  2513 	      deplibs="$deplib $deplibs"
  2514 	    else
  2515 	      # Need to hardcode shared library paths
  2516 	      # or/and link against static libraries
  2517 	      newdependency_libs="$deplib $newdependency_libs"
  2518 	    fi
  2519 	    if test "X$duplicate_deps" = "Xyes" ; then
  2520 	      case "$tmp_libs " in
  2521 	      *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
  2522 	      esac
  2523 	    fi
  2524 	    tmp_libs="$tmp_libs $deplib"
  2525 	  done # for deplib
  2526 	  continue
  2527 	fi # $linkmode = prog...
  2528 
  2529 	if test "$linkmode,$pass" = "prog,link"; then
  2530 	  if test -n "$library_names" &&
  2531 	     { test "$prefer_static_libs" = no || test -z "$old_library"; }; then
  2532 	    # We need to hardcode the library path
  2533 	    if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then
  2534 	      # Make sure the rpath contains only unique directories.
  2535 	      case "$temp_rpath " in
  2536 	      *" $dir "*) ;;
  2537 	      *" $absdir "*) ;;
  2538 	      *) temp_rpath="$temp_rpath $absdir" ;;
  2539 	      esac
  2540 	    fi
  2541 
  2542 	    # Hardcode the library path.
  2543 	    # Skip directories that are in the system default run-time
  2544 	    # search path.
  2545 	    case " $sys_lib_dlsearch_path " in
  2546 	    *" $absdir "*) ;;
  2547 	    *)
  2548 	      case "$compile_rpath " in
  2549 	      *" $absdir "*) ;;
  2550 	      *) compile_rpath="$compile_rpath $absdir"
  2551 	      esac
  2552 	      ;;
  2553 	    esac
  2554 	    case " $sys_lib_dlsearch_path " in
  2555 	    *" $libdir "*) ;;
  2556 	    *)
  2557 	      case "$finalize_rpath " in
  2558 	      *" $libdir "*) ;;
  2559 	      *) finalize_rpath="$finalize_rpath $libdir"
  2560 	      esac
  2561 	      ;;
  2562 	    esac
  2563 	  fi # $linkmode,$pass = prog,link...
  2564 
  2565 	  if test "$alldeplibs" = yes &&
  2566 	     { test "$deplibs_check_method" = pass_all ||
  2567 	       { test "$build_libtool_libs" = yes &&
  2568 		 test -n "$library_names"; }; }; then
  2569 	    # We only need to search for static libraries
  2570 	    continue
  2571 	  fi
  2572 	fi
  2573 
  2574 	link_static=no # Whether the deplib will be linked statically
  2575 	use_static_libs=$prefer_static_libs
  2576 	if test "$use_static_libs" = built && test "$installed" = yes ; then
  2577 	  use_static_libs=no
  2578 	fi
  2579 	if test -n "$library_names" &&
  2580 	   { test "$use_static_libs" = no || test -z "$old_library"; }; then
  2581 	  if test "$installed" = no; then
  2582 	    notinst_deplibs="$notinst_deplibs $lib"
  2583 	    need_relink=yes
  2584 	  fi
  2585 	  # This is a shared library
  2586 
  2587 	  # Warn about portability, can't link against -module's on
  2588 	  # some systems (darwin)
  2589 	  if test "$shouldnotlink" = yes && test "$pass" = link ; then
  2590 	    $echo
  2591 	    if test "$linkmode" = prog; then
  2592 	      $echo "*** Warning: Linking the executable $output against the loadable module"
  2593 	    else
  2594 	      $echo "*** Warning: Linking the shared library $output against the loadable module"
  2595 	    fi
  2596 	    $echo "*** $linklib is not portable!"
  2597 	  fi
  2598 	  if test "$linkmode" = lib &&
  2599 	     test "$hardcode_into_libs" = yes; then
  2600 	    # Hardcode the library path.
  2601 	    # Skip directories that are in the system default run-time
  2602 	    # search path.
  2603 	    case " $sys_lib_dlsearch_path " in
  2604 	    *" $absdir "*) ;;
  2605 	    *)
  2606 	      case "$compile_rpath " in
  2607 	      *" $absdir "*) ;;
  2608 	      *) compile_rpath="$compile_rpath $absdir"
  2609 	      esac
  2610 	      ;;
  2611 	    esac
  2612 	    case " $sys_lib_dlsearch_path " in
  2613 	    *" $libdir "*) ;;
  2614 	    *)
  2615 	      case "$finalize_rpath " in
  2616 	      *" $libdir "*) ;;
  2617 	      *) finalize_rpath="$finalize_rpath $libdir"
  2618 	      esac
  2619 	      ;;
  2620 	    esac
  2621 	  fi
  2622 
  2623 	  if test -n "$old_archive_from_expsyms_cmds"; then
  2624 	    # figure out the soname
  2625 	    set dummy $library_names
  2626 	    realname="$2"
  2627 	    shift; shift
  2628 	    libname=`eval \\$echo \"$libname_spec\"`
  2629 	    # use dlname if we got it. it's perfectly good, no?
  2630 	    if test -n "$dlname"; then
  2631 	      soname="$dlname"
  2632 	    elif test -n "$soname_spec"; then
  2633 	      # bleh windows
  2634 	      case $host in
  2635 	      *cygwin* | mingw*)
  2636 		major=`expr $current - $age`
  2637 		versuffix="-$major"
  2638 		;;
  2639 	      esac
  2640 	      eval soname=\"$soname_spec\"
  2641 	    else
  2642 	      soname="$realname"
  2643 	    fi
  2644 
  2645 	    # Make a new name for the extract_expsyms_cmds to use
  2646 	    soroot="$soname"
  2647 	    soname=`$echo $soroot | ${SED} -e 's/^.*\///'`
  2648 	    newlib="libimp-`$echo $soname | ${SED} 's/^lib//;s/\.dll$//'`.a"
  2649 
  2650 	    # If the library has no export list, then create one now
  2651 	    if test -f "$output_objdir/$soname-def"; then :
  2652 	    else
  2653 	      $show "extracting exported symbol list from \`$soname'"
  2654 	      save_ifs="$IFS"; IFS='~'
  2655 	      cmds=$extract_expsyms_cmds
  2656 	      for cmd in $cmds; do
  2657 		IFS="$save_ifs"
  2658 		eval cmd=\"$cmd\"
  2659 		$show "$cmd"
  2660 		$run eval "$cmd" || exit $?
  2661 	      done
  2662 	      IFS="$save_ifs"
  2663 	    fi
  2664 
  2665 	    # Create $newlib
  2666 	    if test -f "$output_objdir/$newlib"; then :; else
  2667 	      $show "generating import library for \`$soname'"
  2668 	      save_ifs="$IFS"; IFS='~'
  2669 	      cmds=$old_archive_from_expsyms_cmds
  2670 	      for cmd in $cmds; do
  2671 		IFS="$save_ifs"
  2672 		eval cmd=\"$cmd\"
  2673 		$show "$cmd"
  2674 		$run eval "$cmd" || exit $?
  2675 	      done
  2676 	      IFS="$save_ifs"
  2677 	    fi
  2678 	    # make sure the library variables are pointing to the new library
  2679 	    dir=$output_objdir
  2680 	    linklib=$newlib
  2681 	  fi # test -n "$old_archive_from_expsyms_cmds"
  2682 
  2683 	  if test "$linkmode" = prog || test "$mode" != relink; then
  2684 	    add_shlibpath=
  2685 	    add_dir=
  2686 	    add=
  2687 	    lib_linked=yes
  2688 	    case $hardcode_action in
  2689 	    immediate | unsupported)
  2690 	      if test "$hardcode_direct" = no; then
  2691 		add="$dir/$linklib"
  2692 		case $host in
  2693 		  *-*-sco3.2v5.0.[024]*) add_dir="-L$dir" ;;
  2694 		  *-*-sysv4*uw2*) add_dir="-L$dir" ;;
  2695 		  *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \
  2696 		    *-*-unixware7*) add_dir="-L$dir" ;;
  2697 		  *-*-darwin* )
  2698 		    # if the lib is a module then we can not link against
  2699 		    # it, someone is ignoring the new warnings I added
  2700 		    if /usr/bin/file -L $add 2> /dev/null |
  2701                       $EGREP ": [^:]* bundle" >/dev/null ; then
  2702 		      $echo "** Warning, lib $linklib is a module, not a shared library"
  2703 		      if test -z "$old_library" ; then
  2704 		        $echo
  2705 		        $echo "** And there doesn't seem to be a static archive available"
  2706 		        $echo "** The link will probably fail, sorry"
  2707 		      else
  2708 		        add="$dir/$old_library"
  2709 		      fi
  2710 		    fi
  2711 		esac
  2712 	      elif test "$hardcode_minus_L" = no; then
  2713 		case $host in
  2714 		*-*-sunos*) add_shlibpath="$dir" ;;
  2715 		esac
  2716 		add_dir="-L$dir"
  2717 		add="-l$name"
  2718 	      elif test "$hardcode_shlibpath_var" = no; then
  2719 		add_shlibpath="$dir"
  2720 		add="-l$name"
  2721 	      else
  2722 		lib_linked=no
  2723 	      fi
  2724 	      ;;
  2725 	    relink)
  2726 	      if test "$hardcode_direct" = yes; then
  2727 		add="$dir/$linklib"
  2728 	      elif test "$hardcode_minus_L" = yes; then
  2729 		add_dir="-L$dir"
  2730 		# Try looking first in the location we're being installed to.
  2731 		if test -n "$inst_prefix_dir"; then
  2732 		  case $libdir in
  2733 		    [\\/]*)
  2734 		      add_dir="$add_dir -L$inst_prefix_dir$libdir"
  2735 		      ;;
  2736 		  esac
  2737 		fi
  2738 		add="-l$name"
  2739 	      elif test "$hardcode_shlibpath_var" = yes; then
  2740 		add_shlibpath="$dir"
  2741 		add="-l$name"
  2742 	      else
  2743 		lib_linked=no
  2744 	      fi
  2745 	      ;;
  2746 	    *) lib_linked=no ;;
  2747 	    esac
  2748 
  2749 	    if test "$lib_linked" != yes; then
  2750 	      $echo "$modename: configuration error: unsupported hardcode properties"
  2751 	      exit $EXIT_FAILURE
  2752 	    fi
  2753 
  2754 	    if test -n "$add_shlibpath"; then
  2755 	      case :$compile_shlibpath: in
  2756 	      *":$add_shlibpath:"*) ;;
  2757 	      *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;;
  2758 	      esac
  2759 	    fi
  2760 	    if test "$linkmode" = prog; then
  2761 	      test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs"
  2762 	      test -n "$add" && compile_deplibs="$add $compile_deplibs"
  2763 	    else
  2764 	      test -n "$add_dir" && deplibs="$add_dir $deplibs"
  2765 	      test -n "$add" && deplibs="$add $deplibs"
  2766 	      if test "$hardcode_direct" != yes && \
  2767 		 test "$hardcode_minus_L" != yes && \
  2768 		 test "$hardcode_shlibpath_var" = yes; then
  2769 		case :$finalize_shlibpath: in
  2770 		*":$libdir:"*) ;;
  2771 		*) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
  2772 		esac
  2773 	      fi
  2774 	    fi
  2775 	  fi
  2776 
  2777 	  if test "$linkmode" = prog || test "$mode" = relink; then
  2778 	    add_shlibpath=
  2779 	    add_dir=
  2780 	    add=
  2781 	    # Finalize command for both is simple: just hardcode it.
  2782 	    if test "$hardcode_direct" = yes; then
  2783 	      add="$libdir/$linklib"
  2784 	    elif test "$hardcode_minus_L" = yes; then
  2785 	      add_dir="-L$libdir"
  2786 	      add="-l$name"
  2787 	    elif test "$hardcode_shlibpath_var" = yes; then
  2788 	      case :$finalize_shlibpath: in
  2789 	      *":$libdir:"*) ;;
  2790 	      *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
  2791 	      esac
  2792 	      add="-l$name"
  2793 	    elif test "$hardcode_automatic" = yes; then
  2794 	      if test -n "$inst_prefix_dir" &&
  2795 		 test -f "$inst_prefix_dir$libdir/$linklib" ; then
  2796 	        add="$inst_prefix_dir$libdir/$linklib"
  2797 	      else
  2798 	        add="$libdir/$linklib"
  2799 	      fi
  2800 	    else
  2801 	      # We cannot seem to hardcode it, guess we'll fake it.
  2802 	      add_dir="-L$libdir"
  2803 	      # Try looking first in the location we're being installed to.
  2804 	      if test -n "$inst_prefix_dir"; then
  2805 		case $libdir in
  2806 		  [\\/]*)
  2807 		    add_dir="$add_dir -L$inst_prefix_dir$libdir"
  2808 		    ;;
  2809 		esac
  2810 	      fi
  2811 	      add="-l$name"
  2812 	    fi
  2813 
  2814 	    if test "$linkmode" = prog; then
  2815 	      test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs"
  2816 	      test -n "$add" && finalize_deplibs="$add $finalize_deplibs"
  2817 	    else
  2818 	      test -n "$add_dir" && deplibs="$add_dir $deplibs"
  2819 	      test -n "$add" && deplibs="$add $deplibs"
  2820 	    fi
  2821 	  fi
  2822 	elif test "$linkmode" = prog; then
  2823 	  # Here we assume that one of hardcode_direct or hardcode_minus_L
  2824 	  # is not unsupported.  This is valid on all known static and
  2825 	  # shared platforms.
  2826 	  if test "$hardcode_direct" != unsupported; then
  2827 	    test -n "$old_library" && linklib="$old_library"
  2828 	    compile_deplibs="$dir/$linklib $compile_deplibs"
  2829 	    finalize_deplibs="$dir/$linklib $finalize_deplibs"
  2830 	  else
  2831 	    compile_deplibs="-l$name -L$dir $compile_deplibs"
  2832 	    finalize_deplibs="-l$name -L$dir $finalize_deplibs"
  2833 	  fi
  2834 	elif test "$build_libtool_libs" = yes; then
  2835 	  # Not a shared library
  2836 	  if test "$deplibs_check_method" != pass_all; then
  2837 	    # We're trying link a shared library against a static one
  2838 	    # but the system doesn't support it.
  2839 
  2840 	    # Just print a warning and add the library to dependency_libs so
  2841 	    # that the program can be linked against the static library.
  2842 	    $echo
  2843 	    $echo "*** Warning: This system can not link to static lib archive $lib."
  2844 	    $echo "*** I have the capability to make that library automatically link in when"
  2845 	    $echo "*** you link to this library.  But I can only do this if you have a"
  2846 	    $echo "*** shared version of the library, which you do not appear to have."
  2847 	    if test "$module" = yes; then
  2848 	      $echo "*** But as you try to build a module library, libtool will still create "
  2849 	      $echo "*** a static module, that should work as long as the dlopening application"
  2850 	      $echo "*** is linked with the -dlopen flag to resolve symbols at runtime."
  2851 	      if test -z "$global_symbol_pipe"; then
  2852 		$echo
  2853 		$echo "*** However, this would only work if libtool was able to extract symbol"
  2854 		$echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
  2855 		$echo "*** not find such a program.  So, this module is probably useless."
  2856 		$echo "*** \`nm' from GNU binutils and a full rebuild may help."
  2857 	      fi
  2858 	      if test "$build_old_libs" = no; then
  2859 		build_libtool_libs=module
  2860 		build_old_libs=yes
  2861 	      else
  2862 		build_libtool_libs=no
  2863 	      fi
  2864 	    fi
  2865 	  else
  2866 	    deplibs="$dir/$old_library $deplibs"
  2867 	    link_static=yes
  2868 	  fi
  2869 	fi # link shared/static library?
  2870 
  2871 	if test "$linkmode" = lib; then
  2872 	  if test -n "$dependency_libs" &&
  2873 	     { test "$hardcode_into_libs" != yes ||
  2874 	       test "$build_old_libs" = yes ||
  2875 	       test "$link_static" = yes; }; then
  2876 	    # Extract -R from dependency_libs
  2877 	    temp_deplibs=
  2878 	    for libdir in $dependency_libs; do
  2879 	      case $libdir in
  2880 	      -R*) temp_xrpath=`$echo "X$libdir" | $Xsed -e 's/^-R//'`
  2881 		   case " $xrpath " in
  2882 		   *" $temp_xrpath "*) ;;
  2883 		   *) xrpath="$xrpath $temp_xrpath";;
  2884 		   esac;;
  2885 	      *) temp_deplibs="$temp_deplibs $libdir";;
  2886 	      esac
  2887 	    done
  2888 	    dependency_libs="$temp_deplibs"
  2889 	  fi
  2890 
  2891 	  newlib_search_path="$newlib_search_path $absdir"
  2892 	  # Link against this library
  2893 	  test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs"
  2894 	  # ... and its dependency_libs
  2895 	  tmp_libs=
  2896 	  for deplib in $dependency_libs; do
  2897 	    newdependency_libs="$deplib $newdependency_libs"
  2898 	    if test "X$duplicate_deps" = "Xyes" ; then
  2899 	      case "$tmp_libs " in
  2900 	      *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
  2901 	      esac
  2902 	    fi
  2903 	    tmp_libs="$tmp_libs $deplib"
  2904 	  done
  2905 
  2906 	  if test "$link_all_deplibs" != no; then
  2907 	    # Add the search paths of all dependency libraries
  2908 	    for deplib in $dependency_libs; do
  2909 	      case $deplib in
  2910 	      -L*) path="$deplib" ;;
  2911 	      *.la)
  2912 		dir=`$echo "X$deplib" | $Xsed -e 's%/[^/]*$%%'`
  2913 		test "X$dir" = "X$deplib" && dir="."
  2914 		# We need an absolute path.
  2915 		case $dir in
  2916 		[\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;;
  2917 		*)
  2918 		  absdir=`cd "$dir" && pwd`
  2919 		  if test -z "$absdir"; then
  2920 		    $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2
  2921 		    absdir="$dir"
  2922 		  fi
  2923 		  ;;
  2924 		esac
  2925 		if grep "^installed=no" $deplib > /dev/null; then
  2926 		  path="$absdir/$objdir"
  2927 		else
  2928 		  eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
  2929 		  if test -z "$libdir"; then
  2930 		    $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
  2931 		    exit $EXIT_FAILURE
  2932 		  fi
  2933 		  if test "$absdir" != "$libdir"; then
  2934 		    $echo "$modename: warning: \`$deplib' seems to be moved" 1>&2
  2935 		  fi
  2936 		  path="$absdir"
  2937 		fi
  2938 		depdepl=
  2939 		case $host in
  2940 		*-*-darwin*)
  2941 		  # we do not want to link against static libs,
  2942 		  # but need to link against shared
  2943 		  eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib`
  2944 		  if test -n "$deplibrary_names" ; then
  2945 		    for tmp in $deplibrary_names ; do
  2946 		      depdepl=$tmp
  2947 		    done
  2948 		    if test -f "$path/$depdepl" ; then
  2949 		      depdepl="$path/$depdepl"
  2950 		    fi
  2951 		    # do not add paths which are already there
  2952 		    case " $newlib_search_path " in
  2953 		    *" $path "*) ;;
  2954 		    *) newlib_search_path="$newlib_search_path $path";;
  2955 		    esac
  2956 		  fi
  2957 		  path=""
  2958 		  ;;
  2959 		*)
  2960 		  path="-L$path"
  2961 		  ;;
  2962 		esac
  2963 		;;
  2964 	      -l*)
  2965 		case $host in
  2966 		*-*-darwin*)
  2967 		  # Again, we only want to link against shared libraries
  2968 		  eval tmp_libs=`$echo "X$deplib" | $Xsed -e "s,^\-l,,"`
  2969 		  for tmp in $newlib_search_path ; do
  2970 		    if test -f "$tmp/lib$tmp_libs.dylib" ; then
  2971 		      eval depdepl="$tmp/lib$tmp_libs.dylib"
  2972 		      break
  2973 		    fi
  2974 		  done
  2975 		  path=""
  2976 		  ;;
  2977 	      *.framework)
  2978 		case $host in
  2979 		  *-*-darwin*)
  2980 		    depdepl="$deplib"
  2981 		    ;;
  2982 		esac
  2983 		;;
  2984 		*) continue ;;
  2985 		esac
  2986 		;;
  2987 	      *) continue ;;
  2988 	      esac
  2989 	      case " $deplibs " in
  2990 	      *" $path "*) ;;
  2991 	      *) deplibs="$path $deplibs" ;;
  2992 	      esac
  2993 	      case " $deplibs " in
  2994 	      *" $depdepl "*) ;;
  2995 	      *) deplibs="$depdepl $deplibs" ;;
  2996 	      esac
  2997 	    done
  2998 	  fi # link_all_deplibs != no
  2999 	fi # linkmode = lib
  3000       done # for deplib in $libs
  3001       dependency_libs="$newdependency_libs"
  3002       if test "$pass" = dlpreopen; then
  3003 	# Link the dlpreopened libraries before other libraries
  3004 	for deplib in $save_deplibs; do
  3005 	  deplibs="$deplib $deplibs"
  3006 	done
  3007       fi
  3008       if test "$pass" != dlopen; then
  3009 	if test "$pass" != conv; then
  3010 	  # Make sure lib_search_path contains only unique directories.
  3011 	  lib_search_path=
  3012 	  for dir in $newlib_search_path; do
  3013 	    case "$lib_search_path " in
  3014 	    *" $dir "*) ;;
  3015 	    *) lib_search_path="$lib_search_path $dir" ;;
  3016 	    esac
  3017 	  done
  3018 	  newlib_search_path=
  3019 	fi
  3020 
  3021 	if test "$linkmode,$pass" != "prog,link"; then
  3022 	  vars="deplibs"
  3023 	else
  3024 	  vars="compile_deplibs finalize_deplibs"
  3025 	fi
  3026 	for var in $vars dependency_libs; do
  3027 	  # Add libraries to $var in reverse order
  3028 	  eval tmp_libs=\"\$$var\"
  3029 	  new_libs=
  3030 	  for deplib in $tmp_libs; do
  3031 	    # FIXME: Pedantically, this is the right thing to do, so
  3032 	    #        that some nasty dependency loop isn't accidentally
  3033 	    #        broken:
  3034 	    #new_libs="$deplib $new_libs"
  3035 	    # Pragmatically, this seems to cause very few problems in
  3036 	    # practice:
  3037 	    case $deplib in
  3038 	    -L*) new_libs="$deplib $new_libs" ;;
  3039 	    -R*) ;;
  3040 	    *)
  3041 	      # And here is the reason: when a library appears more
  3042 	      # than once as an explicit dependence of a library, or
  3043 	      # is implicitly linked in more than once by the
  3044 	      # compiler, it is considered special, and multiple
  3045 	      # occurrences thereof are not removed.  Compare this
  3046 	      # with having the same library being listed as a
  3047 	      # dependency of multiple other libraries: in this case,
  3048 	      # we know (pedantically, we assume) the library does not
  3049 	      # need to be listed more than once, so we keep only the
  3050 	      # last copy.  This is not always right, but it is rare
  3051 	      # enough that we require users that really mean to play
  3052 	      # such unportable linking tricks to link the library
  3053 	      # using -Wl,-lname, so that libtool does not consider it
  3054 	      # for duplicate removal.
  3055 	      case " $specialdeplibs " in
  3056 	      *" $deplib "*) new_libs="$deplib $new_libs" ;;
  3057 	      *)
  3058 		case " $new_libs " in
  3059 		*" $deplib "*) ;;
  3060 		*) new_libs="$deplib $new_libs" ;;
  3061 		esac
  3062 		;;
  3063 	      esac
  3064 	      ;;
  3065 	    esac
  3066 	  done
  3067 	  tmp_libs=
  3068 	  for deplib in $new_libs; do
  3069 	    case $deplib in
  3070 	    -L*)
  3071 	      case " $tmp_libs " in
  3072 	      *" $deplib "*) ;;
  3073 	      *) tmp_libs="$tmp_libs $deplib" ;;
  3074 	      esac
  3075 	      ;;
  3076 	    *) tmp_libs="$tmp_libs $deplib" ;;
  3077 	    esac
  3078 	  done
  3079 	  eval $var=\"$tmp_libs\"
  3080 	done # for var
  3081       fi
  3082       # Last step: remove runtime libs from dependency_libs
  3083       # (they stay in deplibs)
  3084       tmp_libs=
  3085       for i in $dependency_libs ; do
  3086 	case " $predeps $postdeps $compiler_lib_search_path " in
  3087 	*" $i "*)
  3088 	  i=""
  3089 	  ;;
  3090 	esac
  3091 	if test -n "$i" ; then
  3092 	  tmp_libs="$tmp_libs $i"
  3093 	fi
  3094       done
  3095       dependency_libs=$tmp_libs
  3096     done # for pass
  3097     if test "$linkmode" = prog; then
  3098       dlfiles="$newdlfiles"
  3099       dlprefiles="$newdlprefiles"
  3100     fi
  3101 
  3102     case $linkmode in
  3103     oldlib)
  3104       if test -n "$deplibs"; then
  3105 	$echo "$modename: warning: \`-l' and \`-L' are ignored for archives" 1>&2
  3106       fi
  3107 
  3108       if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
  3109 	$echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2
  3110       fi
  3111 
  3112       if test -n "$rpath"; then
  3113 	$echo "$modename: warning: \`-rpath' is ignored for archives" 1>&2
  3114       fi
  3115 
  3116       if test -n "$xrpath"; then
  3117 	$echo "$modename: warning: \`-R' is ignored for archives" 1>&2
  3118       fi
  3119 
  3120       if test -n "$vinfo"; then
  3121 	$echo "$modename: warning: \`-version-info/-version-number' is ignored for archives" 1>&2
  3122       fi
  3123 
  3124       if test -n "$release"; then
  3125 	$echo "$modename: warning: \`-release' is ignored for archives" 1>&2
  3126       fi
  3127 
  3128       if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
  3129 	$echo "$modename: warning: \`-export-symbols' is ignored for archives" 1>&2
  3130       fi
  3131 
  3132       # Now set the variables for building old libraries.
  3133       build_libtool_libs=no
  3134       oldlibs="$output"
  3135       objs="$objs$old_deplibs"
  3136       ;;
  3137 
  3138     lib)
  3139       # Make sure we only generate libraries of the form `libNAME.la'.
  3140       case $outputname in
  3141       lib*)
  3142 	name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
  3143 	eval shared_ext=\"$shrext_cmds\"
  3144 	eval libname=\"$libname_spec\"
  3145 	;;
  3146       *)
  3147 	if test "$module" = no; then
  3148 	  $echo "$modename: libtool library \`$output' must begin with \`lib'" 1>&2
  3149 	  $echo "$help" 1>&2
  3150 	  exit $EXIT_FAILURE
  3151 	fi
  3152 	if test "$need_lib_prefix" != no; then
  3153 	  # Add the "lib" prefix for modules if required
  3154 	  name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
  3155 	  eval shared_ext=\"$shrext_cmds\"
  3156 	  eval libname=\"$libname_spec\"
  3157 	else
  3158 	  libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
  3159 	fi
  3160 	;;
  3161       esac
  3162 
  3163       if test -n "$objs"; then
  3164 	if test "$deplibs_check_method" != pass_all; then
  3165 	  $echo "$modename: cannot build libtool library \`$output' from non-libtool objects on this host:$objs" 2>&1
  3166 	  exit $EXIT_FAILURE
  3167 	else
  3168 	  $echo
  3169 	  $echo "*** Warning: Linking the shared library $output against the non-libtool"
  3170 	  $echo "*** objects $objs is not portable!"
  3171 	  libobjs="$libobjs $objs"
  3172 	fi
  3173       fi
  3174 
  3175       if test "$dlself" != no; then
  3176 	$echo "$modename: warning: \`-dlopen self' is ignored for libtool libraries" 1>&2
  3177       fi
  3178 
  3179       set dummy $rpath
  3180       if test "$#" -gt 2; then
  3181 	$echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2
  3182       fi
  3183       install_libdir="$2"
  3184 
  3185       oldlibs=
  3186       if test -z "$rpath"; then
  3187 	if test "$build_libtool_libs" = yes; then
  3188 	  # Building a libtool convenience library.
  3189 	  # Some compilers have problems with a `.al' extension so
  3190 	  # convenience libraries should have the same extension an
  3191 	  # archive normally would.
  3192 	  oldlibs="$output_objdir/$libname.$libext $oldlibs"
  3193 	  build_libtool_libs=convenience
  3194 	  build_old_libs=yes
  3195 	fi
  3196 
  3197 	if test -n "$vinfo"; then
  3198 	  $echo "$modename: warning: \`-version-info/-version-number' is ignored for convenience libraries" 1>&2
  3199 	fi
  3200 
  3201 	if test -n "$release"; then
  3202 	  $echo "$modename: warning: \`-release' is ignored for convenience libraries" 1>&2
  3203 	fi
  3204       else
  3205 
  3206 	# Parse the version information argument.
  3207 	save_ifs="$IFS"; IFS=':'
  3208 	set dummy $vinfo 0 0 0
  3209 	IFS="$save_ifs"
  3210 
  3211 	if test -n "$8"; then
  3212 	  $echo "$modename: too many parameters to \`-version-info'" 1>&2
  3213 	  $echo "$help" 1>&2
  3214 	  exit $EXIT_FAILURE
  3215 	fi
  3216 
  3217 	# convert absolute version numbers to libtool ages
  3218 	# this retains compatibility with .la files and attempts
  3219 	# to make the code below a bit more comprehensible
  3220 
  3221 	case $vinfo_number in
  3222 	yes)
  3223 	  number_major="$2"
  3224 	  number_minor="$3"
  3225 	  number_revision="$4"
  3226 	  #
  3227 	  # There are really only two kinds -- those that
  3228 	  # use the current revision as the major version
  3229 	  # and those that subtract age and use age as
  3230 	  # a minor version.  But, then there is irix
  3231 	  # which has an extra 1 added just for fun
  3232 	  #
  3233 	  case $version_type in
  3234 	  darwin|linux|osf|windows)
  3235 	    current=`expr $number_major + $number_minor`
  3236 	    age="$number_minor"
  3237 	    revision="$number_revision"
  3238 	    ;;
  3239 	  freebsd-aout|freebsd-elf|sunos)
  3240 	    current="$number_major"
  3241 	    revision="$number_minor"
  3242 	    age="0"
  3243 	    ;;
  3244 	  irix|nonstopux)
  3245 	    current=`expr $number_major + $number_minor - 1`
  3246 	    age="$number_minor"
  3247 	    revision="$number_minor"
  3248 	    ;;
  3249 	  esac
  3250 	  ;;
  3251 	no)
  3252 	  current="$2"
  3253 	  revision="$3"
  3254 	  age="$4"
  3255 	  ;;
  3256 	esac
  3257 
  3258 	# Check that each of the things are valid numbers.
  3259 	case $current in
  3260 	0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;;
  3261 	*)
  3262 	  $echo "$modename: CURRENT \`$current' must be a nonnegative integer" 1>&2
  3263 	  $echo "$modename: \`$vinfo' is not valid version information" 1>&2
  3264 	  exit $EXIT_FAILURE
  3265 	  ;;
  3266 	esac
  3267 
  3268 	case $revision in
  3269 	0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;;
  3270 	*)
  3271 	  $echo "$modename: REVISION \`$revision' must be a nonnegative integer" 1>&2
  3272 	  $echo "$modename: \`$vinfo' is not valid version information" 1>&2
  3273 	  exit $EXIT_FAILURE
  3274 	  ;;
  3275 	esac
  3276 
  3277 	case $age in
  3278 	0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;;
  3279 	*)
  3280 	  $echo "$modename: AGE \`$age' must be a nonnegative integer" 1>&2
  3281 	  $echo "$modename: \`$vinfo' is not valid version information" 1>&2
  3282 	  exit $EXIT_FAILURE
  3283 	  ;;
  3284 	esac
  3285 
  3286 	if test "$age" -gt "$current"; then
  3287 	  $echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2
  3288 	  $echo "$modename: \`$vinfo' is not valid version information" 1>&2
  3289 	  exit $EXIT_FAILURE
  3290 	fi
  3291 
  3292 	# Calculate the version variables.
  3293 	major=
  3294 	versuffix=
  3295 	verstring=
  3296 	case $version_type in
  3297 	none) ;;
  3298 
  3299 	darwin)
  3300 	  # Like Linux, but with the current version available in
  3301 	  # verstring for coding it into the library header
  3302 	  major=.`expr $current - $age`
  3303 	  versuffix="$major.$age.$revision"
  3304 	  # Darwin ld doesn't like 0 for these options...
  3305 	  minor_current=`expr $current + 1`
  3306 	  verstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision"
  3307 	  ;;
  3308 
  3309 	freebsd-aout)
  3310 	  major=".$current"
  3311 	  versuffix=".$current.$revision";
  3312 	  ;;
  3313 
  3314 	freebsd-elf)
  3315 	  major=".$current"
  3316 	  versuffix=".$current";
  3317 	  ;;
  3318 
  3319 	irix | nonstopux)
  3320 	  major=`expr $current - $age + 1`
  3321 
  3322 	  case $version_type in
  3323 	    nonstopux) verstring_prefix=nonstopux ;;
  3324 	    *)         verstring_prefix=sgi ;;
  3325 	  esac
  3326 	  verstring="$verstring_prefix$major.$revision"
  3327 
  3328 	  # Add in all the interfaces that we are compatible with.
  3329 	  loop=$revision
  3330 	  while test "$loop" -ne 0; do
  3331 	    iface=`expr $revision - $loop`
  3332 	    loop=`expr $loop - 1`
  3333 	    verstring="$verstring_prefix$major.$iface:$verstring"
  3334 	  done
  3335 
  3336 	  # Before this point, $major must not contain `.'.
  3337 	  major=.$major
  3338 	  versuffix="$major.$revision"
  3339 	  ;;
  3340 
  3341 	linux)
  3342 	  major=.`expr $current - $age`
  3343 	  versuffix="$major.$age.$revision"
  3344 	  ;;
  3345 
  3346 	osf)
  3347 	  major=.`expr $current - $age`
  3348 	  versuffix=".$current.$age.$revision"
  3349 	  verstring="$current.$age.$revision"
  3350 
  3351 	  # Add in all the interfaces that we are compatible with.
  3352 	  loop=$age
  3353 	  while test "$loop" -ne 0; do
  3354 	    iface=`expr $current - $loop`
  3355 	    loop=`expr $loop - 1`
  3356 	    verstring="$verstring:${iface}.0"
  3357 	  done
  3358 
  3359 	  # Make executables depend on our current version.
  3360 	  verstring="$verstring:${current}.0"
  3361 	  ;;
  3362 
  3363 	sunos)
  3364 	  major=".$current"
  3365 	  versuffix=".$current.$revision"
  3366 	  ;;
  3367 
  3368 	windows)
  3369 	  # Use '-' rather than '.', since we only want one
  3370 	  # extension on DOS 8.3 filesystems.
  3371 	  major=`expr $current - $age`
  3372 	  versuffix="-$major"
  3373 	  ;;
  3374 
  3375 	*)
  3376 	  $echo "$modename: unknown library version type \`$version_type'" 1>&2
  3377 	  $echo "Fatal configuration error.  See the $PACKAGE docs for more information." 1>&2
  3378 	  exit $EXIT_FAILURE
  3379 	  ;;
  3380 	esac
  3381 
  3382 	# Clear the version info if we defaulted, and they specified a release.
  3383 	if test -z "$vinfo" && test -n "$release"; then
  3384 	  major=
  3385 	  case $version_type in
  3386 	  darwin)
  3387 	    # we can't check for "0.0" in archive_cmds due to quoting
  3388 	    # problems, so we reset it completely
  3389 	    verstring=
  3390 	    ;;
  3391 	  *)
  3392 	    verstring="0.0"
  3393 	    ;;
  3394 	  esac
  3395 	  if test "$need_version" = no; then
  3396 	    versuffix=
  3397 	  else
  3398 	    versuffix=".0.0"
  3399 	  fi
  3400 	fi
  3401 
  3402 	# Remove version info from name if versioning should be avoided
  3403 	if test "$avoid_version" = yes && test "$need_version" = no; then
  3404 	  major=
  3405 	  versuffix=
  3406 	  verstring=""
  3407 	fi
  3408 
  3409 	# Check to see if the archive will have undefined symbols.
  3410 	if test "$allow_undefined" = yes; then
  3411 	  if test "$allow_undefined_flag" = unsupported; then
  3412 	    $echo "$modename: warning: undefined symbols not allowed in $host shared libraries" 1>&2
  3413 	    build_libtool_libs=no
  3414 	    build_old_libs=yes
  3415 	  fi
  3416 	else
  3417 	  # Don't allow undefined symbols.
  3418 	  allow_undefined_flag="$no_undefined_flag"
  3419 	fi
  3420       fi
  3421 
  3422       if test "$mode" != relink; then
  3423 	# Remove our outputs, but don't remove object files since they
  3424 	# may have been created when compiling PIC objects.
  3425 	removelist=
  3426 	tempremovelist=`$echo "$output_objdir/*"`
  3427 	for p in $tempremovelist; do
  3428 	  case $p in
  3429 	    *.$objext)
  3430 	       ;;
  3431 	    $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*)
  3432 	       if test "X$precious_files_regex" != "X"; then
  3433 	         if echo $p | $EGREP -e "$precious_files_regex" >/dev/null 2>&1
  3434 	         then
  3435 		   continue
  3436 		 fi
  3437 	       fi
  3438 	       removelist="$removelist $p"
  3439 	       ;;
  3440 	    *) ;;
  3441 	  esac
  3442 	done
  3443 	if test -n "$removelist"; then
  3444 	  $show "${rm}r $removelist"
  3445 	  $run ${rm}r $removelist
  3446 	fi
  3447       fi
  3448 
  3449       # Now set the variables for building old libraries.
  3450       if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then
  3451 	oldlibs="$oldlibs $output_objdir/$libname.$libext"
  3452 
  3453 	# Transform .lo files to .o files.
  3454 	oldobjs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP`
  3455       fi
  3456 
  3457       # Eliminate all temporary directories.
  3458       for path in $notinst_path; do
  3459 	lib_search_path=`$echo "$lib_search_path " | ${SED} -e "s% $path % %g"`
  3460 	deplibs=`$echo "$deplibs " | ${SED} -e "s% -L$path % %g"`
  3461 	dependency_libs=`$echo "$dependency_libs " | ${SED} -e "s% -L$path % %g"`
  3462       done
  3463 
  3464       if test -n "$xrpath"; then
  3465 	# If the user specified any rpath flags, then add them.
  3466 	temp_xrpath=
  3467 	for libdir in $xrpath; do
  3468 	  temp_xrpath="$temp_xrpath -R$libdir"
  3469 	  case "$finalize_rpath " in
  3470 	  *" $libdir "*) ;;
  3471 	  *) finalize_rpath="$finalize_rpath $libdir" ;;
  3472 	  esac
  3473 	done
  3474 	if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then
  3475 	  dependency_libs="$temp_xrpath $dependency_libs"
  3476 	fi
  3477       fi
  3478 
  3479       # Make sure dlfiles contains only unique files that won't be dlpreopened
  3480       old_dlfiles="$dlfiles"
  3481       dlfiles=
  3482       for lib in $old_dlfiles; do
  3483 	case " $dlprefiles $dlfiles " in
  3484 	*" $lib "*) ;;
  3485 	*) dlfiles="$dlfiles $lib" ;;
  3486 	esac
  3487       done
  3488 
  3489       # Make sure dlprefiles contains only unique files
  3490       old_dlprefiles="$dlprefiles"
  3491       dlprefiles=
  3492       for lib in $old_dlprefiles; do
  3493 	case "$dlprefiles " in
  3494 	*" $lib "*) ;;
  3495 	*) dlprefiles="$dlprefiles $lib" ;;
  3496 	esac
  3497       done
  3498 
  3499       if test "$build_libtool_libs" = yes; then
  3500 	if test -n "$rpath"; then
  3501 	  case $host in
  3502 	  *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos*)
  3503 	    # these systems don't actually have a c library (as such)!
  3504 	    ;;
  3505 	  *-*-rhapsody* | *-*-darwin1.[012])
  3506 	    # Rhapsody C library is in the System framework
  3507 	    deplibs="$deplibs -framework System"
  3508 	    ;;
  3509 	  *-*-netbsd*)
  3510 	    # Don't link with libc until the a.out ld.so is fixed.
  3511 	    ;;
  3512 	  *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
  3513 	    # Do not include libc due to us having libc/libc_r.
  3514 	    ;;
  3515 	  *-*-sco3.2v5* | *-*-sco5v6*)
  3516 	    # Causes problems with __ctype
  3517 	    ;;
  3518 	  *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
  3519 	    # Compiler inserts libc in the correct place for threads to work
  3520 	    ;;
  3521  	  *)
  3522 	    # Add libc to deplibs on all other systems if necessary.
  3523 	    if test "$build_libtool_need_lc" = "yes"; then
  3524 	      deplibs="$deplibs -lc"
  3525 	    fi
  3526 	    ;;
  3527 	  esac
  3528 	fi
  3529 
  3530 	# Transform deplibs into only deplibs that can be linked in shared.
  3531 	name_save=$name
  3532 	libname_save=$libname
  3533 	release_save=$release
  3534 	versuffix_save=$versuffix
  3535 	major_save=$major
  3536 	# I'm not sure if I'm treating the release correctly.  I think
  3537 	# release should show up in the -l (ie -lgmp5) so we don't want to
  3538 	# add it in twice.  Is that correct?
  3539 	release=""
  3540 	versuffix=""
  3541 	major=""
  3542 	newdeplibs=
  3543 	droppeddeps=no
  3544 	case $deplibs_check_method in
  3545 	pass_all)
  3546 	  # Don't check for shared/static.  Everything works.
  3547 	  # This might be a little naive.  We might want to check
  3548 	  # whether the library exists or not.  But this is on
  3549 	  # osf3 & osf4 and I'm not really sure... Just
  3550 	  # implementing what was already the behavior.
  3551 	  newdeplibs=$deplibs
  3552 	  ;;
  3553 	test_compile)
  3554 	  # This code stresses the "libraries are programs" paradigm to its
  3555 	  # limits. Maybe even breaks it.  We compile a program, linking it
  3556 	  # against the deplibs as a proxy for the library.  Then we can check
  3557 	  # whether they linked in statically or dynamically with ldd.
  3558 	  $rm conftest.c
  3559 	  cat > conftest.c <<EOF
  3560 	  int main() { return 0; }
  3561 EOF
  3562 	  $rm conftest
  3563 	  $LTCC $LTCFLAGS -o conftest conftest.c $deplibs
  3564 	  if test "$?" -eq 0 ; then
  3565 	    ldd_output=`ldd conftest`
  3566 	    for i in $deplibs; do
  3567 	      name=`expr $i : '-l\(.*\)'`
  3568 	      # If $name is empty we are operating on a -L argument.
  3569               if test "$name" != "" && test "$name" -ne "0"; then
  3570 		if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
  3571 		  case " $predeps $postdeps " in
  3572 		  *" $i "*)
  3573 		    newdeplibs="$newdeplibs $i"
  3574 		    i=""
  3575 		    ;;
  3576 		  esac
  3577 	        fi
  3578 		if test -n "$i" ; then
  3579 		  libname=`eval \\$echo \"$libname_spec\"`
  3580 		  deplib_matches=`eval \\$echo \"$library_names_spec\"`
  3581 		  set dummy $deplib_matches
  3582 		  deplib_match=$2
  3583 		  if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
  3584 		    newdeplibs="$newdeplibs $i"
  3585 		  else
  3586 		    droppeddeps=yes
  3587 		    $echo
  3588 		    $echo "*** Warning: dynamic linker does not accept needed library $i."
  3589 		    $echo "*** I have the capability to make that library automatically link in when"
  3590 		    $echo "*** you link to this library.  But I can only do this if you have a"
  3591 		    $echo "*** shared version of the library, which I believe you do not have"
  3592 		    $echo "*** because a test_compile did reveal that the linker did not use it for"
  3593 		    $echo "*** its dynamic dependency list that programs get resolved with at runtime."
  3594 		  fi
  3595 		fi
  3596 	      else
  3597 		newdeplibs="$newdeplibs $i"
  3598 	      fi
  3599 	    done
  3600 	  else
  3601 	    # Error occurred in the first compile.  Let's try to salvage
  3602 	    # the situation: Compile a separate program for each library.
  3603 	    for i in $deplibs; do
  3604 	      name=`expr $i : '-l\(.*\)'`
  3605 	      # If $name is empty we are operating on a -L argument.
  3606               if test "$name" != "" && test "$name" != "0"; then
  3607 		$rm conftest
  3608 		$LTCC $LTCFLAGS -o conftest conftest.c $i
  3609 		# Did it work?
  3610 		if test "$?" -eq 0 ; then
  3611 		  ldd_output=`ldd conftest`
  3612 		  if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
  3613 		    case " $predeps $postdeps " in
  3614 		    *" $i "*)
  3615 		      newdeplibs="$newdeplibs $i"
  3616 		      i=""
  3617 		      ;;
  3618 		    esac
  3619 		  fi
  3620 		  if test -n "$i" ; then
  3621 		    libname=`eval \\$echo \"$libname_spec\"`
  3622 		    deplib_matches=`eval \\$echo \"$library_names_spec\"`
  3623 		    set dummy $deplib_matches
  3624 		    deplib_match=$2
  3625 		    if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
  3626 		      newdeplibs="$newdeplibs $i"
  3627 		    else
  3628 		      droppeddeps=yes
  3629 		      $echo
  3630 		      $echo "*** Warning: dynamic linker does not accept needed library $i."
  3631 		      $echo "*** I have the capability to make that library automatically link in when"
  3632 		      $echo "*** you link to this library.  But I can only do this if you have a"
  3633 		      $echo "*** shared version of the library, which you do not appear to have"
  3634 		      $echo "*** because a test_compile did reveal that the linker did not use this one"
  3635 		      $echo "*** as a dynamic dependency that programs can get resolved with at runtime."
  3636 		    fi
  3637 		  fi
  3638 		else
  3639 		  droppeddeps=yes
  3640 		  $echo
  3641 		  $echo "*** Warning!  Library $i is needed by this library but I was not able to"
  3642 		  $echo "***  make it link in!  You will probably need to install it or some"
  3643 		  $echo "*** library that it depends on before this library will be fully"
  3644 		  $echo "*** functional.  Installing it before continuing would be even better."
  3645 		fi
  3646 	      else
  3647 		newdeplibs="$newdeplibs $i"
  3648 	      fi
  3649 	    done
  3650 	  fi
  3651 	  ;;
  3652 	file_magic*)
  3653 	  set dummy $deplibs_check_method
  3654 	  file_magic_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
  3655 	  for a_deplib in $deplibs; do
  3656 	    name=`expr $a_deplib : '-l\(.*\)'`
  3657 	    # If $name is empty we are operating on a -L argument.
  3658             if test "$name" != "" && test  "$name" != "0"; then
  3659 	      if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
  3660 		case " $predeps $postdeps " in
  3661 		*" $a_deplib "*)
  3662 		  newdeplibs="$newdeplibs $a_deplib"
  3663 		  a_deplib=""
  3664 		  ;;
  3665 		esac
  3666 	      fi
  3667 	      if test -n "$a_deplib" ; then
  3668 		libname=`eval \\$echo \"$libname_spec\"`
  3669 		for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
  3670 		  potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
  3671 		  for potent_lib in $potential_libs; do
  3672 		      # Follow soft links.
  3673 		      if ls -lLd "$potent_lib" 2>/dev/null \
  3674 			 | grep " -> " >/dev/null; then
  3675 			continue
  3676 		      fi
  3677 		      # The statement above tries to avoid entering an
  3678 		      # endless loop below, in case of cyclic links.
  3679 		      # We might still enter an endless loop, since a link
  3680 		      # loop can be closed while we follow links,
  3681 		      # but so what?
  3682 		      potlib="$potent_lib"
  3683 		      while test -h "$potlib" 2>/dev/null; do
  3684 			potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'`
  3685 			case $potliblink in
  3686 			[\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";;
  3687 			*) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";;
  3688 			esac
  3689 		      done
  3690 		      if eval $file_magic_cmd \"\$potlib\" 2>/dev/null \
  3691 			 | ${SED} 10q \
  3692 			 | $EGREP "$file_magic_regex" > /dev/null; then
  3693 			newdeplibs="$newdeplibs $a_deplib"
  3694 			a_deplib=""
  3695 			break 2
  3696 		      fi
  3697 		  done
  3698 		done
  3699 	      fi
  3700 	      if test -n "$a_deplib" ; then
  3701 		droppeddeps=yes
  3702 		$echo
  3703 		$echo "*** Warning: linker path does not have real file for library $a_deplib."
  3704 		$echo "*** I have the capability to make that library automatically link in when"
  3705 		$echo "*** you link to this library.  But I can only do this if you have a"
  3706 		$echo "*** shared version of the library, which you do not appear to have"
  3707 		$echo "*** because I did check the linker path looking for a file starting"
  3708 		if test -z "$potlib" ; then
  3709 		  $echo "*** with $libname but no candidates were found. (...for file magic test)"
  3710 		else
  3711 		  $echo "*** with $libname and none of the candidates passed a file format test"
  3712 		  $echo "*** using a file magic. Last file checked: $potlib"
  3713 		fi
  3714 	      fi
  3715 	    else
  3716 	      # Add a -L argument.
  3717 	      newdeplibs="$newdeplibs $a_deplib"
  3718 	    fi
  3719 	  done # Gone through all deplibs.
  3720 	  ;;
  3721 	match_pattern*)
  3722 	  set dummy $deplibs_check_method
  3723 	  match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
  3724 	  for a_deplib in $deplibs; do
  3725 	    name=`expr $a_deplib : '-l\(.*\)'`
  3726 	    # If $name is empty we are operating on a -L argument.
  3727 	    if test -n "$name" && test "$name" != "0"; then
  3728 	      if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
  3729 		case " $predeps $postdeps " in
  3730 		*" $a_deplib "*)
  3731 		  newdeplibs="$newdeplibs $a_deplib"
  3732 		  a_deplib=""
  3733 		  ;;
  3734 		esac
  3735 	      fi
  3736 	      if test -n "$a_deplib" ; then
  3737 		libname=`eval \\$echo \"$libname_spec\"`
  3738 		for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
  3739 		  potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
  3740 		  for potent_lib in $potential_libs; do
  3741 		    potlib="$potent_lib" # see symlink-check above in file_magic test
  3742 		    if eval $echo \"$potent_lib\" 2>/dev/null \
  3743 		        | ${SED} 10q \
  3744 		        | $EGREP "$match_pattern_regex" > /dev/null; then
  3745 		      newdeplibs="$newdeplibs $a_deplib"
  3746 		      a_deplib=""
  3747 		      break 2
  3748 		    fi
  3749 		  done
  3750 		done
  3751 	      fi
  3752 	      if test -n "$a_deplib" ; then
  3753 		droppeddeps=yes
  3754 		$echo
  3755 		$echo "*** Warning: linker path does not have real file for library $a_deplib."
  3756 		$echo "*** I have the capability to make that library automatically link in when"
  3757 		$echo "*** you link to this library.  But I can only do this if you have a"
  3758 		$echo "*** shared version of the library, which you do not appear to have"
  3759 		$echo "*** because I did check the linker path looking for a file starting"
  3760 		if test -z "$potlib" ; then
  3761 		  $echo "*** with $libname but no candidates were found. (...for regex pattern test)"
  3762 		else
  3763 		  $echo "*** with $libname and none of the candidates passed a file format test"
  3764 		  $echo "*** using a regex pattern. Last file checked: $potlib"
  3765 		fi
  3766 	      fi
  3767 	    else
  3768 	      # Add a -L argument.
  3769 	      newdeplibs="$newdeplibs $a_deplib"
  3770 	    fi
  3771 	  done # Gone through all deplibs.
  3772 	  ;;
  3773 	none | unknown | *)
  3774 	  newdeplibs=""
  3775 	  tmp_deplibs=`$echo "X $deplibs" | $Xsed -e 's/ -lc$//' \
  3776 	    -e 's/ -[LR][^ ]*//g'`
  3777 	  if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
  3778 	    for i in $predeps $postdeps ; do
  3779 	      # can't use Xsed below, because $i might contain '/'
  3780 	      tmp_deplibs=`$echo "X $tmp_deplibs" | ${SED} -e "1s,^X,," -e "s,$i,,"`
  3781 	    done
  3782 	  fi
  3783 	  if $echo "X $tmp_deplibs" | $Xsed -e 's/[ 	]//g' \
  3784 	    | grep . >/dev/null; then
  3785 	    $echo
  3786 	    if test "X$deplibs_check_method" = "Xnone"; then
  3787 	      $echo "*** Warning: inter-library dependencies are not supported in this platform."
  3788 	    else
  3789 	      $echo "*** Warning: inter-library dependencies are not known to be supported."
  3790 	    fi
  3791 	    $echo "*** All declared inter-library dependencies are being dropped."
  3792 	    droppeddeps=yes
  3793 	  fi
  3794 	  ;;
  3795 	esac
  3796 	versuffix=$versuffix_save
  3797 	major=$major_save
  3798 	release=$release_save
  3799 	libname=$libname_save
  3800 	name=$name_save
  3801 
  3802 	case $host in
  3803 	*-*-rhapsody* | *-*-darwin1.[012])
  3804 	  # On Rhapsody replace the C library is the System framework
  3805 	  newdeplibs=`$echo "X $newdeplibs" | $Xsed -e 's/ -lc / -framework System /'`
  3806 	  ;;
  3807 	esac
  3808 
  3809 	if test "$droppeddeps" = yes; then
  3810 	  if test "$module" = yes; then
  3811 	    $echo
  3812 	    $echo "*** Warning: libtool could not satisfy all declared inter-library"
  3813 	    $echo "*** dependencies of module $libname.  Therefore, libtool will create"
  3814 	    $echo "*** a static module, that should work as long as the dlopening"
  3815 	    $echo "*** application is linked with the -dlopen flag."
  3816 	    if test -z "$global_symbol_pipe"; then
  3817 	      $echo
  3818 	      $echo "*** However, this would only work if libtool was able to extract symbol"
  3819 	      $echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
  3820 	      $echo "*** not find such a program.  So, this module is probably useless."
  3821 	      $echo "*** \`nm' from GNU binutils and a full rebuild may help."
  3822 	    fi
  3823 	    if test "$build_old_libs" = no; then
  3824 	      oldlibs="$output_objdir/$libname.$libext"
  3825 	      build_libtool_libs=module
  3826 	      build_old_libs=yes
  3827 	    else
  3828 	      build_libtool_libs=no
  3829 	    fi
  3830 	  else
  3831 	    $echo "*** The inter-library dependencies that have been dropped here will be"
  3832 	    $echo "*** automatically added whenever a program is linked with this library"
  3833 	    $echo "*** or is declared to -dlopen it."
  3834 
  3835 	    if test "$allow_undefined" = no; then
  3836 	      $echo
  3837 	      $echo "*** Since this library must not contain undefined symbols,"
  3838 	      $echo "*** because either the platform does not support them or"
  3839 	      $echo "*** it was explicitly requested with -no-undefined,"
  3840 	      $echo "*** libtool will only create a static version of it."
  3841 	      if test "$build_old_libs" = no; then
  3842 		oldlibs="$output_objdir/$libname.$libext"
  3843 		build_libtool_libs=module
  3844 		build_old_libs=yes
  3845 	      else
  3846 		build_libtool_libs=no
  3847 	      fi
  3848 	    fi
  3849 	  fi
  3850 	fi
  3851 	# Time to change all our "foo.framework" stuff back to "-framework foo"
  3852 	case $host in
  3853 	  *-*-darwin*)
  3854 	    newdeplibs=`$echo "X $newdeplibs" | $Xsed -e 's% \([^ $]*\).framework% -framework \1%g'`
  3855 	    dependency_libs=`$echo "X $dependency_libs" | $Xsed -e 's% \([^ $]*\).framework%%g'`
  3856 	    ;;
  3857 	esac
  3858 	# Done checking deplibs!
  3859 	deplibs=$newdeplibs
  3860       fi
  3861 
  3862 
  3863       # move library search paths that coincide with paths to not yet
  3864       # installed libraries to the beginning of the library search list
  3865       new_libs=
  3866       for path in $notinst_path; do
  3867 	case " $new_libs " in
  3868 	*" -L$path/$objdir "*) ;;
  3869 	*)
  3870 	  case " $deplibs " in
  3871 	  *" -L$path/$objdir "*)
  3872 	    new_libs="$new_libs -L$path/$objdir" ;;
  3873 	  esac
  3874 	  ;;
  3875 	esac
  3876       done
  3877       for deplib in $deplibs; do
  3878 	case $deplib in
  3879 	-L*)
  3880 	  case " $new_libs " in
  3881 	  *" $deplib "*) ;;
  3882 	  *) new_libs="$new_libs $deplib" ;;
  3883 	  esac
  3884 	  ;;
  3885 	*) new_libs="$new_libs $deplib" ;;
  3886 	esac
  3887       done
  3888       deplibs="$new_libs"
  3889 
  3890 
  3891       # All the library-specific variables (install_libdir is set above).
  3892       library_names=
  3893       old_library=
  3894       dlname=
  3895 
  3896       # Test again, we may have decided not to build it any more
  3897       if test "$build_libtool_libs" = yes; then
  3898 	if test "$hardcode_into_libs" = yes; then
  3899 	  # Hardcode the library paths
  3900 	  hardcode_libdirs=
  3901 	  dep_rpath=
  3902 	  rpath="$finalize_rpath"
  3903 	  test "$mode" != relink && rpath="$compile_rpath$rpath"
  3904 	  for libdir in $rpath; do
  3905 	    if test -n "$hardcode_libdir_flag_spec"; then
  3906 	      if test -n "$hardcode_libdir_separator"; then
  3907 		if test -z "$hardcode_libdirs"; then
  3908 		  hardcode_libdirs="$libdir"
  3909 		else
  3910 		  # Just accumulate the unique libdirs.
  3911 		  case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
  3912 		  *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
  3913 		    ;;
  3914 		  *)
  3915 		    hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
  3916 		    ;;
  3917 		  esac
  3918 		fi
  3919 	      else
  3920 		eval flag=\"$hardcode_libdir_flag_spec\"
  3921 		dep_rpath="$dep_rpath $flag"
  3922 	      fi
  3923 	    elif test -n "$runpath_var"; then
  3924 	      case "$perm_rpath " in
  3925 	      *" $libdir "*) ;;
  3926 	      *) perm_rpath="$perm_rpath $libdir" ;;
  3927 	      esac
  3928 	    fi
  3929 	  done
  3930 	  # Substitute the hardcoded libdirs into the rpath.
  3931 	  if test -n "$hardcode_libdir_separator" &&
  3932 	     test -n "$hardcode_libdirs"; then
  3933 	    libdir="$hardcode_libdirs"
  3934 	    if test -n "$hardcode_libdir_flag_spec_ld"; then
  3935 	      eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\"
  3936 	    else
  3937 	      eval dep_rpath=\"$hardcode_libdir_flag_spec\"
  3938 	    fi
  3939 	  fi
  3940 	  if test -n "$runpath_var" && test -n "$perm_rpath"; then
  3941 	    # We should set the runpath_var.
  3942 	    rpath=
  3943 	    for dir in $perm_rpath; do
  3944 	      rpath="$rpath$dir:"
  3945 	    done
  3946 	    eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var"
  3947 	  fi
  3948 	  test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs"
  3949 	fi
  3950 
  3951 	shlibpath="$finalize_shlibpath"
  3952 	test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath"
  3953 	if test -n "$shlibpath"; then
  3954 	  eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var"
  3955 	fi
  3956 
  3957 	# Get the real and link names of the library.
  3958 	eval shared_ext=\"$shrext_cmds\"
  3959 	eval library_names=\"$library_names_spec\"
  3960 	set dummy $library_names
  3961 	realname="$2"
  3962 	shift; shift
  3963 
  3964 	if test -n "$soname_spec"; then
  3965 	  eval soname=\"$soname_spec\"
  3966 	else
  3967 	  soname="$realname"
  3968 	fi
  3969 	if test -z "$dlname"; then
  3970 	  dlname=$soname
  3971 	fi
  3972 
  3973 	lib="$output_objdir/$realname"
  3974 	linknames=
  3975 	for link
  3976 	do
  3977 	  linknames="$linknames $link"
  3978 	done
  3979 
  3980 	# Use standard objects if they are pic
  3981 	test -z "$pic_flag" && libobjs=`$echo "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
  3982 
  3983 	# Prepare the list of exported symbols
  3984 	if test -z "$export_symbols"; then
  3985 	  if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then
  3986 	    $show "generating symbol list for \`$libname.la'"
  3987 	    export_symbols="$output_objdir/$libname.exp"
  3988 	    $run $rm $export_symbols
  3989 	    cmds=$export_symbols_cmds
  3990 	    save_ifs="$IFS"; IFS='~'
  3991 	    for cmd in $cmds; do
  3992 	      IFS="$save_ifs"
  3993 	      eval cmd=\"$cmd\"
  3994 	      if len=`expr "X$cmd" : ".*"` &&
  3995 	       test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
  3996 	        $show "$cmd"
  3997 	        $run eval "$cmd" || exit $?
  3998 	        skipped_export=false
  3999 	      else
  4000 	        # The command line is too long to execute in one step.
  4001 	        $show "using reloadable object file for export list..."
  4002 	        skipped_export=:
  4003 		# Break out early, otherwise skipped_export may be
  4004 		# set to false by a later but shorter cmd.
  4005 		break
  4006 	      fi
  4007 	    done
  4008 	    IFS="$save_ifs"
  4009 	    if test -n "$export_symbols_regex"; then
  4010 	      $show "$EGREP -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\""
  4011 	      $run eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
  4012 	      $show "$mv \"${export_symbols}T\" \"$export_symbols\""
  4013 	      $run eval '$mv "${export_symbols}T" "$export_symbols"'
  4014 	    fi
  4015 	  fi
  4016 	fi
  4017 
  4018 	if test -n "$export_symbols" && test -n "$include_expsyms"; then
  4019 	  $run eval '$echo "X$include_expsyms" | $SP2NL >> "$export_symbols"'
  4020 	fi
  4021 
  4022 	tmp_deplibs=
  4023 	for test_deplib in $deplibs; do
  4024 		case " $convenience " in
  4025 		*" $test_deplib "*) ;;
  4026 		*)
  4027 			tmp_deplibs="$tmp_deplibs $test_deplib"
  4028 			;;
  4029 		esac
  4030 	done
  4031 	deplibs="$tmp_deplibs"
  4032 
  4033 	if test -n "$convenience"; then
  4034 	  if test -n "$whole_archive_flag_spec"; then
  4035 	    save_libobjs=$libobjs
  4036 	    eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
  4037 	  else
  4038 	    gentop="$output_objdir/${outputname}x"
  4039 	    generated="$generated $gentop"
  4040 
  4041 	    func_extract_archives $gentop $convenience
  4042 	    libobjs="$libobjs $func_extract_archives_result"
  4043 	  fi
  4044 	fi
  4045 	
  4046 	if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then
  4047 	  eval flag=\"$thread_safe_flag_spec\"
  4048 	  linker_flags="$linker_flags $flag"
  4049 	fi
  4050 
  4051 	# Make a backup of the uninstalled library when relinking
  4052 	if test "$mode" = relink; then
  4053 	  $run eval '(cd $output_objdir && $rm ${realname}U && $mv $realname ${realname}U)' || exit $?
  4054 	fi
  4055 
  4056 	# Do each of the archive commands.
  4057 	if test "$module" = yes && test -n "$module_cmds" ; then
  4058 	  if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
  4059 	    eval test_cmds=\"$module_expsym_cmds\"
  4060 	    cmds=$module_expsym_cmds
  4061 	  else
  4062 	    eval test_cmds=\"$module_cmds\"
  4063 	    cmds=$module_cmds
  4064 	  fi
  4065 	else
  4066 	if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
  4067 	  eval test_cmds=\"$archive_expsym_cmds\"
  4068 	  cmds=$archive_expsym_cmds
  4069 	else
  4070 	  eval test_cmds=\"$archive_cmds\"
  4071 	  cmds=$archive_cmds
  4072 	  fi
  4073 	fi
  4074 
  4075 	if test "X$skipped_export" != "X:" &&
  4076 	   len=`expr "X$test_cmds" : ".*" 2>/dev/null` &&
  4077 	   test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
  4078 	  :
  4079 	else
  4080 	  # The command line is too long to link in one step, link piecewise.
  4081 	  $echo "creating reloadable object files..."
  4082 
  4083 	  # Save the value of $output and $libobjs because we want to
  4084 	  # use them later.  If we have whole_archive_flag_spec, we
  4085 	  # want to use save_libobjs as it was before
  4086 	  # whole_archive_flag_spec was expanded, because we can't
  4087 	  # assume the linker understands whole_archive_flag_spec.
  4088 	  # This may have to be revisited, in case too many
  4089 	  # convenience libraries get linked in and end up exceeding
  4090 	  # the spec.
  4091 	  if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then
  4092 	    save_libobjs=$libobjs
  4093 	  fi
  4094 	  save_output=$output
  4095 	  output_la=`$echo "X$output" | $Xsed -e "$basename"`
  4096 
  4097 	  # Clear the reloadable object creation command queue and
  4098 	  # initialize k to one.
  4099 	  test_cmds=
  4100 	  concat_cmds=
  4101 	  objlist=
  4102 	  delfiles=
  4103 	  last_robj=
  4104 	  k=1
  4105 	  output=$output_objdir/$output_la-${k}.$objext
  4106 	  # Loop over the list of objects to be linked.
  4107 	  for obj in $save_libobjs
  4108 	  do
  4109 	    eval test_cmds=\"$reload_cmds $objlist $last_robj\"
  4110 	    if test "X$objlist" = X ||
  4111 	       { len=`expr "X$test_cmds" : ".*" 2>/dev/null` &&
  4112 		 test "$len" -le "$max_cmd_len"; }; then
  4113 	      objlist="$objlist $obj"
  4114 	    else
  4115 	      # The command $test_cmds is almost too long, add a
  4116 	      # command to the queue.
  4117 	      if test "$k" -eq 1 ; then
  4118 		# The first file doesn't have a previous command to add.
  4119 		eval concat_cmds=\"$reload_cmds $objlist $last_robj\"
  4120 	      else
  4121 		# All subsequent reloadable object files will link in
  4122 		# the last one created.
  4123 		eval concat_cmds=\"\$concat_cmds~$reload_cmds $objlist $last_robj\"
  4124 	      fi
  4125 	      last_robj=$output_objdir/$output_la-${k}.$objext
  4126 	      k=`expr $k + 1`
  4127 	      output=$output_objdir/$output_la-${k}.$objext
  4128 	      objlist=$obj
  4129 	      len=1
  4130 	    fi
  4131 	  done
  4132 	  # Handle the remaining objects by creating one last
  4133 	  # reloadable object file.  All subsequent reloadable object
  4134 	  # files will link in the last one created.
  4135 	  test -z "$concat_cmds" || concat_cmds=$concat_cmds~
  4136 	  eval concat_cmds=\"\${concat_cmds}$reload_cmds $objlist $last_robj\"
  4137 
  4138 	  if ${skipped_export-false}; then
  4139 	    $show "generating symbol list for \`$libname.la'"
  4140 	    export_symbols="$output_objdir/$libname.exp"
  4141 	    $run $rm $export_symbols
  4142 	    libobjs=$output
  4143 	    # Append the command to create the export file.
  4144 	    eval concat_cmds=\"\$concat_cmds~$export_symbols_cmds\"
  4145           fi
  4146 
  4147 	  # Set up a command to remove the reloadable object files
  4148 	  # after they are used.
  4149 	  i=0
  4150 	  while test "$i" -lt "$k"
  4151 	  do
  4152 	    i=`expr $i + 1`
  4153 	    delfiles="$delfiles $output_objdir/$output_la-${i}.$objext"
  4154 	  done
  4155 
  4156 	  $echo "creating a temporary reloadable object file: $output"
  4157 
  4158 	  # Loop through the commands generated above and execute them.
  4159 	  save_ifs="$IFS"; IFS='~'
  4160 	  for cmd in $concat_cmds; do
  4161 	    IFS="$save_ifs"
  4162 	    $show "$cmd"
  4163 	    $run eval "$cmd" || exit $?
  4164 	  done
  4165 	  IFS="$save_ifs"
  4166 
  4167 	  libobjs=$output
  4168 	  # Restore the value of output.
  4169 	  output=$save_output
  4170 
  4171 	  if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then
  4172 	    eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
  4173 	  fi
  4174 	  # Expand the library linking commands again to reset the
  4175 	  # value of $libobjs for piecewise linking.
  4176 
  4177 	  # Do each of the archive commands.
  4178 	  if test "$module" = yes && test -n "$module_cmds" ; then
  4179 	    if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
  4180 	      cmds=$module_expsym_cmds
  4181 	    else
  4182 	      cmds=$module_cmds
  4183 	    fi
  4184 	  else
  4185 	  if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
  4186 	    cmds=$archive_expsym_cmds
  4187 	  else
  4188 	    cmds=$archive_cmds
  4189 	    fi
  4190 	  fi
  4191 
  4192 	  # Append the command to remove the reloadable object files
  4193 	  # to the just-reset $cmds.
  4194 	  eval cmds=\"\$cmds~\$rm $delfiles\"
  4195 	fi
  4196 	save_ifs="$IFS"; IFS='~'
  4197 	for cmd in $cmds; do
  4198 	  IFS="$save_ifs"
  4199 	  eval cmd=\"$cmd\"
  4200 	  $show "$cmd"
  4201 	  $run eval "$cmd" || {
  4202 	    lt_exit=$?
  4203 
  4204 	    # Restore the uninstalled library and exit
  4205 	    if test "$mode" = relink; then
  4206 	      $run eval '(cd $output_objdir && $rm ${realname}T && $mv ${realname}U $realname)'
  4207 	    fi
  4208 
  4209 	    exit $lt_exit
  4210 	  }
  4211 	done
  4212 	IFS="$save_ifs"
  4213 
  4214 	# Restore the uninstalled library and exit
  4215 	if test "$mode" = relink; then
  4216 	  $run eval '(cd $output_objdir && $rm ${realname}T && $mv $realname ${realname}T && $mv "$realname"U $realname)' || exit $?
  4217 
  4218 	  if test -n "$convenience"; then
  4219 	    if test -z "$whole_archive_flag_spec"; then
  4220 	      $show "${rm}r $gentop"
  4221 	      $run ${rm}r "$gentop"
  4222 	    fi
  4223 	  fi
  4224 
  4225 	  exit $EXIT_SUCCESS
  4226 	fi
  4227 
  4228 	# Create links to the real library.
  4229 	for linkname in $linknames; do
  4230 	  if test "$realname" != "$linkname"; then
  4231 	    $show "(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)"
  4232 	    $run eval '(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)' || exit $?
  4233 	  fi
  4234 	done
  4235 
  4236 	# If -module or -export-dynamic was specified, set the dlname.
  4237 	if test "$module" = yes || test "$export_dynamic" = yes; then
  4238 	  # On all known operating systems, these are identical.
  4239 	  dlname="$soname"
  4240 	fi
  4241       fi
  4242       ;;
  4243 
  4244     obj)
  4245       if test -n "$deplibs"; then
  4246 	$echo "$modename: warning: \`-l' and \`-L' are ignored for objects" 1>&2
  4247       fi
  4248 
  4249       if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
  4250 	$echo "$modename: warning: \`-dlopen' is ignored for objects" 1>&2
  4251       fi
  4252 
  4253       if test -n "$rpath"; then
  4254 	$echo "$modename: warning: \`-rpath' is ignored for objects" 1>&2
  4255       fi
  4256 
  4257       if test -n "$xrpath"; then
  4258 	$echo "$modename: warning: \`-R' is ignored for objects" 1>&2
  4259       fi
  4260 
  4261       if test -n "$vinfo"; then
  4262 	$echo "$modename: warning: \`-version-info' is ignored for objects" 1>&2
  4263       fi
  4264 
  4265       if test -n "$release"; then
  4266 	$echo "$modename: warning: \`-release' is ignored for objects" 1>&2
  4267       fi
  4268 
  4269       case $output in
  4270       *.lo)
  4271 	if test -n "$objs$old_deplibs"; then
  4272 	  $echo "$modename: cannot build library object \`$output' from non-libtool objects" 1>&2
  4273 	  exit $EXIT_FAILURE
  4274 	fi
  4275 	libobj="$output"
  4276 	obj=`$echo "X$output" | $Xsed -e "$lo2o"`
  4277 	;;
  4278       *)
  4279 	libobj=
  4280 	obj="$output"
  4281 	;;
  4282       esac
  4283 
  4284       # Delete the old objects.
  4285       $run $rm $obj $libobj
  4286 
  4287       # Objects from convenience libraries.  This assumes
  4288       # single-version convenience libraries.  Whenever we create
  4289       # different ones for PIC/non-PIC, this we'll have to duplicate
  4290       # the extraction.
  4291       reload_conv_objs=
  4292       gentop=
  4293       # reload_cmds runs $LD directly, so let us get rid of
  4294       # -Wl from whole_archive_flag_spec
  4295       wl=
  4296 
  4297       if test -n "$convenience"; then
  4298 	if test -n "$whole_archive_flag_spec"; then
  4299 	  eval reload_conv_objs=\"\$reload_objs $whole_archive_flag_spec\"
  4300 	else
  4301 	  gentop="$output_objdir/${obj}x"
  4302 	  generated="$generated $gentop"
  4303 
  4304 	  func_extract_archives $gentop $convenience
  4305 	  reload_conv_objs="$reload_objs $func_extract_archives_result"
  4306 	fi
  4307       fi
  4308 
  4309       # Create the old-style object.
  4310       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
  4311 
  4312       output="$obj"
  4313       cmds=$reload_cmds
  4314       save_ifs="$IFS"; IFS='~'
  4315       for cmd in $cmds; do
  4316 	IFS="$save_ifs"
  4317 	eval cmd=\"$cmd\"
  4318 	$show "$cmd"
  4319 	$run eval "$cmd" || exit $?
  4320       done
  4321       IFS="$save_ifs"
  4322 
  4323       # Exit if we aren't doing a library object file.
  4324       if test -z "$libobj"; then
  4325 	if test -n "$gentop"; then
  4326 	  $show "${rm}r $gentop"
  4327 	  $run ${rm}r $gentop
  4328 	fi
  4329 
  4330 	exit $EXIT_SUCCESS
  4331       fi
  4332 
  4333       if test "$build_libtool_libs" != yes; then
  4334 	if test -n "$gentop"; then
  4335 	  $show "${rm}r $gentop"
  4336 	  $run ${rm}r $gentop
  4337 	fi
  4338 
  4339 	# Create an invalid libtool object if no PIC, so that we don't
  4340 	# accidentally link it into a program.
  4341 	# $show "echo timestamp > $libobj"
  4342 	# $run eval "echo timestamp > $libobj" || exit $?
  4343 	exit $EXIT_SUCCESS
  4344       fi
  4345 
  4346       if test -n "$pic_flag" || test "$pic_mode" != default; then
  4347 	# Only do commands if we really have different PIC objects.
  4348 	reload_objs="$libobjs $reload_conv_objs"
  4349 	output="$libobj"
  4350 	cmds=$reload_cmds
  4351 	save_ifs="$IFS"; IFS='~'
  4352 	for cmd in $cmds; do
  4353 	  IFS="$save_ifs"
  4354 	  eval cmd=\"$cmd\"
  4355 	  $show "$cmd"
  4356 	  $run eval "$cmd" || exit $?
  4357 	done
  4358 	IFS="$save_ifs"
  4359       fi
  4360 
  4361       if test -n "$gentop"; then
  4362 	$show "${rm}r $gentop"
  4363 	$run ${rm}r $gentop
  4364       fi
  4365 
  4366       exit $EXIT_SUCCESS
  4367       ;;
  4368 
  4369     prog)
  4370       case $host in
  4371 	*cygwin*) output=`$echo $output | ${SED} -e 's,.exe$,,;s,$,.exe,'` ;;
  4372       esac
  4373       if test -n "$vinfo"; then
  4374 	$echo "$modename: warning: \`-version-info' is ignored for programs" 1>&2
  4375       fi
  4376 
  4377       if test -n "$release"; then
  4378 	$echo "$modename: warning: \`-release' is ignored for programs" 1>&2
  4379       fi
  4380 
  4381       if test "$preload" = yes; then
  4382 	if test "$dlopen_support" = unknown && test "$dlopen_self" = unknown &&
  4383 	   test "$dlopen_self_static" = unknown; then
  4384 	  $echo "$modename: warning: \`AC_LIBTOOL_DLOPEN' not used. Assuming no dlopen support."
  4385 	fi
  4386       fi
  4387 
  4388       case $host in
  4389       *-*-rhapsody* | *-*-darwin1.[012])
  4390 	# On Rhapsody replace the C library is the System framework
  4391 	compile_deplibs=`$echo "X $compile_deplibs" | $Xsed -e 's/ -lc / -framework System /'`
  4392 	finalize_deplibs=`$echo "X $finalize_deplibs" | $Xsed -e 's/ -lc / -framework System /'`
  4393 	;;
  4394       esac
  4395 
  4396       case $host in
  4397       *-*-darwin*)
  4398         # Don't allow lazy linking, it breaks C++ global constructors
  4399         if test "$tagname" = CXX ; then
  4400         compile_command="$compile_command ${wl}-bind_at_load"
  4401         finalize_command="$finalize_command ${wl}-bind_at_load"
  4402         fi
  4403 	# Time to change all our "foo.framework" stuff back to "-framework foo"
  4404 	compile_deplibs=`$echo "X $compile_deplibs" | $Xsed -e 's% \([^ $]*\).framework% -framework \1%g'`
  4405 	finalize_deplibs=`$echo "X $finalize_deplibs" | $Xsed -e 's% \([^ $]*\).framework% -framework \1%g'`
  4406         ;;
  4407       esac
  4408 
  4409 
  4410       # move library search paths that coincide with paths to not yet
  4411       # installed libraries to the beginning of the library search list
  4412       new_libs=
  4413       for path in $notinst_path; do
  4414 	case " $new_libs " in
  4415 	*" -L$path/$objdir "*) ;;
  4416 	*)
  4417 	  case " $compile_deplibs " in
  4418 	  *" -L$path/$objdir "*)
  4419 	    new_libs="$new_libs -L$path/$objdir" ;;
  4420 	  esac
  4421 	  ;;
  4422 	esac
  4423       done
  4424       for deplib in $compile_deplibs; do
  4425 	case $deplib in
  4426 	-L*)
  4427 	  case " $new_libs " in
  4428 	  *" $deplib "*) ;;
  4429 	  *) new_libs="$new_libs $deplib" ;;
  4430 	  esac
  4431 	  ;;
  4432 	*) new_libs="$new_libs $deplib" ;;
  4433 	esac
  4434       done
  4435       compile_deplibs="$new_libs"
  4436 
  4437 
  4438       compile_command="$compile_command $compile_deplibs"
  4439       finalize_command="$finalize_command $finalize_deplibs"
  4440 
  4441       if test -n "$rpath$xrpath"; then
  4442 	# If the user specified any rpath flags, then add them.
  4443 	for libdir in $rpath $xrpath; do
  4444 	  # This is the magic to use -rpath.
  4445 	  case "$finalize_rpath " in
  4446 	  *" $libdir "*) ;;
  4447 	  *) finalize_rpath="$finalize_rpath $libdir" ;;
  4448 	  esac
  4449 	done
  4450       fi
  4451 
  4452       # Now hardcode the library paths
  4453       rpath=
  4454       hardcode_libdirs=
  4455       for libdir in $compile_rpath $finalize_rpath; do
  4456 	if test -n "$hardcode_libdir_flag_spec"; then
  4457 	  if test -n "$hardcode_libdir_separator"; then
  4458 	    if test -z "$hardcode_libdirs"; then
  4459 	      hardcode_libdirs="$libdir"
  4460 	    else
  4461 	      # Just accumulate the unique libdirs.
  4462 	      case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
  4463 	      *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
  4464 		;;
  4465 	      *)
  4466 		hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
  4467 		;;
  4468 	      esac
  4469 	    fi
  4470 	  else
  4471 	    eval flag=\"$hardcode_libdir_flag_spec\"
  4472 	    rpath="$rpath $flag"
  4473 	  fi
  4474 	elif test -n "$runpath_var"; then
  4475 	  case "$perm_rpath " in
  4476 	  *" $libdir "*) ;;
  4477 	  *) perm_rpath="$perm_rpath $libdir" ;;
  4478 	  esac
  4479 	fi
  4480 	case $host in
  4481 	*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
  4482 	  testbindir=`$echo "X$libdir" | $Xsed -e 's*/lib$*/bin*'`
  4483 	  case :$dllsearchpath: in
  4484 	  *":$libdir:"*) ;;
  4485 	  *) dllsearchpath="$dllsearchpath:$libdir";;
  4486 	  esac
  4487 	  case :$dllsearchpath: in
  4488 	  *":$testbindir:"*) ;;
  4489 	  *) dllsearchpath="$dllsearchpath:$testbindir";;
  4490 	  esac
  4491 	  ;;
  4492 	esac
  4493       done
  4494       # Substitute the hardcoded libdirs into the rpath.
  4495       if test -n "$hardcode_libdir_separator" &&
  4496 	 test -n "$hardcode_libdirs"; then
  4497 	libdir="$hardcode_libdirs"
  4498 	eval rpath=\" $hardcode_libdir_flag_spec\"
  4499       fi
  4500       compile_rpath="$rpath"
  4501 
  4502       rpath=
  4503       hardcode_libdirs=
  4504       for libdir in $finalize_rpath; do
  4505 	if test -n "$hardcode_libdir_flag_spec"; then
  4506 	  if test -n "$hardcode_libdir_separator"; then
  4507 	    if test -z "$hardcode_libdirs"; then
  4508 	      hardcode_libdirs="$libdir"
  4509 	    else
  4510 	      # Just accumulate the unique libdirs.
  4511 	      case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
  4512 	      *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
  4513 		;;
  4514 	      *)
  4515 		hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
  4516 		;;
  4517 	      esac
  4518 	    fi
  4519 	  else
  4520 	    eval flag=\"$hardcode_libdir_flag_spec\"
  4521 	    rpath="$rpath $flag"
  4522 	  fi
  4523 	elif test -n "$runpath_var"; then
  4524 	  case "$finalize_perm_rpath " in
  4525 	  *" $libdir "*) ;;
  4526 	  *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;;
  4527 	  esac
  4528 	fi
  4529       done
  4530       # Substitute the hardcoded libdirs into the rpath.
  4531       if test -n "$hardcode_libdir_separator" &&
  4532 	 test -n "$hardcode_libdirs"; then
  4533 	libdir="$hardcode_libdirs"
  4534 	eval rpath=\" $hardcode_libdir_flag_spec\"
  4535       fi
  4536       finalize_rpath="$rpath"
  4537 
  4538       if test -n "$libobjs" && test "$build_old_libs" = yes; then
  4539 	# Transform all the library objects into standard objects.
  4540 	compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
  4541 	finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
  4542       fi
  4543 
  4544       dlsyms=
  4545       if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
  4546 	if test -n "$NM" && test -n "$global_symbol_pipe"; then
  4547 	  dlsyms="${outputname}S.c"
  4548 	else
  4549 	  $echo "$modename: not configured to extract global symbols from dlpreopened files" 1>&2
  4550 	fi
  4551       fi
  4552 
  4553       if test -n "$dlsyms"; then
  4554 	case $dlsyms in
  4555 	"") ;;
  4556 	*.c)
  4557 	  # Discover the nlist of each of the dlfiles.
  4558 	  nlist="$output_objdir/${outputname}.nm"
  4559 
  4560 	  $show "$rm $nlist ${nlist}S ${nlist}T"
  4561 	  $run $rm "$nlist" "${nlist}S" "${nlist}T"
  4562 
  4563 	  # Parse the name list into a source file.
  4564 	  $show "creating $output_objdir/$dlsyms"
  4565 
  4566 	  test -z "$run" && $echo > "$output_objdir/$dlsyms" "\
  4567 /* $dlsyms - symbol resolution table for \`$outputname' dlsym emulation. */
  4568 /* Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP */
  4569 
  4570 #ifdef __cplusplus
  4571 extern \"C\" {
  4572 #endif
  4573 
  4574 /* Prevent the only kind of declaration conflicts we can make. */
  4575 #define lt_preloaded_symbols some_other_symbol
  4576 
  4577 /* External symbol declarations for the compiler. */\
  4578 "
  4579 
  4580 	  if test "$dlself" = yes; then
  4581 	    $show "generating symbol list for \`$output'"
  4582 
  4583 	    test -z "$run" && $echo ': @PROGRAM@ ' > "$nlist"
  4584 
  4585 	    # Add our own program objects to the symbol list.
  4586 	    progfiles=`$echo "X$objs$old_deplibs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
  4587 	    for arg in $progfiles; do
  4588 	      $show "extracting global C symbols from \`$arg'"
  4589 	      $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
  4590 	    done
  4591 
  4592 	    if test -n "$exclude_expsyms"; then
  4593 	      $run eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
  4594 	      $run eval '$mv "$nlist"T "$nlist"'
  4595 	    fi
  4596 
  4597 	    if test -n "$export_symbols_regex"; then
  4598 	      $run eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T'
  4599 	      $run eval '$mv "$nlist"T "$nlist"'
  4600 	    fi
  4601 
  4602 	    # Prepare the list of exported symbols
  4603 	    if test -z "$export_symbols"; then
  4604 	      export_symbols="$output_objdir/$outputname.exp"
  4605 	      $run $rm $export_symbols
  4606 	      $run eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
  4607               case $host in
  4608               *cygwin* | *mingw* )
  4609 	        $run eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
  4610 		$run eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"'
  4611                 ;;
  4612               esac
  4613 	    else
  4614 	      $run eval "${SED} -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"'
  4615 	      $run eval 'grep -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T'
  4616 	      $run eval 'mv "$nlist"T "$nlist"'
  4617               case $host in
  4618               *cygwin* | *mingw* )
  4619 	        $run eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
  4620 		$run eval 'cat "$nlist" >> "$output_objdir/$outputname.def"'
  4621                 ;;
  4622               esac
  4623 	    fi
  4624 	  fi
  4625 
  4626 	  for arg in $dlprefiles; do
  4627 	    $show "extracting global C symbols from \`$arg'"
  4628 	    name=`$echo "$arg" | ${SED} -e 's%^.*/%%'`
  4629 	    $run eval '$echo ": $name " >> "$nlist"'
  4630 	    $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
  4631 	  done
  4632 
  4633 	  if test -z "$run"; then
  4634 	    # Make sure we have at least an empty file.
  4635 	    test -f "$nlist" || : > "$nlist"
  4636 
  4637 	    if test -n "$exclude_expsyms"; then
  4638 	      $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T
  4639 	      $mv "$nlist"T "$nlist"
  4640 	    fi
  4641 
  4642 	    # Try sorting and uniquifying the output.
  4643 	    if grep -v "^: " < "$nlist" |
  4644 		if sort -k 3 </dev/null >/dev/null 2>&1; then
  4645 		  sort -k 3
  4646 		else
  4647 		  sort +2
  4648 		fi |
  4649 		uniq > "$nlist"S; then
  4650 	      :
  4651 	    else
  4652 	      grep -v "^: " < "$nlist" > "$nlist"S
  4653 	    fi
  4654 
  4655 	    if test -f "$nlist"S; then
  4656 	      eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$dlsyms"'
  4657 	    else
  4658 	      $echo '/* NONE */' >> "$output_objdir/$dlsyms"
  4659 	    fi
  4660 
  4661 	    $echo >> "$output_objdir/$dlsyms" "\
  4662 
  4663 #undef lt_preloaded_symbols
  4664 
  4665 #if defined (__STDC__) && __STDC__
  4666 # define lt_ptr void *
  4667 #else
  4668 # define lt_ptr char *
  4669 # define const
  4670 #endif
  4671 
  4672 /* The mapping between symbol names and symbols. */
  4673 "
  4674 
  4675 	    case $host in
  4676 	    *cygwin* | *mingw* )
  4677 	  $echo >> "$output_objdir/$dlsyms" "\
  4678 /* DATA imports from DLLs on WIN32 can't be const, because
  4679    runtime relocations are performed -- see ld's documentation
  4680    on pseudo-relocs */
  4681 struct {
  4682 "
  4683 	      ;;
  4684 	    * )
  4685 	  $echo >> "$output_objdir/$dlsyms" "\
  4686 const struct {
  4687 "
  4688 	      ;;
  4689 	    esac
  4690 
  4691 
  4692 	  $echo >> "$output_objdir/$dlsyms" "\
  4693   const char *name;
  4694   lt_ptr address;
  4695 }
  4696 lt_preloaded_symbols[] =
  4697 {\
  4698 "
  4699 
  4700 	    eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$dlsyms"
  4701 
  4702 	    $echo >> "$output_objdir/$dlsyms" "\
  4703   {0, (lt_ptr) 0}
  4704 };
  4705 
  4706 /* This works around a problem in FreeBSD linker */
  4707 #ifdef FREEBSD_WORKAROUND
  4708 static const void *lt_preloaded_setup() {
  4709   return lt_preloaded_symbols;
  4710 }
  4711 #endif
  4712 
  4713 #ifdef __cplusplus
  4714 }
  4715 #endif\
  4716 "
  4717 	  fi
  4718 
  4719 	  pic_flag_for_symtable=
  4720 	  case $host in
  4721 	  # compiling the symbol table file with pic_flag works around
  4722 	  # a FreeBSD bug that causes programs to crash when -lm is
  4723 	  # linked before any other PIC object.  But we must not use
  4724 	  # pic_flag when linking with -static.  The problem exists in
  4725 	  # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1.
  4726 	  *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)
  4727 	    case "$compile_command " in
  4728 	    *" -static "*) ;;
  4729 	    *) pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND";;
  4730 	    esac;;
  4731 	  *-*-hpux*)
  4732 	    case "$compile_command " in
  4733 	    *" -static "*) ;;
  4734 	    *) pic_flag_for_symtable=" $pic_flag";;
  4735 	    esac
  4736 	  esac
  4737 
  4738 	  # Now compile the dynamic symbol file.
  4739 	  $show "(cd $output_objdir && $LTCC  $LTCFLAGS -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")"
  4740 	  $run eval '(cd $output_objdir && $LTCC  $LTCFLAGS -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $?
  4741 
  4742 	  # Clean up the generated files.
  4743 	  $show "$rm $output_objdir/$dlsyms $nlist ${nlist}S ${nlist}T"
  4744 	  $run $rm "$output_objdir/$dlsyms" "$nlist" "${nlist}S" "${nlist}T"
  4745 
  4746 	  # Transform the symbol file into the correct name.
  4747           case $host in
  4748           *cygwin* | *mingw* )
  4749             if test -f "$output_objdir/${outputname}.def" ; then
  4750               compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}.def $output_objdir/${outputname}S.${objext}%"`
  4751               finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}.def $output_objdir/${outputname}S.${objext}%"`
  4752             else
  4753               compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
  4754               finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
  4755              fi
  4756             ;;
  4757           * )
  4758             compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
  4759             finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
  4760             ;;
  4761           esac
  4762 	  ;;
  4763 	*)
  4764 	  $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2
  4765 	  exit $EXIT_FAILURE
  4766 	  ;;
  4767 	esac
  4768       else
  4769 	# We keep going just in case the user didn't refer to
  4770 	# lt_preloaded_symbols.  The linker will fail if global_symbol_pipe
  4771 	# really was required.
  4772 
  4773 	# Nullify the symbol file.
  4774 	compile_command=`$echo "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"`
  4775 	finalize_command=`$echo "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"`
  4776       fi
  4777 
  4778       if test "$need_relink" = no || test "$build_libtool_libs" != yes; then
  4779 	# Replace the output file specification.
  4780 	compile_command=`$echo "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
  4781 	link_command="$compile_command$compile_rpath"
  4782 
  4783 	# We have no uninstalled library dependencies, so finalize right now.
  4784 	$show "$link_command"
  4785 	$run eval "$link_command"
  4786 	exit_status=$?
  4787 
  4788 	# Delete the generated files.
  4789 	if test -n "$dlsyms"; then
  4790 	  $show "$rm $output_objdir/${outputname}S.${objext}"
  4791 	  $run $rm "$output_objdir/${outputname}S.${objext}"
  4792 	fi
  4793 
  4794 	exit $exit_status
  4795       fi
  4796 
  4797       if test -n "$shlibpath_var"; then
  4798 	# We should set the shlibpath_var
  4799 	rpath=
  4800 	for dir in $temp_rpath; do
  4801 	  case $dir in
  4802 	  [\\/]* | [A-Za-z]:[\\/]*)
  4803 	    # Absolute path.
  4804 	    rpath="$rpath$dir:"
  4805 	    ;;
  4806 	  *)
  4807 	    # Relative path: add a thisdir entry.
  4808 	    rpath="$rpath\$thisdir/$dir:"
  4809 	    ;;
  4810 	  esac
  4811 	done
  4812 	temp_rpath="$rpath"
  4813       fi
  4814 
  4815       if test -n "$compile_shlibpath$finalize_shlibpath"; then
  4816 	compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command"
  4817       fi
  4818       if test -n "$finalize_shlibpath"; then
  4819 	finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command"
  4820       fi
  4821 
  4822       compile_var=
  4823       finalize_var=
  4824       if test -n "$runpath_var"; then
  4825 	if test -n "$perm_rpath"; then
  4826 	  # We should set the runpath_var.
  4827 	  rpath=
  4828 	  for dir in $perm_rpath; do
  4829 	    rpath="$rpath$dir:"
  4830 	  done
  4831 	  compile_var="$runpath_var=\"$rpath\$$runpath_var\" "
  4832 	fi
  4833 	if test -n "$finalize_perm_rpath"; then
  4834 	  # We should set the runpath_var.
  4835 	  rpath=
  4836 	  for dir in $finalize_perm_rpath; do
  4837 	    rpath="$rpath$dir:"
  4838 	  done
  4839 	  finalize_var="$runpath_var=\"$rpath\$$runpath_var\" "
  4840 	fi
  4841       fi
  4842 
  4843       if test "$no_install" = yes; then
  4844 	# We don't need to create a wrapper script.
  4845 	link_command="$compile_var$compile_command$compile_rpath"
  4846 	# Replace the output file specification.
  4847 	link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
  4848 	# Delete the old output file.
  4849 	$run $rm $output
  4850 	# Link the executable and exit
  4851 	$show "$link_command"
  4852 	$run eval "$link_command" || exit $?
  4853 	exit $EXIT_SUCCESS
  4854       fi
  4855 
  4856       if test "$hardcode_action" = relink; then
  4857 	# Fast installation is not supported
  4858 	link_command="$compile_var$compile_command$compile_rpath"
  4859 	relink_command="$finalize_var$finalize_command$finalize_rpath"
  4860 
  4861 	$echo "$modename: warning: this platform does not like uninstalled shared libraries" 1>&2
  4862 	$echo "$modename: \`$output' will be relinked during installation" 1>&2
  4863       else
  4864 	if test "$fast_install" != no; then
  4865 	  link_command="$finalize_var$compile_command$finalize_rpath"
  4866 	  if test "$fast_install" = yes; then
  4867 	    relink_command=`$echo "X$compile_var$compile_command$compile_rpath" | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g'`
  4868 	  else
  4869 	    # fast_install is set to needless
  4870 	    relink_command=
  4871 	  fi
  4872 	else
  4873 	  link_command="$compile_var$compile_command$compile_rpath"
  4874 	  relink_command="$finalize_var$finalize_command$finalize_rpath"
  4875 	fi
  4876       fi
  4877 
  4878       # Replace the output file specification.
  4879       link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`
  4880 
  4881       # Delete the old output files.
  4882       $run $rm $output $output_objdir/$outputname $output_objdir/lt-$outputname
  4883 
  4884       $show "$link_command"
  4885       $run eval "$link_command" || exit $?
  4886 
  4887       # Now create the wrapper script.
  4888       $show "creating $output"
  4889 
  4890       # Quote the relink command for shipping.
  4891       if test -n "$relink_command"; then
  4892 	# Preserve any variables that may affect compiler behavior
  4893 	for var in $variables_saved_for_relink; do
  4894 	  if eval test -z \"\${$var+set}\"; then
  4895 	    relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command"
  4896 	  elif eval var_value=\$$var; test -z "$var_value"; then
  4897 	    relink_command="$var=; export $var; $relink_command"
  4898 	  else
  4899 	    var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"`
  4900 	    relink_command="$var=\"$var_value\"; export $var; $relink_command"
  4901 	  fi
  4902 	done
  4903 	relink_command="(cd `pwd`; $relink_command)"
  4904 	relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"`
  4905       fi
  4906 
  4907       # Quote $echo for shipping.
  4908       if test "X$echo" = "X$SHELL $progpath --fallback-echo"; then
  4909 	case $progpath in
  4910 	[\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $progpath --fallback-echo";;
  4911 	*) qecho="$SHELL `pwd`/$progpath --fallback-echo";;
  4912 	esac
  4913 	qecho=`$echo "X$qecho" | $Xsed -e "$sed_quote_subst"`
  4914       else
  4915 	qecho=`$echo "X$echo" | $Xsed -e "$sed_quote_subst"`
  4916       fi
  4917 
  4918       # Only actually do things if our run command is non-null.
  4919       if test -z "$run"; then
  4920 	# win32 will think the script is a binary if it has
  4921 	# a .exe suffix, so we strip it off here.
  4922 	case $output in
  4923 	  *.exe) output=`$echo $output|${SED} 's,.exe$,,'` ;;
  4924 	esac
  4925 	# test for cygwin because mv fails w/o .exe extensions
  4926 	case $host in
  4927 	  *cygwin*)
  4928 	    exeext=.exe
  4929 	    outputname=`$echo $outputname|${SED} 's,.exe$,,'` ;;
  4930 	  *) exeext= ;;
  4931 	esac
  4932 	case $host in
  4933 	  *cygwin* | *mingw* )
  4934             output_name=`basename $output`
  4935             output_path=`dirname $output`
  4936             cwrappersource="$output_path/$objdir/lt-$output_name.c"
  4937             cwrapper="$output_path/$output_name.exe"
  4938             $rm $cwrappersource $cwrapper
  4939             trap "$rm $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15
  4940 
  4941 	    cat > $cwrappersource <<EOF
  4942 
  4943 /* $cwrappersource - temporary wrapper executable for $objdir/$outputname
  4944    Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
  4945 
  4946    The $output program cannot be directly executed until all the libtool
  4947    libraries that it depends on are installed.
  4948 
  4949    This wrapper executable should never be moved out of the build directory.
  4950    If it is, it will not operate correctly.
  4951 
  4952    Currently, it simply execs the wrapper *script* "/bin/sh $output",
  4953    but could eventually absorb all of the scripts functionality and
  4954    exec $objdir/$outputname directly.
  4955 */
  4956 EOF
  4957 	    cat >> $cwrappersource<<"EOF"
  4958 #include <stdio.h>
  4959 #include <stdlib.h>
  4960 #include <unistd.h>
  4961 #include <malloc.h>
  4962 #include <stdarg.h>
  4963 #include <assert.h>
  4964 #include <string.h>
  4965 #include <ctype.h>
  4966 #include <sys/stat.h>
  4967 
  4968 #if defined(PATH_MAX)
  4969 # define LT_PATHMAX PATH_MAX
  4970 #elif defined(MAXPATHLEN)
  4971 # define LT_PATHMAX MAXPATHLEN
  4972 #else
  4973 # define LT_PATHMAX 1024
  4974 #endif
  4975 
  4976 #ifndef DIR_SEPARATOR
  4977 # define DIR_SEPARATOR '/'
  4978 # define PATH_SEPARATOR ':'
  4979 #endif
  4980 
  4981 #if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \
  4982   defined (__OS2__)
  4983 # define HAVE_DOS_BASED_FILE_SYSTEM
  4984 # ifndef DIR_SEPARATOR_2
  4985 #  define DIR_SEPARATOR_2 '\\'
  4986 # endif
  4987 # ifndef PATH_SEPARATOR_2
  4988 #  define PATH_SEPARATOR_2 ';'
  4989 # endif
  4990 #endif
  4991 
  4992 #ifndef DIR_SEPARATOR_2
  4993 # define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR)
  4994 #else /* DIR_SEPARATOR_2 */
  4995 # define IS_DIR_SEPARATOR(ch) \
  4996         (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2))
  4997 #endif /* DIR_SEPARATOR_2 */
  4998 
  4999 #ifndef PATH_SEPARATOR_2
  5000 # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR)
  5001 #else /* PATH_SEPARATOR_2 */
  5002 # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2)
  5003 #endif /* PATH_SEPARATOR_2 */
  5004 
  5005 #define XMALLOC(type, num)      ((type *) xmalloc ((num) * sizeof(type)))
  5006 #define XFREE(stale) do { \
  5007   if (stale) { free ((void *) stale); stale = 0; } \
  5008 } while (0)
  5009 
  5010 /* -DDEBUG is fairly common in CFLAGS.  */
  5011 #undef DEBUG
  5012 #if defined DEBUGWRAPPER
  5013 # define DEBUG(format, ...) fprintf(stderr, format, __VA_ARGS__)
  5014 #else
  5015 # define DEBUG(format, ...)
  5016 #endif
  5017 
  5018 const char *program_name = NULL;
  5019 
  5020 void * xmalloc (size_t num);
  5021 char * xstrdup (const char *string);
  5022 const char * base_name (const char *name);
  5023 char * find_executable(const char *wrapper);
  5024 int    check_executable(const char *path);
  5025 char * strendzap(char *str, const char *pat);
  5026 void lt_fatal (const char *message, ...);
  5027 
  5028 int
  5029 main (int argc, char *argv[])
  5030 {
  5031   char **newargz;
  5032   int i;
  5033 
  5034   program_name = (char *) xstrdup (base_name (argv[0]));
  5035   DEBUG("(main) argv[0]      : %s\n",argv[0]);
  5036   DEBUG("(main) program_name : %s\n",program_name);
  5037   newargz = XMALLOC(char *, argc+2);
  5038 EOF
  5039 
  5040             cat >> $cwrappersource <<EOF
  5041   newargz[0] = (char *) xstrdup("$SHELL");
  5042 EOF
  5043 
  5044             cat >> $cwrappersource <<"EOF"
  5045   newargz[1] = find_executable(argv[0]);
  5046   if (newargz[1] == NULL)
  5047     lt_fatal("Couldn't find %s", argv[0]);
  5048   DEBUG("(main) found exe at : %s\n",newargz[1]);
  5049   /* we know the script has the same name, without the .exe */
  5050   /* so make sure newargz[1] doesn't end in .exe */
  5051   strendzap(newargz[1],".exe");
  5052   for (i = 1; i < argc; i++)
  5053     newargz[i+1] = xstrdup(argv[i]);
  5054   newargz[argc+1] = NULL;
  5055 
  5056   for (i=0; i<argc+1; i++)
  5057   {
  5058     DEBUG("(main) newargz[%d]   : %s\n",i,newargz[i]);
  5059     ;
  5060   }
  5061 
  5062 EOF
  5063 
  5064             case $host_os in
  5065               mingw*)
  5066                 cat >> $cwrappersource <<EOF
  5067   execv("$SHELL",(char const **)newargz);
  5068 EOF
  5069               ;;
  5070               *)
  5071                 cat >> $cwrappersource <<EOF
  5072   execv("$SHELL",newargz);
  5073 EOF
  5074               ;;
  5075             esac
  5076 
  5077             cat >> $cwrappersource <<"EOF"
  5078   return 127;
  5079 }
  5080 
  5081 void *
  5082 xmalloc (size_t num)
  5083 {
  5084   void * p = (void *) malloc (num);
  5085   if (!p)
  5086     lt_fatal ("Memory exhausted");
  5087 
  5088   return p;
  5089 }
  5090 
  5091 char *
  5092 xstrdup (const char *string)
  5093 {
  5094   return string ? strcpy ((char *) xmalloc (strlen (string) + 1), string) : NULL
  5095 ;
  5096 }
  5097 
  5098 const char *
  5099 base_name (const char *name)
  5100 {
  5101   const char *base;
  5102 
  5103 #if defined (HAVE_DOS_BASED_FILE_SYSTEM)
  5104   /* Skip over the disk name in MSDOS pathnames. */
  5105   if (isalpha ((unsigned char)name[0]) && name[1] == ':')
  5106     name += 2;
  5107 #endif
  5108 
  5109   for (base = name; *name; name++)
  5110     if (IS_DIR_SEPARATOR (*name))
  5111       base = name + 1;
  5112   return base;
  5113 }
  5114 
  5115 int
  5116 check_executable(const char * path)
  5117 {
  5118   struct stat st;
  5119 
  5120   DEBUG("(check_executable)  : %s\n", path ? (*path ? path : "EMPTY!") : "NULL!");
  5121   if ((!path) || (!*path))
  5122     return 0;
  5123 
  5124   if ((stat (path, &st) >= 0) &&
  5125       (
  5126         /* MinGW & native WIN32 do not support S_IXOTH or S_IXGRP */
  5127 #if defined (S_IXOTH)
  5128        ((st.st_mode & S_IXOTH) == S_IXOTH) ||
  5129 #endif
  5130 #if defined (S_IXGRP)
  5131        ((st.st_mode & S_IXGRP) == S_IXGRP) ||
  5132 #endif
  5133        ((st.st_mode & S_IXUSR) == S_IXUSR))
  5134       )
  5135     return 1;
  5136   else
  5137     return 0;
  5138 }
  5139 
  5140 /* Searches for the full path of the wrapper.  Returns
  5141    newly allocated full path name if found, NULL otherwise */
  5142 char *
  5143 find_executable (const char* wrapper)
  5144 {
  5145   int has_slash = 0;
  5146   const char* p;
  5147   const char* p_next;
  5148   /* static buffer for getcwd */
  5149   char tmp[LT_PATHMAX + 1];
  5150   int tmp_len;
  5151   char* concat_name;
  5152 
  5153   DEBUG("(find_executable)  : %s\n", wrapper ? (*wrapper ? wrapper : "EMPTY!") : "NULL!");
  5154 
  5155   if ((wrapper == NULL) || (*wrapper == '\0'))
  5156     return NULL;
  5157 
  5158   /* Absolute path? */
  5159 #if defined (HAVE_DOS_BASED_FILE_SYSTEM)
  5160   if (isalpha ((unsigned char)wrapper[0]) && wrapper[1] == ':')
  5161   {
  5162     concat_name = xstrdup (wrapper);
  5163     if (check_executable(concat_name))
  5164       return concat_name;
  5165     XFREE(concat_name);
  5166   }
  5167   else
  5168   {
  5169 #endif
  5170     if (IS_DIR_SEPARATOR (wrapper[0]))
  5171     {
  5172       concat_name = xstrdup (wrapper);
  5173       if (check_executable(concat_name))
  5174         return concat_name;
  5175       XFREE(concat_name);
  5176     }
  5177 #if defined (HAVE_DOS_BASED_FILE_SYSTEM)
  5178   }
  5179 #endif
  5180 
  5181   for (p = wrapper; *p; p++)
  5182     if (*p == '/')
  5183     {
  5184       has_slash = 1;
  5185       break;
  5186     }
  5187   if (!has_slash)
  5188   {
  5189     /* no slashes; search PATH */
  5190     const char* path = getenv ("PATH");
  5191     if (path != NULL)
  5192     {
  5193       for (p = path; *p; p = p_next)
  5194       {
  5195         const char* q;
  5196         size_t p_len;
  5197         for (q = p; *q; q++)
  5198           if (IS_PATH_SEPARATOR(*q))
  5199             break;
  5200         p_len = q - p;
  5201         p_next = (*q == '\0' ? q : q + 1);
  5202         if (p_len == 0)
  5203         {
  5204           /* empty path: current directory */
  5205           if (getcwd (tmp, LT_PATHMAX) == NULL)
  5206             lt_fatal ("getcwd failed");
  5207           tmp_len = strlen(tmp);
  5208           concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1);
  5209           memcpy (concat_name, tmp, tmp_len);
  5210           concat_name[tmp_len] = '/';
  5211           strcpy (concat_name + tmp_len + 1, wrapper);
  5212         }
  5213         else
  5214         {
  5215           concat_name = XMALLOC(char, p_len + 1 + strlen(wrapper) + 1);
  5216           memcpy (concat_name, p, p_len);
  5217           concat_name[p_len] = '/';
  5218           strcpy (concat_name + p_len + 1, wrapper);
  5219         }
  5220         if (check_executable(concat_name))
  5221           return concat_name;
  5222         XFREE(concat_name);
  5223       }
  5224     }
  5225     /* not found in PATH; assume curdir */
  5226   }
  5227   /* Relative path | not found in path: prepend cwd */
  5228   if (getcwd (tmp, LT_PATHMAX) == NULL)
  5229     lt_fatal ("getcwd failed");
  5230   tmp_len = strlen(tmp);
  5231   concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1);
  5232   memcpy (concat_name, tmp, tmp_len);
  5233   concat_name[tmp_len] = '/';
  5234   strcpy (concat_name + tmp_len + 1, wrapper);
  5235 
  5236   if (check_executable(concat_name))
  5237     return concat_name;
  5238   XFREE(concat_name);
  5239   return NULL;
  5240 }
  5241 
  5242 char *
  5243 strendzap(char *str, const char *pat)
  5244 {
  5245   size_t len, patlen;
  5246 
  5247   assert(str != NULL);
  5248   assert(pat != NULL);
  5249 
  5250   len = strlen(str);
  5251   patlen = strlen(pat);
  5252 
  5253   if (patlen <= len)
  5254   {
  5255     str += len - patlen;
  5256     if (strcmp(str, pat) == 0)
  5257       *str = '\0';
  5258   }
  5259   return str;
  5260 }
  5261 
  5262 static void
  5263 lt_error_core (int exit_status, const char * mode,
  5264           const char * message, va_list ap)
  5265 {
  5266   fprintf (stderr, "%s: %s: ", program_name, mode);
  5267   vfprintf (stderr, message, ap);
  5268   fprintf (stderr, ".\n");
  5269 
  5270   if (exit_status >= 0)
  5271     exit (exit_status);
  5272 }
  5273 
  5274 void
  5275 lt_fatal (const char *message, ...)
  5276 {
  5277   va_list ap;
  5278   va_start (ap, message);
  5279   lt_error_core (EXIT_FAILURE, "FATAL", message, ap);
  5280   va_end (ap);
  5281 }
  5282 EOF
  5283           # we should really use a build-platform specific compiler
  5284           # here, but OTOH, the wrappers (shell script and this C one)
  5285           # are only useful if you want to execute the "real" binary.
  5286           # Since the "real" binary is built for $host, then this
  5287           # wrapper might as well be built for $host, too.
  5288           $run $LTCC $LTCFLAGS -s -o $cwrapper $cwrappersource
  5289           ;;
  5290         esac
  5291         $rm $output
  5292         trap "$rm $output; exit $EXIT_FAILURE" 1 2 15
  5293 
  5294 	$echo > $output "\
  5295 #! $SHELL
  5296 
  5297 # $output - temporary wrapper script for $objdir/$outputname
  5298 # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
  5299 #
  5300 # The $output program cannot be directly executed until all the libtool
  5301 # libraries that it depends on are installed.
  5302 #
  5303 # This wrapper script should never be moved out of the build directory.
  5304 # If it is, it will not operate correctly.
  5305 
  5306 # Sed substitution that helps us do robust quoting.  It backslashifies
  5307 # metacharacters that are still active within double-quoted strings.
  5308 Xsed='${SED} -e 1s/^X//'
  5309 sed_quote_subst='$sed_quote_subst'
  5310 
  5311 # The HP-UX ksh and POSIX shell print the target directory to stdout
  5312 # if CDPATH is set.
  5313 (unset CDPATH) >/dev/null 2>&1 && unset CDPATH
  5314 
  5315 relink_command=\"$relink_command\"
  5316 
  5317 # This environment variable determines our operation mode.
  5318 if test \"\$libtool_install_magic\" = \"$magic\"; then
  5319   # install mode needs the following variable:
  5320   notinst_deplibs='$notinst_deplibs'
  5321 else
  5322   # When we are sourced in execute mode, \$file and \$echo are already set.
  5323   if test \"\$libtool_execute_magic\" != \"$magic\"; then
  5324     echo=\"$qecho\"
  5325     file=\"\$0\"
  5326     # Make sure echo works.
  5327     if test \"X\$1\" = X--no-reexec; then
  5328       # Discard the --no-reexec flag, and continue.
  5329       shift
  5330     elif test \"X\`(\$echo '\t') 2>/dev/null\`\" = 'X\t'; then
  5331       # Yippee, \$echo works!
  5332       :
  5333     else
  5334       # Restart under the correct shell, and then maybe \$echo will work.
  5335       exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"}
  5336     fi
  5337   fi\
  5338 "
  5339 	$echo >> $output "\
  5340 
  5341   # Find the directory that this script lives in.
  5342   thisdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\`
  5343   test \"x\$thisdir\" = \"x\$file\" && thisdir=.
  5344 
  5345   # Follow symbolic links until we get to the real thisdir.
  5346   file=\`ls -ld \"\$file\" | ${SED} -n 's/.*-> //p'\`
  5347   while test -n \"\$file\"; do
  5348     destdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\`
  5349 
  5350     # If there was a directory component, then change thisdir.
  5351     if test \"x\$destdir\" != \"x\$file\"; then
  5352       case \"\$destdir\" in
  5353       [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;;
  5354       *) thisdir=\"\$thisdir/\$destdir\" ;;
  5355       esac
  5356     fi
  5357 
  5358     file=\`\$echo \"X\$file\" | \$Xsed -e 's%^.*/%%'\`
  5359     file=\`ls -ld \"\$thisdir/\$file\" | ${SED} -n 's/.*-> //p'\`
  5360   done
  5361 
  5362   # Try to get the absolute directory name.
  5363   absdir=\`cd \"\$thisdir\" && pwd\`
  5364   test -n \"\$absdir\" && thisdir=\"\$absdir\"
  5365 "
  5366 
  5367 	if test "$fast_install" = yes; then
  5368 	  $echo >> $output "\
  5369   program=lt-'$outputname'$exeext
  5370   progdir=\"\$thisdir/$objdir\"
  5371 
  5372   if test ! -f \"\$progdir/\$program\" || \\
  5373      { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\
  5374        test \"X\$file\" != \"X\$progdir/\$program\"; }; then
  5375 
  5376     file=\"\$\$-\$program\"
  5377 
  5378     if test ! -d \"\$progdir\"; then
  5379       $mkdir \"\$progdir\"
  5380     else
  5381       $rm \"\$progdir/\$file\"
  5382     fi"
  5383 
  5384 	  $echo >> $output "\
  5385 
  5386     # relink executable if necessary
  5387     if test -n \"\$relink_command\"; then
  5388       if relink_command_output=\`eval \$relink_command 2>&1\`; then :
  5389       else
  5390 	$echo \"\$relink_command_output\" >&2
  5391 	$rm \"\$progdir/\$file\"
  5392 	exit $EXIT_FAILURE
  5393       fi
  5394     fi
  5395 
  5396     $mv \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null ||
  5397     { $rm \"\$progdir/\$program\";
  5398       $mv \"\$progdir/\$file\" \"\$progdir/\$program\"; }
  5399     $rm \"\$progdir/\$file\"
  5400   fi"
  5401 	else
  5402 	  $echo >> $output "\
  5403   program='$outputname'
  5404   progdir=\"\$thisdir/$objdir\"
  5405 "
  5406 	fi
  5407 
  5408 	$echo >> $output "\
  5409 
  5410   if test -f \"\$progdir/\$program\"; then"
  5411 
  5412 	# Export our shlibpath_var if we have one.
  5413 	if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
  5414 	  $echo >> $output "\
  5415     # Add our own library path to $shlibpath_var
  5416     $shlibpath_var=\"$temp_rpath\$$shlibpath_var\"
  5417 
  5418     # Some systems cannot cope with colon-terminated $shlibpath_var
  5419     # The second colon is a workaround for a bug in BeOS R4 sed
  5420     $shlibpath_var=\`\$echo \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\`
  5421 
  5422     export $shlibpath_var
  5423 "
  5424 	fi
  5425 
  5426 	# fixup the dll searchpath if we need to.
  5427 	if test -n "$dllsearchpath"; then
  5428 	  $echo >> $output "\
  5429     # Add the dll search path components to the executable PATH
  5430     PATH=$dllsearchpath:\$PATH
  5431 "
  5432 	fi
  5433 
  5434 	$echo >> $output "\
  5435     if test \"\$libtool_execute_magic\" != \"$magic\"; then
  5436       # Run the actual program with our arguments.
  5437 "
  5438 	case $host in
  5439 	# Backslashes separate directories on plain windows
  5440 	*-*-mingw | *-*-os2*)
  5441 	  $echo >> $output "\
  5442       exec \"\$progdir\\\\\$program\" \${1+\"\$@\"}
  5443 "
  5444 	  ;;
  5445 
  5446 	*)
  5447 	  $echo >> $output "\
  5448       exec \"\$progdir/\$program\" \${1+\"\$@\"}
  5449 "
  5450 	  ;;
  5451 	esac
  5452 	$echo >> $output "\
  5453       \$echo \"\$0: cannot exec \$program \${1+\"\$@\"}\"
  5454       exit $EXIT_FAILURE
  5455     fi
  5456   else
  5457     # The program doesn't exist.
  5458     \$echo \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2
  5459     \$echo \"This script is just a wrapper for \$program.\" 1>&2
  5460     $echo \"See the $PACKAGE documentation for more information.\" 1>&2
  5461     exit $EXIT_FAILURE
  5462   fi
  5463 fi\
  5464 "
  5465 	chmod +x $output
  5466       fi
  5467       exit $EXIT_SUCCESS
  5468       ;;
  5469     esac
  5470 
  5471     # See if we need to build an old-fashioned archive.
  5472     for oldlib in $oldlibs; do
  5473 
  5474       if test "$build_libtool_libs" = convenience; then
  5475 	oldobjs="$libobjs_save"
  5476 	addlibs="$convenience"
  5477 	build_libtool_libs=no
  5478       else
  5479 	if test "$build_libtool_libs" = module; then
  5480 	  oldobjs="$libobjs_save"
  5481 	  build_libtool_libs=no
  5482 	else
  5483 	  oldobjs="$old_deplibs $non_pic_objects"
  5484 	fi
  5485 	addlibs="$old_convenience"
  5486       fi
  5487 
  5488       if test -n "$addlibs"; then
  5489 	gentop="$output_objdir/${outputname}x"
  5490 	generated="$generated $gentop"
  5491 
  5492 	func_extract_archives $gentop $addlibs
  5493 	oldobjs="$oldobjs $func_extract_archives_result"
  5494       fi
  5495 
  5496       # Do each command in the archive commands.
  5497       if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then
  5498        cmds=$old_archive_from_new_cmds
  5499       else
  5500 	# POSIX demands no paths to be encoded in archives.  We have
  5501 	# to avoid creating archives with duplicate basenames if we
  5502 	# might have to extract them afterwards, e.g., when creating a
  5503 	# static archive out of a convenience library, or when linking
  5504 	# the entirety of a libtool archive into another (currently
  5505 	# not supported by libtool).
  5506 	if (for obj in $oldobjs
  5507 	    do
  5508 	      $echo "X$obj" | $Xsed -e 's%^.*/%%'
  5509 	    done | sort | sort -uc >/dev/null 2>&1); then
  5510 	  :
  5511 	else
  5512 	  $echo "copying selected object files to avoid basename conflicts..."
  5513 
  5514 	  if test -z "$gentop"; then
  5515 	    gentop="$output_objdir/${outputname}x"
  5516 	    generated="$generated $gentop"
  5517 
  5518 	    $show "${rm}r $gentop"
  5519 	    $run ${rm}r "$gentop"
  5520 	    $show "$mkdir $gentop"
  5521 	    $run $mkdir "$gentop"
  5522 	    exit_status=$?
  5523 	    if test "$exit_status" -ne 0 && test ! -d "$gentop"; then
  5524 	      exit $exit_status
  5525 	    fi
  5526 	  fi
  5527 
  5528 	  save_oldobjs=$oldobjs
  5529 	  oldobjs=
  5530 	  counter=1
  5531 	  for obj in $save_oldobjs
  5532 	  do
  5533 	    objbase=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
  5534 	    case " $oldobjs " in
  5535 	    " ") oldobjs=$obj ;;
  5536 	    *[\ /]"$objbase "*)
  5537 	      while :; do
  5538 		# Make sure we don't pick an alternate name that also
  5539 		# overlaps.
  5540 		newobj=lt$counter-$objbase
  5541 		counter=`expr $counter + 1`
  5542 		case " $oldobjs " in
  5543 		*[\ /]"$newobj "*) ;;
  5544 		*) if test ! -f "$gentop/$newobj"; then break; fi ;;
  5545 		esac
  5546 	      done
  5547 	      $show "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj"
  5548 	      $run ln "$obj" "$gentop/$newobj" ||
  5549 	      $run cp "$obj" "$gentop/$newobj"
  5550 	      oldobjs="$oldobjs $gentop/$newobj"
  5551 	      ;;
  5552 	    *) oldobjs="$oldobjs $obj" ;;
  5553 	    esac
  5554 	  done
  5555 	fi
  5556 
  5557 	eval cmds=\"$old_archive_cmds\"
  5558 
  5559 	if len=`expr "X$cmds" : ".*"` &&
  5560 	     test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
  5561 	  cmds=$old_archive_cmds
  5562 	else
  5563 	  # the command line is too long to link in one step, link in parts
  5564 	  $echo "using piecewise archive linking..."
  5565 	  save_RANLIB=$RANLIB
  5566 	  RANLIB=:
  5567 	  objlist=
  5568 	  concat_cmds=
  5569 	  save_oldobjs=$oldobjs
  5570 
  5571 	  # Is there a better way of finding the last object in the list?
  5572 	  for obj in $save_oldobjs
  5573 	  do
  5574 	    last_oldobj=$obj
  5575 	  done
  5576 	  for obj in $save_oldobjs
  5577 	  do
  5578 	    oldobjs="$objlist $obj"
  5579 	    objlist="$objlist $obj"
  5580 	    eval test_cmds=\"$old_archive_cmds\"
  5581 	    if len=`expr "X$test_cmds" : ".*" 2>/dev/null` &&
  5582 	       test "$len" -le "$max_cmd_len"; then
  5583 	      :
  5584 	    else
  5585 	      # the above command should be used before it gets too long
  5586 	      oldobjs=$objlist
  5587 	      if test "$obj" = "$last_oldobj" ; then
  5588 	        RANLIB=$save_RANLIB
  5589 	      fi
  5590 	      test -z "$concat_cmds" || concat_cmds=$concat_cmds~
  5591 	      eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\"
  5592 	      objlist=
  5593 	    fi
  5594 	  done
  5595 	  RANLIB=$save_RANLIB
  5596 	  oldobjs=$objlist
  5597 	  if test "X$oldobjs" = "X" ; then
  5598 	    eval cmds=\"\$concat_cmds\"
  5599 	  else
  5600 	    eval cmds=\"\$concat_cmds~\$old_archive_cmds\"
  5601 	  fi
  5602 	fi
  5603       fi
  5604       save_ifs="$IFS"; IFS='~'
  5605       for cmd in $cmds; do
  5606         eval cmd=\"$cmd\"
  5607 	IFS="$save_ifs"
  5608 	$show "$cmd"
  5609 	$run eval "$cmd" || exit $?
  5610       done
  5611       IFS="$save_ifs"
  5612     done
  5613 
  5614     if test -n "$generated"; then
  5615       $show "${rm}r$generated"
  5616       $run ${rm}r$generated
  5617     fi
  5618 
  5619     # Now create the libtool archive.
  5620     case $output in
  5621     *.la)
  5622       old_library=
  5623       test "$build_old_libs" = yes && old_library="$libname.$libext"
  5624       $show "creating $output"
  5625 
  5626       # Preserve any variables that may affect compiler behavior
  5627       for var in $variables_saved_for_relink; do
  5628 	if eval test -z \"\${$var+set}\"; then
  5629 	  relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command"
  5630 	elif eval var_value=\$$var; test -z "$var_value"; then
  5631 	  relink_command="$var=; export $var; $relink_command"
  5632 	else
  5633 	  var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"`
  5634 	  relink_command="$var=\"$var_value\"; export $var; $relink_command"
  5635 	fi
  5636       done
  5637       # Quote the link command for shipping.
  5638       relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)"
  5639       relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"`
  5640       if test "$hardcode_automatic" = yes ; then
  5641 	relink_command=
  5642       fi
  5643 
  5644 
  5645       # Only create the output if not a dry run.
  5646       if test -z "$run"; then
  5647 	for installed in no yes; do
  5648 	  if test "$installed" = yes; then
  5649 	    if test -z "$install_libdir"; then
  5650 	      break
  5651 	    fi
  5652 	    output="$output_objdir/$outputname"i
  5653 	    # Replace all uninstalled libtool libraries with the installed ones
  5654 	    newdependency_libs=
  5655 	    for deplib in $dependency_libs; do
  5656 	      case $deplib in
  5657 	      *.la)
  5658 		name=`$echo "X$deplib" | $Xsed -e 's%^.*/%%'`
  5659 		eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
  5660 		if test -z "$libdir"; then
  5661 		  $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
  5662 		  exit $EXIT_FAILURE
  5663 		fi
  5664 		newdependency_libs="$newdependency_libs $libdir/$name"
  5665 		;;
  5666 	      *) newdependency_libs="$newdependency_libs $deplib" ;;
  5667 	      esac
  5668 	    done
  5669 	    dependency_libs="$newdependency_libs"
  5670 	    newdlfiles=
  5671 	    for lib in $dlfiles; do
  5672 	      name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
  5673 	      eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
  5674 	      if test -z "$libdir"; then
  5675 		$echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
  5676 		exit $EXIT_FAILURE
  5677 	      fi
  5678 	      newdlfiles="$newdlfiles $libdir/$name"
  5679 	    done
  5680 	    dlfiles="$newdlfiles"
  5681 	    newdlprefiles=
  5682 	    for lib in $dlprefiles; do
  5683 	      name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
  5684 	      eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
  5685 	      if test -z "$libdir"; then
  5686 		$echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
  5687 		exit $EXIT_FAILURE
  5688 	      fi
  5689 	      newdlprefiles="$newdlprefiles $libdir/$name"
  5690 	    done
  5691 	    dlprefiles="$newdlprefiles"
  5692 	  else
  5693 	    newdlfiles=
  5694 	    for lib in $dlfiles; do
  5695 	      case $lib in
  5696 		[\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
  5697 		*) abs=`pwd`"/$lib" ;;
  5698 	      esac
  5699 	      newdlfiles="$newdlfiles $abs"
  5700 	    done
  5701 	    dlfiles="$newdlfiles"
  5702 	    newdlprefiles=
  5703 	    for lib in $dlprefiles; do
  5704 	      case $lib in
  5705 		[\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
  5706 		*) abs=`pwd`"/$lib" ;;
  5707 	      esac
  5708 	      newdlprefiles="$newdlprefiles $abs"
  5709 	    done
  5710 	    dlprefiles="$newdlprefiles"
  5711 	  fi
  5712 	  $rm $output
  5713 	  # place dlname in correct position for cygwin
  5714 	  tdlname=$dlname
  5715 	  case $host,$output,$installed,$module,$dlname in
  5716 	    *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;;
  5717 	  esac
  5718 	  $echo > $output "\
  5719 # $outputname - a libtool library file
  5720 # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
  5721 #
  5722 # Please DO NOT delete this file!
  5723 # It is necessary for linking the library.
  5724 
  5725 # The name that we can dlopen(3).
  5726 dlname='$tdlname'
  5727 
  5728 # Names of this library.
  5729 library_names='$library_names'
  5730 
  5731 # The name of the static archive.
  5732 old_library='$old_library'
  5733 
  5734 # Libraries that this one depends upon.
  5735 dependency_libs='$dependency_libs'
  5736 
  5737 # Version information for $libname.
  5738 current=$current
  5739 age=$age
  5740 revision=$revision
  5741 
  5742 # Is this an already installed library?
  5743 installed=$installed
  5744 
  5745 # Should we warn about portability when linking against -modules?
  5746 shouldnotlink=$module
  5747 
  5748 # Files to dlopen/dlpreopen
  5749 dlopen='$dlfiles'
  5750 dlpreopen='$dlprefiles'
  5751 
  5752 # Directory that this library needs to be installed in:
  5753 libdir='$install_libdir'"
  5754 	  if test "$installed" = no && test "$need_relink" = yes; then
  5755 	    $echo >> $output "\
  5756 relink_command=\"$relink_command\""
  5757 	  fi
  5758 	done
  5759       fi
  5760 
  5761       # Do a symbolic link so that the libtool archive can be found in
  5762       # LD_LIBRARY_PATH before the program is installed.
  5763       $show "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)"
  5764       $run eval '(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)' || exit $?
  5765       ;;
  5766     esac
  5767     exit $EXIT_SUCCESS
  5768     ;;
  5769 
  5770   # libtool install mode
  5771   install)
  5772     modename="$modename: install"
  5773 
  5774     # There may be an optional sh(1) argument at the beginning of
  5775     # install_prog (especially on Windows NT).
  5776     if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh ||
  5777        # Allow the use of GNU shtool's install command.
  5778        $echo "X$nonopt" | grep shtool > /dev/null; then
  5779       # Aesthetically quote it.
  5780       arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"`
  5781       case $arg in
  5782       *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
  5783 	arg="\"$arg\""
  5784 	;;
  5785       esac
  5786       install_prog="$arg "
  5787       arg="$1"
  5788       shift
  5789     else
  5790       install_prog=
  5791       arg=$nonopt
  5792     fi
  5793 
  5794     # The real first argument should be the name of the installation program.
  5795     # Aesthetically quote it.
  5796     arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
  5797     case $arg in
  5798     *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
  5799       arg="\"$arg\""
  5800       ;;
  5801     esac
  5802     install_prog="$install_prog$arg"
  5803 
  5804     # We need to accept at least all the BSD install flags.
  5805     dest=
  5806     files=
  5807     opts=
  5808     prev=
  5809     install_type=
  5810     isdir=no
  5811     stripme=
  5812     for arg
  5813     do
  5814       if test -n "$dest"; then
  5815 	files="$files $dest"
  5816 	dest=$arg
  5817 	continue
  5818       fi
  5819 
  5820       case $arg in
  5821       -d) isdir=yes ;;
  5822       -f) 
  5823       	case " $install_prog " in
  5824 	*[\\\ /]cp\ *) ;;
  5825 	*) prev=$arg ;;
  5826 	esac
  5827 	;;
  5828       -g | -m | -o) prev=$arg ;;
  5829       -s)
  5830 	stripme=" -s"
  5831 	continue
  5832 	;;
  5833       -*)
  5834 	;;
  5835       *)
  5836 	# If the previous option needed an argument, then skip it.
  5837 	if test -n "$prev"; then
  5838 	  prev=
  5839 	else
  5840 	  dest=$arg
  5841 	  continue
  5842 	fi
  5843 	;;
  5844       esac
  5845 
  5846       # Aesthetically quote the argument.
  5847       arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
  5848       case $arg in
  5849       *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
  5850 	arg="\"$arg\""
  5851 	;;
  5852       esac
  5853       install_prog="$install_prog $arg"
  5854     done
  5855 
  5856     if test -z "$install_prog"; then
  5857       $echo "$modename: you must specify an install program" 1>&2
  5858       $echo "$help" 1>&2
  5859       exit $EXIT_FAILURE
  5860     fi
  5861 
  5862     if test -n "$prev"; then
  5863       $echo "$modename: the \`$prev' option requires an argument" 1>&2
  5864       $echo "$help" 1>&2
  5865       exit $EXIT_FAILURE
  5866     fi
  5867 
  5868     if test -z "$files"; then
  5869       if test -z "$dest"; then
  5870 	$echo "$modename: no file or destination specified" 1>&2
  5871       else
  5872 	$echo "$modename: you must specify a destination" 1>&2
  5873       fi
  5874       $echo "$help" 1>&2
  5875       exit $EXIT_FAILURE
  5876     fi
  5877 
  5878     # Strip any trailing slash from the destination.
  5879     dest=`$echo "X$dest" | $Xsed -e 's%/$%%'`
  5880 
  5881     # Check to see that the destination is a directory.
  5882     test -d "$dest" && isdir=yes
  5883     if test "$isdir" = yes; then
  5884       destdir="$dest"
  5885       destname=
  5886     else
  5887       destdir=`$echo "X$dest" | $Xsed -e 's%/[^/]*$%%'`
  5888       test "X$destdir" = "X$dest" && destdir=.
  5889       destname=`$echo "X$dest" | $Xsed -e 's%^.*/%%'`
  5890 
  5891       # Not a directory, so check to see that there is only one file specified.
  5892       set dummy $files
  5893       if test "$#" -gt 2; then
  5894 	$echo "$modename: \`$dest' is not a directory" 1>&2
  5895 	$echo "$help" 1>&2
  5896 	exit $EXIT_FAILURE
  5897       fi
  5898     fi
  5899     case $destdir in
  5900     [\\/]* | [A-Za-z]:[\\/]*) ;;
  5901     *)
  5902       for file in $files; do
  5903 	case $file in
  5904 	*.lo) ;;
  5905 	*)
  5906 	  $echo "$modename: \`$destdir' must be an absolute directory name" 1>&2
  5907 	  $echo "$help" 1>&2
  5908 	  exit $EXIT_FAILURE
  5909 	  ;;
  5910 	esac
  5911       done
  5912       ;;
  5913     esac
  5914 
  5915     # This variable tells wrapper scripts just to set variables rather
  5916     # than running their programs.
  5917     libtool_install_magic="$magic"
  5918 
  5919     staticlibs=
  5920     future_libdirs=
  5921     current_libdirs=
  5922     for file in $files; do
  5923 
  5924       # Do each installation.
  5925       case $file in
  5926       *.$libext)
  5927 	# Do the static libraries later.
  5928 	staticlibs="$staticlibs $file"
  5929 	;;
  5930 
  5931       *.la)
  5932 	# Check to see that this really is a libtool archive.
  5933 	if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
  5934 	else
  5935 	  $echo "$modename: \`$file' is not a valid libtool archive" 1>&2
  5936 	  $echo "$help" 1>&2
  5937 	  exit $EXIT_FAILURE
  5938 	fi
  5939 
  5940 	library_names=
  5941 	old_library=
  5942 	relink_command=
  5943 	# If there is no directory component, then add one.
  5944 	case $file in
  5945 	*/* | *\\*) . $file ;;
  5946 	*) . ./$file ;;
  5947 	esac
  5948 
  5949 	# Add the libdir to current_libdirs if it is the destination.
  5950 	if test "X$destdir" = "X$libdir"; then
  5951 	  case "$current_libdirs " in
  5952 	  *" $libdir "*) ;;
  5953 	  *) current_libdirs="$current_libdirs $libdir" ;;
  5954 	  esac
  5955 	else
  5956 	  # Note the libdir as a future libdir.
  5957 	  case "$future_libdirs " in
  5958 	  *" $libdir "*) ;;
  5959 	  *) future_libdirs="$future_libdirs $libdir" ;;
  5960 	  esac
  5961 	fi
  5962 
  5963 	dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`/
  5964 	test "X$dir" = "X$file/" && dir=
  5965 	dir="$dir$objdir"
  5966 
  5967 	if test -n "$relink_command"; then
  5968 	  # Determine the prefix the user has applied to our future dir.
  5969 	  inst_prefix_dir=`$echo "$destdir" | $SED "s%$libdir\$%%"`
  5970 
  5971 	  # Don't allow the user to place us outside of our expected
  5972 	  # location b/c this prevents finding dependent libraries that
  5973 	  # are installed to the same prefix.
  5974 	  # At present, this check doesn't affect windows .dll's that
  5975 	  # are installed into $libdir/../bin (currently, that works fine)
  5976 	  # but it's something to keep an eye on.
  5977 	  if test "$inst_prefix_dir" = "$destdir"; then
  5978 	    $echo "$modename: error: cannot install \`$file' to a directory not ending in $libdir" 1>&2
  5979 	    exit $EXIT_FAILURE
  5980 	  fi
  5981 
  5982 	  if test -n "$inst_prefix_dir"; then
  5983 	    # Stick the inst_prefix_dir data into the link command.
  5984 	    relink_command=`$echo "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"`
  5985 	  else
  5986 	    relink_command=`$echo "$relink_command" | $SED "s%@inst_prefix_dir@%%"`
  5987 	  fi
  5988 
  5989 	  $echo "$modename: warning: relinking \`$file'" 1>&2
  5990 	  $show "$relink_command"
  5991 	  if $run eval "$relink_command"; then :
  5992 	  else
  5993 	    $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
  5994 	    exit $EXIT_FAILURE
  5995 	  fi
  5996 	fi
  5997 
  5998 	# See the names of the shared library.
  5999 	set dummy $library_names
  6000 	if test -n "$2"; then
  6001 	  realname="$2"
  6002 	  shift
  6003 	  shift
  6004 
  6005 	  srcname="$realname"
  6006 	  test -n "$relink_command" && srcname="$realname"T
  6007 
  6008 	  # Install the shared library and build the symlinks.
  6009 	  $show "$install_prog $dir/$srcname $destdir/$realname"
  6010 	  $run eval "$install_prog $dir/$srcname $destdir/$realname" || exit $?
  6011 	  if test -n "$stripme" && test -n "$striplib"; then
  6012 	    $show "$striplib $destdir/$realname"
  6013 	    $run eval "$striplib $destdir/$realname" || exit $?
  6014 	  fi
  6015 
  6016 	  if test "$#" -gt 0; then
  6017 	    # Delete the old symlinks, and create new ones.
  6018 	    # Try `ln -sf' first, because the `ln' binary might depend on
  6019 	    # the symlink we replace!  Solaris /bin/ln does not understand -f,
  6020 	    # so we also need to try rm && ln -s.
  6021 	    for linkname
  6022 	    do
  6023 	      if test "$linkname" != "$realname"; then
  6024                 $show "(cd $destdir && { $LN_S -f $realname $linkname || { $rm $linkname && $LN_S $realname $linkname; }; })"
  6025                 $run eval "(cd $destdir && { $LN_S -f $realname $linkname || { $rm $linkname && $LN_S $realname $linkname; }; })"
  6026 	      fi
  6027 	    done
  6028 	  fi
  6029 
  6030 	  # Do each command in the postinstall commands.
  6031 	  lib="$destdir/$realname"
  6032 	  cmds=$postinstall_cmds
  6033 	  save_ifs="$IFS"; IFS='~'
  6034 	  for cmd in $cmds; do
  6035 	    IFS="$save_ifs"
  6036 	    eval cmd=\"$cmd\"
  6037 	    $show "$cmd"
  6038 	    $run eval "$cmd" || {
  6039 	      lt_exit=$?
  6040 
  6041 	      # Restore the uninstalled library and exit
  6042 	      if test "$mode" = relink; then
  6043 		$run eval '(cd $output_objdir && $rm ${realname}T && $mv ${realname}U $realname)'
  6044 	      fi
  6045 
  6046 	      exit $lt_exit
  6047 	    }
  6048 	  done
  6049 	  IFS="$save_ifs"
  6050 	fi
  6051 
  6052 	# Install the pseudo-library for information purposes.
  6053 	name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
  6054 	instname="$dir/$name"i
  6055 	$show "$install_prog $instname $destdir/$name"
  6056 	$run eval "$install_prog $instname $destdir/$name" || exit $?
  6057 
  6058 	# Maybe install the static library, too.
  6059 	test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library"
  6060 	;;
  6061 
  6062       *.lo)
  6063 	# Install (i.e. copy) a libtool object.
  6064 
  6065 	# Figure out destination file name, if it wasn't already specified.
  6066 	if test -n "$destname"; then
  6067 	  destfile="$destdir/$destname"
  6068 	else
  6069 	  destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
  6070 	  destfile="$destdir/$destfile"
  6071 	fi
  6072 
  6073 	# Deduce the name of the destination old-style object file.
  6074 	case $destfile in
  6075 	*.lo)
  6076 	  staticdest=`$echo "X$destfile" | $Xsed -e "$lo2o"`
  6077 	  ;;
  6078 	*.$objext)
  6079 	  staticdest="$destfile"
  6080 	  destfile=
  6081 	  ;;
  6082 	*)
  6083 	  $echo "$modename: cannot copy a libtool object to \`$destfile'" 1>&2
  6084 	  $echo "$help" 1>&2
  6085 	  exit $EXIT_FAILURE
  6086 	  ;;
  6087 	esac
  6088 
  6089 	# Install the libtool object if requested.
  6090 	if test -n "$destfile"; then
  6091 	  $show "$install_prog $file $destfile"
  6092 	  $run eval "$install_prog $file $destfile" || exit $?
  6093 	fi
  6094 
  6095 	# Install the old object if enabled.
  6096 	if test "$build_old_libs" = yes; then
  6097 	  # Deduce the name of the old-style object file.
  6098 	  staticobj=`$echo "X$file" | $Xsed -e "$lo2o"`
  6099 
  6100 	  $show "$install_prog $staticobj $staticdest"
  6101 	  $run eval "$install_prog \$staticobj \$staticdest" || exit $?
  6102 	fi
  6103 	exit $EXIT_SUCCESS
  6104 	;;
  6105 
  6106       *)
  6107 	# Figure out destination file name, if it wasn't already specified.
  6108 	if test -n "$destname"; then
  6109 	  destfile="$destdir/$destname"
  6110 	else
  6111 	  destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
  6112 	  destfile="$destdir/$destfile"
  6113 	fi
  6114 
  6115 	# If the file is missing, and there is a .exe on the end, strip it
  6116 	# because it is most likely a libtool script we actually want to
  6117 	# install
  6118 	stripped_ext=""
  6119 	case $file in
  6120 	  *.exe)
  6121 	    if test ! -f "$file"; then
  6122 	      file=`$echo $file|${SED} 's,.exe$,,'`
  6123 	      stripped_ext=".exe"
  6124 	    fi
  6125 	    ;;
  6126 	esac
  6127 
  6128 	# Do a test to see if this is really a libtool program.
  6129 	case $host in
  6130 	*cygwin*|*mingw*)
  6131 	    wrapper=`$echo $file | ${SED} -e 's,.exe$,,'`
  6132 	    ;;
  6133 	*)
  6134 	    wrapper=$file
  6135 	    ;;
  6136 	esac
  6137 	if (${SED} -e '4q' $wrapper | grep "^# Generated by .*$PACKAGE")>/dev/null 2>&1; then
  6138 	  notinst_deplibs=
  6139 	  relink_command=
  6140 
  6141 	  # Note that it is not necessary on cygwin/mingw to append a dot to
  6142 	  # foo even if both foo and FILE.exe exist: automatic-append-.exe
  6143 	  # behavior happens only for exec(3), not for open(2)!  Also, sourcing
  6144 	  # `FILE.' does not work on cygwin managed mounts.
  6145 	  #
  6146 	  # If there is no directory component, then add one.
  6147 	  case $wrapper in
  6148 	  */* | *\\*) . ${wrapper} ;;
  6149 	  *) . ./${wrapper} ;;
  6150 	  esac
  6151 
  6152 	  # Check the variables that should have been set.
  6153 	  if test -z "$notinst_deplibs"; then
  6154 	    $echo "$modename: invalid libtool wrapper script \`$wrapper'" 1>&2
  6155 	    exit $EXIT_FAILURE
  6156 	  fi
  6157 
  6158 	  finalize=yes
  6159 	  for lib in $notinst_deplibs; do
  6160 	    # Check to see that each library is installed.
  6161 	    libdir=
  6162 	    if test -f "$lib"; then
  6163 	      # If there is no directory component, then add one.
  6164 	      case $lib in
  6165 	      */* | *\\*) . $lib ;;
  6166 	      *) . ./$lib ;;
  6167 	      esac
  6168 	    fi
  6169 	    libfile="$libdir/"`$echo "X$lib" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test
  6170 	    if test -n "$libdir" && test ! -f "$libfile"; then
  6171 	      $echo "$modename: warning: \`$lib' has not been installed in \`$libdir'" 1>&2
  6172 	      finalize=no
  6173 	    fi
  6174 	  done
  6175 
  6176 	  relink_command=
  6177 	  # Note that it is not necessary on cygwin/mingw to append a dot to
  6178 	  # foo even if both foo and FILE.exe exist: automatic-append-.exe
  6179 	  # behavior happens only for exec(3), not for open(2)!  Also, sourcing
  6180 	  # `FILE.' does not work on cygwin managed mounts.
  6181 	  #
  6182 	  # If there is no directory component, then add one.
  6183 	  case $wrapper in
  6184 	  */* | *\\*) . ${wrapper} ;;
  6185 	  *) . ./${wrapper} ;;
  6186 	  esac
  6187 
  6188 	  outputname=
  6189 	  if test "$fast_install" = no && test -n "$relink_command"; then
  6190 	    if test "$finalize" = yes && test -z "$run"; then
  6191 	      tmpdir=`func_mktempdir`
  6192 	      file=`$echo "X$file$stripped_ext" | $Xsed -e 's%^.*/%%'`
  6193 	      outputname="$tmpdir/$file"
  6194 	      # Replace the output file specification.
  6195 	      relink_command=`$echo "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'`
  6196 
  6197 	      $show "$relink_command"
  6198 	      if $run eval "$relink_command"; then :
  6199 	      else
  6200 		$echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
  6201 		${rm}r "$tmpdir"
  6202 		continue
  6203 	      fi
  6204 	      file="$outputname"
  6205 	    else
  6206 	      $echo "$modename: warning: cannot relink \`$file'" 1>&2
  6207 	    fi
  6208 	  else
  6209 	    # Install the binary that we compiled earlier.
  6210 	    file=`$echo "X$file$stripped_ext" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"`
  6211 	  fi
  6212 	fi
  6213 
  6214 	# remove .exe since cygwin /usr/bin/install will append another
  6215 	# one anyway 
  6216 	case $install_prog,$host in
  6217 	*/usr/bin/install*,*cygwin*)
  6218 	  case $file:$destfile in
  6219 	  *.exe:*.exe)
  6220 	    # this is ok
  6221 	    ;;
  6222 	  *.exe:*)
  6223 	    destfile=$destfile.exe
  6224 	    ;;
  6225 	  *:*.exe)
  6226 	    destfile=`$echo $destfile | ${SED} -e 's,.exe$,,'`
  6227 	    ;;
  6228 	  esac
  6229 	  ;;
  6230 	esac
  6231 	$show "$install_prog$stripme $file $destfile"
  6232 	$run eval "$install_prog\$stripme \$file \$destfile" || exit $?
  6233 	test -n "$outputname" && ${rm}r "$tmpdir"
  6234 	;;
  6235       esac
  6236     done
  6237 
  6238     for file in $staticlibs; do
  6239       name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
  6240 
  6241       # Set up the ranlib parameters.
  6242       oldlib="$destdir/$name"
  6243 
  6244       $show "$install_prog $file $oldlib"
  6245       $run eval "$install_prog \$file \$oldlib" || exit $?
  6246 
  6247       if test -n "$stripme" && test -n "$old_striplib"; then
  6248 	$show "$old_striplib $oldlib"
  6249 	$run eval "$old_striplib $oldlib" || exit $?
  6250       fi
  6251 
  6252       # Do each command in the postinstall commands.
  6253       cmds=$old_postinstall_cmds
  6254       save_ifs="$IFS"; IFS='~'
  6255       for cmd in $cmds; do
  6256 	IFS="$save_ifs"
  6257 	eval cmd=\"$cmd\"
  6258 	$show "$cmd"
  6259 	$run eval "$cmd" || exit $?
  6260       done
  6261       IFS="$save_ifs"
  6262     done
  6263 
  6264     if test -n "$future_libdirs"; then
  6265       $echo "$modename: warning: remember to run \`$progname --finish$future_libdirs'" 1>&2
  6266     fi
  6267 
  6268     if test -n "$current_libdirs"; then
  6269       # Maybe just do a dry run.
  6270       test -n "$run" && current_libdirs=" -n$current_libdirs"
  6271       exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs'
  6272     else
  6273       exit $EXIT_SUCCESS
  6274     fi
  6275     ;;
  6276 
  6277   # libtool finish mode
  6278   finish)
  6279     modename="$modename: finish"
  6280     libdirs="$nonopt"
  6281     admincmds=
  6282 
  6283     if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
  6284       for dir
  6285       do
  6286 	libdirs="$libdirs $dir"
  6287       done
  6288 
  6289       for libdir in $libdirs; do
  6290 	if test -n "$finish_cmds"; then
  6291 	  # Do each command in the finish commands.
  6292 	  cmds=$finish_cmds
  6293 	  save_ifs="$IFS"; IFS='~'
  6294 	  for cmd in $cmds; do
  6295 	    IFS="$save_ifs"
  6296 	    eval cmd=\"$cmd\"
  6297 	    $show "$cmd"
  6298 	    $run eval "$cmd" || admincmds="$admincmds
  6299        $cmd"
  6300 	  done
  6301 	  IFS="$save_ifs"
  6302 	fi
  6303 	if test -n "$finish_eval"; then
  6304 	  # Do the single finish_eval.
  6305 	  eval cmds=\"$finish_eval\"
  6306 	  $run eval "$cmds" || admincmds="$admincmds
  6307        $cmds"
  6308 	fi
  6309       done
  6310     fi
  6311 
  6312     # Exit here if they wanted silent mode.
  6313     test "$show" = : && exit $EXIT_SUCCESS
  6314 
  6315     $echo "X----------------------------------------------------------------------" | $Xsed
  6316     $echo "Libraries have been installed in:"
  6317     for libdir in $libdirs; do
  6318       $echo "   $libdir"
  6319     done
  6320     $echo
  6321     $echo "If you ever happen to want to link against installed libraries"
  6322     $echo "in a given directory, LIBDIR, you must either use libtool, and"
  6323     $echo "specify the full pathname of the library, or use the \`-LLIBDIR'"
  6324     $echo "flag during linking and do at least one of the following:"
  6325     if test -n "$shlibpath_var"; then
  6326       $echo "   - add LIBDIR to the \`$shlibpath_var' environment variable"
  6327       $echo "     during execution"
  6328     fi
  6329     if test -n "$runpath_var"; then
  6330       $echo "   - add LIBDIR to the \`$runpath_var' environment variable"
  6331       $echo "     during linking"
  6332     fi
  6333     if test -n "$hardcode_libdir_flag_spec"; then
  6334       libdir=LIBDIR
  6335       eval flag=\"$hardcode_libdir_flag_spec\"
  6336 
  6337       $echo "   - use the \`$flag' linker flag"
  6338     fi
  6339     if test -n "$admincmds"; then
  6340       $echo "   - have your system administrator run these commands:$admincmds"
  6341     fi
  6342     if test -f /etc/ld.so.conf; then
  6343       $echo "   - have your system administrator add LIBDIR to \`/etc/ld.so.conf'"
  6344     fi
  6345     $echo
  6346     $echo "See any operating system documentation about shared libraries for"
  6347     $echo "more information, such as the ld(1) and ld.so(8) manual pages."
  6348     $echo "X----------------------------------------------------------------------" | $Xsed
  6349     exit $EXIT_SUCCESS
  6350     ;;
  6351 
  6352   # libtool execute mode
  6353   execute)
  6354     modename="$modename: execute"
  6355 
  6356     # The first argument is the command name.
  6357     cmd="$nonopt"
  6358     if test -z "$cmd"; then
  6359       $echo "$modename: you must specify a COMMAND" 1>&2
  6360       $echo "$help"
  6361       exit $EXIT_FAILURE
  6362     fi
  6363 
  6364     # Handle -dlopen flags immediately.
  6365     for file in $execute_dlfiles; do
  6366       if test ! -f "$file"; then
  6367 	$echo "$modename: \`$file' is not a file" 1>&2
  6368 	$echo "$help" 1>&2
  6369 	exit $EXIT_FAILURE
  6370       fi
  6371 
  6372       dir=
  6373       case $file in
  6374       *.la)
  6375 	# Check to see that this really is a libtool archive.
  6376 	if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
  6377 	else
  6378 	  $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
  6379 	  $echo "$help" 1>&2
  6380 	  exit $EXIT_FAILURE
  6381 	fi
  6382 
  6383 	# Read the libtool library.
  6384 	dlname=
  6385 	library_names=
  6386 
  6387 	# If there is no directory component, then add one.
  6388 	case $file in
  6389 	*/* | *\\*) . $file ;;
  6390 	*) . ./$file ;;
  6391 	esac
  6392 
  6393 	# Skip this library if it cannot be dlopened.
  6394 	if test -z "$dlname"; then
  6395 	  # Warn if it was a shared library.
  6396 	  test -n "$library_names" && $echo "$modename: warning: \`$file' was not linked with \`-export-dynamic'"
  6397 	  continue
  6398 	fi
  6399 
  6400 	dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
  6401 	test "X$dir" = "X$file" && dir=.
  6402 
  6403 	if test -f "$dir/$objdir/$dlname"; then
  6404 	  dir="$dir/$objdir"
  6405 	else
  6406 	  $echo "$modename: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2
  6407 	  exit $EXIT_FAILURE
  6408 	fi
  6409 	;;
  6410 
  6411       *.lo)
  6412 	# Just add the directory containing the .lo file.
  6413 	dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
  6414 	test "X$dir" = "X$file" && dir=.
  6415 	;;
  6416 
  6417       *)
  6418 	$echo "$modename: warning \`-dlopen' is ignored for non-libtool libraries and objects" 1>&2
  6419 	continue
  6420 	;;
  6421       esac
  6422 
  6423       # Get the absolute pathname.
  6424       absdir=`cd "$dir" && pwd`
  6425       test -n "$absdir" && dir="$absdir"
  6426 
  6427       # Now add the directory to shlibpath_var.
  6428       if eval "test -z \"\$$shlibpath_var\""; then
  6429 	eval "$shlibpath_var=\"\$dir\""
  6430       else
  6431 	eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\""
  6432       fi
  6433     done
  6434 
  6435     # This variable tells wrapper scripts just to set shlibpath_var
  6436     # rather than running their programs.
  6437     libtool_execute_magic="$magic"
  6438 
  6439     # Check if any of the arguments is a wrapper script.
  6440     args=
  6441     for file
  6442     do
  6443       case $file in
  6444       -*) ;;
  6445       *)
  6446 	# Do a test to see if this is really a libtool program.
  6447 	if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
  6448 	  # If there is no directory component, then add one.
  6449 	  case $file in
  6450 	  */* | *\\*) . $file ;;
  6451 	  *) . ./$file ;;
  6452 	  esac
  6453 
  6454 	  # Transform arg to wrapped name.
  6455 	  file="$progdir/$program"
  6456 	fi
  6457 	;;
  6458       esac
  6459       # Quote arguments (to preserve shell metacharacters).
  6460       file=`$echo "X$file" | $Xsed -e "$sed_quote_subst"`
  6461       args="$args \"$file\""
  6462     done
  6463 
  6464     if test -z "$run"; then
  6465       if test -n "$shlibpath_var"; then
  6466 	# Export the shlibpath_var.
  6467 	eval "export $shlibpath_var"
  6468       fi
  6469 
  6470       # Restore saved environment variables
  6471       if test "${save_LC_ALL+set}" = set; then
  6472 	LC_ALL="$save_LC_ALL"; export LC_ALL
  6473       fi
  6474       if test "${save_LANG+set}" = set; then
  6475 	LANG="$save_LANG"; export LANG
  6476       fi
  6477 
  6478       # Now prepare to actually exec the command.
  6479       exec_cmd="\$cmd$args"
  6480     else
  6481       # Display what would be done.
  6482       if test -n "$shlibpath_var"; then
  6483 	eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\""
  6484 	$echo "export $shlibpath_var"
  6485       fi
  6486       $echo "$cmd$args"
  6487       exit $EXIT_SUCCESS
  6488     fi
  6489     ;;
  6490 
  6491   # libtool clean and uninstall mode
  6492   clean | uninstall)
  6493     modename="$modename: $mode"
  6494     rm="$nonopt"
  6495     files=
  6496     rmforce=
  6497     exit_status=0
  6498 
  6499     # This variable tells wrapper scripts just to set variables rather
  6500     # than running their programs.
  6501     libtool_install_magic="$magic"
  6502 
  6503     for arg
  6504     do
  6505       case $arg in
  6506       -f) rm="$rm $arg"; rmforce=yes ;;
  6507       -*) rm="$rm $arg" ;;
  6508       *) files="$files $arg" ;;
  6509       esac
  6510     done
  6511 
  6512     if test -z "$rm"; then
  6513       $echo "$modename: you must specify an RM program" 1>&2
  6514       $echo "$help" 1>&2
  6515       exit $EXIT_FAILURE
  6516     fi
  6517 
  6518     rmdirs=
  6519 
  6520     origobjdir="$objdir"
  6521     for file in $files; do
  6522       dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
  6523       if test "X$dir" = "X$file"; then
  6524 	dir=.
  6525 	objdir="$origobjdir"
  6526       else
  6527 	objdir="$dir/$origobjdir"
  6528       fi
  6529       name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
  6530       test "$mode" = uninstall && objdir="$dir"
  6531 
  6532       # Remember objdir for removal later, being careful to avoid duplicates
  6533       if test "$mode" = clean; then
  6534 	case " $rmdirs " in
  6535 	  *" $objdir "*) ;;
  6536 	  *) rmdirs="$rmdirs $objdir" ;;
  6537 	esac
  6538       fi
  6539 
  6540       # Don't error if the file doesn't exist and rm -f was used.
  6541       if (test -L "$file") >/dev/null 2>&1 \
  6542 	|| (test -h "$file") >/dev/null 2>&1 \
  6543 	|| test -f "$file"; then
  6544 	:
  6545       elif test -d "$file"; then
  6546 	exit_status=1
  6547 	continue
  6548       elif test "$rmforce" = yes; then
  6549 	continue
  6550       fi
  6551 
  6552       rmfiles="$file"
  6553 
  6554       case $name in
  6555       *.la)
  6556 	# Possibly a libtool archive, so verify it.
  6557 	if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
  6558 	  . $dir/$name
  6559 
  6560 	  # Delete the libtool libraries and symlinks.
  6561 	  for n in $library_names; do
  6562 	    rmfiles="$rmfiles $objdir/$n"
  6563 	  done
  6564 	  test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library"
  6565 
  6566 	  case "$mode" in
  6567 	  clean)
  6568 	    case "  $library_names " in
  6569 	    # "  " in the beginning catches empty $dlname
  6570 	    *" $dlname "*) ;;
  6571 	    *) rmfiles="$rmfiles $objdir/$dlname" ;;
  6572 	    esac
  6573 	     test -n "$libdir" && rmfiles="$rmfiles $objdir/$name $objdir/${name}i"
  6574 	    ;;
  6575 	  uninstall)
  6576 	    if test -n "$library_names"; then
  6577 	      # Do each command in the postuninstall commands.
  6578 	      cmds=$postuninstall_cmds
  6579 	      save_ifs="$IFS"; IFS='~'
  6580 	      for cmd in $cmds; do
  6581 		IFS="$save_ifs"
  6582 		eval cmd=\"$cmd\"
  6583 		$show "$cmd"
  6584 		$run eval "$cmd"
  6585 		if test "$?" -ne 0 && test "$rmforce" != yes; then
  6586 		  exit_status=1
  6587 		fi
  6588 	      done
  6589 	      IFS="$save_ifs"
  6590 	    fi
  6591 
  6592 	    if test -n "$old_library"; then
  6593 	      # Do each command in the old_postuninstall commands.
  6594 	      cmds=$old_postuninstall_cmds
  6595 	      save_ifs="$IFS"; IFS='~'
  6596 	      for cmd in $cmds; do
  6597 		IFS="$save_ifs"
  6598 		eval cmd=\"$cmd\"
  6599 		$show "$cmd"
  6600 		$run eval "$cmd"
  6601 		if test "$?" -ne 0 && test "$rmforce" != yes; then
  6602 		  exit_status=1
  6603 		fi
  6604 	      done
  6605 	      IFS="$save_ifs"
  6606 	    fi
  6607 	    # FIXME: should reinstall the best remaining shared library.
  6608 	    ;;
  6609 	  esac
  6610 	fi
  6611 	;;
  6612 
  6613       *.lo)
  6614 	# Possibly a libtool object, so verify it.
  6615 	if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
  6616 
  6617 	  # Read the .lo file
  6618 	  . $dir/$name
  6619 
  6620 	  # Add PIC object to the list of files to remove.
  6621 	  if test -n "$pic_object" \
  6622 	     && test "$pic_object" != none; then
  6623 	    rmfiles="$rmfiles $dir/$pic_object"
  6624 	  fi
  6625 
  6626 	  # Add non-PIC object to the list of files to remove.
  6627 	  if test -n "$non_pic_object" \
  6628 	     && test "$non_pic_object" != none; then
  6629 	    rmfiles="$rmfiles $dir/$non_pic_object"
  6630 	  fi
  6631 	fi
  6632 	;;
  6633 
  6634       *)
  6635 	if test "$mode" = clean ; then
  6636 	  noexename=$name
  6637 	  case $file in
  6638 	  *.exe)
  6639 	    file=`$echo $file|${SED} 's,.exe$,,'`
  6640 	    noexename=`$echo $name|${SED} 's,.exe$,,'`
  6641 	    # $file with .exe has already been added to rmfiles,
  6642 	    # add $file without .exe
  6643 	    rmfiles="$rmfiles $file"
  6644