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