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