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