fixed z-order problems in poly2bitmap
[swftools.git] / 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, 2006,
5 # 2007, 2008  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 basename="s,^.*/,,g"
28
29 # Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh
30 # is ksh but when the shell is invoked as "sh" and the current value of
31 # the _XPG environment variable is not equal to 1 (one), the special
32 # positional parameter $0, within a function call, is the name of the
33 # function.
34 progpath="$0"
35
36 # The name of this program:
37 progname=`echo "$progpath" | $SED $basename`
38 modename="$progname"
39
40 # Global variables:
41 EXIT_SUCCESS=0
42 EXIT_FAILURE=1
43
44 PROGRAM=ltmain.sh
45 PACKAGE=libtool
46 VERSION=1.5.26
47 TIMESTAMP=" (1.1220.2.493 2008/02/01 16:58:18)"
48
49 # Be Bourne compatible (taken from Autoconf:_AS_BOURNE_COMPATIBLE).
50 if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
51   emulate sh
52   NULLCMD=:
53   # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
54   # is contrary to our usage.  Disable this feature.
55   alias -g '${1+"$@"}'='"$@"'
56   setopt NO_GLOB_SUBST
57 else
58   case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac
59 fi
60 BIN_SH=xpg4; export BIN_SH # for Tru64
61 DUALCASE=1; export DUALCASE # for MKS sh
62
63 # Check that we have a working $echo.
64 if test "X$1" = X--no-reexec; then
65   # Discard the --no-reexec flag, and continue.
66   shift
67 elif test "X$1" = X--fallback-echo; then
68   # Avoid inline document here, it may be left over
69   :
70 elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then
71   # Yippee, $echo works!
72   :
73 else
74   # Restart under the correct shell, and then maybe $echo will work.
75   exec $SHELL "$progpath" --no-reexec ${1+"$@"}
76 fi
77
78 if test "X$1" = X--fallback-echo; then
79   # used as fallback echo
80   shift
81   cat <<EOF
82 $*
83 EOF
84   exit $EXIT_SUCCESS
85 fi
86
87 default_mode=
88 help="Try \`$progname --help' for more information."
89 magic="%%%MAGIC variable%%%"
90 mkdir="mkdir"
91 mv="mv -f"
92 rm="rm -f"
93
94 # Sed substitution that helps us do robust quoting.  It backslashifies
95 # metacharacters that are still active within double-quoted strings.
96 Xsed="${SED}"' -e 1s/^X//'
97 sed_quote_subst='s/\([\\`\\"$\\\\]\)/\\\1/g'
98 # test EBCDIC or ASCII
99 case `echo X|tr X '\101'` in
100  A) # ASCII based system
101     # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr
102   SP2NL='tr \040 \012'
103   NL2SP='tr \015\012 \040\040'
104   ;;
105  *) # EBCDIC based system
106   SP2NL='tr \100 \n'
107   NL2SP='tr \r\n \100\100'
108   ;;
109 esac
110
111 # NLS nuisances.
112 # Only set LANG and LC_ALL to C if already set.
113 # These must not be set unconditionally because not all systems understand
114 # e.g. LANG=C (notably SCO).
115 # We save the old values to restore during execute mode.
116 lt_env=
117 for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
118 do
119   eval "if test \"\${$lt_var+set}\" = set; then
120           save_$lt_var=\$$lt_var
121           lt_env=\"$lt_var=\$$lt_var \$lt_env\"
122           $lt_var=C
123           export $lt_var
124         fi"
125 done
126
127 if test -n "$lt_env"; then
128   lt_env="env $lt_env"
129 fi
130
131 # Make sure IFS has a sensible default
132 lt_nl='
133 '
134 IFS="   $lt_nl"
135
136 if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
137   $echo "$modename: not configured to build any kind of library" 1>&2
138   $echo "Fatal configuration error.  See the $PACKAGE docs for more information." 1>&2
139   exit $EXIT_FAILURE
140 fi
141
142 # Global variables.
143 mode=$default_mode
144 nonopt=
145 prev=
146 prevopt=
147 run=
148 show="$echo"
149 show_help=
150 execute_dlfiles=
151 duplicate_deps=no
152 preserve_args=
153 lo2o="s/\\.lo\$/.${objext}/"
154 o2lo="s/\\.${objext}\$/.lo/"
155 extracted_archives=
156 extracted_serial=0
157
158 #####################################
159 # Shell function definitions:
160 # This seems to be the best place for them
161
162 # func_mktempdir [string]
163 # Make a temporary directory that won't clash with other running
164 # libtool processes, and avoids race conditions if possible.  If
165 # given, STRING is the basename for that directory.
166 func_mktempdir ()
167 {
168     my_template="${TMPDIR-/tmp}/${1-$progname}"
169
170     if test "$run" = ":"; then
171       # Return a directory name, but don't create it in dry-run mode
172       my_tmpdir="${my_template}-$$"
173     else
174
175       # If mktemp works, use that first and foremost
176       my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null`
177
178       if test ! -d "$my_tmpdir"; then
179         # Failing that, at least try and use $RANDOM to avoid a race
180         my_tmpdir="${my_template}-${RANDOM-0}$$"
181
182         save_mktempdir_umask=`umask`
183         umask 0077
184         $mkdir "$my_tmpdir"
185         umask $save_mktempdir_umask
186       fi
187
188       # If we're not in dry-run mode, bomb out on failure
189       test -d "$my_tmpdir" || {
190         $echo "cannot create temporary directory \`$my_tmpdir'" 1>&2
191         exit $EXIT_FAILURE
192       }
193     fi
194
195     $echo "X$my_tmpdir" | $Xsed
196 }
197
198
199 # func_win32_libid arg
200 # return the library type of file 'arg'
201 #
202 # Need a lot of goo to handle *both* DLLs and import libs
203 # Has to be a shell function in order to 'eat' the argument
204 # that is supplied when $file_magic_command is called.
205 func_win32_libid ()
206 {
207   win32_libid_type="unknown"
208   win32_fileres=`file -L $1 2>/dev/null`
209   case $win32_fileres in
210   *ar\ archive\ import\ library*) # definitely import
211     win32_libid_type="x86 archive import"
212     ;;
213   *ar\ archive*) # could be an import, or static
214     if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | \
215       $EGREP -e 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then
216       win32_nmres=`eval $NM -f posix -A $1 | \
217         $SED -n -e '1,100{
218                 / I /{
219                         s,.*,import,
220                         p
221                         q
222                         }
223                 }'`
224       case $win32_nmres in
225       import*)  win32_libid_type="x86 archive import";;
226       *)        win32_libid_type="x86 archive static";;
227       esac
228     fi
229     ;;
230   *DLL*)
231     win32_libid_type="x86 DLL"
232     ;;
233   *executable*) # but shell scripts are "executable" too...
234     case $win32_fileres in
235     *MS\ Windows\ PE\ Intel*)
236       win32_libid_type="x86 DLL"
237       ;;
238     esac
239     ;;
240   esac
241   $echo $win32_libid_type
242 }
243
244
245 # func_infer_tag arg
246 # Infer tagged configuration to use if any are available and
247 # if one wasn't chosen via the "--tag" command line option.
248 # Only attempt this if the compiler in the base compile
249 # command doesn't match the default compiler.
250 # arg is usually of the form 'gcc ...'
251 func_infer_tag ()
252 {
253     if test -n "$available_tags" && test -z "$tagname"; then
254       CC_quoted=
255       for arg in $CC; do
256         case $arg in
257           *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
258           arg="\"$arg\""
259           ;;
260         esac
261         CC_quoted="$CC_quoted $arg"
262       done
263       case $@ in
264       # Blanks in the command may have been stripped by the calling shell,
265       # but not from the CC environment variable when configure was run.
266       " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*) ;;
267       # Blanks at the start of $base_compile will cause this to fail
268       # if we don't check for them as well.
269       *)
270         for z in $available_tags; do
271           if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then
272             # Evaluate the configuration.
273             eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`"
274             CC_quoted=
275             for arg in $CC; do
276             # Double-quote args containing other shell metacharacters.
277             case $arg in
278               *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \     ]*|*]*|"")
279               arg="\"$arg\""
280               ;;
281             esac
282             CC_quoted="$CC_quoted $arg"
283           done
284             # user sometimes does CC=<HOST>-gcc so we need to match that to 'gcc'
285             trimedcc=`echo ${CC} | $SED -e "s/${host}-//g"`
286             # and sometimes libtool has CC=<HOST>-gcc but user does CC=gcc
287             extendcc=${host}-${CC}
288             # and sometimes libtool has CC=<OLDHOST>-gcc but user has CC=<NEWHOST>-gcc  
289             # (Gentoo-specific hack because we always export $CHOST)
290             mungedcc=${CHOST-${host}}-${trimedcc}
291             case "$@ " in
292               "cc "* | " cc "* | "${host}-cc "* | " ${host}-cc "*|\
293               "gcc "* | " gcc "* | "${host}-gcc "* | " ${host}-gcc "*)
294               tagname=CC
295               break ;;
296               "$trimedcc "* | " $trimedcc "* | "`$echo $trimedcc` "* | " `$echo $trimedcc` "*|\
297               "$extendcc "* | " $extendcc "* | "`$echo $extendcc` "* | " `$echo $extendcc` "*|\
298               "$mungedcc "* | " $mungedcc "* | "`$echo $mungedcc` "* | " `$echo $mungedcc` "*|\
299               " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*)
300               # The compiler in the base compile command matches
301               # the one in the tagged configuration.
302               # Assume this is the tagged configuration we want.
303               tagname=$z
304               break
305               ;;
306             esac
307           fi
308         done
309         # If $tagname still isn't set, then no tagged configuration
310         # was found and let the user know that the "--tag" command
311         # line option must be used.
312         if test -z "$tagname"; then
313           $echo "$modename: unable to infer tagged configuration"
314           $echo "$modename: specify a tag with \`--tag'" 1>&2
315           exit $EXIT_FAILURE
316 #        else
317 #          $echo "$modename: using $tagname tagged configuration"
318         fi
319         ;;
320       esac
321     fi
322 }
323
324
325 # func_extract_an_archive dir oldlib
326 func_extract_an_archive ()
327 {
328     f_ex_an_ar_dir="$1"; shift
329     f_ex_an_ar_oldlib="$1"
330
331     $show "(cd $f_ex_an_ar_dir && $AR x $f_ex_an_ar_oldlib)"
332     $run eval "(cd \$f_ex_an_ar_dir && $AR x \$f_ex_an_ar_oldlib)" || exit $?
333     if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then
334      :
335     else
336       $echo "$modename: ERROR: object name conflicts: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib" 1>&2
337       exit $EXIT_FAILURE
338     fi
339 }
340
341 # func_extract_archives gentop oldlib ...
342 func_extract_archives ()
343 {
344     my_gentop="$1"; shift
345     my_oldlibs=${1+"$@"}
346     my_oldobjs=""
347     my_xlib=""
348     my_xabs=""
349     my_xdir=""
350     my_status=""
351
352     $show "${rm}r $my_gentop"
353     $run ${rm}r "$my_gentop"
354     $show "$mkdir $my_gentop"
355     $run $mkdir "$my_gentop"
356     my_status=$?
357     if test "$my_status" -ne 0 && test ! -d "$my_gentop"; then
358       exit $my_status
359     fi
360
361     for my_xlib in $my_oldlibs; do
362       # Extract the objects.
363       case $my_xlib in
364         [\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;;
365         *) my_xabs=`pwd`"/$my_xlib" ;;
366       esac
367       my_xlib=`$echo "X$my_xlib" | $Xsed -e 's%^.*/%%'`
368       my_xlib_u=$my_xlib
369       while :; do
370         case " $extracted_archives " in
371         *" $my_xlib_u "*)
372           extracted_serial=`expr $extracted_serial + 1`
373           my_xlib_u=lt$extracted_serial-$my_xlib ;;
374         *) break ;;
375         esac
376       done
377       extracted_archives="$extracted_archives $my_xlib_u"
378       my_xdir="$my_gentop/$my_xlib_u"
379
380       $show "${rm}r $my_xdir"
381       $run ${rm}r "$my_xdir"
382       $show "$mkdir $my_xdir"
383       $run $mkdir "$my_xdir"
384       exit_status=$?
385       if test "$exit_status" -ne 0 && test ! -d "$my_xdir"; then
386         exit $exit_status
387       fi
388       case $host in
389       *-darwin*)
390         $show "Extracting $my_xabs"
391         # Do not bother doing anything if just a dry run
392         if test -z "$run"; then
393           darwin_orig_dir=`pwd`
394           cd $my_xdir || exit $?
395           darwin_archive=$my_xabs
396           darwin_curdir=`pwd`
397           darwin_base_archive=`$echo "X$darwin_archive" | $Xsed -e 's%^.*/%%'`
398           darwin_arches=`lipo -info "$darwin_archive" 2>/dev/null | $EGREP Architectures 2>/dev/null`
399           if test -n "$darwin_arches"; then 
400             darwin_arches=`echo "$darwin_arches" | $SED -e 's/.*are://'`
401             darwin_arch=
402             $show "$darwin_base_archive has multiple architectures $darwin_arches"
403             for darwin_arch in  $darwin_arches ; do
404               mkdir -p "unfat-$$/${darwin_base_archive}-${darwin_arch}"
405               lipo -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}"
406               cd "unfat-$$/${darwin_base_archive}-${darwin_arch}"
407               func_extract_an_archive "`pwd`" "${darwin_base_archive}"
408               cd "$darwin_curdir"
409               $rm "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}"
410             done # $darwin_arches
411       ## Okay now we have a bunch of thin objects, gotta fatten them up :)
412             darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print| xargs basename | sort -u | $NL2SP`
413             darwin_file=
414             darwin_files=
415             for darwin_file in $darwin_filelist; do
416               darwin_files=`find unfat-$$ -name $darwin_file -print | $NL2SP`
417               lipo -create -output "$darwin_file" $darwin_files
418             done # $darwin_filelist
419             ${rm}r unfat-$$
420             cd "$darwin_orig_dir"
421           else
422             cd "$darwin_orig_dir"
423             func_extract_an_archive "$my_xdir" "$my_xabs"
424           fi # $darwin_arches
425         fi # $run
426         ;;
427       *)
428         func_extract_an_archive "$my_xdir" "$my_xabs"
429         ;;
430       esac
431       my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP`
432     done
433     func_extract_archives_result="$my_oldobjs"
434 }
435 # End of Shell function definitions
436 #####################################
437
438 # Darwin sucks
439 eval std_shrext=\"$shrext_cmds\"
440
441 disable_libs=no
442
443 # Parse our command line options once, thoroughly.
444 while test "$#" -gt 0
445 do
446   arg="$1"
447   shift
448
449   case $arg in
450   -*=*) optarg=`$echo "X$arg" | $Xsed -e 's/[-_a-zA-Z0-9]*=//'` ;;
451   *) optarg= ;;
452   esac
453
454   # If the previous option needs an argument, assign it.
455   if test -n "$prev"; then
456     case $prev in
457     execute_dlfiles)
458       execute_dlfiles="$execute_dlfiles $arg"
459       ;;
460     tag)
461       tagname="$arg"
462       preserve_args="${preserve_args}=$arg"
463
464       # Check whether tagname contains only valid characters
465       case $tagname in
466       *[!-_A-Za-z0-9,/]*)
467         $echo "$progname: invalid tag name: $tagname" 1>&2
468         exit $EXIT_FAILURE
469         ;;
470       esac
471
472       case $tagname in
473       CC)
474         # Don't test for the "default" C tag, as we know, it's there, but
475         # not specially marked.
476         ;;
477       *)
478         if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "$progpath" > /dev/null; then
479           taglist="$taglist $tagname"
480           # Evaluate the configuration.
481           eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$tagname'$/,/^# ### END LIBTOOL TAG CONFIG: '$tagname'$/p' < $progpath`"
482         else
483           $echo "$progname: ignoring unknown tag $tagname" 1>&2
484         fi
485         ;;
486       esac
487       ;;
488     *)
489       eval "$prev=\$arg"
490       ;;
491     esac
492
493     prev=
494     prevopt=
495     continue
496   fi
497
498   # Have we seen a non-optional argument yet?
499   case $arg in
500   --help)
501     show_help=yes
502     ;;
503
504   --version)
505     echo "\
506 $PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP
507
508 Copyright (C) 2008  Free Software Foundation, Inc.
509 This is free software; see the source for copying conditions.  There is NO
510 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
511     exit $?
512     ;;
513
514   --config)
515     ${SED} -e '1,/^# ### BEGIN LIBTOOL CONFIG/d' -e '/^# ### END LIBTOOL CONFIG/,$d' $progpath
516     # Now print the configurations for the tags.
517     for tagname in $taglist; do
518       ${SED} -n -e "/^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$/,/^# ### END LIBTOOL TAG CONFIG: $tagname$/p" < "$progpath"
519     done
520     exit $?
521     ;;
522
523   --debug)
524     $echo "$progname: enabling shell trace mode"
525     set -x
526     preserve_args="$preserve_args $arg"
527     ;;
528
529   --dry-run | -n)
530     run=:
531     ;;
532
533   --features)
534     $echo "host: $host"
535     if test "$build_libtool_libs" = yes; then
536       $echo "enable shared libraries"
537     else
538       $echo "disable shared libraries"
539     fi
540     if test "$build_old_libs" = yes; then
541       $echo "enable static libraries"
542     else
543       $echo "disable static libraries"
544     fi
545     exit $?
546     ;;
547
548   --finish) mode="finish" ;;
549
550   --mode) prevopt="--mode" prev=mode ;;
551   --mode=*) mode="$optarg" ;;
552
553   --preserve-dup-deps) duplicate_deps="yes" ;;
554
555   --quiet | --silent)
556     show=:
557     preserve_args="$preserve_args $arg"
558     ;;
559
560   --tag)
561     prevopt="--tag"
562     prev=tag
563     preserve_args="$preserve_args --tag"
564     ;;
565   --tag=*)
566     set tag "$optarg" ${1+"$@"}
567     shift
568     prev=tag
569     preserve_args="$preserve_args --tag"
570     ;;
571
572   -dlopen)
573     prevopt="-dlopen"
574     prev=execute_dlfiles
575     ;;
576
577   -*)
578     $echo "$modename: unrecognized option \`$arg'" 1>&2
579     $echo "$help" 1>&2
580     exit $EXIT_FAILURE
581     ;;
582
583   *)
584     nonopt="$arg"
585     break
586     ;;
587   esac
588 done
589
590 if test -n "$prevopt"; then
591   $echo "$modename: option \`$prevopt' requires an argument" 1>&2
592   $echo "$help" 1>&2
593   exit $EXIT_FAILURE
594 fi
595
596 case $disable_libs in
597 no) 
598   ;;
599 shared)
600   build_libtool_libs=no
601   build_old_libs=yes
602   ;;
603 static)
604   build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac`
605   ;;
606 esac
607
608 # If this variable is set in any of the actions, the command in it
609 # will be execed at the end.  This prevents here-documents from being
610 # left over by shells.
611 exec_cmd=
612
613 if test -z "$show_help"; then
614
615   # Infer the operation mode.
616   if test -z "$mode"; then
617     $echo "*** Warning: inferring the mode of operation is deprecated." 1>&2
618     $echo "*** Future versions of Libtool will require --mode=MODE be specified." 1>&2
619     case $nonopt in
620     *cc | cc* | *++ | gcc* | *-gcc* | g++* | xlc*)
621       mode=link
622       for arg
623       do
624         case $arg in
625         -c)
626            mode=compile
627            break
628            ;;
629         esac
630       done
631       ;;
632     *db | *dbx | *strace | *truss)
633       mode=execute
634       ;;
635     *install*|cp|mv)
636       mode=install
637       ;;
638     *rm)
639       mode=uninstall
640       ;;
641     *)
642       # If we have no mode, but dlfiles were specified, then do execute mode.
643       test -n "$execute_dlfiles" && mode=execute
644
645       # Just use the default operation mode.
646       if test -z "$mode"; then
647         if test -n "$nonopt"; then
648           $echo "$modename: warning: cannot infer operation mode from \`$nonopt'" 1>&2
649         else
650           $echo "$modename: warning: cannot infer operation mode without MODE-ARGS" 1>&2
651         fi
652       fi
653       ;;
654     esac
655   fi
656
657   # Only execute mode is allowed to have -dlopen flags.
658   if test -n "$execute_dlfiles" && test "$mode" != execute; then
659     $echo "$modename: unrecognized option \`-dlopen'" 1>&2
660     $echo "$help" 1>&2
661     exit $EXIT_FAILURE
662   fi
663
664   # Change the help message to a mode-specific one.
665   generic_help="$help"
666   help="Try \`$modename --help --mode=$mode' for more information."
667
668   # These modes are in order of execution frequency so that they run quickly.
669   case $mode in
670   # libtool compile mode
671   compile)
672     modename="$modename: compile"
673     # Get the compilation command and the source file.
674     base_compile=
675     srcfile="$nonopt"  #  always keep a non-empty value in "srcfile"
676     suppress_opt=yes
677     suppress_output=
678     arg_mode=normal
679     libobj=
680     later=
681
682     for arg
683     do
684       case $arg_mode in
685       arg  )
686         # do not "continue".  Instead, add this to base_compile
687         lastarg="$arg"
688         arg_mode=normal
689         ;;
690
691       target )
692         libobj="$arg"
693         arg_mode=normal
694         continue
695         ;;
696
697       normal )
698         # Accept any command-line options.
699         case $arg in
700         -o)
701           if test -n "$libobj" ; then
702             $echo "$modename: you cannot specify \`-o' more than once" 1>&2
703             exit $EXIT_FAILURE
704           fi
705           arg_mode=target
706           continue
707           ;;
708
709         -static | -prefer-pic | -prefer-non-pic)
710           later="$later $arg"
711           continue
712           ;;
713
714         -no-suppress)
715           suppress_opt=no
716           continue
717           ;;
718
719         -Xcompiler)
720           arg_mode=arg  #  the next one goes into the "base_compile" arg list
721           continue      #  The current "srcfile" will either be retained or
722           ;;            #  replaced later.  I would guess that would be a bug.
723
724         -Wc,*)
725           args=`$echo "X$arg" | $Xsed -e "s/^-Wc,//"`
726           lastarg=
727           save_ifs="$IFS"; IFS=','
728           for arg in $args; do
729             IFS="$save_ifs"
730
731             # Double-quote args containing other shell metacharacters.
732             # Many Bourne shells cannot handle close brackets correctly
733             # in scan sets, so we specify it separately.
734             case $arg in
735               *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \     ]*|*]*|"")
736               arg="\"$arg\""
737               ;;
738             esac
739             lastarg="$lastarg $arg"
740           done
741           IFS="$save_ifs"
742           lastarg=`$echo "X$lastarg" | $Xsed -e "s/^ //"`
743
744           # Add the arguments to base_compile.
745           base_compile="$base_compile $lastarg"
746           continue
747           ;;
748
749         * )
750           # Accept the current argument as the source file.
751           # The previous "srcfile" becomes the current argument.
752           #
753           lastarg="$srcfile"
754           srcfile="$arg"
755           ;;
756         esac  #  case $arg
757         ;;
758       esac    #  case $arg_mode
759
760       # Aesthetically quote the previous argument.
761       lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"`
762
763       case $lastarg in
764       # Double-quote args containing other shell metacharacters.
765       # Many Bourne shells cannot handle close brackets correctly
766       # in scan sets, and some SunOS ksh mistreat backslash-escaping
767       # in scan sets (worked around with variable expansion),
768       # and furthermore cannot handle '|' '&' '(' ')' in scan sets 
769       # at all, so we specify them separately.
770       *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \     ]*|*]*|"")
771         lastarg="\"$lastarg\""
772         ;;
773       esac
774
775       base_compile="$base_compile $lastarg"
776     done # for arg
777
778     case $arg_mode in
779     arg)
780       $echo "$modename: you must specify an argument for -Xcompile"
781       exit $EXIT_FAILURE
782       ;;
783     target)
784       $echo "$modename: you must specify a target with \`-o'" 1>&2
785       exit $EXIT_FAILURE
786       ;;
787     *)
788       # Get the name of the library object.
789       [ -z "$libobj" ] && libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'`
790       ;;
791     esac
792
793     # Recognize several different file suffixes.
794     # If the user specifies -o file.o, it is replaced with file.lo
795     xform='[cCFSifmso]'
796     case $libobj in
797     *.ada) xform=ada ;;
798     *.adb) xform=adb ;;
799     *.ads) xform=ads ;;
800     *.asm) xform=asm ;;
801     *.c++) xform=c++ ;;
802     *.cc) xform=cc ;;
803     *.ii) xform=ii ;;
804     *.class) xform=class ;;
805     *.cpp) xform=cpp ;;
806     *.cxx) xform=cxx ;;
807     *.[fF][09]?) xform=[fF][09]. ;;
808     *.for) xform=for ;;
809     *.java) xform=java ;;
810     *.obj) xform=obj ;;
811     *.sx) xform=sx ;;
812     esac
813
814     libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"`
815
816     case $libobj in
817     *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;;
818     *)
819       $echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2
820       exit $EXIT_FAILURE
821       ;;
822     esac
823
824     func_infer_tag $base_compile
825
826     for arg in $later; do
827       case $arg in
828       -static)
829         build_old_libs=yes
830         continue
831         ;;
832
833       -prefer-pic)
834         pic_mode=yes
835         continue
836         ;;
837
838       -prefer-non-pic)
839         pic_mode=no
840         continue
841         ;;
842       esac
843     done
844
845     qlibobj=`$echo "X$libobj" | $Xsed -e "$sed_quote_subst"`
846     case $qlibobj in
847       *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \     ]*|*]*|"")
848         qlibobj="\"$qlibobj\"" ;;
849     esac
850     test "X$libobj" != "X$qlibobj" \
851         && $echo "X$libobj" | grep '[]~#^*{};<>?"'"'"'  &()|`$[]' \
852         && $echo "$modename: libobj name \`$libobj' may not contain shell special characters."
853     objname=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
854     xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'`
855     if test "X$xdir" = "X$obj"; then
856       xdir=
857     else
858       xdir=$xdir/
859     fi
860     lobj=${xdir}$objdir/$objname
861
862     if test -z "$base_compile"; then
863       $echo "$modename: you must specify a compilation command" 1>&2
864       $echo "$help" 1>&2
865       exit $EXIT_FAILURE
866     fi
867
868     # Delete any leftover library objects.
869     if test "$build_old_libs" = yes; then
870       removelist="$obj $lobj $libobj ${libobj}T"
871     else
872       removelist="$lobj $libobj ${libobj}T"
873     fi
874
875     $run $rm $removelist
876     trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15
877
878     # On Cygwin there's no "real" PIC flag so we must build both object types
879     case $host_os in
880     cygwin* | mingw* | pw32* | os2*)
881       pic_mode=default
882       ;;
883     esac
884     if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then
885       # non-PIC code in shared libraries is not supported
886       pic_mode=default
887     fi
888
889     # Calculate the filename of the output object if compiler does
890     # not support -o with -c
891     if test "$compiler_c_o" = no; then
892       output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext}
893       lockfile="$output_obj.lock"
894       removelist="$removelist $output_obj $lockfile"
895       trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15
896     else
897       output_obj=
898       need_locks=no
899       lockfile=
900     fi
901
902     # Lock this critical section if it is needed
903     # We use this script file to make the link, it avoids creating a new file
904     if test "$need_locks" = yes; then
905       until $run ln "$srcfile" "$lockfile" 2>/dev/null; do
906         $show "Waiting for $lockfile to be removed"
907         sleep 2
908       done
909     elif test "$need_locks" = warn; then
910       if test -f "$lockfile"; then
911         $echo "\
912 *** ERROR, $lockfile exists and contains:
913 `cat $lockfile 2>/dev/null`
914
915 This indicates that another process is trying to use the same
916 temporary object file, and libtool could not work around it because
917 your compiler does not support \`-c' and \`-o' together.  If you
918 repeat this compilation, it may succeed, by chance, but you had better
919 avoid parallel builds (make -j) in this platform, or get a better
920 compiler."
921
922         $run $rm $removelist
923         exit $EXIT_FAILURE
924       fi
925       $echo "$srcfile" > "$lockfile"
926     fi
927
928     if test -n "$fix_srcfile_path"; then
929       eval srcfile=\"$fix_srcfile_path\"
930     fi
931     qsrcfile=`$echo "X$srcfile" | $Xsed -e "$sed_quote_subst"`
932     case $qsrcfile in
933       *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \     ]*|*]*|"")
934       qsrcfile="\"$qsrcfile\"" ;;
935     esac
936
937     $run $rm "$libobj" "${libobj}T"
938
939     # Create a libtool object file (analogous to a ".la" file),
940     # but don't create it if we're doing a dry run.
941     test -z "$run" && cat > ${libobj}T <<EOF
942 # $libobj - a libtool object file
943 # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
944 #
945 # Please DO NOT delete this file!
946 # It is necessary for linking the library.
947
948 # Name of the PIC object.
949 EOF
950
951     # Only build a PIC object if we are building libtool libraries.
952     if test "$build_libtool_libs" = yes; then
953       # Without this assignment, base_compile gets emptied.
954       fbsd_hideous_sh_bug=$base_compile
955
956       if test "$pic_mode" != no; then
957         command="$base_compile $qsrcfile $pic_flag"
958       else
959         # Don't build PIC code
960         command="$base_compile $qsrcfile"
961       fi
962
963       if test ! -d "${xdir}$objdir"; then
964         $show "$mkdir ${xdir}$objdir"
965         $run $mkdir ${xdir}$objdir
966         exit_status=$?
967         if test "$exit_status" -ne 0 && test ! -d "${xdir}$objdir"; then
968           exit $exit_status
969         fi
970       fi
971
972       if test -z "$output_obj"; then
973         # Place PIC objects in $objdir
974         command="$command -o $lobj"
975       fi
976
977       $run $rm "$lobj" "$output_obj"
978
979       $show "$command"
980       if $run eval $lt_env "$command"; then :
981       else
982         test -n "$output_obj" && $run $rm $removelist
983         exit $EXIT_FAILURE
984       fi
985
986       if test "$need_locks" = warn &&
987          test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
988         $echo "\
989 *** ERROR, $lockfile contains:
990 `cat $lockfile 2>/dev/null`
991
992 but it should contain:
993 $srcfile
994
995 This indicates that another process is trying to use the same
996 temporary object file, and libtool could not work around it because
997 your compiler does not support \`-c' and \`-o' together.  If you
998 repeat this compilation, it may succeed, by chance, but you had better
999 avoid parallel builds (make -j) in this platform, or get a better
1000 compiler."
1001
1002         $run $rm $removelist
1003         exit $EXIT_FAILURE
1004       fi
1005
1006       # Just move the object if needed, then go on to compile the next one
1007       if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then
1008         $show "$mv $output_obj $lobj"
1009         if $run $mv $output_obj $lobj; then :
1010         else
1011           error=$?
1012           $run $rm $removelist
1013           exit $error
1014         fi
1015       fi
1016
1017       # Append the name of the PIC object to the libtool object file.
1018       test -z "$run" && cat >> ${libobj}T <<EOF
1019 pic_object='$objdir/$objname'
1020
1021 EOF
1022
1023       # Allow error messages only from the first compilation.
1024       if test "$suppress_opt" = yes; then
1025         suppress_output=' >/dev/null 2>&1'
1026       fi
1027     else
1028       # No PIC object so indicate it doesn't exist in the libtool
1029       # object file.
1030       test -z "$run" && cat >> ${libobj}T <<EOF
1031 pic_object=none
1032
1033 EOF
1034     fi
1035
1036     # Only build a position-dependent object if we build old libraries.
1037     if test "$build_old_libs" = yes; then
1038       if test "$pic_mode" != yes; then
1039         # Don't build PIC code
1040         command="$base_compile $qsrcfile"
1041       else
1042         command="$base_compile $qsrcfile $pic_flag"
1043       fi
1044       if test "$compiler_c_o" = yes; then
1045         command="$command -o $obj"
1046       fi
1047
1048       # Suppress compiler output if we already did a PIC compilation.
1049       command="$command$suppress_output"
1050       $run $rm "$obj" "$output_obj"
1051       $show "$command"
1052       if $run eval $lt_env "$command"; then :
1053       else
1054         $run $rm $removelist
1055         exit $EXIT_FAILURE
1056       fi
1057
1058       if test "$need_locks" = warn &&
1059          test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
1060         $echo "\
1061 *** ERROR, $lockfile contains:
1062 `cat $lockfile 2>/dev/null`
1063
1064 but it should contain:
1065 $srcfile
1066
1067 This indicates that another process is trying to use the same
1068 temporary object file, and libtool could not work around it because
1069 your compiler does not support \`-c' and \`-o' together.  If you
1070 repeat this compilation, it may succeed, by chance, but you had better
1071 avoid parallel builds (make -j) in this platform, or get a better
1072 compiler."
1073
1074         $run $rm $removelist
1075         exit $EXIT_FAILURE
1076       fi
1077
1078       # Just move the object if needed
1079       if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then
1080         $show "$mv $output_obj $obj"
1081         if $run $mv $output_obj $obj; then :
1082         else
1083           error=$?
1084           $run $rm $removelist
1085           exit $error
1086         fi
1087       fi
1088
1089       # Append the name of the non-PIC object the libtool object file.
1090       # Only append if the libtool object file exists.
1091       test -z "$run" && cat >> ${libobj}T <<EOF
1092 # Name of the non-PIC object.
1093 non_pic_object='$objname'
1094
1095 EOF
1096     else
1097       # Append the name of the non-PIC object the libtool object file.
1098       # Only append if the libtool object file exists.
1099       test -z "$run" && cat >> ${libobj}T <<EOF
1100 # Name of the non-PIC object.
1101 non_pic_object=none
1102
1103 EOF
1104     fi
1105
1106     $run $mv "${libobj}T" "${libobj}"
1107
1108     # Unlock the critical section if it was locked
1109     if test "$need_locks" != no; then
1110       $run $rm "$lockfile"
1111     fi
1112
1113     exit $EXIT_SUCCESS
1114     ;;
1115
1116   # libtool link mode
1117   link | relink)
1118     modename="$modename: link"
1119     case $host in
1120     *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
1121       # It is impossible to link a dll without this setting, and
1122       # we shouldn't force the makefile maintainer to figure out
1123       # which system we are compiling for in order to pass an extra
1124       # flag for every libtool invocation.
1125       # allow_undefined=no
1126
1127       # FIXME: Unfortunately, there are problems with the above when trying
1128       # to make a dll which has undefined symbols, in which case not
1129       # even a static library is built.  For now, we need to specify
1130       # -no-undefined on the libtool link line when we can be certain
1131       # that all symbols are satisfied, otherwise we get a static library.
1132       allow_undefined=yes
1133       ;;
1134     *)
1135       allow_undefined=yes
1136       ;;
1137     esac
1138     libtool_args="$nonopt"
1139     base_compile="$nonopt $@"
1140     compile_command="$nonopt"
1141     finalize_command="$nonopt"
1142
1143     compile_rpath=
1144     finalize_rpath=
1145     compile_shlibpath=
1146     finalize_shlibpath=
1147     convenience=
1148     old_convenience=
1149     deplibs=
1150     old_deplibs=
1151     compiler_flags=
1152     linker_flags=
1153     dllsearchpath=
1154     lib_search_path=`pwd`
1155     inst_prefix_dir=
1156
1157     avoid_version=no
1158     dlfiles=
1159     dlprefiles=
1160     dlself=no
1161     export_dynamic=no
1162     export_symbols=
1163     export_symbols_regex=
1164     generated=
1165     libobjs=
1166     ltlibs=
1167     module=no
1168     no_install=no
1169     objs=
1170     non_pic_objects=
1171     notinst_path= # paths that contain not-installed libtool libraries
1172     precious_files_regex=
1173     prefer_static_libs=no
1174     preload=no
1175     prev=
1176     prevarg=
1177     release=
1178     rpath=
1179     xrpath=
1180     perm_rpath=
1181     temp_rpath=
1182     thread_safe=no
1183     vinfo=
1184     vinfo_number=no
1185     single_module="${wl}-single_module"
1186
1187     func_infer_tag $base_compile
1188
1189     # We need to know -static, to get the right output filenames.
1190     for arg
1191     do
1192       case $arg in
1193       -all-static | -static | -static-libtool-libs)
1194         case $arg in
1195         -all-static)
1196           if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then
1197             $echo "$modename: warning: complete static linking is impossible in this configuration" 1>&2
1198           fi
1199           if test -n "$link_static_flag"; then
1200             dlopen_self=$dlopen_self_static
1201           fi
1202           prefer_static_libs=yes
1203           ;;
1204         -static)
1205           if test -z "$pic_flag" && test -n "$link_static_flag"; then
1206             dlopen_self=$dlopen_self_static
1207           fi
1208           prefer_static_libs=built
1209           ;;
1210         -static-libtool-libs)
1211           if test -z "$pic_flag" && test -n "$link_static_flag"; then
1212             dlopen_self=$dlopen_self_static
1213           fi
1214           prefer_static_libs=yes
1215           ;;
1216         esac
1217         build_libtool_libs=no
1218         build_old_libs=yes
1219         break
1220         ;;
1221       esac
1222     done
1223
1224     # See if our shared archives depend on static archives.
1225     test -n "$old_archive_from_new_cmds" && build_old_libs=yes
1226
1227     # Go through the arguments, transforming them on the way.
1228     while test "$#" -gt 0; do
1229       arg="$1"
1230       shift
1231       case $arg in
1232       *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \     ]*|*]*|"")
1233         qarg=\"`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`\" ### testsuite: skip nested quoting test
1234         ;;
1235       *) qarg=$arg ;;
1236       esac
1237       libtool_args="$libtool_args $qarg"
1238
1239       # If the previous option needs an argument, assign it.
1240       if test -n "$prev"; then
1241         case $prev in
1242         output)
1243           compile_command="$compile_command @OUTPUT@"
1244           finalize_command="$finalize_command @OUTPUT@"
1245           ;;
1246         esac
1247
1248         case $prev in
1249         dlfiles|dlprefiles)
1250           if test "$preload" = no; then
1251             # Add the symbol object into the linking commands.
1252             compile_command="$compile_command @SYMFILE@"
1253             finalize_command="$finalize_command @SYMFILE@"
1254             preload=yes
1255           fi
1256           case $arg in
1257           *.la | *.lo) ;;  # We handle these cases below.
1258           force)
1259             if test "$dlself" = no; then
1260               dlself=needless
1261               export_dynamic=yes
1262             fi
1263             prev=
1264             continue
1265             ;;
1266           self)
1267             if test "$prev" = dlprefiles; then
1268               dlself=yes
1269             elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then
1270               dlself=yes
1271             else
1272               dlself=needless
1273               export_dynamic=yes
1274             fi
1275             prev=
1276             continue
1277             ;;
1278           *)
1279             if test "$prev" = dlfiles; then
1280               dlfiles="$dlfiles $arg"
1281             else
1282               dlprefiles="$dlprefiles $arg"
1283             fi
1284             prev=
1285             continue
1286             ;;
1287           esac
1288           ;;
1289         expsyms)
1290           export_symbols="$arg"
1291           if test ! -f "$arg"; then
1292             $echo "$modename: symbol file \`$arg' does not exist"
1293             exit $EXIT_FAILURE
1294           fi
1295           prev=
1296           continue
1297           ;;
1298         expsyms_regex)
1299           export_symbols_regex="$arg"
1300           prev=
1301           continue
1302           ;;
1303         inst_prefix)
1304           inst_prefix_dir="$arg"
1305           prev=
1306           continue
1307           ;;
1308         precious_regex)
1309           precious_files_regex="$arg"
1310           prev=
1311           continue
1312           ;;
1313         release)
1314           release="-$arg"
1315           prev=
1316           continue
1317           ;;
1318         objectlist)
1319           if test -f "$arg"; then
1320             save_arg=$arg
1321             moreargs=
1322             for fil in `cat $save_arg`
1323             do
1324 #             moreargs="$moreargs $fil"
1325               arg=$fil
1326               # A libtool-controlled object.
1327
1328               # Check to see that this really is a libtool object.
1329               if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
1330                 pic_object=
1331                 non_pic_object=
1332
1333                 # Read the .lo file
1334                 # If there is no directory component, then add one.
1335                 case $arg in
1336                 */* | *\\*) . $arg ;;
1337                 *) . ./$arg ;;
1338                 esac
1339
1340                 if test -z "$pic_object" || \
1341                    test -z "$non_pic_object" ||
1342                    test "$pic_object" = none && \
1343                    test "$non_pic_object" = none; then
1344                   $echo "$modename: cannot find name of object for \`$arg'" 1>&2
1345                   exit $EXIT_FAILURE
1346                 fi
1347
1348                 # Extract subdirectory from the argument.
1349                 xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
1350                 if test "X$xdir" = "X$arg"; then
1351                   xdir=
1352                 else
1353                   xdir="$xdir/"
1354                 fi
1355
1356                 if test "$pic_object" != none; then
1357                   # Prepend the subdirectory the object is found in.
1358                   pic_object="$xdir$pic_object"
1359
1360                   if test "$prev" = dlfiles; then
1361                     if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
1362                       dlfiles="$dlfiles $pic_object"
1363                       prev=
1364                       continue
1365                     else
1366                       # If libtool objects are unsupported, then we need to preload.
1367                       prev=dlprefiles
1368                     fi
1369                   fi
1370
1371                   # CHECK ME:  I think I busted this.  -Ossama
1372                   if test "$prev" = dlprefiles; then
1373                     # Preload the old-style object.
1374                     dlprefiles="$dlprefiles $pic_object"
1375                     prev=
1376                   fi
1377
1378                   # A PIC object.
1379                   libobjs="$libobjs $pic_object"
1380                   arg="$pic_object"
1381                 fi
1382
1383                 # Non-PIC object.
1384                 if test "$non_pic_object" != none; then
1385                   # Prepend the subdirectory the object is found in.
1386                   non_pic_object="$xdir$non_pic_object"
1387
1388                   # A standard non-PIC object
1389                   non_pic_objects="$non_pic_objects $non_pic_object"
1390                   if test -z "$pic_object" || test "$pic_object" = none ; then
1391                     arg="$non_pic_object"
1392                   fi
1393                 else
1394                   # If the PIC object exists, use it instead.
1395                   # $xdir was prepended to $pic_object above.
1396                   non_pic_object="$pic_object"
1397                   non_pic_objects="$non_pic_objects $non_pic_object"
1398                 fi
1399               else
1400                 # Only an error if not doing a dry-run.
1401                 if test -z "$run"; then
1402                   $echo "$modename: \`$arg' is not a valid libtool object" 1>&2
1403                   exit $EXIT_FAILURE
1404                 else
1405                   # Dry-run case.
1406
1407                   # Extract subdirectory from the argument.
1408                   xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
1409                   if test "X$xdir" = "X$arg"; then
1410                     xdir=
1411                   else
1412                     xdir="$xdir/"
1413                   fi
1414
1415                   pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"`
1416                   non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"`
1417                   libobjs="$libobjs $pic_object"
1418                   non_pic_objects="$non_pic_objects $non_pic_object"
1419                 fi
1420               fi
1421             done
1422           else
1423             $echo "$modename: link input file \`$save_arg' does not exist"
1424             exit $EXIT_FAILURE
1425           fi
1426           arg=$save_arg
1427           prev=
1428           continue
1429           ;;
1430         rpath | xrpath)
1431           # We need an absolute path.
1432           case $arg in
1433           [\\/]* | [A-Za-z]:[\\/]*) ;;
1434           *)
1435             $echo "$modename: only absolute run-paths are allowed" 1>&2
1436             exit $EXIT_FAILURE
1437             ;;
1438           esac
1439           if test "$prev" = rpath; then
1440             case "$rpath " in
1441             *" $arg "*) ;;
1442             *) rpath="$rpath $arg" ;;
1443             esac
1444           else
1445             case "$xrpath " in
1446             *" $arg "*) ;;
1447             *) xrpath="$xrpath $arg" ;;
1448             esac
1449           fi
1450           prev=
1451           continue
1452           ;;
1453         xcompiler)
1454           compiler_flags="$compiler_flags $qarg"
1455           prev=
1456           compile_command="$compile_command $qarg"
1457           finalize_command="$finalize_command $qarg"
1458           continue
1459           ;;
1460         xlinker)
1461           linker_flags="$linker_flags $qarg"
1462           compiler_flags="$compiler_flags $wl$qarg"
1463           prev=
1464           compile_command="$compile_command $wl$qarg"
1465           finalize_command="$finalize_command $wl$qarg"
1466           continue
1467           ;;
1468         xcclinker)
1469           linker_flags="$linker_flags $qarg"
1470           compiler_flags="$compiler_flags $qarg"
1471           prev=
1472           compile_command="$compile_command $qarg"
1473           finalize_command="$finalize_command $qarg"
1474           continue
1475           ;;
1476         shrext)
1477           shrext_cmds="$arg"
1478           prev=
1479           continue
1480           ;;
1481         darwin_framework|darwin_framework_skip)
1482           test "$prev" = "darwin_framework" && compiler_flags="$compiler_flags $arg"
1483           compile_command="$compile_command $arg"
1484           finalize_command="$finalize_command $arg"
1485           prev=
1486           continue
1487           ;;
1488         *)
1489           eval "$prev=\"\$arg\""
1490           prev=
1491           continue
1492           ;;
1493         esac
1494       fi # test -n "$prev"
1495
1496       prevarg="$arg"
1497
1498       case $arg in
1499       -all-static)
1500         if test -n "$link_static_flag"; then
1501           compile_command="$compile_command $link_static_flag"
1502           finalize_command="$finalize_command $link_static_flag"
1503         fi
1504         continue
1505         ;;
1506
1507       -allow-undefined)
1508         # FIXME: remove this flag sometime in the future.
1509         $echo "$modename: \`-allow-undefined' is deprecated because it is the default" 1>&2
1510         continue
1511         ;;
1512
1513       -avoid-version)
1514         avoid_version=yes
1515         continue
1516         ;;
1517
1518       -dlopen)
1519         prev=dlfiles
1520         continue
1521         ;;
1522
1523       -dlpreopen)
1524         prev=dlprefiles
1525         continue
1526         ;;
1527
1528       -export-dynamic)
1529         export_dynamic=yes
1530         continue
1531         ;;
1532
1533       -export-symbols | -export-symbols-regex)
1534         if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
1535           $echo "$modename: more than one -exported-symbols argument is not allowed"
1536           exit $EXIT_FAILURE
1537         fi
1538         if test "X$arg" = "X-export-symbols"; then
1539           prev=expsyms
1540         else
1541           prev=expsyms_regex
1542         fi
1543         continue
1544         ;;
1545
1546       -framework|-arch|-isysroot)
1547         case " $CC " in
1548           *" ${arg} ${1} "* | *" ${arg} ${1} "*) 
1549                 prev=darwin_framework_skip ;;
1550           *) compiler_flags="$compiler_flags $arg"
1551              prev=darwin_framework ;;
1552         esac
1553         compile_command="$compile_command $arg"
1554         finalize_command="$finalize_command $arg"
1555         continue
1556         ;;
1557
1558       -inst-prefix-dir)
1559         prev=inst_prefix
1560         continue
1561         ;;
1562
1563       # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:*
1564       # so, if we see these flags be careful not to treat them like -L
1565       -L[A-Z][A-Z]*:*)
1566         case $with_gcc/$host in
1567         no/*-*-irix* | /*-*-irix*)
1568           compile_command="$compile_command $arg"
1569           finalize_command="$finalize_command $arg"
1570           ;;
1571         esac
1572         continue
1573         ;;
1574
1575       -L*)
1576         dir=`$echo "X$arg" | $Xsed -e 's/^-L//'`
1577         # We need an absolute path.
1578         case $dir in
1579         [\\/]* | [A-Za-z]:[\\/]*) ;;
1580         *)
1581           absdir=`cd "$dir" && pwd`
1582           if test -z "$absdir"; then
1583             $echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2
1584             absdir="$dir"
1585             notinst_path="$notinst_path $dir"
1586           fi
1587           dir="$absdir"
1588           ;;
1589         esac
1590         case "$deplibs " in
1591         *" -L$dir "*) ;;
1592         *)
1593           deplibs="$deplibs -L$dir"
1594           lib_search_path="$lib_search_path $dir"
1595           ;;
1596         esac
1597         case $host in
1598         *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
1599           testbindir=`$echo "X$dir" | $Xsed -e 's*/lib$*/bin*'`
1600           case :$dllsearchpath: in
1601           *":$dir:"*) ;;
1602           *) dllsearchpath="$dllsearchpath:$dir";;
1603           esac
1604           case :$dllsearchpath: in
1605           *":$testbindir:"*) ;;
1606           *) dllsearchpath="$dllsearchpath:$testbindir";;
1607           esac
1608           ;;
1609         esac
1610         continue
1611         ;;
1612
1613       -l*)
1614         if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then
1615           case $host in
1616           *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos*)
1617             # These systems don't actually have a C or math library (as such)
1618             continue
1619             ;;
1620           *-*-os2*)
1621             # These systems don't actually have a C library (as such)
1622             test "X$arg" = "X-lc" && continue
1623             ;;
1624           *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
1625             # Do not include libc due to us having libc/libc_r.
1626             test "X$arg" = "X-lc" && continue
1627             ;;
1628           *-*-rhapsody* | *-*-darwin1.[012])
1629             # Rhapsody C and math libraries are in the System framework
1630             deplibs="$deplibs -framework System"
1631             continue
1632             ;;
1633           *-*-sco3.2v5* | *-*-sco5v6*)
1634             # Causes problems with __ctype
1635             test "X$arg" = "X-lc" && continue
1636             ;;
1637           *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
1638             # Compiler inserts libc in the correct place for threads to work
1639             test "X$arg" = "X-lc" && continue
1640             ;;
1641           esac
1642         elif test "X$arg" = "X-lc_r"; then
1643          case $host in
1644          *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
1645            # Do not include libc_r directly, use -pthread flag.
1646            continue
1647            ;;
1648          esac
1649         fi
1650         deplibs="$deplibs $arg"
1651         continue
1652         ;;
1653
1654       # Tru64 UNIX uses -model [arg] to determine the layout of C++
1655       # classes, name mangling, and exception handling.
1656       -model)
1657         compile_command="$compile_command $arg"
1658         compiler_flags="$compiler_flags $arg"
1659         finalize_command="$finalize_command $arg"
1660         prev=xcompiler
1661         continue
1662         ;;
1663
1664      -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads)
1665         compiler_flags="$compiler_flags $arg"
1666         compile_command="$compile_command $arg"
1667         finalize_command="$finalize_command $arg"
1668         continue
1669         ;;
1670
1671       -multi_module)
1672         single_module="${wl}-multi_module"
1673         continue
1674         ;;
1675
1676       -module)
1677         module=yes
1678         continue
1679         ;;
1680
1681       # -64, -mips[0-9] enable 64-bit mode on the SGI compiler
1682       # -r[0-9][0-9]* specifies the processor on the SGI compiler
1683       # -xarch=*, -xtarget=* enable 64-bit mode on the Sun compiler
1684       # +DA*, +DD* enable 64-bit mode on the HP compiler
1685       # -q* pass through compiler args for the IBM compiler
1686       # -m* pass through architecture-specific compiler args for GCC
1687       # -m*, -t[45]*, -txscale* pass through architecture-specific
1688       # compiler args for GCC
1689       # -p, -pg, --coverage, -fprofile-* pass through profiling flag for GCC
1690       # -F/path gives path to uninstalled frameworks, gcc on darwin
1691       # @file GCC response files
1692       -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \
1693       -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*)
1694
1695         # Unknown arguments in both finalize_command and compile_command need
1696         # to be aesthetically quoted because they are evaled later.
1697         arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
1698         case $arg in
1699         *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \   ]*|*]*|"")
1700           arg="\"$arg\""
1701           ;;
1702         esac
1703         compile_command="$compile_command $arg"
1704         finalize_command="$finalize_command $arg"
1705         compiler_flags="$compiler_flags $arg"
1706         continue
1707         ;;
1708
1709       -shrext)
1710         prev=shrext
1711         continue
1712         ;;
1713
1714       -no-fast-install)
1715         fast_install=no
1716         continue
1717         ;;
1718
1719       -no-install)
1720         case $host in
1721         *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin*)
1722           # The PATH hackery in wrapper scripts is required on Windows
1723           # and Darwin in order for the loader to find any dlls it needs.
1724           $echo "$modename: warning: \`-no-install' is ignored for $host" 1>&2
1725           $echo "$modename: warning: assuming \`-no-fast-install' instead" 1>&2
1726           fast_install=no
1727           ;;
1728         *) no_install=yes ;;
1729         esac
1730         continue
1731         ;;
1732
1733       -no-undefined)
1734         allow_undefined=no
1735         continue
1736         ;;
1737
1738       -objectlist)
1739         prev=objectlist
1740         continue
1741         ;;
1742
1743       -o) prev=output ;;
1744
1745       -precious-files-regex)
1746         prev=precious_regex
1747         continue
1748         ;;
1749
1750       -release)
1751         prev=release
1752         continue
1753         ;;
1754
1755       -rpath)
1756         prev=rpath
1757         continue
1758         ;;
1759
1760       -R)
1761         prev=xrpath
1762         continue
1763         ;;
1764
1765       -R*)
1766         dir=`$echo "X$arg" | $Xsed -e 's/^-R//'`
1767         # We need an absolute path.
1768         case $dir in
1769         [\\/]* | [A-Za-z]:[\\/]*) ;;
1770         *)
1771           $echo "$modename: only absolute run-paths are allowed" 1>&2
1772           exit $EXIT_FAILURE
1773           ;;
1774         esac
1775         case "$xrpath " in
1776         *" $dir "*) ;;
1777         *) xrpath="$xrpath $dir" ;;
1778         esac
1779         continue
1780         ;;
1781
1782       -static | -static-libtool-libs)
1783         # The effects of -static are defined in a previous loop.
1784         # We used to do the same as -all-static on platforms that
1785         # didn't have a PIC flag, but the assumption that the effects
1786         # would be equivalent was wrong.  It would break on at least
1787         # Digital Unix and AIX.
1788         continue
1789         ;;
1790
1791       -thread-safe)
1792         thread_safe=yes
1793         continue
1794         ;;
1795
1796       -version-info)
1797         prev=vinfo
1798         continue
1799         ;;
1800       -version-number)
1801         prev=vinfo
1802         vinfo_number=yes
1803         continue
1804         ;;
1805
1806       -Wc,*)
1807         args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wc,//'`
1808         arg=
1809         save_ifs="$IFS"; IFS=','
1810         for flag in $args; do
1811           IFS="$save_ifs"
1812           case $flag in
1813             *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \       ]*|*]*|"")
1814             flag="\"$flag\""
1815             ;;
1816           esac
1817           arg="$arg $wl$flag"
1818           compiler_flags="$compiler_flags $flag"
1819         done
1820         IFS="$save_ifs"
1821         arg=`$echo "X$arg" | $Xsed -e "s/^ //"`
1822         ;;
1823
1824       -Wl,*)
1825         args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wl,//'`
1826         arg=
1827         save_ifs="$IFS"; IFS=','
1828         for flag in $args; do
1829           IFS="$save_ifs"
1830           case $flag in
1831             *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \       ]*|*]*|"")
1832             flag="\"$flag\""
1833             ;;
1834           esac
1835           arg="$arg $wl$flag"
1836           compiler_flags="$compiler_flags $wl$flag"
1837           linker_flags="$linker_flags $flag"
1838         done
1839         IFS="$save_ifs"
1840         arg=`$echo "X$arg" | $Xsed -e "s/^ //"`
1841         ;;
1842
1843       -Xcompiler)
1844         prev=xcompiler
1845         continue
1846         ;;
1847
1848       -Xlinker)
1849         prev=xlinker
1850         continue
1851         ;;
1852
1853       -XCClinker)
1854         prev=xcclinker
1855         continue
1856         ;;
1857
1858       # Some other compiler flag.
1859       -* | +*)
1860         # Unknown arguments in both finalize_command and compile_command need
1861         # to be aesthetically quoted because they are evaled later.
1862         arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
1863         case $arg in
1864         *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \   ]*|*]*|"")
1865           arg="\"$arg\""
1866           ;;
1867         esac
1868         ;;
1869
1870       *.$objext)
1871         # A standard object.
1872         objs="$objs $arg"
1873         ;;
1874
1875       *.lo)
1876         # A libtool-controlled object.
1877
1878         # Check to see that this really is a libtool object.
1879         if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
1880           pic_object=
1881           non_pic_object=
1882
1883           # Read the .lo file
1884           # If there is no directory component, then add one.
1885           case $arg in
1886           */* | *\\*) . $arg ;;
1887           *) . ./$arg ;;
1888           esac
1889
1890           if test -z "$pic_object" || \
1891              test -z "$non_pic_object" ||
1892              test "$pic_object" = none && \
1893              test "$non_pic_object" = none; then
1894             $echo "$modename: cannot find name of object for \`$arg'" 1>&2
1895             exit $EXIT_FAILURE
1896           fi
1897
1898           # Extract subdirectory from the argument.
1899           xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
1900           if test "X$xdir" = "X$arg"; then
1901             xdir=
1902           else
1903             xdir="$xdir/"
1904           fi
1905
1906           if test "$pic_object" != none; then
1907             # Prepend the subdirectory the object is found in.
1908             pic_object="$xdir$pic_object"
1909
1910             if test "$prev" = dlfiles; then
1911               if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
1912                 dlfiles="$dlfiles $pic_object"
1913                 prev=
1914                 continue
1915               else
1916                 # If libtool objects are unsupported, then we need to preload.
1917                 prev=dlprefiles
1918               fi
1919             fi
1920
1921             # CHECK ME:  I think I busted this.  -Ossama
1922             if test "$prev" = dlprefiles; then
1923               # Preload the old-style object.
1924               dlprefiles="$dlprefiles $pic_object"
1925               prev=
1926             fi
1927
1928             # A PIC object.
1929             libobjs="$libobjs $pic_object"
1930             arg="$pic_object"
1931           fi
1932
1933           # Non-PIC object.
1934           if test "$non_pic_object" != none; then
1935             # Prepend the subdirectory the object is found in.
1936             non_pic_object="$xdir$non_pic_object"
1937
1938             # A standard non-PIC object
1939             non_pic_objects="$non_pic_objects $non_pic_object"
1940             if test -z "$pic_object" || test "$pic_object" = none ; then
1941               arg="$non_pic_object"
1942             fi
1943           else
1944             # If the PIC object exists, use it instead.
1945             # $xdir was prepended to $pic_object above.
1946             non_pic_object="$pic_object"
1947             non_pic_objects="$non_pic_objects $non_pic_object"
1948           fi
1949         else
1950           # Only an error if not doing a dry-run.
1951           if test -z "$run"; then
1952             $echo "$modename: \`$arg' is not a valid libtool object" 1>&2
1953             exit $EXIT_FAILURE
1954           else
1955             # Dry-run case.
1956
1957             # Extract subdirectory from the argument.
1958             xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
1959             if test "X$xdir" = "X$arg"; then
1960               xdir=
1961             else
1962               xdir="$xdir/"
1963             fi
1964
1965             pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"`
1966             non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"`
1967             libobjs="$libobjs $pic_object"
1968             non_pic_objects="$non_pic_objects $non_pic_object"
1969           fi
1970         fi
1971         ;;
1972
1973       *.$libext)
1974         # An archive.
1975         deplibs="$deplibs $arg"
1976         old_deplibs="$old_deplibs $arg"
1977         continue
1978         ;;
1979
1980       *.la)
1981         # A libtool-controlled library.
1982
1983         if test "$prev" = dlfiles; then
1984           # This library was specified with -dlopen.
1985           dlfiles="$dlfiles $arg"
1986           prev=
1987         elif test "$prev" = dlprefiles; then
1988           # The library was specified with -dlpreopen.
1989           dlprefiles="$dlprefiles $arg"
1990           prev=
1991         else
1992           deplibs="$deplibs $arg"
1993         fi
1994         continue
1995         ;;
1996
1997       # Some other compiler argument.
1998       *)
1999         # Unknown arguments in both finalize_command and compile_command need
2000         # to be aesthetically quoted because they are evaled later.
2001         arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
2002         case $arg in
2003         *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \   ]*|*]*|"")
2004           arg="\"$arg\""
2005           ;;
2006         esac
2007         ;;
2008       esac # arg
2009
2010       # Now actually substitute the argument into the commands.
2011       if test -n "$arg"; then
2012         compile_command="$compile_command $arg"
2013         finalize_command="$finalize_command $arg"
2014       fi
2015     done # argument parsing loop
2016
2017     if test -n "$prev"; then
2018       $echo "$modename: the \`$prevarg' option requires an argument" 1>&2
2019       $echo "$help" 1>&2
2020       exit $EXIT_FAILURE
2021     fi
2022
2023     if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then
2024       eval arg=\"$export_dynamic_flag_spec\"
2025       compile_command="$compile_command $arg"
2026       finalize_command="$finalize_command $arg"
2027     fi
2028
2029     oldlibs=
2030     # calculate the name of the file, without its directory
2031     outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'`
2032     libobjs_save="$libobjs"
2033
2034     if test -n "$shlibpath_var"; then
2035       # get the directories listed in $shlibpath_var
2036       eval shlib_search_path=\`\$echo \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\`
2037     else
2038       shlib_search_path=
2039     fi
2040     eval sys_lib_search_path=\"$sys_lib_search_path_spec\"
2041     eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\"
2042
2043     output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'`
2044     if test "X$output_objdir" = "X$output"; then
2045       output_objdir="$objdir"
2046     else
2047       output_objdir="$output_objdir/$objdir"
2048     fi
2049     # Create the object directory.
2050     if test ! -d "$output_objdir"; then
2051       $show "$mkdir $output_objdir"
2052       $run $mkdir $output_objdir
2053       exit_status=$?
2054       if test "$exit_status" -ne 0 && test ! -d "$output_objdir"; then
2055         exit $exit_status
2056       fi
2057     fi
2058
2059     # Determine the type of output
2060     case $output in
2061     "")
2062       $echo "$modename: you must specify an output file" 1>&2
2063       $echo "$help" 1>&2
2064       exit $EXIT_FAILURE
2065       ;;
2066     *.$libext) linkmode=oldlib ;;
2067     *.lo | *.$objext) linkmode=obj ;;
2068     *.la) linkmode=lib ;;
2069     *) linkmode=prog ;; # Anything else should be a program.
2070     esac
2071
2072     case $host in
2073     *cygwin* | *mingw* | *pw32*)
2074       # don't eliminate duplications in $postdeps and $predeps
2075       duplicate_compiler_generated_deps=yes
2076       ;;
2077     *)
2078       duplicate_compiler_generated_deps=$duplicate_deps
2079       ;;
2080     esac
2081     specialdeplibs=
2082
2083     libs=
2084     # Find all interdependent deplibs by searching for libraries
2085     # that are linked more than once (e.g. -la -lb -la)
2086     for deplib in $deplibs; do
2087       if test "X$duplicate_deps" = "Xyes" ; then
2088         case "$libs " in
2089         *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
2090         esac
2091       fi
2092       libs="$libs $deplib"
2093     done
2094
2095     if test "$linkmode" = lib; then
2096       libs="$predeps $libs $compiler_lib_search_path $postdeps"
2097
2098       # Compute libraries that are listed more than once in $predeps
2099       # $postdeps and mark them as special (i.e., whose duplicates are
2100       # not to be eliminated).
2101       pre_post_deps=
2102       if test "X$duplicate_compiler_generated_deps" = "Xyes" ; then
2103         for pre_post_dep in $predeps $postdeps; do
2104           case "$pre_post_deps " in
2105           *" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;;
2106           esac
2107           pre_post_deps="$pre_post_deps $pre_post_dep"
2108         done
2109       fi
2110       pre_post_deps=
2111     fi
2112
2113     deplibs=
2114     newdependency_libs=
2115     newlib_search_path=
2116     need_relink=no # whether we're linking any uninstalled libtool libraries
2117     notinst_deplibs= # not-installed libtool libraries
2118     case $linkmode in
2119     lib)
2120         passes="conv link"
2121         for file in $dlfiles $dlprefiles; do
2122           case $file in
2123           *.la) ;;
2124           *)
2125             $echo "$modename: libraries can \`-dlopen' only libtool libraries: $file" 1>&2
2126             exit $EXIT_FAILURE
2127             ;;
2128           esac
2129         done
2130         ;;
2131     prog)
2132         compile_deplibs=
2133         finalize_deplibs=
2134         alldeplibs=no
2135         newdlfiles=
2136         newdlprefiles=
2137         passes="conv scan dlopen dlpreopen link"
2138         ;;
2139     *)  passes="conv"
2140         ;;
2141     esac
2142     for pass in $passes; do
2143       if test "$linkmode,$pass" = "lib,link" ||
2144          test "$linkmode,$pass" = "prog,scan"; then
2145         libs="$deplibs"
2146         deplibs=
2147       fi
2148       if test "$linkmode" = prog; then
2149         case $pass in
2150         dlopen) libs="$dlfiles" ;;
2151         dlpreopen) libs="$dlprefiles" ;;
2152         link) libs="$deplibs %DEPLIBS% $dependency_libs" ;;
2153         esac
2154       fi
2155       if test "$pass" = dlopen; then
2156         # Collect dlpreopened libraries
2157         save_deplibs="$deplibs"
2158         deplibs=
2159       fi
2160       for deplib in $libs; do
2161         lib=
2162         found=no
2163         case $deplib in
2164         -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads)
2165           if test "$linkmode,$pass" = "prog,link"; then
2166             compile_deplibs="$deplib $compile_deplibs"
2167             finalize_deplibs="$deplib $finalize_deplibs"
2168           else
2169             compiler_flags="$compiler_flags $deplib"
2170           fi
2171           continue
2172           ;;
2173         -l*)
2174           if test "$linkmode" != lib && test "$linkmode" != prog; then
2175             $echo "$modename: warning: \`-l' is ignored for archives/objects" 1>&2
2176             continue
2177           fi
2178           name=`$echo "X$deplib" | $Xsed -e 's/^-l//'`
2179           if test "$linkmode" = lib; then
2180             searchdirs="$newlib_search_path $lib_search_path $compiler_lib_search_dirs $sys_lib_search_path $shlib_search_path"
2181           else
2182             searchdirs="$newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path"
2183           fi
2184           for searchdir in $searchdirs; do
2185             for search_ext in .la $std_shrext .so .a; do
2186               # Search the libtool library
2187               lib="$searchdir/lib${name}${search_ext}"
2188               if test -f "$lib"; then
2189                 if test "$search_ext" = ".la"; then
2190                   found=yes
2191                 else
2192                   found=no
2193                 fi
2194                 break 2
2195               fi
2196             done
2197           done
2198           if test "$found" != yes; then
2199             # deplib doesn't seem to be a libtool library
2200             if test "$linkmode,$pass" = "prog,link"; then
2201               compile_deplibs="$deplib $compile_deplibs"
2202               finalize_deplibs="$deplib $finalize_deplibs"
2203             else
2204               deplibs="$deplib $deplibs"
2205               test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
2206             fi
2207             continue
2208           else # deplib is a libtool library
2209             # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib,
2210             # We need to do some special things here, and not later.
2211             if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
2212               case " $predeps $postdeps " in
2213               *" $deplib "*)
2214                 if (${SED} -e '2q' $lib |
2215                     grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
2216                   library_names=
2217                   old_library=
2218                   case $lib in
2219                   */* | *\\*) . $lib ;;
2220                   *) . ./$lib ;;
2221                   esac
2222                   for l in $old_library $library_names; do
2223                     ll="$l"
2224                   done
2225                   if test "X$ll" = "X$old_library" ; then # only static version available
2226                     found=no
2227                     ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'`
2228                     test "X$ladir" = "X$lib" && ladir="."
2229                     lib=$ladir/$old_library
2230                     if test "$linkmode,$pass" = "prog,link"; then
2231                       compile_deplibs="$deplib $compile_deplibs"
2232                       finalize_deplibs="$deplib $finalize_deplibs"
2233                     else
2234                       deplibs="$deplib $deplibs"
2235                       test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
2236                     fi
2237                     continue
2238                   fi
2239                 fi
2240                 ;;
2241               *) ;;
2242               esac
2243             fi
2244           fi
2245           ;; # -l
2246         -L*)
2247           case $linkmode in
2248           lib)
2249             deplibs="$deplib $deplibs"
2250             test "$pass" = conv && continue
2251             newdependency_libs="$deplib $newdependency_libs"
2252             newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
2253             ;;
2254           prog)
2255             if test "$pass" = conv; then
2256               deplibs="$deplib $deplibs"
2257               continue
2258             fi
2259             if test "$pass" = scan; then
2260               deplibs="$deplib $deplibs"
2261             else
2262               compile_deplibs="$deplib $compile_deplibs"
2263               finalize_deplibs="$deplib $finalize_deplibs"
2264             fi
2265             newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
2266             ;;
2267           *)
2268             $echo "$modename: warning: \`-L' is ignored for archives/objects" 1>&2
2269             ;;
2270           esac # linkmode
2271           continue
2272           ;; # -L
2273         -R*)
2274           if test "$pass" = link; then
2275             dir=`$echo "X$deplib" | $Xsed -e 's/^-R//'`
2276             # Make sure the xrpath contains only unique directories.
2277             case "$xrpath " in
2278             *" $dir "*) ;;
2279             *) xrpath="$xrpath $dir" ;;
2280             esac
2281           fi
2282           deplibs="$deplib $deplibs"
2283           continue
2284           ;;
2285         *.la) lib="$deplib" ;;
2286         *.$libext)
2287           if test "$pass" = conv; then
2288             deplibs="$deplib $deplibs"
2289             continue
2290           fi
2291           case $linkmode in
2292           lib)
2293             valid_a_lib=no
2294             case $deplibs_check_method in
2295               match_pattern*)
2296                 set dummy $deplibs_check_method
2297                 match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
2298                 if eval $echo \"$deplib\" 2>/dev/null \
2299                     | $SED 10q \
2300                     | $EGREP "$match_pattern_regex" > /dev/null; then
2301                   valid_a_lib=yes
2302                 fi
2303                 ;;
2304               pass_all)
2305                 valid_a_lib=yes
2306                 ;;
2307             esac
2308             if test "$valid_a_lib" != yes; then
2309               $echo
2310               $echo "*** Warning: Trying to link with static lib archive $deplib."
2311               $echo "*** I have the capability to make that library automatically link in when"
2312               $echo "*** you link to this library.  But I can only do this if you have a"
2313               $echo "*** shared version of the library, which you do not appear to have"
2314               $echo "*** because the file extensions .$libext of this argument makes me believe"
2315               $echo "*** that it is just a static archive that I should not used here."
2316             else
2317               $echo
2318               $echo "*** Warning: Linking the shared library $output against the"
2319               $echo "*** static library $deplib is not portable!"
2320               deplibs="$deplib $deplibs"
2321             fi
2322             continue
2323             ;;
2324           prog)
2325             if test "$pass" != link; then
2326               deplibs="$deplib $deplibs"
2327             else
2328               compile_deplibs="$deplib $compile_deplibs"
2329               finalize_deplibs="$deplib $finalize_deplibs"
2330             fi
2331             continue
2332             ;;
2333           esac # linkmode
2334           ;; # *.$libext
2335         *.lo | *.$objext)
2336           if test "$pass" = conv; then
2337             deplibs="$deplib $deplibs"
2338           elif test "$linkmode" = prog; then
2339             if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
2340               # If there is no dlopen support or we're linking statically,
2341               # we need to preload.
2342               newdlprefiles="$newdlprefiles $deplib"
2343               compile_deplibs="$deplib $compile_deplibs"
2344               finalize_deplibs="$deplib $finalize_deplibs"
2345             else
2346               newdlfiles="$newdlfiles $deplib"
2347             fi
2348           fi
2349           continue
2350           ;;
2351         %DEPLIBS%)
2352           alldeplibs=yes
2353           continue
2354           ;;
2355         esac # case $deplib
2356         if test "$found" = yes || test -f "$lib"; then :
2357         else
2358           $echo "$modename: cannot find the library \`$lib' or unhandled argument \`$deplib'" 1>&2
2359           exit $EXIT_FAILURE
2360         fi
2361
2362         # Check to see that this really is a libtool archive.
2363         if (${SED} -e '2q' $lib | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
2364         else
2365           $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
2366           exit $EXIT_FAILURE
2367         fi
2368
2369         ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'`
2370         test "X$ladir" = "X$lib" && ladir="."
2371
2372         dlname=
2373         dlopen=
2374         dlpreopen=
2375         libdir=
2376         library_names=
2377         old_library=
2378         # If the library was installed with an old release of libtool,
2379         # it will not redefine variables installed, or shouldnotlink
2380         installed=yes
2381         shouldnotlink=no
2382         avoidtemprpath=
2383
2384
2385         # Read the .la file
2386         case $lib in
2387         */* | *\\*) . $lib ;;
2388         *) . ./$lib ;;
2389         esac
2390
2391         if test "$linkmode,$pass" = "lib,link" ||
2392            test "$linkmode,$pass" = "prog,scan" ||
2393            { test "$linkmode" != prog && test "$linkmode" != lib; }; then
2394           test -n "$dlopen" && dlfiles="$dlfiles $dlopen"
2395           test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen"
2396         fi
2397
2398         if test "$pass" = conv; then
2399           # Only check for convenience libraries
2400           deplibs="$lib $deplibs"
2401           if test -z "$libdir"; then
2402             if test -z "$old_library"; then
2403               $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
2404               exit $EXIT_FAILURE
2405             fi
2406             # It is a libtool convenience library, so add in its objects.
2407             convenience="$convenience $ladir/$objdir/$old_library"
2408             old_convenience="$old_convenience $ladir/$objdir/$old_library"
2409             tmp_libs=
2410             for deplib in $dependency_libs; do
2411               deplibs="$deplib $deplibs"
2412               if test "X$duplicate_deps" = "Xyes" ; then
2413                 case "$tmp_libs " in
2414                 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
2415                 esac
2416               fi
2417               tmp_libs="$tmp_libs $deplib"
2418             done
2419           elif test "$linkmode" != prog && test "$linkmode" != lib; then
2420             $echo "$modename: \`$lib' is not a convenience library" 1>&2
2421             exit $EXIT_FAILURE
2422           fi
2423           continue
2424         fi # $pass = conv
2425
2426
2427         # Get the name of the library we link against.
2428         linklib=
2429         for l in $old_library $library_names; do
2430           linklib="$l"
2431         done
2432         if test -z "$linklib"; then
2433           $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
2434           exit $EXIT_FAILURE
2435         fi
2436
2437         # This library was specified with -dlopen.
2438         if test "$pass" = dlopen; then
2439           if test -z "$libdir"; then
2440             $echo "$modename: cannot -dlopen a convenience library: \`$lib'" 1>&2
2441             exit $EXIT_FAILURE
2442           fi
2443           if test -z "$dlname" ||
2444              test "$dlopen_support" != yes ||
2445              test "$build_libtool_libs" = no; then
2446             # If there is no dlname, no dlopen support or we're linking
2447             # statically, we need to preload.  We also need to preload any
2448             # dependent libraries so libltdl's deplib preloader doesn't
2449             # bomb out in the load deplibs phase.
2450             dlprefiles="$dlprefiles $lib $dependency_libs"
2451           else
2452             newdlfiles="$newdlfiles $lib"
2453           fi
2454           continue
2455         fi # $pass = dlopen
2456
2457         # We need an absolute path.
2458         case $ladir in
2459         [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;;
2460         *)
2461           abs_ladir=`cd "$ladir" && pwd`
2462           if test -z "$abs_ladir"; then
2463             $echo "$modename: warning: cannot determine absolute directory name of \`$ladir'" 1>&2
2464             $echo "$modename: passing it literally to the linker, although it might fail" 1>&2
2465             abs_ladir="$ladir"
2466           fi
2467           ;;
2468         esac
2469         laname=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
2470
2471         # Find the relevant object directory and library name.
2472         if test "X$installed" = Xyes; then
2473           if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then
2474             $echo "$modename: warning: library \`$lib' was moved." 1>&2
2475             dir="$ladir"
2476             absdir="$abs_ladir"
2477             libdir="$abs_ladir"
2478           else
2479             dir="$libdir"
2480             absdir="$libdir"
2481           fi
2482           test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes
2483         else
2484           if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then
2485             dir="$ladir"
2486             absdir="$abs_ladir"
2487             # Remove this search path later
2488             notinst_path="$notinst_path $abs_ladir"
2489           else
2490             dir="$ladir/$objdir"
2491             absdir="$abs_ladir/$objdir"
2492             # Remove this search path later
2493             notinst_path="$notinst_path $abs_ladir"
2494           fi
2495         fi # $installed = yes
2496         name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
2497
2498         # This library was specified with -dlpreopen.
2499         if test "$pass" = dlpreopen; then
2500           if test -z "$libdir"; then
2501             $echo "$modename: cannot -dlpreopen a convenience library: \`$lib'" 1>&2
2502             exit $EXIT_FAILURE
2503           fi
2504           # Prefer using a static library (so that no silly _DYNAMIC symbols
2505           # are required to link).
2506           if test -n "$old_library"; then
2507             newdlprefiles="$newdlprefiles $dir/$old_library"
2508           # Otherwise, use the dlname, so that lt_dlopen finds it.
2509           elif test -n "$dlname"; then
2510             newdlprefiles="$newdlprefiles $dir/$dlname"
2511           else
2512             newdlprefiles="$newdlprefiles $dir/$linklib"
2513           fi
2514         fi # $pass = dlpreopen
2515
2516         if test -z "$libdir"; then
2517           # Link the convenience library
2518           if test "$linkmode" = lib; then
2519             deplibs="$dir/$old_library $deplibs"
2520           elif test "$linkmode,$pass" = "prog,link"; then
2521             compile_deplibs="$dir/$old_library $compile_deplibs"
2522             finalize_deplibs="$dir/$old_library $finalize_deplibs"
2523           else
2524             deplibs="$lib $deplibs" # used for prog,scan pass
2525           fi
2526           continue
2527         fi
2528
2529
2530         if test "$linkmode" = prog && test "$pass" != link; then
2531           newlib_search_path="$newlib_search_path $ladir"
2532           deplibs="$lib $deplibs"
2533
2534           linkalldeplibs=no
2535           if test "$link_all_deplibs" != no || test -z "$library_names" ||
2536              test "$build_libtool_libs" = no; then
2537             linkalldeplibs=yes
2538           fi
2539
2540           tmp_libs=
2541           for deplib in $dependency_libs; do
2542             case $deplib in
2543             -L*) newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`;; ### testsuite: skip nested quoting test
2544             esac
2545             # Need to link against all dependency_libs?
2546             if test "$linkalldeplibs" = yes; then
2547               deplibs="$deplib $deplibs"
2548             else
2549               # Need to hardcode shared library paths
2550               # or/and link against static libraries
2551               newdependency_libs="$deplib $newdependency_libs"
2552             fi
2553             if test "X$duplicate_deps" = "Xyes" ; then
2554               case "$tmp_libs " in
2555               *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
2556               esac
2557             fi
2558             tmp_libs="$tmp_libs $deplib"
2559           done # for deplib
2560           continue
2561         fi # $linkmode = prog...
2562
2563         if test "$linkmode,$pass" = "prog,link"; then
2564           if test -n "$library_names" &&
2565              { { test "$prefer_static_libs" = no ||
2566                  test "$prefer_static_libs,$installed" = "built,yes"; } ||
2567                test -z "$old_library"; }; then
2568             # We need to hardcode the library path
2569             if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then
2570               # Make sure the rpath contains only unique directories.
2571               case "$temp_rpath " in
2572               *" $dir "*) ;;
2573               *" $absdir "*) ;;
2574               *) temp_rpath="$temp_rpath $absdir" ;;
2575               esac
2576             fi
2577
2578             # Hardcode the library path.
2579             # Skip directories that are in the system default run-time
2580             # search path.
2581             case " $sys_lib_dlsearch_path " in
2582             *" $absdir "*) ;;
2583             *)
2584               case "$compile_rpath " in
2585               *" $absdir "*) ;;
2586               *) compile_rpath="$compile_rpath $absdir"
2587               esac
2588               ;;
2589             esac
2590             case " $sys_lib_dlsearch_path " in
2591             *" $libdir "*) ;;
2592             *)
2593               case "$finalize_rpath " in
2594               *" $libdir "*) ;;
2595               *) finalize_rpath="$finalize_rpath $libdir"
2596               esac
2597               ;;
2598             esac
2599           fi # $linkmode,$pass = prog,link...
2600
2601           if test "$alldeplibs" = yes &&
2602              { test "$deplibs_check_method" = pass_all ||
2603                { test "$build_libtool_libs" = yes &&
2604                  test -n "$library_names"; }; }; then
2605             # We only need to search for static libraries
2606             continue
2607           fi
2608         fi
2609
2610         link_static=no # Whether the deplib will be linked statically
2611         use_static_libs=$prefer_static_libs
2612         if test "$use_static_libs" = built && test "$installed" = yes ; then
2613           use_static_libs=no
2614         fi
2615         if test -n "$library_names" &&
2616            { test "$use_static_libs" = no || test -z "$old_library"; }; then
2617           if test "$installed" = no; then
2618             notinst_deplibs="$notinst_deplibs $lib"
2619             need_relink=yes
2620           fi
2621           # This is a shared library
2622
2623           # Warn about portability, can't link against -module's on
2624           # some systems (darwin)
2625           if test "$shouldnotlink" = yes && test "$pass" = link ; then
2626             $echo
2627             if test "$linkmode" = prog; then
2628               $echo "*** Warning: Linking the executable $output against the loadable module"
2629             else
2630               $echo "*** Warning: Linking the shared library $output against the loadable module"
2631             fi
2632             $echo "*** $linklib is not portable!"
2633           fi
2634           if test "$linkmode" = lib &&
2635              test "$hardcode_into_libs" = yes; then
2636             # Hardcode the library path.
2637             # Skip directories that are in the system default run-time
2638             # search path.
2639             case " $sys_lib_dlsearch_path " in
2640             *" $absdir "*) ;;
2641             *)
2642               case "$compile_rpath " in
2643               *" $absdir "*) ;;
2644               *) compile_rpath="$compile_rpath $absdir"
2645               esac
2646               ;;
2647             esac
2648             case " $sys_lib_dlsearch_path " in
2649             *" $libdir "*) ;;
2650             *)
2651               case "$finalize_rpath " in
2652               *" $libdir "*) ;;
2653               *) finalize_rpath="$finalize_rpath $libdir"
2654               esac
2655               ;;
2656             esac
2657           fi
2658
2659           if test -n "$old_archive_from_expsyms_cmds"; then
2660             # figure out the soname
2661             set dummy $library_names
2662             realname="$2"
2663             shift; shift
2664             libname=`eval \\$echo \"$libname_spec\"`
2665             # use dlname if we got it. it's perfectly good, no?
2666             if test -n "$dlname"; then
2667               soname="$dlname"
2668             elif test -n "$soname_spec"; then
2669               # bleh windows
2670               case $host in
2671               *cygwin* | mingw*)
2672                 major=`expr $current - $age`
2673                 versuffix="-$major"
2674                 ;;
2675               esac
2676               eval soname=\"$soname_spec\"
2677             else
2678               soname="$realname"
2679             fi
2680
2681             # Make a new name for the extract_expsyms_cmds to use
2682             soroot="$soname"
2683             soname=`$echo $soroot | ${SED} -e 's/^.*\///'`
2684             newlib="libimp-`$echo $soname | ${SED} 's/^lib//;s/\.dll$//'`.a"
2685
2686             # If the library has no export list, then create one now
2687             if test -f "$output_objdir/$soname-def"; then :
2688             else
2689               $show "extracting exported symbol list from \`$soname'"
2690               save_ifs="$IFS"; IFS='~'
2691               cmds=$extract_expsyms_cmds
2692               for cmd in $cmds; do
2693                 IFS="$save_ifs"
2694                 eval cmd=\"$cmd\"
2695                 $show "$cmd"
2696                 $run eval "$cmd" || exit $?
2697               done
2698               IFS="$save_ifs"
2699             fi
2700
2701             # Create $newlib
2702             if test -f "$output_objdir/$newlib"; then :; else
2703               $show "generating import library for \`$soname'"
2704               save_ifs="$IFS"; IFS='~'
2705               cmds=$old_archive_from_expsyms_cmds
2706               for cmd in $cmds; do
2707                 IFS="$save_ifs"
2708                 eval cmd=\"$cmd\"
2709                 $show "$cmd"
2710                 $run eval "$cmd" || exit $?
2711               done
2712               IFS="$save_ifs"
2713             fi
2714             # make sure the library variables are pointing to the new library
2715             dir=$output_objdir
2716             linklib=$newlib
2717           fi # test -n "$old_archive_from_expsyms_cmds"
2718
2719           if test "$linkmode" = prog || test "$mode" != relink; then
2720             add_shlibpath=
2721             add_dir=
2722             add=
2723             lib_linked=yes
2724             case $hardcode_action in
2725             immediate | unsupported)
2726               if test "$hardcode_direct" = no; then
2727                 add="$dir/$linklib"
2728                 case $host in
2729                   *-*-sco3.2v5.0.[024]*) add_dir="-L$dir" ;;
2730                   *-*-sysv4*uw2*) add_dir="-L$dir" ;;
2731                   *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \
2732                     *-*-unixware7*) add_dir="-L$dir" ;;
2733                   *-*-darwin* )
2734                     # if the lib is a module then we can not link against
2735                     # it, someone is ignoring the new warnings I added
2736                     if /usr/bin/file -L $add 2> /dev/null |
2737                       $EGREP ": [^:]* bundle" >/dev/null ; then
2738                       $echo "** Warning, lib $linklib is a module, not a shared library"
2739                       if test -z "$old_library" ; then
2740                         $echo
2741                         $echo "** And there doesn't seem to be a static archive available"
2742                         $echo "** The link will probably fail, sorry"
2743                       else
2744                         add="$dir/$old_library"
2745                       fi
2746                     fi
2747                 esac
2748               elif test "$hardcode_minus_L" = no; then
2749                 case $host in
2750                 *-*-sunos*) add_shlibpath="$dir" ;;
2751                 esac
2752                 add_dir="-L$dir"
2753                 add="-l$name"
2754               elif test "$hardcode_shlibpath_var" = no; then
2755                 add_shlibpath="$dir"
2756                 add="-l$name"
2757               else
2758                 lib_linked=no
2759               fi
2760               ;;
2761             relink)
2762               if test "$hardcode_direct" = yes; then
2763                 add="$dir/$linklib"
2764               elif test "$hardcode_minus_L" = yes; then
2765                 add_dir="-L$dir"
2766                 # Try looking first in the location we're being installed to.
2767                 if test -n "$inst_prefix_dir"; then
2768                   case $libdir in
2769                     [\\/]*)
2770                       add_dir="$add_dir -L$inst_prefix_dir$libdir"
2771                       ;;
2772                   esac
2773                 fi
2774                 add="-l$name"
2775               elif test "$hardcode_shlibpath_var" = yes; then
2776                 add_shlibpath="$dir"
2777                 add="-l$name"
2778               else
2779                 lib_linked=no
2780               fi
2781               ;;
2782             *) lib_linked=no ;;
2783             esac
2784
2785             if test "$lib_linked" != yes; then
2786               $echo "$modename: configuration error: unsupported hardcode properties"
2787               exit $EXIT_FAILURE
2788             fi
2789
2790             if test -n "$add_shlibpath"; then
2791               case :$compile_shlibpath: in
2792               *":$add_shlibpath:"*) ;;
2793               *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;;
2794               esac
2795             fi
2796             if test "$linkmode" = prog; then
2797               test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs"
2798               test -n "$add" && compile_deplibs="$add $compile_deplibs"
2799             else
2800               test -n "$add_dir" && deplibs="$add_dir $deplibs"
2801               test -n "$add" && deplibs="$add $deplibs"
2802               if test "$hardcode_direct" != yes && \
2803                  test "$hardcode_minus_L" != yes && \
2804                  test "$hardcode_shlibpath_var" = yes; then
2805                 case :$finalize_shlibpath: in
2806                 *":$libdir:"*) ;;
2807                 *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
2808                 esac
2809               fi
2810             fi
2811           fi
2812
2813           if test "$linkmode" = prog || test "$mode" = relink; then
2814             add_shlibpath=
2815             add_dir=
2816             add=
2817             # Finalize command for both is simple: just hardcode it.
2818             if test "$hardcode_direct" = yes; then
2819               add="$libdir/$linklib"
2820             elif test "$hardcode_minus_L" = yes; then
2821               add_dir="-L$libdir"
2822               add="-l$name"
2823             elif test "$hardcode_shlibpath_var" = yes; then
2824               case :$finalize_shlibpath: in
2825               *":$libdir:"*) ;;
2826               *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
2827               esac
2828               add="-l$name"
2829             elif test "$hardcode_automatic" = yes; then
2830               if test -n "$inst_prefix_dir" &&
2831                  test -f "$inst_prefix_dir$libdir/$linklib" ; then
2832                 add="$inst_prefix_dir$libdir/$linklib"
2833               else
2834                 add="$libdir/$linklib"
2835               fi
2836             else
2837               # We cannot seem to hardcode it, guess we'll fake it.
2838               add_dir="-L$libdir"
2839               # Try looking first in the location we're being installed to.
2840               if test -n "$inst_prefix_dir"; then
2841                 case $libdir in
2842                   [\\/]*)
2843                     add_dir="$add_dir -L$inst_prefix_dir$libdir"
2844                     ;;
2845                 esac
2846               fi
2847               add="-l$name"
2848             fi
2849
2850             if test "$linkmode" = prog; then
2851               test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs"
2852               test -n "$add" && finalize_deplibs="$add $finalize_deplibs"
2853             else
2854               test -n "$add_dir" && deplibs="$add_dir $deplibs"
2855               test -n "$add" && deplibs="$add $deplibs"
2856             fi
2857           fi
2858         elif test "$linkmode" = prog; then
2859           # Here we assume that one of hardcode_direct or hardcode_minus_L
2860           # is not unsupported.  This is valid on all known static and
2861           # shared platforms.
2862           if test "$hardcode_direct" != unsupported; then
2863             test -n "$old_library" && linklib="$old_library"
2864             compile_deplibs="$dir/$linklib $compile_deplibs"
2865             finalize_deplibs="$dir/$linklib $finalize_deplibs"
2866           else
2867             compile_deplibs="-l$name -L$dir $compile_deplibs"
2868             finalize_deplibs="-l$name -L$dir $finalize_deplibs"
2869           fi
2870         elif test "$build_libtool_libs" = yes; then
2871           # Not a shared library
2872           if test "$deplibs_check_method" != pass_all; then
2873             # We're trying link a shared library against a static one
2874             # but the system doesn't support it.
2875
2876             # Just print a warning and add the library to dependency_libs so
2877             # that the program can be linked against the static library.
2878             $echo
2879             $echo "*** Warning: This system can not link to static lib archive $lib."
2880             $echo "*** I have the capability to make that library automatically link in when"
2881             $echo "*** you link to this library.  But I can only do this if you have a"
2882             $echo "*** shared version of the library, which you do not appear to have."
2883             if test "$module" = yes; then
2884               $echo "*** But as you try to build a module library, libtool will still create "
2885               $echo "*** a static module, that should work as long as the dlopening application"
2886               $echo "*** is linked with the -dlopen flag to resolve symbols at runtime."
2887               if test -z "$global_symbol_pipe"; then
2888                 $echo
2889                 $echo "*** However, this would only work if libtool was able to extract symbol"
2890                 $echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
2891                 $echo "*** not find such a program.  So, this module is probably useless."
2892                 $echo "*** \`nm' from GNU binutils and a full rebuild may help."
2893               fi
2894               if test "$build_old_libs" = no; then
2895                 build_libtool_libs=module
2896                 build_old_libs=yes
2897               else
2898                 build_libtool_libs=no
2899               fi
2900             fi
2901           else
2902             deplibs="$dir/$old_library $deplibs"
2903             link_static=yes
2904           fi
2905         fi # link shared/static library?
2906
2907         if test "$linkmode" = lib; then
2908           if test -n "$dependency_libs" &&
2909              { test "$hardcode_into_libs" != yes ||
2910                test "$build_old_libs" = yes ||
2911                test "$link_static" = yes; }; then
2912             # Extract -R from dependency_libs
2913             temp_deplibs=
2914             for libdir in $dependency_libs; do
2915               case $libdir in
2916               -R*) temp_xrpath=`$echo "X$libdir" | $Xsed -e 's/^-R//'`
2917                    case " $xrpath " in
2918                    *" $temp_xrpath "*) ;;
2919                    *) xrpath="$xrpath $temp_xrpath";;
2920                    esac;;
2921               *) temp_deplibs="$temp_deplibs $libdir";;
2922               esac
2923             done
2924             dependency_libs="$temp_deplibs"
2925           fi
2926
2927           newlib_search_path="$newlib_search_path $absdir"
2928           # Link against this library
2929           test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs"
2930           # ... and its dependency_libs
2931           tmp_libs=
2932           for deplib in $dependency_libs; do
2933             newdependency_libs="$deplib $newdependency_libs"
2934             if test "X$duplicate_deps" = "Xyes" ; then
2935               case "$tmp_libs " in
2936               *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
2937               esac
2938             fi
2939             tmp_libs="$tmp_libs $deplib"
2940           done
2941
2942           if test "$link_all_deplibs" != no; then
2943             # Add the search paths of all dependency libraries
2944             for deplib in $dependency_libs; do
2945               case $deplib in
2946               -L*) path="$deplib" ;;
2947               *.la)
2948                 dir=`$echo "X$deplib" | $Xsed -e 's%/[^/]*$%%'`
2949                 test "X$dir" = "X$deplib" && dir="."
2950                 # We need an absolute path.
2951                 case $dir in
2952                 [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;;
2953                 *)
2954                   absdir=`cd "$dir" && pwd`
2955                   if test -z "$absdir"; then
2956                     $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2
2957                     absdir="$dir"
2958                   fi
2959                   ;;
2960                 esac
2961                 if grep "^installed=no" $deplib > /dev/null; then
2962                   path="$absdir/$objdir"
2963                 else
2964                   eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
2965                   if test -z "$libdir"; then
2966                     $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
2967                     exit $EXIT_FAILURE
2968                   fi
2969                   if test "$absdir" != "$libdir"; then
2970                     $echo "$modename: warning: \`$deplib' seems to be moved" 1>&2
2971                   fi
2972                   path="$absdir"
2973                 fi
2974                 depdepl=
2975                 case $host in
2976                 *-*-darwin*)
2977                   # we do not want to link against static libs,
2978                   # but need to link against shared
2979                   eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib`
2980                   eval deplibdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
2981                   if test -n "$deplibrary_names" ; then
2982                     for tmp in $deplibrary_names ; do
2983                       depdepl=$tmp
2984                     done
2985                     if test -f "$deplibdir/$depdepl" ; then
2986                       depdepl="$deplibdir/$depdepl"
2987                     elif test -f "$path/$depdepl" ; then
2988                       depdepl="$path/$depdepl"
2989                     else
2990                       # Can't find it, oh well...
2991                       depdepl=
2992                     fi
2993                     # do not add paths which are already there
2994                     case " $newlib_search_path " in
2995                     *" $path "*) ;;
2996                     *) newlib_search_path="$newlib_search_path $path";;
2997                     esac
2998                   fi
2999                   path=""
3000                   ;;
3001                 *)
3002                   path="-L$path"
3003                   ;;
3004                 esac
3005                 ;;
3006               -l*)
3007                 case $host in
3008                 *-*-darwin*)
3009                   # Again, we only want to link against shared libraries
3010                   eval tmp_libs=`$echo "X$deplib" | $Xsed -e "s,^\-l,,"`
3011                   for tmp in $newlib_search_path ; do
3012                     if test -f "$tmp/lib$tmp_libs.dylib" ; then
3013                       eval depdepl="$tmp/lib$tmp_libs.dylib"
3014                       break
3015                     fi
3016                   done
3017                   path=""
3018                   ;;
3019                 *) continue ;;
3020                 esac
3021                 ;;
3022               *) continue ;;
3023               esac
3024               case " $deplibs " in
3025               *" $path "*) ;;
3026               *) deplibs="$path $deplibs" ;;
3027               esac
3028               case " $deplibs " in
3029               *" $depdepl "*) ;;
3030               *) deplibs="$depdepl $deplibs" ;;
3031               esac
3032             done
3033           fi # link_all_deplibs != no
3034         fi # linkmode = lib
3035       done # for deplib in $libs
3036       dependency_libs="$newdependency_libs"
3037       if test "$pass" = dlpreopen; then
3038         # Link the dlpreopened libraries before other libraries
3039         for deplib in $save_deplibs; do
3040           deplibs="$deplib $deplibs"
3041         done
3042       fi
3043       if test "$pass" != dlopen; then
3044         if test "$pass" != conv; then
3045           # Make sure lib_search_path contains only unique directories.
3046           lib_search_path=
3047           for dir in $newlib_search_path; do
3048             case "$lib_search_path " in
3049             *" $dir "*) ;;
3050             *) lib_search_path="$lib_search_path $dir" ;;
3051             esac
3052           done
3053           newlib_search_path=
3054         fi
3055
3056         if test "$linkmode,$pass" != "prog,link"; then
3057           vars="deplibs"
3058         else
3059           vars="compile_deplibs finalize_deplibs"
3060         fi
3061         for var in $vars dependency_libs; do
3062           # Add libraries to $var in reverse order
3063           eval tmp_libs=\"\$$var\"
3064           new_libs=
3065           for deplib in $tmp_libs; do
3066             # FIXME: Pedantically, this is the right thing to do, so
3067             #        that some nasty dependency loop isn't accidentally
3068             #        broken:
3069             #new_libs="$deplib $new_libs"
3070             # Pragmatically, this seems to cause very few problems in
3071             # practice:
3072             case $deplib in
3073             -L*) new_libs="$deplib $new_libs" ;;
3074             -R*) ;;
3075             *)
3076               # And here is the reason: when a library appears more
3077               # than once as an explicit dependence of a library, or
3078               # is implicitly linked in more than once by the
3079               # compiler, it is considered special, and multiple
3080               # occurrences thereof are not removed.  Compare this
3081               # with having the same library being listed as a
3082               # dependency of multiple other libraries: in this case,
3083               # we know (pedantically, we assume) the library does not
3084               # need to be listed more than once, so we keep only the
3085               # last copy.  This is not always right, but it is rare
3086               # enough that we require users that really mean to play
3087               # such unportable linking tricks to link the library
3088               # using -Wl,-lname, so that libtool does not consider it
3089               # for duplicate removal.
3090               case " $specialdeplibs " in
3091               *" $deplib "*) new_libs="$deplib $new_libs" ;;
3092               *)
3093                 case " $new_libs " in
3094                 *" $deplib "*) ;;
3095                 *) new_libs="$deplib $new_libs" ;;
3096                 esac
3097                 ;;
3098               esac
3099               ;;
3100             esac
3101           done
3102           tmp_libs=
3103           for deplib in $new_libs; do
3104             case $deplib in
3105             -L*)
3106               case " $tmp_libs " in
3107               *" $deplib "*) ;;
3108               *) tmp_libs="$tmp_libs $deplib" ;;
3109               esac
3110               ;;
3111             *) tmp_libs="$tmp_libs $deplib" ;;
3112             esac
3113           done
3114           eval $var=\"$tmp_libs\"
3115         done # for var
3116       fi
3117       # Last step: remove runtime libs from dependency_libs
3118       # (they stay in deplibs)
3119       tmp_libs=
3120       for i in $dependency_libs ; do
3121         case " $predeps $postdeps $compiler_lib_search_path " in
3122         *" $i "*)
3123           i=""
3124           ;;
3125         esac
3126         if test -n "$i" ; then
3127           tmp_libs="$tmp_libs $i"
3128         fi
3129       done
3130       dependency_libs=$tmp_libs
3131     done # for pass
3132     if test "$linkmode" = prog; then
3133       dlfiles="$newdlfiles"
3134       dlprefiles="$newdlprefiles"
3135     fi
3136
3137     case $linkmode in
3138     oldlib)
3139       case " $deplibs" in
3140       *\ -l* | *\ -L*)
3141         $echo "$modename: warning: \`-l' and \`-L' are ignored for archives" 1>&2 ;;
3142       esac
3143
3144       if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
3145         $echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2
3146       fi
3147
3148       if test -n "$rpath"; then
3149         $echo "$modename: warning: \`-rpath' is ignored for archives" 1>&2
3150       fi
3151
3152       if test -n "$xrpath"; then
3153         $echo "$modename: warning: \`-R' is ignored for archives" 1>&2
3154       fi
3155
3156       if test -n "$vinfo"; then
3157         $echo "$modename: warning: \`-version-info/-version-number' is ignored for archives" 1>&2
3158       fi
3159
3160       if test -n "$release"; then
3161         $echo "$modename: warning: \`-release' is ignored for archives" 1>&2
3162       fi
3163
3164       if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
3165         $echo "$modename: warning: \`-export-symbols' is ignored for archives" 1>&2
3166       fi
3167
3168       # Now set the variables for building old libraries.
3169       build_libtool_libs=no
3170       oldlibs="$output"
3171       objs="$objs$old_deplibs"
3172       ;;
3173
3174     lib)
3175       # Make sure we only generate libraries of the form `libNAME.la'.
3176       case $outputname in
3177       lib*)
3178         name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
3179         eval shared_ext=\"$shrext_cmds\"
3180         eval libname=\"$libname_spec\"
3181         ;;
3182       *)
3183         if test "$module" = no; then
3184           $echo "$modename: libtool library \`$output' must begin with \`lib'" 1>&2
3185           $echo "$help" 1>&2
3186           exit $EXIT_FAILURE
3187         fi
3188         if test "$need_lib_prefix" != no; then
3189           # Add the "lib" prefix for modules if required
3190           name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
3191           eval shared_ext=\"$shrext_cmds\"
3192           eval libname=\"$libname_spec\"
3193         else
3194           libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
3195         fi
3196         ;;
3197       esac
3198
3199       if test -n "$objs"; then
3200         if test "$deplibs_check_method" != pass_all; then
3201           $echo "$modename: cannot build libtool library \`$output' from non-libtool objects on this host:$objs" 2>&1
3202           exit $EXIT_FAILURE
3203         else
3204           $echo
3205           $echo "*** Warning: Linking the shared library $output against the non-libtool"
3206           $echo "*** objects $objs is not portable!"
3207           libobjs="$libobjs $objs"
3208         fi
3209       fi
3210
3211       if test "$dlself" != no; then
3212         $echo "$modename: warning: \`-dlopen self' is ignored for libtool libraries" 1>&2
3213       fi
3214
3215       set dummy $rpath
3216       if test "$#" -gt 2; then
3217         $echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2
3218       fi
3219       install_libdir="$2"
3220
3221       oldlibs=
3222       if test -z "$rpath"; then
3223         if test "$build_libtool_libs" = yes; then
3224           # Building a libtool convenience library.
3225           # Some compilers have problems with a `.al' extension so
3226           # convenience libraries should have the same extension an
3227           # archive normally would.
3228           oldlibs="$output_objdir/$libname.$libext $oldlibs"
3229           build_libtool_libs=convenience
3230           build_old_libs=yes
3231         fi
3232
3233         if test -n "$vinfo"; then
3234           $echo "$modename: warning: \`-version-info/-version-number' is ignored for convenience libraries" 1>&2
3235         fi
3236
3237         if test -n "$release"; then
3238           $echo "$modename: warning: \`-release' is ignored for convenience libraries" 1>&2
3239         fi
3240       else
3241
3242         # Parse the version information argument.
3243         save_ifs="$IFS"; IFS=':'
3244         set dummy $vinfo 0 0 0
3245         IFS="$save_ifs"
3246
3247         if test -n "$8"; then
3248           $echo "$modename: too many parameters to \`-version-info'" 1>&2
3249           $echo "$help" 1>&2
3250           exit $EXIT_FAILURE
3251         fi
3252
3253         # convert absolute version numbers to libtool ages
3254         # this retains compatibility with .la files and attempts
3255         # to make the code below a bit more comprehensible
3256
3257         case $vinfo_number in
3258         yes)
3259           number_major="$2"
3260           number_minor="$3"
3261           number_revision="$4"
3262           #
3263           # There are really only two kinds -- those that
3264           # use the current revision as the major version
3265           # and those that subtract age and use age as
3266           # a minor version.  But, then there is irix
3267           # which has an extra 1 added just for fun
3268           #
3269           case $version_type in
3270           darwin|linux|osf|windows|none)
3271             current=`expr $number_major + $number_minor`
3272             age="$number_minor"
3273             revision="$number_revision"
3274             ;;
3275           freebsd-aout|freebsd-elf|sunos)
3276             current="$number_major"
3277             revision="$number_minor"
3278             age="0"
3279             ;;
3280           irix|nonstopux)
3281             current=`expr $number_major + $number_minor`
3282             age="$number_minor"
3283             revision="$number_minor"
3284             lt_irix_increment=no
3285             ;;
3286           esac
3287           ;;
3288         no)
3289           current="$2"
3290           revision="$3"
3291           age="$4"
3292           ;;
3293         esac
3294
3295         # Check that each of the things are valid numbers.
3296         case $current in
3297         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]) ;;
3298         *)
3299           $echo "$modename: CURRENT \`$current' must be a nonnegative integer" 1>&2
3300           $echo "$modename: \`$vinfo' is not valid version information" 1>&2
3301           exit $EXIT_FAILURE
3302           ;;
3303         esac
3304
3305         case $revision in
3306         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]) ;;
3307         *)
3308           $echo "$modename: REVISION \`$revision' must be a nonnegative integer" 1>&2
3309           $echo "$modename: \`$vinfo' is not valid version information" 1>&2
3310           exit $EXIT_FAILURE
3311           ;;
3312         esac
3313
3314         case $age in
3315         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]) ;;
3316         *)
3317           $echo "$modename: AGE \`$age' must be a nonnegative integer" 1>&2
3318           $echo "$modename: \`$vinfo' is not valid version information" 1>&2
3319           exit $EXIT_FAILURE
3320           ;;
3321         esac
3322
3323         if test "$age" -gt "$current"; then
3324           $echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2
3325           $echo "$modename: \`$vinfo' is not valid version information" 1>&2
3326           exit $EXIT_FAILURE
3327         fi
3328
3329         # Calculate the version variables.
3330         major=
3331         versuffix=
3332         verstring=
3333         case $version_type in
3334         none) ;;
3335
3336         darwin)
3337           # Like Linux, but with the current version available in
3338           # verstring for coding it into the library header
3339           major=.`expr $current - $age`
3340           versuffix="$major.$age.$revision"
3341           # Darwin ld doesn't like 0 for these options...
3342           minor_current=`expr $current + 1`
3343           xlcverstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision"
3344           verstring="-compatibility_version $minor_current -current_version $minor_current.$revision"
3345           ;;
3346
3347         freebsd-aout)
3348           major=".$current"
3349           versuffix=".$current.$revision";
3350           ;;
3351
3352         freebsd-elf)
3353           major=".$current"
3354           versuffix=".$current";
3355           ;;
3356
3357         irix | nonstopux)
3358           if test "X$lt_irix_increment" = "Xno"; then
3359             major=`expr $current - $age`
3360           else
3361             major=`expr $current - $age + 1`
3362           fi
3363           case $version_type in
3364             nonstopux) verstring_prefix=nonstopux ;;
3365             *)         verstring_prefix=sgi ;;
3366           esac
3367           verstring="$verstring_prefix$major.$revision"
3368
3369           # Add in all the interfaces that we are compatible with.
3370           loop=$revision
3371           while test "$loop" -ne 0; do
3372             iface=`expr $revision - $loop`
3373             loop=`expr $loop - 1`
3374             verstring="$verstring_prefix$major.$iface:$verstring"
3375           done
3376
3377           # Before this point, $major must not contain `.'.
3378           major=.$major
3379           versuffix="$major.$revision"
3380           ;;
3381
3382         linux)
3383           major=.`expr $current - $age`
3384           versuffix="$major.$age.$revision"
3385           ;;
3386
3387         osf)
3388           major=.`expr $current - $age`
3389           versuffix=".$current.$age.$revision"
3390           verstring="$current.$age.$revision"
3391
3392           # Add in all the interfaces that we are compatible with.
3393           loop=$age
3394           while test "$loop" -ne 0; do
3395             iface=`expr $current - $loop`
3396             loop=`expr $loop - 1`
3397             verstring="$verstring:${iface}.0"
3398           done
3399
3400           # Make executables depend on our current version.
3401           verstring="$verstring:${current}.0"
3402           ;;
3403
3404         sunos)
3405           major=".$current"
3406           versuffix=".$current.$revision"
3407           ;;
3408
3409         windows)
3410           # Use '-' rather than '.', since we only want one
3411           # extension on DOS 8.3 filesystems.
3412           major=`expr $current - $age`
3413           versuffix="-$major"
3414           ;;
3415
3416         *)
3417           $echo "$modename: unknown library version type \`$version_type'" 1>&2
3418           $echo "Fatal configuration error.  See the $PACKAGE docs for more information." 1>&2
3419           exit $EXIT_FAILURE
3420           ;;
3421         esac
3422
3423         # Clear the version info if we defaulted, and they specified a release.
3424         if test -z "$vinfo" && test -n "$release"; then
3425           major=
3426           case $version_type in
3427           darwin)
3428             # we can't check for "0.0" in archive_cmds due to quoting
3429             # problems, so we reset it completely
3430             verstring=
3431             ;;
3432           *)
3433             verstring="0.0"
3434             ;;
3435           esac
3436           if test "$need_version" = no; then
3437             versuffix=
3438           else
3439             versuffix=".0.0"
3440           fi
3441         fi
3442
3443         # Remove version info from name if versioning should be avoided
3444         if test "$avoid_version" = yes && test "$need_version" = no; then
3445           major=
3446           versuffix=
3447           verstring=""
3448         fi
3449
3450         # Check to see if the archive will have undefined symbols.
3451         if test "$allow_undefined" = yes; then
3452           if test "$allow_undefined_flag" = unsupported; then
3453             $echo "$modename: warning: undefined symbols not allowed in $host shared libraries" 1>&2
3454             build_libtool_libs=no
3455             build_old_libs=yes
3456           fi
3457         else
3458           # Don't allow undefined symbols.
3459           allow_undefined_flag="$no_undefined_flag"
3460         fi
3461       fi
3462
3463       if test "$mode" != relink; then
3464         # Remove our outputs, but don't remove object files since they
3465         # may have been created when compiling PIC objects.
3466         removelist=
3467         tempremovelist=`$echo "$output_objdir/*"`
3468         for p in $tempremovelist; do
3469           case $p in
3470             *.$objext)
3471                ;;
3472             $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*)
3473                if test "X$precious_files_regex" != "X"; then
3474                  if echo $p | $EGREP -e "$precious_files_regex" >/dev/null 2>&1
3475                  then
3476                    continue
3477                  fi
3478                fi
3479                removelist="$removelist $p"
3480                ;;
3481             *) ;;
3482           esac
3483         done
3484         if test -n "$removelist"; then
3485           $show "${rm}r $removelist"
3486           $run ${rm}r $removelist
3487         fi
3488       fi
3489
3490       # Now set the variables for building old libraries.
3491       if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then
3492         oldlibs="$oldlibs $output_objdir/$libname.$libext"
3493
3494         # Transform .lo files to .o files.
3495         oldobjs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP`
3496       fi
3497
3498       # Eliminate all temporary directories.
3499       #for path in $notinst_path; do
3500       # lib_search_path=`$echo "$lib_search_path " | ${SED} -e "s% $path % %g"`
3501       # deplibs=`$echo "$deplibs " | ${SED} -e "s% -L$path % %g"`
3502       # dependency_libs=`$echo "$dependency_libs " | ${SED} -e "s% -L$path % %g"`
3503       #done
3504
3505       if test -n "$xrpath"; then
3506         # If the user specified any rpath flags, then add them.
3507         temp_xrpath=
3508         for libdir in $xrpath; do
3509           temp_xrpath="$temp_xrpath -R$libdir"
3510           case "$finalize_rpath " in
3511           *" $libdir "*) ;;
3512           *) finalize_rpath="$finalize_rpath $libdir" ;;
3513           esac
3514         done
3515         if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then
3516           dependency_libs="$temp_xrpath $dependency_libs"
3517         fi
3518       fi
3519
3520       # Make sure dlfiles contains only unique files that won't be dlpreopened
3521       old_dlfiles="$dlfiles"
3522       dlfiles=
3523       for lib in $old_dlfiles; do
3524         case " $dlprefiles $dlfiles " in
3525         *" $lib "*) ;;
3526         *) dlfiles="$dlfiles $lib" ;;
3527         esac
3528       done
3529
3530       # Make sure dlprefiles contains only unique files
3531       old_dlprefiles="$dlprefiles"
3532       dlprefiles=
3533       for lib in $old_dlprefiles; do
3534         case "$dlprefiles " in
3535         *" $lib "*) ;;
3536         *) dlprefiles="$dlprefiles $lib" ;;
3537         esac
3538       done
3539
3540       if test "$build_libtool_libs" = yes; then
3541         if test -n "$rpath"; then
3542           case $host in
3543           *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos*)
3544             # these systems don't actually have a c library (as such)!
3545             ;;
3546           *-*-rhapsody* | *-*-darwin1.[012])
3547             # Rhapsody C library is in the System framework
3548             deplibs="$deplibs -framework System"
3549             ;;
3550           *-*-netbsd*)
3551             # Don't link with libc until the a.out ld.so is fixed.
3552             ;;
3553           *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
3554             # Do not include libc due to us having libc/libc_r.
3555             ;;
3556           *-*-sco3.2v5* | *-*-sco5v6*)
3557             # Causes problems with __ctype
3558             ;;
3559           *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
3560             # Compiler inserts libc in the correct place for threads to work
3561             ;;
3562           *)
3563             # Add libc to deplibs on all other systems if necessary.
3564             if test "$build_libtool_need_lc" = "yes"; then
3565               deplibs="$deplibs -lc"
3566             fi
3567             ;;
3568           esac
3569         fi
3570
3571         # Transform deplibs into only deplibs that can be linked in shared.
3572         name_save=$name
3573         libname_save=$libname
3574         release_save=$release
3575         versuffix_save=$versuffix
3576         major_save=$major
3577         # I'm not sure if I'm treating the release correctly.  I think
3578         # release should show up in the -l (ie -lgmp5) so we don't want to
3579         # add it in twice.  Is that correct?
3580         release=""
3581         versuffix=""
3582         major=""
3583         newdeplibs=
3584         droppeddeps=no
3585         case $deplibs_check_method in
3586         pass_all)
3587           # Don't check for shared/static.  Everything works.
3588           # This might be a little naive.  We might want to check
3589           # whether the library exists or not.  But this is on
3590           # osf3 & osf4 and I'm not really sure... Just
3591           # implementing what was already the behavior.
3592           newdeplibs=$deplibs
3593           ;;
3594         test_compile)
3595           # This code stresses the "libraries are programs" paradigm to its
3596           # limits. Maybe even breaks it.  We compile a program, linking it
3597           # against the deplibs as a proxy for the library.  Then we can check
3598           # whether they linked in statically or dynamically with ldd.
3599           $rm conftest.c
3600           cat > conftest.c <<EOF
3601           int main() { return 0; }
3602 EOF
3603           $rm conftest
3604           if $LTCC $LTCFLAGS -o conftest conftest.c $deplibs; then
3605             ldd_output=`ldd conftest`
3606             for i in $deplibs; do
3607               name=`expr $i : '-l\(.*\)'`
3608               # If $name is empty we are operating on a -L argument.
3609               if test "$name" != "" && test "$name" != "0"; then
3610                 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
3611                   case " $predeps $postdeps " in
3612                   *" $i "*)
3613                     newdeplibs="$newdeplibs $i"
3614                     i=""
3615                     ;;
3616                   esac
3617                 fi
3618                 if test -n "$i" ; then
3619                   libname=`eval \\$echo \"$libname_spec\"`
3620                   deplib_matches=`eval \\$echo \"$library_names_spec\"`
3621                   set dummy $deplib_matches
3622                   deplib_match=$2
3623                   if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
3624                     newdeplibs="$newdeplibs $i"
3625                   else
3626                     droppeddeps=yes
3627                     $echo
3628                     $echo "*** Warning: dynamic linker does not accept needed library $i."
3629                     $echo "*** I have the capability to make that library automatically link in when"
3630                     $echo "*** you link to this library.  But I can only do this if you have a"
3631                     $echo "*** shared version of the library, which I believe you do not have"
3632                     $echo "*** because a test_compile did reveal that the linker did not use it for"