1240a9a23Smbalmer# ltmain.sh - Provide generalized library-building support services.
2240a9a23Smbalmer# NOTE: Changing this file will not affect anything until you rerun configure.
3240a9a23Smbalmer#
4240a9a23Smbalmer# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006,
5240a9a23Smbalmer# 2007, 2008  Free Software Foundation, Inc.
6240a9a23Smbalmer# Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
7240a9a23Smbalmer#
8240a9a23Smbalmer# This program is free software; you can redistribute it and/or modify
9240a9a23Smbalmer# it under the terms of the GNU General Public License as published by
10240a9a23Smbalmer# the Free Software Foundation; either version 2 of the License, or
11240a9a23Smbalmer# (at your option) any later version.
12240a9a23Smbalmer#
13240a9a23Smbalmer# This program is distributed in the hope that it will be useful, but
14240a9a23Smbalmer# WITHOUT ANY WARRANTY; without even the implied warranty of
15240a9a23Smbalmer# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16240a9a23Smbalmer# General Public License for more details.
17240a9a23Smbalmer#
18240a9a23Smbalmer# You should have received a copy of the GNU General Public License
19240a9a23Smbalmer# along with this program; if not, write to the Free Software
20240a9a23Smbalmer# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
21240a9a23Smbalmer#
22240a9a23Smbalmer# As a special exception to the GNU General Public License, if you
23240a9a23Smbalmer# distribute this file as part of a program that contains a
24240a9a23Smbalmer# configuration script generated by Autoconf, you may include it under
25240a9a23Smbalmer# the same distribution terms that you use for the rest of that program.
26240a9a23Smbalmer
27240a9a23Smbalmerbasename="s,^.*/,,g"
28240a9a23Smbalmer
29240a9a23Smbalmer# Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh
30240a9a23Smbalmer# is ksh but when the shell is invoked as "sh" and the current value of
31240a9a23Smbalmer# the _XPG environment variable is not equal to 1 (one), the special
32240a9a23Smbalmer# positional parameter $0, within a function call, is the name of the
33240a9a23Smbalmer# function.
34240a9a23Smbalmerprogpath="$0"
35240a9a23Smbalmer
36240a9a23Smbalmer# The name of this program:
37240a9a23Smbalmerprogname=`echo "$progpath" | $SED $basename`
38240a9a23Smbalmermodename="$progname"
39240a9a23Smbalmer
40240a9a23Smbalmer# Global variables:
41240a9a23SmbalmerEXIT_SUCCESS=0
42240a9a23SmbalmerEXIT_FAILURE=1
43240a9a23Smbalmer
44240a9a23SmbalmerPROGRAM=ltmain.sh
45240a9a23SmbalmerPACKAGE=libtool
46240a9a23SmbalmerVERSION=1.5.26
47240a9a23SmbalmerTIMESTAMP=" (1.1220.2.493 2008/02/01 16:58:18)"
48240a9a23Smbalmer
49240a9a23Smbalmer# Be Bourne compatible (taken from Autoconf:_AS_BOURNE_COMPATIBLE).
50240a9a23Smbalmerif test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
51240a9a23Smbalmer  emulate sh
52240a9a23Smbalmer  NULLCMD=:
53240a9a23Smbalmer  # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
54240a9a23Smbalmer  # is contrary to our usage.  Disable this feature.
55240a9a23Smbalmer  alias -g '${1+"$@"}'='"$@"'
56240a9a23Smbalmer  setopt NO_GLOB_SUBST
57240a9a23Smbalmerelse
58240a9a23Smbalmer  case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac
59240a9a23Smbalmerfi
60240a9a23SmbalmerBIN_SH=xpg4; export BIN_SH # for Tru64
61240a9a23SmbalmerDUALCASE=1; export DUALCASE # for MKS sh
62240a9a23Smbalmer
63240a9a23Smbalmer# Check that we have a working $echo.
64240a9a23Smbalmerif test "X$1" = X--no-reexec; then
65240a9a23Smbalmer  # Discard the --no-reexec flag, and continue.
66240a9a23Smbalmer  shift
67240a9a23Smbalmerelif test "X$1" = X--fallback-echo; then
68240a9a23Smbalmer  # Avoid inline document here, it may be left over
69240a9a23Smbalmer  :
70240a9a23Smbalmerelif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then
71240a9a23Smbalmer  # Yippee, $echo works!
72240a9a23Smbalmer  :
73240a9a23Smbalmerelse
74240a9a23Smbalmer  # Restart under the correct shell, and then maybe $echo will work.
75240a9a23Smbalmer  exec $SHELL "$progpath" --no-reexec ${1+"$@"}
76240a9a23Smbalmerfi
77240a9a23Smbalmer
78240a9a23Smbalmerif test "X$1" = X--fallback-echo; then
79240a9a23Smbalmer  # used as fallback echo
80240a9a23Smbalmer  shift
81240a9a23Smbalmer  cat <<EOF
82240a9a23Smbalmer$*
83240a9a23SmbalmerEOF
84240a9a23Smbalmer  exit $EXIT_SUCCESS
85240a9a23Smbalmerfi
86240a9a23Smbalmer
87240a9a23Smbalmerdefault_mode=
88240a9a23Smbalmerhelp="Try \`$progname --help' for more information."
89240a9a23Smbalmermagic="%%%MAGIC variable%%%"
90240a9a23Smbalmermkdir="mkdir"
91240a9a23Smbalmermv="mv -f"
92240a9a23Smbalmerrm="rm -f"
93240a9a23Smbalmer
94240a9a23Smbalmer# Sed substitution that helps us do robust quoting.  It backslashifies
95240a9a23Smbalmer# metacharacters that are still active within double-quoted strings.
96240a9a23SmbalmerXsed="${SED}"' -e 1s/^X//'
97240a9a23Smbalmersed_quote_subst='s/\([\\`\\"$\\\\]\)/\\\1/g'
98240a9a23Smbalmer# test EBCDIC or ASCII
99240a9a23Smbalmercase `echo X|tr X '\101'` in
100240a9a23Smbalmer A) # ASCII based system
101240a9a23Smbalmer    # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr
102240a9a23Smbalmer  SP2NL='tr \040 \012'
103240a9a23Smbalmer  NL2SP='tr \015\012 \040\040'
104240a9a23Smbalmer  ;;
105240a9a23Smbalmer *) # EBCDIC based system
106240a9a23Smbalmer  SP2NL='tr \100 \n'
107240a9a23Smbalmer  NL2SP='tr \r\n \100\100'
108240a9a23Smbalmer  ;;
109240a9a23Smbalmeresac
110240a9a23Smbalmer
111240a9a23Smbalmer# NLS nuisances.
112240a9a23Smbalmer# Only set LANG and LC_ALL to C if already set.
113240a9a23Smbalmer# These must not be set unconditionally because not all systems understand
114240a9a23Smbalmer# e.g. LANG=C (notably SCO).
115240a9a23Smbalmer# We save the old values to restore during execute mode.
116240a9a23Smbalmerlt_env=
117240a9a23Smbalmerfor lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
118240a9a23Smbalmerdo
119240a9a23Smbalmer  eval "if test \"\${$lt_var+set}\" = set; then
120240a9a23Smbalmer	  save_$lt_var=\$$lt_var
121240a9a23Smbalmer	  lt_env=\"$lt_var=\$$lt_var \$lt_env\"
122240a9a23Smbalmer	  $lt_var=C
123240a9a23Smbalmer	  export $lt_var
124240a9a23Smbalmer	fi"
125240a9a23Smbalmerdone
126240a9a23Smbalmer
127240a9a23Smbalmerif test -n "$lt_env"; then
128240a9a23Smbalmer  lt_env="env $lt_env"
129240a9a23Smbalmerfi
130240a9a23Smbalmer
131240a9a23Smbalmer# Make sure IFS has a sensible default
132240a9a23Smbalmerlt_nl='
133240a9a23Smbalmer'
134240a9a23SmbalmerIFS=" 	$lt_nl"
135240a9a23Smbalmer
136240a9a23Smbalmerif test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
137240a9a23Smbalmer  $echo "$modename: not configured to build any kind of library" 1>&2
138240a9a23Smbalmer  $echo "Fatal configuration error.  See the $PACKAGE docs for more information." 1>&2
139240a9a23Smbalmer  exit $EXIT_FAILURE
140240a9a23Smbalmerfi
141240a9a23Smbalmer
142240a9a23Smbalmer# Global variables.
143240a9a23Smbalmermode=$default_mode
144240a9a23Smbalmernonopt=
145240a9a23Smbalmerprev=
146240a9a23Smbalmerprevopt=
147240a9a23Smbalmerrun=
148240a9a23Smbalmershow="$echo"
149240a9a23Smbalmershow_help=
150240a9a23Smbalmerexecute_dlfiles=
151240a9a23Smbalmerduplicate_deps=no
152240a9a23Smbalmerpreserve_args=
153240a9a23Smbalmerlo2o="s/\\.lo\$/.${objext}/"
154240a9a23Smbalmero2lo="s/\\.${objext}\$/.lo/"
155240a9a23Smbalmerextracted_archives=
156240a9a23Smbalmerextracted_serial=0
157240a9a23Smbalmer
158240a9a23Smbalmer#####################################
159240a9a23Smbalmer# Shell function definitions:
160240a9a23Smbalmer# This seems to be the best place for them
161240a9a23Smbalmer
162240a9a23Smbalmer# func_mktempdir [string]
163240a9a23Smbalmer# Make a temporary directory that won't clash with other running
164240a9a23Smbalmer# libtool processes, and avoids race conditions if possible.  If
165240a9a23Smbalmer# given, STRING is the basename for that directory.
166240a9a23Smbalmerfunc_mktempdir ()
167240a9a23Smbalmer{
168240a9a23Smbalmer    my_template="${TMPDIR-/tmp}/${1-$progname}"
169240a9a23Smbalmer
170240a9a23Smbalmer    if test "$run" = ":"; then
171240a9a23Smbalmer      # Return a directory name, but don't create it in dry-run mode
172240a9a23Smbalmer      my_tmpdir="${my_template}-$$"
173240a9a23Smbalmer    else
174240a9a23Smbalmer
175240a9a23Smbalmer      # If mktemp works, use that first and foremost
176240a9a23Smbalmer      my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null`
177240a9a23Smbalmer
178240a9a23Smbalmer      if test ! -d "$my_tmpdir"; then
179240a9a23Smbalmer	# Failing that, at least try and use $RANDOM to avoid a race
180240a9a23Smbalmer	my_tmpdir="${my_template}-${RANDOM-0}$$"
181240a9a23Smbalmer
182240a9a23Smbalmer	save_mktempdir_umask=`umask`
183240a9a23Smbalmer	umask 0077
184240a9a23Smbalmer	$mkdir "$my_tmpdir"
185240a9a23Smbalmer	umask $save_mktempdir_umask
186240a9a23Smbalmer      fi
187240a9a23Smbalmer
188240a9a23Smbalmer      # If we're not in dry-run mode, bomb out on failure
189240a9a23Smbalmer      test -d "$my_tmpdir" || {
190240a9a23Smbalmer        $echo "cannot create temporary directory \`$my_tmpdir'" 1>&2
191240a9a23Smbalmer	exit $EXIT_FAILURE
192240a9a23Smbalmer      }
193240a9a23Smbalmer    fi
194240a9a23Smbalmer
195240a9a23Smbalmer    $echo "X$my_tmpdir" | $Xsed
196240a9a23Smbalmer}
197240a9a23Smbalmer
198240a9a23Smbalmer
199240a9a23Smbalmer# func_win32_libid arg
200240a9a23Smbalmer# return the library type of file 'arg'
201240a9a23Smbalmer#
202240a9a23Smbalmer# Need a lot of goo to handle *both* DLLs and import libs
203240a9a23Smbalmer# Has to be a shell function in order to 'eat' the argument
204240a9a23Smbalmer# that is supplied when $file_magic_command is called.
205240a9a23Smbalmerfunc_win32_libid ()
206240a9a23Smbalmer{
207240a9a23Smbalmer  win32_libid_type="unknown"
208240a9a23Smbalmer  win32_fileres=`file -L $1 2>/dev/null`
209240a9a23Smbalmer  case $win32_fileres in
210240a9a23Smbalmer  *ar\ archive\ import\ library*) # definitely import
211240a9a23Smbalmer    win32_libid_type="x86 archive import"
212240a9a23Smbalmer    ;;
213240a9a23Smbalmer  *ar\ archive*) # could be an import, or static
214240a9a23Smbalmer    if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | \
215240a9a23Smbalmer      $EGREP -e 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then
216240a9a23Smbalmer      win32_nmres=`eval $NM -f posix -A $1 | \
217240a9a23Smbalmer	$SED -n -e '1,100{
218240a9a23Smbalmer		/ I /{
219240a9a23Smbalmer			s,.*,import,
220240a9a23Smbalmer			p
221240a9a23Smbalmer			q
222240a9a23Smbalmer			}
223240a9a23Smbalmer		}'`
224240a9a23Smbalmer      case $win32_nmres in
225240a9a23Smbalmer      import*)  win32_libid_type="x86 archive import";;
226240a9a23Smbalmer      *)        win32_libid_type="x86 archive static";;
227240a9a23Smbalmer      esac
228240a9a23Smbalmer    fi
229240a9a23Smbalmer    ;;
230240a9a23Smbalmer  *DLL*)
231240a9a23Smbalmer    win32_libid_type="x86 DLL"
232240a9a23Smbalmer    ;;
233240a9a23Smbalmer  *executable*) # but shell scripts are "executable" too...
234240a9a23Smbalmer    case $win32_fileres in
235240a9a23Smbalmer    *MS\ Windows\ PE\ Intel*)
236240a9a23Smbalmer      win32_libid_type="x86 DLL"
237240a9a23Smbalmer      ;;
238240a9a23Smbalmer    esac
239240a9a23Smbalmer    ;;
240240a9a23Smbalmer  esac
241240a9a23Smbalmer  $echo $win32_libid_type
242240a9a23Smbalmer}
243240a9a23Smbalmer
244240a9a23Smbalmer
245240a9a23Smbalmer# func_infer_tag arg
246240a9a23Smbalmer# Infer tagged configuration to use if any are available and
247240a9a23Smbalmer# if one wasn't chosen via the "--tag" command line option.
248240a9a23Smbalmer# Only attempt this if the compiler in the base compile
249240a9a23Smbalmer# command doesn't match the default compiler.
250240a9a23Smbalmer# arg is usually of the form 'gcc ...'
251240a9a23Smbalmerfunc_infer_tag ()
252240a9a23Smbalmer{
253240a9a23Smbalmer    if test -n "$available_tags" && test -z "$tagname"; then
254240a9a23Smbalmer      CC_quoted=
255240a9a23Smbalmer      for arg in $CC; do
256240a9a23Smbalmer	case $arg in
257240a9a23Smbalmer	  *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
258240a9a23Smbalmer	  arg="\"$arg\""
259240a9a23Smbalmer	  ;;
260240a9a23Smbalmer	esac
261240a9a23Smbalmer	CC_quoted="$CC_quoted $arg"
262240a9a23Smbalmer      done
263240a9a23Smbalmer      case $@ in
264240a9a23Smbalmer      # Blanks in the command may have been stripped by the calling shell,
265240a9a23Smbalmer      # but not from the CC environment variable when configure was run.
266240a9a23Smbalmer      " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*) ;;
267240a9a23Smbalmer      # Blanks at the start of $base_compile will cause this to fail
268240a9a23Smbalmer      # if we don't check for them as well.
269240a9a23Smbalmer      *)
270240a9a23Smbalmer	for z in $available_tags; do
271240a9a23Smbalmer	  if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then
272240a9a23Smbalmer	    # Evaluate the configuration.
273240a9a23Smbalmer	    eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`"
274240a9a23Smbalmer	    CC_quoted=
275240a9a23Smbalmer	    for arg in $CC; do
276240a9a23Smbalmer	    # Double-quote args containing other shell metacharacters.
277240a9a23Smbalmer	    case $arg in
278240a9a23Smbalmer	      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
279240a9a23Smbalmer	      arg="\"$arg\""
280240a9a23Smbalmer	      ;;
281240a9a23Smbalmer	    esac
282240a9a23Smbalmer	    CC_quoted="$CC_quoted $arg"
283240a9a23Smbalmer	  done
284240a9a23Smbalmer	    case "$@ " in
285240a9a23Smbalmer	      " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*)
286240a9a23Smbalmer	      # The compiler in the base compile command matches
287240a9a23Smbalmer	      # the one in the tagged configuration.
288240a9a23Smbalmer	      # Assume this is the tagged configuration we want.
289240a9a23Smbalmer	      tagname=$z
290240a9a23Smbalmer	      break
291240a9a23Smbalmer	      ;;
292240a9a23Smbalmer	    esac
293240a9a23Smbalmer	  fi
294240a9a23Smbalmer	done
295240a9a23Smbalmer	# If $tagname still isn't set, then no tagged configuration
296240a9a23Smbalmer	# was found and let the user know that the "--tag" command
297240a9a23Smbalmer	# line option must be used.
298240a9a23Smbalmer	if test -z "$tagname"; then
299240a9a23Smbalmer	  $echo "$modename: unable to infer tagged configuration"
300240a9a23Smbalmer	  $echo "$modename: specify a tag with \`--tag'" 1>&2
301240a9a23Smbalmer	  exit $EXIT_FAILURE
302240a9a23Smbalmer#        else
303240a9a23Smbalmer#          $echo "$modename: using $tagname tagged configuration"
304240a9a23Smbalmer	fi
305240a9a23Smbalmer	;;
306240a9a23Smbalmer      esac
307240a9a23Smbalmer    fi
308240a9a23Smbalmer}
309240a9a23Smbalmer
310240a9a23Smbalmer
311240a9a23Smbalmer# func_extract_an_archive dir oldlib
312240a9a23Smbalmerfunc_extract_an_archive ()
313240a9a23Smbalmer{
314240a9a23Smbalmer    f_ex_an_ar_dir="$1"; shift
315240a9a23Smbalmer    f_ex_an_ar_oldlib="$1"
316240a9a23Smbalmer
317240a9a23Smbalmer    $show "(cd $f_ex_an_ar_dir && $AR x $f_ex_an_ar_oldlib)"
318240a9a23Smbalmer    $run eval "(cd \$f_ex_an_ar_dir && $AR x \$f_ex_an_ar_oldlib)" || exit $?
319240a9a23Smbalmer    if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then
320240a9a23Smbalmer     :
321240a9a23Smbalmer    else
322240a9a23Smbalmer      $echo "$modename: ERROR: object name conflicts: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib" 1>&2
323240a9a23Smbalmer      exit $EXIT_FAILURE
324240a9a23Smbalmer    fi
325240a9a23Smbalmer}
326240a9a23Smbalmer
327240a9a23Smbalmer# func_extract_archives gentop oldlib ...
328240a9a23Smbalmerfunc_extract_archives ()
329240a9a23Smbalmer{
330240a9a23Smbalmer    my_gentop="$1"; shift
331240a9a23Smbalmer    my_oldlibs=${1+"$@"}
332240a9a23Smbalmer    my_oldobjs=""
333240a9a23Smbalmer    my_xlib=""
334240a9a23Smbalmer    my_xabs=""
335240a9a23Smbalmer    my_xdir=""
336240a9a23Smbalmer    my_status=""
337240a9a23Smbalmer
338240a9a23Smbalmer    $show "${rm}r $my_gentop"
339240a9a23Smbalmer    $run ${rm}r "$my_gentop"
340240a9a23Smbalmer    $show "$mkdir $my_gentop"
341240a9a23Smbalmer    $run $mkdir "$my_gentop"
342240a9a23Smbalmer    my_status=$?
343240a9a23Smbalmer    if test "$my_status" -ne 0 && test ! -d "$my_gentop"; then
344240a9a23Smbalmer      exit $my_status
345240a9a23Smbalmer    fi
346240a9a23Smbalmer
347240a9a23Smbalmer    for my_xlib in $my_oldlibs; do
348240a9a23Smbalmer      # Extract the objects.
349240a9a23Smbalmer      case $my_xlib in
350240a9a23Smbalmer	[\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;;
351240a9a23Smbalmer	*) my_xabs=`pwd`"/$my_xlib" ;;
352240a9a23Smbalmer      esac
353240a9a23Smbalmer      my_xlib=`$echo "X$my_xlib" | $Xsed -e 's%^.*/%%'`
354240a9a23Smbalmer      my_xlib_u=$my_xlib
355240a9a23Smbalmer      while :; do
356240a9a23Smbalmer        case " $extracted_archives " in
357240a9a23Smbalmer	*" $my_xlib_u "*)
358240a9a23Smbalmer	  extracted_serial=`expr $extracted_serial + 1`
359240a9a23Smbalmer	  my_xlib_u=lt$extracted_serial-$my_xlib ;;
360240a9a23Smbalmer	*) break ;;
361240a9a23Smbalmer	esac
362240a9a23Smbalmer      done
363240a9a23Smbalmer      extracted_archives="$extracted_archives $my_xlib_u"
364240a9a23Smbalmer      my_xdir="$my_gentop/$my_xlib_u"
365240a9a23Smbalmer
366240a9a23Smbalmer      $show "${rm}r $my_xdir"
367240a9a23Smbalmer      $run ${rm}r "$my_xdir"
368240a9a23Smbalmer      $show "$mkdir $my_xdir"
369240a9a23Smbalmer      $run $mkdir "$my_xdir"
370240a9a23Smbalmer      exit_status=$?
371240a9a23Smbalmer      if test "$exit_status" -ne 0 && test ! -d "$my_xdir"; then
372240a9a23Smbalmer	exit $exit_status
373240a9a23Smbalmer      fi
374240a9a23Smbalmer      case $host in
375240a9a23Smbalmer      *-darwin*)
376240a9a23Smbalmer	$show "Extracting $my_xabs"
377240a9a23Smbalmer	# Do not bother doing anything if just a dry run
378240a9a23Smbalmer	if test -z "$run"; then
379240a9a23Smbalmer	  darwin_orig_dir=`pwd`
380240a9a23Smbalmer	  cd $my_xdir || exit $?
381240a9a23Smbalmer	  darwin_archive=$my_xabs
382240a9a23Smbalmer	  darwin_curdir=`pwd`
383240a9a23Smbalmer	  darwin_base_archive=`$echo "X$darwin_archive" | $Xsed -e 's%^.*/%%'`
384240a9a23Smbalmer	  darwin_arches=`lipo -info "$darwin_archive" 2>/dev/null | $EGREP Architectures 2>/dev/null`
385240a9a23Smbalmer	  if test -n "$darwin_arches"; then 
386240a9a23Smbalmer	    darwin_arches=`echo "$darwin_arches" | $SED -e 's/.*are://'`
387240a9a23Smbalmer	    darwin_arch=
388240a9a23Smbalmer	    $show "$darwin_base_archive has multiple architectures $darwin_arches"
389240a9a23Smbalmer	    for darwin_arch in  $darwin_arches ; do
390240a9a23Smbalmer	      mkdir -p "unfat-$$/${darwin_base_archive}-${darwin_arch}"
391240a9a23Smbalmer	      lipo -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}"
392240a9a23Smbalmer	      cd "unfat-$$/${darwin_base_archive}-${darwin_arch}"
393240a9a23Smbalmer	      func_extract_an_archive "`pwd`" "${darwin_base_archive}"
394240a9a23Smbalmer	      cd "$darwin_curdir"
395240a9a23Smbalmer	      $rm "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}"
396240a9a23Smbalmer	    done # $darwin_arches
397240a9a23Smbalmer      ## Okay now we have a bunch of thin objects, gotta fatten them up :)
398240a9a23Smbalmer	    darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print| xargs basename | sort -u | $NL2SP`
399240a9a23Smbalmer	    darwin_file=
400240a9a23Smbalmer	    darwin_files=
401240a9a23Smbalmer	    for darwin_file in $darwin_filelist; do
402240a9a23Smbalmer	      darwin_files=`find unfat-$$ -name $darwin_file -print | $NL2SP`
403240a9a23Smbalmer	      lipo -create -output "$darwin_file" $darwin_files
404240a9a23Smbalmer	    done # $darwin_filelist
405240a9a23Smbalmer	    ${rm}r unfat-$$
406240a9a23Smbalmer	    cd "$darwin_orig_dir"
407240a9a23Smbalmer	  else
408240a9a23Smbalmer	    cd "$darwin_orig_dir"
409240a9a23Smbalmer 	    func_extract_an_archive "$my_xdir" "$my_xabs"
410240a9a23Smbalmer	  fi # $darwin_arches
411240a9a23Smbalmer	fi # $run
412240a9a23Smbalmer	;;
413240a9a23Smbalmer      *)
414240a9a23Smbalmer        func_extract_an_archive "$my_xdir" "$my_xabs"
415240a9a23Smbalmer        ;;
416240a9a23Smbalmer      esac
417240a9a23Smbalmer      my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP`
418240a9a23Smbalmer    done
419240a9a23Smbalmer    func_extract_archives_result="$my_oldobjs"
420240a9a23Smbalmer}
421240a9a23Smbalmer# End of Shell function definitions
422240a9a23Smbalmer#####################################
423240a9a23Smbalmer
424240a9a23Smbalmer# Darwin sucks
425240a9a23Smbalmereval std_shrext=\"$shrext_cmds\"
426240a9a23Smbalmer
427240a9a23Smbalmerdisable_libs=no
428240a9a23Smbalmer
429240a9a23Smbalmer# Parse our command line options once, thoroughly.
430240a9a23Smbalmerwhile test "$#" -gt 0
431240a9a23Smbalmerdo
432240a9a23Smbalmer  arg="$1"
433240a9a23Smbalmer  shift
434240a9a23Smbalmer
435240a9a23Smbalmer  case $arg in
436240a9a23Smbalmer  -*=*) optarg=`$echo "X$arg" | $Xsed -e 's/[-_a-zA-Z0-9]*=//'` ;;
437240a9a23Smbalmer  *) optarg= ;;
438240a9a23Smbalmer  esac
439240a9a23Smbalmer
440240a9a23Smbalmer  # If the previous option needs an argument, assign it.
441240a9a23Smbalmer  if test -n "$prev"; then
442240a9a23Smbalmer    case $prev in
443240a9a23Smbalmer    execute_dlfiles)
444240a9a23Smbalmer      execute_dlfiles="$execute_dlfiles $arg"
445240a9a23Smbalmer      ;;
446240a9a23Smbalmer    tag)
447240a9a23Smbalmer      tagname="$arg"
448240a9a23Smbalmer      preserve_args="${preserve_args}=$arg"
449240a9a23Smbalmer
450240a9a23Smbalmer      # Check whether tagname contains only valid characters
451240a9a23Smbalmer      case $tagname in
452240a9a23Smbalmer      *[!-_A-Za-z0-9,/]*)
453240a9a23Smbalmer	$echo "$progname: invalid tag name: $tagname" 1>&2
454240a9a23Smbalmer	exit $EXIT_FAILURE
455240a9a23Smbalmer	;;
456240a9a23Smbalmer      esac
457240a9a23Smbalmer
458240a9a23Smbalmer      case $tagname in
459240a9a23Smbalmer      CC)
460240a9a23Smbalmer	# Don't test for the "default" C tag, as we know, it's there, but
461240a9a23Smbalmer	# not specially marked.
462240a9a23Smbalmer	;;
463240a9a23Smbalmer      *)
464240a9a23Smbalmer	if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "$progpath" > /dev/null; then
465240a9a23Smbalmer	  taglist="$taglist $tagname"
466240a9a23Smbalmer	  # Evaluate the configuration.
467240a9a23Smbalmer	  eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$tagname'$/,/^# ### END LIBTOOL TAG CONFIG: '$tagname'$/p' < $progpath`"
468240a9a23Smbalmer	else
469240a9a23Smbalmer	  $echo "$progname: ignoring unknown tag $tagname" 1>&2
470240a9a23Smbalmer	fi
471240a9a23Smbalmer	;;
472240a9a23Smbalmer      esac
473240a9a23Smbalmer      ;;
474240a9a23Smbalmer    *)
475240a9a23Smbalmer      eval "$prev=\$arg"
476240a9a23Smbalmer      ;;
477240a9a23Smbalmer    esac
478240a9a23Smbalmer
479240a9a23Smbalmer    prev=
480240a9a23Smbalmer    prevopt=
481240a9a23Smbalmer    continue
482240a9a23Smbalmer  fi
483240a9a23Smbalmer
484240a9a23Smbalmer  # Have we seen a non-optional argument yet?
485240a9a23Smbalmer  case $arg in
486240a9a23Smbalmer  --help)
487240a9a23Smbalmer    show_help=yes
488240a9a23Smbalmer    ;;
489240a9a23Smbalmer
490240a9a23Smbalmer  --version)
491240a9a23Smbalmer    echo "\
492240a9a23Smbalmer$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP
493240a9a23Smbalmer
494240a9a23SmbalmerCopyright (C) 2008  Free Software Foundation, Inc.
495240a9a23SmbalmerThis is free software; see the source for copying conditions.  There is NO
496240a9a23Smbalmerwarranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
497240a9a23Smbalmer    exit $?
498240a9a23Smbalmer    ;;
499240a9a23Smbalmer
500240a9a23Smbalmer  --config)
501240a9a23Smbalmer    ${SED} -e '1,/^# ### BEGIN LIBTOOL CONFIG/d' -e '/^# ### END LIBTOOL CONFIG/,$d' $progpath
502240a9a23Smbalmer    # Now print the configurations for the tags.
503240a9a23Smbalmer    for tagname in $taglist; do
504240a9a23Smbalmer      ${SED} -n -e "/^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$/,/^# ### END LIBTOOL TAG CONFIG: $tagname$/p" < "$progpath"
505240a9a23Smbalmer    done
506240a9a23Smbalmer    exit $?
507240a9a23Smbalmer    ;;
508240a9a23Smbalmer
509240a9a23Smbalmer  --debug)
510240a9a23Smbalmer    $echo "$progname: enabling shell trace mode"
511240a9a23Smbalmer    set -x
512240a9a23Smbalmer    preserve_args="$preserve_args $arg"
513240a9a23Smbalmer    ;;
514240a9a23Smbalmer
515240a9a23Smbalmer  --dry-run | -n)
516240a9a23Smbalmer    run=:
517240a9a23Smbalmer    ;;
518240a9a23Smbalmer
519240a9a23Smbalmer  --features)
520240a9a23Smbalmer    $echo "host: $host"
521240a9a23Smbalmer    if test "$build_libtool_libs" = yes; then
522240a9a23Smbalmer      $echo "enable shared libraries"
523240a9a23Smbalmer    else
524240a9a23Smbalmer      $echo "disable shared libraries"
525240a9a23Smbalmer    fi
526240a9a23Smbalmer    if test "$build_old_libs" = yes; then
527240a9a23Smbalmer      $echo "enable static libraries"
528240a9a23Smbalmer    else
529240a9a23Smbalmer      $echo "disable static libraries"
530240a9a23Smbalmer    fi
531240a9a23Smbalmer    exit $?
532240a9a23Smbalmer    ;;
533240a9a23Smbalmer
534240a9a23Smbalmer  --finish) mode="finish" ;;
535240a9a23Smbalmer
536240a9a23Smbalmer  --mode) prevopt="--mode" prev=mode ;;
537240a9a23Smbalmer  --mode=*) mode="$optarg" ;;
538240a9a23Smbalmer
539240a9a23Smbalmer  --preserve-dup-deps) duplicate_deps="yes" ;;
540240a9a23Smbalmer
541240a9a23Smbalmer  --quiet | --silent)
542240a9a23Smbalmer    show=:
543240a9a23Smbalmer    preserve_args="$preserve_args $arg"
544240a9a23Smbalmer    ;;
545240a9a23Smbalmer
546240a9a23Smbalmer  --tag)
547240a9a23Smbalmer    prevopt="--tag"
548240a9a23Smbalmer    prev=tag
549240a9a23Smbalmer    preserve_args="$preserve_args --tag"
550240a9a23Smbalmer    ;;
551240a9a23Smbalmer  --tag=*)
552240a9a23Smbalmer    set tag "$optarg" ${1+"$@"}
553240a9a23Smbalmer    shift
554240a9a23Smbalmer    prev=tag
555240a9a23Smbalmer    preserve_args="$preserve_args --tag"
556240a9a23Smbalmer    ;;
557240a9a23Smbalmer
558240a9a23Smbalmer  -dlopen)
559240a9a23Smbalmer    prevopt="-dlopen"
560240a9a23Smbalmer    prev=execute_dlfiles
561240a9a23Smbalmer    ;;
562240a9a23Smbalmer
563240a9a23Smbalmer  -*)
564240a9a23Smbalmer    $echo "$modename: unrecognized option \`$arg'" 1>&2
565240a9a23Smbalmer    $echo "$help" 1>&2
566240a9a23Smbalmer    exit $EXIT_FAILURE
567240a9a23Smbalmer    ;;
568240a9a23Smbalmer
569240a9a23Smbalmer  *)
570240a9a23Smbalmer    nonopt="$arg"
571240a9a23Smbalmer    break
572240a9a23Smbalmer    ;;
573240a9a23Smbalmer  esac
574240a9a23Smbalmerdone
575240a9a23Smbalmer
576240a9a23Smbalmerif test -n "$prevopt"; then
577240a9a23Smbalmer  $echo "$modename: option \`$prevopt' requires an argument" 1>&2
578240a9a23Smbalmer  $echo "$help" 1>&2
579240a9a23Smbalmer  exit $EXIT_FAILURE
580240a9a23Smbalmerfi
581240a9a23Smbalmer
582240a9a23Smbalmercase $disable_libs in
583240a9a23Smbalmerno) 
584240a9a23Smbalmer  ;;
585240a9a23Smbalmershared)
586240a9a23Smbalmer  build_libtool_libs=no
587240a9a23Smbalmer  build_old_libs=yes
588240a9a23Smbalmer  ;;
589240a9a23Smbalmerstatic)
590240a9a23Smbalmer  build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac`
591240a9a23Smbalmer  ;;
592240a9a23Smbalmeresac
593240a9a23Smbalmer
594240a9a23Smbalmer# If this variable is set in any of the actions, the command in it
595240a9a23Smbalmer# will be execed at the end.  This prevents here-documents from being
596240a9a23Smbalmer# left over by shells.
597240a9a23Smbalmerexec_cmd=
598240a9a23Smbalmer
599240a9a23Smbalmerif test -z "$show_help"; then
600240a9a23Smbalmer
601240a9a23Smbalmer  # Infer the operation mode.
602240a9a23Smbalmer  if test -z "$mode"; then
603240a9a23Smbalmer    $echo "*** Warning: inferring the mode of operation is deprecated." 1>&2
604240a9a23Smbalmer    $echo "*** Future versions of Libtool will require --mode=MODE be specified." 1>&2
605240a9a23Smbalmer    case $nonopt in
606240a9a23Smbalmer    *cc | cc* | *++ | gcc* | *-gcc* | g++* | xlc*)
607240a9a23Smbalmer      mode=link
608240a9a23Smbalmer      for arg
609240a9a23Smbalmer      do
610240a9a23Smbalmer	case $arg in
611240a9a23Smbalmer	-c)
612240a9a23Smbalmer	   mode=compile
613240a9a23Smbalmer	   break
614240a9a23Smbalmer	   ;;
615240a9a23Smbalmer	esac
616240a9a23Smbalmer      done
617240a9a23Smbalmer      ;;
618240a9a23Smbalmer    *db | *dbx | *strace | *truss)
619240a9a23Smbalmer      mode=execute
620240a9a23Smbalmer      ;;
621240a9a23Smbalmer    *install*|cp|mv)
622240a9a23Smbalmer      mode=install
623240a9a23Smbalmer      ;;
624240a9a23Smbalmer    *rm)
625240a9a23Smbalmer      mode=uninstall
626240a9a23Smbalmer      ;;
627240a9a23Smbalmer    *)
628240a9a23Smbalmer      # If we have no mode, but dlfiles were specified, then do execute mode.
629240a9a23Smbalmer      test -n "$execute_dlfiles" && mode=execute
630240a9a23Smbalmer
631240a9a23Smbalmer      # Just use the default operation mode.
632240a9a23Smbalmer      if test -z "$mode"; then
633240a9a23Smbalmer	if test -n "$nonopt"; then
634240a9a23Smbalmer	  $echo "$modename: warning: cannot infer operation mode from \`$nonopt'" 1>&2
635240a9a23Smbalmer	else
636240a9a23Smbalmer	  $echo "$modename: warning: cannot infer operation mode without MODE-ARGS" 1>&2
637240a9a23Smbalmer	fi
638240a9a23Smbalmer      fi
639240a9a23Smbalmer      ;;
640240a9a23Smbalmer    esac
641240a9a23Smbalmer  fi
642240a9a23Smbalmer
643240a9a23Smbalmer  # Only execute mode is allowed to have -dlopen flags.
644240a9a23Smbalmer  if test -n "$execute_dlfiles" && test "$mode" != execute; then
645240a9a23Smbalmer    $echo "$modename: unrecognized option \`-dlopen'" 1>&2
646240a9a23Smbalmer    $echo "$help" 1>&2
647240a9a23Smbalmer    exit $EXIT_FAILURE
648240a9a23Smbalmer  fi
649240a9a23Smbalmer
650240a9a23Smbalmer  # Change the help message to a mode-specific one.
651240a9a23Smbalmer  generic_help="$help"
652240a9a23Smbalmer  help="Try \`$modename --help --mode=$mode' for more information."
653240a9a23Smbalmer
654240a9a23Smbalmer  # These modes are in order of execution frequency so that they run quickly.
655240a9a23Smbalmer  case $mode in
656240a9a23Smbalmer  # libtool compile mode
657240a9a23Smbalmer  compile)
658240a9a23Smbalmer    modename="$modename: compile"
659240a9a23Smbalmer    # Get the compilation command and the source file.
660240a9a23Smbalmer    base_compile=
661240a9a23Smbalmer    srcfile="$nonopt"  #  always keep a non-empty value in "srcfile"
662240a9a23Smbalmer    suppress_opt=yes
663240a9a23Smbalmer    suppress_output=
664240a9a23Smbalmer    arg_mode=normal
665240a9a23Smbalmer    libobj=
666240a9a23Smbalmer    later=
667240a9a23Smbalmer
668240a9a23Smbalmer    for arg
669240a9a23Smbalmer    do
670240a9a23Smbalmer      case $arg_mode in
671240a9a23Smbalmer      arg  )
672240a9a23Smbalmer	# do not "continue".  Instead, add this to base_compile
673240a9a23Smbalmer	lastarg="$arg"
674240a9a23Smbalmer	arg_mode=normal
675240a9a23Smbalmer	;;
676240a9a23Smbalmer
677240a9a23Smbalmer      target )
678240a9a23Smbalmer	libobj="$arg"
679240a9a23Smbalmer	arg_mode=normal
680240a9a23Smbalmer	continue
681240a9a23Smbalmer	;;
682240a9a23Smbalmer
683240a9a23Smbalmer      normal )
684240a9a23Smbalmer	# Accept any command-line options.
685240a9a23Smbalmer	case $arg in
686240a9a23Smbalmer	-o)
687240a9a23Smbalmer	  if test -n "$libobj" ; then
688240a9a23Smbalmer	    $echo "$modename: you cannot specify \`-o' more than once" 1>&2
689240a9a23Smbalmer	    exit $EXIT_FAILURE
690240a9a23Smbalmer	  fi
691240a9a23Smbalmer	  arg_mode=target
692240a9a23Smbalmer	  continue
693240a9a23Smbalmer	  ;;
694240a9a23Smbalmer
695240a9a23Smbalmer	-static | -prefer-pic | -prefer-non-pic)
696240a9a23Smbalmer	  later="$later $arg"
697240a9a23Smbalmer	  continue
698240a9a23Smbalmer	  ;;
699240a9a23Smbalmer
700240a9a23Smbalmer	-no-suppress)
701240a9a23Smbalmer	  suppress_opt=no
702240a9a23Smbalmer	  continue
703240a9a23Smbalmer	  ;;
704240a9a23Smbalmer
705240a9a23Smbalmer	-Xcompiler)
706240a9a23Smbalmer	  arg_mode=arg  #  the next one goes into the "base_compile" arg list
707240a9a23Smbalmer	  continue      #  The current "srcfile" will either be retained or
708240a9a23Smbalmer	  ;;            #  replaced later.  I would guess that would be a bug.
709240a9a23Smbalmer
710240a9a23Smbalmer	-Wc,*)
711240a9a23Smbalmer	  args=`$echo "X$arg" | $Xsed -e "s/^-Wc,//"`
712240a9a23Smbalmer	  lastarg=
713240a9a23Smbalmer	  save_ifs="$IFS"; IFS=','
714240a9a23Smbalmer 	  for arg in $args; do
715240a9a23Smbalmer	    IFS="$save_ifs"
716240a9a23Smbalmer
717240a9a23Smbalmer	    # Double-quote args containing other shell metacharacters.
718240a9a23Smbalmer	    # Many Bourne shells cannot handle close brackets correctly
719240a9a23Smbalmer	    # in scan sets, so we specify it separately.
720240a9a23Smbalmer	    case $arg in
721240a9a23Smbalmer	      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
722240a9a23Smbalmer	      arg="\"$arg\""
723240a9a23Smbalmer	      ;;
724240a9a23Smbalmer	    esac
725240a9a23Smbalmer	    lastarg="$lastarg $arg"
726240a9a23Smbalmer	  done
727240a9a23Smbalmer	  IFS="$save_ifs"
728240a9a23Smbalmer	  lastarg=`$echo "X$lastarg" | $Xsed -e "s/^ //"`
729240a9a23Smbalmer
730240a9a23Smbalmer	  # Add the arguments to base_compile.
731240a9a23Smbalmer	  base_compile="$base_compile $lastarg"
732240a9a23Smbalmer	  continue
733240a9a23Smbalmer	  ;;
734240a9a23Smbalmer
735240a9a23Smbalmer	* )
736240a9a23Smbalmer	  # Accept the current argument as the source file.
737240a9a23Smbalmer	  # The previous "srcfile" becomes the current argument.
738240a9a23Smbalmer	  #
739240a9a23Smbalmer	  lastarg="$srcfile"
740240a9a23Smbalmer	  srcfile="$arg"
741240a9a23Smbalmer	  ;;
742240a9a23Smbalmer	esac  #  case $arg
743240a9a23Smbalmer	;;
744240a9a23Smbalmer      esac    #  case $arg_mode
745240a9a23Smbalmer
746240a9a23Smbalmer      # Aesthetically quote the previous argument.
747240a9a23Smbalmer      lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"`
748240a9a23Smbalmer
749240a9a23Smbalmer      case $lastarg in
750240a9a23Smbalmer      # Double-quote args containing other shell metacharacters.
751240a9a23Smbalmer      # Many Bourne shells cannot handle close brackets correctly
752240a9a23Smbalmer      # in scan sets, and some SunOS ksh mistreat backslash-escaping
753240a9a23Smbalmer      # in scan sets (worked around with variable expansion),
754240a9a23Smbalmer      # and furthermore cannot handle '|' '&' '(' ')' in scan sets 
755240a9a23Smbalmer      # at all, so we specify them separately.
756240a9a23Smbalmer      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
757240a9a23Smbalmer	lastarg="\"$lastarg\""
758240a9a23Smbalmer	;;
759240a9a23Smbalmer      esac
760240a9a23Smbalmer
761240a9a23Smbalmer      base_compile="$base_compile $lastarg"
762240a9a23Smbalmer    done # for arg
763240a9a23Smbalmer
764240a9a23Smbalmer    case $arg_mode in
765240a9a23Smbalmer    arg)
766240a9a23Smbalmer      $echo "$modename: you must specify an argument for -Xcompile"
767240a9a23Smbalmer      exit $EXIT_FAILURE
768240a9a23Smbalmer      ;;
769240a9a23Smbalmer    target)
770240a9a23Smbalmer      $echo "$modename: you must specify a target with \`-o'" 1>&2
771240a9a23Smbalmer      exit $EXIT_FAILURE
772240a9a23Smbalmer      ;;
773240a9a23Smbalmer    *)
774240a9a23Smbalmer      # Get the name of the library object.
775240a9a23Smbalmer      [ -z "$libobj" ] && libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'`
776240a9a23Smbalmer      ;;
777240a9a23Smbalmer    esac
778240a9a23Smbalmer
779240a9a23Smbalmer    # Recognize several different file suffixes.
780240a9a23Smbalmer    # If the user specifies -o file.o, it is replaced with file.lo
781240a9a23Smbalmer    xform='[cCFSifmso]'
782240a9a23Smbalmer    case $libobj in
783240a9a23Smbalmer    *.ada) xform=ada ;;
784240a9a23Smbalmer    *.adb) xform=adb ;;
785240a9a23Smbalmer    *.ads) xform=ads ;;
786240a9a23Smbalmer    *.asm) xform=asm ;;
787240a9a23Smbalmer    *.c++) xform=c++ ;;
788240a9a23Smbalmer    *.cc) xform=cc ;;
789240a9a23Smbalmer    *.ii) xform=ii ;;
790240a9a23Smbalmer    *.class) xform=class ;;
791240a9a23Smbalmer    *.cpp) xform=cpp ;;
792240a9a23Smbalmer    *.cxx) xform=cxx ;;
793240a9a23Smbalmer    *.[fF][09]?) xform=[fF][09]. ;;
794240a9a23Smbalmer    *.for) xform=for ;;
795240a9a23Smbalmer    *.java) xform=java ;;
796240a9a23Smbalmer    *.obj) xform=obj ;;
797240a9a23Smbalmer    *.sx) xform=sx ;;
798240a9a23Smbalmer    esac
799240a9a23Smbalmer
800240a9a23Smbalmer    libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"`
801240a9a23Smbalmer
802240a9a23Smbalmer    case $libobj in
803240a9a23Smbalmer    *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;;
804240a9a23Smbalmer    *)
805240a9a23Smbalmer      $echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2
806240a9a23Smbalmer      exit $EXIT_FAILURE
807240a9a23Smbalmer      ;;
808240a9a23Smbalmer    esac
809240a9a23Smbalmer
810240a9a23Smbalmer    func_infer_tag $base_compile
811240a9a23Smbalmer
812240a9a23Smbalmer    for arg in $later; do
813240a9a23Smbalmer      case $arg in
814240a9a23Smbalmer      -static)
815240a9a23Smbalmer	build_old_libs=yes
816240a9a23Smbalmer	continue
817240a9a23Smbalmer	;;
818240a9a23Smbalmer
819240a9a23Smbalmer      -prefer-pic)
820240a9a23Smbalmer	pic_mode=yes
821240a9a23Smbalmer	continue
822240a9a23Smbalmer	;;
823240a9a23Smbalmer
824240a9a23Smbalmer      -prefer-non-pic)
825240a9a23Smbalmer	pic_mode=no
826240a9a23Smbalmer	continue
827240a9a23Smbalmer	;;
828240a9a23Smbalmer      esac
829240a9a23Smbalmer    done
830240a9a23Smbalmer
831240a9a23Smbalmer    qlibobj=`$echo "X$libobj" | $Xsed -e "$sed_quote_subst"`
832240a9a23Smbalmer    case $qlibobj in
833240a9a23Smbalmer      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
834240a9a23Smbalmer	qlibobj="\"$qlibobj\"" ;;
835240a9a23Smbalmer    esac
836240a9a23Smbalmer    test "X$libobj" != "X$qlibobj" \
837240a9a23Smbalmer	&& $echo "X$libobj" | grep '[]~#^*{};<>?"'"'"' 	&()|`$[]' \
838240a9a23Smbalmer	&& $echo "$modename: libobj name \`$libobj' may not contain shell special characters."
839240a9a23Smbalmer    objname=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
840240a9a23Smbalmer    xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'`
841240a9a23Smbalmer    if test "X$xdir" = "X$obj"; then
842240a9a23Smbalmer      xdir=
843240a9a23Smbalmer    else
844240a9a23Smbalmer      xdir=$xdir/
845240a9a23Smbalmer    fi
846240a9a23Smbalmer    lobj=${xdir}$objdir/$objname
847240a9a23Smbalmer
848240a9a23Smbalmer    if test -z "$base_compile"; then
849240a9a23Smbalmer      $echo "$modename: you must specify a compilation command" 1>&2
850240a9a23Smbalmer      $echo "$help" 1>&2
851240a9a23Smbalmer      exit $EXIT_FAILURE
852240a9a23Smbalmer    fi
853240a9a23Smbalmer
854240a9a23Smbalmer    # Delete any leftover library objects.
855240a9a23Smbalmer    if test "$build_old_libs" = yes; then
856240a9a23Smbalmer      removelist="$obj $lobj $libobj ${libobj}T"
857240a9a23Smbalmer    else
858240a9a23Smbalmer      removelist="$lobj $libobj ${libobj}T"
859240a9a23Smbalmer    fi
860240a9a23Smbalmer
861240a9a23Smbalmer    $run $rm $removelist
862240a9a23Smbalmer    trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15
863240a9a23Smbalmer
864240a9a23Smbalmer    # On Cygwin there's no "real" PIC flag so we must build both object types
865240a9a23Smbalmer    case $host_os in
866240a9a23Smbalmer    cygwin* | mingw* | pw32* | os2*)
867240a9a23Smbalmer      pic_mode=default
868240a9a23Smbalmer      ;;
869240a9a23Smbalmer    esac
870240a9a23Smbalmer    if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then
871240a9a23Smbalmer      # non-PIC code in shared libraries is not supported
872240a9a23Smbalmer      pic_mode=default
873240a9a23Smbalmer    fi
874240a9a23Smbalmer
875240a9a23Smbalmer    # Calculate the filename of the output object if compiler does
876240a9a23Smbalmer    # not support -o with -c
877240a9a23Smbalmer    if test "$compiler_c_o" = no; then
878240a9a23Smbalmer      output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext}
879240a9a23Smbalmer      lockfile="$output_obj.lock"
880240a9a23Smbalmer      removelist="$removelist $output_obj $lockfile"
881240a9a23Smbalmer      trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15
882240a9a23Smbalmer    else
883240a9a23Smbalmer      output_obj=
884240a9a23Smbalmer      need_locks=no
885240a9a23Smbalmer      lockfile=
886240a9a23Smbalmer    fi
887240a9a23Smbalmer
888240a9a23Smbalmer    # Lock this critical section if it is needed
889240a9a23Smbalmer    # We use this script file to make the link, it avoids creating a new file
890240a9a23Smbalmer    if test "$need_locks" = yes; then
891240a9a23Smbalmer      until $run ln "$progpath" "$lockfile" 2>/dev/null; do
892240a9a23Smbalmer	$show "Waiting for $lockfile to be removed"
893240a9a23Smbalmer	sleep 2
894240a9a23Smbalmer      done
895240a9a23Smbalmer    elif test "$need_locks" = warn; then
896240a9a23Smbalmer      if test -f "$lockfile"; then
897240a9a23Smbalmer	$echo "\
898240a9a23Smbalmer*** ERROR, $lockfile exists and contains:
899240a9a23Smbalmer`cat $lockfile 2>/dev/null`
900240a9a23Smbalmer
901240a9a23SmbalmerThis indicates that another process is trying to use the same
902240a9a23Smbalmertemporary object file, and libtool could not work around it because
903240a9a23Smbalmeryour compiler does not support \`-c' and \`-o' together.  If you
904240a9a23Smbalmerrepeat this compilation, it may succeed, by chance, but you had better
905240a9a23Smbalmeravoid parallel builds (make -j) in this platform, or get a better
906240a9a23Smbalmercompiler."
907240a9a23Smbalmer
908240a9a23Smbalmer	$run $rm $removelist
909240a9a23Smbalmer	exit $EXIT_FAILURE
910240a9a23Smbalmer      fi
911240a9a23Smbalmer      $echo "$srcfile" > "$lockfile"
912240a9a23Smbalmer    fi
913240a9a23Smbalmer
914240a9a23Smbalmer    if test -n "$fix_srcfile_path"; then
915240a9a23Smbalmer      eval srcfile=\"$fix_srcfile_path\"
916240a9a23Smbalmer    fi
917240a9a23Smbalmer    qsrcfile=`$echo "X$srcfile" | $Xsed -e "$sed_quote_subst"`
918240a9a23Smbalmer    case $qsrcfile in
919240a9a23Smbalmer      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
920240a9a23Smbalmer      qsrcfile="\"$qsrcfile\"" ;;
921240a9a23Smbalmer    esac
922240a9a23Smbalmer
923240a9a23Smbalmer    $run $rm "$libobj" "${libobj}T"
924240a9a23Smbalmer
925240a9a23Smbalmer    # Create a libtool object file (analogous to a ".la" file),
926240a9a23Smbalmer    # but don't create it if we're doing a dry run.
927240a9a23Smbalmer    test -z "$run" && cat > ${libobj}T <<EOF
928240a9a23Smbalmer# $libobj - a libtool object file
929240a9a23Smbalmer# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
930240a9a23Smbalmer#
931240a9a23Smbalmer# Please DO NOT delete this file!
932240a9a23Smbalmer# It is necessary for linking the library.
933240a9a23Smbalmer
934240a9a23Smbalmer# Name of the PIC object.
935240a9a23SmbalmerEOF
936240a9a23Smbalmer
937240a9a23Smbalmer    # Only build a PIC object if we are building libtool libraries.
938240a9a23Smbalmer    if test "$build_libtool_libs" = yes; then
939240a9a23Smbalmer      # Without this assignment, base_compile gets emptied.
940240a9a23Smbalmer      fbsd_hideous_sh_bug=$base_compile
941240a9a23Smbalmer
942240a9a23Smbalmer      if test "$pic_mode" != no; then
943240a9a23Smbalmer	command="$base_compile $qsrcfile $pic_flag"
944240a9a23Smbalmer      else
945240a9a23Smbalmer	# Don't build PIC code
946240a9a23Smbalmer	command="$base_compile $qsrcfile"
947240a9a23Smbalmer      fi
948240a9a23Smbalmer
949240a9a23Smbalmer      if test ! -d "${xdir}$objdir"; then
950240a9a23Smbalmer	$show "$mkdir ${xdir}$objdir"
951240a9a23Smbalmer	$run $mkdir ${xdir}$objdir
952240a9a23Smbalmer	exit_status=$?
953240a9a23Smbalmer	if test "$exit_status" -ne 0 && test ! -d "${xdir}$objdir"; then
954240a9a23Smbalmer	  exit $exit_status
955240a9a23Smbalmer	fi
956240a9a23Smbalmer      fi
957240a9a23Smbalmer
958240a9a23Smbalmer      if test -z "$output_obj"; then
959240a9a23Smbalmer	# Place PIC objects in $objdir
960240a9a23Smbalmer	command="$command -o $lobj"
961240a9a23Smbalmer      fi
962240a9a23Smbalmer
963240a9a23Smbalmer      $run $rm "$lobj" "$output_obj"
964240a9a23Smbalmer
965240a9a23Smbalmer      $show "$command"
966240a9a23Smbalmer      if $run eval $lt_env "$command"; then :
967240a9a23Smbalmer      else
968240a9a23Smbalmer	test -n "$output_obj" && $run $rm $removelist
969240a9a23Smbalmer	exit $EXIT_FAILURE
970240a9a23Smbalmer      fi
971240a9a23Smbalmer
972240a9a23Smbalmer      if test "$need_locks" = warn &&
973240a9a23Smbalmer	 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
974240a9a23Smbalmer	$echo "\
975240a9a23Smbalmer*** ERROR, $lockfile contains:
976240a9a23Smbalmer`cat $lockfile 2>/dev/null`
977240a9a23Smbalmer
978240a9a23Smbalmerbut it should contain:
979240a9a23Smbalmer$srcfile
980240a9a23Smbalmer
981240a9a23SmbalmerThis indicates that another process is trying to use the same
982240a9a23Smbalmertemporary object file, and libtool could not work around it because
983240a9a23Smbalmeryour compiler does not support \`-c' and \`-o' together.  If you
984240a9a23Smbalmerrepeat this compilation, it may succeed, by chance, but you had better
985240a9a23Smbalmeravoid parallel builds (make -j) in this platform, or get a better
986240a9a23Smbalmercompiler."
987240a9a23Smbalmer
988240a9a23Smbalmer	$run $rm $removelist
989240a9a23Smbalmer	exit $EXIT_FAILURE
990240a9a23Smbalmer      fi
991240a9a23Smbalmer
992240a9a23Smbalmer      # Just move the object if needed, then go on to compile the next one
993240a9a23Smbalmer      if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then
994240a9a23Smbalmer	$show "$mv $output_obj $lobj"
995240a9a23Smbalmer	if $run $mv $output_obj $lobj; then :
996240a9a23Smbalmer	else
997240a9a23Smbalmer	  error=$?
998240a9a23Smbalmer	  $run $rm $removelist
999240a9a23Smbalmer	  exit $error
1000240a9a23Smbalmer	fi
1001240a9a23Smbalmer      fi
1002240a9a23Smbalmer
1003240a9a23Smbalmer      # Append the name of the PIC object to the libtool object file.
1004240a9a23Smbalmer      test -z "$run" && cat >> ${libobj}T <<EOF
1005240a9a23Smbalmerpic_object='$objdir/$objname'
1006240a9a23Smbalmer
1007240a9a23SmbalmerEOF
1008240a9a23Smbalmer
1009240a9a23Smbalmer      # Allow error messages only from the first compilation.
1010240a9a23Smbalmer      if test "$suppress_opt" = yes; then
1011240a9a23Smbalmer        suppress_output=' >/dev/null 2>&1'
1012240a9a23Smbalmer      fi
1013240a9a23Smbalmer    else
1014240a9a23Smbalmer      # No PIC object so indicate it doesn't exist in the libtool
1015240a9a23Smbalmer      # object file.
1016240a9a23Smbalmer      test -z "$run" && cat >> ${libobj}T <<EOF
1017240a9a23Smbalmerpic_object=none
1018240a9a23Smbalmer
1019240a9a23SmbalmerEOF
1020240a9a23Smbalmer    fi
1021240a9a23Smbalmer
1022240a9a23Smbalmer    # Only build a position-dependent object if we build old libraries.
1023240a9a23Smbalmer    if test "$build_old_libs" = yes; then
1024240a9a23Smbalmer      if test "$pic_mode" != yes; then
1025240a9a23Smbalmer	# Don't build PIC code
1026240a9a23Smbalmer	command="$base_compile $qsrcfile"
1027240a9a23Smbalmer      else
1028240a9a23Smbalmer	command="$base_compile $qsrcfile $pic_flag"
1029240a9a23Smbalmer      fi
1030240a9a23Smbalmer      if test "$compiler_c_o" = yes; then
1031240a9a23Smbalmer	command="$command -o $obj"
1032240a9a23Smbalmer      fi
1033240a9a23Smbalmer
1034240a9a23Smbalmer      # Suppress compiler output if we already did a PIC compilation.
1035240a9a23Smbalmer      command="$command$suppress_output"
1036240a9a23Smbalmer      $run $rm "$obj" "$output_obj"
1037240a9a23Smbalmer      $show "$command"
1038240a9a23Smbalmer      if $run eval $lt_env "$command"; then :
1039240a9a23Smbalmer      else
1040240a9a23Smbalmer	$run $rm $removelist
1041240a9a23Smbalmer	exit $EXIT_FAILURE
1042240a9a23Smbalmer      fi
1043240a9a23Smbalmer
1044240a9a23Smbalmer      if test "$need_locks" = warn &&
1045240a9a23Smbalmer	 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
1046240a9a23Smbalmer	$echo "\
1047240a9a23Smbalmer*** ERROR, $lockfile contains:
1048240a9a23Smbalmer`cat $lockfile 2>/dev/null`
1049240a9a23Smbalmer
1050240a9a23Smbalmerbut it should contain:
1051240a9a23Smbalmer$srcfile
1052240a9a23Smbalmer
1053240a9a23SmbalmerThis indicates that another process is trying to use the same
1054240a9a23Smbalmertemporary object file, and libtool could not work around it because
1055240a9a23Smbalmeryour compiler does not support \`-c' and \`-o' together.  If you
1056240a9a23Smbalmerrepeat this compilation, it may succeed, by chance, but you had better
1057240a9a23Smbalmeravoid parallel builds (make -j) in this platform, or get a better
1058240a9a23Smbalmercompiler."
1059240a9a23Smbalmer
1060240a9a23Smbalmer	$run $rm $removelist
1061240a9a23Smbalmer	exit $EXIT_FAILURE
1062240a9a23Smbalmer      fi
1063240a9a23Smbalmer
1064240a9a23Smbalmer      # Just move the object if needed
1065240a9a23Smbalmer      if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then
1066240a9a23Smbalmer	$show "$mv $output_obj $obj"
1067240a9a23Smbalmer	if $run $mv $output_obj $obj; then :
1068240a9a23Smbalmer	else
1069240a9a23Smbalmer	  error=$?
1070240a9a23Smbalmer	  $run $rm $removelist
1071240a9a23Smbalmer	  exit $error
1072240a9a23Smbalmer	fi
1073240a9a23Smbalmer      fi
1074240a9a23Smbalmer
1075240a9a23Smbalmer      # Append the name of the non-PIC object the libtool object file.
1076240a9a23Smbalmer      # Only append if the libtool object file exists.
1077240a9a23Smbalmer      test -z "$run" && cat >> ${libobj}T <<EOF
1078240a9a23Smbalmer# Name of the non-PIC object.
1079240a9a23Smbalmernon_pic_object='$objname'
1080240a9a23Smbalmer
1081240a9a23SmbalmerEOF
1082240a9a23Smbalmer    else
1083240a9a23Smbalmer      # Append the name of the non-PIC object the libtool object file.
1084240a9a23Smbalmer      # Only append if the libtool object file exists.
1085240a9a23Smbalmer      test -z "$run" && cat >> ${libobj}T <<EOF
1086240a9a23Smbalmer# Name of the non-PIC object.
1087240a9a23Smbalmernon_pic_object=none
1088240a9a23Smbalmer
1089240a9a23SmbalmerEOF
1090240a9a23Smbalmer    fi
1091240a9a23Smbalmer
1092240a9a23Smbalmer    $run $mv "${libobj}T" "${libobj}"
1093240a9a23Smbalmer
1094240a9a23Smbalmer    # Unlock the critical section if it was locked
1095240a9a23Smbalmer    if test "$need_locks" != no; then
1096240a9a23Smbalmer      $run $rm "$lockfile"
1097240a9a23Smbalmer    fi
1098240a9a23Smbalmer
1099240a9a23Smbalmer    exit $EXIT_SUCCESS
1100240a9a23Smbalmer    ;;
1101240a9a23Smbalmer
1102240a9a23Smbalmer  # libtool link mode
1103240a9a23Smbalmer  link | relink)
1104240a9a23Smbalmer    modename="$modename: link"
1105240a9a23Smbalmer    case $host in
1106240a9a23Smbalmer    *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
1107240a9a23Smbalmer      # It is impossible to link a dll without this setting, and
1108240a9a23Smbalmer      # we shouldn't force the makefile maintainer to figure out
1109240a9a23Smbalmer      # which system we are compiling for in order to pass an extra
1110240a9a23Smbalmer      # flag for every libtool invocation.
1111240a9a23Smbalmer      # allow_undefined=no
1112240a9a23Smbalmer
1113240a9a23Smbalmer      # FIXME: Unfortunately, there are problems with the above when trying
1114240a9a23Smbalmer      # to make a dll which has undefined symbols, in which case not
1115240a9a23Smbalmer      # even a static library is built.  For now, we need to specify
1116240a9a23Smbalmer      # -no-undefined on the libtool link line when we can be certain
1117240a9a23Smbalmer      # that all symbols are satisfied, otherwise we get a static library.
1118240a9a23Smbalmer      allow_undefined=yes
1119240a9a23Smbalmer      ;;
1120240a9a23Smbalmer    *)
1121240a9a23Smbalmer      allow_undefined=yes
1122240a9a23Smbalmer      ;;
1123240a9a23Smbalmer    esac
1124240a9a23Smbalmer    libtool_args="$nonopt"
1125240a9a23Smbalmer    base_compile="$nonopt $@"
1126240a9a23Smbalmer    compile_command="$nonopt"
1127240a9a23Smbalmer    finalize_command="$nonopt"
1128240a9a23Smbalmer
1129240a9a23Smbalmer    compile_rpath=
1130240a9a23Smbalmer    finalize_rpath=
1131240a9a23Smbalmer    compile_shlibpath=
1132240a9a23Smbalmer    finalize_shlibpath=
1133240a9a23Smbalmer    convenience=
1134240a9a23Smbalmer    old_convenience=
1135240a9a23Smbalmer    deplibs=
1136240a9a23Smbalmer    old_deplibs=
1137240a9a23Smbalmer    compiler_flags=
1138240a9a23Smbalmer    linker_flags=
1139240a9a23Smbalmer    dllsearchpath=
1140240a9a23Smbalmer    lib_search_path=`pwd`
1141240a9a23Smbalmer    inst_prefix_dir=
1142240a9a23Smbalmer
1143240a9a23Smbalmer    avoid_version=no
1144240a9a23Smbalmer    dlfiles=
1145240a9a23Smbalmer    dlprefiles=
1146240a9a23Smbalmer    dlself=no
1147240a9a23Smbalmer    export_dynamic=no
1148240a9a23Smbalmer    export_symbols=
1149240a9a23Smbalmer    export_symbols_regex=
1150240a9a23Smbalmer    generated=
1151240a9a23Smbalmer    libobjs=
1152240a9a23Smbalmer    ltlibs=
1153240a9a23Smbalmer    module=no
1154240a9a23Smbalmer    no_install=no
1155240a9a23Smbalmer    objs=
1156240a9a23Smbalmer    non_pic_objects=
1157240a9a23Smbalmer    notinst_path= # paths that contain not-installed libtool libraries
1158240a9a23Smbalmer    precious_files_regex=
1159240a9a23Smbalmer    prefer_static_libs=no
1160240a9a23Smbalmer    preload=no
1161240a9a23Smbalmer    prev=
1162240a9a23Smbalmer    prevarg=
1163240a9a23Smbalmer    release=
1164240a9a23Smbalmer    rpath=
1165240a9a23Smbalmer    xrpath=
1166240a9a23Smbalmer    perm_rpath=
1167240a9a23Smbalmer    temp_rpath=
1168240a9a23Smbalmer    thread_safe=no
1169240a9a23Smbalmer    vinfo=
1170240a9a23Smbalmer    vinfo_number=no
1171240a9a23Smbalmer    single_module="${wl}-single_module"
1172240a9a23Smbalmer
1173240a9a23Smbalmer    func_infer_tag $base_compile
1174240a9a23Smbalmer
1175240a9a23Smbalmer    # We need to know -static, to get the right output filenames.
1176240a9a23Smbalmer    for arg
1177240a9a23Smbalmer    do
1178240a9a23Smbalmer      case $arg in
1179240a9a23Smbalmer      -all-static | -static | -static-libtool-libs)
1180240a9a23Smbalmer	case $arg in
1181240a9a23Smbalmer	-all-static)
1182240a9a23Smbalmer	  if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then
1183240a9a23Smbalmer	    $echo "$modename: warning: complete static linking is impossible in this configuration" 1>&2
1184240a9a23Smbalmer	  fi
1185240a9a23Smbalmer	  if test -n "$link_static_flag"; then
1186240a9a23Smbalmer	    dlopen_self=$dlopen_self_static
1187240a9a23Smbalmer	  fi
1188240a9a23Smbalmer	  prefer_static_libs=yes
1189240a9a23Smbalmer	  ;;
1190240a9a23Smbalmer	-static)
1191240a9a23Smbalmer	  if test -z "$pic_flag" && test -n "$link_static_flag"; then
1192240a9a23Smbalmer	    dlopen_self=$dlopen_self_static
1193240a9a23Smbalmer	  fi
1194240a9a23Smbalmer	  prefer_static_libs=built
1195240a9a23Smbalmer	  ;;
1196240a9a23Smbalmer	-static-libtool-libs)
1197240a9a23Smbalmer	  if test -z "$pic_flag" && test -n "$link_static_flag"; then
1198240a9a23Smbalmer	    dlopen_self=$dlopen_self_static
1199240a9a23Smbalmer	  fi
1200240a9a23Smbalmer	  prefer_static_libs=yes
1201240a9a23Smbalmer	  ;;
1202240a9a23Smbalmer	esac
1203240a9a23Smbalmer	build_libtool_libs=no
1204240a9a23Smbalmer	build_old_libs=yes
1205240a9a23Smbalmer	break
1206240a9a23Smbalmer	;;
1207240a9a23Smbalmer      esac
1208240a9a23Smbalmer    done
1209240a9a23Smbalmer
1210240a9a23Smbalmer    # See if our shared archives depend on static archives.
1211240a9a23Smbalmer    test -n "$old_archive_from_new_cmds" && build_old_libs=yes
1212240a9a23Smbalmer
1213240a9a23Smbalmer    # Go through the arguments, transforming them on the way.
1214240a9a23Smbalmer    while test "$#" -gt 0; do
1215240a9a23Smbalmer      arg="$1"
1216240a9a23Smbalmer      shift
1217240a9a23Smbalmer      case $arg in
1218240a9a23Smbalmer      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
1219240a9a23Smbalmer	qarg=\"`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`\" ### testsuite: skip nested quoting test
1220240a9a23Smbalmer	;;
1221240a9a23Smbalmer      *) qarg=$arg ;;
1222240a9a23Smbalmer      esac
1223240a9a23Smbalmer      libtool_args="$libtool_args $qarg"
1224240a9a23Smbalmer
1225240a9a23Smbalmer      # If the previous option needs an argument, assign it.
1226240a9a23Smbalmer      if test -n "$prev"; then
1227240a9a23Smbalmer	case $prev in
1228240a9a23Smbalmer	output)
1229240a9a23Smbalmer	  compile_command="$compile_command @OUTPUT@"
1230240a9a23Smbalmer	  finalize_command="$finalize_command @OUTPUT@"
1231240a9a23Smbalmer	  ;;
1232240a9a23Smbalmer	esac
1233240a9a23Smbalmer
1234240a9a23Smbalmer	case $prev in
1235240a9a23Smbalmer	dlfiles|dlprefiles)
1236240a9a23Smbalmer	  if test "$preload" = no; then
1237240a9a23Smbalmer	    # Add the symbol object into the linking commands.
1238240a9a23Smbalmer	    compile_command="$compile_command @SYMFILE@"
1239240a9a23Smbalmer	    finalize_command="$finalize_command @SYMFILE@"
1240240a9a23Smbalmer	    preload=yes
1241240a9a23Smbalmer	  fi
1242240a9a23Smbalmer	  case $arg in
1243240a9a23Smbalmer	  *.la | *.lo) ;;  # We handle these cases below.
1244240a9a23Smbalmer	  force)
1245240a9a23Smbalmer	    if test "$dlself" = no; then
1246240a9a23Smbalmer	      dlself=needless
1247240a9a23Smbalmer	      export_dynamic=yes
1248240a9a23Smbalmer	    fi
1249240a9a23Smbalmer	    prev=
1250240a9a23Smbalmer	    continue
1251240a9a23Smbalmer	    ;;
1252240a9a23Smbalmer	  self)
1253240a9a23Smbalmer	    if test "$prev" = dlprefiles; then
1254240a9a23Smbalmer	      dlself=yes
1255240a9a23Smbalmer	    elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then
1256240a9a23Smbalmer	      dlself=yes
1257240a9a23Smbalmer	    else
1258240a9a23Smbalmer	      dlself=needless
1259240a9a23Smbalmer	      export_dynamic=yes
1260240a9a23Smbalmer	    fi
1261240a9a23Smbalmer	    prev=
1262240a9a23Smbalmer	    continue
1263240a9a23Smbalmer	    ;;
1264240a9a23Smbalmer	  *)
1265240a9a23Smbalmer	    if test "$prev" = dlfiles; then
1266240a9a23Smbalmer	      dlfiles="$dlfiles $arg"
1267240a9a23Smbalmer	    else
1268240a9a23Smbalmer	      dlprefiles="$dlprefiles $arg"
1269240a9a23Smbalmer	    fi
1270240a9a23Smbalmer	    prev=
1271240a9a23Smbalmer	    continue
1272240a9a23Smbalmer	    ;;
1273240a9a23Smbalmer	  esac
1274240a9a23Smbalmer	  ;;
1275240a9a23Smbalmer	expsyms)
1276240a9a23Smbalmer	  export_symbols="$arg"
1277240a9a23Smbalmer	  if test ! -f "$arg"; then
1278240a9a23Smbalmer	    $echo "$modename: symbol file \`$arg' does not exist"
1279240a9a23Smbalmer	    exit $EXIT_FAILURE
1280240a9a23Smbalmer	  fi
1281240a9a23Smbalmer	  prev=
1282240a9a23Smbalmer	  continue
1283240a9a23Smbalmer	  ;;
1284240a9a23Smbalmer	expsyms_regex)
1285240a9a23Smbalmer	  export_symbols_regex="$arg"
1286240a9a23Smbalmer	  prev=
1287240a9a23Smbalmer	  continue
1288240a9a23Smbalmer	  ;;
1289240a9a23Smbalmer	inst_prefix)
1290240a9a23Smbalmer	  inst_prefix_dir="$arg"
1291240a9a23Smbalmer	  prev=
1292240a9a23Smbalmer	  continue
1293240a9a23Smbalmer	  ;;
1294240a9a23Smbalmer	precious_regex)
1295240a9a23Smbalmer	  precious_files_regex="$arg"
1296240a9a23Smbalmer	  prev=
1297240a9a23Smbalmer	  continue
1298240a9a23Smbalmer	  ;;
1299240a9a23Smbalmer	release)
1300240a9a23Smbalmer	  release="-$arg"
1301240a9a23Smbalmer	  prev=
1302240a9a23Smbalmer	  continue
1303240a9a23Smbalmer	  ;;
1304240a9a23Smbalmer	objectlist)
1305240a9a23Smbalmer	  if test -f "$arg"; then
1306240a9a23Smbalmer	    save_arg=$arg
1307240a9a23Smbalmer	    moreargs=
1308240a9a23Smbalmer	    for fil in `cat $save_arg`
1309240a9a23Smbalmer	    do
1310240a9a23Smbalmer#	      moreargs="$moreargs $fil"
1311240a9a23Smbalmer	      arg=$fil
1312240a9a23Smbalmer	      # A libtool-controlled object.
1313240a9a23Smbalmer
1314240a9a23Smbalmer	      # Check to see that this really is a libtool object.
1315240a9a23Smbalmer	      if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
1316240a9a23Smbalmer		pic_object=
1317240a9a23Smbalmer		non_pic_object=
1318240a9a23Smbalmer
1319240a9a23Smbalmer		# Read the .lo file
1320240a9a23Smbalmer		# If there is no directory component, then add one.
1321240a9a23Smbalmer		case $arg in
1322240a9a23Smbalmer		*/* | *\\*) . $arg ;;
1323240a9a23Smbalmer		*) . ./$arg ;;
1324240a9a23Smbalmer		esac
1325240a9a23Smbalmer
1326240a9a23Smbalmer		if test -z "$pic_object" || \
1327240a9a23Smbalmer		   test -z "$non_pic_object" ||
1328240a9a23Smbalmer		   test "$pic_object" = none && \
1329240a9a23Smbalmer		   test "$non_pic_object" = none; then
1330240a9a23Smbalmer		  $echo "$modename: cannot find name of object for \`$arg'" 1>&2
1331240a9a23Smbalmer		  exit $EXIT_FAILURE
1332240a9a23Smbalmer		fi
1333240a9a23Smbalmer
1334240a9a23Smbalmer		# Extract subdirectory from the argument.
1335240a9a23Smbalmer		xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
1336240a9a23Smbalmer		if test "X$xdir" = "X$arg"; then
1337240a9a23Smbalmer		  xdir=
1338240a9a23Smbalmer		else
1339240a9a23Smbalmer		  xdir="$xdir/"
1340240a9a23Smbalmer		fi
1341240a9a23Smbalmer
1342240a9a23Smbalmer		if test "$pic_object" != none; then
1343240a9a23Smbalmer		  # Prepend the subdirectory the object is found in.
1344240a9a23Smbalmer		  pic_object="$xdir$pic_object"
1345240a9a23Smbalmer
1346240a9a23Smbalmer		  if test "$prev" = dlfiles; then
1347240a9a23Smbalmer		    if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
1348240a9a23Smbalmer		      dlfiles="$dlfiles $pic_object"
1349240a9a23Smbalmer		      prev=
1350240a9a23Smbalmer		      continue
1351240a9a23Smbalmer		    else
1352240a9a23Smbalmer		      # If libtool objects are unsupported, then we need to preload.
1353240a9a23Smbalmer		      prev=dlprefiles
1354240a9a23Smbalmer		    fi
1355240a9a23Smbalmer		  fi
1356240a9a23Smbalmer
1357240a9a23Smbalmer		  # CHECK ME:  I think I busted this.  -Ossama
1358240a9a23Smbalmer		  if test "$prev" = dlprefiles; then
1359240a9a23Smbalmer		    # Preload the old-style object.
1360240a9a23Smbalmer		    dlprefiles="$dlprefiles $pic_object"
1361240a9a23Smbalmer		    prev=
1362240a9a23Smbalmer		  fi
1363240a9a23Smbalmer
1364240a9a23Smbalmer		  # A PIC object.
1365240a9a23Smbalmer		  libobjs="$libobjs $pic_object"
1366240a9a23Smbalmer		  arg="$pic_object"
1367240a9a23Smbalmer		fi
1368240a9a23Smbalmer
1369240a9a23Smbalmer		# Non-PIC object.
1370240a9a23Smbalmer		if test "$non_pic_object" != none; then
1371240a9a23Smbalmer		  # Prepend the subdirectory the object is found in.
1372240a9a23Smbalmer		  non_pic_object="$xdir$non_pic_object"
1373240a9a23Smbalmer
1374240a9a23Smbalmer		  # A standard non-PIC object
1375240a9a23Smbalmer		  non_pic_objects="$non_pic_objects $non_pic_object"
1376240a9a23Smbalmer		  if test -z "$pic_object" || test "$pic_object" = none ; then
1377240a9a23Smbalmer		    arg="$non_pic_object"
1378240a9a23Smbalmer		  fi
1379240a9a23Smbalmer		else
1380240a9a23Smbalmer		  # If the PIC object exists, use it instead.
1381240a9a23Smbalmer		  # $xdir was prepended to $pic_object above.
1382240a9a23Smbalmer		  non_pic_object="$pic_object"
1383240a9a23Smbalmer		  non_pic_objects="$non_pic_objects $non_pic_object"
1384240a9a23Smbalmer		fi
1385240a9a23Smbalmer	      else
1386240a9a23Smbalmer		# Only an error if not doing a dry-run.
1387240a9a23Smbalmer		if test -z "$run"; then
1388240a9a23Smbalmer		  $echo "$modename: \`$arg' is not a valid libtool object" 1>&2
1389240a9a23Smbalmer		  exit $EXIT_FAILURE
1390240a9a23Smbalmer		else
1391240a9a23Smbalmer		  # Dry-run case.
1392240a9a23Smbalmer
1393240a9a23Smbalmer		  # Extract subdirectory from the argument.
1394240a9a23Smbalmer		  xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
1395240a9a23Smbalmer		  if test "X$xdir" = "X$arg"; then
1396240a9a23Smbalmer		    xdir=
1397240a9a23Smbalmer		  else
1398240a9a23Smbalmer		    xdir="$xdir/"
1399240a9a23Smbalmer		  fi
1400240a9a23Smbalmer
1401240a9a23Smbalmer		  pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"`
1402240a9a23Smbalmer		  non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"`
1403240a9a23Smbalmer		  libobjs="$libobjs $pic_object"
1404240a9a23Smbalmer		  non_pic_objects="$non_pic_objects $non_pic_object"
1405240a9a23Smbalmer		fi
1406240a9a23Smbalmer	      fi
1407240a9a23Smbalmer	    done
1408240a9a23Smbalmer	  else
1409240a9a23Smbalmer	    $echo "$modename: link input file \`$save_arg' does not exist"
1410240a9a23Smbalmer	    exit $EXIT_FAILURE
1411240a9a23Smbalmer	  fi
1412240a9a23Smbalmer	  arg=$save_arg
1413240a9a23Smbalmer	  prev=
1414240a9a23Smbalmer	  continue
1415240a9a23Smbalmer	  ;;
1416240a9a23Smbalmer	rpath | xrpath)
1417240a9a23Smbalmer	  # We need an absolute path.
1418240a9a23Smbalmer	  case $arg in
1419240a9a23Smbalmer	  [\\/]* | [A-Za-z]:[\\/]*) ;;
1420240a9a23Smbalmer	  *)
1421240a9a23Smbalmer	    $echo "$modename: only absolute run-paths are allowed" 1>&2
1422240a9a23Smbalmer	    exit $EXIT_FAILURE
1423240a9a23Smbalmer	    ;;
1424240a9a23Smbalmer	  esac
1425240a9a23Smbalmer	  if test "$prev" = rpath; then
1426240a9a23Smbalmer	    case "$rpath " in
1427240a9a23Smbalmer	    *" $arg "*) ;;
1428240a9a23Smbalmer	    *) rpath="$rpath $arg" ;;
1429240a9a23Smbalmer	    esac
1430240a9a23Smbalmer	  else
1431240a9a23Smbalmer	    case "$xrpath " in
1432240a9a23Smbalmer	    *" $arg "*) ;;
1433240a9a23Smbalmer	    *) xrpath="$xrpath $arg" ;;
1434240a9a23Smbalmer	    esac
1435240a9a23Smbalmer	  fi
1436240a9a23Smbalmer	  prev=
1437240a9a23Smbalmer	  continue
1438240a9a23Smbalmer	  ;;
1439240a9a23Smbalmer	xcompiler)
1440240a9a23Smbalmer	  compiler_flags="$compiler_flags $qarg"
1441240a9a23Smbalmer	  prev=
1442240a9a23Smbalmer	  compile_command="$compile_command $qarg"
1443240a9a23Smbalmer	  finalize_command="$finalize_command $qarg"
1444240a9a23Smbalmer	  continue
1445240a9a23Smbalmer	  ;;
1446240a9a23Smbalmer	xlinker)
1447240a9a23Smbalmer	  linker_flags="$linker_flags $qarg"
1448240a9a23Smbalmer	  compiler_flags="$compiler_flags $wl$qarg"
1449240a9a23Smbalmer	  prev=
1450240a9a23Smbalmer	  compile_command="$compile_command $wl$qarg"
1451240a9a23Smbalmer	  finalize_command="$finalize_command $wl$qarg"
1452240a9a23Smbalmer	  continue
1453240a9a23Smbalmer	  ;;
1454240a9a23Smbalmer	xcclinker)
1455240a9a23Smbalmer	  linker_flags="$linker_flags $qarg"
1456240a9a23Smbalmer	  compiler_flags="$compiler_flags $qarg"
1457240a9a23Smbalmer	  prev=
1458240a9a23Smbalmer	  compile_command="$compile_command $qarg"
1459240a9a23Smbalmer	  finalize_command="$finalize_command $qarg"
1460240a9a23Smbalmer	  continue
1461240a9a23Smbalmer	  ;;
1462240a9a23Smbalmer	shrext)
1463240a9a23Smbalmer  	  shrext_cmds="$arg"
1464240a9a23Smbalmer	  prev=
1465240a9a23Smbalmer	  continue
1466240a9a23Smbalmer	  ;;
1467240a9a23Smbalmer	darwin_framework|darwin_framework_skip)
1468240a9a23Smbalmer	  test "$prev" = "darwin_framework" && compiler_flags="$compiler_flags $arg"
1469240a9a23Smbalmer	  compile_command="$compile_command $arg"
1470240a9a23Smbalmer	  finalize_command="$finalize_command $arg"
1471240a9a23Smbalmer	  prev=
1472240a9a23Smbalmer	  continue
1473240a9a23Smbalmer	  ;;
1474240a9a23Smbalmer	*)
1475240a9a23Smbalmer	  eval "$prev=\"\$arg\""
1476240a9a23Smbalmer	  prev=
1477240a9a23Smbalmer	  continue
1478240a9a23Smbalmer	  ;;
1479240a9a23Smbalmer	esac
1480240a9a23Smbalmer      fi # test -n "$prev"
1481240a9a23Smbalmer
1482240a9a23Smbalmer      prevarg="$arg"
1483240a9a23Smbalmer
1484240a9a23Smbalmer      case $arg in
1485240a9a23Smbalmer      -all-static)
1486240a9a23Smbalmer	if test -n "$link_static_flag"; then
1487240a9a23Smbalmer	  compile_command="$compile_command $link_static_flag"
1488240a9a23Smbalmer	  finalize_command="$finalize_command $link_static_flag"
1489240a9a23Smbalmer	fi
1490240a9a23Smbalmer	continue
1491240a9a23Smbalmer	;;
1492240a9a23Smbalmer
1493240a9a23Smbalmer      -allow-undefined)
1494240a9a23Smbalmer	# FIXME: remove this flag sometime in the future.
1495240a9a23Smbalmer	$echo "$modename: \`-allow-undefined' is deprecated because it is the default" 1>&2
1496240a9a23Smbalmer	continue
1497240a9a23Smbalmer	;;
1498240a9a23Smbalmer
1499240a9a23Smbalmer      -avoid-version)
1500240a9a23Smbalmer	avoid_version=yes
1501240a9a23Smbalmer	continue
1502240a9a23Smbalmer	;;
1503240a9a23Smbalmer
1504240a9a23Smbalmer      -dlopen)
1505240a9a23Smbalmer	prev=dlfiles
1506240a9a23Smbalmer	continue
1507240a9a23Smbalmer	;;
1508240a9a23Smbalmer
1509240a9a23Smbalmer      -dlpreopen)
1510240a9a23Smbalmer	prev=dlprefiles
1511240a9a23Smbalmer	continue
1512240a9a23Smbalmer	;;
1513240a9a23Smbalmer
1514240a9a23Smbalmer      -export-dynamic)
1515240a9a23Smbalmer	export_dynamic=yes
1516240a9a23Smbalmer	continue
1517240a9a23Smbalmer	;;
1518240a9a23Smbalmer
1519240a9a23Smbalmer      -export-symbols | -export-symbols-regex)
1520240a9a23Smbalmer	if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
1521240a9a23Smbalmer	  $echo "$modename: more than one -exported-symbols argument is not allowed"
1522240a9a23Smbalmer	  exit $EXIT_FAILURE
1523240a9a23Smbalmer	fi
1524240a9a23Smbalmer	if test "X$arg" = "X-export-symbols"; then
1525240a9a23Smbalmer	  prev=expsyms
1526240a9a23Smbalmer	else
1527240a9a23Smbalmer	  prev=expsyms_regex
1528240a9a23Smbalmer	fi
1529240a9a23Smbalmer	continue
1530240a9a23Smbalmer	;;
1531240a9a23Smbalmer
1532240a9a23Smbalmer      -framework|-arch|-isysroot)
1533240a9a23Smbalmer	case " $CC " in
1534240a9a23Smbalmer	  *" ${arg} ${1} "* | *" ${arg}	${1} "*) 
1535240a9a23Smbalmer		prev=darwin_framework_skip ;;
1536240a9a23Smbalmer	  *) compiler_flags="$compiler_flags $arg"
1537240a9a23Smbalmer	     prev=darwin_framework ;;
1538240a9a23Smbalmer	esac
1539240a9a23Smbalmer	compile_command="$compile_command $arg"
1540240a9a23Smbalmer	finalize_command="$finalize_command $arg"
1541240a9a23Smbalmer	continue
1542240a9a23Smbalmer	;;
1543240a9a23Smbalmer
1544240a9a23Smbalmer      -inst-prefix-dir)
1545240a9a23Smbalmer	prev=inst_prefix
1546240a9a23Smbalmer	continue
1547240a9a23Smbalmer	;;
1548240a9a23Smbalmer
1549240a9a23Smbalmer      # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:*
1550240a9a23Smbalmer      # so, if we see these flags be careful not to treat them like -L
1551240a9a23Smbalmer      -L[A-Z][A-Z]*:*)
1552240a9a23Smbalmer	case $with_gcc/$host in
1553240a9a23Smbalmer	no/*-*-irix* | /*-*-irix*)
1554240a9a23Smbalmer	  compile_command="$compile_command $arg"
1555240a9a23Smbalmer	  finalize_command="$finalize_command $arg"
1556240a9a23Smbalmer	  ;;
1557240a9a23Smbalmer	esac
1558240a9a23Smbalmer	continue
1559240a9a23Smbalmer	;;
1560240a9a23Smbalmer
1561240a9a23Smbalmer      -L*)
1562240a9a23Smbalmer	dir=`$echo "X$arg" | $Xsed -e 's/^-L//'`
1563240a9a23Smbalmer	# We need an absolute path.
1564240a9a23Smbalmer	case $dir in
1565240a9a23Smbalmer	[\\/]* | [A-Za-z]:[\\/]*) ;;
1566240a9a23Smbalmer	*)
1567240a9a23Smbalmer	  absdir=`cd "$dir" && pwd`
1568240a9a23Smbalmer	  if test -z "$absdir"; then
1569240a9a23Smbalmer	    $echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2
1570240a9a23Smbalmer	    absdir="$dir"
1571240a9a23Smbalmer	    notinst_path="$notinst_path $dir"
1572240a9a23Smbalmer	  fi
1573240a9a23Smbalmer	  dir="$absdir"
1574240a9a23Smbalmer	  ;;
1575240a9a23Smbalmer	esac
1576240a9a23Smbalmer	case "$deplibs " in
1577240a9a23Smbalmer	*" -L$dir "*) ;;
1578240a9a23Smbalmer	*)
1579240a9a23Smbalmer	  deplibs="$deplibs -L$dir"
1580240a9a23Smbalmer	  lib_search_path="$lib_search_path $dir"
1581240a9a23Smbalmer	  ;;
1582240a9a23Smbalmer	esac
1583240a9a23Smbalmer	case $host in
1584240a9a23Smbalmer	*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
1585240a9a23Smbalmer	  testbindir=`$echo "X$dir" | $Xsed -e 's*/lib$*/bin*'`
1586240a9a23Smbalmer	  case :$dllsearchpath: in
1587240a9a23Smbalmer	  *":$dir:"*) ;;
1588240a9a23Smbalmer	  *) dllsearchpath="$dllsearchpath:$dir";;
1589240a9a23Smbalmer	  esac
1590240a9a23Smbalmer	  case :$dllsearchpath: in
1591240a9a23Smbalmer	  *":$testbindir:"*) ;;
1592240a9a23Smbalmer	  *) dllsearchpath="$dllsearchpath:$testbindir";;
1593240a9a23Smbalmer	  esac
1594240a9a23Smbalmer	  ;;
1595240a9a23Smbalmer	esac
1596240a9a23Smbalmer	continue
1597240a9a23Smbalmer	;;
1598240a9a23Smbalmer
1599240a9a23Smbalmer      -l*)
1600240a9a23Smbalmer	if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then
1601240a9a23Smbalmer	  case $host in
1602240a9a23Smbalmer	  *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos*)
1603240a9a23Smbalmer	    # These systems don't actually have a C or math library (as such)
1604240a9a23Smbalmer	    continue
1605240a9a23Smbalmer	    ;;
1606240a9a23Smbalmer	  *-*-os2*)
1607240a9a23Smbalmer	    # These systems don't actually have a C library (as such)
1608240a9a23Smbalmer	    test "X$arg" = "X-lc" && continue
1609240a9a23Smbalmer	    ;;
1610240a9a23Smbalmer	  *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
1611240a9a23Smbalmer	    # Do not include libc due to us having libc/libc_r.
1612240a9a23Smbalmer	    test "X$arg" = "X-lc" && continue
1613240a9a23Smbalmer	    ;;
1614240a9a23Smbalmer	  *-*-rhapsody* | *-*-darwin1.[012])
1615240a9a23Smbalmer	    # Rhapsody C and math libraries are in the System framework
1616240a9a23Smbalmer	    deplibs="$deplibs -framework System"
1617240a9a23Smbalmer	    continue
1618240a9a23Smbalmer	    ;;
1619240a9a23Smbalmer	  *-*-sco3.2v5* | *-*-sco5v6*)
1620240a9a23Smbalmer	    # Causes problems with __ctype
1621240a9a23Smbalmer	    test "X$arg" = "X-lc" && continue
1622240a9a23Smbalmer	    ;;
1623240a9a23Smbalmer	  *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
1624240a9a23Smbalmer	    # Compiler inserts libc in the correct place for threads to work
1625240a9a23Smbalmer	    test "X$arg" = "X-lc" && continue
1626240a9a23Smbalmer	    ;;
1627240a9a23Smbalmer	  esac
1628240a9a23Smbalmer	elif test "X$arg" = "X-lc_r"; then
1629240a9a23Smbalmer	 case $host in
1630240a9a23Smbalmer	 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
1631240a9a23Smbalmer	   # Do not include libc_r directly, use -pthread flag.
1632240a9a23Smbalmer	   continue
1633240a9a23Smbalmer	   ;;
1634240a9a23Smbalmer	 esac
1635240a9a23Smbalmer	fi
1636240a9a23Smbalmer	deplibs="$deplibs $arg"
1637240a9a23Smbalmer	continue
1638240a9a23Smbalmer	;;
1639240a9a23Smbalmer
1640240a9a23Smbalmer      # Tru64 UNIX uses -model [arg] to determine the layout of C++
1641240a9a23Smbalmer      # classes, name mangling, and exception handling.
1642240a9a23Smbalmer      -model)
1643240a9a23Smbalmer	compile_command="$compile_command $arg"
1644240a9a23Smbalmer	compiler_flags="$compiler_flags $arg"
1645240a9a23Smbalmer	finalize_command="$finalize_command $arg"
1646240a9a23Smbalmer	prev=xcompiler
1647240a9a23Smbalmer	continue
1648240a9a23Smbalmer	;;
1649240a9a23Smbalmer
1650240a9a23Smbalmer     -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads)
1651240a9a23Smbalmer	compiler_flags="$compiler_flags $arg"
1652240a9a23Smbalmer	compile_command="$compile_command $arg"
1653240a9a23Smbalmer	finalize_command="$finalize_command $arg"
1654240a9a23Smbalmer	deplibs="$deplibs $arg"
1655240a9a23Smbalmer	continue
1656240a9a23Smbalmer	;;
1657240a9a23Smbalmer
1658240a9a23Smbalmer      -multi_module)
1659240a9a23Smbalmer	single_module="${wl}-multi_module"
1660240a9a23Smbalmer	continue
1661240a9a23Smbalmer	;;
1662240a9a23Smbalmer
1663240a9a23Smbalmer      -module)
1664240a9a23Smbalmer	module=yes
1665240a9a23Smbalmer	continue
1666240a9a23Smbalmer	;;
1667240a9a23Smbalmer
1668240a9a23Smbalmer      # -64, -mips[0-9] enable 64-bit mode on the SGI compiler
1669240a9a23Smbalmer      # -r[0-9][0-9]* specifies the processor on the SGI compiler
1670240a9a23Smbalmer      # -xarch=*, -xtarget=* enable 64-bit mode on the Sun compiler
1671240a9a23Smbalmer      # +DA*, +DD* enable 64-bit mode on the HP compiler
1672240a9a23Smbalmer      # -q* pass through compiler args for the IBM compiler
1673240a9a23Smbalmer      # -m* pass through architecture-specific compiler args for GCC
1674240a9a23Smbalmer      # -m*, -t[45]*, -txscale* pass through architecture-specific
1675240a9a23Smbalmer      # compiler args for GCC
1676240a9a23Smbalmer      # -p, -pg, --coverage, -fprofile-* pass through profiling flag for GCC
1677240a9a23Smbalmer      # -F/path gives path to uninstalled frameworks, gcc on darwin
1678240a9a23Smbalmer      # @file GCC response files
1679240a9a23Smbalmer      -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \
1680240a9a23Smbalmer      -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*)
1681240a9a23Smbalmer
1682240a9a23Smbalmer	# Unknown arguments in both finalize_command and compile_command need
1683240a9a23Smbalmer	# to be aesthetically quoted because they are evaled later.
1684240a9a23Smbalmer	arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
1685240a9a23Smbalmer	case $arg in
1686240a9a23Smbalmer	*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
1687240a9a23Smbalmer	  arg="\"$arg\""
1688240a9a23Smbalmer	  ;;
1689240a9a23Smbalmer	esac
1690240a9a23Smbalmer        compile_command="$compile_command $arg"
1691240a9a23Smbalmer        finalize_command="$finalize_command $arg"
1692240a9a23Smbalmer        compiler_flags="$compiler_flags $arg"
1693240a9a23Smbalmer        continue
1694240a9a23Smbalmer        ;;
1695240a9a23Smbalmer
1696240a9a23Smbalmer      -shrext)
1697240a9a23Smbalmer	prev=shrext
1698240a9a23Smbalmer	continue
1699240a9a23Smbalmer	;;
1700240a9a23Smbalmer
1701240a9a23Smbalmer      -no-fast-install)
1702240a9a23Smbalmer	fast_install=no
1703240a9a23Smbalmer	continue
1704240a9a23Smbalmer	;;
1705240a9a23Smbalmer
1706240a9a23Smbalmer      -no-install)
1707240a9a23Smbalmer	case $host in
1708240a9a23Smbalmer	*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin*)
1709240a9a23Smbalmer	  # The PATH hackery in wrapper scripts is required on Windows
1710240a9a23Smbalmer	  # and Darwin in order for the loader to find any dlls it needs.
1711240a9a23Smbalmer	  $echo "$modename: warning: \`-no-install' is ignored for $host" 1>&2
1712240a9a23Smbalmer	  $echo "$modename: warning: assuming \`-no-fast-install' instead" 1>&2
1713240a9a23Smbalmer	  fast_install=no
1714240a9a23Smbalmer	  ;;
1715240a9a23Smbalmer	*) no_install=yes ;;
1716240a9a23Smbalmer	esac
1717240a9a23Smbalmer	continue
1718240a9a23Smbalmer	;;
1719240a9a23Smbalmer
1720240a9a23Smbalmer      -no-undefined)
1721240a9a23Smbalmer	allow_undefined=no
1722240a9a23Smbalmer	continue
1723240a9a23Smbalmer	;;
1724240a9a23Smbalmer
1725240a9a23Smbalmer      -objectlist)
1726240a9a23Smbalmer	prev=objectlist
1727240a9a23Smbalmer	continue
1728240a9a23Smbalmer	;;
1729240a9a23Smbalmer
1730240a9a23Smbalmer      -o) prev=output ;;
1731240a9a23Smbalmer
1732240a9a23Smbalmer      -precious-files-regex)
1733240a9a23Smbalmer	prev=precious_regex
1734240a9a23Smbalmer	continue
1735240a9a23Smbalmer	;;
1736240a9a23Smbalmer
1737240a9a23Smbalmer      -release)
1738240a9a23Smbalmer	prev=release
1739240a9a23Smbalmer	continue
1740240a9a23Smbalmer	;;
1741240a9a23Smbalmer
1742240a9a23Smbalmer      -rpath)
1743240a9a23Smbalmer	prev=rpath
1744240a9a23Smbalmer	continue
1745240a9a23Smbalmer	;;
1746240a9a23Smbalmer
1747240a9a23Smbalmer      -R)
1748240a9a23Smbalmer	prev=xrpath
1749240a9a23Smbalmer	continue
1750240a9a23Smbalmer	;;
1751240a9a23Smbalmer
1752240a9a23Smbalmer      -R*)
1753240a9a23Smbalmer	dir=`$echo "X$arg" | $Xsed -e 's/^-R//'`
1754240a9a23Smbalmer	# We need an absolute path.
1755240a9a23Smbalmer	case $dir in
1756240a9a23Smbalmer	[\\/]* | [A-Za-z]:[\\/]*) ;;
1757240a9a23Smbalmer	*)
1758240a9a23Smbalmer	  $echo "$modename: only absolute run-paths are allowed" 1>&2
1759240a9a23Smbalmer	  exit $EXIT_FAILURE
1760240a9a23Smbalmer	  ;;
1761240a9a23Smbalmer	esac
1762240a9a23Smbalmer	case "$xrpath " in
1763240a9a23Smbalmer	*" $dir "*) ;;
1764240a9a23Smbalmer	*) xrpath="$xrpath $dir" ;;
1765240a9a23Smbalmer	esac
1766240a9a23Smbalmer	continue
1767240a9a23Smbalmer	;;
1768240a9a23Smbalmer
1769240a9a23Smbalmer      -static | -static-libtool-libs)
1770240a9a23Smbalmer	# The effects of -static are defined in a previous loop.
1771240a9a23Smbalmer	# We used to do the same as -all-static on platforms that
1772240a9a23Smbalmer	# didn't have a PIC flag, but the assumption that the effects
1773240a9a23Smbalmer	# would be equivalent was wrong.  It would break on at least
1774240a9a23Smbalmer	# Digital Unix and AIX.
1775240a9a23Smbalmer	continue
1776240a9a23Smbalmer	;;
1777240a9a23Smbalmer
1778240a9a23Smbalmer      -thread-safe)
1779240a9a23Smbalmer	thread_safe=yes
1780240a9a23Smbalmer	continue
1781240a9a23Smbalmer	;;
1782240a9a23Smbalmer
1783240a9a23Smbalmer      -version-info)
1784240a9a23Smbalmer	prev=vinfo
1785240a9a23Smbalmer	continue
1786240a9a23Smbalmer	;;
1787240a9a23Smbalmer      -version-number)
1788240a9a23Smbalmer	prev=vinfo
1789240a9a23Smbalmer	vinfo_number=yes
1790240a9a23Smbalmer	continue
1791240a9a23Smbalmer	;;
1792240a9a23Smbalmer
1793240a9a23Smbalmer      -Wc,*)
1794240a9a23Smbalmer	args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wc,//'`
1795240a9a23Smbalmer	arg=
1796240a9a23Smbalmer	save_ifs="$IFS"; IFS=','
1797240a9a23Smbalmer	for flag in $args; do
1798240a9a23Smbalmer	  IFS="$save_ifs"
1799240a9a23Smbalmer	  case $flag in
1800240a9a23Smbalmer	    *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
1801240a9a23Smbalmer	    flag="\"$flag\""
1802240a9a23Smbalmer	    ;;
1803240a9a23Smbalmer	  esac
1804240a9a23Smbalmer	  arg="$arg $wl$flag"
1805240a9a23Smbalmer	  compiler_flags="$compiler_flags $flag"
1806240a9a23Smbalmer	done
1807240a9a23Smbalmer	IFS="$save_ifs"
1808240a9a23Smbalmer	arg=`$echo "X$arg" | $Xsed -e "s/^ //"`
1809240a9a23Smbalmer	;;
1810240a9a23Smbalmer
1811240a9a23Smbalmer      -Wl,*)
1812240a9a23Smbalmer	args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wl,//'`
1813240a9a23Smbalmer	arg=
1814240a9a23Smbalmer	save_ifs="$IFS"; IFS=','
1815240a9a23Smbalmer	for flag in $args; do
1816240a9a23Smbalmer	  IFS="$save_ifs"
1817240a9a23Smbalmer	  case $flag in
1818240a9a23Smbalmer	    *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
1819240a9a23Smbalmer	    flag="\"$flag\""
1820240a9a23Smbalmer	    ;;
1821240a9a23Smbalmer	  esac
1822240a9a23Smbalmer	  arg="$arg $wl$flag"
1823240a9a23Smbalmer	  compiler_flags="$compiler_flags $wl$flag"
1824240a9a23Smbalmer	  linker_flags="$linker_flags $flag"
1825240a9a23Smbalmer	done
1826240a9a23Smbalmer	IFS="$save_ifs"
1827240a9a23Smbalmer	arg=`$echo "X$arg" | $Xsed -e "s/^ //"`
1828240a9a23Smbalmer	;;
1829240a9a23Smbalmer
1830240a9a23Smbalmer      -Xcompiler)
1831240a9a23Smbalmer	prev=xcompiler
1832240a9a23Smbalmer	continue
1833240a9a23Smbalmer	;;
1834240a9a23Smbalmer
1835240a9a23Smbalmer      -Xlinker)
1836240a9a23Smbalmer	prev=xlinker
1837240a9a23Smbalmer	continue
1838240a9a23Smbalmer	;;
1839240a9a23Smbalmer
1840240a9a23Smbalmer      -XCClinker)
1841240a9a23Smbalmer	prev=xcclinker
1842240a9a23Smbalmer	continue
1843240a9a23Smbalmer	;;
1844240a9a23Smbalmer
1845240a9a23Smbalmer      # Some other compiler flag.
1846240a9a23Smbalmer      -* | +*)
1847240a9a23Smbalmer	# Unknown arguments in both finalize_command and compile_command need
1848240a9a23Smbalmer	# to be aesthetically quoted because they are evaled later.
1849240a9a23Smbalmer	arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
1850240a9a23Smbalmer	case $arg in
1851240a9a23Smbalmer	*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
1852240a9a23Smbalmer	  arg="\"$arg\""
1853240a9a23Smbalmer	  ;;
1854240a9a23Smbalmer	esac
1855240a9a23Smbalmer	;;
1856240a9a23Smbalmer
1857240a9a23Smbalmer      *.$objext)
1858240a9a23Smbalmer	# A standard object.
1859240a9a23Smbalmer	objs="$objs $arg"
1860240a9a23Smbalmer	;;
1861240a9a23Smbalmer
1862240a9a23Smbalmer      *.lo)
1863240a9a23Smbalmer	# A libtool-controlled object.
1864240a9a23Smbalmer
1865240a9a23Smbalmer	# Check to see that this really is a libtool object.
1866240a9a23Smbalmer	if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
1867240a9a23Smbalmer	  pic_object=
1868240a9a23Smbalmer	  non_pic_object=
1869240a9a23Smbalmer
1870240a9a23Smbalmer	  # Read the .lo file
1871240a9a23Smbalmer	  # If there is no directory component, then add one.
1872240a9a23Smbalmer	  case $arg in
1873240a9a23Smbalmer	  */* | *\\*) . $arg ;;
1874240a9a23Smbalmer	  *) . ./$arg ;;
1875240a9a23Smbalmer	  esac
1876240a9a23Smbalmer
1877240a9a23Smbalmer	  if test -z "$pic_object" || \
1878240a9a23Smbalmer	     test -z "$non_pic_object" ||
1879240a9a23Smbalmer	     test "$pic_object" = none && \
1880240a9a23Smbalmer	     test "$non_pic_object" = none; then
1881240a9a23Smbalmer	    $echo "$modename: cannot find name of object for \`$arg'" 1>&2
1882240a9a23Smbalmer	    exit $EXIT_FAILURE
1883240a9a23Smbalmer	  fi
1884240a9a23Smbalmer
1885240a9a23Smbalmer	  # Extract subdirectory from the argument.
1886240a9a23Smbalmer	  xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
1887240a9a23Smbalmer	  if test "X$xdir" = "X$arg"; then
1888240a9a23Smbalmer	    xdir=
1889240a9a23Smbalmer 	  else
1890240a9a23Smbalmer	    xdir="$xdir/"
1891240a9a23Smbalmer	  fi
1892240a9a23Smbalmer
1893240a9a23Smbalmer	  if test "$pic_object" != none; then
1894240a9a23Smbalmer	    # Prepend the subdirectory the object is found in.
1895240a9a23Smbalmer	    pic_object="$xdir$pic_object"
1896240a9a23Smbalmer
1897240a9a23Smbalmer	    if test "$prev" = dlfiles; then
1898240a9a23Smbalmer	      if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
1899240a9a23Smbalmer		dlfiles="$dlfiles $pic_object"
1900240a9a23Smbalmer		prev=
1901240a9a23Smbalmer		continue
1902240a9a23Smbalmer	      else
1903240a9a23Smbalmer		# If libtool objects are unsupported, then we need to preload.
1904240a9a23Smbalmer		prev=dlprefiles
1905240a9a23Smbalmer	      fi
1906240a9a23Smbalmer	    fi
1907240a9a23Smbalmer
1908240a9a23Smbalmer	    # CHECK ME:  I think I busted this.  -Ossama
1909240a9a23Smbalmer	    if test "$prev" = dlprefiles; then
1910240a9a23Smbalmer	      # Preload the old-style object.
1911240a9a23Smbalmer	      dlprefiles="$dlprefiles $pic_object"
1912240a9a23Smbalmer	      prev=
1913240a9a23Smbalmer	    fi
1914240a9a23Smbalmer
1915240a9a23Smbalmer	    # A PIC object.
1916240a9a23Smbalmer	    libobjs="$libobjs $pic_object"
1917240a9a23Smbalmer	    arg="$pic_object"
1918240a9a23Smbalmer	  fi
1919240a9a23Smbalmer
1920240a9a23Smbalmer	  # Non-PIC object.
1921240a9a23Smbalmer	  if test "$non_pic_object" != none; then
1922240a9a23Smbalmer	    # Prepend the subdirectory the object is found in.
1923240a9a23Smbalmer	    non_pic_object="$xdir$non_pic_object"
1924240a9a23Smbalmer
1925240a9a23Smbalmer	    # A standard non-PIC object
1926240a9a23Smbalmer	    non_pic_objects="$non_pic_objects $non_pic_object"
1927240a9a23Smbalmer	    if test -z "$pic_object" || test "$pic_object" = none ; then
1928240a9a23Smbalmer	      arg="$non_pic_object"
1929240a9a23Smbalmer	    fi
1930240a9a23Smbalmer	  else
1931240a9a23Smbalmer	    # If the PIC object exists, use it instead.
1932240a9a23Smbalmer	    # $xdir was prepended to $pic_object above.
1933240a9a23Smbalmer	    non_pic_object="$pic_object"
1934240a9a23Smbalmer	    non_pic_objects="$non_pic_objects $non_pic_object"
1935240a9a23Smbalmer	  fi
1936240a9a23Smbalmer	else
1937240a9a23Smbalmer	  # Only an error if not doing a dry-run.
1938240a9a23Smbalmer	  if test -z "$run"; then
1939240a9a23Smbalmer	    $echo "$modename: \`$arg' is not a valid libtool object" 1>&2
1940240a9a23Smbalmer	    exit $EXIT_FAILURE
1941240a9a23Smbalmer	  else
1942240a9a23Smbalmer	    # Dry-run case.
1943240a9a23Smbalmer
1944240a9a23Smbalmer	    # Extract subdirectory from the argument.
1945240a9a23Smbalmer	    xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
1946240a9a23Smbalmer	    if test "X$xdir" = "X$arg"; then
1947240a9a23Smbalmer	      xdir=
1948240a9a23Smbalmer	    else
1949240a9a23Smbalmer	      xdir="$xdir/"
1950240a9a23Smbalmer	    fi
1951240a9a23Smbalmer
1952240a9a23Smbalmer	    pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"`
1953240a9a23Smbalmer	    non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"`
1954240a9a23Smbalmer	    libobjs="$libobjs $pic_object"
1955240a9a23Smbalmer	    non_pic_objects="$non_pic_objects $non_pic_object"
1956240a9a23Smbalmer	  fi
1957240a9a23Smbalmer	fi
1958240a9a23Smbalmer	;;
1959240a9a23Smbalmer
1960240a9a23Smbalmer      *.$libext)
1961240a9a23Smbalmer	# An archive.
1962240a9a23Smbalmer	deplibs="$deplibs $arg"
1963240a9a23Smbalmer	old_deplibs="$old_deplibs $arg"
1964240a9a23Smbalmer	continue
1965240a9a23Smbalmer	;;
1966240a9a23Smbalmer
1967240a9a23Smbalmer      *.la)
1968240a9a23Smbalmer	# A libtool-controlled library.
1969240a9a23Smbalmer
1970240a9a23Smbalmer	if test "$prev" = dlfiles; then
1971240a9a23Smbalmer	  # This library was specified with -dlopen.
1972240a9a23Smbalmer	  dlfiles="$dlfiles $arg"
1973240a9a23Smbalmer	  prev=
1974240a9a23Smbalmer	elif test "$prev" = dlprefiles; then
1975240a9a23Smbalmer	  # The library was specified with -dlpreopen.
1976240a9a23Smbalmer	  dlprefiles="$dlprefiles $arg"
1977240a9a23Smbalmer	  prev=
1978240a9a23Smbalmer	else
1979240a9a23Smbalmer	  deplibs="$deplibs $arg"
1980240a9a23Smbalmer	fi
1981240a9a23Smbalmer	continue
1982240a9a23Smbalmer	;;
1983240a9a23Smbalmer
1984240a9a23Smbalmer      # Some other compiler argument.
1985240a9a23Smbalmer      *)
1986240a9a23Smbalmer	# Unknown arguments in both finalize_command and compile_command need
1987240a9a23Smbalmer	# to be aesthetically quoted because they are evaled later.
1988240a9a23Smbalmer	arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
1989240a9a23Smbalmer	case $arg in
1990240a9a23Smbalmer	*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
1991240a9a23Smbalmer	  arg="\"$arg\""
1992240a9a23Smbalmer	  ;;
1993240a9a23Smbalmer	esac
1994240a9a23Smbalmer	;;
1995240a9a23Smbalmer      esac # arg
1996240a9a23Smbalmer
1997240a9a23Smbalmer      # Now actually substitute the argument into the commands.
1998240a9a23Smbalmer      if test -n "$arg"; then
1999240a9a23Smbalmer	compile_command="$compile_command $arg"
2000240a9a23Smbalmer	finalize_command="$finalize_command $arg"
2001240a9a23Smbalmer      fi
2002240a9a23Smbalmer    done # argument parsing loop
2003240a9a23Smbalmer
2004240a9a23Smbalmer    if test -n "$prev"; then
2005240a9a23Smbalmer      $echo "$modename: the \`$prevarg' option requires an argument" 1>&2
2006240a9a23Smbalmer      $echo "$help" 1>&2
2007240a9a23Smbalmer      exit $EXIT_FAILURE
2008240a9a23Smbalmer    fi
2009240a9a23Smbalmer
2010240a9a23Smbalmer    if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then
2011240a9a23Smbalmer      eval arg=\"$export_dynamic_flag_spec\"
2012240a9a23Smbalmer      compile_command="$compile_command $arg"
2013240a9a23Smbalmer      finalize_command="$finalize_command $arg"
2014240a9a23Smbalmer    fi
2015240a9a23Smbalmer
2016240a9a23Smbalmer    oldlibs=
2017240a9a23Smbalmer    # calculate the name of the file, without its directory
2018240a9a23Smbalmer    outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'`
2019240a9a23Smbalmer    libobjs_save="$libobjs"
2020240a9a23Smbalmer
2021240a9a23Smbalmer    if test -n "$shlibpath_var"; then
2022240a9a23Smbalmer      # get the directories listed in $shlibpath_var
2023240a9a23Smbalmer      eval shlib_search_path=\`\$echo \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\`
2024240a9a23Smbalmer    else
2025240a9a23Smbalmer      shlib_search_path=
2026240a9a23Smbalmer    fi
2027240a9a23Smbalmer    eval sys_lib_search_path=\"$sys_lib_search_path_spec\"
2028240a9a23Smbalmer    eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\"
2029240a9a23Smbalmer
2030240a9a23Smbalmer    output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'`
2031240a9a23Smbalmer    if test "X$output_objdir" = "X$output"; then
2032240a9a23Smbalmer      output_objdir="$objdir"
2033240a9a23Smbalmer    else
2034240a9a23Smbalmer      output_objdir="$output_objdir/$objdir"
2035240a9a23Smbalmer    fi
2036240a9a23Smbalmer    # Create the object directory.
2037240a9a23Smbalmer    if test ! -d "$output_objdir"; then
2038240a9a23Smbalmer      $show "$mkdir $output_objdir"
2039240a9a23Smbalmer      $run $mkdir $output_objdir
2040240a9a23Smbalmer      exit_status=$?
2041240a9a23Smbalmer      if test "$exit_status" -ne 0 && test ! -d "$output_objdir"; then
2042240a9a23Smbalmer	exit $exit_status
2043240a9a23Smbalmer      fi
2044240a9a23Smbalmer    fi
2045240a9a23Smbalmer
2046240a9a23Smbalmer    # Determine the type of output
2047240a9a23Smbalmer    case $output in
2048240a9a23Smbalmer    "")
2049240a9a23Smbalmer      $echo "$modename: you must specify an output file" 1>&2
2050240a9a23Smbalmer      $echo "$help" 1>&2
2051240a9a23Smbalmer      exit $EXIT_FAILURE
2052240a9a23Smbalmer      ;;
2053240a9a23Smbalmer    *.$libext) linkmode=oldlib ;;
2054240a9a23Smbalmer    *.lo | *.$objext) linkmode=obj ;;
2055240a9a23Smbalmer    *.la) linkmode=lib ;;
2056240a9a23Smbalmer    *) linkmode=prog ;; # Anything else should be a program.
2057240a9a23Smbalmer    esac
2058240a9a23Smbalmer
2059240a9a23Smbalmer    case $host in
2060240a9a23Smbalmer    *cygwin* | *mingw* | *pw32*)
2061240a9a23Smbalmer      # don't eliminate duplications in $postdeps and $predeps
2062240a9a23Smbalmer      duplicate_compiler_generated_deps=yes
2063240a9a23Smbalmer      ;;
2064240a9a23Smbalmer    *)
2065240a9a23Smbalmer      duplicate_compiler_generated_deps=$duplicate_deps
2066240a9a23Smbalmer      ;;
2067240a9a23Smbalmer    esac
2068240a9a23Smbalmer    specialdeplibs=
2069240a9a23Smbalmer
2070240a9a23Smbalmer    libs=
2071240a9a23Smbalmer    # Find all interdependent deplibs by searching for libraries
2072240a9a23Smbalmer    # that are linked more than once (e.g. -la -lb -la)
2073240a9a23Smbalmer    for deplib in $deplibs; do
2074240a9a23Smbalmer      if test "X$duplicate_deps" = "Xyes" ; then
2075240a9a23Smbalmer	case "$libs " in
2076240a9a23Smbalmer	*" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
2077240a9a23Smbalmer	esac
2078240a9a23Smbalmer      fi
2079240a9a23Smbalmer      libs="$libs $deplib"
2080240a9a23Smbalmer    done
2081240a9a23Smbalmer
2082240a9a23Smbalmer    if test "$linkmode" = lib; then
2083240a9a23Smbalmer      libs="$predeps $libs $compiler_lib_search_path $postdeps"
2084240a9a23Smbalmer
2085240a9a23Smbalmer      # Compute libraries that are listed more than once in $predeps
2086240a9a23Smbalmer      # $postdeps and mark them as special (i.e., whose duplicates are
2087240a9a23Smbalmer      # not to be eliminated).
2088240a9a23Smbalmer      pre_post_deps=
2089240a9a23Smbalmer      if test "X$duplicate_compiler_generated_deps" = "Xyes" ; then
2090240a9a23Smbalmer	for pre_post_dep in $predeps $postdeps; do
2091240a9a23Smbalmer	  case "$pre_post_deps " in
2092240a9a23Smbalmer	  *" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;;
2093240a9a23Smbalmer	  esac
2094240a9a23Smbalmer	  pre_post_deps="$pre_post_deps $pre_post_dep"
2095240a9a23Smbalmer	done
2096240a9a23Smbalmer      fi
2097240a9a23Smbalmer      pre_post_deps=
2098240a9a23Smbalmer    fi
2099240a9a23Smbalmer
2100240a9a23Smbalmer    deplibs=
2101240a9a23Smbalmer    newdependency_libs=
2102240a9a23Smbalmer    newlib_search_path=
2103240a9a23Smbalmer    need_relink=no # whether we're linking any uninstalled libtool libraries
2104240a9a23Smbalmer    notinst_deplibs= # not-installed libtool libraries
2105240a9a23Smbalmer    case $linkmode in
2106240a9a23Smbalmer    lib)
2107240a9a23Smbalmer	passes="conv link"
2108240a9a23Smbalmer	for file in $dlfiles $dlprefiles; do
2109240a9a23Smbalmer	  case $file in
2110240a9a23Smbalmer	  *.la) ;;
2111240a9a23Smbalmer	  *)
2112240a9a23Smbalmer	    $echo "$modename: libraries can \`-dlopen' only libtool libraries: $file" 1>&2
2113240a9a23Smbalmer	    exit $EXIT_FAILURE
2114240a9a23Smbalmer	    ;;
2115240a9a23Smbalmer	  esac
2116240a9a23Smbalmer	done
2117240a9a23Smbalmer	;;
2118240a9a23Smbalmer    prog)
2119240a9a23Smbalmer	compile_deplibs=
2120240a9a23Smbalmer	finalize_deplibs=
2121240a9a23Smbalmer	alldeplibs=no
2122240a9a23Smbalmer	newdlfiles=
2123240a9a23Smbalmer	newdlprefiles=
2124240a9a23Smbalmer	passes="conv scan dlopen dlpreopen link"
2125240a9a23Smbalmer	;;
2126240a9a23Smbalmer    *)  passes="conv"
2127240a9a23Smbalmer	;;
2128240a9a23Smbalmer    esac
2129240a9a23Smbalmer    for pass in $passes; do
2130240a9a23Smbalmer      if test "$linkmode,$pass" = "lib,link" ||
2131240a9a23Smbalmer	 test "$linkmode,$pass" = "prog,scan"; then
2132240a9a23Smbalmer	libs="$deplibs"
2133240a9a23Smbalmer	deplibs=
2134240a9a23Smbalmer      fi
2135240a9a23Smbalmer      if test "$linkmode" = prog; then
2136240a9a23Smbalmer	case $pass in
2137240a9a23Smbalmer	dlopen) libs="$dlfiles" ;;
2138240a9a23Smbalmer	dlpreopen) libs="$dlprefiles" ;;
2139240a9a23Smbalmer	link) libs="$deplibs %DEPLIBS% $dependency_libs" ;;
2140240a9a23Smbalmer	esac
2141240a9a23Smbalmer      fi
2142240a9a23Smbalmer      if test "$pass" = dlopen; then
2143240a9a23Smbalmer	# Collect dlpreopened libraries
2144240a9a23Smbalmer	save_deplibs="$deplibs"
2145240a9a23Smbalmer	deplibs=
2146240a9a23Smbalmer      fi
2147240a9a23Smbalmer      for deplib in $libs; do
2148240a9a23Smbalmer	lib=
2149240a9a23Smbalmer	found=no
2150240a9a23Smbalmer	case $deplib in
2151240a9a23Smbalmer	-mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads)
2152240a9a23Smbalmer	  if test "$linkmode,$pass" = "prog,link"; then
2153240a9a23Smbalmer	    compile_deplibs="$deplib $compile_deplibs"
2154240a9a23Smbalmer	    finalize_deplibs="$deplib $finalize_deplibs"
2155240a9a23Smbalmer	  else
2156240a9a23Smbalmer	    compiler_flags="$compiler_flags $deplib"
2157240a9a23Smbalmer	    test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
2158240a9a23Smbalmer	  fi
2159240a9a23Smbalmer	  continue
2160240a9a23Smbalmer	  ;;
2161240a9a23Smbalmer	-l*)
2162240a9a23Smbalmer	  if test "$linkmode" != lib && test "$linkmode" != prog; then
2163240a9a23Smbalmer	    $echo "$modename: warning: \`-l' is ignored for archives/objects" 1>&2
2164240a9a23Smbalmer	    continue
2165240a9a23Smbalmer	  fi
2166240a9a23Smbalmer	  name=`$echo "X$deplib" | $Xsed -e 's/^-l//'`
2167240a9a23Smbalmer	  if test "$linkmode" = lib; then
2168240a9a23Smbalmer	    searchdirs="$newlib_search_path $lib_search_path $compiler_lib_search_dirs $sys_lib_search_path $shlib_search_path"
2169240a9a23Smbalmer	  else
2170240a9a23Smbalmer	    searchdirs="$newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path"
2171240a9a23Smbalmer	  fi
2172240a9a23Smbalmer	  for searchdir in $searchdirs; do
2173240a9a23Smbalmer	    for search_ext in .la $std_shrext .so .a; do
2174240a9a23Smbalmer	      # Search the libtool library
2175240a9a23Smbalmer	      lib="$searchdir/lib${name}${search_ext}"
2176240a9a23Smbalmer	      if test -f "$lib"; then
2177240a9a23Smbalmer		if test "$search_ext" = ".la"; then
2178240a9a23Smbalmer		  found=yes
2179240a9a23Smbalmer		else
2180240a9a23Smbalmer		  found=no
2181240a9a23Smbalmer		fi
2182240a9a23Smbalmer		break 2
2183240a9a23Smbalmer	      fi
2184240a9a23Smbalmer	    done
2185240a9a23Smbalmer	  done
2186240a9a23Smbalmer	  if test "$found" != yes; then
2187240a9a23Smbalmer	    # deplib doesn't seem to be a libtool library
2188240a9a23Smbalmer	    if test "$linkmode,$pass" = "prog,link"; then
2189240a9a23Smbalmer	      compile_deplibs="$deplib $compile_deplibs"
2190240a9a23Smbalmer	      finalize_deplibs="$deplib $finalize_deplibs"
2191240a9a23Smbalmer	    else
2192240a9a23Smbalmer	      deplibs="$deplib $deplibs"
2193240a9a23Smbalmer	      test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
2194240a9a23Smbalmer	    fi
2195240a9a23Smbalmer	    continue
2196240a9a23Smbalmer	  else # deplib is a libtool library
2197240a9a23Smbalmer	    # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib,
2198240a9a23Smbalmer	    # We need to do some special things here, and not later.
2199240a9a23Smbalmer	    if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
2200240a9a23Smbalmer	      case " $predeps $postdeps " in
2201240a9a23Smbalmer	      *" $deplib "*)
2202240a9a23Smbalmer		if (${SED} -e '2q' $lib |
2203240a9a23Smbalmer                    grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
2204240a9a23Smbalmer		  library_names=
2205240a9a23Smbalmer		  old_library=
2206240a9a23Smbalmer		  case $lib in
2207240a9a23Smbalmer		  */* | *\\*) . $lib ;;
2208240a9a23Smbalmer		  *) . ./$lib ;;
2209240a9a23Smbalmer		  esac
2210240a9a23Smbalmer		  for l in $old_library $library_names; do
2211240a9a23Smbalmer		    ll="$l"
2212240a9a23Smbalmer		  done
2213240a9a23Smbalmer		  if test "X$ll" = "X$old_library" ; then # only static version available
2214240a9a23Smbalmer		    found=no
2215240a9a23Smbalmer		    ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'`
2216240a9a23Smbalmer		    test "X$ladir" = "X$lib" && ladir="."
2217240a9a23Smbalmer		    lib=$ladir/$old_library
2218240a9a23Smbalmer		    if test "$linkmode,$pass" = "prog,link"; then
2219240a9a23Smbalmer		      compile_deplibs="$deplib $compile_deplibs"
2220240a9a23Smbalmer		      finalize_deplibs="$deplib $finalize_deplibs"
2221240a9a23Smbalmer		    else
2222240a9a23Smbalmer		      deplibs="$deplib $deplibs"
2223240a9a23Smbalmer		      test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
2224240a9a23Smbalmer		    fi
2225240a9a23Smbalmer		    continue
2226240a9a23Smbalmer		  fi
2227240a9a23Smbalmer		fi
2228240a9a23Smbalmer	        ;;
2229240a9a23Smbalmer	      *) ;;
2230240a9a23Smbalmer	      esac
2231240a9a23Smbalmer	    fi
2232240a9a23Smbalmer	  fi
2233240a9a23Smbalmer	  ;; # -l
2234240a9a23Smbalmer	-L*)
2235240a9a23Smbalmer	  case $linkmode in
2236240a9a23Smbalmer	  lib)
2237240a9a23Smbalmer	    deplibs="$deplib $deplibs"
2238240a9a23Smbalmer	    test "$pass" = conv && continue
2239240a9a23Smbalmer	    newdependency_libs="$deplib $newdependency_libs"
2240240a9a23Smbalmer	    newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
2241240a9a23Smbalmer	    ;;
2242240a9a23Smbalmer	  prog)
2243240a9a23Smbalmer	    if test "$pass" = conv; then
2244240a9a23Smbalmer	      deplibs="$deplib $deplibs"
2245240a9a23Smbalmer	      continue
2246240a9a23Smbalmer	    fi
2247240a9a23Smbalmer	    if test "$pass" = scan; then
2248240a9a23Smbalmer	      deplibs="$deplib $deplibs"
2249240a9a23Smbalmer	    else
2250240a9a23Smbalmer	      compile_deplibs="$deplib $compile_deplibs"
2251240a9a23Smbalmer	      finalize_deplibs="$deplib $finalize_deplibs"
2252240a9a23Smbalmer	    fi
2253240a9a23Smbalmer	    newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
2254240a9a23Smbalmer	    ;;
2255240a9a23Smbalmer	  *)
2256240a9a23Smbalmer	    $echo "$modename: warning: \`-L' is ignored for archives/objects" 1>&2
2257240a9a23Smbalmer	    ;;
2258240a9a23Smbalmer	  esac # linkmode
2259240a9a23Smbalmer	  continue
2260240a9a23Smbalmer	  ;; # -L
2261240a9a23Smbalmer	-R*)
2262240a9a23Smbalmer	  if test "$pass" = link; then
2263240a9a23Smbalmer	    dir=`$echo "X$deplib" | $Xsed -e 's/^-R//'`
2264240a9a23Smbalmer	    # Make sure the xrpath contains only unique directories.
2265240a9a23Smbalmer	    case "$xrpath " in
2266240a9a23Smbalmer	    *" $dir "*) ;;
2267240a9a23Smbalmer	    *) xrpath="$xrpath $dir" ;;
2268240a9a23Smbalmer	    esac
2269240a9a23Smbalmer	  fi
2270240a9a23Smbalmer	  deplibs="$deplib $deplibs"
2271240a9a23Smbalmer	  continue
2272240a9a23Smbalmer	  ;;
2273240a9a23Smbalmer	*.la) lib="$deplib" ;;
2274240a9a23Smbalmer	*.$libext)
2275240a9a23Smbalmer	  if test "$pass" = conv; then
2276240a9a23Smbalmer	    deplibs="$deplib $deplibs"
2277240a9a23Smbalmer	    continue
2278240a9a23Smbalmer	  fi
2279240a9a23Smbalmer	  case $linkmode in
2280240a9a23Smbalmer	  lib)
2281240a9a23Smbalmer	    valid_a_lib=no
2282240a9a23Smbalmer	    case $deplibs_check_method in
2283240a9a23Smbalmer	      match_pattern*)
2284240a9a23Smbalmer		set dummy $deplibs_check_method
2285240a9a23Smbalmer	        match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
2286240a9a23Smbalmer		if eval $echo \"$deplib\" 2>/dev/null \
2287240a9a23Smbalmer		    | $SED 10q \
2288240a9a23Smbalmer		    | $EGREP "$match_pattern_regex" > /dev/null; then
2289240a9a23Smbalmer		  valid_a_lib=yes
2290240a9a23Smbalmer		fi
2291240a9a23Smbalmer		;;
2292240a9a23Smbalmer	      pass_all)
2293240a9a23Smbalmer		valid_a_lib=yes
2294240a9a23Smbalmer		;;
2295240a9a23Smbalmer            esac
2296240a9a23Smbalmer	    if test "$valid_a_lib" != yes; then
2297240a9a23Smbalmer	      $echo
2298240a9a23Smbalmer	      $echo "*** Warning: Trying to link with static lib archive $deplib."
2299240a9a23Smbalmer	      $echo "*** I have the capability to make that library automatically link in when"
2300240a9a23Smbalmer	      $echo "*** you link to this library.  But I can only do this if you have a"
2301240a9a23Smbalmer	      $echo "*** shared version of the library, which you do not appear to have"
2302240a9a23Smbalmer	      $echo "*** because the file extensions .$libext of this argument makes me believe"
2303240a9a23Smbalmer	      $echo "*** that it is just a static archive that I should not used here."
2304240a9a23Smbalmer	    else
2305240a9a23Smbalmer	      $echo
2306240a9a23Smbalmer	      $echo "*** Warning: Linking the shared library $output against the"
2307240a9a23Smbalmer	      $echo "*** static library $deplib is not portable!"
2308240a9a23Smbalmer	      deplibs="$deplib $deplibs"
2309240a9a23Smbalmer	    fi
2310240a9a23Smbalmer	    continue
2311240a9a23Smbalmer	    ;;
2312240a9a23Smbalmer	  prog)
2313240a9a23Smbalmer	    if test "$pass" != link; then
2314240a9a23Smbalmer	      deplibs="$deplib $deplibs"
2315240a9a23Smbalmer	    else
2316240a9a23Smbalmer	      compile_deplibs="$deplib $compile_deplibs"
2317240a9a23Smbalmer	      finalize_deplibs="$deplib $finalize_deplibs"
2318240a9a23Smbalmer	    fi
2319240a9a23Smbalmer	    continue
2320240a9a23Smbalmer	    ;;
2321240a9a23Smbalmer	  esac # linkmode
2322240a9a23Smbalmer	  ;; # *.$libext
2323240a9a23Smbalmer	*.lo | *.$objext)
2324240a9a23Smbalmer	  if test "$pass" = conv; then
2325240a9a23Smbalmer	    deplibs="$deplib $deplibs"
2326240a9a23Smbalmer	  elif test "$linkmode" = prog; then
2327240a9a23Smbalmer	    if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
2328240a9a23Smbalmer	      # If there is no dlopen support or we're linking statically,
2329240a9a23Smbalmer	      # we need to preload.
2330240a9a23Smbalmer	      newdlprefiles="$newdlprefiles $deplib"
2331240a9a23Smbalmer	      compile_deplibs="$deplib $compile_deplibs"
2332240a9a23Smbalmer	      finalize_deplibs="$deplib $finalize_deplibs"
2333240a9a23Smbalmer	    else
2334240a9a23Smbalmer	      newdlfiles="$newdlfiles $deplib"
2335240a9a23Smbalmer	    fi
2336240a9a23Smbalmer	  fi
2337240a9a23Smbalmer	  continue
2338240a9a23Smbalmer	  ;;
2339240a9a23Smbalmer	%DEPLIBS%)
2340240a9a23Smbalmer	  alldeplibs=yes
2341240a9a23Smbalmer	  continue
2342240a9a23Smbalmer	  ;;
2343240a9a23Smbalmer	esac # case $deplib
2344240a9a23Smbalmer	if test "$found" = yes || test -f "$lib"; then :
2345240a9a23Smbalmer	else
2346240a9a23Smbalmer	  $echo "$modename: cannot find the library \`$lib' or unhandled argument \`$deplib'" 1>&2
2347240a9a23Smbalmer	  exit $EXIT_FAILURE
2348240a9a23Smbalmer	fi
2349240a9a23Smbalmer
2350240a9a23Smbalmer	# Check to see that this really is a libtool archive.
2351240a9a23Smbalmer	if (${SED} -e '2q' $lib | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
2352240a9a23Smbalmer	else
2353240a9a23Smbalmer	  $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
2354240a9a23Smbalmer	  exit $EXIT_FAILURE
2355240a9a23Smbalmer	fi
2356240a9a23Smbalmer
2357240a9a23Smbalmer	ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'`
2358240a9a23Smbalmer	test "X$ladir" = "X$lib" && ladir="."
2359240a9a23Smbalmer
2360240a9a23Smbalmer	dlname=
2361240a9a23Smbalmer	dlopen=
2362240a9a23Smbalmer	dlpreopen=
2363240a9a23Smbalmer	libdir=
2364240a9a23Smbalmer	library_names=
2365240a9a23Smbalmer	old_library=
2366240a9a23Smbalmer	# If the library was installed with an old release of libtool,
2367240a9a23Smbalmer	# it will not redefine variables installed, or shouldnotlink
2368240a9a23Smbalmer	installed=yes
2369240a9a23Smbalmer	shouldnotlink=no
2370240a9a23Smbalmer	avoidtemprpath=
2371240a9a23Smbalmer
2372240a9a23Smbalmer
2373240a9a23Smbalmer	# Read the .la file
2374240a9a23Smbalmer	case $lib in
2375240a9a23Smbalmer	*/* | *\\*) . $lib ;;
2376240a9a23Smbalmer	*) . ./$lib ;;
2377240a9a23Smbalmer	esac
2378240a9a23Smbalmer
2379240a9a23Smbalmer	if test "$linkmode,$pass" = "lib,link" ||
2380240a9a23Smbalmer	   test "$linkmode,$pass" = "prog,scan" ||
2381240a9a23Smbalmer	   { test "$linkmode" != prog && test "$linkmode" != lib; }; then
2382240a9a23Smbalmer	  test -n "$dlopen" && dlfiles="$dlfiles $dlopen"
2383240a9a23Smbalmer	  test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen"
2384240a9a23Smbalmer	fi
2385240a9a23Smbalmer
2386240a9a23Smbalmer	if test "$pass" = conv; then
2387240a9a23Smbalmer	  # Only check for convenience libraries
2388240a9a23Smbalmer	  deplibs="$lib $deplibs"
2389240a9a23Smbalmer	  if test -z "$libdir"; then
2390240a9a23Smbalmer	    if test -z "$old_library"; then
2391240a9a23Smbalmer	      $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
2392240a9a23Smbalmer	      exit $EXIT_FAILURE
2393240a9a23Smbalmer	    fi
2394240a9a23Smbalmer	    # It is a libtool convenience library, so add in its objects.
2395240a9a23Smbalmer	    convenience="$convenience $ladir/$objdir/$old_library"
2396240a9a23Smbalmer	    old_convenience="$old_convenience $ladir/$objdir/$old_library"
2397240a9a23Smbalmer	  elif test "$linkmode" != prog && test "$linkmode" != lib; then
2398240a9a23Smbalmer	    $echo "$modename: \`$lib' is not a convenience library" 1>&2
2399240a9a23Smbalmer	    exit $EXIT_FAILURE
2400240a9a23Smbalmer	  fi
2401240a9a23Smbalmer	  tmp_libs=
2402240a9a23Smbalmer	  for deplib in $dependency_libs; do
2403240a9a23Smbalmer	    deplibs="$deplib $deplibs"
2404240a9a23Smbalmer	    if test "X$duplicate_deps" = "Xyes" ; then
2405240a9a23Smbalmer	      case "$tmp_libs " in
2406240a9a23Smbalmer	      *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
2407240a9a23Smbalmer	      esac
2408240a9a23Smbalmer	    fi
2409240a9a23Smbalmer	    tmp_libs="$tmp_libs $deplib"
2410240a9a23Smbalmer	  done
2411240a9a23Smbalmer	  continue
2412240a9a23Smbalmer	fi # $pass = conv
2413240a9a23Smbalmer
2414240a9a23Smbalmer
2415240a9a23Smbalmer	# Get the name of the library we link against.
2416240a9a23Smbalmer	linklib=
2417240a9a23Smbalmer	for l in $old_library $library_names; do
2418240a9a23Smbalmer	  linklib="$l"
2419240a9a23Smbalmer	done
2420240a9a23Smbalmer	if test -z "$linklib"; then
2421240a9a23Smbalmer	  $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
2422240a9a23Smbalmer	  exit $EXIT_FAILURE
2423240a9a23Smbalmer	fi
2424240a9a23Smbalmer
2425240a9a23Smbalmer	# This library was specified with -dlopen.
2426240a9a23Smbalmer	if test "$pass" = dlopen; then
2427240a9a23Smbalmer	  if test -z "$libdir"; then
2428240a9a23Smbalmer	    $echo "$modename: cannot -dlopen a convenience library: \`$lib'" 1>&2
2429240a9a23Smbalmer	    exit $EXIT_FAILURE
2430240a9a23Smbalmer	  fi
2431240a9a23Smbalmer	  if test -z "$dlname" ||
2432240a9a23Smbalmer	     test "$dlopen_support" != yes ||
2433240a9a23Smbalmer	     test "$build_libtool_libs" = no; then
2434240a9a23Smbalmer	    # If there is no dlname, no dlopen support or we're linking
2435240a9a23Smbalmer	    # statically, we need to preload.  We also need to preload any
2436240a9a23Smbalmer	    # dependent libraries so libltdl's deplib preloader doesn't
2437240a9a23Smbalmer	    # bomb out in the load deplibs phase.
2438240a9a23Smbalmer	    dlprefiles="$dlprefiles $lib $dependency_libs"
2439240a9a23Smbalmer	  else
2440240a9a23Smbalmer	    newdlfiles="$newdlfiles $lib"
2441240a9a23Smbalmer	  fi
2442240a9a23Smbalmer	  continue
2443240a9a23Smbalmer	fi # $pass = dlopen
2444240a9a23Smbalmer
2445240a9a23Smbalmer	# We need an absolute path.
2446240a9a23Smbalmer	case $ladir in
2447240a9a23Smbalmer	[\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;;
2448240a9a23Smbalmer	*)
2449240a9a23Smbalmer	  abs_ladir=`cd "$ladir" && pwd`
2450240a9a23Smbalmer	  if test -z "$abs_ladir"; then
2451240a9a23Smbalmer	    $echo "$modename: warning: cannot determine absolute directory name of \`$ladir'" 1>&2
2452240a9a23Smbalmer	    $echo "$modename: passing it literally to the linker, although it might fail" 1>&2
2453240a9a23Smbalmer	    abs_ladir="$ladir"
2454240a9a23Smbalmer	  fi
2455240a9a23Smbalmer	  ;;
2456240a9a23Smbalmer	esac
2457240a9a23Smbalmer	laname=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
2458240a9a23Smbalmer
2459240a9a23Smbalmer	# Find the relevant object directory and library name.
2460240a9a23Smbalmer	if test "X$installed" = Xyes; then
2461240a9a23Smbalmer	  if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then
2462240a9a23Smbalmer	    $echo "$modename: warning: library \`$lib' was moved." 1>&2
2463240a9a23Smbalmer	    dir="$ladir"
2464240a9a23Smbalmer	    absdir="$abs_ladir"
2465240a9a23Smbalmer	    libdir="$abs_ladir"
2466240a9a23Smbalmer	  else
2467240a9a23Smbalmer	    dir="$libdir"
2468240a9a23Smbalmer	    absdir="$libdir"
2469240a9a23Smbalmer	  fi
2470240a9a23Smbalmer	  test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes
2471240a9a23Smbalmer	else
2472240a9a23Smbalmer	  if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then
2473240a9a23Smbalmer	    dir="$ladir"
2474240a9a23Smbalmer	    absdir="$abs_ladir"
2475240a9a23Smbalmer	    # Remove this search path later
2476240a9a23Smbalmer	    notinst_path="$notinst_path $abs_ladir"
2477240a9a23Smbalmer	  else
2478240a9a23Smbalmer	    dir="$ladir/$objdir"
2479240a9a23Smbalmer	    absdir="$abs_ladir/$objdir"
2480240a9a23Smbalmer	    # Remove this search path later
2481240a9a23Smbalmer	    notinst_path="$notinst_path $abs_ladir"
2482240a9a23Smbalmer	  fi
2483240a9a23Smbalmer	fi # $installed = yes
2484240a9a23Smbalmer	name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
2485240a9a23Smbalmer
2486240a9a23Smbalmer	# This library was specified with -dlpreopen.
2487240a9a23Smbalmer	if test "$pass" = dlpreopen; then
2488240a9a23Smbalmer	  if test -z "$libdir"; then
2489240a9a23Smbalmer	    $echo "$modename: cannot -dlpreopen a convenience library: \`$lib'" 1>&2
2490240a9a23Smbalmer	    exit $EXIT_FAILURE
2491240a9a23Smbalmer	  fi
2492240a9a23Smbalmer	  # Prefer using a static library (so that no silly _DYNAMIC symbols
2493240a9a23Smbalmer	  # are required to link).
2494240a9a23Smbalmer	  if test -n "$old_library"; then
2495240a9a23Smbalmer	    newdlprefiles="$newdlprefiles $dir/$old_library"
2496240a9a23Smbalmer	  # Otherwise, use the dlname, so that lt_dlopen finds it.
2497240a9a23Smbalmer	  elif test -n "$dlname"; then
2498240a9a23Smbalmer	    newdlprefiles="$newdlprefiles $dir/$dlname"
2499240a9a23Smbalmer	  else
2500240a9a23Smbalmer	    newdlprefiles="$newdlprefiles $dir/$linklib"
2501240a9a23Smbalmer	  fi
2502240a9a23Smbalmer	fi # $pass = dlpreopen
2503240a9a23Smbalmer
2504240a9a23Smbalmer	if test -z "$libdir"; then
2505240a9a23Smbalmer	  # Link the convenience library
2506240a9a23Smbalmer	  if test "$linkmode" = lib; then
2507240a9a23Smbalmer	    deplibs="$dir/$old_library $deplibs"
2508240a9a23Smbalmer	  elif test "$linkmode,$pass" = "prog,link"; then
2509240a9a23Smbalmer	    compile_deplibs="$dir/$old_library $compile_deplibs"
2510240a9a23Smbalmer	    finalize_deplibs="$dir/$old_library $finalize_deplibs"
2511240a9a23Smbalmer	  else
2512240a9a23Smbalmer	    deplibs="$lib $deplibs" # used for prog,scan pass
2513240a9a23Smbalmer	  fi
2514240a9a23Smbalmer	  continue
2515240a9a23Smbalmer	fi
2516240a9a23Smbalmer
2517240a9a23Smbalmer
2518240a9a23Smbalmer	if test "$linkmode" = prog && test "$pass" != link; then
2519240a9a23Smbalmer	  newlib_search_path="$newlib_search_path $ladir"
2520240a9a23Smbalmer	  deplibs="$lib $deplibs"
2521240a9a23Smbalmer
2522240a9a23Smbalmer	  linkalldeplibs=no
2523240a9a23Smbalmer	  if test "$link_all_deplibs" != no || test -z "$library_names" ||
2524240a9a23Smbalmer	     test "$build_libtool_libs" = no; then
2525240a9a23Smbalmer	    linkalldeplibs=yes
2526240a9a23Smbalmer	  fi
2527240a9a23Smbalmer
2528240a9a23Smbalmer	  tmp_libs=
2529240a9a23Smbalmer	  for deplib in $dependency_libs; do
2530240a9a23Smbalmer	    case $deplib in
2531240a9a23Smbalmer	    -L*) newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`;; ### testsuite: skip nested quoting test
2532240a9a23Smbalmer	    esac
2533240a9a23Smbalmer	    # Need to link against all dependency_libs?
2534240a9a23Smbalmer	    if test "$linkalldeplibs" = yes; then
2535240a9a23Smbalmer	      deplibs="$deplib $deplibs"
2536240a9a23Smbalmer	    else
2537240a9a23Smbalmer	      # Need to hardcode shared library paths
2538240a9a23Smbalmer	      # or/and link against static libraries
2539240a9a23Smbalmer	      newdependency_libs="$deplib $newdependency_libs"
2540240a9a23Smbalmer	    fi
2541240a9a23Smbalmer	    if test "X$duplicate_deps" = "Xyes" ; then
2542240a9a23Smbalmer	      case "$tmp_libs " in
2543240a9a23Smbalmer	      *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
2544240a9a23Smbalmer	      esac
2545240a9a23Smbalmer	    fi
2546240a9a23Smbalmer	    tmp_libs="$tmp_libs $deplib"
2547240a9a23Smbalmer	  done # for deplib
2548240a9a23Smbalmer	  continue
2549240a9a23Smbalmer	fi # $linkmode = prog...
2550240a9a23Smbalmer
2551240a9a23Smbalmer	if test "$linkmode,$pass" = "prog,link"; then
2552240a9a23Smbalmer	  if test -n "$library_names" &&
2553240a9a23Smbalmer	     { { test "$prefer_static_libs" = no ||
2554240a9a23Smbalmer		 test "$prefer_static_libs,$installed" = "built,yes"; } ||
2555240a9a23Smbalmer	       test -z "$old_library"; }; then
2556240a9a23Smbalmer	    # We need to hardcode the library path
2557240a9a23Smbalmer	    if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then
2558240a9a23Smbalmer	      # Make sure the rpath contains only unique directories.
2559240a9a23Smbalmer	      case "$temp_rpath " in
2560240a9a23Smbalmer	      *" $dir "*) ;;
2561240a9a23Smbalmer	      *" $absdir "*) ;;
2562240a9a23Smbalmer	      *) temp_rpath="$temp_rpath $absdir" ;;
2563240a9a23Smbalmer	      esac
2564240a9a23Smbalmer	    fi
2565240a9a23Smbalmer
2566240a9a23Smbalmer	    # Hardcode the library path.
2567240a9a23Smbalmer	    # Skip directories that are in the system default run-time
2568240a9a23Smbalmer	    # search path.
2569240a9a23Smbalmer	    case " $sys_lib_dlsearch_path " in
2570240a9a23Smbalmer	    *" $absdir "*) ;;
2571240a9a23Smbalmer	    *)
2572240a9a23Smbalmer	      case "$compile_rpath " in
2573240a9a23Smbalmer	      *" $absdir "*) ;;
2574240a9a23Smbalmer	      *) compile_rpath="$compile_rpath $absdir"
2575240a9a23Smbalmer	      esac
2576240a9a23Smbalmer	      ;;
2577240a9a23Smbalmer	    esac
2578240a9a23Smbalmer	    case " $sys_lib_dlsearch_path " in
2579240a9a23Smbalmer	    *" $libdir "*) ;;
2580240a9a23Smbalmer	    *)
2581240a9a23Smbalmer	      case "$finalize_rpath " in
2582240a9a23Smbalmer	      *" $libdir "*) ;;
2583240a9a23Smbalmer	      *) finalize_rpath="$finalize_rpath $libdir"
2584240a9a23Smbalmer	      esac
2585240a9a23Smbalmer	      ;;
2586240a9a23Smbalmer	    esac
2587240a9a23Smbalmer	  fi # $linkmode,$pass = prog,link...
2588240a9a23Smbalmer
2589240a9a23Smbalmer	  if test "$alldeplibs" = yes &&
2590240a9a23Smbalmer	     { test "$deplibs_check_method" = pass_all ||
2591240a9a23Smbalmer	       { test "$build_libtool_libs" = yes &&
2592240a9a23Smbalmer		 test -n "$library_names"; }; }; then
2593240a9a23Smbalmer	    # We only need to search for static libraries
2594240a9a23Smbalmer	    continue
2595240a9a23Smbalmer	  fi
2596240a9a23Smbalmer	fi
2597240a9a23Smbalmer
2598240a9a23Smbalmer	link_static=no # Whether the deplib will be linked statically
2599240a9a23Smbalmer	use_static_libs=$prefer_static_libs
2600240a9a23Smbalmer	if test "$use_static_libs" = built && test "$installed" = yes ; then
2601240a9a23Smbalmer	  use_static_libs=no
2602240a9a23Smbalmer	fi
2603240a9a23Smbalmer	if test -n "$library_names" &&
2604240a9a23Smbalmer	   { test "$use_static_libs" = no || test -z "$old_library"; }; then
2605240a9a23Smbalmer	  if test "$installed" = no; then
2606240a9a23Smbalmer	    notinst_deplibs="$notinst_deplibs $lib"
2607240a9a23Smbalmer	    test -z "$DESTDIR" && need_relink=yes
2608240a9a23Smbalmer	  fi
2609240a9a23Smbalmer	  # This is a shared library
2610240a9a23Smbalmer
2611240a9a23Smbalmer	  # Warn about portability, can't link against -module's on
2612240a9a23Smbalmer	  # some systems (darwin)
2613240a9a23Smbalmer	  if test "$shouldnotlink" = yes && test "$pass" = link ; then
2614240a9a23Smbalmer	    $echo
2615240a9a23Smbalmer	    if test "$linkmode" = prog; then
2616240a9a23Smbalmer	      $echo "*** Warning: Linking the executable $output against the loadable module"
2617240a9a23Smbalmer	    else
2618240a9a23Smbalmer	      $echo "*** Warning: Linking the shared library $output against the loadable module"
2619240a9a23Smbalmer	    fi
2620240a9a23Smbalmer	    $echo "*** $linklib is not portable!"
2621240a9a23Smbalmer	  fi
2622240a9a23Smbalmer	  if test "$linkmode" = lib &&
2623240a9a23Smbalmer	     test "$hardcode_into_libs" = yes; then
2624240a9a23Smbalmer	    # Hardcode the library path.
2625240a9a23Smbalmer	    # Skip directories that are in the system default run-time
2626240a9a23Smbalmer	    # search path.
2627240a9a23Smbalmer	    case " $sys_lib_dlsearch_path " in
2628240a9a23Smbalmer	    *" $absdir "*) ;;
2629240a9a23Smbalmer	    *)
2630240a9a23Smbalmer	      case "$compile_rpath " in
2631240a9a23Smbalmer	      *" $absdir "*) ;;
2632240a9a23Smbalmer	      *) compile_rpath="$compile_rpath $absdir"
2633240a9a23Smbalmer	      esac
2634240a9a23Smbalmer	      ;;
2635240a9a23Smbalmer	    esac
2636240a9a23Smbalmer	    case " $sys_lib_dlsearch_path " in
2637240a9a23Smbalmer	    *" $libdir "*) ;;
2638240a9a23Smbalmer	    *)
2639240a9a23Smbalmer	      case "$finalize_rpath " in
2640240a9a23Smbalmer	      *" $libdir "*) ;;
2641240a9a23Smbalmer	      *) finalize_rpath="$finalize_rpath $libdir"
2642240a9a23Smbalmer	      esac
2643240a9a23Smbalmer	      ;;
2644240a9a23Smbalmer	    esac
2645240a9a23Smbalmer	  fi
2646240a9a23Smbalmer
2647240a9a23Smbalmer	  if test -n "$old_archive_from_expsyms_cmds"; then
2648240a9a23Smbalmer	    # figure out the soname
2649240a9a23Smbalmer	    set dummy $library_names
2650240a9a23Smbalmer	    realname="$2"
2651240a9a23Smbalmer	    shift; shift
2652240a9a23Smbalmer	    libname=`eval \\$echo \"$libname_spec\"`
2653240a9a23Smbalmer	    # use dlname if we got it. it's perfectly good, no?
2654240a9a23Smbalmer	    if test -n "$dlname"; then
2655240a9a23Smbalmer	      soname="$dlname"
2656240a9a23Smbalmer	    elif test -n "$soname_spec"; then
2657240a9a23Smbalmer	      # bleh windows
2658240a9a23Smbalmer	      case $host in
2659240a9a23Smbalmer	      *cygwin* | mingw*)
2660240a9a23Smbalmer		major=`expr $current - $age`
2661240a9a23Smbalmer		versuffix="-$major"
2662240a9a23Smbalmer		;;
2663240a9a23Smbalmer	      esac
2664240a9a23Smbalmer	      eval soname=\"$soname_spec\"
2665240a9a23Smbalmer	    else
2666240a9a23Smbalmer	      soname="$realname"
2667240a9a23Smbalmer	    fi
2668240a9a23Smbalmer
2669240a9a23Smbalmer	    # Make a new name for the extract_expsyms_cmds to use
2670240a9a23Smbalmer	    soroot="$soname"
2671240a9a23Smbalmer	    soname=`$echo $soroot | ${SED} -e 's/^.*\///'`
2672240a9a23Smbalmer	    newlib="libimp-`$echo $soname | ${SED} 's/^lib//;s/\.dll$//'`.a"
2673240a9a23Smbalmer
2674240a9a23Smbalmer	    # If the library has no export list, then create one now
2675240a9a23Smbalmer	    if test -f "$output_objdir/$soname-def"; then :
2676240a9a23Smbalmer	    else
2677240a9a23Smbalmer	      $show "extracting exported symbol list from \`$soname'"
2678240a9a23Smbalmer	      save_ifs="$IFS"; IFS='~'
2679240a9a23Smbalmer	      cmds=$extract_expsyms_cmds
2680240a9a23Smbalmer	      for cmd in $cmds; do
2681240a9a23Smbalmer		IFS="$save_ifs"
2682240a9a23Smbalmer		eval cmd=\"$cmd\"
2683240a9a23Smbalmer		$show "$cmd"
2684240a9a23Smbalmer		$run eval "$cmd" || exit $?
2685240a9a23Smbalmer	      done
2686240a9a23Smbalmer	      IFS="$save_ifs"
2687240a9a23Smbalmer	    fi
2688240a9a23Smbalmer
2689240a9a23Smbalmer	    # Create $newlib
2690240a9a23Smbalmer	    if test -f "$output_objdir/$newlib"; then :; else
2691240a9a23Smbalmer	      $show "generating import library for \`$soname'"
2692240a9a23Smbalmer	      save_ifs="$IFS"; IFS='~'
2693240a9a23Smbalmer	      cmds=$old_archive_from_expsyms_cmds
2694240a9a23Smbalmer	      for cmd in $cmds; do
2695240a9a23Smbalmer		IFS="$save_ifs"
2696240a9a23Smbalmer		eval cmd=\"$cmd\"
2697240a9a23Smbalmer		$show "$cmd"
2698240a9a23Smbalmer		$run eval "$cmd" || exit $?
2699240a9a23Smbalmer	      done
2700240a9a23Smbalmer	      IFS="$save_ifs"
2701240a9a23Smbalmer	    fi
2702240a9a23Smbalmer	    # make sure the library variables are pointing to the new library
2703240a9a23Smbalmer	    dir=$output_objdir
2704240a9a23Smbalmer	    linklib=$newlib
2705240a9a23Smbalmer	  fi # test -n "$old_archive_from_expsyms_cmds"
2706240a9a23Smbalmer
2707240a9a23Smbalmer	  if test "$linkmode" = prog || test "$mode" != relink; then
2708240a9a23Smbalmer	    add_shlibpath=
2709240a9a23Smbalmer	    add_dir=
2710240a9a23Smbalmer	    add=
2711240a9a23Smbalmer	    lib_linked=yes
2712240a9a23Smbalmer	    case $hardcode_action in
2713240a9a23Smbalmer	    immediate | unsupported)
2714240a9a23Smbalmer	      if test "$hardcode_direct" = no; then
2715240a9a23Smbalmer		add="$dir/$linklib"
2716240a9a23Smbalmer		case $host in
2717240a9a23Smbalmer		  *-*-sco3.2v5.0.[024]*) add_dir="-L$dir" ;;
2718240a9a23Smbalmer		  *-*-sysv4*uw2*) add_dir="-L$dir" ;;
2719240a9a23Smbalmer		  *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \
2720240a9a23Smbalmer		    *-*-unixware7*) add_dir="-L$dir" ;;
2721240a9a23Smbalmer		  *-*-darwin* )
2722240a9a23Smbalmer		    # if the lib is a module then we can not link against
2723240a9a23Smbalmer		    # it, someone is ignoring the new warnings I added
2724240a9a23Smbalmer		    if /usr/bin/file -L $add 2> /dev/null |
2725240a9a23Smbalmer                      $EGREP ": [^:]* bundle" >/dev/null ; then
2726240a9a23Smbalmer		      $echo "** Warning, lib $linklib is a module, not a shared library"
2727240a9a23Smbalmer		      if test -z "$old_library" ; then
2728240a9a23Smbalmer		        $echo
2729240a9a23Smbalmer		        $echo "** And there doesn't seem to be a static archive available"
2730240a9a23Smbalmer		        $echo "** The link will probably fail, sorry"
2731240a9a23Smbalmer		      else
2732240a9a23Smbalmer		        add="$dir/$old_library"
2733240a9a23Smbalmer		      fi
2734240a9a23Smbalmer		    fi
2735240a9a23Smbalmer		esac
2736240a9a23Smbalmer	      elif test "$hardcode_minus_L" = no; then
2737240a9a23Smbalmer		case $host in
2738240a9a23Smbalmer		*-*-sunos*) add_shlibpath="$dir" ;;
2739240a9a23Smbalmer		esac
2740240a9a23Smbalmer		add_dir="-L$dir"
2741240a9a23Smbalmer		add="-l$name"
2742240a9a23Smbalmer	      elif test "$hardcode_shlibpath_var" = no; then
2743240a9a23Smbalmer		add_shlibpath="$dir"
2744240a9a23Smbalmer		add="-l$name"
2745240a9a23Smbalmer	      else
2746240a9a23Smbalmer		lib_linked=no
2747240a9a23Smbalmer	      fi
2748240a9a23Smbalmer	      ;;
2749240a9a23Smbalmer	    relink)
2750240a9a23Smbalmer	      if test "$hardcode_direct" = yes; then
2751240a9a23Smbalmer		add="$dir/$linklib"
2752240a9a23Smbalmer	      elif test "$hardcode_minus_L" = yes; then
2753240a9a23Smbalmer		add_dir="-L$dir"
2754240a9a23Smbalmer		# Try looking first in the location we're being installed to.
2755240a9a23Smbalmer		if test -n "$inst_prefix_dir"; then
2756240a9a23Smbalmer		  case $libdir in
2757240a9a23Smbalmer		    [\\/]*)
2758240a9a23Smbalmer		      add_dir="$add_dir -L$inst_prefix_dir$libdir"
2759240a9a23Smbalmer		      ;;
2760240a9a23Smbalmer		  esac
2761240a9a23Smbalmer		fi
2762240a9a23Smbalmer		add="-l$name"
2763240a9a23Smbalmer	      elif test "$hardcode_shlibpath_var" = yes; then
2764240a9a23Smbalmer		add_shlibpath="$dir"
2765240a9a23Smbalmer		add="-l$name"
2766240a9a23Smbalmer	      else
2767240a9a23Smbalmer		lib_linked=no
2768240a9a23Smbalmer	      fi
2769240a9a23Smbalmer	      ;;
2770240a9a23Smbalmer	    *) lib_linked=no ;;
2771240a9a23Smbalmer	    esac
2772240a9a23Smbalmer
2773240a9a23Smbalmer	    if test "$lib_linked" != yes; then
2774240a9a23Smbalmer	      $echo "$modename: configuration error: unsupported hardcode properties"
2775240a9a23Smbalmer	      exit $EXIT_FAILURE
2776240a9a23Smbalmer	    fi
2777240a9a23Smbalmer
2778240a9a23Smbalmer	    if test -n "$add_shlibpath"; then
2779240a9a23Smbalmer	      case :$compile_shlibpath: in
2780240a9a23Smbalmer	      *":$add_shlibpath:"*) ;;
2781240a9a23Smbalmer	      *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;;
2782240a9a23Smbalmer	      esac
2783240a9a23Smbalmer	    fi
2784240a9a23Smbalmer	    if test "$linkmode" = prog; then
2785240a9a23Smbalmer	      test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs"
2786240a9a23Smbalmer	      test -n "$add" && compile_deplibs="$add $compile_deplibs"
2787240a9a23Smbalmer	    else
2788240a9a23Smbalmer	      test -n "$add_dir" && deplibs="$add_dir $deplibs"
2789240a9a23Smbalmer	      test -n "$add" && deplibs="$add $deplibs"
2790240a9a23Smbalmer	      if test "$hardcode_direct" != yes && \
2791240a9a23Smbalmer		 test "$hardcode_minus_L" != yes && \
2792240a9a23Smbalmer		 test "$hardcode_shlibpath_var" = yes; then
2793240a9a23Smbalmer		case :$finalize_shlibpath: in
2794240a9a23Smbalmer		*":$libdir:"*) ;;
2795240a9a23Smbalmer		*) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
2796240a9a23Smbalmer		esac
2797240a9a23Smbalmer	      fi
2798240a9a23Smbalmer	    fi
2799240a9a23Smbalmer	  fi
2800240a9a23Smbalmer
2801240a9a23Smbalmer	  if test "$linkmode" = prog || test "$mode" = relink; then
2802240a9a23Smbalmer	    add_shlibpath=
2803240a9a23Smbalmer	    add_dir=
2804240a9a23Smbalmer	    add=
2805240a9a23Smbalmer	    # Finalize command for both is simple: just hardcode it.
2806240a9a23Smbalmer	    if test "$hardcode_direct" = yes && test -f $libdir/$linklib; then
2807240a9a23Smbalmer	      add="$libdir/$linklib"
2808240a9a23Smbalmer	    elif test "$hardcode_minus_L" = yes; then
2809240a9a23Smbalmer	      add_dir="-L$libdir"
2810240a9a23Smbalmer	      add="-l$name"
2811240a9a23Smbalmer	    elif test "$hardcode_shlibpath_var" = yes; then
2812240a9a23Smbalmer	      case :$finalize_shlibpath: in
2813240a9a23Smbalmer	      *":$libdir:"*) ;;
2814240a9a23Smbalmer	      *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
2815240a9a23Smbalmer	      esac
2816240a9a23Smbalmer	      add="-l$name"
2817240a9a23Smbalmer	    elif test "$hardcode_automatic" = yes; then
2818240a9a23Smbalmer	      if test -n "$inst_prefix_dir" &&
2819240a9a23Smbalmer		 test -f "$inst_prefix_dir$libdir/$linklib" ; then
2820240a9a23Smbalmer	        add="$inst_prefix_dir$libdir/$linklib"
2821240a9a23Smbalmer	      else
2822240a9a23Smbalmer	        add="$libdir/$linklib"
2823240a9a23Smbalmer	      fi
2824240a9a23Smbalmer	    else
2825240a9a23Smbalmer	      # We cannot seem to hardcode it, guess we'll fake it.
2826240a9a23Smbalmer	      add_dir="-L$libdir"
2827240a9a23Smbalmer	      # Try looking first in the location we're being installed to.
2828240a9a23Smbalmer	      if test -n "$inst_prefix_dir"; then
2829240a9a23Smbalmer		case $libdir in
2830240a9a23Smbalmer		  [\\/]*)
2831240a9a23Smbalmer		    add_dir="$add_dir -L$inst_prefix_dir$libdir"
2832240a9a23Smbalmer		    ;;
2833240a9a23Smbalmer		esac
2834240a9a23Smbalmer	      fi
2835240a9a23Smbalmer	      add="-l$name"
2836240a9a23Smbalmer	    fi
2837240a9a23Smbalmer
2838240a9a23Smbalmer	    if test "$linkmode" = prog; then
2839240a9a23Smbalmer	      test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs"
2840240a9a23Smbalmer	      test -n "$add" && finalize_deplibs="$add $finalize_deplibs"
2841240a9a23Smbalmer	    else
2842240a9a23Smbalmer	      test -n "$add_dir" && deplibs="$add_dir $deplibs"
2843240a9a23Smbalmer	      test -n "$add" && deplibs="$add $deplibs"
2844240a9a23Smbalmer	    fi
2845240a9a23Smbalmer	  fi
2846240a9a23Smbalmer	elif test "$linkmode" = prog; then
2847240a9a23Smbalmer	  # Here we assume that one of hardcode_direct or hardcode_minus_L
2848240a9a23Smbalmer	  # is not unsupported.  This is valid on all known static and
2849240a9a23Smbalmer	  # shared platforms.
2850240a9a23Smbalmer	  if test "$hardcode_direct" != unsupported; then
2851240a9a23Smbalmer	    test -n "$old_library" && linklib="$old_library"
2852240a9a23Smbalmer	    compile_deplibs="$dir/$linklib $compile_deplibs"
2853240a9a23Smbalmer	    finalize_deplibs="$dir/$linklib $finalize_deplibs"
2854240a9a23Smbalmer	  else
2855240a9a23Smbalmer	    compile_deplibs="-l$name -L$dir $compile_deplibs"
2856240a9a23Smbalmer	    finalize_deplibs="-l$name -L$dir $finalize_deplibs"
2857240a9a23Smbalmer	  fi
2858240a9a23Smbalmer	elif test "$build_libtool_libs" = yes; then
2859240a9a23Smbalmer	  # Not a shared library
2860240a9a23Smbalmer	  if test "$deplibs_check_method" != pass_all; then
2861240a9a23Smbalmer	    # We're trying link a shared library against a static one
2862240a9a23Smbalmer	    # but the system doesn't support it.
2863240a9a23Smbalmer
2864240a9a23Smbalmer	    # Just print a warning and add the library to dependency_libs so
2865240a9a23Smbalmer	    # that the program can be linked against the static library.
2866240a9a23Smbalmer	    $echo
2867240a9a23Smbalmer	    $echo "*** Warning: This system can not link to static lib archive $lib."
2868240a9a23Smbalmer	    $echo "*** I have the capability to make that library automatically link in when"
2869240a9a23Smbalmer	    $echo "*** you link to this library.  But I can only do this if you have a"
2870240a9a23Smbalmer	    $echo "*** shared version of the library, which you do not appear to have."
2871240a9a23Smbalmer	    if test "$module" = yes; then
2872240a9a23Smbalmer	      $echo "*** But as you try to build a module library, libtool will still create "
2873240a9a23Smbalmer	      $echo "*** a static module, that should work as long as the dlopening application"
2874240a9a23Smbalmer	      $echo "*** is linked with the -dlopen flag to resolve symbols at runtime."
2875240a9a23Smbalmer	      if test -z "$global_symbol_pipe"; then
2876240a9a23Smbalmer		$echo
2877240a9a23Smbalmer		$echo "*** However, this would only work if libtool was able to extract symbol"
2878240a9a23Smbalmer		$echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
2879240a9a23Smbalmer		$echo "*** not find such a program.  So, this module is probably useless."
2880240a9a23Smbalmer		$echo "*** \`nm' from GNU binutils and a full rebuild may help."
2881240a9a23Smbalmer	      fi
2882240a9a23Smbalmer	      if test "$build_old_libs" = no; then
2883240a9a23Smbalmer		build_libtool_libs=module
2884240a9a23Smbalmer		build_old_libs=yes
2885240a9a23Smbalmer	      else
2886240a9a23Smbalmer		build_libtool_libs=no
2887240a9a23Smbalmer	      fi
2888240a9a23Smbalmer	    fi
2889240a9a23Smbalmer	  else
2890240a9a23Smbalmer	    deplibs="$dir/$old_library $deplibs"
2891240a9a23Smbalmer	    link_static=yes
2892240a9a23Smbalmer	  fi
2893240a9a23Smbalmer	fi # link shared/static library?
2894240a9a23Smbalmer
2895240a9a23Smbalmer	if test "$linkmode" = lib; then
2896240a9a23Smbalmer	  if test -n "$dependency_libs" &&
2897240a9a23Smbalmer	     { test "$hardcode_into_libs" != yes ||
2898240a9a23Smbalmer	       test "$build_old_libs" = yes ||
2899240a9a23Smbalmer	       test "$link_static" = yes; }; then
2900240a9a23Smbalmer	    # Extract -R from dependency_libs
2901240a9a23Smbalmer	    temp_deplibs=
2902240a9a23Smbalmer	    for libdir in $dependency_libs; do
2903240a9a23Smbalmer	      case $libdir in
2904240a9a23Smbalmer	      -R*) temp_xrpath=`$echo "X$libdir" | $Xsed -e 's/^-R//'`
2905240a9a23Smbalmer		   case " $xrpath " in
2906240a9a23Smbalmer		   *" $temp_xrpath "*) ;;
2907240a9a23Smbalmer		   *) xrpath="$xrpath $temp_xrpath";;
2908240a9a23Smbalmer		   esac;;
2909240a9a23Smbalmer	      *) temp_deplibs="$temp_deplibs $libdir";;
2910240a9a23Smbalmer	      esac
2911240a9a23Smbalmer	    done
2912240a9a23Smbalmer	    dependency_libs="$temp_deplibs"
2913240a9a23Smbalmer	  fi
2914240a9a23Smbalmer
2915240a9a23Smbalmer	  newlib_search_path="$newlib_search_path $absdir"
2916240a9a23Smbalmer	  # Link against this library
2917240a9a23Smbalmer	  test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs"
2918240a9a23Smbalmer	  # ... and its dependency_libs
2919240a9a23Smbalmer	  tmp_libs=
2920240a9a23Smbalmer	  for deplib in $dependency_libs; do
2921240a9a23Smbalmer	    newdependency_libs="$deplib $newdependency_libs"
2922240a9a23Smbalmer	    if test "X$duplicate_deps" = "Xyes" ; then
2923240a9a23Smbalmer	      case "$tmp_libs " in
2924240a9a23Smbalmer	      *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
2925240a9a23Smbalmer	      esac
2926240a9a23Smbalmer	    fi
2927240a9a23Smbalmer	    tmp_libs="$tmp_libs $deplib"
2928240a9a23Smbalmer	  done
2929240a9a23Smbalmer
2930240a9a23Smbalmer	  if test "$link_all_deplibs" != no; then
2931240a9a23Smbalmer	    # Add the search paths of all dependency libraries
2932240a9a23Smbalmer	    for deplib in $dependency_libs; do
2933240a9a23Smbalmer	      case $deplib in
2934240a9a23Smbalmer	      -L*) path="$deplib" ;;
2935240a9a23Smbalmer	      *.la)
2936240a9a23Smbalmer		dir=`$echo "X$deplib" | $Xsed -e 's%/[^/]*$%%'`
2937240a9a23Smbalmer		test "X$dir" = "X$deplib" && dir="."
2938240a9a23Smbalmer		# We need an absolute path.
2939240a9a23Smbalmer		case $dir in
2940240a9a23Smbalmer		[\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;;
2941240a9a23Smbalmer		*)
2942240a9a23Smbalmer		  absdir=`cd "$dir" && pwd`
2943240a9a23Smbalmer		  if test -z "$absdir"; then
2944240a9a23Smbalmer		    $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2
2945240a9a23Smbalmer		    absdir="$dir"
2946240a9a23Smbalmer		  fi
2947240a9a23Smbalmer		  ;;
2948240a9a23Smbalmer		esac
2949240a9a23Smbalmer		if grep "^installed=no" $deplib > /dev/null; then
2950240a9a23Smbalmer		  path="$absdir/$objdir"
2951240a9a23Smbalmer		else
2952240a9a23Smbalmer		  eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
2953240a9a23Smbalmer		  if test -z "$libdir"; then
2954240a9a23Smbalmer		    $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
2955240a9a23Smbalmer		    exit $EXIT_FAILURE
2956240a9a23Smbalmer		  fi
2957240a9a23Smbalmer		  if test "$absdir" != "$libdir"; then
2958240a9a23Smbalmer		    $echo "$modename: warning: \`$deplib' seems to be moved" 1>&2
2959240a9a23Smbalmer		  fi
2960240a9a23Smbalmer		  path="$absdir"
2961240a9a23Smbalmer		fi
2962240a9a23Smbalmer		depdepl=
2963240a9a23Smbalmer		case $host in
2964240a9a23Smbalmer		*-*-darwin*)
2965240a9a23Smbalmer		  # we do not want to link against static libs,
2966240a9a23Smbalmer		  # but need to link against shared
2967240a9a23Smbalmer		  eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib`
2968240a9a23Smbalmer		  eval deplibdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
2969240a9a23Smbalmer		  if test -n "$deplibrary_names" ; then
2970240a9a23Smbalmer		    for tmp in $deplibrary_names ; do
2971240a9a23Smbalmer		      depdepl=$tmp
2972240a9a23Smbalmer		    done
2973240a9a23Smbalmer		    if test -f "$deplibdir/$depdepl" ; then
2974240a9a23Smbalmer		      depdepl="$deplibdir/$depdepl"
2975240a9a23Smbalmer	      	    elif test -f "$path/$depdepl" ; then
2976240a9a23Smbalmer		      depdepl="$path/$depdepl"
2977240a9a23Smbalmer		    else
2978240a9a23Smbalmer		      # Can't find it, oh well...
2979240a9a23Smbalmer		      depdepl=
2980240a9a23Smbalmer		    fi
2981240a9a23Smbalmer		    # do not add paths which are already there
2982240a9a23Smbalmer		    case " $newlib_search_path " in
2983240a9a23Smbalmer		    *" $path "*) ;;
2984240a9a23Smbalmer		    *) newlib_search_path="$newlib_search_path $path";;
2985240a9a23Smbalmer		    esac
2986240a9a23Smbalmer		  fi
2987240a9a23Smbalmer		  path=""
2988240a9a23Smbalmer		  ;;
2989240a9a23Smbalmer		*)
2990240a9a23Smbalmer		  path="-L$path"
2991240a9a23Smbalmer		  ;;
2992240a9a23Smbalmer		esac
2993240a9a23Smbalmer		;;
2994240a9a23Smbalmer	      -l*)
2995240a9a23Smbalmer		case $host in
2996240a9a23Smbalmer		*-*-darwin*)
2997240a9a23Smbalmer		  # Again, we only want to link against shared libraries
2998240a9a23Smbalmer		  eval tmp_libs=`$echo "X$deplib" | $Xsed -e "s,^\-l,,"`
2999240a9a23Smbalmer		  for tmp in $newlib_search_path ; do
3000240a9a23Smbalmer		    if test -f "$tmp/lib$tmp_libs.dylib" ; then
3001240a9a23Smbalmer		      eval depdepl="$tmp/lib$tmp_libs.dylib"
3002240a9a23Smbalmer		      break
3003240a9a23Smbalmer		    fi
3004240a9a23Smbalmer		  done
3005240a9a23Smbalmer		  path=""
3006240a9a23Smbalmer		  ;;
3007240a9a23Smbalmer		*) continue ;;
3008240a9a23Smbalmer		esac
3009240a9a23Smbalmer		;;
3010240a9a23Smbalmer	      *) continue ;;
3011240a9a23Smbalmer	      esac
3012240a9a23Smbalmer	      case " $deplibs " in
3013240a9a23Smbalmer	      *" $path "*) ;;
3014240a9a23Smbalmer	      *) deplibs="$path $deplibs" ;;
3015240a9a23Smbalmer	      esac
3016240a9a23Smbalmer	      case " $deplibs " in
3017240a9a23Smbalmer	      *" $depdepl "*) ;;
3018240a9a23Smbalmer	      *) deplibs="$depdepl $deplibs" ;;
3019240a9a23Smbalmer	      esac
3020240a9a23Smbalmer	    done
3021240a9a23Smbalmer	  fi # link_all_deplibs != no
3022240a9a23Smbalmer	fi # linkmode = lib
3023240a9a23Smbalmer      done # for deplib in $libs
3024240a9a23Smbalmer      dependency_libs="$newdependency_libs"
3025240a9a23Smbalmer      if test "$pass" = dlpreopen; then
3026240a9a23Smbalmer	# Link the dlpreopened libraries before other libraries
3027240a9a23Smbalmer	for deplib in $save_deplibs; do
3028240a9a23Smbalmer	  deplibs="$deplib $deplibs"
3029240a9a23Smbalmer	done
3030240a9a23Smbalmer      fi
3031240a9a23Smbalmer      if test "$pass" != dlopen; then
3032240a9a23Smbalmer	if test "$pass" != conv; then
3033240a9a23Smbalmer	  # Make sure lib_search_path contains only unique directories.
3034240a9a23Smbalmer	  lib_search_path=
3035240a9a23Smbalmer	  for dir in $newlib_search_path; do
3036240a9a23Smbalmer	    case "$lib_search_path " in
3037240a9a23Smbalmer	    *" $dir "*) ;;
3038240a9a23Smbalmer	    *) lib_search_path="$lib_search_path $dir" ;;
3039240a9a23Smbalmer	    esac
3040240a9a23Smbalmer	  done
3041240a9a23Smbalmer	  newlib_search_path=
3042240a9a23Smbalmer	fi
3043240a9a23Smbalmer
3044240a9a23Smbalmer	if test "$linkmode,$pass" != "prog,link"; then
3045240a9a23Smbalmer	  vars="deplibs"
3046240a9a23Smbalmer	else
3047240a9a23Smbalmer	  vars="compile_deplibs finalize_deplibs"
3048240a9a23Smbalmer	fi
3049240a9a23Smbalmer	for var in $vars dependency_libs; do
3050240a9a23Smbalmer	  # Add libraries to $var in reverse order
3051240a9a23Smbalmer	  eval tmp_libs=\"\$$var\"
3052240a9a23Smbalmer	  new_libs=
3053240a9a23Smbalmer	  for deplib in $tmp_libs; do
3054240a9a23Smbalmer	    # FIXME: Pedantically, this is the right thing to do, so
3055240a9a23Smbalmer	    #        that some nasty dependency loop isn't accidentally
3056240a9a23Smbalmer	    #        broken:
3057240a9a23Smbalmer	    #new_libs="$deplib $new_libs"
3058240a9a23Smbalmer	    # Pragmatically, this seems to cause very few problems in
3059240a9a23Smbalmer	    # practice:
3060240a9a23Smbalmer	    case $deplib in
3061240a9a23Smbalmer	    -L*) new_libs="$deplib $new_libs" ;;
3062240a9a23Smbalmer	    -R*) ;;
3063240a9a23Smbalmer	    *)
3064240a9a23Smbalmer	      # And here is the reason: when a library appears more
3065240a9a23Smbalmer	      # than once as an explicit dependence of a library, or
3066240a9a23Smbalmer	      # is implicitly linked in more than once by the
3067240a9a23Smbalmer	      # compiler, it is considered special, and multiple
3068240a9a23Smbalmer	      # occurrences thereof are not removed.  Compare this
3069240a9a23Smbalmer	      # with having the same library being listed as a
3070240a9a23Smbalmer	      # dependency of multiple other libraries: in this case,
3071240a9a23Smbalmer	      # we know (pedantically, we assume) the library does not
3072240a9a23Smbalmer	      # need to be listed more than once, so we keep only the
3073240a9a23Smbalmer	      # last copy.  This is not always right, but it is rare
3074240a9a23Smbalmer	      # enough that we require users that really mean to play
3075240a9a23Smbalmer	      # such unportable linking tricks to link the library
3076240a9a23Smbalmer	      # using -Wl,-lname, so that libtool does not consider it
3077240a9a23Smbalmer	      # for duplicate removal.
3078240a9a23Smbalmer	      case " $specialdeplibs " in
3079240a9a23Smbalmer	      *" $deplib "*) new_libs="$deplib $new_libs" ;;
3080240a9a23Smbalmer	      *)
3081240a9a23Smbalmer		case " $new_libs " in
3082240a9a23Smbalmer		*" $deplib "*) ;;
3083240a9a23Smbalmer		*) new_libs="$deplib $new_libs" ;;
3084240a9a23Smbalmer		esac
3085240a9a23Smbalmer		;;
3086240a9a23Smbalmer	      esac
3087240a9a23Smbalmer	      ;;
3088240a9a23Smbalmer	    esac
3089240a9a23Smbalmer	  done
3090240a9a23Smbalmer	  tmp_libs=
3091240a9a23Smbalmer	  for deplib in $new_libs; do
3092240a9a23Smbalmer	    case $deplib in
3093240a9a23Smbalmer	    -L*)
3094240a9a23Smbalmer	      case " $tmp_libs " in
3095240a9a23Smbalmer	      *" $deplib "*) ;;
3096240a9a23Smbalmer	      *) tmp_libs="$tmp_libs $deplib" ;;
3097240a9a23Smbalmer	      esac
3098240a9a23Smbalmer	      ;;
3099240a9a23Smbalmer	    *) tmp_libs="$tmp_libs $deplib" ;;
3100240a9a23Smbalmer	    esac
3101240a9a23Smbalmer	  done
3102240a9a23Smbalmer	  eval $var=\"$tmp_libs\"
3103240a9a23Smbalmer	done # for var
3104240a9a23Smbalmer      fi
3105240a9a23Smbalmer      # Last step: remove runtime libs from dependency_libs
3106240a9a23Smbalmer      # (they stay in deplibs)
3107240a9a23Smbalmer      tmp_libs=
3108240a9a23Smbalmer      for i in $dependency_libs ; do
3109240a9a23Smbalmer	case " $predeps $postdeps $compiler_lib_search_path " in
3110240a9a23Smbalmer	*" $i "*)
3111240a9a23Smbalmer	  i=""
3112240a9a23Smbalmer	  ;;
3113240a9a23Smbalmer	esac
3114240a9a23Smbalmer	if test -n "$i" ; then
3115240a9a23Smbalmer	  tmp_libs="$tmp_libs $i"
3116240a9a23Smbalmer	fi
3117240a9a23Smbalmer      done
3118240a9a23Smbalmer      dependency_libs=$tmp_libs
3119240a9a23Smbalmer    done # for pass
3120240a9a23Smbalmer    if test "$linkmode" = prog; then
3121240a9a23Smbalmer      dlfiles="$newdlfiles"
3122240a9a23Smbalmer      dlprefiles="$newdlprefiles"
3123240a9a23Smbalmer    fi
3124240a9a23Smbalmer
3125240a9a23Smbalmer    case $linkmode in
3126240a9a23Smbalmer    oldlib)
3127240a9a23Smbalmer      case " $deplibs" in
3128240a9a23Smbalmer      *\ -l* | *\ -L*)
3129240a9a23Smbalmer	$echo "$modename: warning: \`-l' and \`-L' are ignored for archives" 1>&2 ;;
3130240a9a23Smbalmer      esac
3131240a9a23Smbalmer
3132240a9a23Smbalmer      if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
3133240a9a23Smbalmer	$echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2
3134240a9a23Smbalmer      fi
3135240a9a23Smbalmer
3136240a9a23Smbalmer      if test -n "$rpath"; then
3137240a9a23Smbalmer	$echo "$modename: warning: \`-rpath' is ignored for archives" 1>&2
3138240a9a23Smbalmer      fi
3139240a9a23Smbalmer
3140240a9a23Smbalmer      if test -n "$xrpath"; then
3141240a9a23Smbalmer	$echo "$modename: warning: \`-R' is ignored for archives" 1>&2
3142240a9a23Smbalmer      fi
3143240a9a23Smbalmer
3144240a9a23Smbalmer      if test -n "$vinfo"; then
3145240a9a23Smbalmer	$echo "$modename: warning: \`-version-info/-version-number' is ignored for archives" 1>&2
3146240a9a23Smbalmer      fi
3147240a9a23Smbalmer
3148240a9a23Smbalmer      if test -n "$release"; then
3149240a9a23Smbalmer	$echo "$modename: warning: \`-release' is ignored for archives" 1>&2
3150240a9a23Smbalmer      fi
3151240a9a23Smbalmer
3152240a9a23Smbalmer      if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
3153240a9a23Smbalmer	$echo "$modename: warning: \`-export-symbols' is ignored for archives" 1>&2
3154240a9a23Smbalmer      fi
3155240a9a23Smbalmer
3156240a9a23Smbalmer      # Now set the variables for building old libraries.
3157240a9a23Smbalmer      build_libtool_libs=no
3158240a9a23Smbalmer      oldlibs="$output"
3159240a9a23Smbalmer      objs="$objs$old_deplibs"
3160240a9a23Smbalmer      ;;
3161240a9a23Smbalmer
3162240a9a23Smbalmer    lib)
3163240a9a23Smbalmer      # Make sure we only generate libraries of the form `libNAME.la'.
3164240a9a23Smbalmer      case $outputname in
3165240a9a23Smbalmer      lib*)
3166240a9a23Smbalmer	name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
3167240a9a23Smbalmer	eval shared_ext=\"$shrext_cmds\"
3168240a9a23Smbalmer	eval libname=\"$libname_spec\"
3169240a9a23Smbalmer	;;
3170240a9a23Smbalmer      *)
3171240a9a23Smbalmer	if test "$module" = no; then
3172240a9a23Smbalmer	  $echo "$modename: libtool library \`$output' must begin with \`lib'" 1>&2
3173240a9a23Smbalmer	  $echo "$help" 1>&2
3174240a9a23Smbalmer	  exit $EXIT_FAILURE
3175240a9a23Smbalmer	fi
3176240a9a23Smbalmer	if test "$need_lib_prefix" != no; then
3177240a9a23Smbalmer	  # Add the "lib" prefix for modules if required
3178240a9a23Smbalmer	  name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
3179240a9a23Smbalmer	  eval shared_ext=\"$shrext_cmds\"
3180240a9a23Smbalmer	  eval libname=\"$libname_spec\"
3181240a9a23Smbalmer	else
3182240a9a23Smbalmer	  libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
3183240a9a23Smbalmer	fi
3184240a9a23Smbalmer	;;
3185240a9a23Smbalmer      esac
3186240a9a23Smbalmer
3187240a9a23Smbalmer      if test -n "$objs"; then
3188240a9a23Smbalmer	if test "$deplibs_check_method" != pass_all; then
3189240a9a23Smbalmer	  $echo "$modename: cannot build libtool library \`$output' from non-libtool objects on this host:$objs" 2>&1
3190240a9a23Smbalmer	  exit $EXIT_FAILURE
3191240a9a23Smbalmer	else
3192240a9a23Smbalmer	  $echo
3193240a9a23Smbalmer	  $echo "*** Warning: Linking the shared library $output against the non-libtool"
3194240a9a23Smbalmer	  $echo "*** objects $objs is not portable!"
3195240a9a23Smbalmer	  libobjs="$libobjs $objs"
3196240a9a23Smbalmer	fi
3197240a9a23Smbalmer      fi
3198240a9a23Smbalmer
3199240a9a23Smbalmer      if test "$dlself" != no; then
3200240a9a23Smbalmer	$echo "$modename: warning: \`-dlopen self' is ignored for libtool libraries" 1>&2
3201240a9a23Smbalmer      fi
3202240a9a23Smbalmer
3203240a9a23Smbalmer      set dummy $rpath
3204240a9a23Smbalmer      if test "$#" -gt 2; then
3205240a9a23Smbalmer	$echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2
3206240a9a23Smbalmer      fi
3207240a9a23Smbalmer      install_libdir="$2"
3208240a9a23Smbalmer
3209240a9a23Smbalmer      oldlibs=
3210240a9a23Smbalmer      if test -z "$rpath"; then
3211240a9a23Smbalmer	if test "$build_libtool_libs" = yes; then
3212240a9a23Smbalmer	  # Building a libtool convenience library.
3213240a9a23Smbalmer	  # Some compilers have problems with a `.al' extension so
3214240a9a23Smbalmer	  # convenience libraries should have the same extension an
3215240a9a23Smbalmer	  # archive normally would.
3216240a9a23Smbalmer	  oldlibs="$output_objdir/$libname.$libext $oldlibs"
3217240a9a23Smbalmer	  build_libtool_libs=convenience
3218240a9a23Smbalmer	  build_old_libs=yes
3219240a9a23Smbalmer	fi
3220240a9a23Smbalmer
3221240a9a23Smbalmer	if test -n "$vinfo"; then
3222240a9a23Smbalmer	  $echo "$modename: warning: \`-version-info/-version-number' is ignored for convenience libraries" 1>&2
3223240a9a23Smbalmer	fi
3224240a9a23Smbalmer
3225240a9a23Smbalmer	if test -n "$release"; then
3226240a9a23Smbalmer	  $echo "$modename: warning: \`-release' is ignored for convenience libraries" 1>&2
3227240a9a23Smbalmer	fi
3228240a9a23Smbalmer      else
3229240a9a23Smbalmer
3230240a9a23Smbalmer	# Parse the version information argument.
3231240a9a23Smbalmer	save_ifs="$IFS"; IFS=':'
3232240a9a23Smbalmer	set dummy $vinfo 0 0 0
3233240a9a23Smbalmer	IFS="$save_ifs"
3234240a9a23Smbalmer
3235240a9a23Smbalmer	if test -n "$8"; then
3236240a9a23Smbalmer	  $echo "$modename: too many parameters to \`-version-info'" 1>&2
3237240a9a23Smbalmer	  $echo "$help" 1>&2
3238240a9a23Smbalmer	  exit $EXIT_FAILURE
3239240a9a23Smbalmer	fi
3240240a9a23Smbalmer
3241240a9a23Smbalmer	# convert absolute version numbers to libtool ages
3242240a9a23Smbalmer	# this retains compatibility with .la files and attempts
3243240a9a23Smbalmer	# to make the code below a bit more comprehensible
3244240a9a23Smbalmer
3245240a9a23Smbalmer	case $vinfo_number in
3246240a9a23Smbalmer	yes)
3247240a9a23Smbalmer	  number_major="$2"
3248240a9a23Smbalmer	  number_minor="$3"
3249240a9a23Smbalmer	  number_revision="$4"
3250240a9a23Smbalmer	  #
3251240a9a23Smbalmer	  # There are really only two kinds -- those that
3252240a9a23Smbalmer	  # use the current revision as the major version
3253240a9a23Smbalmer	  # and those that subtract age and use age as
3254240a9a23Smbalmer	  # a minor version.  But, then there is irix
3255240a9a23Smbalmer	  # which has an extra 1 added just for fun
3256240a9a23Smbalmer	  #
3257240a9a23Smbalmer	  case $version_type in
3258240a9a23Smbalmer	  darwin|linux|osf|windows|none)
3259240a9a23Smbalmer	    current=`expr $number_major + $number_minor`
3260240a9a23Smbalmer	    age="$number_minor"
3261240a9a23Smbalmer	    revision="$number_revision"
3262240a9a23Smbalmer	    ;;
3263240a9a23Smbalmer	  freebsd-aout|freebsd-elf|sunos)
3264240a9a23Smbalmer	    current="$number_major"
3265240a9a23Smbalmer	    revision="$number_minor"
3266240a9a23Smbalmer	    age="0"
3267240a9a23Smbalmer	    ;;
3268240a9a23Smbalmer	  irix|nonstopux)
3269240a9a23Smbalmer	    current=`expr $number_major + $number_minor`
3270240a9a23Smbalmer	    age="$number_minor"
3271240a9a23Smbalmer	    revision="$number_minor"
3272240a9a23Smbalmer	    lt_irix_increment=no
3273240a9a23Smbalmer	    ;;
3274240a9a23Smbalmer	  esac
3275240a9a23Smbalmer	  ;;
3276240a9a23Smbalmer	no)
3277240a9a23Smbalmer	  current="$2"
3278240a9a23Smbalmer	  revision="$3"
3279240a9a23Smbalmer	  age="$4"
3280240a9a23Smbalmer	  ;;
3281240a9a23Smbalmer	esac
3282240a9a23Smbalmer
3283240a9a23Smbalmer	# Check that each of the things are valid numbers.
3284240a9a23Smbalmer	case $current in
3285240a9a23Smbalmer	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]) ;;
3286240a9a23Smbalmer	*)
3287240a9a23Smbalmer	  $echo "$modename: CURRENT \`$current' must be a nonnegative integer" 1>&2
3288240a9a23Smbalmer	  $echo "$modename: \`$vinfo' is not valid version information" 1>&2
3289240a9a23Smbalmer	  exit $EXIT_FAILURE
3290240a9a23Smbalmer	  ;;
3291240a9a23Smbalmer	esac
3292240a9a23Smbalmer
3293240a9a23Smbalmer	case $revision in
3294240a9a23Smbalmer	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]) ;;
3295240a9a23Smbalmer	*)
3296240a9a23Smbalmer	  $echo "$modename: REVISION \`$revision' must be a nonnegative integer" 1>&2
3297240a9a23Smbalmer	  $echo "$modename: \`$vinfo' is not valid version information" 1>&2
3298240a9a23Smbalmer	  exit $EXIT_FAILURE
3299240a9a23Smbalmer	  ;;
3300240a9a23Smbalmer	esac
3301240a9a23Smbalmer
3302240a9a23Smbalmer	case $age in
3303240a9a23Smbalmer	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]) ;;
3304240a9a23Smbalmer	*)
3305240a9a23Smbalmer	  $echo "$modename: AGE \`$age' must be a nonnegative integer" 1>&2
3306240a9a23Smbalmer	  $echo "$modename: \`$vinfo' is not valid version information" 1>&2
3307240a9a23Smbalmer	  exit $EXIT_FAILURE
3308240a9a23Smbalmer	  ;;
3309240a9a23Smbalmer	esac
3310240a9a23Smbalmer
3311240a9a23Smbalmer	if test "$age" -gt "$current"; then
3312240a9a23Smbalmer	  $echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2
3313240a9a23Smbalmer	  $echo "$modename: \`$vinfo' is not valid version information" 1>&2
3314240a9a23Smbalmer	  exit $EXIT_FAILURE
3315240a9a23Smbalmer	fi
3316240a9a23Smbalmer
3317240a9a23Smbalmer	# Calculate the version variables.
3318240a9a23Smbalmer	major=
3319240a9a23Smbalmer	versuffix=
3320240a9a23Smbalmer	verstring=
3321240a9a23Smbalmer	case $version_type in
3322240a9a23Smbalmer	none) ;;
3323240a9a23Smbalmer
3324240a9a23Smbalmer	darwin)
3325240a9a23Smbalmer	  # Like Linux, but with the current version available in
3326240a9a23Smbalmer	  # verstring for coding it into the library header
3327240a9a23Smbalmer	  major=.`expr $current - $age`
3328240a9a23Smbalmer	  versuffix="$major.$age.$revision"
3329240a9a23Smbalmer	  # Darwin ld doesn't like 0 for these options...
3330240a9a23Smbalmer	  minor_current=`expr $current + 1`
3331240a9a23Smbalmer	  xlcverstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision"
3332240a9a23Smbalmer	  verstring="-compatibility_version $minor_current -current_version $minor_current.$revision"
3333240a9a23Smbalmer	  ;;
3334240a9a23Smbalmer
3335240a9a23Smbalmer	freebsd-aout)
3336240a9a23Smbalmer	  major=".$current"
3337240a9a23Smbalmer	  versuffix=".$current.$revision";
3338240a9a23Smbalmer	  ;;
3339240a9a23Smbalmer
3340240a9a23Smbalmer	freebsd-elf)
3341240a9a23Smbalmer	  major=".$current"
3342240a9a23Smbalmer	  versuffix=".$current";
3343240a9a23Smbalmer	  ;;
3344240a9a23Smbalmer
3345240a9a23Smbalmer	irix | nonstopux)
3346240a9a23Smbalmer	  if test "X$lt_irix_increment" = "Xno"; then
3347240a9a23Smbalmer	    major=`expr $current - $age`
3348240a9a23Smbalmer	  else
3349240a9a23Smbalmer	    major=`expr $current - $age + 1`
3350240a9a23Smbalmer	  fi
3351240a9a23Smbalmer	  case $version_type in
3352240a9a23Smbalmer	    nonstopux) verstring_prefix=nonstopux ;;
3353240a9a23Smbalmer	    *)         verstring_prefix=sgi ;;
3354240a9a23Smbalmer	  esac
3355240a9a23Smbalmer	  verstring="$verstring_prefix$major.$revision"
3356240a9a23Smbalmer
3357240a9a23Smbalmer	  # Add in all the interfaces that we are compatible with.
3358240a9a23Smbalmer	  loop=$revision
3359240a9a23Smbalmer	  while test "$loop" -ne 0; do
3360240a9a23Smbalmer	    iface=`expr $revision - $loop`
3361240a9a23Smbalmer	    loop=`expr $loop - 1`
3362240a9a23Smbalmer	    verstring="$verstring_prefix$major.$iface:$verstring"
3363240a9a23Smbalmer	  done
3364240a9a23Smbalmer
3365240a9a23Smbalmer	  # Before this point, $major must not contain `.'.
3366240a9a23Smbalmer	  major=.$major
3367240a9a23Smbalmer	  versuffix="$major.$revision"
3368240a9a23Smbalmer	  ;;
3369240a9a23Smbalmer
3370240a9a23Smbalmer	linux)
3371240a9a23Smbalmer	  major=.`expr $current - $age`
3372240a9a23Smbalmer	  versuffix="$major.$age.$revision"
3373240a9a23Smbalmer	  ;;
3374240a9a23Smbalmer
3375240a9a23Smbalmer	osf)
3376240a9a23Smbalmer	  major=.`expr $current - $age`
3377240a9a23Smbalmer	  versuffix=".$current.$age.$revision"
3378240a9a23Smbalmer	  verstring="$current.$age.$revision"
3379240a9a23Smbalmer
3380240a9a23Smbalmer	  # Add in all the interfaces that we are compatible with.
3381240a9a23Smbalmer	  loop=$age
3382240a9a23Smbalmer	  while test "$loop" -ne 0; do
3383240a9a23Smbalmer	    iface=`expr $current - $loop`
3384240a9a23Smbalmer	    loop=`expr $loop - 1`
3385240a9a23Smbalmer	    verstring="$verstring:${iface}.0"
3386240a9a23Smbalmer	  done
3387240a9a23Smbalmer
3388240a9a23Smbalmer	  # Make executables depend on our current version.
3389240a9a23Smbalmer	  verstring="$verstring:${current}.0"
3390240a9a23Smbalmer	  ;;
3391240a9a23Smbalmer
3392240a9a23Smbalmer	sunos)
3393240a9a23Smbalmer	  major=".$current"
3394240a9a23Smbalmer	  versuffix=".$current.$revision"
3395240a9a23Smbalmer	  ;;
3396240a9a23Smbalmer
3397240a9a23Smbalmer	windows)
3398240a9a23Smbalmer	  # Use '-' rather than '.', since we only want one
3399240a9a23Smbalmer	  # extension on DOS 8.3 filesystems.
3400240a9a23Smbalmer	  major=`expr $current - $age`
3401240a9a23Smbalmer	  versuffix="-$major"
3402240a9a23Smbalmer	  ;;
3403240a9a23Smbalmer
3404240a9a23Smbalmer	*)
3405240a9a23Smbalmer	  $echo "$modename: unknown library version type \`$version_type'" 1>&2
3406240a9a23Smbalmer	  $echo "Fatal configuration error.  See the $PACKAGE docs for more information." 1>&2
3407240a9a23Smbalmer	  exit $EXIT_FAILURE
3408240a9a23Smbalmer	  ;;
3409240a9a23Smbalmer	esac
3410240a9a23Smbalmer
3411240a9a23Smbalmer	# Clear the version info if we defaulted, and they specified a release.
3412240a9a23Smbalmer	if test -z "$vinfo" && test -n "$release"; then
3413240a9a23Smbalmer	  major=
3414240a9a23Smbalmer	  case $version_type in
3415240a9a23Smbalmer	  darwin)
3416240a9a23Smbalmer	    # we can't check for "0.0" in archive_cmds due to quoting
3417240a9a23Smbalmer	    # problems, so we reset it completely
3418240a9a23Smbalmer	    verstring=
3419240a9a23Smbalmer	    ;;
3420240a9a23Smbalmer	  *)
3421240a9a23Smbalmer	    verstring="0.0"
3422240a9a23Smbalmer	    ;;
3423240a9a23Smbalmer	  esac
3424240a9a23Smbalmer	  if test "$need_version" = no; then
3425240a9a23Smbalmer	    versuffix=
3426240a9a23Smbalmer	  else
3427240a9a23Smbalmer	    versuffix=".0.0"
3428240a9a23Smbalmer	  fi
3429240a9a23Smbalmer	fi
3430240a9a23Smbalmer
3431240a9a23Smbalmer	# Remove version info from name if versioning should be avoided
3432240a9a23Smbalmer	if test "$avoid_version" = yes && test "$need_version" = no; then
3433240a9a23Smbalmer	  major=
3434240a9a23Smbalmer	  versuffix=
3435240a9a23Smbalmer	  verstring=""
3436240a9a23Smbalmer	else
3437240a9a23Smbalmer	  # XXX
3438240a9a23Smbalmer	  tmp=`echo $libname|sed -e 's,+,_,g' -e 's,-,_,g' -e 's,\.,_,g'`
3439240a9a23Smbalmer	  eval tmp2=\$${tmp}_ltversion
3440240a9a23Smbalmer	  if ! test -z "${SHARED_LIBS_LOG}"; then
3441240a9a23Smbalmer		  if ! test -f ${SHARED_LIBS_LOG}; then
3442240a9a23Smbalmer			  echo "# SHARED_LIBS+=	<libname>      <obsd version> # <orig version>" >${SHARED_LIBS_LOG}
3443240a9a23Smbalmer		  fi
3444240a9a23Smbalmer		  tmp4=`echo $libname|sed -e 's/^lib//'`
3445240a9a23Smbalmer		  printf "SHARED_LIBS +=\t%-20s %-8s # %s\n" "$tmp4" "$tmp2" "$versuffix" >>${SHARED_LIBS_LOG}
3446240a9a23Smbalmer	  fi
3447240a9a23Smbalmer	  if test -n "$versuffix" && test -n "$tmp2"; then
3448240a9a23Smbalmer	    versuffix=".$tmp2"
3449240a9a23Smbalmer	  fi
3450240a9a23Smbalmer	fi
3451240a9a23Smbalmer
3452240a9a23Smbalmer	# Check to see if the archive will have undefined symbols.
3453240a9a23Smbalmer	if test "$allow_undefined" = yes; then
3454240a9a23Smbalmer	  if test "$allow_undefined_flag" = unsupported; then
3455240a9a23Smbalmer	    $echo "$modename: warning: undefined symbols not allowed in $host shared libraries" 1>&2
3456240a9a23Smbalmer	    build_libtool_libs=no
3457240a9a23Smbalmer	    build_old_libs=yes
3458240a9a23Smbalmer	  fi
3459240a9a23Smbalmer	else
3460240a9a23Smbalmer	  # Don't allow undefined symbols.
3461240a9a23Smbalmer	  allow_undefined_flag="$no_undefined_flag"
3462240a9a23Smbalmer	fi
3463240a9a23Smbalmer      fi
3464240a9a23Smbalmer
3465240a9a23Smbalmer      if test "$mode" != relink; then
3466240a9a23Smbalmer	# Remove our outputs, but don't remove object files since they
3467240a9a23Smbalmer	# may have been created when compiling PIC objects.
3468240a9a23Smbalmer	removelist=
3469240a9a23Smbalmer	tempremovelist=`$echo "$output_objdir/*"`
3470240a9a23Smbalmer	for p in $tempremovelist; do
3471240a9a23Smbalmer	  case $p in
3472240a9a23Smbalmer	    *.$objext)
3473240a9a23Smbalmer	       ;;
3474240a9a23Smbalmer	    $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*)
3475240a9a23Smbalmer	       if test "X$precious_files_regex" != "X"; then
3476240a9a23Smbalmer	         if echo $p | $EGREP -e "$precious_files_regex" >/dev/null 2>&1
3477240a9a23Smbalmer	         then
3478240a9a23Smbalmer		   continue
3479240a9a23Smbalmer		 fi
3480240a9a23Smbalmer	       fi
3481240a9a23Smbalmer	       removelist="$removelist $p"
3482240a9a23Smbalmer	       ;;
3483240a9a23Smbalmer	    *) ;;
3484240a9a23Smbalmer	  esac
3485240a9a23Smbalmer	done
3486240a9a23Smbalmer	if test -n "$removelist"; then
3487240a9a23Smbalmer	  $show "${rm}r $removelist"
3488240a9a23Smbalmer	  $run ${rm}r $removelist
3489240a9a23Smbalmer	fi
3490240a9a23Smbalmer      fi
3491240a9a23Smbalmer
3492240a9a23Smbalmer      # Now set the variables for building old libraries.
3493240a9a23Smbalmer      if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then
3494240a9a23Smbalmer	oldlibs="$oldlibs $output_objdir/$libname.$libext"
3495240a9a23Smbalmer
3496240a9a23Smbalmer	# Transform .lo files to .o files.
3497240a9a23Smbalmer	oldobjs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP`
3498240a9a23Smbalmer      fi
3499240a9a23Smbalmer
3500240a9a23Smbalmer      # Eliminate all temporary directories.
3501240a9a23Smbalmer      #for path in $notinst_path; do
3502240a9a23Smbalmer      #	lib_search_path=`$echo "$lib_search_path " | ${SED} -e "s% $path % %g"`
3503240a9a23Smbalmer      #	deplibs=`$echo "$deplibs " | ${SED} -e "s% -L$path % %g"`
3504240a9a23Smbalmer      #	dependency_libs=`$echo "$dependency_libs " | ${SED} -e "s% -L$path % %g"`
3505240a9a23Smbalmer      #done
3506240a9a23Smbalmer
3507240a9a23Smbalmer      if test -n "$xrpath"; then
3508240a9a23Smbalmer	# If the user specified any rpath flags, then add them.
3509240a9a23Smbalmer	temp_xrpath=
3510240a9a23Smbalmer	for libdir in $xrpath; do
3511240a9a23Smbalmer	  temp_xrpath="$temp_xrpath -R$libdir"
3512240a9a23Smbalmer	  case "$finalize_rpath " in
3513240a9a23Smbalmer	  *" $libdir "*) ;;
3514240a9a23Smbalmer	  *) finalize_rpath="$finalize_rpath $libdir" ;;
3515240a9a23Smbalmer	  esac
3516240a9a23Smbalmer	done
3517240a9a23Smbalmer	if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then
3518240a9a23Smbalmer	  dependency_libs="$temp_xrpath $dependency_libs"
3519240a9a23Smbalmer	fi
3520240a9a23Smbalmer      fi
3521240a9a23Smbalmer
3522240a9a23Smbalmer      # Make sure dlfiles contains only unique files that won't be dlpreopened
3523240a9a23Smbalmer      old_dlfiles="$dlfiles"
3524240a9a23Smbalmer      dlfiles=
3525240a9a23Smbalmer      for lib in $old_dlfiles; do
3526240a9a23Smbalmer	case " $dlprefiles $dlfiles " in
3527240a9a23Smbalmer	*" $lib "*) ;;
3528240a9a23Smbalmer	*) dlfiles="$dlfiles $lib" ;;
3529240a9a23Smbalmer	esac
3530240a9a23Smbalmer      done
3531240a9a23Smbalmer
3532240a9a23Smbalmer      # Make sure dlprefiles contains only unique files
3533240a9a23Smbalmer      old_dlprefiles="$dlprefiles"
3534240a9a23Smbalmer      dlprefiles=
3535240a9a23Smbalmer      for lib in $old_dlprefiles; do
3536240a9a23Smbalmer	case "$dlprefiles " in
3537240a9a23Smbalmer	*" $lib "*) ;;
3538240a9a23Smbalmer	*) dlprefiles="$dlprefiles $lib" ;;
3539240a9a23Smbalmer	esac
3540240a9a23Smbalmer      done
3541240a9a23Smbalmer
3542240a9a23Smbalmer      if test "$build_libtool_libs" = yes; then
3543240a9a23Smbalmer	if test -n "$rpath"; then
3544240a9a23Smbalmer	  case $host in
3545240a9a23Smbalmer	  *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos*)
3546240a9a23Smbalmer	    # these systems don't actually have a c library (as such)!
3547240a9a23Smbalmer	    ;;
3548240a9a23Smbalmer	  *-*-rhapsody* | *-*-darwin1.[012])
3549240a9a23Smbalmer	    # Rhapsody C library is in the System framework
3550240a9a23Smbalmer	    deplibs="$deplibs -framework System"
3551240a9a23Smbalmer	    ;;
3552240a9a23Smbalmer	  *-*-netbsd*)
3553240a9a23Smbalmer	    # Don't link with libc until the a.out ld.so is fixed.
3554240a9a23Smbalmer	    ;;
3555240a9a23Smbalmer	  *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
3556240a9a23Smbalmer	    # Do not include libc due to us having libc/libc_r.
3557240a9a23Smbalmer	    ;;
3558240a9a23Smbalmer	  *-*-sco3.2v5* | *-*-sco5v6*)
3559240a9a23Smbalmer	    # Causes problems with __ctype
3560240a9a23Smbalmer	    ;;
3561240a9a23Smbalmer	  *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
3562240a9a23Smbalmer	    # Compiler inserts libc in the correct place for threads to work
3563240a9a23Smbalmer	    ;;
3564240a9a23Smbalmer 	  *)
3565240a9a23Smbalmer	    # Add libc to deplibs on all other systems if necessary.
3566240a9a23Smbalmer	    if test "$build_libtool_need_lc" = "yes"; then
3567240a9a23Smbalmer	      deplibs="$deplibs -lc"
3568240a9a23Smbalmer	    fi
3569240a9a23Smbalmer	    ;;
3570240a9a23Smbalmer	  esac
3571240a9a23Smbalmer	fi
3572240a9a23Smbalmer
3573240a9a23Smbalmer	# Transform deplibs into only deplibs that can be linked in shared.
3574240a9a23Smbalmer	name_save=$name
3575240a9a23Smbalmer	libname_save=$libname
3576240a9a23Smbalmer	release_save=$release
3577240a9a23Smbalmer	versuffix_save=$versuffix
3578240a9a23Smbalmer	major_save=$major
3579240a9a23Smbalmer	# I'm not sure if I'm treating the release correctly.  I think
3580240a9a23Smbalmer	# release should show up in the -l (ie -lgmp5) so we don't want to
3581240a9a23Smbalmer	# add it in twice.  Is that correct?
3582240a9a23Smbalmer	release=""
3583240a9a23Smbalmer	versuffix=""
3584240a9a23Smbalmer	major=""
3585240a9a23Smbalmer	newdeplibs=
3586240a9a23Smbalmer	droppeddeps=no
3587240a9a23Smbalmer	case $deplibs_check_method in
3588240a9a23Smbalmer	pass_all)
3589240a9a23Smbalmer	  # Don't check for shared/static.  Everything works.
3590240a9a23Smbalmer	  # This might be a little naive.  We might want to check
3591240a9a23Smbalmer	  # whether the library exists or not.  But this is on
3592240a9a23Smbalmer	  # osf3 & osf4 and I'm not really sure... Just
3593240a9a23Smbalmer	  # implementing what was already the behavior.
3594240a9a23Smbalmer	  newdeplibs=$deplibs
3595240a9a23Smbalmer	  ;;
3596240a9a23Smbalmer	test_compile)
3597240a9a23Smbalmer	  # This code stresses the "libraries are programs" paradigm to its
3598240a9a23Smbalmer	  # limits. Maybe even breaks it.  We compile a program, linking it
3599240a9a23Smbalmer	  # against the deplibs as a proxy for the library.  Then we can check
3600240a9a23Smbalmer	  # whether they linked in statically or dynamically with ldd.
3601240a9a23Smbalmer	  $rm conftest.c
3602240a9a23Smbalmer	  cat > conftest.c <<EOF
3603240a9a23Smbalmer	  int main() { return 0; }
3604240a9a23SmbalmerEOF
3605240a9a23Smbalmer	  $rm conftest
3606240a9a23Smbalmer	  if $LTCC $LTCFLAGS -o conftest conftest.c $deplibs; then
3607240a9a23Smbalmer	    ldd_output=`ldd conftest`
3608240a9a23Smbalmer	    for i in $deplibs; do
3609240a9a23Smbalmer	      name=`expr $i : '-l\(.*\)'`
3610240a9a23Smbalmer	      # If $name is empty we are operating on a -L argument.
3611240a9a23Smbalmer              if test "$name" != "" && test "$name" != "0"; then
3612240a9a23Smbalmer		if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
3613240a9a23Smbalmer		  case " $predeps $postdeps " in
3614240a9a23Smbalmer		  *" $i "*)
3615240a9a23Smbalmer		    newdeplibs="$newdeplibs $i"
3616240a9a23Smbalmer		    i=""
3617240a9a23Smbalmer		    ;;
3618240a9a23Smbalmer		  esac
3619240a9a23Smbalmer	        fi
3620240a9a23Smbalmer		if test -n "$i" ; then
3621240a9a23Smbalmer		  libname=`eval \\$echo \"$libname_spec\"`
3622240a9a23Smbalmer		  deplib_matches=`eval \\$echo \"$library_names_spec\"`
3623240a9a23Smbalmer		  set dummy $deplib_matches
3624240a9a23Smbalmer		  deplib_match=$2
3625240a9a23Smbalmer		  if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
3626240a9a23Smbalmer		    newdeplibs="$newdeplibs $i"
3627240a9a23Smbalmer		  else
3628240a9a23Smbalmer		    droppeddeps=yes
3629240a9a23Smbalmer		    $echo
3630240a9a23Smbalmer		    $echo "*** Warning: dynamic linker does not accept needed library $i."
3631240a9a23Smbalmer		    $echo "*** I have the capability to make that library automatically link in when"
3632240a9a23Smbalmer		    $echo "*** you link to this library.  But I can only do this if you have a"
3633240a9a23Smbalmer		    $echo "*** shared version of the library, which I believe you do not have"
3634240a9a23Smbalmer		    $echo "*** because a test_compile did reveal that the linker did not use it for"
3635240a9a23Smbalmer		    $echo "*** its dynamic dependency list that programs get resolved with at runtime."
3636240a9a23Smbalmer		  fi
3637240a9a23Smbalmer		fi
3638240a9a23Smbalmer	      else
3639240a9a23Smbalmer		newdeplibs="$newdeplibs $i"
3640240a9a23Smbalmer	      fi
3641240a9a23Smbalmer	    done
3642240a9a23Smbalmer	  else
3643240a9a23Smbalmer	    # Error occurred in the first compile.  Let's try to salvage
3644240a9a23Smbalmer	    # the situation: Compile a separate program for each library.
3645240a9a23Smbalmer	    for i in $deplibs; do
3646240a9a23Smbalmer	      name=`expr $i : '-l\(.*\)'`
3647240a9a23Smbalmer	      # If $name is empty we are operating on a -L argument.
3648240a9a23Smbalmer              if test "$name" != "" && test "$name" != "0"; then
3649240a9a23Smbalmer		$rm conftest
3650240a9a23Smbalmer		if $LTCC $LTCFLAGS -o conftest conftest.c $i; then
3651240a9a23Smbalmer		  ldd_output=`ldd conftest`
3652240a9a23Smbalmer		  if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
3653240a9a23Smbalmer		    case " $predeps $postdeps " in
3654240a9a23Smbalmer		    *" $i "*)
3655240a9a23Smbalmer		      newdeplibs="$newdeplibs $i"
3656240a9a23Smbalmer		      i=""
3657240a9a23Smbalmer		      ;;
3658240a9a23Smbalmer		    esac
3659240a9a23Smbalmer		  fi
3660240a9a23Smbalmer		  if test -n "$i" ; then
3661240a9a23Smbalmer		    libname=`eval \\$echo \"$libname_spec\"`
3662240a9a23Smbalmer		    deplib_matches=`eval \\$echo \"$library_names_spec\"`
3663240a9a23Smbalmer		    set dummy $deplib_matches
3664240a9a23Smbalmer		    deplib_match=$2
3665240a9a23Smbalmer		    if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
3666240a9a23Smbalmer		      newdeplibs="$newdeplibs $i"
3667240a9a23Smbalmer		    else
3668240a9a23Smbalmer		      droppeddeps=yes
3669240a9a23Smbalmer		      $echo
3670240a9a23Smbalmer		      $echo "*** Warning: dynamic linker does not accept needed library $i."
3671240a9a23Smbalmer		      $echo "*** I have the capability to make that library automatically link in when"
3672240a9a23Smbalmer		      $echo "*** you link to this library.  But I can only do this if you have a"
3673240a9a23Smbalmer		      $echo "*** shared version of the library, which you do not appear to have"
3674240a9a23Smbalmer		      $echo "*** because a test_compile did reveal that the linker did not use this one"
3675240a9a23Smbalmer		      $echo "*** as a dynamic dependency that programs can get resolved with at runtime."
3676240a9a23Smbalmer		    fi
3677240a9a23Smbalmer		  fi
3678240a9a23Smbalmer		else
3679240a9a23Smbalmer		  droppeddeps=yes
3680240a9a23Smbalmer		  $echo
3681240a9a23Smbalmer		  $echo "*** Warning!  Library $i is needed by this library but I was not able to"
3682240a9a23Smbalmer		  $echo "*** make it link in!  You will probably need to install it or some"
3683240a9a23Smbalmer		  $echo "*** library that it depends on before this library will be fully"
3684240a9a23Smbalmer		  $echo "*** functional.  Installing it before continuing would be even better."
3685240a9a23Smbalmer		fi
3686240a9a23Smbalmer	      else
3687240a9a23Smbalmer		newdeplibs="$newdeplibs $i"
3688240a9a23Smbalmer	      fi
3689240a9a23Smbalmer	    done
3690240a9a23Smbalmer	  fi
3691240a9a23Smbalmer	  ;;
3692240a9a23Smbalmer	file_magic*)
3693240a9a23Smbalmer	  set dummy $deplibs_check_method
3694240a9a23Smbalmer	  file_magic_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
3695240a9a23Smbalmer	  for a_deplib in $deplibs; do
3696240a9a23Smbalmer	    name=`expr $a_deplib : '-l\(.*\)'`
3697240a9a23Smbalmer	    # If $name is empty we are operating on a -L argument.
3698240a9a23Smbalmer            if test "$name" != "" && test  "$name" != "0"; then
3699240a9a23Smbalmer	      if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
3700240a9a23Smbalmer		case " $predeps $postdeps " in
3701240a9a23Smbalmer		*" $a_deplib "*)
3702240a9a23Smbalmer		  newdeplibs="$newdeplibs $a_deplib"
3703240a9a23Smbalmer		  a_deplib=""
3704240a9a23Smbalmer		  ;;
3705240a9a23Smbalmer		esac
3706240a9a23Smbalmer	      fi
3707240a9a23Smbalmer	      if test -n "$a_deplib" ; then
3708240a9a23Smbalmer		libname=`eval \\$echo \"$libname_spec\"`
3709240a9a23Smbalmer		for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
3710240a9a23Smbalmer		  potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
3711240a9a23Smbalmer		  for potent_lib in $potential_libs; do
3712240a9a23Smbalmer		      # Follow soft links.
3713240a9a23Smbalmer		      if ls -lLd "$potent_lib" 2>/dev/null \
3714240a9a23Smbalmer			 | grep " -> " >/dev/null; then
3715240a9a23Smbalmer			continue
3716240a9a23Smbalmer		      fi
3717240a9a23Smbalmer		      # The statement above tries to avoid entering an
3718240a9a23Smbalmer		      # endless loop below, in case of cyclic links.
3719240a9a23Smbalmer		      # We might still enter an endless loop, since a link
3720240a9a23Smbalmer		      # loop can be closed while we follow links,
3721240a9a23Smbalmer		      # but so what?
3722240a9a23Smbalmer		      potlib="$potent_lib"
3723240a9a23Smbalmer		      while test -h "$potlib" 2>/dev/null; do
3724240a9a23Smbalmer			potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'`
3725240a9a23Smbalmer			case $potliblink in
3726240a9a23Smbalmer			[\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";;
3727240a9a23Smbalmer			*) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";;
3728240a9a23Smbalmer			esac
3729240a9a23Smbalmer		      done
3730240a9a23Smbalmer		      if eval $file_magic_cmd \"\$potlib\" 2>/dev/null \
3731240a9a23Smbalmer			 | ${SED} 10q \
3732240a9a23Smbalmer			 | $EGREP "$file_magic_regex" > /dev/null; then
3733240a9a23Smbalmer			newdeplibs="$newdeplibs $a_deplib"
3734240a9a23Smbalmer			a_deplib=""
3735240a9a23Smbalmer			break 2
3736240a9a23Smbalmer		      fi
3737240a9a23Smbalmer		  done
3738240a9a23Smbalmer		done
3739240a9a23Smbalmer	      fi
3740240a9a23Smbalmer	      if test -n "$a_deplib" ; then
3741240a9a23Smbalmer		droppeddeps=yes
3742240a9a23Smbalmer		$echo
3743240a9a23Smbalmer		$echo "*** Warning: linker path does not have real file for library $a_deplib."
3744240a9a23Smbalmer		$echo "*** I have the capability to make that library automatically link in when"
3745240a9a23Smbalmer		$echo "*** you link to this library.  But I can only do this if you have a"
3746240a9a23Smbalmer		$echo "*** shared version of the library, which you do not appear to have"
3747240a9a23Smbalmer		$echo "*** because I did check the linker path looking for a file starting"
3748240a9a23Smbalmer		if test -z "$potlib" ; then
3749240a9a23Smbalmer		  $echo "*** with $libname but no candidates were found. (...for file magic test)"
3750240a9a23Smbalmer		else
3751240a9a23Smbalmer		  $echo "*** with $libname and none of the candidates passed a file format test"
3752240a9a23Smbalmer		  $echo "*** using a file magic. Last file checked: $potlib"
3753240a9a23Smbalmer		fi
3754240a9a23Smbalmer	      fi
3755240a9a23Smbalmer	    else
3756240a9a23Smbalmer	      # Add a -L argument.
3757240a9a23Smbalmer	      newdeplibs="$newdeplibs $a_deplib"
3758240a9a23Smbalmer	    fi
3759240a9a23Smbalmer	  done # Gone through all deplibs.
3760240a9a23Smbalmer	  ;;
3761240a9a23Smbalmer	match_pattern*)
3762240a9a23Smbalmer	  set dummy $deplibs_check_method
3763240a9a23Smbalmer	  match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
3764240a9a23Smbalmer	  for a_deplib in $deplibs; do
3765240a9a23Smbalmer	    name=`expr $a_deplib : '-l\(.*\)'`
3766240a9a23Smbalmer	    # If $name is empty we are operating on a -L argument.
3767240a9a23Smbalmer	    if test -n "$name" && test "$name" != "0"; then
3768240a9a23Smbalmer	      if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
3769240a9a23Smbalmer		case " $predeps $postdeps " in
3770240a9a23Smbalmer		*" $a_deplib "*)
3771240a9a23Smbalmer		  newdeplibs="$newdeplibs $a_deplib"
3772240a9a23Smbalmer		  a_deplib=""
3773240a9a23Smbalmer		  ;;
3774240a9a23Smbalmer		esac
3775240a9a23Smbalmer	      fi
3776240a9a23Smbalmer	      if test -n "$a_deplib" ; then
3777240a9a23Smbalmer		libname=`eval \\$echo \"$libname_spec\"`
3778240a9a23Smbalmer		for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
3779240a9a23Smbalmer		  potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
3780240a9a23Smbalmer		  for potent_lib in $potential_libs; do
3781240a9a23Smbalmer		    potlib="$potent_lib" # see symlink-check above in file_magic test
3782240a9a23Smbalmer		    if eval $echo \"$potent_lib\" 2>/dev/null \
3783240a9a23Smbalmer		        | ${SED} 10q \
3784240a9a23Smbalmer		        | $EGREP "$match_pattern_regex" > /dev/null; then
3785240a9a23Smbalmer		      newdeplibs="$newdeplibs $a_deplib"
3786240a9a23Smbalmer		      a_deplib=""
3787240a9a23Smbalmer		      break 2
3788240a9a23Smbalmer		    fi
3789240a9a23Smbalmer		  done
3790240a9a23Smbalmer		done
3791240a9a23Smbalmer	      fi
3792240a9a23Smbalmer	      if test -n "$a_deplib" ; then
3793240a9a23Smbalmer		droppeddeps=yes
3794240a9a23Smbalmer		$echo
3795240a9a23Smbalmer		$echo "*** Warning: linker path does not have real file for library $a_deplib."
3796240a9a23Smbalmer		$echo "*** I have the capability to make that library automatically link in when"
3797240a9a23Smbalmer		$echo "*** you link to this library.  But I can only do this if you have a"
3798240a9a23Smbalmer		$echo "*** shared version of the library, which you do not appear to have"
3799240a9a23Smbalmer		$echo "*** because I did check the linker path looking for a file starting"
3800240a9a23Smbalmer		if test -z "$potlib" ; then
3801240a9a23Smbalmer		  $echo "*** with $libname but no candidates were found. (...for regex pattern test)"
3802240a9a23Smbalmer		else
3803240a9a23Smbalmer		  $echo "*** with $libname and none of the candidates passed a file format test"
3804240a9a23Smbalmer		  $echo "*** using a regex pattern. Last file checked: $potlib"
3805240a9a23Smbalmer		fi
3806240a9a23Smbalmer	      fi
3807240a9a23Smbalmer	    else
3808240a9a23Smbalmer	      # Add a -L argument.
3809240a9a23Smbalmer	      newdeplibs="$newdeplibs $a_deplib"
3810240a9a23Smbalmer	    fi
3811240a9a23Smbalmer	  done # Gone through all deplibs.
3812240a9a23Smbalmer	  ;;
3813240a9a23Smbalmer	none | unknown | *)
3814240a9a23Smbalmer	  newdeplibs=""
3815240a9a23Smbalmer	  tmp_deplibs=`$echo "X $deplibs" | $Xsed -e 's/ -lc$//' \
3816240a9a23Smbalmer	    -e 's/ -[LR][^ ]*//g'`
3817240a9a23Smbalmer	  if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
3818240a9a23Smbalmer	    for i in $predeps $postdeps ; do
3819240a9a23Smbalmer	      # can't use Xsed below, because $i might contain '/'
3820240a9a23Smbalmer	      tmp_deplibs=`$echo "X $tmp_deplibs" | ${SED} -e "1s,^X,," -e "s,$i,,"`
3821240a9a23Smbalmer	    done
3822240a9a23Smbalmer	  fi
3823240a9a23Smbalmer	  if $echo "X $tmp_deplibs" | $Xsed -e 's/[ 	]//g' \
3824240a9a23Smbalmer	    | grep . >/dev/null; then
3825240a9a23Smbalmer	    $echo
3826240a9a23Smbalmer	    if test "X$deplibs_check_method" = "Xnone"; then
3827240a9a23Smbalmer	      $echo "*** Warning: inter-library dependencies are not supported in this platform."
3828240a9a23Smbalmer	    else
3829240a9a23Smbalmer	      $echo "*** Warning: inter-library dependencies are not known to be supported."
3830240a9a23Smbalmer	    fi
3831240a9a23Smbalmer	    $echo "*** All declared inter-library dependencies are being dropped."
3832240a9a23Smbalmer	    droppeddeps=yes
3833240a9a23Smbalmer	  fi
3834240a9a23Smbalmer	  ;;
3835240a9a23Smbalmer	esac
3836240a9a23Smbalmer	versuffix=$versuffix_save
3837240a9a23Smbalmer	major=$major_save
3838240a9a23Smbalmer	release=$release_save
3839240a9a23Smbalmer	libname=$libname_save
3840240a9a23Smbalmer	name=$name_save
3841240a9a23Smbalmer
3842240a9a23Smbalmer	case $host in
3843240a9a23Smbalmer	*-*-rhapsody* | *-*-darwin1.[012])
3844240a9a23Smbalmer	  # On Rhapsody replace the C library is the System framework
3845240a9a23Smbalmer	  newdeplibs=`$echo "X $newdeplibs" | $Xsed -e 's/ -lc / -framework System /'`
3846240a9a23Smbalmer	  ;;
3847240a9a23Smbalmer	esac
3848240a9a23Smbalmer
3849240a9a23Smbalmer	if test "$droppeddeps" = yes; then
3850240a9a23Smbalmer	  if test "$module" = yes; then
3851240a9a23Smbalmer	    $echo
3852240a9a23Smbalmer	    $echo "*** Warning: libtool could not satisfy all declared inter-library"
3853240a9a23Smbalmer	    $echo "*** dependencies of module $libname.  Therefore, libtool will create"
3854240a9a23Smbalmer	    $echo "*** a static module, that should work as long as the dlopening"
3855240a9a23Smbalmer	    $echo "*** application is linked with the -dlopen flag."
3856240a9a23Smbalmer	    if test -z "$global_symbol_pipe"; then
3857240a9a23Smbalmer	      $echo
3858240a9a23Smbalmer	      $echo "*** However, this would only work if libtool was able to extract symbol"
3859240a9a23Smbalmer	      $echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
3860240a9a23Smbalmer	      $echo "*** not find such a program.  So, this module is probably useless."
3861240a9a23Smbalmer	      $echo "*** \`nm' from GNU binutils and a full rebuild may help."
3862240a9a23Smbalmer	    fi
3863240a9a23Smbalmer	    if test "$build_old_libs" = no; then
3864240a9a23Smbalmer	      oldlibs="$output_objdir/$libname.$libext"
3865240a9a23Smbalmer	      build_libtool_libs=module
3866240a9a23Smbalmer	      build_old_libs=yes
3867240a9a23Smbalmer	    else
3868240a9a23Smbalmer	      build_libtool_libs=no
3869240a9a23Smbalmer	    fi
3870240a9a23Smbalmer	  else
3871240a9a23Smbalmer	    $echo "*** The inter-library dependencies that have been dropped here will be"
3872240a9a23Smbalmer	    $echo "*** automatically added whenever a program is linked with this library"
3873240a9a23Smbalmer	    $echo "*** or is declared to -dlopen it."
3874240a9a23Smbalmer
3875240a9a23Smbalmer	    if test "$allow_undefined" = no; then
3876240a9a23Smbalmer	      $echo
3877240a9a23Smbalmer	      $echo "*** Since this library must not contain undefined symbols,"
3878240a9a23Smbalmer	      $echo "*** because either the platform does not support them or"
3879240a9a23Smbalmer	      $echo "*** it was explicitly requested with -no-undefined,"
3880240a9a23Smbalmer	      $echo "*** libtool will only create a static version of it."
3881240a9a23Smbalmer	      if test "$build_old_libs" = no; then
3882240a9a23Smbalmer		oldlibs="$output_objdir/$libname.$libext"
3883240a9a23Smbalmer		build_libtool_libs=module
3884240a9a23Smbalmer		build_old_libs=yes
3885240a9a23Smbalmer	      else
3886240a9a23Smbalmer		build_libtool_libs=no
3887240a9a23Smbalmer	      fi
3888240a9a23Smbalmer	    fi
3889240a9a23Smbalmer	  fi
3890240a9a23Smbalmer	fi
3891240a9a23Smbalmer	# Done checking deplibs!
3892240a9a23Smbalmer	deplibs=$newdeplibs
3893240a9a23Smbalmer      fi
3894240a9a23Smbalmer
3895240a9a23Smbalmer
3896240a9a23Smbalmer      # move library search paths that coincide with paths to not yet
3897240a9a23Smbalmer      # installed libraries to the beginning of the library search list
3898240a9a23Smbalmer      new_libs=
3899240a9a23Smbalmer      for path in $notinst_path; do
3900240a9a23Smbalmer	case " $new_libs " in
3901240a9a23Smbalmer	*" -L$path/$objdir "*) ;;
3902240a9a23Smbalmer	*)
3903240a9a23Smbalmer	  case " $deplibs " in
3904240a9a23Smbalmer	  *" -L$path/$objdir "*)
3905240a9a23Smbalmer	    new_libs="$new_libs -L$path/$objdir" ;;
3906240a9a23Smbalmer	  esac
3907240a9a23Smbalmer	  ;;
3908240a9a23Smbalmer	esac
3909240a9a23Smbalmer      done
3910240a9a23Smbalmer      for deplib in $deplibs; do
3911240a9a23Smbalmer	case $deplib in
3912240a9a23Smbalmer	-L*)
3913240a9a23Smbalmer	  case " $new_libs " in
3914240a9a23Smbalmer	  *" $deplib "*) ;;
3915240a9a23Smbalmer	  *) new_libs="$new_libs $deplib" ;;
3916240a9a23Smbalmer	  esac
3917240a9a23Smbalmer	  ;;
3918240a9a23Smbalmer	*) new_libs="$new_libs $deplib" ;;
3919240a9a23Smbalmer	esac
3920240a9a23Smbalmer      done
3921240a9a23Smbalmer      deplibs="$new_libs"
3922240a9a23Smbalmer
3923240a9a23Smbalmer
3924240a9a23Smbalmer      # All the library-specific variables (install_libdir is set above).
3925240a9a23Smbalmer      library_names=
3926240a9a23Smbalmer      old_library=
3927240a9a23Smbalmer      dlname=
3928240a9a23Smbalmer
3929240a9a23Smbalmer      # Test again, we may have decided not to build it any more
3930240a9a23Smbalmer      if test "$build_libtool_libs" = yes; then
3931240a9a23Smbalmer	if test "$hardcode_into_libs" = yes; then
3932240a9a23Smbalmer	  # Hardcode the library paths
3933240a9a23Smbalmer	  hardcode_libdirs=
3934240a9a23Smbalmer	  dep_rpath=
3935240a9a23Smbalmer	  rpath="$finalize_rpath"
3936240a9a23Smbalmer	  test "$mode" != relink && rpath="$compile_rpath$rpath"
3937240a9a23Smbalmer	  for libdir in $rpath; do
3938240a9a23Smbalmer	    if test -n "$hardcode_libdir_flag_spec"; then
3939240a9a23Smbalmer	      if test -n "$hardcode_libdir_separator"; then
3940240a9a23Smbalmer		if test -z "$hardcode_libdirs"; then
3941240a9a23Smbalmer		  hardcode_libdirs="$libdir"
3942240a9a23Smbalmer		else
3943240a9a23Smbalmer		  # Just accumulate the unique libdirs.
3944240a9a23Smbalmer		  case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
3945240a9a23Smbalmer		  *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
3946240a9a23Smbalmer		    ;;
3947240a9a23Smbalmer		  *)
3948240a9a23Smbalmer		    hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
3949240a9a23Smbalmer		    ;;
3950240a9a23Smbalmer		  esac
3951240a9a23Smbalmer		fi
3952240a9a23Smbalmer	      else
3953240a9a23Smbalmer		eval flag=\"$hardcode_libdir_flag_spec\"
3954240a9a23Smbalmer		dep_rpath="$dep_rpath $flag"
3955240a9a23Smbalmer	      fi
3956240a9a23Smbalmer	    elif test -n "$runpath_var"; then
3957240a9a23Smbalmer	      case "$perm_rpath " in
3958240a9a23Smbalmer	      *" $libdir "*) ;;
3959240a9a23Smbalmer	      *) perm_rpath="$perm_rpath $libdir" ;;
3960240a9a23Smbalmer	      esac
3961240a9a23Smbalmer	    fi
3962240a9a23Smbalmer	  done
3963240a9a23Smbalmer	  # Substitute the hardcoded libdirs into the rpath.
3964240a9a23Smbalmer	  if test -n "$hardcode_libdir_separator" &&
3965240a9a23Smbalmer	     test -n "$hardcode_libdirs"; then
3966240a9a23Smbalmer	    libdir="$hardcode_libdirs"
3967240a9a23Smbalmer	    if test -n "$hardcode_libdir_flag_spec_ld"; then
3968240a9a23Smbalmer	      case $archive_cmds in
3969240a9a23Smbalmer	      *\$LD*) eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\" ;;
3970240a9a23Smbalmer	      *)      eval dep_rpath=\"$hardcode_libdir_flag_spec\" ;;
3971240a9a23Smbalmer	      esac
3972240a9a23Smbalmer	    else
3973240a9a23Smbalmer	      eval dep_rpath=\"$hardcode_libdir_flag_spec\"
3974240a9a23Smbalmer	    fi
3975240a9a23Smbalmer	  fi
3976240a9a23Smbalmer	  if test -n "$runpath_var" && test -n "$perm_rpath"; then
3977240a9a23Smbalmer	    # We should set the runpath_var.
3978240a9a23Smbalmer	    rpath=
3979240a9a23Smbalmer	    for dir in $perm_rpath; do
3980240a9a23Smbalmer	      rpath="$rpath$dir:"
3981240a9a23Smbalmer	    done
3982240a9a23Smbalmer	    eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var"
3983240a9a23Smbalmer	  fi
3984240a9a23Smbalmer	  test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs"
3985240a9a23Smbalmer	fi
3986240a9a23Smbalmer
3987240a9a23Smbalmer	shlibpath="$finalize_shlibpath"
3988240a9a23Smbalmer	test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath"
3989240a9a23Smbalmer	if test -n "$shlibpath"; then
3990240a9a23Smbalmer	  eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var"
3991240a9a23Smbalmer	fi
3992240a9a23Smbalmer
3993240a9a23Smbalmer	# Get the real and link names of the library.
3994240a9a23Smbalmer	eval shared_ext=\"$shrext_cmds\"
3995240a9a23Smbalmer	eval library_names=\"$library_names_spec\"
3996240a9a23Smbalmer	set dummy $library_names
3997240a9a23Smbalmer	realname="$2"
3998240a9a23Smbalmer	shift; shift
3999240a9a23Smbalmer
4000240a9a23Smbalmer	if test -n "$soname_spec"; then
4001240a9a23Smbalmer	  eval soname=\"$soname_spec\"
4002240a9a23Smbalmer	else
4003240a9a23Smbalmer	  soname="$realname"
4004240a9a23Smbalmer	fi
4005240a9a23Smbalmer	if test -z "$dlname"; then
4006240a9a23Smbalmer	  dlname=$soname
4007240a9a23Smbalmer	fi
4008240a9a23Smbalmer
4009240a9a23Smbalmer	lib="$output_objdir/$realname"
4010240a9a23Smbalmer	linknames=
4011240a9a23Smbalmer	for link
4012240a9a23Smbalmer	do
4013240a9a23Smbalmer	  linknames="$linknames $link"
4014240a9a23Smbalmer	done
4015240a9a23Smbalmer
4016240a9a23Smbalmer	# Use standard objects if they are pic
4017240a9a23Smbalmer	test -z "$pic_flag" && libobjs=`$echo "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
4018240a9a23Smbalmer
4019240a9a23Smbalmer	# Prepare the list of exported symbols
4020240a9a23Smbalmer	if test -z "$export_symbols"; then
4021240a9a23Smbalmer	  if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then
4022240a9a23Smbalmer	    $show "generating symbol list for \`$libname.la'"
4023240a9a23Smbalmer	    export_symbols="$output_objdir/$libname.exp"
4024240a9a23Smbalmer	    $run $rm $export_symbols
4025240a9a23Smbalmer	    cmds=$export_symbols_cmds
4026240a9a23Smbalmer	    save_ifs="$IFS"; IFS='~'
4027240a9a23Smbalmer	    for cmd in $cmds; do
4028240a9a23Smbalmer	      IFS="$save_ifs"
4029240a9a23Smbalmer	      eval cmd=\"$cmd\"
4030240a9a23Smbalmer	      if len=`expr "X$cmd" : ".*"` &&
4031240a9a23Smbalmer	       test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
4032240a9a23Smbalmer	        $show "$cmd"
4033240a9a23Smbalmer	        $run eval "$cmd" || exit $?
4034240a9a23Smbalmer	        skipped_export=false
4035240a9a23Smbalmer	      else
4036240a9a23Smbalmer	        # The command line is too long to execute in one step.
4037240a9a23Smbalmer	        $show "using reloadable object file for export list..."
4038240a9a23Smbalmer	        skipped_export=:
4039240a9a23Smbalmer		# Break out early, otherwise skipped_export may be
4040240a9a23Smbalmer		# set to false by a later but shorter cmd.
4041240a9a23Smbalmer		break
4042240a9a23Smbalmer	      fi
4043240a9a23Smbalmer	    done
4044240a9a23Smbalmer	    IFS="$save_ifs"
4045240a9a23Smbalmer	    if test -n "$export_symbols_regex"; then
4046240a9a23Smbalmer	      $show "$EGREP -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\""
4047240a9a23Smbalmer	      $run eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
4048240a9a23Smbalmer	      $show "$mv \"${export_symbols}T\" \"$export_symbols\""
4049240a9a23Smbalmer	      $run eval '$mv "${export_symbols}T" "$export_symbols"'
4050240a9a23Smbalmer	    fi
4051240a9a23Smbalmer	  fi
4052240a9a23Smbalmer	fi
4053240a9a23Smbalmer
4054240a9a23Smbalmer	if test -n "$export_symbols" && test -n "$include_expsyms"; then
4055240a9a23Smbalmer	  $run eval '$echo "X$include_expsyms" | $SP2NL >> "$export_symbols"'
4056240a9a23Smbalmer	fi
4057240a9a23Smbalmer
4058240a9a23Smbalmer	tmp_deplibs=
4059240a9a23Smbalmer	for test_deplib in $deplibs; do
4060240a9a23Smbalmer		case " $convenience " in
4061240a9a23Smbalmer		*" $test_deplib "*) ;;
4062240a9a23Smbalmer		*)
4063240a9a23Smbalmer			tmp_deplibs="$tmp_deplibs $test_deplib"
4064240a9a23Smbalmer			;;
4065240a9a23Smbalmer		esac
4066240a9a23Smbalmer	done
4067240a9a23Smbalmer	deplibs="$tmp_deplibs"
4068240a9a23Smbalmer
4069240a9a23Smbalmer	if test -n "$convenience"; then
4070240a9a23Smbalmer	  if test -n "$whole_archive_flag_spec"; then
4071240a9a23Smbalmer	    save_libobjs=$libobjs
4072240a9a23Smbalmer	    eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
4073240a9a23Smbalmer	  else
4074240a9a23Smbalmer	    gentop="$output_objdir/${outputname}x"
4075240a9a23Smbalmer	    generated="$generated $gentop"
4076240a9a23Smbalmer
4077240a9a23Smbalmer	    func_extract_archives $gentop $convenience
4078240a9a23Smbalmer	    libobjs="$libobjs $func_extract_archives_result"
4079240a9a23Smbalmer	  fi
4080240a9a23Smbalmer	fi
4081240a9a23Smbalmer	
4082240a9a23Smbalmer	if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then
4083240a9a23Smbalmer	  eval flag=\"$thread_safe_flag_spec\"
4084240a9a23Smbalmer	  linker_flags="$linker_flags $flag"
4085240a9a23Smbalmer	fi
4086240a9a23Smbalmer
4087240a9a23Smbalmer	# Make a backup of the uninstalled library when relinking
4088240a9a23Smbalmer	if test "$mode" = relink; then
4089240a9a23Smbalmer	  $run eval '(cd $output_objdir && $rm ${realname}U && $mv $realname ${realname}U)' || exit $?
4090240a9a23Smbalmer	fi
4091240a9a23Smbalmer
4092240a9a23Smbalmer	# Do each of the archive commands.
4093240a9a23Smbalmer	if test "$module" = yes && test -n "$module_cmds" ; then
4094240a9a23Smbalmer	  if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
4095240a9a23Smbalmer	    eval test_cmds=\"$module_expsym_cmds\"
4096240a9a23Smbalmer	    cmds=$module_expsym_cmds
4097240a9a23Smbalmer	  else
4098240a9a23Smbalmer	    eval test_cmds=\"$module_cmds\"
4099240a9a23Smbalmer	    cmds=$module_cmds
4100240a9a23Smbalmer	  fi
4101240a9a23Smbalmer	else
4102240a9a23Smbalmer	if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
4103240a9a23Smbalmer	  eval test_cmds=\"$archive_expsym_cmds\"
4104240a9a23Smbalmer	  cmds=$archive_expsym_cmds
4105240a9a23Smbalmer	else
4106240a9a23Smbalmer	  eval test_cmds=\"$archive_cmds\"
4107240a9a23Smbalmer	  cmds=$archive_cmds
4108240a9a23Smbalmer	  fi
4109240a9a23Smbalmer	fi
4110240a9a23Smbalmer
4111240a9a23Smbalmer	if test "X$skipped_export" != "X:" &&
4112240a9a23Smbalmer	   len=`expr "X$test_cmds" : ".*" 2>/dev/null` &&
4113240a9a23Smbalmer	   test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
4114240a9a23Smbalmer	  :
4115240a9a23Smbalmer	else
4116240a9a23Smbalmer	  # The command line is too long to link in one step, link piecewise.
4117240a9a23Smbalmer	  $echo "creating reloadable object files..."
4118240a9a23Smbalmer
4119240a9a23Smbalmer	  # Save the value of $output and $libobjs because we want to
4120240a9a23Smbalmer	  # use them later.  If we have whole_archive_flag_spec, we
4121240a9a23Smbalmer	  # want to use save_libobjs as it was before
4122240a9a23Smbalmer	  # whole_archive_flag_spec was expanded, because we can't
4123240a9a23Smbalmer	  # assume the linker understands whole_archive_flag_spec.
4124240a9a23Smbalmer	  # This may have to be revisited, in case too many
4125240a9a23Smbalmer	  # convenience libraries get linked in and end up exceeding
4126240a9a23Smbalmer	  # the spec.
4127240a9a23Smbalmer	  if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then
4128240a9a23Smbalmer	    save_libobjs=$libobjs
4129240a9a23Smbalmer	  fi
4130240a9a23Smbalmer	  save_output=$output
4131240a9a23Smbalmer	  output_la=`$echo "X$output" | $Xsed -e "$basename"`
4132240a9a23Smbalmer
4133240a9a23Smbalmer	  # Clear the reloadable object creation command queue and
4134240a9a23Smbalmer	  # initialize k to one.
4135240a9a23Smbalmer	  test_cmds=
4136240a9a23Smbalmer	  concat_cmds=
4137240a9a23Smbalmer	  objlist=
4138240a9a23Smbalmer	  delfiles=
4139240a9a23Smbalmer	  last_robj=
4140240a9a23Smbalmer	  k=1
4141240a9a23Smbalmer	  output=$output_objdir/$output_la-${k}.$objext
4142240a9a23Smbalmer	  # Loop over the list of objects to be linked.
4143240a9a23Smbalmer	  for obj in $save_libobjs
4144240a9a23Smbalmer	  do
4145240a9a23Smbalmer	    eval test_cmds=\"$reload_cmds $objlist $last_robj\"
4146240a9a23Smbalmer	    if test "X$objlist" = X ||
4147240a9a23Smbalmer	       { len=`expr "X$test_cmds" : ".*" 2>/dev/null` &&
4148240a9a23Smbalmer		 test "$len" -le "$max_cmd_len"; }; then
4149240a9a23Smbalmer	      objlist="$objlist $obj"
4150240a9a23Smbalmer	    else
4151240a9a23Smbalmer	      # The command $test_cmds is almost too long, add a
4152240a9a23Smbalmer	      # command to the queue.
4153240a9a23Smbalmer	      if test "$k" -eq 1 ; then
4154240a9a23Smbalmer		# The first file doesn't have a previous command to add.
4155240a9a23Smbalmer		eval concat_cmds=\"$reload_cmds $objlist $last_robj\"
4156240a9a23Smbalmer	      else
4157240a9a23Smbalmer		# All subsequent reloadable object files will link in
4158240a9a23Smbalmer		# the last one created.
4159240a9a23Smbalmer		eval concat_cmds=\"\$concat_cmds~$reload_cmds $objlist $last_robj\"
4160240a9a23Smbalmer	      fi
4161240a9a23Smbalmer	      last_robj=$output_objdir/$output_la-${k}.$objext
4162240a9a23Smbalmer	      k=`expr $k + 1`
4163240a9a23Smbalmer	      output=$output_objdir/$output_la-${k}.$objext
4164240a9a23Smbalmer	      objlist=$obj
4165240a9a23Smbalmer	      len=1
4166240a9a23Smbalmer	    fi
4167240a9a23Smbalmer	  done
4168240a9a23Smbalmer	  # Handle the remaining objects by creating one last
4169240a9a23Smbalmer	  # reloadable object file.  All subsequent reloadable object
4170240a9a23Smbalmer	  # files will link in the last one created.
4171240a9a23Smbalmer	  test -z "$concat_cmds" || concat_cmds=$concat_cmds~
4172240a9a23Smbalmer	  eval concat_cmds=\"\${concat_cmds}$reload_cmds $objlist $last_robj\"
4173240a9a23Smbalmer
4174240a9a23Smbalmer	  if ${skipped_export-false}; then
4175240a9a23Smbalmer	    $show "generating symbol list for \`$libname.la'"
4176240a9a23Smbalmer	    export_symbols="$output_objdir/$libname.exp"
4177240a9a23Smbalmer	    $run $rm $export_symbols
4178240a9a23Smbalmer	    libobjs=$output
4179240a9a23Smbalmer	    # Append the command to create the export file.
4180240a9a23Smbalmer	    eval concat_cmds=\"\$concat_cmds~$export_symbols_cmds\"
4181240a9a23Smbalmer          fi
4182240a9a23Smbalmer
4183240a9a23Smbalmer	  # Set up a command to remove the reloadable object files
4184240a9a23Smbalmer	  # after they are used.
4185240a9a23Smbalmer	  i=0
4186240a9a23Smbalmer	  while test "$i" -lt "$k"
4187240a9a23Smbalmer	  do
4188240a9a23Smbalmer	    i=`expr $i + 1`
4189240a9a23Smbalmer	    delfiles="$delfiles $output_objdir/$output_la-${i}.$objext"
4190240a9a23Smbalmer	  done
4191240a9a23Smbalmer
4192240a9a23Smbalmer	  $echo "creating a temporary reloadable object file: $output"
4193240a9a23Smbalmer
4194240a9a23Smbalmer	  # Loop through the commands generated above and execute them.
4195240a9a23Smbalmer	  save_ifs="$IFS"; IFS='~'
4196240a9a23Smbalmer	  for cmd in $concat_cmds; do
4197240a9a23Smbalmer	    IFS="$save_ifs"
4198240a9a23Smbalmer	    $show "$cmd"
4199240a9a23Smbalmer	    $run eval "$cmd" || exit $?
4200240a9a23Smbalmer	  done
4201240a9a23Smbalmer	  IFS="$save_ifs"
4202240a9a23Smbalmer
4203240a9a23Smbalmer	  libobjs=$output
4204240a9a23Smbalmer	  # Restore the value of output.
4205240a9a23Smbalmer	  output=$save_output
4206240a9a23Smbalmer
4207240a9a23Smbalmer	  if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then
4208240a9a23Smbalmer	    eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
4209240a9a23Smbalmer	  fi
4210240a9a23Smbalmer	  # Expand the library linking commands again to reset the
4211240a9a23Smbalmer	  # value of $libobjs for piecewise linking.
4212240a9a23Smbalmer
4213240a9a23Smbalmer	  # Do each of the archive commands.
4214240a9a23Smbalmer	  if test "$module" = yes && test -n "$module_cmds" ; then
4215240a9a23Smbalmer	    if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
4216240a9a23Smbalmer	      cmds=$module_expsym_cmds
4217240a9a23Smbalmer	    else
4218240a9a23Smbalmer	      cmds=$module_cmds
4219240a9a23Smbalmer	    fi
4220240a9a23Smbalmer	  else
4221240a9a23Smbalmer	  if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
4222240a9a23Smbalmer	    cmds=$archive_expsym_cmds
4223240a9a23Smbalmer	  else
4224240a9a23Smbalmer	    cmds=$archive_cmds
4225240a9a23Smbalmer	    fi
4226240a9a23Smbalmer	  fi
4227240a9a23Smbalmer
4228240a9a23Smbalmer	  # Append the command to remove the reloadable object files
4229240a9a23Smbalmer	  # to the just-reset $cmds.
4230240a9a23Smbalmer	  eval cmds=\"\$cmds~\$rm $delfiles\"
4231240a9a23Smbalmer	fi
4232240a9a23Smbalmer	save_ifs="$IFS"; IFS='~'
4233240a9a23Smbalmer	for cmd in $cmds; do
4234240a9a23Smbalmer	  IFS="$save_ifs"
4235240a9a23Smbalmer	  eval cmd=\"$cmd\"
4236240a9a23Smbalmer	  $show "$cmd"
4237240a9a23Smbalmer	  $run eval "$cmd" || {
4238240a9a23Smbalmer	    lt_exit=$?
4239240a9a23Smbalmer
4240240a9a23Smbalmer	    # Restore the uninstalled library and exit
4241240a9a23Smbalmer	    if test "$mode" = relink; then
4242240a9a23Smbalmer	      $run eval '(cd $output_objdir && $rm ${realname}T && $mv ${realname}U $realname)'
4243240a9a23Smbalmer	    fi
4244240a9a23Smbalmer
4245240a9a23Smbalmer	    exit $lt_exit
4246240a9a23Smbalmer	  }
4247240a9a23Smbalmer	done
4248240a9a23Smbalmer	IFS="$save_ifs"
4249240a9a23Smbalmer
4250240a9a23Smbalmer	# Restore the uninstalled library and exit
4251240a9a23Smbalmer	if test "$mode" = relink; then
4252240a9a23Smbalmer	  $run eval '(cd $output_objdir && $rm ${realname}T && $mv $realname ${realname}T && $mv "$realname"U $realname)' || exit $?
4253240a9a23Smbalmer
4254240a9a23Smbalmer	  if test -n "$convenience"; then
4255240a9a23Smbalmer	    if test -z "$whole_archive_flag_spec"; then
4256240a9a23Smbalmer	      $show "${rm}r $gentop"
4257240a9a23Smbalmer	      $run ${rm}r "$gentop"
4258240a9a23Smbalmer	    fi
4259240a9a23Smbalmer	  fi
4260240a9a23Smbalmer
4261240a9a23Smbalmer	  exit $EXIT_SUCCESS
4262240a9a23Smbalmer	fi
4263240a9a23Smbalmer
4264240a9a23Smbalmer	# Create links to the real library.
4265240a9a23Smbalmer	for linkname in $linknames; do
4266240a9a23Smbalmer	  if test "$realname" != "$linkname"; then
4267240a9a23Smbalmer	    $show "(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)"
4268240a9a23Smbalmer	    $run eval '(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)' || exit $?
4269240a9a23Smbalmer	  fi
4270240a9a23Smbalmer	done
4271240a9a23Smbalmer
4272240a9a23Smbalmer	# If -module or -export-dynamic was specified, set the dlname.
4273240a9a23Smbalmer	if test "$module" = yes || test "$export_dynamic" = yes; then
4274240a9a23Smbalmer	  # On all known operating systems, these are identical.
4275240a9a23Smbalmer	  dlname="$soname"
4276240a9a23Smbalmer	fi
4277240a9a23Smbalmer      fi
4278240a9a23Smbalmer      ;;
4279240a9a23Smbalmer
4280240a9a23Smbalmer    obj)
4281240a9a23Smbalmer      case " $deplibs" in
4282240a9a23Smbalmer      *\ -l* | *\ -L*)
4283240a9a23Smbalmer	$echo "$modename: warning: \`-l' and \`-L' are ignored for objects" 1>&2 ;;
4284240a9a23Smbalmer      esac
4285240a9a23Smbalmer
4286240a9a23Smbalmer      if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
4287240a9a23Smbalmer	$echo "$modename: warning: \`-dlopen' is ignored for objects" 1>&2
4288240a9a23Smbalmer      fi
4289240a9a23Smbalmer
4290240a9a23Smbalmer      if test -n "$rpath"; then
4291240a9a23Smbalmer	$echo "$modename: warning: \`-rpath' is ignored for objects" 1>&2
4292240a9a23Smbalmer      fi
4293240a9a23Smbalmer
4294240a9a23Smbalmer      if test -n "$xrpath"; then
4295240a9a23Smbalmer	$echo "$modename: warning: \`-R' is ignored for objects" 1>&2
4296240a9a23Smbalmer      fi
4297240a9a23Smbalmer
4298240a9a23Smbalmer      if test -n "$vinfo"; then
4299240a9a23Smbalmer	$echo "$modename: warning: \`-version-info' is ignored for objects" 1>&2
4300240a9a23Smbalmer      fi
4301240a9a23Smbalmer
4302240a9a23Smbalmer      if test -n "$release"; then
4303240a9a23Smbalmer	$echo "$modename: warning: \`-release' is ignored for objects" 1>&2
4304240a9a23Smbalmer      fi
4305240a9a23Smbalmer
4306240a9a23Smbalmer      case $output in
4307240a9a23Smbalmer      *.lo)
4308240a9a23Smbalmer	if test -n "$objs$old_deplibs"; then
4309240a9a23Smbalmer	  $echo "$modename: cannot build library object \`$output' from non-libtool objects" 1>&2
4310240a9a23Smbalmer	  exit $EXIT_FAILURE
4311240a9a23Smbalmer	fi
4312240a9a23Smbalmer	libobj="$output"
4313240a9a23Smbalmer	obj=`$echo "X$output" | $Xsed -e "$lo2o"`
4314240a9a23Smbalmer	;;
4315240a9a23Smbalmer      *)
4316240a9a23Smbalmer	libobj=
4317240a9a23Smbalmer	obj="$output"
4318240a9a23Smbalmer	;;
4319240a9a23Smbalmer      esac
4320240a9a23Smbalmer
4321240a9a23Smbalmer      # Delete the old objects.
4322240a9a23Smbalmer      $run $rm $obj $libobj
4323240a9a23Smbalmer
4324240a9a23Smbalmer      # Objects from convenience libraries.  This assumes
4325240a9a23Smbalmer      # single-version convenience libraries.  Whenever we create
4326240a9a23Smbalmer      # different ones for PIC/non-PIC, this we'll have to duplicate
4327240a9a23Smbalmer      # the extraction.
4328240a9a23Smbalmer      reload_conv_objs=
4329240a9a23Smbalmer      gentop=
4330240a9a23Smbalmer      # reload_cmds runs $LD directly, so let us get rid of
4331240a9a23Smbalmer      # -Wl from whole_archive_flag_spec and hope we can get by with
4332240a9a23Smbalmer      # turning comma into space..
4333240a9a23Smbalmer      wl=
4334240a9a23Smbalmer
4335240a9a23Smbalmer      if test -n "$convenience"; then
4336240a9a23Smbalmer	if test -n "$whole_archive_flag_spec"; then
4337240a9a23Smbalmer	  eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\"
4338240a9a23Smbalmer	  reload_conv_objs=$reload_objs\ `$echo "X$tmp_whole_archive_flags" | $Xsed -e 's|,| |g'`
4339240a9a23Smbalmer	else
4340240a9a23Smbalmer	  gentop="$output_objdir/${obj}x"
4341240a9a23Smbalmer	  generated="$generated $gentop"
4342240a9a23Smbalmer
4343240a9a23Smbalmer	  func_extract_archives $gentop $convenience
4344240a9a23Smbalmer	  reload_conv_objs="$reload_objs $func_extract_archives_result"
4345240a9a23Smbalmer	fi
4346240a9a23Smbalmer      fi
4347240a9a23Smbalmer
4348240a9a23Smbalmer      # Create the old-style object.
4349240a9a23Smbalmer      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
4350240a9a23Smbalmer
4351240a9a23Smbalmer      output="$obj"
4352240a9a23Smbalmer      cmds=$reload_cmds
4353240a9a23Smbalmer      save_ifs="$IFS"; IFS='~'
4354240a9a23Smbalmer      for cmd in $cmds; do
4355240a9a23Smbalmer	IFS="$save_ifs"
4356240a9a23Smbalmer	eval cmd=\"$cmd\"
4357240a9a23Smbalmer	$show "$cmd"
4358240a9a23Smbalmer	$run eval "$cmd" || exit $?
4359240a9a23Smbalmer      done
4360240a9a23Smbalmer      IFS="$save_ifs"
4361240a9a23Smbalmer
4362240a9a23Smbalmer      # Exit if we aren't doing a library object file.
4363240a9a23Smbalmer      if test -z "$libobj"; then
4364240a9a23Smbalmer	if test -n "$gentop"; then
4365240a9a23Smbalmer	  $show "${rm}r $gentop"
4366240a9a23Smbalmer	  $run ${rm}r $gentop
4367240a9a23Smbalmer	fi
4368240a9a23Smbalmer
4369240a9a23Smbalmer	exit $EXIT_SUCCESS
4370240a9a23Smbalmer      fi
4371240a9a23Smbalmer
4372240a9a23Smbalmer      if test "$build_libtool_libs" != yes; then
4373240a9a23Smbalmer	if test -n "$gentop"; then
4374240a9a23Smbalmer	  $show "${rm}r $gentop"
4375240a9a23Smbalmer	  $run ${rm}r $gentop
4376240a9a23Smbalmer	fi
4377240a9a23Smbalmer
4378240a9a23Smbalmer	# Create an invalid libtool object if no PIC, so that we don't
4379240a9a23Smbalmer	# accidentally link it into a program.
4380240a9a23Smbalmer	# $show "echo timestamp > $libobj"
4381240a9a23Smbalmer	# $run eval "echo timestamp > $libobj" || exit $?
4382240a9a23Smbalmer	exit $EXIT_SUCCESS
4383240a9a23Smbalmer      fi
4384240a9a23Smbalmer
4385240a9a23Smbalmer      if test -n "$pic_flag" || test "$pic_mode" != default; then
4386240a9a23Smbalmer	# Only do commands if we really have different PIC objects.
4387240a9a23Smbalmer	reload_objs="$libobjs $reload_conv_objs"
4388240a9a23Smbalmer	output="$libobj"
4389240a9a23Smbalmer	cmds=$reload_cmds
4390240a9a23Smbalmer	save_ifs="$IFS"; IFS='~'
4391240a9a23Smbalmer	for cmd in $cmds; do
4392240a9a23Smbalmer	  IFS="$save_ifs"
4393240a9a23Smbalmer	  eval cmd=\"$cmd\"
4394240a9a23Smbalmer	  $show "$cmd"
4395240a9a23Smbalmer	  $run eval "$cmd" || exit $?
4396240a9a23Smbalmer	done
4397240a9a23Smbalmer	IFS="$save_ifs"
4398240a9a23Smbalmer      fi
4399240a9a23Smbalmer
4400240a9a23Smbalmer      if test -n "$gentop"; then
4401240a9a23Smbalmer	$show "${rm}r $gentop"
4402240a9a23Smbalmer	$run ${rm}r $gentop
4403240a9a23Smbalmer      fi
4404240a9a23Smbalmer
4405240a9a23Smbalmer      exit $EXIT_SUCCESS
4406240a9a23Smbalmer      ;;
4407240a9a23Smbalmer
4408240a9a23Smbalmer    prog)
4409240a9a23Smbalmer      case $host in
4410240a9a23Smbalmer	*cygwin*) output=`$echo $output | ${SED} -e 's,.exe$,,;s,$,.exe,'` ;;
4411240a9a23Smbalmer      esac
4412240a9a23Smbalmer      if test -n "$vinfo"; then
4413240a9a23Smbalmer	$echo "$modename: warning: \`-version-info' is ignored for programs" 1>&2
4414240a9a23Smbalmer      fi
4415240a9a23Smbalmer
4416240a9a23Smbalmer      if test -n "$release"; then
4417240a9a23Smbalmer	$echo "$modename: warning: \`-release' is ignored for programs" 1>&2
4418240a9a23Smbalmer      fi
4419240a9a23Smbalmer
4420240a9a23Smbalmer      if test "$preload" = yes; then
4421240a9a23Smbalmer	if test "$dlopen_support" = unknown && test "$dlopen_self" = unknown &&
4422240a9a23Smbalmer	   test "$dlopen_self_static" = unknown; then
4423240a9a23Smbalmer	  $echo "$modename: warning: \`AC_LIBTOOL_DLOPEN' not used. Assuming no dlopen support."
4424240a9a23Smbalmer	fi
4425240a9a23Smbalmer      fi
4426240a9a23Smbalmer
4427240a9a23Smbalmer      case $host in
4428240a9a23Smbalmer      *-*-rhapsody* | *-*-darwin1.[012])
4429240a9a23Smbalmer	# On Rhapsody replace the C library is the System framework
4430240a9a23Smbalmer	compile_deplibs=`$echo "X $compile_deplibs" | $Xsed -e 's/ -lc / -framework System /'`
4431240a9a23Smbalmer	finalize_deplibs=`$echo "X $finalize_deplibs" | $Xsed -e 's/ -lc / -framework System /'`
4432240a9a23Smbalmer	;;
4433240a9a23Smbalmer      esac
4434240a9a23Smbalmer
4435240a9a23Smbalmer      case $host in
4436240a9a23Smbalmer      *darwin*)
4437240a9a23Smbalmer        # Don't allow lazy linking, it breaks C++ global constructors
4438240a9a23Smbalmer        if test "$tagname" = CXX ; then
4439240a9a23Smbalmer        compile_command="$compile_command ${wl}-bind_at_load"
4440240a9a23Smbalmer        finalize_command="$finalize_command ${wl}-bind_at_load"
4441240a9a23Smbalmer        fi
4442240a9a23Smbalmer        ;;
4443240a9a23Smbalmer      esac
4444240a9a23Smbalmer
4445240a9a23Smbalmer
4446240a9a23Smbalmer      # move library search paths that coincide with paths to not yet
4447240a9a23Smbalmer      # installed libraries to the beginning of the library search list
4448240a9a23Smbalmer      new_libs=
4449240a9a23Smbalmer      for path in $notinst_path; do
4450240a9a23Smbalmer	case " $new_libs " in
4451240a9a23Smbalmer	*" -L$path/$objdir "*) ;;
4452240a9a23Smbalmer	*)
4453240a9a23Smbalmer	  case " $compile_deplibs " in
4454240a9a23Smbalmer	  *" -L$path/$objdir "*)
4455240a9a23Smbalmer	    new_libs="$new_libs -L$path/$objdir" ;;
4456240a9a23Smbalmer	  esac
4457240a9a23Smbalmer	  ;;
4458240a9a23Smbalmer	esac
4459240a9a23Smbalmer      done
4460240a9a23Smbalmer      for deplib in $compile_deplibs; do
4461240a9a23Smbalmer	case $deplib in
4462240a9a23Smbalmer	-L*)
4463240a9a23Smbalmer	  case " $new_libs " in
4464240a9a23Smbalmer	  *" $deplib "*) ;;
4465240a9a23Smbalmer	  *) new_libs="$new_libs $deplib" ;;
4466240a9a23Smbalmer	  esac
4467240a9a23Smbalmer	  ;;
4468240a9a23Smbalmer	*) new_libs="$new_libs $deplib" ;;
4469240a9a23Smbalmer	esac
4470240a9a23Smbalmer      done
4471240a9a23Smbalmer      compile_deplibs="$new_libs"
4472240a9a23Smbalmer
4473240a9a23Smbalmer
4474240a9a23Smbalmer      compile_command="$compile_command $compile_deplibs"
4475240a9a23Smbalmer      finalize_command="$finalize_command $finalize_deplibs"
4476240a9a23Smbalmer
4477240a9a23Smbalmer      if test -n "$rpath$xrpath"; then
4478240a9a23Smbalmer	# If the user specified any rpath flags, then add them.
4479240a9a23Smbalmer	for libdir in $rpath $xrpath; do
4480240a9a23Smbalmer	  # This is the magic to use -rpath.
4481240a9a23Smbalmer	  case "$finalize_rpath " in
4482240a9a23Smbalmer	  *" $libdir "*) ;;
4483240a9a23Smbalmer	  *) finalize_rpath="$finalize_rpath $libdir" ;;
4484240a9a23Smbalmer	  esac
4485240a9a23Smbalmer	done
4486240a9a23Smbalmer      fi
4487240a9a23Smbalmer
4488240a9a23Smbalmer      # Now hardcode the library paths
4489240a9a23Smbalmer      rpath=
4490240a9a23Smbalmer      hardcode_libdirs=
4491240a9a23Smbalmer      for libdir in $compile_rpath $finalize_rpath; do
4492240a9a23Smbalmer	if test -n "$hardcode_libdir_flag_spec"; then
4493240a9a23Smbalmer	  if test -n "$hardcode_libdir_separator"; then
4494240a9a23Smbalmer	    if test -z "$hardcode_libdirs"; then
4495240a9a23Smbalmer	      hardcode_libdirs="$libdir"
4496240a9a23Smbalmer	    else
4497240a9a23Smbalmer	      # Just accumulate the unique libdirs.
4498240a9a23Smbalmer	      case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
4499240a9a23Smbalmer	      *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
4500240a9a23Smbalmer		;;
4501240a9a23Smbalmer	      *)
4502240a9a23Smbalmer		hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
4503240a9a23Smbalmer		;;
4504240a9a23Smbalmer	      esac
4505240a9a23Smbalmer	    fi
4506240a9a23Smbalmer	  else
4507240a9a23Smbalmer	    eval flag=\"$hardcode_libdir_flag_spec\"
4508240a9a23Smbalmer	    rpath="$rpath $flag"
4509240a9a23Smbalmer	  fi
4510240a9a23Smbalmer	elif test -n "$runpath_var"; then
4511240a9a23Smbalmer	  case "$perm_rpath " in
4512240a9a23Smbalmer	  *" $libdir "*) ;;
4513240a9a23Smbalmer	  *) perm_rpath="$perm_rpath $libdir" ;;
4514240a9a23Smbalmer	  esac
4515240a9a23Smbalmer	fi
4516240a9a23Smbalmer	case $host in
4517240a9a23Smbalmer	*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
4518240a9a23Smbalmer	  testbindir=`$echo "X$libdir" | $Xsed -e 's*/lib$*/bin*'`
4519240a9a23Smbalmer	  case :$dllsearchpath: in
4520240a9a23Smbalmer	  *":$libdir:"*) ;;
4521240a9a23Smbalmer	  *) dllsearchpath="$dllsearchpath:$libdir";;
4522240a9a23Smbalmer	  esac
4523240a9a23Smbalmer	  case :$dllsearchpath: in
4524240a9a23Smbalmer	  *":$testbindir:"*) ;;
4525240a9a23Smbalmer	  *) dllsearchpath="$dllsearchpath:$testbindir";;
4526240a9a23Smbalmer	  esac
4527240a9a23Smbalmer	  ;;
4528240a9a23Smbalmer	esac
4529240a9a23Smbalmer      done
4530240a9a23Smbalmer      # Substitute the hardcoded libdirs into the rpath.
4531240a9a23Smbalmer      if test -n "$hardcode_libdir_separator" &&
4532240a9a23Smbalmer	 test -n "$hardcode_libdirs"; then
4533240a9a23Smbalmer	libdir="$hardcode_libdirs"
4534240a9a23Smbalmer	eval rpath=\" $hardcode_libdir_flag_spec\"
4535240a9a23Smbalmer      fi
4536240a9a23Smbalmer      compile_rpath="$rpath"
4537240a9a23Smbalmer
4538240a9a23Smbalmer      rpath=
4539240a9a23Smbalmer      hardcode_libdirs=
4540240a9a23Smbalmer      for libdir in $finalize_rpath; do
4541240a9a23Smbalmer	if test -n "$hardcode_libdir_flag_spec"; then
4542240a9a23Smbalmer	  if test -n "$hardcode_libdir_separator"; then
4543240a9a23Smbalmer	    if test -z "$hardcode_libdirs"; then
4544240a9a23Smbalmer	      hardcode_libdirs="$libdir"
4545240a9a23Smbalmer	    else
4546240a9a23Smbalmer	      # Just accumulate the unique libdirs.
4547240a9a23Smbalmer	      case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
4548240a9a23Smbalmer	      *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
4549240a9a23Smbalmer		;;
4550240a9a23Smbalmer	      *)
4551240a9a23Smbalmer		hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
4552240a9a23Smbalmer		;;
4553240a9a23Smbalmer	      esac
4554240a9a23Smbalmer	    fi
4555240a9a23Smbalmer	  else
4556240a9a23Smbalmer	    eval flag=\"$hardcode_libdir_flag_spec\"
4557240a9a23Smbalmer	    rpath="$rpath $flag"
4558240a9a23Smbalmer	  fi
4559240a9a23Smbalmer	elif test -n "$runpath_var"; then
4560240a9a23Smbalmer	  case "$finalize_perm_rpath " in
4561240a9a23Smbalmer	  *" $libdir "*) ;;
4562240a9a23Smbalmer	  *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;;
4563240a9a23Smbalmer	  esac
4564240a9a23Smbalmer	fi
4565240a9a23Smbalmer      done
4566240a9a23Smbalmer      # Substitute the hardcoded libdirs into the rpath.
4567240a9a23Smbalmer      if test -n "$hardcode_libdir_separator" &&
4568240a9a23Smbalmer	 test -n "$hardcode_libdirs"; then
4569240a9a23Smbalmer	libdir="$hardcode_libdirs"
4570240a9a23Smbalmer	eval rpath=\" $hardcode_libdir_flag_spec\"
4571240a9a23Smbalmer      fi
4572240a9a23Smbalmer      finalize_rpath="$rpath"
4573240a9a23Smbalmer
4574240a9a23Smbalmer      if test -n "$libobjs" && test "$build_old_libs" = yes; then
4575240a9a23Smbalmer	# Transform all the library objects into standard objects.
4576240a9a23Smbalmer	compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
4577240a9a23Smbalmer	finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
4578240a9a23Smbalmer      fi
4579240a9a23Smbalmer
4580240a9a23Smbalmer      dlsyms=
4581240a9a23Smbalmer      if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
4582240a9a23Smbalmer	if test -n "$NM" && test -n "$global_symbol_pipe"; then
4583240a9a23Smbalmer	  dlsyms="${outputname}S.c"
4584240a9a23Smbalmer	else
4585240a9a23Smbalmer	  $echo "$modename: not configured to extract global symbols from dlpreopened files" 1>&2
4586240a9a23Smbalmer	fi
4587240a9a23Smbalmer      fi
4588240a9a23Smbalmer
4589240a9a23Smbalmer      if test -n "$dlsyms"; then
4590240a9a23Smbalmer	case $dlsyms in
4591240a9a23Smbalmer	"") ;;
4592240a9a23Smbalmer	*.c)
4593240a9a23Smbalmer	  # Discover the nlist of each of the dlfiles.
4594240a9a23Smbalmer	  nlist="$output_objdir/${outputname}.nm"
4595240a9a23Smbalmer
4596240a9a23Smbalmer	  $show "$rm $nlist ${nlist}S ${nlist}T"
4597240a9a23Smbalmer	  $run $rm "$nlist" "${nlist}S" "${nlist}T"
4598240a9a23Smbalmer
4599240a9a23Smbalmer	  # Parse the name list into a source file.
4600240a9a23Smbalmer	  $show "creating $output_objdir/$dlsyms"
4601240a9a23Smbalmer
4602240a9a23Smbalmer	  test -z "$run" && $echo > "$output_objdir/$dlsyms" "\
4603240a9a23Smbalmer/* $dlsyms - symbol resolution table for \`$outputname' dlsym emulation. */
4604240a9a23Smbalmer/* Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP */
4605240a9a23Smbalmer
4606240a9a23Smbalmer#ifdef __cplusplus
4607240a9a23Smbalmerextern \"C\" {
4608240a9a23Smbalmer#endif
4609240a9a23Smbalmer
4610240a9a23Smbalmer/* Prevent the only kind of declaration conflicts we can make. */
4611240a9a23Smbalmer#define lt_preloaded_symbols some_other_symbol
4612240a9a23Smbalmer
4613240a9a23Smbalmer/* External symbol declarations for the compiler. */\
4614240a9a23Smbalmer"
4615240a9a23Smbalmer
4616240a9a23Smbalmer	  if test "$dlself" = yes; then
4617240a9a23Smbalmer	    $show "generating symbol list for \`$output'"
4618240a9a23Smbalmer
4619240a9a23Smbalmer	    test -z "$run" && $echo ': @PROGRAM@ ' > "$nlist"
4620240a9a23Smbalmer
4621240a9a23Smbalmer	    # Add our own program objects to the symbol list.
4622240a9a23Smbalmer	    progfiles=`$echo "X$objs$old_deplibs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
4623240a9a23Smbalmer	    for arg in $progfiles; do
4624240a9a23Smbalmer	      $show "extracting global C symbols from \`$arg'"
4625240a9a23Smbalmer	      $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
4626240a9a23Smbalmer	    done
4627240a9a23Smbalmer
4628240a9a23Smbalmer	    if test -n "$exclude_expsyms"; then
4629240a9a23Smbalmer	      $run eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
4630240a9a23Smbalmer	      $run eval '$mv "$nlist"T "$nlist"'
4631240a9a23Smbalmer	    fi
4632240a9a23Smbalmer
4633240a9a23Smbalmer	    if test -n "$export_symbols_regex"; then
4634240a9a23Smbalmer	      $run eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T'
4635240a9a23Smbalmer	      $run eval '$mv "$nlist"T "$nlist"'
4636240a9a23Smbalmer	    fi
4637240a9a23Smbalmer
4638240a9a23Smbalmer	    # Prepare the list of exported symbols
4639240a9a23Smbalmer	    if test -z "$export_symbols"; then
4640240a9a23Smbalmer	      export_symbols="$output_objdir/$outputname.exp"
4641240a9a23Smbalmer	      $run $rm $export_symbols
4642240a9a23Smbalmer	      $run eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
4643240a9a23Smbalmer              case $host in
4644240a9a23Smbalmer              *cygwin* | *mingw* )
4645240a9a23Smbalmer	        $run eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
4646240a9a23Smbalmer		$run eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"'
4647240a9a23Smbalmer                ;;
4648240a9a23Smbalmer              esac
4649240a9a23Smbalmer	    else
4650240a9a23Smbalmer	      $run eval "${SED} -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"'
4651240a9a23Smbalmer	      $run eval 'grep -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T'
4652240a9a23Smbalmer	      $run eval 'mv "$nlist"T "$nlist"'
4653240a9a23Smbalmer              case $host in
4654240a9a23Smbalmer              *cygwin* | *mingw* )
4655240a9a23Smbalmer	        $run eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
4656240a9a23Smbalmer		$run eval 'cat "$nlist" >> "$output_objdir/$outputname.def"'
4657240a9a23Smbalmer                ;;
4658240a9a23Smbalmer              esac
4659240a9a23Smbalmer	    fi
4660240a9a23Smbalmer	  fi
4661240a9a23Smbalmer
4662240a9a23Smbalmer	  for arg in $dlprefiles; do
4663240a9a23Smbalmer	    $show "extracting global C symbols from \`$arg'"
4664240a9a23Smbalmer	    name=`$echo "$arg" | ${SED} -e 's%^.*/%%'`
4665240a9a23Smbalmer	    $run eval '$echo ": $name " >> "$nlist"'
4666240a9a23Smbalmer	    $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
4667240a9a23Smbalmer	  done
4668240a9a23Smbalmer
4669240a9a23Smbalmer	  if test -z "$run"; then
4670240a9a23Smbalmer	    # Make sure we have at least an empty file.
4671240a9a23Smbalmer	    test -f "$nlist" || : > "$nlist"
4672240a9a23Smbalmer
4673240a9a23Smbalmer	    if test -n "$exclude_expsyms"; then
4674240a9a23Smbalmer	      $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T
4675240a9a23Smbalmer	      $mv "$nlist"T "$nlist"
4676240a9a23Smbalmer	    fi
4677240a9a23Smbalmer
4678240a9a23Smbalmer	    # Try sorting and uniquifying the output.
4679240a9a23Smbalmer	    if grep -v "^: " < "$nlist" |
4680240a9a23Smbalmer		if sort -k 3 </dev/null >/dev/null 2>&1; then
4681240a9a23Smbalmer		  sort -k 3
4682240a9a23Smbalmer		else
4683240a9a23Smbalmer		  sort +2
4684240a9a23Smbalmer		fi |
4685240a9a23Smbalmer		uniq > "$nlist"S; then
4686240a9a23Smbalmer	      :
4687240a9a23Smbalmer	    else
4688240a9a23Smbalmer	      grep -v "^: " < "$nlist" > "$nlist"S
4689240a9a23Smbalmer	    fi
4690240a9a23Smbalmer
4691240a9a23Smbalmer	    if test -f "$nlist"S; then
4692240a9a23Smbalmer	      eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$dlsyms"'
4693240a9a23Smbalmer	    else
4694240a9a23Smbalmer	      $echo '/* NONE */' >> "$output_objdir/$dlsyms"
4695240a9a23Smbalmer	    fi
4696240a9a23Smbalmer
4697240a9a23Smbalmer	    $echo >> "$output_objdir/$dlsyms" "\
4698240a9a23Smbalmer
4699240a9a23Smbalmer#undef lt_preloaded_symbols
4700240a9a23Smbalmer
4701240a9a23Smbalmer#if defined (__STDC__) && __STDC__
4702240a9a23Smbalmer# define lt_ptr void *
4703240a9a23Smbalmer#else
4704240a9a23Smbalmer# define lt_ptr char *
4705240a9a23Smbalmer# define const
4706240a9a23Smbalmer#endif
4707240a9a23Smbalmer
4708240a9a23Smbalmer/* The mapping between symbol names and symbols. */
4709240a9a23Smbalmer"
4710240a9a23Smbalmer
4711240a9a23Smbalmer	    case $host in
4712240a9a23Smbalmer	    *cygwin* | *mingw* )
4713240a9a23Smbalmer	  $echo >> "$output_objdir/$dlsyms" "\
4714240a9a23Smbalmer/* DATA imports from DLLs on WIN32 can't be const, because
4715240a9a23Smbalmer   runtime relocations are performed -- see ld's documentation
4716240a9a23Smbalmer   on pseudo-relocs */
4717240a9a23Smbalmerstruct {
4718240a9a23Smbalmer"
4719240a9a23Smbalmer	      ;;
4720240a9a23Smbalmer	    * )
4721240a9a23Smbalmer	  $echo >> "$output_objdir/$dlsyms" "\
4722240a9a23Smbalmerconst struct {
4723240a9a23Smbalmer"
4724240a9a23Smbalmer	      ;;
4725240a9a23Smbalmer	    esac
4726240a9a23Smbalmer
4727240a9a23Smbalmer
4728240a9a23Smbalmer	  $echo >> "$output_objdir/$dlsyms" "\
4729240a9a23Smbalmer  const char *name;
4730240a9a23Smbalmer  lt_ptr address;
4731240a9a23Smbalmer}
4732240a9a23Smbalmerlt_preloaded_symbols[] =
4733240a9a23Smbalmer{\
4734240a9a23Smbalmer"
4735240a9a23Smbalmer
4736240a9a23Smbalmer	    eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$dlsyms"
4737240a9a23Smbalmer
4738240a9a23Smbalmer	    $echo >> "$output_objdir/$dlsyms" "\
4739240a9a23Smbalmer  {0, (lt_ptr) 0}
4740240a9a23Smbalmer};
4741240a9a23Smbalmer
4742240a9a23Smbalmer/* This works around a problem in FreeBSD linker */
4743240a9a23Smbalmer#ifdef FREEBSD_WORKAROUND
4744240a9a23Smbalmerstatic const void *lt_preloaded_setup() {
4745240a9a23Smbalmer  return lt_preloaded_symbols;
4746240a9a23Smbalmer}
4747240a9a23Smbalmer#endif
4748240a9a23Smbalmer
4749240a9a23Smbalmer#ifdef __cplusplus
4750240a9a23Smbalmer}
4751240a9a23Smbalmer#endif\
4752240a9a23Smbalmer"
4753240a9a23Smbalmer	  fi
4754240a9a23Smbalmer
4755240a9a23Smbalmer	  pic_flag_for_symtable=
4756240a9a23Smbalmer	  case $host in
4757240a9a23Smbalmer	  # compiling the symbol table file with pic_flag works around
4758240a9a23Smbalmer	  # a FreeBSD bug that causes programs to crash when -lm is
4759240a9a23Smbalmer	  # linked before any other PIC object.  But we must not use
4760240a9a23Smbalmer	  # pic_flag when linking with -static.  The problem exists in
4761240a9a23Smbalmer	  # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1.
4762240a9a23Smbalmer	  *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)
4763240a9a23Smbalmer	    case "$compile_command " in
4764240a9a23Smbalmer	    *" -static "*) ;;
4765240a9a23Smbalmer	    *) pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND";;
4766240a9a23Smbalmer	    esac;;
4767240a9a23Smbalmer	  *-*-hpux*)
4768240a9a23Smbalmer	    case "$compile_command " in
4769240a9a23Smbalmer	    *" -static "*) ;;
4770240a9a23Smbalmer	    *) pic_flag_for_symtable=" $pic_flag";;
4771240a9a23Smbalmer	    esac
4772240a9a23Smbalmer	  esac
4773240a9a23Smbalmer
4774240a9a23Smbalmer	  # Now compile the dynamic symbol file.
4775240a9a23Smbalmer	  $show "(cd $output_objdir && $LTCC  $LTCFLAGS -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")"
4776240a9a23Smbalmer	  $run eval '(cd $output_objdir && $LTCC  $LTCFLAGS -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $?
4777240a9a23Smbalmer
4778240a9a23Smbalmer	  # Clean up the generated files.
4779240a9a23Smbalmer	  $show "$rm $output_objdir/$dlsyms $nlist ${nlist}S ${nlist}T"
4780240a9a23Smbalmer	  $run $rm "$output_objdir/$dlsyms" "$nlist" "${nlist}S" "${nlist}T"
4781240a9a23Smbalmer
4782240a9a23Smbalmer	  # Transform the symbol file into the correct name.
4783240a9a23Smbalmer          case $host in
4784240a9a23Smbalmer          *cygwin* | *mingw* )
4785240a9a23Smbalmer            if test -f "$output_objdir/${outputname}.def" ; then
4786240a9a23Smbalmer              compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}.def $output_objdir/${outputname}S.${objext}%" | $NL2SP`
4787240a9a23Smbalmer              finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}.def $output_objdir/${outputname}S.${objext}%" | $NL2SP`
4788240a9a23Smbalmer            else
4789240a9a23Smbalmer              compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%" | $NL2SP`
4790240a9a23Smbalmer              finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%" | $NL2SP`
4791240a9a23Smbalmer             fi
4792240a9a23Smbalmer            ;;
4793240a9a23Smbalmer          * )
4794240a9a23Smbalmer            compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%" | $NL2SP`
4795240a9a23Smbalmer            finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%" | $NL2SP`
4796240a9a23Smbalmer            ;;
4797240a9a23Smbalmer          esac
4798240a9a23Smbalmer	  ;;
4799240a9a23Smbalmer	*)
4800240a9a23Smbalmer	  $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2
4801240a9a23Smbalmer	  exit $EXIT_FAILURE
4802240a9a23Smbalmer	  ;;
4803240a9a23Smbalmer	esac
4804240a9a23Smbalmer      else
4805240a9a23Smbalmer	# We keep going just in case the user didn't refer to
4806240a9a23Smbalmer	# lt_preloaded_symbols.  The linker will fail if global_symbol_pipe
4807240a9a23Smbalmer	# really was required.
4808240a9a23Smbalmer
4809240a9a23Smbalmer	# Nullify the symbol file.
4810240a9a23Smbalmer	compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "s% @SYMFILE@%%" | $NL2SP`
4811240a9a23Smbalmer	finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "s% @SYMFILE@%%" | $NL2SP`
4812240a9a23Smbalmer      fi
4813240a9a23Smbalmer
4814240a9a23Smbalmer      if test "$need_relink" = no || test "$build_libtool_libs" != yes; then
4815240a9a23Smbalmer	# Replace the output file specification.
4816240a9a23Smbalmer	compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e 's%@OUTPUT@%'"$output"'%g' | $NL2SP`
4817240a9a23Smbalmer	link_command="$compile_command$compile_rpath"
4818240a9a23Smbalmer
4819240a9a23Smbalmer	# We have no uninstalled library dependencies, so finalize right now.
4820240a9a23Smbalmer	$show "$link_command"
4821240a9a23Smbalmer	$run eval "$link_command"
4822240a9a23Smbalmer	exit_status=$?
4823240a9a23Smbalmer
4824240a9a23Smbalmer	# Delete the generated files.
4825240a9a23Smbalmer	if test -n "$dlsyms"; then
4826240a9a23Smbalmer	  $show "$rm $output_objdir/${outputname}S.${objext}"
4827240a9a23Smbalmer	  $run $rm "$output_objdir/${outputname}S.${objext}"
4828240a9a23Smbalmer	fi
4829240a9a23Smbalmer
4830240a9a23Smbalmer	exit $exit_status
4831240a9a23Smbalmer      fi
4832240a9a23Smbalmer
4833240a9a23Smbalmer      if test -n "$shlibpath_var"; then
4834240a9a23Smbalmer	# We should set the shlibpath_var
4835240a9a23Smbalmer	rpath=
4836240a9a23Smbalmer	for dir in $temp_rpath; do
4837240a9a23Smbalmer	  case $dir in
4838240a9a23Smbalmer	  [\\/]* | [A-Za-z]:[\\/]*)
4839240a9a23Smbalmer	    # Absolute path.
4840240a9a23Smbalmer	    rpath="$rpath$dir:"
4841240a9a23Smbalmer	    ;;
4842240a9a23Smbalmer	  *)
4843240a9a23Smbalmer	    # Relative path: add a thisdir entry.
4844240a9a23Smbalmer	    rpath="$rpath\$thisdir/$dir:"
4845240a9a23Smbalmer	    ;;
4846240a9a23Smbalmer	  esac
4847240a9a23Smbalmer	done
4848240a9a23Smbalmer	temp_rpath="$rpath"
4849240a9a23Smbalmer      fi
4850240a9a23Smbalmer
4851240a9a23Smbalmer      if test -n "$compile_shlibpath$finalize_shlibpath"; then
4852240a9a23Smbalmer	compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command"
4853240a9a23Smbalmer      fi
4854240a9a23Smbalmer      if test -n "$finalize_shlibpath"; then
4855240a9a23Smbalmer	finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command"
4856240a9a23Smbalmer      fi
4857240a9a23Smbalmer
4858240a9a23Smbalmer      compile_var=
4859240a9a23Smbalmer      finalize_var=
4860240a9a23Smbalmer      if test -n "$runpath_var"; then
4861240a9a23Smbalmer	if test -n "$perm_rpath"; then
4862240a9a23Smbalmer	  # We should set the runpath_var.
4863240a9a23Smbalmer	  rpath=
4864240a9a23Smbalmer	  for dir in $perm_rpath; do
4865240a9a23Smbalmer	    rpath="$rpath$dir:"
4866240a9a23Smbalmer	  done
4867240a9a23Smbalmer	  compile_var="$runpath_var=\"$rpath\$$runpath_var\" "
4868240a9a23Smbalmer	fi
4869240a9a23Smbalmer	if test -n "$finalize_perm_rpath"; then
4870240a9a23Smbalmer	  # We should set the runpath_var.
4871240a9a23Smbalmer	  rpath=
4872240a9a23Smbalmer	  for dir in $finalize_perm_rpath; do
4873240a9a23Smbalmer	    rpath="$rpath$dir:"
4874240a9a23Smbalmer	  done
4875240a9a23Smbalmer	  finalize_var="$runpath_var=\"$rpath\$$runpath_var\" "
4876240a9a23Smbalmer	fi
4877240a9a23Smbalmer      fi
4878240a9a23Smbalmer
4879240a9a23Smbalmer      if test "$no_install" = yes; then
4880240a9a23Smbalmer	# We don't need to create a wrapper script.
4881240a9a23Smbalmer	link_command="$compile_var$compile_command$compile_rpath"
4882240a9a23Smbalmer	# Replace the output file specification.
4883240a9a23Smbalmer	link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
4884240a9a23Smbalmer	# Delete the old output file.
4885240a9a23Smbalmer	$run $rm $output
4886240a9a23Smbalmer	# Link the executable and exit
4887240a9a23Smbalmer	$show "$link_command"
4888240a9a23Smbalmer	$run eval "$link_command" || exit $?
4889240a9a23Smbalmer	exit $EXIT_SUCCESS
4890240a9a23Smbalmer      fi
4891240a9a23Smbalmer
4892240a9a23Smbalmer      if test "$hardcode_action" = relink; then
4893240a9a23Smbalmer	# Fast installation is not supported
4894240a9a23Smbalmer	link_command="$compile_var$compile_command$compile_rpath"
4895240a9a23Smbalmer	relink_command="$finalize_var$finalize_command$finalize_rpath"
4896240a9a23Smbalmer
4897240a9a23Smbalmer	$echo "$modename: warning: this platform does not like uninstalled shared libraries" 1>&2
4898240a9a23Smbalmer	$echo "$modename: \`$output' will be relinked during installation" 1>&2
4899240a9a23Smbalmer      else
4900240a9a23Smbalmer	if test "$fast_install" != no; then
4901240a9a23Smbalmer	  link_command="$finalize_var$compile_command$finalize_rpath"
4902240a9a23Smbalmer	  if test "$fast_install" = yes; then
4903240a9a23Smbalmer	    relink_command=`$echo "X$compile_var$compile_command$compile_rpath" | $SP2NL | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g' | $NL2SP`
4904240a9a23Smbalmer	  else
4905240a9a23Smbalmer	    # fast_install is set to needless
4906240a9a23Smbalmer	    relink_command=
4907240a9a23Smbalmer	  fi
4908240a9a23Smbalmer	else
4909240a9a23Smbalmer	  link_command="$compile_var$compile_command$compile_rpath"
4910240a9a23Smbalmer	  relink_command="$finalize_var$finalize_command$finalize_rpath"
4911240a9a23Smbalmer	fi
4912240a9a23Smbalmer      fi
4913240a9a23Smbalmer
4914240a9a23Smbalmer      # Replace the output file specification.
4915240a9a23Smbalmer      link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`
4916240a9a23Smbalmer
4917240a9a23Smbalmer      # Delete the old output files.
4918240a9a23Smbalmer      $run $rm $output $output_objdir/$outputname $output_objdir/lt-$outputname
4919240a9a23Smbalmer
4920240a9a23Smbalmer      $show "$link_command"
4921240a9a23Smbalmer      $run eval "$link_command" || exit $?
4922240a9a23Smbalmer
4923240a9a23Smbalmer      # Now create the wrapper script.
4924240a9a23Smbalmer      $show "creating $output"
4925240a9a23Smbalmer
4926240a9a23Smbalmer      # Quote the relink command for shipping.
4927240a9a23Smbalmer      if test -n "$relink_command"; then
4928240a9a23Smbalmer	# Preserve any variables that may affect compiler behavior
4929240a9a23Smbalmer	for var in $variables_saved_for_relink; do
4930240a9a23Smbalmer	  if eval test -z \"\${$var+set}\"; then
4931240a9a23Smbalmer	    relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command"
4932240a9a23Smbalmer	  elif eval var_value=\$$var; test -z "$var_value"; then
4933240a9a23Smbalmer	    relink_command="$var=; export $var; $relink_command"
4934240a9a23Smbalmer	  else
4935240a9a23Smbalmer	    var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"`
4936240a9a23Smbalmer	    relink_command="$var=\"$var_value\"; export $var; $relink_command"
4937240a9a23Smbalmer	  fi
4938240a9a23Smbalmer	done
4939240a9a23Smbalmer	relink_command="(cd `pwd`; $relink_command)"
4940240a9a23Smbalmer	relink_command=`$echo "X$relink_command" | $SP2NL | $Xsed -e "$sed_quote_subst" | $NL2SP`
4941240a9a23Smbalmer      fi
4942240a9a23Smbalmer
4943240a9a23Smbalmer      # Quote $echo for shipping.
4944240a9a23Smbalmer      if test "X$echo" = "X$SHELL $progpath --fallback-echo"; then
4945240a9a23Smbalmer	case $progpath in
4946240a9a23Smbalmer	[\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $progpath --fallback-echo";;
4947240a9a23Smbalmer	*) qecho="$SHELL `pwd`/$progpath --fallback-echo";;
4948240a9a23Smbalmer	esac
4949240a9a23Smbalmer	qecho=`$echo "X$qecho" | $Xsed -e "$sed_quote_subst"`
4950240a9a23Smbalmer      else
4951240a9a23Smbalmer	qecho=`$echo "X$echo" | $Xsed -e "$sed_quote_subst"`
4952240a9a23Smbalmer      fi
4953240a9a23Smbalmer
4954240a9a23Smbalmer      # Only actually do things if our run command is non-null.
4955240a9a23Smbalmer      if test -z "$run"; then
4956240a9a23Smbalmer	# win32 will think the script is a binary if it has
4957240a9a23Smbalmer	# a .exe suffix, so we strip it off here.
4958240a9a23Smbalmer	case $output in
4959240a9a23Smbalmer	  *.exe) output=`$echo $output|${SED} 's,.exe$,,'` ;;
4960240a9a23Smbalmer	esac
4961240a9a23Smbalmer	# test for cygwin because mv fails w/o .exe extensions
4962240a9a23Smbalmer	case $host in
4963240a9a23Smbalmer	  *cygwin*)
4964240a9a23Smbalmer	    exeext=.exe
4965240a9a23Smbalmer	    outputname=`$echo $outputname|${SED} 's,.exe$,,'` ;;
4966240a9a23Smbalmer	  *) exeext= ;;
4967240a9a23Smbalmer	esac
4968240a9a23Smbalmer	case $host in
4969240a9a23Smbalmer	  *cygwin* | *mingw* )
4970240a9a23Smbalmer            output_name=`basename $output`
4971240a9a23Smbalmer            output_path=`dirname $output`
4972240a9a23Smbalmer            cwrappersource="$output_path/$objdir/lt-$output_name.c"
4973240a9a23Smbalmer            cwrapper="$output_path/$output_name.exe"
4974240a9a23Smbalmer            $rm $cwrappersource $cwrapper
4975240a9a23Smbalmer            trap "$rm $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15
4976240a9a23Smbalmer
4977240a9a23Smbalmer	    cat > $cwrappersource <<EOF
4978240a9a23Smbalmer
4979240a9a23Smbalmer/* $cwrappersource - temporary wrapper executable for $objdir/$outputname
4980240a9a23Smbalmer   Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
4981240a9a23Smbalmer
4982240a9a23Smbalmer   The $output program cannot be directly executed until all the libtool
4983240a9a23Smbalmer   libraries that it depends on are installed.
4984240a9a23Smbalmer
4985240a9a23Smbalmer   This wrapper executable should never be moved out of the build directory.
4986240a9a23Smbalmer   If it is, it will not operate correctly.
4987240a9a23Smbalmer
4988240a9a23Smbalmer   Currently, it simply execs the wrapper *script* "/bin/sh $output",
4989240a9a23Smbalmer   but could eventually absorb all of the scripts functionality and
4990240a9a23Smbalmer   exec $objdir/$outputname directly.
4991240a9a23Smbalmer*/
4992240a9a23SmbalmerEOF
4993240a9a23Smbalmer	    cat >> $cwrappersource<<"EOF"
4994240a9a23Smbalmer#include <stdio.h>
4995240a9a23Smbalmer#include <stdlib.h>
4996240a9a23Smbalmer#include <unistd.h>
4997240a9a23Smbalmer#include <malloc.h>
4998240a9a23Smbalmer#include <stdarg.h>
4999240a9a23Smbalmer#include <assert.h>
5000240a9a23Smbalmer#include <string.h>
5001240a9a23Smbalmer#include <ctype.h>
5002240a9a23Smbalmer#include <sys/stat.h>
5003240a9a23Smbalmer
5004240a9a23Smbalmer#if defined(PATH_MAX)
5005240a9a23Smbalmer# define LT_PATHMAX PATH_MAX
5006240a9a23Smbalmer#elif defined(MAXPATHLEN)
5007240a9a23Smbalmer# define LT_PATHMAX MAXPATHLEN
5008240a9a23Smbalmer#else
5009240a9a23Smbalmer# define LT_PATHMAX 1024
5010240a9a23Smbalmer#endif
5011240a9a23Smbalmer
5012240a9a23Smbalmer#ifndef DIR_SEPARATOR
5013240a9a23Smbalmer# define DIR_SEPARATOR '/'
5014240a9a23Smbalmer# define PATH_SEPARATOR ':'
5015240a9a23Smbalmer#endif
5016240a9a23Smbalmer
5017240a9a23Smbalmer#if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \
5018240a9a23Smbalmer  defined (__OS2__)
5019240a9a23Smbalmer# define HAVE_DOS_BASED_FILE_SYSTEM
5020240a9a23Smbalmer# ifndef DIR_SEPARATOR_2
5021240a9a23Smbalmer#  define DIR_SEPARATOR_2 '\\'
5022240a9a23Smbalmer# endif
5023240a9a23Smbalmer# ifndef PATH_SEPARATOR_2
5024240a9a23Smbalmer#  define PATH_SEPARATOR_2 ';'
5025240a9a23Smbalmer# endif
5026240a9a23Smbalmer#endif
5027240a9a23Smbalmer
5028240a9a23Smbalmer#ifndef DIR_SEPARATOR_2
5029240a9a23Smbalmer# define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR)
5030240a9a23Smbalmer#else /* DIR_SEPARATOR_2 */
5031240a9a23Smbalmer# define IS_DIR_SEPARATOR(ch) \
5032240a9a23Smbalmer        (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2))
5033240a9a23Smbalmer#endif /* DIR_SEPARATOR_2 */
5034240a9a23Smbalmer
5035240a9a23Smbalmer#ifndef PATH_SEPARATOR_2
5036240a9a23Smbalmer# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR)
5037240a9a23Smbalmer#else /* PATH_SEPARATOR_2 */
5038240a9a23Smbalmer# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2)
5039240a9a23Smbalmer#endif /* PATH_SEPARATOR_2 */
5040240a9a23Smbalmer
5041240a9a23Smbalmer#define XMALLOC(type, num)      ((type *) xmalloc ((num) * sizeof(type)))
5042240a9a23Smbalmer#define XFREE(stale) do { \
5043240a9a23Smbalmer  if (stale) { free ((void *) stale); stale = 0; } \
5044240a9a23Smbalmer} while (0)
5045240a9a23Smbalmer
5046240a9a23Smbalmer/* -DDEBUG is fairly common in CFLAGS.  */
5047240a9a23Smbalmer#undef DEBUG
5048240a9a23Smbalmer#if defined DEBUGWRAPPER
5049240a9a23Smbalmer# define DEBUG(format, ...) fprintf(stderr, format, __VA_ARGS__)
5050240a9a23Smbalmer#else
5051240a9a23Smbalmer# define DEBUG(format, ...)
5052240a9a23Smbalmer#endif
5053240a9a23Smbalmer
5054240a9a23Smbalmerconst char *program_name = NULL;
5055240a9a23Smbalmer
5056240a9a23Smbalmervoid * xmalloc (size_t num);
5057240a9a23Smbalmerchar * xstrdup (const char *string);
5058240a9a23Smbalmerconst char * base_name (const char *name);
5059240a9a23Smbalmerchar * find_executable(const char *wrapper);
5060240a9a23Smbalmerint    check_executable(const char *path);
5061240a9a23Smbalmerchar * strendzap(char *str, const char *pat);
5062240a9a23Smbalmervoid lt_fatal (const char *message, ...);
5063240a9a23Smbalmer
5064240a9a23Smbalmerint
5065240a9a23Smbalmermain (int argc, char *argv[])
5066240a9a23Smbalmer{
5067240a9a23Smbalmer  char **newargz;
5068240a9a23Smbalmer  int i;
5069240a9a23Smbalmer
5070240a9a23Smbalmer  program_name = (char *) xstrdup (base_name (argv[0]));
5071240a9a23Smbalmer  DEBUG("(main) argv[0]      : %s\n",argv[0]);
5072240a9a23Smbalmer  DEBUG("(main) program_name : %s\n",program_name);
5073240a9a23Smbalmer  newargz = XMALLOC(char *, argc+2);
5074240a9a23SmbalmerEOF
5075240a9a23Smbalmer
5076240a9a23Smbalmer            cat >> $cwrappersource <<EOF
5077240a9a23Smbalmer  newargz[0] = (char *) xstrdup("$SHELL");
5078240a9a23SmbalmerEOF
5079240a9a23Smbalmer
5080240a9a23Smbalmer            cat >> $cwrappersource <<"EOF"
5081240a9a23Smbalmer  newargz[1] = find_executable(argv[0]);
5082240a9a23Smbalmer  if (newargz[1] == NULL)
5083240a9a23Smbalmer    lt_fatal("Couldn't find %s", argv[0]);
5084240a9a23Smbalmer  DEBUG("(main) found exe at : %s\n",newargz[1]);
5085240a9a23Smbalmer  /* we know the script has the same name, without the .exe */
5086240a9a23Smbalmer  /* so make sure newargz[1] doesn't end in .exe */
5087240a9a23Smbalmer  strendzap(newargz[1],".exe");
5088240a9a23Smbalmer  for (i = 1; i < argc; i++)
5089240a9a23Smbalmer    newargz[i+1] = xstrdup(argv[i]);
5090240a9a23Smbalmer  newargz[argc+1] = NULL;
5091240a9a23Smbalmer
5092240a9a23Smbalmer  for (i=0; i<argc+1; i++)
5093240a9a23Smbalmer  {
5094240a9a23Smbalmer    DEBUG("(main) newargz[%d]   : %s\n",i,newargz[i]);
5095240a9a23Smbalmer    ;
5096240a9a23Smbalmer  }
5097240a9a23Smbalmer
5098240a9a23SmbalmerEOF
5099240a9a23Smbalmer
5100240a9a23Smbalmer            case $host_os in
5101240a9a23Smbalmer              mingw*)
5102240a9a23Smbalmer                cat >> $cwrappersource <<EOF
5103240a9a23Smbalmer  execv("$SHELL",(char const **)newargz);
5104240a9a23SmbalmerEOF
5105240a9a23Smbalmer              ;;
5106240a9a23Smbalmer              *)
5107240a9a23Smbalmer                cat >> $cwrappersource <<EOF
5108240a9a23Smbalmer  execv("$SHELL",newargz);
5109240a9a23SmbalmerEOF
5110240a9a23Smbalmer              ;;
5111240a9a23Smbalmer            esac
5112240a9a23Smbalmer
5113240a9a23Smbalmer            cat >> $cwrappersource <<"EOF"
5114240a9a23Smbalmer  return 127;
5115240a9a23Smbalmer}
5116240a9a23Smbalmer
5117240a9a23Smbalmervoid *
5118240a9a23Smbalmerxmalloc (size_t num)
5119240a9a23Smbalmer{
5120240a9a23Smbalmer  void * p = (void *) malloc (num);
5121240a9a23Smbalmer  if (!p)
5122240a9a23Smbalmer    lt_fatal ("Memory exhausted");
5123240a9a23Smbalmer
5124240a9a23Smbalmer  return p;
5125240a9a23Smbalmer}
5126240a9a23Smbalmer
5127240a9a23Smbalmerchar *
5128240a9a23Smbalmerxstrdup (const char *string)
5129240a9a23Smbalmer{
5130240a9a23Smbalmer  return string ? strcpy ((char *) xmalloc (strlen (string) + 1), string) : NULL
5131240a9a23Smbalmer;
5132240a9a23Smbalmer}
5133240a9a23Smbalmer
5134240a9a23Smbalmerconst char *
5135240a9a23Smbalmerbase_name (const char *name)
5136240a9a23Smbalmer{
5137240a9a23Smbalmer  const char *base;
5138240a9a23Smbalmer
5139240a9a23Smbalmer#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
5140240a9a23Smbalmer  /* Skip over the disk name in MSDOS pathnames. */
5141240a9a23Smbalmer  if (isalpha ((unsigned char)name[0]) && name[1] == ':')
5142240a9a23Smbalmer    name += 2;
5143240a9a23Smbalmer#endif
5144240a9a23Smbalmer
5145240a9a23Smbalmer  for (base = name; *name; name++)
5146240a9a23Smbalmer    if (IS_DIR_SEPARATOR (*name))
5147240a9a23Smbalmer      base = name + 1;
5148240a9a23Smbalmer  return base;
5149240a9a23Smbalmer}
5150240a9a23Smbalmer
5151240a9a23Smbalmerint
5152240a9a23Smbalmercheck_executable(const char * path)
5153240a9a23Smbalmer{
5154240a9a23Smbalmer  struct stat st;
5155240a9a23Smbalmer
5156240a9a23Smbalmer  DEBUG("(check_executable)  : %s\n", path ? (*path ? path : "EMPTY!") : "NULL!");
5157240a9a23Smbalmer  if ((!path) || (!*path))
5158240a9a23Smbalmer    return 0;
5159240a9a23Smbalmer
5160240a9a23Smbalmer  if ((stat (path, &st) >= 0) &&
5161240a9a23Smbalmer      (
5162240a9a23Smbalmer        /* MinGW & native WIN32 do not support S_IXOTH or S_IXGRP */
5163240a9a23Smbalmer#if defined (S_IXOTH)
5164240a9a23Smbalmer       ((st.st_mode & S_IXOTH) == S_IXOTH) ||
5165240a9a23Smbalmer#endif
5166240a9a23Smbalmer#if defined (S_IXGRP)
5167240a9a23Smbalmer       ((st.st_mode & S_IXGRP) == S_IXGRP) ||
5168240a9a23Smbalmer#endif
5169240a9a23Smbalmer       ((st.st_mode & S_IXUSR) == S_IXUSR))
5170240a9a23Smbalmer      )
5171240a9a23Smbalmer    return 1;
5172240a9a23Smbalmer  else
5173240a9a23Smbalmer    return 0;
5174240a9a23Smbalmer}
5175240a9a23Smbalmer
5176240a9a23Smbalmer/* Searches for the full path of the wrapper.  Returns
5177240a9a23Smbalmer   newly allocated full path name if found, NULL otherwise */
5178240a9a23Smbalmerchar *
5179240a9a23Smbalmerfind_executable (const char* wrapper)
5180240a9a23Smbalmer{
5181240a9a23Smbalmer  int has_slash = 0;
5182240a9a23Smbalmer  const char* p;
5183240a9a23Smbalmer  const char* p_next;
5184240a9a23Smbalmer  /* static buffer for getcwd */
5185240a9a23Smbalmer  char tmp[LT_PATHMAX + 1];
5186240a9a23Smbalmer  int tmp_len;
5187240a9a23Smbalmer  char* concat_name;
5188240a9a23Smbalmer
5189240a9a23Smbalmer  DEBUG("(find_executable)  : %s\n", wrapper ? (*wrapper ? wrapper : "EMPTY!") : "NULL!");
5190240a9a23Smbalmer
5191240a9a23Smbalmer  if ((wrapper == NULL) || (*wrapper == '\0'))
5192240a9a23Smbalmer    return NULL;
5193240a9a23Smbalmer
5194240a9a23Smbalmer  /* Absolute path? */
5195240a9a23Smbalmer#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
5196240a9a23Smbalmer  if (isalpha ((unsigned char)wrapper[0]) && wrapper[1] == ':')
5197240a9a23Smbalmer  {
5198240a9a23Smbalmer    concat_name = xstrdup (wrapper);
5199240a9a23Smbalmer    if (check_executable(concat_name))
5200240a9a23Smbalmer      return concat_name;
5201240a9a23Smbalmer    XFREE(concat_name);
5202240a9a23Smbalmer  }
5203240a9a23Smbalmer  else
5204240a9a23Smbalmer  {
5205240a9a23Smbalmer#endif
5206240a9a23Smbalmer    if (IS_DIR_SEPARATOR (wrapper[0]))
5207240a9a23Smbalmer    {
5208240a9a23Smbalmer      concat_name = xstrdup (wrapper);
5209240a9a23Smbalmer      if (check_executable(concat_name))
5210240a9a23Smbalmer        return concat_name;
5211240a9a23Smbalmer      XFREE(concat_name);
5212240a9a23Smbalmer    }
5213240a9a23Smbalmer#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
5214240a9a23Smbalmer  }
5215240a9a23Smbalmer#endif
5216240a9a23Smbalmer
5217240a9a23Smbalmer  for (p = wrapper; *p; p++)
5218240a9a23Smbalmer    if (*p == '/')
5219240a9a23Smbalmer    {
5220240a9a23Smbalmer      has_slash = 1;
5221240a9a23Smbalmer      break;
5222240a9a23Smbalmer    }
5223240a9a23Smbalmer  if (!has_slash)
5224240a9a23Smbalmer  {
5225240a9a23Smbalmer    /* no slashes; search PATH */
5226240a9a23Smbalmer    const char* path = getenv ("PATH");
5227240a9a23Smbalmer    if (path != NULL)
5228240a9a23Smbalmer    {
5229240a9a23Smbalmer      for (p = path; *p; p = p_next)
5230240a9a23Smbalmer      {
5231240a9a23Smbalmer        const char* q;
5232240a9a23Smbalmer        size_t p_len;
5233240a9a23Smbalmer        for (q = p; *q; q++)
5234240a9a23Smbalmer          if (IS_PATH_SEPARATOR(*q))
5235240a9a23Smbalmer            break;
5236240a9a23Smbalmer        p_len = q - p;
5237240a9a23Smbalmer        p_next = (*q == '\0' ? q : q + 1);
5238240a9a23Smbalmer        if (p_len == 0)
5239240a9a23Smbalmer        {
5240240a9a23Smbalmer          /* empty path: current directory */
5241240a9a23Smbalmer          if (getcwd (tmp, LT_PATHMAX) == NULL)
5242240a9a23Smbalmer            lt_fatal ("getcwd failed");
5243240a9a23Smbalmer          tmp_len = strlen(tmp);
5244240a9a23Smbalmer          concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1);
5245240a9a23Smbalmer          memcpy (concat_name, tmp, tmp_len);
5246240a9a23Smbalmer          concat_name[tmp_len] = '/';
5247240a9a23Smbalmer          strcpy (concat_name + tmp_len + 1, wrapper);
5248240a9a23Smbalmer        }
5249240a9a23Smbalmer        else
5250240a9a23Smbalmer        {
5251240a9a23Smbalmer          concat_name = XMALLOC(char, p_len + 1 + strlen(wrapper) + 1);
5252240a9a23Smbalmer          memcpy (concat_name, p, p_len);
5253240a9a23Smbalmer          concat_name[p_len] = '/';
5254240a9a23Smbalmer          strcpy (concat_name + p_len + 1, wrapper);
5255240a9a23Smbalmer        }
5256240a9a23Smbalmer        if (check_executable(concat_name))
5257240a9a23Smbalmer          return concat_name;
5258240a9a23Smbalmer        XFREE(concat_name);
5259240a9a23Smbalmer      }
5260240a9a23Smbalmer    }
5261240a9a23Smbalmer    /* not found in PATH; assume curdir */
5262240a9a23Smbalmer  }
5263240a9a23Smbalmer  /* Relative path | not found in path: prepend cwd */
5264240a9a23Smbalmer  if (getcwd (tmp, LT_PATHMAX) == NULL)
5265240a9a23Smbalmer    lt_fatal ("getcwd failed");
5266240a9a23Smbalmer  tmp_len = strlen(tmp);
5267240a9a23Smbalmer  concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1);
5268240a9a23Smbalmer  memcpy (concat_name, tmp, tmp_len);
5269240a9a23Smbalmer  concat_name[tmp_len] = '/';
5270240a9a23Smbalmer  strcpy (concat_name + tmp_len + 1, wrapper);
5271240a9a23Smbalmer
5272240a9a23Smbalmer  if (check_executable(concat_name))
5273240a9a23Smbalmer    return concat_name;
5274240a9a23Smbalmer  XFREE(concat_name);
5275240a9a23Smbalmer  return NULL;
5276240a9a23Smbalmer}
5277240a9a23Smbalmer
5278240a9a23Smbalmerchar *
5279240a9a23Smbalmerstrendzap(char *str, const char *pat)
5280240a9a23Smbalmer{
5281240a9a23Smbalmer  size_t len, patlen;
5282240a9a23Smbalmer
5283240a9a23Smbalmer  assert(str != NULL);
5284240a9a23Smbalmer  assert(pat != NULL);
5285240a9a23Smbalmer
5286240a9a23Smbalmer  len = strlen(str);
5287240a9a23Smbalmer  patlen = strlen(pat);
5288240a9a23Smbalmer
5289240a9a23Smbalmer  if (patlen <= len)
5290240a9a23Smbalmer  {
5291240a9a23Smbalmer    str += len - patlen;
5292240a9a23Smbalmer    if (strcmp(str, pat) == 0)
5293240a9a23Smbalmer      *str = '\0';
5294240a9a23Smbalmer  }
5295240a9a23Smbalmer  return str;
5296240a9a23Smbalmer}
5297240a9a23Smbalmer
5298240a9a23Smbalmerstatic void
5299240a9a23Smbalmerlt_error_core (int exit_status, const char * mode,
5300240a9a23Smbalmer          const char * message, va_list ap)
5301240a9a23Smbalmer{
5302240a9a23Smbalmer  fprintf (stderr, "%s: %s: ", program_name, mode);
5303240a9a23Smbalmer  vfprintf (stderr, message, ap);
5304240a9a23Smbalmer  fprintf (stderr, ".\n");
5305240a9a23Smbalmer
5306240a9a23Smbalmer  if (exit_status >= 0)
5307240a9a23Smbalmer    exit (exit_status);
5308240a9a23Smbalmer}
5309240a9a23Smbalmer
5310240a9a23Smbalmervoid
5311240a9a23Smbalmerlt_fatal (const char *message, ...)
5312240a9a23Smbalmer{
5313240a9a23Smbalmer  va_list ap;
5314240a9a23Smbalmer  va_start (ap, message);
5315240a9a23Smbalmer  lt_error_core (EXIT_FAILURE, "FATAL", message, ap);
5316240a9a23Smbalmer  va_end (ap);
5317240a9a23Smbalmer}
5318240a9a23SmbalmerEOF
5319240a9a23Smbalmer          # we should really use a build-platform specific compiler
5320240a9a23Smbalmer          # here, but OTOH, the wrappers (shell script and this C one)
5321240a9a23Smbalmer          # are only useful if you want to execute the "real" binary.
5322240a9a23Smbalmer          # Since the "real" binary is built for $host, then this
5323240a9a23Smbalmer          # wrapper might as well be built for $host, too.
5324240a9a23Smbalmer          $run $LTCC $LTCFLAGS -s -o $cwrapper $cwrappersource
5325240a9a23Smbalmer          ;;
5326240a9a23Smbalmer        esac
5327240a9a23Smbalmer        $rm $output
5328240a9a23Smbalmer        trap "$rm $output; exit $EXIT_FAILURE" 1 2 15
5329240a9a23Smbalmer
5330240a9a23Smbalmer	$echo > $output "\
5331240a9a23Smbalmer#! $SHELL
5332240a9a23Smbalmer
5333240a9a23Smbalmer# $output - temporary wrapper script for $objdir/$outputname
5334240a9a23Smbalmer# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
5335240a9a23Smbalmer#
5336240a9a23Smbalmer# The $output program cannot be directly executed until all the libtool
5337240a9a23Smbalmer# libraries that it depends on are installed.
5338240a9a23Smbalmer#
5339240a9a23Smbalmer# This wrapper script should never be moved out of the build directory.
5340240a9a23Smbalmer# If it is, it will not operate correctly.
5341240a9a23Smbalmer
5342240a9a23Smbalmer# Sed substitution that helps us do robust quoting.  It backslashifies
5343240a9a23Smbalmer# metacharacters that are still active within double-quoted strings.
5344240a9a23SmbalmerXsed='${SED} -e 1s/^X//'
5345240a9a23Smbalmersed_quote_subst='$sed_quote_subst'
5346240a9a23Smbalmer
5347240a9a23Smbalmer# Be Bourne compatible (taken from Autoconf:_AS_BOURNE_COMPATIBLE).
5348240a9a23Smbalmerif test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then
5349240a9a23Smbalmer  emulate sh
5350240a9a23Smbalmer  NULLCMD=:
5351240a9a23Smbalmer  # Zsh 3.x and 4.x performs word splitting on \${1+\"\$@\"}, which
5352240a9a23Smbalmer  # is contrary to our usage.  Disable this feature.
5353240a9a23Smbalmer  alias -g '\${1+\"\$@\"}'='\"\$@\"'
5354240a9a23Smbalmer  setopt NO_GLOB_SUBST
5355240a9a23Smbalmerelse
5356240a9a23Smbalmer  case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac
5357240a9a23Smbalmerfi
5358240a9a23SmbalmerBIN_SH=xpg4; export BIN_SH # for Tru64
5359240a9a23SmbalmerDUALCASE=1; export DUALCASE # for MKS sh
5360240a9a23Smbalmer
5361240a9a23Smbalmer# The HP-UX ksh and POSIX shell print the target directory to stdout
5362240a9a23Smbalmer# if CDPATH is set.
5363240a9a23Smbalmer(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
5364240a9a23Smbalmer
5365240a9a23Smbalmerrelink_command=\"$relink_command\"
5366240a9a23Smbalmer
5367240a9a23Smbalmer# This environment variable determines our operation mode.
5368240a9a23Smbalmerif test \"\$libtool_install_magic\" = \"$magic\"; then
5369240a9a23Smbalmer  # install mode needs the following variable:
5370240a9a23Smbalmer  notinst_deplibs='$notinst_deplibs'
5371240a9a23Smbalmerelse
5372240a9a23Smbalmer  # When we are sourced in execute mode, \$file and \$echo are already set.
5373240a9a23Smbalmer  if test \"\$libtool_execute_magic\" != \"$magic\"; then
5374240a9a23Smbalmer    echo=\"$qecho\"
5375240a9a23Smbalmer    file=\"\$0\"
5376240a9a23Smbalmer    # Make sure echo works.
5377240a9a23Smbalmer    if test \"X\$1\" = X--no-reexec; then
5378240a9a23Smbalmer      # Discard the --no-reexec flag, and continue.
5379240a9a23Smbalmer      shift
5380240a9a23Smbalmer    elif test \"X\`(\$echo '\t') 2>/dev/null\`\" = 'X\t'; then
5381240a9a23Smbalmer      # Yippee, \$echo works!
5382240a9a23Smbalmer      :
5383240a9a23Smbalmer    else
5384240a9a23Smbalmer      # Restart under the correct shell, and then maybe \$echo will work.
5385240a9a23Smbalmer      exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"}
5386240a9a23Smbalmer    fi
5387240a9a23Smbalmer  fi\
5388240a9a23Smbalmer"
5389240a9a23Smbalmer	$echo >> $output "\
5390240a9a23Smbalmer
5391240a9a23Smbalmer  # Find the directory that this script lives in.
5392240a9a23Smbalmer  thisdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\`
5393240a9a23Smbalmer  test \"x\$thisdir\" = \"x\$file\" && thisdir=.
5394240a9a23Smbalmer
5395240a9a23Smbalmer  # Follow symbolic links until we get to the real thisdir.
5396240a9a23Smbalmer  file=\`ls -ld \"\$file\" | ${SED} -n 's/.*-> //p'\`
5397240a9a23Smbalmer  while test -n \"\$file\"; do
5398240a9a23Smbalmer    destdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\`
5399240a9a23Smbalmer
5400240a9a23Smbalmer    # If there was a directory component, then change thisdir.
5401240a9a23Smbalmer    if test \"x\$destdir\" != \"x\$file\"; then
5402240a9a23Smbalmer      case \"\$destdir\" in
5403240a9a23Smbalmer      [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;;
5404240a9a23Smbalmer      *) thisdir=\"\$thisdir/\$destdir\" ;;
5405240a9a23Smbalmer      esac
5406240a9a23Smbalmer    fi
5407240a9a23Smbalmer
5408240a9a23Smbalmer    file=\`\$echo \"X\$file\" | \$Xsed -e 's%^.*/%%'\`
5409240a9a23Smbalmer    file=\`ls -ld \"\$thisdir/\$file\" | ${SED} -n 's/.*-> //p'\`
5410240a9a23Smbalmer  done
5411240a9a23Smbalmer
5412240a9a23Smbalmer  # Try to get the absolute directory name.
5413240a9a23Smbalmer  absdir=\`cd \"\$thisdir\" && pwd\`
5414240a9a23Smbalmer  test -n \"\$absdir\" && thisdir=\"\$absdir\"
5415240a9a23Smbalmer"
5416240a9a23Smbalmer
5417240a9a23Smbalmer	if test "$fast_install" = yes; then
5418240a9a23Smbalmer	  $echo >> $output "\
5419240a9a23Smbalmer  program=lt-'$outputname'$exeext
5420240a9a23Smbalmer  progdir=\"\$thisdir/$objdir\"
5421240a9a23Smbalmer
5422240a9a23Smbalmer  if test ! -f \"\$progdir/\$program\" || \\
5423240a9a23Smbalmer     { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\
5424240a9a23Smbalmer       test \"X\$file\" != \"X\$progdir/\$program\"; }; then
5425240a9a23Smbalmer
5426240a9a23Smbalmer    file=\"\$\$-\$program\"
5427240a9a23Smbalmer
5428240a9a23Smbalmer    if test ! -d \"\$progdir\"; then
5429240a9a23Smbalmer      $mkdir \"\$progdir\"
5430240a9a23Smbalmer    else
5431240a9a23Smbalmer      $rm \"\$progdir/\$file\"
5432240a9a23Smbalmer    fi"
5433240a9a23Smbalmer
5434240a9a23Smbalmer	  $echo >> $output "\
5435240a9a23Smbalmer
5436240a9a23Smbalmer    # relink executable if necessary
5437240a9a23Smbalmer    if test -n \"\$relink_command\"; then
5438240a9a23Smbalmer      if relink_command_output=\`eval \$relink_command 2>&1\`; then :
5439240a9a23Smbalmer      else
5440240a9a23Smbalmer	$echo \"\$relink_command_output\" >&2
5441240a9a23Smbalmer	$rm \"\$progdir/\$file\"
5442240a9a23Smbalmer	exit $EXIT_FAILURE
5443240a9a23Smbalmer      fi
5444240a9a23Smbalmer    fi
5445240a9a23Smbalmer
5446240a9a23Smbalmer    $mv \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null ||
5447240a9a23Smbalmer    { $rm \"\$progdir/\$program\";
5448240a9a23Smbalmer      $mv \"\$progdir/\$file\" \"\$progdir/\$program\"; }
5449240a9a23Smbalmer    $rm \"\$progdir/\$file\"
5450240a9a23Smbalmer  fi"
5451240a9a23Smbalmer	else
5452240a9a23Smbalmer	  $echo >> $output "\
5453240a9a23Smbalmer  program='$outputname'
5454240a9a23Smbalmer  progdir=\"\$thisdir/$objdir\"
5455240a9a23Smbalmer"
5456240a9a23Smbalmer	fi
5457240a9a23Smbalmer
5458240a9a23Smbalmer	$echo >> $output "\
5459240a9a23Smbalmer
5460240a9a23Smbalmer  if test -f \"\$progdir/\$program\"; then"
5461240a9a23Smbalmer
5462240a9a23Smbalmer	# Export our shlibpath_var if we have one.
5463240a9a23Smbalmer	if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
5464240a9a23Smbalmer	  $echo >> $output "\
5465240a9a23Smbalmer    # Add our own library path to $shlibpath_var
5466240a9a23Smbalmer    $shlibpath_var=\"$temp_rpath\$$shlibpath_var\"
5467240a9a23Smbalmer
5468240a9a23Smbalmer    # Some systems cannot cope with colon-terminated $shlibpath_var
5469240a9a23Smbalmer    # The second colon is a workaround for a bug in BeOS R4 sed
5470240a9a23Smbalmer    $shlibpath_var=\`\$echo \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\`
5471240a9a23Smbalmer
5472240a9a23Smbalmer    export $shlibpath_var
5473240a9a23Smbalmer"
5474240a9a23Smbalmer	fi
5475240a9a23Smbalmer
5476240a9a23Smbalmer	# fixup the dll searchpath if we need to.
5477240a9a23Smbalmer	if test -n "$dllsearchpath"; then
5478240a9a23Smbalmer	  $echo >> $output "\
5479240a9a23Smbalmer    # Add the dll search path components to the executable PATH
5480240a9a23Smbalmer    PATH=$dllsearchpath:\$PATH
5481240a9a23Smbalmer"
5482240a9a23Smbalmer	fi
5483240a9a23Smbalmer
5484240a9a23Smbalmer	$echo >> $output "\
5485240a9a23Smbalmer    if test \"\$libtool_execute_magic\" != \"$magic\"; then
5486240a9a23Smbalmer      # Run the actual program with our arguments.
5487240a9a23Smbalmer"
5488240a9a23Smbalmer	case $host in
5489240a9a23Smbalmer	# Backslashes separate directories on plain windows
5490240a9a23Smbalmer	*-*-mingw | *-*-os2*)
5491240a9a23Smbalmer	  $echo >> $output "\
5492240a9a23Smbalmer      exec \"\$progdir\\\\\$program\" \${1+\"\$@\"}
5493240a9a23Smbalmer"
5494240a9a23Smbalmer	  ;;
5495240a9a23Smbalmer
5496240a9a23Smbalmer	*)
5497240a9a23Smbalmer	  $echo >> $output "\
5498240a9a23Smbalmer      exec \"\$progdir/\$program\" \${1+\"\$@\"}
5499240a9a23Smbalmer"
5500240a9a23Smbalmer	  ;;
5501240a9a23Smbalmer	esac
5502240a9a23Smbalmer	$echo >> $output "\
5503240a9a23Smbalmer      \$echo \"\$0: cannot exec \$program \$*\"
5504240a9a23Smbalmer      exit $EXIT_FAILURE
5505240a9a23Smbalmer    fi
5506240a9a23Smbalmer  else
5507240a9a23Smbalmer    # The program doesn't exist.
5508240a9a23Smbalmer    \$echo \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2
5509240a9a23Smbalmer    \$echo \"This script is just a wrapper for \$program.\" 1>&2
5510240a9a23Smbalmer    $echo \"See the $PACKAGE documentation for more information.\" 1>&2
5511240a9a23Smbalmer    exit $EXIT_FAILURE
5512240a9a23Smbalmer  fi
5513240a9a23Smbalmerfi\
5514240a9a23Smbalmer"
5515240a9a23Smbalmer	chmod +x $output
5516240a9a23Smbalmer      fi
5517240a9a23Smbalmer      exit $EXIT_SUCCESS
5518240a9a23Smbalmer      ;;
5519240a9a23Smbalmer    esac
5520240a9a23Smbalmer
5521240a9a23Smbalmer    # See if we need to build an old-fashioned archive.
5522240a9a23Smbalmer    for oldlib in $oldlibs; do
5523240a9a23Smbalmer
5524240a9a23Smbalmer      if test "$build_libtool_libs" = convenience; then
5525240a9a23Smbalmer	oldobjs="$libobjs_save"
5526240a9a23Smbalmer	addlibs="$convenience"
5527240a9a23Smbalmer	build_libtool_libs=no
5528240a9a23Smbalmer      else
5529240a9a23Smbalmer	if test "$build_libtool_libs" = module; then
5530240a9a23Smbalmer	  oldobjs="$libobjs_save"
5531240a9a23Smbalmer	  build_libtool_libs=no
5532240a9a23Smbalmer	else
5533240a9a23Smbalmer	  oldobjs="$old_deplibs $non_pic_objects"
5534240a9a23Smbalmer	fi
5535240a9a23Smbalmer	addlibs="$old_convenience"
5536240a9a23Smbalmer      fi
5537240a9a23Smbalmer
5538240a9a23Smbalmer      if test -n "$addlibs"; then
5539240a9a23Smbalmer	gentop="$output_objdir/${outputname}x"
5540240a9a23Smbalmer	generated="$generated $gentop"
5541240a9a23Smbalmer
5542240a9a23Smbalmer	func_extract_archives $gentop $addlibs
5543240a9a23Smbalmer	oldobjs="$oldobjs $func_extract_archives_result"
5544240a9a23Smbalmer      fi
5545240a9a23Smbalmer
5546240a9a23Smbalmer      # Do each command in the archive commands.
5547240a9a23Smbalmer      if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then
5548240a9a23Smbalmer       cmds=$old_archive_from_new_cmds
5549240a9a23Smbalmer      else
5550240a9a23Smbalmer	# POSIX demands no paths to be encoded in archives.  We have
5551240a9a23Smbalmer	# to avoid creating archives with duplicate basenames if we
5552240a9a23Smbalmer	# might have to extract them afterwards, e.g., when creating a
5553240a9a23Smbalmer	# static archive out of a convenience library, or when linking
5554240a9a23Smbalmer	# the entirety of a libtool archive into another (currently
5555240a9a23Smbalmer	# not supported by libtool).
5556240a9a23Smbalmer	if (for obj in $oldobjs
5557240a9a23Smbalmer	    do
5558240a9a23Smbalmer	      $echo "X$obj" | $Xsed -e 's%^.*/%%'
5559240a9a23Smbalmer	    done | sort | sort -uc >/dev/null 2>&1); then
5560240a9a23Smbalmer	  :
5561240a9a23Smbalmer	else
5562240a9a23Smbalmer	  $echo "copying selected object files to avoid basename conflicts..."
5563240a9a23Smbalmer
5564240a9a23Smbalmer	  if test -z "$gentop"; then
5565240a9a23Smbalmer	    gentop="$output_objdir/${outputname}x"
5566240a9a23Smbalmer	    generated="$generated $gentop"
5567240a9a23Smbalmer
5568240a9a23Smbalmer	    $show "${rm}r $gentop"
5569240a9a23Smbalmer	    $run ${rm}r "$gentop"
5570240a9a23Smbalmer	    $show "$mkdir $gentop"
5571240a9a23Smbalmer	    $run $mkdir "$gentop"
5572240a9a23Smbalmer	    exit_status=$?
5573240a9a23Smbalmer	    if test "$exit_status" -ne 0 && test ! -d "$gentop"; then
5574240a9a23Smbalmer	      exit $exit_status
5575240a9a23Smbalmer	    fi
5576240a9a23Smbalmer	  fi
5577240a9a23Smbalmer
5578240a9a23Smbalmer	  save_oldobjs=$oldobjs
5579240a9a23Smbalmer	  oldobjs=
5580240a9a23Smbalmer	  counter=1
5581240a9a23Smbalmer	  for obj in $save_oldobjs
5582240a9a23Smbalmer	  do
5583240a9a23Smbalmer	    objbase=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
5584240a9a23Smbalmer	    case " $oldobjs " in
5585240a9a23Smbalmer	    " ") oldobjs=$obj ;;
5586240a9a23Smbalmer	    *[\ /]"$objbase "*)
5587240a9a23Smbalmer	      while :; do
5588240a9a23Smbalmer		# Make sure we don't pick an alternate name that also
5589240a9a23Smbalmer		# overlaps.
5590240a9a23Smbalmer		newobj=lt$counter-$objbase
5591240a9a23Smbalmer		counter=`expr $counter + 1`
5592240a9a23Smbalmer		case " $oldobjs " in
5593240a9a23Smbalmer		*[\ /]"$newobj "*) ;;
5594240a9a23Smbalmer		*) if test ! -f "$gentop/$newobj"; then break; fi ;;
5595240a9a23Smbalmer		esac
5596240a9a23Smbalmer	      done
5597240a9a23Smbalmer	      $show "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj"
5598240a9a23Smbalmer	      $run ln "$obj" "$gentop/$newobj" ||
5599240a9a23Smbalmer	      $run cp "$obj" "$gentop/$newobj"
5600240a9a23Smbalmer	      oldobjs="$oldobjs $gentop/$newobj"
5601240a9a23Smbalmer	      ;;
5602240a9a23Smbalmer	    *) oldobjs="$oldobjs $obj" ;;
5603240a9a23Smbalmer	    esac
5604240a9a23Smbalmer	  done
5605240a9a23Smbalmer	fi
5606240a9a23Smbalmer
5607240a9a23Smbalmer	eval cmds=\"$old_archive_cmds\"
5608240a9a23Smbalmer
5609240a9a23Smbalmer	if len=`expr "X$cmds" : ".*"` &&
5610240a9a23Smbalmer	     test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
5611240a9a23Smbalmer	  cmds=$old_archive_cmds
5612240a9a23Smbalmer	else
5613240a9a23Smbalmer	  # the command line is too long to link in one step, link in parts
5614240a9a23Smbalmer	  $echo "using piecewise archive linking..."
5615240a9a23Smbalmer	  save_RANLIB=$RANLIB
5616240a9a23Smbalmer	  RANLIB=:
5617240a9a23Smbalmer	  objlist=
5618240a9a23Smbalmer	  concat_cmds=
5619240a9a23Smbalmer	  save_oldobjs=$oldobjs
5620240a9a23Smbalmer
5621240a9a23Smbalmer	  # Is there a better way of finding the last object in the list?
5622240a9a23Smbalmer	  for obj in $save_oldobjs
5623240a9a23Smbalmer	  do
5624240a9a23Smbalmer	    last_oldobj=$obj
5625240a9a23Smbalmer	  done
5626240a9a23Smbalmer	  for obj in $save_oldobjs
5627240a9a23Smbalmer	  do
5628240a9a23Smbalmer	    oldobjs="$objlist $obj"
5629240a9a23Smbalmer	    objlist="$objlist $obj"
5630240a9a23Smbalmer	    eval test_cmds=\"$old_archive_cmds\"
5631240a9a23Smbalmer	    if len=`expr "X$test_cmds" : ".*" 2>/dev/null` &&
5632240a9a23Smbalmer	       test "$len" -le "$max_cmd_len"; then
5633240a9a23Smbalmer	      :
5634240a9a23Smbalmer	    else
5635240a9a23Smbalmer	      # the above command should be used before it gets too long
5636240a9a23Smbalmer	      oldobjs=$objlist
5637240a9a23Smbalmer	      if test "$obj" = "$last_oldobj" ; then
5638240a9a23Smbalmer	        RANLIB=$save_RANLIB
5639240a9a23Smbalmer	      fi
5640240a9a23Smbalmer	      test -z "$concat_cmds" || concat_cmds=$concat_cmds~
5641240a9a23Smbalmer	      eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\"
5642240a9a23Smbalmer	      objlist=
5643240a9a23Smbalmer	    fi
5644240a9a23Smbalmer	  done
5645240a9a23Smbalmer	  RANLIB=$save_RANLIB
5646240a9a23Smbalmer	  oldobjs=$objlist
5647240a9a23Smbalmer	  if test "X$oldobjs" = "X" ; then
5648240a9a23Smbalmer	    eval cmds=\"\$concat_cmds\"
5649240a9a23Smbalmer	  else
5650240a9a23Smbalmer	    eval cmds=\"\$concat_cmds~\$old_archive_cmds\"
5651240a9a23Smbalmer	  fi
5652240a9a23Smbalmer	fi
5653240a9a23Smbalmer      fi
5654240a9a23Smbalmer      save_ifs="$IFS"; IFS='~'
5655240a9a23Smbalmer      for cmd in $cmds; do
5656240a9a23Smbalmer        eval cmd=\"$cmd\"
5657240a9a23Smbalmer	IFS="$save_ifs"
5658240a9a23Smbalmer	$show "$cmd"
5659240a9a23Smbalmer	$run eval "$cmd" || exit $?
5660240a9a23Smbalmer      done
5661240a9a23Smbalmer      IFS="$save_ifs"
5662240a9a23Smbalmer    done
5663240a9a23Smbalmer
5664240a9a23Smbalmer    if test -n "$generated"; then
5665240a9a23Smbalmer      $show "${rm}r$generated"
5666240a9a23Smbalmer      $run ${rm}r$generated
5667240a9a23Smbalmer    fi
5668240a9a23Smbalmer
5669240a9a23Smbalmer    # Now create the libtool archive.
5670240a9a23Smbalmer    case $output in
5671240a9a23Smbalmer    *.la)
5672240a9a23Smbalmer      old_library=
5673240a9a23Smbalmer      test "$build_old_libs" = yes && old_library="$libname.$libext"
5674240a9a23Smbalmer      $show "creating $output"
5675240a9a23Smbalmer
5676240a9a23Smbalmer      # Preserve any variables that may affect compiler behavior
5677240a9a23Smbalmer      for var in $variables_saved_for_relink; do
5678240a9a23Smbalmer	if eval test -z \"\${$var+set}\"; then
5679240a9a23Smbalmer	  relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command"
5680240a9a23Smbalmer	elif eval var_value=\$$var; test -z "$var_value"; then
5681240a9a23Smbalmer	  relink_command="$var=; export $var; $relink_command"
5682240a9a23Smbalmer	else
5683240a9a23Smbalmer	  var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"`
5684240a9a23Smbalmer	  relink_command="$var=\"$var_value\"; export $var; $relink_command"
5685240a9a23Smbalmer	fi
5686240a9a23Smbalmer      done
5687240a9a23Smbalmer      # Quote the link command for shipping.
5688240a9a23Smbalmer      relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)"
5689240a9a23Smbalmer      relink_command=`$echo "X$relink_command" | $SP2NL | $Xsed -e "$sed_quote_subst" | $NL2SP`
5690240a9a23Smbalmer      if test "$hardcode_automatic" = yes ; then
5691240a9a23Smbalmer	relink_command=
5692240a9a23Smbalmer      fi
5693240a9a23Smbalmer
5694240a9a23Smbalmer
5695240a9a23Smbalmer      # Only create the output if not a dry run.
5696240a9a23Smbalmer      if test -z "$run"; then
5697240a9a23Smbalmer	for installed in no yes; do
5698240a9a23Smbalmer	  if test "$installed" = yes; then
5699240a9a23Smbalmer	    if test -z "$install_libdir"; then
5700240a9a23Smbalmer	      break
5701240a9a23Smbalmer	    fi
5702240a9a23Smbalmer	    output="$output_objdir/$outputname"i
5703240a9a23Smbalmer	    # Replace all uninstalled libtool libraries with the installed ones
5704240a9a23Smbalmer	    newdependency_libs=
5705240a9a23Smbalmer	    for deplib in $dependency_libs; do
5706240a9a23Smbalmer	      case $deplib in
5707240a9a23Smbalmer	      *.la)
5708240a9a23Smbalmer		name=`$echo "X$deplib" | $Xsed -e 's%^.*/%%'`
5709240a9a23Smbalmer		eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
5710240a9a23Smbalmer		if test -z "$libdir"; then
5711240a9a23Smbalmer		  $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
5712240a9a23Smbalmer		  exit $EXIT_FAILURE
5713240a9a23Smbalmer		fi
5714240a9a23Smbalmer		newdependency_libs="$newdependency_libs $libdir/$name"
5715240a9a23Smbalmer		;;
5716240a9a23Smbalmer	      *) newdependency_libs="$newdependency_libs $deplib" ;;
5717240a9a23Smbalmer	      esac
5718240a9a23Smbalmer	    done
5719240a9a23Smbalmer	    dependency_libs="$newdependency_libs"
5720240a9a23Smbalmer	    newdlfiles=
5721240a9a23Smbalmer	    for lib in $dlfiles; do
5722240a9a23Smbalmer	      name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
5723240a9a23Smbalmer	      eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
5724240a9a23Smbalmer	      if test -z "$libdir"; then
5725240a9a23Smbalmer		$echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
5726240a9a23Smbalmer		exit $EXIT_FAILURE
5727240a9a23Smbalmer	      fi
5728240a9a23Smbalmer	      newdlfiles="$newdlfiles $libdir/$name"
5729240a9a23Smbalmer	    done
5730240a9a23Smbalmer	    dlfiles="$newdlfiles"
5731240a9a23Smbalmer	    newdlprefiles=
5732240a9a23Smbalmer	    for lib in $dlprefiles; do
5733240a9a23Smbalmer	      name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
5734240a9a23Smbalmer	      eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
5735240a9a23Smbalmer	      if test -z "$libdir"; then
5736240a9a23Smbalmer		$echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
5737240a9a23Smbalmer		exit $EXIT_FAILURE
5738240a9a23Smbalmer	      fi
5739240a9a23Smbalmer	      newdlprefiles="$newdlprefiles $libdir/$name"
5740240a9a23Smbalmer	    done
5741240a9a23Smbalmer	    dlprefiles="$newdlprefiles"
5742240a9a23Smbalmer	  else
5743240a9a23Smbalmer	    newdlfiles=
5744240a9a23Smbalmer	    for lib in $dlfiles; do
5745240a9a23Smbalmer	      case $lib in
5746240a9a23Smbalmer		[\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
5747240a9a23Smbalmer		*) abs=`pwd`"/$lib" ;;
5748240a9a23Smbalmer	      esac
5749240a9a23Smbalmer	      newdlfiles="$newdlfiles $abs"
5750240a9a23Smbalmer	    done
5751240a9a23Smbalmer	    dlfiles="$newdlfiles"
5752240a9a23Smbalmer	    newdlprefiles=
5753240a9a23Smbalmer	    for lib in $dlprefiles; do
5754240a9a23Smbalmer	      case $lib in
5755240a9a23Smbalmer		[\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
5756240a9a23Smbalmer		*) abs=`pwd`"/$lib" ;;
5757240a9a23Smbalmer	      esac
5758240a9a23Smbalmer	      newdlprefiles="$newdlprefiles $abs"
5759240a9a23Smbalmer	    done
5760240a9a23Smbalmer	    dlprefiles="$newdlprefiles"
5761240a9a23Smbalmer	  fi
5762240a9a23Smbalmer	  $rm $output
5763240a9a23Smbalmer	  # place dlname in correct position for cygwin
5764240a9a23Smbalmer	  tdlname=$dlname
5765240a9a23Smbalmer	  case $host,$output,$installed,$module,$dlname in
5766240a9a23Smbalmer	    *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;;
5767240a9a23Smbalmer	  esac
5768240a9a23Smbalmer	  $echo > $output "\
5769240a9a23Smbalmer# $outputname - a libtool library file
5770240a9a23Smbalmer# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
5771240a9a23Smbalmer#
5772240a9a23Smbalmer# Please DO NOT delete this file!
5773240a9a23Smbalmer# It is necessary for linking the library.
5774240a9a23Smbalmer
5775240a9a23Smbalmer# The name that we can dlopen(3).
5776240a9a23Smbalmerdlname='$tdlname'
5777240a9a23Smbalmer
5778240a9a23Smbalmer# Names of this library.
5779240a9a23Smbalmerlibrary_names='$library_names'
5780240a9a23Smbalmer
5781240a9a23Smbalmer# The name of the static archive.
5782240a9a23Smbalmerold_library='$old_library'
5783240a9a23Smbalmer
5784240a9a23Smbalmer# Libraries that this one depends upon.
5785240a9a23Smbalmerdependency_libs='$dependency_libs'
5786240a9a23Smbalmer
5787240a9a23Smbalmer# Version information for $libname.
5788240a9a23Smbalmercurrent=$current
5789240a9a23Smbalmerage=$age
5790240a9a23Smbalmerrevision=$revision
5791240a9a23Smbalmer
5792240a9a23Smbalmer# Is this an already installed library?
5793240a9a23Smbalmerinstalled=$installed
5794240a9a23Smbalmer
5795240a9a23Smbalmer# Should we warn about portability when linking against -modules?
5796240a9a23Smbalmershouldnotlink=$module
5797240a9a23Smbalmer
5798240a9a23Smbalmer# Files to dlopen/dlpreopen
5799240a9a23Smbalmerdlopen='$dlfiles'
5800240a9a23Smbalmerdlpreopen='$dlprefiles'
5801240a9a23Smbalmer
5802240a9a23Smbalmer# Directory that this library needs to be installed in:
5803240a9a23Smbalmerlibdir='$install_libdir'"
5804240a9a23Smbalmer	  if test "$installed" = no && test "$need_relink" = yes; then
5805240a9a23Smbalmer	    $echo >> $output "\
5806240a9a23Smbalmerrelink_command=\"$relink_command\""
5807240a9a23Smbalmer	  fi
5808240a9a23Smbalmer	done
5809240a9a23Smbalmer      fi
5810240a9a23Smbalmer
5811240a9a23Smbalmer      # Do a symbolic link so that the libtool archive can be found in
5812240a9a23Smbalmer      # LD_LIBRARY_PATH before the program is installed.
5813240a9a23Smbalmer      $show "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)"
5814240a9a23Smbalmer      $run eval '(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)' || exit $?
5815240a9a23Smbalmer      ;;
5816240a9a23Smbalmer    esac
5817240a9a23Smbalmer    exit $EXIT_SUCCESS
5818240a9a23Smbalmer    ;;
5819240a9a23Smbalmer
5820240a9a23Smbalmer  # libtool install mode
5821240a9a23Smbalmer  install)
5822240a9a23Smbalmer    modename="$modename: install"
5823240a9a23Smbalmer
5824240a9a23Smbalmer    # There may be an optional sh(1) argument at the beginning of
5825240a9a23Smbalmer    # install_prog (especially on Windows NT).
5826240a9a23Smbalmer    if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh ||
5827240a9a23Smbalmer       # Allow the use of GNU shtool's install command.
5828240a9a23Smbalmer       $echo "X$nonopt" | grep shtool > /dev/null; then
5829240a9a23Smbalmer      # Aesthetically quote it.
5830240a9a23Smbalmer      arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"`
5831240a9a23Smbalmer      case $arg in
5832240a9a23Smbalmer      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
5833240a9a23Smbalmer	arg="\"$arg\""
5834240a9a23Smbalmer	;;
5835240a9a23Smbalmer      esac
5836240a9a23Smbalmer      install_prog="$arg "
5837240a9a23Smbalmer      arg="$1"
5838240a9a23Smbalmer      shift
5839240a9a23Smbalmer    else
5840240a9a23Smbalmer      install_prog=
5841240a9a23Smbalmer      arg=$nonopt
5842240a9a23Smbalmer    fi
5843240a9a23Smbalmer
5844240a9a23Smbalmer    # The real first argument should be the name of the installation program.
5845240a9a23Smbalmer    # Aesthetically quote it.
5846240a9a23Smbalmer    arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
5847240a9a23Smbalmer    case $arg in
5848240a9a23Smbalmer    *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
5849240a9a23Smbalmer      arg="\"$arg\""
5850240a9a23Smbalmer      ;;
5851240a9a23Smbalmer    esac
5852240a9a23Smbalmer    install_prog="$install_prog$arg"
5853240a9a23Smbalmer
5854240a9a23Smbalmer    # We need to accept at least all the BSD install flags.
5855240a9a23Smbalmer    dest=
5856240a9a23Smbalmer    files=
5857240a9a23Smbalmer    opts=
5858240a9a23Smbalmer    prev=
5859240a9a23Smbalmer    install_type=
5860240a9a23Smbalmer    isdir=no
5861240a9a23Smbalmer    stripme=
5862240a9a23Smbalmer    for arg
5863240a9a23Smbalmer    do
5864240a9a23Smbalmer      if test -n "$dest"; then
5865240a9a23Smbalmer	files="$files $dest"
5866240a9a23Smbalmer	dest=$arg
5867240a9a23Smbalmer	continue
5868240a9a23Smbalmer      fi
5869240a9a23Smbalmer
5870240a9a23Smbalmer      case $arg in
5871240a9a23Smbalmer      -d) isdir=yes ;;
5872240a9a23Smbalmer      -f) 
5873240a9a23Smbalmer      	case " $install_prog " in
5874240a9a23Smbalmer	*[\\\ /]cp\ *) ;;
5875240a9a23Smbalmer	*) prev=$arg ;;
5876240a9a23Smbalmer	esac
5877240a9a23Smbalmer	;;
5878240a9a23Smbalmer      -g | -m | -o) prev=$arg ;;
5879240a9a23Smbalmer      -s)
5880240a9a23Smbalmer	stripme=" -s"
5881240a9a23Smbalmer	continue
5882240a9a23Smbalmer	;;
5883240a9a23Smbalmer      -*)
5884240a9a23Smbalmer	;;
5885240a9a23Smbalmer      *)
5886240a9a23Smbalmer	# If the previous option needed an argument, then skip it.
5887240a9a23Smbalmer	if test -n "$prev"; then
5888240a9a23Smbalmer	  prev=
5889240a9a23Smbalmer	else
5890240a9a23Smbalmer	  dest=$arg
5891240a9a23Smbalmer	  continue
5892240a9a23Smbalmer	fi
5893240a9a23Smbalmer	;;
5894240a9a23Smbalmer      esac
5895240a9a23Smbalmer
5896240a9a23Smbalmer      # Aesthetically quote the argument.
5897240a9a23Smbalmer      arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
5898240a9a23Smbalmer      case $arg in
5899240a9a23Smbalmer      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
5900240a9a23Smbalmer	arg="\"$arg\""
5901240a9a23Smbalmer	;;
5902240a9a23Smbalmer      esac
5903240a9a23Smbalmer      install_prog="$install_prog $arg"
5904240a9a23Smbalmer    done
5905240a9a23Smbalmer    case " $install_prog " in
5906240a9a23Smbalmer    *[\\\ /]cp\ *) extra_mode=;;
5907240a9a23Smbalmer    *) extra_mode='-m 644';;
5908240a9a23Smbalmer    esac
5909240a9a23Smbalmer
5910240a9a23Smbalmer    if test -z "$install_prog"; then
5911240a9a23Smbalmer      $echo "$modename: you must specify an install program" 1>&2
5912240a9a23Smbalmer      $echo "$help" 1>&2
5913240a9a23Smbalmer      exit $EXIT_FAILURE
5914240a9a23Smbalmer    fi
5915240a9a23Smbalmer
5916240a9a23Smbalmer    if test -n "$prev"; then
5917240a9a23Smbalmer      $echo "$modename: the \`$prev' option requires an argument" 1>&2
5918240a9a23Smbalmer      $echo "$help" 1>&2
5919240a9a23Smbalmer      exit $EXIT_FAILURE
5920240a9a23Smbalmer    fi
5921240a9a23Smbalmer
5922240a9a23Smbalmer    if test -z "$files"; then
5923240a9a23Smbalmer      if test -z "$dest"; then
5924240a9a23Smbalmer	$echo "$modename: no file or destination specified" 1>&2
5925240a9a23Smbalmer      else
5926240a9a23Smbalmer	$echo "$modename: you must specify a destination" 1>&2
5927240a9a23Smbalmer      fi
5928240a9a23Smbalmer      $echo "$help" 1>&2
5929240a9a23Smbalmer      exit $EXIT_FAILURE
5930240a9a23Smbalmer    fi
5931240a9a23Smbalmer
5932240a9a23Smbalmer    # Strip any trailing slash from the destination.
5933240a9a23Smbalmer    dest=`$echo "X$dest" | $Xsed -e 's%/$%%'`
5934240a9a23Smbalmer
5935240a9a23Smbalmer    # Check to see that the destination is a directory.
5936240a9a23Smbalmer    test -d "$dest" && isdir=yes
5937240a9a23Smbalmer    if test "$isdir" = yes; then
5938240a9a23Smbalmer      destdir="$dest"
5939240a9a23Smbalmer      destname=
5940240a9a23Smbalmer    else
5941240a9a23Smbalmer      destdir=`$echo "X$dest" | $Xsed -e 's%/[^/]*$%%'`
5942240a9a23Smbalmer      test "X$destdir" = "X$dest" && destdir=.
5943240a9a23Smbalmer      destname=`$echo "X$dest" | $Xsed -e 's%^.*/%%'`
5944240a9a23Smbalmer
5945240a9a23Smbalmer      # Not a directory, so check to see that there is only one file specified.
5946240a9a23Smbalmer      set dummy $files
5947240a9a23Smbalmer      if test "$#" -gt 2; then
5948240a9a23Smbalmer	$echo "$modename: \`$dest' is not a directory" 1>&2
5949240a9a23Smbalmer	$echo "$help" 1>&2
5950240a9a23Smbalmer	exit $EXIT_FAILURE
5951240a9a23Smbalmer      fi
5952240a9a23Smbalmer    fi
5953240a9a23Smbalmer    case $destdir in
5954240a9a23Smbalmer    [\\/]* | [A-Za-z]:[\\/]*) ;;
5955240a9a23Smbalmer    *)
5956240a9a23Smbalmer      for file in $files; do
5957240a9a23Smbalmer	case $file in
5958240a9a23Smbalmer	*.lo) ;;
5959240a9a23Smbalmer	*)
5960240a9a23Smbalmer	  $echo "$modename: \`$destdir' must be an absolute directory name" 1>&2
5961240a9a23Smbalmer	  $echo "$help" 1>&2
5962240a9a23Smbalmer	  exit $EXIT_FAILURE
5963240a9a23Smbalmer	  ;;
5964240a9a23Smbalmer	esac
5965240a9a23Smbalmer      done
5966240a9a23Smbalmer      ;;
5967240a9a23Smbalmer    esac
5968240a9a23Smbalmer
5969240a9a23Smbalmer    # This variable tells wrapper scripts just to set variables rather
5970240a9a23Smbalmer    # than running their programs.
5971240a9a23Smbalmer    libtool_install_magic="$magic"
5972240a9a23Smbalmer
5973240a9a23Smbalmer    staticlibs=
5974240a9a23Smbalmer    future_libdirs=
5975240a9a23Smbalmer    current_libdirs=
5976240a9a23Smbalmer    for file in $files; do
5977240a9a23Smbalmer
5978240a9a23Smbalmer      # Do each installation.
5979240a9a23Smbalmer      case $file in
5980240a9a23Smbalmer      *.$libext)
5981240a9a23Smbalmer	# Do the static libraries later.
5982240a9a23Smbalmer	staticlibs="$staticlibs $file"
5983240a9a23Smbalmer	;;
5984240a9a23Smbalmer
5985240a9a23Smbalmer      *.la)
5986240a9a23Smbalmer	# Check to see that this really is a libtool archive.
5987240a9a23Smbalmer	if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
5988240a9a23Smbalmer	else
5989240a9a23Smbalmer	  $echo "$modename: \`$file' is not a valid libtool archive" 1>&2
5990240a9a23Smbalmer	  $echo "$help" 1>&2
5991240a9a23Smbalmer	  exit $EXIT_FAILURE
5992240a9a23Smbalmer	fi
5993240a9a23Smbalmer
5994240a9a23Smbalmer	library_names=
5995240a9a23Smbalmer	old_library=
5996240a9a23Smbalmer	relink_command=
5997240a9a23Smbalmer	# If there is no directory component, then add one.
5998240a9a23Smbalmer	case $file in
5999240a9a23Smbalmer	*/* | *\\*) . $file ;;
6000240a9a23Smbalmer	*) . ./$file ;;
6001240a9a23Smbalmer	esac
6002240a9a23Smbalmer
6003240a9a23Smbalmer	# Add the libdir to current_libdirs if it is the destination.
6004240a9a23Smbalmer	if test "X$destdir" = "X$libdir"; then
6005240a9a23Smbalmer	  case "$current_libdirs " in
6006240a9a23Smbalmer	  *" $libdir "*) ;;
6007240a9a23Smbalmer	  *) current_libdirs="$current_libdirs $libdir" ;;
6008240a9a23Smbalmer	  esac
6009240a9a23Smbalmer	else
6010240a9a23Smbalmer	  # Note the libdir as a future libdir.
6011240a9a23Smbalmer	  case "$future_libdirs " in
6012240a9a23Smbalmer	  *" $libdir "*) ;;
6013240a9a23Smbalmer	  *) future_libdirs="$future_libdirs $libdir" ;;
6014240a9a23Smbalmer	  esac
6015240a9a23Smbalmer	fi
6016240a9a23Smbalmer
6017240a9a23Smbalmer	dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`/
6018240a9a23Smbalmer	test "X$dir" = "X$file/" && dir=
6019240a9a23Smbalmer	dir="$dir$objdir"
6020240a9a23Smbalmer
6021240a9a23Smbalmer	if test -n "$relink_command"; then
6022240a9a23Smbalmer	  # Determine the prefix the user has applied to our future dir.
6023240a9a23Smbalmer	  inst_prefix_dir=`$echo "$destdir" | $SED "s%$libdir\$%%"`
6024240a9a23Smbalmer
6025240a9a23Smbalmer	  # Don't allow the user to place us outside of our expected
6026240a9a23Smbalmer	  # location b/c this prevents finding dependent libraries that
6027240a9a23Smbalmer	  # are installed to the same prefix.
6028240a9a23Smbalmer	  # At present, this check doesn't affect windows .dll's that
6029240a9a23Smbalmer	  # are installed into $libdir/../bin (currently, that works fine)
6030240a9a23Smbalmer	  # but it's something to keep an eye on.
6031240a9a23Smbalmer	  if test "$inst_prefix_dir" = "$destdir"; then
6032240a9a23Smbalmer	    $echo "$modename: error: cannot install \`$file' to a directory not ending in $libdir" 1>&2
6033240a9a23Smbalmer	    exit $EXIT_FAILURE
6034240a9a23Smbalmer	  fi
6035240a9a23Smbalmer
6036240a9a23Smbalmer	  if test -n "$inst_prefix_dir"; then
6037240a9a23Smbalmer	    # Stick the inst_prefix_dir data into the link command.
6038240a9a23Smbalmer	    relink_command=`$echo "$relink_command" | $SP2NL | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%" | $NL2SP`
6039240a9a23Smbalmer	  else
6040240a9a23Smbalmer	    relink_command=`$echo "$relink_command" | $SP2NL | $SED "s%@inst_prefix_dir@%%" | $NL2SP`
6041240a9a23Smbalmer	  fi
6042240a9a23Smbalmer
6043240a9a23Smbalmer	  $echo "$modename: warning: relinking \`$file'" 1>&2
6044240a9a23Smbalmer	  $show "$relink_command"
6045240a9a23Smbalmer	  if $run eval "$relink_command"; then :
6046240a9a23Smbalmer	  else
6047240a9a23Smbalmer	    $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
6048240a9a23Smbalmer	    exit $EXIT_FAILURE
6049240a9a23Smbalmer	  fi
6050240a9a23Smbalmer	fi
6051240a9a23Smbalmer
6052240a9a23Smbalmer	# See the names of the shared library.
6053240a9a23Smbalmer	set dummy $library_names
6054240a9a23Smbalmer	if test -n "$2"; then
6055240a9a23Smbalmer	  realname="$2"
6056240a9a23Smbalmer	  shift
6057240a9a23Smbalmer	  shift
6058240a9a23Smbalmer
6059240a9a23Smbalmer	  srcname="$realname"
6060240a9a23Smbalmer	  test -n "$relink_command" && srcname="$realname"T
6061240a9a23Smbalmer
6062240a9a23Smbalmer	  # Install the shared library and build the symlinks.
6063240a9a23Smbalmer	  $show "$install_prog $extra_mode $dir/$srcname $destdir/$realname"
6064240a9a23Smbalmer	  $run eval "$install_prog $extra_mode $dir/$srcname $destdir/$realname" || exit $?
6065240a9a23Smbalmer	  if test -n "$stripme" && test -n "$striplib"; then
6066240a9a23Smbalmer	    $show "$striplib $destdir/$realname"
6067240a9a23Smbalmer	    $run eval "$striplib $destdir/$realname" || exit $?
6068240a9a23Smbalmer	  fi
6069240a9a23Smbalmer
6070240a9a23Smbalmer	  if test "$#" -gt 0; then
6071240a9a23Smbalmer	    # Delete the old symlinks, and create new ones.
6072240a9a23Smbalmer	    # Try `ln -sf' first, because the `ln' binary might depend on
6073240a9a23Smbalmer	    # the symlink we replace!  Solaris /bin/ln does not understand -f,
6074240a9a23Smbalmer	    # so we also need to try rm && ln -s.
6075240a9a23Smbalmer	    for linkname
6076240a9a23Smbalmer	    do
6077240a9a23Smbalmer	      if test "$linkname" != "$realname"; then
6078240a9a23Smbalmer                $show "(cd $destdir && { $LN_S -f $realname $linkname || { $rm $linkname && $LN_S $realname $linkname; }; })"
6079240a9a23Smbalmer                $run eval "(cd $destdir && { $LN_S -f $realname $linkname || { $rm $linkname && $LN_S $realname $linkname; }; })"
6080240a9a23Smbalmer	      fi
6081240a9a23Smbalmer	    done
6082240a9a23Smbalmer	  fi
6083240a9a23Smbalmer
6084240a9a23Smbalmer	  # Do each command in the postinstall commands.
6085240a9a23Smbalmer	  lib="$destdir/$realname"
6086240a9a23Smbalmer	  cmds=$postinstall_cmds
6087240a9a23Smbalmer	  save_ifs="$IFS"; IFS='~'
6088240a9a23Smbalmer	  for cmd in $cmds; do
6089240a9a23Smbalmer	    IFS="$save_ifs"
6090240a9a23Smbalmer	    eval cmd=\"$cmd\"
6091240a9a23Smbalmer	    $show "$cmd"
6092240a9a23Smbalmer	    $run eval "$cmd" || {
6093240a9a23Smbalmer	      lt_exit=$?
6094240a9a23Smbalmer
6095240a9a23Smbalmer	      # Restore the uninstalled library and exit
6096240a9a23Smbalmer	      if test "$mode" = relink; then
6097240a9a23Smbalmer		$run eval '(cd $output_objdir && $rm ${realname}T && $mv ${realname}U $realname)'
6098240a9a23Smbalmer	      fi
6099240a9a23Smbalmer
6100240a9a23Smbalmer	      exit $lt_exit
6101240a9a23Smbalmer	    }
6102240a9a23Smbalmer	  done
6103240a9a23Smbalmer	  IFS="$save_ifs"
6104240a9a23Smbalmer	fi
6105240a9a23Smbalmer
6106240a9a23Smbalmer	# Install the pseudo-library for information purposes.
6107240a9a23Smbalmer	name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
6108240a9a23Smbalmer	instname="$dir/$name"i
6109240a9a23Smbalmer	$show "$install_prog $extra_mode $instname $destdir/$name"
6110240a9a23Smbalmer	$run eval "$install_prog $extra_mode $instname $destdir/$name" || exit $?
6111240a9a23Smbalmer
6112240a9a23Smbalmer	# Maybe install the static library, too.
6113240a9a23Smbalmer	test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library"
6114240a9a23Smbalmer	;;
6115240a9a23Smbalmer
6116240a9a23Smbalmer      *.lo)
6117240a9a23Smbalmer	# Install (i.e. copy) a libtool object.
6118240a9a23Smbalmer
6119240a9a23Smbalmer	# Figure out destination file name, if it wasn't already specified.
6120240a9a23Smbalmer	if test -n "$destname"; then
6121240a9a23Smbalmer	  destfile="$destdir/$destname"
6122240a9a23Smbalmer	else
6123240a9a23Smbalmer	  destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
6124240a9a23Smbalmer	  destfile="$destdir/$destfile"
6125240a9a23Smbalmer	fi
6126240a9a23Smbalmer
6127240a9a23Smbalmer	# Deduce the name of the destination old-style object file.
6128240a9a23Smbalmer	case $destfile in
6129240a9a23Smbalmer	*.lo)
6130240a9a23Smbalmer	  staticdest=`$echo "X$destfile" | $Xsed -e "$lo2o"`
6131240a9a23Smbalmer	  ;;
6132240a9a23Smbalmer	*.$objext)
6133240a9a23Smbalmer	  staticdest="$destfile"
6134240a9a23Smbalmer	  destfile=
6135240a9a23Smbalmer	  ;;
6136240a9a23Smbalmer	*)
6137240a9a23Smbalmer	  $echo "$modename: cannot copy a libtool object to \`$destfile'" 1>&2
6138240a9a23Smbalmer	  $echo "$help" 1>&2
6139240a9a23Smbalmer	  exit $EXIT_FAILURE
6140240a9a23Smbalmer	  ;;
6141240a9a23Smbalmer	esac
6142240a9a23Smbalmer
6143240a9a23Smbalmer	# Install the libtool object if requested.
6144240a9a23Smbalmer	if test -n "$destfile"; then
6145240a9a23Smbalmer	  $show "$install_prog $extra_mode $file $destfile"
6146240a9a23Smbalmer	  $run eval "$install_prog $extra_mode $file $destfile" || exit $?
6147240a9a23Smbalmer	fi
6148240a9a23Smbalmer
6149240a9a23Smbalmer	# Install the old object if enabled.
6150240a9a23Smbalmer	if test "$build_old_libs" = yes; then
6151240a9a23Smbalmer	  # Deduce the name of the old-style object file.
6152240a9a23Smbalmer	  staticobj=`$echo "X$file" | $Xsed -e "$lo2o"`
6153240a9a23Smbalmer
6154240a9a23Smbalmer	  $show "$install_prog $extra_mode $staticobj $staticdest"
6155240a9a23Smbalmer	  $run eval "$install_prog $extra_mode \$staticobj \$staticdest" || exit $?
6156240a9a23Smbalmer	fi
6157240a9a23Smbalmer	exit $EXIT_SUCCESS
6158240a9a23Smbalmer	;;
6159240a9a23Smbalmer
6160240a9a23Smbalmer      *)
6161240a9a23Smbalmer	# Figure out destination file name, if it wasn't already specified.
6162240a9a23Smbalmer	if test -n "$destname"; then
6163240a9a23Smbalmer	  destfile="$destdir/$destname"
6164240a9a23Smbalmer	else
6165240a9a23Smbalmer	  destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
6166240a9a23Smbalmer	  destfile="$destdir/$destfile"
6167240a9a23Smbalmer	fi
6168240a9a23Smbalmer
6169240a9a23Smbalmer	# If the file is missing, and there is a .exe on the end, strip it
6170240a9a23Smbalmer	# because it is most likely a libtool script we actually want to
6171240a9a23Smbalmer	# install
6172240a9a23Smbalmer	stripped_ext=""
6173240a9a23Smbalmer	case $file in
6174240a9a23Smbalmer	  *.exe)
6175240a9a23Smbalmer	    if test ! -f "$file"; then
6176240a9a23Smbalmer	      file=`$echo $file|${SED} 's,.exe$,,'`
6177240a9a23Smbalmer	      stripped_ext=".exe"
6178240a9a23Smbalmer	    fi
6179240a9a23Smbalmer	    ;;
6180240a9a23Smbalmer	esac
6181240a9a23Smbalmer
6182240a9a23Smbalmer	# Do a test to see if this is really a libtool program.
6183240a9a23Smbalmer	case $host in
6184240a9a23Smbalmer	*cygwin*|*mingw*)
6185240a9a23Smbalmer	    wrapper=`$echo $file | ${SED} -e 's,.exe$,,'`
6186240a9a23Smbalmer	    ;;
6187240a9a23Smbalmer	*)
6188240a9a23Smbalmer	    wrapper=$file
6189240a9a23Smbalmer	    ;;
6190240a9a23Smbalmer	esac
6191240a9a23Smbalmer	if (${SED} -e '4q' $wrapper | grep "^# Generated by .*$PACKAGE")>/dev/null 2>&1; then
6192240a9a23Smbalmer	  notinst_deplibs=
6193240a9a23Smbalmer	  relink_command=
6194240a9a23Smbalmer
6195240a9a23Smbalmer	  # Note that it is not necessary on cygwin/mingw to append a dot to
6196240a9a23Smbalmer	  # foo even if both foo and FILE.exe exist: automatic-append-.exe
6197240a9a23Smbalmer	  # behavior happens only for exec(3), not for open(2)!  Also, sourcing
6198240a9a23Smbalmer	  # `FILE.' does not work on cygwin managed mounts.
6199240a9a23Smbalmer	  #
6200240a9a23Smbalmer	  # If there is no directory component, then add one.
6201240a9a23Smbalmer	  case $wrapper in
6202240a9a23Smbalmer	  */* | *\\*) . ${wrapper} ;;
6203240a9a23Smbalmer	  *) . ./${wrapper} ;;
6204240a9a23Smbalmer	  esac
6205240a9a23Smbalmer
6206240a9a23Smbalmer	  # Check the variables that should have been set.
6207240a9a23Smbalmer	  if test -z "$notinst_deplibs"; then
6208240a9a23Smbalmer	    $echo "$modename: invalid libtool wrapper script \`$wrapper'" 1>&2
6209240a9a23Smbalmer	    exit $EXIT_FAILURE
6210240a9a23Smbalmer	  fi
6211240a9a23Smbalmer
6212240a9a23Smbalmer	  finalize=yes
6213240a9a23Smbalmer	  for lib in $notinst_deplibs; do
6214240a9a23Smbalmer	    # Check to see that each library is installed.
6215240a9a23Smbalmer	    libdir=
6216240a9a23Smbalmer	    if test -f "$lib"; then
6217240a9a23Smbalmer	      # If there is no directory component, then add one.
6218240a9a23Smbalmer	      case $lib in
6219240a9a23Smbalmer	      */* | *\\*) . $lib ;;
6220240a9a23Smbalmer	      *) . ./$lib ;;
6221240a9a23Smbalmer	      esac
6222240a9a23Smbalmer	    fi
6223240a9a23Smbalmer	    libfile="$libdir/"`$echo "X$lib" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test
6224240a9a23Smbalmer	    if test -n "$libdir" && test ! -f "$libfile"; then
6225240a9a23Smbalmer	      $echo "$modename: warning: \`$lib' has not been installed in \`$libdir'" 1>&2
6226240a9a23Smbalmer	      finalize=no
6227240a9a23Smbalmer	    fi
6228240a9a23Smbalmer	  done
6229240a9a23Smbalmer
6230240a9a23Smbalmer	  relink_command=
6231240a9a23Smbalmer	  # Note that it is not necessary on cygwin/mingw to append a dot to
6232240a9a23Smbalmer	  # foo even if both foo and FILE.exe exist: automatic-append-.exe
6233240a9a23Smbalmer	  # behavior happens only for exec(3), not for open(2)!  Also, sourcing
6234240a9a23Smbalmer	  # `FILE.' does not work on cygwin managed mounts.
6235240a9a23Smbalmer	  #
6236240a9a23Smbalmer	  # If there is no directory component, then add one.
6237240a9a23Smbalmer	  case $wrapper in
6238240a9a23Smbalmer	  */* | *\\*) . ${wrapper} ;;
6239240a9a23Smbalmer	  *) . ./${wrapper} ;;
6240240a9a23Smbalmer	  esac
6241240a9a23Smbalmer
6242240a9a23Smbalmer	  outputname=
6243240a9a23Smbalmer	  if test "$fast_install" = no && test -n "$relink_command"; then
6244240a9a23Smbalmer	    if test "$finalize" = yes && test -z "$run"; then
6245240a9a23Smbalmer	      tmpdir=`func_mktempdir`
6246240a9a23Smbalmer	      file=`$echo "X$file$stripped_ext" | $Xsed -e 's%^.*/%%'`
6247240a9a23Smbalmer	      outputname="$tmpdir/$file"
6248240a9a23Smbalmer	      # Replace the output file specification.
6249240a9a23Smbalmer	      relink_command=`$echo "X$relink_command" | $SP2NL | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g' | $NL2SP`
6250240a9a23Smbalmer
6251240a9a23Smbalmer	      $show "$relink_command"
6252240a9a23Smbalmer	      if $run eval "$relink_command"; then :
6253240a9a23Smbalmer	      else
6254240a9a23Smbalmer		$echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
6255240a9a23Smbalmer		${rm}r "$tmpdir"
6256240a9a23Smbalmer		continue
6257240a9a23Smbalmer	      fi
6258240a9a23Smbalmer	      file="$outputname"
6259240a9a23Smbalmer	    else
6260240a9a23Smbalmer	      $echo "$modename: warning: cannot relink \`$file'" 1>&2
6261240a9a23Smbalmer	    fi
6262240a9a23Smbalmer	  else
6263240a9a23Smbalmer	    # Install the binary that we compiled earlier.
6264240a9a23Smbalmer	    file=`$echo "X$file$stripped_ext" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"`
6265240a9a23Smbalmer	  fi
6266240a9a23Smbalmer	fi
6267240a9a23Smbalmer
6268240a9a23Smbalmer	# remove .exe since cygwin /usr/bin/install will append another
6269240a9a23Smbalmer	# one anyway 
6270240a9a23Smbalmer	case $install_prog,$host in
6271240a9a23Smbalmer	*/usr/bin/install*,*cygwin*)
6272240a9a23Smbalmer	  case $file:$destfile in
6273240a9a23Smbalmer	  *.exe:*.exe)
6274240a9a23Smbalmer	    # this is ok
6275240a9a23Smbalmer	    ;;
6276240a9a23Smbalmer	  *.exe:*)
6277240a9a23Smbalmer	    destfile=$destfile.exe
6278240a9a23Smbalmer	    ;;
6279240a9a23Smbalmer	  *:*.exe)
6280240a9a23Smbalmer	    destfile=`$echo $destfile | ${SED} -e 's,.exe$,,'`
6281240a9a23Smbalmer	    ;;
6282240a9a23Smbalmer	  esac
6283240a9a23Smbalmer	  ;;
6284240a9a23Smbalmer	esac
6285240a9a23Smbalmer	$show "$install_prog$stripme $file $destfile"
6286240a9a23Smbalmer	$run eval "$install_prog\$stripme \$file \$destfile" || exit $?
6287240a9a23Smbalmer	test -n "$outputname" && ${rm}r "$tmpdir"
6288240a9a23Smbalmer	;;
6289240a9a23Smbalmer      esac
6290240a9a23Smbalmer    done
6291240a9a23Smbalmer
6292240a9a23Smbalmer    for file in $staticlibs; do
6293240a9a23Smbalmer      name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
6294240a9a23Smbalmer
6295240a9a23Smbalmer      # Set up the ranlib parameters.
6296240a9a23Smbalmer      oldlib="$destdir/$name"
6297240a9a23Smbalmer
6298240a9a23Smbalmer      $show "$install_prog $file $oldlib"
6299240a9a23Smbalmer      $run eval "$install_prog \$file \$oldlib" || exit $?
6300240a9a23Smbalmer
6301240a9a23Smbalmer      if test -n "$stripme" && test -n "$old_striplib"; then
6302240a9a23Smbalmer	$show "$old_striplib $oldlib"
6303240a9a23Smbalmer	$run eval "$old_striplib $oldlib" || exit $?
6304240a9a23Smbalmer      fi
6305240a9a23Smbalmer
6306240a9a23Smbalmer      # Do each command in the postinstall commands.
6307240a9a23Smbalmer      cmds=$old_postinstall_cmds
6308240a9a23Smbalmer      save_ifs="$IFS"; IFS='~'
6309240a9a23Smbalmer      for cmd in $cmds; do
6310240a9a23Smbalmer	IFS="$save_ifs"
6311240a9a23Smbalmer	eval cmd=\"$cmd\"
6312240a9a23Smbalmer	$show "$cmd"
6313240a9a23Smbalmer	$run eval "$cmd" || exit $?
6314240a9a23Smbalmer      done
6315240a9a23Smbalmer      IFS="$save_ifs"
6316240a9a23Smbalmer    done
6317240a9a23Smbalmer
6318240a9a23Smbalmer    if test -n "$future_libdirs"; then
6319240a9a23Smbalmer      $echo "$modename: warning: remember to run \`$progname --finish$future_libdirs'" 1>&2
6320240a9a23Smbalmer    fi
6321240a9a23Smbalmer
6322240a9a23Smbalmer    if test -n "$current_libdirs"; then
6323240a9a23Smbalmer      # Maybe just do a dry run.
6324240a9a23Smbalmer      test -n "$run" && current_libdirs=" -n$current_libdirs"
6325240a9a23Smbalmer      exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs'
6326240a9a23Smbalmer    else
6327240a9a23Smbalmer      exit $EXIT_SUCCESS
6328240a9a23Smbalmer    fi
6329240a9a23Smbalmer    ;;
6330240a9a23Smbalmer
6331240a9a23Smbalmer  # libtool finish mode
6332240a9a23Smbalmer  finish)
6333240a9a23Smbalmer    modename="$modename: finish"
6334240a9a23Smbalmer    libdirs="$nonopt"
6335240a9a23Smbalmer    admincmds=
6336240a9a23Smbalmer
6337240a9a23Smbalmer    if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
6338240a9a23Smbalmer      for dir
6339240a9a23Smbalmer      do
6340240a9a23Smbalmer	libdirs="$libdirs $dir"
6341240a9a23Smbalmer      done
6342240a9a23Smbalmer
6343240a9a23Smbalmer      for libdir in $libdirs; do
6344240a9a23Smbalmer	if test -n "$finish_cmds"; then
6345240a9a23Smbalmer	  # Do each command in the finish commands.
6346240a9a23Smbalmer	  cmds=$finish_cmds
6347240a9a23Smbalmer	  save_ifs="$IFS"; IFS='~'
6348240a9a23Smbalmer	  for cmd in $cmds; do
6349240a9a23Smbalmer	    IFS="$save_ifs"
6350240a9a23Smbalmer	    eval cmd=\"$cmd\"
6351240a9a23Smbalmer	    $show "$cmd"
6352240a9a23Smbalmer	    $run eval "$cmd" || admincmds="$admincmds
6353240a9a23Smbalmer       $cmd"
6354240a9a23Smbalmer	  done
6355240a9a23Smbalmer	  IFS="$save_ifs"
6356240a9a23Smbalmer	fi
6357240a9a23Smbalmer	if test -n "$finish_eval"; then
6358240a9a23Smbalmer	  # Do the single finish_eval.
6359240a9a23Smbalmer	  eval cmds=\"$finish_eval\"
6360240a9a23Smbalmer	  $run eval "$cmds" || admincmds="$admincmds
6361240a9a23Smbalmer       $cmds"
6362240a9a23Smbalmer	fi
6363240a9a23Smbalmer      done
6364240a9a23Smbalmer    fi
6365240a9a23Smbalmer
6366240a9a23Smbalmer    # Exit here if they wanted silent mode.
6367240a9a23Smbalmer    test "$show" = : && exit $EXIT_SUCCESS
6368240a9a23Smbalmer
6369240a9a23Smbalmer    exit $EXIT_SUCCESS
6370240a9a23Smbalmer    ;;
6371240a9a23Smbalmer
6372240a9a23Smbalmer  # libtool execute mode
6373240a9a23Smbalmer  execute)
6374240a9a23Smbalmer    modename="$modename: execute"
6375240a9a23Smbalmer
6376240a9a23Smbalmer    # The first argument is the command name.
6377240a9a23Smbalmer    cmd="$nonopt"
6378240a9a23Smbalmer    if test -z "$cmd"; then
6379240a9a23Smbalmer      $echo "$modename: you must specify a COMMAND" 1>&2
6380240a9a23Smbalmer      $echo "$help"
6381240a9a23Smbalmer      exit $EXIT_FAILURE
6382240a9a23Smbalmer    fi
6383240a9a23Smbalmer
6384240a9a23Smbalmer    # Handle -dlopen flags immediately.
6385240a9a23Smbalmer    for file in $execute_dlfiles; do
6386240a9a23Smbalmer      if test ! -f "$file"; then
6387240a9a23Smbalmer	$echo "$modename: \`$file' is not a file" 1>&2
6388240a9a23Smbalmer	$echo "$help" 1>&2
6389240a9a23Smbalmer	exit $EXIT_FAILURE
6390240a9a23Smbalmer      fi
6391240a9a23Smbalmer
6392240a9a23Smbalmer      dir=
6393240a9a23Smbalmer      case $file in
6394240a9a23Smbalmer      *.la)
6395240a9a23Smbalmer	# Check to see that this really is a libtool archive.
6396240a9a23Smbalmer	if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
6397240a9a23Smbalmer	else
6398240a9a23Smbalmer	  $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
6399240a9a23Smbalmer	  $echo "$help" 1>&2
6400240a9a23Smbalmer	  exit $EXIT_FAILURE
6401240a9a23Smbalmer	fi
6402240a9a23Smbalmer
6403240a9a23Smbalmer	# Read the libtool library.
6404240a9a23Smbalmer	dlname=
6405240a9a23Smbalmer	library_names=
6406240a9a23Smbalmer
6407240a9a23Smbalmer	# If there is no directory component, then add one.
6408240a9a23Smbalmer	case $file in
6409240a9a23Smbalmer	*/* | *\\*) . $file ;;
6410240a9a23Smbalmer	*) . ./$file ;;
6411240a9a23Smbalmer	esac
6412240a9a23Smbalmer
6413240a9a23Smbalmer	# Skip this library if it cannot be dlopened.
6414240a9a23Smbalmer	if test -z "$dlname"; then
6415240a9a23Smbalmer	  # Warn if it was a shared library.
6416240a9a23Smbalmer	  test -n "$library_names" && $echo "$modename: warning: \`$file' was not linked with \`-export-dynamic'"
6417240a9a23Smbalmer	  continue
6418240a9a23Smbalmer	fi
6419240a9a23Smbalmer
6420240a9a23Smbalmer	dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
6421240a9a23Smbalmer	test "X$dir" = "X$file" && dir=.
6422240a9a23Smbalmer
6423240a9a23Smbalmer	if test -f "$dir/$objdir/$dlname"; then
6424240a9a23Smbalmer	  dir="$dir/$objdir"
6425240a9a23Smbalmer	else
6426240a9a23Smbalmer	  if test ! -f "$dir/$dlname"; then
6427240a9a23Smbalmer	    $echo "$modename: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2
6428240a9a23Smbalmer	    exit $EXIT_FAILURE
6429240a9a23Smbalmer	  fi
6430240a9a23Smbalmer	fi
6431240a9a23Smbalmer	;;
6432240a9a23Smbalmer
6433240a9a23Smbalmer      *.lo)
6434240a9a23Smbalmer	# Just add the directory containing the .lo file.
6435240a9a23Smbalmer	dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
6436240a9a23Smbalmer	test "X$dir" = "X$file" && dir=.
6437240a9a23Smbalmer	;;
6438240a9a23Smbalmer
6439240a9a23Smbalmer      *)
6440240a9a23Smbalmer	$echo "$modename: warning \`-dlopen' is ignored for non-libtool libraries and objects" 1>&2
6441240a9a23Smbalmer	continue
6442240a9a23Smbalmer	;;
6443240a9a23Smbalmer      esac
6444240a9a23Smbalmer
6445240a9a23Smbalmer      # Get the absolute pathname.
6446240a9a23Smbalmer      absdir=`cd "$dir" && pwd`
6447240a9a23Smbalmer      test -n "$absdir" && dir="$absdir"
6448240a9a23Smbalmer
6449240a9a23Smbalmer      # Now add the directory to shlibpath_var.
6450240a9a23Smbalmer      if eval "test -z \"\$$shlibpath_var\""; then
6451240a9a23Smbalmer	eval "$shlibpath_var=\"\$dir\""
6452240a9a23Smbalmer      else
6453240a9a23Smbalmer	eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\""
6454240a9a23Smbalmer      fi
6455240a9a23Smbalmer    done
6456240a9a23Smbalmer
6457240a9a23Smbalmer    # This variable tells wrapper scripts just to set shlibpath_var
6458240a9a23Smbalmer    # rather than running their programs.
6459240a9a23Smbalmer    libtool_execute_magic="$magic"
6460240a9a23Smbalmer
6461240a9a23Smbalmer    # Check if any of the arguments is a wrapper script.
6462240a9a23Smbalmer    args=
6463240a9a23Smbalmer    for file
6464240a9a23Smbalmer    do
6465240a9a23Smbalmer      case $file in
6466240a9a23Smbalmer      -*) ;;
6467240a9a23Smbalmer      *)
6468240a9a23Smbalmer	# Do a test to see if this is really a libtool program.
6469240a9a23Smbalmer	if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
6470240a9a23Smbalmer	  # If there is no directory component, then add one.
6471240a9a23Smbalmer	  case $file in
6472240a9a23Smbalmer	  */* | *\\*) . $file ;;
6473240a9a23Smbalmer	  *) . ./$file ;;
6474240a9a23Smbalmer	  esac
6475240a9a23Smbalmer
6476240a9a23Smbalmer	  # Transform arg to wrapped name.
6477240a9a23Smbalmer	  file="$progdir/$program"
6478240a9a23Smbalmer	fi
6479240a9a23Smbalmer	;;
6480240a9a23Smbalmer      esac
6481240a9a23Smbalmer      # Quote arguments (to preserve shell metacharacters).
6482240a9a23Smbalmer      file=`$echo "X$file" | $Xsed -e "$sed_quote_subst"`
6483240a9a23Smbalmer      args="$args \"$file\""
6484240a9a23Smbalmer    done
6485240a9a23Smbalmer
6486240a9a23Smbalmer    if test -z "$run"; then
6487240a9a23Smbalmer      if test -n "$shlibpath_var"; then
6488240a9a23Smbalmer	# Export the shlibpath_var.
6489240a9a23Smbalmer	eval "export $shlibpath_var"
6490240a9a23Smbalmer      fi
6491240a9a23Smbalmer
6492240a9a23Smbalmer      # Restore saved environment variables
6493240a9a23Smbalmer      for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
6494240a9a23Smbalmer      do
6495240a9a23Smbalmer	eval "if test \"\${save_$lt_var+set}\" = set; then
6496240a9a23Smbalmer		$lt_var=\$save_$lt_var; export $lt_var
6497240a9a23Smbalmer	      fi"
6498240a9a23Smbalmer      done
6499240a9a23Smbalmer
6500240a9a23Smbalmer      # Now prepare to actually exec the command.
6501240a9a23Smbalmer      exec_cmd="\$cmd$args"
6502240a9a23Smbalmer    else
6503240a9a23Smbalmer      # Display what would be done.
6504240a9a23Smbalmer      if test -n "$shlibpath_var"; then
6505240a9a23Smbalmer	eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\""
6506240a9a23Smbalmer	$echo "export $shlibpath_var"
6507240a9a23Smbalmer      fi
6508240a9a23Smbalmer      $echo "$cmd$args"
6509240a9a23Smbalmer      exit $EXIT_SUCCESS
6510240a9a23Smbalmer    fi
6511240a9a23Smbalmer    ;;
6512240a9a23Smbalmer
6513240a9a23Smbalmer  # libtool clean and uninstall mode
6514240a9a23Smbalmer  clean | uninstall)
6515240a9a23Smbalmer    modename="$modename: $mode"
6516240a9a23Smbalmer    rm="$nonopt"
6517240a9a23Smbalmer    files=
6518240a9a23Smbalmer    rmforce=
6519240a9a23Smbalmer    exit_status=0
6520240a9a23Smbalmer
6521240a9a23Smbalmer    # This variable tells wrapper scripts just to set variables rather
6522240a9a23Smbalmer    # than running their programs.
6523240a9a23Smbalmer    libtool_install_magic="$magic"
6524240a9a23Smbalmer
6525240a9a23Smbalmer    for arg
6526240a9a23Smbalmer    do
6527240a9a23Smbalmer      case $arg in
6528240a9a23Smbalmer      -f) rm="$rm $arg"; rmforce=yes ;;
6529240a9a23Smbalmer      -*) rm="$rm $arg" ;;
6530240a9a23Smbalmer      *) files="$files $arg" ;;
6531240a9a23Smbalmer      esac
6532240a9a23Smbalmer    done
6533240a9a23Smbalmer
6534240a9a23Smbalmer    if test -z "$rm"; then
6535240a9a23Smbalmer      $echo "$modename: you must specify an RM program" 1>&2
6536240a9a23Smbalmer      $echo "$help" 1>&2
6537240a9a23Smbalmer      exit $EXIT_FAILURE
6538240a9a23Smbalmer    fi
6539240a9a23Smbalmer
6540240a9a23Smbalmer    rmdirs=
6541240a9a23Smbalmer
6542240a9a23Smbalmer    origobjdir="$objdir"
6543240a9a23Smbalmer    for file in $files; do
6544240a9a23Smbalmer      dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
6545240a9a23Smbalmer      if test "X$dir" = "X$file"; then
6546240a9a23Smbalmer	dir=.
6547240a9a23Smbalmer	objdir="$origobjdir"
6548240a9a23Smbalmer      else
6549240a9a23Smbalmer	objdir="$dir/$origobjdir"
6550240a9a23Smbalmer      fi
6551240a9a23Smbalmer      name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
6552240a9a23Smbalmer      test "$mode" = uninstall && objdir="$dir"
6553240a9a23Smbalmer
6554240a9a23Smbalmer      # Remember objdir for removal later, being careful to avoid duplicates
6555240a9a23Smbalmer      if test "$mode" = clean; then
6556240a9a23Smbalmer	case " $rmdirs " in
6557240a9a23Smbalmer	  *" $objdir "*) ;;
6558240a9a23Smbalmer	  *) rmdirs="$rmdirs $objdir" ;;
6559240a9a23Smbalmer	esac
6560240a9a23Smbalmer      fi
6561240a9a23Smbalmer
6562240a9a23Smbalmer      # Don't error if the file doesn't exist and rm -f was used.
6563240a9a23Smbalmer      if (test -L "$file") >/dev/null 2>&1 \
6564240a9a23Smbalmer	|| (test -h "$file") >/dev/null 2>&1 \
6565240a9a23Smbalmer	|| test -f "$file"; then
6566240a9a23Smbalmer	:
6567240a9a23Smbalmer      elif test -d "$file"; then
6568240a9a23Smbalmer	exit_status=1
6569240a9a23Smbalmer	continue
6570240a9a23Smbalmer      elif test "$rmforce" = yes; then
6571240a9a23Smbalmer	continue
6572240a9a23Smbalmer      fi
6573240a9a23Smbalmer
6574240a9a23Smbalmer      rmfiles="$file"
6575240a9a23Smbalmer
6576240a9a23Smbalmer      case $name in
6577240a9a23Smbalmer      *.la)
6578240a9a23Smbalmer	# Possibly a libtool archive, so verify it.
6579240a9a23Smbalmer	if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
6580240a9a23Smbalmer	  . $dir/$name
6581240a9a23Smbalmer
6582240a9a23Smbalmer	  # Delete the libtool libraries and symlinks.
6583240a9a23Smbalmer	  for n in $library_names; do
6584240a9a23Smbalmer	    rmfiles="$rmfiles $objdir/$n"
6585240a9a23Smbalmer	  done
6586240a9a23Smbalmer	  test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library"
6587240a9a23Smbalmer
6588240a9a23Smbalmer	  case "$mode" in
6589240a9a23Smbalmer	  clean)
6590240a9a23Smbalmer	    case "  $library_names " in
6591240a9a23Smbalmer	    # "  " in the beginning catches empty $dlname
6592240a9a23Smbalmer	    *" $dlname "*) ;;
6593240a9a23Smbalmer	    *) rmfiles="$rmfiles $objdir/$dlname" ;;
6594240a9a23Smbalmer	    esac
6595240a9a23Smbalmer	     test -n "$libdir" && rmfiles="$rmfiles $objdir/$name $objdir/${name}i"
6596240a9a23Smbalmer	    ;;
6597240a9a23Smbalmer	  uninstall)
6598240a9a23Smbalmer	    if test -n "$library_names"; then
6599240a9a23Smbalmer	      # Do each command in the postuninstall commands.
6600240a9a23Smbalmer	      cmds=$postuninstall_cmds
6601240a9a23Smbalmer	      save_ifs="$IFS"; IFS='~'
6602240a9a23Smbalmer	      for cmd in $cmds; do
6603240a9a23Smbalmer		IFS="$save_ifs"
6604240a9a23Smbalmer		eval cmd=\"$cmd\"
6605240a9a23Smbalmer		$show "$cmd"
6606240a9a23Smbalmer		$run eval "$cmd"
6607240a9a23Smbalmer		if test "$?" -ne 0 && test "$rmforce" != yes; then
6608240a9a23Smbalmer		  exit_status=1
6609240a9a23Smbalmer		fi
6610240a9a23Smbalmer	      done
6611240a9a23Smbalmer	      IFS="$save_ifs"
6612240a9a23Smbalmer	    fi
6613240a9a23Smbalmer
6614240a9a23Smbalmer	    if test -n "$old_library"; then
6615240a9a23Smbalmer	      # Do each command in the old_postuninstall commands.
6616240a9a23Smbalmer	      cmds=$old_postuninstall_cmds
6617240a9a23Smbalmer	      save_ifs="$IFS"; IFS='~'
6618240a9a23Smbalmer	      for cmd in $cmds; do
6619240a9a23Smbalmer		IFS="$save_ifs"
6620240a9a23Smbalmer		eval cmd=\"$cmd\"
6621240a9a23Smbalmer		$show "$cmd"
6622240a9a23Smbalmer		$run eval "$cmd"
6623240a9a23Smbalmer		if test "$?" -ne 0 && test "$rmforce" != yes; then
6624240a9a23Smbalmer		  exit_status=1
6625240a9a23Smbalmer		fi
6626240a9a23Smbalmer	      done
6627240a9a23Smbalmer	      IFS="$save_ifs"
6628240a9a23Smbalmer	    fi
6629240a9a23Smbalmer	    # FIXME: should reinstall the best remaining shared library.
6630240a9a23Smbalmer	    ;;
6631240a9a23Smbalmer	  esac
6632240a9a23Smbalmer	fi
6633240a9a23Smbalmer	;;
6634240a9a23Smbalmer
6635240a9a23Smbalmer      *.lo)
6636240a9a23Smbalmer	# Possibly a libtool object, so verify it.
6637240a9a23Smbalmer	if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
6638240a9a23Smbalmer
6639240a9a23Smbalmer	  # Read the .lo file
6640240a9a23Smbalmer	  . $dir/$name
6641240a9a23Smbalmer
6642240a9a23Smbalmer	  # Add PIC object to the list of files to remove.
6643240a9a23Smbalmer	  if test -n "$pic_object" \
6644240a9a23Smbalmer	     && test "$pic_object" != none; then
6645240a9a23Smbalmer	    rmfiles="$rmfiles $dir/$pic_object"
6646240a9a23Smbalmer	  fi
6647240a9a23Smbalmer
6648240a9a23Smbalmer	  # Add non-PIC object to the list of files to remove.
6649240a9a23Smbalmer	  if test -n "$non_pic_object" \
6650240a9a23Smbalmer	     && test "$non_pic_object" != none; then
6651240a9a23Smbalmer	    rmfiles="$rmfiles $dir/$non_pic_object"
6652240a9a23Smbalmer	  fi
6653240a9a23Smbalmer	fi
6654240a9a23Smbalmer	;;
6655240a9a23Smbalmer
6656240a9a23Smbalmer      *)
6657240a9a23Smbalmer	if test "$mode" = clean ; then
6658240a9a23Smbalmer	  noexename=$name
6659240a9a23Smbalmer	  case $file in
6660240a9a23Smbalmer	  *.exe)
6661240a9a23Smbalmer	    file=`$echo $file|${SED} 's,.exe$,,'`
6662240a9a23Smbalmer	    noexename=`$echo $name|${SED} 's,.exe$,,'`
6663240a9a23Smbalmer	    # $file with .exe has already been added to rmfiles,
6664240a9a23Smbalmer	    # add $file without .exe
6665240a9a23Smbalmer	    rmfiles="$rmfiles $file"
6666240a9a23Smbalmer	    ;;
6667240a9a23Smbalmer	  esac
6668240a9a23Smbalmer	  # Do a test to see if this is a libtool program.
6669240a9a23Smbalmer	  if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
6670240a9a23Smbalmer	    relink_command=
6671240a9a23Smbalmer	    . $dir/$noexename
6672240a9a23Smbalmer
6673240a9a23Smbalmer	    # note $name still contains .exe if it was in $file originally
6674240a9a23Smbalmer	    # as does the version of $file that was added into $rmfiles
6675240a9a23Smbalmer	    rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}"
6676240a9a23Smbalmer	    if test "$fast_install" = yes && test -n "$relink_command"; then
6677240a9a23Smbalmer	      rmfiles="$rmfiles $objdir/lt-$name"
6678240a9a23Smbalmer	    fi
6679240a9a23Smbalmer	    if test "X$noexename" != "X$name" ; then
6680240a9a23Smbalmer	      rmfiles="$rmfiles $objdir/lt-${noexename}.c"
6681240a9a23Smbalmer	    fi
6682240a9a23Smbalmer	  fi
6683240a9a23Smbalmer	fi
6684240a9a23Smbalmer	;;
6685240a9a23Smbalmer      esac
6686240a9a23Smbalmer      $show "$rm $rmfiles"
6687240a9a23Smbalmer      $run $rm $rmfiles || exit_status=1
6688240a9a23Smbalmer    done
6689240a9a23Smbalmer    objdir="$origobjdir"
6690240a9a23Smbalmer
6691240a9a23Smbalmer    # Try to remove the ${objdir}s in the directories where we deleted files
6692240a9a23Smbalmer    for dir in $rmdirs; do
6693240a9a23Smbalmer      if test -d "$dir"; then
6694240a9a23Smbalmer	$show "rmdir $dir"
6695240a9a23Smbalmer	$run rmdir $dir >/dev/null 2>&1
6696240a9a23Smbalmer      fi
6697240a9a23Smbalmer    done
6698240a9a23Smbalmer
6699240a9a23Smbalmer    exit $exit_status
6700240a9a23Smbalmer    ;;
6701240a9a23Smbalmer
6702240a9a23Smbalmer  "")
6703240a9a23Smbalmer    $echo "$modename: you must specify a MODE" 1>&2
6704240a9a23Smbalmer    $echo "$generic_help" 1>&2
6705240a9a23Smbalmer    exit $EXIT_FAILURE
6706240a9a23Smbalmer    ;;
6707240a9a23Smbalmer  esac
6708240a9a23Smbalmer
6709240a9a23Smbalmer  if test -z "$exec_cmd"; then
6710240a9a23Smbalmer    $echo "$modename: invalid operation mode \`$mode'" 1>&2
6711240a9a23Smbalmer    $echo "$generic_help" 1>&2
6712240a9a23Smbalmer    exit $EXIT_FAILURE
6713240a9a23Smbalmer  fi
6714240a9a23Smbalmerfi # test -z "$show_help"
6715240a9a23Smbalmer
6716240a9a23Smbalmerif test -n "$exec_cmd"; then
6717240a9a23Smbalmer  eval exec $exec_cmd
6718240a9a23Smbalmer  exit $EXIT_FAILURE
6719240a9a23Smbalmerfi
6720240a9a23Smbalmer
6721240a9a23Smbalmer# We need to display help for each of the modes.
6722240a9a23Smbalmercase $mode in
6723240a9a23Smbalmer"") $echo \
6724240a9a23Smbalmer"Usage: $modename [OPTION]... [MODE-ARG]...
6725240a9a23Smbalmer
6726240a9a23SmbalmerProvide generalized library-building support services.
6727240a9a23Smbalmer
6728240a9a23Smbalmer    --config          show all configuration variables
6729240a9a23Smbalmer    --debug           enable verbose shell tracing
6730240a9a23Smbalmer-n, --dry-run         display commands without modifying any files
6731240a9a23Smbalmer    --features        display basic configuration information and exit
6732240a9a23Smbalmer    --finish          same as \`--mode=finish'
6733240a9a23Smbalmer    --help            display this help message and exit
6734240a9a23Smbalmer    --mode=MODE       use operation mode MODE [default=inferred from MODE-ARGS]
6735240a9a23Smbalmer    --quiet           same as \`--silent'
6736240a9a23Smbalmer    --silent          don't print informational messages
6737240a9a23Smbalmer    --tag=TAG         use configuration variables from tag TAG
6738240a9a23Smbalmer    --version         print version information
6739240a9a23Smbalmer
6740240a9a23SmbalmerMODE must be one of the following:
6741240a9a23Smbalmer
6742240a9a23Smbalmer      clean           remove files from the build directory
6743240a9a23Smbalmer      compile         compile a source file into a libtool object
6744240a9a23Smbalmer      execute         automatically set library path, then run a program
6745240a9a23Smbalmer      finish          complete the installation of libtool libraries
6746240a9a23Smbalmer      install         install libraries or executables
6747240a9a23Smbalmer      link            create a library or an executable
6748240a9a23Smbalmer      uninstall       remove libraries from an installed directory
6749240a9a23Smbalmer
6750240a9a23SmbalmerMODE-ARGS vary depending on the MODE.  Try \`$modename --help --mode=MODE' for
6751240a9a23Smbalmera more detailed description of MODE.
6752240a9a23Smbalmer
6753240a9a23SmbalmerReport bugs to <bug-libtool@gnu.org>."
6754240a9a23Smbalmer  exit $EXIT_SUCCESS
6755240a9a23Smbalmer  ;;
6756240a9a23Smbalmer
6757240a9a23Smbalmerclean)
6758240a9a23Smbalmer  $echo \
6759240a9a23Smbalmer"Usage: $modename [OPTION]... --mode=clean RM [RM-OPTION]... FILE...
6760240a9a23Smbalmer
6761240a9a23SmbalmerRemove files from the build directory.
6762240a9a23Smbalmer
6763240a9a23SmbalmerRM is the name of the program to use to delete files associated with each FILE
6764240a9a23Smbalmer(typically \`/bin/rm').  RM-OPTIONS are options (such as \`-f') to be passed
6765240a9a23Smbalmerto RM.
6766240a9a23Smbalmer
6767240a9a23SmbalmerIf FILE is a libtool library, object or program, all the files associated
6768240a9a23Smbalmerwith it are deleted. Otherwise, only FILE itself is deleted using RM."
6769240a9a23Smbalmer  ;;
6770240a9a23Smbalmer
6771240a9a23Smbalmercompile)
6772240a9a23Smbalmer  $echo \
6773240a9a23Smbalmer"Usage: $modename [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE
6774240a9a23Smbalmer
6775240a9a23SmbalmerCompile a source file into a libtool library object.
6776240a9a23Smbalmer
6777240a9a23SmbalmerThis mode accepts the following additional options:
6778240a9a23Smbalmer
6779240a9a23Smbalmer  -o OUTPUT-FILE    set the output file name to OUTPUT-FILE
6780240a9a23Smbalmer  -prefer-pic       try to building PIC objects only
6781240a9a23Smbalmer  -prefer-non-pic   try to building non-PIC objects only
6782240a9a23Smbalmer  -static           always build a \`.o' file suitable for static linking
6783240a9a23Smbalmer
6784240a9a23SmbalmerCOMPILE-COMMAND is a command to be used in creating a \`standard' object file
6785240a9a23Smbalmerfrom the given SOURCEFILE.
6786240a9a23Smbalmer
6787240a9a23SmbalmerThe output file name is determined by removing the directory component from
6788240a9a23SmbalmerSOURCEFILE, then substituting the C source code suffix \`.c' with the
6789240a9a23Smbalmerlibrary object suffix, \`.lo'."
6790240a9a23Smbalmer  ;;
6791240a9a23Smbalmer
6792240a9a23Smbalmerexecute)
6793240a9a23Smbalmer  $echo \
6794240a9a23Smbalmer"Usage: $modename [OPTION]... --mode=execute COMMAND [ARGS]...
6795240a9a23Smbalmer
6796240a9a23SmbalmerAutomatically set library path, then run a program.
6797240a9a23Smbalmer
6798240a9a23SmbalmerThis mode accepts the following additional options:
6799240a9a23Smbalmer
6800240a9a23Smbalmer  -dlopen FILE      add the directory containing FILE to the library path
6801240a9a23Smbalmer
6802240a9a23SmbalmerThis mode sets the library path environment variable according to \`-dlopen'
6803240a9a23Smbalmerflags.
6804240a9a23Smbalmer
6805240a9a23SmbalmerIf any of the ARGS are libtool executable wrappers, then they are translated
6806240a9a23Smbalmerinto their corresponding uninstalled binary, and any of their required library
6807240a9a23Smbalmerdirectories are added to the library path.
6808240a9a23Smbalmer
6809240a9a23SmbalmerThen, COMMAND is executed, with ARGS as arguments."
6810240a9a23Smbalmer  ;;
6811240a9a23Smbalmer
6812240a9a23Smbalmerfinish)
6813240a9a23Smbalmer  $echo \
6814240a9a23Smbalmer"Usage: $modename [OPTION]... --mode=finish [LIBDIR]...
6815240a9a23Smbalmer
6816240a9a23SmbalmerComplete the installation of libtool libraries.
6817240a9a23Smbalmer
6818240a9a23SmbalmerEach LIBDIR is a directory that contains libtool libraries.
6819240a9a23Smbalmer
6820240a9a23SmbalmerThe commands that this mode executes may require superuser privileges.  Use
6821240a9a23Smbalmerthe \`--dry-run' option if you just want to see what would be executed."
6822240a9a23Smbalmer  ;;
6823240a9a23Smbalmer
6824240a9a23Smbalmerinstall)
6825240a9a23Smbalmer  $echo \
6826240a9a23Smbalmer"Usage: $modename [OPTION]... --mode=install INSTALL-COMMAND...
6827240a9a23Smbalmer
6828240a9a23SmbalmerInstall executables or libraries.
6829240a9a23Smbalmer
6830240a9a23SmbalmerINSTALL-COMMAND is the installation command.  The first component should be
6831240a9a23Smbalmereither the \`install' or \`cp' program.
6832240a9a23Smbalmer
6833240a9a23SmbalmerThe rest of the components are interpreted as arguments to that command (only
6834240a9a23SmbalmerBSD-compatible install options are recognized)."
6835240a9a23Smbalmer  ;;
6836240a9a23Smbalmer
6837240a9a23Smbalmerlink)
6838240a9a23Smbalmer  $echo \
6839240a9a23Smbalmer"Usage: $modename [OPTION]... --mode=link LINK-COMMAND...
6840240a9a23Smbalmer
6841240a9a23SmbalmerLink object files or libraries together to form another library, or to
6842240a9a23Smbalmercreate an executable program.
6843240a9a23Smbalmer
6844240a9a23SmbalmerLINK-COMMAND is a command using the C compiler that you would use to create
6845240a9a23Smbalmera program from several object files.
6846240a9a23Smbalmer
6847240a9a23SmbalmerThe following components of LINK-COMMAND are treated specially:
6848240a9a23Smbalmer
6849240a9a23Smbalmer  -all-static       do not do any dynamic linking at all
6850240a9a23Smbalmer  -avoid-version    do not add a version suffix if possible
6851240a9a23Smbalmer  -dlopen FILE      \`-dlpreopen' FILE if it cannot be dlopened at runtime
6852240a9a23Smbalmer  -dlpreopen FILE   link in FILE and add its symbols to lt_preloaded_symbols
6853240a9a23Smbalmer  -export-dynamic   allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
6854240a9a23Smbalmer  -export-symbols SYMFILE
6855240a9a23Smbalmer                    try to export only the symbols listed in SYMFILE
6856240a9a23Smbalmer  -export-symbols-regex REGEX
6857240a9a23Smbalmer                    try to export only the symbols matching REGEX
6858240a9a23Smbalmer  -LLIBDIR          search LIBDIR for required installed libraries
6859240a9a23Smbalmer  -lNAME            OUTPUT-FILE requires the installed library libNAME
6860240a9a23Smbalmer  -module           build a library that can dlopened
6861240a9a23Smbalmer  -no-fast-install  disable the fast-install mode
6862240a9a23Smbalmer  -no-install       link a not-installable executable
6863240a9a23Smbalmer  -no-undefined     declare that a library does not refer to external symbols
6864240a9a23Smbalmer  -o OUTPUT-FILE    create OUTPUT-FILE from the specified objects
6865240a9a23Smbalmer  -objectlist FILE  Use a list of object files found in FILE to specify objects
6866240a9a23Smbalmer  -precious-files-regex REGEX
6867240a9a23Smbalmer                    don't remove output files matching REGEX
6868240a9a23Smbalmer  -release RELEASE  specify package release information
6869240a9a23Smbalmer  -rpath LIBDIR     the created library will eventually be installed in LIBDIR
6870240a9a23Smbalmer  -R[ ]LIBDIR       add LIBDIR to the runtime path of programs and libraries
6871240a9a23Smbalmer  -static           do not do any dynamic linking of uninstalled libtool libraries
6872240a9a23Smbalmer  -static-libtool-libs
6873240a9a23Smbalmer                    do not do any dynamic linking of libtool libraries
6874240a9a23Smbalmer  -version-info CURRENT[:REVISION[:AGE]]
6875240a9a23Smbalmer                    specify library version info [each variable defaults to 0]
6876240a9a23Smbalmer
6877240a9a23SmbalmerAll other options (arguments beginning with \`-') are ignored.
6878240a9a23Smbalmer
6879240a9a23SmbalmerEvery other argument is treated as a filename.  Files ending in \`.la' are
6880240a9a23Smbalmertreated as uninstalled libtool libraries, other files are standard or library
6881240a9a23Smbalmerobject files.
6882240a9a23Smbalmer
6883240a9a23SmbalmerIf the OUTPUT-FILE ends in \`.la', then a libtool library is created,
6884240a9a23Smbalmeronly library objects (\`.lo' files) may be specified, and \`-rpath' is
6885240a9a23Smbalmerrequired, except when creating a convenience library.
6886240a9a23Smbalmer
6887240a9a23SmbalmerIf OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created
6888240a9a23Smbalmerusing \`ar' and \`ranlib', or on Windows using \`lib'.
6889240a9a23Smbalmer
6890240a9a23SmbalmerIf OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file
6891240a9a23Smbalmeris created, otherwise an executable program is created."
6892240a9a23Smbalmer  ;;
6893240a9a23Smbalmer
6894240a9a23Smbalmeruninstall)
6895240a9a23Smbalmer  $echo \
6896240a9a23Smbalmer"Usage: $modename [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE...
6897240a9a23Smbalmer
6898240a9a23SmbalmerRemove libraries from an installation directory.
6899240a9a23Smbalmer
6900240a9a23SmbalmerRM is the name of the program to use to delete files associated with each FILE
6901240a9a23Smbalmer(typically \`/bin/rm').  RM-OPTIONS are options (such as \`-f') to be passed
6902240a9a23Smbalmerto RM.
6903240a9a23Smbalmer
6904240a9a23SmbalmerIf FILE is a libtool library, all the files associated with it are deleted.
6905240a9a23SmbalmerOtherwise, only FILE itself is deleted using RM."
6906240a9a23Smbalmer  ;;
6907240a9a23Smbalmer
6908240a9a23Smbalmer*)
6909240a9a23Smbalmer  $echo "$modename: invalid operation mode \`$mode'" 1>&2
6910240a9a23Smbalmer  $echo "$help" 1>&2
6911240a9a23Smbalmer  exit $EXIT_FAILURE
6912240a9a23Smbalmer  ;;
6913240a9a23Smbalmeresac
6914240a9a23Smbalmer
6915240a9a23Smbalmer$echo
6916240a9a23Smbalmer$echo "Try \`$modename --help' for more information about other modes."
6917240a9a23Smbalmer
6918240a9a23Smbalmerexit $?
6919240a9a23Smbalmer
6920240a9a23Smbalmer# The TAGs below are defined such that we never get into a situation
6921240a9a23Smbalmer# in which we disable both kinds of libraries.  Given conflicting
6922240a9a23Smbalmer# choices, we go for a static library, that is the most portable,
6923240a9a23Smbalmer# since we can't tell whether shared libraries were disabled because
6924240a9a23Smbalmer# the user asked for that or because the platform doesn't support
6925240a9a23Smbalmer# them.  This is particularly important on AIX, because we don't
6926240a9a23Smbalmer# support having both static and shared libraries enabled at the same
6927240a9a23Smbalmer# time on that platform, so we default to a shared-only configuration.
6928240a9a23Smbalmer# If a disable-shared tag is given, we'll fallback to a static-only
6929240a9a23Smbalmer# configuration.  But we'll never go from static-only to shared-only.
6930240a9a23Smbalmer
6931240a9a23Smbalmer# ### BEGIN LIBTOOL TAG CONFIG: disable-shared
6932240a9a23Smbalmerdisable_libs=shared
6933240a9a23Smbalmer# ### END LIBTOOL TAG CONFIG: disable-shared
6934240a9a23Smbalmer
6935240a9a23Smbalmer# ### BEGIN LIBTOOL TAG CONFIG: disable-static
6936240a9a23Smbalmerdisable_libs=static
6937240a9a23Smbalmer# ### END LIBTOOL TAG CONFIG: disable-static
6938240a9a23Smbalmer
6939240a9a23Smbalmer# Local Variables:
6940240a9a23Smbalmer# mode:shell-script
6941240a9a23Smbalmer# sh-indentation:2
6942240a9a23Smbalmer# End:
6943