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
27basename="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.
34progpath="$0"
35
36# The name of this program:
37progname=`echo "$progpath" | $SED $basename`
38modename="$progname"
39
40# Global variables:
41EXIT_SUCCESS=0
42EXIT_FAILURE=1
43
44PROGRAM=ltmain.sh
45PACKAGE=libtool
46VERSION=1.5.26
47TIMESTAMP=" (1.1220.2.492 2008/01/30 06:40:56)"
48
49# Be Bourne compatible (taken from Autoconf:_AS_BOURNE_COMPATIBLE).
50if 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
57else
58  case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac
59fi
60BIN_SH=xpg4; export BIN_SH # for Tru64
61DUALCASE=1; export DUALCASE # for MKS sh
62
63# Check that we have a working $echo.
64if test "X$1" = X--no-reexec; then
65  # Discard the --no-reexec flag, and continue.
66  shift
67elif test "X$1" = X--fallback-echo; then
68  # Avoid inline document here, it may be left over
69  :
70elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then
71  # Yippee, $echo works!
72  :
73else
74  # Restart under the correct shell, and then maybe $echo will work.
75  exec $SHELL "$progpath" --no-reexec ${1+"$@"}
76fi
77
78if test "X$1" = X--fallback-echo; then
79  # used as fallback echo
80  shift
81  cat <<EOF
82$*
83EOF
84  exit $EXIT_SUCCESS
85fi
86
87default_mode=
88help="Try \`$progname --help' for more information."
89magic="%%%MAGIC variable%%%"
90mkdir="mkdir"
91mv="mv -f"
92rm="rm -f"
93
94# Sed substitution that helps us do robust quoting.  It backslashifies
95# metacharacters that are still active within double-quoted strings.
96Xsed="${SED}"' -e 1s/^X//'
97sed_quote_subst='s/\([\\`\\"$\\\\]\)/\\\1/g'
98# test EBCDIC or ASCII
99case `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  ;;
109esac
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.
116lt_env=
117for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
118do
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"
125done
126
127if test -n "$lt_env"; then
128  lt_env="env $lt_env"
129fi
130
131# Make sure IFS has a sensible default
132lt_nl='
133'
134IFS=" 	$lt_nl"
135
136if 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
140fi
141
142# Global variables.
143mode=$default_mode
144nonopt=
145prev=
146prevopt=
147run=
148show="$echo"
149show_help=
150execute_dlfiles=
151duplicate_deps=no
152preserve_args=
153lo2o="s/\\.lo\$/.${objext}/"
154o2lo="s/\\.${objext}\$/.lo/"
155extracted_archives=
156extracted_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.
166func_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.
205func_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 ...'
251func_infer_tag ()
252{
253    if test -n "$available_tags" && test -z "$tagname"; then
254      CC_quoted=
255      for arg in $CC; do
256	case $arg in
257	  *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
258	  arg="\"$arg\""
259	  ;;
260	esac
261	CC_quoted="$CC_quoted $arg"
262      done
263      case $@ in
264      # Blanks in the command may have been stripped by the calling shell,
265      # but not from the CC environment variable when configure was run.
266      " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*) ;;
267      # Blanks at the start of $base_compile will cause this to fail
268      # if we don't check for them as well.
269      *)
270	for z in $available_tags; do
271	  if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then
272	    # Evaluate the configuration.
273	    eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`"
274	    CC_quoted=
275	    for arg in $CC; do
276	    # Double-quote args containing other shell metacharacters.
277	    case $arg in
278	      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
279	      arg="\"$arg\""
280	      ;;
281	    esac
282	    CC_quoted="$CC_quoted $arg"
283	  done
284	    case "$@ " in
285	      " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*)
286	      # The compiler in the base compile command matches
287	      # the one in the tagged configuration.
288	      # Assume this is the tagged configuration we want.
289	      tagname=$z
290	      break
291	      ;;
292	    esac
293	  fi
294	done
295	# If $tagname still isn't set, then no tagged configuration
296	# was found and let the user know that the "--tag" command
297	# line option must be used.
298	if test -z "$tagname"; then
299	  $echo "$modename: unable to infer tagged configuration"
300	  $echo "$modename: specify a tag with \`--tag'" 1>&2
301	  exit $EXIT_FAILURE
302#        else
303#          $echo "$modename: using $tagname tagged configuration"
304	fi
305	;;
306      esac
307    fi
308}
309
310
311# func_extract_an_archive dir oldlib
312func_extract_an_archive ()
313{
314    f_ex_an_ar_dir="$1"; shift
315    f_ex_an_ar_oldlib="$1"
316
317    $show "(cd $f_ex_an_ar_dir && $AR x $f_ex_an_ar_oldlib)"
318    $run eval "(cd \$f_ex_an_ar_dir && $AR x \$f_ex_an_ar_oldlib)" || exit $?
319    if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then
320     :
321    else
322      $echo "$modename: ERROR: object name conflicts: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib" 1>&2
323      exit $EXIT_FAILURE
324    fi
325}
326
327# func_extract_archives gentop oldlib ...
328func_extract_archives ()
329{
330    my_gentop="$1"; shift
331    my_oldlibs=${1+"$@"}
332    my_oldobjs=""
333    my_xlib=""
334    my_xabs=""
335    my_xdir=""
336    my_status=""
337
338    $show "${rm}r $my_gentop"
339    $run ${rm}r "$my_gentop"
340    $show "$mkdir $my_gentop"
341    $run $mkdir "$my_gentop"
342    my_status=$?
343    if test "$my_status" -ne 0 && test ! -d "$my_gentop"; then
344      exit $my_status
345    fi
346
347    for my_xlib in $my_oldlibs; do
348      # Extract the objects.
349      case $my_xlib in
350	[\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;;
351	*) my_xabs=`pwd`"/$my_xlib" ;;
352      esac
353      my_xlib=`$echo "X$my_xlib" | $Xsed -e 's%^.*/%%'`
354      my_xlib_u=$my_xlib
355      while :; do
356        case " $extracted_archives " in
357	*" $my_xlib_u "*)
358	  extracted_serial=`expr $extracted_serial + 1`
359	  my_xlib_u=lt$extracted_serial-$my_xlib ;;
360	*) break ;;
361	esac
362      done
363      extracted_archives="$extracted_archives $my_xlib_u"
364      my_xdir="$my_gentop/$my_xlib_u"
365
366      $show "${rm}r $my_xdir"
367      $run ${rm}r "$my_xdir"
368      $show "$mkdir $my_xdir"
369      $run $mkdir "$my_xdir"
370      exit_status=$?
371      if test "$exit_status" -ne 0 && test ! -d "$my_xdir"; then
372	exit $exit_status
373      fi
374      case $host in
375      *-darwin*)
376	$show "Extracting $my_xabs"
377	# Do not bother doing anything if just a dry run
378	if test -z "$run"; then
379	  darwin_orig_dir=`pwd`
380	  cd $my_xdir || exit $?
381	  darwin_archive=$my_xabs
382	  darwin_curdir=`pwd`
383	  darwin_base_archive=`$echo "X$darwin_archive" | $Xsed -e 's%^.*/%%'`
384	  darwin_arches=`lipo -info "$darwin_archive" 2>/dev/null | $EGREP Architectures 2>/dev/null`
385	  if test -n "$darwin_arches"; then 
386	    darwin_arches=`echo "$darwin_arches" | $SED -e 's/.*are://'`
387	    darwin_arch=
388	    $show "$darwin_base_archive has multiple architectures $darwin_arches"
389	    for darwin_arch in  $darwin_arches ; do
390	      mkdir -p "unfat-$$/${darwin_base_archive}-${darwin_arch}"
391	      lipo -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}"
392	      cd "unfat-$$/${darwin_base_archive}-${darwin_arch}"
393	      func_extract_an_archive "`pwd`" "${darwin_base_archive}"
394	      cd "$darwin_curdir"
395	      $rm "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}"
396	    done # $darwin_arches
397      ## Okay now we have a bunch of thin objects, gotta fatten them up :)
398	    darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print| xargs basename | sort -u | $NL2SP`
399	    darwin_file=
400	    darwin_files=
401	    for darwin_file in $darwin_filelist; do
402	      darwin_files=`find unfat-$$ -name $darwin_file -print | $NL2SP`
403	      lipo -create -output "$darwin_file" $darwin_files
404	    done # $darwin_filelist
405	    ${rm}r unfat-$$
406	    cd "$darwin_orig_dir"
407	  else
408	    cd "$darwin_orig_dir"
409 	    func_extract_an_archive "$my_xdir" "$my_xabs"
410	  fi # $darwin_arches
411	fi # $run
412	;;
413      *)
414        func_extract_an_archive "$my_xdir" "$my_xabs"
415        ;;
416      esac
417      my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP`
418    done
419    func_extract_archives_result="$my_oldobjs"
420}
421# End of Shell function definitions
422#####################################
423
424# Darwin sucks
425eval std_shrext=\"$shrext_cmds\"
426
427disable_libs=no
428
429# Parse our command line options once, thoroughly.
430while test "$#" -gt 0
431do
432  arg="$1"
433  shift
434
435  case $arg in
436  -*=*) optarg=`$echo "X$arg" | $Xsed -e 's/[-_a-zA-Z0-9]*=//'` ;;
437  *) optarg= ;;
438  esac
439
440  # If the previous option needs an argument, assign it.
441  if test -n "$prev"; then
442    case $prev in
443    execute_dlfiles)
444      execute_dlfiles="$execute_dlfiles $arg"
445      ;;
446    tag)
447      tagname="$arg"
448      preserve_args="${preserve_args}=$arg"
449
450      # Check whether tagname contains only valid characters
451      case $tagname in
452      *[!-_A-Za-z0-9,/]*)
453	$echo "$progname: invalid tag name: $tagname" 1>&2
454	exit $EXIT_FAILURE
455	;;
456      esac
457
458      case $tagname in
459      CC)
460	# Don't test for the "default" C tag, as we know, it's there, but
461	# not specially marked.
462	;;
463      *)
464	if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "$progpath" > /dev/null; then
465	  taglist="$taglist $tagname"
466	  # Evaluate the configuration.
467	  eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$tagname'$/,/^# ### END LIBTOOL TAG CONFIG: '$tagname'$/p' < $progpath`"
468	else
469	  $echo "$progname: ignoring unknown tag $tagname" 1>&2
470	fi
471	;;
472      esac
473      ;;
474    *)
475      eval "$prev=\$arg"
476      ;;
477    esac
478
479    prev=
480    prevopt=
481    continue
482  fi
483
484  # Have we seen a non-optional argument yet?
485  case $arg in
486  --help)
487    show_help=yes
488    ;;
489
490  --version)
491    echo "\
492$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP
493
494Copyright (C) 2008  Free Software Foundation, Inc.
495This is free software; see the source for copying conditions.  There is NO
496warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
497    exit $?
498    ;;
499
500  --config)
501    ${SED} -e '1,/^# ### BEGIN LIBTOOL CONFIG/d' -e '/^# ### END LIBTOOL CONFIG/,$d' $progpath
502    # Now print the configurations for the tags.
503    for tagname in $taglist; do
504      ${SED} -n -e "/^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$/,/^# ### END LIBTOOL TAG CONFIG: $tagname$/p" < "$progpath"
505    done
506    exit $?
507    ;;
508
509  --debug)
510    $echo "$progname: enabling shell trace mode"
511    set -x
512    preserve_args="$preserve_args $arg"
513    ;;
514
515  --dry-run | -n)
516    run=:
517    ;;
518
519  --features)
520    $echo "host: $host"
521    if test "$build_libtool_libs" = yes; then
522      $echo "enable shared libraries"
523    else
524      $echo "disable shared libraries"
525    fi
526    if test "$build_old_libs" = yes; then
527      $echo "enable static libraries"
528    else
529      $echo "disable static libraries"
530    fi
531    exit $?
532    ;;
533
534  --finish) mode="finish" ;;
535
536  --mode) prevopt="--mode" prev=mode ;;
537  --mode=*) mode="$optarg" ;;
538
539  --preserve-dup-deps) duplicate_deps="yes" ;;
540
541  --quiet | --silent)
542    show=:
543    preserve_args="$preserve_args $arg"
544    ;;
545
546  --tag)
547    prevopt="--tag"
548    prev=tag
549    preserve_args="$preserve_args --tag"
550    ;;
551  --tag=*)
552    set tag "$optarg" ${1+"$@"}
553    shift
554    prev=tag
555    preserve_args="$preserve_args --tag"
556    ;;
557
558  -dlopen)
559    prevopt="-dlopen"
560    prev=execute_dlfiles
561    ;;
562
563  -*)
564    $echo "$modename: unrecognized option \`$arg'" 1>&2
565    $echo "$help" 1>&2
566    exit $EXIT_FAILURE
567    ;;
568
569  *)
570    nonopt="$arg"
571    break
572    ;;
573  esac
574done
575
576if test -n "$prevopt"; then
577  $echo "$modename: option \`$prevopt' requires an argument" 1>&2
578  $echo "$help" 1>&2
579  exit $EXIT_FAILURE
580fi
581
582case $disable_libs in
583no) 
584  ;;
585shared)
586  build_libtool_libs=no
587  build_old_libs=yes
588  ;;
589static)
590  build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac`
591  ;;
592esac
593
594# If this variable is set in any of the actions, the command in it
595# will be execed at the end.  This prevents here-documents from being
596# left over by shells.
597exec_cmd=
598
599if test -z "$show_help"; then
600
601  # Infer the operation mode.
602  if test -z "$mode"; then
603    $echo "*** Warning: inferring the mode of operation is deprecated." 1>&2
604    $echo "*** Future versions of Libtool will require --mode=MODE be specified." 1>&2
605    case $nonopt in
606    *cc | cc* | *++ | gcc* | *-gcc* | g++* | xlc*)
607      mode=link
608      for arg
609      do
610	case $arg in
611	-c)
612	   mode=compile
613	   break
614	   ;;
615	esac
616      done
617      ;;
618    *db | *dbx | *strace | *truss)
619      mode=execute
620      ;;
621    *install*|cp|mv)
622      mode=install
623      ;;
624    *rm)
625      mode=uninstall
626      ;;
627    *)
628      # If we have no mode, but dlfiles were specified, then do execute mode.
629      test -n "$execute_dlfiles" && mode=execute
630
631      # Just use the default operation mode.
632      if test -z "$mode"; then
633	if test -n "$nonopt"; then
634	  $echo "$modename: warning: cannot infer operation mode from \`$nonopt'" 1>&2
635	else
636	  $echo "$modename: warning: cannot infer operation mode without MODE-ARGS" 1>&2
637	fi
638      fi
639      ;;
640    esac
641  fi
642
643  # Only execute mode is allowed to have -dlopen flags.
644  if test -n "$execute_dlfiles" && test "$mode" != execute; then
645    $echo "$modename: unrecognized option \`-dlopen'" 1>&2
646    $echo "$help" 1>&2
647    exit $EXIT_FAILURE
648  fi
649
650  # Change the help message to a mode-specific one.
651  generic_help="$help"
652  help="Try \`$modename --help --mode=$mode' for more information."
653
654  # These modes are in order of execution frequency so that they run quickly.
655  case $mode in
656  # libtool compile mode
657  compile)
658    modename="$modename: compile"
659    # Get the compilation command and the source file.
660    base_compile=
661    srcfile="$nonopt"  #  always keep a non-empty value in "srcfile"
662    suppress_opt=yes
663    suppress_output=
664    arg_mode=normal
665    libobj=
666    later=
667
668    for arg
669    do
670      case $arg_mode in
671      arg  )
672	# do not "continue".  Instead, add this to base_compile
673	lastarg="$arg"
674	arg_mode=normal
675	;;
676
677      target )
678	libobj="$arg"
679	arg_mode=normal
680	continue
681	;;
682
683      normal )
684	# Accept any command-line options.
685	case $arg in
686	-o)
687	  if test -n "$libobj" ; then
688	    $echo "$modename: you cannot specify \`-o' more than once" 1>&2
689	    exit $EXIT_FAILURE
690	  fi
691	  arg_mode=target
692	  continue
693	  ;;
694
695	-static | -prefer-pic | -prefer-non-pic)
696	  later="$later $arg"
697	  continue
698	  ;;
699
700	-no-suppress)
701	  suppress_opt=no
702	  continue
703	  ;;
704
705	-Xcompiler)
706	  arg_mode=arg  #  the next one goes into the "base_compile" arg list
707	  continue      #  The current "srcfile" will either be retained or
708	  ;;            #  replaced later.  I would guess that would be a bug.
709
710	-Wc,*)
711	  args=`$echo "X$arg" | $Xsed -e "s/^-Wc,//"`
712	  lastarg=
713	  save_ifs="$IFS"; IFS=','
714 	  for arg in $args; do
715	    IFS="$save_ifs"
716
717	    # Double-quote args containing other shell metacharacters.
718	    # Many Bourne shells cannot handle close brackets correctly
719	    # in scan sets, so we specify it separately.
720	    case $arg in
721	      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
722	      arg="\"$arg\""
723	      ;;
724	    esac
725	    lastarg="$lastarg $arg"
726	  done
727	  IFS="$save_ifs"
728	  lastarg=`$echo "X$lastarg" | $Xsed -e "s/^ //"`
729
730	  # Add the arguments to base_compile.
731	  base_compile="$base_compile $lastarg"
732	  continue
733	  ;;
734
735	* )
736	  # Accept the current argument as the source file.
737	  # The previous "srcfile" becomes the current argument.
738	  #
739	  lastarg="$srcfile"
740	  srcfile="$arg"
741	  ;;
742	esac  #  case $arg
743	;;
744      esac    #  case $arg_mode
745
746      # Aesthetically quote the previous argument.
747      lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"`
748
749      case $lastarg in
750      # Double-quote args containing other shell metacharacters.
751      # Many Bourne shells cannot handle close brackets correctly
752      # in scan sets, and some SunOS ksh mistreat backslash-escaping
753      # in scan sets (worked around with variable expansion),
754      # and furthermore cannot handle '|' '&' '(' ')' in scan sets 
755      # at all, so we specify them separately.
756      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
757	lastarg="\"$lastarg\""
758	;;
759      esac
760
761      base_compile="$base_compile $lastarg"
762    done # for arg
763
764    case $arg_mode in
765    arg)
766      $echo "$modename: you must specify an argument for -Xcompile"
767      exit $EXIT_FAILURE
768      ;;
769    target)
770      $echo "$modename: you must specify a target with \`-o'" 1>&2
771      exit $EXIT_FAILURE
772      ;;
773    *)
774      # Get the name of the library object.
775      [ -z "$libobj" ] && libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'`
776      ;;
777    esac
778
779    # Recognize several different file suffixes.
780    # If the user specifies -o file.o, it is replaced with file.lo
781    xform='[cCFSifmso]'
782    case $libobj in
783    *.ada) xform=ada ;;
784    *.adb) xform=adb ;;
785    *.ads) xform=ads ;;
786    *.asm) xform=asm ;;
787    *.c++) xform=c++ ;;
788    *.cc) xform=cc ;;
789    *.ii) xform=ii ;;
790    *.class) xform=class ;;
791    *.cpp) xform=cpp ;;
792    *.cxx) xform=cxx ;;
793    *.[fF][09]?) xform=[fF][09]. ;;
794    *.for) xform=for ;;
795    *.java) xform=java ;;
796    *.obj) xform=obj ;;
797    *.sx) xform=sx ;;
798    esac
799
800    libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"`
801
802    case $libobj in
803    *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;;
804    *)
805      $echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2
806      exit $EXIT_FAILURE
807      ;;
808    esac
809
810    func_infer_tag $base_compile
811
812    for arg in $later; do
813      case $arg in
814      -static)
815	build_old_libs=yes
816	continue
817	;;
818
819      -prefer-pic)
820	pic_mode=yes
821	continue
822	;;
823
824      -prefer-non-pic)
825	pic_mode=no
826	continue
827	;;
828      esac
829    done
830
831    qlibobj=`$echo "X$libobj" | $Xsed -e "$sed_quote_subst"`
832    case $qlibobj in
833      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
834	qlibobj="\"$qlibobj\"" ;;
835    esac
836    test "X$libobj" != "X$qlibobj" \
837	&& $echo "X$libobj" | grep '[]~#^*{};<>?"'"'"' 	&()|`$[]' \
838	&& $echo "$modename: libobj name \`$libobj' may not contain shell special characters."
839    objname=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
840    xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'`
841    if test "X$xdir" = "X$obj"; then
842      xdir=
843    else
844      xdir=$xdir/
845    fi
846    lobj=${xdir}$objdir/$objname
847
848    if test -z "$base_compile"; then
849      $echo "$modename: you must specify a compilation command" 1>&2
850      $echo "$help" 1>&2
851      exit $EXIT_FAILURE
852    fi
853
854    # Delete any leftover library objects.
855    if test "$build_old_libs" = yes; then
856      removelist="$obj $lobj $libobj ${libobj}T"
857    else
858      removelist="$lobj $libobj ${libobj}T"
859    fi
860
861    $run $rm $removelist
862    trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15
863
864    # On Cygwin there's no "real" PIC flag so we must build both object types
865    case $host_os in
866    cygwin* | mingw* | pw32* | os2*)
867      pic_mode=default
868      ;;
869    esac
870    if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then
871      # non-PIC code in shared libraries is not supported
872      pic_mode=default
873    fi
874
875    # Calculate the filename of the output object if compiler does
876    # not support -o with -c
877    if test "$compiler_c_o" = no; then
878      output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext}
879      lockfile="$output_obj.lock"
880      removelist="$removelist $output_obj $lockfile"
881      trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15
882    else
883      output_obj=
884      need_locks=no
885      lockfile=
886    fi
887
888    # Lock this critical section if it is needed
889    # We use this script file to make the link, it avoids creating a new file
890    if test "$need_locks" = yes; then
891      until $run ln "$progpath" "$lockfile" 2>/dev/null; do
892	$show "Waiting for $lockfile to be removed"
893	sleep 2
894      done
895    elif test "$need_locks" = warn; then
896      if test -f "$lockfile"; then
897	$echo "\
898*** ERROR, $lockfile exists and contains:
899`cat $lockfile 2>/dev/null`
900
901This indicates that another process is trying to use the same
902temporary object file, and libtool could not work around it because
903your compiler does not support \`-c' and \`-o' together.  If you
904repeat this compilation, it may succeed, by chance, but you had better
905avoid parallel builds (make -j) in this platform, or get a better
906compiler."
907
908	$run $rm $removelist
909	exit $EXIT_FAILURE
910      fi
911      $echo "$srcfile" > "$lockfile"
912    fi
913
914    if test -n "$fix_srcfile_path"; then
915      eval srcfile=\"$fix_srcfile_path\"
916    fi
917    qsrcfile=`$echo "X$srcfile" | $Xsed -e "$sed_quote_subst"`
918    case $qsrcfile in
919      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
920      qsrcfile="\"$qsrcfile\"" ;;
921    esac
922
923    $run $rm "$libobj" "${libobj}T"
924
925    # Create a libtool object file (analogous to a ".la" file),
926    # but don't create it if we're doing a dry run.
927    test -z "$run" && cat > ${libobj}T <<EOF
928# $libobj - a libtool object file
929# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
930#
931# Please DO NOT delete this file!
932# It is necessary for linking the library.
933
934# Name of the PIC object.
935EOF
936
937    # Only build a PIC object if we are building libtool libraries.
938    if test "$build_libtool_libs" = yes; then
939      # Without this assignment, base_compile gets emptied.
940      fbsd_hideous_sh_bug=$base_compile
941
942      if test "$pic_mode" != no; then
943	command="$base_compile $qsrcfile $pic_flag"
944      else
945	# Don't build PIC code
946	command="$base_compile $qsrcfile"
947      fi
948
949      if test ! -d "${xdir}$objdir"; then
950	$show "$mkdir ${xdir}$objdir"
951	$run $mkdir ${xdir}$objdir
952	exit_status=$?
953	if test "$exit_status" -ne 0 && test ! -d "${xdir}$objdir"; then
954	  exit $exit_status
955	fi
956      fi
957
958      if test -z "$output_obj"; then
959	$run $rm "$lobj"
960	# Place PIC objects in $objdir
961	command="$command -o $lobj"
962      else
963	$run $rm "$lobj" "$output_obj"
964      fi
965
966      $show "$command"
967      if $run eval $lt_env "$command"; then :
968      else
969	test -n "$output_obj" && $run $rm $removelist
970	exit $EXIT_FAILURE
971      fi
972
973      if test "$need_locks" = warn &&
974	 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
975	$echo "\
976*** ERROR, $lockfile contains:
977`cat $lockfile 2>/dev/null`
978
979but it should contain:
980$srcfile
981
982This indicates that another process is trying to use the same
983temporary object file, and libtool could not work around it because
984your compiler does not support \`-c' and \`-o' together.  If you
985repeat this compilation, it may succeed, by chance, but you had better
986avoid parallel builds (make -j) in this platform, or get a better
987compiler."
988
989	$run $rm $removelist
990	exit $EXIT_FAILURE
991      fi
992
993      # Just move the object if needed, then go on to compile the next one
994      if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then
995	$show "$mv $output_obj $lobj"
996	if $run $mv $output_obj $lobj; then :
997	else
998	  error=$?
999	  $run $rm $removelist
1000	  exit $error
1001	fi
1002      fi
1003
1004      # Append the name of the PIC object to the libtool object file.
1005      test -z "$run" && cat >> ${libobj}T <<EOF
1006pic_object='$objdir/$objname'
1007
1008EOF
1009
1010      # Allow error messages only from the first compilation.
1011      if test "$suppress_opt" = yes; then
1012        suppress_output=' >/dev/null 2>&1'
1013      fi
1014    else
1015      # No PIC object so indicate it doesn't exist in the libtool
1016      # object file.
1017      test -z "$run" && cat >> ${libobj}T <<EOF
1018pic_object=none
1019
1020EOF
1021    fi
1022
1023    # Only build a position-dependent object if we build old libraries.
1024    if test "$build_old_libs" = yes; then
1025      if test "$pic_mode" != yes; then
1026	# Don't build PIC code
1027	command="$base_compile $qsrcfile"
1028      else
1029	command="$base_compile $qsrcfile $pic_flag"
1030      fi
1031      if test "$compiler_c_o" = yes; then
1032	command="$command -o $obj"
1033      fi
1034
1035      # Suppress compiler output if we already did a PIC compilation.
1036      command="$command$suppress_output"
1037      $run $rm "$obj" "$output_obj"
1038      $show "$command"
1039      if $run eval $lt_env "$command"; then :
1040      else
1041	$run $rm $removelist
1042	exit $EXIT_FAILURE
1043      fi
1044
1045      if test "$need_locks" = warn &&
1046	 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
1047	$echo "\
1048*** ERROR, $lockfile contains:
1049`cat $lockfile 2>/dev/null`
1050
1051but it should contain:
1052$srcfile
1053
1054This indicates that another process is trying to use the same
1055temporary object file, and libtool could not work around it because
1056your compiler does not support \`-c' and \`-o' together.  If you
1057repeat this compilation, it may succeed, by chance, but you had better
1058avoid parallel builds (make -j) in this platform, or get a better
1059compiler."
1060
1061	$run $rm $removelist
1062	exit $EXIT_FAILURE
1063      fi
1064
1065      # Just move the object if needed
1066      if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then
1067	$show "$mv $output_obj $obj"
1068	if $run $mv $output_obj $obj; then :
1069	else
1070	  error=$?
1071	  $run $rm $removelist
1072	  exit $error
1073	fi
1074      fi
1075
1076      # Append the name of the non-PIC object the libtool object file.
1077      # Only append if the libtool object file exists.
1078      test -z "$run" && cat >> ${libobj}T <<EOF
1079# Name of the non-PIC object.
1080non_pic_object='$objname'
1081
1082EOF
1083    else
1084      # Append the name of the non-PIC object the libtool object file.
1085      # Only append if the libtool object file exists.
1086      test -z "$run" && cat >> ${libobj}T <<EOF
1087# Name of the non-PIC object.
1088non_pic_object=none
1089
1090EOF
1091    fi
1092
1093    $run $mv "${libobj}T" "${libobj}"
1094
1095    # Unlock the critical section if it was locked
1096    if test "$need_locks" != no; then
1097      $run $rm "$lockfile"
1098    fi
1099
1100    exit $EXIT_SUCCESS
1101    ;;
1102
1103  # libtool link mode
1104  link | relink)
1105    modename="$modename: link"
1106    case $host in
1107    *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
1108      # It is impossible to link a dll without this setting, and
1109      # we shouldn't force the makefile maintainer to figure out
1110      # which system we are compiling for in order to pass an extra
1111      # flag for every libtool invocation.
1112      # allow_undefined=no
1113
1114      # FIXME: Unfortunately, there are problems with the above when trying
1115      # to make a dll which has undefined symbols, in which case not
1116      # even a static library is built.  For now, we need to specify
1117      # -no-undefined on the libtool link line when we can be certain
1118      # that all symbols are satisfied, otherwise we get a static library.
1119      allow_undefined=yes
1120      ;;
1121    *)
1122      allow_undefined=yes
1123      ;;
1124    esac
1125    libtool_args="$nonopt"
1126    base_compile="$nonopt $@"
1127    compile_command="$nonopt"
1128    finalize_command="$nonopt"
1129
1130    compile_rpath=
1131    finalize_rpath=
1132    compile_shlibpath=
1133    finalize_shlibpath=
1134    convenience=
1135    old_convenience=
1136    deplibs=
1137    old_deplibs=
1138    compiler_flags=
1139    linker_flags=
1140    dllsearchpath=
1141    lib_search_path=`pwd`
1142    inst_prefix_dir=
1143
1144    avoid_version=no
1145    dlfiles=
1146    dlprefiles=
1147    dlself=no
1148    export_dynamic=no
1149    export_symbols=
1150    export_symbols_regex=
1151    generated=
1152    libobjs=
1153    ltlibs=
1154    module=no
1155    no_install=no
1156    objs=
1157    non_pic_objects=
1158    notinst_path= # paths that contain not-installed libtool libraries
1159    precious_files_regex=
1160    prefer_static_libs=no
1161    preload=no
1162    prev=
1163    prevarg=
1164    release=
1165    rpath=
1166    xrpath=
1167    perm_rpath=
1168    temp_rpath=
1169    thread_safe=no
1170    vinfo=
1171    vinfo_number=no
1172    single_module="${wl}-single_module"
1173
1174    func_infer_tag $base_compile
1175
1176    # We need to know -static, to get the right output filenames.
1177    for arg
1178    do
1179      case $arg in
1180      -all-static | -static | -static-libtool-libs)
1181	case $arg in
1182	-all-static)
1183	  if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then
1184	    $echo "$modename: warning: complete static linking is impossible in this configuration" 1>&2
1185	  fi
1186	  if test -n "$link_static_flag"; then
1187	    dlopen_self=$dlopen_self_static
1188	  fi
1189	  prefer_static_libs=yes
1190	  ;;
1191	-static)
1192	  if test -z "$pic_flag" && test -n "$link_static_flag"; then
1193	    dlopen_self=$dlopen_self_static
1194	  fi
1195	  prefer_static_libs=built
1196	  ;;
1197	-static-libtool-libs)
1198	  if test -z "$pic_flag" && test -n "$link_static_flag"; then
1199	    dlopen_self=$dlopen_self_static
1200	  fi
1201	  prefer_static_libs=yes
1202	  ;;
1203	esac
1204	build_libtool_libs=no
1205	build_old_libs=yes
1206	break
1207	;;
1208      esac
1209    done
1210
1211    # See if our shared archives depend on static archives.
1212    test -n "$old_archive_from_new_cmds" && build_old_libs=yes
1213
1214    # Go through the arguments, transforming them on the way.
1215    while test "$#" -gt 0; do
1216      arg="$1"
1217      shift
1218      case $arg in
1219      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
1220	qarg=\"`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`\" ### testsuite: skip nested quoting test
1221	;;
1222      *) qarg=$arg ;;
1223      esac
1224      libtool_args="$libtool_args $qarg"
1225
1226      # If the previous option needs an argument, assign it.
1227      if test -n "$prev"; then
1228	case $prev in
1229	output)
1230	  compile_command="$compile_command @OUTPUT@"
1231	  finalize_command="$finalize_command @OUTPUT@"
1232	  ;;
1233	esac
1234
1235	case $prev in
1236	dlfiles|dlprefiles)
1237	  if test "$preload" = no; then
1238	    # Add the symbol object into the linking commands.
1239	    compile_command="$compile_command @SYMFILE@"
1240	    finalize_command="$finalize_command @SYMFILE@"
1241	    preload=yes
1242	  fi
1243	  case $arg in
1244	  *.la | *.lo) ;;  # We handle these cases below.
1245	  force)
1246	    if test "$dlself" = no; then
1247	      dlself=needless
1248	      export_dynamic=yes
1249	    fi
1250	    prev=
1251	    continue
1252	    ;;
1253	  self)
1254	    if test "$prev" = dlprefiles; then
1255	      dlself=yes
1256	    elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then
1257	      dlself=yes
1258	    else
1259	      dlself=needless
1260	      export_dynamic=yes
1261	    fi
1262	    prev=
1263	    continue
1264	    ;;
1265	  *)
1266	    if test "$prev" = dlfiles; then
1267	      dlfiles="$dlfiles $arg"
1268	    else
1269	      dlprefiles="$dlprefiles $arg"
1270	    fi
1271	    prev=
1272	    continue
1273	    ;;
1274	  esac
1275	  ;;
1276	expsyms)
1277	  export_symbols="$arg"
1278	  if test ! -f "$arg"; then
1279	    $echo "$modename: symbol file \`$arg' does not exist"
1280	    exit $EXIT_FAILURE
1281	  fi
1282	  prev=
1283	  continue
1284	  ;;
1285	expsyms_regex)
1286	  export_symbols_regex="$arg"
1287	  prev=
1288	  continue
1289	  ;;
1290	inst_prefix)
1291	  inst_prefix_dir="$arg"
1292	  prev=
1293	  continue
1294	  ;;
1295	precious_regex)
1296	  precious_files_regex="$arg"
1297	  prev=
1298	  continue
1299	  ;;
1300	release)
1301	  release="-$arg"
1302	  prev=
1303	  continue
1304	  ;;
1305	objectlist)
1306	  if test -f "$arg"; then
1307	    save_arg=$arg
1308	    moreargs=
1309	    for fil in `cat $save_arg`
1310	    do
1311#	      moreargs="$moreargs $fil"
1312	      arg=$fil
1313	      # A libtool-controlled object.
1314
1315	      # Check to see that this really is a libtool object.
1316	      if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
1317		pic_object=
1318		non_pic_object=
1319
1320		# Read the .lo file
1321		# If there is no directory component, then add one.
1322		case $arg in
1323		*/* | *\\*) . $arg ;;
1324		*) . ./$arg ;;
1325		esac
1326
1327		if test -z "$pic_object" || \
1328		   test -z "$non_pic_object" ||
1329		   test "$pic_object" = none && \
1330		   test "$non_pic_object" = none; then
1331		  $echo "$modename: cannot find name of object for \`$arg'" 1>&2
1332		  exit $EXIT_FAILURE
1333		fi
1334
1335		# Extract subdirectory from the argument.
1336		xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
1337		if test "X$xdir" = "X$arg"; then
1338		  xdir=
1339		else
1340		  xdir="$xdir/"
1341		fi
1342
1343		if test "$pic_object" != none; then
1344		  # Prepend the subdirectory the object is found in.
1345		  pic_object="$xdir$pic_object"
1346
1347		  if test "$prev" = dlfiles; then
1348		    if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
1349		      dlfiles="$dlfiles $pic_object"
1350		      prev=
1351		      continue
1352		    else
1353		      # If libtool objects are unsupported, then we need to preload.
1354		      prev=dlprefiles
1355		    fi
1356		  fi
1357
1358		  # CHECK ME:  I think I busted this.  -Ossama
1359		  if test "$prev" = dlprefiles; then
1360		    # Preload the old-style object.
1361		    dlprefiles="$dlprefiles $pic_object"
1362		    prev=
1363		  fi
1364
1365		  # A PIC object.
1366		  libobjs="$libobjs $pic_object"
1367		  arg="$pic_object"
1368		fi
1369
1370		# Non-PIC object.
1371		if test "$non_pic_object" != none; then
1372		  # Prepend the subdirectory the object is found in.
1373		  non_pic_object="$xdir$non_pic_object"
1374
1375		  # A standard non-PIC object
1376		  non_pic_objects="$non_pic_objects $non_pic_object"
1377		  if test -z "$pic_object" || test "$pic_object" = none ; then
1378		    arg="$non_pic_object"
1379		  fi
1380		else
1381		  # If the PIC object exists, use it instead.
1382		  # $xdir was prepended to $pic_object above.
1383		  non_pic_object="$pic_object"
1384		  non_pic_objects="$non_pic_objects $non_pic_object"
1385		fi
1386	      else
1387		# Only an error if not doing a dry-run.
1388		if test -z "$run"; then
1389		  $echo "$modename: \`$arg' is not a valid libtool object" 1>&2
1390		  exit $EXIT_FAILURE
1391		else
1392		  # Dry-run case.
1393
1394		  # Extract subdirectory from the argument.
1395		  xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
1396		  if test "X$xdir" = "X$arg"; then
1397		    xdir=
1398		  else
1399		    xdir="$xdir/"
1400		  fi
1401
1402		  pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"`
1403		  non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"`
1404		  libobjs="$libobjs $pic_object"
1405		  non_pic_objects="$non_pic_objects $non_pic_object"
1406		fi
1407	      fi
1408	    done
1409	  else
1410	    $echo "$modename: link input file \`$save_arg' does not exist"
1411	    exit $EXIT_FAILURE
1412	  fi
1413	  arg=$save_arg
1414	  prev=
1415	  continue
1416	  ;;
1417	rpath | xrpath)
1418	  # We need an absolute path.
1419	  case $arg in
1420	  [\\/]* | [A-Za-z]:[\\/]*) ;;
1421	  *)
1422	    $echo "$modename: only absolute run-paths are allowed" 1>&2
1423	    exit $EXIT_FAILURE
1424	    ;;
1425	  esac
1426	  if test "$prev" = rpath; then
1427	    case "$rpath " in
1428	    *" $arg "*) ;;
1429	    *) rpath="$rpath $arg" ;;
1430	    esac
1431	  else
1432	    case "$xrpath " in
1433	    *" $arg "*) ;;
1434	    *) xrpath="$xrpath $arg" ;;
1435	    esac
1436	  fi
1437	  prev=
1438	  continue
1439	  ;;
1440	xcompiler)
1441	  compiler_flags="$compiler_flags $qarg"
1442	  prev=
1443	  compile_command="$compile_command $qarg"
1444	  finalize_command="$finalize_command $qarg"
1445	  continue
1446	  ;;
1447	xlinker)
1448	  linker_flags="$linker_flags $qarg"
1449	  compiler_flags="$compiler_flags $wl$qarg"
1450	  prev=
1451	  compile_command="$compile_command $wl$qarg"
1452	  finalize_command="$finalize_command $wl$qarg"
1453	  continue
1454	  ;;
1455	xcclinker)
1456	  linker_flags="$linker_flags $qarg"
1457	  compiler_flags="$compiler_flags $qarg"
1458	  prev=
1459	  compile_command="$compile_command $qarg"
1460	  finalize_command="$finalize_command $qarg"
1461	  continue
1462	  ;;
1463	shrext)
1464  	  shrext_cmds="$arg"
1465	  prev=
1466	  continue
1467	  ;;
1468	darwin_framework|darwin_framework_skip)
1469	  test "$prev" = "darwin_framework" && compiler_flags="$compiler_flags $arg"
1470	  compile_command="$compile_command $arg"
1471	  finalize_command="$finalize_command $arg"
1472	  prev=
1473	  continue
1474	  ;;
1475	*)
1476	  eval "$prev=\"\$arg\""
1477	  prev=
1478	  continue
1479	  ;;
1480	esac
1481      fi # test -n "$prev"
1482
1483      prevarg="$arg"
1484
1485      case $arg in
1486      -all-static)
1487	if test -n "$link_static_flag"; then
1488	  compile_command="$compile_command $link_static_flag"
1489	  finalize_command="$finalize_command $link_static_flag"
1490	fi
1491	continue
1492	;;
1493
1494      -allow-undefined)
1495	# FIXME: remove this flag sometime in the future.
1496	$echo "$modename: \`-allow-undefined' is deprecated because it is the default" 1>&2
1497	continue
1498	;;
1499
1500      -avoid-version)
1501	avoid_version=yes
1502	continue
1503	;;
1504
1505      -dlopen)
1506	prev=dlfiles
1507	continue
1508	;;
1509
1510      -dlpreopen)
1511	prev=dlprefiles
1512	continue
1513	;;
1514
1515      -export-dynamic)
1516	export_dynamic=yes
1517	continue
1518	;;
1519
1520      -export-symbols | -export-symbols-regex)
1521	if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
1522	  $echo "$modename: more than one -exported-symbols argument is not allowed"
1523	  exit $EXIT_FAILURE
1524	fi
1525	if test "X$arg" = "X-export-symbols"; then
1526	  prev=expsyms
1527	else
1528	  prev=expsyms_regex
1529	fi
1530	continue
1531	;;
1532
1533      -framework|-arch|-isysroot)
1534	case " $CC " in
1535	  *" ${arg} ${1} "* | *" ${arg}	${1} "*) 
1536		prev=darwin_framework_skip ;;
1537	  *) compiler_flags="$compiler_flags $arg"
1538	     prev=darwin_framework ;;
1539	esac
1540	compile_command="$compile_command $arg"
1541	finalize_command="$finalize_command $arg"
1542	continue
1543	;;
1544
1545      -inst-prefix-dir)
1546	prev=inst_prefix
1547	continue
1548	;;
1549
1550      # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:*
1551      # so, if we see these flags be careful not to treat them like -L
1552      -L[A-Z][A-Z]*:*)
1553	case $with_gcc/$host in
1554	no/*-*-irix* | /*-*-irix*)
1555	  compile_command="$compile_command $arg"
1556	  finalize_command="$finalize_command $arg"
1557	  ;;
1558	esac
1559	continue
1560	;;
1561
1562      -L*)
1563	dir=`$echo "X$arg" | $Xsed -e 's/^-L//'`
1564	# We need an absolute path.
1565	case $dir in
1566	[\\/]* | [A-Za-z]:[\\/]*) ;;
1567	*)
1568	  absdir=`cd "$dir" && pwd`
1569	  if test -z "$absdir"; then
1570	    $echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2
1571	    absdir="$dir"
1572	    notinst_path="$notinst_path $dir"
1573	  fi
1574	  dir="$absdir"
1575	  ;;
1576	esac
1577	case "$deplibs " in
1578	*" -L$dir "*) ;;
1579	*)
1580	  deplibs="$deplibs -L$dir"
1581	  lib_search_path="$lib_search_path $dir"
1582	  ;;
1583	esac
1584	case $host in
1585	*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
1586	  testbindir=`$echo "X$dir" | $Xsed -e 's*/lib$*/bin*'`
1587	  case :$dllsearchpath: in
1588	  *":$dir:"*) ;;
1589	  *) dllsearchpath="$dllsearchpath:$dir";;
1590	  esac
1591	  case :$dllsearchpath: in
1592	  *":$testbindir:"*) ;;
1593	  *) dllsearchpath="$dllsearchpath:$testbindir";;
1594	  esac
1595	  ;;
1596	esac
1597	continue
1598	;;
1599
1600      -l*)
1601	if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then
1602	  case $host in
1603	  *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos*)
1604	    # These systems don't actually have a C or math library (as such)
1605	    continue
1606	    ;;
1607	  *-*-os2*)
1608	    # These systems don't actually have a C library (as such)
1609	    test "X$arg" = "X-lc" && continue
1610	    ;;
1611	  *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
1612	    # Do not include libc due to us having libc/libc_r.
1613	    test "X$arg" = "X-lc" && continue
1614	    ;;
1615	  *-*-rhapsody* | *-*-darwin1.[012])
1616	    # Rhapsody C and math libraries are in the System framework
1617	    deplibs="$deplibs -framework System"
1618	    continue
1619	    ;;
1620	  *-*-sco3.2v5* | *-*-sco5v6*)
1621	    # Causes problems with __ctype
1622	    test "X$arg" = "X-lc" && continue
1623	    ;;
1624	  *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
1625	    # Compiler inserts libc in the correct place for threads to work
1626	    test "X$arg" = "X-lc" && continue
1627	    ;;
1628	  esac
1629	elif test "X$arg" = "X-lc_r"; then
1630	 case $host in
1631	 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
1632	   # Do not include libc_r directly, use -pthread flag.
1633	   continue
1634	   ;;
1635	 esac
1636	fi
1637	deplibs="$deplibs $arg"
1638	continue
1639	;;
1640
1641      # Tru64 UNIX uses -model [arg] to determine the layout of C++
1642      # classes, name mangling, and exception handling.
1643      -model)
1644	compile_command="$compile_command $arg"
1645	compiler_flags="$compiler_flags $arg"
1646	finalize_command="$finalize_command $arg"
1647	prev=xcompiler
1648	continue
1649	;;
1650
1651     -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads)
1652	compiler_flags="$compiler_flags $arg"
1653	compile_command="$compile_command $arg"
1654	finalize_command="$finalize_command $arg"
1655	continue
1656	;;
1657
1658      -multi_module)
1659	single_module="${wl}-multi_module"
1660	continue
1661	;;
1662
1663      -module)
1664	module=yes
1665	continue
1666	;;
1667
1668      # -64, -mips[0-9] enable 64-bit mode on the SGI compiler
1669      # -r[0-9][0-9]* specifies the processor on the SGI compiler
1670      # -xarch=*, -xtarget=* enable 64-bit mode on the Sun compiler
1671      # +DA*, +DD* enable 64-bit mode on the HP compiler
1672      # -q* pass through compiler args for the IBM compiler
1673      # -m* pass through architecture-specific compiler args for GCC
1674      # -m*, -t[45]*, -txscale* pass through architecture-specific
1675      # compiler args for GCC
1676      # -p, -pg, --coverage, -fprofile-* pass through profiling flag for GCC
1677      # -F/path gives path to uninstalled frameworks, gcc on darwin
1678      # @file GCC response files
1679      -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \
1680      -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*)
1681
1682	# Unknown arguments in both finalize_command and compile_command need
1683	# to be aesthetically quoted because they are evaled later.
1684	arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
1685	case $arg in
1686	*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
1687	  arg="\"$arg\""
1688	  ;;
1689	esac
1690        compile_command="$compile_command $arg"
1691        finalize_command="$finalize_command $arg"
1692        compiler_flags="$compiler_flags $arg"
1693        continue
1694        ;;
1695
1696      -shrext)
1697	prev=shrext
1698	continue
1699	;;
1700
1701      -no-fast-install)
1702	fast_install=no
1703	continue
1704	;;
1705
1706      -no-install)
1707	case $host in
1708	*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin*)
1709	  # The PATH hackery in wrapper scripts is required on Windows
1710	  # and Darwin in order for the loader to find any dlls it needs.
1711	  $echo "$modename: warning: \`-no-install' is ignored for $host" 1>&2
1712	  $echo "$modename: warning: assuming \`-no-fast-install' instead" 1>&2
1713	  fast_install=no
1714	  ;;
1715	*) no_install=yes ;;
1716	esac
1717	continue
1718	;;
1719
1720      -no-undefined)
1721	allow_undefined=no
1722	continue
1723	;;
1724
1725      -objectlist)
1726	prev=objectlist
1727	continue
1728	;;
1729
1730      -o) prev=output ;;
1731
1732      -precious-files-regex)
1733	prev=precious_regex
1734	continue
1735	;;
1736
1737      -release)
1738	prev=release
1739	continue
1740	;;
1741
1742      -rpath)
1743	prev=rpath
1744	continue
1745	;;
1746
1747      -R)
1748	prev=xrpath
1749	continue
1750	;;
1751
1752      -R*)
1753	dir=`$echo "X$arg" | $Xsed -e 's/^-R//'`
1754	# We need an absolute path.
1755	case $dir in
1756	[\\/]* | [A-Za-z]:[\\/]*) ;;
1757	*)
1758	  $echo "$modename: only absolute run-paths are allowed" 1>&2
1759	  exit $EXIT_FAILURE
1760	  ;;
1761	esac
1762	case "$xrpath " in
1763	*" $dir "*) ;;
1764	*) xrpath="$xrpath $dir" ;;
1765	esac
1766	continue
1767	;;
1768
1769      -static | -static-libtool-libs)
1770	# The effects of -static are defined in a previous loop.
1771	# We used to do the same as -all-static on platforms that
1772	# didn't have a PIC flag, but the assumption that the effects
1773	# would be equivalent was wrong.  It would break on at least
1774	# Digital Unix and AIX.
1775	continue
1776	;;
1777
1778      -thread-safe)
1779	thread_safe=yes
1780	continue
1781	;;
1782
1783      -version-info)
1784	prev=vinfo
1785	continue
1786	;;
1787      -version-number)
1788	prev=vinfo
1789	vinfo_number=yes
1790	continue
1791	;;
1792
1793      -Wc,*)
1794	args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wc,//'`
1795	arg=
1796	save_ifs="$IFS"; IFS=','
1797	for flag in $args; do
1798	  IFS="$save_ifs"
1799	  case $flag in
1800	    *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
1801	    flag="\"$flag\""
1802	    ;;
1803	  esac
1804	  arg="$arg $wl$flag"
1805	  compiler_flags="$compiler_flags $flag"
1806	done
1807	IFS="$save_ifs"
1808	arg=`$echo "X$arg" | $Xsed -e "s/^ //"`
1809	;;
1810
1811      -Wl,*)
1812	args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wl,//'`
1813	arg=
1814	save_ifs="$IFS"; IFS=','
1815	for flag in $args; do
1816	  IFS="$save_ifs"
1817	  case $flag in
1818	    *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
1819	    flag="\"$flag\""
1820	    ;;
1821	  esac
1822	  arg="$arg $wl$flag"
1823	  compiler_flags="$compiler_flags $wl$flag"
1824	  linker_flags="$linker_flags $flag"
1825	done
1826	IFS="$save_ifs"
1827	arg=`$echo "X$arg" | $Xsed -e "s/^ //"`
1828	;;
1829
1830      -Xcompiler)
1831	prev=xcompiler
1832	continue
1833	;;
1834
1835      -Xlinker)
1836	prev=xlinker
1837	continue
1838	;;
1839
1840      -XCClinker)
1841	prev=xcclinker
1842	continue
1843	;;
1844
1845      # Some other compiler flag.
1846      -* | +*)
1847	# Unknown arguments in both finalize_command and compile_command need
1848	# to be aesthetically quoted because they are evaled later.
1849	arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
1850	case $arg in
1851	*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
1852	  arg="\"$arg\""
1853	  ;;
1854	esac
1855	;;
1856
1857      *.$objext)
1858	# A standard object.
1859	objs="$objs $arg"
1860	;;
1861
1862      *.lo)
1863	# A libtool-controlled object.
1864
1865	# Check to see that this really is a libtool object.
1866	if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
1867	  pic_object=
1868	  non_pic_object=
1869
1870	  # Read the .lo file
1871	  # If there is no directory component, then add one.
1872	  case $arg in
1873	  */* | *\\*) . $arg ;;
1874	  *) . ./$arg ;;
1875	  esac
1876
1877	  if test -z "$pic_object" || \
1878	     test -z "$non_pic_object" ||
1879	     test "$pic_object" = none && \
1880	     test "$non_pic_object" = none; then
1881	    $echo "$modename: cannot find name of object for \`$arg'" 1>&2
1882	    exit $EXIT_FAILURE
1883	  fi
1884
1885	  # Extract subdirectory from the argument.
1886	  xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
1887	  if test "X$xdir" = "X$arg"; then
1888	    xdir=
1889 	  else
1890	    xdir="$xdir/"
1891	  fi
1892
1893	  if test "$pic_object" != none; then
1894	    # Prepend the subdirectory the object is found in.
1895	    pic_object="$xdir$pic_object"
1896
1897	    if test "$prev" = dlfiles; then
1898	      if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
1899		dlfiles="$dlfiles $pic_object"
1900		prev=
1901		continue
1902	      else
1903		# If libtool objects are unsupported, then we need to preload.
1904		prev=dlprefiles
1905	      fi
1906	    fi
1907
1908	    # CHECK ME:  I think I busted this.  -Ossama
1909	    if test "$prev" = dlprefiles; then
1910	      # Preload the old-style object.
1911	      dlprefiles="$dlprefiles $pic_object"
1912	      prev=
1913	    fi
1914
1915	    # A PIC object.
1916	    libobjs="$libobjs $pic_object"
1917	    arg="$pic_object"
1918	  fi
1919
1920	  # Non-PIC object.
1921	  if test "$non_pic_object" != none; then
1922	    # Prepend the subdirectory the object is found in.
1923	    non_pic_object="$xdir$non_pic_object"
1924
1925	    # A standard non-PIC object
1926	    non_pic_objects="$non_pic_objects $non_pic_object"
1927	    if test -z "$pic_object" || test "$pic_object" = none ; then
1928	      arg="$non_pic_object"
1929	    fi
1930	  else
1931	    # If the PIC object exists, use it instead.
1932	    # $xdir was prepended to $pic_object above.
1933	    non_pic_object="$pic_object"
1934	    non_pic_objects="$non_pic_objects $non_pic_object"
1935	  fi
1936	else
1937	  # Only an error if not doing a dry-run.
1938	  if test -z "$run"; then
1939	    $echo "$modename: \`$arg' is not a valid libtool object" 1>&2
1940	    exit $EXIT_FAILURE
1941	  else
1942	    # Dry-run case.
1943
1944	    # Extract subdirectory from the argument.
1945	    xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
1946	    if test "X$xdir" = "X$arg"; then
1947	      xdir=
1948	    else
1949	      xdir="$xdir/"
1950	    fi
1951
1952	    pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"`
1953	    non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"`
1954	    libobjs="$libobjs $pic_object"
1955	    non_pic_objects="$non_pic_objects $non_pic_object"
1956	  fi
1957	fi
1958	;;
1959
1960      *.$libext)
1961	# An archive.
1962	deplibs="$deplibs $arg"
1963	old_deplibs="$old_deplibs $arg"
1964	continue
1965	;;
1966
1967      *.la)
1968	# A libtool-controlled library.
1969
1970	if test "$prev" = dlfiles; then
1971	  # This library was specified with -dlopen.
1972	  dlfiles="$dlfiles $arg"
1973	  prev=
1974	elif test "$prev" = dlprefiles; then
1975	  # The library was specified with -dlpreopen.
1976	  dlprefiles="$dlprefiles $arg"
1977	  prev=
1978	else
1979	  deplibs="$deplibs $arg"
1980	fi
1981	continue
1982	;;
1983
1984      # Some other compiler argument.
1985      *)
1986	# Unknown arguments in both finalize_command and compile_command need
1987	# to be aesthetically quoted because they are evaled later.
1988	arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
1989	case $arg in
1990	*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
1991	  arg="\"$arg\""
1992	  ;;
1993	esac
1994	;;
1995      esac # arg
1996
1997      # Now actually substitute the argument into the commands.
1998      if test -n "$arg"; then
1999	compile_command="$compile_command $arg"
2000	finalize_command="$finalize_command $arg"
2001      fi
2002    done # argument parsing loop
2003
2004    if test -n "$prev"; then
2005      $echo "$modename: the \`$prevarg' option requires an argument" 1>&2
2006      $echo "$help" 1>&2
2007      exit $EXIT_FAILURE
2008    fi
2009
2010    if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then
2011      eval arg=\"$export_dynamic_flag_spec\"
2012      compile_command="$compile_command $arg"
2013      finalize_command="$finalize_command $arg"
2014    fi
2015
2016    oldlibs=
2017    # calculate the name of the file, without its directory
2018    outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'`
2019    libobjs_save="$libobjs"
2020
2021    if test -n "$shlibpath_var"; then
2022      # get the directories listed in $shlibpath_var
2023      eval shlib_search_path=\`\$echo \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\`
2024    else
2025      shlib_search_path=
2026    fi
2027    eval sys_lib_search_path=\"$sys_lib_search_path_spec\"
2028    eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\"
2029
2030    output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'`
2031    if test "X$output_objdir" = "X$output"; then
2032      output_objdir="$objdir"
2033    else
2034      output_objdir="$output_objdir/$objdir"
2035    fi
2036    # Create the object directory.
2037    if test ! -d "$output_objdir"; then
2038      $show "$mkdir $output_objdir"
2039      $run $mkdir $output_objdir
2040      exit_status=$?
2041      if test "$exit_status" -ne 0 && test ! -d "$output_objdir"; then
2042	exit $exit_status
2043      fi
2044    fi
2045
2046    # Determine the type of output
2047    case $output in
2048    "")
2049      $echo "$modename: you must specify an output file" 1>&2
2050      $echo "$help" 1>&2
2051      exit $EXIT_FAILURE
2052      ;;
2053    *.$libext) linkmode=oldlib ;;
2054    *.lo | *.$objext) linkmode=obj ;;
2055    *.la) linkmode=lib ;;
2056    *) linkmode=prog ;; # Anything else should be a program.
2057    esac
2058
2059    case $host in
2060    *cygwin* | *mingw* | *pw32*)
2061      # don't eliminate duplications in $postdeps and $predeps
2062      duplicate_compiler_generated_deps=yes
2063      ;;
2064    *)
2065      duplicate_compiler_generated_deps=$duplicate_deps
2066      ;;
2067    esac
2068    specialdeplibs=
2069
2070    libs=
2071    # Find all interdependent deplibs by searching for libraries
2072    # that are linked more than once (e.g. -la -lb -la)
2073    for deplib in $deplibs; do
2074      if test "X$duplicate_deps" = "Xyes" ; then
2075	case "$libs " in
2076	*" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
2077	esac
2078      fi
2079      libs="$libs $deplib"
2080    done
2081
2082    if test "$linkmode" = lib; then
2083      libs="$predeps $libs $compiler_lib_search_path $postdeps"
2084
2085      # Compute libraries that are listed more than once in $predeps
2086      # $postdeps and mark them as special (i.e., whose duplicates are
2087      # not to be eliminated).
2088      pre_post_deps=
2089      if test "X$duplicate_compiler_generated_deps" = "Xyes" ; then
2090	for pre_post_dep in $predeps $postdeps; do
2091	  case "$pre_post_deps " in
2092	  *" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;;
2093	  esac
2094	  pre_post_deps="$pre_post_deps $pre_post_dep"
2095	done
2096      fi
2097      pre_post_deps=
2098    fi
2099
2100    deplibs=
2101    newdependency_libs=
2102    newlib_search_path=
2103    need_relink=no # whether we're linking any uninstalled libtool libraries
2104    notinst_deplibs= # not-installed libtool libraries
2105    case $linkmode in
2106    lib)
2107	passes="conv link"
2108	for file in $dlfiles $dlprefiles; do
2109	  case $file in
2110	  *.la) ;;
2111	  *)
2112	    $echo "$modename: libraries can \`-dlopen' only libtool libraries: $file" 1>&2
2113	    exit $EXIT_FAILURE
2114	    ;;
2115	  esac
2116	done
2117	;;
2118    prog)
2119	compile_deplibs=
2120	finalize_deplibs=
2121	alldeplibs=no
2122	newdlfiles=
2123	newdlprefiles=
2124	passes="conv scan dlopen dlpreopen link"
2125	;;
2126    *)  passes="conv"
2127	;;
2128    esac
2129    for pass in $passes; do
2130      if test "$linkmode,$pass" = "lib,link" ||
2131	 test "$linkmode,$pass" = "prog,scan"; then
2132	libs="$deplibs"
2133	deplibs=
2134      fi
2135      if test "$linkmode" = prog; then
2136	case $pass in
2137	dlopen) libs="$dlfiles" ;;
2138	dlpreopen) libs="$dlprefiles" ;;
2139	link) libs="$deplibs %DEPLIBS% $dependency_libs" ;;
2140	esac
2141      fi
2142      if test "$pass" = dlopen; then
2143	# Collect dlpreopened libraries
2144	save_deplibs="$deplibs"
2145	deplibs=
2146      fi
2147      for deplib in $libs; do
2148	lib=
2149	found=no
2150	case $deplib in
2151	-mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads)
2152	  if test "$linkmode,$pass" = "prog,link"; then
2153	    compile_deplibs="$deplib $compile_deplibs"
2154	    finalize_deplibs="$deplib $finalize_deplibs"
2155	  else
2156	    compiler_flags="$compiler_flags $deplib"
2157	  fi
2158	  continue
2159	  ;;
2160	-l*)
2161	  if test "$linkmode" != lib && test "$linkmode" != prog; then
2162	    $echo "$modename: warning: \`-l' is ignored for archives/objects" 1>&2
2163	    continue
2164	  fi
2165	  name=`$echo "X$deplib" | $Xsed -e 's/^-l//'`
2166	  if test "$linkmode" = lib; then
2167	    searchdirs="$newlib_search_path $lib_search_path $compiler_lib_search_dirs $sys_lib_search_path $shlib_search_path"
2168	  else
2169	    searchdirs="$newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path"
2170	  fi
2171	  for searchdir in $searchdirs; do
2172	    for search_ext in .la $std_shrext .so .a; do
2173	      # Search the libtool library
2174	      lib="$searchdir/lib${name}${search_ext}"
2175	      if test -f "$lib"; then
2176		if test "$search_ext" = ".la"; then
2177		  found=yes
2178		else
2179		  found=no
2180		fi
2181		break 2
2182	      fi
2183	    done
2184	  done
2185	  if test "$found" != yes; then
2186	    # deplib doesn't seem to be a libtool library
2187	    if test "$linkmode,$pass" = "prog,link"; then
2188	      compile_deplibs="$deplib $compile_deplibs"
2189	      finalize_deplibs="$deplib $finalize_deplibs"
2190	    else
2191	      deplibs="$deplib $deplibs"
2192	      test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
2193	    fi
2194	    continue
2195	  else # deplib is a libtool library
2196	    # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib,
2197	    # We need to do some special things here, and not later.
2198	    if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
2199	      case " $predeps $postdeps " in
2200	      *" $deplib "*)
2201		if (${SED} -e '2q' $lib |
2202                    grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
2203		  library_names=
2204		  old_library=
2205		  case $lib in
2206		  */* | *\\*) . $lib ;;
2207		  *) . ./$lib ;;
2208		  esac
2209		  for l in $old_library $library_names; do
2210		    ll="$l"
2211		  done
2212		  if test "X$ll" = "X$old_library" ; then # only static version available
2213		    found=no
2214		    ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'`
2215		    test "X$ladir" = "X$lib" && ladir="."
2216		    lib=$ladir/$old_library
2217		    if test "$linkmode,$pass" = "prog,link"; then
2218		      compile_deplibs="$deplib $compile_deplibs"
2219		      finalize_deplibs="$deplib $finalize_deplibs"
2220		    else
2221		      deplibs="$deplib $deplibs"
2222		      test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
2223		    fi
2224		    continue
2225		  fi
2226		fi
2227	        ;;
2228	      *) ;;
2229	      esac
2230	    fi
2231	  fi
2232	  ;; # -l
2233	-L*)
2234	  case $linkmode in
2235	  lib)
2236	    deplibs="$deplib $deplibs"
2237	    test "$pass" = conv && continue
2238	    newdependency_libs="$deplib $newdependency_libs"
2239	    newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
2240	    ;;
2241	  prog)
2242	    if test "$pass" = conv; then
2243	      deplibs="$deplib $deplibs"
2244	      continue
2245	    fi
2246	    if test "$pass" = scan; then
2247	      deplibs="$deplib $deplibs"
2248	    else
2249	      compile_deplibs="$deplib $compile_deplibs"
2250	      finalize_deplibs="$deplib $finalize_deplibs"
2251	    fi
2252	    newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
2253	    ;;
2254	  *)
2255	    $echo "$modename: warning: \`-L' is ignored for archives/objects" 1>&2
2256	    ;;
2257	  esac # linkmode
2258	  continue
2259	  ;; # -L
2260	-R*)
2261	  if test "$pass" = link; then
2262	    dir=`$echo "X$deplib" | $Xsed -e 's/^-R//'`
2263	    # Make sure the xrpath contains only unique directories.
2264	    case "$xrpath " in
2265	    *" $dir "*) ;;
2266	    *) xrpath="$xrpath $dir" ;;
2267	    esac
2268	  fi
2269	  deplibs="$deplib $deplibs"
2270	  continue
2271	  ;;
2272	*.la) lib="$deplib" ;;
2273	*.$libext)
2274	  if test "$pass" = conv; then
2275	    deplibs="$deplib $deplibs"
2276	    continue
2277	  fi
2278	  case $linkmode in
2279	  lib)
2280	    valid_a_lib=no
2281	    case $deplibs_check_method in
2282	      match_pattern*)
2283		set dummy $deplibs_check_method
2284	        match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
2285		if eval $echo \"$deplib\" 2>/dev/null \
2286		    | $SED 10q \
2287		    | $EGREP "$match_pattern_regex" > /dev/null; then
2288		  valid_a_lib=yes
2289		fi
2290		;;
2291	      pass_all)
2292		valid_a_lib=yes
2293		;;
2294            esac
2295	    if test "$valid_a_lib" != yes; then
2296	      $echo
2297	      $echo "*** Warning: Trying to link with static lib archive $deplib."
2298	      $echo "*** I have the capability to make that library automatically link in when"
2299	      $echo "*** you link to this library.  But I can only do this if you have a"
2300	      $echo "*** shared version of the library, which you do not appear to have"
2301	      $echo "*** because the file extensions .$libext of this argument makes me believe"
2302	      $echo "*** that it is just a static archive that I should not used here."
2303	    else
2304	      $echo
2305	      $echo "*** Warning: Linking the shared library $output against the"
2306	      $echo "*** static library $deplib is not portable!"
2307	      deplibs="$deplib $deplibs"
2308	    fi
2309	    continue
2310	    ;;
2311	  prog)
2312	    if test "$pass" != link; then
2313	      deplibs="$deplib $deplibs"
2314	    else
2315	      compile_deplibs="$deplib $compile_deplibs"
2316	      finalize_deplibs="$deplib $finalize_deplibs"
2317	    fi
2318	    continue
2319	    ;;
2320	  esac # linkmode
2321	  ;; # *.$libext
2322	*.lo | *.$objext)
2323	  if test "$pass" = conv; then
2324	    deplibs="$deplib $deplibs"
2325	  elif test "$linkmode" = prog; then
2326	    if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
2327	      # If there is no dlopen support or we're linking statically,
2328	      # we need to preload.
2329	      newdlprefiles="$newdlprefiles $deplib"
2330	      compile_deplibs="$deplib $compile_deplibs"
2331	      finalize_deplibs="$deplib $finalize_deplibs"
2332	    else
2333	      newdlfiles="$newdlfiles $deplib"
2334	    fi
2335	  fi
2336	  continue
2337	  ;;
2338	%DEPLIBS%)
2339	  alldeplibs=yes
2340	  continue
2341	  ;;
2342	esac # case $deplib
2343	if test "$found" = yes || test -f "$lib"; then :
2344	else
2345	  $echo "$modename: cannot find the library \`$lib' or unhandled argument \`$deplib'" 1>&2
2346	  exit $EXIT_FAILURE
2347	fi
2348
2349	# Check to see that this really is a libtool archive.
2350	if (${SED} -e '2q' $lib | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
2351	else
2352	  $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
2353	  exit $EXIT_FAILURE
2354	fi
2355
2356	ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'`
2357	test "X$ladir" = "X$lib" && ladir="."
2358
2359	dlname=
2360	dlopen=
2361	dlpreopen=
2362	libdir=
2363	library_names=
2364	old_library=
2365	# If the library was installed with an old release of libtool,
2366	# it will not redefine variables installed, or shouldnotlink
2367	installed=yes
2368	shouldnotlink=no
2369	avoidtemprpath=
2370
2371
2372	# Read the .la file
2373	case $lib in
2374	*/* | *\\*) . $lib ;;
2375	*) . ./$lib ;;
2376	esac
2377
2378	if test "$linkmode,$pass" = "lib,link" ||
2379	   test "$linkmode,$pass" = "prog,scan" ||
2380	   { test "$linkmode" != prog && test "$linkmode" != lib; }; then
2381	  test -n "$dlopen" && dlfiles="$dlfiles $dlopen"
2382	  test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen"
2383	fi
2384
2385	if test "$pass" = conv; then
2386	  # Only check for convenience libraries
2387	  deplibs="$lib $deplibs"
2388	  if test -z "$libdir"; then
2389	    if test -z "$old_library"; then
2390	      $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
2391	      exit $EXIT_FAILURE
2392	    fi
2393	    # It is a libtool convenience library, so add in its objects.
2394	    convenience="$convenience $ladir/$objdir/$old_library"
2395	    old_convenience="$old_convenience $ladir/$objdir/$old_library"
2396	    tmp_libs=
2397	    for deplib in $dependency_libs; do
2398	      deplibs="$deplib $deplibs"
2399              if test "X$duplicate_deps" = "Xyes" ; then
2400	        case "$tmp_libs " in
2401	        *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
2402	        esac
2403              fi
2404	      tmp_libs="$tmp_libs $deplib"
2405	    done
2406	  elif test "$linkmode" != prog && test "$linkmode" != lib; then
2407	    $echo "$modename: \`$lib' is not a convenience library" 1>&2
2408	    exit $EXIT_FAILURE
2409	  fi
2410	  continue
2411	fi # $pass = conv
2412
2413
2414	# Get the name of the library we link against.
2415	linklib=
2416	for l in $old_library $library_names; do
2417	  linklib="$l"
2418	done
2419	if test -z "$linklib"; then
2420	  $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
2421	  exit $EXIT_FAILURE
2422	fi
2423
2424	# This library was specified with -dlopen.
2425	if test "$pass" = dlopen; then
2426	  if test -z "$libdir"; then
2427	    $echo "$modename: cannot -dlopen a convenience library: \`$lib'" 1>&2
2428	    exit $EXIT_FAILURE
2429	  fi
2430	  if test -z "$dlname" ||
2431	     test "$dlopen_support" != yes ||
2432	     test "$build_libtool_libs" = no; then
2433	    # If there is no dlname, no dlopen support or we're linking
2434	    # statically, we need to preload.  We also need to preload any
2435	    # dependent libraries so libltdl's deplib preloader doesn't
2436	    # bomb out in the load deplibs phase.
2437	    dlprefiles="$dlprefiles $lib $dependency_libs"
2438	  else
2439	    newdlfiles="$newdlfiles $lib"
2440	  fi
2441	  continue
2442	fi # $pass = dlopen
2443
2444	# We need an absolute path.
2445	case $ladir in
2446	[\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;;
2447	*)
2448	  abs_ladir=`cd "$ladir" && pwd`
2449	  if test -z "$abs_ladir"; then
2450	    $echo "$modename: warning: cannot determine absolute directory name of \`$ladir'" 1>&2
2451	    $echo "$modename: passing it literally to the linker, although it might fail" 1>&2
2452	    abs_ladir="$ladir"
2453	  fi
2454	  ;;
2455	esac
2456	laname=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
2457
2458	# Find the relevant object directory and library name.
2459	if test "X$installed" = Xyes; then
2460	  if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then
2461	    $echo "$modename: warning: library \`$lib' was moved." 1>&2
2462	    dir="$ladir"
2463	    absdir="$abs_ladir"
2464	    libdir="$abs_ladir"
2465	  else
2466	    dir="$libdir"
2467	    absdir="$libdir"
2468	  fi
2469	  test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes
2470	else
2471	  if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then
2472	    dir="$ladir"
2473	    absdir="$abs_ladir"
2474	    # Remove this search path later
2475	    notinst_path="$notinst_path $abs_ladir"
2476	  else
2477	    dir="$ladir/$objdir"
2478	    absdir="$abs_ladir/$objdir"
2479	    # Remove this search path later
2480	    notinst_path="$notinst_path $abs_ladir"
2481	  fi
2482	fi # $installed = yes
2483	name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
2484
2485	# This library was specified with -dlpreopen.
2486	if test "$pass" = dlpreopen; then
2487	  if test -z "$libdir"; then
2488	    $echo "$modename: cannot -dlpreopen a convenience library: \`$lib'" 1>&2
2489	    exit $EXIT_FAILURE
2490	  fi
2491	  # Prefer using a static library (so that no silly _DYNAMIC symbols
2492	  # are required to link).
2493	  if test -n "$old_library"; then
2494	    newdlprefiles="$newdlprefiles $dir/$old_library"
2495	  # Otherwise, use the dlname, so that lt_dlopen finds it.
2496	  elif test -n "$dlname"; then
2497	    newdlprefiles="$newdlprefiles $dir/$dlname"
2498	  else
2499	    newdlprefiles="$newdlprefiles $dir/$linklib"
2500	  fi
2501	fi # $pass = dlpreopen
2502
2503	if test -z "$libdir"; then
2504	  # Link the convenience library
2505	  if test "$linkmode" = lib; then
2506	    deplibs="$dir/$old_library $deplibs"
2507	  elif test "$linkmode,$pass" = "prog,link"; then
2508	    compile_deplibs="$dir/$old_library $compile_deplibs"
2509	    finalize_deplibs="$dir/$old_library $finalize_deplibs"
2510	  else
2511	    deplibs="$lib $deplibs" # used for prog,scan pass
2512	  fi
2513	  continue
2514	fi
2515
2516
2517	if test "$linkmode" = prog && test "$pass" != link; then
2518	  newlib_search_path="$newlib_search_path $ladir"
2519	  deplibs="$lib $deplibs"
2520
2521	  linkalldeplibs=no
2522	  if test "$link_all_deplibs" != no || test -z "$library_names" ||
2523	     test "$build_libtool_libs" = no; then
2524	    linkalldeplibs=yes
2525	  fi
2526
2527	  tmp_libs=
2528	  for deplib in $dependency_libs; do
2529	    case $deplib in
2530	    -L*) newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`;; ### testsuite: skip nested quoting test
2531	    esac
2532	    # Need to link against all dependency_libs?
2533	    if test "$linkalldeplibs" = yes; then
2534	      deplibs="$deplib $deplibs"
2535	    else
2536	      # Need to hardcode shared library paths
2537	      # or/and link against static libraries
2538	      newdependency_libs="$deplib $newdependency_libs"
2539	    fi
2540	    if test "X$duplicate_deps" = "Xyes" ; then
2541	      case "$tmp_libs " in
2542	      *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
2543	      esac
2544	    fi
2545	    tmp_libs="$tmp_libs $deplib"
2546	  done # for deplib
2547	  continue
2548	fi # $linkmode = prog...
2549
2550	if test "$linkmode,$pass" = "prog,link"; then
2551	  if test -n "$library_names" &&
2552	     { { test "$prefer_static_libs" = no ||
2553		 test "$prefer_static_libs,$installed" = "built,yes"; } ||
2554	       test -z "$old_library"; }; then
2555	    # We need to hardcode the library path
2556	    if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then
2557	      # Make sure the rpath contains only unique directories.
2558	      case "$temp_rpath " in
2559	      *" $dir "*) ;;
2560	      *" $absdir "*) ;;
2561	      *) temp_rpath="$temp_rpath $absdir" ;;
2562	      esac
2563	    fi
2564
2565	    # Hardcode the library path.
2566	    # Skip directories that are in the system default run-time
2567	    # search path.
2568	    case " $sys_lib_dlsearch_path " in
2569	    *" $absdir "*) ;;
2570	    *)
2571	      case "$compile_rpath " in
2572	      *" $absdir "*) ;;
2573	      *) compile_rpath="$compile_rpath $absdir"
2574	      esac
2575	      ;;
2576	    esac
2577	    case " $sys_lib_dlsearch_path " in
2578	    *" $libdir "*) ;;
2579	    *)
2580	      case "$finalize_rpath " in
2581	      *" $libdir "*) ;;
2582	      *) finalize_rpath="$finalize_rpath $libdir"
2583	      esac
2584	      ;;
2585	    esac
2586	  fi # $linkmode,$pass = prog,link...
2587
2588	  if test "$alldeplibs" = yes &&
2589	     { test "$deplibs_check_method" = pass_all ||
2590	       { test "$build_libtool_libs" = yes &&
2591		 test -n "$library_names"; }; }; then
2592	    # We only need to search for static libraries
2593	    continue
2594	  fi
2595	fi
2596
2597	link_static=no # Whether the deplib will be linked statically
2598	use_static_libs=$prefer_static_libs
2599	if test "$use_static_libs" = built && test "$installed" = yes ; then
2600	  use_static_libs=no
2601	fi
2602	if test -n "$library_names" &&
2603	   { test "$use_static_libs" = no || test -z "$old_library"; }; then
2604	  if test "$installed" = no; then
2605	    notinst_deplibs="$notinst_deplibs $lib"
2606	    need_relink=yes
2607	  fi
2608	  # This is a shared library
2609
2610	  # Warn about portability, can't link against -module's on
2611	  # some systems (darwin)
2612	  if test "$shouldnotlink" = yes && test "$pass" = link ; then
2613	    $echo
2614	    if test "$linkmode" = prog; then
2615	      $echo "*** Warning: Linking the executable $output against the loadable module"
2616	    else
2617	      $echo "*** Warning: Linking the shared library $output against the loadable module"
2618	    fi
2619	    $echo "*** $linklib is not portable!"
2620	  fi
2621	  if test "$linkmode" = lib &&
2622	     test "$hardcode_into_libs" = yes; then
2623	    # Hardcode the library path.
2624	    # Skip directories that are in the system default run-time
2625	    # search path.
2626	    case " $sys_lib_dlsearch_path " in
2627	    *" $absdir "*) ;;
2628	    *)
2629	      case "$compile_rpath " in
2630	      *" $absdir "*) ;;
2631	      *) compile_rpath="$compile_rpath $absdir"
2632	      esac
2633	      ;;
2634	    esac
2635	    case " $sys_lib_dlsearch_path " in
2636	    *" $libdir "*) ;;
2637	    *)
2638	      case "$finalize_rpath " in
2639	      *" $libdir "*) ;;
2640	      *) finalize_rpath="$finalize_rpath $libdir"
2641	      esac
2642	      ;;
2643	    esac
2644	  fi
2645
2646	  if test -n "$old_archive_from_expsyms_cmds"; then
2647	    # figure out the soname
2648	    set dummy $library_names
2649	    realname="$2"
2650	    shift; shift
2651	    libname=`eval \\$echo \"$libname_spec\"`
2652	    # use dlname if we got it. it's perfectly good, no?
2653	    if test -n "$dlname"; then
2654	      soname="$dlname"
2655	    elif test -n "$soname_spec"; then
2656	      # bleh windows
2657	      case $host in
2658	      *cygwin* | mingw*)
2659		major=`expr $current - $age`
2660		versuffix="-$major"
2661		;;
2662	      esac
2663	      eval soname=\"$soname_spec\"
2664	    else
2665	      soname="$realname"
2666	    fi
2667
2668	    # Make a new name for the extract_expsyms_cmds to use
2669	    soroot="$soname"
2670	    soname=`$echo $soroot | ${SED} -e 's/^.*\///'`
2671	    newlib="libimp-`$echo $soname | ${SED} 's/^lib//;s/\.dll$//'`.a"
2672
2673	    # If the library has no export list, then create one now
2674	    if test -f "$output_objdir/$soname-def"; then :
2675	    else
2676	      $show "extracting exported symbol list from \`$soname'"
2677	      save_ifs="$IFS"; IFS='~'
2678	      cmds=$extract_expsyms_cmds
2679	      for cmd in $cmds; do
2680		IFS="$save_ifs"
2681		eval cmd=\"$cmd\"
2682		$show "$cmd"
2683		$run eval "$cmd" || exit $?
2684	      done
2685	      IFS="$save_ifs"
2686	    fi
2687
2688	    # Create $newlib
2689	    if test -f "$output_objdir/$newlib"; then :; else
2690	      $show "generating import library for \`$soname'"
2691	      save_ifs="$IFS"; IFS='~'
2692	      cmds=$old_archive_from_expsyms_cmds
2693	      for cmd in $cmds; do
2694		IFS="$save_ifs"
2695		eval cmd=\"$cmd\"
2696		$show "$cmd"
2697		$run eval "$cmd" || exit $?
2698	      done
2699	      IFS="$save_ifs"
2700	    fi
2701	    # make sure the library variables are pointing to the new library
2702	    dir=$output_objdir
2703	    linklib=$newlib
2704	  fi # test -n "$old_archive_from_expsyms_cmds"
2705
2706	  if test "$linkmode" = prog || test "$mode" != relink; then
2707	    add_shlibpath=
2708	    add_dir=
2709	    add=
2710	    lib_linked=yes
2711	    case $hardcode_action in
2712	    immediate | unsupported)
2713	      if test "$hardcode_direct" = no; then
2714		add="$dir/$linklib"
2715		case $host in
2716		  *-*-sco3.2v5.0.[024]*) add_dir="-L$dir" ;;
2717		  *-*-sysv4*uw2*) add_dir="-L$dir" ;;
2718		  *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \
2719		    *-*-unixware7*) add_dir="-L$dir" ;;
2720		  *-*-darwin* )
2721		    # if the lib is a module then we can not link against
2722		    # it, someone is ignoring the new warnings I added
2723		    if /usr/bin/file -L $add 2> /dev/null |
2724                      $EGREP ": [^:]* bundle" >/dev/null ; then
2725		      $echo "** Warning, lib $linklib is a module, not a shared library"
2726		      if test -z "$old_library" ; then
2727		        $echo
2728		        $echo "** And there doesn't seem to be a static archive available"
2729		        $echo "** The link will probably fail, sorry"
2730		      else
2731		        add="$dir/$old_library"
2732		      fi
2733		    fi
2734		esac
2735	      elif test "$hardcode_minus_L" = no; then
2736		case $host in
2737		*-*-sunos*) add_shlibpath="$dir" ;;
2738		esac
2739		add_dir="-L$dir"
2740		add="-l$name"
2741	      elif test "$hardcode_shlibpath_var" = no; then
2742		add_shlibpath="$dir"
2743		add="-l$name"
2744	      else
2745		lib_linked=no
2746	      fi
2747	      ;;
2748	    relink)
2749	      if test "$hardcode_direct" = yes; then
2750		add="$dir/$linklib"
2751	      elif test "$hardcode_minus_L" = yes; then
2752		add_dir="-L$dir"
2753		# Try looking first in the location we're being installed to.
2754		if test -n "$inst_prefix_dir"; then
2755		  case $libdir in
2756		    [\\/]*)
2757		      add_dir="$add_dir -L$inst_prefix_dir$libdir"
2758		      ;;
2759		  esac
2760		fi
2761		add="-l$name"
2762	      elif test "$hardcode_shlibpath_var" = yes; then
2763		add_shlibpath="$dir"
2764		add="-l$name"
2765	      else
2766		lib_linked=no
2767	      fi
2768	      ;;
2769	    *) lib_linked=no ;;
2770	    esac
2771
2772	    if test "$lib_linked" != yes; then
2773	      $echo "$modename: configuration error: unsupported hardcode properties"
2774	      exit $EXIT_FAILURE
2775	    fi
2776
2777	    if test -n "$add_shlibpath"; then
2778	      case :$compile_shlibpath: in
2779	      *":$add_shlibpath:"*) ;;
2780	      *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;;
2781	      esac
2782	    fi
2783	    if test "$linkmode" = prog; then
2784	      test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs"
2785	      test -n "$add" && compile_deplibs="$add $compile_deplibs"
2786	    else
2787	      test -n "$add_dir" && deplibs="$add_dir $deplibs"
2788	      test -n "$add" && deplibs="$add $deplibs"
2789	      if test "$hardcode_direct" != yes && \
2790		 test "$hardcode_minus_L" != yes && \
2791		 test "$hardcode_shlibpath_var" = yes; then
2792		case :$finalize_shlibpath: in
2793		*":$libdir:"*) ;;
2794		*) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
2795		esac
2796	      fi
2797	    fi
2798	  fi
2799
2800	  if test "$linkmode" = prog || test "$mode" = relink; then
2801	    add_shlibpath=
2802	    add_dir=
2803	    add=
2804	    # Finalize command for both is simple: just hardcode it.
2805	    if test "$hardcode_direct" = yes; then
2806	      add="$libdir/$linklib"
2807	    elif test "$hardcode_minus_L" = yes; then
2808	      add_dir="-L$libdir"
2809	      add="-l$name"
2810	    elif test "$hardcode_shlibpath_var" = yes; then
2811	      case :$finalize_shlibpath: in
2812	      *":$libdir:"*) ;;
2813	      *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
2814	      esac
2815	      add="-l$name"
2816	    elif test "$hardcode_automatic" = yes; then
2817	      if test -n "$inst_prefix_dir" &&
2818		 test -f "$inst_prefix_dir$libdir/$linklib" ; then
2819	        add="$inst_prefix_dir$libdir/$linklib"
2820	      else
2821	        add="$libdir/$linklib"
2822	      fi
2823	    else
2824	      # We cannot seem to hardcode it, guess we'll fake it.
2825	      add_dir="-L$libdir"
2826	      # Try looking first in the location we're being installed to.
2827	      if test -n "$inst_prefix_dir"; then
2828		case $libdir in
2829		  [\\/]*)
2830		    add_dir="$add_dir -L$inst_prefix_dir$libdir"
2831		    ;;
2832		esac
2833	      fi
2834	      add="-l$name"
2835	    fi
2836
2837	    if test "$linkmode" = prog; then
2838	      test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs"
2839	      test -n "$add" && finalize_deplibs="$add $finalize_deplibs"
2840	    else
2841	      test -n "$add_dir" && deplibs="$add_dir $deplibs"
2842	      test -n "$add" && deplibs="$add $deplibs"
2843	    fi
2844	  fi
2845	elif test "$linkmode" = prog; then
2846	  # Here we assume that one of hardcode_direct or hardcode_minus_L
2847	  # is not unsupported.  This is valid on all known static and
2848	  # shared platforms.
2849	  if test "$hardcode_direct" != unsupported; then
2850	    test -n "$old_library" && linklib="$old_library"
2851	    compile_deplibs="$dir/$linklib $compile_deplibs"
2852	    finalize_deplibs="$dir/$linklib $finalize_deplibs"
2853	  else
2854	    compile_deplibs="-l$name -L$dir $compile_deplibs"
2855	    finalize_deplibs="-l$name -L$dir $finalize_deplibs"
2856	  fi
2857	elif test "$build_libtool_libs" = yes; then
2858	  # Not a shared library
2859	  if test "$deplibs_check_method" != pass_all; then
2860	    # We're trying link a shared library against a static one
2861	    # but the system doesn't support it.
2862
2863	    # Just print a warning and add the library to dependency_libs so
2864	    # that the program can be linked against the static library.
2865	    $echo
2866	    $echo "*** Warning: This system can not link to static lib archive $lib."
2867	    $echo "*** I have the capability to make that library automatically link in when"
2868	    $echo "*** you link to this library.  But I can only do this if you have a"
2869	    $echo "*** shared version of the library, which you do not appear to have."
2870	    if test "$module" = yes; then
2871	      $echo "*** But as you try to build a module library, libtool will still create "
2872	      $echo "*** a static module, that should work as long as the dlopening application"
2873	      $echo "*** is linked with the -dlopen flag to resolve symbols at runtime."
2874	      if test -z "$global_symbol_pipe"; then
2875		$echo
2876		$echo "*** However, this would only work if libtool was able to extract symbol"
2877		$echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
2878		$echo "*** not find such a program.  So, this module is probably useless."
2879		$echo "*** \`nm' from GNU binutils and a full rebuild may help."
2880	      fi
2881	      if test "$build_old_libs" = no; then
2882		build_libtool_libs=module
2883		build_old_libs=yes
2884	      else
2885		build_libtool_libs=no
2886	      fi
2887	    fi
2888	  else
2889	    deplibs="$dir/$old_library $deplibs"
2890	    link_static=yes
2891	  fi
2892	fi # link shared/static library?
2893
2894	if test "$linkmode" = lib; then
2895	  if test -n "$dependency_libs" &&
2896	     { test "$hardcode_into_libs" != yes ||
2897	       test "$build_old_libs" = yes ||
2898	       test "$link_static" = yes; }; then
2899	    # Extract -R from dependency_libs
2900	    temp_deplibs=
2901	    for libdir in $dependency_libs; do
2902	      case $libdir in
2903	      -R*) temp_xrpath=`$echo "X$libdir" | $Xsed -e 's/^-R//'`
2904		   case " $xrpath " in
2905		   *" $temp_xrpath "*) ;;
2906		   *) xrpath="$xrpath $temp_xrpath";;
2907		   esac;;
2908	      *) temp_deplibs="$temp_deplibs $libdir";;
2909	      esac
2910	    done
2911	    dependency_libs="$temp_deplibs"
2912	  fi
2913
2914	  newlib_search_path="$newlib_search_path $absdir"
2915	  # Link against this library
2916	  test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs"
2917	  # ... and its dependency_libs
2918	  tmp_libs=
2919	  for deplib in $dependency_libs; do
2920	    newdependency_libs="$deplib $newdependency_libs"
2921	    if test "X$duplicate_deps" = "Xyes" ; then
2922	      case "$tmp_libs " in
2923	      *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
2924	      esac
2925	    fi
2926	    tmp_libs="$tmp_libs $deplib"
2927	  done
2928
2929	  if test "$link_all_deplibs" != no; then
2930	    # Add the search paths of all dependency libraries
2931	    for deplib in $dependency_libs; do
2932	      case $deplib in
2933	      -L*) path="$deplib" ;;
2934	      *.la)
2935		dir=`$echo "X$deplib" | $Xsed -e 's%/[^/]*$%%'`
2936		test "X$dir" = "X$deplib" && dir="."
2937		# We need an absolute path.
2938		case $dir in
2939		[\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;;
2940		*)
2941		  absdir=`cd "$dir" && pwd`
2942		  if test -z "$absdir"; then
2943		    $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2
2944		    absdir="$dir"
2945		  fi
2946		  ;;
2947		esac
2948		if grep "^installed=no" $deplib > /dev/null; then
2949		  path="$absdir/$objdir"
2950		else
2951		  eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
2952		  if test -z "$libdir"; then
2953		    $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
2954		    exit $EXIT_FAILURE
2955		  fi
2956		  if test "$absdir" != "$libdir"; then
2957		    $echo "$modename: warning: \`$deplib' seems to be moved" 1>&2
2958		  fi
2959		  path="$absdir"
2960		fi
2961		depdepl=
2962		case $host in
2963		*-*-darwin*)
2964		  # we do not want to link against static libs,
2965		  # but need to link against shared
2966		  eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib`
2967		  eval deplibdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
2968		  if test -n "$deplibrary_names" ; then
2969		    for tmp in $deplibrary_names ; do
2970		      depdepl=$tmp
2971		    done
2972		    if test -f "$deplibdir/$depdepl" ; then
2973		      depdepl="$deplibdir/$depdepl"
2974	      	    elif test -f "$path/$depdepl" ; then
2975		      depdepl="$path/$depdepl"
2976		    else
2977		      # Can't find it, oh well...
2978		      depdepl=
2979		    fi
2980		    # do not add paths which are already there
2981		    case " $newlib_search_path " in
2982		    *" $path "*) ;;
2983		    *) newlib_search_path="$newlib_search_path $path";;
2984		    esac
2985		  fi
2986		  path=""
2987		  ;;
2988		*)
2989		  path="-L$path"
2990		  ;;
2991		esac
2992		;;
2993	      -l*)
2994		case $host in
2995		*-*-darwin*)
2996		  # Again, we only want to link against shared libraries
2997		  eval tmp_libs=`$echo "X$deplib" | $Xsed -e "s,^\-l,,"`
2998		  for tmp in $newlib_search_path ; do
2999		    if test -f "$tmp/lib$tmp_libs.dylib" ; then
3000		      eval depdepl="$tmp/lib$tmp_libs.dylib"
3001		      break
3002		    fi
3003		  done
3004		  path=""
3005		  ;;
3006		*) continue ;;
3007		esac
3008		;;
3009	      *) continue ;;
3010	      esac
3011	      case " $deplibs " in
3012	      *" $path "*) ;;
3013	      *) deplibs="$path $deplibs" ;;
3014	      esac
3015	      case " $deplibs " in
3016	      *" $depdepl "*) ;;
3017	      *) deplibs="$depdepl $deplibs" ;;
3018	      esac
3019	    done
3020	  fi # link_all_deplibs != no
3021	fi # linkmode = lib
3022      done # for deplib in $libs
3023      dependency_libs="$newdependency_libs"
3024      if test "$pass" = dlpreopen; then
3025	# Link the dlpreopened libraries before other libraries
3026	for deplib in $save_deplibs; do
3027	  deplibs="$deplib $deplibs"
3028	done
3029      fi
3030      if test "$pass" != dlopen; then
3031	if test "$pass" != conv; then
3032	  # Make sure lib_search_path contains only unique directories.
3033	  lib_search_path=
3034	  for dir in $newlib_search_path; do
3035	    case "$lib_search_path " in
3036	    *" $dir "*) ;;
3037	    *) lib_search_path="$lib_search_path $dir" ;;
3038	    esac
3039	  done
3040	  newlib_search_path=
3041	fi
3042
3043	if test "$linkmode,$pass" != "prog,link"; then
3044	  vars="deplibs"
3045	else
3046	  vars="compile_deplibs finalize_deplibs"
3047	fi
3048	for var in $vars dependency_libs; do
3049	  # Add libraries to $var in reverse order
3050	  eval tmp_libs=\"\$$var\"
3051	  new_libs=
3052	  for deplib in $tmp_libs; do
3053	    # FIXME: Pedantically, this is the right thing to do, so
3054	    #        that some nasty dependency loop isn't accidentally
3055	    #        broken:
3056	    #new_libs="$deplib $new_libs"
3057	    # Pragmatically, this seems to cause very few problems in
3058	    # practice:
3059	    case $deplib in
3060	    -L*) new_libs="$deplib $new_libs" ;;
3061	    -R*) ;;
3062	    *)
3063	      # And here is the reason: when a library appears more
3064	      # than once as an explicit dependence of a library, or
3065	      # is implicitly linked in more than once by the
3066	      # compiler, it is considered special, and multiple
3067	      # occurrences thereof are not removed.  Compare this
3068	      # with having the same library being listed as a
3069	      # dependency of multiple other libraries: in this case,
3070	      # we know (pedantically, we assume) the library does not
3071	      # need to be listed more than once, so we keep only the
3072	      # last copy.  This is not always right, but it is rare
3073	      # enough that we require users that really mean to play
3074	      # such unportable linking tricks to link the library
3075	      # using -Wl,-lname, so that libtool does not consider it
3076	      # for duplicate removal.
3077	      case " $specialdeplibs " in
3078	      *" $deplib "*) new_libs="$deplib $new_libs" ;;
3079	      *)
3080		case " $new_libs " in
3081		*" $deplib "*) ;;
3082		*) new_libs="$deplib $new_libs" ;;
3083		esac
3084		;;
3085	      esac
3086	      ;;
3087	    esac
3088	  done
3089	  tmp_libs=
3090	  for deplib in $new_libs; do
3091	    case $deplib in
3092	    -L*)
3093	      case " $tmp_libs " in
3094	      *" $deplib "*) ;;
3095	      *) tmp_libs="$tmp_libs $deplib" ;;
3096	      esac
3097	      ;;
3098	    *) tmp_libs="$tmp_libs $deplib" ;;
3099	    esac
3100	  done
3101	  eval $var=\"$tmp_libs\"
3102	done # for var
3103      fi
3104      # Last step: remove runtime libs from dependency_libs
3105      # (they stay in deplibs)
3106      tmp_libs=
3107      for i in $dependency_libs ; do
3108	case " $predeps $postdeps $compiler_lib_search_path " in
3109	*" $i "*)
3110	  i=""
3111	  ;;
3112	esac
3113	if test -n "$i" ; then
3114	  tmp_libs="$tmp_libs $i"
3115	fi
3116      done
3117      dependency_libs=$tmp_libs
3118    done # for pass
3119    if test "$linkmode" = prog; then
3120      dlfiles="$newdlfiles"
3121      dlprefiles="$newdlprefiles"
3122    fi
3123
3124    case $linkmode in
3125    oldlib)
3126      case " $deplibs" in
3127      *\ -l* | *\ -L*)
3128	$echo "$modename: warning: \`-l' and \`-L' are ignored for archives" 1>&2 ;;
3129      esac
3130
3131      if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
3132	$echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2
3133      fi
3134
3135      if test -n "$rpath"; then
3136	$echo "$modename: warning: \`-rpath' is ignored for archives" 1>&2
3137      fi
3138
3139      if test -n "$xrpath"; then
3140	$echo "$modename: warning: \`-R' is ignored for archives" 1>&2
3141      fi
3142
3143      if test -n "$vinfo"; then
3144	$echo "$modename: warning: \`-version-info/-version-number' is ignored for archives" 1>&2
3145      fi
3146
3147      if test -n "$release"; then
3148	$echo "$modename: warning: \`-release' is ignored for archives" 1>&2
3149      fi
3150
3151      if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
3152	$echo "$modename: warning: \`-export-symbols' is ignored for archives" 1>&2
3153      fi
3154
3155      # Now set the variables for building old libraries.
3156      build_libtool_libs=no
3157      oldlibs="$output"
3158      objs="$objs$old_deplibs"
3159      ;;
3160
3161    lib)
3162      # Make sure we only generate libraries of the form `libNAME.la'.
3163      case $outputname in
3164      lib*)
3165	name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
3166	eval shared_ext=\"$shrext_cmds\"
3167	eval libname=\"$libname_spec\"
3168	;;
3169      *)
3170	if test "$module" = no; then
3171	  $echo "$modename: libtool library \`$output' must begin with \`lib'" 1>&2
3172	  $echo "$help" 1>&2
3173	  exit $EXIT_FAILURE
3174	fi
3175	if test "$need_lib_prefix" != no; then
3176	  # Add the "lib" prefix for modules if required
3177	  name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
3178	  eval shared_ext=\"$shrext_cmds\"
3179	  eval libname=\"$libname_spec\"
3180	else
3181	  libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
3182	fi
3183	;;
3184      esac
3185
3186      if test -n "$objs"; then
3187	if test "$deplibs_check_method" != pass_all; then
3188	  $echo "$modename: cannot build libtool library \`$output' from non-libtool objects on this host:$objs" 2>&1
3189	  exit $EXIT_FAILURE
3190	else
3191	  $echo
3192	  $echo "*** Warning: Linking the shared library $output against the non-libtool"
3193	  $echo "*** objects $objs is not portable!"
3194	  libobjs="$libobjs $objs"
3195	fi
3196      fi
3197
3198      if test "$dlself" != no; then
3199	$echo "$modename: warning: \`-dlopen self' is ignored for libtool libraries" 1>&2
3200      fi
3201
3202      set dummy $rpath
3203      if test "$#" -gt 2; then
3204	$echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2
3205      fi
3206      install_libdir="$2"
3207
3208      oldlibs=
3209      if test -z "$rpath"; then
3210	if test "$build_libtool_libs" = yes; then
3211	  # Building a libtool convenience library.
3212	  # Some compilers have problems with a `.al' extension so
3213	  # convenience libraries should have the same extension an
3214	  # archive normally would.
3215	  oldlibs="$output_objdir/$libname.$libext $oldlibs"
3216	  build_libtool_libs=convenience
3217	  build_old_libs=yes
3218	fi
3219
3220	if test -n "$vinfo"; then
3221	  $echo "$modename: warning: \`-version-info/-version-number' is ignored for convenience libraries" 1>&2
3222	fi
3223
3224	if test -n "$release"; then
3225	  $echo "$modename: warning: \`-release' is ignored for convenience libraries" 1>&2
3226	fi
3227      else
3228
3229	# Parse the version information argument.
3230	save_ifs="$IFS"; IFS=':'
3231	set dummy $vinfo 0 0 0
3232	IFS="$save_ifs"
3233
3234	if test -n "$8"; then
3235	  $echo "$modename: too many parameters to \`-version-info'" 1>&2
3236	  $echo "$help" 1>&2
3237	  exit $EXIT_FAILURE
3238	fi
3239
3240	# convert absolute version numbers to libtool ages
3241	# this retains compatibility with .la files and attempts
3242	# to make the code below a bit more comprehensible
3243
3244	case $vinfo_number in
3245	yes)
3246	  number_major="$2"
3247	  number_minor="$3"
3248	  number_revision="$4"
3249	  #
3250	  # There are really only two kinds -- those that
3251	  # use the current revision as the major version
3252	  # and those that subtract age and use age as
3253	  # a minor version.  But, then there is irix
3254	  # which has an extra 1 added just for fun
3255	  #
3256	  case $version_type in
3257	  darwin|linux|osf|windows|none)
3258	    current=`expr $number_major + $number_minor`
3259	    age="$number_minor"
3260	    revision="$number_revision"
3261	    ;;
3262	  freebsd-aout|freebsd-elf|sunos)
3263	    current="$number_major"
3264	    revision="$number_minor"
3265	    age="0"
3266	    ;;
3267	  irix|nonstopux)
3268	    current=`expr $number_major + $number_minor`
3269	    age="$number_minor"
3270	    revision="$number_minor"
3271	    lt_irix_increment=no
3272	    ;;
3273	  esac
3274	  ;;
3275	no)
3276	  current="$2"
3277	  revision="$3"
3278	  age="$4"
3279	  ;;
3280	esac
3281
3282	# Check that each of the things are valid numbers.
3283	case $current in
3284	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]) ;;
3285	*)
3286	  $echo "$modename: CURRENT \`$current' must be a nonnegative integer" 1>&2
3287	  $echo "$modename: \`$vinfo' is not valid version information" 1>&2
3288	  exit $EXIT_FAILURE
3289	  ;;
3290	esac
3291
3292	case $revision in
3293	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]) ;;
3294	*)
3295	  $echo "$modename: REVISION \`$revision' must be a nonnegative integer" 1>&2
3296	  $echo "$modename: \`$vinfo' is not valid version information" 1>&2
3297	  exit $EXIT_FAILURE
3298	  ;;
3299	esac
3300
3301	case $age in
3302	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]) ;;
3303	*)
3304	  $echo "$modename: AGE \`$age' must be a nonnegative integer" 1>&2
3305	  $echo "$modename: \`$vinfo' is not valid version information" 1>&2
3306	  exit $EXIT_FAILURE
3307	  ;;
3308	esac
3309
3310	if test "$age" -gt "$current"; then
3311	  $echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2
3312	  $echo "$modename: \`$vinfo' is not valid version information" 1>&2
3313	  exit $EXIT_FAILURE
3314	fi
3315
3316	# Calculate the version variables.
3317	major=
3318	versuffix=
3319	verstring=
3320	case $version_type in
3321	none) ;;
3322
3323	darwin)
3324	  # Like Linux, but with the current version available in
3325	  # verstring for coding it into the library header
3326	  major=.`expr $current - $age`
3327	  versuffix="$major.$age.$revision"
3328	  # Darwin ld doesn't like 0 for these options...
3329	  minor_current=`expr $current + 1`
3330	  xlcverstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision"
3331	  verstring="-compatibility_version $minor_current -current_version $minor_current.$revision"
3332	  ;;
3333
3334	freebsd-aout)
3335	  major=".$current"
3336	  versuffix=".$current.$revision";
3337	  ;;
3338
3339	freebsd-elf)
3340	  major=".$current"
3341	  versuffix=".$current";
3342	  ;;
3343
3344	irix | nonstopux)
3345	  if test "X$lt_irix_increment" = "Xno"; then
3346	    major=`expr $current - $age`
3347	  else
3348	    major=`expr $current - $age + 1`
3349	  fi
3350	  case $version_type in
3351	    nonstopux) verstring_prefix=nonstopux ;;
3352	    *)         verstring_prefix=sgi ;;
3353	  esac
3354	  verstring="$verstring_prefix$major.$revision"
3355
3356	  # Add in all the interfaces that we are compatible with.
3357	  loop=$revision
3358	  while test "$loop" -ne 0; do
3359	    iface=`expr $revision - $loop`
3360	    loop=`expr $loop - 1`
3361	    verstring="$verstring_prefix$major.$iface:$verstring"
3362	  done
3363
3364	  # Before this point, $major must not contain `.'.
3365	  major=.$major
3366	  versuffix="$major.$revision"
3367	  ;;
3368
3369	linux)
3370	  major=.`expr $current - $age`
3371	  versuffix="$major.$age.$revision"
3372	  ;;
3373
3374	osf)
3375	  major=.`expr $current - $age`
3376	  versuffix=".$current.$age.$revision"
3377	  verstring="$current.$age.$revision"
3378
3379	  # Add in all the interfaces that we are compatible with.
3380	  loop=$age
3381	  while test "$loop" -ne 0; do
3382	    iface=`expr $current - $loop`
3383	    loop=`expr $loop - 1`
3384	    verstring="$verstring:${iface}.0"
3385	  done
3386
3387	  # Make executables depend on our current version.
3388	  verstring="$verstring:${current}.0"
3389	  ;;
3390
3391	sunos)
3392	  major=".$current"
3393	  versuffix=".$current.$revision"
3394	  ;;
3395
3396	windows)
3397	  # Use '-' rather than '.', since we only want one
3398	  # extension on DOS 8.3 filesystems.
3399	  major=`expr $current - $age`
3400	  versuffix="-$major"
3401	  ;;
3402
3403	*)
3404	  $echo "$modename: unknown library version type \`$version_type'" 1>&2
3405	  $echo "Fatal configuration error.  See the $PACKAGE docs for more information." 1>&2
3406	  exit $EXIT_FAILURE
3407	  ;;
3408	esac
3409
3410	# Clear the version info if we defaulted, and they specified a release.
3411	if test -z "$vinfo" && test -n "$release"; then
3412	  major=
3413	  case $version_type in
3414	  darwin)
3415	    # we can't check for "0.0" in archive_cmds due to quoting
3416	    # problems, so we reset it completely
3417	    verstring=
3418	    ;;
3419	  *)
3420	    verstring="0.0"
3421	    ;;
3422	  esac
3423	  if test "$need_version" = no; then
3424	    versuffix=
3425	  else
3426	    versuffix=".0.0"
3427	  fi
3428	fi
3429
3430	# Remove version info from name if versioning should be avoided
3431	if test "$avoid_version" = yes && test "$need_version" = no; then
3432	  major=
3433	  versuffix=
3434	  verstring=""
3435	fi
3436
3437	# Check to see if the archive will have undefined symbols.
3438	if test "$allow_undefined" = yes; then
3439	  if test "$allow_undefined_flag" = unsupported; then
3440	    $echo "$modename: warning: undefined symbols not allowed in $host shared libraries" 1>&2
3441	    build_libtool_libs=no
3442	    build_old_libs=yes
3443	  fi
3444	else
3445	  # Don't allow undefined symbols.
3446	  allow_undefined_flag="$no_undefined_flag"
3447	fi
3448      fi
3449
3450      if test "$mode" != relink; then
3451	# Remove our outputs, but don't remove object files since they
3452	# may have been created when compiling PIC objects.
3453	removelist=
3454	tempremovelist=`$echo "$output_objdir/*"`
3455	for p in $tempremovelist; do
3456	  case $p in
3457	    *.$objext)
3458	       ;;
3459	    $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*)
3460	       if test "X$precious_files_regex" != "X"; then
3461	         if echo $p | $EGREP -e "$precious_files_regex" >/dev/null 2>&1
3462	         then
3463		   continue
3464		 fi
3465	       fi
3466	       removelist="$removelist $p"
3467	       ;;
3468	    *) ;;
3469	  esac
3470	done
3471	if test -n "$removelist"; then
3472	  $show "${rm}r $removelist"
3473	  $run ${rm}r $removelist
3474	fi
3475      fi
3476
3477      # Now set the variables for building old libraries.
3478      if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then
3479	oldlibs="$oldlibs $output_objdir/$libname.$libext"
3480
3481	# Transform .lo files to .o files.
3482	oldobjs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP`
3483      fi
3484
3485      # Eliminate all temporary directories.
3486      #for path in $notinst_path; do
3487      #	lib_search_path=`$echo "$lib_search_path " | ${SED} -e "s% $path % %g"`
3488      #	deplibs=`$echo "$deplibs " | ${SED} -e "s% -L$path % %g"`
3489      #	dependency_libs=`$echo "$dependency_libs " | ${SED} -e "s% -L$path % %g"`
3490      #done
3491
3492      if test -n "$xrpath"; then
3493	# If the user specified any rpath flags, then add them.
3494	temp_xrpath=
3495	for libdir in $xrpath; do
3496	  temp_xrpath="$temp_xrpath -R$libdir"
3497	  case "$finalize_rpath " in
3498	  *" $libdir "*) ;;
3499	  *) finalize_rpath="$finalize_rpath $libdir" ;;
3500	  esac
3501	done
3502	if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then
3503	  dependency_libs="$temp_xrpath $dependency_libs"
3504	fi
3505      fi
3506
3507      # Make sure dlfiles contains only unique files that won't be dlpreopened
3508      old_dlfiles="$dlfiles"
3509      dlfiles=
3510      for lib in $old_dlfiles; do
3511	case " $dlprefiles $dlfiles " in
3512	*" $lib "*) ;;
3513	*) dlfiles="$dlfiles $lib" ;;
3514	esac
3515      done
3516
3517      # Make sure dlprefiles contains only unique files
3518      old_dlprefiles="$dlprefiles"
3519      dlprefiles=
3520      for lib in $old_dlprefiles; do
3521	case "$dlprefiles " in
3522	*" $lib "*) ;;
3523	*) dlprefiles="$dlprefiles $lib" ;;
3524	esac
3525      done
3526
3527      if test "$build_libtool_libs" = yes; then
3528	if test -n "$rpath"; then
3529	  case $host in
3530	  *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos*)
3531	    # these systems don't actually have a c library (as such)!
3532	    ;;
3533	  *-*-rhapsody* | *-*-darwin1.[012])
3534	    # Rhapsody C library is in the System framework
3535	    deplibs="$deplibs -framework System"
3536	    ;;
3537	  *-*-netbsd*)
3538	    # Don't link with libc until the a.out ld.so is fixed.
3539	    ;;
3540	  *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
3541	    # Do not include libc due to us having libc/libc_r.
3542	    ;;
3543	  *-*-sco3.2v5* | *-*-sco5v6*)
3544	    # Causes problems with __ctype
3545	    ;;
3546	  *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
3547	    # Compiler inserts libc in the correct place for threads to work
3548	    ;;
3549 	  *)
3550	    # Add libc to deplibs on all other systems if necessary.
3551	    if test "$build_libtool_need_lc" = "yes"; then
3552	      deplibs="$deplibs -lc"
3553	    fi
3554	    ;;
3555	  esac
3556	fi
3557
3558	# Transform deplibs into only deplibs that can be linked in shared.
3559	name_save=$name
3560	libname_save=$libname
3561	release_save=$release
3562	versuffix_save=$versuffix
3563	major_save=$major
3564	# I'm not sure if I'm treating the release correctly.  I think
3565	# release should show up in the -l (ie -lgmp5) so we don't want to
3566	# add it in twice.  Is that correct?
3567	release=""
3568	versuffix=""
3569	major=""
3570	newdeplibs=
3571	droppeddeps=no
3572	case $deplibs_check_method in
3573	pass_all)
3574	  # Don't check for shared/static.  Everything works.
3575	  # This might be a little naive.  We might want to check
3576	  # whether the library exists or not.  But this is on
3577	  # osf3 & osf4 and I'm not really sure... Just
3578	  # implementing what was already the behavior.
3579	  newdeplibs=$deplibs
3580	  ;;
3581	test_compile)
3582	  # This code stresses the "libraries are programs" paradigm to its
3583	  # limits. Maybe even breaks it.  We compile a program, linking it
3584	  # against the deplibs as a proxy for the library.  Then we can check
3585	  # whether they linked in statically or dynamically with ldd.
3586	  $rm conftest.c
3587	  cat > conftest.c <<EOF
3588	  int main() { return 0; }
3589EOF
3590	  $rm conftest
3591	  if $LTCC $LTCFLAGS -o conftest conftest.c $deplibs; then
3592	    ldd_output=`ldd conftest`
3593	    for i in $deplibs; do
3594	      name=`expr $i : '-l\(.*\)'`
3595	      # If $name is empty we are operating on a -L argument.
3596              if test "$name" != "" && test "$name" != "0"; then
3597		if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
3598		  case " $predeps $postdeps " in
3599		  *" $i "*)
3600		    newdeplibs="$newdeplibs $i"
3601		    i=""
3602		    ;;
3603		  esac
3604	        fi
3605		if test -n "$i" ; then
3606		  libname=`eval \\$echo \"$libname_spec\"`
3607		  deplib_matches=`eval \\$echo \"$library_names_spec\"`
3608		  set dummy $deplib_matches
3609		  deplib_match=$2
3610		  if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
3611		    newdeplibs="$newdeplibs $i"
3612		  else
3613		    droppeddeps=yes
3614		    $echo
3615		    $echo "*** Warning: dynamic linker does not accept needed library $i."
3616		    $echo "*** I have the capability to make that library automatically link in when"
3617		    $echo "*** you link to this library.  But I can only do this if you have a"
3618		    $echo "*** shared version of the library, which I believe you do not have"
3619		    $echo "*** because a test_compile did reveal that the linker did not use it for"
3620		    $echo "*** its dynamic dependency list that programs get resolved with at runtime."
3621		  fi
3622		fi
3623	      else
3624		newdeplibs="$newdeplibs $i"
3625	      fi
3626	    done
3627	  else
3628	    # Error occurred in the first compile.  Let's try to salvage
3629	    # the situation: Compile a separate program for each library.
3630	    for i in $deplibs; do
3631	      name=`expr $i : '-l\(.*\)'`
3632	      # If $name is empty we are operating on a -L argument.
3633              if test "$name" != "" && test "$name" != "0"; then
3634		$rm conftest
3635		if $LTCC $LTCFLAGS -o conftest conftest.c $i; then
3636		  ldd_output=`ldd conftest`
3637		  if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
3638		    case " $predeps $postdeps " in
3639		    *" $i "*)
3640		      newdeplibs="$newdeplibs $i"
3641		      i=""
3642		      ;;
3643		    esac
3644		  fi
3645		  if test -n "$i" ; then
3646		    libname=`eval \\$echo \"$libname_spec\"`
3647		    deplib_matches=`eval \\$echo \"$library_names_spec\"`
3648		    set dummy $deplib_matches
3649		    deplib_match=$2
3650		    if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
3651		      newdeplibs="$newdeplibs $i"
3652		    else
3653		      droppeddeps=yes
3654		      $echo
3655		      $echo "*** Warning: dynamic linker does not accept needed library $i."
3656		      $echo "*** I have the capability to make that library automatically link in when"
3657		      $echo "*** you link to this library.  But I can only do this if you have a"
3658		      $echo "*** shared version of the library, which you do not appear to have"
3659		      $echo "*** because a test_compile did reveal that the linker did not use this one"
3660		      $echo "*** as a dynamic dependency that programs can get resolved with at runtime."
3661		    fi
3662		  fi
3663		else
3664		  droppeddeps=yes
3665		  $echo
3666		  $echo "*** Warning!  Library $i is needed by this library but I was not able to"
3667		  $echo "*** make it link in!  You will probably need to install it or some"
3668		  $echo "*** library that it depends on before this library will be fully"
3669		  $echo "*** functional.  Installing it before continuing would be even better."
3670		fi
3671	      else
3672		newdeplibs="$newdeplibs $i"
3673	      fi
3674	    done
3675	  fi
3676	  ;;
3677	file_magic*)
3678	  set dummy $deplibs_check_method
3679	  file_magic_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
3680	  for a_deplib in $deplibs; do
3681	    name=`expr $a_deplib : '-l\(.*\)'`
3682	    # If $name is empty we are operating on a -L argument.
3683            if test "$name" != "" && test  "$name" != "0"; then
3684	      if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
3685		case " $predeps $postdeps " in
3686		*" $a_deplib "*)
3687		  newdeplibs="$newdeplibs $a_deplib"
3688		  a_deplib=""
3689		  ;;
3690		esac
3691	      fi
3692	      if test -n "$a_deplib" ; then
3693		libname=`eval \\$echo \"$libname_spec\"`
3694		for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
3695		  potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
3696		  for potent_lib in $potential_libs; do
3697		      # Follow soft links.
3698		      if ls -lLd "$potent_lib" 2>/dev/null \
3699			 | grep " -> " >/dev/null; then
3700			continue
3701		      fi
3702		      # The statement above tries to avoid entering an
3703		      # endless loop below, in case of cyclic links.
3704		      # We might still enter an endless loop, since a link
3705		      # loop can be closed while we follow links,
3706		      # but so what?
3707		      potlib="$potent_lib"
3708		      while test -h "$potlib" 2>/dev/null; do
3709			potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'`
3710			case $potliblink in
3711			[\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";;
3712			*) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";;
3713			esac
3714		      done
3715		      if eval $file_magic_cmd \"\$potlib\" 2>/dev/null \
3716			 | ${SED} 10q \
3717			 | $EGREP "$file_magic_regex" > /dev/null; then
3718			newdeplibs="$newdeplibs $a_deplib"
3719			a_deplib=""
3720			break 2
3721		      fi
3722		  done
3723		done
3724	      fi
3725	      if test -n "$a_deplib" ; then
3726		droppeddeps=yes
3727		$echo
3728		$echo "*** Warning: linker path does not have real file for library $a_deplib."
3729		$echo "*** I have the capability to make that library automatically link in when"
3730		$echo "*** you link to this library.  But I can only do this if you have a"
3731		$echo "*** shared version of the library, which you do not appear to have"
3732		$echo "*** because I did check the linker path looking for a file starting"
3733		if test -z "$potlib" ; then
3734		  $echo "*** with $libname but no candidates were found. (...for file magic test)"
3735		else
3736		  $echo "*** with $libname and none of the candidates passed a file format test"
3737		  $echo "*** using a file magic. Last file checked: $potlib"
3738		fi
3739	      fi
3740	    else
3741	      # Add a -L argument.
3742	      newdeplibs="$newdeplibs $a_deplib"
3743	    fi
3744	  done # Gone through all deplibs.
3745	  ;;
3746	match_pattern*)
3747	  set dummy $deplibs_check_method
3748	  match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
3749	  for a_deplib in $deplibs; do
3750	    name=`expr $a_deplib : '-l\(.*\)'`
3751	    # If $name is empty we are operating on a -L argument.
3752	    if test -n "$name" && test "$name" != "0"; then
3753	      if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
3754		case " $predeps $postdeps " in
3755		*" $a_deplib "*)
3756		  newdeplibs="$newdeplibs $a_deplib"
3757		  a_deplib=""
3758		  ;;
3759		esac
3760	      fi
3761	      if test -n "$a_deplib" ; then
3762		libname=`eval \\$echo \"$libname_spec\"`
3763		for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
3764		  potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
3765		  for potent_lib in $potential_libs; do
3766		    potlib="$potent_lib" # see symlink-check above in file_magic test
3767		    if eval $echo \"$potent_lib\" 2>/dev/null \
3768		        | ${SED} 10q \
3769		        | $EGREP "$match_pattern_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 regex pattern test)"
3787		else
3788		  $echo "*** with $libname and none of the candidates passed a file format test"
3789		  $echo "*** using a regex pattern. 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	none | unknown | *)
3799	  newdeplibs=""
3800	  tmp_deplibs=`$echo "X $deplibs" | $Xsed -e 's/ -lc$//' \
3801	    -e 's/ -[LR][^ ]*//g'`
3802	  if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
3803	    for i in $predeps $postdeps ; do
3804	      # can't use Xsed below, because $i might contain '/'
3805	      tmp_deplibs=`$echo "X $tmp_deplibs" | ${SED} -e "1s,^X,," -e "s,$i,,"`
3806	    done
3807	  fi
3808	  if $echo "X $tmp_deplibs" | $Xsed -e 's/[ 	]//g' \
3809	    | grep . >/dev/null; then
3810	    $echo
3811	    if test "X$deplibs_check_method" = "Xnone"; then
3812	      $echo "*** Warning: inter-library dependencies are not supported in this platform."
3813	    else
3814	      $echo "*** Warning: inter-library dependencies are not known to be supported."
3815	    fi
3816	    $echo "*** All declared inter-library dependencies are being dropped."
3817	    droppeddeps=yes
3818	  fi
3819	  ;;
3820	esac
3821	versuffix=$versuffix_save
3822	major=$major_save
3823	release=$release_save
3824	libname=$libname_save
3825	name=$name_save
3826
3827	case $host in
3828	*-*-rhapsody* | *-*-darwin1.[012])
3829	  # On Rhapsody replace the C library is the System framework
3830	  newdeplibs=`$echo "X $newdeplibs" | $Xsed -e 's/ -lc / -framework System /'`
3831	  ;;
3832	esac
3833
3834	if test "$droppeddeps" = yes; then
3835	  if test "$module" = yes; then
3836	    $echo
3837	    $echo "*** Warning: libtool could not satisfy all declared inter-library"
3838	    $echo "*** dependencies of module $libname.  Therefore, libtool will create"
3839	    $echo "*** a static module, that should work as long as the dlopening"
3840	    $echo "*** application is linked with the -dlopen flag."
3841	    if test -z "$global_symbol_pipe"; then
3842	      $echo
3843	      $echo "*** However, this would only work if libtool was able to extract symbol"
3844	      $echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
3845	      $echo "*** not find such a program.  So, this module is probably useless."
3846	      $echo "*** \`nm' from GNU binutils and a full rebuild may help."
3847	    fi
3848	    if test "$build_old_libs" = no; then
3849	      oldlibs="$output_objdir/$libname.$libext"
3850	      build_libtool_libs=module
3851	      build_old_libs=yes
3852	    else
3853	      build_libtool_libs=no
3854	    fi
3855	  else
3856	    $echo "*** The inter-library dependencies that have been dropped here will be"
3857	    $echo "*** automatically added whenever a program is linked with this library"
3858	    $echo "*** or is declared to -dlopen it."
3859
3860	    if test "$allow_undefined" = no; then
3861	      $echo
3862	      $echo "*** Since this library must not contain undefined symbols,"
3863	      $echo "*** because either the platform does not support them or"
3864	      $echo "*** it was explicitly requested with -no-undefined,"
3865	      $echo "*** libtool will only create a static version of it."
3866	      if test "$build_old_libs" = no; then
3867		oldlibs="$output_objdir/$libname.$libext"
3868		build_libtool_libs=module
3869		build_old_libs=yes
3870	      else
3871		build_libtool_libs=no
3872	      fi
3873	    fi
3874	  fi
3875	fi
3876	# Done checking deplibs!
3877	deplibs=$newdeplibs
3878      fi
3879
3880
3881      # move library search paths that coincide with paths to not yet
3882      # installed libraries to the beginning of the library search list
3883      new_libs=
3884      for path in $notinst_path; do
3885	case " $new_libs " in
3886	*" -L$path/$objdir "*) ;;
3887	*)
3888	  case " $deplibs " in
3889	  *" -L$path/$objdir "*)
3890	    new_libs="$new_libs -L$path/$objdir" ;;
3891	  esac
3892	  ;;
3893	esac
3894      done
3895      for deplib in $deplibs; do
3896	case $deplib in
3897	-L*)
3898	  case " $new_libs " in
3899	  *" $deplib "*) ;;
3900	  *) new_libs="$new_libs $deplib" ;;
3901	  esac
3902	  ;;
3903	*) new_libs="$new_libs $deplib" ;;
3904	esac
3905      done
3906      deplibs="$new_libs"
3907
3908
3909      # All the library-specific variables (install_libdir is set above).
3910      library_names=
3911      old_library=
3912      dlname=
3913
3914      # Test again, we may have decided not to build it any more
3915      if test "$build_libtool_libs" = yes; then
3916	if test "$hardcode_into_libs" = yes; then
3917	  # Hardcode the library paths
3918	  hardcode_libdirs=
3919	  dep_rpath=
3920	  rpath="$finalize_rpath"
3921	  test "$mode" != relink && rpath="$compile_rpath$rpath"
3922	  for libdir in $rpath; do
3923	    if test -n "$hardcode_libdir_flag_spec"; then
3924	      if test -n "$hardcode_libdir_separator"; then
3925		if test -z "$hardcode_libdirs"; then
3926		  hardcode_libdirs="$libdir"
3927		else
3928		  # Just accumulate the unique libdirs.
3929		  case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
3930		  *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
3931		    ;;
3932		  *)
3933		    hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
3934		    ;;
3935		  esac
3936		fi
3937	      else
3938		eval flag=\"$hardcode_libdir_flag_spec\"
3939		dep_rpath="$dep_rpath $flag"
3940	      fi
3941	    elif test -n "$runpath_var"; then
3942	      case "$perm_rpath " in
3943	      *" $libdir "*) ;;
3944	      *) perm_rpath="$perm_rpath $libdir" ;;
3945	      esac
3946	    fi
3947	  done
3948	  # Substitute the hardcoded libdirs into the rpath.
3949	  if test -n "$hardcode_libdir_separator" &&
3950	     test -n "$hardcode_libdirs"; then
3951	    libdir="$hardcode_libdirs"
3952	    if test -n "$hardcode_libdir_flag_spec_ld"; then
3953	      case $archive_cmds in
3954	      *\$LD*) eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\" ;;
3955	      *)      eval dep_rpath=\"$hardcode_libdir_flag_spec\" ;;
3956	      esac
3957	    else
3958	      eval dep_rpath=\"$hardcode_libdir_flag_spec\"
3959	    fi
3960	  fi
3961	  if test -n "$runpath_var" && test -n "$perm_rpath"; then
3962	    # We should set the runpath_var.
3963	    rpath=
3964	    for dir in $perm_rpath; do
3965	      rpath="$rpath$dir:"
3966	    done
3967	    eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var"
3968	  fi
3969	  test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs"
3970	fi
3971
3972	shlibpath="$finalize_shlibpath"
3973	test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath"
3974	if test -n "$shlibpath"; then
3975	  eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var"
3976	fi
3977
3978	# Get the real and link names of the library.
3979	eval shared_ext=\"$shrext_cmds\"
3980	eval library_names=\"$library_names_spec\"
3981	set dummy $library_names
3982	realname="$2"
3983	shift; shift
3984
3985	if test -n "$soname_spec"; then
3986	  eval soname=\"$soname_spec\"
3987	else
3988	  soname="$realname"
3989	fi
3990	if test -z "$dlname"; then
3991	  dlname=$soname
3992	fi
3993
3994	lib="$output_objdir/$realname"
3995	linknames=
3996	for link
3997	do
3998	  linknames="$linknames $link"
3999	done
4000
4001	# Use standard objects if they are pic
4002	test -z "$pic_flag" && libobjs=`$echo "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
4003
4004	# Prepare the list of exported symbols
4005	if test -z "$export_symbols"; then
4006	  if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then
4007	    $show "generating symbol list for \`$libname.la'"
4008	    export_symbols="$output_objdir/$libname.exp"
4009	    $run $rm $export_symbols
4010	    cmds=$export_symbols_cmds
4011	    save_ifs="$IFS"; IFS='~'
4012	    for cmd in $cmds; do
4013	      IFS="$save_ifs"
4014	      eval cmd=\"$cmd\"
4015	      if len=`expr "X$cmd" : ".*"` &&
4016	       test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
4017	        $show "$cmd"
4018	        $run eval "$cmd" || exit $?
4019	        skipped_export=false
4020	      else
4021	        # The command line is too long to execute in one step.
4022	        $show "using reloadable object file for export list..."
4023	        skipped_export=:
4024		# Break out early, otherwise skipped_export may be
4025		# set to false by a later but shorter cmd.
4026		break
4027	      fi
4028	    done
4029	    IFS="$save_ifs"
4030	    if test -n "$export_symbols_regex"; then
4031	      $show "$EGREP -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\""
4032	      $run eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
4033	      $show "$mv \"${export_symbols}T\" \"$export_symbols\""
4034	      $run eval '$mv "${export_symbols}T" "$export_symbols"'
4035	    fi
4036	  fi
4037	fi
4038
4039	if test -n "$export_symbols" && test -n "$include_expsyms"; then
4040	  $run eval '$echo "X$include_expsyms" | $SP2NL >> "$export_symbols"'
4041	fi
4042
4043	tmp_deplibs=
4044	for test_deplib in $deplibs; do
4045		case " $convenience " in
4046		*" $test_deplib "*) ;;
4047		*)
4048			tmp_deplibs="$tmp_deplibs $test_deplib"
4049			;;
4050		esac
4051	done
4052	deplibs="$tmp_deplibs"
4053
4054	if test -n "$convenience"; then
4055	  if test -n "$whole_archive_flag_spec"; then
4056	    save_libobjs=$libobjs
4057	    eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
4058	  else
4059	    gentop="$output_objdir/${outputname}x"
4060	    generated="$generated $gentop"
4061
4062	    func_extract_archives $gentop $convenience
4063	    libobjs="$libobjs $func_extract_archives_result"
4064	  fi
4065	fi
4066	
4067	if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then
4068	  eval flag=\"$thread_safe_flag_spec\"
4069	  linker_flags="$linker_flags $flag"
4070	fi
4071
4072	# Make a backup of the uninstalled library when relinking
4073	if test "$mode" = relink; then
4074	  $run eval '(cd $output_objdir && $rm ${realname}U && $mv $realname ${realname}U)' || exit $?
4075	fi
4076
4077	# Do each of the archive commands.
4078	if test "$module" = yes && test -n "$module_cmds" ; then
4079	  if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
4080	    eval test_cmds=\"$module_expsym_cmds\"
4081	    cmds=$module_expsym_cmds
4082	  else
4083	    eval test_cmds=\"$module_cmds\"
4084	    cmds=$module_cmds
4085	  fi
4086	else
4087	if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
4088	  eval test_cmds=\"$archive_expsym_cmds\"
4089	  cmds=$archive_expsym_cmds
4090	else
4091	  eval test_cmds=\"$archive_cmds\"
4092	  cmds=$archive_cmds
4093	  fi
4094	fi
4095
4096	if test "X$skipped_export" != "X:" &&
4097	   len=`expr "X$test_cmds" : ".*" 2>/dev/null` &&
4098	   test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
4099	  :
4100	else
4101	  # The command line is too long to link in one step, link piecewise.
4102	  $echo "creating reloadable object files..."
4103
4104	  # Save the value of $output and $libobjs because we want to
4105	  # use them later.  If we have whole_archive_flag_spec, we
4106	  # want to use save_libobjs as it was before
4107	  # whole_archive_flag_spec was expanded, because we can't
4108	  # assume the linker understands whole_archive_flag_spec.
4109	  # This may have to be revisited, in case too many
4110	  # convenience libraries get linked in and end up exceeding
4111	  # the spec.
4112	  if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then
4113	    save_libobjs=$libobjs
4114	  fi
4115	  save_output=$output
4116	  output_la=`$echo "X$output" | $Xsed -e "$basename"`
4117
4118	  # Clear the reloadable object creation command queue and
4119	  # initialize k to one.
4120	  test_cmds=
4121	  concat_cmds=
4122	  objlist=
4123	  delfiles=
4124	  last_robj=
4125	  k=1
4126	  output=$output_objdir/$output_la-${k}.$objext
4127	  # Loop over the list of objects to be linked.
4128	  for obj in $save_libobjs
4129	  do
4130	    eval test_cmds=\"$reload_cmds $objlist $last_robj\"
4131	    if test "X$objlist" = X ||
4132	       { len=`expr "X$test_cmds" : ".*" 2>/dev/null` &&
4133		 test "$len" -le "$max_cmd_len"; }; then
4134	      objlist="$objlist $obj"
4135	    else
4136	      # The command $test_cmds is almost too long, add a
4137	      # command to the queue.
4138	      if test "$k" -eq 1 ; then
4139		# The first file doesn't have a previous command to add.
4140		eval concat_cmds=\"$reload_cmds $objlist $last_robj\"
4141	      else
4142		# All subsequent reloadable object files will link in
4143		# the last one created.
4144		eval concat_cmds=\"\$concat_cmds~$reload_cmds $objlist $last_robj\"
4145	      fi
4146	      last_robj=$output_objdir/$output_la-${k}.$objext
4147	      k=`expr $k + 1`
4148	      output=$output_objdir/$output_la-${k}.$objext
4149	      objlist=$obj
4150	      len=1
4151	    fi
4152	  done
4153	  # Handle the remaining objects by creating one last
4154	  # reloadable object file.  All subsequent reloadable object
4155	  # files will link in the last one created.
4156	  test -z "$concat_cmds" || concat_cmds=$concat_cmds~
4157	  eval concat_cmds=\"\${concat_cmds}$reload_cmds $objlist $last_robj\"
4158
4159	  if ${skipped_export-false}; then
4160	    $show "generating symbol list for \`$libname.la'"
4161	    export_symbols="$output_objdir/$libname.exp"
4162	    $run $rm $export_symbols
4163	    libobjs=$output
4164	    # Append the command to create the export file.
4165	    eval concat_cmds=\"\$concat_cmds~$export_symbols_cmds\"
4166          fi
4167
4168	  # Set up a command to remove the reloadable object files
4169	  # after they are used.
4170	  i=0
4171	  while test "$i" -lt "$k"
4172	  do
4173	    i=`expr $i + 1`
4174	    delfiles="$delfiles $output_objdir/$output_la-${i}.$objext"
4175	  done
4176
4177	  $echo "creating a temporary reloadable object file: $output"
4178
4179	  # Loop through the commands generated above and execute them.
4180	  save_ifs="$IFS"; IFS='~'
4181	  for cmd in $concat_cmds; do
4182	    IFS="$save_ifs"
4183	    $show "$cmd"
4184	    $run eval "$cmd" || exit $?
4185	  done
4186	  IFS="$save_ifs"
4187
4188	  libobjs=$output
4189	  # Restore the value of output.
4190	  output=$save_output
4191
4192	  if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then
4193	    eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
4194	  fi
4195	  # Expand the library linking commands again to reset the
4196	  # value of $libobjs for piecewise linking.
4197
4198	  # Do each of the archive commands.
4199	  if test "$module" = yes && test -n "$module_cmds" ; then
4200	    if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
4201	      cmds=$module_expsym_cmds
4202	    else
4203	      cmds=$module_cmds
4204	    fi
4205	  else
4206	  if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
4207	    cmds=$archive_expsym_cmds
4208	  else
4209	    cmds=$archive_cmds
4210	    fi
4211	  fi
4212
4213	  # Append the command to remove the reloadable object files
4214	  # to the just-reset $cmds.
4215	  eval cmds=\"\$cmds~\$rm $delfiles\"
4216	fi
4217	save_ifs="$IFS"; IFS='~'
4218	for cmd in $cmds; do
4219	  IFS="$save_ifs"
4220	  eval cmd=\"$cmd\"
4221	  $show "$cmd"
4222	  $run eval "$cmd" || {
4223	    lt_exit=$?
4224
4225	    # Restore the uninstalled library and exit
4226	    if test "$mode" = relink; then
4227	      $run eval '(cd $output_objdir && $rm ${realname}T && $mv ${realname}U $realname)'
4228	    fi
4229
4230	    exit $lt_exit
4231	  }
4232	done
4233	IFS="$save_ifs"
4234
4235	# Restore the uninstalled library and exit
4236	if test "$mode" = relink; then
4237	  $run eval '(cd $output_objdir && $rm ${realname}T && $mv $realname ${realname}T && $mv "$realname"U $realname)' || exit $?
4238
4239	  if test -n "$convenience"; then
4240	    if test -z "$whole_archive_flag_spec"; then
4241	      $show "${rm}r $gentop"
4242	      $run ${rm}r "$gentop"
4243	    fi
4244	  fi
4245
4246	  exit $EXIT_SUCCESS
4247	fi
4248
4249	# Create links to the real library.
4250	for linkname in $linknames; do
4251	  if test "$realname" != "$linkname"; then
4252	    $show "(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)"
4253	    $run eval '(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)' || exit $?
4254	  fi
4255	done
4256
4257	# If -module or -export-dynamic was specified, set the dlname.
4258	if test "$module" = yes || test "$export_dynamic" = yes; then
4259	  # On all known operating systems, these are identical.
4260	  dlname="$soname"
4261	fi
4262      fi
4263      ;;
4264
4265    obj)
4266      case " $deplibs" in
4267      *\ -l* | *\ -L*)
4268	$echo "$modename: warning: \`-l' and \`-L' are ignored for objects" 1>&2 ;;
4269      esac
4270
4271      if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
4272	$echo "$modename: warning: \`-dlopen' is ignored for objects" 1>&2
4273      fi
4274
4275      if test -n "$rpath"; then
4276	$echo "$modename: warning: \`-rpath' is ignored for objects" 1>&2
4277      fi
4278
4279      if test -n "$xrpath"; then
4280	$echo "$modename: warning: \`-R' is ignored for objects" 1>&2
4281      fi
4282
4283      if test -n "$vinfo"; then
4284	$echo "$modename: warning: \`-version-info' is ignored for objects" 1>&2
4285      fi
4286
4287      if test -n "$release"; then
4288	$echo "$modename: warning: \`-release' is ignored for objects" 1>&2
4289      fi
4290
4291      case $output in
4292      *.lo)
4293	if test -n "$objs$old_deplibs"; then
4294	  $echo "$modename: cannot build library object \`$output' from non-libtool objects" 1>&2
4295	  exit $EXIT_FAILURE
4296	fi
4297	libobj="$output"
4298	obj=`$echo "X$output" | $Xsed -e "$lo2o"`
4299	;;
4300      *)
4301	libobj=
4302	obj="$output"
4303	;;
4304      esac
4305
4306      # Delete the old objects.
4307      $run $rm $obj $libobj
4308
4309      # Objects from convenience libraries.  This assumes
4310      # single-version convenience libraries.  Whenever we create
4311      # different ones for PIC/non-PIC, this we'll have to duplicate
4312      # the extraction.
4313      reload_conv_objs=
4314      gentop=
4315      # reload_cmds runs $LD directly, so let us get rid of
4316      # -Wl from whole_archive_flag_spec and hope we can get by with
4317      # turning comma into space..
4318      wl=
4319
4320      if test -n "$convenience"; then
4321	if test -n "$whole_archive_flag_spec"; then
4322	  eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\"
4323	  reload_conv_objs=$reload_objs\ `$echo "X$tmp_whole_archive_flags" | $Xsed -e 's|,| |g'`
4324	else
4325	  gentop="$output_objdir/${obj}x"
4326	  generated="$generated $gentop"
4327
4328	  func_extract_archives $gentop $convenience
4329	  reload_conv_objs="$reload_objs $func_extract_archives_result"
4330	fi
4331      fi
4332
4333      # Create the old-style object.
4334      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
4335
4336      output="$obj"
4337      cmds=$reload_cmds
4338      save_ifs="$IFS"; IFS='~'
4339      for cmd in $cmds; do
4340	IFS="$save_ifs"
4341	eval cmd=\"$cmd\"
4342	$show "$cmd"
4343	$run eval "$cmd" || exit $?
4344      done
4345      IFS="$save_ifs"
4346
4347      # Exit if we aren't doing a library object file.
4348      if test -z "$libobj"; then
4349	if test -n "$gentop"; then
4350	  $show "${rm}r $gentop"
4351	  $run ${rm}r $gentop
4352	fi
4353
4354	exit $EXIT_SUCCESS
4355      fi
4356
4357      if test "$build_libtool_libs" != yes; then
4358	if test -n "$gentop"; then
4359	  $show "${rm}r $gentop"
4360	  $run ${rm}r $gentop
4361	fi
4362
4363	# Create an invalid libtool object if no PIC, so that we don't
4364	# accidentally link it into a program.
4365	# $show "echo timestamp > $libobj"
4366	# $run eval "echo timestamp > $libobj" || exit $?
4367	exit $EXIT_SUCCESS
4368      fi
4369
4370      if test -n "$pic_flag" || test "$pic_mode" != default; then
4371	# Only do commands if we really have different PIC objects.
4372	reload_objs="$libobjs $reload_conv_objs"
4373	output="$libobj"
4374	cmds=$reload_cmds
4375	save_ifs="$IFS"; IFS='~'
4376	for cmd in $cmds; do
4377	  IFS="$save_ifs"
4378	  eval cmd=\"$cmd\"
4379	  $show "$cmd"
4380	  $run eval "$cmd" || exit $?
4381	done
4382	IFS="$save_ifs"
4383      fi
4384
4385      if test -n "$gentop"; then
4386	$show "${rm}r $gentop"
4387	$run ${rm}r $gentop
4388      fi
4389
4390      exit $EXIT_SUCCESS
4391      ;;
4392
4393    prog)
4394      case $host in
4395	*cygwin*) output=`$echo $output | ${SED} -e 's,.exe$,,;s,$,.exe,'` ;;
4396      esac
4397      if test -n "$vinfo"; then
4398	$echo "$modename: warning: \`-version-info' is ignored for programs" 1>&2
4399      fi
4400
4401      if test -n "$release"; then
4402	$echo "$modename: warning: \`-release' is ignored for programs" 1>&2
4403      fi
4404
4405      if test "$preload" = yes; then
4406	if test "$dlopen_support" = unknown && test "$dlopen_self" = unknown &&
4407	   test "$dlopen_self_static" = unknown; then
4408	  $echo "$modename: warning: \`AC_LIBTOOL_DLOPEN' not used. Assuming no dlopen support."
4409	fi
4410      fi
4411
4412      case $host in
4413      *-*-rhapsody* | *-*-darwin1.[012])
4414	# On Rhapsody replace the C library is the System framework
4415	compile_deplibs=`$echo "X $compile_deplibs" | $Xsed -e 's/ -lc / -framework System /'`
4416	finalize_deplibs=`$echo "X $finalize_deplibs" | $Xsed -e 's/ -lc / -framework System /'`
4417	;;
4418      esac
4419
4420      case $host in
4421      *darwin*)
4422        # Don't allow lazy linking, it breaks C++ global constructors
4423        if test "$tagname" = CXX ; then
4424        compile_command="$compile_command ${wl}-bind_at_load"
4425        finalize_command="$finalize_command ${wl}-bind_at_load"
4426        fi
4427        ;;
4428      esac
4429
4430
4431      # move library search paths that coincide with paths to not yet
4432      # installed libraries to the beginning of the library search list
4433      new_libs=
4434      for path in $notinst_path; do
4435	case " $new_libs " in
4436	*" -L$path/$objdir "*) ;;
4437	*)
4438	  case " $compile_deplibs " in
4439	  *" -L$path/$objdir "*)
4440	    new_libs="$new_libs -L$path/$objdir" ;;
4441	  esac
4442	  ;;
4443	esac
4444      done
4445      for deplib in $compile_deplibs; do
4446	case $deplib in
4447	-L*)
4448	  case " $new_libs " in
4449	  *" $deplib "*) ;;
4450	  *) new_libs="$new_libs $deplib" ;;
4451	  esac
4452	  ;;
4453	*) new_libs="$new_libs $deplib" ;;
4454	esac
4455      done
4456      compile_deplibs="$new_libs"
4457
4458
4459      compile_command="$compile_command $compile_deplibs"
4460      finalize_command="$finalize_command $finalize_deplibs"
4461
4462      if test -n "$rpath$xrpath"; then
4463	# If the user specified any rpath flags, then add them.
4464	for libdir in $rpath $xrpath; do
4465	  # This is the magic to use -rpath.
4466	  case "$finalize_rpath " in
4467	  *" $libdir "*) ;;
4468	  *) finalize_rpath="$finalize_rpath $libdir" ;;
4469	  esac
4470	done
4471      fi
4472
4473      # Now hardcode the library paths
4474      rpath=
4475      hardcode_libdirs=
4476      for libdir in $compile_rpath $finalize_rpath; do
4477	if test -n "$hardcode_libdir_flag_spec"; then
4478	  if test -n "$hardcode_libdir_separator"; then
4479	    if test -z "$hardcode_libdirs"; then
4480	      hardcode_libdirs="$libdir"
4481	    else
4482	      # Just accumulate the unique libdirs.
4483	      case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
4484	      *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
4485		;;
4486	      *)
4487		hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
4488		;;
4489	      esac
4490	    fi
4491	  else
4492	    eval flag=\"$hardcode_libdir_flag_spec\"
4493	    rpath="$rpath $flag"
4494	  fi
4495	elif test -n "$runpath_var"; then
4496	  case "$perm_rpath " in
4497	  *" $libdir "*) ;;
4498	  *) perm_rpath="$perm_rpath $libdir" ;;
4499	  esac
4500	fi
4501	case $host in
4502	*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
4503	  testbindir=`$echo "X$libdir" | $Xsed -e 's*/lib$*/bin*'`
4504	  case :$dllsearchpath: in
4505	  *":$libdir:"*) ;;
4506	  *) dllsearchpath="$dllsearchpath:$libdir";;
4507	  esac
4508	  case :$dllsearchpath: in
4509	  *":$testbindir:"*) ;;
4510	  *) dllsearchpath="$dllsearchpath:$testbindir";;
4511	  esac
4512	  ;;
4513	esac
4514      done
4515      # Substitute the hardcoded libdirs into the rpath.
4516      if test -n "$hardcode_libdir_separator" &&
4517	 test -n "$hardcode_libdirs"; then
4518	libdir="$hardcode_libdirs"
4519	eval rpath=\" $hardcode_libdir_flag_spec\"
4520      fi
4521      compile_rpath="$rpath"
4522
4523      rpath=
4524      hardcode_libdirs=
4525      for libdir in $finalize_rpath; do
4526	if test -n "$hardcode_libdir_flag_spec"; then
4527	  if test -n "$hardcode_libdir_separator"; then
4528	    if test -z "$hardcode_libdirs"; then
4529	      hardcode_libdirs="$libdir"
4530	    else
4531	      # Just accumulate the unique libdirs.
4532	      case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
4533	      *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
4534		;;
4535	      *)
4536		hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
4537		;;
4538	      esac
4539	    fi
4540	  else
4541	    eval flag=\"$hardcode_libdir_flag_spec\"
4542	    rpath="$rpath $flag"
4543	  fi
4544	elif test -n "$runpath_var"; then
4545	  case "$finalize_perm_rpath " in
4546	  *" $libdir "*) ;;
4547	  *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;;
4548	  esac
4549	fi
4550      done
4551      # Substitute the hardcoded libdirs into the rpath.
4552      if test -n "$hardcode_libdir_separator" &&
4553	 test -n "$hardcode_libdirs"; then
4554	libdir="$hardcode_libdirs"
4555	eval rpath=\" $hardcode_libdir_flag_spec\"
4556      fi
4557      finalize_rpath="$rpath"
4558
4559      if test -n "$libobjs" && test "$build_old_libs" = yes; then
4560	# Transform all the library objects into standard objects.
4561	compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
4562	finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
4563      fi
4564
4565      dlsyms=
4566      if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
4567	if test -n "$NM" && test -n "$global_symbol_pipe"; then
4568	  dlsyms="${outputname}S.c"
4569	else
4570	  $echo "$modename: not configured to extract global symbols from dlpreopened files" 1>&2
4571	fi
4572      fi
4573
4574      if test -n "$dlsyms"; then
4575	case $dlsyms in
4576	"") ;;
4577	*.c)
4578	  # Discover the nlist of each of the dlfiles.
4579	  nlist="$output_objdir/${outputname}.nm"
4580
4581	  $show "$rm $nlist ${nlist}S ${nlist}T"
4582	  $run $rm "$nlist" "${nlist}S" "${nlist}T"
4583
4584	  # Parse the name list into a source file.
4585	  $show "creating $output_objdir/$dlsyms"
4586
4587	  test -z "$run" && $echo > "$output_objdir/$dlsyms" "\
4588/* $dlsyms - symbol resolution table for \`$outputname' dlsym emulation. */
4589/* Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP */
4590
4591#ifdef __cplusplus
4592extern \"C\" {
4593#endif
4594
4595/* Prevent the only kind of declaration conflicts we can make. */
4596#define lt_preloaded_symbols some_other_symbol
4597
4598/* External symbol declarations for the compiler. */\
4599"
4600
4601	  if test "$dlself" = yes; then
4602	    $show "generating symbol list for \`$output'"
4603
4604	    test -z "$run" && $echo ': @PROGRAM@ ' > "$nlist"
4605
4606	    # Add our own program objects to the symbol list.
4607	    progfiles=`$echo "X$objs$old_deplibs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
4608	    for arg in $progfiles; do
4609	      $show "extracting global C symbols from \`$arg'"
4610	      $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
4611	    done
4612
4613	    if test -n "$exclude_expsyms"; then
4614	      $run eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
4615	      $run eval '$mv "$nlist"T "$nlist"'
4616	    fi
4617
4618	    if test -n "$export_symbols_regex"; then
4619	      $run eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T'
4620	      $run eval '$mv "$nlist"T "$nlist"'
4621	    fi
4622
4623	    # Prepare the list of exported symbols
4624	    if test -z "$export_symbols"; then
4625	      export_symbols="$output_objdir/$outputname.exp"
4626	      $run $rm $export_symbols
4627	      $run eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
4628              case $host in
4629              *cygwin* | *mingw* )
4630	        $run eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
4631		$run eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"'
4632                ;;
4633              esac
4634	    else
4635	      $run eval "${SED} -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"'
4636	      $run eval 'grep -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T'
4637	      $run eval 'mv "$nlist"T "$nlist"'
4638              case $host in
4639              *cygwin* | *mingw* )
4640	        $run eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
4641		$run eval 'cat "$nlist" >> "$output_objdir/$outputname.def"'
4642                ;;
4643              esac
4644	    fi
4645	  fi
4646
4647	  for arg in $dlprefiles; do
4648	    $show "extracting global C symbols from \`$arg'"
4649	    name=`$echo "$arg" | ${SED} -e 's%^.*/%%'`
4650	    $run eval '$echo ": $name " >> "$nlist"'
4651	    $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
4652	  done
4653
4654	  if test -z "$run"; then
4655	    # Make sure we have at least an empty file.
4656	    test -f "$nlist" || : > "$nlist"
4657
4658	    if test -n "$exclude_expsyms"; then
4659	      $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T
4660	      $mv "$nlist"T "$nlist"
4661	    fi
4662
4663	    # Try sorting and uniquifying the output.
4664	    if grep -v "^: " < "$nlist" |
4665		if sort -k 3 </dev/null >/dev/null 2>&1; then
4666		  sort -k 3
4667		else
4668		  sort +2
4669		fi |
4670		uniq > "$nlist"S; then
4671	      :
4672	    else
4673	      grep -v "^: " < "$nlist" > "$nlist"S
4674	    fi
4675
4676	    if test -f "$nlist"S; then
4677	      eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$dlsyms"'
4678	    else
4679	      $echo '/* NONE */' >> "$output_objdir/$dlsyms"
4680	    fi
4681
4682	    $echo >> "$output_objdir/$dlsyms" "\
4683
4684#undef lt_preloaded_symbols
4685
4686#if defined (__STDC__) && __STDC__
4687# define lt_ptr void *
4688#else
4689# define lt_ptr char *
4690# define const
4691#endif
4692
4693/* The mapping between symbol names and symbols. */
4694"
4695
4696	    case $host in
4697	    *cygwin* | *mingw* )
4698	  $echo >> "$output_objdir/$dlsyms" "\
4699/* DATA imports from DLLs on WIN32 can't be const, because
4700   runtime relocations are performed -- see ld's documentation
4701   on pseudo-relocs */
4702struct {
4703"
4704	      ;;
4705	    * )
4706	  $echo >> "$output_objdir/$dlsyms" "\
4707const struct {
4708"
4709	      ;;
4710	    esac
4711
4712
4713	  $echo >> "$output_objdir/$dlsyms" "\
4714  const char *name;
4715  lt_ptr address;
4716}
4717lt_preloaded_symbols[] =
4718{\
4719"
4720
4721	    eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$dlsyms"
4722
4723	    $echo >> "$output_objdir/$dlsyms" "\
4724  {0, (lt_ptr) 0}
4725};
4726
4727/* This works around a problem in FreeBSD linker */
4728#ifdef FREEBSD_WORKAROUND
4729static const void *lt_preloaded_setup() {
4730  return lt_preloaded_symbols;
4731}
4732#endif
4733
4734#ifdef __cplusplus
4735}
4736#endif\
4737"
4738	  fi
4739
4740	  pic_flag_for_symtable=
4741	  case $host in
4742	  # compiling the symbol table file with pic_flag works around
4743	  # a FreeBSD bug that causes programs to crash when -lm is
4744	  # linked before any other PIC object.  But we must not use
4745	  # pic_flag when linking with -static.  The problem exists in
4746	  # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1.
4747	  *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)
4748	    case "$compile_command " in
4749	    *" -static "*) ;;
4750	    *) pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND";;
4751	    esac;;
4752	  *-*-hpux*)
4753	    case "$compile_command " in
4754	    *" -static "*) ;;
4755	    *) pic_flag_for_symtable=" $pic_flag";;
4756	    esac
4757	  esac
4758
4759	  # Now compile the dynamic symbol file.
4760	  $show "(cd $output_objdir && $LTCC  $LTCFLAGS -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")"
4761	  $run eval '(cd $output_objdir && $LTCC  $LTCFLAGS -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $?
4762
4763	  # Clean up the generated files.
4764	  $show "$rm $output_objdir/$dlsyms $nlist ${nlist}S ${nlist}T"
4765	  $run $rm "$output_objdir/$dlsyms" "$nlist" "${nlist}S" "${nlist}T"
4766
4767	  # Transform the symbol file into the correct name.
4768          case $host in
4769          *cygwin* | *mingw* )
4770            if test -f "$output_objdir/${outputname}.def" ; then
4771              compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}.def $output_objdir/${outputname}S.${objext}%" | $NL2SP`
4772              finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}.def $output_objdir/${outputname}S.${objext}%" | $NL2SP`
4773            else
4774              compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%" | $NL2SP`
4775              finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%" | $NL2SP`
4776             fi
4777            ;;
4778          * )
4779            compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%" | $NL2SP`
4780            finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%" | $NL2SP`
4781            ;;
4782          esac
4783	  ;;
4784	*)
4785	  $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2
4786	  exit $EXIT_FAILURE
4787	  ;;
4788	esac
4789      else
4790	# We keep going just in case the user didn't refer to
4791	# lt_preloaded_symbols.  The linker will fail if global_symbol_pipe
4792	# really was required.
4793
4794	# Nullify the symbol file.
4795	compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "s% @SYMFILE@%%" | $NL2SP`
4796	finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "s% @SYMFILE@%%" | $NL2SP`
4797      fi
4798
4799      if test "$need_relink" = no || test "$build_libtool_libs" != yes; then
4800	# Replace the output file specification.
4801	compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e 's%@OUTPUT@%'"$output"'%g' | $NL2SP`
4802	link_command="$compile_command$compile_rpath"
4803
4804	# We have no uninstalled library dependencies, so finalize right now.
4805	$show "$link_command"
4806	$run eval "$link_command"
4807	exit_status=$?
4808
4809	# Delete the generated files.
4810	if test -n "$dlsyms"; then
4811	  $show "$rm $output_objdir/${outputname}S.${objext}"
4812	  $run $rm "$output_objdir/${outputname}S.${objext}"
4813	fi
4814
4815	exit $exit_status
4816      fi
4817
4818      if test -n "$shlibpath_var"; then
4819	# We should set the shlibpath_var
4820	rpath=
4821	for dir in $temp_rpath; do
4822	  case $dir in
4823	  [\\/]* | [A-Za-z]:[\\/]*)
4824	    # Absolute path.
4825	    rpath="$rpath$dir:"
4826	    ;;
4827	  *)
4828	    # Relative path: add a thisdir entry.
4829	    rpath="$rpath\$thisdir/$dir:"
4830	    ;;
4831	  esac
4832	done
4833	temp_rpath="$rpath"
4834      fi
4835
4836      if test -n "$compile_shlibpath$finalize_shlibpath"; then
4837	compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command"
4838      fi
4839      if test -n "$finalize_shlibpath"; then
4840	finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command"
4841      fi
4842
4843      compile_var=
4844      finalize_var=
4845      if test -n "$runpath_var"; then
4846	if test -n "$perm_rpath"; then
4847	  # We should set the runpath_var.
4848	  rpath=
4849	  for dir in $perm_rpath; do
4850	    rpath="$rpath$dir:"
4851	  done
4852	  compile_var="$runpath_var=\"$rpath\$$runpath_var\" "
4853	fi
4854	if test -n "$finalize_perm_rpath"; then
4855	  # We should set the runpath_var.
4856	  rpath=
4857	  for dir in $finalize_perm_rpath; do
4858	    rpath="$rpath$dir:"
4859	  done
4860	  finalize_var="$runpath_var=\"$rpath\$$runpath_var\" "
4861	fi
4862      fi
4863
4864      if test "$no_install" = yes; then
4865	# We don't need to create a wrapper script.
4866	link_command="$compile_var$compile_command$compile_rpath"
4867	# Replace the output file specification.
4868	link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
4869	# Delete the old output file.
4870	$run $rm $output
4871	# Link the executable and exit
4872	$show "$link_command"
4873	$run eval "$link_command" || exit $?
4874	exit $EXIT_SUCCESS
4875      fi
4876
4877      if test "$hardcode_action" = relink; then
4878	# Fast installation is not supported
4879	link_command="$compile_var$compile_command$compile_rpath"
4880	relink_command="$finalize_var$finalize_command$finalize_rpath"
4881
4882	$echo "$modename: warning: this platform does not like uninstalled shared libraries" 1>&2
4883	$echo "$modename: \`$output' will be relinked during installation" 1>&2
4884      else
4885	if test "$fast_install" != no; then
4886	  link_command="$finalize_var$compile_command$finalize_rpath"
4887	  if test "$fast_install" = yes; then
4888	    relink_command=`$echo "X$compile_var$compile_command$compile_rpath" | $SP2NL | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g' | $NL2SP`
4889	  else
4890	    # fast_install is set to needless
4891	    relink_command=
4892	  fi
4893	else
4894	  link_command="$compile_var$compile_command$compile_rpath"
4895	  relink_comman