ltmain.sh revision 578741aa
1145b7b3cSmrg# ltmain.sh - Provide generalized library-building support services.
2145b7b3cSmrg# NOTE: Changing this file will not affect anything until you rerun configure.
3145b7b3cSmrg#
4578741aaSmrg# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006,
5578741aaSmrg# 2007, 2008  Free Software Foundation, Inc.
6145b7b3cSmrg# Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
7145b7b3cSmrg#
8145b7b3cSmrg# This program is free software; you can redistribute it and/or modify
9145b7b3cSmrg# it under the terms of the GNU General Public License as published by
10145b7b3cSmrg# the Free Software Foundation; either version 2 of the License, or
11145b7b3cSmrg# (at your option) any later version.
12145b7b3cSmrg#
13145b7b3cSmrg# This program is distributed in the hope that it will be useful, but
14145b7b3cSmrg# WITHOUT ANY WARRANTY; without even the implied warranty of
15145b7b3cSmrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16145b7b3cSmrg# General Public License for more details.
17145b7b3cSmrg#
18145b7b3cSmrg# You should have received a copy of the GNU General Public License
19145b7b3cSmrg# along with this program; if not, write to the Free Software
20145b7b3cSmrg# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
21145b7b3cSmrg#
22145b7b3cSmrg# As a special exception to the GNU General Public License, if you
23145b7b3cSmrg# distribute this file as part of a program that contains a
24145b7b3cSmrg# configuration script generated by Autoconf, you may include it under
25145b7b3cSmrg# the same distribution terms that you use for the rest of that program.
26145b7b3cSmrg
27145b7b3cSmrgbasename="s,^.*/,,g"
28145b7b3cSmrg
29145b7b3cSmrg# Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh
30145b7b3cSmrg# is ksh but when the shell is invoked as "sh" and the current value of
31145b7b3cSmrg# the _XPG environment variable is not equal to 1 (one), the special
32145b7b3cSmrg# positional parameter $0, within a function call, is the name of the
33145b7b3cSmrg# function.
34145b7b3cSmrgprogpath="$0"
35145b7b3cSmrg
36145b7b3cSmrg# The name of this program:
37145b7b3cSmrgprogname=`echo "$progpath" | $SED $basename`
38145b7b3cSmrgmodename="$progname"
39145b7b3cSmrg
40145b7b3cSmrg# Global variables:
41145b7b3cSmrgEXIT_SUCCESS=0
42145b7b3cSmrgEXIT_FAILURE=1
43145b7b3cSmrg
44145b7b3cSmrgPROGRAM=ltmain.sh
45145b7b3cSmrgPACKAGE=libtool
46578741aaSmrgVERSION=1.5.26
47578741aaSmrgTIMESTAMP=" (1.1220.2.492 2008/01/30 06:40:56)"
48578741aaSmrg
49578741aaSmrg# Be Bourne compatible (taken from Autoconf:_AS_BOURNE_COMPATIBLE).
50578741aaSmrgif test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
51578741aaSmrg  emulate sh
52578741aaSmrg  NULLCMD=:
53578741aaSmrg  # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
54578741aaSmrg  # is contrary to our usage.  Disable this feature.
55578741aaSmrg  alias -g '${1+"$@"}'='"$@"'
56145b7b3cSmrg  setopt NO_GLOB_SUBST
57578741aaSmrgelse
58578741aaSmrg  case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac
59145b7b3cSmrgfi
60578741aaSmrgBIN_SH=xpg4; export BIN_SH # for Tru64
61578741aaSmrgDUALCASE=1; export DUALCASE # for MKS sh
62145b7b3cSmrg
63145b7b3cSmrg# Check that we have a working $echo.
64145b7b3cSmrgif test "X$1" = X--no-reexec; then
65145b7b3cSmrg  # Discard the --no-reexec flag, and continue.
66145b7b3cSmrg  shift
67145b7b3cSmrgelif test "X$1" = X--fallback-echo; then
68145b7b3cSmrg  # Avoid inline document here, it may be left over
69145b7b3cSmrg  :
70145b7b3cSmrgelif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then
71145b7b3cSmrg  # Yippee, $echo works!
72145b7b3cSmrg  :
73145b7b3cSmrgelse
74145b7b3cSmrg  # Restart under the correct shell, and then maybe $echo will work.
75145b7b3cSmrg  exec $SHELL "$progpath" --no-reexec ${1+"$@"}
76145b7b3cSmrgfi
77145b7b3cSmrg
78145b7b3cSmrgif test "X$1" = X--fallback-echo; then
79145b7b3cSmrg  # used as fallback echo
80145b7b3cSmrg  shift
81145b7b3cSmrg  cat <<EOF
82145b7b3cSmrg$*
83145b7b3cSmrgEOF
84145b7b3cSmrg  exit $EXIT_SUCCESS
85145b7b3cSmrgfi
86145b7b3cSmrg
87145b7b3cSmrgdefault_mode=
88145b7b3cSmrghelp="Try \`$progname --help' for more information."
89145b7b3cSmrgmagic="%%%MAGIC variable%%%"
90145b7b3cSmrgmkdir="mkdir"
91145b7b3cSmrgmv="mv -f"
92145b7b3cSmrgrm="rm -f"
93145b7b3cSmrg
94145b7b3cSmrg# Sed substitution that helps us do robust quoting.  It backslashifies
95145b7b3cSmrg# metacharacters that are still active within double-quoted strings.
96145b7b3cSmrgXsed="${SED}"' -e 1s/^X//'
97145b7b3cSmrgsed_quote_subst='s/\([\\`\\"$\\\\]\)/\\\1/g'
98145b7b3cSmrg# test EBCDIC or ASCII
99145b7b3cSmrgcase `echo X|tr X '\101'` in
100145b7b3cSmrg A) # ASCII based system
101145b7b3cSmrg    # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr
102145b7b3cSmrg  SP2NL='tr \040 \012'
103145b7b3cSmrg  NL2SP='tr \015\012 \040\040'
104145b7b3cSmrg  ;;
105145b7b3cSmrg *) # EBCDIC based system
106145b7b3cSmrg  SP2NL='tr \100 \n'
107145b7b3cSmrg  NL2SP='tr \r\n \100\100'
108145b7b3cSmrg  ;;
109145b7b3cSmrgesac
110145b7b3cSmrg
111145b7b3cSmrg# NLS nuisances.
112145b7b3cSmrg# Only set LANG and LC_ALL to C if already set.
113145b7b3cSmrg# These must not be set unconditionally because not all systems understand
114145b7b3cSmrg# e.g. LANG=C (notably SCO).
115145b7b3cSmrg# We save the old values to restore during execute mode.
116578741aaSmrglt_env=
117578741aaSmrgfor lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
118578741aaSmrgdo
119578741aaSmrg  eval "if test \"\${$lt_var+set}\" = set; then
120578741aaSmrg	  save_$lt_var=\$$lt_var
121578741aaSmrg	  lt_env=\"$lt_var=\$$lt_var \$lt_env\"
122578741aaSmrg	  $lt_var=C
123578741aaSmrg	  export $lt_var
124578741aaSmrg	fi"
125578741aaSmrgdone
126578741aaSmrg
127578741aaSmrgif test -n "$lt_env"; then
128578741aaSmrg  lt_env="env $lt_env"
129145b7b3cSmrgfi
130145b7b3cSmrg
131145b7b3cSmrg# Make sure IFS has a sensible default
132145b7b3cSmrglt_nl='
133145b7b3cSmrg'
134145b7b3cSmrgIFS=" 	$lt_nl"
135145b7b3cSmrg
136145b7b3cSmrgif test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
137145b7b3cSmrg  $echo "$modename: not configured to build any kind of library" 1>&2
138145b7b3cSmrg  $echo "Fatal configuration error.  See the $PACKAGE docs for more information." 1>&2
139145b7b3cSmrg  exit $EXIT_FAILURE
140145b7b3cSmrgfi
141145b7b3cSmrg
142145b7b3cSmrg# Global variables.
143145b7b3cSmrgmode=$default_mode
144145b7b3cSmrgnonopt=
145145b7b3cSmrgprev=
146145b7b3cSmrgprevopt=
147145b7b3cSmrgrun=
148145b7b3cSmrgshow="$echo"
149145b7b3cSmrgshow_help=
150145b7b3cSmrgexecute_dlfiles=
151145b7b3cSmrgduplicate_deps=no
152145b7b3cSmrgpreserve_args=
153145b7b3cSmrglo2o="s/\\.lo\$/.${objext}/"
154145b7b3cSmrgo2lo="s/\\.${objext}\$/.lo/"
155578741aaSmrgextracted_archives=
156578741aaSmrgextracted_serial=0
157145b7b3cSmrg
158145b7b3cSmrg#####################################
159145b7b3cSmrg# Shell function definitions:
160145b7b3cSmrg# This seems to be the best place for them
161145b7b3cSmrg
162145b7b3cSmrg# func_mktempdir [string]
163145b7b3cSmrg# Make a temporary directory that won't clash with other running
164145b7b3cSmrg# libtool processes, and avoids race conditions if possible.  If
165145b7b3cSmrg# given, STRING is the basename for that directory.
166145b7b3cSmrgfunc_mktempdir ()
167145b7b3cSmrg{
168145b7b3cSmrg    my_template="${TMPDIR-/tmp}/${1-$progname}"
169145b7b3cSmrg
170145b7b3cSmrg    if test "$run" = ":"; then
171145b7b3cSmrg      # Return a directory name, but don't create it in dry-run mode
172145b7b3cSmrg      my_tmpdir="${my_template}-$$"
173145b7b3cSmrg    else
174145b7b3cSmrg
175145b7b3cSmrg      # If mktemp works, use that first and foremost
176145b7b3cSmrg      my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null`
177145b7b3cSmrg
178145b7b3cSmrg      if test ! -d "$my_tmpdir"; then
179145b7b3cSmrg	# Failing that, at least try and use $RANDOM to avoid a race
180145b7b3cSmrg	my_tmpdir="${my_template}-${RANDOM-0}$$"
181145b7b3cSmrg
182145b7b3cSmrg	save_mktempdir_umask=`umask`
183145b7b3cSmrg	umask 0077
184145b7b3cSmrg	$mkdir "$my_tmpdir"
185145b7b3cSmrg	umask $save_mktempdir_umask
186145b7b3cSmrg      fi
187145b7b3cSmrg
188145b7b3cSmrg      # If we're not in dry-run mode, bomb out on failure
189145b7b3cSmrg      test -d "$my_tmpdir" || {
190145b7b3cSmrg        $echo "cannot create temporary directory \`$my_tmpdir'" 1>&2
191145b7b3cSmrg	exit $EXIT_FAILURE
192145b7b3cSmrg      }
193145b7b3cSmrg    fi
194145b7b3cSmrg
195145b7b3cSmrg    $echo "X$my_tmpdir" | $Xsed
196145b7b3cSmrg}
197145b7b3cSmrg
198145b7b3cSmrg
199145b7b3cSmrg# func_win32_libid arg
200145b7b3cSmrg# return the library type of file 'arg'
201145b7b3cSmrg#
202145b7b3cSmrg# Need a lot of goo to handle *both* DLLs and import libs
203145b7b3cSmrg# Has to be a shell function in order to 'eat' the argument
204145b7b3cSmrg# that is supplied when $file_magic_command is called.
205145b7b3cSmrgfunc_win32_libid ()
206145b7b3cSmrg{
207145b7b3cSmrg  win32_libid_type="unknown"
208145b7b3cSmrg  win32_fileres=`file -L $1 2>/dev/null`
209145b7b3cSmrg  case $win32_fileres in
210145b7b3cSmrg  *ar\ archive\ import\ library*) # definitely import
211145b7b3cSmrg    win32_libid_type="x86 archive import"
212145b7b3cSmrg    ;;
213145b7b3cSmrg  *ar\ archive*) # could be an import, or static
214145b7b3cSmrg    if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | \
215145b7b3cSmrg      $EGREP -e 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then
216145b7b3cSmrg      win32_nmres=`eval $NM -f posix -A $1 | \
217578741aaSmrg	$SED -n -e '1,100{
218578741aaSmrg		/ I /{
219578741aaSmrg			s,.*,import,
220578741aaSmrg			p
221578741aaSmrg			q
222578741aaSmrg			}
223578741aaSmrg		}'`
224145b7b3cSmrg      case $win32_nmres in
225145b7b3cSmrg      import*)  win32_libid_type="x86 archive import";;
226145b7b3cSmrg      *)        win32_libid_type="x86 archive static";;
227145b7b3cSmrg      esac
228145b7b3cSmrg    fi
229145b7b3cSmrg    ;;
230145b7b3cSmrg  *DLL*)
231145b7b3cSmrg    win32_libid_type="x86 DLL"
232145b7b3cSmrg    ;;
233145b7b3cSmrg  *executable*) # but shell scripts are "executable" too...
234145b7b3cSmrg    case $win32_fileres in
235145b7b3cSmrg    *MS\ Windows\ PE\ Intel*)
236145b7b3cSmrg      win32_libid_type="x86 DLL"
237145b7b3cSmrg      ;;
238145b7b3cSmrg    esac
239145b7b3cSmrg    ;;
240145b7b3cSmrg  esac
241145b7b3cSmrg  $echo $win32_libid_type
242145b7b3cSmrg}
243145b7b3cSmrg
244145b7b3cSmrg
245145b7b3cSmrg# func_infer_tag arg
246145b7b3cSmrg# Infer tagged configuration to use if any are available and
247145b7b3cSmrg# if one wasn't chosen via the "--tag" command line option.
248145b7b3cSmrg# Only attempt this if the compiler in the base compile
249145b7b3cSmrg# command doesn't match the default compiler.
250145b7b3cSmrg# arg is usually of the form 'gcc ...'
251145b7b3cSmrgfunc_infer_tag ()
252145b7b3cSmrg{
253145b7b3cSmrg    if test -n "$available_tags" && test -z "$tagname"; then
254145b7b3cSmrg      CC_quoted=
255145b7b3cSmrg      for arg in $CC; do
256145b7b3cSmrg	case $arg in
257145b7b3cSmrg	  *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
258145b7b3cSmrg	  arg="\"$arg\""
259145b7b3cSmrg	  ;;
260145b7b3cSmrg	esac
261145b7b3cSmrg	CC_quoted="$CC_quoted $arg"
262145b7b3cSmrg      done
263145b7b3cSmrg      case $@ in
264145b7b3cSmrg      # Blanks in the command may have been stripped by the calling shell,
265145b7b3cSmrg      # but not from the CC environment variable when configure was run.
266145b7b3cSmrg      " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*) ;;
267145b7b3cSmrg      # Blanks at the start of $base_compile will cause this to fail
268145b7b3cSmrg      # if we don't check for them as well.
269145b7b3cSmrg      *)
270145b7b3cSmrg	for z in $available_tags; do
271145b7b3cSmrg	  if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then
272145b7b3cSmrg	    # Evaluate the configuration.
273145b7b3cSmrg	    eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`"
274145b7b3cSmrg	    CC_quoted=
275145b7b3cSmrg	    for arg in $CC; do
276145b7b3cSmrg	    # Double-quote args containing other shell metacharacters.
277145b7b3cSmrg	    case $arg in
278145b7b3cSmrg	      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
279145b7b3cSmrg	      arg="\"$arg\""
280145b7b3cSmrg	      ;;
281145b7b3cSmrg	    esac
282145b7b3cSmrg	    CC_quoted="$CC_quoted $arg"
283145b7b3cSmrg	  done
284145b7b3cSmrg	    case "$@ " in
285145b7b3cSmrg	      " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*)
286145b7b3cSmrg	      # The compiler in the base compile command matches
287145b7b3cSmrg	      # the one in the tagged configuration.
288145b7b3cSmrg	      # Assume this is the tagged configuration we want.
289145b7b3cSmrg	      tagname=$z
290145b7b3cSmrg	      break
291145b7b3cSmrg	      ;;
292145b7b3cSmrg	    esac
293145b7b3cSmrg	  fi
294145b7b3cSmrg	done
295145b7b3cSmrg	# If $tagname still isn't set, then no tagged configuration
296145b7b3cSmrg	# was found and let the user know that the "--tag" command
297145b7b3cSmrg	# line option must be used.
298145b7b3cSmrg	if test -z "$tagname"; then
299145b7b3cSmrg	  $echo "$modename: unable to infer tagged configuration"
300145b7b3cSmrg	  $echo "$modename: specify a tag with \`--tag'" 1>&2
301145b7b3cSmrg	  exit $EXIT_FAILURE
302145b7b3cSmrg#        else
303145b7b3cSmrg#          $echo "$modename: using $tagname tagged configuration"
304145b7b3cSmrg	fi
305145b7b3cSmrg	;;
306145b7b3cSmrg      esac
307145b7b3cSmrg    fi
308145b7b3cSmrg}
309145b7b3cSmrg
310145b7b3cSmrg
311145b7b3cSmrg# func_extract_an_archive dir oldlib
312145b7b3cSmrgfunc_extract_an_archive ()
313145b7b3cSmrg{
314145b7b3cSmrg    f_ex_an_ar_dir="$1"; shift
315145b7b3cSmrg    f_ex_an_ar_oldlib="$1"
316145b7b3cSmrg
317145b7b3cSmrg    $show "(cd $f_ex_an_ar_dir && $AR x $f_ex_an_ar_oldlib)"
318145b7b3cSmrg    $run eval "(cd \$f_ex_an_ar_dir && $AR x \$f_ex_an_ar_oldlib)" || exit $?
319145b7b3cSmrg    if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then
320145b7b3cSmrg     :
321145b7b3cSmrg    else
322145b7b3cSmrg      $echo "$modename: ERROR: object name conflicts: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib" 1>&2
323145b7b3cSmrg      exit $EXIT_FAILURE
324145b7b3cSmrg    fi
325145b7b3cSmrg}
326145b7b3cSmrg
327145b7b3cSmrg# func_extract_archives gentop oldlib ...
328145b7b3cSmrgfunc_extract_archives ()
329145b7b3cSmrg{
330145b7b3cSmrg    my_gentop="$1"; shift
331145b7b3cSmrg    my_oldlibs=${1+"$@"}
332145b7b3cSmrg    my_oldobjs=""
333145b7b3cSmrg    my_xlib=""
334145b7b3cSmrg    my_xabs=""
335145b7b3cSmrg    my_xdir=""
336145b7b3cSmrg    my_status=""
337145b7b3cSmrg
338145b7b3cSmrg    $show "${rm}r $my_gentop"
339145b7b3cSmrg    $run ${rm}r "$my_gentop"
340145b7b3cSmrg    $show "$mkdir $my_gentop"
341145b7b3cSmrg    $run $mkdir "$my_gentop"
342145b7b3cSmrg    my_status=$?
343145b7b3cSmrg    if test "$my_status" -ne 0 && test ! -d "$my_gentop"; then
344145b7b3cSmrg      exit $my_status
345145b7b3cSmrg    fi
346145b7b3cSmrg
347145b7b3cSmrg    for my_xlib in $my_oldlibs; do
348145b7b3cSmrg      # Extract the objects.
349145b7b3cSmrg      case $my_xlib in
350145b7b3cSmrg	[\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;;
351145b7b3cSmrg	*) my_xabs=`pwd`"/$my_xlib" ;;
352145b7b3cSmrg      esac
353145b7b3cSmrg      my_xlib=`$echo "X$my_xlib" | $Xsed -e 's%^.*/%%'`
354578741aaSmrg      my_xlib_u=$my_xlib
355578741aaSmrg      while :; do
356578741aaSmrg        case " $extracted_archives " in
357578741aaSmrg	*" $my_xlib_u "*)
358578741aaSmrg	  extracted_serial=`expr $extracted_serial + 1`
359578741aaSmrg	  my_xlib_u=lt$extracted_serial-$my_xlib ;;
360578741aaSmrg	*) break ;;
361578741aaSmrg	esac
362578741aaSmrg      done
363578741aaSmrg      extracted_archives="$extracted_archives $my_xlib_u"
364578741aaSmrg      my_xdir="$my_gentop/$my_xlib_u"
365145b7b3cSmrg
366145b7b3cSmrg      $show "${rm}r $my_xdir"
367145b7b3cSmrg      $run ${rm}r "$my_xdir"
368145b7b3cSmrg      $show "$mkdir $my_xdir"
369145b7b3cSmrg      $run $mkdir "$my_xdir"
370145b7b3cSmrg      exit_status=$?
371145b7b3cSmrg      if test "$exit_status" -ne 0 && test ! -d "$my_xdir"; then
372145b7b3cSmrg	exit $exit_status
373145b7b3cSmrg      fi
374145b7b3cSmrg      case $host in
375145b7b3cSmrg      *-darwin*)
376145b7b3cSmrg	$show "Extracting $my_xabs"
377145b7b3cSmrg	# Do not bother doing anything if just a dry run
378145b7b3cSmrg	if test -z "$run"; then
379145b7b3cSmrg	  darwin_orig_dir=`pwd`
380145b7b3cSmrg	  cd $my_xdir || exit $?
381145b7b3cSmrg	  darwin_archive=$my_xabs
382145b7b3cSmrg	  darwin_curdir=`pwd`
383145b7b3cSmrg	  darwin_base_archive=`$echo "X$darwin_archive" | $Xsed -e 's%^.*/%%'`
384145b7b3cSmrg	  darwin_arches=`lipo -info "$darwin_archive" 2>/dev/null | $EGREP Architectures 2>/dev/null`
385145b7b3cSmrg	  if test -n "$darwin_arches"; then 
386145b7b3cSmrg	    darwin_arches=`echo "$darwin_arches" | $SED -e 's/.*are://'`
387145b7b3cSmrg	    darwin_arch=
388145b7b3cSmrg	    $show "$darwin_base_archive has multiple architectures $darwin_arches"
389145b7b3cSmrg	    for darwin_arch in  $darwin_arches ; do
390145b7b3cSmrg	      mkdir -p "unfat-$$/${darwin_base_archive}-${darwin_arch}"
391145b7b3cSmrg	      lipo -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}"
392145b7b3cSmrg	      cd "unfat-$$/${darwin_base_archive}-${darwin_arch}"
393145b7b3cSmrg	      func_extract_an_archive "`pwd`" "${darwin_base_archive}"
394145b7b3cSmrg	      cd "$darwin_curdir"
395145b7b3cSmrg	      $rm "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}"
396145b7b3cSmrg	    done # $darwin_arches
397145b7b3cSmrg      ## Okay now we have a bunch of thin objects, gotta fatten them up :)
398145b7b3cSmrg	    darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print| xargs basename | sort -u | $NL2SP`
399145b7b3cSmrg	    darwin_file=
400145b7b3cSmrg	    darwin_files=
401145b7b3cSmrg	    for darwin_file in $darwin_filelist; do
402145b7b3cSmrg	      darwin_files=`find unfat-$$ -name $darwin_file -print | $NL2SP`
403145b7b3cSmrg	      lipo -create -output "$darwin_file" $darwin_files
404145b7b3cSmrg	    done # $darwin_filelist
405145b7b3cSmrg	    ${rm}r unfat-$$
406145b7b3cSmrg	    cd "$darwin_orig_dir"
407145b7b3cSmrg	  else
408145b7b3cSmrg	    cd "$darwin_orig_dir"
409145b7b3cSmrg 	    func_extract_an_archive "$my_xdir" "$my_xabs"
410145b7b3cSmrg	  fi # $darwin_arches
411145b7b3cSmrg	fi # $run
412145b7b3cSmrg	;;
413145b7b3cSmrg      *)
414145b7b3cSmrg        func_extract_an_archive "$my_xdir" "$my_xabs"
415145b7b3cSmrg        ;;
416145b7b3cSmrg      esac
417145b7b3cSmrg      my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP`
418145b7b3cSmrg    done
419145b7b3cSmrg    func_extract_archives_result="$my_oldobjs"
420145b7b3cSmrg}
421145b7b3cSmrg# End of Shell function definitions
422145b7b3cSmrg#####################################
423145b7b3cSmrg
424145b7b3cSmrg# Darwin sucks
425145b7b3cSmrgeval std_shrext=\"$shrext_cmds\"
426145b7b3cSmrg
427145b7b3cSmrgdisable_libs=no
428145b7b3cSmrg
429145b7b3cSmrg# Parse our command line options once, thoroughly.
430145b7b3cSmrgwhile test "$#" -gt 0
431145b7b3cSmrgdo
432145b7b3cSmrg  arg="$1"
433145b7b3cSmrg  shift
434145b7b3cSmrg
435145b7b3cSmrg  case $arg in
436145b7b3cSmrg  -*=*) optarg=`$echo "X$arg" | $Xsed -e 's/[-_a-zA-Z0-9]*=//'` ;;
437145b7b3cSmrg  *) optarg= ;;
438145b7b3cSmrg  esac
439145b7b3cSmrg
440145b7b3cSmrg  # If the previous option needs an argument, assign it.
441145b7b3cSmrg  if test -n "$prev"; then
442145b7b3cSmrg    case $prev in
443145b7b3cSmrg    execute_dlfiles)
444145b7b3cSmrg      execute_dlfiles="$execute_dlfiles $arg"
445145b7b3cSmrg      ;;
446145b7b3cSmrg    tag)
447145b7b3cSmrg      tagname="$arg"
448145b7b3cSmrg      preserve_args="${preserve_args}=$arg"
449145b7b3cSmrg
450145b7b3cSmrg      # Check whether tagname contains only valid characters
451145b7b3cSmrg      case $tagname in
452145b7b3cSmrg      *[!-_A-Za-z0-9,/]*)
453145b7b3cSmrg	$echo "$progname: invalid tag name: $tagname" 1>&2
454145b7b3cSmrg	exit $EXIT_FAILURE
455145b7b3cSmrg	;;
456145b7b3cSmrg      esac
457145b7b3cSmrg
458145b7b3cSmrg      case $tagname in
459145b7b3cSmrg      CC)
460145b7b3cSmrg	# Don't test for the "default" C tag, as we know, it's there, but
461145b7b3cSmrg	# not specially marked.
462145b7b3cSmrg	;;
463145b7b3cSmrg      *)
464145b7b3cSmrg	if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "$progpath" > /dev/null; then
465145b7b3cSmrg	  taglist="$taglist $tagname"
466145b7b3cSmrg	  # Evaluate the configuration.
467145b7b3cSmrg	  eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$tagname'$/,/^# ### END LIBTOOL TAG CONFIG: '$tagname'$/p' < $progpath`"
468145b7b3cSmrg	else
469145b7b3cSmrg	  $echo "$progname: ignoring unknown tag $tagname" 1>&2
470145b7b3cSmrg	fi
471145b7b3cSmrg	;;
472145b7b3cSmrg      esac
473145b7b3cSmrg      ;;
474145b7b3cSmrg    *)
475145b7b3cSmrg      eval "$prev=\$arg"
476145b7b3cSmrg      ;;
477145b7b3cSmrg    esac
478145b7b3cSmrg
479145b7b3cSmrg    prev=
480145b7b3cSmrg    prevopt=
481145b7b3cSmrg    continue
482145b7b3cSmrg  fi
483145b7b3cSmrg
484145b7b3cSmrg  # Have we seen a non-optional argument yet?
485145b7b3cSmrg  case $arg in
486145b7b3cSmrg  --help)
487145b7b3cSmrg    show_help=yes
488145b7b3cSmrg    ;;
489145b7b3cSmrg
490145b7b3cSmrg  --version)
491578741aaSmrg    echo "\
492578741aaSmrg$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP
493578741aaSmrg
494578741aaSmrgCopyright (C) 2008  Free Software Foundation, Inc.
495578741aaSmrgThis is free software; see the source for copying conditions.  There is NO
496578741aaSmrgwarranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
497145b7b3cSmrg    exit $?
498145b7b3cSmrg    ;;
499145b7b3cSmrg
500145b7b3cSmrg  --config)
501145b7b3cSmrg    ${SED} -e '1,/^# ### BEGIN LIBTOOL CONFIG/d' -e '/^# ### END LIBTOOL CONFIG/,$d' $progpath
502145b7b3cSmrg    # Now print the configurations for the tags.
503145b7b3cSmrg    for tagname in $taglist; do
504145b7b3cSmrg      ${SED} -n -e "/^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$/,/^# ### END LIBTOOL TAG CONFIG: $tagname$/p" < "$progpath"
505145b7b3cSmrg    done
506145b7b3cSmrg    exit $?
507145b7b3cSmrg    ;;
508145b7b3cSmrg
509145b7b3cSmrg  --debug)
510145b7b3cSmrg    $echo "$progname: enabling shell trace mode"
511145b7b3cSmrg    set -x
512145b7b3cSmrg    preserve_args="$preserve_args $arg"
513145b7b3cSmrg    ;;
514145b7b3cSmrg
515145b7b3cSmrg  --dry-run | -n)
516145b7b3cSmrg    run=:
517145b7b3cSmrg    ;;
518145b7b3cSmrg
519145b7b3cSmrg  --features)
520145b7b3cSmrg    $echo "host: $host"
521145b7b3cSmrg    if test "$build_libtool_libs" = yes; then
522145b7b3cSmrg      $echo "enable shared libraries"
523145b7b3cSmrg    else
524145b7b3cSmrg      $echo "disable shared libraries"
525145b7b3cSmrg    fi
526145b7b3cSmrg    if test "$build_old_libs" = yes; then
527145b7b3cSmrg      $echo "enable static libraries"
528145b7b3cSmrg    else
529145b7b3cSmrg      $echo "disable static libraries"
530145b7b3cSmrg    fi
531145b7b3cSmrg    exit $?
532145b7b3cSmrg    ;;
533145b7b3cSmrg
534145b7b3cSmrg  --finish) mode="finish" ;;
535145b7b3cSmrg
536145b7b3cSmrg  --mode) prevopt="--mode" prev=mode ;;
537145b7b3cSmrg  --mode=*) mode="$optarg" ;;
538145b7b3cSmrg
539145b7b3cSmrg  --preserve-dup-deps) duplicate_deps="yes" ;;
540145b7b3cSmrg
541145b7b3cSmrg  --quiet | --silent)
542145b7b3cSmrg    show=:
543145b7b3cSmrg    preserve_args="$preserve_args $arg"
544145b7b3cSmrg    ;;
545145b7b3cSmrg
546145b7b3cSmrg  --tag)
547145b7b3cSmrg    prevopt="--tag"
548145b7b3cSmrg    prev=tag
549145b7b3cSmrg    preserve_args="$preserve_args --tag"
550145b7b3cSmrg    ;;
551145b7b3cSmrg  --tag=*)
552145b7b3cSmrg    set tag "$optarg" ${1+"$@"}
553145b7b3cSmrg    shift
554145b7b3cSmrg    prev=tag
555145b7b3cSmrg    preserve_args="$preserve_args --tag"
556145b7b3cSmrg    ;;
557145b7b3cSmrg
558145b7b3cSmrg  -dlopen)
559145b7b3cSmrg    prevopt="-dlopen"
560145b7b3cSmrg    prev=execute_dlfiles
561145b7b3cSmrg    ;;
562145b7b3cSmrg
563145b7b3cSmrg  -*)
564145b7b3cSmrg    $echo "$modename: unrecognized option \`$arg'" 1>&2
565145b7b3cSmrg    $echo "$help" 1>&2
566145b7b3cSmrg    exit $EXIT_FAILURE
567145b7b3cSmrg    ;;
568145b7b3cSmrg
569145b7b3cSmrg  *)
570145b7b3cSmrg    nonopt="$arg"
571145b7b3cSmrg    break
572145b7b3cSmrg    ;;
573145b7b3cSmrg  esac
574145b7b3cSmrgdone
575145b7b3cSmrg
576145b7b3cSmrgif test -n "$prevopt"; then
577145b7b3cSmrg  $echo "$modename: option \`$prevopt' requires an argument" 1>&2
578145b7b3cSmrg  $echo "$help" 1>&2
579145b7b3cSmrg  exit $EXIT_FAILURE
580145b7b3cSmrgfi
581145b7b3cSmrg
582145b7b3cSmrgcase $disable_libs in
583145b7b3cSmrgno) 
584145b7b3cSmrg  ;;
585145b7b3cSmrgshared)
586145b7b3cSmrg  build_libtool_libs=no
587145b7b3cSmrg  build_old_libs=yes
588145b7b3cSmrg  ;;
589145b7b3cSmrgstatic)
590145b7b3cSmrg  build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac`
591145b7b3cSmrg  ;;
592145b7b3cSmrgesac
593145b7b3cSmrg
594145b7b3cSmrg# If this variable is set in any of the actions, the command in it
595145b7b3cSmrg# will be execed at the end.  This prevents here-documents from being
596145b7b3cSmrg# left over by shells.
597145b7b3cSmrgexec_cmd=
598145b7b3cSmrg
599145b7b3cSmrgif test -z "$show_help"; then
600145b7b3cSmrg
601145b7b3cSmrg  # Infer the operation mode.
602145b7b3cSmrg  if test -z "$mode"; then
603145b7b3cSmrg    $echo "*** Warning: inferring the mode of operation is deprecated." 1>&2
604145b7b3cSmrg    $echo "*** Future versions of Libtool will require --mode=MODE be specified." 1>&2
605145b7b3cSmrg    case $nonopt in
606145b7b3cSmrg    *cc | cc* | *++ | gcc* | *-gcc* | g++* | xlc*)
607145b7b3cSmrg      mode=link
608145b7b3cSmrg      for arg
609145b7b3cSmrg      do
610145b7b3cSmrg	case $arg in
611145b7b3cSmrg	-c)
612145b7b3cSmrg	   mode=compile
613145b7b3cSmrg	   break
614145b7b3cSmrg	   ;;
615145b7b3cSmrg	esac
616145b7b3cSmrg      done
617145b7b3cSmrg      ;;
618145b7b3cSmrg    *db | *dbx | *strace | *truss)
619145b7b3cSmrg      mode=execute
620145b7b3cSmrg      ;;
621145b7b3cSmrg    *install*|cp|mv)
622145b7b3cSmrg      mode=install
623145b7b3cSmrg      ;;
624145b7b3cSmrg    *rm)
625145b7b3cSmrg      mode=uninstall
626145b7b3cSmrg      ;;
627145b7b3cSmrg    *)
628145b7b3cSmrg      # If we have no mode, but dlfiles were specified, then do execute mode.
629145b7b3cSmrg      test -n "$execute_dlfiles" && mode=execute
630145b7b3cSmrg
631145b7b3cSmrg      # Just use the default operation mode.
632145b7b3cSmrg      if test -z "$mode"; then
633145b7b3cSmrg	if test -n "$nonopt"; then
634145b7b3cSmrg	  $echo "$modename: warning: cannot infer operation mode from \`$nonopt'" 1>&2
635145b7b3cSmrg	else
636145b7b3cSmrg	  $echo "$modename: warning: cannot infer operation mode without MODE-ARGS" 1>&2
637145b7b3cSmrg	fi
638145b7b3cSmrg      fi
639145b7b3cSmrg      ;;
640145b7b3cSmrg    esac
641145b7b3cSmrg  fi
642145b7b3cSmrg
643145b7b3cSmrg  # Only execute mode is allowed to have -dlopen flags.
644145b7b3cSmrg  if test -n "$execute_dlfiles" && test "$mode" != execute; then
645145b7b3cSmrg    $echo "$modename: unrecognized option \`-dlopen'" 1>&2
646145b7b3cSmrg    $echo "$help" 1>&2
647145b7b3cSmrg    exit $EXIT_FAILURE
648145b7b3cSmrg  fi
649145b7b3cSmrg
650145b7b3cSmrg  # Change the help message to a mode-specific one.
651145b7b3cSmrg  generic_help="$help"
652145b7b3cSmrg  help="Try \`$modename --help --mode=$mode' for more information."
653145b7b3cSmrg
654145b7b3cSmrg  # These modes are in order of execution frequency so that they run quickly.
655145b7b3cSmrg  case $mode in
656145b7b3cSmrg  # libtool compile mode
657145b7b3cSmrg  compile)
658145b7b3cSmrg    modename="$modename: compile"
659145b7b3cSmrg    # Get the compilation command and the source file.
660145b7b3cSmrg    base_compile=
661145b7b3cSmrg    srcfile="$nonopt"  #  always keep a non-empty value in "srcfile"
662145b7b3cSmrg    suppress_opt=yes
663145b7b3cSmrg    suppress_output=
664145b7b3cSmrg    arg_mode=normal
665145b7b3cSmrg    libobj=
666145b7b3cSmrg    later=
667145b7b3cSmrg
668145b7b3cSmrg    for arg
669145b7b3cSmrg    do
670145b7b3cSmrg      case $arg_mode in
671145b7b3cSmrg      arg  )
672145b7b3cSmrg	# do not "continue".  Instead, add this to base_compile
673145b7b3cSmrg	lastarg="$arg"
674145b7b3cSmrg	arg_mode=normal
675145b7b3cSmrg	;;
676145b7b3cSmrg
677145b7b3cSmrg      target )
678145b7b3cSmrg	libobj="$arg"
679145b7b3cSmrg	arg_mode=normal
680145b7b3cSmrg	continue
681145b7b3cSmrg	;;
682145b7b3cSmrg
683145b7b3cSmrg      normal )
684145b7b3cSmrg	# Accept any command-line options.
685145b7b3cSmrg	case $arg in
686145b7b3cSmrg	-o)
687145b7b3cSmrg	  if test -n "$libobj" ; then
688145b7b3cSmrg	    $echo "$modename: you cannot specify \`-o' more than once" 1>&2
689145b7b3cSmrg	    exit $EXIT_FAILURE
690145b7b3cSmrg	  fi
691145b7b3cSmrg	  arg_mode=target
692145b7b3cSmrg	  continue
693145b7b3cSmrg	  ;;
694145b7b3cSmrg
695145b7b3cSmrg	-static | -prefer-pic | -prefer-non-pic)
696145b7b3cSmrg	  later="$later $arg"
697145b7b3cSmrg	  continue
698145b7b3cSmrg	  ;;
699145b7b3cSmrg
700145b7b3cSmrg	-no-suppress)
701145b7b3cSmrg	  suppress_opt=no
702145b7b3cSmrg	  continue
703145b7b3cSmrg	  ;;
704145b7b3cSmrg
705145b7b3cSmrg	-Xcompiler)
706145b7b3cSmrg	  arg_mode=arg  #  the next one goes into the "base_compile" arg list
707145b7b3cSmrg	  continue      #  The current "srcfile" will either be retained or
708145b7b3cSmrg	  ;;            #  replaced later.  I would guess that would be a bug.
709145b7b3cSmrg
710145b7b3cSmrg	-Wc,*)
711145b7b3cSmrg	  args=`$echo "X$arg" | $Xsed -e "s/^-Wc,//"`
712145b7b3cSmrg	  lastarg=
713145b7b3cSmrg	  save_ifs="$IFS"; IFS=','
714145b7b3cSmrg 	  for arg in $args; do
715145b7b3cSmrg	    IFS="$save_ifs"
716145b7b3cSmrg
717145b7b3cSmrg	    # Double-quote args containing other shell metacharacters.
718145b7b3cSmrg	    # Many Bourne shells cannot handle close brackets correctly
719145b7b3cSmrg	    # in scan sets, so we specify it separately.
720145b7b3cSmrg	    case $arg in
721145b7b3cSmrg	      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
722145b7b3cSmrg	      arg="\"$arg\""
723145b7b3cSmrg	      ;;
724145b7b3cSmrg	    esac
725145b7b3cSmrg	    lastarg="$lastarg $arg"
726145b7b3cSmrg	  done
727145b7b3cSmrg	  IFS="$save_ifs"
728145b7b3cSmrg	  lastarg=`$echo "X$lastarg" | $Xsed -e "s/^ //"`
729145b7b3cSmrg
730145b7b3cSmrg	  # Add the arguments to base_compile.
731145b7b3cSmrg	  base_compile="$base_compile $lastarg"
732145b7b3cSmrg	  continue
733145b7b3cSmrg	  ;;
734145b7b3cSmrg
735145b7b3cSmrg	* )
736145b7b3cSmrg	  # Accept the current argument as the source file.
737145b7b3cSmrg	  # The previous "srcfile" becomes the current argument.
738145b7b3cSmrg	  #
739145b7b3cSmrg	  lastarg="$srcfile"
740145b7b3cSmrg	  srcfile="$arg"
741145b7b3cSmrg	  ;;
742145b7b3cSmrg	esac  #  case $arg
743145b7b3cSmrg	;;
744145b7b3cSmrg      esac    #  case $arg_mode
745145b7b3cSmrg
746145b7b3cSmrg      # Aesthetically quote the previous argument.
747145b7b3cSmrg      lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"`
748145b7b3cSmrg
749145b7b3cSmrg      case $lastarg in
750145b7b3cSmrg      # Double-quote args containing other shell metacharacters.
751145b7b3cSmrg      # Many Bourne shells cannot handle close brackets correctly
752145b7b3cSmrg      # in scan sets, and some SunOS ksh mistreat backslash-escaping
753145b7b3cSmrg      # in scan sets (worked around with variable expansion),
754145b7b3cSmrg      # and furthermore cannot handle '|' '&' '(' ')' in scan sets 
755145b7b3cSmrg      # at all, so we specify them separately.
756145b7b3cSmrg      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
757145b7b3cSmrg	lastarg="\"$lastarg\""
758145b7b3cSmrg	;;
759145b7b3cSmrg      esac
760145b7b3cSmrg
761145b7b3cSmrg      base_compile="$base_compile $lastarg"
762145b7b3cSmrg    done # for arg
763145b7b3cSmrg
764145b7b3cSmrg    case $arg_mode in
765145b7b3cSmrg    arg)
766145b7b3cSmrg      $echo "$modename: you must specify an argument for -Xcompile"
767145b7b3cSmrg      exit $EXIT_FAILURE
768145b7b3cSmrg      ;;
769145b7b3cSmrg    target)
770145b7b3cSmrg      $echo "$modename: you must specify a target with \`-o'" 1>&2
771145b7b3cSmrg      exit $EXIT_FAILURE
772145b7b3cSmrg      ;;
773145b7b3cSmrg    *)
774145b7b3cSmrg      # Get the name of the library object.
775145b7b3cSmrg      [ -z "$libobj" ] && libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'`
776145b7b3cSmrg      ;;
777145b7b3cSmrg    esac
778145b7b3cSmrg
779145b7b3cSmrg    # Recognize several different file suffixes.
780145b7b3cSmrg    # If the user specifies -o file.o, it is replaced with file.lo
781145b7b3cSmrg    xform='[cCFSifmso]'
782145b7b3cSmrg    case $libobj in
783145b7b3cSmrg    *.ada) xform=ada ;;
784145b7b3cSmrg    *.adb) xform=adb ;;
785145b7b3cSmrg    *.ads) xform=ads ;;
786145b7b3cSmrg    *.asm) xform=asm ;;
787145b7b3cSmrg    *.c++) xform=c++ ;;
788145b7b3cSmrg    *.cc) xform=cc ;;
789145b7b3cSmrg    *.ii) xform=ii ;;
790145b7b3cSmrg    *.class) xform=class ;;
791145b7b3cSmrg    *.cpp) xform=cpp ;;
792145b7b3cSmrg    *.cxx) xform=cxx ;;
793578741aaSmrg    *.[fF][09]?) xform=[fF][09]. ;;
794145b7b3cSmrg    *.for) xform=for ;;
795145b7b3cSmrg    *.java) xform=java ;;
796578741aaSmrg    *.obj) xform=obj ;;
797578741aaSmrg    *.sx) xform=sx ;;
798145b7b3cSmrg    esac
799145b7b3cSmrg
800145b7b3cSmrg    libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"`
801145b7b3cSmrg
802145b7b3cSmrg    case $libobj in
803145b7b3cSmrg    *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;;
804145b7b3cSmrg    *)
805145b7b3cSmrg      $echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2
806145b7b3cSmrg      exit $EXIT_FAILURE
807145b7b3cSmrg      ;;
808145b7b3cSmrg    esac
809145b7b3cSmrg
810145b7b3cSmrg    func_infer_tag $base_compile
811145b7b3cSmrg
812145b7b3cSmrg    for arg in $later; do
813145b7b3cSmrg      case $arg in
814145b7b3cSmrg      -static)
815145b7b3cSmrg	build_old_libs=yes
816145b7b3cSmrg	continue
817145b7b3cSmrg	;;
818145b7b3cSmrg
819145b7b3cSmrg      -prefer-pic)
820145b7b3cSmrg	pic_mode=yes
821145b7b3cSmrg	continue
822145b7b3cSmrg	;;
823145b7b3cSmrg
824145b7b3cSmrg      -prefer-non-pic)
825145b7b3cSmrg	pic_mode=no
826145b7b3cSmrg	continue
827145b7b3cSmrg	;;
828145b7b3cSmrg      esac
829145b7b3cSmrg    done
830145b7b3cSmrg
831145b7b3cSmrg    qlibobj=`$echo "X$libobj" | $Xsed -e "$sed_quote_subst"`
832145b7b3cSmrg    case $qlibobj in
833145b7b3cSmrg      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
834145b7b3cSmrg	qlibobj="\"$qlibobj\"" ;;
835145b7b3cSmrg    esac
836145b7b3cSmrg    test "X$libobj" != "X$qlibobj" \
837145b7b3cSmrg	&& $echo "X$libobj" | grep '[]~#^*{};<>?"'"'"' 	&()|`$[]' \
838145b7b3cSmrg	&& $echo "$modename: libobj name \`$libobj' may not contain shell special characters."
839145b7b3cSmrg    objname=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
840145b7b3cSmrg    xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'`
841145b7b3cSmrg    if test "X$xdir" = "X$obj"; then
842145b7b3cSmrg      xdir=
843145b7b3cSmrg    else
844145b7b3cSmrg      xdir=$xdir/
845145b7b3cSmrg    fi
846145b7b3cSmrg    lobj=${xdir}$objdir/$objname
847145b7b3cSmrg
848145b7b3cSmrg    if test -z "$base_compile"; then
849145b7b3cSmrg      $echo "$modename: you must specify a compilation command" 1>&2
850145b7b3cSmrg      $echo "$help" 1>&2
851145b7b3cSmrg      exit $EXIT_FAILURE
852145b7b3cSmrg    fi
853145b7b3cSmrg
854145b7b3cSmrg    # Delete any leftover library objects.
855145b7b3cSmrg    if test "$build_old_libs" = yes; then
856145b7b3cSmrg      removelist="$obj $lobj $libobj ${libobj}T"
857145b7b3cSmrg    else
858145b7b3cSmrg      removelist="$lobj $libobj ${libobj}T"
859145b7b3cSmrg    fi
860145b7b3cSmrg
861145b7b3cSmrg    $run $rm $removelist
862145b7b3cSmrg    trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15
863145b7b3cSmrg
864145b7b3cSmrg    # On Cygwin there's no "real" PIC flag so we must build both object types
865145b7b3cSmrg    case $host_os in
866145b7b3cSmrg    cygwin* | mingw* | pw32* | os2*)
867145b7b3cSmrg      pic_mode=default
868145b7b3cSmrg      ;;
869145b7b3cSmrg    esac
870145b7b3cSmrg    if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then
871145b7b3cSmrg      # non-PIC code in shared libraries is not supported
872145b7b3cSmrg      pic_mode=default
873145b7b3cSmrg    fi
874145b7b3cSmrg
875145b7b3cSmrg    # Calculate the filename of the output object if compiler does
876145b7b3cSmrg    # not support -o with -c
877145b7b3cSmrg    if test "$compiler_c_o" = no; then
878145b7b3cSmrg      output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext}
879145b7b3cSmrg      lockfile="$output_obj.lock"
880145b7b3cSmrg      removelist="$removelist $output_obj $lockfile"
881145b7b3cSmrg      trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15
882145b7b3cSmrg    else
883145b7b3cSmrg      output_obj=
884145b7b3cSmrg      need_locks=no
885145b7b3cSmrg      lockfile=
886145b7b3cSmrg    fi
887145b7b3cSmrg
888145b7b3cSmrg    # Lock this critical section if it is needed
889145b7b3cSmrg    # We use this script file to make the link, it avoids creating a new file
890145b7b3cSmrg    if test "$need_locks" = yes; then
891145b7b3cSmrg      until $run ln "$progpath" "$lockfile" 2>/dev/null; do
892145b7b3cSmrg	$show "Waiting for $lockfile to be removed"
893145b7b3cSmrg	sleep 2
894145b7b3cSmrg      done
895145b7b3cSmrg    elif test "$need_locks" = warn; then
896145b7b3cSmrg      if test -f "$lockfile"; then
897145b7b3cSmrg	$echo "\
898145b7b3cSmrg*** ERROR, $lockfile exists and contains:
899145b7b3cSmrg`cat $lockfile 2>/dev/null`
900145b7b3cSmrg
901145b7b3cSmrgThis indicates that another process is trying to use the same
902145b7b3cSmrgtemporary object file, and libtool could not work around it because
903145b7b3cSmrgyour compiler does not support \`-c' and \`-o' together.  If you
904145b7b3cSmrgrepeat this compilation, it may succeed, by chance, but you had better
905145b7b3cSmrgavoid parallel builds (make -j) in this platform, or get a better
906145b7b3cSmrgcompiler."
907145b7b3cSmrg
908145b7b3cSmrg	$run $rm $removelist
909145b7b3cSmrg	exit $EXIT_FAILURE
910145b7b3cSmrg      fi
911145b7b3cSmrg      $echo "$srcfile" > "$lockfile"
912145b7b3cSmrg    fi
913145b7b3cSmrg
914145b7b3cSmrg    if test -n "$fix_srcfile_path"; then
915145b7b3cSmrg      eval srcfile=\"$fix_srcfile_path\"
916145b7b3cSmrg    fi
917145b7b3cSmrg    qsrcfile=`$echo "X$srcfile" | $Xsed -e "$sed_quote_subst"`
918145b7b3cSmrg    case $qsrcfile in
919145b7b3cSmrg      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
920145b7b3cSmrg      qsrcfile="\"$qsrcfile\"" ;;
921145b7b3cSmrg    esac
922145b7b3cSmrg
923145b7b3cSmrg    $run $rm "$libobj" "${libobj}T"
924145b7b3cSmrg
925145b7b3cSmrg    # Create a libtool object file (analogous to a ".la" file),
926145b7b3cSmrg    # but don't create it if we're doing a dry run.
927145b7b3cSmrg    test -z "$run" && cat > ${libobj}T <<EOF
928145b7b3cSmrg# $libobj - a libtool object file
929145b7b3cSmrg# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
930145b7b3cSmrg#
931145b7b3cSmrg# Please DO NOT delete this file!
932145b7b3cSmrg# It is necessary for linking the library.
933145b7b3cSmrg
934145b7b3cSmrg# Name of the PIC object.
935145b7b3cSmrgEOF
936145b7b3cSmrg
937145b7b3cSmrg    # Only build a PIC object if we are building libtool libraries.
938145b7b3cSmrg    if test "$build_libtool_libs" = yes; then
939145b7b3cSmrg      # Without this assignment, base_compile gets emptied.
940145b7b3cSmrg      fbsd_hideous_sh_bug=$base_compile
941145b7b3cSmrg
942145b7b3cSmrg      if test "$pic_mode" != no; then
943145b7b3cSmrg	command="$base_compile $qsrcfile $pic_flag"
944145b7b3cSmrg      else
945145b7b3cSmrg	# Don't build PIC code
946145b7b3cSmrg	command="$base_compile $qsrcfile"
947145b7b3cSmrg      fi
948145b7b3cSmrg
949145b7b3cSmrg      if test ! -d "${xdir}$objdir"; then
950145b7b3cSmrg	$show "$mkdir ${xdir}$objdir"
951145b7b3cSmrg	$run $mkdir ${xdir}$objdir
952145b7b3cSmrg	exit_status=$?
953145b7b3cSmrg	if test "$exit_status" -ne 0 && test ! -d "${xdir}$objdir"; then
954145b7b3cSmrg	  exit $exit_status
955145b7b3cSmrg	fi
956145b7b3cSmrg      fi
957145b7b3cSmrg
958145b7b3cSmrg      if test -z "$output_obj"; then
959145b7b3cSmrg	# Place PIC objects in $objdir
960145b7b3cSmrg	command="$command -o $lobj"
961145b7b3cSmrg      fi
962145b7b3cSmrg
963145b7b3cSmrg      $run $rm "$lobj" "$output_obj"
964145b7b3cSmrg
965145b7b3cSmrg      $show "$command"
966578741aaSmrg      if $run eval $lt_env "$command"; then :
967145b7b3cSmrg      else
968145b7b3cSmrg	test -n "$output_obj" && $run $rm $removelist
969145b7b3cSmrg	exit $EXIT_FAILURE
970145b7b3cSmrg      fi
971145b7b3cSmrg
972145b7b3cSmrg      if test "$need_locks" = warn &&
973145b7b3cSmrg	 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
974145b7b3cSmrg	$echo "\
975145b7b3cSmrg*** ERROR, $lockfile contains:
976145b7b3cSmrg`cat $lockfile 2>/dev/null`
977145b7b3cSmrg
978145b7b3cSmrgbut it should contain:
979145b7b3cSmrg$srcfile
980145b7b3cSmrg
981145b7b3cSmrgThis indicates that another process is trying to use the same
982145b7b3cSmrgtemporary object file, and libtool could not work around it because
983145b7b3cSmrgyour compiler does not support \`-c' and \`-o' together.  If you
984145b7b3cSmrgrepeat this compilation, it may succeed, by chance, but you had better
985145b7b3cSmrgavoid parallel builds (make -j) in this platform, or get a better
986145b7b3cSmrgcompiler."
987145b7b3cSmrg
988145b7b3cSmrg	$run $rm $removelist
989145b7b3cSmrg	exit $EXIT_FAILURE
990145b7b3cSmrg      fi
991145b7b3cSmrg
992145b7b3cSmrg      # Just move the object if needed, then go on to compile the next one
993145b7b3cSmrg      if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then
994145b7b3cSmrg	$show "$mv $output_obj $lobj"
995145b7b3cSmrg	if $run $mv $output_obj $lobj; then :
996145b7b3cSmrg	else
997145b7b3cSmrg	  error=$?
998145b7b3cSmrg	  $run $rm $removelist
999145b7b3cSmrg	  exit $error
1000145b7b3cSmrg	fi
1001145b7b3cSmrg      fi
1002145b7b3cSmrg
1003145b7b3cSmrg      # Append the name of the PIC object to the libtool object file.
1004145b7b3cSmrg      test -z "$run" && cat >> ${libobj}T <<EOF
1005145b7b3cSmrgpic_object='$objdir/$objname'
1006145b7b3cSmrg
1007145b7b3cSmrgEOF
1008145b7b3cSmrg
1009145b7b3cSmrg      # Allow error messages only from the first compilation.
1010145b7b3cSmrg      if test "$suppress_opt" = yes; then
1011145b7b3cSmrg        suppress_output=' >/dev/null 2>&1'
1012145b7b3cSmrg      fi
1013145b7b3cSmrg    else
1014145b7b3cSmrg      # No PIC object so indicate it doesn't exist in the libtool
1015145b7b3cSmrg      # object file.
1016145b7b3cSmrg      test -z "$run" && cat >> ${libobj}T <<EOF
1017145b7b3cSmrgpic_object=none
1018145b7b3cSmrg
1019145b7b3cSmrgEOF
1020145b7b3cSmrg    fi
1021145b7b3cSmrg
1022145b7b3cSmrg    # Only build a position-dependent object if we build old libraries.
1023145b7b3cSmrg    if test "$build_old_libs" = yes; then
1024145b7b3cSmrg      if test "$pic_mode" != yes; then
1025145b7b3cSmrg	# Don't build PIC code
1026145b7b3cSmrg	command="$base_compile $qsrcfile"
1027145b7b3cSmrg      else
1028145b7b3cSmrg	command="$base_compile $qsrcfile $pic_flag"
1029145b7b3cSmrg      fi
1030145b7b3cSmrg      if test "$compiler_c_o" = yes; then
1031145b7b3cSmrg	command="$command -o $obj"
1032145b7b3cSmrg      fi
1033145b7b3cSmrg
1034145b7b3cSmrg      # Suppress compiler output if we already did a PIC compilation.
1035145b7b3cSmrg      command="$command$suppress_output"
1036145b7b3cSmrg      $run $rm "$obj" "$output_obj"
1037145b7b3cSmrg      $show "$command"
1038578741aaSmrg      if $run eval $lt_env "$command"; then :
1039145b7b3cSmrg      else
1040145b7b3cSmrg	$run $rm $removelist
1041145b7b3cSmrg	exit $EXIT_FAILURE
1042145b7b3cSmrg      fi
1043145b7b3cSmrg
1044145b7b3cSmrg      if test "$need_locks" = warn &&
1045145b7b3cSmrg	 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
1046145b7b3cSmrg	$echo "\
1047145b7b3cSmrg*** ERROR, $lockfile contains:
1048145b7b3cSmrg`cat $lockfile 2>/dev/null`
1049145b7b3cSmrg
1050145b7b3cSmrgbut it should contain:
1051145b7b3cSmrg$srcfile
1052145b7b3cSmrg
1053145b7b3cSmrgThis indicates that another process is trying to use the same
1054145b7b3cSmrgtemporary object file, and libtool could not work around it because
1055145b7b3cSmrgyour compiler does not support \`-c' and \`-o' together.  If you
1056145b7b3cSmrgrepeat this compilation, it may succeed, by chance, but you had better
1057145b7b3cSmrgavoid parallel builds (make -j) in this platform, or get a better
1058145b7b3cSmrgcompiler."
1059145b7b3cSmrg
1060145b7b3cSmrg	$run $rm $removelist
1061145b7b3cSmrg	exit $EXIT_FAILURE
1062145b7b3cSmrg      fi
1063145b7b3cSmrg
1064145b7b3cSmrg      # Just move the object if needed
1065145b7b3cSmrg      if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then
1066145b7b3cSmrg	$show "$mv $output_obj $obj"
1067145b7b3cSmrg	if $run $mv $output_obj $obj; then :
1068145b7b3cSmrg	else
1069145b7b3cSmrg	  error=$?
1070145b7b3cSmrg	  $run $rm $removelist
1071145b7b3cSmrg	  exit $error
1072145b7b3cSmrg	fi
1073145b7b3cSmrg      fi
1074145b7b3cSmrg
1075145b7b3cSmrg      # Append the name of the non-PIC object the libtool object file.
1076145b7b3cSmrg      # Only append if the libtool object file exists.
1077145b7b3cSmrg      test -z "$run" && cat >> ${libobj}T <<EOF
1078145b7b3cSmrg# Name of the non-PIC object.
1079145b7b3cSmrgnon_pic_object='$objname'
1080145b7b3cSmrg
1081145b7b3cSmrgEOF
1082145b7b3cSmrg    else
1083145b7b3cSmrg      # Append the name of the non-PIC object the libtool object file.
1084145b7b3cSmrg      # Only append if the libtool object file exists.
1085145b7b3cSmrg      test -z "$run" && cat >> ${libobj}T <<EOF
1086145b7b3cSmrg# Name of the non-PIC object.
1087145b7b3cSmrgnon_pic_object=none
1088145b7b3cSmrg
1089145b7b3cSmrgEOF
1090145b7b3cSmrg    fi
1091145b7b3cSmrg
1092145b7b3cSmrg    $run $mv "${libobj}T" "${libobj}"
1093145b7b3cSmrg
1094145b7b3cSmrg    # Unlock the critical section if it was locked
1095145b7b3cSmrg    if test "$need_locks" != no; then
1096145b7b3cSmrg      $run $rm "$lockfile"
1097145b7b3cSmrg    fi
1098145b7b3cSmrg
1099145b7b3cSmrg    exit $EXIT_SUCCESS
1100145b7b3cSmrg    ;;
1101145b7b3cSmrg
1102145b7b3cSmrg  # libtool link mode
1103145b7b3cSmrg  link | relink)
1104145b7b3cSmrg    modename="$modename: link"
1105145b7b3cSmrg    case $host in
1106145b7b3cSmrg    *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
1107145b7b3cSmrg      # It is impossible to link a dll without this setting, and
1108145b7b3cSmrg      # we shouldn't force the makefile maintainer to figure out
1109145b7b3cSmrg      # which system we are compiling for in order to pass an extra
1110145b7b3cSmrg      # flag for every libtool invocation.
1111145b7b3cSmrg      # allow_undefined=no
1112145b7b3cSmrg
1113145b7b3cSmrg      # FIXME: Unfortunately, there are problems with the above when trying
1114145b7b3cSmrg      # to make a dll which has undefined symbols, in which case not
1115145b7b3cSmrg      # even a static library is built.  For now, we need to specify
1116145b7b3cSmrg      # -no-undefined on the libtool link line when we can be certain
1117145b7b3cSmrg      # that all symbols are satisfied, otherwise we get a static library.
1118145b7b3cSmrg      allow_undefined=yes
1119145b7b3cSmrg      ;;
1120145b7b3cSmrg    *)
1121145b7b3cSmrg      allow_undefined=yes
1122145b7b3cSmrg      ;;
1123145b7b3cSmrg    esac
1124145b7b3cSmrg    libtool_args="$nonopt"
1125145b7b3cSmrg    base_compile="$nonopt $@"
1126145b7b3cSmrg    compile_command="$nonopt"
1127145b7b3cSmrg    finalize_command="$nonopt"
1128145b7b3cSmrg
1129145b7b3cSmrg    compile_rpath=
1130145b7b3cSmrg    finalize_rpath=
1131145b7b3cSmrg    compile_shlibpath=
1132145b7b3cSmrg    finalize_shlibpath=
1133145b7b3cSmrg    convenience=
1134145b7b3cSmrg    old_convenience=
1135145b7b3cSmrg    deplibs=
1136145b7b3cSmrg    old_deplibs=
1137145b7b3cSmrg    compiler_flags=
1138145b7b3cSmrg    linker_flags=
1139145b7b3cSmrg    dllsearchpath=
1140145b7b3cSmrg    lib_search_path=`pwd`
1141145b7b3cSmrg    inst_prefix_dir=
1142145b7b3cSmrg
1143145b7b3cSmrg    avoid_version=no
1144145b7b3cSmrg    dlfiles=
1145145b7b3cSmrg    dlprefiles=
1146145b7b3cSmrg    dlself=no
1147145b7b3cSmrg    export_dynamic=no
1148145b7b3cSmrg    export_symbols=
1149145b7b3cSmrg    export_symbols_regex=
1150145b7b3cSmrg    generated=
1151145b7b3cSmrg    libobjs=
1152145b7b3cSmrg    ltlibs=
1153145b7b3cSmrg    module=no
1154145b7b3cSmrg    no_install=no
1155145b7b3cSmrg    objs=
1156145b7b3cSmrg    non_pic_objects=
1157145b7b3cSmrg    notinst_path= # paths that contain not-installed libtool libraries
1158145b7b3cSmrg    precious_files_regex=
1159145b7b3cSmrg    prefer_static_libs=no
1160145b7b3cSmrg    preload=no
1161145b7b3cSmrg    prev=
1162145b7b3cSmrg    prevarg=
1163145b7b3cSmrg    release=
1164145b7b3cSmrg    rpath=
1165145b7b3cSmrg    xrpath=
1166145b7b3cSmrg    perm_rpath=
1167145b7b3cSmrg    temp_rpath=
1168145b7b3cSmrg    thread_safe=no
1169145b7b3cSmrg    vinfo=
1170145b7b3cSmrg    vinfo_number=no
1171578741aaSmrg    single_module="${wl}-single_module"
1172145b7b3cSmrg
1173145b7b3cSmrg    func_infer_tag $base_compile
1174145b7b3cSmrg
1175145b7b3cSmrg    # We need to know -static, to get the right output filenames.
1176145b7b3cSmrg    for arg
1177145b7b3cSmrg    do
1178145b7b3cSmrg      case $arg in
1179578741aaSmrg      -all-static | -static | -static-libtool-libs)
1180578741aaSmrg	case $arg in
1181578741aaSmrg	-all-static)
1182145b7b3cSmrg	  if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then
1183145b7b3cSmrg	    $echo "$modename: warning: complete static linking is impossible in this configuration" 1>&2
1184145b7b3cSmrg	  fi
1185145b7b3cSmrg	  if test -n "$link_static_flag"; then
1186145b7b3cSmrg	    dlopen_self=$dlopen_self_static
1187145b7b3cSmrg	  fi
1188145b7b3cSmrg	  prefer_static_libs=yes
1189578741aaSmrg	  ;;
1190578741aaSmrg	-static)
1191145b7b3cSmrg	  if test -z "$pic_flag" && test -n "$link_static_flag"; then
1192145b7b3cSmrg	    dlopen_self=$dlopen_self_static
1193145b7b3cSmrg	  fi
1194145b7b3cSmrg	  prefer_static_libs=built
1195578741aaSmrg	  ;;
1196578741aaSmrg	-static-libtool-libs)
1197578741aaSmrg	  if test -z "$pic_flag" && test -n "$link_static_flag"; then
1198578741aaSmrg	    dlopen_self=$dlopen_self_static
1199578741aaSmrg	  fi
1200578741aaSmrg	  prefer_static_libs=yes
1201578741aaSmrg	  ;;
1202578741aaSmrg	esac
1203145b7b3cSmrg	build_libtool_libs=no
1204145b7b3cSmrg	build_old_libs=yes
1205145b7b3cSmrg	break
1206145b7b3cSmrg	;;
1207145b7b3cSmrg      esac
1208145b7b3cSmrg    done
1209145b7b3cSmrg
1210145b7b3cSmrg    # See if our shared archives depend on static archives.
1211145b7b3cSmrg    test -n "$old_archive_from_new_cmds" && build_old_libs=yes
1212145b7b3cSmrg
1213145b7b3cSmrg    # Go through the arguments, transforming them on the way.
1214145b7b3cSmrg    while test "$#" -gt 0; do
1215145b7b3cSmrg      arg="$1"
1216145b7b3cSmrg      shift
1217145b7b3cSmrg      case $arg in
1218145b7b3cSmrg      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
1219145b7b3cSmrg	qarg=\"`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`\" ### testsuite: skip nested quoting test
1220145b7b3cSmrg	;;
1221145b7b3cSmrg      *) qarg=$arg ;;
1222145b7b3cSmrg      esac
1223145b7b3cSmrg      libtool_args="$libtool_args $qarg"
1224145b7b3cSmrg
1225145b7b3cSmrg      # If the previous option needs an argument, assign it.
1226145b7b3cSmrg      if test -n "$prev"; then
1227145b7b3cSmrg	case $prev in
1228145b7b3cSmrg	output)
1229145b7b3cSmrg	  compile_command="$compile_command @OUTPUT@"
1230145b7b3cSmrg	  finalize_command="$finalize_command @OUTPUT@"
1231145b7b3cSmrg	  ;;
1232145b7b3cSmrg	esac
1233145b7b3cSmrg
1234145b7b3cSmrg	case $prev in
1235145b7b3cSmrg	dlfiles|dlprefiles)
1236145b7b3cSmrg	  if test "$preload" = no; then
1237145b7b3cSmrg	    # Add the symbol object into the linking commands.
1238145b7b3cSmrg	    compile_command="$compile_command @SYMFILE@"
1239145b7b3cSmrg	    finalize_command="$finalize_command @SYMFILE@"
1240145b7b3cSmrg	    preload=yes
1241145b7b3cSmrg	  fi
1242145b7b3cSmrg	  case $arg in
1243145b7b3cSmrg	  *.la | *.lo) ;;  # We handle these cases below.
1244145b7b3cSmrg	  force)
1245145b7b3cSmrg	    if test "$dlself" = no; then
1246145b7b3cSmrg	      dlself=needless
1247145b7b3cSmrg	      export_dynamic=yes
1248145b7b3cSmrg	    fi
1249145b7b3cSmrg	    prev=
1250145b7b3cSmrg	    continue
1251145b7b3cSmrg	    ;;
1252145b7b3cSmrg	  self)
1253145b7b3cSmrg	    if test "$prev" = dlprefiles; then
1254145b7b3cSmrg	      dlself=yes
1255145b7b3cSmrg	    elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then
1256145b7b3cSmrg	      dlself=yes
1257145b7b3cSmrg	    else
1258145b7b3cSmrg	      dlself=needless
1259145b7b3cSmrg	      export_dynamic=yes
1260145b7b3cSmrg	    fi
1261145b7b3cSmrg	    prev=
1262145b7b3cSmrg	    continue
1263145b7b3cSmrg	    ;;
1264145b7b3cSmrg	  *)
1265145b7b3cSmrg	    if test "$prev" = dlfiles; then
1266145b7b3cSmrg	      dlfiles="$dlfiles $arg"
1267145b7b3cSmrg	    else
1268145b7b3cSmrg	      dlprefiles="$dlprefiles $arg"
1269145b7b3cSmrg	    fi
1270145b7b3cSmrg	    prev=
1271145b7b3cSmrg	    continue
1272145b7b3cSmrg	    ;;
1273145b7b3cSmrg	  esac
1274145b7b3cSmrg	  ;;
1275145b7b3cSmrg	expsyms)
1276145b7b3cSmrg	  export_symbols="$arg"
1277145b7b3cSmrg	  if test ! -f "$arg"; then
1278145b7b3cSmrg	    $echo "$modename: symbol file \`$arg' does not exist"
1279145b7b3cSmrg	    exit $EXIT_FAILURE
1280145b7b3cSmrg	  fi
1281145b7b3cSmrg	  prev=
1282145b7b3cSmrg	  continue
1283145b7b3cSmrg	  ;;
1284145b7b3cSmrg	expsyms_regex)
1285145b7b3cSmrg	  export_symbols_regex="$arg"
1286145b7b3cSmrg	  prev=
1287145b7b3cSmrg	  continue
1288145b7b3cSmrg	  ;;
1289145b7b3cSmrg	inst_prefix)
1290145b7b3cSmrg	  inst_prefix_dir="$arg"
1291145b7b3cSmrg	  prev=
1292145b7b3cSmrg	  continue
1293145b7b3cSmrg	  ;;
1294145b7b3cSmrg	precious_regex)
1295145b7b3cSmrg	  precious_files_regex="$arg"
1296145b7b3cSmrg	  prev=
1297145b7b3cSmrg	  continue
1298145b7b3cSmrg	  ;;
1299145b7b3cSmrg	release)
1300145b7b3cSmrg	  release="-$arg"
1301145b7b3cSmrg	  prev=
1302145b7b3cSmrg	  continue
1303145b7b3cSmrg	  ;;
1304145b7b3cSmrg	objectlist)
1305145b7b3cSmrg	  if test -f "$arg"; then
1306145b7b3cSmrg	    save_arg=$arg
1307145b7b3cSmrg	    moreargs=
1308145b7b3cSmrg	    for fil in `cat $save_arg`
1309145b7b3cSmrg	    do
1310145b7b3cSmrg#	      moreargs="$moreargs $fil"
1311145b7b3cSmrg	      arg=$fil
1312145b7b3cSmrg	      # A libtool-controlled object.
1313145b7b3cSmrg
1314145b7b3cSmrg	      # Check to see that this really is a libtool object.
1315145b7b3cSmrg	      if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
1316145b7b3cSmrg		pic_object=
1317145b7b3cSmrg		non_pic_object=
1318145b7b3cSmrg
1319145b7b3cSmrg		# Read the .lo file
1320145b7b3cSmrg		# If there is no directory component, then add one.
1321145b7b3cSmrg		case $arg in
1322145b7b3cSmrg		*/* | *\\*) . $arg ;;
1323145b7b3cSmrg		*) . ./$arg ;;
1324145b7b3cSmrg		esac
1325145b7b3cSmrg
1326145b7b3cSmrg		if test -z "$pic_object" || \
1327145b7b3cSmrg		   test -z "$non_pic_object" ||
1328145b7b3cSmrg		   test "$pic_object" = none && \
1329145b7b3cSmrg		   test "$non_pic_object" = none; then
1330145b7b3cSmrg		  $echo "$modename: cannot find name of object for \`$arg'" 1>&2
1331145b7b3cSmrg		  exit $EXIT_FAILURE
1332145b7b3cSmrg		fi
1333145b7b3cSmrg
1334145b7b3cSmrg		# Extract subdirectory from the argument.
1335145b7b3cSmrg		xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
1336145b7b3cSmrg		if test "X$xdir" = "X$arg"; then
1337145b7b3cSmrg		  xdir=
1338145b7b3cSmrg		else
1339145b7b3cSmrg		  xdir="$xdir/"
1340145b7b3cSmrg		fi
1341145b7b3cSmrg
1342145b7b3cSmrg		if test "$pic_object" != none; then
1343145b7b3cSmrg		  # Prepend the subdirectory the object is found in.
1344145b7b3cSmrg		  pic_object="$xdir$pic_object"
1345145b7b3cSmrg
1346145b7b3cSmrg		  if test "$prev" = dlfiles; then
1347145b7b3cSmrg		    if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
1348145b7b3cSmrg		      dlfiles="$dlfiles $pic_object"
1349145b7b3cSmrg		      prev=
1350145b7b3cSmrg		      continue
1351145b7b3cSmrg		    else
1352145b7b3cSmrg		      # If libtool objects are unsupported, then we need to preload.
1353145b7b3cSmrg		      prev=dlprefiles
1354145b7b3cSmrg		    fi
1355145b7b3cSmrg		  fi
1356145b7b3cSmrg
1357145b7b3cSmrg		  # CHECK ME:  I think I busted this.  -Ossama
1358145b7b3cSmrg		  if test "$prev" = dlprefiles; then
1359145b7b3cSmrg		    # Preload the old-style object.
1360145b7b3cSmrg		    dlprefiles="$dlprefiles $pic_object"
1361145b7b3cSmrg		    prev=
1362145b7b3cSmrg		  fi
1363145b7b3cSmrg
1364145b7b3cSmrg		  # A PIC object.
1365145b7b3cSmrg		  libobjs="$libobjs $pic_object"
1366145b7b3cSmrg		  arg="$pic_object"
1367145b7b3cSmrg		fi
1368145b7b3cSmrg
1369145b7b3cSmrg		# Non-PIC object.
1370145b7b3cSmrg		if test "$non_pic_object" != none; then
1371145b7b3cSmrg		  # Prepend the subdirectory the object is found in.
1372145b7b3cSmrg		  non_pic_object="$xdir$non_pic_object"
1373145b7b3cSmrg
1374145b7b3cSmrg		  # A standard non-PIC object
1375145b7b3cSmrg		  non_pic_objects="$non_pic_objects $non_pic_object"
1376145b7b3cSmrg		  if test -z "$pic_object" || test "$pic_object" = none ; then
1377145b7b3cSmrg		    arg="$non_pic_object"
1378145b7b3cSmrg		  fi
1379145b7b3cSmrg		else
1380145b7b3cSmrg		  # If the PIC object exists, use it instead.
1381145b7b3cSmrg		  # $xdir was prepended to $pic_object above.
1382145b7b3cSmrg		  non_pic_object="$pic_object"
1383145b7b3cSmrg		  non_pic_objects="$non_pic_objects $non_pic_object"
1384145b7b3cSmrg		fi
1385145b7b3cSmrg	      else
1386145b7b3cSmrg		# Only an error if not doing a dry-run.
1387145b7b3cSmrg		if test -z "$run"; then
1388145b7b3cSmrg		  $echo "$modename: \`$arg' is not a valid libtool object" 1>&2
1389145b7b3cSmrg		  exit $EXIT_FAILURE
1390145b7b3cSmrg		else
1391145b7b3cSmrg		  # Dry-run case.
1392145b7b3cSmrg
1393145b7b3cSmrg		  # Extract subdirectory from the argument.
1394145b7b3cSmrg		  xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
1395145b7b3cSmrg		  if test "X$xdir" = "X$arg"; then
1396145b7b3cSmrg		    xdir=
1397145b7b3cSmrg		  else
1398145b7b3cSmrg		    xdir="$xdir/"
1399145b7b3cSmrg		  fi
1400145b7b3cSmrg
1401145b7b3cSmrg		  pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"`
1402145b7b3cSmrg		  non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"`
1403145b7b3cSmrg		  libobjs="$libobjs $pic_object"
1404145b7b3cSmrg		  non_pic_objects="$non_pic_objects $non_pic_object"
1405145b7b3cSmrg		fi
1406145b7b3cSmrg	      fi
1407145b7b3cSmrg	    done
1408145b7b3cSmrg	  else
1409145b7b3cSmrg	    $echo "$modename: link input file \`$save_arg' does not exist"
1410145b7b3cSmrg	    exit $EXIT_FAILURE
1411145b7b3cSmrg	  fi
1412145b7b3cSmrg	  arg=$save_arg
1413145b7b3cSmrg	  prev=
1414145b7b3cSmrg	  continue
1415145b7b3cSmrg	  ;;
1416145b7b3cSmrg	rpath | xrpath)
1417145b7b3cSmrg	  # We need an absolute path.
1418145b7b3cSmrg	  case $arg in
1419145b7b3cSmrg	  [\\/]* | [A-Za-z]:[\\/]*) ;;
1420145b7b3cSmrg	  *)
1421145b7b3cSmrg	    $echo "$modename: only absolute run-paths are allowed" 1>&2
1422145b7b3cSmrg	    exit $EXIT_FAILURE
1423145b7b3cSmrg	    ;;
1424145b7b3cSmrg	  esac
1425145b7b3cSmrg	  if test "$prev" = rpath; then
1426145b7b3cSmrg	    case "$rpath " in
1427145b7b3cSmrg	    *" $arg "*) ;;
1428145b7b3cSmrg	    *) rpath="$rpath $arg" ;;
1429145b7b3cSmrg	    esac
1430145b7b3cSmrg	  else
1431145b7b3cSmrg	    case "$xrpath " in
1432145b7b3cSmrg	    *" $arg "*) ;;
1433145b7b3cSmrg	    *) xrpath="$xrpath $arg" ;;
1434145b7b3cSmrg	    esac
1435145b7b3cSmrg	  fi
1436145b7b3cSmrg	  prev=
1437145b7b3cSmrg	  continue
1438145b7b3cSmrg	  ;;
1439145b7b3cSmrg	xcompiler)
1440145b7b3cSmrg	  compiler_flags="$compiler_flags $qarg"
1441145b7b3cSmrg	  prev=
1442145b7b3cSmrg	  compile_command="$compile_command $qarg"
1443145b7b3cSmrg	  finalize_command="$finalize_command $qarg"
1444145b7b3cSmrg	  continue
1445145b7b3cSmrg	  ;;
1446145b7b3cSmrg	xlinker)
1447145b7b3cSmrg	  linker_flags="$linker_flags $qarg"
1448145b7b3cSmrg	  compiler_flags="$compiler_flags $wl$qarg"
1449145b7b3cSmrg	  prev=
1450145b7b3cSmrg	  compile_command="$compile_command $wl$qarg"
1451145b7b3cSmrg	  finalize_command="$finalize_command $wl$qarg"
1452145b7b3cSmrg	  continue
1453145b7b3cSmrg	  ;;
1454145b7b3cSmrg	xcclinker)
1455145b7b3cSmrg	  linker_flags="$linker_flags $qarg"
1456145b7b3cSmrg	  compiler_flags="$compiler_flags $qarg"
1457145b7b3cSmrg	  prev=
1458145b7b3cSmrg	  compile_command="$compile_command $qarg"
1459145b7b3cSmrg	  finalize_command="$finalize_command $qarg"
1460145b7b3cSmrg	  continue
1461145b7b3cSmrg	  ;;
1462145b7b3cSmrg	shrext)
1463145b7b3cSmrg  	  shrext_cmds="$arg"
1464145b7b3cSmrg	  prev=
1465145b7b3cSmrg	  continue
1466145b7b3cSmrg	  ;;
1467145b7b3cSmrg	darwin_framework|darwin_framework_skip)
1468145b7b3cSmrg	  test "$prev" = "darwin_framework" && compiler_flags="$compiler_flags $arg"
1469145b7b3cSmrg	  compile_command="$compile_command $arg"
1470145b7b3cSmrg	  finalize_command="$finalize_command $arg"
1471145b7b3cSmrg	  prev=
1472145b7b3cSmrg	  continue
1473145b7b3cSmrg	  ;;
1474145b7b3cSmrg	*)
1475145b7b3cSmrg	  eval "$prev=\"\$arg\""
1476145b7b3cSmrg	  prev=
1477145b7b3cSmrg	  continue
1478145b7b3cSmrg	  ;;
1479145b7b3cSmrg	esac
1480145b7b3cSmrg      fi # test -n "$prev"
1481145b7b3cSmrg
1482145b7b3cSmrg      prevarg="$arg"
1483145b7b3cSmrg
1484145b7b3cSmrg      case $arg in
1485145b7b3cSmrg      -all-static)
1486145b7b3cSmrg	if test -n "$link_static_flag"; then
1487145b7b3cSmrg	  compile_command="$compile_command $link_static_flag"
1488145b7b3cSmrg	  finalize_command="$finalize_command $link_static_flag"
1489145b7b3cSmrg	fi
1490145b7b3cSmrg	continue
1491145b7b3cSmrg	;;
1492145b7b3cSmrg
1493145b7b3cSmrg      -allow-undefined)
1494145b7b3cSmrg	# FIXME: remove this flag sometime in the future.
1495145b7b3cSmrg	$echo "$modename: \`-allow-undefined' is deprecated because it is the default" 1>&2
1496145b7b3cSmrg	continue
1497145b7b3cSmrg	;;
1498145b7b3cSmrg
1499145b7b3cSmrg      -avoid-version)
1500145b7b3cSmrg	avoid_version=yes
1501145b7b3cSmrg	continue
1502145b7b3cSmrg	;;
1503145b7b3cSmrg
1504145b7b3cSmrg      -dlopen)
1505145b7b3cSmrg	prev=dlfiles
1506145b7b3cSmrg	continue
1507145b7b3cSmrg	;;
1508145b7b3cSmrg
1509145b7b3cSmrg      -dlpreopen)
1510145b7b3cSmrg	prev=dlprefiles
1511145b7b3cSmrg	continue
1512145b7b3cSmrg	;;
1513145b7b3cSmrg
1514145b7b3cSmrg      -export-dynamic)
1515145b7b3cSmrg	export_dynamic=yes
1516145b7b3cSmrg	continue
1517145b7b3cSmrg	;;
1518145b7b3cSmrg
1519145b7b3cSmrg      -export-symbols | -export-symbols-regex)
1520145b7b3cSmrg	if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
1521145b7b3cSmrg	  $echo "$modename: more than one -exported-symbols argument is not allowed"
1522145b7b3cSmrg	  exit $EXIT_FAILURE
1523145b7b3cSmrg	fi
1524145b7b3cSmrg	if test "X$arg" = "X-export-symbols"; then
1525145b7b3cSmrg	  prev=expsyms
1526145b7b3cSmrg	else
1527145b7b3cSmrg	  prev=expsyms_regex
1528145b7b3cSmrg	fi
1529145b7b3cSmrg	continue
1530145b7b3cSmrg	;;
1531145b7b3cSmrg
1532145b7b3cSmrg      -framework|-arch|-isysroot)
1533145b7b3cSmrg	case " $CC " in
1534145b7b3cSmrg	  *" ${arg} ${1} "* | *" ${arg}	${1} "*) 
1535145b7b3cSmrg		prev=darwin_framework_skip ;;
1536145b7b3cSmrg	  *) compiler_flags="$compiler_flags $arg"
1537145b7b3cSmrg	     prev=darwin_framework ;;
1538145b7b3cSmrg	esac
1539145b7b3cSmrg	compile_command="$compile_command $arg"
1540145b7b3cSmrg	finalize_command="$finalize_command $arg"
1541145b7b3cSmrg	continue
1542145b7b3cSmrg	;;
1543145b7b3cSmrg
1544145b7b3cSmrg      -inst-prefix-dir)
1545145b7b3cSmrg	prev=inst_prefix
1546145b7b3cSmrg	continue
1547145b7b3cSmrg	;;
1548145b7b3cSmrg
1549145b7b3cSmrg      # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:*
1550145b7b3cSmrg      # so, if we see these flags be careful not to treat them like -L
1551145b7b3cSmrg      -L[A-Z][A-Z]*:*)
1552145b7b3cSmrg	case $with_gcc/$host in
1553145b7b3cSmrg	no/*-*-irix* | /*-*-irix*)
1554145b7b3cSmrg	  compile_command="$compile_command $arg"
1555145b7b3cSmrg	  finalize_command="$finalize_command $arg"
1556145b7b3cSmrg	  ;;
1557145b7b3cSmrg	esac
1558145b7b3cSmrg	continue
1559145b7b3cSmrg	;;
1560145b7b3cSmrg
1561145b7b3cSmrg      -L*)
1562145b7b3cSmrg	dir=`$echo "X$arg" | $Xsed -e 's/^-L//'`
1563145b7b3cSmrg	# We need an absolute path.
1564145b7b3cSmrg	case $dir in
1565145b7b3cSmrg	[\\/]* | [A-Za-z]:[\\/]*) ;;
1566145b7b3cSmrg	*)
1567145b7b3cSmrg	  absdir=`cd "$dir" && pwd`
1568145b7b3cSmrg	  if test -z "$absdir"; then
1569145b7b3cSmrg	    $echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2
1570145b7b3cSmrg	    absdir="$dir"
1571145b7b3cSmrg	    notinst_path="$notinst_path $dir"
1572145b7b3cSmrg	  fi
1573145b7b3cSmrg	  dir="$absdir"
1574145b7b3cSmrg	  ;;
1575145b7b3cSmrg	esac
1576145b7b3cSmrg	case "$deplibs " in
1577145b7b3cSmrg	*" -L$dir "*) ;;
1578145b7b3cSmrg	*)
1579145b7b3cSmrg	  deplibs="$deplibs -L$dir"
1580145b7b3cSmrg	  lib_search_path="$lib_search_path $dir"
1581145b7b3cSmrg	  ;;
1582145b7b3cSmrg	esac
1583145b7b3cSmrg	case $host in
1584145b7b3cSmrg	*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
1585145b7b3cSmrg	  testbindir=`$echo "X$dir" | $Xsed -e 's*/lib$*/bin*'`
1586145b7b3cSmrg	  case :$dllsearchpath: in
1587145b7b3cSmrg	  *":$dir:"*) ;;
1588145b7b3cSmrg	  *) dllsearchpath="$dllsearchpath:$dir";;
1589145b7b3cSmrg	  esac
1590145b7b3cSmrg	  case :$dllsearchpath: in
1591145b7b3cSmrg	  *":$testbindir:"*) ;;
1592145b7b3cSmrg	  *) dllsearchpath="$dllsearchpath:$testbindir";;
1593145b7b3cSmrg	  esac
1594145b7b3cSmrg	  ;;
1595145b7b3cSmrg	esac
1596145b7b3cSmrg	continue
1597145b7b3cSmrg	;;
1598145b7b3cSmrg
1599145b7b3cSmrg      -l*)
1600145b7b3cSmrg	if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then
1601145b7b3cSmrg	  case $host in
1602145b7b3cSmrg	  *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos*)
1603145b7b3cSmrg	    # These systems don't actually have a C or math library (as such)
1604145b7b3cSmrg	    continue
1605145b7b3cSmrg	    ;;
1606145b7b3cSmrg	  *-*-os2*)
1607145b7b3cSmrg	    # These systems don't actually have a C library (as such)
1608145b7b3cSmrg	    test "X$arg" = "X-lc" && continue
1609145b7b3cSmrg	    ;;
1610145b7b3cSmrg	  *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
1611145b7b3cSmrg	    # Do not include libc due to us having libc/libc_r.
1612145b7b3cSmrg	    test "X$arg" = "X-lc" && continue
1613145b7b3cSmrg	    ;;
1614145b7b3cSmrg	  *-*-rhapsody* | *-*-darwin1.[012])
1615145b7b3cSmrg	    # Rhapsody C and math libraries are in the System framework
1616145b7b3cSmrg	    deplibs="$deplibs -framework System"
1617145b7b3cSmrg	    continue
1618145b7b3cSmrg	    ;;
1619145b7b3cSmrg	  *-*-sco3.2v5* | *-*-sco5v6*)
1620145b7b3cSmrg	    # Causes problems with __ctype
1621145b7b3cSmrg	    test "X$arg" = "X-lc" && continue
1622145b7b3cSmrg	    ;;
1623145b7b3cSmrg	  *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
1624145b7b3cSmrg	    # Compiler inserts libc in the correct place for threads to work
1625145b7b3cSmrg	    test "X$arg" = "X-lc" && continue
1626145b7b3cSmrg	    ;;
1627145b7b3cSmrg	  esac
1628145b7b3cSmrg	elif test "X$arg" = "X-lc_r"; then
1629145b7b3cSmrg	 case $host in
1630145b7b3cSmrg	 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
1631145b7b3cSmrg	   # Do not include libc_r directly, use -pthread flag.
1632145b7b3cSmrg	   continue
1633145b7b3cSmrg	   ;;
1634145b7b3cSmrg	 esac
1635145b7b3cSmrg	fi
1636145b7b3cSmrg	deplibs="$deplibs $arg"
1637145b7b3cSmrg	continue
1638145b7b3cSmrg	;;
1639145b7b3cSmrg
1640145b7b3cSmrg      # Tru64 UNIX uses -model [arg] to determine the layout of C++
1641145b7b3cSmrg      # classes, name mangling, and exception handling.
1642145b7b3cSmrg      -model)
1643145b7b3cSmrg	compile_command="$compile_command $arg"
1644145b7b3cSmrg	compiler_flags="$compiler_flags $arg"
1645145b7b3cSmrg	finalize_command="$finalize_command $arg"
1646145b7b3cSmrg	prev=xcompiler
1647145b7b3cSmrg	continue
1648145b7b3cSmrg	;;
1649145b7b3cSmrg
1650578741aaSmrg     -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads)
1651145b7b3cSmrg	compiler_flags="$compiler_flags $arg"
1652145b7b3cSmrg	compile_command="$compile_command $arg"
1653145b7b3cSmrg	finalize_command="$finalize_command $arg"
1654145b7b3cSmrg	continue
1655145b7b3cSmrg	;;
1656145b7b3cSmrg
1657578741aaSmrg      -multi_module)
1658578741aaSmrg	single_module="${wl}-multi_module"
1659578741aaSmrg	continue
1660578741aaSmrg	;;
1661578741aaSmrg
1662145b7b3cSmrg      -module)
1663145b7b3cSmrg	module=yes
1664145b7b3cSmrg	continue
1665145b7b3cSmrg	;;
1666145b7b3cSmrg
1667145b7b3cSmrg      # -64, -mips[0-9] enable 64-bit mode on the SGI compiler
1668145b7b3cSmrg      # -r[0-9][0-9]* specifies the processor on the SGI compiler
1669145b7b3cSmrg      # -xarch=*, -xtarget=* enable 64-bit mode on the Sun compiler
1670145b7b3cSmrg      # +DA*, +DD* enable 64-bit mode on the HP compiler
1671145b7b3cSmrg      # -q* pass through compiler args for the IBM compiler
1672145b7b3cSmrg      # -m* pass through architecture-specific compiler args for GCC
1673145b7b3cSmrg      # -m*, -t[45]*, -txscale* pass through architecture-specific
1674145b7b3cSmrg      # compiler args for GCC
1675578741aaSmrg      # -p, -pg, --coverage, -fprofile-* pass through profiling flag for GCC
1676578741aaSmrg      # -F/path gives path to uninstalled frameworks, gcc on darwin
1677145b7b3cSmrg      # @file GCC response files
1678578741aaSmrg      -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \
1679578741aaSmrg      -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*)
1680145b7b3cSmrg
1681145b7b3cSmrg	# Unknown arguments in both finalize_command and compile_command need
1682145b7b3cSmrg	# to be aesthetically quoted because they are evaled later.
1683145b7b3cSmrg	arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
1684145b7b3cSmrg	case $arg in
1685145b7b3cSmrg	*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
1686145b7b3cSmrg	  arg="\"$arg\""
1687145b7b3cSmrg	  ;;
1688145b7b3cSmrg	esac
1689145b7b3cSmrg        compile_command="$compile_command $arg"
1690145b7b3cSmrg        finalize_command="$finalize_command $arg"
1691145b7b3cSmrg        compiler_flags="$compiler_flags $arg"
1692145b7b3cSmrg        continue
1693145b7b3cSmrg        ;;
1694145b7b3cSmrg
1695145b7b3cSmrg      -shrext)
1696145b7b3cSmrg	prev=shrext
1697145b7b3cSmrg	continue
1698145b7b3cSmrg	;;
1699145b7b3cSmrg
1700145b7b3cSmrg      -no-fast-install)
1701145b7b3cSmrg	fast_install=no
1702145b7b3cSmrg	continue
1703145b7b3cSmrg	;;
1704145b7b3cSmrg
1705145b7b3cSmrg      -no-install)
1706145b7b3cSmrg	case $host in
1707578741aaSmrg	*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin*)
1708145b7b3cSmrg	  # The PATH hackery in wrapper scripts is required on Windows
1709578741aaSmrg	  # and Darwin in order for the loader to find any dlls it needs.
1710145b7b3cSmrg	  $echo "$modename: warning: \`-no-install' is ignored for $host" 1>&2
1711145b7b3cSmrg	  $echo "$modename: warning: assuming \`-no-fast-install' instead" 1>&2
1712145b7b3cSmrg	  fast_install=no
1713145b7b3cSmrg	  ;;
1714145b7b3cSmrg	*) no_install=yes ;;
1715145b7b3cSmrg	esac
1716145b7b3cSmrg	continue
1717145b7b3cSmrg	;;
1718145b7b3cSmrg
1719145b7b3cSmrg      -no-undefined)
1720145b7b3cSmrg	allow_undefined=no
1721145b7b3cSmrg	continue
1722145b7b3cSmrg	;;
1723145b7b3cSmrg
1724145b7b3cSmrg      -objectlist)
1725145b7b3cSmrg	prev=objectlist
1726145b7b3cSmrg	continue
1727145b7b3cSmrg	;;
1728145b7b3cSmrg
1729145b7b3cSmrg      -o) prev=output ;;
1730145b7b3cSmrg
1731145b7b3cSmrg      -precious-files-regex)
1732145b7b3cSmrg	prev=precious_regex
1733145b7b3cSmrg	continue
1734145b7b3cSmrg	;;
1735145b7b3cSmrg
1736145b7b3cSmrg      -release)
1737145b7b3cSmrg	prev=release
1738145b7b3cSmrg	continue
1739145b7b3cSmrg	;;
1740145b7b3cSmrg
1741145b7b3cSmrg      -rpath)
1742145b7b3cSmrg	prev=rpath
1743145b7b3cSmrg	continue
1744145b7b3cSmrg	;;
1745145b7b3cSmrg
1746145b7b3cSmrg      -R)
1747145b7b3cSmrg	prev=xrpath
1748145b7b3cSmrg	continue
1749145b7b3cSmrg	;;
1750145b7b3cSmrg
1751145b7b3cSmrg      -R*)
1752145b7b3cSmrg	dir=`$echo "X$arg" | $Xsed -e 's/^-R//'`
1753145b7b3cSmrg	# We need an absolute path.
1754145b7b3cSmrg	case $dir in
1755145b7b3cSmrg	[\\/]* | [A-Za-z]:[\\/]*) ;;
1756145b7b3cSmrg	*)
1757145b7b3cSmrg	  $echo "$modename: only absolute run-paths are allowed" 1>&2
1758145b7b3cSmrg	  exit $EXIT_FAILURE
1759145b7b3cSmrg	  ;;
1760145b7b3cSmrg	esac
1761145b7b3cSmrg	case "$xrpath " in
1762145b7b3cSmrg	*" $dir "*) ;;
1763145b7b3cSmrg	*) xrpath="$xrpath $dir" ;;
1764145b7b3cSmrg	esac
1765145b7b3cSmrg	continue
1766145b7b3cSmrg	;;
1767145b7b3cSmrg
1768578741aaSmrg      -static | -static-libtool-libs)
1769145b7b3cSmrg	# The effects of -static are defined in a previous loop.
1770145b7b3cSmrg	# We used to do the same as -all-static on platforms that
1771145b7b3cSmrg	# didn't have a PIC flag, but the assumption that the effects
1772145b7b3cSmrg	# would be equivalent was wrong.  It would break on at least
1773145b7b3cSmrg	# Digital Unix and AIX.
1774145b7b3cSmrg	continue
1775145b7b3cSmrg	;;
1776145b7b3cSmrg
1777145b7b3cSmrg      -thread-safe)
1778145b7b3cSmrg	thread_safe=yes
1779145b7b3cSmrg	continue
1780145b7b3cSmrg	;;
1781145b7b3cSmrg
1782145b7b3cSmrg      -version-info)
1783145b7b3cSmrg	prev=vinfo
1784145b7b3cSmrg	continue
1785145b7b3cSmrg	;;
1786145b7b3cSmrg      -version-number)
1787145b7b3cSmrg	prev=vinfo
1788145b7b3cSmrg	vinfo_number=yes
1789145b7b3cSmrg	continue
1790145b7b3cSmrg	;;
1791145b7b3cSmrg
1792145b7b3cSmrg      -Wc,*)
1793145b7b3cSmrg	args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wc,//'`
1794145b7b3cSmrg	arg=
1795145b7b3cSmrg	save_ifs="$IFS"; IFS=','
1796145b7b3cSmrg	for flag in $args; do
1797145b7b3cSmrg	  IFS="$save_ifs"
1798145b7b3cSmrg	  case $flag in
1799145b7b3cSmrg	    *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
1800145b7b3cSmrg	    flag="\"$flag\""
1801145b7b3cSmrg	    ;;
1802145b7b3cSmrg	  esac
1803145b7b3cSmrg	  arg="$arg $wl$flag"
1804145b7b3cSmrg	  compiler_flags="$compiler_flags $flag"
1805145b7b3cSmrg	done
1806145b7b3cSmrg	IFS="$save_ifs"
1807145b7b3cSmrg	arg=`$echo "X$arg" | $Xsed -e "s/^ //"`
1808145b7b3cSmrg	;;
1809145b7b3cSmrg
1810145b7b3cSmrg      -Wl,*)
1811145b7b3cSmrg	args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wl,//'`
1812145b7b3cSmrg	arg=
1813145b7b3cSmrg	save_ifs="$IFS"; IFS=','
1814145b7b3cSmrg	for flag in $args; do
1815145b7b3cSmrg	  IFS="$save_ifs"
1816145b7b3cSmrg	  case $flag in
1817145b7b3cSmrg	    *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
1818145b7b3cSmrg	    flag="\"$flag\""
1819145b7b3cSmrg	    ;;
1820145b7b3cSmrg	  esac
1821145b7b3cSmrg	  arg="$arg $wl$flag"
1822145b7b3cSmrg	  compiler_flags="$compiler_flags $wl$flag"
1823145b7b3cSmrg	  linker_flags="$linker_flags $flag"
1824145b7b3cSmrg	done
1825145b7b3cSmrg	IFS="$save_ifs"
1826145b7b3cSmrg	arg=`$echo "X$arg" | $Xsed -e "s/^ //"`
1827145b7b3cSmrg	;;
1828145b7b3cSmrg
1829145b7b3cSmrg      -Xcompiler)
1830145b7b3cSmrg	prev=xcompiler
1831145b7b3cSmrg	continue
1832145b7b3cSmrg	;;
1833145b7b3cSmrg
1834145b7b3cSmrg      -Xlinker)
1835145b7b3cSmrg	prev=xlinker
1836145b7b3cSmrg	continue
1837145b7b3cSmrg	;;
1838145b7b3cSmrg
1839145b7b3cSmrg      -XCClinker)
1840145b7b3cSmrg	prev=xcclinker
1841145b7b3cSmrg	continue
1842145b7b3cSmrg	;;
1843145b7b3cSmrg
1844145b7b3cSmrg      # Some other compiler flag.
1845145b7b3cSmrg      -* | +*)
1846145b7b3cSmrg	# Unknown arguments in both finalize_command and compile_command need
1847145b7b3cSmrg	# to be aesthetically quoted because they are evaled later.
1848145b7b3cSmrg	arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
1849145b7b3cSmrg	case $arg in
1850145b7b3cSmrg	*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
1851145b7b3cSmrg	  arg="\"$arg\""
1852145b7b3cSmrg	  ;;
1853145b7b3cSmrg	esac
1854145b7b3cSmrg	;;
1855145b7b3cSmrg
1856145b7b3cSmrg      *.$objext)
1857145b7b3cSmrg	# A standard object.
1858145b7b3cSmrg	objs="$objs $arg"
1859145b7b3cSmrg	;;
1860145b7b3cSmrg
1861145b7b3cSmrg      *.lo)
1862145b7b3cSmrg	# A libtool-controlled object.
1863145b7b3cSmrg
1864145b7b3cSmrg	# Check to see that this really is a libtool object.
1865145b7b3cSmrg	if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
1866145b7b3cSmrg	  pic_object=
1867145b7b3cSmrg	  non_pic_object=
1868145b7b3cSmrg
1869145b7b3cSmrg	  # Read the .lo file
1870145b7b3cSmrg	  # If there is no directory component, then add one.
1871145b7b3cSmrg	  case $arg in
1872145b7b3cSmrg	  */* | *\\*) . $arg ;;
1873145b7b3cSmrg	  *) . ./$arg ;;
1874145b7b3cSmrg	  esac
1875145b7b3cSmrg
1876145b7b3cSmrg	  if test -z "$pic_object" || \
1877145b7b3cSmrg	     test -z "$non_pic_object" ||
1878145b7b3cSmrg	     test "$pic_object" = none && \
1879145b7b3cSmrg	     test "$non_pic_object" = none; then
1880145b7b3cSmrg	    $echo "$modename: cannot find name of object for \`$arg'" 1>&2
1881145b7b3cSmrg	    exit $EXIT_FAILURE
1882145b7b3cSmrg	  fi
1883145b7b3cSmrg
1884145b7b3cSmrg	  # Extract subdirectory from the argument.
1885145b7b3cSmrg	  xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
1886145b7b3cSmrg	  if test "X$xdir" = "X$arg"; then
1887145b7b3cSmrg	    xdir=
1888145b7b3cSmrg 	  else
1889145b7b3cSmrg	    xdir="$xdir/"
1890145b7b3cSmrg	  fi
1891145b7b3cSmrg
1892145b7b3cSmrg	  if test "$pic_object" != none; then
1893145b7b3cSmrg	    # Prepend the subdirectory the object is found in.
1894145b7b3cSmrg	    pic_object="$xdir$pic_object"
1895145b7b3cSmrg
1896145b7b3cSmrg	    if test "$prev" = dlfiles; then
1897145b7b3cSmrg	      if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
1898145b7b3cSmrg		dlfiles="$dlfiles $pic_object"
1899145b7b3cSmrg		prev=
1900145b7b3cSmrg		continue
1901145b7b3cSmrg	      else
1902145b7b3cSmrg		# If libtool objects are unsupported, then we need to preload.
1903145b7b3cSmrg		prev=dlprefiles
1904145b7b3cSmrg	      fi
1905145b7b3cSmrg	    fi
1906145b7b3cSmrg
1907145b7b3cSmrg	    # CHECK ME:  I think I busted this.  -Ossama
1908145b7b3cSmrg	    if test "$prev" = dlprefiles; then
1909145b7b3cSmrg	      # Preload the old-style object.
1910145b7b3cSmrg	      dlprefiles="$dlprefiles $pic_object"
1911145b7b3cSmrg	      prev=
1912145b7b3cSmrg	    fi
1913145b7b3cSmrg
1914145b7b3cSmrg	    # A PIC object.
1915145b7b3cSmrg	    libobjs="$libobjs $pic_object"
1916145b7b3cSmrg	    arg="$pic_object"
1917145b7b3cSmrg	  fi
1918145b7b3cSmrg
1919145b7b3cSmrg	  # Non-PIC object.
1920145b7b3cSmrg	  if test "$non_pic_object" != none; then
1921145b7b3cSmrg	    # Prepend the subdirectory the object is found in.
1922145b7b3cSmrg	    non_pic_object="$xdir$non_pic_object"
1923145b7b3cSmrg
1924145b7b3cSmrg	    # A standard non-PIC object
1925145b7b3cSmrg	    non_pic_objects="$non_pic_objects $non_pic_object"
1926145b7b3cSmrg	    if test -z "$pic_object" || test "$pic_object" = none ; then
1927145b7b3cSmrg	      arg="$non_pic_object"
1928145b7b3cSmrg	    fi
1929145b7b3cSmrg	  else
1930145b7b3cSmrg	    # If the PIC object exists, use it instead.
1931145b7b3cSmrg	    # $xdir was prepended to $pic_object above.
1932145b7b3cSmrg	    non_pic_object="$pic_object"
1933145b7b3cSmrg	    non_pic_objects="$non_pic_objects $non_pic_object"
1934145b7b3cSmrg	  fi
1935145b7b3cSmrg	else
1936145b7b3cSmrg	  # Only an error if not doing a dry-run.
1937145b7b3cSmrg	  if test -z "$run"; then
1938145b7b3cSmrg	    $echo "$modename: \`$arg' is not a valid libtool object" 1>&2
1939145b7b3cSmrg	    exit $EXIT_FAILURE
1940145b7b3cSmrg	  else
1941145b7b3cSmrg	    # Dry-run case.
1942145b7b3cSmrg
1943145b7b3cSmrg	    # Extract subdirectory from the argument.
1944145b7b3cSmrg	    xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
1945145b7b3cSmrg	    if test "X$xdir" = "X$arg"; then
1946145b7b3cSmrg	      xdir=
1947145b7b3cSmrg	    else
1948145b7b3cSmrg	      xdir="$xdir/"
1949145b7b3cSmrg	    fi
1950145b7b3cSmrg
1951145b7b3cSmrg	    pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"`
1952145b7b3cSmrg	    non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"`
1953145b7b3cSmrg	    libobjs="$libobjs $pic_object"
1954145b7b3cSmrg	    non_pic_objects="$non_pic_objects $non_pic_object"
1955145b7b3cSmrg	  fi
1956145b7b3cSmrg	fi
1957145b7b3cSmrg	;;
1958145b7b3cSmrg
1959145b7b3cSmrg      *.$libext)
1960145b7b3cSmrg	# An archive.
1961145b7b3cSmrg	deplibs="$deplibs $arg"
1962145b7b3cSmrg	old_deplibs="$old_deplibs $arg"
1963145b7b3cSmrg	continue
1964145b7b3cSmrg	;;
1965145b7b3cSmrg
1966145b7b3cSmrg      *.la)
1967145b7b3cSmrg	# A libtool-controlled library.
1968145b7b3cSmrg
1969145b7b3cSmrg	if test "$prev" = dlfiles; then
1970145b7b3cSmrg	  # This library was specified with -dlopen.
1971145b7b3cSmrg	  dlfiles="$dlfiles $arg"
1972145b7b3cSmrg	  prev=
1973145b7b3cSmrg	elif test "$prev" = dlprefiles; then
1974145b7b3cSmrg	  # The library was specified with -dlpreopen.
1975145b7b3cSmrg	  dlprefiles="$dlprefiles $arg"
1976145b7b3cSmrg	  prev=
1977145b7b3cSmrg	else
1978145b7b3cSmrg	  deplibs="$deplibs $arg"
1979145b7b3cSmrg	fi
1980145b7b3cSmrg	continue
1981145b7b3cSmrg	;;
1982145b7b3cSmrg
1983145b7b3cSmrg      # Some other compiler argument.
1984145b7b3cSmrg      *)
1985145b7b3cSmrg	# Unknown arguments in both finalize_command and compile_command need
1986145b7b3cSmrg	# to be aesthetically quoted because they are evaled later.
1987145b7b3cSmrg	arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
1988145b7b3cSmrg	case $arg in
1989145b7b3cSmrg	*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
1990145b7b3cSmrg	  arg="\"$arg\""
1991145b7b3cSmrg	  ;;
1992145b7b3cSmrg	esac
1993145b7b3cSmrg	;;
1994145b7b3cSmrg      esac # arg
1995145b7b3cSmrg
1996145b7b3cSmrg      # Now actually substitute the argument into the commands.
1997145b7b3cSmrg      if test -n "$arg"; then
1998145b7b3cSmrg	compile_command="$compile_command $arg"
1999145b7b3cSmrg	finalize_command="$finalize_command $arg"
2000145b7b3cSmrg      fi
2001145b7b3cSmrg    done # argument parsing loop
2002145b7b3cSmrg
2003145b7b3cSmrg    if test -n "$prev"; then
2004145b7b3cSmrg      $echo "$modename: the \`$prevarg' option requires an argument" 1>&2
2005145b7b3cSmrg      $echo "$help" 1>&2
2006145b7b3cSmrg      exit $EXIT_FAILURE
2007145b7b3cSmrg    fi
2008145b7b3cSmrg
2009145b7b3cSmrg    if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then
2010145b7b3cSmrg      eval arg=\"$export_dynamic_flag_spec\"
2011145b7b3cSmrg      compile_command="$compile_command $arg"
2012145b7b3cSmrg      finalize_command="$finalize_command $arg"
2013145b7b3cSmrg    fi
2014145b7b3cSmrg
2015145b7b3cSmrg    oldlibs=
2016145b7b3cSmrg    # calculate the name of the file, without its directory
2017145b7b3cSmrg    outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'`
2018145b7b3cSmrg    libobjs_save="$libobjs"
2019145b7b3cSmrg
2020145b7b3cSmrg    if test -n "$shlibpath_var"; then
2021145b7b3cSmrg      # get the directories listed in $shlibpath_var
2022145b7b3cSmrg      eval shlib_search_path=\`\$echo \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\`
2023145b7b3cSmrg    else
2024145b7b3cSmrg      shlib_search_path=
2025145b7b3cSmrg    fi
2026145b7b3cSmrg    eval sys_lib_search_path=\"$sys_lib_search_path_spec\"
2027145b7b3cSmrg    eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\"
2028145b7b3cSmrg
2029145b7b3cSmrg    output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'`
2030145b7b3cSmrg    if test "X$output_objdir" = "X$output"; then
2031145b7b3cSmrg      output_objdir="$objdir"
2032145b7b3cSmrg    else
2033145b7b3cSmrg      output_objdir="$output_objdir/$objdir"
2034145b7b3cSmrg    fi
2035145b7b3cSmrg    # Create the object directory.
2036145b7b3cSmrg    if test ! -d "$output_objdir"; then
2037145b7b3cSmrg      $show "$mkdir $output_objdir"
2038145b7b3cSmrg      $run $mkdir $output_objdir
2039145b7b3cSmrg      exit_status=$?
2040145b7b3cSmrg      if test "$exit_status" -ne 0 && test ! -d "$output_objdir"; then
2041145b7b3cSmrg	exit $exit_status
2042145b7b3cSmrg      fi
2043145b7b3cSmrg    fi
2044145b7b3cSmrg
2045145b7b3cSmrg    # Determine the type of output
2046145b7b3cSmrg    case $output in
2047145b7b3cSmrg    "")
2048145b7b3cSmrg      $echo "$modename: you must specify an output file" 1>&2
2049145b7b3cSmrg      $echo "$help" 1>&2
2050145b7b3cSmrg      exit $EXIT_FAILURE
2051145b7b3cSmrg      ;;
2052145b7b3cSmrg    *.$libext) linkmode=oldlib ;;
2053145b7b3cSmrg    *.lo | *.$objext) linkmode=obj ;;
2054145b7b3cSmrg    *.la) linkmode=lib ;;
2055145b7b3cSmrg    *) linkmode=prog ;; # Anything else should be a program.
2056145b7b3cSmrg    esac
2057145b7b3cSmrg
2058145b7b3cSmrg    case $host in
2059145b7b3cSmrg    *cygwin* | *mingw* | *pw32*)
2060145b7b3cSmrg      # don't eliminate duplications in $postdeps and $predeps
2061145b7b3cSmrg      duplicate_compiler_generated_deps=yes
2062145b7b3cSmrg      ;;
2063145b7b3cSmrg    *)
2064145b7b3cSmrg      duplicate_compiler_generated_deps=$duplicate_deps
2065145b7b3cSmrg      ;;
2066145b7b3cSmrg    esac
2067145b7b3cSmrg    specialdeplibs=
2068145b7b3cSmrg
2069145b7b3cSmrg    libs=
2070145b7b3cSmrg    # Find all interdependent deplibs by searching for libraries
2071145b7b3cSmrg    # that are linked more than once (e.g. -la -lb -la)
2072145b7b3cSmrg    for deplib in $deplibs; do
2073145b7b3cSmrg      if test "X$duplicate_deps" = "Xyes" ; then
2074145b7b3cSmrg	case "$libs " in
2075145b7b3cSmrg	*" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
2076145b7b3cSmrg	esac
2077145b7b3cSmrg      fi
2078145b7b3cSmrg      libs="$libs $deplib"
2079145b7b3cSmrg    done
2080145b7b3cSmrg
2081145b7b3cSmrg    if test "$linkmode" = lib; then
2082145b7b3cSmrg      libs="$predeps $libs $compiler_lib_search_path $postdeps"
2083145b7b3cSmrg
2084145b7b3cSmrg      # Compute libraries that are listed more than once in $predeps
2085145b7b3cSmrg      # $postdeps and mark them as special (i.e., whose duplicates are
2086145b7b3cSmrg      # not to be eliminated).
2087145b7b3cSmrg      pre_post_deps=
2088145b7b3cSmrg      if test "X$duplicate_compiler_generated_deps" = "Xyes" ; then
2089145b7b3cSmrg	for pre_post_dep in $predeps $postdeps; do
2090145b7b3cSmrg	  case "$pre_post_deps " in
2091145b7b3cSmrg	  *" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;;
2092145b7b3cSmrg	  esac
2093145b7b3cSmrg	  pre_post_deps="$pre_post_deps $pre_post_dep"
2094145b7b3cSmrg	done
2095145b7b3cSmrg      fi
2096145b7b3cSmrg      pre_post_deps=
2097145b7b3cSmrg    fi
2098145b7b3cSmrg
2099145b7b3cSmrg    deplibs=
2100145b7b3cSmrg    newdependency_libs=
2101145b7b3cSmrg    newlib_search_path=
2102145b7b3cSmrg    need_relink=no # whether we're linking any uninstalled libtool libraries
2103145b7b3cSmrg    notinst_deplibs= # not-installed libtool libraries
2104145b7b3cSmrg    case $linkmode in
2105145b7b3cSmrg    lib)
2106145b7b3cSmrg	passes="conv link"
2107145b7b3cSmrg	for file in $dlfiles $dlprefiles; do
2108145b7b3cSmrg	  case $file in
2109145b7b3cSmrg	  *.la) ;;
2110145b7b3cSmrg	  *)
2111145b7b3cSmrg	    $echo "$modename: libraries can \`-dlopen' only libtool libraries: $file" 1>&2
2112145b7b3cSmrg	    exit $EXIT_FAILURE
2113145b7b3cSmrg	    ;;
2114145b7b3cSmrg	  esac
2115145b7b3cSmrg	done
2116145b7b3cSmrg	;;
2117145b7b3cSmrg    prog)
2118145b7b3cSmrg	compile_deplibs=
2119145b7b3cSmrg	finalize_deplibs=
2120145b7b3cSmrg	alldeplibs=no
2121145b7b3cSmrg	newdlfiles=
2122145b7b3cSmrg	newdlprefiles=
2123145b7b3cSmrg	passes="conv scan dlopen dlpreopen link"
2124145b7b3cSmrg	;;
2125145b7b3cSmrg    *)  passes="conv"
2126145b7b3cSmrg	;;
2127145b7b3cSmrg    esac
2128145b7b3cSmrg    for pass in $passes; do
2129145b7b3cSmrg      if test "$linkmode,$pass" = "lib,link" ||
2130145b7b3cSmrg	 test "$linkmode,$pass" = "prog,scan"; then
2131145b7b3cSmrg	libs="$deplibs"
2132145b7b3cSmrg	deplibs=
2133145b7b3cSmrg      fi
2134145b7b3cSmrg      if test "$linkmode" = prog; then
2135145b7b3cSmrg	case $pass in
2136145b7b3cSmrg	dlopen) libs="$dlfiles" ;;
2137145b7b3cSmrg	dlpreopen) libs="$dlprefiles" ;;
2138145b7b3cSmrg	link) libs="$deplibs %DEPLIBS% $dependency_libs" ;;
2139145b7b3cSmrg	esac
2140145b7b3cSmrg      fi
2141145b7b3cSmrg      if test "$pass" = dlopen; then
2142145b7b3cSmrg	# Collect dlpreopened libraries
2143145b7b3cSmrg	save_deplibs="$deplibs"
2144145b7b3cSmrg	deplibs=
2145145b7b3cSmrg      fi
2146145b7b3cSmrg      for deplib in $libs; do
2147145b7b3cSmrg	lib=
2148145b7b3cSmrg	found=no
2149145b7b3cSmrg	case $deplib in
2150578741aaSmrg	-mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads)
2151145b7b3cSmrg	  if test "$linkmode,$pass" = "prog,link"; then
2152145b7b3cSmrg	    compile_deplibs="$deplib $compile_deplibs"
2153145b7b3cSmrg	    finalize_deplibs="$deplib $finalize_deplibs"
2154145b7b3cSmrg	  else
2155145b7b3cSmrg	    compiler_flags="$compiler_flags $deplib"
2156145b7b3cSmrg	  fi
2157145b7b3cSmrg	  continue
2158145b7b3cSmrg	  ;;
2159145b7b3cSmrg	-l*)
2160145b7b3cSmrg	  if test "$linkmode" != lib && test "$linkmode" != prog; then
2161145b7b3cSmrg	    $echo "$modename: warning: \`-l' is ignored for archives/objects" 1>&2
2162145b7b3cSmrg	    continue
2163145b7b3cSmrg	  fi
2164145b7b3cSmrg	  name=`$echo "X$deplib" | $Xsed -e 's/^-l//'`
2165578741aaSmrg	  if test "$linkmode" = lib; then
2166578741aaSmrg	    searchdirs="$newlib_search_path $lib_search_path $compiler_lib_search_dirs $sys_lib_search_path $shlib_search_path"
2167578741aaSmrg	  else
2168578741aaSmrg	    searchdirs="$newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path"
2169578741aaSmrg	  fi
2170578741aaSmrg	  for searchdir in $searchdirs; do
2171145b7b3cSmrg	    for search_ext in .la $std_shrext .so .a; do
2172145b7b3cSmrg	      # Search the libtool library
2173145b7b3cSmrg	      lib="$searchdir/lib${name}${search_ext}"
2174145b7b3cSmrg	      if test -f "$lib"; then
2175145b7b3cSmrg		if test "$search_ext" = ".la"; then
2176145b7b3cSmrg		  found=yes
2177145b7b3cSmrg		else
2178145b7b3cSmrg		  found=no
2179145b7b3cSmrg		fi
2180145b7b3cSmrg		break 2
2181145b7b3cSmrg	      fi
2182145b7b3cSmrg	    done
2183145b7b3cSmrg	  done
2184145b7b3cSmrg	  if test "$found" != yes; then
2185145b7b3cSmrg	    # deplib doesn't seem to be a libtool library
2186145b7b3cSmrg	    if test "$linkmode,$pass" = "prog,link"; then
2187145b7b3cSmrg	      compile_deplibs="$deplib $compile_deplibs"
2188145b7b3cSmrg	      finalize_deplibs="$deplib $finalize_deplibs"
2189145b7b3cSmrg	    else
2190145b7b3cSmrg	      deplibs="$deplib $deplibs"
2191145b7b3cSmrg	      test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
2192145b7b3cSmrg	    fi
2193145b7b3cSmrg	    continue
2194145b7b3cSmrg	  else # deplib is a libtool library
2195145b7b3cSmrg	    # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib,
2196145b7b3cSmrg	    # We need to do some special things here, and not later.
2197145b7b3cSmrg	    if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
2198145b7b3cSmrg	      case " $predeps $postdeps " in
2199145b7b3cSmrg	      *" $deplib "*)
2200145b7b3cSmrg		if (${SED} -e '2q' $lib |
2201145b7b3cSmrg                    grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
2202145b7b3cSmrg		  library_names=
2203145b7b3cSmrg		  old_library=
2204145b7b3cSmrg		  case $lib in
2205145b7b3cSmrg		  */* | *\\*) . $lib ;;
2206145b7b3cSmrg		  *) . ./$lib ;;
2207145b7b3cSmrg		  esac
2208145b7b3cSmrg		  for l in $old_library $library_names; do
2209145b7b3cSmrg		    ll="$l"
2210145b7b3cSmrg		  done
2211145b7b3cSmrg		  if test "X$ll" = "X$old_library" ; then # only static version available
2212145b7b3cSmrg		    found=no
2213145b7b3cSmrg		    ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'`
2214145b7b3cSmrg		    test "X$ladir" = "X$lib" && ladir="."
2215145b7b3cSmrg		    lib=$ladir/$old_library
2216145b7b3cSmrg		    if test "$linkmode,$pass" = "prog,link"; then
2217145b7b3cSmrg		      compile_deplibs="$deplib $compile_deplibs"
2218145b7b3cSmrg		      finalize_deplibs="$deplib $finalize_deplibs"
2219145b7b3cSmrg		    else
2220145b7b3cSmrg		      deplibs="$deplib $deplibs"
2221145b7b3cSmrg		      test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
2222145b7b3cSmrg		    fi
2223145b7b3cSmrg		    continue
2224145b7b3cSmrg		  fi
2225145b7b3cSmrg		fi
2226145b7b3cSmrg	        ;;
2227145b7b3cSmrg	      *) ;;
2228145b7b3cSmrg	      esac
2229145b7b3cSmrg	    fi
2230145b7b3cSmrg	  fi
2231145b7b3cSmrg	  ;; # -l
2232145b7b3cSmrg	-L*)
2233145b7b3cSmrg	  case $linkmode in
2234145b7b3cSmrg	  lib)
2235145b7b3cSmrg	    deplibs="$deplib $deplibs"
2236145b7b3cSmrg	    test "$pass" = conv && continue
2237145b7b3cSmrg	    newdependency_libs="$deplib $newdependency_libs"
2238145b7b3cSmrg	    newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
2239145b7b3cSmrg	    ;;
2240145b7b3cSmrg	  prog)
2241145b7b3cSmrg	    if test "$pass" = conv; then
2242145b7b3cSmrg	      deplibs="$deplib $deplibs"
2243145b7b3cSmrg	      continue
2244145b7b3cSmrg	    fi
2245145b7b3cSmrg	    if test "$pass" = scan; then
2246145b7b3cSmrg	      deplibs="$deplib $deplibs"
2247145b7b3cSmrg	    else
2248145b7b3cSmrg	      compile_deplibs="$deplib $compile_deplibs"
2249145b7b3cSmrg	      finalize_deplibs="$deplib $finalize_deplibs"
2250145b7b3cSmrg	    fi
2251145b7b3cSmrg	    newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
2252145b7b3cSmrg	    ;;
2253145b7b3cSmrg	  *)
2254145b7b3cSmrg	    $echo "$modename: warning: \`-L' is ignored for archives/objects" 1>&2
2255145b7b3cSmrg	    ;;
2256145b7b3cSmrg	  esac # linkmode
2257145b7b3cSmrg	  continue
2258145b7b3cSmrg	  ;; # -L
2259145b7b3cSmrg	-R*)
2260145b7b3cSmrg	  if test "$pass" = link; then
2261145b7b3cSmrg	    dir=`$echo "X$deplib" | $Xsed -e 's/^-R//'`
2262145b7b3cSmrg	    # Make sure the xrpath contains only unique directories.
2263145b7b3cSmrg	    case "$xrpath " in
2264145b7b3cSmrg	    *" $dir "*) ;;
2265145b7b3cSmrg	    *) xrpath="$xrpath $dir" ;;
2266145b7b3cSmrg	    esac
2267145b7b3cSmrg	  fi
2268145b7b3cSmrg	  deplibs="$deplib $deplibs"
2269145b7b3cSmrg	  continue
2270145b7b3cSmrg	  ;;
2271145b7b3cSmrg	*.la) lib="$deplib" ;;
2272145b7b3cSmrg	*.$libext)
2273145b7b3cSmrg	  if test "$pass" = conv; then
2274145b7b3cSmrg	    deplibs="$deplib $deplibs"
2275145b7b3cSmrg	    continue
2276145b7b3cSmrg	  fi
2277145b7b3cSmrg	  case $linkmode in
2278145b7b3cSmrg	  lib)
2279145b7b3cSmrg	    valid_a_lib=no
2280145b7b3cSmrg	    case $deplibs_check_method in
2281145b7b3cSmrg	      match_pattern*)
2282145b7b3cSmrg		set dummy $deplibs_check_method
2283145b7b3cSmrg	        match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
2284145b7b3cSmrg		if eval $echo \"$deplib\" 2>/dev/null \
2285145b7b3cSmrg		    | $SED 10q \
2286145b7b3cSmrg		    | $EGREP "$match_pattern_regex" > /dev/null; then
2287145b7b3cSmrg		  valid_a_lib=yes
2288145b7b3cSmrg		fi
2289145b7b3cSmrg		;;
2290145b7b3cSmrg	      pass_all)
2291145b7b3cSmrg		valid_a_lib=yes
2292145b7b3cSmrg		;;
2293145b7b3cSmrg            esac
2294145b7b3cSmrg	    if test "$valid_a_lib" != yes; then
2295145b7b3cSmrg	      $echo
2296145b7b3cSmrg	      $echo "*** Warning: Trying to link with static lib archive $deplib."
2297145b7b3cSmrg	      $echo "*** I have the capability to make that library automatically link in when"
2298145b7b3cSmrg	      $echo "*** you link to this library.  But I can only do this if you have a"
2299145b7b3cSmrg	      $echo "*** shared version of the library, which you do not appear to have"
2300145b7b3cSmrg	      $echo "*** because the file extensions .$libext of this argument makes me believe"
2301145b7b3cSmrg	      $echo "*** that it is just a static archive that I should not used here."
2302145b7b3cSmrg	    else
2303145b7b3cSmrg	      $echo
2304145b7b3cSmrg	      $echo "*** Warning: Linking the shared library $output against the"
2305145b7b3cSmrg	      $echo "*** static library $deplib is not portable!"
2306145b7b3cSmrg	      deplibs="$deplib $deplibs"
2307145b7b3cSmrg	    fi
2308145b7b3cSmrg	    continue
2309145b7b3cSmrg	    ;;
2310145b7b3cSmrg	  prog)
2311145b7b3cSmrg	    if test "$pass" != link; then
2312145b7b3cSmrg	      deplibs="$deplib $deplibs"
2313145b7b3cSmrg	    else
2314145b7b3cSmrg	      compile_deplibs="$deplib $compile_deplibs"
2315145b7b3cSmrg	      finalize_deplibs="$deplib $finalize_deplibs"
2316145b7b3cSmrg	    fi
2317145b7b3cSmrg	    continue
2318145b7b3cSmrg	    ;;
2319145b7b3cSmrg	  esac # linkmode
2320145b7b3cSmrg	  ;; # *.$libext
2321145b7b3cSmrg	*.lo | *.$objext)
2322145b7b3cSmrg	  if test "$pass" = conv; then
2323145b7b3cSmrg	    deplibs="$deplib $deplibs"
2324145b7b3cSmrg	  elif test "$linkmode" = prog; then
2325145b7b3cSmrg	    if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
2326145b7b3cSmrg	      # If there is no dlopen support or we're linking statically,
2327145b7b3cSmrg	      # we need to preload.
2328145b7b3cSmrg	      newdlprefiles="$newdlprefiles $deplib"
2329145b7b3cSmrg	      compile_deplibs="$deplib $compile_deplibs"
2330145b7b3cSmrg	      finalize_deplibs="$deplib $finalize_deplibs"
2331145b7b3cSmrg	    else
2332145b7b3cSmrg	      newdlfiles="$newdlfiles $deplib"
2333145b7b3cSmrg	    fi
2334145b7b3cSmrg	  fi
2335145b7b3cSmrg	  continue
2336145b7b3cSmrg	  ;;
2337145b7b3cSmrg	%DEPLIBS%)
2338145b7b3cSmrg	  alldeplibs=yes
2339145b7b3cSmrg	  continue
2340145b7b3cSmrg	  ;;
2341145b7b3cSmrg	esac # case $deplib
2342145b7b3cSmrg	if test "$found" = yes || test -f "$lib"; then :
2343145b7b3cSmrg	else
2344145b7b3cSmrg	  $echo "$modename: cannot find the library \`$lib' or unhandled argument \`$deplib'" 1>&2
2345145b7b3cSmrg	  exit $EXIT_FAILURE
2346145b7b3cSmrg	fi
2347145b7b3cSmrg
2348145b7b3cSmrg	# Check to see that this really is a libtool archive.
2349145b7b3cSmrg	if (${SED} -e '2q' $lib | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
2350145b7b3cSmrg	else
2351145b7b3cSmrg	  $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
2352145b7b3cSmrg	  exit $EXIT_FAILURE
2353145b7b3cSmrg	fi
2354145b7b3cSmrg
2355145b7b3cSmrg	ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'`
2356145b7b3cSmrg	test "X$ladir" = "X$lib" && ladir="."
2357145b7b3cSmrg
2358145b7b3cSmrg	dlname=
2359145b7b3cSmrg	dlopen=
2360145b7b3cSmrg	dlpreopen=
2361145b7b3cSmrg	libdir=
2362145b7b3cSmrg	library_names=
2363145b7b3cSmrg	old_library=
2364145b7b3cSmrg	# If the library was installed with an old release of libtool,
2365145b7b3cSmrg	# it will not redefine variables installed, or shouldnotlink
2366145b7b3cSmrg	installed=yes
2367145b7b3cSmrg	shouldnotlink=no
2368145b7b3cSmrg	avoidtemprpath=
2369145b7b3cSmrg
2370145b7b3cSmrg
2371145b7b3cSmrg	# Read the .la file
2372145b7b3cSmrg	case $lib in
2373145b7b3cSmrg	*/* | *\\*) . $lib ;;
2374145b7b3cSmrg	*) . ./$lib ;;
2375145b7b3cSmrg	esac
2376145b7b3cSmrg
2377145b7b3cSmrg	if test "$linkmode,$pass" = "lib,link" ||
2378145b7b3cSmrg	   test "$linkmode,$pass" = "prog,scan" ||
2379145b7b3cSmrg	   { test "$linkmode" != prog && test "$linkmode" != lib; }; then
2380145b7b3cSmrg	  test -n "$dlopen" && dlfiles="$dlfiles $dlopen"
2381145b7b3cSmrg	  test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen"
2382145b7b3cSmrg	fi
2383145b7b3cSmrg
2384145b7b3cSmrg	if test "$pass" = conv; then
2385145b7b3cSmrg	  # Only check for convenience libraries
2386145b7b3cSmrg	  deplibs="$lib $deplibs"
2387145b7b3cSmrg	  if test -z "$libdir"; then
2388145b7b3cSmrg	    if test -z "$old_library"; then
2389145b7b3cSmrg	      $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
2390145b7b3cSmrg	      exit $EXIT_FAILURE
2391145b7b3cSmrg	    fi
2392145b7b3cSmrg	    # It is a libtool convenience library, so add in its objects.
2393145b7b3cSmrg	    convenience="$convenience $ladir/$objdir/$old_library"
2394145b7b3cSmrg	    old_convenience="$old_convenience $ladir/$objdir/$old_library"
2395145b7b3cSmrg	    tmp_libs=
2396145b7b3cSmrg	    for deplib in $dependency_libs; do
2397145b7b3cSmrg	      deplibs="$deplib $deplibs"
2398145b7b3cSmrg              if test "X$duplicate_deps" = "Xyes" ; then
2399145b7b3cSmrg	        case "$tmp_libs " in
2400145b7b3cSmrg	        *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
2401145b7b3cSmrg	        esac
2402145b7b3cSmrg              fi
2403145b7b3cSmrg	      tmp_libs="$tmp_libs $deplib"
2404145b7b3cSmrg	    done
2405145b7b3cSmrg	  elif test "$linkmode" != prog && test "$linkmode" != lib; then
2406145b7b3cSmrg	    $echo "$modename: \`$lib' is not a convenience library" 1>&2
2407145b7b3cSmrg	    exit $EXIT_FAILURE
2408145b7b3cSmrg	  fi
2409145b7b3cSmrg	  continue
2410145b7b3cSmrg	fi # $pass = conv
2411145b7b3cSmrg
2412145b7b3cSmrg
2413145b7b3cSmrg	# Get the name of the library we link against.
2414145b7b3cSmrg	linklib=
2415145b7b3cSmrg	for l in $old_library $library_names; do
2416145b7b3cSmrg	  linklib="$l"
2417145b7b3cSmrg	done
2418145b7b3cSmrg	if test -z "$linklib"; then
2419145b7b3cSmrg	  $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
2420145b7b3cSmrg	  exit $EXIT_FAILURE
2421145b7b3cSmrg	fi
2422145b7b3cSmrg
2423145b7b3cSmrg	# This library was specified with -dlopen.
2424145b7b3cSmrg	if test "$pass" = dlopen; then
2425145b7b3cSmrg	  if test -z "$libdir"; then
2426145b7b3cSmrg	    $echo "$modename: cannot -dlopen a convenience library: \`$lib'" 1>&2
2427145b7b3cSmrg	    exit $EXIT_FAILURE
2428145b7b3cSmrg	  fi
2429145b7b3cSmrg	  if test -z "$dlname" ||
2430145b7b3cSmrg	     test "$dlopen_support" != yes ||
2431145b7b3cSmrg	     test "$build_libtool_libs" = no; then
2432145b7b3cSmrg	    # If there is no dlname, no dlopen support or we're linking
2433145b7b3cSmrg	    # statically, we need to preload.  We also need to preload any
2434145b7b3cSmrg	    # dependent libraries so libltdl's deplib preloader doesn't
2435145b7b3cSmrg	    # bomb out in the load deplibs phase.
2436145b7b3cSmrg	    dlprefiles="$dlprefiles $lib $dependency_libs"
2437145b7b3cSmrg	  else
2438145b7b3cSmrg	    newdlfiles="$newdlfiles $lib"
2439145b7b3cSmrg	  fi
2440145b7b3cSmrg	  continue
2441145b7b3cSmrg	fi # $pass = dlopen
2442145b7b3cSmrg
2443145b7b3cSmrg	# We need an absolute path.
2444145b7b3cSmrg	case $ladir in
2445145b7b3cSmrg	[\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;;
2446145b7b3cSmrg	*)
2447145b7b3cSmrg	  abs_ladir=`cd "$ladir" && pwd`
2448145b7b3cSmrg	  if test -z "$abs_ladir"; then
2449145b7b3cSmrg	    $echo "$modename: warning: cannot determine absolute directory name of \`$ladir'" 1>&2
2450145b7b3cSmrg	    $echo "$modename: passing it literally to the linker, although it might fail" 1>&2
2451145b7b3cSmrg	    abs_ladir="$ladir"
2452145b7b3cSmrg	  fi
2453145b7b3cSmrg	  ;;
2454145b7b3cSmrg	esac
2455145b7b3cSmrg	laname=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
2456145b7b3cSmrg
2457145b7b3cSmrg	# Find the relevant object directory and library name.
2458145b7b3cSmrg	if test "X$installed" = Xyes; then
2459145b7b3cSmrg	  if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then
2460145b7b3cSmrg	    $echo "$modename: warning: library \`$lib' was moved." 1>&2
2461145b7b3cSmrg	    dir="$ladir"
2462145b7b3cSmrg	    absdir="$abs_ladir"
2463145b7b3cSmrg	    libdir="$abs_ladir"
2464145b7b3cSmrg	  else
2465145b7b3cSmrg	    dir="$libdir"
2466145b7b3cSmrg	    absdir="$libdir"
2467145b7b3cSmrg	  fi
2468145b7b3cSmrg	  test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes
2469145b7b3cSmrg	else
2470145b7b3cSmrg	  if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then
2471145b7b3cSmrg	    dir="$ladir"
2472145b7b3cSmrg	    absdir="$abs_ladir"
2473145b7b3cSmrg	    # Remove this search path later
2474145b7b3cSmrg	    notinst_path="$notinst_path $abs_ladir"
2475145b7b3cSmrg	  else
2476145b7b3cSmrg	    dir="$ladir/$objdir"
2477145b7b3cSmrg	    absdir="$abs_ladir/$objdir"
2478145b7b3cSmrg	    # Remove this search path later
2479145b7b3cSmrg	    notinst_path="$notinst_path $abs_ladir"
2480145b7b3cSmrg	  fi
2481145b7b3cSmrg	fi # $installed = yes
2482145b7b3cSmrg	name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
2483145b7b3cSmrg
2484145b7b3cSmrg	# This library was specified with -dlpreopen.
2485145b7b3cSmrg	if test "$pass" = dlpreopen; then
2486145b7b3cSmrg	  if test -z "$libdir"; then
2487145b7b3cSmrg	    $echo "$modename: cannot -dlpreopen a convenience library: \`$lib'" 1>&2
2488145b7b3cSmrg	    exit $EXIT_FAILURE
2489145b7b3cSmrg	  fi
2490145b7b3cSmrg	  # Prefer using a static library (so that no silly _DYNAMIC symbols
2491145b7b3cSmrg	  # are required to link).
2492145b7b3cSmrg	  if test -n "$old_library"; then
2493145b7b3cSmrg	    newdlprefiles="$newdlprefiles $dir/$old_library"
2494145b7b3cSmrg	  # Otherwise, use the dlname, so that lt_dlopen finds it.
2495145b7b3cSmrg	  elif test -n "$dlname"; then
2496145b7b3cSmrg	    newdlprefiles="$newdlprefiles $dir/$dlname"
2497145b7b3cSmrg	  else
2498145b7b3cSmrg	    newdlprefiles="$newdlprefiles $dir/$linklib"
2499145b7b3cSmrg	  fi
2500145b7b3cSmrg	fi # $pass = dlpreopen
2501145b7b3cSmrg
2502145b7b3cSmrg	if test -z "$libdir"; then
2503145b7b3cSmrg	  # Link the convenience library
2504145b7b3cSmrg	  if test "$linkmode" = lib; then
2505145b7b3cSmrg	    deplibs="$dir/$old_library $deplibs"
2506145b7b3cSmrg	  elif test "$linkmode,$pass" = "prog,link"; then
2507145b7b3cSmrg	    compile_deplibs="$dir/$old_library $compile_deplibs"
2508145b7b3cSmrg	    finalize_deplibs="$dir/$old_library $finalize_deplibs"
2509145b7b3cSmrg	  else
2510145b7b3cSmrg	    deplibs="$lib $deplibs" # used for prog,scan pass
2511145b7b3cSmrg	  fi
2512145b7b3cSmrg	  continue
2513145b7b3cSmrg	fi
2514145b7b3cSmrg
2515145b7b3cSmrg
2516145b7b3cSmrg	if test "$linkmode" = prog && test "$pass" != link; then
2517145b7b3cSmrg	  newlib_search_path="$newlib_search_path $ladir"
2518145b7b3cSmrg	  deplibs="$lib $deplibs"
2519145b7b3cSmrg
2520145b7b3cSmrg	  linkalldeplibs=no
2521145b7b3cSmrg	  if test "$link_all_deplibs" != no || test -z "$library_names" ||
2522145b7b3cSmrg	     test "$build_libtool_libs" = no; then
2523145b7b3cSmrg	    linkalldeplibs=yes
2524145b7b3cSmrg	  fi
2525145b7b3cSmrg
2526145b7b3cSmrg	  tmp_libs=
2527145b7b3cSmrg	  for deplib in $dependency_libs; do
2528145b7b3cSmrg	    case $deplib in
2529145b7b3cSmrg	    -L*) newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`;; ### testsuite: skip nested quoting test
2530145b7b3cSmrg	    esac
2531145b7b3cSmrg	    # Need to link against all dependency_libs?
2532145b7b3cSmrg	    if test "$linkalldeplibs" = yes; then
2533145b7b3cSmrg	      deplibs="$deplib $deplibs"
2534145b7b3cSmrg	    else
2535145b7b3cSmrg	      # Need to hardcode shared library paths
2536145b7b3cSmrg	      # or/and link against static libraries
2537145b7b3cSmrg	      newdependency_libs="$deplib $newdependency_libs"
2538145b7b3cSmrg	    fi
2539145b7b3cSmrg	    if test "X$duplicate_deps" = "Xyes" ; then
2540145b7b3cSmrg	      case "$tmp_libs " in
2541145b7b3cSmrg	      *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
2542145b7b3cSmrg	      esac
2543145b7b3cSmrg	    fi
2544145b7b3cSmrg	    tmp_libs="$tmp_libs $deplib"
2545145b7b3cSmrg	  done # for deplib
2546145b7b3cSmrg	  continue
2547145b7b3cSmrg	fi # $linkmode = prog...
2548145b7b3cSmrg
2549145b7b3cSmrg	if test "$linkmode,$pass" = "prog,link"; then
2550145b7b3cSmrg	  if test -n "$library_names" &&
2551578741aaSmrg	     { { test "$prefer_static_libs" = no ||
2552578741aaSmrg		 test "$prefer_static_libs,$installed" = "built,yes"; } ||
2553578741aaSmrg	       test -z "$old_library"; }; then
2554145b7b3cSmrg	    # We need to hardcode the library path
2555145b7b3cSmrg	    if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then
2556145b7b3cSmrg	      # Make sure the rpath contains only unique directories.
2557145b7b3cSmrg	      case "$temp_rpath " in
2558145b7b3cSmrg	      *" $dir "*) ;;
2559145b7b3cSmrg	      *" $absdir "*) ;;
2560145b7b3cSmrg	      *) temp_rpath="$temp_rpath $absdir" ;;
2561145b7b3cSmrg	      esac
2562145b7b3cSmrg	    fi
2563145b7b3cSmrg
2564145b7b3cSmrg	    # Hardcode the library path.
2565145b7b3cSmrg	    # Skip directories that are in the system default run-time
2566145b7b3cSmrg	    # search path.
2567145b7b3cSmrg	    case " $sys_lib_dlsearch_path " in
2568145b7b3cSmrg	    *" $absdir "*) ;;
2569145b7b3cSmrg	    *)
2570145b7b3cSmrg	      case "$compile_rpath " in
2571145b7b3cSmrg	      *" $absdir "*) ;;
2572145b7b3cSmrg	      *) compile_rpath="$compile_rpath $absdir"
2573145b7b3cSmrg	      esac
2574145b7b3cSmrg	      ;;
2575145b7b3cSmrg	    esac
2576145b7b3cSmrg	    case " $sys_lib_dlsearch_path " in
2577145b7b3cSmrg	    *" $libdir "*) ;;
2578145b7b3cSmrg	    *)
2579145b7b3cSmrg	      case "$finalize_rpath " in
2580145b7b3cSmrg	      *" $libdir "*) ;;
2581145b7b3cSmrg	      *) finalize_rpath="$finalize_rpath $libdir"
2582145b7b3cSmrg	      esac
2583145b7b3cSmrg	      ;;
2584145b7b3cSmrg	    esac
2585145b7b3cSmrg	  fi # $linkmode,$pass = prog,link...
2586145b7b3cSmrg
2587145b7b3cSmrg	  if test "$alldeplibs" = yes &&
2588145b7b3cSmrg	     { test "$deplibs_check_method" = pass_all ||
2589145b7b3cSmrg	       { test "$build_libtool_libs" = yes &&
2590145b7b3cSmrg		 test -n "$library_names"; }; }; then
2591145b7b3cSmrg	    # We only need to search for static libraries
2592145b7b3cSmrg	    continue
2593145b7b3cSmrg	  fi
2594145b7b3cSmrg	fi
2595145b7b3cSmrg
2596145b7b3cSmrg	link_static=no # Whether the deplib will be linked statically
2597145b7b3cSmrg	use_static_libs=$prefer_static_libs
2598145b7b3cSmrg	if test "$use_static_libs" = built && test "$installed" = yes ; then
2599145b7b3cSmrg	  use_static_libs=no
2600145b7b3cSmrg	fi
2601145b7b3cSmrg	if test -n "$library_names" &&
2602145b7b3cSmrg	   { test "$use_static_libs" = no || test -z "$old_library"; }; then
2603145b7b3cSmrg	  if test "$installed" = no; then
2604145b7b3cSmrg	    notinst_deplibs="$notinst_deplibs $lib"
2605145b7b3cSmrg	    need_relink=yes
2606145b7b3cSmrg	  fi
2607145b7b3cSmrg	  # This is a shared library
2608145b7b3cSmrg
2609145b7b3cSmrg	  # Warn about portability, can't link against -module's on
2610145b7b3cSmrg	  # some systems (darwin)
2611145b7b3cSmrg	  if test "$shouldnotlink" = yes && test "$pass" = link ; then
2612145b7b3cSmrg	    $echo
2613145b7b3cSmrg	    if test "$linkmode" = prog; then
2614145b7b3cSmrg	      $echo "*** Warning: Linking the executable $output against the loadable module"
2615145b7b3cSmrg	    else
2616145b7b3cSmrg	      $echo "*** Warning: Linking the shared library $output against the loadable module"
2617145b7b3cSmrg	    fi
2618145b7b3cSmrg	    $echo "*** $linklib is not portable!"
2619145b7b3cSmrg	  fi
2620145b7b3cSmrg	  if test "$linkmode" = lib &&
2621145b7b3cSmrg	     test "$hardcode_into_libs" = yes; then
2622145b7b3cSmrg	    # Hardcode the library path.
2623145b7b3cSmrg	    # Skip directories that are in the system default run-time
2624145b7b3cSmrg	    # search path.
2625145b7b3cSmrg	    case " $sys_lib_dlsearch_path " in
2626145b7b3cSmrg	    *" $absdir "*) ;;
2627145b7b3cSmrg	    *)
2628145b7b3cSmrg	      case "$compile_rpath " in
2629145b7b3cSmrg	      *" $absdir "*) ;;
2630145b7b3cSmrg	      *) compile_rpath="$compile_rpath $absdir"
2631145b7b3cSmrg	      esac
2632145b7b3cSmrg	      ;;
2633145b7b3cSmrg	    esac
2634145b7b3cSmrg	    case " $sys_lib_dlsearch_path " in
2635145b7b3cSmrg	    *" $libdir "*) ;;
2636145b7b3cSmrg	    *)
2637145b7b3cSmrg	      case "$finalize_rpath " in
2638145b7b3cSmrg	      *" $libdir "*) ;;
2639145b7b3cSmrg	      *) finalize_rpath="$finalize_rpath $libdir"
2640145b7b3cSmrg	      esac
2641145b7b3cSmrg	      ;;
2642145b7b3cSmrg	    esac
2643145b7b3cSmrg	  fi
2644145b7b3cSmrg
2645145b7b3cSmrg	  if test -n "$old_archive_from_expsyms_cmds"; then
2646145b7b3cSmrg	    # figure out the soname
2647145b7b3cSmrg	    set dummy $library_names
2648145b7b3cSmrg	    realname="$2"
2649145b7b3cSmrg	    shift; shift
2650145b7b3cSmrg	    libname=`eval \\$echo \"$libname_spec\"`
2651145b7b3cSmrg	    # use dlname if we got it. it's perfectly good, no?
2652145b7b3cSmrg	    if test -n "$dlname"; then
2653145b7b3cSmrg	      soname="$dlname"
2654145b7b3cSmrg	    elif test -n "$soname_spec"; then
2655145b7b3cSmrg	      # bleh windows
2656145b7b3cSmrg	      case $host in
2657145b7b3cSmrg	      *cygwin* | mingw*)
2658145b7b3cSmrg		major=`expr $current - $age`
2659145b7b3cSmrg		versuffix="-$major"
2660145b7b3cSmrg		;;
2661145b7b3cSmrg	      esac
2662145b7b3cSmrg	      eval soname=\"$soname_spec\"
2663145b7b3cSmrg	    else
2664145b7b3cSmrg	      soname="$realname"
2665145b7b3cSmrg	    fi
2666145b7b3cSmrg
2667145b7b3cSmrg	    # Make a new name for the extract_expsyms_cmds to use
2668145b7b3cSmrg	    soroot="$soname"
2669145b7b3cSmrg	    soname=`$echo $soroot | ${SED} -e 's/^.*\///'`
2670145b7b3cSmrg	    newlib="libimp-`$echo $soname | ${SED} 's/^lib//;s/\.dll$//'`.a"
2671145b7b3cSmrg
2672145b7b3cSmrg	    # If the library has no export list, then create one now
2673145b7b3cSmrg	    if test -f "$output_objdir/$soname-def"; then :
2674145b7b3cSmrg	    else
2675145b7b3cSmrg	      $show "extracting exported symbol list from \`$soname'"
2676145b7b3cSmrg	      save_ifs="$IFS"; IFS='~'
2677145b7b3cSmrg	      cmds=$extract_expsyms_cmds
2678145b7b3cSmrg	      for cmd in $cmds; do
2679145b7b3cSmrg		IFS="$save_ifs"
2680145b7b3cSmrg		eval cmd=\"$cmd\"
2681145b7b3cSmrg		$show "$cmd"
2682145b7b3cSmrg		$run eval "$cmd" || exit $?
2683145b7b3cSmrg	      done
2684145b7b3cSmrg	      IFS="$save_ifs"
2685145b7b3cSmrg	    fi
2686145b7b3cSmrg
2687145b7b3cSmrg	    # Create $newlib
2688145b7b3cSmrg	    if test -f "$output_objdir/$newlib"; then :; else
2689145b7b3cSmrg	      $show "generating import library for \`$soname'"
2690145b7b3cSmrg	      save_ifs="$IFS"; IFS='~'
2691145b7b3cSmrg	      cmds=$old_archive_from_expsyms_cmds
2692145b7b3cSmrg	      for cmd in $cmds; do
2693145b7b3cSmrg		IFS="$save_ifs"
2694145b7b3cSmrg		eval cmd=\"$cmd\"
2695145b7b3cSmrg		$show "$cmd"
2696145b7b3cSmrg		$run eval "$cmd" || exit $?
2697145b7b3cSmrg	      done
2698145b7b3cSmrg	      IFS="$save_ifs"
2699145b7b3cSmrg	    fi
2700145b7b3cSmrg	    # make sure the library variables are pointing to the new library
2701145b7b3cSmrg	    dir=$output_objdir
2702145b7b3cSmrg	    linklib=$newlib
2703145b7b3cSmrg	  fi # test -n "$old_archive_from_expsyms_cmds"
2704145b7b3cSmrg
2705145b7b3cSmrg	  if test "$linkmode" = prog || test "$mode" != relink; then
2706145b7b3cSmrg	    add_shlibpath=
2707145b7b3cSmrg	    add_dir=
2708145b7b3cSmrg	    add=
2709145b7b3cSmrg	    lib_linked=yes
2710145b7b3cSmrg	    case $hardcode_action in
2711145b7b3cSmrg	    immediate | unsupported)
2712145b7b3cSmrg	      if test "$hardcode_direct" = no; then
2713145b7b3cSmrg		add="$dir/$linklib"
2714145b7b3cSmrg		case $host in
2715145b7b3cSmrg		  *-*-sco3.2v5.0.[024]*) add_dir="-L$dir" ;;
2716145b7b3cSmrg		  *-*-sysv4*uw2*) add_dir="-L$dir" ;;
2717145b7b3cSmrg		  *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \
2718145b7b3cSmrg		    *-*-unixware7*) add_dir="-L$dir" ;;
2719145b7b3cSmrg		  *-*-darwin* )
2720145b7b3cSmrg		    # if the lib is a module then we can not link against
2721145b7b3cSmrg		    # it, someone is ignoring the new warnings I added
2722145b7b3cSmrg		    if /usr/bin/file -L $add 2> /dev/null |
2723145b7b3cSmrg                      $EGREP ": [^:]* bundle" >/dev/null ; then
2724145b7b3cSmrg		      $echo "** Warning, lib $linklib is a module, not a shared library"
2725145b7b3cSmrg		      if test -z "$old_library" ; then
2726145b7b3cSmrg		        $echo
2727145b7b3cSmrg		        $echo "** And there doesn't seem to be a static archive available"
2728145b7b3cSmrg		        $echo "** The link will probably fail, sorry"
2729145b7b3cSmrg		      else
2730145b7b3cSmrg		        add="$dir/$old_library"
2731145b7b3cSmrg		      fi
2732145b7b3cSmrg		    fi
2733145b7b3cSmrg		esac
2734145b7b3cSmrg	      elif test "$hardcode_minus_L" = no; then
2735145b7b3cSmrg		case $host in
2736145b7b3cSmrg		*-*-sunos*) add_shlibpath="$dir" ;;
2737145b7b3cSmrg		esac
2738145b7b3cSmrg		add_dir="-L$dir"
2739145b7b3cSmrg		add="-l$name"
2740145b7b3cSmrg	      elif test "$hardcode_shlibpath_var" = no; then
2741145b7b3cSmrg		add_shlibpath="$dir"
2742145b7b3cSmrg		add="-l$name"
2743145b7b3cSmrg	      else
2744145b7b3cSmrg		lib_linked=no
2745145b7b3cSmrg	      fi
2746145b7b3cSmrg	      ;;
2747145b7b3cSmrg	    relink)
2748145b7b3cSmrg	      if test "$hardcode_direct" = yes; then
2749145b7b3cSmrg		add="$dir/$linklib"
2750145b7b3cSmrg	      elif test "$hardcode_minus_L" = yes; then
2751145b7b3cSmrg		add_dir="-L$dir"
2752145b7b3cSmrg		# Try looking first in the location we're being installed to.
2753145b7b3cSmrg		if test -n "$inst_prefix_dir"; then
2754145b7b3cSmrg		  case $libdir in
2755145b7b3cSmrg		    [\\/]*)
2756145b7b3cSmrg		      add_dir="$add_dir -L$inst_prefix_dir$libdir"
2757145b7b3cSmrg		      ;;
2758145b7b3cSmrg		  esac
2759145b7b3cSmrg		fi
2760145b7b3cSmrg		add="-l$name"
2761145b7b3cSmrg	      elif test "$hardcode_shlibpath_var" = yes; then
2762145b7b3cSmrg		add_shlibpath="$dir"
2763145b7b3cSmrg		add="-l$name"
2764145b7b3cSmrg	      else
2765145b7b3cSmrg		lib_linked=no
2766145b7b3cSmrg	      fi
2767145b7b3cSmrg	      ;;
2768145b7b3cSmrg	    *) lib_linked=no ;;
2769145b7b3cSmrg	    esac
2770145b7b3cSmrg
2771145b7b3cSmrg	    if test "$lib_linked" != yes; then
2772145b7b3cSmrg	      $echo "$modename: configuration error: unsupported hardcode properties"
2773145b7b3cSmrg	      exit $EXIT_FAILURE
2774145b7b3cSmrg	    fi
2775145b7b3cSmrg
2776145b7b3cSmrg	    if test -n "$add_shlibpath"; then
2777145b7b3cSmrg	      case :$compile_shlibpath: in
2778145b7b3cSmrg	      *":$add_shlibpath:"*) ;;
2779145b7b3cSmrg	      *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;;
2780145b7b3cSmrg	      esac
2781145b7b3cSmrg	    fi
2782145b7b3cSmrg	    if test "$linkmode" = prog; then
2783145b7b3cSmrg	      test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs"
2784145b7b3cSmrg	      test -n "$add" && compile_deplibs="$add $compile_deplibs"
2785145b7b3cSmrg	    else
2786145b7b3cSmrg	      test -n "$add_dir" && deplibs="$add_dir $deplibs"
2787145b7b3cSmrg	      test -n "$add" && deplibs="$add $deplibs"
2788145b7b3cSmrg	      if test "$hardcode_direct" != yes && \
2789145b7b3cSmrg		 test "$hardcode_minus_L" != yes && \
2790145b7b3cSmrg		 test "$hardcode_shlibpath_var" = yes; then
2791145b7b3cSmrg		case :$finalize_shlibpath: in
2792145b7b3cSmrg		*":$libdir:"*) ;;
2793145b7b3cSmrg		*) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
2794145b7b3cSmrg		esac
2795145b7b3cSmrg	      fi
2796145b7b3cSmrg	    fi
2797145b7b3cSmrg	  fi
2798145b7b3cSmrg
2799145b7b3cSmrg	  if test "$linkmode" = prog || test "$mode" = relink; then
2800145b7b3cSmrg	    add_shlibpath=
2801145b7b3cSmrg	    add_dir=
2802145b7b3cSmrg	    add=
2803145b7b3cSmrg	    # Finalize command for both is simple: just hardcode it.
2804145b7b3cSmrg	    if test "$hardcode_direct" = yes; then
2805145b7b3cSmrg	      add="$libdir/$linklib"
2806145b7b3cSmrg	    elif test "$hardcode_minus_L" = yes; then
2807145b7b3cSmrg	      add_dir="-L$libdir"
2808145b7b3cSmrg	      add="-l$name"
2809145b7b3cSmrg	    elif test "$hardcode_shlibpath_var" = yes; then
2810145b7b3cSmrg	      case :$finalize_shlibpath: in
2811145b7b3cSmrg	      *":$libdir:"*) ;;
2812145b7b3cSmrg	      *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
2813145b7b3cSmrg	      esac
2814145b7b3cSmrg	      add="-l$name"
2815145b7b3cSmrg	    elif test "$hardcode_automatic" = yes; then
2816145b7b3cSmrg	      if test -n "$inst_prefix_dir" &&
2817145b7b3cSmrg		 test -f "$inst_prefix_dir$libdir/$linklib" ; then
2818145b7b3cSmrg	        add="$inst_prefix_dir$libdir/$linklib"
2819145b7b3cSmrg	      else
2820145b7b3cSmrg	        add="$libdir/$linklib"
2821145b7b3cSmrg	      fi
2822145b7b3cSmrg	    else
2823145b7b3cSmrg	      # We cannot seem to hardcode it, guess we'll fake it.
2824145b7b3cSmrg	      add_dir="-L$libdir"
2825145b7b3cSmrg	      # Try looking first in the location we're being installed to.
2826145b7b3cSmrg	      if test -n "$inst_prefix_dir"; then
2827145b7b3cSmrg		case $libdir in
2828145b7b3cSmrg		  [\\/]*)
2829145b7b3cSmrg		    add_dir="$add_dir -L$inst_prefix_dir$libdir"
2830145b7b3cSmrg		    ;;
2831145b7b3cSmrg		esac
2832145b7b3cSmrg	      fi
2833145b7b3cSmrg	      add="-l$name"
2834145b7b3cSmrg	    fi
2835145b7b3cSmrg
2836145b7b3cSmrg	    if test "$linkmode" = prog; then
2837145b7b3cSmrg	      test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs"
2838145b7b3cSmrg	      test -n "$add" && finalize_deplibs="$add $finalize_deplibs"
2839145b7b3cSmrg	    else
2840145b7b3cSmrg	      test -n "$add_dir" && deplibs="$add_dir $deplibs"
2841145b7b3cSmrg	      test -n "$add" && deplibs="$add $deplibs"
2842145b7b3cSmrg	    fi
2843145b7b3cSmrg	  fi
2844145b7b3cSmrg	elif test "$linkmode" = prog; then
2845145b7b3cSmrg	  # Here we assume that one of hardcode_direct or hardcode_minus_L
2846145b7b3cSmrg	  # is not unsupported.  This is valid on all known static and
2847145b7b3cSmrg	  # shared platforms.
2848145b7b3cSmrg	  if test "$hardcode_direct" != unsupported; then
2849145b7b3cSmrg	    test -n "$old_library" && linklib="$old_library"
2850145b7b3cSmrg	    compile_deplibs="$dir/$linklib $compile_deplibs"
2851145b7b3cSmrg	    finalize_deplibs="$dir/$linklib $finalize_deplibs"
2852145b7b3cSmrg	  else
2853145b7b3cSmrg	    compile_deplibs="-l$name -L$dir $compile_deplibs"
2854145b7b3cSmrg	    finalize_deplibs="-l$name -L$dir $finalize_deplibs"
2855145b7b3cSmrg	  fi
2856145b7b3cSmrg	elif test "$build_libtool_libs" = yes; then
2857145b7b3cSmrg	  # Not a shared library
2858145b7b3cSmrg	  if test "$deplibs_check_method" != pass_all; then
2859145b7b3cSmrg	    # We're trying link a shared library against a static one
2860145b7b3cSmrg	    # but the system doesn't support it.
2861145b7b3cSmrg
2862145b7b3cSmrg	    # Just print a warning and add the library to dependency_libs so
2863145b7b3cSmrg	    # that the program can be linked against the static library.
2864145b7b3cSmrg	    $echo
2865145b7b3cSmrg	    $echo "*** Warning: This system can not link to static lib archive $lib."
2866145b7b3cSmrg	    $echo "*** I have the capability to make that library automatically link in when"
2867145b7b3cSmrg	    $echo "*** you link to this library.  But I can only do this if you have a"
2868145b7b3cSmrg	    $echo "*** shared version of the library, which you do not appear to have."
2869145b7b3cSmrg	    if test "$module" = yes; then
2870145b7b3cSmrg	      $echo "*** But as you try to build a module library, libtool will still create "
2871145b7b3cSmrg	      $echo "*** a static module, that should work as long as the dlopening application"
2872145b7b3cSmrg	      $echo "*** is linked with the -dlopen flag to resolve symbols at runtime."
2873145b7b3cSmrg	      if test -z "$global_symbol_pipe"; then
2874145b7b3cSmrg		$echo
2875145b7b3cSmrg		$echo "*** However, this would only work if libtool was able to extract symbol"
2876145b7b3cSmrg		$echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
2877145b7b3cSmrg		$echo "*** not find such a program.  So, this module is probably useless."
2878145b7b3cSmrg		$echo "*** \`nm' from GNU binutils and a full rebuild may help."
2879145b7b3cSmrg	      fi
2880145b7b3cSmrg	      if test "$build_old_libs" = no; then
2881145b7b3cSmrg		build_libtool_libs=module
2882145b7b3cSmrg		build_old_libs=yes
2883145b7b3cSmrg	      else
2884145b7b3cSmrg		build_libtool_libs=no
2885145b7b3cSmrg	      fi
2886145b7b3cSmrg	    fi
2887145b7b3cSmrg	  else
2888145b7b3cSmrg	    deplibs="$dir/$old_library $deplibs"
2889145b7b3cSmrg	    link_static=yes
2890145b7b3cSmrg	  fi
2891145b7b3cSmrg	fi # link shared/static library?
2892145b7b3cSmrg
2893145b7b3cSmrg	if test "$linkmode" = lib; then
2894145b7b3cSmrg	  if test -n "$dependency_libs" &&
2895145b7b3cSmrg	     { test "$hardcode_into_libs" != yes ||
2896145b7b3cSmrg	       test "$build_old_libs" = yes ||
2897145b7b3cSmrg	       test "$link_static" = yes; }; then
2898145b7b3cSmrg	    # Extract -R from dependency_libs
2899145b7b3cSmrg	    temp_deplibs=
2900145b7b3cSmrg	    for libdir in $dependency_libs; do
2901145b7b3cSmrg	      case $libdir in
2902145b7b3cSmrg	      -R*) temp_xrpath=`$echo "X$libdir" | $Xsed -e 's/^-R//'`
2903145b7b3cSmrg		   case " $xrpath " in
2904145b7b3cSmrg		   *" $temp_xrpath "*) ;;
2905145b7b3cSmrg		   *) xrpath="$xrpath $temp_xrpath";;
2906145b7b3cSmrg		   esac;;
2907145b7b3cSmrg	      *) temp_deplibs="$temp_deplibs $libdir";;
2908145b7b3cSmrg	      esac
2909145b7b3cSmrg	    done
2910145b7b3cSmrg	    dependency_libs="$temp_deplibs"
2911145b7b3cSmrg	  fi
2912145b7b3cSmrg
2913145b7b3cSmrg	  newlib_search_path="$newlib_search_path $absdir"
2914145b7b3cSmrg	  # Link against this library
2915145b7b3cSmrg	  test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs"
2916145b7b3cSmrg	  # ... and its dependency_libs
2917145b7b3cSmrg	  tmp_libs=
2918145b7b3cSmrg	  for deplib in $dependency_libs; do
2919145b7b3cSmrg	    newdependency_libs="$deplib $newdependency_libs"
2920145b7b3cSmrg	    if test "X$duplicate_deps" = "Xyes" ; then
2921145b7b3cSmrg	      case "$tmp_libs " in
2922145b7b3cSmrg	      *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
2923145b7b3cSmrg	      esac
2924145b7b3cSmrg	    fi
2925145b7b3cSmrg	    tmp_libs="$tmp_libs $deplib"
2926145b7b3cSmrg	  done
2927145b7b3cSmrg
2928145b7b3cSmrg	  if test "$link_all_deplibs" != no; then
2929145b7b3cSmrg	    # Add the search paths of all dependency libraries
2930145b7b3cSmrg	    for deplib in $dependency_libs; do
2931145b7b3cSmrg	      case $deplib in
2932145b7b3cSmrg	      -L*) path="$deplib" ;;
2933145b7b3cSmrg	      *.la)
2934145b7b3cSmrg		dir=`$echo "X$deplib" | $Xsed -e 's%/[^/]*$%%'`
2935145b7b3cSmrg		test "X$dir" = "X$deplib" && dir="."
2936145b7b3cSmrg		# We need an absolute path.
2937145b7b3cSmrg		case $dir in
2938145b7b3cSmrg		[\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;;
2939145b7b3cSmrg		*)
2940145b7b3cSmrg		  absdir=`cd "$dir" && pwd`
2941145b7b3cSmrg		  if test -z "$absdir"; then
2942145b7b3cSmrg		    $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2
2943145b7b3cSmrg		    absdir="$dir"
2944145b7b3cSmrg		  fi
2945145b7b3cSmrg		  ;;
2946145b7b3cSmrg		esac
2947145b7b3cSmrg		if grep "^installed=no" $deplib > /dev/null; then
2948145b7b3cSmrg		  path="$absdir/$objdir"
2949145b7b3cSmrg		else
2950145b7b3cSmrg		  eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
2951145b7b3cSmrg		  if test -z "$libdir"; then
2952145b7b3cSmrg		    $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
2953145b7b3cSmrg		    exit $EXIT_FAILURE
2954145b7b3cSmrg		  fi
2955145b7b3cSmrg		  if test "$absdir" != "$libdir"; then
2956145b7b3cSmrg		    $echo "$modename: warning: \`$deplib' seems to be moved" 1>&2
2957145b7b3cSmrg		  fi
2958145b7b3cSmrg		  path="$absdir"
2959145b7b3cSmrg		fi
2960145b7b3cSmrg		depdepl=
2961145b7b3cSmrg		case $host in
2962145b7b3cSmrg		*-*-darwin*)
2963145b7b3cSmrg		  # we do not want to link against static libs,
2964145b7b3cSmrg		  # but need to link against shared
2965145b7b3cSmrg		  eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib`
2966578741aaSmrg		  eval deplibdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
2967145b7b3cSmrg		  if test -n "$deplibrary_names" ; then
2968145b7b3cSmrg		    for tmp in $deplibrary_names ; do
2969145b7b3cSmrg		      depdepl=$tmp
2970145b7b3cSmrg		    done
2971578741aaSmrg		    if test -f "$deplibdir/$depdepl" ; then
2972578741aaSmrg		      depdepl="$deplibdir/$depdepl"
2973578741aaSmrg	      	    elif test -f "$path/$depdepl" ; then
2974145b7b3cSmrg		      depdepl="$path/$depdepl"
2975578741aaSmrg		    else
2976578741aaSmrg		      # Can't find it, oh well...
2977578741aaSmrg		      depdepl=
2978145b7b3cSmrg		    fi
2979145b7b3cSmrg		    # do not add paths which are already there
2980145b7b3cSmrg		    case " $newlib_search_path " in
2981145b7b3cSmrg		    *" $path "*) ;;
2982145b7b3cSmrg		    *) newlib_search_path="$newlib_search_path $path";;
2983145b7b3cSmrg		    esac
2984145b7b3cSmrg		  fi
2985145b7b3cSmrg		  path=""
2986145b7b3cSmrg		  ;;
2987145b7b3cSmrg		*)
2988145b7b3cSmrg		  path="-L$path"
2989145b7b3cSmrg		  ;;
2990145b7b3cSmrg		esac
2991145b7b3cSmrg		;;
2992145b7b3cSmrg	      -l*)
2993145b7b3cSmrg		case $host in
2994145b7b3cSmrg		*-*-darwin*)
2995145b7b3cSmrg		  # Again, we only want to link against shared libraries
2996145b7b3cSmrg		  eval tmp_libs=`$echo "X$deplib" | $Xsed -e "s,^\-l,,"`
2997145b7b3cSmrg		  for tmp in $newlib_search_path ; do
2998145b7b3cSmrg		    if test -f "$tmp/lib$tmp_libs.dylib" ; then
2999145b7b3cSmrg		      eval depdepl="$tmp/lib$tmp_libs.dylib"
3000145b7b3cSmrg		      break
3001145b7b3cSmrg		    fi
3002145b7b3cSmrg		  done
3003145b7b3cSmrg		  path=""
3004145b7b3cSmrg		  ;;
3005145b7b3cSmrg		*) continue ;;
3006145b7b3cSmrg		esac
3007145b7b3cSmrg		;;
3008145b7b3cSmrg	      *) continue ;;
3009145b7b3cSmrg	      esac
3010145b7b3cSmrg	      case " $deplibs " in
3011145b7b3cSmrg	      *" $path "*) ;;
3012145b7b3cSmrg	      *) deplibs="$path $deplibs" ;;
3013145b7b3cSmrg	      esac
3014145b7b3cSmrg	      case " $deplibs " in
3015145b7b3cSmrg	      *" $depdepl "*) ;;
3016145b7b3cSmrg	      *) deplibs="$depdepl $deplibs" ;;
3017145b7b3cSmrg	      esac
3018145b7b3cSmrg	    done
3019145b7b3cSmrg	  fi # link_all_deplibs != no
3020145b7b3cSmrg	fi # linkmode = lib
3021145b7b3cSmrg      done # for deplib in $libs
3022145b7b3cSmrg      dependency_libs="$newdependency_libs"
3023145b7b3cSmrg      if test "$pass" = dlpreopen; then
3024145b7b3cSmrg	# Link the dlpreopened libraries before other libraries
3025145b7b3cSmrg	for deplib in $save_deplibs; do
3026145b7b3cSmrg	  deplibs="$deplib $deplibs"
3027145b7b3cSmrg	done
3028145b7b3cSmrg      fi
3029145b7b3cSmrg      if test "$pass" != dlopen; then
3030145b7b3cSmrg	if test "$pass" != conv; then
3031145b7b3cSmrg	  # Make sure lib_search_path contains only unique directories.
3032145b7b3cSmrg	  lib_search_path=
3033145b7b3cSmrg	  for dir in $newlib_search_path; do
3034145b7b3cSmrg	    case "$lib_search_path " in
3035145b7b3cSmrg	    *" $dir "*) ;;
3036145b7b3cSmrg	    *) lib_search_path="$lib_search_path $dir" ;;
3037145b7b3cSmrg	    esac
3038145b7b3cSmrg	  done
3039145b7b3cSmrg	  newlib_search_path=
3040145b7b3cSmrg	fi
3041145b7b3cSmrg
3042145b7b3cSmrg	if test "$linkmode,$pass" != "prog,link"; then
3043145b7b3cSmrg	  vars="deplibs"
3044145b7b3cSmrg	else
3045145b7b3cSmrg	  vars="compile_deplibs finalize_deplibs"
3046145b7b3cSmrg	fi
3047145b7b3cSmrg	for var in $vars dependency_libs; do
3048145b7b3cSmrg	  # Add libraries to $var in reverse order
3049145b7b3cSmrg	  eval tmp_libs=\"\$$var\"
3050145b7b3cSmrg	  new_libs=
3051145b7b3cSmrg	  for deplib in $tmp_libs; do
3052145b7b3cSmrg	    # FIXME: Pedantically, this is the right thing to do, so
3053145b7b3cSmrg	    #        that some nasty dependency loop isn't accidentally
3054145b7b3cSmrg	    #        broken:
3055145b7b3cSmrg	    #new_libs="$deplib $new_libs"
3056145b7b3cSmrg	    # Pragmatically, this seems to cause very few problems in
3057145b7b3cSmrg	    # practice:
3058145b7b3cSmrg	    case $deplib in
3059145b7b3cSmrg	    -L*) new_libs="$deplib $new_libs" ;;
3060145b7b3cSmrg	    -R*) ;;
3061145b7b3cSmrg	    *)
3062145b7b3cSmrg	      # And here is the reason: when a library appears more
3063145b7b3cSmrg	      # than once as an explicit dependence of a library, or
3064145b7b3cSmrg	      # is implicitly linked in more than once by the
3065145b7b3cSmrg	      # compiler, it is considered special, and multiple
3066145b7b3cSmrg	      # occurrences thereof are not removed.  Compare this
3067145b7b3cSmrg	      # with having the same library being listed as a
3068145b7b3cSmrg	      # dependency of multiple other libraries: in this case,
3069145b7b3cSmrg	      # we know (pedantically, we assume) the library does not
3070145b7b3cSmrg	      # need to be listed more than once, so we keep only the
3071145b7b3cSmrg	      # last copy.  This is not always right, but it is rare
3072145b7b3cSmrg	      # enough that we require users that really mean to play
3073145b7b3cSmrg	      # such unportable linking tricks to link the library
3074145b7b3cSmrg	      # using -Wl,-lname, so that libtool does not consider it
3075145b7b3cSmrg	      # for duplicate removal.
3076145b7b3cSmrg	      case " $specialdeplibs " in
3077145b7b3cSmrg	      *" $deplib "*) new_libs="$deplib $new_libs" ;;
3078145b7b3cSmrg	      *)
3079145b7b3cSmrg		case " $new_libs " in
3080145b7b3cSmrg		*" $deplib "*) ;;
3081145b7b3cSmrg		*) new_libs="$deplib $new_libs" ;;
3082145b7b3cSmrg		esac
3083145b7b3cSmrg		;;
3084145b7b3cSmrg	      esac
3085145b7b3cSmrg	      ;;
3086145b7b3cSmrg	    esac
3087145b7b3cSmrg	  done
3088145b7b3cSmrg	  tmp_libs=
3089145b7b3cSmrg	  for deplib in $new_libs; do
3090145b7b3cSmrg	    case $deplib in
3091145b7b3cSmrg	    -L*)
3092145b7b3cSmrg	      case " $tmp_libs " in
3093145b7b3cSmrg	      *" $deplib "*) ;;
3094145b7b3cSmrg	      *) tmp_libs="$tmp_libs $deplib" ;;
3095145b7b3cSmrg	      esac
3096145b7b3cSmrg	      ;;
3097145b7b3cSmrg	    *) tmp_libs="$tmp_libs $deplib" ;;
3098145b7b3cSmrg	    esac
3099145b7b3cSmrg	  done
3100145b7b3cSmrg	  eval $var=\"$tmp_libs\"
3101145b7b3cSmrg	done # for var
3102145b7b3cSmrg      fi
3103145b7b3cSmrg      # Last step: remove runtime libs from dependency_libs
3104145b7b3cSmrg      # (they stay in deplibs)
3105145b7b3cSmrg      tmp_libs=
3106145b7b3cSmrg      for i in $dependency_libs ; do
3107145b7b3cSmrg	case " $predeps $postdeps $compiler_lib_search_path " in
3108145b7b3cSmrg	*" $i "*)
3109145b7b3cSmrg	  i=""
3110145b7b3cSmrg	  ;;
3111145b7b3cSmrg	esac
3112145b7b3cSmrg	if test -n "$i" ; then
3113145b7b3cSmrg	  tmp_libs="$tmp_libs $i"
3114145b7b3cSmrg	fi
3115145b7b3cSmrg      done
3116145b7b3cSmrg      dependency_libs=$tmp_libs
3117145b7b3cSmrg    done # for pass
3118145b7b3cSmrg    if test "$linkmode" = prog; then
3119145b7b3cSmrg      dlfiles="$newdlfiles"
3120145b7b3cSmrg      dlprefiles="$newdlprefiles"
3121145b7b3cSmrg    fi
3122145b7b3cSmrg
3123145b7b3cSmrg    case $linkmode in
3124145b7b3cSmrg    oldlib)
3125578741aaSmrg      case " $deplibs" in
3126578741aaSmrg      *\ -l* | *\ -L*)
3127578741aaSmrg	$echo "$modename: warning: \`-l' and \`-L' are ignored for archives" 1>&2 ;;
3128578741aaSmrg      esac
3129145b7b3cSmrg
3130145b7b3cSmrg      if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
3131145b7b3cSmrg	$echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2
3132145b7b3cSmrg      fi
3133145b7b3cSmrg
3134145b7b3cSmrg      if test -n "$rpath"; then
3135145b7b3cSmrg	$echo "$modename: warning: \`-rpath' is ignored for archives" 1>&2
3136145b7b3cSmrg      fi
3137145b7b3cSmrg
3138145b7b3cSmrg      if test -n "$xrpath"; then
3139145b7b3cSmrg	$echo "$modename: warning: \`-R' is ignored for archives" 1>&2
3140145b7b3cSmrg      fi
3141145b7b3cSmrg
3142145b7b3cSmrg      if test -n "$vinfo"; then
3143145b7b3cSmrg	$echo "$modename: warning: \`-version-info/-version-number' is ignored for archives" 1>&2
3144145b7b3cSmrg      fi
3145145b7b3cSmrg
3146145b7b3cSmrg      if test -n "$release"; then
3147145b7b3cSmrg	$echo "$modename: warning: \`-release' is ignored for archives" 1>&2
3148145b7b3cSmrg      fi
3149145b7b3cSmrg
3150145b7b3cSmrg      if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
3151145b7b3cSmrg	$echo "$modename: warning: \`-export-symbols' is ignored for archives" 1>&2
3152145b7b3cSmrg      fi
3153145b7b3cSmrg
3154145b7b3cSmrg      # Now set the variables for building old libraries.
3155145b7b3cSmrg      build_libtool_libs=no
3156145b7b3cSmrg      oldlibs="$output"
3157145b7b3cSmrg      objs="$objs$old_deplibs"
3158145b7b3cSmrg      ;;
3159145b7b3cSmrg
3160145b7b3cSmrg    lib)
3161145b7b3cSmrg      # Make sure we only generate libraries of the form `libNAME.la'.
3162145b7b3cSmrg      case $outputname in
3163145b7b3cSmrg      lib*)
3164145b7b3cSmrg	name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
3165145b7b3cSmrg	eval shared_ext=\"$shrext_cmds\"
3166145b7b3cSmrg	eval libname=\"$libname_spec\"
3167145b7b3cSmrg	;;
3168145b7b3cSmrg      *)
3169145b7b3cSmrg	if test "$module" = no; then
3170145b7b3cSmrg	  $echo "$modename: libtool library \`$output' must begin with \`lib'" 1>&2
3171145b7b3cSmrg	  $echo "$help" 1>&2
3172145b7b3cSmrg	  exit $EXIT_FAILURE
3173145b7b3cSmrg	fi
3174145b7b3cSmrg	if test "$need_lib_prefix" != no; then
3175145b7b3cSmrg	  # Add the "lib" prefix for modules if required
3176145b7b3cSmrg	  name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
3177145b7b3cSmrg	  eval shared_ext=\"$shrext_cmds\"
3178145b7b3cSmrg	  eval libname=\"$libname_spec\"
3179145b7b3cSmrg	else
3180145b7b3cSmrg	  libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
3181145b7b3cSmrg	fi
3182145b7b3cSmrg	;;
3183145b7b3cSmrg      esac
3184145b7b3cSmrg
3185145b7b3cSmrg      if test -n "$objs"; then
3186145b7b3cSmrg	if test "$deplibs_check_method" != pass_all; then
3187145b7b3cSmrg	  $echo "$modename: cannot build libtool library \`$output' from non-libtool objects on this host:$objs" 2>&1
3188145b7b3cSmrg	  exit $EXIT_FAILURE
3189145b7b3cSmrg	else
3190145b7b3cSmrg	  $echo
3191145b7b3cSmrg	  $echo "*** Warning: Linking the shared library $output against the non-libtool"
3192145b7b3cSmrg	  $echo "*** objects $objs is not portable!"
3193145b7b3cSmrg	  libobjs="$libobjs $objs"
3194145b7b3cSmrg	fi
3195145b7b3cSmrg      fi
3196145b7b3cSmrg
3197145b7b3cSmrg      if test "$dlself" != no; then
3198145b7b3cSmrg	$echo "$modename: warning: \`-dlopen self' is ignored for libtool libraries" 1>&2
3199145b7b3cSmrg      fi
3200145b7b3cSmrg
3201145b7b3cSmrg      set dummy $rpath
3202145b7b3cSmrg      if test "$#" -gt 2; then
3203145b7b3cSmrg	$echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2
3204145b7b3cSmrg      fi
3205145b7b3cSmrg      install_libdir="$2"
3206145b7b3cSmrg
3207145b7b3cSmrg      oldlibs=
3208145b7b3cSmrg      if test -z "$rpath"; then
3209145b7b3cSmrg	if test "$build_libtool_libs" = yes; then
3210145b7b3cSmrg	  # Building a libtool convenience library.
3211145b7b3cSmrg	  # Some compilers have problems with a `.al' extension so
3212145b7b3cSmrg	  # convenience libraries should have the same extension an
3213145b7b3cSmrg	  # archive normally would.
3214145b7b3cSmrg	  oldlibs="$output_objdir/$libname.$libext $oldlibs"
3215145b7b3cSmrg	  build_libtool_libs=convenience
3216145b7b3cSmrg	  build_old_libs=yes
3217145b7b3cSmrg	fi
3218145b7b3cSmrg
3219145b7b3cSmrg	if test -n "$vinfo"; then
3220145b7b3cSmrg	  $echo "$modename: warning: \`-version-info/-version-number' is ignored for convenience libraries" 1>&2
3221145b7b3cSmrg	fi
3222145b7b3cSmrg
3223145b7b3cSmrg	if test -n "$release"; then
3224145b7b3cSmrg	  $echo "$modename: warning: \`-release' is ignored for convenience libraries" 1>&2
3225145b7b3cSmrg	fi
3226145b7b3cSmrg      else
3227145b7b3cSmrg
3228145b7b3cSmrg	# Parse the version information argument.
3229145b7b3cSmrg	save_ifs="$IFS"; IFS=':'
3230145b7b3cSmrg	set dummy $vinfo 0 0 0
3231145b7b3cSmrg	IFS="$save_ifs"
3232145b7b3cSmrg
3233145b7b3cSmrg	if test -n "$8"; then
3234145b7b3cSmrg	  $echo "$modename: too many parameters to \`-version-info'" 1>&2
3235145b7b3cSmrg	  $echo "$help" 1>&2
3236145b7b3cSmrg	  exit $EXIT_FAILURE
3237145b7b3cSmrg	fi
3238145b7b3cSmrg
3239145b7b3cSmrg	# convert absolute version numbers to libtool ages
3240145b7b3cSmrg	# this retains compatibility with .la files and attempts
3241145b7b3cSmrg	# to make the code below a bit more comprehensible
3242145b7b3cSmrg
3243145b7b3cSmrg	case $vinfo_number in
3244145b7b3cSmrg	yes)
3245145b7b3cSmrg	  number_major="$2"
3246145b7b3cSmrg	  number_minor="$3"
3247145b7b3cSmrg	  number_revision="$4"
3248145b7b3cSmrg	  #
3249145b7b3cSmrg	  # There are really only two kinds -- those that
3250145b7b3cSmrg	  # use the current revision as the major version
3251145b7b3cSmrg	  # and those that subtract age and use age as
3252145b7b3cSmrg	  # a minor version.  But, then there is irix
3253145b7b3cSmrg	  # which has an extra 1 added just for fun
3254145b7b3cSmrg	  #
3255145b7b3cSmrg	  case $version_type in
3256578741aaSmrg	  darwin|linux|osf|windows|none)
3257145b7b3cSmrg	    current=`expr $number_major + $number_minor`
3258145b7b3cSmrg	    age="$number_minor"
3259145b7b3cSmrg	    revision="$number_revision"
3260145b7b3cSmrg	    ;;
3261145b7b3cSmrg	  freebsd-aout|freebsd-elf|sunos)
3262145b7b3cSmrg	    current="$number_major"
3263145b7b3cSmrg	    revision="$number_minor"
3264145b7b3cSmrg	    age="0"
3265145b7b3cSmrg	    ;;
3266145b7b3cSmrg	  irix|nonstopux)
3267578741aaSmrg	    current=`expr $number_major + $number_minor`
3268145b7b3cSmrg	    age="$number_minor"
3269145b7b3cSmrg	    revision="$number_minor"
3270578741aaSmrg	    lt_irix_increment=no
3271145b7b3cSmrg	    ;;
3272145b7b3cSmrg	  esac
3273145b7b3cSmrg	  ;;
3274145b7b3cSmrg	no)
3275145b7b3cSmrg	  current="$2"
3276145b7b3cSmrg	  revision="$3"
3277145b7b3cSmrg	  age="$4"
3278145b7b3cSmrg	  ;;
3279145b7b3cSmrg	esac
3280145b7b3cSmrg
3281145b7b3cSmrg	# Check that each of the things are valid numbers.
3282145b7b3cSmrg	case $current in
3283145b7b3cSmrg	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]) ;;
3284145b7b3cSmrg	*)
3285145b7b3cSmrg	  $echo "$modename: CURRENT \`$current' must be a nonnegative integer" 1>&2
3286145b7b3cSmrg	  $echo "$modename: \`$vinfo' is not valid version information" 1>&2
3287145b7b3cSmrg	  exit $EXIT_FAILURE
3288145b7b3cSmrg	  ;;
3289145b7b3cSmrg	esac
3290145b7b3cSmrg
3291145b7b3cSmrg	case $revision in
3292145b7b3cSmrg	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]) ;;
3293145b7b3cSmrg	*)
3294145b7b3cSmrg	  $echo "$modename: REVISION \`$revision' must be a nonnegative integer" 1>&2
3295145b7b3cSmrg	  $echo "$modename: \`$vinfo' is not valid version information" 1>&2
3296145b7b3cSmrg	  exit $EXIT_FAILURE
3297145b7b3cSmrg	  ;;
3298145b7b3cSmrg	esac
3299145b7b3cSmrg
3300145b7b3cSmrg	case $age in
3301145b7b3cSmrg	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]) ;;
3302145b7b3cSmrg	*)
3303145b7b3cSmrg	  $echo "$modename: AGE \`$age' must be a nonnegative integer" 1>&2
3304145b7b3cSmrg	  $echo "$modename: \`$vinfo' is not valid version information" 1>&2
3305145b7b3cSmrg	  exit $EXIT_FAILURE
3306145b7b3cSmrg	  ;;
3307145b7b3cSmrg	esac
3308145b7b3cSmrg
3309145b7b3cSmrg	if test "$age" -gt "$current"; then
3310145b7b3cSmrg	  $echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2
3311145b7b3cSmrg	  $echo "$modename: \`$vinfo' is not valid version information" 1>&2
3312145b7b3cSmrg	  exit $EXIT_FAILURE
3313145b7b3cSmrg	fi
3314145b7b3cSmrg
3315145b7b3cSmrg	# Calculate the version variables.
3316145b7b3cSmrg	major=
3317145b7b3cSmrg	versuffix=
3318145b7b3cSmrg	verstring=
3319145b7b3cSmrg	case $version_type in
3320145b7b3cSmrg	none) ;;
3321145b7b3cSmrg
3322145b7b3cSmrg	darwin)
3323145b7b3cSmrg	  # Like Linux, but with the current version available in
3324145b7b3cSmrg	  # verstring for coding it into the library header
3325145b7b3cSmrg	  major=.`expr $current - $age`
3326145b7b3cSmrg	  versuffix="$major.$age.$revision"
3327145b7b3cSmrg	  # Darwin ld doesn't like 0 for these options...
3328145b7b3cSmrg	  minor_current=`expr $current + 1`
3329578741aaSmrg	  xlcverstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision"
3330578741aaSmrg	  verstring="-compatibility_version $minor_current -current_version $minor_current.$revision"
3331145b7b3cSmrg	  ;;
3332145b7b3cSmrg
3333145b7b3cSmrg	freebsd-aout)
3334145b7b3cSmrg	  major=".$current"
3335145b7b3cSmrg	  versuffix=".$current.$revision";
3336145b7b3cSmrg	  ;;
3337145b7b3cSmrg
3338145b7b3cSmrg	freebsd-elf)
3339145b7b3cSmrg	  major=".$current"
3340145b7b3cSmrg	  versuffix=".$current";
3341145b7b3cSmrg	  ;;
3342145b7b3cSmrg
3343145b7b3cSmrg	irix | nonstopux)
3344578741aaSmrg	  if test "X$lt_irix_increment" = "Xno"; then
3345578741aaSmrg	    major=`expr $current - $age`
3346578741aaSmrg	  else
3347578741aaSmrg	    major=`expr $current - $age + 1`
3348578741aaSmrg	  fi
3349145b7b3cSmrg	  case $version_type in
3350145b7b3cSmrg	    nonstopux) verstring_prefix=nonstopux ;;
3351145b7b3cSmrg	    *)         verstring_prefix=sgi ;;
3352145b7b3cSmrg	  esac
3353145b7b3cSmrg	  verstring="$verstring_prefix$major.$revision"
3354145b7b3cSmrg
3355145b7b3cSmrg	  # Add in all the interfaces that we are compatible with.
3356145b7b3cSmrg	  loop=$revision
3357145b7b3cSmrg	  while test "$loop" -ne 0; do
3358145b7b3cSmrg	    iface=`expr $revision - $loop`
3359145b7b3cSmrg	    loop=`expr $loop - 1`
3360145b7b3cSmrg	    verstring="$verstring_prefix$major.$iface:$verstring"
3361145b7b3cSmrg	  done
3362145b7b3cSmrg
3363145b7b3cSmrg	  # Before this point, $major must not contain `.'.
3364145b7b3cSmrg	  major=.$major
3365145b7b3cSmrg	  versuffix="$major.$revision"
3366145b7b3cSmrg	  ;;
3367145b7b3cSmrg
3368145b7b3cSmrg	linux)
3369145b7b3cSmrg	  major=.`expr $current - $age`
3370145b7b3cSmrg	  versuffix="$major.$age.$revision"
3371145b7b3cSmrg	  ;;
3372145b7b3cSmrg
3373145b7b3cSmrg	osf)
3374145b7b3cSmrg	  major=.`expr $current - $age`
3375145b7b3cSmrg	  versuffix=".$current.$age.$revision"
3376145b7b3cSmrg	  verstring="$current.$age.$revision"
3377145b7b3cSmrg
3378145b7b3cSmrg	  # Add in all the interfaces that we are compatible with.
3379145b7b3cSmrg	  loop=$age
3380145b7b3cSmrg	  while test "$loop" -ne 0; do
3381145b7b3cSmrg	    iface=`expr $current - $loop`
3382145b7b3cSmrg	    loop=`expr $loop - 1`
3383145b7b3cSmrg	    verstring="$verstring:${iface}.0"
3384145b7b3cSmrg	  done
3385145b7b3cSmrg
3386145b7b3cSmrg	  # Make executables depend on our current version.
3387145b7b3cSmrg	  verstring="$verstring:${current}.0"
3388145b7b3cSmrg	  ;;
3389145b7b3cSmrg
3390145b7b3cSmrg	sunos)
3391145b7b3cSmrg	  major=".$current"
3392145b7b3cSmrg	  versuffix=".$current.$revision"
3393145b7b3cSmrg	  ;;
3394145b7b3cSmrg
3395145b7b3cSmrg	windows)
3396145b7b3cSmrg	  # Use '-' rather than '.', since we only want one
3397145b7b3cSmrg	  # extension on DOS 8.3 filesystems.
3398145b7b3cSmrg	  major=`expr $current - $age`
3399145b7b3cSmrg	  versuffix="-$major"
3400145b7b3cSmrg	  ;;
3401145b7b3cSmrg
3402145b7b3cSmrg	*)
3403145b7b3cSmrg	  $echo "$modename: unknown library version type \`$version_type'" 1>&2
3404145b7b3cSmrg	  $echo "Fatal configuration error.  See the $PACKAGE docs for more information." 1>&2
3405145b7b3cSmrg	  exit $EXIT_FAILURE
3406145b7b3cSmrg	  ;;
3407145b7b3cSmrg	esac
3408145b7b3cSmrg
3409145b7b3cSmrg	# Clear the version info if we defaulted, and they specified a release.
3410145b7b3cSmrg	if test -z "$vinfo" && test -n "$release"; then
3411145b7b3cSmrg	  major=
3412145b7b3cSmrg	  case $version_type in
3413145b7b3cSmrg	  darwin)
3414145b7b3cSmrg	    # we can't check for "0.0" in archive_cmds due to quoting
3415145b7b3cSmrg	    # problems, so we reset it completely
3416145b7b3cSmrg	    verstring=
3417145b7b3cSmrg	    ;;
3418145b7b3cSmrg	  *)
3419145b7b3cSmrg	    verstring="0.0"
3420145b7b3cSmrg	    ;;
3421145b7b3cSmrg	  esac
3422145b7b3cSmrg	  if test "$need_version" = no; then
3423145b7b3cSmrg	    versuffix=
3424145b7b3cSmrg	  else
3425145b7b3cSmrg	    versuffix=".0.0"
3426145b7b3cSmrg	  fi
3427145b7b3cSmrg	fi
3428145b7b3cSmrg
3429145b7b3cSmrg	# Remove version info from name if versioning should be avoided
3430145b7b3cSmrg	if test "$avoid_version" = yes && test "$need_version" = no; then
3431145b7b3cSmrg	  major=
3432145b7b3cSmrg	  versuffix=
3433145b7b3cSmrg	  verstring=""
3434145b7b3cSmrg	fi
3435145b7b3cSmrg
3436145b7b3cSmrg	# Check to see if the archive will have undefined symbols.
3437145b7b3cSmrg	if test "$allow_undefined" = yes; then
3438145b7b3cSmrg	  if test "$allow_undefined_flag" = unsupported; then
3439145b7b3cSmrg	    $echo "$modename: warning: undefined symbols not allowed in $host shared libraries" 1>&2
3440145b7b3cSmrg	    build_libtool_libs=no
3441145b7b3cSmrg	    build_old_libs=yes
3442145b7b3cSmrg	  fi
3443145b7b3cSmrg	else
3444145b7b3cSmrg	  # Don't allow undefined symbols.
3445145b7b3cSmrg	  allow_undefined_flag="$no_undefined_flag"
3446145b7b3cSmrg	fi
3447145b7b3cSmrg      fi
3448145b7b3cSmrg
3449145b7b3cSmrg      if test "$mode" != relink; then
3450145b7b3cSmrg	# Remove our outputs, but don't remove object files since they
3451145b7b3cSmrg	# may have been created when compiling PIC objects.
3452145b7b3cSmrg	removelist=
3453145b7b3cSmrg	tempremovelist=`$echo "$output_objdir/*"`
3454145b7b3cSmrg	for p in $tempremovelist; do
3455145b7b3cSmrg	  case $p in
3456145b7b3cSmrg	    *.$objext)
3457145b7b3cSmrg	       ;;
3458145b7b3cSmrg	    $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*)
3459145b7b3cSmrg	       if test "X$precious_files_regex" != "X"; then
3460145b7b3cSmrg	         if echo $p | $EGREP -e "$precious_files_regex" >/dev/null 2>&1
3461145b7b3cSmrg	         then
3462145b7b3cSmrg		   continue
3463145b7b3cSmrg		 fi
3464145b7b3cSmrg	       fi
3465145b7b3cSmrg	       removelist="$removelist $p"
3466145b7b3cSmrg	       ;;
3467145b7b3cSmrg	    *) ;;
3468145b7b3cSmrg	  esac
3469145b7b3cSmrg	done
3470145b7b3cSmrg	if test -n "$removelist"; then
3471145b7b3cSmrg	  $show "${rm}r $removelist"
3472145b7b3cSmrg	  $run ${rm}r $removelist
3473145b7b3cSmrg	fi
3474145b7b3cSmrg      fi
3475145b7b3cSmrg
3476145b7b3cSmrg      # Now set the variables for building old libraries.
3477145b7b3cSmrg      if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then
3478145b7b3cSmrg	oldlibs="$oldlibs $output_objdir/$libname.$libext"
3479145b7b3cSmrg
3480145b7b3cSmrg	# Transform .lo files to .o files.
3481145b7b3cSmrg	oldobjs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP`
3482145b7b3cSmrg      fi
3483145b7b3cSmrg
3484145b7b3cSmrg      # Eliminate all temporary directories.
3485578741aaSmrg      #for path in $notinst_path; do
3486578741aaSmrg      #	lib_search_path=`$echo "$lib_search_path " | ${SED} -e "s% $path % %g"`
3487578741aaSmrg      #	deplibs=`$echo "$deplibs " | ${SED} -e "s% -L$path % %g"`
3488578741aaSmrg      #	dependency_libs=`$echo "$dependency_libs " | ${SED} -e "s% -L$path % %g"`
3489578741aaSmrg      #done
3490145b7b3cSmrg
3491145b7b3cSmrg      if test -n "$xrpath"; then
3492145b7b3cSmrg	# If the user specified any rpath flags, then add them.
3493145b7b3cSmrg	temp_xrpath=
3494145b7b3cSmrg	for libdir in $xrpath; do
3495145b7b3cSmrg	  temp_xrpath="$temp_xrpath -R$libdir"
3496145b7b3cSmrg	  case "$finalize_rpath " in
3497145b7b3cSmrg	  *" $libdir "*) ;;
3498145b7b3cSmrg	  *) finalize_rpath="$finalize_rpath $libdir" ;;
3499145b7b3cSmrg	  esac
3500145b7b3cSmrg	done
3501145b7b3cSmrg	if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then
3502145b7b3cSmrg	  dependency_libs="$temp_xrpath $dependency_libs"
3503145b7b3cSmrg	fi
3504145b7b3cSmrg      fi
3505145b7b3cSmrg
3506145b7b3cSmrg      # Make sure dlfiles contains only unique files that won't be dlpreopened
3507145b7b3cSmrg      old_dlfiles="$dlfiles"
3508145b7b3cSmrg      dlfiles=
3509145b7b3cSmrg      for lib in $old_dlfiles; do
3510145b7b3cSmrg	case " $dlprefiles $dlfiles " in
3511145b7b3cSmrg	*" $lib "*) ;;
3512145b7b3cSmrg	*) dlfiles="$dlfiles $lib" ;;
3513145b7b3cSmrg	esac
3514145b7b3cSmrg      done
3515145b7b3cSmrg
3516145b7b3cSmrg      # Make sure dlprefiles contains only unique files
3517145b7b3cSmrg      old_dlprefiles="$dlprefiles"
3518145b7b3cSmrg      dlprefiles=
3519145b7b3cSmrg      for lib in $old_dlprefiles; do
3520145b7b3cSmrg	case "$dlprefiles " in
3521145b7b3cSmrg	*" $lib "*) ;;
3522145b7b3cSmrg	*) dlprefiles="$dlprefiles $lib" ;;
3523145b7b3cSmrg	esac
3524145b7b3cSmrg      done
3525145b7b3cSmrg
3526145b7b3cSmrg      if test "$build_libtool_libs" = yes; then
3527145b7b3cSmrg	if test -n "$rpath"; then
3528145b7b3cSmrg	  case $host in
3529145b7b3cSmrg	  *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos*)
3530145b7b3cSmrg	    # these systems don't actually have a c library (as such)!
3531145b7b3cSmrg	    ;;
3532145b7b3cSmrg	  *-*-rhapsody* | *-*-darwin1.[012])
3533145b7b3cSmrg	    # Rhapsody C library is in the System framework
3534145b7b3cSmrg	    deplibs="$deplibs -framework System"
3535145b7b3cSmrg	    ;;
3536145b7b3cSmrg	  *-*-netbsd*)
3537145b7b3cSmrg	    # Don't link with libc until the a.out ld.so is fixed.
3538145b7b3cSmrg	    ;;
3539145b7b3cSmrg	  *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
3540145b7b3cSmrg	    # Do not include libc due to us having libc/libc_r.
3541145b7b3cSmrg	    ;;
3542145b7b3cSmrg	  *-*-sco3.2v5* | *-*-sco5v6*)
3543145b7b3cSmrg	    # Causes problems with __ctype
3544145b7b3cSmrg	    ;;
3545145b7b3cSmrg	  *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
3546145b7b3cSmrg	    # Compiler inserts libc in the correct place for threads to work
3547145b7b3cSmrg	    ;;
3548145b7b3cSmrg 	  *)
3549145b7b3cSmrg	    # Add libc to deplibs on all other systems if necessary.
3550145b7b3cSmrg	    if test "$build_libtool_need_lc" = "yes"; then
3551145b7b3cSmrg	      deplibs="$deplibs -lc"
3552145b7b3cSmrg	    fi
3553145b7b3cSmrg	    ;;
3554145b7b3cSmrg	  esac
3555145b7b3cSmrg	fi
3556145b7b3cSmrg
3557145b7b3cSmrg	# Transform deplibs into only deplibs that can be linked in shared.
3558145b7b3cSmrg	name_save=$name
3559145b7b3cSmrg	libname_save=$libname
3560145b7b3cSmrg	release_save=$release
3561145b7b3cSmrg	versuffix_save=$versuffix
3562145b7b3cSmrg	major_save=$major
3563145b7b3cSmrg	# I'm not sure if I'm treating the release correctly.  I think
3564145b7b3cSmrg	# release should show up in the -l (ie -lgmp5) so we don't want to
3565145b7b3cSmrg	# add it in twice.  Is that correct?
3566145b7b3cSmrg	release=""
3567145b7b3cSmrg	versuffix=""
3568145b7b3cSmrg	major=""
3569145b7b3cSmrg	newdeplibs=
3570145b7b3cSmrg	droppeddeps=no
3571145b7b3cSmrg	case $deplibs_check_method in
3572145b7b3cSmrg	pass_all)
3573145b7b3cSmrg	  # Don't check for shared/static.  Everything works.
3574145b7b3cSmrg	  # This might be a little naive.  We might want to check
3575145b7b3cSmrg	  # whether the library exists or not.  But this is on
3576145b7b3cSmrg	  # osf3 & osf4 and I'm not really sure... Just
3577145b7b3cSmrg	  # implementing what was already the behavior.
3578145b7b3cSmrg	  newdeplibs=$deplibs
3579145b7b3cSmrg	  ;;
3580145b7b3cSmrg	test_compile)
3581145b7b3cSmrg	  # This code stresses the "libraries are programs" paradigm to its
3582145b7b3cSmrg	  # limits. Maybe even breaks it.  We compile a program, linking it
3583145b7b3cSmrg	  # against the deplibs as a proxy for the library.  Then we can check
3584145b7b3cSmrg	  # whether they linked in statically or dynamically with ldd.
3585145b7b3cSmrg	  $rm conftest.c
3586145b7b3cSmrg	  cat > conftest.c <<EOF
3587145b7b3cSmrg	  int main() { return 0; }
3588145b7b3cSmrgEOF
3589145b7b3cSmrg	  $rm conftest
3590578741aaSmrg	  if $LTCC $LTCFLAGS -o conftest conftest.c $deplibs; then
3591145b7b3cSmrg	    ldd_output=`ldd conftest`
3592145b7b3cSmrg	    for i in $deplibs; do
3593145b7b3cSmrg	      name=`expr $i : '-l\(.*\)'`
3594145b7b3cSmrg	      # If $name is empty we are operating on a -L argument.
3595578741aaSmrg              if test "$name" != "" && test "$name" != "0"; then
3596145b7b3cSmrg		if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
3597145b7b3cSmrg		  case " $predeps $postdeps " in
3598145b7b3cSmrg		  *" $i "*)
3599145b7b3cSmrg		    newdeplibs="$newdeplibs $i"
3600145b7b3cSmrg		    i=""
3601145b7b3cSmrg		    ;;
3602145b7b3cSmrg		  esac
3603145b7b3cSmrg	        fi
3604145b7b3cSmrg		if test -n "$i" ; then
3605145b7b3cSmrg		  libname=`eval \\$echo \"$libname_spec\"`
3606145b7b3cSmrg		  deplib_matches=`eval \\$echo \"$library_names_spec\"`
3607145b7b3cSmrg		  set dummy $deplib_matches
3608145b7b3cSmrg		  deplib_match=$2
3609145b7b3cSmrg		  if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
3610145b7b3cSmrg		    newdeplibs="$newdeplibs $i"
3611145b7b3cSmrg		  else
3612145b7b3cSmrg		    droppeddeps=yes
3613145b7b3cSmrg		    $echo
3614145b7b3cSmrg		    $echo "*** Warning: dynamic linker does not accept needed library $i."
3615145b7b3cSmrg		    $echo "*** I have the capability to make that library automatically link in when"
3616145b7b3cSmrg		    $echo "*** you link to this library.  But I can only do this if you have a"
3617145b7b3cSmrg		    $echo "*** shared version of the library, which I believe you do not have"
3618145b7b3cSmrg		    $echo "*** because a test_compile did reveal that the linker did not use it for"
3619145b7b3cSmrg		    $echo "*** its dynamic dependency list that programs get resolved with at runtime."
3620145b7b3cSmrg		  fi
3621145b7b3cSmrg		fi
3622145b7b3cSmrg	      else
3623145b7b3cSmrg		newdeplibs="$newdeplibs $i"
3624145b7b3cSmrg	      fi
3625145b7b3cSmrg	    done
3626145b7b3cSmrg	  else
3627145b7b3cSmrg	    # Error occurred in the first compile.  Let's try to salvage
3628145b7b3cSmrg	    # the situation: Compile a separate program for each library.
3629145b7b3cSmrg	    for i in $deplibs; do
3630145b7b3cSmrg	      name=`expr $i : '-l\(.*\)'`
3631145b7b3cSmrg	      # If $name is empty we are operating on a -L argument.
3632145b7b3cSmrg              if test "$name" != "" && test "$name" != "0"; then
3633145b7b3cSmrg		$rm conftest
3634578741aaSmrg		if $LTCC $LTCFLAGS -o conftest conftest.c $i; then
3635145b7b3cSmrg		  ldd_output=`ldd conftest`
3636145b7b3cSmrg		  if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
3637145b7b3cSmrg		    case " $predeps $postdeps " in
3638145b7b3cSmrg		    *" $i "*)
3639145b7b3cSmrg		      newdeplibs="$newdeplibs $i"
3640145b7b3cSmrg		      i=""
3641145b7b3cSmrg		      ;;
3642145b7b3cSmrg		    esac
3643145b7b3cSmrg		  fi
3644145b7b3cSmrg		  if test -n "$i" ; then
3645145b7b3cSmrg		    libname=`eval \\$echo \"$libname_spec\"`
3646145b7b3cSmrg		    deplib_matches=`eval \\$echo \"$library_names_spec\"`
3647145b7b3cSmrg		    set dummy $deplib_matches
3648145b7b3cSmrg		    deplib_match=$2
3649145b7b3cSmrg		    if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
3650145b7b3cSmrg		      newdeplibs="$newdeplibs $i"
3651145b7b3cSmrg		    else
3652145b7b3cSmrg		      droppeddeps=yes
3653145b7b3cSmrg		      $echo
3654145b7b3cSmrg		      $echo "*** Warning: dynamic linker does not accept needed library $i."
3655145b7b3cSmrg		      $echo "*** I have the capability to make that library automatically link in when"
3656145b7b3cSmrg		      $echo "*** you link to this library.  But I can only do this if you have a"
3657145b7b3cSmrg		      $echo "*** shared version of the library, which you do not appear to have"
3658145b7b3cSmrg		      $echo "*** because a test_compile did reveal that the linker did not use this one"
3659145b7b3cSmrg		      $echo "*** as a dynamic dependency that programs can get resolved with at runtime."
3660145b7b3cSmrg		    fi
3661145b7b3cSmrg		  fi
3662145b7b3cSmrg		else
3663145b7b3cSmrg		  droppeddeps=yes
3664145b7b3cSmrg		  $echo
3665145b7b3cSmrg		  $echo "*** Warning!  Library $i is needed by this library but I was not able to"
3666578741aaSmrg		  $echo "*** make it link in!  You will probably need to install it or some"
3667145b7b3cSmrg		  $echo "*** library that it depends on before this library will be fully"
3668145b7b3cSmrg		  $echo "*** functional.  Installing it before continuing would be even better."
3669145b7b3cSmrg		fi
3670145b7b3cSmrg	      else
3671145b7b3cSmrg		newdeplibs="$newdeplibs $i"
3672145b7b3cSmrg	      fi
3673145b7b3cSmrg	    done
3674145b7b3cSmrg	  fi
3675145b7b3cSmrg	  ;;
3676145b7b3cSmrg	file_magic*)
3677145b7b3cSmrg	  set dummy $deplibs_check_method
3678145b7b3cSmrg	  file_magic_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
3679145b7b3cSmrg	  for a_deplib in $deplibs; do
3680145b7b3cSmrg	    name=`expr $a_deplib : '-l\(.*\)'`
3681145b7b3cSmrg	    # If $name is empty we are operating on a -L argument.
3682145b7b3cSmrg            if test "$name" != "" && test  "$name" != "0"; then
3683145b7b3cSmrg	      if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
3684145b7b3cSmrg		case " $predeps $postdeps " in
3685145b7b3cSmrg		*" $a_deplib "*)
3686145b7b3cSmrg		  newdeplibs="$newdeplibs $a_deplib"
3687145b7b3cSmrg		  a_deplib=""
3688145b7b3cSmrg		  ;;
3689145b7b3cSmrg		esac
3690145b7b3cSmrg	      fi
3691145b7b3cSmrg	      if test -n "$a_deplib" ; then
3692145b7b3cSmrg		libname=`eval \\$echo \"$libname_spec\"`
3693145b7b3cSmrg		for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
3694145b7b3cSmrg		  potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
3695145b7b3cSmrg		  for potent_lib in $potential_libs; do
3696145b7b3cSmrg		      # Follow soft links.
3697145b7b3cSmrg		      if ls -lLd "$potent_lib" 2>/dev/null \
3698145b7b3cSmrg			 | grep " -> " >/dev/null; then
3699145b7b3cSmrg			continue
3700145b7b3cSmrg		      fi
3701145b7b3cSmrg		      # The statement above tries to avoid entering an
3702145b7b3cSmrg		      # endless loop below, in case of cyclic links.
3703145b7b3cSmrg		      # We might still enter an endless loop, since a link
3704145b7b3cSmrg		      # loop can be closed while we follow links,
3705145b7b3cSmrg		      # but so what?
3706145b7b3cSmrg		      potlib="$potent_lib"
3707145b7b3cSmrg		      while test -h "$potlib" 2>/dev/null; do
3708145b7b3cSmrg			potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'`
3709145b7b3cSmrg			case $potliblink in
3710145b7b3cSmrg			[\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";;
3711145b7b3cSmrg			*) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";;
3712145b7b3cSmrg			esac
3713145b7b3cSmrg		      done
3714145b7b3cSmrg		      if eval $file_magic_cmd \"\$potlib\" 2>/dev/null \
3715145b7b3cSmrg			 | ${SED} 10q \
3716145b7b3cSmrg			 | $EGREP "$file_magic_regex" > /dev/null; then
3717145b7b3cSmrg			newdeplibs="$newdeplibs $a_deplib"
3718145b7b3cSmrg			a_deplib=""
3719145b7b3cSmrg			break 2
3720145b7b3cSmrg		      fi
3721145b7b3cSmrg		  done
3722145b7b3cSmrg		done
3723145b7b3cSmrg	      fi
3724145b7b3cSmrg	      if test -n "$a_deplib" ; then
3725145b7b3cSmrg		droppeddeps=yes
3726145b7b3cSmrg		$echo
3727145b7b3cSmrg		$echo "*** Warning: linker path does not have real file for library $a_deplib."
3728145b7b3cSmrg		$echo "*** I have the capability to make that library automatically link in when"
3729145b7b3cSmrg		$echo "*** you link to this library.  But I can only do this if you have a"
3730145b7b3cSmrg		$echo "*** shared version of the library, which you do not appear to have"
3731145b7b3cSmrg		$echo "*** because I did check the linker path looking for a file starting"
3732145b7b3cSmrg		if test -z "$potlib" ; then
3733145b7b3cSmrg		  $echo "*** with $libname but no candidates were found. (...for file magic test)"
3734145b7b3cSmrg		else
3735145b7b3cSmrg		  $echo "*** with $libname and none of the candidates passed a file format test"
3736145b7b3cSmrg		  $echo "*** using a file magic. Last file checked: $potlib"
3737145b7b3cSmrg		fi
3738145b7b3cSmrg	      fi
3739145b7b3cSmrg	    else
3740145b7b3cSmrg	      # Add a -L argument.
3741145b7b3cSmrg	      newdeplibs="$newdeplibs $a_deplib"
3742145b7b3cSmrg	    fi
3743145b7b3cSmrg	  done # Gone through all deplibs.
3744145b7b3cSmrg	  ;;
3745145b7b3cSmrg	match_pattern*)
3746145b7b3cSmrg	  set dummy $deplibs_check_method
3747145b7b3cSmrg	  match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
3748145b7b3cSmrg	  for a_deplib in $deplibs; do
3749145b7b3cSmrg	    name=`expr $a_deplib : '-l\(.*\)'`
3750145b7b3cSmrg	    # If $name is empty we are operating on a -L argument.
3751145b7b3cSmrg	    if test -n "$name" && test "$name" != "0"; then
3752145b7b3cSmrg	      if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
3753145b7b3cSmrg		case " $predeps $postdeps " in
3754145b7b3cSmrg		*" $a_deplib "*)
3755145b7b3cSmrg		  newdeplibs="$newdeplibs $a_deplib"
3756145b7b3cSmrg		  a_deplib=""
3757145b7b3cSmrg		  ;;
3758145b7b3cSmrg		esac
3759145b7b3cSmrg	      fi
3760145b7b3cSmrg	      if test -n "$a_deplib" ; then
3761145b7b3cSmrg		libname=`eval \\$echo \"$libname_spec\"`
3762145b7b3cSmrg		for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
3763145b7b3cSmrg		  potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
3764145b7b3cSmrg		  for potent_lib in $potential_libs; do
3765145b7b3cSmrg		    potlib="$potent_lib" # see symlink-check above in file_magic test
3766145b7b3cSmrg		    if eval $echo \"$potent_lib\" 2>/dev/null \
3767145b7b3cSmrg		        | ${SED} 10q \
3768145b7b3cSmrg		        | $EGREP "$match_pattern_regex" > /dev/null; then
3769145b7b3cSmrg		      newdeplibs="$newdeplibs $a_deplib"
3770145b7b3cSmrg		      a_deplib=""
3771145b7b3cSmrg		      break 2
3772145b7b3cSmrg		    fi
3773145b7b3cSmrg		  done
3774145b7b3cSmrg		done
3775145b7b3cSmrg	      fi
3776145b7b3cSmrg	      if test -n "$a_deplib" ; then
3777145b7b3cSmrg		droppeddeps=yes
3778145b7b3cSmrg		$echo
3779145b7b3cSmrg		$echo "*** Warning: linker path does not have real file for library $a_deplib."
3780145b7b3cSmrg		$echo "*** I have the capability to make that library automatically link in when"
3781145b7b3cSmrg		$echo "*** you link to this library.  But I can only do this if you have a"
3782145b7b3cSmrg		$echo "*** shared version of the library, which you do not appear to have"
3783145b7b3cSmrg		$echo "*** because I did check the linker path looking for a file starting"
3784145b7b3cSmrg		if test -z "$potlib" ; then
3785145b7b3cSmrg		  $echo "*** with $libname but no candidates were found. (...for regex pattern test)"
3786145b7b3cSmrg		else
3787145b7b3cSmrg		  $echo "*** with $libname and none of the candidates passed a file format test"
3788145b7b3cSmrg		  $echo "*** using a regex pattern. Last file checked: $potlib"
3789145b7b3cSmrg		fi
3790145b7b3cSmrg	      fi
3791145b7b3cSmrg	    else
3792145b7b3cSmrg	      # Add a -L argument.
3793145b7b3cSmrg	      newdeplibs="$newdeplibs $a_deplib"
3794145b7b3cSmrg	    fi
3795145b7b3cSmrg	  done # Gone through all deplibs.
3796145b7b3cSmrg	  ;;
3797145b7b3cSmrg	none | unknown | *)
3798145b7b3cSmrg	  newdeplibs=""
3799145b7b3cSmrg	  tmp_deplibs=`$echo "X $deplibs" | $Xsed -e 's/ -lc$//' \
3800145b7b3cSmrg	    -e 's/ -[LR][^ ]*//g'`
3801145b7b3cSmrg	  if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
3802145b7b3cSmrg	    for i in $predeps $postdeps ; do
3803145b7b3cSmrg	      # can't use Xsed below, because $i might contain '/'
3804145b7b3cSmrg	      tmp_deplibs=`$echo "X $tmp_deplibs" | ${SED} -e "1s,^X,," -e "s,$i,,"`
3805145b7b3cSmrg	    done
3806145b7b3cSmrg	  fi
3807145b7b3cSmrg	  if $echo "X $tmp_deplibs" | $Xsed -e 's/[ 	]//g' \
3808145b7b3cSmrg	    | grep . >/dev/null; then
3809145b7b3cSmrg	    $echo
3810145b7b3cSmrg	    if test "X$deplibs_check_method" = "Xnone"; then
3811145b7b3cSmrg	      $echo "*** Warning: inter-library dependencies are not supported in this platform."
3812145b7b3cSmrg	    else
3813145b7b3cSmrg	      $echo "*** Warning: inter-library dependencies are not known to be supported."
3814145b7b3cSmrg	    fi
3815145b7b3cSmrg	    $echo "*** All declared inter-library dependencies are being dropped."
3816145b7b3cSmrg	    droppeddeps=yes
3817145b7b3cSmrg	  fi
3818145b7b3cSmrg	  ;;
3819145b7b3cSmrg	esac
3820145b7b3cSmrg	versuffix=$versuffix_save
3821145b7b3cSmrg	major=$major_save
3822145b7b3cSmrg	release=$release_save
3823145b7b3cSmrg	libname=$libname_save
3824145b7b3cSmrg	name=$name_save
3825145b7b3cSmrg
3826145b7b3cSmrg	case $host in
3827145b7b3cSmrg	*-*-rhapsody* | *-*-darwin1.[012])
3828145b7b3cSmrg	  # On Rhapsody replace the C library is the System framework
3829145b7b3cSmrg	  newdeplibs=`$echo "X $newdeplibs" | $Xsed -e 's/ -lc / -framework System /'`
3830145b7b3cSmrg	  ;;
3831145b7b3cSmrg	esac
3832145b7b3cSmrg
3833145b7b3cSmrg	if test "$droppeddeps" = yes; then
3834145b7b3cSmrg	  if test "$module" = yes; then
3835145b7b3cSmrg	    $echo
3836145b7b3cSmrg	    $echo "*** Warning: libtool could not satisfy all declared inter-library"
3837145b7b3cSmrg	    $echo "*** dependencies of module $libname.  Therefore, libtool will create"
3838145b7b3cSmrg	    $echo "*** a static module, that should work as long as the dlopening"
3839145b7b3cSmrg	    $echo "*** application is linked with the -dlopen flag."
3840145b7b3cSmrg	    if test -z "$global_symbol_pipe"; then
3841145b7b3cSmrg	      $echo
3842145b7b3cSmrg	      $echo "*** However, this would only work if libtool was able to extract symbol"
3843145b7b3cSmrg	      $echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
3844145b7b3cSmrg	      $echo "*** not find such a program.  So, this module is probably useless."
3845145b7b3cSmrg	      $echo "*** \`nm' from GNU binutils and a full rebuild may help."
3846145b7b3cSmrg	    fi
3847145b7b3cSmrg	    if test "$build_old_libs" = no; then
3848145b7b3cSmrg	      oldlibs="$output_objdir/$libname.$libext"
3849145b7b3cSmrg	      build_libtool_libs=module
3850145b7b3cSmrg	      build_old_libs=yes
3851145b7b3cSmrg	    else
3852145b7b3cSmrg	      build_libtool_libs=no
3853145b7b3cSmrg	    fi
3854145b7b3cSmrg	  else
3855145b7b3cSmrg	    $echo "*** The inter-library dependencies that have been dropped here will be"
3856145b7b3cSmrg	    $echo "*** automatically added whenever a program is linked with this library"
3857145b7b3cSmrg	    $echo "*** or is declared to -dlopen it."
3858145b7b3cSmrg
3859145b7b3cSmrg	    if test "$allow_undefined" = no; then
3860145b7b3cSmrg	      $echo
3861145b7b3cSmrg	      $echo "*** Since this library must not contain undefined symbols,"
3862145b7b3cSmrg	      $echo "*** because either the platform does not support them or"
3863145b7b3cSmrg	      $echo "*** it was explicitly requested with -no-undefined,"
3864145b7b3cSmrg	      $echo "*** libtool will only create a static version of it."
3865145b7b3cSmrg	      if test "$build_old_libs" = no; then
3866145b7b3cSmrg		oldlibs="$output_objdir/$libname.$libext"
3867145b7b3cSmrg		build_libtool_libs=module
3868145b7b3cSmrg		build_old_libs=yes
3869145b7b3cSmrg	      else
3870145b7b3cSmrg		build_libtool_libs=no
3871145b7b3cSmrg	      fi
3872145b7b3cSmrg	    fi
3873145b7b3cSmrg	  fi
3874145b7b3cSmrg	fi
3875145b7b3cSmrg	# Done checking deplibs!
3876145b7b3cSmrg	deplibs=$newdeplibs
3877145b7b3cSmrg      fi
3878145b7b3cSmrg
3879145b7b3cSmrg
3880145b7b3cSmrg      # move library search paths that coincide with paths to not yet
3881145b7b3cSmrg      # installed libraries to the beginning of the library search list
3882145b7b3cSmrg      new_libs=
3883145b7b3cSmrg      for path in $notinst_path; do
3884145b7b3cSmrg	case " $new_libs " in
3885145b7b3cSmrg	*" -L$path/$objdir "*) ;;
3886145b7b3cSmrg	*)
3887145b7b3cSmrg	  case " $deplibs " in
3888145b7b3cSmrg	  *" -L$path/$objdir "*)
3889145b7b3cSmrg	    new_libs="$new_libs -L$path/$objdir" ;;
3890145b7b3cSmrg	  esac
3891145b7b3cSmrg	  ;;
3892145b7b3cSmrg	esac
3893145b7b3cSmrg      done
3894145b7b3cSmrg      for deplib in $deplibs; do
3895145b7b3cSmrg	case $deplib in
3896145b7b3cSmrg	-L*)
3897145b7b3cSmrg	  case " $new_libs " in
3898145b7b3cSmrg	  *" $deplib "*) ;;
3899145b7b3cSmrg	  *) new_libs="$new_libs $deplib" ;;
3900145b7b3cSmrg	  esac
3901145b7b3cSmrg	  ;;
3902145b7b3cSmrg	*) new_libs="$new_libs $deplib" ;;
3903145b7b3cSmrg	esac
3904145b7b3cSmrg      done
3905145b7b3cSmrg      deplibs="$new_libs"
3906145b7b3cSmrg
3907145b7b3cSmrg
3908145b7b3cSmrg      # All the library-specific variables (install_libdir is set above).
3909145b7b3cSmrg      library_names=
3910145b7b3cSmrg      old_library=
3911145b7b3cSmrg      dlname=
3912145b7b3cSmrg
3913145b7b3cSmrg      # Test again, we may have decided not to build it any more
3914145b7b3cSmrg      if test "$build_libtool_libs" = yes; then
3915145b7b3cSmrg	if test "$hardcode_into_libs" = yes; then
3916145b7b3cSmrg	  # Hardcode the library paths
3917145b7b3cSmrg	  hardcode_libdirs=
3918145b7b3cSmrg	  dep_rpath=
3919145b7b3cSmrg	  rpath="$finalize_rpath"
3920145b7b3cSmrg	  test "$mode" != relink && rpath="$compile_rpath$rpath"
3921145b7b3cSmrg	  for libdir in $rpath; do
3922145b7b3cSmrg	    if test -n "$hardcode_libdir_flag_spec"; then
3923145b7b3cSmrg	      if test -n "$hardcode_libdir_separator"; then
3924145b7b3cSmrg		if test -z "$hardcode_libdirs"; then
3925145b7b3cSmrg		  hardcode_libdirs="$libdir"
3926145b7b3cSmrg		else
3927145b7b3cSmrg		  # Just accumulate the unique libdirs.
3928145b7b3cSmrg		  case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
3929145b7b3cSmrg		  *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
3930145b7b3cSmrg		    ;;
3931145b7b3cSmrg		  *)
3932145b7b3cSmrg		    hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
3933145b7b3cSmrg		    ;;
3934145b7b3cSmrg		  esac
3935145b7b3cSmrg		fi
3936145b7b3cSmrg	      else
3937145b7b3cSmrg		eval flag=\"$hardcode_libdir_flag_spec\"
3938145b7b3cSmrg		dep_rpath="$dep_rpath $flag"
3939145b7b3cSmrg	      fi
3940145b7b3cSmrg	    elif test -n "$runpath_var"; then
3941145b7b3cSmrg	      case "$perm_rpath " in
3942145b7b3cSmrg	      *" $libdir "*) ;;
3943145b7b3cSmrg	      *) perm_rpath="$perm_rpath $libdir" ;;
3944145b7b3cSmrg	      esac
3945145b7b3cSmrg	    fi
3946145b7b3cSmrg	  done
3947145b7b3cSmrg	  # Substitute the hardcoded libdirs into the rpath.
3948145b7b3cSmrg	  if test -n "$hardcode_libdir_separator" &&
3949145b7b3cSmrg	     test -n "$hardcode_libdirs"; then
3950145b7b3cSmrg	    libdir="$hardcode_libdirs"
3951145b7b3cSmrg	    if test -n "$hardcode_libdir_flag_spec_ld"; then
3952578741aaSmrg	      case $archive_cmds in
3953578741aaSmrg	      *\$LD*) eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\" ;;
3954578741aaSmrg	      *)      eval dep_rpath=\"$hardcode_libdir_flag_spec\" ;;
3955578741aaSmrg	      esac
3956145b7b3cSmrg	    else
3957145b7b3cSmrg	      eval dep_rpath=\"$hardcode_libdir_flag_spec\"
3958145b7b3cSmrg	    fi
3959145b7b3cSmrg	  fi
3960145b7b3cSmrg	  if test -n "$runpath_var" && test -n "$perm_rpath"; then
3961145b7b3cSmrg	    # We should set the runpath_var.
3962145b7b3cSmrg	    rpath=
3963145b7b3cSmrg	    for dir in $perm_rpath; do
3964145b7b3cSmrg	      rpath="$rpath$dir:"
3965145b7b3cSmrg	    done
3966145b7b3cSmrg	    eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var"
3967145b7b3cSmrg	  fi
3968145b7b3cSmrg	  test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs"
3969145b7b3cSmrg	fi
3970145b7b3cSmrg
3971145b7b3cSmrg	shlibpath="$finalize_shlibpath"
3972145b7b3cSmrg	test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath"
3973145b7b3cSmrg	if test -n "$shlibpath"; then
3974145b7b3cSmrg	  eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var"
3975145b7b3cSmrg	fi
3976145b7b3cSmrg
3977145b7b3cSmrg	# Get the real and link names of the library.
3978145b7b3cSmrg	eval shared_ext=\"$shrext_cmds\"
3979145b7b3cSmrg	eval library_names=\"$library_names_spec\"
3980145b7b3cSmrg	set dummy $library_names
3981145b7b3cSmrg	realname="$2"
3982145b7b3cSmrg	shift; shift
3983145b7b3cSmrg
3984145b7b3cSmrg	if test -n "$soname_spec"; then
3985145b7b3cSmrg	  eval soname=\"$soname_spec\"
3986145b7b3cSmrg	else
3987145b7b3cSmrg	  soname="$realname"
3988145b7b3cSmrg	fi
3989145b7b3cSmrg	if test -z "$dlname"; then
3990145b7b3cSmrg	  dlname=$soname
3991145b7b3cSmrg	fi
3992145b7b3cSmrg
3993145b7b3cSmrg	lib="$output_objdir/$realname"
3994145b7b3cSmrg	linknames=
3995145b7b3cSmrg	for link
3996145b7b3cSmrg	do
3997145b7b3cSmrg	  linknames="$linknames $link"
3998145b7b3cSmrg	done
3999145b7b3cSmrg
4000145b7b3cSmrg	# Use standard objects if they are pic
4001145b7b3cSmrg	test -z "$pic_flag" && libobjs=`$echo "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
4002145b7b3cSmrg
4003145b7b3cSmrg	# Prepare the list of exported symbols
4004145b7b3cSmrg	if test -z "$export_symbols"; then
4005145b7b3cSmrg	  if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then
4006145b7b3cSmrg	    $show "generating symbol list for \`$libname.la'"
4007145b7b3cSmrg	    export_symbols="$output_objdir/$libname.exp"
4008145b7b3cSmrg	    $run $rm $export_symbols
4009145b7b3cSmrg	    cmds=$export_symbols_cmds
4010145b7b3cSmrg	    save_ifs="$IFS"; IFS='~'
4011145b7b3cSmrg	    for cmd in $cmds; do
4012145b7b3cSmrg	      IFS="$save_ifs"
4013145b7b3cSmrg	      eval cmd=\"$cmd\"
4014145b7b3cSmrg	      if len=`expr "X$cmd" : ".*"` &&
4015145b7b3cSmrg	       test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
4016145b7b3cSmrg	        $show "$cmd"
4017145b7b3cSmrg	        $run eval "$cmd" || exit $?
4018145b7b3cSmrg	        skipped_export=false
4019145b7b3cSmrg	      else
4020145b7b3cSmrg	        # The command line is too long to execute in one step.
4021145b7b3cSmrg	        $show "using reloadable object file for export list..."
4022145b7b3cSmrg	        skipped_export=:
4023145b7b3cSmrg		# Break out early, otherwise skipped_export may be
4024145b7b3cSmrg		# set to false by a later but shorter cmd.
4025145b7b3cSmrg		break
4026145b7b3cSmrg	      fi
4027145b7b3cSmrg	    done
4028145b7b3cSmrg	    IFS="$save_ifs"
4029145b7b3cSmrg	    if test -n "$export_symbols_regex"; then
4030145b7b3cSmrg	      $show "$EGREP -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\""
4031145b7b3cSmrg	      $run eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
4032145b7b3cSmrg	      $show "$mv \"${export_symbols}T\" \"$export_symbols\""
4033145b7b3cSmrg	      $run eval '$mv "${export_symbols}T" "$export_symbols"'
4034145b7b3cSmrg	    fi
4035145b7b3cSmrg	  fi
4036145b7b3cSmrg	fi
4037145b7b3cSmrg
4038145b7b3cSmrg	if test -n "$export_symbols" && test -n "$include_expsyms"; then
4039145b7b3cSmrg	  $run eval '$echo "X$include_expsyms" | $SP2NL >> "$export_symbols"'
4040145b7b3cSmrg	fi
4041145b7b3cSmrg
4042145b7b3cSmrg	tmp_deplibs=
4043145b7b3cSmrg	for test_deplib in $deplibs; do
4044145b7b3cSmrg		case " $convenience " in
4045145b7b3cSmrg		*" $test_deplib "*) ;;
4046145b7b3cSmrg		*)
4047145b7b3cSmrg			tmp_deplibs="$tmp_deplibs $test_deplib"
4048145b7b3cSmrg			;;
4049145b7b3cSmrg		esac
4050145b7b3cSmrg	done
4051145b7b3cSmrg	deplibs="$tmp_deplibs"
4052145b7b3cSmrg
4053145b7b3cSmrg	if test -n "$convenience"; then
4054145b7b3cSmrg	  if test -n "$whole_archive_flag_spec"; then
4055145b7b3cSmrg	    save_libobjs=$libobjs
4056145b7b3cSmrg	    eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
4057145b7b3cSmrg	  else
4058145b7b3cSmrg	    gentop="$output_objdir/${outputname}x"
4059145b7b3cSmrg	    generated="$generated $gentop"
4060145b7b3cSmrg
4061145b7b3cSmrg	    func_extract_archives $gentop $convenience
4062145b7b3cSmrg	    libobjs="$libobjs $func_extract_archives_result"
4063145b7b3cSmrg	  fi
4064145b7b3cSmrg	fi
4065145b7b3cSmrg	
4066145b7b3cSmrg	if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then
4067145b7b3cSmrg	  eval flag=\"$thread_safe_flag_spec\"
4068145b7b3cSmrg	  linker_flags="$linker_flags $flag"
4069145b7b3cSmrg	fi
4070145b7b3cSmrg
4071145b7b3cSmrg	# Make a backup of the uninstalled library when relinking
4072145b7b3cSmrg	if test "$mode" = relink; then
4073145b7b3cSmrg	  $run eval '(cd $output_objdir && $rm ${realname}U && $mv $realname ${realname}U)' || exit $?
4074145b7b3cSmrg	fi
4075145b7b3cSmrg
4076145b7b3cSmrg	# Do each of the archive commands.
4077145b7b3cSmrg	if test "$module" = yes && test -n "$module_cmds" ; then
4078145b7b3cSmrg	  if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
4079145b7b3cSmrg	    eval test_cmds=\"$module_expsym_cmds\"
4080145b7b3cSmrg	    cmds=$module_expsym_cmds
4081145b7b3cSmrg	  else
4082145b7b3cSmrg	    eval test_cmds=\"$module_cmds\"
4083145b7b3cSmrg	    cmds=$module_cmds
4084145b7b3cSmrg	  fi
4085145b7b3cSmrg	else
4086145b7b3cSmrg	if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
4087145b7b3cSmrg	  eval test_cmds=\"$archive_expsym_cmds\"
4088145b7b3cSmrg	  cmds=$archive_expsym_cmds
4089145b7b3cSmrg	else
4090145b7b3cSmrg	  eval test_cmds=\"$archive_cmds\"
4091145b7b3cSmrg	  cmds=$archive_cmds
4092145b7b3cSmrg	  fi
4093145b7b3cSmrg	fi
4094145b7b3cSmrg
4095145b7b3cSmrg	if test "X$skipped_export" != "X:" &&
4096145b7b3cSmrg	   len=`expr "X$test_cmds" : ".*" 2>/dev/null` &&
4097145b7b3cSmrg	   test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
4098145b7b3cSmrg	  :
4099145b7b3cSmrg	else
4100145b7b3cSmrg	  # The command line is too long to link in one step, link piecewise.
4101145b7b3cSmrg	  $echo "creating reloadable object files..."
4102145b7b3cSmrg
4103145b7b3cSmrg	  # Save the value of $output and $libobjs because we want to
4104145b7b3cSmrg	  # use them later.  If we have whole_archive_flag_spec, we
4105145b7b3cSmrg	  # want to use save_libobjs as it was before
4106145b7b3cSmrg	  # whole_archive_flag_spec was expanded, because we can't
4107145b7b3cSmrg	  # assume the linker understands whole_archive_flag_spec.
4108145b7b3cSmrg	  # This may have to be revisited, in case too many
4109145b7b3cSmrg	  # convenience libraries get linked in and end up exceeding
4110145b7b3cSmrg	  # the spec.
4111145b7b3cSmrg	  if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then
4112145b7b3cSmrg	    save_libobjs=$libobjs
4113145b7b3cSmrg	  fi
4114145b7b3cSmrg	  save_output=$output
4115145b7b3cSmrg	  output_la=`$echo "X$output" | $Xsed -e "$basename"`
4116145b7b3cSmrg
4117145b7b3cSmrg	  # Clear the reloadable object creation command queue and
4118145b7b3cSmrg	  # initialize k to one.
4119145b7b3cSmrg	  test_cmds=
4120145b7b3cSmrg	  concat_cmds=
4121145b7b3cSmrg	  objlist=
4122145b7b3cSmrg	  delfiles=
4123145b7b3cSmrg	  last_robj=
4124145b7b3cSmrg	  k=1
4125145b7b3cSmrg	  output=$output_objdir/$output_la-${k}.$objext
4126145b7b3cSmrg	  # Loop over the list of objects to be linked.
4127145b7b3cSmrg	  for obj in $save_libobjs
4128145b7b3cSmrg	  do
4129145b7b3cSmrg	    eval test_cmds=\"$reload_cmds $objlist $last_robj\"
4130145b7b3cSmrg	    if test "X$objlist" = X ||
4131145b7b3cSmrg	       { len=`expr "X$test_cmds" : ".*" 2>/dev/null` &&
4132145b7b3cSmrg		 test "$len" -le "$max_cmd_len"; }; then
4133145b7b3cSmrg	      objlist="$objlist $obj"
4134145b7b3cSmrg	    else
4135145b7b3cSmrg	      # The command $test_cmds is almost too long, add a
4136145b7b3cSmrg	      # command to the queue.
4137145b7b3cSmrg	      if test "$k" -eq 1 ; then
4138145b7b3cSmrg		# The first file doesn't have a previous command to add.
4139145b7b3cSmrg		eval concat_cmds=\"$reload_cmds $objlist $last_robj\"
4140145b7b3cSmrg	      else
4141145b7b3cSmrg		# All subsequent reloadable object files will link in
4142145b7b3cSmrg		# the last one created.
4143145b7b3cSmrg		eval concat_cmds=\"\$concat_cmds~$reload_cmds $objlist $last_robj\"
4144145b7b3cSmrg	      fi
4145145b7b3cSmrg	      last_robj=$output_objdir/$output_la-${k}.$objext
4146145b7b3cSmrg	      k=`expr $k + 1`
4147145b7b3cSmrg	      output=$output_objdir/$output_la-${k}.$objext
4148145b7b3cSmrg	      objlist=$obj
4149145b7b3cSmrg	      len=1
4150145b7b3cSmrg	    fi
4151145b7b3cSmrg	  done
4152145b7b3cSmrg	  # Handle the remaining objects by creating one last
4153145b7b3cSmrg	  # reloadable object file.  All subsequent reloadable object
4154145b7b3cSmrg	  # files will link in the last one created.
4155145b7b3cSmrg	  test -z "$concat_cmds" || concat_cmds=$concat_cmds~
4156145b7b3cSmrg	  eval concat_cmds=\"\${concat_cmds}$reload_cmds $objlist $last_robj\"
4157145b7b3cSmrg
4158145b7b3cSmrg	  if ${skipped_export-false}; then
4159145b7b3cSmrg	    $show "generating symbol list for \`$libname.la'"
4160145b7b3cSmrg	    export_symbols="$output_objdir/$libname.exp"
4161145b7b3cSmrg	    $run $rm $export_symbols
4162145b7b3cSmrg	    libobjs=$output
4163145b7b3cSmrg	    # Append the command to create the export file.
4164145b7b3cSmrg	    eval concat_cmds=\"\$concat_cmds~$export_symbols_cmds\"
4165145b7b3cSmrg          fi
4166145b7b3cSmrg
4167145b7b3cSmrg	  # Set up a command to remove the reloadable object files
4168145b7b3cSmrg	  # after they are used.
4169145b7b3cSmrg	  i=0
4170145b7b3cSmrg	  while test "$i" -lt "$k"
4171145b7b3cSmrg	  do
4172145b7b3cSmrg	    i=`expr $i + 1`
4173145b7b3cSmrg	    delfiles="$delfiles $output_objdir/$output_la-${i}.$objext"
4174145b7b3cSmrg	  done
4175145b7b3cSmrg
4176145b7b3cSmrg	  $echo "creating a temporary reloadable object file: $output"
4177145b7b3cSmrg
4178145b7b3cSmrg	  # Loop through the commands generated above and execute them.
4179145b7b3cSmrg	  save_ifs="$IFS"; IFS='~'
4180145b7b3cSmrg	  for cmd in $concat_cmds; do
4181145b7b3cSmrg	    IFS="$save_ifs"
4182145b7b3cSmrg	    $show "$cmd"
4183145b7b3cSmrg	    $run eval "$cmd" || exit $?
4184145b7b3cSmrg	  done
4185145b7b3cSmrg	  IFS="$save_ifs"
4186145b7b3cSmrg
4187145b7b3cSmrg	  libobjs=$output
4188145b7b3cSmrg	  # Restore the value of output.
4189145b7b3cSmrg	  output=$save_output
4190145b7b3cSmrg
4191145b7b3cSmrg	  if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then
4192145b7b3cSmrg	    eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
4193145b7b3cSmrg	  fi
4194145b7b3cSmrg	  # Expand the library linking commands again to reset the
4195145b7b3cSmrg	  # value of $libobjs for piecewise linking.
4196145b7b3cSmrg
4197145b7b3cSmrg	  # Do each of the archive commands.
4198145b7b3cSmrg	  if test "$module" = yes && test -n "$module_cmds" ; then
4199145b7b3cSmrg	    if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
4200145b7b3cSmrg	      cmds=$module_expsym_cmds
4201145b7b3cSmrg	    else
4202145b7b3cSmrg	      cmds=$module_cmds
4203145b7b3cSmrg	    fi
4204145b7b3cSmrg	  else
4205145b7b3cSmrg	  if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
4206145b7b3cSmrg	    cmds=$archive_expsym_cmds
4207145b7b3cSmrg	  else
4208145b7b3cSmrg	    cmds=$archive_cmds
4209145b7b3cSmrg	    fi
4210145b7b3cSmrg	  fi
4211145b7b3cSmrg
4212145b7b3cSmrg	  # Append the command to remove the reloadable object files
4213145b7b3cSmrg	  # to the just-reset $cmds.
4214145b7b3cSmrg	  eval cmds=\"\$cmds~\$rm $delfiles\"
4215145b7b3cSmrg	fi
4216145b7b3cSmrg	save_ifs="$IFS"; IFS='~'
4217145b7b3cSmrg	for cmd in $cmds; do
4218145b7b3cSmrg	  IFS="$save_ifs"
4219145b7b3cSmrg	  eval cmd=\"$cmd\"
4220145b7b3cSmrg	  $show "$cmd"
4221145b7b3cSmrg	  $run eval "$cmd" || {
4222145b7b3cSmrg	    lt_exit=$?
4223145b7b3cSmrg
4224145b7b3cSmrg	    # Restore the uninstalled library and exit
4225145b7b3cSmrg	    if test "$mode" = relink; then
4226145b7b3cSmrg	      $run eval '(cd $output_objdir && $rm ${realname}T && $mv ${realname}U $realname)'
4227145b7b3cSmrg	    fi
4228145b7b3cSmrg
4229145b7b3cSmrg	    exit $lt_exit
4230145b7b3cSmrg	  }
4231145b7b3cSmrg	done
4232145b7b3cSmrg	IFS="$save_ifs"
4233145b7b3cSmrg
4234145b7b3cSmrg	# Restore the uninstalled library and exit
4235145b7b3cSmrg	if test "$mode" = relink; then
4236145b7b3cSmrg	  $run eval '(cd $output_objdir && $rm ${realname}T && $mv $realname ${realname}T && $mv "$realname"U $realname)' || exit $?
4237145b7b3cSmrg
4238145b7b3cSmrg	  if test -n "$convenience"; then
4239145b7b3cSmrg	    if test -z "$whole_archive_flag_spec"; then
4240145b7b3cSmrg	      $show "${rm}r $gentop"
4241145b7b3cSmrg	      $run ${rm}r "$gentop"
4242145b7b3cSmrg	    fi
4243145b7b3cSmrg	  fi
4244145b7b3cSmrg
4245145b7b3cSmrg	  exit $EXIT_SUCCESS
4246145b7b3cSmrg	fi
4247145b7b3cSmrg
4248145b7b3cSmrg	# Create links to the real library.
4249145b7b3cSmrg	for linkname in $linknames; do
4250145b7b3cSmrg	  if test "$realname" != "$linkname"; then
4251145b7b3cSmrg	    $show "(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)"
4252145b7b3cSmrg	    $run eval '(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)' || exit $?
4253145b7b3cSmrg	  fi
4254145b7b3cSmrg	done
4255145b7b3cSmrg
4256145b7b3cSmrg	# If -module or -export-dynamic was specified, set the dlname.
4257145b7b3cSmrg	if test "$module" = yes || test "$export_dynamic" = yes; then
4258145b7b3cSmrg	  # On all known operating systems, these are identical.
4259145b7b3cSmrg	  dlname="$soname"
4260145b7b3cSmrg	fi
4261145b7b3cSmrg      fi
4262145b7b3cSmrg      ;;
4263145b7b3cSmrg
4264145b7b3cSmrg    obj)
4265578741aaSmrg      case " $deplibs" in
4266578741aaSmrg      *\ -l* | *\ -L*)
4267578741aaSmrg	$echo "$modename: warning: \`-l' and \`-L' are ignored for objects" 1>&2 ;;
4268578741aaSmrg      esac
4269145b7b3cSmrg
4270145b7b3cSmrg      if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
4271145b7b3cSmrg	$echo "$modename: warning: \`-dlopen' is ignored for objects" 1>&2
4272145b7b3cSmrg      fi
4273145b7b3cSmrg
4274145b7b3cSmrg      if test -n "$rpath"; then
4275145b7b3cSmrg	$echo "$modename: warning: \`-rpath' is ignored for objects" 1>&2
4276145b7b3cSmrg      fi
4277145b7b3cSmrg
4278145b7b3cSmrg      if test -n "$xrpath"; then
4279145b7b3cSmrg	$echo "$modename: warning: \`-R' is ignored for objects" 1>&2
4280145b7b3cSmrg      fi
4281145b7b3cSmrg
4282145b7b3cSmrg      if test -n "$vinfo"; then
4283145b7b3cSmrg	$echo "$modename: warning: \`-version-info' is ignored for objects" 1>&2
4284145b7b3cSmrg      fi
4285145b7b3cSmrg
4286145b7b3cSmrg      if test -n "$release"; then
4287145b7b3cSmrg	$echo "$modename: warning: \`-release' is ignored for objects" 1>&2
4288145b7b3cSmrg      fi
4289145b7b3cSmrg
4290145b7b3cSmrg      case $output in
4291145b7b3cSmrg      *.lo)
4292145b7b3cSmrg	if test -n "$objs$old_deplibs"; then
4293145b7b3cSmrg	  $echo "$modename: cannot build library object \`$output' from non-libtool objects" 1>&2
4294145b7b3cSmrg	  exit $EXIT_FAILURE
4295145b7b3cSmrg	fi
4296145b7b3cSmrg	libobj="$output"
4297145b7b3cSmrg	obj=`$echo "X$output" | $Xsed -e "$lo2o"`
4298145b7b3cSmrg	;;
4299145b7b3cSmrg      *)
4300145b7b3cSmrg	libobj=
4301145b7b3cSmrg	obj="$output"
4302145b7b3cSmrg	;;
4303145b7b3cSmrg      esac
4304145b7b3cSmrg
4305145b7b3cSmrg      # Delete the old objects.
4306145b7b3cSmrg      $run $rm $obj $libobj
4307145b7b3cSmrg
4308145b7b3cSmrg      # Objects from convenience libraries.  This assumes
4309145b7b3cSmrg      # single-version convenience libraries.  Whenever we create
4310145b7b3cSmrg      # different ones for PIC/non-PIC, this we'll have to duplicate
4311145b7b3cSmrg      # the extraction.
4312145b7b3cSmrg      reload_conv_objs=
4313145b7b3cSmrg      gentop=
4314145b7b3cSmrg      # reload_cmds runs $LD directly, so let us get rid of
4315578741aaSmrg      # -Wl from whole_archive_flag_spec and hope we can get by with
4316578741aaSmrg      # turning comma into space..
4317145b7b3cSmrg      wl=
4318145b7b3cSmrg
4319145b7b3cSmrg      if test -n "$convenience"; then
4320145b7b3cSmrg	if test -n "$whole_archive_flag_spec"; then
4321578741aaSmrg	  eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\"
4322578741aaSmrg	  reload_conv_objs=$reload_objs\ `$echo "X$tmp_whole_archive_flags" | $Xsed -e 's|,| |g'`
4323145b7b3cSmrg	else
4324145b7b3cSmrg	  gentop="$output_objdir/${obj}x"
4325145b7b3cSmrg	  generated="$generated $gentop"
4326145b7b3cSmrg
4327145b7b3cSmrg	  func_extract_archives $gentop $convenience
4328145b7b3cSmrg	  reload_conv_objs="$reload_objs $func_extract_archives_result"
4329145b7b3cSmrg	fi
4330145b7b3cSmrg      fi
4331145b7b3cSmrg
4332145b7b3cSmrg      # Create the old-style object.
4333145b7b3cSmrg      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
4334145b7b3cSmrg
4335145b7b3cSmrg      output="$obj"
4336145b7b3cSmrg      cmds=$reload_cmds
4337145b7b3cSmrg      save_ifs="$IFS"; IFS='~'
4338145b7b3cSmrg      for cmd in $cmds; do
4339145b7b3cSmrg	IFS="$save_ifs"
4340145b7b3cSmrg	eval cmd=\"$cmd\"
4341145b7b3cSmrg	$show "$cmd"
4342145b7b3cSmrg	$run eval "$cmd" || exit $?
4343145b7b3cSmrg      done
4344145b7b3cSmrg      IFS="$save_ifs"
4345145b7b3cSmrg
4346145b7b3cSmrg      # Exit if we aren't doing a library object file.
4347145b7b3cSmrg      if test -z "$libobj"; then
4348145b7b3cSmrg	if test -n "$gentop"; then
4349145b7b3cSmrg	  $show "${rm}r $gentop"
4350145b7b3cSmrg	  $run ${rm}r $gentop
4351145b7b3cSmrg	fi
4352145b7b3cSmrg
4353145b7b3cSmrg	exit $EXIT_SUCCESS
4354145b7b3cSmrg      fi
4355145b7b3cSmrg
4356145b7b3cSmrg      if test "$build_libtool_libs" != yes; then
4357145b7b3cSmrg	if test -n "$gentop"; then
4358145b7b3cSmrg	  $show "${rm}r $gentop"
4359145b7b3cSmrg	  $run ${rm}r $gentop
4360145b7b3cSmrg	fi
4361145b7b3cSmrg
4362145b7b3cSmrg	# Create an invalid libtool object if no PIC, so that we don't
4363145b7b3cSmrg	# accidentally link it into a program.
4364145b7b3cSmrg	# $show "echo timestamp > $libobj"
4365145b7b3cSmrg	# $run eval "echo timestamp > $libobj" || exit $?
4366145b7b3cSmrg	exit $EXIT_SUCCESS
4367145b7b3cSmrg      fi
4368145b7b3cSmrg
4369145b7b3cSmrg      if test -n "$pic_flag" || test "$pic_mode" != default; then
4370145b7b3cSmrg	# Only do commands if we really have different PIC objects.
4371145b7b3cSmrg	reload_objs="$libobjs $reload_conv_objs"
4372145b7b3cSmrg	output="$libobj"
4373145b7b3cSmrg	cmds=$reload_cmds
4374145b7b3cSmrg	save_ifs="$IFS"; IFS='~'
4375145b7b3cSmrg	for cmd in $cmds; do
4376145b7b3cSmrg	  IFS="$save_ifs"
4377145b7b3cSmrg	  eval cmd=\"$cmd\"
4378145b7b3cSmrg	  $show "$cmd"
4379145b7b3cSmrg	  $run eval "$cmd" || exit $?
4380145b7b3cSmrg	done
4381145b7b3cSmrg	IFS="$save_ifs"
4382145b7b3cSmrg      fi
4383145b7b3cSmrg
4384145b7b3cSmrg      if test -n "$gentop"; then
4385145b7b3cSmrg	$show "${rm}r $gentop"
4386145b7b3cSmrg	$run ${rm}r $gentop
4387145b7b3cSmrg      fi
4388145b7b3cSmrg
4389145b7b3cSmrg      exit $EXIT_SUCCESS
4390145b7b3cSmrg      ;;
4391145b7b3cSmrg
4392145b7b3cSmrg    prog)
4393145b7b3cSmrg      case $host in
4394145b7b3cSmrg	*cygwin*) output=`$echo $output | ${SED} -e 's,.exe$,,;s,$,.exe,'` ;;
4395145b7b3cSmrg      esac
4396145b7b3cSmrg      if test -n "$vinfo"; then
4397145b7b3cSmrg	$echo "$modename: warning: \`-version-info' is ignored for programs" 1>&2
4398145b7b3cSmrg      fi
4399145b7b3cSmrg
4400145b7b3cSmrg      if test -n "$release"; then
4401145b7b3cSmrg	$echo "$modename: warning: \`-release' is ignored for programs" 1>&2
4402145b7b3cSmrg      fi
4403145b7b3cSmrg
4404145b7b3cSmrg      if test "$preload" = yes; then
4405145b7b3cSmrg	if test "$dlopen_support" = unknown && test "$dlopen_self" = unknown &&
4406145b7b3cSmrg	   test "$dlopen_self_static" = unknown; then
4407145b7b3cSmrg	  $echo "$modename: warning: \`AC_LIBTOOL_DLOPEN' not used. Assuming no dlopen support."
4408145b7b3cSmrg	fi
4409145b7b3cSmrg      fi
4410145b7b3cSmrg
4411145b7b3cSmrg      case $host in
4412145b7b3cSmrg      *-*-rhapsody* | *-*-darwin1.[012])
4413145b7b3cSmrg	# On Rhapsody replace the C library is the System framework
4414145b7b3cSmrg	compile_deplibs=`$echo "X $compile_deplibs" | $Xsed -e 's/ -lc / -framework System /'`
4415145b7b3cSmrg	finalize_deplibs=`$echo "X $finalize_deplibs" | $Xsed -e 's/ -lc / -framework System /'`
4416145b7b3cSmrg	;;
4417145b7b3cSmrg      esac
4418145b7b3cSmrg
4419145b7b3cSmrg      case $host in
4420145b7b3cSmrg      *darwin*)
4421145b7b3cSmrg        # Don't allow lazy linking, it breaks C++ global constructors
4422145b7b3cSmrg        if test "$tagname" = CXX ; then
4423145b7b3cSmrg        compile_command="$compile_command ${wl}-bind_at_load"
4424145b7b3cSmrg        finalize_command="$finalize_command ${wl}-bind_at_load"
4425145b7b3cSmrg        fi
4426145b7b3cSmrg        ;;
4427145b7b3cSmrg      esac
4428145b7b3cSmrg
4429145b7b3cSmrg
4430145b7b3cSmrg      # move library search paths that coincide with paths to not yet
4431145b7b3cSmrg      # installed libraries to the beginning of the library search list
4432145b7b3cSmrg      new_libs=
4433145b7b3cSmrg      for path in $notinst_path; do
4434145b7b3cSmrg	case " $new_libs " in
4435145b7b3cSmrg	*" -L$path/$objdir "*) ;;
4436145b7b3cSmrg	*)
4437145b7b3cSmrg	  case " $compile_deplibs " in
4438145b7b3cSmrg	  *" -L$path/$objdir "*)
4439145b7b3cSmrg	    new_libs="$new_libs -L$path/$objdir" ;;
4440145b7b3cSmrg	  esac
4441145b7b3cSmrg	  ;;
4442145b7b3cSmrg	esac
4443145b7b3cSmrg      done
4444145b7b3cSmrg      for deplib in $compile_deplibs; do
4445145b7b3cSmrg	case $deplib in
4446145b7b3cSmrg	-L*)
4447145b7b3cSmrg	  case " $new_libs " in
4448145b7b3cSmrg	  *" $deplib "*) ;;
4449145b7b3cSmrg	  *) new_libs="$new_libs $deplib" ;;
4450145b7b3cSmrg	  esac
4451145b7b3cSmrg	  ;;
4452145b7b3cSmrg	*) new_libs="$new_libs $deplib" ;;
4453145b7b3cSmrg	esac
4454145b7b3cSmrg      done
4455145b7b3cSmrg      compile_deplibs="$new_libs"
4456145b7b3cSmrg
4457145b7b3cSmrg
4458145b7b3cSmrg      compile_command="$compile_command $compile_deplibs"
4459145b7b3cSmrg      finalize_command="$finalize_command $finalize_deplibs"
4460145b7b3cSmrg
4461145b7b3cSmrg      if test -n "$rpath$xrpath"; then
4462145b7b3cSmrg	# If the user specified any rpath flags, then add them.
4463145b7b3cSmrg	for libdir in $rpath $xrpath; do
4464145b7b3cSmrg	  # This is the magic to use -rpath.
4465145b7b3cSmrg	  case "$finalize_rpath " in
4466145b7b3cSmrg	  *" $libdir "*) ;;
4467145b7b3cSmrg	  *) finalize_rpath="$finalize_rpath $libdir" ;;
4468145b7b3cSmrg	  esac
4469145b7b3cSmrg	done
4470145b7b3cSmrg      fi
4471145b7b3cSmrg
4472145b7b3cSmrg      # Now hardcode the library paths
4473145b7b3cSmrg      rpath=
4474145b7b3cSmrg      hardcode_libdirs=
4475145b7b3cSmrg      for libdir in $compile_rpath $finalize_rpath; do
4476145b7b3cSmrg	if test -n "$hardcode_libdir_flag_spec"; then
4477145b7b3cSmrg	  if test -n "$hardcode_libdir_separator"; then
4478145b7b3cSmrg	    if test -z "$hardcode_libdirs"; then
4479145b7b3cSmrg	      hardcode_libdirs="$libdir"
4480145b7b3cSmrg	    else
4481145b7b3cSmrg	      # Just accumulate the unique libdirs.
4482145b7b3cSmrg	      case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
4483145b7b3cSmrg	      *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
4484145b7b3cSmrg		;;
4485145b7b3cSmrg	      *)
4486145b7b3cSmrg		hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
4487145b7b3cSmrg		;;
4488145b7b3cSmrg	      esac
4489145b7b3cSmrg	    fi
4490145b7b3cSmrg	  else
4491145b7b3cSmrg	    eval flag=\"$hardcode_libdir_flag_spec\"
4492145b7b3cSmrg	    rpath="$rpath $flag"
4493145b7b3cSmrg	  fi
4494145b7b3cSmrg	elif test -n "$runpath_var"; then
4495145b7b3cSmrg	  case "$perm_rpath " in
4496145b7b3cSmrg	  *" $libdir "*) ;;
4497145b7b3cSmrg	  *) perm_rpath="$perm_rpath $libdir" ;;
4498145b7b3cSmrg	  esac
4499145b7b3cSmrg	fi
4500145b7b3cSmrg	case $host in
4501145b7b3cSmrg	*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
4502145b7b3cSmrg	  testbindir=`$echo "X$libdir" | $Xsed -e 's*/lib$*/bin*'`
4503145b7b3cSmrg	  case :$dllsearchpath: in
4504145b7b3cSmrg	  *":$libdir:"*) ;;
4505145b7b3cSmrg	  *) dllsearchpath="$dllsearchpath:$libdir";;
4506145b7b3cSmrg	  esac
4507145b7b3cSmrg	  case :$dllsearchpath: in
4508145b7b3cSmrg	  *":$testbindir:"*) ;;
4509145b7b3cSmrg	  *) dllsearchpath="$dllsearchpath:$testbindir";;
4510145b7b3cSmrg	  esac
4511145b7b3cSmrg	  ;;
4512145b7b3cSmrg	esac
4513145b7b3cSmrg      done
4514145b7b3cSmrg      # Substitute the hardcoded libdirs into the rpath.
4515145b7b3cSmrg      if test -n "$hardcode_libdir_separator" &&
4516145b7b3cSmrg	 test -n "$hardcode_libdirs"; then
4517145b7b3cSmrg	libdir="$hardcode_libdirs"
4518145b7b3cSmrg	eval rpath=\" $hardcode_libdir_flag_spec\"
4519145b7b3cSmrg      fi
4520145b7b3cSmrg      compile_rpath="$rpath"
4521145b7b3cSmrg
4522145b7b3cSmrg      rpath=
4523145b7b3cSmrg      hardcode_libdirs=
4524145b7b3cSmrg      for libdir in $finalize_rpath; do
4525145b7b3cSmrg	if test -n "$hardcode_libdir_flag_spec"; then
4526145b7b3cSmrg	  if test -n "$hardcode_libdir_separator"; then
4527145b7b3cSmrg	    if test -z "$hardcode_libdirs"; then
4528145b7b3cSmrg	      hardcode_libdirs="$libdir"
4529145b7b3cSmrg	    else
4530145b7b3cSmrg	      # Just accumulate the unique libdirs.
4531145b7b3cSmrg	      case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
4532145b7b3cSmrg	      *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
4533145b7b3cSmrg		;;
4534145b7b3cSmrg	      *)
4535145b7b3cSmrg		hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
4536145b7b3cSmrg		;;
4537145b7b3cSmrg	      esac
4538145b7b3cSmrg	    fi
4539145b7b3cSmrg	  else
4540145b7b3cSmrg	    eval flag=\"$hardcode_libdir_flag_spec\"
4541145b7b3cSmrg	    rpath="$rpath $flag"
4542145b7b3cSmrg	  fi
4543145b7b3cSmrg	elif test -n "$runpath_var"; then
4544145b7b3cSmrg	  case "$finalize_perm_rpath " in
4545145b7b3cSmrg	  *" $libdir "*) ;;
4546145b7b3cSmrg	  *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;;
4547145b7b3cSmrg	  esac
4548145b7b3cSmrg	fi
4549145b7b3cSmrg      done
4550145b7b3cSmrg      # Substitute the hardcoded libdirs into the rpath.
4551145b7b3cSmrg      if test -n "$hardcode_libdir_separator" &&
4552145b7b3cSmrg	 test -n "$hardcode_libdirs"; then
4553145b7b3cSmrg	libdir="$hardcode_libdirs"
4554145b7b3cSmrg	eval rpath=\" $hardcode_libdir_flag_spec\"
4555145b7b3cSmrg      fi
4556145b7b3cSmrg      finalize_rpath="$rpath"
4557145b7b3cSmrg
4558145b7b3cSmrg      if test -n "$libobjs" && test "$build_old_libs" = yes; then
4559145b7b3cSmrg	# Transform all the library objects into standard objects.
4560145b7b3cSmrg	compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
4561145b7b3cSmrg	finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
4562145b7b3cSmrg      fi
4563145b7b3cSmrg
4564145b7b3cSmrg      dlsyms=
4565145b7b3cSmrg      if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
4566145b7b3cSmrg	if test -n "$NM" && test -n "$global_symbol_pipe"; then
4567145b7b3cSmrg	  dlsyms="${outputname}S.c"
4568145b7b3cSmrg	else
4569145b7b3cSmrg	  $echo "$modename: not configured to extract global symbols from dlpreopened files" 1>&2
4570145b7b3cSmrg	fi
4571145b7b3cSmrg      fi
4572145b7b3cSmrg
4573145b7b3cSmrg      if test -n "$dlsyms"; then
4574145b7b3cSmrg	case $dlsyms in
4575145b7b3cSmrg	"") ;;
4576145b7b3cSmrg	*.c)
4577145b7b3cSmrg	  # Discover the nlist of each of the dlfiles.
4578145b7b3cSmrg	  nlist="$output_objdir/${outputname}.nm"
4579145b7b3cSmrg
4580145b7b3cSmrg	  $show "$rm $nlist ${nlist}S ${nlist}T"
4581145b7b3cSmrg	  $run $rm "$nlist" "${nlist}S" "${nlist}T"
4582145b7b3cSmrg
4583145b7b3cSmrg	  # Parse the name list into a source file.
4584145b7b3cSmrg	  $show "creating $output_objdir/$dlsyms"
4585145b7b3cSmrg
4586145b7b3cSmrg	  test -z "$run" && $echo > "$output_objdir/$dlsyms" "\
4587145b7b3cSmrg/* $dlsyms - symbol resolution table for \`$outputname' dlsym emulation. */
4588145b7b3cSmrg/* Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP */
4589145b7b3cSmrg
4590145b7b3cSmrg#ifdef __cplusplus
4591145b7b3cSmrgextern \"C\" {
4592145b7b3cSmrg#endif
4593145b7b3cSmrg
4594145b7b3cSmrg/* Prevent the only kind of declaration conflicts we can make. */
4595145b7b3cSmrg#define lt_preloaded_symbols some_other_symbol
4596145b7b3cSmrg
4597145b7b3cSmrg/* External symbol declarations for the compiler. */\
4598145b7b3cSmrg"
4599145b7b3cSmrg
4600145b7b3cSmrg	  if test "$dlself" = yes; then
4601145b7b3cSmrg	    $show "generating symbol list for \`$output'"
4602145b7b3cSmrg
4603145b7b3cSmrg	    test -z "$run" && $echo ': @PROGRAM@ ' > "$nlist"
4604145b7b3cSmrg
4605145b7b3cSmrg	    # Add our own program objects to the symbol list.
4606145b7b3cSmrg	    progfiles=`$echo "X$objs$old_deplibs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
4607145b7b3cSmrg	    for arg in $progfiles; do
4608145b7b3cSmrg	      $show "extracting global C symbols from \`$arg'"
4609145b7b3cSmrg	      $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
4610145b7b3cSmrg	    done
4611145b7b3cSmrg
4612145b7b3cSmrg	    if test -n "$exclude_expsyms"; then
4613145b7b3cSmrg	      $run eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
4614145b7b3cSmrg	      $run eval '$mv "$nlist"T "$nlist"'
4615145b7b3cSmrg	    fi
4616145b7b3cSmrg
4617145b7b3cSmrg	    if test -n "$export_symbols_regex"; then
4618145b7b3cSmrg	      $run eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T'
4619145b7b3cSmrg	      $run eval '$mv "$nlist"T "$nlist"'
4620145b7b3cSmrg	    fi
4621145b7b3cSmrg
4622145b7b3cSmrg	    # Prepare the list of exported symbols
4623145b7b3cSmrg	    if test -z "$export_symbols"; then
4624145b7b3cSmrg	      export_symbols="$output_objdir/$outputname.exp"
4625145b7b3cSmrg	      $run $rm $export_symbols
4626145b7b3cSmrg	      $run eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
4627145b7b3cSmrg              case $host in
4628145b7b3cSmrg              *cygwin* | *mingw* )
4629145b7b3cSmrg	        $run eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
4630145b7b3cSmrg		$run eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"'
4631145b7b3cSmrg                ;;
4632145b7b3cSmrg              esac
4633145b7b3cSmrg	    else
4634145b7b3cSmrg	      $run eval "${SED} -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"'
4635145b7b3cSmrg	      $run eval 'grep -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T'
4636145b7b3cSmrg	      $run eval 'mv "$nlist"T "$nlist"'
4637145b7b3cSmrg              case $host in
4638145b7b3cSmrg              *cygwin* | *mingw* )
4639145b7b3cSmrg	        $run eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
4640145b7b3cSmrg		$run eval 'cat "$nlist" >> "$output_objdir/$outputname.def"'
4641145b7b3cSmrg                ;;
4642145b7b3cSmrg              esac
4643145b7b3cSmrg	    fi
4644145b7b3cSmrg	  fi
4645145b7b3cSmrg
4646145b7b3cSmrg	  for arg in $dlprefiles; do
4647145b7b3cSmrg	    $show "extracting global C symbols from \`$arg'"
4648145b7b3cSmrg	    name=`$echo "$arg" | ${SED} -e 's%^.*/%%'`
4649145b7b3cSmrg	    $run eval '$echo ": $name " >> "$nlist"'
4650145b7b3cSmrg	    $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
4651145b7b3cSmrg	  done
4652145b7b3cSmrg
4653145b7b3cSmrg	  if test -z "$run"; then
4654145b7b3cSmrg	    # Make sure we have at least an empty file.
4655145b7b3cSmrg	    test -f "$nlist" || : > "$nlist"
4656145b7b3cSmrg
4657145b7b3cSmrg	    if test -n "$exclude_expsyms"; then
4658145b7b3cSmrg	      $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T
4659145b7b3cSmrg	      $mv "$nlist"T "$nlist"
4660145b7b3cSmrg	    fi
4661145b7b3cSmrg
4662145b7b3cSmrg	    # Try sorting and uniquifying the output.
4663145b7b3cSmrg	    if grep -v "^: " < "$nlist" |
4664145b7b3cSmrg		if sort -k 3 </dev/null >/dev/null 2>&1; then
4665145b7b3cSmrg		  sort -k 3
4666145b7b3cSmrg		else
4667145b7b3cSmrg		  sort +2
4668145b7b3cSmrg		fi |
4669145b7b3cSmrg		uniq > "$nlist"S; then
4670145b7b3cSmrg	      :
4671145b7b3cSmrg	    else
4672145b7b3cSmrg	      grep -v "^: " < "$nlist" > "$nlist"S
4673145b7b3cSmrg	    fi
4674145b7b3cSmrg
4675145b7b3cSmrg	    if test -f "$nlist"S; then
4676145b7b3cSmrg	      eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$dlsyms"'
4677145b7b3cSmrg	    else
4678145b7b3cSmrg	      $echo '/* NONE */' >> "$output_objdir/$dlsyms"
4679145b7b3cSmrg	    fi
4680145b7b3cSmrg
4681145b7b3cSmrg	    $echo >> "$output_objdir/$dlsyms" "\
4682145b7b3cSmrg
4683145b7b3cSmrg#undef lt_preloaded_symbols
4684145b7b3cSmrg
4685145b7b3cSmrg#if defined (__STDC__) && __STDC__
4686145b7b3cSmrg# define lt_ptr void *
4687145b7b3cSmrg#else
4688145b7b3cSmrg# define lt_ptr char *
4689145b7b3cSmrg# define const
4690145b7b3cSmrg#endif
4691145b7b3cSmrg
4692145b7b3cSmrg/* The mapping between symbol names and symbols. */
4693145b7b3cSmrg"
4694145b7b3cSmrg
4695145b7b3cSmrg	    case $host in
4696145b7b3cSmrg	    *cygwin* | *mingw* )
4697145b7b3cSmrg	  $echo >> "$output_objdir/$dlsyms" "\
4698145b7b3cSmrg/* DATA imports from DLLs on WIN32 can't be const, because
4699145b7b3cSmrg   runtime relocations are performed -- see ld's documentation
4700145b7b3cSmrg   on pseudo-relocs */
4701145b7b3cSmrgstruct {
4702145b7b3cSmrg"
4703145b7b3cSmrg	      ;;
4704145b7b3cSmrg	    * )
4705145b7b3cSmrg	  $echo >> "$output_objdir/$dlsyms" "\
4706145b7b3cSmrgconst struct {
4707145b7b3cSmrg"
4708145b7b3cSmrg	      ;;
4709145b7b3cSmrg	    esac
4710145b7b3cSmrg
4711145b7b3cSmrg
4712145b7b3cSmrg	  $echo >> "$output_objdir/$dlsyms" "\
4713145b7b3cSmrg  const char *name;
4714145b7b3cSmrg  lt_ptr address;
4715145b7b3cSmrg}
4716145b7b3cSmrglt_preloaded_symbols[] =
4717145b7b3cSmrg{\
4718145b7b3cSmrg"
4719145b7b3cSmrg
4720145b7b3cSmrg	    eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$dlsyms"
4721145b7b3cSmrg
4722145b7b3cSmrg	    $echo >> "$output_objdir/$dlsyms" "\
4723145b7b3cSmrg  {0, (lt_ptr) 0}
4724145b7b3cSmrg};
4725145b7b3cSmrg
4726145b7b3cSmrg/* This works around a problem in FreeBSD linker */
4727145b7b3cSmrg#ifdef FREEBSD_WORKAROUND
4728145b7b3cSmrgstatic const void *lt_preloaded_setup() {
4729145b7b3cSmrg  return lt_preloaded_symbols;
4730145b7b3cSmrg}
4731145b7b3cSmrg#endif
4732145b7b3cSmrg
4733145b7b3cSmrg#ifdef __cplusplus
4734145b7b3cSmrg}
4735145b7b3cSmrg#endif\
4736145b7b3cSmrg"
4737145b7b3cSmrg	  fi
4738145b7b3cSmrg
4739145b7b3cSmrg	  pic_flag_for_symtable=
4740145b7b3cSmrg	  case $host in
4741145b7b3cSmrg	  # compiling the symbol table file with pic_flag works around
4742145b7b3cSmrg	  # a FreeBSD bug that causes programs to crash when -lm is
4743145b7b3cSmrg	  # linked before any other PIC object.  But we must not use
4744145b7b3cSmrg	  # pic_flag when linking with -static.  The problem exists in
4745145b7b3cSmrg	  # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1.
4746145b7b3cSmrg	  *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)
4747145b7b3cSmrg	    case "$compile_command " in
4748145b7b3cSmrg	    *" -static "*) ;;
4749145b7b3cSmrg	    *) pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND";;
4750145b7b3cSmrg	    esac;;
4751145b7b3cSmrg	  *-*-hpux*)
4752145b7b3cSmrg	    case "$compile_command " in
4753145b7b3cSmrg	    *" -static "*) ;;
4754145b7b3cSmrg	    *) pic_flag_for_symtable=" $pic_flag";;
4755145b7b3cSmrg	    esac
4756145b7b3cSmrg	  esac
4757145b7b3cSmrg
4758145b7b3cSmrg	  # Now compile the dynamic symbol file.
4759145b7b3cSmrg	  $show "(cd $output_objdir && $LTCC  $LTCFLAGS -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")"
4760145b7b3cSmrg	  $run eval '(cd $output_objdir && $LTCC  $LTCFLAGS -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $?
4761145b7b3cSmrg
4762145b7b3cSmrg	  # Clean up the generated files.
4763145b7b3cSmrg	  $show "$rm $output_objdir/$dlsyms $nlist ${nlist}S ${nlist}T"
4764145b7b3cSmrg	  $run $rm "$output_objdir/$dlsyms" "$nlist" "${nlist}S" "${nlist}T"
4765145b7b3cSmrg
4766145b7b3cSmrg	  # Transform the symbol file into the correct name.
4767145b7b3cSmrg          case $host in
4768145b7b3cSmrg          *cygwin* | *mingw* )
4769145b7b3cSmrg            if test -f "$output_objdir/${outputname}.def" ; then
4770578741aaSmrg              compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}.def $output_objdir/${outputname}S.${objext}%" | $NL2SP`
4771578741aaSmrg              finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}.def $output_objdir/${outputname}S.${objext}%" | $NL2SP`
4772145b7b3cSmrg            else
4773578741aaSmrg              compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%" | $NL2SP`
4774578741aaSmrg              finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%" | $NL2SP`
4775145b7b3cSmrg             fi
4776145b7b3cSmrg            ;;
4777145b7b3cSmrg          * )
4778578741aaSmrg            compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%" | $NL2SP`
4779578741aaSmrg            finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%" | $NL2SP`
4780145b7b3cSmrg            ;;
4781145b7b3cSmrg          esac
4782145b7b3cSmrg	  ;;
4783145b7b3cSmrg	*)
4784145b7b3cSmrg	  $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2
4785145b7b3cSmrg	  exit $EXIT_FAILURE
4786145b7b3cSmrg	  ;;
4787145b7b3cSmrg	esac
4788145b7b3cSmrg      else
4789145b7b3cSmrg	# We keep going just in case the user didn't refer to
4790145b7b3cSmrg	# lt_preloaded_symbols.  The linker will fail if global_symbol_pipe
4791145b7b3cSmrg	# really was required.
4792145b7b3cSmrg
4793145b7b3cSmrg	# Nullify the symbol file.
4794578741aaSmrg	compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "s% @SYMFILE@%%" | $NL2SP`
4795578741aaSmrg	finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "s% @SYMFILE@%%" | $NL2SP`
4796145b7b3cSmrg      fi
4797145b7b3cSmrg
4798145b7b3cSmrg      if test "$need_relink" = no || test "$build_libtool_libs" != yes; then
4799145b7b3cSmrg	# Replace the output file specification.
4800578741aaSmrg	compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e 's%@OUTPUT@%'"$output"'%g' | $NL2SP`
4801145b7b3cSmrg	link_command="$compile_command$compile_rpath"
4802145b7b3cSmrg
4803145b7b3cSmrg	# We have no uninstalled library dependencies, so finalize right now.
4804145b7b3cSmrg	$show "$link_command"
4805145b7b3cSmrg	$run eval "$link_command"
4806145b7b3cSmrg	exit_status=$?
4807145b7b3cSmrg
4808145b7b3cSmrg	# Delete the generated files.
4809145b7b3cSmrg	if test -n "$dlsyms"; then
4810145b7b3cSmrg	  $show "$rm $output_objdir/${outputname}S.${objext}"
4811145b7b3cSmrg	  $run $rm "$output_objdir/${outputname}S.${objext}"
4812145b7b3cSmrg	fi
4813145b7b3cSmrg
4814145b7b3cSmrg	exit $exit_status
4815145b7b3cSmrg      fi
4816145b7b3cSmrg
4817145b7b3cSmrg      if test -n "$shlibpath_var"; then
4818145b7b3cSmrg	# We should set the shlibpath_var
4819145b7b3cSmrg	rpath=
4820145b7b3cSmrg	for dir in $temp_rpath; do
4821145b7b3cSmrg	  case $dir in
4822145b7b3cSmrg	  [\\/]* | [A-Za-z]:[\\/]*)
4823145b7b3cSmrg	    # Absolute path.
4824145b7b3cSmrg	    rpath="$rpath$dir:"
4825145b7b3cSmrg	    ;;
4826145b7b3cSmrg	  *)
4827145b7b3cSmrg	    # Relative path: add a thisdir entry.
4828145b7b3cSmrg	    rpath="$rpath\$thisdir/$dir:"
4829145b7b3cSmrg	    ;;
4830145b7b3cSmrg	  esac
4831145b7b3cSmrg	done
4832145b7b3cSmrg	temp_rpath="$rpath"
4833145b7b3cSmrg      fi
4834145b7b3cSmrg
4835145b7b3cSmrg      if test -n "$compile_shlibpath$finalize_shlibpath"; then
4836145b7b3cSmrg	compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command"
4837145b7b3cSmrg      fi
4838145b7b3cSmrg      if test -n "$finalize_shlibpath"; then
4839145b7b3cSmrg	finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command"
4840145b7b3cSmrg      fi
4841145b7b3cSmrg
4842145b7b3cSmrg      compile_var=
4843145b7b3cSmrg      finalize_var=
4844145b7b3cSmrg      if test -n "$runpath_var"; then
4845145b7b3cSmrg	if test -n "$perm_rpath"; then
4846145b7b3cSmrg	  # We should set the runpath_var.
4847145b7b3cSmrg	  rpath=
4848145b7b3cSmrg	  for dir in $perm_rpath; do
4849145b7b3cSmrg	    rpath="$rpath$dir:"
4850145b7b3cSmrg	  done
4851145b7b3cSmrg	  compile_var="$runpath_var=\"$rpath\$$runpath_var\" "
4852145b7b3cSmrg	fi
4853145b7b3cSmrg	if test -n "$finalize_perm_rpath"; then
4854145b7b3cSmrg	  # We should set the runpath_var.
4855145b7b3cSmrg	  rpath=
4856145b7b3cSmrg	  for dir in $finalize_perm_rpath; do
4857145b7b3cSmrg	    rpath="$rpath$dir:"
4858145b7b3cSmrg	  done
4859145b7b3cSmrg	  finalize_var="$runpath_var=\"$rpath\$$runpath_var\" "
4860145b7b3cSmrg	fi
4861145b7b3cSmrg      fi
4862145b7b3cSmrg
4863145b7b3cSmrg      if test "$no_install" = yes; then
4864145b7b3cSmrg	# We don't need to create a wrapper script.
4865145b7b3cSmrg	link_command="$compile_var$compile_command$compile_rpath"
4866145b7b3cSmrg	# Replace the output file specification.
4867145b7b3cSmrg	link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
4868145b7b3cSmrg	# Delete the old output file.
4869145b7b3cSmrg	$run $rm $output
4870145b7b3cSmrg	# Link the executable and exit
4871145b7b3cSmrg	$show "$link_command"
4872145b7b3cSmrg	$run eval "$link_command" || exit $?
4873145b7b3cSmrg	exit $EXIT_SUCCESS
4874145b7b3cSmrg      fi
4875145b7b3cSmrg
4876145b7b3cSmrg      if test "$hardcode_action" = relink; then
4877145b7b3cSmrg	# Fast installation is not supported
4878145b7b3cSmrg	link_command="$compile_var$compile_command$compile_rpath"
4879145b7b3cSmrg	relink_command="$finalize_var$finalize_command$finalize_rpath"
4880145b7b3cSmrg
4881145b7b3cSmrg	$echo "$modename: warning: this platform does not like uninstalled shared libraries" 1>&2
4882145b7b3cSmrg	$echo "$modename: \`$output' will be relinked during installation" 1>&2
4883145b7b3cSmrg      else
4884145b7b3cSmrg	if test "$fast_install" != no; then
4885145b7b3cSmrg	  link_command="$finalize_var$compile_command$finalize_rpath"
4886145b7b3cSmrg	  if test "$fast_install" = yes; then
4887578741aaSmrg	    relink_command=`$echo "X$compile_var$compile_command$compile_rpath" | $SP2NL | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g' | $NL2SP`
4888145b7b3cSmrg	  else
4889145b7b3cSmrg	    # fast_install is set to needless
4890145b7b3cSmrg	    relink_command=
4891145b7b3cSmrg	  fi
4892145b7b3cSmrg	else
4893145b7b3cSmrg	  link_command="$compile_var$compile_command$compile_rpath"
4894145b7b3cSmrg	  relink_command="$finalize_var$finalize_command$finalize_rpath"
4895145b7b3cSmrg	fi
4896145b7b3cSmrg      fi
4897145b7b3cSmrg
4898145b7b3cSmrg      # Replace the output file specification.
4899145b7b3cSmrg      link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`
4900145b7b3cSmrg
4901145b7b3cSmrg      # Delete the old output files.
4902145b7b3cSmrg      $run $rm $output $output_objdir/$outputname $output_objdir/lt-$outputname
4903145b7b3cSmrg
4904145b7b3cSmrg      $show "$link_command"
4905145b7b3cSmrg      $run eval "$link_command" || exit $?
4906145b7b3cSmrg
4907145b7b3cSmrg      # Now create the wrapper script.
4908145b7b3cSmrg      $show "creating $output"
4909145b7b3cSmrg
4910145b7b3cSmrg      # Quote the relink command for shipping.
4911145b7b3cSmrg      if test -n "$relink_command"; then
4912145b7b3cSmrg	# Preserve any variables that may affect compiler behavior
4913145b7b3cSmrg	for var in $variables_saved_for_relink; do
4914145b7b3cSmrg	  if eval test -z \"\${$var+set}\"; then
4915145b7b3cSmrg	    relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command"
4916145b7b3cSmrg	  elif eval var_value=\$$var; test -z "$var_value"; then
4917145b7b3cSmrg	    relink_command="$var=; export $var; $relink_command"
4918145b7b3cSmrg	  else
4919145b7b3cSmrg	    var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"`
4920145b7b3cSmrg	    relink_command="$var=\"$var_value\"; export $var; $relink_command"
4921145b7b3cSmrg	  fi
4922145b7b3cSmrg	done
4923145b7b3cSmrg	relink_command="(cd `pwd`; $relink_command)"
4924578741aaSmrg	relink_command=`$echo "X$relink_command" | $SP2NL | $Xsed -e "$sed_quote_subst" | $NL2SP`
4925145b7b3cSmrg      fi
4926145b7b3cSmrg
4927145b7b3cSmrg      # Quote $echo for shipping.
4928145b7b3cSmrg      if test "X$echo" = "X$SHELL $progpath --fallback-echo"; then
4929145b7b3cSmrg	case $progpath in
4930145b7b3cSmrg	[\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $progpath --fallback-echo";;
4931145b7b3cSmrg	*) qecho="$SHELL `pwd`/$progpath --fallback-echo";;
4932145b7b3cSmrg	esac
4933145b7b3cSmrg	qecho=`$echo "X$qecho" | $Xsed -e "$sed_quote_subst"`
4934145b7b3cSmrg      else
4935145b7b3cSmrg	qecho=`$echo "X$echo" | $Xsed -e "$sed_quote_subst"`
4936145b7b3cSmrg      fi
4937145b7b3cSmrg
4938145b7b3cSmrg      # Only actually do things if our run command is non-null.
4939145b7b3cSmrg      if test -z "$run"; then
4940145b7b3cSmrg	# win32 will think the script is a binary if it has
4941145b7b3cSmrg	# a .exe suffix, so we strip it off here.
4942145b7b3cSmrg	case $output in
4943145b7b3cSmrg	  *.exe) output=`$echo $output|${SED} 's,.exe$,,'` ;;
4944145b7b3cSmrg	esac
4945145b7b3cSmrg	# test for cygwin because mv fails w/o .exe extensions
4946145b7b3cSmrg	case $host in
4947145b7b3cSmrg	  *cygwin*)
4948145b7b3cSmrg	    exeext=.exe
4949145b7b3cSmrg	    outputname=`$echo $outputname|${SED} 's,.exe$,,'` ;;
4950145b7b3cSmrg	  *) exeext= ;;
4951145b7b3cSmrg	esac
4952145b7b3cSmrg	case $host in
4953145b7b3cSmrg	  *cygwin* | *mingw* )
4954145b7b3cSmrg            output_name=`basename $output`
4955145b7b3cSmrg            output_path=`dirname $output`
4956145b7b3cSmrg            cwrappersource="$output_path/$objdir/lt-$output_name.c"
4957145b7b3cSmrg            cwrapper="$output_path/$output_name.exe"
4958145b7b3cSmrg            $rm $cwrappersource $cwrapper
4959145b7b3cSmrg            trap "$rm $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15
4960145b7b3cSmrg
4961145b7b3cSmrg	    cat > $cwrappersource <<EOF
4962145b7b3cSmrg
4963145b7b3cSmrg/* $cwrappersource - temporary wrapper executable for $objdir/$outputname
4964145b7b3cSmrg   Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
4965145b7b3cSmrg
4966145b7b3cSmrg   The $output program cannot be directly executed until all the libtool
4967145b7b3cSmrg   libraries that it depends on are installed.
4968145b7b3cSmrg
4969145b7b3cSmrg   This wrapper executable should never be moved out of the build directory.
4970145b7b3cSmrg   If it is, it will not operate correctly.
4971145b7b3cSmrg
4972145b7b3cSmrg   Currently, it simply execs the wrapper *script* "/bin/sh $output",
4973145b7b3cSmrg   but could eventually absorb all of the scripts functionality and
4974145b7b3cSmrg   exec $objdir/$outputname directly.
4975145b7b3cSmrg*/
4976145b7b3cSmrgEOF
4977145b7b3cSmrg	    cat >> $cwrappersource<<"EOF"
4978145b7b3cSmrg#include <stdio.h>
4979145b7b3cSmrg#include <stdlib.h>
4980145b7b3cSmrg#include <unistd.h>
4981145b7b3cSmrg#include <malloc.h>
4982145b7b3cSmrg#include <stdarg.h>
4983145b7b3cSmrg#include <assert.h>
4984145b7b3cSmrg#include <string.h>
4985145b7b3cSmrg#include <ctype.h>
4986145b7b3cSmrg#include <sys/stat.h>
4987145b7b3cSmrg
4988145b7b3cSmrg#if defined(PATH_MAX)
4989145b7b3cSmrg# define LT_PATHMAX PATH_MAX
4990145b7b3cSmrg#elif defined(MAXPATHLEN)
4991145b7b3cSmrg# define LT_PATHMAX MAXPATHLEN
4992145b7b3cSmrg#else
4993145b7b3cSmrg# define LT_PATHMAX 1024
4994145b7b3cSmrg#endif
4995145b7b3cSmrg
4996145b7b3cSmrg#ifndef DIR_SEPARATOR
4997145b7b3cSmrg# define DIR_SEPARATOR '/'
4998145b7b3cSmrg# define PATH_SEPARATOR ':'
4999145b7b3cSmrg#endif
5000145b7b3cSmrg
5001145b7b3cSmrg#if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \
5002145b7b3cSmrg  defined (__OS2__)
5003145b7b3cSmrg# define HAVE_DOS_BASED_FILE_SYSTEM
5004145b7b3cSmrg# ifndef DIR_SEPARATOR_2
5005145b7b3cSmrg#  define DIR_SEPARATOR_2 '\\'
5006145b7b3cSmrg# endif
5007145b7b3cSmrg# ifndef PATH_SEPARATOR_2
5008145b7b3cSmrg#  define PATH_SEPARATOR_2 ';'
5009145b7b3cSmrg# endif
5010145b7b3cSmrg#endif
5011145b7b3cSmrg
5012145b7b3cSmrg#ifndef DIR_SEPARATOR_2
5013145b7b3cSmrg# define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR)
5014145b7b3cSmrg#else /* DIR_SEPARATOR_2 */
5015145b7b3cSmrg# define IS_DIR_SEPARATOR(ch) \
5016145b7b3cSmrg        (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2))
5017145b7b3cSmrg#endif /* DIR_SEPARATOR_2 */
5018145b7b3cSmrg
5019145b7b3cSmrg#ifndef PATH_SEPARATOR_2
5020145b7b3cSmrg# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR)
5021145b7b3cSmrg#else /* PATH_SEPARATOR_2 */
5022145b7b3cSmrg# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2)
5023145b7b3cSmrg#endif /* PATH_SEPARATOR_2 */
5024145b7b3cSmrg
5025145b7b3cSmrg#define XMALLOC(type, num)      ((type *) xmalloc ((num) * sizeof(type)))
5026145b7b3cSmrg#define XFREE(stale) do { \
5027145b7b3cSmrg  if (stale) { free ((void *) stale); stale = 0; } \
5028145b7b3cSmrg} while (0)
5029145b7b3cSmrg
5030145b7b3cSmrg/* -DDEBUG is fairly common in CFLAGS.  */
5031145b7b3cSmrg#undef DEBUG
5032145b7b3cSmrg#if defined DEBUGWRAPPER
5033145b7b3cSmrg# define DEBUG(format, ...) fprintf(stderr, format, __VA_ARGS__)
5034145b7b3cSmrg#else
5035145b7b3cSmrg# define DEBUG(format, ...)
5036145b7b3cSmrg#endif
5037145b7b3cSmrg
5038145b7b3cSmrgconst char *program_name = NULL;
5039145b7b3cSmrg
5040145b7b3cSmrgvoid * xmalloc (size_t num);
5041145b7b3cSmrgchar * xstrdup (const char *string);
5042145b7b3cSmrgconst char * base_name (const char *name);
5043145b7b3cSmrgchar * find_executable(const char *wrapper);
5044145b7b3cSmrgint    check_executable(const char *path);
5045145b7b3cSmrgchar * strendzap(char *str, const char *pat);
5046145b7b3cSmrgvoid lt_fatal (const char *message, ...);
5047145b7b3cSmrg
5048145b7b3cSmrgint
5049145b7b3cSmrgmain (int argc, char *argv[])
5050145b7b3cSmrg{
5051145b7b3cSmrg  char **newargz;
5052145b7b3cSmrg  int i;
5053145b7b3cSmrg
5054145b7b3cSmrg  program_name = (char *) xstrdup (base_name (argv[0]));
5055145b7b3cSmrg  DEBUG("(main) argv[0]      : %s\n",argv[0]);
5056145b7b3cSmrg  DEBUG("(main) program_name : %s\n",program_name);
5057145b7b3cSmrg  newargz = XMALLOC(char *, argc+2);
5058145b7b3cSmrgEOF
5059145b7b3cSmrg
5060145b7b3cSmrg            cat >> $cwrappersource <<EOF
5061145b7b3cSmrg  newargz[0] = (char *) xstrdup("$SHELL");
5062145b7b3cSmrgEOF
5063145b7b3cSmrg
5064145b7b3cSmrg            cat >> $cwrappersource <<"EOF"
5065145b7b3cSmrg  newargz[1] = find_executable(argv[0]);
5066145b7b3cSmrg  if (newargz[1] == NULL)
5067145b7b3cSmrg    lt_fatal("Couldn't find %s", argv[0]);
5068145b7b3cSmrg  DEBUG("(main) found exe at : %s\n",newargz[1]);
5069145b7b3cSmrg  /* we know the script has the same name, without the .exe */
5070145b7b3cSmrg  /* so make sure newargz[1] doesn't end in .exe */
5071145b7b3cSmrg  strendzap(newargz[1],".exe");
5072145b7b3cSmrg  for (i = 1; i < argc; i++)
5073145b7b3cSmrg    newargz[i+1] = xstrdup(argv[i]);
5074145b7b3cSmrg  newargz[argc+1] = NULL;
5075145b7b3cSmrg
5076145b7b3cSmrg  for (i=0; i<argc+1; i++)
5077145b7b3cSmrg  {
5078145b7b3cSmrg    DEBUG("(main) newargz[%d]   : %s\n",i,newargz[i]);
5079145b7b3cSmrg    ;
5080145b7b3cSmrg  }
5081145b7b3cSmrg
5082145b7b3cSmrgEOF
5083145b7b3cSmrg
5084145b7b3cSmrg            case $host_os in
5085145b7b3cSmrg              mingw*)
5086145b7b3cSmrg                cat >> $cwrappersource <<EOF
5087145b7b3cSmrg  execv("$SHELL",(char const **)newargz);
5088145b7b3cSmrgEOF
5089145b7b3cSmrg              ;;
5090145b7b3cSmrg              *)
5091145b7b3cSmrg                cat >> $cwrappersource <<EOF
5092145b7b3cSmrg  execv("$SHELL",newargz);
5093145b7b3cSmrgEOF
5094145b7b3cSmrg              ;;
5095145b7b3cSmrg            esac
5096145b7b3cSmrg
5097145b7b3cSmrg            cat >> $cwrappersource <<"EOF"
5098145b7b3cSmrg  return 127;
5099145b7b3cSmrg}
5100145b7b3cSmrg
5101145b7b3cSmrgvoid *
5102145b7b3cSmrgxmalloc (size_t num)
5103145b7b3cSmrg{
5104145b7b3cSmrg  void * p = (void *) malloc (num);
5105145b7b3cSmrg  if (!p)
5106145b7b3cSmrg    lt_fatal ("Memory exhausted");
5107145b7b3cSmrg
5108145b7b3cSmrg  return p;
5109145b7b3cSmrg}
5110145b7b3cSmrg
5111145b7b3cSmrgchar *
5112145b7b3cSmrgxstrdup (const char *string)
5113145b7b3cSmrg{
5114145b7b3cSmrg  return string ? strcpy ((char *) xmalloc (strlen (string) + 1), string) : NULL
5115145b7b3cSmrg;
5116145b7b3cSmrg}
5117145b7b3cSmrg
5118145b7b3cSmrgconst char *
5119145b7b3cSmrgbase_name (const char *name)
5120145b7b3cSmrg{
5121145b7b3cSmrg  const char *base;
5122145b7b3cSmrg
5123145b7b3cSmrg#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
5124145b7b3cSmrg  /* Skip over the disk name in MSDOS pathnames. */
5125145b7b3cSmrg  if (isalpha ((unsigned char)name[0]) && name[1] == ':')
5126145b7b3cSmrg    name += 2;
5127145b7b3cSmrg#endif
5128145b7b3cSmrg
5129145b7b3cSmrg  for (base = name; *name; name++)
5130145b7b3cSmrg    if (IS_DIR_SEPARATOR (*name))
5131145b7b3cSmrg      base = name + 1;
5132145b7b3cSmrg  return base;
5133145b7b3cSmrg}
5134145b7b3cSmrg
5135145b7b3cSmrgint
5136145b7b3cSmrgcheck_executable(const char * path)
5137145b7b3cSmrg{
5138145b7b3cSmrg  struct stat st;
5139145b7b3cSmrg
5140145b7b3cSmrg  DEBUG("(check_executable)  : %s\n", path ? (*path ? path : "EMPTY!") : "NULL!");
5141145b7b3cSmrg  if ((!path) || (!*path))
5142145b7b3cSmrg    return 0;
5143145b7b3cSmrg
5144145b7b3cSmrg  if ((stat (path, &st) >= 0) &&
5145145b7b3cSmrg      (
5146145b7b3cSmrg        /* MinGW & native WIN32 do not support S_IXOTH or S_IXGRP */
5147145b7b3cSmrg#if defined (S_IXOTH)
5148145b7b3cSmrg       ((st.st_mode & S_IXOTH) == S_IXOTH) ||
5149145b7b3cSmrg#endif
5150145b7b3cSmrg#if defined (S_IXGRP)
5151145b7b3cSmrg       ((st.st_mode & S_IXGRP) == S_IXGRP) ||
5152145b7b3cSmrg#endif
5153145b7b3cSmrg       ((st.st_mode & S_IXUSR) == S_IXUSR))
5154145b7b3cSmrg      )
5155145b7b3cSmrg    return 1;
5156145b7b3cSmrg  else
5157145b7b3cSmrg    return 0;
5158145b7b3cSmrg}
5159145b7b3cSmrg
5160145b7b3cSmrg/* Searches for the full path of the wrapper.  Returns
5161145b7b3cSmrg   newly allocated full path name if found, NULL otherwise */
5162145b7b3cSmrgchar *
5163145b7b3cSmrgfind_executable (const char* wrapper)
5164145b7b3cSmrg{
5165145b7b3cSmrg  int has_slash = 0;
5166145b7b3cSmrg  const char* p;
5167145b7b3cSmrg  const char* p_next;
5168145b7b3cSmrg  /* static buffer for getcwd */
5169145b7b3cSmrg  char tmp[LT_PATHMAX + 1];
5170145b7b3cSmrg  int tmp_len;
5171145b7b3cSmrg  char* concat_name;
5172145b7b3cSmrg
5173145b7b3cSmrg  DEBUG("(find_executable)  : %s\n", wrapper ? (*wrapper ? wrapper : "EMPTY!") : "NULL!");
5174145b7b3cSmrg
5175145b7b3cSmrg  if ((wrapper == NULL) || (*wrapper == '\0'))
5176145b7b3cSmrg    return NULL;
5177145b7b3cSmrg
5178145b7b3cSmrg  /* Absolute path? */
5179145b7b3cSmrg#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
5180145b7b3cSmrg  if (isalpha ((unsigned char)wrapper[0]) && wrapper[1] == ':')
5181145b7b3cSmrg  {
5182145b7b3cSmrg    concat_name = xstrdup (wrapper);
5183145b7b3cSmrg    if (check_executable(concat_name))
5184145b7b3cSmrg      return concat_name;
5185145b7b3cSmrg    XFREE(concat_name);
5186145b7b3cSmrg  }
5187145b7b3cSmrg  else
5188145b7b3cSmrg  {
5189145b7b3cSmrg#endif
5190145b7b3cSmrg    if (IS_DIR_SEPARATOR (wrapper[0]))
5191145b7b3cSmrg    {
5192145b7b3cSmrg      concat_name = xstrdup (wrapper);
5193145b7b3cSmrg      if (check_executable(concat_name))
5194145b7b3cSmrg        return concat_name;
5195145b7b3cSmrg      XFREE(concat_name);
5196145b7b3cSmrg    }
5197145b7b3cSmrg#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
5198145b7b3cSmrg  }
5199145b7b3cSmrg#endif
5200145b7b3cSmrg
5201145b7b3cSmrg  for (p = wrapper; *p; p++)
5202145b7b3cSmrg    if (*p == '/')
5203145b7b3cSmrg    {
5204145b7b3cSmrg      has_slash = 1;
5205145b7b3cSmrg      break;
5206145b7b3cSmrg    }
5207145b7b3cSmrg  if (!has_slash)
5208145b7b3cSmrg  {
5209145b7b3cSmrg    /* no slashes; search PATH */
5210145b7b3cSmrg    const char* path = getenv ("PATH");
5211145b7b3cSmrg    if (path != NULL)
5212145b7b3cSmrg    {
5213145b7b3cSmrg      for (p = path; *p; p = p_next)
5214145b7b3cSmrg      {
5215145b7b3cSmrg        const char* q;
5216145b7b3cSmrg        size_t p_len;
5217145b7b3cSmrg        for (q = p; *q; q++)
5218145b7b3cSmrg          if (IS_PATH_SEPARATOR(*q))
5219145b7b3cSmrg            break;
5220145b7b3cSmrg        p_len = q - p;
5221145b7b3cSmrg        p_next = (*q == '\0' ? q : q + 1);
5222145b7b3cSmrg        if (p_len == 0)
5223145b7b3cSmrg        {
5224145b7b3cSmrg          /* empty path: current directory */
5225145b7b3cSmrg          if (getcwd (tmp, LT_PATHMAX) == NULL)
5226145b7b3cSmrg            lt_fatal ("getcwd failed");
5227145b7b3cSmrg          tmp_len = strlen(tmp);
5228145b7b3cSmrg          concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1);
5229145b7b3cSmrg          memcpy (concat_name, tmp, tmp_len);
5230145b7b3cSmrg          concat_name[tmp_len] = '/';
5231145b7b3cSmrg          strcpy (concat_name + tmp_len + 1, wrapper);
5232145b7b3cSmrg        }
5233145b7b3cSmrg        else
5234145b7b3cSmrg        {
5235145b7b3cSmrg          concat_name = XMALLOC(char, p_len + 1 + strlen(wrapper) + 1);
5236145b7b3cSmrg          memcpy (concat_name, p, p_len);
5237145b7b3cSmrg          concat_name[p_len] = '/';
5238145b7b3cSmrg          strcpy (concat_name + p_len + 1, wrapper);
5239145b7b3cSmrg        }
5240145b7b3cSmrg        if (check_executable(concat_name))
5241145b7b3cSmrg          return concat_name;
5242145b7b3cSmrg        XFREE(concat_name);
5243145b7b3cSmrg      }
5244145b7b3cSmrg    }
5245145b7b3cSmrg    /* not found in PATH; assume curdir */
5246145b7b3cSmrg  }
5247145b7b3cSmrg  /* Relative path | not found in path: prepend cwd */
5248145b7b3cSmrg  if (getcwd (tmp, LT_PATHMAX) == NULL)
5249145b7b3cSmrg    lt_fatal ("getcwd failed");
5250145b7b3cSmrg  tmp_len = strlen(tmp);
5251145b7b3cSmrg  concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1);
5252145b7b3cSmrg  memcpy (concat_name, tmp, tmp_len);
5253145b7b3cSmrg  concat_name[tmp_len] = '/';
5254145b7b3cSmrg  strcpy (concat_name + tmp_len + 1, wrapper);
5255145b7b3cSmrg
5256145b7b3cSmrg  if (check_executable(concat_name))
5257145b7b3cSmrg    return concat_name;
5258145b7b3cSmrg  XFREE(concat_name);
5259145b7b3cSmrg  return NULL;
5260145b7b3cSmrg}
5261145b7b3cSmrg
5262145b7b3cSmrgchar *
5263145b7b3cSmrgstrendzap(char *str, const char *pat)
5264145b7b3cSmrg{
5265145b7b3cSmrg  size_t len, patlen;
5266145b7b3cSmrg
5267145b7b3cSmrg  assert(str != NULL);
5268145b7b3cSmrg  assert(pat != NULL);
5269145b7b3cSmrg
5270145b7b3cSmrg  len = strlen(str);
5271145b7b3cSmrg  patlen = strlen(pat);
5272145b7b3cSmrg
5273145b7b3cSmrg  if (patlen <= len)
5274145b7b3cSmrg  {
5275145b7b3cSmrg    str += len - patlen;
5276145b7b3cSmrg    if (strcmp(str, pat) == 0)
5277145b7b3cSmrg      *str = '\0';
5278145b7b3cSmrg  }
5279145b7b3cSmrg  return str;
5280145b7b3cSmrg}
5281145b7b3cSmrg
5282145b7b3cSmrgstatic void
5283145b7b3cSmrglt_error_core (int exit_status, const char * mode,
5284145b7b3cSmrg          const char * message, va_list ap)
5285145b7b3cSmrg{
5286145b7b3cSmrg  fprintf (stderr, "%s: %s: ", program_name, mode);
5287145b7b3cSmrg  vfprintf (stderr, message, ap);
5288145b7b3cSmrg  fprintf (stderr, ".\n");
5289145b7b3cSmrg
5290145b7b3cSmrg  if (exit_status >= 0)
5291145b7b3cSmrg    exit (exit_status);
5292145b7b3cSmrg}
5293145b7b3cSmrg
5294145b7b3cSmrgvoid
5295145b7b3cSmrglt_fatal (const char *message, ...)
5296145b7b3cSmrg{
5297145b7b3cSmrg  va_list ap;
5298145b7b3cSmrg  va_start (ap, message);
5299145b7b3cSmrg  lt_error_core (EXIT_FAILURE, "FATAL", message, ap);
5300145b7b3cSmrg  va_end (ap);
5301145b7b3cSmrg}
5302145b7b3cSmrgEOF
5303145b7b3cSmrg          # we should really use a build-platform specific compiler
5304145b7b3cSmrg          # here, but OTOH, the wrappers (shell script and this C one)
5305145b7b3cSmrg          # are only useful if you want to execute the "real" binary.
5306145b7b3cSmrg          # Since the "real" binary is built for $host, then this
5307145b7b3cSmrg          # wrapper might as well be built for $host, too.
5308145b7b3cSmrg          $run $LTCC $LTCFLAGS -s -o $cwrapper $cwrappersource
5309145b7b3cSmrg          ;;
5310145b7b3cSmrg        esac
5311145b7b3cSmrg        $rm $output
5312145b7b3cSmrg        trap "$rm $output; exit $EXIT_FAILURE" 1 2 15
5313145b7b3cSmrg
5314145b7b3cSmrg	$echo > $output "\
5315145b7b3cSmrg#! $SHELL
5316145b7b3cSmrg
5317145b7b3cSmrg# $output - temporary wrapper script for $objdir/$outputname
5318145b7b3cSmrg# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
5319145b7b3cSmrg#
5320145b7b3cSmrg# The $output program cannot be directly executed until all the libtool
5321145b7b3cSmrg# libraries that it depends on are installed.
5322145b7b3cSmrg#
5323145b7b3cSmrg# This wrapper script should never be moved out of the build directory.
5324145b7b3cSmrg# If it is, it will not operate correctly.
5325145b7b3cSmrg
5326145b7b3cSmrg# Sed substitution that helps us do robust quoting.  It backslashifies
5327145b7b3cSmrg# metacharacters that are still active within double-quoted strings.
5328145b7b3cSmrgXsed='${SED} -e 1s/^X//'
5329145b7b3cSmrgsed_quote_subst='$sed_quote_subst'
5330145b7b3cSmrg
5331578741aaSmrg# Be Bourne compatible (taken from Autoconf:_AS_BOURNE_COMPATIBLE).
5332578741aaSmrgif test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then
5333578741aaSmrg  emulate sh
5334578741aaSmrg  NULLCMD=:
5335578741aaSmrg  # Zsh 3.x and 4.x performs word splitting on \${1+\"\$@\"}, which
5336578741aaSmrg  # is contrary to our usage.  Disable this feature.
5337578741aaSmrg  alias -g '\${1+\"\$@\"}'='\"\$@\"'
5338578741aaSmrg  setopt NO_GLOB_SUBST
5339578741aaSmrgelse
5340578741aaSmrg  case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac
5341578741aaSmrgfi
5342578741aaSmrgBIN_SH=xpg4; export BIN_SH # for Tru64
5343578741aaSmrgDUALCASE=1; export DUALCASE # for MKS sh
5344578741aaSmrg
5345145b7b3cSmrg# The HP-UX ksh and POSIX shell print the target directory to stdout
5346145b7b3cSmrg# if CDPATH is set.
5347145b7b3cSmrg(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
5348145b7b3cSmrg
5349145b7b3cSmrgrelink_command=\"$relink_command\"
5350145b7b3cSmrg
5351145b7b3cSmrg# This environment variable determines our operation mode.
5352145b7b3cSmrgif test \"\$libtool_install_magic\" = \"$magic\"; then
5353145b7b3cSmrg  # install mode needs the following variable:
5354145b7b3cSmrg  notinst_deplibs='$notinst_deplibs'
5355145b7b3cSmrgelse
5356145b7b3cSmrg  # When we are sourced in execute mode, \$file and \$echo are already set.
5357145b7b3cSmrg  if test \"\$libtool_execute_magic\" != \"$magic\"; then
5358145b7b3cSmrg    echo=\"$qecho\"
5359145b7b3cSmrg    file=\"\$0\"
5360145b7b3cSmrg    # Make sure echo works.
5361145b7b3cSmrg    if test \"X\$1\" = X--no-reexec; then
5362145b7b3cSmrg      # Discard the --no-reexec flag, and continue.
5363145b7b3cSmrg      shift
5364145b7b3cSmrg    elif test \"X\`(\$echo '\t') 2>/dev/null\`\" = 'X\t'; then
5365145b7b3cSmrg      # Yippee, \$echo works!
5366145b7b3cSmrg      :
5367145b7b3cSmrg    else
5368145b7b3cSmrg      # Restart under the correct shell, and then maybe \$echo will work.
5369145b7b3cSmrg      exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"}
5370145b7b3cSmrg    fi
5371145b7b3cSmrg  fi\
5372145b7b3cSmrg"
5373145b7b3cSmrg	$echo >> $output "\
5374145b7b3cSmrg
5375145b7b3cSmrg  # Find the directory that this script lives in.
5376145b7b3cSmrg  thisdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\`
5377145b7b3cSmrg  test \"x\$thisdir\" = \"x\$file\" && thisdir=.
5378145b7b3cSmrg
5379145b7b3cSmrg  # Follow symbolic links until we get to the real thisdir.
5380145b7b3cSmrg  file=\`ls -ld \"\$file\" | ${SED} -n 's/.*-> //p'\`
5381145b7b3cSmrg  while test -n \"\$file\"; do
5382145b7b3cSmrg    destdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\`
5383145b7b3cSmrg
5384145b7b3cSmrg    # If there was a directory component, then change thisdir.
5385145b7b3cSmrg    if test \"x\$destdir\" != \"x\$file\"; then
5386145b7b3cSmrg      case \"\$destdir\" in
5387145b7b3cSmrg      [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;;
5388145b7b3cSmrg      *) thisdir=\"\$thisdir/\$destdir\" ;;
5389145b7b3cSmrg      esac
5390145b7b3cSmrg    fi
5391145b7b3cSmrg
5392145b7b3cSmrg    file=\`\$echo \"X\$file\" | \$Xsed -e 's%^.*/%%'\`
5393145b7b3cSmrg    file=\`ls -ld \"\$thisdir/\$file\" | ${SED} -n 's/.*-> //p'\`
5394145b7b3cSmrg  done
5395145b7b3cSmrg
5396145b7b3cSmrg  # Try to get the absolute directory name.
5397145b7b3cSmrg  absdir=\`cd \"\$thisdir\" && pwd\`
5398145b7b3cSmrg  test -n \"\$absdir\" && thisdir=\"\$absdir\"
5399145b7b3cSmrg"
5400145b7b3cSmrg
5401145b7b3cSmrg	if test "$fast_install" = yes; then
5402145b7b3cSmrg	  $echo >> $output "\
5403145b7b3cSmrg  program=lt-'$outputname'$exeext
5404145b7b3cSmrg  progdir=\"\$thisdir/$objdir\"
5405145b7b3cSmrg
5406145b7b3cSmrg  if test ! -f \"\$progdir/\$program\" || \\
5407145b7b3cSmrg     { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\
5408145b7b3cSmrg       test \"X\$file\" != \"X\$progdir/\$program\"; }; then
5409145b7b3cSmrg
5410145b7b3cSmrg    file=\"\$\$-\$program\"
5411145b7b3cSmrg
5412145b7b3cSmrg    if test ! -d \"\$progdir\"; then
5413145b7b3cSmrg      $mkdir \"\$progdir\"
5414145b7b3cSmrg    else
5415145b7b3cSmrg      $rm \"\$progdir/\$file\"
5416145b7b3cSmrg    fi"
5417145b7b3cSmrg
5418145b7b3cSmrg	  $echo >> $output "\
5419145b7b3cSmrg
5420145b7b3cSmrg    # relink executable if necessary
5421145b7b3cSmrg    if test -n \"\$relink_command\"; then
5422145b7b3cSmrg      if relink_command_output=\`eval \$relink_command 2>&1\`; then :
5423145b7b3cSmrg      else
5424145b7b3cSmrg	$echo \"\$relink_command_output\" >&2
5425145b7b3cSmrg	$rm \"\$progdir/\$file\"
5426145b7b3cSmrg	exit $EXIT_FAILURE
5427145b7b3cSmrg      fi
5428145b7b3cSmrg    fi
5429145b7b3cSmrg
5430145b7b3cSmrg    $mv \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null ||
5431145b7b3cSmrg    { $rm \"\$progdir/\$program\";
5432145b7b3cSmrg      $mv \"\$progdir/\$file\" \"\$progdir/\$program\"; }
5433145b7b3cSmrg    $rm \"\$progdir/\$file\"
5434145b7b3cSmrg  fi"
5435145b7b3cSmrg	else
5436145b7b3cSmrg	  $echo >> $output "\
5437145b7b3cSmrg  program='$outputname'
5438145b7b3cSmrg  progdir=\"\$thisdir/$objdir\"
5439145b7b3cSmrg"
5440145b7b3cSmrg	fi
5441145b7b3cSmrg
5442145b7b3cSmrg	$echo >> $output "\
5443145b7b3cSmrg
5444145b7b3cSmrg  if test -f \"\$progdir/\$program\"; then"
5445145b7b3cSmrg
5446145b7b3cSmrg	# Export our shlibpath_var if we have one.
5447145b7b3cSmrg	if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
5448145b7b3cSmrg	  $echo >> $output "\
5449145b7b3cSmrg    # Add our own library path to $shlibpath_var
5450145b7b3cSmrg    $shlibpath_var=\"$temp_rpath\$$shlibpath_var\"
5451145b7b3cSmrg
5452145b7b3cSmrg    # Some systems cannot cope with colon-terminated $shlibpath_var
5453145b7b3cSmrg    # The second colon is a workaround for a bug in BeOS R4 sed
5454145b7b3cSmrg    $shlibpath_var=\`\$echo \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\`
5455145b7b3cSmrg
5456145b7b3cSmrg    export $shlibpath_var
5457145b7b3cSmrg"
5458145b7b3cSmrg	fi
5459145b7b3cSmrg
5460145b7b3cSmrg	# fixup the dll searchpath if we need to.
5461145b7b3cSmrg	if test -n "$dllsearchpath"; then
5462145b7b3cSmrg	  $echo >> $output "\
5463145b7b3cSmrg    # Add the dll search path components to the executable PATH
5464145b7b3cSmrg    PATH=$dllsearchpath:\$PATH
5465145b7b3cSmrg"
5466145b7b3cSmrg	fi
5467145b7b3cSmrg
5468145b7b3cSmrg	$echo >> $output "\
5469145b7b3cSmrg    if test \"\$libtool_execute_magic\" != \"$magic\"; then
5470145b7b3cSmrg      # Run the actual program with our arguments.
5471145b7b3cSmrg"
5472145b7b3cSmrg	case $host in
5473145b7b3cSmrg	# Backslashes separate directories on plain windows
5474145b7b3cSmrg	*-*-mingw | *-*-os2*)
5475145b7b3cSmrg	  $echo >> $output "\
5476145b7b3cSmrg      exec \"\$progdir\\\\\$program\" \${1+\"\$@\"}
5477145b7b3cSmrg"
5478145b7b3cSmrg	  ;;
5479145b7b3cSmrg
5480145b7b3cSmrg	*)
5481145b7b3cSmrg	  $echo >> $output "\
5482145b7b3cSmrg      exec \"\$progdir/\$program\" \${1+\"\$@\"}
5483145b7b3cSmrg"
5484145b7b3cSmrg	  ;;
5485145b7b3cSmrg	esac
5486145b7b3cSmrg	$echo >> $output "\
5487578741aaSmrg      \$echo \"\$0: cannot exec \$program \$*\"
5488145b7b3cSmrg      exit $EXIT_FAILURE
5489145b7b3cSmrg    fi
5490145b7b3cSmrg  else
5491145b7b3cSmrg    # The program doesn't exist.
5492145b7b3cSmrg    \$echo \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2
5493145b7b3cSmrg    \$echo \"This script is just a wrapper for \$program.\" 1>&2
5494145b7b3cSmrg    $echo \"See the $PACKAGE documentation for more information.\" 1>&2
5495145b7b3cSmrg    exit $EXIT_FAILURE
5496145b7b3cSmrg  fi
5497145b7b3cSmrgfi\
5498145b7b3cSmrg"
5499145b7b3cSmrg	chmod +x $output
5500145b7b3cSmrg      fi
5501145b7b3cSmrg      exit $EXIT_SUCCESS
5502145b7b3cSmrg      ;;
5503145b7b3cSmrg    esac
5504145b7b3cSmrg
5505145b7b3cSmrg    # See if we need to build an old-fashioned archive.
5506145b7b3cSmrg    for oldlib in $oldlibs; do
5507145b7b3cSmrg
5508145b7b3cSmrg      if test "$build_libtool_libs" = convenience; then
5509145b7b3cSmrg	oldobjs="$libobjs_save"
5510145b7b3cSmrg	addlibs="$convenience"
5511145b7b3cSmrg	build_libtool_libs=no
5512145b7b3cSmrg      else
5513145b7b3cSmrg	if test "$build_libtool_libs" = module; then
5514145b7b3cSmrg	  oldobjs="$libobjs_save"
5515145b7b3cSmrg	  build_libtool_libs=no
5516145b7b3cSmrg	else
5517145b7b3cSmrg	  oldobjs="$old_deplibs $non_pic_objects"
5518145b7b3cSmrg	fi
5519145b7b3cSmrg	addlibs="$old_convenience"
5520145b7b3cSmrg      fi
5521145b7b3cSmrg
5522145b7b3cSmrg      if test -n "$addlibs"; then
5523145b7b3cSmrg	gentop="$output_objdir/${outputname}x"
5524145b7b3cSmrg	generated="$generated $gentop"
5525145b7b3cSmrg
5526145b7b3cSmrg	func_extract_archives $gentop $addlibs
5527145b7b3cSmrg	oldobjs="$oldobjs $func_extract_archives_result"
5528145b7b3cSmrg      fi
5529145b7b3cSmrg
5530145b7b3cSmrg      # Do each command in the archive commands.
5531145b7b3cSmrg      if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then
5532145b7b3cSmrg       cmds=$old_archive_from_new_cmds
5533145b7b3cSmrg      else
5534145b7b3cSmrg	# POSIX demands no paths to be encoded in archives.  We have
5535145b7b3cSmrg	# to avoid creating archives with duplicate basenames if we
5536145b7b3cSmrg	# might have to extract them afterwards, e.g., when creating a
5537145b7b3cSmrg	# static archive out of a convenience library, or when linking
5538145b7b3cSmrg	# the entirety of a libtool archive into another (currently
5539145b7b3cSmrg	# not supported by libtool).
5540145b7b3cSmrg	if (for obj in $oldobjs
5541145b7b3cSmrg	    do
5542145b7b3cSmrg	      $echo "X$obj" | $Xsed -e 's%^.*/%%'
5543145b7b3cSmrg	    done | sort | sort -uc >/dev/null 2>&1); then
5544145b7b3cSmrg	  :
5545145b7b3cSmrg	else
5546145b7b3cSmrg	  $echo "copying selected object files to avoid basename conflicts..."
5547145b7b3cSmrg
5548145b7b3cSmrg	  if test -z "$gentop"; then
5549145b7b3cSmrg	    gentop="$output_objdir/${outputname}x"
5550145b7b3cSmrg	    generated="$generated $gentop"
5551145b7b3cSmrg
5552145b7b3cSmrg	    $show "${rm}r $gentop"
5553145b7b3cSmrg	    $run ${rm}r "$gentop"
5554145b7b3cSmrg	    $show "$mkdir $gentop"
5555145b7b3cSmrg	    $run $mkdir "$gentop"
5556145b7b3cSmrg	    exit_status=$?
5557145b7b3cSmrg	    if test "$exit_status" -ne 0 && test ! -d "$gentop"; then
5558145b7b3cSmrg	      exit $exit_status
5559145b7b3cSmrg	    fi
5560145b7b3cSmrg	  fi
5561145b7b3cSmrg
5562145b7b3cSmrg	  save_oldobjs=$oldobjs
5563145b7b3cSmrg	  oldobjs=
5564145b7b3cSmrg	  counter=1
5565145b7b3cSmrg	  for obj in $save_oldobjs
5566145b7b3cSmrg	  do
5567145b7b3cSmrg	    objbase=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
5568145b7b3cSmrg	    case " $oldobjs " in
5569145b7b3cSmrg	    " ") oldobjs=$obj ;;
5570145b7b3cSmrg	    *[\ /]"$objbase "*)
5571145b7b3cSmrg	      while :; do
5572145b7b3cSmrg		# Make sure we don't pick an alternate name that also
5573145b7b3cSmrg		# overlaps.
5574145b7b3cSmrg		newobj=lt$counter-$objbase
5575145b7b3cSmrg		counter=`expr $counter + 1`
5576145b7b3cSmrg		case " $oldobjs " in
5577145b7b3cSmrg		*[\ /]"$newobj "*) ;;
5578145b7b3cSmrg		*) if test ! -f "$gentop/$newobj"; then break; fi ;;
5579145b7b3cSmrg		esac
5580145b7b3cSmrg	      done
5581145b7b3cSmrg	      $show "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj"
5582145b7b3cSmrg	      $run ln "$obj" "$gentop/$newobj" ||
5583145b7b3cSmrg	      $run cp "$obj" "$gentop/$newobj"
5584145b7b3cSmrg	      oldobjs="$oldobjs $gentop/$newobj"
5585145b7b3cSmrg	      ;;
5586145b7b3cSmrg	    *) oldobjs="$oldobjs $obj" ;;
5587145b7b3cSmrg	    esac
5588145b7b3cSmrg	  done
5589145b7b3cSmrg	fi
5590145b7b3cSmrg
5591145b7b3cSmrg	eval cmds=\"$old_archive_cmds\"
5592145b7b3cSmrg
5593145b7b3cSmrg	if len=`expr "X$cmds" : ".*"` &&
5594145b7b3cSmrg	     test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
5595145b7b3cSmrg	  cmds=$old_archive_cmds
5596145b7b3cSmrg	else
5597145b7b3cSmrg	  # the command line is too long to link in one step, link in parts
5598145b7b3cSmrg	  $echo "using piecewise archive linking..."
5599145b7b3cSmrg	  save_RANLIB=$RANLIB
5600145b7b3cSmrg	  RANLIB=:
5601145b7b3cSmrg	  objlist=
5602145b7b3cSmrg	  concat_cmds=
5603145b7b3cSmrg	  save_oldobjs=$oldobjs
5604145b7b3cSmrg
5605145b7b3cSmrg	  # Is there a better way of finding the last object in the list?
5606145b7b3cSmrg	  for obj in $save_oldobjs
5607145b7b3cSmrg	  do
5608145b7b3cSmrg	    last_oldobj=$obj
5609145b7b3cSmrg	  done
5610145b7b3cSmrg	  for obj in $save_oldobjs
5611145b7b3cSmrg	  do
5612145b7b3cSmrg	    oldobjs="$objlist $obj"
5613145b7b3cSmrg	    objlist="$objlist $obj"
5614145b7b3cSmrg	    eval test_cmds=\"$old_archive_cmds\"
5615145b7b3cSmrg	    if len=`expr "X$test_cmds" : ".*" 2>/dev/null` &&
5616145b7b3cSmrg	       test "$len" -le "$max_cmd_len"; then
5617145b7b3cSmrg	      :
5618145b7b3cSmrg	    else
5619145b7b3cSmrg	      # the above command should be used before it gets too long
5620145b7b3cSmrg	      oldobjs=$objlist
5621145b7b3cSmrg	      if test "$obj" = "$last_oldobj" ; then
5622145b7b3cSmrg	        RANLIB=$save_RANLIB
5623145b7b3cSmrg	      fi
5624145b7b3cSmrg	      test -z "$concat_cmds" || concat_cmds=$concat_cmds~
5625145b7b3cSmrg	      eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\"
5626145b7b3cSmrg	      objlist=
5627145b7b3cSmrg	    fi
5628145b7b3cSmrg	  done
5629145b7b3cSmrg	  RANLIB=$save_RANLIB
5630145b7b3cSmrg	  oldobjs=$objlist
5631145b7b3cSmrg	  if test "X$oldobjs" = "X" ; then
5632145b7b3cSmrg	    eval cmds=\"\$concat_cmds\"
5633145b7b3cSmrg	  else
5634145b7b3cSmrg	    eval cmds=\"\$concat_cmds~\$old_archive_cmds\"
5635145b7b3cSmrg	  fi
5636145b7b3cSmrg	fi
5637145b7b3cSmrg      fi
5638145b7b3cSmrg      save_ifs="$IFS"; IFS='~'
5639145b7b3cSmrg      for cmd in $cmds; do
5640145b7b3cSmrg        eval cmd=\"$cmd\"
5641145b7b3cSmrg	IFS="$save_ifs"
5642145b7b3cSmrg	$show "$cmd"
5643145b7b3cSmrg	$run eval "$cmd" || exit $?
5644145b7b3cSmrg      done
5645145b7b3cSmrg      IFS="$save_ifs"
5646145b7b3cSmrg    done
5647145b7b3cSmrg
5648145b7b3cSmrg    if test -n "$generated"; then
5649145b7b3cSmrg      $show "${rm}r$generated"
5650145b7b3cSmrg      $run ${rm}r$generated
5651145b7b3cSmrg    fi
5652145b7b3cSmrg
5653145b7b3cSmrg    # Now create the libtool archive.
5654145b7b3cSmrg    case $output in
5655145b7b3cSmrg    *.la)
5656145b7b3cSmrg      old_library=
5657145b7b3cSmrg      test "$build_old_libs" = yes && old_library="$libname.$libext"
5658145b7b3cSmrg      $show "creating $output"
5659145b7b3cSmrg
5660145b7b3cSmrg      # Preserve any variables that may affect compiler behavior
5661145b7b3cSmrg      for var in $variables_saved_for_relink; do
5662145b7b3cSmrg	if eval test -z \"\${$var+set}\"; then
5663145b7b3cSmrg	  relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command"
5664145b7b3cSmrg	elif eval var_value=\$$var; test -z "$var_value"; then
5665145b7b3cSmrg	  relink_command="$var=; export $var; $relink_command"
5666145b7b3cSmrg	else
5667145b7b3cSmrg	  var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"`
5668145b7b3cSmrg	  relink_command="$var=\"$var_value\"; export $var; $relink_command"
5669145b7b3cSmrg	fi
5670145b7b3cSmrg      done
5671145b7b3cSmrg      # Quote the link command for shipping.
5672145b7b3cSmrg      relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)"
5673578741aaSmrg      relink_command=`$echo "X$relink_command" | $SP2NL | $Xsed -e "$sed_quote_subst" | $NL2SP`
5674145b7b3cSmrg      if test "$hardcode_automatic" = yes ; then
5675145b7b3cSmrg	relink_command=
5676145b7b3cSmrg      fi
5677145b7b3cSmrg
5678145b7b3cSmrg
5679145b7b3cSmrg      # Only create the output if not a dry run.
5680145b7b3cSmrg      if test -z "$run"; then
5681145b7b3cSmrg	for installed in no yes; do
5682145b7b3cSmrg	  if test "$installed" = yes; then
5683145b7b3cSmrg	    if test -z "$install_libdir"; then
5684145b7b3cSmrg	      break
5685145b7b3cSmrg	    fi
5686145b7b3cSmrg	    output="$output_objdir/$outputname"i
5687145b7b3cSmrg	    # Replace all uninstalled libtool libraries with the installed ones
5688145b7b3cSmrg	    newdependency_libs=
5689145b7b3cSmrg	    for deplib in $dependency_libs; do
5690145b7b3cSmrg	      case $deplib in
5691145b7b3cSmrg	      *.la)
5692145b7b3cSmrg		name=`$echo "X$deplib" | $Xsed -e 's%^.*/%%'`
5693145b7b3cSmrg		eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
5694145b7b3cSmrg		if test -z "$libdir"; then
5695145b7b3cSmrg		  $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
5696145b7b3cSmrg		  exit $EXIT_FAILURE
5697145b7b3cSmrg		fi
5698145b7b3cSmrg		newdependency_libs="$newdependency_libs $libdir/$name"
5699145b7b3cSmrg		;;
5700145b7b3cSmrg	      *) newdependency_libs="$newdependency_libs $deplib" ;;
5701145b7b3cSmrg	      esac
5702145b7b3cSmrg	    done
5703145b7b3cSmrg	    dependency_libs="$newdependency_libs"
5704145b7b3cSmrg	    newdlfiles=
5705145b7b3cSmrg	    for lib in $dlfiles; do
5706145b7b3cSmrg	      name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
5707145b7b3cSmrg	      eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
5708145b7b3cSmrg	      if test -z "$libdir"; then
5709145b7b3cSmrg		$echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
5710145b7b3cSmrg		exit $EXIT_FAILURE
5711145b7b3cSmrg	      fi
5712145b7b3cSmrg	      newdlfiles="$newdlfiles $libdir/$name"
5713145b7b3cSmrg	    done
5714145b7b3cSmrg	    dlfiles="$newdlfiles"
5715145b7b3cSmrg	    newdlprefiles=
5716145b7b3cSmrg	    for lib in $dlprefiles; do
5717145b7b3cSmrg	      name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
5718145b7b3cSmrg	      eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
5719145b7b3cSmrg	      if test -z "$libdir"; then
5720145b7b3cSmrg		$echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
5721145b7b3cSmrg		exit $EXIT_FAILURE
5722145b7b3cSmrg	      fi
5723145b7b3cSmrg	      newdlprefiles="$newdlprefiles $libdir/$name"
5724145b7b3cSmrg	    done
5725145b7b3cSmrg	    dlprefiles="$newdlprefiles"
5726145b7b3cSmrg	  else
5727145b7b3cSmrg	    newdlfiles=
5728145b7b3cSmrg	    for lib in $dlfiles; do
5729145b7b3cSmrg	      case $lib in
5730145b7b3cSmrg		[\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
5731145b7b3cSmrg		*) abs=`pwd`"/$lib" ;;
5732145b7b3cSmrg	      esac
5733145b7b3cSmrg	      newdlfiles="$newdlfiles $abs"
5734145b7b3cSmrg	    done
5735145b7b3cSmrg	    dlfiles="$newdlfiles"
5736145b7b3cSmrg	    newdlprefiles=
5737145b7b3cSmrg	    for lib in $dlprefiles; do
5738145b7b3cSmrg	      case $lib in
5739145b7b3cSmrg		[\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
5740145b7b3cSmrg		*) abs=`pwd`"/$lib" ;;
5741145b7b3cSmrg	      esac
5742145b7b3cSmrg	      newdlprefiles="$newdlprefiles $abs"
5743145b7b3cSmrg	    done
5744145b7b3cSmrg	    dlprefiles="$newdlprefiles"
5745145b7b3cSmrg	  fi
5746145b7b3cSmrg	  $rm $output
5747145b7b3cSmrg	  # place dlname in correct position for cygwin
5748145b7b3cSmrg	  tdlname=$dlname
5749145b7b3cSmrg	  case $host,$output,$installed,$module,$dlname in
5750145b7b3cSmrg	    *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;;
5751145b7b3cSmrg	  esac
5752145b7b3cSmrg	  $echo > $output "\
5753145b7b3cSmrg# $outputname - a libtool library file
5754145b7b3cSmrg# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
5755145b7b3cSmrg#
5756145b7b3cSmrg# Please DO NOT delete this file!
5757145b7b3cSmrg# It is necessary for linking the library.
5758145b7b3cSmrg
5759145b7b3cSmrg# The name that we can dlopen(3).
5760145b7b3cSmrgdlname='$tdlname'
5761145b7b3cSmrg
5762145b7b3cSmrg# Names of this library.
5763145b7b3cSmrglibrary_names='$library_names'
5764145b7b3cSmrg
5765145b7b3cSmrg# The name of the static archive.
5766145b7b3cSmrgold_library='$old_library'
5767145b7b3cSmrg
5768145b7b3cSmrg# Libraries that this one depends upon.
5769145b7b3cSmrgdependency_libs='$dependency_libs'
5770145b7b3cSmrg
5771145b7b3cSmrg# Version information for $libname.
5772145b7b3cSmrgcurrent=$current
5773145b7b3cSmrgage=$age
5774145b7b3cSmrgrevision=$revision
5775145b7b3cSmrg
5776145b7b3cSmrg# Is this an already installed library?
5777145b7b3cSmrginstalled=$installed
5778145b7b3cSmrg
5779145b7b3cSmrg# Should we warn about portability when linking against -modules?
5780145b7b3cSmrgshouldnotlink=$module
5781145b7b3cSmrg
5782145b7b3cSmrg# Files to dlopen/dlpreopen
5783145b7b3cSmrgdlopen='$dlfiles'
5784145b7b3cSmrgdlpreopen='$dlprefiles'
5785145b7b3cSmrg
5786145b7b3cSmrg# Directory that this library needs to be installed in:
5787145b7b3cSmrglibdir='$install_libdir'"
5788145b7b3cSmrg	  if test "$installed" = no && test "$need_relink" = yes; then
5789145b7b3cSmrg	    $echo >> $output "\
5790145b7b3cSmrgrelink_command=\"$relink_command\""
5791145b7b3cSmrg	  fi
5792145b7b3cSmrg	done
5793145b7b3cSmrg      fi
5794145b7b3cSmrg
5795145b7b3cSmrg      # Do a symbolic link so that the libtool archive can be found in
5796145b7b3cSmrg      # LD_LIBRARY_PATH before the program is installed.
5797145b7b3cSmrg      $show "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)"
5798145b7b3cSmrg      $run eval '(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)' || exit $?
5799145b7b3cSmrg      ;;
5800145b7b3cSmrg    esac
5801145b7b3cSmrg    exit $EXIT_SUCCESS
5802145b7b3cSmrg    ;;
5803145b7b3cSmrg
5804145b7b3cSmrg  # libtool install mode
5805145b7b3cSmrg  install)
5806145b7b3cSmrg    modename="$modename: install"
5807145b7b3cSmrg
5808145b7b3cSmrg    # There may be an optional sh(1) argument at the beginning of
5809145b7b3cSmrg    # install_prog (especially on Windows NT).
5810145b7b3cSmrg    if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh ||
5811145b7b3cSmrg       # Allow the use of GNU shtool's install command.
5812145b7b3cSmrg       $echo "X$nonopt" | grep shtool > /dev/null; then
5813145b7b3cSmrg      # Aesthetically quote it.
5814145b7b3cSmrg      arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"`
5815145b7b3cSmrg      case $arg in
5816145b7b3cSmrg      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
5817145b7b3cSmrg	arg="\"$arg\""
5818145b7b3cSmrg	;;
5819145b7b3cSmrg      esac
5820145b7b3cSmrg      install_prog="$arg "
5821145b7b3cSmrg      arg="$1"
5822145b7b3cSmrg      shift
5823145b7b3cSmrg    else
5824145b7b3cSmrg      install_prog=
5825145b7b3cSmrg      arg=$nonopt
5826145b7b3cSmrg    fi
5827145b7b3cSmrg
5828145b7b3cSmrg    # The real first argument should be the name of the installation program.
5829145b7b3cSmrg    # Aesthetically quote it.
5830145b7b3cSmrg    arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
5831145b7b3cSmrg    case $arg in
5832145b7b3cSmrg    *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
5833145b7b3cSmrg      arg="\"$arg\""
5834145b7b3cSmrg      ;;
5835145b7b3cSmrg    esac
5836145b7b3cSmrg    install_prog="$install_prog$arg"
5837145b7b3cSmrg
5838145b7b3cSmrg    # We need to accept at least all the BSD install flags.
5839145b7b3cSmrg    dest=
5840145b7b3cSmrg    files=
5841145b7b3cSmrg    opts=
5842145b7b3cSmrg    prev=
5843145b7b3cSmrg    install_type=
5844145b7b3cSmrg    isdir=no
5845145b7b3cSmrg    stripme=
5846145b7b3cSmrg    for arg
5847145b7b3cSmrg    do
5848145b7b3cSmrg      if test -n "$dest"; then
5849145b7b3cSmrg	files="$files $dest"
5850145b7b3cSmrg	dest=$arg
5851145b7b3cSmrg	continue
5852145b7b3cSmrg      fi
5853145b7b3cSmrg
5854145b7b3cSmrg      case $arg in
5855145b7b3cSmrg      -d) isdir=yes ;;
5856145b7b3cSmrg      -f) 
5857145b7b3cSmrg      	case " $install_prog " in
5858145b7b3cSmrg	*[\\\ /]cp\ *) ;;
5859145b7b3cSmrg	*) prev=$arg ;;
5860145b7b3cSmrg	esac
5861145b7b3cSmrg	;;
5862145b7b3cSmrg      -g | -m | -o) prev=$arg ;;
5863145b7b3cSmrg      -s)
5864145b7b3cSmrg	stripme=" -s"
5865145b7b3cSmrg	continue
5866145b7b3cSmrg	;;
5867145b7b3cSmrg      -*)
5868145b7b3cSmrg	;;
5869145b7b3cSmrg      *)
5870145b7b3cSmrg	# If the previous option needed an argument, then skip it.
5871145b7b3cSmrg	if test -n "$prev"; then
5872145b7b3cSmrg	  prev=
5873145b7b3cSmrg	else
5874145b7b3cSmrg	  dest=$arg
5875145b7b3cSmrg	  continue
5876145b7b3cSmrg	fi
5877145b7b3cSmrg	;;
5878145b7b3cSmrg      esac
5879145b7b3cSmrg
5880145b7b3cSmrg      # Aesthetically quote the argument.
5881145b7b3cSmrg      arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
5882145b7b3cSmrg      case $arg in
5883145b7b3cSmrg      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
5884145b7b3cSmrg	arg="\"$arg\""
5885145b7b3cSmrg	;;
5886145b7b3cSmrg      esac
5887145b7b3cSmrg      install_prog="$install_prog $arg"
5888145b7b3cSmrg    done
5889145b7b3cSmrg
5890145b7b3cSmrg    if test -z "$install_prog"; then
5891145b7b3cSmrg      $echo "$modename: you must specify an install program" 1>&2
5892145b7b3cSmrg      $echo "$help" 1>&2
5893145b7b3cSmrg      exit $EXIT_FAILURE
5894145b7b3cSmrg    fi
5895145b7b3cSmrg
5896145b7b3cSmrg    if test -n "$prev"; then
5897145b7b3cSmrg      $echo "$modename: the \`$prev' option requires an argument" 1>&2
5898145b7b3cSmrg      $echo "$help" 1>&2
5899145b7b3cSmrg      exit $EXIT_FAILURE
5900145b7b3cSmrg    fi
5901145b7b3cSmrg
5902145b7b3cSmrg    if test -z "$files"; then
5903145b7b3cSmrg      if test -z "$dest"; then
5904145b7b3cSmrg	$echo "$modename: no file or destination specified" 1>&2
5905145b7b3cSmrg      else
5906145b7b3cSmrg	$echo "$modename: you must specify a destination" 1>&2
5907145b7b3cSmrg      fi
5908145b7b3cSmrg      $echo "$help" 1>&2
5909145b7b3cSmrg      exit $EXIT_FAILURE
5910145b7b3cSmrg    fi
5911145b7b3cSmrg
5912145b7b3cSmrg    # Strip any trailing slash from the destination.
5913145b7b3cSmrg    dest=`$echo "X$dest" | $Xsed -e 's%/$%%'`
5914145b7b3cSmrg
5915145b7b3cSmrg    # Check to see that the destination is a directory.
5916145b7b3cSmrg    test -d "$dest" && isdir=yes
5917145b7b3cSmrg    if test "$isdir" = yes; then
5918145b7b3cSmrg      destdir="$dest"
5919145b7b3cSmrg      destname=
5920145b7b3cSmrg    else
5921145b7b3cSmrg      destdir=`$echo "X$dest" | $Xsed -e 's%/[^/]*$%%'`
5922145b7b3cSmrg      test "X$destdir" = "X$dest" && destdir=.
5923145b7b3cSmrg      destname=`$echo "X$dest" | $Xsed -e 's%^.*/%%'`
5924145b7b3cSmrg
5925145b7b3cSmrg      # Not a directory, so check to see that there is only one file specified.
5926145b7b3cSmrg      set dummy $files
5927145b7b3cSmrg      if test "$#" -gt 2; then
5928145b7b3cSmrg	$echo "$modename: \`$dest' is not a directory" 1>&2
5929145b7b3cSmrg	$echo "$help" 1>&2
5930145b7b3cSmrg	exit $EXIT_FAILURE
5931145b7b3cSmrg      fi
5932145b7b3cSmrg    fi
5933145b7b3cSmrg    case $destdir in
5934145b7b3cSmrg    [\\/]* | [A-Za-z]:[\\/]*) ;;
5935145b7b3cSmrg    *)
5936145b7b3cSmrg      for file in $files; do
5937145b7b3cSmrg	case $file in
5938145b7b3cSmrg	*.lo) ;;
5939145b7b3cSmrg	*)
5940145b7b3cSmrg	  $echo "$modename: \`$destdir' must be an absolute directory name" 1>&2
5941145b7b3cSmrg	  $echo "$help" 1>&2
5942145b7b3cSmrg	  exit $EXIT_FAILURE
5943145b7b3cSmrg	  ;;
5944145b7b3cSmrg	esac
5945145b7b3cSmrg      done
5946145b7b3cSmrg      ;;
5947145b7b3cSmrg    esac
5948145b7b3cSmrg
5949145b7b3cSmrg    # This variable tells wrapper scripts just to set variables rather
5950145b7b3cSmrg    # than running their programs.
5951145b7b3cSmrg    libtool_install_magic="$magic"
5952145b7b3cSmrg
5953145b7b3cSmrg    staticlibs=
5954145b7b3cSmrg    future_libdirs=
5955145b7b3cSmrg    current_libdirs=
5956145b7b3cSmrg    for file in $files; do
5957145b7b3cSmrg
5958145b7b3cSmrg      # Do each installation.
5959145b7b3cSmrg      case $file in
5960145b7b3cSmrg      *.$libext)
5961145b7b3cSmrg	# Do the static libraries later.
5962145b7b3cSmrg	staticlibs="$staticlibs $file"
5963145b7b3cSmrg	;;
5964145b7b3cSmrg
5965145b7b3cSmrg      *.la)
5966145b7b3cSmrg	# Check to see that this really is a libtool archive.
5967145b7b3cSmrg	if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
5968145b7b3cSmrg	else
5969145b7b3cSmrg	  $echo "$modename: \`$file' is not a valid libtool archive" 1>&2
5970145b7b3cSmrg	  $echo "$help" 1>&2
5971145b7b3cSmrg	  exit $EXIT_FAILURE
5972145b7b3cSmrg	fi
5973145b7b3cSmrg
5974145b7b3cSmrg	library_names=
5975145b7b3cSmrg	old_library=
5976145b7b3cSmrg	relink_command=
5977145b7b3cSmrg	# If there is no directory component, then add one.
5978145b7b3cSmrg	case $file in
5979145b7b3cSmrg	*/* | *\\*) . $file ;;
5980145b7b3cSmrg	*) . ./$file ;;
5981145b7b3cSmrg	esac
5982145b7b3cSmrg
5983145b7b3cSmrg	# Add the libdir to current_libdirs if it is the destination.
5984145b7b3cSmrg	if test "X$destdir" = "X$libdir"; then
5985145b7b3cSmrg	  case "$current_libdirs " in
5986145b7b3cSmrg	  *" $libdir "*) ;;
5987145b7b3cSmrg	  *) current_libdirs="$current_libdirs $libdir" ;;
5988145b7b3cSmrg	  esac
5989145b7b3cSmrg	else
5990145b7b3cSmrg	  # Note the libdir as a future libdir.
5991145b7b3cSmrg	  case "$future_libdirs " in
5992145b7b3cSmrg	  *" $libdir "*) ;;
5993145b7b3cSmrg	  *) future_libdirs="$future_libdirs $libdir" ;;
5994145b7b3cSmrg	  esac
5995145b7b3cSmrg	fi
5996145b7b3cSmrg
5997145b7b3cSmrg	dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`/
5998145b7b3cSmrg	test "X$dir" = "X$file/" && dir=
5999145b7b3cSmrg	dir="$dir$objdir"
6000145b7b3cSmrg
6001145b7b3cSmrg	if test -n "$relink_command"; then
6002145b7b3cSmrg	  # Determine the prefix the user has applied to our future dir.
6003145b7b3cSmrg	  inst_prefix_dir=`$echo "$destdir" | $SED "s%$libdir\$%%"`
6004145b7b3cSmrg
6005145b7b3cSmrg	  # Don't allow the user to place us outside of our expected
6006145b7b3cSmrg	  # location b/c this prevents finding dependent libraries that
6007145b7b3cSmrg	  # are installed to the same prefix.
6008145b7b3cSmrg	  # At present, this check doesn't affect windows .dll's that
6009145b7b3cSmrg	  # are installed into $libdir/../bin (currently, that works fine)
6010145b7b3cSmrg	  # but it's something to keep an eye on.
6011145b7b3cSmrg	  if test "$inst_prefix_dir" = "$destdir"; then
6012145b7b3cSmrg	    $echo "$modename: error: cannot install \`$file' to a directory not ending in $libdir" 1>&2
6013145b7b3cSmrg	    exit $EXIT_FAILURE
6014145b7b3cSmrg	  fi
6015145b7b3cSmrg
6016145b7b3cSmrg	  if test -n "$inst_prefix_dir"; then
6017145b7b3cSmrg	    # Stick the inst_prefix_dir data into the link command.
6018578741aaSmrg	    relink_command=`$echo "$relink_command" | $SP2NL | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%" | $NL2SP`
6019145b7b3cSmrg	  else
6020578741aaSmrg	    relink_command=`$echo "$relink_command" | $SP2NL | $SED "s%@inst_prefix_dir@%%" | $NL2SP`
6021145b7b3cSmrg	  fi
6022145b7b3cSmrg
6023145b7b3cSmrg	  $echo "$modename: warning: relinking \`$file'" 1>&2
6024145b7b3cSmrg	  $show "$relink_command"
6025145b7b3cSmrg	  if $run eval "$relink_command"; then :
6026145b7b3cSmrg	  else
6027145b7b3cSmrg	    $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
6028145b7b3cSmrg	    exit $EXIT_FAILURE
6029145b7b3cSmrg	  fi
6030145b7b3cSmrg	fi
6031145b7b3cSmrg
6032145b7b3cSmrg	# See the names of the shared library.
6033145b7b3cSmrg	set dummy $library_names
6034145b7b3cSmrg	if test -n "$2"; then
6035145b7b3cSmrg	  realname="$2"
6036145b7b3cSmrg	  shift
6037145b7b3cSmrg	  shift
6038145b7b3cSmrg
6039145b7b3cSmrg	  srcname="$realname"
6040145b7b3cSmrg	  test -n "$relink_command" && srcname="$realname"T
6041145b7b3cSmrg
6042145b7b3cSmrg	  # Install the shared library and build the symlinks.
6043145b7b3cSmrg	  $show "$install_prog $dir/$srcname $destdir/$realname"
6044145b7b3cSmrg	  $run eval "$install_prog $dir/$srcname $destdir/$realname" || exit $?
6045145b7b3cSmrg	  if test -n "$stripme" && test -n "$striplib"; then
6046145b7b3cSmrg	    $show "$striplib $destdir/$realname"
6047145b7b3cSmrg	    $run eval "$striplib $destdir/$realname" || exit $?
6048145b7b3cSmrg	  fi
6049145b7b3cSmrg
6050145b7b3cSmrg	  if test "$#" -gt 0; then
6051145b7b3cSmrg	    # Delete the old symlinks, and create new ones.
6052145b7b3cSmrg	    # Try `ln -sf' first, because the `ln' binary might depend on
6053145b7b3cSmrg	    # the symlink we replace!  Solaris /bin/ln does not understand -f,
6054145b7b3cSmrg	    # so we also need to try rm && ln -s.
6055145b7b3cSmrg	    for linkname
6056145b7b3cSmrg	    do
6057145b7b3cSmrg	      if test "$linkname" != "$realname"; then
6058145b7b3cSmrg                $show "(cd $destdir && { $LN_S -f $realname $linkname || { $rm $linkname && $LN_S $realname $linkname; }; })"
6059145b7b3cSmrg                $run eval "(cd $destdir && { $LN_S -f $realname $linkname || { $rm $linkname && $LN_S $realname $linkname; }; })"
6060145b7b3cSmrg	      fi
6061145b7b3cSmrg	    done
6062145b7b3cSmrg	  fi
6063145b7b3cSmrg
6064145b7b3cSmrg	  # Do each command in the postinstall commands.
6065145b7b3cSmrg	  lib="$destdir/$realname"
6066145b7b3cSmrg	  cmds=$postinstall_cmds
6067145b7b3cSmrg	  save_ifs="$IFS"; IFS='~'
6068145b7b3cSmrg	  for cmd in $cmds; do
6069145b7b3cSmrg	    IFS="$save_ifs"
6070145b7b3cSmrg	    eval cmd=\"$cmd\"
6071145b7b3cSmrg	    $show "$cmd"
6072145b7b3cSmrg	    $run eval "$cmd" || {
6073145b7b3cSmrg	      lt_exit=$?
6074145b7b3cSmrg
6075145b7b3cSmrg	      # Restore the uninstalled library and exit
6076145b7b3cSmrg	      if test "$mode" = relink; then
6077145b7b3cSmrg		$run eval '(cd $output_objdir && $rm ${realname}T && $mv ${realname}U $realname)'
6078145b7b3cSmrg	      fi
6079145b7b3cSmrg
6080145b7b3cSmrg	      exit $lt_exit
6081145b7b3cSmrg	    }
6082145b7b3cSmrg	  done
6083145b7b3cSmrg	  IFS="$save_ifs"
6084145b7b3cSmrg	fi
6085145b7b3cSmrg
6086145b7b3cSmrg	# Install the pseudo-library for information purposes.
6087145b7b3cSmrg	name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
6088145b7b3cSmrg	instname="$dir/$name"i
6089145b7b3cSmrg	$show "$install_prog $instname $destdir/$name"
6090145b7b3cSmrg	$run eval "$install_prog $instname $destdir/$name" || exit $?
6091145b7b3cSmrg
6092145b7b3cSmrg	# Maybe install the static library, too.
6093145b7b3cSmrg	test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library"
6094145b7b3cSmrg	;;
6095145b7b3cSmrg
6096145b7b3cSmrg      *.lo)
6097145b7b3cSmrg	# Install (i.e. copy) a libtool object.
6098145b7b3cSmrg
6099145b7b3cSmrg	# Figure out destination file name, if it wasn't already specified.
6100145b7b3cSmrg	if test -n "$destname"; then
6101145b7b3cSmrg	  destfile="$destdir/$destname"
6102145b7b3cSmrg	else
6103145b7b3cSmrg	  destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
6104145b7b3cSmrg	  destfile="$destdir/$destfile"
6105145b7b3cSmrg	fi
6106145b7b3cSmrg
6107145b7b3cSmrg	# Deduce the name of the destination old-style object file.
6108145b7b3cSmrg	case $destfile in
6109145b7b3cSmrg	*.lo)
6110145b7b3cSmrg	  staticdest=`$echo "X$destfile" | $Xsed -e "$lo2o"`
6111145b7b3cSmrg	  ;;
6112145b7b3cSmrg	*.$objext)
6113145b7b3cSmrg	  staticdest="$destfile"
6114145b7b3cSmrg	  destfile=
6115145b7b3cSmrg	  ;;
6116145b7b3cSmrg	*)
6117145b7b3cSmrg	  $echo "$modename: cannot copy a libtool object to \`$destfile'" 1>&2
6118145b7b3cSmrg	  $echo "$help" 1>&2
6119145b7b3cSmrg	  exit $EXIT_FAILURE
6120145b7b3cSmrg	  ;;
6121145b7b3cSmrg	esac
6122145b7b3cSmrg
6123145b7b3cSmrg	# Install the libtool object if requested.
6124145b7b3cSmrg	if test -n "$destfile"; then
6125145b7b3cSmrg	  $show "$install_prog $file $destfile"
6126145b7b3cSmrg	  $run eval "$install_prog $file $destfile" || exit $?
6127145b7b3cSmrg	fi
6128145b7b3cSmrg
6129145b7b3cSmrg	# Install the old object if enabled.
6130145b7b3cSmrg	if test "$build_old_libs" = yes; then
6131145b7b3cSmrg	  # Deduce the name of the old-style object file.
6132145b7b3cSmrg	  staticobj=`$echo "X$file" | $Xsed -e "$lo2o"`
6133145b7b3cSmrg
6134145b7b3cSmrg	  $show "$install_prog $staticobj $staticdest"
6135145b7b3cSmrg	  $run eval "$install_prog \$staticobj \$staticdest" || exit $?
6136145b7b3cSmrg	fi
6137145b7b3cSmrg	exit $EXIT_SUCCESS
6138145b7b3cSmrg	;;
6139145b7b3cSmrg
6140145b7b3cSmrg      *)
6141145b7b3cSmrg	# Figure out destination file name, if it wasn't already specified.
6142145b7b3cSmrg	if test -n "$destname"; then
6143145b7b3cSmrg	  destfile="$destdir/$destname"
6144145b7b3cSmrg	else
6145145b7b3cSmrg	  destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
6146145b7b3cSmrg	  destfile="$destdir/$destfile"
6147145b7b3cSmrg	fi
6148145b7b3cSmrg
6149145b7b3cSmrg	# If the file is missing, and there is a .exe on the end, strip it
6150145b7b3cSmrg	# because it is most likely a libtool script we actually want to
6151145b7b3cSmrg	# install
6152145b7b3cSmrg	stripped_ext=""
6153145b7b3cSmrg	case $file in
6154145b7b3cSmrg	  *.exe)
6155145b7b3cSmrg	    if test ! -f "$file"; then
6156145b7b3cSmrg	      file=`$echo $file|${SED} 's,.exe$,,'`
6157145b7b3cSmrg	      stripped_ext=".exe"
6158145b7b3cSmrg	    fi
6159145b7b3cSmrg	    ;;
6160145b7b3cSmrg	esac
6161145b7b3cSmrg
6162145b7b3cSmrg	# Do a test to see if this is really a libtool program.
6163145b7b3cSmrg	case $host in
6164145b7b3cSmrg	*cygwin*|*mingw*)
6165145b7b3cSmrg	    wrapper=`$echo $file | ${SED} -e 's,.exe$,,'`
6166145b7b3cSmrg	    ;;
6167145b7b3cSmrg	*)
6168145b7b3cSmrg	    wrapper=$file
6169145b7b3cSmrg	    ;;
6170145b7b3cSmrg	esac
6171145b7b3cSmrg	if (${SED} -e '4q' $wrapper | grep "^# Generated by .*$PACKAGE")>/dev/null 2>&1; then
6172145b7b3cSmrg	  notinst_deplibs=
6173145b7b3cSmrg	  relink_command=
6174145b7b3cSmrg
6175145b7b3cSmrg	  # Note that it is not necessary on cygwin/mingw to append a dot to
6176145b7b3cSmrg	  # foo even if both foo and FILE.exe exist: automatic-append-.exe
6177145b7b3cSmrg	  # behavior happens only for exec(3), not for open(2)!  Also, sourcing
6178145b7b3cSmrg	  # `FILE.' does not work on cygwin managed mounts.
6179145b7b3cSmrg	  #
6180145b7b3cSmrg	  # If there is no directory component, then add one.
6181145b7b3cSmrg	  case $wrapper in
6182145b7b3cSmrg	  */* | *\\*) . ${wrapper} ;;
6183145b7b3cSmrg	  *) . ./${wrapper} ;;
6184145b7b3cSmrg	  esac
6185145b7b3cSmrg
6186145b7b3cSmrg	  # Check the variables that should have been set.
6187145b7b3cSmrg	  if test -z "$notinst_deplibs"; then
6188145b7b3cSmrg	    $echo "$modename: invalid libtool wrapper script \`$wrapper'" 1>&2
6189145b7b3cSmrg	    exit $EXIT_FAILURE
6190145b7b3cSmrg	  fi
6191145b7b3cSmrg
6192145b7b3cSmrg	  finalize=yes
6193145b7b3cSmrg	  for lib in $notinst_deplibs; do
6194145b7b3cSmrg	    # Check to see that each library is installed.
6195145b7b3cSmrg	    libdir=
6196145b7b3cSmrg	    if test -f "$lib"; then
6197145b7b3cSmrg	      # If there is no directory component, then add one.
6198145b7b3cSmrg	      case $lib in
6199145b7b3cSmrg	      */* | *\\*) . $lib ;;
6200145b7b3cSmrg	      *) . ./$lib ;;
6201145b7b3cSmrg	      esac
6202145b7b3cSmrg	    fi
6203145b7b3cSmrg	    libfile="$libdir/"`$echo "X$lib" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test
6204145b7b3cSmrg	    if test -n "$libdir" && test ! -f "$libfile"; then
6205145b7b3cSmrg	      $echo "$modename: warning: \`$lib' has not been installed in \`$libdir'" 1>&2
6206145b7b3cSmrg	      finalize=no
6207145b7b3cSmrg	    fi
6208145b7b3cSmrg	  done
6209145b7b3cSmrg
6210145b7b3cSmrg	  relink_command=
6211145b7b3cSmrg	  # Note that it is not necessary on cygwin/mingw to append a dot to
6212145b7b3cSmrg	  # foo even if both foo and FILE.exe exist: automatic-append-.exe
6213145b7b3cSmrg	  # behavior happens only for exec(3), not for open(2)!  Also, sourcing
6214145b7b3cSmrg	  # `FILE.' does not work on cygwin managed mounts.
6215145b7b3cSmrg	  #
6216145b7b3cSmrg	  # If there is no directory component, then add one.
6217145b7b3cSmrg	  case $wrapper in
6218145b7b3cSmrg	  */* | *\\*) . ${wrapper} ;;
6219145b7b3cSmrg	  *) . ./${wrapper} ;;
6220145b7b3cSmrg	  esac
6221145b7b3cSmrg
6222145b7b3cSmrg	  outputname=
6223145b7b3cSmrg	  if test "$fast_install" = no && test -n "$relink_command"; then
6224145b7b3cSmrg	    if test "$finalize" = yes && test -z "$run"; then
6225145b7b3cSmrg	      tmpdir=`func_mktempdir`
6226145b7b3cSmrg	      file=`$echo "X$file$stripped_ext" | $Xsed -e 's%^.*/%%'`
6227145b7b3cSmrg	      outputname="$tmpdir/$file"
6228145b7b3cSmrg	      # Replace the output file specification.
6229578741aaSmrg	      relink_command=`$echo "X$relink_command" | $SP2NL | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g' | $NL2SP`
6230145b7b3cSmrg
6231145b7b3cSmrg	      $show "$relink_command"
6232145b7b3cSmrg	      if $run eval "$relink_command"; then :
6233145b7b3cSmrg	      else
6234145b7b3cSmrg		$echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
6235145b7b3cSmrg		${rm}r "$tmpdir"
6236145b7b3cSmrg		continue
6237145b7b3cSmrg	      fi
6238145b7b3cSmrg	      file="$outputname"
6239145b7b3cSmrg	    else
6240145b7b3cSmrg	      $echo "$modename: warning: cannot relink \`$file'" 1>&2
6241145b7b3cSmrg	    fi
6242145b7b3cSmrg	  else
6243145b7b3cSmrg	    # Install the binary that we compiled earlier.
6244145b7b3cSmrg	    file=`$echo "X$file$stripped_ext" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"`
6245145b7b3cSmrg	  fi
6246145b7b3cSmrg	fi
6247145b7b3cSmrg
6248145b7b3cSmrg	# remove .exe since cygwin /usr/bin/install will append another
6249145b7b3cSmrg	# one anyway 
6250145b7b3cSmrg	case $install_prog,$host in
6251145b7b3cSmrg	*/usr/bin/install*,*cygwin*)
6252145b7b3cSmrg	  case $file:$destfile in
6253145b7b3cSmrg	  *.exe:*.exe)
6254145b7b3cSmrg	    # this is ok
6255145b7b3cSmrg	    ;;
6256145b7b3cSmrg	  *.exe:*)
6257145b7b3cSmrg	    destfile=$destfile.exe
6258145b7b3cSmrg	    ;;
6259145b7b3cSmrg	  *:*.exe)
6260145b7b3cSmrg	    destfile=`$echo $destfile | ${SED} -e 's,.exe$,,'`
6261145b7b3cSmrg	    ;;
6262145b7b3cSmrg	  esac
6263145b7b3cSmrg	  ;;
6264145b7b3cSmrg	esac
6265145b7b3cSmrg	$show "$install_prog$stripme $file $destfile"
6266145b7b3cSmrg	$run eval "$install_prog\$stripme \$file \$destfile" || exit $?
6267145b7b3cSmrg	test -n "$outputname" && ${rm}r "$tmpdir"
6268145b7b3cSmrg	;;
6269145b7b3cSmrg      esac
6270145b7b3cSmrg    done
6271145b7b3cSmrg
6272145b7b3cSmrg    for file in $staticlibs; do
6273145b7b3cSmrg      name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
6274145b7b3cSmrg
6275145b7b3cSmrg      # Set up the ranlib parameters.
6276145b7b3cSmrg      oldlib="$destdir/$name"
6277145b7b3cSmrg
6278145b7b3cSmrg      $show "$install_prog $file $oldlib"
6279145b7b3cSmrg      $run eval "$install_prog \$file \$oldlib" || exit $?
6280145b7b3cSmrg
6281145b7b3cSmrg      if test -n "$stripme" && test -n "$old_striplib"; then
6282145b7b3cSmrg	$show "$old_striplib $oldlib"
6283145b7b3cSmrg	$run eval "$old_striplib $oldlib" || exit $?
6284145b7b3cSmrg      fi
6285145b7b3cSmrg
6286145b7b3cSmrg      # Do each command in the postinstall commands.
6287145b7b3cSmrg      cmds=$old_postinstall_cmds
6288145b7b3cSmrg      save_ifs="$IFS"; IFS='~'
6289145b7b3cSmrg      for cmd in $cmds; do
6290145b7b3cSmrg	IFS="$save_ifs"
6291145b7b3cSmrg	eval cmd=\"$cmd\"
6292145b7b3cSmrg	$show "$cmd"
6293145b7b3cSmrg	$run eval "$cmd" || exit $?
6294145b7b3cSmrg      done
6295145b7b3cSmrg      IFS="$save_ifs"
6296145b7b3cSmrg    done
6297145b7b3cSmrg
6298145b7b3cSmrg    if test -n "$future_libdirs"; then
6299145b7b3cSmrg      $echo "$modename: warning: remember to run \`$progname --finish$future_libdirs'" 1>&2
6300145b7b3cSmrg    fi
6301145b7b3cSmrg
6302145b7b3cSmrg    if test -n "$current_libdirs"; then
6303145b7b3cSmrg      # Maybe just do a dry run.
6304145b7b3cSmrg      test -n "$run" && current_libdirs=" -n$current_libdirs"
6305145b7b3cSmrg      exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs'
6306145b7b3cSmrg    else
6307145b7b3cSmrg      exit $EXIT_SUCCESS
6308145b7b3cSmrg    fi
6309145b7b3cSmrg    ;;
6310145b7b3cSmrg
6311145b7b3cSmrg  # libtool finish mode
6312145b7b3cSmrg  finish)
6313145b7b3cSmrg    modename="$modename: finish"
6314145b7b3cSmrg    libdirs="$nonopt"
6315145b7b3cSmrg    admincmds=
6316145b7b3cSmrg
6317145b7b3cSmrg    if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
6318145b7b3cSmrg      for dir
6319145b7b3cSmrg      do
6320145b7b3cSmrg	libdirs="$libdirs $dir"
6321145b7b3cSmrg      done
6322145b7b3cSmrg
6323145b7b3cSmrg      for libdir in $libdirs; do
6324145b7b3cSmrg	if test -n "$finish_cmds"; then
6325145b7b3cSmrg	  # Do each command in the finish commands.
6326145b7b3cSmrg	  cmds=$finish_cmds
6327145b7b3cSmrg	  save_ifs="$IFS"; IFS='~'
6328145b7b3cSmrg	  for cmd in $cmds; do
6329145b7b3cSmrg	    IFS="$save_ifs"
6330145b7b3cSmrg	    eval cmd=\"$cmd\"
6331145b7b3cSmrg	    $show "$cmd"
6332145b7b3cSmrg	    $run eval "$cmd" || admincmds="$admincmds
6333145b7b3cSmrg       $cmd"
6334145b7b3cSmrg	  done
6335145b7b3cSmrg	  IFS="$save_ifs"
6336145b7b3cSmrg	fi
6337145b7b3cSmrg	if test -n "$finish_eval"; then
6338145b7b3cSmrg	  # Do the single finish_eval.
6339145b7b3cSmrg	  eval cmds=\"$finish_eval\"
6340145b7b3cSmrg	  $run eval "$cmds" || admincmds="$admincmds
6341145b7b3cSmrg       $cmds"
6342145b7b3cSmrg	fi
6343145b7b3cSmrg      done
6344145b7b3cSmrg    fi
6345145b7b3cSmrg
6346145b7b3cSmrg    # Exit here if they wanted silent mode.
6347145b7b3cSmrg    test "$show" = : && exit $EXIT_SUCCESS
6348145b7b3cSmrg
6349145b7b3cSmrg    $echo "X----------------------------------------------------------------------" | $Xsed
6350145b7b3cSmrg    $echo "Libraries have been installed in:"
6351145b7b3cSmrg    for libdir in $libdirs; do
6352145b7b3cSmrg      $echo "   $libdir"
6353145b7b3cSmrg    done
6354145b7b3cSmrg    $echo
6355145b7b3cSmrg    $echo "If you ever happen to want to link against installed libraries"
6356145b7b3cSmrg    $echo "in a given directory, LIBDIR, you must either use libtool, and"
6357145b7b3cSmrg    $echo "specify the full pathname of the library, or use the \`-LLIBDIR'"
6358145b7b3cSmrg    $echo "flag during linking and do at least one of the following:"
6359145b7b3cSmrg    if test -n "$shlibpath_var"; then
6360145b7b3cSmrg      $echo "   - add LIBDIR to the \`$shlibpath_var' environment variable"
6361145b7b3cSmrg      $echo "     during execution"
6362145b7b3cSmrg    fi
6363145b7b3cSmrg    if test -n "$runpath_var"; then
6364145b7b3cSmrg      $echo "   - add LIBDIR to the \`$runpath_var' environment variable"
6365145b7b3cSmrg      $echo "     during linking"
6366145b7b3cSmrg    fi
6367145b7b3cSmrg    if test -n "$hardcode_libdir_flag_spec"; then
6368145b7b3cSmrg      libdir=LIBDIR
6369145b7b3cSmrg      eval flag=\"$hardcode_libdir_flag_spec\"
6370145b7b3cSmrg
6371145b7b3cSmrg      $echo "   - use the \`$flag' linker flag"
6372145b7b3cSmrg    fi
6373145b7b3cSmrg    if test -n "$admincmds"; then
6374145b7b3cSmrg      $echo "   - have your system administrator run these commands:$admincmds"
6375145b7b3cSmrg    fi
6376145b7b3cSmrg    if test -f /etc/ld.so.conf; then
6377145b7b3cSmrg      $echo "   - have your system administrator add LIBDIR to \`/etc/ld.so.conf'"
6378145b7b3cSmrg    fi
6379145b7b3cSmrg    $echo
6380145b7b3cSmrg    $echo "See any operating system documentation about shared libraries for"
6381145b7b3cSmrg    $echo "more information, such as the ld(1) and ld.so(8) manual pages."
6382145b7b3cSmrg    $echo "X----------------------------------------------------------------------" | $Xsed
6383145b7b3cSmrg    exit $EXIT_SUCCESS
6384145b7b3cSmrg    ;;
6385145b7b3cSmrg
6386145b7b3cSmrg  # libtool execute mode
6387145b7b3cSmrg  execute)
6388145b7b3cSmrg    modename="$modename: execute"
6389145b7b3cSmrg
6390145b7b3cSmrg    # The first argument is the command name.
6391145b7b3cSmrg    cmd="$nonopt"
6392145b7b3cSmrg    if test -z "$cmd"; then
6393145b7b3cSmrg      $echo "$modename: you must specify a COMMAND" 1>&2
6394145b7b3cSmrg      $echo "$help"
6395145b7b3cSmrg      exit $EXIT_FAILURE
6396145b7b3cSmrg    fi
6397145b7b3cSmrg
6398145b7b3cSmrg    # Handle -dlopen flags immediately.
6399145b7b3cSmrg    for file in $execute_dlfiles; do
6400145b7b3cSmrg      if test ! -f "$file"; then
6401145b7b3cSmrg	$echo "$modename: \`$file' is not a file" 1>&2
6402145b7b3cSmrg	$echo "$help" 1>&2
6403145b7b3cSmrg	exit $EXIT_FAILURE
6404145b7b3cSmrg      fi
6405145b7b3cSmrg
6406145b7b3cSmrg      dir=
6407145b7b3cSmrg      case $file in
6408145b7b3cSmrg      *.la)
6409145b7b3cSmrg	# Check to see that this really is a libtool archive.
6410145b7b3cSmrg	if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
6411145b7b3cSmrg	else
6412145b7b3cSmrg	  $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
6413145b7b3cSmrg	  $echo "$help" 1>&2
6414145b7b3cSmrg	  exit $EXIT_FAILURE
6415145b7b3cSmrg	fi
6416145b7b3cSmrg
6417145b7b3cSmrg	# Read the libtool library.
6418145b7b3cSmrg	dlname=
6419145b7b3cSmrg	library_names=
6420145b7b3cSmrg
6421145b7b3cSmrg	# If there is no directory component, then add one.
6422145b7b3cSmrg	case $file in
6423145b7b3cSmrg	*/* | *\\*) . $file ;;
6424145b7b3cSmrg	*) . ./$file ;;
6425145b7b3cSmrg	esac
6426145b7b3cSmrg
6427145b7b3cSmrg	# Skip this library if it cannot be dlopened.
6428145b7b3cSmrg	if test -z "$dlname"; then
6429145b7b3cSmrg	  # Warn if it was a shared library.
6430145b7b3cSmrg	  test -n "$library_names" && $echo "$modename: warning: \`$file' was not linked with \`-export-dynamic'"
6431145b7b3cSmrg	  continue
6432145b7b3cSmrg	fi
6433145b7b3cSmrg
6434145b7b3cSmrg	dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
6435145b7b3cSmrg	test "X$dir" = "X$file" && dir=.
6436145b7b3cSmrg
6437145b7b3cSmrg	if test -f "$dir/$objdir/$dlname"; then
6438145b7b3cSmrg	  dir="$dir/$objdir"
6439145b7b3cSmrg	else
6440578741aaSmrg	  if test ! -f "$dir/$dlname"; then
6441578741aaSmrg	    $echo "$modename: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2
6442578741aaSmrg	    exit $EXIT_FAILURE
6443578741aaSmrg	  fi
6444145b7b3cSmrg	fi
6445145b7b3cSmrg	;;
6446145b7b3cSmrg
6447145b7b3cSmrg      *.lo)
6448145b7b3cSmrg	# Just add the directory containing the .lo file.
6449145b7b3cSmrg	dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
6450145b7b3cSmrg	test "X$dir" = "X$file" && dir=.
6451145b7b3cSmrg	;;
6452145b7b3cSmrg
6453145b7b3cSmrg      *)
6454145b7b3cSmrg	$echo "$modename: warning \`-dlopen' is ignored for non-libtool libraries and objects" 1>&2
6455145b7b3cSmrg	continue
6456145b7b3cSmrg	;;
6457145b7b3cSmrg      esac
6458145b7b3cSmrg
6459145b7b3cSmrg      # Get the absolute pathname.
6460145b7b3cSmrg      absdir=`cd "$dir" && pwd`
6461145b7b3cSmrg      test -n "$absdir" && dir="$absdir"
6462145b7b3cSmrg
6463145b7b3cSmrg      # Now add the directory to shlibpath_var.
6464145b7b3cSmrg      if eval "test -z \"\$$shlibpath_var\""; then
6465145b7b3cSmrg	eval "$shlibpath_var=\"\$dir\""
6466145b7b3cSmrg      else
6467145b7b3cSmrg	eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\""
6468145b7b3cSmrg      fi
6469145b7b3cSmrg    done
6470145b7b3cSmrg
6471145b7b3cSmrg    # This variable tells wrapper scripts just to set shlibpath_var
6472145b7b3cSmrg    # rather than running their programs.
6473145b7b3cSmrg    libtool_execute_magic="$magic"
6474145b7b3cSmrg
6475145b7b3cSmrg    # Check if any of the arguments is a wrapper script.
6476145b7b3cSmrg    args=
6477145b7b3cSmrg    for file
6478145b7b3cSmrg    do
6479145b7b3cSmrg      case $file in
6480145b7b3cSmrg      -*) ;;
6481145b7b3cSmrg      *)
6482145b7b3cSmrg	# Do a test to see if this is really a libtool program.
6483145b7b3cSmrg	if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
6484145b7b3cSmrg	  # If there is no directory component, then add one.
6485145b7b3cSmrg	  case $file in
6486145b7b3cSmrg	  */* | *\\*) . $file ;;
6487145b7b3cSmrg	  *) . ./$file ;;
6488145b7b3cSmrg	  esac
6489145b7b3cSmrg
6490145b7b3cSmrg	  # Transform arg to wrapped name.
6491145b7b3cSmrg	  file="$progdir/$program"
6492145b7b3cSmrg	fi
6493145b7b3cSmrg	;;
6494145b7b3cSmrg      esac
6495145b7b3cSmrg      # Quote arguments (to preserve shell metacharacters).
6496145b7b3cSmrg      file=`$echo "X$file" | $Xsed -e "$sed_quote_subst"`
6497145b7b3cSmrg      args="$args \"$file\""
6498145b7b3cSmrg    done
6499145b7b3cSmrg
6500145b7b3cSmrg    if test -z "$run"; then
6501145b7b3cSmrg      if test -n "$shlibpath_var"; then
6502145b7b3cSmrg	# Export the shlibpath_var.
6503145b7b3cSmrg	eval "export $shlibpath_var"
6504145b7b3cSmrg      fi
6505145b7b3cSmrg
6506145b7b3cSmrg      # Restore saved environment variables
6507578741aaSmrg      for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
6508578741aaSmrg      do
6509578741aaSmrg	eval "if test \"\${save_$lt_var+set}\" = set; then
6510578741aaSmrg		$lt_var=\$save_$lt_var; export $lt_var
6511578741aaSmrg	      fi"
6512578741aaSmrg      done
6513145b7b3cSmrg
6514145b7b3cSmrg      # Now prepare to actually exec the command.
6515145b7b3cSmrg      exec_cmd="\$cmd$args"
6516145b7b3cSmrg    else
6517145b7b3cSmrg      # Display what would be done.
6518145b7b3cSmrg      if test -n "$shlibpath_var"; then
6519145b7b3cSmrg	eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\""
6520145b7b3cSmrg	$echo "export $shlibpath_var"
6521145b7b3cSmrg      fi
6522145b7b3cSmrg      $echo "$cmd$args"
6523145b7b3cSmrg      exit $EXIT_SUCCESS
6524145b7b3cSmrg    fi
6525145b7b3cSmrg    ;;
6526145b7b3cSmrg
6527145b7b3cSmrg  # libtool clean and uninstall mode
6528145b7b3cSmrg  clean | uninstall)
6529145b7b3cSmrg    modename="$modename: $mode"
6530145b7b3cSmrg    rm="$nonopt"
6531145b7b3cSmrg    files=
6532145b7b3cSmrg    rmforce=
6533145b7b3cSmrg    exit_status=0
6534145b7b3cSmrg
6535145b7b3cSmrg    # This variable tells wrapper scripts just to set variables rather
6536145b7b3cSmrg    # than running their programs.
6537145b7b3cSmrg    libtool_install_magic="$magic"
6538145b7b3cSmrg
6539145b7b3cSmrg    for arg
6540145b7b3cSmrg    do
6541145b7b3cSmrg      case $arg in
6542145b7b3cSmrg      -f) rm="$rm $arg"; rmforce=yes ;;
6543145b7b3cSmrg      -*) rm="$rm $arg" ;;
6544145b7b3cSmrg      *) files="$files $arg" ;;
6545145b7b3cSmrg      esac
6546145b7b3cSmrg    done
6547145b7b3cSmrg
6548145b7b3cSmrg    if test -z "$rm"; then
6549145b7b3cSmrg      $echo "$modename: you must specify an RM program" 1>&2
6550145b7b3cSmrg      $echo "$help" 1>&2
6551145b7b3cSmrg      exit $EXIT_FAILURE
6552145b7b3cSmrg    fi
6553145b7b3cSmrg
6554145b7b3cSmrg    rmdirs=
6555145b7b3cSmrg
6556145b7b3cSmrg    origobjdir="$objdir"
6557145b7b3cSmrg    for file in $files; do
6558145b7b3cSmrg      dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
6559145b7b3cSmrg      if test "X$dir" = "X$file"; then
6560145b7b3cSmrg	dir=.
6561145b7b3cSmrg	objdir="$origobjdir"
6562145b7b3cSmrg      else
6563145b7b3cSmrg	objdir="$dir/$origobjdir"
6564145b7b3cSmrg      fi
6565145b7b3cSmrg      name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
6566145b7b3cSmrg      test "$mode" = uninstall && objdir="$dir"
6567145b7b3cSmrg
6568145b7b3cSmrg      # Remember objdir for removal later, being careful to avoid duplicates
6569145b7b3cSmrg      if test "$mode" = clean; then
6570145b7b3cSmrg	case " $rmdirs " in
6571145b7b3cSmrg	  *" $objdir "*) ;;
6572145b7b3cSmrg	  *) rmdirs="$rmdirs $objdir" ;;
6573145b7b3cSmrg	esac
6574145b7b3cSmrg      fi
6575145b7b3cSmrg
6576145b7b3cSmrg      # Don't error if the file doesn't exist and rm -f was used.
6577145b7b3cSmrg      if (test -L "$file") >/dev/null 2>&1 \
6578145b7b3cSmrg	|| (test -h "$file") >/dev/null 2>&1 \
6579145b7b3cSmrg	|| test -f "$file"; then
6580145b7b3cSmrg	:
6581145b7b3cSmrg      elif test -d "$file"; then
6582145b7b3cSmrg	exit_status=1
6583145b7b3cSmrg	continue
6584145b7b3cSmrg      elif test "$rmforce" = yes; then
6585145b7b3cSmrg	continue
6586145b7b3cSmrg      fi
6587145b7b3cSmrg
6588145b7b3cSmrg      rmfiles="$file"
6589145b7b3cSmrg
6590145b7b3cSmrg      case $name in
6591145b7b3cSmrg      *.la)
6592145b7b3cSmrg	# Possibly a libtool archive, so verify it.
6593145b7b3cSmrg	if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
6594145b7b3cSmrg	  . $dir/$name
6595145b7b3cSmrg
6596145b7b3cSmrg	  # Delete the libtool libraries and symlinks.
6597145b7b3cSmrg	  for n in $library_names; do
6598145b7b3cSmrg	    rmfiles="$rmfiles $objdir/$n"
6599145b7b3cSmrg	  done
6600145b7b3cSmrg	  test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library"
6601145b7b3cSmrg
6602145b7b3cSmrg	  case "$mode" in
6603145b7b3cSmrg	  clean)
6604145b7b3cSmrg	    case "  $library_names " in
6605145b7b3cSmrg	    # "  " in the beginning catches empty $dlname
6606145b7b3cSmrg	    *" $dlname "*) ;;
6607145b7b3cSmrg	    *) rmfiles="$rmfiles $objdir/$dlname" ;;
6608145b7b3cSmrg	    esac
6609145b7b3cSmrg	     test -n "$libdir" && rmfiles="$rmfiles $objdir/$name $objdir/${name}i"
6610145b7b3cSmrg	    ;;
6611145b7b3cSmrg	  uninstall)
6612145b7b3cSmrg	    if test -n "$library_names"; then
6613145b7b3cSmrg	      # Do each command in the postuninstall commands.
6614145b7b3cSmrg	      cmds=$postuninstall_cmds
6615145b7b3cSmrg	      save_ifs="$IFS"; IFS='~'
6616145b7b3cSmrg	      for cmd in $cmds; do
6617145b7b3cSmrg		IFS="$save_ifs"
6618145b7b3cSmrg		eval cmd=\"$cmd\"
6619145b7b3cSmrg		$show "$cmd"
6620145b7b3cSmrg		$run eval "$cmd"
6621145b7b3cSmrg		if test "$?" -ne 0 && test "$rmforce" != yes; then
6622145b7b3cSmrg		  exit_status=1
6623145b7b3cSmrg		fi
6624145b7b3cSmrg	      done
6625145b7b3cSmrg	      IFS="$save_ifs"
6626145b7b3cSmrg	    fi
6627145b7b3cSmrg
6628145b7b3cSmrg	    if test -n "$old_library"; then
6629145b7b3cSmrg	      # Do each command in the old_postuninstall commands.
6630145b7b3cSmrg	      cmds=$old_postuninstall_cmds
6631145b7b3cSmrg	      save_ifs="$IFS"; IFS='~'
6632145b7b3cSmrg	      for cmd in $cmds; do
6633145b7b3cSmrg		IFS="$save_ifs"
6634145b7b3cSmrg		eval cmd=\"$cmd\"
6635145b7b3cSmrg		$show "$cmd"
6636145b7b3cSmrg		$run eval "$cmd"
6637145b7b3cSmrg		if test "$?" -ne 0 && test "$rmforce" != yes; then
6638145b7b3cSmrg		  exit_status=1
6639145b7b3cSmrg		fi
6640145b7b3cSmrg	      done
6641145b7b3cSmrg	      IFS="$save_ifs"
6642145b7b3cSmrg	    fi
6643145b7b3cSmrg	    # FIXME: should reinstall the best remaining shared library.
6644145b7b3cSmrg	    ;;
6645145b7b3cSmrg	  esac
6646145b7b3cSmrg	fi
6647145b7b3cSmrg	;;
6648145b7b3cSmrg
6649145b7b3cSmrg      *.lo)
6650145b7b3cSmrg	# Possibly a libtool object, so verify it.
6651145b7b3cSmrg	if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
6652145b7b3cSmrg
6653145b7b3cSmrg	  # Read the .lo file
6654145b7b3cSmrg	  . $dir/$name
6655145b7b3cSmrg
6656145b7b3cSmrg	  # Add PIC object to the list of files to remove.
6657145b7b3cSmrg	  if test -n "$pic_object" \
6658145b7b3cSmrg	     && test "$pic_object" != none; then
6659145b7b3cSmrg	    rmfiles="$rmfiles $dir/$pic_object"
6660145b7b3cSmrg	  fi
6661145b7b3cSmrg
6662145b7b3cSmrg	  # Add non-PIC object to the list of files to remove.
6663145b7b3cSmrg	  if test -n "$non_pic_object" \
6664145b7b3cSmrg	     && test "$non_pic_object" != none; then
6665145b7b3cSmrg	    rmfiles="$rmfiles $dir/$non_pic_object"
6666145b7b3cSmrg	  fi
6667145b7b3cSmrg	fi
6668145b7b3cSmrg	;;
6669145b7b3cSmrg
6670145b7b3cSmrg      *)
6671145b7b3cSmrg	if test "$mode" = clean ; then
6672145b7b3cSmrg	  noexename=$name
6673145b7b3cSmrg	  case $file in
6674145b7b3cSmrg	  *.exe)
6675145b7b3cSmrg	    file=`$echo $file|${SED} 's,.exe$,,'`
6676145b7b3cSmrg	    noexename=`$echo $name|${SED} 's,.exe$,,'`
6677145b7b3cSmrg	    # $file with .exe has already been added to rmfiles,
6678145b7b3cSmrg	    # add $file without .exe
6679145b7b3cSmrg	    rmfiles="$rmfiles $file"
6680145b7b3cSmrg	    ;;
6681145b7b3cSmrg	  esac
6682145b7b3cSmrg	  # Do a test to see if this is a libtool program.
6683145b7b3cSmrg	  if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
6684145b7b3cSmrg	    relink_command=
6685145b7b3cSmrg	    . $dir/$noexename
6686145b7b3cSmrg
6687145b7b3cSmrg	    # note $name still contains .exe if it was in $file originally
6688145b7b3cSmrg	    # as does the version of $file that was added into $rmfiles
6689145b7b3cSmrg	    rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}"
6690145b7b3cSmrg	    if test "$fast_install" = yes && test -n "$relink_command"; then
6691145b7b3cSmrg	      rmfiles="$rmfiles $objdir/lt-$name"
6692145b7b3cSmrg	    fi
6693145b7b3cSmrg	    if test "X$noexename" != "X$name" ; then
6694145b7b3cSmrg	      rmfiles="$rmfiles $objdir/lt-${noexename}.c"
6695145b7b3cSmrg	    fi
6696145b7b3cSmrg	  fi
6697145b7b3cSmrg	fi
6698145b7b3cSmrg	;;
6699145b7b3cSmrg      esac
6700145b7b3cSmrg      $show "$rm $rmfiles"
6701145b7b3cSmrg      $run $rm $rmfiles || exit_status=1
6702145b7b3cSmrg    done
6703145b7b3cSmrg    objdir="$origobjdir"
6704145b7b3cSmrg
6705145b7b3cSmrg    # Try to remove the ${objdir}s in the directories where we deleted files
6706145b7b3cSmrg    for dir in $rmdirs; do
6707145b7b3cSmrg      if test -d "$dir"; then
6708145b7b3cSmrg	$show "rmdir $dir"
6709145b7b3cSmrg	$run rmdir $dir >/dev/null 2>&1
6710145b7b3cSmrg      fi
6711145b7b3cSmrg    done
6712145b7b3cSmrg
6713145b7b3cSmrg    exit $exit_status
6714145b7b3cSmrg    ;;
6715145b7b3cSmrg
6716145b7b3cSmrg  "")
6717145b7b3cSmrg    $echo "$modename: you must specify a MODE" 1>&2
6718145b7b3cSmrg    $echo "$generic_help" 1>&2
6719145b7b3cSmrg    exit $EXIT_FAILURE
6720145b7b3cSmrg    ;;
6721145b7b3cSmrg  esac
6722145b7b3cSmrg
6723145b7b3cSmrg  if test -z "$exec_cmd"; then
6724145b7b3cSmrg    $echo "$modename: invalid operation mode \`$mode'" 1>&2
6725145b7b3cSmrg    $echo "$generic_help" 1>&2
6726145b7b3cSmrg    exit $EXIT_FAILURE
6727145b7b3cSmrg  fi
6728145b7b3cSmrgfi # test -z "$show_help"
6729145b7b3cSmrg
6730145b7b3cSmrgif test -n "$exec_cmd"; then
6731145b7b3cSmrg  eval exec $exec_cmd
6732145b7b3cSmrg  exit $EXIT_FAILURE
6733145b7b3cSmrgfi
6734145b7b3cSmrg
6735145b7b3cSmrg# We need to display help for each of the modes.
6736145b7b3cSmrgcase $mode in
6737145b7b3cSmrg"") $echo \
6738145b7b3cSmrg"Usage: $modename [OPTION]... [MODE-ARG]...
6739145b7b3cSmrg
6740145b7b3cSmrgProvide generalized library-building support services.
6741145b7b3cSmrg
6742145b7b3cSmrg    --config          show all configuration variables
6743145b7b3cSmrg    --debug           enable verbose shell tracing
6744145b7b3cSmrg-n, --dry-run         display commands without modifying any files
6745145b7b3cSmrg    --features        display basic configuration information and exit
6746145b7b3cSmrg    --finish          same as \`--mode=finish'
6747145b7b3cSmrg    --help            display this help message and exit
6748145b7b3cSmrg    --mode=MODE       use operation mode MODE [default=inferred from MODE-ARGS]
6749145b7b3cSmrg    --quiet           same as \`--silent'
6750145b7b3cSmrg    --silent          don't print informational messages
6751145b7b3cSmrg    --tag=TAG         use configuration variables from tag TAG
6752145b7b3cSmrg    --version         print version information
6753145b7b3cSmrg
6754145b7b3cSmrgMODE must be one of the following:
6755145b7b3cSmrg
6756145b7b3cSmrg      clean           remove files from the build directory
6757145b7b3cSmrg      compile         compile a source file into a libtool object
6758145b7b3cSmrg      execute         automatically set library path, then run a program
6759145b7b3cSmrg      finish          complete the installation of libtool libraries
6760145b7b3cSmrg      install         install libraries or executables
6761145b7b3cSmrg      link            create a library or an executable
6762145b7b3cSmrg      uninstall       remove libraries from an installed directory
6763145b7b3cSmrg
6764145b7b3cSmrgMODE-ARGS vary depending on the MODE.  Try \`$modename --help --mode=MODE' for
6765145b7b3cSmrga more detailed description of MODE.
6766145b7b3cSmrg
6767145b7b3cSmrgReport bugs to <bug-libtool@gnu.org>."
6768145b7b3cSmrg  exit $EXIT_SUCCESS
6769145b7b3cSmrg  ;;
6770145b7b3cSmrg
6771145b7b3cSmrgclean)
6772145b7b3cSmrg  $echo \
6773145b7b3cSmrg"Usage: $modename [OPTION]... --mode=clean RM [RM-OPTION]... FILE...
6774145b7b3cSmrg
6775145b7b3cSmrgRemove files from the build directory.
6776145b7b3cSmrg
6777145b7b3cSmrgRM is the name of the program to use to delete files associated with each FILE
6778145b7b3cSmrg(typically \`/bin/rm').  RM-OPTIONS are options (such as \`-f') to be passed
6779145b7b3cSmrgto RM.
6780145b7b3cSmrg
6781145b7b3cSmrgIf FILE is a libtool library, object or program, all the files associated
6782145b7b3cSmrgwith it are deleted. Otherwise, only FILE itself is deleted using RM."
6783145b7b3cSmrg  ;;
6784145b7b3cSmrg
6785145b7b3cSmrgcompile)
6786145b7b3cSmrg  $echo \
6787145b7b3cSmrg"Usage: $modename [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE
6788145b7b3cSmrg
6789145b7b3cSmrgCompile a source file into a libtool library object.
6790145b7b3cSmrg
6791145b7b3cSmrgThis mode accepts the following additional options:
6792145b7b3cSmrg
6793145b7b3cSmrg  -o OUTPUT-FILE    set the output file name to OUTPUT-FILE
6794145b7b3cSmrg  -prefer-pic       try to building PIC objects only
6795145b7b3cSmrg  -prefer-non-pic   try to building non-PIC objects only
6796145b7b3cSmrg  -static           always build a \`.o' file suitable for static linking
6797145b7b3cSmrg
6798145b7b3cSmrgCOMPILE-COMMAND is a command to be used in creating a \`standard' object file
6799145b7b3cSmrgfrom the given SOURCEFILE.
6800145b7b3cSmrg
6801145b7b3cSmrgThe output file name is determined by removing the directory component from
6802145b7b3cSmrgSOURCEFILE, then substituting the C source code suffix \`.c' with the
6803145b7b3cSmrglibrary object suffix, \`.lo'."
6804145b7b3cSmrg  ;;
6805145b7b3cSmrg
6806145b7b3cSmrgexecute)
6807145b7b3cSmrg  $echo \
6808145b7b3cSmrg"Usage: $modename [OPTION]... --mode=execute COMMAND [ARGS]...
6809145b7b3cSmrg
6810145b7b3cSmrgAutomatically set library path, then run a program.
6811145b7b3cSmrg
6812145b7b3cSmrgThis mode accepts the following additional options:
6813145b7b3cSmrg
6814145b7b3cSmrg  -dlopen FILE      add the directory containing FILE to the library path
6815145b7b3cSmrg
6816145b7b3cSmrgThis mode sets the library path environment variable according to \`-dlopen'
6817145b7b3cSmrgflags.
6818145b7b3cSmrg
6819145b7b3cSmrgIf any of the ARGS are libtool executable wrappers, then they are translated
6820145b7b3cSmrginto their corresponding uninstalled binary, and any of their required library
6821145b7b3cSmrgdirectories are added to the library path.
6822145b7b3cSmrg
6823145b7b3cSmrgThen, COMMAND is executed, with ARGS as arguments."
6824145b7b3cSmrg  ;;
6825145b7b3cSmrg
6826145b7b3cSmrgfinish)
6827145b7b3cSmrg  $echo \
6828145b7b3cSmrg"Usage: $modename [OPTION]... --mode=finish [LIBDIR]...
6829145b7b3cSmrg
6830145b7b3cSmrgComplete the installation of libtool libraries.
6831145b7b3cSmrg
6832145b7b3cSmrgEach LIBDIR is a directory that contains libtool libraries.
6833145b7b3cSmrg
6834145b7b3cSmrgThe commands that this mode executes may require superuser privileges.  Use
6835145b7b3cSmrgthe \`--dry-run' option if you just want to see what would be executed."
6836145b7b3cSmrg  ;;
6837145b7b3cSmrg
6838145b7b3cSmrginstall)
6839145b7b3cSmrg  $echo \
6840145b7b3cSmrg"Usage: $modename [OPTION]... --mode=install INSTALL-COMMAND...
6841145b7b3cSmrg
6842145b7b3cSmrgInstall executables or libraries.
6843145b7b3cSmrg
6844145b7b3cSmrgINSTALL-COMMAND is the installation command.  The first component should be
6845145b7b3cSmrgeither the \`install' or \`cp' program.
6846145b7b3cSmrg
6847145b7b3cSmrgThe rest of the components are interpreted as arguments to that command (only
6848145b7b3cSmrgBSD-compatible install options are recognized)."
6849145b7b3cSmrg  ;;
6850145b7b3cSmrg
6851145b7b3cSmrglink)
6852145b7b3cSmrg  $echo \
6853145b7b3cSmrg"Usage: $modename [OPTION]... --mode=link LINK-COMMAND...
6854145b7b3cSmrg
6855145b7b3cSmrgLink object files or libraries together to form another library, or to
6856145b7b3cSmrgcreate an executable program.
6857145b7b3cSmrg
6858145b7b3cSmrgLINK-COMMAND is a command using the C compiler that you would use to create
6859145b7b3cSmrga program from several object files.
6860145b7b3cSmrg
6861145b7b3cSmrgThe following components of LINK-COMMAND are treated specially:
6862145b7b3cSmrg
6863145b7b3cSmrg  -all-static       do not do any dynamic linking at all
6864145b7b3cSmrg  -avoid-version    do not add a version suffix if possible
6865145b7b3cSmrg  -dlopen FILE      \`-dlpreopen' FILE if it cannot be dlopened at runtime
6866145b7b3cSmrg  -dlpreopen FILE   link in FILE and add its symbols to lt_preloaded_symbols
6867145b7b3cSmrg  -export-dynamic   allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
6868145b7b3cSmrg  -export-symbols SYMFILE
6869578741aaSmrg                    try to export only the symbols listed in SYMFILE
6870145b7b3cSmrg  -export-symbols-regex REGEX
6871578741aaSmrg                    try to export only the symbols matching REGEX
6872145b7b3cSmrg  -LLIBDIR          search LIBDIR for required installed libraries
6873145b7b3cSmrg  -lNAME            OUTPUT-FILE requires the installed library libNAME
6874145b7b3cSmrg  -module           build a library that can dlopened
6875145b7b3cSmrg  -no-fast-install  disable the fast-install mode
6876145b7b3cSmrg  -no-install       link a not-installable executable
6877145b7b3cSmrg  -no-undefined     declare that a library does not refer to external symbols
6878145b7b3cSmrg  -o OUTPUT-FILE    create OUTPUT-FILE from the specified objects
6879145b7b3cSmrg  -objectlist FILE  Use a list of object files found in FILE to specify objects
6880145b7b3cSmrg  -precious-files-regex REGEX
6881145b7b3cSmrg                    don't remove output files matching REGEX
6882145b7b3cSmrg  -release RELEASE  specify package release information
6883145b7b3cSmrg  -rpath LIBDIR     the created library will eventually be installed in LIBDIR
6884145b7b3cSmrg  -R[ ]LIBDIR       add LIBDIR to the runtime path of programs and libraries
6885578741aaSmrg  -static           do not do any dynamic linking of uninstalled libtool libraries
6886578741aaSmrg  -static-libtool-libs
6887578741aaSmrg                    do not do any dynamic linking of libtool libraries
6888145b7b3cSmrg  -version-info CURRENT[:REVISION[:AGE]]
6889578741aaSmrg                    specify library version info [each variable defaults to 0]
6890145b7b3cSmrg
6891145b7b3cSmrgAll other options (arguments beginning with \`-') are ignored.
6892145b7b3cSmrg
6893145b7b3cSmrgEvery other argument is treated as a filename.  Files ending in \`.la' are
6894145b7b3cSmrgtreated as uninstalled libtool libraries, other files are standard or library
6895145b7b3cSmrgobject files.
6896145b7b3cSmrg
6897145b7b3cSmrgIf the OUTPUT-FILE ends in \`.la', then a libtool library is created,
6898145b7b3cSmrgonly library objects (\`.lo' files) may be specified, and \`-rpath' is
6899145b7b3cSmrgrequired, except when creating a convenience library.
6900145b7b3cSmrg
6901145b7b3cSmrgIf OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created
6902145b7b3cSmrgusing \`ar' and \`ranlib', or on Windows using \`lib'.
6903145b7b3cSmrg
6904145b7b3cSmrgIf OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file
6905145b7b3cSmrgis created, otherwise an executable program is created."
6906145b7b3cSmrg  ;;
6907145b7b3cSmrg
6908145b7b3cSmrguninstall)
6909145b7b3cSmrg  $echo \
6910145b7b3cSmrg"Usage: $modename [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE...
6911145b7b3cSmrg
6912145b7b3cSmrgRemove libraries from an installation directory.
6913145b7b3cSmrg
6914145b7b3cSmrgRM is the name of the program to use to delete files associated with each FILE
6915145b7b3cSmrg(typically \`/bin/rm').  RM-OPTIONS are options (such as \`-f') to be passed
6916145b7b3cSmrgto RM.
6917145b7b3cSmrg
6918145b7b3cSmrgIf FILE is a libtool library, all the files associated with it are deleted.
6919145b7b3cSmrgOtherwise, only FILE itself is deleted using RM."
6920145b7b3cSmrg  ;;
6921145b7b3cSmrg
6922145b7b3cSmrg*)
6923145b7b3cSmrg  $echo "$modename: invalid operation mode \`$mode'" 1>&2
6924145b7b3cSmrg  $echo "$help" 1>&2
6925145b7b3cSmrg  exit $EXIT_FAILURE
6926145b7b3cSmrg  ;;
6927145b7b3cSmrgesac
6928145b7b3cSmrg
6929145b7b3cSmrg$echo
6930145b7b3cSmrg$echo "Try \`$modename --help' for more information about other modes."
6931145b7b3cSmrg
6932145b7b3cSmrgexit $?
6933145b7b3cSmrg
6934145b7b3cSmrg# The TAGs below are defined such that we never get into a situation
6935145b7b3cSmrg# in which we disable both kinds of libraries.  Given conflicting
6936145b7b3cSmrg# choices, we go for a static library, that is the most portable,
6937145b7b3cSmrg# since we can't tell whether shared libraries were disabled because
6938145b7b3cSmrg# the user asked for that or because the platform doesn't support
6939145b7b3cSmrg# them.  This is particularly important on AIX, because we don't
6940145b7b3cSmrg# support having both static and shared libraries enabled at the same
6941145b7b3cSmrg# time on that platform, so we default to a shared-only configuration.
6942145b7b3cSmrg# If a disable-shared tag is given, we'll fallback to a static-only
6943145b7b3cSmrg# configuration.  But we'll never go from static-only to shared-only.
6944145b7b3cSmrg
6945145b7b3cSmrg# ### BEGIN LIBTOOL TAG CONFIG: disable-shared
6946145b7b3cSmrgdisable_libs=shared
6947145b7b3cSmrg# ### END LIBTOOL TAG CONFIG: disable-shared
6948145b7b3cSmrg
6949145b7b3cSmrg# ### BEGIN LIBTOOL TAG CONFIG: disable-static
6950145b7b3cSmrgdisable_libs=static
6951145b7b3cSmrg# ### END LIBTOOL TAG CONFIG: disable-static
6952145b7b3cSmrg
6953145b7b3cSmrg# Local Variables:
6954145b7b3cSmrg# mode:shell-script
6955145b7b3cSmrg# sh-indentation:2
6956145b7b3cSmrg# End:
6957