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