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