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