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