OSDN Git Service

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