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