251
by Andrew Joseph Smith
pkg fixes |
1 |
#! /bin/bash
|
2 |
# Generated automatically by config.status (tpad) 6.5.1.2
|
|
3 |
# NOTE: Changes made to this file will be lost: look at ltmain.sh.
|
|
4 |
||
5 |
# Provide generalized library-building support services.
|
|
6 |
# Written by Gordon Matzigkeit, 1996
|
|
7 |
||
8 |
# Copyright (C) 2014 Free Software Foundation, Inc.
|
|
9 |
# This is free software; see the source for copying conditions. There is NO
|
|
10 |
# warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
11 |
||
12 |
# GNU Libtool is free software; you can redistribute it and/or modify
|
|
13 |
# it under the terms of the GNU General Public License as published by
|
|
14 |
# the Free Software Foundation; either version 2 of of the License, or
|
|
15 |
# (at your option) any later version.
|
|
16 |
#
|
|
17 |
# As a special exception to the GNU General Public License, if you
|
|
18 |
# distribute this file as part of a program or library that is built
|
|
19 |
# using GNU Libtool, you may include this file under the same
|
|
20 |
# distribution terms that you use for the rest of that program.
|
|
21 |
#
|
|
22 |
# GNU Libtool is distributed in the hope that it will be useful, but
|
|
23 |
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
24 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
25 |
# GNU General Public License for more details.
|
|
26 |
#
|
|
27 |
# You should have received a copy of the GNU General Public License
|
|
28 |
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
29 |
||
30 |
||
31 |
# The names of the tagged configurations supported by this script.
|
|
32 |
available_tags='CXX ' |
|
33 |
||
34 |
# Configured defaults for sys_lib_dlsearch_path munging.
|
|
35 |
: ${LT_SYS_LIBRARY_PATH=""} |
|
36 |
||
37 |
# ### BEGIN LIBTOOL CONFIG
|
|
38 |
||
39 |
# Which release of libtool.m4 was used?
|
|
40 |
macro_version=2.4.6 |
|
41 |
macro_revision=2.4.6 |
|
42 |
||
43 |
# Whether or not to build shared libraries.
|
|
44 |
build_libtool_libs=yes |
|
45 |
||
46 |
# Whether or not to build static libraries.
|
|
47 |
build_old_libs=yes |
|
48 |
||
49 |
# What type of objects to build.
|
|
50 |
pic_mode=default |
|
51 |
||
52 |
# Whether or not to optimize for fast installation.
|
|
53 |
fast_install=needless |
|
54 |
||
55 |
# Shared archive member basename,for filename based shared library versioning on AIX.
|
|
56 |
shared_archive_member_spec= |
|
57 |
||
58 |
# Shell to use when invoking shell scripts.
|
|
59 |
SHELL="/bin/bash" |
|
60 |
||
61 |
# An echo program that protects backslashes.
|
|
62 |
ECHO="printf %s\\n" |
|
63 |
||
64 |
# The PATH separator for the build system.
|
|
65 |
PATH_SEPARATOR=":" |
|
66 |
||
67 |
# The host system.
|
|
68 |
host_alias= |
|
69 |
host=x86_64-pc-linux-gnu |
|
70 |
host_os=linux-gnu |
|
71 |
||
72 |
# The build system.
|
|
73 |
build_alias=x86_64-linux-gnu |
|
74 |
build=x86_64-pc-linux-gnu |
|
75 |
build_os=linux-gnu |
|
76 |
||
77 |
# A sed program that does not truncate output.
|
|
78 |
SED="/usr/bin/sed" |
|
79 |
||
80 |
# Sed that helps us avoid accidentally triggering echo(1) options like -n.
|
|
81 |
Xsed="$SED -e 1s/^X//" |
|
82 |
||
83 |
# A grep program that handles long lines.
|
|
84 |
GREP="/usr/bin/grep" |
|
85 |
||
86 |
# An ERE matcher.
|
|
87 |
EGREP="/usr/bin/grep -E" |
|
88 |
||
89 |
# A literal string matcher.
|
|
90 |
FGREP="/usr/bin/grep -F" |
|
91 |
||
92 |
# A BSD- or MS-compatible name lister.
|
|
93 |
NM="/usr/bin/nm -B" |
|
94 |
||
95 |
# Whether we need soft or hard links.
|
|
96 |
LN_S="ln -s" |
|
97 |
||
98 |
# What is the maximum length of a command?
|
|
99 |
max_cmd_len=1572864 |
|
100 |
||
101 |
# Object file suffix (normally "o").
|
|
102 |
objext=o |
|
103 |
||
104 |
# Executable file suffix (normally "").
|
|
105 |
exeext= |
|
106 |
||
107 |
# whether the shell understands "unset".
|
|
108 |
lt_unset=unset |
|
109 |
||
110 |
# turn spaces into newlines.
|
|
111 |
SP2NL="tr \\040 \\012" |
|
112 |
||
113 |
# turn newlines into spaces.
|
|
114 |
NL2SP="tr \\015\\012 \\040\\040" |
|
115 |
||
116 |
# convert $build file names to $host format.
|
|
117 |
to_host_file_cmd=func_convert_file_noop |
|
118 |
||
119 |
# convert $build files to toolchain format.
|
|
120 |
to_tool_file_cmd=func_convert_file_noop |
|
121 |
||
122 |
# An object symbol dumper.
|
|
123 |
OBJDUMP="objdump" |
|
124 |
||
125 |
# Method to check whether dependent libraries are shared objects.
|
|
126 |
deplibs_check_method="pass_all" |
|
127 |
||
128 |
# Command to use when deplibs_check_method = "file_magic".
|
|
129 |
file_magic_cmd="\$MAGIC_CMD" |
|
130 |
||
131 |
# How to find potential files when deplibs_check_method = "file_magic".
|
|
132 |
file_magic_glob="" |
|
133 |
||
134 |
# Find potential files using nocaseglob when deplibs_check_method = "file_magic".
|
|
135 |
want_nocaseglob="no" |
|
136 |
||
137 |
# DLL creation program.
|
|
138 |
DLLTOOL="false" |
|
139 |
||
140 |
# Command to associate shared and link libraries.
|
|
141 |
sharedlib_from_linklib_cmd="printf %s\\n" |
|
142 |
||
143 |
# The archiver.
|
|
144 |
AR="ar" |
|
145 |
||
146 |
# Flags to create an archive.
|
|
147 |
AR_FLAGS="cr" |
|
148 |
||
149 |
# How to feed a file listing to the archiver.
|
|
150 |
archiver_list_spec="@" |
|
151 |
||
152 |
# A symbol stripping program.
|
|
153 |
STRIP="strip" |
|
154 |
||
155 |
# Commands used to install an old-style archive.
|
|
156 |
RANLIB="ranlib" |
|
157 |
old_postinstall_cmds="chmod 644 \$oldlib~\$RANLIB \$tool_oldlib" |
|
158 |
old_postuninstall_cmds="" |
|
159 |
||
160 |
# Whether to use a lock for old archive extraction.
|
|
161 |
lock_old_archive_extraction=no |
|
162 |
||
163 |
# A C compiler.
|
|
164 |
LTCC="gcc" |
|
165 |
||
166 |
# LTCC compiler flags.
|
|
167 |
LTCFLAGS="-fdebug-prefix-map=/home/andy/TPAD_PROOJECT/tpad-project=. -fstack-protector-strong -Wformat -Werror=format-security -g0 -flto=11 -O3" |
|
168 |
||
169 |
# Take the output of nm and produce a listing of raw symbols and C names.
|
|
170 |
global_symbol_pipe="sed -n -e 's/^.*[ ]\\([ABCDGIRSTW][ABCDGIRSTW]*\\)[ ][ ]*\\([_A-Za-z][_A-Za-z0-9]*\\)\$/\\1 \\2 \\2/p' | sed '/ __gnu_lto/d'" |
|
171 |
||
172 |
# Transform the output of nm in a proper C declaration.
|
|
173 |
global_symbol_to_cdecl="sed -n -e 's/^T .* \\(.*\\)\$/extern int \\1();/p' -e 's/^[ABCDGIRSTW][ABCDGIRSTW]* .* \\(.*\\)\$/extern char \\1;/p'" |
|
174 |
||
175 |
# Transform the output of nm into a list of symbols to manually relocate.
|
|
176 |
global_symbol_to_import="" |
|
177 |
||
178 |
# Transform the output of nm in a C name address pair.
|
|
179 |
global_symbol_to_c_name_address="sed -n -e 's/^: \\(.*\\) .*\$/ {\"\\1\", (void *) 0},/p' -e 's/^[ABCDGIRSTW][ABCDGIRSTW]* .* \\(.*\\)\$/ {\"\\1\", (void *) \\&\\1},/p'" |
|
180 |
||
181 |
# Transform the output of nm in a C name address pair when lib prefix is needed.
|
|
182 |
global_symbol_to_c_name_address_lib_prefix="sed -n -e 's/^: \\(.*\\) .*\$/ {\"\\1\", (void *) 0},/p' -e 's/^[ABCDGIRSTW][ABCDGIRSTW]* .* \\(lib.*\\)\$/ {\"\\1\", (void *) \\&\\1},/p' -e 's/^[ABCDGIRSTW][ABCDGIRSTW]* .* \\(.*\\)\$/ {\"lib\\1\", (void *) \\&\\1},/p'" |
|
183 |
||
184 |
# The name lister interface.
|
|
185 |
nm_interface="BSD nm" |
|
186 |
||
187 |
# Specify filename containing input files for $NM.
|
|
188 |
nm_file_list_spec="@" |
|
189 |
||
190 |
# The root where to search for dependent libraries,and where our libraries should be installed.
|
|
191 |
lt_sysroot= |
|
192 |
||
193 |
# Command to truncate a binary pipe.
|
|
194 |
lt_truncate_bin="/usr/bin/dd bs=4096 count=1" |
|
195 |
||
196 |
# The name of the directory that contains temporary libtool files.
|
|
197 |
objdir=.libs |
|
198 |
||
199 |
# Used to examine libraries when file_magic_cmd begins with "file".
|
|
200 |
MAGIC_CMD=file |
|
201 |
||
202 |
# Must we lock files when doing compilation?
|
|
203 |
need_locks="no" |
|
204 |
||
205 |
# Manifest tool.
|
|
206 |
MANIFEST_TOOL=":" |
|
207 |
||
208 |
# Tool to manipulate archived DWARF debug symbol files on Mac OS X.
|
|
209 |
DSYMUTIL="" |
|
210 |
||
211 |
# Tool to change global to local symbols on Mac OS X.
|
|
212 |
NMEDIT="" |
|
213 |
||
214 |
# Tool to manipulate fat objects and archives on Mac OS X.
|
|
215 |
LIPO="" |
|
216 |
||
217 |
# ldd/readelf like tool for Mach-O binaries on Mac OS X.
|
|
218 |
OTOOL="" |
|
219 |
||
220 |
# ldd/readelf like tool for 64 bit Mach-O binaries on Mac OS X 10.4.
|
|
221 |
OTOOL64="" |
|
222 |
||
223 |
# Old archive suffix (normally "a").
|
|
224 |
libext=a |
|
225 |
||
226 |
# Shared library suffix (normally ".so").
|
|
227 |
shrext_cmds=".so" |
|
228 |
||
229 |
# The commands to extract the exported symbol list from a shared archive.
|
|
230 |
extract_expsyms_cmds="" |
|
231 |
||
232 |
# Variables whose values should be saved in libtool wrapper scripts and
|
|
233 |
# restored at link time.
|
|
234 |
variables_saved_for_relink="PATH LD_LIBRARY_PATH LD_RUN_PATH GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" |
|
235 |
||
236 |
# Do we need the "lib" prefix for modules?
|
|
237 |
need_lib_prefix=no |
|
238 |
||
239 |
# Do we need a version for libraries?
|
|
240 |
need_version=no |
|
241 |
||
242 |
# Library versioning type.
|
|
243 |
version_type=linux |
|
244 |
||
245 |
# Shared library runtime path variable.
|
|
246 |
runpath_var=LD_RUN_PATH |
|
247 |
||
248 |
# Shared library path variable.
|
|
249 |
shlibpath_var=LD_LIBRARY_PATH |
|
250 |
||
251 |
# Is shlibpath searched before the hard-coded library search path?
|
|
252 |
shlibpath_overrides_runpath=yes |
|
253 |
||
254 |
# Format of library name prefix.
|
|
255 |
libname_spec="lib\$name" |
|
256 |
||
257 |
# List of archive names. First name is the real one, the rest are links.
|
|
258 |
# The last name is the one that the linker finds with -lNAME
|
|
259 |
library_names_spec="\$libname\$release\$shared_ext\$versuffix \$libname\$release\$shared_ext\$major \$libname\$shared_ext" |
|
260 |
||
261 |
# The coded name of the library, if different from the real name.
|
|
262 |
soname_spec="\$libname\$release\$shared_ext\$major" |
|
263 |
||
264 |
# Permission mode override for installation of shared libraries.
|
|
265 |
install_override_mode="" |
|
266 |
||
267 |
# Command to use after installation of a shared archive.
|
|
268 |
postinstall_cmds="" |
|
269 |
||
270 |
# Command to use after uninstallation of a shared archive.
|
|
271 |
postuninstall_cmds="" |
|
272 |
||
273 |
# Commands used to finish a libtool library installation in a directory.
|
|
274 |
finish_cmds="PATH=\\\"\\\$PATH:/sbin\\\" ldconfig -n \$libdir" |
|
275 |
||
276 |
# As "finish_cmds", except a single script fragment to be evaled but
|
|
277 |
# not shown.
|
|
278 |
finish_eval="" |
|
279 |
||
280 |
# Whether we should hardcode library paths into libraries.
|
|
281 |
hardcode_into_libs=yes |
|
282 |
||
283 |
# Compile-time system search path for libraries.
|
|
284 |
sys_lib_search_path_spec="/usr/lib/gcc/x86_64-linux-gnu/9 /usr/lib/x86_64-linux-gnu /usr/lib /lib/x86_64-linux-gnu /lib " |
|
285 |
||
286 |
# Detected run-time system search path for libraries.
|
|
287 |
sys_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 " |
|
288 |
||
289 |
# Explicit LT_SYS_LIBRARY_PATH set during ./configure time.
|
|
290 |
configure_time_lt_sys_library_path="" |
|
291 |
||
292 |
# Whether dlopen is supported.
|
|
293 |
dlopen_support=unknown |
|
294 |
||
295 |
# Whether dlopen of programs is supported.
|
|
296 |
dlopen_self=unknown |
|
297 |
||
298 |
# Whether dlopen of statically linked programs is supported.
|
|
299 |
dlopen_self_static=unknown |
|
300 |
||
301 |
# Commands to strip libraries.
|
|
302 |
old_striplib="strip --strip-debug" |
|
303 |
striplib="strip --strip-unneeded" |
|
304 |
||
305 |
||
306 |
# The linker used to build libraries.
|
|
307 |
LD="/usr/bin/ld -m elf_x86_64" |
|
308 |
||
309 |
# How to create reloadable object files.
|
|
310 |
reload_flag=" -r" |
|
311 |
reload_cmds="\$LD\$reload_flag -o \$output\$reload_objs" |
|
312 |
||
313 |
# Commands used to build an old-style archive.
|
|
314 |
old_archive_cmds="\$AR \$AR_FLAGS \$oldlib\$oldobjs~\$RANLIB \$tool_oldlib" |
|
315 |
||
316 |
# A language specific compiler.
|
|
317 |
CC="gcc" |
|
318 |
||
319 |
# Is the compiler the GNU compiler?
|
|
320 |
with_gcc=yes |
|
321 |
||
322 |
# Compiler flag to turn off builtin functions.
|
|
323 |
no_builtin_flag=" -fno-builtin" |
|
324 |
||
325 |
# Additional compiler flags for building library objects.
|
|
326 |
pic_flag=" -fPIC -DPIC" |
|
327 |
||
328 |
# How to pass a linker flag through the compiler.
|
|
329 |
wl="-Wl," |
|
330 |
||
331 |
# Compiler flag to prevent dynamic linking.
|
|
332 |
link_static_flag="-static" |
|
333 |
||
334 |
# Does compiler simultaneously support -c and -o options?
|
|
335 |
compiler_c_o="yes" |
|
336 |
||
337 |
# Whether or not to add -lc for building shared libraries.
|
|
338 |
build_libtool_need_lc=no |
|
339 |
||
340 |
# Whether or not to disallow shared libs when runtime libs are static.
|
|
341 |
allow_libtool_libs_with_static_runtimes=no |
|
342 |
||
343 |
# Compiler flag to allow reflexive dlopens.
|
|
344 |
export_dynamic_flag_spec="\$wl--export-dynamic" |
|
345 |
||
346 |
# Compiler flag to generate shared objects directly from archives.
|
|
347 |
whole_archive_flag_spec="\$wl--whole-archive\$convenience \$wl--no-whole-archive" |
|
348 |
||
349 |
# Whether the compiler copes with passing no objects directly.
|
|
350 |
compiler_needs_object="no" |
|
351 |
||
352 |
# Create an old-style archive from a shared archive.
|
|
353 |
old_archive_from_new_cmds="" |
|
354 |
||
355 |
# Create a temporary old-style archive to link instead of a shared archive.
|
|
356 |
old_archive_from_expsyms_cmds="" |
|
357 |
||
358 |
# Commands used to build a shared archive.
|
|
359 |
archive_cmds="\$CC -shared \$pic_flag \$libobjs \$deplibs \$compiler_flags \$wl-soname \$wl\$soname -o \$lib" |
|
360 |
archive_expsym_cmds="echo \\\"{ global:\\\" > \$output_objdir/\$libname.ver~ |
|
361 |
cat \$export_symbols | sed -e \\\"s/\\\\(.*\\\\)/\\\\1;/\\\" >> \$output_objdir/\$libname.ver~
|
|
362 |
echo \\\"local: *; };\\\" >> \$output_objdir/\$libname.ver~
|
|
363 |
\$CC -shared \$pic_flag \$libobjs \$deplibs \$compiler_flags \$wl-soname \$wl\$soname \$wl-version-script \$wl\$output_objdir/\$libname.ver -o \$lib"
|
|
364 |
||
365 |
# Commands used to build a loadable module if different from building
|
|
366 |
# a shared archive.
|
|
367 |
module_cmds="" |
|
368 |
module_expsym_cmds="" |
|
369 |
||
370 |
# Whether we are building with GNU ld or not.
|
|
371 |
with_gnu_ld="yes" |
|
372 |
||
373 |
# Flag that allows shared libraries with undefined symbols to be built.
|
|
374 |
allow_undefined_flag="" |
|
375 |
||
376 |
# Flag that enforces no undefined symbols.
|
|
377 |
no_undefined_flag="" |
|
378 |
||
379 |
# Flag to hardcode $libdir into a binary during linking.
|
|
380 |
# This must work even if $libdir does not exist
|
|
381 |
hardcode_libdir_flag_spec="\$wl-rpath \$wl\$libdir" |
|
382 |
||
383 |
# Whether we need a single "-rpath" flag with a separated argument.
|
|
384 |
hardcode_libdir_separator="" |
|
385 |
||
386 |
# Set to "yes" if using DIR/libNAME$shared_ext during linking hardcodes
|
|
387 |
# DIR into the resulting binary.
|
|
388 |
hardcode_direct=no |
|
389 |
||
390 |
# Set to "yes" if using DIR/libNAME$shared_ext during linking hardcodes
|
|
391 |
# DIR into the resulting binary and the resulting library dependency is
|
|
392 |
# "absolute",i.e impossible to change by setting $shlibpath_var if the
|
|
393 |
# library is relocated.
|
|
394 |
hardcode_direct_absolute=no |
|
395 |
||
396 |
# Set to "yes" if using the -LDIR flag during linking hardcodes DIR
|
|
397 |
# into the resulting binary.
|
|
398 |
hardcode_minus_L=no |
|
399 |
||
400 |
# Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR
|
|
401 |
# into the resulting binary.
|
|
402 |
hardcode_shlibpath_var=unsupported |
|
403 |
||
404 |
# Set to "yes" if building a shared library automatically hardcodes DIR
|
|
405 |
# into the library and all subsequent libraries and executables linked
|
|
406 |
# against it.
|
|
407 |
hardcode_automatic=no |
|
408 |
||
409 |
# Set to yes if linker adds runtime paths of dependent libraries
|
|
410 |
# to runtime path list.
|
|
411 |
inherit_rpath=no |
|
412 |
||
413 |
# Whether libtool must link a program against all its dependency libraries.
|
|
414 |
link_all_deplibs=no |
|
415 |
||
416 |
# Set to "yes" if exported symbols are required.
|
|
417 |
always_export_symbols=no |
|
418 |
||
419 |
# The commands to list exported symbols.
|
|
420 |
export_symbols_cmds="\$NM \$libobjs \$convenience | \$global_symbol_pipe | \$SED 's/.* //' | sort | uniq > \$export_symbols" |
|
421 |
||
422 |
# Symbols that should not be listed in the preloaded symbols.
|
|
423 |
exclude_expsyms="_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*" |
|
424 |
||
425 |
# Symbols that must always be exported.
|
|
426 |
include_expsyms="" |
|
427 |
||
428 |
# Commands necessary for linking programs (against libraries) with templates.
|
|
429 |
prelink_cmds="" |
|
430 |
||
431 |
# Commands necessary for finishing linking programs.
|
|
432 |
postlink_cmds="" |
|
433 |
||
434 |
# Specify filename containing input files.
|
|
435 |
file_list_spec="" |
|
436 |
||
437 |
# How to hardcode a shared library path into an executable.
|
|
438 |
hardcode_action=immediate |
|
439 |
||
440 |
# The directories searched by this compiler when creating a shared library.
|
|
441 |
compiler_lib_search_dirs="" |
|
442 |
||
443 |
# Dependencies to place before and after the objects being linked to
|
|
444 |
# create a shared library.
|
|
445 |
predep_objects="" |
|
446 |
postdep_objects="" |
|
447 |
predeps="" |
|
448 |
postdeps="" |
|
449 |
||
450 |
# The library search path used internally by the compiler when linking
|
|
451 |
# a shared library.
|
|
452 |
compiler_lib_search_path="" |
|
453 |
||
454 |
# ### END LIBTOOL CONFIG
|
|
455 |
||
456 |
||
457 |
# ### BEGIN FUNCTIONS SHARED WITH CONFIGURE
|
|
458 |
||
459 |
# func_munge_path_list VARIABLE PATH
|
|
460 |
# -----------------------------------
|
|
461 |
# VARIABLE is name of variable containing _space_ separated list of
|
|
462 |
# directories to be munged by the contents of PATH, which is string
|
|
463 |
# having a format:
|
|
464 |
# "DIR[:DIR]:"
|
|
465 |
# string "DIR[ DIR]" will be prepended to VARIABLE
|
|
466 |
# ":DIR[:DIR]"
|
|
467 |
# string "DIR[ DIR]" will be appended to VARIABLE
|
|
468 |
# "DIRP[:DIRP]::[DIRA:]DIRA"
|
|
469 |
# string "DIRP[ DIRP]" will be prepended to VARIABLE and string
|
|
470 |
# "DIRA[ DIRA]" will be appended to VARIABLE
|
|
471 |
# "DIR[:DIR]"
|
|
472 |
# VARIABLE will be replaced by "DIR[ DIR]"
|
|
473 |
func_munge_path_list ()
|
|
474 |
{
|
|
475 |
case x$2 in |
|
476 |
x)
|
|
477 |
;;
|
|
478 |
*:)
|
|
479 |
eval $1=\"`$ECHO $2 | $SED 's/:/ /g'` \$$1\" |
|
480 |
;;
|
|
481 |
x:*)
|
|
482 |
eval $1=\"\$$1 `$ECHO $2 | $SED 's/:/ /g'`\" |
|
483 |
;;
|
|
484 |
*::*)
|
|
485 |
eval $1=\"\$$1\ `$ECHO $2 | $SED -e 's/.*:://' -e 's/:/ /g'`\" |
|
486 |
eval $1=\"`$ECHO $2 | $SED -e 's/::.*//' -e 's/:/ /g'`\ \$$1\" |
|
487 |
;;
|
|
488 |
*)
|
|
489 |
eval $1=\"`$ECHO $2 | $SED 's/:/ /g'`\" |
|
490 |
;;
|
|
491 |
esac
|
|
492 |
}
|
|
493 |
||
494 |
||
495 |
# Calculate cc_basename. Skip known compiler wrappers and cross-prefix.
|
|
496 |
func_cc_basename ()
|
|
497 |
{
|
|
498 |
for cc_temp in $*""; do |
|
499 |
case $cc_temp in |
|
500 |
compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; |
|
501 |
distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; |
|
502 |
\-*) ;; |
|
503 |
*) break;; |
|
504 |
esac
|
|
505 |
done
|
|
506 |
func_cc_basename_result=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"` |
|
507 |
}
|
|
508 |
||
509 |
||
510 |
# ### END FUNCTIONS SHARED WITH CONFIGURE
|
|
511 |
||
512 |
#! /bin/sh
|
|
513 |
## DO NOT EDIT - This file generated from ./build-aux/ltmain.in
|
|
514 |
## by inline-source v2014-01-03.01
|
|
515 |
||
516 |
# libtool (GNU libtool) 2.4.6
|
|
517 |
# Provide generalized library-building support services.
|
|
518 |
# Written by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
|
|
519 |
||
520 |
# Copyright (C) 1996-2015 Free Software Foundation, Inc.
|
|
521 |
# This is free software; see the source for copying conditions. There is NO
|
|
522 |
# warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
523 |
||
524 |
# GNU Libtool is free software; you can redistribute it and/or modify
|
|
525 |
# it under the terms of the GNU General Public License as published by
|
|
526 |
# the Free Software Foundation; either version 2 of the License, or
|
|
527 |
# (at your option) any later version.
|
|
528 |
#
|
|
529 |
# As a special exception to the GNU General Public License,
|
|
530 |
# if you distribute this file as part of a program or library that
|
|
531 |
# is built using GNU Libtool, you may include this file under the
|
|
532 |
# same distribution terms that you use for the rest of that program.
|
|
533 |
#
|
|
534 |
# GNU Libtool is distributed in the hope that it will be useful, but
|
|
535 |
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
536 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
537 |
# General Public License for more details.
|
|
538 |
#
|
|
539 |
# You should have received a copy of the GNU General Public License
|
|
540 |
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
541 |
||
542 |
||
543 |
PROGRAM=libtool |
|
544 |
PACKAGE=libtool |
|
545 |
VERSION="2.4.6 Debian-2.4.6-14" |
|
546 |
package_revision=2.4.6 |
|
547 |
||
548 |
||
549 |
## ------ ##
|
|
550 |
## Usage. ##
|
|
551 |
## ------ ##
|
|
552 |
||
553 |
# Run './libtool --help' for help with using this script from the
|
|
554 |
# command line.
|
|
555 |
||
556 |
||
557 |
## ------------------------------- ##
|
|
558 |
## User overridable command paths. ##
|
|
559 |
## ------------------------------- ##
|
|
560 |
||
561 |
# After configure completes, it has a better idea of some of the
|
|
562 |
# shell tools we need than the defaults used by the functions shared
|
|
563 |
# with bootstrap, so set those here where they can still be over-
|
|
564 |
# ridden by the user, but otherwise take precedence.
|
|
565 |
||
566 |
: ${AUTOCONF="autoconf"} |
|
567 |
: ${AUTOMAKE="automake"} |
|
568 |
||
569 |
||
570 |
## -------------------------- ##
|
|
571 |
## Source external libraries. ##
|
|
572 |
## -------------------------- ##
|
|
573 |
||
574 |
# Much of our low-level functionality needs to be sourced from external
|
|
575 |
# libraries, which are installed to $pkgauxdir.
|
|
576 |
||
577 |
# Set a version string for this script.
|
|
578 |
scriptversion=2015-01-20.17; # UTC |
|
579 |
||
580 |
# General shell script boiler plate, and helper functions.
|
|
581 |
# Written by Gary V. Vaughan, 2004
|
|
582 |
||
583 |
# Copyright (C) 2004-2015 Free Software Foundation, Inc.
|
|
584 |
# This is free software; see the source for copying conditions. There is NO
|
|
585 |
# warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
586 |
||
587 |
# This program is free software; you can redistribute it and/or modify
|
|
588 |
# it under the terms of the GNU General Public License as published by
|
|
589 |
# the Free Software Foundation; either version 3 of the License, or
|
|
590 |
# (at your option) any later version.
|
|
591 |
||
592 |
# As a special exception to the GNU General Public License, if you distribute
|
|
593 |
# this file as part of a program or library that is built using GNU Libtool,
|
|
594 |
# you may include this file under the same distribution terms that you use
|
|
595 |
# for the rest of that program.
|
|
596 |
||
597 |
# This program is distributed in the hope that it will be useful,
|
|
598 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
599 |
# MERCHANTABILITY or FITNES FOR A PARTICULAR PURPOSE. See the GNU
|
|
600 |
# General Public License for more details.
|
|
601 |
||
602 |
# You should have received a copy of the GNU General Public License
|
|
603 |
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
604 |
||
605 |
# Please report bugs or propose patches to gary@gnu.org.
|
|
606 |
||
607 |
||
608 |
## ------ ##
|
|
609 |
## Usage. ##
|
|
610 |
## ------ ##
|
|
611 |
||
612 |
# Evaluate this file near the top of your script to gain access to
|
|
613 |
# the functions and variables defined here:
|
|
614 |
#
|
|
615 |
# . `echo "$0" | ${SED-sed} 's|[^/]*$||'`/build-aux/funclib.sh
|
|
616 |
#
|
|
617 |
# If you need to override any of the default environment variable
|
|
618 |
# settings, do that before evaluating this file.
|
|
619 |
||
620 |
||
621 |
## -------------------- ##
|
|
622 |
## Shell normalisation. ##
|
|
623 |
## -------------------- ##
|
|
624 |
||
625 |
# Some shells need a little help to be as Bourne compatible as possible.
|
|
626 |
# Before doing anything else, make sure all that help has been provided!
|
|
627 |
||
628 |
DUALCASE=1; export DUALCASE # for MKS sh |
|
629 |
if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : |
|
630 |
emulate sh |
|
631 |
NULLCMD=: |
|
632 |
# Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which
|
|
633 |
# is contrary to our usage. Disable this feature.
|
|
634 |
alias -g '${1+"$@"}'='"$@"' |
|
635 |
setopt NO_GLOB_SUBST |
|
636 |
else
|
|
637 |
case `(set -o) 2>/dev/null` in *posix*) set -o posix ;; esac |
|
638 |
fi
|
|
639 |
||
640 |
# NLS nuisances: We save the old values in case they are required later.
|
|
641 |
_G_user_locale= |
|
642 |
_G_safe_locale= |
|
643 |
for _G_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
|
|
644 |
do
|
|
645 |
eval "if test set = \"\${$_G_var+set}\"; then |
|
646 |
save_$_G_var=\$$_G_var |
|
647 |
$_G_var=C |
|
648 |
export $_G_var |
|
649 |
_G_user_locale=\"$_G_var=\\\$save_\$_G_var; \$_G_user_locale\" |
|
650 |
_G_safe_locale=\"$_G_var=C; \$_G_safe_locale\" |
|
651 |
fi"
|
|
652 |
done
|
|
653 |
||
654 |
# CDPATH.
|
|
655 |
(unset CDPATH) >/dev/null 2>&1 && unset CDPATH |
|
656 |
||
657 |
# Make sure IFS has a sensible default
|
|
658 |
sp=' ' |
|
659 |
nl=' |
|
660 |
'
|
|
661 |
IFS="$sp $nl" |
|
662 |
||
663 |
# There are apparently some retarded systems that use ';' as a PATH separator!
|
|
664 |
if test "${PATH_SEPARATOR+set}" != set; then |
|
665 |
PATH_SEPARATOR=: |
|
666 |
(PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { |
|
667 |
(PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || |
|
668 |
PATH_SEPARATOR=';' |
|
669 |
}
|
|
670 |
fi
|
|
671 |
||
672 |
||
673 |
||
674 |
## ------------------------- ##
|
|
675 |
## Locate command utilities. ##
|
|
676 |
## ------------------------- ##
|
|
677 |
||
678 |
||
679 |
# func_executable_p FILE
|
|
680 |
# ----------------------
|
|
681 |
# Check that FILE is an executable regular file.
|
|
682 |
func_executable_p ()
|
|
683 |
{
|
|
684 |
test -f "$1" && test -x "$1" |
|
685 |
}
|
|
686 |
||
687 |
||
688 |
# func_path_progs PROGS_LIST CHECK_FUNC [PATH]
|
|
689 |
# --------------------------------------------
|
|
690 |
# Search for either a program that responds to --version with output
|
|
691 |
# containing "GNU", or else returned by CHECK_FUNC otherwise, by
|
|
692 |
# trying all the directories in PATH with each of the elements of
|
|
693 |
# PROGS_LIST.
|
|
694 |
#
|
|
695 |
# CHECK_FUNC should accept the path to a candidate program, and
|
|
696 |
# set $func_check_prog_result if it truncates its output less than
|
|
697 |
# $_G_path_prog_max characters.
|
|
698 |
func_path_progs ()
|
|
699 |
{
|
|
700 |
_G_progs_list=$1 |
|
701 |
_G_check_func=$2 |
|
702 |
_G_PATH=${3-"$PATH"} |
|
703 |
||
704 |
_G_path_prog_max=0 |
|
705 |
_G_path_prog_found=false |
|
706 |
_G_save_IFS=$IFS; IFS=${PATH_SEPARATOR-:} |
|
707 |
for _G_dir in $_G_PATH; do |
|
708 |
IFS=$_G_save_IFS |
|
709 |
test -z "$_G_dir" && _G_dir=. |
|
710 |
for _G_prog_name in $_G_progs_list; do |
|
711 |
for _exeext in '' .EXE; do |
|
712 |
_G_path_prog=$_G_dir/$_G_prog_name$_exeext |
|
713 |
func_executable_p "$_G_path_prog" || continue |
|
714 |
case `"$_G_path_prog" --version 2>&1` in |
|
715 |
*GNU*) func_path_progs_result=$_G_path_prog _G_path_prog_found=: ;; |
|
716 |
*) $_G_check_func $_G_path_prog |
|
717 |
func_path_progs_result=$func_check_prog_result |
|
718 |
;;
|
|
719 |
esac
|
|
720 |
$_G_path_prog_found && break 3 |
|
721 |
done
|
|
722 |
done
|
|
723 |
done
|
|
724 |
IFS=$_G_save_IFS |
|
725 |
test -z "$func_path_progs_result" && { |
|
726 |
echo "no acceptable sed could be found in \$PATH" >&2 |
|
727 |
exit 1 |
|
728 |
}
|
|
729 |
}
|
|
730 |
||
731 |
||
732 |
# We want to be able to use the functions in this file before configure
|
|
733 |
# has figured out where the best binaries are kept, which means we have
|
|
734 |
# to search for them ourselves - except when the results are already set
|
|
735 |
# where we skip the searches.
|
|
736 |
||
737 |
# Unless the user overrides by setting SED, search the path for either GNU
|
|
738 |
# sed, or the sed that truncates its output the least.
|
|
739 |
test -z "$SED" && { |
|
740 |
_G_sed_script=s/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb/ |
|
741 |
for _G_i in 1 2 3 4 5 6 7; do |
|
742 |
_G_sed_script=$_G_sed_script$nl$_G_sed_script |
|
743 |
done
|
|
744 |
echo "$_G_sed_script" 2>/dev/null | sed 99q >conftest.sed |
|
745 |
_G_sed_script= |
|
746 |
||
747 |
func_check_prog_sed ()
|
|
748 |
{
|
|
749 |
_G_path_prog=$1 |
|
750 |
||
751 |
_G_count=0 |
|
752 |
printf 0123456789 >conftest.in |
|
753 |
while :
|
|
754 |
do
|
|
755 |
cat conftest.in conftest.in >conftest.tmp |
|
756 |
mv conftest.tmp conftest.in |
|
757 |
cp conftest.in conftest.nl |
|
758 |
echo '' >> conftest.nl |
|
759 |
"$_G_path_prog" -f conftest.sed <conftest.nl >conftest.out 2>/dev/null || break |
|
760 |
diff conftest.out conftest.nl >/dev/null 2>&1 || break |
|
761 |
_G_count=`expr $_G_count + 1` |
|
762 |
if test "$_G_count" -gt "$_G_path_prog_max"; then |
|
763 |
# Best one so far, save it but keep looking for a better one
|
|
764 |
func_check_prog_result=$_G_path_prog |
|
765 |
_G_path_prog_max=$_G_count |
|
766 |
fi
|
|
767 |
# 10*(2^10) chars as input seems more than enough
|
|
768 |
test 10 -lt "$_G_count" && break |
|
769 |
done
|
|
770 |
rm -f conftest.in conftest.tmp conftest.nl conftest.out |
|
771 |
}
|
|
772 |
||
773 |
func_path_progs "sed gsed" func_check_prog_sed $PATH:/usr/xpg4/bin |
|
774 |
rm -f conftest.sed |
|
775 |
SED=$func_path_progs_result |
|
776 |
}
|
|
777 |
||
778 |
||
779 |
# Unless the user overrides by setting GREP, search the path for either GNU
|
|
780 |
# grep, or the grep that truncates its output the least.
|
|
781 |
test -z "$GREP" && { |
|
782 |
func_check_prog_grep ()
|
|
783 |
{
|
|
784 |
_G_path_prog=$1 |
|
785 |
||
786 |
_G_count=0 |
|
787 |
_G_path_prog_max=0 |
|
788 |
printf 0123456789 >conftest.in |
|
789 |
while :
|
|
790 |
do
|
|
791 |
cat conftest.in conftest.in >conftest.tmp |
|
792 |
mv conftest.tmp conftest.in |
|
793 |
cp conftest.in conftest.nl |
|
794 |
echo 'GREP' >> conftest.nl |
|
795 |
"$_G_path_prog" -e 'GREP$' -e '-(cannot match)-' <conftest.nl >conftest.out 2>/dev/null || break |
|
796 |
diff conftest.out conftest.nl >/dev/null 2>&1 || break |
|
797 |
_G_count=`expr $_G_count + 1` |
|
798 |
if test "$_G_count" -gt "$_G_path_prog_max"; then |
|
799 |
# Best one so far, save it but keep looking for a better one
|
|
800 |
func_check_prog_result=$_G_path_prog |
|
801 |
_G_path_prog_max=$_G_count |
|
802 |
fi
|
|
803 |
# 10*(2^10) chars as input seems more than enough
|
|
804 |
test 10 -lt "$_G_count" && break |
|
805 |
done
|
|
806 |
rm -f conftest.in conftest.tmp conftest.nl conftest.out |
|
807 |
}
|
|
808 |
||
809 |
func_path_progs "grep ggrep" func_check_prog_grep $PATH:/usr/xpg4/bin |
|
810 |
GREP=$func_path_progs_result |
|
811 |
}
|
|
812 |
||
813 |
||
814 |
## ------------------------------- ##
|
|
815 |
## User overridable command paths. ##
|
|
816 |
## ------------------------------- ##
|
|
817 |
||
818 |
# All uppercase variable names are used for environment variables. These
|
|
819 |
# variables can be overridden by the user before calling a script that
|
|
820 |
# uses them if a suitable command of that name is not already available
|
|
821 |
# in the command search PATH.
|
|
822 |
||
823 |
: ${CP="cp -f"} |
|
824 |
: ${ECHO="printf %s\n"} |
|
825 |
: ${EGREP="$GREP -E"} |
|
826 |
: ${FGREP="$GREP -F"} |
|
827 |
: ${LN_S="ln -s"} |
|
828 |
: ${MAKE="make"} |
|
829 |
: ${MKDIR="mkdir"} |
|
830 |
: ${MV="mv -f"} |
|
831 |
: ${RM="rm -f"} |
|
832 |
: ${SHELL="${CONFIG_SHELL-/bin/sh}"} |
|
833 |
||
834 |
||
835 |
## -------------------- ##
|
|
836 |
## Useful sed snippets. ##
|
|
837 |
## -------------------- ##
|
|
838 |
||
839 |
sed_dirname='s|/[^/]*$||' |
|
840 |
sed_basename='s|^.*/||' |
|
841 |
||
842 |
# Sed substitution that helps us do robust quoting. It backslashifies
|
|
843 |
# metacharacters that are still active within double-quoted strings.
|
|
844 |
sed_quote_subst='s|\([`"$\\]\)|\\\1|g' |
|
845 |
||
846 |
# Same as above, but do not quote variable references.
|
|
847 |
sed_double_quote_subst='s/\(["`\\]\)/\\\1/g' |
|
848 |
||
849 |
# Sed substitution that turns a string into a regex matching for the
|
|
850 |
# string literally.
|
|
851 |
sed_make_literal_regex='s|[].[^$\\*\/]|\\&|g' |
|
852 |
||
853 |
# Sed substitution that converts a w32 file name or path
|
|
854 |
# that contains forward slashes, into one that contains
|
|
855 |
# (escaped) backslashes. A very naive implementation.
|
|
856 |
sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g' |
|
857 |
||
858 |
# Re-'\' parameter expansions in output of sed_double_quote_subst that
|
|
859 |
# were '\'-ed in input to the same. If an odd number of '\' preceded a
|
|
860 |
# '$' in input to sed_double_quote_subst, that '$' was protected from
|
|
861 |
# expansion. Since each input '\' is now two '\'s, look for any number
|
|
862 |
# of runs of four '\'s followed by two '\'s and then a '$'. '\' that '$'.
|
|
863 |
_G_bs='\\' |
|
864 |
_G_bs2='\\\\' |
|
865 |
_G_bs4='\\\\\\\\' |
|
866 |
_G_dollar='\$' |
|
867 |
sed_double_backslash="\ |
|
868 |
s/$_G_bs4/&\\ |
|
869 |
/g
|
|
870 |
s/^$_G_bs2$_G_dollar/$_G_bs&/ |
|
871 |
s/\\([^$_G_bs]\\)$_G_bs2$_G_dollar/\\1$_G_bs2$_G_bs$_G_dollar/g |
|
872 |
s/\n//g"
|
|
873 |
||
874 |
||
875 |
## ----------------- ##
|
|
876 |
## Global variables. ##
|
|
877 |
## ----------------- ##
|
|
878 |
||
879 |
# Except for the global variables explicitly listed below, the following
|
|
880 |
# functions in the '^func_' namespace, and the '^require_' namespace
|
|
881 |
# variables initialised in the 'Resource management' section, sourcing
|
|
882 |
# this file will not pollute your global namespace with anything
|
|
883 |
# else. There's no portable way to scope variables in Bourne shell
|
|
884 |
# though, so actually running these functions will sometimes place
|
|
885 |
# results into a variable named after the function, and often use
|
|
886 |
# temporary variables in the '^_G_' namespace. If you are careful to
|
|
887 |
# avoid using those namespaces casually in your sourcing script, things
|
|
888 |
# should continue to work as you expect. And, of course, you can freely
|
|
889 |
# overwrite any of the functions or variables defined here before
|
|
890 |
# calling anything to customize them.
|
|
891 |
||
892 |
EXIT_SUCCESS=0 |
|
893 |
EXIT_FAILURE=1 |
|
894 |
EXIT_MISMATCH=63 # $? = 63 is used to indicate version mismatch to missing. |
|
895 |
EXIT_SKIP=77 # $? = 77 is used to indicate a skipped test to automake. |
|
896 |
||
897 |
# Allow overriding, eg assuming that you follow the convention of
|
|
898 |
# putting '$debug_cmd' at the start of all your functions, you can get
|
|
899 |
# bash to show function call trace with:
|
|
900 |
#
|
|
901 |
# debug_cmd='echo "${FUNCNAME[0]} $*" >&2' bash your-script-name
|
|
902 |
debug_cmd=${debug_cmd-":"} |
|
903 |
exit_cmd=: |
|
904 |
||
905 |
# By convention, finish your script with:
|
|
906 |
#
|
|
907 |
# exit $exit_status
|
|
908 |
#
|
|
909 |
# so that you can set exit_status to non-zero if you want to indicate
|
|
910 |
# something went wrong during execution without actually bailing out at
|
|
911 |
# the point of failure.
|
|
912 |
exit_status=$EXIT_SUCCESS |
|
913 |
||
914 |
# Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh
|
|
915 |
# is ksh but when the shell is invoked as "sh" and the current value of
|
|
916 |
# the _XPG environment variable is not equal to 1 (one), the special
|
|
917 |
# positional parameter $0, within a function call, is the name of the
|
|
918 |
# function.
|
|
919 |
progpath=$0 |
|
920 |
||
921 |
# The name of this program.
|
|
922 |
progname=`$ECHO "$progpath" |$SED "$sed_basename"` |
|
923 |
||
924 |
# Make sure we have an absolute progpath for reexecution:
|
|
925 |
case $progpath in |
|
926 |
[\\/]*|[A-Za-z]:\\*) ;; |
|
927 |
*[\\/]*) |
|
928 |
progdir=`$ECHO "$progpath" |$SED "$sed_dirname"` |
|
929 |
progdir=`cd "$progdir" && pwd` |
|
930 |
progpath=$progdir/$progname |
|
931 |
;;
|
|
932 |
*)
|
|
933 |
_G_IFS=$IFS |
|
934 |
IFS=${PATH_SEPARATOR-:} |
|
935 |
for progdir in $PATH; do |
|
936 |
IFS=$_G_IFS |
|
937 |
test -x "$progdir/$progname" && break |
|
938 |
done
|
|
939 |
IFS=$_G_IFS |
|
940 |
test -n "$progdir" || progdir=`pwd` |
|
941 |
progpath=$progdir/$progname |
|
942 |
;;
|
|
943 |
esac
|
|
944 |
||
945 |
||
946 |
## ----------------- ##
|
|
947 |
## Standard options. ##
|
|
948 |
## ----------------- ##
|
|
949 |
||
950 |
# The following options affect the operation of the functions defined
|
|
951 |
# below, and should be set appropriately depending on run-time para-
|
|
952 |
# meters passed on the command line.
|
|
953 |
||
954 |
opt_dry_run=false |
|
955 |
opt_quiet=false |
|
956 |
opt_verbose=false |
|
957 |
||
958 |
# Categories 'all' and 'none' are always available. Append any others
|
|
959 |
# you will pass as the first argument to func_warning from your own
|
|
960 |
# code.
|
|
961 |
warning_categories= |
|
962 |
||
963 |
# By default, display warnings according to 'opt_warning_types'. Set
|
|
964 |
# 'warning_func' to ':' to elide all warnings, or func_fatal_error to
|
|
965 |
# treat the next displayed warning as a fatal error.
|
|
966 |
warning_func=func_warn_and_continue |
|
967 |
||
968 |
# Set to 'all' to display all warnings, 'none' to suppress all
|
|
969 |
# warnings, or a space delimited list of some subset of
|
|
970 |
# 'warning_categories' to display only the listed warnings.
|
|
971 |
opt_warning_types=all |
|
972 |
||
973 |
||
974 |
## -------------------- ##
|
|
975 |
## Resource management. ##
|
|
976 |
## -------------------- ##
|
|
977 |
||
978 |
# This section contains definitions for functions that each ensure a
|
|
979 |
# particular resource (a file, or a non-empty configuration variable for
|
|
980 |
# example) is available, and if appropriate to extract default values
|
|
981 |
# from pertinent package files. Call them using their associated
|
|
982 |
# 'require_*' variable to ensure that they are executed, at most, once.
|
|
983 |
#
|
|
984 |
# It's entirely deliberate that calling these functions can set
|
|
985 |
# variables that don't obey the namespace limitations obeyed by the rest
|
|
986 |
# of this file, in order that that they be as useful as possible to
|
|
987 |
# callers.
|
|
988 |
||
989 |
||
990 |
# require_term_colors
|
|
991 |
# -------------------
|
|
992 |
# Allow display of bold text on terminals that support it.
|
|
993 |
require_term_colors=func_require_term_colors |
|
994 |
func_require_term_colors ()
|
|
995 |
{
|
|
996 |
$debug_cmd
|
|
997 |
||
998 |
test -t 1 && { |
|
999 |
# COLORTERM and USE_ANSI_COLORS environment variables take
|
|
1000 |
# precedence, because most terminfo databases neglect to describe
|
|
1001 |
# whether color sequences are supported.
|
|
1002 |
test -n "${COLORTERM+set}" && : ${USE_ANSI_COLORS="1"} |
|
1003 |
||
1004 |
if test 1 = "$USE_ANSI_COLORS"; then |
|
1005 |
# Standard ANSI escape sequences
|
|
1006 |
tc_reset='[0m' |
|
1007 |
tc_bold='[1m'; tc_standout='[7m' |
|
1008 |
tc_red='[31m'; tc_green='[32m' |
|
1009 |
tc_blue='[34m'; tc_cyan='[36m' |
|
1010 |
else
|
|
1011 |
# Otherwise trust the terminfo database after all.
|
|
1012 |
test -n "`tput sgr0 2>/dev/null`" && { |
|
1013 |
tc_reset=`tput sgr0` |
|
1014 |
test -n "`tput bold 2>/dev/null`" && tc_bold=`tput bold` |
|
1015 |
tc_standout=$tc_bold |
|
1016 |
test -n "`tput smso 2>/dev/null`" && tc_standout=`tput smso` |
|
1017 |
test -n "`tput setaf 1 2>/dev/null`" && tc_red=`tput setaf 1` |
|
1018 |
test -n "`tput setaf 2 2>/dev/null`" && tc_green=`tput setaf 2` |
|
1019 |
test -n "`tput setaf 4 2>/dev/null`" && tc_blue=`tput setaf 4` |
|
1020 |
test -n "`tput setaf 5 2>/dev/null`" && tc_cyan=`tput setaf 5` |
|
1021 |
}
|
|
1022 |
fi
|
|
1023 |
}
|
|
1024 |
||
1025 |
require_term_colors=: |
|
1026 |
}
|
|
1027 |
||
1028 |
||
1029 |
## ----------------- ##
|
|
1030 |
## Function library. ##
|
|
1031 |
## ----------------- ##
|
|
1032 |
||
1033 |
# This section contains a variety of useful functions to call in your
|
|
1034 |
# scripts. Take note of the portable wrappers for features provided by
|
|
1035 |
# some modern shells, which will fall back to slower equivalents on
|
|
1036 |
# less featureful shells.
|
|
1037 |
||
1038 |
||
1039 |
# func_append VAR VALUE
|
|
1040 |
# ---------------------
|
|
1041 |
# Append VALUE onto the existing contents of VAR.
|
|
1042 |
||
1043 |
# We should try to minimise forks, especially on Windows where they are
|
|
1044 |
# unreasonably slow, so skip the feature probes when bash or zsh are
|
|
1045 |
# being used:
|
|
1046 |
if test set = "${BASH_VERSION+set}${ZSH_VERSION+set}"; then |
|
1047 |
: ${_G_HAVE_ARITH_OP="yes"} |
|
1048 |
: ${_G_HAVE_XSI_OPS="yes"} |
|
1049 |
# The += operator was introduced in bash 3.1
|
|
1050 |
case $BASH_VERSION in |
|
1051 |
[12].* | 3.0 | 3.0*) ;; |
|
1052 |
*)
|
|
1053 |
: ${_G_HAVE_PLUSEQ_OP="yes"} |
|
1054 |
;;
|
|
1055 |
esac
|
|
1056 |
fi
|
|
1057 |
||
1058 |
# _G_HAVE_PLUSEQ_OP
|
|
1059 |
# Can be empty, in which case the shell is probed, "yes" if += is
|
|
1060 |
# useable or anything else if it does not work.
|
|
1061 |
test -z "$_G_HAVE_PLUSEQ_OP" \ |
|
1062 |
&& (eval 'x=a; x+=" b"; test "a b" = "$x"') 2>/dev/null \ |
|
1063 |
&& _G_HAVE_PLUSEQ_OP=yes |
|
1064 |
||
1065 |
if test yes = "$_G_HAVE_PLUSEQ_OP" |
|
1066 |
then
|
|
1067 |
# This is an XSI compatible shell, allowing a faster implementation...
|
|
1068 |
eval 'func_append () |
|
1069 |
{
|
|
1070 |
$debug_cmd
|
|
1071 |
||
1072 |
eval "$1+=\$2"
|
|
1073 |
}'
|
|
1074 |
else
|
|
1075 |
# ...otherwise fall back to using expr, which is often a shell builtin.
|
|
1076 |
func_append ()
|
|
1077 |
{
|
|
1078 |
$debug_cmd
|
|
1079 |
||
1080 |
eval "$1=\$$1\$2" |
|
1081 |
}
|
|
1082 |
fi
|
|
1083 |
||
1084 |
||
1085 |
# func_append_quoted VAR VALUE
|
|
1086 |
# ----------------------------
|
|
1087 |
# Quote VALUE and append to the end of shell variable VAR, separated
|
|
1088 |
# by a space.
|
|
1089 |
if test yes = "$_G_HAVE_PLUSEQ_OP"; then |
|
1090 |
eval 'func_append_quoted () |
|
1091 |
{
|
|
1092 |
$debug_cmd
|
|
1093 |
||
1094 |
func_quote_for_eval "$2"
|
|
1095 |
eval "$1+=\\ \$func_quote_for_eval_result"
|
|
1096 |
}'
|
|
1097 |
else
|
|
1098 |
func_append_quoted ()
|
|
1099 |
{
|
|
1100 |
$debug_cmd
|
|
1101 |
||
1102 |
func_quote_for_eval "$2" |
|
1103 |
eval "$1=\$$1\\ \$func_quote_for_eval_result" |
|
1104 |
}
|
|
1105 |
fi
|
|
1106 |
||
1107 |
||
1108 |
# func_append_uniq VAR VALUE
|
|
1109 |
# --------------------------
|
|
1110 |
# Append unique VALUE onto the existing contents of VAR, assuming
|
|
1111 |
# entries are delimited by the first character of VALUE. For example:
|
|
1112 |
#
|
|
1113 |
# func_append_uniq options " --another-option option-argument"
|
|
1114 |
#
|
|
1115 |
# will only append to $options if " --another-option option-argument "
|
|
1116 |
# is not already present somewhere in $options already (note spaces at
|
|
1117 |
# each end implied by leading space in second argument).
|
|
1118 |
func_append_uniq ()
|
|
1119 |
{
|
|
1120 |
$debug_cmd
|
|
1121 |
||
1122 |
eval _G_current_value='`$ECHO $'$1'`' |
|
1123 |
_G_delim=`expr "$2" : '\(.\)'` |
|
1124 |
||
1125 |
case $_G_delim$_G_current_value$_G_delim in |
|
1126 |
*"$2$_G_delim"*) ;; |
|
1127 |
*) func_append "$@" ;; |
|
1128 |
esac
|
|
1129 |
}
|
|
1130 |
||
1131 |
||
1132 |
# func_arith TERM...
|
|
1133 |
# ------------------
|
|
1134 |
# Set func_arith_result to the result of evaluating TERMs.
|
|
1135 |
test -z "$_G_HAVE_ARITH_OP" \ |
|
1136 |
&& (eval 'test 2 = $(( 1 + 1 ))') 2>/dev/null \ |
|
1137 |
&& _G_HAVE_ARITH_OP=yes |
|
1138 |
||
1139 |
if test yes = "$_G_HAVE_ARITH_OP"; then |
|
1140 |
eval 'func_arith () |
|
1141 |
{
|
|
1142 |
$debug_cmd
|
|
1143 |
||
1144 |
func_arith_result=$(( $* ))
|
|
1145 |
}'
|
|
1146 |
else
|
|
1147 |
func_arith ()
|
|
1148 |
{
|
|
1149 |
$debug_cmd
|
|
1150 |
||
1151 |
func_arith_result=`expr "$@"` |
|
1152 |
}
|
|
1153 |
fi
|
|
1154 |
||
1155 |
||
1156 |
# func_basename FILE
|
|
1157 |
# ------------------
|
|
1158 |
# Set func_basename_result to FILE with everything up to and including
|
|
1159 |
# the last / stripped.
|
|
1160 |
if test yes = "$_G_HAVE_XSI_OPS"; then |
|
1161 |
# If this shell supports suffix pattern removal, then use it to avoid
|
|
1162 |
# forking. Hide the definitions single quotes in case the shell chokes
|
|
1163 |
# on unsupported syntax...
|
|
1164 |
_b='func_basename_result=${1##*/}' |
|
1165 |
_d='case $1 in |
|
1166 |
*/*) func_dirname_result=${1%/*}$2 ;;
|
|
1167 |
* ) func_dirname_result=$3 ;;
|
|
1168 |
esac'
|
|
1169 |
||
1170 |
else
|
|
1171 |
# ...otherwise fall back to using sed.
|
|
1172 |
_b='func_basename_result=`$ECHO "$1" |$SED "$sed_basename"`' |
|
1173 |
_d='func_dirname_result=`$ECHO "$1" |$SED "$sed_dirname"` |
|
1174 |
if test "X$func_dirname_result" = "X$1"; then
|
|
1175 |
func_dirname_result=$3
|
|
1176 |
else
|
|
1177 |
func_append func_dirname_result "$2"
|
|
1178 |
fi'
|
|
1179 |
fi
|
|
1180 |
||
1181 |
eval 'func_basename () |
|
1182 |
{
|
|
1183 |
$debug_cmd
|
|
1184 |
||
1185 |
'"$_b"' |
|
1186 |
}'
|
|
1187 |
||
1188 |
||
1189 |
# func_dirname FILE APPEND NONDIR_REPLACEMENT
|
|
1190 |
# -------------------------------------------
|
|
1191 |
# Compute the dirname of FILE. If nonempty, add APPEND to the result,
|
|
1192 |
# otherwise set result to NONDIR_REPLACEMENT.
|
|
1193 |
eval 'func_dirname () |
|
1194 |
{
|
|
1195 |
$debug_cmd
|
|
1196 |
||
1197 |
'"$_d"' |
|
1198 |
}'
|
|
1199 |
||
1200 |
||
1201 |
# func_dirname_and_basename FILE APPEND NONDIR_REPLACEMENT
|
|
1202 |
# --------------------------------------------------------
|
|
1203 |
# Perform func_basename and func_dirname in a single function
|
|
1204 |
# call:
|
|
1205 |
# dirname: Compute the dirname of FILE. If nonempty,
|
|
1206 |
# add APPEND to the result, otherwise set result
|
|
1207 |
# to NONDIR_REPLACEMENT.
|
|
1208 |
# value returned in "$func_dirname_result"
|
|
1209 |
# basename: Compute filename of FILE.
|
|
1210 |
# value retuned in "$func_basename_result"
|
|
1211 |
# For efficiency, we do not delegate to the functions above but instead
|
|
1212 |
# duplicate the functionality here.
|
|
1213 |
eval 'func_dirname_and_basename () |
|
1214 |
{
|
|
1215 |
$debug_cmd
|
|
1216 |
||
1217 |
'"$_b"' |
|
1218 |
'"$_d"' |
|
1219 |
}'
|
|
1220 |
||
1221 |
||
1222 |
# func_echo ARG...
|
|
1223 |
# ----------------
|
|
1224 |
# Echo program name prefixed message.
|
|
1225 |
func_echo ()
|
|
1226 |
{
|
|
1227 |
$debug_cmd
|
|
1228 |
||
1229 |
_G_message=$* |
|
1230 |
||
1231 |
func_echo_IFS=$IFS |
|
1232 |
IFS=$nl |
|
1233 |
for _G_line in $_G_message; do |
|
1234 |
IFS=$func_echo_IFS |
|
1235 |
$ECHO "$progname: $_G_line" |
|
1236 |
done
|
|
1237 |
IFS=$func_echo_IFS |
|
1238 |
}
|
|
1239 |
||
1240 |
||
1241 |
# func_echo_all ARG...
|
|
1242 |
# --------------------
|
|
1243 |
# Invoke $ECHO with all args, space-separated.
|
|
1244 |
func_echo_all ()
|
|
1245 |
{
|
|
1246 |
$ECHO "$*" |
|
1247 |
}
|
|
1248 |
||
1249 |
||
1250 |
# func_echo_infix_1 INFIX ARG...
|
|
1251 |
# ------------------------------
|
|
1252 |
# Echo program name, followed by INFIX on the first line, with any
|
|
1253 |
# additional lines not showing INFIX.
|
|
1254 |
func_echo_infix_1 ()
|
|
1255 |
{
|
|
1256 |
$debug_cmd
|
|
1257 |
||
1258 |
$require_term_colors
|
|
1259 |
||
1260 |
_G_infix=$1; shift |
|
1261 |
_G_indent=$_G_infix |
|
1262 |
_G_prefix="$progname: $_G_infix: " |
|
1263 |
_G_message=$* |
|
1264 |
||
1265 |
# Strip color escape sequences before counting printable length
|
|
1266 |
for _G_tc in "$tc_reset" "$tc_bold" "$tc_standout" "$tc_red" "$tc_green" "$tc_blue" "$tc_cyan" |
|
1267 |
do
|
|
1268 |
test -n "$_G_tc" && { |
|
1269 |
_G_esc_tc=`$ECHO "$_G_tc" | $SED "$sed_make_literal_regex"` |
|
1270 |
_G_indent=`$ECHO "$_G_indent" | $SED "s|$_G_esc_tc||g"` |
|
1271 |
}
|
|
1272 |
done
|
|
1273 |
_G_indent="$progname: "`echo "$_G_indent" | $SED 's|.| |g'`" " ## exclude from sc_prohibit_nested_quotes |
|
1274 |
||
1275 |
func_echo_infix_1_IFS=$IFS |
|
1276 |
IFS=$nl |
|
1277 |
for _G_line in $_G_message; do |
|
1278 |
IFS=$func_echo_infix_1_IFS |
|
1279 |
$ECHO "$_G_prefix$tc_bold$_G_line$tc_reset" >&2 |
|
1280 |
_G_prefix=$_G_indent |
|
1281 |
done
|
|
1282 |
IFS=$func_echo_infix_1_IFS |
|
1283 |
}
|
|
1284 |
||
1285 |
||
1286 |
# func_error ARG...
|
|
1287 |
# -----------------
|
|
1288 |
# Echo program name prefixed message to standard error.
|
|
1289 |
func_error ()
|
|
1290 |
{
|
|
1291 |
$debug_cmd
|
|
1292 |
||
1293 |
$require_term_colors
|
|
1294 |
||
1295 |
func_echo_infix_1 " $tc_standout${tc_red}error$tc_reset" "$*" >&2 |
|
1296 |
}
|
|
1297 |
||
1298 |
||
1299 |
# func_fatal_error ARG...
|
|
1300 |
# -----------------------
|
|
1301 |
# Echo program name prefixed message to standard error, and exit.
|
|
1302 |
func_fatal_error ()
|
|
1303 |
{
|
|
1304 |
$debug_cmd
|
|
1305 |
||
1306 |
func_error "$*" |
|
1307 |
exit $EXIT_FAILURE |
|
1308 |
}
|
|
1309 |
||
1310 |
||
1311 |
# func_grep EXPRESSION FILENAME
|
|
1312 |
# -----------------------------
|
|
1313 |
# Check whether EXPRESSION matches any line of FILENAME, without output.
|
|
1314 |
func_grep ()
|
|
1315 |
{
|
|
1316 |
$debug_cmd
|
|
1317 |
||
1318 |
$GREP "$1" "$2" >/dev/null 2>&1 |
|
1319 |
}
|
|
1320 |
||
1321 |
||
1322 |
# func_len STRING
|
|
1323 |
# ---------------
|
|
1324 |
# Set func_len_result to the length of STRING. STRING may not
|
|
1325 |
# start with a hyphen.
|
|
1326 |
test -z "$_G_HAVE_XSI_OPS" \ |
|
1327 |
&& (eval 'x=a/b/c; |
|
1328 |
test 5aa/bb/cc = "${#x}${x%%/*}${x%/*}${x#*/}${x##*/}"') 2>/dev/null \ |
|
1329 |
&& _G_HAVE_XSI_OPS=yes |
|
1330 |
||
1331 |
if test yes = "$_G_HAVE_XSI_OPS"; then |
|
1332 |
eval 'func_len () |
|
1333 |
{
|
|
1334 |
$debug_cmd
|
|
1335 |
||
1336 |
func_len_result=${#1}
|
|
1337 |
}'
|
|
1338 |
else
|
|
1339 |
func_len ()
|
|
1340 |
{
|
|
1341 |
$debug_cmd
|
|
1342 |
||
1343 |
func_len_result=`expr "$1" : ".*" 2>/dev/null || echo $max_cmd_len` |
|
1344 |
}
|
|
1345 |
fi
|
|
1346 |
||
1347 |
||
1348 |
# func_mkdir_p DIRECTORY-PATH
|
|
1349 |
# ---------------------------
|
|
1350 |
# Make sure the entire path to DIRECTORY-PATH is available.
|
|
1351 |
func_mkdir_p ()
|
|
1352 |
{
|
|
1353 |
$debug_cmd
|
|
1354 |
||
1355 |
_G_directory_path=$1 |
|
1356 |
_G_dir_list= |
|
1357 |
||
1358 |
if test -n "$_G_directory_path" && test : != "$opt_dry_run"; then |
|
1359 |
||
1360 |
# Protect directory names starting with '-'
|
|
1361 |
case $_G_directory_path in |
|
1362 |
-*) _G_directory_path=./$_G_directory_path ;; |
|
1363 |
esac
|
|
1364 |
||
1365 |
# While some portion of DIR does not yet exist...
|
|
1366 |
while test ! -d "$_G_directory_path"; do |
|
1367 |
# ...make a list in topmost first order. Use a colon delimited
|
|
1368 |
# list incase some portion of path contains whitespace.
|
|
1369 |
_G_dir_list=$_G_directory_path:$_G_dir_list |
|
1370 |
||
1371 |
# If the last portion added has no slash in it, the list is done
|
|
1372 |
case $_G_directory_path in */*) ;; *) break ;; esac |
|
1373 |
||
1374 |
# ...otherwise throw away the child directory and loop
|
|
1375 |
_G_directory_path=`$ECHO "$_G_directory_path" | $SED -e "$sed_dirname"` |
|
1376 |
done
|
|
1377 |
_G_dir_list=`$ECHO "$_G_dir_list" | $SED 's|:*$||'` |
|
1378 |
||
1379 |
func_mkdir_p_IFS=$IFS; IFS=: |
|
1380 |
for _G_dir in $_G_dir_list; do |
|
1381 |
IFS=$func_mkdir_p_IFS |
|
1382 |
# mkdir can fail with a 'File exist' error if two processes
|
|
1383 |
# try to create one of the directories concurrently. Don't
|
|
1384 |
# stop in that case!
|
|
1385 |
$MKDIR "$_G_dir" 2>/dev/null || : |
|
1386 |
done
|
|
1387 |
IFS=$func_mkdir_p_IFS |
|
1388 |
||
1389 |
# Bail out if we (or some other process) failed to create a directory.
|
|
1390 |
test -d "$_G_directory_path" || \ |
|
1391 |
func_fatal_error "Failed to create '$1'" |
|
1392 |
fi
|
|
1393 |
}
|
|
1394 |
||
1395 |
||
1396 |
# func_mktempdir [BASENAME]
|
|
1397 |
# -------------------------
|
|
1398 |
# Make a temporary directory that won't clash with other running
|
|
1399 |
# libtool processes, and avoids race conditions if possible. If
|
|
1400 |
# given, BASENAME is the basename for that directory.
|
|
1401 |
func_mktempdir ()
|
|
1402 |
{
|
|
1403 |
$debug_cmd
|
|
1404 |
||
1405 |
_G_template=${TMPDIR-/tmp}/${1-$progname} |
|
1406 |
||
1407 |
if test : = "$opt_dry_run"; then |
|
1408 |
# Return a directory name, but don't create it in dry-run mode
|
|
1409 |
_G_tmpdir=$_G_template-$$ |
|
1410 |
else
|
|
1411 |
||
1412 |
# If mktemp works, use that first and foremost
|
|
1413 |
_G_tmpdir=`mktemp -d "$_G_template-XXXXXXXX" 2>/dev/null` |
|
1414 |
||
1415 |
if test ! -d "$_G_tmpdir"; then |
|
1416 |
# Failing that, at least try and use $RANDOM to avoid a race
|
|
1417 |
_G_tmpdir=$_G_template-${RANDOM-0}$$ |
|
1418 |
||
1419 |
func_mktempdir_umask=`umask` |
|
1420 |
umask 0077 |
|
1421 |
$MKDIR "$_G_tmpdir" |
|
1422 |
umask $func_mktempdir_umask |
|
1423 |
fi
|
|
1424 |
||
1425 |
# If we're not in dry-run mode, bomb out on failure
|
|
1426 |
test -d "$_G_tmpdir" || \ |
|
1427 |
func_fatal_error "cannot create temporary directory '$_G_tmpdir'" |
|
1428 |
fi
|
|
1429 |
||
1430 |
$ECHO "$_G_tmpdir" |
|
1431 |
}
|
|
1432 |
||
1433 |
||
1434 |
# func_normal_abspath PATH
|
|
1435 |
# ------------------------
|
|
1436 |
# Remove doubled-up and trailing slashes, "." path components,
|
|
1437 |
# and cancel out any ".." path components in PATH after making
|
|
1438 |
# it an absolute path.
|
|
1439 |
func_normal_abspath ()
|
|
1440 |
{
|
|
1441 |
$debug_cmd
|
|
1442 |
||
1443 |
# These SED scripts presuppose an absolute path with a trailing slash.
|
|
1444 |
_G_pathcar='s|^/\([^/]*\).*$|\1|' |
|
1445 |
_G_pathcdr='s|^/[^/]*||' |
|
1446 |
_G_removedotparts=':dotsl |
|
1447 |
s|/\./|/|g
|
|
1448 |
t dotsl
|
|
1449 |
s|/\.$|/|'
|
|
1450 |
_G_collapseslashes='s|/\{1,\}|/|g' |
|
1451 |
_G_finalslash='s|/*$|/|' |
|
1452 |
||
1453 |
# Start from root dir and reassemble the path.
|
|
1454 |
func_normal_abspath_result= |
|
1455 |
func_normal_abspath_tpath=$1 |
|
1456 |
func_normal_abspath_altnamespace= |
|
1457 |
case $func_normal_abspath_tpath in |
|
1458 |
"") |
|
1459 |
# Empty path, that just means $cwd.
|
|
1460 |
func_stripname '' '/' "`pwd`" |
|
1461 |
func_normal_abspath_result=$func_stripname_result |
|
1462 |
return
|
|
1463 |
;;
|
|
1464 |
# The next three entries are used to spot a run of precisely
|
|
1465 |
# two leading slashes without using negated character classes;
|
|
1466 |
# we take advantage of case's first-match behaviour.
|
|
1467 |
///*)
|
|
1468 |
# Unusual form of absolute path, do nothing.
|
|
1469 |
;;
|
|
1470 |
//*)
|
|
1471 |
# Not necessarily an ordinary path; POSIX reserves leading '//'
|
|
1472 |
# and for example Cygwin uses it to access remote file shares
|
|
1473 |
# over CIFS/SMB, so we conserve a leading double slash if found.
|
|
1474 |
func_normal_abspath_altnamespace=/ |
|
1475 |
;;
|
|
1476 |
/*)
|
|
1477 |
# Absolute path, do nothing.
|
|
1478 |
;;
|
|
1479 |
*)
|
|
1480 |
# Relative path, prepend $cwd.
|
|
1481 |
func_normal_abspath_tpath=`pwd`/$func_normal_abspath_tpath |
|
1482 |
;;
|
|
1483 |
esac
|
|
1484 |
||
1485 |
# Cancel out all the simple stuff to save iterations. We also want
|
|
1486 |
# the path to end with a slash for ease of parsing, so make sure
|
|
1487 |
# there is one (and only one) here.
|
|
1488 |
func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \ |
|
1489 |
-e "$_G_removedotparts" -e "$_G_collapseslashes" -e "$_G_finalslash"` |
|
1490 |
while :; do |
|
1491 |
# Processed it all yet?
|
|
1492 |
if test / = "$func_normal_abspath_tpath"; then |
|
1493 |
# If we ascended to the root using ".." the result may be empty now.
|
|
1494 |
if test -z "$func_normal_abspath_result"; then |
|
1495 |
func_normal_abspath_result=/ |
|
1496 |
fi
|
|
1497 |
break
|
|
1498 |
fi
|
|
1499 |
func_normal_abspath_tcomponent=`$ECHO "$func_normal_abspath_tpath" | $SED \ |
|
1500 |
-e "$_G_pathcar"` |
|
1501 |
func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \ |
|
1502 |
-e "$_G_pathcdr"` |
|
1503 |
# Figure out what to do with it
|
|
1504 |
case $func_normal_abspath_tcomponent in |
|
1505 |
"") |
|
1506 |
# Trailing empty path component, ignore it.
|
|
1507 |
;;
|
|
1508 |
..)
|
|
1509 |
# Parent dir; strip last assembled component from result.
|
|
1510 |
func_dirname "$func_normal_abspath_result" |
|
1511 |
func_normal_abspath_result=$func_dirname_result |
|
1512 |
;;
|
|
1513 |
*)
|
|
1514 |
# Actual path component, append it.
|
|
1515 |
func_append func_normal_abspath_result "/$func_normal_abspath_tcomponent" |
|
1516 |
;;
|
|
1517 |
esac
|
|
1518 |
done
|
|
1519 |
# Restore leading double-slash if one was found on entry.
|
|
1520 |
func_normal_abspath_result=$func_normal_abspath_altnamespace$func_normal_abspath_result |
|
1521 |
}
|
|
1522 |
||
1523 |
||
1524 |
# func_notquiet ARG...
|
|
1525 |
# --------------------
|
|
1526 |
# Echo program name prefixed message only when not in quiet mode.
|
|
1527 |
func_notquiet ()
|
|
1528 |
{
|
|
1529 |
$debug_cmd
|
|
1530 |
||
1531 |
$opt_quiet || func_echo ${1+"$@"} |
|
1532 |
||
1533 |
# A bug in bash halts the script if the last line of a function
|
|
1534 |
# fails when set -e is in force, so we need another command to
|
|
1535 |
# work around that:
|
|
1536 |
: |
|
1537 |
}
|
|
1538 |
||
1539 |
||
1540 |
# func_relative_path SRCDIR DSTDIR
|
|
1541 |
# --------------------------------
|
|
1542 |
# Set func_relative_path_result to the relative path from SRCDIR to DSTDIR.
|
|
1543 |
func_relative_path ()
|
|
1544 |
{
|
|
1545 |
$debug_cmd
|
|
1546 |
||
1547 |
func_relative_path_result= |
|
1548 |
func_normal_abspath "$1" |
|
1549 |
func_relative_path_tlibdir=$func_normal_abspath_result |
|
1550 |
func_normal_abspath "$2" |
|
1551 |
func_relative_path_tbindir=$func_normal_abspath_result |
|
1552 |
||
1553 |
# Ascend the tree starting from libdir
|
|
1554 |
while :; do |
|
1555 |
# check if we have found a prefix of bindir
|
|
1556 |
case $func_relative_path_tbindir in |
|
1557 |
$func_relative_path_tlibdir) |
|
1558 |
# found an exact match
|
|
1559 |
func_relative_path_tcancelled= |
|
1560 |
break
|
|
1561 |
;;
|
|
1562 |
$func_relative_path_tlibdir*) |
|
1563 |
# found a matching prefix
|
|
1564 |
func_stripname "$func_relative_path_tlibdir" '' "$func_relative_path_tbindir" |
|
1565 |
func_relative_path_tcancelled=$func_stripname_result |
|
1566 |
if test -z "$func_relative_path_result"; then |
|
1567 |
func_relative_path_result=. |
|
1568 |
fi
|
|
1569 |
break
|
|
1570 |
;;
|
|
1571 |
*)
|
|
1572 |
func_dirname $func_relative_path_tlibdir
|
|
1573 |
func_relative_path_tlibdir=$func_dirname_result |
|
1574 |
if test -z "$func_relative_path_tlibdir"; then |
|
1575 |
# Have to descend all the way to the root!
|
|
1576 |
func_relative_path_result=../$func_relative_path_result |
|
1577 |
func_relative_path_tcancelled=$func_relative_path_tbindir |
|
1578 |
break
|
|
1579 |
fi
|
|
1580 |
func_relative_path_result=../$func_relative_path_result |
|
1581 |
;;
|
|
1582 |
esac
|
|
1583 |
done
|
|
1584 |
||
1585 |
# Now calculate path; take care to avoid doubling-up slashes.
|
|
1586 |
func_stripname '' '/' "$func_relative_path_result" |
|
1587 |
func_relative_path_result=$func_stripname_result |
|
1588 |
func_stripname '/' '/' "$func_relative_path_tcancelled" |
|
1589 |
if test -n "$func_stripname_result"; then |
|
1590 |
func_append func_relative_path_result "/$func_stripname_result" |
|
1591 |
fi
|
|
1592 |
||
1593 |
# Normalisation. If bindir is libdir, return '.' else relative path.
|
|
1594 |
if test -n "$func_relative_path_result"; then |
|
1595 |
func_stripname './' '' "$func_relative_path_result" |
|
1596 |
func_relative_path_result=$func_stripname_result |
|
1597 |
fi
|
|
1598 |
||
1599 |
test -n "$func_relative_path_result" || func_relative_path_result=. |
|
1600 |
||
1601 |
: |
|
1602 |
}
|
|
1603 |
||
1604 |
||
1605 |
# func_quote_for_eval ARG...
|
|
1606 |
# --------------------------
|
|
1607 |
# Aesthetically quote ARGs to be evaled later.
|
|
1608 |
# This function returns two values:
|
|
1609 |
# i) func_quote_for_eval_result
|
|
1610 |
# double-quoted, suitable for a subsequent eval
|
|
1611 |
# ii) func_quote_for_eval_unquoted_result
|
|
1612 |
# has all characters that are still active within double
|
|
1613 |
# quotes backslashified.
|
|
1614 |
func_quote_for_eval ()
|
|
1615 |
{
|
|
1616 |
$debug_cmd
|
|
1617 |
||
1618 |
func_quote_for_eval_unquoted_result= |
|
1619 |
func_quote_for_eval_result= |
|
1620 |
while test 0 -lt $#; do |
|
1621 |
case $1 in |
|
1622 |
*[\\\`\"\$]*) |
|
1623 |
_G_unquoted_arg=`printf '%s\n' "$1" |$SED "$sed_quote_subst"` ;; |
|
1624 |
*)
|
|
1625 |
_G_unquoted_arg=$1 ;; |
|
1626 |
esac
|
|
1627 |
if test -n "$func_quote_for_eval_unquoted_result"; then |
|
1628 |
func_append func_quote_for_eval_unquoted_result " $_G_unquoted_arg" |
|
1629 |
else
|
|
1630 |
func_append func_quote_for_eval_unquoted_result "$_G_unquoted_arg" |
|
1631 |
fi
|
|
1632 |
||
1633 |
case $_G_unquoted_arg in |
|
1634 |
# Double-quote args containing shell metacharacters to delay
|
|
1635 |
# word splitting, command substitution and variable expansion
|
|
1636 |
# for a subsequent eval.
|
|
1637 |
# Many Bourne shells cannot handle close brackets correctly
|
|
1638 |
# in scan sets, so we specify it separately.
|
|
1639 |
*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") |
|
1640 |
_G_quoted_arg=\"$_G_unquoted_arg\" |
|
1641 |
;;
|
|
1642 |
*)
|
|
1643 |
_G_quoted_arg=$_G_unquoted_arg |
|
1644 |
;;
|
|
1645 |
esac
|
|
1646 |
||
1647 |
if test -n "$func_quote_for_eval_result"; then |
|
1648 |
func_append func_quote_for_eval_result " $_G_quoted_arg" |
|
1649 |
else
|
|
1650 |
func_append func_quote_for_eval_result "$_G_quoted_arg" |
|
1651 |
fi
|
|
1652 |
shift
|
|
1653 |
done
|
|
1654 |
}
|
|
1655 |
||
1656 |
||
1657 |
# func_quote_for_expand ARG
|
|
1658 |
# -------------------------
|
|
1659 |
# Aesthetically quote ARG to be evaled later; same as above,
|
|
1660 |
# but do not quote variable references.
|
|
1661 |
func_quote_for_expand ()
|
|
1662 |
{
|
|
1663 |
$debug_cmd
|
|
1664 |
||
1665 |
case $1 in |
|
1666 |
*[\\\`\"]*) |
|
1667 |
_G_arg=`$ECHO "$1" | $SED \ |
|
1668 |
-e "$sed_double_quote_subst" -e "$sed_double_backslash"` ;; |
|
1669 |
*)
|
|
1670 |
_G_arg=$1 ;; |
|
1671 |
esac
|
|
1672 |
||
1673 |
case $_G_arg in |
|
1674 |
# Double-quote args containing shell metacharacters to delay
|
|
1675 |
# word splitting and command substitution for a subsequent eval.
|
|
1676 |
# Many Bourne shells cannot handle close brackets correctly
|
|
1677 |
# in scan sets, so we specify it separately.
|
|
1678 |
*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") |
|
1679 |
_G_arg=\"$_G_arg\" |
|
1680 |
;;
|
|
1681 |
esac
|
|
1682 |
||
1683 |
func_quote_for_expand_result=$_G_arg |
|
1684 |
}
|
|
1685 |
||
1686 |
||
1687 |
# func_stripname PREFIX SUFFIX NAME
|
|
1688 |
# ---------------------------------
|
|
1689 |
# strip PREFIX and SUFFIX from NAME, and store in func_stripname_result.
|
|
1690 |
# PREFIX and SUFFIX must not contain globbing or regex special
|
|
1691 |
# characters, hashes, percent signs, but SUFFIX may contain a leading
|
|
1692 |
# dot (in which case that matches only a dot).
|
|
1693 |
if test yes = "$_G_HAVE_XSI_OPS"; then |
|
1694 |
eval 'func_stripname () |
|
1695 |
{
|
|
1696 |
$debug_cmd
|
|
1697 |
||
1698 |
# pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are
|
|
1699 |
# positional parameters, so assign one to ordinary variable first.
|
|
1700 |
func_stripname_result=$3
|
|
1701 |
func_stripname_result=${func_stripname_result#"$1"}
|
|
1702 |
func_stripname_result=${func_stripname_result%"$2"}
|
|
1703 |
}'
|
|
1704 |
else
|
|
1705 |
func_stripname ()
|
|
1706 |
{
|
|
1707 |
$debug_cmd
|
|
1708 |
||
1709 |
case $2 in |
|
1710 |
.*) func_stripname_result=`$ECHO "$3" | $SED -e "s%^$1%%" -e "s%\\\\$2\$%%"`;; |
|
1711 |
*) func_stripname_result=`$ECHO "$3" | $SED -e "s%^$1%%" -e "s%$2\$%%"`;; |
|
1712 |
esac
|
|
1713 |
}
|
|
1714 |
fi
|
|
1715 |
||
1716 |
||
1717 |
# func_show_eval CMD [FAIL_EXP]
|
|
1718 |
# -----------------------------
|
|
1719 |
# Unless opt_quiet is true, then output CMD. Then, if opt_dryrun is
|
|
1720 |
# not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP
|
|
1721 |
# is given, then evaluate it.
|
|
1722 |
func_show_eval ()
|
|
1723 |
{
|
|
1724 |
$debug_cmd
|
|
1725 |
||
1726 |
_G_cmd=$1 |
|
1727 |
_G_fail_exp=${2-':'} |
|
1728 |
||
1729 |
func_quote_for_expand "$_G_cmd" |
|
1730 |
eval "func_notquiet $func_quote_for_expand_result" |
|
1731 |
||
1732 |
$opt_dry_run || { |
|
1733 |
eval "$_G_cmd" |
|
1734 |
_G_status=$? |
|
1735 |
if test 0 -ne "$_G_status"; then |
|
1736 |
eval "(exit $_G_status); $_G_fail_exp" |
|
1737 |
fi
|
|
1738 |
}
|
|
1739 |
}
|
|
1740 |
||
1741 |
||
1742 |
# func_show_eval_locale CMD [FAIL_EXP]
|
|
1743 |
# ------------------------------------
|
|
1744 |
# Unless opt_quiet is true, then output CMD. Then, if opt_dryrun is
|
|
1745 |
# not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP
|
|
1746 |
# is given, then evaluate it. Use the saved locale for evaluation.
|
|
1747 |
func_show_eval_locale ()
|
|
1748 |
{
|
|
1749 |
$debug_cmd
|
|
1750 |
||
1751 |
_G_cmd=$1 |
|
1752 |
_G_fail_exp=${2-':'} |
|
1753 |
||
1754 |
$opt_quiet || { |
|
1755 |
func_quote_for_expand "$_G_cmd" |
|
1756 |
eval "func_echo $func_quote_for_expand_result" |
|
1757 |
}
|
|
1758 |
||
1759 |
$opt_dry_run || { |
|
1760 |
eval "$_G_user_locale |
|
1761 |
$_G_cmd" |
|
1762 |
_G_status=$? |
|
1763 |
eval "$_G_safe_locale" |
|
1764 |
if test 0 -ne "$_G_status"; then |
|
1765 |
eval "(exit $_G_status); $_G_fail_exp" |
|
1766 |
fi
|
|
1767 |
}
|
|
1768 |
}
|
|
1769 |
||
1770 |
||
1771 |
# func_tr_sh
|
|
1772 |
# ----------
|
|
1773 |
# Turn $1 into a string suitable for a shell variable name.
|
|
1774 |
# Result is stored in $func_tr_sh_result. All characters
|
|
1775 |
# not in the set a-zA-Z0-9_ are replaced with '_'. Further,
|
|
1776 |
# if $1 begins with a digit, a '_' is prepended as well.
|
|
1777 |
func_tr_sh ()
|
|
1778 |
{
|
|
1779 |
$debug_cmd
|
|
1780 |
||
1781 |
case $1 in |
|
1782 |
[0-9]* | *[!a-zA-Z0-9_]*) |
|
1783 |
func_tr_sh_result=`$ECHO "$1" | $SED -e 's/^\([0-9]\)/_\1/' -e 's/[^a-zA-Z0-9_]/_/g'` |
|
1784 |
;;
|
|
1785 |
* )
|
|
1786 |
func_tr_sh_result=$1 |
|
1787 |
;;
|
|
1788 |
esac
|
|
1789 |
}
|
|
1790 |
||
1791 |
||
1792 |
# func_verbose ARG...
|
|
1793 |
# -------------------
|
|
1794 |
# Echo program name prefixed message in verbose mode only.
|
|
1795 |
func_verbose ()
|
|
1796 |
{
|
|
1797 |
$debug_cmd
|
|
1798 |
||
1799 |
$opt_verbose && func_echo "$*" |
|
1800 |
||
1801 |
: |
|
1802 |
}
|
|
1803 |
||
1804 |
||
1805 |
# func_warn_and_continue ARG...
|
|
1806 |
# -----------------------------
|
|
1807 |
# Echo program name prefixed warning message to standard error.
|
|
1808 |
func_warn_and_continue ()
|
|
1809 |
{
|
|
1810 |
$debug_cmd
|
|
1811 |
||
1812 |
$require_term_colors
|
|
1813 |
||
1814 |
func_echo_infix_1 "${tc_red}warning$tc_reset" "$*" >&2 |
|
1815 |
}
|
|
1816 |
||
1817 |
||
1818 |
# func_warning CATEGORY ARG...
|
|
1819 |
# ----------------------------
|
|
1820 |
# Echo program name prefixed warning message to standard error. Warning
|
|
1821 |
# messages can be filtered according to CATEGORY, where this function
|
|
1822 |
# elides messages where CATEGORY is not listed in the global variable
|
|
1823 |
# 'opt_warning_types'.
|
|
1824 |
func_warning ()
|
|
1825 |
{
|
|
1826 |
$debug_cmd
|
|
1827 |
||
1828 |
# CATEGORY must be in the warning_categories list!
|
|
1829 |
case " $warning_categories " in |
|
1830 |
*" $1 "*) ;; |
|
1831 |
*) func_internal_error "invalid warning category '$1'" ;; |
|
1832 |
esac
|
|
1833 |
||
1834 |
_G_category=$1 |
|
1835 |
shift
|
|
1836 |
||
1837 |
case " $opt_warning_types " in |
|
1838 |
*" $_G_category "*) $warning_func ${1+"$@"} ;; |
|
1839 |
esac
|
|
1840 |
}
|
|
1841 |
||
1842 |
||
1843 |
# func_sort_ver VER1 VER2
|
|
1844 |
# -----------------------
|
|
1845 |
# 'sort -V' is not generally available.
|
|
1846 |
# Note this deviates from the version comparison in automake
|
|
1847 |
# in that it treats 1.5 < 1.5.0, and treats 1.4.4a < 1.4-p3a
|
|
1848 |
# but this should suffice as we won't be specifying old
|
|
1849 |
# version formats or redundant trailing .0 in bootstrap.conf.
|
|
1850 |
# If we did want full compatibility then we should probably
|
|
1851 |
# use m4_version_compare from autoconf.
|
|
1852 |
func_sort_ver ()
|
|
1853 |
{
|
|
1854 |
$debug_cmd
|
|
1855 |
||
1856 |
printf '%s\n%s\n' "$1" "$2" \ |
|
1857 |
| sort -t. -k 1,1n -k 2,2n -k 3,3n -k 4,4n -k 5,5n -k 6,6n -k 7,7n -k 8,8n -k 9,9n |
|
1858 |
}
|
|
1859 |
||
1860 |
# func_lt_ver PREV CURR
|
|
1861 |
# ---------------------
|
|
1862 |
# Return true if PREV and CURR are in the correct order according to
|
|
1863 |
# func_sort_ver, otherwise false. Use it like this:
|
|
1864 |
#
|
|
1865 |
# func_lt_ver "$prev_ver" "$proposed_ver" || func_fatal_error "..."
|
|
1866 |
func_lt_ver ()
|
|
1867 |
{
|
|
1868 |
$debug_cmd
|
|
1869 |
||
1870 |
test "x$1" = x`func_sort_ver "$1" "$2" | $SED 1q` |
|
1871 |
}
|
|
1872 |
||
1873 |
||
1874 |
# Local variables:
|
|
1875 |
# mode: shell-script
|
|
1876 |
# sh-indentation: 2
|
|
1877 |
# eval: (add-hook 'before-save-hook 'time-stamp)
|
|
1878 |
# time-stamp-pattern: "10/scriptversion=%:y-%02m-%02d.%02H; # UTC"
|
|
1879 |
# time-stamp-time-zone: "UTC"
|
|
1880 |
# End:
|
|
1881 |
#! /bin/sh
|
|
1882 |
||
1883 |
# Set a version string for this script.
|
|
1884 |
scriptversion=2015-10-07.11; # UTC |
|
1885 |
||
1886 |
# A portable, pluggable option parser for Bourne shell.
|
|
1887 |
# Written by Gary V. Vaughan, 2010
|
|
1888 |
||
1889 |
# Copyright (C) 2010-2015 Free Software Foundation, Inc.
|
|
1890 |
# This is free software; see the source for copying conditions. There is NO
|
|
1891 |
# warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
1892 |
||
1893 |
# This program is free software: you can redistribute it and/or modify
|
|
1894 |
# it under the terms of the GNU General Public License as published by
|
|
1895 |
# the Free Software Foundation, either version 3 of the License, or
|
|
1896 |
# (at your option) any later version.
|
|
1897 |
||
1898 |
# This program is distributed in the hope that it will be useful,
|
|
1899 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
1900 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
1901 |
# GNU General Public License for more details.
|
|
1902 |
||
1903 |
# You should have received a copy of the GNU General Public License
|
|
1904 |
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
1905 |
||
1906 |
# Please report bugs or propose patches to gary@gnu.org.
|
|
1907 |
||
1908 |
||
1909 |
## ------ ##
|
|
1910 |
## Usage. ##
|
|
1911 |
## ------ ##
|
|
1912 |
||
1913 |
# This file is a library for parsing options in your shell scripts along
|
|
1914 |
# with assorted other useful supporting features that you can make use
|
|
1915 |
# of too.
|
|
1916 |
#
|
|
1917 |
# For the simplest scripts you might need only:
|
|
1918 |
#
|
|
1919 |
# #!/bin/sh
|
|
1920 |
# . relative/path/to/funclib.sh
|
|
1921 |
# . relative/path/to/options-parser
|
|
1922 |
# scriptversion=1.0
|
|
1923 |
# func_options ${1+"$@"}
|
|
1924 |
# eval set dummy "$func_options_result"; shift
|
|
1925 |
# ...rest of your script...
|
|
1926 |
#
|
|
1927 |
# In order for the '--version' option to work, you will need to have a
|
|
1928 |
# suitably formatted comment like the one at the top of this file
|
|
1929 |
# starting with '# Written by ' and ending with '# warranty; '.
|
|
1930 |
#
|
|
1931 |
# For '-h' and '--help' to work, you will also need a one line
|
|
1932 |
# description of your script's purpose in a comment directly above the
|
|
1933 |
# '# Written by ' line, like the one at the top of this file.
|
|
1934 |
#
|
|
1935 |
# The default options also support '--debug', which will turn on shell
|
|
1936 |
# execution tracing (see the comment above debug_cmd below for another
|
|
1937 |
# use), and '--verbose' and the func_verbose function to allow your script
|
|
1938 |
# to display verbose messages only when your user has specified
|
|
1939 |
# '--verbose'.
|
|
1940 |
#
|
|
1941 |
# After sourcing this file, you can plug processing for additional
|
|
1942 |
# options by amending the variables from the 'Configuration' section
|
|
1943 |
# below, and following the instructions in the 'Option parsing'
|
|
1944 |
# section further down.
|
|
1945 |
||
1946 |
## -------------- ##
|
|
1947 |
## Configuration. ##
|
|
1948 |
## -------------- ##
|
|
1949 |
||
1950 |
# You should override these variables in your script after sourcing this
|
|
1951 |
# file so that they reflect the customisations you have added to the
|
|
1952 |
# option parser.
|
|
1953 |
||
1954 |
# The usage line for option parsing errors and the start of '-h' and
|
|
1955 |
# '--help' output messages. You can embed shell variables for delayed
|
|
1956 |
# expansion at the time the message is displayed, but you will need to
|
|
1957 |
# quote other shell meta-characters carefully to prevent them being
|
|
1958 |
# expanded when the contents are evaled.
|
|
1959 |
usage='$progpath [OPTION]...' |
|
1960 |
||
1961 |
# Short help message in response to '-h' and '--help'. Add to this or
|
|
1962 |
# override it after sourcing this library to reflect the full set of
|
|
1963 |
# options your script accepts.
|
|
1964 |
usage_message="\ |
|
1965 |
--debug enable verbose shell tracing
|
|
1966 |
-W, --warnings=CATEGORY
|
|
1967 |
report the warnings falling in CATEGORY [all]
|
|
1968 |
-v, --verbose verbosely report processing
|
|
1969 |
--version print version information and exit
|
|
1970 |
-h, --help print short or long help message and exit
|
|
1971 |
"
|
|
1972 |
||
1973 |
# Additional text appended to 'usage_message' in response to '--help'.
|
|
1974 |
long_help_message=" |
|
1975 |
Warning categories include:
|
|
1976 |
'all' show all warnings
|
|
1977 |
'none' turn off all the warnings
|
|
1978 |
'error' warnings are treated as fatal errors"
|
|
1979 |
||
1980 |
# Help message printed before fatal option parsing errors.
|
|
1981 |
fatal_help="Try '\$progname --help' for more information." |
|
1982 |
||
1983 |
||
1984 |
||
1985 |
## ------------------------- ##
|
|
1986 |
## Hook function management. ##
|
|
1987 |
## ------------------------- ##
|
|
1988 |
||
1989 |
# This section contains functions for adding, removing, and running hooks
|
|
1990 |
# to the main code. A hook is just a named list of of function, that can
|
|
1991 |
# be run in order later on.
|
|
1992 |
||
1993 |
# func_hookable FUNC_NAME
|
|
1994 |
# -----------------------
|
|
1995 |
# Declare that FUNC_NAME will run hooks added with
|
|
1996 |
# 'func_add_hook FUNC_NAME ...'.
|
|
1997 |
func_hookable ()
|
|
1998 |
{
|
|
1999 |
$debug_cmd
|
|
2000 |
||
2001 |
func_append hookable_fns " $1" |
|
2002 |
}
|
|
2003 |
||
2004 |
||
2005 |
# func_add_hook FUNC_NAME HOOK_FUNC
|
|
2006 |
# ---------------------------------
|
|
2007 |
# Request that FUNC_NAME call HOOK_FUNC before it returns. FUNC_NAME must
|
|
2008 |
# first have been declared "hookable" by a call to 'func_hookable'.
|
|
2009 |
func_add_hook ()
|
|
2010 |
{
|
|
2011 |
$debug_cmd
|
|
2012 |
||
2013 |
case " $hookable_fns " in |
|
2014 |
*" $1 "*) ;; |
|
2015 |
*) func_fatal_error "'$1' does not accept hook functions." ;; |
|
2016 |
esac
|
|
2017 |
||
2018 |
eval func_append ${1}_hooks '" $2"' |
|
2019 |
}
|
|
2020 |
||
2021 |
||
2022 |
# func_remove_hook FUNC_NAME HOOK_FUNC
|
|
2023 |
# ------------------------------------
|
|
2024 |
# Remove HOOK_FUNC from the list of functions called by FUNC_NAME.
|
|
2025 |
func_remove_hook ()
|
|
2026 |
{
|
|
2027 |
$debug_cmd
|
|
2028 |
||
2029 |
eval ${1}_hooks='`$ECHO "\$'$1'_hooks" |$SED "s| '$2'||"`' |
|
2030 |
}
|
|
2031 |
||
2032 |
||
2033 |
# func_run_hooks FUNC_NAME [ARG]...
|
|
2034 |
# ---------------------------------
|
|
2035 |
# Run all hook functions registered to FUNC_NAME.
|
|
2036 |
# It is assumed that the list of hook functions contains nothing more
|
|
2037 |
# than a whitespace-delimited list of legal shell function names, and
|
|
2038 |
# no effort is wasted trying to catch shell meta-characters or preserve
|
|
2039 |
# whitespace.
|
|
2040 |
func_run_hooks ()
|
|
2041 |
{
|
|
2042 |
$debug_cmd
|
|
2043 |
||
2044 |
_G_rc_run_hooks=false |
|
2045 |
||
2046 |
case " $hookable_fns " in |
|
2047 |
*" $1 "*) ;; |
|
2048 |
*) func_fatal_error "'$1' does not support hook funcions.n" ;; |
|
2049 |
esac
|
|
2050 |
||
2051 |
eval _G_hook_fns=\$$1_hooks; shift |
|
2052 |
||
2053 |
for _G_hook in $_G_hook_fns; do |
|
2054 |
if eval $_G_hook '"$@"'; then |
|
2055 |
# store returned options list back into positional
|
|
2056 |
# parameters for next 'cmd' execution.
|
|
2057 |
eval _G_hook_result=\$${_G_hook}_result |
|
2058 |
eval set dummy "$_G_hook_result"; shift |
|
2059 |
_G_rc_run_hooks=: |
|
2060 |
fi
|
|
2061 |
done
|
|
2062 |
||
2063 |
$_G_rc_run_hooks && func_run_hooks_result=$_G_hook_result |
|
2064 |
}
|
|
2065 |
||
2066 |
||
2067 |
||
2068 |
## --------------- ##
|
|
2069 |
## Option parsing. ##
|
|
2070 |
## --------------- ##
|
|
2071 |
||
2072 |
# In order to add your own option parsing hooks, you must accept the
|
|
2073 |
# full positional parameter list in your hook function, you may remove/edit
|
|
2074 |
# any options that you action, and then pass back the remaining unprocessed
|
|
2075 |
# options in '<hooked_function_name>_result', escaped suitably for
|
|
2076 |
# 'eval'. In this case you also must return $EXIT_SUCCESS to let the
|
|
2077 |
# hook's caller know that it should pay attention to
|
|
2078 |
# '<hooked_function_name>_result'. Returning $EXIT_FAILURE signalizes that
|
|
2079 |
# arguments are left untouched by the hook and therefore caller will ignore the
|
|
2080 |
# result variable.
|
|
2081 |
#
|
|
2082 |
# Like this:
|
|
2083 |
#
|
|
2084 |
# my_options_prep ()
|
|
2085 |
# {
|
|
2086 |
# $debug_cmd
|
|
2087 |
#
|
|
2088 |
# # Extend the existing usage message.
|
|
2089 |
# usage_message=$usage_message'
|
|
2090 |
# -s, --silent don'\''t print informational messages
|
|
2091 |
# '
|
|
2092 |
# # No change in '$@' (ignored completely by this hook). There is
|
|
2093 |
# # no need to do the equivalent (but slower) action:
|
|
2094 |
# # func_quote_for_eval ${1+"$@"}
|
|
2095 |
# # my_options_prep_result=$func_quote_for_eval_result
|
|
2096 |
# false
|
|
2097 |
# }
|
|
2098 |
# func_add_hook func_options_prep my_options_prep
|
|
2099 |
#
|
|
2100 |
#
|
|
2101 |
# my_silent_option ()
|
|
2102 |
# {
|
|
2103 |
# $debug_cmd
|
|
2104 |
#
|
|
2105 |
# args_changed=false
|
|
2106 |
#
|
|
2107 |
# # Note that for efficiency, we parse as many options as we can
|
|
2108 |
# # recognise in a loop before passing the remainder back to the
|
|
2109 |
# # caller on the first unrecognised argument we encounter.
|
|
2110 |
# while test $# -gt 0; do
|
|
2111 |
# opt=$1; shift
|
|
2112 |
# case $opt in
|
|
2113 |
# --silent|-s) opt_silent=:
|
|
2114 |
# args_changed=:
|
|
2115 |
# ;;
|
|
2116 |
# # Separate non-argument short options:
|
|
2117 |
# -s*) func_split_short_opt "$_G_opt"
|
|
2118 |
# set dummy "$func_split_short_opt_name" \
|
|
2119 |
# "-$func_split_short_opt_arg" ${1+"$@"}
|
|
2120 |
# shift
|
|
2121 |
# args_changed=:
|
|
2122 |
# ;;
|
|
2123 |
# *) # Make sure the first unrecognised option "$_G_opt"
|
|
2124 |
# # is added back to "$@", we could need that later
|
|
2125 |
# # if $args_changed is true.
|
|
2126 |
# set dummy "$_G_opt" ${1+"$@"}; shift; break ;;
|
|
2127 |
# esac
|
|
2128 |
# done
|
|
2129 |
#
|
|
2130 |
# if $args_changed; then
|
|
2131 |
# func_quote_for_eval ${1+"$@"}
|
|
2132 |
# my_silent_option_result=$func_quote_for_eval_result
|
|
2133 |
# fi
|
|
2134 |
#
|
|
2135 |
# $args_changed
|
|
2136 |
# }
|
|
2137 |
# func_add_hook func_parse_options my_silent_option
|
|
2138 |
#
|
|
2139 |
#
|
|
2140 |
# my_option_validation ()
|
|
2141 |
# {
|
|
2142 |
# $debug_cmd
|
|
2143 |
#
|
|
2144 |
# $opt_silent && $opt_verbose && func_fatal_help "\
|
|
2145 |
# '--silent' and '--verbose' options are mutually exclusive."
|
|
2146 |
#
|
|
2147 |
# false
|
|
2148 |
# }
|
|
2149 |
# func_add_hook func_validate_options my_option_validation
|
|
2150 |
#
|
|
2151 |
# You'll also need to manually amend $usage_message to reflect the extra
|
|
2152 |
# options you parse. It's preferable to append if you can, so that
|
|
2153 |
# multiple option parsing hooks can be added safely.
|
|
2154 |
||
2155 |
||
2156 |
# func_options_finish [ARG]...
|
|
2157 |
# ----------------------------
|
|
2158 |
# Finishing the option parse loop (call 'func_options' hooks ATM).
|
|
2159 |
func_options_finish ()
|
|
2160 |
{
|
|
2161 |
$debug_cmd
|
|
2162 |
||
2163 |
_G_func_options_finish_exit=false |
|
2164 |
if func_run_hooks func_options ${1+"$@"}; then |
|
2165 |
func_options_finish_result=$func_run_hooks_result |
|
2166 |
_G_func_options_finish_exit=: |
|
2167 |
fi
|
|
2168 |
||
2169 |
$_G_func_options_finish_exit
|
|
2170 |
}
|
|
2171 |
||
2172 |
||
2173 |
# func_options [ARG]...
|
|
2174 |
# ---------------------
|
|
2175 |
# All the functions called inside func_options are hookable. See the
|
|
2176 |
# individual implementations for details.
|
|
2177 |
func_hookable func_options |
|
2178 |
func_options ()
|
|
2179 |
{
|
|
2180 |
$debug_cmd
|
|
2181 |
||
2182 |
_G_rc_options=false |
|
2183 |
||
2184 |
for my_func in options_prep parse_options validate_options options_finish
|
|
2185 |
do
|
|
2186 |
if eval func_$my_func '${1+"$@"}'; then |
|
2187 |
eval _G_res_var='$'"func_${my_func}_result" |
|
2188 |
eval set dummy "$_G_res_var" ; shift |
|
2189 |
_G_rc_options=: |
|
2190 |
fi
|
|
2191 |
done
|
|
2192 |
||
2193 |
# Save modified positional parameters for caller. As a top-level
|
|
2194 |
# options-parser function we always need to set the 'func_options_result'
|
|
2195 |
# variable (regardless the $_G_rc_options value).
|
|
2196 |
if $_G_rc_options; then |
|
2197 |
func_options_result=$_G_res_var |
|
2198 |
else
|
|
2199 |
func_quote_for_eval ${1+"$@"} |
|
2200 |
func_options_result=$func_quote_for_eval_result |
|
2201 |
fi
|
|
2202 |
||
2203 |
$_G_rc_options
|
|
2204 |
}
|
|
2205 |
||
2206 |
||
2207 |
# func_options_prep [ARG]...
|
|
2208 |
# --------------------------
|
|
2209 |
# All initialisations required before starting the option parse loop.
|
|
2210 |
# Note that when calling hook functions, we pass through the list of
|
|
2211 |
# positional parameters. If a hook function modifies that list, and
|
|
2212 |
# needs to propagate that back to rest of this script, then the complete
|
|
2213 |
# modified list must be put in 'func_run_hooks_result' before
|
|
2214 |
# returning $EXIT_SUCCESS (otherwise $EXIT_FAILURE is returned).
|
|
2215 |
func_hookable func_options_prep |
|
2216 |
func_options_prep ()
|
|
2217 |
{
|
|
2218 |
$debug_cmd
|
|
2219 |
||
2220 |
# Option defaults:
|
|
2221 |
opt_verbose=false |
|
2222 |
opt_warning_types= |
|
2223 |
||
2224 |
_G_rc_options_prep=false |
|
2225 |
if func_run_hooks func_options_prep ${1+"$@"}; then |
|
2226 |
_G_rc_options_prep=: |
|
2227 |
# save modified positional parameters for caller
|
|
2228 |
func_options_prep_result=$func_run_hooks_result |
|
2229 |
fi
|
|
2230 |
||
2231 |
$_G_rc_options_prep
|
|
2232 |
}
|
|
2233 |
||
2234 |
||
2235 |
# func_parse_options [ARG]...
|
|
2236 |
# ---------------------------
|
|
2237 |
# The main option parsing loop.
|
|
2238 |
func_hookable func_parse_options |
|
2239 |
func_parse_options ()
|
|
2240 |
{
|
|
2241 |
$debug_cmd
|
|
2242 |
||
2243 |
func_parse_options_result= |
|
2244 |
||
2245 |
_G_rc_parse_options=false |
|
2246 |
# this just eases exit handling
|
|
2247 |
while test $# -gt 0; do |
|
2248 |
# Defer to hook functions for initial option parsing, so they
|
|
2249 |
# get priority in the event of reusing an option name.
|
|
2250 |
if func_run_hooks func_parse_options ${1+"$@"}; then |
|
2251 |
eval set dummy "$func_run_hooks_result"; shift |
|
2252 |
_G_rc_parse_options=: |
|
2253 |
fi
|
|
2254 |
||
2255 |
# Break out of the loop if we already parsed every option.
|
|
2256 |
test $# -gt 0 || break |
|
2257 |
||
2258 |
_G_match_parse_options=: |
|
2259 |
_G_opt=$1 |
|
2260 |
shift
|
|
2261 |
case $_G_opt in |
|
2262 |
--debug|-x) debug_cmd='set -x' |
|
2263 |
func_echo "enabling shell trace mode"
|
|
2264 |
$debug_cmd
|
|
2265 |
;;
|
|
2266 |
||
2267 |
--no-warnings|--no-warning|--no-warn) |
|
2268 |
set dummy --warnings none ${1+"$@"} |
|
2269 |
shift
|
|
2270 |
;;
|
|
2271 |
||
2272 |
--warnings|--warning|-W) |
|
2273 |
if test $# = 0 && func_missing_arg $_G_opt; then |
|
2274 |
_G_rc_parse_options=: |
|
2275 |
break
|
|
2276 |
fi
|
|
2277 |
case " $warning_categories $1" in |
|
2278 |
*" $1 "*) |
|
2279 |
# trailing space prevents matching last $1 above
|
|
2280 |
func_append_uniq opt_warning_types " $1" |
|
2281 |
;;
|
|
2282 |
*all)
|
|
2283 |
opt_warning_types=$warning_categories |
|
2284 |
;;
|
|
2285 |
*none)
|
|
2286 |
opt_warning_types=none |
|
2287 |
warning_func=: |
|
2288 |
;;
|
|
2289 |
*error)
|
|
2290 |
opt_warning_types=$warning_categories |
|
2291 |
warning_func=func_fatal_error |
|
2292 |
;;
|
|
2293 |
*)
|
|
2294 |
func_fatal_error \
|
|
2295 |
"unsupported warning category: '$1'" |
|
2296 |
;;
|
|
2297 |
esac
|
|
2298 |
shift
|
|
2299 |
;;
|
|
2300 |
||
2301 |
--verbose|-v) opt_verbose=: ;; |
|
2302 |
--version) func_version ;; |
|
2303 |
-\?|-h) func_usage ;; |
|
2304 |
--help) func_help ;; |
|
2305 |
||
2306 |
# Separate optargs to long options (plugins may need this):
|
|
2307 |
--*=*) func_split_equals "$_G_opt" |
|
2308 |
set dummy "$func_split_equals_lhs" \ |
|
2309 |
"$func_split_equals_rhs" ${1+"$@"} |
|
2310 |
shift
|
|
2311 |
;;
|
|
2312 |
||
2313 |
# Separate optargs to short options:
|
|
2314 |
-W*)
|
|
2315 |
func_split_short_opt "$_G_opt" |
|
2316 |
set dummy "$func_split_short_opt_name" \ |
|
2317 |
"$func_split_short_opt_arg" ${1+"$@"} |
|
2318 |
shift
|
|
2319 |
;;
|
|
2320 |
||
2321 |
# Separate non-argument short options:
|
|
2322 |
-\?*|-h*|-v*|-x*) |
|
2323 |
func_split_short_opt "$_G_opt" |
|
2324 |
set dummy "$func_split_short_opt_name" \ |
|
2325 |
"-$func_split_short_opt_arg" ${1+"$@"} |
|
2326 |
shift
|
|
2327 |
;;
|
|
2328 |
||
2329 |
--) _G_rc_parse_options=: ; break ;; |
|
2330 |
-*) func_fatal_help "unrecognised option: '$_G_opt'" ;; |
|
2331 |
*) set dummy "$_G_opt" ${1+"$@"}; shift |
|
2332 |
_G_match_parse_options=false |
|
2333 |
break
|
|
2334 |
;;
|
|
2335 |
esac
|
|
2336 |
||
2337 |
$_G_match_parse_options && _G_rc_parse_options=: |
|
2338 |
done
|
|
2339 |
||
2340 |
||
2341 |
if $_G_rc_parse_options; then |
|
2342 |
# save modified positional parameters for caller
|
|
2343 |
func_quote_for_eval ${1+"$@"} |
|
2344 |
func_parse_options_result=$func_quote_for_eval_result |
|
2345 |
fi
|
|
2346 |
||
2347 |
$_G_rc_parse_options
|
|
2348 |
}
|
|
2349 |
||
2350 |
||
2351 |
# func_validate_options [ARG]...
|
|
2352 |
# ------------------------------
|
|
2353 |
# Perform any sanity checks on option settings and/or unconsumed
|
|
2354 |
# arguments.
|
|
2355 |
func_hookable func_validate_options |
|
2356 |
func_validate_options ()
|
|
2357 |
{
|
|
2358 |
$debug_cmd
|
|
2359 |
||
2360 |
_G_rc_validate_options=false |
|
2361 |
||
2362 |
# Display all warnings if -W was not given.
|
|
2363 |
test -n "$opt_warning_types" || opt_warning_types=" $warning_categories" |
|
2364 |
||
2365 |
if func_run_hooks func_validate_options ${1+"$@"}; then |
|
2366 |
# save modified positional parameters for caller
|
|
2367 |
func_validate_options_result=$func_run_hooks_result |
|
2368 |
_G_rc_validate_options=: |
|
2369 |
fi
|
|
2370 |
||
2371 |
# Bail if the options were screwed!
|
|
2372 |
$exit_cmd $EXIT_FAILURE |
|
2373 |
||
2374 |
$_G_rc_validate_options
|
|
2375 |
}
|
|
2376 |
||
2377 |
||
2378 |
||
2379 |
## ----------------- ##
|
|
2380 |
## Helper functions. ##
|
|
2381 |
## ----------------- ##
|
|
2382 |
||
2383 |
# This section contains the helper functions used by the rest of the
|
|
2384 |
# hookable option parser framework in ascii-betical order.
|
|
2385 |
||
2386 |
||
2387 |
# func_fatal_help ARG...
|
|
2388 |
# ----------------------
|
|
2389 |
# Echo program name prefixed message to standard error, followed by
|
|
2390 |
# a help hint, and exit.
|
|
2391 |
func_fatal_help ()
|
|
2392 |
{
|
|
2393 |
$debug_cmd
|
|
2394 |
||
2395 |
eval \$ECHO \""Usage: $usage"\" |
|
2396 |
eval \$ECHO \""$fatal_help"\" |
|
2397 |
func_error ${1+"$@"} |
|
2398 |
exit $EXIT_FAILURE |
|
2399 |
}
|
|
2400 |
||
2401 |
||
2402 |
# func_help
|
|
2403 |
# ---------
|
|
2404 |
# Echo long help message to standard output and exit.
|
|
2405 |
func_help ()
|
|
2406 |
{
|
|
2407 |
$debug_cmd
|
|
2408 |
||
2409 |
func_usage_message |
|
2410 |
$ECHO "$long_help_message" |
|
2411 |
exit 0 |
|
2412 |
}
|
|
2413 |
||
2414 |
||
2415 |
# func_missing_arg ARGNAME
|
|
2416 |
# ------------------------
|
|
2417 |
# Echo program name prefixed message to standard error and set global
|
|
2418 |
# exit_cmd.
|
|
2419 |
func_missing_arg ()
|
|
2420 |
{
|
|
2421 |
$debug_cmd
|
|
2422 |
||
2423 |
func_error "Missing argument for '$1'." |
|
2424 |
exit_cmd=exit |
|
2425 |
}
|
|
2426 |
||
2427 |
||
2428 |
# func_split_equals STRING
|
|
2429 |
# ------------------------
|
|
2430 |
# Set func_split_equals_lhs and func_split_equals_rhs shell variables after
|
|
2431 |
# splitting STRING at the '=' sign.
|
|
2432 |
test -z "$_G_HAVE_XSI_OPS" \ |
|
2433 |
&& (eval 'x=a/b/c; |
|
2434 |
test 5aa/bb/cc = "${#x}${x%%/*}${x%/*}${x#*/}${x##*/}"') 2>/dev/null \ |
|
2435 |
&& _G_HAVE_XSI_OPS=yes |
|
2436 |
||
2437 |
if test yes = "$_G_HAVE_XSI_OPS" |
|
2438 |
then
|
|
2439 |
# This is an XSI compatible shell, allowing a faster implementation...
|
|
2440 |
eval 'func_split_equals () |
|
2441 |
{
|
|
2442 |
$debug_cmd
|
|
2443 |
||
2444 |
func_split_equals_lhs=${1%%=*}
|
|
2445 |
func_split_equals_rhs=${1#*=}
|
|
2446 |
test "x$func_split_equals_lhs" = "x$1" \
|
|
2447 |
&& func_split_equals_rhs=
|
|
2448 |
}'
|
|
2449 |
else
|
|
2450 |
# ...otherwise fall back to using expr, which is often a shell builtin.
|
|
2451 |
func_split_equals ()
|
|
2452 |
{
|
|
2453 |
$debug_cmd
|
|
2454 |
||
2455 |
func_split_equals_lhs=`expr "x$1" : 'x\([^=]*\)'` |
|
2456 |
func_split_equals_rhs= |
|
2457 |
test "x$func_split_equals_lhs" = "x$1" \ |
|
2458 |
|| func_split_equals_rhs=`expr "x$1" : 'x[^=]*=\(.*\)$'` |
|
2459 |
}
|
|
2460 |
fi #func_split_equals |
|
2461 |
||
2462 |
||
2463 |
# func_split_short_opt SHORTOPT
|
|
2464 |
# -----------------------------
|
|
2465 |
# Set func_split_short_opt_name and func_split_short_opt_arg shell
|
|
2466 |
# variables after splitting SHORTOPT after the 2nd character.
|
|
2467 |
if test yes = "$_G_HAVE_XSI_OPS" |
|
2468 |
then
|
|
2469 |
# This is an XSI compatible shell, allowing a faster implementation...
|
|
2470 |
eval 'func_split_short_opt () |
|
2471 |
{
|
|
2472 |
$debug_cmd
|
|
2473 |
||
2474 |
func_split_short_opt_arg=${1#??}
|
|
2475 |
func_split_short_opt_name=${1%"$func_split_short_opt_arg"}
|
|
2476 |
}'
|
|
2477 |
else
|
|
2478 |
# ...otherwise fall back to using expr, which is often a shell builtin.
|
|
2479 |
func_split_short_opt ()
|
|
2480 |
{
|
|
2481 |
$debug_cmd
|
|
2482 |
||
2483 |
func_split_short_opt_name=`expr "x$1" : 'x-\(.\)'` |
|
2484 |
func_split_short_opt_arg=`expr "x$1" : 'x-.\(.*\)$'` |
|
2485 |
}
|
|
2486 |
fi #func_split_short_opt |
|
2487 |
||
2488 |
||
2489 |
# func_usage
|
|
2490 |
# ----------
|
|
2491 |
# Echo short help message to standard output and exit.
|
|
2492 |
func_usage ()
|
|
2493 |
{
|
|
2494 |
$debug_cmd
|
|
2495 |
||
2496 |
func_usage_message |
|
2497 |
$ECHO "Run '$progname --help |${PAGER-more}' for full usage" |
|
2498 |
exit 0 |
|
2499 |
}
|
|
2500 |
||
2501 |
||
2502 |
# func_usage_message
|
|
2503 |
# ------------------
|
|
2504 |
# Echo short help message to standard output.
|
|
2505 |
func_usage_message ()
|
|
2506 |
{
|
|
2507 |
$debug_cmd
|
|
2508 |
||
2509 |
eval \$ECHO \""Usage: $usage"\" |
|
2510 |
echo
|
|
2511 |
$SED -n 's|^# || |
|
2512 |
/^Written by/{
|
|
2513 |
x;p;x
|
|
2514 |
}
|
|
2515 |
h
|
|
2516 |
/^Written by/q' < "$progpath" |
|
2517 |
echo
|
|
2518 |
eval \$ECHO \""$usage_message"\" |
|
2519 |
}
|
|
2520 |
||
2521 |
||
2522 |
# func_version
|
|
2523 |
# ------------
|
|
2524 |
# Echo version message to standard output and exit.
|
|
2525 |
func_version ()
|
|
2526 |
{
|
|
2527 |
$debug_cmd
|
|
2528 |
||
2529 |
printf '%s\n' "$progname $scriptversion" |
|
2530 |
$SED -n ' |
|
2531 |
/(C)/!b go
|
|
2532 |
:more
|
|
2533 |
/\./!{
|
|
2534 |
N
|
|
2535 |
s|\n# | |
|
|
2536 |
b more
|
|
2537 |
}
|
|
2538 |
:go
|
|
2539 |
/^# Written by /,/# warranty; / {
|
|
2540 |
s|^# ||
|
|
2541 |
s|^# *$||
|
|
2542 |
s|\((C)\)[ 0-9,-]*[ ,-]\([1-9][0-9]* \)|\1 \2|
|
|
2543 |
p
|
|
2544 |
}
|
|
2545 |
/^# Written by / {
|
|
2546 |
s|^# ||
|
|
2547 |
p
|
|
2548 |
}
|
|
2549 |
/^warranty; /q' < "$progpath" |
|
2550 |
||
2551 |
exit $? |
|
2552 |
}
|
|
2553 |
||
2554 |
||
2555 |
# Local variables:
|
|
2556 |
# mode: shell-script
|
|
2557 |
# sh-indentation: 2
|
|
2558 |
# eval: (add-hook 'before-save-hook 'time-stamp)
|
|
2559 |
# time-stamp-pattern: "10/scriptversion=%:y-%02m-%02d.%02H; # UTC"
|
|
2560 |
# time-stamp-time-zone: "UTC"
|
|
2561 |
# End:
|
|
2562 |
||
2563 |
# Set a version string.
|
|
2564 |
scriptversion='(GNU libtool) 2.4.6' |
|
2565 |
||
2566 |
||
2567 |
# func_echo ARG...
|
|
2568 |
# ----------------
|
|
2569 |
# Libtool also displays the current mode in messages, so override
|
|
2570 |
# funclib.sh func_echo with this custom definition.
|
|
2571 |
func_echo ()
|
|
2572 |
{
|
|
2573 |
$debug_cmd
|
|
2574 |
||
2575 |
_G_message=$* |
|
2576 |
||
2577 |
func_echo_IFS=$IFS |
|
2578 |
IFS=$nl |
|
2579 |
for _G_line in $_G_message; do |
|
2580 |
IFS=$func_echo_IFS |
|
2581 |
$ECHO "$progname${opt_mode+: $opt_mode}: $_G_line" |
|
2582 |
done
|
|
2583 |
IFS=$func_echo_IFS |
|
2584 |
}
|
|
2585 |
||
2586 |
||
2587 |
# func_warning ARG...
|
|
2588 |
# -------------------
|
|
2589 |
# Libtool warnings are not categorized, so override funclib.sh
|
|
2590 |
# func_warning with this simpler definition.
|
|
2591 |
func_warning ()
|
|
2592 |
{
|
|
2593 |
$debug_cmd
|
|
2594 |
||
2595 |
$warning_func ${1+"$@"} |
|
2596 |
}
|
|
2597 |
||
2598 |
||
2599 |
## ---------------- ##
|
|
2600 |
## Options parsing. ##
|
|
2601 |
## ---------------- ##
|
|
2602 |
||
2603 |
# Hook in the functions to make sure our own options are parsed during
|
|
2604 |
# the option parsing loop.
|
|
2605 |
||
2606 |
usage='$progpath [OPTION]... [MODE-ARG]...' |
|
2607 |
||
2608 |
# Short help message in response to '-h'.
|
|
2609 |
usage_message="Options: |
|
2610 |
--config show all configuration variables
|
|
2611 |
--debug enable verbose shell tracing
|
|
2612 |
-n, --dry-run display commands without modifying any files
|
|
2613 |
--features display basic configuration information and exit
|
|
2614 |
--mode=MODE use operation mode MODE
|
|
2615 |
--no-warnings equivalent to '-Wnone'
|
|
2616 |
--preserve-dup-deps don't remove duplicate dependency libraries
|
|
2617 |
--quiet, --silent don't print informational messages
|
|
2618 |
--tag=TAG use configuration variables from tag TAG
|
|
2619 |
-v, --verbose print more informational messages than default
|
|
2620 |
--version print version information
|
|
2621 |
-W, --warnings=CATEGORY report the warnings falling in CATEGORY [all]
|
|
2622 |
-h, --help, --help-all print short, long, or detailed help message
|
|
2623 |
"
|
|
2624 |
||
2625 |
# Additional text appended to 'usage_message' in response to '--help'.
|
|
2626 |
func_help ()
|
|
2627 |
{
|
|
2628 |
$debug_cmd
|
|
2629 |
||
2630 |
func_usage_message |
|
2631 |
$ECHO "$long_help_message |
|
2632 |
||
2633 |
MODE must be one of the following:
|
|
2634 |
||
2635 |
clean remove files from the build directory
|
|
2636 |
compile compile a source file into a libtool object
|
|
2637 |
execute automatically set library path, then run a program
|
|
2638 |
finish complete the installation of libtool libraries
|
|
2639 |
install install libraries or executables
|
|
2640 |
link create a library or an executable
|
|
2641 |
uninstall remove libraries from an installed directory
|
|
2642 |
||
2643 |
MODE-ARGS vary depending on the MODE. When passed as first option,
|
|
2644 |
'--mode=MODE' may be abbreviated as 'MODE' or a unique abbreviation of that.
|
|
2645 |
Try '$progname --help --mode=MODE' for a more detailed description of MODE. |
|
2646 |
||
2647 |
When reporting a bug, please describe a test case to reproduce it and
|
|
2648 |
include the following information:
|
|
2649 |
||
2650 |
host-triplet: $host |
|
2651 |
shell: $SHELL |
|
2652 |
compiler: $LTCC |
|
2653 |
compiler flags: $LTCFLAGS |
|
2654 |
linker: $LD (gnu? $with_gnu_ld) |
|
2655 |
version: $progname $scriptversion Debian-2.4.6-14 |
|
2656 |
automake: `($AUTOMAKE --version) 2>/dev/null |$SED 1q` |
|
2657 |
autoconf: `($AUTOCONF --version) 2>/dev/null |$SED 1q` |
|
2658 |
||
2659 |
Report bugs to <bug-libtool@gnu.org>.
|
|
2660 |
GNU libtool home page: <http://www.gnu.org/s/libtool/>.
|
|
2661 |
General help using GNU software: <http://www.gnu.org/gethelp/>."
|
|
2662 |
exit 0 |
|
2663 |
}
|
|
2664 |
||
2665 |
||
2666 |
# func_lo2o OBJECT-NAME
|
|
2667 |
# ---------------------
|
|
2668 |
# Transform OBJECT-NAME from a '.lo' suffix to the platform specific
|
|
2669 |
# object suffix.
|
|
2670 |
||
2671 |
lo2o=s/\\.lo\$/.$objext/ |
|
2672 |
o2lo=s/\\.$objext\$/.lo/ |
|
2673 |
||
2674 |
if test yes = "$_G_HAVE_XSI_OPS"; then |
|
2675 |
eval 'func_lo2o () |
|
2676 |
{
|
|
2677 |
case $1 in
|
|
2678 |
*.lo) func_lo2o_result=${1%.lo}.$objext ;;
|
|
2679 |
* ) func_lo2o_result=$1 ;;
|
|
2680 |
esac
|
|
2681 |
}'
|
|
2682 |
||
2683 |
# func_xform LIBOBJ-OR-SOURCE
|
|
2684 |
# ---------------------------
|
|
2685 |
# Transform LIBOBJ-OR-SOURCE from a '.o' or '.c' (or otherwise)
|
|
2686 |
# suffix to a '.lo' libtool-object suffix.
|
|
2687 |
eval 'func_xform () |
|
2688 |
{
|
|
2689 |
func_xform_result=${1%.*}.lo
|
|
2690 |
}'
|
|
2691 |
else
|
|
2692 |
# ...otherwise fall back to using sed.
|
|
2693 |
func_lo2o ()
|
|
2694 |
{
|
|
2695 |
func_lo2o_result=`$ECHO "$1" | $SED "$lo2o"` |
|
2696 |
}
|
|
2697 |
||
2698 |
func_xform ()
|
|
2699 |
{
|
|
2700 |
func_xform_result=`$ECHO "$1" | $SED 's|\.[^.]*$|.lo|'` |
|
2701 |
}
|
|
2702 |
fi
|
|
2703 |
||
2704 |
||
2705 |
# func_fatal_configuration ARG...
|
|
2706 |
# -------------------------------
|
|
2707 |
# Echo program name prefixed message to standard error, followed by
|
|
2708 |
# a configuration failure hint, and exit.
|
|
2709 |
func_fatal_configuration ()
|
|
2710 |
{
|
|
2711 |
func__fatal_error ${1+"$@"} \ |
|
2712 |
"See the $PACKAGE documentation for more information." \ |
|
2713 |
"Fatal configuration error."
|
|
2714 |
}
|
|
2715 |
||
2716 |
||
2717 |
# func_config
|
|
2718 |
# -----------
|
|
2719 |
# Display the configuration for all the tags in this script.
|
|
2720 |
func_config ()
|
|
2721 |
{
|
|
2722 |
re_begincf='^# ### BEGIN LIBTOOL' |
|
2723 |
re_endcf='^# ### END LIBTOOL' |
|
2724 |
||
2725 |
# Default configuration.
|
|
2726 |
$SED "1,/$re_begincf CONFIG/d;/$re_endcf CONFIG/,\$d" < "$progpath" |
|
2727 |
||
2728 |
# Now print the configurations for the tags.
|
|
2729 |
for tagname in $taglist; do |
|
2730 |
$SED -n "/$re_begincf TAG CONFIG: $tagname\$/,/$re_endcf TAG CONFIG: $tagname\$/p" < "$progpath" |
|
2731 |
done
|
|
2732 |
||
2733 |
exit $? |
|
2734 |
}
|
|
2735 |
||
2736 |
||
2737 |
# func_features
|
|
2738 |
# -------------
|
|
2739 |
# Display the features supported by this script.
|
|
2740 |
func_features ()
|
|
2741 |
{
|
|
2742 |
echo "host: $host" |
|
2743 |
if test yes = "$build_libtool_libs"; then |
|
2744 |
echo "enable shared libraries" |
|
2745 |
else
|
|
2746 |
echo "disable shared libraries" |
|
2747 |
fi
|
|
2748 |
if test yes = "$build_old_libs"; then |
|
2749 |
echo "enable static libraries" |
|
2750 |
else
|
|
2751 |
echo "disable static libraries" |
|
2752 |
fi
|
|
2753 |
||
2754 |
exit $? |
|
2755 |
}
|
|
2756 |
||
2757 |
||
2758 |
# func_enable_tag TAGNAME
|
|
2759 |
# -----------------------
|
|
2760 |
# Verify that TAGNAME is valid, and either flag an error and exit, or
|
|
2761 |
# enable the TAGNAME tag. We also add TAGNAME to the global $taglist
|
|
2762 |
# variable here.
|
|
2763 |
func_enable_tag ()
|
|
2764 |
{
|
|
2765 |
# Global variable:
|
|
2766 |
tagname=$1 |
|
2767 |
||
2768 |
re_begincf="^# ### BEGIN LIBTOOL TAG CONFIG: $tagname\$" |
|
2769 |
re_endcf="^# ### END LIBTOOL TAG CONFIG: $tagname\$" |
|
2770 |
sed_extractcf=/$re_begincf/,/$re_endcf/p |
|
2771 |
||
2772 |
# Validate tagname.
|
|
2773 |
case $tagname in |
|
2774 |
*[!-_A-Za-z0-9,/]*) |
|
2775 |
func_fatal_error "invalid tag name: $tagname" |
|
2776 |
;;
|
|
2777 |
esac
|
|
2778 |
||
2779 |
# Don't test for the "default" C tag, as we know it's
|
|
2780 |
# there but not specially marked.
|
|
2781 |
case $tagname in |
|
2782 |
CC) ;; |
|
2783 |
*)
|
|
2784 |
if $GREP "$re_begincf" "$progpath" >/dev/null 2>&1; then |
|
2785 |
taglist="$taglist $tagname" |
|
2786 |
||
2787 |
# Evaluate the configuration. Be careful to quote the path
|
|
2788 |
# and the sed script, to avoid splitting on whitespace, but
|
|
2789 |
# also don't use non-portable quotes within backquotes within
|
|
2790 |
# quotes we have to do it in 2 steps:
|
|
2791 |
extractedcf=`$SED -n -e "$sed_extractcf" < "$progpath"` |
|
2792 |
eval "$extractedcf" |
|
2793 |
else
|
|
2794 |
func_error "ignoring unknown tag $tagname" |
|
2795 |
fi
|
|
2796 |
;;
|
|
2797 |
esac
|
|
2798 |
}
|
|
2799 |
||
2800 |
||
2801 |
# func_check_version_match
|
|
2802 |
# ------------------------
|
|
2803 |
# Ensure that we are using m4 macros, and libtool script from the same
|
|
2804 |
# release of libtool.
|
|
2805 |
func_check_version_match ()
|
|
2806 |
{
|
|
2807 |
if test "$package_revision" != "$macro_revision"; then |
|
2808 |
if test "$VERSION" != "$macro_version"; then |
|
2809 |
if test -z "$macro_version"; then |
|
2810 |
cat >&2 <<_LT_EOF |
|
2811 |
$progname: Version mismatch error. This is $PACKAGE $VERSION, but the
|
|
2812 |
$progname: definition of this LT_INIT comes from an older release.
|
|
2813 |
$progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION
|
|
2814 |
$progname: and run autoconf again.
|
|
2815 |
_LT_EOF
|
|
2816 |
else
|
|
2817 |
cat >&2 <<_LT_EOF |
|
2818 |
$progname: Version mismatch error. This is $PACKAGE $VERSION, but the
|
|
2819 |
$progname: definition of this LT_INIT comes from $PACKAGE $macro_version.
|
|
2820 |
$progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION
|
|
2821 |
$progname: and run autoconf again.
|
|
2822 |
_LT_EOF
|
|
2823 |
fi
|
|
2824 |
else
|
|
2825 |
cat >&2 <<_LT_EOF |
|
2826 |
$progname: Version mismatch error. This is $PACKAGE $VERSION, revision $package_revision,
|
|
2827 |
$progname: but the definition of this LT_INIT comes from revision $macro_revision.
|
|
2828 |
$progname: You should recreate aclocal.m4 with macros from revision $package_revision
|
|
2829 |
$progname: of $PACKAGE $VERSION and run autoconf again.
|
|
2830 |
_LT_EOF
|
|
2831 |
fi
|
|
2832 |
||
2833 |
exit $EXIT_MISMATCH |
|
2834 |
fi
|
|
2835 |
}
|
|
2836 |
||
2837 |
||
2838 |
# libtool_options_prep [ARG]...
|
|
2839 |
# -----------------------------
|
|
2840 |
# Preparation for options parsed by libtool.
|
|
2841 |
libtool_options_prep ()
|
|
2842 |
{
|
|
2843 |
$debug_mode
|
|
2844 |
||
2845 |
# Option defaults:
|
|
2846 |
opt_config=false |
|
2847 |
opt_dlopen= |
|
2848 |
opt_dry_run=false |
|
2849 |
opt_help=false |
|
2850 |
opt_mode= |
|
2851 |
opt_preserve_dup_deps=false |
|
2852 |
opt_quiet=false |
|
2853 |
||
2854 |
nonopt= |
|
2855 |
preserve_args= |
|
2856 |
||
2857 |
_G_rc_lt_options_prep=: |
|
2858 |
||
2859 |
# Shorthand for --mode=foo, only valid as the first argument
|
|
2860 |
case $1 in |
|
2861 |
clean|clea|cle|cl) |
|
2862 |
shift; set dummy --mode clean ${1+"$@"}; shift |
|
2863 |
;;
|
|
2864 |
compile|compil|compi|comp|com|co|c) |
|
2865 |
shift; set dummy --mode compile ${1+"$@"}; shift |
|
2866 |
;;
|
|
2867 |
execute|execut|execu|exec|exe|ex|e) |
|
2868 |
shift; set dummy --mode execute ${1+"$@"}; shift |
|
2869 |
;;
|
|
2870 |
finish|finis|fini|fin|fi|f) |
|
2871 |
shift; set dummy --mode finish ${1+"$@"}; shift |
|
2872 |
;;
|
|
2873 |
install|instal|insta|inst|ins|in|i) |
|
2874 |
shift; set dummy --mode install ${1+"$@"}; shift |
|
2875 |
;;
|
|
2876 |
link|lin|li|l) |
|
2877 |
shift; set dummy --mode link ${1+"$@"}; shift |
|
2878 |
;;
|
|
2879 |
uninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u) |
|
2880 |
shift; set dummy --mode uninstall ${1+"$@"}; shift |
|
2881 |
;;
|
|
2882 |
*)
|
|
2883 |
_G_rc_lt_options_prep=false |
|
2884 |
;;
|
|
2885 |
esac
|
|
2886 |
||
2887 |
if $_G_rc_lt_options_prep; then |
|
2888 |
# Pass back the list of options.
|
|
2889 |
func_quote_for_eval ${1+"$@"} |
|
2890 |
libtool_options_prep_result=$func_quote_for_eval_result |
|
2891 |
fi
|
|
2892 |
||
2893 |
$_G_rc_lt_options_prep
|
|
2894 |
}
|
|
2895 |
func_add_hook func_options_prep libtool_options_prep |
|
2896 |
||
2897 |
||
2898 |
# libtool_parse_options [ARG]...
|
|
2899 |
# ---------------------------------
|
|
2900 |
# Provide handling for libtool specific options.
|
|
2901 |
libtool_parse_options ()
|
|
2902 |
{
|
|
2903 |
$debug_cmd
|
|
2904 |
||
2905 |
_G_rc_lt_parse_options=false |
|
2906 |
||
2907 |
# Perform our own loop to consume as many options as possible in
|
|
2908 |
# each iteration.
|
|
2909 |
while test $# -gt 0; do |
|
2910 |
_G_match_lt_parse_options=: |
|
2911 |
_G_opt=$1 |
|
2912 |
shift
|
|
2913 |
case $_G_opt in |
|
2914 |
--dry-run|--dryrun|-n) |
|
2915 |
opt_dry_run=: |
|
2916 |
;;
|
|
2917 |
||
2918 |
--config) func_config ;; |
|
2919 |
||
2920 |
--dlopen|-dlopen) |
|
2921 |
opt_dlopen="${opt_dlopen+$opt_dlopen |
|
2922 |
}$1" |
|
2923 |
shift
|
|
2924 |
;;
|
|
2925 |
||
2926 |
--preserve-dup-deps)
|
|
2927 |
opt_preserve_dup_deps=: ;; |
|
2928 |
||
2929 |
--features) func_features ;; |
|
2930 |
||
2931 |
--finish) set dummy --mode finish ${1+"$@"}; shift ;; |
|
2932 |
||
2933 |
--help) opt_help=: ;; |
|
2934 |
||
2935 |
--help-all) opt_help=': help-all' ;; |
|
2936 |
||
2937 |
--mode) test $# = 0 && func_missing_arg $_G_opt && break |
|
2938 |
opt_mode=$1 |
|
2939 |
case $1 in |
|
2940 |
# Valid mode arguments:
|
|
2941 |
clean|compile|execute|finish|install|link|relink|uninstall) ;; |
|
2942 |
||
2943 |
# Catch anything else as an error
|
|
2944 |
*) func_error "invalid argument for $_G_opt" |
|
2945 |
exit_cmd=exit |
|
2946 |
break
|
|
2947 |
;;
|
|
2948 |
esac
|
|
2949 |
shift
|
|
2950 |
;;
|
|
2951 |
||
2952 |
--no-silent|--no-quiet) |
|
2953 |
opt_quiet=false |
|
2954 |
func_append preserve_args " $_G_opt" |
|
2955 |
;;
|
|
2956 |
||
2957 |
--no-warnings|--no-warning|--no-warn) |
|
2958 |
opt_warning=false |
|
2959 |
func_append preserve_args " $_G_opt" |
|
2960 |
;;
|
|
2961 |
||
2962 |
--no-verbose)
|
|
2963 |
opt_verbose=false |
|
2964 |
func_append preserve_args " $_G_opt" |
|
2965 |
;;
|
|
2966 |
||
2967 |
--silent|--quiet) |
|
2968 |
opt_quiet=: |
|
2969 |
opt_verbose=false |
|
2970 |
func_append preserve_args " $_G_opt" |
|
2971 |
;;
|
|
2972 |
||
2973 |
--tag) test $# = 0 && func_missing_arg $_G_opt && break |
|
2974 |
opt_tag=$1 |
|
2975 |
func_append preserve_args " $_G_opt $1" |
|
2976 |
func_enable_tag "$1" |
|
2977 |
shift
|
|
2978 |
;;
|
|
2979 |
||
2980 |
--verbose|-v) opt_quiet=false |
|
2981 |
opt_verbose=: |
|
2982 |
func_append preserve_args " $_G_opt" |
|
2983 |
;;
|
|
2984 |
||
2985 |
# An option not handled by this hook function:
|
|
2986 |
*) set dummy "$_G_opt" ${1+"$@"} ; shift |
|
2987 |
_G_match_lt_parse_options=false |
|
2988 |
break
|
|
2989 |
;;
|
|
2990 |
esac
|
|
2991 |
$_G_match_lt_parse_options && _G_rc_lt_parse_options=: |
|
2992 |
done
|
|
2993 |
||
2994 |
if $_G_rc_lt_parse_options; then |
|
2995 |
# save modified positional parameters for caller
|
|
2996 |
func_quote_for_eval ${1+"$@"} |
|
2997 |
libtool_parse_options_result=$func_quote_for_eval_result |
|
2998 |
fi
|
|
2999 |
||
3000 |
$_G_rc_lt_parse_options
|
|
3001 |
}
|
|
3002 |
func_add_hook func_parse_options libtool_parse_options |
|
3003 |
||
3004 |
||
3005 |
||
3006 |
# libtool_validate_options [ARG]...
|
|
3007 |
# ---------------------------------
|
|
3008 |
# Perform any sanity checks on option settings and/or unconsumed
|
|
3009 |
# arguments.
|
|
3010 |
libtool_validate_options ()
|
|
3011 |
{
|
|
3012 |
# save first non-option argument
|
|
3013 |
if test 0 -lt $#; then |
|
3014 |
nonopt=$1 |
|
3015 |
shift
|
|
3016 |
fi
|
|
3017 |
||
3018 |
# preserve --debug
|
|
3019 |
test : = "$debug_cmd" || func_append preserve_args " --debug" |
|
3020 |
||
3021 |
case $host in |
|
3022 |
# Solaris2 added to fix http://debbugs.gnu.org/cgi/bugreport.cgi?bug=16452
|
|
3023 |
# see also: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59788
|
|
3024 |
*cygwin* | *mingw* | *pw32* | *cegcc* | *solaris2* | *os2*) |
|
3025 |
# don't eliminate duplications in $postdeps and $predeps
|
|
3026 |
opt_duplicate_compiler_generated_deps=: |
|
3027 |
;;
|
|
3028 |
*)
|
|
3029 |
opt_duplicate_compiler_generated_deps=$opt_preserve_dup_deps |
|
3030 |
;;
|
|
3031 |
esac
|
|
3032 |
||
3033 |
$opt_help || { |
|
3034 |
# Sanity checks first:
|
|
3035 |
func_check_version_match |
|
3036 |
||
3037 |
test yes != "$build_libtool_libs" \ |
|
3038 |
&& test yes != "$build_old_libs" \ |
|
3039 |
&& func_fatal_configuration "not configured to build any kind of library" |
|
3040 |
||
3041 |
# Darwin sucks
|
|
3042 |
eval std_shrext=\"$shrext_cmds\" |
|
3043 |
||
3044 |
# Only execute mode is allowed to have -dlopen flags.
|
|
3045 |
if test -n "$opt_dlopen" && test execute != "$opt_mode"; then |
|
3046 |
func_error "unrecognized option '-dlopen'"
|
|
3047 |
$ECHO "$help" 1>&2 |
|
3048 |
exit $EXIT_FAILURE |
|
3049 |
fi
|
|
3050 |
||
3051 |
# Change the help message to a mode-specific one.
|
|
3052 |
generic_help=$help |
|
3053 |
help="Try '$progname --help --mode=$opt_mode' for more information." |
|
3054 |
}
|
|
3055 |
||
3056 |
# Pass back the unparsed argument list
|
|
3057 |
func_quote_for_eval ${1+"$@"} |
|
3058 |
libtool_validate_options_result=$func_quote_for_eval_result |
|
3059 |
}
|
|
3060 |
func_add_hook func_validate_options libtool_validate_options |
|
3061 |
||
3062 |
||
3063 |
# Process options as early as possible so that --help and --version
|
|
3064 |
# can return quickly.
|
|
3065 |
func_options ${1+"$@"} |
|
3066 |
eval set dummy "$func_options_result"; shift |
|
3067 |
||
3068 |
||
3069 |
||
3070 |
## ----------- ##
|
|
3071 |
## Main. ##
|
|
3072 |
## ----------- ##
|
|
3073 |
||
3074 |
magic='%%%MAGIC variable%%%' |
|
3075 |
magic_exe='%%%MAGIC EXE variable%%%' |
|
3076 |
||
3077 |
# Global variables.
|
|
3078 |
extracted_archives= |
|
3079 |
extracted_serial=0 |
|
3080 |
||
3081 |
# If this variable is set in any of the actions, the command in it
|
|
3082 |
# will be execed at the end. This prevents here-documents from being
|
|
3083 |
# left over by shells.
|
|
3084 |
exec_cmd= |
|
3085 |
||
3086 |
||
3087 |
# A function that is used when there is no print builtin or printf.
|
|
3088 |
func_fallback_echo ()
|
|
3089 |
{
|
|
3090 |
eval 'cat <<_LTECHO_EOF |
|
3091 |
$1
|
|
3092 |
_LTECHO_EOF'
|
|
3093 |
}
|
|
3094 |
||
3095 |
# func_generated_by_libtool
|
|
3096 |
# True iff stdin has been generated by Libtool. This function is only
|
|
3097 |
# a basic sanity check; it will hardly flush out determined imposters.
|
|
3098 |
func_generated_by_libtool_p ()
|
|
3099 |
{
|
|
3100 |
$GREP "^# Generated by .*$PACKAGE" > /dev/null 2>&1 |
|
3101 |
}
|
|
3102 |
||
3103 |
# func_lalib_p file
|
|
3104 |
# True iff FILE is a libtool '.la' library or '.lo' object file.
|
|
3105 |
# This function is only a basic sanity check; it will hardly flush out
|
|
3106 |
# determined imposters.
|
|
3107 |
func_lalib_p ()
|
|
3108 |
{
|
|
3109 |
test -f "$1" && |
|
3110 |
$SED -e 4q "$1" 2>/dev/null | func_generated_by_libtool_p |
|
3111 |
}
|
|
3112 |
||
3113 |
# func_lalib_unsafe_p file
|
|
3114 |
# True iff FILE is a libtool '.la' library or '.lo' object file.
|
|
3115 |
# This function implements the same check as func_lalib_p without
|
|
3116 |
# resorting to external programs. To this end, it redirects stdin and
|
|
3117 |
# closes it afterwards, without saving the original file descriptor.
|
|
3118 |
# As a safety measure, use it only where a negative result would be
|
|
3119 |
# fatal anyway. Works if 'file' does not exist.
|
|
3120 |
func_lalib_unsafe_p ()
|
|
3121 |
{
|
|
3122 |
lalib_p=no |
|
3123 |
if test -f "$1" && test -r "$1" && exec 5<&0 <"$1"; then |
|
3124 |
for lalib_p_l in 1 2 3 4 |
|
3125 |
do
|
|
3126 |
read lalib_p_line
|
|
3127 |
case $lalib_p_line in |
|
3128 |
\#\ Generated\ by\ *$PACKAGE* ) lalib_p=yes; break;; |
|
3129 |
esac
|
|
3130 |
done
|
|
3131 |
exec 0<&5 5<&- |
|
3132 |
fi
|
|
3133 |
test yes = "$lalib_p" |
|
3134 |
}
|
|
3135 |
||
3136 |
# func_ltwrapper_script_p file
|
|
3137 |
# True iff FILE is a libtool wrapper script
|
|
3138 |
# This function is only a basic sanity check; it will hardly flush out
|
|
3139 |
# determined imposters.
|
|
3140 |
func_ltwrapper_script_p ()
|
|
3141 |
{
|
|
3142 |
test -f "$1" && |
|
3143 |
$lt_truncate_bin < "$1" 2>/dev/null | func_generated_by_libtool_p |
|
3144 |
}
|
|
3145 |
||
3146 |
# func_ltwrapper_executable_p file
|
|
3147 |
# True iff FILE is a libtool wrapper executable
|
|
3148 |
# This function is only a basic sanity check; it will hardly flush out
|
|
3149 |
# determined imposters.
|
|
3150 |
func_ltwrapper_executable_p ()
|
|
3151 |
{
|
|
3152 |
func_ltwrapper_exec_suffix= |
|
3153 |
case $1 in |
|
3154 |
*.exe) ;; |
|
3155 |
*) func_ltwrapper_exec_suffix=.exe ;; |
|
3156 |
esac
|
|
3157 |
$GREP "$magic_exe" "$1$func_ltwrapper_exec_suffix" >/dev/null 2>&1 |
|
3158 |
}
|
|
3159 |
||
3160 |
# func_ltwrapper_scriptname file
|
|
3161 |
# Assumes file is an ltwrapper_executable
|
|
3162 |
# uses $file to determine the appropriate filename for a
|
|
3163 |
# temporary ltwrapper_script.
|
|
3164 |
func_ltwrapper_scriptname ()
|
|
3165 |
{
|
|
3166 |
func_dirname_and_basename "$1" "" "." |
|
3167 |
func_stripname '' '.exe' "$func_basename_result" |
|
3168 |
func_ltwrapper_scriptname_result=$func_dirname_result/$objdir/${func_stripname_result}_ltshwrapper |
|
3169 |
}
|
|
3170 |
||
3171 |
# func_ltwrapper_p file
|
|
3172 |
# True iff FILE is a libtool wrapper script or wrapper executable
|
|
3173 |
# This function is only a basic sanity check; it will hardly flush out
|
|
3174 |
# determined imposters.
|
|
3175 |
func_ltwrapper_p ()
|
|
3176 |
{
|
|
3177 |
func_ltwrapper_script_p "$1" || func_ltwrapper_executable_p "$1" |
|
3178 |
}
|
|
3179 |
||
3180 |
||
3181 |
# func_execute_cmds commands fail_cmd
|
|
3182 |
# Execute tilde-delimited COMMANDS.
|
|
3183 |
# If FAIL_CMD is given, eval that upon failure.
|
|
3184 |
# FAIL_CMD may read-access the current command in variable CMD!
|
|
3185 |
func_execute_cmds ()
|
|
3186 |
{
|
|
3187 |
$debug_cmd
|
|
3188 |
||
3189 |
save_ifs=$IFS; IFS='~' |
|
3190 |
for cmd in $1; do |
|
3191 |
IFS=$sp$nl |
|
3192 |
eval cmd=\"$cmd\" |
|
3193 |
IFS=$save_ifs |
|
3194 |
func_show_eval "$cmd" "${2-:}" |
|
3195 |
done
|
|
3196 |
IFS=$save_ifs |
|
3197 |
}
|
|
3198 |
||
3199 |
||
3200 |
# func_source file
|
|
3201 |
# Source FILE, adding directory component if necessary.
|
|
3202 |
# Note that it is not necessary on cygwin/mingw to append a dot to
|
|
3203 |
# FILE even if both FILE and FILE.exe exist: automatic-append-.exe
|
|
3204 |
# behavior happens only for exec(3), not for open(2)! Also, sourcing
|
|
3205 |
# 'FILE.' does not work on cygwin managed mounts.
|
|
3206 |
func_source ()
|
|
3207 |
{
|
|
3208 |
$debug_cmd
|
|
3209 |
||
3210 |
case $1 in |
|
3211 |
*/* | *\\*) . "$1" ;; |
|
3212 |
*) . "./$1" ;; |
|
3213 |
esac
|
|
3214 |
}
|
|
3215 |
||
3216 |
||
3217 |
# func_resolve_sysroot PATH
|
|
3218 |
# Replace a leading = in PATH with a sysroot. Store the result into
|
|
3219 |
# func_resolve_sysroot_result
|
|
3220 |
func_resolve_sysroot ()
|
|
3221 |
{
|
|
3222 |
func_resolve_sysroot_result=$1 |
|
3223 |
case $func_resolve_sysroot_result in |
|
3224 |
=*) |
|
3225 |
func_stripname '=' '' "$func_resolve_sysroot_result" |
|
3226 |
func_resolve_sysroot_result=$lt_sysroot$func_stripname_result |
|
3227 |
;;
|
|
3228 |
esac
|
|
3229 |
}
|
|
3230 |
||
3231 |
# func_replace_sysroot PATH
|
|
3232 |
# If PATH begins with the sysroot, replace it with = and
|
|
3233 |
# store the result into func_replace_sysroot_result.
|
|
3234 |
func_replace_sysroot ()
|
|
3235 |
{
|
|
3236 |
case $lt_sysroot:$1 in |
|
3237 |
?*:"$lt_sysroot"*) |
|
3238 |
func_stripname "$lt_sysroot" '' "$1" |
|
3239 |
func_replace_sysroot_result='='$func_stripname_result |
|
3240 |
;;
|
|
3241 |
*)
|
|
3242 |
# Including no sysroot.
|
|
3243 |
func_replace_sysroot_result=$1 |
|
3244 |
;;
|
|
3245 |
esac
|
|
3246 |
}
|
|
3247 |
||
3248 |
# func_infer_tag arg
|
|
3249 |
# Infer tagged configuration to use if any are available and
|
|
3250 |
# if one wasn't chosen via the "--tag" command line option.
|
|
3251 |
# Only attempt this if the compiler in the base compile
|
|
3252 |
# command doesn't match the default compiler.
|
|
3253 |
# arg is usually of the form 'gcc ...'
|
|
3254 |
func_infer_tag ()
|
|
3255 |
{
|
|
3256 |
$debug_cmd
|
|
3257 |
||
3258 |
if test -n "$available_tags" && test -z "$tagname"; then |
|
3259 |
CC_quoted= |
|
3260 |
for arg in $CC; do |
|
3261 |
func_append_quoted CC_quoted "$arg" |
|
3262 |
done
|
|
3263 |
CC_expanded=`func_echo_all $CC` |
|
3264 |
CC_quoted_expanded=`func_echo_all $CC_quoted` |
|
3265 |
case $@ in |
|
3266 |
# Blanks in the command may have been stripped by the calling shell,
|
|
3267 |
# but not from the CC environment variable when configure was run.
|
|
3268 |
" $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \ |
|
3269 |
" $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*) ;; |
|
3270 |
# Blanks at the start of $base_compile will cause this to fail
|
|
3271 |
# if we don't check for them as well.
|
|
3272 |
*)
|
|
3273 |
for z in $available_tags; do |
|
3274 |
if $GREP "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then |
|
3275 |
# Evaluate the configuration.
|
|
3276 |
eval "`$SED -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`" |
|
3277 |
CC_quoted= |
|
3278 |
for arg in $CC; do |
|
3279 |
# Double-quote args containing other shell metacharacters.
|
|
3280 |
func_append_quoted CC_quoted "$arg" |
|
3281 |
done
|
|
3282 |
CC_expanded=`func_echo_all $CC` |
|
3283 |
CC_quoted_expanded=`func_echo_all $CC_quoted` |
|
3284 |
case "$@ " in |
|
3285 |
" $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \ |
|
3286 |
" $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*) |
|
3287 |
# The compiler in the base compile command matches
|
|
3288 |
# the one in the tagged configuration.
|
|
3289 |
# Assume this is the tagged configuration we want.
|
|
3290 |
tagname=$z |
|
3291 |
break
|
|
3292 |
;;
|
|
3293 |
esac
|
|
3294 |
fi
|
|
3295 |
done
|
|
3296 |
# If $tagname still isn't set, then no tagged configuration
|
|
3297 |
# was found and let the user know that the "--tag" command
|
|
3298 |
# line option must be used.
|
|
3299 |
if test -z "$tagname"; then |
|
3300 |
func_echo "unable to infer tagged configuration"
|
|
3301 |
func_fatal_error "specify a tag with '--tag'"
|
|
3302 |
# else
|
|
3303 |
# func_verbose "using $tagname tagged configuration"
|
|
3304 |
fi
|
|
3305 |
;;
|
|
3306 |
esac
|
|
3307 |
fi
|
|
3308 |
}
|
|
3309 |
||
3310 |
||
3311 |
||
3312 |
# func_write_libtool_object output_name pic_name nonpic_name
|
|
3313 |
# Create a libtool object file (analogous to a ".la" file),
|
|
3314 |
# but don't create it if we're doing a dry run.
|
|
3315 |
func_write_libtool_object ()
|
|
3316 |
{
|
|
3317 |
write_libobj=$1 |
|
3318 |
if test yes = "$build_libtool_libs"; then |
|
3319 |
write_lobj=\'$2\' |
|
3320 |
else
|
|
3321 |
write_lobj=none |
|
3322 |
fi
|
|
3323 |
||
3324 |
if test yes = "$build_old_libs"; then |
|
3325 |
write_oldobj=\'$3\' |
|
3326 |
else
|
|
3327 |
write_oldobj=none |
|
3328 |
fi
|
|
3329 |
||
3330 |
$opt_dry_run || { |
|
3331 |
cat >${write_libobj}T <<EOF |
|
3332 |
# $write_libobj - a libtool object file
|
|
3333 |
# Generated by $PROGRAM (GNU $PACKAGE) $VERSION
|
|
3334 |
#
|
|
3335 |
# Please DO NOT delete this file!
|
|
3336 |
# It is necessary for linking the library.
|
|
3337 |
||
3338 |
# Name of the PIC object.
|
|
3339 |
pic_object=$write_lobj
|
|
3340 |
||
3341 |
# Name of the non-PIC object
|
|
3342 |
non_pic_object=$write_oldobj
|
|
3343 |
||
3344 |
EOF
|
|
3345 |
$MV "${write_libobj}T" "$write_libobj" |
|
3346 |
}
|
|
3347 |
}
|
|
3348 |
||
3349 |
||
3350 |
##################################################
|
|
3351 |
# FILE NAME AND PATH CONVERSION HELPER FUNCTIONS #
|
|
3352 |
##################################################
|
|
3353 |
||
3354 |
# func_convert_core_file_wine_to_w32 ARG
|
|
3355 |
# Helper function used by file name conversion functions when $build is *nix,
|
|
3356 |
# and $host is mingw, cygwin, or some other w32 environment. Relies on a
|
|
3357 |
# correctly configured wine environment available, with the winepath program
|
|
3358 |
# in $build's $PATH.
|
|
3359 |
#
|
|
3360 |
# ARG is the $build file name to be converted to w32 format.
|
|
3361 |
# Result is available in $func_convert_core_file_wine_to_w32_result, and will
|
|
3362 |
# be empty on error (or when ARG is empty)
|
|
3363 |
func_convert_core_file_wine_to_w32 ()
|
|
3364 |
{
|
|
3365 |
$debug_cmd
|
|
3366 |
||
3367 |
func_convert_core_file_wine_to_w32_result=$1 |
|
3368 |
if test -n "$1"; then |
|
3369 |
# Unfortunately, winepath does not exit with a non-zero error code, so we
|
|
3370 |
# are forced to check the contents of stdout. On the other hand, if the
|
|
3371 |
# command is not found, the shell will set an exit code of 127 and print
|
|
3372 |
# *an error message* to stdout. So we must check for both error code of
|
|
3373 |
# zero AND non-empty stdout, which explains the odd construction:
|
|
3374 |
func_convert_core_file_wine_to_w32_tmp=`winepath -w "$1" 2>/dev/null` |
|
3375 |
if test "$?" -eq 0 && test -n "$func_convert_core_file_wine_to_w32_tmp"; then |
|
3376 |
func_convert_core_file_wine_to_w32_result=`$ECHO "$func_convert_core_file_wine_to_w32_tmp" | |
|
3377 |
$SED -e "$sed_naive_backslashify"` |
|
3378 |
else
|
|
3379 |
func_convert_core_file_wine_to_w32_result= |
|
3380 |
fi
|
|
3381 |
fi
|
|
3382 |
}
|
|
3383 |
# end: func_convert_core_file_wine_to_w32
|
|
3384 |
||
3385 |
||
3386 |
# func_convert_core_path_wine_to_w32 ARG
|
|
3387 |
# Helper function used by path conversion functions when $build is *nix, and
|
|
3388 |
# $host is mingw, cygwin, or some other w32 environment. Relies on a correctly
|
|
3389 |
# configured wine environment available, with the winepath program in $build's
|
|
3390 |
# $PATH. Assumes ARG has no leading or trailing path separator characters.
|
|
3391 |
#
|
|
3392 |
# ARG is path to be converted from $build format to win32.
|
|
3393 |
# Result is available in $func_convert_core_path_wine_to_w32_result.
|
|
3394 |
# Unconvertible file (directory) names in ARG are skipped; if no directory names
|
|
3395 |
# are convertible, then the result may be empty.
|
|
3396 |
func_convert_core_path_wine_to_w32 ()
|
|
3397 |
{
|
|
3398 |
$debug_cmd
|
|
3399 |
||
3400 |
# unfortunately, winepath doesn't convert paths, only file names
|
|
3401 |
func_convert_core_path_wine_to_w32_result= |
|
3402 |
if test -n "$1"; then |
|
3403 |
oldIFS=$IFS |
|
3404 |
IFS=: |
|
3405 |
for func_convert_core_path_wine_to_w32_f in $1; do |
|
3406 |
IFS=$oldIFS |
|
3407 |
func_convert_core_file_wine_to_w32 "$func_convert_core_path_wine_to_w32_f" |
|
3408 |
if test -n "$func_convert_core_file_wine_to_w32_result"; then |
|
3409 |
if test -z "$func_convert_core_path_wine_to_w32_result"; then |
|
3410 |
func_convert_core_path_wine_to_w32_result=$func_convert_core_file_wine_to_w32_result |
|
3411 |
else
|
|
3412 |
func_append func_convert_core_path_wine_to_w32_result ";$func_convert_core_file_wine_to_w32_result" |
|
3413 |
fi
|
|
3414 |
fi
|
|
3415 |
done
|
|
3416 |
IFS=$oldIFS |
|
3417 |
fi
|
|
3418 |
}
|
|
3419 |
# end: func_convert_core_path_wine_to_w32
|
|
3420 |
||
3421 |
||
3422 |
# func_cygpath ARGS...
|
|
3423 |
# Wrapper around calling the cygpath program via LT_CYGPATH. This is used when
|
|
3424 |
# when (1) $build is *nix and Cygwin is hosted via a wine environment; or (2)
|
|
3425 |
# $build is MSYS and $host is Cygwin, or (3) $build is Cygwin. In case (1) or
|
|
3426 |
# (2), returns the Cygwin file name or path in func_cygpath_result (input
|
|
3427 |
# file name or path is assumed to be in w32 format, as previously converted
|
|
3428 |
# from $build's *nix or MSYS format). In case (3), returns the w32 file name
|
|
3429 |
# or path in func_cygpath_result (input file name or path is assumed to be in
|
|
3430 |
# Cygwin format). Returns an empty string on error.
|
|
3431 |
#
|
|
3432 |
# ARGS are passed to cygpath, with the last one being the file name or path to
|
|
3433 |
# be converted.
|
|
3434 |
#
|
|
3435 |
# Specify the absolute *nix (or w32) name to cygpath in the LT_CYGPATH
|
|
3436 |
# environment variable; do not put it in $PATH.
|
|
3437 |
func_cygpath ()
|
|
3438 |
{
|
|
3439 |
$debug_cmd
|
|
3440 |
||
3441 |
if test -n "$LT_CYGPATH" && test -f "$LT_CYGPATH"; then |
|
3442 |
func_cygpath_result=`$LT_CYGPATH "$@" 2>/dev/null` |
|
3443 |
if test "$?" -ne 0; then |
|
3444 |
# on failure, ensure result is empty
|
|
3445 |
func_cygpath_result= |
|
3446 |
fi
|
|
3447 |
else
|
|
3448 |
func_cygpath_result= |
|
3449 |
func_error "LT_CYGPATH is empty or specifies non-existent file: '$LT_CYGPATH'" |
|
3450 |
fi
|
|
3451 |
}
|
|
3452 |
#end: func_cygpath
|
|
3453 |
||
3454 |
||
3455 |
# func_convert_core_msys_to_w32 ARG
|
|
3456 |
# Convert file name or path ARG from MSYS format to w32 format. Return
|
|
3457 |
# result in func_convert_core_msys_to_w32_result.
|
|
3458 |
func_convert_core_msys_to_w32 ()
|
|
3459 |
{
|
|
3460 |
$debug_cmd
|
|
3461 |
||
3462 |
# awkward: cmd appends spaces to result
|
|
3463 |
func_convert_core_msys_to_w32_result=`( cmd //c echo "$1" ) 2>/dev/null | |
|
3464 |
$SED -e 's/[ ]*$//' -e "$sed_naive_backslashify"` |
|
3465 |
}
|
|
3466 |
#end: func_convert_core_msys_to_w32
|
|
3467 |
||
3468 |
||
3469 |
# func_convert_file_check ARG1 ARG2
|
|
3470 |
# Verify that ARG1 (a file name in $build format) was converted to $host
|
|
3471 |
# format in ARG2. Otherwise, emit an error message, but continue (resetting
|
|
3472 |
# func_to_host_file_result to ARG1).
|
|
3473 |
func_convert_file_check ()
|
|
3474 |
{
|
|
3475 |
$debug_cmd
|
|
3476 |
||
3477 |
if test -z "$2" && test -n "$1"; then |
|
3478 |
func_error "Could not determine host file name corresponding to"
|
|
3479 |
func_error " '$1'" |
|
3480 |
func_error "Continuing, but uninstalled executables may not work."
|
|
3481 |
# Fallback:
|
|
3482 |
func_to_host_file_result=$1 |
|
3483 |
fi
|
|
3484 |
}
|
|
3485 |
# end func_convert_file_check
|
|
3486 |
||
3487 |
||
3488 |
# func_convert_path_check FROM_PATHSEP TO_PATHSEP FROM_PATH TO_PATH
|
|
3489 |
# Verify that FROM_PATH (a path in $build format) was converted to $host
|
|
3490 |
# format in TO_PATH. Otherwise, emit an error message, but continue, resetting
|
|
3491 |
# func_to_host_file_result to a simplistic fallback value (see below).
|
|
3492 |
func_convert_path_check ()
|
|
3493 |
{
|
|
3494 |
$debug_cmd
|
|
3495 |
||
3496 |
if test -z "$4" && test -n "$3"; then |
|
3497 |
func_error "Could not determine the host path corresponding to"
|
|
3498 |
func_error " '$3'" |
|
3499 |
func_error "Continuing, but uninstalled executables may not work."
|
|
3500 |
# Fallback. This is a deliberately simplistic "conversion" and
|
|
3501 |
# should not be "improved". See libtool.info.
|
|
3502 |
if test "x$1" != "x$2"; then |
|
3503 |
lt_replace_pathsep_chars="s|$1|$2|g" |
|
3504 |
func_to_host_path_result=`echo "$3" | |
|
3505 |
$SED -e "$lt_replace_pathsep_chars"` |
|
3506 |
else
|
|
3507 |
func_to_host_path_result=$3 |
|
3508 |
fi
|
|
3509 |
fi
|
|
3510 |
}
|
|
3511 |
# end func_convert_path_check
|
|
3512 |
||
3513 |
||
3514 |
# func_convert_path_front_back_pathsep FRONTPAT BACKPAT REPL ORIG
|
|
3515 |
# Modifies func_to_host_path_result by prepending REPL if ORIG matches FRONTPAT
|
|
3516 |
# and appending REPL if ORIG matches BACKPAT.
|
|
3517 |
func_convert_path_front_back_pathsep ()
|
|
3518 |
{
|
|
3519 |
$debug_cmd
|
|
3520 |
||
3521 |
case $4 in |
|
3522 |
$1 ) func_to_host_path_result=$3$func_to_host_path_result |
|
3523 |
;;
|
|
3524 |
esac
|
|
3525 |
case $4 in |
|
3526 |
$2 ) func_append func_to_host_path_result "$3" |
|
3527 |
;;
|
|
3528 |
esac
|
|
3529 |
}
|
|
3530 |
# end func_convert_path_front_back_pathsep
|
|
3531 |
||
3532 |
||
3533 |
##################################################
|
|
3534 |
# $build to $host FILE NAME CONVERSION FUNCTIONS #
|
|
3535 |
##################################################
|
|
3536 |
# invoked via '$to_host_file_cmd ARG'
|
|
3537 |
#
|
|
3538 |
# In each case, ARG is the path to be converted from $build to $host format.
|
|
3539 |
# Result will be available in $func_to_host_file_result.
|
|
3540 |
||
3541 |
||
3542 |
# func_to_host_file ARG
|
|
3543 |
# Converts the file name ARG from $build format to $host format. Return result
|
|
3544 |
# in func_to_host_file_result.
|
|
3545 |
func_to_host_file ()
|
|
3546 |
{
|
|
3547 |
$debug_cmd
|
|
3548 |
||
3549 |
$to_host_file_cmd "$1" |
|
3550 |
}
|
|
3551 |
# end func_to_host_file
|
|
3552 |
||
3553 |
||
3554 |
# func_to_tool_file ARG LAZY
|
|
3555 |
# converts the file name ARG from $build format to toolchain format. Return
|
|
3556 |
# result in func_to_tool_file_result. If the conversion in use is listed
|
|
3557 |
# in (the comma separated) LAZY, no conversion takes place.
|
|
3558 |
func_to_tool_file ()
|
|
3559 |
{
|
|
3560 |
$debug_cmd
|
|
3561 |
||
3562 |
case ,$2, in |
|
3563 |
*,"$to_tool_file_cmd",*) |
|
3564 |
func_to_tool_file_result=$1 |
|
3565 |
;;
|
|
3566 |
*)
|
|
3567 |
$to_tool_file_cmd "$1" |
|
3568 |
func_to_tool_file_result=$func_to_host_file_result |
|
3569 |
;;
|
|
3570 |
esac
|
|
3571 |
}
|
|
3572 |
# end func_to_tool_file
|
|
3573 |
||
3574 |
||
3575 |
# func_convert_file_noop ARG
|
|
3576 |
# Copy ARG to func_to_host_file_result.
|
|
3577 |
func_convert_file_noop ()
|
|
3578 |
{
|
|
3579 |
func_to_host_file_result=$1 |
|
3580 |
}
|
|
3581 |
# end func_convert_file_noop
|
|
3582 |
||
3583 |
||
3584 |
# func_convert_file_msys_to_w32 ARG
|
|
3585 |
# Convert file name ARG from (mingw) MSYS to (mingw) w32 format; automatic
|
|
3586 |
# conversion to w32 is not available inside the cwrapper. Returns result in
|
|
3587 |
# func_to_host_file_result.
|
|
3588 |
func_convert_file_msys_to_w32 ()
|
|
3589 |
{
|
|
3590 |
$debug_cmd
|
|
3591 |
||
3592 |
func_to_host_file_result=$1 |
|
3593 |
if test -n "$1"; then |
|
3594 |
func_convert_core_msys_to_w32 "$1" |
|
3595 |
func_to_host_file_result=$func_convert_core_msys_to_w32_result |
|
3596 |
fi
|
|
3597 |
func_convert_file_check "$1" "$func_to_host_file_result" |
|
3598 |
}
|
|
3599 |
# end func_convert_file_msys_to_w32
|
|
3600 |
||
3601 |
||
3602 |
# func_convert_file_cygwin_to_w32 ARG
|
|
3603 |
# Convert file name ARG from Cygwin to w32 format. Returns result in
|
|
3604 |
# func_to_host_file_result.
|
|
3605 |
func_convert_file_cygwin_to_w32 ()
|
|
3606 |
{
|
|
3607 |
$debug_cmd
|
|
3608 |
||
3609 |
func_to_host_file_result=$1 |
|
3610 |
if test -n "$1"; then |
|
3611 |
# because $build is cygwin, we call "the" cygpath in $PATH; no need to use
|
|
3612 |
# LT_CYGPATH in this case.
|
|
3613 |
func_to_host_file_result=`cygpath -m "$1"` |
|
3614 |
fi
|
|
3615 |
func_convert_file_check "$1" "$func_to_host_file_result" |
|
3616 |
}
|
|
3617 |
# end func_convert_file_cygwin_to_w32
|
|
3618 |
||
3619 |
||
3620 |
# func_convert_file_nix_to_w32 ARG
|
|
3621 |
# Convert file name ARG from *nix to w32 format. Requires a wine environment
|
|
3622 |
# and a working winepath. Returns result in func_to_host_file_result.
|
|
3623 |
func_convert_file_nix_to_w32 ()
|
|
3624 |
{
|
|
3625 |
$debug_cmd
|
|
3626 |
||
3627 |
func_to_host_file_result=$1 |
|
3628 |
if test -n "$1"; then |
|
3629 |
func_convert_core_file_wine_to_w32 "$1" |
|
3630 |
func_to_host_file_result=$func_convert_core_file_wine_to_w32_result |
|
3631 |
fi
|
|
3632 |
func_convert_file_check "$1" "$func_to_host_file_result" |
|
3633 |
}
|
|
3634 |
# end func_convert_file_nix_to_w32
|
|
3635 |
||
3636 |
||
3637 |
# func_convert_file_msys_to_cygwin ARG
|
|
3638 |
# Convert file name ARG from MSYS to Cygwin format. Requires LT_CYGPATH set.
|
|
3639 |
# Returns result in func_to_host_file_result.
|
|
3640 |
func_convert_file_msys_to_cygwin ()
|
|
3641 |
{
|
|
3642 |
$debug_cmd
|
|
3643 |
||
3644 |
func_to_host_file_result=$1 |
|
3645 |
if test -n "$1"; then |
|
3646 |
func_convert_core_msys_to_w32 "$1" |
|
3647 |
func_cygpath -u "$func_convert_core_msys_to_w32_result" |
|
3648 |
func_to_host_file_result=$func_cygpath_result |
|
3649 |
fi
|
|
3650 |
func_convert_file_check "$1" "$func_to_host_file_result" |
|
3651 |
}
|
|
3652 |
# end func_convert_file_msys_to_cygwin
|
|
3653 |
||
3654 |
||
3655 |
# func_convert_file_nix_to_cygwin ARG
|
|
3656 |
# Convert file name ARG from *nix to Cygwin format. Requires Cygwin installed
|
|
3657 |
# in a wine environment, working winepath, and LT_CYGPATH set. Returns result
|
|
3658 |
# in func_to_host_file_result.
|
|
3659 |
func_convert_file_nix_to_cygwin ()
|
|
3660 |
{
|
|
3661 |
$debug_cmd
|
|
3662 |
||
3663 |
func_to_host_file_result=$1 |
|
3664 |
if test -n "$1"; then |
|
3665 |
# convert from *nix to w32, then use cygpath to convert from w32 to cygwin.
|
|
3666 |
func_convert_core_file_wine_to_w32 "$1" |
|
3667 |
func_cygpath -u "$func_convert_core_file_wine_to_w32_result" |
|
3668 |
func_to_host_file_result=$func_cygpath_result |
|
3669 |
fi
|
|
3670 |
func_convert_file_check "$1" "$func_to_host_file_result" |
|
3671 |
}
|
|
3672 |
# end func_convert_file_nix_to_cygwin
|
|
3673 |
||
3674 |
||
3675 |
#############################################
|
|
3676 |
# $build to $host PATH CONVERSION FUNCTIONS #
|
|
3677 |
#############################################
|
|
3678 |
# invoked via '$to_host_path_cmd ARG'
|
|
3679 |
#
|
|
3680 |
# In each case, ARG is the path to be converted from $build to $host format.
|
|
3681 |
# The result will be available in $func_to_host_path_result.
|
|
3682 |
#
|
|
3683 |
# Path separators are also converted from $build format to $host format. If
|
|
3684 |
# ARG begins or ends with a path separator character, it is preserved (but
|
|
3685 |
# converted to $host format) on output.
|
|
3686 |
#
|
|
3687 |
# All path conversion functions are named using the following convention:
|
|
3688 |
# file name conversion function : func_convert_file_X_to_Y ()
|
|
3689 |
# path conversion function : func_convert_path_X_to_Y ()
|
|
3690 |
# where, for any given $build/$host combination the 'X_to_Y' value is the
|
|
3691 |
# same. If conversion functions are added for new $build/$host combinations,
|
|
3692 |
# the two new functions must follow this pattern, or func_init_to_host_path_cmd
|
|
3693 |
# will break.
|
|
3694 |
||
3695 |
||
3696 |
# func_init_to_host_path_cmd
|
|
3697 |
# Ensures that function "pointer" variable $to_host_path_cmd is set to the
|
|
3698 |
# appropriate value, based on the value of $to_host_file_cmd.
|
|
3699 |
to_host_path_cmd= |
|
3700 |
func_init_to_host_path_cmd ()
|
|
3701 |
{
|
|
3702 |
$debug_cmd
|
|
3703 |
||
3704 |
if test -z "$to_host_path_cmd"; then |
|
3705 |
func_stripname 'func_convert_file_' '' "$to_host_file_cmd" |
|
3706 |
to_host_path_cmd=func_convert_path_$func_stripname_result |
|
3707 |
fi
|
|
3708 |
}
|
|
3709 |
||
3710 |
||
3711 |
# func_to_host_path ARG
|
|
3712 |
# Converts the path ARG from $build format to $host format. Return result
|
|
3713 |
# in func_to_host_path_result.
|
|
3714 |
func_to_host_path ()
|
|
3715 |
{
|
|
3716 |
$debug_cmd
|
|
3717 |
||
3718 |
func_init_to_host_path_cmd |
|
3719 |
$to_host_path_cmd "$1" |
|
3720 |
}
|
|
3721 |
# end func_to_host_path
|
|
3722 |
||
3723 |
||
3724 |
# func_convert_path_noop ARG
|
|
3725 |
# Copy ARG to func_to_host_path_result.
|
|
3726 |
func_convert_path_noop ()
|
|
3727 |
{
|
|
3728 |
func_to_host_path_result=$1 |
|
3729 |
}
|
|
3730 |
# end func_convert_path_noop
|
|
3731 |
||
3732 |
||
3733 |
# func_convert_path_msys_to_w32 ARG
|
|
3734 |
# Convert path ARG from (mingw) MSYS to (mingw) w32 format; automatic
|
|
3735 |
# conversion to w32 is not available inside the cwrapper. Returns result in
|
|
3736 |
# func_to_host_path_result.
|
|
3737 |
func_convert_path_msys_to_w32 ()
|
|
3738 |
{
|
|
3739 |
$debug_cmd
|
|
3740 |
||
3741 |
func_to_host_path_result=$1 |
|
3742 |
if test -n "$1"; then |
|
3743 |
# Remove leading and trailing path separator characters from ARG. MSYS
|
|
3744 |
# behavior is inconsistent here; cygpath turns them into '.;' and ';.';
|
|
3745 |
# and winepath ignores them completely.
|
|
3746 |
func_stripname : : "$1" |
|
3747 |
func_to_host_path_tmp1=$func_stripname_result |
|
3748 |
func_convert_core_msys_to_w32 "$func_to_host_path_tmp1" |
|
3749 |
func_to_host_path_result=$func_convert_core_msys_to_w32_result |
|
3750 |
func_convert_path_check : ";" \ |
|
3751 |
"$func_to_host_path_tmp1" "$func_to_host_path_result" |
|
3752 |
func_convert_path_front_back_pathsep ":*" "*:" ";" "$1" |
|
3753 |
fi
|
|
3754 |
}
|
|
3755 |
# end func_convert_path_msys_to_w32
|
|
3756 |
||
3757 |
||
3758 |
# func_convert_path_cygwin_to_w32 ARG
|
|
3759 |
# Convert path ARG from Cygwin to w32 format. Returns result in
|
|
3760 |
# func_to_host_file_result.
|
|
3761 |
func_convert_path_cygwin_to_w32 ()
|
|
3762 |
{
|
|
3763 |
$debug_cmd
|
|
3764 |
||
3765 |
func_to_host_path_result=$1 |
|
3766 |
if test -n "$1"; then |
|
3767 |
# See func_convert_path_msys_to_w32:
|
|
3768 |
func_stripname : : "$1" |
|
3769 |
func_to_host_path_tmp1=$func_stripname_result |
|
3770 |
func_to_host_path_result=`cygpath -m -p "$func_to_host_path_tmp1"` |
|
3771 |
func_convert_path_check : ";" \ |
|
3772 |
"$func_to_host_path_tmp1" "$func_to_host_path_result" |
|
3773 |
func_convert_path_front_back_pathsep ":*" "*:" ";" "$1" |
|
3774 |
fi
|
|
3775 |
}
|
|
3776 |
# end func_convert_path_cygwin_to_w32
|
|
3777 |
||
3778 |
||
3779 |
# func_convert_path_nix_to_w32 ARG
|
|
3780 |
# Convert path ARG from *nix to w32 format. Requires a wine environment and
|
|
3781 |
# a working winepath. Returns result in func_to_host_file_result.
|
|
3782 |
func_convert_path_nix_to_w32 ()
|
|
3783 |
{
|
|
3784 |
$debug_cmd
|
|
3785 |
||
3786 |
func_to_host_path_result=$1 |
|
3787 |
if test -n "$1"; then |
|
3788 |
# See func_convert_path_msys_to_w32:
|
|
3789 |
func_stripname : : "$1" |
|
3790 |
func_to_host_path_tmp1=$func_stripname_result |
|
3791 |
func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1" |
|
3792 |
func_to_host_path_result=$func_convert_core_path_wine_to_w32_result |
|
3793 |
func_convert_path_check : ";" \ |
|
3794 |
"$func_to_host_path_tmp1" "$func_to_host_path_result" |
|
3795 |
func_convert_path_front_back_pathsep ":*" "*:" ";" "$1" |
|
3796 |
fi
|
|
3797 |
}
|
|
3798 |
# end func_convert_path_nix_to_w32
|
|
3799 |
||
3800 |
||
3801 |
# func_convert_path_msys_to_cygwin ARG
|
|
3802 |
# Convert path ARG from MSYS to Cygwin format. Requires LT_CYGPATH set.
|
|
3803 |
# Returns result in func_to_host_file_result.
|
|
3804 |
func_convert_path_msys_to_cygwin ()
|
|
3805 |
{
|
|
3806 |
$debug_cmd
|
|
3807 |
||
3808 |
func_to_host_path_result=$1 |
|
3809 |
if test -n "$1"; then |
|
3810 |
# See func_convert_path_msys_to_w32:
|
|
3811 |
func_stripname : : "$1" |
|
3812 |
func_to_host_path_tmp1=$func_stripname_result |
|
3813 |
func_convert_core_msys_to_w32 "$func_to_host_path_tmp1" |
|
3814 |
func_cygpath -u -p "$func_convert_core_msys_to_w32_result" |
|
3815 |
func_to_host_path_result=$func_cygpath_result |
|
3816 |
func_convert_path_check : : \
|
|
3817 |
"$func_to_host_path_tmp1" "$func_to_host_path_result" |
|
3818 |
func_convert_path_front_back_pathsep ":*" "*:" : "$1" |
|
3819 |
fi
|
|
3820 |
}
|
|
3821 |
# end func_convert_path_msys_to_cygwin
|
|
3822 |
||
3823 |
||
3824 |
# func_convert_path_nix_to_cygwin ARG
|
|
3825 |
# Convert path ARG from *nix to Cygwin format. Requires Cygwin installed in a
|
|
3826 |
# a wine environment, working winepath, and LT_CYGPATH set. Returns result in
|
|
3827 |
# func_to_host_file_result.
|
|
3828 |
func_convert_path_nix_to_cygwin ()
|
|
3829 |
{
|
|
3830 |
$debug_cmd
|
|
3831 |
||
3832 |
func_to_host_path_result=$1 |
|
3833 |
if test -n "$1"; then |
|
3834 |
# Remove leading and trailing path separator characters from
|
|
3835 |
# ARG. msys behavior is inconsistent here, cygpath turns them
|
|
3836 |
# into '.;' and ';.', and winepath ignores them completely.
|
|
3837 |
func_stripname : : "$1" |
|
3838 |
func_to_host_path_tmp1=$func_stripname_result |
|
3839 |
func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1" |
|
3840 |
func_cygpath -u -p "$func_convert_core_path_wine_to_w32_result" |
|
3841 |
func_to_host_path_result=$func_cygpath_result |
|
3842 |
func_convert_path_check : : \
|
|
3843 |
"$func_to_host_path_tmp1" "$func_to_host_path_result" |
|
3844 |
func_convert_path_front_back_pathsep ":*" "*:" : "$1" |
|
3845 |
fi
|
|
3846 |
}
|
|
3847 |
# end func_convert_path_nix_to_cygwin
|
|
3848 |
||
3849 |
||
3850 |
# func_dll_def_p FILE
|
|
3851 |
# True iff FILE is a Windows DLL '.def' file.
|
|
3852 |
# Keep in sync with _LT_DLL_DEF_P in libtool.m4
|
|
3853 |
func_dll_def_p ()
|
|
3854 |
{
|
|
3855 |
$debug_cmd
|
|
3856 |
||
3857 |
func_dll_def_p_tmp=`$SED -n \ |
|
3858 |
-e 's/^[ ]*//' \ |
|
3859 |
-e '/^\(;.*\)*$/d' \ |
|
3860 |
-e 's/^\(EXPORTS\|LIBRARY\)\([ ].*\)*$/DEF/p' \ |
|
3861 |
-e q \
|
|
3862 |
"$1"` |
|
3863 |
test DEF = "$func_dll_def_p_tmp" |
|
3864 |
}
|
|
3865 |
||
3866 |
||
3867 |
# func_mode_compile arg...
|
|
3868 |
func_mode_compile ()
|
|
3869 |
{
|
|
3870 |
$debug_cmd
|
|
3871 |
||
3872 |
# Get the compilation command and the source file.
|
|
3873 |
base_compile= |
|
3874 |
srcfile=$nonopt # always keep a non-empty value in "srcfile" |
|
3875 |
suppress_opt=yes |
|
3876 |
suppress_output= |
|
3877 |
arg_mode=normal |
|
3878 |
libobj= |
|
3879 |
later= |
|
3880 |
pie_flag= |
|
3881 |
||
3882 |
for arg
|
|
3883 |
do
|
|
3884 |
case $arg_mode in |
|
3885 |
arg )
|
|
3886 |
# do not "continue". Instead, add this to base_compile
|
|
3887 |
lastarg=$arg |
|
3888 |
arg_mode=normal |
|
3889 |
;;
|
|
3890 |
||
3891 |
target )
|
|
3892 |
libobj=$arg |
|
3893 |
arg_mode=normal |
|
3894 |
continue
|
|
3895 |
;;
|
|
3896 |
||
3897 |
normal )
|
|
3898 |
# Accept any command-line options.
|
|
3899 |
case $arg in |
|
3900 |
-o)
|
|
3901 |
test -n "$libobj" && \ |
|
3902 |
func_fatal_error "you cannot specify '-o' more than once"
|
|
3903 |
arg_mode=target |
|
3904 |
continue
|
|
3905 |
;;
|
|
3906 |
||
3907 |
-pie | -fpie | -fPIE) |
|
3908 |
func_append pie_flag " $arg" |
|
3909 |
continue
|
|
3910 |
;;
|
|
3911 |
||
3912 |
-shared | -static | -prefer-pic | -prefer-non-pic) |
|
3913 |
func_append later " $arg" |
|
3914 |
continue
|
|
3915 |
;;
|
|
3916 |
||
3917 |
-no-suppress)
|
|
3918 |
suppress_opt=no |
|
3919 |
continue
|
|
3920 |
;;
|
|
3921 |
||
3922 |
-Xcompiler)
|
|
3923 |
arg_mode=arg # the next one goes into the "base_compile" arg list |
|
3924 |
continue # The current "srcfile" will either be retained or |
|
3925 |
;; # replaced later. I would guess that would be a bug. |
|
3926 |
||
3927 |
-Wc,*)
|
|
3928 |
func_stripname '-Wc,' '' "$arg" |
|
3929 |
args=$func_stripname_result |
|
3930 |
lastarg= |
|
3931 |
save_ifs=$IFS; IFS=, |
|
3932 |
for arg in $args; do |
|
3933 |
IFS=$save_ifs |
|
3934 |
func_append_quoted lastarg "$arg" |
|
3935 |
done
|
|
3936 |
IFS=$save_ifs |
|
3937 |
func_stripname ' ' '' "$lastarg" |
|
3938 |
lastarg=$func_stripname_result |
|
3939 |
||
3940 |
# Add the arguments to base_compile.
|
|
3941 |
func_append base_compile " $lastarg" |
|
3942 |
continue
|
|
3943 |
;;
|
|
3944 |
||
3945 |
*)
|
|
3946 |
# Accept the current argument as the source file.
|
|
3947 |
# The previous "srcfile" becomes the current argument.
|
|
3948 |
#
|
|
3949 |
lastarg=$srcfile |
|
3950 |
srcfile=$arg |
|
3951 |
;;
|
|
3952 |
esac # case $arg |
|
3953 |
;;
|
|
3954 |
esac # case $arg_mode |
|
3955 |
||
3956 |
# Aesthetically quote the previous argument.
|
|
3957 |
func_append_quoted base_compile "$lastarg" |
|
3958 |
done # for arg |
|
3959 |
||
3960 |
case $arg_mode in |
|
3961 |
arg)
|
|
3962 |
func_fatal_error "you must specify an argument for -Xcompile"
|
|
3963 |
;;
|
|
3964 |
target)
|
|
3965 |
func_fatal_error "you must specify a target with '-o'"
|
|
3966 |
;;
|
|
3967 |
*)
|
|
3968 |
# Get the name of the library object.
|
|
3969 |
test -z "$libobj" && { |
|
3970 |
func_basename "$srcfile" |
|
3971 |
libobj=$func_basename_result |
|
3972 |
}
|
|
3973 |
;;
|
|
3974 |
esac
|
|
3975 |
||
3976 |
# Recognize several different file suffixes.
|
|
3977 |
# If the user specifies -o file.o, it is replaced with file.lo
|
|
3978 |
case $libobj in |
|
3979 |
*.[cCFSifmso] | \ |
|
3980 |
*.ada | *.adb | *.ads | *.asm | \ |
|
3981 |
*.c++ | *.cc | *.ii | *.class | *.cpp | *.cxx | \ |
|
3982 |
*.[fF][09]? | *.for | *.java | *.go | *.obj | *.sx | *.cu | *.cup) |
|
3983 |
func_xform "$libobj" |
|
3984 |
libobj=$func_xform_result |
|
3985 |
;;
|
|
3986 |
esac
|
|
3987 |
||
3988 |
case $libobj in |
|
3989 |
*.lo) func_lo2o "$libobj"; obj=$func_lo2o_result ;; |
|
3990 |
*)
|
|
3991 |
func_fatal_error "cannot determine name of library object from '$libobj'" |
|
3992 |
;;
|
|
3993 |
esac
|
|
3994 |
||
3995 |
func_infer_tag $base_compile
|
|
3996 |
||
3997 |
for arg in $later; do |
|
3998 |
case $arg in |
|
3999 |
-shared)
|
|
4000 |
test yes = "$build_libtool_libs" \ |
|
4001 |
|| func_fatal_configuration "cannot build a shared library" |
|
4002 |
build_old_libs=no |
|
4003 |
continue
|
|
4004 |
;;
|
|
4005 |
||
4006 |
-static)
|
|
4007 |
build_libtool_libs=no |
|
4008 |
build_old_libs=yes |
|
4009 |
continue
|
|
4010 |
;;
|
|
4011 |
||
4012 |
-prefer-pic)
|
|
4013 |
pic_mode=yes |
|
4014 |
continue
|
|
4015 |
;;
|
|
4016 |
||
4017 |
-prefer-non-pic)
|
|
4018 |
pic_mode=no |
|
4019 |
continue
|
|
4020 |
;;
|
|
4021 |
esac
|
|
4022 |
done
|
|
4023 |
||
4024 |
func_quote_for_eval "$libobj" |
|
4025 |
test "X$libobj" != "X$func_quote_for_eval_result" \ |
|
4026 |
&& $ECHO "X$libobj" | $GREP '[]~#^*{};<>?"'"'"' &()|`$[]' \ |
|
4027 |
&& func_warning "libobj name '$libobj' may not contain shell special characters." |
|
4028 |
func_dirname_and_basename "$obj" "/" "" |
|
4029 |
objname=$func_basename_result |
|
4030 |
xdir=$func_dirname_result |
|
4031 |
lobj=$xdir$objdir/$objname |
|
4032 |
||
4033 |
test -z "$base_compile" && \ |
|
4034 |
func_fatal_help "you must specify a compilation command"
|
|
4035 |
||
4036 |
# Delete any leftover library objects.
|
|
4037 |
if test yes = "$build_old_libs"; then |
|
4038 |
removelist="$obj $lobj $libobj ${libobj}T" |
|
4039 |
else
|
|
4040 |
removelist="$lobj $libobj ${libobj}T" |
|
4041 |
fi
|
|
4042 |
||
4043 |
# On Cygwin there's no "real" PIC flag so we must build both object types
|
|
4044 |
case $host_os in |
|
4045 |
cygwin* | mingw* | pw32* | os2* | cegcc*) |
|
4046 |
pic_mode=default |
|
4047 |
;;
|
|
4048 |
esac
|
|
4049 |
if test no = "$pic_mode" && test pass_all != "$deplibs_check_method"; then |
|
4050 |
# non-PIC code in shared libraries is not supported
|
|
4051 |
pic_mode=default |
|
4052 |
fi
|
|
4053 |
||
4054 |
# Calculate the filename of the output object if compiler does
|
|
4055 |
# not support -o with -c
|
|
4056 |
if test no = "$compiler_c_o"; then |
|
4057 |
output_obj=`$ECHO "$srcfile" | $SED 's%^.*/%%; s%\.[^.]*$%%'`.$objext |
|
4058 |
lockfile=$output_obj.lock |
|
4059 |
else
|
|
4060 |
output_obj= |
|
4061 |
need_locks=no |
|
4062 |
lockfile= |
|
4063 |
fi
|
|
4064 |
||
4065 |
# Lock this critical section if it is needed
|
|
4066 |
# We use this script file to make the link, it avoids creating a new file
|
|
4067 |
if test yes = "$need_locks"; then |
|
4068 |
until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do |
|
4069 |
func_echo "Waiting for $lockfile to be removed" |
|
4070 |
sleep 2
|
|
4071 |
done
|
|
4072 |
elif test warn = "$need_locks"; then |
|
4073 |
if test -f "$lockfile"; then |
|
4074 |
$ECHO "\ |
|
4075 |
*** ERROR, $lockfile exists and contains: |
|
4076 |
`cat $lockfile 2>/dev/null` |
|
4077 |
||
4078 |
This indicates that another process is trying to use the same
|
|
4079 |
temporary object file, and libtool could not work around it because
|
|
4080 |
your compiler does not support '-c' and '-o' together. If you
|
|
4081 |
repeat this compilation, it may succeed, by chance, but you had better
|
|
4082 |
avoid parallel builds (make -j) in this platform, or get a better
|
|
4083 |
compiler."
|
|
4084 |
||
4085 |
$opt_dry_run || $RM $removelist |
|
4086 |
exit $EXIT_FAILURE |
|
4087 |
fi
|
|
4088 |
func_append removelist " $output_obj" |
|
4089 |
$ECHO "$srcfile" > "$lockfile" |
|
4090 |
fi
|
|
4091 |
||
4092 |
$opt_dry_run || $RM $removelist |
|
4093 |
func_append removelist " $lockfile" |
|
4094 |
trap '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' 1 2 15 |
|
4095 |
||
4096 |
func_to_tool_file "$srcfile" func_convert_file_msys_to_w32 |
|
4097 |
srcfile=$func_to_tool_file_result |
|
4098 |
func_quote_for_eval "$srcfile" |
|
4099 |
qsrcfile=$func_quote_for_eval_result |
|
4100 |
||
4101 |
# Only build a PIC object if we are building libtool libraries.
|
|
4102 |
if test yes = "$build_libtool_libs"; then |
|
4103 |
# Without this assignment, base_compile gets emptied.
|
|
4104 |
fbsd_hideous_sh_bug=$base_compile |
|
4105 |
||
4106 |
if test no != "$pic_mode"; then |
|
4107 |
command="$base_compile $qsrcfile $pic_flag" |
|
4108 |
else
|
|
4109 |
# Don't build PIC code
|
|
4110 |
command="$base_compile $qsrcfile" |
|
4111 |
fi
|
|
4112 |
||
4113 |
func_mkdir_p "$xdir$objdir" |
|
4114 |
||
4115 |
if test -z "$output_obj"; then |
|
4116 |
# Place PIC objects in $objdir
|
|
4117 |
func_append command " -o $lobj" |
|
4118 |
fi
|
|
4119 |
||
4120 |
func_show_eval_locale "$command" \ |
|
4121 |
'test -n "$output_obj" && $RM $removelist; exit $EXIT_FAILURE'
|
|
4122 |
||
4123 |
if test warn = "$need_locks" && |
|
4124 |
test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then |
|
4125 |
$ECHO "\ |
|
4126 |
*** ERROR, $lockfile contains: |
|
4127 |
`cat $lockfile 2>/dev/null` |
|
4128 |
||
4129 |
but it should contain:
|
|
4130 |
$srcfile
|
|
4131 |
||
4132 |
This indicates that another process is trying to use the same
|
|
4133 |
temporary object file, and libtool could not work around it because
|
|
4134 |
your compiler does not support '-c' and '-o' together. If you
|
|
4135 |
repeat this compilation, it may succeed, by chance, but you had better
|
|
4136 |
avoid parallel builds (make -j) in this platform, or get a better
|
|
4137 |
compiler."
|
|
4138 |
||
4139 |
$opt_dry_run || $RM $removelist |
|
4140 |
exit $EXIT_FAILURE |
|
4141 |
fi
|
|
4142 |
||
4143 |
# Just move the object if needed, then go on to compile the next one
|
|
4144 |
if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then |
|
4145 |
func_show_eval '$MV "$output_obj" "$lobj"' \ |
|
4146 |
'error=$?; $opt_dry_run || $RM $removelist; exit $error'
|
|
4147 |
fi
|
|
4148 |
||
4149 |
# Allow error messages only from the first compilation.
|
|
4150 |
if test yes = "$suppress_opt"; then |
|
4151 |
suppress_output=' >/dev/null 2>&1' |
|
4152 |
fi
|
|
4153 |
fi
|
|
4154 |
||
4155 |
# Only build a position-dependent object if we build old libraries.
|
|
4156 |
if test yes = "$build_old_libs"; then |
|
4157 |
if test yes != "$pic_mode"; then |
|
4158 |
# Don't build PIC code
|
|
4159 |
command="$base_compile $qsrcfile$pie_flag" |
|
4160 |
else
|
|
4161 |
command="$base_compile $qsrcfile $pic_flag" |
|
4162 |
fi
|
|
4163 |
if test yes = "$compiler_c_o"; then |
|
4164 |
func_append command " -o $obj" |
|
4165 |
fi
|
|
4166 |
||
4167 |
# Suppress compiler output if we already did a PIC compilation.
|
|
4168 |
func_append command "$suppress_output" |
|
4169 |
func_show_eval_locale "$command" \ |
|
4170 |
'$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE'
|
|
4171 |
||
4172 |
if test warn = "$need_locks" && |
|
4173 |
test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then |
|
4174 |
$ECHO "\ |
|
4175 |
*** ERROR, $lockfile contains: |
|
4176 |
`cat $lockfile 2>/dev/null` |
|
4177 |
||
4178 |
but it should contain:
|
|
4179 |
$srcfile
|
|
4180 |
||
4181 |
This indicates that another process is trying to use the same
|
|
4182 |
temporary object file, and libtool could not work around it because
|
|
4183 |
your compiler does not support '-c' and '-o' together. If you
|
|
4184 |
repeat this compilation, it may succeed, by chance, but you had better
|
|
4185 |
avoid parallel builds (make -j) in this platform, or get a better
|
|
4186 |
compiler."
|
|
4187 |
||
4188 |
$opt_dry_run || $RM $removelist |
|
4189 |
exit $EXIT_FAILURE |
|
4190 |
fi
|
|
4191 |
||
4192 |
# Just move the object if needed
|
|
4193 |
if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then |
|
4194 |
func_show_eval '$MV "$output_obj" "$obj"' \ |
|
4195 |
'error=$?; $opt_dry_run || $RM $removelist; exit $error'
|
|
4196 |
fi
|
|
4197 |
fi
|
|
4198 |
||
4199 |
$opt_dry_run || { |
|
4200 |
func_write_libtool_object "$libobj" "$objdir/$objname" "$objname" |
|
4201 |
||
4202 |
# Unlock the critical section if it was locked
|
|
4203 |
if test no != "$need_locks"; then |
|
4204 |
removelist=$lockfile |
|
4205 |
$RM "$lockfile" |
|
4206 |
fi
|
|
4207 |
}
|
|
4208 |
||
4209 |
exit $EXIT_SUCCESS |
|
4210 |
}
|
|
4211 |
||
4212 |
$opt_help || { |
|
4213 |
test compile = "$opt_mode" && func_mode_compile ${1+"$@"} |
|
4214 |
}
|
|
4215 |
||
4216 |
func_mode_help ()
|
|
4217 |
{
|
|
4218 |
# We need to display help for each of the modes.
|
|
4219 |
case $opt_mode in |
|
4220 |
"") |
|
4221 |
# Generic help is extracted from the usage comments
|
|
4222 |
# at the start of this file.
|
|
4223 |
func_help |
|
4224 |
;;
|
|
4225 |
||
4226 |
clean)
|
|
4227 |
$ECHO \ |
|
4228 |
"Usage: $progname [OPTION]... --mode=clean RM [RM-OPTION]... FILE... |
|
4229 |
||
4230 |
Remove files from the build directory.
|
|
4231 |
||
4232 |
RM is the name of the program to use to delete files associated with each FILE
|
|
4233 |
(typically '/bin/rm'). RM-OPTIONS are options (such as '-f') to be passed
|
|
4234 |
to RM.
|
|
4235 |
||
4236 |
If FILE is a libtool library, object or program, all the files associated
|
|
4237 |
with it are deleted. Otherwise, only FILE itself is deleted using RM."
|
|
4238 |
;;
|
|
4239 |
||
4240 |
compile)
|
|
4241 |
$ECHO \ |
|
4242 |
"Usage: $progname [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE |
|
4243 |
||
4244 |
Compile a source file into a libtool library object.
|
|
4245 |
||
4246 |
This mode accepts the following additional options:
|
|
4247 |
||
4248 |
-o OUTPUT-FILE set the output file name to OUTPUT-FILE
|
|
4249 |
-no-suppress do not suppress compiler output for multiple passes
|
|
4250 |
-prefer-pic try to build PIC objects only
|
|
4251 |
-prefer-non-pic try to build non-PIC objects only
|
|
4252 |
-shared do not build a '.o' file suitable for static linking
|
|
4253 |
-static only build a '.o' file suitable for static linking
|
|
4254 |
-Wc,FLAG pass FLAG directly to the compiler
|
|
4255 |
||
4256 |
COMPILE-COMMAND is a command to be used in creating a 'standard' object file
|
|
4257 |
from the given SOURCEFILE.
|
|
4258 |
||
4259 |
The output file name is determined by removing the directory component from
|
|
4260 |
SOURCEFILE, then substituting the C source code suffix '.c' with the
|
|
4261 |
library object suffix, '.lo'."
|
|
4262 |
;;
|
|
4263 |
||
4264 |
execute)
|
|
4265 |
$ECHO \ |
|
4266 |
"Usage: $progname [OPTION]... --mode=execute COMMAND [ARGS]... |
|
4267 |
||
4268 |
Automatically set library path, then run a program.
|
|
4269 |
||
4270 |
This mode accepts the following additional options:
|
|
4271 |
||
4272 |
-dlopen FILE add the directory containing FILE to the library path
|
|
4273 |
||
4274 |
This mode sets the library path environment variable according to '-dlopen'
|
|
4275 |
flags.
|
|
4276 |
||
4277 |
If any of the ARGS are libtool executable wrappers, then they are translated
|
|
4278 |
into their corresponding uninstalled binary, and any of their required library
|
|
4279 |
directories are added to the library path.
|
|
4280 |
||
4281 |
Then, COMMAND is executed, with ARGS as arguments."
|
|
4282 |
;;
|
|
4283 |
||
4284 |
finish)
|
|
4285 |
$ECHO \ |
|
4286 |
"Usage: $progname [OPTION]... --mode=finish [LIBDIR]... |
|
4287 |
||
4288 |
Complete the installation of libtool libraries.
|
|
4289 |
||
4290 |
Each LIBDIR is a directory that contains libtool libraries.
|
|
4291 |
||
4292 |
The commands that this mode executes may require superuser privileges. Use
|
|
4293 |
the '--dry-run' option if you just want to see what would be executed."
|
|
4294 |
;;
|
|
4295 |
||
4296 |
install)
|
|
4297 |
$ECHO \ |
|
4298 |
"Usage: $progname [OPTION]... --mode=install INSTALL-COMMAND... |
|
4299 |
||
4300 |
Install executables or libraries.
|
|
4301 |
||
4302 |
INSTALL-COMMAND is the installation command. The first component should be
|
|
4303 |
either the 'install' or 'cp' program.
|
|
4304 |
||
4305 |
The following components of INSTALL-COMMAND are treated specially:
|
|
4306 |
||
4307 |
-inst-prefix-dir PREFIX-DIR Use PREFIX-DIR as a staging area for installation
|
|
4308 |
||
4309 |
The rest of the components are interpreted as arguments to that command (only
|
|
4310 |
BSD-compatible install options are recognized)."
|
|
4311 |
;;
|
|
4312 |
||
4313 |
link)
|
|
4314 |
$ECHO \ |
|
4315 |
"Usage: $progname [OPTION]... --mode=link LINK-COMMAND... |
|
4316 |
||
4317 |
Link object files or libraries together to form another library, or to
|
|
4318 |
create an executable program.
|
|
4319 |
||
4320 |
LINK-COMMAND is a command using the C compiler that you would use to create
|
|
4321 |
a program from several object files.
|
|
4322 |
||
4323 |
The following components of LINK-COMMAND are treated specially:
|
|
4324 |
||
4325 |
-all-static do not do any dynamic linking at all
|
|
4326 |
-avoid-version do not add a version suffix if possible
|
|
4327 |
-bindir BINDIR specify path to binaries directory (for systems where
|
|
4328 |
libraries must be found in the PATH setting at runtime)
|
|
4329 |
-dlopen FILE '-dlpreopen' FILE if it cannot be dlopened at runtime
|
|
4330 |
-dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols
|
|
4331 |
-export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
|
|
4332 |
-export-symbols SYMFILE
|
|
4333 |
try to export only the symbols listed in SYMFILE
|
|
4334 |
-export-symbols-regex REGEX
|
|
4335 |
try to export only the symbols matching REGEX
|
|
4336 |
-LLIBDIR search LIBDIR for required installed libraries
|
|
4337 |
-lNAME OUTPUT-FILE requires the installed library libNAME
|
|
4338 |
-module build a library that can dlopened
|
|
4339 |
-no-fast-install disable the fast-install mode
|
|
4340 |
-no-install link a not-installable executable
|
|
4341 |
-no-undefined declare that a library does not refer to external symbols
|
|
4342 |
-o OUTPUT-FILE create OUTPUT-FILE from the specified objects
|
|
4343 |
-objectlist FILE use a list of object files found in FILE to specify objects
|
|
4344 |
-os2dllname NAME force a short DLL name on OS/2 (no effect on other OSes)
|
|
4345 |
-precious-files-regex REGEX
|
|
4346 |
don't remove output files matching REGEX
|
|
4347 |
-release RELEASE specify package release information
|
|
4348 |
-rpath LIBDIR the created library will eventually be installed in LIBDIR
|
|
4349 |
-R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries
|
|
4350 |
-shared only do dynamic linking of libtool libraries
|
|
4351 |
-shrext SUFFIX override the standard shared library file extension
|
|
4352 |
-static do not do any dynamic linking of uninstalled libtool libraries
|
|
4353 |
-static-libtool-libs
|
|
4354 |
do not do any dynamic linking of libtool libraries
|
|
4355 |
-version-info CURRENT[:REVISION[:AGE]]
|
|
4356 |
specify library version info [each variable defaults to 0]
|
|
4357 |
-weak LIBNAME declare that the target provides the LIBNAME interface
|
|
4358 |
-Wc,FLAG
|
|
4359 |
-Xcompiler FLAG pass linker-specific FLAG directly to the compiler
|
|
4360 |
-Wl,FLAG
|
|
4361 |
-Xlinker FLAG pass linker-specific FLAG directly to the linker
|
|
4362 |
-XCClinker FLAG pass link-specific FLAG to the compiler driver (CC)
|
|
4363 |
||
4364 |
All other options (arguments beginning with '-') are ignored.
|
|
4365 |
||
4366 |
Every other argument is treated as a filename. Files ending in '.la' are
|
|
4367 |
treated as uninstalled libtool libraries, other files are standard or library
|
|
4368 |
object files.
|
|
4369 |
||
4370 |
If the OUTPUT-FILE ends in '.la', then a libtool library is created,
|
|
4371 |
only library objects ('.lo' files) may be specified, and '-rpath' is
|
|
4372 |
required, except when creating a convenience library.
|
|
4373 |
||
4374 |
If OUTPUT-FILE ends in '.a' or '.lib', then a standard library is created
|
|
4375 |
using 'ar' and 'ranlib', or on Windows using 'lib'.
|
|
4376 |
||
4377 |
If OUTPUT-FILE ends in '.lo' or '.$objext', then a reloadable object file |
|
4378 |
is created, otherwise an executable program is created."
|
|
4379 |
;;
|
|
4380 |
||
4381 |
uninstall)
|
|
4382 |
$ECHO \ |
|
4383 |
"Usage: $progname [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE... |
|
4384 |
||
4385 |
Remove libraries from an installation directory.
|
|
4386 |
||
4387 |
RM is the name of the program to use to delete files associated with each FILE
|
|
4388 |
(typically '/bin/rm'). RM-OPTIONS are options (such as '-f') to be passed
|
|
4389 |
to RM.
|
|
4390 |
||
4391 |
If FILE is a libtool library, all the files associated with it are deleted.
|
|
4392 |
Otherwise, only FILE itself is deleted using RM."
|
|
4393 |
;;
|
|
4394 |
||
4395 |
*)
|
|
4396 |
func_fatal_help "invalid operation mode '$opt_mode'" |
|
4397 |
;;
|
|
4398 |
esac
|
|
4399 |
||
4400 |
echo
|
|
4401 |
$ECHO "Try '$progname --help' for more information about other modes." |
|
4402 |
}
|
|
4403 |
||
4404 |
# Now that we've collected a possible --mode arg, show help if necessary
|
|
4405 |
if $opt_help; then |
|
4406 |
if test : = "$opt_help"; then |
|
4407 |
func_mode_help |
|
4408 |
else
|
|
4409 |
{
|
|
4410 |
func_help noexit |
|
4411 |
for opt_mode in compile link execute install finish uninstall clean; do |
|
4412 |
func_mode_help |
|
4413 |
done
|
|
4414 |
} | $SED -n '1p; 2,$s/^Usage:/ or: /p' |
|
4415 |
{
|
|
4416 |
func_help noexit |
|
4417 |
for opt_mode in compile link execute install finish uninstall clean; do |
|
4418 |
echo
|
|
4419 |
func_mode_help |
|
4420 |
done
|
|
4421 |
} | |
|
4422 |
$SED '1d |
|
4423 |
/^When reporting/,/^Report/{
|
|
4424 |
H
|
|
4425 |
d
|
|
4426 |
}
|
|
4427 |
$x
|
|
4428 |
/information about other modes/d
|
|
4429 |
/more detailed .*MODE/d
|
|
4430 |
s/^Usage:.*--mode=\([^ ]*\) .*/Description of \1 mode:/'
|
|
4431 |
fi
|
|
4432 |
exit $? |
|
4433 |
fi
|
|
4434 |
||
4435 |
||
4436 |
# func_mode_execute arg...
|
|
4437 |
func_mode_execute ()
|
|
4438 |
{
|
|
4439 |
$debug_cmd
|
|
4440 |
||
4441 |
# The first argument is the command name.
|
|
4442 |
cmd=$nonopt |
|
4443 |
test -z "$cmd" && \ |
|
4444 |
func_fatal_help "you must specify a COMMAND"
|
|
4445 |
||
4446 |
# Handle -dlopen flags immediately.
|
|
4447 |
for file in $opt_dlopen; do |
|
4448 |
test -f "$file" \ |
|
4449 |
|| func_fatal_help "'$file' is not a file" |
|
4450 |
||
4451 |
dir= |
|
4452 |
case $file in |
|
4453 |
*.la)
|
|
4454 |
func_resolve_sysroot "$file" |
|
4455 |
file=$func_resolve_sysroot_result |
|
4456 |
||
4457 |
# Check to see that this really is a libtool archive.
|
|
4458 |
func_lalib_unsafe_p "$file" \ |
|
4459 |
|| func_fatal_help "'$lib' is not a valid libtool archive" |
|
4460 |
||
4461 |
# Read the libtool library.
|
|
4462 |
dlname= |
|
4463 |
library_names= |
|
4464 |
func_source "$file" |
|
4465 |
||
4466 |
# Skip this library if it cannot be dlopened.
|
|
4467 |
if test -z "$dlname"; then |
|
4468 |
# Warn if it was a shared library.
|
|
4469 |
test -n "$library_names" && \ |
|
4470 |
func_warning "'$file' was not linked with '-export-dynamic'" |
|
4471 |
continue
|
|
4472 |
fi
|
|
4473 |
||
4474 |
func_dirname "$file" "" "." |
|
4475 |
dir=$func_dirname_result |
|
4476 |
||
4477 |
if test -f "$dir/$objdir/$dlname"; then |
|
4478 |
func_append dir "/$objdir" |
|
4479 |
else
|
|
4480 |
if test ! -f "$dir/$dlname"; then |
|
4481 |
func_fatal_error "cannot find '$dlname' in '$dir' or '$dir/$objdir'" |
|
4482 |
fi
|
|
4483 |
fi
|
|
4484 |
;;
|
|
4485 |
||
4486 |
*.lo)
|
|
4487 |
# Just add the directory containing the .lo file.
|
|
4488 |
func_dirname "$file" "" "." |
|
4489 |
dir=$func_dirname_result |
|
4490 |
;;
|
|
4491 |
||
4492 |
*)
|
|
4493 |
func_warning "'-dlopen' is ignored for non-libtool libraries and objects"
|
|
4494 |
continue
|
|
4495 |
;;
|
|
4496 |
esac
|
|
4497 |
||
4498 |
# Get the absolute pathname.
|
|
4499 |
absdir=`cd "$dir" && pwd` |
|
4500 |
test -n "$absdir" && dir=$absdir |
|
4501 |
||
4502 |
# Now add the directory to shlibpath_var.
|
|
4503 |
if eval "test -z \"\$$shlibpath_var\""; then |
|
4504 |
eval "$shlibpath_var=\"\$dir\"" |
|
4505 |
else
|
|
4506 |
eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\"" |
|
4507 |
fi
|
|
4508 |
done
|
|
4509 |
||
4510 |
# This variable tells wrapper scripts just to set shlibpath_var
|
|
4511 |
# rather than running their programs.
|
|
4512 |
libtool_execute_magic=$magic |
|
4513 |
||
4514 |
# Check if any of the arguments is a wrapper script.
|
|
4515 |
args= |
|
4516 |
for file
|
|
4517 |
do
|
|
4518 |
case $file in |
|
4519 |
-* | *.la | *.lo ) ;; |
|
4520 |
*)
|
|
4521 |
# Do a test to see if this is really a libtool program.
|
|
4522 |
if func_ltwrapper_script_p "$file"; then |
|
4523 |
func_source "$file" |
|
4524 |
# Transform arg to wrapped name.
|
|
4525 |
file=$progdir/$program |
|
4526 |
elif func_ltwrapper_executable_p "$file"; then |
|
4527 |
func_ltwrapper_scriptname "$file" |
|
4528 |
func_source "$func_ltwrapper_scriptname_result" |
|
4529 |
# Transform arg to wrapped name.
|
|
4530 |
file=$progdir/$program |
|
4531 |
fi
|
|
4532 |
;;
|
|
4533 |
esac
|
|
4534 |
# Quote arguments (to preserve shell metacharacters).
|
|
4535 |
func_append_quoted args "$file" |
|
4536 |
done
|
|
4537 |
||
4538 |
if $opt_dry_run; then |
|
4539 |
# Display what would be done.
|
|
4540 |
if test -n "$shlibpath_var"; then |
|
4541 |
eval "\$ECHO \"\$shlibpath_var=\$$shlibpath_var\"" |
|
4542 |
echo "export $shlibpath_var" |
|
4543 |
fi
|
|
4544 |
$ECHO "$cmd$args" |
|
4545 |
exit $EXIT_SUCCESS |
|
4546 |
else
|
|
4547 |
if test -n "$shlibpath_var"; then |
|
4548 |
# Export the shlibpath_var.
|
|
4549 |
eval "export $shlibpath_var" |
|
4550 |
fi
|
|
4551 |
||
4552 |
# Restore saved environment variables
|
|
4553 |
for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
|
|
4554 |
do
|
|
4555 |
eval "if test \"\${save_$lt_var+set}\" = set; then |
|
4556 |
$lt_var=\$save_$lt_var; export $lt_var |
|
4557 |
else
|
|
4558 |
$lt_unset $lt_var |
|
4559 |
fi"
|
|
4560 |
done
|
|
4561 |
||
4562 |
# Now prepare to actually exec the command.
|
|
4563 |
exec_cmd=\$cmd$args |
|
4564 |
fi
|
|
4565 |
}
|
|
4566 |
||
4567 |
test execute = "$opt_mode" && func_mode_execute ${1+"$@"} |
|
4568 |
||
4569 |
||
4570 |
# func_mode_finish arg...
|
|
4571 |
func_mode_finish ()
|
|
4572 |
{
|
|
4573 |
$debug_cmd
|
|
4574 |
||
4575 |
libs= |
|
4576 |
libdirs= |
|
4577 |
admincmds= |
|
4578 |
||
4579 |
for opt in "$nonopt" ${1+"$@"} |
|
4580 |
do
|
|
4581 |
if test -d "$opt"; then |
|
4582 |
func_append libdirs " $opt" |
|
4583 |
||
4584 |
elif test -f "$opt"; then |
|
4585 |
if func_lalib_unsafe_p "$opt"; then |
|
4586 |
func_append libs " $opt" |
|
4587 |
else
|
|
4588 |
func_warning "'$opt' is not a valid libtool archive" |
|
4589 |
fi
|
|
4590 |
||
4591 |
else
|
|
4592 |
func_fatal_error "invalid argument '$opt'" |
|
4593 |
fi
|
|
4594 |
done
|
|
4595 |
||
4596 |
if test -n "$libs"; then |
|
4597 |
if test -n "$lt_sysroot"; then |
|
4598 |
sysroot_regex=`$ECHO "$lt_sysroot" | $SED "$sed_make_literal_regex"` |
|
4599 |
sysroot_cmd="s/\([ ']\)$sysroot_regex/\1/g;" |
|
4600 |
else
|
|
4601 |
sysroot_cmd= |
|
4602 |
fi
|
|
4603 |
||
4604 |
# Remove sysroot references
|
|
4605 |
if $opt_dry_run; then |
|
4606 |
for lib in $libs; do |
|
4607 |
echo "removing references to $lt_sysroot and '=' prefixes from $lib" |
|
4608 |
done
|
|
4609 |
else
|
|
4610 |
tmpdir=`func_mktempdir` |
|
4611 |
for lib in $libs; do |
|
4612 |
$SED -e "$sysroot_cmd s/\([ ']-[LR]\)=/\1/g; s/\([ ']\)=/\1/g" $lib \ |
|
4613 |
> $tmpdir/tmp-la
|
|
4614 |
mv -f $tmpdir/tmp-la $lib |
|
4615 |
done
|
|
4616 |
${RM}r "$tmpdir" |
|
4617 |
fi
|
|
4618 |
fi
|
|
4619 |
||
4620 |
if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then |
|
4621 |
for libdir in $libdirs; do |
|
4622 |
if test -n "$finish_cmds"; then |
|
4623 |
# Do each command in the finish commands.
|
|
4624 |
func_execute_cmds "$finish_cmds" 'admincmds="$admincmds |
|
4625 |
'"$cmd"'"' |
|
4626 |
fi
|
|
4627 |
if test -n "$finish_eval"; then |
|
4628 |
# Do the single finish_eval.
|
|
4629 |
eval cmds=\"$finish_eval\" |
|
4630 |
$opt_dry_run || eval "$cmds" || func_append admincmds " |
|
4631 |
$cmds" |
|
4632 |
fi
|
|
4633 |
done
|
|
4634 |
fi
|
|
4635 |
||
4636 |
# Exit here if they wanted silent mode.
|
|
4637 |
$opt_quiet && exit $EXIT_SUCCESS |
|
4638 |
||
4639 |
if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then |
|
4640 |
echo "----------------------------------------------------------------------" |
|
4641 |
echo "Libraries have been installed in:" |
|
4642 |
for libdir in $libdirs; do |
|
4643 |
$ECHO " $libdir" |
|
4644 |
done
|
|
4645 |
echo
|
|
4646 |
echo "If you ever happen to want to link against installed libraries" |
|
4647 |
echo "in a given directory, LIBDIR, you must either use libtool, and" |
|
4648 |
echo "specify the full pathname of the library, or use the '-LLIBDIR'" |
|
4649 |
echo "flag during linking and do at least one of the following:" |
|
4650 |
if test -n "$shlibpath_var"; then |
|
4651 |
echo " - add LIBDIR to the '$shlibpath_var' environment variable" |
|
4652 |
echo " during execution" |
|
4653 |
fi
|
|
4654 |
if test -n "$runpath_var"; then |
|
4655 |
echo " - add LIBDIR to the '$runpath_var' environment variable" |
|
4656 |
echo " during linking" |
|
4657 |
fi
|
|
4658 |
if test -n "$hardcode_libdir_flag_spec"; then |
|
4659 |
libdir=LIBDIR |
|
4660 |
eval flag=\"$hardcode_libdir_flag_spec\" |
|
4661 |
||
4662 |
$ECHO " - use the '$flag' linker flag" |
|
4663 |
fi
|
|
4664 |
if test -n "$admincmds"; then |
|
4665 |
$ECHO " - have your system administrator run these commands:$admincmds" |
|
4666 |
fi
|
|
4667 |
if test -f /etc/ld.so.conf; then |
|
4668 |
echo " - have your system administrator add LIBDIR to '/etc/ld.so.conf'" |
|
4669 |
fi
|
|
4670 |
echo
|
|
4671 |
||
4672 |
echo "See any operating system documentation about shared libraries for" |
|
4673 |
case $host in |
|
4674 |
solaris2.[6789]|solaris2.1[0-9]) |
|
4675 |
echo "more information, such as the ld(1), crle(1) and ld.so(8) manual" |
|
4676 |
echo "pages." |
|
4677 |
;;
|
|
4678 |
*)
|
|
4679 |
echo "more information, such as the ld(1) and ld.so(8) manual pages." |
|
4680 |
;;
|
|
4681 |
esac
|
|
4682 |
echo "----------------------------------------------------------------------" |
|
4683 |
fi
|
|
4684 |
exit $EXIT_SUCCESS |
|
4685 |
}
|
|
4686 |
||
4687 |
test finish = "$opt_mode" && func_mode_finish ${1+"$@"} |
|
4688 |
||
4689 |
||
4690 |
# func_mode_install arg...
|
|
4691 |
func_mode_install ()
|
|
4692 |
{
|
|
4693 |
$debug_cmd
|
|
4694 |
||
4695 |
# There may be an optional sh(1) argument at the beginning of
|
|
4696 |
# install_prog (especially on Windows NT).
|
|
4697 |
if test "$SHELL" = "$nonopt" || test /bin/sh = "$nonopt" || |
|
4698 |
# Allow the use of GNU shtool's install command.
|
|
4699 |
case $nonopt in *shtool*) :;; *) false;; esac |
|
4700 |
then
|
|
4701 |
# Aesthetically quote it.
|
|
4702 |
func_quote_for_eval "$nonopt" |
|
4703 |
install_prog="$func_quote_for_eval_result " |
|
4704 |
arg=$1 |
|
4705 |
shift
|
|
4706 |
else
|
|
4707 |
install_prog= |
|
4708 |
arg=$nonopt |
|
4709 |
fi
|
|
4710 |
||
4711 |
# The real first argument should be the name of the installation program.
|
|
4712 |
# Aesthetically quote it.
|
|
4713 |
func_quote_for_eval "$arg" |
|
4714 |
func_append install_prog "$func_quote_for_eval_result" |
|
4715 |
install_shared_prog=$install_prog |
|
4716 |
case " $install_prog " in |
|
4717 |
*[\\\ /]cp\ *) install_cp=: ;; |
|
4718 |
*) install_cp=false ;; |
|
4719 |
esac
|
|
4720 |
||
4721 |
# We need to accept at least all the BSD install flags.
|
|
4722 |
dest= |
|
4723 |
files= |
|
4724 |
opts= |
|
4725 |
prev= |
|
4726 |
install_type= |
|
4727 |
isdir=false |
|
4728 |
stripme= |
|
4729 |
no_mode=: |
|
4730 |
for arg
|
|
4731 |
do
|
|
4732 |
arg2= |
|
4733 |
if test -n "$dest"; then |
|
4734 |
func_append files " $dest" |
|
4735 |
dest=$arg |
|
4736 |
continue
|
|
4737 |
fi
|
|
4738 |
||
4739 |
case $arg in |
|
4740 |
-d) isdir=: ;; |
|
4741 |
-f)
|
|
4742 |
if $install_cp; then :; else |
|
4743 |
prev=$arg |
|
4744 |
fi
|
|
4745 |
;;
|
|
4746 |
-g | -m | -o) |
|
4747 |
prev=$arg |
|
4748 |
;;
|
|
4749 |
-s)
|
|
4750 |
stripme=" -s" |
|
4751 |
continue
|
|
4752 |
;;
|
|
4753 |
-*)
|
|
4754 |
;;
|
|
4755 |
*)
|
|
4756 |
# If the previous option needed an argument, then skip it.
|
|
4757 |
if test -n "$prev"; then |
|
4758 |
if test X-m = "X$prev" && test -n "$install_override_mode"; then |
|
4759 |
arg2=$install_override_mode |
|
4760 |
no_mode=false |
|
4761 |
fi
|
|
4762 |
prev= |
|
4763 |
else
|
|
4764 |
dest=$arg |
|
4765 |
continue
|
|
4766 |
fi
|
|
4767 |
;;
|
|
4768 |
esac
|
|
4769 |
||
4770 |
# Aesthetically quote the argument.
|
|
4771 |
func_quote_for_eval "$arg" |
|
4772 |
func_append install_prog " $func_quote_for_eval_result" |
|
4773 |
if test -n "$arg2"; then |
|
4774 |
func_quote_for_eval "$arg2" |
|
4775 |
fi
|
|
4776 |
func_append install_shared_prog " $func_quote_for_eval_result" |
|
4777 |
done
|
|
4778 |
||
4779 |
test -z "$install_prog" && \ |
|
4780 |
func_fatal_help "you must specify an install program"
|
|
4781 |
||
4782 |
test -n "$prev" && \ |
|
4783 |
func_fatal_help "the '$prev' option requires an argument" |
|
4784 |
||
4785 |
if test -n "$install_override_mode" && $no_mode; then |
|
4786 |
if $install_cp; then :; else |
|
4787 |
func_quote_for_eval "$install_override_mode" |
|
4788 |
func_append install_shared_prog " -m $func_quote_for_eval_result" |
|
4789 |
fi
|
|
4790 |
fi
|
|
4791 |
||
4792 |
if test -z "$files"; then |
|
4793 |
if test -z "$dest"; then |
|
4794 |
func_fatal_help "no file or destination specified"
|
|
4795 |
else
|
|
4796 |
func_fatal_help "you must specify a destination"
|
|
4797 |
fi
|
|
4798 |
fi
|
|
4799 |
||
4800 |
# Strip any trailing slash from the destination.
|
|
4801 |
func_stripname '' '/' "$dest" |
|
4802 |
dest=$func_stripname_result |
|
4803 |
||
4804 |
# Check to see that the destination is a directory.
|
|
4805 |
test -d "$dest" && isdir=: |
|
4806 |
if $isdir; then |
|
4807 |
destdir=$dest |
|
4808 |
destname= |
|
4809 |
else
|
|
4810 |
func_dirname_and_basename "$dest" "" "." |
|
4811 |
destdir=$func_dirname_result |
|
4812 |
destname=$func_basename_result |
|
4813 |
||
4814 |
# Not a directory, so check to see that there is only one file specified.
|
|
4815 |
set dummy $files; shift |
|
4816 |
test "$#" -gt 1 && \ |
|
4817 |
func_fatal_help "'$dest' is not a directory" |
|
4818 |
fi
|
|
4819 |
case $destdir in |
|
4820 |
[\\/]* | [A-Za-z]:[\\/]*) ;; |
|
4821 |
*)
|
|
4822 |
for file in $files; do |
|
4823 |
case $file in |
|
4824 |
*.lo) ;; |
|
4825 |
*)
|
|
4826 |
func_fatal_help "'$destdir' must be an absolute directory name" |
|
4827 |
;;
|
|
4828 |
esac
|
|
4829 |
done
|
|
4830 |
;;
|
|
4831 |
esac
|
|
4832 |
||
4833 |
# This variable tells wrapper scripts just to set variables rather
|
|
4834 |
# than running their programs.
|
|
4835 |
libtool_install_magic=$magic |
|
4836 |
||
4837 |
staticlibs= |
|
4838 |
future_libdirs= |
|
4839 |
current_libdirs= |
|
4840 |
for file in $files; do |
|
4841 |
||
4842 |
# Do each installation.
|
|
4843 |
case $file in |
|
4844 |
*.$libext) |
|
4845 |
# Do the static libraries later.
|
|
4846 |
func_append staticlibs " $file" |
|
4847 |
;;
|
|
4848 |
||
4849 |
*.la)
|
|
4850 |
func_resolve_sysroot "$file" |
|
4851 |
file=$func_resolve_sysroot_result |
|
4852 |
||
4853 |
# Check to see that this really is a libtool archive.
|
|
4854 |
func_lalib_unsafe_p "$file" \ |
|
4855 |
|| func_fatal_help "'$file' is not a valid libtool archive" |
|
4856 |
||
4857 |
library_names= |
|
4858 |
old_library= |
|
4859 |
relink_command= |
|
4860 |
func_source "$file" |
|
4861 |
||
4862 |
# Add the libdir to current_libdirs if it is the destination.
|
|
4863 |
if test "X$destdir" = "X$libdir"; then |
|
4864 |
case "$current_libdirs " in |
|
4865 |
*" $libdir "*) ;; |
|
4866 |
*) func_append current_libdirs " $libdir" ;; |
|
4867 |
esac
|
|
4868 |
else
|
|
4869 |
# Note the libdir as a future libdir.
|
|
4870 |
case "$future_libdirs " in |
|
4871 |
*" $libdir "*) ;; |
|
4872 |
*) func_append future_libdirs " $libdir" ;; |
|
4873 |
esac
|
|
4874 |
fi
|
|
4875 |
||
4876 |
func_dirname "$file" "/" "" |
|
4877 |
dir=$func_dirname_result |
|
4878 |
func_append dir "$objdir" |
|
4879 |
||
4880 |
if test -n "$relink_command"; then |
|
4881 |
# Determine the prefix the user has applied to our future dir.
|
|
4882 |
inst_prefix_dir=`$ECHO "$destdir" | $SED -e "s%$libdir\$%%"` |
|
4883 |
||
4884 |
# Don't allow the user to place us outside of our expected
|
|
4885 |
# location b/c this prevents finding dependent libraries that
|
|
4886 |
# are installed to the same prefix.
|
|
4887 |
# At present, this check doesn't affect windows .dll's that
|
|
4888 |
# are installed into $libdir/../bin (currently, that works fine)
|
|
4889 |
# but it's something to keep an eye on.
|
|
4890 |
test "$inst_prefix_dir" = "$destdir" && \ |
|
4891 |
func_fatal_error "error: cannot install '$file' to a directory not ending in $libdir" |
|
4892 |
||
4893 |
if test -n "$inst_prefix_dir"; then |
|
4894 |
# Stick the inst_prefix_dir data into the link command.
|
|
4895 |
relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"` |
|
4896 |
else
|
|
4897 |
relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%%"` |
|
4898 |
fi
|
|
4899 |
||
4900 |
func_warning "relinking '$file'" |
|
4901 |
func_show_eval "$relink_command" \ |
|
4902 |
'func_fatal_error "error: relink '\''$file'\'' with the above command before installing it"' |
|
4903 |
fi
|
|
4904 |
||
4905 |
# See the names of the shared library.
|
|
4906 |
set dummy $library_names; shift |
|
4907 |
if test -n "$1"; then |
|
4908 |
realname=$1 |
|
4909 |
shift
|
|
4910 |
||
4911 |
srcname=$realname |
|
4912 |
test -n "$relink_command" && srcname=${realname}T |
|
4913 |
||
4914 |
# Install the shared library and build the symlinks.
|
|
4915 |
func_show_eval "$install_shared_prog $dir/$srcname $destdir/$realname" \ |
|
4916 |
'exit $?'
|
|
4917 |
tstripme=$stripme |
|
4918 |
case $host_os in |
|
4919 |
cygwin* | mingw* | pw32* | cegcc*) |
|
4920 |
case $realname in |
|
4921 |
*.dll.a)
|
|
4922 |
tstripme= |
|
4923 |
;;
|
|
4924 |
esac
|
|
4925 |
;;
|
|
4926 |
os2*)
|
|
4927 |
case $realname in |
|
4928 |
*_dll.a)
|
|
4929 |
tstripme= |
|
4930 |
;;
|
|
4931 |
esac
|
|
4932 |
;;
|
|
4933 |
esac
|
|
4934 |
if test -n "$tstripme" && test -n "$striplib"; then |
|
4935 |
func_show_eval "$striplib $destdir/$realname" 'exit $?' |
|
4936 |
fi
|
|
4937 |
||
4938 |
if test "$#" -gt 0; then |
|
4939 |
# Delete the old symlinks, and create new ones.
|
|
4940 |
# Try 'ln -sf' first, because the 'ln' binary might depend on
|
|
4941 |
# the symlink we replace! Solaris /bin/ln does not understand -f,
|
|
4942 |
# so we also need to try rm && ln -s.
|
|
4943 |
for linkname
|
|
4944 |
do
|
|
4945 |
test "$linkname" != "$realname" \ |
|
4946 |
&& func_show_eval "(cd $destdir && { $LN_S -f $realname $linkname || { $RM $linkname && $LN_S $realname $linkname; }; })" |
|
4947 |
done
|
|
4948 |
fi
|
|
4949 |
||
4950 |
# Do each command in the postinstall commands.
|
|
4951 |
lib=$destdir/$realname |
|
4952 |
func_execute_cmds "$postinstall_cmds" 'exit $?' |
|
4953 |
fi
|
|
4954 |
||
4955 |
# Install the pseudo-library for information purposes.
|
|
4956 |
func_basename "$file" |
|
4957 |
name=$func_basename_result |
|
4958 |
instname=$dir/${name}i |
|
4959 |
func_show_eval "$install_prog $instname $destdir/$name" 'exit $?' |
|
4960 |
||
4961 |
# Maybe install the static library, too.
|
|
4962 |
test -n "$old_library" && func_append staticlibs " $dir/$old_library" |
|
4963 |
;;
|
|
4964 |
||
4965 |
*.lo)
|
|
4966 |
# Install (i.e. copy) a libtool object.
|
|
4967 |
||
4968 |
# Figure out destination file name, if it wasn't already specified.
|
|
4969 |
if test -n "$destname"; then |
|
4970 |
destfile=$destdir/$destname |
|
4971 |
else
|
|
4972 |
func_basename "$file" |
|
4973 |
destfile=$func_basename_result |
|
4974 |
destfile=$destdir/$destfile |
|
4975 |
fi
|
|
4976 |
||
4977 |
# Deduce the name of the destination old-style object file.
|
|
4978 |
case $destfile in |
|
4979 |
*.lo)
|
|
4980 |
func_lo2o "$destfile" |
|
4981 |
staticdest=$func_lo2o_result |
|
4982 |
;;
|
|
4983 |
*.$objext) |
|
4984 |
staticdest=$destfile |
|
4985 |
destfile= |
|
4986 |
;;
|
|
4987 |
*)
|
|
4988 |
func_fatal_help "cannot copy a libtool object to '$destfile'" |
|
4989 |
;;
|
|
4990 |
esac
|
|
4991 |
||
4992 |
# Install the libtool object if requested.
|
|
4993 |
test -n "$destfile" && \ |
|
4994 |
func_show_eval "$install_prog $file $destfile" 'exit $?' |
|
4995 |
||
4996 |
# Install the old object if enabled.
|
|
4997 |
if test yes = "$build_old_libs"; then |
|
4998 |
# Deduce the name of the old-style object file.
|
|
4999 |
func_lo2o "$file" |
|
5000 |
staticobj=$func_lo2o_result |
|
5001 |
func_show_eval "$install_prog \$staticobj \$staticdest" 'exit $?' |
|
5002 |
fi
|
|
5003 |
exit $EXIT_SUCCESS |
|
5004 |
;;
|
|
5005 |
||
5006 |
*)
|
|
5007 |
# Figure out destination file name, if it wasn't already specified.
|
|
5008 |
if test -n "$destname"; then |
|
5009 |
destfile=$destdir/$destname |
|
5010 |
else
|
|
5011 |
func_basename "$file" |
|
5012 |
destfile=$func_basename_result |
|
5013 |
destfile=$destdir/$destfile |
|
5014 |
fi
|
|
5015 |
||
5016 |
# If the file is missing, and there is a .exe on the end, strip it
|
|
5017 |
# because it is most likely a libtool script we actually want to
|
|
5018 |
# install
|
|
5019 |
stripped_ext= |
|
5020 |
case $file in |
|
5021 |
*.exe)
|
|
5022 |
if test ! -f "$file"; then |
|
5023 |
func_stripname '' '.exe' "$file" |
|
5024 |
file=$func_stripname_result |
|
5025 |
stripped_ext=.exe |
|
5026 |
fi
|
|
5027 |
;;
|
|
5028 |
esac
|
|
5029 |
||
5030 |
# Do a test to see if this is really a libtool program.
|
|
5031 |
case $host in |
|
5032 |
*cygwin* | *mingw*) |
|
5033 |
if func_ltwrapper_executable_p "$file"; then |
|
5034 |
func_ltwrapper_scriptname "$file" |
|
5035 |
wrapper=$func_ltwrapper_scriptname_result |
|
5036 |
else
|
|
5037 |
func_stripname '' '.exe' "$file" |
|
5038 |
wrapper=$func_stripname_result |
|
5039 |
fi
|
|
5040 |
;;
|
|
5041 |
*)
|
|
5042 |
wrapper=$file |
|
5043 |
;;
|
|
5044 |
esac
|
|
5045 |
if func_ltwrapper_script_p "$wrapper"; then |
|
5046 |
notinst_deplibs= |
|
5047 |
relink_command= |
|
5048 |
||
5049 |
func_source "$wrapper" |
|
5050 |
||
5051 |
# Check the variables that should have been set.
|
|
5052 |
test -z "$generated_by_libtool_version" && \ |
|
5053 |
func_fatal_error "invalid libtool wrapper script '$wrapper'" |
|
5054 |
||
5055 |
finalize=: |
|
5056 |
for lib in $notinst_deplibs; do |
|
5057 |
# Check to see that each library is installed.
|
|
5058 |
libdir= |
|
5059 |
if test -f "$lib"; then |
|
5060 |
func_source "$lib" |
|
5061 |
fi
|
|
5062 |
libfile=$libdir/`$ECHO "$lib" | $SED 's%^.*/%%g'` |
|
5063 |
if test -n "$libdir" && test ! -f "$libfile"; then |
|
5064 |
func_warning "'$lib' has not been installed in '$libdir'" |
|
5065 |
finalize=false |
|
5066 |
fi
|
|
5067 |
done
|
|
5068 |
||
5069 |
relink_command= |
|
5070 |
func_source "$wrapper" |
|
5071 |
||
5072 |
outputname= |
|
5073 |
if test no = "$fast_install" && test -n "$relink_command"; then |
|
5074 |
$opt_dry_run || { |
|
5075 |
if $finalize; then |
|
5076 |
tmpdir=`func_mktempdir` |
|
5077 |
func_basename "$file$stripped_ext" |
|
5078 |
file=$func_basename_result |
|
5079 |
outputname=$tmpdir/$file |
|
5080 |
# Replace the output file specification.
|
|
5081 |
relink_command=`$ECHO "$relink_command" | $SED 's%@OUTPUT@%'"$outputname"'%g'` |
|
5082 |
||
5083 |
$opt_quiet || { |
|
5084 |
func_quote_for_expand "$relink_command" |
|
5085 |
eval "func_echo $func_quote_for_expand_result" |
|
5086 |
}
|
|
5087 |
if eval "$relink_command"; then : |
|
5088 |
else
|
|
5089 |
func_error "error: relink '$file' with the above command before installing it" |
|
5090 |
$opt_dry_run || ${RM}r "$tmpdir" |
|
5091 |
continue
|
|
5092 |
fi
|
|
5093 |
file=$outputname |
|
5094 |
else
|
|
5095 |
func_warning "cannot relink '$file'" |
|
5096 |
fi
|
|
5097 |
}
|
|
5098 |
else
|
|
5099 |
# Install the binary that we compiled earlier.
|
|
5100 |
file=`$ECHO "$file$stripped_ext" | $SED "s%\([^/]*\)$%$objdir/\1%"` |
|
5101 |
fi
|
|
5102 |
fi
|
|
5103 |
||
5104 |
# remove .exe since cygwin /usr/bin/install will append another
|
|
5105 |
# one anyway
|
|
5106 |
case $install_prog,$host in |
|
5107 |
*/usr/bin/install*,*cygwin*)
|
|
5108 |
case $file:$destfile in |
|
5109 |
*.exe:*.exe)
|
|
5110 |
# this is ok
|
|
5111 |
;;
|
|
5112 |
*.exe:*)
|
|
5113 |
destfile=$destfile.exe |
|
5114 |
;;
|
|
5115 |
*:*.exe)
|
|
5116 |
func_stripname '' '.exe' "$destfile" |
|
5117 |
destfile=$func_stripname_result |
|
5118 |
;;
|
|
5119 |
esac
|
|
5120 |
;;
|
|
5121 |
esac
|
|
5122 |
func_show_eval "$install_prog\$stripme \$file \$destfile" 'exit $?' |
|
5123 |
$opt_dry_run || if test -n "$outputname"; then |
|
5124 |
${RM}r "$tmpdir" |
|
5125 |
fi
|
|
5126 |
;;
|
|
5127 |
esac
|
|
5128 |
done
|
|
5129 |
||
5130 |
for file in $staticlibs; do |
|
5131 |
func_basename "$file" |
|
5132 |
name=$func_basename_result |
|
5133 |
||
5134 |
# Set up the ranlib parameters.
|
|
5135 |
oldlib=$destdir/$name |
|
5136 |
func_to_tool_file "$oldlib" func_convert_file_msys_to_w32 |
|
5137 |
tool_oldlib=$func_to_tool_file_result |
|
5138 |
||
5139 |
func_show_eval "$install_prog \$file \$oldlib" 'exit $?' |
|
5140 |
||
5141 |
if test -n "$stripme" && test -n "$old_striplib"; then |
|
5142 |
func_show_eval "$old_striplib $tool_oldlib" 'exit $?' |
|
5143 |
fi
|
|
5144 |
||
5145 |
# Do each command in the postinstall commands.
|
|
5146 |
func_execute_cmds "$old_postinstall_cmds" 'exit $?' |
|
5147 |
done
|
|
5148 |
||
5149 |
test -n "$future_libdirs" && \ |
|
5150 |
func_warning "remember to run '$progname --finish$future_libdirs'" |
|
5151 |
||
5152 |
if test -n "$current_libdirs"; then |
|
5153 |
# Maybe just do a dry run.
|
|
5154 |
$opt_dry_run && current_libdirs=" -n$current_libdirs" |
|
5155 |
exec_cmd='$SHELL "$progpath" $preserve_args --finish$current_libdirs' |
|
5156 |
else
|
|
5157 |
exit $EXIT_SUCCESS |
|
5158 |
fi
|
|
5159 |
}
|
|
5160 |
||
5161 |
test install = "$opt_mode" && func_mode_install ${1+"$@"} |
|
5162 |
||
5163 |
||
5164 |
# func_generate_dlsyms outputname originator pic_p
|
|
5165 |
# Extract symbols from dlprefiles and create ${outputname}S.o with
|
|
5166 |
# a dlpreopen symbol table.
|
|
5167 |
func_generate_dlsyms ()
|
|
5168 |
{
|
|
5169 |
$debug_cmd
|
|
5170 |
||
5171 |
my_outputname=$1 |
|
5172 |
my_originator=$2 |
|
5173 |
my_pic_p=${3-false} |
|
5174 |
my_prefix=`$ECHO "$my_originator" | $SED 's%[^a-zA-Z0-9]%_%g'` |
|
5175 |
my_dlsyms= |
|
5176 |
||
5177 |
if test -n "$dlfiles$dlprefiles" || test no != "$dlself"; then |
|
5178 |
if test -n "$NM" && test -n "$global_symbol_pipe"; then |
|
5179 |
my_dlsyms=${my_outputname}S.c |
|
5180 |
else
|
|
5181 |
func_error "not configured to extract global symbols from dlpreopened files"
|
|
5182 |
fi
|
|
5183 |
fi
|
|
5184 |
||
5185 |
if test -n "$my_dlsyms"; then |
|
5186 |
case $my_dlsyms in |
|
5187 |
"") ;; |
|
5188 |
*.c)
|
|
5189 |
# Discover the nlist of each of the dlfiles.
|
|
5190 |
nlist=$output_objdir/$my_outputname.nm |
|
5191 |
||
5192 |
func_show_eval "$RM $nlist ${nlist}S ${nlist}T" |
|
5193 |
||
5194 |
# Parse the name list into a source file.
|
|
5195 |
func_verbose "creating $output_objdir/$my_dlsyms" |
|
5196 |
||
5197 |
$opt_dry_run || $ECHO > "$output_objdir/$my_dlsyms" "\ |
|
5198 |
/* $my_dlsyms - symbol resolution table for '$my_outputname' dlsym emulation. */ |
|
5199 |
/* Generated by $PROGRAM (GNU $PACKAGE) $VERSION */ |
|
5200 |
||
5201 |
#ifdef __cplusplus
|
|
5202 |
extern \"C\" {
|
|
5203 |
#endif
|
|
5204 |
||
5205 |
#if defined __GNUC__ && (((__GNUC__ == 4) && (__GNUC_MINOR__ >= 4)) || (__GNUC__ > 4))
|
|
5206 |
#pragma GCC diagnostic ignored \"-Wstrict-prototypes\"
|
|
5207 |
#endif
|
|
5208 |
||
5209 |
/* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */
|
|
5210 |
#if defined _WIN32 || defined __CYGWIN__ || defined _WIN32_WCE
|
|
5211 |
/* DATA imports from DLLs on WIN32 can't be const, because runtime
|
|
5212 |
relocations are performed -- see ld's documentation on pseudo-relocs. */
|
|
5213 |
# define LT_DLSYM_CONST
|
|
5214 |
#elif defined __osf__
|
|
5215 |
/* This system does not cope well with relocations in const data. */
|
|
5216 |
# define LT_DLSYM_CONST
|
|
5217 |
#else
|
|
5218 |
# define LT_DLSYM_CONST const
|
|
5219 |
#endif
|
|
5220 |
||
5221 |
#define STREQ(s1, s2) (strcmp ((s1), (s2)) == 0)
|
|
5222 |
||
5223 |
/* External symbol declarations for the compiler. */\
|
|
5224 |
"
|
|
5225 |
||
5226 |
if test yes = "$dlself"; then |
|
5227 |
func_verbose "generating symbol list for '$output'" |
|
5228 |
||
5229 |
$opt_dry_run || echo ': @PROGRAM@ ' > "$nlist" |
|
5230 |
||
5231 |
# Add our own program objects to the symbol list.
|
|
5232 |
progfiles=`$ECHO "$objs$old_deplibs" | $SP2NL | $SED "$lo2o" | $NL2SP` |
|
5233 |
for progfile in $progfiles; do |
|
5234 |
func_to_tool_file "$progfile" func_convert_file_msys_to_w32 |
|
5235 |
func_verbose "extracting global C symbols from '$func_to_tool_file_result'" |
|
5236 |
$opt_dry_run || eval "$NM $func_to_tool_file_result | $global_symbol_pipe >> '$nlist'" |
|
5237 |
done
|
|
5238 |
||
5239 |
if test -n "$exclude_expsyms"; then |
|
5240 |
$opt_dry_run || { |
|
5241 |
eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T' |
|
5242 |
eval '$MV "$nlist"T "$nlist"' |
|
5243 |
}
|
|
5244 |
fi
|
|
5245 |
||
5246 |
if test -n "$export_symbols_regex"; then |
|
5247 |
$opt_dry_run || { |
|
5248 |
eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T' |
|
5249 |
eval '$MV "$nlist"T "$nlist"' |
|
5250 |
}
|
|
5251 |
fi
|
|
5252 |
||
5253 |
# Prepare the list of exported symbols
|
|
5254 |
if test -z "$export_symbols"; then |
|
5255 |
export_symbols=$output_objdir/$outputname.exp |
|
5256 |
$opt_dry_run || { |
|
5257 |
$RM $export_symbols |
|
5258 |
eval "$SED -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"' |
|
5259 |
case $host in |
|
5260 |
*cygwin* | *mingw* | *cegcc* ) |
|
5261 |
eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' |
|
5262 |
eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"' |
|
5263 |
;;
|
|
5264 |
esac
|
|
5265 |
}
|
|
5266 |
else
|
|
5267 |
$opt_dry_run || { |
|
5268 |
eval "$SED -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"' |
|
5269 |
eval '$GREP -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T' |
|
5270 |
eval '$MV "$nlist"T "$nlist"' |
|
5271 |
case $host in |
|
5272 |
*cygwin* | *mingw* | *cegcc* ) |
|
5273 |
eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' |
|
5274 |
eval 'cat "$nlist" >> "$output_objdir/$outputname.def"' |
|
5275 |
;;
|
|
5276 |
esac
|
|
5277 |
}
|
|
5278 |
fi
|
|
5279 |
fi
|
|
5280 |
||
5281 |
for dlprefile in $dlprefiles; do |
|
5282 |
func_verbose "extracting global C symbols from '$dlprefile'" |
|
5283 |
func_basename "$dlprefile" |
|
5284 |
name=$func_basename_result |
|
5285 |
case $host in |
|
5286 |
*cygwin* | *mingw* | *cegcc* ) |
|
5287 |
# if an import library, we need to obtain dlname
|
|
5288 |
if func_win32_import_lib_p "$dlprefile"; then |
|
5289 |
func_tr_sh "$dlprefile" |
|
5290 |
eval "curr_lafile=\$libfile_$func_tr_sh_result" |
|
5291 |
dlprefile_dlbasename= |
|
5292 |
if test -n "$curr_lafile" && func_lalib_p "$curr_lafile"; then |
|
5293 |
# Use subshell, to avoid clobbering current variable values
|
|
5294 |
dlprefile_dlname=`source "$curr_lafile" && echo "$dlname"` |
|
5295 |
if test -n "$dlprefile_dlname"; then |
|
5296 |
func_basename "$dlprefile_dlname" |
|
5297 |
dlprefile_dlbasename=$func_basename_result |
|
5298 |
else
|
|
5299 |
# no lafile. user explicitly requested -dlpreopen <import library>.
|
|
5300 |
$sharedlib_from_linklib_cmd "$dlprefile" |
|
5301 |
dlprefile_dlbasename=$sharedlib_from_linklib_result |
|
5302 |
fi
|
|
5303 |
fi
|
|
5304 |
$opt_dry_run || { |
|
5305 |
if test -n "$dlprefile_dlbasename"; then |
|
5306 |
eval '$ECHO ": $dlprefile_dlbasename" >> "$nlist"' |
|
5307 |
else
|
|
5308 |
func_warning "Could not compute DLL name from $name" |
|
5309 |
eval '$ECHO ": $name " >> "$nlist"' |
|
5310 |
fi
|
|
5311 |
func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32 |
|
5312 |
eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe | |
|
5313 |
$SED -e '/I __imp/d' -e 's/I __nm_/D /;s/_nm__//' >> '$nlist'" |
|
5314 |
}
|
|
5315 |
else # not an import lib |
|
5316 |
$opt_dry_run || { |
|
5317 |
eval '$ECHO ": $name " >> "$nlist"' |
|
5318 |
func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32 |
|
5319 |
eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'" |
|
5320 |
}
|
|
5321 |
fi
|
|
5322 |
;;
|
|
5323 |
*)
|
|
5324 |
$opt_dry_run || { |
|
5325 |
eval '$ECHO ": $name " >> "$nlist"' |
|
5326 |
func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32 |
|
5327 |
eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'" |
|
5328 |
}
|
|
5329 |
;;
|
|
5330 |
esac
|
|
5331 |
done
|
|
5332 |
||
5333 |
$opt_dry_run || { |
|
5334 |
# Make sure we have at least an empty file.
|
|
5335 |
test -f "$nlist" || : > "$nlist" |
|
5336 |
||
5337 |
if test -n "$exclude_expsyms"; then |
|
5338 |
$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T |
|
5339 |
$MV "$nlist"T "$nlist" |
|
5340 |
fi
|
|
5341 |
||
5342 |
# Try sorting and uniquifying the output.
|
|
5343 |
if $GREP -v "^: " < "$nlist" | |
|
5344 |
if sort -k 3 </dev/null >/dev/null 2>&1; then |
|
5345 |
sort -k 3
|
|
5346 |
else
|
|
5347 |
sort +2 |
|
5348 |
fi | |
|
5349 |
uniq > "$nlist"S; then |
|
5350 |
: |
|
5351 |
else
|
|
5352 |
$GREP -v "^: " < "$nlist" > "$nlist"S |
|
5353 |
fi
|
|
5354 |
||
5355 |
if test -f "$nlist"S; then |
|
5356 |
eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$my_dlsyms"' |
|
5357 |
else
|
|
5358 |
echo '/* NONE */' >> "$output_objdir/$my_dlsyms" |
|
5359 |
fi
|
|
5360 |
||
5361 |
func_show_eval '$RM "${nlist}I"'
|
|
5362 |
if test -n "$global_symbol_to_import"; then |
|
5363 |
eval "$global_symbol_to_import"' < "$nlist"S > "$nlist"I' |
|
5364 |
fi
|
|
5365 |
||
5366 |
echo >> "$output_objdir/$my_dlsyms" "\ |
|
5367 |
||
5368 |
/* The mapping between symbol names and symbols. */
|
|
5369 |
typedef struct {
|
|
5370 |
const char *name;
|
|
5371 |
void *address;
|
|
5372 |
} lt_dlsymlist;
|
|
5373 |
extern LT_DLSYM_CONST lt_dlsymlist
|
|
5374 |
lt_${my_prefix}_LTX_preloaded_symbols[];\ |
|
5375 |
"
|
|
5376 |
||
5377 |
if test -s "$nlist"I; then |
|
5378 |
echo >> "$output_objdir/$my_dlsyms" "\ |
|
5379 |
static void lt_syminit(void)
|
|
5380 |
{
|
|
5381 |
LT_DLSYM_CONST lt_dlsymlist *symbol = lt_${my_prefix}_LTX_preloaded_symbols; |
|
5382 |
for (; symbol->name; ++symbol)
|
|
5383 |
{"
|
|
5384 |
$SED 's/.*/ if (STREQ (symbol->name, \"&\")) symbol->address = (void *) \&&;/' < "$nlist"I >> "$output_objdir/$my_dlsyms" |
|
5385 |
echo >> "$output_objdir/$my_dlsyms" "\ |
|
5386 |
}
|
|
5387 |
}"
|
|
5388 |
fi
|
|
5389 |
echo >> "$output_objdir/$my_dlsyms" "\ |
|
5390 |
LT_DLSYM_CONST lt_dlsymlist
|
|
5391 |
lt_${my_prefix}_LTX_preloaded_symbols[] = |
|
5392 |
{ {\"$my_originator\", (void *) 0}," |
|
5393 |
||
5394 |
if test -s "$nlist"I; then |
|
5395 |
echo >> "$output_objdir/$my_dlsyms" "\ |
|
5396 |
{\"@INIT@\", (void *) <_syminit},"
|
|
5397 |
fi
|
|
5398 |
||
5399 |
case $need_lib_prefix in |
|
5400 |
no)
|
|
5401 |
eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$my_dlsyms" |
|
5402 |
;;
|
|
5403 |
*)
|
|
5404 |
eval "$global_symbol_to_c_name_address_lib_prefix" < "$nlist" >> "$output_objdir/$my_dlsyms" |
|
5405 |
;;
|
|
5406 |
esac
|
|
5407 |
echo >> "$output_objdir/$my_dlsyms" "\ |
|
5408 |
{0, (void *) 0}
|
|
5409 |
};
|
|
5410 |
||
5411 |
/* This works around a problem in FreeBSD linker */
|
|
5412 |
#ifdef FREEBSD_WORKAROUND
|
|
5413 |
static const void *lt_preloaded_setup() {
|
|
5414 |
return lt_${my_prefix}_LTX_preloaded_symbols; |
|
5415 |
}
|
|
5416 |
#endif
|
|
5417 |
||
5418 |
#ifdef __cplusplus
|
|
5419 |
}
|
|
5420 |
#endif\
|
|
5421 |
"
|
|
5422 |
} # !$opt_dry_run |
|
5423 |
||
5424 |
pic_flag_for_symtable= |
|
5425 |
case "$compile_command " in |
|
5426 |
*" -static "*) ;; |
|
5427 |
*)
|
|
5428 |
case $host in |
|
5429 |
# compiling the symbol table file with pic_flag works around
|
|
5430 |
# a FreeBSD bug that causes programs to crash when -lm is
|
|
5431 |
# linked before any other PIC object. But we must not use
|
|
5432 |
# pic_flag when linking with -static. The problem exists in
|
|
5433 |
# FreeBSD 2.2.6 and is fixed in FreeBSD 3.1.
|
|
5434 |
*-*-freebsd2.*|*-*-freebsd3.0*|*-*-freebsdelf3.0*) |
|
5435 |
pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND" ;; |
|
5436 |
*-*-hpux*)
|
|
5437 |
pic_flag_for_symtable=" $pic_flag" ;; |
|
5438 |
*)
|
|
5439 |
$my_pic_p && pic_flag_for_symtable=" $pic_flag" |
|
5440 |
;;
|
|
5441 |
esac
|
|
5442 |
;;
|
|
5443 |
esac
|
|
5444 |
symtab_cflags= |
|
5445 |
for arg in $LTCFLAGS; do |
|
5446 |
case $arg in |
|
5447 |
-pie | -fpie | -fPIE) ;; |
|
5448 |
*) func_append symtab_cflags " $arg" ;; |
|
5449 |
esac
|
|
5450 |
done
|
|
5451 |
||
5452 |
# Now compile the dynamic symbol file.
|
|
5453 |
func_show_eval '(cd $output_objdir && $LTCC$symtab_cflags -c$no_builtin_flag$pic_flag_for_symtable "$my_dlsyms")' 'exit $?' |
|
5454 |
||
5455 |
# Clean up the generated files.
|
|
5456 |
func_show_eval '$RM "$output_objdir/$my_dlsyms" "$nlist" "${nlist}S" "${nlist}T" "${nlist}I"'
|
|
5457 |
||
5458 |
# Transform the symbol file into the correct name.
|
|
5459 |
symfileobj=$output_objdir/${my_outputname}S.$objext |
|
5460 |
case $host in |
|
5461 |
*cygwin* | *mingw* | *cegcc* ) |
|
5462 |
if test -f "$output_objdir/$my_outputname.def"; then |
|
5463 |
compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"` |
|
5464 |
finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"` |
|
5465 |
else
|
|
5466 |
compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"` |
|
5467 |
finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"` |
|
5468 |
fi
|
|
5469 |
;;
|
|
5470 |
*)
|
|
5471 |
compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"` |
|
5472 |
finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"` |
|
5473 |
;;
|
|
5474 |
esac
|
|
5475 |
;;
|
|
5476 |
*)
|
|
5477 |
func_fatal_error "unknown suffix for '$my_dlsyms'" |
|
5478 |
;;
|
|
5479 |
esac
|
|
5480 |
else
|
|
5481 |
# We keep going just in case the user didn't refer to
|
|
5482 |
# lt_preloaded_symbols. The linker will fail if global_symbol_pipe
|
|
5483 |
# really was required.
|
|
5484 |
||
5485 |
# Nullify the symbol file.
|
|
5486 |
compile_command=`$ECHO "$compile_command" | $SED "s% @SYMFILE@%%"` |
|
5487 |
finalize_command=`$ECHO "$finalize_command" | $SED "s% @SYMFILE@%%"` |
|
5488 |
fi
|
|
5489 |
}
|
|
5490 |
||
5491 |
# func_cygming_gnu_implib_p ARG
|
|
5492 |
# This predicate returns with zero status (TRUE) if
|
|
5493 |
# ARG is a GNU/binutils-style import library. Returns
|
|
5494 |
# with nonzero status (FALSE) otherwise.
|
|
5495 |
func_cygming_gnu_implib_p ()
|
|
5496 |
{
|
|
5497 |
$debug_cmd
|
|
5498 |
||
5499 |
func_to_tool_file "$1" func_convert_file_msys_to_w32 |
|
5500 |
func_cygming_gnu_implib_tmp=`$NM "$func_to_tool_file_result" | eval "$global_symbol_pipe" | $EGREP ' (_head_[A-Za-z0-9_]+_[ad]l*|[A-Za-z0-9_]+_[ad]l*_iname)$'` |
|
5501 |
test -n "$func_cygming_gnu_implib_tmp" |
|
5502 |
}
|
|
5503 |
||
5504 |
# func_cygming_ms_implib_p ARG
|
|
5505 |
# This predicate returns with zero status (TRUE) if
|
|
5506 |
# ARG is an MS-style import library. Returns
|
|
5507 |
# with nonzero status (FALSE) otherwise.
|
|
5508 |
func_cygming_ms_implib_p ()
|
|
5509 |
{
|
|
5510 |
$debug_cmd
|
|
5511 |
||
5512 |
func_to_tool_file "$1" func_convert_file_msys_to_w32 |
|
5513 |
func_cygming_ms_implib_tmp=`$NM "$func_to_tool_file_result" | eval "$global_symbol_pipe" | $GREP '_NULL_IMPORT_DESCRIPTOR'` |
|
5514 |
test -n "$func_cygming_ms_implib_tmp" |
|
5515 |
}
|
|
5516 |
||
5517 |
# func_win32_libid arg
|
|
5518 |
# return the library type of file 'arg'
|
|
5519 |
#
|
|
5520 |
# Need a lot of goo to handle *both* DLLs and import libs
|
|
5521 |
# Has to be a shell function in order to 'eat' the argument
|
|
5522 |
# that is supplied when $file_magic_command is called.
|
|
5523 |
# Despite the name, also deal with 64 bit binaries.
|
|
5524 |
func_win32_libid ()
|
|
5525 |
{
|
|
5526 |
$debug_cmd
|
|
5527 |
||
5528 |
win32_libid_type=unknown |
|
5529 |
win32_fileres=`file -L $1 2>/dev/null` |
|
5530 |
case $win32_fileres in |
|
5531 |
*ar\ archive\ import\ library*) # definitely import |
|
5532 |
win32_libid_type="x86 archive import" |
|
5533 |
;;
|
|
5534 |
*ar\ archive*) # could be an import, or static |
|
5535 |
# Keep the egrep pattern in sync with the one in _LT_CHECK_MAGIC_METHOD.
|
|
5536 |
if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | |
|
5537 |
$EGREP 'file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' >/dev/null; then |
|
5538 |
case $nm_interface in |
|
5539 |
"MS dumpbin") |
|
5540 |
if func_cygming_ms_implib_p "$1" || |
|
5541 |
func_cygming_gnu_implib_p "$1" |
|
5542 |
then
|
|
5543 |
win32_nmres=import |
|
5544 |
else
|
|
5545 |
win32_nmres= |
|
5546 |
fi
|
|
5547 |
;;
|
|
5548 |
*)
|
|
5549 |
func_to_tool_file "$1" func_convert_file_msys_to_w32 |
|
5550 |
win32_nmres=`eval $NM -f posix -A \"$func_to_tool_file_result\" | |
|
5551 |
$SED -n -e ' |
|
5552 |
1,100{
|
|
5553 |
/ I /{
|
|
5554 |
s|.*|import|
|
|
5555 |
p
|
|
5556 |
q
|
|
5557 |
}
|
|
5558 |
}'` |
|
5559 |
;;
|
|
5560 |
esac
|
|
5561 |
case $win32_nmres in |
|
5562 |
import*) win32_libid_type="x86 archive import";; |
|
5563 |
*) win32_libid_type="x86 archive static";; |
|
5564 |
esac
|
|
5565 |
fi
|
|
5566 |
;;
|
|
5567 |
*DLL*)
|
|
5568 |
win32_libid_type="x86 DLL" |
|
5569 |
;;
|
|
5570 |
*executable*) # but shell scripts are "executable" too... |
|
5571 |
case $win32_fileres in |
|
5572 |
*MS\ Windows\ PE\ Intel*) |
|
5573 |
win32_libid_type="x86 DLL" |
|
5574 |
;;
|
|
5575 |
esac
|
|
5576 |
;;
|
|
5577 |
esac
|
|
5578 |
$ECHO "$win32_libid_type" |
|
5579 |
}
|
|
5580 |
||
5581 |
# func_cygming_dll_for_implib ARG
|
|
5582 |
#
|
|
5583 |
# Platform-specific function to extract the
|
|
5584 |
# name of the DLL associated with the specified
|
|
5585 |
# import library ARG.
|
|
5586 |
# Invoked by eval'ing the libtool variable
|
|
5587 |
# $sharedlib_from_linklib_cmd
|
|
5588 |
# Result is available in the variable
|
|
5589 |
# $sharedlib_from_linklib_result
|
|
5590 |
func_cygming_dll_for_implib ()
|
|
5591 |
{
|
|
5592 |
$debug_cmd
|
|
5593 |
||
5594 |
sharedlib_from_linklib_result=`$DLLTOOL --identify-strict --identify "$1"` |
|
5595 |
}
|
|
5596 |
||
5597 |
# func_cygming_dll_for_implib_fallback_core SECTION_NAME LIBNAMEs
|
|
5598 |
#
|
|
5599 |
# The is the core of a fallback implementation of a
|
|
5600 |
# platform-specific function to extract the name of the
|
|
5601 |
# DLL associated with the specified import library LIBNAME.
|
|
5602 |
#
|
|
5603 |
# SECTION_NAME is either .idata$6 or .idata$7, depending
|
|
5604 |
# on the platform and compiler that created the implib.
|
|
5605 |
#
|
|
5606 |
# Echos the name of the DLL associated with the
|
|
5607 |
# specified import library.
|
|
5608 |
func_cygming_dll_for_implib_fallback_core ()
|
|
5609 |
{
|
|
5610 |
$debug_cmd
|
|
5611 |
||
5612 |
match_literal=`$ECHO "$1" | $SED "$sed_make_literal_regex"` |
|
5613 |
$OBJDUMP -s --section "$1" "$2" 2>/dev/null | |
|
5614 |
$SED '/^Contents of section '"$match_literal"':/{ |
|
5615 |
# Place marker at beginning of archive member dllname section
|
|
5616 |
s/.*/====MARK====/
|
|
5617 |
p
|
|
5618 |
d
|
|
5619 |
}
|
|
5620 |
# These lines can sometimes be longer than 43 characters, but
|
|
5621 |
# are always uninteresting
|
|
5622 |
/:[ ]*file format pe[i]\{,1\}-/d
|
|
5623 |
/^In archive [^:]*:/d
|
|
5624 |
# Ensure marker is printed
|
|
5625 |
/^====MARK====/p
|
|
5626 |
# Remove all lines with less than 43 characters
|
|
5627 |
/^.\{43\}/!d
|
|
5628 |
# From remaining lines, remove first 43 characters
|
|
5629 |
s/^.\{43\}//' | |
|
5630 |
$SED -n ' |
|
5631 |
# Join marker and all lines until next marker into a single line
|
|
5632 |
/^====MARK====/ b para
|
|
5633 |
H
|
|
5634 |
$ b para
|
|
5635 |
b
|
|
5636 |
:para
|
|
5637 |
x
|
|
5638 |
s/\n//g
|
|
5639 |
# Remove the marker
|
|
5640 |
s/^====MARK====//
|
|
5641 |
# Remove trailing dots and whitespace
|
|
5642 |
s/[\. \t]*$//
|
|
5643 |
# Print
|
|
5644 |
/./p' | |
|
5645 |
# we now have a list, one entry per line, of the stringified
|
|
5646 |
# contents of the appropriate section of all members of the
|
|
5647 |
# archive that possess that section. Heuristic: eliminate
|
|
5648 |
# all those that have a first or second character that is
|
|
5649 |
# a '.' (that is, objdump's representation of an unprintable
|
|
5650 |
# character.) This should work for all archives with less than
|
|
5651 |
# 0x302f exports -- but will fail for DLLs whose name actually
|
|
5652 |
# begins with a literal '.' or a single character followed by
|
|
5653 |
# a '.'.
|
|
5654 |
#
|
|
5655 |
# Of those that remain, print the first one.
|
|
5656 |
$SED -e '/^\./d;/^.\./d;q' |
|
5657 |
}
|
|
5658 |
||
5659 |
# func_cygming_dll_for_implib_fallback ARG
|
|
5660 |
# Platform-specific function to extract the
|
|
5661 |
# name of the DLL associated with the specified
|
|
5662 |
# import library ARG.
|
|
5663 |
#
|
|
5664 |
# This fallback implementation is for use when $DLLTOOL
|
|
5665 |
# does not support the --identify-strict option.
|
|
5666 |
# Invoked by eval'ing the libtool variable
|
|
5667 |
# $sharedlib_from_linklib_cmd
|
|
5668 |
# Result is available in the variable
|
|
5669 |
# $sharedlib_from_linklib_result
|
|
5670 |
func_cygming_dll_for_implib_fallback ()
|
|
5671 |
{
|
|
5672 |
$debug_cmd
|
|
5673 |
||
5674 |
if func_cygming_gnu_implib_p "$1"; then |
|
5675 |
# binutils import library
|
|
5676 |
sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$7' "$1"` |
|
5677 |
elif func_cygming_ms_implib_p "$1"; then |
|
5678 |
# ms-generated import library
|
|
5679 |
sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$6' "$1"` |
|
5680 |
else
|
|
5681 |
# unknown
|
|
5682 |
sharedlib_from_linklib_result= |
|
5683 |
fi
|
|
5684 |
}
|
|
5685 |
||
5686 |
||
5687 |
# func_extract_an_archive dir oldlib
|
|
5688 |
func_extract_an_archive ()
|
|
5689 |
{
|
|
5690 |
$debug_cmd
|
|
5691 |
||
5692 |
f_ex_an_ar_dir=$1; shift |
|
5693 |
f_ex_an_ar_oldlib=$1 |
|
5694 |
if test yes = "$lock_old_archive_extraction"; then |
|
5695 |
lockfile=$f_ex_an_ar_oldlib.lock |
|
5696 |
until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do |
|
5697 |
func_echo "Waiting for $lockfile to be removed" |
|
5698 |
sleep 2
|
|
5699 |
done
|
|
5700 |
fi
|
|
5701 |
func_show_eval "(cd \$f_ex_an_ar_dir && $AR x \"\$f_ex_an_ar_oldlib\")" \ |
|
5702 |
'stat=$?; rm -f "$lockfile"; exit $stat'
|
|
5703 |
if test yes = "$lock_old_archive_extraction"; then |
|
5704 |
$opt_dry_run || rm -f "$lockfile" |
|
5705 |
fi
|
|
5706 |
if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then |
|
5707 |
: |
|
5708 |
else
|
|
5709 |
func_fatal_error "object name conflicts in archive: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib" |
|
5710 |
fi
|
|
5711 |
}
|
|
5712 |
||
5713 |
||
5714 |
# func_extract_archives gentop oldlib ...
|
|
5715 |
func_extract_archives ()
|
|
5716 |
{
|
|
5717 |
$debug_cmd
|
|
5718 |
||
5719 |
my_gentop=$1; shift |
|
5720 |
my_oldlibs=${1+"$@"} |
|
5721 |
my_oldobjs= |
|
5722 |
my_xlib= |
|
5723 |
my_xabs= |
|
5724 |
my_xdir= |
|
5725 |
||
5726 |
for my_xlib in $my_oldlibs; do |
|
5727 |
# Extract the objects.
|
|
5728 |
case $my_xlib in |
|
5729 |
[\\/]* | [A-Za-z]:[\\/]*) my_xabs=$my_xlib ;; |
|
5730 |
*) my_xabs=`pwd`"/$my_xlib" ;; |
|
5731 |
esac
|
|
5732 |
func_basename "$my_xlib" |
|
5733 |
my_xlib=$func_basename_result |
|
5734 |
my_xlib_u=$my_xlib |
|
5735 |
while :; do |
|
5736 |
case " $extracted_archives " in |
|
5737 |
*" $my_xlib_u "*) |
|
5738 |
func_arith $extracted_serial + 1 |
|
5739 |
extracted_serial=$func_arith_result |
|
5740 |
my_xlib_u=lt$extracted_serial-$my_xlib ;; |
|
5741 |
*) break ;; |
|
5742 |
esac
|
|
5743 |
done
|
|
5744 |
extracted_archives="$extracted_archives $my_xlib_u" |
|
5745 |
my_xdir=$my_gentop/$my_xlib_u |
|
5746 |
||
5747 |
func_mkdir_p "$my_xdir" |
|
5748 |
||
5749 |
case $host in |
|
5750 |
*-darwin*)
|
|
5751 |
func_verbose "Extracting $my_xabs" |
|
5752 |
# Do not bother doing anything if just a dry run
|
|
5753 |
$opt_dry_run || { |
|
5754 |
darwin_orig_dir=`pwd` |
|
5755 |
cd $my_xdir || exit $? |
|
5756 |
darwin_archive=$my_xabs |
|
5757 |
darwin_curdir=`pwd` |
|
5758 |
func_basename "$darwin_archive" |
|
5759 |
darwin_base_archive=$func_basename_result |
|
5760 |
darwin_arches=`$LIPO -info "$darwin_archive" 2>/dev/null | $GREP Architectures 2>/dev/null || true` |
|
5761 |
if test -n "$darwin_arches"; then |
|
5762 |
darwin_arches=`$ECHO "$darwin_arches" | $SED -e 's/.*are://'` |
|
5763 |
darwin_arch= |
|
5764 |
func_verbose "$darwin_base_archive has multiple architectures $darwin_arches" |
|
5765 |
for darwin_arch in $darwin_arches; do |
|
5766 |
func_mkdir_p "unfat-$$/$darwin_base_archive-$darwin_arch" |
|
5767 |
$LIPO -thin $darwin_arch -output "unfat-$$/$darwin_base_archive-$darwin_arch/$darwin_base_archive" "$darwin_archive" |
|
5768 |
cd "unfat-$$/$darwin_base_archive-$darwin_arch" |
|
5769 |
func_extract_an_archive "`pwd`" "$darwin_base_archive" |
|
5770 |
cd "$darwin_curdir" |
|
5771 |
$RM "unfat-$$/$darwin_base_archive-$darwin_arch/$darwin_base_archive" |
|
5772 |
done # $darwin_arches |
|
5773 |
## Okay now we've a bunch of thin objects, gotta fatten them up :)
|
|
5774 |
darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print | $SED -e "$sed_basename" | sort -u` |
|
5775 |
darwin_file= |
|
5776 |
darwin_files= |
|
5777 |
for darwin_file in $darwin_filelist; do |
|
5778 |
darwin_files=`find unfat-$$ -name $darwin_file -print | sort | $NL2SP` |
|
5779 |
$LIPO -create -output "$darwin_file" $darwin_files |
|
5780 |
done # $darwin_filelist |
|
5781 |
$RM -rf unfat-$$ |
|
5782 |
cd "$darwin_orig_dir" |
|
5783 |
else
|
|
5784 |
cd $darwin_orig_dir |
|
5785 |
func_extract_an_archive "$my_xdir" "$my_xabs" |
|
5786 |
fi # $darwin_arches |
|
5787 |
} # !$opt_dry_run |
|
5788 |
;;
|
|
5789 |
*)
|
|
5790 |
func_extract_an_archive "$my_xdir" "$my_xabs" |
|
5791 |
;;
|
|
5792 |
esac
|
|
5793 |
my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | sort | $NL2SP` |
|
5794 |
done
|
|
5795 |
||
5796 |
func_extract_archives_result=$my_oldobjs |
|
5797 |
}
|
|
5798 |
||
5799 |
||
5800 |
# func_emit_wrapper [arg=no]
|
|
5801 |
#
|
|
5802 |
# Emit a libtool wrapper script on stdout.
|
|
5803 |
# Don't directly open a file because we may want to
|
|
5804 |
# incorporate the script contents within a cygwin/mingw
|
|
5805 |
# wrapper executable. Must ONLY be called from within
|
|
5806 |
# func_mode_link because it depends on a number of variables
|
|
5807 |
# set therein.
|
|
5808 |
#
|
|
5809 |
# ARG is the value that the WRAPPER_SCRIPT_BELONGS_IN_OBJDIR
|
|
5810 |
# variable will take. If 'yes', then the emitted script
|
|
5811 |
# will assume that the directory where it is stored is
|
|
5812 |
# the $objdir directory. This is a cygwin/mingw-specific
|
|
5813 |
# behavior.
|
|
5814 |
func_emit_wrapper ()
|
|
5815 |
{
|
|
5816 |
func_emit_wrapper_arg1=${1-no} |
|
5817 |
||
5818 |
$ECHO "\ |
|
5819 |
#! $SHELL |
|
5820 |
||
5821 |
# $output - temporary wrapper script for $objdir/$outputname |
|
5822 |
# Generated by $PROGRAM (GNU $PACKAGE) $VERSION |
|
5823 |
#
|
|
5824 |
# The $output program cannot be directly executed until all the libtool |
|
5825 |
# libraries that it depends on are installed.
|
|
5826 |
#
|
|
5827 |
# This wrapper script should never be moved out of the build directory.
|
|
5828 |
# If it is, it will not operate correctly.
|
|
5829 |
||
5830 |
# Sed substitution that helps us do robust quoting. It backslashifies
|
|
5831 |
# metacharacters that are still active within double-quoted strings.
|
|
5832 |
sed_quote_subst='$sed_quote_subst' |
|
5833 |
||
5834 |
# Be Bourne compatible
|
|
5835 |
if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then
|
|
5836 |
emulate sh
|
|
5837 |
NULLCMD=:
|
|
5838 |
# Zsh 3.x and 4.x performs word splitting on \${1+\"\$@\"}, which
|
|
5839 |
# is contrary to our usage. Disable this feature.
|
|
5840 |
alias -g '\${1+\"\$@\"}'='\"\$@\"'
|
|
5841 |
setopt NO_GLOB_SUBST
|
|
5842 |
else
|
|
5843 |
case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac
|
|
5844 |
fi
|
|
5845 |
BIN_SH=xpg4; export BIN_SH # for Tru64
|
|
5846 |
DUALCASE=1; export DUALCASE # for MKS sh
|
|
5847 |
||
5848 |
# The HP-UX ksh and POSIX shell print the target directory to stdout
|
|
5849 |
# if CDPATH is set.
|
|
5850 |
(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
|
|
5851 |
||
5852 |
relink_command=\"$relink_command\" |
|
5853 |
||
5854 |
# This environment variable determines our operation mode.
|
|
5855 |
if test \"\$libtool_install_magic\" = \"$magic\"; then |
|
5856 |
# install mode needs the following variables:
|
|
5857 |
generated_by_libtool_version='$macro_version' |
|
5858 |
notinst_deplibs='$notinst_deplibs' |
|
5859 |
else
|
|
5860 |
# When we are sourced in execute mode, \$file and \$ECHO are already set.
|
|
5861 |
if test \"\$libtool_execute_magic\" != \"$magic\"; then |
|
5862 |
file=\"\$0\""
|
|
5863 |
||
5864 |
qECHO=`$ECHO "$ECHO" | $SED "$sed_quote_subst"` |
|
5865 |
$ECHO "\ |
|
5866 |
||
5867 |
# A function that is used when there is no print builtin or printf.
|
|
5868 |
func_fallback_echo ()
|
|
5869 |
{
|
|
5870 |
eval 'cat <<_LTECHO_EOF
|
|
5871 |
\$1
|
|
5872 |
_LTECHO_EOF'
|
|
5873 |
}
|
|
5874 |
ECHO=\"$qECHO\" |
|
5875 |
fi
|
|
5876 |
||
5877 |
# Very basic option parsing. These options are (a) specific to
|
|
5878 |
# the libtool wrapper, (b) are identical between the wrapper
|
|
5879 |
# /script/ and the wrapper /executable/ that is used only on
|
|
5880 |
# windows platforms, and (c) all begin with the string "--lt-" |
|
5881 |
# (application programs are unlikely to have options that match
|
|
5882 |
# this pattern).
|
|
5883 |
#
|
|
5884 |
# There are only two supported options: --lt-debug and
|
|
5885 |
# --lt-dump-script. There is, deliberately, no --lt-help.
|
|
5886 |
#
|
|
5887 |
# The first argument to this parsing function should be the
|
|
5888 |
# script's $0 value, followed by "$@". |
|
5889 |
lt_option_debug=
|
|
5890 |
func_parse_lt_options ()
|
|
5891 |
{
|
|
5892 |
lt_script_arg0=\$0
|
|
5893 |
shift
|
|
5894 |
for lt_opt
|
|
5895 |
do
|
|
5896 |
case \"\$lt_opt\" in
|
|
5897 |
--lt-debug) lt_option_debug=1 ;;
|
|
5898 |
--lt-dump-script)
|
|
5899 |
lt_dump_D=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%/[^/]*$%%'\` |
|
5900 |
test \"X\$lt_dump_D\" = \"X\$lt_script_arg0\" && lt_dump_D=.
|
|
5901 |
lt_dump_F=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%^.*/%%'\` |
|
5902 |
cat \"\$lt_dump_D/\$lt_dump_F\"
|
|
5903 |
exit 0
|
|
5904 |
;;
|
|
5905 |
--lt-*)
|
|
5906 |
\$ECHO \"Unrecognized --lt- option: '\$lt_opt'\" 1>&2
|
|
5907 |
exit 1
|
|
5908 |
;;
|
|
5909 |
esac
|
|
5910 |
done
|
|
5911 |
||
5912 |
# Print the debug banner immediately:
|
|
5913 |
if test -n \"\$lt_option_debug\"; then
|
|
5914 |
echo \"$outputname:$output:\$LINENO: libtool wrapper (GNU $PACKAGE) $VERSION\" 1>&2 |
|
5915 |
fi
|
|
5916 |
}
|
|
5917 |
||
5918 |
# Used when --lt-debug. Prints its arguments to stdout
|
|
5919 |
# (redirection is the responsibility of the caller)
|
|
5920 |
func_lt_dump_args ()
|
|
5921 |
{
|
|
5922 |
lt_dump_args_N=1;
|
|
5923 |
for lt_arg
|
|
5924 |
do
|
|
5925 |
\$ECHO \"$outputname:$output:\$LINENO: newargv[\$lt_dump_args_N]: \$lt_arg\" |
|
5926 |
lt_dump_args_N=\`expr \$lt_dump_args_N + 1\`
|
|
5927 |
done
|
|
5928 |
}
|
|
5929 |
||
5930 |
# Core function for launching the target application
|
|
5931 |
func_exec_program_core ()
|
|
5932 |
{
|
|
5933 |
"
|
|
5934 |
case $host in |
|
5935 |
# Backslashes separate directories on plain windows
|
|
5936 |
*-*-mingw | *-*-os2* | *-cegcc*) |
|
5937 |
$ECHO "\ |
|
5938 |
if test -n \"\$lt_option_debug\"; then
|
|
5939 |
\$ECHO \"$outputname:$output:\$LINENO: newargv[0]: \$progdir\\\\\$program\" 1>&2 |
|
5940 |
func_lt_dump_args \${1+\"\$@\"} 1>&2
|
|
5941 |
fi
|
|
5942 |
exec \"\$progdir\\\\\$program\" \${1+\"\$@\"}
|
|
5943 |
"
|
|
5944 |
;;
|
|
5945 |
||
5946 |
*)
|
|
5947 |
$ECHO "\ |
|
5948 |
if test -n \"\$lt_option_debug\"; then
|
|
5949 |
\$ECHO \"$outputname:$output:\$LINENO: newargv[0]: \$progdir/\$program\" 1>&2 |
|
5950 |
func_lt_dump_args \${1+\"\$@\"} 1>&2
|
|
5951 |
fi
|
|
5952 |
exec \"\$progdir/\$program\" \${1+\"\$@\"}
|
|
5953 |
"
|
|
5954 |
;;
|
|
5955 |
esac
|
|
5956 |
$ECHO "\ |
|
5957 |
\$ECHO \"\$0: cannot exec \$program \$*\" 1>&2
|
|
5958 |
exit 1
|
|
5959 |
}
|
|
5960 |
||
5961 |
# A function to encapsulate launching the target application
|
|
5962 |
# Strips options in the --lt-* namespace from \$@ and
|
|
5963 |
# launches target application with the remaining arguments.
|
|
5964 |
func_exec_program ()
|
|
5965 |
{
|
|
5966 |
case \" \$* \" in
|
|
5967 |
*\\ --lt-*)
|
|
5968 |
for lt_wr_arg
|
|
5969 |
do
|
|
5970 |
case \$lt_wr_arg in
|
|
5971 |
--lt-*) ;;
|
|
5972 |
*) set x \"\$@\" \"\$lt_wr_arg\"; shift;;
|
|
5973 |
esac
|
|
5974 |
shift
|
|
5975 |
done ;;
|
|
5976 |
esac
|
|
5977 |
func_exec_program_core \${1+\"\$@\"}
|
|
5978 |
}
|
|
5979 |
||
5980 |
# Parse options
|
|
5981 |
func_parse_lt_options \"\$0\" \${1+\"\$@\"}
|
|
5982 |
||
5983 |
# Find the directory that this script lives in.
|
|
5984 |
thisdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*$%%'\` |
|
5985 |
test \"x\$thisdir\" = \"x\$file\" && thisdir=.
|
|
5986 |
||
5987 |
# Follow symbolic links until we get to the real thisdir.
|
|
5988 |
file=\`ls -ld \"\$file\" | $SED -n 's/.*-> //p'\` |
|
5989 |
while test -n \"\$file\"; do
|
|
5990 |
destdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*\$%%'\` |
|
5991 |
||
5992 |
# If there was a directory component, then change thisdir.
|
|
5993 |
if test \"x\$destdir\" != \"x\$file\"; then
|
|
5994 |
case \"\$destdir\" in
|
|
5995 |
[\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;;
|
|
5996 |
*) thisdir=\"\$thisdir/\$destdir\" ;;
|
|
5997 |
esac
|
|
5998 |
fi
|
|
5999 |
||
6000 |
file=\`\$ECHO \"\$file\" | $SED 's%^.*/%%'\` |
|
6001 |
file=\`ls -ld \"\$thisdir/\$file\" | $SED -n 's/.*-> //p'\` |
|
6002 |
done
|
|
6003 |
||
6004 |
# Usually 'no', except on cygwin/mingw when embedded into
|
|
6005 |
# the cwrapper.
|
|
6006 |
WRAPPER_SCRIPT_BELONGS_IN_OBJDIR=$func_emit_wrapper_arg1 |
|
6007 |
if test \"\$WRAPPER_SCRIPT_BELONGS_IN_OBJDIR\" = \"yes\"; then
|
|
6008 |
# special case for '.'
|
|
6009 |
if test \"\$thisdir\" = \".\"; then
|
|
6010 |
thisdir=\`pwd\`
|
|
6011 |
fi
|
|
6012 |
# remove .libs from thisdir
|
|
6013 |
case \"\$thisdir\" in
|
|
6014 |
*[\\\\/]$objdir ) thisdir=\`\$ECHO \"\$thisdir\" | $SED 's%[\\\\/][^\\\\/]*$%%'\` ;; |
|
6015 |
$objdir ) thisdir=. ;; |
|
6016 |
esac
|
|
6017 |
fi
|
|
6018 |
||
6019 |
# Try to get the absolute directory name.
|
|
6020 |
absdir=\`cd \"\$thisdir\" && pwd\`
|
|
6021 |
test -n \"\$absdir\" && thisdir=\"\$absdir\"
|
|
6022 |
"
|
|
6023 |
||
6024 |
if test yes = "$fast_install"; then |
|
6025 |
$ECHO "\ |
|
6026 |
program=lt-'$outputname'$exeext |
|
6027 |
progdir=\"\$thisdir/$objdir\" |
|
6028 |
||
6029 |
if test ! -f \"\$progdir/\$program\" ||
|
|
6030 |
{ file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | $SED 1q\`; \\ |
|
6031 |
test \"X\$file\" != \"X\$progdir/\$program\"; }; then
|
|
6032 |
||
6033 |
file=\"\$\$-\$program\"
|
|
6034 |
||
6035 |
if test ! -d \"\$progdir\"; then
|
|
6036 |
$MKDIR \"\$progdir\" |
|
6037 |
else
|
|
6038 |
$RM \"\$progdir/\$file\" |
|
6039 |
fi"
|
|
6040 |
||
6041 |
$ECHO "\ |
|
6042 |
||
6043 |
# relink executable if necessary
|
|
6044 |
if test -n \"\$relink_command\"; then
|
|
6045 |
if relink_command_output=\`eval \$relink_command 2>&1\`; then :
|
|
6046 |
else
|
|
6047 |
\$ECHO \"\$relink_command_output\" >&2
|
|
6048 |
$RM \"\$progdir/\$file\" |
|
6049 |
exit 1
|
|
6050 |
fi
|
|
6051 |
fi
|
|
6052 |
||
6053 |
$MV \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null || |
|
6054 |
{ $RM \"\$progdir/\$program\"; |
|
6055 |
$MV \"\$progdir/\$file\" \"\$progdir/\$program\"; } |
|
6056 |
$RM \"\$progdir/\$file\" |
|
6057 |
fi"
|
|
6058 |
else
|
|
6059 |
$ECHO "\ |
|
6060 |
program='$outputname' |
|
6061 |
progdir=\"\$thisdir/$objdir\" |
|
6062 |
"
|
|
6063 |
fi
|
|
6064 |
||
6065 |
$ECHO "\ |
|
6066 |
||
6067 |
if test -f \"\$progdir/\$program\"; then"
|
|
6068 |
||
6069 |
# fixup the dll searchpath if we need to.
|
|
6070 |
#
|
|
6071 |
# Fix the DLL searchpath if we need to. Do this before prepending
|
|
6072 |
# to shlibpath, because on Windows, both are PATH and uninstalled
|
|
6073 |
# libraries must come first.
|
|
6074 |
if test -n "$dllsearchpath"; then |
|
6075 |
$ECHO "\ |
|
6076 |
# Add the dll search path components to the executable PATH
|
|
6077 |
PATH=$dllsearchpath:\$PATH |
|
6078 |
"
|
|
6079 |
fi
|
|
6080 |
||
6081 |
# Export our shlibpath_var if we have one.
|
|
6082 |
if test yes = "$shlibpath_overrides_runpath" && test -n "$shlibpath_var" && test -n "$temp_rpath"; then |
|
6083 |
$ECHO "\ |
|
6084 |
# Add our own library path to $shlibpath_var |
|
6085 |
$shlibpath_var=\"$temp_rpath\$$shlibpath_var\" |
|
6086 |
||
6087 |
# Some systems cannot cope with colon-terminated $shlibpath_var |
|
6088 |
# The second colon is a workaround for a bug in BeOS R4 sed
|
|
6089 |
$shlibpath_var=\`\$ECHO \"\$$shlibpath_var\" | $SED 's/::*\$//'\` |
|
6090 |
||
6091 |
export $shlibpath_var |
|
6092 |
"
|
|
6093 |
fi
|
|
6094 |
||
6095 |
$ECHO "\ |
|
6096 |
if test \"\$libtool_execute_magic\" != \"$magic\"; then |
|
6097 |
# Run the actual program with our arguments.
|
|
6098 |
func_exec_program \${1+\"\$@\"}
|
|
6099 |
fi
|
|
6100 |
else
|
|
6101 |
# The program doesn't exist.
|
|
6102 |
\$ECHO \"\$0: error: '\$progdir/\$program' does not exist\" 1>&2
|
|
6103 |
\$ECHO \"This script is just a wrapper for \$program.\" 1>&2
|
|
6104 |
\$ECHO \"See the $PACKAGE documentation for more information.\" 1>&2 |
|
6105 |
exit 1
|
|
6106 |
fi
|
|
6107 |
fi\
|
|
6108 |
"
|
|
6109 |
}
|
|
6110 |
||
6111 |
||
6112 |
# func_emit_cwrapperexe_src
|
|
6113 |
# emit the source code for a wrapper executable on stdout
|
|
6114 |
# Must ONLY be called from within func_mode_link because
|
|
6115 |
# it depends on a number of variable set therein.
|
|
6116 |
func_emit_cwrapperexe_src ()
|
|
6117 |
{
|
|
6118 |
cat <<EOF
|
|
6119 |
||
6120 |
/* $cwrappersource - temporary wrapper executable for $objdir/$outputname
|
|
6121 |
Generated by $PROGRAM (GNU $PACKAGE) $VERSION
|
|
6122 |
||
6123 |
The $output program cannot be directly executed until all the libtool
|
|
6124 |
libraries that it depends on are installed.
|
|
6125 |
||
6126 |
This wrapper executable should never be moved out of the build directory.
|
|
6127 |
If it is, it will not operate correctly.
|
|
6128 |
*/
|
|
6129 |
EOF
|
|
6130 |
cat <<"EOF"
|
|
6131 |
#ifdef _MSC_VER
|
|
6132 |
# define _CRT_SECURE_NO_DEPRECATE 1
|
|
6133 |
#endif
|
|
6134 |
#include <stdio.h>
|
|
6135 |
#include <stdlib.h>
|
|
6136 |
#ifdef _MSC_VER
|
|
6137 |
# include <direct.h>
|
|
6138 |
# include <process.h>
|
|
6139 |
# include <io.h>
|
|
6140 |
#else
|
|
6141 |
# include <unistd.h>
|
|
6142 |
# include <stdint.h>
|
|
6143 |
# ifdef __CYGWIN__
|
|
6144 |
# include <io.h>
|
|
6145 |
# endif
|
|
6146 |
#endif
|
|
6147 |
#include <malloc.h>
|
|
6148 |
#include <stdarg.h>
|
|
6149 |
#include <assert.h>
|
|
6150 |
#include <string.h>
|
|
6151 |
#include <ctype.h>
|
|
6152 |
#include <errno.h>
|
|
6153 |
#include <fcntl.h>
|
|
6154 |
#include <sys/stat.h>
|
|
6155 |
||
6156 |
#define STREQ(s1, s2) (strcmp ((s1), (s2)) == 0)
|
|
6157 |
||
6158 |
/* declarations of non-ANSI functions */ |
|
6159 |
#if defined __MINGW32__
|
|
6160 |
# ifdef __STRICT_ANSI__
|
|
6161 |
int _putenv (const char *); |
|
6162 |
# endif
|
|
6163 |
#elif defined __CYGWIN__
|
|
6164 |
# ifdef __STRICT_ANSI__
|
|
6165 |
char *realpath (const char *, char *); |
|
6166 |
int putenv (char *); |
|
6167 |
int setenv (const char *, const char *, int); |
|
6168 |
# endif
|
|
6169 |
/* #elif defined other_platform || defined ... */
|
|
6170 |
#endif
|
|
6171 |
||
6172 |
/* portability defines, excluding path handling macros */ |
|
6173 |
#if defined _MSC_VER
|
|
6174 |
# define setmode _setmode
|
|
6175 |
# define stat _stat
|
|
6176 |
# define chmod _chmod
|
|
6177 |
# define getcwd _getcwd
|
|
6178 |
# define putenv _putenv
|
|
6179 |
# define S_IXUSR _S_IEXEC
|
|
6180 |
#elif defined __MINGW32__
|
|
6181 |
# define setmode _setmode
|
|
6182 |
# define stat _stat
|
|
6183 |
# define chmod _chmod
|
|
6184 |
# define getcwd _getcwd
|
|
6185 |
# define putenv _putenv
|
|
6186 |
#elif defined __CYGWIN__
|
|
6187 |
# define HAVE_SETENV
|
|
6188 |
# define FOPEN_WB "wb"
|
|
6189 |
/* #elif defined other platforms ... */
|
|
6190 |
#endif
|
|
6191 |
||
6192 |
#if defined PATH_MAX
|
|
6193 |
# define LT_PATHMAX PATH_MAX
|
|
6194 |
#elif defined MAXPATHLEN
|
|
6195 |
# define LT_PATHMAX MAXPATHLEN
|
|
6196 |
#else
|
|
6197 |
# define LT_PATHMAX 1024
|
|
6198 |
#endif
|
|
6199 |
||
6200 |
#ifndef S_IXOTH
|
|
6201 |
# define S_IXOTH 0
|
|
6202 |
#endif
|
|
6203 |
#ifndef S_IXGRP
|
|
6204 |
# define S_IXGRP 0
|
|
6205 |
#endif
|
|
6206 |
||
6207 |
/* path handling portability macros */ |
|
6208 |
#ifndef DIR_SEPARATOR
|
|
6209 |
# define DIR_SEPARATOR '/'
|
|
6210 |
# define PATH_SEPARATOR ':'
|
|
6211 |
#endif
|
|
6212 |
||
6213 |
#if defined _WIN32 || defined __MSDOS__ || defined __DJGPP__ || \
|
|
6214 |
defined __OS2__ |
|
6215 |
# define HAVE_DOS_BASED_FILE_SYSTEM
|
|
6216 |
# define FOPEN_WB "wb"
|
|
6217 |
# ifndef DIR_SEPARATOR_2
|
|
6218 |
# define DIR_SEPARATOR_2 '\\'
|
|
6219 |
# endif
|
|
6220 |
# ifndef PATH_SEPARATOR_2
|
|
6221 |
# define PATH_SEPARATOR_2 ';'
|
|
6222 |
# endif
|
|
6223 |
#endif
|
|
6224 |
||
6225 |
#ifndef DIR_SEPARATOR_2
|
|
6226 |
# define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR)
|
|
6227 |
#else /* DIR_SEPARATOR_2 */
|
|
6228 |
# define IS_DIR_SEPARATOR(ch) \
|
|
6229 |
(((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2)) |
|
6230 |
#endif /* DIR_SEPARATOR_2 */
|
|
6231 |
||
6232 |
#ifndef PATH_SEPARATOR_2
|
|
6233 |
# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR)
|
|
6234 |
#else /* PATH_SEPARATOR_2 */
|
|
6235 |
# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2)
|
|
6236 |
#endif /* PATH_SEPARATOR_2 */
|
|
6237 |
||
6238 |
#ifndef FOPEN_WB
|
|
6239 |
# define FOPEN_WB "w"
|
|
6240 |
#endif
|
|
6241 |
#ifndef _O_BINARY
|
|
6242 |
# define _O_BINARY 0
|
|
6243 |
#endif
|
|
6244 |
||
6245 |
#define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type)))
|
|
6246 |
#define XFREE(stale) do { \
|
|
6247 |
if (stale) { free (stale); stale = 0; } \ |
|
6248 |
} while (0) |
|
6249 |
||
6250 |
#if defined LT_DEBUGWRAPPER
|
|
6251 |
static int lt_debug = 1; |
|
6252 |
#else
|
|
6253 |
static int lt_debug = 0; |
|
6254 |
#endif
|
|
6255 |
||
6256 |
const char *program_name = "libtool-wrapper"; /* in case xstrdup fails */ |
|
6257 |
||
6258 |
void *xmalloc (size_t num); |
|
6259 |
char *xstrdup (const char *string); |
|
6260 |
const char *base_name (const char *name); |
|
6261 |
char *find_executable (const char *wrapper); |
|
6262 |
char *chase_symlinks (const char *pathspec); |
|
6263 |
int make_executable (const char *path); |
|
6264 |
int check_executable (const char *path); |
|
6265 |
char *strendzap (char *str, const char *pat); |
|
6266 |
void lt_debugprintf (const char *file, int line, const char *fmt, ...); |
|
6267 |
void lt_fatal (const char *file, int line, const char *message, ...); |
|
6268 |
static const char *nonnull (const char *s); |
|
6269 |
static const char *nonempty (const char *s); |
|
6270 |
void lt_setenv (const char *name, const char *value); |
|
6271 |
char *lt_extend_str (const char *orig_value, const char *add, int to_end); |
|
6272 |
void lt_update_exe_path (const char *name, const char *value); |
|
6273 |
void lt_update_lib_path (const char *name, const char *value); |
|
6274 |
char **prepare_spawn (char **argv); |
|
6275 |
void lt_dump_script (FILE *f); |
|
6276 |
EOF |
|
6277 |
||
6278 |
cat <<EOF
|
|
6279 |
#if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 5)
|
|
6280 |
# define externally_visible volatile
|
|
6281 |
#else
|
|
6282 |
# define externally_visible __attribute__((externally_visible)) volatile
|
|
6283 |
#endif
|
|
6284 |
externally_visible const char * MAGIC_EXE = "$magic_exe";
|
|
6285 |
const char * LIB_PATH_VARNAME = "$shlibpath_var";
|
|
6286 |
EOF
|
|
6287 |
||
6288 |
if test yes = "$shlibpath_overrides_runpath" && test -n "$shlibpath_var" && test -n "$temp_rpath"; then |
|
6289 |
func_to_host_path "$temp_rpath" |
|
6290 |
cat <<EOF
|
|
6291 |
const char * LIB_PATH_VALUE = "$func_to_host_path_result";
|
|
6292 |
EOF
|
|
6293 |
else
|
|
6294 |
cat <<"EOF"
|
|
6295 |
const char * LIB_PATH_VALUE = ""; |
|
6296 |
EOF |
|
6297 |
fi
|
|
6298 |
||
6299 |
if test -n "$dllsearchpath"; then |
|
6300 |
func_to_host_path "$dllsearchpath:" |
|
6301 |
cat <<EOF
|
|
6302 |
const char * EXE_PATH_VARNAME = "PATH";
|
|
6303 |
const char * EXE_PATH_VALUE = "$func_to_host_path_result";
|
|
6304 |
EOF
|
|
6305 |
else
|
|
6306 |
cat <<"EOF"
|
|
6307 |
const char * EXE_PATH_VARNAME = ""; |
|
6308 |
const char * EXE_PATH_VALUE = ""; |
|
6309 |
EOF |
|
6310 |
fi
|
|
6311 |
||
6312 |
if test yes = "$fast_install"; then |
|
6313 |
cat <<EOF
|
|
6314 |
const char * TARGET_PROGRAM_NAME = "lt-$outputname"; /* hopefully, no .exe */
|
|
6315 |
EOF
|
|
6316 |
else
|
|
6317 |
cat <<EOF
|
|
6318 |
const char * TARGET_PROGRAM_NAME = "$outputname"; /* hopefully, no .exe */
|
|
6319 |
EOF
|
|
6320 |
fi
|
|
6321 |
||
6322 |
||
6323 |
cat <<"EOF"
|
|
6324 |
||
6325 |
#define LTWRAPPER_OPTION_PREFIX "--lt-"
|
|
6326 |
||
6327 |
static const char *ltwrapper_option_prefix = LTWRAPPER_OPTION_PREFIX; |
|
6328 |
static const char *dumpscript_opt = LTWRAPPER_OPTION_PREFIX "dump-script"; |
|
6329 |
static const char *debug_opt = LTWRAPPER_OPTION_PREFIX "debug"; |
|
6330 |
||
6331 |
int |
|
6332 |
main (int argc, char *argv[]) |
|
6333 |
{
|
|
6334 |
char **newargz;
|
|
6335 |
int newargc;
|
|
6336 |
char *tmp_pathspec;
|
|
6337 |
char *actual_cwrapper_path;
|
|
6338 |
char *actual_cwrapper_name;
|
|
6339 |
char *target_name;
|
|
6340 |
char *lt_argv_zero;
|
|
6341 |
int rval = 127; |
|
6342 |
||
6343 |
int i;
|
|
6344 |
||
6345 |
program_name = (char *) xstrdup (base_name (argv[0])); |
|
6346 |
newargz = XMALLOC (char *, (size_t) argc + 1); |
|
6347 |
||
6348 |
/* very simple arg parsing; don't want to rely on getopt |
|
6349 |
* also, copy all non cwrapper options to newargz, except
|
|
6350 |
* argz[0], which is handled differently
|
|
6351 |
*/
|
|
6352 |
newargc=0;
|
|
6353 |
for (i = 1; i < argc; i++)
|
|
6354 |
{
|
|
6355 |
if (STREQ (argv[i], dumpscript_opt))
|
|
6356 |
{
|
|
6357 |
EOF
|
|
6358 |
case $host in
|
|
6359 |
*mingw* | *cygwin* )
|
|
6360 |
# make stdout use "unix" line endings
|
|
6361 |
echo " setmode(1,_O_BINARY);"
|
|
6362 |
;;
|
|
6363 |
esac
|
|
6364 |
||
6365 |
cat <<"EOF"
|
|
6366 |
lt_dump_script (stdout);
|
|
6367 |
return 0;
|
|
6368 |
}
|
|
6369 |
if (STREQ (argv[i], debug_opt))
|
|
6370 |
{
|
|
6371 |
lt_debug = 1;
|
|
6372 |
continue;
|
|
6373 |
}
|
|
6374 |
if (STREQ (argv[i], ltwrapper_option_prefix))
|
|
6375 |
{
|
|
6376 |
/* however, if there is an option in the LTWRAPPER_OPTION_PREFIX
|
|
6377 |
namespace, but it is not one of the ones we know about and
|
|
6378 |
have already dealt with, above (inluding dump-script), then
|
|
6379 |
report an error. Otherwise, targets might begin to believe
|
|
6380 |
they are allowed to use options in the LTWRAPPER_OPTION_PREFIX
|
|
6381 |
namespace. The first time any user complains about this, we'll
|
|
6382 |
need to make LTWRAPPER_OPTION_PREFIX a configure-time option |
|
6383 |
or a configure.ac-settable value. |
|
6384 |
*/ |
|
6385 |
lt_fatal (__FILE__, __LINE__,
|
|
6386 |
"unrecognized %s option: '%s'",
|
|
6387 |
ltwrapper_option_prefix, argv[i]); |
|
6388 |
}
|
|
6389 |
/* otherwise ... */ |
|
6390 |
newargz[++newargc] = xstrdup (argv[i]); |
|
6391 |
}
|
|
6392 |
newargz[++newargc] = NULL; |
|
6393 |
||
6394 |
EOF |
|
6395 |
cat <<EOF
|
|
6396 |
/* The GNU banner must be the first non-error debug message */
|
|
6397 |
lt_debugprintf (__FILE__, __LINE__, "libtool wrapper (GNU $PACKAGE) $VERSION\n");
|
|
6398 |
EOF
|
|
6399 |
cat <<"EOF"
|
|
6400 |
lt_debugprintf (__FILE__, __LINE__, "(main) argv[0]: %s\n", argv[0]); |
|
6401 |
lt_debugprintf (__FILE__, __LINE__, "(main) program_name: %s\n", program_name); |
|
6402 |
||
6403 |
tmp_pathspec = find_executable (argv[0]); |
|
6404 |
if (tmp_pathspec == NULL) |
|
6405 |
lt_fatal (__FILE__, __LINE__, "couldn't find %s", argv[0]); |
|
6406 |
lt_debugprintf (__FILE__, __LINE__,
|
|
6407 |
"(main) found exe (before symlink chase) at: %s\n",
|
|
6408 |
tmp_pathspec); |
|
6409 |
||
6410 |
actual_cwrapper_path = chase_symlinks (tmp_pathspec); |
|
6411 |
lt_debugprintf (__FILE__, __LINE__,
|
|
6412 |
"(main) found exe (after symlink chase) at: %s\n",
|
|
6413 |
actual_cwrapper_path); |
|
6414 |
XFREE (tmp_pathspec); |
|
6415 |
||
6416 |
actual_cwrapper_name = xstrdup (base_name (actual_cwrapper_path)); |
|
6417 |
strendzap (actual_cwrapper_path, actual_cwrapper_name); |
|
6418 |
||
6419 |
/* wrapper name transforms */ |
|
6420 |
strendzap (actual_cwrapper_name, ".exe"); |
|
6421 |
tmp_pathspec = lt_extend_str (actual_cwrapper_name, ".exe", 1); |
|
6422 |
XFREE (actual_cwrapper_name); |
|
6423 |
actual_cwrapper_name = tmp_pathspec; |
|
6424 |
tmp_pathspec = 0; |
|
6425 |
||
6426 |
/* target_name transforms -- use actual target program name; might have lt- prefix */
|
|
6427 |
target_name = xstrdup (base_name (TARGET_PROGRAM_NAME)); |
|
6428 |
strendzap (target_name, ".exe"); |
|
6429 |
tmp_pathspec = lt_extend_str (target_name, ".exe", 1); |
|
6430 |
XFREE (target_name); |
|
6431 |
target_name = tmp_pathspec; |
|
6432 |
tmp_pathspec = 0; |
|
6433 |
||
6434 |
lt_debugprintf (__FILE__, __LINE__,
|
|
6435 |
"(main) libtool target name: %s\n",
|
|
6436 |
target_name); |
|
6437 |
EOF |
|
6438 |
||
6439 |
cat <<EOF
|
|
6440 |
newargz[0] =
|
|
6441 |
XMALLOC (char, (strlen (actual_cwrapper_path) +
|
|
6442 |
strlen ("$objdir") + 1 + strlen (actual_cwrapper_name) + 1));
|
|
6443 |
strcpy (newargz[0], actual_cwrapper_path);
|
|
6444 |
strcat (newargz[0], "$objdir");
|
|
6445 |
strcat (newargz[0], "/");
|
|
6446 |
EOF
|
|
6447 |
||
6448 |
cat <<"EOF"
|
|
6449 |
/* stop here, and copy so we don't have to do this twice */
|
|
6450 |
tmp_pathspec = xstrdup (newargz[0]);
|
|
6451 |
||
6452 |
/* do NOT want the lt- prefix here, so use actual_cwrapper_name */
|
|
6453 |
strcat (newargz[0], actual_cwrapper_name);
|
|
6454 |
||
6455 |
/* DO want the lt- prefix here if it exists, so use target_name */
|
|
6456 |
lt_argv_zero = lt_extend_str (tmp_pathspec, target_name, 1);
|
|
6457 |
XFREE (tmp_pathspec);
|
|
6458 |
tmp_pathspec = NULL;
|
|
6459 |
EOF
|
|
6460 |
||
6461 |
case $host_os in
|
|
6462 |
mingw*)
|
|
6463 |
cat <<"EOF"
|
|
6464 |
{
|
|
6465 |
char* p;
|
|
6466 |
while ((p = strchr (newargz[0], '\\')) != NULL) |
|
6467 |
{
|
|
6468 |
*p = '/'; |
|
6469 |
}
|
|
6470 |
while ((p = strchr (lt_argv_zero, '\\')) != NULL) |
|
6471 |
{
|
|
6472 |
*p = '/'; |
|
6473 |
}
|
|
6474 |
}
|
|
6475 |
EOF
|
|
6476 |
;;
|
|
6477 |
esac
|
|
6478 |
||
6479 |
cat <<"EOF"
|
|
6480 |
XFREE (target_name);
|
|
6481 |
XFREE (actual_cwrapper_path);
|
|
6482 |
XFREE (actual_cwrapper_name);
|
|
6483 |
||
6484 |
lt_setenv ("BIN_SH", "xpg4"); /* for Tru64 */
|
|
6485 |
lt_setenv ("DUALCASE", "1"); /* for MSK sh */
|
|
6486 |
/* Update the DLL searchpath. EXE_PATH_VALUE ($dllsearchpath) must
|
|
6487 |
be prepended before (that is, appear after) LIB_PATH_VALUE ($temp_rpath)
|
|
6488 |
because on Windows, both *_VARNAMEs are PATH but uninstalled
|
|
6489 |
libraries must come first. */
|
|
6490 |
lt_update_exe_path (EXE_PATH_VARNAME, EXE_PATH_VALUE);
|
|
6491 |
lt_update_lib_path (LIB_PATH_VARNAME, LIB_PATH_VALUE);
|
|
6492 |
||
6493 |
lt_debugprintf (__FILE__, __LINE__, "(main) lt_argv_zero: %s\n",
|
|
6494 |
nonnull (lt_argv_zero));
|
|
6495 |
for (i = 0; i < newargc; i++)
|
|
6496 |
{
|
|
6497 |
lt_debugprintf (__FILE__, __LINE__, "(main) newargz[%d]: %s\n",
|
|
6498 |
i, nonnull (newargz[i]));
|
|
6499 |
}
|
|
6500 |
||
6501 |
EOF
|
|
6502 |
||
6503 |
case $host_os in
|
|
6504 |
mingw*)
|
|
6505 |
cat <<"EOF"
|
|
6506 |
/* execv doesn't actually work on mingw as expected on unix */
|
|
6507 |
newargz = prepare_spawn (newargz); |
|
6508 |
rval = (int) _spawnv (_P_WAIT, lt_argv_zero, (const char * const *) newargz); |
|
6509 |
if (rval == -1) |
|
6510 |
{
|
|
6511 |
/* failed to start process */ |
|
6512 |
lt_debugprintf (__FILE__, __LINE__,
|
|
6513 |
"(main) failed to launch target \"%s\": %s\n",
|
|
6514 |
lt_argv_zero, nonnull (strerror (errno))); |
|
6515 |
return 127; |
|
6516 |
}
|
|
6517 |
return rval; |
|
6518 |
EOF |
|
6519 |
;;
|
|
6520 |
*)
|
|
6521 |
cat <<"EOF"
|
|
6522 |
execv (lt_argv_zero, newargz); |
|
6523 |
return rval; /* =127, but avoids unused variable warning */ |
|
6524 |
EOF |
|
6525 |
;;
|
|
6526 |
esac
|
|
6527 |
||
6528 |
cat <<"EOF"
|
|
6529 |
}
|
|
6530 |
||
6531 |
void * |
|
6532 |
xmalloc (size_t num) |
|
6533 |
{
|
|
6534 |
void *p = (void *) malloc (num); |
|
6535 |
if (!p) |
|
6536 |
lt_fatal (__FILE__, __LINE__, "memory exhausted"); |
|
6537 |
||
6538 |
return p; |
|
6539 |
}
|
|
6540 |
||
6541 |
char * |
|
6542 |
xstrdup (const char *string) |
|
6543 |
{
|
|
6544 |
return string ? strcpy ((char *) xmalloc (strlen (string) + 1), |
|
6545 |
string) : NULL; |
|
6546 |
}
|
|
6547 |
||
6548 |
const char * |
|
6549 |
base_name (const char *name) |
|
6550 |
{
|
|
6551 |
const char *base;
|
|
6552 |
||
6553 |
#if defined HAVE_DOS_BASED_FILE_SYSTEM
|
|
6554 |
/* Skip over the disk name in MSDOS pathnames. */ |
|
6555 |
if (isalpha ((unsigned char) name[0]) && name[1] == ':') |
|
6556 |
name += 2; |
|
6557 |
#endif
|
|
6558 |
||
6559 |
for (base = name; *name; name++) |
|
6560 |
if (IS_DIR_SEPARATOR (*name)) |
|
6561 |
base = name + 1; |
|
6562 |
return base; |
|
6563 |
}
|
|
6564 |
||
6565 |
int |
|
6566 |
check_executable (const char *path) |
|
6567 |
{
|
|
6568 |
struct stat st;
|
|
6569 |
||
6570 |
lt_debugprintf (__FILE__, __LINE__, "(check_executable): %s\n", |
|
6571 |
nonempty (path)); |
|
6572 |
if ((!path) || (!*path)) |
|
6573 |
return 0; |
|
6574 |
||
6575 |
if ((stat (path, &st) >= 0) |
|
6576 |
&& (st.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH))) |
|
6577 |
return 1; |
|
6578 |
else
|
|
6579 |
return 0; |
|
6580 |
}
|
|
6581 |
||
6582 |
int |
|
6583 |
make_executable (const char *path) |
|
6584 |
{
|
|
6585 |
int rval = 0; |
|
6586 |
struct stat st;
|
|
6587 |
||
6588 |
lt_debugprintf (__FILE__, __LINE__, "(make_executable): %s\n", |
|
6589 |
nonempty (path)); |
|
6590 |
if ((!path) || (!*path)) |
|
6591 |
return 0; |
|
6592 |
||
6593 |
if (stat (path, &st) >= 0) |
|
6594 |
{
|
|
6595 |
rval = chmod (path, st.st_mode | S_IXOTH | S_IXGRP | S_IXUSR); |
|
6596 |
}
|
|
6597 |
return rval; |
|
6598 |
}
|
|
6599 |
||
6600 |
/* Searches for the full path of the wrapper. Returns
|
|
6601 |
newly allocated full path name if found, NULL otherwise
|
|
6602 |
Does not chase symlinks, even on platforms that support them. |
|
6603 |
*/ |
|
6604 |
char * |
|
6605 |
find_executable (const char *wrapper) |
|
6606 |
{
|
|
6607 |
int has_slash = 0; |
|
6608 |
const char *p;
|
|
6609 |
const char *p_next;
|
|
6610 |
/* static buffer for getcwd */
|
|
6611 |
char tmp[LT_PATHMAX + 1]; |
|
6612 |
size_t tmp_len;
|
|
6613 |
char *concat_name;
|
|
6614 |
||
6615 |
lt_debugprintf (__FILE__, __LINE__, "(find_executable): %s\n", |
|
6616 |
nonempty (wrapper)); |
|
6617 |
||
6618 |
if ((wrapper == NULL) || (*wrapper == '\0')) |
|
6619 |
return NULL; |
|
6620 |
||
6621 |
/* Absolute path? */ |
|
6622 |
#if defined HAVE_DOS_BASED_FILE_SYSTEM
|
|
6623 |
if (isalpha ((unsigned char) wrapper[0]) && wrapper[1] == ':') |
|
6624 |
{
|
|
6625 |
concat_name = xstrdup (wrapper); |
|
6626 |
if (check_executable (concat_name)) |
|
6627 |
return concat_name; |
|
6628 |
XFREE (concat_name); |
|
6629 |
}
|
|
6630 |
else
|
|
6631 |
{
|
|
6632 |
#endif
|
|
6633 |
if (IS_DIR_SEPARATOR (wrapper[0])) |
|
6634 |
{
|
|
6635 |
concat_name = xstrdup (wrapper); |
|
6636 |
if (check_executable (concat_name)) |
|
6637 |
return concat_name; |
|
6638 |
XFREE (concat_name); |
|
6639 |
}
|
|
6640 |
#if defined HAVE_DOS_BASED_FILE_SYSTEM
|
|
6641 |
}
|
|
6642 |
#endif
|
|
6643 |
||
6644 |
for (p = wrapper; *p; p++) |
|
6645 |
if (*p == '/') |
|
6646 |
{
|
|
6647 |
has_slash = 1; |
|
6648 |
break;
|
|
6649 |
}
|
|
6650 |
if (!has_slash) |
|
6651 |
{
|
|
6652 |
/* no slashes; search PATH */
|
|
6653 |
const char *path = getenv ("PATH"); |
|
6654 |
if (path != NULL) |
|
6655 |
{
|
|
6656 |
for (p = path; *p; p = p_next) |
|
6657 |
{
|
|
6658 |
const char *q;
|
|
6659 |
size_t p_len;
|
|
6660 |
for (q = p; *q; q++) |
|
6661 |
if (IS_PATH_SEPARATOR (*q)) |
|
6662 |
break;
|
|
6663 |
p_len = (size_t) (q - p); |
|
6664 |
p_next = (*q == '\0' ? q : q + 1); |
|
6665 |
if (p_len == 0) |
|
6666 |
{
|
|
6667 |
/* empty path: current directory */ |
|
6668 |
if (getcwd (tmp, LT_PATHMAX) == NULL) |
|
6669 |
lt_fatal (__FILE__, __LINE__, "getcwd failed: %s", |
|
6670 |
nonnull (strerror (errno))); |
|
6671 |
tmp_len = strlen (tmp); |
|
6672 |
concat_name = |
|
6673 |
XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1); |
|
6674 |
memcpy (concat_name, tmp, tmp_len); |
|
6675 |
concat_name[tmp_len] = '/'; |
|
6676 |
strcpy (concat_name + tmp_len + 1, wrapper); |
|
6677 |
}
|
|
6678 |
else
|
|
6679 |
{
|
|
6680 |
concat_name = |
|
6681 |
XMALLOC (char, p_len + 1 + strlen (wrapper) + 1); |
|
6682 |
memcpy (concat_name, p, p_len); |
|
6683 |
concat_name[p_len] = '/'; |
|
6684 |
strcpy (concat_name + p_len + 1, wrapper); |
|
6685 |
}
|
|
6686 |
if (check_executable (concat_name)) |
|
6687 |
return concat_name; |
|
6688 |
XFREE (concat_name); |
|
6689 |
}
|
|
6690 |
}
|
|
6691 |
/* not found in PATH; assume curdir */
|
|
6692 |
}
|
|
6693 |
/* Relative path | not found in path: prepend cwd */
|
|
6694 |
if (getcwd (tmp, LT_PATHMAX) == NULL) |
|
6695 |
lt_fatal (__FILE__, __LINE__, "getcwd failed: %s", |
|
6696 |
nonnull (strerror (errno))); |
|
6697 |
tmp_len = strlen (tmp); |
|
6698 |
concat_name = XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1); |
|
6699 |
memcpy (concat_name, tmp, tmp_len); |
|
6700 |
concat_name[tmp_len] = '/'; |
|
6701 |
strcpy (concat_name + tmp_len + 1, wrapper); |
|
6702 |
||
6703 |
if (check_executable (concat_name)) |
|
6704 |
return concat_name; |
|
6705 |
XFREE (concat_name); |
|
6706 |
return NULL; |
|
6707 |
}
|
|
6708 |
||
6709 |
char * |
|
6710 |
chase_symlinks (const char *pathspec) |
|
6711 |
{
|
|
6712 |
#ifndef S_ISLNK
|
|
6713 |
return xstrdup (pathspec); |
|
6714 |
#else
|
|
6715 |
char buf[LT_PATHMAX]; |
|
6716 |
struct stat s;
|
|
6717 |
char *tmp_pathspec = xstrdup (pathspec); |
|
6718 |
char *p;
|
|
6719 |
int has_symlinks = 0; |
|
6720 |
while (strlen (tmp_pathspec) && !has_symlinks) |
|
6721 |
{
|
|
6722 |
lt_debugprintf (__FILE__, __LINE__,
|
|
6723 |
"checking path component for symlinks: %s\n",
|
|
6724 |
tmp_pathspec); |
|
6725 |
if (lstat (tmp_pathspec, &s) == 0) |
|
6726 |
{
|
|
6727 |
if (S_ISLNK (s.st_mode) != 0) |
|
6728 |
{
|
|
6729 |
has_symlinks = 1; |
|
6730 |
break;
|
|
6731 |
}
|
|
6732 |
||
6733 |
/* search backwards for last DIR_SEPARATOR */
|
|
6734 |
p = tmp_pathspec + strlen (tmp_pathspec) - 1; |
|
6735 |
while ((p > tmp_pathspec) && (!IS_DIR_SEPARATOR (*p))) |
|
6736 |
p--;
|
|
6737 |
if ((p == tmp_pathspec) && (!IS_DIR_SEPARATOR (*p))) |
|
6738 |
{
|
|
6739 |
/* no more DIR_SEPARATORS left */ |
|
6740 |
break;
|
|
6741 |
}
|
|
6742 |
*p = '\0'; |
|
6743 |
}
|
|
6744 |
else
|
|
6745 |
{
|
|
6746 |
lt_fatal (__FILE__, __LINE__,
|
|
6747 |
"error accessing file \"%s\": %s",
|
|
6748 |
tmp_pathspec, nonnull (strerror (errno))); |
|
6749 |
}
|
|
6750 |
}
|
|
6751 |
XFREE (tmp_pathspec); |
|
6752 |
||
6753 |
if (!has_symlinks) |
|
6754 |
{
|
|
6755 |
return xstrdup (pathspec); |
|
6756 |
}
|
|
6757 |
||
6758 |
tmp_pathspec = realpath (pathspec, buf); |
|
6759 |
if (tmp_pathspec == 0) |
|
6760 |
{
|
|
6761 |
lt_fatal (__FILE__, __LINE__,
|
|
6762 |
"could not follow symlinks for %s", pathspec); |
|
6763 |
}
|
|
6764 |
return xstrdup (tmp_pathspec); |
|
6765 |
#endif
|
|
6766 |
}
|
|
6767 |
||
6768 |
char * |
|
6769 |
strendzap (char *str, const char *pat) |
|
6770 |
{
|
|
6771 |
size_t len, patlen;
|
|
6772 |
||
6773 |
assert (str != NULL); |
|
6774 |
assert (pat != NULL); |
|
6775 |
||
6776 |
len = strlen (str); |
|
6777 |
patlen = strlen (pat); |
|
6778 |
||
6779 |
if (patlen <= len) |
|
6780 |
{
|
|
6781 |
str += len - patlen; |
|
6782 |
if (STREQ (str, pat)) |
|
6783 |
*str = '\0'; |
|
6784 |
}
|
|
6785 |
return str; |
|
6786 |
}
|
|
6787 |
||
6788 |
void |
|
6789 |
lt_debugprintf (const char *file, int line, const char *fmt, ...) |
|
6790 |
{
|
|
6791 |
va_list args;
|
|
6792 |
if (lt_debug) |
|
6793 |
{
|
|
6794 |
(void) fprintf (stderr, "%s:%s:%d: ", program_name, file, line); |
|
6795 |
va_start (args, fmt); |
|
6796 |
(void) vfprintf (stderr, fmt, args); |
|
6797 |
va_end (args); |
|
6798 |
}
|
|
6799 |
}
|
|
6800 |
||
6801 |
static void |
|
6802 |
lt_error_core (int exit_status, const char *file,
|
|
6803 |
int line, const char *mode, |
|
6804 |
const char *message, va_list ap)
|
|
6805 |
{
|
|
6806 |
fprintf (stderr, "%s:%s:%d: %s: ", program_name, file, line, mode); |
|
6807 |
vfprintf (stderr, message, ap); |
|
6808 |
fprintf (stderr, ".\n"); |
|
6809 |
||
6810 |
if (exit_status >= 0) |
|
6811 |
exit (exit_status); |
|
6812 |
}
|
|
6813 |
||
6814 |
void |
|
6815 |
lt_fatal (const char *file, int line, const char *message, ...) |
|
6816 |
{
|
|
6817 |
va_list ap;
|
|
6818 |
va_start (ap, message); |
|
6819 |
lt_error_core (EXIT_FAILURE, file, line, "FATAL", message, ap); |
|
6820 |
va_end (ap); |
|
6821 |
}
|
|
6822 |
||
6823 |
static const char * |
|
6824 |
nonnull (const char *s) |
|
6825 |
{
|
|
6826 |
return s ? s : "(null)"; |
|
6827 |
}
|
|
6828 |
||
6829 |
static const char * |
|
6830 |
nonempty (const char *s) |
|
6831 |
{
|
|
6832 |
return (s && !*s) ? "(empty)" : nonnull (s); |
|
6833 |
}
|
|
6834 |
||
6835 |
void |
|
6836 |
lt_setenv (const char *name, const char *value) |
|
6837 |
{
|
|
6838 |
lt_debugprintf (__FILE__, __LINE__,
|
|
6839 |
"(lt_setenv) setting '%s' to '%s'\n",
|
|
6840 |
nonnull (name), nonnull (value)); |
|
6841 |
{
|
|
6842 |
#ifdef HAVE_SETENV
|
|
6843 |
/* always make a copy, for consistency with !HAVE_SETENV */
|
|
6844 |
char *str = xstrdup (value); |
|
6845 |
setenv (name, str, 1); |
|
6846 |
#else
|
|
6847 |
size_t len = strlen (name) + 1 + strlen (value) + 1; |
|
6848 |
char *str = XMALLOC (char, len); |
|
6849 |
sprintf (str, "%s=%s", name, value); |
|
6850 |
if (putenv (str) != EXIT_SUCCESS) |
|
6851 |
{
|
|
6852 |
XFREE (str); |
|
6853 |
}
|
|
6854 |
#endif
|
|
6855 |
}
|
|
6856 |
}
|
|
6857 |
||
6858 |
char * |
|
6859 |
lt_extend_str (const char *orig_value, const char *add, int to_end) |
|
6860 |
{
|
|
6861 |
char *new_value;
|
|
6862 |
if (orig_value && *orig_value) |
|
6863 |
{
|
|
6864 |
size_t orig_value_len = strlen (orig_value); |
|
6865 |
size_t add_len = strlen (add); |
|
6866 |
new_value = XMALLOC (char, add_len + orig_value_len + 1); |
|
6867 |
if (to_end) |
|
6868 |
{
|
|
6869 |
strcpy (new_value, orig_value); |
|
6870 |
strcpy (new_value + orig_value_len, add); |
|
6871 |
}
|
|
6872 |
else
|
|
6873 |
{
|
|
6874 |
strcpy (new_value, add); |
|
6875 |
strcpy (new_value + add_len, orig_value); |
|
6876 |
}
|
|
6877 |
}
|
|
6878 |
else
|
|
6879 |
{
|
|
6880 |
new_value = xstrdup (add); |
|
6881 |
}
|
|
6882 |
return new_value; |
|
6883 |
}
|
|
6884 |
||
6885 |
void |
|
6886 |
lt_update_exe_path (const char *name, const char *value) |
|
6887 |
{
|
|
6888 |
lt_debugprintf (__FILE__, __LINE__,
|
|
6889 |
"(lt_update_exe_path) modifying '%s' by prepending '%s'\n",
|
|
6890 |
nonnull (name), nonnull (value)); |
|
6891 |
||
6892 |
if (name && *name && value && *value) |
|
6893 |
{
|
|
6894 |
char *new_value = lt_extend_str (getenv (name), value, 0); |
|
6895 |
/* some systems can't cope with a ':'-terminated path #' */ |
|
6896 |
size_t len = strlen (new_value); |
|
6897 |
while ((len > 0) && IS_PATH_SEPARATOR (new_value[len-1])) |
|
6898 |
{
|
|
6899 |
new_value[--len] = '\0'; |
|
6900 |
}
|
|
6901 |
lt_setenv (name, new_value); |
|
6902 |
XFREE (new_value); |
|
6903 |
}
|
|
6904 |
}
|
|
6905 |
||
6906 |
void |
|
6907 |
lt_update_lib_path (const char *name, const char *value) |
|
6908 |
{
|
|
6909 |
lt_debugprintf (__FILE__, __LINE__,
|
|
6910 |
"(lt_update_lib_path) modifying '%s' by prepending '%s'\n",
|
|
6911 |
nonnull (name), nonnull (value)); |
|
6912 |
||
6913 |
if (name && *name && value && *value) |
|
6914 |
{
|
|
6915 |
char *new_value = lt_extend_str (getenv (name), value, 0); |
|
6916 |
lt_setenv (name, new_value); |
|
6917 |
XFREE (new_value); |
|
6918 |
}
|
|
6919 |
}
|
|
6920 |
||
6921 |
EOF |
|
6922 |
case $host_os in |
|
6923 |
mingw*)
|
|
6924 |
cat <<"EOF"
|
|
6925 |
||
6926 |
/* Prepares an argument vector before calling spawn().
|
|
6927 |
Note that spawn() does not by itself call the command interpreter |
|
6928 |
(getenv ("COMSPEC") != NULL ? getenv ("COMSPEC") : |
|
6929 |
({ OSVERSIONINFO v; v.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); |
|
6930 |
GetVersionEx(&v); |
|
6931 |
v.dwPlatformId == VER_PLATFORM_WIN32_NT; |
|
6932 |
}) ? "cmd.exe" : "command.com"). |
|
6933 |
Instead it simply concatenates the arguments, separated by ' ', and calls
|
|
6934 |
CreateProcess(). We must quote the arguments since Win32 CreateProcess() |
|
6935 |
interprets characters like ' ', '\t', '\\', '"' (but not '<' and '>') in a |
|
6936 |
special way: |
|
6937 |
- Space and tab are interpreted as delimiters. They are not treated as |
|
6938 |
delimiters if they are surrounded by double quotes: "...". |
|
6939 |
- Unescaped double quotes are removed from the input. Their only effect is |
|
6940 |
that within double quotes, space and tab are treated like normal |
|
6941 |
characters. |
|
6942 |
- Backslashes not followed by double quotes are not special. |
|
6943 |
- But 2*n+1 backslashes followed by a double quote become
|
|
6944 |
n backslashes followed by a double quote (n >= 0): |
|
6945 |
\" -> " |
|
6946 |
\\\" -> \"
|
|
6947 |
\\\\\" -> \\"
|
|
6948 |
*/ |
|
6949 |
#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"
|
|
6950 |
#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"
|
|
6951 |
char ** |
|
6952 |
prepare_spawn (char **argv) |
|
6953 |
{
|
|
6954 |
size_t argc;
|
|
6955 |
char **new_argv;
|
|
6956 |
size_t i;
|
|
6957 |
||
6958 |
/* Count number of arguments. */ |
|
6959 |
for (argc = 0; argv[argc] != NULL; argc++) |
|
6960 |
;
|
|
6961 |
||
6962 |
/* Allocate new argument vector. */ |
|
6963 |
new_argv = XMALLOC (char *, argc + 1); |
|
6964 |
||
6965 |
/* Put quoted arguments into the new argument vector. */ |
|
6966 |
for (i = 0; i < argc; i++) |
|
6967 |
{
|
|
6968 |
const char *string = argv[i]; |
|
6969 |
||
6970 |
if (string[0] == '\0') |
|
6971 |
new_argv[i] = xstrdup ("\"\""); |
|
6972 |
else if (strpbrk (string, SHELL_SPECIAL_CHARS) != NULL) |
|
6973 |
{
|
|
6974 |
int quote_around = (strpbrk (string, SHELL_SPACE_CHARS) != NULL); |
|
6975 |
size_t length;
|
|
6976 |
unsigned int backslashes;
|
|
6977 |
const char *s;
|
|
6978 |
char *quoted_string;
|
|
6979 |
char *p;
|
|
6980 |
||
6981 |
length = 0; |
|
6982 |
backslashes = 0; |
|
6983 |
if (quote_around) |
|
6984 |
length++;
|
|
6985 |
for (s = string; *s != '\0'; s++) |
|
6986 |
{
|
|
6987 |
char c = *s; |
|
6988 |
if (c == '"') |
|
6989 |
length += backslashes + 1; |
|
6990 |
length++;
|
|
6991 |
if (c == '\\') |
|
6992 |
backslashes++;
|
|
6993 |
else
|
|
6994 |
backslashes = 0; |
|
6995 |
}
|
|
6996 |
if (quote_around) |
|
6997 |
length += backslashes + 1; |
|
6998 |
||
6999 |
quoted_string = XMALLOC (char, length + 1); |
|
7000 |
||
7001 |
p = quoted_string; |
|
7002 |
backslashes = 0; |
|
7003 |
if (quote_around) |
|
7004 |
*p++ = '"'; |
|
7005 |
for (s = string; *s != '\0'; s++) |
|
7006 |
{
|
|
7007 |
char c = *s; |
|
7008 |
if (c == '"') |
|
7009 |
{
|
|
7010 |
unsigned int j;
|
|
7011 |
for (j = backslashes + 1; j > 0; j--) |
|
7012 |
*p++ = '\\'; |
|
7013 |
}
|
|
7014 |
*p++ = c; |
|
7015 |
if (c == '\\') |
|
7016 |
backslashes++;
|
|
7017 |
else
|
|
7018 |
backslashes = 0; |
|
7019 |
}
|
|
7020 |
if (quote_around) |
|
7021 |
{
|
|
7022 |
unsigned int j;
|
|
7023 |
for (j = backslashes; j > 0; j--) |
|
7024 |
*p++ = '\\'; |
|
7025 |
*p++ = '"'; |
|
7026 |
}
|
|
7027 |
*p = '\0'; |
|
7028 |
||
7029 |
new_argv[i] = quoted_string; |
|
7030 |
}
|
|
7031 |
else
|
|
7032 |
new_argv[i] = (char *) string; |
|
7033 |
}
|
|
7034 |
new_argv[argc] = NULL; |
|
7035 |
||
7036 |
return new_argv; |
|
7037 |
}
|
|
7038 |
EOF |
|
7039 |
;;
|
|
7040 |
esac
|
|
7041 |
||
7042 |
cat <<"EOF"
|
|
7043 |
void lt_dump_script (FILE* f) |
|
7044 |
{
|
|
7045 |
EOF |
|
7046 |
func_emit_wrapper yes |
|
|
7047 |
$SED -n -e ' |
|
7048 |
s/^\(.\{79\}\)\(..*\)/\1\
|
|
7049 |
\2/
|
|
7050 |
h
|
|
7051 |
s/\([\\"]\)/\\\1/g
|
|
7052 |
s/$/\\n/
|
|
7053 |
s/\([^\n]*\).*/ fputs ("\1", f);/p
|
|
7054 |
g
|
|
7055 |
D'
|
|
7056 |
cat <<"EOF"
|
|
7057 |
}
|
|
7058 |
EOF |
|
7059 |
}
|
|
7060 |
# end: func_emit_cwrapperexe_src
|
|
7061 |
||
7062 |
# func_win32_import_lib_p ARG
|
|
7063 |
# True if ARG is an import lib, as indicated by $file_magic_cmd
|
|
7064 |
func_win32_import_lib_p ()
|
|
7065 |
{
|
|
7066 |
$debug_cmd
|
|
7067 |
||
7068 |
case `eval $file_magic_cmd \"\$1\" 2>/dev/null | $SED -e 10q` in |
|
7069 |
*import*) : ;; |
|
7070 |
*) false ;; |
|
7071 |
esac
|
|
7072 |
}
|
|
7073 |
||
7074 |
# func_suncc_cstd_abi
|
|
7075 |
# !!ONLY CALL THIS FOR SUN CC AFTER $compile_command IS FULLY EXPANDED!!
|
|
7076 |
# Several compiler flags select an ABI that is incompatible with the
|
|
7077 |
# Cstd library. Avoid specifying it if any are in CXXFLAGS.
|
|
7078 |
func_suncc_cstd_abi ()
|
|
7079 |
{
|
|
7080 |
$debug_cmd
|
|
7081 |
||
7082 |
case " $compile_command " in |
|
7083 |
*" -compat=g "*|*\ -std=c++[0-9][0-9]\ *|*" -library=stdcxx4 "*|*" -library=stlport4 "*) |
|
7084 |
suncc_use_cstd_abi=no |
|
7085 |
;;
|
|
7086 |
*)
|
|
7087 |
suncc_use_cstd_abi=yes |
|
7088 |
;;
|
|
7089 |
esac
|
|
7090 |
}
|
|
7091 |
||
7092 |
# func_mode_link arg...
|
|
7093 |
func_mode_link ()
|
|
7094 |
{
|
|
7095 |
$debug_cmd
|
|
7096 |
||
7097 |
case $host in |
|
7098 |
*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) |
|
7099 |
# It is impossible to link a dll without this setting, and
|
|
7100 |
# we shouldn't force the makefile maintainer to figure out
|
|
7101 |
# what system we are compiling for in order to pass an extra
|
|
7102 |
# flag for every libtool invocation.
|
|
7103 |
# allow_undefined=no
|
|
7104 |
||
7105 |
# FIXME: Unfortunately, there are problems with the above when trying
|
|
7106 |
# to make a dll that has undefined symbols, in which case not
|
|
7107 |
# even a static library is built. For now, we need to specify
|
|
7108 |
# -no-undefined on the libtool link line when we can be certain
|
|
7109 |
# that all symbols are satisfied, otherwise we get a static library.
|
|
7110 |
allow_undefined=yes |
|
7111 |
;;
|
|
7112 |
*)
|
|
7113 |
allow_undefined=yes |
|
7114 |
;;
|
|
7115 |
esac
|
|
7116 |
libtool_args=$nonopt |
|
7117 |
base_compile="$nonopt $@" |
|
7118 |
compile_command=$nonopt |
|
7119 |
finalize_command=$nonopt |
|
7120 |
||
7121 |
compile_rpath= |
|
7122 |
finalize_rpath= |
|
7123 |
compile_shlibpath= |
|
7124 |
finalize_shlibpath= |
|
7125 |
convenience= |
|
7126 |
old_convenience= |
|
7127 |
deplibs= |
|
7128 |
old_deplibs= |
|
7129 |
compiler_flags= |
|
7130 |
linker_flags= |
|
7131 |
dllsearchpath= |
|
7132 |
lib_search_path=`pwd` |
|
7133 |
inst_prefix_dir= |
|
7134 |
new_inherited_linker_flags= |
|
7135 |
||
7136 |
avoid_version=no |
|
7137 |
bindir= |
|
7138 |
dlfiles= |
|
7139 |
dlprefiles= |
|
7140 |
dlself=no |
|
7141 |
export_dynamic=no |
|
7142 |
export_symbols= |
|
7143 |
export_symbols_regex= |
|
7144 |
generated= |
|
7145 |
libobjs= |
|
7146 |
ltlibs= |
|
7147 |
module=no |
|
7148 |
no_install=no |
|
7149 |
objs= |
|
7150 |
os2dllname= |
|
7151 |
non_pic_objects= |
|
7152 |
precious_files_regex= |
|
7153 |
prefer_static_libs=no |
|
7154 |
preload=false |
|
7155 |
prev= |
|
7156 |
prevarg= |
|
7157 |
release= |
|
7158 |
rpath= |
|
7159 |
xrpath= |
|
7160 |
perm_rpath= |
|
7161 |
temp_rpath= |
|
7162 |
thread_safe=no |
|
7163 |
vinfo= |
|
7164 |
vinfo_number=no |
|
7165 |
weak_libs= |
|
7166 |
single_module=$wl-single_module |
|
7167 |
func_infer_tag $base_compile
|
|
7168 |
||
7169 |
# We need to know -static, to get the right output filenames.
|
|
7170 |
for arg
|
|
7171 |
do
|
|
7172 |
case $arg in |
|
7173 |
-shared)
|
|
7174 |
test yes != "$build_libtool_libs" \ |
|
7175 |
&& func_fatal_configuration "cannot build a shared library" |
|
7176 |
build_old_libs=no |
|
7177 |
break
|
|
7178 |
;;
|
|
7179 |
-all-static | -static | -static-libtool-libs) |
|
7180 |
case $arg in |
|
7181 |
-all-static)
|
|
7182 |
if test yes = "$build_libtool_libs" && test -z "$link_static_flag"; then |
|
7183 |
func_warning "complete static linking is impossible in this configuration"
|
|
7184 |
fi
|
|
7185 |
if test -n "$link_static_flag"; then |
|
7186 |
dlopen_self=$dlopen_self_static |
|
7187 |
fi
|
|
7188 |
prefer_static_libs=yes |
|
7189 |
;;
|
|
7190 |
-static)
|
|
7191 |
if test -z "$pic_flag" && test -n "$link_static_flag"; then |
|
7192 |
dlopen_self=$dlopen_self_static |
|
7193 |
fi
|
|
7194 |
prefer_static_libs=built |
|
7195 |
;;
|
|
7196 |
-static-libtool-libs)
|
|
7197 |
if test -z "$pic_flag" && test -n "$link_static_flag"; then |
|
7198 |
dlopen_self=$dlopen_self_static |
|
7199 |
fi
|
|
7200 |
prefer_static_libs=yes |
|
7201 |
;;
|
|
7202 |
esac
|
|
7203 |
build_libtool_libs=no |
|
7204 |
build_old_libs=yes |
|
7205 |
break
|
|
7206 |
;;
|
|
7207 |
esac
|
|
7208 |
done
|
|
7209 |
||
7210 |
# See if our shared archives depend on static archives.
|
|
7211 |
test -n "$old_archive_from_new_cmds" && build_old_libs=yes |
|
7212 |
||
7213 |
# Go through the arguments, transforming them on the way.
|
|
7214 |
while test "$#" -gt 0; do |
|
7215 |
arg=$1 |
|
7216 |
shift
|
|
7217 |
func_quote_for_eval "$arg" |
|
7218 |
qarg=$func_quote_for_eval_unquoted_result |
|
7219 |
func_append libtool_args " $func_quote_for_eval_result" |
|
7220 |
||
7221 |
# If the previous option needs an argument, assign it.
|
|
7222 |
if test -n "$prev"; then |
|
7223 |
case $prev in |
|
7224 |
output)
|
|
7225 |
func_append compile_command " @OUTPUT@"
|
|
7226 |
func_append finalize_command " @OUTPUT@"
|
|
7227 |
;;
|
|
7228 |
esac
|
|
7229 |
||
7230 |
case $prev in |
|
7231 |
bindir)
|
|
7232 |
bindir=$arg |
|
7233 |
prev= |
|
7234 |
continue
|
|
7235 |
;;
|
|
7236 |
dlfiles|dlprefiles) |
|
7237 |
$preload || { |
|
7238 |
# Add the symbol object into the linking commands.
|
|
7239 |
func_append compile_command " @SYMFILE@"
|
|
7240 |
func_append finalize_command " @SYMFILE@"
|
|
7241 |
preload=: |
|
7242 |
}
|
|
7243 |
case $arg in |
|
7244 |
*.la | *.lo) ;; # We handle these cases below. |
|
7245 |
force)
|
|
7246 |
if test no = "$dlself"; then |
|
7247 |
dlself=needless |
|
7248 |
export_dynamic=yes |
|
7249 |
fi
|
|
7250 |
prev= |
|
7251 |
continue
|
|
7252 |
;;
|
|
7253 |
self)
|
|
7254 |
if test dlprefiles = "$prev"; then |
|
7255 |
dlself=yes |
|
7256 |
elif test dlfiles = "$prev" && test yes != "$dlopen_self"; then |
|
7257 |
dlself=yes |
|
7258 |
else
|
|
7259 |
dlself=needless |
|
7260 |
export_dynamic=yes |
|
7261 |
fi
|
|
7262 |
prev= |
|
7263 |
continue
|
|
7264 |
;;
|
|
7265 |
*)
|
|
7266 |
if test dlfiles = "$prev"; then |
|
7267 |
func_append dlfiles " $arg" |
|
7268 |
else
|
|
7269 |
func_append dlprefiles " $arg" |
|
7270 |
fi
|
|
7271 |
prev= |
|
7272 |
continue
|
|
7273 |
;;
|
|
7274 |
esac
|
|
7275 |
;;
|
|
7276 |
expsyms)
|
|
7277 |
export_symbols=$arg |
|
7278 |
test -f "$arg" \ |
|
7279 |
|| func_fatal_error "symbol file '$arg' does not exist" |
|
7280 |
prev= |
|
7281 |
continue
|
|
7282 |
;;
|
|
7283 |
expsyms_regex)
|
|
7284 |
export_symbols_regex=$arg |
|
7285 |
prev= |
|
7286 |
continue
|
|
7287 |
;;
|
|
7288 |
framework)
|
|
7289 |
case $host in |
|
7290 |
*-*-darwin*)
|
|
7291 |
case "$deplibs " in |
|
7292 |
*" $qarg.ltframework "*) ;; |
|
7293 |
*) func_append deplibs " $qarg.ltframework" # this is fixed later |
|
7294 |
;;
|
|
7295 |
esac
|
|
7296 |
;;
|
|
7297 |
esac
|
|
7298 |
prev= |
|
7299 |
continue
|
|
7300 |
;;
|
|
7301 |
inst_prefix)
|
|
7302 |
inst_prefix_dir=$arg |
|
7303 |
prev= |
|
7304 |
continue
|
|
7305 |
;;
|
|
7306 |
mllvm)
|
|
7307 |
# Clang does not use LLVM to link, so we can simply discard any
|
|
7308 |
# '-mllvm $arg' options when doing the link step.
|
|
7309 |
prev= |
|
7310 |
continue
|
|
7311 |
;;
|
|
7312 |
objectlist)
|
|
7313 |
if test -f "$arg"; then |
|
7314 |
save_arg=$arg |
|
7315 |
moreargs= |
|
7316 |
for fil in `cat "$save_arg"` |
|
7317 |
do
|
|
7318 |
# func_append moreargs " $fil"
|
|
7319 |
arg=$fil |
|
7320 |
# A libtool-controlled object.
|
|
7321 |
||
7322 |
# Check to see that this really is a libtool object.
|
|
7323 |
if func_lalib_unsafe_p "$arg"; then |
|
7324 |
pic_object= |
|
7325 |
non_pic_object= |
|
7326 |
||
7327 |
# Read the .lo file
|
|
7328 |
func_source "$arg" |
|
7329 |
||
7330 |
if test -z "$pic_object" || |
|
7331 |
test -z "$non_pic_object" || |
|
7332 |
test none = "$pic_object" && |
|
7333 |
test none = "$non_pic_object"; then |
|
7334 |
func_fatal_error "cannot find name of object for '$arg'" |
|
7335 |
fi
|
|
7336 |
||
7337 |
# Extract subdirectory from the argument.
|
|
7338 |
func_dirname "$arg" "/" "" |
|
7339 |
xdir=$func_dirname_result |
|
7340 |
||
7341 |
if test none != "$pic_object"; then |
|
7342 |
# Prepend the subdirectory the object is found in.
|
|
7343 |
pic_object=$xdir$pic_object |
|
7344 |
||
7345 |
if test dlfiles = "$prev"; then |
|
7346 |
if test yes = "$build_libtool_libs" && test yes = "$dlopen_support"; then |
|
7347 |
func_append dlfiles " $pic_object" |
|
7348 |
prev= |
|
7349 |
continue
|
|
7350 |
else
|
|
7351 |
# If libtool objects are unsupported, then we need to preload.
|
|
7352 |
prev=dlprefiles |
|
7353 |
fi
|
|
7354 |
fi
|
|
7355 |
||
7356 |
# CHECK ME: I think I busted this. -Ossama
|
|
7357 |
if test dlprefiles = "$prev"; then |
|
7358 |
# Preload the old-style object.
|
|
7359 |
func_append dlprefiles " $pic_object" |
|
7360 |
prev= |
|
7361 |
fi
|
|
7362 |
||
7363 |
# A PIC object.
|
|
7364 |
func_append libobjs " $pic_object" |
|
7365 |
arg=$pic_object |
|
7366 |
fi
|
|
7367 |
||
7368 |
# Non-PIC object.
|
|
7369 |
if test none != "$non_pic_object"; then |
|
7370 |
# Prepend the subdirectory the object is found in.
|
|
7371 |
non_pic_object=$xdir$non_pic_object |
|
7372 |
||
7373 |
# A standard non-PIC object
|
|
7374 |
func_append non_pic_objects " $non_pic_object" |
|
7375 |
if test -z "$pic_object" || test none = "$pic_object"; then |
|
7376 |
arg=$non_pic_object |
|
7377 |
fi
|
|
7378 |
else
|
|
7379 |
# If the PIC object exists, use it instead.
|
|
7380 |
# $xdir was prepended to $pic_object above.
|
|
7381 |
non_pic_object=$pic_object |
|
7382 |
func_append non_pic_objects " $non_pic_object" |
|
7383 |
fi
|
|
7384 |
else
|
|
7385 |
# Only an error if not doing a dry-run.
|
|
7386 |
if $opt_dry_run; then |
|
7387 |
# Extract subdirectory from the argument.
|
|
7388 |
func_dirname "$arg" "/" "" |
|
7389 |
xdir=$func_dirname_result |
|
7390 |
||
7391 |
func_lo2o "$arg" |
|
7392 |
pic_object=$xdir$objdir/$func_lo2o_result |
|
7393 |
non_pic_object=$xdir$func_lo2o_result |
|
7394 |
func_append libobjs " $pic_object" |
|
7395 |
func_append non_pic_objects " $non_pic_object" |
|
7396 |
else
|
|
7397 |
func_fatal_error "'$arg' is not a valid libtool object" |
|
7398 |
fi
|
|
7399 |
fi
|
|
7400 |
done
|
|
7401 |
else
|
|
7402 |
func_fatal_error "link input file '$arg' does not exist" |
|
7403 |
fi
|
|
7404 |
arg=$save_arg |
|
7405 |
prev= |
|
7406 |
continue
|
|
7407 |
;;
|
|
7408 |
os2dllname)
|
|
7409 |
os2dllname=$arg |
|
7410 |
prev= |
|
7411 |
continue
|
|
7412 |
;;
|
|
7413 |
precious_regex)
|
|
7414 |
precious_files_regex=$arg |
|
7415 |
prev= |
|
7416 |
continue
|
|
7417 |
;;
|
|
7418 |
release)
|
|
7419 |
release=-$arg |
|
7420 |
prev= |
|
7421 |
continue
|
|
7422 |
;;
|
|
7423 |
rpath | xrpath) |
|
7424 |
# We need an absolute path.
|
|
7425 |
case $arg in |
|
7426 |
[\\/]* | [A-Za-z]:[\\/]*) ;; |
|
7427 |
*)
|
|
7428 |
func_fatal_error "only absolute run-paths are allowed"
|
|
7429 |
;;
|
|
7430 |
esac
|
|
7431 |
if test rpath = "$prev"; then |
|
7432 |
case "$rpath " in |
|
7433 |
*" $arg "*) ;; |
|
7434 |
*) func_append rpath " $arg" ;; |
|
7435 |
esac
|
|
7436 |
else
|
|
7437 |
case "$xrpath " in |
|
7438 |
*" $arg "*) ;; |
|
7439 |
*) func_append xrpath " $arg" ;; |
|
7440 |
esac
|
|
7441 |
fi
|
|
7442 |
prev= |
|
7443 |
continue
|
|
7444 |
;;
|
|
7445 |
shrext)
|
|
7446 |
shrext_cmds=$arg |
|
7447 |
prev= |
|
7448 |
continue
|
|
7449 |
;;
|
|
7450 |
weak)
|
|
7451 |
func_append weak_libs " $arg" |
|
7452 |
prev= |
|
7453 |
continue
|
|
7454 |
;;
|
|
7455 |
xcclinker)
|
|
7456 |
func_append linker_flags " $qarg" |
|
7457 |
func_append compiler_flags " $qarg" |
|
7458 |
prev= |
|
7459 |
func_append compile_command " $qarg" |
|
7460 |
func_append finalize_command " $qarg" |
|
7461 |
continue
|
|
7462 |
;;
|
|
7463 |
xcompiler)
|
|
7464 |
func_append compiler_flags " $qarg" |
|
7465 |
prev= |
|
7466 |
func_append compile_command " $qarg" |
|
7467 |
func_append finalize_command " $qarg" |
|
7468 |
continue
|
|
7469 |
;;
|
|
7470 |
xlinker)
|
|
7471 |
func_append linker_flags " $qarg" |
|
7472 |
func_append compiler_flags " $wl$qarg" |
|
7473 |
prev= |
|
7474 |
func_append compile_command " $wl$qarg" |
|
7475 |
func_append finalize_command " $wl$qarg" |
|
7476 |
continue
|
|
7477 |
;;
|
|
7478 |
*)
|
|
7479 |
eval "$prev=\"\$arg\"" |
|
7480 |
prev= |
|
7481 |
continue
|
|
7482 |
;;
|
|
7483 |
esac
|
|
7484 |
fi # test -n "$prev" |
|
7485 |
||
7486 |
prevarg=$arg |
|
7487 |
||
7488 |
case $arg in |
|
7489 |
-all-static)
|
|
7490 |
if test -n "$link_static_flag"; then |
|
7491 |
# See comment for -static flag below, for more details.
|
|
7492 |
func_append compile_command " $link_static_flag" |
|
7493 |
func_append finalize_command " $link_static_flag" |
|
7494 |
fi
|
|
7495 |
continue
|
|
7496 |
;;
|
|
7497 |
||
7498 |
-allow-undefined)
|
|
7499 |
# FIXME: remove this flag sometime in the future.
|
|
7500 |
func_fatal_error "'-allow-undefined' must not be used because it is the default"
|
|
7501 |
;;
|
|
7502 |
||
7503 |
-avoid-version)
|
|
7504 |
avoid_version=yes |
|
7505 |
continue
|
|
7506 |
;;
|
|
7507 |
||
7508 |
-bindir)
|
|
7509 |
prev=bindir |
|
7510 |
continue
|
|
7511 |
;;
|
|
7512 |
||
7513 |
-dlopen)
|
|
7514 |
prev=dlfiles |
|
7515 |
continue
|
|
7516 |
;;
|
|
7517 |
||
7518 |
-dlpreopen)
|
|
7519 |
prev=dlprefiles |
|
7520 |
continue
|
|
7521 |
;;
|
|
7522 |
||
7523 |
-export-dynamic)
|
|
7524 |
export_dynamic=yes |
|
7525 |
continue
|
|
7526 |
;;
|
|
7527 |
||
7528 |
-export-symbols | -export-symbols-regex) |
|
7529 |
if test -n "$export_symbols" || test -n "$export_symbols_regex"; then |
|
7530 |
func_fatal_error "more than one -exported-symbols argument is not allowed"
|
|
7531 |
fi
|
|
7532 |
if test X-export-symbols = "X$arg"; then |
|
7533 |
prev=expsyms |
|
7534 |
else
|
|
7535 |
prev=expsyms_regex |
|
7536 |
fi
|
|
7537 |
continue
|
|
7538 |
;;
|
|
7539 |
||
7540 |
-framework)
|
|
7541 |
prev=framework |
|
7542 |
continue
|
|
7543 |
;;
|
|
7544 |
||
7545 |
-inst-prefix-dir)
|
|
7546 |
prev=inst_prefix |
|
7547 |
continue
|
|
7548 |
;;
|
|
7549 |
||
7550 |
# The native IRIX linker understands -LANG:*, -LIST:* and -LNO:*
|
|
7551 |
# so, if we see these flags be careful not to treat them like -L
|
|
7552 |
-L[A-Z][A-Z]*:*) |
|
7553 |
case $with_gcc/$host in |
|
7554 |
no/*-*-irix* | /*-*-irix*) |
|
7555 |
func_append compile_command " $arg" |
|
7556 |
func_append finalize_command " $arg" |
|
7557 |
;;
|
|
7558 |
esac
|
|
7559 |
continue
|
|
7560 |
;;
|
|
7561 |
||
7562 |
-L*)
|
|
7563 |
func_stripname "-L" '' "$arg" |
|
7564 |
if test -z "$func_stripname_result"; then |
|
7565 |
if test "$#" -gt 0; then |
|
7566 |
func_fatal_error "require no space between '-L' and '$1'" |
|
7567 |
else
|
|
7568 |
func_fatal_error "need path for '-L' option"
|
|
7569 |
fi
|
|
7570 |
fi
|
|
7571 |
func_resolve_sysroot "$func_stripname_result" |
|
7572 |
dir=$func_resolve_sysroot_result |
|
7573 |
# We need an absolute path.
|
|
7574 |
case $dir in |
|
7575 |
[\\/]* | [A-Za-z]:[\\/]*) ;; |
|
7576 |
*)
|
|
7577 |
absdir=`cd "$dir" && pwd` |
|
7578 |
test -z "$absdir" && \ |
|
7579 |
func_fatal_error "cannot determine absolute directory name of '$dir'" |
|
7580 |
dir=$absdir |
|
7581 |
;;
|
|
7582 |
esac
|
|
7583 |
case "$deplibs " in |
|
7584 |
*" -L$dir "* | *" $arg "*) |
|
7585 |
# Will only happen for absolute or sysroot arguments
|
|
7586 |
;;
|
|
7587 |
*)
|
|
7588 |
# Preserve sysroot, but never include relative directories
|
|
7589 |
case $dir in |
|
7590 |
[\\/]* | [A-Za-z]:[\\/]* | =*) func_append deplibs " $arg" ;; |
|
7591 |
*) func_append deplibs " -L$dir" ;; |
|
7592 |
esac
|
|
7593 |
func_append lib_search_path " $dir" |
|
7594 |
;;
|
|
7595 |
esac
|
|
7596 |
case $host in |
|
7597 |
*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) |
|
7598 |
testbindir=`$ECHO "$dir" | $SED 's*/lib$*/bin*'` |
|
7599 |
case :$dllsearchpath: in |
|
7600 |
*":$dir:"*) ;; |
|
7601 |
::) dllsearchpath=$dir;; |
|
7602 |
*) func_append dllsearchpath ":$dir";; |
|
7603 |
esac
|
|
7604 |
case :$dllsearchpath: in |
|
7605 |
*":$testbindir:"*) ;; |
|
7606 |
::) dllsearchpath=$testbindir;; |
|
7607 |
*) func_append dllsearchpath ":$testbindir";; |
|
7608 |
esac
|
|
7609 |
;;
|
|
7610 |
esac
|
|
7611 |
continue
|
|
7612 |
;;
|
|
7613 |
||
7614 |
-l*)
|
|
7615 |
if test X-lc = "X$arg" || test X-lm = "X$arg"; then |
|
7616 |
case $host in |
|
7617 |
*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos* | *-cegcc* | *-*-haiku*) |
|
7618 |
# These systems don't actually have a C or math library (as such)
|
|
7619 |
continue
|
|
7620 |
;;
|
|
7621 |
*-*-os2*)
|
|
7622 |
# These systems don't actually have a C library (as such)
|
|
7623 |
test X-lc = "X$arg" && continue |
|
7624 |
;;
|
|
7625 |
*-*-openbsd* | *-*-freebsd* | *-*-dragonfly* | *-*-bitrig*) |
|
7626 |
# Do not include libc due to us having libc/libc_r.
|
|
7627 |
test X-lc = "X$arg" && continue |
|
7628 |
;;
|
|
7629 |
*-*-rhapsody* | *-*-darwin1.[012]) |
|
7630 |
# Rhapsody C and math libraries are in the System framework
|
|
7631 |
func_append deplibs " System.ltframework"
|
|
7632 |
continue
|
|
7633 |
;;
|
|
7634 |
*-*-sco3.2v5* | *-*-sco5v6*) |
|
7635 |
# Causes problems with __ctype
|
|
7636 |
test X-lc = "X$arg" && continue |
|
7637 |
;;
|
|
7638 |
*-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) |
|
7639 |
# Compiler inserts libc in the correct place for threads to work
|
|
7640 |
test X-lc = "X$arg" && continue |
|
7641 |
;;
|
|
7642 |
esac
|
|
7643 |
elif test X-lc_r = "X$arg"; then |
|
7644 |
case $host in |
|
7645 |
*-*-openbsd* | *-*-freebsd* | *-*-dragonfly* | *-*-bitrig*) |
|
7646 |
# Do not include libc_r directly, use -pthread flag.
|
|
7647 |
continue
|
|
7648 |
;;
|
|
7649 |
esac
|
|
7650 |
fi
|
|
7651 |
func_append deplibs " $arg" |
|
7652 |
continue
|
|
7653 |
;;
|
|
7654 |
||
7655 |
-mllvm)
|
|
7656 |
prev=mllvm |
|
7657 |
continue
|
|
7658 |
;;
|
|
7659 |
||
7660 |
-module)
|
|
7661 |
module=yes |
|
7662 |
continue
|
|
7663 |
;;
|
|
7664 |
||
7665 |
# Tru64 UNIX uses -model [arg] to determine the layout of C++
|
|
7666 |
# classes, name mangling, and exception handling.
|
|
7667 |
# Darwin uses the -arch flag to determine output architecture.
|
|
7668 |
-model|-arch|-isysroot|--sysroot) |
|
7669 |
func_append compiler_flags " $arg" |
|
7670 |
func_append compile_command " $arg" |
|
7671 |
func_append finalize_command " $arg" |
|
7672 |
prev=xcompiler |
|
7673 |
continue
|
|
7674 |
;;
|
|
7675 |
||
7676 |
-mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe \ |
|
7677 |
|-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*) |
|
7678 |
func_append compiler_flags " $arg" |
|
7679 |
func_append compile_command " $arg" |
|
7680 |
func_append finalize_command " $arg" |
|
7681 |
case "$new_inherited_linker_flags " in |
|
7682 |
*" $arg "*) ;; |
|
7683 |
* ) func_append new_inherited_linker_flags " $arg" ;; |
|
7684 |
esac
|
|
7685 |
continue
|
|
7686 |
;;
|
|
7687 |
||
7688 |
-multi_module)
|
|
7689 |
single_module=$wl-multi_module |
|
7690 |
continue
|
|
7691 |
;;
|
|
7692 |
||
7693 |
-no-fast-install)
|
|
7694 |
fast_install=no |
|
7695 |
continue
|
|
7696 |
;;
|
|
7697 |
||
7698 |
-no-install)
|
|
7699 |
case $host in |
|
7700 |
*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin* | *-cegcc*) |
|
7701 |
# The PATH hackery in wrapper scripts is required on Windows
|
|
7702 |
# and Darwin in order for the loader to find any dlls it needs.
|
|
7703 |
func_warning "'-no-install' is ignored for $host" |
|
7704 |
func_warning "assuming '-no-fast-install' instead"
|
|
7705 |
fast_install=no |
|
7706 |
;;
|
|
7707 |
*) no_install=yes ;; |
|
7708 |
esac
|
|
7709 |
continue
|
|
7710 |
;;
|
|
7711 |
||
7712 |
-no-undefined)
|
|
7713 |
allow_undefined=no |
|
7714 |
continue
|
|
7715 |
;;
|
|
7716 |
||
7717 |
-objectlist)
|
|
7718 |
prev=objectlist |
|
7719 |
continue
|
|
7720 |
;;
|
|
7721 |
||
7722 |
-os2dllname)
|
|
7723 |
prev=os2dllname |
|
7724 |
continue
|
|
7725 |
;;
|
|
7726 |
||
7727 |
-o) prev=output ;; |
|
7728 |
||
7729 |
-precious-files-regex)
|
|
7730 |
prev=precious_regex |
|
7731 |
continue
|
|
7732 |
;;
|
|
7733 |
||
7734 |
-release)
|
|
7735 |
prev=release |
|
7736 |
continue
|
|
7737 |
;;
|
|
7738 |
||
7739 |
-rpath)
|
|
7740 |
prev=rpath |
|
7741 |
continue
|
|
7742 |
;;
|
|
7743 |
||
7744 |
-R)
|
|
7745 |
prev=xrpath |
|
7746 |
continue
|
|
7747 |
;;
|
|
7748 |
||
7749 |
-R*)
|
|
7750 |
func_stripname '-R' '' "$arg" |
|
7751 |
dir=$func_stripname_result |
|
7752 |
# We need an absolute path.
|
|
7753 |
case $dir in |
|
7754 |
[\\/]* | [A-Za-z]:[\\/]*) ;; |
|
7755 |
=*) |
|
7756 |
func_stripname '=' '' "$dir" |
|
7757 |
dir=$lt_sysroot$func_stripname_result |
|
7758 |
;;
|
|
7759 |
*)
|
|
7760 |
func_fatal_error "only absolute run-paths are allowed"
|
|
7761 |
;;
|
|
7762 |
esac
|
|
7763 |
case "$xrpath " in |
|
7764 |
*" $dir "*) ;; |
|
7765 |
*) func_append xrpath " $dir" ;; |
|
7766 |
esac
|
|
7767 |
continue
|
|
7768 |
;;
|
|
7769 |
||
7770 |
-shared)
|
|
7771 |
# The effects of -shared are defined in a previous loop.
|
|
7772 |
continue
|
|
7773 |
;;
|
|
7774 |
||
7775 |
-shrext)
|
|
7776 |
prev=shrext |
|
7777 |
continue
|
|
7778 |
;;
|
|
7779 |
||
7780 |
-static | -static-libtool-libs) |
|
7781 |
# The effects of -static are defined in a previous loop.
|
|
7782 |
# We used to do the same as -all-static on platforms that
|
|
7783 |
# didn't have a PIC flag, but the assumption that the effects
|
|
7784 |
# would be equivalent was wrong. It would break on at least
|
|
7785 |
# Digital Unix and AIX.
|
|
7786 |
continue
|
|
7787 |
;;
|
|
7788 |
||
7789 |
-thread-safe)
|
|
7790 |
thread_safe=yes |
|
7791 |
continue
|
|
7792 |
;;
|
|
7793 |
||
7794 |
-version-info)
|
|
7795 |
prev=vinfo |
|
7796 |
continue
|
|
7797 |
;;
|
|
7798 |
||
7799 |
-version-number)
|
|
7800 |
prev=vinfo |
|
7801 |
vinfo_number=yes |
|
7802 |
continue
|
|
7803 |
;;
|
|
7804 |
||
7805 |
-weak)
|
|
7806 |
prev=weak |
|
7807 |
continue
|
|
7808 |
;;
|
|
7809 |
||
7810 |
-Wc,*)
|
|
7811 |
func_stripname '-Wc,' '' "$arg" |
|
7812 |
args=$func_stripname_result |
|
7813 |
arg= |
|
7814 |
save_ifs=$IFS; IFS=, |
|
7815 |
for flag in $args; do |
|
7816 |
IFS=$save_ifs |
|
7817 |
func_quote_for_eval "$flag" |
|
7818 |
func_append arg " $func_quote_for_eval_result" |
|
7819 |
func_append compiler_flags " $func_quote_for_eval_result" |
|
7820 |
done
|
|
7821 |
IFS=$save_ifs |
|
7822 |
func_stripname ' ' '' "$arg" |
|
7823 |
arg=$func_stripname_result |
|
7824 |
;;
|
|
7825 |
||
7826 |
-Wl,*)
|
|
7827 |
func_stripname '-Wl,' '' "$arg" |
|
7828 |
args=$func_stripname_result |
|
7829 |
arg= |
|
7830 |
save_ifs=$IFS; IFS=, |
|
7831 |
for flag in $args; do |
|
7832 |
IFS=$save_ifs |
|
7833 |
func_quote_for_eval "$flag" |
|
7834 |
func_append arg " $wl$func_quote_for_eval_result" |
|
7835 |
func_append compiler_flags " $wl$func_quote_for_eval_result" |
|
7836 |
func_append linker_flags " $func_quote_for_eval_result" |
|
7837 |
done
|
|
7838 |
IFS=$save_ifs |
|
7839 |
func_stripname ' ' '' "$arg" |
|
7840 |
arg=$func_stripname_result |
|
7841 |
;;
|
|
7842 |
||
7843 |
-Xcompiler)
|
|
7844 |
prev=xcompiler |
|
7845 |
continue
|
|
7846 |
;;
|
|
7847 |
||
7848 |
-Xlinker)
|
|
7849 |
prev=xlinker |
|
7850 |
continue
|
|
7851 |
;;
|
|
7852 |
||
7853 |
-XCClinker)
|
|
7854 |
prev=xcclinker |
|
7855 |
continue
|
|
7856 |
;;
|
|
7857 |
||
7858 |
# -msg_* for osf cc
|
|
7859 |
-msg_*)
|
|
7860 |
func_quote_for_eval "$arg" |
|
7861 |
arg=$func_quote_for_eval_result |
|
7862 |
;;
|
|
7863 |
||
7864 |
# Flags to be passed through unchanged, with rationale:
|
|
7865 |
# -64, -mips[0-9] enable 64-bit mode for the SGI compiler
|
|
7866 |
# -r[0-9][0-9]* specify processor for the SGI compiler
|
|
7867 |
# -xarch=*, -xtarget=* enable 64-bit mode for the Sun compiler
|
|
7868 |
# +DA*, +DD* enable 64-bit mode for the HP compiler
|
|
7869 |
# -q* compiler args for the IBM compiler
|
|
7870 |
# -m*, -t[45]*, -txscale* architecture-specific flags for GCC
|
|
7871 |
# -F/path path to uninstalled frameworks, gcc on darwin
|
|
7872 |
# -p, -pg, --coverage, -fprofile-* profiling flags for GCC
|
|
7873 |
# -fstack-protector* stack protector flags for GCC
|
|
7874 |
# @file GCC response files
|
|
7875 |
# -tp=* Portland pgcc target processor selection
|
|
7876 |
# --sysroot=* for sysroot support
|
|
7877 |
# -O*, -g*, -flto*, -fwhopr*, -fuse-linker-plugin GCC link-time optimization
|
|
7878 |
# -specs=* GCC specs files
|
|
7879 |
# -stdlib=* select c++ std lib with clang
|
|
7880 |
# -fsanitize=* Clang/GCC memory and address sanitizer
|
|
7881 |
# -fuse-ld=* Linker select flags for GCC
|
|
7882 |
# -static-* direct GCC to link specific libraries statically
|
|
7883 |
# -fcilkplus Cilk Plus language extension features for C/C++
|
|
7884 |
-64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \ |
|
7885 |
-t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*|-tp=*|--sysroot=*| \ |
|
7886 |
-O*|-g*|-flto*|-fwhopr*|-fuse-linker-plugin|-fstack-protector*|-stdlib=*| \ |
|
7887 |
-specs=*|-fsanitize=*|-fuse-ld=*|-static-*|-fcilkplus) |
|
7888 |
func_quote_for_eval "$arg" |
|
7889 |
arg=$func_quote_for_eval_result |
|
7890 |
func_append compile_command " $arg" |
|
7891 |
func_append finalize_command " $arg" |
|
7892 |
func_append compiler_flags " $arg" |
|
7893 |
continue
|
|
7894 |
;;
|
|
7895 |
||
7896 |
-Z*)
|
|
7897 |
if test os2 = "`expr $host : '.*\(os2\)'`"; then |
|
7898 |
# OS/2 uses -Zxxx to specify OS/2-specific options
|
|
7899 |
compiler_flags="$compiler_flags $arg" |
|
7900 |
func_append compile_command " $arg" |
|
7901 |
func_append finalize_command " $arg" |
|
7902 |
case $arg in |
|
7903 |
-Zlinker | -Zstack) |
|
7904 |
prev=xcompiler |
|
7905 |
;;
|
|
7906 |
esac
|
|
7907 |
continue
|
|
7908 |
else
|
|
7909 |
# Otherwise treat like 'Some other compiler flag' below
|
|
7910 |
func_quote_for_eval "$arg" |
|
7911 |
arg=$func_quote_for_eval_result |
|
7912 |
fi
|
|
7913 |
;;
|
|
7914 |
||
7915 |
# Some other compiler flag.
|
|
7916 |
-* | +*) |
|
7917 |
func_quote_for_eval "$arg" |
|
7918 |
arg=$func_quote_for_eval_result |
|
7919 |
;;
|
|
7920 |
||
7921 |
*.$objext) |
|
7922 |
# A standard object.
|
|
7923 |
func_append objs " $arg" |
|
7924 |
;;
|
|
7925 |
||
7926 |
*.lo)
|
|
7927 |
# A libtool-controlled object.
|
|
7928 |
||
7929 |
# Check to see that this really is a libtool object.
|
|
7930 |
if func_lalib_unsafe_p "$arg"; then |
|
7931 |
pic_object= |
|
7932 |
non_pic_object= |
|
7933 |
||
7934 |
# Read the .lo file
|
|
7935 |
func_source "$arg" |
|
7936 |
||
7937 |
if test -z "$pic_object" || |
|
7938 |
test -z "$non_pic_object" || |
|
7939 |
test none = "$pic_object" && |
|
7940 |
test none = "$non_pic_object"; then |
|
7941 |
func_fatal_error "cannot find name of object for '$arg'" |
|
7942 |
fi
|
|
7943 |
||
7944 |
# Extract subdirectory from the argument.
|
|
7945 |
func_dirname "$arg" "/" "" |
|
7946 |
xdir=$func_dirname_result |
|
7947 |
||
7948 |
test none = "$pic_object" || { |
|
7949 |
# Prepend the subdirectory the object is found in.
|
|
7950 |
pic_object=$xdir$pic_object |
|
7951 |
||
7952 |
if test dlfiles = "$prev"; then |
|
7953 |
if test yes = "$build_libtool_libs" && test yes = "$dlopen_support"; then |
|
7954 |
func_append dlfiles " $pic_object" |
|
7955 |
prev= |
|
7956 |
continue
|
|
7957 |
else
|
|
7958 |
# If libtool objects are unsupported, then we need to preload.
|
|
7959 |
prev=dlprefiles |
|
7960 |
fi
|
|
7961 |
fi
|
|
7962 |
||
7963 |
# CHECK ME: I think I busted this. -Ossama
|
|
7964 |
if test dlprefiles = "$prev"; then |
|
7965 |
# Preload the old-style object.
|
|
7966 |
func_append dlprefiles " $pic_object" |
|
7967 |
prev= |
|
7968 |
fi
|
|
7969 |
||
7970 |
# A PIC object.
|
|
7971 |
func_append libobjs " $pic_object" |
|
7972 |
arg=$pic_object |
|
7973 |
}
|
|
7974 |
||
7975 |
# Non-PIC object.
|
|
7976 |
if test none != "$non_pic_object"; then |
|
7977 |
# Prepend the subdirectory the object is found in.
|
|
7978 |
non_pic_object=$xdir$non_pic_object |
|
7979 |
||
7980 |
# A standard non-PIC object
|
|
7981 |
func_append non_pic_objects " $non_pic_object" |
|
7982 |
if test -z "$pic_object" || test none = "$pic_object"; then |
|
7983 |
arg=$non_pic_object |
|
7984 |
fi
|
|
7985 |
else
|
|
7986 |
# If the PIC object exists, use it instead.
|
|
7987 |
# $xdir was prepended to $pic_object above.
|
|
7988 |
non_pic_object=$pic_object |
|
7989 |
func_append non_pic_objects " $non_pic_object" |
|
7990 |
fi
|
|
7991 |
else
|
|
7992 |
# Only an error if not doing a dry-run.
|
|
7993 |
if $opt_dry_run; then |
|
7994 |
# Extract subdirectory from the argument.
|
|
7995 |
func_dirname "$arg" "/" "" |
|
7996 |
xdir=$func_dirname_result |
|
7997 |
||
7998 |
func_lo2o "$arg" |
|
7999 |
pic_object=$xdir$objdir/$func_lo2o_result |
|
8000 |
non_pic_object=$xdir$func_lo2o_result |
|
8001 |
func_append libobjs " $pic_object" |
|
8002 |
func_append non_pic_objects " $non_pic_object" |
|
8003 |
else
|
|
8004 |
func_fatal_error "'$arg' is not a valid libtool object" |
|
8005 |
fi
|
|
8006 |
fi
|
|
8007 |
;;
|
|
8008 |
||
8009 |
*.$libext) |
|
8010 |
# An archive.
|
|
8011 |
func_append deplibs " $arg" |
|
8012 |
func_append old_deplibs " $arg" |
|
8013 |
continue
|
|
8014 |
;;
|
|
8015 |
||
8016 |
*.la)
|
|
8017 |
# A libtool-controlled library.
|
|
8018 |
||
8019 |
func_resolve_sysroot "$arg" |
|
8020 |
if test dlfiles = "$prev"; then |
|
8021 |
# This library was specified with -dlopen.
|
|
8022 |
func_append dlfiles " $func_resolve_sysroot_result" |
|
8023 |
prev= |
|
8024 |
elif test dlprefiles = "$prev"; then |
|
8025 |
# The library was specified with -dlpreopen.
|
|
8026 |
func_append dlprefiles " $func_resolve_sysroot_result" |
|
8027 |
prev= |
|
8028 |
else
|
|
8029 |
func_append deplibs " $func_resolve_sysroot_result" |
|
8030 |
fi
|
|
8031 |
continue
|
|
8032 |
;;
|
|
8033 |
||
8034 |
# Some other compiler argument.
|
|
8035 |
*)
|
|
8036 |
# Unknown arguments in both finalize_command and compile_command need
|
|
8037 |
# to be aesthetically quoted because they are evaled later.
|
|
8038 |
func_quote_for_eval "$arg" |
|
8039 |
arg=$func_quote_for_eval_result |
|
8040 |
;;
|
|
8041 |
esac # arg |
|
8042 |
||
8043 |
# Now actually substitute the argument into the commands.
|
|
8044 |
if test -n "$arg"; then |
|
8045 |
func_append compile_command " $arg" |
|
8046 |
func_append finalize_command " $arg" |
|
8047 |
fi
|
|
8048 |
done # argument parsing loop |
|
8049 |
||
8050 |
test -n "$prev" && \ |
|
8051 |
func_fatal_help "the '$prevarg' option requires an argument" |
|
8052 |
||
8053 |
if test yes = "$export_dynamic" && test -n "$export_dynamic_flag_spec"; then |
|
8054 |
eval arg=\"$export_dynamic_flag_spec\" |
|
8055 |
func_append compile_command " $arg" |
|
8056 |
func_append finalize_command " $arg" |
|
8057 |
fi
|
|
8058 |
||
8059 |
oldlibs= |
|
8060 |
# calculate the name of the file, without its directory
|
|
8061 |
func_basename "$output" |
|
8062 |
outputname=$func_basename_result |
|
8063 |
libobjs_save=$libobjs |
|
8064 |
||
8065 |
if test -n "$shlibpath_var"; then |
|
8066 |
# get the directories listed in $shlibpath_var
|
|
8067 |
eval shlib_search_path=\`\$ECHO \"\$$shlibpath_var\" \| \$SED \'s/:/ /g\'\` |
|
8068 |
else
|
|
8069 |
shlib_search_path= |
|
8070 |
fi
|
|
8071 |
eval sys_lib_search_path=\"$sys_lib_search_path_spec\" |
|
8072 |
eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\" |
|
8073 |
||
8074 |
# Definition is injected by LT_CONFIG during libtool generation.
|
|
8075 |
func_munge_path_list sys_lib_dlsearch_path "$LT_SYS_LIBRARY_PATH" |
|
8076 |
||
8077 |
func_dirname "$output" "/" "" |
|
8078 |
output_objdir=$func_dirname_result$objdir |
|
8079 |
func_to_tool_file "$output_objdir/" |
|
8080 |
tool_output_objdir=$func_to_tool_file_result |
|
8081 |
# Create the object directory.
|
|
8082 |
func_mkdir_p "$output_objdir" |
|
8083 |
||
8084 |
# Determine the type of output
|
|
8085 |
case $output in |
|
8086 |
"") |
|
8087 |
func_fatal_help "you must specify an output file"
|
|
8088 |
;;
|
|
8089 |
*.$libext) linkmode=oldlib ;; |
|
8090 |
*.lo | *.$objext) linkmode=obj ;; |
|
8091 |
*.la) linkmode=lib ;; |
|
8092 |
*) linkmode=prog ;; # Anything else should be a program. |
|
8093 |
esac
|
|
8094 |
||
8095 |
specialdeplibs= |
|
8096 |
||
8097 |
libs= |
|
8098 |
# Find all interdependent deplibs by searching for libraries
|
|
8099 |
# that are linked more than once (e.g. -la -lb -la)
|
|
8100 |
for deplib in $deplibs; do |
|
8101 |
if $opt_preserve_dup_deps; then |
|
8102 |
case "$libs " in |
|
8103 |
*" $deplib "*) func_append specialdeplibs " $deplib" ;; |
|
8104 |
esac
|
|
8105 |
fi
|
|
8106 |
func_append libs " $deplib" |
|
8107 |
done
|
|
8108 |
||
8109 |
if test lib = "$linkmode"; then |
|
8110 |
libs="$predeps $libs $compiler_lib_search_path $postdeps" |
|
8111 |
||
8112 |
# Compute libraries that are listed more than once in $predeps
|
|
8113 |
# $postdeps and mark them as special (i.e., whose duplicates are
|
|
8114 |
# not to be eliminated).
|
|
8115 |
pre_post_deps= |
|
8116 |
if $opt_duplicate_compiler_generated_deps; then |
|
8117 |
for pre_post_dep in $predeps $postdeps; do |
|
8118 |
case "$pre_post_deps " in |
|
8119 |
*" $pre_post_dep "*) func_append specialdeplibs " $pre_post_deps" ;; |
|
8120 |
esac
|
|
8121 |
func_append pre_post_deps " $pre_post_dep" |
|
8122 |
done
|
|
8123 |
fi
|
|
8124 |
pre_post_deps= |
|
8125 |
fi
|
|
8126 |
||
8127 |
deplibs= |
|
8128 |
newdependency_libs= |
|
8129 |
newlib_search_path= |
|
8130 |
need_relink=no # whether we're linking any uninstalled libtool libraries |
|
8131 |
notinst_deplibs= # not-installed libtool libraries |
|
8132 |
notinst_path= # paths that contain not-installed libtool libraries |
|
8133 |
||
8134 |
case $linkmode in |
|
8135 |
lib)
|
|
8136 |
passes="conv dlpreopen link" |
|
8137 |
for file in $dlfiles $dlprefiles; do |
|
8138 |
case $file in |
|
8139 |
*.la) ;; |
|
8140 |
*)
|
|
8141 |
func_fatal_help "libraries can '-dlopen' only libtool libraries: $file" |
|
8142 |
;;
|
|
8143 |
esac
|
|
8144 |
done
|
|
8145 |
;;
|
|
8146 |
prog)
|
|
8147 |
compile_deplibs= |
|
8148 |
finalize_deplibs= |
|
8149 |
alldeplibs=false |
|
8150 |
newdlfiles= |
|
8151 |
newdlprefiles= |
|
8152 |
passes="conv scan dlopen dlpreopen link" |
|
8153 |
;;
|
|
8154 |
*) passes="conv" |
|
8155 |
;;
|
|
8156 |
esac
|
|
8157 |
||
8158 |
for pass in $passes; do |
|
8159 |
# The preopen pass in lib mode reverses $deplibs; put it back here
|
|
8160 |
# so that -L comes before libs that need it for instance...
|
|
8161 |
if test lib,link = "$linkmode,$pass"; then |
|
8162 |
## FIXME: Find the place where the list is rebuilt in the wrong
|
|
8163 |
## order, and fix it there properly
|
|
8164 |
tmp_deplibs= |
|
8165 |
for deplib in $deplibs; do |
|
8166 |
tmp_deplibs="$deplib $tmp_deplibs" |
|
8167 |
done
|
|
8168 |
deplibs=$tmp_deplibs |
|
8169 |
fi
|
|
8170 |
||
8171 |
if test lib,link = "$linkmode,$pass" || |
|
8172 |
test prog,scan = "$linkmode,$pass"; then |
|
8173 |
libs=$deplibs |
|
8174 |
deplibs= |
|
8175 |
fi
|
|
8176 |
if test prog = "$linkmode"; then |
|
8177 |
case $pass in |
|
8178 |
dlopen) libs=$dlfiles ;; |
|
8179 |
dlpreopen) libs=$dlprefiles ;; |
|
8180 |
link)
|
|
8181 |
libs="$deplibs %DEPLIBS%" |
|
8182 |
test "X$link_all_deplibs" != Xno && libs="$libs $dependency_libs" |
|
8183 |
;;
|
|
8184 |
esac
|
|
8185 |
fi
|
|
8186 |
if test lib,dlpreopen = "$linkmode,$pass"; then |
|
8187 |
# Collect and forward deplibs of preopened libtool libs
|
|
8188 |
for lib in $dlprefiles; do |
|
8189 |
# Ignore non-libtool-libs
|
|
8190 |
dependency_libs= |
|
8191 |
func_resolve_sysroot "$lib" |
|
8192 |
case $lib in |
|
8193 |
*.la) func_source "$func_resolve_sysroot_result" ;; |
|
8194 |
esac
|
|
8195 |
||
8196 |
# Collect preopened libtool deplibs, except any this library
|
|
8197 |
# has declared as weak libs
|
|
8198 |
for deplib in $dependency_libs; do |
|
8199 |
func_basename "$deplib" |
|
8200 |
deplib_base=$func_basename_result |
|
8201 |
case " $weak_libs " in |
|
8202 |
*" $deplib_base "*) ;; |
|
8203 |
*) func_append deplibs " $deplib" ;; |
|
8204 |
esac
|
|
8205 |
done
|
|
8206 |
done
|
|
8207 |
libs=$dlprefiles |
|
8208 |
fi
|
|
8209 |
if test dlopen = "$pass"; then |
|
8210 |
# Collect dlpreopened libraries
|
|
8211 |
save_deplibs=$deplibs |
|
8212 |
deplibs= |
|
8213 |
fi
|
|
8214 |
||
8215 |
for deplib in $libs; do |
|
8216 |
lib= |
|
8217 |
found=false |
|
8218 |
case $deplib in |
|
8219 |
-mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe \ |
|
8220 |
|-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*) |
|
8221 |
if test prog,link = "$linkmode,$pass"; then |
|
8222 |
compile_deplibs="$deplib $compile_deplibs" |
|
8223 |
finalize_deplibs="$deplib $finalize_deplibs" |
|
8224 |
else
|
|
8225 |
func_append compiler_flags " $deplib" |
|
8226 |
if test lib = "$linkmode"; then |
|
8227 |
case "$new_inherited_linker_flags " in |
|
8228 |
*" $deplib "*) ;; |
|
8229 |
* ) func_append new_inherited_linker_flags " $deplib" ;; |
|
8230 |
esac
|
|
8231 |
fi
|
|
8232 |
fi
|
|
8233 |
continue
|
|
8234 |
;;
|
|
8235 |
-l*)
|
|
8236 |
if test lib != "$linkmode" && test prog != "$linkmode"; then |
|
8237 |
func_warning "'-l' is ignored for archives/objects"
|
|
8238 |
continue
|
|
8239 |
fi
|
|
8240 |
func_stripname '-l' '' "$deplib" |
|
8241 |
name=$func_stripname_result |
|
8242 |
if test lib = "$linkmode"; then |
|
8243 |
searchdirs="$newlib_search_path $lib_search_path $compiler_lib_search_dirs $sys_lib_search_path $shlib_search_path" |
|
8244 |
else
|
|
8245 |
searchdirs="$newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path" |
|
8246 |
fi
|
|
8247 |
for searchdir in $searchdirs; do |
|
8248 |
for search_ext in .la $std_shrext .so .a; do |
|
8249 |
# Search the libtool library
|
|
8250 |
lib=$searchdir/lib$name$search_ext |
|
8251 |
if test -f "$lib"; then |
|
8252 |
if test .la = "$search_ext"; then |
|
8253 |
found=: |
|
8254 |
else
|
|
8255 |
found=false |
|
8256 |
fi
|
|
8257 |
break 2 |
|
8258 |
fi
|
|
8259 |
done
|
|
8260 |
done
|
|
8261 |
if $found; then |
|
8262 |
# deplib is a libtool library
|
|
8263 |
# If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib,
|
|
8264 |
# We need to do some special things here, and not later.
|
|
8265 |
if test yes = "$allow_libtool_libs_with_static_runtimes"; then |
|
8266 |
case " $predeps $postdeps " in |
|
8267 |
*" $deplib "*) |
|
8268 |
if func_lalib_p "$lib"; then |
|
8269 |
library_names= |
|
8270 |
old_library= |
|
8271 |
func_source "$lib" |
|
8272 |
for l in $old_library $library_names; do |
|
8273 |
ll=$l |
|
8274 |
done
|
|
8275 |
if test "X$ll" = "X$old_library"; then # only static version available |
|
8276 |
found=false |
|
8277 |
func_dirname "$lib" "" "." |
|
8278 |
ladir=$func_dirname_result |
|
8279 |
lib=$ladir/$old_library |
|
8280 |
if test prog,link = "$linkmode,$pass"; then |
|
8281 |
compile_deplibs="$deplib $compile_deplibs" |
|
8282 |
finalize_deplibs="$deplib $finalize_deplibs" |
|
8283 |
else
|
|
8284 |
deplibs="$deplib $deplibs" |
|
8285 |
test lib = "$linkmode" && newdependency_libs="$deplib $newdependency_libs" |
|
8286 |
fi
|
|
8287 |
continue
|
|
8288 |
fi
|
|
8289 |
fi
|
|
8290 |
;;
|
|
8291 |
*) ;; |
|
8292 |
esac
|
|
8293 |
fi
|
|
8294 |
else
|
|
8295 |
# deplib doesn't seem to be a libtool library
|
|
8296 |
if test prog,link = "$linkmode,$pass"; then |
|
8297 |
compile_deplibs="$deplib $compile_deplibs" |
|
8298 |
finalize_deplibs="$deplib $finalize_deplibs" |
|
8299 |
else
|
|
8300 |
deplibs="$deplib $deplibs" |
|
8301 |
test lib = "$linkmode" && newdependency_libs="$deplib $newdependency_libs" |
|
8302 |
fi
|
|
8303 |
continue
|
|
8304 |
fi
|
|
8305 |
;; # -l |
|
8306 |
*.ltframework)
|
|
8307 |
if test prog,link = "$linkmode,$pass"; then |
|
8308 |
compile_deplibs="$deplib $compile_deplibs" |
|
8309 |
finalize_deplibs="$deplib $finalize_deplibs" |
|
8310 |
else
|
|
8311 |
deplibs="$deplib $deplibs" |
|
8312 |
if test lib = "$linkmode"; then |
|
8313 |
case "$new_inherited_linker_flags " in |
|
8314 |
*" $deplib "*) ;; |
|
8315 |
* ) func_append new_inherited_linker_flags " $deplib" ;; |
|
8316 |
esac
|
|
8317 |
fi
|
|
8318 |
fi
|
|
8319 |
continue
|
|
8320 |
;;
|
|
8321 |
-L*)
|
|
8322 |
case $linkmode in |
|
8323 |
lib)
|
|
8324 |
deplibs="$deplib $deplibs" |
|
8325 |
test conv = "$pass" && continue |
|
8326 |
newdependency_libs="$deplib $newdependency_libs" |
|
8327 |
func_stripname '-L' '' "$deplib" |
|
8328 |
func_resolve_sysroot "$func_stripname_result" |
|
8329 |
func_append newlib_search_path " $func_resolve_sysroot_result" |
|
8330 |
;;
|
|
8331 |
prog)
|
|
8332 |
if test conv = "$pass"; then |
|
8333 |
deplibs="$deplib $deplibs" |
|
8334 |
continue
|
|
8335 |
fi
|
|
8336 |
if test scan = "$pass"; then |
|
8337 |
deplibs="$deplib $deplibs" |
|
8338 |
else
|
|
8339 |
compile_deplibs="$deplib $compile_deplibs" |
|
8340 |
finalize_deplibs="$deplib $finalize_deplibs" |
|
8341 |
fi
|
|
8342 |
func_stripname '-L' '' "$deplib" |
|
8343 |
func_resolve_sysroot "$func_stripname_result" |
|
8344 |
func_append newlib_search_path " $func_resolve_sysroot_result" |
|
8345 |
;;
|
|
8346 |
*)
|
|
8347 |
func_warning "'-L' is ignored for archives/objects"
|
|
8348 |
;;
|
|
8349 |
esac # linkmode |
|
8350 |
continue
|
|
8351 |
;; # -L |
|
8352 |
-R*)
|
|
8353 |
if test link = "$pass"; then |
|
8354 |
func_stripname '-R' '' "$deplib" |
|
8355 |
func_resolve_sysroot "$func_stripname_result" |
|
8356 |
dir=$func_resolve_sysroot_result |
|
8357 |
# Make sure the xrpath contains only unique directories.
|
|
8358 |
case "$xrpath " in |
|
8359 |
*" $dir "*) ;; |
|
8360 |
*) func_append xrpath " $dir" ;; |
|
8361 |
esac
|
|
8362 |
fi
|
|
8363 |
deplibs="$deplib $deplibs" |
|
8364 |
continue
|
|
8365 |
;;
|
|
8366 |
*.la)
|
|
8367 |
func_resolve_sysroot "$deplib" |
|
8368 |
lib=$func_resolve_sysroot_result |
|
8369 |
;;
|
|
8370 |
*.$libext) |
|
8371 |
if test conv = "$pass"; then |
|
8372 |
deplibs="$deplib $deplibs" |
|
8373 |
continue
|
|
8374 |
fi
|
|
8375 |
case $linkmode in |
|
8376 |
lib)
|
|
8377 |
# Linking convenience modules into shared libraries is allowed,
|
|
8378 |
# but linking other static libraries is non-portable.
|
|
8379 |
case " $dlpreconveniencelibs " in |
|
8380 |
*" $deplib "*) ;; |
|
8381 |
*)
|
|
8382 |
valid_a_lib=false |
|
8383 |
case $deplibs_check_method in |
|
8384 |
match_pattern*)
|
|
8385 |
set dummy $deplibs_check_method; shift |
|
8386 |
match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"` |
|
8387 |
if eval "\$ECHO \"$deplib\"" 2>/dev/null | $SED 10q \ |
|
8388 |
| $EGREP "$match_pattern_regex" > /dev/null; then |
|
8389 |
valid_a_lib=: |
|
8390 |
fi
|
|
8391 |
;;
|
|
8392 |
pass_all)
|
|
8393 |
valid_a_lib=: |
|
8394 |
;;
|
|
8395 |
esac
|
|
8396 |
if $valid_a_lib; then |
|
8397 |
echo
|
|
8398 |
$ECHO "*** Warning: Linking the shared library $output against the" |
|
8399 |
$ECHO "*** static library $deplib is not portable!" |
|
8400 |
deplibs="$deplib $deplibs" |
|
8401 |
else
|
|
8402 |
echo
|
|
8403 |
$ECHO "*** Warning: Trying to link with static lib archive $deplib." |
|
8404 |
echo "*** I have the capability to make that library automatically link in when" |
|
8405 |
echo "*** you link to this library. But I can only do this if you have a" |
|
8406 |
echo "*** shared version of the library, which you do not appear to have" |
|
8407 |
echo "*** because the file extensions .$libext of this argument makes me believe" |
|
8408 |
echo "*** that it is just a static archive that I should not use here." |
|
8409 |
fi
|
|
8410 |
;;
|
|
8411 |
esac
|
|
8412 |
continue
|
|
8413 |
;;
|
|
8414 |
prog)
|
|
8415 |
if test link != "$pass"; then |
|
8416 |
deplibs="$deplib $deplibs" |
|
8417 |
else
|
|
8418 |
compile_deplibs="$deplib $compile_deplibs" |
|
8419 |
finalize_deplibs="$deplib $finalize_deplibs" |
|
8420 |
fi
|
|
8421 |
continue
|
|
8422 |
;;
|
|
8423 |
esac # linkmode |
|
8424 |
;; # *.$libext |
|
8425 |
*.lo | *.$objext) |
|
8426 |
if test conv = "$pass"; then |
|
8427 |
deplibs="$deplib $deplibs" |
|
8428 |
elif test prog = "$linkmode"; then |
|
8429 |
if test dlpreopen = "$pass" || test yes != "$dlopen_support" || test no = "$build_libtool_libs"; then |
|
8430 |
# If there is no dlopen support or we're linking statically,
|
|
8431 |
# we need to preload.
|
|
8432 |
func_append newdlprefiles " $deplib" |
|
8433 |
compile_deplibs="$deplib $compile_deplibs" |
|
8434 |
finalize_deplibs="$deplib $finalize_deplibs" |
|
8435 |
else
|
|
8436 |
func_append newdlfiles " $deplib" |
|
8437 |
fi
|
|
8438 |
fi
|
|
8439 |
continue
|
|
8440 |
;;
|
|
8441 |
%DEPLIBS%)
|
|
8442 |
alldeplibs=: |
|
8443 |
continue
|
|
8444 |
;;
|
|
8445 |
esac # case $deplib |
|
8446 |
||
8447 |
$found || test -f "$lib" \ |
|
8448 |
|| func_fatal_error "cannot find the library '$lib' or unhandled argument '$deplib'" |
|
8449 |
||
8450 |
# Check to see that this really is a libtool archive.
|
|
8451 |
func_lalib_unsafe_p "$lib" \ |
|
8452 |
|| func_fatal_error "'$lib' is not a valid libtool archive" |
|
8453 |
||
8454 |
func_dirname "$lib" "" "." |
|
8455 |
ladir=$func_dirname_result |
|
8456 |
||
8457 |
dlname= |
|
8458 |
dlopen= |
|
8459 |
dlpreopen= |
|
8460 |
libdir= |
|
8461 |
library_names= |
|
8462 |
old_library= |
|
8463 |
inherited_linker_flags= |
|
8464 |
# If the library was installed with an old release of libtool,
|
|
8465 |
# it will not redefine variables installed, or shouldnotlink
|
|
8466 |
installed=yes |
|
8467 |
shouldnotlink=no |
|
8468 |
avoidtemprpath= |
|
8469 |
||
8470 |
||
8471 |
# Read the .la file
|
|
8472 |
func_source "$lib" |
|
8473 |
||
8474 |
# Convert "-framework foo" to "foo.ltframework"
|
|
8475 |
if test -n "$inherited_linker_flags"; then |
|
8476 |
tmp_inherited_linker_flags=`$ECHO "$inherited_linker_flags" | $SED 's/-framework \([^ $]*\)/\1.ltframework/g'` |
|
8477 |
for tmp_inherited_linker_flag in $tmp_inherited_linker_flags; do |
|
8478 |
case " $new_inherited_linker_flags " in |
|
8479 |
*" $tmp_inherited_linker_flag "*) ;; |
|
8480 |
*) func_append new_inherited_linker_flags " $tmp_inherited_linker_flag";; |
|
8481 |
esac
|
|
8482 |
done
|
|
8483 |
fi
|
|
8484 |
dependency_libs=`$ECHO " $dependency_libs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` |
|
8485 |
if test lib,link = "$linkmode,$pass" || |
|
8486 |
test prog,scan = "$linkmode,$pass" || |
|
8487 |
{ test prog != "$linkmode" && test lib != "$linkmode"; }; then |
|
8488 |
test -n "$dlopen" && func_append dlfiles " $dlopen" |
|
8489 |
test -n "$dlpreopen" && func_append dlprefiles " $dlpreopen" |
|
8490 |
fi
|
|
8491 |
||
8492 |
if test conv = "$pass"; then |
|
8493 |
# Only check for convenience libraries
|
|
8494 |
deplibs="$lib $deplibs" |
|
8495 |
if test -z "$libdir"; then |
|
8496 |
if test -z "$old_library"; then |
|
8497 |
func_fatal_error "cannot find name of link library for '$lib'" |
|
8498 |
fi
|
|
8499 |
# It is a libtool convenience library, so add in its objects.
|
|
8500 |
func_append convenience " $ladir/$objdir/$old_library" |
|
8501 |
func_append old_convenience " $ladir/$objdir/$old_library" |
|
8502 |
tmp_libs= |
|
8503 |
for deplib in $dependency_libs; do |
|
8504 |
deplibs="$deplib $deplibs" |
|
8505 |
if $opt_preserve_dup_deps; then |
|
8506 |
case "$tmp_libs " in |
|
8507 |
*" $deplib "*) func_append specialdeplibs " $deplib" ;; |
|
8508 |
esac
|
|
8509 |
fi
|
|
8510 |
func_append tmp_libs " $deplib" |
|
8511 |
done
|
|
8512 |
elif test prog != "$linkmode" && test lib != "$linkmode"; then |
|
8513 |
func_fatal_error "'$lib' is not a convenience library" |
|
8514 |
fi
|
|
8515 |
continue
|
|
8516 |
fi # $pass = conv |
|
8517 |
||
8518 |
||
8519 |
# Get the name of the library we link against.
|
|
8520 |
linklib= |
|
8521 |
if test -n "$old_library" && |
|
8522 |
{ test yes = "$prefer_static_libs" || |
|
8523 |
test built,no = "$prefer_static_libs,$installed"; }; then |
|
8524 |
linklib=$old_library |
|
8525 |
else
|
|
8526 |
for l in $old_library $library_names; do |
|
8527 |
linklib=$l |
|
8528 |
done
|
|
8529 |
fi
|
|
8530 |
if test -z "$linklib"; then |
|
8531 |
func_fatal_error "cannot find name of link library for '$lib'" |
|
8532 |
fi
|
|
8533 |
||
8534 |
# This library was specified with -dlopen.
|
|
8535 |
if test dlopen = "$pass"; then |
|
8536 |
test -z "$libdir" \ |
|
8537 |
&& func_fatal_error "cannot -dlopen a convenience library: '$lib'" |
|
8538 |
if test -z "$dlname" || |
|
8539 |
test yes != "$dlopen_support" || |
|
8540 |
test no = "$build_libtool_libs" |
|
8541 |
then
|
|
8542 |
# If there is no dlname, no dlopen support or we're linking
|
|
8543 |
# statically, we need to preload. We also need to preload any
|
|
8544 |
# dependent libraries so libltdl's deplib preloader doesn't
|
|
8545 |
# bomb out in the load deplibs phase.
|
|
8546 |
func_append dlprefiles " $lib $dependency_libs" |
|
8547 |
else
|
|
8548 |
func_append newdlfiles " $lib" |
|
8549 |
fi
|
|
8550 |
continue
|
|
8551 |
fi # $pass = dlopen |
|
8552 |
||
8553 |
# We need an absolute path.
|
|
8554 |
case $ladir in |
|
8555 |
[\\/]* | [A-Za-z]:[\\/]*) abs_ladir=$ladir ;; |
|
8556 |
*)
|
|
8557 |
abs_ladir=`cd "$ladir" && pwd` |
|
8558 |
if test -z "$abs_ladir"; then |
|
8559 |
func_warning "cannot determine absolute directory name of '$ladir'" |
|
8560 |
func_warning "passing it literally to the linker, although it might fail"
|
|
8561 |
abs_ladir=$ladir |
|
8562 |
fi
|
|
8563 |
;;
|
|
8564 |
esac
|
|
8565 |
func_basename "$lib" |
|
8566 |
laname=$func_basename_result |
|
8567 |
||
8568 |
# Find the relevant object directory and library name.
|
|
8569 |
if test yes = "$installed"; then |
|
8570 |
if test ! -f "$lt_sysroot$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then |
|
8571 |
func_warning "library '$lib' was moved." |
|
8572 |
dir=$ladir |
|
8573 |
absdir=$abs_ladir |
|
8574 |
libdir=$abs_ladir |
|
8575 |
else
|
|
8576 |
dir=$lt_sysroot$libdir |
|
8577 |
absdir=$lt_sysroot$libdir |
|
8578 |
fi
|
|
8579 |
test yes = "$hardcode_automatic" && avoidtemprpath=yes |
|
8580 |
else
|
|
8581 |
if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then |
|
8582 |
dir=$ladir |
|
8583 |
absdir=$abs_ladir |
|
8584 |
# Remove this search path later
|
|
8585 |
func_append notinst_path " $abs_ladir" |
|
8586 |
else
|
|
8587 |
dir=$ladir/$objdir |
|
8588 |
absdir=$abs_ladir/$objdir |
|
8589 |
# Remove this search path later
|
|
8590 |
func_append notinst_path " $abs_ladir" |
|
8591 |
fi
|
|
8592 |
fi # $installed = yes |
|
8593 |
func_stripname 'lib' '.la' "$laname" |
|
8594 |
name=$func_stripname_result |
|
8595 |
||
8596 |
# This library was specified with -dlpreopen.
|
|
8597 |
if test dlpreopen = "$pass"; then |
|
8598 |
if test -z "$libdir" && test prog = "$linkmode"; then |
|
8599 |
func_fatal_error "only libraries may -dlpreopen a convenience library: '$lib'" |
|
8600 |
fi
|
|
8601 |
case $host in |
|
8602 |
# special handling for platforms with PE-DLLs.
|
|
8603 |
*cygwin* | *mingw* | *cegcc* ) |
|
8604 |
# Linker will automatically link against shared library if both
|
|
8605 |
# static and shared are present. Therefore, ensure we extract
|
|
8606 |
# symbols from the import library if a shared library is present
|
|
8607 |
# (otherwise, the dlopen module name will be incorrect). We do
|
|
8608 |
# this by putting the import library name into $newdlprefiles.
|
|
8609 |
# We recover the dlopen module name by 'saving' the la file
|
|
8610 |
# name in a special purpose variable, and (later) extracting the
|
|
8611 |
# dlname from the la file.
|
|
8612 |
if test -n "$dlname"; then |
|
8613 |
func_tr_sh "$dir/$linklib" |
|
8614 |
eval "libfile_$func_tr_sh_result=\$abs_ladir/\$laname" |
|
8615 |
func_append newdlprefiles " $dir/$linklib" |
|
8616 |
else
|
|
8617 |
func_append newdlprefiles " $dir/$old_library" |
|
8618 |
# Keep a list of preopened convenience libraries to check
|
|
8619 |
# that they are being used correctly in the link pass.
|
|
8620 |
test -z "$libdir" && \ |
|
8621 |
func_append dlpreconveniencelibs " $dir/$old_library" |
|
8622 |
fi
|
|
8623 |
;;
|
|
8624 |
* )
|
|
8625 |
# Prefer using a static library (so that no silly _DYNAMIC symbols
|
|
8626 |
# are required to link).
|
|
8627 |
if test -n "$old_library"; then |
|
8628 |
func_append newdlprefiles " $dir/$old_library" |
|
8629 |
# Keep a list of preopened convenience libraries to check
|
|
8630 |
# that they are being used correctly in the link pass.
|
|
8631 |
test -z "$libdir" && \ |
|
8632 |
func_append dlpreconveniencelibs " $dir/$old_library" |
|
8633 |
# Otherwise, use the dlname, so that lt_dlopen finds it.
|
|
8634 |
elif test -n "$dlname"; then |
|
8635 |
func_append newdlprefiles " $dir/$dlname" |
|
8636 |
else
|
|
8637 |
func_append newdlprefiles " $dir/$linklib" |
|
8638 |
fi
|
|
8639 |
;;
|
|
8640 |
esac
|
|
8641 |
fi # $pass = dlpreopen |
|
8642 |
||
8643 |
if test -z "$libdir"; then |
|
8644 |
# Link the convenience library
|
|
8645 |
if test lib = "$linkmode"; then |
|
8646 |
deplibs="$dir/$old_library $deplibs" |
|
8647 |
elif test prog,link = "$linkmode,$pass"; then |
|
8648 |
compile_deplibs="$dir/$old_library $compile_deplibs" |
|
8649 |
finalize_deplibs="$dir/$old_library $finalize_deplibs" |
|
8650 |
else
|
|
8651 |
deplibs="$lib $deplibs" # used for prog,scan pass |
|
8652 |
fi
|
|
8653 |
continue
|
|
8654 |
fi
|
|
8655 |
||
8656 |
||
8657 |
if test prog = "$linkmode" && test link != "$pass"; then |
|
8658 |
func_append newlib_search_path " $ladir" |
|
8659 |
deplibs="$lib $deplibs" |
|
8660 |
||
8661 |
linkalldeplibs=false |
|
8662 |
if test no != "$link_all_deplibs" || test -z "$library_names" || |
|
8663 |
test no = "$build_libtool_libs"; then |
|
8664 |
linkalldeplibs=: |
|
8665 |
fi
|
|
8666 |
||
8667 |
tmp_libs= |
|
8668 |
for deplib in $dependency_libs; do |
|
8669 |
case $deplib in |
|
8670 |
-L*) func_stripname '-L' '' "$deplib" |
|
8671 |
func_resolve_sysroot "$func_stripname_result" |
|
8672 |
func_append newlib_search_path " $func_resolve_sysroot_result" |
|
8673 |
;;
|
|
8674 |
esac
|
|
8675 |
# Need to link against all dependency_libs?
|
|
8676 |
if $linkalldeplibs; then |
|
8677 |
deplibs="$deplib $deplibs" |
|
8678 |
else
|
|
8679 |
# Need to hardcode shared library paths
|
|
8680 |
# or/and link against static libraries
|
|
8681 |
newdependency_libs="$deplib $newdependency_libs" |
|
8682 |
fi
|
|
8683 |
if $opt_preserve_dup_deps; then |
|
8684 |
case "$tmp_libs " in |
|
8685 |
*" $deplib "*) func_append specialdeplibs " $deplib" ;; |
|
8686 |
esac
|
|
8687 |
fi
|
|
8688 |
func_append tmp_libs " $deplib" |
|
8689 |
done # for deplib |
|
8690 |
continue
|
|
8691 |
fi # $linkmode = prog... |
|
8692 |
||
8693 |
if test prog,link = "$linkmode,$pass"; then |
|
8694 |
if test -n "$library_names" && |
|
8695 |
{ { test no = "$prefer_static_libs" || |
|
8696 |
test built,yes = "$prefer_static_libs,$installed"; } || |
|
8697 |
test -z "$old_library"; }; then |
|
8698 |
# We need to hardcode the library path
|
|
8699 |
if test -n "$shlibpath_var" && test -z "$avoidtemprpath"; then |
|
8700 |
# Make sure the rpath contains only unique directories.
|
|
8701 |
case $temp_rpath: in |
|
8702 |
*"$absdir:"*) ;; |
|
8703 |
*) func_append temp_rpath "$absdir:" ;; |
|
8704 |
esac
|
|
8705 |
fi
|
|
8706 |
||
8707 |
# Hardcode the library path.
|
|
8708 |
# Skip directories that are in the system default run-time
|
|
8709 |
# search path.
|
|
8710 |
case " $sys_lib_dlsearch_path " in |
|
8711 |
*" $absdir "*) ;; |
|
8712 |
*)
|
|
8713 |
case "$compile_rpath " in |
|
8714 |
*" $absdir "*) ;; |
|
8715 |
*) func_append compile_rpath " $absdir" ;; |
|
8716 |
esac
|
|
8717 |
;;
|
|
8718 |
esac
|
|
8719 |
case " $sys_lib_dlsearch_path " in |
|
8720 |
*" $libdir "*) ;; |
|
8721 |
*)
|
|
8722 |
case "$finalize_rpath " in |
|
8723 |
*" $libdir "*) ;; |
|
8724 |
*) func_append finalize_rpath " $libdir" ;; |
|
8725 |
esac
|
|
8726 |
;;
|
|
8727 |
esac
|
|
8728 |
fi # $linkmode,$pass = prog,link... |
|
8729 |
||
8730 |
if $alldeplibs && |
|
8731 |
{ test pass_all = "$deplibs_check_method" || |
|
8732 |
{ test yes = "$build_libtool_libs" && |
|
8733 |
test -n "$library_names"; }; }; then |
|
8734 |
# We only need to search for static libraries
|
|
8735 |
continue
|
|
8736 |
fi
|
|
8737 |
fi
|
|
8738 |
||
8739 |
link_static=no # Whether the deplib will be linked statically |
|
8740 |
use_static_libs=$prefer_static_libs |
|
8741 |
if test built = "$use_static_libs" && test yes = "$installed"; then |
|
8742 |
use_static_libs=no |
|
8743 |
fi
|
|
8744 |
if test -n "$library_names" && |
|
8745 |
{ test no = "$use_static_libs" || test -z "$old_library"; }; then |
|
8746 |
case $host in |
|
8747 |
*cygwin* | *mingw* | *cegcc* | *os2*) |
|
8748 |
# No point in relinking DLLs because paths are not encoded
|
|
8749 |
func_append notinst_deplibs " $lib" |
|
8750 |
need_relink=no |
|
8751 |
;;
|
|
8752 |
*)
|
|
8753 |
if test no = "$installed"; then |
|
8754 |
func_append notinst_deplibs " $lib" |
|
8755 |
need_relink=yes |
|
8756 |
fi
|
|
8757 |
;;
|
|
8758 |
esac
|
|
8759 |
# This is a shared library
|
|
8760 |
||
8761 |
# Warn about portability, can't link against -module's on some
|
|
8762 |
# systems (darwin). Don't bleat about dlopened modules though!
|
|
8763 |
dlopenmodule= |
|
8764 |
for dlpremoduletest in $dlprefiles; do |
|
8765 |
if test "X$dlpremoduletest" = "X$lib"; then |
|
8766 |
dlopenmodule=$dlpremoduletest |
|
8767 |
break
|
|
8768 |
fi
|
|
8769 |
done
|
|
8770 |
if test -z "$dlopenmodule" && test yes = "$shouldnotlink" && test link = "$pass"; then |
|
8771 |
echo
|
|
8772 |
if test prog = "$linkmode"; then |
|
8773 |
$ECHO "*** Warning: Linking the executable $output against the loadable module" |
|
8774 |
else
|
|
8775 |
$ECHO "*** Warning: Linking the shared library $output against the loadable module" |
|
8776 |
fi
|
|
8777 |
$ECHO "*** $linklib is not portable!" |
|
8778 |
fi
|
|
8779 |
if test lib = "$linkmode" && |
|
8780 |
test yes = "$hardcode_into_libs"; then |
|
8781 |
# Hardcode the library path.
|
|
8782 |
# Skip directories that are in the system default run-time
|
|
8783 |
# search path.
|
|
8784 |
case " $sys_lib_dlsearch_path " in |
|
8785 |
*" $absdir "*) ;; |
|
8786 |
*)
|
|
8787 |
case "$compile_rpath " in |
|
8788 |
*" $absdir "*) ;; |
|
8789 |
*) func_append compile_rpath " $absdir" ;; |
|
8790 |
esac
|
|
8791 |
;;
|
|
8792 |
esac
|
|
8793 |
case " $sys_lib_dlsearch_path " in |
|
8794 |
*" $libdir "*) ;; |
|
8795 |
*)
|
|
8796 |
case "$finalize_rpath " in |
|
8797 |
*" $libdir "*) ;; |
|
8798 |
*) func_append finalize_rpath " $libdir" ;; |
|
8799 |
esac
|
|
8800 |
;;
|
|
8801 |
esac
|
|
8802 |
fi
|
|
8803 |
||
8804 |
if test -n "$old_archive_from_expsyms_cmds"; then |
|
8805 |
# figure out the soname
|
|
8806 |
set dummy $library_names |
|
8807 |
shift
|
|
8808 |
realname=$1 |
|
8809 |
shift
|
|
8810 |
libname=`eval "\\$ECHO \"$libname_spec\""` |
|
8811 |
# use dlname if we got it. it's perfectly good, no?
|
|
8812 |
if test -n "$dlname"; then |
|
8813 |
soname=$dlname |
|
8814 |
elif test -n "$soname_spec"; then |
|
8815 |
# bleh windows
|
|
8816 |
case $host in |
|
8817 |
*cygwin* | mingw* | *cegcc* | *os2*) |
|
8818 |
func_arith $current - $age |
|
8819 |
major=$func_arith_result |
|
8820 |
versuffix=-$major |
|
8821 |
;;
|
|
8822 |
esac
|
|
8823 |
eval soname=\"$soname_spec\" |
|
8824 |
else
|
|
8825 |
soname=$realname |
|
8826 |
fi
|
|
8827 |
||
8828 |
# Make a new name for the extract_expsyms_cmds to use
|
|
8829 |
soroot=$soname |
|
8830 |
func_basename "$soroot" |
|
8831 |
soname=$func_basename_result |
|
8832 |
func_stripname 'lib' '.dll' "$soname" |
|
8833 |
newlib=libimp-$func_stripname_result.a |
|
8834 |
||
8835 |
# If the library has no export list, then create one now
|
|
8836 |
if test -f "$output_objdir/$soname-def"; then : |
|
8837 |
else
|
|
8838 |
func_verbose "extracting exported symbol list from '$soname'" |
|
8839 |
func_execute_cmds "$extract_expsyms_cmds" 'exit $?' |
|
8840 |
fi
|
|
8841 |
||
8842 |
# Create $newlib
|
|
8843 |
if test -f "$output_objdir/$newlib"; then :; else |
|
8844 |
func_verbose "generating import library for '$soname'" |
|
8845 |
func_execute_cmds "$old_archive_from_expsyms_cmds" 'exit $?' |
|
8846 |
fi
|
|
8847 |
# make sure the library variables are pointing to the new library
|
|
8848 |
dir=$output_objdir |
|
8849 |
linklib=$newlib |
|
8850 |
fi # test -n "$old_archive_from_expsyms_cmds" |
|
8851 |
||
8852 |
if test prog = "$linkmode" || test relink != "$opt_mode"; then |
|
8853 |
add_shlibpath= |
|
8854 |
add_dir= |
|
8855 |
add= |
|
8856 |
lib_linked=yes |
|
8857 |
case $hardcode_action in |
|
8858 |
immediate | unsupported) |
|
8859 |
if test no = "$hardcode_direct"; then |
|
8860 |
add=$dir/$linklib |
|
8861 |
case $host in |
|
8862 |
*-*-sco3.2v5.0.[024]*) add_dir=-L$dir ;; |
|
8863 |
*-*-sysv4*uw2*) add_dir=-L$dir ;; |
|
8864 |
*-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \ |
|
8865 |
*-*-unixware7*) add_dir=-L$dir ;; |
|
8866 |
*-*-darwin* )
|
|
8867 |
# if the lib is a (non-dlopened) module then we cannot
|
|
8868 |
# link against it, someone is ignoring the earlier warnings
|
|
8869 |
if /usr/bin/file -L $add 2> /dev/null | |
|
8870 |
$GREP ": [^:]* bundle" >/dev/null; then |
|
8871 |
if test "X$dlopenmodule" != "X$lib"; then |
|
8872 |
$ECHO "*** Warning: lib $linklib is a module, not a shared library" |
|
8873 |
if test -z "$old_library"; then |
|
8874 |
echo
|
|
8875 |
echo "*** And there doesn't seem to be a static archive available" |
|
8876 |
echo "*** The link will probably fail, sorry" |
|
8877 |
else
|
|
8878 |
add=$dir/$old_library |
|
8879 |
fi
|
|
8880 |
elif test -n "$old_library"; then |
|
8881 |
add=$dir/$old_library |
|
8882 |
fi
|
|
8883 |
fi
|
|
8884 |
esac
|
|
8885 |
elif test no = "$hardcode_minus_L"; then |
|
8886 |
case $host in |
|
8887 |
*-*-sunos*) add_shlibpath=$dir ;; |
|
8888 |
esac
|
|
8889 |
add_dir=-L$dir |
|
8890 |
add=-l$name |
|
8891 |
elif test no = "$hardcode_shlibpath_var"; then |
|
8892 |
add_shlibpath=$dir |
|
8893 |
add=-l$name |
|
8894 |
else
|
|
8895 |
lib_linked=no |
|
8896 |
fi
|
|
8897 |
;;
|
|
8898 |
relink)
|
|
8899 |
if test yes = "$hardcode_direct" && |
|
8900 |
test no = "$hardcode_direct_absolute"; then |
|
8901 |
add=$dir/$linklib |
|
8902 |
elif test yes = "$hardcode_minus_L"; then |
|
8903 |
add_dir=-L$absdir |
|
8904 |
# Try looking first in the location we're being installed to.
|
|
8905 |
if test -n "$inst_prefix_dir"; then |
|
8906 |
case $libdir in |
|
8907 |
[\\/]*) |
|
8908 |
func_append add_dir " -L$inst_prefix_dir$libdir" |
|
8909 |
;;
|
|
8910 |
esac
|
|
8911 |
fi
|
|
8912 |
add=-l$name |
|
8913 |
elif test yes = "$hardcode_shlibpath_var"; then |
|
8914 |
add_shlibpath=$dir |
|
8915 |
add=-l$name |
|
8916 |
else
|
|
8917 |
lib_linked=no |
|
8918 |
fi
|
|
8919 |
;;
|
|
8920 |
*) lib_linked=no ;; |
|
8921 |
esac
|
|
8922 |
||
8923 |
if test yes != "$lib_linked"; then |
|
8924 |
func_fatal_configuration "unsupported hardcode properties"
|
|
8925 |
fi
|
|
8926 |
||
8927 |
if test -n "$add_shlibpath"; then |
|
8928 |
case :$compile_shlibpath: in |
|
8929 |
*":$add_shlibpath:"*) ;; |
|
8930 |
*) func_append compile_shlibpath "$add_shlibpath:" ;; |
|
8931 |
esac
|
|
8932 |
fi
|
|
8933 |
if test prog = "$linkmode"; then |
|
8934 |
test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs" |
|
8935 |
test -n "$add" && compile_deplibs="$add $compile_deplibs" |
|
8936 |
else
|
|
8937 |
test -n "$add_dir" && deplibs="$add_dir $deplibs" |
|
8938 |
test -n "$add" && deplibs="$add $deplibs" |
|
8939 |
if test yes != "$hardcode_direct" && |
|
8940 |
test yes != "$hardcode_minus_L" && |
|
8941 |
test yes = "$hardcode_shlibpath_var"; then |
|
8942 |
case :$finalize_shlibpath: in |
|
8943 |
*":$libdir:"*) ;; |
|
8944 |
*) func_append finalize_shlibpath "$libdir:" ;; |
|
8945 |
esac
|
|
8946 |
fi
|
|
8947 |
fi
|
|
8948 |
fi
|
|
8949 |
||
8950 |
if test prog = "$linkmode" || test relink = "$opt_mode"; then |
|
8951 |
add_shlibpath= |
|
8952 |
add_dir= |
|
8953 |
add= |
|
8954 |
# Finalize command for both is simple: just hardcode it.
|
|
8955 |
if test yes = "$hardcode_direct" && |
|
8956 |
test no = "$hardcode_direct_absolute"; then |
|
8957 |
add=$libdir/$linklib |
|
8958 |
elif test yes = "$hardcode_minus_L"; then |
|
8959 |
add_dir=-L$libdir |
|
8960 |
add=-l$name |
|
8961 |
elif test yes = "$hardcode_shlibpath_var"; then |
|
8962 |
case :$finalize_shlibpath: in |
|
8963 |
*":$libdir:"*) ;; |
|
8964 |
*) func_append finalize_shlibpath "$libdir:" ;; |
|
8965 |
esac
|
|
8966 |
add=-l$name |
|
8967 |
elif test yes = "$hardcode_automatic"; then |
|
8968 |
if test -n "$inst_prefix_dir" && |
|
8969 |
test -f "$inst_prefix_dir$libdir/$linklib"; then |
|
8970 |
add=$inst_prefix_dir$libdir/$linklib |
|
8971 |
else
|
|
8972 |
add=$libdir/$linklib |
|
8973 |
fi
|
|
8974 |
else
|
|
8975 |
# We cannot seem to hardcode it, guess we'll fake it.
|
|
8976 |
add_dir=-L$libdir |
|
8977 |
# Try looking first in the location we're being installed to.
|
|
8978 |
if test -n "$inst_prefix_dir"; then |
|
8979 |
case $libdir in |
|
8980 |
[\\/]*) |
|
8981 |
func_append add_dir " -L$inst_prefix_dir$libdir" |
|
8982 |
;;
|
|
8983 |
esac
|
|
8984 |
fi
|
|
8985 |
add=-l$name |
|
8986 |
fi
|
|
8987 |
||
8988 |
if test prog = "$linkmode"; then |
|
8989 |
test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs" |
|
8990 |
test -n "$add" && finalize_deplibs="$add $finalize_deplibs" |
|
8991 |
else
|
|
8992 |
test -n "$add_dir" && deplibs="$add_dir $deplibs" |
|
8993 |
test -n "$add" && deplibs="$add $deplibs" |
|
8994 |
fi
|
|
8995 |
fi
|
|
8996 |
elif test prog = "$linkmode"; then |
|
8997 |
# Here we assume that one of hardcode_direct or hardcode_minus_L
|
|
8998 |
# is not unsupported. This is valid on all known static and
|
|
8999 |
# shared platforms.
|
|
9000 |
if test unsupported != "$hardcode_direct"; then |
|
9001 |
test -n "$old_library" && linklib=$old_library |
|
9002 |
compile_deplibs="$dir/$linklib $compile_deplibs" |
|
9003 |
finalize_deplibs="$dir/$linklib $finalize_deplibs" |
|
9004 |
else
|
|
9005 |
compile_deplibs="-l$name -L$dir $compile_deplibs" |
|
9006 |
finalize_deplibs="-l$name -L$dir $finalize_deplibs" |
|
9007 |
fi
|
|
9008 |
elif test yes = "$build_libtool_libs"; then |
|
9009 |
# Not a shared library
|
|
9010 |
if test pass_all != "$deplibs_check_method"; then |
|
9011 |
# We're trying link a shared library against a static one
|
|
9012 |
# but the system doesn't support it.
|
|
9013 |
||
9014 |
# Just print a warning and add the library to dependency_libs so
|
|
9015 |
# that the program can be linked against the static library.
|
|
9016 |
echo
|
|
9017 |
$ECHO "*** Warning: This system cannot link to static lib archive $lib." |
|
9018 |
echo "*** I have the capability to make that library automatically link in when" |
|
9019 |
echo "*** you link to this library. But I can only do this if you have a" |
|
9020 |
echo "*** shared version of the library, which you do not appear to have." |
|
9021 |
if test yes = "$module"; then |
|
9022 |
echo "*** But as you try to build a module library, libtool will still create " |
|
9023 |
echo "*** a static module, that should work as long as the dlopening application" |
|
9024 |
echo "*** is linked with the -dlopen flag to resolve symbols at runtime." |
|
9025 |
if test -z "$global_symbol_pipe"; then |
|
9026 |
echo
|
|
9027 |
echo "*** However, this would only work if libtool was able to extract symbol" |
|
9028 |
echo "*** lists from a program, using 'nm' or equivalent, but libtool could" |
|
9029 |
echo "*** not find such a program. So, this module is probably useless." |
|
9030 |
echo "*** 'nm' from GNU binutils and a full rebuild may help." |
|
9031 |
fi
|
|
9032 |
if test no = "$build_old_libs"; then |
|
9033 |
build_libtool_libs=module |
|
9034 |
build_old_libs=yes |
|
9035 |
else
|
|
9036 |
build_libtool_libs=no |
|
9037 |
fi
|
|
9038 |
fi
|
|
9039 |
else
|
|
9040 |
deplibs="$dir/$old_library $deplibs" |
|
9041 |
link_static=yes |
|
9042 |
fi
|
|
9043 |
fi # link shared/static library? |
|
9044 |
||
9045 |
if test lib = "$linkmode"; then |
|
9046 |
if test -n "$dependency_libs" && |
|
9047 |
{ test yes != "$hardcode_into_libs" || |
|
9048 |
test yes = "$build_old_libs" || |
|
9049 |
test yes = "$link_static"; }; then |
|
9050 |
# Extract -R from dependency_libs
|
|
9051 |
temp_deplibs= |
|
9052 |
for libdir in $dependency_libs; do |
|
9053 |
case $libdir in |
|
9054 |
-R*) func_stripname '-R' '' "$libdir" |
|
9055 |
temp_xrpath=$func_stripname_result |
|
9056 |
case " $xrpath " in |
|
9057 |
*" $temp_xrpath "*) ;; |
|
9058 |
*) func_append xrpath " $temp_xrpath";; |
|
9059 |
esac;; |
|
9060 |
*) func_append temp_deplibs " $libdir";; |
|
9061 |
esac
|
|
9062 |
done
|
|
9063 |
dependency_libs=$temp_deplibs |
|
9064 |
fi
|
|
9065 |
||
9066 |
func_append newlib_search_path " $absdir" |
|
9067 |
# Link against this library
|
|
9068 |
test no = "$link_static" && newdependency_libs="$abs_ladir/$laname $newdependency_libs" |
|
9069 |
# ... and its dependency_libs
|
|
9070 |
tmp_libs= |
|
9071 |
for deplib in $dependency_libs; do |
|
9072 |
newdependency_libs="$deplib $newdependency_libs" |
|
9073 |
case $deplib in |
|
9074 |
-L*) func_stripname '-L' '' "$deplib" |
|
9075 |
func_resolve_sysroot "$func_stripname_result";; |
|
9076 |
*) func_resolve_sysroot "$deplib" ;; |
|
9077 |
esac
|
|
9078 |
if $opt_preserve_dup_deps; then |
|
9079 |
case "$tmp_libs " in |
|
9080 |
*" $func_resolve_sysroot_result "*) |
|
9081 |
func_append specialdeplibs " $func_resolve_sysroot_result" ;; |
|
9082 |
esac
|
|
9083 |
fi
|
|
9084 |
func_append tmp_libs " $func_resolve_sysroot_result" |
|
9085 |
done
|
|
9086 |
||
9087 |
if test no != "$link_all_deplibs"; then |
|
9088 |
# Add the search paths of all dependency libraries
|
|
9089 |
for deplib in $dependency_libs; do |
|
9090 |
path= |
|
9091 |
case $deplib in |
|
9092 |
-L*) path=$deplib ;; |
|
9093 |
*.la)
|
|
9094 |
func_resolve_sysroot "$deplib" |
|
9095 |
deplib=$func_resolve_sysroot_result |
|
9096 |
func_dirname "$deplib" "" "." |
|
9097 |
dir=$func_dirname_result |
|
9098 |
# We need an absolute path.
|
|
9099 |
case $dir in |
|
9100 |
[\\/]* | [A-Za-z]:[\\/]*) absdir=$dir ;; |
|
9101 |
*)
|
|
9102 |
absdir=`cd "$dir" && pwd` |
|
9103 |
if test -z "$absdir"; then |
|
9104 |
func_warning "cannot determine absolute directory name of '$dir'" |
|
9105 |
absdir=$dir |
|
9106 |
fi
|
|
9107 |
;;
|
|
9108 |
esac
|
|
9109 |
if $GREP "^installed=no" $deplib > /dev/null; then |
|
9110 |
case $host in |
|
9111 |
*-*-darwin*)
|
|
9112 |
depdepl= |
|
9113 |
eval deplibrary_names=`$SED -n -e 's/^library_names=\(.*\)$/\1/p' $deplib` |
|
9114 |
if test -n "$deplibrary_names"; then |
|
9115 |
for tmp in $deplibrary_names; do |
|
9116 |
depdepl=$tmp |
|
9117 |
done
|
|
9118 |
if test -f "$absdir/$objdir/$depdepl"; then |
|
9119 |
depdepl=$absdir/$objdir/$depdepl |
|
9120 |
darwin_install_name=`$OTOOL -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'` |
|
9121 |
if test -z "$darwin_install_name"; then |
|
9122 |
darwin_install_name=`$OTOOL64 -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'` |
|
9123 |
fi
|
|
9124 |
func_append compiler_flags " $wl-dylib_file $wl$darwin_install_name:$depdepl" |
|
9125 |
func_append linker_flags " -dylib_file $darwin_install_name:$depdepl" |
|
9126 |
path= |
|
9127 |
fi
|
|
9128 |
fi
|
|
9129 |
;;
|
|
9130 |
*)
|
|
9131 |
path=-L$absdir/$objdir |
|
9132 |
;;
|
|
9133 |
esac
|
|
9134 |
else
|
|
9135 |
eval libdir=`$SED -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` |
|
9136 |
test -z "$libdir" && \ |
|
9137 |
func_fatal_error "'$deplib' is not a valid libtool archive" |
|
9138 |
test "$absdir" != "$libdir" && \ |
|
9139 |
func_warning "'$deplib' seems to be moved" |
|
9140 |
||
9141 |
path=-L$absdir |
|
9142 |
fi
|
|
9143 |
;;
|
|
9144 |
esac
|
|
9145 |
case " $deplibs " in |
|
9146 |
*" $path "*) ;; |
|
9147 |
*) deplibs="$path $deplibs" ;; |
|
9148 |
esac
|
|
9149 |
done
|
|
9150 |
fi # link_all_deplibs != no |
|
9151 |
fi # linkmode = lib |
|
9152 |
done # for deplib in $libs |
|
9153 |
if test link = "$pass"; then |
|
9154 |
if test prog = "$linkmode"; then |
|
9155 |
compile_deplibs="$new_inherited_linker_flags $compile_deplibs" |
|
9156 |
finalize_deplibs="$new_inherited_linker_flags $finalize_deplibs" |
|
9157 |
else
|
|
9158 |
compiler_flags="$compiler_flags "`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` |
|
9159 |
fi
|
|
9160 |
fi
|
|
9161 |
dependency_libs=$newdependency_libs |
|
9162 |
if test dlpreopen = "$pass"; then |
|
9163 |
# Link the dlpreopened libraries before other libraries
|
|
9164 |
for deplib in $save_deplibs; do |
|
9165 |
deplibs="$deplib $deplibs" |
|
9166 |
done
|
|
9167 |
fi
|
|
9168 |
if test dlopen != "$pass"; then |
|
9169 |
test conv = "$pass" || { |
|
9170 |
# Make sure lib_search_path contains only unique directories.
|
|
9171 |
lib_search_path= |
|
9172 |
for dir in $newlib_search_path; do |
|
9173 |
case "$lib_search_path " in |
|
9174 |
*" $dir "*) ;; |
|
9175 |
*) func_append lib_search_path " $dir" ;; |
|
9176 |
esac
|
|
9177 |
done
|
|
9178 |
newlib_search_path= |
|
9179 |
}
|
|
9180 |
||
9181 |
if test prog,link = "$linkmode,$pass"; then |
|
9182 |
vars="compile_deplibs finalize_deplibs" |
|
9183 |
else
|
|
9184 |
vars=deplibs |
|
9185 |
fi
|
|
9186 |
for var in $vars dependency_libs; do |
|
9187 |
# Add libraries to $var in reverse order
|
|
9188 |
eval tmp_libs=\"\$$var\" |
|
9189 |
new_libs= |
|
9190 |
for deplib in $tmp_libs; do |
|
9191 |
# FIXME: Pedantically, this is the right thing to do, so
|
|
9192 |
# that some nasty dependency loop isn't accidentally
|
|
9193 |
# broken:
|
|
9194 |
#new_libs="$deplib $new_libs"
|
|
9195 |
# Pragmatically, this seems to cause very few problems in
|
|
9196 |
# practice:
|
|
9197 |
case $deplib in |
|
9198 |
-L*) new_libs="$deplib $new_libs" ;; |
|
9199 |
-R*) ;; |
|
9200 |
*)
|
|
9201 |
# And here is the reason: when a library appears more
|
|
9202 |
# than once as an explicit dependence of a library, or
|
|
9203 |
# is implicitly linked in more than once by the
|
|
9204 |
# compiler, it is considered special, and multiple
|
|
9205 |
# occurrences thereof are not removed. Compare this
|
|
9206 |
# with having the same library being listed as a
|
|
9207 |
# dependency of multiple other libraries: in this case,
|
|
9208 |
# we know (pedantically, we assume) the library does not
|
|
9209 |
# need to be listed more than once, so we keep only the
|
|
9210 |
# last copy. This is not always right, but it is rare
|
|
9211 |
# enough that we require users that really mean to play
|
|
9212 |
# such unportable linking tricks to link the library
|
|
9213 |
# using -Wl,-lname, so that libtool does not consider it
|
|
9214 |
# for duplicate removal.
|
|
9215 |
case " $specialdeplibs " in |
|
9216 |
*" $deplib "*) new_libs="$deplib $new_libs" ;; |
|
9217 |
*)
|
|
9218 |
case " $new_libs " in |
|
9219 |
*" $deplib "*) ;; |
|
9220 |
*) new_libs="$deplib $new_libs" ;; |
|
9221 |
esac
|
|
9222 |
;;
|
|
9223 |
esac
|
|
9224 |
;;
|
|
9225 |
esac
|
|
9226 |
done
|
|
9227 |
tmp_libs= |
|
9228 |
for deplib in $new_libs; do |
|
9229 |
case $deplib in |
|
9230 |
-L*)
|
|
9231 |
case " $tmp_libs " in |
|
9232 |
*" $deplib "*) ;; |
|
9233 |
*) func_append tmp_libs " $deplib" ;; |
|
9234 |
esac
|
|
9235 |
;;
|
|
9236 |
*) func_append tmp_libs " $deplib" ;; |
|
9237 |
esac
|
|
9238 |
done
|
|
9239 |
eval $var=\"$tmp_libs\" |
|
9240 |
done # for var |
|
9241 |
fi
|
|
9242 |
||
9243 |
# Add Sun CC postdeps if required:
|
|
9244 |
test CXX = "$tagname" && { |
|
9245 |
case $host_os in |
|
9246 |
linux*)
|
|
9247 |
case `$CC -V 2>&1 | sed 5q` in |
|
9248 |
*Sun\ C*) # Sun C++ 5.9 |
|
9249 |
func_suncc_cstd_abi |
|
9250 |
||
9251 |
if test no != "$suncc_use_cstd_abi"; then |
|
9252 |
func_append postdeps ' -library=Cstd -library=Crun'
|
|
9253 |
fi
|
|
9254 |
;;
|
|
9255 |
esac
|
|
9256 |
;;
|
|
9257 |
||
9258 |
solaris*)
|
|
9259 |
func_cc_basename "$CC" |
|
9260 |
case $func_cc_basename_result in |
|
9261 |
CC* | sunCC*) |
|
9262 |
func_suncc_cstd_abi |
|
9263 |
||
9264 |
if test no != "$suncc_use_cstd_abi"; then |
|
9265 |
func_append postdeps ' -library=Cstd -library=Crun'
|
|
9266 |
fi
|
|
9267 |
;;
|
|
9268 |
esac
|
|
9269 |
;;
|
|
9270 |
esac
|
|
9271 |
}
|
|
9272 |
||
9273 |
# Last step: remove runtime libs from dependency_libs
|
|
9274 |
# (they stay in deplibs)
|
|
9275 |
tmp_libs= |
|
9276 |
for i in $dependency_libs; do |
|
9277 |
case " $predeps $postdeps $compiler_lib_search_path " in |
|
9278 |
*" $i "*) |
|
9279 |
i= |
|
9280 |
;;
|
|
9281 |
esac
|
|
9282 |
if test -n "$i"; then |
|
9283 |
func_append tmp_libs " $i" |
|
9284 |
fi
|
|
9285 |
done
|
|
9286 |
dependency_libs=$tmp_libs |
|
9287 |
done # for pass |
|
9288 |
if test prog = "$linkmode"; then |
|
9289 |
dlfiles=$newdlfiles |
|
9290 |
fi
|
|
9291 |
if test prog = "$linkmode" || test lib = "$linkmode"; then |
|
9292 |
dlprefiles=$newdlprefiles |
|
9293 |
fi
|
|
9294 |
||
9295 |
case $linkmode in |
|
9296 |
oldlib)
|
|
9297 |
if test -n "$dlfiles$dlprefiles" || test no != "$dlself"; then |
|
9298 |
func_warning "'-dlopen' is ignored for archives"
|
|
9299 |
fi
|
|
9300 |
||
9301 |
case " $deplibs" in |
|
9302 |
*\ -l* | *\ -L*) |
|
9303 |
func_warning "'-l' and '-L' are ignored for archives" ;; |
|
9304 |
esac
|
|
9305 |
||
9306 |
test -n "$rpath" && \ |
|
9307 |
func_warning "'-rpath' is ignored for archives"
|
|
9308 |
||
9309 |
test -n "$xrpath" && \ |
|
9310 |
func_warning "'-R' is ignored for archives"
|
|
9311 |
||
9312 |
test -n "$vinfo" && \ |
|
9313 |
func_warning "'-version-info/-version-number' is ignored for archives"
|
|
9314 |
||
9315 |
test -n "$release" && \ |
|
9316 |
func_warning "'-release' is ignored for archives"
|
|
9317 |
||
9318 |
test -n "$export_symbols$export_symbols_regex" && \ |
|
9319 |
func_warning "'-export-symbols' is ignored for archives"
|
|
9320 |
||
9321 |
# Now set the variables for building old libraries.
|
|
9322 |
build_libtool_libs=no |
|
9323 |
oldlibs=$output |
|
9324 |
func_append objs "$old_deplibs" |
|
9325 |
;;
|
|
9326 |
||
9327 |
lib)
|
|
9328 |
# Make sure we only generate libraries of the form 'libNAME.la'.
|
|
9329 |
case $outputname in |
|
9330 |
lib*)
|
|
9331 |
func_stripname 'lib' '.la' "$outputname" |
|
9332 |
name=$func_stripname_result |
|
9333 |
eval shared_ext=\"$shrext_cmds\" |
|
9334 |
eval libname=\"$libname_spec\" |
|
9335 |
;;
|
|
9336 |
*)
|
|
9337 |
test no = "$module" \ |
|
9338 |
&& func_fatal_help "libtool library '$output' must begin with 'lib'" |
|
9339 |
||
9340 |
if test no != "$need_lib_prefix"; then |
|
9341 |
# Add the "lib" prefix for modules if required
|
|
9342 |
func_stripname '' '.la' "$outputname" |
|
9343 |
name=$func_stripname_result |
|
9344 |
eval shared_ext=\"$shrext_cmds\" |
|
9345 |
eval libname=\"$libname_spec\" |
|
9346 |
else
|
|
9347 |
func_stripname '' '.la' "$outputname" |
|
9348 |
libname=$func_stripname_result |
|
9349 |
fi
|
|
9350 |
;;
|
|
9351 |
esac
|
|
9352 |
||
9353 |
if test -n "$objs"; then |
|
9354 |
if test pass_all != "$deplibs_check_method"; then |
|
9355 |
func_fatal_error "cannot build libtool library '$output' from non-libtool objects on this host:$objs" |
|
9356 |
else
|
|
9357 |
echo
|
|
9358 |
$ECHO "*** Warning: Linking the shared library $output against the non-libtool" |
|
9359 |
$ECHO "*** objects $objs is not portable!" |
|
9360 |
func_append libobjs " $objs" |
|
9361 |
fi
|
|
9362 |
fi
|
|
9363 |
||
9364 |
test no = "$dlself" \ |
|
9365 |
|| func_warning "'-dlopen self' is ignored for libtool libraries" |
|
9366 |
||
9367 |
set dummy $rpath |
|
9368 |
shift
|
|
9369 |
test 1 -lt "$#" \ |
|
9370 |
&& func_warning "ignoring multiple '-rpath's for a libtool library" |
|
9371 |
||
9372 |
install_libdir=$1 |
|
9373 |
||
9374 |
oldlibs= |
|
9375 |
if test -z "$rpath"; then |
|
9376 |
if test yes = "$build_libtool_libs"; then |
|
9377 |
# Building a libtool convenience library.
|
|
9378 |
# Some compilers have problems with a '.al' extension so
|
|
9379 |
# convenience libraries should have the same extension an
|
|
9380 |
# archive normally would.
|
|
9381 |
oldlibs="$output_objdir/$libname.$libext $oldlibs" |
|
9382 |
build_libtool_libs=convenience |
|
9383 |
build_old_libs=yes |
|
9384 |
fi
|
|
9385 |
||
9386 |
test -n "$vinfo" && \ |
|
9387 |
func_warning "'-version-info/-version-number' is ignored for convenience libraries"
|
|
9388 |
||
9389 |
test -n "$release" && \ |
|
9390 |
func_warning "'-release' is ignored for convenience libraries"
|
|
9391 |
else
|
|
9392 |
||
9393 |
# Parse the version information argument.
|
|
9394 |
save_ifs=$IFS; IFS=: |
|
9395 |
set dummy $vinfo 0 0 0 |
|
9396 |
shift
|
|
9397 |
IFS=$save_ifs |
|
9398 |
||
9399 |
test -n "$7" && \ |
|
9400 |
func_fatal_help "too many parameters to '-version-info'"
|
|
9401 |
||
9402 |
# convert absolute version numbers to libtool ages
|
|
9403 |
# this retains compatibility with .la files and attempts
|
|
9404 |
# to make the code below a bit more comprehensible
|
|
9405 |
||
9406 |
case $vinfo_number in |
|
9407 |
yes)
|
|
9408 |
number_major=$1 |
|
9409 |
number_minor=$2 |
|
9410 |
number_revision=$3 |
|
9411 |
#
|
|
9412 |
# There are really only two kinds -- those that
|
|
9413 |
# use the current revision as the major version
|
|
9414 |
# and those that subtract age and use age as
|
|
9415 |
# a minor version. But, then there is irix
|
|
9416 |
# that has an extra 1 added just for fun
|
|
9417 |
#
|
|
9418 |
case $version_type in |
|
9419 |
# correct linux to gnu/linux during the next big refactor
|
|
9420 |
darwin|freebsd-elf|linux|osf|windows|none) |
|
9421 |
func_arith $number_major + $number_minor |
|
9422 |
current=$func_arith_result |
|
9423 |
age=$number_minor |
|
9424 |
revision=$number_revision |
|
9425 |
;;
|
|
9426 |
freebsd-aout|qnx|sunos) |
|
9427 |
current=$number_major |
|
9428 |
revision=$number_minor |
|
9429 |
age=0 |
|
9430 |
;;
|
|
9431 |
irix|nonstopux) |
|
9432 |
func_arith $number_major + $number_minor |
|
9433 |
current=$func_arith_result |
|
9434 |
age=$number_minor |
|
9435 |
revision=$number_minor |
|
9436 |
lt_irix_increment=no |
|
9437 |
;;
|
|
9438 |
*)
|
|
9439 |
func_fatal_configuration "$modename: unknown library version type '$version_type'" |
|
9440 |
;;
|
|
9441 |
esac
|
|
9442 |
;;
|
|
9443 |
no)
|
|
9444 |
current=$1 |
|
9445 |
revision=$2 |
|
9446 |
age=$3 |
|
9447 |
;;
|
|
9448 |
esac
|
|
9449 |
||
9450 |
# Check that each of the things are valid numbers.
|
|
9451 |
case $current in |
|
9452 |
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]) ;; |
|
9453 |
*)
|
|
9454 |
func_error "CURRENT '$current' must be a nonnegative integer" |
|
9455 |
func_fatal_error "'$vinfo' is not valid version information" |
|
9456 |
;;
|
|
9457 |
esac
|
|
9458 |
||
9459 |
case $revision in |
|
9460 |
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]) ;; |
|
9461 |
*)
|
|
9462 |
func_error "REVISION '$revision' must be a nonnegative integer" |
|
9463 |
func_fatal_error "'$vinfo' is not valid version information" |
|
9464 |
;;
|
|
9465 |
esac
|
|
9466 |
||
9467 |
case $age in |
|
9468 |
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]) ;; |
|
9469 |
*)
|
|
9470 |
func_error "AGE '$age' must be a nonnegative integer" |
|
9471 |
func_fatal_error "'$vinfo' is not valid version information" |
|
9472 |
;;
|
|
9473 |
esac
|
|
9474 |
||
9475 |
if test "$age" -gt "$current"; then |
|
9476 |
func_error "AGE '$age' is greater than the current interface number '$current'" |
|
9477 |
func_fatal_error "'$vinfo' is not valid version information" |
|
9478 |
fi
|
|
9479 |
||
9480 |
# Calculate the version variables.
|
|
9481 |
major= |
|
9482 |
versuffix= |
|
9483 |
verstring= |
|
9484 |
case $version_type in |
|
9485 |
none) ;; |
|
9486 |
||
9487 |
darwin)
|
|
9488 |
# Like Linux, but with the current version available in
|
|
9489 |
# verstring for coding it into the library header
|
|
9490 |
func_arith $current - $age |
|
9491 |
major=.$func_arith_result |
|
9492 |
versuffix=$major.$age.$revision |
|
9493 |
# Darwin ld doesn't like 0 for these options...
|
|
9494 |
func_arith $current + 1 |
|
9495 |
minor_current=$func_arith_result |
|
9496 |
xlcverstring="$wl-compatibility_version $wl$minor_current $wl-current_version $wl$minor_current.$revision" |
|
9497 |
verstring="-compatibility_version $minor_current -current_version $minor_current.$revision" |
|
9498 |
# On Darwin other compilers
|
|
9499 |
case $CC in |
|
9500 |
nagfor*)
|
|
9501 |
verstring="$wl-compatibility_version $wl$minor_current $wl-current_version $wl$minor_current.$revision" |
|
9502 |
;;
|
|
9503 |
*)
|
|
9504 |
verstring="-compatibility_version $minor_current -current_version $minor_current.$revision" |
|
9505 |
;;
|
|
9506 |
esac
|
|
9507 |
;;
|
|
9508 |
||
9509 |
freebsd-aout)
|
|
9510 |
major=.$current |
|
9511 |
versuffix=.$current.$revision |
|
9512 |
;;
|
|
9513 |
||
9514 |
freebsd-elf)
|
|
9515 |
func_arith $current - $age |
|
9516 |
major=.$func_arith_result |
|
9517 |
versuffix=$major.$age.$revision |
|
9518 |
;;
|
|
9519 |
||
9520 |
irix | nonstopux) |
|
9521 |
if test no = "$lt_irix_increment"; then |
|
9522 |
func_arith $current - $age |
|
9523 |
else
|
|
9524 |
func_arith $current - $age + 1 |
|
9525 |
fi
|
|
9526 |
major=$func_arith_result |
|
9527 |
||
9528 |
case $version_type in |
|
9529 |
nonstopux) verstring_prefix=nonstopux ;; |
|
9530 |
*) verstring_prefix=sgi ;; |
|
9531 |
esac
|
|
9532 |
verstring=$verstring_prefix$major.$revision |
|
9533 |
||
9534 |
# Add in all the interfaces that we are compatible with.
|
|
9535 |
loop=$revision |
|
9536 |
while test 0 -ne "$loop"; do |
|
9537 |
func_arith $revision - $loop |
|
9538 |
iface=$func_arith_result |
|
9539 |
func_arith $loop - 1 |
|
9540 |
loop=$func_arith_result |
|
9541 |
verstring=$verstring_prefix$major.$iface:$verstring |
|
9542 |
done
|
|
9543 |
||
9544 |
# Before this point, $major must not contain '.'.
|
|
9545 |
major=.$major |
|
9546 |
versuffix=$major.$revision |
|
9547 |
;;
|
|
9548 |
||
9549 |
linux) # correct to gnu/linux during the next big refactor |
|
9550 |
func_arith $current - $age |
|
9551 |
major=.$func_arith_result |
|
9552 |
versuffix=$major.$age.$revision |
|
9553 |
;;
|
|
9554 |
||
9555 |
osf)
|
|
9556 |
func_arith $current - $age |
|
9557 |
major=.$func_arith_result |
|
9558 |
versuffix=.$current.$age.$revision |
|
9559 |
verstring=$current.$age.$revision |
|
9560 |
||
9561 |
# Add in all the interfaces that we are compatible with.
|
|
9562 |
loop=$age |
|
9563 |
while test 0 -ne "$loop"; do |
|
9564 |
func_arith $current - $loop |
|
9565 |
iface=$func_arith_result |
|
9566 |
func_arith $loop - 1 |
|
9567 |
loop=$func_arith_result |
|
9568 |
verstring=$verstring:$iface.0 |
|
9569 |
done
|
|
9570 |
||
9571 |
# Make executables depend on our current version.
|
|
9572 |
func_append verstring ":$current.0" |
|
9573 |
;;
|
|
9574 |
||
9575 |
qnx)
|
|
9576 |
major=.$current |
|
9577 |
versuffix=.$current |
|
9578 |
;;
|
|
9579 |
||
9580 |
sco)
|
|
9581 |
major=.$current |
|
9582 |
versuffix=.$current |
|
9583 |
;;
|
|
9584 |
||
9585 |
sunos)
|
|
9586 |
major=.$current |
|
9587 |
versuffix=.$current.$revision |
|
9588 |
;;
|
|
9589 |
||
9590 |
windows)
|
|
9591 |
# Use '-' rather than '.', since we only want one
|
|
9592 |
# extension on DOS 8.3 file systems.
|
|
9593 |
func_arith $current - $age |
|
9594 |
major=$func_arith_result |
|
9595 |
versuffix=-$major |
|
9596 |
;;
|
|
9597 |
||
9598 |
*)
|
|
9599 |
func_fatal_configuration "unknown library version type '$version_type'" |
|
9600 |
;;
|
|
9601 |
esac
|
|
9602 |
||
9603 |
# Clear the version info if we defaulted, and they specified a release.
|
|
9604 |
if test -z "$vinfo" && test -n "$release"; then |
|
9605 |
major= |
|
9606 |
case $version_type in |
|
9607 |
darwin)
|
|
9608 |
# we can't check for "0.0" in archive_cmds due to quoting
|
|
9609 |
# problems, so we reset it completely
|
|
9610 |
verstring= |
|
9611 |
;;
|
|
9612 |
*)
|
|
9613 |
verstring=0.0 |
|
9614 |
;;
|
|
9615 |
esac
|
|
9616 |
if test no = "$need_version"; then |
|
9617 |
versuffix= |
|
9618 |
else
|
|
9619 |
versuffix=.0.0 |
|
9620 |
fi
|
|
9621 |
fi
|
|
9622 |
||
9623 |
# Remove version info from name if versioning should be avoided
|
|
9624 |
if test yes,no = "$avoid_version,$need_version"; then |
|
9625 |
major= |
|
9626 |
versuffix= |
|
9627 |
verstring= |
|
9628 |
fi
|
|
9629 |
||
9630 |
# Check to see if the archive will have undefined symbols.
|
|
9631 |
if test yes = "$allow_undefined"; then |
|
9632 |
if test unsupported = "$allow_undefined_flag"; then |
|
9633 |
if test yes = "$build_old_libs"; then |
|
9634 |
func_warning "undefined symbols not allowed in $host shared libraries; building static only" |
|
9635 |
build_libtool_libs=no |
|
9636 |
else
|
|
9637 |
func_fatal_error "can't build $host shared library unless -no-undefined is specified" |
|
9638 |
fi
|
|
9639 |
fi
|
|
9640 |
else
|
|
9641 |
# Don't allow undefined symbols.
|
|
9642 |
allow_undefined_flag=$no_undefined_flag |
|
9643 |
fi
|
|
9644 |
||
9645 |
fi
|
|
9646 |
||
9647 |
func_generate_dlsyms "$libname" "$libname" : |
|
9648 |
func_append libobjs " $symfileobj" |
|
9649 |
test " " = "$libobjs" && libobjs= |
|
9650 |
||
9651 |
if test relink != "$opt_mode"; then |
|
9652 |
# Remove our outputs, but don't remove object files since they
|
|
9653 |
# may have been created when compiling PIC objects.
|
|
9654 |
removelist= |
|
9655 |
tempremovelist=`$ECHO "$output_objdir/*"` |
|
9656 |
for p in $tempremovelist; do |
|
9657 |
case $p in |
|
9658 |
*.$objext | *.gcno) |
|
9659 |
;;
|
|
9660 |
$output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/$libname$release.*) |
|
9661 |
if test -n "$precious_files_regex"; then |
|
9662 |
if $ECHO "$p" | $EGREP -e "$precious_files_regex" >/dev/null 2>&1 |
|
9663 |
then
|
|
9664 |
continue
|
|
9665 |
fi
|
|
9666 |
fi
|
|
9667 |
func_append removelist " $p" |
|
9668 |
;;
|
|
9669 |
*) ;; |
|
9670 |
esac
|
|
9671 |
done
|
|
9672 |
test -n "$removelist" && \ |
|
9673 |
func_show_eval "${RM}r \$removelist" |
|
9674 |
fi
|
|
9675 |
||
9676 |
# Now set the variables for building old libraries.
|
|
9677 |
if test yes = "$build_old_libs" && test convenience != "$build_libtool_libs"; then |
|
9678 |
func_append oldlibs " $output_objdir/$libname.$libext" |
|
9679 |
||
9680 |
# Transform .lo files to .o files.
|
|
9681 |
oldobjs="$objs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.$libext$/d; $lo2o" | $NL2SP` |
|
9682 |
fi
|
|
9683 |
||
9684 |
# Eliminate all temporary directories.
|
|
9685 |
#for path in $notinst_path; do
|
|
9686 |
# lib_search_path=`$ECHO "$lib_search_path " | $SED "s% $path % %g"`
|
|
9687 |
# deplibs=`$ECHO "$deplibs " | $SED "s% -L$path % %g"`
|
|
9688 |
# dependency_libs=`$ECHO "$dependency_libs " | $SED "s% -L$path % %g"`
|
|
9689 |
#done
|
|
9690 |
||
9691 |
if test -n "$xrpath"; then |
|
9692 |
# If the user specified any rpath flags, then add them.
|
|
9693 |
temp_xrpath= |
|
9694 |
for libdir in $xrpath; do |
|
9695 |
func_replace_sysroot "$libdir" |
|
9696 |
func_append temp_xrpath " -R$func_replace_sysroot_result" |
|
9697 |
case "$finalize_rpath " in |
|
9698 |
*" $libdir "*) ;; |
|
9699 |
*) func_append finalize_rpath " $libdir" ;; |
|
9700 |
esac
|
|
9701 |
done
|
|
9702 |
if test yes != "$hardcode_into_libs" || test yes = "$build_old_libs"; then |
|
9703 |
dependency_libs="$temp_xrpath $dependency_libs" |
|
9704 |
fi
|
|
9705 |
fi
|
|
9706 |
||
9707 |
# Make sure dlfiles contains only unique files that won't be dlpreopened
|
|
9708 |
old_dlfiles=$dlfiles |
|
9709 |
dlfiles= |
|
9710 |
for lib in $old_dlfiles; do |
|
9711 |
case " $dlprefiles $dlfiles " in |
|
9712 |
*" $lib "*) ;; |
|
9713 |
*) func_append dlfiles " $lib" ;; |
|
9714 |
esac
|
|
9715 |
done
|
|
9716 |
||
9717 |
# Make sure dlprefiles contains only unique files
|
|
9718 |
old_dlprefiles=$dlprefiles |
|
9719 |
dlprefiles= |
|
9720 |
for lib in $old_dlprefiles; do |
|
9721 |
case "$dlprefiles " in |
|
9722 |
*" $lib "*) ;; |
|
9723 |
*) func_append dlprefiles " $lib" ;; |
|
9724 |
esac
|
|
9725 |
done
|
|
9726 |
||
9727 |
if test yes = "$build_libtool_libs"; then |
|
9728 |
if test -n "$rpath"; then |
|
9729 |
case $host in |
|
9730 |
*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos* | *-cegcc* | *-*-haiku*) |
|
9731 |
# these systems don't actually have a c library (as such)!
|
|
9732 |
;;
|
|
9733 |
*-*-rhapsody* | *-*-darwin1.[012]) |
|
9734 |
# Rhapsody C library is in the System framework
|
|
9735 |
func_append deplibs " System.ltframework"
|
|
9736 |
;;
|
|
9737 |
*-*-netbsd*)
|
|
9738 |
# Don't link with libc until the a.out ld.so is fixed.
|
|
9739 |
;;
|
|
9740 |
*-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) |
|
9741 |
# Do not include libc due to us having libc/libc_r.
|
|
9742 |
;;
|
|
9743 |
*-*-sco3.2v5* | *-*-sco5v6*) |
|
9744 |
# Causes problems with __ctype
|
|
9745 |
;;
|
|
9746 |
*-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) |
|
9747 |
# Compiler inserts libc in the correct place for threads to work
|
|
9748 |
;;
|
|
9749 |
*)
|
|
9750 |
# Add libc to deplibs on all other systems if necessary.
|
|
9751 |
if test yes = "$build_libtool_need_lc"; then |
|
9752 |
func_append deplibs " -lc"
|
|
9753 |
fi
|
|
9754 |
;;
|
|
9755 |
esac
|
|
9756 |
fi
|
|
9757 |
||
9758 |
# Transform deplibs into only deplibs that can be linked in shared.
|
|
9759 |
name_save=$name |
|
9760 |
libname_save=$libname |
|
9761 |
release_save=$release |
|
9762 |
versuffix_save=$versuffix |
|
9763 |
major_save=$major |
|
9764 |
# I'm not sure if I'm treating the release correctly. I think
|
|
9765 |
# release should show up in the -l (ie -lgmp5) so we don't want to
|
|
9766 |
# add it in twice. Is that correct?
|
|
9767 |
release= |
|
9768 |
versuffix= |
|
9769 |
major= |
|
9770 |
newdeplibs= |
|
9771 |
droppeddeps=no |
|
9772 |
case $deplibs_check_method in |
|
9773 |
pass_all)
|
|
9774 |
# Don't check for shared/static. Everything works.
|
|
9775 |
# This might be a little naive. We might want to check
|
|
9776 |
# whether the library exists or not. But this is on
|
|
9777 |
# osf3 & osf4 and I'm not really sure... Just
|
|
9778 |
# implementing what was already the behavior.
|
|
9779 |
newdeplibs=$deplibs |
|
9780 |
;;
|
|
9781 |
test_compile)
|
|
9782 |
# This code stresses the "libraries are programs" paradigm to its
|
|
9783 |
# limits. Maybe even breaks it. We compile a program, linking it
|
|
9784 |
# against the deplibs as a proxy for the library. Then we can check
|
|
9785 |
# whether they linked in statically or dynamically with ldd.
|
|
9786 |
$opt_dry_run || $RM conftest.c |
|
9787 |
cat > conftest.c <<EOF
|
|
9788 |
int main() { return 0; }
|
|
9789 |
EOF
|
|
9790 |
$opt_dry_run || $RM conftest |
|
9791 |
if $LTCC $LTCFLAGS -o conftest conftest.c $deplibs; then |
|
9792 |
ldd_output=`ldd conftest` |
|
9793 |
for i in $deplibs; do |
|
9794 |
case $i in |
|
9795 |
-l*)
|
|
9796 |
func_stripname -l '' "$i" |
|
9797 |
name=$func_stripname_result |
|
9798 |
if test yes = "$allow_libtool_libs_with_static_runtimes"; then |
|
9799 |
case " $predeps $postdeps " in |
|
9800 |
*" $i "*) |
|
9801 |
func_append newdeplibs " $i" |
|
9802 |
i= |
|
9803 |
;;
|
|
9804 |
esac
|
|
9805 |
fi
|
|
9806 |
if test -n "$i"; then |
|
9807 |
libname=`eval "\\$ECHO \"$libname_spec\""` |
|
9808 |
deplib_matches=`eval "\\$ECHO \"$library_names_spec\""` |
|
9809 |
set dummy $deplib_matches; shift |
|
9810 |
deplib_match=$1 |
|
9811 |
if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0; then |
|
9812 |
func_append newdeplibs " $i" |
|
9813 |
else
|
|
9814 |
droppeddeps=yes |
|
9815 |
echo
|
|
9816 |
$ECHO "*** Warning: dynamic linker does not accept needed library $i." |
|
9817 |
echo "*** I have the capability to make that library automatically link in when" |
|
9818 |
echo "*** you link to this library. But I can only do this if you have a" |
|
9819 |
echo "*** shared version of the library, which I believe you do not have" |
|
9820 |
echo "*** because a test_compile did reveal that the linker did not use it for" |
|
9821 |
echo "*** its dynamic dependency list that programs get resolved with at runtime." |
|
9822 |
fi
|
|
9823 |
fi
|
|
9824 |
;;
|
|
9825 |
*)
|
|
9826 |
func_append newdeplibs " $i" |
|
9827 |
;;
|
|
9828 |
esac
|
|
9829 |
done
|
|
9830 |
else
|
|
9831 |
# Error occurred in the first compile. Let's try to salvage
|
|
9832 |
# the situation: Compile a separate program for each library.
|
|
9833 |
for i in $deplibs; do |
|
9834 |
case $i in |
|
9835 |
-l*)
|
|
9836 |
func_stripname -l '' "$i" |
|
9837 |
name=$func_stripname_result |
|
9838 |
$opt_dry_run || $RM conftest |
|
9839 |
if $LTCC $LTCFLAGS -o conftest conftest.c $i; then |
|
9840 |
ldd_output=`ldd conftest` |
|
9841 |
if test yes = "$allow_libtool_libs_with_static_runtimes"; then |
|
9842 |
case " $predeps $postdeps " in |
|
9843 |
*" $i "*) |
|
9844 |
func_append newdeplibs " $i" |
|
9845 |
i= |
|
9846 |
;;
|
|
9847 |
esac
|
|
9848 |
fi
|
|
9849 |
if test -n "$i"; then |
|
9850 |
libname=`eval "\\$ECHO \"$libname_spec\""` |
|
9851 |
deplib_matches=`eval "\\$ECHO \"$library_names_spec\""` |
|
9852 |
set dummy $deplib_matches; shift |
|
9853 |
deplib_match=$1 |
|
9854 |
if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0; then |
|
9855 |
func_append newdeplibs " $i" |
|
9856 |
else
|
|
9857 |
droppeddeps=yes |
|
9858 |
echo
|
|
9859 |
$ECHO "*** Warning: dynamic linker does not accept needed library $i." |
|
9860 |
echo "*** I have the capability to make that library automatically link in when" |
|
9861 |
echo "*** you link to this library. But I can only do this if you have a" |
|
9862 |
echo "*** shared version of the library, which you do not appear to have" |
|
9863 |
echo "*** because a test_compile did reveal that the linker did not use this one" |
|
9864 |
echo "*** as a dynamic dependency that programs can get resolved with at runtime." |
|
9865 |
fi
|
|
9866 |
fi
|
|
9867 |
else
|
|
9868 |
droppeddeps=yes |
|
9869 |
echo
|
|
9870 |
$ECHO "*** Warning! Library $i is needed by this library but I was not able to" |
|
9871 |
echo "*** make it link in! You will probably need to install it or some" |
|
9872 |
echo "*** library that it depends on before this library will be fully" |
|
9873 |
echo "*** functional. Installing it before continuing would be even better." |
|
9874 |
fi
|
|
9875 |
;;
|
|
9876 |
*)
|
|
9877 |
func_append newdeplibs " $i" |
|
9878 |
;;
|
|
9879 |
esac
|
|
9880 |
done
|
|
9881 |
fi
|
|
9882 |
;;
|
|
9883 |
file_magic*)
|
|
9884 |
set dummy $deplibs_check_method; shift |
|
9885 |
file_magic_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"` |
|
9886 |
for a_deplib in $deplibs; do |
|
9887 |
case $a_deplib in |
|
9888 |
-l*)
|
|
9889 |
func_stripname -l '' "$a_deplib" |
|
9890 |
name=$func_stripname_result |
|
9891 |
if test yes = "$allow_libtool_libs_with_static_runtimes"; then |
|
9892 |
case " $predeps $postdeps " in |
|
9893 |
*" $a_deplib "*) |
|
9894 |
func_append newdeplibs " $a_deplib" |
|
9895 |
a_deplib= |
|
9896 |
;;
|
|
9897 |
esac
|
|
9898 |
fi
|
|
9899 |
if test -n "$a_deplib"; then |
|
9900 |
libname=`eval "\\$ECHO \"$libname_spec\""` |
|
9901 |
if test -n "$file_magic_glob"; then |
|
9902 |
libnameglob=`func_echo_all "$libname" | $SED -e $file_magic_glob` |
|
9903 |
else
|
|
9904 |
libnameglob=$libname |
|
9905 |
fi
|
|
9906 |
test yes = "$want_nocaseglob" && nocaseglob=`shopt -p nocaseglob` |
|
9907 |
for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do |
|
9908 |
if test yes = "$want_nocaseglob"; then |
|
9909 |
shopt -s nocaseglob
|
|
9910 |
potential_libs=`ls $i/$libnameglob[.-]* 2>/dev/null` |
|
9911 |
$nocaseglob
|
|
9912 |
else
|
|
9913 |
potential_libs=`ls $i/$libnameglob[.-]* 2>/dev/null` |
|
9914 |
fi
|
|
9915 |
for potent_lib in $potential_libs; do |
|
9916 |
# Follow soft links.
|
|
9917 |
if ls -lLd "$potent_lib" 2>/dev/null | |
|
9918 |
$GREP " -> " >/dev/null; then |
|
9919 |
continue
|
|
9920 |
fi
|
|
9921 |
# The statement above tries to avoid entering an
|
|
9922 |
# endless loop below, in case of cyclic links.
|
|
9923 |
# We might still enter an endless loop, since a link
|
|
9924 |
# loop can be closed while we follow links,
|
|
9925 |
# but so what?
|
|
9926 |
potlib=$potent_lib |
|
9927 |
while test -h "$potlib" 2>/dev/null; do |
|
9928 |
potliblink=`ls -ld $potlib | $SED 's/.* -> //'` |
|
9929 |
case $potliblink in |
|
9930 |
[\\/]* | [A-Za-z]:[\\/]*) potlib=$potliblink;; |
|
9931 |
*) potlib=`$ECHO "$potlib" | $SED 's|[^/]*$||'`"$potliblink";; |
|
9932 |
esac
|
|
9933 |
done
|
|
9934 |
if eval $file_magic_cmd \"\$potlib\" 2>/dev/null | |
|
9935 |
$SED -e 10q | |
|
9936 |
$EGREP "$file_magic_regex" > /dev/null; then |
|
9937 |
func_append newdeplibs " $a_deplib" |
|
9938 |
a_deplib= |
|
9939 |
break 2 |
|
9940 |
fi
|
|
9941 |
done
|
|
9942 |
done
|
|
9943 |
fi
|
|
9944 |
if test -n "$a_deplib"; then |
|
9945 |
droppeddeps=yes |
|
9946 |
echo
|
|
9947 |
$ECHO "*** Warning: linker path does not have real file for library $a_deplib." |
|
9948 |
echo "*** I have the capability to make that library automatically link in when" |
|
9949 |
echo "*** you link to this library. But I can only do this if you have a" |
|
9950 |
echo "*** shared version of the library, which you do not appear to have" |
|
9951 |
echo "*** because I did check the linker path looking for a file starting" |
|
9952 |
if test -z "$potlib"; then |
|
9953 |
$ECHO "*** with $libname but no candidates were found. (...for file magic test)" |
|
9954 |
else
|
|
9955 |
$ECHO "*** with $libname and none of the candidates passed a file format test" |
|
9956 |
$ECHO "*** using a file magic. Last file checked: $potlib" |
|
9957 |
fi
|
|
9958 |
fi
|
|
9959 |
;;
|
|
9960 |
*)
|
|
9961 |
# Add a -L argument.
|
|
9962 |
func_append newdeplibs " $a_deplib" |
|
9963 |
;;
|
|
9964 |
esac
|
|
9965 |
done # Gone through all deplibs. |
|
9966 |
;;
|
|
9967 |
match_pattern*)
|
|
9968 |
set dummy $deplibs_check_method; shift |
|
9969 |
match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"` |
|
9970 |
for a_deplib in $deplibs; do |
|
9971 |
case $a_deplib in |
|
9972 |
-l*)
|
|
9973 |
func_stripname -l '' "$a_deplib" |
|
9974 |
name=$func_stripname_result |
|
9975 |
if test yes = "$allow_libtool_libs_with_static_runtimes"; then |
|
9976 |
case " $predeps $postdeps " in |
|
9977 |
*" $a_deplib "*) |
|
9978 |
func_append newdeplibs " $a_deplib" |
|
9979 |
a_deplib= |
|
9980 |
;;
|
|
9981 |
esac
|
|
9982 |
fi
|
|
9983 |
if test -n "$a_deplib"; then |
|
9984 |
libname=`eval "\\$ECHO \"$libname_spec\""` |
|
9985 |
for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do |
|
9986 |
potential_libs=`ls $i/$libname[.-]* 2>/dev/null` |
|
9987 |
for potent_lib in $potential_libs; do |
|
9988 |
potlib=$potent_lib # see symlink-check above in file_magic test |
|
9989 |
if eval "\$ECHO \"$potent_lib\"" 2>/dev/null | $SED 10q | \ |
|
9990 |
$EGREP "$match_pattern_regex" > /dev/null; then |
|
9991 |
func_append newdeplibs " $a_deplib" |
|
9992 |
a_deplib= |
|
9993 |
break 2 |
|
9994 |
fi
|
|
9995 |
done
|
|
9996 |
done
|
|
9997 |
fi
|
|
9998 |
if test -n "$a_deplib"; then |
|
9999 |
droppeddeps=yes |
|
10000 |
echo
|
|
10001 |
$ECHO "*** Warning: linker path does not have real file for library $a_deplib." |
|
10002 |
echo "*** I have the capability to make that library automatically link in when" |
|
10003 |
echo "*** you link to this library. But I can only do this if you have a" |
|
10004 |
echo "*** shared version of the library, which you do not appear to have" |
|
10005 |
echo "*** because I did check the linker path looking for a file starting" |
|
10006 |
if test -z "$potlib"; then |
|
10007 |
$ECHO "*** with $libname but no candidates were found. (...for regex pattern test)" |
|
10008 |
else
|
|
10009 |
$ECHO "*** with $libname and none of the candidates passed a file format test" |
|
10010 |
$ECHO "*** using a regex pattern. Last file checked: $potlib" |
|
10011 |
fi
|
|
10012 |
fi
|
|
10013 |
;;
|
|
10014 |
*)
|
|
10015 |
# Add a -L argument.
|
|
10016 |
func_append newdeplibs " $a_deplib" |
|
10017 |
;;
|
|
10018 |
esac
|
|
10019 |
done # Gone through all deplibs. |
|
10020 |
;;
|
|
10021 |
none | unknown | *) |
|
10022 |
newdeplibs= |
|
10023 |
tmp_deplibs=`$ECHO " $deplibs" | $SED 's/ -lc$//; s/ -[LR][^ ]*//g'` |
|
10024 |
if test yes = "$allow_libtool_libs_with_static_runtimes"; then |
|
10025 |
for i in $predeps $postdeps; do |
|
10026 |
# can't use Xsed below, because $i might contain '/'
|
|
10027 |
tmp_deplibs=`$ECHO " $tmp_deplibs" | $SED "s|$i||"` |
|
10028 |
done
|
|
10029 |
fi
|
|
10030 |
case $tmp_deplibs in |
|
10031 |
*[!\ \ ]*) |
|
10032 |
echo
|
|
10033 |
if test none = "$deplibs_check_method"; then |
|
10034 |
echo "*** Warning: inter-library dependencies are not supported in this platform." |
|
10035 |
else
|
|
10036 |
echo "*** Warning: inter-library dependencies are not known to be supported." |
|
10037 |
fi
|
|
10038 |
echo "*** All declared inter-library dependencies are being dropped." |
|
10039 |
droppeddeps=yes |
|
10040 |
;;
|
|
10041 |
esac
|
|
10042 |
;;
|
|
10043 |
esac
|
|
10044 |
versuffix=$versuffix_save |
|
10045 |
major=$major_save |
|
10046 |
release=$release_save |
|
10047 |
libname=$libname_save |
|
10048 |
name=$name_save |
|
10049 |
||
10050 |
case $host in |
|
10051 |
*-*-rhapsody* | *-*-darwin1.[012]) |
|
10052 |
# On Rhapsody replace the C library with the System framework
|
|
10053 |
newdeplibs=`$ECHO " $newdeplibs" | $SED 's/ -lc / System.ltframework /'` |
|
10054 |
;;
|
|
10055 |
esac
|
|
10056 |
||
10057 |
if test yes = "$droppeddeps"; then |
|
10058 |
if test yes = "$module"; then |
|
10059 |
echo
|
|
10060 |
echo "*** Warning: libtool could not satisfy all declared inter-library" |
|
10061 |
$ECHO "*** dependencies of module $libname. Therefore, libtool will create" |
|
10062 |
echo "*** a static module, that should work as long as the dlopening" |
|
10063 |
echo "*** application is linked with the -dlopen flag." |
|
10064 |
if test -z "$global_symbol_pipe"; then |
|
10065 |
echo
|
|
10066 |
echo "*** However, this would only work if libtool was able to extract symbol" |
|
10067 |
echo "*** lists from a program, using 'nm' or equivalent, but libtool could" |
|
10068 |
echo "*** not find such a program. So, this module is probably useless." |
|
10069 |
echo "*** 'nm' from GNU binutils and a full rebuild may help." |
|
10070 |
fi
|
|
10071 |
if test no = "$build_old_libs"; then |
|
10072 |
oldlibs=$output_objdir/$libname.$libext |
|
10073 |
build_libtool_libs=module |
|
10074 |
build_old_libs=yes |
|
10075 |
else
|
|
10076 |
build_libtool_libs=no |
|
10077 |
fi
|
|
10078 |
else
|
|
10079 |
echo "*** The inter-library dependencies that have been dropped here will be" |
|
10080 |
echo "*** automatically added whenever a program is linked with this library" |
|
10081 |
echo "*** or is declared to -dlopen it." |
|
10082 |
||
10083 |
if test no = "$allow_undefined"; then |
|
10084 |
echo
|
|
10085 |
echo "*** Since this library must not contain undefined symbols," |
|
10086 |
echo "*** because either the platform does not support them or" |
|
10087 |
echo "*** it was explicitly requested with -no-undefined," |
|
10088 |
echo "*** libtool will only create a static version of it." |
|
10089 |
if test no = "$build_old_libs"; then |
|
10090 |
oldlibs=$output_objdir/$libname.$libext |
|
10091 |
build_libtool_libs=module |
|
10092 |
build_old_libs=yes |
|
10093 |
else
|
|
10094 |
build_libtool_libs=no |
|
10095 |
fi
|
|
10096 |
fi
|
|
10097 |
fi
|
|
10098 |
fi
|
|
10099 |
# Done checking deplibs!
|
|
10100 |
deplibs=$newdeplibs |
|
10101 |
fi
|
|
10102 |
# Time to change all our "foo.ltframework" stuff back to "-framework foo"
|
|
10103 |
case $host in |
|
10104 |
*-*-darwin*)
|
|
10105 |
newdeplibs=`$ECHO " $newdeplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` |
|
10106 |
new_inherited_linker_flags=`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` |
|
10107 |
deplibs=`$ECHO " $deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` |
|
10108 |
;;
|
|
10109 |
esac
|
|
10110 |
||
10111 |
# move library search paths that coincide with paths to not yet
|
|
10112 |
# installed libraries to the beginning of the library search list
|
|
10113 |
new_libs= |
|
10114 |
for path in $notinst_path; do |
|
10115 |
case " $new_libs " in |
|
10116 |
*" -L$path/$objdir "*) ;; |
|
10117 |
*)
|
|
10118 |
case " $deplibs " in |
|
10119 |
*" -L$path/$objdir "*) |
|
10120 |
func_append new_libs " -L$path/$objdir" ;; |
|
10121 |
esac
|
|
10122 |
;;
|
|
10123 |
esac
|
|
10124 |
done
|
|
10125 |
for deplib in $deplibs; do |
|
10126 |
case $deplib in |
|
10127 |
-L*)
|
|
10128 |
case " $new_libs " in |
|
10129 |
*" $deplib "*) ;; |
|
10130 |
*) func_append new_libs " $deplib" ;; |
|
10131 |
esac
|
|
10132 |
;;
|
|
10133 |
*) func_append new_libs " $deplib" ;; |
|
10134 |
esac
|
|
10135 |
done
|
|
10136 |
deplibs=$new_libs |
|
10137 |
||
10138 |
# All the library-specific variables (install_libdir is set above).
|
|
10139 |
library_names= |
|
10140 |
old_library= |
|
10141 |
dlname= |
|
10142 |
||
10143 |
# Test again, we may have decided not to build it any more
|
|
10144 |
if test yes = "$build_libtool_libs"; then |
|
10145 |
# Remove $wl instances when linking with ld.
|
|
10146 |
# FIXME: should test the right _cmds variable.
|
|
10147 |
case $archive_cmds in |
|
10148 |
*\$LD\ *) wl= ;; |
|
10149 |
esac
|
|
10150 |
if test yes = "$hardcode_into_libs"; then |
|
10151 |
# Hardcode the library paths
|
|
10152 |
hardcode_libdirs= |
|
10153 |
dep_rpath= |
|
10154 |
rpath=$finalize_rpath |
|
10155 |
test relink = "$opt_mode" || rpath=$compile_rpath$rpath |
|
10156 |
for libdir in $rpath; do |
|
10157 |
if test -n "$hardcode_libdir_flag_spec"; then |
|
10158 |
if test -n "$hardcode_libdir_separator"; then |
|
10159 |
func_replace_sysroot "$libdir" |
|
10160 |
libdir=$func_replace_sysroot_result |
|
10161 |
if test -z "$hardcode_libdirs"; then |
|
10162 |
hardcode_libdirs=$libdir |
|
10163 |
else
|
|
10164 |
# Just accumulate the unique libdirs.
|
|
10165 |
case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in |
|
10166 |
*"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) |
|
10167 |
;;
|
|
10168 |
*)
|
|
10169 |
func_append hardcode_libdirs "$hardcode_libdir_separator$libdir" |
|
10170 |
;;
|
|
10171 |
esac
|
|
10172 |
fi
|
|
10173 |
else
|
|
10174 |
eval flag=\"$hardcode_libdir_flag_spec\" |
|
10175 |
func_append dep_rpath " $flag" |
|
10176 |
fi
|
|
10177 |
elif test -n "$runpath_var"; then |
|
10178 |
case "$perm_rpath " in |
|
10179 |
*" $libdir "*) ;; |
|
10180 |
*) func_append perm_rpath " $libdir" ;; |
|
10181 |
esac
|
|
10182 |
fi
|
|
10183 |
done
|
|
10184 |
# Substitute the hardcoded libdirs into the rpath.
|
|
10185 |
if test -n "$hardcode_libdir_separator" && |
|
10186 |
test -n "$hardcode_libdirs"; then |
|
10187 |
libdir=$hardcode_libdirs |
|
10188 |
eval "dep_rpath=\"$hardcode_libdir_flag_spec\"" |
|
10189 |
fi
|
|
10190 |
if test -n "$runpath_var" && test -n "$perm_rpath"; then |
|
10191 |
# We should set the runpath_var.
|
|
10192 |
rpath= |
|
10193 |
for dir in $perm_rpath; do |
|
10194 |
func_append rpath "$dir:" |
|
10195 |
done
|
|
10196 |
eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var" |
|
10197 |
fi
|
|
10198 |
test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs" |
|
10199 |
fi
|
|
10200 |
||
10201 |
shlibpath=$finalize_shlibpath |
|
10202 |
test relink = "$opt_mode" || shlibpath=$compile_shlibpath$shlibpath |
|
10203 |
if test -n "$shlibpath"; then |
|
10204 |
eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var" |
|
10205 |
fi
|
|
10206 |
||
10207 |
# Get the real and link names of the library.
|
|
10208 |
eval shared_ext=\"$shrext_cmds\" |
|
10209 |
eval library_names=\"$library_names_spec\" |
|
10210 |
set dummy $library_names |
|
10211 |
shift
|
|
10212 |
realname=$1 |
|
10213 |
shift
|
|
10214 |
||
10215 |
if test -n "$soname_spec"; then |
|
10216 |
eval soname=\"$soname_spec\" |
|
10217 |
else
|
|
10218 |
soname=$realname |
|
10219 |
fi
|
|
10220 |
if test -z "$dlname"; then |
|
10221 |
dlname=$soname |
|
10222 |
fi
|
|
10223 |
||
10224 |
lib=$output_objdir/$realname |
|
10225 |
linknames= |
|
10226 |
for link
|
|
10227 |
do
|
|
10228 |
func_append linknames " $link" |
|
10229 |
done
|
|
10230 |
||
10231 |
# Use standard objects if they are pic
|
|
10232 |
test -z "$pic_flag" && libobjs=`$ECHO "$libobjs" | $SP2NL | $SED "$lo2o" | $NL2SP` |
|
10233 |
test "X$libobjs" = "X " && libobjs= |
|
10234 |
||
10235 |
delfiles= |
|
10236 |
if test -n "$export_symbols" && test -n "$include_expsyms"; then |
|
10237 |
$opt_dry_run || cp "$export_symbols" "$output_objdir/$libname.uexp" |
|
10238 |
export_symbols=$output_objdir/$libname.uexp |
|
10239 |
func_append delfiles " $export_symbols" |
|
10240 |
fi
|
|
10241 |
||
10242 |
orig_export_symbols= |
|
10243 |
case $host_os in |
|
10244 |
cygwin* | mingw* | cegcc*) |
|
10245 |
if test -n "$export_symbols" && test -z "$export_symbols_regex"; then |
|
10246 |
# exporting using user supplied symfile
|
|
10247 |
func_dll_def_p "$export_symbols" || { |
|
10248 |
# and it's NOT already a .def file. Must figure out
|
|
10249 |
# which of the given symbols are data symbols and tag
|
|
10250 |
# them as such. So, trigger use of export_symbols_cmds.
|
|
10251 |
# export_symbols gets reassigned inside the "prepare
|
|
10252 |
# the list of exported symbols" if statement, so the
|
|
10253 |
# include_expsyms logic still works.
|
|
10254 |
orig_export_symbols=$export_symbols |
|
10255 |
export_symbols= |
|
10256 |
always_export_symbols=yes |
|
10257 |
}
|
|
10258 |
fi
|
|
10259 |
;;
|
|
10260 |
esac
|
|
10261 |
||
10262 |
# Prepare the list of exported symbols
|
|
10263 |
if test -z "$export_symbols"; then |
|
10264 |
if test yes = "$always_export_symbols" || test -n "$export_symbols_regex"; then |
|
10265 |
func_verbose "generating symbol list for '$libname.la'" |
|
10266 |
export_symbols=$output_objdir/$libname.exp |
|
10267 |
$opt_dry_run || $RM $export_symbols |
|
10268 |
cmds=$export_symbols_cmds |
|
10269 |
save_ifs=$IFS; IFS='~' |
|
10270 |
for cmd1 in $cmds; do |
|
10271 |
IFS=$save_ifs |
|
10272 |
# Take the normal branch if the nm_file_list_spec branch
|
|
10273 |
# doesn't work or if tool conversion is not needed.
|
|
10274 |
case $nm_file_list_spec~$to_tool_file_cmd in |
|
10275 |
*~func_convert_file_noop | *~func_convert_file_msys_to_w32 | ~*) |
|
10276 |
try_normal_branch=yes |
|
10277 |
eval cmd=\"$cmd1\" |
|
10278 |
func_len " $cmd" |
|
10279 |
len=$func_len_result |
|
10280 |
;;
|
|
10281 |
*)
|
|
10282 |
try_normal_branch=no |
|
10283 |
;;
|
|
10284 |
esac
|
|
10285 |
if test yes = "$try_normal_branch" \ |
|
10286 |
&& { test "$len" -lt "$max_cmd_len" \ |
|
10287 |
|| test "$max_cmd_len" -le -1; } |
|
10288 |
then
|
|
10289 |
func_show_eval "$cmd" 'exit $?' |
|
10290 |
skipped_export=false |
|
10291 |
elif test -n "$nm_file_list_spec"; then |
|
10292 |
func_basename "$output" |
|
10293 |
output_la=$func_basename_result |
|
10294 |
save_libobjs=$libobjs |
|
10295 |
save_output=$output |
|
10296 |
output=$output_objdir/$output_la.nm |
|
10297 |
func_to_tool_file "$output" |
|
10298 |
libobjs=$nm_file_list_spec$func_to_tool_file_result |
|
10299 |
func_append delfiles " $output" |
|
10300 |
func_verbose "creating $NM input file list: $output" |
|
10301 |
for obj in $save_libobjs; do |
|
10302 |
func_to_tool_file "$obj" |
|
10303 |
$ECHO "$func_to_tool_file_result" |
|
10304 |
done > "$output" |
|
10305 |
eval cmd=\"$cmd1\" |
|
10306 |
func_show_eval "$cmd" 'exit $?' |
|
10307 |
output=$save_output |
|
10308 |
libobjs=$save_libobjs |
|
10309 |
skipped_export=false |
|
10310 |
else
|
|
10311 |
# The command line is too long to execute in one step.
|
|
10312 |
func_verbose "using reloadable object file for export list..."
|
|
10313 |
skipped_export=: |
|
10314 |
# Break out early, otherwise skipped_export may be
|
|
10315 |
# set to false by a later but shorter cmd.
|
|
10316 |
break
|
|
10317 |
fi
|
|
10318 |
done
|
|
10319 |
IFS=$save_ifs |
|
10320 |
if test -n "$export_symbols_regex" && test : != "$skipped_export"; then |
|
10321 |
func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
|
|
10322 |
func_show_eval '$MV "${export_symbols}T" "$export_symbols"'
|
|
10323 |
fi
|
|
10324 |
fi
|
|
10325 |
fi
|
|
10326 |
||
10327 |
if test -n "$export_symbols" && test -n "$include_expsyms"; then |
|
10328 |
tmp_export_symbols=$export_symbols |
|
10329 |
test -n "$orig_export_symbols" && tmp_export_symbols=$orig_export_symbols |
|
10330 |
$opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"' |
|
10331 |
fi
|
|
10332 |
||
10333 |
if test : != "$skipped_export" && test -n "$orig_export_symbols"; then |
|
10334 |
# The given exports_symbols file has to be filtered, so filter it.
|
|
10335 |
func_verbose "filter symbol list for '$libname.la' to tag DATA exports" |
|
10336 |
# FIXME: $output_objdir/$libname.filter potentially contains lots of
|
|
10337 |
# 's' commands, which not all seds can handle. GNU sed should be fine
|
|
10338 |
# though. Also, the filter scales superlinearly with the number of
|
|
10339 |
# global variables. join(1) would be nice here, but unfortunately
|
|
10340 |
# isn't a blessed tool.
|
|
10341 |
$opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter |
|
10342 |
func_append delfiles " $export_symbols $output_objdir/$libname.filter" |
|
10343 |
export_symbols=$output_objdir/$libname.def |
|
10344 |
$opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols |
|
10345 |
fi
|
|
10346 |
||
10347 |
tmp_deplibs= |
|
10348 |
for test_deplib in $deplibs; do |
|
10349 |
case " $convenience " in |
|
10350 |
*" $test_deplib "*) ;; |
|
10351 |
*)
|
|
10352 |
func_append tmp_deplibs " $test_deplib" |
|
10353 |
;;
|
|
10354 |
esac
|
|
10355 |
done
|
|
10356 |
deplibs=$tmp_deplibs |
|
10357 |
||
10358 |
if test -n "$convenience"; then |
|
10359 |
if test -n "$whole_archive_flag_spec" && |
|
10360 |
test yes = "$compiler_needs_object" && |
|
10361 |
test -z "$libobjs"; then |
|
10362 |
# extract the archives, so we have objects to list.
|
|
10363 |
# TODO: could optimize this to just extract one archive.
|
|
10364 |
whole_archive_flag_spec= |
|
10365 |
fi
|
|
10366 |
if test -n "$whole_archive_flag_spec"; then |
|
10367 |
save_libobjs=$libobjs |
|
10368 |
eval libobjs=\"\$libobjs $whole_archive_flag_spec\" |
|
10369 |
test "X$libobjs" = "X " && libobjs= |
|
10370 |
else
|
|
10371 |
gentop=$output_objdir/${outputname}x |
|
10372 |
func_append generated " $gentop" |
|
10373 |
||
10374 |
func_extract_archives $gentop $convenience |
|
10375 |
func_append libobjs " $func_extract_archives_result" |
|
10376 |
test "X$libobjs" = "X " && libobjs= |
|
10377 |
fi
|
|
10378 |
fi
|
|
10379 |
||
10380 |
if test yes = "$thread_safe" && test -n "$thread_safe_flag_spec"; then |
|
10381 |
eval flag=\"$thread_safe_flag_spec\" |
|
10382 |
func_append linker_flags " $flag" |
|
10383 |
fi
|
|
10384 |
||
10385 |
# Make a backup of the uninstalled library when relinking
|
|
10386 |
if test relink = "$opt_mode"; then |
|
10387 |
$opt_dry_run || eval '(cd $output_objdir && $RM ${realname}U && $MV $realname ${realname}U)' || exit $? |
|
10388 |
fi
|
|
10389 |
||
10390 |
# Do each of the archive commands.
|
|
10391 |
if test yes = "$module" && test -n "$module_cmds"; then |
|
10392 |
if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then |
|
10393 |
eval test_cmds=\"$module_expsym_cmds\" |
|
10394 |
cmds=$module_expsym_cmds |
|
10395 |
else
|
|
10396 |
eval test_cmds=\"$module_cmds\" |
|
10397 |
cmds=$module_cmds |
|
10398 |
fi
|
|
10399 |
else
|
|
10400 |
if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then |
|
10401 |
eval test_cmds=\"$archive_expsym_cmds\" |
|
10402 |
cmds=$archive_expsym_cmds |
|
10403 |
else
|
|
10404 |
eval test_cmds=\"$archive_cmds\" |
|
10405 |
cmds=$archive_cmds |
|
10406 |
fi
|
|
10407 |
fi
|
|
10408 |
||
10409 |
if test : != "$skipped_export" && |
|
10410 |
func_len " $test_cmds" && |
|
10411 |
len=$func_len_result && |
|
10412 |
test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then |
|
10413 |
: |
|
10414 |
else
|
|
10415 |
# The command line is too long to link in one step, link piecewise
|
|
10416 |
# or, if using GNU ld and skipped_export is not :, use a linker
|
|
10417 |
# script.
|
|
10418 |
||
10419 |
# Save the value of $output and $libobjs because we want to
|
|
10420 |
# use them later. If we have whole_archive_flag_spec, we
|
|
10421 |
# want to use save_libobjs as it was before
|
|
10422 |
# whole_archive_flag_spec was expanded, because we can't
|
|
10423 |
# assume the linker understands whole_archive_flag_spec.
|
|
10424 |
# This may have to be revisited, in case too many
|
|
10425 |
# convenience libraries get linked in and end up exceeding
|
|
10426 |
# the spec.
|
|
10427 |
if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then |
|
10428 |
save_libobjs=$libobjs |
|
10429 |
fi
|
|
10430 |
save_output=$output |
|
10431 |
func_basename "$output" |
|
10432 |
output_la=$func_basename_result |
|
10433 |
||
10434 |
# Clear the reloadable object creation command queue and
|
|
10435 |
# initialize k to one.
|
|
10436 |
test_cmds= |
|
10437 |
concat_cmds= |
|
10438 |
objlist= |
|
10439 |
last_robj= |
|
10440 |
k=1 |
|
10441 |
||
10442 |
if test -n "$save_libobjs" && test : != "$skipped_export" && test yes = "$with_gnu_ld"; then |
|
10443 |
output=$output_objdir/$output_la.lnkscript |
|
10444 |
func_verbose "creating GNU ld script: $output" |
|
10445 |
echo 'INPUT (' > $output |
|
10446 |
for obj in $save_libobjs |
|
10447 |
do
|
|
10448 |
func_to_tool_file "$obj" |
|
10449 |
$ECHO "$func_to_tool_file_result" >> $output |
|
10450 |
done
|
|
10451 |
echo ')' >> $output |
|
10452 |
func_append delfiles " $output" |
|
10453 |
func_to_tool_file "$output" |
|
10454 |
output=$func_to_tool_file_result |
|
10455 |
elif test -n "$save_libobjs" && test : != "$skipped_export" && test -n "$file_list_spec"; then |
|
10456 |
output=$output_objdir/$output_la.lnk |
|
10457 |
func_verbose "creating linker input file list: $output" |
|
10458 |
: > $output
|
|
10459 |
set x $save_libobjs |
|
10460 |
shift
|
|
10461 |
firstobj= |
|
10462 |
if test yes = "$compiler_needs_object"; then |
|
10463 |
firstobj="$1 " |
|
10464 |
shift
|
|
10465 |
fi
|
|
10466 |
for obj
|
|
10467 |
do
|
|
10468 |
func_to_tool_file "$obj" |
|
10469 |
$ECHO "$func_to_tool_file_result" >> $output |
|
10470 |
done
|
|
10471 |
func_append delfiles " $output" |
|
10472 |
func_to_tool_file "$output" |
|
10473 |
output=$firstobj\"$file_list_spec$func_to_tool_file_result\" |
|
10474 |
else
|
|
10475 |
if test -n "$save_libobjs"; then |
|
10476 |
func_verbose "creating reloadable object files..."
|
|
10477 |
output=$output_objdir/$output_la-$k.$objext |
|
10478 |
eval test_cmds=\"$reload_cmds\" |
|
10479 |
func_len " $test_cmds" |
|
10480 |
len0=$func_len_result |
|
10481 |
len=$len0 |
|
10482 |
||
10483 |
# Loop over the list of objects to be linked.
|
|
10484 |
for obj in $save_libobjs |
|
10485 |
do
|
|
10486 |
func_len " $obj" |
|
10487 |
func_arith $len + $func_len_result |
|
10488 |
len=$func_arith_result |
|
10489 |
if test -z "$objlist" || |
|
10490 |
test "$len" -lt "$max_cmd_len"; then |
|
10491 |
func_append objlist " $obj" |
|
10492 |
else
|
|
10493 |
# The command $test_cmds is almost too long, add a
|
|
10494 |
# command to the queue.
|
|
10495 |
if test 1 -eq "$k"; then |
|
10496 |
# The first file doesn't have a previous command to add.
|
|
10497 |
reload_objs=$objlist |
|
10498 |
eval concat_cmds=\"$reload_cmds\" |
|
10499 |
else
|
|
10500 |
# All subsequent reloadable object files will link in
|
|
10501 |
# the last one created.
|
|
10502 |
reload_objs="$objlist $last_robj" |
|
10503 |
eval concat_cmds=\"\$concat_cmds~$reload_cmds~\$RM $last_robj\" |
|
10504 |
fi
|
|
10505 |
last_robj=$output_objdir/$output_la-$k.$objext |
|
10506 |
func_arith $k + 1 |
|
10507 |
k=$func_arith_result |
|
10508 |
output=$output_objdir/$output_la-$k.$objext |
|
10509 |
objlist=" $obj" |
|
10510 |
func_len " $last_robj" |
|
10511 |
func_arith $len0 + $func_len_result |
|
10512 |
len=$func_arith_result |
|
10513 |
fi
|
|
10514 |
done
|
|
10515 |
# Handle the remaining objects by creating one last
|
|
10516 |
# reloadable object file. All subsequent reloadable object
|
|
10517 |
# files will link in the last one created.
|
|
10518 |
test -z "$concat_cmds" || concat_cmds=$concat_cmds~ |
|
10519 |
reload_objs="$objlist $last_robj" |
|
10520 |
eval concat_cmds=\"\$concat_cmds$reload_cmds\" |
|
10521 |
if test -n "$last_robj"; then |
|
10522 |
eval concat_cmds=\"\$concat_cmds~\$RM $last_robj\" |
|
10523 |
fi
|
|
10524 |
func_append delfiles " $output" |
|
10525 |
||
10526 |
else
|
|
10527 |
output= |
|
10528 |
fi
|
|
10529 |
||
10530 |
${skipped_export-false} && { |
|
10531 |
func_verbose "generating symbol list for '$libname.la'" |
|
10532 |
export_symbols=$output_objdir/$libname.exp |
|
10533 |
$opt_dry_run || $RM $export_symbols |
|
10534 |
libobjs=$output |
|
10535 |
# Append the command to create the export file.
|
|
10536 |
test -z "$concat_cmds" || concat_cmds=$concat_cmds~ |
|
10537 |
eval concat_cmds=\"\$concat_cmds$export_symbols_cmds\" |
|
10538 |
if test -n "$last_robj"; then |
|
10539 |
eval concat_cmds=\"\$concat_cmds~\$RM $last_robj\" |
|
10540 |
fi
|
|
10541 |
}
|
|
10542 |
||
10543 |
test -n "$save_libobjs" && |
|
10544 |
func_verbose "creating a temporary reloadable object file: $output" |
|
10545 |
||
10546 |
# Loop through the commands generated above and execute them.
|
|
10547 |
save_ifs=$IFS; IFS='~' |
|
10548 |
for cmd in $concat_cmds; do |
|
10549 |
IFS=$save_ifs |
|
10550 |
$opt_quiet || { |
|
10551 |
func_quote_for_expand "$cmd" |
|
10552 |
eval "func_echo $func_quote_for_expand_result" |
|
10553 |
}
|
|
10554 |
$opt_dry_run || eval "$cmd" || { |
|
10555 |
lt_exit=$? |
|
10556 |
||
10557 |
# Restore the uninstalled library and exit
|
|
10558 |
if test relink = "$opt_mode"; then |
|
10559 |
( cd "$output_objdir" && \ |
|
10560 |
$RM "${realname}T" && \ |
|
10561 |
$MV "${realname}U" "$realname" ) |
|
10562 |
fi
|
|
10563 |
||
10564 |
exit $lt_exit |
|
10565 |
}
|
|
10566 |
done
|
|
10567 |
IFS=$save_ifs |
|
10568 |
||
10569 |
if test -n "$export_symbols_regex" && ${skipped_export-false}; then |
|
10570 |
func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
|
|
10571 |
func_show_eval '$MV "${export_symbols}T" "$export_symbols"'
|
|
10572 |
fi
|
|
10573 |
fi
|
|
10574 |
||
10575 |
${skipped_export-false} && { |
|
10576 |
if test -n "$export_symbols" && test -n "$include_expsyms"; then |
|
10577 |
tmp_export_symbols=$export_symbols |
|
10578 |
test -n "$orig_export_symbols" && tmp_export_symbols=$orig_export_symbols |
|
10579 |
$opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"' |
|
10580 |
fi
|
|
10581 |
||
10582 |
if test -n "$orig_export_symbols"; then |
|
10583 |
# The given exports_symbols file has to be filtered, so filter it.
|
|
10584 |
func_verbose "filter symbol list for '$libname.la' to tag DATA exports" |
|
10585 |
# FIXME: $output_objdir/$libname.filter potentially contains lots of
|
|
10586 |
# 's' commands, which not all seds can handle. GNU sed should be fine
|
|
10587 |
# though. Also, the filter scales superlinearly with the number of
|
|
10588 |
# global variables. join(1) would be nice here, but unfortunately
|
|
10589 |
# isn't a blessed tool.
|
|
10590 |
$opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter |
|
10591 |
func_append delfiles " $export_symbols $output_objdir/$libname.filter" |
|
10592 |
export_symbols=$output_objdir/$libname.def |
|
10593 |
$opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols |
|
10594 |
fi
|
|
10595 |
}
|
|
10596 |
||
10597 |
libobjs=$output |
|
10598 |
# Restore the value of output.
|
|
10599 |
output=$save_output |
|
10600 |
||
10601 |
if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then |
|
10602 |
eval libobjs=\"\$libobjs $whole_archive_flag_spec\" |
|
10603 |
test "X$libobjs" = "X " && libobjs= |
|
10604 |
fi
|
|
10605 |
# Expand the library linking commands again to reset the
|
|
10606 |
# value of $libobjs for piecewise linking.
|
|
10607 |
||
10608 |
# Do each of the archive commands.
|
|
10609 |
if test yes = "$module" && test -n "$module_cmds"; then |
|
10610 |
if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then |
|
10611 |
cmds=$module_expsym_cmds |
|
10612 |
else
|
|
10613 |
cmds=$module_cmds |
|
10614 |
fi
|
|
10615 |
else
|
|
10616 |
if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then |
|
10617 |
cmds=$archive_expsym_cmds |
|
10618 |
else
|
|
10619 |
cmds=$archive_cmds |
|
10620 |
fi
|
|
10621 |
fi
|
|
10622 |
fi
|
|
10623 |
||
10624 |
if test -n "$delfiles"; then |
|
10625 |
# Append the command to remove temporary files to $cmds.
|
|
10626 |
eval cmds=\"\$cmds~\$RM $delfiles\" |
|
10627 |
fi
|
|
10628 |
||
10629 |
# Add any objects from preloaded convenience libraries
|
|
10630 |
if test -n "$dlprefiles"; then |
|
10631 |
gentop=$output_objdir/${outputname}x |
|
10632 |
func_append generated " $gentop" |
|
10633 |
||
10634 |
func_extract_archives $gentop $dlprefiles |
|
10635 |
func_append libobjs " $func_extract_archives_result" |
|
10636 |
test "X$libobjs" = "X " && libobjs= |
|
10637 |
fi
|
|
10638 |
||
10639 |
save_ifs=$IFS; IFS='~' |
|
10640 |
for cmd in $cmds; do |
|
10641 |
IFS=$sp$nl |
|
10642 |
eval cmd=\"$cmd\" |
|
10643 |
IFS=$save_ifs |
|
10644 |
$opt_quiet || { |
|
10645 |
func_quote_for_expand "$cmd" |
|
10646 |
eval "func_echo $func_quote_for_expand_result" |
|
10647 |
}
|
|
10648 |
$opt_dry_run || eval "$cmd" || { |
|
10649 |
lt_exit=$? |
|
10650 |
||
10651 |
# Restore the uninstalled library and exit
|
|
10652 |
if test relink = "$opt_mode"; then |
|
10653 |
( cd "$output_objdir" && \ |
|
10654 |
$RM "${realname}T" && \ |
|
10655 |
$MV "${realname}U" "$realname" ) |
|
10656 |
fi
|
|
10657 |
||
10658 |
exit $lt_exit |
|
10659 |
}
|
|
10660 |
done
|
|
10661 |
IFS=$save_ifs |
|
10662 |
||
10663 |
# Restore the uninstalled library and exit
|
|
10664 |
if test relink = "$opt_mode"; then |
|
10665 |
$opt_dry_run || eval '(cd $output_objdir && $RM ${realname}T && $MV $realname ${realname}T && $MV ${realname}U $realname)' || exit $? |
|
10666 |
||
10667 |
if test -n "$convenience"; then |
|
10668 |
if test -z "$whole_archive_flag_spec"; then |
|
10669 |
func_show_eval '${RM}r "$gentop"'
|
|
10670 |
fi
|
|
10671 |
fi
|
|
10672 |
||
10673 |
exit $EXIT_SUCCESS |
|
10674 |
fi
|
|
10675 |
||
10676 |
# Create links to the real library.
|
|
10677 |
for linkname in $linknames; do |
|
10678 |
if test "$realname" != "$linkname"; then |
|
10679 |
func_show_eval '(cd "$output_objdir" && $RM "$linkname" && $LN_S "$realname" "$linkname")' 'exit $?' |
|
10680 |
fi
|
|
10681 |
done
|
|
10682 |
||
10683 |
# If -module or -export-dynamic was specified, set the dlname.
|
|
10684 |
if test yes = "$module" || test yes = "$export_dynamic"; then |
|
10685 |
# On all known operating systems, these are identical.
|
|
10686 |
dlname=$soname |
|
10687 |
fi
|
|
10688 |
fi
|
|
10689 |
;;
|
|
10690 |
||
10691 |
obj)
|
|
10692 |
if test -n "$dlfiles$dlprefiles" || test no != "$dlself"; then |
|
10693 |
func_warning "'-dlopen' is ignored for objects"
|
|
10694 |
fi
|
|
10695 |
||
10696 |
case " $deplibs" in |
|
10697 |
*\ -l* | *\ -L*) |
|
10698 |
func_warning "'-l' and '-L' are ignored for objects" ;; |
|
10699 |
esac
|
|
10700 |
||
10701 |
test -n "$rpath" && \ |
|
10702 |
func_warning "'-rpath' is ignored for objects"
|
|
10703 |
||
10704 |
test -n "$xrpath" && \ |
|
10705 |
func_warning "'-R' is ignored for objects"
|
|
10706 |
||
10707 |
test -n "$vinfo" && \ |
|
10708 |
func_warning "'-version-info' is ignored for objects"
|
|
10709 |
||
10710 |
test -n "$release" && \ |
|
10711 |
func_warning "'-release' is ignored for objects"
|
|
10712 |
||
10713 |
case $output in |
|
10714 |
*.lo)
|
|
10715 |
test -n "$objs$old_deplibs" && \ |
|
10716 |
func_fatal_error "cannot build library object '$output' from non-libtool objects" |
|
10717 |
||
10718 |
libobj=$output |
|
10719 |
func_lo2o "$libobj" |
|
10720 |
obj=$func_lo2o_result |
|
10721 |
;;
|
|
10722 |
*)
|
|
10723 |
libobj= |
|
10724 |
obj=$output |
|
10725 |
;;
|
|
10726 |
esac
|
|
10727 |
||
10728 |
# Delete the old objects.
|
|
10729 |
$opt_dry_run || $RM $obj $libobj |
|
10730 |
||
10731 |
# Objects from convenience libraries. This assumes
|
|
10732 |
# single-version convenience libraries. Whenever we create
|
|
10733 |
# different ones for PIC/non-PIC, this we'll have to duplicate
|
|
10734 |
# the extraction.
|
|
10735 |
reload_conv_objs= |
|
10736 |
gentop= |
|
10737 |
# if reload_cmds runs $LD directly, get rid of -Wl from
|
|
10738 |
# whole_archive_flag_spec and hope we can get by with turning comma
|
|
10739 |
# into space.
|
|
10740 |
case $reload_cmds in |
|
10741 |
*\$LD[\ \$]*) wl= ;; |
|
10742 |
esac
|
|
10743 |
if test -n "$convenience"; then |
|
10744 |
if test -n "$whole_archive_flag_spec"; then |
|
10745 |
eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\" |
|
10746 |
test -n "$wl" || tmp_whole_archive_flags=`$ECHO "$tmp_whole_archive_flags" | $SED 's|,| |g'` |
|
10747 |
reload_conv_objs=$reload_objs\ $tmp_whole_archive_flags |
|
10748 |
else
|
|
10749 |
gentop=$output_objdir/${obj}x |
|
10750 |
func_append generated " $gentop" |
|
10751 |
||
10752 |
func_extract_archives $gentop $convenience |
|
10753 |
reload_conv_objs="$reload_objs $func_extract_archives_result" |
|
10754 |
fi
|
|
10755 |
fi
|
|
10756 |
||
10757 |
# If we're not building shared, we need to use non_pic_objs
|
|
10758 |
test yes = "$build_libtool_libs" || libobjs=$non_pic_objects |
|
10759 |
||
10760 |
# Create the old-style object.
|
|
10761 |
reload_objs=$objs$old_deplibs' '`$ECHO "$libobjs" | $SP2NL | $SED "/\.$libext$/d; /\.lib$/d; $lo2o" | $NL2SP`' '$reload_conv_objs |
|
10762 |
||
10763 |
output=$obj |
|
10764 |
func_execute_cmds "$reload_cmds" 'exit $?' |
|
10765 |
||
10766 |
# Exit if we aren't doing a library object file.
|
|
10767 |
if test -z "$libobj"; then |
|
10768 |
if test -n "$gentop"; then |
|
10769 |
func_show_eval '${RM}r "$gentop"'
|
|
10770 |
fi
|
|
10771 |
||
10772 |
exit $EXIT_SUCCESS |
|
10773 |
fi
|
|
10774 |
||
10775 |
test yes = "$build_libtool_libs" || { |
|
10776 |
if test -n "$gentop"; then |
|
10777 |
func_show_eval '${RM}r "$gentop"'
|
|
10778 |
fi
|
|
10779 |
||
10780 |
# Create an invalid libtool object if no PIC, so that we don't
|
|
10781 |
# accidentally link it into a program.
|
|
10782 |
# $show "echo timestamp > $libobj"
|
|
10783 |
# $opt_dry_run || eval "echo timestamp > $libobj" || exit $?
|
|
10784 |
exit $EXIT_SUCCESS |
|
10785 |
}
|
|
10786 |
||
10787 |
if test -n "$pic_flag" || test default != "$pic_mode"; then |
|
10788 |
# Only do commands if we really have different PIC objects.
|
|
10789 |
reload_objs="$libobjs $reload_conv_objs" |
|
10790 |
output=$libobj |
|
10791 |
func_execute_cmds "$reload_cmds" 'exit $?' |
|
10792 |
fi
|
|
10793 |
||
10794 |
if test -n "$gentop"; then |
|
10795 |
func_show_eval '${RM}r "$gentop"'
|
|
10796 |
fi
|
|
10797 |
||
10798 |
exit $EXIT_SUCCESS |
|
10799 |
;;
|
|
10800 |
||
10801 |
prog)
|
|
10802 |
case $host in |
|
10803 |
*cygwin*) func_stripname '' '.exe' "$output" |
|
10804 |
output=$func_stripname_result.exe;; |
|
10805 |
esac
|
|
10806 |
test -n "$vinfo" && \ |
|
10807 |
func_warning "'-version-info' is ignored for programs"
|
|
10808 |
||
10809 |
test -n "$release" && \ |
|
10810 |
func_warning "'-release' is ignored for programs"
|
|
10811 |
||
10812 |
$preload \ |
|
10813 |
&& test unknown,unknown,unknown = "$dlopen_support,$dlopen_self,$dlopen_self_static" \ |
|
10814 |
&& func_warning "'LT_INIT([dlopen])' not used. Assuming no dlopen support." |
|
10815 |
||
10816 |
case $host in |
|
10817 |
*-*-rhapsody* | *-*-darwin1.[012]) |
|
10818 |
# On Rhapsody replace the C library is the System framework
|
|
10819 |
compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's/ -lc / System.ltframework /'` |
|
10820 |
finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's/ -lc / System.ltframework /'` |
|
10821 |
;;
|
|
10822 |
esac
|
|
10823 |
||
10824 |
case $host in |
|
10825 |
*-*-darwin*)
|
|
10826 |
# Don't allow lazy linking, it breaks C++ global constructors
|
|
10827 |
# But is supposedly fixed on 10.4 or later (yay!).
|
|
10828 |
if test CXX = "$tagname"; then |
|
10829 |
case ${MACOSX_DEPLOYMENT_TARGET-10.0} in |
|
10830 |
10.[0123]) |
|
10831 |
func_append compile_command " $wl-bind_at_load" |
|
10832 |
func_append finalize_command " $wl-bind_at_load" |
|
10833 |
;;
|
|
10834 |
esac
|
|
10835 |
fi
|
|
10836 |
# Time to change all our "foo.ltframework" stuff back to "-framework foo"
|
|
10837 |
compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` |
|
10838 |
finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` |
|
10839 |
;;
|
|
10840 |
esac
|
|
10841 |
||
10842 |
||
10843 |
# move library search paths that coincide with paths to not yet
|
|
10844 |
# installed libraries to the beginning of the library search list
|
|
10845 |
new_libs= |
|
10846 |
for path in $notinst_path; do |
|
10847 |
case " $new_libs " in |
|
10848 |
*" -L$path/$objdir "*) ;; |
|
10849 |
*)
|
|
10850 |
case " $compile_deplibs " in |
|
10851 |
*" -L$path/$objdir "*) |
|
10852 |
func_append new_libs " -L$path/$objdir" ;; |
|
10853 |
esac
|
|
10854 |
;;
|
|
10855 |
esac
|
|
10856 |
done
|
|
10857 |
for deplib in $compile_deplibs; do |
|
10858 |
case $deplib in |
|
10859 |
-L*)
|
|
10860 |
case " $new_libs " in |
|
10861 |
*" $deplib "*) ;; |
|
10862 |
*) func_append new_libs " $deplib" ;; |
|
10863 |
esac
|
|
10864 |
;;
|
|
10865 |
*) func_append new_libs " $deplib" ;; |
|
10866 |
esac
|
|
10867 |
done
|
|
10868 |
compile_deplibs=$new_libs |
|
10869 |
||
10870 |
||
10871 |
func_append compile_command " $compile_deplibs" |
|
10872 |
func_append finalize_command " $finalize_deplibs" |
|
10873 |
||
10874 |
if test -n "$rpath$xrpath"; then |
|
10875 |
# If the user specified any rpath flags, then add them.
|
|
10876 |
for libdir in $rpath $xrpath; do |
|
10877 |
# This is the magic to use -rpath.
|
|
10878 |
case "$finalize_rpath " in |
|
10879 |
*" $libdir "*) ;; |
|
10880 |
*) func_append finalize_rpath " $libdir" ;; |
|
10881 |
esac
|
|
10882 |
done
|
|
10883 |
fi
|
|
10884 |
||
10885 |
# Now hardcode the library paths
|
|
10886 |
rpath= |
|
10887 |
hardcode_libdirs= |
|
10888 |
for libdir in $compile_rpath $finalize_rpath; do |
|
10889 |
if test -n "$hardcode_libdir_flag_spec"; then |
|
10890 |
if test -n "$hardcode_libdir_separator"; then |
|
10891 |
if test -z "$hardcode_libdirs"; then |
|
10892 |
hardcode_libdirs=$libdir |
|
10893 |
else
|
|
10894 |
# Just accumulate the unique libdirs.
|
|
10895 |
case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in |
|
10896 |
*"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) |
|
10897 |
;;
|
|
10898 |
*)
|
|
10899 |
func_append hardcode_libdirs "$hardcode_libdir_separator$libdir" |
|
10900 |
;;
|
|
10901 |
esac
|
|
10902 |
fi
|
|
10903 |
else
|
|
10904 |
eval flag=\"$hardcode_libdir_flag_spec\" |
|
10905 |
func_append rpath " $flag" |
|
10906 |
fi
|
|
10907 |
elif test -n "$runpath_var"; then |
|
10908 |
case "$perm_rpath " in |
|
10909 |
*" $libdir "*) ;; |
|
10910 |
*) func_append perm_rpath " $libdir" ;; |
|
10911 |
esac
|
|
10912 |
fi
|
|
10913 |
case $host in |
|
10914 |
*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) |
|
10915 |
testbindir=`$ECHO "$libdir" | $SED -e 's*/lib$*/bin*'` |
|
10916 |
case :$dllsearchpath: in |
|
10917 |
*":$libdir:"*) ;; |
|
10918 |
::) dllsearchpath=$libdir;; |
|
10919 |
*) func_append dllsearchpath ":$libdir";; |
|
10920 |
esac
|
|
10921 |
case :$dllsearchpath: in |
|
10922 |
*":$testbindir:"*) ;; |
|
10923 |
::) dllsearchpath=$testbindir;; |
|
10924 |
*) func_append dllsearchpath ":$testbindir";; |
|
10925 |
esac
|
|
10926 |
;;
|
|
10927 |
esac
|
|
10928 |
done
|
|
10929 |
# Substitute the hardcoded libdirs into the rpath.
|
|
10930 |
if test -n "$hardcode_libdir_separator" && |
|
10931 |
test -n "$hardcode_libdirs"; then |
|
10932 |
libdir=$hardcode_libdirs |
|
10933 |
eval rpath=\" $hardcode_libdir_flag_spec\" |
|
10934 |
fi
|
|
10935 |
compile_rpath=$rpath |
|
10936 |
||
10937 |
rpath= |
|
10938 |
hardcode_libdirs= |
|
10939 |
for libdir in $finalize_rpath; do |
|
10940 |
if test -n "$hardcode_libdir_flag_spec"; then |
|
10941 |
if test -n "$hardcode_libdir_separator"; then |
|
10942 |
if test -z "$hardcode_libdirs"; then |
|
10943 |
hardcode_libdirs=$libdir |
|
10944 |
else
|
|
10945 |
# Just accumulate the unique libdirs.
|
|
10946 |
case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in |
|
10947 |
*"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) |
|
10948 |
;;
|
|
10949 |
*)
|
|
10950 |
func_append hardcode_libdirs "$hardcode_libdir_separator$libdir" |
|
10951 |
;;
|
|
10952 |
esac
|
|
10953 |
fi
|
|
10954 |
else
|
|
10955 |
eval flag=\"$hardcode_libdir_flag_spec\" |
|
10956 |
func_append rpath " $flag" |
|
10957 |
fi
|
|
10958 |
elif test -n "$runpath_var"; then |
|
10959 |
case "$finalize_perm_rpath " in |
|
10960 |
*" $libdir "*) ;; |
|
10961 |
*) func_append finalize_perm_rpath " $libdir" ;; |
|
10962 |
esac
|
|
10963 |
fi
|
|
10964 |
done
|
|
10965 |
# Substitute the hardcoded libdirs into the rpath.
|
|
10966 |
if test -n "$hardcode_libdir_separator" && |
|
10967 |
test -n "$hardcode_libdirs"; then |
|
10968 |
libdir=$hardcode_libdirs |
|
10969 |
eval rpath=\" $hardcode_libdir_flag_spec\" |
|
10970 |
fi
|
|
10971 |
finalize_rpath=$rpath |
|
10972 |
||
10973 |
if test -n "$libobjs" && test yes = "$build_old_libs"; then |
|
10974 |
# Transform all the library objects into standard objects.
|
|
10975 |
compile_command=`$ECHO "$compile_command" | $SP2NL | $SED "$lo2o" | $NL2SP` |
|
10976 |
finalize_command=`$ECHO "$finalize_command" | $SP2NL | $SED "$lo2o" | $NL2SP` |
|
10977 |
fi
|
|
10978 |
||
10979 |
func_generate_dlsyms "$outputname" "@PROGRAM@" false |
|
10980 |
||
10981 |
# template prelinking step
|
|
10982 |
if test -n "$prelink_cmds"; then |
|
10983 |
func_execute_cmds "$prelink_cmds" 'exit $?' |
|
10984 |
fi
|
|
10985 |
||
10986 |
wrappers_required=: |
|
10987 |
case $host in |
|
10988 |
*cegcc* | *mingw32ce*) |
|
10989 |
# Disable wrappers for cegcc and mingw32ce hosts, we are cross compiling anyway.
|
|
10990 |
wrappers_required=false |
|
10991 |
;;
|
|
10992 |
*cygwin* | *mingw* ) |
|
10993 |
test yes = "$build_libtool_libs" || wrappers_required=false |
|
10994 |
;;
|
|
10995 |
*)
|
|
10996 |
if test no = "$need_relink" || test yes != "$build_libtool_libs"; then |
|
10997 |
wrappers_required=false |
|
10998 |
fi
|
|
10999 |
;;
|
|
11000 |
esac
|
|
11001 |
$wrappers_required || { |
|
11002 |
# Replace the output file specification.
|
|
11003 |
compile_command=`$ECHO "$compile_command" | $SED 's%@OUTPUT@%'"$output"'%g'` |
|
11004 |
link_command=$compile_command$compile_rpath |
|
11005 |
||
11006 |
# We have no uninstalled library dependencies, so finalize right now.
|
|
11007 |
exit_status=0 |
|
11008 |
func_show_eval "$link_command" 'exit_status=$?' |
|
11009 |
||
11010 |
if test -n "$postlink_cmds"; then |
|
11011 |
func_to_tool_file "$output" |
|
11012 |
postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'` |
|
11013 |
func_execute_cmds "$postlink_cmds" 'exit $?' |
|
11014 |
fi
|
|
11015 |
||
11016 |
# Delete the generated files.
|
|
11017 |
if test -f "$output_objdir/${outputname}S.$objext"; then |
|
11018 |
func_show_eval '$RM "$output_objdir/${outputname}S.$objext"'
|
|
11019 |
fi
|
|
11020 |
||
11021 |
exit $exit_status |
|
11022 |
}
|
|
11023 |
||
11024 |
if test -n "$compile_shlibpath$finalize_shlibpath"; then |
|
11025 |
compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command" |
|
11026 |
fi
|
|
11027 |
if test -n "$finalize_shlibpath"; then |
|
11028 |
finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command" |
|
11029 |
fi
|
|
11030 |
||
11031 |
compile_var= |
|
11032 |
finalize_var= |
|
11033 |
if test -n "$runpath_var"; then |
|
11034 |
if test -n "$perm_rpath"; then |
|
11035 |
# We should set the runpath_var.
|
|
11036 |
rpath= |
|
11037 |
for dir in $perm_rpath; do |
|
11038 |
func_append rpath "$dir:" |
|
11039 |
done
|
|
11040 |
compile_var="$runpath_var=\"$rpath\$$runpath_var\" " |
|
11041 |
fi
|
|
11042 |
if test -n "$finalize_perm_rpath"; then |
|
11043 |
# We should set the runpath_var.
|
|
11044 |
rpath= |
|
11045 |
for dir in $finalize_perm_rpath; do |
|
11046 |
func_append rpath "$dir:" |
|
11047 |
done
|
|
11048 |
finalize_var="$runpath_var=\"$rpath\$$runpath_var\" " |
|
11049 |
fi
|
|
11050 |
fi
|
|
11051 |
||
11052 |
if test yes = "$no_install"; then |
|
11053 |
# We don't need to create a wrapper script.
|
|
11054 |
link_command=$compile_var$compile_command$compile_rpath |
|
11055 |
# Replace the output file specification.
|
|
11056 |
link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output"'%g'` |
|
11057 |
# Delete the old output file.
|
|
11058 |
$opt_dry_run || $RM $output |
|
11059 |
# Link the executable and exit
|
|
11060 |
func_show_eval "$link_command" 'exit $?' |
|
11061 |
||
11062 |
if test -n "$postlink_cmds"; then |
|
11063 |
func_to_tool_file "$output" |
|
11064 |
postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'` |
|
11065 |
func_execute_cmds "$postlink_cmds" 'exit $?' |
|
11066 |
fi
|
|
11067 |
||
11068 |
exit $EXIT_SUCCESS |
|
11069 |
fi
|
|
11070 |
||
11071 |
case $hardcode_action,$fast_install in |
|
11072 |
relink,*)
|
|
11073 |
# Fast installation is not supported
|
|
11074 |
link_command=$compile_var$compile_command$compile_rpath |
|
11075 |
relink_command=$finalize_var$finalize_command$finalize_rpath |
|
11076 |
||
11077 |
func_warning "this platform does not like uninstalled shared libraries"
|
|
11078 |
func_warning "'$output' will be relinked during installation" |
|
11079 |
;;
|
|
11080 |
*,yes)
|
|
11081 |
link_command=$finalize_var$compile_command$finalize_rpath |
|
11082 |
relink_command=`$ECHO "$compile_var$compile_command$compile_rpath" | $SED 's%@OUTPUT@%\$progdir/\$file%g'` |
|
11083 |
;;
|
|
11084 |
*,no)
|
|
11085 |
link_command=$compile_var$compile_command$compile_rpath |
|
11086 |
relink_command=$finalize_var$finalize_command$finalize_rpath |
|
11087 |
;;
|
|
11088 |
*,needless)
|
|
11089 |
link_command=$finalize_var$compile_command$finalize_rpath |
|
11090 |
relink_command= |
|
11091 |
;;
|
|
11092 |
esac
|
|
11093 |
||
11094 |
# Replace the output file specification.
|
|
11095 |
link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'` |
|
11096 |
||
11097 |
# Delete the old output files.
|
|
11098 |
$opt_dry_run || $RM $output $output_objdir/$outputname $output_objdir/lt-$outputname |
|
11099 |
||
11100 |
func_show_eval "$link_command" 'exit $?' |
|
11101 |
||
11102 |
if test -n "$postlink_cmds"; then |
|
11103 |
func_to_tool_file "$output_objdir/$outputname" |
|
11104 |
postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'` |
|
11105 |
func_execute_cmds "$postlink_cmds" 'exit $?' |
|
11106 |
fi
|
|
11107 |
||
11108 |
# Now create the wrapper script.
|
|
11109 |
func_verbose "creating $output" |
|
11110 |
||
11111 |
# Quote the relink command for shipping.
|
|
11112 |
if test -n "$relink_command"; then |
|
11113 |
# Preserve any variables that may affect compiler behavior
|
|
11114 |
for var in $variables_saved_for_relink; do |
|
11115 |
if eval test -z \"\${$var+set}\"; then |
|
11116 |
relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command" |
|
11117 |
elif eval var_value=\$$var; test -z "$var_value"; then |
|
11118 |
relink_command="$var=; export $var; $relink_command" |
|
11119 |
else
|
|
11120 |
func_quote_for_eval "$var_value" |
|
11121 |
relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command" |
|
11122 |
fi
|
|
11123 |
done
|
|
11124 |
relink_command="(cd `pwd`; $relink_command)" |
|
11125 |
relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"` |
|
11126 |
fi
|
|
11127 |
||
11128 |
# Only actually do things if not in dry run mode.
|
|
11129 |
$opt_dry_run || { |
|
11130 |
# win32 will think the script is a binary if it has
|
|
11131 |
# a .exe suffix, so we strip it off here.
|
|
11132 |
case $output in |
|
11133 |
*.exe) func_stripname '' '.exe' "$output" |
|
11134 |
output=$func_stripname_result ;; |
|
11135 |
esac
|
|
11136 |
# test for cygwin because mv fails w/o .exe extensions
|
|
11137 |
case $host in |
|
11138 |
*cygwin*)
|
|
11139 |
exeext=.exe |
|
11140 |
func_stripname '' '.exe' "$outputname" |
|
11141 |
outputname=$func_stripname_result ;; |
|
11142 |
*) exeext= ;; |
|
11143 |
esac
|
|
11144 |
case $host in |
|
11145 |
*cygwin* | *mingw* ) |
|
11146 |
func_dirname_and_basename "$output" "" "." |
|
11147 |
output_name=$func_basename_result |
|
11148 |
output_path=$func_dirname_result |
|
11149 |
cwrappersource=$output_path/$objdir/lt-$output_name.c |
|
11150 |
cwrapper=$output_path/$output_name.exe |
|
11151 |
$RM $cwrappersource $cwrapper |
|
11152 |
trap "$RM $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15 |
|
11153 |
||
11154 |
func_emit_cwrapperexe_src > $cwrappersource
|
|
11155 |
||
11156 |
# The wrapper executable is built using the $host compiler,
|
|
11157 |
# because it contains $host paths and files. If cross-
|
|
11158 |
# compiling, it, like the target executable, must be
|
|
11159 |
# executed on the $host or under an emulation environment.
|
|
11160 |
$opt_dry_run || { |
|
11161 |
$LTCC $LTCFLAGS -o $cwrapper $cwrappersource |
|
11162 |
$STRIP $cwrapper |
|
11163 |
}
|
|
11164 |
||
11165 |
# Now, create the wrapper script for func_source use:
|
|
11166 |
func_ltwrapper_scriptname $cwrapper
|
|
11167 |
$RM $func_ltwrapper_scriptname_result |
|
11168 |
trap "$RM $func_ltwrapper_scriptname_result; exit $EXIT_FAILURE" 1 2 15 |
|
11169 |
$opt_dry_run || { |
|
11170 |
# note: this script will not be executed, so do not chmod.
|
|
11171 |
if test "x$build" = "x$host"; then |
|
11172 |
$cwrapper --lt-dump-script > $func_ltwrapper_scriptname_result |
|
11173 |
else
|
|
11174 |
func_emit_wrapper no > $func_ltwrapper_scriptname_result
|
|
11175 |
fi
|
|
11176 |
}
|
|
11177 |
;;
|
|
11178 |
* )
|
|
11179 |
$RM $output |
|
11180 |
trap "$RM $output; exit $EXIT_FAILURE" 1 2 15 |
|
11181 |
||
11182 |
func_emit_wrapper no > $output
|
|
11183 |
chmod +x $output
|
|
11184 |
;;
|
|
11185 |
esac
|
|
11186 |
}
|
|
11187 |
exit $EXIT_SUCCESS |
|
11188 |
;;
|
|
11189 |
esac
|
|
11190 |
||
11191 |
# See if we need to build an old-fashioned archive.
|
|
11192 |
for oldlib in $oldlibs; do |
|
11193 |
||
11194 |
case $build_libtool_libs in |
|
11195 |
convenience)
|
|
11196 |
oldobjs="$libobjs_save $symfileobj" |
|
11197 |
addlibs=$convenience |
|
11198 |
build_libtool_libs=no |
|
11199 |
;;
|
|
11200 |
module)
|
|
11201 |
oldobjs=$libobjs_save |
|
11202 |
addlibs=$old_convenience |
|
11203 |
build_libtool_libs=no |
|
11204 |
;;
|
|
11205 |
*)
|
|
11206 |
oldobjs="$old_deplibs $non_pic_objects" |
|
11207 |
$preload && test -f "$symfileobj" \ |
|
11208 |
&& func_append oldobjs " $symfileobj" |
|
11209 |
addlibs=$old_convenience |
|
11210 |
;;
|
|
11211 |
esac
|
|
11212 |
||
11213 |
if test -n "$addlibs"; then |
|
11214 |
gentop=$output_objdir/${outputname}x |
|
11215 |
func_append generated " $gentop" |
|
11216 |
||
11217 |
func_extract_archives $gentop $addlibs |
|
11218 |
func_append oldobjs " $func_extract_archives_result" |
|
11219 |
fi
|
|
11220 |
||
11221 |
# Do each command in the archive commands.
|
|
11222 |
if test -n "$old_archive_from_new_cmds" && test yes = "$build_libtool_libs"; then |
|
11223 |
cmds=$old_archive_from_new_cmds |
|
11224 |
else
|
|
11225 |
||
11226 |
# Add any objects from preloaded convenience libraries
|
|
11227 |
if test -n "$dlprefiles"; then |
|
11228 |
gentop=$output_objdir/${outputname}x |
|
11229 |
func_append generated " $gentop" |
|
11230 |
||
11231 |
func_extract_archives $gentop $dlprefiles |
|
11232 |
func_append oldobjs " $func_extract_archives_result" |
|
11233 |
fi
|
|
11234 |
||
11235 |
# POSIX demands no paths to be encoded in archives. We have
|
|
11236 |
# to avoid creating archives with duplicate basenames if we
|
|
11237 |
# might have to extract them afterwards, e.g., when creating a
|
|
11238 |
# static archive out of a convenience library, or when linking
|
|
11239 |
# the entirety of a libtool archive into another (currently
|
|
11240 |
# not supported by libtool).
|
|
11241 |
if (for obj in $oldobjs |
|
11242 |
do
|
|
11243 |
func_basename "$obj" |
|
11244 |
$ECHO "$func_basename_result" |
|
11245 |
done | sort | sort -uc >/dev/null 2>&1); then |
|
11246 |
: |
|
11247 |
else
|
|
11248 |
echo "copying selected object files to avoid basename conflicts..." |
|
11249 |
gentop=$output_objdir/${outputname}x |
|
11250 |
func_append generated " $gentop" |
|
11251 |
func_mkdir_p "$gentop" |
|
11252 |
save_oldobjs=$oldobjs |
|
11253 |
oldobjs= |
|
11254 |
counter=1 |
|
11255 |
for obj in $save_oldobjs |
|
11256 |
do
|
|
11257 |
func_basename "$obj" |
|
11258 |
objbase=$func_basename_result |
|
11259 |
case " $oldobjs " in |
|
11260 |
" ") oldobjs=$obj ;; |
|
11261 |
*[\ /]"$objbase "*) |
|
11262 |
while :; do |
|
11263 |
# Make sure we don't pick an alternate name that also
|
|
11264 |
# overlaps.
|
|
11265 |
newobj=lt$counter-$objbase |
|
11266 |
func_arith $counter + 1 |
|
11267 |
counter=$func_arith_result |
|
11268 |
case " $oldobjs " in |
|
11269 |
*[\ /]"$newobj "*) ;; |
|
11270 |
*) if test ! -f "$gentop/$newobj"; then break; fi ;; |
|
11271 |
esac
|
|
11272 |
done
|
|
11273 |
func_show_eval "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj" |
|
11274 |
func_append oldobjs " $gentop/$newobj" |
|
11275 |
;;
|
|
11276 |
*) func_append oldobjs " $obj" ;; |
|
11277 |
esac
|
|
11278 |
done
|
|
11279 |
fi
|
|
11280 |
func_to_tool_file "$oldlib" func_convert_file_msys_to_w32 |
|
11281 |
tool_oldlib=$func_to_tool_file_result |
|
11282 |
eval cmds=\"$old_archive_cmds\" |
|
11283 |
||
11284 |
func_len " $cmds" |
|
11285 |
len=$func_len_result |
|
11286 |
if test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then |
|
11287 |
cmds=$old_archive_cmds |
|
11288 |
elif test -n "$archiver_list_spec"; then |
|
11289 |
func_verbose "using command file archive linking..."
|
|
11290 |
for obj in $oldobjs |
|
11291 |
do
|
|
11292 |
func_to_tool_file "$obj" |
|
11293 |
$ECHO "$func_to_tool_file_result" |
|
11294 |
done > $output_objdir/$libname.libcmd |
|
11295 |
func_to_tool_file "$output_objdir/$libname.libcmd" |
|
11296 |
oldobjs=" $archiver_list_spec$func_to_tool_file_result" |
|
11297 |
cmds=$old_archive_cmds |
|
11298 |
else
|
|
11299 |
# the command line is too long to link in one step, link in parts
|
|
11300 |
func_verbose "using piecewise archive linking..."
|
|
11301 |
save_RANLIB=$RANLIB |
|
11302 |
RANLIB=: |
|
11303 |
objlist= |
|
11304 |
concat_cmds= |
|
11305 |
save_oldobjs=$oldobjs |
|
11306 |
oldobjs= |
|
11307 |
# Is there a better way of finding the last object in the list?
|
|
11308 |
for obj in $save_oldobjs |
|
11309 |
do
|
|
11310 |
last_oldobj=$obj |
|
11311 |
done
|
|
11312 |
eval test_cmds=\"$old_archive_cmds\" |
|
11313 |
func_len " $test_cmds" |
|
11314 |
len0=$func_len_result |
|
11315 |
len=$len0 |
|
11316 |
for obj in $save_oldobjs |
|
11317 |
do
|
|
11318 |
func_len " $obj" |
|
11319 |
func_arith $len + $func_len_result |
|
11320 |
len=$func_arith_result |
|
11321 |
func_append objlist " $obj" |
|
11322 |
if test "$len" -lt "$max_cmd_len"; then |
|
11323 |
: |
|
11324 |
else
|
|
11325 |
# the above command should be used before it gets too long
|
|
11326 |
oldobjs=$objlist |
|
11327 |
if test "$obj" = "$last_oldobj"; then |
|
11328 |
RANLIB=$save_RANLIB |
|
11329 |
fi
|
|
11330 |
test -z "$concat_cmds" || concat_cmds=$concat_cmds~ |
|
11331 |
eval concat_cmds=\"\$concat_cmds$old_archive_cmds\" |
|
11332 |
objlist= |
|
11333 |
len=$len0 |
|
11334 |
fi
|
|
11335 |
done
|
|
11336 |
RANLIB=$save_RANLIB |
|
11337 |
oldobjs=$objlist |
|
11338 |
if test -z "$oldobjs"; then |
|
11339 |
eval cmds=\"\$concat_cmds\" |
|
11340 |
else
|
|
11341 |
eval cmds=\"\$concat_cmds~\$old_archive_cmds\" |
|
11342 |
fi
|
|
11343 |
fi
|
|
11344 |
fi
|
|
11345 |
func_execute_cmds "$cmds" 'exit $?' |
|
11346 |
done
|
|
11347 |
||
11348 |
test -n "$generated" && \ |
|
11349 |
func_show_eval "${RM}r$generated" |
|
11350 |
||
11351 |
# Now create the libtool archive.
|
|
11352 |
case $output in |
|
11353 |
*.la)
|
|
11354 |
old_library= |
|
11355 |
test yes = "$build_old_libs" && old_library=$libname.$libext |
|
11356 |
func_verbose "creating $output" |
|
11357 |
||
11358 |
# Preserve any variables that may affect compiler behavior
|
|
11359 |
for var in $variables_saved_for_relink; do |
|
11360 |
if eval test -z \"\${$var+set}\"; then |
|
11361 |
relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command" |
|
11362 |
elif eval var_value=\$$var; test -z "$var_value"; then |
|
11363 |
relink_command="$var=; export $var; $relink_command" |
|
11364 |
else
|
|
11365 |
func_quote_for_eval "$var_value" |
|
11366 |
relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command" |
|
11367 |
fi
|
|
11368 |
done
|
|
11369 |
# Quote the link command for shipping.
|
|
11370 |
relink_command="(cd `pwd`; $SHELL \"$progpath\" $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)" |
|
11371 |
relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"` |
|
11372 |
if test yes = "$hardcode_automatic"; then |
|
11373 |
relink_command= |
|
11374 |
fi
|
|
11375 |
||
11376 |
# Only create the output if not a dry run.
|
|
11377 |
$opt_dry_run || { |
|
11378 |
for installed in no yes; do |
|
11379 |
if test yes = "$installed"; then |
|
11380 |
if test -z "$install_libdir"; then |
|
11381 |
break
|
|
11382 |
fi
|
|
11383 |
output=$output_objdir/${outputname}i |
|
11384 |
# Replace all uninstalled libtool libraries with the installed ones
|
|
11385 |
newdependency_libs= |
|
11386 |
for deplib in $dependency_libs; do |
|
11387 |
case $deplib in |
|
11388 |
*.la)
|
|
11389 |
func_basename "$deplib" |
|
11390 |
name=$func_basename_result |
|
11391 |
func_resolve_sysroot "$deplib" |
|
11392 |
eval libdir=`$SED -n -e 's/^libdir=\(.*\)$/\1/p' $func_resolve_sysroot_result` |
|
11393 |
test -z "$libdir" && \ |
|
11394 |
func_fatal_error "'$deplib' is not a valid libtool archive" |
|
11395 |
func_append newdependency_libs " ${lt_sysroot:+=}$libdir/$name" |
|
11396 |
;;
|
|
11397 |
-L*)
|
|
11398 |
func_stripname -L '' "$deplib" |
|
11399 |
func_replace_sysroot "$func_stripname_result" |
|
11400 |
func_append newdependency_libs " -L$func_replace_sysroot_result" |
|
11401 |
;;
|
|
11402 |
-R*)
|
|
11403 |
func_stripname -R '' "$deplib" |
|
11404 |
func_replace_sysroot "$func_stripname_result" |
|
11405 |
func_append newdependency_libs " -R$func_replace_sysroot_result" |
|
11406 |
;;
|
|
11407 |
*) func_append newdependency_libs " $deplib" ;; |
|
11408 |
esac
|
|
11409 |
done
|
|
11410 |
dependency_libs=$newdependency_libs |
|
11411 |
newdlfiles= |
|
11412 |
||
11413 |
for lib in $dlfiles; do |
|
11414 |
case $lib in |
|
11415 |
*.la)
|
|
11416 |
func_basename "$lib" |
|
11417 |
name=$func_basename_result |
|
11418 |
eval libdir=`$SED -n -e 's/^libdir=\(.*\)$/\1/p' $lib` |
|
11419 |
test -z "$libdir" && \ |
|
11420 |
func_fatal_error "'$lib' is not a valid libtool archive" |
|
11421 |
func_append newdlfiles " ${lt_sysroot:+=}$libdir/$name" |
|
11422 |
;;
|
|
11423 |
*) func_append newdlfiles " $lib" ;; |
|
11424 |
esac
|
|
11425 |
done
|
|
11426 |
dlfiles=$newdlfiles |
|
11427 |
newdlprefiles= |
|
11428 |
for lib in $dlprefiles; do |
|
11429 |
case $lib in |
|
11430 |
*.la)
|
|
11431 |
# Only pass preopened files to the pseudo-archive (for
|
|
11432 |
# eventual linking with the app. that links it) if we
|
|
11433 |
# didn't already link the preopened objects directly into
|
|
11434 |
# the library:
|
|
11435 |
func_basename "$lib" |
|
11436 |
name=$func_basename_result |
|
11437 |
eval libdir=`$SED -n -e 's/^libdir=\(.*\)$/\1/p' $lib` |
|
11438 |
test -z "$libdir" && \ |
|
11439 |
func_fatal_error "'$lib' is not a valid libtool archive" |
|
11440 |
func_append newdlprefiles " ${lt_sysroot:+=}$libdir/$name" |
|
11441 |
;;
|
|
11442 |
esac
|
|
11443 |
done
|
|
11444 |
dlprefiles=$newdlprefiles |
|
11445 |
else
|
|
11446 |
newdlfiles= |
|
11447 |
for lib in $dlfiles; do |
|
11448 |
case $lib in |
|
11449 |
[\\/]* | [A-Za-z]:[\\/]*) abs=$lib ;; |
|
11450 |
*) abs=`pwd`"/$lib" ;; |
|
11451 |
esac
|
|
11452 |
func_append newdlfiles " $abs" |
|
11453 |
done
|
|
11454 |
dlfiles=$newdlfiles |
|
11455 |
newdlprefiles= |
|
11456 |
for lib in $dlprefiles; do |
|
11457 |
case $lib in |
|
11458 |
[\\/]* | [A-Za-z]:[\\/]*) abs=$lib ;; |
|
11459 |
*) abs=`pwd`"/$lib" ;; |
|
11460 |
esac
|
|
11461 |
func_append newdlprefiles " $abs" |
|
11462 |
done
|
|
11463 |
dlprefiles=$newdlprefiles |
|
11464 |
fi
|
|
11465 |
$RM $output |
|
11466 |
# place dlname in correct position for cygwin
|
|
11467 |
# In fact, it would be nice if we could use this code for all target
|
|
11468 |
# systems that can't hard-code library paths into their executables
|
|
11469 |
# and that have no shared library path variable independent of PATH,
|
|
11470 |
# but it turns out we can't easily determine that from inspecting
|
|
11471 |
# libtool variables, so we have to hard-code the OSs to which it
|
|
11472 |
# applies here; at the moment, that means platforms that use the PE
|
|
11473 |
# object format with DLL files. See the long comment at the top of
|
|
11474 |
# tests/bindir.at for full details.
|
|
11475 |
tdlname=$dlname |
|
11476 |
case $host,$output,$installed,$module,$dlname in |
|
11477 |
*cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll | *cegcc*,*lai,yes,no,*.dll) |
|
11478 |
# If a -bindir argument was supplied, place the dll there.
|
|
11479 |
if test -n "$bindir"; then |
|
11480 |
func_relative_path "$install_libdir" "$bindir" |
|
11481 |
tdlname=$func_relative_path_result/$dlname |
|
11482 |
else
|
|
11483 |
# Otherwise fall back on heuristic.
|
|
11484 |
tdlname=../bin/$dlname |
|
11485 |
fi
|
|
11486 |
;;
|
|
11487 |
esac
|
|
11488 |
$ECHO > $output "\ |
|
11489 |
# $outputname - a libtool library file |
|
11490 |
# Generated by $PROGRAM (GNU $PACKAGE) $VERSION |
|
11491 |
#
|
|
11492 |
# Please DO NOT delete this file!
|
|
11493 |
# It is necessary for linking the library.
|
|
11494 |
||
11495 |
# The name that we can dlopen(3).
|
|
11496 |
dlname='$tdlname' |
|
11497 |
||
11498 |
# Names of this library.
|
|
11499 |
library_names='$library_names' |
|
11500 |
||
11501 |
# The name of the static archive.
|
|
11502 |
old_library='$old_library' |
|
11503 |
||
11504 |
# Linker flags that cannot go in dependency_libs.
|
|
11505 |
inherited_linker_flags='$new_inherited_linker_flags' |
|
11506 |
||
11507 |
# Libraries that this one depends upon.
|
|
11508 |
dependency_libs='$dependency_libs' |
|
11509 |
||
11510 |
# Names of additional weak libraries provided by this library
|
|
11511 |
weak_library_names='$weak_libs' |
|
11512 |
||
11513 |
# Version information for $libname. |
|
11514 |
current=$current |
|
11515 |
age=$age |
|
11516 |
revision=$revision |
|
11517 |
||
11518 |
# Is this an already installed library?
|
|
11519 |
installed=$installed |
|
11520 |
||
11521 |
# Should we warn about portability when linking against -modules?
|
|
11522 |
shouldnotlink=$module |
|
11523 |
||
11524 |
# Files to dlopen/dlpreopen
|
|
11525 |
dlopen='$dlfiles' |
|
11526 |
dlpreopen='$dlprefiles' |
|
11527 |
||
11528 |
# Directory that this library needs to be installed in:
|
|
11529 |
libdir='$install_libdir'" |
|
11530 |
if test no,yes = "$installed,$need_relink"; then |
|
11531 |
$ECHO >> $output "\ |
|
11532 |
relink_command=\"$relink_command\"" |
|
11533 |
fi
|
|
11534 |
done
|
|
11535 |
}
|
|
11536 |
||
11537 |
# Do a symbolic link so that the libtool archive can be found in
|
|
11538 |
# LD_LIBRARY_PATH before the program is installed.
|
|
11539 |
func_show_eval '( cd "$output_objdir" && $RM "$outputname" && $LN_S "../$outputname" "$outputname" )' 'exit $?' |
|
11540 |
;;
|
|
11541 |
esac
|
|
11542 |
exit $EXIT_SUCCESS |
|
11543 |
}
|
|
11544 |
||
11545 |
if test link = "$opt_mode" || test relink = "$opt_mode"; then |
|
11546 |
func_mode_link ${1+"$@"} |
|
11547 |
fi
|
|
11548 |
||
11549 |
||
11550 |
# func_mode_uninstall arg...
|
|
11551 |
func_mode_uninstall ()
|
|
11552 |
{
|
|
11553 |
$debug_cmd
|
|
11554 |
||
11555 |
RM=$nonopt |
|
11556 |
files= |
|
11557 |
rmforce=false |
|
11558 |
exit_status=0 |
|
11559 |
||
11560 |
# This variable tells wrapper scripts just to set variables rather
|
|
11561 |
# than running their programs.
|
|
11562 |
libtool_install_magic=$magic |
|
11563 |
||
11564 |
for arg
|
|
11565 |
do
|
|
11566 |
case $arg in |
|
11567 |
-f) func_append RM " $arg"; rmforce=: ;; |
|
11568 |
-*) func_append RM " $arg" ;; |
|
11569 |
*) func_append files " $arg" ;; |
|
11570 |
esac
|
|
11571 |
done
|
|
11572 |
||
11573 |
test -z "$RM" && \ |
|
11574 |
func_fatal_help "you must specify an RM program"
|
|
11575 |
||
11576 |
rmdirs= |
|
11577 |
||
11578 |
for file in $files; do |
|
11579 |
func_dirname "$file" "" "." |
|
11580 |
dir=$func_dirname_result |
|
11581 |
if test . = "$dir"; then |
|
11582 |
odir=$objdir |
|
11583 |
else
|
|
11584 |
odir=$dir/$objdir |
|
11585 |
fi
|
|
11586 |
func_basename "$file" |
|
11587 |
name=$func_basename_result |
|
11588 |
test uninstall = "$opt_mode" && odir=$dir |
|
11589 |
||
11590 |
# Remember odir for removal later, being careful to avoid duplicates
|
|
11591 |
if test clean = "$opt_mode"; then |
|
11592 |
case " $rmdirs " in |
|
11593 |
*" $odir "*) ;; |
|
11594 |
*) func_append rmdirs " $odir" ;; |
|
11595 |
esac
|
|
11596 |
fi
|
|
11597 |
||
11598 |
# Don't error if the file doesn't exist and rm -f was used.
|
|
11599 |
if { test -L "$file"; } >/dev/null 2>&1 || |
|
11600 |
{ test -h "$file"; } >/dev/null 2>&1 || |
|
11601 |
test -f "$file"; then |
|
11602 |
: |
|
11603 |
elif test -d "$file"; then |
|
11604 |
exit_status=1 |
|
11605 |
continue
|
|
11606 |
elif $rmforce; then |
|
11607 |
continue
|
|
11608 |
fi
|
|
11609 |
||
11610 |
rmfiles=$file |
|
11611 |
||
11612 |
case $name in |
|
11613 |
*.la)
|
|
11614 |
# Possibly a libtool archive, so verify it.
|
|
11615 |
if func_lalib_p "$file"; then |
|
11616 |
func_source $dir/$name |
|
11617 |
||
11618 |
# Delete the libtool libraries and symlinks.
|
|
11619 |
for n in $library_names; do |
|
11620 |
func_append rmfiles " $odir/$n" |
|
11621 |
done
|
|
11622 |
test -n "$old_library" && func_append rmfiles " $odir/$old_library" |
|
11623 |
||
11624 |
case $opt_mode in |
|
11625 |
clean)
|
|
11626 |
case " $library_names " in |
|
11627 |
*" $dlname "*) ;; |
|
11628 |
*) test -n "$dlname" && func_append rmfiles " $odir/$dlname" ;; |
|
11629 |
esac
|
|
11630 |
test -n "$libdir" && func_append rmfiles " $odir/$name $odir/${name}i" |
|
11631 |
;;
|
|
11632 |
uninstall)
|
|
11633 |
if test -n "$library_names"; then |
|
11634 |
# Do each command in the postuninstall commands.
|
|
11635 |
func_execute_cmds "$postuninstall_cmds" '$rmforce || exit_status=1' |
|
11636 |
fi
|
|
11637 |
||
11638 |
if test -n "$old_library"; then |
|
11639 |
# Do each command in the old_postuninstall commands.
|
|
11640 |
func_execute_cmds "$old_postuninstall_cmds" '$rmforce || exit_status=1' |
|
11641 |
fi
|
|
11642 |
# FIXME: should reinstall the best remaining shared library.
|
|
11643 |
;;
|
|
11644 |
esac
|
|
11645 |
fi
|
|
11646 |
;;
|
|
11647 |
||
11648 |
*.lo)
|
|
11649 |
# Possibly a libtool object, so verify it.
|
|
11650 |
if func_lalib_p "$file"; then |
|
11651 |
||
11652 |
# Read the .lo file
|
|
11653 |
func_source $dir/$name |
|
11654 |
||
11655 |
# Add PIC object to the list of files to remove.
|
|
11656 |
if test -n "$pic_object" && test none != "$pic_object"; then |
|
11657 |
func_append rmfiles " $dir/$pic_object" |
|
11658 |
fi
|
|
11659 |
||
11660 |
# Add non-PIC object to the list of files to remove.
|
|
11661 |
if test -n "$non_pic_object" && test none != "$non_pic_object"; then |
|
11662 |
func_append rmfiles " $dir/$non_pic_object" |
|
11663 |
fi
|
|
11664 |
fi
|
|
11665 |
;;
|
|
11666 |
||
11667 |
*)
|
|
11668 |
if test clean = "$opt_mode"; then |
|
11669 |
noexename=$name |
|
11670 |
case $file in |
|
11671 |
*.exe)
|
|
11672 |
func_stripname '' '.exe' "$file" |
|
11673 |
file=$func_stripname_result |
|
11674 |
func_stripname '' '.exe' "$name" |
|
11675 |
noexename=$func_stripname_result |
|
11676 |
# $file with .exe has already been added to rmfiles,
|
|
11677 |
# add $file without .exe
|
|
11678 |
func_append rmfiles " $file" |
|
11679 |
;;
|
|
11680 |
esac
|
|
11681 |
# Do a test to see if this is a libtool program.
|
|
11682 |
if func_ltwrapper_p "$file"; then |
|
11683 |
if func_ltwrapper_executable_p "$file"; then |
|
11684 |
func_ltwrapper_scriptname "$file" |
|
11685 |
relink_command= |
|
11686 |
func_source $func_ltwrapper_scriptname_result
|
|
11687 |
func_append rmfiles " $func_ltwrapper_scriptname_result" |
|
11688 |
else
|
|
11689 |
relink_command= |
|
11690 |
func_source $dir/$noexename |
|
11691 |
fi
|
|
11692 |
||
11693 |
# note $name still contains .exe if it was in $file originally
|
|
11694 |
# as does the version of $file that was added into $rmfiles
|
|
11695 |
func_append rmfiles " $odir/$name $odir/${name}S.$objext" |
|
11696 |
if test yes = "$fast_install" && test -n "$relink_command"; then |
|
11697 |
func_append rmfiles " $odir/lt-$name" |
|
11698 |
fi
|
|
11699 |
if test "X$noexename" != "X$name"; then |
|
11700 |
func_append rmfiles " $odir/lt-$noexename.c" |
|
11701 |
fi
|
|
11702 |
fi
|
|
11703 |
fi
|
|
11704 |
;;
|
|
11705 |
esac
|
|
11706 |
func_show_eval "$RM $rmfiles" 'exit_status=1' |
|
11707 |
done
|
|
11708 |
||
11709 |
# Try to remove the $objdir's in the directories where we deleted files
|
|
11710 |
for dir in $rmdirs; do |
|
11711 |
if test -d "$dir"; then |
|
11712 |
func_show_eval "rmdir $dir >/dev/null 2>&1" |
|
11713 |
fi
|
|
11714 |
done
|
|
11715 |
||
11716 |
exit $exit_status |
|
11717 |
}
|
|
11718 |
||
11719 |
if test uninstall = "$opt_mode" || test clean = "$opt_mode"; then |
|
11720 |
func_mode_uninstall ${1+"$@"} |
|
11721 |
fi
|
|
11722 |
||
11723 |
test -z "$opt_mode" && { |
|
11724 |
help=$generic_help |
|
11725 |
func_fatal_help "you must specify a MODE"
|
|
11726 |
}
|
|
11727 |
||
11728 |
test -z "$exec_cmd" && \ |
|
11729 |
func_fatal_help "invalid operation mode '$opt_mode'" |
|
11730 |
||
11731 |
if test -n "$exec_cmd"; then |
|
11732 |
eval exec "$exec_cmd" |
|
11733 |
exit $EXIT_FAILURE |
|
11734 |
fi
|
|
11735 |
||
11736 |
exit $exit_status |
|
11737 |
||
11738 |
||
11739 |
# The TAGs below are defined such that we never get into a situation
|
|
11740 |
# where we disable both kinds of libraries. Given conflicting
|
|
11741 |
# choices, we go for a static library, that is the most portable,
|
|
11742 |
# since we can't tell whether shared libraries were disabled because
|
|
11743 |
# the user asked for that or because the platform doesn't support
|
|
11744 |
# them. This is particularly important on AIX, because we don't
|
|
11745 |
# support having both static and shared libraries enabled at the same
|
|
11746 |
# time on that platform, so we default to a shared-only configuration.
|
|
11747 |
# If a disable-shared tag is given, we'll fallback to a static-only
|
|
11748 |
# configuration. But we'll never go from static-only to shared-only.
|
|
11749 |
||
11750 |
# ### BEGIN LIBTOOL TAG CONFIG: disable-shared
|
|
11751 |
build_libtool_libs=no |
|
11752 |
build_old_libs=yes |
|
11753 |
# ### END LIBTOOL TAG CONFIG: disable-shared
|
|
11754 |
||
11755 |
# ### BEGIN LIBTOOL TAG CONFIG: disable-static
|
|
11756 |
build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac` |
|
11757 |
# ### END LIBTOOL TAG CONFIG: disable-static
|
|
11758 |
||
11759 |
# Local Variables:
|
|
11760 |
# mode:shell-script
|
|
11761 |
# sh-indentation:2
|
|
11762 |
# End:
|
|
11763 |
||
11764 |
# ### BEGIN LIBTOOL TAG CONFIG: CXX
|
|
11765 |
||
11766 |
# The linker used to build libraries.
|
|
11767 |
LD="/usr/bin/ld -m elf_x86_64" |
|
11768 |
||
11769 |
# How to create reloadable object files.
|
|
11770 |
reload_flag=" -r" |
|
11771 |
reload_cmds="\$LD\$reload_flag -o \$output\$reload_objs" |
|
11772 |
||
11773 |
# Commands used to build an old-style archive.
|
|
11774 |
old_archive_cmds="\$AR \$AR_FLAGS \$oldlib\$oldobjs~\$RANLIB \$tool_oldlib" |
|
11775 |
||
11776 |
# A language specific compiler.
|
|
11777 |
CC="g++" |
|
11778 |
||
11779 |
# Is the compiler the GNU compiler?
|
|
11780 |
with_gcc=yes |
|
11781 |
||
11782 |
# Compiler flag to turn off builtin functions.
|
|
11783 |
no_builtin_flag=" -fno-builtin" |
|
11784 |
||
11785 |
# Additional compiler flags for building library objects.
|
|
11786 |
pic_flag=" -fPIC -DPIC" |
|
11787 |
||
11788 |
# How to pass a linker flag through the compiler.
|
|
11789 |
wl="-Wl," |
|
11790 |
||
11791 |
# Compiler flag to prevent dynamic linking.
|
|
11792 |
link_static_flag="-static" |
|
11793 |
||
11794 |
# Does compiler simultaneously support -c and -o options?
|
|
11795 |
compiler_c_o="yes" |
|
11796 |
||
11797 |
# Whether or not to add -lc for building shared libraries.
|
|
11798 |
build_libtool_need_lc=no |
|
11799 |
||
11800 |
# Whether or not to disallow shared libs when runtime libs are static.
|
|
11801 |
allow_libtool_libs_with_static_runtimes=no |
|
11802 |
||
11803 |
# Compiler flag to allow reflexive dlopens.
|
|
11804 |
export_dynamic_flag_spec="\$wl--export-dynamic" |
|
11805 |
||
11806 |
# Compiler flag to generate shared objects directly from archives.
|
|
11807 |
whole_archive_flag_spec="\$wl--whole-archive\$convenience \$wl--no-whole-archive" |
|
11808 |
||
11809 |
# Whether the compiler copes with passing no objects directly.
|
|
11810 |
compiler_needs_object="no" |
|
11811 |
||
11812 |
# Create an old-style archive from a shared archive.
|
|
11813 |
old_archive_from_new_cmds="" |
|
11814 |
||
11815 |
# Create a temporary old-style archive to link instead of a shared archive.
|
|
11816 |
old_archive_from_expsyms_cmds="" |
|
11817 |
||
11818 |
# Commands used to build a shared archive.
|
|
11819 |
archive_cmds="\$CC \$pic_flag -shared -nostdlib \$predep_objects \$libobjs \$deplibs \$postdep_objects \$compiler_flags \$wl-soname \$wl\$soname -o \$lib" |
|
11820 |
archive_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" |
|
11821 |
||
11822 |
# Commands used to build a loadable module if different from building
|
|
11823 |
# a shared archive.
|
|
11824 |
module_cmds="" |
|
11825 |
module_expsym_cmds="" |
|
11826 |
||
11827 |
# Whether we are building with GNU ld or not.
|
|
11828 |
with_gnu_ld="yes" |
|
11829 |
||
11830 |
# Flag that allows shared libraries with undefined symbols to be built.
|
|
11831 |
allow_undefined_flag="" |
|
11832 |
||
11833 |
# Flag that enforces no undefined symbols.
|
|
11834 |
no_undefined_flag="" |
|
11835 |
||
11836 |
# Flag to hardcode $libdir into a binary during linking.
|
|
11837 |
# This must work even if $libdir does not exist
|
|
11838 |
hardcode_libdir_flag_spec="\$wl-rpath \$wl\$libdir" |
|
11839 |
||
11840 |
# Whether we need a single "-rpath" flag with a separated argument.
|
|
11841 |
hardcode_libdir_separator="" |
|
11842 |
||
11843 |
# Set to "yes" if using DIR/libNAME$shared_ext during linking hardcodes
|
|
11844 |
# DIR into the resulting binary.
|
|
11845 |
hardcode_direct=no |
|
11846 |
||
11847 |
# Set to "yes" if using DIR/libNAME$shared_ext during linking hardcodes
|
|
11848 |
# DIR into the resulting binary and the resulting library dependency is
|
|
11849 |
# "absolute",i.e impossible to change by setting $shlibpath_var if the
|
|
11850 |
# library is relocated.
|
|
11851 |
hardcode_direct_absolute=no |
|
11852 |
||
11853 |
# Set to "yes" if using the -LDIR flag during linking hardcodes DIR
|
|
11854 |
# into the resulting binary.
|
|
11855 |
hardcode_minus_L=no |
|
11856 |
||
11857 |
# Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR
|
|
11858 |
# into the resulting binary.
|
|
11859 |
hardcode_shlibpath_var=unsupported |
|
11860 |
||
11861 |
# Set to "yes" if building a shared library automatically hardcodes DIR
|
|
11862 |
# into the library and all subsequent libraries and executables linked
|
|
11863 |
# against it.
|
|
11864 |
hardcode_automatic=no |
|
11865 |
||
11866 |
# Set to yes if linker adds runtime paths of dependent libraries
|
|
11867 |
# to runtime path list.
|
|
11868 |
inherit_rpath=no |
|
11869 |
||
11870 |
# Whether libtool must link a program against all its dependency libraries.
|
|
11871 |
link_all_deplibs=no |
|
11872 |
||
11873 |
# Set to "yes" if exported symbols are required.
|
|
11874 |
always_export_symbols=no |
|
11875 |
||
11876 |
# The commands to list exported symbols.
|
|
11877 |
export_symbols_cmds="\$NM \$libobjs \$convenience | \$global_symbol_pipe | \$SED 's/.* //' | sort | uniq > \$export_symbols" |
|
11878 |
||
11879 |
# Symbols that should not be listed in the preloaded symbols.
|
|
11880 |
exclude_expsyms="_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*" |
|
11881 |
||
11882 |
# Symbols that must always be exported.
|
|
11883 |
include_expsyms="" |
|
11884 |
||
11885 |
# Commands necessary for linking programs (against libraries) with templates.
|
|
11886 |
prelink_cmds="" |
|
11887 |
||
11888 |
# Commands necessary for finishing linking programs.
|
|
11889 |
postlink_cmds="" |
|
11890 |
||
11891 |
# Specify filename containing input files.
|
|
11892 |
file_list_spec="" |
|
11893 |
||
11894 |
# How to hardcode a shared library path into an executable.
|
|
11895 |
hardcode_action=immediate |
|
11896 |
||
11897 |
# The directories searched by this compiler when creating a shared library.
|
|
11898 |
compiler_lib_search_dirs="/usr/lib/gcc/x86_64-linux-gnu/9 /usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu /usr/lib/gcc/x86_64-linux-gnu/9/../../../../lib /lib/x86_64-linux-gnu /lib/../lib /usr/lib/x86_64-linux-gnu /usr/lib/../lib /usr/lib/gcc/x86_64-linux-gnu/9/../../.." |
|
11899 |
||
11900 |
# Dependencies to place before and after the objects being linked to
|
|
11901 |
# create a shared library.
|
|
11902 |
predep_objects="/usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu/crti.o /usr/lib/gcc/x86_64-linux-gnu/9/crtbeginS.o" |
|
11903 |
postdep_objects="/usr/lib/gcc/x86_64-linux-gnu/9/crtendS.o /usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu/crtn.o" |
|
11904 |
predeps="" |
|
11905 |
postdeps="-lstdc++ -lm -lgcc_s -lc -lgcc_s" |
|
11906 |
||
11907 |
# The library search path used internally by the compiler when linking
|
|
11908 |
# a shared library.
|
|
11909 |
compiler_lib_search_path="-L/usr/lib/gcc/x86_64-linux-gnu/9 -L/usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu -L/usr/lib/gcc/x86_64-linux-gnu/9/../../../../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/9/../../.." |
|
11910 |
||
11911 |
# ### END LIBTOOL TAG CONFIG: CXX
|