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