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