ltmain.sh revision 39713583
139713583Smrg# Generated from ltmain.m4sh.
239713583Smrg
339713583Smrg# ltmain.sh (GNU libtool) 2.2.6
439713583Smrg# Written by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
539713583Smrg
639713583Smrg# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006, 2007 2008 Free Software Foundation, Inc.
739713583Smrg# This is free software; see the source for copying conditions.  There is NO
839713583Smrg# warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
939713583Smrg
1039713583Smrg# GNU Libtool is free software; you can redistribute it and/or modify
1195b296d0Smrg# it under the terms of the GNU General Public License as published by
1295b296d0Smrg# the Free Software Foundation; either version 2 of the License, or
1395b296d0Smrg# (at your option) any later version.
1495b296d0Smrg#
1539713583Smrg# As a special exception to the GNU General Public License,
1639713583Smrg# if you distribute this file as part of a program or library that
1739713583Smrg# is built using GNU Libtool, you may include this file under the
1839713583Smrg# same distribution terms that you use for the rest of that program.
1939713583Smrg#
2039713583Smrg# GNU Libtool is distributed in the hope that it will be useful, but
2195b296d0Smrg# WITHOUT ANY WARRANTY; without even the implied warranty of
2295b296d0Smrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
2395b296d0Smrg# General Public License for more details.
2495b296d0Smrg#
2595b296d0Smrg# You should have received a copy of the GNU General Public License
2639713583Smrg# along with GNU Libtool; see the file COPYING.  If not, a copy
2739713583Smrg# can be downloaded from http://www.gnu.org/licenses/gpl.html,
2839713583Smrg# or obtained by writing to the Free Software Foundation, Inc.,
2939713583Smrg# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
3095b296d0Smrg
3139713583Smrg# Usage: $progname [OPTION]... [MODE-ARG]...
3239713583Smrg#
3339713583Smrg# Provide generalized library-building support services.
3439713583Smrg#
3539713583Smrg#     --config             show all configuration variables
3639713583Smrg#     --debug              enable verbose shell tracing
3739713583Smrg# -n, --dry-run            display commands without modifying any files
3839713583Smrg#     --features           display basic configuration information and exit
3939713583Smrg#     --mode=MODE          use operation mode MODE
4039713583Smrg#     --preserve-dup-deps  don't remove duplicate dependency libraries
4139713583Smrg#     --quiet, --silent    don't print informational messages
4239713583Smrg#     --tag=TAG            use configuration variables from tag TAG
4339713583Smrg# -v, --verbose            print informational messages (default)
4439713583Smrg#     --version            print version information
4539713583Smrg# -h, --help               print short or long help message
4639713583Smrg#
4739713583Smrg# MODE must be one of the following:
4839713583Smrg#
4939713583Smrg#       clean              remove files from the build directory
5039713583Smrg#       compile            compile a source file into a libtool object
5139713583Smrg#       execute            automatically set library path, then run a program
5239713583Smrg#       finish             complete the installation of libtool libraries
5339713583Smrg#       install            install libraries or executables
5439713583Smrg#       link               create a library or an executable
5539713583Smrg#       uninstall          remove libraries from an installed directory
5639713583Smrg#
5739713583Smrg# MODE-ARGS vary depending on the MODE.
5839713583Smrg# Try `$progname --help --mode=MODE' for a more detailed description of MODE.
5939713583Smrg#
6039713583Smrg# When reporting a bug, please describe a test case to reproduce it and
6139713583Smrg# include the following information:
6239713583Smrg#
6339713583Smrg#       host-triplet:	$host
6439713583Smrg#       shell:		$SHELL
6539713583Smrg#       compiler:		$LTCC
6639713583Smrg#       compiler flags:		$LTCFLAGS
6739713583Smrg#       linker:		$LD (gnu? $with_gnu_ld)
6839713583Smrg#       $progname:		(GNU libtool) 2.2.6
6939713583Smrg#       automake:		$automake_version
7039713583Smrg#       autoconf:		$autoconf_version
7139713583Smrg#
7239713583Smrg# Report bugs to <bug-libtool@gnu.org>.
7395b296d0Smrg
7495b296d0SmrgPROGRAM=ltmain.sh
7595b296d0SmrgPACKAGE=libtool
7639713583SmrgVERSION=2.2.6
7739713583SmrgTIMESTAMP=""
7839713583Smrgpackage_revision=1.3012
79ff89ac2bSmrg
8039713583Smrg# Be Bourne compatible
81ff89ac2bSmrgif test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
82ff89ac2bSmrg  emulate sh
83ff89ac2bSmrg  NULLCMD=:
84ff89ac2bSmrg  # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
85ff89ac2bSmrg  # is contrary to our usage.  Disable this feature.
86ff89ac2bSmrg  alias -g '${1+"$@"}'='"$@"'
8795b296d0Smrg  setopt NO_GLOB_SUBST
88ff89ac2bSmrgelse
89ff89ac2bSmrg  case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac
9095b296d0Smrgfi
91ff89ac2bSmrgBIN_SH=xpg4; export BIN_SH # for Tru64
92ff89ac2bSmrgDUALCASE=1; export DUALCASE # for MKS sh
9395b296d0Smrg
9439713583Smrg# NLS nuisances: We save the old values to restore during execute mode.
9595b296d0Smrg# Only set LANG and LC_ALL to C if already set.
9695b296d0Smrg# These must not be set unconditionally because not all systems understand
9795b296d0Smrg# e.g. LANG=C (notably SCO).
9839713583Smrglt_user_locale=
9939713583Smrglt_safe_locale=
100ff89ac2bSmrgfor lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
101ff89ac2bSmrgdo
102ff89ac2bSmrg  eval "if test \"\${$lt_var+set}\" = set; then
10339713583Smrg          save_$lt_var=\$$lt_var
10439713583Smrg          $lt_var=C
105ff89ac2bSmrg	  export $lt_var
10639713583Smrg	  lt_user_locale=\"$lt_var=\\\$save_\$lt_var; \$lt_user_locale\"
10739713583Smrg	  lt_safe_locale=\"$lt_var=C; \$lt_safe_locale\"
108ff89ac2bSmrg	fi"
109ff89ac2bSmrgdone
110ff89ac2bSmrg
11139713583Smrg$lt_unset CDPATH
11239713583Smrg
11339713583Smrg
11439713583Smrg
11539713583Smrg
11639713583Smrg
11739713583Smrg: ${CP="cp -f"}
11839713583Smrg: ${ECHO="echo"}
11939713583Smrg: ${EGREP="/bin/grep -E"}
12039713583Smrg: ${FGREP="/bin/grep -F"}
12139713583Smrg: ${GREP="/bin/grep"}
12239713583Smrg: ${LN_S="ln -s"}
12339713583Smrg: ${MAKE="make"}
12439713583Smrg: ${MKDIR="mkdir"}
12539713583Smrg: ${MV="mv -f"}
12639713583Smrg: ${RM="rm -f"}
12739713583Smrg: ${SED="/bin/sed"}
12839713583Smrg: ${SHELL="${CONFIG_SHELL-/bin/sh}"}
12939713583Smrg: ${Xsed="$SED -e 1s/^X//"}
13039713583Smrg
13139713583Smrg# Global variables:
13239713583SmrgEXIT_SUCCESS=0
13339713583SmrgEXIT_FAILURE=1
13439713583SmrgEXIT_MISMATCH=63  # $? = 63 is used to indicate version mismatch to missing.
13539713583SmrgEXIT_SKIP=77	  # $? = 77 is used to indicate a skipped test to automake.
13639713583Smrg
13739713583Smrgexit_status=$EXIT_SUCCESS
13895b296d0Smrg
13995b296d0Smrg# Make sure IFS has a sensible default
14095b296d0Smrglt_nl='
14195b296d0Smrg'
14295b296d0SmrgIFS=" 	$lt_nl"
14395b296d0Smrg
14439713583Smrgdirname="s,/[^/]*$,,"
14539713583Smrgbasename="s,^.*/,,"
14639713583Smrg
14739713583Smrg# func_dirname_and_basename file append nondir_replacement
14839713583Smrg# perform func_basename and func_dirname in a single function
14939713583Smrg# call:
15039713583Smrg#   dirname:  Compute the dirname of FILE.  If nonempty,
15139713583Smrg#             add APPEND to the result, otherwise set result
15239713583Smrg#             to NONDIR_REPLACEMENT.
15339713583Smrg#             value returned in "$func_dirname_result"
15439713583Smrg#   basename: Compute filename of FILE.
15539713583Smrg#             value retuned in "$func_basename_result"
15639713583Smrg# Implementation must be kept synchronized with func_dirname
15739713583Smrg# and func_basename. For efficiency, we do not delegate to
15839713583Smrg# those functions but instead duplicate the functionality here.
15939713583Smrgfunc_dirname_and_basename ()
16039713583Smrg{
16139713583Smrg  # Extract subdirectory from the argument.
16239713583Smrg  func_dirname_result=`$ECHO "X${1}" | $Xsed -e "$dirname"`
16339713583Smrg  if test "X$func_dirname_result" = "X${1}"; then
16439713583Smrg    func_dirname_result="${3}"
16539713583Smrg  else
16639713583Smrg    func_dirname_result="$func_dirname_result${2}"
16739713583Smrg  fi
16839713583Smrg  func_basename_result=`$ECHO "X${1}" | $Xsed -e "$basename"`
16939713583Smrg}
17095b296d0Smrg
17139713583Smrg# Generated shell functions inserted here.
17239713583Smrg
17339713583Smrg# Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh
17439713583Smrg# is ksh but when the shell is invoked as "sh" and the current value of
17539713583Smrg# the _XPG environment variable is not equal to 1 (one), the special
17639713583Smrg# positional parameter $0, within a function call, is the name of the
17739713583Smrg# function.
17839713583Smrgprogpath="$0"
17939713583Smrg
18039713583Smrg# The name of this program:
18139713583Smrg# In the unlikely event $progname began with a '-', it would play havoc with
18239713583Smrg# func_echo (imagine progname=-n), so we prepend ./ in that case:
18339713583Smrgfunc_dirname_and_basename "$progpath"
18439713583Smrgprogname=$func_basename_result
18539713583Smrgcase $progname in
18639713583Smrg  -*) progname=./$progname ;;
18739713583Smrgesac
18839713583Smrg
18939713583Smrg# Make sure we have an absolute path for reexecution:
19039713583Smrgcase $progpath in
19139713583Smrg  [\\/]*|[A-Za-z]:\\*) ;;
19239713583Smrg  *[\\/]*)
19339713583Smrg     progdir=$func_dirname_result
19439713583Smrg     progdir=`cd "$progdir" && pwd`
19539713583Smrg     progpath="$progdir/$progname"
19639713583Smrg     ;;
19739713583Smrg  *)
19839713583Smrg     save_IFS="$IFS"
19939713583Smrg     IFS=:
20039713583Smrg     for progdir in $PATH; do
20139713583Smrg       IFS="$save_IFS"
20239713583Smrg       test -x "$progdir/$progname" && break
20339713583Smrg     done
20439713583Smrg     IFS="$save_IFS"
20539713583Smrg     test -n "$progdir" || progdir=`pwd`
20639713583Smrg     progpath="$progdir/$progname"
20739713583Smrg     ;;
20839713583Smrgesac
20939713583Smrg
21039713583Smrg# Sed substitution that helps us do robust quoting.  It backslashifies
21139713583Smrg# metacharacters that are still active within double-quoted strings.
21239713583SmrgXsed="${SED}"' -e 1s/^X//'
21339713583Smrgsed_quote_subst='s/\([`"$\\]\)/\\\1/g'
21439713583Smrg
21539713583Smrg# Same as above, but do not quote variable references.
21639713583Smrgdouble_quote_subst='s/\(["`\\]\)/\\\1/g'
21739713583Smrg
21839713583Smrg# Re-`\' parameter expansions in output of double_quote_subst that were
21939713583Smrg# `\'-ed in input to the same.  If an odd number of `\' preceded a '$'
22039713583Smrg# in input to double_quote_subst, that '$' was protected from expansion.
22139713583Smrg# Since each input `\' is now two `\'s, look for any number of runs of
22239713583Smrg# four `\'s followed by two `\'s and then a '$'.  `\' that '$'.
22339713583Smrgbs='\\'
22439713583Smrgbs2='\\\\'
22539713583Smrgbs4='\\\\\\\\'
22639713583Smrgdollar='\$'
22739713583Smrgsed_double_backslash="\
22839713583Smrg  s/$bs4/&\\
22939713583Smrg/g
23039713583Smrg  s/^$bs2$dollar/$bs&/
23139713583Smrg  s/\\([^$bs]\\)$bs2$dollar/\\1$bs2$bs$dollar/g
23239713583Smrg  s/\n//g"
23339713583Smrg
23439713583Smrg# Standard options:
23539713583Smrgopt_dry_run=false
23639713583Smrgopt_help=false
23739713583Smrgopt_quiet=false
23839713583Smrgopt_verbose=false
23939713583Smrgopt_warning=:
24039713583Smrg
24139713583Smrg# func_echo arg...
24239713583Smrg# Echo program name prefixed message, along with the current mode
24339713583Smrg# name if it has been set yet.
24439713583Smrgfunc_echo ()
24539713583Smrg{
24639713583Smrg    $ECHO "$progname${mode+: }$mode: $*"
24739713583Smrg}
24839713583Smrg
24939713583Smrg# func_verbose arg...
25039713583Smrg# Echo program name prefixed message in verbose mode only.
25139713583Smrgfunc_verbose ()
25239713583Smrg{
25339713583Smrg    $opt_verbose && func_echo ${1+"$@"}
25439713583Smrg
25539713583Smrg    # A bug in bash halts the script if the last line of a function
25639713583Smrg    # fails when set -e is in force, so we need another command to
25739713583Smrg    # work around that:
25839713583Smrg    :
25939713583Smrg}
26039713583Smrg
26139713583Smrg# func_error arg...
26239713583Smrg# Echo program name prefixed message to standard error.
26339713583Smrgfunc_error ()
26439713583Smrg{
26539713583Smrg    $ECHO "$progname${mode+: }$mode: "${1+"$@"} 1>&2
26639713583Smrg}
26739713583Smrg
26839713583Smrg# func_warning arg...
26939713583Smrg# Echo program name prefixed warning message to standard error.
27039713583Smrgfunc_warning ()
27139713583Smrg{
27239713583Smrg    $opt_warning && $ECHO "$progname${mode+: }$mode: warning: "${1+"$@"} 1>&2
27339713583Smrg
27439713583Smrg    # bash bug again:
27539713583Smrg    :
27639713583Smrg}
27739713583Smrg
27839713583Smrg# func_fatal_error arg...
27939713583Smrg# Echo program name prefixed message to standard error, and exit.
28039713583Smrgfunc_fatal_error ()
28139713583Smrg{
28239713583Smrg    func_error ${1+"$@"}
28339713583Smrg    exit $EXIT_FAILURE
28439713583Smrg}
28539713583Smrg
28639713583Smrg# func_fatal_help arg...
28739713583Smrg# Echo program name prefixed message to standard error, followed by
28839713583Smrg# a help hint, and exit.
28939713583Smrgfunc_fatal_help ()
29039713583Smrg{
29139713583Smrg    func_error ${1+"$@"}
29239713583Smrg    func_fatal_error "$help"
29339713583Smrg}
29439713583Smrghelp="Try \`$progname --help' for more information."  ## default
29539713583Smrg
29639713583Smrg
29739713583Smrg# func_grep expression filename
29839713583Smrg# Check whether EXPRESSION matches any line of FILENAME, without output.
29939713583Smrgfunc_grep ()
30039713583Smrg{
30139713583Smrg    $GREP "$1" "$2" >/dev/null 2>&1
30239713583Smrg}
30339713583Smrg
30439713583Smrg
30539713583Smrg# func_mkdir_p directory-path
30639713583Smrg# Make sure the entire path to DIRECTORY-PATH is available.
30739713583Smrgfunc_mkdir_p ()
30839713583Smrg{
30939713583Smrg    my_directory_path="$1"
31039713583Smrg    my_dir_list=
31139713583Smrg
31239713583Smrg    if test -n "$my_directory_path" && test "$opt_dry_run" != ":"; then
31339713583Smrg
31439713583Smrg      # Protect directory names starting with `-'
31539713583Smrg      case $my_directory_path in
31639713583Smrg        -*) my_directory_path="./$my_directory_path" ;;
31739713583Smrg      esac
31839713583Smrg
31939713583Smrg      # While some portion of DIR does not yet exist...
32039713583Smrg      while test ! -d "$my_directory_path"; do
32139713583Smrg        # ...make a list in topmost first order.  Use a colon delimited
32239713583Smrg	# list incase some portion of path contains whitespace.
32339713583Smrg        my_dir_list="$my_directory_path:$my_dir_list"
32439713583Smrg
32539713583Smrg        # If the last portion added has no slash in it, the list is done
32639713583Smrg        case $my_directory_path in */*) ;; *) break ;; esac
32739713583Smrg
32839713583Smrg        # ...otherwise throw away the child directory and loop
32939713583Smrg        my_directory_path=`$ECHO "X$my_directory_path" | $Xsed -e "$dirname"`
33039713583Smrg      done
33139713583Smrg      my_dir_list=`$ECHO "X$my_dir_list" | $Xsed -e 's,:*$,,'`
33239713583Smrg
33339713583Smrg      save_mkdir_p_IFS="$IFS"; IFS=':'
33439713583Smrg      for my_dir in $my_dir_list; do
33539713583Smrg	IFS="$save_mkdir_p_IFS"
33639713583Smrg        # mkdir can fail with a `File exist' error if two processes
33739713583Smrg        # try to create one of the directories concurrently.  Don't
33839713583Smrg        # stop in that case!
33939713583Smrg        $MKDIR "$my_dir" 2>/dev/null || :
34039713583Smrg      done
34139713583Smrg      IFS="$save_mkdir_p_IFS"
34239713583Smrg
34339713583Smrg      # Bail out if we (or some other process) failed to create a directory.
34439713583Smrg      test -d "$my_directory_path" || \
34539713583Smrg        func_fatal_error "Failed to create \`$1'"
34639713583Smrg    fi
34739713583Smrg}
34895b296d0Smrg
34995b296d0Smrg
35095b296d0Smrg# func_mktempdir [string]
35195b296d0Smrg# Make a temporary directory that won't clash with other running
35295b296d0Smrg# libtool processes, and avoids race conditions if possible.  If
35395b296d0Smrg# given, STRING is the basename for that directory.
35495b296d0Smrgfunc_mktempdir ()
35595b296d0Smrg{
35695b296d0Smrg    my_template="${TMPDIR-/tmp}/${1-$progname}"
35795b296d0Smrg
35839713583Smrg    if test "$opt_dry_run" = ":"; then
35995b296d0Smrg      # Return a directory name, but don't create it in dry-run mode
36095b296d0Smrg      my_tmpdir="${my_template}-$$"
36195b296d0Smrg    else
36295b296d0Smrg
36395b296d0Smrg      # If mktemp works, use that first and foremost
36495b296d0Smrg      my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null`
36595b296d0Smrg
36695b296d0Smrg      if test ! -d "$my_tmpdir"; then
36739713583Smrg        # Failing that, at least try and use $RANDOM to avoid a race
36839713583Smrg        my_tmpdir="${my_template}-${RANDOM-0}$$"
36995b296d0Smrg
37039713583Smrg        save_mktempdir_umask=`umask`
37139713583Smrg        umask 0077
37239713583Smrg        $MKDIR "$my_tmpdir"
37339713583Smrg        umask $save_mktempdir_umask
37495b296d0Smrg      fi
37595b296d0Smrg
37695b296d0Smrg      # If we're not in dry-run mode, bomb out on failure
37739713583Smrg      test -d "$my_tmpdir" || \
37839713583Smrg        func_fatal_error "cannot create temporary directory \`$my_tmpdir'"
37995b296d0Smrg    fi
38095b296d0Smrg
38139713583Smrg    $ECHO "X$my_tmpdir" | $Xsed
38295b296d0Smrg}
38395b296d0Smrg
38495b296d0Smrg
38539713583Smrg# func_quote_for_eval arg
38639713583Smrg# Aesthetically quote ARG to be evaled later.
38739713583Smrg# This function returns two values: FUNC_QUOTE_FOR_EVAL_RESULT
38839713583Smrg# is double-quoted, suitable for a subsequent eval, whereas
38939713583Smrg# FUNC_QUOTE_FOR_EVAL_UNQUOTED_RESULT has merely all characters
39039713583Smrg# which are still active within double quotes backslashified.
39139713583Smrgfunc_quote_for_eval ()
39295b296d0Smrg{
39339713583Smrg    case $1 in
39439713583Smrg      *[\\\`\"\$]*)
39539713583Smrg	func_quote_for_eval_unquoted_result=`$ECHO "X$1" | $Xsed -e "$sed_quote_subst"` ;;
39639713583Smrg      *)
39739713583Smrg        func_quote_for_eval_unquoted_result="$1" ;;
39839713583Smrg    esac
39939713583Smrg
40039713583Smrg    case $func_quote_for_eval_unquoted_result in
40139713583Smrg      # Double-quote args containing shell metacharacters to delay
40239713583Smrg      # word splitting, command substitution and and variable
40339713583Smrg      # expansion for a subsequent eval.
40439713583Smrg      # Many Bourne shells cannot handle close brackets correctly
40539713583Smrg      # in scan sets, so we specify it separately.
40639713583Smrg      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
40739713583Smrg        func_quote_for_eval_result="\"$func_quote_for_eval_unquoted_result\""
40839713583Smrg        ;;
40939713583Smrg      *)
41039713583Smrg        func_quote_for_eval_result="$func_quote_for_eval_unquoted_result"
41195b296d0Smrg    esac
41295b296d0Smrg}
41395b296d0Smrg
41495b296d0Smrg
41539713583Smrg# func_quote_for_expand arg
41639713583Smrg# Aesthetically quote ARG to be evaled later; same as above,
41739713583Smrg# but do not quote variable references.
41839713583Smrgfunc_quote_for_expand ()
41995b296d0Smrg{
42039713583Smrg    case $1 in
42139713583Smrg      *[\\\`\"]*)
42239713583Smrg	my_arg=`$ECHO "X$1" | $Xsed \
42339713583Smrg	    -e "$double_quote_subst" -e "$sed_double_backslash"` ;;
42495b296d0Smrg      *)
42539713583Smrg        my_arg="$1" ;;
42639713583Smrg    esac
42739713583Smrg
42839713583Smrg    case $my_arg in
42939713583Smrg      # Double-quote args containing shell metacharacters to delay
43039713583Smrg      # word splitting and command substitution for a subsequent eval.
43139713583Smrg      # Many Bourne shells cannot handle close brackets correctly
43239713583Smrg      # in scan sets, so we specify it separately.
43339713583Smrg      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
43439713583Smrg        my_arg="\"$my_arg\""
43539713583Smrg        ;;
43639713583Smrg    esac
43739713583Smrg
43839713583Smrg    func_quote_for_expand_result="$my_arg"
43995b296d0Smrg}
44095b296d0Smrg
44195b296d0Smrg
44239713583Smrg# func_show_eval cmd [fail_exp]
44339713583Smrg# Unless opt_silent is true, then output CMD.  Then, if opt_dryrun is
44439713583Smrg# not true, evaluate CMD.  If the evaluation of CMD fails, and FAIL_EXP
44539713583Smrg# is given, then evaluate it.
44639713583Smrgfunc_show_eval ()
44795b296d0Smrg{
44839713583Smrg    my_cmd="$1"
44939713583Smrg    my_fail_exp="${2-:}"
45095b296d0Smrg
45139713583Smrg    ${opt_silent-false} || {
45239713583Smrg      func_quote_for_expand "$my_cmd"
45339713583Smrg      eval "func_echo $func_quote_for_expand_result"
45439713583Smrg    }
45539713583Smrg
45639713583Smrg    if ${opt_dry_run-false}; then :; else
45739713583Smrg      eval "$my_cmd"
45839713583Smrg      my_status=$?
45939713583Smrg      if test "$my_status" -eq 0; then :; else
46039713583Smrg	eval "(exit $my_status); $my_fail_exp"
46139713583Smrg      fi
46295b296d0Smrg    fi
46395b296d0Smrg}
46495b296d0Smrg
46539713583Smrg
46639713583Smrg# func_show_eval_locale cmd [fail_exp]
46739713583Smrg# Unless opt_silent is true, then output CMD.  Then, if opt_dryrun is
46839713583Smrg# not true, evaluate CMD.  If the evaluation of CMD fails, and FAIL_EXP
46939713583Smrg# is given, then evaluate it.  Use the saved locale for evaluation.
47039713583Smrgfunc_show_eval_locale ()
47195b296d0Smrg{
47239713583Smrg    my_cmd="$1"
47339713583Smrg    my_fail_exp="${2-:}"
47439713583Smrg
47539713583Smrg    ${opt_silent-false} || {
47639713583Smrg      func_quote_for_expand "$my_cmd"
47739713583Smrg      eval "func_echo $func_quote_for_expand_result"
47839713583Smrg    }
47939713583Smrg
48039713583Smrg    if ${opt_dry_run-false}; then :; else
48139713583Smrg      eval "$lt_user_locale
48239713583Smrg	    $my_cmd"
48339713583Smrg      my_status=$?
48439713583Smrg      eval "$lt_safe_locale"
48539713583Smrg      if test "$my_status" -eq 0; then :; else
48639713583Smrg	eval "(exit $my_status); $my_fail_exp"
48739713583Smrg      fi
48895b296d0Smrg    fi
48939713583Smrg}
49095b296d0Smrg
49195b296d0Smrg
49239713583Smrg
49339713583Smrg
49439713583Smrg
49539713583Smrg# func_version
49639713583Smrg# Echo version message to standard output and exit.
49739713583Smrgfunc_version ()
49839713583Smrg{
49939713583Smrg    $SED -n '/^# '$PROGRAM' (GNU /,/# warranty; / {
50039713583Smrg        s/^# //
50139713583Smrg	s/^# *$//
50239713583Smrg        s/\((C)\)[ 0-9,-]*\( [1-9][0-9]*\)/\1\2/
50339713583Smrg        p
50439713583Smrg     }' < "$progpath"
50539713583Smrg     exit $?
50639713583Smrg}
50739713583Smrg
50839713583Smrg# func_usage
50939713583Smrg# Echo short help message to standard output and exit.
51039713583Smrgfunc_usage ()
51139713583Smrg{
51239713583Smrg    $SED -n '/^# Usage:/,/# -h/ {
51339713583Smrg        s/^# //
51439713583Smrg	s/^# *$//
51539713583Smrg	s/\$progname/'$progname'/
51639713583Smrg	p
51739713583Smrg    }' < "$progpath"
51839713583Smrg    $ECHO
51939713583Smrg    $ECHO "run \`$progname --help | more' for full usage"
52039713583Smrg    exit $?
52139713583Smrg}
52239713583Smrg
52339713583Smrg# func_help
52439713583Smrg# Echo long help message to standard output and exit.
52539713583Smrgfunc_help ()
52639713583Smrg{
52739713583Smrg    $SED -n '/^# Usage:/,/# Report bugs to/ {
52839713583Smrg        s/^# //
52939713583Smrg	s/^# *$//
53039713583Smrg	s*\$progname*'$progname'*
53139713583Smrg	s*\$host*'"$host"'*
53239713583Smrg	s*\$SHELL*'"$SHELL"'*
53339713583Smrg	s*\$LTCC*'"$LTCC"'*
53439713583Smrg	s*\$LTCFLAGS*'"$LTCFLAGS"'*
53539713583Smrg	s*\$LD*'"$LD"'*
53639713583Smrg	s/\$with_gnu_ld/'"$with_gnu_ld"'/
53739713583Smrg	s/\$automake_version/'"`(automake --version) 2>/dev/null |$SED 1q`"'/
53839713583Smrg	s/\$autoconf_version/'"`(autoconf --version) 2>/dev/null |$SED 1q`"'/
53939713583Smrg	p
54039713583Smrg     }' < "$progpath"
54139713583Smrg    exit $?
54239713583Smrg}
54339713583Smrg
54439713583Smrg# func_missing_arg argname
54539713583Smrg# Echo program name prefixed message to standard error and set global
54639713583Smrg# exit_cmd.
54739713583Smrgfunc_missing_arg ()
54839713583Smrg{
54939713583Smrg    func_error "missing argument for $1"
55039713583Smrg    exit_cmd=exit
55195b296d0Smrg}
55295b296d0Smrg
55339713583Smrgexit_cmd=:
55495b296d0Smrg
55595b296d0Smrg
55639713583Smrg
55739713583Smrg
55839713583Smrg
55939713583Smrg# Check that we have a working $ECHO.
56039713583Smrgif test "X$1" = X--no-reexec; then
56139713583Smrg  # Discard the --no-reexec flag, and continue.
56295b296d0Smrg  shift
56339713583Smrgelif test "X$1" = X--fallback-echo; then
56439713583Smrg  # Avoid inline document here, it may be left over
56539713583Smrg  :
56639713583Smrgelif test "X`{ $ECHO '\t'; } 2>/dev/null`" = 'X\t'; then
56739713583Smrg  # Yippee, $ECHO works!
56839713583Smrg  :
56939713583Smrgelse
57039713583Smrg  # Restart under the correct shell, and then maybe $ECHO will work.
57139713583Smrg  exec $SHELL "$progpath" --no-reexec ${1+"$@"}
57239713583Smrgfi
57395b296d0Smrg
57439713583Smrgif test "X$1" = X--fallback-echo; then
57539713583Smrg  # used as fallback echo
57639713583Smrg  shift
57739713583Smrg  cat <<EOF
57839713583Smrg$*
57939713583SmrgEOF
58039713583Smrg  exit $EXIT_SUCCESS
58139713583Smrgfi
58295b296d0Smrg
58339713583Smrgmagic="%%%MAGIC variable%%%"
58439713583Smrgmagic_exe="%%%MAGIC EXE variable%%%"
58595b296d0Smrg
58639713583Smrg# Global variables.
58739713583Smrg# $mode is unset
58839713583Smrgnonopt=
58939713583Smrgexecute_dlfiles=
59039713583Smrgpreserve_args=
59139713583Smrglo2o="s/\\.lo\$/.${objext}/"
59239713583Smrgo2lo="s/\\.${objext}\$/.lo/"
59339713583Smrgextracted_archives=
59439713583Smrgextracted_serial=0
59595b296d0Smrg
59639713583Smrgopt_dry_run=false
59739713583Smrgopt_duplicate_deps=false
59839713583Smrgopt_silent=false
59939713583Smrgopt_debug=:
60095b296d0Smrg
60139713583Smrg# If this variable is set in any of the actions, the command in it
60239713583Smrg# will be execed at the end.  This prevents here-documents from being
60339713583Smrg# left over by shells.
60439713583Smrgexec_cmd=
60539713583Smrg
60639713583Smrg# func_fatal_configuration arg...
60739713583Smrg# Echo program name prefixed message to standard error, followed by
60839713583Smrg# a configuration failure hint, and exit.
60939713583Smrgfunc_fatal_configuration ()
61039713583Smrg{
61139713583Smrg    func_error ${1+"$@"}
61239713583Smrg    func_error "See the $PACKAGE documentation for more information."
61339713583Smrg    func_fatal_error "Fatal configuration error."
61439713583Smrg}
61595b296d0Smrg
616ff89ac2bSmrg
61739713583Smrg# func_config
61839713583Smrg# Display the configuration for all the tags in this script.
61939713583Smrgfunc_config ()
62039713583Smrg{
62139713583Smrg    re_begincf='^# ### BEGIN LIBTOOL'
62239713583Smrg    re_endcf='^# ### END LIBTOOL'
62339713583Smrg
62439713583Smrg    # Default configuration.
62539713583Smrg    $SED "1,/$re_begincf CONFIG/d;/$re_endcf CONFIG/,\$d" < "$progpath"
62695b296d0Smrg
62795b296d0Smrg    # Now print the configurations for the tags.
62895b296d0Smrg    for tagname in $taglist; do
62939713583Smrg      $SED -n "/$re_begincf TAG CONFIG: $tagname\$/,/$re_endcf TAG CONFIG: $tagname\$/p" < "$progpath"
63095b296d0Smrg    done
63195b296d0Smrg
63239713583Smrg    exit $?
63339713583Smrg}
63495b296d0Smrg
63539713583Smrg# func_features
63639713583Smrg# Display the features supported by this script.
63739713583Smrgfunc_features ()
63839713583Smrg{
63939713583Smrg    $ECHO "host: $host"
64095b296d0Smrg    if test "$build_libtool_libs" = yes; then
64139713583Smrg      $ECHO "enable shared libraries"
64295b296d0Smrg    else
64339713583Smrg      $ECHO "disable shared libraries"
64495b296d0Smrg    fi
64595b296d0Smrg    if test "$build_old_libs" = yes; then
64639713583Smrg      $ECHO "enable static libraries"
64795b296d0Smrg    else
64839713583Smrg      $ECHO "disable static libraries"
64995b296d0Smrg    fi
65039713583Smrg
65195b296d0Smrg    exit $?
65239713583Smrg}
65395b296d0Smrg
65439713583Smrg# func_enable_tag tagname
65539713583Smrg# Verify that TAGNAME is valid, and either flag an error and exit, or
65639713583Smrg# enable the TAGNAME tag.  We also add TAGNAME to the global $taglist
65739713583Smrg# variable here.
65839713583Smrgfunc_enable_tag ()
65939713583Smrg{
66039713583Smrg  # Global variable:
66139713583Smrg  tagname="$1"
66295b296d0Smrg
66339713583Smrg  re_begincf="^# ### BEGIN LIBTOOL TAG CONFIG: $tagname\$"
66439713583Smrg  re_endcf="^# ### END LIBTOOL TAG CONFIG: $tagname\$"
66539713583Smrg  sed_extractcf="/$re_begincf/,/$re_endcf/p"
66695b296d0Smrg
66739713583Smrg  # Validate tagname.
66839713583Smrg  case $tagname in
66939713583Smrg    *[!-_A-Za-z0-9,/]*)
67039713583Smrg      func_fatal_error "invalid tag name: $tagname"
67139713583Smrg      ;;
67239713583Smrg  esac
67395b296d0Smrg
67439713583Smrg  # Don't test for the "default" C tag, as we know it's
67539713583Smrg  # there but not specially marked.
67639713583Smrg  case $tagname in
67739713583Smrg    CC) ;;
67839713583Smrg    *)
67939713583Smrg      if $GREP "$re_begincf" "$progpath" >/dev/null 2>&1; then
68039713583Smrg	taglist="$taglist $tagname"
68139713583Smrg
68239713583Smrg	# Evaluate the configuration.  Be careful to quote the path
68339713583Smrg	# and the sed script, to avoid splitting on whitespace, but
68439713583Smrg	# also don't use non-portable quotes within backquotes within
68539713583Smrg	# quotes we have to do it in 2 steps:
68639713583Smrg	extractedcf=`$SED -n -e "$sed_extractcf" < "$progpath"`
68739713583Smrg	eval "$extractedcf"
68839713583Smrg      else
68939713583Smrg	func_error "ignoring unknown tag $tagname"
69039713583Smrg      fi
69139713583Smrg      ;;
69239713583Smrg  esac
69339713583Smrg}
69439713583Smrg
69539713583Smrg# Parse options once, thoroughly.  This comes as soon as possible in
69639713583Smrg# the script to make things like `libtool --version' happen quickly.
69739713583Smrg{
69895b296d0Smrg
69939713583Smrg  # Shorthand for --mode=foo, only valid as the first argument
70039713583Smrg  case $1 in
70139713583Smrg  clean|clea|cle|cl)
70239713583Smrg    shift; set dummy --mode clean ${1+"$@"}; shift
70395b296d0Smrg    ;;
70439713583Smrg  compile|compil|compi|comp|com|co|c)
70539713583Smrg    shift; set dummy --mode compile ${1+"$@"}; shift
70695b296d0Smrg    ;;
70739713583Smrg  execute|execut|execu|exec|exe|ex|e)
70839713583Smrg    shift; set dummy --mode execute ${1+"$@"}; shift
70995b296d0Smrg    ;;
71039713583Smrg  finish|finis|fini|fin|fi|f)
71139713583Smrg    shift; set dummy --mode finish ${1+"$@"}; shift
71295b296d0Smrg    ;;
71339713583Smrg  install|instal|insta|inst|ins|in|i)
71439713583Smrg    shift; set dummy --mode install ${1+"$@"}; shift
71539713583Smrg    ;;
71639713583Smrg  link|lin|li|l)
71739713583Smrg    shift; set dummy --mode link ${1+"$@"}; shift
71839713583Smrg    ;;
71939713583Smrg  uninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u)
72039713583Smrg    shift; set dummy --mode uninstall ${1+"$@"}; shift
72195b296d0Smrg    ;;
72295b296d0Smrg  esac
72395b296d0Smrg
72439713583Smrg  # Parse non-mode specific arguments:
72539713583Smrg  while test "$#" -gt 0; do
72639713583Smrg    opt="$1"
72739713583Smrg    shift
72895b296d0Smrg
72939713583Smrg    case $opt in
73039713583Smrg      --config)		func_config					;;
73195b296d0Smrg
73239713583Smrg      --debug)		preserve_args="$preserve_args $opt"
73339713583Smrg			func_echo "enabling shell trace mode"
73439713583Smrg			opt_debug='set -x'
73539713583Smrg			$opt_debug
73639713583Smrg			;;
73795b296d0Smrg
73839713583Smrg      -dlopen)		test "$#" -eq 0 && func_missing_arg "$opt" && break
73939713583Smrg			execute_dlfiles="$execute_dlfiles $1"
74039713583Smrg			shift
74139713583Smrg			;;
74295b296d0Smrg
74339713583Smrg      --dry-run | -n)	opt_dry_run=:					;;
74439713583Smrg      --features)       func_features					;;
74539713583Smrg      --finish)		mode="finish"					;;
74639713583Smrg
74739713583Smrg      --mode)		test "$#" -eq 0 && func_missing_arg "$opt" && break
74839713583Smrg			case $1 in
74939713583Smrg			  # Valid mode arguments:
75039713583Smrg			  clean)	;;
75139713583Smrg			  compile)	;;
75239713583Smrg			  execute)	;;
75339713583Smrg			  finish)	;;
75439713583Smrg			  install)	;;
75539713583Smrg			  link)		;;
75639713583Smrg			  relink)	;;
75739713583Smrg			  uninstall)	;;
75839713583Smrg
75939713583Smrg			  # Catch anything else as an error
76039713583Smrg			  *) func_error "invalid argument for $opt"
76139713583Smrg			     exit_cmd=exit
76239713583Smrg			     break
76339713583Smrg			     ;;
76439713583Smrg		        esac
76539713583Smrg
76639713583Smrg			mode="$1"
76739713583Smrg			shift
76839713583Smrg			;;
76939713583Smrg
77039713583Smrg      --preserve-dup-deps)
77139713583Smrg			opt_duplicate_deps=:				;;
77239713583Smrg
77339713583Smrg      --quiet|--silent)	preserve_args="$preserve_args $opt"
77439713583Smrg			opt_silent=:
77539713583Smrg			;;
77639713583Smrg
77739713583Smrg      --verbose| -v)	preserve_args="$preserve_args $opt"
77839713583Smrg			opt_silent=false
77939713583Smrg			;;
78039713583Smrg
78139713583Smrg      --tag)		test "$#" -eq 0 && func_missing_arg "$opt" && break
78239713583Smrg			preserve_args="$preserve_args $opt $1"
78339713583Smrg			func_enable_tag "$1"	# tagname is set here
78439713583Smrg			shift
78539713583Smrg			;;
78639713583Smrg
78739713583Smrg      # Separate optargs to long options:
78839713583Smrg      -dlopen=*|--mode=*|--tag=*)
78939713583Smrg			func_opt_split "$opt"
79039713583Smrg			set dummy "$func_opt_split_opt" "$func_opt_split_arg" ${1+"$@"}
79139713583Smrg			shift
79239713583Smrg			;;
79339713583Smrg
79439713583Smrg      -\?|-h)		func_usage					;;
79539713583Smrg      --help)		opt_help=:					;;
79639713583Smrg      --version)	func_version					;;
79739713583Smrg
79839713583Smrg      -*)		func_fatal_help "unrecognized option \`$opt'"	;;
79939713583Smrg
80039713583Smrg      *)		nonopt="$opt"
80139713583Smrg			break
80239713583Smrg			;;
80339713583Smrg    esac
80439713583Smrg  done
80539713583Smrg
80639713583Smrg
80739713583Smrg  case $host in
80839713583Smrg    *cygwin* | *mingw* | *pw32* | *cegcc*)
80939713583Smrg      # don't eliminate duplications in $postdeps and $predeps
81039713583Smrg      opt_duplicate_compiler_generated_deps=:
81195b296d0Smrg      ;;
81295b296d0Smrg    *)
81339713583Smrg      opt_duplicate_compiler_generated_deps=$opt_duplicate_deps
81439713583Smrg      ;;
81539713583Smrg  esac
81695b296d0Smrg
81739713583Smrg  # Having warned about all mis-specified options, bail out if
81839713583Smrg  # anything was wrong.
81939713583Smrg  $exit_cmd $EXIT_FAILURE
82039713583Smrg}
82139713583Smrg
82239713583Smrg# func_check_version_match
82339713583Smrg# Ensure that we are using m4 macros, and libtool script from the same
82439713583Smrg# release of libtool.
82539713583Smrgfunc_check_version_match ()
82639713583Smrg{
82739713583Smrg  if test "$package_revision" != "$macro_revision"; then
82839713583Smrg    if test "$VERSION" != "$macro_version"; then
82939713583Smrg      if test -z "$macro_version"; then
83039713583Smrg        cat >&2 <<_LT_EOF
83139713583Smrg$progname: Version mismatch error.  This is $PACKAGE $VERSION, but the
83239713583Smrg$progname: definition of this LT_INIT comes from an older release.
83339713583Smrg$progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION
83439713583Smrg$progname: and run autoconf again.
83539713583Smrg_LT_EOF
83639713583Smrg      else
83739713583Smrg        cat >&2 <<_LT_EOF
83839713583Smrg$progname: Version mismatch error.  This is $PACKAGE $VERSION, but the
83939713583Smrg$progname: definition of this LT_INIT comes from $PACKAGE $macro_version.
84039713583Smrg$progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION
84139713583Smrg$progname: and run autoconf again.
84239713583Smrg_LT_EOF
84395b296d0Smrg      fi
84439713583Smrg    else
84539713583Smrg      cat >&2 <<_LT_EOF
84639713583Smrg$progname: Version mismatch error.  This is $PACKAGE $VERSION, revision $package_revision,
84739713583Smrg$progname: but the definition of this LT_INIT comes from revision $macro_revision.
84839713583Smrg$progname: You should recreate aclocal.m4 with macros from revision $package_revision
84939713583Smrg$progname: of $PACKAGE $VERSION and run autoconf again.
85039713583Smrg_LT_EOF
85139713583Smrg    fi
85239713583Smrg
85339713583Smrg    exit $EXIT_MISMATCH
85439713583Smrg  fi
85539713583Smrg}
85639713583Smrg
85739713583Smrg
85839713583Smrg## ----------- ##
85939713583Smrg##    Main.    ##
86039713583Smrg## ----------- ##
86139713583Smrg
86239713583Smrg$opt_help || {
86339713583Smrg  # Sanity checks first:
86439713583Smrg  func_check_version_match
86539713583Smrg
86639713583Smrg  if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
86739713583Smrg    func_fatal_configuration "not configured to build any kind of library"
86895b296d0Smrg  fi
86995b296d0Smrg
87039713583Smrg  test -z "$mode" && func_fatal_error "error: you must specify a MODE."
87139713583Smrg
87239713583Smrg
87339713583Smrg  # Darwin sucks
87439713583Smrg  eval std_shrext=\"$shrext_cmds\"
87539713583Smrg
87639713583Smrg
87795b296d0Smrg  # Only execute mode is allowed to have -dlopen flags.
87895b296d0Smrg  if test -n "$execute_dlfiles" && test "$mode" != execute; then
87939713583Smrg    func_error "unrecognized option \`-dlopen'"
88039713583Smrg    $ECHO "$help" 1>&2
88195b296d0Smrg    exit $EXIT_FAILURE
88295b296d0Smrg  fi
88395b296d0Smrg
88495b296d0Smrg  # Change the help message to a mode-specific one.
88595b296d0Smrg  generic_help="$help"
88639713583Smrg  help="Try \`$progname --help --mode=$mode' for more information."
88739713583Smrg}
88895b296d0Smrg
88995b296d0Smrg
89039713583Smrg# func_lalib_p file
89139713583Smrg# True iff FILE is a libtool `.la' library or `.lo' object file.
89239713583Smrg# This function is only a basic sanity check; it will hardly flush out
89339713583Smrg# determined imposters.
89439713583Smrgfunc_lalib_p ()
89539713583Smrg{
89639713583Smrg    test -f "$1" &&
89739713583Smrg      $SED -e 4q "$1" 2>/dev/null \
89839713583Smrg        | $GREP "^# Generated by .*$PACKAGE" > /dev/null 2>&1
89939713583Smrg}
90095b296d0Smrg
90139713583Smrg# func_lalib_unsafe_p file
90239713583Smrg# True iff FILE is a libtool `.la' library or `.lo' object file.
90339713583Smrg# This function implements the same check as func_lalib_p without
90439713583Smrg# resorting to external programs.  To this end, it redirects stdin and
90539713583Smrg# closes it afterwards, without saving the original file descriptor.
90639713583Smrg# As a safety measure, use it only where a negative result would be
90739713583Smrg# fatal anyway.  Works if `file' does not exist.
90839713583Smrgfunc_lalib_unsafe_p ()
90939713583Smrg{
91039713583Smrg    lalib_p=no
91139713583Smrg    if test -f "$1" && test -r "$1" && exec 5<&0 <"$1"; then
91239713583Smrg	for lalib_p_l in 1 2 3 4
91339713583Smrg	do
91439713583Smrg	    read lalib_p_line
91539713583Smrg	    case "$lalib_p_line" in
91639713583Smrg		\#\ Generated\ by\ *$PACKAGE* ) lalib_p=yes; break;;
91739713583Smrg	    esac
91839713583Smrg	done
91939713583Smrg	exec 0<&5 5<&-
92039713583Smrg    fi
92139713583Smrg    test "$lalib_p" = yes
92239713583Smrg}
92395b296d0Smrg
92439713583Smrg# func_ltwrapper_script_p file
92539713583Smrg# True iff FILE is a libtool wrapper script
92639713583Smrg# This function is only a basic sanity check; it will hardly flush out
92739713583Smrg# determined imposters.
92839713583Smrgfunc_ltwrapper_script_p ()
92939713583Smrg{
93039713583Smrg    func_lalib_p "$1"
93139713583Smrg}
93295b296d0Smrg
93339713583Smrg# func_ltwrapper_executable_p file
93439713583Smrg# True iff FILE is a libtool wrapper executable
93539713583Smrg# This function is only a basic sanity check; it will hardly flush out
93639713583Smrg# determined imposters.
93739713583Smrgfunc_ltwrapper_executable_p ()
93839713583Smrg{
93939713583Smrg    func_ltwrapper_exec_suffix=
94039713583Smrg    case $1 in
94139713583Smrg    *.exe) ;;
94239713583Smrg    *) func_ltwrapper_exec_suffix=.exe ;;
94339713583Smrg    esac
94439713583Smrg    $GREP "$magic_exe" "$1$func_ltwrapper_exec_suffix" >/dev/null 2>&1
94539713583Smrg}
94695b296d0Smrg
94739713583Smrg# func_ltwrapper_scriptname file
94839713583Smrg# Assumes file is an ltwrapper_executable
94939713583Smrg# uses $file to determine the appropriate filename for a
95039713583Smrg# temporary ltwrapper_script.
95139713583Smrgfunc_ltwrapper_scriptname ()
95239713583Smrg{
95339713583Smrg    func_ltwrapper_scriptname_result=""
95439713583Smrg    if func_ltwrapper_executable_p "$1"; then
95539713583Smrg	func_dirname_and_basename "$1" "" "."
95639713583Smrg	func_stripname '' '.exe' "$func_basename_result"
95739713583Smrg	func_ltwrapper_scriptname_result="$func_dirname_result/$objdir/${func_stripname_result}_ltshwrapper"
95839713583Smrg    fi
95939713583Smrg}
96039713583Smrg
96139713583Smrg# func_ltwrapper_p file
96239713583Smrg# True iff FILE is a libtool wrapper script or wrapper executable
96339713583Smrg# This function is only a basic sanity check; it will hardly flush out
96439713583Smrg# determined imposters.
96539713583Smrgfunc_ltwrapper_p ()
96639713583Smrg{
96739713583Smrg    func_ltwrapper_script_p "$1" || func_ltwrapper_executable_p "$1"
96839713583Smrg}
96939713583Smrg
97039713583Smrg
97139713583Smrg# func_execute_cmds commands fail_cmd
97239713583Smrg# Execute tilde-delimited COMMANDS.
97339713583Smrg# If FAIL_CMD is given, eval that upon failure.
97439713583Smrg# FAIL_CMD may read-access the current command in variable CMD!
97539713583Smrgfunc_execute_cmds ()
97639713583Smrg{
97739713583Smrg    $opt_debug
97839713583Smrg    save_ifs=$IFS; IFS='~'
97939713583Smrg    for cmd in $1; do
98039713583Smrg      IFS=$save_ifs
98139713583Smrg      eval cmd=\"$cmd\"
98239713583Smrg      func_show_eval "$cmd" "${2-:}"
98339713583Smrg    done
98439713583Smrg    IFS=$save_ifs
98539713583Smrg}
98639713583Smrg
98739713583Smrg
98839713583Smrg# func_source file
98939713583Smrg# Source FILE, adding directory component if necessary.
99039713583Smrg# Note that it is not necessary on cygwin/mingw to append a dot to
99139713583Smrg# FILE even if both FILE and FILE.exe exist: automatic-append-.exe
99239713583Smrg# behavior happens only for exec(3), not for open(2)!  Also, sourcing
99339713583Smrg# `FILE.' does not work on cygwin managed mounts.
99439713583Smrgfunc_source ()
99539713583Smrg{
99639713583Smrg    $opt_debug
99739713583Smrg    case $1 in
99839713583Smrg    */* | *\\*)	. "$1" ;;
99939713583Smrg    *)		. "./$1" ;;
100039713583Smrg    esac
100139713583Smrg}
100239713583Smrg
100339713583Smrg
100439713583Smrg# func_infer_tag arg
100539713583Smrg# Infer tagged configuration to use if any are available and
100639713583Smrg# if one wasn't chosen via the "--tag" command line option.
100739713583Smrg# Only attempt this if the compiler in the base compile
100839713583Smrg# command doesn't match the default compiler.
100939713583Smrg# arg is usually of the form 'gcc ...'
101039713583Smrgfunc_infer_tag ()
101139713583Smrg{
101239713583Smrg    $opt_debug
101339713583Smrg    if test -n "$available_tags" && test -z "$tagname"; then
101439713583Smrg      CC_quoted=
101539713583Smrg      for arg in $CC; do
101639713583Smrg        func_quote_for_eval "$arg"
101739713583Smrg	CC_quoted="$CC_quoted $func_quote_for_eval_result"
101839713583Smrg      done
101939713583Smrg      case $@ in
102039713583Smrg      # Blanks in the command may have been stripped by the calling shell,
102139713583Smrg      # but not from the CC environment variable when configure was run.
102239713583Smrg      " $CC "* | "$CC "* | " `$ECHO $CC` "* | "`$ECHO $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$ECHO $CC_quoted` "* | "`$ECHO $CC_quoted` "*) ;;
102339713583Smrg      # Blanks at the start of $base_compile will cause this to fail
102439713583Smrg      # if we don't check for them as well.
102539713583Smrg      *)
102639713583Smrg	for z in $available_tags; do
102739713583Smrg	  if $GREP "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then
102839713583Smrg	    # Evaluate the configuration.
102939713583Smrg	    eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`"
103039713583Smrg	    CC_quoted=
103139713583Smrg	    for arg in $CC; do
103239713583Smrg	      # Double-quote args containing other shell metacharacters.
103339713583Smrg	      func_quote_for_eval "$arg"
103439713583Smrg	      CC_quoted="$CC_quoted $func_quote_for_eval_result"
103539713583Smrg	    done
103639713583Smrg	    case "$@ " in
103739713583Smrg	      " $CC "* | "$CC "* | " `$ECHO $CC` "* | "`$ECHO $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$ECHO $CC_quoted` "* | "`$ECHO $CC_quoted` "*)
103839713583Smrg	      # The compiler in the base compile command matches
103939713583Smrg	      # the one in the tagged configuration.
104039713583Smrg	      # Assume this is the tagged configuration we want.
104139713583Smrg	      tagname=$z
104239713583Smrg	      break
104339713583Smrg	      ;;
104439713583Smrg	    esac
104539713583Smrg	  fi
104639713583Smrg	done
104739713583Smrg	# If $tagname still isn't set, then no tagged configuration
104839713583Smrg	# was found and let the user know that the "--tag" command
104939713583Smrg	# line option must be used.
105039713583Smrg	if test -z "$tagname"; then
105139713583Smrg	  func_echo "unable to infer tagged configuration"
105239713583Smrg	  func_fatal_error "specify a tag with \`--tag'"
105339713583Smrg#	else
105439713583Smrg#	  func_verbose "using $tagname tagged configuration"
105539713583Smrg	fi
105639713583Smrg	;;
105739713583Smrg      esac
105839713583Smrg    fi
105939713583Smrg}
106039713583Smrg
106139713583Smrg
106239713583Smrg
106339713583Smrg# func_write_libtool_object output_name pic_name nonpic_name
106439713583Smrg# Create a libtool object file (analogous to a ".la" file),
106539713583Smrg# but don't create it if we're doing a dry run.
106639713583Smrgfunc_write_libtool_object ()
106739713583Smrg{
106839713583Smrg    write_libobj=${1}
106939713583Smrg    if test "$build_libtool_libs" = yes; then
107039713583Smrg      write_lobj=\'${2}\'
107139713583Smrg    else
107239713583Smrg      write_lobj=none
107339713583Smrg    fi
107439713583Smrg
107539713583Smrg    if test "$build_old_libs" = yes; then
107639713583Smrg      write_oldobj=\'${3}\'
107739713583Smrg    else
107839713583Smrg      write_oldobj=none
107939713583Smrg    fi
108039713583Smrg
108139713583Smrg    $opt_dry_run || {
108239713583Smrg      cat >${write_libobj}T <<EOF
108339713583Smrg# $write_libobj - a libtool object file
108439713583Smrg# Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
108539713583Smrg#
108639713583Smrg# Please DO NOT delete this file!
108739713583Smrg# It is necessary for linking the library.
108839713583Smrg
108939713583Smrg# Name of the PIC object.
109039713583Smrgpic_object=$write_lobj
109139713583Smrg
109239713583Smrg# Name of the non-PIC object
109339713583Smrgnon_pic_object=$write_oldobj
109439713583Smrg
109539713583SmrgEOF
109639713583Smrg      $MV "${write_libobj}T" "${write_libobj}"
109739713583Smrg    }
109839713583Smrg}
109939713583Smrg
110039713583Smrg# func_mode_compile arg...
110139713583Smrgfunc_mode_compile ()
110239713583Smrg{
110339713583Smrg    $opt_debug
110439713583Smrg    # Get the compilation command and the source file.
110539713583Smrg    base_compile=
110639713583Smrg    srcfile="$nonopt"  #  always keep a non-empty value in "srcfile"
110739713583Smrg    suppress_opt=yes
110839713583Smrg    suppress_output=
110939713583Smrg    arg_mode=normal
111039713583Smrg    libobj=
111139713583Smrg    later=
111239713583Smrg    pie_flag=
111339713583Smrg
111439713583Smrg    for arg
111539713583Smrg    do
111639713583Smrg      case $arg_mode in
111739713583Smrg      arg  )
111839713583Smrg	# do not "continue".  Instead, add this to base_compile
111939713583Smrg	lastarg="$arg"
112039713583Smrg	arg_mode=normal
112139713583Smrg	;;
112239713583Smrg
112339713583Smrg      target )
112439713583Smrg	libobj="$arg"
112539713583Smrg	arg_mode=normal
112639713583Smrg	continue
112739713583Smrg	;;
112839713583Smrg
112939713583Smrg      normal )
113039713583Smrg	# Accept any command-line options.
113139713583Smrg	case $arg in
113239713583Smrg	-o)
113339713583Smrg	  test -n "$libobj" && \
113439713583Smrg	    func_fatal_error "you cannot specify \`-o' more than once"
113539713583Smrg	  arg_mode=target
113639713583Smrg	  continue
113739713583Smrg	  ;;
113839713583Smrg
113939713583Smrg	-pie | -fpie | -fPIE)
114039713583Smrg          pie_flag="$pie_flag $arg"
114139713583Smrg	  continue
114239713583Smrg	  ;;
114339713583Smrg
114439713583Smrg	-shared | -static | -prefer-pic | -prefer-non-pic)
114539713583Smrg	  later="$later $arg"
114639713583Smrg	  continue
114739713583Smrg	  ;;
114839713583Smrg
114939713583Smrg	-no-suppress)
115095b296d0Smrg	  suppress_opt=no
115195b296d0Smrg	  continue
115295b296d0Smrg	  ;;
115395b296d0Smrg
115495b296d0Smrg	-Xcompiler)
115595b296d0Smrg	  arg_mode=arg  #  the next one goes into the "base_compile" arg list
115695b296d0Smrg	  continue      #  The current "srcfile" will either be retained or
115795b296d0Smrg	  ;;            #  replaced later.  I would guess that would be a bug.
115895b296d0Smrg
115995b296d0Smrg	-Wc,*)
116039713583Smrg	  func_stripname '-Wc,' '' "$arg"
116139713583Smrg	  args=$func_stripname_result
116295b296d0Smrg	  lastarg=
116395b296d0Smrg	  save_ifs="$IFS"; IFS=','
116439713583Smrg	  for arg in $args; do
116595b296d0Smrg	    IFS="$save_ifs"
116639713583Smrg	    func_quote_for_eval "$arg"
116739713583Smrg	    lastarg="$lastarg $func_quote_for_eval_result"
116895b296d0Smrg	  done
116995b296d0Smrg	  IFS="$save_ifs"
117039713583Smrg	  func_stripname ' ' '' "$lastarg"
117139713583Smrg	  lastarg=$func_stripname_result
117295b296d0Smrg
117395b296d0Smrg	  # Add the arguments to base_compile.
117495b296d0Smrg	  base_compile="$base_compile $lastarg"
117595b296d0Smrg	  continue
117695b296d0Smrg	  ;;
117795b296d0Smrg
117839713583Smrg	*)
117995b296d0Smrg	  # Accept the current argument as the source file.
118095b296d0Smrg	  # The previous "srcfile" becomes the current argument.
118195b296d0Smrg	  #
118295b296d0Smrg	  lastarg="$srcfile"
118395b296d0Smrg	  srcfile="$arg"
118495b296d0Smrg	  ;;
118595b296d0Smrg	esac  #  case $arg
118695b296d0Smrg	;;
118795b296d0Smrg      esac    #  case $arg_mode
118895b296d0Smrg
118995b296d0Smrg      # Aesthetically quote the previous argument.
119039713583Smrg      func_quote_for_eval "$lastarg"
119139713583Smrg      base_compile="$base_compile $func_quote_for_eval_result"
119295b296d0Smrg    done # for arg
119395b296d0Smrg
119495b296d0Smrg    case $arg_mode in
119595b296d0Smrg    arg)
119639713583Smrg      func_fatal_error "you must specify an argument for -Xcompile"
119795b296d0Smrg      ;;
119895b296d0Smrg    target)
119939713583Smrg      func_fatal_error "you must specify a target with \`-o'"
120095b296d0Smrg      ;;
120195b296d0Smrg    *)
120295b296d0Smrg      # Get the name of the library object.
120339713583Smrg      test -z "$libobj" && {
120439713583Smrg	func_basename "$srcfile"
120539713583Smrg	libobj="$func_basename_result"
120639713583Smrg      }
120795b296d0Smrg      ;;
120895b296d0Smrg    esac
120995b296d0Smrg
121095b296d0Smrg    # Recognize several different file suffixes.
121195b296d0Smrg    # If the user specifies -o file.o, it is replaced with file.lo
121295b296d0Smrg    case $libobj in
121339713583Smrg    *.[cCFSifmso] | \
121439713583Smrg    *.ada | *.adb | *.ads | *.asm | \
121539713583Smrg    *.c++ | *.cc | *.ii | *.class | *.cpp | *.cxx | \
121639713583Smrg    *.[fF][09]? | *.for | *.java | *.obj | *.sx)
121739713583Smrg      func_xform "$libobj"
121839713583Smrg      libobj=$func_xform_result
121939713583Smrg      ;;
122095b296d0Smrg    esac
122195b296d0Smrg
122295b296d0Smrg    case $libobj in
122339713583Smrg    *.lo) func_lo2o "$libobj"; obj=$func_lo2o_result ;;
122495b296d0Smrg    *)
122539713583Smrg      func_fatal_error "cannot determine name of library object from \`$libobj'"
122695b296d0Smrg      ;;
122795b296d0Smrg    esac
122895b296d0Smrg
122995b296d0Smrg    func_infer_tag $base_compile
123095b296d0Smrg
123195b296d0Smrg    for arg in $later; do
123295b296d0Smrg      case $arg in
123339713583Smrg      -shared)
123439713583Smrg	test "$build_libtool_libs" != yes && \
123539713583Smrg	  func_fatal_configuration "can not build a shared library"
123639713583Smrg	build_old_libs=no
123739713583Smrg	continue
123839713583Smrg	;;
123939713583Smrg
124095b296d0Smrg      -static)
124139713583Smrg	build_libtool_libs=no
124295b296d0Smrg	build_old_libs=yes
124395b296d0Smrg	continue
124495b296d0Smrg	;;
124595b296d0Smrg
124695b296d0Smrg      -prefer-pic)
124795b296d0Smrg	pic_mode=yes
124895b296d0Smrg	continue
124995b296d0Smrg	;;
125095b296d0Smrg
125195b296d0Smrg      -prefer-non-pic)
125295b296d0Smrg	pic_mode=no
125395b296d0Smrg	continue
125495b296d0Smrg	;;
125595b296d0Smrg      esac
125695b296d0Smrg    done
125795b296d0Smrg
125839713583Smrg    func_quote_for_eval "$libobj"
125939713583Smrg    test "X$libobj" != "X$func_quote_for_eval_result" \
126039713583Smrg      && $ECHO "X$libobj" | $GREP '[]~#^*{};<>?"'"'"'	 &()|`$[]' \
126139713583Smrg      && func_warning "libobj name \`$libobj' may not contain shell special characters."
126239713583Smrg    func_dirname_and_basename "$obj" "/" ""
126339713583Smrg    objname="$func_basename_result"
126439713583Smrg    xdir="$func_dirname_result"
126595b296d0Smrg    lobj=${xdir}$objdir/$objname
126695b296d0Smrg
126739713583Smrg    test -z "$base_compile" && \
126839713583Smrg      func_fatal_help "you must specify a compilation command"
126995b296d0Smrg
127095b296d0Smrg    # Delete any leftover library objects.
127195b296d0Smrg    if test "$build_old_libs" = yes; then
127295b296d0Smrg      removelist="$obj $lobj $libobj ${libobj}T"
127395b296d0Smrg    else
127495b296d0Smrg      removelist="$lobj $libobj ${libobj}T"
127595b296d0Smrg    fi
127695b296d0Smrg
127795b296d0Smrg    # On Cygwin there's no "real" PIC flag so we must build both object types
127895b296d0Smrg    case $host_os in
127939713583Smrg    cygwin* | mingw* | pw32* | os2* | cegcc*)
128095b296d0Smrg      pic_mode=default
128195b296d0Smrg      ;;
128295b296d0Smrg    esac
128395b296d0Smrg    if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then
128495b296d0Smrg      # non-PIC code in shared libraries is not supported
128595b296d0Smrg      pic_mode=default
128695b296d0Smrg    fi
128795b296d0Smrg
128895b296d0Smrg    # Calculate the filename of the output object if compiler does
128995b296d0Smrg    # not support -o with -c
129095b296d0Smrg    if test "$compiler_c_o" = no; then
129139713583Smrg      output_obj=`$ECHO "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext}
129295b296d0Smrg      lockfile="$output_obj.lock"
129395b296d0Smrg    else
129495b296d0Smrg      output_obj=
129595b296d0Smrg      need_locks=no
129695b296d0Smrg      lockfile=
129795b296d0Smrg    fi
129895b296d0Smrg
129995b296d0Smrg    # Lock this critical section if it is needed
130095b296d0Smrg    # We use this script file to make the link, it avoids creating a new file
130195b296d0Smrg    if test "$need_locks" = yes; then
130239713583Smrg      until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do
130339713583Smrg	func_echo "Waiting for $lockfile to be removed"
130495b296d0Smrg	sleep 2
130595b296d0Smrg      done
130695b296d0Smrg    elif test "$need_locks" = warn; then
130795b296d0Smrg      if test -f "$lockfile"; then
130839713583Smrg	$ECHO "\
130995b296d0Smrg*** ERROR, $lockfile exists and contains:
131095b296d0Smrg`cat $lockfile 2>/dev/null`
131195b296d0Smrg
131295b296d0SmrgThis indicates that another process is trying to use the same
131395b296d0Smrgtemporary object file, and libtool could not work around it because
131495b296d0Smrgyour compiler does not support \`-c' and \`-o' together.  If you
131595b296d0Smrgrepeat this compilation, it may succeed, by chance, but you had better
131695b296d0Smrgavoid parallel builds (make -j) in this platform, or get a better
131795b296d0Smrgcompiler."
131895b296d0Smrg
131939713583Smrg	$opt_dry_run || $RM $removelist
132095b296d0Smrg	exit $EXIT_FAILURE
132195b296d0Smrg      fi
132239713583Smrg      removelist="$removelist $output_obj"
132339713583Smrg      $ECHO "$srcfile" > "$lockfile"
132495b296d0Smrg    fi
132595b296d0Smrg
132639713583Smrg    $opt_dry_run || $RM $removelist
132739713583Smrg    removelist="$removelist $lockfile"
132839713583Smrg    trap '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' 1 2 15
132939713583Smrg
133095b296d0Smrg    if test -n "$fix_srcfile_path"; then
133195b296d0Smrg      eval srcfile=\"$fix_srcfile_path\"
133295b296d0Smrg    fi
133339713583Smrg    func_quote_for_eval "$srcfile"
133439713583Smrg    qsrcfile=$func_quote_for_eval_result
133595b296d0Smrg
133695b296d0Smrg    # Only build a PIC object if we are building libtool libraries.
133795b296d0Smrg    if test "$build_libtool_libs" = yes; then
133895b296d0Smrg      # Without this assignment, base_compile gets emptied.
133995b296d0Smrg      fbsd_hideous_sh_bug=$base_compile
134095b296d0Smrg
134195b296d0Smrg      if test "$pic_mode" != no; then
134295b296d0Smrg	command="$base_compile $qsrcfile $pic_flag"
134395b296d0Smrg      else
134495b296d0Smrg	# Don't build PIC code
134595b296d0Smrg	command="$base_compile $qsrcfile"
134695b296d0Smrg      fi
134795b296d0Smrg
134839713583Smrg      func_mkdir_p "$xdir$objdir"
134995b296d0Smrg
135095b296d0Smrg      if test -z "$output_obj"; then
135195b296d0Smrg	# Place PIC objects in $objdir
135295b296d0Smrg	command="$command -o $lobj"
135395b296d0Smrg      fi
135495b296d0Smrg
135539713583Smrg      func_show_eval_locale "$command"	\
135639713583Smrg          'test -n "$output_obj" && $RM $removelist; exit $EXIT_FAILURE'
135795b296d0Smrg
135895b296d0Smrg      if test "$need_locks" = warn &&
135995b296d0Smrg	 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
136039713583Smrg	$ECHO "\
136195b296d0Smrg*** ERROR, $lockfile contains:
136295b296d0Smrg`cat $lockfile 2>/dev/null`
136395b296d0Smrg
136495b296d0Smrgbut it should contain:
136595b296d0Smrg$srcfile
136695b296d0Smrg
136795b296d0SmrgThis indicates that another process is trying to use the same
136895b296d0Smrgtemporary object file, and libtool could not work around it because
136995b296d0Smrgyour compiler does not support \`-c' and \`-o' together.  If you
137095b296d0Smrgrepeat this compilation, it may succeed, by chance, but you had better
137195b296d0Smrgavoid parallel builds (make -j) in this platform, or get a better
137295b296d0Smrgcompiler."
137395b296d0Smrg
137439713583Smrg	$opt_dry_run || $RM $removelist
137595b296d0Smrg	exit $EXIT_FAILURE
137695b296d0Smrg      fi
137795b296d0Smrg
137895b296d0Smrg      # Just move the object if needed, then go on to compile the next one
137995b296d0Smrg      if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then
138039713583Smrg	func_show_eval '$MV "$output_obj" "$lobj"' \
138139713583Smrg	  'error=$?; $opt_dry_run || $RM $removelist; exit $error'
138295b296d0Smrg      fi
138395b296d0Smrg
138495b296d0Smrg      # Allow error messages only from the first compilation.
138595b296d0Smrg      if test "$suppress_opt" = yes; then
138639713583Smrg	suppress_output=' >/dev/null 2>&1'
138795b296d0Smrg      fi
138895b296d0Smrg    fi
138995b296d0Smrg
139095b296d0Smrg    # Only build a position-dependent object if we build old libraries.
139195b296d0Smrg    if test "$build_old_libs" = yes; then
139295b296d0Smrg      if test "$pic_mode" != yes; then
139395b296d0Smrg	# Don't build PIC code
139439713583Smrg	command="$base_compile $qsrcfile$pie_flag"
139595b296d0Smrg      else
139695b296d0Smrg	command="$base_compile $qsrcfile $pic_flag"
139795b296d0Smrg      fi
139895b296d0Smrg      if test "$compiler_c_o" = yes; then
139995b296d0Smrg	command="$command -o $obj"
140095b296d0Smrg      fi
140195b296d0Smrg
140295b296d0Smrg      # Suppress compiler output if we already did a PIC compilation.
140395b296d0Smrg      command="$command$suppress_output"
140439713583Smrg      func_show_eval_locale "$command" \
140539713583Smrg        '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE'
140695b296d0Smrg
140795b296d0Smrg      if test "$need_locks" = warn &&
140895b296d0Smrg	 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
140939713583Smrg	$ECHO "\
141095b296d0Smrg*** ERROR, $lockfile contains:
141195b296d0Smrg`cat $lockfile 2>/dev/null`
141295b296d0Smrg
141395b296d0Smrgbut it should contain:
141495b296d0Smrg$srcfile
141595b296d0Smrg
141695b296d0SmrgThis indicates that another process is trying to use the same
141795b296d0Smrgtemporary object file, and libtool could not work around it because
141895b296d0Smrgyour compiler does not support \`-c' and \`-o' together.  If you
141995b296d0Smrgrepeat this compilation, it may succeed, by chance, but you had better
142095b296d0Smrgavoid parallel builds (make -j) in this platform, or get a better
142195b296d0Smrgcompiler."
142295b296d0Smrg
142339713583Smrg	$opt_dry_run || $RM $removelist
142495b296d0Smrg	exit $EXIT_FAILURE
142595b296d0Smrg      fi
142695b296d0Smrg
142795b296d0Smrg      # Just move the object if needed
142895b296d0Smrg      if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then
142939713583Smrg	func_show_eval '$MV "$output_obj" "$obj"' \
143039713583Smrg	  'error=$?; $opt_dry_run || $RM $removelist; exit $error'
143195b296d0Smrg      fi
143295b296d0Smrg    fi
143395b296d0Smrg
143439713583Smrg    $opt_dry_run || {
143539713583Smrg      func_write_libtool_object "$libobj" "$objdir/$objname" "$objname"
143695b296d0Smrg
143739713583Smrg      # Unlock the critical section if it was locked
143839713583Smrg      if test "$need_locks" != no; then
143939713583Smrg	removelist=$lockfile
144039713583Smrg        $RM "$lockfile"
144139713583Smrg      fi
144239713583Smrg    }
144395b296d0Smrg
144495b296d0Smrg    exit $EXIT_SUCCESS
144539713583Smrg}
144695b296d0Smrg
144739713583Smrg$opt_help || {
144839713583Smrgtest "$mode" = compile && func_mode_compile ${1+"$@"}
144939713583Smrg}
145095b296d0Smrg
145139713583Smrgfunc_mode_help ()
145239713583Smrg{
145339713583Smrg    # We need to display help for each of the modes.
145439713583Smrg    case $mode in
145539713583Smrg      "")
145639713583Smrg        # Generic help is extracted from the usage comments
145739713583Smrg        # at the start of this file.
145839713583Smrg        func_help
145939713583Smrg        ;;
146095b296d0Smrg
146139713583Smrg      clean)
146239713583Smrg        $ECHO \
146339713583Smrg"Usage: $progname [OPTION]... --mode=clean RM [RM-OPTION]... FILE...
146495b296d0Smrg
146539713583SmrgRemove files from the build directory.
146695b296d0Smrg
146739713583SmrgRM is the name of the program to use to delete files associated with each FILE
146839713583Smrg(typically \`/bin/rm').  RM-OPTIONS are options (such as \`-f') to be passed
146939713583Smrgto RM.
147095b296d0Smrg
147139713583SmrgIf FILE is a libtool library, object or program, all the files associated
147239713583Smrgwith it are deleted. Otherwise, only FILE itself is deleted using RM."
147339713583Smrg        ;;
147495b296d0Smrg
147539713583Smrg      compile)
147639713583Smrg      $ECHO \
147739713583Smrg"Usage: $progname [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE
147895b296d0Smrg
147939713583SmrgCompile a source file into a libtool library object.
148095b296d0Smrg
148139713583SmrgThis mode accepts the following additional options:
148295b296d0Smrg
148339713583Smrg  -o OUTPUT-FILE    set the output file name to OUTPUT-FILE
148439713583Smrg  -no-suppress      do not suppress compiler output for multiple passes
148539713583Smrg  -prefer-pic       try to building PIC objects only
148639713583Smrg  -prefer-non-pic   try to building non-PIC objects only
148739713583Smrg  -shared           do not build a \`.o' file suitable for static linking
148839713583Smrg  -static           only build a \`.o' file suitable for static linking
148995b296d0Smrg
149039713583SmrgCOMPILE-COMMAND is a command to be used in creating a \`standard' object file
149139713583Smrgfrom the given SOURCEFILE.
149295b296d0Smrg
149339713583SmrgThe output file name is determined by removing the directory component from
149439713583SmrgSOURCEFILE, then substituting the C source code suffix \`.c' with the
149539713583Smrglibrary object suffix, \`.lo'."
149639713583Smrg        ;;
149795b296d0Smrg
149839713583Smrg      execute)
149939713583Smrg        $ECHO \
150039713583Smrg"Usage: $progname [OPTION]... --mode=execute COMMAND [ARGS]...
150195b296d0Smrg
150239713583SmrgAutomatically set library path, then run a program.
150395b296d0Smrg
150439713583SmrgThis mode accepts the following additional options:
150595b296d0Smrg
150639713583Smrg  -dlopen FILE      add the directory containing FILE to the library path
150795b296d0Smrg
150839713583SmrgThis mode sets the library path environment variable according to \`-dlopen'
150939713583Smrgflags.
151095b296d0Smrg
151139713583SmrgIf any of the ARGS are libtool executable wrappers, then they are translated
151239713583Smrginto their corresponding uninstalled binary, and any of their required library
151339713583Smrgdirectories are added to the library path.
151495b296d0Smrg
151539713583SmrgThen, COMMAND is executed, with ARGS as arguments."
151639713583Smrg        ;;
151795b296d0Smrg
151839713583Smrg      finish)
151939713583Smrg        $ECHO \
152039713583Smrg"Usage: $progname [OPTION]... --mode=finish [LIBDIR]...
152195b296d0Smrg
152239713583SmrgComplete the installation of libtool libraries.
152395b296d0Smrg
152439713583SmrgEach LIBDIR is a directory that contains libtool libraries.
152595b296d0Smrg
152639713583SmrgThe commands that this mode executes may require superuser privileges.  Use
152739713583Smrgthe \`--dry-run' option if you just want to see what would be executed."
152839713583Smrg        ;;
152995b296d0Smrg
153039713583Smrg      install)
153139713583Smrg        $ECHO \
153239713583Smrg"Usage: $progname [OPTION]... --mode=install INSTALL-COMMAND...
153395b296d0Smrg
153439713583SmrgInstall executables or libraries.
153595b296d0Smrg
153639713583SmrgINSTALL-COMMAND is the installation command.  The first component should be
153739713583Smrgeither the \`install' or \`cp' program.
153895b296d0Smrg
153939713583SmrgThe following components of INSTALL-COMMAND are treated specially:
154095b296d0Smrg
154139713583Smrg  -inst-prefix PREFIX-DIR  Use PREFIX-DIR as a staging area for installation
154295b296d0Smrg
154339713583SmrgThe rest of the components are interpreted as arguments to that command (only
154439713583SmrgBSD-compatible install options are recognized)."
154539713583Smrg        ;;
154695b296d0Smrg
154739713583Smrg      link)
154839713583Smrg        $ECHO \
154939713583Smrg"Usage: $progname [OPTION]... --mode=link LINK-COMMAND...
155095b296d0Smrg
155139713583SmrgLink object files or libraries together to form another library, or to
155239713583Smrgcreate an executable program.
155395b296d0Smrg
155439713583SmrgLINK-COMMAND is a command using the C compiler that you would use to create
155539713583Smrga program from several object files.
155695b296d0Smrg
155739713583SmrgThe following components of LINK-COMMAND are treated specially:
155895b296d0Smrg
155939713583Smrg  -all-static       do not do any dynamic linking at all
156039713583Smrg  -avoid-version    do not add a version suffix if possible
156139713583Smrg  -dlopen FILE      \`-dlpreopen' FILE if it cannot be dlopened at runtime
156239713583Smrg  -dlpreopen FILE   link in FILE and add its symbols to lt_preloaded_symbols
156339713583Smrg  -export-dynamic   allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
156439713583Smrg  -export-symbols SYMFILE
156539713583Smrg                    try to export only the symbols listed in SYMFILE
156639713583Smrg  -export-symbols-regex REGEX
156739713583Smrg                    try to export only the symbols matching REGEX
156839713583Smrg  -LLIBDIR          search LIBDIR for required installed libraries
156939713583Smrg  -lNAME            OUTPUT-FILE requires the installed library libNAME
157039713583Smrg  -module           build a library that can dlopened
157139713583Smrg  -no-fast-install  disable the fast-install mode
157239713583Smrg  -no-install       link a not-installable executable
157339713583Smrg  -no-undefined     declare that a library does not refer to external symbols
157439713583Smrg  -o OUTPUT-FILE    create OUTPUT-FILE from the specified objects
157539713583Smrg  -objectlist FILE  Use a list of object files found in FILE to specify objects
157639713583Smrg  -precious-files-regex REGEX
157739713583Smrg                    don't remove output files matching REGEX
157839713583Smrg  -release RELEASE  specify package release information
157939713583Smrg  -rpath LIBDIR     the created library will eventually be installed in LIBDIR
158039713583Smrg  -R[ ]LIBDIR       add LIBDIR to the runtime path of programs and libraries
158139713583Smrg  -shared           only do dynamic linking of libtool libraries
158239713583Smrg  -shrext SUFFIX    override the standard shared library file extension
158339713583Smrg  -static           do not do any dynamic linking of uninstalled libtool libraries
158439713583Smrg  -static-libtool-libs
158539713583Smrg                    do not do any dynamic linking of libtool libraries
158639713583Smrg  -version-info CURRENT[:REVISION[:AGE]]
158739713583Smrg                    specify library version info [each variable defaults to 0]
158839713583Smrg  -weak LIBNAME     declare that the target provides the LIBNAME interface
158995b296d0Smrg
159039713583SmrgAll other options (arguments beginning with \`-') are ignored.
159195b296d0Smrg
159239713583SmrgEvery other argument is treated as a filename.  Files ending in \`.la' are
159339713583Smrgtreated as uninstalled libtool libraries, other files are standard or library
159439713583Smrgobject files.
1595ff89ac2bSmrg
159639713583SmrgIf the OUTPUT-FILE ends in \`.la', then a libtool library is created,
159739713583Smrgonly library objects (\`.lo' files) may be specified, and \`-rpath' is
159839713583Smrgrequired, except when creating a convenience library.
159995b296d0Smrg
160039713583SmrgIf OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created
160139713583Smrgusing \`ar' and \`ranlib', or on Windows using \`lib'.
160295b296d0Smrg
160339713583SmrgIf OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file
160439713583Smrgis created, otherwise an executable program is created."
160595b296d0Smrg        ;;
160695b296d0Smrg
160739713583Smrg      uninstall)
160839713583Smrg        $ECHO \
160939713583Smrg"Usage: $progname [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE...
161095b296d0Smrg
161139713583SmrgRemove libraries from an installation directory.
161295b296d0Smrg
161339713583SmrgRM is the name of the program to use to delete files associated with each FILE
161439713583Smrg(typically \`/bin/rm').  RM-OPTIONS are options (such as \`-f') to be passed
161539713583Smrgto RM.
161695b296d0Smrg
161739713583SmrgIf FILE is a libtool library, all the files associated with it are deleted.
161839713583SmrgOtherwise, only FILE itself is deleted using RM."
161939713583Smrg        ;;
162095b296d0Smrg
162139713583Smrg      *)
162239713583Smrg        func_fatal_help "invalid operation mode \`$mode'"
162339713583Smrg        ;;
162439713583Smrg    esac
162595b296d0Smrg
162639713583Smrg    $ECHO
162739713583Smrg    $ECHO "Try \`$progname --help' for more information about other modes."
162895b296d0Smrg
162939713583Smrg    exit $?
163039713583Smrg}
163195b296d0Smrg
163239713583Smrg  # Now that we've collected a possible --mode arg, show help if necessary
163339713583Smrg  $opt_help && func_mode_help
163495b296d0Smrg
163595b296d0Smrg
163639713583Smrg# func_mode_execute arg...
163739713583Smrgfunc_mode_execute ()
163839713583Smrg{
163939713583Smrg    $opt_debug
164039713583Smrg    # The first argument is the command name.
164139713583Smrg    cmd="$nonopt"
164239713583Smrg    test -z "$cmd" && \
164339713583Smrg      func_fatal_help "you must specify a COMMAND"
164495b296d0Smrg
164539713583Smrg    # Handle -dlopen flags immediately.
164639713583Smrg    for file in $execute_dlfiles; do
164739713583Smrg      test -f "$file" \
164839713583Smrg	|| func_fatal_help "\`$file' is not a file"
164995b296d0Smrg
165039713583Smrg      dir=
165139713583Smrg      case $file in
165239713583Smrg      *.la)
165339713583Smrg	# Check to see that this really is a libtool archive.
165439713583Smrg	func_lalib_unsafe_p "$file" \
165539713583Smrg	  || func_fatal_help "\`$lib' is not a valid libtool archive"
165695b296d0Smrg
165739713583Smrg	# Read the libtool library.
165839713583Smrg	dlname=
165939713583Smrg	library_names=
166039713583Smrg	func_source "$file"
166195b296d0Smrg
166239713583Smrg	# Skip this library if it cannot be dlopened.
166339713583Smrg	if test -z "$dlname"; then
166439713583Smrg	  # Warn if it was a shared library.
166539713583Smrg	  test -n "$library_names" && \
166639713583Smrg	    func_warning "\`$file' was not linked with \`-export-dynamic'"
166739713583Smrg	  continue
166839713583Smrg	fi
166995b296d0Smrg
167039713583Smrg	func_dirname "$file" "" "."
167139713583Smrg	dir="$func_dirname_result"
167295b296d0Smrg
167339713583Smrg	if test -f "$dir/$objdir/$dlname"; then
167439713583Smrg	  dir="$dir/$objdir"
167539713583Smrg	else
167639713583Smrg	  if test ! -f "$dir/$dlname"; then
167739713583Smrg	    func_fatal_error "cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'"
167839713583Smrg	  fi
167939713583Smrg	fi
168095b296d0Smrg	;;
168195b296d0Smrg
168239713583Smrg      *.lo)
168339713583Smrg	# Just add the directory containing the .lo file.
168439713583Smrg	func_dirname "$file" "" "."
168539713583Smrg	dir="$func_dirname_result"
168695b296d0Smrg	;;
168795b296d0Smrg
168839713583Smrg      *)
168939713583Smrg	func_warning "\`-dlopen' is ignored for non-libtool libraries and objects"
169095b296d0Smrg	continue
169195b296d0Smrg	;;
169239713583Smrg      esac
169395b296d0Smrg
169439713583Smrg      # Get the absolute pathname.
169539713583Smrg      absdir=`cd "$dir" && pwd`
169639713583Smrg      test -n "$absdir" && dir="$absdir"
169795b296d0Smrg
169839713583Smrg      # Now add the directory to shlibpath_var.
169939713583Smrg      if eval "test -z \"\$$shlibpath_var\""; then
170039713583Smrg	eval "$shlibpath_var=\"\$dir\""
170139713583Smrg      else
170239713583Smrg	eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\""
170339713583Smrg      fi
170439713583Smrg    done
170595b296d0Smrg
170639713583Smrg    # This variable tells wrapper scripts just to set shlibpath_var
170739713583Smrg    # rather than running their programs.
170839713583Smrg    libtool_execute_magic="$magic"
170995b296d0Smrg
171039713583Smrg    # Check if any of the arguments is a wrapper script.
171139713583Smrg    args=
171239713583Smrg    for file
171339713583Smrg    do
171439713583Smrg      case $file in
171539713583Smrg      -*) ;;
171639713583Smrg      *)
171739713583Smrg	# Do a test to see if this is really a libtool program.
171839713583Smrg	if func_ltwrapper_script_p "$file"; then
171939713583Smrg	  func_source "$file"
172039713583Smrg	  # Transform arg to wrapped name.
172139713583Smrg	  file="$progdir/$program"
172239713583Smrg	elif func_ltwrapper_executable_p "$file"; then
172339713583Smrg	  func_ltwrapper_scriptname "$file"
172439713583Smrg	  func_source "$func_ltwrapper_scriptname_result"
172539713583Smrg	  # Transform arg to wrapped name.
172639713583Smrg	  file="$progdir/$program"
172739713583Smrg	fi
172839713583Smrg	;;
172939713583Smrg      esac
173039713583Smrg      # Quote arguments (to preserve shell metacharacters).
173139713583Smrg      func_quote_for_eval "$file"
173239713583Smrg      args="$args $func_quote_for_eval_result"
173339713583Smrg    done
173495b296d0Smrg
173539713583Smrg    if test "X$opt_dry_run" = Xfalse; then
173639713583Smrg      if test -n "$shlibpath_var"; then
173739713583Smrg	# Export the shlibpath_var.
173839713583Smrg	eval "export $shlibpath_var"
173939713583Smrg      fi
174095b296d0Smrg
174139713583Smrg      # Restore saved environment variables
174239713583Smrg      for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
174339713583Smrg      do
174439713583Smrg	eval "if test \"\${save_$lt_var+set}\" = set; then
174539713583Smrg                $lt_var=\$save_$lt_var; export $lt_var
174695b296d0Smrg	      else
174739713583Smrg		$lt_unset $lt_var
174839713583Smrg	      fi"
174939713583Smrg      done
175095b296d0Smrg
175139713583Smrg      # Now prepare to actually exec the command.
175239713583Smrg      exec_cmd="\$cmd$args"
175339713583Smrg    else
175439713583Smrg      # Display what would be done.
175539713583Smrg      if test -n "$shlibpath_var"; then
175639713583Smrg	eval "\$ECHO \"\$shlibpath_var=\$$shlibpath_var\""
175739713583Smrg	$ECHO "export $shlibpath_var"
175839713583Smrg      fi
175939713583Smrg      $ECHO "$cmd$args"
176039713583Smrg      exit $EXIT_SUCCESS
176139713583Smrg    fi
176239713583Smrg}
176395b296d0Smrg
176439713583Smrgtest "$mode" = execute && func_mode_execute ${1+"$@"}
176595b296d0Smrg
176695b296d0Smrg
176739713583Smrg# func_mode_finish arg...
176839713583Smrgfunc_mode_finish ()
176939713583Smrg{
177039713583Smrg    $opt_debug
177139713583Smrg    libdirs="$nonopt"
177239713583Smrg    admincmds=
177395b296d0Smrg
177439713583Smrg    if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
177539713583Smrg      for dir
177639713583Smrg      do
177739713583Smrg	libdirs="$libdirs $dir"
177839713583Smrg      done
177995b296d0Smrg
178039713583Smrg      for libdir in $libdirs; do
178139713583Smrg	if test -n "$finish_cmds"; then
178239713583Smrg	  # Do each command in the finish commands.
178339713583Smrg	  func_execute_cmds "$finish_cmds" 'admincmds="$admincmds
178439713583Smrg'"$cmd"'"'
178595b296d0Smrg	fi
178639713583Smrg	if test -n "$finish_eval"; then
178739713583Smrg	  # Do the single finish_eval.
178839713583Smrg	  eval cmds=\"$finish_eval\"
178939713583Smrg	  $opt_dry_run || eval "$cmds" || admincmds="$admincmds
179039713583Smrg       $cmds"
179139713583Smrg	fi
179239713583Smrg      done
179339713583Smrg    fi
179495b296d0Smrg
179539713583Smrg    # Exit here if they wanted silent mode.
179639713583Smrg    $opt_silent && exit $EXIT_SUCCESS
179795b296d0Smrg
179839713583Smrg    $ECHO "X----------------------------------------------------------------------" | $Xsed
179939713583Smrg    $ECHO "Libraries have been installed in:"
180039713583Smrg    for libdir in $libdirs; do
180139713583Smrg      $ECHO "   $libdir"
180239713583Smrg    done
180339713583Smrg    $ECHO
180439713583Smrg    $ECHO "If you ever happen to want to link against installed libraries"
180539713583Smrg    $ECHO "in a given directory, LIBDIR, you must either use libtool, and"
180639713583Smrg    $ECHO "specify the full pathname of the library, or use the \`-LLIBDIR'"
180739713583Smrg    $ECHO "flag during linking and do at least one of the following:"
180839713583Smrg    if test -n "$shlibpath_var"; then
180939713583Smrg      $ECHO "   - add LIBDIR to the \`$shlibpath_var' environment variable"
181039713583Smrg      $ECHO "     during execution"
181139713583Smrg    fi
181239713583Smrg    if test -n "$runpath_var"; then
181339713583Smrg      $ECHO "   - add LIBDIR to the \`$runpath_var' environment variable"
181439713583Smrg      $ECHO "     during linking"
181539713583Smrg    fi
181639713583Smrg    if test -n "$hardcode_libdir_flag_spec"; then
181739713583Smrg      libdir=LIBDIR
181839713583Smrg      eval flag=\"$hardcode_libdir_flag_spec\"
181939713583Smrg
182039713583Smrg      $ECHO "   - use the \`$flag' linker flag"
182139713583Smrg    fi
182239713583Smrg    if test -n "$admincmds"; then
182339713583Smrg      $ECHO "   - have your system administrator run these commands:$admincmds"
182439713583Smrg    fi
182539713583Smrg    if test -f /etc/ld.so.conf; then
182639713583Smrg      $ECHO "   - have your system administrator add LIBDIR to \`/etc/ld.so.conf'"
182739713583Smrg    fi
182839713583Smrg    $ECHO
182939713583Smrg
183039713583Smrg    $ECHO "See any operating system documentation about shared libraries for"
183139713583Smrg    case $host in
183239713583Smrg      solaris2.[6789]|solaris2.1[0-9])
183339713583Smrg        $ECHO "more information, such as the ld(1), crle(1) and ld.so(8) manual"
183439713583Smrg	$ECHO "pages."
183539713583Smrg	;;
183639713583Smrg      *)
183739713583Smrg        $ECHO "more information, such as the ld(1) and ld.so(8) manual pages."
183839713583Smrg        ;;
183939713583Smrg    esac
184039713583Smrg    $ECHO "X----------------------------------------------------------------------" | $Xsed
184139713583Smrg    exit $EXIT_SUCCESS
184239713583Smrg}
184339713583Smrg
184439713583Smrgtest "$mode" = finish && func_mode_finish ${1+"$@"}
184539713583Smrg
184639713583Smrg
184739713583Smrg# func_mode_install arg...
184839713583Smrgfunc_mode_install ()
184939713583Smrg{
185039713583Smrg    $opt_debug
185139713583Smrg    # There may be an optional sh(1) argument at the beginning of
185239713583Smrg    # install_prog (especially on Windows NT).
185339713583Smrg    if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh ||
185439713583Smrg       # Allow the use of GNU shtool's install command.
185539713583Smrg       $ECHO "X$nonopt" | $GREP shtool >/dev/null; then
185639713583Smrg      # Aesthetically quote it.
185739713583Smrg      func_quote_for_eval "$nonopt"
185839713583Smrg      install_prog="$func_quote_for_eval_result "
185939713583Smrg      arg=$1
186039713583Smrg      shift
186139713583Smrg    else
186239713583Smrg      install_prog=
186339713583Smrg      arg=$nonopt
186439713583Smrg    fi
186539713583Smrg
186639713583Smrg    # The real first argument should be the name of the installation program.
186739713583Smrg    # Aesthetically quote it.
186839713583Smrg    func_quote_for_eval "$arg"
186939713583Smrg    install_prog="$install_prog$func_quote_for_eval_result"
187039713583Smrg
187139713583Smrg    # We need to accept at least all the BSD install flags.
187239713583Smrg    dest=
187339713583Smrg    files=
187439713583Smrg    opts=
187539713583Smrg    prev=
187639713583Smrg    install_type=
187739713583Smrg    isdir=no
187839713583Smrg    stripme=
187939713583Smrg    for arg
188039713583Smrg    do
188139713583Smrg      if test -n "$dest"; then
188239713583Smrg	files="$files $dest"
188339713583Smrg	dest=$arg
188439713583Smrg	continue
188539713583Smrg      fi
188639713583Smrg
188739713583Smrg      case $arg in
188839713583Smrg      -d) isdir=yes ;;
188939713583Smrg      -f)
189039713583Smrg	case " $install_prog " in
189139713583Smrg	*[\\\ /]cp\ *) ;;
189239713583Smrg	*) prev=$arg ;;
189339713583Smrg	esac
189439713583Smrg	;;
189539713583Smrg      -g | -m | -o)
189639713583Smrg	prev=$arg
189739713583Smrg	;;
189839713583Smrg      -s)
189939713583Smrg	stripme=" -s"
190039713583Smrg	continue
190139713583Smrg	;;
190239713583Smrg      -*)
190339713583Smrg	;;
190439713583Smrg      *)
190539713583Smrg	# If the previous option needed an argument, then skip it.
190639713583Smrg	if test -n "$prev"; then
190795b296d0Smrg	  prev=
190895b296d0Smrg	else
190939713583Smrg	  dest=$arg
191039713583Smrg	  continue
191195b296d0Smrg	fi
191295b296d0Smrg	;;
191339713583Smrg      esac
191495b296d0Smrg
191539713583Smrg      # Aesthetically quote the argument.
191639713583Smrg      func_quote_for_eval "$arg"
191739713583Smrg      install_prog="$install_prog $func_quote_for_eval_result"
191839713583Smrg    done
191995b296d0Smrg
192039713583Smrg    test -z "$install_prog" && \
192139713583Smrg      func_fatal_help "you must specify an install program"
192295b296d0Smrg
192339713583Smrg    test -n "$prev" && \
192439713583Smrg      func_fatal_help "the \`$prev' option requires an argument"
192595b296d0Smrg
192639713583Smrg    if test -z "$files"; then
192739713583Smrg      if test -z "$dest"; then
192839713583Smrg	func_fatal_help "no file or destination specified"
192939713583Smrg      else
193039713583Smrg	func_fatal_help "you must specify a destination"
193139713583Smrg      fi
193295b296d0Smrg    fi
193395b296d0Smrg
193439713583Smrg    # Strip any trailing slash from the destination.
193539713583Smrg    func_stripname '' '/' "$dest"
193639713583Smrg    dest=$func_stripname_result
193795b296d0Smrg
193839713583Smrg    # Check to see that the destination is a directory.
193939713583Smrg    test -d "$dest" && isdir=yes
194039713583Smrg    if test "$isdir" = yes; then
194139713583Smrg      destdir="$dest"
194239713583Smrg      destname=
194395b296d0Smrg    else
194439713583Smrg      func_dirname_and_basename "$dest" "" "."
194539713583Smrg      destdir="$func_dirname_result"
194639713583Smrg      destname="$func_basename_result"
194795b296d0Smrg
194839713583Smrg      # Not a directory, so check to see that there is only one file specified.
194939713583Smrg      set dummy $files; shift
195039713583Smrg      test "$#" -gt 1 && \
195139713583Smrg	func_fatal_help "\`$dest' is not a directory"
195295b296d0Smrg    fi
195339713583Smrg    case $destdir in
195439713583Smrg    [\\/]* | [A-Za-z]:[\\/]*) ;;
195595b296d0Smrg    *)
195639713583Smrg      for file in $files; do
195739713583Smrg	case $file in
195839713583Smrg	*.lo) ;;
195939713583Smrg	*)
196039713583Smrg	  func_fatal_help "\`$destdir' must be an absolute directory name"
196139713583Smrg	  ;;
196239713583Smrg	esac
196339713583Smrg      done
196495b296d0Smrg      ;;
196595b296d0Smrg    esac
196695b296d0Smrg
196739713583Smrg    # This variable tells wrapper scripts just to set variables rather
196839713583Smrg    # than running their programs.
196939713583Smrg    libtool_install_magic="$magic"
197095b296d0Smrg
197139713583Smrg    staticlibs=
197239713583Smrg    future_libdirs=
197339713583Smrg    current_libdirs=
197439713583Smrg    for file in $files; do
197595b296d0Smrg
197639713583Smrg      # Do each installation.
197739713583Smrg      case $file in
197839713583Smrg      *.$libext)
197939713583Smrg	# Do the static libraries later.
198039713583Smrg	staticlibs="$staticlibs $file"
198139713583Smrg	;;
198239713583Smrg
198339713583Smrg      *.la)
198439713583Smrg	# Check to see that this really is a libtool archive.
198539713583Smrg	func_lalib_unsafe_p "$file" \
198639713583Smrg	  || func_fatal_help "\`$file' is not a valid libtool archive"
198739713583Smrg
198839713583Smrg	library_names=
198939713583Smrg	old_library=
199039713583Smrg	relink_command=
199139713583Smrg	func_source "$file"
199239713583Smrg
199339713583Smrg	# Add the libdir to current_libdirs if it is the destination.
199439713583Smrg	if test "X$destdir" = "X$libdir"; then
199539713583Smrg	  case "$current_libdirs " in
199639713583Smrg	  *" $libdir "*) ;;
199739713583Smrg	  *) current_libdirs="$current_libdirs $libdir" ;;
199895b296d0Smrg	  esac
199939713583Smrg	else
200039713583Smrg	  # Note the libdir as a future libdir.
200139713583Smrg	  case "$future_libdirs " in
200239713583Smrg	  *" $libdir "*) ;;
200339713583Smrg	  *) future_libdirs="$future_libdirs $libdir" ;;
200439713583Smrg	  esac
200539713583Smrg	fi
200695b296d0Smrg
200739713583Smrg	func_dirname "$file" "/" ""
200839713583Smrg	dir="$func_dirname_result"
200939713583Smrg	dir="$dir$objdir"
201039713583Smrg
201139713583Smrg	if test -n "$relink_command"; then
201239713583Smrg	  # Determine the prefix the user has applied to our future dir.
201339713583Smrg	  inst_prefix_dir=`$ECHO "X$destdir" | $Xsed -e "s%$libdir\$%%"`
201439713583Smrg
201539713583Smrg	  # Don't allow the user to place us outside of our expected
201639713583Smrg	  # location b/c this prevents finding dependent libraries that
201739713583Smrg	  # are installed to the same prefix.
201839713583Smrg	  # At present, this check doesn't affect windows .dll's that
201939713583Smrg	  # are installed into $libdir/../bin (currently, that works fine)
202039713583Smrg	  # but it's something to keep an eye on.
202139713583Smrg	  test "$inst_prefix_dir" = "$destdir" && \
202239713583Smrg	    func_fatal_error "error: cannot install \`$file' to a directory not ending in $libdir"
202339713583Smrg
202439713583Smrg	  if test -n "$inst_prefix_dir"; then
202539713583Smrg	    # Stick the inst_prefix_dir data into the link command.
202639713583Smrg	    relink_command=`$ECHO "X$relink_command" | $Xsed -e "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"`
202739713583Smrg	  else
202839713583Smrg	    relink_command=`$ECHO "X$relink_command" | $Xsed -e "s%@inst_prefix_dir@%%"`
202939713583Smrg	  fi
203039713583Smrg
203139713583Smrg	  func_warning "relinking \`$file'"
203239713583Smrg	  func_show_eval "$relink_command" \
203339713583Smrg	    'func_fatal_error "error: relink \`$file'\'' with the above command before installing it"'
203439713583Smrg	fi
203539713583Smrg
203639713583Smrg	# See the names of the shared library.
203739713583Smrg	set dummy $library_names; shift
203839713583Smrg	if test -n "$1"; then
203939713583Smrg	  realname="$1"
204039713583Smrg	  shift
204139713583Smrg
204239713583Smrg	  srcname="$realname"
204339713583Smrg	  test -n "$relink_command" && srcname="$realname"T
204439713583Smrg
204539713583Smrg	  # Install the shared library and build the symlinks.
204639713583Smrg	  func_show_eval "$install_prog $dir/$srcname $destdir/$realname" \
204739713583Smrg	      'exit $?'
204839713583Smrg	  tstripme="$stripme"
204939713583Smrg	  case $host_os in
205039713583Smrg	  cygwin* | mingw* | pw32* | cegcc*)
205139713583Smrg	    case $realname in
205239713583Smrg	    *.dll.a)
205339713583Smrg	      tstripme=""
205439713583Smrg	      ;;
205539713583Smrg	    esac
205695b296d0Smrg	    ;;
205795b296d0Smrg	  esac
205839713583Smrg	  if test -n "$tstripme" && test -n "$striplib"; then
205939713583Smrg	    func_show_eval "$striplib $destdir/$realname" 'exit $?'
206095b296d0Smrg	  fi
206139713583Smrg
206239713583Smrg	  if test "$#" -gt 0; then
206339713583Smrg	    # Delete the old symlinks, and create new ones.
206439713583Smrg	    # Try `ln -sf' first, because the `ln' binary might depend on
206539713583Smrg	    # the symlink we replace!  Solaris /bin/ln does not understand -f,
206639713583Smrg	    # so we also need to try rm && ln -s.
206739713583Smrg	    for linkname
206839713583Smrg	    do
206939713583Smrg	      test "$linkname" != "$realname" \
207039713583Smrg		&& func_show_eval "(cd $destdir && { $LN_S -f $realname $linkname || { $RM $linkname && $LN_S $realname $linkname; }; })"
207195b296d0Smrg	    done
207295b296d0Smrg	  fi
207395b296d0Smrg
207439713583Smrg	  # Do each command in the postinstall commands.
207539713583Smrg	  lib="$destdir/$realname"
207639713583Smrg	  func_execute_cmds "$postinstall_cmds" 'exit $?'
207795b296d0Smrg	fi
207895b296d0Smrg
207939713583Smrg	# Install the pseudo-library for information purposes.
208039713583Smrg	func_basename "$file"
208139713583Smrg	name="$func_basename_result"
208239713583Smrg	instname="$dir/$name"i
208339713583Smrg	func_show_eval "$install_prog $instname $destdir/$name" 'exit $?'
208495b296d0Smrg
208539713583Smrg	# Maybe install the static library, too.
208639713583Smrg	test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library"
208739713583Smrg	;;
208895b296d0Smrg
208939713583Smrg      *.lo)
209039713583Smrg	# Install (i.e. copy) a libtool object.
209195b296d0Smrg
209239713583Smrg	# Figure out destination file name, if it wasn't already specified.
209339713583Smrg	if test -n "$destname"; then
209439713583Smrg	  destfile="$destdir/$destname"
209539713583Smrg	else
209639713583Smrg	  func_basename "$file"
209739713583Smrg	  destfile="$func_basename_result"
209839713583Smrg	  destfile="$destdir/$destfile"
209995b296d0Smrg	fi
210095b296d0Smrg
210139713583Smrg	# Deduce the name of the destination old-style object file.
210239713583Smrg	case $destfile in
210339713583Smrg	*.lo)
210439713583Smrg	  func_lo2o "$destfile"
210539713583Smrg	  staticdest=$func_lo2o_result
210639713583Smrg	  ;;
210739713583Smrg	*.$objext)
210839713583Smrg	  staticdest="$destfile"
210939713583Smrg	  destfile=
211039713583Smrg	  ;;
211139713583Smrg	*)
211239713583Smrg	  func_fatal_help "cannot copy a libtool object to \`$destfile'"
211339713583Smrg	  ;;
211439713583Smrg	esac
211595b296d0Smrg
211639713583Smrg	# Install the libtool object if requested.
211739713583Smrg	test -n "$destfile" && \
211839713583Smrg	  func_show_eval "$install_prog $file $destfile" 'exit $?'
211995b296d0Smrg
212039713583Smrg	# Install the old object if enabled.
212139713583Smrg	if test "$build_old_libs" = yes; then
212239713583Smrg	  # Deduce the name of the old-style object file.
212339713583Smrg	  func_lo2o "$file"
212439713583Smrg	  staticobj=$func_lo2o_result
212539713583Smrg	  func_show_eval "$install_prog \$staticobj \$staticdest" 'exit $?'
212695b296d0Smrg	fi
212739713583Smrg	exit $EXIT_SUCCESS
212839713583Smrg	;;
212995b296d0Smrg
213039713583Smrg      *)
213139713583Smrg	# Figure out destination file name, if it wasn't already specified.
213239713583Smrg	if test -n "$destname"; then
213339713583Smrg	  destfile="$destdir/$destname"
213439713583Smrg	else
213539713583Smrg	  func_basename "$file"
213639713583Smrg	  destfile="$func_basename_result"
213739713583Smrg	  destfile="$destdir/$destfile"
213839713583Smrg	fi
213995b296d0Smrg
214039713583Smrg	# If the file is missing, and there is a .exe on the end, strip it
214139713583Smrg	# because it is most likely a libtool script we actually want to
214239713583Smrg	# install
214339713583Smrg	stripped_ext=""
214439713583Smrg	case $file in
214539713583Smrg	  *.exe)
214639713583Smrg	    if test ! -f "$file"; then
214739713583Smrg	      func_stripname '' '.exe' "$file"
214839713583Smrg	      file=$func_stripname_result
214939713583Smrg	      stripped_ext=".exe"
215039713583Smrg	    fi
215139713583Smrg	    ;;
215239713583Smrg	esac
215339713583Smrg
215439713583Smrg	# Do a test to see if this is really a libtool program.
215539713583Smrg	case $host in
215639713583Smrg	*cygwin* | *mingw*)
215739713583Smrg	    if func_ltwrapper_executable_p "$file"; then
215839713583Smrg	      func_ltwrapper_scriptname "$file"
215939713583Smrg	      wrapper=$func_ltwrapper_scriptname_result
216039713583Smrg	    else
216139713583Smrg	      func_stripname '' '.exe' "$file"
216239713583Smrg	      wrapper=$func_stripname_result
216339713583Smrg	    fi
216439713583Smrg	    ;;
216595b296d0Smrg	*)
216639713583Smrg	    wrapper=$file
216739713583Smrg	    ;;
216839713583Smrg	esac
216939713583Smrg	if func_ltwrapper_script_p "$wrapper"; then
217039713583Smrg	  notinst_deplibs=
217139713583Smrg	  relink_command=
217239713583Smrg
217339713583Smrg	  func_source "$wrapper"
217439713583Smrg
217539713583Smrg	  # Check the variables that should have been set.
217639713583Smrg	  test -z "$generated_by_libtool_version" && \
217739713583Smrg	    func_fatal_error "invalid libtool wrapper script \`$wrapper'"
217839713583Smrg
217939713583Smrg	  finalize=yes
218039713583Smrg	  for lib in $notinst_deplibs; do
218139713583Smrg	    # Check to see that each library is installed.
218239713583Smrg	    libdir=
218339713583Smrg	    if test -f "$lib"; then
218439713583Smrg	      func_source "$lib"
218539713583Smrg	    fi
218639713583Smrg	    libfile="$libdir/"`$ECHO "X$lib" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test
218739713583Smrg	    if test -n "$libdir" && test ! -f "$libfile"; then
218839713583Smrg	      func_warning "\`$lib' has not been installed in \`$libdir'"
218939713583Smrg	      finalize=no
219039713583Smrg	    fi
219139713583Smrg	  done
219239713583Smrg
219339713583Smrg	  relink_command=
219439713583Smrg	  func_source "$wrapper"
219539713583Smrg
219639713583Smrg	  outputname=
219739713583Smrg	  if test "$fast_install" = no && test -n "$relink_command"; then
219839713583Smrg	    $opt_dry_run || {
219939713583Smrg	      if test "$finalize" = yes; then
220039713583Smrg	        tmpdir=`func_mktempdir`
220139713583Smrg		func_basename "$file$stripped_ext"
220239713583Smrg		file="$func_basename_result"
220339713583Smrg	        outputname="$tmpdir/$file"
220439713583Smrg	        # Replace the output file specification.
220539713583Smrg	        relink_command=`$ECHO "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'`
220639713583Smrg
220739713583Smrg	        $opt_silent || {
220839713583Smrg	          func_quote_for_expand "$relink_command"
220939713583Smrg		  eval "func_echo $func_quote_for_expand_result"
221039713583Smrg	        }
221139713583Smrg	        if eval "$relink_command"; then :
221239713583Smrg	          else
221339713583Smrg		  func_error "error: relink \`$file' with the above command before installing it"
221439713583Smrg		  $opt_dry_run || ${RM}r "$tmpdir"
221539713583Smrg		  continue
221639713583Smrg	        fi
221739713583Smrg	        file="$outputname"
221839713583Smrg	      else
221939713583Smrg	        func_warning "cannot relink \`$file'"
222039713583Smrg	      fi
222139713583Smrg	    }
222239713583Smrg	  else
222339713583Smrg	    # Install the binary that we compiled earlier.
222439713583Smrg	    file=`$ECHO "X$file$stripped_ext" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"`
222595b296d0Smrg	  fi
222639713583Smrg	fi
222739713583Smrg
222839713583Smrg	# remove .exe since cygwin /usr/bin/install will append another
222939713583Smrg	# one anyway
223039713583Smrg	case $install_prog,$host in
223139713583Smrg	*/usr/bin/install*,*cygwin*)
223239713583Smrg	  case $file:$destfile in
223339713583Smrg	  *.exe:*.exe)
223439713583Smrg	    # this is ok
223539713583Smrg	    ;;
223639713583Smrg	  *.exe:*)
223739713583Smrg	    destfile=$destfile.exe
223839713583Smrg	    ;;
223939713583Smrg	  *:*.exe)
224039713583Smrg	    func_stripname '' '.exe' "$destfile"
224139713583Smrg	    destfile=$func_stripname_result
224239713583Smrg	    ;;
224339713583Smrg	  esac
224495b296d0Smrg	  ;;
224595b296d0Smrg	esac
224639713583Smrg	func_show_eval "$install_prog\$stripme \$file \$destfile" 'exit $?'
224739713583Smrg	$opt_dry_run || if test -n "$outputname"; then
224839713583Smrg	  ${RM}r "$tmpdir"
224939713583Smrg	fi
225039713583Smrg	;;
225139713583Smrg      esac
225239713583Smrg    done
225395b296d0Smrg
225439713583Smrg    for file in $staticlibs; do
225539713583Smrg      func_basename "$file"
225639713583Smrg      name="$func_basename_result"
225739713583Smrg
225839713583Smrg      # Set up the ranlib parameters.
225939713583Smrg      oldlib="$destdir/$name"
226039713583Smrg
226139713583Smrg      func_show_eval "$install_prog \$file \$oldlib" 'exit $?'
226239713583Smrg
226339713583Smrg      if test -n "$stripme" && test -n "$old_striplib"; then
226439713583Smrg	func_show_eval "$old_striplib $oldlib" 'exit $?'
226539713583Smrg      fi
226639713583Smrg
226739713583Smrg      # Do each command in the postinstall commands.
226839713583Smrg      func_execute_cmds "$old_postinstall_cmds" 'exit $?'
226939713583Smrg    done
227039713583Smrg
227139713583Smrg    test -n "$future_libdirs" && \
227239713583Smrg      func_warning "remember to run \`$progname --finish$future_libdirs'"
227339713583Smrg
227439713583Smrg    if test -n "$current_libdirs"; then
227539713583Smrg      # Maybe just do a dry run.
227639713583Smrg      $opt_dry_run && current_libdirs=" -n$current_libdirs"
227739713583Smrg      exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs'
227839713583Smrg    else
227939713583Smrg      exit $EXIT_SUCCESS
228039713583Smrg    fi
228139713583Smrg}
228239713583Smrg
228339713583Smrgtest "$mode" = install && func_mode_install ${1+"$@"}
228439713583Smrg
228539713583Smrg
228639713583Smrg# func_generate_dlsyms outputname originator pic_p
228739713583Smrg# Extract symbols from dlprefiles and create ${outputname}S.o with
228839713583Smrg# a dlpreopen symbol table.
228939713583Smrgfunc_generate_dlsyms ()
229039713583Smrg{
229139713583Smrg    $opt_debug
229239713583Smrg    my_outputname="$1"
229339713583Smrg    my_originator="$2"
229439713583Smrg    my_pic_p="${3-no}"
229539713583Smrg    my_prefix=`$ECHO "$my_originator" | sed 's%[^a-zA-Z0-9]%_%g'`
229639713583Smrg    my_dlsyms=
229739713583Smrg
229839713583Smrg    if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
229939713583Smrg      if test -n "$NM" && test -n "$global_symbol_pipe"; then
230039713583Smrg	my_dlsyms="${my_outputname}S.c"
230139713583Smrg      else
230239713583Smrg	func_error "not configured to extract global symbols from dlpreopened files"
230339713583Smrg      fi
230439713583Smrg    fi
230539713583Smrg
230639713583Smrg    if test -n "$my_dlsyms"; then
230739713583Smrg      case $my_dlsyms in
230839713583Smrg      "") ;;
230939713583Smrg      *.c)
231039713583Smrg	# Discover the nlist of each of the dlfiles.
231139713583Smrg	nlist="$output_objdir/${my_outputname}.nm"
231239713583Smrg
231339713583Smrg	func_show_eval "$RM $nlist ${nlist}S ${nlist}T"
231439713583Smrg
231539713583Smrg	# Parse the name list into a source file.
231639713583Smrg	func_verbose "creating $output_objdir/$my_dlsyms"
231739713583Smrg
231839713583Smrg	$opt_dry_run || $ECHO > "$output_objdir/$my_dlsyms" "\
231939713583Smrg/* $my_dlsyms - symbol resolution table for \`$my_outputname' dlsym emulation. */
232039713583Smrg/* Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION */
232139713583Smrg
232239713583Smrg#ifdef __cplusplus
232339713583Smrgextern \"C\" {
232439713583Smrg#endif
232539713583Smrg
232639713583Smrg/* External symbol declarations for the compiler. */\
232739713583Smrg"
232839713583Smrg
232939713583Smrg	if test "$dlself" = yes; then
233039713583Smrg	  func_verbose "generating symbol list for \`$output'"
233139713583Smrg
233239713583Smrg	  $opt_dry_run || echo ': @PROGRAM@ ' > "$nlist"
233339713583Smrg
233439713583Smrg	  # Add our own program objects to the symbol list.
233539713583Smrg	  progfiles=`$ECHO "X$objs$old_deplibs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
233639713583Smrg	  for progfile in $progfiles; do
233739713583Smrg	    func_verbose "extracting global C symbols from \`$progfile'"
233839713583Smrg	    $opt_dry_run || eval "$NM $progfile | $global_symbol_pipe >> '$nlist'"
233939713583Smrg	  done
234039713583Smrg
234139713583Smrg	  if test -n "$exclude_expsyms"; then
234239713583Smrg	    $opt_dry_run || {
234339713583Smrg	      eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
234439713583Smrg	      eval '$MV "$nlist"T "$nlist"'
234539713583Smrg	    }
234695b296d0Smrg	  fi
234739713583Smrg
234839713583Smrg	  if test -n "$export_symbols_regex"; then
234939713583Smrg	    $opt_dry_run || {
235039713583Smrg	      eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T'
235139713583Smrg	      eval '$MV "$nlist"T "$nlist"'
235239713583Smrg	    }
235339713583Smrg	  fi
235439713583Smrg
235539713583Smrg	  # Prepare the list of exported symbols
235639713583Smrg	  if test -z "$export_symbols"; then
235739713583Smrg	    export_symbols="$output_objdir/$outputname.exp"
235839713583Smrg	    $opt_dry_run || {
235939713583Smrg	      $RM $export_symbols
236039713583Smrg	      eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
236139713583Smrg	      case $host in
236239713583Smrg	      *cygwin* | *mingw* | *cegcc* )
236339713583Smrg                eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
236439713583Smrg                eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"'
236539713583Smrg	        ;;
236639713583Smrg	      esac
236739713583Smrg	    }
236895b296d0Smrg	  else
236939713583Smrg	    $opt_dry_run || {
237039713583Smrg	      eval "${SED} -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"'
237139713583Smrg	      eval '$GREP -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T'
237239713583Smrg	      eval '$MV "$nlist"T "$nlist"'
237339713583Smrg	      case $host in
237439713583Smrg	        *cygwin | *mingw* | *cegcc* )
237539713583Smrg	          eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
237639713583Smrg	          eval 'cat "$nlist" >> "$output_objdir/$outputname.def"'
237739713583Smrg	          ;;
237839713583Smrg	      esac
237939713583Smrg	    }
238095b296d0Smrg	  fi
238139713583Smrg	fi
238295b296d0Smrg
238339713583Smrg	for dlprefile in $dlprefiles; do
238439713583Smrg	  func_verbose "extracting global C symbols from \`$dlprefile'"
238539713583Smrg	  func_basename "$dlprefile"
238639713583Smrg	  name="$func_basename_result"
238739713583Smrg	  $opt_dry_run || {
238839713583Smrg	    eval '$ECHO ": $name " >> "$nlist"'
238939713583Smrg	    eval "$NM $dlprefile 2>/dev/null | $global_symbol_pipe >> '$nlist'"
239039713583Smrg	  }
239139713583Smrg	done
239239713583Smrg
239339713583Smrg	$opt_dry_run || {
239439713583Smrg	  # Make sure we have at least an empty file.
239539713583Smrg	  test -f "$nlist" || : > "$nlist"
239639713583Smrg
239739713583Smrg	  if test -n "$exclude_expsyms"; then
239839713583Smrg	    $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T
239939713583Smrg	    $MV "$nlist"T "$nlist"
240095b296d0Smrg	  fi
240139713583Smrg
240239713583Smrg	  # Try sorting and uniquifying the output.
240339713583Smrg	  if $GREP -v "^: " < "$nlist" |
240439713583Smrg	      if sort -k 3 </dev/null >/dev/null 2>&1; then
240539713583Smrg		sort -k 3
240639713583Smrg	      else
240739713583Smrg		sort +2
240839713583Smrg	      fi |
240939713583Smrg	      uniq > "$nlist"S; then
241039713583Smrg	    :
241195b296d0Smrg	  else
241239713583Smrg	    $GREP -v "^: " < "$nlist" > "$nlist"S
241395b296d0Smrg	  fi
241495b296d0Smrg
241539713583Smrg	  if test -f "$nlist"S; then
241639713583Smrg	    eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$my_dlsyms"'
241795b296d0Smrg	  else
241839713583Smrg	    $ECHO '/* NONE */' >> "$output_objdir/$my_dlsyms"
241995b296d0Smrg	  fi
242095b296d0Smrg
242139713583Smrg	  $ECHO >> "$output_objdir/$my_dlsyms" "\
242295b296d0Smrg
242339713583Smrg/* The mapping between symbol names and symbols.  */
242439713583Smrgtypedef struct {
242539713583Smrg  const char *name;
242639713583Smrg  void *address;
242739713583Smrg} lt_dlsymlist;
242839713583Smrg"
242939713583Smrg	  case $host in
243039713583Smrg	  *cygwin* | *mingw* | *cegcc* )
243139713583Smrg	    $ECHO >> "$output_objdir/$my_dlsyms" "\
243239713583Smrg/* DATA imports from DLLs on WIN32 con't be const, because
243339713583Smrg   runtime relocations are performed -- see ld's documentation
243439713583Smrg   on pseudo-relocs.  */"
243539713583Smrg	    lt_dlsym_const= ;;
243639713583Smrg	  *osf5*)
243739713583Smrg	    echo >> "$output_objdir/$my_dlsyms" "\
243839713583Smrg/* This system does not cope well with relocations in const data */"
243939713583Smrg	    lt_dlsym_const= ;;
244039713583Smrg	  *)
244139713583Smrg	    lt_dlsym_const=const ;;
244239713583Smrg	  esac
244395b296d0Smrg
244439713583Smrg	  $ECHO >> "$output_objdir/$my_dlsyms" "\
244539713583Smrgextern $lt_dlsym_const lt_dlsymlist
244639713583Smrglt_${my_prefix}_LTX_preloaded_symbols[];
244739713583Smrg$lt_dlsym_const lt_dlsymlist
244839713583Smrglt_${my_prefix}_LTX_preloaded_symbols[] =
244939713583Smrg{\
245039713583Smrg  { \"$my_originator\", (void *) 0 },"
245195b296d0Smrg
245239713583Smrg	  case $need_lib_prefix in
245339713583Smrg	  no)
245439713583Smrg	    eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$my_dlsyms"
245539713583Smrg	    ;;
245639713583Smrg	  *)
245739713583Smrg	    eval "$global_symbol_to_c_name_address_lib_prefix" < "$nlist" >> "$output_objdir/$my_dlsyms"
245839713583Smrg	    ;;
245939713583Smrg	  esac
246039713583Smrg	  $ECHO >> "$output_objdir/$my_dlsyms" "\
246139713583Smrg  {0, (void *) 0}
246239713583Smrg};
246395b296d0Smrg
246439713583Smrg/* This works around a problem in FreeBSD linker */
246539713583Smrg#ifdef FREEBSD_WORKAROUND
246639713583Smrgstatic const void *lt_preloaded_setup() {
246739713583Smrg  return lt_${my_prefix}_LTX_preloaded_symbols;
246839713583Smrg}
246939713583Smrg#endif
247039713583Smrg
247139713583Smrg#ifdef __cplusplus
247239713583Smrg}
247339713583Smrg#endif\
247439713583Smrg"
247539713583Smrg	} # !$opt_dry_run
247639713583Smrg
247739713583Smrg	pic_flag_for_symtable=
247839713583Smrg	case "$compile_command " in
247939713583Smrg	*" -static "*) ;;
248039713583Smrg	*)
248139713583Smrg	  case $host in
248239713583Smrg	  # compiling the symbol table file with pic_flag works around
248339713583Smrg	  # a FreeBSD bug that causes programs to crash when -lm is
248439713583Smrg	  # linked before any other PIC object.  But we must not use
248539713583Smrg	  # pic_flag when linking with -static.  The problem exists in
248639713583Smrg	  # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1.
248739713583Smrg	  *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)
248839713583Smrg	    pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND" ;;
248939713583Smrg	  *-*-hpux*)
249039713583Smrg	    pic_flag_for_symtable=" $pic_flag"  ;;
249139713583Smrg	  *)
249239713583Smrg	    if test "X$my_pic_p" != Xno; then
249339713583Smrg	      pic_flag_for_symtable=" $pic_flag"
249495b296d0Smrg	    fi
249539713583Smrg	    ;;
249639713583Smrg	  esac
249739713583Smrg	  ;;
249839713583Smrg	esac
249939713583Smrg	symtab_cflags=
250039713583Smrg	for arg in $LTCFLAGS; do
250139713583Smrg	  case $arg in
250239713583Smrg	  -pie | -fpie | -fPIE) ;;
250339713583Smrg	  *) symtab_cflags="$symtab_cflags $arg" ;;
250439713583Smrg	  esac
250539713583Smrg	done
250695b296d0Smrg
250739713583Smrg	# Now compile the dynamic symbol file.
250839713583Smrg	func_show_eval '(cd $output_objdir && $LTCC$symtab_cflags -c$no_builtin_flag$pic_flag_for_symtable "$my_dlsyms")' 'exit $?'
250995b296d0Smrg
251039713583Smrg	# Clean up the generated files.
251139713583Smrg	func_show_eval '$RM "$output_objdir/$my_dlsyms" "$nlist" "${nlist}S" "${nlist}T"'
251295b296d0Smrg
251339713583Smrg	# Transform the symbol file into the correct name.
251439713583Smrg	symfileobj="$output_objdir/${my_outputname}S.$objext"
251539713583Smrg	case $host in
251639713583Smrg	*cygwin* | *mingw* | *cegcc* )
251739713583Smrg	  if test -f "$output_objdir/$my_outputname.def"; then
251839713583Smrg	    compile_command=`$ECHO "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"`
251939713583Smrg	    finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"`
252039713583Smrg	  else
252139713583Smrg	    compile_command=`$ECHO "X$compile_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"`
252239713583Smrg	    finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"`
252395b296d0Smrg	  fi
252439713583Smrg	  ;;
252539713583Smrg	*)
252639713583Smrg	  compile_command=`$ECHO "X$compile_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"`
252739713583Smrg	  finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"`
252839713583Smrg	  ;;
252939713583Smrg	esac
253039713583Smrg	;;
253139713583Smrg      *)
253239713583Smrg	func_fatal_error "unknown suffix for \`$my_dlsyms'"
253339713583Smrg	;;
253439713583Smrg      esac
253539713583Smrg    else
253639713583Smrg      # We keep going just in case the user didn't refer to
253739713583Smrg      # lt_preloaded_symbols.  The linker will fail if global_symbol_pipe
253839713583Smrg      # really was required.
253995b296d0Smrg
254039713583Smrg      # Nullify the symbol file.
254139713583Smrg      compile_command=`$ECHO "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"`
254239713583Smrg      finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"`
254339713583Smrg    fi
254439713583Smrg}
254595b296d0Smrg
254639713583Smrg# func_win32_libid arg
254739713583Smrg# return the library type of file 'arg'
254839713583Smrg#
254939713583Smrg# Need a lot of goo to handle *both* DLLs and import libs
255039713583Smrg# Has to be a shell function in order to 'eat' the argument
255139713583Smrg# that is supplied when $file_magic_command is called.
255239713583Smrgfunc_win32_libid ()
255339713583Smrg{
255439713583Smrg  $opt_debug
255539713583Smrg  win32_libid_type="unknown"
255639713583Smrg  win32_fileres=`file -L $1 2>/dev/null`
255739713583Smrg  case $win32_fileres in
255839713583Smrg  *ar\ archive\ import\ library*) # definitely import
255939713583Smrg    win32_libid_type="x86 archive import"
256039713583Smrg    ;;
256139713583Smrg  *ar\ archive*) # could be an import, or static
256239713583Smrg    if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null |
256339713583Smrg       $EGREP 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then
256439713583Smrg      win32_nmres=`eval $NM -f posix -A $1 |
256539713583Smrg	$SED -n -e '
256639713583Smrg	    1,100{
256739713583Smrg		/ I /{
256839713583Smrg		    s,.*,import,
256939713583Smrg		    p
257039713583Smrg		    q
257139713583Smrg		}
257239713583Smrg	    }'`
257339713583Smrg      case $win32_nmres in
257439713583Smrg      import*)  win32_libid_type="x86 archive import";;
257539713583Smrg      *)        win32_libid_type="x86 archive static";;
257639713583Smrg      esac
257739713583Smrg    fi
257839713583Smrg    ;;
257939713583Smrg  *DLL*)
258039713583Smrg    win32_libid_type="x86 DLL"
258139713583Smrg    ;;
258239713583Smrg  *executable*) # but shell scripts are "executable" too...
258339713583Smrg    case $win32_fileres in
258439713583Smrg    *MS\ Windows\ PE\ Intel*)
258539713583Smrg      win32_libid_type="x86 DLL"
258639713583Smrg      ;;
258739713583Smrg    esac
258839713583Smrg    ;;
258939713583Smrg  esac
259039713583Smrg  $ECHO "$win32_libid_type"
259139713583Smrg}
259295b296d0Smrg
259395b296d0Smrg
259495b296d0Smrg
259539713583Smrg# func_extract_an_archive dir oldlib
259639713583Smrgfunc_extract_an_archive ()
259739713583Smrg{
259839713583Smrg    $opt_debug
259939713583Smrg    f_ex_an_ar_dir="$1"; shift
260039713583Smrg    f_ex_an_ar_oldlib="$1"
260139713583Smrg    func_show_eval "(cd \$f_ex_an_ar_dir && $AR x \"\$f_ex_an_ar_oldlib\")" 'exit $?'
260239713583Smrg    if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then
260339713583Smrg     :
260439713583Smrg    else
260539713583Smrg      func_fatal_error "object name conflicts in archive: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib"
260639713583Smrg    fi
260739713583Smrg}
260895b296d0Smrg
260995b296d0Smrg
261039713583Smrg# func_extract_archives gentop oldlib ...
261139713583Smrgfunc_extract_archives ()
261239713583Smrg{
261339713583Smrg    $opt_debug
261439713583Smrg    my_gentop="$1"; shift
261539713583Smrg    my_oldlibs=${1+"$@"}
261639713583Smrg    my_oldobjs=""
261739713583Smrg    my_xlib=""
261839713583Smrg    my_xabs=""
261939713583Smrg    my_xdir=""
262095b296d0Smrg
262139713583Smrg    for my_xlib in $my_oldlibs; do
262239713583Smrg      # Extract the objects.
262339713583Smrg      case $my_xlib in
262439713583Smrg	[\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;;
262539713583Smrg	*) my_xabs=`pwd`"/$my_xlib" ;;
262639713583Smrg      esac
262739713583Smrg      func_basename "$my_xlib"
262839713583Smrg      my_xlib="$func_basename_result"
262939713583Smrg      my_xlib_u=$my_xlib
263039713583Smrg      while :; do
263139713583Smrg        case " $extracted_archives " in
263239713583Smrg	*" $my_xlib_u "*)
263339713583Smrg	  func_arith $extracted_serial + 1
263439713583Smrg	  extracted_serial=$func_arith_result
263539713583Smrg	  my_xlib_u=lt$extracted_serial-$my_xlib ;;
263639713583Smrg	*) break ;;
263739713583Smrg	esac
263839713583Smrg      done
263939713583Smrg      extracted_archives="$extracted_archives $my_xlib_u"
264039713583Smrg      my_xdir="$my_gentop/$my_xlib_u"
264195b296d0Smrg
264239713583Smrg      func_mkdir_p "$my_xdir"
264395b296d0Smrg
264439713583Smrg      case $host in
264539713583Smrg      *-darwin*)
264639713583Smrg	func_verbose "Extracting $my_xabs"
264739713583Smrg	# Do not bother doing anything if just a dry run
264839713583Smrg	$opt_dry_run || {
264939713583Smrg	  darwin_orig_dir=`pwd`
265039713583Smrg	  cd $my_xdir || exit $?
265139713583Smrg	  darwin_archive=$my_xabs
265239713583Smrg	  darwin_curdir=`pwd`
265339713583Smrg	  darwin_base_archive=`basename "$darwin_archive"`
265439713583Smrg	  darwin_arches=`$LIPO -info "$darwin_archive" 2>/dev/null | $GREP Architectures 2>/dev/null || true`
265539713583Smrg	  if test -n "$darwin_arches"; then
265639713583Smrg	    darwin_arches=`$ECHO "$darwin_arches" | $SED -e 's/.*are://'`
265739713583Smrg	    darwin_arch=
265839713583Smrg	    func_verbose "$darwin_base_archive has multiple architectures $darwin_arches"
265939713583Smrg	    for darwin_arch in  $darwin_arches ; do
266039713583Smrg	      func_mkdir_p "unfat-$$/${darwin_base_archive}-${darwin_arch}"
266139713583Smrg	      $LIPO -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}"
266239713583Smrg	      cd "unfat-$$/${darwin_base_archive}-${darwin_arch}"
266339713583Smrg	      func_extract_an_archive "`pwd`" "${darwin_base_archive}"
266439713583Smrg	      cd "$darwin_curdir"
266539713583Smrg	      $RM "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}"
266639713583Smrg	    done # $darwin_arches
266739713583Smrg            ## Okay now we've a bunch of thin objects, gotta fatten them up :)
266839713583Smrg	    darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print | $SED -e "$basename" | sort -u`
266939713583Smrg	    darwin_file=
267039713583Smrg	    darwin_files=
267139713583Smrg	    for darwin_file in $darwin_filelist; do
267239713583Smrg	      darwin_files=`find unfat-$$ -name $darwin_file -print | $NL2SP`
267339713583Smrg	      $LIPO -create -output "$darwin_file" $darwin_files
267439713583Smrg	    done # $darwin_filelist
267539713583Smrg	    $RM -rf unfat-$$
267639713583Smrg	    cd "$darwin_orig_dir"
267795b296d0Smrg	  else
267839713583Smrg	    cd $darwin_orig_dir
267939713583Smrg	    func_extract_an_archive "$my_xdir" "$my_xabs"
268039713583Smrg	  fi # $darwin_arches
268139713583Smrg	} # !$opt_dry_run
268239713583Smrg	;;
268339713583Smrg      *)
268439713583Smrg        func_extract_an_archive "$my_xdir" "$my_xabs"
268539713583Smrg	;;
268639713583Smrg      esac
268739713583Smrg      my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP`
268839713583Smrg    done
268995b296d0Smrg
269039713583Smrg    func_extract_archives_result="$my_oldobjs"
269139713583Smrg}
269295b296d0Smrg
269395b296d0Smrg
269495b296d0Smrg
269539713583Smrg# func_emit_wrapper_part1 [arg=no]
269639713583Smrg#
269739713583Smrg# Emit the first part of a libtool wrapper script on stdout.
269839713583Smrg# For more information, see the description associated with
269939713583Smrg# func_emit_wrapper(), below.
270039713583Smrgfunc_emit_wrapper_part1 ()
270139713583Smrg{
270239713583Smrg	func_emit_wrapper_part1_arg1=no
270339713583Smrg	if test -n "$1" ; then
270439713583Smrg	  func_emit_wrapper_part1_arg1=$1
270595b296d0Smrg	fi
270695b296d0Smrg
270739713583Smrg	$ECHO "\
270839713583Smrg#! $SHELL
270995b296d0Smrg
271039713583Smrg# $output - temporary wrapper script for $objdir/$outputname
271139713583Smrg# Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
271239713583Smrg#
271339713583Smrg# The $output program cannot be directly executed until all the libtool
271439713583Smrg# libraries that it depends on are installed.
271539713583Smrg#
271639713583Smrg# This wrapper script should never be moved out of the build directory.
271739713583Smrg# If it is, it will not operate correctly.
271895b296d0Smrg
271939713583Smrg# Sed substitution that helps us do robust quoting.  It backslashifies
272039713583Smrg# metacharacters that are still active within double-quoted strings.
272139713583SmrgXsed='${SED} -e 1s/^X//'
272239713583Smrgsed_quote_subst='$sed_quote_subst'
272395b296d0Smrg
272439713583Smrg# Be Bourne compatible
272539713583Smrgif test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then
272639713583Smrg  emulate sh
272739713583Smrg  NULLCMD=:
272839713583Smrg  # Zsh 3.x and 4.x performs word splitting on \${1+\"\$@\"}, which
272939713583Smrg  # is contrary to our usage.  Disable this feature.
273039713583Smrg  alias -g '\${1+\"\$@\"}'='\"\$@\"'
273139713583Smrg  setopt NO_GLOB_SUBST
273239713583Smrgelse
273339713583Smrg  case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac
273439713583Smrgfi
273539713583SmrgBIN_SH=xpg4; export BIN_SH # for Tru64
273639713583SmrgDUALCASE=1; export DUALCASE # for MKS sh
273795b296d0Smrg
273839713583Smrg# The HP-UX ksh and POSIX shell print the target directory to stdout
273939713583Smrg# if CDPATH is set.
274039713583Smrg(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
274195b296d0Smrg
274239713583Smrgrelink_command=\"$relink_command\"
274395b296d0Smrg
274439713583Smrg# This environment variable determines our operation mode.
274539713583Smrgif test \"\$libtool_install_magic\" = \"$magic\"; then
274639713583Smrg  # install mode needs the following variables:
274739713583Smrg  generated_by_libtool_version='$macro_version'
274839713583Smrg  notinst_deplibs='$notinst_deplibs'
274939713583Smrgelse
275039713583Smrg  # When we are sourced in execute mode, \$file and \$ECHO are already set.
275139713583Smrg  if test \"\$libtool_execute_magic\" != \"$magic\"; then
275239713583Smrg    ECHO=\"$qecho\"
275339713583Smrg    file=\"\$0\"
275439713583Smrg    # Make sure echo works.
275539713583Smrg    if test \"X\$1\" = X--no-reexec; then
275639713583Smrg      # Discard the --no-reexec flag, and continue.
275739713583Smrg      shift
275839713583Smrg    elif test \"X\`{ \$ECHO '\t'; } 2>/dev/null\`\" = 'X\t'; then
275939713583Smrg      # Yippee, \$ECHO works!
276039713583Smrg      :
276139713583Smrg    else
276239713583Smrg      # Restart under the correct shell, and then maybe \$ECHO will work.
276339713583Smrg      exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"}
276439713583Smrg    fi
276539713583Smrg  fi\
276639713583Smrg"
276739713583Smrg	$ECHO "\
276895b296d0Smrg
276939713583Smrg  # Find the directory that this script lives in.
277039713583Smrg  thisdir=\`\$ECHO \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\`
277139713583Smrg  test \"x\$thisdir\" = \"x\$file\" && thisdir=.
277295b296d0Smrg
277339713583Smrg  # Follow symbolic links until we get to the real thisdir.
277439713583Smrg  file=\`ls -ld \"\$file\" | ${SED} -n 's/.*-> //p'\`
277539713583Smrg  while test -n \"\$file\"; do
277639713583Smrg    destdir=\`\$ECHO \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\`
277795b296d0Smrg
277839713583Smrg    # If there was a directory component, then change thisdir.
277939713583Smrg    if test \"x\$destdir\" != \"x\$file\"; then
278039713583Smrg      case \"\$destdir\" in
278139713583Smrg      [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;;
278239713583Smrg      *) thisdir=\"\$thisdir/\$destdir\" ;;
278395b296d0Smrg      esac
278439713583Smrg    fi
278595b296d0Smrg
278639713583Smrg    file=\`\$ECHO \"X\$file\" | \$Xsed -e 's%^.*/%%'\`
278739713583Smrg    file=\`ls -ld \"\$thisdir/\$file\" | ${SED} -n 's/.*-> //p'\`
278839713583Smrg  done
278939713583Smrg"
279039713583Smrg}
279139713583Smrg# end: func_emit_wrapper_part1
279239713583Smrg
279339713583Smrg# func_emit_wrapper_part2 [arg=no]
279439713583Smrg#
279539713583Smrg# Emit the second part of a libtool wrapper script on stdout.
279639713583Smrg# For more information, see the description associated with
279739713583Smrg# func_emit_wrapper(), below.
279839713583Smrgfunc_emit_wrapper_part2 ()
279939713583Smrg{
280039713583Smrg	func_emit_wrapper_part2_arg1=no
280139713583Smrg	if test -n "$1" ; then
280239713583Smrg	  func_emit_wrapper_part2_arg1=$1
280395b296d0Smrg	fi
280495b296d0Smrg
280539713583Smrg	$ECHO "\
280695b296d0Smrg
280739713583Smrg  # Usually 'no', except on cygwin/mingw when embedded into
280839713583Smrg  # the cwrapper.
280939713583Smrg  WRAPPER_SCRIPT_BELONGS_IN_OBJDIR=$func_emit_wrapper_part2_arg1
281039713583Smrg  if test \"\$WRAPPER_SCRIPT_BELONGS_IN_OBJDIR\" = \"yes\"; then
281139713583Smrg    # special case for '.'
281239713583Smrg    if test \"\$thisdir\" = \".\"; then
281339713583Smrg      thisdir=\`pwd\`
281439713583Smrg    fi
281539713583Smrg    # remove .libs from thisdir
281639713583Smrg    case \"\$thisdir\" in
281739713583Smrg    *[\\\\/]$objdir ) thisdir=\`\$ECHO \"X\$thisdir\" | \$Xsed -e 's%[\\\\/][^\\\\/]*$%%'\` ;;
281839713583Smrg    $objdir )   thisdir=. ;;
281939713583Smrg    esac
282039713583Smrg  fi
282139713583Smrg
282239713583Smrg  # Try to get the absolute directory name.
282339713583Smrg  absdir=\`cd \"\$thisdir\" && pwd\`
282439713583Smrg  test -n \"\$absdir\" && thisdir=\"\$absdir\"
282539713583Smrg"
282639713583Smrg
282739713583Smrg	if test "$fast_install" = yes; then
282839713583Smrg	  $ECHO "\
282939713583Smrg  program=lt-'$outputname'$exeext
283039713583Smrg  progdir=\"\$thisdir/$objdir\"
283139713583Smrg
283239713583Smrg  if test ! -f \"\$progdir/\$program\" ||
283339713583Smrg     { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\
283439713583Smrg       test \"X\$file\" != \"X\$progdir/\$program\"; }; then
283539713583Smrg
283639713583Smrg    file=\"\$\$-\$program\"
283739713583Smrg
283839713583Smrg    if test ! -d \"\$progdir\"; then
283939713583Smrg      $MKDIR \"\$progdir\"
284039713583Smrg    else
284139713583Smrg      $RM \"\$progdir/\$file\"
284239713583Smrg    fi"
284339713583Smrg
284439713583Smrg	  $ECHO "\
284539713583Smrg
284639713583Smrg    # relink executable if necessary
284739713583Smrg    if test -n \"\$relink_command\"; then
284839713583Smrg      if relink_command_output=\`eval \$relink_command 2>&1\`; then :
284939713583Smrg      else
285039713583Smrg	$ECHO \"\$relink_command_output\" >&2
285139713583Smrg	$RM \"\$progdir/\$file\"
285239713583Smrg	exit 1
285395b296d0Smrg      fi
285439713583Smrg    fi
285595b296d0Smrg
285639713583Smrg    $MV \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null ||
285739713583Smrg    { $RM \"\$progdir/\$program\";
285839713583Smrg      $MV \"\$progdir/\$file\" \"\$progdir/\$program\"; }
285939713583Smrg    $RM \"\$progdir/\$file\"
286039713583Smrg  fi"
286139713583Smrg	else
286239713583Smrg	  $ECHO "\
286339713583Smrg  program='$outputname'
286439713583Smrg  progdir=\"\$thisdir/$objdir\"
286539713583Smrg"
286695b296d0Smrg	fi
286795b296d0Smrg
286839713583Smrg	$ECHO "\
286995b296d0Smrg
287039713583Smrg  if test -f \"\$progdir/\$program\"; then"
287195b296d0Smrg
287239713583Smrg	# Export our shlibpath_var if we have one.
287339713583Smrg	if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
287439713583Smrg	  $ECHO "\
287539713583Smrg    # Add our own library path to $shlibpath_var
287639713583Smrg    $shlibpath_var=\"$temp_rpath\$$shlibpath_var\"
287739713583Smrg
287839713583Smrg    # Some systems cannot cope with colon-terminated $shlibpath_var
287939713583Smrg    # The second colon is a workaround for a bug in BeOS R4 sed
288039713583Smrg    $shlibpath_var=\`\$ECHO \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\`
288195b296d0Smrg
288239713583Smrg    export $shlibpath_var
288339713583Smrg"
288495b296d0Smrg	fi
288595b296d0Smrg
288639713583Smrg	# fixup the dll searchpath if we need to.
288739713583Smrg	if test -n "$dllsearchpath"; then
288839713583Smrg	  $ECHO "\
288939713583Smrg    # Add the dll search path components to the executable PATH
289039713583Smrg    PATH=$dllsearchpath:\$PATH
289139713583Smrg"
289239713583Smrg	fi
289395b296d0Smrg
289439713583Smrg	$ECHO "\
289539713583Smrg    if test \"\$libtool_execute_magic\" != \"$magic\"; then
289639713583Smrg      # Run the actual program with our arguments.
289739713583Smrg"
289839713583Smrg	case $host in
289939713583Smrg	# Backslashes separate directories on plain windows
290039713583Smrg	*-*-mingw | *-*-os2* | *-cegcc*)
290139713583Smrg	  $ECHO "\
290239713583Smrg      exec \"\$progdir\\\\\$program\" \${1+\"\$@\"}
290339713583Smrg"
290495b296d0Smrg	  ;;
290595b296d0Smrg
290695b296d0Smrg	*)
290739713583Smrg	  $ECHO "\
290839713583Smrg      exec \"\$progdir/\$program\" \${1+\"\$@\"}
290939713583Smrg"
291095b296d0Smrg	  ;;
291195b296d0Smrg	esac
291239713583Smrg	$ECHO "\
291339713583Smrg      \$ECHO \"\$0: cannot exec \$program \$*\" 1>&2
291439713583Smrg      exit 1
291539713583Smrg    fi
291639713583Smrg  else
291739713583Smrg    # The program doesn't exist.
291839713583Smrg    \$ECHO \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2
291939713583Smrg    \$ECHO \"This script is just a wrapper for \$program.\" 1>&2
292039713583Smrg    $ECHO \"See the $PACKAGE documentation for more information.\" 1>&2
292139713583Smrg    exit 1
292239713583Smrg  fi
292339713583Smrgfi\
292439713583Smrg"
292539713583Smrg}
292639713583Smrg# end: func_emit_wrapper_part2
292795b296d0Smrg
292895b296d0Smrg
292939713583Smrg# func_emit_wrapper [arg=no]
293039713583Smrg#
293139713583Smrg# Emit a libtool wrapper script on stdout.
293239713583Smrg# Don't directly open a file because we may want to
293339713583Smrg# incorporate the script contents within a cygwin/mingw
293439713583Smrg# wrapper executable.  Must ONLY be called from within
293539713583Smrg# func_mode_link because it depends on a number of variables
293639713583Smrg# set therein.
293739713583Smrg#
293839713583Smrg# ARG is the value that the WRAPPER_SCRIPT_BELONGS_IN_OBJDIR
293939713583Smrg# variable will take.  If 'yes', then the emitted script
294039713583Smrg# will assume that the directory in which it is stored is
294139713583Smrg# the $objdir directory.  This is a cygwin/mingw-specific
294239713583Smrg# behavior.
294339713583Smrgfunc_emit_wrapper ()
294439713583Smrg{
294539713583Smrg	func_emit_wrapper_arg1=no
294639713583Smrg	if test -n "$1" ; then
294739713583Smrg	  func_emit_wrapper_arg1=$1
294895b296d0Smrg	fi
294995b296d0Smrg
295039713583Smrg	# split this up so that func_emit_cwrapperexe_src
295139713583Smrg	# can call each part independently.
295239713583Smrg	func_emit_wrapper_part1 "${func_emit_wrapper_arg1}"
295339713583Smrg	func_emit_wrapper_part2 "${func_emit_wrapper_arg1}"
295439713583Smrg}
295595b296d0Smrg
295695b296d0Smrg
295739713583Smrg# func_to_host_path arg
295839713583Smrg#
295939713583Smrg# Convert paths to host format when used with build tools.
296039713583Smrg# Intended for use with "native" mingw (where libtool itself
296139713583Smrg# is running under the msys shell), or in the following cross-
296239713583Smrg# build environments:
296339713583Smrg#    $build          $host
296439713583Smrg#    mingw (msys)    mingw  [e.g. native]
296539713583Smrg#    cygwin          mingw
296639713583Smrg#    *nix + wine     mingw
296739713583Smrg# where wine is equipped with the `winepath' executable.
296839713583Smrg# In the native mingw case, the (msys) shell automatically
296939713583Smrg# converts paths for any non-msys applications it launches,
297039713583Smrg# but that facility isn't available from inside the cwrapper.
297139713583Smrg# Similar accommodations are necessary for $host mingw and
297239713583Smrg# $build cygwin.  Calling this function does no harm for other
297339713583Smrg# $host/$build combinations not listed above.
297439713583Smrg#
297539713583Smrg# ARG is the path (on $build) that should be converted to
297639713583Smrg# the proper representation for $host. The result is stored
297739713583Smrg# in $func_to_host_path_result.
297839713583Smrgfunc_to_host_path ()
297939713583Smrg{
298039713583Smrg  func_to_host_path_result="$1"
298139713583Smrg  if test -n "$1" ; then
298239713583Smrg    case $host in
298339713583Smrg      *mingw* )
298439713583Smrg        lt_sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g'
298539713583Smrg        case $build in
298639713583Smrg          *mingw* ) # actually, msys
298739713583Smrg            # awkward: cmd appends spaces to result
298839713583Smrg            lt_sed_strip_trailing_spaces="s/[ ]*\$//"
298939713583Smrg            func_to_host_path_tmp1=`( cmd //c echo "$1" |\
299039713583Smrg              $SED -e "$lt_sed_strip_trailing_spaces" ) 2>/dev/null || echo ""`
299139713583Smrg            func_to_host_path_result=`echo "$func_to_host_path_tmp1" |\
299239713583Smrg              $SED -e "$lt_sed_naive_backslashify"`
299339713583Smrg            ;;
299439713583Smrg          *cygwin* )
299539713583Smrg            func_to_host_path_tmp1=`cygpath -w "$1"`
299639713583Smrg            func_to_host_path_result=`echo "$func_to_host_path_tmp1" |\
299739713583Smrg              $SED -e "$lt_sed_naive_backslashify"`
299839713583Smrg            ;;
299939713583Smrg          * )
300039713583Smrg            # Unfortunately, winepath does not exit with a non-zero
300139713583Smrg            # error code, so we are forced to check the contents of
300239713583Smrg            # stdout. On the other hand, if the command is not
300339713583Smrg            # found, the shell will set an exit code of 127 and print
300439713583Smrg            # *an error message* to stdout. So we must check for both
300539713583Smrg            # error code of zero AND non-empty stdout, which explains
300639713583Smrg            # the odd construction:
300739713583Smrg            func_to_host_path_tmp1=`winepath -w "$1" 2>/dev/null`
300839713583Smrg            if test "$?" -eq 0 && test -n "${func_to_host_path_tmp1}"; then
300939713583Smrg              func_to_host_path_result=`echo "$func_to_host_path_tmp1" |\
301039713583Smrg                $SED -e "$lt_sed_naive_backslashify"`
301139713583Smrg            else
301239713583Smrg              # Allow warning below.
301339713583Smrg              func_to_host_path_result=""
301439713583Smrg            fi
301539713583Smrg            ;;
301639713583Smrg        esac
301739713583Smrg        if test -z "$func_to_host_path_result" ; then
301839713583Smrg          func_error "Could not determine host path corresponding to"
301939713583Smrg          func_error "  '$1'"
302039713583Smrg          func_error "Continuing, but uninstalled executables may not work."
302139713583Smrg          # Fallback:
302239713583Smrg          func_to_host_path_result="$1"
302339713583Smrg        fi
302439713583Smrg        ;;
302539713583Smrg    esac
302639713583Smrg  fi
302739713583Smrg}
302839713583Smrg# end: func_to_host_path
302995b296d0Smrg
303039713583Smrg# func_to_host_pathlist arg
303139713583Smrg#
303239713583Smrg# Convert pathlists to host format when used with build tools.
303339713583Smrg# See func_to_host_path(), above. This function supports the
303439713583Smrg# following $build/$host combinations (but does no harm for
303539713583Smrg# combinations not listed here):
303639713583Smrg#    $build          $host
303739713583Smrg#    mingw (msys)    mingw  [e.g. native]
303839713583Smrg#    cygwin          mingw
303939713583Smrg#    *nix + wine     mingw
304039713583Smrg#
304139713583Smrg# Path separators are also converted from $build format to
304239713583Smrg# $host format. If ARG begins or ends with a path separator
304339713583Smrg# character, it is preserved (but converted to $host format)
304439713583Smrg# on output.
304539713583Smrg#
304639713583Smrg# ARG is a pathlist (on $build) that should be converted to
304739713583Smrg# the proper representation on $host. The result is stored
304839713583Smrg# in $func_to_host_pathlist_result.
304939713583Smrgfunc_to_host_pathlist ()
305039713583Smrg{
305139713583Smrg  func_to_host_pathlist_result="$1"
305239713583Smrg  if test -n "$1" ; then
305339713583Smrg    case $host in
305439713583Smrg      *mingw* )
305539713583Smrg        lt_sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g'
305639713583Smrg        # Remove leading and trailing path separator characters from
305739713583Smrg        # ARG. msys behavior is inconsistent here, cygpath turns them
305839713583Smrg        # into '.;' and ';.', and winepath ignores them completely.
305939713583Smrg        func_to_host_pathlist_tmp2="$1"
306039713583Smrg        # Once set for this call, this variable should not be
306139713583Smrg        # reassigned. It is used in tha fallback case.
306239713583Smrg        func_to_host_pathlist_tmp1=`echo "$func_to_host_pathlist_tmp2" |\
306339713583Smrg          $SED -e 's|^:*||' -e 's|:*$||'`
306439713583Smrg        case $build in
306539713583Smrg          *mingw* ) # Actually, msys.
306639713583Smrg            # Awkward: cmd appends spaces to result.
306739713583Smrg            lt_sed_strip_trailing_spaces="s/[ ]*\$//"
306839713583Smrg            func_to_host_pathlist_tmp2=`( cmd //c echo "$func_to_host_pathlist_tmp1" |\
306939713583Smrg              $SED -e "$lt_sed_strip_trailing_spaces" ) 2>/dev/null || echo ""`
307039713583Smrg            func_to_host_pathlist_result=`echo "$func_to_host_pathlist_tmp2" |\
307139713583Smrg              $SED -e "$lt_sed_naive_backslashify"`
307239713583Smrg            ;;
307339713583Smrg          *cygwin* )
307439713583Smrg            func_to_host_pathlist_tmp2=`cygpath -w -p "$func_to_host_pathlist_tmp1"`
307539713583Smrg            func_to_host_pathlist_result=`echo "$func_to_host_pathlist_tmp2" |\
307639713583Smrg              $SED -e "$lt_sed_naive_backslashify"`
307739713583Smrg            ;;
307839713583Smrg          * )
307939713583Smrg            # unfortunately, winepath doesn't convert pathlists
308039713583Smrg            func_to_host_pathlist_result=""
308139713583Smrg            func_to_host_pathlist_oldIFS=$IFS
308239713583Smrg            IFS=:
308339713583Smrg            for func_to_host_pathlist_f in $func_to_host_pathlist_tmp1 ; do
308439713583Smrg              IFS=$func_to_host_pathlist_oldIFS
308539713583Smrg              if test -n "$func_to_host_pathlist_f" ; then
308639713583Smrg                func_to_host_path "$func_to_host_pathlist_f"
308739713583Smrg                if test -n "$func_to_host_path_result" ; then
308839713583Smrg                  if test -z "$func_to_host_pathlist_result" ; then
308939713583Smrg                    func_to_host_pathlist_result="$func_to_host_path_result"
309039713583Smrg                  else
309139713583Smrg                    func_to_host_pathlist_result="$func_to_host_pathlist_result;$func_to_host_path_result"
309239713583Smrg                  fi
309339713583Smrg                fi
309439713583Smrg              fi
309539713583Smrg              IFS=:
309639713583Smrg            done
309739713583Smrg            IFS=$func_to_host_pathlist_oldIFS
309839713583Smrg            ;;
309939713583Smrg        esac
310039713583Smrg        if test -z "$func_to_host_pathlist_result" ; then
310139713583Smrg          func_error "Could not determine the host path(s) corresponding to"
310239713583Smrg          func_error "  '$1'"
310339713583Smrg          func_error "Continuing, but uninstalled executables may not work."
310439713583Smrg          # Fallback. This may break if $1 contains DOS-style drive
310539713583Smrg          # specifications. The fix is not to complicate the expression
310639713583Smrg          # below, but for the user to provide a working wine installation
310739713583Smrg          # with winepath so that path translation in the cross-to-mingw
310839713583Smrg          # case works properly.
310939713583Smrg          lt_replace_pathsep_nix_to_dos="s|:|;|g"
311039713583Smrg          func_to_host_pathlist_result=`echo "$func_to_host_pathlist_tmp1" |\
311139713583Smrg            $SED -e "$lt_replace_pathsep_nix_to_dos"`
311239713583Smrg        fi
311339713583Smrg        # Now, add the leading and trailing path separators back
311439713583Smrg        case "$1" in
311539713583Smrg          :* ) func_to_host_pathlist_result=";$func_to_host_pathlist_result"
311639713583Smrg            ;;
311739713583Smrg        esac
311839713583Smrg        case "$1" in
311939713583Smrg          *: ) func_to_host_pathlist_result="$func_to_host_pathlist_result;"
312039713583Smrg            ;;
312139713583Smrg        esac
312239713583Smrg        ;;
312339713583Smrg    esac
312439713583Smrg  fi
312539713583Smrg}
312639713583Smrg# end: func_to_host_pathlist
312795b296d0Smrg
312839713583Smrg# func_emit_cwrapperexe_src
312939713583Smrg# emit the source code for a wrapper executable on stdout
313039713583Smrg# Must ONLY be called from within func_mode_link because
313139713583Smrg# it depends on a number of variable set therein.
313239713583Smrgfunc_emit_cwrapperexe_src ()
313339713583Smrg{
313439713583Smrg	cat <<EOF
313595b296d0Smrg
313639713583Smrg/* $cwrappersource - temporary wrapper executable for $objdir/$outputname
313739713583Smrg   Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
313895b296d0Smrg
313939713583Smrg   The $output program cannot be directly executed until all the libtool
314039713583Smrg   libraries that it depends on are installed.
314195b296d0Smrg
314239713583Smrg   This wrapper executable should never be moved out of the build directory.
314339713583Smrg   If it is, it will not operate correctly.
314495b296d0Smrg
314539713583Smrg   Currently, it simply execs the wrapper *script* "$SHELL $output",
314639713583Smrg   but could eventually absorb all of the scripts functionality and
314739713583Smrg   exec $objdir/$outputname directly.
314839713583Smrg*/
314939713583SmrgEOF
315039713583Smrg	    cat <<"EOF"
315139713583Smrg#include <stdio.h>
315239713583Smrg#include <stdlib.h>
315339713583Smrg#ifdef _MSC_VER
315439713583Smrg# include <direct.h>
315539713583Smrg# include <process.h>
315639713583Smrg# include <io.h>
315739713583Smrg# define setmode _setmode
315839713583Smrg#else
315939713583Smrg# include <unistd.h>
316039713583Smrg# include <stdint.h>
316139713583Smrg# ifdef __CYGWIN__
316239713583Smrg#  include <io.h>
316339713583Smrg#  define HAVE_SETENV
316439713583Smrg#  ifdef __STRICT_ANSI__
316539713583Smrgchar *realpath (const char *, char *);
316639713583Smrgint putenv (char *);
316739713583Smrgint setenv (const char *, const char *, int);
316839713583Smrg#  endif
316939713583Smrg# endif
317039713583Smrg#endif
317139713583Smrg#include <malloc.h>
317239713583Smrg#include <stdarg.h>
317339713583Smrg#include <assert.h>
317439713583Smrg#include <string.h>
317539713583Smrg#include <ctype.h>
317639713583Smrg#include <errno.h>
317739713583Smrg#include <fcntl.h>
317839713583Smrg#include <sys/stat.h>
317995b296d0Smrg
318039713583Smrg#if defined(PATH_MAX)
318139713583Smrg# define LT_PATHMAX PATH_MAX
318239713583Smrg#elif defined(MAXPATHLEN)
318339713583Smrg# define LT_PATHMAX MAXPATHLEN
318439713583Smrg#else
318539713583Smrg# define LT_PATHMAX 1024
318639713583Smrg#endif
318795b296d0Smrg
318839713583Smrg#ifndef S_IXOTH
318939713583Smrg# define S_IXOTH 0
319039713583Smrg#endif
319139713583Smrg#ifndef S_IXGRP
319239713583Smrg# define S_IXGRP 0
319339713583Smrg#endif
319495b296d0Smrg
319539713583Smrg#ifdef _MSC_VER
319639713583Smrg# define S_IXUSR _S_IEXEC
319739713583Smrg# define stat _stat
319839713583Smrg# ifndef _INTPTR_T_DEFINED
319939713583Smrg#  define intptr_t int
320039713583Smrg# endif
320139713583Smrg#endif
320295b296d0Smrg
320339713583Smrg#ifndef DIR_SEPARATOR
320439713583Smrg# define DIR_SEPARATOR '/'
320539713583Smrg# define PATH_SEPARATOR ':'
320639713583Smrg#endif
320795b296d0Smrg
320839713583Smrg#if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \
320939713583Smrg  defined (__OS2__)
321039713583Smrg# define HAVE_DOS_BASED_FILE_SYSTEM
321139713583Smrg# define FOPEN_WB "wb"
321239713583Smrg# ifndef DIR_SEPARATOR_2
321339713583Smrg#  define DIR_SEPARATOR_2 '\\'
321439713583Smrg# endif
321539713583Smrg# ifndef PATH_SEPARATOR_2
321639713583Smrg#  define PATH_SEPARATOR_2 ';'
321739713583Smrg# endif
321839713583Smrg#endif
321995b296d0Smrg
322039713583Smrg#ifndef DIR_SEPARATOR_2
322139713583Smrg# define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR)
322239713583Smrg#else /* DIR_SEPARATOR_2 */
322339713583Smrg# define IS_DIR_SEPARATOR(ch) \
322439713583Smrg	(((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2))
322539713583Smrg#endif /* DIR_SEPARATOR_2 */
322695b296d0Smrg
322739713583Smrg#ifndef PATH_SEPARATOR_2
322839713583Smrg# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR)
322939713583Smrg#else /* PATH_SEPARATOR_2 */
323039713583Smrg# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2)
323139713583Smrg#endif /* PATH_SEPARATOR_2 */
323295b296d0Smrg
323339713583Smrg#ifdef __CYGWIN__
323439713583Smrg# define FOPEN_WB "wb"
323539713583Smrg#endif
323695b296d0Smrg
323739713583Smrg#ifndef FOPEN_WB
323839713583Smrg# define FOPEN_WB "w"
323939713583Smrg#endif
324039713583Smrg#ifndef _O_BINARY
324139713583Smrg# define _O_BINARY 0
324239713583Smrg#endif
324395b296d0Smrg
324439713583Smrg#define XMALLOC(type, num)      ((type *) xmalloc ((num) * sizeof(type)))
324539713583Smrg#define XFREE(stale) do { \
324639713583Smrg  if (stale) { free ((void *) stale); stale = 0; } \
324739713583Smrg} while (0)
324895b296d0Smrg
324939713583Smrg#undef LTWRAPPER_DEBUGPRINTF
325039713583Smrg#if defined DEBUGWRAPPER
325139713583Smrg# define LTWRAPPER_DEBUGPRINTF(args) ltwrapper_debugprintf args
325239713583Smrgstatic void
325339713583Smrgltwrapper_debugprintf (const char *fmt, ...)
325439713583Smrg{
325539713583Smrg    va_list args;
325639713583Smrg    va_start (args, fmt);
325739713583Smrg    (void) vfprintf (stderr, fmt, args);
325839713583Smrg    va_end (args);
325939713583Smrg}
326039713583Smrg#else
326139713583Smrg# define LTWRAPPER_DEBUGPRINTF(args)
326239713583Smrg#endif
326395b296d0Smrg
326439713583Smrgconst char *program_name = NULL;
326595b296d0Smrg
326639713583Smrgvoid *xmalloc (size_t num);
326739713583Smrgchar *xstrdup (const char *string);
326839713583Smrgconst char *base_name (const char *name);
326939713583Smrgchar *find_executable (const char *wrapper);
327039713583Smrgchar *chase_symlinks (const char *pathspec);
327139713583Smrgint make_executable (const char *path);
327239713583Smrgint check_executable (const char *path);
327339713583Smrgchar *strendzap (char *str, const char *pat);
327439713583Smrgvoid lt_fatal (const char *message, ...);
327539713583Smrgvoid lt_setenv (const char *name, const char *value);
327639713583Smrgchar *lt_extend_str (const char *orig_value, const char *add, int to_end);
327739713583Smrgvoid lt_opt_process_env_set (const char *arg);
327839713583Smrgvoid lt_opt_process_env_prepend (const char *arg);
327939713583Smrgvoid lt_opt_process_env_append (const char *arg);
328039713583Smrgint lt_split_name_value (const char *arg, char** name, char** value);
328139713583Smrgvoid lt_update_exe_path (const char *name, const char *value);
328239713583Smrgvoid lt_update_lib_path (const char *name, const char *value);
328339713583Smrg
328439713583Smrgstatic const char *script_text_part1 =
328539713583SmrgEOF
328695b296d0Smrg
328739713583Smrg	    func_emit_wrapper_part1 yes |
328839713583Smrg	        $SED -e 's/\([\\"]\)/\\\1/g' \
328939713583Smrg	             -e 's/^/  "/' -e 's/$/\\n"/'
329039713583Smrg	    echo ";"
329139713583Smrg	    cat <<EOF
329295b296d0Smrg
329339713583Smrgstatic const char *script_text_part2 =
329439713583SmrgEOF
329539713583Smrg	    func_emit_wrapper_part2 yes |
329639713583Smrg	        $SED -e 's/\([\\"]\)/\\\1/g' \
329739713583Smrg	             -e 's/^/  "/' -e 's/$/\\n"/'
329839713583Smrg	    echo ";"
329939713583Smrg
330039713583Smrg	    cat <<EOF
330139713583Smrgconst char * MAGIC_EXE = "$magic_exe";
330239713583Smrgconst char * LIB_PATH_VARNAME = "$shlibpath_var";
330339713583SmrgEOF
330495b296d0Smrg
330539713583Smrg	    if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
330639713583Smrg              func_to_host_pathlist "$temp_rpath"
330739713583Smrg	      cat <<EOF
330839713583Smrgconst char * LIB_PATH_VALUE   = "$func_to_host_pathlist_result";
330939713583SmrgEOF
331039713583Smrg	    else
331139713583Smrg	      cat <<"EOF"
331239713583Smrgconst char * LIB_PATH_VALUE   = "";
331339713583SmrgEOF
331495b296d0Smrg	    fi
331595b296d0Smrg
331639713583Smrg	    if test -n "$dllsearchpath"; then
331739713583Smrg              func_to_host_pathlist "$dllsearchpath:"
331839713583Smrg	      cat <<EOF
331939713583Smrgconst char * EXE_PATH_VARNAME = "PATH";
332039713583Smrgconst char * EXE_PATH_VALUE   = "$func_to_host_pathlist_result";
332195b296d0SmrgEOF
332295b296d0Smrg	    else
332339713583Smrg	      cat <<"EOF"
332439713583Smrgconst char * EXE_PATH_VARNAME = "";
332539713583Smrgconst char * EXE_PATH_VALUE   = "";
332639713583SmrgEOF
332795b296d0Smrg	    fi
332839713583Smrg
332939713583Smrg	    if test "$fast_install" = yes; then
333039713583Smrg	      cat <<EOF
333139713583Smrgconst char * TARGET_PROGRAM_NAME = "lt-$outputname"; /* hopefully, no .exe */
333239713583SmrgEOF
333395b296d0Smrg	    else
333439713583Smrg	      cat <<EOF
333539713583Smrgconst char * TARGET_PROGRAM_NAME = "$outputname"; /* hopefully, no .exe */
333639713583SmrgEOF
333795b296d0Smrg	    fi
333895b296d0Smrg
333995b296d0Smrg
334039713583Smrg	    cat <<"EOF"
334195b296d0Smrg
334239713583Smrg#define LTWRAPPER_OPTION_PREFIX         "--lt-"
334339713583Smrg#define LTWRAPPER_OPTION_PREFIX_LENGTH  5
334495b296d0Smrg
334539713583Smrgstatic const size_t opt_prefix_len         = LTWRAPPER_OPTION_PREFIX_LENGTH;
334639713583Smrgstatic const char *ltwrapper_option_prefix = LTWRAPPER_OPTION_PREFIX;
334795b296d0Smrg
334839713583Smrgstatic const char *dumpscript_opt       = LTWRAPPER_OPTION_PREFIX "dump-script";
334995b296d0Smrg
335039713583Smrgstatic const size_t env_set_opt_len     = LTWRAPPER_OPTION_PREFIX_LENGTH + 7;
335139713583Smrgstatic const char *env_set_opt          = LTWRAPPER_OPTION_PREFIX "env-set";
335239713583Smrg  /* argument is putenv-style "foo=bar", value of foo is set to bar */
335395b296d0Smrg
335439713583Smrgstatic const size_t env_prepend_opt_len = LTWRAPPER_OPTION_PREFIX_LENGTH + 11;
335539713583Smrgstatic const char *env_prepend_opt      = LTWRAPPER_OPTION_PREFIX "env-prepend";
335639713583Smrg  /* argument is putenv-style "foo=bar", new value of foo is bar${foo} */
335795b296d0Smrg
335839713583Smrgstatic const size_t env_append_opt_len  = LTWRAPPER_OPTION_PREFIX_LENGTH + 10;
335939713583Smrgstatic const char *env_append_opt       = LTWRAPPER_OPTION_PREFIX "env-append";
336039713583Smrg  /* argument is putenv-style "foo=bar", new value of foo is ${foo}bar */
336195b296d0Smrg
336239713583Smrgint
336339713583Smrgmain (int argc, char *argv[])
336439713583Smrg{
336539713583Smrg  char **newargz;
336639713583Smrg  int  newargc;
336739713583Smrg  char *tmp_pathspec;
336839713583Smrg  char *actual_cwrapper_path;
336939713583Smrg  char *actual_cwrapper_name;
337039713583Smrg  char *target_name;
337139713583Smrg  char *lt_argv_zero;
337239713583Smrg  intptr_t rval = 127;
337395b296d0Smrg
337439713583Smrg  int i;
337595b296d0Smrg
337639713583Smrg  program_name = (char *) xstrdup (base_name (argv[0]));
337739713583Smrg  LTWRAPPER_DEBUGPRINTF (("(main) argv[0]      : %s\n", argv[0]));
337839713583Smrg  LTWRAPPER_DEBUGPRINTF (("(main) program_name : %s\n", program_name));
337995b296d0Smrg
338039713583Smrg  /* very simple arg parsing; don't want to rely on getopt */
338139713583Smrg  for (i = 1; i < argc; i++)
338239713583Smrg    {
338339713583Smrg      if (strcmp (argv[i], dumpscript_opt) == 0)
338439713583Smrg	{
338539713583SmrgEOF
338639713583Smrg	    case "$host" in
338739713583Smrg	      *mingw* | *cygwin* )
338839713583Smrg		# make stdout use "unix" line endings
338939713583Smrg		echo "          setmode(1,_O_BINARY);"
339039713583Smrg		;;
339139713583Smrg	      esac
339295b296d0Smrg
339339713583Smrg	    cat <<"EOF"
339439713583Smrg	  printf ("%s", script_text_part1);
339539713583Smrg	  printf ("%s", script_text_part2);
339639713583Smrg	  return 0;
339739713583Smrg	}
339839713583Smrg    }
339995b296d0Smrg
340039713583Smrg  newargz = XMALLOC (char *, argc + 1);
340139713583Smrg  tmp_pathspec = find_executable (argv[0]);
340239713583Smrg  if (tmp_pathspec == NULL)
340339713583Smrg    lt_fatal ("Couldn't find %s", argv[0]);
340439713583Smrg  LTWRAPPER_DEBUGPRINTF (("(main) found exe (before symlink chase) at : %s\n",
340539713583Smrg			  tmp_pathspec));
340639713583Smrg
340739713583Smrg  actual_cwrapper_path = chase_symlinks (tmp_pathspec);
340839713583Smrg  LTWRAPPER_DEBUGPRINTF (("(main) found exe (after symlink chase) at : %s\n",
340939713583Smrg			  actual_cwrapper_path));
341039713583Smrg  XFREE (tmp_pathspec);
341139713583Smrg
341239713583Smrg  actual_cwrapper_name = xstrdup( base_name (actual_cwrapper_path));
341339713583Smrg  strendzap (actual_cwrapper_path, actual_cwrapper_name);
341439713583Smrg
341539713583Smrg  /* wrapper name transforms */
341639713583Smrg  strendzap (actual_cwrapper_name, ".exe");
341739713583Smrg  tmp_pathspec = lt_extend_str (actual_cwrapper_name, ".exe", 1);
341839713583Smrg  XFREE (actual_cwrapper_name);
341939713583Smrg  actual_cwrapper_name = tmp_pathspec;
342039713583Smrg  tmp_pathspec = 0;
342139713583Smrg
342239713583Smrg  /* target_name transforms -- use actual target program name; might have lt- prefix */
342339713583Smrg  target_name = xstrdup (base_name (TARGET_PROGRAM_NAME));
342439713583Smrg  strendzap (target_name, ".exe");
342539713583Smrg  tmp_pathspec = lt_extend_str (target_name, ".exe", 1);
342639713583Smrg  XFREE (target_name);
342739713583Smrg  target_name = tmp_pathspec;
342839713583Smrg  tmp_pathspec = 0;
342939713583Smrg
343039713583Smrg  LTWRAPPER_DEBUGPRINTF (("(main) libtool target name: %s\n",
343139713583Smrg			  target_name));
343239713583SmrgEOF
343395b296d0Smrg
343439713583Smrg	    cat <<EOF
343539713583Smrg  newargz[0] =
343639713583Smrg    XMALLOC (char, (strlen (actual_cwrapper_path) +
343739713583Smrg		    strlen ("$objdir") + 1 + strlen (actual_cwrapper_name) + 1));
343839713583Smrg  strcpy (newargz[0], actual_cwrapper_path);
343939713583Smrg  strcat (newargz[0], "$objdir");
344039713583Smrg  strcat (newargz[0], "/");
344139713583SmrgEOF
344295b296d0Smrg
344339713583Smrg	    cat <<"EOF"
344439713583Smrg  /* stop here, and copy so we don't have to do this twice */
344539713583Smrg  tmp_pathspec = xstrdup (newargz[0]);
344695b296d0Smrg
344739713583Smrg  /* do NOT want the lt- prefix here, so use actual_cwrapper_name */
344839713583Smrg  strcat (newargz[0], actual_cwrapper_name);
344995b296d0Smrg
345039713583Smrg  /* DO want the lt- prefix here if it exists, so use target_name */
345139713583Smrg  lt_argv_zero = lt_extend_str (tmp_pathspec, target_name, 1);
345239713583Smrg  XFREE (tmp_pathspec);
345339713583Smrg  tmp_pathspec = NULL;
345439713583SmrgEOF
345595b296d0Smrg
345639713583Smrg	    case $host_os in
345739713583Smrg	      mingw*)
345839713583Smrg	    cat <<"EOF"
345939713583Smrg  {
346039713583Smrg    char* p;
346139713583Smrg    while ((p = strchr (newargz[0], '\\')) != NULL)
346239713583Smrg      {
346339713583Smrg	*p = '/';
346439713583Smrg      }
346539713583Smrg    while ((p = strchr (lt_argv_zero, '\\')) != NULL)
346639713583Smrg      {
346739713583Smrg	*p = '/';
346839713583Smrg      }
346939713583Smrg  }
347039713583SmrgEOF
347139713583Smrg	    ;;
347239713583Smrg	    esac
347395b296d0Smrg
347439713583Smrg	    cat <<"EOF"
347539713583Smrg  XFREE (target_name);
347639713583Smrg  XFREE (actual_cwrapper_path);
347739713583Smrg  XFREE (actual_cwrapper_name);
347895b296d0Smrg
347939713583Smrg  lt_setenv ("BIN_SH", "xpg4"); /* for Tru64 */
348039713583Smrg  lt_setenv ("DUALCASE", "1");  /* for MSK sh */
348139713583Smrg  lt_update_lib_path (LIB_PATH_VARNAME, LIB_PATH_VALUE);
348239713583Smrg  lt_update_exe_path (EXE_PATH_VARNAME, EXE_PATH_VALUE);
348395b296d0Smrg
348439713583Smrg  newargc=0;
348539713583Smrg  for (i = 1; i < argc; i++)
348639713583Smrg    {
348739713583Smrg      if (strncmp (argv[i], env_set_opt, env_set_opt_len) == 0)
348839713583Smrg        {
348939713583Smrg          if (argv[i][env_set_opt_len] == '=')
349039713583Smrg            {
349139713583Smrg              const char *p = argv[i] + env_set_opt_len + 1;
349239713583Smrg              lt_opt_process_env_set (p);
349339713583Smrg            }
349439713583Smrg          else if (argv[i][env_set_opt_len] == '\0' && i + 1 < argc)
349539713583Smrg            {
349639713583Smrg              lt_opt_process_env_set (argv[++i]); /* don't copy */
349739713583Smrg            }
349839713583Smrg          else
349939713583Smrg            lt_fatal ("%s missing required argument", env_set_opt);
350039713583Smrg          continue;
350139713583Smrg        }
350239713583Smrg      if (strncmp (argv[i], env_prepend_opt, env_prepend_opt_len) == 0)
350339713583Smrg        {
350439713583Smrg          if (argv[i][env_prepend_opt_len] == '=')
350539713583Smrg            {
350639713583Smrg              const char *p = argv[i] + env_prepend_opt_len + 1;
350739713583Smrg              lt_opt_process_env_prepend (p);
350839713583Smrg            }
350939713583Smrg          else if (argv[i][env_prepend_opt_len] == '\0' && i + 1 < argc)
351039713583Smrg            {
351139713583Smrg              lt_opt_process_env_prepend (argv[++i]); /* don't copy */
351239713583Smrg            }
351339713583Smrg          else
351439713583Smrg            lt_fatal ("%s missing required argument", env_prepend_opt);
351539713583Smrg          continue;
351639713583Smrg        }
351739713583Smrg      if (strncmp (argv[i], env_append_opt, env_append_opt_len) == 0)
351839713583Smrg        {
351939713583Smrg          if (argv[i][env_append_opt_len] == '=')
352039713583Smrg            {
352139713583Smrg              const char *p = argv[i] + env_append_opt_len + 1;
352239713583Smrg              lt_opt_process_env_append (p);
352339713583Smrg            }
352439713583Smrg          else if (argv[i][env_append_opt_len] == '\0' && i + 1 < argc)
352539713583Smrg            {
352639713583Smrg              lt_opt_process_env_append (argv[++i]); /* don't copy */
352739713583Smrg            }
352839713583Smrg          else
352939713583Smrg            lt_fatal ("%s missing required argument", env_append_opt);
353039713583Smrg          continue;
353139713583Smrg        }
353239713583Smrg      if (strncmp (argv[i], ltwrapper_option_prefix, opt_prefix_len) == 0)
353339713583Smrg        {
353439713583Smrg          /* however, if there is an option in the LTWRAPPER_OPTION_PREFIX
353539713583Smrg             namespace, but it is not one of the ones we know about and
353639713583Smrg             have already dealt with, above (inluding dump-script), then
353739713583Smrg             report an error. Otherwise, targets might begin to believe
353839713583Smrg             they are allowed to use options in the LTWRAPPER_OPTION_PREFIX
353939713583Smrg             namespace. The first time any user complains about this, we'll
354039713583Smrg             need to make LTWRAPPER_OPTION_PREFIX a configure-time option
354139713583Smrg             or a configure.ac-settable value.
354239713583Smrg           */
354339713583Smrg          lt_fatal ("Unrecognized option in %s namespace: '%s'",
354439713583Smrg                    ltwrapper_option_prefix, argv[i]);
354539713583Smrg        }
354639713583Smrg      /* otherwise ... */
354739713583Smrg      newargz[++newargc] = xstrdup (argv[i]);
354839713583Smrg    }
354939713583Smrg  newargz[++newargc] = NULL;
355095b296d0Smrg
355139713583Smrg  LTWRAPPER_DEBUGPRINTF     (("(main) lt_argv_zero : %s\n", (lt_argv_zero ? lt_argv_zero : "<NULL>")));
355239713583Smrg  for (i = 0; i < newargc; i++)
355339713583Smrg    {
355439713583Smrg      LTWRAPPER_DEBUGPRINTF (("(main) newargz[%d]   : %s\n", i, (newargz[i] ? newargz[i] : "<NULL>")));
355539713583Smrg    }
355695b296d0Smrg
355739713583SmrgEOF
355895b296d0Smrg
355939713583Smrg	    case $host_os in
356039713583Smrg	      mingw*)
356139713583Smrg		cat <<"EOF"
356239713583Smrg  /* execv doesn't actually work on mingw as expected on unix */
356339713583Smrg  rval = _spawnv (_P_WAIT, lt_argv_zero, (const char * const *) newargz);
356439713583Smrg  if (rval == -1)
356539713583Smrg    {
356639713583Smrg      /* failed to start process */
356739713583Smrg      LTWRAPPER_DEBUGPRINTF (("(main) failed to launch target \"%s\": errno = %d\n", lt_argv_zero, errno));
356839713583Smrg      return 127;
356939713583Smrg    }
357039713583Smrg  return rval;
357139713583SmrgEOF
357239713583Smrg		;;
357339713583Smrg	      *)
357439713583Smrg		cat <<"EOF"
357539713583Smrg  execv (lt_argv_zero, newargz);
357639713583Smrg  return rval; /* =127, but avoids unused variable warning */
357739713583SmrgEOF
357839713583Smrg		;;
357939713583Smrg	    esac
358095b296d0Smrg
358139713583Smrg	    cat <<"EOF"
358239713583Smrg}
358395b296d0Smrg
358439713583Smrgvoid *
358539713583Smrgxmalloc (size_t num)
358639713583Smrg{
358739713583Smrg  void *p = (void *) malloc (num);
358839713583Smrg  if (!p)
358939713583Smrg    lt_fatal ("Memory exhausted");
359095b296d0Smrg
359139713583Smrg  return p;
359239713583Smrg}
359395b296d0Smrg
359439713583Smrgchar *
359539713583Smrgxstrdup (const char *string)
359639713583Smrg{
359739713583Smrg  return string ? strcpy ((char *) xmalloc (strlen (string) + 1),
359839713583Smrg			  string) : NULL;
359939713583Smrg}
360095b296d0Smrg
360139713583Smrgconst char *
360239713583Smrgbase_name (const char *name)
360339713583Smrg{
360439713583Smrg  const char *base;
360595b296d0Smrg
360639713583Smrg#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
360739713583Smrg  /* Skip over the disk name in MSDOS pathnames. */
360839713583Smrg  if (isalpha ((unsigned char) name[0]) && name[1] == ':')
360939713583Smrg    name += 2;
361039713583Smrg#endif
361195b296d0Smrg
361239713583Smrg  for (base = name; *name; name++)
361339713583Smrg    if (IS_DIR_SEPARATOR (*name))
361439713583Smrg      base = name + 1;
361539713583Smrg  return base;
361639713583Smrg}
361795b296d0Smrg
361839713583Smrgint
361939713583Smrgcheck_executable (const char *path)
362039713583Smrg{
362139713583Smrg  struct stat st;
362295b296d0Smrg
362339713583Smrg  LTWRAPPER_DEBUGPRINTF (("(check_executable)  : %s\n",
362439713583Smrg			  path ? (*path ? path : "EMPTY!") : "NULL!"));
362539713583Smrg  if ((!path) || (!*path))
362639713583Smrg    return 0;
362795b296d0Smrg
362839713583Smrg  if ((stat (path, &st) >= 0)
362939713583Smrg      && (st.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH)))
363039713583Smrg    return 1;
363139713583Smrg  else
363239713583Smrg    return 0;
363339713583Smrg}
363495b296d0Smrg
363539713583Smrgint
363639713583Smrgmake_executable (const char *path)
363739713583Smrg{
363839713583Smrg  int rval = 0;
363939713583Smrg  struct stat st;
364095b296d0Smrg
364139713583Smrg  LTWRAPPER_DEBUGPRINTF (("(make_executable)   : %s\n",
364239713583Smrg			  path ? (*path ? path : "EMPTY!") : "NULL!"));
364339713583Smrg  if ((!path) || (!*path))
364439713583Smrg    return 0;
364595b296d0Smrg
364639713583Smrg  if (stat (path, &st) >= 0)
364739713583Smrg    {
364839713583Smrg      rval = chmod (path, st.st_mode | S_IXOTH | S_IXGRP | S_IXUSR);
364939713583Smrg    }
365039713583Smrg  return rval;
365139713583Smrg}
365295b296d0Smrg
365339713583Smrg/* Searches for the full path of the wrapper.  Returns
365439713583Smrg   newly allocated full path name if found, NULL otherwise
365539713583Smrg   Does not chase symlinks, even on platforms that support them.
365639713583Smrg*/
365739713583Smrgchar *
365839713583Smrgfind_executable (const char *wrapper)
365939713583Smrg{
366039713583Smrg  int has_slash = 0;
366139713583Smrg  const char *p;
366239713583Smrg  const char *p_next;
366339713583Smrg  /* static buffer for getcwd */
366439713583Smrg  char tmp[LT_PATHMAX + 1];
366539713583Smrg  int tmp_len;
366639713583Smrg  char *concat_name;
366795b296d0Smrg
366839713583Smrg  LTWRAPPER_DEBUGPRINTF (("(find_executable)   : %s\n",
366939713583Smrg			  wrapper ? (*wrapper ? wrapper : "EMPTY!") : "NULL!"));
367095b296d0Smrg
367139713583Smrg  if ((wrapper == NULL) || (*wrapper == '\0'))
367239713583Smrg    return NULL;
367395b296d0Smrg
367439713583Smrg  /* Absolute path? */
367539713583Smrg#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
367639713583Smrg  if (isalpha ((unsigned char) wrapper[0]) && wrapper[1] == ':')
367739713583Smrg    {
367839713583Smrg      concat_name = xstrdup (wrapper);
367939713583Smrg      if (check_executable (concat_name))
368039713583Smrg	return concat_name;
368139713583Smrg      XFREE (concat_name);
368239713583Smrg    }
368339713583Smrg  else
368439713583Smrg    {
368539713583Smrg#endif
368639713583Smrg      if (IS_DIR_SEPARATOR (wrapper[0]))
368739713583Smrg	{
368839713583Smrg	  concat_name = xstrdup (wrapper);
368939713583Smrg	  if (check_executable (concat_name))
369039713583Smrg	    return concat_name;
369139713583Smrg	  XFREE (concat_name);
369239713583Smrg	}
369339713583Smrg#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
369439713583Smrg    }
369539713583Smrg#endif
369695b296d0Smrg
369739713583Smrg  for (p = wrapper; *p; p++)
369839713583Smrg    if (*p == '/')
369939713583Smrg      {
370039713583Smrg	has_slash = 1;
370139713583Smrg	break;
370239713583Smrg      }
370339713583Smrg  if (!has_slash)
370439713583Smrg    {
370539713583Smrg      /* no slashes; search PATH */
370639713583Smrg      const char *path = getenv ("PATH");
370739713583Smrg      if (path != NULL)
370839713583Smrg	{
370939713583Smrg	  for (p = path; *p; p = p_next)
371039713583Smrg	    {
371139713583Smrg	      const char *q;
371239713583Smrg	      size_t p_len;
371339713583Smrg	      for (q = p; *q; q++)
371439713583Smrg		if (IS_PATH_SEPARATOR (*q))
371539713583Smrg		  break;
371639713583Smrg	      p_len = q - p;
371739713583Smrg	      p_next = (*q == '\0' ? q : q + 1);
371839713583Smrg	      if (p_len == 0)
371939713583Smrg		{
372039713583Smrg		  /* empty path: current directory */
372139713583Smrg		  if (getcwd (tmp, LT_PATHMAX) == NULL)
372239713583Smrg		    lt_fatal ("getcwd failed");
372339713583Smrg		  tmp_len = strlen (tmp);
372439713583Smrg		  concat_name =
372539713583Smrg		    XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1);
372639713583Smrg		  memcpy (concat_name, tmp, tmp_len);
372739713583Smrg		  concat_name[tmp_len] = '/';
372839713583Smrg		  strcpy (concat_name + tmp_len + 1, wrapper);
372939713583Smrg		}
373039713583Smrg	      else
373139713583Smrg		{
373239713583Smrg		  concat_name =
373339713583Smrg		    XMALLOC (char, p_len + 1 + strlen (wrapper) + 1);
373439713583Smrg		  memcpy (concat_name, p, p_len);
373539713583Smrg		  concat_name[p_len] = '/';
373639713583Smrg		  strcpy (concat_name + p_len + 1, wrapper);
373739713583Smrg		}
373839713583Smrg	      if (check_executable (concat_name))
373939713583Smrg		return concat_name;
374039713583Smrg	      XFREE (concat_name);
374139713583Smrg	    }
374239713583Smrg	}
374339713583Smrg      /* not found in PATH; assume curdir */
374439713583Smrg    }
374539713583Smrg  /* Relative path | not found in path: prepend cwd */
374639713583Smrg  if (getcwd (tmp, LT_PATHMAX) == NULL)
374739713583Smrg    lt_fatal ("getcwd failed");
374839713583Smrg  tmp_len = strlen (tmp);
374939713583Smrg  concat_name = XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1);
375039713583Smrg  memcpy (concat_name, tmp, tmp_len);
375139713583Smrg  concat_name[tmp_len] = '/';
375239713583Smrg  strcpy (concat_name + tmp_len + 1, wrapper);
375395b296d0Smrg
375439713583Smrg  if (check_executable (concat_name))
375539713583Smrg    return concat_name;
375639713583Smrg  XFREE (concat_name);
375739713583Smrg  return NULL;
375839713583Smrg}
375995b296d0Smrg
376039713583Smrgchar *
376139713583Smrgchase_symlinks (const char *pathspec)
376239713583Smrg{
376339713583Smrg#ifndef S_ISLNK
376439713583Smrg  return xstrdup (pathspec);
376539713583Smrg#else
376639713583Smrg  char buf[LT_PATHMAX];
376739713583Smrg  struct stat s;
376839713583Smrg  char *tmp_pathspec = xstrdup (pathspec);
376939713583Smrg  char *p;
377039713583Smrg  int has_symlinks = 0;
377139713583Smrg  while (strlen (tmp_pathspec) && !has_symlinks)
377239713583Smrg    {
377339713583Smrg      LTWRAPPER_DEBUGPRINTF (("checking path component for symlinks: %s\n",
377439713583Smrg			      tmp_pathspec));
377539713583Smrg      if (lstat (tmp_pathspec, &s) == 0)
377639713583Smrg	{
377739713583Smrg	  if (S_ISLNK (s.st_mode) != 0)
377839713583Smrg	    {
377939713583Smrg	      has_symlinks = 1;
378039713583Smrg	      break;
378139713583Smrg	    }
378295b296d0Smrg
378339713583Smrg	  /* search backwards for last DIR_SEPARATOR */
378439713583Smrg	  p = tmp_pathspec + strlen (tmp_pathspec) - 1;
378539713583Smrg	  while ((p > tmp_pathspec) && (!IS_DIR_SEPARATOR (*p)))
378639713583Smrg	    p--;
378739713583Smrg	  if ((p == tmp_pathspec) && (!IS_DIR_SEPARATOR (*p)))
378839713583Smrg	    {
378939713583Smrg	      /* no more DIR_SEPARATORS left */
379039713583Smrg	      break;
379139713583Smrg	    }
379239713583Smrg	  *p = '\0';
379339713583Smrg	}
379439713583Smrg      else
379539713583Smrg	{
379639713583Smrg	  char *errstr = strerror (errno);
379739713583Smrg	  lt_fatal ("Error accessing file %s (%s)", tmp_pathspec, errstr);
379839713583Smrg	}
379939713583Smrg    }
380039713583Smrg  XFREE (tmp_pathspec);
380195b296d0Smrg
380239713583Smrg  if (!has_symlinks)
380339713583Smrg    {
380439713583Smrg      return xstrdup (pathspec);
380539713583Smrg    }
380695b296d0Smrg
380739713583Smrg  tmp_pathspec = realpath (pathspec, buf);
380839713583Smrg  if (tmp_pathspec == 0)
380939713583Smrg    {
381039713583Smrg      lt_fatal ("Could not follow symlinks for %s", pathspec);
381139713583Smrg    }
381239713583Smrg  return xstrdup (tmp_pathspec);
381339713583Smrg#endif
381439713583Smrg}
381595b296d0Smrg
381639713583Smrgchar *
381739713583Smrgstrendzap (char *str, const char *pat)
381839713583Smrg{
381939713583Smrg  size_t len, patlen;
382095b296d0Smrg
382139713583Smrg  assert (str != NULL);
382239713583Smrg  assert (pat != NULL);
382395b296d0Smrg
382439713583Smrg  len = strlen (str);
382539713583Smrg  patlen = strlen (pat);
382695b296d0Smrg
382739713583Smrg  if (patlen <= len)
382839713583Smrg    {
382939713583Smrg      str += len - patlen;
383039713583Smrg      if (strcmp (str, pat) == 0)
383139713583Smrg	*str = '\0';
383239713583Smrg    }
383339713583Smrg  return str;
383439713583Smrg}
383595b296d0Smrg
383639713583Smrgstatic void
383739713583Smrglt_error_core (int exit_status, const char *mode,
383839713583Smrg	       const char *message, va_list ap)
383939713583Smrg{
384039713583Smrg  fprintf (stderr, "%s: %s: ", program_name, mode);
384139713583Smrg  vfprintf (stderr, message, ap);
384239713583Smrg  fprintf (stderr, ".\n");
384395b296d0Smrg
384439713583Smrg  if (exit_status >= 0)
384539713583Smrg    exit (exit_status);
384639713583Smrg}
384795b296d0Smrg
384839713583Smrgvoid
384939713583Smrglt_fatal (const char *message, ...)
385039713583Smrg{
385139713583Smrg  va_list ap;
385239713583Smrg  va_start (ap, message);
385339713583Smrg  lt_error_core (EXIT_FAILURE, "FATAL", message, ap);
385439713583Smrg  va_end (ap);
385539713583Smrg}
385695b296d0Smrg
385739713583Smrgvoid
385839713583Smrglt_setenv (const char *name, const char *value)
385939713583Smrg{
386039713583Smrg  LTWRAPPER_DEBUGPRINTF (("(lt_setenv) setting '%s' to '%s'\n",
386139713583Smrg                          (name ? name : "<NULL>"),
386239713583Smrg                          (value ? value : "<NULL>")));
386339713583Smrg  {
386439713583Smrg#ifdef HAVE_SETENV
386539713583Smrg    /* always make a copy, for consistency with !HAVE_SETENV */
386639713583Smrg    char *str = xstrdup (value);
386739713583Smrg    setenv (name, str, 1);
386839713583Smrg#else
386939713583Smrg    int len = strlen (name) + 1 + strlen (value) + 1;
387039713583Smrg    char *str = XMALLOC (char, len);
387139713583Smrg    sprintf (str, "%s=%s", name, value);
387239713583Smrg    if (putenv (str) != EXIT_SUCCESS)
387339713583Smrg      {
387439713583Smrg        XFREE (str);
387539713583Smrg      }
387639713583Smrg#endif
387739713583Smrg  }
387839713583Smrg}
387995b296d0Smrg
388039713583Smrgchar *
388139713583Smrglt_extend_str (const char *orig_value, const char *add, int to_end)
388239713583Smrg{
388339713583Smrg  char *new_value;
388439713583Smrg  if (orig_value && *orig_value)
388539713583Smrg    {
388639713583Smrg      int orig_value_len = strlen (orig_value);
388739713583Smrg      int add_len = strlen (add);
388839713583Smrg      new_value = XMALLOC (char, add_len + orig_value_len + 1);
388939713583Smrg      if (to_end)
389039713583Smrg        {
389139713583Smrg          strcpy (new_value, orig_value);
389239713583Smrg          strcpy (new_value + orig_value_len, add);
389339713583Smrg        }
389439713583Smrg      else
389539713583Smrg        {
389639713583Smrg          strcpy (new_value, add);
389739713583Smrg          strcpy (new_value + add_len, orig_value);
389839713583Smrg        }
389939713583Smrg    }
390039713583Smrg  else
390139713583Smrg    {
390239713583Smrg      new_value = xstrdup (add);
390339713583Smrg    }
390439713583Smrg  return new_value;
390539713583Smrg}
390695b296d0Smrg
390739713583Smrgint
390839713583Smrglt_split_name_value (const char *arg, char** name, char** value)
390939713583Smrg{
391039713583Smrg  const char *p;
391139713583Smrg  int len;
391239713583Smrg  if (!arg || !*arg)
391339713583Smrg    return 1;
391495b296d0Smrg
391539713583Smrg  p = strchr (arg, (int)'=');
391695b296d0Smrg
391739713583Smrg  if (!p)
391839713583Smrg    return 1;
391995b296d0Smrg
392039713583Smrg  *value = xstrdup (++p);
392195b296d0Smrg
392239713583Smrg  len = strlen (arg) - strlen (*value);
392339713583Smrg  *name = XMALLOC (char, len);
392439713583Smrg  strncpy (*name, arg, len-1);
392539713583Smrg  (*name)[len - 1] = '\0';
392695b296d0Smrg
392739713583Smrg  return 0;
392839713583Smrg}
392995b296d0Smrg
393039713583Smrgvoid
393139713583Smrglt_opt_process_env_set (const char *arg)
393239713583Smrg{
393339713583Smrg  char *name = NULL;
393439713583Smrg  char *value = NULL;
393595b296d0Smrg
393639713583Smrg  if (lt_split_name_value (arg, &name, &value) != 0)
393739713583Smrg    {
393839713583Smrg      XFREE (name);
393939713583Smrg      XFREE (value);
394039713583Smrg      lt_fatal ("bad argument for %s: '%s'", env_set_opt, arg);
394139713583Smrg    }
394295b296d0Smrg
394339713583Smrg  lt_setenv (name, value);
394439713583Smrg  XFREE (name);
394539713583Smrg  XFREE (value);
394639713583Smrg}
394795b296d0Smrg
394839713583Smrgvoid
394939713583Smrglt_opt_process_env_prepend (const char *arg)
395039713583Smrg{
395139713583Smrg  char *name = NULL;
395239713583Smrg  char *value = NULL;
395339713583Smrg  char *new_value = NULL;
395495b296d0Smrg
395539713583Smrg  if (lt_split_name_value (arg, &name, &value) != 0)
395639713583Smrg    {
395739713583Smrg      XFREE (name);
395839713583Smrg      XFREE (value);
395939713583Smrg      lt_fatal ("bad argument for %s: '%s'", env_prepend_opt, arg);
396039713583Smrg    }
396195b296d0Smrg
396239713583Smrg  new_value = lt_extend_str (getenv (name), value, 0);
396339713583Smrg  lt_setenv (name, new_value);
396439713583Smrg  XFREE (new_value);
396539713583Smrg  XFREE (name);
396639713583Smrg  XFREE (value);
396739713583Smrg}
396895b296d0Smrg
396939713583Smrgvoid
397039713583Smrglt_opt_process_env_append (const char *arg)
397139713583Smrg{
397239713583Smrg  char *name = NULL;
397339713583Smrg  char *value = NULL;
397439713583Smrg  char *new_value = NULL;
397595b296d0Smrg
397639713583Smrg  if (lt_split_name_value (arg, &name, &value) != 0)
397739713583Smrg    {
397839713583Smrg      XFREE (name);
397939713583Smrg      XFREE (value);
398039713583Smrg      lt_fatal ("bad argument for %s: '%s'", env_append_opt, arg);
398139713583Smrg    }
398295b296d0Smrg
398339713583Smrg  new_value = lt_extend_str (getenv (name), value, 1);
398439713583Smrg  lt_setenv (name, new_value);
398539713583Smrg  XFREE (new_value);
398639713583Smrg  XFREE (name);
398739713583Smrg  XFREE (value);
398839713583Smrg}
398995b296d0Smrg
399039713583Smrgvoid
399139713583Smrglt_update_exe_path (const char *name, const char *value)
399239713583Smrg{
399339713583Smrg  LTWRAPPER_DEBUGPRINTF (("(lt_update_exe_path) modifying '%s' by prepending '%s'\n",
399439713583Smrg                          (name ? name : "<NULL>"),
399539713583Smrg                          (value ? value : "<NULL>")));
399695b296d0Smrg
399739713583Smrg  if (name && *name && value && *value)
399839713583Smrg    {
399939713583Smrg      char *new_value = lt_extend_str (getenv (name), value, 0);
400039713583Smrg      /* some systems can't cope with a ':'-terminated path #' */
400139713583Smrg      int len = strlen (new_value);
400239713583Smrg      while (((len = strlen (new_value)) > 0) && IS_PATH_SEPARATOR (new_value[len-1]))
400339713583Smrg        {
400439713583Smrg          new_value[len-1] = '\0';
400539713583Smrg        }
400639713583Smrg      lt_setenv (name, new_value);
400739713583Smrg      XFREE (new_value);
400839713583Smrg    }
400939713583Smrg}
401095b296d0Smrg
401139713583Smrgvoid
401239713583Smrglt_update_lib_path (const char *name, const char *value)
401339713583Smrg{
401439713583Smrg  LTWRAPPER_DEBUGPRINTF (("(lt_update_lib_path) modifying '%s' by prepending '%s'\n",
401539713583Smrg                          (name ? name : "<NULL>"),
401639713583Smrg                          (value ? value : "<NULL>")));
401795b296d0Smrg
401839713583Smrg  if (name && *name && value && *value)
401939713583Smrg    {
402039713583Smrg      char *new_value = lt_extend_str (getenv (name), value, 0);
402139713583Smrg      lt_setenv (name, new_value);
402239713583Smrg      XFREE (new_value);
402339713583Smrg    }
402439713583Smrg}
402595b296d0Smrg
402695b296d0Smrg
402739713583SmrgEOF
402839713583Smrg}
402939713583Smrg# end: func_emit_cwrapperexe_src
403095b296d0Smrg
403139713583Smrg# func_mode_link arg...
403239713583Smrgfunc_mode_link ()
403339713583Smrg{
403439713583Smrg    $opt_debug
403539713583Smrg    case $host in
403639713583Smrg    *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
403739713583Smrg      # It is impossible to link a dll without this setting, and
403839713583Smrg      # we shouldn't force the makefile maintainer to figure out
403939713583Smrg      # which system we are compiling for in order to pass an extra
404039713583Smrg      # flag for every libtool invocation.
404139713583Smrg      # allow_undefined=no
404295b296d0Smrg
404339713583Smrg      # FIXME: Unfortunately, there are problems with the above when trying
404439713583Smrg      # to make a dll which has undefined symbols, in which case not
404539713583Smrg      # even a static library is built.  For now, we need to specify
404639713583Smrg      # -no-undefined on the libtool link line when we can be certain
404739713583Smrg      # that all symbols are satisfied, otherwise we get a static library.
404839713583Smrg      allow_undefined=yes
404939713583Smrg      ;;
405039713583Smrg    *)
405139713583Smrg      allow_undefined=yes
405239713583Smrg      ;;
405339713583Smrg    esac
405439713583Smrg    libtool_args=$nonopt
405539713583Smrg    base_compile="$nonopt $@"
405639713583Smrg    compile_command=$nonopt
405739713583Smrg    finalize_command=$nonopt
405895b296d0Smrg
405939713583Smrg    compile_rpath=
406039713583Smrg    finalize_rpath=
406139713583Smrg    compile_shlibpath=
406239713583Smrg    finalize_shlibpath=
406339713583Smrg    convenience=
406439713583Smrg    old_convenience=
406539713583Smrg    deplibs=
406639713583Smrg    old_deplibs=
406739713583Smrg    compiler_flags=
406839713583Smrg    linker_flags=
406939713583Smrg    dllsearchpath=
407039713583Smrg    lib_search_path=`pwd`
407139713583Smrg    inst_prefix_dir=
407239713583Smrg    new_inherited_linker_flags=
407395b296d0Smrg
407439713583Smrg    avoid_version=no
407539713583Smrg    dlfiles=
407639713583Smrg    dlprefiles=
407739713583Smrg    dlself=no
407839713583Smrg    export_dynamic=no
407939713583Smrg    export_symbols=
408039713583Smrg    export_symbols_regex=
408139713583Smrg    generated=
408239713583Smrg    libobjs=
408339713583Smrg    ltlibs=
408439713583Smrg    module=no
408539713583Smrg    no_install=no
408639713583Smrg    objs=
408739713583Smrg    non_pic_objects=
408839713583Smrg    precious_files_regex=
408939713583Smrg    prefer_static_libs=no
409039713583Smrg    preload=no
409139713583Smrg    prev=
409239713583Smrg    prevarg=
409339713583Smrg    release=
409439713583Smrg    rpath=
409539713583Smrg    xrpath=
409639713583Smrg    perm_rpath=
409739713583Smrg    temp_rpath=
409839713583Smrg    thread_safe=no
409939713583Smrg    vinfo=
410039713583Smrg    vinfo_number=no
410139713583Smrg    weak_libs=
410239713583Smrg    single_module="${wl}-single_module"
410339713583Smrg    func_infer_tag $base_compile
410439713583Smrg
410539713583Smrg    # We need to know -static, to get the right output filenames.
410639713583Smrg    for arg
410739713583Smrg    do
410839713583Smrg      case $arg in
410939713583Smrg      -shared)
411039713583Smrg	test "$build_libtool_libs" != yes && \
411139713583Smrg	  func_fatal_configuration "can not build a shared library"
411239713583Smrg	build_old_libs=no
411339713583Smrg	break
411439713583Smrg	;;
411539713583Smrg      -all-static | -static | -static-libtool-libs)
411639713583Smrg	case $arg in
411739713583Smrg	-all-static)
411839713583Smrg	  if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then
411939713583Smrg	    func_warning "complete static linking is impossible in this configuration"
412039713583Smrg	  fi
412139713583Smrg	  if test -n "$link_static_flag"; then
412239713583Smrg	    dlopen_self=$dlopen_self_static
412339713583Smrg	  fi
412439713583Smrg	  prefer_static_libs=yes
412539713583Smrg	  ;;
412639713583Smrg	-static)
412739713583Smrg	  if test -z "$pic_flag" && test -n "$link_static_flag"; then
412839713583Smrg	    dlopen_self=$dlopen_self_static
412939713583Smrg	  fi
413039713583Smrg	  prefer_static_libs=built
413139713583Smrg	  ;;
413239713583Smrg	-static-libtool-libs)
413339713583Smrg	  if test -z "$pic_flag" && test -n "$link_static_flag"; then
413439713583Smrg	    dlopen_self=$dlopen_self_static
413595b296d0Smrg	  fi
413639713583Smrg	  prefer_static_libs=yes
413739713583Smrg	  ;;
413839713583Smrg	esac
413939713583Smrg	build_libtool_libs=no
414039713583Smrg	build_old_libs=yes
414139713583Smrg	break
414239713583Smrg	;;
414339713583Smrg      esac
414439713583Smrg    done
414595b296d0Smrg
414639713583Smrg    # See if our shared archives depend on static archives.
414739713583Smrg    test -n "$old_archive_from_new_cmds" && build_old_libs=yes
414895b296d0Smrg
414939713583Smrg    # Go through the arguments, transforming them on the way.
415039713583Smrg    while test "$#" -gt 0; do
415139713583Smrg      arg="$1"
415239713583Smrg      shift
415339713583Smrg      func_quote_for_eval "$arg"
415439713583Smrg      qarg=$func_quote_for_eval_unquoted_result
415539713583Smrg      func_append libtool_args " $func_quote_for_eval_result"
415695b296d0Smrg
415739713583Smrg      # If the previous option needs an argument, assign it.
415839713583Smrg      if test -n "$prev"; then
415939713583Smrg	case $prev in
416039713583Smrg	output)
416139713583Smrg	  func_append compile_command " @OUTPUT@"
416239713583Smrg	  func_append finalize_command " @OUTPUT@"
416339713583Smrg	  ;;
416439713583Smrg	esac
416595b296d0Smrg
416639713583Smrg	case $prev in
416739713583Smrg	dlfiles|dlprefiles)
416839713583Smrg	  if test "$preload" = no; then
416939713583Smrg	    # Add the symbol object into the linking commands.
417039713583Smrg	    func_append compile_command " @SYMFILE@"
417139713583Smrg	    func_append finalize_command " @SYMFILE@"
417239713583Smrg	    preload=yes
417339713583Smrg	  fi
417439713583Smrg	  case $arg in
417539713583Smrg	  *.la | *.lo) ;;  # We handle these cases below.
417639713583Smrg	  force)
417739713583Smrg	    if test "$dlself" = no; then
417839713583Smrg	      dlself=needless
417939713583Smrg	      export_dynamic=yes
418039713583Smrg	    fi
418139713583Smrg	    prev=
418239713583Smrg	    continue
418339713583Smrg	    ;;
418439713583Smrg	  self)
418539713583Smrg	    if test "$prev" = dlprefiles; then
418639713583Smrg	      dlself=yes
418739713583Smrg	    elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then
418839713583Smrg	      dlself=yes
418995b296d0Smrg	    else
419039713583Smrg	      dlself=needless
419139713583Smrg	      export_dynamic=yes
419295b296d0Smrg	    fi
419339713583Smrg	    prev=
419439713583Smrg	    continue
419539713583Smrg	    ;;
419639713583Smrg	  *)
419739713583Smrg	    if test "$prev" = dlfiles; then
419839713583Smrg	      dlfiles="$dlfiles $arg"
419995b296d0Smrg	    else
420039713583Smrg	      dlprefiles="$dlprefiles $arg"
420195b296d0Smrg	    fi
420239713583Smrg	    prev=
420339713583Smrg	    continue
420439713583Smrg	    ;;
420539713583Smrg	  esac
420639713583Smrg	  ;;
420739713583Smrg	expsyms)
420839713583Smrg	  export_symbols="$arg"
420939713583Smrg	  test -f "$arg" \
421039713583Smrg	    || func_fatal_error "symbol file \`$arg' does not exist"
421139713583Smrg	  prev=
421239713583Smrg	  continue
421339713583Smrg	  ;;
421439713583Smrg	expsyms_regex)
421539713583Smrg	  export_symbols_regex="$arg"
421639713583Smrg	  prev=
421739713583Smrg	  continue
421839713583Smrg	  ;;
421939713583Smrg	framework)
422095b296d0Smrg	  case $host in
422139713583Smrg	    *-*-darwin*)
422239713583Smrg	      case "$deplibs " in
422339713583Smrg		*" $qarg.ltframework "*) ;;
422439713583Smrg		*) deplibs="$deplibs $qarg.ltframework" # this is fixed later
422539713583Smrg		   ;;
422639713583Smrg	      esac
422739713583Smrg	      ;;
422895b296d0Smrg	  esac
422939713583Smrg	  prev=
423039713583Smrg	  continue
423195b296d0Smrg	  ;;
423239713583Smrg	inst_prefix)
423339713583Smrg	  inst_prefix_dir="$arg"
423439713583Smrg	  prev=
423539713583Smrg	  continue
423695b296d0Smrg	  ;;
423739713583Smrg	objectlist)
423839713583Smrg	  if test -f "$arg"; then
423939713583Smrg	    save_arg=$arg
424039713583Smrg	    moreargs=
424139713583Smrg	    for fil in `cat "$save_arg"`
424239713583Smrg	    do
424339713583Smrg#	      moreargs="$moreargs $fil"
424439713583Smrg	      arg=$fil
424539713583Smrg	      # A libtool-controlled object.
424695b296d0Smrg
424739713583Smrg	      # Check to see that this really is a libtool object.
424839713583Smrg	      if func_lalib_unsafe_p "$arg"; then
424939713583Smrg		pic_object=
425039713583Smrg		non_pic_object=
425195b296d0Smrg
425239713583Smrg		# Read the .lo file
425339713583Smrg		func_source "$arg"
425495b296d0Smrg
425539713583Smrg		if test -z "$pic_object" ||
425639713583Smrg		   test -z "$non_pic_object" ||
425739713583Smrg		   test "$pic_object" = none &&
425839713583Smrg		   test "$non_pic_object" = none; then
425939713583Smrg		  func_fatal_error "cannot find name of object for \`$arg'"
426039713583Smrg		fi
426195b296d0Smrg
426239713583Smrg		# Extract subdirectory from the argument.
426339713583Smrg		func_dirname "$arg" "/" ""
426439713583Smrg		xdir="$func_dirname_result"
426595b296d0Smrg
426639713583Smrg		if test "$pic_object" != none; then
426739713583Smrg		  # Prepend the subdirectory the object is found in.
426839713583Smrg		  pic_object="$xdir$pic_object"
426995b296d0Smrg
427039713583Smrg		  if test "$prev" = dlfiles; then
427139713583Smrg		    if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
427239713583Smrg		      dlfiles="$dlfiles $pic_object"
427339713583Smrg		      prev=
427439713583Smrg		      continue
427539713583Smrg		    else
427639713583Smrg		      # If libtool objects are unsupported, then we need to preload.
427739713583Smrg		      prev=dlprefiles
427839713583Smrg		    fi
427939713583Smrg		  fi
428095b296d0Smrg
428139713583Smrg		  # CHECK ME:  I think I busted this.  -Ossama
428239713583Smrg		  if test "$prev" = dlprefiles; then
428339713583Smrg		    # Preload the old-style object.
428439713583Smrg		    dlprefiles="$dlprefiles $pic_object"
428539713583Smrg		    prev=
428639713583Smrg		  fi
428795b296d0Smrg
428839713583Smrg		  # A PIC object.
428939713583Smrg		  func_append libobjs " $pic_object"
429039713583Smrg		  arg="$pic_object"
429139713583Smrg		fi
429295b296d0Smrg
429339713583Smrg		# Non-PIC object.
429439713583Smrg		if test "$non_pic_object" != none; then
429539713583Smrg		  # Prepend the subdirectory the object is found in.
429639713583Smrg		  non_pic_object="$xdir$non_pic_object"
429795b296d0Smrg
429839713583Smrg		  # A standard non-PIC object
429939713583Smrg		  func_append non_pic_objects " $non_pic_object"
430039713583Smrg		  if test -z "$pic_object" || test "$pic_object" = none ; then
430139713583Smrg		    arg="$non_pic_object"
430239713583Smrg		  fi
430339713583Smrg		else
430439713583Smrg		  # If the PIC object exists, use it instead.
430539713583Smrg		  # $xdir was prepended to $pic_object above.
430639713583Smrg		  non_pic_object="$pic_object"
430739713583Smrg		  func_append non_pic_objects " $non_pic_object"
430839713583Smrg		fi
430939713583Smrg	      else
431039713583Smrg		# Only an error if not doing a dry-run.
431139713583Smrg		if $opt_dry_run; then
431239713583Smrg		  # Extract subdirectory from the argument.
431339713583Smrg		  func_dirname "$arg" "/" ""
431439713583Smrg		  xdir="$func_dirname_result"
431539713583Smrg
431639713583Smrg		  func_lo2o "$arg"
431739713583Smrg		  pic_object=$xdir$objdir/$func_lo2o_result
431839713583Smrg		  non_pic_object=$xdir$func_lo2o_result
431939713583Smrg		  func_append libobjs " $pic_object"
432039713583Smrg		  func_append non_pic_objects " $non_pic_object"
432139713583Smrg	        else
432239713583Smrg		  func_fatal_error "\`$arg' is not a valid libtool object"
432339713583Smrg		fi
432439713583Smrg	      fi
432539713583Smrg	    done
432695b296d0Smrg	  else
432739713583Smrg	    func_fatal_error "link input file \`$arg' does not exist"
432895b296d0Smrg	  fi
432939713583Smrg	  arg=$save_arg
433039713583Smrg	  prev=
433139713583Smrg	  continue
433239713583Smrg	  ;;
433339713583Smrg	precious_regex)
433439713583Smrg	  precious_files_regex="$arg"
433539713583Smrg	  prev=
433639713583Smrg	  continue
433739713583Smrg	  ;;
433839713583Smrg	release)
433939713583Smrg	  release="-$arg"
434039713583Smrg	  prev=
434139713583Smrg	  continue
434239713583Smrg	  ;;
434339713583Smrg	rpath | xrpath)
434439713583Smrg	  # We need an absolute path.
434539713583Smrg	  case $arg in
434639713583Smrg	  [\\/]* | [A-Za-z]:[\\/]*) ;;
434739713583Smrg	  *)
434839713583Smrg	    func_fatal_error "only absolute run-paths are allowed"
434939713583Smrg	    ;;
435039713583Smrg	  esac
435139713583Smrg	  if test "$prev" = rpath; then
435239713583Smrg	    case "$rpath " in
435339713583Smrg	    *" $arg "*) ;;
435439713583Smrg	    *) rpath="$rpath $arg" ;;
435539713583Smrg	    esac
435695b296d0Smrg	  else
435739713583Smrg	    case "$xrpath " in
435839713583Smrg	    *" $arg "*) ;;
435939713583Smrg	    *) xrpath="$xrpath $arg" ;;
436039713583Smrg	    esac
436195b296d0Smrg	  fi
436239713583Smrg	  prev=
436339713583Smrg	  continue
436439713583Smrg	  ;;
436539713583Smrg	shrext)
436639713583Smrg	  shrext_cmds="$arg"
436739713583Smrg	  prev=
436839713583Smrg	  continue
436939713583Smrg	  ;;
437039713583Smrg	weak)
437139713583Smrg	  weak_libs="$weak_libs $arg"
437239713583Smrg	  prev=
437339713583Smrg	  continue
437439713583Smrg	  ;;
437539713583Smrg	xcclinker)
437639713583Smrg	  linker_flags="$linker_flags $qarg"
437739713583Smrg	  compiler_flags="$compiler_flags $qarg"
437839713583Smrg	  prev=
437939713583Smrg	  func_append compile_command " $qarg"
438039713583Smrg	  func_append finalize_command " $qarg"
438139713583Smrg	  continue
438239713583Smrg	  ;;
438339713583Smrg	xcompiler)
438439713583Smrg	  compiler_flags="$compiler_flags $qarg"
438539713583Smrg	  prev=
438639713583Smrg	  func_append compile_command " $qarg"
438739713583Smrg	  func_append finalize_command " $qarg"
438839713583Smrg	  continue
438939713583Smrg	  ;;
439039713583Smrg	xlinker)
439139713583Smrg	  linker_flags="$linker_flags $qarg"
439239713583Smrg	  compiler_flags="$compiler_flags $wl$qarg"
439339713583Smrg	  prev=
439439713583Smrg	  func_append compile_command " $wl$qarg"
439539713583Smrg	  func_append finalize_command " $wl$qarg"
439639713583Smrg	  continue
439739713583Smrg	  ;;
439839713583Smrg	*)
439939713583Smrg	  eval "$prev=\"\$arg\""
440039713583Smrg	  prev=
440139713583Smrg	  continue
440239713583Smrg	  ;;
440395b296d0Smrg	esac
440439713583Smrg      fi # test -n "$prev"
440595b296d0Smrg
440639713583Smrg      prevarg="$arg"
440795b296d0Smrg
440839713583Smrg      case $arg in
440939713583Smrg      -all-static)
441039713583Smrg	if test -n "$link_static_flag"; then
441139713583Smrg	  # See comment for -static flag below, for more details.
441239713583Smrg	  func_append compile_command " $link_static_flag"
441339713583Smrg	  func_append finalize_command " $link_static_flag"
441439713583Smrg	fi
441539713583Smrg	continue
441639713583Smrg	;;
441795b296d0Smrg
441839713583Smrg      -allow-undefined)
441939713583Smrg	# FIXME: remove this flag sometime in the future.
442039713583Smrg	func_fatal_error "\`-allow-undefined' must not be used because it is the default"
442139713583Smrg	;;
442295b296d0Smrg
442339713583Smrg      -avoid-version)
442439713583Smrg	avoid_version=yes
442539713583Smrg	continue
442639713583Smrg	;;
442795b296d0Smrg
442839713583Smrg      -dlopen)
442939713583Smrg	prev=dlfiles
443039713583Smrg	continue
443139713583Smrg	;;
443295b296d0Smrg
443339713583Smrg      -dlpreopen)
443439713583Smrg	prev=dlprefiles
443539713583Smrg	continue
443639713583Smrg	;;
443795b296d0Smrg
443839713583Smrg      -export-dynamic)
443939713583Smrg	export_dynamic=yes
444039713583Smrg	continue
444139713583Smrg	;;
444295b296d0Smrg
444339713583Smrg      -export-symbols | -export-symbols-regex)
444439713583Smrg	if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
444539713583Smrg	  func_fatal_error "more than one -exported-symbols argument is not allowed"
444639713583Smrg	fi
444739713583Smrg	if test "X$arg" = "X-export-symbols"; then
444839713583Smrg	  prev=expsyms
444939713583Smrg	else
445039713583Smrg	  prev=expsyms_regex
445139713583Smrg	fi
445239713583Smrg	continue
445339713583Smrg	;;
445495b296d0Smrg
445539713583Smrg      -framework)
445639713583Smrg	prev=framework
445739713583Smrg	continue
445839713583Smrg	;;
445995b296d0Smrg
446039713583Smrg      -inst-prefix-dir)
446139713583Smrg	prev=inst_prefix
446239713583Smrg	continue
446339713583Smrg	;;
446495b296d0Smrg
446539713583Smrg      # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:*
446639713583Smrg      # so, if we see these flags be careful not to treat them like -L
446739713583Smrg      -L[A-Z][A-Z]*:*)
446839713583Smrg	case $with_gcc/$host in
446939713583Smrg	no/*-*-irix* | /*-*-irix*)
447039713583Smrg	  func_append compile_command " $arg"
447139713583Smrg	  func_append finalize_command " $arg"
447239713583Smrg	  ;;
447339713583Smrg	esac
447439713583Smrg	continue
447539713583Smrg	;;
447695b296d0Smrg
447739713583Smrg      -L*)
447839713583Smrg	func_stripname '-L' '' "$arg"
447939713583Smrg	dir=$func_stripname_result
448039713583Smrg	if test -z "$dir"; then
448139713583Smrg	  if test "$#" -gt 0; then
448239713583Smrg	    func_fatal_error "require no space between \`-L' and \`$1'"
448339713583Smrg	  else
448439713583Smrg	    func_fatal_error "need path for \`-L' option"
448539713583Smrg	  fi
448639713583Smrg	fi
448739713583Smrg	# We need an absolute path.
448839713583Smrg	case $dir in
448939713583Smrg	[\\/]* | [A-Za-z]:[\\/]*) ;;
449039713583Smrg	*)
449139713583Smrg	  absdir=`cd "$dir" && pwd`
449239713583Smrg	  test -z "$absdir" && \
449339713583Smrg	    func_fatal_error "cannot determine absolute directory name of \`$dir'"
449439713583Smrg	  dir="$absdir"
449539713583Smrg	  ;;
449639713583Smrg	esac
449739713583Smrg	case "$deplibs " in
449839713583Smrg	*" -L$dir "*) ;;
449939713583Smrg	*)
450039713583Smrg	  deplibs="$deplibs -L$dir"
450139713583Smrg	  lib_search_path="$lib_search_path $dir"
450239713583Smrg	  ;;
450339713583Smrg	esac
450439713583Smrg	case $host in
450539713583Smrg	*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
450639713583Smrg	  testbindir=`$ECHO "X$dir" | $Xsed -e 's*/lib$*/bin*'`
450739713583Smrg	  case :$dllsearchpath: in
450839713583Smrg	  *":$dir:"*) ;;
450939713583Smrg	  ::) dllsearchpath=$dir;;
451039713583Smrg	  *) dllsearchpath="$dllsearchpath:$dir";;
451139713583Smrg	  esac
451239713583Smrg	  case :$dllsearchpath: in
451339713583Smrg	  *":$testbindir:"*) ;;
451439713583Smrg	  ::) dllsearchpath=$testbindir;;
451539713583Smrg	  *) dllsearchpath="$dllsearchpath:$testbindir";;
451639713583Smrg	  esac
451739713583Smrg	  ;;
451839713583Smrg	esac
451939713583Smrg	continue
452039713583Smrg	;;
452195b296d0Smrg
452239713583Smrg      -l*)
452339713583Smrg	if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then
452439713583Smrg	  case $host in
452539713583Smrg	  *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos* | *-cegcc*)
452639713583Smrg	    # These systems don't actually have a C or math library (as such)
452739713583Smrg	    continue
452839713583Smrg	    ;;
452939713583Smrg	  *-*-os2*)
453039713583Smrg	    # These systems don't actually have a C library (as such)
453139713583Smrg	    test "X$arg" = "X-lc" && continue
453239713583Smrg	    ;;
453339713583Smrg	  *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
453439713583Smrg	    # Do not include libc due to us having libc/libc_r.
453539713583Smrg	    test "X$arg" = "X-lc" && continue
453639713583Smrg	    ;;
453739713583Smrg	  *-*-rhapsody* | *-*-darwin1.[012])
453839713583Smrg	    # Rhapsody C and math libraries are in the System framework
453939713583Smrg	    deplibs="$deplibs System.ltframework"
454039713583Smrg	    continue
454139713583Smrg	    ;;
454239713583Smrg	  *-*-sco3.2v5* | *-*-sco5v6*)
454339713583Smrg	    # Causes problems with __ctype
454439713583Smrg	    test "X$arg" = "X-lc" && continue
454539713583Smrg	    ;;
454639713583Smrg	  *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
454739713583Smrg	    # Compiler inserts libc in the correct place for threads to work
454839713583Smrg	    test "X$arg" = "X-lc" && continue
454939713583Smrg	    ;;
455039713583Smrg	  esac
455139713583Smrg	elif test "X$arg" = "X-lc_r"; then
455239713583Smrg	 case $host in
455339713583Smrg	 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
455439713583Smrg	   # Do not include libc_r directly, use -pthread flag.
455539713583Smrg	   continue
455639713583Smrg	   ;;
455739713583Smrg	 esac
455839713583Smrg	fi
455939713583Smrg	deplibs="$deplibs $arg"
456039713583Smrg	continue
456139713583Smrg	;;
456295b296d0Smrg
456339713583Smrg      -module)
456439713583Smrg	module=yes
456539713583Smrg	continue
456639713583Smrg	;;
456795b296d0Smrg
456839713583Smrg      # Tru64 UNIX uses -model [arg] to determine the layout of C++
456939713583Smrg      # classes, name mangling, and exception handling.
457039713583Smrg      # Darwin uses the -arch flag to determine output architecture.
457139713583Smrg      -model|-arch|-isysroot)
457239713583Smrg	compiler_flags="$compiler_flags $arg"
457339713583Smrg	func_append compile_command " $arg"
457439713583Smrg	func_append finalize_command " $arg"
457539713583Smrg	prev=xcompiler
457639713583Smrg	continue
457739713583Smrg	;;
457895b296d0Smrg
457939713583Smrg      -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads)
458039713583Smrg	compiler_flags="$compiler_flags $arg"
458139713583Smrg	func_append compile_command " $arg"
458239713583Smrg	func_append finalize_command " $arg"
458339713583Smrg	case "$new_inherited_linker_flags " in
458439713583Smrg	    *" $arg "*) ;;
458539713583Smrg	    * ) new_inherited_linker_flags="$new_inherited_linker_flags $arg" ;;
458639713583Smrg	esac
458739713583Smrg	continue
458839713583Smrg	;;
458995b296d0Smrg
459039713583Smrg      -multi_module)
459139713583Smrg	single_module="${wl}-multi_module"
459239713583Smrg	continue
459339713583Smrg	;;
459495b296d0Smrg
459539713583Smrg      -no-fast-install)
459639713583Smrg	fast_install=no
459739713583Smrg	continue
459839713583Smrg	;;
459995b296d0Smrg
460039713583Smrg      -no-install)
460139713583Smrg	case $host in
460239713583Smrg	*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin* | *-cegcc*)
460339713583Smrg	  # The PATH hackery in wrapper scripts is required on Windows
460439713583Smrg	  # and Darwin in order for the loader to find any dlls it needs.
460539713583Smrg	  func_warning "\`-no-install' is ignored for $host"
460639713583Smrg	  func_warning "assuming \`-no-fast-install' instead"
460739713583Smrg	  fast_install=no
460839713583Smrg	  ;;
460939713583Smrg	*) no_install=yes ;;
461039713583Smrg	esac
461139713583Smrg	continue
461239713583Smrg	;;
461395b296d0Smrg
461439713583Smrg      -no-undefined)
461539713583Smrg	allow_undefined=no
461639713583Smrg	continue
461739713583Smrg	;;
461895b296d0Smrg
461939713583Smrg      -objectlist)
462039713583Smrg	prev=objectlist
462139713583Smrg	continue
462239713583Smrg	;;
462395b296d0Smrg
462439713583Smrg      -o) prev=output ;;
462595b296d0Smrg
462639713583Smrg      -precious-files-regex)
462739713583Smrg	prev=precious_regex
462839713583Smrg	continue
462939713583Smrg	;;
463095b296d0Smrg
463139713583Smrg      -release)
463239713583Smrg	prev=release
463339713583Smrg	continue
463439713583Smrg	;;
463595b296d0Smrg
463639713583Smrg      -rpath)
463739713583Smrg	prev=rpath
463839713583Smrg	continue
463939713583Smrg	;;
464095b296d0Smrg
464139713583Smrg      -R)
464239713583Smrg	prev=xrpath
464339713583Smrg	continue
464439713583Smrg	;;
464595b296d0Smrg
464639713583Smrg      -R*)
464739713583Smrg	func_stripname '-R' '' "$arg"
464839713583Smrg	dir=$func_stripname_result
464939713583Smrg	# We need an absolute path.
465039713583Smrg	case $dir in
465139713583Smrg	[\\/]* | [A-Za-z]:[\\/]*) ;;
465239713583Smrg	*)
465339713583Smrg	  func_fatal_error "only absolute run-paths are allowed"
465439713583Smrg	  ;;
465539713583Smrg	esac
465639713583Smrg	case "$xrpath " in
465739713583Smrg	*" $dir "*) ;;
465839713583Smrg	*) xrpath="$xrpath $dir" ;;
465939713583Smrg	esac
466039713583Smrg	continue
466139713583Smrg	;;
466295b296d0Smrg
466339713583Smrg      -shared)
466439713583Smrg	# The effects of -shared are defined in a previous loop.
466539713583Smrg	continue
466639713583Smrg	;;
466795b296d0Smrg
466839713583Smrg      -shrext)
466939713583Smrg	prev=shrext
467039713583Smrg	continue
467139713583Smrg	;;
467295b296d0Smrg
467339713583Smrg      -static | -static-libtool-libs)
467439713583Smrg	# The effects of -static are defined in a previous loop.
467539713583Smrg	# We used to do the same as -all-static on platforms that
467639713583Smrg	# didn't have a PIC flag, but the assumption that the effects
467739713583Smrg	# would be equivalent was wrong.  It would break on at least
467839713583Smrg	# Digital Unix and AIX.
467939713583Smrg	continue
468039713583Smrg	;;
468195b296d0Smrg
468239713583Smrg      -thread-safe)
468339713583Smrg	thread_safe=yes
468439713583Smrg	continue
468539713583Smrg	;;
468695b296d0Smrg
468739713583Smrg      -version-info)
468839713583Smrg	prev=vinfo
468939713583Smrg	continue
469039713583Smrg	;;
469195b296d0Smrg
469239713583Smrg      -version-number)
469339713583Smrg	prev=vinfo
469439713583Smrg	vinfo_number=yes
469539713583Smrg	continue
469639713583Smrg	;;
469795b296d0Smrg
469839713583Smrg      -weak)
469939713583Smrg        prev=weak
470039713583Smrg	continue
470139713583Smrg	;;
470295b296d0Smrg
470339713583Smrg      -Wc,*)
470439713583Smrg	func_stripname '-Wc,' '' "$arg"
470539713583Smrg	args=$func_stripname_result
470639713583Smrg	arg=
470739713583Smrg	save_ifs="$IFS"; IFS=','
470839713583Smrg	for flag in $args; do
470939713583Smrg	  IFS="$save_ifs"
471039713583Smrg          func_quote_for_eval "$flag"
471139713583Smrg	  arg="$arg $wl$func_quote_for_eval_result"
471239713583Smrg	  compiler_flags="$compiler_flags $func_quote_for_eval_result"
471339713583Smrg	done
471439713583Smrg	IFS="$save_ifs"
471539713583Smrg	func_stripname ' ' '' "$arg"
471639713583Smrg	arg=$func_stripname_result
471739713583Smrg	;;
471895b296d0Smrg
471939713583Smrg      -Wl,*)
472039713583Smrg	func_stripname '-Wl,' '' "$arg"
472139713583Smrg	args=$func_stripname_result
472239713583Smrg	arg=
472339713583Smrg	save_ifs="$IFS"; IFS=','
472439713583Smrg	for flag in $args; do
472539713583Smrg	  IFS="$save_ifs"
472639713583Smrg          func_quote_for_eval "$flag"
472739713583Smrg	  arg="$arg $wl$func_quote_for_eval_result"
472839713583Smrg	  compiler_flags="$compiler_flags $wl$func_quote_for_eval_result"
472939713583Smrg	  linker_flags="$linker_flags $func_quote_for_eval_result"
473039713583Smrg	done
473139713583Smrg	IFS="$save_ifs"
473239713583Smrg	func_stripname ' ' '' "$arg"
473339713583Smrg	arg=$func_stripname_result
473439713583Smrg	;;
473595b296d0Smrg
473639713583Smrg      -Xcompiler)
473739713583Smrg	prev=xcompiler
473839713583Smrg	continue
473939713583Smrg	;;
474095b296d0Smrg
474139713583Smrg      -Xlinker)
474239713583Smrg	prev=xlinker
474339713583Smrg	continue
474439713583Smrg	;;
474595b296d0Smrg
474639713583Smrg      -XCClinker)
474739713583Smrg	prev=xcclinker
474839713583Smrg	continue
474939713583Smrg	;;
475095b296d0Smrg
475139713583Smrg      # -msg_* for osf cc
475239713583Smrg      -msg_*)
475339713583Smrg	func_quote_for_eval "$arg"
475439713583Smrg	arg="$func_quote_for_eval_result"
475539713583Smrg	;;
475695b296d0Smrg
475739713583Smrg      # -64, -mips[0-9] enable 64-bit mode on the SGI compiler
475839713583Smrg      # -r[0-9][0-9]* specifies the processor on the SGI compiler
475939713583Smrg      # -xarch=*, -xtarget=* enable 64-bit mode on the Sun compiler
476039713583Smrg      # +DA*, +DD* enable 64-bit mode on the HP compiler
476139713583Smrg      # -q* pass through compiler args for the IBM compiler
476239713583Smrg      # -m*, -t[45]*, -txscale* pass through architecture-specific
476339713583Smrg      # compiler args for GCC
476439713583Smrg      # -F/path gives path to uninstalled frameworks, gcc on darwin
476539713583Smrg      # -p, -pg, --coverage, -fprofile-* pass through profiling flag for GCC
476639713583Smrg      # @file GCC response files
476739713583Smrg      -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \
476839713583Smrg      -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*)
476939713583Smrg        func_quote_for_eval "$arg"
477039713583Smrg	arg="$func_quote_for_eval_result"
477139713583Smrg        func_append compile_command " $arg"
477239713583Smrg        func_append finalize_command " $arg"
477339713583Smrg        compiler_flags="$compiler_flags $arg"
477439713583Smrg        continue
477539713583Smrg        ;;
477695b296d0Smrg
477739713583Smrg      # Some other compiler flag.
477839713583Smrg      -* | +*)
477939713583Smrg        func_quote_for_eval "$arg"
478039713583Smrg	arg="$func_quote_for_eval_result"
478139713583Smrg	;;
478295b296d0Smrg
478339713583Smrg      *.$objext)
478439713583Smrg	# A standard object.
478539713583Smrg	objs="$objs $arg"
478639713583Smrg	;;
478795b296d0Smrg
478839713583Smrg      *.lo)
478939713583Smrg	# A libtool-controlled object.
479095b296d0Smrg
479139713583Smrg	# Check to see that this really is a libtool object.
479239713583Smrg	if func_lalib_unsafe_p "$arg"; then
479339713583Smrg	  pic_object=
479439713583Smrg	  non_pic_object=
479595b296d0Smrg
479639713583Smrg	  # Read the .lo file
479739713583Smrg	  func_source "$arg"
479895b296d0Smrg
479939713583Smrg	  if test -z "$pic_object" ||
480039713583Smrg	     test -z "$non_pic_object" ||
480139713583Smrg	     test "$pic_object" = none &&
480239713583Smrg	     test "$non_pic_object" = none; then
480339713583Smrg	    func_fatal_error "cannot find name of object for \`$arg'"
480439713583Smrg	  fi
480595b296d0Smrg
480639713583Smrg	  # Extract subdirectory from the argument.
480739713583Smrg	  func_dirname "$arg" "/" ""
480839713583Smrg	  xdir="$func_dirname_result"
4809ff89ac2bSmrg
481039713583Smrg	  if test "$pic_object" != none; then
481139713583Smrg	    # Prepend the subdirectory the object is found in.
481239713583Smrg	    pic_object="$xdir$pic_object"
481395b296d0Smrg
481439713583Smrg	    if test "$prev" = dlfiles; then
481539713583Smrg	      if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
481639713583Smrg		dlfiles="$dlfiles $pic_object"
481739713583Smrg		prev=
481839713583Smrg		continue
481939713583Smrg	      else
482039713583Smrg		# If libtool objects are unsupported, then we need to preload.
482139713583Smrg		prev=dlprefiles
482239713583Smrg	      fi
482339713583Smrg	    fi
482495b296d0Smrg
482539713583Smrg	    # CHECK ME:  I think I busted this.  -Ossama
482639713583Smrg	    if test "$prev" = dlprefiles; then
482739713583Smrg	      # Preload the old-style object.
482839713583Smrg	      dlprefiles="$dlprefiles $pic_object"
482939713583Smrg	      prev=
483039713583Smrg	    fi
483195b296d0Smrg
483239713583Smrg	    # A PIC object.
483339713583Smrg	    func_append libobjs " $pic_object"
483439713583Smrg	    arg="$pic_object"
483539713583Smrg	  fi
483695b296d0Smrg
483739713583Smrg	  # Non-PIC object.
483839713583Smrg	  if test "$non_pic_object" != none; then
483939713583Smrg	    # Prepend the subdirectory the object is found in.
484039713583Smrg	    non_pic_object="$xdir$non_pic_object"
484195b296d0Smrg
484239713583Smrg	    # A standard non-PIC object
484339713583Smrg	    func_append non_pic_objects " $non_pic_object"
484439713583Smrg	    if test -z "$pic_object" || test "$pic_object" = none ; then
484539713583Smrg	      arg="$non_pic_object"
484639713583Smrg	    fi
484739713583Smrg	  else
484839713583Smrg	    # If the PIC object exists, use it instead.
484939713583Smrg	    # $xdir was prepended to $pic_object above.
485039713583Smrg	    non_pic_object="$pic_object"
485139713583Smrg	    func_append non_pic_objects " $non_pic_object"
485239713583Smrg	  fi
485339713583Smrg	else
485439713583Smrg	  # Only an error if not doing a dry-run.
485539713583Smrg	  if $opt_dry_run; then
485639713583Smrg	    # Extract subdirectory from the argument.
485739713583Smrg	    func_dirname "$arg" "/" ""
485839713583Smrg	    xdir="$func_dirname_result"
485939713583Smrg
486039713583Smrg	    func_lo2o "$arg"
486139713583Smrg	    pic_object=$xdir$objdir/$func_lo2o_result
486239713583Smrg	    non_pic_object=$xdir$func_lo2o_result
486339713583Smrg	    func_append libobjs " $pic_object"
486439713583Smrg	    func_append non_pic_objects " $non_pic_object"
486539713583Smrg	  else
486639713583Smrg	    func_fatal_error "\`$arg' is not a valid libtool object"
486739713583Smrg	  fi
486839713583Smrg	fi
486939713583Smrg	;;
487095b296d0Smrg
487139713583Smrg      *.$libext)
487239713583Smrg	# An archive.
487339713583Smrg	deplibs="$deplibs $arg"
487439713583Smrg	old_deplibs="$old_deplibs $arg"
487539713583Smrg	continue
487639713583Smrg	;;
487739713583Smrg
487839713583Smrg      *.la)
487939713583Smrg	# A libtool-controlled library.
488039713583Smrg
488139713583Smrg	if test "$prev" = dlfiles; then
488239713583Smrg	  # This library was specified with -dlopen.
488339713583Smrg	  dlfiles="$dlfiles $arg"
488439713583Smrg	  prev=
488539713583Smrg	elif test "$prev" = dlprefiles; then
488639713583Smrg	  # The library was specified with -dlpreopen.
488739713583Smrg	  dlprefiles="$dlprefiles $arg"
488839713583Smrg	  prev=
488939713583Smrg	else
489039713583Smrg	  deplibs="$deplibs $arg"
489139713583Smrg	fi
489239713583Smrg	continue
489339713583Smrg	;;
489439713583Smrg
489539713583Smrg      # Some other compiler argument.
489639713583Smrg      *)
489739713583Smrg	# Unknown arguments in both finalize_command and compile_command need
489839713583Smrg	# to be aesthetically quoted because they are evaled later.
489939713583Smrg	func_quote_for_eval "$arg"
490039713583Smrg	arg="$func_quote_for_eval_result"
490139713583Smrg	;;
490239713583Smrg      esac # arg
490339713583Smrg
490439713583Smrg      # Now actually substitute the argument into the commands.
490539713583Smrg      if test -n "$arg"; then
490639713583Smrg	func_append compile_command " $arg"
490739713583Smrg	func_append finalize_command " $arg"
490839713583Smrg      fi
490939713583Smrg    done # argument parsing loop
491039713583Smrg
491139713583Smrg    test -n "$prev" && \
491239713583Smrg      func_fatal_help "the \`$prevarg' option requires an argument"
491339713583Smrg
491439713583Smrg    if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then
491539713583Smrg      eval arg=\"$export_dynamic_flag_spec\"
491639713583Smrg      func_append compile_command " $arg"
491739713583Smrg      func_append finalize_command " $arg"
491839713583Smrg    fi
491939713583Smrg
492039713583Smrg    oldlibs=
492139713583Smrg    # calculate the name of the file, without its directory
492239713583Smrg    func_basename "$output"
492339713583Smrg    outputname="$func_basename_result"
492439713583Smrg    libobjs_save="$libobjs"
492539713583Smrg
492639713583Smrg    if test -n "$shlibpath_var"; then
492739713583Smrg      # get the directories listed in $shlibpath_var
492839713583Smrg      eval shlib_search_path=\`\$ECHO \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\`
492939713583Smrg    else
493039713583Smrg      shlib_search_path=
493139713583Smrg    fi
493239713583Smrg    eval sys_lib_search_path=\"$sys_lib_search_path_spec\"
493339713583Smrg    eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\"
493439713583Smrg
493539713583Smrg    func_dirname "$output" "/" ""
493639713583Smrg    output_objdir="$func_dirname_result$objdir"
493739713583Smrg    # Create the object directory.
493839713583Smrg    func_mkdir_p "$output_objdir"
493939713583Smrg
494039713583Smrg    # Determine the type of output
494139713583Smrg    case $output in
494239713583Smrg    "")
494339713583Smrg      func_fatal_help "you must specify an output file"
494439713583Smrg      ;;
494539713583Smrg    *.$libext) linkmode=oldlib ;;
494639713583Smrg    *.lo | *.$objext) linkmode=obj ;;
494739713583Smrg    *.la) linkmode=lib ;;
494839713583Smrg    *) linkmode=prog ;; # Anything else should be a program.
494939713583Smrg    esac
495039713583Smrg
495139713583Smrg    specialdeplibs=
495239713583Smrg
495339713583Smrg    libs=
495439713583Smrg    # Find all interdependent deplibs by searching for libraries
495539713583Smrg    # that are linked more than once (e.g. -la -lb -la)
495639713583Smrg    for deplib in $deplibs; do
495739713583Smrg      if $opt_duplicate_deps ; then
495839713583Smrg	case "$libs " in
495939713583Smrg	*" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
496039713583Smrg	esac
496139713583Smrg      fi
496239713583Smrg      libs="$libs $deplib"
496339713583Smrg    done
496439713583Smrg
496539713583Smrg    if test "$linkmode" = lib; then
496639713583Smrg      libs="$predeps $libs $compiler_lib_search_path $postdeps"
496739713583Smrg
496839713583Smrg      # Compute libraries that are listed more than once in $predeps
496939713583Smrg      # $postdeps and mark them as special (i.e., whose duplicates are
497039713583Smrg      # not to be eliminated).
497139713583Smrg      pre_post_deps=
497239713583Smrg      if $opt_duplicate_compiler_generated_deps; then
497339713583Smrg	for pre_post_dep in $predeps $postdeps; do
497439713583Smrg	  case "$pre_post_deps " in
497539713583Smrg	  *" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;;
497639713583Smrg	  esac
497739713583Smrg	  pre_post_deps="$pre_post_deps $pre_post_dep"
497839713583Smrg	done
497939713583Smrg      fi
498039713583Smrg      pre_post_deps=
498139713583Smrg    fi
498239713583Smrg
498339713583Smrg    deplibs=
498439713583Smrg    newdependency_libs=
498539713583Smrg    newlib_search_path=
498639713583Smrg    need_relink=no # whether we're linking any uninstalled libtool libraries
498739713583Smrg    notinst_deplibs= # not-installed libtool libraries
498839713583Smrg    notinst_path= # paths that contain not-installed libtool libraries
498939713583Smrg
499039713583Smrg    case $linkmode in
499139713583Smrg    lib)
499239713583Smrg	passes="conv dlpreopen link"
499339713583Smrg	for file in $dlfiles $dlprefiles; do
499439713583Smrg	  case $file in
499539713583Smrg	  *.la) ;;
499639713583Smrg	  *)
499739713583Smrg	    func_fatal_help "libraries can \`-dlopen' only libtool libraries: $file"
499839713583Smrg	    ;;
499939713583Smrg	  esac
500039713583Smrg	done
500139713583Smrg	;;
500239713583Smrg    prog)
500339713583Smrg	compile_deplibs=
500439713583Smrg	finalize_deplibs=
500539713583Smrg	alldeplibs=no
500639713583Smrg	newdlfiles=
500739713583Smrg	newdlprefiles=
500839713583Smrg	passes="conv scan dlopen dlpreopen link"
500939713583Smrg	;;
501039713583Smrg    *)  passes="conv"
501139713583Smrg	;;
501239713583Smrg    esac
501339713583Smrg
501439713583Smrg    for pass in $passes; do
501539713583Smrg      # The preopen pass in lib mode reverses $deplibs; put it back here
501639713583Smrg      # so that -L comes before libs that need it for instance...
501739713583Smrg      if test "$linkmode,$pass" = "lib,link"; then
501839713583Smrg	## FIXME: Find the place where the list is rebuilt in the wrong
501939713583Smrg	##        order, and fix it there properly
502039713583Smrg        tmp_deplibs=
502139713583Smrg	for deplib in $deplibs; do
502239713583Smrg	  tmp_deplibs="$deplib $tmp_deplibs"
502339713583Smrg	done
502439713583Smrg	deplibs="$tmp_deplibs"
502539713583Smrg      fi
502639713583Smrg
502739713583Smrg      if test "$linkmode,$pass" = "lib,link" ||
502839713583Smrg	 test "$linkmode,$pass" = "prog,scan"; then
502939713583Smrg	libs="$deplibs"
503039713583Smrg	deplibs=
503139713583Smrg      fi
503239713583Smrg      if test "$linkmode" = prog; then
503339713583Smrg	case $pass in
503439713583Smrg	dlopen) libs="$dlfiles" ;;
503539713583Smrg	dlpreopen) libs="$dlprefiles" ;;
503639713583Smrg	link) libs="$deplibs %DEPLIBS% $dependency_libs" ;;
503739713583Smrg	esac
503839713583Smrg      fi
503939713583Smrg      if test "$linkmode,$pass" = "lib,dlpreopen"; then
504039713583Smrg	# Collect and forward deplibs of preopened libtool libs
504139713583Smrg	for lib in $dlprefiles; do
504239713583Smrg	  # Ignore non-libtool-libs
504339713583Smrg	  dependency_libs=
504439713583Smrg	  case $lib in
504539713583Smrg	  *.la)	func_source "$lib" ;;
504639713583Smrg	  esac
504739713583Smrg
504839713583Smrg	  # Collect preopened libtool deplibs, except any this library
504939713583Smrg	  # has declared as weak libs
505039713583Smrg	  for deplib in $dependency_libs; do
505139713583Smrg            deplib_base=`$ECHO "X$deplib" | $Xsed -e "$basename"`
505239713583Smrg	    case " $weak_libs " in
505339713583Smrg	    *" $deplib_base "*) ;;
505439713583Smrg	    *) deplibs="$deplibs $deplib" ;;
505539713583Smrg	    esac
505639713583Smrg	  done
505739713583Smrg	done
505839713583Smrg	libs="$dlprefiles"
505939713583Smrg      fi
506039713583Smrg      if test "$pass" = dlopen; then
506139713583Smrg	# Collect dlpreopened libraries
506239713583Smrg	save_deplibs="$deplibs"
506339713583Smrg	deplibs=
506439713583Smrg      fi
506539713583Smrg
506639713583Smrg      for deplib in $libs; do
506739713583Smrg	lib=
506839713583Smrg	found=no
506939713583Smrg	case $deplib in
507039713583Smrg	-mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads)
507139713583Smrg	  if test "$linkmode,$pass" = "prog,link"; then
507239713583Smrg	    compile_deplibs="$deplib $compile_deplibs"
507339713583Smrg	    finalize_deplibs="$deplib $finalize_deplibs"
507439713583Smrg	  else
507539713583Smrg	    compiler_flags="$compiler_flags $deplib"
507639713583Smrg	    if test "$linkmode" = lib ; then
507739713583Smrg		case "$new_inherited_linker_flags " in
507839713583Smrg		    *" $deplib "*) ;;
507939713583Smrg		    * ) new_inherited_linker_flags="$new_inherited_linker_flags $deplib" ;;
508039713583Smrg		esac
508139713583Smrg	    fi
508239713583Smrg	  fi
508339713583Smrg	  continue
508439713583Smrg	  ;;
508539713583Smrg	-l*)
508639713583Smrg	  if test "$linkmode" != lib && test "$linkmode" != prog; then
508739713583Smrg	    func_warning "\`-l' is ignored for archives/objects"
508839713583Smrg	    continue
508939713583Smrg	  fi
509039713583Smrg	  func_stripname '-l' '' "$deplib"
509139713583Smrg	  name=$func_stripname_result
509239713583Smrg	  if test "$linkmode" = lib; then
509339713583Smrg	    searchdirs="$newlib_search_path $lib_search_path $compiler_lib_search_dirs $sys_lib_search_path $shlib_search_path"
509439713583Smrg	  else
509539713583Smrg	    searchdirs="$newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path"
509639713583Smrg	  fi
509739713583Smrg	  for searchdir in $searchdirs; do
509839713583Smrg	    for search_ext in .la $std_shrext .so .a; do
509939713583Smrg	      # Search the libtool library
510039713583Smrg	      lib="$searchdir/lib${name}${search_ext}"
510139713583Smrg	      if test -f "$lib"; then
510239713583Smrg		if test "$search_ext" = ".la"; then
510339713583Smrg		  found=yes
510439713583Smrg		else
510539713583Smrg		  found=no
510639713583Smrg		fi
510739713583Smrg		break 2
510839713583Smrg	      fi
510939713583Smrg	    done
511039713583Smrg	  done
511139713583Smrg	  if test "$found" != yes; then
511239713583Smrg	    # deplib doesn't seem to be a libtool library
511339713583Smrg	    if test "$linkmode,$pass" = "prog,link"; then
511439713583Smrg	      compile_deplibs="$deplib $compile_deplibs"
511539713583Smrg	      finalize_deplibs="$deplib $finalize_deplibs"
511639713583Smrg	    else
511739713583Smrg	      deplibs="$deplib $deplibs"
511839713583Smrg	      test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
511939713583Smrg	    fi
512039713583Smrg	    continue
512139713583Smrg	  else # deplib is a libtool library
512239713583Smrg	    # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib,
512339713583Smrg	    # We need to do some special things here, and not later.
512439713583Smrg	    if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
512539713583Smrg	      case " $predeps $postdeps " in
512639713583Smrg	      *" $deplib "*)
512739713583Smrg		if func_lalib_p "$lib"; then
512839713583Smrg		  library_names=
512939713583Smrg		  old_library=
513039713583Smrg		  func_source "$lib"
513139713583Smrg		  for l in $old_library $library_names; do
513239713583Smrg		    ll="$l"
513339713583Smrg		  done
513439713583Smrg		  if test "X$ll" = "X$old_library" ; then # only static version available
513539713583Smrg		    found=no
513639713583Smrg		    func_dirname "$lib" "" "."
513739713583Smrg		    ladir="$func_dirname_result"
513839713583Smrg		    lib=$ladir/$old_library
513939713583Smrg		    if test "$linkmode,$pass" = "prog,link"; then
514039713583Smrg		      compile_deplibs="$deplib $compile_deplibs"
514139713583Smrg		      finalize_deplibs="$deplib $finalize_deplibs"
514239713583Smrg		    else
514339713583Smrg		      deplibs="$deplib $deplibs"
514439713583Smrg		      test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
514539713583Smrg		    fi
514639713583Smrg		    continue
514739713583Smrg		  fi
514839713583Smrg		fi
514939713583Smrg		;;
515039713583Smrg	      *) ;;
515139713583Smrg	      esac
515239713583Smrg	    fi
515339713583Smrg	  fi
515439713583Smrg	  ;; # -l
515539713583Smrg	*.ltframework)
515639713583Smrg	  if test "$linkmode,$pass" = "prog,link"; then
515739713583Smrg	    compile_deplibs="$deplib $compile_deplibs"
515839713583Smrg	    finalize_deplibs="$deplib $finalize_deplibs"
515939713583Smrg	  else
516039713583Smrg	    deplibs="$deplib $deplibs"
516139713583Smrg	    if test "$linkmode" = lib ; then
516239713583Smrg		case "$new_inherited_linker_flags " in
516339713583Smrg		    *" $deplib "*) ;;
516439713583Smrg		    * ) new_inherited_linker_flags="$new_inherited_linker_flags $deplib" ;;
516539713583Smrg		esac
516639713583Smrg	    fi
516739713583Smrg	  fi
516839713583Smrg	  continue
516939713583Smrg	  ;;
517039713583Smrg	-L*)
517139713583Smrg	  case $linkmode in
517239713583Smrg	  lib)
517339713583Smrg	    deplibs="$deplib $deplibs"
517439713583Smrg	    test "$pass" = conv && continue
517539713583Smrg	    newdependency_libs="$deplib $newdependency_libs"
517639713583Smrg	    func_stripname '-L' '' "$deplib"
517739713583Smrg	    newlib_search_path="$newlib_search_path $func_stripname_result"
517839713583Smrg	    ;;
517939713583Smrg	  prog)
518039713583Smrg	    if test "$pass" = conv; then
518139713583Smrg	      deplibs="$deplib $deplibs"
518239713583Smrg	      continue
518339713583Smrg	    fi
518439713583Smrg	    if test "$pass" = scan; then
518539713583Smrg	      deplibs="$deplib $deplibs"
518639713583Smrg	    else
518739713583Smrg	      compile_deplibs="$deplib $compile_deplibs"
518839713583Smrg	      finalize_deplibs="$deplib $finalize_deplibs"
518939713583Smrg	    fi
519039713583Smrg	    func_stripname '-L' '' "$deplib"
519139713583Smrg	    newlib_search_path="$newlib_search_path $func_stripname_result"
519239713583Smrg	    ;;
519339713583Smrg	  *)
519439713583Smrg	    func_warning "\`-L' is ignored for archives/objects"
519539713583Smrg	    ;;
519639713583Smrg	  esac # linkmode
519739713583Smrg	  continue
519839713583Smrg	  ;; # -L
519939713583Smrg	-R*)
520039713583Smrg	  if test "$pass" = link; then
520139713583Smrg	    func_stripname '-R' '' "$deplib"
520239713583Smrg	    dir=$func_stripname_result
520339713583Smrg	    # Make sure the xrpath contains only unique directories.
520439713583Smrg	    case "$xrpath " in
520539713583Smrg	    *" $dir "*) ;;
520639713583Smrg	    *) xrpath="$xrpath $dir" ;;
520739713583Smrg	    esac
520839713583Smrg	  fi
520939713583Smrg	  deplibs="$deplib $deplibs"
521039713583Smrg	  continue
521139713583Smrg	  ;;
521239713583Smrg	*.la) lib="$deplib" ;;
521339713583Smrg	*.$libext)
521439713583Smrg	  if test "$pass" = conv; then
521539713583Smrg	    deplibs="$deplib $deplibs"
521639713583Smrg	    continue
521739713583Smrg	  fi
521839713583Smrg	  case $linkmode in
521939713583Smrg	  lib)
522039713583Smrg	    # Linking convenience modules into shared libraries is allowed,
522139713583Smrg	    # but linking other static libraries is non-portable.
522239713583Smrg	    case " $dlpreconveniencelibs " in
522339713583Smrg	    *" $deplib "*) ;;
522439713583Smrg	    *)
522539713583Smrg	      valid_a_lib=no
522639713583Smrg	      case $deplibs_check_method in
522739713583Smrg		match_pattern*)
522839713583Smrg		  set dummy $deplibs_check_method; shift
522939713583Smrg		  match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
523039713583Smrg		  if eval "\$ECHO \"X$deplib\"" 2>/dev/null | $Xsed -e 10q \
523139713583Smrg		    | $EGREP "$match_pattern_regex" > /dev/null; then
523239713583Smrg		    valid_a_lib=yes
523339713583Smrg		  fi
523439713583Smrg		;;
523539713583Smrg		pass_all)
523639713583Smrg		  valid_a_lib=yes
523739713583Smrg		;;
523839713583Smrg	      esac
523939713583Smrg	      if test "$valid_a_lib" != yes; then
524039713583Smrg		$ECHO
524139713583Smrg		$ECHO "*** Warning: Trying to link with static lib archive $deplib."
524239713583Smrg		$ECHO "*** I have the capability to make that library automatically link in when"
524339713583Smrg		$ECHO "*** you link to this library.  But I can only do this if you have a"
524439713583Smrg		$ECHO "*** shared version of the library, which you do not appear to have"
524539713583Smrg		$ECHO "*** because the file extensions .$libext of this argument makes me believe"
524639713583Smrg		$ECHO "*** that it is just a static archive that I should not use here."
524739713583Smrg	      else
524839713583Smrg		$ECHO
524939713583Smrg		$ECHO "*** Warning: Linking the shared library $output against the"
525039713583Smrg		$ECHO "*** static library $deplib is not portable!"
525139713583Smrg		deplibs="$deplib $deplibs"
525239713583Smrg	      fi
525339713583Smrg	      ;;
525439713583Smrg	    esac
525539713583Smrg	    continue
525639713583Smrg	    ;;
525739713583Smrg	  prog)
525839713583Smrg	    if test "$pass" != link; then
525939713583Smrg	      deplibs="$deplib $deplibs"
526039713583Smrg	    else
526139713583Smrg	      compile_deplibs="$deplib $compile_deplibs"
526239713583Smrg	      finalize_deplibs="$deplib $finalize_deplibs"
526339713583Smrg	    fi
526439713583Smrg	    continue
526539713583Smrg	    ;;
526639713583Smrg	  esac # linkmode
526739713583Smrg	  ;; # *.$libext
526839713583Smrg	*.lo | *.$objext)
526939713583Smrg	  if test "$pass" = conv; then
527039713583Smrg	    deplibs="$deplib $deplibs"
527139713583Smrg	  elif test "$linkmode" = prog; then
527239713583Smrg	    if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
527339713583Smrg	      # If there is no dlopen support or we're linking statically,
527439713583Smrg	      # we need to preload.
527539713583Smrg	      newdlprefiles="$newdlprefiles $deplib"
527639713583Smrg	      compile_deplibs="$deplib $compile_deplibs"
527739713583Smrg	      finalize_deplibs="$deplib $finalize_deplibs"
527839713583Smrg	    else
527939713583Smrg	      newdlfiles="$newdlfiles $deplib"
528039713583Smrg	    fi
528139713583Smrg	  fi
528239713583Smrg	  continue
528339713583Smrg	  ;;
528439713583Smrg	%DEPLIBS%)
528539713583Smrg	  alldeplibs=yes
528639713583Smrg	  continue
528739713583Smrg	  ;;
528839713583Smrg	esac # case $deplib
528939713583Smrg
529039713583Smrg	if test "$found" = yes || test -f "$lib"; then :
529139713583Smrg	else
529239713583Smrg	  func_fatal_error "cannot find the library \`$lib' or unhandled argument \`$deplib'"
529339713583Smrg	fi
529439713583Smrg
529539713583Smrg	# Check to see that this really is a libtool archive.
529639713583Smrg	func_lalib_unsafe_p "$lib" \
529739713583Smrg	  || func_fatal_error "\`$lib' is not a valid libtool archive"
529839713583Smrg
529939713583Smrg	func_dirname "$lib" "" "."
530039713583Smrg	ladir="$func_dirname_result"
530139713583Smrg
530239713583Smrg	dlname=
530339713583Smrg	dlopen=
530439713583Smrg	dlpreopen=
530539713583Smrg	libdir=
530639713583Smrg	library_names=
530739713583Smrg	old_library=
530839713583Smrg	inherited_linker_flags=
530939713583Smrg	# If the library was installed with an old release of libtool,
531039713583Smrg	# it will not redefine variables installed, or shouldnotlink
531139713583Smrg	installed=yes
531239713583Smrg	shouldnotlink=no
531339713583Smrg	avoidtemprpath=
531439713583Smrg
531539713583Smrg
531639713583Smrg	# Read the .la file
531739713583Smrg	func_source "$lib"
531839713583Smrg
531939713583Smrg	# Convert "-framework foo" to "foo.ltframework"
532039713583Smrg	if test -n "$inherited_linker_flags"; then
532139713583Smrg	  tmp_inherited_linker_flags=`$ECHO "X$inherited_linker_flags" | $Xsed -e 's/-framework \([^ $]*\)/\1.ltframework/g'`
532239713583Smrg	  for tmp_inherited_linker_flag in $tmp_inherited_linker_flags; do
532339713583Smrg	    case " $new_inherited_linker_flags " in
532439713583Smrg	      *" $tmp_inherited_linker_flag "*) ;;
532539713583Smrg	      *) new_inherited_linker_flags="$new_inherited_linker_flags $tmp_inherited_linker_flag";;
532639713583Smrg	    esac
532739713583Smrg	  done
532839713583Smrg	fi
532939713583Smrg	dependency_libs=`$ECHO "X $dependency_libs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'`
533039713583Smrg	if test "$linkmode,$pass" = "lib,link" ||
533139713583Smrg	   test "$linkmode,$pass" = "prog,scan" ||
533239713583Smrg	   { test "$linkmode" != prog && test "$linkmode" != lib; }; then
533339713583Smrg	  test -n "$dlopen" && dlfiles="$dlfiles $dlopen"
533439713583Smrg	  test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen"
533539713583Smrg	fi
533639713583Smrg
533739713583Smrg	if test "$pass" = conv; then
533839713583Smrg	  # Only check for convenience libraries
533939713583Smrg	  deplibs="$lib $deplibs"
534039713583Smrg	  if test -z "$libdir"; then
534139713583Smrg	    if test -z "$old_library"; then
534239713583Smrg	      func_fatal_error "cannot find name of link library for \`$lib'"
534339713583Smrg	    fi
534439713583Smrg	    # It is a libtool convenience library, so add in its objects.
534539713583Smrg	    convenience="$convenience $ladir/$objdir/$old_library"
534639713583Smrg	    old_convenience="$old_convenience $ladir/$objdir/$old_library"
534739713583Smrg	  elif test "$linkmode" != prog && test "$linkmode" != lib; then
534839713583Smrg	    func_fatal_error "\`$lib' is not a convenience library"
534939713583Smrg	  fi
535039713583Smrg	  tmp_libs=
535139713583Smrg	  for deplib in $dependency_libs; do
535239713583Smrg	    deplibs="$deplib $deplibs"
535339713583Smrg	    if $opt_duplicate_deps ; then
535439713583Smrg	      case "$tmp_libs " in
535539713583Smrg	      *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
535639713583Smrg	      esac
535739713583Smrg	    fi
535839713583Smrg	    tmp_libs="$tmp_libs $deplib"
535939713583Smrg	  done
536039713583Smrg	  continue
536139713583Smrg	fi # $pass = conv
536239713583Smrg
536339713583Smrg
536439713583Smrg	# Get the name of the library we link against.
536539713583Smrg	linklib=
536639713583Smrg	for l in $old_library $library_names; do
536739713583Smrg	  linklib="$l"
536839713583Smrg	done
536939713583Smrg	if test -z "$linklib"; then
537039713583Smrg	  func_fatal_error "cannot find name of link library for \`$lib'"
537139713583Smrg	fi
537239713583Smrg
537339713583Smrg	# This library was specified with -dlopen.
537439713583Smrg	if test "$pass" = dlopen; then
537539713583Smrg	  if test -z "$libdir"; then
537639713583Smrg	    func_fatal_error "cannot -dlopen a convenience library: \`$lib'"
537739713583Smrg	  fi
537839713583Smrg	  if test -z "$dlname" ||
537939713583Smrg	     test "$dlopen_support" != yes ||
538039713583Smrg	     test "$build_libtool_libs" = no; then
538139713583Smrg	    # If there is no dlname, no dlopen support or we're linking
538239713583Smrg	    # statically, we need to preload.  We also need to preload any
538339713583Smrg	    # dependent libraries so libltdl's deplib preloader doesn't
538439713583Smrg	    # bomb out in the load deplibs phase.
538539713583Smrg	    dlprefiles="$dlprefiles $lib $dependency_libs"
538639713583Smrg	  else
538739713583Smrg	    newdlfiles="$newdlfiles $lib"
538839713583Smrg	  fi
538939713583Smrg	  continue
539039713583Smrg	fi # $pass = dlopen
539139713583Smrg
539239713583Smrg	# We need an absolute path.
539339713583Smrg	case $ladir in
539439713583Smrg	[\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;;
539539713583Smrg	*)
539639713583Smrg	  abs_ladir=`cd "$ladir" && pwd`
539739713583Smrg	  if test -z "$abs_ladir"; then
539839713583Smrg	    func_warning "cannot determine absolute directory name of \`$ladir'"
539939713583Smrg	    func_warning "passing it literally to the linker, although it might fail"
540039713583Smrg	    abs_ladir="$ladir"
540139713583Smrg	  fi
540239713583Smrg	  ;;
540339713583Smrg	esac
540439713583Smrg	func_basename "$lib"
540539713583Smrg	laname="$func_basename_result"
540639713583Smrg
540739713583Smrg	# Find the relevant object directory and library name.
540839713583Smrg	if test "X$installed" = Xyes; then
540939713583Smrg	  if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then
541039713583Smrg	    func_warning "library \`$lib' was moved."
541139713583Smrg	    dir="$ladir"
541239713583Smrg	    absdir="$abs_ladir"
541339713583Smrg	    libdir="$abs_ladir"
541439713583Smrg	  else
541539713583Smrg	    dir="$libdir"
541639713583Smrg	    absdir="$libdir"
541739713583Smrg	  fi
541839713583Smrg	  test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes
541939713583Smrg	else
542039713583Smrg	  if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then
542139713583Smrg	    dir="$ladir"
542239713583Smrg	    absdir="$abs_ladir"
542339713583Smrg	    # Remove this search path later
542439713583Smrg	    notinst_path="$notinst_path $abs_ladir"
542539713583Smrg	  else
542639713583Smrg	    dir="$ladir/$objdir"
542739713583Smrg	    absdir="$abs_ladir/$objdir"
542839713583Smrg	    # Remove this search path later
542939713583Smrg	    notinst_path="$notinst_path $abs_ladir"
543039713583Smrg	  fi
543139713583Smrg	fi # $installed = yes
543239713583Smrg	func_stripname 'lib' '.la' "$laname"
543339713583Smrg	name=$func_stripname_result
543439713583Smrg
543539713583Smrg	# This library was specified with -dlpreopen.
543639713583Smrg	if test "$pass" = dlpreopen; then
543739713583Smrg	  if test -z "$libdir" && test "$linkmode" = prog; then
543839713583Smrg	    func_fatal_error "only libraries may -dlpreopen a convenience library: \`$lib'"
543939713583Smrg	  fi
544039713583Smrg	  # Prefer using a static library (so that no silly _DYNAMIC symbols
544139713583Smrg	  # are required to link).
544239713583Smrg	  if test -n "$old_library"; then
544339713583Smrg	    newdlprefiles="$newdlprefiles $dir/$old_library"
544439713583Smrg	    # Keep a list of preopened convenience libraries to check
544539713583Smrg	    # that they are being used correctly in the link pass.
544639713583Smrg	    test -z "$libdir" && \
544739713583Smrg		dlpreconveniencelibs="$dlpreconveniencelibs $dir/$old_library"
544839713583Smrg	  # Otherwise, use the dlname, so that lt_dlopen finds it.
544939713583Smrg	  elif test -n "$dlname"; then
545039713583Smrg	    newdlprefiles="$newdlprefiles $dir/$dlname"
545139713583Smrg	  else
545239713583Smrg	    newdlprefiles="$newdlprefiles $dir/$linklib"
545339713583Smrg	  fi
545439713583Smrg	fi # $pass = dlpreopen
545539713583Smrg
545639713583Smrg	if test -z "$libdir"; then
545739713583Smrg	  # Link the convenience library
545839713583Smrg	  if test "$linkmode" = lib; then
545939713583Smrg	    deplibs="$dir/$old_library $deplibs"
546039713583Smrg	  elif test "$linkmode,$pass" = "prog,link"; then
546139713583Smrg	    compile_deplibs="$dir/$old_library $compile_deplibs"
546239713583Smrg	    finalize_deplibs="$dir/$old_library $finalize_deplibs"
546339713583Smrg	  else
546439713583Smrg	    deplibs="$lib $deplibs" # used for prog,scan pass
546539713583Smrg	  fi
546639713583Smrg	  continue
546739713583Smrg	fi
546839713583Smrg
546939713583Smrg
547039713583Smrg	if test "$linkmode" = prog && test "$pass" != link; then
547139713583Smrg	  newlib_search_path="$newlib_search_path $ladir"
547239713583Smrg	  deplibs="$lib $deplibs"
547339713583Smrg
547439713583Smrg	  linkalldeplibs=no
547539713583Smrg	  if test "$link_all_deplibs" != no || test -z "$library_names" ||
547639713583Smrg	     test "$build_libtool_libs" = no; then
547739713583Smrg	    linkalldeplibs=yes
547839713583Smrg	  fi
547939713583Smrg
548039713583Smrg	  tmp_libs=
548139713583Smrg	  for deplib in $dependency_libs; do
548239713583Smrg	    case $deplib in
548339713583Smrg	    -L*) func_stripname '-L' '' "$deplib"
548439713583Smrg	         newlib_search_path="$newlib_search_path $func_stripname_result"
548539713583Smrg		 ;;
548639713583Smrg	    esac
548739713583Smrg	    # Need to link against all dependency_libs?
548839713583Smrg	    if test "$linkalldeplibs" = yes; then
548939713583Smrg	      deplibs="$deplib $deplibs"
549039713583Smrg	    else
549139713583Smrg	      # Need to hardcode shared library paths
549239713583Smrg	      # or/and link against static libraries
549339713583Smrg	      newdependency_libs="$deplib $newdependency_libs"
549439713583Smrg	    fi
549539713583Smrg	    if $opt_duplicate_deps ; then
549639713583Smrg	      case "$tmp_libs " in
549739713583Smrg	      *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
549839713583Smrg	      esac
549939713583Smrg	    fi
550039713583Smrg	    tmp_libs="$tmp_libs $deplib"
550139713583Smrg	  done # for deplib
550239713583Smrg	  continue
550339713583Smrg	fi # $linkmode = prog...
550439713583Smrg
550539713583Smrg	if test "$linkmode,$pass" = "prog,link"; then
550639713583Smrg	  if test -n "$library_names" &&
550739713583Smrg	     { { test "$prefer_static_libs" = no ||
550839713583Smrg	         test "$prefer_static_libs,$installed" = "built,yes"; } ||
550939713583Smrg	       test -z "$old_library"; }; then
551039713583Smrg	    # We need to hardcode the library path
551139713583Smrg	    if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then
551239713583Smrg	      # Make sure the rpath contains only unique directories.
551339713583Smrg	      case "$temp_rpath:" in
551439713583Smrg	      *"$absdir:"*) ;;
551539713583Smrg	      *) temp_rpath="$temp_rpath$absdir:" ;;
551639713583Smrg	      esac
551739713583Smrg	    fi
551839713583Smrg
551939713583Smrg	    # Hardcode the library path.
552039713583Smrg	    # Skip directories that are in the system default run-time
552139713583Smrg	    # search path.
552239713583Smrg	    case " $sys_lib_dlsearch_path " in
552339713583Smrg	    *" $absdir "*) ;;
552439713583Smrg	    *)
552539713583Smrg	      case "$compile_rpath " in
552639713583Smrg	      *" $absdir "*) ;;
552739713583Smrg	      *) compile_rpath="$compile_rpath $absdir"
552839713583Smrg	      esac
552939713583Smrg	      ;;
553039713583Smrg	    esac
553139713583Smrg	    case " $sys_lib_dlsearch_path " in
553239713583Smrg	    *" $libdir "*) ;;
553339713583Smrg	    *)
553439713583Smrg	      case "$finalize_rpath " in
553539713583Smrg	      *" $libdir "*) ;;
553639713583Smrg	      *) finalize_rpath="$finalize_rpath $libdir"
553739713583Smrg	      esac
553839713583Smrg	      ;;
553939713583Smrg	    esac
554039713583Smrg	  fi # $linkmode,$pass = prog,link...
554139713583Smrg
554239713583Smrg	  if test "$alldeplibs" = yes &&
554339713583Smrg	     { test "$deplibs_check_method" = pass_all ||
554439713583Smrg	       { test "$build_libtool_libs" = yes &&
554539713583Smrg		 test -n "$library_names"; }; }; then
554639713583Smrg	    # We only need to search for static libraries
554739713583Smrg	    continue
554839713583Smrg	  fi
554939713583Smrg	fi
555039713583Smrg
555139713583Smrg	link_static=no # Whether the deplib will be linked statically
555239713583Smrg	use_static_libs=$prefer_static_libs
555339713583Smrg	if test "$use_static_libs" = built && test "$installed" = yes; then
555439713583Smrg	  use_static_libs=no
555539713583Smrg	fi
555639713583Smrg	if test -n "$library_names" &&
555739713583Smrg	   { test "$use_static_libs" = no || test -z "$old_library"; }; then
555839713583Smrg	  case $host in
555939713583Smrg	  *cygwin* | *mingw* | *cegcc*)
556039713583Smrg	      # No point in relinking DLLs because paths are not encoded
556139713583Smrg	      notinst_deplibs="$notinst_deplibs $lib"
556239713583Smrg	      need_relink=no
556339713583Smrg	    ;;
556439713583Smrg	  *)
556539713583Smrg	    if test "$installed" = no; then
556639713583Smrg	      notinst_deplibs="$notinst_deplibs $lib"
556739713583Smrg	      need_relink=yes
556839713583Smrg	    fi
556939713583Smrg	    ;;
557039713583Smrg	  esac
557139713583Smrg	  # This is a shared library
557239713583Smrg
557339713583Smrg	  # Warn about portability, can't link against -module's on some
557439713583Smrg	  # systems (darwin).  Don't bleat about dlopened modules though!
557539713583Smrg	  dlopenmodule=""
557639713583Smrg	  for dlpremoduletest in $dlprefiles; do
557739713583Smrg	    if test "X$dlpremoduletest" = "X$lib"; then
557839713583Smrg	      dlopenmodule="$dlpremoduletest"
557939713583Smrg	      break
558039713583Smrg	    fi
558139713583Smrg	  done
558239713583Smrg	  if test -z "$dlopenmodule" && test "$shouldnotlink" = yes && test "$pass" = link; then
558339713583Smrg	    $ECHO
558439713583Smrg	    if test "$linkmode" = prog; then
558539713583Smrg	      $ECHO "*** Warning: Linking the executable $output against the loadable module"
558639713583Smrg	    else
558739713583Smrg	      $ECHO "*** Warning: Linking the shared library $output against the loadable module"
558839713583Smrg	    fi
558939713583Smrg	    $ECHO "*** $linklib is not portable!"
559039713583Smrg	  fi
559139713583Smrg	  if test "$linkmode" = lib &&
559239713583Smrg	     test "$hardcode_into_libs" = yes; then
559339713583Smrg	    # Hardcode the library path.
559439713583Smrg	    # Skip directories that are in the system default run-time
559539713583Smrg	    # search path.
559639713583Smrg	    case " $sys_lib_dlsearch_path " in
559739713583Smrg	    *" $absdir "*) ;;
559839713583Smrg	    *)
559939713583Smrg	      case "$compile_rpath " in
560039713583Smrg	      *" $absdir "*) ;;
560139713583Smrg	      *) compile_rpath="$compile_rpath $absdir"
560239713583Smrg	      esac
560339713583Smrg	      ;;
560439713583Smrg	    esac
560539713583Smrg	    case " $sys_lib_dlsearch_path " in
560639713583Smrg	    *" $libdir "*) ;;
560739713583Smrg	    *)
560839713583Smrg	      case "$finalize_rpath " in
560939713583Smrg	      *" $libdir "*) ;;
561039713583Smrg	      *) finalize_rpath="$finalize_rpath $libdir"
561139713583Smrg	      esac
561239713583Smrg	      ;;
561339713583Smrg	    esac
561439713583Smrg	  fi
561539713583Smrg
561639713583Smrg	  if test -n "$old_archive_from_expsyms_cmds"; then
561739713583Smrg	    # figure out the soname
561839713583Smrg	    set dummy $library_names
561939713583Smrg	    shift
562039713583Smrg	    realname="$1"
562139713583Smrg	    shift
562239713583Smrg	    libname=`eval "\\$ECHO \"$libname_spec\""`
562339713583Smrg	    # use dlname if we got it. it's perfectly good, no?
562439713583Smrg	    if test -n "$dlname"; then
562539713583Smrg	      soname="$dlname"
562639713583Smrg	    elif test -n "$soname_spec"; then
562739713583Smrg	      # bleh windows
562839713583Smrg	      case $host in
562939713583Smrg	      *cygwin* | mingw* | *cegcc*)
563039713583Smrg	        func_arith $current - $age
563139713583Smrg		major=$func_arith_result
563239713583Smrg		versuffix="-$major"
563339713583Smrg		;;
563439713583Smrg	      esac
563539713583Smrg	      eval soname=\"$soname_spec\"
563639713583Smrg	    else
563739713583Smrg	      soname="$realname"
563839713583Smrg	    fi
563939713583Smrg
564039713583Smrg	    # Make a new name for the extract_expsyms_cmds to use
564139713583Smrg	    soroot="$soname"
564239713583Smrg	    func_basename "$soroot"
564339713583Smrg	    soname="$func_basename_result"
564439713583Smrg	    func_stripname 'lib' '.dll' "$soname"
564539713583Smrg	    newlib=libimp-$func_stripname_result.a
564639713583Smrg
564739713583Smrg	    # If the library has no export list, then create one now
564839713583Smrg	    if test -f "$output_objdir/$soname-def"; then :
564939713583Smrg	    else
565039713583Smrg	      func_verbose "extracting exported symbol list from \`$soname'"
565139713583Smrg	      func_execute_cmds "$extract_expsyms_cmds" 'exit $?'
565239713583Smrg	    fi
565339713583Smrg
565439713583Smrg	    # Create $newlib
565539713583Smrg	    if test -f "$output_objdir/$newlib"; then :; else
565639713583Smrg	      func_verbose "generating import library for \`$soname'"
565739713583Smrg	      func_execute_cmds "$old_archive_from_expsyms_cmds" 'exit $?'
565839713583Smrg	    fi
565939713583Smrg	    # make sure the library variables are pointing to the new library
566039713583Smrg	    dir=$output_objdir
566139713583Smrg	    linklib=$newlib
566239713583Smrg	  fi # test -n "$old_archive_from_expsyms_cmds"
566339713583Smrg
566439713583Smrg	  if test "$linkmode" = prog || test "$mode" != relink; then
566539713583Smrg	    add_shlibpath=
566639713583Smrg	    add_dir=
566739713583Smrg	    add=
566839713583Smrg	    lib_linked=yes
566939713583Smrg	    case $hardcode_action in
567039713583Smrg	    immediate | unsupported)
567139713583Smrg	      if test "$hardcode_direct" = no; then
567239713583Smrg		add="$dir/$linklib"
567339713583Smrg		case $host in
567439713583Smrg		  *-*-sco3.2v5.0.[024]*) add_dir="-L$dir" ;;
567539713583Smrg		  *-*-sysv4*uw2*) add_dir="-L$dir" ;;
567639713583Smrg		  *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \
567739713583Smrg		    *-*-unixware7*) add_dir="-L$dir" ;;
567839713583Smrg		  *-*-darwin* )
567939713583Smrg		    # if the lib is a (non-dlopened) module then we can not
568039713583Smrg		    # link against it, someone is ignoring the earlier warnings
568139713583Smrg		    if /usr/bin/file -L $add 2> /dev/null |
568239713583Smrg			 $GREP ": [^:]* bundle" >/dev/null ; then
568339713583Smrg		      if test "X$dlopenmodule" != "X$lib"; then
568439713583Smrg			$ECHO "*** Warning: lib $linklib is a module, not a shared library"
568539713583Smrg			if test -z "$old_library" ; then
568639713583Smrg			  $ECHO
568739713583Smrg			  $ECHO "*** And there doesn't seem to be a static archive available"
568839713583Smrg			  $ECHO "*** The link will probably fail, sorry"
568939713583Smrg			else
569039713583Smrg			  add="$dir/$old_library"
569139713583Smrg			fi
569239713583Smrg		      elif test -n "$old_library"; then
569339713583Smrg			add="$dir/$old_library"
569439713583Smrg		      fi
569539713583Smrg		    fi
569639713583Smrg		esac
569739713583Smrg	      elif test "$hardcode_minus_L" = no; then
569839713583Smrg		case $host in
569939713583Smrg		*-*-sunos*) add_shlibpath="$dir" ;;
570039713583Smrg		esac
570139713583Smrg		add_dir="-L$dir"
570239713583Smrg		add="-l$name"
570339713583Smrg	      elif test "$hardcode_shlibpath_var" = no; then
570439713583Smrg		add_shlibpath="$dir"
570539713583Smrg		add="-l$name"
570639713583Smrg	      else
570739713583Smrg		lib_linked=no
570839713583Smrg	      fi
570939713583Smrg	      ;;
571039713583Smrg	    relink)
571139713583Smrg	      if test "$hardcode_direct" = yes &&
571239713583Smrg	         test "$hardcode_direct_absolute" = no; then
571339713583Smrg		add="$dir/$linklib"
571439713583Smrg	      elif test "$hardcode_minus_L" = yes; then
571539713583Smrg		add_dir="-L$dir"
571639713583Smrg		# Try looking first in the location we're being installed to.
571739713583Smrg		if test -n "$inst_prefix_dir"; then
571839713583Smrg		  case $libdir in
571939713583Smrg		    [\\/]*)
572039713583Smrg		      add_dir="$add_dir -L$inst_prefix_dir$libdir"
572139713583Smrg		      ;;
572239713583Smrg		  esac
572339713583Smrg		fi
572439713583Smrg		add="-l$name"
572539713583Smrg	      elif test "$hardcode_shlibpath_var" = yes; then
572639713583Smrg		add_shlibpath="$dir"
572739713583Smrg		add="-l$name"
572839713583Smrg	      else
572939713583Smrg		lib_linked=no
573039713583Smrg	      fi
573139713583Smrg	      ;;
573239713583Smrg	    *) lib_linked=no ;;
573339713583Smrg	    esac
573439713583Smrg
573539713583Smrg	    if test "$lib_linked" != yes; then
573639713583Smrg	      func_fatal_configuration "unsupported hardcode properties"
573739713583Smrg	    fi
573839713583Smrg
573939713583Smrg	    if test -n "$add_shlibpath"; then
574039713583Smrg	      case :$compile_shlibpath: in
574139713583Smrg	      *":$add_shlibpath:"*) ;;
574239713583Smrg	      *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;;
574339713583Smrg	      esac
574439713583Smrg	    fi
574539713583Smrg	    if test "$linkmode" = prog; then
574639713583Smrg	      test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs"
574739713583Smrg	      test -n "$add" && compile_deplibs="$add $compile_deplibs"
574839713583Smrg	    else
574939713583Smrg	      test -n "$add_dir" && deplibs="$add_dir $deplibs"
575039713583Smrg	      test -n "$add" && deplibs="$add $deplibs"
575139713583Smrg	      if test "$hardcode_direct" != yes &&
575239713583Smrg		 test "$hardcode_minus_L" != yes &&
575339713583Smrg		 test "$hardcode_shlibpath_var" = yes; then
575439713583Smrg		case :$finalize_shlibpath: in
575539713583Smrg		*":$libdir:"*) ;;
575639713583Smrg		*) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
575739713583Smrg		esac
575839713583Smrg	      fi
575939713583Smrg	    fi
576039713583Smrg	  fi
576139713583Smrg
576239713583Smrg	  if test "$linkmode" = prog || test "$mode" = relink; then
576339713583Smrg	    add_shlibpath=
576439713583Smrg	    add_dir=
576539713583Smrg	    add=
576639713583Smrg	    # Finalize command for both is simple: just hardcode it.
576739713583Smrg	    if test "$hardcode_direct" = yes &&
576839713583Smrg	       test "$hardcode_direct_absolute" = no; then
576939713583Smrg	      add="$libdir/$linklib"
577039713583Smrg	    elif test "$hardcode_minus_L" = yes; then
577139713583Smrg	      add_dir="-L$libdir"
577239713583Smrg	      add="-l$name"
577339713583Smrg	    elif test "$hardcode_shlibpath_var" = yes; then
577439713583Smrg	      case :$finalize_shlibpath: in
577539713583Smrg	      *":$libdir:"*) ;;
577639713583Smrg	      *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
577739713583Smrg	      esac
577839713583Smrg	      add="-l$name"
577939713583Smrg	    elif test "$hardcode_automatic" = yes; then
578039713583Smrg	      if test -n "$inst_prefix_dir" &&
578139713583Smrg		 test -f "$inst_prefix_dir$libdir/$linklib" ; then
578239713583Smrg		add="$inst_prefix_dir$libdir/$linklib"
578339713583Smrg	      else
578439713583Smrg		add="$libdir/$linklib"
578539713583Smrg	      fi
578639713583Smrg	    else
578739713583Smrg	      # We cannot seem to hardcode it, guess we'll fake it.
578839713583Smrg	      add_dir="-L$libdir"
578939713583Smrg	      # Try looking first in the location we're being installed to.
579039713583Smrg	      if test -n "$inst_prefix_dir"; then
579139713583Smrg		case $libdir in
579239713583Smrg		  [\\/]*)
579339713583Smrg		    add_dir="$add_dir -L$inst_prefix_dir$libdir"
579439713583Smrg		    ;;
579539713583Smrg		esac
579639713583Smrg	      fi
579739713583Smrg	      add="-l$name"
579839713583Smrg	    fi
579939713583Smrg
580039713583Smrg	    if test "$linkmode" = prog; then
580139713583Smrg	      test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs"
580239713583Smrg	      test -n "$add" && finalize_deplibs="$add $finalize_deplibs"
580339713583Smrg	    else
580439713583Smrg	      test -n "$add_dir" && deplibs="$add_dir $deplibs"
580539713583Smrg	      test -n "$add" && deplibs="$add $deplibs"
580639713583Smrg	    fi
580739713583Smrg	  fi
580839713583Smrg	elif test "$linkmode" = prog; then
580939713583Smrg	  # Here we assume that one of hardcode_direct or hardcode_minus_L
581039713583Smrg	  # is not unsupported.  This is valid on all known static and
581139713583Smrg	  # shared platforms.
581239713583Smrg	  if test "$hardcode_direct" != unsupported; then
581339713583Smrg	    test -n "$old_library" && linklib="$old_library"
581439713583Smrg	    compile_deplibs="$dir/$linklib $compile_deplibs"
581539713583Smrg	    finalize_deplibs="$dir/$linklib $finalize_deplibs"
581639713583Smrg	  else
581739713583Smrg	    compile_deplibs="-l$name -L$dir $compile_deplibs"
581839713583Smrg	    finalize_deplibs="-l$name -L$dir $finalize_deplibs"
581939713583Smrg	  fi
582039713583Smrg	elif test "$build_libtool_libs" = yes; then
582139713583Smrg	  # Not a shared library
582239713583Smrg	  if test "$deplibs_check_method" != pass_all; then
582339713583Smrg	    # We're trying link a shared library against a static one
582439713583Smrg	    # but the system doesn't support it.
582539713583Smrg
582639713583Smrg	    # Just print a warning and add the library to dependency_libs so
582739713583Smrg	    # that the program can be linked against the static library.
582839713583Smrg	    $ECHO
582939713583Smrg	    $ECHO "*** Warning: This system can not link to static lib archive $lib."
583039713583Smrg	    $ECHO "*** I have the capability to make that library automatically link in when"
583139713583Smrg	    $ECHO "*** you link to this library.  But I can only do this if you have a"
583239713583Smrg	    $ECHO "*** shared version of the library, which you do not appear to have."
583339713583Smrg	    if test "$module" = yes; then
583439713583Smrg	      $ECHO "*** But as you try to build a module library, libtool will still create "
583539713583Smrg	      $ECHO "*** a static module, that should work as long as the dlopening application"
583639713583Smrg	      $ECHO "*** is linked with the -dlopen flag to resolve symbols at runtime."
583739713583Smrg	      if test -z "$global_symbol_pipe"; then
583839713583Smrg		$ECHO
583939713583Smrg		$ECHO "*** However, this would only work if libtool was able to extract symbol"
584039713583Smrg		$ECHO "*** lists from a program, using \`nm' or equivalent, but libtool could"
584139713583Smrg		$ECHO "*** not find such a program.  So, this module is probably useless."
584239713583Smrg		$ECHO "*** \`nm' from GNU binutils and a full rebuild may help."
584339713583Smrg	      fi
584439713583Smrg	      if test "$build_old_libs" = no; then
584539713583Smrg		build_libtool_libs=module
584639713583Smrg		build_old_libs=yes
584739713583Smrg	      else
584839713583Smrg		build_libtool_libs=no
584939713583Smrg	      fi
585039713583Smrg	    fi
585139713583Smrg	  else
585239713583Smrg	    deplibs="$dir/$old_library $deplibs"
585339713583Smrg	    link_static=yes
585439713583Smrg	  fi
585539713583Smrg	fi # link shared/static library?
585639713583Smrg
585739713583Smrg	if test "$linkmode" = lib; then
585839713583Smrg	  if test -n "$dependency_libs" &&
585939713583Smrg	     { test "$hardcode_into_libs" != yes ||
586039713583Smrg	       test "$build_old_libs" = yes ||
586139713583Smrg	       test "$link_static" = yes; }; then
586239713583Smrg	    # Extract -R from dependency_libs
586339713583Smrg	    temp_deplibs=
586439713583Smrg	    for libdir in $dependency_libs; do
586539713583Smrg	      case $libdir in
586639713583Smrg	      -R*) func_stripname '-R' '' "$libdir"
586739713583Smrg	           temp_xrpath=$func_stripname_result
586839713583Smrg		   case " $xrpath " in
586939713583Smrg		   *" $temp_xrpath "*) ;;
587039713583Smrg		   *) xrpath="$xrpath $temp_xrpath";;
587139713583Smrg		   esac;;
587239713583Smrg	      *) temp_deplibs="$temp_deplibs $libdir";;
587339713583Smrg	      esac
587439713583Smrg	    done
587539713583Smrg	    dependency_libs="$temp_deplibs"
587639713583Smrg	  fi
587739713583Smrg
587839713583Smrg	  newlib_search_path="$newlib_search_path $absdir"
587939713583Smrg	  # Link against this library
588039713583Smrg	  test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs"
588139713583Smrg	  # ... and its dependency_libs
588239713583Smrg	  tmp_libs=
588339713583Smrg	  for deplib in $dependency_libs; do
588439713583Smrg	    newdependency_libs="$deplib $newdependency_libs"
588539713583Smrg	    if $opt_duplicate_deps ; then
588639713583Smrg	      case "$tmp_libs " in
588739713583Smrg	      *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
588839713583Smrg	      esac
588939713583Smrg	    fi
589039713583Smrg	    tmp_libs="$tmp_libs $deplib"
589139713583Smrg	  done
589239713583Smrg
589339713583Smrg	  if test "$link_all_deplibs" != no; then
589439713583Smrg	    # Add the search paths of all dependency libraries
589539713583Smrg	    for deplib in $dependency_libs; do
589639713583Smrg	      case $deplib in
589739713583Smrg	      -L*) path="$deplib" ;;
589839713583Smrg	      *.la)
589939713583Smrg	        func_dirname "$deplib" "" "."
590039713583Smrg		dir="$func_dirname_result"
590139713583Smrg		# We need an absolute path.
590239713583Smrg		case $dir in
590339713583Smrg		[\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;;
590439713583Smrg		*)
590539713583Smrg		  absdir=`cd "$dir" && pwd`
590639713583Smrg		  if test -z "$absdir"; then
590739713583Smrg		    func_warning "cannot determine absolute directory name of \`$dir'"
590839713583Smrg		    absdir="$dir"
590939713583Smrg		  fi
591039713583Smrg		  ;;
591139713583Smrg		esac
591239713583Smrg		if $GREP "^installed=no" $deplib > /dev/null; then
591339713583Smrg		case $host in
591439713583Smrg		*-*-darwin*)
591539713583Smrg		  depdepl=
591639713583Smrg		  eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib`
591739713583Smrg		  if test -n "$deplibrary_names" ; then
591839713583Smrg		    for tmp in $deplibrary_names ; do
591939713583Smrg		      depdepl=$tmp
592039713583Smrg		    done
592139713583Smrg		    if test -f "$absdir/$objdir/$depdepl" ; then
592239713583Smrg		      depdepl="$absdir/$objdir/$depdepl"
592339713583Smrg		      darwin_install_name=`${OTOOL} -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'`
592439713583Smrg                      if test -z "$darwin_install_name"; then
592539713583Smrg                          darwin_install_name=`${OTOOL64} -L $depdepl  | awk '{if (NR == 2) {print $1;exit}}'`
592639713583Smrg                      fi
592739713583Smrg		      compiler_flags="$compiler_flags ${wl}-dylib_file ${wl}${darwin_install_name}:${depdepl}"
592839713583Smrg		      linker_flags="$linker_flags -dylib_file ${darwin_install_name}:${depdepl}"
592939713583Smrg		      path=
593039713583Smrg		    fi
593139713583Smrg		  fi
593239713583Smrg		  ;;
593339713583Smrg		*)
593439713583Smrg		  path="-L$absdir/$objdir"
593539713583Smrg		  ;;
593639713583Smrg		esac
593739713583Smrg		else
593839713583Smrg		  eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
593939713583Smrg		  test -z "$libdir" && \
594039713583Smrg		    func_fatal_error "\`$deplib' is not a valid libtool archive"
594139713583Smrg		  test "$absdir" != "$libdir" && \
594239713583Smrg		    func_warning "\`$deplib' seems to be moved"
594339713583Smrg
594439713583Smrg		  path="-L$absdir"
594539713583Smrg		fi
594639713583Smrg		;;
594739713583Smrg	      esac
594839713583Smrg	      case " $deplibs " in
594939713583Smrg	      *" $path "*) ;;
595039713583Smrg	      *) deplibs="$path $deplibs" ;;
595139713583Smrg	      esac
595239713583Smrg	    done
595339713583Smrg	  fi # link_all_deplibs != no
595439713583Smrg	fi # linkmode = lib
595539713583Smrg      done # for deplib in $libs
595639713583Smrg      if test "$pass" = link; then
595739713583Smrg	if test "$linkmode" = "prog"; then
595839713583Smrg	  compile_deplibs="$new_inherited_linker_flags $compile_deplibs"
595939713583Smrg	  finalize_deplibs="$new_inherited_linker_flags $finalize_deplibs"
596039713583Smrg	else
596139713583Smrg	  compiler_flags="$compiler_flags "`$ECHO "X $new_inherited_linker_flags" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'`
596239713583Smrg	fi
596339713583Smrg      fi
596439713583Smrg      dependency_libs="$newdependency_libs"
596539713583Smrg      if test "$pass" = dlpreopen; then
596639713583Smrg	# Link the dlpreopened libraries before other libraries
596739713583Smrg	for deplib in $save_deplibs; do
596839713583Smrg	  deplibs="$deplib $deplibs"
596939713583Smrg	done
597039713583Smrg      fi
597139713583Smrg      if test "$pass" != dlopen; then
597239713583Smrg	if test "$pass" != conv; then
597339713583Smrg	  # Make sure lib_search_path contains only unique directories.
597439713583Smrg	  lib_search_path=
597539713583Smrg	  for dir in $newlib_search_path; do
597639713583Smrg	    case "$lib_search_path " in
597739713583Smrg	    *" $dir "*) ;;
597839713583Smrg	    *) lib_search_path="$lib_search_path $dir" ;;
597939713583Smrg	    esac
598039713583Smrg	  done
598139713583Smrg	  newlib_search_path=
598239713583Smrg	fi
598339713583Smrg
598439713583Smrg	if test "$linkmode,$pass" != "prog,link"; then
598539713583Smrg	  vars="deplibs"
598639713583Smrg	else
598739713583Smrg	  vars="compile_deplibs finalize_deplibs"
598839713583Smrg	fi
598939713583Smrg	for var in $vars dependency_libs; do
599039713583Smrg	  # Add libraries to $var in reverse order
599139713583Smrg	  eval tmp_libs=\"\$$var\"
599239713583Smrg	  new_libs=
599339713583Smrg	  for deplib in $tmp_libs; do
599439713583Smrg	    # FIXME: Pedantically, this is the right thing to do, so
599539713583Smrg	    #        that some nasty dependency loop isn't accidentally
599639713583Smrg	    #        broken:
599739713583Smrg	    #new_libs="$deplib $new_libs"
599839713583Smrg	    # Pragmatically, this seems to cause very few problems in
599939713583Smrg	    # practice:
600039713583Smrg	    case $deplib in
600139713583Smrg	    -L*) new_libs="$deplib $new_libs" ;;
600239713583Smrg	    -R*) ;;
600339713583Smrg	    *)
600439713583Smrg	      # And here is the reason: when a library appears more
600539713583Smrg	      # than once as an explicit dependence of a library, or
600639713583Smrg	      # is implicitly linked in more than once by the
600739713583Smrg	      # compiler, it is considered special, and multiple
600839713583Smrg	      # occurrences thereof are not removed.  Compare this
600939713583Smrg	      # with having the same library being listed as a
601039713583Smrg	      # dependency of multiple other libraries: in this case,
601139713583Smrg	      # we know (pedantically, we assume) the library does not
601239713583Smrg	      # need to be listed more than once, so we keep only the
601339713583Smrg	      # last copy.  This is not always right, but it is rare
601439713583Smrg	      # enough that we require users that really mean to play
601539713583Smrg	      # such unportable linking tricks to link the library
601639713583Smrg	      # using -Wl,-lname, so that libtool does not consider it
601739713583Smrg	      # for duplicate removal.
601839713583Smrg	      case " $specialdeplibs " in
601939713583Smrg	      *" $deplib "*) new_libs="$deplib $new_libs" ;;
602039713583Smrg	      *)
602139713583Smrg		case " $new_libs " in
602239713583Smrg		*" $deplib "*) ;;
602339713583Smrg		*) new_libs="$deplib $new_libs" ;;
602439713583Smrg		esac
602539713583Smrg		;;
602639713583Smrg	      esac
602739713583Smrg	      ;;
602839713583Smrg	    esac
602939713583Smrg	  done
603039713583Smrg	  tmp_libs=
603139713583Smrg	  for deplib in $new_libs; do
603239713583Smrg	    case $deplib in
603339713583Smrg	    -L*)
603439713583Smrg	      case " $tmp_libs " in
603539713583Smrg	      *" $deplib "*) ;;
603639713583Smrg	      *) tmp_libs="$tmp_libs $deplib" ;;
603739713583Smrg	      esac
603839713583Smrg	      ;;
603939713583Smrg	    *) tmp_libs="$tmp_libs $deplib" ;;
604039713583Smrg	    esac
604139713583Smrg	  done
604239713583Smrg	  eval $var=\"$tmp_libs\"
604339713583Smrg	done # for var
604439713583Smrg      fi
604539713583Smrg      # Last step: remove runtime libs from dependency_libs
604639713583Smrg      # (they stay in deplibs)
604739713583Smrg      tmp_libs=
604839713583Smrg      for i in $dependency_libs ; do
604939713583Smrg	case " $predeps $postdeps $compiler_lib_search_path " in
605039713583Smrg	*" $i "*)
605139713583Smrg	  i=""
605239713583Smrg	  ;;
605339713583Smrg	esac
605439713583Smrg	if test -n "$i" ; then
605539713583Smrg	  tmp_libs="$tmp_libs $i"
605639713583Smrg	fi
605739713583Smrg      done
605839713583Smrg      dependency_libs=$tmp_libs
605939713583Smrg    done # for pass
606039713583Smrg    if test "$linkmode" = prog; then
606139713583Smrg      dlfiles="$newdlfiles"
606239713583Smrg    fi
606339713583Smrg    if test "$linkmode" = prog || test "$linkmode" = lib; then
606439713583Smrg      dlprefiles="$newdlprefiles"
606539713583Smrg    fi
606639713583Smrg
606739713583Smrg    case $linkmode in
606839713583Smrg    oldlib)
606939713583Smrg      if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
607039713583Smrg	func_warning "\`-dlopen' is ignored for archives"
607139713583Smrg      fi
607239713583Smrg
607339713583Smrg      case " $deplibs" in
607439713583Smrg      *\ -l* | *\ -L*)
607539713583Smrg	func_warning "\`-l' and \`-L' are ignored for archives" ;;
607639713583Smrg      esac
607739713583Smrg
607839713583Smrg      test -n "$rpath" && \
607939713583Smrg	func_warning "\`-rpath' is ignored for archives"
608039713583Smrg
608139713583Smrg      test -n "$xrpath" && \
608239713583Smrg	func_warning "\`-R' is ignored for archives"
608339713583Smrg
608439713583Smrg      test -n "$vinfo" && \
608539713583Smrg	func_warning "\`-version-info/-version-number' is ignored for archives"
608639713583Smrg
608739713583Smrg      test -n "$release" && \
608839713583Smrg	func_warning "\`-release' is ignored for archives"
608939713583Smrg
609039713583Smrg      test -n "$export_symbols$export_symbols_regex" && \
609139713583Smrg	func_warning "\`-export-symbols' is ignored for archives"
609239713583Smrg
609339713583Smrg      # Now set the variables for building old libraries.
609439713583Smrg      build_libtool_libs=no
609539713583Smrg      oldlibs="$output"
609639713583Smrg      objs="$objs$old_deplibs"
609739713583Smrg      ;;
609839713583Smrg
609939713583Smrg    lib)
610039713583Smrg      # Make sure we only generate libraries of the form `libNAME.la'.
610139713583Smrg      case $outputname in
610239713583Smrg      lib*)
610339713583Smrg	func_stripname 'lib' '.la' "$outputname"
610439713583Smrg	name=$func_stripname_result
610539713583Smrg	eval shared_ext=\"$shrext_cmds\"
610639713583Smrg	eval libname=\"$libname_spec\"
610739713583Smrg	;;
610839713583Smrg      *)
610939713583Smrg	test "$module" = no && \
611039713583Smrg	  func_fatal_help "libtool library \`$output' must begin with \`lib'"
611139713583Smrg
611239713583Smrg	if test "$need_lib_prefix" != no; then
611339713583Smrg	  # Add the "lib" prefix for modules if required
611439713583Smrg	  func_stripname '' '.la' "$outputname"
611539713583Smrg	  name=$func_stripname_result
611639713583Smrg	  eval shared_ext=\"$shrext_cmds\"
611739713583Smrg	  eval libname=\"$libname_spec\"
611839713583Smrg	else
611939713583Smrg	  func_stripname '' '.la' "$outputname"
612039713583Smrg	  libname=$func_stripname_result
612139713583Smrg	fi
612239713583Smrg	;;
612339713583Smrg      esac
612439713583Smrg
612539713583Smrg      if test -n "$objs"; then
612639713583Smrg	if test "$deplibs_check_method" != pass_all; then
612739713583Smrg	  func_fatal_error "cannot build libtool library \`$output' from non-libtool objects on this host:$objs"
612839713583Smrg	else
612939713583Smrg	  $ECHO
613039713583Smrg	  $ECHO "*** Warning: Linking the shared library $output against the non-libtool"
613139713583Smrg	  $ECHO "*** objects $objs is not portable!"
613239713583Smrg	  libobjs="$libobjs $objs"
613339713583Smrg	fi
613439713583Smrg      fi
613539713583Smrg
613639713583Smrg      test "$dlself" != no && \
613739713583Smrg	func_warning "\`-dlopen self' is ignored for libtool libraries"
613839713583Smrg
613939713583Smrg      set dummy $rpath
614039713583Smrg      shift
614139713583Smrg      test "$#" -gt 1 && \
614239713583Smrg	func_warning "ignoring multiple \`-rpath's for a libtool library"
614339713583Smrg
614439713583Smrg      install_libdir="$1"
614539713583Smrg
614639713583Smrg      oldlibs=
614739713583Smrg      if test -z "$rpath"; then
614839713583Smrg	if test "$build_libtool_libs" = yes; then
614939713583Smrg	  # Building a libtool convenience library.
615039713583Smrg	  # Some compilers have problems with a `.al' extension so
615139713583Smrg	  # convenience libraries should have the same extension an
615239713583Smrg	  # archive normally would.
615339713583Smrg	  oldlibs="$output_objdir/$libname.$libext $oldlibs"
615439713583Smrg	  build_libtool_libs=convenience
615539713583Smrg	  build_old_libs=yes
615639713583Smrg	fi
615739713583Smrg
615839713583Smrg	test -n "$vinfo" && \
615939713583Smrg	  func_warning "\`-version-info/-version-number' is ignored for convenience libraries"
616039713583Smrg
616139713583Smrg	test -n "$release" && \
616239713583Smrg	  func_warning "\`-release' is ignored for convenience libraries"
616339713583Smrg      else
616439713583Smrg
616539713583Smrg	# Parse the version information argument.
616639713583Smrg	save_ifs="$IFS"; IFS=':'
616739713583Smrg	set dummy $vinfo 0 0 0
616839713583Smrg	shift
616939713583Smrg	IFS="$save_ifs"
617039713583Smrg
617139713583Smrg	test -n "$7" && \
617239713583Smrg	  func_fatal_help "too many parameters to \`-version-info'"
617339713583Smrg
617439713583Smrg	# convert absolute version numbers to libtool ages
617539713583Smrg	# this retains compatibility with .la files and attempts
617639713583Smrg	# to make the code below a bit more comprehensible
617739713583Smrg
617839713583Smrg	case $vinfo_number in
617939713583Smrg	yes)
618039713583Smrg	  number_major="$1"
618139713583Smrg	  number_minor="$2"
618239713583Smrg	  number_revision="$3"
618339713583Smrg	  #
618439713583Smrg	  # There are really only two kinds -- those that
618539713583Smrg	  # use the current revision as the major version
618639713583Smrg	  # and those that subtract age and use age as
618739713583Smrg	  # a minor version.  But, then there is irix
618839713583Smrg	  # which has an extra 1 added just for fun
618939713583Smrg	  #
619039713583Smrg	  case $version_type in
619139713583Smrg	  darwin|linux|osf|windows|none)
619239713583Smrg	    func_arith $number_major + $number_minor
619339713583Smrg	    current=$func_arith_result
619439713583Smrg	    age="$number_minor"
619539713583Smrg	    revision="$number_revision"
619639713583Smrg	    ;;
619739713583Smrg	  freebsd-aout|freebsd-elf|sunos)
619839713583Smrg	    current="$number_major"
619939713583Smrg	    revision="$number_minor"
620039713583Smrg	    age="0"
620139713583Smrg	    ;;
620239713583Smrg	  irix|nonstopux)
620339713583Smrg	    func_arith $number_major + $number_minor
620439713583Smrg	    current=$func_arith_result
620539713583Smrg	    age="$number_minor"
620639713583Smrg	    revision="$number_minor"
620739713583Smrg	    lt_irix_increment=no
620839713583Smrg	    ;;
620939713583Smrg	  esac
621039713583Smrg	  ;;
621139713583Smrg	no)
621239713583Smrg	  current="$1"
621339713583Smrg	  revision="$2"
621439713583Smrg	  age="$3"
621539713583Smrg	  ;;
621639713583Smrg	esac
621739713583Smrg
621839713583Smrg	# Check that each of the things are valid numbers.
621939713583Smrg	case $current in
622039713583Smrg	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]) ;;
622139713583Smrg	*)
622239713583Smrg	  func_error "CURRENT \`$current' must be a nonnegative integer"
622339713583Smrg	  func_fatal_error "\`$vinfo' is not valid version information"
622439713583Smrg	  ;;
622539713583Smrg	esac
622639713583Smrg
622739713583Smrg	case $revision in
622839713583Smrg	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]) ;;
622939713583Smrg	*)
623039713583Smrg	  func_error "REVISION \`$revision' must be a nonnegative integer"
623139713583Smrg	  func_fatal_error "\`$vinfo' is not valid version information"
623239713583Smrg	  ;;
623339713583Smrg	esac
623439713583Smrg
623539713583Smrg	case $age in
623639713583Smrg	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]) ;;
623739713583Smrg	*)
623839713583Smrg	  func_error "AGE \`$age' must be a nonnegative integer"
623939713583Smrg	  func_fatal_error "\`$vinfo' is not valid version information"
624039713583Smrg	  ;;
624139713583Smrg	esac
624239713583Smrg
624339713583Smrg	if test "$age" -gt "$current"; then
624439713583Smrg	  func_error "AGE \`$age' is greater than the current interface number \`$current'"
624539713583Smrg	  func_fatal_error "\`$vinfo' is not valid version information"
624639713583Smrg	fi
624739713583Smrg
624839713583Smrg	# Calculate the version variables.
624939713583Smrg	major=
625039713583Smrg	versuffix=
625139713583Smrg	verstring=
625239713583Smrg	case $version_type in
625339713583Smrg	none) ;;
625439713583Smrg
625539713583Smrg	darwin)
625639713583Smrg	  # Like Linux, but with the current version available in
625739713583Smrg	  # verstring for coding it into the library header
625839713583Smrg	  func_arith $current - $age
625939713583Smrg	  major=.$func_arith_result
626039713583Smrg	  versuffix="$major.$age.$revision"
626139713583Smrg	  # Darwin ld doesn't like 0 for these options...
626239713583Smrg	  func_arith $current + 1
626339713583Smrg	  minor_current=$func_arith_result
626439713583Smrg	  xlcverstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision"
626539713583Smrg	  verstring="-compatibility_version $minor_current -current_version $minor_current.$revision"
626639713583Smrg	  ;;
626739713583Smrg
626839713583Smrg	freebsd-aout)
626939713583Smrg	  major=".$current"
627039713583Smrg	  versuffix=".$current.$revision";
627139713583Smrg	  ;;
627239713583Smrg
627339713583Smrg	freebsd-elf)
627439713583Smrg	  major=".$current"
627539713583Smrg	  versuffix=".$current"
627639713583Smrg	  ;;
627739713583Smrg
627839713583Smrg	irix | nonstopux)
627939713583Smrg	  if test "X$lt_irix_increment" = "Xno"; then
628039713583Smrg	    func_arith $current - $age
628139713583Smrg	  else
628239713583Smrg	    func_arith $current - $age + 1
628339713583Smrg	  fi
628439713583Smrg	  major=$func_arith_result
628539713583Smrg
628639713583Smrg	  case $version_type in
628739713583Smrg	    nonstopux) verstring_prefix=nonstopux ;;
628839713583Smrg	    *)         verstring_prefix=sgi ;;
628939713583Smrg	  esac
629039713583Smrg	  verstring="$verstring_prefix$major.$revision"
629139713583Smrg
629239713583Smrg	  # Add in all the interfaces that we are compatible with.
629339713583Smrg	  loop=$revision
629439713583Smrg	  while test "$loop" -ne 0; do
629539713583Smrg	    func_arith $revision - $loop
629639713583Smrg	    iface=$func_arith_result
629739713583Smrg	    func_arith $loop - 1
629839713583Smrg	    loop=$func_arith_result
629939713583Smrg	    verstring="$verstring_prefix$major.$iface:$verstring"
630039713583Smrg	  done
630139713583Smrg
630239713583Smrg	  # Before this point, $major must not contain `.'.
630339713583Smrg	  major=.$major
630439713583Smrg	  versuffix="$major.$revision"
630539713583Smrg	  ;;
630639713583Smrg
630739713583Smrg	linux)
630839713583Smrg	  func_arith $current - $age
630939713583Smrg	  major=.$func_arith_result
631039713583Smrg	  versuffix="$major.$age.$revision"
631139713583Smrg	  ;;
631239713583Smrg
631339713583Smrg	osf)
631439713583Smrg	  func_arith $current - $age
631539713583Smrg	  major=.$func_arith_result
631639713583Smrg	  versuffix=".$current.$age.$revision"
631739713583Smrg	  verstring="$current.$age.$revision"
631839713583Smrg
631939713583Smrg	  # Add in all the interfaces that we are compatible with.
632039713583Smrg	  loop=$age
632139713583Smrg	  while test "$loop" -ne 0; do
632239713583Smrg	    func_arith $current - $loop
632339713583Smrg	    iface=$func_arith_result
632439713583Smrg	    func_arith $loop - 1
632539713583Smrg	    loop=$func_arith_result
632639713583Smrg	    verstring="$verstring:${iface}.0"
632739713583Smrg	  done
632839713583Smrg
632939713583Smrg	  # Make executables depend on our current version.
633039713583Smrg	  verstring="$verstring:${current}.0"
633139713583Smrg	  ;;
633239713583Smrg
633339713583Smrg	qnx)
633439713583Smrg	  major=".$current"
633539713583Smrg	  versuffix=".$current"
633639713583Smrg	  ;;
633739713583Smrg
633839713583Smrg	sunos)
633939713583Smrg	  major=".$current"
634039713583Smrg	  versuffix=".$current.$revision"
634139713583Smrg	  ;;
634239713583Smrg
634339713583Smrg	windows)
634439713583Smrg	  # Use '-' rather than '.', since we only want one
634539713583Smrg	  # extension on DOS 8.3 filesystems.
634639713583Smrg	  func_arith $current - $age
634739713583Smrg	  major=$func_arith_result
634839713583Smrg	  versuffix="-$major"
634939713583Smrg	  ;;
635039713583Smrg
635139713583Smrg	*)
635239713583Smrg	  func_fatal_configuration "unknown library version type \`$version_type'"
635339713583Smrg	  ;;
635439713583Smrg	esac
635539713583Smrg
635639713583Smrg	# Clear the version info if we defaulted, and they specified a release.
635739713583Smrg	if test -z "$vinfo" && test -n "$release"; then
635839713583Smrg	  major=
635939713583Smrg	  case $version_type in
636039713583Smrg	  darwin)
636139713583Smrg	    # we can't check for "0.0" in archive_cmds due to quoting
636239713583Smrg	    # problems, so we reset it completely
636339713583Smrg	    verstring=
636439713583Smrg	    ;;
636539713583Smrg	  *)
636639713583Smrg	    verstring="0.0"
636739713583Smrg	    ;;
636839713583Smrg	  esac
636939713583Smrg	  if test "$need_version" = no; then
637039713583Smrg	    versuffix=
637139713583Smrg	  else
637239713583Smrg	    versuffix=".0.0"
637339713583Smrg	  fi
637439713583Smrg	fi
637539713583Smrg
637639713583Smrg	# Remove version info from name if versioning should be avoided
637739713583Smrg	if test "$avoid_version" = yes && test "$need_version" = no; then
637839713583Smrg	  major=
637939713583Smrg	  versuffix=
638039713583Smrg	  verstring=""
638139713583Smrg	fi
638239713583Smrg
638339713583Smrg	# Check to see if the archive will have undefined symbols.
638439713583Smrg	if test "$allow_undefined" = yes; then
638539713583Smrg	  if test "$allow_undefined_flag" = unsupported; then
638639713583Smrg	    func_warning "undefined symbols not allowed in $host shared libraries"
638739713583Smrg	    build_libtool_libs=no
638839713583Smrg	    build_old_libs=yes
638939713583Smrg	  fi
639039713583Smrg	else
639139713583Smrg	  # Don't allow undefined symbols.
639239713583Smrg	  allow_undefined_flag="$no_undefined_flag"
639339713583Smrg	fi
639439713583Smrg
639539713583Smrg      fi
639639713583Smrg
639739713583Smrg      func_generate_dlsyms "$libname" "$libname" "yes"
639839713583Smrg      libobjs="$libobjs $symfileobj"
639939713583Smrg      test "X$libobjs" = "X " && libobjs=
640039713583Smrg
640139713583Smrg      if test "$mode" != relink; then
640239713583Smrg	# Remove our outputs, but don't remove object files since they
640339713583Smrg	# may have been created when compiling PIC objects.
640439713583Smrg	removelist=
640539713583Smrg	tempremovelist=`$ECHO "$output_objdir/*"`
640639713583Smrg	for p in $tempremovelist; do
640739713583Smrg	  case $p in
640839713583Smrg	    *.$objext | *.gcno)
640939713583Smrg	       ;;
641039713583Smrg	    $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*)
641139713583Smrg	       if test "X$precious_files_regex" != "X"; then
641239713583Smrg		 if $ECHO "$p" | $EGREP -e "$precious_files_regex" >/dev/null 2>&1
641339713583Smrg		 then
641439713583Smrg		   continue
641539713583Smrg		 fi
641639713583Smrg	       fi
641739713583Smrg	       removelist="$removelist $p"
641839713583Smrg	       ;;
641939713583Smrg	    *) ;;
642039713583Smrg	  esac
642139713583Smrg	done
642239713583Smrg	test -n "$removelist" && \
642339713583Smrg	  func_show_eval "${RM}r \$removelist"
642439713583Smrg      fi
642539713583Smrg
642639713583Smrg      # Now set the variables for building old libraries.
642739713583Smrg      if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then
642839713583Smrg	oldlibs="$oldlibs $output_objdir/$libname.$libext"
642939713583Smrg
643039713583Smrg	# Transform .lo files to .o files.
643139713583Smrg	oldobjs="$objs "`$ECHO "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP`
643239713583Smrg      fi
643339713583Smrg
643439713583Smrg      # Eliminate all temporary directories.
643539713583Smrg      #for path in $notinst_path; do
643639713583Smrg      #	lib_search_path=`$ECHO "X$lib_search_path " | $Xsed -e "s% $path % %g"`
643739713583Smrg      #	deplibs=`$ECHO "X$deplibs " | $Xsed -e "s% -L$path % %g"`
643839713583Smrg      #	dependency_libs=`$ECHO "X$dependency_libs " | $Xsed -e "s% -L$path % %g"`
643939713583Smrg      #done
644039713583Smrg
644139713583Smrg      if test -n "$xrpath"; then
644239713583Smrg	# If the user specified any rpath flags, then add them.
644339713583Smrg	temp_xrpath=
644439713583Smrg	for libdir in $xrpath; do
644539713583Smrg	  temp_xrpath="$temp_xrpath -R$libdir"
644639713583Smrg	  case "$finalize_rpath " in
644739713583Smrg	  *" $libdir "*) ;;
644839713583Smrg	  *) finalize_rpath="$finalize_rpath $libdir" ;;
644939713583Smrg	  esac
645039713583Smrg	done
645139713583Smrg	if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then
645239713583Smrg	  dependency_libs="$temp_xrpath $dependency_libs"
645339713583Smrg	fi
645439713583Smrg      fi
645539713583Smrg
645639713583Smrg      # Make sure dlfiles contains only unique files that won't be dlpreopened
645739713583Smrg      old_dlfiles="$dlfiles"
645839713583Smrg      dlfiles=
645939713583Smrg      for lib in $old_dlfiles; do
646039713583Smrg	case " $dlprefiles $dlfiles " in
646139713583Smrg	*" $lib "*) ;;
646239713583Smrg	*) dlfiles="$dlfiles $lib" ;;
646339713583Smrg	esac
646439713583Smrg      done
646539713583Smrg
646639713583Smrg      # Make sure dlprefiles contains only unique files
646739713583Smrg      old_dlprefiles="$dlprefiles"
646839713583Smrg      dlprefiles=
646939713583Smrg      for lib in $old_dlprefiles; do
647039713583Smrg	case "$dlprefiles " in
647139713583Smrg	*" $lib "*) ;;
647239713583Smrg	*) dlprefiles="$dlprefiles $lib" ;;
647339713583Smrg	esac
647439713583Smrg      done
647539713583Smrg
647639713583Smrg      if test "$build_libtool_libs" = yes; then
647739713583Smrg	if test -n "$rpath"; then
647839713583Smrg	  case $host in
647939713583Smrg	  *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos* | *-cegcc*)
648039713583Smrg	    # these systems don't actually have a c library (as such)!
648139713583Smrg	    ;;
648239713583Smrg	  *-*-rhapsody* | *-*-darwin1.[012])
648339713583Smrg	    # Rhapsody C library is in the System framework
648439713583Smrg	    deplibs="$deplibs System.ltframework"
648539713583Smrg	    ;;
648639713583Smrg	  *-*-netbsd*)
648739713583Smrg	    # Don't link with libc until the a.out ld.so is fixed.
648839713583Smrg	    ;;
648939713583Smrg	  *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
649039713583Smrg	    # Do not include libc due to us having libc/libc_r.
649139713583Smrg	    ;;
649239713583Smrg	  *-*-sco3.2v5* | *-*-sco5v6*)
649339713583Smrg	    # Causes problems with __ctype
649439713583Smrg	    ;;
649539713583Smrg	  *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
649639713583Smrg	    # Compiler inserts libc in the correct place for threads to work
649739713583Smrg	    ;;
649839713583Smrg	  *)
649939713583Smrg	    # Add libc to deplibs on all other systems if necessary.
650039713583Smrg	    if test "$build_libtool_need_lc" = "yes"; then
650139713583Smrg	      deplibs="$deplibs -lc"
650239713583Smrg	    fi
650339713583Smrg	    ;;
650439713583Smrg	  esac
650539713583Smrg	fi
650639713583Smrg
650739713583Smrg	# Transform deplibs into only deplibs that can be linked in shared.
650839713583Smrg	name_save=$name
650939713583Smrg	libname_save=$libname
651039713583Smrg	release_save=$release
651139713583Smrg	versuffix_save=$versuffix
651239713583Smrg	major_save=$major
651339713583Smrg	# I'm not sure if I'm treating the release correctly.  I think
651439713583Smrg	# release should show up in the -l (ie -lgmp5) so we don't want to
651539713583Smrg	# add it in twice.  Is that correct?
651639713583Smrg	release=""
651739713583Smrg	versuffix=""
651839713583Smrg	major=""
651939713583Smrg	newdeplibs=
652039713583Smrg	droppeddeps=no
652139713583Smrg	case $deplibs_check_method in
652239713583Smrg	pass_all)
652339713583Smrg	  # Don't check for shared/static.  Everything works.
652439713583Smrg	  # This might be a little naive.  We might want to check
652539713583Smrg	  # whether the library exists or not.  But this is on
652639713583Smrg	  # osf3 & osf4 and I'm not really sure... Just
652739713583Smrg	  # implementing what was already the behavior.
652839713583Smrg	  newdeplibs=$deplibs
652939713583Smrg	  ;;
653039713583Smrg	test_compile)
653139713583Smrg	  # This code stresses the "libraries are programs" paradigm to its
653239713583Smrg	  # limits. Maybe even breaks it.  We compile a program, linking it
653339713583Smrg	  # against the deplibs as a proxy for the library.  Then we can check
653439713583Smrg	  # whether they linked in statically or dynamically with ldd.
653539713583Smrg	  $opt_dry_run || $RM conftest.c
653639713583Smrg	  cat > conftest.c <<EOF
653739713583Smrg	  int main() { return 0; }
653839713583SmrgEOF
653939713583Smrg	  $opt_dry_run || $RM conftest
654039713583Smrg	  if $LTCC $LTCFLAGS -o conftest conftest.c $deplibs; then
654139713583Smrg	    ldd_output=`ldd conftest`
654239713583Smrg	    for i in $deplibs; do
654339713583Smrg	      case $i in
654439713583Smrg	      -l*)
654539713583Smrg		func_stripname -l '' "$i"
654639713583Smrg		name=$func_stripname_result
654739713583Smrg		if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
654839713583Smrg		  case " $predeps $postdeps " in
654939713583Smrg		  *" $i "*)
655039713583Smrg		    newdeplibs="$newdeplibs $i"
655139713583Smrg		    i=""
655239713583Smrg		    ;;
655339713583Smrg		  esac
655439713583Smrg		fi
655539713583Smrg		if test -n "$i" ; then
655639713583Smrg		  libname=`eval "\\$ECHO \"$libname_spec\""`
655739713583Smrg		  deplib_matches=`eval "\\$ECHO \"$library_names_spec\""`
655839713583Smrg		  set dummy $deplib_matches; shift
655939713583Smrg		  deplib_match=$1
656039713583Smrg		  if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
656139713583Smrg		    newdeplibs="$newdeplibs $i"
656239713583Smrg		  else
656339713583Smrg		    droppeddeps=yes
656439713583Smrg		    $ECHO
656539713583Smrg		    $ECHO "*** Warning: dynamic linker does not accept needed library $i."
656639713583Smrg		    $ECHO "*** I have the capability to make that library automatically link in when"
656739713583Smrg		    $ECHO "*** you link to this library.  But I can only do this if you have a"
656839713583Smrg		    $ECHO "*** shared version of the library, which I believe you do not have"
656939713583Smrg		    $ECHO "*** because a test_compile did reveal that the linker did not use it for"
657039713583Smrg		    $ECHO "*** its dynamic dependency list that programs get resolved with at runtime."
657139713583Smrg		  fi
657239713583Smrg		fi
657339713583Smrg		;;
657439713583Smrg	      *)
657539713583Smrg		newdeplibs="$newdeplibs $i"
657639713583Smrg		;;
657739713583Smrg	      esac
657839713583Smrg	    done
657939713583Smrg	  else
658039713583Smrg	    # Error occurred in the first compile.  Let's try to salvage
658139713583Smrg	    # the situation: Compile a separate program for each library.
658239713583Smrg	    for i in $deplibs; do
658339713583Smrg	      case $i in
658439713583Smrg	      -l*)
658539713583Smrg		func_stripname -l '' "$i"
658639713583Smrg		name=$func_stripname_result
658739713583Smrg		$opt_dry_run || $RM conftest
658839713583Smrg		if $LTCC $LTCFLAGS -o conftest conftest.c $i; then
658939713583Smrg		  ldd_output=`ldd conftest`
659039713583Smrg		  if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
659139713583Smrg		    case " $predeps $postdeps " in
659239713583Smrg		    *" $i "*)
659339713583Smrg		      newdeplibs="$newdeplibs $i"
659439713583Smrg		      i=""
659539713583Smrg		      ;;
659639713583Smrg		    esac
659739713583Smrg		  fi
659839713583Smrg		  if test -n "$i" ; then
659939713583Smrg		    libname=`eval "\\$ECHO \"$libname_spec\""`
660039713583Smrg		    deplib_matches=`eval "\\$ECHO \"$library_names_spec\""`
660139713583Smrg		    set dummy $deplib_matches; shift
660239713583Smrg		    deplib_match=$1
660339713583Smrg		    if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
660439713583Smrg		      newdeplibs="$newdeplibs $i"
660539713583Smrg		    else
660639713583Smrg		      droppeddeps=yes
660739713583Smrg		      $ECHO
660839713583Smrg		      $ECHO "*** Warning: dynamic linker does not accept needed library $i."
660939713583Smrg		      $ECHO "*** I have the capability to make that library automatically link in when"
661039713583Smrg		      $ECHO "*** you link to this library.  But I can only do this if you have a"
661139713583Smrg		      $ECHO "*** shared version of the library, which you do not appear to have"
661239713583Smrg		      $ECHO "*** because a test_compile did reveal that the linker did not use this one"
661339713583Smrg		      $ECHO "*** as a dynamic dependency that programs can get resolved with at runtime."
661439713583Smrg		    fi
661539713583Smrg		  fi
661639713583Smrg		else
661739713583Smrg		  droppeddeps=yes
661839713583Smrg		  $ECHO
661939713583Smrg		  $ECHO "*** Warning!  Library $i is needed by this library but I was not able to"
662039713583Smrg		  $ECHO "*** make it link in!  You will probably need to install it or some"
662139713583Smrg		  $ECHO "*** library that it depends on before this library will be fully"
662239713583Smrg		  $ECHO "*** functional.  Installing it before continuing would be even better."
662339713583Smrg		fi
662439713583Smrg		;;
662539713583Smrg	      *)
662639713583Smrg		newdeplibs="$newdeplibs $i"
662739713583Smrg		;;
662839713583Smrg	      esac
662939713583Smrg	    done
663039713583Smrg	  fi
663139713583Smrg	  ;;
663239713583Smrg	file_magic*)
663339713583Smrg	  set dummy $deplibs_check_method; shift
663439713583Smrg	  file_magic_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
663539713583Smrg	  for a_deplib in $deplibs; do
663639713583Smrg	    case $a_deplib in
663739713583Smrg	    -l*)
663839713583Smrg	      func_stripname -l '' "$a_deplib"
663939713583Smrg	      name=$func_stripname_result
664039713583Smrg	      if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
664139713583Smrg		case " $predeps $postdeps " in
664239713583Smrg		*" $a_deplib "*)
664339713583Smrg		  newdeplibs="$newdeplibs $a_deplib"
664439713583Smrg		  a_deplib=""
664539713583Smrg		  ;;
664639713583Smrg		esac
664739713583Smrg	      fi
664839713583Smrg	      if test -n "$a_deplib" ; then
664939713583Smrg		libname=`eval "\\$ECHO \"$libname_spec\""`
665039713583Smrg		for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
665139713583Smrg		  potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
665239713583Smrg		  for potent_lib in $potential_libs; do
665339713583Smrg		      # Follow soft links.
665439713583Smrg		      if ls -lLd "$potent_lib" 2>/dev/null |
665539713583Smrg			 $GREP " -> " >/dev/null; then
665639713583Smrg			continue
665739713583Smrg		      fi
665839713583Smrg		      # The statement above tries to avoid entering an
665939713583Smrg		      # endless loop below, in case of cyclic links.
666039713583Smrg		      # We might still enter an endless loop, since a link
666139713583Smrg		      # loop can be closed while we follow links,
666239713583Smrg		      # but so what?
666339713583Smrg		      potlib="$potent_lib"
666439713583Smrg		      while test -h "$potlib" 2>/dev/null; do
666539713583Smrg			potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'`
666639713583Smrg			case $potliblink in
666739713583Smrg			[\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";;
666839713583Smrg			*) potlib=`$ECHO "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";;
666939713583Smrg			esac
667039713583Smrg		      done
667139713583Smrg		      if eval $file_magic_cmd \"\$potlib\" 2>/dev/null |
667239713583Smrg			 $SED -e 10q |
667339713583Smrg			 $EGREP "$file_magic_regex" > /dev/null; then
667439713583Smrg			newdeplibs="$newdeplibs $a_deplib"
667539713583Smrg			a_deplib=""
667639713583Smrg			break 2
667739713583Smrg		      fi
667839713583Smrg		  done
667939713583Smrg		done
668039713583Smrg	      fi
668139713583Smrg	      if test -n "$a_deplib" ; then
668239713583Smrg		droppeddeps=yes
668339713583Smrg		$ECHO
668439713583Smrg		$ECHO "*** Warning: linker path does not have real file for library $a_deplib."
668539713583Smrg		$ECHO "*** I have the capability to make that library automatically link in when"
668639713583Smrg		$ECHO "*** you link to this library.  But I can only do this if you have a"
668739713583Smrg		$ECHO "*** shared version of the library, which you do not appear to have"
668839713583Smrg		$ECHO "*** because I did check the linker path looking for a file starting"
668939713583Smrg		if test -z "$potlib" ; then
669039713583Smrg		  $ECHO "*** with $libname but no candidates were found. (...for file magic test)"
669139713583Smrg		else
669239713583Smrg		  $ECHO "*** with $libname and none of the candidates passed a file format test"
669339713583Smrg		  $ECHO "*** using a file magic. Last file checked: $potlib"
669439713583Smrg		fi
669539713583Smrg	      fi
669639713583Smrg	      ;;
669739713583Smrg	    *)
669839713583Smrg	      # Add a -L argument.
669939713583Smrg	      newdeplibs="$newdeplibs $a_deplib"
670039713583Smrg	      ;;
670139713583Smrg	    esac
670239713583Smrg	  done # Gone through all deplibs.
670339713583Smrg	  ;;
670439713583Smrg	match_pattern*)
670539713583Smrg	  set dummy $deplibs_check_method; shift
670639713583Smrg	  match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
670739713583Smrg	  for a_deplib in $deplibs; do
670839713583Smrg	    case $a_deplib in
670939713583Smrg	    -l*)
671039713583Smrg	      func_stripname -l '' "$a_deplib"
671139713583Smrg	      name=$func_stripname_result
671239713583Smrg	      if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
671339713583Smrg		case " $predeps $postdeps " in
671439713583Smrg		*" $a_deplib "*)
671539713583Smrg		  newdeplibs="$newdeplibs $a_deplib"
671639713583Smrg		  a_deplib=""
671739713583Smrg		  ;;
671839713583Smrg		esac
671939713583Smrg	      fi
672039713583Smrg	      if test -n "$a_deplib" ; then
672139713583Smrg		libname=`eval "\\$ECHO \"$libname_spec\""`
672239713583Smrg		for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
672339713583Smrg		  potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
672439713583Smrg		  for potent_lib in $potential_libs; do
672539713583Smrg		    potlib="$potent_lib" # see symlink-check above in file_magic test
672639713583Smrg		    if eval "\$ECHO \"X$potent_lib\"" 2>/dev/null | $Xsed -e 10q | \
672739713583Smrg		       $EGREP "$match_pattern_regex" > /dev/null; then
672839713583Smrg		      newdeplibs="$newdeplibs $a_deplib"
672939713583Smrg		      a_deplib=""
673039713583Smrg		      break 2
673139713583Smrg		    fi
673239713583Smrg		  done
673339713583Smrg		done
673439713583Smrg	      fi
673539713583Smrg	      if test -n "$a_deplib" ; then
673639713583Smrg		droppeddeps=yes
673739713583Smrg		$ECHO
673839713583Smrg		$ECHO "*** Warning: linker path does not have real file for library $a_deplib."
673939713583Smrg		$ECHO "*** I have the capability to make that library automatically link in when"
674039713583Smrg		$ECHO "*** you link to this library.  But I can only do this if you have a"
674139713583Smrg		$ECHO "*** shared version of the library, which you do not appear to have"
674239713583Smrg		$ECHO "*** because I did check the linker path looking for a file starting"
674339713583Smrg		if test -z "$potlib" ; then
674439713583Smrg		  $ECHO "*** with $libname but no candidates were found. (...for regex pattern test)"
674539713583Smrg		else
674639713583Smrg		  $ECHO "*** with $libname and none of the candidates passed a file format test"
674739713583Smrg		  $ECHO "*** using a regex pattern. Last file checked: $potlib"
674839713583Smrg		fi
674939713583Smrg	      fi
675039713583Smrg	      ;;
675139713583Smrg	    *)
675239713583Smrg	      # Add a -L argument.
675339713583Smrg	      newdeplibs="$newdeplibs $a_deplib"
675439713583Smrg	      ;;
675539713583Smrg	    esac
675639713583Smrg	  done # Gone through all deplibs.
675739713583Smrg	  ;;
675839713583Smrg	none | unknown | *)
675939713583Smrg	  newdeplibs=""
676039713583Smrg	  tmp_deplibs=`$ECHO "X $deplibs" | $Xsed \
676139713583Smrg	      -e 's/ -lc$//' -e 's/ -[LR][^ ]*//g'`
676239713583Smrg	  if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
676339713583Smrg	    for i in $predeps $postdeps ; do
676439713583Smrg	      # can't use Xsed below, because $i might contain '/'
676539713583Smrg	      tmp_deplibs=`$ECHO "X $tmp_deplibs" | $Xsed -e "s,$i,,"`
676639713583Smrg	    done
676739713583Smrg	  fi
676839713583Smrg	  if $ECHO "X $tmp_deplibs" | $Xsed -e 's/[	 ]//g' |
676939713583Smrg	     $GREP . >/dev/null; then
677039713583Smrg	    $ECHO
677139713583Smrg	    if test "X$deplibs_check_method" = "Xnone"; then
677239713583Smrg	      $ECHO "*** Warning: inter-library dependencies are not supported in this platform."
677339713583Smrg	    else
677439713583Smrg	      $ECHO "*** Warning: inter-library dependencies are not known to be supported."
677539713583Smrg	    fi
677639713583Smrg	    $ECHO "*** All declared inter-library dependencies are being dropped."
677739713583Smrg	    droppeddeps=yes
677839713583Smrg	  fi
677939713583Smrg	  ;;
678039713583Smrg	esac
678139713583Smrg	versuffix=$versuffix_save
678239713583Smrg	major=$major_save
678339713583Smrg	release=$release_save
678439713583Smrg	libname=$libname_save
678539713583Smrg	name=$name_save
678639713583Smrg
678739713583Smrg	case $host in
678839713583Smrg	*-*-rhapsody* | *-*-darwin1.[012])
678939713583Smrg	  # On Rhapsody replace the C library with the System framework
679039713583Smrg	  newdeplibs=`$ECHO "X $newdeplibs" | $Xsed -e 's/ -lc / System.ltframework /'`
679139713583Smrg	  ;;
679239713583Smrg	esac
679339713583Smrg
679439713583Smrg	if test "$droppeddeps" = yes; then
679539713583Smrg	  if test "$module" = yes; then
679639713583Smrg	    $ECHO
679739713583Smrg	    $ECHO "*** Warning: libtool could not satisfy all declared inter-library"
679839713583Smrg	    $ECHO "*** dependencies of module $libname.  Therefore, libtool will create"
679939713583Smrg	    $ECHO "*** a static module, that should work as long as the dlopening"
680039713583Smrg	    $ECHO "*** application is linked with the -dlopen flag."
680139713583Smrg	    if test -z "$global_symbol_pipe"; then
680239713583Smrg	      $ECHO
680339713583Smrg	      $ECHO "*** However, this would only work if libtool was able to extract symbol"
680439713583Smrg	      $ECHO "*** lists from a program, using \`nm' or equivalent, but libtool could"
680539713583Smrg	      $ECHO "*** not find such a program.  So, this module is probably useless."
680639713583Smrg	      $ECHO "*** \`nm' from GNU binutils and a full rebuild may help."
680739713583Smrg	    fi
680839713583Smrg	    if test "$build_old_libs" = no; then
680939713583Smrg	      oldlibs="$output_objdir/$libname.$libext"
681039713583Smrg	      build_libtool_libs=module
681139713583Smrg	      build_old_libs=yes
681239713583Smrg	    else
681339713583Smrg	      build_libtool_libs=no
681439713583Smrg	    fi
681539713583Smrg	  else
681639713583Smrg	    $ECHO "*** The inter-library dependencies that have been dropped here will be"
681739713583Smrg	    $ECHO "*** automatically added whenever a program is linked with this library"
681839713583Smrg	    $ECHO "*** or is declared to -dlopen it."
681939713583Smrg
682039713583Smrg	    if test "$allow_undefined" = no; then
682139713583Smrg	      $ECHO
682239713583Smrg	      $ECHO "*** Since this library must not contain undefined symbols,"
682339713583Smrg	      $ECHO "*** because either the platform does not support them or"
682439713583Smrg	      $ECHO "*** it was explicitly requested with -no-undefined,"
682539713583Smrg	      $ECHO "*** libtool will only create a static version of it."
682639713583Smrg	      if test "$build_old_libs" = no; then
682739713583Smrg		oldlibs="$output_objdir/$libname.$libext"
682839713583Smrg		build_libtool_libs=module
682939713583Smrg		build_old_libs=yes
683039713583Smrg	      else
683139713583Smrg		build_libtool_libs=no
683239713583Smrg	      fi
683339713583Smrg	    fi
683439713583Smrg	  fi
683539713583Smrg	fi
683639713583Smrg	# Done checking deplibs!
683739713583Smrg	deplibs=$newdeplibs
683839713583Smrg      fi
683939713583Smrg      # Time to change all our "foo.ltframework" stuff back to "-framework foo"
684039713583Smrg      case $host in
684139713583Smrg	*-*-darwin*)
684239713583Smrg	  newdeplibs=`$ECHO "X $newdeplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'`
684339713583Smrg	  new_inherited_linker_flags=`$ECHO "X $new_inherited_linker_flags" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'`
684439713583Smrg	  deplibs=`$ECHO "X $deplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'`
684539713583Smrg	  ;;
684639713583Smrg      esac
684739713583Smrg
684839713583Smrg      # move library search paths that coincide with paths to not yet
684939713583Smrg      # installed libraries to the beginning of the library search list
685039713583Smrg      new_libs=
685139713583Smrg      for path in $notinst_path; do
685239713583Smrg	case " $new_libs " in
685339713583Smrg	*" -L$path/$objdir "*) ;;
685439713583Smrg	*)
685539713583Smrg	  case " $deplibs " in
685639713583Smrg	  *" -L$path/$objdir "*)
685739713583Smrg	    new_libs="$new_libs -L$path/$objdir" ;;
685839713583Smrg	  esac
685939713583Smrg	  ;;
686039713583Smrg	esac
686139713583Smrg      done
686239713583Smrg      for deplib in $deplibs; do
686339713583Smrg	case $deplib in
686439713583Smrg	-L*)
686539713583Smrg	  case " $new_libs " in
686639713583Smrg	  *" $deplib "*) ;;
686739713583Smrg	  *) new_libs="$new_libs $deplib" ;;
686839713583Smrg	  esac
686939713583Smrg	  ;;
687039713583Smrg	*) new_libs="$new_libs $deplib" ;;
687139713583Smrg	esac
687239713583Smrg      done
687339713583Smrg      deplibs="$new_libs"
687439713583Smrg
687539713583Smrg      # All the library-specific variables (install_libdir is set above).
687639713583Smrg      library_names=
687739713583Smrg      old_library=
687839713583Smrg      dlname=
687939713583Smrg
688039713583Smrg      # Test again, we may have decided not to build it any more
688139713583Smrg      if test "$build_libtool_libs" = yes; then
688239713583Smrg	if test "$hardcode_into_libs" = yes; then
688339713583Smrg	  # Hardcode the library paths
688439713583Smrg	  hardcode_libdirs=
688539713583Smrg	  dep_rpath=
688639713583Smrg	  rpath="$finalize_rpath"
688739713583Smrg	  test "$mode" != relink && rpath="$compile_rpath$rpath"
688839713583Smrg	  for libdir in $rpath; do
688939713583Smrg	    if test -n "$hardcode_libdir_flag_spec"; then
689039713583Smrg	      if test -n "$hardcode_libdir_separator"; then
689139713583Smrg		if test -z "$hardcode_libdirs"; then
689239713583Smrg		  hardcode_libdirs="$libdir"
689339713583Smrg		else
689439713583Smrg		  # Just accumulate the unique libdirs.
689539713583Smrg		  case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
689639713583Smrg		  *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
689739713583Smrg		    ;;
689839713583Smrg		  *)
689939713583Smrg		    hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
690039713583Smrg		    ;;
690139713583Smrg		  esac
690239713583Smrg		fi
690339713583Smrg	      else
690439713583Smrg		eval flag=\"$hardcode_libdir_flag_spec\"
690539713583Smrg		dep_rpath="$dep_rpath $flag"
690639713583Smrg	      fi
690739713583Smrg	    elif test -n "$runpath_var"; then
690839713583Smrg	      case "$perm_rpath " in
690939713583Smrg	      *" $libdir "*) ;;
691039713583Smrg	      *) perm_rpath="$perm_rpath $libdir" ;;
691139713583Smrg	      esac
691239713583Smrg	    fi
691339713583Smrg	  done
691439713583Smrg	  # Substitute the hardcoded libdirs into the rpath.
691539713583Smrg	  if test -n "$hardcode_libdir_separator" &&
691639713583Smrg	     test -n "$hardcode_libdirs"; then
691739713583Smrg	    libdir="$hardcode_libdirs"
691839713583Smrg	    if test -n "$hardcode_libdir_flag_spec_ld"; then
691939713583Smrg	      eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\"
692039713583Smrg	    else
692139713583Smrg	      eval dep_rpath=\"$hardcode_libdir_flag_spec\"
692239713583Smrg	    fi
692339713583Smrg	  fi
692439713583Smrg	  if test -n "$runpath_var" && test -n "$perm_rpath"; then
692539713583Smrg	    # We should set the runpath_var.
692639713583Smrg	    rpath=
692739713583Smrg	    for dir in $perm_rpath; do
692839713583Smrg	      rpath="$rpath$dir:"
692939713583Smrg	    done
693039713583Smrg	    eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var"
693139713583Smrg	  fi
693239713583Smrg	  test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs"
693339713583Smrg	fi
693495b296d0Smrg
693539713583Smrg	shlibpath="$finalize_shlibpath"
693639713583Smrg	test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath"
693739713583Smrg	if test -n "$shlibpath"; then
693839713583Smrg	  eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var"
693939713583Smrg	fi
694095b296d0Smrg
694139713583Smrg	# Get the real and link names of the library.
694239713583Smrg	eval shared_ext=\"$shrext_cmds\"
694339713583Smrg	eval library_names=\"$library_names_spec\"
694439713583Smrg	set dummy $library_names
694539713583Smrg	shift
694639713583Smrg	realname="$1"
694739713583Smrg	shift
694895b296d0Smrg
694939713583Smrg	if test -n "$soname_spec"; then
695039713583Smrg	  eval soname=\"$soname_spec\"
695139713583Smrg	else
695239713583Smrg	  soname="$realname"
695339713583Smrg	fi
695439713583Smrg	if test -z "$dlname"; then
695539713583Smrg	  dlname=$soname
695639713583Smrg	fi
695795b296d0Smrg
695839713583Smrg	lib="$output_objdir/$realname"
695939713583Smrg	linknames=
696039713583Smrg	for link
696139713583Smrg	do
696239713583Smrg	  linknames="$linknames $link"
696339713583Smrg	done
696495b296d0Smrg
696539713583Smrg	# Use standard objects if they are pic
696639713583Smrg	test -z "$pic_flag" && libobjs=`$ECHO "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
696739713583Smrg	test "X$libobjs" = "X " && libobjs=
696895b296d0Smrg
696939713583Smrg	delfiles=
697039713583Smrg	if test -n "$export_symbols" && test -n "$include_expsyms"; then
697139713583Smrg	  $opt_dry_run || cp "$export_symbols" "$output_objdir/$libname.uexp"
697239713583Smrg	  export_symbols="$output_objdir/$libname.uexp"
697339713583Smrg	  delfiles="$delfiles $export_symbols"
697439713583Smrg	fi
697595b296d0Smrg
697639713583Smrg	orig_export_symbols=
697739713583Smrg	case $host_os in
697839713583Smrg	cygwin* | mingw* | cegcc*)
697939713583Smrg	  if test -n "$export_symbols" && test -z "$export_symbols_regex"; then
698039713583Smrg	    # exporting using user supplied symfile
698139713583Smrg	    if test "x`$SED 1q $export_symbols`" != xEXPORTS; then
698239713583Smrg	      # and it's NOT already a .def file. Must figure out
698339713583Smrg	      # which of the given symbols are data symbols and tag
698439713583Smrg	      # them as such. So, trigger use of export_symbols_cmds.
698539713583Smrg	      # export_symbols gets reassigned inside the "prepare
698639713583Smrg	      # the list of exported symbols" if statement, so the
698739713583Smrg	      # include_expsyms logic still works.
698839713583Smrg	      orig_export_symbols="$export_symbols"
698939713583Smrg	      export_symbols=
699039713583Smrg	      always_export_symbols=yes
699139713583Smrg	    fi
699239713583Smrg	  fi
699339713583Smrg	  ;;
699439713583Smrg	esac
699595b296d0Smrg
699639713583Smrg	# Prepare the list of exported symbols
699739713583Smrg	if test -z "$export_symbols"; then
699839713583Smrg	  if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then
699939713583Smrg	    func_verbose "generating symbol list for \`$libname.la'"
700039713583Smrg	    export_symbols="$output_objdir/$libname.exp"
700139713583Smrg	    $opt_dry_run || $RM $export_symbols
700239713583Smrg	    cmds=$export_symbols_cmds
700339713583Smrg	    save_ifs="$IFS"; IFS='~'
700439713583Smrg	    for cmd in $cmds; do
700539713583Smrg	      IFS="$save_ifs"
700639713583Smrg	      eval cmd=\"$cmd\"
700739713583Smrg	      func_len " $cmd"
700839713583Smrg	      len=$func_len_result
700939713583Smrg	      if test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then
701039713583Smrg		func_show_eval "$cmd" 'exit $?'
701139713583Smrg		skipped_export=false
701239713583Smrg	      else
701339713583Smrg		# The command line is too long to execute in one step.
701439713583Smrg		func_verbose "using reloadable object file for export list..."
701539713583Smrg		skipped_export=:
701639713583Smrg		# Break out early, otherwise skipped_export may be
701739713583Smrg		# set to false by a later but shorter cmd.
701839713583Smrg		break
701939713583Smrg	      fi
702039713583Smrg	    done
702139713583Smrg	    IFS="$save_ifs"
702239713583Smrg	    if test -n "$export_symbols_regex" && test "X$skipped_export" != "X:"; then
702339713583Smrg	      func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
702439713583Smrg	      func_show_eval '$MV "${export_symbols}T" "$export_symbols"'
702539713583Smrg	    fi
702639713583Smrg	  fi
702795b296d0Smrg	fi
702895b296d0Smrg
702939713583Smrg	if test -n "$export_symbols" && test -n "$include_expsyms"; then
703039713583Smrg	  tmp_export_symbols="$export_symbols"
703139713583Smrg	  test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols"
703239713583Smrg	  $opt_dry_run || eval '$ECHO "X$include_expsyms" | $Xsed | $SP2NL >> "$tmp_export_symbols"'
703339713583Smrg	fi
703495b296d0Smrg
703539713583Smrg	if test "X$skipped_export" != "X:" && test -n "$orig_export_symbols"; then
703639713583Smrg	  # The given exports_symbols file has to be filtered, so filter it.
703739713583Smrg	  func_verbose "filter symbol list for \`$libname.la' to tag DATA exports"
703839713583Smrg	  # FIXME: $output_objdir/$libname.filter potentially contains lots of
703939713583Smrg	  # 's' commands which not all seds can handle. GNU sed should be fine
704039713583Smrg	  # though. Also, the filter scales superlinearly with the number of
704139713583Smrg	  # global variables. join(1) would be nice here, but unfortunately
704239713583Smrg	  # isn't a blessed tool.
704339713583Smrg	  $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter
704439713583Smrg	  delfiles="$delfiles $export_symbols $output_objdir/$libname.filter"
704539713583Smrg	  export_symbols=$output_objdir/$libname.def
704639713583Smrg	  $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols
704739713583Smrg	fi
704895b296d0Smrg
704939713583Smrg	tmp_deplibs=
705039713583Smrg	for test_deplib in $deplibs; do
705139713583Smrg	  case " $convenience " in
705239713583Smrg	  *" $test_deplib "*) ;;
705339713583Smrg	  *)
705439713583Smrg	    tmp_deplibs="$tmp_deplibs $test_deplib"
705539713583Smrg	    ;;
705639713583Smrg	  esac
705739713583Smrg	done
705839713583Smrg	deplibs="$tmp_deplibs"
705995b296d0Smrg
706039713583Smrg	if test -n "$convenience"; then
706139713583Smrg	  if test -n "$whole_archive_flag_spec" &&
706239713583Smrg	    test "$compiler_needs_object" = yes &&
706339713583Smrg	    test -z "$libobjs"; then
706439713583Smrg	    # extract the archives, so we have objects to list.
706539713583Smrg	    # TODO: could optimize this to just extract one archive.
706639713583Smrg	    whole_archive_flag_spec=
706739713583Smrg	  fi
706839713583Smrg	  if test -n "$whole_archive_flag_spec"; then
706939713583Smrg	    save_libobjs=$libobjs
707039713583Smrg	    eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
707139713583Smrg	    test "X$libobjs" = "X " && libobjs=
707239713583Smrg	  else
707339713583Smrg	    gentop="$output_objdir/${outputname}x"
707439713583Smrg	    generated="$generated $gentop"
707595b296d0Smrg
707639713583Smrg	    func_extract_archives $gentop $convenience
707739713583Smrg	    libobjs="$libobjs $func_extract_archives_result"
707839713583Smrg	    test "X$libobjs" = "X " && libobjs=
707939713583Smrg	  fi
708095b296d0Smrg	fi
708195b296d0Smrg
708239713583Smrg	if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then
708339713583Smrg	  eval flag=\"$thread_safe_flag_spec\"
708439713583Smrg	  linker_flags="$linker_flags $flag"
708595b296d0Smrg	fi
708695b296d0Smrg
708739713583Smrg	# Make a backup of the uninstalled library when relinking
708839713583Smrg	if test "$mode" = relink; then
708939713583Smrg	  $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}U && $MV $realname ${realname}U)' || exit $?
709039713583Smrg	fi
709195b296d0Smrg
709239713583Smrg	# Do each of the archive commands.
709339713583Smrg	if test "$module" = yes && test -n "$module_cmds" ; then
709439713583Smrg	  if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
709539713583Smrg	    eval test_cmds=\"$module_expsym_cmds\"
709639713583Smrg	    cmds=$module_expsym_cmds
709739713583Smrg	  else
709839713583Smrg	    eval test_cmds=\"$module_cmds\"
709939713583Smrg	    cmds=$module_cmds
710039713583Smrg	  fi
710195b296d0Smrg	else
710239713583Smrg	  if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
710339713583Smrg	    eval test_cmds=\"$archive_expsym_cmds\"
710439713583Smrg	    cmds=$archive_expsym_cmds
710539713583Smrg	  else
710639713583Smrg	    eval test_cmds=\"$archive_cmds\"
710739713583Smrg	    cmds=$archive_cmds
710839713583Smrg	  fi
710995b296d0Smrg	fi
711095b296d0Smrg
711139713583Smrg	if test "X$skipped_export" != "X:" &&
711239713583Smrg	   func_len " $test_cmds" &&
711339713583Smrg	   len=$func_len_result &&
711439713583Smrg	   test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then
711539713583Smrg	  :
711639713583Smrg	else
711739713583Smrg	  # The command line is too long to link in one step, link piecewise
711839713583Smrg	  # or, if using GNU ld and skipped_export is not :, use a linker
711939713583Smrg	  # script.
712095b296d0Smrg
712139713583Smrg	  # Save the value of $output and $libobjs because we want to
712239713583Smrg	  # use them later.  If we have whole_archive_flag_spec, we
712339713583Smrg	  # want to use save_libobjs as it was before
712439713583Smrg	  # whole_archive_flag_spec was expanded, because we can't
712539713583Smrg	  # assume the linker understands whole_archive_flag_spec.
712639713583Smrg	  # This may have to be revisited, in case too many
712739713583Smrg	  # convenience libraries get linked in and end up exceeding
712839713583Smrg	  # the spec.
712939713583Smrg	  if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then
713039713583Smrg	    save_libobjs=$libobjs
713139713583Smrg	  fi
713239713583Smrg	  save_output=$output
713339713583Smrg	  output_la=`$ECHO "X$output" | $Xsed -e "$basename"`
713495b296d0Smrg
713539713583Smrg	  # Clear the reloadable object creation command queue and
713639713583Smrg	  # initialize k to one.
713739713583Smrg	  test_cmds=
713839713583Smrg	  concat_cmds=
713939713583Smrg	  objlist=
714039713583Smrg	  last_robj=
714139713583Smrg	  k=1
714239713583Smrg
714339713583Smrg	  if test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "$with_gnu_ld" = yes; then
714439713583Smrg	    output=${output_objdir}/${output_la}.lnkscript
714539713583Smrg	    func_verbose "creating GNU ld script: $output"
714639713583Smrg	    $ECHO 'INPUT (' > $output
714739713583Smrg	    for obj in $save_libobjs
714895b296d0Smrg	    do
714939713583Smrg	      $ECHO "$obj" >> $output
715039713583Smrg	    done
715139713583Smrg	    $ECHO ')' >> $output
715239713583Smrg	    delfiles="$delfiles $output"
715339713583Smrg	  elif test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "X$file_list_spec" != X; then
715439713583Smrg	    output=${output_objdir}/${output_la}.lnk
715539713583Smrg	    func_verbose "creating linker input file list: $output"
715639713583Smrg	    : > $output
715739713583Smrg	    set x $save_libobjs
715839713583Smrg	    shift
715939713583Smrg	    firstobj=
716039713583Smrg	    if test "$compiler_needs_object" = yes; then
716139713583Smrg	      firstobj="$1 "
716239713583Smrg	      shift
716339713583Smrg	    fi
716439713583Smrg	    for obj
716539713583Smrg	    do
716639713583Smrg	      $ECHO "$obj" >> $output
716739713583Smrg	    done
716839713583Smrg	    delfiles="$delfiles $output"
716939713583Smrg	    output=$firstobj\"$file_list_spec$output\"
717039713583Smrg	  else
717139713583Smrg	    if test -n "$save_libobjs"; then
717239713583Smrg	      func_verbose "creating reloadable object files..."
717339713583Smrg	      output=$output_objdir/$output_la-${k}.$objext
717439713583Smrg	      eval test_cmds=\"$reload_cmds\"
717539713583Smrg	      func_len " $test_cmds"
717639713583Smrg	      len0=$func_len_result
717739713583Smrg	      len=$len0
717839713583Smrg
717939713583Smrg	      # Loop over the list of objects to be linked.
718039713583Smrg	      for obj in $save_libobjs
718139713583Smrg	      do
718239713583Smrg		func_len " $obj"
718339713583Smrg		func_arith $len + $func_len_result
718439713583Smrg		len=$func_arith_result
718539713583Smrg		if test "X$objlist" = X ||
718639713583Smrg		   test "$len" -lt "$max_cmd_len"; then
718739713583Smrg		  func_append objlist " $obj"
718839713583Smrg		else
718939713583Smrg		  # The command $test_cmds is almost too long, add a
719039713583Smrg		  # command to the queue.
719139713583Smrg		  if test "$k" -eq 1 ; then
719239713583Smrg		    # The first file doesn't have a previous command to add.
719339713583Smrg		    eval concat_cmds=\"$reload_cmds $objlist $last_robj\"
719439713583Smrg		  else
719539713583Smrg		    # All subsequent reloadable object files will link in
719639713583Smrg		    # the last one created.
719739713583Smrg		    eval concat_cmds=\"\$concat_cmds~$reload_cmds $objlist $last_robj~\$RM $last_robj\"
719839713583Smrg		  fi
719939713583Smrg		  last_robj=$output_objdir/$output_la-${k}.$objext
720039713583Smrg		  func_arith $k + 1
720139713583Smrg		  k=$func_arith_result
720239713583Smrg		  output=$output_objdir/$output_la-${k}.$objext
720339713583Smrg		  objlist=$obj
720439713583Smrg		  func_len " $last_robj"
720539713583Smrg		  func_arith $len0 + $func_len_result
720639713583Smrg		  len=$func_arith_result
720739713583Smrg		fi
720839713583Smrg	      done
720939713583Smrg	      # Handle the remaining objects by creating one last
721039713583Smrg	      # reloadable object file.  All subsequent reloadable object
721139713583Smrg	      # files will link in the last one created.
721239713583Smrg	      test -z "$concat_cmds" || concat_cmds=$concat_cmds~
721339713583Smrg	      eval concat_cmds=\"\${concat_cmds}$reload_cmds $objlist $last_robj\"
721439713583Smrg	      if test -n "$last_robj"; then
721539713583Smrg	        eval concat_cmds=\"\${concat_cmds}~\$RM $last_robj\"
721639713583Smrg	      fi
721739713583Smrg	      delfiles="$delfiles $output"
721895b296d0Smrg
721939713583Smrg	    else
722039713583Smrg	      output=
722139713583Smrg	    fi
722295b296d0Smrg
722339713583Smrg	    if ${skipped_export-false}; then
722439713583Smrg	      func_verbose "generating symbol list for \`$libname.la'"
722539713583Smrg	      export_symbols="$output_objdir/$libname.exp"
722639713583Smrg	      $opt_dry_run || $RM $export_symbols
722739713583Smrg	      libobjs=$output
722839713583Smrg	      # Append the command to create the export file.
722939713583Smrg	      test -z "$concat_cmds" || concat_cmds=$concat_cmds~
723039713583Smrg	      eval concat_cmds=\"\$concat_cmds$export_symbols_cmds\"
723139713583Smrg	      if test -n "$last_robj"; then
723239713583Smrg		eval concat_cmds=\"\$concat_cmds~\$RM $last_robj\"
723339713583Smrg	      fi
723495b296d0Smrg	    fi
723595b296d0Smrg
723639713583Smrg	    test -n "$save_libobjs" &&
723739713583Smrg	      func_verbose "creating a temporary reloadable object file: $output"
723895b296d0Smrg
723939713583Smrg	    # Loop through the commands generated above and execute them.
724039713583Smrg	    save_ifs="$IFS"; IFS='~'
724139713583Smrg	    for cmd in $concat_cmds; do
724239713583Smrg	      IFS="$save_ifs"
724339713583Smrg	      $opt_silent || {
724439713583Smrg		  func_quote_for_expand "$cmd"
724539713583Smrg		  eval "func_echo $func_quote_for_expand_result"
724639713583Smrg	      }
724739713583Smrg	      $opt_dry_run || eval "$cmd" || {
724839713583Smrg		lt_exit=$?
724939713583Smrg
725039713583Smrg		# Restore the uninstalled library and exit
725139713583Smrg		if test "$mode" = relink; then
725239713583Smrg		  ( cd "$output_objdir" && \
725339713583Smrg		    $RM "${realname}T" && \
725439713583Smrg		    $MV "${realname}U" "$realname" )
725539713583Smrg		fi
725695b296d0Smrg
725739713583Smrg		exit $lt_exit
725839713583Smrg	      }
725939713583Smrg	    done
726039713583Smrg	    IFS="$save_ifs"
726195b296d0Smrg
726239713583Smrg	    if test -n "$export_symbols_regex" && ${skipped_export-false}; then
726339713583Smrg	      func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
726439713583Smrg	      func_show_eval '$MV "${export_symbols}T" "$export_symbols"'
726595b296d0Smrg	    fi
726695b296d0Smrg	  fi
726795b296d0Smrg
726839713583Smrg          if ${skipped_export-false}; then
726939713583Smrg	    if test -n "$export_symbols" && test -n "$include_expsyms"; then
727039713583Smrg	      tmp_export_symbols="$export_symbols"
727139713583Smrg	      test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols"
727239713583Smrg	      $opt_dry_run || eval '$ECHO "X$include_expsyms" | $Xsed | $SP2NL >> "$tmp_export_symbols"'
727339713583Smrg	    fi
727495b296d0Smrg
727539713583Smrg	    if test -n "$orig_export_symbols"; then
727639713583Smrg	      # The given exports_symbols file has to be filtered, so filter it.
727739713583Smrg	      func_verbose "filter symbol list for \`$libname.la' to tag DATA exports"
727839713583Smrg	      # FIXME: $output_objdir/$libname.filter potentially contains lots of
727939713583Smrg	      # 's' commands which not all seds can handle. GNU sed should be fine
728039713583Smrg	      # though. Also, the filter scales superlinearly with the number of
728139713583Smrg	      # global variables. join(1) would be nice here, but unfortunately
728239713583Smrg	      # isn't a blessed tool.
728339713583Smrg	      $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter
728439713583Smrg	      delfiles="$delfiles $export_symbols $output_objdir/$libname.filter"
728539713583Smrg	      export_symbols=$output_objdir/$libname.def
728639713583Smrg	      $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols
728739713583Smrg	    fi
728839713583Smrg	  fi
728995b296d0Smrg
729039713583Smrg	  libobjs=$output
729139713583Smrg	  # Restore the value of output.
729239713583Smrg	  output=$save_output
729395b296d0Smrg
729439713583Smrg	  if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then
729539713583Smrg	    eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
729639713583Smrg	    test "X$libobjs" = "X " && libobjs=
729739713583Smrg	  fi
729839713583Smrg	  # Expand the library linking commands again to reset the
729939713583Smrg	  # value of $libobjs for piecewise linking.
730095b296d0Smrg
730139713583Smrg	  # Do each of the archive commands.
730239713583Smrg	  if test "$module" = yes && test -n "$module_cmds" ; then
730339713583Smrg	    if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
730439713583Smrg	      cmds=$module_expsym_cmds
730539713583Smrg	    else
730639713583Smrg	      cmds=$module_cmds
730795b296d0Smrg	    fi
730895b296d0Smrg	  else
730939713583Smrg	    if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
731039713583Smrg	      cmds=$archive_expsym_cmds
731139713583Smrg	    else
731239713583Smrg	      cmds=$archive_cmds
731339713583Smrg	    fi
731495b296d0Smrg	  fi
731539713583Smrg	fi
731695b296d0Smrg
731739713583Smrg	if test -n "$delfiles"; then
731839713583Smrg	  # Append the command to remove temporary files to $cmds.
731939713583Smrg	  eval cmds=\"\$cmds~\$RM $delfiles\"
732039713583Smrg	fi
732195b296d0Smrg
732239713583Smrg	# Add any objects from preloaded convenience libraries
732339713583Smrg	if test -n "$dlprefiles"; then
732439713583Smrg	  gentop="$output_objdir/${outputname}x"
732539713583Smrg	  generated="$generated $gentop"
732695b296d0Smrg
732739713583Smrg	  func_extract_archives $gentop $dlprefiles
732839713583Smrg	  libobjs="$libobjs $func_extract_archives_result"
732939713583Smrg	  test "X$libobjs" = "X " && libobjs=
733039713583Smrg	fi
733195b296d0Smrg
733239713583Smrg	save_ifs="$IFS"; IFS='~'
733339713583Smrg	for cmd in $cmds; do
733439713583Smrg	  IFS="$save_ifs"
733539713583Smrg	  eval cmd=\"$cmd\"
733639713583Smrg	  $opt_silent || {
733739713583Smrg	    func_quote_for_expand "$cmd"
733839713583Smrg	    eval "func_echo $func_quote_for_expand_result"
733939713583Smrg	  }
734039713583Smrg	  $opt_dry_run || eval "$cmd" || {
734139713583Smrg	    lt_exit=$?
734295b296d0Smrg
734339713583Smrg	    # Restore the uninstalled library and exit
734439713583Smrg	    if test "$mode" = relink; then
734539713583Smrg	      ( cd "$output_objdir" && \
734639713583Smrg	        $RM "${realname}T" && \
734739713583Smrg		$MV "${realname}U" "$realname" )
734839713583Smrg	    fi
734995b296d0Smrg
735039713583Smrg	    exit $lt_exit
735139713583Smrg	  }
735239713583Smrg	done
735339713583Smrg	IFS="$save_ifs"
735495b296d0Smrg
735539713583Smrg	# Restore the uninstalled library and exit
735639713583Smrg	if test "$mode" = relink; then
735739713583Smrg	  $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}T && $MV $realname ${realname}T && $MV ${realname}U $realname)' || exit $?
735895b296d0Smrg
735939713583Smrg	  if test -n "$convenience"; then
736039713583Smrg	    if test -z "$whole_archive_flag_spec"; then
736139713583Smrg	      func_show_eval '${RM}r "$gentop"'
736239713583Smrg	    fi
736339713583Smrg	  fi
736495b296d0Smrg
736539713583Smrg	  exit $EXIT_SUCCESS
736639713583Smrg	fi
736739713583Smrg
736839713583Smrg	# Create links to the real library.
736939713583Smrg	for linkname in $linknames; do
737039713583Smrg	  if test "$realname" != "$linkname"; then
737139713583Smrg	    func_show_eval '(cd "$output_objdir" && $RM "$linkname" && $LN_S "$realname" "$linkname")' 'exit $?'
737295b296d0Smrg	  fi
737395b296d0Smrg	done
737495b296d0Smrg
737539713583Smrg	# If -module or -export-dynamic was specified, set the dlname.
737639713583Smrg	if test "$module" = yes || test "$export_dynamic" = yes; then
737739713583Smrg	  # On all known operating systems, these are identical.
737839713583Smrg	  dlname="$soname"
737939713583Smrg	fi
738039713583Smrg      fi
738195b296d0Smrg      ;;
738295b296d0Smrg
738339713583Smrg    obj)
738439713583Smrg      if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
738539713583Smrg	func_warning "\`-dlopen' is ignored for objects"
738639713583Smrg      fi
738795b296d0Smrg
738839713583Smrg      case " $deplibs" in
738939713583Smrg      *\ -l* | *\ -L*)
739039713583Smrg	func_warning "\`-l' and \`-L' are ignored for objects" ;;
739195b296d0Smrg      esac
739295b296d0Smrg
739339713583Smrg      test -n "$rpath" && \
739439713583Smrg	func_warning "\`-rpath' is ignored for objects"
739539713583Smrg
739639713583Smrg      test -n "$xrpath" && \
739739713583Smrg	func_warning "\`-R' is ignored for objects"
739895b296d0Smrg
739939713583Smrg      test -n "$vinfo" && \
740039713583Smrg	func_warning "\`-version-info' is ignored for objects"
740195b296d0Smrg
740239713583Smrg      test -n "$release" && \
740339713583Smrg	func_warning "\`-release' is ignored for objects"
740439713583Smrg
740539713583Smrg      case $output in
740639713583Smrg      *.lo)
740739713583Smrg	test -n "$objs$old_deplibs" && \
740839713583Smrg	  func_fatal_error "cannot build library object \`$output' from non-libtool objects"
740939713583Smrg
741039713583Smrg	libobj=$output
741139713583Smrg	func_lo2o "$libobj"
741239713583Smrg	obj=$func_lo2o_result
741395b296d0Smrg	;;
741495b296d0Smrg      *)
741539713583Smrg	libobj=
741639713583Smrg	obj="$output"
741795b296d0Smrg	;;
741895b296d0Smrg      esac
741995b296d0Smrg
742039713583Smrg      # Delete the old objects.
742139713583Smrg      $opt_dry_run || $RM $obj $libobj
742295b296d0Smrg
742339713583Smrg      # Objects from convenience libraries.  This assumes
742439713583Smrg      # single-version convenience libraries.  Whenever we create
742539713583Smrg      # different ones for PIC/non-PIC, this we'll have to duplicate
742639713583Smrg      # the extraction.
742739713583Smrg      reload_conv_objs=
742839713583Smrg      gentop=
742939713583Smrg      # reload_cmds runs $LD directly, so let us get rid of
743039713583Smrg      # -Wl from whole_archive_flag_spec and hope we can get by with
743139713583Smrg      # turning comma into space..
743239713583Smrg      wl=
743395b296d0Smrg
743439713583Smrg      if test -n "$convenience"; then
743539713583Smrg	if test -n "$whole_archive_flag_spec"; then
743639713583Smrg	  eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\"
743739713583Smrg	  reload_conv_objs=$reload_objs\ `$ECHO "X$tmp_whole_archive_flags" | $Xsed -e 's|,| |g'`
743839713583Smrg	else
743939713583Smrg	  gentop="$output_objdir/${obj}x"
744039713583Smrg	  generated="$generated $gentop"
744195b296d0Smrg
744239713583Smrg	  func_extract_archives $gentop $convenience
744339713583Smrg	  reload_conv_objs="$reload_objs $func_extract_archives_result"
744439713583Smrg	fi
744595b296d0Smrg      fi
744695b296d0Smrg
744739713583Smrg      # Create the old-style object.
744839713583Smrg      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
744995b296d0Smrg
745039713583Smrg      output="$obj"
745139713583Smrg      func_execute_cmds "$reload_cmds" 'exit $?'
745295b296d0Smrg
745339713583Smrg      # Exit if we aren't doing a library object file.
745439713583Smrg      if test -z "$libobj"; then
745539713583Smrg	if test -n "$gentop"; then
745639713583Smrg	  func_show_eval '${RM}r "$gentop"'
745739713583Smrg	fi
745839713583Smrg
745939713583Smrg	exit $EXIT_SUCCESS
746095b296d0Smrg      fi
746139713583Smrg
746239713583Smrg      if test "$build_libtool_libs" != yes; then
746339713583Smrg	if test -n "$gentop"; then
746439713583Smrg	  func_show_eval '${RM}r "$gentop"'
746539713583Smrg	fi
746639713583Smrg
746739713583Smrg	# Create an invalid libtool object if no PIC, so that we don't
746839713583Smrg	# accidentally link it into a program.
746939713583Smrg	# $show "echo timestamp > $libobj"
747039713583Smrg	# $opt_dry_run || eval "echo timestamp > $libobj" || exit $?
747139713583Smrg	exit $EXIT_SUCCESS
747239713583Smrg      fi
747339713583Smrg
747439713583Smrg      if test -n "$pic_flag" || test "$pic_mode" != default; then
747539713583Smrg	# Only do commands if we really have different PIC objects.
747639713583Smrg	reload_objs="$libobjs $reload_conv_objs"
747739713583Smrg	output="$libobj"
747839713583Smrg	func_execute_cmds "$reload_cmds" 'exit $?'
747939713583Smrg      fi
748039713583Smrg
748139713583Smrg      if test -n "$gentop"; then
748239713583Smrg	func_show_eval '${RM}r "$gentop"'
748339713583Smrg      fi
748439713583Smrg
748539713583Smrg      exit $EXIT_SUCCESS
748695b296d0Smrg      ;;
748795b296d0Smrg
748839713583Smrg    prog)
748939713583Smrg      case $host in
749039713583Smrg	*cygwin*) func_stripname '' '.exe' "$output"
749139713583Smrg	          output=$func_stripname_result.exe;;
749239713583Smrg      esac
749339713583Smrg      test -n "$vinfo" && \
749439713583Smrg	func_warning "\`-version-info' is ignored for programs"
749595b296d0Smrg
749639713583Smrg      test -n "$release" && \
749739713583Smrg	func_warning "\`-release' is ignored for programs"
749895b296d0Smrg
749939713583Smrg      test "$preload" = yes \
750039713583Smrg        && test "$dlopen_support" = unknown \
750139713583Smrg	&& test "$dlopen_self" = unknown \
750239713583Smrg	&& test "$dlopen_self_static" = unknown && \
750339713583Smrg	  func_warning "\`LT_INIT([dlopen])' not used. Assuming no dlopen support."
750439713583Smrg
750539713583Smrg      case $host in
750639713583Smrg      *-*-rhapsody* | *-*-darwin1.[012])
750739713583Smrg	# On Rhapsody replace the C library is the System framework
750839713583Smrg	compile_deplibs=`$ECHO "X $compile_deplibs" | $Xsed -e 's/ -lc / System.ltframework /'`
750939713583Smrg	finalize_deplibs=`$ECHO "X $finalize_deplibs" | $Xsed -e 's/ -lc / System.ltframework /'`
751095b296d0Smrg	;;
751139713583Smrg      esac
751295b296d0Smrg
751339713583Smrg      case $host in
751439713583Smrg      *-*-darwin*)
751539713583Smrg	# Don't allow lazy linking, it breaks C++ global constructors
751639713583Smrg	# But is supposedly fixed on 10.4 or later (yay!).
751739713583Smrg	if test "$tagname" = CXX ; then
751839713583Smrg	  case ${MACOSX_DEPLOYMENT_TARGET-10.0} in
751939713583Smrg	    10.[0123])
752039713583Smrg	      compile_command="$compile_command ${wl}-bind_at_load"
752139713583Smrg	      finalize_command="$finalize_command ${wl}-bind_at_load"
752239713583Smrg	    ;;
752339713583Smrg	  esac
752495b296d0Smrg	fi
752539713583Smrg	# Time to change all our "foo.ltframework" stuff back to "-framework foo"
752639713583Smrg	compile_deplibs=`$ECHO "X $compile_deplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'`
752739713583Smrg	finalize_deplibs=`$ECHO "X $finalize_deplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'`
752839713583Smrg	;;
752939713583Smrg      esac
753095b296d0Smrg
753195b296d0Smrg
753239713583Smrg      # move library search paths that coincide with paths to not yet
753339713583Smrg      # installed libraries to the beginning of the library search list
753439713583Smrg      new_libs=
753539713583Smrg      for path in $notinst_path; do
753639713583Smrg	case " $new_libs " in
753739713583Smrg	*" -L$path/$objdir "*) ;;
753839713583Smrg	*)
753939713583Smrg	  case " $compile_deplibs " in
754039713583Smrg	  *" -L$path/$objdir "*)
754139713583Smrg	    new_libs="$new_libs -L$path/$objdir" ;;
754295b296d0Smrg	  esac
754339713583Smrg	  ;;
754439713583Smrg	esac
754539713583Smrg      done
754639713583Smrg      for deplib in $compile_deplibs; do
754739713583Smrg	case $deplib in
754839713583Smrg	-L*)
754939713583Smrg	  case " $new_libs " in
755039713583Smrg	  *" $deplib "*) ;;
755139713583Smrg	  *) new_libs="$new_libs $deplib" ;;
755295b296d0Smrg	  esac
755339713583Smrg	  ;;
755439713583Smrg	*) new_libs="$new_libs $deplib" ;;
755539713583Smrg	esac
755639713583Smrg      done
755739713583Smrg      compile_deplibs="$new_libs"
755895b296d0Smrg
755995b296d0Smrg
756039713583Smrg      compile_command="$compile_command $compile_deplibs"
756139713583Smrg      finalize_command="$finalize_command $finalize_deplibs"
756295b296d0Smrg
756339713583Smrg      if test -n "$rpath$xrpath"; then
756439713583Smrg	# If the user specified any rpath flags, then add them.
756539713583Smrg	for libdir in $rpath $xrpath; do
756639713583Smrg	  # This is the magic to use -rpath.
756739713583Smrg	  case "$finalize_rpath " in
756839713583Smrg	  *" $libdir "*) ;;
756939713583Smrg	  *) finalize_rpath="$finalize_rpath $libdir" ;;
757039713583Smrg	  esac
757139713583Smrg	done
757239713583Smrg      fi
757395b296d0Smrg
757439713583Smrg      # Now hardcode the library paths
757539713583Smrg      rpath=
757639713583Smrg      hardcode_libdirs=
757739713583Smrg      for libdir in $compile_rpath $finalize_rpath; do
757839713583Smrg	if test -n "$hardcode_libdir_flag_spec"; then
757939713583Smrg	  if test -n "$hardcode_libdir_separator"; then
758039713583Smrg	    if test -z "$hardcode_libdirs"; then
758139713583Smrg	      hardcode_libdirs="$libdir"
758239713583Smrg	    else
758339713583Smrg	      # Just accumulate the unique libdirs.
758439713583Smrg	      case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
758539713583Smrg	      *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
758639713583Smrg		;;
758739713583Smrg	      *)
758839713583Smrg		hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
758939713583Smrg		;;
759039713583Smrg	      esac
759139713583Smrg	    fi
759295b296d0Smrg	  else
759339713583Smrg	    eval flag=\"$hardcode_libdir_flag_spec\"
759439713583Smrg	    rpath="$rpath $flag"
759595b296d0Smrg	  fi
759639713583Smrg	elif test -n "$runpath_var"; then
759739713583Smrg	  case "$perm_rpath " in
759839713583Smrg	  *" $libdir "*) ;;
759939713583Smrg	  *) perm_rpath="$perm_rpath $libdir" ;;
760039713583Smrg	  esac
760139713583Smrg	fi
760239713583Smrg	case $host in
760339713583Smrg	*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
760439713583Smrg	  testbindir=`${ECHO} "$libdir" | ${SED} -e 's*/lib$*/bin*'`
760539713583Smrg	  case :$dllsearchpath: in
760639713583Smrg	  *":$libdir:"*) ;;
760739713583Smrg	  ::) dllsearchpath=$libdir;;
760839713583Smrg	  *) dllsearchpath="$dllsearchpath:$libdir";;
760939713583Smrg	  esac
761039713583Smrg	  case :$dllsearchpath: in
761139713583Smrg	  *":$testbindir:"*) ;;
761239713583Smrg	  ::) dllsearchpath=$testbindir;;
761339713583Smrg	  *) dllsearchpath="$dllsearchpath:$testbindir";;
761439713583Smrg	  esac
761539713583Smrg	  ;;
761639713583Smrg	esac
761739713583Smrg      done
761839713583Smrg      # Substitute the hardcoded libdirs into the rpath.
761939713583Smrg      if test -n "$hardcode_libdir_separator" &&
762039713583Smrg	 test -n "$hardcode_libdirs"; then
762139713583Smrg	libdir="$hardcode_libdirs"
762239713583Smrg	eval rpath=\" $hardcode_libdir_flag_spec\"
762339713583Smrg      fi
762439713583Smrg      compile_rpath="$rpath"
762595b296d0Smrg
762639713583Smrg      rpath=
762739713583Smrg      hardcode_libdirs=
762839713583Smrg      for libdir in $finalize_rpath; do
762939713583Smrg	if test -n "$hardcode_libdir_flag_spec"; then
763039713583Smrg	  if test -n "$hardcode_libdir_separator"; then
763139713583Smrg	    if test -z "$hardcode_libdirs"; then
763239713583Smrg	      hardcode_libdirs="$libdir"
763339713583Smrg	    else
763439713583Smrg	      # Just accumulate the unique libdirs.
763539713583Smrg	      case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
763639713583Smrg	      *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
763739713583Smrg		;;
763839713583Smrg	      *)
763939713583Smrg		hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
764039713583Smrg		;;
764139713583Smrg	      esac
764239713583Smrg	    fi
764395b296d0Smrg	  else
764439713583Smrg	    eval flag=\"$hardcode_libdir_flag_spec\"
764539713583Smrg	    rpath="$rpath $flag"
764695b296d0Smrg	  fi
764739713583Smrg	elif test -n "$runpath_var"; then
764839713583Smrg	  case "$finalize_perm_rpath " in
764939713583Smrg	  *" $libdir "*) ;;
765039713583Smrg	  *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;;
765139713583Smrg	  esac
765295b296d0Smrg	fi
765339713583Smrg      done
765439713583Smrg      # Substitute the hardcoded libdirs into the rpath.
765539713583Smrg      if test -n "$hardcode_libdir_separator" &&
765639713583Smrg	 test -n "$hardcode_libdirs"; then
765739713583Smrg	libdir="$hardcode_libdirs"
765839713583Smrg	eval rpath=\" $hardcode_libdir_flag_spec\"
765939713583Smrg      fi
766039713583Smrg      finalize_rpath="$rpath"
766195b296d0Smrg
766239713583Smrg      if test -n "$libobjs" && test "$build_old_libs" = yes; then
766339713583Smrg	# Transform all the library objects into standard objects.
766439713583Smrg	compile_command=`$ECHO "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
766539713583Smrg	finalize_command=`$ECHO "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
766639713583Smrg      fi
766795b296d0Smrg
766839713583Smrg      func_generate_dlsyms "$outputname" "@PROGRAM@" "no"
766995b296d0Smrg
767039713583Smrg      # template prelinking step
767139713583Smrg      if test -n "$prelink_cmds"; then
767239713583Smrg	func_execute_cmds "$prelink_cmds" 'exit $?'
767339713583Smrg      fi
767495b296d0Smrg
767539713583Smrg      wrappers_required=yes
767639713583Smrg      case $host in
767739713583Smrg      *cygwin* | *mingw* )
767839713583Smrg        if test "$build_libtool_libs" != yes; then
767939713583Smrg          wrappers_required=no
768039713583Smrg        fi
768139713583Smrg        ;;
768239713583Smrg      *cegcc)
768339713583Smrg        # Disable wrappers for cegcc, we are cross compiling anyway.
768439713583Smrg        wrappers_required=no
768539713583Smrg        ;;
768639713583Smrg      *)
768739713583Smrg        if test "$need_relink" = no || test "$build_libtool_libs" != yes; then
768839713583Smrg          wrappers_required=no
768939713583Smrg        fi
769039713583Smrg        ;;
769139713583Smrg      esac
769239713583Smrg      if test "$wrappers_required" = no; then
769339713583Smrg	# Replace the output file specification.
769439713583Smrg	compile_command=`$ECHO "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
769539713583Smrg	link_command="$compile_command$compile_rpath"
769695b296d0Smrg
769739713583Smrg	# We have no uninstalled library dependencies, so finalize right now.
769839713583Smrg	exit_status=0
769939713583Smrg	func_show_eval "$link_command" 'exit_status=$?'
770095b296d0Smrg
770139713583Smrg	# Delete the generated files.
770239713583Smrg	if test -f "$output_objdir/${outputname}S.${objext}"; then
770339713583Smrg	  func_show_eval '$RM "$output_objdir/${outputname}S.${objext}"'
770495b296d0Smrg	fi
770595b296d0Smrg
770639713583Smrg	exit $exit_status
770739713583Smrg      fi
770895b296d0Smrg
770939713583Smrg      if test -n "$compile_shlibpath$finalize_shlibpath"; then
771039713583Smrg	compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command"
771139713583Smrg      fi
771239713583Smrg      if test -n "$finalize_shlibpath"; then
771339713583Smrg	finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command"
771439713583Smrg      fi
771595b296d0Smrg
771639713583Smrg      compile_var=
771739713583Smrg      finalize_var=
771839713583Smrg      if test -n "$runpath_var"; then
771939713583Smrg	if test -n "$perm_rpath"; then
772039713583Smrg	  # We should set the runpath_var.
772139713583Smrg	  rpath=
772239713583Smrg	  for dir in $perm_rpath; do
772339713583Smrg	    rpath="$rpath$dir:"
772439713583Smrg	  done
772539713583Smrg	  compile_var="$runpath_var=\"$rpath\$$runpath_var\" "
772695b296d0Smrg	fi
772739713583Smrg	if test -n "$finalize_perm_rpath"; then
772839713583Smrg	  # We should set the runpath_var.
772939713583Smrg	  rpath=
773039713583Smrg	  for dir in $finalize_perm_rpath; do
773139713583Smrg	    rpath="$rpath$dir:"
773239713583Smrg	  done
773339713583Smrg	  finalize_var="$runpath_var=\"$rpath\$$runpath_var\" "
773495b296d0Smrg	fi
773539713583Smrg      fi
773695b296d0Smrg
773739713583Smrg      if test "$no_install" = yes; then
773839713583Smrg	# We don't need to create a wrapper script.
773939713583Smrg	link_command="$compile_var$compile_command$compile_rpath"
774039713583Smrg	# Replace the output file specification.
774139713583Smrg	link_command=`$ECHO "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
774239713583Smrg	# Delete the old output file.
774339713583Smrg	$opt_dry_run || $RM $output
774439713583Smrg	# Link the executable and exit
774539713583Smrg	func_show_eval "$link_command" 'exit $?'
774695b296d0Smrg	exit $EXIT_SUCCESS
774739713583Smrg      fi
774895b296d0Smrg
774939713583Smrg      if test "$hardcode_action" = relink; then
775039713583Smrg	# Fast installation is not supported
775139713583Smrg	link_command="$compile_var$compile_command$compile_rpath"
775239713583Smrg	relink_command="$finalize_var$finalize_command$finalize_rpath"
775339713583Smrg
775439713583Smrg	func_warning "this platform does not like uninstalled shared libraries"
775539713583Smrg	func_warning "\`$output' will be relinked during installation"
775639713583Smrg      else
775739713583Smrg	if test "$fast_install" != no; then
775839713583Smrg	  link_command="$finalize_var$compile_command$finalize_rpath"
775939713583Smrg	  if test "$fast_install" = yes; then
776039713583Smrg	    relink_command=`$ECHO "X$compile_var$compile_command$compile_rpath" | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g'`
776139713583Smrg	  else
776239713583Smrg	    # fast_install is set to needless
776339713583Smrg	    relink_command=
776439713583Smrg	  fi
776595b296d0Smrg	else
776639713583Smrg	  link_command="$compile_var$compile_command$compile_rpath"
776739713583Smrg	  relink_command="$finalize_var$finalize_command$finalize_rpath"
776895b296d0Smrg	fi
776939713583Smrg      fi
777095b296d0Smrg
777139713583Smrg      # Replace the output file specification.
777239713583Smrg      link_command=`$ECHO "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`
777395b296d0Smrg
777439713583Smrg      # Delete the old output files.
777539713583Smrg      $opt_dry_run || $RM $output $output_objdir/$outputname $output_objdir/lt-$outputname
777695b296d0Smrg
777739713583Smrg      func_show_eval "$link_command" 'exit $?'
777895b296d0Smrg
777939713583Smrg      # Now create the wrapper script.
778039713583Smrg      func_verbose "creating $output"
778195b296d0Smrg
778239713583Smrg      # Quote the relink command for shipping.
778339713583Smrg      if test -n "$relink_command"; then
778439713583Smrg	# Preserve any variables that may affect compiler behavior
778539713583Smrg	for var in $variables_saved_for_relink; do
778639713583Smrg	  if eval test -z \"\${$var+set}\"; then
778739713583Smrg	    relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command"
778839713583Smrg	  elif eval var_value=\$$var; test -z "$var_value"; then
778939713583Smrg	    relink_command="$var=; export $var; $relink_command"
779095b296d0Smrg	  else
779139713583Smrg	    func_quote_for_eval "$var_value"
779239713583Smrg	    relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command"
779395b296d0Smrg	  fi
779439713583Smrg	done
779539713583Smrg	relink_command="(cd `pwd`; $relink_command)"
779639713583Smrg	relink_command=`$ECHO "X$relink_command" | $Xsed -e "$sed_quote_subst"`
779739713583Smrg      fi
779895b296d0Smrg
779939713583Smrg      # Quote $ECHO for shipping.
780039713583Smrg      if test "X$ECHO" = "X$SHELL $progpath --fallback-echo"; then
780139713583Smrg	case $progpath in
780239713583Smrg	[\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $progpath --fallback-echo";;
780339713583Smrg	*) qecho="$SHELL `pwd`/$progpath --fallback-echo";;
780439713583Smrg	esac
780539713583Smrg	qecho=`$ECHO "X$qecho" | $Xsed -e "$sed_quote_subst"`
780639713583Smrg      else
780739713583Smrg	qecho=`$ECHO "X$ECHO" | $Xsed -e "$sed_quote_subst"`
780839713583Smrg      fi
780939713583Smrg
781039713583Smrg      # Only actually do things if not in dry run mode.
781139713583Smrg      $opt_dry_run || {
781239713583Smrg	# win32 will think the script is a binary if it has
781339713583Smrg	# a .exe suffix, so we strip it off here.
781439713583Smrg	case $output in
781539713583Smrg	  *.exe) func_stripname '' '.exe' "$output"
781639713583Smrg	         output=$func_stripname_result ;;
781739713583Smrg	esac
781839713583Smrg	# test for cygwin because mv fails w/o .exe extensions
781939713583Smrg	case $host in
782039713583Smrg	  *cygwin*)
782139713583Smrg	    exeext=.exe
782239713583Smrg	    func_stripname '' '.exe' "$outputname"
782339713583Smrg	    outputname=$func_stripname_result ;;
782439713583Smrg	  *) exeext= ;;
782595b296d0Smrg	esac
782639713583Smrg	case $host in
782739713583Smrg	  *cygwin* | *mingw* )
782839713583Smrg	    func_dirname_and_basename "$output" "" "."
782939713583Smrg	    output_name=$func_basename_result
783039713583Smrg	    output_path=$func_dirname_result
783139713583Smrg	    cwrappersource="$output_path/$objdir/lt-$output_name.c"
783239713583Smrg	    cwrapper="$output_path/$output_name.exe"
783339713583Smrg	    $RM $cwrappersource $cwrapper
783439713583Smrg	    trap "$RM $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15
783539713583Smrg
783639713583Smrg	    func_emit_cwrapperexe_src > $cwrappersource
783739713583Smrg
783839713583Smrg	    # The wrapper executable is built using the $host compiler,
783939713583Smrg	    # because it contains $host paths and files. If cross-
784039713583Smrg	    # compiling, it, like the target executable, must be
784139713583Smrg	    # executed on the $host or under an emulation environment.
784239713583Smrg	    $opt_dry_run || {
784339713583Smrg	      $LTCC $LTCFLAGS -o $cwrapper $cwrappersource
784439713583Smrg	      $STRIP $cwrapper
784539713583Smrg	    }
784695b296d0Smrg
784739713583Smrg	    # Now, create the wrapper script for func_source use:
784839713583Smrg	    func_ltwrapper_scriptname $cwrapper
784939713583Smrg	    $RM $func_ltwrapper_scriptname_result
785039713583Smrg	    trap "$RM $func_ltwrapper_scriptname_result; exit $EXIT_FAILURE" 1 2 15
785139713583Smrg	    $opt_dry_run || {
785239713583Smrg	      # note: this script will not be executed, so do not chmod.
785339713583Smrg	      if test "x$build" = "x$host" ; then
785439713583Smrg		$cwrapper --lt-dump-script > $func_ltwrapper_scriptname_result
785539713583Smrg	      else
785639713583Smrg		func_emit_wrapper no > $func_ltwrapper_scriptname_result
785739713583Smrg	      fi
785839713583Smrg	    }
785939713583Smrg	  ;;
786039713583Smrg	  * )
786139713583Smrg	    $RM $output
786239713583Smrg	    trap "$RM $output; exit $EXIT_FAILURE" 1 2 15
786395b296d0Smrg
786439713583Smrg	    func_emit_wrapper no > $output
786539713583Smrg	    chmod +x $output
786639713583Smrg	  ;;
786739713583Smrg	esac
786839713583Smrg      }
786939713583Smrg      exit $EXIT_SUCCESS
787039713583Smrg      ;;
787139713583Smrg    esac
787295b296d0Smrg
787339713583Smrg    # See if we need to build an old-fashioned archive.
787439713583Smrg    for oldlib in $oldlibs; do
787595b296d0Smrg
787639713583Smrg      if test "$build_libtool_libs" = convenience; then
787739713583Smrg	oldobjs="$libobjs_save $symfileobj"
787839713583Smrg	addlibs="$convenience"
787939713583Smrg	build_libtool_libs=no
788039713583Smrg      else
788139713583Smrg	if test "$build_libtool_libs" = module; then
788239713583Smrg	  oldobjs="$libobjs_save"
788339713583Smrg	  build_libtool_libs=no
788439713583Smrg	else
788539713583Smrg	  oldobjs="$old_deplibs $non_pic_objects"
788639713583Smrg	  if test "$preload" = yes && test -f "$symfileobj"; then
788739713583Smrg	    oldobjs="$oldobjs $symfileobj"
788839713583Smrg	  fi
788939713583Smrg	fi
789039713583Smrg	addlibs="$old_convenience"
789195b296d0Smrg      fi
789295b296d0Smrg
789339713583Smrg      if test -n "$addlibs"; then
789439713583Smrg	gentop="$output_objdir/${outputname}x"
789539713583Smrg	generated="$generated $gentop"
789695b296d0Smrg
789739713583Smrg	func_extract_archives $gentop $addlibs
789839713583Smrg	oldobjs="$oldobjs $func_extract_archives_result"
789939713583Smrg      fi
790095b296d0Smrg
790139713583Smrg      # Do each command in the archive commands.
790239713583Smrg      if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then
790339713583Smrg	cmds=$old_archive_from_new_cmds
790439713583Smrg      else
790595b296d0Smrg
790639713583Smrg	# Add any objects from preloaded convenience libraries
790739713583Smrg	if test -n "$dlprefiles"; then
790839713583Smrg	  gentop="$output_objdir/${outputname}x"
790939713583Smrg	  generated="$generated $gentop"
791095b296d0Smrg
791139713583Smrg	  func_extract_archives $gentop $dlprefiles
791239713583Smrg	  oldobjs="$oldobjs $func_extract_archives_result"
791339713583Smrg	fi
791495b296d0Smrg
791539713583Smrg	# POSIX demands no paths to be encoded in archives.  We have
791639713583Smrg	# to avoid creating archives with duplicate basenames if we
791739713583Smrg	# might have to extract them afterwards, e.g., when creating a
791839713583Smrg	# static archive out of a convenience library, or when linking
791939713583Smrg	# the entirety of a libtool archive into another (currently
792039713583Smrg	# not supported by libtool).
792139713583Smrg	if (for obj in $oldobjs
792239713583Smrg	    do
792339713583Smrg	      func_basename "$obj"
792439713583Smrg	      $ECHO "$func_basename_result"
792539713583Smrg	    done | sort | sort -uc >/dev/null 2>&1); then
792639713583Smrg	  :
792739713583Smrg	else
792839713583Smrg	  $ECHO "copying selected object files to avoid basename conflicts..."
792939713583Smrg	  gentop="$output_objdir/${outputname}x"
793039713583Smrg	  generated="$generated $gentop"
793139713583Smrg	  func_mkdir_p "$gentop"
793239713583Smrg	  save_oldobjs=$oldobjs
793339713583Smrg	  oldobjs=
793439713583Smrg	  counter=1
793539713583Smrg	  for obj in $save_oldobjs
793639713583Smrg	  do
793739713583Smrg	    func_basename "$obj"
793839713583Smrg	    objbase="$func_basename_result"
793939713583Smrg	    case " $oldobjs " in
794039713583Smrg	    " ") oldobjs=$obj ;;
794139713583Smrg	    *[\ /]"$objbase "*)
794239713583Smrg	      while :; do
794339713583Smrg		# Make sure we don't pick an alternate name that also
794439713583Smrg		# overlaps.
794539713583Smrg		newobj=lt$counter-$objbase
794639713583Smrg		func_arith $counter + 1
794739713583Smrg		counter=$func_arith_result
794839713583Smrg		case " $oldobjs " in
794939713583Smrg		*[\ /]"$newobj "*) ;;
795039713583Smrg		*) if test ! -f "$gentop/$newobj"; then break; fi ;;
795139713583Smrg		esac
795239713583Smrg	      done
795339713583Smrg	      func_show_eval "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj"
795439713583Smrg	      oldobjs="$oldobjs $gentop/$newobj"
795539713583Smrg	      ;;
795639713583Smrg	    *) oldobjs="$oldobjs $obj" ;;
795739713583Smrg	    esac
795895b296d0Smrg	  done
795995b296d0Smrg	fi
796039713583Smrg	eval cmds=\"$old_archive_cmds\"
796195b296d0Smrg
796239713583Smrg	func_len " $cmds"
796339713583Smrg	len=$func_len_result
796439713583Smrg	if test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then
796539713583Smrg	  cmds=$old_archive_cmds
796639713583Smrg	else
796739713583Smrg	  # the command line is too long to link in one step, link in parts
796839713583Smrg	  func_verbose "using piecewise archive linking..."
796939713583Smrg	  save_RANLIB=$RANLIB
797039713583Smrg	  RANLIB=:
797139713583Smrg	  objlist=
797239713583Smrg	  concat_cmds=
797339713583Smrg	  save_oldobjs=$oldobjs
797439713583Smrg	  oldobjs=
797539713583Smrg	  # Is there a better way of finding the last object in the list?
797639713583Smrg	  for obj in $save_oldobjs
797739713583Smrg	  do
797839713583Smrg	    last_oldobj=$obj
797939713583Smrg	  done
798039713583Smrg	  eval test_cmds=\"$old_archive_cmds\"
798139713583Smrg	  func_len " $test_cmds"
798239713583Smrg	  len0=$func_len_result
798339713583Smrg	  len=$len0
798439713583Smrg	  for obj in $save_oldobjs
798539713583Smrg	  do
798639713583Smrg	    func_len " $obj"
798739713583Smrg	    func_arith $len + $func_len_result
798839713583Smrg	    len=$func_arith_result
798939713583Smrg	    func_append objlist " $obj"
799039713583Smrg	    if test "$len" -lt "$max_cmd_len"; then
799139713583Smrg	      :
799239713583Smrg	    else
799339713583Smrg	      # the above command should be used before it gets too long
799439713583Smrg	      oldobjs=$objlist
799539713583Smrg	      if test "$obj" = "$last_oldobj" ; then
799639713583Smrg		RANLIB=$save_RANLIB
799739713583Smrg	      fi
799839713583Smrg	      test -z "$concat_cmds" || concat_cmds=$concat_cmds~
799939713583Smrg	      eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\"
800039713583Smrg	      objlist=
800139713583Smrg	      len=$len0
800239713583Smrg	    fi
800339713583Smrg	  done
800439713583Smrg	  RANLIB=$save_RANLIB
800539713583Smrg	  oldobjs=$objlist
800639713583Smrg	  if test "X$oldobjs" = "X" ; then
800739713583Smrg	    eval cmds=\"\$concat_cmds\"
800839713583Smrg	  else
800939713583Smrg	    eval cmds=\"\$concat_cmds~\$old_archive_cmds\"
801039713583Smrg	  fi
801139713583Smrg	fi
801239713583Smrg      fi
801339713583Smrg      func_execute_cmds "$cmds" 'exit $?'
801495b296d0Smrg    done
801595b296d0Smrg
801639713583Smrg    test -n "$generated" && \
801739713583Smrg      func_show_eval "${RM}r$generated"
801895b296d0Smrg
801939713583Smrg    # Now create the libtool archive.
802039713583Smrg    case $output in
802139713583Smrg    *.la)
802239713583Smrg      old_library=
802339713583Smrg      test "$build_old_libs" = yes && old_library="$libname.$libext"
802439713583Smrg      func_verbose "creating $output"
802595b296d0Smrg
802639713583Smrg      # Preserve any variables that may affect compiler behavior
802739713583Smrg      for var in $variables_saved_for_relink; do
802839713583Smrg	if eval test -z \"\${$var+set}\"; then
802939713583Smrg	  relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command"
803039713583Smrg	elif eval var_value=\$$var; test -z "$var_value"; then
803139713583Smrg	  relink_command="$var=; export $var; $relink_command"
803295b296d0Smrg	else
803339713583Smrg	  func_quote_for_eval "$var_value"
803439713583Smrg	  relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command"
803595b296d0Smrg	fi
803639713583Smrg      done
803739713583Smrg      # Quote the link command for shipping.
803839713583Smrg      relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)"
803939713583Smrg      relink_command=`$ECHO "X$relink_command" | $Xsed -e "$sed_quote_subst"`
804039713583Smrg      if test "$hardcode_automatic" = yes ; then
804139713583Smrg	relink_command=
804239713583Smrg      fi
804395b296d0Smrg
804439713583Smrg      # Only create the output if not a dry run.
804539713583Smrg      $opt_dry_run || {
804639713583Smrg	for installed in no yes; do
804739713583Smrg	  if test "$installed" = yes; then
804839713583Smrg	    if test -z "$install_libdir"; then
804939713583Smrg	      break
805039713583Smrg	    fi
805139713583Smrg	    output="$output_objdir/$outputname"i
805239713583Smrg	    # Replace all uninstalled libtool libraries with the installed ones
805339713583Smrg	    newdependency_libs=
805439713583Smrg	    for deplib in $dependency_libs; do
805539713583Smrg	      case $deplib in
805639713583Smrg	      *.la)
805739713583Smrg		func_basename "$deplib"
805839713583Smrg		name="$func_basename_result"
805939713583Smrg		eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
806039713583Smrg		test -z "$libdir" && \
806139713583Smrg		  func_fatal_error "\`$deplib' is not a valid libtool archive"
806239713583Smrg		newdependency_libs="$newdependency_libs $libdir/$name"
806339713583Smrg		;;
806439713583Smrg	      *) newdependency_libs="$newdependency_libs $deplib" ;;
806539713583Smrg	      esac
806639713583Smrg	    done
806739713583Smrg	    dependency_libs="$newdependency_libs"
806839713583Smrg	    newdlfiles=
806939713583Smrg
807039713583Smrg	    for lib in $dlfiles; do
807139713583Smrg	      case $lib in
807239713583Smrg	      *.la)
807339713583Smrg	        func_basename "$lib"
807439713583Smrg		name="$func_basename_result"
807539713583Smrg		eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
807639713583Smrg		test -z "$libdir" && \
807739713583Smrg		  func_fatal_error "\`$lib' is not a valid libtool archive"
807839713583Smrg		newdlfiles="$newdlfiles $libdir/$name"
807939713583Smrg		;;
808039713583Smrg	      *) newdlfiles="$newdlfiles $lib" ;;
808139713583Smrg	      esac
808239713583Smrg	    done
808339713583Smrg	    dlfiles="$newdlfiles"
808439713583Smrg	    newdlprefiles=
808539713583Smrg	    for lib in $dlprefiles; do
808639713583Smrg	      case $lib in
808739713583Smrg	      *.la)
808839713583Smrg		# Only pass preopened files to the pseudo-archive (for
808939713583Smrg		# eventual linking with the app. that links it) if we
809039713583Smrg		# didn't already link the preopened objects directly into
809139713583Smrg		# the library:
809239713583Smrg		func_basename "$lib"
809339713583Smrg		name="$func_basename_result"
809439713583Smrg		eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
809539713583Smrg		test -z "$libdir" && \
809639713583Smrg		  func_fatal_error "\`$lib' is not a valid libtool archive"
809739713583Smrg		newdlprefiles="$newdlprefiles $libdir/$name"
809839713583Smrg		;;
809939713583Smrg	      esac
810039713583Smrg	    done
810139713583Smrg	    dlprefiles="$newdlprefiles"
810239713583Smrg	  else
810339713583Smrg	    newdlfiles=
810439713583Smrg	    for lib in $dlfiles; do
810539713583Smrg	      case $lib in
810639713583Smrg		[\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
810739713583Smrg		*) abs=`pwd`"/$lib" ;;
810839713583Smrg	      esac
810939713583Smrg	      newdlfiles="$newdlfiles $abs"
811039713583Smrg	    done
811139713583Smrg	    dlfiles="$newdlfiles"
811239713583Smrg	    newdlprefiles=
811339713583Smrg	    for lib in $dlprefiles; do
811439713583Smrg	      case $lib in
811539713583Smrg		[\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
811639713583Smrg		*) abs=`pwd`"/$lib" ;;
811739713583Smrg	      esac
811839713583Smrg	      newdlprefiles="$newdlprefiles $abs"
811939713583Smrg	    done
812039713583Smrg	    dlprefiles="$newdlprefiles"
812139713583Smrg	  fi
812239713583Smrg	  $RM $output
812339713583Smrg	  # place dlname in correct position for cygwin
812439713583Smrg	  tdlname=$dlname
812539713583Smrg	  case $host,$output,$installed,$module,$dlname in
812639713583Smrg	    *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll | *cegcc*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;;
812739713583Smrg	  esac
812839713583Smrg	  $ECHO > $output "\
812939713583Smrg# $outputname - a libtool library file
813039713583Smrg# Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
813139713583Smrg#
813239713583Smrg# Please DO NOT delete this file!
813339713583Smrg# It is necessary for linking the library.
813495b296d0Smrg
813539713583Smrg# The name that we can dlopen(3).
813639713583Smrgdlname='$tdlname'
813795b296d0Smrg
813839713583Smrg# Names of this library.
813939713583Smrglibrary_names='$library_names'
814095b296d0Smrg
814139713583Smrg# The name of the static archive.
814239713583Smrgold_library='$old_library'
814395b296d0Smrg
814439713583Smrg# Linker flags that can not go in dependency_libs.
814539713583Smrginherited_linker_flags='$new_inherited_linker_flags'
814695b296d0Smrg
814739713583Smrg# Libraries that this one depends upon.
814839713583Smrgdependency_libs='$dependency_libs'
814995b296d0Smrg
815039713583Smrg# Names of additional weak libraries provided by this library
815139713583Smrgweak_library_names='$weak_libs'
815295b296d0Smrg
815339713583Smrg# Version information for $libname.
815439713583Smrgcurrent=$current
815539713583Smrgage=$age
815639713583Smrgrevision=$revision
815795b296d0Smrg
815839713583Smrg# Is this an already installed library?
815939713583Smrginstalled=$installed
816095b296d0Smrg
816139713583Smrg# Should we warn about portability when linking against -modules?
816239713583Smrgshouldnotlink=$module
816395b296d0Smrg
816439713583Smrg# Files to dlopen/dlpreopen
816539713583Smrgdlopen='$dlfiles'
816639713583Smrgdlpreopen='$dlprefiles'
816795b296d0Smrg
816839713583Smrg# Directory that this library needs to be installed in:
816939713583Smrglibdir='$install_libdir'"
817039713583Smrg	  if test "$installed" = no && test "$need_relink" = yes; then
817139713583Smrg	    $ECHO >> $output "\
817239713583Smrgrelink_command=\"$relink_command\""
817339713583Smrg	  fi
817439713583Smrg	done
817539713583Smrg      }
817695b296d0Smrg
817739713583Smrg      # Do a symbolic link so that the libtool archive can be found in
817839713583Smrg      # LD_LIBRARY_PATH before the program is installed.
817939713583Smrg      func_show_eval '( cd "$output_objdir" && $RM "$outputname" && $LN_S "../$outputname" "$outputname" )' 'exit $?'
818039713583Smrg      ;;
818139713583Smrg    esac
818239713583Smrg    exit $EXIT_SUCCESS
818339713583Smrg}
818495b296d0Smrg
818539713583Smrg{ test "$mode" = link || test "$mode" = relink; } &&
818639713583Smrg    func_mode_link ${1+"$@"}
818795b296d0Smrg
818895b296d0Smrg
818939713583Smrg# func_mode_uninstall arg...
819039713583Smrgfunc_mode_uninstall ()
819139713583Smrg{
819239713583Smrg    $opt_debug
819339713583Smrg    RM="$nonopt"
819495b296d0Smrg    files=
819595b296d0Smrg    rmforce=
819695b296d0Smrg    exit_status=0
819795b296d0Smrg
819895b296d0Smrg    # This variable tells wrapper scripts just to set variables rather
819995b296d0Smrg    # than running their programs.
820095b296d0Smrg    libtool_install_magic="$magic"
820195b296d0Smrg
820295b296d0Smrg    for arg
820395b296d0Smrg    do
820495b296d0Smrg      case $arg in
820539713583Smrg      -f) RM="$RM $arg"; rmforce=yes ;;
820639713583Smrg      -*) RM="$RM $arg" ;;
820795b296d0Smrg      *) files="$files $arg" ;;
820895b296d0Smrg      esac
820995b296d0Smrg    done
821095b296d0Smrg
821139713583Smrg    test -z "$RM" && \
821239713583Smrg      func_fatal_help "you must specify an RM program"
821395b296d0Smrg
821495b296d0Smrg    rmdirs=
821595b296d0Smrg
821695b296d0Smrg    origobjdir="$objdir"
821795b296d0Smrg    for file in $files; do
821839713583Smrg      func_dirname "$file" "" "."
821939713583Smrg      dir="$func_dirname_result"
822039713583Smrg      if test "X$dir" = X.; then
822195b296d0Smrg	objdir="$origobjdir"
822295b296d0Smrg      else
822395b296d0Smrg	objdir="$dir/$origobjdir"
822495b296d0Smrg      fi
822539713583Smrg      func_basename "$file"
822639713583Smrg      name="$func_basename_result"
822795b296d0Smrg      test "$mode" = uninstall && objdir="$dir"
822895b296d0Smrg
822995b296d0Smrg      # Remember objdir for removal later, being careful to avoid duplicates
823095b296d0Smrg      if test "$mode" = clean; then
823195b296d0Smrg	case " $rmdirs " in
823295b296d0Smrg	  *" $objdir "*) ;;
823395b296d0Smrg	  *) rmdirs="$rmdirs $objdir" ;;
823495b296d0Smrg	esac
823595b296d0Smrg      fi
823695b296d0Smrg
823795b296d0Smrg      # Don't error if the file doesn't exist and rm -f was used.
823839713583Smrg      if { test -L "$file"; } >/dev/null 2>&1 ||
823939713583Smrg	 { test -h "$file"; } >/dev/null 2>&1 ||
824039713583Smrg	 test -f "$file"; then
824195b296d0Smrg	:
824295b296d0Smrg      elif test -d "$file"; then
824395b296d0Smrg	exit_status=1
824495b296d0Smrg	continue
824595b296d0Smrg      elif test "$rmforce" = yes; then
824695b296d0Smrg	continue
824795b296d0Smrg      fi
824895b296d0Smrg
824995b296d0Smrg      rmfiles="$file"
825095b296d0Smrg
825195b296d0Smrg      case $name in
825295b296d0Smrg      *.la)
825395b296d0Smrg	# Possibly a libtool archive, so verify it.
825439713583Smrg	if func_lalib_p "$file"; then
825539713583Smrg	  func_source $dir/$name
825695b296d0Smrg
825795b296d0Smrg	  # Delete the libtool libraries and symlinks.
825895b296d0Smrg	  for n in $library_names; do
825995b296d0Smrg	    rmfiles="$rmfiles $objdir/$n"
826095b296d0Smrg	  done
826195b296d0Smrg	  test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library"
826295b296d0Smrg
826395b296d0Smrg	  case "$mode" in
826495b296d0Smrg	  clean)
826595b296d0Smrg	    case "  $library_names " in
826695b296d0Smrg	    # "  " in the beginning catches empty $dlname
826795b296d0Smrg	    *" $dlname "*) ;;
826895b296d0Smrg	    *) rmfiles="$rmfiles $objdir/$dlname" ;;
826995b296d0Smrg	    esac
827039713583Smrg	    test -n "$libdir" && rmfiles="$rmfiles $objdir/$name $objdir/${name}i"
827195b296d0Smrg	    ;;
827295b296d0Smrg	  uninstall)
827395b296d0Smrg	    if test -n "$library_names"; then
827495b296d0Smrg	      # Do each command in the postuninstall commands.
827539713583Smrg	      func_execute_cmds "$postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1'
827695b296d0Smrg	    fi
827795b296d0Smrg
827895b296d0Smrg	    if test -n "$old_library"; then
827995b296d0Smrg	      # Do each command in the old_postuninstall commands.
828039713583Smrg	      func_execute_cmds "$old_postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1'
828195b296d0Smrg	    fi
828295b296d0Smrg	    # FIXME: should reinstall the best remaining shared library.
828395b296d0Smrg	    ;;
828495b296d0Smrg	  esac
828595b296d0Smrg	fi
828695b296d0Smrg	;;
828795b296d0Smrg
828895b296d0Smrg      *.lo)
828995b296d0Smrg	# Possibly a libtool object, so verify it.
829039713583Smrg	if func_lalib_p "$file"; then
829195b296d0Smrg
829295b296d0Smrg	  # Read the .lo file
829339713583Smrg	  func_source $dir/$name
829495b296d0Smrg
829595b296d0Smrg	  # Add PIC object to the list of files to remove.
829639713583Smrg	  if test -n "$pic_object" &&
829739713583Smrg	     test "$pic_object" != none; then
829895b296d0Smrg	    rmfiles="$rmfiles $dir/$pic_object"
829995b296d0Smrg	  fi
830095b296d0Smrg
830195b296d0Smrg	  # Add non-PIC object to the list of files to remove.
830239713583Smrg	  if test -n "$non_pic_object" &&
830339713583Smrg	     test "$non_pic_object" != none; then
830495b296d0Smrg	    rmfiles="$rmfiles $dir/$non_pic_object"
830595b296d0Smrg	  fi
830695b296d0Smrg	fi
830795b296d0Smrg	;;
830895b296d0Smrg
830995b296d0Smrg      *)
831095b296d0Smrg	if test "$mode" = clean ; then
831195b296d0Smrg	  noexename=$name
831295b296d0Smrg	  case $file in
831395b296d0Smrg	  *.exe)
831439713583Smrg	    func_stripname '' '.exe' "$file"
831539713583Smrg	    file=$func_stripname_result
831639713583Smrg	    func_stripname '' '.exe' "$name"
831739713583Smrg	    noexename=$func_stripname_result
831895b296d0Smrg	    # $file with .exe has already been added to rmfiles,
831995b296d0Smrg	    # add $file without .exe
832095b296d0Smrg	    rmfiles="$rmfiles $file"
832195b296d0Smrg	    ;;
832295b296d0Smrg	  esac
832395b296d0Smrg	  # Do a test to see if this is a libtool program.
832439713583Smrg	  if func_ltwrapper_p "$file"; then
832539713583Smrg	    if func_ltwrapper_executable_p "$file"; then
832639713583Smrg	      func_ltwrapper_scriptname "$file"
832739713583Smrg	      relink_command=
832839713583Smrg	      func_source $func_ltwrapper_scriptname_result
832939713583Smrg	      rmfiles="$rmfiles $func_ltwrapper_scriptname_result"
833039713583Smrg	    else
833139713583Smrg	      relink_command=
833239713583Smrg	      func_source $dir/$noexename
833339713583Smrg	    fi
833495b296d0Smrg
833595b296d0Smrg	    # note $name still contains .exe if it was in $file originally
833695b296d0Smrg	    # as does the version of $file that was added into $rmfiles
833795b296d0Smrg	    rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}"
833895b296d0Smrg	    if test "$fast_install" = yes && test -n "$relink_command"; then
833995b296d0Smrg	      rmfiles="$rmfiles $objdir/lt-$name"
834095b296d0Smrg	    fi
834195b296d0Smrg	    if test "X$noexename" != "X$name" ; then
834295b296d0Smrg	      rmfiles="$rmfiles $objdir/lt-${noexename}.c"
834395b296d0Smrg	    fi
834495b296d0Smrg	  fi
834595b296d0Smrg	fi
834695b296d0Smrg	;;
834795b296d0Smrg      esac
834839713583Smrg      func_show_eval "$RM $rmfiles" 'exit_status=1'
834995b296d0Smrg    done
835095b296d0Smrg    objdir="$origobjdir"
835195b296d0Smrg
835295b296d0Smrg    # Try to remove the ${objdir}s in the directories where we deleted files
835395b296d0Smrg    for dir in $rmdirs; do
835495b296d0Smrg      if test -d "$dir"; then
835539713583Smrg	func_show_eval "rmdir $dir >/dev/null 2>&1"
835695b296d0Smrg      fi
835795b296d0Smrg    done
835895b296d0Smrg
835995b296d0Smrg    exit $exit_status
836039713583Smrg}
836195b296d0Smrg
836239713583Smrg{ test "$mode" = uninstall || test "$mode" = clean; } &&
836339713583Smrg    func_mode_uninstall ${1+"$@"}
836495b296d0Smrg
836539713583Smrgtest -z "$mode" && {
836639713583Smrg  help="$generic_help"
836739713583Smrg  func_fatal_help "you must specify a MODE"
836839713583Smrg}
836939713583Smrg
837039713583Smrgtest -z "$exec_cmd" && \
837139713583Smrg  func_fatal_help "invalid operation mode \`$mode'"
837295b296d0Smrg
837395b296d0Smrgif test -n "$exec_cmd"; then
837439713583Smrg  eval exec "$exec_cmd"
837595b296d0Smrg  exit $EXIT_FAILURE
837695b296d0Smrgfi
837795b296d0Smrg
837839713583Smrgexit $exit_status
837995b296d0Smrg
838095b296d0Smrg
838195b296d0Smrg# The TAGs below are defined such that we never get into a situation
838295b296d0Smrg# in which we disable both kinds of libraries.  Given conflicting
838395b296d0Smrg# choices, we go for a static library, that is the most portable,
838495b296d0Smrg# since we can't tell whether shared libraries were disabled because
838595b296d0Smrg# the user asked for that or because the platform doesn't support
838695b296d0Smrg# them.  This is particularly important on AIX, because we don't
838795b296d0Smrg# support having both static and shared libraries enabled at the same
838895b296d0Smrg# time on that platform, so we default to a shared-only configuration.
838995b296d0Smrg# If a disable-shared tag is given, we'll fallback to a static-only
839095b296d0Smrg# configuration.  But we'll never go from static-only to shared-only.
839195b296d0Smrg
839295b296d0Smrg# ### BEGIN LIBTOOL TAG CONFIG: disable-shared
839339713583Smrgbuild_libtool_libs=no
839439713583Smrgbuild_old_libs=yes
839595b296d0Smrg# ### END LIBTOOL TAG CONFIG: disable-shared
839695b296d0Smrg
839795b296d0Smrg# ### BEGIN LIBTOOL TAG CONFIG: disable-static
839839713583Smrgbuild_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac`
839995b296d0Smrg# ### END LIBTOOL TAG CONFIG: disable-static
840095b296d0Smrg
840195b296d0Smrg# Local Variables:
840295b296d0Smrg# mode:shell-script
840395b296d0Smrg# sh-indentation:2
840495b296d0Smrg# End:
840539713583Smrg# vi:sw=2
840639713583Smrg
8407