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