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