Add default Smack manifest for prelink.spec
[external/prelink.git] / ltmain.sh
1 # ltmain.sh - Provide generalized library-building support services.
2 # NOTE: Changing this file will not affect anything until you rerun configure.
3 #
4 # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001
5 # Free Software Foundation, Inc.
6 # Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
7 #
8 # This program is free software; you can redistribute it and/or modify
9 # it under the terms of the GNU General Public License as published by
10 # the Free Software Foundation; either version 2 of the License, or
11 # (at your option) any later version.
12 #
13 # This program is distributed in the hope that it will be useful, but
14 # WITHOUT ANY WARRANTY; without even the implied warranty of
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16 # General Public License for more details.
17 #
18 # You should have received a copy of the GNU General Public License
19 # along with this program; if not, write to the Free Software
20 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
21 #
22 # As a special exception to the GNU General Public License, if you
23 # distribute this file as part of a program that contains a
24 # configuration script generated by Autoconf, you may include it under
25 # the same distribution terms that you use for the rest of that program.
26
27 # Check that we have a working $echo.
28 if test "X$1" = X--no-reexec; then
29   # Discard the --no-reexec flag, and continue.
30   shift
31 elif test "X$1" = X--fallback-echo; then
32   # Avoid inline document here, it may be left over
33   :
34 elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then
35   # Yippee, $echo works!
36   :
37 else
38   # Restart under the correct shell, and then maybe $echo will work.
39   exec $SHELL "$0" --no-reexec ${1+"$@"}
40 fi
41
42 if test "X$1" = X--fallback-echo; then
43   # used as fallback echo
44   shift
45   cat <<EOF
46 $*
47 EOF
48   exit 0
49 fi
50
51 # The name of this program.
52 progname=`$echo "$0" | sed 's%^.*/%%'`
53 modename="$progname"
54
55 # Constants.
56 PROGRAM=ltmain.sh
57 PACKAGE=libtool
58 VERSION=1.4.2
59 TIMESTAMP=" (1.922.2.54 2001/09/11 03:33:37)"
60
61 default_mode=
62 help="Try \`$progname --help' for more information."
63 magic="%%%MAGIC variable%%%"
64 mkdir="mkdir"
65 mv="mv -f"
66 rm="rm -f"
67
68 # Sed substitution that helps us do robust quoting.  It backslashifies
69 # metacharacters that are still active within double-quoted strings.
70 Xsed='sed -e 1s/^X//'
71 sed_quote_subst='s/\([\\`\\"$\\\\]\)/\\\1/g'
72 SP2NL='tr \040 \012'
73 NL2SP='tr \015\012 \040\040'
74
75 # NLS nuisances.
76 # Only set LANG and LC_ALL to C if already set.
77 # These must not be set unconditionally because not all systems understand
78 # e.g. LANG=C (notably SCO).
79 # We save the old values to restore during execute mode.
80 if test "${LC_ALL+set}" = set; then
81   save_LC_ALL="$LC_ALL"; LC_ALL=C; export LC_ALL
82 fi
83 if test "${LANG+set}" = set; then
84   save_LANG="$LANG"; LANG=C; export LANG
85 fi
86
87 # Make sure IFS has a sensible default
88 : ${IFS="       "}
89
90 if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
91   echo "$modename: not configured to build any kind of library" 1>&2
92   echo "Fatal configuration error.  See the $PACKAGE docs for more information." 1>&2
93   exit 1
94 fi
95
96 # Global variables.
97 mode=$default_mode
98 nonopt=
99 prev=
100 prevopt=
101 run=
102 show="$echo"
103 show_help=
104 execute_dlfiles=
105 lo2o="s/\\.lo\$/.${objext}/"
106 o2lo="s/\\.${objext}\$/.lo/"
107
108 # Parse our command line options once, thoroughly.
109 while test $# -gt 0
110 do
111   arg="$1"
112   shift
113
114   case $arg in
115   -*=*) optarg=`$echo "X$arg" | $Xsed -e 's/[-_a-zA-Z0-9]*=//'` ;;
116   *) optarg= ;;
117   esac
118
119   # If the previous option needs an argument, assign it.
120   if test -n "$prev"; then
121     case $prev in
122     execute_dlfiles)
123       execute_dlfiles="$execute_dlfiles $arg"
124       ;;
125     *)
126       eval "$prev=\$arg"
127       ;;
128     esac
129
130     prev=
131     prevopt=
132     continue
133   fi
134
135   # Have we seen a non-optional argument yet?
136   case $arg in
137   --help)
138     show_help=yes
139     ;;
140
141   --version)
142     echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP"
143     exit 0
144     ;;
145
146   --config)
147     sed -e '1,/^# ### BEGIN LIBTOOL CONFIG/d' -e '/^# ### END LIBTOOL CONFIG/,$d' $0
148     exit 0
149     ;;
150
151   --debug)
152     echo "$progname: enabling shell trace mode"
153     set -x
154     ;;
155
156   --dry-run | -n)
157     run=:
158     ;;
159
160   --features)
161     echo "host: $host"
162     if test "$build_libtool_libs" = yes; then
163       echo "enable shared libraries"
164     else
165       echo "disable shared libraries"
166     fi
167     if test "$build_old_libs" = yes; then
168       echo "enable static libraries"
169     else
170       echo "disable static libraries"
171     fi
172     exit 0
173     ;;
174
175   --finish) mode="finish" ;;
176
177   --mode) prevopt="--mode" prev=mode ;;
178   --mode=*) mode="$optarg" ;;
179
180   --preserve-dup-deps) duplicate_deps="yes" ;;
181
182   --quiet | --silent)
183     show=:
184     ;;
185
186   -dlopen)
187     prevopt="-dlopen"
188     prev=execute_dlfiles
189     ;;
190
191   -*)
192     $echo "$modename: unrecognized option \`$arg'" 1>&2
193     $echo "$help" 1>&2
194     exit 1
195     ;;
196
197   *)
198     nonopt="$arg"
199     break
200     ;;
201   esac
202 done
203
204 if test -n "$prevopt"; then
205   $echo "$modename: option \`$prevopt' requires an argument" 1>&2
206   $echo "$help" 1>&2
207   exit 1
208 fi
209
210 # If this variable is set in any of the actions, the command in it
211 # will be execed at the end.  This prevents here-documents from being
212 # left over by shells.
213 exec_cmd=
214
215 if test -z "$show_help"; then
216
217   # Infer the operation mode.
218   if test -z "$mode"; then
219     case $nonopt in
220     *cc | *++ | gcc* | *-gcc*)
221       mode=link
222       for arg
223       do
224         case $arg in
225         -c)
226            mode=compile
227            break
228            ;;
229         esac
230       done
231       ;;
232     *db | *dbx | *strace | *truss)
233       mode=execute
234       ;;
235     *install*|cp|mv)
236       mode=install
237       ;;
238     *rm)
239       mode=uninstall
240       ;;
241     *)
242       # If we have no mode, but dlfiles were specified, then do execute mode.
243       test -n "$execute_dlfiles" && mode=execute
244
245       # Just use the default operation mode.
246       if test -z "$mode"; then
247         if test -n "$nonopt"; then
248           $echo "$modename: warning: cannot infer operation mode from \`$nonopt'" 1>&2
249         else
250           $echo "$modename: warning: cannot infer operation mode without MODE-ARGS" 1>&2
251         fi
252       fi
253       ;;
254     esac
255   fi
256
257   # Only execute mode is allowed to have -dlopen flags.
258   if test -n "$execute_dlfiles" && test "$mode" != execute; then
259     $echo "$modename: unrecognized option \`-dlopen'" 1>&2
260     $echo "$help" 1>&2
261     exit 1
262   fi
263
264   # Change the help message to a mode-specific one.
265   generic_help="$help"
266   help="Try \`$modename --help --mode=$mode' for more information."
267
268   # These modes are in order of execution frequency so that they run quickly.
269   case $mode in
270   # libtool compile mode
271   compile)
272     modename="$modename: compile"
273     # Get the compilation command and the source file.
274     base_compile=
275     prev=
276     lastarg=
277     srcfile="$nonopt"
278     suppress_output=
279
280     user_target=no
281     for arg
282     do
283       case $prev in
284       "") ;;
285       xcompiler)
286         # Aesthetically quote the previous argument.
287         prev=
288         lastarg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
289
290         case $arg in
291         # Double-quote args containing other shell metacharacters.
292         # Many Bourne shells cannot handle close brackets correctly
293         # in scan sets, so we specify it separately.
294         *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \   ]*|*]*|"")
295           arg="\"$arg\""
296           ;;
297         esac
298
299         # Add the previous argument to base_compile.
300         if test -z "$base_compile"; then
301           base_compile="$lastarg"
302         else
303           base_compile="$base_compile $lastarg"
304         fi
305         continue
306         ;;
307       esac
308
309       # Accept any command-line options.
310       case $arg in
311       -o)
312         if test "$user_target" != "no"; then
313           $echo "$modename: you cannot specify \`-o' more than once" 1>&2
314           exit 1
315         fi
316         user_target=next
317         ;;
318
319       -static)
320         build_old_libs=yes
321         continue
322         ;;
323
324       -prefer-pic)
325         pic_mode=yes
326         continue
327         ;;
328
329       -prefer-non-pic)
330         pic_mode=no
331         continue
332         ;;
333
334       -Xcompiler)
335         prev=xcompiler
336         continue
337         ;;
338
339       -Wc,*)
340         args=`$echo "X$arg" | $Xsed -e "s/^-Wc,//"`
341         lastarg=
342         save_ifs="$IFS"; IFS=','
343         for arg in $args; do
344           IFS="$save_ifs"
345
346           # Double-quote args containing other shell metacharacters.
347           # Many Bourne shells cannot handle close brackets correctly
348           # in scan sets, so we specify it separately.
349           case $arg in
350             *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \       ]*|*]*|"")
351             arg="\"$arg\""
352             ;;
353           esac
354           lastarg="$lastarg $arg"
355         done
356         IFS="$save_ifs"
357         lastarg=`$echo "X$lastarg" | $Xsed -e "s/^ //"`
358
359         # Add the arguments to base_compile.
360         if test -z "$base_compile"; then
361           base_compile="$lastarg"
362         else
363           base_compile="$base_compile $lastarg"
364         fi
365         continue
366         ;;
367       esac
368
369       case $user_target in
370       next)
371         # The next one is the -o target name
372         user_target=yes
373         continue
374         ;;
375       yes)
376         # We got the output file
377         user_target=set
378         libobj="$arg"
379         continue
380         ;;
381       esac
382
383       # Accept the current argument as the source file.
384       lastarg="$srcfile"
385       srcfile="$arg"
386
387       # Aesthetically quote the previous argument.
388
389       # Backslashify any backslashes, double quotes, and dollar signs.
390       # These are the only characters that are still specially
391       # interpreted inside of double-quoted scrings.
392       lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"`
393
394       # Double-quote args containing other shell metacharacters.
395       # Many Bourne shells cannot handle close brackets correctly
396       # in scan sets, so we specify it separately.
397       case $lastarg in
398       *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \     ]*|*]*|"")
399         lastarg="\"$lastarg\""
400         ;;
401       esac
402
403       # Add the previous argument to base_compile.
404       if test -z "$base_compile"; then
405         base_compile="$lastarg"
406       else
407         base_compile="$base_compile $lastarg"
408       fi
409     done
410
411     case $user_target in
412     set)
413       ;;
414     no)
415       # Get the name of the library object.
416       libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'`
417       ;;
418     *)
419       $echo "$modename: you must specify a target with \`-o'" 1>&2
420       exit 1
421       ;;
422     esac
423
424     # Recognize several different file suffixes.
425     # If the user specifies -o file.o, it is replaced with file.lo
426     xform='[cCFSfmso]'
427     case $libobj in
428     *.ada) xform=ada ;;
429     *.adb) xform=adb ;;
430     *.ads) xform=ads ;;
431     *.asm) xform=asm ;;
432     *.c++) xform=c++ ;;
433     *.cc) xform=cc ;;
434     *.cpp) xform=cpp ;;
435     *.cxx) xform=cxx ;;
436     *.f90) xform=f90 ;;
437     *.for) xform=for ;;
438     esac
439
440     libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"`
441
442     case $libobj in
443     *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;;
444     *)
445       $echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2
446       exit 1
447       ;;
448     esac
449
450     if test -z "$base_compile"; then
451       $echo "$modename: you must specify a compilation command" 1>&2
452       $echo "$help" 1>&2
453       exit 1
454     fi
455
456     # Delete any leftover library objects.
457     if test "$build_old_libs" = yes; then
458       removelist="$obj $libobj"
459     else
460       removelist="$libobj"
461     fi
462
463     $run $rm $removelist
464     trap "$run $rm $removelist; exit 1" 1 2 15
465
466     # On Cygwin there's no "real" PIC flag so we must build both object types
467     case $host_os in
468     cygwin* | mingw* | pw32* | os2*)
469       pic_mode=default
470       ;;
471     esac
472     if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then
473       # non-PIC code in shared libraries is not supported
474       pic_mode=default
475     fi
476
477     # Calculate the filename of the output object if compiler does
478     # not support -o with -c
479     if test "$compiler_c_o" = no; then
480       output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext}
481       lockfile="$output_obj.lock"
482       removelist="$removelist $output_obj $lockfile"
483       trap "$run $rm $removelist; exit 1" 1 2 15
484     else
485       need_locks=no
486       lockfile=
487     fi
488
489     # Lock this critical section if it is needed
490     # We use this script file to make the link, it avoids creating a new file
491     if test "$need_locks" = yes; then
492       until $run ln "$0" "$lockfile" 2>/dev/null; do
493         $show "Waiting for $lockfile to be removed"
494         sleep 2
495       done
496     elif test "$need_locks" = warn; then
497       if test -f "$lockfile"; then
498         echo "\
499 *** ERROR, $lockfile exists and contains:
500 `cat $lockfile 2>/dev/null`
501
502 This indicates that another process is trying to use the same
503 temporary object file, and libtool could not work around it because
504 your compiler does not support \`-c' and \`-o' together.  If you
505 repeat this compilation, it may succeed, by chance, but you had better
506 avoid parallel builds (make -j) in this platform, or get a better
507 compiler."
508
509         $run $rm $removelist
510         exit 1
511       fi
512       echo $srcfile > "$lockfile"
513     fi
514
515     if test -n "$fix_srcfile_path"; then
516       eval srcfile=\"$fix_srcfile_path\"
517     fi
518
519     # Only build a PIC object if we are building libtool libraries.
520     if test "$build_libtool_libs" = yes; then
521       # Without this assignment, base_compile gets emptied.
522       fbsd_hideous_sh_bug=$base_compile
523
524       if test "$pic_mode" != no; then
525         # All platforms use -DPIC, to notify preprocessed assembler code.
526         command="$base_compile $srcfile $pic_flag -DPIC"
527       else
528         # Don't build PIC code
529         command="$base_compile $srcfile"
530       fi
531       if test "$build_old_libs" = yes; then
532         lo_libobj="$libobj"
533         dir=`$echo "X$libobj" | $Xsed -e 's%/[^/]*$%%'`
534         if test "X$dir" = "X$libobj"; then
535           dir="$objdir"
536         else
537           dir="$dir/$objdir"
538         fi
539         libobj="$dir/"`$echo "X$libobj" | $Xsed -e 's%^.*/%%'`
540
541         if test -d "$dir"; then
542           $show "$rm $libobj"
543           $run $rm $libobj
544         else
545           $show "$mkdir $dir"
546           $run $mkdir $dir
547           status=$?
548           if test $status -ne 0 && test ! -d $dir; then
549             exit $status
550           fi
551         fi
552       fi
553       if test "$compiler_o_lo" = yes; then
554         output_obj="$libobj"
555         command="$command -o $output_obj"
556       elif test "$compiler_c_o" = yes; then
557         output_obj="$obj"
558         command="$command -o $output_obj"
559       fi
560
561       $run $rm "$output_obj"
562       $show "$command"
563       if $run eval "$command"; then :
564       else
565         test -n "$output_obj" && $run $rm $removelist
566         exit 1
567       fi
568
569       if test "$need_locks" = warn &&
570          test x"`cat $lockfile 2>/dev/null`" != x"$srcfile"; then
571         echo "\
572 *** ERROR, $lockfile contains:
573 `cat $lockfile 2>/dev/null`
574
575 but it should contain:
576 $srcfile
577
578 This indicates that another process is trying to use the same
579 temporary object file, and libtool could not work around it because
580 your compiler does not support \`-c' and \`-o' together.  If you
581 repeat this compilation, it may succeed, by chance, but you had better
582 avoid parallel builds (make -j) in this platform, or get a better
583 compiler."
584
585         $run $rm $removelist
586         exit 1
587       fi
588
589       # Just move the object if needed, then go on to compile the next one
590       if test x"$output_obj" != x"$libobj"; then
591         $show "$mv $output_obj $libobj"
592         if $run $mv $output_obj $libobj; then :
593         else
594           error=$?
595           $run $rm $removelist
596           exit $error
597         fi
598       fi
599
600       # If we have no pic_flag, then copy the object into place and finish.
601       if (test -z "$pic_flag" || test "$pic_mode" != default) &&
602          test "$build_old_libs" = yes; then
603         # Rename the .lo from within objdir to obj
604         if test -f $obj; then
605           $show $rm $obj
606           $run $rm $obj
607         fi
608
609         $show "$mv $libobj $obj"
610         if $run $mv $libobj $obj; then :
611         else
612           error=$?
613           $run $rm $removelist
614           exit $error
615         fi
616
617         xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'`
618         if test "X$xdir" = "X$obj"; then
619           xdir="."
620         else
621           xdir="$xdir"
622         fi
623         baseobj=`$echo "X$obj" | $Xsed -e "s%.*/%%"`
624         libobj=`$echo "X$baseobj" | $Xsed -e "$o2lo"`
625         # Now arrange that obj and lo_libobj become the same file
626         $show "(cd $xdir && $LN_S $baseobj $libobj)"
627         if $run eval '(cd $xdir && $LN_S $baseobj $libobj)'; then
628           # Unlock the critical section if it was locked
629           if test "$need_locks" != no; then
630             $run $rm "$lockfile"
631           fi
632           exit 0
633         else
634           error=$?
635           $run $rm $removelist
636           exit $error
637         fi
638       fi
639
640       # Allow error messages only from the first compilation.
641       suppress_output=' >/dev/null 2>&1'
642     fi
643
644     # Only build a position-dependent object if we build old libraries.
645     if test "$build_old_libs" = yes; then
646       if test "$pic_mode" != yes; then
647         # Don't build PIC code
648         command="$base_compile $srcfile"
649       else
650         # All platforms use -DPIC, to notify preprocessed assembler code.
651         command="$base_compile $srcfile $pic_flag -DPIC"
652       fi
653       if test "$compiler_c_o" = yes; then
654         command="$command -o $obj"
655         output_obj="$obj"
656       fi
657
658       # Suppress compiler output if we already did a PIC compilation.
659       command="$command$suppress_output"
660       $run $rm "$output_obj"
661       $show "$command"
662       if $run eval "$command"; then :
663       else
664         $run $rm $removelist
665         exit 1
666       fi
667
668       if test "$need_locks" = warn &&
669          test x"`cat $lockfile 2>/dev/null`" != x"$srcfile"; then
670         echo "\
671 *** ERROR, $lockfile contains:
672 `cat $lockfile 2>/dev/null`
673
674 but it should contain:
675 $srcfile
676
677 This indicates that another process is trying to use the same
678 temporary object file, and libtool could not work around it because
679 your compiler does not support \`-c' and \`-o' together.  If you
680 repeat this compilation, it may succeed, by chance, but you had better
681 avoid parallel builds (make -j) in this platform, or get a better
682 compiler."
683
684         $run $rm $removelist
685         exit 1
686       fi
687
688       # Just move the object if needed
689       if test x"$output_obj" != x"$obj"; then
690         $show "$mv $output_obj $obj"
691         if $run $mv $output_obj $obj; then :
692         else
693           error=$?
694           $run $rm $removelist
695           exit $error
696         fi
697       fi
698
699       # Create an invalid libtool object if no PIC, so that we do not
700       # accidentally link it into a program.
701       if test "$build_libtool_libs" != yes; then
702         $show "echo timestamp > $libobj"
703         $run eval "echo timestamp > \$libobj" || exit $?
704       else
705         # Move the .lo from within objdir
706         $show "$mv $libobj $lo_libobj"
707         if $run $mv $libobj $lo_libobj; then :
708         else
709           error=$?
710           $run $rm $removelist
711           exit $error
712         fi
713       fi
714     fi
715
716     # Unlock the critical section if it was locked
717     if test "$need_locks" != no; then
718       $run $rm "$lockfile"
719     fi
720
721     exit 0
722     ;;
723
724   # libtool link mode
725   link | relink)
726     modename="$modename: link"
727     case $host in
728     *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
729       # It is impossible to link a dll without this setting, and
730       # we shouldn't force the makefile maintainer to figure out
731       # which system we are compiling for in order to pass an extra
732       # flag for every libtool invokation.
733       # allow_undefined=no
734
735       # FIXME: Unfortunately, there are problems with the above when trying
736       # to make a dll which has undefined symbols, in which case not
737       # even a static library is built.  For now, we need to specify
738       # -no-undefined on the libtool link line when we can be certain
739       # that all symbols are satisfied, otherwise we get a static library.
740       allow_undefined=yes
741       ;;
742     *)
743       allow_undefined=yes
744       ;;
745     esac
746     libtool_args="$nonopt"
747     compile_command="$nonopt"
748     finalize_command="$nonopt"
749
750     compile_rpath=
751     finalize_rpath=
752     compile_shlibpath=
753     finalize_shlibpath=
754     convenience=
755     old_convenience=
756     deplibs=
757     old_deplibs=
758     compiler_flags=
759     linker_flags=
760     dllsearchpath=
761     lib_search_path=`pwd`
762     inst_prefix_dir=
763
764     avoid_version=no
765     dlfiles=
766     dlprefiles=
767     dlself=no
768     export_dynamic=no
769     export_symbols=
770     export_symbols_regex=
771     generated=
772     libobjs=
773     ltlibs=
774     module=no
775     no_install=no
776     objs=
777     prefer_static_libs=no
778     preload=no
779     prev=
780     prevarg=
781     release=
782     rpath=
783     xrpath=
784     perm_rpath=
785     temp_rpath=
786     thread_safe=no
787     vinfo=
788
789     # We need to know -static, to get the right output filenames.
790     for arg
791     do
792       case $arg in
793       -all-static | -static)
794         if test "X$arg" = "X-all-static"; then
795           if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then
796             $echo "$modename: warning: complete static linking is impossible in this configuration" 1>&2
797           fi
798           if test -n "$link_static_flag"; then
799             dlopen_self=$dlopen_self_static
800           fi
801         else
802           if test -z "$pic_flag" && test -n "$link_static_flag"; then
803             dlopen_self=$dlopen_self_static
804           fi
805         fi
806         build_libtool_libs=no
807         build_old_libs=yes
808         prefer_static_libs=yes
809         break
810         ;;
811       esac
812     done
813
814     # See if our shared archives depend on static archives.
815     test -n "$old_archive_from_new_cmds" && build_old_libs=yes
816
817     # Go through the arguments, transforming them on the way.
818     while test $# -gt 0; do
819       arg="$1"
820       shift
821       case $arg in
822       *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \     ]*|*]*|"")
823         qarg=\"`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`\" ### testsuite: skip nested quoting test
824         ;;
825       *) qarg=$arg ;;
826       esac
827       libtool_args="$libtool_args $qarg"
828
829       # If the previous option needs an argument, assign it.
830       if test -n "$prev"; then
831         case $prev in
832         output)
833           compile_command="$compile_command @OUTPUT@"
834           finalize_command="$finalize_command @OUTPUT@"
835           ;;
836         esac
837
838         case $prev in
839         dlfiles|dlprefiles)
840           if test "$preload" = no; then
841             # Add the symbol object into the linking commands.
842             compile_command="$compile_command @SYMFILE@"
843             finalize_command="$finalize_command @SYMFILE@"
844             preload=yes
845           fi
846           case $arg in
847           *.la | *.lo) ;;  # We handle these cases below.
848           force)
849             if test "$dlself" = no; then
850               dlself=needless
851               export_dynamic=yes
852             fi
853             prev=
854             continue
855             ;;
856           self)
857             if test "$prev" = dlprefiles; then
858               dlself=yes
859             elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then
860               dlself=yes
861             else
862               dlself=needless
863               export_dynamic=yes
864             fi
865             prev=
866             continue
867             ;;
868           *)
869             if test "$prev" = dlfiles; then
870               dlfiles="$dlfiles $arg"
871             else
872               dlprefiles="$dlprefiles $arg"
873             fi
874             prev=
875             continue
876             ;;
877           esac
878           ;;
879         expsyms)
880           export_symbols="$arg"
881           if test ! -f "$arg"; then
882             $echo "$modename: symbol file \`$arg' does not exist"
883             exit 1
884           fi
885           prev=
886           continue
887           ;;
888         expsyms_regex)
889           export_symbols_regex="$arg"
890           prev=
891           continue
892           ;;
893         inst_prefix)
894           inst_prefix_dir="$arg"
895           prev=
896           continue
897           ;;
898         release)
899           release="-$arg"
900           prev=
901           continue
902           ;;
903         rpath | xrpath)
904           # We need an absolute path.
905           case $arg in
906           [\\/]* | [A-Za-z]:[\\/]*) ;;
907           *)
908             $echo "$modename: only absolute run-paths are allowed" 1>&2
909             exit 1
910             ;;
911           esac
912           if test "$prev" = rpath; then
913             case "$rpath " in
914             *" $arg "*) ;;
915             *) rpath="$rpath $arg" ;;
916             esac
917           else
918             case "$xrpath " in
919             *" $arg "*) ;;
920             *) xrpath="$xrpath $arg" ;;
921             esac
922           fi
923           prev=
924           continue
925           ;;
926         xcompiler)
927           compiler_flags="$compiler_flags $qarg"
928           prev=
929           compile_command="$compile_command $qarg"
930           finalize_command="$finalize_command $qarg"
931           continue
932           ;;
933         xlinker)
934           linker_flags="$linker_flags $qarg"
935           compiler_flags="$compiler_flags $wl$qarg"
936           prev=
937           compile_command="$compile_command $wl$qarg"
938           finalize_command="$finalize_command $wl$qarg"
939           continue
940           ;;
941         *)
942           eval "$prev=\"\$arg\""
943           prev=
944           continue
945           ;;
946         esac
947       fi # test -n $prev
948
949       prevarg="$arg"
950
951       case $arg in
952       -all-static)
953         if test -n "$link_static_flag"; then
954           compile_command="$compile_command $link_static_flag"
955           finalize_command="$finalize_command $link_static_flag"
956         fi
957         continue
958         ;;
959
960       -allow-undefined)
961         # FIXME: remove this flag sometime in the future.
962         $echo "$modename: \`-allow-undefined' is deprecated because it is the default" 1>&2
963         continue
964         ;;
965
966       -avoid-version)
967         avoid_version=yes
968         continue
969         ;;
970
971       -dlopen)
972         prev=dlfiles
973         continue
974         ;;
975
976       -dlpreopen)
977         prev=dlprefiles
978         continue
979         ;;
980
981       -export-dynamic)
982         export_dynamic=yes
983         continue
984         ;;
985
986       -export-symbols | -export-symbols-regex)
987         if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
988           $echo "$modename: more than one -exported-symbols argument is not allowed"
989           exit 1
990         fi
991         if test "X$arg" = "X-export-symbols"; then
992           prev=expsyms
993         else
994           prev=expsyms_regex
995         fi
996         continue
997         ;;
998
999       -inst-prefix-dir)
1000         prev=inst_prefix
1001         continue
1002         ;;
1003
1004       # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:*
1005       # so, if we see these flags be careful not to treat them like -L
1006       -L[A-Z][A-Z]*:*)
1007         case $with_gcc/$host in
1008         no/*-*-irix*)
1009           compile_command="$compile_command $arg"
1010           finalize_command="$finalize_command $arg"
1011           ;;
1012         esac
1013         continue
1014         ;;
1015
1016       -L*)
1017         dir=`$echo "X$arg" | $Xsed -e 's/^-L//'`
1018         # We need an absolute path.
1019         case $dir in
1020         [\\/]* | [A-Za-z]:[\\/]*) ;;
1021         *)
1022           absdir=`cd "$dir" && pwd`
1023           if test -z "$absdir"; then
1024             $echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2
1025             exit 1
1026           fi
1027           dir="$absdir"
1028           ;;
1029         esac
1030         case "$deplibs " in
1031         *" -L$dir "*) ;;
1032         *)
1033           deplibs="$deplibs -L$dir"
1034           lib_search_path="$lib_search_path $dir"
1035           ;;
1036         esac
1037         case $host in
1038         *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
1039           case :$dllsearchpath: in
1040           *":$dir:"*) ;;
1041           *) dllsearchpath="$dllsearchpath:$dir";;
1042           esac
1043           ;;
1044         esac
1045         continue
1046         ;;
1047
1048       -l*)
1049         if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then
1050           case $host in
1051           *-*-cygwin* | *-*-pw32* | *-*-beos*)
1052             # These systems don't actually have a C or math library (as such)
1053             continue
1054             ;;
1055           *-*-mingw* | *-*-os2*)
1056             # These systems don't actually have a C library (as such)
1057             test "X$arg" = "X-lc" && continue
1058             ;;
1059           *-*-openbsd*)
1060             # Do not include libc due to us having libc/libc_r.
1061             test "X$arg" = "X-lc" && continue
1062             ;;
1063           esac
1064          elif test "X$arg" = "X-lc_r"; then
1065           case $host in
1066           *-*-openbsd*)
1067             # Do not include libc_r directly, use -pthread flag.
1068             continue
1069             ;;
1070           esac
1071         fi
1072         deplibs="$deplibs $arg"
1073         continue
1074         ;;
1075
1076       -module)
1077         module=yes
1078         continue
1079         ;;
1080
1081       -no-fast-install)
1082         fast_install=no
1083         continue
1084         ;;
1085
1086       -no-install)
1087         case $host in
1088         *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
1089           # The PATH hackery in wrapper scripts is required on Windows
1090           # in order for the loader to find any dlls it needs.
1091           $echo "$modename: warning: \`-no-install' is ignored for $host" 1>&2
1092           $echo "$modename: warning: assuming \`-no-fast-install' instead" 1>&2
1093           fast_install=no
1094           ;;
1095         *) no_install=yes ;;
1096         esac
1097         continue
1098         ;;
1099
1100       -no-undefined)
1101         allow_undefined=no
1102         continue
1103         ;;
1104
1105       -o) prev=output ;;
1106
1107       -release)
1108         prev=release
1109         continue
1110         ;;
1111
1112       -rpath)
1113         prev=rpath
1114         continue
1115         ;;
1116
1117       -R)
1118         prev=xrpath
1119         continue
1120         ;;
1121
1122       -R*)
1123         dir=`$echo "X$arg" | $Xsed -e 's/^-R//'`
1124         # We need an absolute path.
1125         case $dir in
1126         [\\/]* | [A-Za-z]:[\\/]*) ;;
1127         *)
1128           $echo "$modename: only absolute run-paths are allowed" 1>&2
1129           exit 1
1130           ;;
1131         esac
1132         case "$xrpath " in
1133         *" $dir "*) ;;
1134         *) xrpath="$xrpath $dir" ;;
1135         esac
1136         continue
1137         ;;
1138
1139       -static)
1140         # The effects of -static are defined in a previous loop.
1141         # We used to do the same as -all-static on platforms that
1142         # didn't have a PIC flag, but the assumption that the effects
1143         # would be equivalent was wrong.  It would break on at least
1144         # Digital Unix and AIX.
1145         continue
1146         ;;
1147
1148       -thread-safe)
1149         thread_safe=yes
1150         continue
1151         ;;
1152
1153       -version-info)
1154         prev=vinfo
1155         continue
1156         ;;
1157
1158       -Wc,*)
1159         args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wc,//'`
1160         arg=
1161         save_ifs="$IFS"; IFS=','
1162         for flag in $args; do
1163           IFS="$save_ifs"
1164           case $flag in
1165             *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \       ]*|*]*|"")
1166             flag="\"$flag\""
1167             ;;
1168           esac
1169           arg="$arg $wl$flag"
1170           compiler_flags="$compiler_flags $flag"
1171         done
1172         IFS="$save_ifs"
1173         arg=`$echo "X$arg" | $Xsed -e "s/^ //"`
1174         ;;
1175
1176       -Wl,*)
1177         args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wl,//'`
1178         arg=
1179         save_ifs="$IFS"; IFS=','
1180         for flag in $args; do
1181           IFS="$save_ifs"
1182           case $flag in
1183             *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \       ]*|*]*|"")
1184             flag="\"$flag\""
1185             ;;
1186           esac
1187           arg="$arg $wl$flag"
1188           compiler_flags="$compiler_flags $wl$flag"
1189           linker_flags="$linker_flags $flag"
1190         done
1191         IFS="$save_ifs"
1192         arg=`$echo "X$arg" | $Xsed -e "s/^ //"`
1193         ;;
1194
1195       -Xcompiler)
1196         prev=xcompiler
1197         continue
1198         ;;
1199
1200       -Xlinker)
1201         prev=xlinker
1202         continue
1203         ;;
1204
1205       # Some other compiler flag.
1206       -* | +*)
1207         # Unknown arguments in both finalize_command and compile_command need
1208         # to be aesthetically quoted because they are evaled later.
1209         arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
1210         case $arg in
1211         *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \   ]*|*]*|"")
1212           arg="\"$arg\""
1213           ;;
1214         esac
1215         ;;
1216
1217       *.lo | *.$objext)
1218         # A library or standard object.
1219         if test "$prev" = dlfiles; then
1220           # This file was specified with -dlopen.
1221           if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
1222             dlfiles="$dlfiles $arg"
1223             prev=
1224             continue
1225           else
1226             # If libtool objects are unsupported, then we need to preload.
1227             prev=dlprefiles
1228           fi
1229         fi
1230
1231         if test "$prev" = dlprefiles; then
1232           # Preload the old-style object.
1233           dlprefiles="$dlprefiles "`$echo "X$arg" | $Xsed -e "$lo2o"`
1234           prev=
1235         else
1236           case $arg in
1237           *.lo) libobjs="$libobjs $arg" ;;
1238           *) objs="$objs $arg" ;;
1239           esac
1240         fi
1241         ;;
1242
1243       *.$libext)
1244         # An archive.
1245         deplibs="$deplibs $arg"
1246         old_deplibs="$old_deplibs $arg"
1247         continue
1248         ;;
1249
1250       *.la)
1251         # A libtool-controlled library.
1252
1253         if test "$prev" = dlfiles; then
1254           # This library was specified with -dlopen.
1255           dlfiles="$dlfiles $arg"
1256           prev=
1257         elif test "$prev" = dlprefiles; then
1258           # The library was specified with -dlpreopen.
1259           dlprefiles="$dlprefiles $arg"
1260           prev=
1261         else
1262           deplibs="$deplibs $arg"
1263         fi
1264         continue
1265         ;;
1266
1267       # Some other compiler argument.
1268       *)
1269         # Unknown arguments in both finalize_command and compile_command need
1270         # to be aesthetically quoted because they are evaled later.
1271         arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
1272         case $arg in
1273         *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \   ]*|*]*|"")
1274           arg="\"$arg\""
1275           ;;
1276         esac
1277         ;;
1278       esac # arg
1279
1280       # Now actually substitute the argument into the commands.
1281       if test -n "$arg"; then
1282         compile_command="$compile_command $arg"
1283         finalize_command="$finalize_command $arg"
1284       fi
1285     done # argument parsing loop
1286
1287     if test -n "$prev"; then
1288       $echo "$modename: the \`$prevarg' option requires an argument" 1>&2
1289       $echo "$help" 1>&2
1290       exit 1
1291     fi
1292
1293     if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then
1294       eval arg=\"$export_dynamic_flag_spec\"
1295       compile_command="$compile_command $arg"
1296       finalize_command="$finalize_command $arg"
1297     fi
1298
1299     # calculate the name of the file, without its directory
1300     outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'`
1301     libobjs_save="$libobjs"
1302
1303     if test -n "$shlibpath_var"; then
1304       # get the directories listed in $shlibpath_var
1305       eval shlib_search_path=\`\$echo \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\`
1306     else
1307       shlib_search_path=
1308     fi
1309     eval sys_lib_search_path=\"$sys_lib_search_path_spec\"
1310     eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\"
1311
1312     output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'`
1313     if test "X$output_objdir" = "X$output"; then
1314       output_objdir="$objdir"
1315     else
1316       output_objdir="$output_objdir/$objdir"
1317     fi
1318     # Create the object directory.
1319     if test ! -d "$output_objdir"; then
1320       $show "$mkdir $output_objdir"
1321       $run $mkdir $output_objdir
1322       status=$?
1323       if test "$status" -ne 0 && test ! -d "$output_objdir"; then
1324         exit $status
1325       fi
1326     fi
1327
1328     # Determine the type of output
1329     case $output in
1330     "")
1331       $echo "$modename: you must specify an output file" 1>&2
1332       $echo "$help" 1>&2
1333       exit 1
1334       ;;
1335     *.$libext) linkmode=oldlib ;;
1336     *.lo | *.$objext) linkmode=obj ;;
1337     *.la) linkmode=lib ;;
1338     *) linkmode=prog ;; # Anything else should be a program.
1339     esac
1340
1341     specialdeplibs=
1342     libs=
1343     # Find all interdependent deplibs by searching for libraries
1344     # that are linked more than once (e.g. -la -lb -la)
1345     for deplib in $deplibs; do
1346       if test "X$duplicate_deps" = "Xyes" ; then
1347         case "$libs " in
1348         *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
1349         esac
1350       fi
1351       libs="$libs $deplib"
1352     done
1353
1354     if test "$linkmode" = lib; then
1355       libs="$predeps $libs $compiler_lib_search_path $postdeps"
1356
1357       # Compute libraries that are listed more than once in $predeps
1358       # $postdeps and mark them as special (i.e., whose duplicates are
1359       # not to be eliminated).
1360       pre_post_deps=
1361       if test "X$duplicate_deps" = "Xyes" ; then
1362         for pre_post_dep in $predeps $postdeps; do
1363           case "$pre_post_deps " in
1364           *" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;;
1365           esac
1366           pre_post_deps="$pre_post_deps $pre_post_dep"
1367         done
1368       fi
1369       pre_post_deps=
1370     fi
1371
1372     deplibs=
1373     newdependency_libs=
1374     newlib_search_path=
1375     need_relink=no # whether we're linking any uninstalled libtool libraries
1376     notinst_deplibs= # not-installed libtool libraries
1377     notinst_path= # paths that contain not-installed libtool libraries
1378     case $linkmode in
1379     lib)
1380         passes="conv link"
1381         for file in $dlfiles $dlprefiles; do
1382           case $file in
1383           *.la) ;;
1384           *)
1385             $echo "$modename: libraries can \`-dlopen' only libtool libraries: $file" 1>&2
1386             exit 1
1387             ;;
1388           esac
1389         done
1390         ;;
1391     prog)
1392         compile_deplibs=
1393         finalize_deplibs=
1394         alldeplibs=no
1395         newdlfiles=
1396         newdlprefiles=
1397         passes="conv scan dlopen dlpreopen link"
1398         ;;
1399     *)  passes="conv"
1400         ;;
1401     esac
1402     for pass in $passes; do
1403       if test "$linkmode" = prog; then
1404         # Determine which files to process
1405         case $pass in
1406         dlopen)
1407           libs="$dlfiles"
1408           save_deplibs="$deplibs" # Collect dlpreopened libraries
1409           deplibs=
1410           ;;
1411         dlpreopen) libs="$dlprefiles" ;;
1412         link) libs="$deplibs %DEPLIBS% $dependency_libs" ;;
1413         esac
1414       fi
1415       for deplib in $libs; do
1416         lib=
1417         found=no
1418         case $deplib in
1419         -l*)
1420           if test "$linkmode" = oldlib && test "$linkmode" = obj; then
1421             $echo "$modename: warning: \`-l' is ignored for archives/objects: $deplib" 1>&2
1422             continue
1423           fi
1424           if test "$pass" = conv; then
1425             deplibs="$deplib $deplibs"
1426             continue
1427           fi
1428           name=`$echo "X$deplib" | $Xsed -e 's/^-l//'`
1429           for searchdir in $newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path; do
1430             # Search the libtool library
1431             lib="$searchdir/lib${name}.la"
1432             if test -f "$lib"; then
1433               found=yes
1434               break
1435             fi
1436           done
1437           if test "$found" != yes; then
1438             # deplib doesn't seem to be a libtool library
1439             if test "$linkmode,$pass" = "prog,link"; then
1440               compile_deplibs="$deplib $compile_deplibs"
1441               finalize_deplibs="$deplib $finalize_deplibs"
1442             else
1443               deplibs="$deplib $deplibs"
1444               test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
1445             fi
1446             continue
1447           fi
1448           ;; # -l
1449         -L*)
1450           case $linkmode in
1451           lib)
1452             deplibs="$deplib $deplibs"
1453             test "$pass" = conv && continue
1454             newdependency_libs="$deplib $newdependency_libs"
1455             newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
1456             ;;
1457           prog)
1458             if test "$pass" = conv; then
1459               deplibs="$deplib $deplibs"
1460               continue
1461             fi
1462             if test "$pass" = scan; then
1463               deplibs="$deplib $deplibs"
1464               newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
1465             else
1466               compile_deplibs="$deplib $compile_deplibs"
1467               finalize_deplibs="$deplib $finalize_deplibs"
1468             fi
1469             ;;
1470           *)
1471             $echo "$modename: warning: \`-L' is ignored for archives/objects: $deplib" 1>&2
1472             ;;
1473           esac # linkmode
1474           continue
1475           ;; # -L
1476         -R*)
1477           if test "$pass" = link; then
1478             dir=`$echo "X$deplib" | $Xsed -e 's/^-R//'`
1479             # Make sure the xrpath contains only unique directories.
1480             case "$xrpath " in
1481             *" $dir "*) ;;
1482             *) xrpath="$xrpath $dir" ;;
1483             esac
1484           fi
1485           deplibs="$deplib $deplibs"
1486           continue
1487           ;;
1488         *.la) lib="$deplib" ;;
1489         *.$libext)
1490           if test "$pass" = conv; then
1491             deplibs="$deplib $deplibs"
1492             continue
1493           fi
1494           case $linkmode in
1495           lib)
1496             if test "$deplibs_check_method" != pass_all; then
1497               echo
1498               echo "*** Warning: This library needs some functionality provided by $deplib."
1499               echo "*** I have the capability to make that library automatically link in when"
1500               echo "*** you link to this library.  But I can only do this if you have a"
1501               echo "*** shared version of the library, which you do not appear to have."
1502             else
1503               echo
1504               echo "*** Warning: Linking the shared library $output against the"
1505               echo "*** static library $deplib is not portable!"
1506               deplibs="$deplib $deplibs"
1507             fi
1508             continue
1509             ;;
1510           prog)
1511             if test "$pass" != link; then
1512               deplibs="$deplib $deplibs"
1513             else
1514               compile_deplibs="$deplib $compile_deplibs"
1515               finalize_deplibs="$deplib $finalize_deplibs"
1516             fi
1517             continue
1518             ;;
1519           esac # linkmode
1520           ;; # *.$libext
1521         *.lo | *.$objext)
1522           if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
1523             # If there is no dlopen support or we're linking statically,
1524             # we need to preload.
1525             newdlprefiles="$newdlprefiles $deplib"
1526             compile_deplibs="$deplib $compile_deplibs"
1527             finalize_deplibs="$deplib $finalize_deplibs"
1528           else
1529             newdlfiles="$newdlfiles $deplib"
1530           fi
1531           continue
1532           ;;
1533         %DEPLIBS%)
1534           alldeplibs=yes
1535           continue
1536           ;;
1537         esac # case $deplib
1538         if test "$found" = yes || test -f "$lib"; then :
1539         else
1540           $echo "$modename: cannot find the library \`$lib'" 1>&2
1541           exit 1
1542         fi
1543
1544         # Check to see that this really is a libtool archive.
1545         if (sed -e '2q' $lib | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
1546         else
1547           $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
1548           exit 1
1549         fi
1550
1551         ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'`
1552         test "X$ladir" = "X$lib" && ladir="."
1553
1554         dlname=
1555         dlopen=
1556         dlpreopen=
1557         libdir=
1558         library_names=
1559         old_library=
1560         # If the library was installed with an old release of libtool,
1561         # it will not redefine variable installed.
1562         installed=yes
1563
1564         # Read the .la file
1565         case $lib in
1566         */* | *\\*) . $lib ;;
1567         *) . ./$lib ;;
1568         esac
1569
1570         if test "$linkmode,$pass" = "lib,link" ||
1571            test "$linkmode,$pass" = "prog,scan" ||
1572            { test "$linkmode" = oldlib && test "$linkmode" = obj; }; then
1573            # Add dl[pre]opened files of deplib
1574           test -n "$dlopen" && dlfiles="$dlfiles $dlopen"
1575           test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen"
1576         fi
1577
1578         if test "$pass" = conv; then
1579           # Only check for convenience libraries
1580           deplibs="$lib $deplibs"
1581           if test -z "$libdir"; then
1582             if test -z "$old_library"; then
1583               $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
1584               exit 1
1585             fi
1586             # It is a libtool convenience library, so add in its objects.
1587             convenience="$convenience $ladir/$objdir/$old_library"
1588             old_convenience="$old_convenience $ladir/$objdir/$old_library"
1589             tmp_libs=
1590             for deplib in $dependency_libs; do
1591               deplibs="$deplib $deplibs"
1592               if test "X$duplicate_deps" = "Xyes" ; then
1593                 case "$tmp_libs " in
1594                 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
1595                 esac
1596               fi
1597               tmp_libs="$tmp_libs $deplib"
1598             done
1599           elif test "$linkmode" != prog && test "$linkmode" != lib; then
1600             $echo "$modename: \`$lib' is not a convenience library" 1>&2
1601             exit 1
1602           fi
1603           continue
1604         fi # $pass = conv
1605
1606         # Get the name of the library we link against.
1607         linklib=
1608         for l in $old_library $library_names; do
1609           linklib="$l"
1610         done
1611         if test -z "$linklib"; then
1612           $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
1613           exit 1
1614         fi
1615
1616         # This library was specified with -dlopen.
1617         if test "$pass" = dlopen; then
1618           if test -z "$libdir"; then
1619             $echo "$modename: cannot -dlopen a convenience library: \`$lib'" 1>&2
1620             exit 1
1621           fi
1622           if test -z "$dlname" || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
1623             # If there is no dlname, no dlopen support or we're linking
1624             # statically, we need to preload.
1625             dlprefiles="$dlprefiles $lib"
1626           else
1627             newdlfiles="$newdlfiles $lib"
1628           fi
1629           continue
1630         fi # $pass = dlopen
1631
1632         # We need an absolute path.
1633         case $ladir in
1634         [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;;
1635         *)
1636           abs_ladir=`cd "$ladir" && pwd`
1637           if test -z "$abs_ladir"; then
1638             $echo "$modename: warning: cannot determine absolute directory name of \`$ladir'" 1>&2
1639             $echo "$modename: passing it literally to the linker, although it might fail" 1>&2
1640             abs_ladir="$ladir"
1641           fi
1642           ;;
1643         esac
1644         laname=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
1645
1646         # Find the relevant object directory and library name.
1647         if test "X$installed" = Xyes; then
1648           if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then
1649             $echo "$modename: warning: library \`$lib' was moved." 1>&2
1650             dir="$ladir"
1651             absdir="$abs_ladir"
1652             libdir="$abs_ladir"
1653           else
1654             dir="$libdir"
1655             absdir="$libdir"
1656           fi
1657         else
1658           dir="$ladir/$objdir"
1659           absdir="$abs_ladir/$objdir"
1660           # Remove this search path later
1661           notinst_path="$notinst_path $abs_ladir"
1662         fi # $installed = yes
1663         name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
1664
1665         # This library was specified with -dlpreopen.
1666         if test "$pass" = dlpreopen; then
1667           if test -z "$libdir"; then
1668             $echo "$modename: cannot -dlpreopen a convenience library: \`$lib'" 1>&2
1669             exit 1
1670           fi
1671           # Prefer using a static library (so that no silly _DYNAMIC symbols
1672           # are required to link).
1673           if test -n "$old_library"; then
1674             newdlprefiles="$newdlprefiles $dir/$old_library"
1675           # Otherwise, use the dlname, so that lt_dlopen finds it.
1676           elif test -n "$dlname"; then
1677             newdlprefiles="$newdlprefiles $dir/$dlname"
1678           else
1679             newdlprefiles="$newdlprefiles $dir/$linklib"
1680           fi
1681         fi # $pass = dlpreopen
1682
1683         if test -z "$libdir"; then
1684           # Link the convenience library
1685           if test "$linkmode" = lib; then
1686             deplibs="$dir/$old_library $deplibs"
1687           elif test "$linkmode,$pass" = "prog,link"; then
1688             compile_deplibs="$dir/$old_library $compile_deplibs"
1689             finalize_deplibs="$dir/$old_library $finalize_deplibs"
1690           else
1691             deplibs="$lib $deplibs"
1692           fi
1693           continue
1694         fi
1695
1696         if test "$linkmode" = prog && test "$pass" != link; then
1697           newlib_search_path="$newlib_search_path $ladir"
1698           deplibs="$lib $deplibs"
1699
1700           linkalldeplibs=no
1701           if test "$link_all_deplibs" != no || test -z "$library_names" ||
1702              test "$build_libtool_libs" = no; then
1703             linkalldeplibs=yes
1704           fi
1705
1706           tmp_libs=
1707           for deplib in $dependency_libs; do
1708             case $deplib in
1709             -L*) newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`;; ### testsuite: skip nested quoting test
1710             esac
1711             # Need to link against all dependency_libs?
1712             if test "$linkalldeplibs" = yes; then
1713               deplibs="$deplib $deplibs"
1714             else
1715               # Need to hardcode shared library paths
1716               # or/and link against static libraries
1717               newdependency_libs="$deplib $newdependency_libs"
1718             fi
1719             if test "X$duplicate_deps" = "Xyes" ; then
1720               case "$tmp_libs " in
1721               *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
1722               esac
1723             fi
1724             tmp_libs="$tmp_libs $deplib"
1725           done # for deplib
1726           continue
1727         fi # $linkmode = prog...
1728
1729         link_static=no # Whether the deplib will be linked statically
1730         if test -n "$library_names" &&
1731            { test "$prefer_static_libs" = no || test -z "$old_library"; }; then
1732           # Link against this shared library
1733
1734           if test "$linkmode,$pass" = "prog,link" ||
1735            { test "$linkmode" = lib && test "$hardcode_into_libs" = yes; }; then
1736             # Hardcode the library path.
1737             # Skip directories that are in the system default run-time
1738             # search path.
1739             case " $sys_lib_dlsearch_path " in
1740             *" $absdir "*) ;;
1741             *)
1742               case "$compile_rpath " in
1743               *" $absdir "*) ;;
1744               *) compile_rpath="$compile_rpath $absdir"
1745               esac
1746               ;;
1747             esac
1748             case " $sys_lib_dlsearch_path " in
1749             *" $libdir "*) ;;
1750             *)
1751               case "$finalize_rpath " in
1752               *" $libdir "*) ;;
1753               *) finalize_rpath="$finalize_rpath $libdir"
1754               esac
1755               ;;
1756             esac
1757             if test "$linkmode" = prog; then
1758               # We need to hardcode the library path
1759               if test -n "$shlibpath_var"; then
1760                 # Make sure the rpath contains only unique directories.
1761                 case "$temp_rpath " in
1762                 *" $dir "*) ;;
1763                 *" $absdir "*) ;;
1764                 *) temp_rpath="$temp_rpath $dir" ;;
1765                 esac
1766               fi
1767             fi
1768           fi # $linkmode,$pass = prog,link...
1769
1770           if test "$alldeplibs" = yes &&
1771              { test "$deplibs_check_method" = pass_all ||
1772                { test "$build_libtool_libs" = yes &&
1773                  test -n "$library_names"; }; }; then
1774             # We only need to search for static libraries
1775             continue
1776           fi
1777
1778           if test "$installed" = no; then
1779             notinst_deplibs="$notinst_deplibs $lib"
1780             need_relink=yes
1781           fi
1782
1783           if test -n "$old_archive_from_expsyms_cmds"; then
1784             # figure out the soname
1785             set dummy $library_names
1786             realname="$2"
1787             shift; shift
1788             libname=`eval \\$echo \"$libname_spec\"`
1789             # use dlname if we got it. it's perfectly good, no?
1790             if test -n "$dlname"; then
1791               soname="$dlname"
1792             elif test -n "$soname_spec"; then
1793               # bleh windows
1794               case $host in
1795               *cygwin*)
1796                 major=`expr $current - $age`
1797                 versuffix="-$major"
1798                 ;;
1799               esac
1800               eval soname=\"$soname_spec\"
1801             else
1802               soname="$realname"
1803             fi
1804
1805             # Make a new name for the extract_expsyms_cmds to use
1806             soroot="$soname"
1807             soname=`echo $soroot | sed -e 's/^.*\///'`
1808             newlib="libimp-`echo $soname | sed 's/^lib//;s/\.dll$//'`.a"
1809
1810             # If the library has no export list, then create one now
1811             if test -f "$output_objdir/$soname-def"; then :
1812             else
1813               $show "extracting exported symbol list from \`$soname'"
1814               save_ifs="$IFS"; IFS='~'
1815               eval cmds=\"$extract_expsyms_cmds\"
1816               for cmd in $cmds; do
1817                 IFS="$save_ifs"
1818                 $show "$cmd"
1819                 $run eval "$cmd" || exit $?
1820               done
1821               IFS="$save_ifs"
1822             fi
1823
1824             # Create $newlib
1825             if test -f "$output_objdir/$newlib"; then :; else
1826               $show "generating import library for \`$soname'"
1827               save_ifs="$IFS"; IFS='~'
1828               eval cmds=\"$old_archive_from_expsyms_cmds\"
1829               for cmd in $cmds; do
1830                 IFS="$save_ifs"
1831                 $show "$cmd"
1832                 $run eval "$cmd" || exit $?
1833               done
1834               IFS="$save_ifs"
1835             fi
1836             # make sure the library variables are pointing to the new library
1837             dir=$output_objdir
1838             linklib=$newlib
1839           fi # test -n "$old_archive_from_expsyms_cmds"
1840
1841           if test "$linkmode" = prog || test "$mode" != relink; then
1842             add_shlibpath=
1843             add_dir=
1844             add=
1845             lib_linked=yes
1846             case $hardcode_action in
1847             immediate | unsupported)
1848               if test "$hardcode_direct" = no; then
1849                 add="$dir/$linklib"
1850               elif test "$hardcode_minus_L" = no; then
1851                 case $host in
1852                 *-*-sunos*) add_shlibpath="$dir" ;;
1853                 esac
1854                 add_dir="-L$dir"
1855                 add="-l$name"
1856               elif test "$hardcode_shlibpath_var" = no; then
1857                 add_shlibpath="$dir"
1858                 add="-l$name"
1859               else
1860                 lib_linked=no
1861               fi
1862               ;;
1863             relink)
1864               if test "$hardcode_direct" = yes; then
1865                 add="$dir/$linklib"
1866               elif test "$hardcode_minus_L" = yes; then
1867                 add_dir="-L$dir"
1868                 add="-l$name"
1869               elif test "$hardcode_shlibpath_var" = yes; then
1870                 add_shlibpath="$dir"
1871                 add="-l$name"
1872               else
1873                 lib_linked=no
1874               fi
1875               ;;
1876             *) lib_linked=no ;;
1877             esac
1878
1879             if test "$lib_linked" != yes; then
1880               $echo "$modename: configuration error: unsupported hardcode properties"
1881               exit 1
1882             fi
1883
1884             if test -n "$add_shlibpath"; then
1885               case :$compile_shlibpath: in
1886               *":$add_shlibpath:"*) ;;
1887               *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;;
1888               esac
1889             fi
1890             if test "$linkmode" = prog; then
1891               test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs"
1892               test -n "$add" && compile_deplibs="$add $compile_deplibs"
1893             else
1894               test -n "$add_dir" && deplibs="$add_dir $deplibs"
1895               test -n "$add" && deplibs="$add $deplibs"
1896               if test "$hardcode_direct" != yes && \
1897                  test "$hardcode_minus_L" != yes && \
1898                  test "$hardcode_shlibpath_var" = yes; then
1899                 case :$finalize_shlibpath: in
1900                 *":$libdir:"*) ;;
1901                 *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
1902                 esac
1903               fi
1904             fi
1905           fi
1906
1907           if test "$linkmode" = prog || test "$mode" = relink; then
1908             add_shlibpath=
1909             add_dir=
1910             add=
1911             # Finalize command for both is simple: just hardcode it.
1912             if test "$hardcode_direct" = yes; then
1913               add="$libdir/$linklib"
1914             elif test "$hardcode_minus_L" = yes; then
1915               # Try looking first in the location we're being installed to.
1916               add_dir=
1917               if test -n "$inst_prefix_dir"; then
1918                 case "$libdir" in
1919                 [\\/]*)
1920                   add_dir="-L$inst_prefix_dir$libdir"
1921                   ;;
1922                 esac
1923               fi
1924               add_dir="$add_dir -L$libdir"
1925               add="-l$name"
1926             elif test "$hardcode_shlibpath_var" = yes; then
1927               case :$finalize_shlibpath: in
1928               *":$libdir:"*) ;;
1929               *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
1930               esac
1931               add="-l$name"
1932             else
1933               # We cannot seem to hardcode it, guess we'll fake it.
1934               # Try looking first in the location we're being installed to.
1935               add_dir=
1936               if test -n "$inst_prefix_dir"; then
1937                 case "$libdir" in
1938                 [\\/]*)
1939                   add_dir="-L$inst_prefix_dir$libdir"
1940                   ;;
1941                 esac
1942               fi
1943               add_dir="$add_dir -L$libdir"
1944               add="-l$name"
1945             fi
1946
1947             if test "$linkmode" = prog; then
1948               test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs"
1949               test -n "$add" && finalize_deplibs="$add $finalize_deplibs"
1950             else
1951               test -n "$add_dir" && deplibs="$add_dir $deplibs"
1952               test -n "$add" && deplibs="$add $deplibs"
1953             fi
1954           fi
1955         elif test "$linkmode" = prog; then
1956           if test "$alldeplibs" = yes &&
1957              { test "$deplibs_check_method" = pass_all ||
1958                { test "$build_libtool_libs" = yes &&
1959                  test -n "$library_names"; }; }; then
1960             # We only need to search for static libraries
1961             continue
1962           fi
1963
1964           # Try to link the static library
1965           # Here we assume that one of hardcode_direct or hardcode_minus_L
1966           # is not unsupported.  This is valid on all known static and
1967           # shared platforms.
1968           if test "$hardcode_direct" != unsupported; then
1969             test -n "$old_library" && linklib="$old_library"
1970             compile_deplibs="$dir/$linklib $compile_deplibs"
1971             finalize_deplibs="$dir/$linklib $finalize_deplibs"
1972           else
1973             compile_deplibs="-l$name -L$dir $compile_deplibs"
1974             finalize_deplibs="-l$name -L$dir $finalize_deplibs"
1975           fi
1976         elif test "$build_libtool_libs" = yes; then
1977           # Not a shared library
1978           if test "$deplibs_check_method" != pass_all; then
1979             # We're trying link a shared library against a static one
1980             # but the system doesn't support it.
1981
1982             # Just print a warning and add the library to dependency_libs so
1983             # that the program can be linked against the static library.
1984             echo
1985             echo "*** Warning: This library needs some functionality provided by $lib."
1986             echo "*** I have the capability to make that library automatically link in when"
1987             echo "*** you link to this library.  But I can only do this if you have a"
1988             echo "*** shared version of the library, which you do not appear to have."
1989             if test "$module" = yes; then
1990               echo "*** Therefore, libtool will create a static module, that should work "
1991               echo "*** as long as the dlopening application is linked with the -dlopen flag."
1992               if test -z "$global_symbol_pipe"; then
1993                 echo
1994                 echo "*** However, this would only work if libtool was able to extract symbol"
1995                 echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
1996                 echo "*** not find such a program.  So, this module is probably useless."
1997                 echo "*** \`nm' from GNU binutils and a full rebuild may help."
1998               fi
1999               if test "$build_old_libs" = no; then
2000                 build_libtool_libs=module
2001                 build_old_libs=yes
2002               else
2003                 build_libtool_libs=no
2004               fi
2005             fi
2006           else
2007             convenience="$convenience $dir/$old_library"
2008             old_convenience="$old_convenience $dir/$old_library"
2009             deplibs="$dir/$old_library $deplibs"
2010             link_static=yes
2011           fi
2012         fi # link shared/static library?
2013
2014         if test "$linkmode" = lib; then
2015           if test -n "$dependency_libs" &&
2016              { test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes ||
2017                test "$link_static" = yes; }; then
2018             # Extract -R from dependency_libs
2019             temp_deplibs=
2020             for libdir in $dependency_libs; do
2021               case $libdir in
2022               -R*) temp_xrpath=`$echo "X$libdir" | $Xsed -e 's/^-R//'`
2023                    case " $xrpath " in
2024                    *" $temp_xrpath "*) ;;
2025                    *) xrpath="$xrpath $temp_xrpath";;
2026                    esac;;
2027               *) temp_deplibs="$temp_deplibs $libdir";;
2028               esac
2029             done
2030             dependency_libs="$temp_deplibs"
2031           fi
2032
2033           newlib_search_path="$newlib_search_path $absdir"
2034           # Link against this library
2035           test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs"
2036           # ... and its dependency_libs
2037           tmp_libs=
2038           for deplib in $dependency_libs; do
2039             newdependency_libs="$deplib $newdependency_libs"
2040             if test "X$duplicate_deps" = "Xyes" ; then
2041               case "$tmp_libs " in
2042               *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
2043               esac
2044             fi
2045             tmp_libs="$tmp_libs $deplib"
2046           done
2047
2048           if test "$link_all_deplibs" != no; then
2049             # Add the search paths of all dependency libraries
2050             for deplib in $dependency_libs; do
2051               case $deplib in
2052               -L*) path="$deplib" ;;
2053               *.la)
2054                 dir=`$echo "X$deplib" | $Xsed -e 's%/[^/]*$%%'`
2055                 test "X$dir" = "X$deplib" && dir="."
2056                 # We need an absolute path.
2057                 case $dir in
2058                 [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;;
2059                 *)
2060                   absdir=`cd "$dir" && pwd`
2061                   if test -z "$absdir"; then
2062                     $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2
2063                     absdir="$dir"
2064                   fi
2065                   ;;
2066                 esac
2067                 if grep "^installed=no" $deplib > /dev/null; then
2068                   path="-L$absdir/$objdir"
2069                 else
2070                   eval libdir=`sed -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
2071                   if test -z "$libdir"; then
2072                     $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
2073                     exit 1
2074                   fi
2075                   if test "$absdir" != "$libdir"; then
2076                     $echo "$modename: warning: \`$deplib' seems to be moved" 1>&2
2077                   fi
2078                   path="-L$absdir"
2079                 fi
2080                 ;;
2081               *) continue ;;
2082               esac
2083               case " $deplibs " in
2084               *" $path "*) ;;
2085               *) deplibs="$deplibs $path" ;;
2086               esac
2087             done
2088           fi # link_all_deplibs != no
2089         fi # linkmode = lib
2090       done # for deplib in $libs
2091       if test "$pass" = dlpreopen; then
2092         # Link the dlpreopened libraries before other libraries
2093         for deplib in $save_deplibs; do
2094           deplibs="$deplib $deplibs"
2095         done
2096       fi
2097       if test "$pass" != dlopen; then
2098         test "$pass" != scan && dependency_libs="$newdependency_libs"
2099         if test "$pass" != conv; then
2100           # Make sure lib_search_path contains only unique directories.
2101           lib_search_path=
2102           for dir in $newlib_search_path; do
2103             case "$lib_search_path " in
2104             *" $dir "*) ;;
2105             *) lib_search_path="$lib_search_path $dir" ;;
2106             esac
2107           done
2108           newlib_search_path=
2109         fi
2110
2111         if test "$linkmode,$pass" != "prog,link"; then
2112           vars="deplibs"
2113         else
2114           vars="compile_deplibs finalize_deplibs"
2115         fi
2116         for var in $vars dependency_libs; do
2117           # Add libraries to $var in reverse order
2118           eval tmp_libs=\"\$$var\"
2119           new_libs=
2120           for deplib in $tmp_libs; do
2121             case $deplib in
2122             -L*) new_libs="$deplib $new_libs" ;;
2123             *)
2124               case " $specialdeplibs " in
2125               *" $deplib "*) new_libs="$deplib $new_libs" ;;
2126               *)
2127                 case " $new_libs " in
2128                 *" $deplib "*) ;;
2129                 *) new_libs="$deplib $new_libs" ;;
2130                 esac
2131                 ;;
2132               esac
2133               ;;
2134             esac
2135           done
2136           tmp_libs=
2137           for deplib in $new_libs; do
2138             case $deplib in
2139             -L*)
2140               case " $tmp_libs " in
2141               *" $deplib "*) ;;
2142               *) tmp_libs="$tmp_libs $deplib" ;;
2143               esac
2144               ;;
2145             *) tmp_libs="$tmp_libs $deplib" ;;
2146             esac
2147           done
2148           eval $var=\"$tmp_libs\"
2149         done # for var
2150       fi
2151       if test "$pass" = "conv" &&
2152        { test "$linkmode" = "lib" || test "$linkmode" = "prog"; }; then
2153         libs="$deplibs" # reset libs
2154         deplibs=
2155       fi
2156     done # for pass
2157     if test "$linkmode" = prog; then
2158       dlfiles="$newdlfiles"
2159       dlprefiles="$newdlprefiles"
2160     fi
2161
2162     case $linkmode in
2163     oldlib)
2164       if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
2165         $echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2
2166       fi
2167
2168       if test -n "$rpath"; then
2169         $echo "$modename: warning: \`-rpath' is ignored for archives" 1>&2
2170       fi
2171
2172       if test -n "$xrpath"; then
2173         $echo "$modename: warning: \`-R' is ignored for archives" 1>&2
2174       fi
2175
2176       if test -n "$vinfo"; then
2177         $echo "$modename: warning: \`-version-info' is ignored for archives" 1>&2
2178       fi
2179
2180       if test -n "$release"; then
2181         $echo "$modename: warning: \`-release' is ignored for archives" 1>&2
2182       fi
2183
2184       if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
2185         $echo "$modename: warning: \`-export-symbols' is ignored for archives" 1>&2
2186       fi
2187
2188       # Now set the variables for building old libraries.
2189       build_libtool_libs=no
2190       oldlibs="$output"
2191       objs="$objs$old_deplibs"
2192       ;;
2193
2194     lib)
2195       # Make sure we only generate libraries of the form `libNAME.la'.
2196       case $outputname in
2197       lib*)
2198         name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
2199         eval libname=\"$libname_spec\"
2200         ;;
2201       *)
2202         if test "$module" = no; then
2203           $echo "$modename: libtool library \`$output' must begin with \`lib'" 1>&2
2204           $echo "$help" 1>&2
2205           exit 1
2206         fi
2207         if test "$need_lib_prefix" != no; then
2208           # Add the "lib" prefix for modules if required
2209           name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
2210           eval libname=\"$libname_spec\"
2211         else
2212           libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
2213         fi
2214         ;;
2215       esac
2216
2217       if test -n "$objs"; then
2218         if test "$deplibs_check_method" != pass_all; then
2219           $echo "$modename: cannot build libtool library \`$output' from non-libtool objects on this host:$objs" 2>&1
2220           exit 1
2221         else
2222           echo
2223           echo "*** Warning: Linking the shared library $output against the non-libtool"
2224           echo "*** objects $objs is not portable!"
2225           libobjs="$libobjs $objs"
2226         fi
2227       fi
2228
2229       if test "$dlself" != no; then
2230         $echo "$modename: warning: \`-dlopen self' is ignored for libtool libraries" 1>&2
2231       fi
2232
2233       set dummy $rpath
2234       if test "$#" -gt 2; then
2235         $echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2
2236       fi
2237       install_libdir="$2"
2238
2239       oldlibs=
2240       if test -z "$rpath"; then
2241         if test "$build_libtool_libs" = yes; then
2242           # Building a libtool convenience library.
2243           libext=al
2244           oldlibs="$output_objdir/$libname.$libext $oldlibs"
2245           build_libtool_libs=convenience
2246           build_old_libs=yes
2247         fi
2248
2249         if test -n "$vinfo"; then
2250           $echo "$modename: warning: \`-version-info' is ignored for convenience libraries" 1>&2
2251         fi
2252
2253         if test -n "$release"; then
2254           $echo "$modename: warning: \`-release' is ignored for convenience libraries" 1>&2
2255         fi
2256       else
2257
2258         # Parse the version information argument.
2259         save_ifs="$IFS"; IFS=':'
2260         set dummy $vinfo 0 0 0
2261         IFS="$save_ifs"
2262
2263         if test -n "$8"; then
2264           $echo "$modename: too many parameters to \`-version-info'" 1>&2
2265           $echo "$help" 1>&2
2266           exit 1
2267         fi
2268
2269         current="$2"
2270         revision="$3"
2271         age="$4"
2272
2273         # Check that each of the things are valid numbers.
2274         case $current in
2275         [0-9]*) ;;
2276         *)
2277           $echo "$modename: CURRENT \`$current' is not a nonnegative integer" 1>&2
2278           $echo "$modename: \`$vinfo' is not valid version information" 1>&2
2279           exit 1
2280           ;;
2281         esac
2282
2283         case $revision in
2284         [0-9]*) ;;
2285         *)
2286           $echo "$modename: REVISION \`$revision' is not a nonnegative integer" 1>&2
2287           $echo "$modename: \`$vinfo' is not valid version information" 1>&2
2288           exit 1
2289           ;;
2290         esac
2291
2292         case $age in
2293         [0-9]*) ;;
2294         *)
2295           $echo "$modename: AGE \`$age' is not a nonnegative integer" 1>&2
2296           $echo "$modename: \`$vinfo' is not valid version information" 1>&2
2297           exit 1
2298           ;;
2299         esac
2300
2301         if test "$age" -gt "$current"; then
2302           $echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2
2303           $echo "$modename: \`$vinfo' is not valid version information" 1>&2
2304           exit 1
2305         fi
2306
2307         # Calculate the version variables.
2308         major=
2309         versuffix=
2310         verstring=
2311         case $version_type in
2312         none) ;;
2313
2314         darwin)
2315           # Like Linux, but with the current version available in
2316           # verstring for coding it into the library header
2317           major=.`expr $current - $age`
2318           versuffix="$major.$age.$revision"
2319           # Darwin ld doesn't like 0 for these options...
2320           minor_current=`expr $current + 1`
2321           verstring="-compatibility_version $minor_current -current_version $minor_current.$revision"
2322           ;;
2323
2324         freebsd-aout)
2325           major=".$current"
2326           versuffix=".$current.$revision";
2327           ;;
2328
2329         freebsd-elf)
2330           major=".$current"
2331           versuffix=".$current";
2332           ;;
2333
2334         irix)
2335           major=`expr $current - $age + 1`
2336           verstring="sgi$major.$revision"
2337
2338           # Add in all the interfaces that we are compatible with.
2339           loop=$revision
2340           while test "$loop" -ne 0; do
2341             iface=`expr $revision - $loop`
2342             loop=`expr $loop - 1`
2343             verstring="sgi$major.$iface:$verstring"
2344           done
2345
2346           # Before this point, $major must not contain `.'.
2347           major=.$major
2348           versuffix="$major.$revision"
2349           ;;
2350
2351         linux)
2352           major=.`expr $current - $age`
2353           versuffix="$major.$age.$revision"
2354           ;;
2355
2356         osf)
2357           major=`expr $current - $age`
2358           versuffix=".$current.$age.$revision"
2359           verstring="$current.$age.$revision"
2360
2361           # Add in all the interfaces that we are compatible with.
2362           loop=$age
2363           while test "$loop" -ne 0; do
2364             iface=`expr $current - $loop`
2365             loop=`expr $loop - 1`
2366             verstring="$verstring:${iface}.0"
2367           done
2368
2369           # Make executables depend on our current version.
2370           verstring="$verstring:${current}.0"
2371           ;;
2372
2373         sunos)
2374           major=".$current"
2375           versuffix=".$current.$revision"
2376           ;;
2377
2378         windows)
2379           # Use '-' rather than '.', since we only want one
2380           # extension on DOS 8.3 filesystems.
2381           major=`expr $current - $age`
2382           versuffix="-$major"
2383           ;;
2384
2385         *)
2386           $echo "$modename: unknown library version type \`$version_type'" 1>&2
2387           echo "Fatal configuration error.  See the $PACKAGE docs for more information." 1>&2
2388           exit 1
2389           ;;
2390         esac
2391
2392         # Clear the version info if we defaulted, and they specified a release.
2393         if test -z "$vinfo" && test -n "$release"; then
2394           major=
2395           verstring="0.0"
2396           case $version_type in
2397           darwin)
2398             # we can't check for "0.0" in archive_cmds due to quoting
2399             # problems, so we reset it completely
2400             verstring=""
2401             ;;
2402           *)
2403             verstring="0.0"
2404             ;;
2405           esac
2406           if test "$need_version" = no; then
2407             versuffix=
2408           else
2409             versuffix=".0.0"
2410           fi
2411         fi
2412
2413         # Remove version info from name if versioning should be avoided
2414         if test "$avoid_version" = yes && test "$need_version" = no; then
2415           major=
2416           versuffix=
2417           verstring=""
2418         fi
2419
2420         # Check to see if the archive will have undefined symbols.
2421         if test "$allow_undefined" = yes; then
2422           if test "$allow_undefined_flag" = unsupported; then
2423             $echo "$modename: warning: undefined symbols not allowed in $host shared libraries" 1>&2
2424             build_libtool_libs=no
2425             build_old_libs=yes
2426           fi
2427         else
2428           # Don't allow undefined symbols.
2429           allow_undefined_flag="$no_undefined_flag"
2430         fi
2431       fi
2432
2433       if test "$mode" != relink; then
2434         # Remove our outputs.
2435         $show "${rm}r $output_objdir/$outputname $output_objdir/$libname.* $output_objdir/${libname}${release}.*"
2436         $run ${rm}r $output_objdir/$outputname $output_objdir/$libname.* $output_objdir/${libname}${release}.*
2437       fi
2438
2439       # Now set the variables for building old libraries.
2440       if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then
2441         oldlibs="$oldlibs $output_objdir/$libname.$libext"
2442
2443         # Transform .lo files to .o files.
2444         oldobjs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP`
2445       fi
2446
2447       # Eliminate all temporary directories.
2448       for path in $notinst_path; do
2449         lib_search_path=`echo "$lib_search_path " | sed -e 's% $path % %g'`
2450         deplibs=`echo "$deplibs " | sed -e 's% -L$path % %g'`
2451         dependency_libs=`echo "$dependency_libs " | sed -e 's% -L$path % %g'`
2452       done
2453
2454       if test -n "$xrpath"; then
2455         # If the user specified any rpath flags, then add them.
2456         temp_xrpath=
2457         for libdir in $xrpath; do
2458           temp_xrpath="$temp_xrpath -R$libdir"
2459           case "$finalize_rpath " in
2460           *" $libdir "*) ;;
2461           *) finalize_rpath="$finalize_rpath $libdir" ;;
2462           esac
2463         done
2464         if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then
2465           dependency_libs="$temp_xrpath $dependency_libs"
2466         fi
2467       fi
2468
2469       # Make sure dlfiles contains only unique files that won't be dlpreopened
2470       old_dlfiles="$dlfiles"
2471       dlfiles=
2472       for lib in $old_dlfiles; do
2473         case " $dlprefiles $dlfiles " in
2474         *" $lib "*) ;;
2475         *) dlfiles="$dlfiles $lib" ;;
2476         esac
2477       done
2478
2479       # Make sure dlprefiles contains only unique files
2480       old_dlprefiles="$dlprefiles"
2481       dlprefiles=
2482       for lib in $old_dlprefiles; do
2483         case "$dlprefiles " in
2484         *" $lib "*) ;;
2485         *) dlprefiles="$dlprefiles $lib" ;;
2486         esac
2487       done
2488
2489       if test "$build_libtool_libs" = yes; then
2490         if test -n "$rpath"; then
2491           case $host in
2492           *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos*)
2493             # these systems don't actually have a c library (as such)!
2494             ;;
2495           *-*-rhapsody* | *-*-darwin1.[012])
2496             # Rhapsody C library is in the System framework
2497             deplibs="$deplibs -framework System"
2498             ;;
2499           *-*-netbsd*)
2500             # Don't link with libc until the a.out ld.so is fixed.
2501             ;;
2502           *-*-openbsd*)
2503             # Do not include libc due to us having libc/libc_r.
2504             ;;
2505           *)
2506             # Add libc to deplibs on all other systems if necessary.
2507             if test "$build_libtool_need_lc" = "yes"; then
2508               deplibs="$deplibs -lc"
2509             fi
2510             ;;
2511           esac
2512         fi
2513
2514         # Transform deplibs into only deplibs that can be linked in shared.
2515         name_save=$name
2516         libname_save=$libname
2517         release_save=$release
2518         versuffix_save=$versuffix
2519         major_save=$major
2520         # I'm not sure if I'm treating the release correctly.  I think
2521         # release should show up in the -l (ie -lgmp5) so we don't want to
2522         # add it in twice.  Is that correct?
2523         release=""
2524         versuffix=""
2525         major=""
2526         newdeplibs=
2527         droppeddeps=no
2528         case $deplibs_check_method in
2529         pass_all)
2530           # Don't check for shared/static.  Everything works.
2531           # This might be a little naive.  We might want to check
2532           # whether the library exists or not.  But this is on
2533           # osf3 & osf4 and I'm not really sure... Just
2534           # implementing what was already the behaviour.
2535           newdeplibs=$deplibs
2536           ;;
2537         test_compile)
2538           # This code stresses the "libraries are programs" paradigm to its
2539           # limits. Maybe even breaks it.  We compile a program, linking it
2540           # against the deplibs as a proxy for the library.  Then we can check
2541           # whether they linked in statically or dynamically with ldd.
2542           $rm conftest.c
2543           cat > conftest.c <<EOF
2544           int main() { return 0; }
2545 EOF
2546           $rm conftest
2547           $CC -o conftest conftest.c $deplibs
2548           if test "$?" -eq 0 ; then
2549             ldd_output=`ldd conftest`
2550             for i in $deplibs; do
2551               name="`expr $i : '-l\(.*\)'`"
2552               # If $name is empty we are operating on a -L argument.
2553               if test -n "$name" && test "$name" != "0"; then
2554                 libname=`eval \\$echo \"$libname_spec\"`
2555                 deplib_matches=`eval \\$echo \"$library_names_spec\"`
2556                 set dummy $deplib_matches
2557                 deplib_match=$2
2558                 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
2559                   newdeplibs="$newdeplibs $i"
2560                 else
2561                   droppeddeps=yes
2562                   echo
2563                   echo "*** Warning: This library needs some functionality provided by $i."
2564                   echo "*** I have the capability to make that library automatically link in when"
2565                   echo "*** you link to this library.  But I can only do this if you have a"
2566                   echo "*** shared version of the library, which you do not appear to have."
2567                 fi
2568               else
2569                 newdeplibs="$newdeplibs $i"
2570               fi
2571             done
2572           else
2573             # Error occured in the first compile.  Let's try to salvage the situation:
2574             # Compile a seperate program for each library.
2575             for i in $deplibs; do
2576               name="`expr $i : '-l\(.*\)'`"
2577              # If $name is empty we are operating on a -L argument.
2578               if test -n "$name" && test "$name" != "0"; then
2579                 $rm conftest
2580                 $CC -o conftest conftest.c $i
2581                 # Did it work?
2582                 if test "$?" -eq 0 ; then
2583                   ldd_output=`ldd conftest`
2584                   libname=`eval \\$echo \"$libname_spec\"`
2585                   deplib_matches=`eval \\$echo \"$library_names_spec\"`
2586                   set dummy $deplib_matches
2587                   deplib_match=$2
2588                   if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
2589                     newdeplibs="$newdeplibs $i"
2590                   else
2591                     droppeddeps=yes
2592                     echo
2593                     echo "*** Warning: This library needs some functionality provided by $i."
2594                     echo "*** I have the capability to make that library automatically link in when"
2595                     echo "*** you link to this library.  But I can only do this if you have a"
2596                     echo "*** shared version of the library, which you do not appear to have."
2597                   fi
2598                 else
2599                   droppeddeps=yes
2600                   echo
2601                   echo "*** Warning!  Library $i is needed by this library but I was not able to"
2602                   echo "***  make it link in!  You will probably need to install it or some"
2603                   echo "*** library that it depends on before this library will be fully"
2604                   echo "*** functional.  Installing it before continuing would be even better."
2605                 fi
2606               else
2607                 newdeplibs="$newdeplibs $i"
2608               fi
2609             done
2610           fi
2611           ;;
2612         file_magic*)
2613           set dummy $deplibs_check_method
2614           file_magic_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
2615           for a_deplib in $deplibs; do
2616             name="`expr $a_deplib : '-l\(.*\)'`"
2617             # If $name is empty we are operating on a -L argument.
2618             if test -n "$name" && test "$name" != "0"; then
2619               libname=`eval \\$echo \"$libname_spec\"`
2620               for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
2621                     potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
2622                     for potent_lib in $potential_libs; do
2623                       # Follow soft links.
2624                       if ls -lLd "$potent_lib" 2>/dev/null \
2625                          | grep " -> " >/dev/null; then
2626                         continue
2627                       fi
2628                       # The statement above tries to avoid entering an
2629                       # endless loop below, in case of cyclic links.
2630                       # We might still enter an endless loop, since a link
2631                       # loop can be closed while we follow links,
2632                       # but so what?
2633                       potlib="$potent_lib"
2634                       while test -h "$potlib" 2>/dev/null; do
2635                         potliblink=`ls -ld $potlib | sed 's/.* -> //'`
2636                         case $potliblink in
2637                         [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";;
2638                         *) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";;
2639                         esac
2640                       done
2641                       if eval $file_magic_cmd \"\$potlib\" 2>/dev/null \
2642                          | sed 10q \
2643                          | egrep "$file_magic_regex" > /dev/null; then
2644                         newdeplibs="$newdeplibs $a_deplib"
2645                         a_deplib=""
2646                         break 2
2647                       fi
2648                     done
2649               done
2650               if test -n "$a_deplib" ; then
2651                 droppeddeps=yes
2652                 echo
2653                 echo "*** Warning: This library needs some functionality provided by $a_deplib."
2654                 echo "*** I have the capability to make that library automatically link in when"
2655                 echo "*** you link to this library.  But I can only do this if you have a"
2656                 echo "*** shared version of the library, which you do not appear to have."
2657               fi
2658             else
2659               # Add a -L argument.
2660               newdeplibs="$newdeplibs $a_deplib"
2661             fi
2662           done # Gone through all deplibs.
2663           ;;
2664         match_pattern*)
2665           set dummy $deplibs_check_method
2666           match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
2667           for a_deplib in $deplibs; do
2668             name="`expr $a_deplib : '-l\(.*\)'`"
2669             # If $name is empty we are operating on a -L argument.
2670             if test -n "$name" && test "$name" != "0"; then
2671               libname=`eval \\$echo \"$libname_spec\"`
2672               for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
2673                 potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
2674                 for potent_lib in $potential_libs; do
2675                   if eval echo \"$potent_lib\" 2>/dev/null \
2676                       | sed 10q \
2677                       | egrep "$match_pattern_regex" > /dev/null; then
2678                     newdeplibs="$newdeplibs $a_deplib"
2679                     a_deplib=""
2680                     break 2
2681                   fi
2682                 done
2683               done
2684               if test -n "$a_deplib" ; then
2685                 droppeddeps=yes
2686                 echo
2687                 echo "*** Warning: This library needs some functionality provided by $a_deplib."
2688                 echo "*** I have the capability to make that library automatically link in when"
2689                 echo "*** you link to this library.  But I can only do this if you have a"
2690                 echo "*** shared version of the library, which you do not appear to have."
2691               fi
2692             else
2693               # Add a -L argument.
2694               newdeplibs="$newdeplibs $a_deplib"
2695             fi
2696           done # Gone through all deplibs.
2697           ;;
2698         none | unknown | *)
2699           newdeplibs=""
2700           if $echo "X $deplibs" | $Xsed -e 's/ -lc$//' \
2701                -e 's/ -[LR][^ ]*//g' -e 's/[    ]//g' |
2702              grep . >/dev/null; then
2703             echo
2704             if test "X$deplibs_check_method" = "Xnone"; then
2705               echo "*** Warning: inter-library dependencies are not supported in this platform."
2706             else
2707               echo "*** Warning: inter-library dependencies are not known to be supported."
2708             fi
2709             echo "*** All declared inter-library dependencies are being dropped."
2710             droppeddeps=yes
2711           fi
2712           ;;
2713         esac
2714         versuffix=$versuffix_save
2715         major=$major_save
2716         release=$release_save
2717         libname=$libname_save
2718         name=$name_save
2719
2720         case $host in
2721         *-*-rhapsody* | *-*-darwin1.[012])
2722           # On Rhapsody replace the C library is the System framework
2723           newdeplibs=`$echo "X $newdeplibs" | $Xsed -e 's/ -lc / -framework System /'`
2724           ;;
2725         esac
2726
2727         if test "$droppeddeps" = yes; then
2728           if test "$module" = yes; then
2729             echo
2730             echo "*** Warning: libtool could not satisfy all declared inter-library"
2731             echo "*** dependencies of module $libname.  Therefore, libtool will create"
2732             echo "*** a static module, that should work as long as the dlopening"
2733             echo "*** application is linked with the -dlopen flag."
2734             if test -z "$global_symbol_pipe"; then
2735               echo
2736               echo "*** However, this would only work if libtool was able to extract symbol"
2737               echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
2738               echo "*** not find such a program.  So, this module is probably useless."
2739               echo "*** \`nm' from GNU binutils and a full rebuild may help."
2740             fi
2741             if test "$build_old_libs" = no; then
2742               oldlibs="$output_objdir/$libname.$libext"
2743               build_libtool_libs=module
2744               build_old_libs=yes
2745             else
2746               build_libtool_libs=no
2747             fi
2748           else
2749             echo "*** The inter-library dependencies that have been dropped here will be"
2750             echo "*** automatically added whenever a program is linked with this library"
2751             echo "*** or is declared to -dlopen it."
2752
2753             if test "$allow_undefined" = no; then
2754               echo
2755               echo "*** Since this library must not contain undefined symbols,"
2756               echo "*** because either the platform does not support them or"
2757               echo "*** it was explicitly requested with -no-undefined,"
2758               echo "*** libtool will only create a static version of it."
2759               if test "$build_old_libs" = no; then
2760                 oldlibs="$output_objdir/$libname.$libext"
2761                 build_libtool_libs=module
2762                 build_old_libs=yes
2763               else
2764                 build_libtool_libs=no
2765               fi
2766             fi
2767           fi
2768         fi
2769         # Done checking deplibs!
2770         deplibs=$newdeplibs
2771       fi
2772
2773       # All the library-specific variables (install_libdir is set above).
2774       library_names=
2775       old_library=
2776       dlname=
2777
2778       # Test again, we may have decided not to build it any more
2779       if test "$build_libtool_libs" = yes; then
2780         if test "$hardcode_into_libs" = yes; then
2781           # Hardcode the library paths
2782           hardcode_libdirs=
2783           dep_rpath=
2784           rpath="$finalize_rpath"
2785           test "$mode" != relink && rpath="$compile_rpath$rpath"
2786           for libdir in $rpath; do
2787             if test -n "$hardcode_libdir_flag_spec"; then
2788               if test -n "$hardcode_libdir_separator"; then
2789                 if test -z "$hardcode_libdirs"; then
2790                   hardcode_libdirs="$libdir"
2791                 else
2792                   # Just accumulate the unique libdirs.
2793                   case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
2794                   *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
2795                     ;;
2796                   *)
2797                     hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
2798                     ;;
2799                   esac
2800                 fi
2801               else
2802                 eval flag=\"$hardcode_libdir_flag_spec\"
2803                 dep_rpath="$dep_rpath $flag"
2804               fi
2805             elif test -n "$runpath_var"; then
2806               case "$perm_rpath " in
2807               *" $libdir "*) ;;
2808               *) perm_rpath="$perm_rpath $libdir" ;;
2809               esac
2810             fi
2811           done
2812           # Substitute the hardcoded libdirs into the rpath.
2813           if test -n "$hardcode_libdir_separator" &&
2814              test -n "$hardcode_libdirs"; then
2815             libdir="$hardcode_libdirs"
2816             eval dep_rpath=\"$hardcode_libdir_flag_spec\"
2817           fi
2818           if test -n "$runpath_var" && test -n "$perm_rpath"; then
2819             # We should set the runpath_var.
2820             rpath=
2821             for dir in $perm_rpath; do
2822               rpath="$rpath$dir:"
2823             done
2824             eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var"
2825           fi
2826           test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs"
2827         fi
2828
2829         shlibpath="$finalize_shlibpath"
2830         test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath"
2831         if test -n "$shlibpath"; then
2832           eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var"
2833         fi
2834
2835         # Get the real and link names of the library.
2836         eval library_names=\"$library_names_spec\"
2837         set dummy $library_names
2838         realname="$2"
2839         shift; shift
2840
2841         if test -n "$soname_spec"; then
2842           eval soname=\"$soname_spec\"
2843         else
2844           soname="$realname"
2845         fi
2846         test -z "$dlname" && dlname=$soname
2847
2848         lib="$output_objdir/$realname"
2849         for link
2850         do
2851           linknames="$linknames $link"
2852         done
2853
2854         # Ensure that we have .o objects for linkers which dislike .lo
2855         # (e.g. aix) in case we are running --disable-static
2856         for obj in $libobjs; do
2857           xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'`
2858           if test "X$xdir" = "X$obj"; then
2859             xdir="."
2860           else
2861             xdir="$xdir"
2862           fi
2863           baseobj=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
2864           oldobj=`$echo "X$baseobj" | $Xsed -e "$lo2o"`
2865           if test ! -f $xdir/$oldobj; then
2866             $show "(cd $xdir && ${LN_S} $baseobj $oldobj)"
2867             $run eval '(cd $xdir && ${LN_S} $baseobj $oldobj)' || exit $?
2868           fi
2869         done
2870
2871         # Use standard objects if they are pic
2872         test -z "$pic_flag" && libobjs=`$echo "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
2873
2874         # Prepare the list of exported symbols
2875         if test -z "$export_symbols"; then
2876           if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then
2877             $show "generating symbol list for \`$libname.la'"
2878             export_symbols="$output_objdir/$libname.exp"
2879             $run $rm $export_symbols
2880             eval cmds=\"$export_symbols_cmds\"
2881             save_ifs="$IFS"; IFS='~'
2882             for cmd in $cmds; do
2883               IFS="$save_ifs"
2884               $show "$cmd"
2885               $run eval "$cmd" || exit $?
2886             done
2887             IFS="$save_ifs"
2888             if test -n "$export_symbols_regex"; then
2889               $show "egrep -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\""
2890               $run eval 'egrep -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
2891               $show "$mv \"${export_symbols}T\" \"$export_symbols\""
2892               $run eval '$mv "${export_symbols}T" "$export_symbols"'
2893             fi
2894           fi
2895         fi
2896
2897         if test -n "$export_symbols" && test -n "$include_expsyms"; then
2898           $run eval '$echo "X$include_expsyms" | $SP2NL >> "$export_symbols"'
2899         fi
2900
2901         if test -n "$convenience"; then
2902           if test -n "$whole_archive_flag_spec"; then
2903             eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
2904           else
2905             gentop="$output_objdir/${outputname}x"
2906             $show "${rm}r $gentop"
2907             $run ${rm}r "$gentop"
2908             $show "mkdir $gentop"
2909             $run mkdir "$gentop"
2910             status=$?
2911             if test "$status" -ne 0 && test ! -d "$gentop"; then
2912               exit $status
2913             fi
2914             generated="$generated $gentop"
2915
2916             for xlib in $convenience; do
2917               # Extract the objects.
2918               case $xlib in
2919               [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
2920               *) xabs=`pwd`"/$xlib" ;;
2921               esac
2922               xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
2923               xdir="$gentop/$xlib"
2924
2925               $show "${rm}r $xdir"
2926               $run ${rm}r "$xdir"
2927               $show "mkdir $xdir"
2928               $run mkdir "$xdir"
2929               status=$?
2930               if test "$status" -ne 0 && test ! -d "$xdir"; then
2931                 exit $status
2932               fi
2933               $show "(cd $xdir && $AR x $xabs)"
2934               $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
2935
2936               libobjs="$libobjs "`find $xdir -name \*.o -print -o -name \*.lo -print | $NL2SP`
2937             done
2938           fi
2939         fi
2940
2941         if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then
2942           eval flag=\"$thread_safe_flag_spec\"
2943           linker_flags="$linker_flags $flag"
2944         fi
2945
2946         # Make a backup of the uninstalled library when relinking
2947         if test "$mode" = relink; then
2948           $run eval '(cd $output_objdir && $rm ${realname}U && $mv $realname ${realname}U)' || exit $?
2949         fi
2950
2951         # Do each of the archive commands.
2952         if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
2953           eval cmds=\"$archive_expsym_cmds\"
2954         else
2955           eval cmds=\"$archive_cmds\"
2956         fi
2957         save_ifs="$IFS"; IFS='~'
2958         for cmd in $cmds; do
2959           IFS="$save_ifs"
2960           $show "$cmd"
2961           $run eval "$cmd" || exit $?
2962         done
2963         IFS="$save_ifs"
2964
2965         # Restore the uninstalled library and exit
2966         if test "$mode" = relink; then
2967           $run eval '(cd $output_objdir && $rm ${realname}T && $mv $realname ${realname}T && $mv "$realname"U $realname)' || exit $?
2968           exit 0
2969         fi
2970
2971         # Create links to the real library.
2972         for linkname in $linknames; do
2973           if test "$realname" != "$linkname"; then
2974             $show "(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)"
2975             $run eval '(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)' || exit $?
2976           fi
2977         done
2978
2979         # If -module or -export-dynamic was specified, set the dlname.
2980         if test "$module" = yes || test "$export_dynamic" = yes; then
2981           # On all known operating systems, these are identical.
2982           dlname="$soname"
2983         fi
2984       fi
2985       ;;
2986
2987     obj)
2988       if test -n "$deplibs"; then
2989         $echo "$modename: warning: \`-l' and \`-L' are ignored for objects" 1>&2
2990       fi
2991
2992       if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
2993         $echo "$modename: warning: \`-dlopen' is ignored for objects" 1>&2
2994       fi
2995
2996       if test -n "$rpath"; then
2997         $echo "$modename: warning: \`-rpath' is ignored for objects" 1>&2
2998       fi
2999
3000       if test -n "$xrpath"; then
3001         $echo "$modename: warning: \`-R' is ignored for objects" 1>&2
3002       fi
3003
3004       if test -n "$vinfo"; then
3005         $echo "$modename: warning: \`-version-info' is ignored for objects" 1>&2
3006       fi
3007
3008       if test -n "$release"; then
3009         $echo "$modename: warning: \`-release' is ignored for objects" 1>&2
3010       fi
3011
3012       case $output in
3013       *.lo)
3014         if test -n "$objs$old_deplibs"; then
3015           $echo "$modename: cannot build library object \`$output' from non-libtool objects" 1>&2
3016           exit 1
3017         fi
3018         libobj="$output"
3019         obj=`$echo "X$output" | $Xsed -e "$lo2o"`
3020         ;;
3021       *)
3022         libobj=
3023         obj="$output"
3024         ;;
3025       esac
3026
3027       # Delete the old objects.
3028       $run $rm $obj $libobj
3029
3030       # Objects from convenience libraries.  This assumes
3031       # single-version convenience libraries.  Whenever we create
3032       # different ones for PIC/non-PIC, this we'll have to duplicate
3033       # the extraction.
3034       reload_conv_objs=
3035       gentop=
3036       # reload_cmds runs $LD directly, so let us get rid of
3037       # -Wl from whole_archive_flag_spec
3038       wl=
3039
3040       if test -n "$convenience"; then
3041         if test -n "$whole_archive_flag_spec"; then
3042           eval reload_conv_objs=\"\$reload_objs $whole_archive_flag_spec\"
3043         else
3044           gentop="$output_objdir/${obj}x"
3045           $show "${rm}r $gentop"
3046           $run ${rm}r "$gentop"
3047           $show "mkdir $gentop"
3048           $run mkdir "$gentop"
3049           status=$?
3050           if test "$status" -ne 0 && test ! -d "$gentop"; then
3051             exit $status
3052           fi
3053           generated="$generated $gentop"
3054
3055           for xlib in $convenience; do
3056             # Extract the objects.
3057             case $xlib in
3058             [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
3059             *) xabs=`pwd`"/$xlib" ;;
3060             esac
3061             xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
3062             xdir="$gentop/$xlib"
3063
3064             $show "${rm}r $xdir"
3065             $run ${rm}r "$xdir"
3066             $show "mkdir $xdir"
3067             $run mkdir "$xdir"
3068             status=$?
3069             if test "$status" -ne 0 && test ! -d "$xdir"; then
3070               exit $status
3071             fi
3072             $show "(cd $xdir && $AR x $xabs)"
3073             $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
3074
3075             reload_conv_objs="$reload_objs "`find $xdir -name \*.o -print -o -name \*.lo -print | $NL2SP`
3076           done
3077         fi
3078       fi
3079
3080       # Create the old-style object.
3081       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
3082
3083       output="$obj"
3084       eval cmds=\"$reload_cmds\"
3085       save_ifs="$IFS"; IFS='~'
3086       for cmd in $cmds; do
3087         IFS="$save_ifs"
3088         $show "$cmd"
3089         $run eval "$cmd" || exit $?
3090       done
3091       IFS="$save_ifs"
3092
3093       # Exit if we aren't doing a library object file.
3094       if test -z "$libobj"; then
3095         if test -n "$gentop"; then
3096           $show "${rm}r $gentop"
3097           $run ${rm}r $gentop
3098         fi
3099
3100         exit 0
3101       fi
3102
3103       if test "$build_libtool_libs" != yes; then
3104         if test -n "$gentop"; then
3105           $show "${rm}r $gentop"
3106           $run ${rm}r $gentop
3107         fi
3108
3109         # Create an invalid libtool object if no PIC, so that we don't
3110         # accidentally link it into a program.
3111         $show "echo timestamp > $libobj"
3112         $run eval "echo timestamp > $libobj" || exit $?
3113         exit 0
3114       fi
3115
3116       if test -n "$pic_flag" || test "$pic_mode" != default; then
3117         # Only do commands if we really have different PIC objects.
3118         reload_objs="$libobjs $reload_conv_objs"
3119         output="$libobj"
3120         eval cmds=\"$reload_cmds\"
3121         save_ifs="$IFS"; IFS='~'
3122         for cmd in $cmds; do
3123           IFS="$save_ifs"
3124           $show "$cmd"
3125           $run eval "$cmd" || exit $?
3126         done
3127         IFS="$save_ifs"
3128       else
3129         # Just create a symlink.
3130         $show $rm $libobj
3131         $run $rm $libobj
3132         xdir=`$echo "X$libobj" | $Xsed -e 's%/[^/]*$%%'`
3133         if test "X$xdir" = "X$libobj"; then
3134           xdir="."
3135         else
3136           xdir="$xdir"
3137         fi
3138         baseobj=`$echo "X$libobj" | $Xsed -e 's%^.*/%%'`
3139         oldobj=`$echo "X$baseobj" | $Xsed -e "$lo2o"`
3140         $show "(cd $xdir && $LN_S $oldobj $baseobj)"
3141         $run eval '(cd $xdir && $LN_S $oldobj $baseobj)' || exit $?
3142       fi
3143
3144       if test -n "$gentop"; then
3145         $show "${rm}r $gentop"
3146         $run ${rm}r $gentop
3147       fi
3148
3149       exit 0
3150       ;;
3151
3152     prog)
3153       case $host in
3154         *cygwin*) output=`echo $output | sed -e 's,.exe$,,;s,$,.exe,'` ;;
3155       esac
3156       if test -n "$vinfo"; then
3157         $echo "$modename: warning: \`-version-info' is ignored for programs" 1>&2
3158       fi
3159
3160       if test -n "$release"; then
3161         $echo "$modename: warning: \`-release' is ignored for programs" 1>&2
3162       fi
3163
3164       if test "$preload" = yes; then
3165         if test "$dlopen_support" = unknown && test "$dlopen_self" = unknown &&
3166            test "$dlopen_self_static" = unknown; then
3167           $echo "$modename: warning: \`AC_LIBTOOL_DLOPEN' not used. Assuming no dlopen support."
3168         fi
3169       fi
3170
3171       case $host in
3172       *-*-rhapsody* | *-*-darwin1.[012])
3173         # On Rhapsody replace the C library is the System framework
3174         compile_deplibs=`$echo "X $compile_deplibs" | $Xsed -e 's/ -lc / -framework System /'`
3175         finalize_deplibs=`$echo "X $finalize_deplibs" | $Xsed -e 's/ -lc / -framework System /'`
3176         ;;
3177       esac
3178
3179       compile_command="$compile_command $compile_deplibs"
3180       finalize_command="$finalize_command $finalize_deplibs"
3181
3182       if test -n "$rpath$xrpath"; then
3183         # If the user specified any rpath flags, then add them.
3184         for libdir in $rpath $xrpath; do
3185           # This is the magic to use -rpath.
3186           case "$finalize_rpath " in
3187           *" $libdir "*) ;;
3188           *) finalize_rpath="$finalize_rpath $libdir" ;;
3189           esac
3190         done
3191       fi
3192
3193       # Now hardcode the library paths
3194       rpath=
3195       hardcode_libdirs=
3196       for libdir in $compile_rpath $finalize_rpath; do
3197         if test -n "$hardcode_libdir_flag_spec"; then
3198           if test -n "$hardcode_libdir_separator"; then
3199             if test -z "$hardcode_libdirs"; then
3200               hardcode_libdirs="$libdir"
3201             else
3202               # Just accumulate the unique libdirs.
3203               case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
3204               *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
3205                 ;;
3206               *)
3207                 hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
3208                 ;;
3209               esac
3210             fi
3211           else
3212             eval flag=\"$hardcode_libdir_flag_spec\"
3213             rpath="$rpath $flag"
3214           fi
3215         elif test -n "$runpath_var"; then
3216           case "$perm_rpath " in
3217           *" $libdir "*) ;;
3218           *) perm_rpath="$perm_rpath $libdir" ;;
3219           esac
3220         fi
3221         case $host in
3222         *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
3223           case :$dllsearchpath: in
3224           *":$libdir:"*) ;;
3225           *) dllsearchpath="$dllsearchpath:$libdir";;
3226           esac
3227           ;;
3228         esac
3229       done
3230       # Substitute the hardcoded libdirs into the rpath.
3231       if test -n "$hardcode_libdir_separator" &&
3232          test -n "$hardcode_libdirs"; then
3233         libdir="$hardcode_libdirs"
3234         eval rpath=\" $hardcode_libdir_flag_spec\"
3235       fi
3236       compile_rpath="$rpath"
3237
3238       rpath=
3239       hardcode_libdirs=
3240       for libdir in $finalize_rpath; do
3241         if test -n "$hardcode_libdir_flag_spec"; then
3242           if test -n "$hardcode_libdir_separator"; then
3243             if test -z "$hardcode_libdirs"; then
3244               hardcode_libdirs="$libdir"
3245             else
3246               # Just accumulate the unique libdirs.
3247               case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
3248               *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
3249                 ;;
3250               *)
3251                 hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
3252                 ;;
3253               esac
3254             fi
3255           else
3256             eval flag=\"$hardcode_libdir_flag_spec\"
3257             rpath="$rpath $flag"
3258           fi
3259         elif test -n "$runpath_var"; then
3260           case "$finalize_perm_rpath " in
3261           *" $libdir "*) ;;
3262           *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;;
3263           esac
3264         fi
3265       done
3266       # Substitute the hardcoded libdirs into the rpath.
3267       if test -n "$hardcode_libdir_separator" &&
3268          test -n "$hardcode_libdirs"; then
3269         libdir="$hardcode_libdirs"
3270         eval rpath=\" $hardcode_libdir_flag_spec\"
3271       fi
3272       finalize_rpath="$rpath"
3273
3274       if test -n "$libobjs" && test "$build_old_libs" = yes; then
3275         # Transform all the library objects into standard objects.
3276         compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
3277         finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
3278       fi
3279
3280       dlsyms=
3281       if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
3282         if test -n "$NM" && test -n "$global_symbol_pipe"; then
3283           dlsyms="${outputname}S.c"
3284         else
3285           $echo "$modename: not configured to extract global symbols from dlpreopened files" 1>&2
3286         fi
3287       fi
3288
3289       if test -n "$dlsyms"; then
3290         case $dlsyms in
3291         "") ;;
3292         *.c)
3293           # Discover the nlist of each of the dlfiles.
3294           nlist="$output_objdir/${outputname}.nm"
3295
3296           $show "$rm $nlist ${nlist}S ${nlist}T"
3297           $run $rm "$nlist" "${nlist}S" "${nlist}T"
3298
3299           # Parse the name list into a source file.
3300           $show "creating $output_objdir/$dlsyms"
3301
3302           test -z "$run" && $echo > "$output_objdir/$dlsyms" "\
3303 /* $dlsyms - symbol resolution table for \`$outputname' dlsym emulation. */
3304 /* Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP */
3305
3306 #ifdef __cplusplus
3307 extern \"C\" {
3308 #endif
3309
3310 /* Prevent the only kind of declaration conflicts we can make. */
3311 #define lt_preloaded_symbols some_other_symbol
3312
3313 /* External symbol declarations for the compiler. */\
3314 "
3315
3316           if test "$dlself" = yes; then
3317             $show "generating symbol list for \`$output'"
3318
3319             test -z "$run" && $echo ': @PROGRAM@ ' > "$nlist"
3320
3321             # Add our own program objects to the symbol list.
3322             progfiles=`$echo "X$objs$old_deplibs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
3323             for arg in $progfiles; do
3324               $show "extracting global C symbols from \`$arg'"
3325               $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
3326             done
3327
3328             if test -n "$exclude_expsyms"; then
3329               $run eval 'egrep -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
3330               $run eval '$mv "$nlist"T "$nlist"'
3331             fi
3332
3333             if test -n "$export_symbols_regex"; then
3334               $run eval 'egrep -e "$export_symbols_regex" "$nlist" > "$nlist"T'
3335               $run eval '$mv "$nlist"T "$nlist"'
3336             fi
3337
3338             # Prepare the list of exported symbols
3339             if test -z "$export_symbols"; then
3340               export_symbols="$output_objdir/$output.exp"
3341               $run $rm $export_symbols
3342               $run eval "sed -n -e '/^: @PROGRAM@$/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
3343             else
3344               $run eval "sed -e 's/\([][.*^$]\)/\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$output.exp"'
3345               $run eval 'grep -f "$output_objdir/$output.exp" < "$nlist" > "$nlist"T'
3346               $run eval 'mv "$nlist"T "$nlist"'
3347             fi
3348           fi
3349
3350           for arg in $dlprefiles; do
3351             $show "extracting global C symbols from \`$arg'"
3352             name=`echo "$arg" | sed -e 's%^.*/%%'`
3353             $run eval 'echo ": $name " >> "$nlist"'
3354             $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
3355           done
3356
3357           if test -z "$run"; then
3358             # Make sure we have at least an empty file.
3359             test -f "$nlist" || : > "$nlist"
3360
3361             if test -n "$exclude_expsyms"; then
3362               egrep -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T
3363               $mv "$nlist"T "$nlist"
3364             fi
3365
3366             # Try sorting and uniquifying the output.
3367             if grep -v "^: " < "$nlist" | sort +2 | uniq > "$nlist"S; then
3368               :
3369             else
3370               grep -v "^: " < "$nlist" > "$nlist"S
3371             fi
3372
3373             if test -f "$nlist"S; then
3374               eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$dlsyms"'
3375             else
3376               echo '/* NONE */' >> "$output_objdir/$dlsyms"
3377             fi
3378
3379             $echo >> "$output_objdir/$dlsyms" "\
3380
3381 #undef lt_preloaded_symbols
3382
3383 #if defined (__STDC__) && __STDC__
3384 # define lt_ptr void *
3385 #else
3386 # define lt_ptr char *
3387 # define const
3388 #endif
3389
3390 /* The mapping between symbol names and symbols. */
3391 const struct {
3392   const char *name;
3393   lt_ptr address;
3394 }
3395 lt_preloaded_symbols[] =
3396 {\
3397 "
3398
3399             eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$dlsyms"
3400
3401             $echo >> "$output_objdir/$dlsyms" "\
3402   {0, (lt_ptr) 0}
3403 };
3404
3405 /* This works around a problem in FreeBSD linker */
3406 #ifdef FREEBSD_WORKAROUND
3407 static const void *lt_preloaded_setup() {
3408   return lt_preloaded_symbols;
3409 }
3410 #endif
3411
3412 #ifdef __cplusplus
3413 }
3414 #endif\
3415 "
3416           fi
3417
3418           pic_flag_for_symtable=
3419           case $host in
3420           # compiling the symbol table file with pic_flag works around
3421           # a FreeBSD bug that causes programs to crash when -lm is
3422           # linked before any other PIC object.  But we must not use
3423           # pic_flag when linking with -static.  The problem exists in
3424           # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1.
3425           *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)
3426             case "$compile_command " in
3427             *" -static "*) ;;
3428             *) pic_flag_for_symtable=" $pic_flag -DPIC -DFREEBSD_WORKAROUND";;
3429             esac;;
3430           *-*-hpux*)
3431             case "$compile_command " in
3432             *" -static "*) ;;
3433             *) pic_flag_for_symtable=" $pic_flag -DPIC";;
3434             esac
3435           esac
3436
3437           # Now compile the dynamic symbol file.
3438           $show "(cd $output_objdir && $CC -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")"
3439           $run eval '(cd $output_objdir && $CC -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $?
3440
3441           # Clean up the generated files.
3442           $show "$rm $output_objdir/$dlsyms $nlist ${nlist}S ${nlist}T"
3443           $run $rm "$output_objdir/$dlsyms" "$nlist" "${nlist}S" "${nlist}T"
3444
3445           # Transform the symbol file into the correct name.
3446           compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
3447           finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
3448           ;;
3449         *)
3450           $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2
3451           exit 1
3452           ;;
3453         esac
3454       else
3455         # We keep going just in case the user didn't refer to
3456         # lt_preloaded_symbols.  The linker will fail if global_symbol_pipe
3457         # really was required.
3458
3459         # Nullify the symbol file.
3460         compile_command=`$echo "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"`
3461         finalize_command=`$echo "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"`
3462       fi
3463
3464       if test "$need_relink" = no || test "$build_libtool_libs" != yes; then
3465         # Replace the output file specification.
3466         compile_command=`$echo "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
3467         link_command="$compile_command$compile_rpath"
3468
3469         # We have no uninstalled library dependencies, so finalize right now.
3470         $show "$link_command"
3471         $run eval "$link_command"
3472         status=$?
3473
3474         # Delete the generated files.
3475         if test -n "$dlsyms"; then
3476           $show "$rm $output_objdir/${outputname}S.${objext}"
3477           $run $rm "$output_objdir/${outputname}S.${objext}"
3478         fi
3479
3480         exit $status
3481       fi
3482
3483       if test -n "$shlibpath_var"; then
3484         # We should set the shlibpath_var
3485         rpath=
3486         for dir in $temp_rpath; do
3487           case $dir in
3488           [\\/]* | [A-Za-z]:[\\/]*)
3489             # Absolute path.
3490             rpath="$rpath$dir:"
3491             ;;
3492           *)
3493             # Relative path: add a thisdir entry.
3494             rpath="$rpath\$thisdir/$dir:"
3495             ;;
3496           esac
3497         done
3498         temp_rpath="$rpath"
3499       fi
3500
3501       if test -n "$compile_shlibpath$finalize_shlibpath"; then
3502         compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command"
3503       fi
3504       if test -n "$finalize_shlibpath"; then
3505         finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command"
3506       fi
3507
3508       compile_var=
3509       finalize_var=
3510       if test -n "$runpath_var"; then
3511         if test -n "$perm_rpath"; then
3512           # We should set the runpath_var.
3513           rpath=
3514           for dir in $perm_rpath; do
3515             rpath="$rpath$dir:"
3516           done
3517           compile_var="$runpath_var=\"$rpath\$$runpath_var\" "
3518         fi
3519         if test -n "$finalize_perm_rpath"; then
3520           # We should set the runpath_var.
3521           rpath=
3522           for dir in $finalize_perm_rpath; do
3523             rpath="$rpath$dir:"
3524           done
3525           finalize_var="$runpath_var=\"$rpath\$$runpath_var\" "
3526         fi
3527       fi
3528
3529       if test "$no_install" = yes; then
3530         # We don't need to create a wrapper script.
3531         link_command="$compile_var$compile_command$compile_rpath"
3532         # Replace the output file specification.
3533         link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
3534         # Delete the old output file.
3535         $run $rm $output
3536         # Link the executable and exit
3537         $show "$link_command"
3538         $run eval "$link_command" || exit $?
3539         exit 0
3540       fi
3541
3542       if test "$hardcode_action" = relink; then
3543         # Fast installation is not supported
3544         link_command="$compile_var$compile_command$compile_rpath"
3545         relink_command="$finalize_var$finalize_command$finalize_rpath"
3546
3547         $echo "$modename: warning: this platform does not like uninstalled shared libraries" 1>&2
3548         $echo "$modename: \`$output' will be relinked during installation" 1>&2
3549       else
3550         if test "$fast_install" != no; then
3551           link_command="$finalize_var$compile_command$finalize_rpath"
3552           if test "$fast_install" = yes; then
3553             relink_command=`$echo "X$compile_var$compile_command$compile_rpath" | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g'`
3554           else
3555             # fast_install is set to needless
3556             relink_command=
3557           fi
3558         else
3559           link_command="$compile_var$compile_command$compile_rpath"
3560           relink_command="$finalize_var$finalize_command$finalize_rpath"
3561         fi
3562       fi
3563
3564       # Replace the output file specification.
3565       link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`
3566
3567       # Delete the old output files.
3568       $run $rm $output $output_objdir/$outputname $output_objdir/lt-$outputname
3569
3570       $show "$link_command"
3571       $run eval "$link_command" || exit $?
3572
3573       # Now create the wrapper script.
3574       $show "creating $output"
3575
3576       # Quote the relink command for shipping.
3577       if test -n "$relink_command"; then
3578         # Preserve any variables that may affect compiler behavior
3579         for var in $variables_saved_for_relink; do
3580           if eval test -z \"\${$var+set}\"; then
3581             relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command"
3582           elif eval var_value=\$$var; test -z "$var_value"; then
3583             relink_command="$var=; export $var; $relink_command"
3584           else
3585             var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"`
3586             relink_command="$var=\"$var_value\"; export $var; $relink_command"
3587           fi
3588         done
3589         relink_command="(cd `pwd`; $relink_command)"
3590         relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"`
3591       fi
3592
3593       # Quote $echo for shipping.
3594       if test "X$echo" = "X$SHELL $0 --fallback-echo"; then
3595         case $0 in
3596         [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $0 --fallback-echo";;
3597         *) qecho="$SHELL `pwd`/$0 --fallback-echo";;
3598         esac
3599         qecho=`$echo "X$qecho" | $Xsed -e "$sed_quote_subst"`
3600       else
3601         qecho=`$echo "X$echo" | $Xsed -e "$sed_quote_subst"`
3602       fi
3603
3604       # Only actually do things if our run command is non-null.
3605       if test -z "$run"; then
3606         # win32 will think the script is a binary if it has
3607         # a .exe suffix, so we strip it off here.
3608         case $output in
3609           *.exe) output=`echo $output|sed 's,.exe$,,'` ;;
3610         esac
3611         # test for cygwin because mv fails w/o .exe extensions
3612         case $host in
3613           *cygwin*) exeext=.exe ;;
3614           *) exeext= ;;
3615         esac
3616         $rm $output
3617         trap "$rm $output; exit 1" 1 2 15
3618
3619         $echo > $output "\
3620 #! $SHELL
3621
3622 # $output - temporary wrapper script for $objdir/$outputname
3623 # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
3624 #
3625 # The $output program cannot be directly executed until all the libtool
3626 # libraries that it depends on are installed.
3627 #
3628 # This wrapper script should never be moved out of the build directory.
3629 # If it is, it will not operate correctly.
3630
3631 # Sed substitution that helps us do robust quoting.  It backslashifies
3632 # metacharacters that are still active within double-quoted strings.
3633 Xsed='sed -e 1s/^X//'
3634 sed_quote_subst='$sed_quote_subst'
3635
3636 # The HP-UX ksh and POSIX shell print the target directory to stdout
3637 # if CDPATH is set.
3638 if test \"\${CDPATH+set}\" = set; then CDPATH=:; export CDPATH; fi
3639
3640 relink_command=\"$relink_command\"
3641
3642 # This environment variable determines our operation mode.
3643 if test \"\$libtool_install_magic\" = \"$magic\"; then
3644   # install mode needs the following variable:
3645   notinst_deplibs='$notinst_deplibs'
3646 else
3647   # When we are sourced in execute mode, \$file and \$echo are already set.
3648   if test \"\$libtool_execute_magic\" != \"$magic\"; then
3649     echo=\"$qecho\"
3650     file=\"\$0\"
3651     # Make sure echo works.
3652     if test \"X\$1\" = X--no-reexec; then
3653       # Discard the --no-reexec flag, and continue.
3654       shift
3655     elif test \"X\`(\$echo '\t') 2>/dev/null\`\" = 'X\t'; then
3656       # Yippee, \$echo works!
3657       :
3658     else
3659       # Restart under the correct shell, and then maybe \$echo will work.
3660       exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"}
3661     fi
3662   fi\
3663 "
3664         $echo >> $output "\
3665
3666   # Find the directory that this script lives in.
3667   thisdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\`
3668   test \"x\$thisdir\" = \"x\$file\" && thisdir=.
3669
3670   # Follow symbolic links until we get to the real thisdir.
3671   file=\`ls -ld \"\$file\" | sed -n 's/.*-> //p'\`
3672   while test -n \"\$file\"; do
3673     destdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\`
3674
3675     # If there was a directory component, then change thisdir.
3676     if test \"x\$destdir\" != \"x\$file\"; then
3677       case \"\$destdir\" in
3678       [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;;
3679       *) thisdir=\"\$thisdir/\$destdir\" ;;
3680       esac
3681     fi
3682
3683     file=\`\$echo \"X\$file\" | \$Xsed -e 's%^.*/%%'\`
3684     file=\`ls -ld \"\$thisdir/\$file\" | sed -n 's/.*-> //p'\`
3685   done
3686
3687   # Try to get the absolute directory name.
3688   absdir=\`cd \"\$thisdir\" && pwd\`
3689   test -n \"\$absdir\" && thisdir=\"\$absdir\"
3690 "
3691
3692         if test "$fast_install" = yes; then
3693           echo >> $output "\
3694   program=lt-'$outputname'$exeext
3695   progdir=\"\$thisdir/$objdir\"
3696
3697   if test ! -f \"\$progdir/\$program\" || \\
3698      { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | sed 1q\`; \\
3699        test \"X\$file\" != \"X\$progdir/\$program\"; }; then
3700
3701     file=\"\$\$-\$program\"
3702
3703     if test ! -d \"\$progdir\"; then
3704       $mkdir \"\$progdir\"
3705     else
3706       $rm \"\$progdir/\$file\"
3707     fi"
3708
3709           echo >> $output "\
3710
3711     # relink executable if necessary
3712     if test -n \"\$relink_command\"; then
3713       if relink_command_output=\`eval \$relink_command 2>&1\`; then :
3714       else
3715         $echo \"\$relink_command_output\" >&2
3716         $rm \"\$progdir/\$file\"
3717         exit 1
3718       fi
3719     fi
3720
3721     $mv \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null ||
3722     { $rm \"\$progdir/\$program\";
3723       $mv \"\$progdir/\$file\" \"\$progdir/\$program\"; }
3724     $rm \"\$progdir/\$file\"
3725   fi"
3726         else
3727           echo >> $output "\
3728   program='$outputname'
3729   progdir=\"\$thisdir/$objdir\"
3730 "
3731         fi
3732
3733         echo >> $output "\
3734
3735   if test -f \"\$progdir/\$program\"; then"
3736
3737         # Export our shlibpath_var if we have one.
3738         if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
3739           $echo >> $output "\
3740     # Add our own library path to $shlibpath_var
3741     $shlibpath_var=\"$temp_rpath\$$shlibpath_var\"
3742
3743     # Some systems cannot cope with colon-terminated $shlibpath_var
3744     # The second colon is a workaround for a bug in BeOS R4 sed
3745     $shlibpath_var=\`\$echo \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\`
3746
3747     export $shlibpath_var
3748 "
3749         fi
3750
3751         # fixup the dll searchpath if we need to.
3752         if test -n "$dllsearchpath"; then
3753           $echo >> $output "\
3754     # Add the dll search path components to the executable PATH
3755     PATH=$dllsearchpath:\$PATH
3756 "
3757         fi
3758
3759         $echo >> $output "\
3760     if test \"\$libtool_execute_magic\" != \"$magic\"; then
3761       # Run the actual program with our arguments.
3762 "
3763         case $host in
3764         # win32 systems need to use the prog path for dll
3765         # lookup to work
3766         *-*-cygwin* | *-*-pw32*)
3767           $echo >> $output "\
3768       exec \$progdir/\$program \${1+\"\$@\"}
3769 "
3770           ;;
3771
3772         # Backslashes separate directories on plain windows
3773         *-*-mingw | *-*-os2*)
3774           $echo >> $output "\
3775       exec \$progdir\\\\\$program \${1+\"\$@\"}
3776 "
3777           ;;
3778
3779         *)
3780           $echo >> $output "\
3781       # Export the path to the program.
3782       PATH=\"\$progdir:\$PATH\"
3783       export PATH
3784
3785       exec \$program \${1+\"\$@\"}
3786 "
3787           ;;
3788         esac
3789         $echo >> $output "\
3790       \$echo \"\$0: cannot exec \$program \${1+\"\$@\"}\"
3791       exit 1
3792     fi
3793   else
3794     # The program doesn't exist.
3795     \$echo \"\$0: error: \$progdir/\$program does not exist\" 1>&2
3796     \$echo \"This script is just a wrapper for \$program.\" 1>&2
3797     echo \"See the $PACKAGE documentation for more information.\" 1>&2
3798     exit 1
3799   fi
3800 fi\
3801 "
3802         chmod +x $output
3803       fi
3804       exit 0
3805       ;;
3806     esac
3807
3808     # See if we need to build an old-fashioned archive.
3809     for oldlib in $oldlibs; do
3810
3811       if test "$build_libtool_libs" = convenience; then
3812         oldobjs="$libobjs_save"
3813         addlibs="$convenience"
3814         build_libtool_libs=no
3815       else
3816         if test "$build_libtool_libs" = module; then
3817           oldobjs="$libobjs_save"
3818           build_libtool_libs=no
3819         else
3820           oldobjs="$objs$old_deplibs "`$echo "X$libobjs_save" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`
3821         fi
3822         addlibs="$old_convenience"
3823       fi
3824
3825       if test -n "$addlibs"; then
3826         gentop="$output_objdir/${outputname}x"
3827         $show "${rm}r $gentop"
3828         $run ${rm}r "$gentop"
3829         $show "mkdir $gentop"
3830         $run mkdir "$gentop"
3831         status=$?
3832         if test "$status" -ne 0 && test ! -d "$gentop"; then
3833           exit $status
3834         fi
3835         generated="$generated $gentop"
3836
3837         # Add in members from convenience archives.
3838         for xlib in $addlibs; do
3839           # Extract the objects.
3840           case $xlib in
3841           [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
3842           *) xabs=`pwd`"/$xlib" ;;
3843           esac
3844           xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
3845           xdir="$gentop/$xlib"
3846
3847           $show "${rm}r $xdir"
3848           $run ${rm}r "$xdir"
3849           $show "mkdir $xdir"
3850           $run mkdir "$xdir"
3851           status=$?
3852           if test "$status" -ne 0 && test ! -d "$xdir"; then
3853             exit $status
3854           fi
3855           $show "(cd $xdir && $AR x $xabs)"
3856           $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
3857
3858           oldobjs="$oldobjs "`find $xdir -name \*.${objext} -print -o -name \*.lo -print | $NL2SP`
3859         done
3860       fi
3861
3862       # Do each command in the archive commands.
3863       if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then
3864         eval cmds=\"$old_archive_from_new_cmds\"
3865       else
3866         # Ensure that we have .o objects in place in case we decided
3867         # not to build a shared library, and have fallen back to building
3868         # static libs even though --disable-static was passed!
3869         for oldobj in $oldobjs; do
3870           if test ! -f $oldobj; then
3871             xdir=`$echo "X$oldobj" | $Xsed -e 's%/[^/]*$%%'`
3872             if test "X$xdir" = "X$oldobj"; then
3873               xdir="."
3874             else
3875               xdir="$xdir"
3876             fi
3877             baseobj=`$echo "X$oldobj" | $Xsed -e 's%^.*/%%'`
3878             obj=`$echo "X$baseobj" | $Xsed -e "$o2lo"`
3879             $show "(cd $xdir && ${LN_S} $obj $baseobj)"
3880             $run eval '(cd $xdir && ${LN_S} $obj $baseobj)' || exit $?
3881           fi
3882         done
3883
3884         eval cmds=\"$old_archive_cmds\"
3885       fi
3886       save_ifs="$IFS"; IFS='~'
3887       for cmd in $cmds; do
3888         IFS="$save_ifs"
3889         $show "$cmd"
3890         $run eval "$cmd" || exit $?
3891       done
3892       IFS="$save_ifs"
3893     done
3894
3895     if test -n "$generated"; then
3896       $show "${rm}r$generated"
3897       $run ${rm}r$generated
3898     fi
3899
3900     # Now create the libtool archive.
3901     case $output in
3902     *.la)
3903       old_library=
3904       test "$build_old_libs" = yes && old_library="$libname.$libext"
3905       $show "creating $output"
3906
3907       # Preserve any variables that may affect compiler behavior
3908       for var in $variables_saved_for_relink; do
3909         if eval test -z \"\${$var+set}\"; then
3910           relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command"
3911         elif eval var_value=\$$var; test -z "$var_value"; then
3912           relink_command="$var=; export $var; $relink_command"
3913         else
3914           var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"`
3915           relink_command="$var=\"$var_value\"; export $var; $relink_command"
3916         fi
3917       done
3918       # Quote the link command for shipping.
3919       relink_command="(cd `pwd`; $SHELL $0 --mode=relink $libtool_args @inst_prefix_dir@)"
3920       relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"`
3921
3922       # Only create the output if not a dry run.
3923       if test -z "$run"; then
3924         for installed in no yes; do
3925           if test "$installed" = yes; then
3926             if test -z "$install_libdir"; then
3927               break
3928             fi
3929             output="$output_objdir/$outputname"i
3930             # Replace all uninstalled libtool libraries with the installed ones
3931             newdependency_libs=
3932             for deplib in $dependency_libs; do
3933               case $deplib in
3934               *.la)
3935                 name=`$echo "X$deplib" | $Xsed -e 's%^.*/%%'`
3936                 eval libdir=`sed -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
3937                 if test -z "$libdir"; then
3938                   $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
3939                   exit 1
3940                 fi
3941                 newdependency_libs="$newdependency_libs $libdir/$name"
3942                 ;;
3943               *) newdependency_libs="$newdependency_libs $deplib" ;;
3944               esac
3945             done
3946             dependency_libs="$newdependency_libs"
3947             newdlfiles=
3948             for lib in $dlfiles; do
3949               name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
3950               eval libdir=`sed -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
3951               if test -z "$libdir"; then
3952                 $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
3953                 exit 1
3954               fi
3955               newdlfiles="$newdlfiles $libdir/$name"
3956             done
3957             dlfiles="$newdlfiles"
3958             newdlprefiles=
3959             for lib in $dlprefiles; do
3960               name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
3961               eval libdir=`sed -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
3962               if test -z "$libdir"; then
3963                 $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
3964                 exit 1
3965               fi
3966               newdlprefiles="$newdlprefiles $libdir/$name"
3967             done
3968             dlprefiles="$newdlprefiles"
3969           fi
3970           $rm $output
3971           # place dlname in correct position for cygwin
3972           tdlname=$dlname
3973           case $host,$output,$installed,$module,$dlname in
3974             *cygwin*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;;
3975           esac
3976           $echo > $output "\
3977 # $outputname - a libtool library file
3978 # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
3979 #
3980 # Please DO NOT delete this file!
3981 # It is necessary for linking the library.
3982
3983 # The name that we can dlopen(3).
3984 dlname='$tdlname'
3985
3986 # Names of this library.
3987 library_names='$library_names'
3988
3989 # The name of the static archive.
3990 old_library='$old_library'
3991
3992 # Libraries that this one depends upon.
3993 dependency_libs='$dependency_libs'
3994
3995 # Version information for $libname.
3996 current=$current
3997 age=$age
3998 revision=$revision
3999
4000 # Is this an already installed library?
4001 installed=$installed
4002
4003 # Files to dlopen/dlpreopen
4004 dlopen='$dlfiles'
4005 dlpreopen='$dlprefiles'
4006
4007 # Directory that this library needs to be installed in:
4008 libdir='$install_libdir'"
4009           if test "$installed" = no && test "$need_relink" = yes; then
4010             $echo >> $output "\
4011 relink_command=\"$relink_command\""
4012           fi
4013         done
4014       fi
4015
4016       # Do a symbolic link so that the libtool archive can be found in
4017       # LD_LIBRARY_PATH before the program is installed.
4018       $show "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)"
4019       $run eval '(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)' || exit $?
4020       ;;
4021     esac
4022     exit 0
4023     ;;
4024
4025   # libtool install mode
4026   install)
4027     modename="$modename: install"
4028
4029     # There may be an optional sh(1) argument at the beginning of
4030     # install_prog (especially on Windows NT).
4031     if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh ||
4032        # Allow the use of GNU shtool's install command.
4033        $echo "X$nonopt" | $Xsed | grep shtool > /dev/null; then
4034       # Aesthetically quote it.
4035       arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"`
4036       case $arg in
4037       *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \     ]*|*]*)
4038         arg="\"$arg\""
4039         ;;
4040       esac
4041       install_prog="$arg "
4042       arg="$1"
4043       shift
4044     else
4045       install_prog=
4046       arg="$nonopt"
4047     fi
4048
4049     # The real first argument should be the name of the installation program.
4050     # Aesthetically quote it.
4051     arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
4052     case $arg in
4053     *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \       ]*|*]*)
4054       arg="\"$arg\""
4055       ;;
4056     esac
4057     install_prog="$install_prog$arg"
4058
4059     # We need to accept at least all the BSD install flags.
4060     dest=
4061     files=
4062     opts=
4063     prev=
4064     install_type=
4065     isdir=no
4066     stripme=
4067     for arg
4068     do
4069       if test -n "$dest"; then
4070         files="$files $dest"
4071         dest="$arg"
4072         continue
4073       fi
4074
4075       case $arg in
4076       -d) isdir=yes ;;
4077       -f) prev="-f" ;;
4078       -g) prev="-g" ;;
4079       -m) prev="-m" ;;
4080       -o) prev="-o" ;;
4081       -s)
4082         stripme=" -s"
4083         continue
4084         ;;
4085       -*) ;;
4086
4087       *)
4088         # If the previous option needed an argument, then skip it.
4089         if test -n "$prev"; then
4090           prev=
4091         else
4092           dest="$arg"
4093           continue
4094         fi
4095         ;;
4096       esac
4097
4098       # Aesthetically quote the argument.
4099       arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
4100       case $arg in
4101       *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \     ]*|*]*)
4102         arg="\"$arg\""
4103         ;;
4104       esac
4105       install_prog="$install_prog $arg"
4106     done
4107
4108     if test -z "$install_prog"; then
4109       $echo "$modename: you must specify an install program" 1>&2
4110       $echo "$help" 1>&2
4111       exit 1
4112     fi
4113
4114     if test -n "$prev"; then
4115       $echo "$modename: the \`$prev' option requires an argument" 1>&2
4116       $echo "$help" 1>&2
4117       exit 1
4118     fi
4119
4120     if test -z "$files"; then
4121       if test -z "$dest"; then
4122         $echo "$modename: no file or destination specified" 1>&2
4123       else
4124         $echo "$modename: you must specify a destination" 1>&2
4125       fi
4126       $echo "$help" 1>&2
4127       exit 1
4128     fi
4129
4130     # Strip any trailing slash from the destination.
4131     dest=`$echo "X$dest" | $Xsed -e 's%/$%%'`
4132
4133     # Check to see that the destination is a directory.
4134     test -d "$dest" && isdir=yes
4135     if test "$isdir" = yes; then
4136       destdir="$dest"
4137       destname=
4138     else
4139       destdir=`$echo "X$dest" | $Xsed -e 's%/[^/]*$%%'`
4140       test "X$destdir" = "X$dest" && destdir=.
4141       destname=`$echo "X$dest" | $Xsed -e 's%^.*/%%'`
4142
4143       # Not a directory, so check to see that there is only one file specified.
4144       set dummy $files
4145       if test "$#" -gt 2; then
4146         $echo "$modename: \`$dest' is not a directory" 1>&2
4147         $echo "$help" 1>&2
4148         exit 1
4149       fi
4150     fi
4151     case $destdir in
4152     [\\/]* | [A-Za-z]:[\\/]*) ;;
4153     *)
4154       for file in $files; do
4155         case $file in
4156         *.lo) ;;
4157         *)
4158           $echo "$modename: \`$destdir' must be an absolute directory name" 1>&2
4159           $echo "$help" 1>&2
4160           exit 1
4161           ;;
4162         esac
4163       done
4164       ;;
4165     esac
4166
4167     # This variable tells wrapper scripts just to set variables rather
4168     # than running their programs.
4169     libtool_install_magic="$magic"
4170
4171     staticlibs=
4172     future_libdirs=
4173     current_libdirs=
4174     for file in $files; do
4175
4176       # Do each installation.
4177       case $file in
4178       *.$libext)
4179         # Do the static libraries later.
4180         staticlibs="$staticlibs $file"
4181         ;;
4182
4183       *.la)
4184         # Check to see that this really is a libtool archive.
4185         if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
4186         else
4187           $echo "$modename: \`$file' is not a valid libtool archive" 1>&2
4188           $echo "$help" 1>&2
4189           exit 1
4190         fi
4191
4192         library_names=
4193         old_library=
4194         relink_command=
4195         # If there is no directory component, then add one.
4196         case $file in
4197         */* | *\\*) . $file ;;
4198         *) . ./$file ;;
4199         esac
4200
4201         # Add the libdir to current_libdirs if it is the destination.
4202         if test "X$destdir" = "X$libdir"; then
4203           case "$current_libdirs " in
4204           *" $libdir "*) ;;
4205           *) current_libdirs="$current_libdirs $libdir" ;;
4206           esac
4207         else
4208           # Note the libdir as a future libdir.
4209           case "$future_libdirs " in
4210           *" $libdir "*) ;;
4211           *) future_libdirs="$future_libdirs $libdir" ;;
4212           esac
4213         fi
4214
4215         dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`/
4216         test "X$dir" = "X$file/" && dir=
4217         dir="$dir$objdir"
4218
4219         if test -n "$relink_command"; then
4220           # Determine the prefix the user has applied to our future dir.
4221           inst_prefix_dir=`$echo "$destdir" | sed "s%$libdir\$%%"`
4222
4223           # Don't allow the user to place us outside of our expected
4224           # location b/c this prevents finding dependent libraries that
4225           # are installed to the same prefix.
4226           if test "$inst_prefix_dir" = "$destdir"; then
4227             $echo "$modename: error: cannot install \`$file' to a directory not ending in $libdir" 1>&2
4228             exit 1
4229           fi
4230
4231           if test -n "$inst_prefix_dir"; then
4232             # Stick the inst_prefix_dir data into the link command.
4233             relink_command=`$echo "$relink_command" | sed "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"`
4234           else
4235             relink_command=`$echo "$relink_command" | sed "s%@inst_prefix_dir@%%"`
4236           fi
4237
4238           $echo "$modename: warning: relinking \`$file'" 1>&2
4239           $show "$relink_command"
4240           if $run eval "$relink_command"; then :
4241           else
4242             $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
4243             exit 1
4244           fi
4245         fi
4246
4247         # See the names of the shared library.
4248         set dummy $library_names
4249         if test -n "$2"; then
4250           realname="$2"
4251           shift
4252           shift
4253
4254           srcname="$realname"
4255           test -n "$relink_command" && srcname="$realname"T
4256
4257           # Install the shared library and build the symlinks.
4258           $show "$install_prog $dir/$srcname $destdir/$realname"
4259           $run eval "$install_prog $dir/$srcname $destdir/$realname" || exit $?
4260           if test -n "$stripme" && test -n "$striplib"; then
4261             $show "$striplib $destdir/$realname"
4262             $run eval "$striplib $destdir/$realname" || exit $?
4263           fi
4264
4265           if test "$#" -gt 0; then
4266             # Delete the old symlinks, and create new ones.
4267             for linkname
4268             do
4269               if test "$linkname" != "$realname"; then
4270                 $show "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)"
4271                 $run eval "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)"
4272               fi
4273             done
4274           fi
4275
4276           # Do each command in the postinstall commands.
4277           lib="$destdir/$realname"
4278           eval cmds=\"$postinstall_cmds\"
4279           save_ifs="$IFS"; IFS='~'
4280           for cmd in $cmds; do
4281             IFS="$save_ifs"
4282             $show "$cmd"
4283             $run eval "$cmd" || exit $?
4284           done
4285           IFS="$save_ifs"
4286         fi
4287
4288         # Install the pseudo-library for information purposes.
4289         name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
4290         instname="$dir/$name"i
4291         $show "$install_prog $instname $destdir/$name"
4292         $run eval "$install_prog $instname $destdir/$name" || exit $?
4293
4294         # Maybe install the static library, too.
4295         test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library"
4296         ;;
4297
4298       *.lo)
4299         # Install (i.e. copy) a libtool object.
4300
4301         # Figure out destination file name, if it wasn't already specified.
4302         if test -n "$destname"; then
4303           destfile="$destdir/$destname"
4304         else
4305           destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
4306           destfile="$destdir/$destfile"
4307         fi
4308
4309         # Deduce the name of the destination old-style object file.
4310         case $destfile in
4311         *.lo)
4312           staticdest=`$echo "X$destfile" | $Xsed -e "$lo2o"`
4313           ;;
4314         *.$objext)
4315           staticdest="$destfile"
4316           destfile=
4317           ;;
4318         *)
4319           $echo "$modename: cannot copy a libtool object to \`$destfile'" 1>&2
4320           $echo "$help" 1>&2
4321           exit 1
4322           ;;
4323         esac
4324
4325         # Install the libtool object if requested.
4326         if test -n "$destfile"; then
4327           $show "$install_prog $file $destfile"
4328           $run eval "$install_prog $file $destfile" || exit $?
4329         fi
4330
4331         # Install the old object if enabled.
4332         if test "$build_old_libs" = yes; then
4333           # Deduce the name of the old-style object file.
4334           staticobj=`$echo "X$file" | $Xsed -e "$lo2o"`
4335
4336           $show "$install_prog $staticobj $staticdest"
4337           $run eval "$install_prog \$staticobj \$staticdest" || exit $?
4338         fi
4339         exit 0
4340         ;;
4341
4342       *)
4343         # Figure out destination file name, if it wasn't already specified.
4344         if test -n "$destname"; then
4345           destfile="$destdir/$destname"
4346         else
4347           destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
4348           destfile="$destdir/$destfile"
4349         fi
4350
4351         # Do a test to see if this is really a libtool program.
4352         if (sed -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
4353           notinst_deplibs=
4354           relink_command=
4355
4356           # If there is no directory component, then add one.
4357           case $file in
4358           */* | *\\*) . $file ;;
4359           *) . ./$file ;;
4360           esac
4361
4362           # Check the variables that should have been set.
4363           if test -z "$notinst_deplibs"; then
4364             $echo "$modename: invalid libtool wrapper script \`$file'" 1>&2
4365             exit 1
4366           fi
4367
4368           finalize=yes
4369           for lib in $notinst_deplibs; do
4370             # Check to see that each library is installed.
4371             libdir=
4372             if test -f "$lib"; then
4373               # If there is no directory component, then add one.
4374               case $lib in
4375               */* | *\\*) . $lib ;;
4376               *) . ./$lib ;;
4377               esac
4378             fi
4379             libfile="$libdir/"`$echo "X$lib" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test
4380             if test -n "$libdir" && test ! -f "$libfile"; then
4381               $echo "$modename: warning: \`$lib' has not been installed in \`$libdir'" 1>&2
4382               finalize=no
4383             fi
4384           done
4385
4386           relink_command=
4387           # If there is no directory component, then add one.
4388           case $file in
4389           */* | *\\*) . $file ;;
4390           *) . ./$file ;;
4391           esac
4392
4393           outputname=
4394           if test "$fast_install" = no && test -n "$relink_command"; then
4395             if test "$finalize" = yes && test -z "$run"; then
4396               tmpdir="/tmp"
4397               test -n "$TMPDIR" && tmpdir="$TMPDIR"
4398               tmpdir=`mktemp -d $tmpdir/libtool-XXXXXX 2> /dev/null`
4399               if test $? = 0 ; then :
4400               else
4401                 tmpdir="$tmpdir/libtool-$$"
4402               fi
4403               if $mkdir -p "$tmpdir" && chmod 700 "$tmpdir"; then :
4404               else
4405                 $echo "$modename: error: cannot create temporary directory \`$tmpdir'" 1>&2
4406                 continue
4407               fi
4408               file=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
4409               outputname="$tmpdir/$file"
4410               # Replace the output file specification.
4411               relink_command=`$echo "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'`
4412
4413               $show "$relink_command"
4414               if $run eval "$relink_command"; then :
4415               else
4416                 $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
4417                 ${rm}r "$tmpdir"
4418                 continue
4419               fi
4420               file="$outputname"
4421             else
4422               $echo "$modename: warning: cannot relink \`$file'" 1>&2
4423             fi
4424           else
4425             # Install the binary that we compiled earlier.
4426             file=`$echo "X$file" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"`
4427           fi
4428         fi
4429
4430         # remove .exe since cygwin /usr/bin/install will append another
4431         # one anyways
4432         case $install_prog,$host in
4433         /usr/bin/install*,*cygwin*)
4434           case $file:$destfile in
4435           *.exe:*.exe)
4436             # this is ok
4437             ;;
4438           *.exe:*)
4439             destfile=$destfile.exe
4440             ;;
4441           *:*.exe)
4442             destfile=`echo $destfile | sed -e 's,.exe$,,'`
4443             ;;
4444           esac
4445           ;;
4446         esac
4447         $show "$install_prog$stripme $file $destfile"
4448         $run eval "$install_prog\$stripme \$file \$destfile" || exit $?
4449         test -n "$outputname" && ${rm}r "$tmpdir"
4450         ;;
4451       esac
4452     done
4453
4454     for file in $staticlibs; do
4455       name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
4456
4457       # Set up the ranlib parameters.
4458       oldlib="$destdir/$name"
4459
4460       $show "$install_prog $file $oldlib"
4461       $run eval "$install_prog \$file \$oldlib" || exit $?
4462
4463       if test -n "$stripme" && test -n "$striplib"; then
4464         $show "$old_striplib $oldlib"
4465         $run eval "$old_striplib $oldlib" || exit $?
4466       fi
4467
4468       # Do each command in the postinstall commands.
4469       eval cmds=\"$old_postinstall_cmds\"
4470       save_ifs="$IFS"; IFS='~'
4471       for cmd in $cmds; do
4472         IFS="$save_ifs"
4473         $show "$cmd"
4474         $run eval "$cmd" || exit $?
4475       done
4476       IFS="$save_ifs"
4477     done
4478
4479     if test -n "$future_libdirs"; then
4480       $echo "$modename: warning: remember to run \`$progname --finish$future_libdirs'" 1>&2
4481     fi
4482
4483     if test -n "$current_libdirs"; then
4484       # Maybe just do a dry run.
4485       test -n "$run" && current_libdirs=" -n$current_libdirs"
4486       exec_cmd='$SHELL $0 --finish$current_libdirs'
4487     else
4488       exit 0
4489     fi
4490     ;;
4491
4492   # libtool finish mode
4493   finish)
4494     modename="$modename: finish"
4495     libdirs="$nonopt"
4496     admincmds=
4497
4498     if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
4499       for dir
4500       do
4501         libdirs="$libdirs $dir"
4502       done
4503
4504       for libdir in $libdirs; do
4505         if test -n "$finish_cmds"; then
4506           # Do each command in the finish commands.
4507           eval cmds=\"$finish_cmds\"
4508           save_ifs="$IFS"; IFS='~'
4509           for cmd in $cmds; do
4510             IFS="$save_ifs"
4511             $show "$cmd"
4512             $run eval "$cmd" || admincmds="$admincmds
4513        $cmd"
4514           done
4515           IFS="$save_ifs"
4516         fi
4517         if test -n "$finish_eval"; then
4518           # Do the single finish_eval.
4519           eval cmds=\"$finish_eval\"
4520           $run eval "$cmds" || admincmds="$admincmds
4521        $cmds"
4522         fi
4523       done
4524     fi
4525
4526     # Exit here if they wanted silent mode.
4527     test "$show" = : && exit 0
4528
4529     echo "----------------------------------------------------------------------"
4530     echo "Libraries have been installed in:"
4531     for libdir in $libdirs; do
4532       echo "   $libdir"
4533     done
4534     echo
4535     echo "If you ever happen to want to link against installed libraries"
4536     echo "in a given directory, LIBDIR, you must either use libtool, and"
4537     echo "specify the full pathname of the library, or use the \`-LLIBDIR'"
4538     echo "flag during linking and do at least one of the following:"
4539     if test -n "$shlibpath_var"; then
4540       echo "   - add LIBDIR to the \`$shlibpath_var' environment variable"
4541       echo "     during execution"
4542     fi
4543     if test -n "$runpath_var"; then
4544       echo "   - add LIBDIR to the \`$runpath_var' environment variable"
4545       echo "     during linking"
4546     fi
4547     if test -n "$hardcode_libdir_flag_spec"; then
4548       libdir=LIBDIR
4549       eval flag=\"$hardcode_libdir_flag_spec\"
4550
4551       echo "   - use the \`$flag' linker flag"
4552     fi
4553     if test -n "$admincmds"; then
4554       echo "   - have your system administrator run these commands:$admincmds"
4555     fi
4556     if test -f /etc/ld.so.conf; then
4557       echo "   - have your system administrator add LIBDIR to \`/etc/ld.so.conf'"
4558     fi
4559     echo
4560     echo "See any operating system documentation about shared libraries for"
4561     echo "more information, such as the ld(1) and ld.so(8) manual pages."
4562     echo "----------------------------------------------------------------------"
4563     exit 0
4564     ;;
4565
4566   # libtool execute mode
4567   execute)
4568     modename="$modename: execute"
4569
4570     # The first argument is the command name.
4571     cmd="$nonopt"
4572     if test -z "$cmd"; then
4573       $echo "$modename: you must specify a COMMAND" 1>&2
4574       $echo "$help"
4575       exit 1
4576     fi
4577
4578     # Handle -dlopen flags immediately.
4579     for file in $execute_dlfiles; do
4580       if test ! -f "$file"; then
4581         $echo "$modename: \`$file' is not a file" 1>&2
4582         $echo "$help" 1>&2
4583         exit 1
4584       fi
4585
4586       dir=
4587       case $file in
4588       *.la)
4589         # Check to see that this really is a libtool archive.
4590         if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
4591         else
4592           $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
4593           $echo "$help" 1>&2
4594           exit 1
4595         fi
4596
4597         # Read the libtool library.
4598         dlname=
4599         library_names=
4600
4601         # If there is no directory component, then add one.
4602         case $file in
4603         */* | *\\*) . $file ;;
4604         *) . ./$file ;;
4605         esac
4606
4607         # Skip this library if it cannot be dlopened.
4608         if test -z "$dlname"; then
4609           # Warn if it was a shared library.
4610           test -n "$library_names" && $echo "$modename: warning: \`$file' was not linked with \`-export-dynamic'"
4611           continue
4612         fi
4613
4614         dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
4615         test "X$dir" = "X$file" && dir=.
4616
4617         if test -f "$dir/$objdir/$dlname"; then
4618           dir="$dir/$objdir"
4619         else
4620           $echo "$modename: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2
4621           exit 1
4622         fi
4623         ;;
4624
4625       *.lo)
4626         # Just add the directory containing the .lo file.
4627         dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
4628         test "X$dir" = "X$file" && dir=.
4629         ;;
4630
4631       *)
4632         $echo "$modename: warning \`-dlopen' is ignored for non-libtool libraries and objects" 1>&2
4633         continue
4634         ;;
4635       esac
4636
4637       # Get the absolute pathname.
4638       absdir=`cd "$dir" && pwd`
4639       test -n "$absdir" && dir="$absdir"
4640
4641       # Now add the directory to shlibpath_var.
4642       if eval "test -z \"\$$shlibpath_var\""; then
4643         eval "$shlibpath_var=\"\$dir\""
4644       else
4645         eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\""
4646       fi
4647     done
4648
4649     # This variable tells wrapper scripts just to set shlibpath_var
4650     # rather than running their programs.
4651     libtool_execute_magic="$magic"
4652
4653     # Check if any of the arguments is a wrapper script.
4654     args=
4655     for file
4656     do
4657       case $file in
4658       -*) ;;
4659       *)
4660         # Do a test to see if this is really a libtool program.
4661         if (sed -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
4662           # If there is no directory component, then add one.
4663           case $file in
4664           */* | *\\*) . $file ;;
4665           *) . ./$file ;;
4666           esac
4667
4668           # Transform arg to wrapped name.
4669           file="$progdir/$program"
4670         fi
4671         ;;
4672       esac
4673       # Quote arguments (to preserve shell metacharacters).
4674       file=`$echo "X$file" | $Xsed -e "$sed_quote_subst"`
4675       args="$args \"$file\""
4676     done
4677
4678     if test -z "$run"; then
4679       if test -n "$shlibpath_var"; then
4680         # Export the shlibpath_var.
4681         eval "export $shlibpath_var"
4682       fi
4683
4684       # Restore saved enviroment variables
4685       if test "${save_LC_ALL+set}" = set; then
4686         LC_ALL="$save_LC_ALL"; export LC_ALL
4687       fi
4688       if test "${save_LANG+set}" = set; then
4689         LANG="$save_LANG"; export LANG
4690       fi
4691
4692       # Now prepare to actually exec the command.
4693       exec_cmd="\$cmd$args"
4694     else
4695       # Display what would be done.
4696       if test -n "$shlibpath_var"; then
4697         eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\""
4698         $echo "export $shlibpath_var"
4699       fi
4700       $echo "$cmd$args"
4701       exit 0
4702     fi
4703     ;;
4704
4705   # libtool clean and uninstall mode
4706   clean | uninstall)
4707     modename="$modename: $mode"
4708     rm="$nonopt"
4709     files=
4710     rmforce=
4711     exit_status=0
4712
4713     # This variable tells wrapper scripts just to set variables rather
4714     # than running their programs.
4715     libtool_install_magic="$magic"
4716
4717     for arg
4718     do
4719       case $arg in
4720       -f) rm="$rm $arg"; rmforce=yes ;;
4721       -*) rm="$rm $arg" ;;
4722       *) files="$files $arg" ;;
4723       esac
4724     done
4725
4726     if test -z "$rm"; then
4727       $echo "$modename: you must specify an RM program" 1>&2
4728       $echo "$help" 1>&2
4729       exit 1
4730     fi
4731
4732     rmdirs=
4733
4734     for file in $files; do
4735       dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
4736       if test "X$dir" = "X$file"; then
4737         dir=.
4738         objdir="$objdir"
4739       else
4740         objdir="$dir/$objdir"
4741       fi
4742       name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
4743       test "$mode" = uninstall && objdir="$dir"
4744
4745       # Remember objdir for removal later, being careful to avoid duplicates
4746       if test "$mode" = clean; then
4747         case " $rmdirs " in
4748           *" $objdir "*) ;;
4749           *) rmdirs="$rmdirs $objdir" ;;
4750         esac
4751       fi
4752
4753       # Don't error if the file doesn't exist and rm -f was used.
4754       if (test -L "$file") >/dev/null 2>&1 \
4755         || (test -h "$file") >/dev/null 2>&1 \
4756         || test -f "$file"; then
4757         :
4758       elif test -d "$file"; then
4759         exit_status=1
4760         continue
4761       elif test "$rmforce" = yes; then
4762         continue
4763       fi
4764
4765       rmfiles="$file"
4766
4767       case $name in
4768       *.la)
4769         # Possibly a libtool archive, so verify it.
4770         if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
4771           . $dir/$name
4772
4773           # Delete the libtool libraries and symlinks.
4774           for n in $library_names; do
4775             rmfiles="$rmfiles $objdir/$n"
4776           done
4777           test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library"
4778           test "$mode" = clean && rmfiles="$rmfiles $objdir/$name $objdir/${name}i"
4779
4780           if test "$mode" = uninstall; then
4781             if test -n "$library_names"; then
4782               # Do each command in the postuninstall commands.
4783               eval cmds=\"$postuninstall_cmds\"
4784               save_ifs="$IFS"; IFS='~'
4785               for cmd in $cmds; do
4786                 IFS="$save_ifs"
4787                 $show "$cmd"
4788                 $run eval "$cmd"
4789                 if test "$?" -ne 0 && test "$rmforce" != yes; then
4790                   exit_status=1
4791                 fi
4792               done
4793               IFS="$save_ifs"
4794             fi
4795
4796             if test -n "$old_library"; then
4797               # Do each command in the old_postuninstall commands.
4798               eval cmds=\"$old_postuninstall_cmds\"
4799               save_ifs="$IFS"; IFS='~'
4800               for cmd in $cmds; do
4801                 IFS="$save_ifs"
4802                 $show "$cmd"
4803                 $run eval "$cmd"
4804                 if test "$?" -ne 0 && test "$rmforce" != yes; then
4805                   exit_status=1
4806                 fi
4807               done
4808               IFS="$save_ifs"
4809             fi
4810             # FIXME: should reinstall the best remaining shared library.
4811           fi
4812         fi
4813         ;;
4814
4815       *.lo)
4816         if test "$build_old_libs" = yes; then
4817           oldobj=`$echo "X$name" | $Xsed -e "$lo2o"`
4818           rmfiles="$rmfiles $dir/$oldobj"
4819         fi
4820         ;;
4821
4822       *)
4823         # Do a test to see if this is a libtool program.
4824         if test "$mode" = clean &&
4825            (sed -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
4826           relink_command=
4827           . $dir/$file
4828
4829           rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}"
4830           if test "$fast_install" = yes && test -n "$relink_command"; then
4831             rmfiles="$rmfiles $objdir/lt-$name"
4832           fi
4833         fi
4834         ;;
4835       esac
4836       $show "$rm $rmfiles"
4837       $run $rm $rmfiles || exit_status=1
4838     done
4839
4840     # Try to remove the ${objdir}s in the directories where we deleted files
4841     for dir in $rmdirs; do
4842       if test -d "$dir"; then
4843         $show "rmdir $dir"
4844         $run rmdir $dir >/dev/null 2>&1
4845       fi
4846     done
4847
4848     exit $exit_status
4849     ;;
4850
4851   "")
4852     $echo "$modename: you must specify a MODE" 1>&2
4853     $echo "$generic_help" 1>&2
4854     exit 1
4855     ;;
4856   esac
4857
4858   if test -z "$exec_cmd"; then
4859     $echo "$modename: invalid operation mode \`$mode'" 1>&2
4860     $echo "$generic_help" 1>&2
4861     exit 1
4862   fi
4863 fi # test -z "$show_help"
4864
4865 if test -n "$exec_cmd"; then
4866   eval exec $exec_cmd
4867   exit 1
4868 fi
4869
4870 # We need to display help for each of the modes.
4871 case $mode in
4872 "") $echo \
4873 "Usage: $modename [OPTION]... [MODE-ARG]...
4874
4875 Provide generalized library-building support services.
4876
4877     --config          show all configuration variables
4878     --debug           enable verbose shell tracing
4879 -n, --dry-run         display commands without modifying any files
4880     --features        display basic configuration information and exit
4881     --finish          same as \`--mode=finish'
4882     --help            display this help message and exit
4883     --mode=MODE       use operation mode MODE [default=inferred from MODE-ARGS]
4884     --quiet           same as \`--silent'
4885     --silent          don't print informational messages
4886     --version         print version information
4887
4888 MODE must be one of the following:
4889
4890       clean           remove files from the build directory
4891       compile         compile a source file into a libtool object
4892       execute         automatically set library path, then run a program
4893       finish          complete the installation of libtool libraries
4894       install         install libraries or executables
4895       link            create a library or an executable
4896       uninstall       remove libraries from an installed directory
4897
4898 MODE-ARGS vary depending on the MODE.  Try \`$modename --help --mode=MODE' for
4899 a more detailed description of MODE."
4900   exit 0
4901   ;;
4902
4903 clean)
4904   $echo \
4905 "Usage: $modename [OPTION]... --mode=clean RM [RM-OPTION]... FILE...
4906
4907 Remove files from the build directory.
4908
4909 RM is the name of the program to use to delete files associated with each FILE
4910 (typically \`/bin/rm').  RM-OPTIONS are options (such as \`-f') to be passed
4911 to RM.
4912
4913 If FILE is a libtool library, object or program, all the files associated
4914 with it are deleted. Otherwise, only FILE itself is deleted using RM."
4915   ;;
4916
4917 compile)
4918   $echo \
4919 "Usage: $modename [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE
4920
4921 Compile a source file into a libtool library object.
4922
4923 This mode accepts the following additional options:
4924
4925   -o OUTPUT-FILE    set the output file name to OUTPUT-FILE
4926   -prefer-pic       try to building PIC objects only
4927   -prefer-non-pic   try to building non-PIC objects only
4928   -static           always build a \`.o' file suitable for static linking
4929
4930 COMPILE-COMMAND is a command to be used in creating a \`standard' object file
4931 from the given SOURCEFILE.
4932
4933 The output file name is determined by removing the directory component from
4934 SOURCEFILE, then substituting the C source code suffix \`.c' with the
4935 library object suffix, \`.lo'."
4936   ;;
4937
4938 execute)
4939   $echo \
4940 "Usage: $modename [OPTION]... --mode=execute COMMAND [ARGS]...
4941
4942 Automatically set library path, then run a program.
4943
4944 This mode accepts the following additional options:
4945
4946   -dlopen FILE      add the directory containing FILE to the library path
4947
4948 This mode sets the library path environment variable according to \`-dlopen'
4949 flags.
4950
4951 If any of the ARGS are libtool executable wrappers, then they are translated
4952 into their corresponding uninstalled binary, and any of their required library
4953 directories are added to the library path.
4954
4955 Then, COMMAND is executed, with ARGS as arguments."
4956   ;;
4957
4958 finish)
4959   $echo \
4960 "Usage: $modename [OPTION]... --mode=finish [LIBDIR]...
4961
4962 Complete the installation of libtool libraries.
4963
4964 Each LIBDIR is a directory that contains libtool libraries.
4965
4966 The commands that this mode executes may require superuser privileges.  Use
4967 the \`--dry-run' option if you just want to see what would be executed."
4968   ;;
4969
4970 install)
4971   $echo \
4972 "Usage: $modename [OPTION]... --mode=install INSTALL-COMMAND...
4973
4974 Install executables or libraries.
4975
4976 INSTALL-COMMAND is the installation command.  The first component should be
4977 either the \`install' or \`cp' program.
4978
4979 The rest of the components are interpreted as arguments to that command (only
4980 BSD-compatible install options are recognized)."
4981   ;;
4982
4983 link)
4984   $echo \
4985 "Usage: $modename [OPTION]... --mode=link LINK-COMMAND...
4986
4987 Link object files or libraries together to form another library, or to
4988 create an executable program.
4989
4990 LINK-COMMAND is a command using the C compiler that you would use to create
4991 a program from several object files.
4992
4993 The following components of LINK-COMMAND are treated specially:
4994
4995   -all-static       do not do any dynamic linking at all
4996   -avoid-version    do not add a version suffix if possible
4997   -dlopen FILE      \`-dlpreopen' FILE if it cannot be dlopened at runtime
4998   -dlpreopen FILE   link in FILE and add its symbols to lt_preloaded_symbols
4999   -export-dynamic   allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
5000   -export-symbols SYMFILE
5001                     try to export only the symbols listed in SYMFILE
5002   -export-symbols-regex REGEX
5003                     try to export only the symbols matching REGEX
5004   -LLIBDIR          search LIBDIR for required installed libraries
5005   -lNAME            OUTPUT-FILE requires the installed library libNAME
5006   -module           build a library that can dlopened
5007   -no-fast-install  disable the fast-install mode
5008   -no-install       link a not-installable executable
5009   -no-undefined     declare that a library does not refer to external symbols
5010   -o OUTPUT-FILE    create OUTPUT-FILE from the specified objects
5011   -release RELEASE  specify package release information
5012   -rpath LIBDIR     the created library will eventually be installed in LIBDIR
5013   -R[ ]LIBDIR       add LIBDIR to the runtime path of programs and libraries
5014   -static           do not do any dynamic linking of libtool libraries
5015   -version-info CURRENT[:REVISION[:AGE]]
5016                     specify library version info [each variable defaults to 0]
5017
5018 All other options (arguments beginning with \`-') are ignored.
5019
5020 Every other argument is treated as a filename.  Files ending in \`.la' are
5021 treated as uninstalled libtool libraries, other files are standard or library
5022 object files.
5023
5024 If the OUTPUT-FILE ends in \`.la', then a libtool library is created,
5025 only library objects (\`.lo' files) may be specified, and \`-rpath' is
5026 required, except when creating a convenience library.
5027
5028 If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created
5029 using \`ar' and \`ranlib', or on Windows using \`lib'.
5030
5031 If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file
5032 is created, otherwise an executable program is created."
5033   ;;
5034
5035 uninstall)
5036   $echo \
5037 "Usage: $modename [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE...
5038
5039 Remove libraries from an installation directory.
5040
5041 RM is the name of the program to use to delete files associated with each FILE
5042 (typically \`/bin/rm').  RM-OPTIONS are options (such as \`-f') to be passed
5043 to RM.
5044
5045 If FILE is a libtool library, all the files associated with it are deleted.
5046 Otherwise, only FILE itself is deleted using RM."
5047   ;;
5048
5049 *)
5050   $echo "$modename: invalid operation mode \`$mode'" 1>&2
5051   $echo "$help" 1>&2
5052   exit 1
5053   ;;
5054 esac
5055
5056 echo
5057 $echo "Try \`$modename --help' for more information about other modes."
5058
5059 exit 0
5060
5061 # Local Variables:
5062 # mode:shell-script
5063 # sh-indentation:2
5064 # End: