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