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