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