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