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