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