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