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