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