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