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