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