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