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