Logo AND Algorithmique Numérique Distribuée

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