xref: /netbsd-src/external/gpl3/gdb.old/dist/gdb/libtool (revision 6881a4007f077b54e5f51159c52b9b25f57deb0d)
1*6881a400Schristos#! /bin/bash
2*6881a400Schristos
3*6881a400Schristos# libtool - Provide generalized library-building support services.
4*6881a400Schristos# Generated automatically by config.status (gdb)
5*6881a400Schristos# Libtool was configured on host takamaka:
6*6881a400Schristos# NOTE: Changes made to this file will be lost: look at ltmain.sh.
7*6881a400Schristos#
8*6881a400Schristos#   Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005,
9*6881a400Schristos#                 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
10*6881a400Schristos#   Written by Gordon Matzigkeit, 1996
11*6881a400Schristos#
12*6881a400Schristos#   This file is part of GNU Libtool.
13*6881a400Schristos#
14*6881a400Schristos# GNU Libtool is free software; you can redistribute it and/or
15*6881a400Schristos# modify it under the terms of the GNU General Public License as
16*6881a400Schristos# published by the Free Software Foundation; either version 2 of
17*6881a400Schristos# the License, or (at your option) any later version.
18*6881a400Schristos#
19*6881a400Schristos# As a special exception to the GNU General Public License,
20*6881a400Schristos# if you distribute this file as part of a program or library that
21*6881a400Schristos# is built using GNU Libtool, you may include this file under the
22*6881a400Schristos# same distribution terms that you use for the rest of that program.
23*6881a400Schristos#
24*6881a400Schristos# GNU Libtool is distributed in the hope that it will be useful,
25*6881a400Schristos# but WITHOUT ANY WARRANTY; without even the implied warranty of
26*6881a400Schristos# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
27*6881a400Schristos# GNU General Public License for more details.
28*6881a400Schristos#
29*6881a400Schristos# You should have received a copy of the GNU General Public License
30*6881a400Schristos# along with GNU Libtool; see the file COPYING.  If not, a copy
31*6881a400Schristos# can be downloaded from http://www.gnu.org/licenses/gpl.html, or
32*6881a400Schristos# obtained by writing to the Free Software Foundation, Inc.,
33*6881a400Schristos# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
34*6881a400Schristos
35*6881a400Schristos
36*6881a400Schristos# The names of the tagged configurations supported by this script.
37*6881a400Schristosavailable_tags="CXX "
38*6881a400Schristos
39*6881a400Schristos# ### BEGIN LIBTOOL CONFIG
40*6881a400Schristos
41*6881a400Schristos# Which release of libtool.m4 was used?
42*6881a400Schristosmacro_version=2.2.7a
43*6881a400Schristosmacro_revision=1.3134
44*6881a400Schristos
45*6881a400Schristos# Whether or not to build shared libraries.
46*6881a400Schristosbuild_libtool_libs=yes
47*6881a400Schristos
48*6881a400Schristos# Whether or not to build static libraries.
49*6881a400Schristosbuild_old_libs=yes
50*6881a400Schristos
51*6881a400Schristos# What type of objects to build.
52*6881a400Schristospic_mode=default
53*6881a400Schristos
54*6881a400Schristos# Whether or not to optimize for fast installation.
55*6881a400Schristosfast_install=needless
56*6881a400Schristos
57*6881a400Schristos# Shell to use when invoking shell scripts.
58*6881a400SchristosSHELL="/bin/bash"
59*6881a400Schristos
60*6881a400Schristos# An echo program that protects backslashes.
61*6881a400SchristosECHO="printf %s\\n"
62*6881a400Schristos
63*6881a400Schristos# The host system.
64*6881a400Schristoshost_alias=x86_64-pc-linux-gnu
65*6881a400Schristoshost=x86_64-pc-linux-gnu
66*6881a400Schristoshost_os=linux-gnu
67*6881a400Schristos
68*6881a400Schristos# The build system.
69*6881a400Schristosbuild_alias=x86_64-pc-linux-gnu
70*6881a400Schristosbuild=x86_64-pc-linux-gnu
71*6881a400Schristosbuild_os=linux-gnu
72*6881a400Schristos
73*6881a400Schristos# A sed program that does not truncate output.
74*6881a400SchristosSED="/usr/bin/sed"
75*6881a400Schristos
76*6881a400Schristos# Sed that helps us avoid accidentally triggering echo(1) options like -n.
77*6881a400SchristosXsed="$SED -e 1s/^X//"
78*6881a400Schristos
79*6881a400Schristos# A grep program that handles long lines.
80*6881a400SchristosGREP="/usr/bin/grep"
81*6881a400Schristos
82*6881a400Schristos# An ERE matcher.
83*6881a400SchristosEGREP="/usr/bin/grep -E"
84*6881a400Schristos
85*6881a400Schristos# A literal string matcher.
86*6881a400SchristosFGREP="/usr/bin/grep -F"
87*6881a400Schristos
88*6881a400Schristos# A BSD- or MS-compatible name lister.
89*6881a400SchristosNM="/usr/bin/nm -B"
90*6881a400Schristos
91*6881a400Schristos# Whether we need soft or hard links.
92*6881a400SchristosLN_S="ln -s"
93*6881a400Schristos
94*6881a400Schristos# What is the maximum length of a command?
95*6881a400Schristosmax_cmd_len=1572864
96*6881a400Schristos
97*6881a400Schristos# Object file suffix (normally "o").
98*6881a400Schristosobjext=o
99*6881a400Schristos
100*6881a400Schristos# Executable file suffix (normally "").
101*6881a400Schristosexeext=
102*6881a400Schristos
103*6881a400Schristos# whether the shell understands "unset".
104*6881a400Schristoslt_unset=unset
105*6881a400Schristos
106*6881a400Schristos# turn spaces into newlines.
107*6881a400SchristosSP2NL="tr \\040 \\012"
108*6881a400Schristos
109*6881a400Schristos# turn newlines into spaces.
110*6881a400SchristosNL2SP="tr \\015\\012 \\040\\040"
111*6881a400Schristos
112*6881a400Schristos# An object symbol dumper.
113*6881a400SchristosOBJDUMP="objdump"
114*6881a400Schristos
115*6881a400Schristos# Method to check whether dependent libraries are shared objects.
116*6881a400Schristosdeplibs_check_method="pass_all"
117*6881a400Schristos
118*6881a400Schristos# Command to use when deplibs_check_method == "file_magic".
119*6881a400Schristosfile_magic_cmd="\$MAGIC_CMD"
120*6881a400Schristos
121*6881a400Schristos# The archiver.
122*6881a400SchristosAR="ar --plugin /usr/lib/gcc/x86_64-linux-gnu/11/liblto_plugin.so"
123*6881a400SchristosAR_FLAGS="cru"
124*6881a400Schristos
125*6881a400Schristos# A symbol stripping program.
126*6881a400SchristosSTRIP="strip"
127*6881a400Schristos
128*6881a400Schristos# Commands used to install an old-style archive.
129*6881a400SchristosRANLIB="ranlib --plugin /usr/lib/gcc/x86_64-linux-gnu/11/liblto_plugin.so"
130*6881a400Schristosold_postinstall_cmds="chmod 644 \$oldlib~\$RANLIB \$oldlib"
131*6881a400Schristosold_postuninstall_cmds=""
132*6881a400Schristos
133*6881a400Schristos# Whether to use a lock for old archive extraction.
134*6881a400Schristoslock_old_archive_extraction=no
135*6881a400Schristos
136*6881a400Schristos# A C compiler.
137*6881a400SchristosLTCC="gcc"
138*6881a400Schristos
139*6881a400Schristos# LTCC compiler flags.
140*6881a400SchristosLTCFLAGS="-g -O2  "
141*6881a400Schristos
142*6881a400Schristos# Take the output of nm and produce a listing of raw symbols and C names.
143*6881a400Schristosglobal_symbol_pipe="sed -n -e 's/^.*[	 ]\\([ABCDGIRSTW][ABCDGIRSTW]*\\)[	 ][	 ]*\\([_A-Za-z][_A-Za-z0-9]*\\)\$/\\1 \\2 \\2/p'"
144*6881a400Schristos
145*6881a400Schristos# Transform the output of nm in a proper C declaration.
146*6881a400Schristosglobal_symbol_to_cdecl="sed -n -e 's/^T .* \\(.*\\)\$/extern int \\1();/p' -e 's/^[ABCDGIRSTW]* .* \\(.*\\)\$/extern char \\1;/p'"
147*6881a400Schristos
148*6881a400Schristos# Transform the output of nm in a C name address pair.
149*6881a400Schristosglobal_symbol_to_c_name_address="sed -n -e 's/^: \\([^ ]*\\) \$/  {\\\"\\1\\\", (void *) 0},/p' -e 's/^[ABCDGIRSTW]* \\([^ ]*\\) \\([^ ]*\\)\$/  {\"\\2\", (void *) \\&\\2},/p'"
150*6881a400Schristos
151*6881a400Schristos# Transform the output of nm in a C name address pair when lib prefix is needed.
152*6881a400Schristosglobal_symbol_to_c_name_address_lib_prefix="sed -n -e 's/^: \\([^ ]*\\) \$/  {\\\"\\1\\\", (void *) 0},/p' -e 's/^[ABCDGIRSTW]* \\([^ ]*\\) \\(lib[^ ]*\\)\$/  {\"\\2\", (void *) \\&\\2},/p' -e 's/^[ABCDGIRSTW]* \\([^ ]*\\) \\([^ ]*\\)\$/  {\"lib\\2\", (void *) \\&\\2},/p'"
153*6881a400Schristos
154*6881a400Schristos# The name of the directory that contains temporary libtool files.
155*6881a400Schristosobjdir=.libs
156*6881a400Schristos
157*6881a400Schristos# Used to examine libraries when file_magic_cmd begins with "file".
158*6881a400SchristosMAGIC_CMD=file
159*6881a400Schristos
160*6881a400Schristos# Must we lock files when doing compilation?
161*6881a400Schristosneed_locks="no"
162*6881a400Schristos
163*6881a400Schristos# Tool to manipulate archived DWARF debug symbol files on Mac OS X.
164*6881a400SchristosDSYMUTIL="dsymutil"
165*6881a400Schristos
166*6881a400Schristos# Tool to change global to local symbols on Mac OS X.
167*6881a400SchristosNMEDIT=""
168*6881a400Schristos
169*6881a400Schristos# Tool to manipulate fat objects and archives on Mac OS X.
170*6881a400SchristosLIPO=""
171*6881a400Schristos
172*6881a400Schristos# ldd/readelf like tool for Mach-O binaries on Mac OS X.
173*6881a400SchristosOTOOL="otool"
174*6881a400Schristos
175*6881a400Schristos# ldd/readelf like tool for 64 bit Mach-O binaries on Mac OS X 10.4.
176*6881a400SchristosOTOOL64=""
177*6881a400Schristos
178*6881a400Schristos# Old archive suffix (normally "a").
179*6881a400Schristoslibext=a
180*6881a400Schristos
181*6881a400Schristos# Shared library suffix (normally ".so").
182*6881a400Schristosshrext_cmds=".so"
183*6881a400Schristos
184*6881a400Schristos# The commands to extract the exported symbol list from a shared archive.
185*6881a400Schristosextract_expsyms_cmds=""
186*6881a400Schristos
187*6881a400Schristos# Variables whose values should be saved in libtool wrapper scripts and
188*6881a400Schristos# restored at link time.
189*6881a400Schristosvariables_saved_for_relink="PATH LD_LIBRARY_PATH LD_RUN_PATH GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH"
190*6881a400Schristos
191*6881a400Schristos# Do we need the "lib" prefix for modules?
192*6881a400Schristosneed_lib_prefix=no
193*6881a400Schristos
194*6881a400Schristos# Do we need a version for libraries?
195*6881a400Schristosneed_version=no
196*6881a400Schristos
197*6881a400Schristos# Library versioning type.
198*6881a400Schristosversion_type=linux
199*6881a400Schristos
200*6881a400Schristos# Shared library runtime path variable.
201*6881a400Schristosrunpath_var=LD_RUN_PATH
202*6881a400Schristos
203*6881a400Schristos# Shared library path variable.
204*6881a400Schristosshlibpath_var=LD_LIBRARY_PATH
205*6881a400Schristos
206*6881a400Schristos# Is shlibpath searched before the hard-coded library search path?
207*6881a400Schristosshlibpath_overrides_runpath=yes
208*6881a400Schristos
209*6881a400Schristos# Format of library name prefix.
210*6881a400Schristoslibname_spec="lib\$name"
211*6881a400Schristos
212*6881a400Schristos# List of archive names.  First name is the real one, the rest are links.
213*6881a400Schristos# The last name is the one that the linker finds with -lNAME
214*6881a400Schristoslibrary_names_spec="\${libname}\${release}\${shared_ext}\$versuffix \${libname}\${release}\${shared_ext}\$major \$libname\${shared_ext}"
215*6881a400Schristos
216*6881a400Schristos# The coded name of the library, if different from the real name.
217*6881a400Schristossoname_spec="\${libname}\${release}\${shared_ext}\$major"
218*6881a400Schristos
219*6881a400Schristos# Permission mode override for installation of shared libraries.
220*6881a400Schristosinstall_override_mode=""
221*6881a400Schristos
222*6881a400Schristos# Command to use after installation of a shared archive.
223*6881a400Schristospostinstall_cmds=""
224*6881a400Schristos
225*6881a400Schristos# Command to use after uninstallation of a shared archive.
226*6881a400Schristospostuninstall_cmds=""
227*6881a400Schristos
228*6881a400Schristos# Commands used to finish a libtool library installation in a directory.
229*6881a400Schristosfinish_cmds="PATH=\\\"\\\$PATH:/sbin\\\" ldconfig -n \$libdir"
230*6881a400Schristos
231*6881a400Schristos# As "finish_cmds", except a single script fragment to be evaled but
232*6881a400Schristos# not shown.
233*6881a400Schristosfinish_eval=""
234*6881a400Schristos
235*6881a400Schristos# Whether we should hardcode library paths into libraries.
236*6881a400Schristoshardcode_into_libs=yes
237*6881a400Schristos
238*6881a400Schristos# Compile-time system search path for libraries.
239*6881a400Schristossys_lib_search_path_spec="/usr/lib/gcc/x86_64-linux-gnu/11 /usr/lib/x86_64-linux-gnu /usr/lib /lib/x86_64-linux-gnu /lib "
240*6881a400Schristos
241*6881a400Schristos# Run-time system search path for libraries.
242*6881a400Schristossys_lib_dlsearch_path_spec="/lib /usr/lib /usr/lib/x86_64-linux-gnu/libfakeroot /usr/local/lib/i386-linux-gnu /lib/i386-linux-gnu /usr/lib/i386-linux-gnu /usr/local/lib/i686-linux-gnu /lib/i686-linux-gnu /usr/lib/i686-linux-gnu /usr/local/lib /usr/local/lib/x86_64-linux-gnu /lib/x86_64-linux-gnu /usr/lib/x86_64-linux-gnu /lib32 /usr/lib32 /libx32 /usr/libx32 "
243*6881a400Schristos
244*6881a400Schristos# Whether dlopen is supported.
245*6881a400Schristosdlopen_support=unknown
246*6881a400Schristos
247*6881a400Schristos# Whether dlopen of programs is supported.
248*6881a400Schristosdlopen_self=unknown
249*6881a400Schristos
250*6881a400Schristos# Whether dlopen of statically linked programs is supported.
251*6881a400Schristosdlopen_self_static=unknown
252*6881a400Schristos
253*6881a400Schristos# Commands to strip libraries.
254*6881a400Schristosold_striplib="strip --strip-debug"
255*6881a400Schristosstriplib="strip --strip-unneeded"
256*6881a400Schristos
257*6881a400Schristos
258*6881a400Schristos# The linker used to build libraries.
259*6881a400SchristosLD="ld -m elf_x86_64"
260*6881a400Schristos
261*6881a400Schristos# How to create reloadable object files.
262*6881a400Schristosreload_flag=" -r"
263*6881a400Schristosreload_cmds="\$LD\$reload_flag -o \$output\$reload_objs"
264*6881a400Schristos
265*6881a400Schristos# Commands used to build an old-style archive.
266*6881a400Schristosold_archive_cmds="\$AR \$AR_FLAGS \$oldlib\$oldobjs~\$RANLIB \$oldlib"
267*6881a400Schristos
268*6881a400Schristos# A language specific compiler.
269*6881a400SchristosCC="gcc"
270*6881a400Schristos
271*6881a400Schristos# Is the compiler the GNU compiler?
272*6881a400Schristoswith_gcc=yes
273*6881a400Schristos
274*6881a400Schristos# Compiler flag to turn off builtin functions.
275*6881a400Schristosno_builtin_flag=" -fno-builtin"
276*6881a400Schristos
277*6881a400Schristos# How to pass a linker flag through the compiler.
278*6881a400Schristoswl="-Wl,"
279*6881a400Schristos
280*6881a400Schristos# Additional compiler flags for building library objects.
281*6881a400Schristospic_flag=" -fPIC -DPIC"
282*6881a400Schristos
283*6881a400Schristos# Compiler flag to prevent dynamic linking.
284*6881a400Schristoslink_static_flag="-static"
285*6881a400Schristos
286*6881a400Schristos# Does compiler simultaneously support -c and -o options?
287*6881a400Schristoscompiler_c_o="yes"
288*6881a400Schristos
289*6881a400Schristos# Whether or not to add -lc for building shared libraries.
290*6881a400Schristosbuild_libtool_need_lc=no
291*6881a400Schristos
292*6881a400Schristos# Whether or not to disallow shared libs when runtime libs are static.
293*6881a400Schristosallow_libtool_libs_with_static_runtimes=no
294*6881a400Schristos
295*6881a400Schristos# Compiler flag to allow reflexive dlopens.
296*6881a400Schristosexport_dynamic_flag_spec="\${wl}--export-dynamic"
297*6881a400Schristos
298*6881a400Schristos# Compiler flag to generate shared objects directly from archives.
299*6881a400Schristoswhole_archive_flag_spec="\${wl}--whole-archive\$convenience \${wl}--no-whole-archive"
300*6881a400Schristos
301*6881a400Schristos# Whether the compiler copes with passing no objects directly.
302*6881a400Schristoscompiler_needs_object="no"
303*6881a400Schristos
304*6881a400Schristos# Create an old-style archive from a shared archive.
305*6881a400Schristosold_archive_from_new_cmds=""
306*6881a400Schristos
307*6881a400Schristos# Create a temporary old-style archive to link instead of a shared archive.
308*6881a400Schristosold_archive_from_expsyms_cmds=""
309*6881a400Schristos
310*6881a400Schristos# Commands used to build a shared archive.
311*6881a400Schristosarchive_cmds="\$CC -shared \$pic_flag \$libobjs \$deplibs \$compiler_flags \${wl}-soname \$wl\$soname -o \$lib"
312*6881a400Schristosarchive_expsym_cmds="echo \\\"{ global:\\\" > \$output_objdir/\$libname.ver~
313*6881a400Schristos	    cat \$export_symbols | sed -e \\\"s/\\\\(.*\\\\)/\\\\1;/\\\" >> \$output_objdir/\$libname.ver~
314*6881a400Schristos	    echo \\\"local: *; };\\\" >> \$output_objdir/\$libname.ver~
315*6881a400Schristos	    \$CC -shared \$pic_flag \$libobjs \$deplibs \$compiler_flags \${wl}-soname \$wl\$soname \${wl}-version-script \${wl}\$output_objdir/\$libname.ver -o \$lib"
316*6881a400Schristos
317*6881a400Schristos# Commands used to build a loadable module if different from building
318*6881a400Schristos# a shared archive.
319*6881a400Schristosmodule_cmds=""
320*6881a400Schristosmodule_expsym_cmds=""
321*6881a400Schristos
322*6881a400Schristos# Whether we are building with GNU ld or not.
323*6881a400Schristoswith_gnu_ld="yes"
324*6881a400Schristos
325*6881a400Schristos# Flag that allows shared libraries with undefined symbols to be built.
326*6881a400Schristosallow_undefined_flag=""
327*6881a400Schristos
328*6881a400Schristos# Flag that enforces no undefined symbols.
329*6881a400Schristosno_undefined_flag=""
330*6881a400Schristos
331*6881a400Schristos# Flag to hardcode $libdir into a binary during linking.
332*6881a400Schristos# This must work even if $libdir does not exist
333*6881a400Schristoshardcode_libdir_flag_spec="\${wl}-rpath \${wl}\$libdir"
334*6881a400Schristos
335*6881a400Schristos# If ld is used when linking, flag to hardcode $libdir into a binary
336*6881a400Schristos# during linking.  This must work even if $libdir does not exist.
337*6881a400Schristoshardcode_libdir_flag_spec_ld=""
338*6881a400Schristos
339*6881a400Schristos# Whether we need a single "-rpath" flag with a separated argument.
340*6881a400Schristoshardcode_libdir_separator=""
341*6881a400Schristos
342*6881a400Schristos# Set to "yes" if using DIR/libNAME${shared_ext} during linking hardcodes
343*6881a400Schristos# DIR into the resulting binary.
344*6881a400Schristoshardcode_direct=no
345*6881a400Schristos
346*6881a400Schristos# Set to "yes" if using DIR/libNAME${shared_ext} during linking hardcodes
347*6881a400Schristos# DIR into the resulting binary and the resulting library dependency is
348*6881a400Schristos# "absolute",i.e impossible to change by setting ${shlibpath_var} if the
349*6881a400Schristos# library is relocated.
350*6881a400Schristoshardcode_direct_absolute=no
351*6881a400Schristos
352*6881a400Schristos# Set to "yes" if using the -LDIR flag during linking hardcodes DIR
353*6881a400Schristos# into the resulting binary.
354*6881a400Schristoshardcode_minus_L=no
355*6881a400Schristos
356*6881a400Schristos# Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR
357*6881a400Schristos# into the resulting binary.
358*6881a400Schristoshardcode_shlibpath_var=unsupported
359*6881a400Schristos
360*6881a400Schristos# Set to "yes" if building a shared library automatically hardcodes DIR
361*6881a400Schristos# into the library and all subsequent libraries and executables linked
362*6881a400Schristos# against it.
363*6881a400Schristoshardcode_automatic=no
364*6881a400Schristos
365*6881a400Schristos# Set to yes if linker adds runtime paths of dependent libraries
366*6881a400Schristos# to runtime path list.
367*6881a400Schristosinherit_rpath=no
368*6881a400Schristos
369*6881a400Schristos# Whether libtool must link a program against all its dependency libraries.
370*6881a400Schristoslink_all_deplibs=unknown
371*6881a400Schristos
372*6881a400Schristos# Fix the shell variable $srcfile for the compiler.
373*6881a400Schristosfix_srcfile_path=""
374*6881a400Schristos
375*6881a400Schristos# Set to "yes" if exported symbols are required.
376*6881a400Schristosalways_export_symbols=no
377*6881a400Schristos
378*6881a400Schristos# The commands to list exported symbols.
379*6881a400Schristosexport_symbols_cmds="\$NM \$libobjs \$convenience | \$global_symbol_pipe | \$SED 's/.* //' | sort | uniq > \$export_symbols"
380*6881a400Schristos
381*6881a400Schristos# Symbols that should not be listed in the preloaded symbols.
382*6881a400Schristosexclude_expsyms="_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*"
383*6881a400Schristos
384*6881a400Schristos# Symbols that must always be exported.
385*6881a400Schristosinclude_expsyms=""
386*6881a400Schristos
387*6881a400Schristos# Commands necessary for linking programs (against libraries) with templates.
388*6881a400Schristosprelink_cmds=""
389*6881a400Schristos
390*6881a400Schristos# Specify filename containing input files.
391*6881a400Schristosfile_list_spec=""
392*6881a400Schristos
393*6881a400Schristos# How to hardcode a shared library path into an executable.
394*6881a400Schristoshardcode_action=immediate
395*6881a400Schristos
396*6881a400Schristos# The directories searched by this compiler when creating a shared library.
397*6881a400Schristoscompiler_lib_search_dirs=""
398*6881a400Schristos
399*6881a400Schristos# Dependencies to place before and after the objects being linked to
400*6881a400Schristos# create a shared library.
401*6881a400Schristospredep_objects=""
402*6881a400Schristospostdep_objects=""
403*6881a400Schristospredeps=""
404*6881a400Schristospostdeps=""
405*6881a400Schristos
406*6881a400Schristos# The library search path used internally by the compiler when linking
407*6881a400Schristos# a shared library.
408*6881a400Schristoscompiler_lib_search_path=""
409*6881a400Schristos
410*6881a400Schristos# ### END LIBTOOL CONFIG
411*6881a400Schristos
412*6881a400Schristos# Generated from ltmain.m4sh.
413*6881a400Schristos
414*6881a400Schristos# libtool (GNU libtool 1.3134 2009-11-29) 2.2.7a
415*6881a400Schristos# Written by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
416*6881a400Schristos
417*6881a400Schristos# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006,
418*6881a400Schristos# 2007, 2008, 2009 Free Software Foundation, Inc.
419*6881a400Schristos# This is free software; see the source for copying conditions.  There is NO
420*6881a400Schristos# warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
421*6881a400Schristos
422*6881a400Schristos# GNU Libtool is free software; you can redistribute it and/or modify
423*6881a400Schristos# it under the terms of the GNU General Public License as published by
424*6881a400Schristos# the Free Software Foundation; either version 2 of the License, or
425*6881a400Schristos# (at your option) any later version.
426*6881a400Schristos#
427*6881a400Schristos# As a special exception to the GNU General Public License,
428*6881a400Schristos# if you distribute this file as part of a program or library that
429*6881a400Schristos# is built using GNU Libtool, you may include this file under the
430*6881a400Schristos# same distribution terms that you use for the rest of that program.
431*6881a400Schristos#
432*6881a400Schristos# GNU Libtool is distributed in the hope that it will be useful, but
433*6881a400Schristos# WITHOUT ANY WARRANTY; without even the implied warranty of
434*6881a400Schristos# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
435*6881a400Schristos# General Public License for more details.
436*6881a400Schristos#
437*6881a400Schristos# You should have received a copy of the GNU General Public License
438*6881a400Schristos# along with GNU Libtool; see the file COPYING.  If not, a copy
439*6881a400Schristos# can be downloaded from http://www.gnu.org/licenses/gpl.html,
440*6881a400Schristos# or obtained by writing to the Free Software Foundation, Inc.,
441*6881a400Schristos# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
442*6881a400Schristos
443*6881a400Schristos# Usage: $progname [OPTION]... [MODE-ARG]...
444*6881a400Schristos#
445*6881a400Schristos# Provide generalized library-building support services.
446*6881a400Schristos#
447*6881a400Schristos#       --config             show all configuration variables
448*6881a400Schristos#       --debug              enable verbose shell tracing
449*6881a400Schristos#   -n, --dry-run            display commands without modifying any files
450*6881a400Schristos#       --features           display basic configuration information and exit
451*6881a400Schristos#       --mode=MODE          use operation mode MODE
452*6881a400Schristos#       --no-finish          let install mode avoid finish commands
453*6881a400Schristos#       --preserve-dup-deps  don't remove duplicate dependency libraries
454*6881a400Schristos#       --quiet, --silent    don't print informational messages
455*6881a400Schristos#       --no-quiet, --no-silent
456*6881a400Schristos#                            print informational messages (default)
457*6881a400Schristos#       --tag=TAG            use configuration variables from tag TAG
458*6881a400Schristos#   -v, --verbose            print more informational messages than default
459*6881a400Schristos#       --no-verbose         don't print the extra informational messages
460*6881a400Schristos#       --version            print version information
461*6881a400Schristos#   -h, --help, --help-all   print short, long, or detailed help message
462*6881a400Schristos#
463*6881a400Schristos# MODE must be one of the following:
464*6881a400Schristos#
465*6881a400Schristos#         clean              remove files from the build directory
466*6881a400Schristos#         compile            compile a source file into a libtool object
467*6881a400Schristos#         execute            automatically set library path, then run a program
468*6881a400Schristos#         finish             complete the installation of libtool libraries
469*6881a400Schristos#         install            install libraries or executables
470*6881a400Schristos#         link               create a library or an executable
471*6881a400Schristos#         uninstall          remove libraries from an installed directory
472*6881a400Schristos#
473*6881a400Schristos# MODE-ARGS vary depending on the MODE.  When passed as first option,
474*6881a400Schristos# `--mode=MODE' may be abbreviated as `MODE' or a unique abbreviation of that.
475*6881a400Schristos# Try `$progname --help --mode=MODE' for a more detailed description of MODE.
476*6881a400Schristos#
477*6881a400Schristos# When reporting a bug, please describe a test case to reproduce it and
478*6881a400Schristos# include the following information:
479*6881a400Schristos#
480*6881a400Schristos#         host-triplet:	$host
481*6881a400Schristos#         shell:		$SHELL
482*6881a400Schristos#         compiler:		$LTCC
483*6881a400Schristos#         compiler flags:		$LTCFLAGS
484*6881a400Schristos#         linker:		$LD (gnu? $with_gnu_ld)
485*6881a400Schristos#         $progname:	(GNU libtool 1.3134 2009-11-29) 2.2.7a
486*6881a400Schristos#         automake:	$automake_version
487*6881a400Schristos#         autoconf:	$autoconf_version
488*6881a400Schristos#
489*6881a400Schristos# Report bugs to <bug-libtool@gnu.org>.
490*6881a400Schristos
491*6881a400SchristosPROGRAM=libtool
492*6881a400SchristosPACKAGE=libtool
493*6881a400SchristosVERSION=2.2.7a
494*6881a400SchristosTIMESTAMP=" 1.3134 2009-11-29"
495*6881a400Schristospackage_revision=1.3134
496*6881a400Schristos
497*6881a400Schristos# Be Bourne compatible
498*6881a400Schristosif test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
499*6881a400Schristos  emulate sh
500*6881a400Schristos  NULLCMD=:
501*6881a400Schristos  # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
502*6881a400Schristos  # is contrary to our usage.  Disable this feature.
503*6881a400Schristos  alias -g '${1+"$@"}'='"$@"'
504*6881a400Schristos  setopt NO_GLOB_SUBST
505*6881a400Schristoselse
506*6881a400Schristos  case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac
507*6881a400Schristosfi
508*6881a400SchristosBIN_SH=xpg4; export BIN_SH # for Tru64
509*6881a400SchristosDUALCASE=1; export DUALCASE # for MKS sh
510*6881a400Schristos
511*6881a400Schristos# A function that is used when there is no print builtin or printf.
512*6881a400Schristosfunc_fallback_echo ()
513*6881a400Schristos{
514*6881a400Schristos  eval 'cat <<_LTECHO_EOF
515*6881a400Schristos$1
516*6881a400Schristos_LTECHO_EOF'
517*6881a400Schristos}
518*6881a400Schristos
519*6881a400Schristos# NLS nuisances: We save the old values to restore during execute mode.
520*6881a400Schristos# Only set LANG and LC_ALL to C if already set.
521*6881a400Schristos# These must not be set unconditionally because not all systems understand
522*6881a400Schristos# e.g. LANG=C (notably SCO).
523*6881a400Schristoslt_user_locale=
524*6881a400Schristoslt_safe_locale=
525*6881a400Schristosfor lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
526*6881a400Schristosdo
527*6881a400Schristos  eval "if test \"\${$lt_var+set}\" = set; then
528*6881a400Schristos          save_$lt_var=\$$lt_var
529*6881a400Schristos          $lt_var=C
530*6881a400Schristos	  export $lt_var
531*6881a400Schristos	  lt_user_locale=\"$lt_var=\\\$save_\$lt_var; \$lt_user_locale\"
532*6881a400Schristos	  lt_safe_locale=\"$lt_var=C; \$lt_safe_locale\"
533*6881a400Schristos	fi"
534*6881a400Schristosdone
535*6881a400Schristos
536*6881a400Schristos$lt_unset CDPATH
537*6881a400Schristos
538*6881a400Schristos
539*6881a400Schristos
540*6881a400Schristos
541*6881a400Schristos
542*6881a400Schristos
543*6881a400Schristos
544*6881a400Schristos# Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh
545*6881a400Schristos# is ksh but when the shell is invoked as "sh" and the current value of
546*6881a400Schristos# the _XPG environment variable is not equal to 1 (one), the special
547*6881a400Schristos# positional parameter $0, within a function call, is the name of the
548*6881a400Schristos# function.
549*6881a400Schristosprogpath="$0"
550*6881a400Schristos
551*6881a400Schristos
552*6881a400Schristos
553*6881a400Schristos: ${CP="cp -f"}
554*6881a400Schristos: ${ECHO=$as_echo}
555*6881a400Schristos: ${EGREP="/bin/grep -E"}
556*6881a400Schristos: ${FGREP="/bin/grep -F"}
557*6881a400Schristos: ${GREP="/bin/grep"}
558*6881a400Schristos: ${LN_S="ln -s"}
559*6881a400Schristos: ${MAKE="make"}
560*6881a400Schristos: ${MKDIR="mkdir"}
561*6881a400Schristos: ${MV="mv -f"}
562*6881a400Schristos: ${RM="rm -f"}
563*6881a400Schristos: ${SED="/mount/endor/wildenhu/local-x86_64/bin/sed"}
564*6881a400Schristos: ${SHELL="${CONFIG_SHELL-/bin/sh}"}
565*6881a400Schristos: ${Xsed="$SED -e 1s/^X//"}
566*6881a400Schristos
567*6881a400Schristos# Global variables:
568*6881a400SchristosEXIT_SUCCESS=0
569*6881a400SchristosEXIT_FAILURE=1
570*6881a400SchristosEXIT_MISMATCH=63  # $? = 63 is used to indicate version mismatch to missing.
571*6881a400SchristosEXIT_SKIP=77	  # $? = 77 is used to indicate a skipped test to automake.
572*6881a400Schristos
573*6881a400Schristosexit_status=$EXIT_SUCCESS
574*6881a400Schristos
575*6881a400Schristos# Make sure IFS has a sensible default
576*6881a400Schristoslt_nl='
577*6881a400Schristos'
578*6881a400SchristosIFS=" 	$lt_nl"
579*6881a400Schristos
580*6881a400Schristosdirname="s,/[^/]*$,,"
581*6881a400Schristosbasename="s,^.*/,,"
582*6881a400Schristos
583*6881a400Schristos# func_dirname_and_basename file append nondir_replacement
584*6881a400Schristos# perform func_basename and func_dirname in a single function
585*6881a400Schristos# call:
586*6881a400Schristos#   dirname:  Compute the dirname of FILE.  If nonempty,
587*6881a400Schristos#             add APPEND to the result, otherwise set result
588*6881a400Schristos#             to NONDIR_REPLACEMENT.
589*6881a400Schristos#             value returned in "$func_dirname_result"
590*6881a400Schristos#   basename: Compute filename of FILE.
591*6881a400Schristos#             value retuned in "$func_basename_result"
592*6881a400Schristos# Implementation must be kept synchronized with func_dirname
593*6881a400Schristos# and func_basename. For efficiency, we do not delegate to
594*6881a400Schristos# those functions but instead duplicate the functionality here.
595*6881a400Schristosfunc_dirname_and_basename ()
596*6881a400Schristos{
597*6881a400Schristos  # Extract subdirectory from the argument.
598*6881a400Schristos  func_dirname_result=`$ECHO "${1}" | $SED -e "$dirname"`
599*6881a400Schristos  if test "X$func_dirname_result" = "X${1}"; then
600*6881a400Schristos    func_dirname_result="${3}"
601*6881a400Schristos  else
602*6881a400Schristos    func_dirname_result="$func_dirname_result${2}"
603*6881a400Schristos  fi
604*6881a400Schristos  func_basename_result=`$ECHO "${1}" | $SED -e "$basename"`
605*6881a400Schristos}
606*6881a400Schristos
607*6881a400Schristos# Generated shell functions inserted here.
608*6881a400Schristos
609*6881a400Schristos# func_dirname file append nondir_replacement
610*6881a400Schristos# Compute the dirname of FILE.  If nonempty, add APPEND to the result,
611*6881a400Schristos# otherwise set result to NONDIR_REPLACEMENT.
612*6881a400Schristosfunc_dirname ()
613*6881a400Schristos{
614*6881a400Schristos  case ${1} in
615*6881a400Schristos    */*) func_dirname_result="${1%/*}${2}" ;;
616*6881a400Schristos    *  ) func_dirname_result="${3}" ;;
617*6881a400Schristos  esac
618*6881a400Schristos}
619*6881a400Schristos
620*6881a400Schristos# func_basename file
621*6881a400Schristosfunc_basename ()
622*6881a400Schristos{
623*6881a400Schristos  func_basename_result="${1##*/}"
624*6881a400Schristos}
625*6881a400Schristos
626*6881a400Schristos# func_dirname_and_basename file append nondir_replacement
627*6881a400Schristos# perform func_basename and func_dirname in a single function
628*6881a400Schristos# call:
629*6881a400Schristos#   dirname:  Compute the dirname of FILE.  If nonempty,
630*6881a400Schristos#             add APPEND to the result, otherwise set result
631*6881a400Schristos#             to NONDIR_REPLACEMENT.
632*6881a400Schristos#             value returned in "$func_dirname_result"
633*6881a400Schristos#   basename: Compute filename of FILE.
634*6881a400Schristos#             value retuned in "$func_basename_result"
635*6881a400Schristos# Implementation must be kept synchronized with func_dirname
636*6881a400Schristos# and func_basename. For efficiency, we do not delegate to
637*6881a400Schristos# those functions but instead duplicate the functionality here.
638*6881a400Schristosfunc_dirname_and_basename ()
639*6881a400Schristos{
640*6881a400Schristos  case ${1} in
641*6881a400Schristos    */*) func_dirname_result="${1%/*}${2}" ;;
642*6881a400Schristos    *  ) func_dirname_result="${3}" ;;
643*6881a400Schristos  esac
644*6881a400Schristos  func_basename_result="${1##*/}"
645*6881a400Schristos}
646*6881a400Schristos
647*6881a400Schristos# func_stripname prefix suffix name
648*6881a400Schristos# strip PREFIX and SUFFIX off of NAME.
649*6881a400Schristos# PREFIX and SUFFIX must not contain globbing or regex special
650*6881a400Schristos# characters, hashes, percent signs, but SUFFIX may contain a leading
651*6881a400Schristos# dot (in which case that matches only a dot).
652*6881a400Schristosfunc_stripname ()
653*6881a400Schristos{
654*6881a400Schristos  # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are
655*6881a400Schristos  # positional parameters, so assign one to ordinary parameter first.
656*6881a400Schristos  func_stripname_result=${3}
657*6881a400Schristos  func_stripname_result=${func_stripname_result#"${1}"}
658*6881a400Schristos  func_stripname_result=${func_stripname_result%"${2}"}
659*6881a400Schristos}
660*6881a400Schristos
661*6881a400Schristos# func_opt_split
662*6881a400Schristosfunc_opt_split ()
663*6881a400Schristos{
664*6881a400Schristos  func_opt_split_opt=${1%%=*}
665*6881a400Schristos  func_opt_split_arg=${1#*=}
666*6881a400Schristos}
667*6881a400Schristos
668*6881a400Schristos# func_lo2o object
669*6881a400Schristosfunc_lo2o ()
670*6881a400Schristos{
671*6881a400Schristos  case ${1} in
672*6881a400Schristos    *.lo) func_lo2o_result=${1%.lo}.${objext} ;;
673*6881a400Schristos    *)    func_lo2o_result=${1} ;;
674*6881a400Schristos  esac
675*6881a400Schristos}
676*6881a400Schristos
677*6881a400Schristos# func_xform libobj-or-source
678*6881a400Schristosfunc_xform ()
679*6881a400Schristos{
680*6881a400Schristos  func_xform_result=${1%.*}.lo
681*6881a400Schristos}
682*6881a400Schristos
683*6881a400Schristos# func_arith arithmetic-term...
684*6881a400Schristosfunc_arith ()
685*6881a400Schristos{
686*6881a400Schristos  func_arith_result=$(( $* ))
687*6881a400Schristos}
688*6881a400Schristos
689*6881a400Schristos# func_len string
690*6881a400Schristos# STRING may not start with a hyphen.
691*6881a400Schristosfunc_len ()
692*6881a400Schristos{
693*6881a400Schristos  func_len_result=${#1}
694*6881a400Schristos}
695*6881a400Schristos
696*6881a400Schristos
697*6881a400Schristos# func_append var value
698*6881a400Schristos# Append VALUE to the end of shell variable VAR.
699*6881a400Schristosfunc_append ()
700*6881a400Schristos{
701*6881a400Schristos  eval "$1+=\$2"
702*6881a400Schristos}
703*6881a400Schristos# Generated shell functions inserted here.
704*6881a400Schristos
705*6881a400Schristos# These SED scripts presuppose an absolute path with a trailing slash.
706*6881a400Schristospathcar='s,^/\([^/]*\).*$,\1,'
707*6881a400Schristospathcdr='s,^/[^/]*,,'
708*6881a400Schristosremovedotparts=':dotsl
709*6881a400Schristos		s@/\./@/@g
710*6881a400Schristos		t dotsl
711*6881a400Schristos		s,/\.$,/,'
712*6881a400Schristoscollapseslashes='s@/\{1,\}@/@g'
713*6881a400Schristosfinalslash='s,/*$,/,'
714*6881a400Schristos
715*6881a400Schristos# func_normal_abspath PATH
716*6881a400Schristos# Remove doubled-up and trailing slashes, "." path components,
717*6881a400Schristos# and cancel out any ".." path components in PATH after making
718*6881a400Schristos# it an absolute path.
719*6881a400Schristos#             value returned in "$func_normal_abspath_result"
720*6881a400Schristosfunc_normal_abspath ()
721*6881a400Schristos{
722*6881a400Schristos  # Start from root dir and reassemble the path.
723*6881a400Schristos  func_normal_abspath_result=
724*6881a400Schristos  func_normal_abspath_tpath=$1
725*6881a400Schristos  func_normal_abspath_altnamespace=
726*6881a400Schristos  case $func_normal_abspath_tpath in
727*6881a400Schristos    "")
728*6881a400Schristos      # Empty path, that just means $cwd.
729*6881a400Schristos      func_stripname '' '/' "`pwd`"
730*6881a400Schristos      func_normal_abspath_result=$func_stripname_result
731*6881a400Schristos      return
732*6881a400Schristos    ;;
733*6881a400Schristos    # The next three entries are used to spot a run of precisely
734*6881a400Schristos    # two leading slashes without using negated character classes;
735*6881a400Schristos    # we take advantage of case's first-match behaviour.
736*6881a400Schristos    ///*)
737*6881a400Schristos      # Unusual form of absolute path, do nothing.
738*6881a400Schristos    ;;
739*6881a400Schristos    //*)
740*6881a400Schristos      # Not necessarily an ordinary path; POSIX reserves leading '//'
741*6881a400Schristos      # and for example Cygwin uses it to access remote file shares
742*6881a400Schristos      # over CIFS/SMB, so we conserve a leading double slash if found.
743*6881a400Schristos      func_normal_abspath_altnamespace=/
744*6881a400Schristos    ;;
745*6881a400Schristos    /*)
746*6881a400Schristos      # Absolute path, do nothing.
747*6881a400Schristos    ;;
748*6881a400Schristos    *)
749*6881a400Schristos      # Relative path, prepend $cwd.
750*6881a400Schristos      func_normal_abspath_tpath=`pwd`/$func_normal_abspath_tpath
751*6881a400Schristos    ;;
752*6881a400Schristos  esac
753*6881a400Schristos  # Cancel out all the simple stuff to save iterations.  We also want
754*6881a400Schristos  # the path to end with a slash for ease of parsing, so make sure
755*6881a400Schristos  # there is one (and only one) here.
756*6881a400Schristos  func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \
757*6881a400Schristos        -e "$removedotparts" -e "$collapseslashes" -e "$finalslash"`
758*6881a400Schristos  while :; do
759*6881a400Schristos    # Processed it all yet?
760*6881a400Schristos    if test "$func_normal_abspath_tpath" = / ; then
761*6881a400Schristos      # If we ascended to the root using ".." the result may be empty now.
762*6881a400Schristos      if test -z "$func_normal_abspath_result" ; then
763*6881a400Schristos        func_normal_abspath_result=/
764*6881a400Schristos      fi
765*6881a400Schristos      break
766*6881a400Schristos    fi
767*6881a400Schristos    func_normal_abspath_tcomponent=`$ECHO "$func_normal_abspath_tpath" | $SED \
768*6881a400Schristos        -e "$pathcar"`
769*6881a400Schristos    func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \
770*6881a400Schristos        -e "$pathcdr"`
771*6881a400Schristos    # Figure out what to do with it
772*6881a400Schristos    case $func_normal_abspath_tcomponent in
773*6881a400Schristos      "")
774*6881a400Schristos        # Trailing empty path component, ignore it.
775*6881a400Schristos      ;;
776*6881a400Schristos      ..)
777*6881a400Schristos        # Parent dir; strip last assembled component from result.
778*6881a400Schristos        func_dirname "$func_normal_abspath_result"
779*6881a400Schristos        func_normal_abspath_result=$func_dirname_result
780*6881a400Schristos      ;;
781*6881a400Schristos      *)
782*6881a400Schristos        # Actual path component, append it.
783*6881a400Schristos        func_normal_abspath_result=$func_normal_abspath_result/$func_normal_abspath_tcomponent
784*6881a400Schristos      ;;
785*6881a400Schristos    esac
786*6881a400Schristos  done
787*6881a400Schristos  # Restore leading double-slash if one was found on entry.
788*6881a400Schristos  func_normal_abspath_result=$func_normal_abspath_altnamespace$func_normal_abspath_result
789*6881a400Schristos}
790*6881a400Schristos
791*6881a400Schristos# func_relative_path SRCDIR DSTDIR
792*6881a400Schristos# generates a relative path from SRCDIR to DSTDIR, with a trailing
793*6881a400Schristos# slash if non-empty, suitable for immediately appending a filename
794*6881a400Schristos# without needing to append a separator.
795*6881a400Schristos#             value returned in "$func_relative_path_result"
796*6881a400Schristosfunc_relative_path ()
797*6881a400Schristos{
798*6881a400Schristos  func_relative_path_result=
799*6881a400Schristos  func_normal_abspath "$1"
800*6881a400Schristos  func_relative_path_tlibdir=$func_normal_abspath_result
801*6881a400Schristos  func_normal_abspath "$2"
802*6881a400Schristos  func_relative_path_tbindir=$func_normal_abspath_result
803*6881a400Schristos
804*6881a400Schristos  # Ascend the tree starting from libdir
805*6881a400Schristos  while :; do
806*6881a400Schristos    # check if we have found a prefix of bindir
807*6881a400Schristos    case $func_relative_path_tbindir in
808*6881a400Schristos      $func_relative_path_tlibdir)
809*6881a400Schristos        # found an exact match
810*6881a400Schristos        func_relative_path_tcancelled=
811*6881a400Schristos        break
812*6881a400Schristos        ;;
813*6881a400Schristos      $func_relative_path_tlibdir*)
814*6881a400Schristos        # found a matching prefix
815*6881a400Schristos        func_stripname "$func_relative_path_tlibdir" '' "$func_relative_path_tbindir"
816*6881a400Schristos        func_relative_path_tcancelled=$func_stripname_result
817*6881a400Schristos        if test -z "$func_relative_path_result"; then
818*6881a400Schristos          func_relative_path_result=.
819*6881a400Schristos        fi
820*6881a400Schristos        break
821*6881a400Schristos        ;;
822*6881a400Schristos      *)
823*6881a400Schristos        func_dirname $func_relative_path_tlibdir
824*6881a400Schristos        func_relative_path_tlibdir=${func_dirname_result}
825*6881a400Schristos        if test "x$func_relative_path_tlibdir" = x ; then
826*6881a400Schristos          # Have to descend all the way to the root!
827*6881a400Schristos          func_relative_path_result=../$func_relative_path_result
828*6881a400Schristos          func_relative_path_tcancelled=$func_relative_path_tbindir
829*6881a400Schristos          break
830*6881a400Schristos        fi
831*6881a400Schristos        func_relative_path_result=../$func_relative_path_result
832*6881a400Schristos        ;;
833*6881a400Schristos    esac
834*6881a400Schristos  done
835*6881a400Schristos
836*6881a400Schristos  # Now calculate path; take care to avoid doubling-up slashes.
837*6881a400Schristos  func_stripname '' '/' "$func_relative_path_result"
838*6881a400Schristos  func_relative_path_result=$func_stripname_result
839*6881a400Schristos  func_stripname '/' '/' "$func_relative_path_tcancelled"
840*6881a400Schristos  if test "x$func_stripname_result" != x ; then
841*6881a400Schristos    func_relative_path_result=${func_relative_path_result}/${func_stripname_result}
842*6881a400Schristos  fi
843*6881a400Schristos
844*6881a400Schristos  # Normalisation. If bindir is libdir, return empty string,
845*6881a400Schristos  # else relative path ending with a slash; either way, target
846*6881a400Schristos  # file name can be directly appended.
847*6881a400Schristos  if test ! -z "$func_relative_path_result"; then
848*6881a400Schristos    func_stripname './' '' "$func_relative_path_result/"
849*6881a400Schristos    func_relative_path_result=$func_stripname_result
850*6881a400Schristos  fi
851*6881a400Schristos}
852*6881a400Schristos
853*6881a400Schristos# The name of this program:
854*6881a400Schristosfunc_dirname_and_basename "$progpath"
855*6881a400Schristosprogname=$func_basename_result
856*6881a400Schristos
857*6881a400Schristos# Make sure we have an absolute path for reexecution:
858*6881a400Schristoscase $progpath in
859*6881a400Schristos  [\\/]*|[A-Za-z]:\\*) ;;
860*6881a400Schristos  *[\\/]*)
861*6881a400Schristos     progdir=$func_dirname_result
862*6881a400Schristos     progdir=`cd "$progdir" && pwd`
863*6881a400Schristos     progpath="$progdir/$progname"
864*6881a400Schristos     ;;
865*6881a400Schristos  *)
866*6881a400Schristos     save_IFS="$IFS"
867*6881a400Schristos     IFS=:
868*6881a400Schristos     for progdir in $PATH; do
869*6881a400Schristos       IFS="$save_IFS"
870*6881a400Schristos       test -x "$progdir/$progname" && break
871*6881a400Schristos     done
872*6881a400Schristos     IFS="$save_IFS"
873*6881a400Schristos     test -n "$progdir" || progdir=`pwd`
874*6881a400Schristos     progpath="$progdir/$progname"
875*6881a400Schristos     ;;
876*6881a400Schristosesac
877*6881a400Schristos
878*6881a400Schristos# Sed substitution that helps us do robust quoting.  It backslashifies
879*6881a400Schristos# metacharacters that are still active within double-quoted strings.
880*6881a400SchristosXsed="${SED}"' -e 1s/^X//'
881*6881a400Schristossed_quote_subst='s/\([`"$\\]\)/\\\1/g'
882*6881a400Schristos
883*6881a400Schristos# Same as above, but do not quote variable references.
884*6881a400Schristosdouble_quote_subst='s/\(["`\\]\)/\\\1/g'
885*6881a400Schristos
886*6881a400Schristos# Re-`\' parameter expansions in output of double_quote_subst that were
887*6881a400Schristos# `\'-ed in input to the same.  If an odd number of `\' preceded a '$'
888*6881a400Schristos# in input to double_quote_subst, that '$' was protected from expansion.
889*6881a400Schristos# Since each input `\' is now two `\'s, look for any number of runs of
890*6881a400Schristos# four `\'s followed by two `\'s and then a '$'.  `\' that '$'.
891*6881a400Schristosbs='\\'
892*6881a400Schristosbs2='\\\\'
893*6881a400Schristosbs4='\\\\\\\\'
894*6881a400Schristosdollar='\$'
895*6881a400Schristossed_double_backslash="\
896*6881a400Schristos  s/$bs4/&\\
897*6881a400Schristos/g
898*6881a400Schristos  s/^$bs2$dollar/$bs&/
899*6881a400Schristos  s/\\([^$bs]\\)$bs2$dollar/\\1$bs2$bs$dollar/g
900*6881a400Schristos  s/\n//g"
901*6881a400Schristos
902*6881a400Schristos# Standard options:
903*6881a400Schristosopt_dry_run=false
904*6881a400Schristosopt_help=false
905*6881a400Schristosopt_quiet=false
906*6881a400Schristosopt_verbose=false
907*6881a400Schristosopt_warning=:
908*6881a400Schristos
909*6881a400Schristos# func_echo arg...
910*6881a400Schristos# Echo program name prefixed message, along with the current mode
911*6881a400Schristos# name if it has been set yet.
912*6881a400Schristosfunc_echo ()
913*6881a400Schristos{
914*6881a400Schristos    $ECHO "$progname${mode+: }$mode: $*"
915*6881a400Schristos}
916*6881a400Schristos
917*6881a400Schristos# func_verbose arg...
918*6881a400Schristos# Echo program name prefixed message in verbose mode only.
919*6881a400Schristosfunc_verbose ()
920*6881a400Schristos{
921*6881a400Schristos    $opt_verbose && func_echo ${1+"$@"}
922*6881a400Schristos
923*6881a400Schristos    # A bug in bash halts the script if the last line of a function
924*6881a400Schristos    # fails when set -e is in force, so we need another command to
925*6881a400Schristos    # work around that:
926*6881a400Schristos    :
927*6881a400Schristos}
928*6881a400Schristos
929*6881a400Schristos# func_echo_all arg...
930*6881a400Schristos# Invoke $ECHO with all args, space-separated.
931*6881a400Schristosfunc_echo_all ()
932*6881a400Schristos{
933*6881a400Schristos    $ECHO "$*"
934*6881a400Schristos}
935*6881a400Schristos
936*6881a400Schristos# func_error arg...
937*6881a400Schristos# Echo program name prefixed message to standard error.
938*6881a400Schristosfunc_error ()
939*6881a400Schristos{
940*6881a400Schristos    $ECHO "$progname${mode+: }$mode: "${1+"$@"} 1>&2
941*6881a400Schristos}
942*6881a400Schristos
943*6881a400Schristos# func_warning arg...
944*6881a400Schristos# Echo program name prefixed warning message to standard error.
945*6881a400Schristosfunc_warning ()
946*6881a400Schristos{
947*6881a400Schristos    $opt_warning && $ECHO "$progname${mode+: }$mode: warning: "${1+"$@"} 1>&2
948*6881a400Schristos
949*6881a400Schristos    # bash bug again:
950*6881a400Schristos    :
951*6881a400Schristos}
952*6881a400Schristos
953*6881a400Schristos# func_fatal_error arg...
954*6881a400Schristos# Echo program name prefixed message to standard error, and exit.
955*6881a400Schristosfunc_fatal_error ()
956*6881a400Schristos{
957*6881a400Schristos    func_error ${1+"$@"}
958*6881a400Schristos    exit $EXIT_FAILURE
959*6881a400Schristos}
960*6881a400Schristos
961*6881a400Schristos# func_fatal_help arg...
962*6881a400Schristos# Echo program name prefixed message to standard error, followed by
963*6881a400Schristos# a help hint, and exit.
964*6881a400Schristosfunc_fatal_help ()
965*6881a400Schristos{
966*6881a400Schristos    func_error ${1+"$@"}
967*6881a400Schristos    func_fatal_error "$help"
968*6881a400Schristos}
969*6881a400Schristoshelp="Try \`$progname --help' for more information."  ## default
970*6881a400Schristos
971*6881a400Schristos
972*6881a400Schristos# func_grep expression filename
973*6881a400Schristos# Check whether EXPRESSION matches any line of FILENAME, without output.
974*6881a400Schristosfunc_grep ()
975*6881a400Schristos{
976*6881a400Schristos    $GREP "$1" "$2" >/dev/null 2>&1
977*6881a400Schristos}
978*6881a400Schristos
979*6881a400Schristos
980*6881a400Schristos# func_mkdir_p directory-path
981*6881a400Schristos# Make sure the entire path to DIRECTORY-PATH is available.
982*6881a400Schristosfunc_mkdir_p ()
983*6881a400Schristos{
984*6881a400Schristos    my_directory_path="$1"
985*6881a400Schristos    my_dir_list=
986*6881a400Schristos
987*6881a400Schristos    if test -n "$my_directory_path" && test "$opt_dry_run" != ":"; then
988*6881a400Schristos
989*6881a400Schristos      # Protect directory names starting with `-'
990*6881a400Schristos      case $my_directory_path in
991*6881a400Schristos        -*) my_directory_path="./$my_directory_path" ;;
992*6881a400Schristos      esac
993*6881a400Schristos
994*6881a400Schristos      # While some portion of DIR does not yet exist...
995*6881a400Schristos      while test ! -d "$my_directory_path"; do
996*6881a400Schristos        # ...make a list in topmost first order.  Use a colon delimited
997*6881a400Schristos	# list incase some portion of path contains whitespace.
998*6881a400Schristos        my_dir_list="$my_directory_path:$my_dir_list"
999*6881a400Schristos
1000*6881a400Schristos        # If the last portion added has no slash in it, the list is done
1001*6881a400Schristos        case $my_directory_path in */*) ;; *) break ;; esac
1002*6881a400Schristos
1003*6881a400Schristos        # ...otherwise throw away the child directory and loop
1004*6881a400Schristos        my_directory_path=`$ECHO "$my_directory_path" | $SED -e "$dirname"`
1005*6881a400Schristos      done
1006*6881a400Schristos      my_dir_list=`$ECHO "$my_dir_list" | $SED 's,:*$,,'`
1007*6881a400Schristos
1008*6881a400Schristos      save_mkdir_p_IFS="$IFS"; IFS=':'
1009*6881a400Schristos      for my_dir in $my_dir_list; do
1010*6881a400Schristos	IFS="$save_mkdir_p_IFS"
1011*6881a400Schristos        # mkdir can fail with a `File exist' error if two processes
1012*6881a400Schristos        # try to create one of the directories concurrently.  Don't
1013*6881a400Schristos        # stop in that case!
1014*6881a400Schristos        $MKDIR "$my_dir" 2>/dev/null || :
1015*6881a400Schristos      done
1016*6881a400Schristos      IFS="$save_mkdir_p_IFS"
1017*6881a400Schristos
1018*6881a400Schristos      # Bail out if we (or some other process) failed to create a directory.
1019*6881a400Schristos      test -d "$my_directory_path" || \
1020*6881a400Schristos        func_fatal_error "Failed to create \`$1'"
1021*6881a400Schristos    fi
1022*6881a400Schristos}
1023*6881a400Schristos
1024*6881a400Schristos
1025*6881a400Schristos# func_mktempdir [string]
1026*6881a400Schristos# Make a temporary directory that won't clash with other running
1027*6881a400Schristos# libtool processes, and avoids race conditions if possible.  If
1028*6881a400Schristos# given, STRING is the basename for that directory.
1029*6881a400Schristosfunc_mktempdir ()
1030*6881a400Schristos{
1031*6881a400Schristos    my_template="${TMPDIR-/tmp}/${1-$progname}"
1032*6881a400Schristos
1033*6881a400Schristos    if test "$opt_dry_run" = ":"; then
1034*6881a400Schristos      # Return a directory name, but don't create it in dry-run mode
1035*6881a400Schristos      my_tmpdir="${my_template}-$$"
1036*6881a400Schristos    else
1037*6881a400Schristos
1038*6881a400Schristos      # If mktemp works, use that first and foremost
1039*6881a400Schristos      my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null`
1040*6881a400Schristos
1041*6881a400Schristos      if test ! -d "$my_tmpdir"; then
1042*6881a400Schristos        # Failing that, at least try and use $RANDOM to avoid a race
1043*6881a400Schristos        my_tmpdir="${my_template}-${RANDOM-0}$$"
1044*6881a400Schristos
1045*6881a400Schristos        save_mktempdir_umask=`umask`
1046*6881a400Schristos        umask 0077
1047*6881a400Schristos        $MKDIR "$my_tmpdir"
1048*6881a400Schristos        umask $save_mktempdir_umask
1049*6881a400Schristos      fi
1050*6881a400Schristos
1051*6881a400Schristos      # If we're not in dry-run mode, bomb out on failure
1052*6881a400Schristos      test -d "$my_tmpdir" || \
1053*6881a400Schristos        func_fatal_error "cannot create temporary directory \`$my_tmpdir'"
1054*6881a400Schristos    fi
1055*6881a400Schristos
1056*6881a400Schristos    $ECHO "$my_tmpdir"
1057*6881a400Schristos}
1058*6881a400Schristos
1059*6881a400Schristos
1060*6881a400Schristos# func_quote_for_eval arg
1061*6881a400Schristos# Aesthetically quote ARG to be evaled later.
1062*6881a400Schristos# This function returns two values: FUNC_QUOTE_FOR_EVAL_RESULT
1063*6881a400Schristos# is double-quoted, suitable for a subsequent eval, whereas
1064*6881a400Schristos# FUNC_QUOTE_FOR_EVAL_UNQUOTED_RESULT has merely all characters
1065*6881a400Schristos# which are still active within double quotes backslashified.
1066*6881a400Schristosfunc_quote_for_eval ()
1067*6881a400Schristos{
1068*6881a400Schristos    case $1 in
1069*6881a400Schristos      *[\\\`\"\$]*)
1070*6881a400Schristos	func_quote_for_eval_unquoted_result=`$ECHO "$1" | $SED "$sed_quote_subst"` ;;
1071*6881a400Schristos      *)
1072*6881a400Schristos        func_quote_for_eval_unquoted_result="$1" ;;
1073*6881a400Schristos    esac
1074*6881a400Schristos
1075*6881a400Schristos    case $func_quote_for_eval_unquoted_result in
1076*6881a400Schristos      # Double-quote args containing shell metacharacters to delay
1077*6881a400Schristos      # word splitting, command substitution and and variable
1078*6881a400Schristos      # expansion for a subsequent eval.
1079*6881a400Schristos      # Many Bourne shells cannot handle close brackets correctly
1080*6881a400Schristos      # in scan sets, so we specify it separately.
1081*6881a400Schristos      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
1082*6881a400Schristos        func_quote_for_eval_result="\"$func_quote_for_eval_unquoted_result\""
1083*6881a400Schristos        ;;
1084*6881a400Schristos      *)
1085*6881a400Schristos        func_quote_for_eval_result="$func_quote_for_eval_unquoted_result"
1086*6881a400Schristos    esac
1087*6881a400Schristos}
1088*6881a400Schristos
1089*6881a400Schristos
1090*6881a400Schristos# func_quote_for_expand arg
1091*6881a400Schristos# Aesthetically quote ARG to be evaled later; same as above,
1092*6881a400Schristos# but do not quote variable references.
1093*6881a400Schristosfunc_quote_for_expand ()
1094*6881a400Schristos{
1095*6881a400Schristos    case $1 in
1096*6881a400Schristos      *[\\\`\"]*)
1097*6881a400Schristos	my_arg=`$ECHO "$1" | $SED \
1098*6881a400Schristos	    -e "$double_quote_subst" -e "$sed_double_backslash"` ;;
1099*6881a400Schristos      *)
1100*6881a400Schristos        my_arg="$1" ;;
1101*6881a400Schristos    esac
1102*6881a400Schristos
1103*6881a400Schristos    case $my_arg in
1104*6881a400Schristos      # Double-quote args containing shell metacharacters to delay
1105*6881a400Schristos      # word splitting and command substitution for a subsequent eval.
1106*6881a400Schristos      # Many Bourne shells cannot handle close brackets correctly
1107*6881a400Schristos      # in scan sets, so we specify it separately.
1108*6881a400Schristos      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
1109*6881a400Schristos        my_arg="\"$my_arg\""
1110*6881a400Schristos        ;;
1111*6881a400Schristos    esac
1112*6881a400Schristos
1113*6881a400Schristos    func_quote_for_expand_result="$my_arg"
1114*6881a400Schristos}
1115*6881a400Schristos
1116*6881a400Schristos
1117*6881a400Schristos# func_show_eval cmd [fail_exp]
1118*6881a400Schristos# Unless opt_silent is true, then output CMD.  Then, if opt_dryrun is
1119*6881a400Schristos# not true, evaluate CMD.  If the evaluation of CMD fails, and FAIL_EXP
1120*6881a400Schristos# is given, then evaluate it.
1121*6881a400Schristosfunc_show_eval ()
1122*6881a400Schristos{
1123*6881a400Schristos    my_cmd="$1"
1124*6881a400Schristos    my_fail_exp="${2-:}"
1125*6881a400Schristos
1126*6881a400Schristos    ${opt_silent-false} || {
1127*6881a400Schristos      func_quote_for_expand "$my_cmd"
1128*6881a400Schristos      eval "func_echo $func_quote_for_expand_result"
1129*6881a400Schristos    }
1130*6881a400Schristos
1131*6881a400Schristos    if ${opt_dry_run-false}; then :; else
1132*6881a400Schristos      eval "$my_cmd"
1133*6881a400Schristos      my_status=$?
1134*6881a400Schristos      if test "$my_status" -eq 0; then :; else
1135*6881a400Schristos	eval "(exit $my_status); $my_fail_exp"
1136*6881a400Schristos      fi
1137*6881a400Schristos    fi
1138*6881a400Schristos}
1139*6881a400Schristos
1140*6881a400Schristos
1141*6881a400Schristos# func_show_eval_locale cmd [fail_exp]
1142*6881a400Schristos# Unless opt_silent is true, then output CMD.  Then, if opt_dryrun is
1143*6881a400Schristos# not true, evaluate CMD.  If the evaluation of CMD fails, and FAIL_EXP
1144*6881a400Schristos# is given, then evaluate it.  Use the saved locale for evaluation.
1145*6881a400Schristosfunc_show_eval_locale ()
1146*6881a400Schristos{
1147*6881a400Schristos    my_cmd="$1"
1148*6881a400Schristos    my_fail_exp="${2-:}"
1149*6881a400Schristos
1150*6881a400Schristos    ${opt_silent-false} || {
1151*6881a400Schristos      func_quote_for_expand "$my_cmd"
1152*6881a400Schristos      eval "func_echo $func_quote_for_expand_result"
1153*6881a400Schristos    }
1154*6881a400Schristos
1155*6881a400Schristos    if ${opt_dry_run-false}; then :; else
1156*6881a400Schristos      eval "$lt_user_locale
1157*6881a400Schristos	    $my_cmd"
1158*6881a400Schristos      my_status=$?
1159*6881a400Schristos      eval "$lt_safe_locale"
1160*6881a400Schristos      if test "$my_status" -eq 0; then :; else
1161*6881a400Schristos	eval "(exit $my_status); $my_fail_exp"
1162*6881a400Schristos      fi
1163*6881a400Schristos    fi
1164*6881a400Schristos}
1165*6881a400Schristos
1166*6881a400Schristos
1167*6881a400Schristos
1168*6881a400Schristos
1169*6881a400Schristos
1170*6881a400Schristos# func_version
1171*6881a400Schristos# Echo version message to standard output and exit.
1172*6881a400Schristosfunc_version ()
1173*6881a400Schristos{
1174*6881a400Schristos    $SED -n '/(C)/!b go
1175*6881a400Schristos	:more
1176*6881a400Schristos	/\./!{
1177*6881a400Schristos	  N
1178*6881a400Schristos	  s/\n# //
1179*6881a400Schristos	  b more
1180*6881a400Schristos	}
1181*6881a400Schristos	:go
1182*6881a400Schristos	/^# '$PROGRAM' (GNU /,/# warranty; / {
1183*6881a400Schristos        s/^# //
1184*6881a400Schristos	s/^# *$//
1185*6881a400Schristos        s/\((C)\)[ 0-9,-]*\( [1-9][0-9]*\)/\1\2/
1186*6881a400Schristos        p
1187*6881a400Schristos     }' < "$progpath"
1188*6881a400Schristos     exit $?
1189*6881a400Schristos}
1190*6881a400Schristos
1191*6881a400Schristos# func_usage
1192*6881a400Schristos# Echo short help message to standard output and exit.
1193*6881a400Schristosfunc_usage ()
1194*6881a400Schristos{
1195*6881a400Schristos    $SED -n '/^# Usage:/,/^#  *-h/ {
1196*6881a400Schristos        s/^# //
1197*6881a400Schristos	s/^# *$//
1198*6881a400Schristos	s/\$progname/'$progname'/
1199*6881a400Schristos	p
1200*6881a400Schristos    }' < "$progpath"
1201*6881a400Schristos    echo
1202*6881a400Schristos    $ECHO "run \`$progname --help | more' for full usage"
1203*6881a400Schristos    exit $?
1204*6881a400Schristos}
1205*6881a400Schristos
1206*6881a400Schristos# func_help [NOEXIT]
1207*6881a400Schristos# Echo long help message to standard output and exit,
1208*6881a400Schristos# unless 'noexit' is passed as argument.
1209*6881a400Schristosfunc_help ()
1210*6881a400Schristos{
1211*6881a400Schristos    $SED -n '/^# Usage:/,/# Report bugs to/ {
1212*6881a400Schristos        s/^# //
1213*6881a400Schristos	s/^# *$//
1214*6881a400Schristos	s*\$progname*'$progname'*
1215*6881a400Schristos	s*\$host*'"$host"'*
1216*6881a400Schristos	s*\$SHELL*'"$SHELL"'*
1217*6881a400Schristos	s*\$LTCC*'"$LTCC"'*
1218*6881a400Schristos	s*\$LTCFLAGS*'"$LTCFLAGS"'*
1219*6881a400Schristos	s*\$LD*'"$LD"'*
1220*6881a400Schristos	s/\$with_gnu_ld/'"$with_gnu_ld"'/
1221*6881a400Schristos	s/\$automake_version/'"`(automake --version) 2>/dev/null |$SED 1q`"'/
1222*6881a400Schristos	s/\$autoconf_version/'"`(autoconf --version) 2>/dev/null |$SED 1q`"'/
1223*6881a400Schristos	p
1224*6881a400Schristos     }' < "$progpath"
1225*6881a400Schristos    ret=$?
1226*6881a400Schristos    if test -z "$1"; then
1227*6881a400Schristos      exit $ret
1228*6881a400Schristos    fi
1229*6881a400Schristos}
1230*6881a400Schristos
1231*6881a400Schristos# func_missing_arg argname
1232*6881a400Schristos# Echo program name prefixed message to standard error and set global
1233*6881a400Schristos# exit_cmd.
1234*6881a400Schristosfunc_missing_arg ()
1235*6881a400Schristos{
1236*6881a400Schristos    func_error "missing argument for $1"
1237*6881a400Schristos    exit_cmd=exit
1238*6881a400Schristos}
1239*6881a400Schristos
1240*6881a400Schristosexit_cmd=:
1241*6881a400Schristos
1242*6881a400Schristos
1243*6881a400Schristos
1244*6881a400Schristos
1245*6881a400Schristos
1246*6881a400Schristos
1247*6881a400Schristosmagic="%%%MAGIC variable%%%"
1248*6881a400Schristosmagic_exe="%%%MAGIC EXE variable%%%"
1249*6881a400Schristos
1250*6881a400Schristos# Global variables.
1251*6881a400Schristos# $mode is unset
1252*6881a400Schristosnonopt=
1253*6881a400Schristosexecute_dlfiles=
1254*6881a400Schristospreserve_args=
1255*6881a400Schristoslo2o="s/\\.lo\$/.${objext}/"
1256*6881a400Schristoso2lo="s/\\.${objext}\$/.lo/"
1257*6881a400Schristosextracted_archives=
1258*6881a400Schristosextracted_serial=0
1259*6881a400Schristos
1260*6881a400Schristosopt_dry_run=false
1261*6881a400Schristosopt_finish=:
1262*6881a400Schristosopt_duplicate_deps=false
1263*6881a400Schristosopt_silent=false
1264*6881a400Schristosopt_debug=:
1265*6881a400Schristos
1266*6881a400Schristos# If this variable is set in any of the actions, the command in it
1267*6881a400Schristos# will be execed at the end.  This prevents here-documents from being
1268*6881a400Schristos# left over by shells.
1269*6881a400Schristosexec_cmd=
1270*6881a400Schristos
1271*6881a400Schristos# func_fatal_configuration arg...
1272*6881a400Schristos# Echo program name prefixed message to standard error, followed by
1273*6881a400Schristos# a configuration failure hint, and exit.
1274*6881a400Schristosfunc_fatal_configuration ()
1275*6881a400Schristos{
1276*6881a400Schristos    func_error ${1+"$@"}
1277*6881a400Schristos    func_error "See the $PACKAGE documentation for more information."
1278*6881a400Schristos    func_fatal_error "Fatal configuration error."
1279*6881a400Schristos}
1280*6881a400Schristos
1281*6881a400Schristos
1282*6881a400Schristos# func_config
1283*6881a400Schristos# Display the configuration for all the tags in this script.
1284*6881a400Schristosfunc_config ()
1285*6881a400Schristos{
1286*6881a400Schristos    re_begincf='^# ### BEGIN LIBTOOL'
1287*6881a400Schristos    re_endcf='^# ### END LIBTOOL'
1288*6881a400Schristos
1289*6881a400Schristos    # Default configuration.
1290*6881a400Schristos    $SED "1,/$re_begincf CONFIG/d;/$re_endcf CONFIG/,\$d" < "$progpath"
1291*6881a400Schristos
1292*6881a400Schristos    # Now print the configurations for the tags.
1293*6881a400Schristos    for tagname in $taglist; do
1294*6881a400Schristos      $SED -n "/$re_begincf TAG CONFIG: $tagname\$/,/$re_endcf TAG CONFIG: $tagname\$/p" < "$progpath"
1295*6881a400Schristos    done
1296*6881a400Schristos
1297*6881a400Schristos    exit $?
1298*6881a400Schristos}
1299*6881a400Schristos
1300*6881a400Schristos# func_features
1301*6881a400Schristos# Display the features supported by this script.
1302*6881a400Schristosfunc_features ()
1303*6881a400Schristos{
1304*6881a400Schristos    echo "host: $host"
1305*6881a400Schristos    if test "$build_libtool_libs" = yes; then
1306*6881a400Schristos      echo "enable shared libraries"
1307*6881a400Schristos    else
1308*6881a400Schristos      echo "disable shared libraries"
1309*6881a400Schristos    fi
1310*6881a400Schristos    if test "$build_old_libs" = yes; then
1311*6881a400Schristos      echo "enable static libraries"
1312*6881a400Schristos    else
1313*6881a400Schristos      echo "disable static libraries"
1314*6881a400Schristos    fi
1315*6881a400Schristos
1316*6881a400Schristos    exit $?
1317*6881a400Schristos}
1318*6881a400Schristos
1319*6881a400Schristos# func_enable_tag tagname
1320*6881a400Schristos# Verify that TAGNAME is valid, and either flag an error and exit, or
1321*6881a400Schristos# enable the TAGNAME tag.  We also add TAGNAME to the global $taglist
1322*6881a400Schristos# variable here.
1323*6881a400Schristosfunc_enable_tag ()
1324*6881a400Schristos{
1325*6881a400Schristos  # Global variable:
1326*6881a400Schristos  tagname="$1"
1327*6881a400Schristos
1328*6881a400Schristos  re_begincf="^# ### BEGIN LIBTOOL TAG CONFIG: $tagname\$"
1329*6881a400Schristos  re_endcf="^# ### END LIBTOOL TAG CONFIG: $tagname\$"
1330*6881a400Schristos  sed_extractcf="/$re_begincf/,/$re_endcf/p"
1331*6881a400Schristos
1332*6881a400Schristos  # Validate tagname.
1333*6881a400Schristos  case $tagname in
1334*6881a400Schristos    *[!-_A-Za-z0-9,/]*)
1335*6881a400Schristos      func_fatal_error "invalid tag name: $tagname"
1336*6881a400Schristos      ;;
1337*6881a400Schristos  esac
1338*6881a400Schristos
1339*6881a400Schristos  # Don't test for the "default" C tag, as we know it's
1340*6881a400Schristos  # there but not specially marked.
1341*6881a400Schristos  case $tagname in
1342*6881a400Schristos    CC) ;;
1343*6881a400Schristos    *)
1344*6881a400Schristos      if $GREP "$re_begincf" "$progpath" >/dev/null 2>&1; then
1345*6881a400Schristos	taglist="$taglist $tagname"
1346*6881a400Schristos
1347*6881a400Schristos	# Evaluate the configuration.  Be careful to quote the path
1348*6881a400Schristos	# and the sed script, to avoid splitting on whitespace, but
1349*6881a400Schristos	# also don't use non-portable quotes within backquotes within
1350*6881a400Schristos	# quotes we have to do it in 2 steps:
1351*6881a400Schristos	extractedcf=`$SED -n -e "$sed_extractcf" < "$progpath"`
1352*6881a400Schristos	eval "$extractedcf"
1353*6881a400Schristos      else
1354*6881a400Schristos	func_error "ignoring unknown tag $tagname"
1355*6881a400Schristos      fi
1356*6881a400Schristos      ;;
1357*6881a400Schristos  esac
1358*6881a400Schristos}
1359*6881a400Schristos
1360*6881a400Schristos# Parse options once, thoroughly.  This comes as soon as possible in
1361*6881a400Schristos# the script to make things like `libtool --version' happen quickly.
1362*6881a400Schristos{
1363*6881a400Schristos
1364*6881a400Schristos  # Shorthand for --mode=foo, only valid as the first argument
1365*6881a400Schristos  case $1 in
1366*6881a400Schristos  clean|clea|cle|cl)
1367*6881a400Schristos    shift; set dummy --mode clean ${1+"$@"}; shift
1368*6881a400Schristos    ;;
1369*6881a400Schristos  compile|compil|compi|comp|com|co|c)
1370*6881a400Schristos    shift; set dummy --mode compile ${1+"$@"}; shift
1371*6881a400Schristos    ;;
1372*6881a400Schristos  execute|execut|execu|exec|exe|ex|e)
1373*6881a400Schristos    shift; set dummy --mode execute ${1+"$@"}; shift
1374*6881a400Schristos    ;;
1375*6881a400Schristos  finish|finis|fini|fin|fi|f)
1376*6881a400Schristos    shift; set dummy --mode finish ${1+"$@"}; shift
1377*6881a400Schristos    ;;
1378*6881a400Schristos  install|instal|insta|inst|ins|in|i)
1379*6881a400Schristos    shift; set dummy --mode install ${1+"$@"}; shift
1380*6881a400Schristos    ;;
1381*6881a400Schristos  link|lin|li|l)
1382*6881a400Schristos    shift; set dummy --mode link ${1+"$@"}; shift
1383*6881a400Schristos    ;;
1384*6881a400Schristos  uninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u)
1385*6881a400Schristos    shift; set dummy --mode uninstall ${1+"$@"}; shift
1386*6881a400Schristos    ;;
1387*6881a400Schristos  esac
1388*6881a400Schristos
1389*6881a400Schristos  # Parse non-mode specific arguments:
1390*6881a400Schristos  while test "$#" -gt 0; do
1391*6881a400Schristos    opt="$1"
1392*6881a400Schristos    shift
1393*6881a400Schristos
1394*6881a400Schristos    case $opt in
1395*6881a400Schristos      --config)		func_config					;;
1396*6881a400Schristos
1397*6881a400Schristos      --debug)		preserve_args="$preserve_args $opt"
1398*6881a400Schristos			func_echo "enabling shell trace mode"
1399*6881a400Schristos			opt_debug='set -x'
1400*6881a400Schristos			$opt_debug
1401*6881a400Schristos			;;
1402*6881a400Schristos
1403*6881a400Schristos      -dlopen)		test "$#" -eq 0 && func_missing_arg "$opt" && break
1404*6881a400Schristos			execute_dlfiles="$execute_dlfiles $1"
1405*6881a400Schristos			shift
1406*6881a400Schristos			;;
1407*6881a400Schristos
1408*6881a400Schristos      --dry-run | -n)	opt_dry_run=:					;;
1409*6881a400Schristos      --features)       func_features					;;
1410*6881a400Schristos      --finish)		mode="finish"					;;
1411*6881a400Schristos      --no-finish)	opt_finish=false				;;
1412*6881a400Schristos
1413*6881a400Schristos      --mode)		test "$#" -eq 0 && func_missing_arg "$opt" && break
1414*6881a400Schristos			case $1 in
1415*6881a400Schristos			  # Valid mode arguments:
1416*6881a400Schristos			  clean)	;;
1417*6881a400Schristos			  compile)	;;
1418*6881a400Schristos			  execute)	;;
1419*6881a400Schristos			  finish)	;;
1420*6881a400Schristos			  install)	;;
1421*6881a400Schristos			  link)		;;
1422*6881a400Schristos			  relink)	;;
1423*6881a400Schristos			  uninstall)	;;
1424*6881a400Schristos
1425*6881a400Schristos			  # Catch anything else as an error
1426*6881a400Schristos			  *) func_error "invalid argument for $opt"
1427*6881a400Schristos			     exit_cmd=exit
1428*6881a400Schristos			     break
1429*6881a400Schristos			     ;;
1430*6881a400Schristos		        esac
1431*6881a400Schristos
1432*6881a400Schristos			mode="$1"
1433*6881a400Schristos			shift
1434*6881a400Schristos			;;
1435*6881a400Schristos
1436*6881a400Schristos      --preserve-dup-deps)
1437*6881a400Schristos			opt_duplicate_deps=:				;;
1438*6881a400Schristos
1439*6881a400Schristos      --quiet|--silent)	preserve_args="$preserve_args $opt"
1440*6881a400Schristos			opt_silent=:
1441*6881a400Schristos			opt_verbose=false
1442*6881a400Schristos			;;
1443*6881a400Schristos
1444*6881a400Schristos      --no-quiet|--no-silent)
1445*6881a400Schristos			preserve_args="$preserve_args $opt"
1446*6881a400Schristos			opt_silent=false
1447*6881a400Schristos			;;
1448*6881a400Schristos
1449*6881a400Schristos      --verbose| -v)	preserve_args="$preserve_args $opt"
1450*6881a400Schristos			opt_silent=false
1451*6881a400Schristos			opt_verbose=:
1452*6881a400Schristos			;;
1453*6881a400Schristos
1454*6881a400Schristos      --no-verbose)	preserve_args="$preserve_args $opt"
1455*6881a400Schristos			opt_verbose=false
1456*6881a400Schristos			;;
1457*6881a400Schristos
1458*6881a400Schristos      --tag)		test "$#" -eq 0 && func_missing_arg "$opt" && break
1459*6881a400Schristos			preserve_args="$preserve_args $opt $1"
1460*6881a400Schristos			func_enable_tag "$1"	# tagname is set here
1461*6881a400Schristos			shift
1462*6881a400Schristos			;;
1463*6881a400Schristos
1464*6881a400Schristos      # Separate optargs to long options:
1465*6881a400Schristos      -dlopen=*|--mode=*|--tag=*)
1466*6881a400Schristos			func_opt_split "$opt"
1467*6881a400Schristos			set dummy "$func_opt_split_opt" "$func_opt_split_arg" ${1+"$@"}
1468*6881a400Schristos			shift
1469*6881a400Schristos			;;
1470*6881a400Schristos
1471*6881a400Schristos      -\?|-h)		func_usage					;;
1472*6881a400Schristos      --help)		opt_help=:					;;
1473*6881a400Schristos      --help-all)	opt_help=': help-all'				;;
1474*6881a400Schristos      --version)	func_version					;;
1475*6881a400Schristos
1476*6881a400Schristos      -*)		func_fatal_help "unrecognized option \`$opt'"	;;
1477*6881a400Schristos
1478*6881a400Schristos      *)		nonopt="$opt"
1479*6881a400Schristos			break
1480*6881a400Schristos			;;
1481*6881a400Schristos    esac
1482*6881a400Schristos  done
1483*6881a400Schristos
1484*6881a400Schristos
1485*6881a400Schristos  case $host in
1486*6881a400Schristos    *cygwin* | *mingw* | *pw32* | *cegcc* | *solaris2* )
1487*6881a400Schristos      # don't eliminate duplications in $postdeps and $predeps
1488*6881a400Schristos      opt_duplicate_compiler_generated_deps=:
1489*6881a400Schristos      ;;
1490*6881a400Schristos    *)
1491*6881a400Schristos      opt_duplicate_compiler_generated_deps=$opt_duplicate_deps
1492*6881a400Schristos      ;;
1493*6881a400Schristos  esac
1494*6881a400Schristos
1495*6881a400Schristos  # Having warned about all mis-specified options, bail out if
1496*6881a400Schristos  # anything was wrong.
1497*6881a400Schristos  $exit_cmd $EXIT_FAILURE
1498*6881a400Schristos}
1499*6881a400Schristos
1500*6881a400Schristos# func_check_version_match
1501*6881a400Schristos# Ensure that we are using m4 macros, and libtool script from the same
1502*6881a400Schristos# release of libtool.
1503*6881a400Schristosfunc_check_version_match ()
1504*6881a400Schristos{
1505*6881a400Schristos  if test "$package_revision" != "$macro_revision"; then
1506*6881a400Schristos    if test "$VERSION" != "$macro_version"; then
1507*6881a400Schristos      if test -z "$macro_version"; then
1508*6881a400Schristos        cat >&2 <<_LT_EOF
1509*6881a400Schristos$progname: Version mismatch error.  This is $PACKAGE $VERSION, but the
1510*6881a400Schristos$progname: definition of this LT_INIT comes from an older release.
1511*6881a400Schristos$progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION
1512*6881a400Schristos$progname: and run autoconf again.
1513*6881a400Schristos_LT_EOF
1514*6881a400Schristos      else
1515*6881a400Schristos        cat >&2 <<_LT_EOF
1516*6881a400Schristos$progname: Version mismatch error.  This is $PACKAGE $VERSION, but the
1517*6881a400Schristos$progname: definition of this LT_INIT comes from $PACKAGE $macro_version.
1518*6881a400Schristos$progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION
1519*6881a400Schristos$progname: and run autoconf again.
1520*6881a400Schristos_LT_EOF
1521*6881a400Schristos      fi
1522*6881a400Schristos    else
1523*6881a400Schristos      cat >&2 <<_LT_EOF
1524*6881a400Schristos$progname: Version mismatch error.  This is $PACKAGE $VERSION, revision $package_revision,
1525*6881a400Schristos$progname: but the definition of this LT_INIT comes from revision $macro_revision.
1526*6881a400Schristos$progname: You should recreate aclocal.m4 with macros from revision $package_revision
1527*6881a400Schristos$progname: of $PACKAGE $VERSION and run autoconf again.
1528*6881a400Schristos_LT_EOF
1529*6881a400Schristos    fi
1530*6881a400Schristos
1531*6881a400Schristos    exit $EXIT_MISMATCH
1532*6881a400Schristos  fi
1533*6881a400Schristos}
1534*6881a400Schristos
1535*6881a400Schristos
1536*6881a400Schristos## ----------- ##
1537*6881a400Schristos##    Main.    ##
1538*6881a400Schristos## ----------- ##
1539*6881a400Schristos
1540*6881a400Schristos$opt_help || {
1541*6881a400Schristos  # Sanity checks first:
1542*6881a400Schristos  func_check_version_match
1543*6881a400Schristos
1544*6881a400Schristos  if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
1545*6881a400Schristos    func_fatal_configuration "not configured to build any kind of library"
1546*6881a400Schristos  fi
1547*6881a400Schristos
1548*6881a400Schristos  test -z "$mode" && func_fatal_error "error: you must specify a MODE."
1549*6881a400Schristos
1550*6881a400Schristos
1551*6881a400Schristos  # Darwin sucks
1552*6881a400Schristos  eval "std_shrext=\"$shrext_cmds\""
1553*6881a400Schristos
1554*6881a400Schristos
1555*6881a400Schristos  # Only execute mode is allowed to have -dlopen flags.
1556*6881a400Schristos  if test -n "$execute_dlfiles" && test "$mode" != execute; then
1557*6881a400Schristos    func_error "unrecognized option \`-dlopen'"
1558*6881a400Schristos    $ECHO "$help" 1>&2
1559*6881a400Schristos    exit $EXIT_FAILURE
1560*6881a400Schristos  fi
1561*6881a400Schristos
1562*6881a400Schristos  # Change the help message to a mode-specific one.
1563*6881a400Schristos  generic_help="$help"
1564*6881a400Schristos  help="Try \`$progname --help --mode=$mode' for more information."
1565*6881a400Schristos}
1566*6881a400Schristos
1567*6881a400Schristos
1568*6881a400Schristos# func_lalib_p file
1569*6881a400Schristos# True iff FILE is a libtool `.la' library or `.lo' object file.
1570*6881a400Schristos# This function is only a basic sanity check; it will hardly flush out
1571*6881a400Schristos# determined imposters.
1572*6881a400Schristosfunc_lalib_p ()
1573*6881a400Schristos{
1574*6881a400Schristos    test -f "$1" &&
1575*6881a400Schristos      $SED -e 4q "$1" 2>/dev/null \
1576*6881a400Schristos        | $GREP "^# Generated by .*$PACKAGE" > /dev/null 2>&1
1577*6881a400Schristos}
1578*6881a400Schristos
1579*6881a400Schristos# func_lalib_unsafe_p file
1580*6881a400Schristos# True iff FILE is a libtool `.la' library or `.lo' object file.
1581*6881a400Schristos# This function implements the same check as func_lalib_p without
1582*6881a400Schristos# resorting to external programs.  To this end, it redirects stdin and
1583*6881a400Schristos# closes it afterwards, without saving the original file descriptor.
1584*6881a400Schristos# As a safety measure, use it only where a negative result would be
1585*6881a400Schristos# fatal anyway.  Works if `file' does not exist.
1586*6881a400Schristosfunc_lalib_unsafe_p ()
1587*6881a400Schristos{
1588*6881a400Schristos    lalib_p=no
1589*6881a400Schristos    if test -f "$1" && test -r "$1" && exec 5<&0 <"$1"; then
1590*6881a400Schristos	for lalib_p_l in 1 2 3 4
1591*6881a400Schristos	do
1592*6881a400Schristos	    read lalib_p_line
1593*6881a400Schristos	    case "$lalib_p_line" in
1594*6881a400Schristos		\#\ Generated\ by\ *$PACKAGE* ) lalib_p=yes; break;;
1595*6881a400Schristos	    esac
1596*6881a400Schristos	done
1597*6881a400Schristos	exec 0<&5 5<&-
1598*6881a400Schristos    fi
1599*6881a400Schristos    test "$lalib_p" = yes
1600*6881a400Schristos}
1601*6881a400Schristos
1602*6881a400Schristos# func_ltwrapper_script_p file
1603*6881a400Schristos# True iff FILE is a libtool wrapper script
1604*6881a400Schristos# This function is only a basic sanity check; it will hardly flush out
1605*6881a400Schristos# determined imposters.
1606*6881a400Schristosfunc_ltwrapper_script_p ()
1607*6881a400Schristos{
1608*6881a400Schristos    func_lalib_p "$1"
1609*6881a400Schristos}
1610*6881a400Schristos
1611*6881a400Schristos# func_ltwrapper_executable_p file
1612*6881a400Schristos# True iff FILE is a libtool wrapper executable
1613*6881a400Schristos# This function is only a basic sanity check; it will hardly flush out
1614*6881a400Schristos# determined imposters.
1615*6881a400Schristosfunc_ltwrapper_executable_p ()
1616*6881a400Schristos{
1617*6881a400Schristos    func_ltwrapper_exec_suffix=
1618*6881a400Schristos    case $1 in
1619*6881a400Schristos    *.exe) ;;
1620*6881a400Schristos    *) func_ltwrapper_exec_suffix=.exe ;;
1621*6881a400Schristos    esac
1622*6881a400Schristos    $GREP "$magic_exe" "$1$func_ltwrapper_exec_suffix" >/dev/null 2>&1
1623*6881a400Schristos}
1624*6881a400Schristos
1625*6881a400Schristos# func_ltwrapper_scriptname file
1626*6881a400Schristos# Assumes file is an ltwrapper_executable
1627*6881a400Schristos# uses $file to determine the appropriate filename for a
1628*6881a400Schristos# temporary ltwrapper_script.
1629*6881a400Schristosfunc_ltwrapper_scriptname ()
1630*6881a400Schristos{
1631*6881a400Schristos    func_ltwrapper_scriptname_result=""
1632*6881a400Schristos    if func_ltwrapper_executable_p "$1"; then
1633*6881a400Schristos	func_dirname_and_basename "$1" "" "."
1634*6881a400Schristos	func_stripname '' '.exe' "$func_basename_result"
1635*6881a400Schristos	func_ltwrapper_scriptname_result="$func_dirname_result/$objdir/${func_stripname_result}_ltshwrapper"
1636*6881a400Schristos    fi
1637*6881a400Schristos}
1638*6881a400Schristos
1639*6881a400Schristos# func_ltwrapper_p file
1640*6881a400Schristos# True iff FILE is a libtool wrapper script or wrapper executable
1641*6881a400Schristos# This function is only a basic sanity check; it will hardly flush out
1642*6881a400Schristos# determined imposters.
1643*6881a400Schristosfunc_ltwrapper_p ()
1644*6881a400Schristos{
1645*6881a400Schristos    func_ltwrapper_script_p "$1" || func_ltwrapper_executable_p "$1"
1646*6881a400Schristos}
1647*6881a400Schristos
1648*6881a400Schristos
1649*6881a400Schristos# func_execute_cmds commands fail_cmd
1650*6881a400Schristos# Execute tilde-delimited COMMANDS.
1651*6881a400Schristos# If FAIL_CMD is given, eval that upon failure.
1652*6881a400Schristos# FAIL_CMD may read-access the current command in variable CMD!
1653*6881a400Schristosfunc_execute_cmds ()
1654*6881a400Schristos{
1655*6881a400Schristos    $opt_debug
1656*6881a400Schristos    save_ifs=$IFS; IFS='~'
1657*6881a400Schristos    for cmd in $1; do
1658*6881a400Schristos      IFS=$save_ifs
1659*6881a400Schristos      eval "cmd=\"$cmd\""
1660*6881a400Schristos      func_show_eval "$cmd" "${2-:}"
1661*6881a400Schristos    done
1662*6881a400Schristos    IFS=$save_ifs
1663*6881a400Schristos}
1664*6881a400Schristos
1665*6881a400Schristos
1666*6881a400Schristos# func_source file
1667*6881a400Schristos# Source FILE, adding directory component if necessary.
1668*6881a400Schristos# Note that it is not necessary on cygwin/mingw to append a dot to
1669*6881a400Schristos# FILE even if both FILE and FILE.exe exist: automatic-append-.exe
1670*6881a400Schristos# behavior happens only for exec(3), not for open(2)!  Also, sourcing
1671*6881a400Schristos# `FILE.' does not work on cygwin managed mounts.
1672*6881a400Schristosfunc_source ()
1673*6881a400Schristos{
1674*6881a400Schristos    $opt_debug
1675*6881a400Schristos    case $1 in
1676*6881a400Schristos    */* | *\\*)	. "$1" ;;
1677*6881a400Schristos    *)		. "./$1" ;;
1678*6881a400Schristos    esac
1679*6881a400Schristos}
1680*6881a400Schristos
1681*6881a400Schristos
1682*6881a400Schristos# func_infer_tag arg
1683*6881a400Schristos# Infer tagged configuration to use if any are available and
1684*6881a400Schristos# if one wasn't chosen via the "--tag" command line option.
1685*6881a400Schristos# Only attempt this if the compiler in the base compile
1686*6881a400Schristos# command doesn't match the default compiler.
1687*6881a400Schristos# arg is usually of the form 'gcc ...'
1688*6881a400Schristosfunc_infer_tag ()
1689*6881a400Schristos{
1690*6881a400Schristos    $opt_debug
1691*6881a400Schristos    if test -n "$available_tags" && test -z "$tagname"; then
1692*6881a400Schristos      CC_quoted=
1693*6881a400Schristos      for arg in $CC; do
1694*6881a400Schristos        func_quote_for_eval "$arg"
1695*6881a400Schristos	CC_quoted="$CC_quoted $func_quote_for_eval_result"
1696*6881a400Schristos      done
1697*6881a400Schristos      CC_expanded=`func_echo_all $CC`
1698*6881a400Schristos      CC_quoted_expanded=`func_echo_all $CC_quoted`
1699*6881a400Schristos      case $@ in
1700*6881a400Schristos      # Blanks in the command may have been stripped by the calling shell,
1701*6881a400Schristos      # but not from the CC environment variable when configure was run.
1702*6881a400Schristos      " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \
1703*6881a400Schristos      " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*) ;;
1704*6881a400Schristos      # Blanks at the start of $base_compile will cause this to fail
1705*6881a400Schristos      # if we don't check for them as well.
1706*6881a400Schristos      *)
1707*6881a400Schristos	for z in $available_tags; do
1708*6881a400Schristos	  if $GREP "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then
1709*6881a400Schristos	    # Evaluate the configuration.
1710*6881a400Schristos	    eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`"
1711*6881a400Schristos	    CC_quoted=
1712*6881a400Schristos	    for arg in $CC; do
1713*6881a400Schristos	      # Double-quote args containing other shell metacharacters.
1714*6881a400Schristos	      func_quote_for_eval "$arg"
1715*6881a400Schristos	      CC_quoted="$CC_quoted $func_quote_for_eval_result"
1716*6881a400Schristos	    done
1717*6881a400Schristos	    CC_expanded=`func_echo_all $CC`
1718*6881a400Schristos	    CC_quoted_expanded=`func_echo_all $CC_quoted`
1719*6881a400Schristos	    case "$@ " in
1720*6881a400Schristos	    " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \
1721*6881a400Schristos	    " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*)
1722*6881a400Schristos	      # The compiler in the base compile command matches
1723*6881a400Schristos	      # the one in the tagged configuration.
1724*6881a400Schristos	      # Assume this is the tagged configuration we want.
1725*6881a400Schristos	      tagname=$z
1726*6881a400Schristos	      break
1727*6881a400Schristos	      ;;
1728*6881a400Schristos	    esac
1729*6881a400Schristos	  fi
1730*6881a400Schristos	done
1731*6881a400Schristos	# If $tagname still isn't set, then no tagged configuration
1732*6881a400Schristos	# was found and let the user know that the "--tag" command
1733*6881a400Schristos	# line option must be used.
1734*6881a400Schristos	if test -z "$tagname"; then
1735*6881a400Schristos	  func_echo "unable to infer tagged configuration"
1736*6881a400Schristos	  func_fatal_error "specify a tag with \`--tag'"
1737*6881a400Schristos#	else
1738*6881a400Schristos#	  func_verbose "using $tagname tagged configuration"
1739*6881a400Schristos	fi
1740*6881a400Schristos	;;
1741*6881a400Schristos      esac
1742*6881a400Schristos    fi
1743*6881a400Schristos}
1744*6881a400Schristos
1745*6881a400Schristos
1746*6881a400Schristos
1747*6881a400Schristos# func_write_libtool_object output_name pic_name nonpic_name
1748*6881a400Schristos# Create a libtool object file (analogous to a ".la" file),
1749*6881a400Schristos# but don't create it if we're doing a dry run.
1750*6881a400Schristosfunc_write_libtool_object ()
1751*6881a400Schristos{
1752*6881a400Schristos    write_libobj=${1}
1753*6881a400Schristos    if test "$build_libtool_libs" = yes; then
1754*6881a400Schristos      write_lobj=\'${2}\'
1755*6881a400Schristos    else
1756*6881a400Schristos      write_lobj=none
1757*6881a400Schristos    fi
1758*6881a400Schristos
1759*6881a400Schristos    if test "$build_old_libs" = yes; then
1760*6881a400Schristos      write_oldobj=\'${3}\'
1761*6881a400Schristos    else
1762*6881a400Schristos      write_oldobj=none
1763*6881a400Schristos    fi
1764*6881a400Schristos
1765*6881a400Schristos    $opt_dry_run || {
1766*6881a400Schristos      cat >${write_libobj}T <<EOF
1767*6881a400Schristos# $write_libobj - a libtool object file
1768*6881a400Schristos# Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
1769*6881a400Schristos#
1770*6881a400Schristos# Please DO NOT delete this file!
1771*6881a400Schristos# It is necessary for linking the library.
1772*6881a400Schristos
1773*6881a400Schristos# Name of the PIC object.
1774*6881a400Schristospic_object=$write_lobj
1775*6881a400Schristos
1776*6881a400Schristos# Name of the non-PIC object
1777*6881a400Schristosnon_pic_object=$write_oldobj
1778*6881a400Schristos
1779*6881a400SchristosEOF
1780*6881a400Schristos      $MV "${write_libobj}T" "${write_libobj}"
1781*6881a400Schristos    }
1782*6881a400Schristos}
1783*6881a400Schristos
1784*6881a400Schristos# func_mode_compile arg...
1785*6881a400Schristosfunc_mode_compile ()
1786*6881a400Schristos{
1787*6881a400Schristos    $opt_debug
1788*6881a400Schristos    # Get the compilation command and the source file.
1789*6881a400Schristos    base_compile=
1790*6881a400Schristos    srcfile="$nonopt"  #  always keep a non-empty value in "srcfile"
1791*6881a400Schristos    suppress_opt=yes
1792*6881a400Schristos    suppress_output=
1793*6881a400Schristos    arg_mode=normal
1794*6881a400Schristos    libobj=
1795*6881a400Schristos    later=
1796*6881a400Schristos    pie_flag=
1797*6881a400Schristos
1798*6881a400Schristos    for arg
1799*6881a400Schristos    do
1800*6881a400Schristos      case $arg_mode in
1801*6881a400Schristos      arg  )
1802*6881a400Schristos	# do not "continue".  Instead, add this to base_compile
1803*6881a400Schristos	lastarg="$arg"
1804*6881a400Schristos	arg_mode=normal
1805*6881a400Schristos	;;
1806*6881a400Schristos
1807*6881a400Schristos      target )
1808*6881a400Schristos	libobj="$arg"
1809*6881a400Schristos	arg_mode=normal
1810*6881a400Schristos	continue
1811*6881a400Schristos	;;
1812*6881a400Schristos
1813*6881a400Schristos      normal )
1814*6881a400Schristos	# Accept any command-line options.
1815*6881a400Schristos	case $arg in
1816*6881a400Schristos	-o)
1817*6881a400Schristos	  test -n "$libobj" && \
1818*6881a400Schristos	    func_fatal_error "you cannot specify \`-o' more than once"
1819*6881a400Schristos	  arg_mode=target
1820*6881a400Schristos	  continue
1821*6881a400Schristos	  ;;
1822*6881a400Schristos
1823*6881a400Schristos	-pie | -fpie | -fPIE)
1824*6881a400Schristos          pie_flag="$pie_flag $arg"
1825*6881a400Schristos	  continue
1826*6881a400Schristos	  ;;
1827*6881a400Schristos
1828*6881a400Schristos	-shared | -static | -prefer-pic | -prefer-non-pic)
1829*6881a400Schristos	  later="$later $arg"
1830*6881a400Schristos	  continue
1831*6881a400Schristos	  ;;
1832*6881a400Schristos
1833*6881a400Schristos	-no-suppress)
1834*6881a400Schristos	  suppress_opt=no
1835*6881a400Schristos	  continue
1836*6881a400Schristos	  ;;
1837*6881a400Schristos
1838*6881a400Schristos	-Xcompiler)
1839*6881a400Schristos	  arg_mode=arg  #  the next one goes into the "base_compile" arg list
1840*6881a400Schristos	  continue      #  The current "srcfile" will either be retained or
1841*6881a400Schristos	  ;;            #  replaced later.  I would guess that would be a bug.
1842*6881a400Schristos
1843*6881a400Schristos	-Wc,*)
1844*6881a400Schristos	  func_stripname '-Wc,' '' "$arg"
1845*6881a400Schristos	  args=$func_stripname_result
1846*6881a400Schristos	  lastarg=
1847*6881a400Schristos	  save_ifs="$IFS"; IFS=','
1848*6881a400Schristos	  for arg in $args; do
1849*6881a400Schristos	    IFS="$save_ifs"
1850*6881a400Schristos	    func_quote_for_eval "$arg"
1851*6881a400Schristos	    lastarg="$lastarg $func_quote_for_eval_result"
1852*6881a400Schristos	  done
1853*6881a400Schristos	  IFS="$save_ifs"
1854*6881a400Schristos	  func_stripname ' ' '' "$lastarg"
1855*6881a400Schristos	  lastarg=$func_stripname_result
1856*6881a400Schristos
1857*6881a400Schristos	  # Add the arguments to base_compile.
1858*6881a400Schristos	  base_compile="$base_compile $lastarg"
1859*6881a400Schristos	  continue
1860*6881a400Schristos	  ;;
1861*6881a400Schristos
1862*6881a400Schristos	*)
1863*6881a400Schristos	  # Accept the current argument as the source file.
1864*6881a400Schristos	  # The previous "srcfile" becomes the current argument.
1865*6881a400Schristos	  #
1866*6881a400Schristos	  lastarg="$srcfile"
1867*6881a400Schristos	  srcfile="$arg"
1868*6881a400Schristos	  ;;
1869*6881a400Schristos	esac  #  case $arg
1870*6881a400Schristos	;;
1871*6881a400Schristos      esac    #  case $arg_mode
1872*6881a400Schristos
1873*6881a400Schristos      # Aesthetically quote the previous argument.
1874*6881a400Schristos      func_quote_for_eval "$lastarg"
1875*6881a400Schristos      base_compile="$base_compile $func_quote_for_eval_result"
1876*6881a400Schristos    done # for arg
1877*6881a400Schristos
1878*6881a400Schristos    case $arg_mode in
1879*6881a400Schristos    arg)
1880*6881a400Schristos      func_fatal_error "you must specify an argument for -Xcompile"
1881*6881a400Schristos      ;;
1882*6881a400Schristos    target)
1883*6881a400Schristos      func_fatal_error "you must specify a target with \`-o'"
1884*6881a400Schristos      ;;
1885*6881a400Schristos    *)
1886*6881a400Schristos      # Get the name of the library object.
1887*6881a400Schristos      test -z "$libobj" && {
1888*6881a400Schristos	func_basename "$srcfile"
1889*6881a400Schristos	libobj="$func_basename_result"
1890*6881a400Schristos      }
1891*6881a400Schristos      ;;
1892*6881a400Schristos    esac
1893*6881a400Schristos
1894*6881a400Schristos    # Recognize several different file suffixes.
1895*6881a400Schristos    # If the user specifies -o file.o, it is replaced with file.lo
1896*6881a400Schristos    case $libobj in
1897*6881a400Schristos    *.[cCFSifmso] | \
1898*6881a400Schristos    *.ada | *.adb | *.ads | *.asm | \
1899*6881a400Schristos    *.c++ | *.cc | *.ii | *.class | *.cpp | *.cxx | \
1900*6881a400Schristos    *.[fF][09]? | *.for | *.java | *.obj | *.sx | *.cu | *.cup)
1901*6881a400Schristos      func_xform "$libobj"
1902*6881a400Schristos      libobj=$func_xform_result
1903*6881a400Schristos      ;;
1904*6881a400Schristos    esac
1905*6881a400Schristos
1906*6881a400Schristos    case $libobj in
1907*6881a400Schristos    *.lo) func_lo2o "$libobj"; obj=$func_lo2o_result ;;
1908*6881a400Schristos    *)
1909*6881a400Schristos      func_fatal_error "cannot determine name of library object from \`$libobj'"
1910*6881a400Schristos      ;;
1911*6881a400Schristos    esac
1912*6881a400Schristos
1913*6881a400Schristos    func_infer_tag $base_compile
1914*6881a400Schristos
1915*6881a400Schristos    for arg in $later; do
1916*6881a400Schristos      case $arg in
1917*6881a400Schristos      -shared)
1918*6881a400Schristos	test "$build_libtool_libs" != yes && \
1919*6881a400Schristos	  func_fatal_configuration "can not build a shared library"
1920*6881a400Schristos	build_old_libs=no
1921*6881a400Schristos	continue
1922*6881a400Schristos	;;
1923*6881a400Schristos
1924*6881a400Schristos      -static)
1925*6881a400Schristos	build_libtool_libs=no
1926*6881a400Schristos	build_old_libs=yes
1927*6881a400Schristos	continue
1928*6881a400Schristos	;;
1929*6881a400Schristos
1930*6881a400Schristos      -prefer-pic)
1931*6881a400Schristos	pic_mode=yes
1932*6881a400Schristos	continue
1933*6881a400Schristos	;;
1934*6881a400Schristos
1935*6881a400Schristos      -prefer-non-pic)
1936*6881a400Schristos	pic_mode=no
1937*6881a400Schristos	continue
1938*6881a400Schristos	;;
1939*6881a400Schristos      esac
1940*6881a400Schristos    done
1941*6881a400Schristos
1942*6881a400Schristos    func_quote_for_eval "$libobj"
1943*6881a400Schristos    test "X$libobj" != "X$func_quote_for_eval_result" \
1944*6881a400Schristos      && $ECHO "X$libobj" | $GREP '[]~#^*{};<>?"'"'"'	 &()|`$[]' \
1945*6881a400Schristos      && func_warning "libobj name \`$libobj' may not contain shell special characters."
1946*6881a400Schristos    func_dirname_and_basename "$obj" "/" ""
1947*6881a400Schristos    objname="$func_basename_result"
1948*6881a400Schristos    xdir="$func_dirname_result"
1949*6881a400Schristos    lobj=${xdir}$objdir/$objname
1950*6881a400Schristos
1951*6881a400Schristos    test -z "$base_compile" && \
1952*6881a400Schristos      func_fatal_help "you must specify a compilation command"
1953*6881a400Schristos
1954*6881a400Schristos    # Delete any leftover library objects.
1955*6881a400Schristos    if test "$build_old_libs" = yes; then
1956*6881a400Schristos      removelist="$obj $lobj $libobj ${libobj}T"
1957*6881a400Schristos    else
1958*6881a400Schristos      removelist="$lobj $libobj ${libobj}T"
1959*6881a400Schristos    fi
1960*6881a400Schristos
1961*6881a400Schristos    # On Cygwin there's no "real" PIC flag so we must build both object types
1962*6881a400Schristos    case $host_os in
1963*6881a400Schristos    cygwin* | mingw* | pw32* | os2* | cegcc*)
1964*6881a400Schristos      pic_mode=default
1965*6881a400Schristos      ;;
1966*6881a400Schristos    esac
1967*6881a400Schristos    if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then
1968*6881a400Schristos      # non-PIC code in shared libraries is not supported
1969*6881a400Schristos      pic_mode=default
1970*6881a400Schristos    fi
1971*6881a400Schristos
1972*6881a400Schristos    # Calculate the filename of the output object if compiler does
1973*6881a400Schristos    # not support -o with -c
1974*6881a400Schristos    if test "$compiler_c_o" = no; then
1975*6881a400Schristos      output_obj=`$ECHO "$srcfile" | $SED 's%^.*/%%; s%\.[^.]*$%%'`.${objext}
1976*6881a400Schristos      lockfile="$output_obj.lock"
1977*6881a400Schristos    else
1978*6881a400Schristos      output_obj=
1979*6881a400Schristos      need_locks=no
1980*6881a400Schristos      lockfile=
1981*6881a400Schristos    fi
1982*6881a400Schristos
1983*6881a400Schristos    # Lock this critical section if it is needed
1984*6881a400Schristos    # We use this script file to make the link, it avoids creating a new file
1985*6881a400Schristos    if test "$need_locks" = yes; then
1986*6881a400Schristos      until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do
1987*6881a400Schristos	func_echo "Waiting for $lockfile to be removed"
1988*6881a400Schristos	sleep 2
1989*6881a400Schristos      done
1990*6881a400Schristos    elif test "$need_locks" = warn; then
1991*6881a400Schristos      if test -f "$lockfile"; then
1992*6881a400Schristos	$ECHO "\
1993*6881a400Schristos*** ERROR, $lockfile exists and contains:
1994*6881a400Schristos`cat $lockfile 2>/dev/null`
1995*6881a400Schristos
1996*6881a400SchristosThis indicates that another process is trying to use the same
1997*6881a400Schristostemporary object file, and libtool could not work around it because
1998*6881a400Schristosyour compiler does not support \`-c' and \`-o' together.  If you
1999*6881a400Schristosrepeat this compilation, it may succeed, by chance, but you had better
2000*6881a400Schristosavoid parallel builds (make -j) in this platform, or get a better
2001*6881a400Schristoscompiler."
2002*6881a400Schristos
2003*6881a400Schristos	$opt_dry_run || $RM $removelist
2004*6881a400Schristos	exit $EXIT_FAILURE
2005*6881a400Schristos      fi
2006*6881a400Schristos      removelist="$removelist $output_obj"
2007*6881a400Schristos      $ECHO "$srcfile" > "$lockfile"
2008*6881a400Schristos    fi
2009*6881a400Schristos
2010*6881a400Schristos    $opt_dry_run || $RM $removelist
2011*6881a400Schristos    removelist="$removelist $lockfile"
2012*6881a400Schristos    trap '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' 1 2 15
2013*6881a400Schristos
2014*6881a400Schristos    if test -n "$fix_srcfile_path"; then
2015*6881a400Schristos      eval "srcfile=\"$fix_srcfile_path\""
2016*6881a400Schristos    fi
2017*6881a400Schristos    func_quote_for_eval "$srcfile"
2018*6881a400Schristos    qsrcfile=$func_quote_for_eval_result
2019*6881a400Schristos
2020*6881a400Schristos    # Only build a PIC object if we are building libtool libraries.
2021*6881a400Schristos    if test "$build_libtool_libs" = yes; then
2022*6881a400Schristos      # Without this assignment, base_compile gets emptied.
2023*6881a400Schristos      fbsd_hideous_sh_bug=$base_compile
2024*6881a400Schristos
2025*6881a400Schristos      if test "$pic_mode" != no; then
2026*6881a400Schristos	command="$base_compile $qsrcfile $pic_flag"
2027*6881a400Schristos      else
2028*6881a400Schristos	# Don't build PIC code
2029*6881a400Schristos	command="$base_compile $qsrcfile"
2030*6881a400Schristos      fi
2031*6881a400Schristos
2032*6881a400Schristos      func_mkdir_p "$xdir$objdir"
2033*6881a400Schristos
2034*6881a400Schristos      if test -z "$output_obj"; then
2035*6881a400Schristos	# Place PIC objects in $objdir
2036*6881a400Schristos	command="$command -o $lobj"
2037*6881a400Schristos      fi
2038*6881a400Schristos
2039*6881a400Schristos      func_show_eval_locale "$command"	\
2040*6881a400Schristos          'test -n "$output_obj" && $RM $removelist; exit $EXIT_FAILURE'
2041*6881a400Schristos
2042*6881a400Schristos      if test "$need_locks" = warn &&
2043*6881a400Schristos	 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
2044*6881a400Schristos	$ECHO "\
2045*6881a400Schristos*** ERROR, $lockfile contains:
2046*6881a400Schristos`cat $lockfile 2>/dev/null`
2047*6881a400Schristos
2048*6881a400Schristosbut it should contain:
2049*6881a400Schristos$srcfile
2050*6881a400Schristos
2051*6881a400SchristosThis indicates that another process is trying to use the same
2052*6881a400Schristostemporary object file, and libtool could not work around it because
2053*6881a400Schristosyour compiler does not support \`-c' and \`-o' together.  If you
2054*6881a400Schristosrepeat this compilation, it may succeed, by chance, but you had better
2055*6881a400Schristosavoid parallel builds (make -j) in this platform, or get a better
2056*6881a400Schristoscompiler."
2057*6881a400Schristos
2058*6881a400Schristos	$opt_dry_run || $RM $removelist
2059*6881a400Schristos	exit $EXIT_FAILURE
2060*6881a400Schristos      fi
2061*6881a400Schristos
2062*6881a400Schristos      # Just move the object if needed, then go on to compile the next one
2063*6881a400Schristos      if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then
2064*6881a400Schristos	func_show_eval '$MV "$output_obj" "$lobj"' \
2065*6881a400Schristos	  'error=$?; $opt_dry_run || $RM $removelist; exit $error'
2066*6881a400Schristos      fi
2067*6881a400Schristos
2068*6881a400Schristos      # Allow error messages only from the first compilation.
2069*6881a400Schristos      if test "$suppress_opt" = yes; then
2070*6881a400Schristos	suppress_output=' >/dev/null 2>&1'
2071*6881a400Schristos      fi
2072*6881a400Schristos    fi
2073*6881a400Schristos
2074*6881a400Schristos    # Only build a position-dependent object if we build old libraries.
2075*6881a400Schristos    if test "$build_old_libs" = yes; then
2076*6881a400Schristos      if test "$pic_mode" != yes; then
2077*6881a400Schristos	# Don't build PIC code
2078*6881a400Schristos	command="$base_compile $qsrcfile$pie_flag"
2079*6881a400Schristos      else
2080*6881a400Schristos	command="$base_compile $qsrcfile $pic_flag"
2081*6881a400Schristos      fi
2082*6881a400Schristos      if test "$compiler_c_o" = yes; then
2083*6881a400Schristos	command="$command -o $obj"
2084*6881a400Schristos      fi
2085*6881a400Schristos
2086*6881a400Schristos      # Suppress compiler output if we already did a PIC compilation.
2087*6881a400Schristos      command="$command$suppress_output"
2088*6881a400Schristos      func_show_eval_locale "$command" \
2089*6881a400Schristos        '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE'
2090*6881a400Schristos
2091*6881a400Schristos      if test "$need_locks" = warn &&
2092*6881a400Schristos	 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
2093*6881a400Schristos	$ECHO "\
2094*6881a400Schristos*** ERROR, $lockfile contains:
2095*6881a400Schristos`cat $lockfile 2>/dev/null`
2096*6881a400Schristos
2097*6881a400Schristosbut it should contain:
2098*6881a400Schristos$srcfile
2099*6881a400Schristos
2100*6881a400SchristosThis indicates that another process is trying to use the same
2101*6881a400Schristostemporary object file, and libtool could not work around it because
2102*6881a400Schristosyour compiler does not support \`-c' and \`-o' together.  If you
2103*6881a400Schristosrepeat this compilation, it may succeed, by chance, but you had better
2104*6881a400Schristosavoid parallel builds (make -j) in this platform, or get a better
2105*6881a400Schristoscompiler."
2106*6881a400Schristos
2107*6881a400Schristos	$opt_dry_run || $RM $removelist
2108*6881a400Schristos	exit $EXIT_FAILURE
2109*6881a400Schristos      fi
2110*6881a400Schristos
2111*6881a400Schristos      # Just move the object if needed
2112*6881a400Schristos      if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then
2113*6881a400Schristos	func_show_eval '$MV "$output_obj" "$obj"' \
2114*6881a400Schristos	  'error=$?; $opt_dry_run || $RM $removelist; exit $error'
2115*6881a400Schristos      fi
2116*6881a400Schristos    fi
2117*6881a400Schristos
2118*6881a400Schristos    $opt_dry_run || {
2119*6881a400Schristos      func_write_libtool_object "$libobj" "$objdir/$objname" "$objname"
2120*6881a400Schristos
2121*6881a400Schristos      # Unlock the critical section if it was locked
2122*6881a400Schristos      if test "$need_locks" != no; then
2123*6881a400Schristos	removelist=$lockfile
2124*6881a400Schristos        $RM "$lockfile"
2125*6881a400Schristos      fi
2126*6881a400Schristos    }
2127*6881a400Schristos
2128*6881a400Schristos    exit $EXIT_SUCCESS
2129*6881a400Schristos}
2130*6881a400Schristos
2131*6881a400Schristos$opt_help || {
2132*6881a400Schristos  test "$mode" = compile && func_mode_compile ${1+"$@"}
2133*6881a400Schristos}
2134*6881a400Schristos
2135*6881a400Schristosfunc_mode_help ()
2136*6881a400Schristos{
2137*6881a400Schristos    # We need to display help for each of the modes.
2138*6881a400Schristos    case $mode in
2139*6881a400Schristos      "")
2140*6881a400Schristos        # Generic help is extracted from the usage comments
2141*6881a400Schristos        # at the start of this file.
2142*6881a400Schristos        func_help
2143*6881a400Schristos        ;;
2144*6881a400Schristos
2145*6881a400Schristos      clean)
2146*6881a400Schristos        $ECHO \
2147*6881a400Schristos"Usage: $progname [OPTION]... --mode=clean RM [RM-OPTION]... FILE...
2148*6881a400Schristos
2149*6881a400SchristosRemove files from the build directory.
2150*6881a400Schristos
2151*6881a400SchristosRM is the name of the program to use to delete files associated with each FILE
2152*6881a400Schristos(typically \`/bin/rm').  RM-OPTIONS are options (such as \`-f') to be passed
2153*6881a400Schristosto RM.
2154*6881a400Schristos
2155*6881a400SchristosIf FILE is a libtool library, object or program, all the files associated
2156*6881a400Schristoswith it are deleted. Otherwise, only FILE itself is deleted using RM."
2157*6881a400Schristos        ;;
2158*6881a400Schristos
2159*6881a400Schristos      compile)
2160*6881a400Schristos      $ECHO \
2161*6881a400Schristos"Usage: $progname [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE
2162*6881a400Schristos
2163*6881a400SchristosCompile a source file into a libtool library object.
2164*6881a400Schristos
2165*6881a400SchristosThis mode accepts the following additional options:
2166*6881a400Schristos
2167*6881a400Schristos  -o OUTPUT-FILE    set the output file name to OUTPUT-FILE
2168*6881a400Schristos  -no-suppress      do not suppress compiler output for multiple passes
2169*6881a400Schristos  -prefer-pic       try to building PIC objects only
2170*6881a400Schristos  -prefer-non-pic   try to building non-PIC objects only
2171*6881a400Schristos  -shared           do not build a \`.o' file suitable for static linking
2172*6881a400Schristos  -static           only build a \`.o' file suitable for static linking
2173*6881a400Schristos  -Wc,FLAG          pass FLAG directly to the compiler
2174*6881a400Schristos
2175*6881a400SchristosCOMPILE-COMMAND is a command to be used in creating a \`standard' object file
2176*6881a400Schristosfrom the given SOURCEFILE.
2177*6881a400Schristos
2178*6881a400SchristosThe output file name is determined by removing the directory component from
2179*6881a400SchristosSOURCEFILE, then substituting the C source code suffix \`.c' with the
2180*6881a400Schristoslibrary object suffix, \`.lo'."
2181*6881a400Schristos        ;;
2182*6881a400Schristos
2183*6881a400Schristos      execute)
2184*6881a400Schristos        $ECHO \
2185*6881a400Schristos"Usage: $progname [OPTION]... --mode=execute COMMAND [ARGS]...
2186*6881a400Schristos
2187*6881a400SchristosAutomatically set library path, then run a program.
2188*6881a400Schristos
2189*6881a400SchristosThis mode accepts the following additional options:
2190*6881a400Schristos
2191*6881a400Schristos  -dlopen FILE      add the directory containing FILE to the library path
2192*6881a400Schristos
2193*6881a400SchristosThis mode sets the library path environment variable according to \`-dlopen'
2194*6881a400Schristosflags.
2195*6881a400Schristos
2196*6881a400SchristosIf any of the ARGS are libtool executable wrappers, then they are translated
2197*6881a400Schristosinto their corresponding uninstalled binary, and any of their required library
2198*6881a400Schristosdirectories are added to the library path.
2199*6881a400Schristos
2200*6881a400SchristosThen, COMMAND is executed, with ARGS as arguments."
2201*6881a400Schristos        ;;
2202*6881a400Schristos
2203*6881a400Schristos      finish)
2204*6881a400Schristos        $ECHO \
2205*6881a400Schristos"Usage: $progname [OPTION]... --mode=finish [LIBDIR]...
2206*6881a400Schristos
2207*6881a400SchristosComplete the installation of libtool libraries.
2208*6881a400Schristos
2209*6881a400SchristosEach LIBDIR is a directory that contains libtool libraries.
2210*6881a400Schristos
2211*6881a400SchristosThe commands that this mode executes may require superuser privileges.  Use
2212*6881a400Schristosthe \`--dry-run' option if you just want to see what would be executed."
2213*6881a400Schristos        ;;
2214*6881a400Schristos
2215*6881a400Schristos      install)
2216*6881a400Schristos        $ECHO \
2217*6881a400Schristos"Usage: $progname [OPTION]... --mode=install INSTALL-COMMAND...
2218*6881a400Schristos
2219*6881a400SchristosInstall executables or libraries.
2220*6881a400Schristos
2221*6881a400SchristosINSTALL-COMMAND is the installation command.  The first component should be
2222*6881a400Schristoseither the \`install' or \`cp' program.
2223*6881a400Schristos
2224*6881a400SchristosThe following components of INSTALL-COMMAND are treated specially:
2225*6881a400Schristos
2226*6881a400Schristos  -inst-prefix-dir PREFIX-DIR  Use PREFIX-DIR as a staging area for installation
2227*6881a400Schristos
2228*6881a400SchristosThe rest of the components are interpreted as arguments to that command (only
2229*6881a400SchristosBSD-compatible install options are recognized)."
2230*6881a400Schristos        ;;
2231*6881a400Schristos
2232*6881a400Schristos      link)
2233*6881a400Schristos        $ECHO \
2234*6881a400Schristos"Usage: $progname [OPTION]... --mode=link LINK-COMMAND...
2235*6881a400Schristos
2236*6881a400SchristosLink object files or libraries together to form another library, or to
2237*6881a400Schristoscreate an executable program.
2238*6881a400Schristos
2239*6881a400SchristosLINK-COMMAND is a command using the C compiler that you would use to create
2240*6881a400Schristosa program from several object files.
2241*6881a400Schristos
2242*6881a400SchristosThe following components of LINK-COMMAND are treated specially:
2243*6881a400Schristos
2244*6881a400Schristos  -all-static       do not do any dynamic linking at all
2245*6881a400Schristos  -avoid-version    do not add a version suffix if possible
2246*6881a400Schristos  -bindir BINDIR    specify path to binaries directory (for systems where
2247*6881a400Schristos                    libraries must be found in the PATH setting at runtime)
2248*6881a400Schristos  -dlopen FILE      \`-dlpreopen' FILE if it cannot be dlopened at runtime
2249*6881a400Schristos  -dlpreopen FILE   link in FILE and add its symbols to lt_preloaded_symbols
2250*6881a400Schristos  -export-dynamic   allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
2251*6881a400Schristos  -export-symbols SYMFILE
2252*6881a400Schristos                    try to export only the symbols listed in SYMFILE
2253*6881a400Schristos  -export-symbols-regex REGEX
2254*6881a400Schristos                    try to export only the symbols matching REGEX
2255*6881a400Schristos  -LLIBDIR          search LIBDIR for required installed libraries
2256*6881a400Schristos  -lNAME            OUTPUT-FILE requires the installed library libNAME
2257*6881a400Schristos  -module           build a library that can dlopened
2258*6881a400Schristos  -no-fast-install  disable the fast-install mode
2259*6881a400Schristos  -no-install       link a not-installable executable
2260*6881a400Schristos  -no-undefined     declare that a library does not refer to external symbols
2261*6881a400Schristos  -o OUTPUT-FILE    create OUTPUT-FILE from the specified objects
2262*6881a400Schristos  -objectlist FILE  Use a list of object files found in FILE to specify objects
2263*6881a400Schristos  -precious-files-regex REGEX
2264*6881a400Schristos                    don't remove output files matching REGEX
2265*6881a400Schristos  -release RELEASE  specify package release information
2266*6881a400Schristos  -rpath LIBDIR     the created library will eventually be installed in LIBDIR
2267*6881a400Schristos  -R[ ]LIBDIR       add LIBDIR to the runtime path of programs and libraries
2268*6881a400Schristos  -shared           only do dynamic linking of libtool libraries
2269*6881a400Schristos  -shrext SUFFIX    override the standard shared library file extension
2270*6881a400Schristos  -static           do not do any dynamic linking of uninstalled libtool libraries
2271*6881a400Schristos  -static-libtool-libs
2272*6881a400Schristos                    do not do any dynamic linking of libtool libraries
2273*6881a400Schristos  -version-info CURRENT[:REVISION[:AGE]]
2274*6881a400Schristos                    specify library version info [each variable defaults to 0]
2275*6881a400Schristos  -weak LIBNAME     declare that the target provides the LIBNAME interface
2276*6881a400Schristos  -Wc,FLAG
2277*6881a400Schristos  -Xcompiler FLAG   pass linker-specific FLAG directly to the compiler
2278*6881a400Schristos  -Wl,FLAG
2279*6881a400Schristos  -Xlinker FLAG     pass linker-specific FLAG directly to the linker
2280*6881a400Schristos  -XCClinker FLAG   pass link-specific FLAG to the compiler driver (CC)
2281*6881a400Schristos
2282*6881a400SchristosAll other options (arguments beginning with \`-') are ignored.
2283*6881a400Schristos
2284*6881a400SchristosEvery other argument is treated as a filename.  Files ending in \`.la' are
2285*6881a400Schristostreated as uninstalled libtool libraries, other files are standard or library
2286*6881a400Schristosobject files.
2287*6881a400Schristos
2288*6881a400SchristosIf the OUTPUT-FILE ends in \`.la', then a libtool library is created,
2289*6881a400Schristosonly library objects (\`.lo' files) may be specified, and \`-rpath' is
2290*6881a400Schristosrequired, except when creating a convenience library.
2291*6881a400Schristos
2292*6881a400SchristosIf OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created
2293*6881a400Schristosusing \`ar' and \`ranlib', or on Windows using \`lib'.
2294*6881a400Schristos
2295*6881a400SchristosIf OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file
2296*6881a400Schristosis created, otherwise an executable program is created."
2297*6881a400Schristos        ;;
2298*6881a400Schristos
2299*6881a400Schristos      uninstall)
2300*6881a400Schristos        $ECHO \
2301*6881a400Schristos"Usage: $progname [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE...
2302*6881a400Schristos
2303*6881a400SchristosRemove libraries from an installation directory.
2304*6881a400Schristos
2305*6881a400SchristosRM is the name of the program to use to delete files associated with each FILE
2306*6881a400Schristos(typically \`/bin/rm').  RM-OPTIONS are options (such as \`-f') to be passed
2307*6881a400Schristosto RM.
2308*6881a400Schristos
2309*6881a400SchristosIf FILE is a libtool library, all the files associated with it are deleted.
2310*6881a400SchristosOtherwise, only FILE itself is deleted using RM."
2311*6881a400Schristos        ;;
2312*6881a400Schristos
2313*6881a400Schristos      *)
2314*6881a400Schristos        func_fatal_help "invalid operation mode \`$mode'"
2315*6881a400Schristos        ;;
2316*6881a400Schristos    esac
2317*6881a400Schristos
2318*6881a400Schristos    echo
2319*6881a400Schristos    $ECHO "Try \`$progname --help' for more information about other modes."
2320*6881a400Schristos}
2321*6881a400Schristos
2322*6881a400Schristos# Now that we've collected a possible --mode arg, show help if necessary
2323*6881a400Schristosif $opt_help; then
2324*6881a400Schristos  if test "$opt_help" = :; then
2325*6881a400Schristos    func_mode_help
2326*6881a400Schristos  else
2327*6881a400Schristos    {
2328*6881a400Schristos      func_help noexit
2329*6881a400Schristos      for mode in compile link execute install finish uninstall clean; do
2330*6881a400Schristos	func_mode_help
2331*6881a400Schristos      done
2332*6881a400Schristos    } | sed -n '1p; 2,$s/^Usage:/  or: /p'
2333*6881a400Schristos    {
2334*6881a400Schristos      func_help noexit
2335*6881a400Schristos      for mode in compile link execute install finish uninstall clean; do
2336*6881a400Schristos	echo
2337*6881a400Schristos	func_mode_help
2338*6881a400Schristos      done
2339*6881a400Schristos    } |
2340*6881a400Schristos    sed '1d
2341*6881a400Schristos      /^When reporting/,/^Report/{
2342*6881a400Schristos	H
2343*6881a400Schristos	d
2344*6881a400Schristos      }
2345*6881a400Schristos      $x
2346*6881a400Schristos      /information about other modes/d
2347*6881a400Schristos      /more detailed .*MODE/d
2348*6881a400Schristos      s/^Usage:.*--mode=\([^ ]*\) .*/Description of \1 mode:/'
2349*6881a400Schristos  fi
2350*6881a400Schristos  exit $?
2351*6881a400Schristosfi
2352*6881a400Schristos
2353*6881a400Schristos
2354*6881a400Schristos# func_mode_execute arg...
2355*6881a400Schristosfunc_mode_execute ()
2356*6881a400Schristos{
2357*6881a400Schristos    $opt_debug
2358*6881a400Schristos    # The first argument is the command name.
2359*6881a400Schristos    cmd="$nonopt"
2360*6881a400Schristos    test -z "$cmd" && \
2361*6881a400Schristos      func_fatal_help "you must specify a COMMAND"
2362*6881a400Schristos
2363*6881a400Schristos    # Handle -dlopen flags immediately.
2364*6881a400Schristos    for file in $execute_dlfiles; do
2365*6881a400Schristos      test -f "$file" \
2366*6881a400Schristos	|| func_fatal_help "\`$file' is not a file"
2367*6881a400Schristos
2368*6881a400Schristos      dir=
2369*6881a400Schristos      case $file in
2370*6881a400Schristos      *.la)
2371*6881a400Schristos	# Check to see that this really is a libtool archive.
2372*6881a400Schristos	func_lalib_unsafe_p "$file" \
2373*6881a400Schristos	  || func_fatal_help "\`$lib' is not a valid libtool archive"
2374*6881a400Schristos
2375*6881a400Schristos	# Read the libtool library.
2376*6881a400Schristos	dlname=
2377*6881a400Schristos	library_names=
2378*6881a400Schristos	func_source "$file"
2379*6881a400Schristos
2380*6881a400Schristos	# Skip this library if it cannot be dlopened.
2381*6881a400Schristos	if test -z "$dlname"; then
2382*6881a400Schristos	  # Warn if it was a shared library.
2383*6881a400Schristos	  test -n "$library_names" && \
2384*6881a400Schristos	    func_warning "\`$file' was not linked with \`-export-dynamic'"
2385*6881a400Schristos	  continue
2386*6881a400Schristos	fi
2387*6881a400Schristos
2388*6881a400Schristos	func_dirname "$file" "" "."
2389*6881a400Schristos	dir="$func_dirname_result"
2390*6881a400Schristos
2391*6881a400Schristos	if test -f "$dir/$objdir/$dlname"; then
2392*6881a400Schristos	  dir="$dir/$objdir"
2393*6881a400Schristos	else
2394*6881a400Schristos	  if test ! -f "$dir/$dlname"; then
2395*6881a400Schristos	    func_fatal_error "cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'"
2396*6881a400Schristos	  fi
2397*6881a400Schristos	fi
2398*6881a400Schristos	;;
2399*6881a400Schristos
2400*6881a400Schristos      *.lo)
2401*6881a400Schristos	# Just add the directory containing the .lo file.
2402*6881a400Schristos	func_dirname "$file" "" "."
2403*6881a400Schristos	dir="$func_dirname_result"
2404*6881a400Schristos	;;
2405*6881a400Schristos
2406*6881a400Schristos      *)
2407*6881a400Schristos	func_warning "\`-dlopen' is ignored for non-libtool libraries and objects"
2408*6881a400Schristos	continue
2409*6881a400Schristos	;;
2410*6881a400Schristos      esac
2411*6881a400Schristos
2412*6881a400Schristos      # Get the absolute pathname.
2413*6881a400Schristos      absdir=`cd "$dir" && pwd`
2414*6881a400Schristos      test -n "$absdir" && dir="$absdir"
2415*6881a400Schristos
2416*6881a400Schristos      # Now add the directory to shlibpath_var.
2417*6881a400Schristos      if eval test -z \"\$$shlibpath_var\"; then
2418*6881a400Schristos	eval $shlibpath_var=\$dir
2419*6881a400Schristos      else
2420*6881a400Schristos	eval $shlibpath_var=\$dir:\$$shlibpath_var
2421*6881a400Schristos      fi
2422*6881a400Schristos    done
2423*6881a400Schristos
2424*6881a400Schristos    # This variable tells wrapper scripts just to set shlibpath_var
2425*6881a400Schristos    # rather than running their programs.
2426*6881a400Schristos    libtool_execute_magic="$magic"
2427*6881a400Schristos
2428*6881a400Schristos    # Check if any of the arguments is a wrapper script.
2429*6881a400Schristos    args=
2430*6881a400Schristos    for file
2431*6881a400Schristos    do
2432*6881a400Schristos      case $file in
2433*6881a400Schristos      -* | *.la | *.lo ) ;;
2434*6881a400Schristos      *)
2435*6881a400Schristos	# Do a test to see if this is really a libtool program.
2436*6881a400Schristos	if func_ltwrapper_script_p "$file"; then
2437*6881a400Schristos	  func_source "$file"
2438*6881a400Schristos	  # Transform arg to wrapped name.
2439*6881a400Schristos	  file="$progdir/$program"
2440*6881a400Schristos	elif func_ltwrapper_executable_p "$file"; then
2441*6881a400Schristos	  func_ltwrapper_scriptname "$file"
2442*6881a400Schristos	  func_source "$func_ltwrapper_scriptname_result"
2443*6881a400Schristos	  # Transform arg to wrapped name.
2444*6881a400Schristos	  file="$progdir/$program"
2445*6881a400Schristos	fi
2446*6881a400Schristos	;;
2447*6881a400Schristos      esac
2448*6881a400Schristos      # Quote arguments (to preserve shell metacharacters).
2449*6881a400Schristos      func_quote_for_eval "$file"
2450*6881a400Schristos      args="$args $func_quote_for_eval_result"
2451*6881a400Schristos    done
2452*6881a400Schristos
2453*6881a400Schristos    if test "X$opt_dry_run" = Xfalse; then
2454*6881a400Schristos      if test -n "$shlibpath_var"; then
2455*6881a400Schristos	# Export the shlibpath_var.
2456*6881a400Schristos	eval "export $shlibpath_var"
2457*6881a400Schristos      fi
2458*6881a400Schristos
2459*6881a400Schristos      # Restore saved environment variables
2460*6881a400Schristos      for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
2461*6881a400Schristos      do
2462*6881a400Schristos	eval "if test \"\${save_$lt_var+set}\" = set; then
2463*6881a400Schristos                $lt_var=\$save_$lt_var; export $lt_var
2464*6881a400Schristos	      else
2465*6881a400Schristos		$lt_unset $lt_var
2466*6881a400Schristos	      fi"
2467*6881a400Schristos      done
2468*6881a400Schristos
2469*6881a400Schristos      # Now prepare to actually exec the command.
2470*6881a400Schristos      exec_cmd="\$cmd$args"
2471*6881a400Schristos    else
2472*6881a400Schristos      # Display what would be done.
2473*6881a400Schristos      if test -n "$shlibpath_var"; then
2474*6881a400Schristos	eval "\$ECHO \"\$shlibpath_var=\$$shlibpath_var\""
2475*6881a400Schristos	echo "export $shlibpath_var"
2476*6881a400Schristos      fi
2477*6881a400Schristos      $ECHO "$cmd$args"
2478*6881a400Schristos      exit $EXIT_SUCCESS
2479*6881a400Schristos    fi
2480*6881a400Schristos}
2481*6881a400Schristos
2482*6881a400Schristostest "$mode" = execute && func_mode_execute ${1+"$@"}
2483*6881a400Schristos
2484*6881a400Schristos
2485*6881a400Schristos# func_mode_finish arg...
2486*6881a400Schristosfunc_mode_finish ()
2487*6881a400Schristos{
2488*6881a400Schristos    $opt_debug
2489*6881a400Schristos    libdirs="$nonopt"
2490*6881a400Schristos    admincmds=
2491*6881a400Schristos
2492*6881a400Schristos    if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
2493*6881a400Schristos      for dir
2494*6881a400Schristos      do
2495*6881a400Schristos	libdirs="$libdirs $dir"
2496*6881a400Schristos      done
2497*6881a400Schristos
2498*6881a400Schristos      for libdir in $libdirs; do
2499*6881a400Schristos	if test -n "$finish_cmds"; then
2500*6881a400Schristos	  # Do each command in the finish commands.
2501*6881a400Schristos	  func_execute_cmds "$finish_cmds" 'admincmds="$admincmds
2502*6881a400Schristos'"$cmd"'"'
2503*6881a400Schristos	fi
2504*6881a400Schristos	if test -n "$finish_eval"; then
2505*6881a400Schristos	  # Do the single finish_eval.
2506*6881a400Schristos	  eval cmds=\"$finish_eval\"
2507*6881a400Schristos	  $opt_dry_run || eval "$cmds" || admincmds="$admincmds
2508*6881a400Schristos       $cmds"
2509*6881a400Schristos	fi
2510*6881a400Schristos      done
2511*6881a400Schristos    fi
2512*6881a400Schristos
2513*6881a400Schristos    # Exit here if they wanted silent mode.
2514*6881a400Schristos    $opt_silent && exit $EXIT_SUCCESS
2515*6881a400Schristos
2516*6881a400Schristos    echo "----------------------------------------------------------------------"
2517*6881a400Schristos    echo "Libraries have been installed in:"
2518*6881a400Schristos    for libdir in $libdirs; do
2519*6881a400Schristos      $ECHO "   $libdir"
2520*6881a400Schristos    done
2521*6881a400Schristos    echo
2522*6881a400Schristos    echo "If you ever happen to want to link against installed libraries"
2523*6881a400Schristos    echo "in a given directory, LIBDIR, you must either use libtool, and"
2524*6881a400Schristos    echo "specify the full pathname of the library, or use the \`-LLIBDIR'"
2525*6881a400Schristos    echo "flag during linking and do at least one of the following:"
2526*6881a400Schristos    if test -n "$shlibpath_var"; then
2527*6881a400Schristos      echo "   - add LIBDIR to the \`$shlibpath_var' environment variable"
2528*6881a400Schristos      echo "     during execution"
2529*6881a400Schristos    fi
2530*6881a400Schristos    if test -n "$runpath_var"; then
2531*6881a400Schristos      echo "   - add LIBDIR to the \`$runpath_var' environment variable"
2532*6881a400Schristos      echo "     during linking"
2533*6881a400Schristos    fi
2534*6881a400Schristos    if test -n "$hardcode_libdir_flag_spec"; then
2535*6881a400Schristos      libdir=LIBDIR
2536*6881a400Schristos      eval "flag=\"$hardcode_libdir_flag_spec\""
2537*6881a400Schristos
2538*6881a400Schristos      $ECHO "   - use the \`$flag' linker flag"
2539*6881a400Schristos    fi
2540*6881a400Schristos    if test -n "$admincmds"; then
2541*6881a400Schristos      $ECHO "   - have your system administrator run these commands:$admincmds"
2542*6881a400Schristos    fi
2543*6881a400Schristos    if test -f /etc/ld.so.conf; then
2544*6881a400Schristos      echo "   - have your system administrator add LIBDIR to \`/etc/ld.so.conf'"
2545*6881a400Schristos    fi
2546*6881a400Schristos    echo
2547*6881a400Schristos
2548*6881a400Schristos    echo "See any operating system documentation about shared libraries for"
2549*6881a400Schristos    case $host in
2550*6881a400Schristos      solaris2.[6789]|solaris2.1[0-9])
2551*6881a400Schristos        echo "more information, such as the ld(1), crle(1) and ld.so(8) manual"
2552*6881a400Schristos	echo "pages."
2553*6881a400Schristos	;;
2554*6881a400Schristos      *)
2555*6881a400Schristos        echo "more information, such as the ld(1) and ld.so(8) manual pages."
2556*6881a400Schristos        ;;
2557*6881a400Schristos    esac
2558*6881a400Schristos    echo "----------------------------------------------------------------------"
2559*6881a400Schristos    exit $EXIT_SUCCESS
2560*6881a400Schristos}
2561*6881a400Schristos
2562*6881a400Schristostest "$mode" = finish && func_mode_finish ${1+"$@"}
2563*6881a400Schristos
2564*6881a400Schristos
2565*6881a400Schristos# func_mode_install arg...
2566*6881a400Schristosfunc_mode_install ()
2567*6881a400Schristos{
2568*6881a400Schristos    $opt_debug
2569*6881a400Schristos    # There may be an optional sh(1) argument at the beginning of
2570*6881a400Schristos    # install_prog (especially on Windows NT).
2571*6881a400Schristos    if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh ||
2572*6881a400Schristos       # Allow the use of GNU shtool's install command.
2573*6881a400Schristos       case $nonopt in *shtool*) :;; *) false;; esac; then
2574*6881a400Schristos      # Aesthetically quote it.
2575*6881a400Schristos      func_quote_for_eval "$nonopt"
2576*6881a400Schristos      install_prog="$func_quote_for_eval_result "
2577*6881a400Schristos      arg=$1
2578*6881a400Schristos      shift
2579*6881a400Schristos    else
2580*6881a400Schristos      install_prog=
2581*6881a400Schristos      arg=$nonopt
2582*6881a400Schristos    fi
2583*6881a400Schristos
2584*6881a400Schristos    # The real first argument should be the name of the installation program.
2585*6881a400Schristos    # Aesthetically quote it.
2586*6881a400Schristos    func_quote_for_eval "$arg"
2587*6881a400Schristos    install_prog="$install_prog$func_quote_for_eval_result"
2588*6881a400Schristos    install_shared_prog=$install_prog
2589*6881a400Schristos    case " $install_prog " in
2590*6881a400Schristos      *[\\\ /]cp\ *) install_cp=: ;;
2591*6881a400Schristos      *) install_cp=false ;;
2592*6881a400Schristos    esac
2593*6881a400Schristos
2594*6881a400Schristos    # We need to accept at least all the BSD install flags.
2595*6881a400Schristos    dest=
2596*6881a400Schristos    files=
2597*6881a400Schristos    opts=
2598*6881a400Schristos    prev=
2599*6881a400Schristos    install_type=
2600*6881a400Schristos    isdir=no
2601*6881a400Schristos    stripme=
2602*6881a400Schristos    no_mode=:
2603*6881a400Schristos    for arg
2604*6881a400Schristos    do
2605*6881a400Schristos      arg2=
2606*6881a400Schristos      if test -n "$dest"; then
2607*6881a400Schristos	files="$files $dest"
2608*6881a400Schristos	dest=$arg
2609*6881a400Schristos	continue
2610*6881a400Schristos      fi
2611*6881a400Schristos
2612*6881a400Schristos      case $arg in
2613*6881a400Schristos      -d) isdir=yes ;;
2614*6881a400Schristos      -f)
2615*6881a400Schristos	if $install_cp; then :; else
2616*6881a400Schristos	  prev=$arg
2617*6881a400Schristos	fi
2618*6881a400Schristos	;;
2619*6881a400Schristos      -g | -m | -o)
2620*6881a400Schristos	prev=$arg
2621*6881a400Schristos	;;
2622*6881a400Schristos      -s)
2623*6881a400Schristos	stripme=" -s"
2624*6881a400Schristos	continue
2625*6881a400Schristos	;;
2626*6881a400Schristos      -*)
2627*6881a400Schristos	;;
2628*6881a400Schristos      *)
2629*6881a400Schristos	# If the previous option needed an argument, then skip it.
2630*6881a400Schristos	if test -n "$prev"; then
2631*6881a400Schristos	  if test "x$prev" = x-m && test -n "$install_override_mode"; then
2632*6881a400Schristos	    arg2=$install_override_mode
2633*6881a400Schristos	    no_mode=false
2634*6881a400Schristos	  fi
2635*6881a400Schristos	  prev=
2636*6881a400Schristos	else
2637*6881a400Schristos	  dest=$arg
2638*6881a400Schristos	  continue
2639*6881a400Schristos	fi
2640*6881a400Schristos	;;
2641*6881a400Schristos      esac
2642*6881a400Schristos
2643*6881a400Schristos      # Aesthetically quote the argument.
2644*6881a400Schristos      func_quote_for_eval "$arg"
2645*6881a400Schristos      install_prog="$install_prog $func_quote_for_eval_result"
2646*6881a400Schristos      if test -n "$arg2"; then
2647*6881a400Schristos	func_quote_for_eval "$arg2"
2648*6881a400Schristos      fi
2649*6881a400Schristos      install_shared_prog="$install_shared_prog $func_quote_for_eval_result"
2650*6881a400Schristos    done
2651*6881a400Schristos
2652*6881a400Schristos    test -z "$install_prog" && \
2653*6881a400Schristos      func_fatal_help "you must specify an install program"
2654*6881a400Schristos
2655*6881a400Schristos    test -n "$prev" && \
2656*6881a400Schristos      func_fatal_help "the \`$prev' option requires an argument"
2657*6881a400Schristos
2658*6881a400Schristos    if test -n "$install_override_mode" && $no_mode; then
2659*6881a400Schristos      if $install_cp; then :; else
2660*6881a400Schristos	func_quote_for_eval "$install_override_mode"
2661*6881a400Schristos	install_shared_prog="$install_shared_prog -m $func_quote_for_eval_result"
2662*6881a400Schristos      fi
2663*6881a400Schristos    fi
2664*6881a400Schristos
2665*6881a400Schristos    if test -z "$files"; then
2666*6881a400Schristos      if test -z "$dest"; then
2667*6881a400Schristos	func_fatal_help "no file or destination specified"
2668*6881a400Schristos      else
2669*6881a400Schristos	func_fatal_help "you must specify a destination"
2670*6881a400Schristos      fi
2671*6881a400Schristos    fi
2672*6881a400Schristos
2673*6881a400Schristos    # Strip any trailing slash from the destination.
2674*6881a400Schristos    func_stripname '' '/' "$dest"
2675*6881a400Schristos    dest=$func_stripname_result
2676*6881a400Schristos
2677*6881a400Schristos    # Check to see that the destination is a directory.
2678*6881a400Schristos    test -d "$dest" && isdir=yes
2679*6881a400Schristos    if test "$isdir" = yes; then
2680*6881a400Schristos      destdir="$dest"
2681*6881a400Schristos      destname=
2682*6881a400Schristos    else
2683*6881a400Schristos      func_dirname_and_basename "$dest" "" "."
2684*6881a400Schristos      destdir="$func_dirname_result"
2685*6881a400Schristos      destname="$func_basename_result"
2686*6881a400Schristos
2687*6881a400Schristos      # Not a directory, so check to see that there is only one file specified.
2688*6881a400Schristos      set dummy $files; shift
2689*6881a400Schristos      test "$#" -gt 1 && \
2690*6881a400Schristos	func_fatal_help "\`$dest' is not a directory"
2691*6881a400Schristos    fi
2692*6881a400Schristos    case $destdir in
2693*6881a400Schristos    [\\/]* | [A-Za-z]:[\\/]*) ;;
2694*6881a400Schristos    *)
2695*6881a400Schristos      for file in $files; do
2696*6881a400Schristos	case $file in
2697*6881a400Schristos	*.lo) ;;
2698*6881a400Schristos	*)
2699*6881a400Schristos	  func_fatal_help "\`$destdir' must be an absolute directory name"
2700*6881a400Schristos	  ;;
2701*6881a400Schristos	esac
2702*6881a400Schristos      done
2703*6881a400Schristos      ;;
2704*6881a400Schristos    esac
2705*6881a400Schristos
2706*6881a400Schristos    # This variable tells wrapper scripts just to set variables rather
2707*6881a400Schristos    # than running their programs.
2708*6881a400Schristos    libtool_install_magic="$magic"
2709*6881a400Schristos
2710*6881a400Schristos    staticlibs=
2711*6881a400Schristos    future_libdirs=
2712*6881a400Schristos    current_libdirs=
2713*6881a400Schristos    for file in $files; do
2714*6881a400Schristos
2715*6881a400Schristos      # Do each installation.
2716*6881a400Schristos      case $file in
2717*6881a400Schristos      *.$libext)
2718*6881a400Schristos	# Do the static libraries later.
2719*6881a400Schristos	staticlibs="$staticlibs $file"
2720*6881a400Schristos	;;
2721*6881a400Schristos
2722*6881a400Schristos      *.la)
2723*6881a400Schristos	# Check to see that this really is a libtool archive.
2724*6881a400Schristos	func_lalib_unsafe_p "$file" \
2725*6881a400Schristos	  || func_fatal_help "\`$file' is not a valid libtool archive"
2726*6881a400Schristos
2727*6881a400Schristos	library_names=
2728*6881a400Schristos	old_library=
2729*6881a400Schristos	relink_command=
2730*6881a400Schristos	func_source "$file"
2731*6881a400Schristos
2732*6881a400Schristos	# Add the libdir to current_libdirs if it is the destination.
2733*6881a400Schristos	if test "X$destdir" = "X$libdir"; then
2734*6881a400Schristos	  case "$current_libdirs " in
2735*6881a400Schristos	  *" $libdir "*) ;;
2736*6881a400Schristos	  *) current_libdirs="$current_libdirs $libdir" ;;
2737*6881a400Schristos	  esac
2738*6881a400Schristos	else
2739*6881a400Schristos	  # Note the libdir as a future libdir.
2740*6881a400Schristos	  case "$future_libdirs " in
2741*6881a400Schristos	  *" $libdir "*) ;;
2742*6881a400Schristos	  *) future_libdirs="$future_libdirs $libdir" ;;
2743*6881a400Schristos	  esac
2744*6881a400Schristos	fi
2745*6881a400Schristos
2746*6881a400Schristos	func_dirname "$file" "/" ""
2747*6881a400Schristos	dir="$func_dirname_result"
2748*6881a400Schristos	dir="$dir$objdir"
2749*6881a400Schristos
2750*6881a400Schristos	if test -n "$relink_command"; then
2751*6881a400Schristos	  # Determine the prefix the user has applied to our future dir.
2752*6881a400Schristos	  inst_prefix_dir=`$ECHO "$destdir" | $SED -e "s%$libdir\$%%"`
2753*6881a400Schristos
2754*6881a400Schristos	  # Don't allow the user to place us outside of our expected
2755*6881a400Schristos	  # location b/c this prevents finding dependent libraries that
2756*6881a400Schristos	  # are installed to the same prefix.
2757*6881a400Schristos	  # At present, this check doesn't affect windows .dll's that
2758*6881a400Schristos	  # are installed into $libdir/../bin (currently, that works fine)
2759*6881a400Schristos	  # but it's something to keep an eye on.
2760*6881a400Schristos	  test "$inst_prefix_dir" = "$destdir" && \
2761*6881a400Schristos	    func_fatal_error "error: cannot install \`$file' to a directory not ending in $libdir"
2762*6881a400Schristos
2763*6881a400Schristos	  if test -n "$inst_prefix_dir"; then
2764*6881a400Schristos	    # Stick the inst_prefix_dir data into the link command.
2765*6881a400Schristos	    relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"`
2766*6881a400Schristos	  else
2767*6881a400Schristos	    relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%%"`
2768*6881a400Schristos	  fi
2769*6881a400Schristos
2770*6881a400Schristos	  func_warning "relinking \`$file'"
2771*6881a400Schristos	  func_show_eval "$relink_command" \
2772*6881a400Schristos	    'func_fatal_error "error: relink \`$file'\'' with the above command before installing it"'
2773*6881a400Schristos	fi
2774*6881a400Schristos
2775*6881a400Schristos	# See the names of the shared library.
2776*6881a400Schristos	set dummy $library_names; shift
2777*6881a400Schristos	if test -n "$1"; then
2778*6881a400Schristos	  realname="$1"
2779*6881a400Schristos	  shift
2780*6881a400Schristos
2781*6881a400Schristos	  srcname="$realname"
2782*6881a400Schristos	  test -n "$relink_command" && srcname="$realname"T
2783*6881a400Schristos
2784*6881a400Schristos	  # Install the shared library and build the symlinks.
2785*6881a400Schristos	  func_show_eval "$install_shared_prog $dir/$srcname $destdir/$realname" \
2786*6881a400Schristos	      'exit $?'
2787*6881a400Schristos	  tstripme="$stripme"
2788*6881a400Schristos	  case $host_os in
2789*6881a400Schristos	  cygwin* | mingw* | pw32* | cegcc*)
2790*6881a400Schristos	    case $realname in
2791*6881a400Schristos	    *.dll.a)
2792*6881a400Schristos	      tstripme=""
2793*6881a400Schristos	      ;;
2794*6881a400Schristos	    esac
2795*6881a400Schristos	    ;;
2796*6881a400Schristos	  esac
2797*6881a400Schristos	  if test -n "$tstripme" && test -n "$striplib"; then
2798*6881a400Schristos	    func_show_eval "$striplib $destdir/$realname" 'exit $?'
2799*6881a400Schristos	  fi
2800*6881a400Schristos
2801*6881a400Schristos	  if test "$#" -gt 0; then
2802*6881a400Schristos	    # Delete the old symlinks, and create new ones.
2803*6881a400Schristos	    # Try `ln -sf' first, because the `ln' binary might depend on
2804*6881a400Schristos	    # the symlink we replace!  Solaris /bin/ln does not understand -f,
2805*6881a400Schristos	    # so we also need to try rm && ln -s.
2806*6881a400Schristos	    for linkname
2807*6881a400Schristos	    do
2808*6881a400Schristos	      test "$linkname" != "$realname" \
2809*6881a400Schristos		&& func_show_eval "(cd $destdir && { $LN_S -f $realname $linkname || { $RM $linkname && $LN_S $realname $linkname; }; })"
2810*6881a400Schristos	    done
2811*6881a400Schristos	  fi
2812*6881a400Schristos
2813*6881a400Schristos	  # Do each command in the postinstall commands.
2814*6881a400Schristos	  lib="$destdir/$realname"
2815*6881a400Schristos	  func_execute_cmds "$postinstall_cmds" 'exit $?'
2816*6881a400Schristos	fi
2817*6881a400Schristos
2818*6881a400Schristos	# Install the pseudo-library for information purposes.
2819*6881a400Schristos	func_basename "$file"
2820*6881a400Schristos	name="$func_basename_result"
2821*6881a400Schristos	instname="$dir/$name"i
2822*6881a400Schristos	func_show_eval "$install_prog $instname $destdir/$name" 'exit $?'
2823*6881a400Schristos
2824*6881a400Schristos	# Maybe install the static library, too.
2825*6881a400Schristos	test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library"
2826*6881a400Schristos	;;
2827*6881a400Schristos
2828*6881a400Schristos      *.lo)
2829*6881a400Schristos	# Install (i.e. copy) a libtool object.
2830*6881a400Schristos
2831*6881a400Schristos	# Figure out destination file name, if it wasn't already specified.
2832*6881a400Schristos	if test -n "$destname"; then
2833*6881a400Schristos	  destfile="$destdir/$destname"
2834*6881a400Schristos	else
2835*6881a400Schristos	  func_basename "$file"
2836*6881a400Schristos	  destfile="$func_basename_result"
2837*6881a400Schristos	  destfile="$destdir/$destfile"
2838*6881a400Schristos	fi
2839*6881a400Schristos
2840*6881a400Schristos	# Deduce the name of the destination old-style object file.
2841*6881a400Schristos	case $destfile in
2842*6881a400Schristos	*.lo)
2843*6881a400Schristos	  func_lo2o "$destfile"
2844*6881a400Schristos	  staticdest=$func_lo2o_result
2845*6881a400Schristos	  ;;
2846*6881a400Schristos	*.$objext)
2847*6881a400Schristos	  staticdest="$destfile"
2848*6881a400Schristos	  destfile=
2849*6881a400Schristos	  ;;
2850*6881a400Schristos	*)
2851*6881a400Schristos	  func_fatal_help "cannot copy a libtool object to \`$destfile'"
2852*6881a400Schristos	  ;;
2853*6881a400Schristos	esac
2854*6881a400Schristos
2855*6881a400Schristos	# Install the libtool object if requested.
2856*6881a400Schristos	test -n "$destfile" && \
2857*6881a400Schristos	  func_show_eval "$install_prog $file $destfile" 'exit $?'
2858*6881a400Schristos
2859*6881a400Schristos	# Install the old object if enabled.
2860*6881a400Schristos	if test "$build_old_libs" = yes; then
2861*6881a400Schristos	  # Deduce the name of the old-style object file.
2862*6881a400Schristos	  func_lo2o "$file"
2863*6881a400Schristos	  staticobj=$func_lo2o_result
2864*6881a400Schristos	  func_show_eval "$install_prog \$staticobj \$staticdest" 'exit $?'
2865*6881a400Schristos	fi
2866*6881a400Schristos	exit $EXIT_SUCCESS
2867*6881a400Schristos	;;
2868*6881a400Schristos
2869*6881a400Schristos      *)
2870*6881a400Schristos	# Figure out destination file name, if it wasn't already specified.
2871*6881a400Schristos	if test -n "$destname"; then
2872*6881a400Schristos	  destfile="$destdir/$destname"
2873*6881a400Schristos	else
2874*6881a400Schristos	  func_basename "$file"
2875*6881a400Schristos	  destfile="$func_basename_result"
2876*6881a400Schristos	  destfile="$destdir/$destfile"
2877*6881a400Schristos	fi
2878*6881a400Schristos
2879*6881a400Schristos	# If the file is missing, and there is a .exe on the end, strip it
2880*6881a400Schristos	# because it is most likely a libtool script we actually want to
2881*6881a400Schristos	# install
2882*6881a400Schristos	stripped_ext=""
2883*6881a400Schristos	case $file in
2884*6881a400Schristos	  *.exe)
2885*6881a400Schristos	    if test ! -f "$file"; then
2886*6881a400Schristos	      func_stripname '' '.exe' "$file"
2887*6881a400Schristos	      file=$func_stripname_result
2888*6881a400Schristos	      stripped_ext=".exe"
2889*6881a400Schristos	    fi
2890*6881a400Schristos	    ;;
2891*6881a400Schristos	esac
2892*6881a400Schristos
2893*6881a400Schristos	# Do a test to see if this is really a libtool program.
2894*6881a400Schristos	case $host in
2895*6881a400Schristos	*cygwin* | *mingw*)
2896*6881a400Schristos	    if func_ltwrapper_executable_p "$file"; then
2897*6881a400Schristos	      func_ltwrapper_scriptname "$file"
2898*6881a400Schristos	      wrapper=$func_ltwrapper_scriptname_result
2899*6881a400Schristos	    else
2900*6881a400Schristos	      func_stripname '' '.exe' "$file"
2901*6881a400Schristos	      wrapper=$func_stripname_result
2902*6881a400Schristos	    fi
2903*6881a400Schristos	    ;;
2904*6881a400Schristos	*)
2905*6881a400Schristos	    wrapper=$file
2906*6881a400Schristos	    ;;
2907*6881a400Schristos	esac
2908*6881a400Schristos	if func_ltwrapper_script_p "$wrapper"; then
2909*6881a400Schristos	  notinst_deplibs=
2910*6881a400Schristos	  relink_command=
2911*6881a400Schristos
2912*6881a400Schristos	  func_source "$wrapper"
2913*6881a400Schristos
2914*6881a400Schristos	  # Check the variables that should have been set.
2915*6881a400Schristos	  test -z "$generated_by_libtool_version" && \
2916*6881a400Schristos	    func_fatal_error "invalid libtool wrapper script \`$wrapper'"
2917*6881a400Schristos
2918*6881a400Schristos	  finalize=yes
2919*6881a400Schristos	  for lib in $notinst_deplibs; do
2920*6881a400Schristos	    # Check to see that each library is installed.
2921*6881a400Schristos	    libdir=
2922*6881a400Schristos	    if test -f "$lib"; then
2923*6881a400Schristos	      func_source "$lib"
2924*6881a400Schristos	    fi
2925*6881a400Schristos	    libfile="$libdir/"`$ECHO "$lib" | $SED 's%^.*/%%g'` ### testsuite: skip nested quoting test
2926*6881a400Schristos	    if test -n "$libdir" && test ! -f "$libfile"; then
2927*6881a400Schristos	      func_warning "\`$lib' has not been installed in \`$libdir'"
2928*6881a400Schristos	      finalize=no
2929*6881a400Schristos	    fi
2930*6881a400Schristos	  done
2931*6881a400Schristos
2932*6881a400Schristos	  relink_command=
2933*6881a400Schristos	  func_source "$wrapper"
2934*6881a400Schristos
2935*6881a400Schristos	  outputname=
2936*6881a400Schristos	  if test "$fast_install" = no && test -n "$relink_command"; then
2937*6881a400Schristos	    $opt_dry_run || {
2938*6881a400Schristos	      if test "$finalize" = yes; then
2939*6881a400Schristos	        tmpdir=`func_mktempdir`
2940*6881a400Schristos		func_basename "$file$stripped_ext"
2941*6881a400Schristos		file="$func_basename_result"
2942*6881a400Schristos	        outputname="$tmpdir/$file"
2943*6881a400Schristos	        # Replace the output file specification.
2944*6881a400Schristos	        relink_command=`$ECHO "$relink_command" | $SED 's%@OUTPUT@%'"$outputname"'%g'`
2945*6881a400Schristos
2946*6881a400Schristos	        $opt_silent || {
2947*6881a400Schristos	          func_quote_for_expand "$relink_command"
2948*6881a400Schristos		  eval "func_echo $func_quote_for_expand_result"
2949*6881a400Schristos	        }
2950*6881a400Schristos	        if eval "$relink_command"; then :
2951*6881a400Schristos	          else
2952*6881a400Schristos		  func_error "error: relink \`$file' with the above command before installing it"
2953*6881a400Schristos		  $opt_dry_run || ${RM}r "$tmpdir"
2954*6881a400Schristos		  continue
2955*6881a400Schristos	        fi
2956*6881a400Schristos	        file="$outputname"
2957*6881a400Schristos	      else
2958*6881a400Schristos	        func_warning "cannot relink \`$file'"
2959*6881a400Schristos	      fi
2960*6881a400Schristos	    }
2961*6881a400Schristos	  else
2962*6881a400Schristos	    # Install the binary that we compiled earlier.
2963*6881a400Schristos	    file=`$ECHO "$file$stripped_ext" | $SED "s%\([^/]*\)$%$objdir/\1%"`
2964*6881a400Schristos	  fi
2965*6881a400Schristos	fi
2966*6881a400Schristos
2967*6881a400Schristos	# remove .exe since cygwin /usr/bin/install will append another
2968*6881a400Schristos	# one anyway
2969*6881a400Schristos	case $install_prog,$host in
2970*6881a400Schristos	*/usr/bin/install*,*cygwin*)
2971*6881a400Schristos	  case $file:$destfile in
2972*6881a400Schristos	  *.exe:*.exe)
2973*6881a400Schristos	    # this is ok
2974*6881a400Schristos	    ;;
2975*6881a400Schristos	  *.exe:*)
2976*6881a400Schristos	    destfile=$destfile.exe
2977*6881a400Schristos	    ;;
2978*6881a400Schristos	  *:*.exe)
2979*6881a400Schristos	    func_stripname '' '.exe' "$destfile"
2980*6881a400Schristos	    destfile=$func_stripname_result
2981*6881a400Schristos	    ;;
2982*6881a400Schristos	  esac
2983*6881a400Schristos	  ;;
2984*6881a400Schristos	esac
2985*6881a400Schristos	func_show_eval "$install_prog\$stripme \$file \$destfile" 'exit $?'
2986*6881a400Schristos	$opt_dry_run || if test -n "$outputname"; then
2987*6881a400Schristos	  ${RM}r "$tmpdir"
2988*6881a400Schristos	fi
2989*6881a400Schristos	;;
2990*6881a400Schristos      esac
2991*6881a400Schristos    done
2992*6881a400Schristos
2993*6881a400Schristos    for file in $staticlibs; do
2994*6881a400Schristos      func_basename "$file"
2995*6881a400Schristos      name="$func_basename_result"
2996*6881a400Schristos
2997*6881a400Schristos      # Set up the ranlib parameters.
2998*6881a400Schristos      oldlib="$destdir/$name"
2999*6881a400Schristos
3000*6881a400Schristos      func_show_eval "$install_prog \$file \$oldlib" 'exit $?'
3001*6881a400Schristos
3002*6881a400Schristos      if test -n "$stripme" && test -n "$old_striplib"; then
3003*6881a400Schristos	func_show_eval "$old_striplib $oldlib" 'exit $?'
3004*6881a400Schristos      fi
3005*6881a400Schristos
3006*6881a400Schristos      # Do each command in the postinstall commands.
3007*6881a400Schristos      func_execute_cmds "$old_postinstall_cmds" 'exit $?'
3008*6881a400Schristos    done
3009*6881a400Schristos
3010*6881a400Schristos    test -n "$future_libdirs" && \
3011*6881a400Schristos      func_warning "remember to run \`$progname --finish$future_libdirs'"
3012*6881a400Schristos
3013*6881a400Schristos    if test -n "$current_libdirs" && $opt_finish; then
3014*6881a400Schristos      # Maybe just do a dry run.
3015*6881a400Schristos      $opt_dry_run && current_libdirs=" -n$current_libdirs"
3016*6881a400Schristos      exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs'
3017*6881a400Schristos    else
3018*6881a400Schristos      exit $EXIT_SUCCESS
3019*6881a400Schristos    fi
3020*6881a400Schristos}
3021*6881a400Schristos
3022*6881a400Schristostest "$mode" = install && func_mode_install ${1+"$@"}
3023*6881a400Schristos
3024*6881a400Schristos
3025*6881a400Schristos# func_generate_dlsyms outputname originator pic_p
3026*6881a400Schristos# Extract symbols from dlprefiles and create ${outputname}S.o with
3027*6881a400Schristos# a dlpreopen symbol table.
3028*6881a400Schristosfunc_generate_dlsyms ()
3029*6881a400Schristos{
3030*6881a400Schristos    $opt_debug
3031*6881a400Schristos    my_outputname="$1"
3032*6881a400Schristos    my_originator="$2"
3033*6881a400Schristos    my_pic_p="${3-no}"
3034*6881a400Schristos    my_prefix=`$ECHO "$my_originator" | sed 's%[^a-zA-Z0-9]%_%g'`
3035*6881a400Schristos    my_dlsyms=
3036*6881a400Schristos
3037*6881a400Schristos    if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
3038*6881a400Schristos      if test -n "$NM" && test -n "$global_symbol_pipe"; then
3039*6881a400Schristos	my_dlsyms="${my_outputname}S.c"
3040*6881a400Schristos      else
3041*6881a400Schristos	func_error "not configured to extract global symbols from dlpreopened files"
3042*6881a400Schristos      fi
3043*6881a400Schristos    fi
3044*6881a400Schristos
3045*6881a400Schristos    if test -n "$my_dlsyms"; then
3046*6881a400Schristos      case $my_dlsyms in
3047*6881a400Schristos      "") ;;
3048*6881a400Schristos      *.c)
3049*6881a400Schristos	# Discover the nlist of each of the dlfiles.
3050*6881a400Schristos	nlist="$output_objdir/${my_outputname}.nm"
3051*6881a400Schristos
3052*6881a400Schristos	func_show_eval "$RM $nlist ${nlist}S ${nlist}T"
3053*6881a400Schristos
3054*6881a400Schristos	# Parse the name list into a source file.
3055*6881a400Schristos	func_verbose "creating $output_objdir/$my_dlsyms"
3056*6881a400Schristos
3057*6881a400Schristos	$opt_dry_run || $ECHO > "$output_objdir/$my_dlsyms" "\
3058*6881a400Schristos/* $my_dlsyms - symbol resolution table for \`$my_outputname' dlsym emulation. */
3059*6881a400Schristos/* Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION */
3060*6881a400Schristos
3061*6881a400Schristos#ifdef __cplusplus
3062*6881a400Schristosextern \"C\" {
3063*6881a400Schristos#endif
3064*6881a400Schristos
3065*6881a400Schristos#if defined(__GNUC__) && (((__GNUC__ == 4) && (__GNUC_MINOR__ >= 4)) || (__GNUC__ > 4))
3066*6881a400Schristos#pragma GCC diagnostic ignored \"-Wstrict-prototypes\"
3067*6881a400Schristos#endif
3068*6881a400Schristos
3069*6881a400Schristos/* External symbol declarations for the compiler. */\
3070*6881a400Schristos"
3071*6881a400Schristos
3072*6881a400Schristos	if test "$dlself" = yes; then
3073*6881a400Schristos	  func_verbose "generating symbol list for \`$output'"
3074*6881a400Schristos
3075*6881a400Schristos	  $opt_dry_run || echo ': @PROGRAM@ ' > "$nlist"
3076*6881a400Schristos
3077*6881a400Schristos	  # Add our own program objects to the symbol list.
3078*6881a400Schristos	  progfiles=`$ECHO "$objs$old_deplibs" | $SP2NL | $SED "$lo2o" | $NL2SP`
3079*6881a400Schristos	  for progfile in $progfiles; do
3080*6881a400Schristos	    func_verbose "extracting global C symbols from \`$progfile'"
3081*6881a400Schristos	    $opt_dry_run || eval "$NM $progfile | $global_symbol_pipe >> '$nlist'"
3082*6881a400Schristos	  done
3083*6881a400Schristos
3084*6881a400Schristos	  if test -n "$exclude_expsyms"; then
3085*6881a400Schristos	    $opt_dry_run || {
3086*6881a400Schristos	      $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T
3087*6881a400Schristos	      $MV "$nlist"T "$nlist"
3088*6881a400Schristos	    }
3089*6881a400Schristos	  fi
3090*6881a400Schristos
3091*6881a400Schristos	  if test -n "$export_symbols_regex"; then
3092*6881a400Schristos	    $opt_dry_run || {
3093*6881a400Schristos	      $EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T
3094*6881a400Schristos	      $MV "$nlist"T "$nlist"
3095*6881a400Schristos	    }
3096*6881a400Schristos	  fi
3097*6881a400Schristos
3098*6881a400Schristos	  # Prepare the list of exported symbols
3099*6881a400Schristos	  if test -z "$export_symbols"; then
3100*6881a400Schristos	    export_symbols="$output_objdir/$outputname.exp"
3101*6881a400Schristos	    $opt_dry_run || {
3102*6881a400Schristos	      $RM $export_symbols
3103*6881a400Schristos	      ${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' < "$nlist" > "$export_symbols"
3104*6881a400Schristos	      case $host in
3105*6881a400Schristos	      *cygwin* | *mingw* | *cegcc* )
3106*6881a400Schristos                echo EXPORTS > "$output_objdir/$outputname.def"
3107*6881a400Schristos                cat "$export_symbols" >> "$output_objdir/$outputname.def"
3108*6881a400Schristos	        ;;
3109*6881a400Schristos	      esac
3110*6881a400Schristos	    }
3111*6881a400Schristos	  else
3112*6881a400Schristos	    $opt_dry_run || {
3113*6881a400Schristos	      ${SED} -e 's/\([].[*^$]\)/\\\1/g' -e 's/^/ /' -e 's/$/$/' < "$export_symbols" > "$output_objdir/$outputname.exp"
3114*6881a400Schristos	      $GREP -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T
3115*6881a400Schristos	      $MV "$nlist"T "$nlist"
3116*6881a400Schristos	      case $host in
3117*6881a400Schristos	        *cygwin* | *mingw* | *cegcc* )
3118*6881a400Schristos	          echo EXPORTS > "$output_objdir/$outputname.def"
3119*6881a400Schristos	          cat "$nlist" >> "$output_objdir/$outputname.def"
3120*6881a400Schristos	          ;;
3121*6881a400Schristos	      esac
3122*6881a400Schristos	    }
3123*6881a400Schristos	  fi
3124*6881a400Schristos	fi
3125*6881a400Schristos
3126*6881a400Schristos	for dlprefile in $dlprefiles; do
3127*6881a400Schristos	  func_verbose "extracting global C symbols from \`$dlprefile'"
3128*6881a400Schristos	  func_basename "$dlprefile"
3129*6881a400Schristos	  name="$func_basename_result"
3130*6881a400Schristos	  $opt_dry_run || {
3131*6881a400Schristos	    $ECHO ": $name " >> "$nlist"
3132*6881a400Schristos	    eval "$NM $dlprefile 2>/dev/null | $global_symbol_pipe >> '$nlist'"
3133*6881a400Schristos	  }
3134*6881a400Schristos	done
3135*6881a400Schristos
3136*6881a400Schristos	$opt_dry_run || {
3137*6881a400Schristos	  # Make sure we have at least an empty file.
3138*6881a400Schristos	  test -f "$nlist" || : > "$nlist"
3139*6881a400Schristos
3140*6881a400Schristos	  if test -n "$exclude_expsyms"; then
3141*6881a400Schristos	    $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T
3142*6881a400Schristos	    $MV "$nlist"T "$nlist"
3143*6881a400Schristos	  fi
3144*6881a400Schristos
3145*6881a400Schristos	  # Try sorting and uniquifying the output.
3146*6881a400Schristos	  if $GREP -v "^: " < "$nlist" |
3147*6881a400Schristos	      if sort -k 3 </dev/null >/dev/null 2>&1; then
3148*6881a400Schristos		sort -k 3
3149*6881a400Schristos	      else
3150*6881a400Schristos		sort +2
3151*6881a400Schristos	      fi |
3152*6881a400Schristos	      uniq > "$nlist"S; then
3153*6881a400Schristos	    :
3154*6881a400Schristos	  else
3155*6881a400Schristos	    $GREP -v "^: " < "$nlist" > "$nlist"S
3156*6881a400Schristos	  fi
3157*6881a400Schristos
3158*6881a400Schristos	  if test -f "$nlist"S; then
3159*6881a400Schristos	    eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$my_dlsyms"'
3160*6881a400Schristos	  else
3161*6881a400Schristos	    echo '/* NONE */' >> "$output_objdir/$my_dlsyms"
3162*6881a400Schristos	  fi
3163*6881a400Schristos
3164*6881a400Schristos	  echo >> "$output_objdir/$my_dlsyms" "\
3165*6881a400Schristos
3166*6881a400Schristos/* The mapping between symbol names and symbols.  */
3167*6881a400Schristostypedef struct {
3168*6881a400Schristos  const char *name;
3169*6881a400Schristos  void *address;
3170*6881a400Schristos} lt_dlsymlist;
3171*6881a400Schristos"
3172*6881a400Schristos	  case $host in
3173*6881a400Schristos	  *cygwin* | *mingw* | *cegcc* )
3174*6881a400Schristos	    echo >> "$output_objdir/$my_dlsyms" "\
3175*6881a400Schristos/* DATA imports from DLLs on WIN32 con't be const, because
3176*6881a400Schristos   runtime relocations are performed -- see ld's documentation
3177*6881a400Schristos   on pseudo-relocs.  */"
3178*6881a400Schristos	    lt_dlsym_const= ;;
3179*6881a400Schristos	  *osf5*)
3180*6881a400Schristos	    echo >> "$output_objdir/$my_dlsyms" "\
3181*6881a400Schristos/* This system does not cope well with relocations in const data */"
3182*6881a400Schristos	    lt_dlsym_const= ;;
3183*6881a400Schristos	  *)
3184*6881a400Schristos	    lt_dlsym_const=const ;;
3185*6881a400Schristos	  esac
3186*6881a400Schristos
3187*6881a400Schristos	  echo >> "$output_objdir/$my_dlsyms" "\
3188*6881a400Schristosextern $lt_dlsym_const lt_dlsymlist
3189*6881a400Schristoslt_${my_prefix}_LTX_preloaded_symbols[];
3190*6881a400Schristos$lt_dlsym_const lt_dlsymlist
3191*6881a400Schristoslt_${my_prefix}_LTX_preloaded_symbols[] =
3192*6881a400Schristos{\
3193*6881a400Schristos  { \"$my_originator\", (void *) 0 },"
3194*6881a400Schristos
3195*6881a400Schristos	  case $need_lib_prefix in
3196*6881a400Schristos	  no)
3197*6881a400Schristos	    eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$my_dlsyms"
3198*6881a400Schristos	    ;;
3199*6881a400Schristos	  *)
3200*6881a400Schristos	    eval "$global_symbol_to_c_name_address_lib_prefix" < "$nlist" >> "$output_objdir/$my_dlsyms"
3201*6881a400Schristos	    ;;
3202*6881a400Schristos	  esac
3203*6881a400Schristos	  echo >> "$output_objdir/$my_dlsyms" "\
3204*6881a400Schristos  {0, (void *) 0}
3205*6881a400Schristos};
3206*6881a400Schristos
3207*6881a400Schristos/* This works around a problem in FreeBSD linker */
3208*6881a400Schristos#ifdef FREEBSD_WORKAROUND
3209*6881a400Schristosstatic const void *lt_preloaded_setup() {
3210*6881a400Schristos  return lt_${my_prefix}_LTX_preloaded_symbols;
3211*6881a400Schristos}
3212*6881a400Schristos#endif
3213*6881a400Schristos
3214*6881a400Schristos#ifdef __cplusplus
3215*6881a400Schristos}
3216*6881a400Schristos#endif\
3217*6881a400Schristos"
3218*6881a400Schristos	} # !$opt_dry_run
3219*6881a400Schristos
3220*6881a400Schristos	pic_flag_for_symtable=
3221*6881a400Schristos	case "$compile_command " in
3222*6881a400Schristos	*" -static "*) ;;
3223*6881a400Schristos	*)
3224*6881a400Schristos	  case $host in
3225*6881a400Schristos	  # compiling the symbol table file with pic_flag works around
3226*6881a400Schristos	  # a FreeBSD bug that causes programs to crash when -lm is
3227*6881a400Schristos	  # linked before any other PIC object.  But we must not use
3228*6881a400Schristos	  # pic_flag when linking with -static.  The problem exists in
3229*6881a400Schristos	  # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1.
3230*6881a400Schristos	  *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)
3231*6881a400Schristos	    pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND" ;;
3232*6881a400Schristos	  *-*-hpux*)
3233*6881a400Schristos	    pic_flag_for_symtable=" $pic_flag"  ;;
3234*6881a400Schristos	  *)
3235*6881a400Schristos	    if test "X$my_pic_p" != Xno; then
3236*6881a400Schristos	      pic_flag_for_symtable=" $pic_flag"
3237*6881a400Schristos	    fi
3238*6881a400Schristos	    ;;
3239*6881a400Schristos	  esac
3240*6881a400Schristos	  ;;
3241*6881a400Schristos	esac
3242*6881a400Schristos	symtab_cflags=
3243*6881a400Schristos	for arg in $LTCFLAGS; do
3244*6881a400Schristos	  case $arg in
3245*6881a400Schristos	  -pie | -fpie | -fPIE) ;;
3246*6881a400Schristos	  *) symtab_cflags="$symtab_cflags $arg" ;;
3247*6881a400Schristos	  esac
3248*6881a400Schristos	done
3249*6881a400Schristos
3250*6881a400Schristos	# Now compile the dynamic symbol file.
3251*6881a400Schristos	func_show_eval '(cd $output_objdir && $LTCC$symtab_cflags -c$no_builtin_flag$pic_flag_for_symtable "$my_dlsyms")' 'exit $?'
3252*6881a400Schristos
3253*6881a400Schristos	# Clean up the generated files.
3254*6881a400Schristos	func_show_eval '$RM "$output_objdir/$my_dlsyms" "$nlist" "${nlist}S" "${nlist}T"'
3255*6881a400Schristos
3256*6881a400Schristos	# Transform the symbol file into the correct name.
3257*6881a400Schristos	symfileobj="$output_objdir/${my_outputname}S.$objext"
3258*6881a400Schristos	case $host in
3259*6881a400Schristos	*cygwin* | *mingw* | *cegcc* )
3260*6881a400Schristos	  if test -f "$output_objdir/$my_outputname.def"; then
3261*6881a400Schristos	    compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"`
3262*6881a400Schristos	    finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"`
3263*6881a400Schristos	  else
3264*6881a400Schristos	    compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"`
3265*6881a400Schristos	    finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"`
3266*6881a400Schristos	  fi
3267*6881a400Schristos	  ;;
3268*6881a400Schristos	*)
3269*6881a400Schristos	  compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"`
3270*6881a400Schristos	  finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"`
3271*6881a400Schristos	  ;;
3272*6881a400Schristos	esac
3273*6881a400Schristos	;;
3274*6881a400Schristos      *)
3275*6881a400Schristos	func_fatal_error "unknown suffix for \`$my_dlsyms'"
3276*6881a400Schristos	;;
3277*6881a400Schristos      esac
3278*6881a400Schristos    else
3279*6881a400Schristos      # We keep going just in case the user didn't refer to
3280*6881a400Schristos      # lt_preloaded_symbols.  The linker will fail if global_symbol_pipe
3281*6881a400Schristos      # really was required.
3282*6881a400Schristos
3283*6881a400Schristos      # Nullify the symbol file.
3284*6881a400Schristos      compile_command=`$ECHO "$compile_command" | $SED "s% @SYMFILE@%%"`
3285*6881a400Schristos      finalize_command=`$ECHO "$finalize_command" | $SED "s% @SYMFILE@%%"`
3286*6881a400Schristos    fi
3287*6881a400Schristos}
3288*6881a400Schristos
3289*6881a400Schristos# func_win32_libid arg
3290*6881a400Schristos# return the library type of file 'arg'
3291*6881a400Schristos#
3292*6881a400Schristos# Need a lot of goo to handle *both* DLLs and import libs
3293*6881a400Schristos# Has to be a shell function in order to 'eat' the argument
3294*6881a400Schristos# that is supplied when $file_magic_command is called.
3295*6881a400Schristos# Despite the name, also deal with 64 bit binaries.
3296*6881a400Schristosfunc_win32_libid ()
3297*6881a400Schristos{
3298*6881a400Schristos  $opt_debug
3299*6881a400Schristos  win32_libid_type="unknown"
3300*6881a400Schristos  win32_fileres=`file -L $1 2>/dev/null`
3301*6881a400Schristos  case $win32_fileres in
3302*6881a400Schristos  *ar\ archive\ import\ library*) # definitely import
3303*6881a400Schristos    win32_libid_type="x86 archive import"
3304*6881a400Schristos    ;;
3305*6881a400Schristos  *ar\ archive*) # could be an import, or static
3306*6881a400Schristos    if $OBJDUMP -f "$1" | $SED -e '10q' 2>/dev/null |
3307*6881a400Schristos       $EGREP 'file format (pe-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' >/dev/null; then
3308*6881a400Schristos      win32_nmres=`$NM -f posix -A "$1" |
3309*6881a400Schristos	$SED -n -e '
3310*6881a400Schristos	    1,100{
3311*6881a400Schristos		/ I /{
3312*6881a400Schristos		    s,.*,import,
3313*6881a400Schristos		    p
3314*6881a400Schristos		    q
3315*6881a400Schristos		}
3316*6881a400Schristos	    }'`
3317*6881a400Schristos      case $win32_nmres in
3318*6881a400Schristos      import*)  win32_libid_type="x86 archive import";;
3319*6881a400Schristos      *)        win32_libid_type="x86 archive static";;
3320*6881a400Schristos      esac
3321*6881a400Schristos    fi
3322*6881a400Schristos    ;;
3323*6881a400Schristos  *DLL*)
3324*6881a400Schristos    win32_libid_type="x86 DLL"
3325*6881a400Schristos    ;;
3326*6881a400Schristos  *executable*) # but shell scripts are "executable" too...
3327*6881a400Schristos    case $win32_fileres in
3328*6881a400Schristos    *MS\ Windows\ PE\ Intel*)
3329*6881a400Schristos      win32_libid_type="x86 DLL"
3330*6881a400Schristos      ;;
3331*6881a400Schristos    esac
3332*6881a400Schristos    ;;
3333*6881a400Schristos  esac
3334*6881a400Schristos  $ECHO "$win32_libid_type"
3335*6881a400Schristos}
3336*6881a400Schristos
3337*6881a400Schristos
3338*6881a400Schristos
3339*6881a400Schristos# func_extract_an_archive dir oldlib
3340*6881a400Schristosfunc_extract_an_archive ()
3341*6881a400Schristos{
3342*6881a400Schristos    $opt_debug
3343*6881a400Schristos    f_ex_an_ar_dir="$1"; shift
3344*6881a400Schristos    f_ex_an_ar_oldlib="$1"
3345*6881a400Schristos    if test "$lock_old_archive_extraction" = yes; then
3346*6881a400Schristos      lockfile=$f_ex_an_ar_oldlib.lock
3347*6881a400Schristos      until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do
3348*6881a400Schristos	func_echo "Waiting for $lockfile to be removed"
3349*6881a400Schristos	sleep 2
3350*6881a400Schristos      done
3351*6881a400Schristos    fi
3352*6881a400Schristos    func_show_eval "(cd \$f_ex_an_ar_dir && $AR x \"\$f_ex_an_ar_oldlib\")" \
3353*6881a400Schristos		   'stat=$?; rm -f "$lockfile"; exit $stat'
3354*6881a400Schristos    if test "$lock_old_archive_extraction" = yes; then
3355*6881a400Schristos      $opt_dry_run || rm -f "$lockfile"
3356*6881a400Schristos    fi
3357*6881a400Schristos    if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then
3358*6881a400Schristos     :
3359*6881a400Schristos    else
3360*6881a400Schristos      func_fatal_error "object name conflicts in archive: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib"
3361*6881a400Schristos    fi
3362*6881a400Schristos}
3363*6881a400Schristos
3364*6881a400Schristos
3365*6881a400Schristos# func_extract_archives gentop oldlib ...
3366*6881a400Schristosfunc_extract_archives ()
3367*6881a400Schristos{
3368*6881a400Schristos    $opt_debug
3369*6881a400Schristos    my_gentop="$1"; shift
3370*6881a400Schristos    my_oldlibs=${1+"$@"}
3371*6881a400Schristos    my_oldobjs=""
3372*6881a400Schristos    my_xlib=""
3373*6881a400Schristos    my_xabs=""
3374*6881a400Schristos    my_xdir=""
3375*6881a400Schristos
3376*6881a400Schristos    for my_xlib in $my_oldlibs; do
3377*6881a400Schristos      # Extract the objects.
3378*6881a400Schristos      case $my_xlib in
3379*6881a400Schristos	[\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;;
3380*6881a400Schristos	*) my_xabs=`pwd`"/$my_xlib" ;;
3381*6881a400Schristos      esac
3382*6881a400Schristos      func_basename "$my_xlib"
3383*6881a400Schristos      my_xlib="$func_basename_result"
3384*6881a400Schristos      my_xlib_u=$my_xlib
3385*6881a400Schristos      while :; do
3386*6881a400Schristos        case " $extracted_archives " in
3387*6881a400Schristos	*" $my_xlib_u "*)
3388*6881a400Schristos	  func_arith $extracted_serial + 1
3389*6881a400Schristos	  extracted_serial=$func_arith_result
3390*6881a400Schristos	  my_xlib_u=lt$extracted_serial-$my_xlib ;;
3391*6881a400Schristos	*) break ;;
3392*6881a400Schristos	esac
3393*6881a400Schristos      done
3394*6881a400Schristos      extracted_archives="$extracted_archives $my_xlib_u"
3395*6881a400Schristos      my_xdir="$my_gentop/$my_xlib_u"
3396*6881a400Schristos
3397*6881a400Schristos      func_mkdir_p "$my_xdir"
3398*6881a400Schristos
3399*6881a400Schristos      case $host in
3400*6881a400Schristos      *-darwin*)
3401*6881a400Schristos	func_verbose "Extracting $my_xabs"
3402*6881a400Schristos	# Do not bother doing anything if just a dry run
3403*6881a400Schristos	$opt_dry_run || {
3404*6881a400Schristos	  darwin_orig_dir=`pwd`
3405*6881a400Schristos	  cd $my_xdir || exit $?
3406*6881a400Schristos	  darwin_archive=$my_xabs
3407*6881a400Schristos	  darwin_curdir=`pwd`
3408*6881a400Schristos	  darwin_base_archive=`basename "$darwin_archive"`
3409*6881a400Schristos	  darwin_arches=`$LIPO -info "$darwin_archive" 2>/dev/null | $GREP Architectures 2>/dev/null || true`
3410*6881a400Schristos	  if test -n "$darwin_arches"; then
3411*6881a400Schristos	    darwin_arches=`$ECHO "$darwin_arches" | $SED -e 's/.*are://'`
3412*6881a400Schristos	    darwin_arch=
3413*6881a400Schristos	    func_verbose "$darwin_base_archive has multiple architectures $darwin_arches"
3414*6881a400Schristos	    for darwin_arch in  $darwin_arches ; do
3415*6881a400Schristos	      func_mkdir_p "unfat-$$/${darwin_base_archive}-${darwin_arch}"
3416*6881a400Schristos	      $LIPO -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}"
3417*6881a400Schristos	      cd "unfat-$$/${darwin_base_archive}-${darwin_arch}"
3418*6881a400Schristos	      func_extract_an_archive "`pwd`" "${darwin_base_archive}"
3419*6881a400Schristos	      cd "$darwin_curdir"
3420*6881a400Schristos	      $RM "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}"
3421*6881a400Schristos	    done # $darwin_arches
3422*6881a400Schristos            ## Okay now we've a bunch of thin objects, gotta fatten them up :)
3423*6881a400Schristos	    darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print | $SED -e "$basename" | sort -u`
3424*6881a400Schristos	    darwin_file=
3425*6881a400Schristos	    darwin_files=
3426*6881a400Schristos	    for darwin_file in $darwin_filelist; do
3427*6881a400Schristos	      darwin_files=`find unfat-$$ -name $darwin_file -print | $NL2SP`
3428*6881a400Schristos	      $LIPO -create -output "$darwin_file" $darwin_files
3429*6881a400Schristos	    done # $darwin_filelist
3430*6881a400Schristos	    $RM -rf unfat-$$
3431*6881a400Schristos	    cd "$darwin_orig_dir"
3432*6881a400Schristos	  else
3433*6881a400Schristos	    cd $darwin_orig_dir
3434*6881a400Schristos	    func_extract_an_archive "$my_xdir" "$my_xabs"
3435*6881a400Schristos	  fi # $darwin_arches
3436*6881a400Schristos	} # !$opt_dry_run
3437*6881a400Schristos	;;
3438*6881a400Schristos      *)
3439*6881a400Schristos        func_extract_an_archive "$my_xdir" "$my_xabs"
3440*6881a400Schristos	;;
3441*6881a400Schristos      esac
3442*6881a400Schristos      my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP`
3443*6881a400Schristos    done
3444*6881a400Schristos
3445*6881a400Schristos    func_extract_archives_result="$my_oldobjs"
3446*6881a400Schristos}
3447*6881a400Schristos
3448*6881a400Schristos
3449*6881a400Schristos# func_emit_wrapper [arg=no]
3450*6881a400Schristos#
3451*6881a400Schristos# Emit a libtool wrapper script on stdout.
3452*6881a400Schristos# Don't directly open a file because we may want to
3453*6881a400Schristos# incorporate the script contents within a cygwin/mingw
3454*6881a400Schristos# wrapper executable.  Must ONLY be called from within
3455*6881a400Schristos# func_mode_link because it depends on a number of variables
3456*6881a400Schristos# set therein.
3457*6881a400Schristos#
3458*6881a400Schristos# ARG is the value that the WRAPPER_SCRIPT_BELONGS_IN_OBJDIR
3459*6881a400Schristos# variable will take.  If 'yes', then the emitted script
3460*6881a400Schristos# will assume that the directory in which it is stored is
3461*6881a400Schristos# the $objdir directory.  This is a cygwin/mingw-specific
3462*6881a400Schristos# behavior.
3463*6881a400Schristosfunc_emit_wrapper ()
3464*6881a400Schristos{
3465*6881a400Schristos	func_emit_wrapper_arg1=${1-no}
3466*6881a400Schristos
3467*6881a400Schristos	$ECHO "\
3468*6881a400Schristos#! $SHELL
3469*6881a400Schristos
3470*6881a400Schristos# $output - temporary wrapper script for $objdir/$outputname
3471*6881a400Schristos# Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
3472*6881a400Schristos#
3473*6881a400Schristos# The $output program cannot be directly executed until all the libtool
3474*6881a400Schristos# libraries that it depends on are installed.
3475*6881a400Schristos#
3476*6881a400Schristos# This wrapper script should never be moved out of the build directory.
3477*6881a400Schristos# If it is, it will not operate correctly.
3478*6881a400Schristos
3479*6881a400Schristos# Sed substitution that helps us do robust quoting.  It backslashifies
3480*6881a400Schristos# metacharacters that are still active within double-quoted strings.
3481*6881a400Schristossed_quote_subst='$sed_quote_subst'
3482*6881a400Schristos
3483*6881a400Schristos# Be Bourne compatible
3484*6881a400Schristosif test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then
3485*6881a400Schristos  emulate sh
3486*6881a400Schristos  NULLCMD=:
3487*6881a400Schristos  # Zsh 3.x and 4.x performs word splitting on \${1+\"\$@\"}, which
3488*6881a400Schristos  # is contrary to our usage.  Disable this feature.
3489*6881a400Schristos  alias -g '\${1+\"\$@\"}'='\"\$@\"'
3490*6881a400Schristos  setopt NO_GLOB_SUBST
3491*6881a400Schristoselse
3492*6881a400Schristos  case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac
3493*6881a400Schristosfi
3494*6881a400SchristosBIN_SH=xpg4; export BIN_SH # for Tru64
3495*6881a400SchristosDUALCASE=1; export DUALCASE # for MKS sh
3496*6881a400Schristos
3497*6881a400Schristos# The HP-UX ksh and POSIX shell print the target directory to stdout
3498*6881a400Schristos# if CDPATH is set.
3499*6881a400Schristos(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
3500*6881a400Schristos
3501*6881a400Schristosrelink_command=\"$relink_command\"
3502*6881a400Schristos
3503*6881a400Schristos# This environment variable determines our operation mode.
3504*6881a400Schristosif test \"\$libtool_install_magic\" = \"$magic\"; then
3505*6881a400Schristos  # install mode needs the following variables:
3506*6881a400Schristos  generated_by_libtool_version='$macro_version'
3507*6881a400Schristos  notinst_deplibs='$notinst_deplibs'
3508*6881a400Schristoselse
3509*6881a400Schristos  # When we are sourced in execute mode, \$file and \$ECHO are already set.
3510*6881a400Schristos  if test \"\$libtool_execute_magic\" != \"$magic\"; then
3511*6881a400Schristos    file=\"\$0\""
3512*6881a400Schristos
3513*6881a400Schristos    qECHO=`$ECHO "$ECHO" | $SED "$sed_quote_subst"`
3514*6881a400Schristos    $ECHO "\
3515*6881a400Schristos
3516*6881a400Schristos# A function that is used when there is no print builtin or printf.
3517*6881a400Schristosfunc_fallback_echo ()
3518*6881a400Schristos{
3519*6881a400Schristos  eval 'cat <<_LTECHO_EOF
3520*6881a400Schristos\$1
3521*6881a400Schristos_LTECHO_EOF'
3522*6881a400Schristos}
3523*6881a400Schristos    ECHO=\"$qECHO\"
3524*6881a400Schristos  fi\
3525*6881a400Schristos
3526*6881a400Schristos  # Find the directory that this script lives in.
3527*6881a400Schristos  thisdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*$%%'\`
3528*6881a400Schristos  test \"x\$thisdir\" = \"x\$file\" && thisdir=.
3529*6881a400Schristos
3530*6881a400Schristos  # Follow symbolic links until we get to the real thisdir.
3531*6881a400Schristos  file=\`ls -ld \"\$file\" | $SED -n 's/.*-> //p'\`
3532*6881a400Schristos  while test -n \"\$file\"; do
3533*6881a400Schristos    destdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*\$%%'\`
3534*6881a400Schristos
3535*6881a400Schristos    # If there was a directory component, then change thisdir.
3536*6881a400Schristos    if test \"x\$destdir\" != \"x\$file\"; then
3537*6881a400Schristos      case \"\$destdir\" in
3538*6881a400Schristos      [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;;
3539*6881a400Schristos      *) thisdir=\"\$thisdir/\$destdir\" ;;
3540*6881a400Schristos      esac
3541*6881a400Schristos    fi
3542*6881a400Schristos
3543*6881a400Schristos    file=\`\$ECHO \"\$file\" | $SED 's%^.*/%%'\`
3544*6881a400Schristos    file=\`ls -ld \"\$thisdir/\$file\" | $SED -n 's/.*-> //p'\`
3545*6881a400Schristos  done
3546*6881a400Schristos
3547*6881a400Schristos  # Usually 'no', except on cygwin/mingw when embedded into
3548*6881a400Schristos  # the cwrapper.
3549*6881a400Schristos  WRAPPER_SCRIPT_BELONGS_IN_OBJDIR=$func_emit_wrapper_arg1
3550*6881a400Schristos  if test \"\$WRAPPER_SCRIPT_BELONGS_IN_OBJDIR\" = \"yes\"; then
3551*6881a400Schristos    # special case for '.'
3552*6881a400Schristos    if test \"\$thisdir\" = \".\"; then
3553*6881a400Schristos      thisdir=\`pwd\`
3554*6881a400Schristos    fi
3555*6881a400Schristos    # remove .libs from thisdir
3556*6881a400Schristos    case \"\$thisdir\" in
3557*6881a400Schristos    *[\\\\/]$objdir ) thisdir=\`\$ECHO \"\$thisdir\" | $SED 's%[\\\\/][^\\\\/]*$%%'\` ;;
3558*6881a400Schristos    $objdir )   thisdir=. ;;
3559*6881a400Schristos    esac
3560*6881a400Schristos  fi
3561*6881a400Schristos
3562*6881a400Schristos  # Try to get the absolute directory name.
3563*6881a400Schristos  absdir=\`cd \"\$thisdir\" && pwd\`
3564*6881a400Schristos  test -n \"\$absdir\" && thisdir=\"\$absdir\"
3565*6881a400Schristos"
3566*6881a400Schristos
3567*6881a400Schristos	if test "$fast_install" = yes; then
3568*6881a400Schristos	  $ECHO "\
3569*6881a400Schristos  program=lt-'$outputname'$exeext
3570*6881a400Schristos  progdir=\"\$thisdir/$objdir\"
3571*6881a400Schristos
3572*6881a400Schristos  if test ! -f \"\$progdir/\$program\" ||
3573*6881a400Schristos     { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\
3574*6881a400Schristos       test \"X\$file\" != \"X\$progdir/\$program\"; }; then
3575*6881a400Schristos
3576*6881a400Schristos    file=\"\$\$-\$program\"
3577*6881a400Schristos
3578*6881a400Schristos    if test ! -d \"\$progdir\"; then
3579*6881a400Schristos      $MKDIR \"\$progdir\"
3580*6881a400Schristos    else
3581*6881a400Schristos      $RM \"\$progdir/\$file\"
3582*6881a400Schristos    fi"
3583*6881a400Schristos
3584*6881a400Schristos	  $ECHO "\
3585*6881a400Schristos
3586*6881a400Schristos    # relink executable if necessary
3587*6881a400Schristos    if test -n \"\$relink_command\"; then
3588*6881a400Schristos      if relink_command_output=\`eval \"\$relink_command\" 2>&1\`; then :
3589*6881a400Schristos      else
3590*6881a400Schristos	$ECHO \"\$relink_command_output\" >&2
3591*6881a400Schristos	$RM \"\$progdir/\$file\"
3592*6881a400Schristos	exit 1
3593*6881a400Schristos      fi
3594*6881a400Schristos    fi
3595*6881a400Schristos
3596*6881a400Schristos    $MV \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null ||
3597*6881a400Schristos    { $RM \"\$progdir/\$program\";
3598*6881a400Schristos      $MV \"\$progdir/\$file\" \"\$progdir/\$program\"; }
3599*6881a400Schristos    $RM \"\$progdir/\$file\"
3600*6881a400Schristos  fi"
3601*6881a400Schristos	else
3602*6881a400Schristos	  $ECHO "\
3603*6881a400Schristos  program='$outputname'
3604*6881a400Schristos  progdir=\"\$thisdir/$objdir\"
3605*6881a400Schristos"
3606*6881a400Schristos	fi
3607*6881a400Schristos
3608*6881a400Schristos	$ECHO "\
3609*6881a400Schristos
3610*6881a400Schristos  if test -f \"\$progdir/\$program\"; then"
3611*6881a400Schristos
3612*6881a400Schristos	# Export our shlibpath_var if we have one.
3613*6881a400Schristos	if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
3614*6881a400Schristos	  $ECHO "\
3615*6881a400Schristos    # Add our own library path to $shlibpath_var
3616*6881a400Schristos    $shlibpath_var=\"$temp_rpath\$$shlibpath_var\"
3617*6881a400Schristos
3618*6881a400Schristos    # Some systems cannot cope with colon-terminated $shlibpath_var
3619*6881a400Schristos    # The second colon is a workaround for a bug in BeOS R4 sed
3620*6881a400Schristos    $shlibpath_var=\`\$ECHO \"\$$shlibpath_var\" | $SED 's/::*\$//'\`
3621*6881a400Schristos
3622*6881a400Schristos    export $shlibpath_var
3623*6881a400Schristos"
3624*6881a400Schristos	fi
3625*6881a400Schristos
3626*6881a400Schristos	# fixup the dll searchpath if we need to.
3627*6881a400Schristos	if test -n "$dllsearchpath"; then
3628*6881a400Schristos	  $ECHO "\
3629*6881a400Schristos    # Add the dll search path components to the executable PATH
3630*6881a400Schristos    PATH=$dllsearchpath:\$PATH
3631*6881a400Schristos"
3632*6881a400Schristos	fi
3633*6881a400Schristos
3634*6881a400Schristos	$ECHO "\
3635*6881a400Schristos    if test \"\$libtool_execute_magic\" != \"$magic\"; then
3636*6881a400Schristos      # Run the actual program with our arguments.
3637*6881a400Schristos"
3638*6881a400Schristos	case $host in
3639*6881a400Schristos	# Backslashes separate directories on plain windows
3640*6881a400Schristos	*-*-mingw | *-*-os2* | *-cegcc*)
3641*6881a400Schristos	  $ECHO "\
3642*6881a400Schristos      exec \"\$progdir\\\\\$program\" \${1+\"\$@\"}
3643*6881a400Schristos"
3644*6881a400Schristos	  ;;
3645*6881a400Schristos
3646*6881a400Schristos	*)
3647*6881a400Schristos	  $ECHO "\
3648*6881a400Schristos      exec \"\$progdir/\$program\" \${1+\"\$@\"}
3649*6881a400Schristos"
3650*6881a400Schristos	  ;;
3651*6881a400Schristos	esac
3652*6881a400Schristos	$ECHO "\
3653*6881a400Schristos      \$ECHO \"\$0: cannot exec \$program \$*\" 1>&2
3654*6881a400Schristos      exit 1
3655*6881a400Schristos    fi
3656*6881a400Schristos  else
3657*6881a400Schristos    # The program doesn't exist.
3658*6881a400Schristos    \$ECHO \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2
3659*6881a400Schristos    \$ECHO \"This script is just a wrapper for \$program.\" 1>&2
3660*6881a400Schristos    \$ECHO \"See the $PACKAGE documentation for more information.\" 1>&2
3661*6881a400Schristos    exit 1
3662*6881a400Schristos  fi
3663*6881a400Schristosfi\
3664*6881a400Schristos"
3665*6881a400Schristos}
3666*6881a400Schristos
3667*6881a400Schristos
3668*6881a400Schristos# func_to_host_path arg
3669*6881a400Schristos#
3670*6881a400Schristos# Convert paths to host format when used with build tools.
3671*6881a400Schristos# Intended for use with "native" mingw (where libtool itself
3672*6881a400Schristos# is running under the msys shell), or in the following cross-
3673*6881a400Schristos# build environments:
3674*6881a400Schristos#    $build          $host
3675*6881a400Schristos#    mingw (msys)    mingw  [e.g. native]
3676*6881a400Schristos#    cygwin          mingw
3677*6881a400Schristos#    *nix + wine     mingw
3678*6881a400Schristos# where wine is equipped with the `winepath' executable.
3679*6881a400Schristos# In the native mingw case, the (msys) shell automatically
3680*6881a400Schristos# converts paths for any non-msys applications it launches,
3681*6881a400Schristos# but that facility isn't available from inside the cwrapper.
3682*6881a400Schristos# Similar accommodations are necessary for $host mingw and
3683*6881a400Schristos# $build cygwin.  Calling this function does no harm for other
3684*6881a400Schristos# $host/$build combinations not listed above.
3685*6881a400Schristos#
3686*6881a400Schristos# ARG is the path (on $build) that should be converted to
3687*6881a400Schristos# the proper representation for $host. The result is stored
3688*6881a400Schristos# in $func_to_host_path_result.
3689*6881a400Schristosfunc_to_host_path ()
3690*6881a400Schristos{
3691*6881a400Schristos  func_to_host_path_result="$1"
3692*6881a400Schristos  if test -n "$1"; then
3693*6881a400Schristos    case $host in
3694*6881a400Schristos      *mingw* )
3695*6881a400Schristos        lt_sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g'
3696*6881a400Schristos        case $build in
3697*6881a400Schristos          *mingw* ) # actually, msys
3698*6881a400Schristos            # awkward: cmd appends spaces to result
3699*6881a400Schristos            func_to_host_path_result=`( cmd //c echo "$1" ) 2>/dev/null |
3700*6881a400Schristos              $SED -e 's/[ ]*$//' -e "$lt_sed_naive_backslashify"`
3701*6881a400Schristos            ;;
3702*6881a400Schristos          *cygwin* )
3703*6881a400Schristos            func_to_host_path_result=`cygpath -w "$1" |
3704*6881a400Schristos	      $SED -e "$lt_sed_naive_backslashify"`
3705*6881a400Schristos            ;;
3706*6881a400Schristos          * )
3707*6881a400Schristos            # Unfortunately, winepath does not exit with a non-zero
3708*6881a400Schristos            # error code, so we are forced to check the contents of
3709*6881a400Schristos            # stdout. On the other hand, if the command is not
3710*6881a400Schristos            # found, the shell will set an exit code of 127 and print
3711*6881a400Schristos            # *an error message* to stdout. So we must check for both
3712*6881a400Schristos            # error code of zero AND non-empty stdout, which explains
3713*6881a400Schristos            # the odd construction:
3714*6881a400Schristos            func_to_host_path_tmp1=`winepath -w "$1" 2>/dev/null`
3715*6881a400Schristos            if test "$?" -eq 0 && test -n "${func_to_host_path_tmp1}"; then
3716*6881a400Schristos              func_to_host_path_result=`$ECHO "$func_to_host_path_tmp1" |
3717*6881a400Schristos                $SED -e "$lt_sed_naive_backslashify"`
3718*6881a400Schristos            else
3719*6881a400Schristos              # Allow warning below.
3720*6881a400Schristos              func_to_host_path_result=
3721*6881a400Schristos            fi
3722*6881a400Schristos            ;;
3723*6881a400Schristos        esac
3724*6881a400Schristos        if test -z "$func_to_host_path_result" ; then
3725*6881a400Schristos          func_error "Could not determine host path corresponding to"
3726*6881a400Schristos          func_error "  \`$1'"
3727*6881a400Schristos          func_error "Continuing, but uninstalled executables may not work."
3728*6881a400Schristos          # Fallback:
3729*6881a400Schristos          func_to_host_path_result="$1"
3730*6881a400Schristos        fi
3731*6881a400Schristos        ;;
3732*6881a400Schristos    esac
3733*6881a400Schristos  fi
3734*6881a400Schristos}
3735*6881a400Schristos# end: func_to_host_path
3736*6881a400Schristos
3737*6881a400Schristos# func_to_host_pathlist arg
3738*6881a400Schristos#
3739*6881a400Schristos# Convert pathlists to host format when used with build tools.
3740*6881a400Schristos# See func_to_host_path(), above. This function supports the
3741*6881a400Schristos# following $build/$host combinations (but does no harm for
3742*6881a400Schristos# combinations not listed here):
3743*6881a400Schristos#    $build          $host
3744*6881a400Schristos#    mingw (msys)    mingw  [e.g. native]
3745*6881a400Schristos#    cygwin          mingw
3746*6881a400Schristos#    *nix + wine     mingw
3747*6881a400Schristos#
3748*6881a400Schristos# Path separators are also converted from $build format to
3749*6881a400Schristos# $host format. If ARG begins or ends with a path separator
3750*6881a400Schristos# character, it is preserved (but converted to $host format)
3751*6881a400Schristos# on output.
3752*6881a400Schristos#
3753*6881a400Schristos# ARG is a pathlist (on $build) that should be converted to
3754*6881a400Schristos# the proper representation on $host. The result is stored
3755*6881a400Schristos# in $func_to_host_pathlist_result.
3756*6881a400Schristosfunc_to_host_pathlist ()
3757*6881a400Schristos{
3758*6881a400Schristos  func_to_host_pathlist_result="$1"
3759*6881a400Schristos  if test -n "$1"; then
3760*6881a400Schristos    case $host in
3761*6881a400Schristos      *mingw* )
3762*6881a400Schristos        lt_sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g'
3763*6881a400Schristos        # Remove leading and trailing path separator characters from
3764*6881a400Schristos        # ARG. msys behavior is inconsistent here, cygpath turns them
3765*6881a400Schristos        # into '.;' and ';.', and winepath ignores them completely.
3766*6881a400Schristos	func_stripname : : "$1"
3767*6881a400Schristos        func_to_host_pathlist_tmp1=$func_stripname_result
3768*6881a400Schristos        case $build in
3769*6881a400Schristos          *mingw* ) # Actually, msys.
3770*6881a400Schristos            # Awkward: cmd appends spaces to result.
3771*6881a400Schristos            func_to_host_pathlist_result=`
3772*6881a400Schristos	      ( cmd //c echo "$func_to_host_pathlist_tmp1" ) 2>/dev/null |
3773*6881a400Schristos	      $SED -e 's/[ ]*$//' -e "$lt_sed_naive_backslashify"`
3774*6881a400Schristos            ;;
3775*6881a400Schristos          *cygwin* )
3776*6881a400Schristos            func_to_host_pathlist_result=`cygpath -w -p "$func_to_host_pathlist_tmp1" |
3777*6881a400Schristos              $SED -e "$lt_sed_naive_backslashify"`
3778*6881a400Schristos            ;;
3779*6881a400Schristos          * )
3780*6881a400Schristos            # unfortunately, winepath doesn't convert pathlists
3781*6881a400Schristos            func_to_host_pathlist_result=""
3782*6881a400Schristos            func_to_host_pathlist_oldIFS=$IFS
3783*6881a400Schristos            IFS=:
3784*6881a400Schristos            for func_to_host_pathlist_f in $func_to_host_pathlist_tmp1 ; do
3785*6881a400Schristos              IFS=$func_to_host_pathlist_oldIFS
3786*6881a400Schristos              if test -n "$func_to_host_pathlist_f" ; then
3787*6881a400Schristos                func_to_host_path "$func_to_host_pathlist_f"
3788*6881a400Schristos                if test -n "$func_to_host_path_result" ; then
3789*6881a400Schristos                  if test -z "$func_to_host_pathlist_result" ; then
3790*6881a400Schristos                    func_to_host_pathlist_result="$func_to_host_path_result"
3791*6881a400Schristos                  else
3792*6881a400Schristos                    func_append func_to_host_pathlist_result ";$func_to_host_path_result"
3793*6881a400Schristos                  fi
3794*6881a400Schristos                fi
3795*6881a400Schristos              fi
3796*6881a400Schristos            done
3797*6881a400Schristos            IFS=$func_to_host_pathlist_oldIFS
3798*6881a400Schristos            ;;
3799*6881a400Schristos        esac
3800*6881a400Schristos        if test -z "$func_to_host_pathlist_result"; then
3801*6881a400Schristos          func_error "Could not determine the host path(s) corresponding to"
3802*6881a400Schristos          func_error "  \`$1'"
3803*6881a400Schristos          func_error "Continuing, but uninstalled executables may not work."
3804*6881a400Schristos          # Fallback. This may break if $1 contains DOS-style drive
3805*6881a400Schristos          # specifications. The fix is not to complicate the expression
3806*6881a400Schristos          # below, but for the user to provide a working wine installation
3807*6881a400Schristos          # with winepath so that path translation in the cross-to-mingw
3808*6881a400Schristos          # case works properly.
3809*6881a400Schristos          lt_replace_pathsep_nix_to_dos="s|:|;|g"
3810*6881a400Schristos          func_to_host_pathlist_result=`echo "$func_to_host_pathlist_tmp1" |\
3811*6881a400Schristos            $SED -e "$lt_replace_pathsep_nix_to_dos"`
3812*6881a400Schristos        fi
3813*6881a400Schristos        # Now, add the leading and trailing path separators back
3814*6881a400Schristos        case "$1" in
3815*6881a400Schristos          :* ) func_to_host_pathlist_result=";$func_to_host_pathlist_result"
3816*6881a400Schristos            ;;
3817*6881a400Schristos        esac
3818*6881a400Schristos        case "$1" in
3819*6881a400Schristos          *: ) func_append func_to_host_pathlist_result ";"
3820*6881a400Schristos            ;;
3821*6881a400Schristos        esac
3822*6881a400Schristos        ;;
3823*6881a400Schristos    esac
3824*6881a400Schristos  fi
3825*6881a400Schristos}
3826*6881a400Schristos# end: func_to_host_pathlist
3827*6881a400Schristos
3828*6881a400Schristos# func_emit_cwrapperexe_src
3829*6881a400Schristos# emit the source code for a wrapper executable on stdout
3830*6881a400Schristos# Must ONLY be called from within func_mode_link because
3831*6881a400Schristos# it depends on a number of variable set therein.
3832*6881a400Schristosfunc_emit_cwrapperexe_src ()
3833*6881a400Schristos{
3834*6881a400Schristos	cat <<EOF
3835*6881a400Schristos
3836*6881a400Schristos/* $cwrappersource - temporary wrapper executable for $objdir/$outputname
3837*6881a400Schristos   Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
3838*6881a400Schristos
3839*6881a400Schristos   The $output program cannot be directly executed until all the libtool
3840*6881a400Schristos   libraries that it depends on are installed.
3841*6881a400Schristos
3842*6881a400Schristos   This wrapper executable should never be moved out of the build directory.
3843*6881a400Schristos   If it is, it will not operate correctly.
3844*6881a400Schristos
3845*6881a400Schristos   Currently, it simply execs the wrapper *script* "$SHELL $output",
3846*6881a400Schristos   but could eventually absorb all of the scripts functionality and
3847*6881a400Schristos   exec $objdir/$outputname directly.
3848*6881a400Schristos*/
3849*6881a400SchristosEOF
3850*6881a400Schristos	    cat <<"EOF"
3851*6881a400Schristos#ifdef _MSC_VER
3852*6881a400Schristos# define _CRT_SECURE_NO_DEPRECATE 1
3853*6881a400Schristos#endif
3854*6881a400Schristos#include <stdio.h>
3855*6881a400Schristos#include <stdlib.h>
3856*6881a400Schristos#ifdef _MSC_VER
3857*6881a400Schristos# include <direct.h>
3858*6881a400Schristos# include <process.h>
3859*6881a400Schristos# include <io.h>
3860*6881a400Schristos#else
3861*6881a400Schristos# include <unistd.h>
3862*6881a400Schristos# include <stdint.h>
3863*6881a400Schristos# ifdef __CYGWIN__
3864*6881a400Schristos#  include <io.h>
3865*6881a400Schristos# endif
3866*6881a400Schristos#endif
3867*6881a400Schristos#include <malloc.h>
3868*6881a400Schristos#include <stdarg.h>
3869*6881a400Schristos#include <assert.h>
3870*6881a400Schristos#include <string.h>
3871*6881a400Schristos#include <ctype.h>
3872*6881a400Schristos#include <errno.h>
3873*6881a400Schristos#include <fcntl.h>
3874*6881a400Schristos#include <sys/stat.h>
3875*6881a400Schristos
3876*6881a400Schristos/* declarations of non-ANSI functions */
3877*6881a400Schristos#if defined(__MINGW32__)
3878*6881a400Schristos# ifdef __STRICT_ANSI__
3879*6881a400Schristosint _putenv (const char *);
3880*6881a400Schristos# endif
3881*6881a400Schristos#elif defined(__CYGWIN__)
3882*6881a400Schristos# ifdef __STRICT_ANSI__
3883*6881a400Schristoschar *realpath (const char *, char *);
3884*6881a400Schristosint putenv (char *);
3885*6881a400Schristosint setenv (const char *, const char *, int);
3886*6881a400Schristos# endif
3887*6881a400Schristos/* #elif defined (other platforms) ... */
3888*6881a400Schristos#endif
3889*6881a400Schristos
3890*6881a400Schristos/* portability defines, excluding path handling macros */
3891*6881a400Schristos#if defined(_MSC_VER)
3892*6881a400Schristos# define setmode _setmode
3893*6881a400Schristos# define stat    _stat
3894*6881a400Schristos# define chmod   _chmod
3895*6881a400Schristos# define getcwd  _getcwd
3896*6881a400Schristos# define putenv  _putenv
3897*6881a400Schristos# define S_IXUSR _S_IEXEC
3898*6881a400Schristos# ifndef _INTPTR_T_DEFINED
3899*6881a400Schristos#  define _INTPTR_T_DEFINED
3900*6881a400Schristos#  define intptr_t int
3901*6881a400Schristos# endif
3902*6881a400Schristos#elif defined(__MINGW32__)
3903*6881a400Schristos# define setmode _setmode
3904*6881a400Schristos# define stat    _stat
3905*6881a400Schristos# define chmod   _chmod
3906*6881a400Schristos# define getcwd  _getcwd
3907*6881a400Schristos# define putenv  _putenv
3908*6881a400Schristos#elif defined(__CYGWIN__)
3909*6881a400Schristos# define HAVE_SETENV
3910*6881a400Schristos# define FOPEN_WB "wb"
3911*6881a400Schristos/* #elif defined (other platforms) ... */
3912*6881a400Schristos#endif
3913*6881a400Schristos
3914*6881a400Schristos#if defined(PATH_MAX)
3915*6881a400Schristos# define LT_PATHMAX PATH_MAX
3916*6881a400Schristos#elif defined(MAXPATHLEN)
3917*6881a400Schristos# define LT_PATHMAX MAXPATHLEN
3918*6881a400Schristos#else
3919*6881a400Schristos# define LT_PATHMAX 1024
3920*6881a400Schristos#endif
3921*6881a400Schristos
3922*6881a400Schristos#ifndef S_IXOTH
3923*6881a400Schristos# define S_IXOTH 0
3924*6881a400Schristos#endif
3925*6881a400Schristos#ifndef S_IXGRP
3926*6881a400Schristos# define S_IXGRP 0
3927*6881a400Schristos#endif
3928*6881a400Schristos
3929*6881a400Schristos/* path handling portability macros */
3930*6881a400Schristos#ifndef DIR_SEPARATOR
3931*6881a400Schristos# define DIR_SEPARATOR '/'
3932*6881a400Schristos# define PATH_SEPARATOR ':'
3933*6881a400Schristos#endif
3934*6881a400Schristos
3935*6881a400Schristos#if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \
3936*6881a400Schristos  defined (__OS2__)
3937*6881a400Schristos# define HAVE_DOS_BASED_FILE_SYSTEM
3938*6881a400Schristos# define FOPEN_WB "wb"
3939*6881a400Schristos# ifndef DIR_SEPARATOR_2
3940*6881a400Schristos#  define DIR_SEPARATOR_2 '\\'
3941*6881a400Schristos# endif
3942*6881a400Schristos# ifndef PATH_SEPARATOR_2
3943*6881a400Schristos#  define PATH_SEPARATOR_2 ';'
3944*6881a400Schristos# endif
3945*6881a400Schristos#endif
3946*6881a400Schristos
3947*6881a400Schristos#ifndef DIR_SEPARATOR_2
3948*6881a400Schristos# define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR)
3949*6881a400Schristos#else /* DIR_SEPARATOR_2 */
3950*6881a400Schristos# define IS_DIR_SEPARATOR(ch) \
3951*6881a400Schristos	(((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2))
3952*6881a400Schristos#endif /* DIR_SEPARATOR_2 */
3953*6881a400Schristos
3954*6881a400Schristos#ifndef PATH_SEPARATOR_2
3955*6881a400Schristos# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR)
3956*6881a400Schristos#else /* PATH_SEPARATOR_2 */
3957*6881a400Schristos# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2)
3958*6881a400Schristos#endif /* PATH_SEPARATOR_2 */
3959*6881a400Schristos
3960*6881a400Schristos#ifndef FOPEN_WB
3961*6881a400Schristos# define FOPEN_WB "w"
3962*6881a400Schristos#endif
3963*6881a400Schristos#ifndef _O_BINARY
3964*6881a400Schristos# define _O_BINARY 0
3965*6881a400Schristos#endif
3966*6881a400Schristos
3967*6881a400Schristos#define XMALLOC(type, num)      ((type *) xmalloc ((num) * sizeof(type)))
3968*6881a400Schristos#define XFREE(stale) do { \
3969*6881a400Schristos  if (stale) { free ((void *) stale); stale = 0; } \
3970*6881a400Schristos} while (0)
3971*6881a400Schristos
3972*6881a400Schristos#undef LTWRAPPER_DEBUGPRINTF
3973*6881a400Schristos#if defined LT_DEBUGWRAPPER
3974*6881a400Schristos# define LTWRAPPER_DEBUGPRINTF(args) ltwrapper_debugprintf args
3975*6881a400Schristosstatic void
3976*6881a400Schristosltwrapper_debugprintf (const char *fmt, ...)
3977*6881a400Schristos{
3978*6881a400Schristos    va_list args;
3979*6881a400Schristos    va_start (args, fmt);
3980*6881a400Schristos    (void) vfprintf (stderr, fmt, args);
3981*6881a400Schristos    va_end (args);
3982*6881a400Schristos}
3983*6881a400Schristos#else
3984*6881a400Schristos# define LTWRAPPER_DEBUGPRINTF(args)
3985*6881a400Schristos#endif
3986*6881a400Schristos
3987*6881a400Schristosconst char *program_name = NULL;
3988*6881a400Schristos
3989*6881a400Schristosvoid *xmalloc (size_t num);
3990*6881a400Schristoschar *xstrdup (const char *string);
3991*6881a400Schristosconst char *base_name (const char *name);
3992*6881a400Schristoschar *find_executable (const char *wrapper);
3993*6881a400Schristoschar *chase_symlinks (const char *pathspec);
3994*6881a400Schristosint make_executable (const char *path);
3995*6881a400Schristosint check_executable (const char *path);
3996*6881a400Schristoschar *strendzap (char *str, const char *pat);
3997*6881a400Schristosvoid lt_fatal (const char *message, ...);
3998*6881a400Schristosvoid lt_setenv (const char *name, const char *value);
3999*6881a400Schristoschar *lt_extend_str (const char *orig_value, const char *add, int to_end);
4000*6881a400Schristosvoid lt_update_exe_path (const char *name, const char *value);
4001*6881a400Schristosvoid lt_update_lib_path (const char *name, const char *value);
4002*6881a400Schristoschar **prepare_spawn (char **argv);
4003*6881a400Schristosvoid lt_dump_script (FILE *f);
4004*6881a400SchristosEOF
4005*6881a400Schristos
4006*6881a400Schristos	    cat <<EOF
4007*6881a400Schristosconst char * MAGIC_EXE = "$magic_exe";
4008*6881a400Schristosconst char * LIB_PATH_VARNAME = "$shlibpath_var";
4009*6881a400SchristosEOF
4010*6881a400Schristos
4011*6881a400Schristos	    if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
4012*6881a400Schristos              func_to_host_pathlist "$temp_rpath"
4013*6881a400Schristos	      cat <<EOF
4014*6881a400Schristosconst char * LIB_PATH_VALUE   = "$func_to_host_pathlist_result";
4015*6881a400SchristosEOF
4016*6881a400Schristos	    else
4017*6881a400Schristos	      cat <<"EOF"
4018*6881a400Schristosconst char * LIB_PATH_VALUE   = "";
4019*6881a400SchristosEOF
4020*6881a400Schristos	    fi
4021*6881a400Schristos
4022*6881a400Schristos	    if test -n "$dllsearchpath"; then
4023*6881a400Schristos              func_to_host_pathlist "$dllsearchpath:"
4024*6881a400Schristos	      cat <<EOF
4025*6881a400Schristosconst char * EXE_PATH_VARNAME = "PATH";
4026*6881a400Schristosconst char * EXE_PATH_VALUE   = "$func_to_host_pathlist_result";
4027*6881a400SchristosEOF
4028*6881a400Schristos	    else
4029*6881a400Schristos	      cat <<"EOF"
4030*6881a400Schristosconst char * EXE_PATH_VARNAME = "";
4031*6881a400Schristosconst char * EXE_PATH_VALUE   = "";
4032*6881a400SchristosEOF
4033*6881a400Schristos	    fi
4034*6881a400Schristos
4035*6881a400Schristos	    if test "$fast_install" = yes; then
4036*6881a400Schristos	      cat <<EOF
4037*6881a400Schristosconst char * TARGET_PROGRAM_NAME = "lt-$outputname"; /* hopefully, no .exe */
4038*6881a400SchristosEOF
4039*6881a400Schristos	    else
4040*6881a400Schristos	      cat <<EOF
4041*6881a400Schristosconst char * TARGET_PROGRAM_NAME = "$outputname"; /* hopefully, no .exe */
4042*6881a400SchristosEOF
4043*6881a400Schristos	    fi
4044*6881a400Schristos
4045*6881a400Schristos
4046*6881a400Schristos	    cat <<"EOF"
4047*6881a400Schristos
4048*6881a400Schristos#define LTWRAPPER_OPTION_PREFIX         "--lt-"
4049*6881a400Schristos#define LTWRAPPER_OPTION_PREFIX_LENGTH  5
4050*6881a400Schristos
4051*6881a400Schristosstatic const size_t opt_prefix_len         = LTWRAPPER_OPTION_PREFIX_LENGTH;
4052*6881a400Schristosstatic const char *ltwrapper_option_prefix = LTWRAPPER_OPTION_PREFIX;
4053*6881a400Schristos
4054*6881a400Schristosstatic const char *dumpscript_opt       = LTWRAPPER_OPTION_PREFIX "dump-script";
4055*6881a400Schristos
4056*6881a400Schristosint
4057*6881a400Schristosmain (int argc, char *argv[])
4058*6881a400Schristos{
4059*6881a400Schristos  char **newargz;
4060*6881a400Schristos  int  newargc;
4061*6881a400Schristos  char *tmp_pathspec;
4062*6881a400Schristos  char *actual_cwrapper_path;
4063*6881a400Schristos  char *actual_cwrapper_name;
4064*6881a400Schristos  char *target_name;
4065*6881a400Schristos  char *lt_argv_zero;
4066*6881a400Schristos  intptr_t rval = 127;
4067*6881a400Schristos
4068*6881a400Schristos  int i;
4069*6881a400Schristos
4070*6881a400Schristos  program_name = (char *) xstrdup (base_name (argv[0]));
4071*6881a400Schristos  LTWRAPPER_DEBUGPRINTF (("(main) argv[0]      : %s\n", argv[0]));
4072*6881a400Schristos  LTWRAPPER_DEBUGPRINTF (("(main) program_name : %s\n", program_name));
4073*6881a400Schristos
4074*6881a400Schristos  /* very simple arg parsing; don't want to rely on getopt */
4075*6881a400Schristos  for (i = 1; i < argc; i++)
4076*6881a400Schristos    {
4077*6881a400Schristos      if (strcmp (argv[i], dumpscript_opt) == 0)
4078*6881a400Schristos	{
4079*6881a400SchristosEOF
4080*6881a400Schristos	    case "$host" in
4081*6881a400Schristos	      *mingw* | *cygwin* )
4082*6881a400Schristos		# make stdout use "unix" line endings
4083*6881a400Schristos		echo "          setmode(1,_O_BINARY);"
4084*6881a400Schristos		;;
4085*6881a400Schristos	      esac
4086*6881a400Schristos
4087*6881a400Schristos	    cat <<"EOF"
4088*6881a400Schristos	  lt_dump_script (stdout);
4089*6881a400Schristos	  return 0;
4090*6881a400Schristos	}
4091*6881a400Schristos    }
4092*6881a400Schristos
4093*6881a400Schristos  newargz = XMALLOC (char *, argc + 1);
4094*6881a400Schristos  tmp_pathspec = find_executable (argv[0]);
4095*6881a400Schristos  if (tmp_pathspec == NULL)
4096*6881a400Schristos    lt_fatal ("Couldn't find %s", argv[0]);
4097*6881a400Schristos  LTWRAPPER_DEBUGPRINTF (("(main) found exe (before symlink chase) at : %s\n",
4098*6881a400Schristos			  tmp_pathspec));
4099*6881a400Schristos
4100*6881a400Schristos  actual_cwrapper_path = chase_symlinks (tmp_pathspec);
4101*6881a400Schristos  LTWRAPPER_DEBUGPRINTF (("(main) found exe (after symlink chase) at : %s\n",
4102*6881a400Schristos			  actual_cwrapper_path));
4103*6881a400Schristos  XFREE (tmp_pathspec);
4104*6881a400Schristos
4105*6881a400Schristos  actual_cwrapper_name = xstrdup( base_name (actual_cwrapper_path));
4106*6881a400Schristos  strendzap (actual_cwrapper_path, actual_cwrapper_name);
4107*6881a400Schristos
4108*6881a400Schristos  /* wrapper name transforms */
4109*6881a400Schristos  strendzap (actual_cwrapper_name, ".exe");
4110*6881a400Schristos  tmp_pathspec = lt_extend_str (actual_cwrapper_name, ".exe", 1);
4111*6881a400Schristos  XFREE (actual_cwrapper_name);
4112*6881a400Schristos  actual_cwrapper_name = tmp_pathspec;
4113*6881a400Schristos  tmp_pathspec = 0;
4114*6881a400Schristos
4115*6881a400Schristos  /* target_name transforms -- use actual target program name; might have lt- prefix */
4116*6881a400Schristos  target_name = xstrdup (base_name (TARGET_PROGRAM_NAME));
4117*6881a400Schristos  strendzap (target_name, ".exe");
4118*6881a400Schristos  tmp_pathspec = lt_extend_str (target_name, ".exe", 1);
4119*6881a400Schristos  XFREE (target_name);
4120*6881a400Schristos  target_name = tmp_pathspec;
4121*6881a400Schristos  tmp_pathspec = 0;
4122*6881a400Schristos
4123*6881a400Schristos  LTWRAPPER_DEBUGPRINTF (("(main) libtool target name: %s\n",
4124*6881a400Schristos			  target_name));
4125*6881a400SchristosEOF
4126*6881a400Schristos
4127*6881a400Schristos	    cat <<EOF
4128*6881a400Schristos  newargz[0] =
4129*6881a400Schristos    XMALLOC (char, (strlen (actual_cwrapper_path) +
4130*6881a400Schristos		    strlen ("$objdir") + 1 + strlen (actual_cwrapper_name) + 1));
4131*6881a400Schristos  strcpy (newargz[0], actual_cwrapper_path);
4132*6881a400Schristos  strcat (newargz[0], "$objdir");
4133*6881a400Schristos  strcat (newargz[0], "/");
4134*6881a400SchristosEOF
4135*6881a400Schristos
4136*6881a400Schristos	    cat <<"EOF"
4137*6881a400Schristos  /* stop here, and copy so we don't have to do this twice */
4138*6881a400Schristos  tmp_pathspec = xstrdup (newargz[0]);
4139*6881a400Schristos
4140*6881a400Schristos  /* do NOT want the lt- prefix here, so use actual_cwrapper_name */
4141*6881a400Schristos  strcat (newargz[0], actual_cwrapper_name);
4142*6881a400Schristos
4143*6881a400Schristos  /* DO want the lt- prefix here if it exists, so use target_name */
4144*6881a400Schristos  lt_argv_zero = lt_extend_str (tmp_pathspec, target_name, 1);
4145*6881a400Schristos  XFREE (tmp_pathspec);
4146*6881a400Schristos  tmp_pathspec = NULL;
4147*6881a400SchristosEOF
4148*6881a400Schristos
4149*6881a400Schristos	    case $host_os in
4150*6881a400Schristos	      mingw*)
4151*6881a400Schristos	    cat <<"EOF"
4152*6881a400Schristos  {
4153*6881a400Schristos    char* p;
4154*6881a400Schristos    while ((p = strchr (newargz[0], '\\')) != NULL)
4155*6881a400Schristos      {
4156*6881a400Schristos	*p = '/';
4157*6881a400Schristos      }
4158*6881a400Schristos    while ((p = strchr (lt_argv_zero, '\\')) != NULL)
4159*6881a400Schristos      {
4160*6881a400Schristos	*p = '/';
4161*6881a400Schristos      }
4162*6881a400Schristos  }
4163*6881a400SchristosEOF
4164*6881a400Schristos	    ;;
4165*6881a400Schristos	    esac
4166*6881a400Schristos
4167*6881a400Schristos	    cat <<"EOF"
4168*6881a400Schristos  XFREE (target_name);
4169*6881a400Schristos  XFREE (actual_cwrapper_path);
4170*6881a400Schristos  XFREE (actual_cwrapper_name);
4171*6881a400Schristos
4172*6881a400Schristos  lt_setenv ("BIN_SH", "xpg4"); /* for Tru64 */
4173*6881a400Schristos  lt_setenv ("DUALCASE", "1");  /* for MSK sh */
4174*6881a400Schristos  lt_update_lib_path (LIB_PATH_VARNAME, LIB_PATH_VALUE);
4175*6881a400Schristos  lt_update_exe_path (EXE_PATH_VARNAME, EXE_PATH_VALUE);
4176*6881a400Schristos
4177*6881a400Schristos  newargc=0;
4178*6881a400Schristos  for (i = 1; i < argc; i++)
4179*6881a400Schristos    {
4180*6881a400Schristos      if (strncmp (argv[i], ltwrapper_option_prefix, opt_prefix_len) == 0)
4181*6881a400Schristos        {
4182*6881a400Schristos          /* however, if there is an option in the LTWRAPPER_OPTION_PREFIX
4183*6881a400Schristos             namespace, but it is not one of the ones we know about and
4184*6881a400Schristos             have already dealt with, above (inluding dump-script), then
4185*6881a400Schristos             report an error. Otherwise, targets might begin to believe
4186*6881a400Schristos             they are allowed to use options in the LTWRAPPER_OPTION_PREFIX
4187*6881a400Schristos             namespace. The first time any user complains about this, we'll
4188*6881a400Schristos             need to make LTWRAPPER_OPTION_PREFIX a configure-time option
4189*6881a400Schristos             or a configure.ac-settable value.
4190*6881a400Schristos           */
4191*6881a400Schristos          lt_fatal ("Unrecognized option in %s namespace: '%s'",
4192*6881a400Schristos                    ltwrapper_option_prefix, argv[i]);
4193*6881a400Schristos        }
4194*6881a400Schristos      /* otherwise ... */
4195*6881a400Schristos      newargz[++newargc] = xstrdup (argv[i]);
4196*6881a400Schristos    }
4197*6881a400Schristos  newargz[++newargc] = NULL;
4198*6881a400Schristos
4199*6881a400Schristos  LTWRAPPER_DEBUGPRINTF     (("(main) lt_argv_zero : %s\n", (lt_argv_zero ? lt_argv_zero : "<NULL>")));
4200*6881a400Schristos  for (i = 0; i < newargc; i++)
4201*6881a400Schristos    {
4202*6881a400Schristos      LTWRAPPER_DEBUGPRINTF (("(main) newargz[%d]   : %s\n", i, (newargz[i] ? newargz[i] : "<NULL>")));
4203*6881a400Schristos    }
4204*6881a400Schristos
4205*6881a400SchristosEOF
4206*6881a400Schristos
4207*6881a400Schristos	    case $host_os in
4208*6881a400Schristos	      mingw*)
4209*6881a400Schristos		cat <<"EOF"
4210*6881a400Schristos  /* execv doesn't actually work on mingw as expected on unix */
4211*6881a400Schristos  newargz = prepare_spawn (newargz);
4212*6881a400Schristos  rval = _spawnv (_P_WAIT, lt_argv_zero, (const char * const *) newargz);
4213*6881a400Schristos  if (rval == -1)
4214*6881a400Schristos    {
4215*6881a400Schristos      /* failed to start process */
4216*6881a400Schristos      LTWRAPPER_DEBUGPRINTF (("(main) failed to launch target \"%s\": errno = %d\n", lt_argv_zero, errno));
4217*6881a400Schristos      return 127;
4218*6881a400Schristos    }
4219*6881a400Schristos  return rval;
4220*6881a400SchristosEOF
4221*6881a400Schristos		;;
4222*6881a400Schristos	      *)
4223*6881a400Schristos		cat <<"EOF"
4224*6881a400Schristos  execv (lt_argv_zero, newargz);
4225*6881a400Schristos  return rval; /* =127, but avoids unused variable warning */
4226*6881a400SchristosEOF
4227*6881a400Schristos		;;
4228*6881a400Schristos	    esac
4229*6881a400Schristos
4230*6881a400Schristos	    cat <<"EOF"
4231*6881a400Schristos}
4232*6881a400Schristos
4233*6881a400Schristosvoid *
4234*6881a400Schristosxmalloc (size_t num)
4235*6881a400Schristos{
4236*6881a400Schristos  void *p = (void *) malloc (num);
4237*6881a400Schristos  if (!p)
4238*6881a400Schristos    lt_fatal ("Memory exhausted");
4239*6881a400Schristos
4240*6881a400Schristos  return p;
4241*6881a400Schristos}
4242*6881a400Schristos
4243*6881a400Schristoschar *
4244*6881a400Schristosxstrdup (const char *string)
4245*6881a400Schristos{
4246*6881a400Schristos  return string ? strcpy ((char *) xmalloc (strlen (string) + 1),
4247*6881a400Schristos			  string) : NULL;
4248*6881a400Schristos}
4249*6881a400Schristos
4250*6881a400Schristosconst char *
4251*6881a400Schristosbase_name (const char *name)
4252*6881a400Schristos{
4253*6881a400Schristos  const char *base;
4254*6881a400Schristos
4255*6881a400Schristos#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
4256*6881a400Schristos  /* Skip over the disk name in MSDOS pathnames. */
4257*6881a400Schristos  if (isalpha ((unsigned char) name[0]) && name[1] == ':')
4258*6881a400Schristos    name += 2;
4259*6881a400Schristos#endif
4260*6881a400Schristos
4261*6881a400Schristos  for (base = name; *name; name++)
4262*6881a400Schristos    if (IS_DIR_SEPARATOR (*name))
4263*6881a400Schristos      base = name + 1;
4264*6881a400Schristos  return base;
4265*6881a400Schristos}
4266*6881a400Schristos
4267*6881a400Schristosint
4268*6881a400Schristoscheck_executable (const char *path)
4269*6881a400Schristos{
4270*6881a400Schristos  struct stat st;
4271*6881a400Schristos
4272*6881a400Schristos  LTWRAPPER_DEBUGPRINTF (("(check_executable)  : %s\n",
4273*6881a400Schristos			  path ? (*path ? path : "EMPTY!") : "NULL!"));
4274*6881a400Schristos  if ((!path) || (!*path))
4275*6881a400Schristos    return 0;
4276*6881a400Schristos
4277*6881a400Schristos  if ((stat (path, &st) >= 0)
4278*6881a400Schristos      && (st.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH)))
4279*6881a400Schristos    return 1;
4280*6881a400Schristos  else
4281*6881a400Schristos    return 0;
4282*6881a400Schristos}
4283*6881a400Schristos
4284*6881a400Schristosint
4285*6881a400Schristosmake_executable (const char *path)
4286*6881a400Schristos{
4287*6881a400Schristos  int rval = 0;
4288*6881a400Schristos  struct stat st;
4289*6881a400Schristos
4290*6881a400Schristos  LTWRAPPER_DEBUGPRINTF (("(make_executable)   : %s\n",
4291*6881a400Schristos			  path ? (*path ? path : "EMPTY!") : "NULL!"));
4292*6881a400Schristos  if ((!path) || (!*path))
4293*6881a400Schristos    return 0;
4294*6881a400Schristos
4295*6881a400Schristos  if (stat (path, &st) >= 0)
4296*6881a400Schristos    {
4297*6881a400Schristos      rval = chmod (path, st.st_mode | S_IXOTH | S_IXGRP | S_IXUSR);
4298*6881a400Schristos    }
4299*6881a400Schristos  return rval;
4300*6881a400Schristos}
4301*6881a400Schristos
4302*6881a400Schristos/* Searches for the full path of the wrapper.  Returns
4303*6881a400Schristos   newly allocated full path name if found, NULL otherwise
4304*6881a400Schristos   Does not chase symlinks, even on platforms that support them.
4305*6881a400Schristos*/
4306*6881a400Schristoschar *
4307*6881a400Schristosfind_executable (const char *wrapper)
4308*6881a400Schristos{
4309*6881a400Schristos  int has_slash = 0;
4310*6881a400Schristos  const char *p;
4311*6881a400Schristos  const char *p_next;
4312*6881a400Schristos  /* static buffer for getcwd */
4313*6881a400Schristos  char tmp[LT_PATHMAX + 1];
4314*6881a400Schristos  int tmp_len;
4315*6881a400Schristos  char *concat_name;
4316*6881a400Schristos
4317*6881a400Schristos  LTWRAPPER_DEBUGPRINTF (("(find_executable)   : %s\n",
4318*6881a400Schristos			  wrapper ? (*wrapper ? wrapper : "EMPTY!") : "NULL!"));
4319*6881a400Schristos
4320*6881a400Schristos  if ((wrapper == NULL) || (*wrapper == '\0'))
4321*6881a400Schristos    return NULL;
4322*6881a400Schristos
4323*6881a400Schristos  /* Absolute path? */
4324*6881a400Schristos#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
4325*6881a400Schristos  if (isalpha ((unsigned char) wrapper[0]) && wrapper[1] == ':')
4326*6881a400Schristos    {
4327*6881a400Schristos      concat_name = xstrdup (wrapper);
4328*6881a400Schristos      if (check_executable (concat_name))
4329*6881a400Schristos	return concat_name;
4330*6881a400Schristos      XFREE (concat_name);
4331*6881a400Schristos    }
4332*6881a400Schristos  else
4333*6881a400Schristos    {
4334*6881a400Schristos#endif
4335*6881a400Schristos      if (IS_DIR_SEPARATOR (wrapper[0]))
4336*6881a400Schristos	{
4337*6881a400Schristos	  concat_name = xstrdup (wrapper);
4338*6881a400Schristos	  if (check_executable (concat_name))
4339*6881a400Schristos	    return concat_name;
4340*6881a400Schristos	  XFREE (concat_name);
4341*6881a400Schristos	}
4342*6881a400Schristos#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
4343*6881a400Schristos    }
4344*6881a400Schristos#endif
4345*6881a400Schristos
4346*6881a400Schristos  for (p = wrapper; *p; p++)
4347*6881a400Schristos    if (*p == '/')
4348*6881a400Schristos      {
4349*6881a400Schristos	has_slash = 1;
4350*6881a400Schristos	break;
4351*6881a400Schristos      }
4352*6881a400Schristos  if (!has_slash)
4353*6881a400Schristos    {
4354*6881a400Schristos      /* no slashes; search PATH */
4355*6881a400Schristos      const char *path = getenv ("PATH");
4356*6881a400Schristos      if (path != NULL)
4357*6881a400Schristos	{
4358*6881a400Schristos	  for (p = path; *p; p = p_next)
4359*6881a400Schristos	    {
4360*6881a400Schristos	      const char *q;
4361*6881a400Schristos	      size_t p_len;
4362*6881a400Schristos	      for (q = p; *q; q++)
4363*6881a400Schristos		if (IS_PATH_SEPARATOR (*q))
4364*6881a400Schristos		  break;
4365*6881a400Schristos	      p_len = q - p;
4366*6881a400Schristos	      p_next = (*q == '\0' ? q : q + 1);
4367*6881a400Schristos	      if (p_len == 0)
4368*6881a400Schristos		{
4369*6881a400Schristos		  /* empty path: current directory */
4370*6881a400Schristos		  if (getcwd (tmp, LT_PATHMAX) == NULL)
4371*6881a400Schristos		    lt_fatal ("getcwd failed");
4372*6881a400Schristos		  tmp_len = strlen (tmp);
4373*6881a400Schristos		  concat_name =
4374*6881a400Schristos		    XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1);
4375*6881a400Schristos		  memcpy (concat_name, tmp, tmp_len);
4376*6881a400Schristos		  concat_name[tmp_len] = '/';
4377*6881a400Schristos		  strcpy (concat_name + tmp_len + 1, wrapper);
4378*6881a400Schristos		}
4379*6881a400Schristos	      else
4380*6881a400Schristos		{
4381*6881a400Schristos		  concat_name =
4382*6881a400Schristos		    XMALLOC (char, p_len + 1 + strlen (wrapper) + 1);
4383*6881a400Schristos		  memcpy (concat_name, p, p_len);
4384*6881a400Schristos		  concat_name[p_len] = '/';
4385*6881a400Schristos		  strcpy (concat_name + p_len + 1, wrapper);
4386*6881a400Schristos		}
4387*6881a400Schristos	      if (check_executable (concat_name))
4388*6881a400Schristos		return concat_name;
4389*6881a400Schristos	      XFREE (concat_name);
4390*6881a400Schristos	    }
4391*6881a400Schristos	}
4392*6881a400Schristos      /* not found in PATH; assume curdir */
4393*6881a400Schristos    }
4394*6881a400Schristos  /* Relative path | not found in path: prepend cwd */
4395*6881a400Schristos  if (getcwd (tmp, LT_PATHMAX) == NULL)
4396*6881a400Schristos    lt_fatal ("getcwd failed");
4397*6881a400Schristos  tmp_len = strlen (tmp);
4398*6881a400Schristos  concat_name = XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1);
4399*6881a400Schristos  memcpy (concat_name, tmp, tmp_len);
4400*6881a400Schristos  concat_name[tmp_len] = '/';
4401*6881a400Schristos  strcpy (concat_name + tmp_len + 1, wrapper);
4402*6881a400Schristos
4403*6881a400Schristos  if (check_executable (concat_name))
4404*6881a400Schristos    return concat_name;
4405*6881a400Schristos  XFREE (concat_name);
4406*6881a400Schristos  return NULL;
4407*6881a400Schristos}
4408*6881a400Schristos
4409*6881a400Schristoschar *
4410*6881a400Schristoschase_symlinks (const char *pathspec)
4411*6881a400Schristos{
4412*6881a400Schristos#ifndef S_ISLNK
4413*6881a400Schristos  return xstrdup (pathspec);
4414*6881a400Schristos#else
4415*6881a400Schristos  char buf[LT_PATHMAX];
4416*6881a400Schristos  struct stat s;
4417*6881a400Schristos  char *tmp_pathspec = xstrdup (pathspec);
4418*6881a400Schristos  char *p;
4419*6881a400Schristos  int has_symlinks = 0;
4420*6881a400Schristos  while (strlen (tmp_pathspec) && !has_symlinks)
4421*6881a400Schristos    {
4422*6881a400Schristos      LTWRAPPER_DEBUGPRINTF (("checking path component for symlinks: %s\n",
4423*6881a400Schristos			      tmp_pathspec));
4424*6881a400Schristos      if (lstat (tmp_pathspec, &s) == 0)
4425*6881a400Schristos	{
4426*6881a400Schristos	  if (S_ISLNK (s.st_mode) != 0)
4427*6881a400Schristos	    {
4428*6881a400Schristos	      has_symlinks = 1;
4429*6881a400Schristos	      break;
4430*6881a400Schristos	    }
4431*6881a400Schristos
4432*6881a400Schristos	  /* search backwards for last DIR_SEPARATOR */
4433*6881a400Schristos	  p = tmp_pathspec + strlen (tmp_pathspec) - 1;
4434*6881a400Schristos	  while ((p > tmp_pathspec) && (!IS_DIR_SEPARATOR (*p)))
4435*6881a400Schristos	    p--;
4436*6881a400Schristos	  if ((p == tmp_pathspec) && (!IS_DIR_SEPARATOR (*p)))
4437*6881a400Schristos	    {
4438*6881a400Schristos	      /* no more DIR_SEPARATORS left */
4439*6881a400Schristos	      break;
4440*6881a400Schristos	    }
4441*6881a400Schristos	  *p = '\0';
4442*6881a400Schristos	}
4443*6881a400Schristos      else
4444*6881a400Schristos	{
4445*6881a400Schristos	  char *errstr = strerror (errno);
4446*6881a400Schristos	  lt_fatal ("Error accessing file %s (%s)", tmp_pathspec, errstr);
4447*6881a400Schristos	}
4448*6881a400Schristos    }
4449*6881a400Schristos  XFREE (tmp_pathspec);
4450*6881a400Schristos
4451*6881a400Schristos  if (!has_symlinks)
4452*6881a400Schristos    {
4453*6881a400Schristos      return xstrdup (pathspec);
4454*6881a400Schristos    }
4455*6881a400Schristos
4456*6881a400Schristos  tmp_pathspec = realpath (pathspec, buf);
4457*6881a400Schristos  if (tmp_pathspec == 0)
4458*6881a400Schristos    {
4459*6881a400Schristos      lt_fatal ("Could not follow symlinks for %s", pathspec);
4460*6881a400Schristos    }
4461*6881a400Schristos  return xstrdup (tmp_pathspec);
4462*6881a400Schristos#endif
4463*6881a400Schristos}
4464*6881a400Schristos
4465*6881a400Schristoschar *
4466*6881a400Schristosstrendzap (char *str, const char *pat)
4467*6881a400Schristos{
4468*6881a400Schristos  size_t len, patlen;
4469*6881a400Schristos
4470*6881a400Schristos  assert (str != NULL);
4471*6881a400Schristos  assert (pat != NULL);
4472*6881a400Schristos
4473*6881a400Schristos  len = strlen (str);
4474*6881a400Schristos  patlen = strlen (pat);
4475*6881a400Schristos
4476*6881a400Schristos  if (patlen <= len)
4477*6881a400Schristos    {
4478*6881a400Schristos      str += len - patlen;
4479*6881a400Schristos      if (strcmp (str, pat) == 0)
4480*6881a400Schristos	*str = '\0';
4481*6881a400Schristos    }
4482*6881a400Schristos  return str;
4483*6881a400Schristos}
4484*6881a400Schristos
4485*6881a400Schristosstatic void
4486*6881a400Schristoslt_error_core (int exit_status, const char *mode,
4487*6881a400Schristos	       const char *message, va_list ap)
4488*6881a400Schristos{
4489*6881a400Schristos  fprintf (stderr, "%s: %s: ", program_name, mode);
4490*6881a400Schristos  vfprintf (stderr, message, ap);
4491*6881a400Schristos  fprintf (stderr, ".\n");
4492*6881a400Schristos
4493*6881a400Schristos  if (exit_status >= 0)
4494*6881a400Schristos    exit (exit_status);
4495*6881a400Schristos}
4496*6881a400Schristos
4497*6881a400Schristosvoid
4498*6881a400Schristoslt_fatal (const char *message, ...)
4499*6881a400Schristos{
4500*6881a400Schristos  va_list ap;
4501*6881a400Schristos  va_start (ap, message);
4502*6881a400Schristos  lt_error_core (EXIT_FAILURE, "FATAL", message, ap);
4503*6881a400Schristos  va_end (ap);
4504*6881a400Schristos}
4505*6881a400Schristos
4506*6881a400Schristosvoid
4507*6881a400Schristoslt_setenv (const char *name, const char *value)
4508*6881a400Schristos{
4509*6881a400Schristos  LTWRAPPER_DEBUGPRINTF (("(lt_setenv) setting '%s' to '%s'\n",
4510*6881a400Schristos                          (name ? name : "<NULL>"),
4511*6881a400Schristos                          (value ? value : "<NULL>")));
4512*6881a400Schristos  {
4513*6881a400Schristos#ifdef HAVE_SETENV
4514*6881a400Schristos    /* always make a copy, for consistency with !HAVE_SETENV */
4515*6881a400Schristos    char *str = xstrdup (value);
4516*6881a400Schristos    setenv (name, str, 1);
4517*6881a400Schristos#else
4518*6881a400Schristos    int len = strlen (name) + 1 + strlen (value) + 1;
4519*6881a400Schristos    char *str = XMALLOC (char, len);
4520*6881a400Schristos    sprintf (str, "%s=%s", name, value);
4521*6881a400Schristos    if (putenv (str) != EXIT_SUCCESS)
4522*6881a400Schristos      {
4523*6881a400Schristos        XFREE (str);
4524*6881a400Schristos      }
4525*6881a400Schristos#endif
4526*6881a400Schristos  }
4527*6881a400Schristos}
4528*6881a400Schristos
4529*6881a400Schristoschar *
4530*6881a400Schristoslt_extend_str (const char *orig_value, const char *add, int to_end)
4531*6881a400Schristos{
4532*6881a400Schristos  char *new_value;
4533*6881a400Schristos  if (orig_value && *orig_value)
4534*6881a400Schristos    {
4535*6881a400Schristos      int orig_value_len = strlen (orig_value);
4536*6881a400Schristos      int add_len = strlen (add);
4537*6881a400Schristos      new_value = XMALLOC (char, add_len + orig_value_len + 1);
4538*6881a400Schristos      if (to_end)
4539*6881a400Schristos        {
4540*6881a400Schristos          strcpy (new_value, orig_value);
4541*6881a400Schristos          strcpy (new_value + orig_value_len, add);
4542*6881a400Schristos        }
4543*6881a400Schristos      else
4544*6881a400Schristos        {
4545*6881a400Schristos          strcpy (new_value, add);
4546*6881a400Schristos          strcpy (new_value + add_len, orig_value);
4547*6881a400Schristos        }
4548*6881a400Schristos    }
4549*6881a400Schristos  else
4550*6881a400Schristos    {
4551*6881a400Schristos      new_value = xstrdup (add);
4552*6881a400Schristos    }
4553*6881a400Schristos  return new_value;
4554*6881a400Schristos}
4555*6881a400Schristos
4556*6881a400Schristosvoid
4557*6881a400Schristoslt_update_exe_path (const char *name, const char *value)
4558*6881a400Schristos{
4559*6881a400Schristos  LTWRAPPER_DEBUGPRINTF (("(lt_update_exe_path) modifying '%s' by prepending '%s'\n",
4560*6881a400Schristos                          (name ? name : "<NULL>"),
4561*6881a400Schristos                          (value ? value : "<NULL>")));
4562*6881a400Schristos
4563*6881a400Schristos  if (name && *name && value && *value)
4564*6881a400Schristos    {
4565*6881a400Schristos      char *new_value = lt_extend_str (getenv (name), value, 0);
4566*6881a400Schristos      /* some systems can't cope with a ':'-terminated path #' */
4567*6881a400Schristos      int len = strlen (new_value);
4568*6881a400Schristos      while (((len = strlen (new_value)) > 0) && IS_PATH_SEPARATOR (new_value[len-1]))
4569*6881a400Schristos        {
4570*6881a400Schristos          new_value[len-1] = '\0';
4571*6881a400Schristos        }
4572*6881a400Schristos      lt_setenv (name, new_value);
4573*6881a400Schristos      XFREE (new_value);
4574*6881a400Schristos    }
4575*6881a400Schristos}
4576*6881a400Schristos
4577*6881a400Schristosvoid
4578*6881a400Schristoslt_update_lib_path (const char *name, const char *value)
4579*6881a400Schristos{
4580*6881a400Schristos  LTWRAPPER_DEBUGPRINTF (("(lt_update_lib_path) modifying '%s' by prepending '%s'\n",
4581*6881a400Schristos                          (name ? name : "<NULL>"),
4582*6881a400Schristos                          (value ? value : "<NULL>")));
4583*6881a400Schristos
4584*6881a400Schristos  if (name && *name && value && *value)
4585*6881a400Schristos    {
4586*6881a400Schristos      char *new_value = lt_extend_str (getenv (name), value, 0);
4587*6881a400Schristos      lt_setenv (name, new_value);
4588*6881a400Schristos      XFREE (new_value);
4589*6881a400Schristos    }
4590*6881a400Schristos}
4591*6881a400Schristos
4592*6881a400SchristosEOF
4593*6881a400Schristos	    case $host_os in
4594*6881a400Schristos	      mingw*)
4595*6881a400Schristos		cat <<"EOF"
4596*6881a400Schristos
4597*6881a400Schristos/* Prepares an argument vector before calling spawn().
4598*6881a400Schristos   Note that spawn() does not by itself call the command interpreter
4599*6881a400Schristos     (getenv ("COMSPEC") != NULL ? getenv ("COMSPEC") :
4600*6881a400Schristos      ({ OSVERSIONINFO v; v.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
4601*6881a400Schristos         GetVersionEx(&v);
4602*6881a400Schristos         v.dwPlatformId == VER_PLATFORM_WIN32_NT;
4603*6881a400Schristos      }) ? "cmd.exe" : "command.com").
4604*6881a400Schristos   Instead it simply concatenates the arguments, separated by ' ', and calls
4605*6881a400Schristos   CreateProcess().  We must quote the arguments since Win32 CreateProcess()
4606*6881a400Schristos   interprets characters like ' ', '\t', '\\', '"' (but not '<' and '>') in a
4607*6881a400Schristos   special way:
4608*6881a400Schristos   - Space and tab are interpreted as delimiters. They are not treated as
4609*6881a400Schristos     delimiters if they are surrounded by double quotes: "...".
4610*6881a400Schristos   - Unescaped double quotes are removed from the input. Their only effect is
4611*6881a400Schristos     that within double quotes, space and tab are treated like normal
4612*6881a400Schristos     characters.
4613*6881a400Schristos   - Backslashes not followed by double quotes are not special.
4614*6881a400Schristos   - But 2*n+1 backslashes followed by a double quote become
4615*6881a400Schristos     n backslashes followed by a double quote (n >= 0):
4616*6881a400Schristos       \" -> "
4617*6881a400Schristos       \\\" -> \"
4618*6881a400Schristos       \\\\\" -> \\"
4619*6881a400Schristos */
4620*6881a400Schristos#define SHELL_SPECIAL_CHARS "\"\\ \001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037"
4621*6881a400Schristos#define SHELL_SPACE_CHARS " \001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037"
4622*6881a400Schristoschar **
4623*6881a400Schristosprepare_spawn (char **argv)
4624*6881a400Schristos{
4625*6881a400Schristos  size_t argc;
4626*6881a400Schristos  char **new_argv;
4627*6881a400Schristos  size_t i;
4628*6881a400Schristos
4629*6881a400Schristos  /* Count number of arguments.  */
4630*6881a400Schristos  for (argc = 0; argv[argc] != NULL; argc++)
4631*6881a400Schristos    ;
4632*6881a400Schristos
4633*6881a400Schristos  /* Allocate new argument vector.  */
4634*6881a400Schristos  new_argv = XMALLOC (char *, argc + 1);
4635*6881a400Schristos
4636*6881a400Schristos  /* Put quoted arguments into the new argument vector.  */
4637*6881a400Schristos  for (i = 0; i < argc; i++)
4638*6881a400Schristos    {
4639*6881a400Schristos      const char *string = argv[i];
4640*6881a400Schristos
4641*6881a400Schristos      if (string[0] == '\0')
4642*6881a400Schristos	new_argv[i] = xstrdup ("\"\"");
4643*6881a400Schristos      else if (strpbrk (string, SHELL_SPECIAL_CHARS) != NULL)
4644*6881a400Schristos	{
4645*6881a400Schristos	  int quote_around = (strpbrk (string, SHELL_SPACE_CHARS) != NULL);
4646*6881a400Schristos	  size_t length;
4647*6881a400Schristos	  unsigned int backslashes;
4648*6881a400Schristos	  const char *s;
4649*6881a400Schristos	  char *quoted_string;
4650*6881a400Schristos	  char *p;
4651*6881a400Schristos
4652*6881a400Schristos	  length = 0;
4653*6881a400Schristos	  backslashes = 0;
4654*6881a400Schristos	  if (quote_around)
4655*6881a400Schristos	    length++;
4656*6881a400Schristos	  for (s = string; *s != '\0'; s++)
4657*6881a400Schristos	    {
4658*6881a400Schristos	      char c = *s;
4659*6881a400Schristos	      if (c == '"')
4660*6881a400Schristos		length += backslashes + 1;
4661*6881a400Schristos	      length++;
4662*6881a400Schristos	      if (c == '\\')
4663*6881a400Schristos		backslashes++;
4664*6881a400Schristos	      else
4665*6881a400Schristos		backslashes = 0;
4666*6881a400Schristos	    }
4667*6881a400Schristos	  if (quote_around)
4668*6881a400Schristos	    length += backslashes + 1;
4669*6881a400Schristos
4670*6881a400Schristos	  quoted_string = XMALLOC (char, length + 1);
4671*6881a400Schristos
4672*6881a400Schristos	  p = quoted_string;
4673*6881a400Schristos	  backslashes = 0;
4674*6881a400Schristos	  if (quote_around)
4675*6881a400Schristos	    *p++ = '"';
4676*6881a400Schristos	  for (s = string; *s != '\0'; s++)
4677*6881a400Schristos	    {
4678*6881a400Schristos	      char c = *s;
4679*6881a400Schristos	      if (c == '"')
4680*6881a400Schristos		{
4681*6881a400Schristos		  unsigned int j;
4682*6881a400Schristos		  for (j = backslashes + 1; j > 0; j--)
4683*6881a400Schristos		    *p++ = '\\';
4684*6881a400Schristos		}
4685*6881a400Schristos	      *p++ = c;
4686*6881a400Schristos	      if (c == '\\')
4687*6881a400Schristos		backslashes++;
4688*6881a400Schristos	      else
4689*6881a400Schristos		backslashes = 0;
4690*6881a400Schristos	    }
4691*6881a400Schristos	  if (quote_around)
4692*6881a400Schristos	    {
4693*6881a400Schristos	      unsigned int j;
4694*6881a400Schristos	      for (j = backslashes; j > 0; j--)
4695*6881a400Schristos		*p++ = '\\';
4696*6881a400Schristos	      *p++ = '"';
4697*6881a400Schristos	    }
4698*6881a400Schristos	  *p = '\0';
4699*6881a400Schristos
4700*6881a400Schristos	  new_argv[i] = quoted_string;
4701*6881a400Schristos	}
4702*6881a400Schristos      else
4703*6881a400Schristos	new_argv[i] = (char *) string;
4704*6881a400Schristos    }
4705*6881a400Schristos  new_argv[argc] = NULL;
4706*6881a400Schristos
4707*6881a400Schristos  return new_argv;
4708*6881a400Schristos}
4709*6881a400SchristosEOF
4710*6881a400Schristos		;;
4711*6881a400Schristos	    esac
4712*6881a400Schristos
4713*6881a400Schristos            cat <<"EOF"
4714*6881a400Schristosvoid lt_dump_script (FILE* f)
4715*6881a400Schristos{
4716*6881a400SchristosEOF
4717*6881a400Schristos	    func_emit_wrapper yes |
4718*6881a400Schristos              $SED -e 's/\([\\"]\)/\\\1/g' \
4719*6881a400Schristos	           -e 's/^/  fputs ("/' -e 's/$/\\n", f);/'
4720*6881a400Schristos
4721*6881a400Schristos            cat <<"EOF"
4722*6881a400Schristos}
4723*6881a400SchristosEOF
4724*6881a400Schristos}
4725*6881a400Schristos# end: func_emit_cwrapperexe_src
4726*6881a400Schristos
4727*6881a400Schristos# func_win32_import_lib_p ARG
4728*6881a400Schristos# True if ARG is an import lib, as indicated by $file_magic_cmd
4729*6881a400Schristosfunc_win32_import_lib_p ()
4730*6881a400Schristos{
4731*6881a400Schristos    $opt_debug
4732*6881a400Schristos    case `eval "$file_magic_cmd \"\$1\" 2>/dev/null" | $SED -e 10q` in
4733*6881a400Schristos    *import*) : ;;
4734*6881a400Schristos    *) false ;;
4735*6881a400Schristos    esac
4736*6881a400Schristos}
4737*6881a400Schristos
4738*6881a400Schristos# func_mode_link arg...
4739*6881a400Schristosfunc_mode_link ()
4740*6881a400Schristos{
4741*6881a400Schristos    $opt_debug
4742*6881a400Schristos    case $host in
4743*6881a400Schristos    *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
4744*6881a400Schristos      # It is impossible to link a dll without this setting, and
4745*6881a400Schristos      # we shouldn't force the makefile maintainer to figure out
4746*6881a400Schristos      # which system we are compiling for in order to pass an extra
4747*6881a400Schristos      # flag for every libtool invocation.
4748*6881a400Schristos      # allow_undefined=no
4749*6881a400Schristos
4750*6881a400Schristos      # FIXME: Unfortunately, there are problems with the above when trying
4751*6881a400Schristos      # to make a dll which has undefined symbols, in which case not
4752*6881a400Schristos      # even a static library is built.  For now, we need to specify
4753*6881a400Schristos      # -no-undefined on the libtool link line when we can be certain
4754*6881a400Schristos      # that all symbols are satisfied, otherwise we get a static library.
4755*6881a400Schristos      allow_undefined=yes
4756*6881a400Schristos      ;;
4757*6881a400Schristos    *)
4758*6881a400Schristos      allow_undefined=yes
4759*6881a400Schristos      ;;
4760*6881a400Schristos    esac
4761*6881a400Schristos    libtool_args=$nonopt
4762*6881a400Schristos    base_compile="$nonopt $@"
4763*6881a400Schristos    compile_command=$nonopt
4764*6881a400Schristos    finalize_command=$nonopt
4765*6881a400Schristos
4766*6881a400Schristos    compile_rpath=
4767*6881a400Schristos    finalize_rpath=
4768*6881a400Schristos    compile_shlibpath=
4769*6881a400Schristos    finalize_shlibpath=
4770*6881a400Schristos    convenience=
4771*6881a400Schristos    old_convenience=
4772*6881a400Schristos    deplibs=
4773*6881a400Schristos    old_deplibs=
4774*6881a400Schristos    compiler_flags=
4775*6881a400Schristos    linker_flags=
4776*6881a400Schristos    dllsearchpath=
4777*6881a400Schristos    lib_search_path=`pwd`
4778*6881a400Schristos    inst_prefix_dir=
4779*6881a400Schristos    new_inherited_linker_flags=
4780*6881a400Schristos
4781*6881a400Schristos    avoid_version=no
4782*6881a400Schristos    bindir=
4783*6881a400Schristos    dlfiles=
4784*6881a400Schristos    dlprefiles=
4785*6881a400Schristos    dlself=no
4786*6881a400Schristos    export_dynamic=no
4787*6881a400Schristos    export_symbols=
4788*6881a400Schristos    export_symbols_regex=
4789*6881a400Schristos    generated=
4790*6881a400Schristos    libobjs=
4791*6881a400Schristos    ltlibs=
4792*6881a400Schristos    module=no
4793*6881a400Schristos    no_install=no
4794*6881a400Schristos    objs=
4795*6881a400Schristos    non_pic_objects=
4796*6881a400Schristos    precious_files_regex=
4797*6881a400Schristos    prefer_static_libs=no
4798*6881a400Schristos    preload=no
4799*6881a400Schristos    prev=
4800*6881a400Schristos    prevarg=
4801*6881a400Schristos    release=
4802*6881a400Schristos    rpath=
4803*6881a400Schristos    xrpath=
4804*6881a400Schristos    perm_rpath=
4805*6881a400Schristos    temp_rpath=
4806*6881a400Schristos    thread_safe=no
4807*6881a400Schristos    vinfo=
4808*6881a400Schristos    vinfo_number=no
4809*6881a400Schristos    weak_libs=
4810*6881a400Schristos    single_module="${wl}-single_module"
4811*6881a400Schristos    func_infer_tag $base_compile
4812*6881a400Schristos
4813*6881a400Schristos    # We need to know -static, to get the right output filenames.
4814*6881a400Schristos    for arg
4815*6881a400Schristos    do
4816*6881a400Schristos      case $arg in
4817*6881a400Schristos      -shared)
4818*6881a400Schristos	test "$build_libtool_libs" != yes && \
4819*6881a400Schristos	  func_fatal_configuration "can not build a shared library"
4820*6881a400Schristos	build_old_libs=no
4821*6881a400Schristos	break
4822*6881a400Schristos	;;
4823*6881a400Schristos      -all-static | -static | -static-libtool-libs)
4824*6881a400Schristos	case $arg in
4825*6881a400Schristos	-all-static)
4826*6881a400Schristos	  if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then
4827*6881a400Schristos	    func_warning "complete static linking is impossible in this configuration"
4828*6881a400Schristos	  fi
4829*6881a400Schristos	  if test -n "$link_static_flag"; then
4830*6881a400Schristos	    dlopen_self=$dlopen_self_static
4831*6881a400Schristos	  fi
4832*6881a400Schristos	  prefer_static_libs=yes
4833*6881a400Schristos	  ;;
4834*6881a400Schristos	-static)
4835*6881a400Schristos	  if test -z "$pic_flag" && test -n "$link_static_flag"; then
4836*6881a400Schristos	    dlopen_self=$dlopen_self_static
4837*6881a400Schristos	  fi
4838*6881a400Schristos	  prefer_static_libs=built
4839*6881a400Schristos	  ;;
4840*6881a400Schristos	-static-libtool-libs)
4841*6881a400Schristos	  if test -z "$pic_flag" && test -n "$link_static_flag"; then
4842*6881a400Schristos	    dlopen_self=$dlopen_self_static
4843*6881a400Schristos	  fi
4844*6881a400Schristos	  prefer_static_libs=yes
4845*6881a400Schristos	  ;;
4846*6881a400Schristos	esac
4847*6881a400Schristos	build_libtool_libs=no
4848*6881a400Schristos	build_old_libs=yes
4849*6881a400Schristos	break
4850*6881a400Schristos	;;
4851*6881a400Schristos      esac
4852*6881a400Schristos    done
4853*6881a400Schristos
4854*6881a400Schristos    # See if our shared archives depend on static archives.
4855*6881a400Schristos    test -n "$old_archive_from_new_cmds" && build_old_libs=yes
4856*6881a400Schristos
4857*6881a400Schristos    # Go through the arguments, transforming them on the way.
4858*6881a400Schristos    while test "$#" -gt 0; do
4859*6881a400Schristos      arg="$1"
4860*6881a400Schristos      shift
4861*6881a400Schristos      func_quote_for_eval "$arg"
4862*6881a400Schristos      qarg=$func_quote_for_eval_unquoted_result
4863*6881a400Schristos      func_append libtool_args " $func_quote_for_eval_result"
4864*6881a400Schristos
4865*6881a400Schristos      # If the previous option needs an argument, assign it.
4866*6881a400Schristos      if test -n "$prev"; then
4867*6881a400Schristos	case $prev in
4868*6881a400Schristos	output)
4869*6881a400Schristos	  func_append compile_command " @OUTPUT@"
4870*6881a400Schristos	  func_append finalize_command " @OUTPUT@"
4871*6881a400Schristos	  ;;
4872*6881a400Schristos	esac
4873*6881a400Schristos
4874*6881a400Schristos	case $prev in
4875*6881a400Schristos	bindir)
4876*6881a400Schristos	  bindir="$arg"
4877*6881a400Schristos	  prev=
4878*6881a400Schristos	  continue
4879*6881a400Schristos	  ;;
4880*6881a400Schristos	dlfiles|dlprefiles)
4881*6881a400Schristos	  if test "$preload" = no; then
4882*6881a400Schristos	    # Add the symbol object into the linking commands.
4883*6881a400Schristos	    func_append compile_command " @SYMFILE@"
4884*6881a400Schristos	    func_append finalize_command " @SYMFILE@"
4885*6881a400Schristos	    preload=yes
4886*6881a400Schristos	  fi
4887*6881a400Schristos	  case $arg in
4888*6881a400Schristos	  *.la | *.lo) ;;  # We handle these cases below.
4889*6881a400Schristos	  force)
4890*6881a400Schristos	    if test "$dlself" = no; then
4891*6881a400Schristos	      dlself=needless
4892*6881a400Schristos	      export_dynamic=yes
4893*6881a400Schristos	    fi
4894*6881a400Schristos	    prev=
4895*6881a400Schristos	    continue
4896*6881a400Schristos	    ;;
4897*6881a400Schristos	  self)
4898*6881a400Schristos	    if test "$prev" = dlprefiles; then
4899*6881a400Schristos	      dlself=yes
4900*6881a400Schristos	    elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then
4901*6881a400Schristos	      dlself=yes
4902*6881a400Schristos	    else
4903*6881a400Schristos	      dlself=needless
4904*6881a400Schristos	      export_dynamic=yes
4905*6881a400Schristos	    fi
4906*6881a400Schristos	    prev=
4907*6881a400Schristos	    continue
4908*6881a400Schristos	    ;;
4909*6881a400Schristos	  *)
4910*6881a400Schristos	    if test "$prev" = dlfiles; then
4911*6881a400Schristos	      dlfiles="$dlfiles $arg"
4912*6881a400Schristos	    else
4913*6881a400Schristos	      dlprefiles="$dlprefiles $arg"
4914*6881a400Schristos	    fi
4915*6881a400Schristos	    prev=
4916*6881a400Schristos	    continue
4917*6881a400Schristos	    ;;
4918*6881a400Schristos	  esac
4919*6881a400Schristos	  ;;
4920*6881a400Schristos	expsyms)
4921*6881a400Schristos	  export_symbols="$arg"
4922*6881a400Schristos	  test -f "$arg" \
4923*6881a400Schristos	    || func_fatal_error "symbol file \`$arg' does not exist"
4924*6881a400Schristos	  prev=
4925*6881a400Schristos	  continue
4926*6881a400Schristos	  ;;
4927*6881a400Schristos	expsyms_regex)
4928*6881a400Schristos	  export_symbols_regex="$arg"
4929*6881a400Schristos	  prev=
4930*6881a400Schristos	  continue
4931*6881a400Schristos	  ;;
4932*6881a400Schristos	framework)
4933*6881a400Schristos	  case $host in
4934*6881a400Schristos	    *-*-darwin*)
4935*6881a400Schristos	      case "$deplibs " in
4936*6881a400Schristos		*" $qarg.ltframework "*) ;;
4937*6881a400Schristos		*) deplibs="$deplibs $qarg.ltframework" # this is fixed later
4938*6881a400Schristos		   ;;
4939*6881a400Schristos	      esac
4940*6881a400Schristos	      ;;
4941*6881a400Schristos	  esac
4942*6881a400Schristos	  prev=
4943*6881a400Schristos	  continue
4944*6881a400Schristos	  ;;
4945*6881a400Schristos	inst_prefix)
4946*6881a400Schristos	  inst_prefix_dir="$arg"
4947*6881a400Schristos	  prev=
4948*6881a400Schristos	  continue
4949*6881a400Schristos	  ;;
4950*6881a400Schristos	objectlist)
4951*6881a400Schristos	  if test -f "$arg"; then
4952*6881a400Schristos	    save_arg=$arg
4953*6881a400Schristos	    moreargs=
4954*6881a400Schristos	    for fil in `cat "$save_arg"`
4955*6881a400Schristos	    do
4956*6881a400Schristos#	      moreargs="$moreargs $fil"
4957*6881a400Schristos	      arg=$fil
4958*6881a400Schristos	      # A libtool-controlled object.
4959*6881a400Schristos
4960*6881a400Schristos	      # Check to see that this really is a libtool object.
4961*6881a400Schristos	      if func_lalib_unsafe_p "$arg"; then
4962*6881a400Schristos		pic_object=
4963*6881a400Schristos		non_pic_object=
4964*6881a400Schristos
4965*6881a400Schristos		# Read the .lo file
4966*6881a400Schristos		func_source "$arg"
4967*6881a400Schristos
4968*6881a400Schristos		if test -z "$pic_object" ||
4969*6881a400Schristos		   test -z "$non_pic_object" ||
4970*6881a400Schristos		   test "$pic_object" = none &&
4971*6881a400Schristos		   test "$non_pic_object" = none; then
4972*6881a400Schristos		  func_fatal_error "cannot find name of object for \`$arg'"
4973*6881a400Schristos		fi
4974*6881a400Schristos
4975*6881a400Schristos		# Extract subdirectory from the argument.
4976*6881a400Schristos		func_dirname "$arg" "/" ""
4977*6881a400Schristos		xdir="$func_dirname_result"
4978*6881a400Schristos
4979*6881a400Schristos		if test "$pic_object" != none; then
4980*6881a400Schristos		  # Prepend the subdirectory the object is found in.
4981*6881a400Schristos		  pic_object="$xdir$pic_object"
4982*6881a400Schristos
4983*6881a400Schristos		  if test "$prev" = dlfiles; then
4984*6881a400Schristos		    if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
4985*6881a400Schristos		      dlfiles="$dlfiles $pic_object"
4986*6881a400Schristos		      prev=
4987*6881a400Schristos		      continue
4988*6881a400Schristos		    else
4989*6881a400Schristos		      # If libtool objects are unsupported, then we need to preload.
4990*6881a400Schristos		      prev=dlprefiles
4991*6881a400Schristos		    fi
4992*6881a400Schristos		  fi
4993*6881a400Schristos
4994*6881a400Schristos		  # CHECK ME:  I think I busted this.  -Ossama
4995*6881a400Schristos		  if test "$prev" = dlprefiles; then
4996*6881a400Schristos		    # Preload the old-style object.
4997*6881a400Schristos		    dlprefiles="$dlprefiles $pic_object"
4998*6881a400Schristos		    prev=
4999*6881a400Schristos		  fi
5000*6881a400Schristos
5001*6881a400Schristos		  # A PIC object.
5002*6881a400Schristos		  func_append libobjs " $pic_object"
5003*6881a400Schristos		  arg="$pic_object"
5004*6881a400Schristos		fi
5005*6881a400Schristos
5006*6881a400Schristos		# Non-PIC object.
5007*6881a400Schristos		if test "$non_pic_object" != none; then
5008*6881a400Schristos		  # Prepend the subdirectory the object is found in.
5009*6881a400Schristos		  non_pic_object="$xdir$non_pic_object"
5010*6881a400Schristos
5011*6881a400Schristos		  # A standard non-PIC object
5012*6881a400Schristos		  func_append non_pic_objects " $non_pic_object"
5013*6881a400Schristos		  if test -z "$pic_object" || test "$pic_object" = none ; then
5014*6881a400Schristos		    arg="$non_pic_object"
5015*6881a400Schristos		  fi
5016*6881a400Schristos		else
5017*6881a400Schristos		  # If the PIC object exists, use it instead.
5018*6881a400Schristos		  # $xdir was prepended to $pic_object above.
5019*6881a400Schristos		  non_pic_object="$pic_object"
5020*6881a400Schristos		  func_append non_pic_objects " $non_pic_object"
5021*6881a400Schristos		fi
5022*6881a400Schristos	      else
5023*6881a400Schristos		# Only an error if not doing a dry-run.
5024*6881a400Schristos		if $opt_dry_run; then
5025*6881a400Schristos		  # Extract subdirectory from the argument.
5026*6881a400Schristos		  func_dirname "$arg" "/" ""
5027*6881a400Schristos		  xdir="$func_dirname_result"
5028*6881a400Schristos
5029*6881a400Schristos		  func_lo2o "$arg"
5030*6881a400Schristos		  pic_object=$xdir$objdir/$func_lo2o_result
5031*6881a400Schristos		  non_pic_object=$xdir$func_lo2o_result
5032*6881a400Schristos		  func_append libobjs " $pic_object"
5033*6881a400Schristos		  func_append non_pic_objects " $non_pic_object"
5034*6881a400Schristos	        else
5035*6881a400Schristos		  func_fatal_error "\`$arg' is not a valid libtool object"
5036*6881a400Schristos		fi
5037*6881a400Schristos	      fi
5038*6881a400Schristos	    done
5039*6881a400Schristos	  else
5040*6881a400Schristos	    func_fatal_error "link input file \`$arg' does not exist"
5041*6881a400Schristos	  fi
5042*6881a400Schristos	  arg=$save_arg
5043*6881a400Schristos	  prev=
5044*6881a400Schristos	  continue
5045*6881a400Schristos	  ;;
5046*6881a400Schristos	precious_regex)
5047*6881a400Schristos	  precious_files_regex="$arg"
5048*6881a400Schristos	  prev=
5049*6881a400Schristos	  continue
5050*6881a400Schristos	  ;;
5051*6881a400Schristos	release)
5052*6881a400Schristos	  release="-$arg"
5053*6881a400Schristos	  prev=
5054*6881a400Schristos	  continue
5055*6881a400Schristos	  ;;
5056*6881a400Schristos	rpath | xrpath)
5057*6881a400Schristos	  # We need an absolute path.
5058*6881a400Schristos	  case $arg in
5059*6881a400Schristos	  [\\/]* | [A-Za-z]:[\\/]*) ;;
5060*6881a400Schristos	  *)
5061*6881a400Schristos	    func_fatal_error "only absolute run-paths are allowed"
5062*6881a400Schristos	    ;;
5063*6881a400Schristos	  esac
5064*6881a400Schristos	  if test "$prev" = rpath; then
5065*6881a400Schristos	    case "$rpath " in
5066*6881a400Schristos	    *" $arg "*) ;;
5067*6881a400Schristos	    *) rpath="$rpath $arg" ;;
5068*6881a400Schristos	    esac
5069*6881a400Schristos	  else
5070*6881a400Schristos	    case "$xrpath " in
5071*6881a400Schristos	    *" $arg "*) ;;
5072*6881a400Schristos	    *) xrpath="$xrpath $arg" ;;
5073*6881a400Schristos	    esac
5074*6881a400Schristos	  fi
5075*6881a400Schristos	  prev=
5076*6881a400Schristos	  continue
5077*6881a400Schristos	  ;;
5078*6881a400Schristos	shrext)
5079*6881a400Schristos	  shrext_cmds="$arg"
5080*6881a400Schristos	  prev=
5081*6881a400Schristos	  continue
5082*6881a400Schristos	  ;;
5083*6881a400Schristos	weak)
5084*6881a400Schristos	  weak_libs="$weak_libs $arg"
5085*6881a400Schristos	  prev=
5086*6881a400Schristos	  continue
5087*6881a400Schristos	  ;;
5088*6881a400Schristos	xcclinker)
5089*6881a400Schristos	  linker_flags="$linker_flags $qarg"
5090*6881a400Schristos	  compiler_flags="$compiler_flags $qarg"
5091*6881a400Schristos	  prev=
5092*6881a400Schristos	  func_append compile_command " $qarg"
5093*6881a400Schristos	  func_append finalize_command " $qarg"
5094*6881a400Schristos	  continue
5095*6881a400Schristos	  ;;
5096*6881a400Schristos	xcompiler)
5097*6881a400Schristos	  compiler_flags="$compiler_flags $qarg"
5098*6881a400Schristos	  prev=
5099*6881a400Schristos	  func_append compile_command " $qarg"
5100*6881a400Schristos	  func_append finalize_command " $qarg"
5101*6881a400Schristos	  continue
5102*6881a400Schristos	  ;;
5103*6881a400Schristos	xlinker)
5104*6881a400Schristos	  linker_flags="$linker_flags $qarg"
5105*6881a400Schristos	  compiler_flags="$compiler_flags $wl$qarg"
5106*6881a400Schristos	  prev=
5107*6881a400Schristos	  func_append compile_command " $wl$qarg"
5108*6881a400Schristos	  func_append finalize_command " $wl$qarg"
5109*6881a400Schristos	  continue
5110*6881a400Schristos	  ;;
5111*6881a400Schristos	*)
5112*6881a400Schristos	  eval "$prev=\"\$arg\""
5113*6881a400Schristos	  prev=
5114*6881a400Schristos	  continue
5115*6881a400Schristos	  ;;
5116*6881a400Schristos	esac
5117*6881a400Schristos      fi # test -n "$prev"
5118*6881a400Schristos
5119*6881a400Schristos      prevarg="$arg"
5120*6881a400Schristos
5121*6881a400Schristos      case $arg in
5122*6881a400Schristos      -all-static)
5123*6881a400Schristos	if test -n "$link_static_flag"; then
5124*6881a400Schristos	  # See comment for -static flag below, for more details.
5125*6881a400Schristos	  func_append compile_command " $link_static_flag"
5126*6881a400Schristos	  func_append finalize_command " $link_static_flag"
5127*6881a400Schristos	fi
5128*6881a400Schristos	continue
5129*6881a400Schristos	;;
5130*6881a400Schristos
5131*6881a400Schristos      -allow-undefined)
5132*6881a400Schristos	# FIXME: remove this flag sometime in the future.
5133*6881a400Schristos	func_fatal_error "\`-allow-undefined' must not be used because it is the default"
5134*6881a400Schristos	;;
5135*6881a400Schristos
5136*6881a400Schristos      -avoid-version)
5137*6881a400Schristos	avoid_version=yes
5138*6881a400Schristos	continue
5139*6881a400Schristos	;;
5140*6881a400Schristos
5141*6881a400Schristos      -bindir)
5142*6881a400Schristos	prev=bindir
5143*6881a400Schristos	continue
5144*6881a400Schristos	;;
5145*6881a400Schristos
5146*6881a400Schristos      -dlopen)
5147*6881a400Schristos	prev=dlfiles
5148*6881a400Schristos	continue
5149*6881a400Schristos	;;
5150*6881a400Schristos
5151*6881a400Schristos      -dlpreopen)
5152*6881a400Schristos	prev=dlprefiles
5153*6881a400Schristos	continue
5154*6881a400Schristos	;;
5155*6881a400Schristos
5156*6881a400Schristos      -export-dynamic)
5157*6881a400Schristos	export_dynamic=yes
5158*6881a400Schristos	continue
5159*6881a400Schristos	;;
5160*6881a400Schristos
5161*6881a400Schristos      -export-symbols | -export-symbols-regex)
5162*6881a400Schristos	if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
5163*6881a400Schristos	  func_fatal_error "more than one -exported-symbols argument is not allowed"
5164*6881a400Schristos	fi
5165*6881a400Schristos	if test "X$arg" = "X-export-symbols"; then
5166*6881a400Schristos	  prev=expsyms
5167*6881a400Schristos	else
5168*6881a400Schristos	  prev=expsyms_regex
5169*6881a400Schristos	fi
5170*6881a400Schristos	continue
5171*6881a400Schristos	;;
5172*6881a400Schristos
5173*6881a400Schristos      -framework)
5174*6881a400Schristos	prev=framework
5175*6881a400Schristos	continue
5176*6881a400Schristos	;;
5177*6881a400Schristos
5178*6881a400Schristos      -inst-prefix-dir)
5179*6881a400Schristos	prev=inst_prefix
5180*6881a400Schristos	continue
5181*6881a400Schristos	;;
5182*6881a400Schristos
5183*6881a400Schristos      # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:*
5184*6881a400Schristos      # so, if we see these flags be careful not to treat them like -L
5185*6881a400Schristos      -L[A-Z][A-Z]*:*)
5186*6881a400Schristos	case $with_gcc/$host in
5187*6881a400Schristos	no/*-*-irix* | /*-*-irix*)
5188*6881a400Schristos	  func_append compile_command " $arg"
5189*6881a400Schristos	  func_append finalize_command " $arg"
5190*6881a400Schristos	  ;;
5191*6881a400Schristos	esac
5192*6881a400Schristos	continue
5193*6881a400Schristos	;;
5194*6881a400Schristos
5195*6881a400Schristos      -L*)
5196*6881a400Schristos	func_stripname '-L' '' "$arg"
5197*6881a400Schristos	dir=$func_stripname_result
5198*6881a400Schristos	if test -z "$dir"; then
5199*6881a400Schristos	  if test "$#" -gt 0; then
5200*6881a400Schristos	    func_fatal_error "require no space between \`-L' and \`$1'"
5201*6881a400Schristos	  else
5202*6881a400Schristos	    func_fatal_error "need path for \`-L' option"
5203*6881a400Schristos	  fi
5204*6881a400Schristos	fi
5205*6881a400Schristos	# We need an absolute path.
5206*6881a400Schristos	case $dir in
5207*6881a400Schristos	[\\/]* | [A-Za-z]:[\\/]*) ;;
5208*6881a400Schristos	*)
5209*6881a400Schristos	  absdir=`cd "$dir" && pwd`
5210*6881a400Schristos	  test -z "$absdir" && \
5211*6881a400Schristos	    func_fatal_error "cannot determine absolute directory name of \`$dir'"
5212*6881a400Schristos	  dir="$absdir"
5213*6881a400Schristos	  ;;
5214*6881a400Schristos	esac
5215*6881a400Schristos	case "$deplibs " in
5216*6881a400Schristos	*" -L$dir "*) ;;
5217*6881a400Schristos	*)
5218*6881a400Schristos	  deplibs="$deplibs -L$dir"
5219*6881a400Schristos	  lib_search_path="$lib_search_path $dir"
5220*6881a400Schristos	  ;;
5221*6881a400Schristos	esac
5222*6881a400Schristos	case $host in
5223*6881a400Schristos	*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
5224*6881a400Schristos	  testbindir=`$ECHO "$dir" | $SED 's*/lib$*/bin*'`
5225*6881a400Schristos	  case :$dllsearchpath: in
5226*6881a400Schristos	  *":$dir:"*) ;;
5227*6881a400Schristos	  ::) dllsearchpath=$dir;;
5228*6881a400Schristos	  *) dllsearchpath="$dllsearchpath:$dir";;
5229*6881a400Schristos	  esac
5230*6881a400Schristos	  case :$dllsearchpath: in
5231*6881a400Schristos	  *":$testbindir:"*) ;;
5232*6881a400Schristos	  ::) dllsearchpath=$testbindir;;
5233*6881a400Schristos	  *) dllsearchpath="$dllsearchpath:$testbindir";;
5234*6881a400Schristos	  esac
5235*6881a400Schristos	  ;;
5236*6881a400Schristos	esac
5237*6881a400Schristos	continue
5238*6881a400Schristos	;;
5239*6881a400Schristos
5240*6881a400Schristos      -l*)
5241*6881a400Schristos	if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then
5242*6881a400Schristos	  case $host in
5243*6881a400Schristos	  *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos* | *-cegcc* | *-*-haiku*)
5244*6881a400Schristos	    # These systems don't actually have a C or math library (as such)
5245*6881a400Schristos	    continue
5246*6881a400Schristos	    ;;
5247*6881a400Schristos	  *-*-os2*)
5248*6881a400Schristos	    # These systems don't actually have a C library (as such)
5249*6881a400Schristos	    test "X$arg" = "X-lc" && continue
5250*6881a400Schristos	    ;;
5251*6881a400Schristos	  *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
5252*6881a400Schristos	    # Do not include libc due to us having libc/libc_r.
5253*6881a400Schristos	    test "X$arg" = "X-lc" && continue
5254*6881a400Schristos	    ;;
5255*6881a400Schristos	  *-*-rhapsody* | *-*-darwin1.[012])
5256*6881a400Schristos	    # Rhapsody C and math libraries are in the System framework
5257*6881a400Schristos	    deplibs="$deplibs System.ltframework"
5258*6881a400Schristos	    continue
5259*6881a400Schristos	    ;;
5260*6881a400Schristos	  *-*-sco3.2v5* | *-*-sco5v6*)
5261*6881a400Schristos	    # Causes problems with __ctype
5262*6881a400Schristos	    test "X$arg" = "X-lc" && continue
5263*6881a400Schristos	    ;;
5264*6881a400Schristos	  *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
5265*6881a400Schristos	    # Compiler inserts libc in the correct place for threads to work
5266*6881a400Schristos	    test "X$arg" = "X-lc" && continue
5267*6881a400Schristos	    ;;
5268*6881a400Schristos	  *-*-linux*)
5269*6881a400Schristos	    test "X$arg" = "X-lc" && continue
5270*6881a400Schristos	    ;;
5271*6881a400Schristos	  esac
5272*6881a400Schristos	elif test "X$arg" = "X-lc_r"; then
5273*6881a400Schristos	 case $host in
5274*6881a400Schristos	 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
5275*6881a400Schristos	   # Do not include libc_r directly, use -pthread flag.
5276*6881a400Schristos	   continue
5277*6881a400Schristos	   ;;
5278*6881a400Schristos	 esac
5279*6881a400Schristos	fi
5280*6881a400Schristos	deplibs="$deplibs $arg"
5281*6881a400Schristos	continue
5282*6881a400Schristos	;;
5283*6881a400Schristos
5284*6881a400Schristos      -module)
5285*6881a400Schristos	module=yes
5286*6881a400Schristos	continue
5287*6881a400Schristos	;;
5288*6881a400Schristos
5289*6881a400Schristos      # Tru64 UNIX uses -model [arg] to determine the layout of C++
5290*6881a400Schristos      # classes, name mangling, and exception handling.
5291*6881a400Schristos      # Darwin uses the -arch flag to determine output architecture.
5292*6881a400Schristos      -model|-arch|-isysroot)
5293*6881a400Schristos	compiler_flags="$compiler_flags $arg"
5294*6881a400Schristos	func_append compile_command " $arg"
5295*6881a400Schristos	func_append finalize_command " $arg"
5296*6881a400Schristos	prev=xcompiler
5297*6881a400Schristos	continue
5298*6881a400Schristos	;;
5299*6881a400Schristos
5300*6881a400Schristos      -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads)
5301*6881a400Schristos	compiler_flags="$compiler_flags $arg"
5302*6881a400Schristos	func_append compile_command " $arg"
5303*6881a400Schristos	func_append finalize_command " $arg"
5304*6881a400Schristos	case "$new_inherited_linker_flags " in
5305*6881a400Schristos	    *" $arg "*) ;;
5306*6881a400Schristos	    * ) new_inherited_linker_flags="$new_inherited_linker_flags $arg" ;;
5307*6881a400Schristos	esac
5308*6881a400Schristos	continue
5309*6881a400Schristos	;;
5310*6881a400Schristos
5311*6881a400Schristos      -multi_module)
5312*6881a400Schristos	single_module="${wl}-multi_module"
5313*6881a400Schristos	continue
5314*6881a400Schristos	;;
5315*6881a400Schristos
5316*6881a400Schristos      -no-fast-install)
5317*6881a400Schristos	fast_install=no
5318*6881a400Schristos	continue
5319*6881a400Schristos	;;
5320*6881a400Schristos
5321*6881a400Schristos      -no-install)
5322*6881a400Schristos	case $host in
5323*6881a400Schristos	*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin* | *-cegcc*)
5324*6881a400Schristos	  # The PATH hackery in wrapper scripts is required on Windows
5325*6881a400Schristos	  # and Darwin in order for the loader to find any dlls it needs.
5326*6881a400Schristos	  func_warning "\`-no-install' is ignored for $host"
5327*6881a400Schristos	  func_warning "assuming \`-no-fast-install' instead"
5328*6881a400Schristos	  fast_install=no
5329*6881a400Schristos	  ;;
5330*6881a400Schristos	*) no_install=yes ;;
5331*6881a400Schristos	esac
5332*6881a400Schristos	continue
5333*6881a400Schristos	;;
5334*6881a400Schristos
5335*6881a400Schristos      -no-undefined)
5336*6881a400Schristos	allow_undefined=no
5337*6881a400Schristos	continue
5338*6881a400Schristos	;;
5339*6881a400Schristos
5340*6881a400Schristos      -objectlist)
5341*6881a400Schristos	prev=objectlist
5342*6881a400Schristos	continue
5343*6881a400Schristos	;;
5344*6881a400Schristos
5345*6881a400Schristos      -o) prev=output ;;
5346*6881a400Schristos
5347*6881a400Schristos      -precious-files-regex)
5348*6881a400Schristos	prev=precious_regex
5349*6881a400Schristos	continue
5350*6881a400Schristos	;;
5351*6881a400Schristos
5352*6881a400Schristos      -release)
5353*6881a400Schristos	prev=release
5354*6881a400Schristos	continue
5355*6881a400Schristos	;;
5356*6881a400Schristos
5357*6881a400Schristos      -rpath)
5358*6881a400Schristos	prev=rpath
5359*6881a400Schristos	continue
5360*6881a400Schristos	;;
5361*6881a400Schristos
5362*6881a400Schristos      -R)
5363*6881a400Schristos	prev=xrpath
5364*6881a400Schristos	continue
5365*6881a400Schristos	;;
5366*6881a400Schristos
5367*6881a400Schristos      -R*)
5368*6881a400Schristos	func_stripname '-R' '' "$arg"
5369*6881a400Schristos	dir=$func_stripname_result
5370*6881a400Schristos	# We need an absolute path.
5371*6881a400Schristos	case $dir in
5372*6881a400Schristos	[\\/]* | [A-Za-z]:[\\/]*) ;;
5373*6881a400Schristos	*)
5374*6881a400Schristos	  func_fatal_error "only absolute run-paths are allowed"
5375*6881a400Schristos	  ;;
5376*6881a400Schristos	esac
5377*6881a400Schristos	case "$xrpath " in
5378*6881a400Schristos	*" $dir "*) ;;
5379*6881a400Schristos	*) xrpath="$xrpath $dir" ;;
5380*6881a400Schristos	esac
5381*6881a400Schristos	continue
5382*6881a400Schristos	;;
5383*6881a400Schristos
5384*6881a400Schristos      -shared)
5385*6881a400Schristos	# The effects of -shared are defined in a previous loop.
5386*6881a400Schristos	continue
5387*6881a400Schristos	;;
5388*6881a400Schristos
5389*6881a400Schristos      -shrext)
5390*6881a400Schristos	prev=shrext
5391*6881a400Schristos	continue
5392*6881a400Schristos	;;
5393*6881a400Schristos
5394*6881a400Schristos      -static | -static-libtool-libs)
5395*6881a400Schristos	# The effects of -static are defined in a previous loop.
5396*6881a400Schristos	# We used to do the same as -all-static on platforms that
5397*6881a400Schristos	# didn't have a PIC flag, but the assumption that the effects
5398*6881a400Schristos	# would be equivalent was wrong.  It would break on at least
5399*6881a400Schristos	# Digital Unix and AIX.
5400*6881a400Schristos	continue
5401*6881a400Schristos	;;
5402*6881a400Schristos
5403*6881a400Schristos      -thread-safe)
5404*6881a400Schristos	thread_safe=yes
5405*6881a400Schristos	continue
5406*6881a400Schristos	;;
5407*6881a400Schristos
5408*6881a400Schristos      -version-info)
5409*6881a400Schristos	prev=vinfo
5410*6881a400Schristos	continue
5411*6881a400Schristos	;;
5412*6881a400Schristos
5413*6881a400Schristos      -version-number)
5414*6881a400Schristos	prev=vinfo
5415*6881a400Schristos	vinfo_number=yes
5416*6881a400Schristos	continue
5417*6881a400Schristos	;;
5418*6881a400Schristos
5419*6881a400Schristos      -weak)
5420*6881a400Schristos        prev=weak
5421*6881a400Schristos	continue
5422*6881a400Schristos	;;
5423*6881a400Schristos
5424*6881a400Schristos      -Wc,*)
5425*6881a400Schristos	func_stripname '-Wc,' '' "$arg"
5426*6881a400Schristos	args=$func_stripname_result
5427*6881a400Schristos	arg=
5428*6881a400Schristos	save_ifs="$IFS"; IFS=','
5429*6881a400Schristos	for flag in $args; do
5430*6881a400Schristos	  IFS="$save_ifs"
5431*6881a400Schristos          func_quote_for_eval "$flag"
5432*6881a400Schristos	  arg="$arg $func_quote_for_eval_result"
5433*6881a400Schristos	  compiler_flags="$compiler_flags $func_quote_for_eval_result"
5434*6881a400Schristos	done
5435*6881a400Schristos	IFS="$save_ifs"
5436*6881a400Schristos	func_stripname ' ' '' "$arg"
5437*6881a400Schristos	arg=$func_stripname_result
5438*6881a400Schristos	;;
5439*6881a400Schristos
5440*6881a400Schristos      -Wl,*)
5441*6881a400Schristos	func_stripname '-Wl,' '' "$arg"
5442*6881a400Schristos	args=$func_stripname_result
5443*6881a400Schristos	arg=
5444*6881a400Schristos	save_ifs="$IFS"; IFS=','
5445*6881a400Schristos	for flag in $args; do
5446*6881a400Schristos	  IFS="$save_ifs"
5447*6881a400Schristos          func_quote_for_eval "$flag"
5448*6881a400Schristos	  arg="$arg $wl$func_quote_for_eval_result"
5449*6881a400Schristos	  compiler_flags="$compiler_flags $wl$func_quote_for_eval_result"
5450*6881a400Schristos	  linker_flags="$linker_flags $func_quote_for_eval_result"
5451*6881a400Schristos	done
5452*6881a400Schristos	IFS="$save_ifs"
5453*6881a400Schristos	func_stripname ' ' '' "$arg"
5454*6881a400Schristos	arg=$func_stripname_result
5455*6881a400Schristos	;;
5456*6881a400Schristos
5457*6881a400Schristos      -Xcompiler)
5458*6881a400Schristos	prev=xcompiler
5459*6881a400Schristos	continue
5460*6881a400Schristos	;;
5461*6881a400Schristos
5462*6881a400Schristos      -Xlinker)
5463*6881a400Schristos	prev=xlinker
5464*6881a400Schristos	continue
5465*6881a400Schristos	;;
5466*6881a400Schristos
5467*6881a400Schristos      -XCClinker)
5468*6881a400Schristos	prev=xcclinker
5469*6881a400Schristos	continue
5470*6881a400Schristos	;;
5471*6881a400Schristos
5472*6881a400Schristos      # -msg_* for osf cc
5473*6881a400Schristos      -msg_*)
5474*6881a400Schristos	func_quote_for_eval "$arg"
5475*6881a400Schristos	arg="$func_quote_for_eval_result"
5476*6881a400Schristos	;;
5477*6881a400Schristos
5478*6881a400Schristos      # -64, -mips[0-9] enable 64-bit mode on the SGI compiler
5479*6881a400Schristos      # -r[0-9][0-9]* specifies the processor on the SGI compiler
5480*6881a400Schristos      # -xarch=*, -xtarget=* enable 64-bit mode on the Sun compiler
5481*6881a400Schristos      # +DA*, +DD* enable 64-bit mode on the HP compiler
5482*6881a400Schristos      # -q* pass through compiler args for the IBM compiler
5483*6881a400Schristos      # -m*, -t[45]*, -txscale* pass through architecture-specific
5484*6881a400Schristos      # compiler args for GCC
5485*6881a400Schristos      # -F/path gives path to uninstalled frameworks, gcc on darwin
5486*6881a400Schristos      # -p, -pg, --coverage, -fprofile-* pass through profiling flag for GCC
5487*6881a400Schristos      # @file GCC response files
5488*6881a400Schristos      # -tp=* Portland pgcc target processor selection
5489*6881a400Schristos      -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \
5490*6881a400Schristos      -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*|-tp=*)
5491*6881a400Schristos        func_quote_for_eval "$arg"
5492*6881a400Schristos	arg="$func_quote_for_eval_result"
5493*6881a400Schristos        func_append compile_command " $arg"
5494*6881a400Schristos        func_append finalize_command " $arg"
5495*6881a400Schristos        compiler_flags="$compiler_flags $arg"
5496*6881a400Schristos        continue
5497*6881a400Schristos        ;;
5498*6881a400Schristos
5499*6881a400Schristos      # Some other compiler flag.
5500*6881a400Schristos      -* | +*)
5501*6881a400Schristos        func_quote_for_eval "$arg"
5502*6881a400Schristos	arg="$func_quote_for_eval_result"
5503*6881a400Schristos	;;
5504*6881a400Schristos
5505*6881a400Schristos      *.$objext)
5506*6881a400Schristos	# A standard object.
5507*6881a400Schristos	objs="$objs $arg"
5508*6881a400Schristos	;;
5509*6881a400Schristos
5510*6881a400Schristos      *.lo)
5511*6881a400Schristos	# A libtool-controlled object.
5512*6881a400Schristos
5513*6881a400Schristos	# Check to see that this really is a libtool object.
5514*6881a400Schristos	if func_lalib_unsafe_p "$arg"; then
5515*6881a400Schristos	  pic_object=
5516*6881a400Schristos	  non_pic_object=
5517*6881a400Schristos
5518*6881a400Schristos	  # Read the .lo file
5519*6881a400Schristos	  func_source "$arg"
5520*6881a400Schristos
5521*6881a400Schristos	  if test -z "$pic_object" ||
5522*6881a400Schristos	     test -z "$non_pic_object" ||
5523*6881a400Schristos	     test "$pic_object" = none &&
5524*6881a400Schristos	     test "$non_pic_object" = none; then
5525*6881a400Schristos	    func_fatal_error "cannot find name of object for \`$arg'"
5526*6881a400Schristos	  fi
5527*6881a400Schristos
5528*6881a400Schristos	  # Extract subdirectory from the argument.
5529*6881a400Schristos	  func_dirname "$arg" "/" ""
5530*6881a400Schristos	  xdir="$func_dirname_result"
5531*6881a400Schristos
5532*6881a400Schristos	  if test "$pic_object" != none; then
5533*6881a400Schristos	    # Prepend the subdirectory the object is found in.
5534*6881a400Schristos	    pic_object="$xdir$pic_object"
5535*6881a400Schristos
5536*6881a400Schristos	    if test "$prev" = dlfiles; then
5537*6881a400Schristos	      if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
5538*6881a400Schristos		dlfiles="$dlfiles $pic_object"
5539*6881a400Schristos		prev=
5540*6881a400Schristos		continue
5541*6881a400Schristos	      else
5542*6881a400Schristos		# If libtool objects are unsupported, then we need to preload.
5543*6881a400Schristos		prev=dlprefiles
5544*6881a400Schristos	      fi
5545*6881a400Schristos	    fi
5546*6881a400Schristos
5547*6881a400Schristos	    # CHECK ME:  I think I busted this.  -Ossama
5548*6881a400Schristos	    if test "$prev" = dlprefiles; then
5549*6881a400Schristos	      # Preload the old-style object.
5550*6881a400Schristos	      dlprefiles="$dlprefiles $pic_object"
5551*6881a400Schristos	      prev=
5552*6881a400Schristos	    fi
5553*6881a400Schristos
5554*6881a400Schristos	    # A PIC object.
5555*6881a400Schristos	    func_append libobjs " $pic_object"
5556*6881a400Schristos	    arg="$pic_object"
5557*6881a400Schristos	  fi
5558*6881a400Schristos
5559*6881a400Schristos	  # Non-PIC object.
5560*6881a400Schristos	  if test "$non_pic_object" != none; then
5561*6881a400Schristos	    # Prepend the subdirectory the object is found in.
5562*6881a400Schristos	    non_pic_object="$xdir$non_pic_object"
5563*6881a400Schristos
5564*6881a400Schristos	    # A standard non-PIC object
5565*6881a400Schristos	    func_append non_pic_objects " $non_pic_object"
5566*6881a400Schristos	    if test -z "$pic_object" || test "$pic_object" = none ; then
5567*6881a400Schristos	      arg="$non_pic_object"
5568*6881a400Schristos	    fi
5569*6881a400Schristos	  else
5570*6881a400Schristos	    # If the PIC object exists, use it instead.
5571*6881a400Schristos	    # $xdir was prepended to $pic_object above.
5572*6881a400Schristos	    non_pic_object="$pic_object"
5573*6881a400Schristos	    func_append non_pic_objects " $non_pic_object"
5574*6881a400Schristos	  fi
5575*6881a400Schristos	else
5576*6881a400Schristos	  # Only an error if not doing a dry-run.
5577*6881a400Schristos	  if $opt_dry_run; then
5578*6881a400Schristos	    # Extract subdirectory from the argument.
5579*6881a400Schristos	    func_dirname "$arg" "/" ""
5580*6881a400Schristos	    xdir="$func_dirname_result"
5581*6881a400Schristos
5582*6881a400Schristos	    func_lo2o "$arg"
5583*6881a400Schristos	    pic_object=$xdir$objdir/$func_lo2o_result
5584*6881a400Schristos	    non_pic_object=$xdir$func_lo2o_result
5585*6881a400Schristos	    func_append libobjs " $pic_object"
5586*6881a400Schristos	    func_append non_pic_objects " $non_pic_object"
5587*6881a400Schristos	  else
5588*6881a400Schristos	    func_fatal_error "\`$arg' is not a valid libtool object"
5589*6881a400Schristos	  fi
5590*6881a400Schristos	fi
5591*6881a400Schristos	;;
5592*6881a400Schristos
5593*6881a400Schristos      *.$libext)
5594*6881a400Schristos	# An archive.
5595*6881a400Schristos	deplibs="$deplibs $arg"
5596*6881a400Schristos	old_deplibs="$old_deplibs $arg"
5597*6881a400Schristos	continue
5598*6881a400Schristos	;;
5599*6881a400Schristos
5600*6881a400Schristos      *.la)
5601*6881a400Schristos	# A libtool-controlled library.
5602*6881a400Schristos
5603*6881a400Schristos	if test "$prev" = dlfiles; then
5604*6881a400Schristos	  # This library was specified with -dlopen.
5605*6881a400Schristos	  dlfiles="$dlfiles $arg"
5606*6881a400Schristos	  prev=
5607*6881a400Schristos	elif test "$prev" = dlprefiles; then
5608*6881a400Schristos	  # The library was specified with -dlpreopen.
5609*6881a400Schristos	  dlprefiles="$dlprefiles $arg"
5610*6881a400Schristos	  prev=
5611*6881a400Schristos	else
5612*6881a400Schristos	  deplibs="$deplibs $arg"
5613*6881a400Schristos	fi
5614*6881a400Schristos	continue
5615*6881a400Schristos	;;
5616*6881a400Schristos
5617*6881a400Schristos      # Some other compiler argument.
5618*6881a400Schristos      *)
5619*6881a400Schristos	# Unknown arguments in both finalize_command and compile_command need
5620*6881a400Schristos	# to be aesthetically quoted because they are evaled later.
5621*6881a400Schristos	func_quote_for_eval "$arg"
5622*6881a400Schristos	arg="$func_quote_for_eval_result"
5623*6881a400Schristos	;;
5624*6881a400Schristos      esac # arg
5625*6881a400Schristos
5626*6881a400Schristos      # Now actually substitute the argument into the commands.
5627*6881a400Schristos      if test -n "$arg"; then
5628*6881a400Schristos	func_append compile_command " $arg"
5629*6881a400Schristos	func_append finalize_command " $arg"
5630*6881a400Schristos      fi
5631*6881a400Schristos    done # argument parsing loop
5632*6881a400Schristos
5633*6881a400Schristos    test -n "$prev" && \
5634*6881a400Schristos      func_fatal_help "the \`$prevarg' option requires an argument"
5635*6881a400Schristos
5636*6881a400Schristos    if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then
5637*6881a400Schristos      eval "arg=\"$export_dynamic_flag_spec\""
5638*6881a400Schristos      func_append compile_command " $arg"
5639*6881a400Schristos      func_append finalize_command " $arg"
5640*6881a400Schristos    fi
5641*6881a400Schristos
5642*6881a400Schristos    oldlibs=
5643*6881a400Schristos    # calculate the name of the file, without its directory
5644*6881a400Schristos    func_basename "$output"
5645*6881a400Schristos    outputname="$func_basename_result"
5646*6881a400Schristos    libobjs_save="$libobjs"
5647*6881a400Schristos
5648*6881a400Schristos    if test -n "$shlibpath_var"; then
5649*6881a400Schristos      # get the directories listed in $shlibpath_var
5650*6881a400Schristos      eval shlib_search_path=\`\$ECHO \"\${$shlibpath_var}\" \| \$SED \'s/:/ /g\'\`
5651*6881a400Schristos    else
5652*6881a400Schristos      shlib_search_path=
5653*6881a400Schristos    fi
5654*6881a400Schristos    eval "sys_lib_search_path=\"$sys_lib_search_path_spec\""
5655*6881a400Schristos    eval "sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\""
5656*6881a400Schristos
5657*6881a400Schristos    func_dirname "$output" "/" ""
5658*6881a400Schristos    output_objdir="$func_dirname_result$objdir"
5659*6881a400Schristos    # Create the object directory.
5660*6881a400Schristos    func_mkdir_p "$output_objdir"
5661*6881a400Schristos
5662*6881a400Schristos    # Determine the type of output
5663*6881a400Schristos    case $output in
5664*6881a400Schristos    "")
5665*6881a400Schristos      func_fatal_help "you must specify an output file"
5666*6881a400Schristos      ;;
5667*6881a400Schristos    *.$libext) linkmode=oldlib ;;
5668*6881a400Schristos    *.lo | *.$objext) linkmode=obj ;;
5669*6881a400Schristos    *.la) linkmode=lib ;;
5670*6881a400Schristos    *) linkmode=prog ;; # Anything else should be a program.
5671*6881a400Schristos    esac
5672*6881a400Schristos
5673*6881a400Schristos    specialdeplibs=
5674*6881a400Schristos
5675*6881a400Schristos    libs=
5676*6881a400Schristos    # Find all interdependent deplibs by searching for libraries
5677*6881a400Schristos    # that are linked more than once (e.g. -la -lb -la)
5678*6881a400Schristos    for deplib in $deplibs; do
5679*6881a400Schristos      if $opt_duplicate_deps ; then
5680*6881a400Schristos	case "$libs " in
5681*6881a400Schristos	*" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
5682*6881a400Schristos	esac
5683*6881a400Schristos      fi
5684*6881a400Schristos      libs="$libs $deplib"
5685*6881a400Schristos    done
5686*6881a400Schristos
5687*6881a400Schristos    if test "$linkmode" = lib; then
5688*6881a400Schristos      libs="$predeps $libs $compiler_lib_search_path $postdeps"
5689*6881a400Schristos
5690*6881a400Schristos      # Compute libraries that are listed more than once in $predeps
5691*6881a400Schristos      # $postdeps and mark them as special (i.e., whose duplicates are
5692*6881a400Schristos      # not to be eliminated).
5693*6881a400Schristos      pre_post_deps=
5694*6881a400Schristos      if $opt_duplicate_compiler_generated_deps; then
5695*6881a400Schristos	for pre_post_dep in $predeps $postdeps; do
5696*6881a400Schristos	  case "$pre_post_deps " in
5697*6881a400Schristos	  *" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;;
5698*6881a400Schristos	  esac
5699*6881a400Schristos	  pre_post_deps="$pre_post_deps $pre_post_dep"
5700*6881a400Schristos	done
5701*6881a400Schristos      fi
5702*6881a400Schristos      pre_post_deps=
5703*6881a400Schristos    fi
5704*6881a400Schristos
5705*6881a400Schristos    deplibs=
5706*6881a400Schristos    newdependency_libs=
5707*6881a400Schristos    newlib_search_path=
5708*6881a400Schristos    need_relink=no # whether we're linking any uninstalled libtool libraries
5709*6881a400Schristos    notinst_deplibs= # not-installed libtool libraries
5710*6881a400Schristos    notinst_path= # paths that contain not-installed libtool libraries
5711*6881a400Schristos
5712*6881a400Schristos    case $linkmode in
5713*6881a400Schristos    lib)
5714*6881a400Schristos	passes="conv dlpreopen link"
5715*6881a400Schristos	for file in $dlfiles $dlprefiles; do
5716*6881a400Schristos	  case $file in
5717*6881a400Schristos	  *.la) ;;
5718*6881a400Schristos	  *)
5719*6881a400Schristos	    func_fatal_help "libraries can \`-dlopen' only libtool libraries: $file"
5720*6881a400Schristos	    ;;
5721*6881a400Schristos	  esac
5722*6881a400Schristos	done
5723*6881a400Schristos	;;
5724*6881a400Schristos    prog)
5725*6881a400Schristos	compile_deplibs=
5726*6881a400Schristos	finalize_deplibs=
5727*6881a400Schristos	alldeplibs=no
5728*6881a400Schristos	newdlfiles=
5729*6881a400Schristos	newdlprefiles=
5730*6881a400Schristos	passes="conv scan dlopen dlpreopen link"
5731*6881a400Schristos	;;
5732*6881a400Schristos    *)  passes="conv"
5733*6881a400Schristos	;;
5734*6881a400Schristos    esac
5735*6881a400Schristos
5736*6881a400Schristos    for pass in $passes; do
5737*6881a400Schristos      # The preopen pass in lib mode reverses $deplibs; put it back here
5738*6881a400Schristos      # so that -L comes before libs that need it for instance...
5739*6881a400Schristos      if test "$linkmode,$pass" = "lib,link"; then
5740*6881a400Schristos	## FIXME: Find the place where the list is rebuilt in the wrong
5741*6881a400Schristos	##        order, and fix it there properly
5742*6881a400Schristos        tmp_deplibs=
5743*6881a400Schristos	for deplib in $deplibs; do
5744*6881a400Schristos	  tmp_deplibs="$deplib $tmp_deplibs"
5745*6881a400Schristos	done
5746*6881a400Schristos	deplibs="$tmp_deplibs"
5747*6881a400Schristos      fi
5748*6881a400Schristos
5749*6881a400Schristos      if test "$linkmode,$pass" = "lib,link" ||
5750*6881a400Schristos	 test "$linkmode,$pass" = "prog,scan"; then
5751*6881a400Schristos	libs="$deplibs"
5752*6881a400Schristos	deplibs=
5753*6881a400Schristos      fi
5754*6881a400Schristos      if test "$linkmode" = prog; then
5755*6881a400Schristos	case $pass in
5756*6881a400Schristos	dlopen) libs="$dlfiles" ;;
5757*6881a400Schristos	dlpreopen) libs="$dlprefiles" ;;
5758*6881a400Schristos	link) libs="$deplibs %DEPLIBS% $dependency_libs" ;;
5759*6881a400Schristos	esac
5760*6881a400Schristos      fi
5761*6881a400Schristos      if test "$linkmode,$pass" = "lib,dlpreopen"; then
5762*6881a400Schristos	# Collect and forward deplibs of preopened libtool libs
5763*6881a400Schristos	for lib in $dlprefiles; do
5764*6881a400Schristos	  # Ignore non-libtool-libs
5765*6881a400Schristos	  dependency_libs=
5766*6881a400Schristos	  case $lib in
5767*6881a400Schristos	  *.la)	func_source "$lib" ;;
5768*6881a400Schristos	  esac
5769*6881a400Schristos
5770*6881a400Schristos	  # Collect preopened libtool deplibs, except any this library
5771*6881a400Schristos	  # has declared as weak libs
5772*6881a400Schristos	  for deplib in $dependency_libs; do
5773*6881a400Schristos	    func_basename "$deplib"
5774*6881a400Schristos            deplib_base=$func_basename_result
5775*6881a400Schristos	    case " $weak_libs " in
5776*6881a400Schristos	    *" $deplib_base "*) ;;
5777*6881a400Schristos	    *) deplibs="$deplibs $deplib" ;;
5778*6881a400Schristos	    esac
5779*6881a400Schristos	  done
5780*6881a400Schristos	done
5781*6881a400Schristos	libs="$dlprefiles"
5782*6881a400Schristos      fi
5783*6881a400Schristos      if test "$pass" = dlopen; then
5784*6881a400Schristos	# Collect dlpreopened libraries
5785*6881a400Schristos	save_deplibs="$deplibs"
5786*6881a400Schristos	deplibs=
5787*6881a400Schristos      fi
5788*6881a400Schristos
5789*6881a400Schristos      for deplib in $libs; do
5790*6881a400Schristos	lib=
5791*6881a400Schristos	found=no
5792*6881a400Schristos	case $deplib in
5793*6881a400Schristos	-mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads)
5794*6881a400Schristos	  if test "$linkmode,$pass" = "prog,link"; then
5795*6881a400Schristos	    compile_deplibs="$deplib $compile_deplibs"
5796*6881a400Schristos	    finalize_deplibs="$deplib $finalize_deplibs"
5797*6881a400Schristos	  else
5798*6881a400Schristos	    compiler_flags="$compiler_flags $deplib"
5799*6881a400Schristos	    if test "$linkmode" = lib ; then
5800*6881a400Schristos		case "$new_inherited_linker_flags " in
5801*6881a400Schristos		    *" $deplib "*) ;;
5802*6881a400Schristos		    * ) new_inherited_linker_flags="$new_inherited_linker_flags $deplib" ;;
5803*6881a400Schristos		esac
5804*6881a400Schristos	    fi
5805*6881a400Schristos	  fi
5806*6881a400Schristos	  continue
5807*6881a400Schristos	  ;;
5808*6881a400Schristos	-l*)
5809*6881a400Schristos	  if test "$linkmode" != lib && test "$linkmode" != prog; then
5810*6881a400Schristos	    func_warning "\`-l' is ignored for archives/objects"
5811*6881a400Schristos	    continue
5812*6881a400Schristos	  fi
5813*6881a400Schristos	  func_stripname '-l' '' "$deplib"
5814*6881a400Schristos	  name=$func_stripname_result
5815*6881a400Schristos	  if test "$linkmode" = lib; then
5816*6881a400Schristos	    searchdirs="$newlib_search_path $lib_search_path $compiler_lib_search_dirs $sys_lib_search_path $shlib_search_path"
5817*6881a400Schristos	  else
5818*6881a400Schristos	    searchdirs="$newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path"
5819*6881a400Schristos	  fi
5820*6881a400Schristos	  for searchdir in $searchdirs; do
5821*6881a400Schristos	    for search_ext in .la $std_shrext .so .a; do
5822*6881a400Schristos	      # Search the libtool library
5823*6881a400Schristos	      lib="$searchdir/lib${name}${search_ext}"
5824*6881a400Schristos	      if test -f "$lib"; then
5825*6881a400Schristos		if test "$search_ext" = ".la"; then
5826*6881a400Schristos		  found=yes
5827*6881a400Schristos		else
5828*6881a400Schristos		  found=no
5829*6881a400Schristos		fi
5830*6881a400Schristos		break 2
5831*6881a400Schristos	      fi
5832*6881a400Schristos	    done
5833*6881a400Schristos	  done
5834*6881a400Schristos	  if test "$found" != yes; then
5835*6881a400Schristos	    # deplib doesn't seem to be a libtool library
5836*6881a400Schristos	    if test "$linkmode,$pass" = "prog,link"; then
5837*6881a400Schristos	      compile_deplibs="$deplib $compile_deplibs"
5838*6881a400Schristos	      finalize_deplibs="$deplib $finalize_deplibs"
5839*6881a400Schristos	    else
5840*6881a400Schristos	      deplibs="$deplib $deplibs"
5841*6881a400Schristos	      test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
5842*6881a400Schristos	    fi
5843*6881a400Schristos	    continue
5844*6881a400Schristos	  else # deplib is a libtool library
5845*6881a400Schristos	    # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib,
5846*6881a400Schristos	    # We need to do some special things here, and not later.
5847*6881a400Schristos	    if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
5848*6881a400Schristos	      case " $predeps $postdeps " in
5849*6881a400Schristos	      *" $deplib "*)
5850*6881a400Schristos		if func_lalib_p "$lib"; then
5851*6881a400Schristos		  library_names=
5852*6881a400Schristos		  old_library=
5853*6881a400Schristos		  func_source "$lib"
5854*6881a400Schristos		  for l in $old_library $library_names; do
5855*6881a400Schristos		    ll="$l"
5856*6881a400Schristos		  done
5857*6881a400Schristos		  if test "X$ll" = "X$old_library" ; then # only static version available
5858*6881a400Schristos		    found=no
5859*6881a400Schristos		    func_dirname "$lib" "" "."
5860*6881a400Schristos		    ladir="$func_dirname_result"
5861*6881a400Schristos		    lib=$ladir/$old_library
5862*6881a400Schristos		    if test "$linkmode,$pass" = "prog,link"; then
5863*6881a400Schristos		      compile_deplibs="$deplib $compile_deplibs"
5864*6881a400Schristos		      finalize_deplibs="$deplib $finalize_deplibs"
5865*6881a400Schristos		    else
5866*6881a400Schristos		      deplibs="$deplib $deplibs"
5867*6881a400Schristos		      test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
5868*6881a400Schristos		    fi
5869*6881a400Schristos		    continue
5870*6881a400Schristos		  fi
5871*6881a400Schristos		fi
5872*6881a400Schristos		;;
5873*6881a400Schristos	      *) ;;
5874*6881a400Schristos	      esac
5875*6881a400Schristos	    fi
5876*6881a400Schristos	  fi
5877*6881a400Schristos	  ;; # -l
5878*6881a400Schristos	*.ltframework)
5879*6881a400Schristos	  if test "$linkmode,$pass" = "prog,link"; then
5880*6881a400Schristos	    compile_deplibs="$deplib $compile_deplibs"
5881*6881a400Schristos	    finalize_deplibs="$deplib $finalize_deplibs"
5882*6881a400Schristos	  else
5883*6881a400Schristos	    deplibs="$deplib $deplibs"
5884*6881a400Schristos	    if test "$linkmode" = lib ; then
5885*6881a400Schristos		case "$new_inherited_linker_flags " in
5886*6881a400Schristos		    *" $deplib "*) ;;
5887*6881a400Schristos		    * ) new_inherited_linker_flags="$new_inherited_linker_flags $deplib" ;;
5888*6881a400Schristos		esac
5889*6881a400Schristos	    fi
5890*6881a400Schristos	  fi
5891*6881a400Schristos	  continue
5892*6881a400Schristos	  ;;
5893*6881a400Schristos	-L*)
5894*6881a400Schristos	  case $linkmode in
5895*6881a400Schristos	  lib)
5896*6881a400Schristos	    deplibs="$deplib $deplibs"
5897*6881a400Schristos	    test "$pass" = conv && continue
5898*6881a400Schristos	    newdependency_libs="$deplib $newdependency_libs"
5899*6881a400Schristos	    func_stripname '-L' '' "$deplib"
5900*6881a400Schristos	    newlib_search_path="$newlib_search_path $func_stripname_result"
5901*6881a400Schristos	    ;;
5902*6881a400Schristos	  prog)
5903*6881a400Schristos	    if test "$pass" = conv; then
5904*6881a400Schristos	      deplibs="$deplib $deplibs"
5905*6881a400Schristos	      continue
5906*6881a400Schristos	    fi
5907*6881a400Schristos	    if test "$pass" = scan; then
5908*6881a400Schristos	      deplibs="$deplib $deplibs"
5909*6881a400Schristos	    else
5910*6881a400Schristos	      compile_deplibs="$deplib $compile_deplibs"
5911*6881a400Schristos	      finalize_deplibs="$deplib $finalize_deplibs"
5912*6881a400Schristos	    fi
5913*6881a400Schristos	    func_stripname '-L' '' "$deplib"
5914*6881a400Schristos	    newlib_search_path="$newlib_search_path $func_stripname_result"
5915*6881a400Schristos	    ;;
5916*6881a400Schristos	  *)
5917*6881a400Schristos	    func_warning "\`-L' is ignored for archives/objects"
5918*6881a400Schristos	    ;;
5919*6881a400Schristos	  esac # linkmode
5920*6881a400Schristos	  continue
5921*6881a400Schristos	  ;; # -L
5922*6881a400Schristos	-R*)
5923*6881a400Schristos	  if test "$pass" = link; then
5924*6881a400Schristos	    func_stripname '-R' '' "$deplib"
5925*6881a400Schristos	    dir=$func_stripname_result
5926*6881a400Schristos	    # Make sure the xrpath contains only unique directories.
5927*6881a400Schristos	    case "$xrpath " in
5928*6881a400Schristos	    *" $dir "*) ;;
5929*6881a400Schristos	    *) xrpath="$xrpath $dir" ;;
5930*6881a400Schristos	    esac
5931*6881a400Schristos	  fi
5932*6881a400Schristos	  deplibs="$deplib $deplibs"
5933*6881a400Schristos	  continue
5934*6881a400Schristos	  ;;
5935*6881a400Schristos	*.la) lib="$deplib" ;;
5936*6881a400Schristos	*.$libext)
5937*6881a400Schristos	  if test "$pass" = conv; then
5938*6881a400Schristos	    deplibs="$deplib $deplibs"
5939*6881a400Schristos	    continue
5940*6881a400Schristos	  fi
5941*6881a400Schristos	  case $linkmode in
5942*6881a400Schristos	  lib)
5943*6881a400Schristos	    # Linking convenience modules into shared libraries is allowed,
5944*6881a400Schristos	    # but linking other static libraries is non-portable.
5945*6881a400Schristos	    case " $dlpreconveniencelibs " in
5946*6881a400Schristos	    *" $deplib "*) ;;
5947*6881a400Schristos	    *)
5948*6881a400Schristos	      valid_a_lib=no
5949*6881a400Schristos	      case $deplibs_check_method in
5950*6881a400Schristos		match_pattern*)
5951*6881a400Schristos		  set dummy $deplibs_check_method; shift
5952*6881a400Schristos		  match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
5953*6881a400Schristos		  if eval "\$ECHO \"$deplib\"" 2>/dev/null | $SED 10q \
5954*6881a400Schristos		    | $EGREP "$match_pattern_regex" > /dev/null; then
5955*6881a400Schristos		    valid_a_lib=yes
5956*6881a400Schristos		  fi
5957*6881a400Schristos		;;
5958*6881a400Schristos		pass_all)
5959*6881a400Schristos		  valid_a_lib=yes
5960*6881a400Schristos		;;
5961*6881a400Schristos	      esac
5962*6881a400Schristos	      if test "$valid_a_lib" != yes; then
5963*6881a400Schristos		echo
5964*6881a400Schristos		$ECHO "*** Warning: Trying to link with static lib archive $deplib."
5965*6881a400Schristos		echo "*** I have the capability to make that library automatically link in when"
5966*6881a400Schristos		echo "*** you link to this library.  But I can only do this if you have a"
5967*6881a400Schristos		echo "*** shared version of the library, which you do not appear to have"
5968*6881a400Schristos		echo "*** because the file extensions .$libext of this argument makes me believe"
5969*6881a400Schristos		echo "*** that it is just a static archive that I should not use here."
5970*6881a400Schristos	      else
5971*6881a400Schristos		echo
5972*6881a400Schristos		$ECHO "*** Warning: Linking the shared library $output against the"
5973*6881a400Schristos		$ECHO "*** static library $deplib is not portable!"
5974*6881a400Schristos		deplibs="$deplib $deplibs"
5975*6881a400Schristos	      fi
5976*6881a400Schristos	      ;;
5977*6881a400Schristos	    esac
5978*6881a400Schristos	    continue
5979*6881a400Schristos	    ;;
5980*6881a400Schristos	  prog)
5981*6881a400Schristos	    if test "$pass" != link; then
5982*6881a400Schristos	      deplibs="$deplib $deplibs"
5983*6881a400Schristos	    else
5984*6881a400Schristos	      compile_deplibs="$deplib $compile_deplibs"
5985*6881a400Schristos	      finalize_deplibs="$deplib $finalize_deplibs"
5986*6881a400Schristos	    fi
5987*6881a400Schristos	    continue
5988*6881a400Schristos	    ;;
5989*6881a400Schristos	  esac # linkmode
5990*6881a400Schristos	  ;; # *.$libext
5991*6881a400Schristos	*.lo | *.$objext)
5992*6881a400Schristos	  if test "$pass" = conv; then
5993*6881a400Schristos	    deplibs="$deplib $deplibs"
5994*6881a400Schristos	  elif test "$linkmode" = prog; then
5995*6881a400Schristos	    if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
5996*6881a400Schristos	      # If there is no dlopen support or we're linking statically,
5997*6881a400Schristos	      # we need to preload.
5998*6881a400Schristos	      newdlprefiles="$newdlprefiles $deplib"
5999*6881a400Schristos	      compile_deplibs="$deplib $compile_deplibs"
6000*6881a400Schristos	      finalize_deplibs="$deplib $finalize_deplibs"
6001*6881a400Schristos	    else
6002*6881a400Schristos	      newdlfiles="$newdlfiles $deplib"
6003*6881a400Schristos	    fi
6004*6881a400Schristos	  fi
6005*6881a400Schristos	  continue
6006*6881a400Schristos	  ;;
6007*6881a400Schristos	%DEPLIBS%)
6008*6881a400Schristos	  alldeplibs=yes
6009*6881a400Schristos	  continue
6010*6881a400Schristos	  ;;
6011*6881a400Schristos	esac # case $deplib
6012*6881a400Schristos
6013*6881a400Schristos	if test "$found" = yes || test -f "$lib"; then :
6014*6881a400Schristos	else
6015*6881a400Schristos	  func_fatal_error "cannot find the library \`$lib' or unhandled argument \`$deplib'"
6016*6881a400Schristos	fi
6017*6881a400Schristos
6018*6881a400Schristos	# Check to see that this really is a libtool archive.
6019*6881a400Schristos	func_lalib_unsafe_p "$lib" \
6020*6881a400Schristos	  || func_fatal_error "\`$lib' is not a valid libtool archive"
6021*6881a400Schristos
6022*6881a400Schristos	func_dirname "$lib" "" "."
6023*6881a400Schristos	ladir="$func_dirname_result"
6024*6881a400Schristos
6025*6881a400Schristos	dlname=
6026*6881a400Schristos	dlopen=
6027*6881a400Schristos	dlpreopen=
6028*6881a400Schristos	libdir=
6029*6881a400Schristos	library_names=
6030*6881a400Schristos	old_library=
6031*6881a400Schristos	inherited_linker_flags=
6032*6881a400Schristos	# If the library was installed with an old release of libtool,
6033*6881a400Schristos	# it will not redefine variables installed, or shouldnotlink
6034*6881a400Schristos	installed=yes
6035*6881a400Schristos	shouldnotlink=no
6036*6881a400Schristos	avoidtemprpath=
6037*6881a400Schristos
6038*6881a400Schristos
6039*6881a400Schristos	# Read the .la file
6040*6881a400Schristos	func_source "$lib"
6041*6881a400Schristos
6042*6881a400Schristos	# Convert "-framework foo" to "foo.ltframework"
6043*6881a400Schristos	if test -n "$inherited_linker_flags"; then
6044*6881a400Schristos	  tmp_inherited_linker_flags=`$ECHO "$inherited_linker_flags" | $SED 's/-framework \([^ $]*\)/\1.ltframework/g'`
6045*6881a400Schristos	  for tmp_inherited_linker_flag in $tmp_inherited_linker_flags; do
6046*6881a400Schristos	    case " $new_inherited_linker_flags " in
6047*6881a400Schristos	      *" $tmp_inherited_linker_flag "*) ;;
6048*6881a400Schristos	      *) new_inherited_linker_flags="$new_inherited_linker_flags $tmp_inherited_linker_flag";;
6049*6881a400Schristos	    esac
6050*6881a400Schristos	  done
6051*6881a400Schristos	fi
6052*6881a400Schristos	dependency_libs=`$ECHO " $dependency_libs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
6053*6881a400Schristos	if test "$linkmode,$pass" = "lib,link" ||
6054*6881a400Schristos	   test "$linkmode,$pass" = "prog,scan" ||
6055*6881a400Schristos	   { test "$linkmode" != prog && test "$linkmode" != lib; }; then
6056*6881a400Schristos	  test -n "$dlopen" && dlfiles="$dlfiles $dlopen"
6057*6881a400Schristos	  test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen"
6058*6881a400Schristos	fi
6059*6881a400Schristos
6060*6881a400Schristos	if test "$pass" = conv; then
6061*6881a400Schristos	  # Only check for convenience libraries
6062*6881a400Schristos	  deplibs="$lib $deplibs"
6063*6881a400Schristos	  if test -z "$libdir"; then
6064*6881a400Schristos	    if test -z "$old_library"; then
6065*6881a400Schristos	      func_fatal_error "cannot find name of link library for \`$lib'"
6066*6881a400Schristos	    fi
6067*6881a400Schristos	    # It is a libtool convenience library, so add in its objects.
6068*6881a400Schristos	    convenience="$convenience $ladir/$objdir/$old_library"
6069*6881a400Schristos	    old_convenience="$old_convenience $ladir/$objdir/$old_library"
6070*6881a400Schristos	  elif test "$linkmode" != prog && test "$linkmode" != lib; then
6071*6881a400Schristos	    func_fatal_error "\`$lib' is not a convenience library"
6072*6881a400Schristos	  fi
6073*6881a400Schristos	  tmp_libs=
6074*6881a400Schristos	  for deplib in $dependency_libs; do
6075*6881a400Schristos	    deplibs="$deplib $deplibs"
6076*6881a400Schristos	    if $opt_duplicate_deps ; then
6077*6881a400Schristos	      case "$tmp_libs " in
6078*6881a400Schristos	      *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
6079*6881a400Schristos	      esac
6080*6881a400Schristos	    fi
6081*6881a400Schristos	    tmp_libs="$tmp_libs $deplib"
6082*6881a400Schristos	  done
6083*6881a400Schristos	  continue
6084*6881a400Schristos	fi # $pass = conv
6085*6881a400Schristos
6086*6881a400Schristos
6087*6881a400Schristos	# Get the name of the library we link against.
6088*6881a400Schristos	linklib=
6089*6881a400Schristos	for l in $old_library $library_names; do
6090*6881a400Schristos	  linklib="$l"
6091*6881a400Schristos	done
6092*6881a400Schristos	if test -z "$linklib"; then
6093*6881a400Schristos	  func_fatal_error "cannot find name of link library for \`$lib'"
6094*6881a400Schristos	fi
6095*6881a400Schristos
6096*6881a400Schristos	# This library was specified with -dlopen.
6097*6881a400Schristos	if test "$pass" = dlopen; then
6098*6881a400Schristos	  if test -z "$libdir"; then
6099*6881a400Schristos	    func_fatal_error "cannot -dlopen a convenience library: \`$lib'"
6100*6881a400Schristos	  fi
6101*6881a400Schristos	  if test -z "$dlname" ||
6102*6881a400Schristos	     test "$dlopen_support" != yes ||
6103*6881a400Schristos	     test "$build_libtool_libs" = no; then
6104*6881a400Schristos	    # If there is no dlname, no dlopen support or we're linking
6105*6881a400Schristos	    # statically, we need to preload.  We also need to preload any
6106*6881a400Schristos	    # dependent libraries so libltdl's deplib preloader doesn't
6107*6881a400Schristos	    # bomb out in the load deplibs phase.
6108*6881a400Schristos	    dlprefiles="$dlprefiles $lib $dependency_libs"
6109*6881a400Schristos	  else
6110*6881a400Schristos	    newdlfiles="$newdlfiles $lib"
6111*6881a400Schristos	  fi
6112*6881a400Schristos	  continue
6113*6881a400Schristos	fi # $pass = dlopen
6114*6881a400Schristos
6115*6881a400Schristos	# We need an absolute path.
6116*6881a400Schristos	case $ladir in
6117*6881a400Schristos	[\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;;
6118*6881a400Schristos	*)
6119*6881a400Schristos	  abs_ladir=`cd "$ladir" && pwd`
6120*6881a400Schristos	  if test -z "$abs_ladir"; then
6121*6881a400Schristos	    func_warning "cannot determine absolute directory name of \`$ladir'"
6122*6881a400Schristos	    func_warning "passing it literally to the linker, although it might fail"
6123*6881a400Schristos	    abs_ladir="$ladir"
6124*6881a400Schristos	  fi
6125*6881a400Schristos	  ;;
6126*6881a400Schristos	esac
6127*6881a400Schristos	func_basename "$lib"
6128*6881a400Schristos	laname="$func_basename_result"
6129*6881a400Schristos
6130*6881a400Schristos	# Find the relevant object directory and library name.
6131*6881a400Schristos	if test "X$installed" = Xyes; then
6132*6881a400Schristos	  if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then
6133*6881a400Schristos	    func_warning "library \`$lib' was moved."
6134*6881a400Schristos	    dir="$ladir"
6135*6881a400Schristos	    absdir="$abs_ladir"
6136*6881a400Schristos	    libdir="$abs_ladir"
6137*6881a400Schristos	  else
6138*6881a400Schristos	    dir="$libdir"
6139*6881a400Schristos	    absdir="$libdir"
6140*6881a400Schristos	  fi
6141*6881a400Schristos	  test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes
6142*6881a400Schristos	else
6143*6881a400Schristos	  if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then
6144*6881a400Schristos	    dir="$ladir"
6145*6881a400Schristos	    absdir="$abs_ladir"
6146*6881a400Schristos	    # Remove this search path later
6147*6881a400Schristos	    notinst_path="$notinst_path $abs_ladir"
6148*6881a400Schristos	  else
6149*6881a400Schristos	    dir="$ladir/$objdir"
6150*6881a400Schristos	    absdir="$abs_ladir/$objdir"
6151*6881a400Schristos	    # Remove this search path later
6152*6881a400Schristos	    notinst_path="$notinst_path $abs_ladir"
6153*6881a400Schristos	  fi
6154*6881a400Schristos	fi # $installed = yes
6155*6881a400Schristos	func_stripname 'lib' '.la' "$laname"
6156*6881a400Schristos	name=$func_stripname_result
6157*6881a400Schristos
6158*6881a400Schristos	# This library was specified with -dlpreopen.
6159*6881a400Schristos	if test "$pass" = dlpreopen; then
6160*6881a400Schristos	  if test -z "$libdir" && test "$linkmode" = prog; then
6161*6881a400Schristos	    func_fatal_error "only libraries may -dlpreopen a convenience library: \`$lib'"
6162*6881a400Schristos	  fi
6163*6881a400Schristos	  # Prefer using a static library (so that no silly _DYNAMIC symbols
6164*6881a400Schristos	  # are required to link).
6165*6881a400Schristos	  if test -n "$old_library"; then
6166*6881a400Schristos	    newdlprefiles="$newdlprefiles $dir/$old_library"
6167*6881a400Schristos	    # Keep a list of preopened convenience libraries to check
6168*6881a400Schristos	    # that they are being used correctly in the link pass.
6169*6881a400Schristos	    test -z "$libdir" && \
6170*6881a400Schristos		dlpreconveniencelibs="$dlpreconveniencelibs $dir/$old_library"
6171*6881a400Schristos	  # Otherwise, use the dlname, so that lt_dlopen finds it.
6172*6881a400Schristos	  elif test -n "$dlname"; then
6173*6881a400Schristos	    newdlprefiles="$newdlprefiles $dir/$dlname"
6174*6881a400Schristos	  else
6175*6881a400Schristos	    newdlprefiles="$newdlprefiles $dir/$linklib"
6176*6881a400Schristos	  fi
6177*6881a400Schristos	fi # $pass = dlpreopen
6178*6881a400Schristos
6179*6881a400Schristos	if test -z "$libdir"; then
6180*6881a400Schristos	  # Link the convenience library
6181*6881a400Schristos	  if test "$linkmode" = lib; then
6182*6881a400Schristos	    deplibs="$dir/$old_library $deplibs"
6183*6881a400Schristos	  elif test "$linkmode,$pass" = "prog,link"; then
6184*6881a400Schristos	    compile_deplibs="$dir/$old_library $compile_deplibs"
6185*6881a400Schristos	    finalize_deplibs="$dir/$old_library $finalize_deplibs"
6186*6881a400Schristos	  else
6187*6881a400Schristos	    deplibs="$lib $deplibs" # used for prog,scan pass
6188*6881a400Schristos	  fi
6189*6881a400Schristos	  continue
6190*6881a400Schristos	fi
6191*6881a400Schristos
6192*6881a400Schristos
6193*6881a400Schristos	if test "$linkmode" = prog && test "$pass" != link; then
6194*6881a400Schristos	  newlib_search_path="$newlib_search_path $ladir"
6195*6881a400Schristos	  deplibs="$lib $deplibs"
6196*6881a400Schristos
6197*6881a400Schristos	  linkalldeplibs=no
6198*6881a400Schristos	  if test "$link_all_deplibs" != no || test -z "$library_names" ||
6199*6881a400Schristos	     test "$build_libtool_libs" = no; then
6200*6881a400Schristos	    linkalldeplibs=yes
6201*6881a400Schristos	  fi
6202*6881a400Schristos
6203*6881a400Schristos	  tmp_libs=
6204*6881a400Schristos	  for deplib in $dependency_libs; do
6205*6881a400Schristos	    case $deplib in
6206*6881a400Schristos	    -L*) func_stripname '-L' '' "$deplib"
6207*6881a400Schristos	         newlib_search_path="$newlib_search_path $func_stripname_result"
6208*6881a400Schristos		 ;;
6209*6881a400Schristos	    esac
6210*6881a400Schristos	    # Need to link against all dependency_libs?
6211*6881a400Schristos	    if test "$linkalldeplibs" = yes; then
6212*6881a400Schristos	      deplibs="$deplib $deplibs"
6213*6881a400Schristos	    else
6214*6881a400Schristos	      # Need to hardcode shared library paths
6215*6881a400Schristos	      # or/and link against static libraries
6216*6881a400Schristos	      newdependency_libs="$deplib $newdependency_libs"
6217*6881a400Schristos	    fi
6218*6881a400Schristos	    if $opt_duplicate_deps ; then
6219*6881a400Schristos	      case "$tmp_libs " in
6220*6881a400Schristos	      *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
6221*6881a400Schristos	      esac
6222*6881a400Schristos	    fi
6223*6881a400Schristos	    tmp_libs="$tmp_libs $deplib"
6224*6881a400Schristos	  done # for deplib
6225*6881a400Schristos	  continue
6226*6881a400Schristos	fi # $linkmode = prog...
6227*6881a400Schristos
6228*6881a400Schristos	if test "$linkmode,$pass" = "prog,link"; then
6229*6881a400Schristos	  if test -n "$library_names" &&
6230*6881a400Schristos	     { { test "$prefer_static_libs" = no ||
6231*6881a400Schristos	         test "$prefer_static_libs,$installed" = "built,yes"; } ||
6232*6881a400Schristos	       test -z "$old_library"; }; then
6233*6881a400Schristos	    # We need to hardcode the library path
6234*6881a400Schristos	    if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then
6235*6881a400Schristos	      # Make sure the rpath contains only unique directories.
6236*6881a400Schristos	      case "$temp_rpath:" in
6237*6881a400Schristos	      *"$absdir:"*) ;;
6238*6881a400Schristos	      *) temp_rpath="$temp_rpath$absdir:" ;;
6239*6881a400Schristos	      esac
6240*6881a400Schristos	    fi
6241*6881a400Schristos
6242*6881a400Schristos	    # Hardcode the library path.
6243*6881a400Schristos	    # Skip directories that are in the system default run-time
6244*6881a400Schristos	    # search path.
6245*6881a400Schristos	    case " $sys_lib_dlsearch_path " in
6246*6881a400Schristos	    *" $absdir "*) ;;
6247*6881a400Schristos	    *)
6248*6881a400Schristos	      case "$compile_rpath " in
6249*6881a400Schristos	      *" $absdir "*) ;;
6250*6881a400Schristos	      *) compile_rpath="$compile_rpath $absdir"
6251*6881a400Schristos	      esac
6252*6881a400Schristos	      ;;
6253*6881a400Schristos	    esac
6254*6881a400Schristos	    case " $sys_lib_dlsearch_path " in
6255*6881a400Schristos	    *" $libdir "*) ;;
6256*6881a400Schristos	    *)
6257*6881a400Schristos	      case "$finalize_rpath " in
6258*6881a400Schristos	      *" $libdir "*) ;;
6259*6881a400Schristos	      *) finalize_rpath="$finalize_rpath $libdir"
6260*6881a400Schristos	      esac
6261*6881a400Schristos	      ;;
6262*6881a400Schristos	    esac
6263*6881a400Schristos	  fi # $linkmode,$pass = prog,link...
6264*6881a400Schristos
6265*6881a400Schristos	  if test "$alldeplibs" = yes &&
6266*6881a400Schristos	     { test "$deplibs_check_method" = pass_all ||
6267*6881a400Schristos	       { test "$build_libtool_libs" = yes &&
6268*6881a400Schristos		 test -n "$library_names"; }; }; then
6269*6881a400Schristos	    # We only need to search for static libraries
6270*6881a400Schristos	    continue
6271*6881a400Schristos	  fi
6272*6881a400Schristos	fi
6273*6881a400Schristos
6274*6881a400Schristos	link_static=no # Whether the deplib will be linked statically
6275*6881a400Schristos	use_static_libs=$prefer_static_libs
6276*6881a400Schristos	if test "$use_static_libs" = built && test "$installed" = yes; then
6277*6881a400Schristos	  use_static_libs=no
6278*6881a400Schristos	fi
6279*6881a400Schristos	if test -n "$library_names" &&
6280*6881a400Schristos	   { test "$use_static_libs" = no || test -z "$old_library"; }; then
6281*6881a400Schristos	  case $host in
6282*6881a400Schristos	  *cygwin* | *mingw* | *cegcc*)
6283*6881a400Schristos	      # No point in relinking DLLs because paths are not encoded
6284*6881a400Schristos	      notinst_deplibs="$notinst_deplibs $lib"
6285*6881a400Schristos	      need_relink=no
6286*6881a400Schristos	    ;;
6287*6881a400Schristos	  *)
6288*6881a400Schristos	    if test "$installed" = no; then
6289*6881a400Schristos	      notinst_deplibs="$notinst_deplibs $lib"
6290*6881a400Schristos	      need_relink=yes
6291*6881a400Schristos	    fi
6292*6881a400Schristos	    ;;
6293*6881a400Schristos	  esac
6294*6881a400Schristos	  # This is a shared library
6295*6881a400Schristos
6296*6881a400Schristos	  # Warn about portability, can't link against -module's on some
6297*6881a400Schristos	  # systems (darwin).  Don't bleat about dlopened modules though!
6298*6881a400Schristos	  dlopenmodule=""
6299*6881a400Schristos	  for dlpremoduletest in $dlprefiles; do
6300*6881a400Schristos	    if test "X$dlpremoduletest" = "X$lib"; then
6301*6881a400Schristos	      dlopenmodule="$dlpremoduletest"
6302*6881a400Schristos	      break
6303*6881a400Schristos	    fi
6304*6881a400Schristos	  done
6305*6881a400Schristos	  if test -z "$dlopenmodule" && test "$shouldnotlink" = yes && test "$pass" = link; then
6306*6881a400Schristos	    echo
6307*6881a400Schristos	    if test "$linkmode" = prog; then
6308*6881a400Schristos	      $ECHO "*** Warning: Linking the executable $output against the loadable module"
6309*6881a400Schristos	    else
6310*6881a400Schristos	      $ECHO "*** Warning: Linking the shared library $output against the loadable module"
6311*6881a400Schristos	    fi
6312*6881a400Schristos	    $ECHO "*** $linklib is not portable!"
6313*6881a400Schristos	  fi
6314*6881a400Schristos	  if test "$linkmode" = lib &&
6315*6881a400Schristos	     test "$hardcode_into_libs" = yes; then
6316*6881a400Schristos	    # Hardcode the library path.
6317*6881a400Schristos	    # Skip directories that are in the system default run-time
6318*6881a400Schristos	    # search path.
6319*6881a400Schristos	    case " $sys_lib_dlsearch_path " in
6320*6881a400Schristos	    *" $absdir "*) ;;
6321*6881a400Schristos	    *)
6322*6881a400Schristos	      case "$compile_rpath " in
6323*6881a400Schristos	      *" $absdir "*) ;;
6324*6881a400Schristos	      *) compile_rpath="$compile_rpath $absdir"
6325*6881a400Schristos	      esac
6326*6881a400Schristos	      ;;
6327*6881a400Schristos	    esac
6328*6881a400Schristos	    case " $sys_lib_dlsearch_path " in
6329*6881a400Schristos	    *" $libdir "*) ;;
6330*6881a400Schristos	    *)
6331*6881a400Schristos	      case "$finalize_rpath " in
6332*6881a400Schristos	      *" $libdir "*) ;;
6333*6881a400Schristos	      *) finalize_rpath="$finalize_rpath $libdir"
6334*6881a400Schristos	      esac
6335*6881a400Schristos	      ;;
6336*6881a400Schristos	    esac
6337*6881a400Schristos	  fi
6338*6881a400Schristos
6339*6881a400Schristos	  if test -n "$old_archive_from_expsyms_cmds"; then
6340*6881a400Schristos	    # figure out the soname
6341*6881a400Schristos	    set dummy $library_names
6342*6881a400Schristos	    shift
6343*6881a400Schristos	    realname="$1"
6344*6881a400Schristos	    shift
6345*6881a400Schristos	    eval "libname=\"$libname_spec\""
6346*6881a400Schristos	    # use dlname if we got it. it's perfectly good, no?
6347*6881a400Schristos	    if test -n "$dlname"; then
6348*6881a400Schristos	      soname="$dlname"
6349*6881a400Schristos	    elif test -n "$soname_spec"; then
6350*6881a400Schristos	      # bleh windows
6351*6881a400Schristos	      case $host in
6352*6881a400Schristos	      *cygwin* | mingw* | *cegcc*)
6353*6881a400Schristos	        func_arith $current - $age
6354*6881a400Schristos		major=$func_arith_result
6355*6881a400Schristos		versuffix="-$major"
6356*6881a400Schristos		;;
6357*6881a400Schristos	      esac
6358*6881a400Schristos	      eval "soname=\"$soname_spec\""
6359*6881a400Schristos	    else
6360*6881a400Schristos	      soname="$realname"
6361*6881a400Schristos	    fi
6362*6881a400Schristos
6363*6881a400Schristos	    # Make a new name for the extract_expsyms_cmds to use
6364*6881a400Schristos	    soroot="$soname"
6365*6881a400Schristos	    func_basename "$soroot"
6366*6881a400Schristos	    soname="$func_basename_result"
6367*6881a400Schristos	    func_stripname 'lib' '.dll' "$soname"
6368*6881a400Schristos	    newlib=libimp-$func_stripname_result.a
6369*6881a400Schristos
6370*6881a400Schristos	    # If the library has no export list, then create one now
6371*6881a400Schristos	    if test -f "$output_objdir/$soname-def"; then :
6372*6881a400Schristos	    else
6373*6881a400Schristos	      func_verbose "extracting exported symbol list from \`$soname'"
6374*6881a400Schristos	      func_execute_cmds "$extract_expsyms_cmds" 'exit $?'
6375*6881a400Schristos	    fi
6376*6881a400Schristos
6377*6881a400Schristos	    # Create $newlib
6378*6881a400Schristos	    if test -f "$output_objdir/$newlib"; then :; else
6379*6881a400Schristos	      func_verbose "generating import library for \`$soname'"
6380*6881a400Schristos	      func_execute_cmds "$old_archive_from_expsyms_cmds" 'exit $?'
6381*6881a400Schristos	    fi
6382*6881a400Schristos	    # make sure the library variables are pointing to the new library
6383*6881a400Schristos	    dir=$output_objdir
6384*6881a400Schristos	    linklib=$newlib
6385*6881a400Schristos	  fi # test -n "$old_archive_from_expsyms_cmds"
6386*6881a400Schristos
6387*6881a400Schristos	  if test "$linkmode" = prog || test "$mode" != relink; then
6388*6881a400Schristos	    add_shlibpath=
6389*6881a400Schristos	    add_dir=
6390*6881a400Schristos	    add=
6391*6881a400Schristos	    lib_linked=yes
6392*6881a400Schristos	    case $hardcode_action in
6393*6881a400Schristos	    immediate | unsupported)
6394*6881a400Schristos	      if test "$hardcode_direct" = no; then
6395*6881a400Schristos		add="$dir/$linklib"
6396*6881a400Schristos		case $host in
6397*6881a400Schristos		  *-*-sco3.2v5.0.[024]*) add_dir="-L$dir" ;;
6398*6881a400Schristos		  *-*-sysv4*uw2*) add_dir="-L$dir" ;;
6399*6881a400Schristos		  *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \
6400*6881a400Schristos		    *-*-unixware7*) add_dir="-L$dir" ;;
6401*6881a400Schristos		  *-*-darwin* )
6402*6881a400Schristos		    # if the lib is a (non-dlopened) module then we can not
6403*6881a400Schristos		    # link against it, someone is ignoring the earlier warnings
6404*6881a400Schristos		    if /usr/bin/file -L $add 2> /dev/null |
6405*6881a400Schristos			 $GREP ": [^:]* bundle" >/dev/null ; then
6406*6881a400Schristos		      if test "X$dlopenmodule" != "X$lib"; then
6407*6881a400Schristos			$ECHO "*** Warning: lib $linklib is a module, not a shared library"
6408*6881a400Schristos			if test -z "$old_library" ; then
6409*6881a400Schristos			  echo
6410*6881a400Schristos			  echo "*** And there doesn't seem to be a static archive available"
6411*6881a400Schristos			  echo "*** The link will probably fail, sorry"
6412*6881a400Schristos			else
6413*6881a400Schristos			  add="$dir/$old_library"
6414*6881a400Schristos			fi
6415*6881a400Schristos		      elif test -n "$old_library"; then
6416*6881a400Schristos			add="$dir/$old_library"
6417*6881a400Schristos		      fi
6418*6881a400Schristos		    fi
6419*6881a400Schristos		esac
6420*6881a400Schristos	      elif test "$hardcode_minus_L" = no; then
6421*6881a400Schristos		case $host in
6422*6881a400Schristos		*-*-sunos*) add_shlibpath="$dir" ;;
6423*6881a400Schristos		esac
6424*6881a400Schristos		add_dir="-L$dir"
6425*6881a400Schristos		add="-l$name"
6426*6881a400Schristos	      elif test "$hardcode_shlibpath_var" = no; then
6427*6881a400Schristos		add_shlibpath="$dir"
6428*6881a400Schristos		add="-l$name"
6429*6881a400Schristos	      else
6430*6881a400Schristos		lib_linked=no
6431*6881a400Schristos	      fi
6432*6881a400Schristos	      ;;
6433*6881a400Schristos	    relink)
6434*6881a400Schristos	      if test "$hardcode_direct" = yes &&
6435*6881a400Schristos	         test "$hardcode_direct_absolute" = no; then
6436*6881a400Schristos		add="$dir/$linklib"
6437*6881a400Schristos	      elif test "$hardcode_minus_L" = yes; then
6438*6881a400Schristos		add_dir="-L$absdir"
6439*6881a400Schristos		# Try looking first in the location we're being installed to.
6440*6881a400Schristos		if test -n "$inst_prefix_dir"; then
6441*6881a400Schristos		  case $libdir in
6442*6881a400Schristos		    [\\/]*)
6443*6881a400Schristos		      add_dir="$add_dir -L$inst_prefix_dir$libdir"
6444*6881a400Schristos		      ;;
6445*6881a400Schristos		  esac
6446*6881a400Schristos		fi
6447*6881a400Schristos		add="-l$name"
6448*6881a400Schristos	      elif test "$hardcode_shlibpath_var" = yes; then
6449*6881a400Schristos		add_shlibpath="$dir"
6450*6881a400Schristos		add="-l$name"
6451*6881a400Schristos	      else
6452*6881a400Schristos		lib_linked=no
6453*6881a400Schristos	      fi
6454*6881a400Schristos	      ;;
6455*6881a400Schristos	    *) lib_linked=no ;;
6456*6881a400Schristos	    esac
6457*6881a400Schristos
6458*6881a400Schristos	    if test "$lib_linked" != yes; then
6459*6881a400Schristos	      func_fatal_configuration "unsupported hardcode properties"
6460*6881a400Schristos	    fi
6461*6881a400Schristos
6462*6881a400Schristos	    if test -n "$add_shlibpath"; then
6463*6881a400Schristos	      case :$compile_shlibpath: in
6464*6881a400Schristos	      *":$add_shlibpath:"*) ;;
6465*6881a400Schristos	      *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;;
6466*6881a400Schristos	      esac
6467*6881a400Schristos	    fi
6468*6881a400Schristos	    if test "$linkmode" = prog; then
6469*6881a400Schristos	      test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs"
6470*6881a400Schristos	      test -n "$add" && compile_deplibs="$add $compile_deplibs"
6471*6881a400Schristos	    else
6472*6881a400Schristos	      test -n "$add_dir" && deplibs="$add_dir $deplibs"
6473*6881a400Schristos	      test -n "$add" && deplibs="$add $deplibs"
6474*6881a400Schristos	      if test "$hardcode_direct" != yes &&
6475*6881a400Schristos		 test "$hardcode_minus_L" != yes &&
6476*6881a400Schristos		 test "$hardcode_shlibpath_var" = yes; then
6477*6881a400Schristos		case :$finalize_shlibpath: in
6478*6881a400Schristos		*":$libdir:"*) ;;
6479*6881a400Schristos		*) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
6480*6881a400Schristos		esac
6481*6881a400Schristos	      fi
6482*6881a400Schristos	    fi
6483*6881a400Schristos	  fi
6484*6881a400Schristos
6485*6881a400Schristos	  if test "$linkmode" = prog || test "$mode" = relink; then
6486*6881a400Schristos	    add_shlibpath=
6487*6881a400Schristos	    add_dir=
6488*6881a400Schristos	    add=
6489*6881a400Schristos	    # Finalize command for both is simple: just hardcode it.
6490*6881a400Schristos	    if test "$hardcode_direct" = yes &&
6491*6881a400Schristos	       test "$hardcode_direct_absolute" = no; then
6492*6881a400Schristos	      add="$libdir/$linklib"
6493*6881a400Schristos	    elif test "$hardcode_minus_L" = yes; then
6494*6881a400Schristos	      add_dir="-L$libdir"
6495*6881a400Schristos	      add="-l$name"
6496*6881a400Schristos	    elif test "$hardcode_shlibpath_var" = yes; then
6497*6881a400Schristos	      case :$finalize_shlibpath: in
6498*6881a400Schristos	      *":$libdir:"*) ;;
6499*6881a400Schristos	      *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
6500*6881a400Schristos	      esac
6501*6881a400Schristos	      add="-l$name"
6502*6881a400Schristos	    elif test "$hardcode_automatic" = yes; then
6503*6881a400Schristos	      if test -n "$inst_prefix_dir" &&
6504*6881a400Schristos		 test -f "$inst_prefix_dir$libdir/$linklib" ; then
6505*6881a400Schristos		add="$inst_prefix_dir$libdir/$linklib"
6506*6881a400Schristos	      else
6507*6881a400Schristos		add="$libdir/$linklib"
6508*6881a400Schristos	      fi
6509*6881a400Schristos	    else
6510*6881a400Schristos	      # We cannot seem to hardcode it, guess we'll fake it.
6511*6881a400Schristos	      add_dir="-L$libdir"
6512*6881a400Schristos	      # Try looking first in the location we're being installed to.
6513*6881a400Schristos	      if test -n "$inst_prefix_dir"; then
6514*6881a400Schristos		case $libdir in
6515*6881a400Schristos		  [\\/]*)
6516*6881a400Schristos		    add_dir="$add_dir -L$inst_prefix_dir$libdir"
6517*6881a400Schristos		    ;;
6518*6881a400Schristos		esac
6519*6881a400Schristos	      fi
6520*6881a400Schristos	      add="-l$name"
6521*6881a400Schristos	    fi
6522*6881a400Schristos
6523*6881a400Schristos	    if test "$linkmode" = prog; then
6524*6881a400Schristos	      test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs"
6525*6881a400Schristos	      test -n "$add" && finalize_deplibs="$add $finalize_deplibs"
6526*6881a400Schristos	    else
6527*6881a400Schristos	      test -n "$add_dir" && deplibs="$add_dir $deplibs"
6528*6881a400Schristos	      test -n "$add" && deplibs="$add $deplibs"
6529*6881a400Schristos	    fi
6530*6881a400Schristos	  fi
6531*6881a400Schristos	elif test "$linkmode" = prog; then
6532*6881a400Schristos	  # Here we assume that one of hardcode_direct or hardcode_minus_L
6533*6881a400Schristos	  # is not unsupported.  This is valid on all known static and
6534*6881a400Schristos	  # shared platforms.
6535*6881a400Schristos	  if test "$hardcode_direct" != unsupported; then
6536*6881a400Schristos	    test -n "$old_library" && linklib="$old_library"
6537*6881a400Schristos	    compile_deplibs="$dir/$linklib $compile_deplibs"
6538*6881a400Schristos	    finalize_deplibs="$dir/$linklib $finalize_deplibs"
6539*6881a400Schristos	  else
6540*6881a400Schristos	    compile_deplibs="-l$name -L$dir $compile_deplibs"
6541*6881a400Schristos	    finalize_deplibs="-l$name -L$dir $finalize_deplibs"
6542*6881a400Schristos	  fi
6543*6881a400Schristos	elif test "$build_libtool_libs" = yes; then
6544*6881a400Schristos	  # Not a shared library
6545*6881a400Schristos	  if test "$deplibs_check_method" != pass_all; then
6546*6881a400Schristos	    # We're trying link a shared library against a static one
6547*6881a400Schristos	    # but the system doesn't support it.
6548*6881a400Schristos
6549*6881a400Schristos	    # Just print a warning and add the library to dependency_libs so
6550*6881a400Schristos	    # that the program can be linked against the static library.
6551*6881a400Schristos	    echo
6552*6881a400Schristos	    $ECHO "*** Warning: This system can not link to static lib archive $lib."
6553*6881a400Schristos	    echo "*** I have the capability to make that library automatically link in when"
6554*6881a400Schristos	    echo "*** you link to this library.  But I can only do this if you have a"
6555*6881a400Schristos	    echo "*** shared version of the library, which you do not appear to have."
6556*6881a400Schristos	    if test "$module" = yes; then
6557*6881a400Schristos	      echo "*** But as you try to build a module library, libtool will still create "
6558*6881a400Schristos	      echo "*** a static module, that should work as long as the dlopening application"
6559*6881a400Schristos	      echo "*** is linked with the -dlopen flag to resolve symbols at runtime."
6560*6881a400Schristos	      if test -z "$global_symbol_pipe"; then
6561*6881a400Schristos		echo
6562*6881a400Schristos		echo "*** However, this would only work if libtool was able to extract symbol"
6563*6881a400Schristos		echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
6564*6881a400Schristos		echo "*** not find such a program.  So, this module is probably useless."
6565*6881a400Schristos		echo "*** \`nm' from GNU binutils and a full rebuild may help."
6566*6881a400Schristos	      fi
6567*6881a400Schristos	      if test "$build_old_libs" = no; then
6568*6881a400Schristos		build_libtool_libs=module
6569*6881a400Schristos		build_old_libs=yes
6570*6881a400Schristos	      else
6571*6881a400Schristos		build_libtool_libs=no
6572*6881a400Schristos	      fi
6573*6881a400Schristos	    fi
6574*6881a400Schristos	  else
6575*6881a400Schristos	    deplibs="$dir/$old_library $deplibs"
6576*6881a400Schristos	    link_static=yes
6577*6881a400Schristos	  fi
6578*6881a400Schristos	fi # link shared/static library?
6579*6881a400Schristos
6580*6881a400Schristos	if test "$linkmode" = lib; then
6581*6881a400Schristos	  if test -n "$dependency_libs" &&
6582*6881a400Schristos	     { test "$hardcode_into_libs" != yes ||
6583*6881a400Schristos	       test "$build_old_libs" = yes ||
6584*6881a400Schristos	       test "$link_static" = yes; }; then
6585*6881a400Schristos	    # Extract -R from dependency_libs
6586*6881a400Schristos	    temp_deplibs=
6587*6881a400Schristos	    for libdir in $dependency_libs; do
6588*6881a400Schristos	      case $libdir in
6589*6881a400Schristos	      -R*) func_stripname '-R' '' "$libdir"
6590*6881a400Schristos	           temp_xrpath=$func_stripname_result
6591*6881a400Schristos		   case " $xrpath " in
6592*6881a400Schristos		   *" $temp_xrpath "*) ;;
6593*6881a400Schristos		   *) xrpath="$xrpath $temp_xrpath";;
6594*6881a400Schristos		   esac;;
6595*6881a400Schristos	      *) temp_deplibs="$temp_deplibs $libdir";;
6596*6881a400Schristos	      esac
6597*6881a400Schristos	    done
6598*6881a400Schristos	    dependency_libs="$temp_deplibs"
6599*6881a400Schristos	  fi
6600*6881a400Schristos
6601*6881a400Schristos	  newlib_search_path="$newlib_search_path $absdir"
6602*6881a400Schristos	  # Link against this library
6603*6881a400Schristos	  test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs"
6604*6881a400Schristos	  # ... and its dependency_libs
6605*6881a400Schristos	  tmp_libs=
6606*6881a400Schristos	  for deplib in $dependency_libs; do
6607*6881a400Schristos	    newdependency_libs="$deplib $newdependency_libs"
6608*6881a400Schristos	    if $opt_duplicate_deps ; then
6609*6881a400Schristos	      case "$tmp_libs " in
6610*6881a400Schristos	      *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
6611*6881a400Schristos	      esac
6612*6881a400Schristos	    fi
6613*6881a400Schristos	    tmp_libs="$tmp_libs $deplib"
6614*6881a400Schristos	  done
6615*6881a400Schristos
6616*6881a400Schristos	  if test "$link_all_deplibs" != no; then
6617*6881a400Schristos	    # Add the search paths of all dependency libraries
6618*6881a400Schristos	    for deplib in $dependency_libs; do
6619*6881a400Schristos	      path=
6620*6881a400Schristos	      case $deplib in
6621*6881a400Schristos	      -L*) path="$deplib" ;;
6622*6881a400Schristos	      *.la)
6623*6881a400Schristos	        func_dirname "$deplib" "" "."
6624*6881a400Schristos		dir="$func_dirname_result"
6625*6881a400Schristos		# We need an absolute path.
6626*6881a400Schristos		case $dir in
6627*6881a400Schristos		[\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;;
6628*6881a400Schristos		*)
6629*6881a400Schristos		  absdir=`cd "$dir" && pwd`
6630*6881a400Schristos		  if test -z "$absdir"; then
6631*6881a400Schristos		    func_warning "cannot determine absolute directory name of \`$dir'"
6632*6881a400Schristos		    absdir="$dir"
6633*6881a400Schristos		  fi
6634*6881a400Schristos		  ;;
6635*6881a400Schristos		esac
6636*6881a400Schristos		if $GREP "^installed=no" $deplib > /dev/null; then
6637*6881a400Schristos		case $host in
6638*6881a400Schristos		*-*-darwin*)
6639*6881a400Schristos		  depdepl=
6640*6881a400Schristos		  deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib`
6641*6881a400Schristos		  if test -n "$deplibrary_names" ; then
6642*6881a400Schristos		    for tmp in $deplibrary_names ; do
6643*6881a400Schristos		      depdepl=$tmp
6644*6881a400Schristos		    done
6645*6881a400Schristos		    if test -f "$absdir/$objdir/$depdepl" ; then
6646*6881a400Schristos		      depdepl="$absdir/$objdir/$depdepl"
6647*6881a400Schristos		      darwin_install_name=`${OTOOL} -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'`
6648*6881a400Schristos                      if test -z "$darwin_install_name"; then
6649*6881a400Schristos                          darwin_install_name=`${OTOOL64} -L $depdepl  | awk '{if (NR == 2) {print $1;exit}}'`
6650*6881a400Schristos                      fi
6651*6881a400Schristos		      compiler_flags="$compiler_flags ${wl}-dylib_file ${wl}${darwin_install_name}:${depdepl}"
6652*6881a400Schristos		      linker_flags="$linker_flags -dylib_file ${darwin_install_name}:${depdepl}"
6653*6881a400Schristos		      path=
6654*6881a400Schristos		    fi
6655*6881a400Schristos		  fi
6656*6881a400Schristos		  ;;
6657*6881a400Schristos		*)
6658*6881a400Schristos		  path="-L$absdir/$objdir"
6659*6881a400Schristos		  ;;
6660*6881a400Schristos		esac
6661*6881a400Schristos		else
6662*6881a400Schristos		  libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
6663*6881a400Schristos		  test -z "$libdir" && \
6664*6881a400Schristos		    func_fatal_error "\`$deplib' is not a valid libtool archive"
6665*6881a400Schristos		  test "$absdir" != "$libdir" && \
6666*6881a400Schristos		    func_warning "\`$deplib' seems to be moved"
6667*6881a400Schristos
6668*6881a400Schristos		  path="-L$absdir"
6669*6881a400Schristos		fi
6670*6881a400Schristos		;;
6671*6881a400Schristos	      esac
6672*6881a400Schristos	      case " $deplibs " in
6673*6881a400Schristos	      *" $path "*) ;;
6674*6881a400Schristos	      *) deplibs="$path $deplibs" ;;
6675*6881a400Schristos	      esac
6676*6881a400Schristos	    done
6677*6881a400Schristos	  fi # link_all_deplibs != no
6678*6881a400Schristos	fi # linkmode = lib
6679*6881a400Schristos      done # for deplib in $libs
6680*6881a400Schristos      if test "$pass" = link; then
6681*6881a400Schristos	if test "$linkmode" = "prog"; then
6682*6881a400Schristos	  compile_deplibs="$new_inherited_linker_flags $compile_deplibs"
6683*6881a400Schristos	  finalize_deplibs="$new_inherited_linker_flags $finalize_deplibs"
6684*6881a400Schristos	else
6685*6881a400Schristos	  compiler_flags="$compiler_flags "`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
6686*6881a400Schristos	fi
6687*6881a400Schristos      fi
6688*6881a400Schristos      dependency_libs="$newdependency_libs"
6689*6881a400Schristos      if test "$pass" = dlpreopen; then
6690*6881a400Schristos	# Link the dlpreopened libraries before other libraries
6691*6881a400Schristos	for deplib in $save_deplibs; do
6692*6881a400Schristos	  deplibs="$deplib $deplibs"
6693*6881a400Schristos	done
6694*6881a400Schristos      fi
6695*6881a400Schristos      if test "$pass" != dlopen; then
6696*6881a400Schristos	if test "$pass" != conv; then
6697*6881a400Schristos	  # Make sure lib_search_path contains only unique directories.
6698*6881a400Schristos	  lib_search_path=
6699*6881a400Schristos	  for dir in $newlib_search_path; do
6700*6881a400Schristos	    case "$lib_search_path " in
6701*6881a400Schristos	    *" $dir "*) ;;
6702*6881a400Schristos	    *) lib_search_path="$lib_search_path $dir" ;;
6703*6881a400Schristos	    esac
6704*6881a400Schristos	  done
6705*6881a400Schristos	  newlib_search_path=
6706*6881a400Schristos	fi
6707*6881a400Schristos
6708*6881a400Schristos	if test "$linkmode,$pass" != "prog,link"; then
6709*6881a400Schristos	  vars="deplibs"
6710*6881a400Schristos	else
6711*6881a400Schristos	  vars="compile_deplibs finalize_deplibs"
6712*6881a400Schristos	fi
6713*6881a400Schristos	for var in $vars dependency_libs; do
6714*6881a400Schristos	  # Add libraries to $var in reverse order
6715*6881a400Schristos	  eval tmp_libs=\$$var
6716*6881a400Schristos	  new_libs=
6717*6881a400Schristos	  for deplib in $tmp_libs; do
6718*6881a400Schristos	    # FIXME: Pedantically, this is the right thing to do, so
6719*6881a400Schristos	    #        that some nasty dependency loop isn't accidentally
6720*6881a400Schristos	    #        broken:
6721*6881a400Schristos	    #new_libs="$deplib $new_libs"
6722*6881a400Schristos	    # Pragmatically, this seems to cause very few problems in
6723*6881a400Schristos	    # practice:
6724*6881a400Schristos	    case $deplib in
6725*6881a400Schristos	    -L*) new_libs="$deplib $new_libs" ;;
6726*6881a400Schristos	    -R*) ;;
6727*6881a400Schristos	    *)
6728*6881a400Schristos	      # And here is the reason: when a library appears more
6729*6881a400Schristos	      # than once as an explicit dependence of a library, or
6730*6881a400Schristos	      # is implicitly linked in more than once by the
6731*6881a400Schristos	      # compiler, it is considered special, and multiple
6732*6881a400Schristos	      # occurrences thereof are not removed.  Compare this
6733*6881a400Schristos	      # with having the same library being listed as a
6734*6881a400Schristos	      # dependency of multiple other libraries: in this case,
6735*6881a400Schristos	      # we know (pedantically, we assume) the library does not
6736*6881a400Schristos	      # need to be listed more than once, so we keep only the
6737*6881a400Schristos	      # last copy.  This is not always right, but it is rare
6738*6881a400Schristos	      # enough that we require users that really mean to play
6739*6881a400Schristos	      # such unportable linking tricks to link the library
6740*6881a400Schristos	      # using -Wl,-lname, so that libtool does not consider it
6741*6881a400Schristos	      # for duplicate removal.
6742*6881a400Schristos	      case " $specialdeplibs " in
6743*6881a400Schristos	      *" $deplib "*) new_libs="$deplib $new_libs" ;;
6744*6881a400Schristos	      *)
6745*6881a400Schristos		case " $new_libs " in
6746*6881a400Schristos		*" $deplib "*) ;;
6747*6881a400Schristos		*) new_libs="$deplib $new_libs" ;;
6748*6881a400Schristos		esac
6749*6881a400Schristos		;;
6750*6881a400Schristos	      esac
6751*6881a400Schristos	      ;;
6752*6881a400Schristos	    esac
6753*6881a400Schristos	  done
6754*6881a400Schristos	  tmp_libs=
6755*6881a400Schristos	  for deplib in $new_libs; do
6756*6881a400Schristos	    case $deplib in
6757*6881a400Schristos	    -L*)
6758*6881a400Schristos	      case " $tmp_libs " in
6759*6881a400Schristos	      *" $deplib "*) ;;
6760*6881a400Schristos	      *) tmp_libs="$tmp_libs $deplib" ;;
6761*6881a400Schristos	      esac
6762*6881a400Schristos	      ;;
6763*6881a400Schristos	    *) tmp_libs="$tmp_libs $deplib" ;;
6764*6881a400Schristos	    esac
6765*6881a400Schristos	  done
6766*6881a400Schristos	  eval $var=\$tmp_libs
6767*6881a400Schristos	done # for var
6768*6881a400Schristos      fi
6769*6881a400Schristos      # Last step: remove runtime libs from dependency_libs
6770*6881a400Schristos      # (they stay in deplibs)
6771*6881a400Schristos      tmp_libs=
6772*6881a400Schristos      for i in $dependency_libs ; do
6773*6881a400Schristos	case " $predeps $postdeps $compiler_lib_search_path " in
6774*6881a400Schristos	*" $i "*)
6775*6881a400Schristos	  i=""
6776*6881a400Schristos	  ;;
6777*6881a400Schristos	esac
6778*6881a400Schristos	if test -n "$i" ; then
6779*6881a400Schristos	  tmp_libs="$tmp_libs $i"
6780*6881a400Schristos	fi
6781*6881a400Schristos      done
6782*6881a400Schristos      dependency_libs=$tmp_libs
6783*6881a400Schristos    done # for pass
6784*6881a400Schristos    if test "$linkmode" = prog; then
6785*6881a400Schristos      dlfiles="$newdlfiles"
6786*6881a400Schristos    fi
6787*6881a400Schristos    if test "$linkmode" = prog || test "$linkmode" = lib; then
6788*6881a400Schristos      dlprefiles="$newdlprefiles"
6789*6881a400Schristos    fi
6790*6881a400Schristos
6791*6881a400Schristos    case $linkmode in
6792*6881a400Schristos    oldlib)
6793*6881a400Schristos      if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
6794*6881a400Schristos	func_warning "\`-dlopen' is ignored for archives"
6795*6881a400Schristos      fi
6796*6881a400Schristos
6797*6881a400Schristos      case " $deplibs" in
6798*6881a400Schristos      *\ -l* | *\ -L*)
6799*6881a400Schristos	func_warning "\`-l' and \`-L' are ignored for archives" ;;
6800*6881a400Schristos      esac
6801*6881a400Schristos
6802*6881a400Schristos      test -n "$rpath" && \
6803*6881a400Schristos	func_warning "\`-rpath' is ignored for archives"
6804*6881a400Schristos
6805*6881a400Schristos      test -n "$xrpath" && \
6806*6881a400Schristos	func_warning "\`-R' is ignored for archives"
6807*6881a400Schristos
6808*6881a400Schristos      test -n "$vinfo" && \
6809*6881a400Schristos	func_warning "\`-version-info/-version-number' is ignored for archives"
6810*6881a400Schristos
6811*6881a400Schristos      test -n "$release" && \
6812*6881a400Schristos	func_warning "\`-release' is ignored for archives"
6813*6881a400Schristos
6814*6881a400Schristos      test -n "$export_symbols$export_symbols_regex" && \
6815*6881a400Schristos	func_warning "\`-export-symbols' is ignored for archives"
6816*6881a400Schristos
6817*6881a400Schristos      # Now set the variables for building old libraries.
6818*6881a400Schristos      build_libtool_libs=no
6819*6881a400Schristos      oldlibs="$output"
6820*6881a400Schristos      objs="$objs$old_deplibs"
6821*6881a400Schristos      ;;
6822*6881a400Schristos
6823*6881a400Schristos    lib)
6824*6881a400Schristos      # Make sure we only generate libraries of the form `libNAME.la'.
6825*6881a400Schristos      case $outputname in
6826*6881a400Schristos      lib*)
6827*6881a400Schristos	func_stripname 'lib' '.la' "$outputname"
6828*6881a400Schristos	name=$func_stripname_result
6829*6881a400Schristos	eval "shared_ext=\"$shrext_cmds\""
6830*6881a400Schristos	eval "libname=\"$libname_spec\""
6831*6881a400Schristos	;;
6832*6881a400Schristos      *)
6833*6881a400Schristos	test "$module" = no && \
6834*6881a400Schristos	  func_fatal_help "libtool library \`$output' must begin with \`lib'"
6835*6881a400Schristos
6836*6881a400Schristos	if test "$need_lib_prefix" != no; then
6837*6881a400Schristos	  # Add the "lib" prefix for modules if required
6838*6881a400Schristos	  func_stripname '' '.la' "$outputname"
6839*6881a400Schristos	  name=$func_stripname_result
6840*6881a400Schristos	  eval "shared_ext=\"$shrext_cmds\""
6841*6881a400Schristos	  eval "libname=\"$libname_spec\""
6842*6881a400Schristos	else
6843*6881a400Schristos	  func_stripname '' '.la' "$outputname"
6844*6881a400Schristos	  libname=$func_stripname_result
6845*6881a400Schristos	fi
6846*6881a400Schristos	;;
6847*6881a400Schristos      esac
6848*6881a400Schristos
6849*6881a400Schristos      if test -n "$objs"; then
6850*6881a400Schristos	if test "$deplibs_check_method" != pass_all; then
6851*6881a400Schristos	  func_fatal_error "cannot build libtool library \`$output' from non-libtool objects on this host:$objs"
6852*6881a400Schristos	else
6853*6881a400Schristos	  echo
6854*6881a400Schristos	  $ECHO "*** Warning: Linking the shared library $output against the non-libtool"
6855*6881a400Schristos	  $ECHO "*** objects $objs is not portable!"
6856*6881a400Schristos	  libobjs="$libobjs $objs"
6857*6881a400Schristos	fi
6858*6881a400Schristos      fi
6859*6881a400Schristos
6860*6881a400Schristos      test "$dlself" != no && \
6861*6881a400Schristos	func_warning "\`-dlopen self' is ignored for libtool libraries"
6862*6881a400Schristos
6863*6881a400Schristos      set dummy $rpath
6864*6881a400Schristos      shift
6865*6881a400Schristos      test "$#" -gt 1 && \
6866*6881a400Schristos	func_warning "ignoring multiple \`-rpath's for a libtool library"
6867*6881a400Schristos
6868*6881a400Schristos      install_libdir="$1"
6869*6881a400Schristos
6870*6881a400Schristos      oldlibs=
6871*6881a400Schristos      if test -z "$rpath"; then
6872*6881a400Schristos	if test "$build_libtool_libs" = yes; then
6873*6881a400Schristos	  # Building a libtool convenience library.
6874*6881a400Schristos	  # Some compilers have problems with a `.al' extension so
6875*6881a400Schristos	  # convenience libraries should have the same extension an
6876*6881a400Schristos	  # archive normally would.
6877*6881a400Schristos	  oldlibs="$output_objdir/$libname.$libext $oldlibs"
6878*6881a400Schristos	  build_libtool_libs=convenience
6879*6881a400Schristos	  build_old_libs=yes
6880*6881a400Schristos	fi
6881*6881a400Schristos
6882*6881a400Schristos	test -n "$vinfo" && \
6883*6881a400Schristos	  func_warning "\`-version-info/-version-number' is ignored for convenience libraries"
6884*6881a400Schristos
6885*6881a400Schristos	test -n "$release" && \
6886*6881a400Schristos	  func_warning "\`-release' is ignored for convenience libraries"
6887*6881a400Schristos      else
6888*6881a400Schristos
6889*6881a400Schristos	# Parse the version information argument.
6890*6881a400Schristos	save_ifs="$IFS"; IFS=':'
6891*6881a400Schristos	set dummy $vinfo 0 0 0
6892*6881a400Schristos	shift
6893*6881a400Schristos	IFS="$save_ifs"
6894*6881a400Schristos
6895*6881a400Schristos	test -n "$7" && \
6896*6881a400Schristos	  func_fatal_help "too many parameters to \`-version-info'"
6897*6881a400Schristos
6898*6881a400Schristos	# convert absolute version numbers to libtool ages
6899*6881a400Schristos	# this retains compatibility with .la files and attempts
6900*6881a400Schristos	# to make the code below a bit more comprehensible
6901*6881a400Schristos
6902*6881a400Schristos	case $vinfo_number in
6903*6881a400Schristos	yes)
6904*6881a400Schristos	  number_major="$1"
6905*6881a400Schristos	  number_minor="$2"
6906*6881a400Schristos	  number_revision="$3"
6907*6881a400Schristos	  #
6908*6881a400Schristos	  # There are really only two kinds -- those that
6909*6881a400Schristos	  # use the current revision as the major version
6910*6881a400Schristos	  # and those that subtract age and use age as
6911*6881a400Schristos	  # a minor version.  But, then there is irix
6912*6881a400Schristos	  # which has an extra 1 added just for fun
6913*6881a400Schristos	  #
6914*6881a400Schristos	  case $version_type in
6915*6881a400Schristos	  darwin|linux|osf|windows|none)
6916*6881a400Schristos	    func_arith $number_major + $number_minor
6917*6881a400Schristos	    current=$func_arith_result
6918*6881a400Schristos	    age="$number_minor"
6919*6881a400Schristos	    revision="$number_revision"
6920*6881a400Schristos	    ;;
6921*6881a400Schristos	  freebsd-aout|freebsd-elf|qnx|sunos)
6922*6881a400Schristos	    current="$number_major"
6923*6881a400Schristos	    revision="$number_minor"
6924*6881a400Schristos	    age="0"
6925*6881a400Schristos	    ;;
6926*6881a400Schristos	  irix|nonstopux)
6927*6881a400Schristos	    func_arith $number_major + $number_minor
6928*6881a400Schristos	    current=$func_arith_result
6929*6881a400Schristos	    age="$number_minor"
6930*6881a400Schristos	    revision="$number_minor"
6931*6881a400Schristos	    lt_irix_increment=no
6932*6881a400Schristos	    ;;
6933*6881a400Schristos	  esac
6934*6881a400Schristos	  ;;
6935*6881a400Schristos	no)
6936*6881a400Schristos	  current="$1"
6937*6881a400Schristos	  revision="$2"
6938*6881a400Schristos	  age="$3"
6939*6881a400Schristos	  ;;
6940*6881a400Schristos	esac
6941*6881a400Schristos
6942*6881a400Schristos	# Check that each of the things are valid numbers.
6943*6881a400Schristos	case $current in
6944*6881a400Schristos	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]) ;;
6945*6881a400Schristos	*)
6946*6881a400Schristos	  func_error "CURRENT \`$current' must be a nonnegative integer"
6947*6881a400Schristos	  func_fatal_error "\`$vinfo' is not valid version information"
6948*6881a400Schristos	  ;;
6949*6881a400Schristos	esac
6950*6881a400Schristos
6951*6881a400Schristos	case $revision in
6952*6881a400Schristos	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]) ;;
6953*6881a400Schristos	*)
6954*6881a400Schristos	  func_error "REVISION \`$revision' must be a nonnegative integer"
6955*6881a400Schristos	  func_fatal_error "\`$vinfo' is not valid version information"
6956*6881a400Schristos	  ;;
6957*6881a400Schristos	esac
6958*6881a400Schristos
6959*6881a400Schristos	case $age in
6960*6881a400Schristos	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]) ;;
6961*6881a400Schristos	*)
6962*6881a400Schristos	  func_error "AGE \`$age' must be a nonnegative integer"
6963*6881a400Schristos	  func_fatal_error "\`$vinfo' is not valid version information"
6964*6881a400Schristos	  ;;
6965*6881a400Schristos	esac
6966*6881a400Schristos
6967*6881a400Schristos	if test "$age" -gt "$current"; then
6968*6881a400Schristos	  func_error "AGE \`$age' is greater than the current interface number \`$current'"
6969*6881a400Schristos	  func_fatal_error "\`$vinfo' is not valid version information"
6970*6881a400Schristos	fi
6971*6881a400Schristos
6972*6881a400Schristos	# Calculate the version variables.
6973*6881a400Schristos	major=
6974*6881a400Schristos	versuffix=
6975*6881a400Schristos	verstring=
6976*6881a400Schristos	case $version_type in
6977*6881a400Schristos	none) ;;
6978*6881a400Schristos
6979*6881a400Schristos	darwin)
6980*6881a400Schristos	  # Like Linux, but with the current version available in
6981*6881a400Schristos	  # verstring for coding it into the library header
6982*6881a400Schristos	  func_arith $current - $age
6983*6881a400Schristos	  major=.$func_arith_result
6984*6881a400Schristos	  versuffix="$major.$age.$revision"
6985*6881a400Schristos	  # Darwin ld doesn't like 0 for these options...
6986*6881a400Schristos	  func_arith $current + 1
6987*6881a400Schristos	  minor_current=$func_arith_result
6988*6881a400Schristos	  xlcverstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision"
6989*6881a400Schristos	  verstring="-compatibility_version $minor_current -current_version $minor_current.$revision"
6990*6881a400Schristos	  ;;
6991*6881a400Schristos
6992*6881a400Schristos	freebsd-aout)
6993*6881a400Schristos	  major=".$current"
6994*6881a400Schristos	  versuffix=".$current.$revision";
6995*6881a400Schristos	  ;;
6996*6881a400Schristos
6997*6881a400Schristos	freebsd-elf)
6998*6881a400Schristos	  major=".$current"
6999*6881a400Schristos	  versuffix=".$current"
7000*6881a400Schristos	  ;;
7001*6881a400Schristos
7002*6881a400Schristos	irix | nonstopux)
7003*6881a400Schristos	  if test "X$lt_irix_increment" = "Xno"; then
7004*6881a400Schristos	    func_arith $current - $age
7005*6881a400Schristos	  else
7006*6881a400Schristos	    func_arith $current - $age + 1
7007*6881a400Schristos	  fi
7008*6881a400Schristos	  major=$func_arith_result
7009*6881a400Schristos
7010*6881a400Schristos	  case $version_type in
7011*6881a400Schristos	    nonstopux) verstring_prefix=nonstopux ;;
7012*6881a400Schristos	    *)         verstring_prefix=sgi ;;
7013*6881a400Schristos	  esac
7014*6881a400Schristos	  verstring="$verstring_prefix$major.$revision"
7015*6881a400Schristos
7016*6881a400Schristos	  # Add in all the interfaces that we are compatible with.
7017*6881a400Schristos	  loop=$revision
7018*6881a400Schristos	  while test "$loop" -ne 0; do
7019*6881a400Schristos	    func_arith $revision - $loop
7020*6881a400Schristos	    iface=$func_arith_result
7021*6881a400Schristos	    func_arith $loop - 1
7022*6881a400Schristos	    loop=$func_arith_result
7023*6881a400Schristos	    verstring="$verstring_prefix$major.$iface:$verstring"
7024*6881a400Schristos	  done
7025*6881a400Schristos
7026*6881a400Schristos	  # Before this point, $major must not contain `.'.
7027*6881a400Schristos	  major=.$major
7028*6881a400Schristos	  versuffix="$major.$revision"
7029*6881a400Schristos	  ;;
7030*6881a400Schristos
7031*6881a400Schristos	linux)
7032*6881a400Schristos	  func_arith $current - $age
7033*6881a400Schristos	  major=.$func_arith_result
7034*6881a400Schristos	  versuffix="$major.$age.$revision"
7035*6881a400Schristos	  ;;
7036*6881a400Schristos
7037*6881a400Schristos	osf)
7038*6881a400Schristos	  func_arith $current - $age
7039*6881a400Schristos	  major=.$func_arith_result
7040*6881a400Schristos	  versuffix=".$current.$age.$revision"
7041*6881a400Schristos	  verstring="$current.$age.$revision"
7042*6881a400Schristos
7043*6881a400Schristos	  # Add in all the interfaces that we are compatible with.
7044*6881a400Schristos	  loop=$age
7045*6881a400Schristos	  while test "$loop" -ne 0; do
7046*6881a400Schristos	    func_arith $current - $loop
7047*6881a400Schristos	    iface=$func_arith_result
7048*6881a400Schristos	    func_arith $loop - 1
7049*6881a400Schristos	    loop=$func_arith_result
7050*6881a400Schristos	    verstring="$verstring:${iface}.0"
7051*6881a400Schristos	  done
7052*6881a400Schristos
7053*6881a400Schristos	  # Make executables depend on our current version.
7054*6881a400Schristos	  verstring="$verstring:${current}.0"
7055*6881a400Schristos	  ;;
7056*6881a400Schristos
7057*6881a400Schristos	qnx)
7058*6881a400Schristos	  major=".$current"
7059*6881a400Schristos	  versuffix=".$current"
7060*6881a400Schristos	  ;;
7061*6881a400Schristos
7062*6881a400Schristos	sunos)
7063*6881a400Schristos	  major=".$current"
7064*6881a400Schristos	  versuffix=".$current.$revision"
7065*6881a400Schristos	  ;;
7066*6881a400Schristos
7067*6881a400Schristos	windows)
7068*6881a400Schristos	  # Use '-' rather than '.', since we only want one
7069*6881a400Schristos	  # extension on DOS 8.3 filesystems.
7070*6881a400Schristos	  func_arith $current - $age
7071*6881a400Schristos	  major=$func_arith_result
7072*6881a400Schristos	  versuffix="-$major"
7073*6881a400Schristos	  ;;
7074*6881a400Schristos
7075*6881a400Schristos	*)
7076*6881a400Schristos	  func_fatal_configuration "unknown library version type \`$version_type'"
7077*6881a400Schristos	  ;;
7078*6881a400Schristos	esac
7079*6881a400Schristos
7080*6881a400Schristos	# Clear the version info if we defaulted, and they specified a release.
7081*6881a400Schristos	if test -z "$vinfo" && test -n "$release"; then
7082*6881a400Schristos	  major=
7083*6881a400Schristos	  case $version_type in
7084*6881a400Schristos	  darwin)
7085*6881a400Schristos	    # we can't check for "0.0" in archive_cmds due to quoting
7086*6881a400Schristos	    # problems, so we reset it completely
7087*6881a400Schristos	    verstring=
7088*6881a400Schristos	    ;;
7089*6881a400Schristos	  *)
7090*6881a400Schristos	    verstring="0.0"
7091*6881a400Schristos	    ;;
7092*6881a400Schristos	  esac
7093*6881a400Schristos	  if test "$need_version" = no; then
7094*6881a400Schristos	    versuffix=
7095*6881a400Schristos	  else
7096*6881a400Schristos	    versuffix=".0.0"
7097*6881a400Schristos	  fi
7098*6881a400Schristos	fi
7099*6881a400Schristos
7100*6881a400Schristos	# Remove version info from name if versioning should be avoided
7101*6881a400Schristos	if test "$avoid_version" = yes && test "$need_version" = no; then
7102*6881a400Schristos	  major=
7103*6881a400Schristos	  versuffix=
7104*6881a400Schristos	  verstring=""
7105*6881a400Schristos	fi
7106*6881a400Schristos
7107*6881a400Schristos	# Check to see if the archive will have undefined symbols.
7108*6881a400Schristos	if test "$allow_undefined" = yes; then
7109*6881a400Schristos	  if test "$allow_undefined_flag" = unsupported; then
7110*6881a400Schristos	    func_warning "undefined symbols not allowed in $host shared libraries"
7111*6881a400Schristos	    build_libtool_libs=no
7112*6881a400Schristos	    build_old_libs=yes
7113*6881a400Schristos	  fi
7114*6881a400Schristos	else
7115*6881a400Schristos	  # Don't allow undefined symbols.
7116*6881a400Schristos	  allow_undefined_flag="$no_undefined_flag"
7117*6881a400Schristos	fi
7118*6881a400Schristos
7119*6881a400Schristos      fi
7120*6881a400Schristos
7121*6881a400Schristos      func_generate_dlsyms "$libname" "$libname" "yes"
7122*6881a400Schristos      libobjs="$libobjs $symfileobj"
7123*6881a400Schristos      test "X$libobjs" = "X " && libobjs=
7124*6881a400Schristos
7125*6881a400Schristos      if test "$mode" != relink; then
7126*6881a400Schristos	# Remove our outputs, but don't remove object files since they
7127*6881a400Schristos	# may have been created when compiling PIC objects.
7128*6881a400Schristos	removelist=
7129*6881a400Schristos	tempremovelist=`$ECHO "$output_objdir/*"`
7130*6881a400Schristos	for p in $tempremovelist; do
7131*6881a400Schristos	  case $p in
7132*6881a400Schristos	    *.$objext | *.gcno)
7133*6881a400Schristos	       ;;
7134*6881a400Schristos	    $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*)
7135*6881a400Schristos	       if test "X$precious_files_regex" != "X"; then
7136*6881a400Schristos		 if $ECHO "$p" | $EGREP -e "$precious_files_regex" >/dev/null 2>&1
7137*6881a400Schristos		 then
7138*6881a400Schristos		   continue
7139*6881a400Schristos		 fi
7140*6881a400Schristos	       fi
7141*6881a400Schristos	       removelist="$removelist $p"
7142*6881a400Schristos	       ;;
7143*6881a400Schristos	    *) ;;
7144*6881a400Schristos	  esac
7145*6881a400Schristos	done
7146*6881a400Schristos	test -n "$removelist" && \
7147*6881a400Schristos	  func_show_eval "${RM}r \$removelist"
7148*6881a400Schristos      fi
7149*6881a400Schristos
7150*6881a400Schristos      # Now set the variables for building old libraries.
7151*6881a400Schristos      if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then
7152*6881a400Schristos	oldlibs="$oldlibs $output_objdir/$libname.$libext"
7153*6881a400Schristos
7154*6881a400Schristos	# Transform .lo files to .o files.
7155*6881a400Schristos	oldobjs="$objs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.${libext}$/d; $lo2o" | $NL2SP`
7156*6881a400Schristos      fi
7157*6881a400Schristos
7158*6881a400Schristos      # Eliminate all temporary directories.
7159*6881a400Schristos      #for path in $notinst_path; do
7160*6881a400Schristos      #	lib_search_path=`$ECHO "$lib_search_path " | $SED "s% $path % %g"`
7161*6881a400Schristos      #	deplibs=`$ECHO "$deplibs " | $SED "s% -L$path % %g"`
7162*6881a400Schristos      #	dependency_libs=`$ECHO "$dependency_libs " | $SED "s% -L$path % %g"`
7163*6881a400Schristos      #done
7164*6881a400Schristos
7165*6881a400Schristos      if test -n "$xrpath"; then
7166*6881a400Schristos	# If the user specified any rpath flags, then add them.
7167*6881a400Schristos	temp_xrpath=
7168*6881a400Schristos	for libdir in $xrpath; do
7169*6881a400Schristos	  temp_xrpath="$temp_xrpath -R$libdir"
7170*6881a400Schristos	  case "$finalize_rpath " in
7171*6881a400Schristos	  *" $libdir "*) ;;
7172*6881a400Schristos	  *) finalize_rpath="$finalize_rpath $libdir" ;;
7173*6881a400Schristos	  esac
7174*6881a400Schristos	done
7175*6881a400Schristos	if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then
7176*6881a400Schristos	  dependency_libs="$temp_xrpath $dependency_libs"
7177*6881a400Schristos	fi
7178*6881a400Schristos      fi
7179*6881a400Schristos
7180*6881a400Schristos      # Make sure dlfiles contains only unique files that won't be dlpreopened
7181*6881a400Schristos      old_dlfiles="$dlfiles"
7182*6881a400Schristos      dlfiles=
7183*6881a400Schristos      for lib in $old_dlfiles; do
7184*6881a400Schristos	case " $dlprefiles $dlfiles " in
7185*6881a400Schristos	*" $lib "*) ;;
7186*6881a400Schristos	*) dlfiles="$dlfiles $lib" ;;
7187*6881a400Schristos	esac
7188*6881a400Schristos      done
7189*6881a400Schristos
7190*6881a400Schristos      # Make sure dlprefiles contains only unique files
7191*6881a400Schristos      old_dlprefiles="$dlprefiles"
7192*6881a400Schristos      dlprefiles=
7193*6881a400Schristos      for lib in $old_dlprefiles; do
7194*6881a400Schristos	case "$dlprefiles " in
7195*6881a400Schristos	*" $lib "*) ;;
7196*6881a400Schristos	*) dlprefiles="$dlprefiles $lib" ;;
7197*6881a400Schristos	esac
7198*6881a400Schristos      done
7199*6881a400Schristos
7200*6881a400Schristos      if test "$build_libtool_libs" = yes; then
7201*6881a400Schristos	if test -n "$rpath"; then
7202*6881a400Schristos	  case $host in
7203*6881a400Schristos	  *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos* | *-cegcc* | *-*-haiku*)
7204*6881a400Schristos	    # these systems don't actually have a c library (as such)!
7205*6881a400Schristos	    ;;
7206*6881a400Schristos	  *-*-rhapsody* | *-*-darwin1.[012])
7207*6881a400Schristos	    # Rhapsody C library is in the System framework
7208*6881a400Schristos	    deplibs="$deplibs System.ltframework"
7209*6881a400Schristos	    ;;
7210*6881a400Schristos	  *-*-netbsd*)
7211*6881a400Schristos	    # Don't link with libc until the a.out ld.so is fixed.
7212*6881a400Schristos	    ;;
7213*6881a400Schristos	  *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
7214*6881a400Schristos	    # Do not include libc due to us having libc/libc_r.
7215*6881a400Schristos	    ;;
7216*6881a400Schristos	  *-*-sco3.2v5* | *-*-sco5v6*)
7217*6881a400Schristos	    # Causes problems with __ctype
7218*6881a400Schristos	    ;;
7219*6881a400Schristos	  *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
7220*6881a400Schristos	    # Compiler inserts libc in the correct place for threads to work
7221*6881a400Schristos	    ;;
7222*6881a400Schristos	  *)
7223*6881a400Schristos	    # Add libc to deplibs on all other systems if necessary.
7224*6881a400Schristos	    if test "$build_libtool_need_lc" = "yes"; then
7225*6881a400Schristos	      deplibs="$deplibs -lc"
7226*6881a400Schristos	    fi
7227*6881a400Schristos	    ;;
7228*6881a400Schristos	  esac
7229*6881a400Schristos	fi
7230*6881a400Schristos
7231*6881a400Schristos	# Transform deplibs into only deplibs that can be linked in shared.
7232*6881a400Schristos	name_save=$name
7233*6881a400Schristos	libname_save=$libname
7234*6881a400Schristos	release_save=$release
7235*6881a400Schristos	versuffix_save=$versuffix
7236*6881a400Schristos	major_save=$major
7237*6881a400Schristos	# I'm not sure if I'm treating the release correctly.  I think
7238*6881a400Schristos	# release should show up in the -l (ie -lgmp5) so we don't want to
7239*6881a400Schristos	# add it in twice.  Is that correct?
7240*6881a400Schristos	release=""
7241*6881a400Schristos	versuffix=""
7242*6881a400Schristos	major=""
7243*6881a400Schristos	newdeplibs=
7244*6881a400Schristos	droppeddeps=no
7245*6881a400Schristos	case $deplibs_check_method in
7246*6881a400Schristos	pass_all)
7247*6881a400Schristos	  # Don't check for shared/static.  Everything works.
7248*6881a400Schristos	  # This might be a little naive.  We might want to check
7249*6881a400Schristos	  # whether the library exists or not.  But this is on
7250*6881a400Schristos	  # osf3 & osf4 and I'm not really sure... Just
7251*6881a400Schristos	  # implementing what was already the behavior.
7252*6881a400Schristos	  newdeplibs=$deplibs
7253*6881a400Schristos	  ;;
7254*6881a400Schristos	test_compile)
7255*6881a400Schristos	  # This code stresses the "libraries are programs" paradigm to its
7256*6881a400Schristos	  # limits. Maybe even breaks it.  We compile a program, linking it
7257*6881a400Schristos	  # against the deplibs as a proxy for the library.  Then we can check
7258*6881a400Schristos	  # whether they linked in statically or dynamically with ldd.
7259*6881a400Schristos	  $opt_dry_run || $RM conftest.c
7260*6881a400Schristos	  cat > conftest.c <<EOF
7261*6881a400Schristos	  int main() { return 0; }
7262*6881a400SchristosEOF
7263*6881a400Schristos	  $opt_dry_run || $RM conftest
7264*6881a400Schristos	  if $LTCC $LTCFLAGS -o conftest conftest.c $deplibs; then
7265*6881a400Schristos	    ldd_output=`ldd conftest`
7266*6881a400Schristos	    for i in $deplibs; do
7267*6881a400Schristos	      case $i in
7268*6881a400Schristos	      -l*)
7269*6881a400Schristos		func_stripname -l '' "$i"
7270*6881a400Schristos		name=$func_stripname_result
7271*6881a400Schristos		if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
7272*6881a400Schristos		  case " $predeps $postdeps " in
7273*6881a400Schristos		  *" $i "*)
7274*6881a400Schristos		    newdeplibs="$newdeplibs $i"
7275*6881a400Schristos		    i=""
7276*6881a400Schristos		    ;;
7277*6881a400Schristos		  esac
7278*6881a400Schristos		fi
7279*6881a400Schristos		if test -n "$i" ; then
7280*6881a400Schristos		  eval "libname=\"$libname_spec\""
7281*6881a400Schristos		  eval "deplib_matches=\"$library_names_spec\""
7282*6881a400Schristos		  set dummy $deplib_matches; shift
7283*6881a400Schristos		  deplib_match=$1
7284*6881a400Schristos		  if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
7285*6881a400Schristos		    newdeplibs="$newdeplibs $i"
7286*6881a400Schristos		  else
7287*6881a400Schristos		    droppeddeps=yes
7288*6881a400Schristos		    echo
7289*6881a400Schristos		    $ECHO "*** Warning: dynamic linker does not accept needed library $i."
7290*6881a400Schristos		    echo "*** I have the capability to make that library automatically link in when"
7291*6881a400Schristos		    echo "*** you link to this library.  But I can only do this if you have a"
7292*6881a400Schristos		    echo "*** shared version of the library, which I believe you do not have"
7293*6881a400Schristos		    echo "*** because a test_compile did reveal that the linker did not use it for"
7294*6881a400Schristos		    echo "*** its dynamic dependency list that programs get resolved with at runtime."
7295*6881a400Schristos		  fi
7296*6881a400Schristos		fi
7297*6881a400Schristos		;;
7298*6881a400Schristos	      *)
7299*6881a400Schristos		newdeplibs="$newdeplibs $i"
7300*6881a400Schristos		;;
7301*6881a400Schristos	      esac
7302*6881a400Schristos	    done
7303*6881a400Schristos	  else
7304*6881a400Schristos	    # Error occurred in the first compile.  Let's try to salvage
7305*6881a400Schristos	    # the situation: Compile a separate program for each library.
7306*6881a400Schristos	    for i in $deplibs; do
7307*6881a400Schristos	      case $i in
7308*6881a400Schristos	      -l*)
7309*6881a400Schristos		func_stripname -l '' "$i"
7310*6881a400Schristos		name=$func_stripname_result
7311*6881a400Schristos		$opt_dry_run || $RM conftest
7312*6881a400Schristos		if $LTCC $LTCFLAGS -o conftest conftest.c $i; then
7313*6881a400Schristos		  ldd_output=`ldd conftest`
7314*6881a400Schristos		  if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
7315*6881a400Schristos		    case " $predeps $postdeps " in
7316*6881a400Schristos		    *" $i "*)
7317*6881a400Schristos		      newdeplibs="$newdeplibs $i"
7318*6881a400Schristos		      i=""
7319*6881a400Schristos		      ;;
7320*6881a400Schristos		    esac
7321*6881a400Schristos		  fi
7322*6881a400Schristos		  if test -n "$i" ; then
7323*6881a400Schristos		    eval "libname=\"$libname_spec\""
7324*6881a400Schristos		    eval "deplib_matches=\"$library_names_spec\""
7325*6881a400Schristos		    set dummy $deplib_matches; shift
7326*6881a400Schristos		    deplib_match=$1
7327*6881a400Schristos		    if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
7328*6881a400Schristos		      newdeplibs="$newdeplibs $i"
7329*6881a400Schristos		    else
7330*6881a400Schristos		      droppeddeps=yes
7331*6881a400Schristos		      echo
7332*6881a400Schristos		      $ECHO "*** Warning: dynamic linker does not accept needed library $i."
7333*6881a400Schristos		      echo "*** I have the capability to make that library automatically link in when"
7334*6881a400Schristos		      echo "*** you link to this library.  But I can only do this if you have a"
7335*6881a400Schristos		      echo "*** shared version of the library, which you do not appear to have"
7336*6881a400Schristos		      echo "*** because a test_compile did reveal that the linker did not use this one"
7337*6881a400Schristos		      echo "*** as a dynamic dependency that programs can get resolved with at runtime."
7338*6881a400Schristos		    fi
7339*6881a400Schristos		  fi
7340*6881a400Schristos		else
7341*6881a400Schristos		  droppeddeps=yes
7342*6881a400Schristos		  echo
7343*6881a400Schristos		  $ECHO "*** Warning!  Library $i is needed by this library but I was not able to"
7344*6881a400Schristos		  echo "*** make it link in!  You will probably need to install it or some"
7345*6881a400Schristos		  echo "*** library that it depends on before this library will be fully"
7346*6881a400Schristos		  echo "*** functional.  Installing it before continuing would be even better."
7347*6881a400Schristos		fi
7348*6881a400Schristos		;;
7349*6881a400Schristos	      *)
7350*6881a400Schristos		newdeplibs="$newdeplibs $i"
7351*6881a400Schristos		;;
7352*6881a400Schristos	      esac
7353*6881a400Schristos	    done
7354*6881a400Schristos	  fi
7355*6881a400Schristos	  ;;
7356*6881a400Schristos	file_magic*)
7357*6881a400Schristos	  set dummy $deplibs_check_method; shift
7358*6881a400Schristos	  file_magic_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
7359*6881a400Schristos	  for a_deplib in $deplibs; do
7360*6881a400Schristos	    case $a_deplib in
7361*6881a400Schristos	    -l*)
7362*6881a400Schristos	      func_stripname -l '' "$a_deplib"
7363*6881a400Schristos	      name=$func_stripname_result
7364*6881a400Schristos	      if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
7365*6881a400Schristos		case " $predeps $postdeps " in
7366*6881a400Schristos		*" $a_deplib "*)
7367*6881a400Schristos		  newdeplibs="$newdeplibs $a_deplib"
7368*6881a400Schristos		  a_deplib=""
7369*6881a400Schristos		  ;;
7370*6881a400Schristos		esac
7371*6881a400Schristos	      fi
7372*6881a400Schristos	      if test -n "$a_deplib" ; then
7373*6881a400Schristos		eval "libname=\"$libname_spec\""
7374*6881a400Schristos		for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
7375*6881a400Schristos		  potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
7376*6881a400Schristos		  for potent_lib in $potential_libs; do
7377*6881a400Schristos		      # Follow soft links.
7378*6881a400Schristos		      if ls -lLd "$potent_lib" 2>/dev/null |
7379*6881a400Schristos			 $GREP " -> " >/dev/null; then
7380*6881a400Schristos			continue
7381*6881a400Schristos		      fi
7382*6881a400Schristos		      # The statement above tries to avoid entering an
7383*6881a400Schristos		      # endless loop below, in case of cyclic links.
7384*6881a400Schristos		      # We might still enter an endless loop, since a link
7385*6881a400Schristos		      # loop can be closed while we follow links,
7386*6881a400Schristos		      # but so what?
7387*6881a400Schristos		      potlib="$potent_lib"
7388*6881a400Schristos		      while test -h "$potlib" 2>/dev/null; do
7389*6881a400Schristos			potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'`
7390*6881a400Schristos			case $potliblink in
7391*6881a400Schristos			[\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";;
7392*6881a400Schristos			*) potlib=`$ECHO "$potlib" | $SED 's,[^/]*$,,'`"$potliblink";;
7393*6881a400Schristos			esac
7394*6881a400Schristos		      done
7395*6881a400Schristos		      if eval "$file_magic_cmd \"\$potlib\"" 2>/dev/null |
7396*6881a400Schristos			 $SED -e 10q |
7397*6881a400Schristos			 $EGREP "$file_magic_regex" > /dev/null; then
7398*6881a400Schristos			newdeplibs="$newdeplibs $a_deplib"
7399*6881a400Schristos			a_deplib=""
7400*6881a400Schristos			break 2
7401*6881a400Schristos		      fi
7402*6881a400Schristos		  done
7403*6881a400Schristos		done
7404*6881a400Schristos	      fi
7405*6881a400Schristos	      if test -n "$a_deplib" ; then
7406*6881a400Schristos		droppeddeps=yes
7407*6881a400Schristos		echo
7408*6881a400Schristos		$ECHO "*** Warning: linker path does not have real file for library $a_deplib."
7409*6881a400Schristos		echo "*** I have the capability to make that library automatically link in when"
7410*6881a400Schristos		echo "*** you link to this library.  But I can only do this if you have a"
7411*6881a400Schristos		echo "*** shared version of the library, which you do not appear to have"
7412*6881a400Schristos		echo "*** because I did check the linker path looking for a file starting"
7413*6881a400Schristos		if test -z "$potlib" ; then
7414*6881a400Schristos		  $ECHO "*** with $libname but no candidates were found. (...for file magic test)"
7415*6881a400Schristos		else
7416*6881a400Schristos		  $ECHO "*** with $libname and none of the candidates passed a file format test"
7417*6881a400Schristos		  $ECHO "*** using a file magic. Last file checked: $potlib"
7418*6881a400Schristos		fi
7419*6881a400Schristos	      fi
7420*6881a400Schristos	      ;;
7421*6881a400Schristos	    *)
7422*6881a400Schristos	      # Add a -L argument.
7423*6881a400Schristos	      newdeplibs="$newdeplibs $a_deplib"
7424*6881a400Schristos	      ;;
7425*6881a400Schristos	    esac
7426*6881a400Schristos	  done # Gone through all deplibs.
7427*6881a400Schristos	  ;;
7428*6881a400Schristos	match_pattern*)
7429*6881a400Schristos	  set dummy $deplibs_check_method; shift
7430*6881a400Schristos	  match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
7431*6881a400Schristos	  for a_deplib in $deplibs; do
7432*6881a400Schristos	    case $a_deplib in
7433*6881a400Schristos	    -l*)
7434*6881a400Schristos	      func_stripname -l '' "$a_deplib"
7435*6881a400Schristos	      name=$func_stripname_result
7436*6881a400Schristos	      if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
7437*6881a400Schristos		case " $predeps $postdeps " in
7438*6881a400Schristos		*" $a_deplib "*)
7439*6881a400Schristos		  newdeplibs="$newdeplibs $a_deplib"
7440*6881a400Schristos		  a_deplib=""
7441*6881a400Schristos		  ;;
7442*6881a400Schristos		esac
7443*6881a400Schristos	      fi
7444*6881a400Schristos	      if test -n "$a_deplib" ; then
7445*6881a400Schristos		eval "libname=\"$libname_spec\""
7446*6881a400Schristos		for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
7447*6881a400Schristos		  potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
7448*6881a400Schristos		  for potent_lib in $potential_libs; do
7449*6881a400Schristos		    potlib="$potent_lib" # see symlink-check above in file_magic test
7450*6881a400Schristos		    if eval "\$ECHO \"$potent_lib\"" 2>/dev/null | $SED 10q | \
7451*6881a400Schristos		       $EGREP "$match_pattern_regex" > /dev/null; then
7452*6881a400Schristos		      newdeplibs="$newdeplibs $a_deplib"
7453*6881a400Schristos		      a_deplib=""
7454*6881a400Schristos		      break 2
7455*6881a400Schristos		    fi
7456*6881a400Schristos		  done
7457*6881a400Schristos		done
7458*6881a400Schristos	      fi
7459*6881a400Schristos	      if test -n "$a_deplib" ; then
7460*6881a400Schristos		droppeddeps=yes
7461*6881a400Schristos		echo
7462*6881a400Schristos		$ECHO "*** Warning: linker path does not have real file for library $a_deplib."
7463*6881a400Schristos		echo "*** I have the capability to make that library automatically link in when"
7464*6881a400Schristos		echo "*** you link to this library.  But I can only do this if you have a"
7465*6881a400Schristos		echo "*** shared version of the library, which you do not appear to have"
7466*6881a400Schristos		echo "*** because I did check the linker path looking for a file starting"
7467*6881a400Schristos		if test -z "$potlib" ; then
7468*6881a400Schristos		  $ECHO "*** with $libname but no candidates were found. (...for regex pattern test)"
7469*6881a400Schristos		else
7470*6881a400Schristos		  $ECHO "*** with $libname and none of the candidates passed a file format test"
7471*6881a400Schristos		  $ECHO "*** using a regex pattern. Last file checked: $potlib"
7472*6881a400Schristos		fi
7473*6881a400Schristos	      fi
7474*6881a400Schristos	      ;;
7475*6881a400Schristos	    *)
7476*6881a400Schristos	      # Add a -L argument.
7477*6881a400Schristos	      newdeplibs="$newdeplibs $a_deplib"
7478*6881a400Schristos	      ;;
7479*6881a400Schristos	    esac
7480*6881a400Schristos	  done # Gone through all deplibs.
7481*6881a400Schristos	  ;;
7482*6881a400Schristos	none | unknown | *)
7483*6881a400Schristos	  newdeplibs=""
7484*6881a400Schristos	  tmp_deplibs=`$ECHO " $deplibs" | $SED 's/ -lc$//; s/ -[LR][^ ]*//g'`
7485*6881a400Schristos	  if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
7486*6881a400Schristos	    for i in $predeps $postdeps ; do
7487*6881a400Schristos	      # can't use Xsed below, because $i might contain '/'
7488*6881a400Schristos	      tmp_deplibs=`$ECHO " $tmp_deplibs" | $SED "s,$i,,"`
7489*6881a400Schristos	    done
7490*6881a400Schristos	  fi
7491*6881a400Schristos	  case $tmp_deplibs in
7492*6881a400Schristos	  *[!\	\ ]*)
7493*6881a400Schristos	    echo
7494*6881a400Schristos	    if test "X$deplibs_check_method" = "Xnone"; then
7495*6881a400Schristos	      echo "*** Warning: inter-library dependencies are not supported in this platform."
7496*6881a400Schristos	    else
7497*6881a400Schristos	      echo "*** Warning: inter-library dependencies are not known to be supported."
7498*6881a400Schristos	    fi
7499*6881a400Schristos	    echo "*** All declared inter-library dependencies are being dropped."
7500*6881a400Schristos	    droppeddeps=yes
7501*6881a400Schristos	    ;;
7502*6881a400Schristos	  esac
7503*6881a400Schristos	  ;;
7504*6881a400Schristos	esac
7505*6881a400Schristos	versuffix=$versuffix_save
7506*6881a400Schristos	major=$major_save
7507*6881a400Schristos	release=$release_save
7508*6881a400Schristos	libname=$libname_save
7509*6881a400Schristos	name=$name_save
7510*6881a400Schristos
7511*6881a400Schristos	case $host in
7512*6881a400Schristos	*-*-rhapsody* | *-*-darwin1.[012])
7513*6881a400Schristos	  # On Rhapsody replace the C library with the System framework
7514*6881a400Schristos	  newdeplibs=`$ECHO " $newdeplibs" | $SED 's/ -lc / System.ltframework /'`
7515*6881a400Schristos	  ;;
7516*6881a400Schristos	esac
7517*6881a400Schristos
7518*6881a400Schristos	if test "$droppeddeps" = yes; then
7519*6881a400Schristos	  if test "$module" = yes; then
7520*6881a400Schristos	    echo
7521*6881a400Schristos	    echo "*** Warning: libtool could not satisfy all declared inter-library"
7522*6881a400Schristos	    $ECHO "*** dependencies of module $libname.  Therefore, libtool will create"
7523*6881a400Schristos	    echo "*** a static module, that should work as long as the dlopening"
7524*6881a400Schristos	    echo "*** application is linked with the -dlopen flag."
7525*6881a400Schristos	    if test -z "$global_symbol_pipe"; then
7526*6881a400Schristos	      echo
7527*6881a400Schristos	      echo "*** However, this would only work if libtool was able to extract symbol"
7528*6881a400Schristos	      echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
7529*6881a400Schristos	      echo "*** not find such a program.  So, this module is probably useless."
7530*6881a400Schristos	      echo "*** \`nm' from GNU binutils and a full rebuild may help."
7531*6881a400Schristos	    fi
7532*6881a400Schristos	    if test "$build_old_libs" = no; then
7533*6881a400Schristos	      oldlibs="$output_objdir/$libname.$libext"
7534*6881a400Schristos	      build_libtool_libs=module
7535*6881a400Schristos	      build_old_libs=yes
7536*6881a400Schristos	    else
7537*6881a400Schristos	      build_libtool_libs=no
7538*6881a400Schristos	    fi
7539*6881a400Schristos	  else
7540*6881a400Schristos	    echo "*** The inter-library dependencies that have been dropped here will be"
7541*6881a400Schristos	    echo "*** automatically added whenever a program is linked with this library"
7542*6881a400Schristos	    echo "*** or is declared to -dlopen it."
7543*6881a400Schristos
7544*6881a400Schristos	    if test "$allow_undefined" = no; then
7545*6881a400Schristos	      echo
7546*6881a400Schristos	      echo "*** Since this library must not contain undefined symbols,"
7547*6881a400Schristos	      echo "*** because either the platform does not support them or"
7548*6881a400Schristos	      echo "*** it was explicitly requested with -no-undefined,"
7549*6881a400Schristos	      echo "*** libtool will only create a static version of it."
7550*6881a400Schristos	      if test "$build_old_libs" = no; then
7551*6881a400Schristos		oldlibs="$output_objdir/$libname.$libext"
7552*6881a400Schristos		build_libtool_libs=module
7553*6881a400Schristos		build_old_libs=yes
7554*6881a400Schristos	      else
7555*6881a400Schristos		build_libtool_libs=no
7556*6881a400Schristos	      fi
7557*6881a400Schristos	    fi
7558*6881a400Schristos	  fi
7559*6881a400Schristos	fi
7560*6881a400Schristos	# Done checking deplibs!
7561*6881a400Schristos	deplibs=$newdeplibs
7562*6881a400Schristos      fi
7563*6881a400Schristos      # Time to change all our "foo.ltframework" stuff back to "-framework foo"
7564*6881a400Schristos      case $host in
7565*6881a400Schristos	*-*-darwin*)
7566*6881a400Schristos	  newdeplibs=`$ECHO " $newdeplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
7567*6881a400Schristos	  new_inherited_linker_flags=`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
7568*6881a400Schristos	  deplibs=`$ECHO " $deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
7569*6881a400Schristos	  ;;
7570*6881a400Schristos      esac
7571*6881a400Schristos
7572*6881a400Schristos      # move library search paths that coincide with paths to not yet
7573*6881a400Schristos      # installed libraries to the beginning of the library search list
7574*6881a400Schristos      new_libs=
7575*6881a400Schristos      for path in $notinst_path; do
7576*6881a400Schristos	case " $new_libs " in
7577*6881a400Schristos	*" -L$path/$objdir "*) ;;
7578*6881a400Schristos	*)
7579*6881a400Schristos	  case " $deplibs " in
7580*6881a400Schristos	  *" -L$path/$objdir "*)
7581*6881a400Schristos	    new_libs="$new_libs -L$path/$objdir" ;;
7582*6881a400Schristos	  esac
7583*6881a400Schristos	  ;;
7584*6881a400Schristos	esac
7585*6881a400Schristos      done
7586*6881a400Schristos      for deplib in $deplibs; do
7587*6881a400Schristos	case $deplib in
7588*6881a400Schristos	-L*)
7589*6881a400Schristos	  case " $new_libs " in
7590*6881a400Schristos	  *" $deplib "*) ;;
7591*6881a400Schristos	  *) new_libs="$new_libs $deplib" ;;
7592*6881a400Schristos	  esac
7593*6881a400Schristos	  ;;
7594*6881a400Schristos	*) new_libs="$new_libs $deplib" ;;
7595*6881a400Schristos	esac
7596*6881a400Schristos      done
7597*6881a400Schristos      deplibs="$new_libs"
7598*6881a400Schristos
7599*6881a400Schristos      # All the library-specific variables (install_libdir is set above).
7600*6881a400Schristos      library_names=
7601*6881a400Schristos      old_library=
7602*6881a400Schristos      dlname=
7603*6881a400Schristos
7604*6881a400Schristos      # Test again, we may have decided not to build it any more
7605*6881a400Schristos      if test "$build_libtool_libs" = yes; then
7606*6881a400Schristos	if test "$hardcode_into_libs" = yes; then
7607*6881a400Schristos	  # Hardcode the library paths
7608*6881a400Schristos	  hardcode_libdirs=
7609*6881a400Schristos	  dep_rpath=
7610*6881a400Schristos	  rpath="$finalize_rpath"
7611*6881a400Schristos	  test "$mode" != relink && rpath="$compile_rpath$rpath"
7612*6881a400Schristos	  for libdir in $rpath; do
7613*6881a400Schristos	    if test -n "$hardcode_libdir_flag_spec"; then
7614*6881a400Schristos	      if test -n "$hardcode_libdir_separator"; then
7615*6881a400Schristos		if test -z "$hardcode_libdirs"; then
7616*6881a400Schristos		  hardcode_libdirs="$libdir"
7617*6881a400Schristos		else
7618*6881a400Schristos		  # Just accumulate the unique libdirs.
7619*6881a400Schristos		  case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
7620*6881a400Schristos		  *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
7621*6881a400Schristos		    ;;
7622*6881a400Schristos		  *)
7623*6881a400Schristos		    hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
7624*6881a400Schristos		    ;;
7625*6881a400Schristos		  esac
7626*6881a400Schristos		fi
7627*6881a400Schristos	      else
7628*6881a400Schristos		eval "flag=\"$hardcode_libdir_flag_spec\""
7629*6881a400Schristos		dep_rpath="$dep_rpath $flag"
7630*6881a400Schristos	      fi
7631*6881a400Schristos	    elif test -n "$runpath_var"; then
7632*6881a400Schristos	      case "$perm_rpath " in
7633*6881a400Schristos	      *" $libdir "*) ;;
7634*6881a400Schristos	      *) perm_rpath="$perm_rpath $libdir" ;;
7635*6881a400Schristos	      esac
7636*6881a400Schristos	    fi
7637*6881a400Schristos	  done
7638*6881a400Schristos	  # Substitute the hardcoded libdirs into the rpath.
7639*6881a400Schristos	  if test -n "$hardcode_libdir_separator" &&
7640*6881a400Schristos	     test -n "$hardcode_libdirs"; then
7641*6881a400Schristos	    libdir="$hardcode_libdirs"
7642*6881a400Schristos	    if test -n "$hardcode_libdir_flag_spec_ld"; then
7643*6881a400Schristos	      eval "dep_rpath=\"$hardcode_libdir_flag_spec_ld\""
7644*6881a400Schristos	    else
7645*6881a400Schristos	      eval "dep_rpath=\"$hardcode_libdir_flag_spec\""
7646*6881a400Schristos	    fi
7647*6881a400Schristos	  fi
7648*6881a400Schristos	  if test -n "$runpath_var" && test -n "$perm_rpath"; then
7649*6881a400Schristos	    # We should set the runpath_var.
7650*6881a400Schristos	    rpath=
7651*6881a400Schristos	    for dir in $perm_rpath; do
7652*6881a400Schristos	      rpath="$rpath$dir:"
7653*6881a400Schristos	    done
7654*6881a400Schristos	    eval $runpath_var=\$rpath\$$runpath_var
7655*6881a400Schristos	    export $runpath_var
7656*6881a400Schristos	  fi
7657*6881a400Schristos	  test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs"
7658*6881a400Schristos	fi
7659*6881a400Schristos
7660*6881a400Schristos	shlibpath="$finalize_shlibpath"
7661*6881a400Schristos	test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath"
7662*6881a400Schristos	if test -n "$shlibpath"; then
7663*6881a400Schristos	  eval $shlibpath_var=\$shlibpath\$$shlibpath_var
7664*6881a400Schristos	  export $shlibpath_var
7665*6881a400Schristos	fi
7666*6881a400Schristos
7667*6881a400Schristos	# Get the real and link names of the library.
7668*6881a400Schristos	eval "shared_ext=\"$shrext_cmds\""
7669*6881a400Schristos	eval "library_names=\"$library_names_spec\""
7670*6881a400Schristos	set dummy $library_names
7671*6881a400Schristos	shift
7672*6881a400Schristos	realname="$1"
7673*6881a400Schristos	shift
7674*6881a400Schristos
7675*6881a400Schristos	if test -n "$soname_spec"; then
7676*6881a400Schristos	  eval "soname=\"$soname_spec\""
7677*6881a400Schristos	else
7678*6881a400Schristos	  soname="$realname"
7679*6881a400Schristos	fi
7680*6881a400Schristos	if test -z "$dlname"; then
7681*6881a400Schristos	  dlname=$soname
7682*6881a400Schristos	fi
7683*6881a400Schristos
7684*6881a400Schristos	lib="$output_objdir/$realname"
7685*6881a400Schristos	linknames=
7686*6881a400Schristos	for link
7687*6881a400Schristos	do
7688*6881a400Schristos	  linknames="$linknames $link"
7689*6881a400Schristos	done
7690*6881a400Schristos
7691*6881a400Schristos	# Use standard objects if they are pic
7692*6881a400Schristos	test -z "$pic_flag" && libobjs=`$ECHO "$libobjs" | $SP2NL | $SED "$lo2o" | $NL2SP`
7693*6881a400Schristos	test "X$libobjs" = "X " && libobjs=
7694*6881a400Schristos
7695*6881a400Schristos	delfiles=
7696*6881a400Schristos	if test -n "$export_symbols" && test -n "$include_expsyms"; then
7697*6881a400Schristos	  $opt_dry_run || cp "$export_symbols" "$output_objdir/$libname.uexp"
7698*6881a400Schristos	  export_symbols="$output_objdir/$libname.uexp"
7699*6881a400Schristos	  delfiles="$delfiles $export_symbols"
7700*6881a400Schristos	fi
7701*6881a400Schristos
7702*6881a400Schristos	orig_export_symbols=
7703*6881a400Schristos	case $host_os in
7704*6881a400Schristos	cygwin* | mingw* | cegcc*)
7705*6881a400Schristos	  if test -n "$export_symbols" && test -z "$export_symbols_regex"; then
7706*6881a400Schristos	    # exporting using user supplied symfile
7707*6881a400Schristos	    if test "x`$SED 1q $export_symbols`" != xEXPORTS; then
7708*6881a400Schristos	      # and it's NOT already a .def file. Must figure out
7709*6881a400Schristos	      # which of the given symbols are data symbols and tag
7710*6881a400Schristos	      # them as such. So, trigger use of export_symbols_cmds.
7711*6881a400Schristos	      # export_symbols gets reassigned inside the "prepare
7712*6881a400Schristos	      # the list of exported symbols" if statement, so the
7713*6881a400Schristos	      # include_expsyms logic still works.
7714*6881a400Schristos	      orig_export_symbols="$export_symbols"
7715*6881a400Schristos	      export_symbols=
7716*6881a400Schristos	      always_export_symbols=yes
7717*6881a400Schristos	    fi
7718*6881a400Schristos	  fi
7719*6881a400Schristos	  ;;
7720*6881a400Schristos	esac
7721*6881a400Schristos
7722*6881a400Schristos	# Prepare the list of exported symbols
7723*6881a400Schristos	if test -z "$export_symbols"; then
7724*6881a400Schristos	  if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then
7725*6881a400Schristos	    func_verbose "generating symbol list for \`$libname.la'"
7726*6881a400Schristos	    export_symbols="$output_objdir/$libname.exp"
7727*6881a400Schristos	    $opt_dry_run || $RM $export_symbols
7728*6881a400Schristos	    cmds=$export_symbols_cmds
7729*6881a400Schristos	    save_ifs="$IFS"; IFS='~'
7730*6881a400Schristos	    for cmd in $cmds; do
7731*6881a400Schristos	      IFS="$save_ifs"
7732*6881a400Schristos	      eval "cmd=\"$cmd\""
7733*6881a400Schristos	      func_len " $cmd"
7734*6881a400Schristos	      len=$func_len_result
7735*6881a400Schristos	      if test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then
7736*6881a400Schristos		func_show_eval "$cmd" 'exit $?'
7737*6881a400Schristos		skipped_export=false
7738*6881a400Schristos	      else
7739*6881a400Schristos		# The command line is too long to execute in one step.
7740*6881a400Schristos		func_verbose "using reloadable object file for export list..."
7741*6881a400Schristos		skipped_export=:
7742*6881a400Schristos		# Break out early, otherwise skipped_export may be
7743*6881a400Schristos		# set to false by a later but shorter cmd.
7744*6881a400Schristos		break
7745*6881a400Schristos	      fi
7746*6881a400Schristos	    done
7747*6881a400Schristos	    IFS="$save_ifs"
7748*6881a400Schristos	    if test -n "$export_symbols_regex" && test "X$skipped_export" != "X:"; then
7749*6881a400Schristos	      func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
7750*6881a400Schristos	      func_show_eval '$MV "${export_symbols}T" "$export_symbols"'
7751*6881a400Schristos	    fi
7752*6881a400Schristos	  fi
7753*6881a400Schristos	fi
7754*6881a400Schristos
7755*6881a400Schristos	if test -n "$export_symbols" && test -n "$include_expsyms"; then
7756*6881a400Schristos	  tmp_export_symbols="$export_symbols"
7757*6881a400Schristos	  test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols"
7758*6881a400Schristos	  $opt_dry_run || $ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"
7759*6881a400Schristos	fi
7760*6881a400Schristos
7761*6881a400Schristos	if test "X$skipped_export" != "X:" && test -n "$orig_export_symbols"; then
7762*6881a400Schristos	  # The given exports_symbols file has to be filtered, so filter it.
7763*6881a400Schristos	  func_verbose "filter symbol list for \`$libname.la' to tag DATA exports"
7764*6881a400Schristos	  # FIXME: $output_objdir/$libname.filter potentially contains lots of
7765*6881a400Schristos	  # 's' commands which not all seds can handle. GNU sed should be fine
7766*6881a400Schristos	  # though. Also, the filter scales superlinearly with the number of
7767*6881a400Schristos	  # global variables. join(1) would be nice here, but unfortunately
7768*6881a400Schristos	  # isn't a blessed tool.
7769*6881a400Schristos	  $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter
7770*6881a400Schristos	  delfiles="$delfiles $export_symbols $output_objdir/$libname.filter"
7771*6881a400Schristos	  export_symbols=$output_objdir/$libname.def
7772*6881a400Schristos	  $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols
7773*6881a400Schristos	fi
7774*6881a400Schristos
7775*6881a400Schristos	tmp_deplibs=
7776*6881a400Schristos	for test_deplib in $deplibs; do
7777*6881a400Schristos	  case " $convenience " in
7778*6881a400Schristos	  *" $test_deplib "*) ;;
7779*6881a400Schristos	  *)
7780*6881a400Schristos	    tmp_deplibs="$tmp_deplibs $test_deplib"
7781*6881a400Schristos	    ;;
7782*6881a400Schristos	  esac
7783*6881a400Schristos	done
7784*6881a400Schristos	deplibs="$tmp_deplibs"
7785*6881a400Schristos
7786*6881a400Schristos	if test -n "$convenience"; then
7787*6881a400Schristos	  if test -n "$whole_archive_flag_spec" &&
7788*6881a400Schristos	    test "$compiler_needs_object" = yes &&
7789*6881a400Schristos	    test -z "$libobjs"; then
7790*6881a400Schristos	    # extract the archives, so we have objects to list.
7791*6881a400Schristos	    # TODO: could optimize this to just extract one archive.
7792*6881a400Schristos	    whole_archive_flag_spec=
7793*6881a400Schristos	  fi
7794*6881a400Schristos	  if test -n "$whole_archive_flag_spec"; then
7795*6881a400Schristos	    save_libobjs=$libobjs
7796*6881a400Schristos	    eval "libobjs=\"\$libobjs $whole_archive_flag_spec\""
7797*6881a400Schristos	    test "X$libobjs" = "X " && libobjs=
7798*6881a400Schristos	  else
7799*6881a400Schristos	    gentop="$output_objdir/${outputname}x"
7800*6881a400Schristos	    generated="$generated $gentop"
7801*6881a400Schristos
7802*6881a400Schristos	    func_extract_archives $gentop $convenience
7803*6881a400Schristos	    libobjs="$libobjs $func_extract_archives_result"
7804*6881a400Schristos	    test "X$libobjs" = "X " && libobjs=
7805*6881a400Schristos	  fi
7806*6881a400Schristos	fi
7807*6881a400Schristos
7808*6881a400Schristos	if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then
7809*6881a400Schristos	  eval "flag=\"$thread_safe_flag_spec\""
7810*6881a400Schristos	  linker_flags="$linker_flags $flag"
7811*6881a400Schristos	fi
7812*6881a400Schristos
7813*6881a400Schristos	# Make a backup of the uninstalled library when relinking
7814*6881a400Schristos	if test "$mode" = relink; then
7815*6881a400Schristos	  $opt_dry_run || (cd $output_objdir && $RM ${realname}U && $MV $realname ${realname}U) || exit $?
7816*6881a400Schristos	fi
7817*6881a400Schristos
7818*6881a400Schristos	# Do each of the archive commands.
7819*6881a400Schristos	if test "$module" = yes && test -n "$module_cmds" ; then
7820*6881a400Schristos	  if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
7821*6881a400Schristos	    eval "test_cmds=\"$module_expsym_cmds\""
7822*6881a400Schristos	    cmds=$module_expsym_cmds
7823*6881a400Schristos	  else
7824*6881a400Schristos	    eval "test_cmds=\"$module_cmds\""
7825*6881a400Schristos	    cmds=$module_cmds
7826*6881a400Schristos	  fi
7827*6881a400Schristos	else
7828*6881a400Schristos	  if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
7829*6881a400Schristos	    eval "test_cmds=\"$archive_expsym_cmds\""
7830*6881a400Schristos	    cmds=$archive_expsym_cmds
7831*6881a400Schristos	  else
7832*6881a400Schristos	    eval "test_cmds=\"$archive_cmds\""
7833*6881a400Schristos	    cmds=$archive_cmds
7834*6881a400Schristos	  fi
7835*6881a400Schristos	fi
7836*6881a400Schristos
7837*6881a400Schristos	if test "X$skipped_export" != "X:" &&
7838*6881a400Schristos	   func_len " $test_cmds" &&
7839*6881a400Schristos	   len=$func_len_result &&
7840*6881a400Schristos	   test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then
7841*6881a400Schristos	  :
7842*6881a400Schristos	else
7843*6881a400Schristos	  # The command line is too long to link in one step, link piecewise
7844*6881a400Schristos	  # or, if using GNU ld and skipped_export is not :, use a linker
7845*6881a400Schristos	  # script.
7846*6881a400Schristos
7847*6881a400Schristos	  # Save the value of $output and $libobjs because we want to
7848*6881a400Schristos	  # use them later.  If we have whole_archive_flag_spec, we
7849*6881a400Schristos	  # want to use save_libobjs as it was before
7850*6881a400Schristos	  # whole_archive_flag_spec was expanded, because we can't
7851*6881a400Schristos	  # assume the linker understands whole_archive_flag_spec.
7852*6881a400Schristos	  # This may have to be revisited, in case too many
7853*6881a400Schristos	  # convenience libraries get linked in and end up exceeding
7854*6881a400Schristos	  # the spec.
7855*6881a400Schristos	  if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then
7856*6881a400Schristos	    save_libobjs=$libobjs
7857*6881a400Schristos	  fi
7858*6881a400Schristos	  save_output=$output
7859*6881a400Schristos	  func_basename "$output"
7860*6881a400Schristos	  output_la=$func_basename_result
7861*6881a400Schristos
7862*6881a400Schristos	  # Clear the reloadable object creation command queue and
7863*6881a400Schristos	  # initialize k to one.
7864*6881a400Schristos	  test_cmds=
7865*6881a400Schristos	  concat_cmds=
7866*6881a400Schristos	  objlist=
7867*6881a400Schristos	  last_robj=
7868*6881a400Schristos	  k=1
7869*6881a400Schristos
7870*6881a400Schristos	  if test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "$with_gnu_ld" = yes; then
7871*6881a400Schristos	    output=${output_objdir}/${output_la}.lnkscript
7872*6881a400Schristos	    func_verbose "creating GNU ld script: $output"
7873*6881a400Schristos	    echo 'INPUT (' > $output
7874*6881a400Schristos	    for obj in $save_libobjs
7875*6881a400Schristos	    do
7876*6881a400Schristos	      $ECHO "$obj" >> $output
7877*6881a400Schristos	    done
7878*6881a400Schristos	    echo ')' >> $output
7879*6881a400Schristos	    delfiles="$delfiles $output"
7880*6881a400Schristos	  elif test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "X$file_list_spec" != X; then
7881*6881a400Schristos	    output=${output_objdir}/${output_la}.lnk
7882*6881a400Schristos	    func_verbose "creating linker input file list: $output"
7883*6881a400Schristos	    : > $output
7884*6881a400Schristos	    set x $save_libobjs
7885*6881a400Schristos	    shift
7886*6881a400Schristos	    firstobj=
7887*6881a400Schristos	    if test "$compiler_needs_object" = yes; then
7888*6881a400Schristos	      firstobj="$1 "
7889*6881a400Schristos	      shift
7890*6881a400Schristos	    fi
7891*6881a400Schristos	    for obj
7892*6881a400Schristos	    do
7893*6881a400Schristos	      $ECHO "$obj" >> $output
7894*6881a400Schristos	    done
7895*6881a400Schristos	    delfiles="$delfiles $output"
7896*6881a400Schristos	    output=$firstobj\"$file_list_spec$output\"
7897*6881a400Schristos	  else
7898*6881a400Schristos	    if test -n "$save_libobjs"; then
7899*6881a400Schristos	      func_verbose "creating reloadable object files..."
7900*6881a400Schristos	      output=$output_objdir/$output_la-${k}.$objext
7901*6881a400Schristos	      eval "test_cmds=\"$reload_cmds\""
7902*6881a400Schristos	      func_len " $test_cmds"
7903*6881a400Schristos	      len0=$func_len_result
7904*6881a400Schristos	      len=$len0
7905*6881a400Schristos
7906*6881a400Schristos	      # Loop over the list of objects to be linked.
7907*6881a400Schristos	      for obj in $save_libobjs
7908*6881a400Schristos	      do
7909*6881a400Schristos		func_len " $obj"
7910*6881a400Schristos		func_arith $len + $func_len_result
7911*6881a400Schristos		len=$func_arith_result
7912*6881a400Schristos		if test "X$objlist" = X ||
7913*6881a400Schristos		   test "$len" -lt "$max_cmd_len"; then
7914*6881a400Schristos		  func_append objlist " $obj"
7915*6881a400Schristos		else
7916*6881a400Schristos		  # The command $test_cmds is almost too long, add a
7917*6881a400Schristos		  # command to the queue.
7918*6881a400Schristos		  if test "$k" -eq 1 ; then
7919*6881a400Schristos		    # The first file doesn't have a previous command to add.
7920*6881a400Schristos		    reload_objs=$objlist
7921*6881a400Schristos		    eval "concat_cmds=\"$reload_cmds\""
7922*6881a400Schristos		  else
7923*6881a400Schristos		    # All subsequent reloadable object files will link in
7924*6881a400Schristos		    # the last one created.
7925*6881a400Schristos		    reload_objs="$objlist $last_robj"
7926*6881a400Schristos		    eval "concat_cmds=\"\$concat_cmds~$reload_cmds~\$RM $last_robj\""
7927*6881a400Schristos		  fi
7928*6881a400Schristos		  last_robj=$output_objdir/$output_la-${k}.$objext
7929*6881a400Schristos		  func_arith $k + 1
7930*6881a400Schristos		  k=$func_arith_result
7931*6881a400Schristos		  output=$output_objdir/$output_la-${k}.$objext
7932*6881a400Schristos		  objlist=" $obj"
7933*6881a400Schristos		  func_len " $last_robj"
7934*6881a400Schristos		  func_arith $len0 + $func_len_result
7935*6881a400Schristos		  len=$func_arith_result
7936*6881a400Schristos		fi
7937*6881a400Schristos	      done
7938*6881a400Schristos	      # Handle the remaining objects by creating one last
7939*6881a400Schristos	      # reloadable object file.  All subsequent reloadable object
7940*6881a400Schristos	      # files will link in the last one created.
7941*6881a400Schristos	      test -z "$concat_cmds" || concat_cmds=$concat_cmds~
7942*6881a400Schristos	      reload_objs="$objlist $last_robj"
7943*6881a400Schristos	      eval "concat_cmds=\"\${concat_cmds}$reload_cmds\""
7944*6881a400Schristos	      if test -n "$last_robj"; then
7945*6881a400Schristos	        eval "concat_cmds=\"\${concat_cmds}~\$RM $last_robj\""
7946*6881a400Schristos	      fi
7947*6881a400Schristos	      delfiles="$delfiles $output"
7948*6881a400Schristos
7949*6881a400Schristos	    else
7950*6881a400Schristos	      output=
7951*6881a400Schristos	    fi
7952*6881a400Schristos
7953*6881a400Schristos	    if ${skipped_export-false}; then
7954*6881a400Schristos	      func_verbose "generating symbol list for \`$libname.la'"
7955*6881a400Schristos	      export_symbols="$output_objdir/$libname.exp"
7956*6881a400Schristos	      $opt_dry_run || $RM $export_symbols
7957*6881a400Schristos	      libobjs=$output
7958*6881a400Schristos	      # Append the command to create the export file.
7959*6881a400Schristos	      test -z "$concat_cmds" || concat_cmds=$concat_cmds~
7960*6881a400Schristos	      eval "concat_cmds=\"\$concat_cmds$export_symbols_cmds\""
7961*6881a400Schristos	      if test -n "$last_robj"; then
7962*6881a400Schristos		eval "concat_cmds=\"\$concat_cmds~\$RM $last_robj\""
7963*6881a400Schristos	      fi
7964*6881a400Schristos	    fi
7965*6881a400Schristos
7966*6881a400Schristos	    test -n "$save_libobjs" &&
7967*6881a400Schristos	      func_verbose "creating a temporary reloadable object file: $output"
7968*6881a400Schristos
7969*6881a400Schristos	    # Loop through the commands generated above and execute them.
7970*6881a400Schristos	    save_ifs="$IFS"; IFS='~'
7971*6881a400Schristos	    for cmd in $concat_cmds; do
7972*6881a400Schristos	      IFS="$save_ifs"
7973*6881a400Schristos	      $opt_silent || {
7974*6881a400Schristos		  func_quote_for_expand "$cmd"
7975*6881a400Schristos		  eval "func_echo $func_quote_for_expand_result"
7976*6881a400Schristos	      }
7977*6881a400Schristos	      $opt_dry_run || eval "$cmd" || {
7978*6881a400Schristos		lt_exit=$?
7979*6881a400Schristos
7980*6881a400Schristos		# Restore the uninstalled library and exit
7981*6881a400Schristos		if test "$mode" = relink; then
7982*6881a400Schristos		  ( cd "$output_objdir" && \
7983*6881a400Schristos		    $RM "${realname}T" && \
7984*6881a400Schristos		    $MV "${realname}U" "$realname" )
7985*6881a400Schristos		fi
7986*6881a400Schristos
7987*6881a400Schristos		exit $lt_exit
7988*6881a400Schristos	      }
7989*6881a400Schristos	    done
7990*6881a400Schristos	    IFS="$save_ifs"
7991*6881a400Schristos
7992*6881a400Schristos	    if test -n "$export_symbols_regex" && ${skipped_export-false}; then
7993*6881a400Schristos	      func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
7994*6881a400Schristos	      func_show_eval '$MV "${export_symbols}T" "$export_symbols"'
7995*6881a400Schristos	    fi
7996*6881a400Schristos	  fi
7997*6881a400Schristos
7998*6881a400Schristos          if ${skipped_export-false}; then
7999*6881a400Schristos	    if test -n "$export_symbols" && test -n "$include_expsyms"; then
8000*6881a400Schristos	      tmp_export_symbols="$export_symbols"
8001*6881a400Schristos	      test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols"
8002*6881a400Schristos	      $opt_dry_run || $ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"
8003*6881a400Schristos	    fi
8004*6881a400Schristos
8005*6881a400Schristos	    if test -n "$orig_export_symbols"; then
8006*6881a400Schristos	      # The given exports_symbols file has to be filtered, so filter it.
8007*6881a400Schristos	      func_verbose "filter symbol list for \`$libname.la' to tag DATA exports"
8008*6881a400Schristos	      # FIXME: $output_objdir/$libname.filter potentially contains lots of
8009*6881a400Schristos	      # 's' commands which not all seds can handle. GNU sed should be fine
8010*6881a400Schristos	      # though. Also, the filter scales superlinearly with the number of
8011*6881a400Schristos	      # global variables. join(1) would be nice here, but unfortunately
8012*6881a400Schristos	      # isn't a blessed tool.
8013*6881a400Schristos	      $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter
8014*6881a400Schristos	      delfiles="$delfiles $export_symbols $output_objdir/$libname.filter"
8015*6881a400Schristos	      export_symbols=$output_objdir/$libname.def
8016*6881a400Schristos	      $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols
8017*6881a400Schristos	    fi
8018*6881a400Schristos	  fi
8019*6881a400Schristos
8020*6881a400Schristos	  libobjs=$output
8021*6881a400Schristos	  # Restore the value of output.
8022*6881a400Schristos	  output=$save_output
8023*6881a400Schristos
8024*6881a400Schristos	  if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then
8025*6881a400Schristos	    eval "libobjs=\"\$libobjs $whole_archive_flag_spec\""
8026*6881a400Schristos	    test "X$libobjs" = "X " && libobjs=
8027*6881a400Schristos	  fi
8028*6881a400Schristos	  # Expand the library linking commands again to reset the
8029*6881a400Schristos	  # value of $libobjs for piecewise linking.
8030*6881a400Schristos
8031*6881a400Schristos	  # Do each of the archive commands.
8032*6881a400Schristos	  if test "$module" = yes && test -n "$module_cmds" ; then
8033*6881a400Schristos	    if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
8034*6881a400Schristos	      cmds=$module_expsym_cmds
8035*6881a400Schristos	    else
8036*6881a400Schristos	      cmds=$module_cmds
8037*6881a400Schristos	    fi
8038*6881a400Schristos	  else
8039*6881a400Schristos	    if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
8040*6881a400Schristos	      cmds=$archive_expsym_cmds
8041*6881a400Schristos	    else
8042*6881a400Schristos	      cmds=$archive_cmds
8043*6881a400Schristos	    fi
8044*6881a400Schristos	  fi
8045*6881a400Schristos	fi
8046*6881a400Schristos
8047*6881a400Schristos	if test -n "$delfiles"; then
8048*6881a400Schristos	  # Append the command to remove temporary files to $cmds.
8049*6881a400Schristos	  eval "cmds=\"\$cmds~\$RM $delfiles\""
8050*6881a400Schristos	fi
8051*6881a400Schristos
8052*6881a400Schristos	# Add any objects from preloaded convenience libraries
8053*6881a400Schristos	if test -n "$dlprefiles"; then
8054*6881a400Schristos	  gentop="$output_objdir/${outputname}x"
8055*6881a400Schristos	  generated="$generated $gentop"
8056*6881a400Schristos
8057*6881a400Schristos	  func_extract_archives $gentop $dlprefiles
8058*6881a400Schristos	  libobjs="$libobjs $func_extract_archives_result"
8059*6881a400Schristos	  test "X$libobjs" = "X " && libobjs=
8060*6881a400Schristos	fi
8061*6881a400Schristos
8062*6881a400Schristos	save_ifs="$IFS"; IFS='~'
8063*6881a400Schristos	for cmd in $cmds; do
8064*6881a400Schristos	  IFS="$save_ifs"
8065*6881a400Schristos	  eval "cmd=\"$cmd\""
8066*6881a400Schristos	  $opt_silent || {
8067*6881a400Schristos	    func_quote_for_expand "$cmd"
8068*6881a400Schristos	    eval "func_echo $func_quote_for_expand_result"
8069*6881a400Schristos	  }
8070*6881a400Schristos	  $opt_dry_run || eval "$cmd" || {
8071*6881a400Schristos	    lt_exit=$?
8072*6881a400Schristos
8073*6881a400Schristos	    # Restore the uninstalled library and exit
8074*6881a400Schristos	    if test "$mode" = relink; then
8075*6881a400Schristos	      ( cd "$output_objdir" && \
8076*6881a400Schristos	        $RM "${realname}T" && \
8077*6881a400Schristos		$MV "${realname}U" "$realname" )
8078*6881a400Schristos	    fi
8079*6881a400Schristos
8080*6881a400Schristos	    exit $lt_exit
8081*6881a400Schristos	  }
8082*6881a400Schristos	done
8083*6881a400Schristos	IFS="$save_ifs"
8084*6881a400Schristos
8085*6881a400Schristos	# Restore the uninstalled library and exit
8086*6881a400Schristos	if test "$mode" = relink; then
8087*6881a400Schristos	  $opt_dry_run || (cd $output_objdir && $RM ${realname}T && $MV $realname ${realname}T && $MV ${realname}U $realname) || exit $?
8088*6881a400Schristos
8089*6881a400Schristos	  if test -n "$convenience"; then
8090*6881a400Schristos	    if test -z "$whole_archive_flag_spec"; then
8091*6881a400Schristos	      func_show_eval '${RM}r "$gentop"'
8092*6881a400Schristos	    fi
8093*6881a400Schristos	  fi
8094*6881a400Schristos
8095*6881a400Schristos	  exit $EXIT_SUCCESS
8096*6881a400Schristos	fi
8097*6881a400Schristos
8098*6881a400Schristos	# Create links to the real library.
8099*6881a400Schristos	for linkname in $linknames; do
8100*6881a400Schristos	  if test "$realname" != "$linkname"; then
8101*6881a400Schristos	    func_show_eval '(cd "$output_objdir" && $RM "$linkname" && $LN_S "$realname" "$linkname")' 'exit $?'
8102*6881a400Schristos	  fi
8103*6881a400Schristos	done
8104*6881a400Schristos
8105*6881a400Schristos	# If -module or -export-dynamic was specified, set the dlname.
8106*6881a400Schristos	if test "$module" = yes || test "$export_dynamic" = yes; then
8107*6881a400Schristos	  # On all known operating systems, these are identical.
8108*6881a400Schristos	  dlname="$soname"
8109*6881a400Schristos	fi
8110*6881a400Schristos      fi
8111*6881a400Schristos      ;;
8112*6881a400Schristos
8113*6881a400Schristos    obj)
8114*6881a400Schristos      if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
8115*6881a400Schristos	func_warning "\`-dlopen' is ignored for objects"
8116*6881a400Schristos      fi
8117*6881a400Schristos
8118*6881a400Schristos      case " $deplibs" in
8119*6881a400Schristos      *\ -l* | *\ -L*)
8120*6881a400Schristos	func_warning "\`-l' and \`-L' are ignored for objects" ;;
8121*6881a400Schristos      esac
8122*6881a400Schristos
8123*6881a400Schristos      test -n "$rpath" && \
8124*6881a400Schristos	func_warning "\`-rpath' is ignored for objects"
8125*6881a400Schristos
8126*6881a400Schristos      test -n "$xrpath" && \
8127*6881a400Schristos	func_warning "\`-R' is ignored for objects"
8128*6881a400Schristos
8129*6881a400Schristos      test -n "$vinfo" && \
8130*6881a400Schristos	func_warning "\`-version-info' is ignored for objects"
8131*6881a400Schristos
8132*6881a400Schristos      test -n "$release" && \
8133*6881a400Schristos	func_warning "\`-release' is ignored for objects"
8134*6881a400Schristos
8135*6881a400Schristos      case $output in
8136*6881a400Schristos      *.lo)
8137*6881a400Schristos	test -n "$objs$old_deplibs" && \
8138*6881a400Schristos	  func_fatal_error "cannot build library object \`$output' from non-libtool objects"
8139*6881a400Schristos
8140*6881a400Schristos	libobj=$output
8141*6881a400Schristos	func_lo2o "$libobj"
8142*6881a400Schristos	obj=$func_lo2o_result
8143*6881a400Schristos	;;
8144*6881a400Schristos      *)
8145*6881a400Schristos	libobj=
8146*6881a400Schristos	obj="$output"
8147*6881a400Schristos	;;
8148*6881a400Schristos      esac
8149*6881a400Schristos
8150*6881a400Schristos      # Delete the old objects.
8151*6881a400Schristos      $opt_dry_run || $RM $obj $libobj
8152*6881a400Schristos
8153*6881a400Schristos      # Objects from convenience libraries.  This assumes
8154*6881a400Schristos      # single-version convenience libraries.  Whenever we create
8155*6881a400Schristos      # different ones for PIC/non-PIC, this we'll have to duplicate
8156*6881a400Schristos      # the extraction.
8157*6881a400Schristos      reload_conv_objs=
8158*6881a400Schristos      gentop=
8159*6881a400Schristos      # reload_cmds runs $LD directly, so let us get rid of
8160*6881a400Schristos      # -Wl from whole_archive_flag_spec and hope we can get by with
8161*6881a400Schristos      # turning comma into space..
8162*6881a400Schristos      wl=
8163*6881a400Schristos
8164*6881a400Schristos      if test -n "$convenience"; then
8165*6881a400Schristos	if test -n "$whole_archive_flag_spec"; then
8166*6881a400Schristos	  eval "tmp_whole_archive_flags=\"$whole_archive_flag_spec\""
8167*6881a400Schristos	  reload_conv_objs=$reload_objs\ `$ECHO "$tmp_whole_archive_flags" | $SED 's|,| |g'`
8168*6881a400Schristos	else
8169*6881a400Schristos	  gentop="$output_objdir/${obj}x"
8170*6881a400Schristos	  generated="$generated $gentop"
8171*6881a400Schristos
8172*6881a400Schristos	  func_extract_archives $gentop $convenience
8173*6881a400Schristos	  reload_conv_objs="$reload_objs $func_extract_archives_result"
8174*6881a400Schristos	fi
8175*6881a400Schristos      fi
8176*6881a400Schristos
8177*6881a400Schristos      # Create the old-style object.
8178*6881a400Schristos      reload_objs="$objs$old_deplibs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.${libext}$/d; /\.lib$/d; $lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test
8179*6881a400Schristos
8180*6881a400Schristos      output="$obj"
8181*6881a400Schristos      func_execute_cmds "$reload_cmds" 'exit $?'
8182*6881a400Schristos
8183*6881a400Schristos      # Exit if we aren't doing a library object file.
8184*6881a400Schristos      if test -z "$libobj"; then
8185*6881a400Schristos	if test -n "$gentop"; then
8186*6881a400Schristos	  func_show_eval '${RM}r "$gentop"'
8187*6881a400Schristos	fi
8188*6881a400Schristos
8189*6881a400Schristos	exit $EXIT_SUCCESS
8190*6881a400Schristos      fi
8191*6881a400Schristos
8192*6881a400Schristos      if test "$build_libtool_libs" != yes; then
8193*6881a400Schristos	if test -n "$gentop"; then
8194*6881a400Schristos	  func_show_eval '${RM}r "$gentop"'
8195*6881a400Schristos	fi
8196*6881a400Schristos
8197*6881a400Schristos	# Create an invalid libtool object if no PIC, so that we don't
8198*6881a400Schristos	# accidentally link it into a program.
8199*6881a400Schristos	# $show "echo timestamp > $libobj"
8200*6881a400Schristos	# $opt_dry_run || echo timestamp > $libobj || exit $?
8201*6881a400Schristos	exit $EXIT_SUCCESS
8202*6881a400Schristos      fi
8203*6881a400Schristos
8204*6881a400Schristos      if test -n "$pic_flag" || test "$pic_mode" != default; then
8205*6881a400Schristos	# Only do commands if we really have different PIC objects.
8206*6881a400Schristos	reload_objs="$libobjs $reload_conv_objs"
8207*6881a400Schristos	output="$libobj"
8208*6881a400Schristos	func_execute_cmds "$reload_cmds" 'exit $?'
8209*6881a400Schristos      fi
8210*6881a400Schristos
8211*6881a400Schristos      if test -n "$gentop"; then
8212*6881a400Schristos	func_show_eval '${RM}r "$gentop"'
8213*6881a400Schristos      fi
8214*6881a400Schristos
8215*6881a400Schristos      exit $EXIT_SUCCESS
8216*6881a400Schristos      ;;
8217*6881a400Schristos
8218*6881a400Schristos    prog)
8219*6881a400Schristos      case $host in
8220*6881a400Schristos	*cygwin*) func_stripname '' '.exe' "$output"
8221*6881a400Schristos	          output=$func_stripname_result.exe;;
8222*6881a400Schristos      esac
8223*6881a400Schristos      test -n "$vinfo" && \
8224*6881a400Schristos	func_warning "\`-version-info' is ignored for programs"
8225*6881a400Schristos
8226*6881a400Schristos      test -n "$release" && \
8227*6881a400Schristos	func_warning "\`-release' is ignored for programs"
8228*6881a400Schristos
8229*6881a400Schristos      test "$preload" = yes \
8230*6881a400Schristos        && test "$dlopen_support" = unknown \
8231*6881a400Schristos	&& test "$dlopen_self" = unknown \
8232*6881a400Schristos	&& test "$dlopen_self_static" = unknown && \
8233*6881a400Schristos	  func_warning "\`LT_INIT([dlopen])' not used. Assuming no dlopen support."
8234*6881a400Schristos
8235*6881a400Schristos      case $host in
8236*6881a400Schristos      *-*-rhapsody* | *-*-darwin1.[012])
8237*6881a400Schristos	# On Rhapsody replace the C library is the System framework
8238*6881a400Schristos	compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's/ -lc / System.ltframework /'`
8239*6881a400Schristos	finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's/ -lc / System.ltframework /'`
8240*6881a400Schristos	;;
8241*6881a400Schristos      esac
8242*6881a400Schristos
8243*6881a400Schristos      case $host in
8244*6881a400Schristos      *-*-darwin*)
8245*6881a400Schristos	# Don't allow lazy linking, it breaks C++ global constructors
8246*6881a400Schristos	# But is supposedly fixed on 10.4 or later (yay!).
8247*6881a400Schristos	if test "$tagname" = CXX ; then
8248*6881a400Schristos	  case ${MACOSX_DEPLOYMENT_TARGET-10.0} in
8249*6881a400Schristos	    10.[0123])
8250*6881a400Schristos	      compile_command="$compile_command ${wl}-bind_at_load"
8251*6881a400Schristos	      finalize_command="$finalize_command ${wl}-bind_at_load"
8252*6881a400Schristos	    ;;
8253*6881a400Schristos	  esac
8254*6881a400Schristos	fi
8255*6881a400Schristos	# Time to change all our "foo.ltframework" stuff back to "-framework foo"
8256*6881a400Schristos	compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
8257*6881a400Schristos	finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
8258*6881a400Schristos	;;
8259*6881a400Schristos      esac
8260*6881a400Schristos
8261*6881a400Schristos
8262*6881a400Schristos      # move library search paths that coincide with paths to not yet
8263*6881a400Schristos      # installed libraries to the beginning of the library search list
8264*6881a400Schristos      new_libs=
8265*6881a400Schristos      for path in $notinst_path; do
8266*6881a400Schristos	case " $new_libs " in
8267*6881a400Schristos	*" -L$path/$objdir "*) ;;
8268*6881a400Schristos	*)
8269*6881a400Schristos	  case " $compile_deplibs " in
8270*6881a400Schristos	  *" -L$path/$objdir "*)
8271*6881a400Schristos	    new_libs="$new_libs -L$path/$objdir" ;;
8272*6881a400Schristos	  esac
8273*6881a400Schristos	  ;;
8274*6881a400Schristos	esac
8275*6881a400Schristos      done
8276*6881a400Schristos      for deplib in $compile_deplibs; do
8277*6881a400Schristos	case $deplib in
8278*6881a400Schristos	-L*)
8279*6881a400Schristos	  case " $new_libs " in
8280*6881a400Schristos	  *" $deplib "*) ;;
8281*6881a400Schristos	  *) new_libs="$new_libs $deplib" ;;
8282*6881a400Schristos	  esac
8283*6881a400Schristos	  ;;
8284*6881a400Schristos	*) new_libs="$new_libs $deplib" ;;
8285*6881a400Schristos	esac
8286*6881a400Schristos      done
8287*6881a400Schristos      compile_deplibs="$new_libs"
8288*6881a400Schristos
8289*6881a400Schristos
8290*6881a400Schristos      compile_command="$compile_command $compile_deplibs"
8291*6881a400Schristos      finalize_command="$finalize_command $finalize_deplibs"
8292*6881a400Schristos
8293*6881a400Schristos      if test -n "$rpath$xrpath"; then
8294*6881a400Schristos	# If the user specified any rpath flags, then add them.
8295*6881a400Schristos	for libdir in $rpath $xrpath; do
8296*6881a400Schristos	  # This is the magic to use -rpath.
8297*6881a400Schristos	  case "$finalize_rpath " in
8298*6881a400Schristos	  *" $libdir "*) ;;
8299*6881a400Schristos	  *) finalize_rpath="$finalize_rpath $libdir" ;;
8300*6881a400Schristos	  esac
8301*6881a400Schristos	done
8302*6881a400Schristos      fi
8303*6881a400Schristos
8304*6881a400Schristos      # Now hardcode the library paths
8305*6881a400Schristos      rpath=
8306*6881a400Schristos      hardcode_libdirs=
8307*6881a400Schristos      for libdir in $compile_rpath $finalize_rpath; do
8308*6881a400Schristos	if test -n "$hardcode_libdir_flag_spec"; then
8309*6881a400Schristos	  if test -n "$hardcode_libdir_separator"; then
8310*6881a400Schristos	    if test -z "$hardcode_libdirs"; then
8311*6881a400Schristos	      hardcode_libdirs="$libdir"
8312*6881a400Schristos	    else
8313*6881a400Schristos	      # Just accumulate the unique libdirs.
8314*6881a400Schristos	      case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
8315*6881a400Schristos	      *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
8316*6881a400Schristos		;;
8317*6881a400Schristos	      *)
8318*6881a400Schristos		hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
8319*6881a400Schristos		;;
8320*6881a400Schristos	      esac
8321*6881a400Schristos	    fi
8322*6881a400Schristos	  else
8323*6881a400Schristos	    eval "flag=\"$hardcode_libdir_flag_spec\""
8324*6881a400Schristos	    rpath="$rpath $flag"
8325*6881a400Schristos	  fi
8326*6881a400Schristos	elif test -n "$runpath_var"; then
8327*6881a400Schristos	  case "$perm_rpath " in
8328*6881a400Schristos	  *" $libdir "*) ;;
8329*6881a400Schristos	  *) perm_rpath="$perm_rpath $libdir" ;;
8330*6881a400Schristos	  esac
8331*6881a400Schristos	fi
8332*6881a400Schristos	case $host in
8333*6881a400Schristos	*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
8334*6881a400Schristos	  testbindir=`${ECHO} "$libdir" | ${SED} -e 's*/lib$*/bin*'`
8335*6881a400Schristos	  case :$dllsearchpath: in
8336*6881a400Schristos	  *":$libdir:"*) ;;
8337*6881a400Schristos	  ::) dllsearchpath=$libdir;;
8338*6881a400Schristos	  *) dllsearchpath="$dllsearchpath:$libdir";;
8339*6881a400Schristos	  esac
8340*6881a400Schristos	  case :$dllsearchpath: in
8341*6881a400Schristos	  *":$testbindir:"*) ;;
8342*6881a400Schristos	  ::) dllsearchpath=$testbindir;;
8343*6881a400Schristos	  *) dllsearchpath="$dllsearchpath:$testbindir";;
8344*6881a400Schristos	  esac
8345*6881a400Schristos	  ;;
8346*6881a400Schristos	esac
8347*6881a400Schristos      done
8348*6881a400Schristos      # Substitute the hardcoded libdirs into the rpath.
8349*6881a400Schristos      if test -n "$hardcode_libdir_separator" &&
8350*6881a400Schristos	 test -n "$hardcode_libdirs"; then
8351*6881a400Schristos	libdir="$hardcode_libdirs"
8352*6881a400Schristos	eval "rpath=\" $hardcode_libdir_flag_spec\""
8353*6881a400Schristos      fi
8354*6881a400Schristos      compile_rpath="$rpath"
8355*6881a400Schristos
8356*6881a400Schristos      rpath=
8357*6881a400Schristos      hardcode_libdirs=
8358*6881a400Schristos      for libdir in $finalize_rpath; do
8359*6881a400Schristos	if test -n "$hardcode_libdir_flag_spec"; then
8360*6881a400Schristos	  if test -n "$hardcode_libdir_separator"; then
8361*6881a400Schristos	    if test -z "$hardcode_libdirs"; then
8362*6881a400Schristos	      hardcode_libdirs="$libdir"
8363*6881a400Schristos	    else
8364*6881a400Schristos	      # Just accumulate the unique libdirs.
8365*6881a400Schristos	      case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
8366*6881a400Schristos	      *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
8367*6881a400Schristos		;;
8368*6881a400Schristos	      *)
8369*6881a400Schristos		hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
8370*6881a400Schristos		;;
8371*6881a400Schristos	      esac
8372*6881a400Schristos	    fi
8373*6881a400Schristos	  else
8374*6881a400Schristos	    eval "flag=\"$hardcode_libdir_flag_spec\""
8375*6881a400Schristos	    rpath="$rpath $flag"
8376*6881a400Schristos	  fi
8377*6881a400Schristos	elif test -n "$runpath_var"; then
8378*6881a400Schristos	  case "$finalize_perm_rpath " in
8379*6881a400Schristos	  *" $libdir "*) ;;
8380*6881a400Schristos	  *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;;
8381*6881a400Schristos	  esac
8382*6881a400Schristos	fi
8383*6881a400Schristos      done
8384*6881a400Schristos      # Substitute the hardcoded libdirs into the rpath.
8385*6881a400Schristos      if test -n "$hardcode_libdir_separator" &&
8386*6881a400Schristos	 test -n "$hardcode_libdirs"; then
8387*6881a400Schristos	libdir="$hardcode_libdirs"
8388*6881a400Schristos	eval "rpath=\" $hardcode_libdir_flag_spec\""
8389*6881a400Schristos      fi
8390*6881a400Schristos      finalize_rpath="$rpath"
8391*6881a400Schristos
8392*6881a400Schristos      if test -n "$libobjs" && test "$build_old_libs" = yes; then
8393*6881a400Schristos	# Transform all the library objects into standard objects.
8394*6881a400Schristos	compile_command=`$ECHO "$compile_command" | $SP2NL | $SED "$lo2o" | $NL2SP`
8395*6881a400Schristos	finalize_command=`$ECHO "$finalize_command" | $SP2NL | $SED "$lo2o" | $NL2SP`
8396*6881a400Schristos      fi
8397*6881a400Schristos
8398*6881a400Schristos      func_generate_dlsyms "$outputname" "@PROGRAM@" "no"
8399*6881a400Schristos
8400*6881a400Schristos      # template prelinking step
8401*6881a400Schristos      if test -n "$prelink_cmds"; then
8402*6881a400Schristos	func_execute_cmds "$prelink_cmds" 'exit $?'
8403*6881a400Schristos      fi
8404*6881a400Schristos
8405*6881a400Schristos      wrappers_required=yes
8406*6881a400Schristos      case $host in
8407*6881a400Schristos      *cegcc* | *mingw32ce*)
8408*6881a400Schristos        # Disable wrappers for cegcc and mingw32ce hosts, we are cross compiling anyway.
8409*6881a400Schristos        wrappers_required=no
8410*6881a400Schristos        ;;
8411*6881a400Schristos      *cygwin* | *mingw* )
8412*6881a400Schristos        if test "$build_libtool_libs" != yes; then
8413*6881a400Schristos          wrappers_required=no
8414*6881a400Schristos        fi
8415*6881a400Schristos        ;;
8416*6881a400Schristos      *)
8417*6881a400Schristos        if test "$need_relink" = no || test "$build_libtool_libs" != yes; then
8418*6881a400Schristos          wrappers_required=no
8419*6881a400Schristos        fi
8420*6881a400Schristos        ;;
8421*6881a400Schristos      esac
8422*6881a400Schristos      if test "$wrappers_required" = no; then
8423*6881a400Schristos	# Replace the output file specification.
8424*6881a400Schristos	compile_command=`$ECHO "$compile_command" | $SED 's%@OUTPUT@%'"$output"'%g'`
8425*6881a400Schristos	link_command="$compile_command$compile_rpath"
8426*6881a400Schristos
8427*6881a400Schristos	# We have no uninstalled library dependencies, so finalize right now.
8428*6881a400Schristos	exit_status=0
8429*6881a400Schristos	func_show_eval "$link_command" 'exit_status=$?'
8430*6881a400Schristos
8431*6881a400Schristos	# Delete the generated files.
8432*6881a400Schristos	if test -f "$output_objdir/${outputname}S.${objext}"; then
8433*6881a400Schristos	  func_show_eval '$RM "$output_objdir/${outputname}S.${objext}"'
8434*6881a400Schristos	fi
8435*6881a400Schristos
8436*6881a400Schristos	exit $exit_status
8437*6881a400Schristos      fi
8438*6881a400Schristos
8439*6881a400Schristos      if test -n "$compile_shlibpath$finalize_shlibpath"; then
8440*6881a400Schristos	compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command"
8441*6881a400Schristos      fi
8442*6881a400Schristos      if test -n "$finalize_shlibpath"; then
8443*6881a400Schristos	finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command"
8444*6881a400Schristos      fi
8445*6881a400Schristos
8446*6881a400Schristos      compile_var=
8447*6881a400Schristos      finalize_var=
8448*6881a400Schristos      if test -n "$runpath_var"; then
8449*6881a400Schristos	if test -n "$perm_rpath"; then
8450*6881a400Schristos	  # We should set the runpath_var.
8451*6881a400Schristos	  rpath=
8452*6881a400Schristos	  for dir in $perm_rpath; do
8453*6881a400Schristos	    rpath="$rpath$dir:"
8454*6881a400Schristos	  done
8455*6881a400Schristos	  compile_var="$runpath_var=\"$rpath\$$runpath_var\" "
8456*6881a400Schristos	fi
8457*6881a400Schristos	if test -n "$finalize_perm_rpath"; then
8458*6881a400Schristos	  # We should set the runpath_var.
8459*6881a400Schristos	  rpath=
8460*6881a400Schristos	  for dir in $finalize_perm_rpath; do
8461*6881a400Schristos	    rpath="$rpath$dir:"
8462*6881a400Schristos	  done
8463*6881a400Schristos	  finalize_var="$runpath_var=\"$rpath\$$runpath_var\" "
8464*6881a400Schristos	fi
8465*6881a400Schristos      fi
8466*6881a400Schristos
8467*6881a400Schristos      if test "$no_install" = yes; then
8468*6881a400Schristos	# We don't need to create a wrapper script.
8469*6881a400Schristos	link_command="$compile_var$compile_command$compile_rpath"
8470*6881a400Schristos	# Replace the output file specification.
8471*6881a400Schristos	link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output"'%g'`
8472*6881a400Schristos	# Delete the old output file.
8473*6881a400Schristos	$opt_dry_run || $RM $output
8474*6881a400Schristos	# Link the executable and exit
8475*6881a400Schristos	func_show_eval "$link_command" 'exit $?'
8476*6881a400Schristos	exit $EXIT_SUCCESS
8477*6881a400Schristos      fi
8478*6881a400Schristos
8479*6881a400Schristos      if test "$hardcode_action" = relink; then
8480*6881a400Schristos	# Fast installation is not supported
8481*6881a400Schristos	link_command="$compile_var$compile_command$compile_rpath"
8482*6881a400Schristos	relink_command="$finalize_var$finalize_command$finalize_rpath"
8483*6881a400Schristos
8484*6881a400Schristos	func_warning "this platform does not like uninstalled shared libraries"
8485*6881a400Schristos	func_warning "\`$output' will be relinked during installation"
8486*6881a400Schristos      else
8487*6881a400Schristos	if test "$fast_install" != no; then
8488*6881a400Schristos	  link_command="$finalize_var$compile_command$finalize_rpath"
8489*6881a400Schristos	  if test "$fast_install" = yes; then
8490*6881a400Schristos	    relink_command=`$ECHO "$compile_var$compile_command$compile_rpath" | $SED 's%@OUTPUT@%\$progdir/\$file%g'`
8491*6881a400Schristos	  else
8492*6881a400Schristos	    # fast_install is set to needless
8493*6881a400Schristos	    relink_command=
8494*6881a400Schristos	  fi
8495*6881a400Schristos	else
8496*6881a400Schristos	  link_command="$compile_var$compile_command$compile_rpath"
8497*6881a400Schristos	  relink_command="$finalize_var$finalize_command$finalize_rpath"
8498*6881a400Schristos	fi
8499*6881a400Schristos      fi
8500*6881a400Schristos
8501*6881a400Schristos      # Replace the output file specification.
8502*6881a400Schristos      link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`
8503*6881a400Schristos
8504*6881a400Schristos      # Delete the old output files.
8505*6881a400Schristos      $opt_dry_run || $RM $output $output_objdir/$outputname $output_objdir/lt-$outputname
8506*6881a400Schristos
8507*6881a400Schristos      func_show_eval "$link_command" 'exit $?'
8508*6881a400Schristos
8509*6881a400Schristos      # Now create the wrapper script.
8510*6881a400Schristos      func_verbose "creating $output"
8511*6881a400Schristos
8512*6881a400Schristos      # Quote the relink command for shipping.
8513*6881a400Schristos      if test -n "$relink_command"; then
8514*6881a400Schristos	# Preserve any variables that may affect compiler behavior
8515*6881a400Schristos	for var in $variables_saved_for_relink; do
8516*6881a400Schristos	  if eval test -z \"\${$var+set}\"; then
8517*6881a400Schristos	    relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command"
8518*6881a400Schristos	  elif eval var_value=\$$var; test -z "$var_value"; then
8519*6881a400Schristos	    relink_command="$var=; export $var; $relink_command"
8520*6881a400Schristos	  else
8521*6881a400Schristos	    func_quote_for_eval "$var_value"
8522*6881a400Schristos	    relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command"
8523*6881a400Schristos	  fi
8524*6881a400Schristos	done
8525*6881a400Schristos	relink_command="(cd `pwd`; $relink_command)"
8526*6881a400Schristos	relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"`
8527*6881a400Schristos      fi
8528*6881a400Schristos
8529*6881a400Schristos      # Only actually do things if not in dry run mode.
8530*6881a400Schristos      $opt_dry_run || {
8531*6881a400Schristos	# win32 will think the script is a binary if it has
8532*6881a400Schristos	# a .exe suffix, so we strip it off here.
8533*6881a400Schristos	case $output in
8534*6881a400Schristos	  *.exe) func_stripname '' '.exe' "$output"
8535*6881a400Schristos	         output=$func_stripname_result ;;
8536*6881a400Schristos	esac
8537*6881a400Schristos	# test for cygwin because mv fails w/o .exe extensions
8538*6881a400Schristos	case $host in
8539*6881a400Schristos	  *cygwin*)
8540*6881a400Schristos	    exeext=.exe
8541*6881a400Schristos	    func_stripname '' '.exe' "$outputname"
8542*6881a400Schristos	    outputname=$func_stripname_result ;;
8543*6881a400Schristos	  *) exeext= ;;
8544*6881a400Schristos	esac
8545*6881a400Schristos	case $host in
8546*6881a400Schristos	  *cygwin* | *mingw* )
8547*6881a400Schristos	    func_dirname_and_basename "$output" "" "."
8548*6881a400Schristos	    output_name=$func_basename_result
8549*6881a400Schristos	    output_path=$func_dirname_result
8550*6881a400Schristos	    cwrappersource="$output_path/$objdir/lt-$output_name.c"
8551*6881a400Schristos	    cwrapper="$output_path/$output_name.exe"
8552*6881a400Schristos	    $RM $cwrappersource $cwrapper
8553*6881a400Schristos	    trap "$RM $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15
8554*6881a400Schristos
8555*6881a400Schristos	    func_emit_cwrapperexe_src > $cwrappersource
8556*6881a400Schristos
8557*6881a400Schristos	    # The wrapper executable is built using the $host compiler,
8558*6881a400Schristos	    # because it contains $host paths and files. If cross-
8559*6881a400Schristos	    # compiling, it, like the target executable, must be
8560*6881a400Schristos	    # executed on the $host or under an emulation environment.
8561*6881a400Schristos	    $opt_dry_run || {
8562*6881a400Schristos	      $LTCC $LTCFLAGS -o $cwrapper $cwrappersource
8563*6881a400Schristos	      $STRIP $cwrapper
8564*6881a400Schristos	    }
8565*6881a400Schristos
8566*6881a400Schristos	    # Now, create the wrapper script for func_source use:
8567*6881a400Schristos	    func_ltwrapper_scriptname $cwrapper
8568*6881a400Schristos	    $RM $func_ltwrapper_scriptname_result
8569*6881a400Schristos	    trap "$RM $func_ltwrapper_scriptname_result; exit $EXIT_FAILURE" 1 2 15
8570*6881a400Schristos	    $opt_dry_run || {
8571*6881a400Schristos	      # note: this script will not be executed, so do not chmod.
8572*6881a400Schristos	      if test "x$build" = "x$host" ; then
8573*6881a400Schristos		$cwrapper --lt-dump-script > $func_ltwrapper_scriptname_result
8574*6881a400Schristos	      else
8575*6881a400Schristos		func_emit_wrapper no > $func_ltwrapper_scriptname_result
8576*6881a400Schristos	      fi
8577*6881a400Schristos	    }
8578*6881a400Schristos	  ;;
8579*6881a400Schristos	  * )
8580*6881a400Schristos	    $RM $output
8581*6881a400Schristos	    trap "$RM $output; exit $EXIT_FAILURE" 1 2 15
8582*6881a400Schristos
8583*6881a400Schristos	    func_emit_wrapper no > $output
8584*6881a400Schristos	    chmod +x $output
8585*6881a400Schristos	  ;;
8586*6881a400Schristos	esac
8587*6881a400Schristos      }
8588*6881a400Schristos      exit $EXIT_SUCCESS
8589*6881a400Schristos      ;;
8590*6881a400Schristos    esac
8591*6881a400Schristos
8592*6881a400Schristos    # See if we need to build an old-fashioned archive.
8593*6881a400Schristos    for oldlib in $oldlibs; do
8594*6881a400Schristos
8595*6881a400Schristos      if test "$build_libtool_libs" = convenience; then
8596*6881a400Schristos	oldobjs="$libobjs_save $symfileobj"
8597*6881a400Schristos	addlibs="$convenience"
8598*6881a400Schristos	build_libtool_libs=no
8599*6881a400Schristos      else
8600*6881a400Schristos	if test "$build_libtool_libs" = module; then
8601*6881a400Schristos	  oldobjs="$libobjs_save"
8602*6881a400Schristos	  build_libtool_libs=no
8603*6881a400Schristos	else
8604*6881a400Schristos	  oldobjs="$old_deplibs $non_pic_objects"
8605*6881a400Schristos	  if test "$preload" = yes && test -f "$symfileobj"; then
8606*6881a400Schristos	    oldobjs="$oldobjs $symfileobj"
8607*6881a400Schristos	  fi
8608*6881a400Schristos	fi
8609*6881a400Schristos	addlibs="$old_convenience"
8610*6881a400Schristos      fi
8611*6881a400Schristos
8612*6881a400Schristos      if test -n "$addlibs"; then
8613*6881a400Schristos	gentop="$output_objdir/${outputname}x"
8614*6881a400Schristos	generated="$generated $gentop"
8615*6881a400Schristos
8616*6881a400Schristos	func_extract_archives $gentop $addlibs
8617*6881a400Schristos	oldobjs="$oldobjs $func_extract_archives_result"
8618*6881a400Schristos      fi
8619*6881a400Schristos
8620*6881a400Schristos      # Do each command in the archive commands.
8621*6881a400Schristos      if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then
8622*6881a400Schristos	cmds=$old_archive_from_new_cmds
8623*6881a400Schristos      else
8624*6881a400Schristos
8625*6881a400Schristos	# Add any objects from preloaded convenience libraries
8626*6881a400Schristos	if test -n "$dlprefiles"; then
8627*6881a400Schristos	  gentop="$output_objdir/${outputname}x"
8628*6881a400Schristos	  generated="$generated $gentop"
8629*6881a400Schristos
8630*6881a400Schristos	  func_extract_archives $gentop $dlprefiles
8631*6881a400Schristos	  oldobjs="$oldobjs $func_extract_archives_result"
8632*6881a400Schristos	fi
8633*6881a400Schristos
8634*6881a400Schristos	# POSIX demands no paths to be encoded in archives.  We have
8635*6881a400Schristos	# to avoid creating archives with duplicate basenames if we
8636*6881a400Schristos	# might have to extract them afterwards, e.g., when creating a
8637*6881a400Schristos	# static archive out of a convenience library, or when linking
8638*6881a400Schristos	# the entirety of a libtool archive into another (currently
8639*6881a400Schristos	# not supported by libtool).
8640*6881a400Schristos	if (for obj in $oldobjs
8641*6881a400Schristos	    do
8642*6881a400Schristos	      func_basename "$obj"
8643*6881a400Schristos	      $ECHO "$func_basename_result"
8644*6881a400Schristos	    done | sort | sort -uc >/dev/null 2>&1); then
8645*6881a400Schristos	  :
8646*6881a400Schristos	else
8647*6881a400Schristos	  echo "copying selected object files to avoid basename conflicts..."
8648*6881a400Schristos	  gentop="$output_objdir/${outputname}x"
8649*6881a400Schristos	  generated="$generated $gentop"
8650*6881a400Schristos	  func_mkdir_p "$gentop"
8651*6881a400Schristos	  save_oldobjs=$oldobjs
8652*6881a400Schristos	  oldobjs=
8653*6881a400Schristos	  counter=1
8654*6881a400Schristos	  for obj in $save_oldobjs
8655*6881a400Schristos	  do
8656*6881a400Schristos	    func_basename "$obj"
8657*6881a400Schristos	    objbase="$func_basename_result"
8658*6881a400Schristos	    case " $oldobjs " in
8659*6881a400Schristos	    " ") oldobjs=$obj ;;
8660*6881a400Schristos	    *[\ /]"$objbase "*)
8661*6881a400Schristos	      while :; do
8662*6881a400Schristos		# Make sure we don't pick an alternate name that also
8663*6881a400Schristos		# overlaps.
8664*6881a400Schristos		newobj=lt$counter-$objbase
8665*6881a400Schristos		func_arith $counter + 1
8666*6881a400Schristos		counter=$func_arith_result
8667*6881a400Schristos		case " $oldobjs " in
8668*6881a400Schristos		*[\ /]"$newobj "*) ;;
8669*6881a400Schristos		*) if test ! -f "$gentop/$newobj"; then break; fi ;;
8670*6881a400Schristos		esac
8671*6881a400Schristos	      done
8672*6881a400Schristos	      func_show_eval "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj"
8673*6881a400Schristos	      oldobjs="$oldobjs $gentop/$newobj"
8674*6881a400Schristos	      ;;
8675*6881a400Schristos	    *) oldobjs="$oldobjs $obj" ;;
8676*6881a400Schristos	    esac
8677*6881a400Schristos	  done
8678*6881a400Schristos	fi
8679*6881a400Schristos	eval "cmds=\"$old_archive_cmds\""
8680*6881a400Schristos
8681*6881a400Schristos	func_len " $cmds"
8682*6881a400Schristos	len=$func_len_result
8683*6881a400Schristos	if test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then
8684*6881a400Schristos	  cmds=$old_archive_cmds
8685*6881a400Schristos	else
8686*6881a400Schristos	  # the command line is too long to link in one step, link in parts
8687*6881a400Schristos	  func_verbose "using piecewise archive linking..."
8688*6881a400Schristos	  save_RANLIB=$RANLIB
8689*6881a400Schristos	  RANLIB=:
8690*6881a400Schristos	  objlist=
8691*6881a400Schristos	  concat_cmds=
8692*6881a400Schristos	  save_oldobjs=$oldobjs
8693*6881a400Schristos	  oldobjs=
8694*6881a400Schristos	  # Is there a better way of finding the last object in the list?
8695*6881a400Schristos	  for obj in $save_oldobjs
8696*6881a400Schristos	  do
8697*6881a400Schristos	    last_oldobj=$obj
8698*6881a400Schristos	  done
8699*6881a400Schristos	  eval "test_cmds=\"$old_archive_cmds\""
8700*6881a400Schristos	  func_len " $test_cmds"
8701*6881a400Schristos	  len0=$func_len_result
8702*6881a400Schristos	  len=$len0
8703*6881a400Schristos	  for obj in $save_oldobjs
8704*6881a400Schristos	  do
8705*6881a400Schristos	    func_len " $obj"
8706*6881a400Schristos	    func_arith $len + $func_len_result
8707*6881a400Schristos	    len=$func_arith_result
8708*6881a400Schristos	    func_append objlist " $obj"
8709*6881a400Schristos	    if test "$len" -lt "$max_cmd_len"; then
8710*6881a400Schristos	      :
8711*6881a400Schristos	    else
8712*6881a400Schristos	      # the above command should be used before it gets too long
8713*6881a400Schristos	      oldobjs=$objlist
8714*6881a400Schristos	      if test "$obj" = "$last_oldobj" ; then
8715*6881a400Schristos		RANLIB=$save_RANLIB
8716*6881a400Schristos	      fi
8717*6881a400Schristos	      test -z "$concat_cmds" || concat_cmds=$concat_cmds~
8718*6881a400Schristos	      eval "concat_cmds=\"\${concat_cmds}$old_archive_cmds\""
8719*6881a400Schristos	      objlist=
8720*6881a400Schristos	      len=$len0
8721*6881a400Schristos	    fi
8722*6881a400Schristos	  done
8723*6881a400Schristos	  RANLIB=$save_RANLIB
8724*6881a400Schristos	  oldobjs=$objlist
8725*6881a400Schristos	  if test "X$oldobjs" = "X" ; then
8726*6881a400Schristos	    eval "cmds=\"\$concat_cmds\""
8727*6881a400Schristos	  else
8728*6881a400Schristos	    eval "cmds=\"\$concat_cmds~\$old_archive_cmds\""
8729*6881a400Schristos	  fi
8730*6881a400Schristos	fi
8731*6881a400Schristos      fi
8732*6881a400Schristos      func_execute_cmds "$cmds" 'exit $?'
8733*6881a400Schristos    done
8734*6881a400Schristos
8735*6881a400Schristos    test -n "$generated" && \
8736*6881a400Schristos      func_show_eval "${RM}r$generated"
8737*6881a400Schristos
8738*6881a400Schristos    # Now create the libtool archive.
8739*6881a400Schristos    case $output in
8740*6881a400Schristos    *.la)
8741*6881a400Schristos      old_library=
8742*6881a400Schristos      test "$build_old_libs" = yes && old_library="$libname.$libext"
8743*6881a400Schristos      func_verbose "creating $output"
8744*6881a400Schristos
8745*6881a400Schristos      # Preserve any variables that may affect compiler behavior
8746*6881a400Schristos      for var in $variables_saved_for_relink; do
8747*6881a400Schristos	if eval test -z \"\${$var+set}\"; then
8748*6881a400Schristos	  relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command"
8749*6881a400Schristos	elif eval var_value=\$$var; test -z "$var_value"; then
8750*6881a400Schristos	  relink_command="$var=; export $var; $relink_command"
8751*6881a400Schristos	else
8752*6881a400Schristos	  func_quote_for_eval "$var_value"
8753*6881a400Schristos	  relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command"
8754*6881a400Schristos	fi
8755*6881a400Schristos      done
8756*6881a400Schristos      # Quote the link command for shipping.
8757*6881a400Schristos      relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)"
8758*6881a400Schristos      relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"`
8759*6881a400Schristos      if test "$hardcode_automatic" = yes ; then
8760*6881a400Schristos	relink_command=
8761*6881a400Schristos      fi
8762*6881a400Schristos
8763*6881a400Schristos      # Only create the output if not a dry run.
8764*6881a400Schristos      $opt_dry_run || {
8765*6881a400Schristos	for installed in no yes; do
8766*6881a400Schristos	  if test "$installed" = yes; then
8767*6881a400Schristos	    if test -z "$install_libdir"; then
8768*6881a400Schristos	      break
8769*6881a400Schristos	    fi
8770*6881a400Schristos	    output="$output_objdir/$outputname"i
8771*6881a400Schristos	    # Replace all uninstalled libtool libraries with the installed ones
8772*6881a400Schristos	    newdependency_libs=
8773*6881a400Schristos	    for deplib in $dependency_libs; do
8774*6881a400Schristos	      case $deplib in
8775*6881a400Schristos	      *.la)
8776*6881a400Schristos		func_basename "$deplib"
8777*6881a400Schristos		name="$func_basename_result"
8778*6881a400Schristos		libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
8779*6881a400Schristos		test -z "$libdir" && \
8780*6881a400Schristos		  func_fatal_error "\`$deplib' is not a valid libtool archive"
8781*6881a400Schristos		newdependency_libs="$newdependency_libs $libdir/$name"
8782*6881a400Schristos		;;
8783*6881a400Schristos	      *) newdependency_libs="$newdependency_libs $deplib" ;;
8784*6881a400Schristos	      esac
8785*6881a400Schristos	    done
8786*6881a400Schristos	    dependency_libs="$newdependency_libs"
8787*6881a400Schristos	    newdlfiles=
8788*6881a400Schristos
8789*6881a400Schristos	    for lib in $dlfiles; do
8790*6881a400Schristos	      case $lib in
8791*6881a400Schristos	      *.la)
8792*6881a400Schristos	        func_basename "$lib"
8793*6881a400Schristos		name="$func_basename_result"
8794*6881a400Schristos		libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
8795*6881a400Schristos		test -z "$libdir" && \
8796*6881a400Schristos		  func_fatal_error "\`$lib' is not a valid libtool archive"
8797*6881a400Schristos		newdlfiles="$newdlfiles $libdir/$name"
8798*6881a400Schristos		;;
8799*6881a400Schristos	      *) newdlfiles="$newdlfiles $lib" ;;
8800*6881a400Schristos	      esac
8801*6881a400Schristos	    done
8802*6881a400Schristos	    dlfiles="$newdlfiles"
8803*6881a400Schristos	    newdlprefiles=
8804*6881a400Schristos	    for lib in $dlprefiles; do
8805*6881a400Schristos	      case $lib in
8806*6881a400Schristos	      *.la)
8807*6881a400Schristos		# Only pass preopened files to the pseudo-archive (for
8808*6881a400Schristos		# eventual linking with the app. that links it) if we
8809*6881a400Schristos		# didn't already link the preopened objects directly into
8810*6881a400Schristos		# the library:
8811*6881a400Schristos		func_basename "$lib"
8812*6881a400Schristos		name="$func_basename_result"
8813*6881a400Schristos		libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
8814*6881a400Schristos		test -z "$libdir" && \
8815*6881a400Schristos		  func_fatal_error "\`$lib' is not a valid libtool archive"
8816*6881a400Schristos		newdlprefiles="$newdlprefiles $libdir/$name"
8817*6881a400Schristos		;;
8818*6881a400Schristos	      esac
8819*6881a400Schristos	    done
8820*6881a400Schristos	    dlprefiles="$newdlprefiles"
8821*6881a400Schristos	  else
8822*6881a400Schristos	    newdlfiles=
8823*6881a400Schristos	    for lib in $dlfiles; do
8824*6881a400Schristos	      case $lib in
8825*6881a400Schristos		[\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
8826*6881a400Schristos		*) abs=`pwd`"/$lib" ;;
8827*6881a400Schristos	      esac
8828*6881a400Schristos	      newdlfiles="$newdlfiles $abs"
8829*6881a400Schristos	    done
8830*6881a400Schristos	    dlfiles="$newdlfiles"
8831*6881a400Schristos	    newdlprefiles=
8832*6881a400Schristos	    for lib in $dlprefiles; do
8833*6881a400Schristos	      case $lib in
8834*6881a400Schristos		[\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
8835*6881a400Schristos		*) abs=`pwd`"/$lib" ;;
8836*6881a400Schristos	      esac
8837*6881a400Schristos	      newdlprefiles="$newdlprefiles $abs"
8838*6881a400Schristos	    done
8839*6881a400Schristos	    dlprefiles="$newdlprefiles"
8840*6881a400Schristos	  fi
8841*6881a400Schristos	  $RM $output
8842*6881a400Schristos	  # place dlname in correct position for cygwin
8843*6881a400Schristos	  # In fact, it would be nice if we could use this code for all target
8844*6881a400Schristos	  # systems that can't hard-code library paths into their executables
8845*6881a400Schristos	  # and that have no shared library path variable independent of PATH,
8846*6881a400Schristos	  # but it turns out we can't easily determine that from inspecting
8847*6881a400Schristos	  # libtool variables, so we have to hard-code the OSs to which it
8848*6881a400Schristos	  # applies here; at the moment, that means platforms that use the PE
8849*6881a400Schristos	  # object format with DLL files.  See the long comment at the top of
8850*6881a400Schristos	  # tests/bindir.at for full details.
8851*6881a400Schristos	  tdlname=$dlname
8852*6881a400Schristos	  case $host,$output,$installed,$module,$dlname in
8853*6881a400Schristos	    *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll | *cegcc*,*lai,yes,no,*.dll)
8854*6881a400Schristos	      # If a -bindir argument was supplied, place the dll there.
8855*6881a400Schristos	      if test "x$bindir" != x ;
8856*6881a400Schristos	      then
8857*6881a400Schristos		func_relative_path "$install_libdir" "$bindir"
8858*6881a400Schristos		tdlname=$func_relative_path_result$dlname
8859*6881a400Schristos	      else
8860*6881a400Schristos		# Otherwise fall back on heuristic.
8861*6881a400Schristos		tdlname=../bin/$dlname
8862*6881a400Schristos	      fi
8863*6881a400Schristos	      ;;
8864*6881a400Schristos	  esac
8865*6881a400Schristos	  $ECHO > $output "\
8866*6881a400Schristos# $outputname - a libtool library file
8867*6881a400Schristos# Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
8868*6881a400Schristos#
8869*6881a400Schristos# Please DO NOT delete this file!
8870*6881a400Schristos# It is necessary for linking the library.
8871*6881a400Schristos
8872*6881a400Schristos# The name that we can dlopen(3).
8873*6881a400Schristosdlname='$tdlname'
8874*6881a400Schristos
8875*6881a400Schristos# Names of this library.
8876*6881a400Schristoslibrary_names='$library_names'
8877*6881a400Schristos
8878*6881a400Schristos# The name of the static archive.
8879*6881a400Schristosold_library='$old_library'
8880*6881a400Schristos
8881*6881a400Schristos# Linker flags that can not go in dependency_libs.
8882*6881a400Schristosinherited_linker_flags='$new_inherited_linker_flags'
8883*6881a400Schristos
8884*6881a400Schristos# Libraries that this one depends upon.
8885*6881a400Schristosdependency_libs='$dependency_libs'
8886*6881a400Schristos
8887*6881a400Schristos# Names of additional weak libraries provided by this library
8888*6881a400Schristosweak_library_names='$weak_libs'
8889*6881a400Schristos
8890*6881a400Schristos# Version information for $libname.
8891*6881a400Schristoscurrent=$current
8892*6881a400Schristosage=$age
8893*6881a400Schristosrevision=$revision
8894*6881a400Schristos
8895*6881a400Schristos# Is this an already installed library?
8896*6881a400Schristosinstalled=$installed
8897*6881a400Schristos
8898*6881a400Schristos# Should we warn about portability when linking against -modules?
8899*6881a400Schristosshouldnotlink=$module
8900*6881a400Schristos
8901*6881a400Schristos# Files to dlopen/dlpreopen
8902*6881a400Schristosdlopen='$dlfiles'
8903*6881a400Schristosdlpreopen='$dlprefiles'
8904*6881a400Schristos
8905*6881a400Schristos# Directory that this library needs to be installed in:
8906*6881a400Schristoslibdir='$install_libdir'"
8907*6881a400Schristos	  if test "$installed" = no && test "$need_relink" = yes; then
8908*6881a400Schristos	    $ECHO >> $output "\
8909*6881a400Schristosrelink_command=\"$relink_command\""
8910*6881a400Schristos	  fi
8911*6881a400Schristos	done
8912*6881a400Schristos      }
8913*6881a400Schristos
8914*6881a400Schristos      # Do a symbolic link so that the libtool archive can be found in
8915*6881a400Schristos      # LD_LIBRARY_PATH before the program is installed.
8916*6881a400Schristos      func_show_eval '( cd "$output_objdir" && $RM "$outputname" && $LN_S "../$outputname" "$outputname" )' 'exit $?'
8917*6881a400Schristos      ;;
8918*6881a400Schristos    esac
8919*6881a400Schristos    exit $EXIT_SUCCESS
8920*6881a400Schristos}
8921*6881a400Schristos
8922*6881a400Schristos{ test "$mode" = link || test "$mode" = relink; } &&
8923*6881a400Schristos    func_mode_link ${1+"$@"}
8924*6881a400Schristos
8925*6881a400Schristos
8926*6881a400Schristos# func_mode_uninstall arg...
8927*6881a400Schristosfunc_mode_uninstall ()
8928*6881a400Schristos{
8929*6881a400Schristos    $opt_debug
8930*6881a400Schristos    RM="$nonopt"
8931*6881a400Schristos    files=
8932*6881a400Schristos    rmforce=
8933*6881a400Schristos    exit_status=0
8934*6881a400Schristos
8935*6881a400Schristos    # This variable tells wrapper scripts just to set variables rather
8936*6881a400Schristos    # than running their programs.
8937*6881a400Schristos    libtool_install_magic="$magic"
8938*6881a400Schristos
8939*6881a400Schristos    for arg
8940*6881a400Schristos    do
8941*6881a400Schristos      case $arg in
8942*6881a400Schristos      -f) RM="$RM $arg"; rmforce=yes ;;
8943*6881a400Schristos      -*) RM="$RM $arg" ;;
8944*6881a400Schristos      *) files="$files $arg" ;;
8945*6881a400Schristos      esac
8946*6881a400Schristos    done
8947*6881a400Schristos
8948*6881a400Schristos    test -z "$RM" && \
8949*6881a400Schristos      func_fatal_help "you must specify an RM program"
8950*6881a400Schristos
8951*6881a400Schristos    rmdirs=
8952*6881a400Schristos
8953*6881a400Schristos    origobjdir="$objdir"
8954*6881a400Schristos    for file in $files; do
8955*6881a400Schristos      func_dirname "$file" "" "."
8956*6881a400Schristos      dir="$func_dirname_result"
8957*6881a400Schristos      if test "X$dir" = X.; then
8958*6881a400Schristos	objdir="$origobjdir"
8959*6881a400Schristos      else
8960*6881a400Schristos	objdir="$dir/$origobjdir"
8961*6881a400Schristos      fi
8962*6881a400Schristos      func_basename "$file"
8963*6881a400Schristos      name="$func_basename_result"
8964*6881a400Schristos      test "$mode" = uninstall && objdir="$dir"
8965*6881a400Schristos
8966*6881a400Schristos      # Remember objdir for removal later, being careful to avoid duplicates
8967*6881a400Schristos      if test "$mode" = clean; then
8968*6881a400Schristos	case " $rmdirs " in
8969*6881a400Schristos	  *" $objdir "*) ;;
8970*6881a400Schristos	  *) rmdirs="$rmdirs $objdir" ;;
8971*6881a400Schristos	esac
8972*6881a400Schristos      fi
8973*6881a400Schristos
8974*6881a400Schristos      # Don't error if the file doesn't exist and rm -f was used.
8975*6881a400Schristos      if { test -L "$file"; } >/dev/null 2>&1 ||
8976*6881a400Schristos	 { test -h "$file"; } >/dev/null 2>&1 ||
8977*6881a400Schristos	 test -f "$file"; then
8978*6881a400Schristos	:
8979*6881a400Schristos      elif test -d "$file"; then
8980*6881a400Schristos	exit_status=1
8981*6881a400Schristos	continue
8982*6881a400Schristos      elif test "$rmforce" = yes; then
8983*6881a400Schristos	continue
8984*6881a400Schristos      fi
8985*6881a400Schristos
8986*6881a400Schristos      rmfiles="$file"
8987*6881a400Schristos
8988*6881a400Schristos      case $name in
8989*6881a400Schristos      *.la)
8990*6881a400Schristos	# Possibly a libtool archive, so verify it.
8991*6881a400Schristos	if func_lalib_p "$file"; then
8992*6881a400Schristos	  func_source $dir/$name
8993*6881a400Schristos
8994*6881a400Schristos	  # Delete the libtool libraries and symlinks.
8995*6881a400Schristos	  for n in $library_names; do
8996*6881a400Schristos	    rmfiles="$rmfiles $objdir/$n"
8997*6881a400Schristos	  done
8998*6881a400Schristos	  test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library"
8999*6881a400Schristos
9000*6881a400Schristos	  case "$mode" in
9001*6881a400Schristos	  clean)
9002*6881a400Schristos	    case "  $library_names " in
9003*6881a400Schristos	    # "  " in the beginning catches empty $dlname
9004*6881a400Schristos	    *" $dlname "*) ;;
9005*6881a400Schristos	    *) rmfiles="$rmfiles $objdir/$dlname" ;;
9006*6881a400Schristos	    esac
9007*6881a400Schristos	    test -n "$libdir" && rmfiles="$rmfiles $objdir/$name $objdir/${name}i"
9008*6881a400Schristos	    ;;
9009*6881a400Schristos	  uninstall)
9010*6881a400Schristos	    if test -n "$library_names"; then
9011*6881a400Schristos	      # Do each command in the postuninstall commands.
9012*6881a400Schristos	      func_execute_cmds "$postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1'
9013*6881a400Schristos	    fi
9014*6881a400Schristos
9015*6881a400Schristos	    if test -n "$old_library"; then
9016*6881a400Schristos	      # Do each command in the old_postuninstall commands.
9017*6881a400Schristos	      func_execute_cmds "$old_postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1'
9018*6881a400Schristos	    fi
9019*6881a400Schristos	    # FIXME: should reinstall the best remaining shared library.
9020*6881a400Schristos	    ;;
9021*6881a400Schristos	  esac
9022*6881a400Schristos	fi
9023*6881a400Schristos	;;
9024*6881a400Schristos
9025*6881a400Schristos      *.lo)
9026*6881a400Schristos	# Possibly a libtool object, so verify it.
9027*6881a400Schristos	if func_lalib_p "$file"; then
9028*6881a400Schristos
9029*6881a400Schristos	  # Read the .lo file
9030*6881a400Schristos	  func_source $dir/$name
9031*6881a400Schristos
9032*6881a400Schristos	  # Add PIC object to the list of files to remove.
9033*6881a400Schristos	  if test -n "$pic_object" &&
9034*6881a400Schristos	     test "$pic_object" != none; then
9035*6881a400Schristos	    rmfiles="$rmfiles $dir/$pic_object"
9036*6881a400Schristos	  fi
9037*6881a400Schristos
9038*6881a400Schristos	  # Add non-PIC object to the list of files to remove.
9039*6881a400Schristos	  if test -n "$non_pic_object" &&
9040*6881a400Schristos	     test "$non_pic_object" != none; then
9041*6881a400Schristos	    rmfiles="$rmfiles $dir/$non_pic_object"
9042*6881a400Schristos	  fi
9043*6881a400Schristos	fi
9044*6881a400Schristos	;;
9045*6881a400Schristos
9046*6881a400Schristos      *)
9047*6881a400Schristos	if test "$mode" = clean ; then
9048*6881a400Schristos	  noexename=$name
9049*6881a400Schristos	  case $file in
9050*6881a400Schristos	  *.exe)
9051*6881a400Schristos	    func_stripname '' '.exe' "$file"
9052*6881a400Schristos	    file=$func_stripname_result
9053*6881a400Schristos	    func_stripname '' '.exe' "$name"
9054*6881a400Schristos	    noexename=$func_stripname_result
9055*6881a400Schristos	    # $file with .exe has already been added to rmfiles,
9056*6881a400Schristos	    # add $file without .exe
9057*6881a400Schristos	    rmfiles="$rmfiles $file"
9058*6881a400Schristos	    ;;
9059*6881a400Schristos	  esac
9060*6881a400Schristos	  # Do a test to see if this is a libtool program.
9061*6881a400Schristos	  if func_ltwrapper_p "$file"; then
9062*6881a400Schristos	    if func_ltwrapper_executable_p "$file"; then
9063*6881a400Schristos	      func_ltwrapper_scriptname "$file"
9064*6881a400Schristos	      relink_command=
9065*6881a400Schristos	      func_source $func_ltwrapper_scriptname_result
9066*6881a400Schristos	      rmfiles="$rmfiles $func_ltwrapper_scriptname_result"
9067*6881a400Schristos	    else
9068*6881a400Schristos	      relink_command=
9069*6881a400Schristos	      func_source $dir/$noexename
9070*6881a400Schristos	    fi
9071*6881a400Schristos
9072*6881a400Schristos	    # note $name still contains .exe if it was in $file originally
9073*6881a400Schristos	    # as does the version of $file that was added into $rmfiles
9074*6881a400Schristos	    rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}"
9075*6881a400Schristos	    if test "$fast_install" = yes && test -n "$relink_command"; then
9076*6881a400Schristos	      rmfiles="$rmfiles $objdir/lt-$name"
9077*6881a400Schristos	    fi
9078*6881a400Schristos	    if test "X$noexename" != "X$name" ; then
9079*6881a400Schristos	      rmfiles="$rmfiles $objdir/lt-${noexename}.c"
9080*6881a400Schristos	    fi
9081*6881a400Schristos	  fi
9082*6881a400Schristos	fi
9083*6881a400Schristos	;;
9084*6881a400Schristos      esac
9085*6881a400Schristos      func_show_eval "$RM $rmfiles" 'exit_status=1'
9086*6881a400Schristos    done
9087*6881a400Schristos    objdir="$origobjdir"
9088*6881a400Schristos
9089*6881a400Schristos    # Try to remove the ${objdir}s in the directories where we deleted files
9090*6881a400Schristos    for dir in $rmdirs; do
9091*6881a400Schristos      if test -d "$dir"; then
9092*6881a400Schristos	func_show_eval "rmdir $dir >/dev/null 2>&1"
9093*6881a400Schristos      fi
9094*6881a400Schristos    done
9095*6881a400Schristos
9096*6881a400Schristos    exit $exit_status
9097*6881a400Schristos}
9098*6881a400Schristos
9099*6881a400Schristos{ test "$mode" = uninstall || test "$mode" = clean; } &&
9100*6881a400Schristos    func_mode_uninstall ${1+"$@"}
9101*6881a400Schristos
9102*6881a400Schristostest -z "$mode" && {
9103*6881a400Schristos  help="$generic_help"
9104*6881a400Schristos  func_fatal_help "you must specify a MODE"
9105*6881a400Schristos}
9106*6881a400Schristos
9107*6881a400Schristostest -z "$exec_cmd" && \
9108*6881a400Schristos  func_fatal_help "invalid operation mode \`$mode'"
9109*6881a400Schristos
9110*6881a400Schristosif test -n "$exec_cmd"; then
9111*6881a400Schristos  eval exec "$exec_cmd"
9112*6881a400Schristos  exit $EXIT_FAILURE
9113*6881a400Schristosfi
9114*6881a400Schristos
9115*6881a400Schristosexit $exit_status
9116*6881a400Schristos
9117*6881a400Schristos
9118*6881a400Schristos# The TAGs below are defined such that we never get into a situation
9119*6881a400Schristos# in which we disable both kinds of libraries.  Given conflicting
9120*6881a400Schristos# choices, we go for a static library, that is the most portable,
9121*6881a400Schristos# since we can't tell whether shared libraries were disabled because
9122*6881a400Schristos# the user asked for that or because the platform doesn't support
9123*6881a400Schristos# them.  This is particularly important on AIX, because we don't
9124*6881a400Schristos# support having both static and shared libraries enabled at the same
9125*6881a400Schristos# time on that platform, so we default to a shared-only configuration.
9126*6881a400Schristos# If a disable-shared tag is given, we'll fallback to a static-only
9127*6881a400Schristos# configuration.  But we'll never go from static-only to shared-only.
9128*6881a400Schristos
9129*6881a400Schristos# ### BEGIN LIBTOOL TAG CONFIG: disable-shared
9130*6881a400Schristosbuild_libtool_libs=no
9131*6881a400Schristosbuild_old_libs=yes
9132*6881a400Schristos# ### END LIBTOOL TAG CONFIG: disable-shared
9133*6881a400Schristos
9134*6881a400Schristos# ### BEGIN LIBTOOL TAG CONFIG: disable-static
9135*6881a400Schristosbuild_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac`
9136*6881a400Schristos# ### END LIBTOOL TAG CONFIG: disable-static
9137*6881a400Schristos
9138*6881a400Schristos# Local Variables:
9139*6881a400Schristos# mode:shell-script
9140*6881a400Schristos# sh-indentation:2
9141*6881a400Schristos# End:
9142*6881a400Schristos# vi:sw=2
9143*6881a400Schristos
9144*6881a400Schristos
9145*6881a400Schristos# ### BEGIN LIBTOOL TAG CONFIG: CXX
9146*6881a400Schristos
9147*6881a400Schristos# The linker used to build libraries.
9148*6881a400SchristosLD="ld -m elf_x86_64"
9149*6881a400Schristos
9150*6881a400Schristos# How to create reloadable object files.
9151*6881a400Schristosreload_flag=" -r"
9152*6881a400Schristosreload_cmds="\$LD\$reload_flag -o \$output\$reload_objs"
9153*6881a400Schristos
9154*6881a400Schristos# Commands used to build an old-style archive.
9155*6881a400Schristosold_archive_cmds="\$AR \$AR_FLAGS \$oldlib\$oldobjs~\$RANLIB \$oldlib"
9156*6881a400Schristos
9157*6881a400Schristos# A language specific compiler.
9158*6881a400SchristosCC="g++"
9159*6881a400Schristos
9160*6881a400Schristos# Is the compiler the GNU compiler?
9161*6881a400Schristoswith_gcc=yes
9162*6881a400Schristos
9163*6881a400Schristos# Compiler flag to turn off builtin functions.
9164*6881a400Schristosno_builtin_flag=" -fno-builtin"
9165*6881a400Schristos
9166*6881a400Schristos# How to pass a linker flag through the compiler.
9167*6881a400Schristoswl="-Wl,"
9168*6881a400Schristos
9169*6881a400Schristos# Additional compiler flags for building library objects.
9170*6881a400Schristospic_flag=" -fPIC -DPIC"
9171*6881a400Schristos
9172*6881a400Schristos# Compiler flag to prevent dynamic linking.
9173*6881a400Schristoslink_static_flag="-static"
9174*6881a400Schristos
9175*6881a400Schristos# Does compiler simultaneously support -c and -o options?
9176*6881a400Schristoscompiler_c_o="yes"
9177*6881a400Schristos
9178*6881a400Schristos# Whether or not to add -lc for building shared libraries.
9179*6881a400Schristosbuild_libtool_need_lc=no
9180*6881a400Schristos
9181*6881a400Schristos# Whether or not to disallow shared libs when runtime libs are static.
9182*6881a400Schristosallow_libtool_libs_with_static_runtimes=no
9183*6881a400Schristos
9184*6881a400Schristos# Compiler flag to allow reflexive dlopens.
9185*6881a400Schristosexport_dynamic_flag_spec="\${wl}--export-dynamic"
9186*6881a400Schristos
9187*6881a400Schristos# Compiler flag to generate shared objects directly from archives.
9188*6881a400Schristoswhole_archive_flag_spec="\${wl}--whole-archive\$convenience \${wl}--no-whole-archive"
9189*6881a400Schristos
9190*6881a400Schristos# Whether the compiler copes with passing no objects directly.
9191*6881a400Schristoscompiler_needs_object="no"
9192*6881a400Schristos
9193*6881a400Schristos# Create an old-style archive from a shared archive.
9194*6881a400Schristosold_archive_from_new_cmds=""
9195*6881a400Schristos
9196*6881a400Schristos# Create a temporary old-style archive to link instead of a shared archive.
9197*6881a400Schristosold_archive_from_expsyms_cmds=""
9198*6881a400Schristos
9199*6881a400Schristos# Commands used to build a shared archive.
9200*6881a400Schristosarchive_cmds="\$CC \$pic_flag -shared -nostdlib \$predep_objects \$libobjs \$deplibs \$postdep_objects \$compiler_flags \${wl}-soname \$wl\$soname -o \$lib"
9201*6881a400Schristosarchive_expsym_cmds="\$CC \$pic_flag -shared -nostdlib \$predep_objects \$libobjs \$deplibs \$postdep_objects \$compiler_flags \${wl}-soname \$wl\$soname \${wl}-retain-symbols-file \$wl\$export_symbols -o \$lib"
9202*6881a400Schristos
9203*6881a400Schristos# Commands used to build a loadable module if different from building
9204*6881a400Schristos# a shared archive.
9205*6881a400Schristosmodule_cmds=""
9206*6881a400Schristosmodule_expsym_cmds=""
9207*6881a400Schristos
9208*6881a400Schristos# Whether we are building with GNU ld or not.
9209*6881a400Schristoswith_gnu_ld="yes"
9210*6881a400Schristos
9211*6881a400Schristos# Flag that allows shared libraries with undefined symbols to be built.
9212*6881a400Schristosallow_undefined_flag=""
9213*6881a400Schristos
9214*6881a400Schristos# Flag that enforces no undefined symbols.
9215*6881a400Schristosno_undefined_flag=""
9216*6881a400Schristos
9217*6881a400Schristos# Flag to hardcode $libdir into a binary during linking.
9218*6881a400Schristos# This must work even if $libdir does not exist
9219*6881a400Schristoshardcode_libdir_flag_spec="\${wl}-rpath \${wl}\$libdir"
9220*6881a400Schristos
9221*6881a400Schristos# If ld is used when linking, flag to hardcode $libdir into a binary
9222*6881a400Schristos# during linking.  This must work even if $libdir does not exist.
9223*6881a400Schristoshardcode_libdir_flag_spec_ld=""
9224*6881a400Schristos
9225*6881a400Schristos# Whether we need a single "-rpath" flag with a separated argument.
9226*6881a400Schristoshardcode_libdir_separator=""
9227*6881a400Schristos
9228*6881a400Schristos# Set to "yes" if using DIR/libNAME${shared_ext} during linking hardcodes
9229*6881a400Schristos# DIR into the resulting binary.
9230*6881a400Schristoshardcode_direct=no
9231*6881a400Schristos
9232*6881a400Schristos# Set to "yes" if using DIR/libNAME${shared_ext} during linking hardcodes
9233*6881a400Schristos# DIR into the resulting binary and the resulting library dependency is
9234*6881a400Schristos# "absolute",i.e impossible to change by setting ${shlibpath_var} if the
9235*6881a400Schristos# library is relocated.
9236*6881a400Schristoshardcode_direct_absolute=no
9237*6881a400Schristos
9238*6881a400Schristos# Set to "yes" if using the -LDIR flag during linking hardcodes DIR
9239*6881a400Schristos# into the resulting binary.
9240*6881a400Schristoshardcode_minus_L=no
9241*6881a400Schristos
9242*6881a400Schristos# Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR
9243*6881a400Schristos# into the resulting binary.
9244*6881a400Schristoshardcode_shlibpath_var=unsupported
9245*6881a400Schristos
9246*6881a400Schristos# Set to "yes" if building a shared library automatically hardcodes DIR
9247*6881a400Schristos# into the library and all subsequent libraries and executables linked
9248*6881a400Schristos# against it.
9249*6881a400Schristoshardcode_automatic=no
9250*6881a400Schristos
9251*6881a400Schristos# Set to yes if linker adds runtime paths of dependent libraries
9252*6881a400Schristos# to runtime path list.
9253*6881a400Schristosinherit_rpath=no
9254*6881a400Schristos
9255*6881a400Schristos# Whether libtool must link a program against all its dependency libraries.
9256*6881a400Schristoslink_all_deplibs=unknown
9257*6881a400Schristos
9258*6881a400Schristos# Fix the shell variable $srcfile for the compiler.
9259*6881a400Schristosfix_srcfile_path=""
9260*6881a400Schristos
9261*6881a400Schristos# Set to "yes" if exported symbols are required.
9262*6881a400Schristosalways_export_symbols=no
9263*6881a400Schristos
9264*6881a400Schristos# The commands to list exported symbols.
9265*6881a400Schristosexport_symbols_cmds="\$NM \$libobjs \$convenience | \$global_symbol_pipe | \$SED 's/.* //' | sort | uniq > \$export_symbols"
9266*6881a400Schristos
9267*6881a400Schristos# Symbols that should not be listed in the preloaded symbols.
9268*6881a400Schristosexclude_expsyms="_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*"
9269*6881a400Schristos
9270*6881a400Schristos# Symbols that must always be exported.
9271*6881a400Schristosinclude_expsyms=""
9272*6881a400Schristos
9273*6881a400Schristos# Commands necessary for linking programs (against libraries) with templates.
9274*6881a400Schristosprelink_cmds=""
9275*6881a400Schristos
9276*6881a400Schristos# Specify filename containing input files.
9277*6881a400Schristosfile_list_spec=""
9278*6881a400Schristos
9279*6881a400Schristos# How to hardcode a shared library path into an executable.
9280*6881a400Schristoshardcode_action=immediate
9281*6881a400Schristos
9282*6881a400Schristos# The directories searched by this compiler when creating a shared library.
9283*6881a400Schristoscompiler_lib_search_dirs="/usr/lib/gcc/x86_64-linux-gnu/11 /usr/lib/gcc/x86_64-linux-gnu/11/../../../x86_64-linux-gnu /usr/lib/gcc/x86_64-linux-gnu/11/../../../../lib /lib/x86_64-linux-gnu /lib/../lib /usr/lib/x86_64-linux-gnu /usr/lib/../lib /usr/lib/gcc/x86_64-linux-gnu/11/../../.."
9284*6881a400Schristos
9285*6881a400Schristos# Dependencies to place before and after the objects being linked to
9286*6881a400Schristos# create a shared library.
9287*6881a400Schristospredep_objects="/usr/lib/gcc/x86_64-linux-gnu/11/../../../x86_64-linux-gnu/crti.o /usr/lib/gcc/x86_64-linux-gnu/11/crtbeginS.o"
9288*6881a400Schristospostdep_objects="/usr/lib/gcc/x86_64-linux-gnu/11/crtendS.o /usr/lib/gcc/x86_64-linux-gnu/11/../../../x86_64-linux-gnu/crtn.o"
9289*6881a400Schristospredeps=""
9290*6881a400Schristospostdeps="-lstdc++ -lm -lgcc_s -lc -lgcc_s"
9291*6881a400Schristos
9292*6881a400Schristos# The library search path used internally by the compiler when linking
9293*6881a400Schristos# a shared library.
9294*6881a400Schristoscompiler_lib_search_path="-L/usr/lib/gcc/x86_64-linux-gnu/11 -L/usr/lib/gcc/x86_64-linux-gnu/11/../../../x86_64-linux-gnu -L/usr/lib/gcc/x86_64-linux-gnu/11/../../../../lib -L/lib/x86_64-linux-gnu -L/lib/../lib -L/usr/lib/x86_64-linux-gnu -L/usr/lib/../lib -L/usr/lib/gcc/x86_64-linux-gnu/11/../../.."
9295*6881a400Schristos
9296*6881a400Schristos# ### END LIBTOOL TAG CONFIG: CXX
9297