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