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