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