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