OSDN Git Service

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