blob: ddf407e1a161a1927e6fe2df94a64ee4d51694b4 [file] [log] [blame]
cristy3ed852e2009-09-05 21:47:34 +00001#! /bin/sh
2
3# libtool - Provide generalized library-building support services.
cristy701db312009-11-20 03:14:08 +00004# Generated automatically by config.status (ImageMagick) 6.5.7-10
cristy3ed852e2009-09-05 21:47:34 +00005# Libtool was configured on host magick.imagemagick.org:
6# NOTE: Changes made to this file will be lost: look at ltmain.sh.
7#
8# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005,
cristy932c9122009-11-19 13:57:03 +00009# 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
cristy3ed852e2009-09-05 21:47:34 +000010# Written by Gordon Matzigkeit, 1996
11#
12# This file is part of GNU Libtool.
13#
14# GNU Libtool is free software; you can redistribute it and/or
15# modify it under the terms of the GNU General Public License as
16# published by the Free Software Foundation; either version 2 of
17# the License, or (at your option) any later version.
18#
19# As a special exception to the GNU General Public License,
20# if you distribute this file as part of a program or library that
21# is built using GNU Libtool, you may include this file under the
22# same distribution terms that you use for the rest of that program.
23#
24# GNU Libtool is distributed in the hope that it will be useful,
25# but WITHOUT ANY WARRANTY; without even the implied warranty of
26# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
27# GNU General Public License for more details.
28#
29# You should have received a copy of the GNU General Public License
30# along with GNU Libtool; see the file COPYING. If not, a copy
31# can be downloaded from http://www.gnu.org/licenses/gpl.html, or
32# obtained by writing to the Free Software Foundation, Inc.,
33# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
34
35
36# The names of the tagged configurations supported by this script.
37available_tags="CXX "
38
39# ### BEGIN LIBTOOL CONFIG
40
41# A sed program that does not truncate output.
42SED="/bin/sed"
43
44# Sed that helps us avoid accidentally triggering echo(1) options like -n.
45Xsed="$SED -e 1s/^X//"
46
47# A grep program that handles long lines.
48GREP="/bin/grep"
49
50# An ERE matcher.
51EGREP="/bin/grep -E"
52
53# A literal string matcher.
54FGREP="/bin/grep -F"
55
cristy932c9122009-11-19 13:57:03 +000056# Shell to use when invoking shell scripts.
57SHELL="/bin/sh"
58
59# An echo program that protects backslashes.
60ECHO="printf %s\\n"
61
cristy3ed852e2009-09-05 21:47:34 +000062# Which release of libtool.m4 was used?
cristy932c9122009-11-19 13:57:03 +000063macro_version=2.2.7a
64macro_revision=1.3130
cristy3ed852e2009-09-05 21:47:34 +000065
66# Assembler program.
cristy932c9122009-11-19 13:57:03 +000067AS="as"
cristy3ed852e2009-09-05 21:47:34 +000068
69# DLL creation program.
cristy932c9122009-11-19 13:57:03 +000070DLLTOOL="dlltool"
cristy3ed852e2009-09-05 21:47:34 +000071
72# Object dumper program.
cristy932c9122009-11-19 13:57:03 +000073OBJDUMP="objdump"
cristy3ed852e2009-09-05 21:47:34 +000074
75# Whether or not to build shared libraries.
cristye6378132009-10-26 20:05:17 +000076build_libtool_libs=yes
cristy3ed852e2009-09-05 21:47:34 +000077
78# Whether or not to build static libraries.
79build_old_libs=yes
80
81# What type of objects to build.
82pic_mode=default
83
84# Whether or not to optimize for fast installation.
cristye6378132009-10-26 20:05:17 +000085fast_install=yes
cristy3ed852e2009-09-05 21:47:34 +000086
87# The host system.
88host_alias=
89host=x86_64-unknown-linux-gnu
90host_os=linux-gnu
91
92# The build system.
93build_alias=
94build=x86_64-unknown-linux-gnu
95build_os=linux-gnu
96
97# A BSD- or MS-compatible name lister.
98NM="/usr/bin/nm -B"
99
100# Whether we need soft or hard links.
101LN_S="ln -s"
102
103# What is the maximum length of a command?
104max_cmd_len=1966080
105
106# Object file suffix (normally "o").
107objext=o
108
109# Executable file suffix (normally "").
110exeext=
111
112# whether the shell understands "unset".
113lt_unset=unset
114
115# turn spaces into newlines.
116SP2NL="tr \\040 \\012"
117
118# turn newlines into spaces.
119NL2SP="tr \\015\\012 \\040\\040"
120
cristy3ed852e2009-09-05 21:47:34 +0000121# Method to check whether dependent libraries are shared objects.
122deplibs_check_method="pass_all"
123
124# Command to use when deplibs_check_method == "file_magic".
125file_magic_cmd="\$MAGIC_CMD"
126
127# The archiver.
128AR="ar"
129AR_FLAGS="cru"
130
131# A symbol stripping program.
132STRIP="strip"
133
134# Commands used to install an old-style archive.
135RANLIB="ranlib"
136old_postinstall_cmds="chmod 644 \$oldlib~\$RANLIB \$oldlib"
137old_postuninstall_cmds=""
138
cristy932c9122009-11-19 13:57:03 +0000139# Whether to use a lock for old archive extraction.
140lock_old_archive_extraction=no
141
cristy3ed852e2009-09-05 21:47:34 +0000142# A C compiler.
143LTCC="gcc -std=gnu99"
144
145# LTCC compiler flags.
146LTCFLAGS="-fopenmp -g -O2 -Wall -W -pthread"
147
148# Take the output of nm and produce a listing of raw symbols and C names.
149global_symbol_pipe="sed -n -e 's/^.*[ ]\\([ABCDGIRSTW][ABCDGIRSTW]*\\)[ ][ ]*\\([_A-Za-z][_A-Za-z0-9]*\\)\$/\\1 \\2 \\2/p'"
150
151# Transform the output of nm in a proper C declaration.
152global_symbol_to_cdecl="sed -n -e 's/^T .* \\(.*\\)\$/extern int \\1();/p' -e 's/^[ABCDGIRSTW]* .* \\(.*\\)\$/extern char \\1;/p'"
153
154# Transform the output of nm in a C name address pair.
155global_symbol_to_c_name_address="sed -n -e 's/^: \\([^ ]*\\) \$/ {\\\"\\1\\\", (void *) 0},/p' -e 's/^[ABCDGIRSTW]* \\([^ ]*\\) \\([^ ]*\\)\$/ {\"\\2\", (void *) \\&\\2},/p'"
156
157# Transform the output of nm in a C name address pair when lib prefix is needed.
158global_symbol_to_c_name_address_lib_prefix="sed -n -e 's/^: \\([^ ]*\\) \$/ {\\\"\\1\\\", (void *) 0},/p' -e 's/^[ABCDGIRSTW]* \\([^ ]*\\) \\(lib[^ ]*\\)\$/ {\"\\2\", (void *) \\&\\2},/p' -e 's/^[ABCDGIRSTW]* \\([^ ]*\\) \\([^ ]*\\)\$/ {\"lib\\2\", (void *) \\&\\2},/p'"
159
160# The name of the directory that contains temporary libtool files.
161objdir=.libs
162
cristy3ed852e2009-09-05 21:47:34 +0000163# Used to examine libraries when file_magic_cmd begins with "file".
164MAGIC_CMD=file
165
166# Must we lock files when doing compilation?
167need_locks="no"
168
169# Tool to manipulate archived DWARF debug symbol files on Mac OS X.
170DSYMUTIL=""
171
172# Tool to change global to local symbols on Mac OS X.
173NMEDIT=""
174
175# Tool to manipulate fat objects and archives on Mac OS X.
176LIPO=""
177
178# ldd/readelf like tool for Mach-O binaries on Mac OS X.
179OTOOL=""
180
181# ldd/readelf like tool for 64 bit Mach-O binaries on Mac OS X 10.4.
182OTOOL64=""
183
184# Old archive suffix (normally "a").
185libext=a
186
187# Shared library suffix (normally ".so").
188shrext_cmds=".so"
189
190# The commands to extract the exported symbol list from a shared archive.
191extract_expsyms_cmds=""
192
193# Variables whose values should be saved in libtool wrapper scripts and
194# restored at link time.
195variables_saved_for_relink="PATH LD_LIBRARY_PATH LD_RUN_PATH GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH"
196
197# Do we need the "lib" prefix for modules?
198need_lib_prefix=no
199
200# Do we need a version for libraries?
201need_version=no
202
203# Library versioning type.
204version_type=linux
205
206# Shared library runtime path variable.
207runpath_var=LD_RUN_PATH
208
209# Shared library path variable.
210shlibpath_var=LD_LIBRARY_PATH
211
212# Is shlibpath searched before the hard-coded library search path?
213shlibpath_overrides_runpath=no
214
215# Format of library name prefix.
216libname_spec="lib\$name"
217
218# List of archive names. First name is the real one, the rest are links.
219# The last name is the one that the linker finds with -lNAME
220library_names_spec="\${libname}\${release}\${shared_ext}\$versuffix \${libname}\${release}\${shared_ext}\$major \$libname\${shared_ext}"
221
222# The coded name of the library, if different from the real name.
223soname_spec="\${libname}\${release}\${shared_ext}\$major"
224
cristy932c9122009-11-19 13:57:03 +0000225# Permission mode override for installation of shared libraries.
226install_override_mode=""
227
cristy3ed852e2009-09-05 21:47:34 +0000228# Command to use after installation of a shared archive.
229postinstall_cmds=""
230
231# Command to use after uninstallation of a shared archive.
232postuninstall_cmds=""
233
234# Commands used to finish a libtool library installation in a directory.
235finish_cmds="PATH=\\\"\\\$PATH:/sbin\\\" ldconfig -n \$libdir"
236
237# As "finish_cmds", except a single script fragment to be evaled but
238# not shown.
239finish_eval=""
240
241# Whether we should hardcode library paths into libraries.
242hardcode_into_libs=yes
243
244# Compile-time system search path for libraries.
cristy932c9122009-11-19 13:57:03 +0000245sys_lib_search_path_spec="/usr/lib/gcc/x86_64-redhat-linux/4.4.2 /usr/lib64 /lib64 "
cristy3ed852e2009-09-05 21:47:34 +0000246
247# Run-time system search path for libraries.
cristy932c9122009-11-19 13:57:03 +0000248sys_lib_dlsearch_path_spec="/lib /usr/lib /usr/lib64/atlas /usr/lib64/mysql /usr/lib64/openmotif /usr/lib64/qt-3.3/lib /usr/lib64/xulrunner-1.9.1 "
cristy3ed852e2009-09-05 21:47:34 +0000249
250# Whether dlopen is supported.
251dlopen_support=yes
252
253# Whether dlopen of programs is supported.
254dlopen_self=yes
255
256# Whether dlopen of statically linked programs is supported.
257dlopen_self_static=yes
258
259# Commands to strip libraries.
260old_striplib="strip --strip-debug"
261striplib="strip --strip-unneeded"
262
263
264# The linker used to build libraries.
265LD="/usr/bin/ld -m elf_x86_64"
266
cristy932c9122009-11-19 13:57:03 +0000267# How to create reloadable object files.
268reload_flag=" -r"
269reload_cmds="\$LD\$reload_flag -o \$output\$reload_objs"
270
cristy3ed852e2009-09-05 21:47:34 +0000271# Commands used to build an old-style archive.
272old_archive_cmds="\$AR \$AR_FLAGS \$oldlib\$oldobjs~\$RANLIB \$oldlib"
273
274# A language specific compiler.
275CC="gcc -std=gnu99"
276
277# Is the compiler the GNU compiler?
278with_gcc=yes
279
280# Compiler flag to turn off builtin functions.
281no_builtin_flag=" -fno-builtin"
282
283# How to pass a linker flag through the compiler.
284wl="-Wl,"
285
286# Additional compiler flags for building library objects.
287pic_flag=" -fPIC -DPIC"
288
289# Compiler flag to prevent dynamic linking.
290link_static_flag=""
291
292# Does compiler simultaneously support -c and -o options?
293compiler_c_o="yes"
294
295# Whether or not to add -lc for building shared libraries.
cristye6378132009-10-26 20:05:17 +0000296build_libtool_need_lc=no
cristy3ed852e2009-09-05 21:47:34 +0000297
298# Whether or not to disallow shared libs when runtime libs are static.
299allow_libtool_libs_with_static_runtimes=no
300
301# Compiler flag to allow reflexive dlopens.
302export_dynamic_flag_spec="\${wl}--export-dynamic"
303
304# Compiler flag to generate shared objects directly from archives.
305whole_archive_flag_spec="\${wl}--whole-archive\$convenience \${wl}--no-whole-archive"
306
307# Whether the compiler copes with passing no objects directly.
308compiler_needs_object="no"
309
310# Create an old-style archive from a shared archive.
311old_archive_from_new_cmds=""
312
313# Create a temporary old-style archive to link instead of a shared archive.
314old_archive_from_expsyms_cmds=""
315
316# Commands used to build a shared archive.
317archive_cmds="\$CC -shared \$libobjs \$deplibs \$compiler_flags \${wl}-soname \$wl\$soname -o \$lib"
318archive_expsym_cmds="echo \\\"{ global:\\\" > \$output_objdir/\$libname.ver~
319 cat \$export_symbols | sed -e \\\"s/\\\\(.*\\\\)/\\\\1;/\\\" >> \$output_objdir/\$libname.ver~
320 echo \\\"local: *; };\\\" >> \$output_objdir/\$libname.ver~
321 \$CC -shared \$libobjs \$deplibs \$compiler_flags \${wl}-soname \$wl\$soname \${wl}-version-script \${wl}\$output_objdir/\$libname.ver -o \$lib"
322
323# Commands used to build a loadable module if different from building
324# a shared archive.
325module_cmds=""
326module_expsym_cmds=""
327
328# Whether we are building with GNU ld or not.
329with_gnu_ld="yes"
330
331# Flag that allows shared libraries with undefined symbols to be built.
332allow_undefined_flag=""
333
334# Flag that enforces no undefined symbols.
335no_undefined_flag=""
336
337# Flag to hardcode $libdir into a binary during linking.
338# This must work even if $libdir does not exist
339hardcode_libdir_flag_spec="\${wl}-rpath \${wl}\$libdir"
340
341# If ld is used when linking, flag to hardcode $libdir into a binary
342# during linking. This must work even if $libdir does not exist.
343hardcode_libdir_flag_spec_ld=""
344
345# Whether we need a single "-rpath" flag with a separated argument.
346hardcode_libdir_separator=""
347
348# Set to "yes" if using DIR/libNAME${shared_ext} during linking hardcodes
349# DIR into the resulting binary.
350hardcode_direct=no
351
352# Set to "yes" if using DIR/libNAME${shared_ext} during linking hardcodes
353# DIR into the resulting binary and the resulting library dependency is
354# "absolute",i.e impossible to change by setting ${shlibpath_var} if the
355# library is relocated.
356hardcode_direct_absolute=no
357
358# Set to "yes" if using the -LDIR flag during linking hardcodes DIR
359# into the resulting binary.
360hardcode_minus_L=no
361
362# Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR
363# into the resulting binary.
364hardcode_shlibpath_var=unsupported
365
366# Set to "yes" if building a shared library automatically hardcodes DIR
367# into the library and all subsequent libraries and executables linked
368# against it.
369hardcode_automatic=no
370
371# Set to yes if linker adds runtime paths of dependent libraries
372# to runtime path list.
373inherit_rpath=no
374
375# Whether libtool must link a program against all its dependency libraries.
376link_all_deplibs=unknown
377
378# Fix the shell variable $srcfile for the compiler.
379fix_srcfile_path=""
380
381# Set to "yes" if exported symbols are required.
382always_export_symbols=no
383
384# The commands to list exported symbols.
385export_symbols_cmds="\$NM \$libobjs \$convenience | \$global_symbol_pipe | \$SED 's/.* //' | sort | uniq > \$export_symbols"
386
387# Symbols that should not be listed in the preloaded symbols.
388exclude_expsyms="_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*"
389
390# Symbols that must always be exported.
391include_expsyms=""
392
393# Commands necessary for linking programs (against libraries) with templates.
394prelink_cmds=""
395
396# Specify filename containing input files.
397file_list_spec=""
398
399# How to hardcode a shared library path into an executable.
400hardcode_action=immediate
401
402# The directories searched by this compiler when creating a shared library.
403compiler_lib_search_dirs=""
404
405# Dependencies to place before and after the objects being linked to
406# create a shared library.
407predep_objects=""
408postdep_objects=""
409predeps=""
410postdeps=""
411
412# The library search path used internally by the compiler when linking
413# a shared library.
414compiler_lib_search_path=""
415
416# ### END LIBTOOL CONFIG
417
418# Generated from ltmain.m4sh.
419
cristy292e4352009-11-19 13:54:29 +0000420# libtool (GNU libtool 1.3130 2009-11-16) 2.2.7a
cristy3ed852e2009-09-05 21:47:34 +0000421# Written by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
422
cristy292e4352009-11-19 13:54:29 +0000423# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006,
424# 2007, 2008, 2009 Free Software Foundation, Inc.
cristy3ed852e2009-09-05 21:47:34 +0000425# This is free software; see the source for copying conditions. There is NO
426# warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
427
428# GNU Libtool is free software; you can redistribute it and/or modify
429# it under the terms of the GNU General Public License as published by
430# the Free Software Foundation; either version 2 of the License, or
431# (at your option) any later version.
432#
433# As a special exception to the GNU General Public License,
434# if you distribute this file as part of a program or library that
435# is built using GNU Libtool, you may include this file under the
436# same distribution terms that you use for the rest of that program.
437#
438# GNU Libtool is distributed in the hope that it will be useful, but
439# WITHOUT ANY WARRANTY; without even the implied warranty of
440# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
441# General Public License for more details.
442#
443# You should have received a copy of the GNU General Public License
444# along with GNU Libtool; see the file COPYING. If not, a copy
445# can be downloaded from http://www.gnu.org/licenses/gpl.html,
446# or obtained by writing to the Free Software Foundation, Inc.,
447# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
448
449# Usage: $progname [OPTION]... [MODE-ARG]...
450#
451# Provide generalized library-building support services.
452#
cristy292e4352009-11-19 13:54:29 +0000453# --config show all configuration variables
454# --debug enable verbose shell tracing
455# -n, --dry-run display commands without modifying any files
456# --features display basic configuration information and exit
457# --mode=MODE use operation mode MODE
458# --preserve-dup-deps don't remove duplicate dependency libraries
459# --quiet, --silent don't print informational messages
460# --no-quiet, --no-silent
461# print informational messages (default)
462# --tag=TAG use configuration variables from tag TAG
463# -v, --verbose print more informational messages than default
464# --no-verbose don't print the extra informational messages
465# --version print version information
466# -h, --help, --help-all print short, long, or detailed help message
cristy3ed852e2009-09-05 21:47:34 +0000467#
468# MODE must be one of the following:
469#
cristy292e4352009-11-19 13:54:29 +0000470# clean remove files from the build directory
471# compile compile a source file into a libtool object
472# execute automatically set library path, then run a program
473# finish complete the installation of libtool libraries
474# install install libraries or executables
475# link create a library or an executable
476# uninstall remove libraries from an installed directory
cristy3ed852e2009-09-05 21:47:34 +0000477#
cristy292e4352009-11-19 13:54:29 +0000478# MODE-ARGS vary depending on the MODE. When passed as first option,
479# `--mode=MODE' may be abbreviated as `MODE' or a unique abbreviation of that.
cristy3ed852e2009-09-05 21:47:34 +0000480# Try `$progname --help --mode=MODE' for a more detailed description of MODE.
481#
482# When reporting a bug, please describe a test case to reproduce it and
483# include the following information:
484#
cristy292e4352009-11-19 13:54:29 +0000485# host-triplet: $host
486# shell: $SHELL
487# compiler: $LTCC
488# compiler flags: $LTCFLAGS
489# linker: $LD (gnu? $with_gnu_ld)
490# $progname: (GNU libtool 1.3130 2009-11-16) 2.2.7a
491# automake: $automake_version
492# autoconf: $autoconf_version
cristy3ed852e2009-09-05 21:47:34 +0000493#
494# Report bugs to <bug-libtool@gnu.org>.
495
cristy292e4352009-11-19 13:54:29 +0000496PROGRAM=libtool
cristy3ed852e2009-09-05 21:47:34 +0000497PACKAGE=libtool
cristy292e4352009-11-19 13:54:29 +0000498VERSION=2.2.7a
499TIMESTAMP=" 1.3130 2009-11-16"
500package_revision=1.3130
cristy3ed852e2009-09-05 21:47:34 +0000501
502# Be Bourne compatible
503if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
504 emulate sh
505 NULLCMD=:
506 # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
507 # is contrary to our usage. Disable this feature.
508 alias -g '${1+"$@"}'='"$@"'
509 setopt NO_GLOB_SUBST
510else
511 case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac
512fi
513BIN_SH=xpg4; export BIN_SH # for Tru64
514DUALCASE=1; export DUALCASE # for MKS sh
515
cristy292e4352009-11-19 13:54:29 +0000516# A function that is used when there is no print builtin or printf.
517func_fallback_echo ()
518{
519 eval 'cat <<_LTECHO_EOF
520$1
521_LTECHO_EOF'
522}
523
cristy3ed852e2009-09-05 21:47:34 +0000524# NLS nuisances: We save the old values to restore during execute mode.
525# Only set LANG and LC_ALL to C if already set.
526# These must not be set unconditionally because not all systems understand
527# e.g. LANG=C (notably SCO).
528lt_user_locale=
529lt_safe_locale=
530for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
531do
532 eval "if test \"\${$lt_var+set}\" = set; then
533 save_$lt_var=\$$lt_var
534 $lt_var=C
535 export $lt_var
536 lt_user_locale=\"$lt_var=\\\$save_\$lt_var; \$lt_user_locale\"
537 lt_safe_locale=\"$lt_var=C; \$lt_safe_locale\"
538 fi"
539done
540
541$lt_unset CDPATH
542
543
544
545
546
cristy292e4352009-11-19 13:54:29 +0000547
548
549# Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh
550# is ksh but when the shell is invoked as "sh" and the current value of
551# the _XPG environment variable is not equal to 1 (one), the special
552# positional parameter $0, within a function call, is the name of the
553# function.
554progpath="$0"
555
556
557
cristy3ed852e2009-09-05 21:47:34 +0000558: ${CP="cp -f"}
cristy292e4352009-11-19 13:54:29 +0000559: ${ECHO=$as_echo}
560: ${EGREP="egrep"}
561: ${FGREP="fgrep"}
562: ${GREP="grep"}
cristy3ed852e2009-09-05 21:47:34 +0000563: ${LN_S="ln -s"}
564: ${MAKE="make"}
565: ${MKDIR="mkdir"}
566: ${MV="mv -f"}
567: ${RM="rm -f"}
cristy292e4352009-11-19 13:54:29 +0000568: ${SED="sed"}
cristy3ed852e2009-09-05 21:47:34 +0000569: ${SHELL="${CONFIG_SHELL-/bin/sh}"}
570: ${Xsed="$SED -e 1s/^X//"}
571
572# Global variables:
573EXIT_SUCCESS=0
574EXIT_FAILURE=1
575EXIT_MISMATCH=63 # $? = 63 is used to indicate version mismatch to missing.
576EXIT_SKIP=77 # $? = 77 is used to indicate a skipped test to automake.
577
578exit_status=$EXIT_SUCCESS
579
580# Make sure IFS has a sensible default
581lt_nl='
582'
583IFS=" $lt_nl"
584
585dirname="s,/[^/]*$,,"
586basename="s,^.*/,,"
587
588# func_dirname_and_basename file append nondir_replacement
589# perform func_basename and func_dirname in a single function
590# call:
591# dirname: Compute the dirname of FILE. If nonempty,
592# add APPEND to the result, otherwise set result
593# to NONDIR_REPLACEMENT.
594# value returned in "$func_dirname_result"
595# basename: Compute filename of FILE.
596# value retuned in "$func_basename_result"
597# Implementation must be kept synchronized with func_dirname
598# and func_basename. For efficiency, we do not delegate to
599# those functions but instead duplicate the functionality here.
600func_dirname_and_basename ()
601{
602 # Extract subdirectory from the argument.
cristy292e4352009-11-19 13:54:29 +0000603 func_dirname_result=`$ECHO "${1}" | $SED -e "$dirname"`
cristy3ed852e2009-09-05 21:47:34 +0000604 if test "X$func_dirname_result" = "X${1}"; then
605 func_dirname_result="${3}"
606 else
607 func_dirname_result="$func_dirname_result${2}"
608 fi
cristy292e4352009-11-19 13:54:29 +0000609 func_basename_result=`$ECHO "${1}" | $SED -e "$basename"`
cristy3ed852e2009-09-05 21:47:34 +0000610}
611
612# Generated shell functions inserted here.
613
614# func_dirname file append nondir_replacement
615# Compute the dirname of FILE. If nonempty, add APPEND to the result,
616# otherwise set result to NONDIR_REPLACEMENT.
617func_dirname ()
618{
619 case ${1} in
620 */*) func_dirname_result="${1%/*}${2}" ;;
621 * ) func_dirname_result="${3}" ;;
622 esac
623}
624
625# func_basename file
626func_basename ()
627{
628 func_basename_result="${1##*/}"
629}
630
631# func_dirname_and_basename file append nondir_replacement
632# perform func_basename and func_dirname in a single function
633# call:
634# dirname: Compute the dirname of FILE. If nonempty,
635# add APPEND to the result, otherwise set result
636# to NONDIR_REPLACEMENT.
637# value returned in "$func_dirname_result"
638# basename: Compute filename of FILE.
639# value retuned in "$func_basename_result"
640# Implementation must be kept synchronized with func_dirname
641# and func_basename. For efficiency, we do not delegate to
642# those functions but instead duplicate the functionality here.
643func_dirname_and_basename ()
644{
645 case ${1} in
646 */*) func_dirname_result="${1%/*}${2}" ;;
647 * ) func_dirname_result="${3}" ;;
648 esac
649 func_basename_result="${1##*/}"
650}
651
652# func_stripname prefix suffix name
653# strip PREFIX and SUFFIX off of NAME.
654# PREFIX and SUFFIX must not contain globbing or regex special
655# characters, hashes, percent signs, but SUFFIX may contain a leading
656# dot (in which case that matches only a dot).
657func_stripname ()
658{
659 # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are
660 # positional parameters, so assign one to ordinary parameter first.
661 func_stripname_result=${3}
662 func_stripname_result=${func_stripname_result#"${1}"}
663 func_stripname_result=${func_stripname_result%"${2}"}
664}
665
666# func_opt_split
667func_opt_split ()
668{
669 func_opt_split_opt=${1%%=*}
670 func_opt_split_arg=${1#*=}
671}
672
673# func_lo2o object
674func_lo2o ()
675{
676 case ${1} in
677 *.lo) func_lo2o_result=${1%.lo}.${objext} ;;
678 *) func_lo2o_result=${1} ;;
679 esac
680}
681
682# func_xform libobj-or-source
683func_xform ()
684{
685 func_xform_result=${1%.*}.lo
686}
687
688# func_arith arithmetic-term...
689func_arith ()
690{
691 func_arith_result=$(( $* ))
692}
693
694# func_len string
695# STRING may not start with a hyphen.
696func_len ()
697{
698 func_len_result=${#1}
699}
700
701
702# func_append var value
703# Append VALUE to the end of shell variable VAR.
704func_append ()
705{
706 eval "$1+=\$2"
707}
708# Generated shell functions inserted here.
709
cristy292e4352009-11-19 13:54:29 +0000710# These SED scripts presuppose an absolute path with a trailing slash.
711pathcar='s,^/\([^/]*\).*$,\1,'
712pathcdr='s,^/[^/]*,,'
713removedotparts=':dotsl
714 s@/\./@/@g
715 t dotsl
716 s,/\.$,/,'
717collapseslashes='s@/\{1,\}@/@g'
718finalslash='s,/*$,/,'
719
720# func_normal_abspath PATH
721# Remove doubled-up and trailing slashes, "." path components,
722# and cancel out any ".." path components in PATH after making
723# it an absolute path.
724# value returned in "$func_normal_abspath_result"
725func_normal_abspath ()
726{
727 # Start from root dir and reassemble the path.
728 func_normal_abspath_result=
729 func_normal_abspath_tpath=$1
730 func_normal_abspath_altnamespace=
731 case $func_normal_abspath_tpath in
732 "")
733 # Empty path, that just means $cwd.
734 func_stripname '' '/' "`pwd`"
735 func_normal_abspath_result=$func_stripname_result
736 return
737 ;;
738 # The next three entries are used to spot a run of precisely
739 # two leading slashes without using negated character classes;
740 # we take advantage of case's first-match behaviour.
741 ///*)
742 # Unusual form of absolute path, do nothing.
743 ;;
744 //*)
745 # Not necessarily an ordinary path; POSIX reserves leading '//'
746 # and for example Cygwin uses it to access remote file shares
747 # over CIFS/SMB, so we conserve a leading double slash if found.
748 func_normal_abspath_altnamespace=/
749 ;;
750 /*)
751 # Absolute path, do nothing.
752 ;;
753 *)
754 # Relative path, prepend $cwd.
755 func_normal_abspath_tpath=`pwd`/$func_normal_abspath_tpath
756 ;;
757 esac
758 # Cancel out all the simple stuff to save iterations. We also want
759 # the path to end with a slash for ease of parsing, so make sure
760 # there is one (and only one) here.
761 func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \
762 -e "$removedotparts" -e "$collapseslashes" -e "$finalslash"`
763 while :; do
764 # Processed it all yet?
765 if test "$func_normal_abspath_tpath" = / ; then
766 # If we ascended to the root using ".." the result may be empty now.
767 if test -z "$func_normal_abspath_result" ; then
768 func_normal_abspath_result=/
769 fi
770 break
771 fi
772 func_normal_abspath_tcomponent=`$ECHO "$func_normal_abspath_tpath" | $SED \
773 -e "$pathcar"`
774 func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \
775 -e "$pathcdr"`
776 # Figure out what to do with it
777 case $func_normal_abspath_tcomponent in
778 "")
779 # Trailing empty path component, ignore it.
780 ;;
781 ..)
782 # Parent dir; strip last assembled component from result.
783 func_dirname "$func_normal_abspath_result"
784 func_normal_abspath_result=$func_dirname_result
785 ;;
786 *)
787 # Actual path component, append it.
788 func_normal_abspath_result=$func_normal_abspath_result/$func_normal_abspath_tcomponent
789 ;;
790 esac
791 done
792 # Restore leading double-slash if one was found on entry.
793 func_normal_abspath_result=$func_normal_abspath_altnamespace$func_normal_abspath_result
794}
795
796# func_relative_path SRCDIR DSTDIR
797# generates a relative path from SRCDIR to DSTDIR, with a trailing
798# slash if non-empty, suitable for immediately appending a filename
799# without needing to append a separator.
800# value returned in "$func_relative_path_result"
801func_relative_path ()
802{
803 func_relative_path_result=
804 func_normal_abspath "$1"
805 func_relative_path_tlibdir=$func_normal_abspath_result
806 func_normal_abspath "$2"
807 func_relative_path_tbindir=$func_normal_abspath_result
808
809 # Ascend the tree starting from libdir
810 while :; do
811 # check if we have found a prefix of bindir
812 case $func_relative_path_tbindir in
813 $func_relative_path_tlibdir)
814 # found an exact match
815 func_relative_path_tcancelled=
816 break
817 ;;
818 $func_relative_path_tlibdir*)
819 # found a matching prefix
820 func_stripname "$func_relative_path_tlibdir" '' "$func_relative_path_tbindir"
821 func_relative_path_tcancelled=$func_stripname_result
822 if test -z "$func_relative_path_result"; then
823 func_relative_path_result=.
824 fi
825 break
826 ;;
827 *)
828 func_dirname $func_relative_path_tlibdir
829 func_relative_path_tlibdir=${func_dirname_result}
830 if test "x$func_relative_path_tlibdir" = x ; then
831 # Have to descend all the way to the root!
832 func_relative_path_result=../$func_relative_path_result
833 func_relative_path_tcancelled=$func_relative_path_tbindir
834 break
835 fi
836 func_relative_path_result=../$func_relative_path_result
837 ;;
838 esac
839 done
840
841 # Now calculate path; take care to avoid doubling-up slashes.
842 func_stripname '' '/' "$func_relative_path_result"
843 func_relative_path_result=$func_stripname_result
844 func_stripname '/' '/' "$func_relative_path_tcancelled"
845 if test "x$func_stripname_result" != x ; then
846 func_relative_path_result=${func_relative_path_result}/${func_stripname_result}
847 fi
848
849 # Normalisation. If bindir is libdir, return empty string,
850 # else relative path ending with a slash; either way, target
851 # file name can be directly appended.
852 if test ! -z "$func_relative_path_result"; then
853 func_stripname './' '' "$func_relative_path_result/"
854 func_relative_path_result=$func_stripname_result
855 fi
856}
cristy3ed852e2009-09-05 21:47:34 +0000857
858# The name of this program:
cristy3ed852e2009-09-05 21:47:34 +0000859func_dirname_and_basename "$progpath"
860progname=$func_basename_result
cristy3ed852e2009-09-05 21:47:34 +0000861
862# Make sure we have an absolute path for reexecution:
863case $progpath in
864 [\\/]*|[A-Za-z]:\\*) ;;
865 *[\\/]*)
866 progdir=$func_dirname_result
867 progdir=`cd "$progdir" && pwd`
868 progpath="$progdir/$progname"
869 ;;
870 *)
871 save_IFS="$IFS"
872 IFS=:
873 for progdir in $PATH; do
874 IFS="$save_IFS"
875 test -x "$progdir/$progname" && break
876 done
877 IFS="$save_IFS"
878 test -n "$progdir" || progdir=`pwd`
879 progpath="$progdir/$progname"
880 ;;
881esac
882
883# Sed substitution that helps us do robust quoting. It backslashifies
884# metacharacters that are still active within double-quoted strings.
885Xsed="${SED}"' -e 1s/^X//'
886sed_quote_subst='s/\([`"$\\]\)/\\\1/g'
887
888# Same as above, but do not quote variable references.
889double_quote_subst='s/\(["`\\]\)/\\\1/g'
890
891# Re-`\' parameter expansions in output of double_quote_subst that were
892# `\'-ed in input to the same. If an odd number of `\' preceded a '$'
893# in input to double_quote_subst, that '$' was protected from expansion.
894# Since each input `\' is now two `\'s, look for any number of runs of
895# four `\'s followed by two `\'s and then a '$'. `\' that '$'.
896bs='\\'
897bs2='\\\\'
898bs4='\\\\\\\\'
899dollar='\$'
900sed_double_backslash="\
901 s/$bs4/&\\
902/g
903 s/^$bs2$dollar/$bs&/
904 s/\\([^$bs]\\)$bs2$dollar/\\1$bs2$bs$dollar/g
905 s/\n//g"
906
907# Standard options:
908opt_dry_run=false
909opt_help=false
910opt_quiet=false
911opt_verbose=false
912opt_warning=:
913
914# func_echo arg...
915# Echo program name prefixed message, along with the current mode
916# name if it has been set yet.
917func_echo ()
918{
919 $ECHO "$progname${mode+: }$mode: $*"
920}
921
922# func_verbose arg...
923# Echo program name prefixed message in verbose mode only.
924func_verbose ()
925{
926 $opt_verbose && func_echo ${1+"$@"}
927
928 # A bug in bash halts the script if the last line of a function
929 # fails when set -e is in force, so we need another command to
930 # work around that:
931 :
932}
933
cristy292e4352009-11-19 13:54:29 +0000934# func_echo_all arg...
935# Invoke $ECHO with all args, space-separated.
936func_echo_all ()
937{
938 $ECHO "$*"
939}
940
cristy3ed852e2009-09-05 21:47:34 +0000941# func_error arg...
942# Echo program name prefixed message to standard error.
943func_error ()
944{
945 $ECHO "$progname${mode+: }$mode: "${1+"$@"} 1>&2
946}
947
948# func_warning arg...
949# Echo program name prefixed warning message to standard error.
950func_warning ()
951{
952 $opt_warning && $ECHO "$progname${mode+: }$mode: warning: "${1+"$@"} 1>&2
953
954 # bash bug again:
955 :
956}
957
958# func_fatal_error arg...
959# Echo program name prefixed message to standard error, and exit.
960func_fatal_error ()
961{
962 func_error ${1+"$@"}
963 exit $EXIT_FAILURE
964}
965
966# func_fatal_help arg...
967# Echo program name prefixed message to standard error, followed by
968# a help hint, and exit.
969func_fatal_help ()
970{
971 func_error ${1+"$@"}
972 func_fatal_error "$help"
973}
974help="Try \`$progname --help' for more information." ## default
975
976
977# func_grep expression filename
978# Check whether EXPRESSION matches any line of FILENAME, without output.
979func_grep ()
980{
981 $GREP "$1" "$2" >/dev/null 2>&1
982}
983
984
985# func_mkdir_p directory-path
986# Make sure the entire path to DIRECTORY-PATH is available.
987func_mkdir_p ()
988{
989 my_directory_path="$1"
990 my_dir_list=
991
992 if test -n "$my_directory_path" && test "$opt_dry_run" != ":"; then
993
994 # Protect directory names starting with `-'
995 case $my_directory_path in
996 -*) my_directory_path="./$my_directory_path" ;;
997 esac
998
999 # While some portion of DIR does not yet exist...
1000 while test ! -d "$my_directory_path"; do
1001 # ...make a list in topmost first order. Use a colon delimited
1002 # list incase some portion of path contains whitespace.
1003 my_dir_list="$my_directory_path:$my_dir_list"
1004
1005 # If the last portion added has no slash in it, the list is done
1006 case $my_directory_path in */*) ;; *) break ;; esac
1007
1008 # ...otherwise throw away the child directory and loop
cristy292e4352009-11-19 13:54:29 +00001009 my_directory_path=`$ECHO "$my_directory_path" | $SED -e "$dirname"`
cristy3ed852e2009-09-05 21:47:34 +00001010 done
cristy292e4352009-11-19 13:54:29 +00001011 my_dir_list=`$ECHO "$my_dir_list" | $SED 's,:*$,,'`
cristy3ed852e2009-09-05 21:47:34 +00001012
1013 save_mkdir_p_IFS="$IFS"; IFS=':'
1014 for my_dir in $my_dir_list; do
1015 IFS="$save_mkdir_p_IFS"
1016 # mkdir can fail with a `File exist' error if two processes
1017 # try to create one of the directories concurrently. Don't
1018 # stop in that case!
1019 $MKDIR "$my_dir" 2>/dev/null || :
1020 done
1021 IFS="$save_mkdir_p_IFS"
1022
1023 # Bail out if we (or some other process) failed to create a directory.
1024 test -d "$my_directory_path" || \
1025 func_fatal_error "Failed to create \`$1'"
1026 fi
1027}
1028
1029
1030# func_mktempdir [string]
1031# Make a temporary directory that won't clash with other running
1032# libtool processes, and avoids race conditions if possible. If
1033# given, STRING is the basename for that directory.
1034func_mktempdir ()
1035{
1036 my_template="${TMPDIR-/tmp}/${1-$progname}"
1037
1038 if test "$opt_dry_run" = ":"; then
1039 # Return a directory name, but don't create it in dry-run mode
1040 my_tmpdir="${my_template}-$$"
1041 else
1042
1043 # If mktemp works, use that first and foremost
1044 my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null`
1045
1046 if test ! -d "$my_tmpdir"; then
1047 # Failing that, at least try and use $RANDOM to avoid a race
1048 my_tmpdir="${my_template}-${RANDOM-0}$$"
1049
1050 save_mktempdir_umask=`umask`
1051 umask 0077
1052 $MKDIR "$my_tmpdir"
1053 umask $save_mktempdir_umask
1054 fi
1055
1056 # If we're not in dry-run mode, bomb out on failure
1057 test -d "$my_tmpdir" || \
1058 func_fatal_error "cannot create temporary directory \`$my_tmpdir'"
1059 fi
1060
cristy292e4352009-11-19 13:54:29 +00001061 $ECHO "$my_tmpdir"
cristy3ed852e2009-09-05 21:47:34 +00001062}
1063
1064
1065# func_quote_for_eval arg
1066# Aesthetically quote ARG to be evaled later.
1067# This function returns two values: FUNC_QUOTE_FOR_EVAL_RESULT
1068# is double-quoted, suitable for a subsequent eval, whereas
1069# FUNC_QUOTE_FOR_EVAL_UNQUOTED_RESULT has merely all characters
1070# which are still active within double quotes backslashified.
1071func_quote_for_eval ()
1072{
1073 case $1 in
1074 *[\\\`\"\$]*)
cristy292e4352009-11-19 13:54:29 +00001075 func_quote_for_eval_unquoted_result=`$ECHO "$1" | $SED "$sed_quote_subst"` ;;
cristy3ed852e2009-09-05 21:47:34 +00001076 *)
1077 func_quote_for_eval_unquoted_result="$1" ;;
1078 esac
1079
1080 case $func_quote_for_eval_unquoted_result in
1081 # Double-quote args containing shell metacharacters to delay
1082 # word splitting, command substitution and and variable
1083 # expansion for a subsequent eval.
1084 # Many Bourne shells cannot handle close brackets correctly
1085 # in scan sets, so we specify it separately.
1086 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1087 func_quote_for_eval_result="\"$func_quote_for_eval_unquoted_result\""
1088 ;;
1089 *)
1090 func_quote_for_eval_result="$func_quote_for_eval_unquoted_result"
1091 esac
1092}
1093
1094
1095# func_quote_for_expand arg
1096# Aesthetically quote ARG to be evaled later; same as above,
1097# but do not quote variable references.
1098func_quote_for_expand ()
1099{
1100 case $1 in
1101 *[\\\`\"]*)
cristy292e4352009-11-19 13:54:29 +00001102 my_arg=`$ECHO "$1" | $SED \
cristy3ed852e2009-09-05 21:47:34 +00001103 -e "$double_quote_subst" -e "$sed_double_backslash"` ;;
1104 *)
1105 my_arg="$1" ;;
1106 esac
1107
1108 case $my_arg in
1109 # Double-quote args containing shell metacharacters to delay
1110 # word splitting and command substitution for a subsequent eval.
1111 # Many Bourne shells cannot handle close brackets correctly
1112 # in scan sets, so we specify it separately.
1113 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1114 my_arg="\"$my_arg\""
1115 ;;
1116 esac
1117
1118 func_quote_for_expand_result="$my_arg"
1119}
1120
1121
1122# func_show_eval cmd [fail_exp]
1123# Unless opt_silent is true, then output CMD. Then, if opt_dryrun is
1124# not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP
1125# is given, then evaluate it.
1126func_show_eval ()
1127{
1128 my_cmd="$1"
1129 my_fail_exp="${2-:}"
1130
1131 ${opt_silent-false} || {
1132 func_quote_for_expand "$my_cmd"
1133 eval "func_echo $func_quote_for_expand_result"
1134 }
1135
1136 if ${opt_dry_run-false}; then :; else
1137 eval "$my_cmd"
1138 my_status=$?
1139 if test "$my_status" -eq 0; then :; else
1140 eval "(exit $my_status); $my_fail_exp"
1141 fi
1142 fi
1143}
1144
1145
1146# func_show_eval_locale cmd [fail_exp]
1147# Unless opt_silent is true, then output CMD. Then, if opt_dryrun is
1148# not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP
1149# is given, then evaluate it. Use the saved locale for evaluation.
1150func_show_eval_locale ()
1151{
1152 my_cmd="$1"
1153 my_fail_exp="${2-:}"
1154
1155 ${opt_silent-false} || {
1156 func_quote_for_expand "$my_cmd"
1157 eval "func_echo $func_quote_for_expand_result"
1158 }
1159
1160 if ${opt_dry_run-false}; then :; else
1161 eval "$lt_user_locale
1162 $my_cmd"
1163 my_status=$?
1164 eval "$lt_safe_locale"
1165 if test "$my_status" -eq 0; then :; else
1166 eval "(exit $my_status); $my_fail_exp"
1167 fi
1168 fi
1169}
1170
1171
1172
1173
1174
1175# func_version
1176# Echo version message to standard output and exit.
1177func_version ()
1178{
cristy292e4352009-11-19 13:54:29 +00001179 $SED -n '/(C)/!b go
1180 :more
1181 /\./!{
1182 N
1183 s/\n# //
1184 b more
1185 }
1186 :go
1187 /^# '$PROGRAM' (GNU /,/# warranty; / {
cristy3ed852e2009-09-05 21:47:34 +00001188 s/^# //
1189 s/^# *$//
1190 s/\((C)\)[ 0-9,-]*\( [1-9][0-9]*\)/\1\2/
1191 p
1192 }' < "$progpath"
1193 exit $?
1194}
1195
1196# func_usage
1197# Echo short help message to standard output and exit.
1198func_usage ()
1199{
cristy292e4352009-11-19 13:54:29 +00001200 $SED -n '/^# Usage:/,/^# *-h/ {
cristy3ed852e2009-09-05 21:47:34 +00001201 s/^# //
1202 s/^# *$//
1203 s/\$progname/'$progname'/
1204 p
1205 }' < "$progpath"
cristy292e4352009-11-19 13:54:29 +00001206 echo
cristy3ed852e2009-09-05 21:47:34 +00001207 $ECHO "run \`$progname --help | more' for full usage"
1208 exit $?
1209}
1210
cristy292e4352009-11-19 13:54:29 +00001211# func_help [NOEXIT]
1212# Echo long help message to standard output and exit,
1213# unless 'noexit' is passed as argument.
cristy3ed852e2009-09-05 21:47:34 +00001214func_help ()
1215{
1216 $SED -n '/^# Usage:/,/# Report bugs to/ {
1217 s/^# //
1218 s/^# *$//
1219 s*\$progname*'$progname'*
1220 s*\$host*'"$host"'*
1221 s*\$SHELL*'"$SHELL"'*
1222 s*\$LTCC*'"$LTCC"'*
1223 s*\$LTCFLAGS*'"$LTCFLAGS"'*
1224 s*\$LD*'"$LD"'*
1225 s/\$with_gnu_ld/'"$with_gnu_ld"'/
1226 s/\$automake_version/'"`(automake --version) 2>/dev/null |$SED 1q`"'/
1227 s/\$autoconf_version/'"`(autoconf --version) 2>/dev/null |$SED 1q`"'/
1228 p
1229 }' < "$progpath"
cristy292e4352009-11-19 13:54:29 +00001230 ret=$?
1231 if test -z "$1"; then
1232 exit $ret
1233 fi
cristy3ed852e2009-09-05 21:47:34 +00001234}
1235
1236# func_missing_arg argname
1237# Echo program name prefixed message to standard error and set global
1238# exit_cmd.
1239func_missing_arg ()
1240{
1241 func_error "missing argument for $1"
1242 exit_cmd=exit
1243}
1244
1245exit_cmd=:
1246
1247
1248
1249
1250
cristy3ed852e2009-09-05 21:47:34 +00001251
1252magic="%%%MAGIC variable%%%"
1253magic_exe="%%%MAGIC EXE variable%%%"
1254
1255# Global variables.
1256# $mode is unset
1257nonopt=
1258execute_dlfiles=
1259preserve_args=
1260lo2o="s/\\.lo\$/.${objext}/"
1261o2lo="s/\\.${objext}\$/.lo/"
1262extracted_archives=
1263extracted_serial=0
1264
1265opt_dry_run=false
1266opt_duplicate_deps=false
1267opt_silent=false
1268opt_debug=:
1269
1270# If this variable is set in any of the actions, the command in it
1271# will be execed at the end. This prevents here-documents from being
1272# left over by shells.
1273exec_cmd=
1274
1275# func_fatal_configuration arg...
1276# Echo program name prefixed message to standard error, followed by
1277# a configuration failure hint, and exit.
1278func_fatal_configuration ()
1279{
1280 func_error ${1+"$@"}
1281 func_error "See the $PACKAGE documentation for more information."
1282 func_fatal_error "Fatal configuration error."
1283}
1284
1285
1286# func_config
1287# Display the configuration for all the tags in this script.
1288func_config ()
1289{
1290 re_begincf='^# ### BEGIN LIBTOOL'
1291 re_endcf='^# ### END LIBTOOL'
1292
1293 # Default configuration.
1294 $SED "1,/$re_begincf CONFIG/d;/$re_endcf CONFIG/,\$d" < "$progpath"
1295
1296 # Now print the configurations for the tags.
1297 for tagname in $taglist; do
1298 $SED -n "/$re_begincf TAG CONFIG: $tagname\$/,/$re_endcf TAG CONFIG: $tagname\$/p" < "$progpath"
1299 done
1300
1301 exit $?
1302}
1303
1304# func_features
1305# Display the features supported by this script.
1306func_features ()
1307{
cristy292e4352009-11-19 13:54:29 +00001308 echo "host: $host"
cristy3ed852e2009-09-05 21:47:34 +00001309 if test "$build_libtool_libs" = yes; then
cristy292e4352009-11-19 13:54:29 +00001310 echo "enable shared libraries"
cristy3ed852e2009-09-05 21:47:34 +00001311 else
cristy292e4352009-11-19 13:54:29 +00001312 echo "disable shared libraries"
cristy3ed852e2009-09-05 21:47:34 +00001313 fi
1314 if test "$build_old_libs" = yes; then
cristy292e4352009-11-19 13:54:29 +00001315 echo "enable static libraries"
cristy3ed852e2009-09-05 21:47:34 +00001316 else
cristy292e4352009-11-19 13:54:29 +00001317 echo "disable static libraries"
cristy3ed852e2009-09-05 21:47:34 +00001318 fi
1319
1320 exit $?
1321}
1322
1323# func_enable_tag tagname
1324# Verify that TAGNAME is valid, and either flag an error and exit, or
1325# enable the TAGNAME tag. We also add TAGNAME to the global $taglist
1326# variable here.
1327func_enable_tag ()
1328{
1329 # Global variable:
1330 tagname="$1"
1331
1332 re_begincf="^# ### BEGIN LIBTOOL TAG CONFIG: $tagname\$"
1333 re_endcf="^# ### END LIBTOOL TAG CONFIG: $tagname\$"
1334 sed_extractcf="/$re_begincf/,/$re_endcf/p"
1335
1336 # Validate tagname.
1337 case $tagname in
1338 *[!-_A-Za-z0-9,/]*)
1339 func_fatal_error "invalid tag name: $tagname"
1340 ;;
1341 esac
1342
1343 # Don't test for the "default" C tag, as we know it's
1344 # there but not specially marked.
1345 case $tagname in
1346 CC) ;;
1347 *)
1348 if $GREP "$re_begincf" "$progpath" >/dev/null 2>&1; then
1349 taglist="$taglist $tagname"
1350
1351 # Evaluate the configuration. Be careful to quote the path
1352 # and the sed script, to avoid splitting on whitespace, but
1353 # also don't use non-portable quotes within backquotes within
1354 # quotes we have to do it in 2 steps:
1355 extractedcf=`$SED -n -e "$sed_extractcf" < "$progpath"`
1356 eval "$extractedcf"
1357 else
1358 func_error "ignoring unknown tag $tagname"
1359 fi
1360 ;;
1361 esac
1362}
1363
1364# Parse options once, thoroughly. This comes as soon as possible in
1365# the script to make things like `libtool --version' happen quickly.
1366{
1367
1368 # Shorthand for --mode=foo, only valid as the first argument
1369 case $1 in
1370 clean|clea|cle|cl)
1371 shift; set dummy --mode clean ${1+"$@"}; shift
1372 ;;
1373 compile|compil|compi|comp|com|co|c)
1374 shift; set dummy --mode compile ${1+"$@"}; shift
1375 ;;
1376 execute|execut|execu|exec|exe|ex|e)
1377 shift; set dummy --mode execute ${1+"$@"}; shift
1378 ;;
1379 finish|finis|fini|fin|fi|f)
1380 shift; set dummy --mode finish ${1+"$@"}; shift
1381 ;;
1382 install|instal|insta|inst|ins|in|i)
1383 shift; set dummy --mode install ${1+"$@"}; shift
1384 ;;
1385 link|lin|li|l)
1386 shift; set dummy --mode link ${1+"$@"}; shift
1387 ;;
1388 uninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u)
1389 shift; set dummy --mode uninstall ${1+"$@"}; shift
1390 ;;
1391 esac
1392
1393 # Parse non-mode specific arguments:
1394 while test "$#" -gt 0; do
1395 opt="$1"
1396 shift
1397
1398 case $opt in
1399 --config) func_config ;;
1400
1401 --debug) preserve_args="$preserve_args $opt"
1402 func_echo "enabling shell trace mode"
1403 opt_debug='set -x'
1404 $opt_debug
1405 ;;
1406
1407 -dlopen) test "$#" -eq 0 && func_missing_arg "$opt" && break
1408 execute_dlfiles="$execute_dlfiles $1"
1409 shift
1410 ;;
1411
1412 --dry-run | -n) opt_dry_run=: ;;
1413 --features) func_features ;;
1414 --finish) mode="finish" ;;
1415
1416 --mode) test "$#" -eq 0 && func_missing_arg "$opt" && break
1417 case $1 in
1418 # Valid mode arguments:
1419 clean) ;;
1420 compile) ;;
1421 execute) ;;
1422 finish) ;;
1423 install) ;;
1424 link) ;;
1425 relink) ;;
1426 uninstall) ;;
1427
1428 # Catch anything else as an error
1429 *) func_error "invalid argument for $opt"
1430 exit_cmd=exit
1431 break
1432 ;;
1433 esac
1434
1435 mode="$1"
1436 shift
1437 ;;
1438
1439 --preserve-dup-deps)
1440 opt_duplicate_deps=: ;;
1441
1442 --quiet|--silent) preserve_args="$preserve_args $opt"
1443 opt_silent=:
cristy292e4352009-11-19 13:54:29 +00001444 opt_verbose=false
1445 ;;
1446
1447 --no-quiet|--no-silent)
1448 preserve_args="$preserve_args $opt"
1449 opt_silent=false
cristy3ed852e2009-09-05 21:47:34 +00001450 ;;
1451
1452 --verbose| -v) preserve_args="$preserve_args $opt"
1453 opt_silent=false
cristy292e4352009-11-19 13:54:29 +00001454 opt_verbose=:
1455 ;;
1456
1457 --no-verbose) preserve_args="$preserve_args $opt"
1458 opt_verbose=false
cristy3ed852e2009-09-05 21:47:34 +00001459 ;;
1460
1461 --tag) test "$#" -eq 0 && func_missing_arg "$opt" && break
1462 preserve_args="$preserve_args $opt $1"
1463 func_enable_tag "$1" # tagname is set here
1464 shift
1465 ;;
1466
1467 # Separate optargs to long options:
1468 -dlopen=*|--mode=*|--tag=*)
1469 func_opt_split "$opt"
1470 set dummy "$func_opt_split_opt" "$func_opt_split_arg" ${1+"$@"}
1471 shift
1472 ;;
1473
1474 -\?|-h) func_usage ;;
1475 --help) opt_help=: ;;
cristy292e4352009-11-19 13:54:29 +00001476 --help-all) opt_help=': help-all' ;;
cristy3ed852e2009-09-05 21:47:34 +00001477 --version) func_version ;;
1478
1479 -*) func_fatal_help "unrecognized option \`$opt'" ;;
1480
1481 *) nonopt="$opt"
1482 break
1483 ;;
1484 esac
1485 done
1486
1487
1488 case $host in
1489 *cygwin* | *mingw* | *pw32* | *cegcc*)
1490 # don't eliminate duplications in $postdeps and $predeps
1491 opt_duplicate_compiler_generated_deps=:
1492 ;;
1493 *)
1494 opt_duplicate_compiler_generated_deps=$opt_duplicate_deps
1495 ;;
1496 esac
1497
1498 # Having warned about all mis-specified options, bail out if
1499 # anything was wrong.
1500 $exit_cmd $EXIT_FAILURE
1501}
1502
1503# func_check_version_match
1504# Ensure that we are using m4 macros, and libtool script from the same
1505# release of libtool.
1506func_check_version_match ()
1507{
1508 if test "$package_revision" != "$macro_revision"; then
1509 if test "$VERSION" != "$macro_version"; then
1510 if test -z "$macro_version"; then
1511 cat >&2 <<_LT_EOF
1512$progname: Version mismatch error. This is $PACKAGE $VERSION, but the
1513$progname: definition of this LT_INIT comes from an older release.
1514$progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION
1515$progname: and run autoconf again.
1516_LT_EOF
1517 else
1518 cat >&2 <<_LT_EOF
1519$progname: Version mismatch error. This is $PACKAGE $VERSION, but the
1520$progname: definition of this LT_INIT comes from $PACKAGE $macro_version.
1521$progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION
1522$progname: and run autoconf again.
1523_LT_EOF
1524 fi
1525 else
1526 cat >&2 <<_LT_EOF
1527$progname: Version mismatch error. This is $PACKAGE $VERSION, revision $package_revision,
1528$progname: but the definition of this LT_INIT comes from revision $macro_revision.
1529$progname: You should recreate aclocal.m4 with macros from revision $package_revision
1530$progname: of $PACKAGE $VERSION and run autoconf again.
1531_LT_EOF
1532 fi
1533
1534 exit $EXIT_MISMATCH
1535 fi
1536}
1537
1538
1539## ----------- ##
1540## Main. ##
1541## ----------- ##
1542
1543$opt_help || {
1544 # Sanity checks first:
1545 func_check_version_match
1546
1547 if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
1548 func_fatal_configuration "not configured to build any kind of library"
1549 fi
1550
1551 test -z "$mode" && func_fatal_error "error: you must specify a MODE."
1552
1553
1554 # Darwin sucks
1555 eval std_shrext=\"$shrext_cmds\"
1556
1557
1558 # Only execute mode is allowed to have -dlopen flags.
1559 if test -n "$execute_dlfiles" && test "$mode" != execute; then
1560 func_error "unrecognized option \`-dlopen'"
1561 $ECHO "$help" 1>&2
1562 exit $EXIT_FAILURE
1563 fi
1564
1565 # Change the help message to a mode-specific one.
1566 generic_help="$help"
1567 help="Try \`$progname --help --mode=$mode' for more information."
1568}
1569
1570
1571# func_lalib_p file
1572# True iff FILE is a libtool `.la' library or `.lo' object file.
1573# This function is only a basic sanity check; it will hardly flush out
1574# determined imposters.
1575func_lalib_p ()
1576{
1577 test -f "$1" &&
1578 $SED -e 4q "$1" 2>/dev/null \
1579 | $GREP "^# Generated by .*$PACKAGE" > /dev/null 2>&1
1580}
1581
1582# func_lalib_unsafe_p file
1583# True iff FILE is a libtool `.la' library or `.lo' object file.
1584# This function implements the same check as func_lalib_p without
1585# resorting to external programs. To this end, it redirects stdin and
1586# closes it afterwards, without saving the original file descriptor.
1587# As a safety measure, use it only where a negative result would be
1588# fatal anyway. Works if `file' does not exist.
1589func_lalib_unsafe_p ()
1590{
1591 lalib_p=no
1592 if test -f "$1" && test -r "$1" && exec 5<&0 <"$1"; then
1593 for lalib_p_l in 1 2 3 4
1594 do
1595 read lalib_p_line
1596 case "$lalib_p_line" in
1597 \#\ Generated\ by\ *$PACKAGE* ) lalib_p=yes; break;;
1598 esac
1599 done
1600 exec 0<&5 5<&-
1601 fi
1602 test "$lalib_p" = yes
1603}
1604
1605# func_ltwrapper_script_p file
1606# True iff FILE is a libtool wrapper script
1607# This function is only a basic sanity check; it will hardly flush out
1608# determined imposters.
1609func_ltwrapper_script_p ()
1610{
1611 func_lalib_p "$1"
1612}
1613
1614# func_ltwrapper_executable_p file
1615# True iff FILE is a libtool wrapper executable
1616# This function is only a basic sanity check; it will hardly flush out
1617# determined imposters.
1618func_ltwrapper_executable_p ()
1619{
1620 func_ltwrapper_exec_suffix=
1621 case $1 in
1622 *.exe) ;;
1623 *) func_ltwrapper_exec_suffix=.exe ;;
1624 esac
1625 $GREP "$magic_exe" "$1$func_ltwrapper_exec_suffix" >/dev/null 2>&1
1626}
1627
1628# func_ltwrapper_scriptname file
1629# Assumes file is an ltwrapper_executable
1630# uses $file to determine the appropriate filename for a
1631# temporary ltwrapper_script.
1632func_ltwrapper_scriptname ()
1633{
1634 func_ltwrapper_scriptname_result=""
1635 if func_ltwrapper_executable_p "$1"; then
1636 func_dirname_and_basename "$1" "" "."
1637 func_stripname '' '.exe' "$func_basename_result"
1638 func_ltwrapper_scriptname_result="$func_dirname_result/$objdir/${func_stripname_result}_ltshwrapper"
1639 fi
1640}
1641
1642# func_ltwrapper_p file
1643# True iff FILE is a libtool wrapper script or wrapper executable
1644# This function is only a basic sanity check; it will hardly flush out
1645# determined imposters.
1646func_ltwrapper_p ()
1647{
1648 func_ltwrapper_script_p "$1" || func_ltwrapper_executable_p "$1"
1649}
1650
1651
1652# func_execute_cmds commands fail_cmd
1653# Execute tilde-delimited COMMANDS.
1654# If FAIL_CMD is given, eval that upon failure.
1655# FAIL_CMD may read-access the current command in variable CMD!
1656func_execute_cmds ()
1657{
1658 $opt_debug
1659 save_ifs=$IFS; IFS='~'
1660 for cmd in $1; do
1661 IFS=$save_ifs
1662 eval cmd=\"$cmd\"
1663 func_show_eval "$cmd" "${2-:}"
1664 done
1665 IFS=$save_ifs
1666}
1667
1668
1669# func_source file
1670# Source FILE, adding directory component if necessary.
1671# Note that it is not necessary on cygwin/mingw to append a dot to
1672# FILE even if both FILE and FILE.exe exist: automatic-append-.exe
1673# behavior happens only for exec(3), not for open(2)! Also, sourcing
1674# `FILE.' does not work on cygwin managed mounts.
1675func_source ()
1676{
1677 $opt_debug
1678 case $1 in
1679 */* | *\\*) . "$1" ;;
1680 *) . "./$1" ;;
1681 esac
1682}
1683
1684
1685# func_infer_tag arg
1686# Infer tagged configuration to use if any are available and
1687# if one wasn't chosen via the "--tag" command line option.
1688# Only attempt this if the compiler in the base compile
1689# command doesn't match the default compiler.
1690# arg is usually of the form 'gcc ...'
1691func_infer_tag ()
1692{
1693 $opt_debug
1694 if test -n "$available_tags" && test -z "$tagname"; then
1695 CC_quoted=
1696 for arg in $CC; do
1697 func_quote_for_eval "$arg"
1698 CC_quoted="$CC_quoted $func_quote_for_eval_result"
1699 done
cristy292e4352009-11-19 13:54:29 +00001700 CC_expanded=`func_echo_all $CC`
1701 CC_quoted_expanded=`func_echo_all $CC_quoted`
cristy3ed852e2009-09-05 21:47:34 +00001702 case $@ in
1703 # Blanks in the command may have been stripped by the calling shell,
1704 # but not from the CC environment variable when configure was run.
cristy292e4352009-11-19 13:54:29 +00001705 " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \
1706 " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*) ;;
cristy3ed852e2009-09-05 21:47:34 +00001707 # Blanks at the start of $base_compile will cause this to fail
1708 # if we don't check for them as well.
1709 *)
1710 for z in $available_tags; do
1711 if $GREP "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then
1712 # Evaluate the configuration.
1713 eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`"
1714 CC_quoted=
1715 for arg in $CC; do
1716 # Double-quote args containing other shell metacharacters.
1717 func_quote_for_eval "$arg"
1718 CC_quoted="$CC_quoted $func_quote_for_eval_result"
1719 done
cristy292e4352009-11-19 13:54:29 +00001720 CC_expanded=`func_echo_all $CC`
1721 CC_quoted_expanded=`func_echo_all $CC_quoted`
cristy3ed852e2009-09-05 21:47:34 +00001722 case "$@ " in
cristy292e4352009-11-19 13:54:29 +00001723 " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \
1724 " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*)
cristy3ed852e2009-09-05 21:47:34 +00001725 # The compiler in the base compile command matches
1726 # the one in the tagged configuration.
1727 # Assume this is the tagged configuration we want.
1728 tagname=$z
1729 break
1730 ;;
1731 esac
1732 fi
1733 done
1734 # If $tagname still isn't set, then no tagged configuration
1735 # was found and let the user know that the "--tag" command
1736 # line option must be used.
1737 if test -z "$tagname"; then
1738 func_echo "unable to infer tagged configuration"
1739 func_fatal_error "specify a tag with \`--tag'"
1740# else
1741# func_verbose "using $tagname tagged configuration"
1742 fi
1743 ;;
1744 esac
1745 fi
1746}
1747
1748
1749
1750# func_write_libtool_object output_name pic_name nonpic_name
1751# Create a libtool object file (analogous to a ".la" file),
1752# but don't create it if we're doing a dry run.
1753func_write_libtool_object ()
1754{
1755 write_libobj=${1}
1756 if test "$build_libtool_libs" = yes; then
1757 write_lobj=\'${2}\'
1758 else
1759 write_lobj=none
1760 fi
1761
1762 if test "$build_old_libs" = yes; then
1763 write_oldobj=\'${3}\'
1764 else
1765 write_oldobj=none
1766 fi
1767
1768 $opt_dry_run || {
1769 cat >${write_libobj}T <<EOF
1770# $write_libobj - a libtool object file
1771# Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
1772#
1773# Please DO NOT delete this file!
1774# It is necessary for linking the library.
1775
1776# Name of the PIC object.
1777pic_object=$write_lobj
1778
1779# Name of the non-PIC object
1780non_pic_object=$write_oldobj
1781
1782EOF
1783 $MV "${write_libobj}T" "${write_libobj}"
1784 }
1785}
1786
1787# func_mode_compile arg...
1788func_mode_compile ()
1789{
1790 $opt_debug
1791 # Get the compilation command and the source file.
1792 base_compile=
1793 srcfile="$nonopt" # always keep a non-empty value in "srcfile"
1794 suppress_opt=yes
1795 suppress_output=
1796 arg_mode=normal
1797 libobj=
1798 later=
1799 pie_flag=
1800
1801 for arg
1802 do
1803 case $arg_mode in
1804 arg )
1805 # do not "continue". Instead, add this to base_compile
1806 lastarg="$arg"
1807 arg_mode=normal
1808 ;;
1809
1810 target )
1811 libobj="$arg"
1812 arg_mode=normal
1813 continue
1814 ;;
1815
1816 normal )
1817 # Accept any command-line options.
1818 case $arg in
1819 -o)
1820 test -n "$libobj" && \
1821 func_fatal_error "you cannot specify \`-o' more than once"
1822 arg_mode=target
1823 continue
1824 ;;
1825
1826 -pie | -fpie | -fPIE)
1827 pie_flag="$pie_flag $arg"
1828 continue
1829 ;;
1830
1831 -shared | -static | -prefer-pic | -prefer-non-pic)
1832 later="$later $arg"
1833 continue
1834 ;;
1835
1836 -no-suppress)
1837 suppress_opt=no
1838 continue
1839 ;;
1840
1841 -Xcompiler)
1842 arg_mode=arg # the next one goes into the "base_compile" arg list
1843 continue # The current "srcfile" will either be retained or
1844 ;; # replaced later. I would guess that would be a bug.
1845
1846 -Wc,*)
1847 func_stripname '-Wc,' '' "$arg"
1848 args=$func_stripname_result
1849 lastarg=
1850 save_ifs="$IFS"; IFS=','
1851 for arg in $args; do
1852 IFS="$save_ifs"
1853 func_quote_for_eval "$arg"
1854 lastarg="$lastarg $func_quote_for_eval_result"
1855 done
1856 IFS="$save_ifs"
1857 func_stripname ' ' '' "$lastarg"
1858 lastarg=$func_stripname_result
1859
1860 # Add the arguments to base_compile.
1861 base_compile="$base_compile $lastarg"
1862 continue
1863 ;;
1864
1865 *)
1866 # Accept the current argument as the source file.
1867 # The previous "srcfile" becomes the current argument.
1868 #
1869 lastarg="$srcfile"
1870 srcfile="$arg"
1871 ;;
1872 esac # case $arg
1873 ;;
1874 esac # case $arg_mode
1875
1876 # Aesthetically quote the previous argument.
1877 func_quote_for_eval "$lastarg"
1878 base_compile="$base_compile $func_quote_for_eval_result"
1879 done # for arg
1880
1881 case $arg_mode in
1882 arg)
1883 func_fatal_error "you must specify an argument for -Xcompile"
1884 ;;
1885 target)
1886 func_fatal_error "you must specify a target with \`-o'"
1887 ;;
1888 *)
1889 # Get the name of the library object.
1890 test -z "$libobj" && {
1891 func_basename "$srcfile"
1892 libobj="$func_basename_result"
1893 }
1894 ;;
1895 esac
1896
1897 # Recognize several different file suffixes.
1898 # If the user specifies -o file.o, it is replaced with file.lo
1899 case $libobj in
1900 *.[cCFSifmso] | \
1901 *.ada | *.adb | *.ads | *.asm | \
1902 *.c++ | *.cc | *.ii | *.class | *.cpp | *.cxx | \
cristy292e4352009-11-19 13:54:29 +00001903 *.[fF][09]? | *.for | *.java | *.obj | *.sx | *.cu | *.cup)
cristy3ed852e2009-09-05 21:47:34 +00001904 func_xform "$libobj"
1905 libobj=$func_xform_result
1906 ;;
1907 esac
1908
1909 case $libobj in
1910 *.lo) func_lo2o "$libobj"; obj=$func_lo2o_result ;;
1911 *)
1912 func_fatal_error "cannot determine name of library object from \`$libobj'"
1913 ;;
1914 esac
1915
1916 func_infer_tag $base_compile
1917
1918 for arg in $later; do
1919 case $arg in
1920 -shared)
1921 test "$build_libtool_libs" != yes && \
1922 func_fatal_configuration "can not build a shared library"
1923 build_old_libs=no
1924 continue
1925 ;;
1926
1927 -static)
1928 build_libtool_libs=no
1929 build_old_libs=yes
1930 continue
1931 ;;
1932
1933 -prefer-pic)
1934 pic_mode=yes
1935 continue
1936 ;;
1937
1938 -prefer-non-pic)
1939 pic_mode=no
1940 continue
1941 ;;
1942 esac
1943 done
1944
1945 func_quote_for_eval "$libobj"
1946 test "X$libobj" != "X$func_quote_for_eval_result" \
1947 && $ECHO "X$libobj" | $GREP '[]~#^*{};<>?"'"'"' &()|`$[]' \
1948 && func_warning "libobj name \`$libobj' may not contain shell special characters."
1949 func_dirname_and_basename "$obj" "/" ""
1950 objname="$func_basename_result"
1951 xdir="$func_dirname_result"
1952 lobj=${xdir}$objdir/$objname
1953
1954 test -z "$base_compile" && \
1955 func_fatal_help "you must specify a compilation command"
1956
1957 # Delete any leftover library objects.
1958 if test "$build_old_libs" = yes; then
1959 removelist="$obj $lobj $libobj ${libobj}T"
1960 else
1961 removelist="$lobj $libobj ${libobj}T"
1962 fi
1963
1964 # On Cygwin there's no "real" PIC flag so we must build both object types
1965 case $host_os in
1966 cygwin* | mingw* | pw32* | os2* | cegcc*)
1967 pic_mode=default
1968 ;;
1969 esac
1970 if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then
1971 # non-PIC code in shared libraries is not supported
1972 pic_mode=default
1973 fi
1974
1975 # Calculate the filename of the output object if compiler does
1976 # not support -o with -c
1977 if test "$compiler_c_o" = no; then
cristy292e4352009-11-19 13:54:29 +00001978 output_obj=`$ECHO "$srcfile" | $SED 's%^.*/%%; s%\.[^.]*$%%'`.${objext}
cristy3ed852e2009-09-05 21:47:34 +00001979 lockfile="$output_obj.lock"
1980 else
1981 output_obj=
1982 need_locks=no
1983 lockfile=
1984 fi
1985
1986 # Lock this critical section if it is needed
1987 # We use this script file to make the link, it avoids creating a new file
1988 if test "$need_locks" = yes; then
1989 until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do
1990 func_echo "Waiting for $lockfile to be removed"
1991 sleep 2
1992 done
1993 elif test "$need_locks" = warn; then
1994 if test -f "$lockfile"; then
1995 $ECHO "\
1996*** ERROR, $lockfile exists and contains:
1997`cat $lockfile 2>/dev/null`
1998
1999This indicates that another process is trying to use the same
2000temporary object file, and libtool could not work around it because
2001your compiler does not support \`-c' and \`-o' together. If you
2002repeat this compilation, it may succeed, by chance, but you had better
2003avoid parallel builds (make -j) in this platform, or get a better
2004compiler."
2005
2006 $opt_dry_run || $RM $removelist
2007 exit $EXIT_FAILURE
2008 fi
2009 removelist="$removelist $output_obj"
2010 $ECHO "$srcfile" > "$lockfile"
2011 fi
2012
2013 $opt_dry_run || $RM $removelist
2014 removelist="$removelist $lockfile"
2015 trap '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' 1 2 15
2016
2017 if test -n "$fix_srcfile_path"; then
2018 eval srcfile=\"$fix_srcfile_path\"
2019 fi
2020 func_quote_for_eval "$srcfile"
2021 qsrcfile=$func_quote_for_eval_result
2022
2023 # Only build a PIC object if we are building libtool libraries.
2024 if test "$build_libtool_libs" = yes; then
2025 # Without this assignment, base_compile gets emptied.
2026 fbsd_hideous_sh_bug=$base_compile
2027
2028 if test "$pic_mode" != no; then
2029 command="$base_compile $qsrcfile $pic_flag"
2030 else
2031 # Don't build PIC code
2032 command="$base_compile $qsrcfile"
2033 fi
2034
2035 func_mkdir_p "$xdir$objdir"
2036
2037 if test -z "$output_obj"; then
2038 # Place PIC objects in $objdir
2039 command="$command -o $lobj"
2040 fi
2041
2042 func_show_eval_locale "$command" \
2043 'test -n "$output_obj" && $RM $removelist; exit $EXIT_FAILURE'
2044
2045 if test "$need_locks" = warn &&
2046 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
2047 $ECHO "\
2048*** ERROR, $lockfile contains:
2049`cat $lockfile 2>/dev/null`
2050
2051but it should contain:
2052$srcfile
2053
2054This indicates that another process is trying to use the same
2055temporary object file, and libtool could not work around it because
2056your compiler does not support \`-c' and \`-o' together. If you
2057repeat this compilation, it may succeed, by chance, but you had better
2058avoid parallel builds (make -j) in this platform, or get a better
2059compiler."
2060
2061 $opt_dry_run || $RM $removelist
2062 exit $EXIT_FAILURE
2063 fi
2064
2065 # Just move the object if needed, then go on to compile the next one
2066 if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then
2067 func_show_eval '$MV "$output_obj" "$lobj"' \
2068 'error=$?; $opt_dry_run || $RM $removelist; exit $error'
2069 fi
2070
2071 # Allow error messages only from the first compilation.
2072 if test "$suppress_opt" = yes; then
2073 suppress_output=' >/dev/null 2>&1'
2074 fi
2075 fi
2076
2077 # Only build a position-dependent object if we build old libraries.
2078 if test "$build_old_libs" = yes; then
2079 if test "$pic_mode" != yes; then
2080 # Don't build PIC code
2081 command="$base_compile $qsrcfile$pie_flag"
2082 else
2083 command="$base_compile $qsrcfile $pic_flag"
2084 fi
2085 if test "$compiler_c_o" = yes; then
2086 command="$command -o $obj"
2087 fi
2088
2089 # Suppress compiler output if we already did a PIC compilation.
2090 command="$command$suppress_output"
2091 func_show_eval_locale "$command" \
2092 '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE'
2093
2094 if test "$need_locks" = warn &&
2095 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
2096 $ECHO "\
2097*** ERROR, $lockfile contains:
2098`cat $lockfile 2>/dev/null`
2099
2100but it should contain:
2101$srcfile
2102
2103This indicates that another process is trying to use the same
2104temporary object file, and libtool could not work around it because
2105your compiler does not support \`-c' and \`-o' together. If you
2106repeat this compilation, it may succeed, by chance, but you had better
2107avoid parallel builds (make -j) in this platform, or get a better
2108compiler."
2109
2110 $opt_dry_run || $RM $removelist
2111 exit $EXIT_FAILURE
2112 fi
2113
2114 # Just move the object if needed
2115 if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then
2116 func_show_eval '$MV "$output_obj" "$obj"' \
2117 'error=$?; $opt_dry_run || $RM $removelist; exit $error'
2118 fi
2119 fi
2120
2121 $opt_dry_run || {
2122 func_write_libtool_object "$libobj" "$objdir/$objname" "$objname"
2123
2124 # Unlock the critical section if it was locked
2125 if test "$need_locks" != no; then
2126 removelist=$lockfile
2127 $RM "$lockfile"
2128 fi
2129 }
2130
2131 exit $EXIT_SUCCESS
2132}
2133
2134$opt_help || {
cristy292e4352009-11-19 13:54:29 +00002135 test "$mode" = compile && func_mode_compile ${1+"$@"}
cristy3ed852e2009-09-05 21:47:34 +00002136}
2137
2138func_mode_help ()
2139{
2140 # We need to display help for each of the modes.
2141 case $mode in
2142 "")
2143 # Generic help is extracted from the usage comments
2144 # at the start of this file.
2145 func_help
2146 ;;
2147
2148 clean)
2149 $ECHO \
2150"Usage: $progname [OPTION]... --mode=clean RM [RM-OPTION]... FILE...
2151
2152Remove files from the build directory.
2153
2154RM is the name of the program to use to delete files associated with each FILE
2155(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
2156to RM.
2157
2158If FILE is a libtool library, object or program, all the files associated
2159with it are deleted. Otherwise, only FILE itself is deleted using RM."
2160 ;;
2161
2162 compile)
2163 $ECHO \
2164"Usage: $progname [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE
2165
2166Compile a source file into a libtool library object.
2167
2168This mode accepts the following additional options:
2169
2170 -o OUTPUT-FILE set the output file name to OUTPUT-FILE
2171 -no-suppress do not suppress compiler output for multiple passes
2172 -prefer-pic try to building PIC objects only
2173 -prefer-non-pic try to building non-PIC objects only
2174 -shared do not build a \`.o' file suitable for static linking
2175 -static only build a \`.o' file suitable for static linking
cristy292e4352009-11-19 13:54:29 +00002176 -Wc,FLAG pass FLAG directly to the compiler
cristy3ed852e2009-09-05 21:47:34 +00002177
2178COMPILE-COMMAND is a command to be used in creating a \`standard' object file
2179from the given SOURCEFILE.
2180
2181The output file name is determined by removing the directory component from
2182SOURCEFILE, then substituting the C source code suffix \`.c' with the
2183library object suffix, \`.lo'."
2184 ;;
2185
2186 execute)
2187 $ECHO \
2188"Usage: $progname [OPTION]... --mode=execute COMMAND [ARGS]...
2189
2190Automatically set library path, then run a program.
2191
2192This mode accepts the following additional options:
2193
2194 -dlopen FILE add the directory containing FILE to the library path
2195
2196This mode sets the library path environment variable according to \`-dlopen'
2197flags.
2198
2199If any of the ARGS are libtool executable wrappers, then they are translated
2200into their corresponding uninstalled binary, and any of their required library
2201directories are added to the library path.
2202
2203Then, COMMAND is executed, with ARGS as arguments."
2204 ;;
2205
2206 finish)
2207 $ECHO \
2208"Usage: $progname [OPTION]... --mode=finish [LIBDIR]...
2209
2210Complete the installation of libtool libraries.
2211
2212Each LIBDIR is a directory that contains libtool libraries.
2213
2214The commands that this mode executes may require superuser privileges. Use
2215the \`--dry-run' option if you just want to see what would be executed."
2216 ;;
2217
2218 install)
2219 $ECHO \
2220"Usage: $progname [OPTION]... --mode=install INSTALL-COMMAND...
2221
2222Install executables or libraries.
2223
2224INSTALL-COMMAND is the installation command. The first component should be
2225either the \`install' or \`cp' program.
2226
2227The following components of INSTALL-COMMAND are treated specially:
2228
cristy292e4352009-11-19 13:54:29 +00002229 -inst-prefix-dir PREFIX-DIR Use PREFIX-DIR as a staging area for installation
cristy3ed852e2009-09-05 21:47:34 +00002230
2231The rest of the components are interpreted as arguments to that command (only
2232BSD-compatible install options are recognized)."
2233 ;;
2234
2235 link)
2236 $ECHO \
2237"Usage: $progname [OPTION]... --mode=link LINK-COMMAND...
2238
2239Link object files or libraries together to form another library, or to
2240create an executable program.
2241
2242LINK-COMMAND is a command using the C compiler that you would use to create
2243a program from several object files.
2244
2245The following components of LINK-COMMAND are treated specially:
2246
2247 -all-static do not do any dynamic linking at all
2248 -avoid-version do not add a version suffix if possible
cristy292e4352009-11-19 13:54:29 +00002249 -bindir BINDIR specify path to binaries directory (for systems where
2250 libraries must be found in the PATH setting at runtime)
cristy3ed852e2009-09-05 21:47:34 +00002251 -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime
2252 -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols
2253 -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
2254 -export-symbols SYMFILE
2255 try to export only the symbols listed in SYMFILE
2256 -export-symbols-regex REGEX
2257 try to export only the symbols matching REGEX
2258 -LLIBDIR search LIBDIR for required installed libraries
2259 -lNAME OUTPUT-FILE requires the installed library libNAME
2260 -module build a library that can dlopened
2261 -no-fast-install disable the fast-install mode
2262 -no-install link a not-installable executable
2263 -no-undefined declare that a library does not refer to external symbols
2264 -o OUTPUT-FILE create OUTPUT-FILE from the specified objects
2265 -objectlist FILE Use a list of object files found in FILE to specify objects
2266 -precious-files-regex REGEX
2267 don't remove output files matching REGEX
2268 -release RELEASE specify package release information
2269 -rpath LIBDIR the created library will eventually be installed in LIBDIR
2270 -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries
2271 -shared only do dynamic linking of libtool libraries
2272 -shrext SUFFIX override the standard shared library file extension
2273 -static do not do any dynamic linking of uninstalled libtool libraries
2274 -static-libtool-libs
2275 do not do any dynamic linking of libtool libraries
2276 -version-info CURRENT[:REVISION[:AGE]]
2277 specify library version info [each variable defaults to 0]
2278 -weak LIBNAME declare that the target provides the LIBNAME interface
cristy292e4352009-11-19 13:54:29 +00002279 -Wc,FLAG
2280 -Xcompiler FLAG pass linker-specific FLAG directly to the compiler
2281 -Wl,FLAG
2282 -Xlinker FLAG pass linker-specific FLAG directly to the linker
2283 -XCClinker FLAG pass link-specific FLAG to the compiler driver (CC)
cristy3ed852e2009-09-05 21:47:34 +00002284
2285All other options (arguments beginning with \`-') are ignored.
2286
2287Every other argument is treated as a filename. Files ending in \`.la' are
2288treated as uninstalled libtool libraries, other files are standard or library
2289object files.
2290
2291If the OUTPUT-FILE ends in \`.la', then a libtool library is created,
2292only library objects (\`.lo' files) may be specified, and \`-rpath' is
2293required, except when creating a convenience library.
2294
2295If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created
2296using \`ar' and \`ranlib', or on Windows using \`lib'.
2297
2298If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file
2299is created, otherwise an executable program is created."
2300 ;;
2301
2302 uninstall)
2303 $ECHO \
2304"Usage: $progname [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE...
2305
2306Remove libraries from an installation directory.
2307
2308RM is the name of the program to use to delete files associated with each FILE
2309(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
2310to RM.
2311
2312If FILE is a libtool library, all the files associated with it are deleted.
2313Otherwise, only FILE itself is deleted using RM."
2314 ;;
2315
2316 *)
2317 func_fatal_help "invalid operation mode \`$mode'"
2318 ;;
2319 esac
2320
cristy292e4352009-11-19 13:54:29 +00002321 echo
cristy3ed852e2009-09-05 21:47:34 +00002322 $ECHO "Try \`$progname --help' for more information about other modes."
cristy3ed852e2009-09-05 21:47:34 +00002323}
2324
cristy292e4352009-11-19 13:54:29 +00002325# Now that we've collected a possible --mode arg, show help if necessary
2326if $opt_help; then
2327 if test "$opt_help" = :; then
2328 func_mode_help
2329 else
2330 {
2331 func_help noexit
2332 for mode in compile link execute install finish uninstall clean; do
2333 func_mode_help
2334 done
2335 } | sed -n '1p; 2,$s/^Usage:/ or: /p'
2336 {
2337 func_help noexit
2338 for mode in compile link execute install finish uninstall clean; do
2339 echo
2340 func_mode_help
2341 done
2342 } |
2343 sed '1d
2344 /^When reporting/,/^Report/{
2345 H
2346 d
2347 }
2348 $x
2349 /information about other modes/d
2350 /more detailed .*MODE/d
2351 s/^Usage:.*--mode=\([^ ]*\) .*/Description of \1 mode:/'
2352 fi
2353 exit $?
2354fi
cristy3ed852e2009-09-05 21:47:34 +00002355
2356
2357# func_mode_execute arg...
2358func_mode_execute ()
2359{
2360 $opt_debug
2361 # The first argument is the command name.
2362 cmd="$nonopt"
2363 test -z "$cmd" && \
2364 func_fatal_help "you must specify a COMMAND"
2365
2366 # Handle -dlopen flags immediately.
2367 for file in $execute_dlfiles; do
2368 test -f "$file" \
2369 || func_fatal_help "\`$file' is not a file"
2370
2371 dir=
2372 case $file in
2373 *.la)
2374 # Check to see that this really is a libtool archive.
2375 func_lalib_unsafe_p "$file" \
2376 || func_fatal_help "\`$lib' is not a valid libtool archive"
2377
2378 # Read the libtool library.
2379 dlname=
2380 library_names=
2381 func_source "$file"
2382
2383 # Skip this library if it cannot be dlopened.
2384 if test -z "$dlname"; then
2385 # Warn if it was a shared library.
2386 test -n "$library_names" && \
2387 func_warning "\`$file' was not linked with \`-export-dynamic'"
2388 continue
2389 fi
2390
2391 func_dirname "$file" "" "."
2392 dir="$func_dirname_result"
2393
2394 if test -f "$dir/$objdir/$dlname"; then
2395 dir="$dir/$objdir"
2396 else
2397 if test ! -f "$dir/$dlname"; then
2398 func_fatal_error "cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'"
2399 fi
2400 fi
2401 ;;
2402
2403 *.lo)
2404 # Just add the directory containing the .lo file.
2405 func_dirname "$file" "" "."
2406 dir="$func_dirname_result"
2407 ;;
2408
2409 *)
2410 func_warning "\`-dlopen' is ignored for non-libtool libraries and objects"
2411 continue
2412 ;;
2413 esac
2414
2415 # Get the absolute pathname.
2416 absdir=`cd "$dir" && pwd`
2417 test -n "$absdir" && dir="$absdir"
2418
2419 # Now add the directory to shlibpath_var.
2420 if eval "test -z \"\$$shlibpath_var\""; then
2421 eval "$shlibpath_var=\"\$dir\""
2422 else
2423 eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\""
2424 fi
2425 done
2426
2427 # This variable tells wrapper scripts just to set shlibpath_var
2428 # rather than running their programs.
2429 libtool_execute_magic="$magic"
2430
2431 # Check if any of the arguments is a wrapper script.
2432 args=
2433 for file
2434 do
2435 case $file in
cristy292e4352009-11-19 13:54:29 +00002436 -* | *.la | *.lo ) ;;
cristy3ed852e2009-09-05 21:47:34 +00002437 *)
2438 # Do a test to see if this is really a libtool program.
2439 if func_ltwrapper_script_p "$file"; then
2440 func_source "$file"
2441 # Transform arg to wrapped name.
2442 file="$progdir/$program"
2443 elif func_ltwrapper_executable_p "$file"; then
2444 func_ltwrapper_scriptname "$file"
2445 func_source "$func_ltwrapper_scriptname_result"
2446 # Transform arg to wrapped name.
2447 file="$progdir/$program"
2448 fi
2449 ;;
2450 esac
2451 # Quote arguments (to preserve shell metacharacters).
2452 func_quote_for_eval "$file"
2453 args="$args $func_quote_for_eval_result"
2454 done
2455
2456 if test "X$opt_dry_run" = Xfalse; then
2457 if test -n "$shlibpath_var"; then
2458 # Export the shlibpath_var.
2459 eval "export $shlibpath_var"
2460 fi
2461
2462 # Restore saved environment variables
2463 for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
2464 do
2465 eval "if test \"\${save_$lt_var+set}\" = set; then
2466 $lt_var=\$save_$lt_var; export $lt_var
2467 else
2468 $lt_unset $lt_var
2469 fi"
2470 done
2471
2472 # Now prepare to actually exec the command.
2473 exec_cmd="\$cmd$args"
2474 else
2475 # Display what would be done.
2476 if test -n "$shlibpath_var"; then
2477 eval "\$ECHO \"\$shlibpath_var=\$$shlibpath_var\""
cristy292e4352009-11-19 13:54:29 +00002478 echo "export $shlibpath_var"
cristy3ed852e2009-09-05 21:47:34 +00002479 fi
2480 $ECHO "$cmd$args"
2481 exit $EXIT_SUCCESS
2482 fi
2483}
2484
2485test "$mode" = execute && func_mode_execute ${1+"$@"}
2486
2487
2488# func_mode_finish arg...
2489func_mode_finish ()
2490{
2491 $opt_debug
2492 libdirs="$nonopt"
2493 admincmds=
2494
2495 if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
2496 for dir
2497 do
2498 libdirs="$libdirs $dir"
2499 done
2500
2501 for libdir in $libdirs; do
2502 if test -n "$finish_cmds"; then
2503 # Do each command in the finish commands.
2504 func_execute_cmds "$finish_cmds" 'admincmds="$admincmds
2505'"$cmd"'"'
2506 fi
2507 if test -n "$finish_eval"; then
2508 # Do the single finish_eval.
2509 eval cmds=\"$finish_eval\"
2510 $opt_dry_run || eval "$cmds" || admincmds="$admincmds
2511 $cmds"
2512 fi
2513 done
2514 fi
2515
2516 # Exit here if they wanted silent mode.
2517 $opt_silent && exit $EXIT_SUCCESS
2518
cristy292e4352009-11-19 13:54:29 +00002519 echo "----------------------------------------------------------------------"
2520 echo "Libraries have been installed in:"
cristy3ed852e2009-09-05 21:47:34 +00002521 for libdir in $libdirs; do
2522 $ECHO " $libdir"
2523 done
cristy292e4352009-11-19 13:54:29 +00002524 echo
2525 echo "If you ever happen to want to link against installed libraries"
2526 echo "in a given directory, LIBDIR, you must either use libtool, and"
2527 echo "specify the full pathname of the library, or use the \`-LLIBDIR'"
2528 echo "flag during linking and do at least one of the following:"
cristy3ed852e2009-09-05 21:47:34 +00002529 if test -n "$shlibpath_var"; then
cristy292e4352009-11-19 13:54:29 +00002530 echo " - add LIBDIR to the \`$shlibpath_var' environment variable"
2531 echo " during execution"
cristy3ed852e2009-09-05 21:47:34 +00002532 fi
2533 if test -n "$runpath_var"; then
cristy292e4352009-11-19 13:54:29 +00002534 echo " - add LIBDIR to the \`$runpath_var' environment variable"
2535 echo " during linking"
cristy3ed852e2009-09-05 21:47:34 +00002536 fi
2537 if test -n "$hardcode_libdir_flag_spec"; then
2538 libdir=LIBDIR
2539 eval flag=\"$hardcode_libdir_flag_spec\"
2540
2541 $ECHO " - use the \`$flag' linker flag"
2542 fi
2543 if test -n "$admincmds"; then
2544 $ECHO " - have your system administrator run these commands:$admincmds"
2545 fi
2546 if test -f /etc/ld.so.conf; then
cristy292e4352009-11-19 13:54:29 +00002547 echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'"
cristy3ed852e2009-09-05 21:47:34 +00002548 fi
cristy292e4352009-11-19 13:54:29 +00002549 echo
cristy3ed852e2009-09-05 21:47:34 +00002550
cristy292e4352009-11-19 13:54:29 +00002551 echo "See any operating system documentation about shared libraries for"
cristy3ed852e2009-09-05 21:47:34 +00002552 case $host in
2553 solaris2.[6789]|solaris2.1[0-9])
cristy292e4352009-11-19 13:54:29 +00002554 echo "more information, such as the ld(1), crle(1) and ld.so(8) manual"
2555 echo "pages."
cristy3ed852e2009-09-05 21:47:34 +00002556 ;;
2557 *)
cristy292e4352009-11-19 13:54:29 +00002558 echo "more information, such as the ld(1) and ld.so(8) manual pages."
cristy3ed852e2009-09-05 21:47:34 +00002559 ;;
2560 esac
cristy292e4352009-11-19 13:54:29 +00002561 echo "----------------------------------------------------------------------"
cristy3ed852e2009-09-05 21:47:34 +00002562 exit $EXIT_SUCCESS
2563}
2564
2565test "$mode" = finish && func_mode_finish ${1+"$@"}
2566
2567
2568# func_mode_install arg...
2569func_mode_install ()
2570{
2571 $opt_debug
2572 # There may be an optional sh(1) argument at the beginning of
2573 # install_prog (especially on Windows NT).
2574 if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh ||
2575 # Allow the use of GNU shtool's install command.
cristy292e4352009-11-19 13:54:29 +00002576 case $nonopt in *shtool*) :;; *) false;; esac; then
cristy3ed852e2009-09-05 21:47:34 +00002577 # Aesthetically quote it.
2578 func_quote_for_eval "$nonopt"
2579 install_prog="$func_quote_for_eval_result "
2580 arg=$1
2581 shift
2582 else
2583 install_prog=
2584 arg=$nonopt
2585 fi
2586
2587 # The real first argument should be the name of the installation program.
2588 # Aesthetically quote it.
2589 func_quote_for_eval "$arg"
2590 install_prog="$install_prog$func_quote_for_eval_result"
cristy292e4352009-11-19 13:54:29 +00002591 install_shared_prog=$install_prog
2592 case " $install_prog " in
2593 *[\\\ /]cp\ *) install_cp=: ;;
2594 *) install_cp=false ;;
2595 esac
cristy3ed852e2009-09-05 21:47:34 +00002596
2597 # We need to accept at least all the BSD install flags.
2598 dest=
2599 files=
2600 opts=
2601 prev=
2602 install_type=
2603 isdir=no
2604 stripme=
cristy292e4352009-11-19 13:54:29 +00002605 no_mode=:
cristy3ed852e2009-09-05 21:47:34 +00002606 for arg
2607 do
cristy292e4352009-11-19 13:54:29 +00002608 arg2=
cristy3ed852e2009-09-05 21:47:34 +00002609 if test -n "$dest"; then
2610 files="$files $dest"
2611 dest=$arg
2612 continue
2613 fi
2614
2615 case $arg in
2616 -d) isdir=yes ;;
2617 -f)
cristy292e4352009-11-19 13:54:29 +00002618 if $install_cp; then :; else
2619 prev=$arg
2620 fi
cristy3ed852e2009-09-05 21:47:34 +00002621 ;;
2622 -g | -m | -o)
2623 prev=$arg
2624 ;;
2625 -s)
2626 stripme=" -s"
2627 continue
2628 ;;
2629 -*)
2630 ;;
2631 *)
2632 # If the previous option needed an argument, then skip it.
2633 if test -n "$prev"; then
cristy292e4352009-11-19 13:54:29 +00002634 if test "x$prev" = x-m && test -n "$install_override_mode"; then
2635 arg2=$install_override_mode
2636 no_mode=false
2637 fi
cristy3ed852e2009-09-05 21:47:34 +00002638 prev=
2639 else
2640 dest=$arg
2641 continue
2642 fi
2643 ;;
2644 esac
2645
2646 # Aesthetically quote the argument.
2647 func_quote_for_eval "$arg"
2648 install_prog="$install_prog $func_quote_for_eval_result"
cristy292e4352009-11-19 13:54:29 +00002649 if test -n "$arg2"; then
2650 func_quote_for_eval "$arg2"
2651 fi
2652 install_shared_prog="$install_shared_prog $func_quote_for_eval_result"
cristy3ed852e2009-09-05 21:47:34 +00002653 done
2654
2655 test -z "$install_prog" && \
2656 func_fatal_help "you must specify an install program"
2657
2658 test -n "$prev" && \
2659 func_fatal_help "the \`$prev' option requires an argument"
2660
cristy292e4352009-11-19 13:54:29 +00002661 if test -n "$install_override_mode" && $no_mode; then
2662 if $install_cp; then :; else
2663 func_quote_for_eval "$install_override_mode"
2664 install_shared_prog="$install_shared_prog -m $func_quote_for_eval_result"
2665 fi
2666 fi
2667
cristy3ed852e2009-09-05 21:47:34 +00002668 if test -z "$files"; then
2669 if test -z "$dest"; then
2670 func_fatal_help "no file or destination specified"
2671 else
2672 func_fatal_help "you must specify a destination"
2673 fi
2674 fi
2675
2676 # Strip any trailing slash from the destination.
2677 func_stripname '' '/' "$dest"
2678 dest=$func_stripname_result
2679
2680 # Check to see that the destination is a directory.
2681 test -d "$dest" && isdir=yes
2682 if test "$isdir" = yes; then
2683 destdir="$dest"
2684 destname=
2685 else
2686 func_dirname_and_basename "$dest" "" "."
2687 destdir="$func_dirname_result"
2688 destname="$func_basename_result"
2689
2690 # Not a directory, so check to see that there is only one file specified.
2691 set dummy $files; shift
2692 test "$#" -gt 1 && \
2693 func_fatal_help "\`$dest' is not a directory"
2694 fi
2695 case $destdir in
2696 [\\/]* | [A-Za-z]:[\\/]*) ;;
2697 *)
2698 for file in $files; do
2699 case $file in
2700 *.lo) ;;
2701 *)
2702 func_fatal_help "\`$destdir' must be an absolute directory name"
2703 ;;
2704 esac
2705 done
2706 ;;
2707 esac
2708
2709 # This variable tells wrapper scripts just to set variables rather
2710 # than running their programs.
2711 libtool_install_magic="$magic"
2712
2713 staticlibs=
2714 future_libdirs=
2715 current_libdirs=
2716 for file in $files; do
2717
2718 # Do each installation.
2719 case $file in
2720 *.$libext)
2721 # Do the static libraries later.
2722 staticlibs="$staticlibs $file"
2723 ;;
2724
2725 *.la)
2726 # Check to see that this really is a libtool archive.
2727 func_lalib_unsafe_p "$file" \
2728 || func_fatal_help "\`$file' is not a valid libtool archive"
2729
2730 library_names=
2731 old_library=
2732 relink_command=
2733 func_source "$file"
2734
2735 # Add the libdir to current_libdirs if it is the destination.
2736 if test "X$destdir" = "X$libdir"; then
2737 case "$current_libdirs " in
2738 *" $libdir "*) ;;
2739 *) current_libdirs="$current_libdirs $libdir" ;;
2740 esac
2741 else
2742 # Note the libdir as a future libdir.
2743 case "$future_libdirs " in
2744 *" $libdir "*) ;;
2745 *) future_libdirs="$future_libdirs $libdir" ;;
2746 esac
2747 fi
2748
2749 func_dirname "$file" "/" ""
2750 dir="$func_dirname_result"
2751 dir="$dir$objdir"
2752
2753 if test -n "$relink_command"; then
2754 # Determine the prefix the user has applied to our future dir.
cristy292e4352009-11-19 13:54:29 +00002755 inst_prefix_dir=`$ECHO "$destdir" | $SED -e "s%$libdir\$%%"`
cristy3ed852e2009-09-05 21:47:34 +00002756
2757 # Don't allow the user to place us outside of our expected
2758 # location b/c this prevents finding dependent libraries that
2759 # are installed to the same prefix.
2760 # At present, this check doesn't affect windows .dll's that
2761 # are installed into $libdir/../bin (currently, that works fine)
2762 # but it's something to keep an eye on.
2763 test "$inst_prefix_dir" = "$destdir" && \
2764 func_fatal_error "error: cannot install \`$file' to a directory not ending in $libdir"
2765
2766 if test -n "$inst_prefix_dir"; then
2767 # Stick the inst_prefix_dir data into the link command.
cristy292e4352009-11-19 13:54:29 +00002768 relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"`
cristy3ed852e2009-09-05 21:47:34 +00002769 else
cristy292e4352009-11-19 13:54:29 +00002770 relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%%"`
cristy3ed852e2009-09-05 21:47:34 +00002771 fi
2772
2773 func_warning "relinking \`$file'"
2774 func_show_eval "$relink_command" \
2775 'func_fatal_error "error: relink \`$file'\'' with the above command before installing it"'
2776 fi
2777
2778 # See the names of the shared library.
2779 set dummy $library_names; shift
2780 if test -n "$1"; then
2781 realname="$1"
2782 shift
2783
2784 srcname="$realname"
2785 test -n "$relink_command" && srcname="$realname"T
2786
2787 # Install the shared library and build the symlinks.
cristy292e4352009-11-19 13:54:29 +00002788 func_show_eval "$install_shared_prog $dir/$srcname $destdir/$realname" \
cristy3ed852e2009-09-05 21:47:34 +00002789 'exit $?'
2790 tstripme="$stripme"
2791 case $host_os in
2792 cygwin* | mingw* | pw32* | cegcc*)
2793 case $realname in
2794 *.dll.a)
2795 tstripme=""
2796 ;;
2797 esac
2798 ;;
2799 esac
2800 if test -n "$tstripme" && test -n "$striplib"; then
2801 func_show_eval "$striplib $destdir/$realname" 'exit $?'
2802 fi
2803
2804 if test "$#" -gt 0; then
2805 # Delete the old symlinks, and create new ones.
2806 # Try `ln -sf' first, because the `ln' binary might depend on
2807 # the symlink we replace! Solaris /bin/ln does not understand -f,
2808 # so we also need to try rm && ln -s.
2809 for linkname
2810 do
2811 test "$linkname" != "$realname" \
2812 && func_show_eval "(cd $destdir && { $LN_S -f $realname $linkname || { $RM $linkname && $LN_S $realname $linkname; }; })"
2813 done
2814 fi
2815
2816 # Do each command in the postinstall commands.
2817 lib="$destdir/$realname"
2818 func_execute_cmds "$postinstall_cmds" 'exit $?'
2819 fi
2820
2821 # Install the pseudo-library for information purposes.
2822 func_basename "$file"
2823 name="$func_basename_result"
2824 instname="$dir/$name"i
2825 func_show_eval "$install_prog $instname $destdir/$name" 'exit $?'
2826
2827 # Maybe install the static library, too.
2828 test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library"
2829 ;;
2830
2831 *.lo)
2832 # Install (i.e. copy) a libtool object.
2833
2834 # Figure out destination file name, if it wasn't already specified.
2835 if test -n "$destname"; then
2836 destfile="$destdir/$destname"
2837 else
2838 func_basename "$file"
2839 destfile="$func_basename_result"
2840 destfile="$destdir/$destfile"
2841 fi
2842
2843 # Deduce the name of the destination old-style object file.
2844 case $destfile in
2845 *.lo)
2846 func_lo2o "$destfile"
2847 staticdest=$func_lo2o_result
2848 ;;
2849 *.$objext)
2850 staticdest="$destfile"
2851 destfile=
2852 ;;
2853 *)
2854 func_fatal_help "cannot copy a libtool object to \`$destfile'"
2855 ;;
2856 esac
2857
2858 # Install the libtool object if requested.
2859 test -n "$destfile" && \
2860 func_show_eval "$install_prog $file $destfile" 'exit $?'
2861
2862 # Install the old object if enabled.
2863 if test "$build_old_libs" = yes; then
2864 # Deduce the name of the old-style object file.
2865 func_lo2o "$file"
2866 staticobj=$func_lo2o_result
2867 func_show_eval "$install_prog \$staticobj \$staticdest" 'exit $?'
2868 fi
2869 exit $EXIT_SUCCESS
2870 ;;
2871
2872 *)
2873 # Figure out destination file name, if it wasn't already specified.
2874 if test -n "$destname"; then
2875 destfile="$destdir/$destname"
2876 else
2877 func_basename "$file"
2878 destfile="$func_basename_result"
2879 destfile="$destdir/$destfile"
2880 fi
2881
2882 # If the file is missing, and there is a .exe on the end, strip it
2883 # because it is most likely a libtool script we actually want to
2884 # install
2885 stripped_ext=""
2886 case $file in
2887 *.exe)
2888 if test ! -f "$file"; then
2889 func_stripname '' '.exe' "$file"
2890 file=$func_stripname_result
2891 stripped_ext=".exe"
2892 fi
2893 ;;
2894 esac
2895
2896 # Do a test to see if this is really a libtool program.
2897 case $host in
2898 *cygwin* | *mingw*)
2899 if func_ltwrapper_executable_p "$file"; then
2900 func_ltwrapper_scriptname "$file"
2901 wrapper=$func_ltwrapper_scriptname_result
2902 else
2903 func_stripname '' '.exe' "$file"
2904 wrapper=$func_stripname_result
2905 fi
2906 ;;
2907 *)
2908 wrapper=$file
2909 ;;
2910 esac
2911 if func_ltwrapper_script_p "$wrapper"; then
2912 notinst_deplibs=
2913 relink_command=
2914
2915 func_source "$wrapper"
2916
2917 # Check the variables that should have been set.
2918 test -z "$generated_by_libtool_version" && \
2919 func_fatal_error "invalid libtool wrapper script \`$wrapper'"
2920
2921 finalize=yes
2922 for lib in $notinst_deplibs; do
2923 # Check to see that each library is installed.
2924 libdir=
2925 if test -f "$lib"; then
2926 func_source "$lib"
2927 fi
cristy292e4352009-11-19 13:54:29 +00002928 libfile="$libdir/"`$ECHO "$lib" | $SED 's%^.*/%%g'` ### testsuite: skip nested quoting test
cristy3ed852e2009-09-05 21:47:34 +00002929 if test -n "$libdir" && test ! -f "$libfile"; then
2930 func_warning "\`$lib' has not been installed in \`$libdir'"
2931 finalize=no
2932 fi
2933 done
2934
2935 relink_command=
2936 func_source "$wrapper"
2937
2938 outputname=
2939 if test "$fast_install" = no && test -n "$relink_command"; then
2940 $opt_dry_run || {
2941 if test "$finalize" = yes; then
2942 tmpdir=`func_mktempdir`
2943 func_basename "$file$stripped_ext"
2944 file="$func_basename_result"
2945 outputname="$tmpdir/$file"
2946 # Replace the output file specification.
cristy292e4352009-11-19 13:54:29 +00002947 relink_command=`$ECHO "$relink_command" | $SED 's%@OUTPUT@%'"$outputname"'%g'`
cristy3ed852e2009-09-05 21:47:34 +00002948
2949 $opt_silent || {
2950 func_quote_for_expand "$relink_command"
2951 eval "func_echo $func_quote_for_expand_result"
2952 }
2953 if eval "$relink_command"; then :
2954 else
2955 func_error "error: relink \`$file' with the above command before installing it"
2956 $opt_dry_run || ${RM}r "$tmpdir"
2957 continue
2958 fi
2959 file="$outputname"
2960 else
2961 func_warning "cannot relink \`$file'"
2962 fi
2963 }
2964 else
2965 # Install the binary that we compiled earlier.
cristy292e4352009-11-19 13:54:29 +00002966 file=`$ECHO "$file$stripped_ext" | $SED "s%\([^/]*\)$%$objdir/\1%"`
cristy3ed852e2009-09-05 21:47:34 +00002967 fi
2968 fi
2969
2970 # remove .exe since cygwin /usr/bin/install will append another
2971 # one anyway
2972 case $install_prog,$host in
2973 */usr/bin/install*,*cygwin*)
2974 case $file:$destfile in
2975 *.exe:*.exe)
2976 # this is ok
2977 ;;
2978 *.exe:*)
2979 destfile=$destfile.exe
2980 ;;
2981 *:*.exe)
2982 func_stripname '' '.exe' "$destfile"
2983 destfile=$func_stripname_result
2984 ;;
2985 esac
2986 ;;
2987 esac
2988 func_show_eval "$install_prog\$stripme \$file \$destfile" 'exit $?'
2989 $opt_dry_run || if test -n "$outputname"; then
2990 ${RM}r "$tmpdir"
2991 fi
2992 ;;
2993 esac
2994 done
2995
2996 for file in $staticlibs; do
2997 func_basename "$file"
2998 name="$func_basename_result"
2999
3000 # Set up the ranlib parameters.
3001 oldlib="$destdir/$name"
3002
3003 func_show_eval "$install_prog \$file \$oldlib" 'exit $?'
3004
3005 if test -n "$stripme" && test -n "$old_striplib"; then
3006 func_show_eval "$old_striplib $oldlib" 'exit $?'
3007 fi
3008
3009 # Do each command in the postinstall commands.
3010 func_execute_cmds "$old_postinstall_cmds" 'exit $?'
3011 done
3012
3013 test -n "$future_libdirs" && \
3014 func_warning "remember to run \`$progname --finish$future_libdirs'"
3015
3016 if test -n "$current_libdirs"; then
3017 # Maybe just do a dry run.
3018 $opt_dry_run && current_libdirs=" -n$current_libdirs"
3019 exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs'
3020 else
3021 exit $EXIT_SUCCESS
3022 fi
3023}
3024
3025test "$mode" = install && func_mode_install ${1+"$@"}
3026
3027
3028# func_generate_dlsyms outputname originator pic_p
3029# Extract symbols from dlprefiles and create ${outputname}S.o with
3030# a dlpreopen symbol table.
3031func_generate_dlsyms ()
3032{
3033 $opt_debug
3034 my_outputname="$1"
3035 my_originator="$2"
3036 my_pic_p="${3-no}"
3037 my_prefix=`$ECHO "$my_originator" | sed 's%[^a-zA-Z0-9]%_%g'`
3038 my_dlsyms=
3039
3040 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
3041 if test -n "$NM" && test -n "$global_symbol_pipe"; then
3042 my_dlsyms="${my_outputname}S.c"
3043 else
3044 func_error "not configured to extract global symbols from dlpreopened files"
3045 fi
3046 fi
3047
3048 if test -n "$my_dlsyms"; then
3049 case $my_dlsyms in
3050 "") ;;
3051 *.c)
3052 # Discover the nlist of each of the dlfiles.
3053 nlist="$output_objdir/${my_outputname}.nm"
3054
3055 func_show_eval "$RM $nlist ${nlist}S ${nlist}T"
3056
3057 # Parse the name list into a source file.
3058 func_verbose "creating $output_objdir/$my_dlsyms"
3059
3060 $opt_dry_run || $ECHO > "$output_objdir/$my_dlsyms" "\
3061/* $my_dlsyms - symbol resolution table for \`$my_outputname' dlsym emulation. */
3062/* Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION */
3063
3064#ifdef __cplusplus
3065extern \"C\" {
3066#endif
3067
cristy292e4352009-11-19 13:54:29 +00003068#if defined(__GNUC__) && (((__GNUC__ == 4) && (__GNUC_MINOR__ >= 4)) || (__GNUC__ > 4))
3069#pragma GCC diagnostic ignored \"-Wstrict-prototypes\"
3070#endif
3071
cristy3ed852e2009-09-05 21:47:34 +00003072/* External symbol declarations for the compiler. */\
3073"
3074
3075 if test "$dlself" = yes; then
3076 func_verbose "generating symbol list for \`$output'"
3077
3078 $opt_dry_run || echo ': @PROGRAM@ ' > "$nlist"
3079
3080 # Add our own program objects to the symbol list.
cristy292e4352009-11-19 13:54:29 +00003081 progfiles=`$ECHO "$objs$old_deplibs" | $SP2NL | $SED "$lo2o" | $NL2SP`
cristy3ed852e2009-09-05 21:47:34 +00003082 for progfile in $progfiles; do
3083 func_verbose "extracting global C symbols from \`$progfile'"
3084 $opt_dry_run || eval "$NM $progfile | $global_symbol_pipe >> '$nlist'"
3085 done
3086
3087 if test -n "$exclude_expsyms"; then
3088 $opt_dry_run || {
3089 eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
3090 eval '$MV "$nlist"T "$nlist"'
3091 }
3092 fi
3093
3094 if test -n "$export_symbols_regex"; then
3095 $opt_dry_run || {
3096 eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T'
3097 eval '$MV "$nlist"T "$nlist"'
3098 }
3099 fi
3100
3101 # Prepare the list of exported symbols
3102 if test -z "$export_symbols"; then
3103 export_symbols="$output_objdir/$outputname.exp"
3104 $opt_dry_run || {
3105 $RM $export_symbols
3106 eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
3107 case $host in
3108 *cygwin* | *mingw* | *cegcc* )
3109 eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
3110 eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"'
3111 ;;
3112 esac
3113 }
3114 else
3115 $opt_dry_run || {
3116 eval "${SED} -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"'
3117 eval '$GREP -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T'
3118 eval '$MV "$nlist"T "$nlist"'
3119 case $host in
cristy292e4352009-11-19 13:54:29 +00003120 *cygwin* | *mingw* | *cegcc* )
cristy3ed852e2009-09-05 21:47:34 +00003121 eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
3122 eval 'cat "$nlist" >> "$output_objdir/$outputname.def"'
3123 ;;
3124 esac
3125 }
3126 fi
3127 fi
3128
3129 for dlprefile in $dlprefiles; do
3130 func_verbose "extracting global C symbols from \`$dlprefile'"
3131 func_basename "$dlprefile"
3132 name="$func_basename_result"
3133 $opt_dry_run || {
3134 eval '$ECHO ": $name " >> "$nlist"'
3135 eval "$NM $dlprefile 2>/dev/null | $global_symbol_pipe >> '$nlist'"
3136 }
3137 done
3138
3139 $opt_dry_run || {
3140 # Make sure we have at least an empty file.
3141 test -f "$nlist" || : > "$nlist"
3142
3143 if test -n "$exclude_expsyms"; then
3144 $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T
3145 $MV "$nlist"T "$nlist"
3146 fi
3147
3148 # Try sorting and uniquifying the output.
3149 if $GREP -v "^: " < "$nlist" |
3150 if sort -k 3 </dev/null >/dev/null 2>&1; then
3151 sort -k 3
3152 else
3153 sort +2
3154 fi |
3155 uniq > "$nlist"S; then
3156 :
3157 else
3158 $GREP -v "^: " < "$nlist" > "$nlist"S
3159 fi
3160
3161 if test -f "$nlist"S; then
3162 eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$my_dlsyms"'
3163 else
cristy292e4352009-11-19 13:54:29 +00003164 echo '/* NONE */' >> "$output_objdir/$my_dlsyms"
cristy3ed852e2009-09-05 21:47:34 +00003165 fi
3166
cristy292e4352009-11-19 13:54:29 +00003167 echo >> "$output_objdir/$my_dlsyms" "\
cristy3ed852e2009-09-05 21:47:34 +00003168
3169/* The mapping between symbol names and symbols. */
3170typedef struct {
3171 const char *name;
3172 void *address;
3173} lt_dlsymlist;
3174"
3175 case $host in
3176 *cygwin* | *mingw* | *cegcc* )
cristy292e4352009-11-19 13:54:29 +00003177 echo >> "$output_objdir/$my_dlsyms" "\
cristy3ed852e2009-09-05 21:47:34 +00003178/* DATA imports from DLLs on WIN32 con't be const, because
3179 runtime relocations are performed -- see ld's documentation
3180 on pseudo-relocs. */"
3181 lt_dlsym_const= ;;
3182 *osf5*)
3183 echo >> "$output_objdir/$my_dlsyms" "\
3184/* This system does not cope well with relocations in const data */"
3185 lt_dlsym_const= ;;
3186 *)
3187 lt_dlsym_const=const ;;
3188 esac
3189
cristy292e4352009-11-19 13:54:29 +00003190 echo >> "$output_objdir/$my_dlsyms" "\
cristy3ed852e2009-09-05 21:47:34 +00003191extern $lt_dlsym_const lt_dlsymlist
3192lt_${my_prefix}_LTX_preloaded_symbols[];
3193$lt_dlsym_const lt_dlsymlist
3194lt_${my_prefix}_LTX_preloaded_symbols[] =
3195{\
3196 { \"$my_originator\", (void *) 0 },"
3197
3198 case $need_lib_prefix in
3199 no)
3200 eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$my_dlsyms"
3201 ;;
3202 *)
3203 eval "$global_symbol_to_c_name_address_lib_prefix" < "$nlist" >> "$output_objdir/$my_dlsyms"
3204 ;;
3205 esac
cristy292e4352009-11-19 13:54:29 +00003206 echo >> "$output_objdir/$my_dlsyms" "\
cristy3ed852e2009-09-05 21:47:34 +00003207 {0, (void *) 0}
3208};
3209
3210/* This works around a problem in FreeBSD linker */
3211#ifdef FREEBSD_WORKAROUND
3212static const void *lt_preloaded_setup() {
3213 return lt_${my_prefix}_LTX_preloaded_symbols;
3214}
3215#endif
3216
3217#ifdef __cplusplus
3218}
3219#endif\
3220"
3221 } # !$opt_dry_run
3222
3223 pic_flag_for_symtable=
3224 case "$compile_command " in
3225 *" -static "*) ;;
3226 *)
3227 case $host in
3228 # compiling the symbol table file with pic_flag works around
3229 # a FreeBSD bug that causes programs to crash when -lm is
3230 # linked before any other PIC object. But we must not use
3231 # pic_flag when linking with -static. The problem exists in
3232 # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1.
3233 *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)
3234 pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND" ;;
3235 *-*-hpux*)
3236 pic_flag_for_symtable=" $pic_flag" ;;
3237 *)
3238 if test "X$my_pic_p" != Xno; then
3239 pic_flag_for_symtable=" $pic_flag"
3240 fi
3241 ;;
3242 esac
3243 ;;
3244 esac
3245 symtab_cflags=
3246 for arg in $LTCFLAGS; do
3247 case $arg in
3248 -pie | -fpie | -fPIE) ;;
3249 *) symtab_cflags="$symtab_cflags $arg" ;;
3250 esac
3251 done
3252
3253 # Now compile the dynamic symbol file.
3254 func_show_eval '(cd $output_objdir && $LTCC$symtab_cflags -c$no_builtin_flag$pic_flag_for_symtable "$my_dlsyms")' 'exit $?'
3255
3256 # Clean up the generated files.
3257 func_show_eval '$RM "$output_objdir/$my_dlsyms" "$nlist" "${nlist}S" "${nlist}T"'
3258
3259 # Transform the symbol file into the correct name.
3260 symfileobj="$output_objdir/${my_outputname}S.$objext"
3261 case $host in
3262 *cygwin* | *mingw* | *cegcc* )
3263 if test -f "$output_objdir/$my_outputname.def"; then
cristy292e4352009-11-19 13:54:29 +00003264 compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"`
3265 finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"`
cristy3ed852e2009-09-05 21:47:34 +00003266 else
cristy292e4352009-11-19 13:54:29 +00003267 compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"`
3268 finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"`
cristy3ed852e2009-09-05 21:47:34 +00003269 fi
3270 ;;
3271 *)
cristy292e4352009-11-19 13:54:29 +00003272 compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"`
3273 finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"`
cristy3ed852e2009-09-05 21:47:34 +00003274 ;;
3275 esac
3276 ;;
3277 *)
3278 func_fatal_error "unknown suffix for \`$my_dlsyms'"
3279 ;;
3280 esac
3281 else
3282 # We keep going just in case the user didn't refer to
3283 # lt_preloaded_symbols. The linker will fail if global_symbol_pipe
3284 # really was required.
3285
3286 # Nullify the symbol file.
cristy292e4352009-11-19 13:54:29 +00003287 compile_command=`$ECHO "$compile_command" | $SED "s% @SYMFILE@%%"`
3288 finalize_command=`$ECHO "$finalize_command" | $SED "s% @SYMFILE@%%"`
cristy3ed852e2009-09-05 21:47:34 +00003289 fi
3290}
3291
3292# func_win32_libid arg
3293# return the library type of file 'arg'
3294#
3295# Need a lot of goo to handle *both* DLLs and import libs
3296# Has to be a shell function in order to 'eat' the argument
3297# that is supplied when $file_magic_command is called.
cristy292e4352009-11-19 13:54:29 +00003298# Despite the name, also deal with 64 bit binaries.
cristy3ed852e2009-09-05 21:47:34 +00003299func_win32_libid ()
3300{
3301 $opt_debug
3302 win32_libid_type="unknown"
3303 win32_fileres=`file -L $1 2>/dev/null`
3304 case $win32_fileres in
3305 *ar\ archive\ import\ library*) # definitely import
3306 win32_libid_type="x86 archive import"
3307 ;;
3308 *ar\ archive*) # could be an import, or static
3309 if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null |
cristy292e4352009-11-19 13:54:29 +00003310 $EGREP 'file format (pe-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' >/dev/null; then
cristy3ed852e2009-09-05 21:47:34 +00003311 win32_nmres=`eval $NM -f posix -A $1 |
3312 $SED -n -e '
3313 1,100{
3314 / I /{
3315 s,.*,import,
3316 p
3317 q
3318 }
3319 }'`
3320 case $win32_nmres in
3321 import*) win32_libid_type="x86 archive import";;
3322 *) win32_libid_type="x86 archive static";;
3323 esac
3324 fi
3325 ;;
3326 *DLL*)
3327 win32_libid_type="x86 DLL"
3328 ;;
3329 *executable*) # but shell scripts are "executable" too...
3330 case $win32_fileres in
3331 *MS\ Windows\ PE\ Intel*)
3332 win32_libid_type="x86 DLL"
3333 ;;
3334 esac
3335 ;;
3336 esac
3337 $ECHO "$win32_libid_type"
3338}
3339
3340
3341
3342# func_extract_an_archive dir oldlib
3343func_extract_an_archive ()
3344{
3345 $opt_debug
3346 f_ex_an_ar_dir="$1"; shift
3347 f_ex_an_ar_oldlib="$1"
cristy292e4352009-11-19 13:54:29 +00003348 if test "$lock_old_archive_extraction" = yes; then
3349 lockfile=$f_ex_an_ar_oldlib.lock
3350 until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do
3351 func_echo "Waiting for $lockfile to be removed"
3352 sleep 2
3353 done
3354 fi
3355 func_show_eval "(cd \$f_ex_an_ar_dir && $AR x \"\$f_ex_an_ar_oldlib\")" \
3356 'stat=$?; rm -f "$lockfile"; exit $stat'
3357 if test "$lock_old_archive_extraction" = yes; then
3358 $opt_dry_run || rm -f "$lockfile"
3359 fi
cristy3ed852e2009-09-05 21:47:34 +00003360 if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then
3361 :
3362 else
3363 func_fatal_error "object name conflicts in archive: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib"
3364 fi
3365}
3366
3367
3368# func_extract_archives gentop oldlib ...
3369func_extract_archives ()
3370{
3371 $opt_debug
3372 my_gentop="$1"; shift
3373 my_oldlibs=${1+"$@"}
3374 my_oldobjs=""
3375 my_xlib=""
3376 my_xabs=""
3377 my_xdir=""
3378
3379 for my_xlib in $my_oldlibs; do
3380 # Extract the objects.
3381 case $my_xlib in
3382 [\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;;
3383 *) my_xabs=`pwd`"/$my_xlib" ;;
3384 esac
3385 func_basename "$my_xlib"
3386 my_xlib="$func_basename_result"
3387 my_xlib_u=$my_xlib
3388 while :; do
3389 case " $extracted_archives " in
3390 *" $my_xlib_u "*)
3391 func_arith $extracted_serial + 1
3392 extracted_serial=$func_arith_result
3393 my_xlib_u=lt$extracted_serial-$my_xlib ;;
3394 *) break ;;
3395 esac
3396 done
3397 extracted_archives="$extracted_archives $my_xlib_u"
3398 my_xdir="$my_gentop/$my_xlib_u"
3399
3400 func_mkdir_p "$my_xdir"
3401
3402 case $host in
3403 *-darwin*)
3404 func_verbose "Extracting $my_xabs"
3405 # Do not bother doing anything if just a dry run
3406 $opt_dry_run || {
3407 darwin_orig_dir=`pwd`
3408 cd $my_xdir || exit $?
3409 darwin_archive=$my_xabs
3410 darwin_curdir=`pwd`
3411 darwin_base_archive=`basename "$darwin_archive"`
3412 darwin_arches=`$LIPO -info "$darwin_archive" 2>/dev/null | $GREP Architectures 2>/dev/null || true`
3413 if test -n "$darwin_arches"; then
3414 darwin_arches=`$ECHO "$darwin_arches" | $SED -e 's/.*are://'`
3415 darwin_arch=
3416 func_verbose "$darwin_base_archive has multiple architectures $darwin_arches"
3417 for darwin_arch in $darwin_arches ; do
3418 func_mkdir_p "unfat-$$/${darwin_base_archive}-${darwin_arch}"
3419 $LIPO -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}"
3420 cd "unfat-$$/${darwin_base_archive}-${darwin_arch}"
3421 func_extract_an_archive "`pwd`" "${darwin_base_archive}"
3422 cd "$darwin_curdir"
3423 $RM "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}"
3424 done # $darwin_arches
3425 ## Okay now we've a bunch of thin objects, gotta fatten them up :)
3426 darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print | $SED -e "$basename" | sort -u`
3427 darwin_file=
3428 darwin_files=
3429 for darwin_file in $darwin_filelist; do
3430 darwin_files=`find unfat-$$ -name $darwin_file -print | $NL2SP`
3431 $LIPO -create -output "$darwin_file" $darwin_files
3432 done # $darwin_filelist
3433 $RM -rf unfat-$$
3434 cd "$darwin_orig_dir"
3435 else
3436 cd $darwin_orig_dir
3437 func_extract_an_archive "$my_xdir" "$my_xabs"
3438 fi # $darwin_arches
3439 } # !$opt_dry_run
3440 ;;
3441 *)
3442 func_extract_an_archive "$my_xdir" "$my_xabs"
3443 ;;
3444 esac
3445 my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP`
3446 done
3447
3448 func_extract_archives_result="$my_oldobjs"
3449}
3450
3451
cristy292e4352009-11-19 13:54:29 +00003452# func_emit_wrapper [arg=no]
cristy3ed852e2009-09-05 21:47:34 +00003453#
cristy292e4352009-11-19 13:54:29 +00003454# Emit a libtool wrapper script on stdout.
3455# Don't directly open a file because we may want to
3456# incorporate the script contents within a cygwin/mingw
3457# wrapper executable. Must ONLY be called from within
3458# func_mode_link because it depends on a number of variables
3459# set therein.
3460#
3461# ARG is the value that the WRAPPER_SCRIPT_BELONGS_IN_OBJDIR
3462# variable will take. If 'yes', then the emitted script
3463# will assume that the directory in which it is stored is
3464# the $objdir directory. This is a cygwin/mingw-specific
3465# behavior.
3466func_emit_wrapper ()
cristy3ed852e2009-09-05 21:47:34 +00003467{
cristy292e4352009-11-19 13:54:29 +00003468 func_emit_wrapper_arg1=${1-no}
cristy3ed852e2009-09-05 21:47:34 +00003469
3470 $ECHO "\
3471#! $SHELL
3472
3473# $output - temporary wrapper script for $objdir/$outputname
3474# Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
3475#
3476# The $output program cannot be directly executed until all the libtool
3477# libraries that it depends on are installed.
3478#
3479# This wrapper script should never be moved out of the build directory.
3480# If it is, it will not operate correctly.
3481
3482# Sed substitution that helps us do robust quoting. It backslashifies
3483# metacharacters that are still active within double-quoted strings.
cristy3ed852e2009-09-05 21:47:34 +00003484sed_quote_subst='$sed_quote_subst'
3485
3486# Be Bourne compatible
3487if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then
3488 emulate sh
3489 NULLCMD=:
3490 # Zsh 3.x and 4.x performs word splitting on \${1+\"\$@\"}, which
3491 # is contrary to our usage. Disable this feature.
3492 alias -g '\${1+\"\$@\"}'='\"\$@\"'
3493 setopt NO_GLOB_SUBST
3494else
3495 case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac
3496fi
3497BIN_SH=xpg4; export BIN_SH # for Tru64
3498DUALCASE=1; export DUALCASE # for MKS sh
3499
3500# The HP-UX ksh and POSIX shell print the target directory to stdout
3501# if CDPATH is set.
3502(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
3503
3504relink_command=\"$relink_command\"
3505
3506# This environment variable determines our operation mode.
3507if test \"\$libtool_install_magic\" = \"$magic\"; then
3508 # install mode needs the following variables:
3509 generated_by_libtool_version='$macro_version'
3510 notinst_deplibs='$notinst_deplibs'
3511else
3512 # When we are sourced in execute mode, \$file and \$ECHO are already set.
3513 if test \"\$libtool_execute_magic\" != \"$magic\"; then
cristy292e4352009-11-19 13:54:29 +00003514 file=\"\$0\""
3515
3516 qECHO=`$ECHO "$ECHO" | $SED "$sed_quote_subst"`
3517 $ECHO "\
3518
3519# A function that is used when there is no print builtin or printf.
3520func_fallback_echo ()
3521{
3522 eval 'cat <<_LTECHO_EOF
3523\$1
3524_LTECHO_EOF'
3525}
3526 ECHO=\"$qECHO\"
cristy3ed852e2009-09-05 21:47:34 +00003527 fi\
cristy3ed852e2009-09-05 21:47:34 +00003528
3529 # Find the directory that this script lives in.
cristy292e4352009-11-19 13:54:29 +00003530 thisdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*$%%'\`
cristy3ed852e2009-09-05 21:47:34 +00003531 test \"x\$thisdir\" = \"x\$file\" && thisdir=.
3532
3533 # Follow symbolic links until we get to the real thisdir.
cristy292e4352009-11-19 13:54:29 +00003534 file=\`ls -ld \"\$file\" | $SED -n 's/.*-> //p'\`
cristy3ed852e2009-09-05 21:47:34 +00003535 while test -n \"\$file\"; do
cristy292e4352009-11-19 13:54:29 +00003536 destdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*\$%%'\`
cristy3ed852e2009-09-05 21:47:34 +00003537
3538 # If there was a directory component, then change thisdir.
3539 if test \"x\$destdir\" != \"x\$file\"; then
3540 case \"\$destdir\" in
3541 [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;;
3542 *) thisdir=\"\$thisdir/\$destdir\" ;;
3543 esac
3544 fi
3545
cristy292e4352009-11-19 13:54:29 +00003546 file=\`\$ECHO \"\$file\" | $SED 's%^.*/%%'\`
3547 file=\`ls -ld \"\$thisdir/\$file\" | $SED -n 's/.*-> //p'\`
cristy3ed852e2009-09-05 21:47:34 +00003548 done
cristy3ed852e2009-09-05 21:47:34 +00003549
3550 # Usually 'no', except on cygwin/mingw when embedded into
3551 # the cwrapper.
cristy292e4352009-11-19 13:54:29 +00003552 WRAPPER_SCRIPT_BELONGS_IN_OBJDIR=$func_emit_wrapper_arg1
cristy3ed852e2009-09-05 21:47:34 +00003553 if test \"\$WRAPPER_SCRIPT_BELONGS_IN_OBJDIR\" = \"yes\"; then
3554 # special case for '.'
3555 if test \"\$thisdir\" = \".\"; then
3556 thisdir=\`pwd\`
3557 fi
3558 # remove .libs from thisdir
3559 case \"\$thisdir\" in
cristy292e4352009-11-19 13:54:29 +00003560 *[\\\\/]$objdir ) thisdir=\`\$ECHO \"\$thisdir\" | $SED 's%[\\\\/][^\\\\/]*$%%'\` ;;
cristy3ed852e2009-09-05 21:47:34 +00003561 $objdir ) thisdir=. ;;
3562 esac
3563 fi
3564
3565 # Try to get the absolute directory name.
3566 absdir=\`cd \"\$thisdir\" && pwd\`
3567 test -n \"\$absdir\" && thisdir=\"\$absdir\"
3568"
3569
3570 if test "$fast_install" = yes; then
3571 $ECHO "\
3572 program=lt-'$outputname'$exeext
3573 progdir=\"\$thisdir/$objdir\"
3574
3575 if test ! -f \"\$progdir/\$program\" ||
3576 { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\
3577 test \"X\$file\" != \"X\$progdir/\$program\"; }; then
3578
3579 file=\"\$\$-\$program\"
3580
3581 if test ! -d \"\$progdir\"; then
3582 $MKDIR \"\$progdir\"
3583 else
3584 $RM \"\$progdir/\$file\"
3585 fi"
3586
3587 $ECHO "\
3588
3589 # relink executable if necessary
3590 if test -n \"\$relink_command\"; then
3591 if relink_command_output=\`eval \$relink_command 2>&1\`; then :
3592 else
3593 $ECHO \"\$relink_command_output\" >&2
3594 $RM \"\$progdir/\$file\"
3595 exit 1
3596 fi
3597 fi
3598
3599 $MV \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null ||
3600 { $RM \"\$progdir/\$program\";
3601 $MV \"\$progdir/\$file\" \"\$progdir/\$program\"; }
3602 $RM \"\$progdir/\$file\"
3603 fi"
3604 else
3605 $ECHO "\
3606 program='$outputname'
3607 progdir=\"\$thisdir/$objdir\"
3608"
3609 fi
3610
3611 $ECHO "\
3612
3613 if test -f \"\$progdir/\$program\"; then"
3614
3615 # Export our shlibpath_var if we have one.
3616 if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
3617 $ECHO "\
3618 # Add our own library path to $shlibpath_var
3619 $shlibpath_var=\"$temp_rpath\$$shlibpath_var\"
3620
3621 # Some systems cannot cope with colon-terminated $shlibpath_var
3622 # The second colon is a workaround for a bug in BeOS R4 sed
cristy292e4352009-11-19 13:54:29 +00003623 $shlibpath_var=\`\$ECHO \"\$$shlibpath_var\" | $SED 's/::*\$//'\`
cristy3ed852e2009-09-05 21:47:34 +00003624
3625 export $shlibpath_var
3626"
3627 fi
3628
3629 # fixup the dll searchpath if we need to.
3630 if test -n "$dllsearchpath"; then
3631 $ECHO "\
3632 # Add the dll search path components to the executable PATH
3633 PATH=$dllsearchpath:\$PATH
3634"
3635 fi
3636
3637 $ECHO "\
3638 if test \"\$libtool_execute_magic\" != \"$magic\"; then
3639 # Run the actual program with our arguments.
3640"
3641 case $host in
3642 # Backslashes separate directories on plain windows
3643 *-*-mingw | *-*-os2* | *-cegcc*)
3644 $ECHO "\
3645 exec \"\$progdir\\\\\$program\" \${1+\"\$@\"}
3646"
3647 ;;
3648
3649 *)
3650 $ECHO "\
3651 exec \"\$progdir/\$program\" \${1+\"\$@\"}
3652"
3653 ;;
3654 esac
3655 $ECHO "\
3656 \$ECHO \"\$0: cannot exec \$program \$*\" 1>&2
3657 exit 1
3658 fi
3659 else
3660 # The program doesn't exist.
3661 \$ECHO \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2
3662 \$ECHO \"This script is just a wrapper for \$program.\" 1>&2
cristy292e4352009-11-19 13:54:29 +00003663 \$ECHO \"See the $PACKAGE documentation for more information.\" 1>&2
cristy3ed852e2009-09-05 21:47:34 +00003664 exit 1
3665 fi
3666fi\
3667"
3668}
cristy3ed852e2009-09-05 21:47:34 +00003669
3670
3671# func_to_host_path arg
3672#
3673# Convert paths to host format when used with build tools.
3674# Intended for use with "native" mingw (where libtool itself
3675# is running under the msys shell), or in the following cross-
3676# build environments:
3677# $build $host
3678# mingw (msys) mingw [e.g. native]
3679# cygwin mingw
3680# *nix + wine mingw
3681# where wine is equipped with the `winepath' executable.
3682# In the native mingw case, the (msys) shell automatically
3683# converts paths for any non-msys applications it launches,
3684# but that facility isn't available from inside the cwrapper.
3685# Similar accommodations are necessary for $host mingw and
3686# $build cygwin. Calling this function does no harm for other
3687# $host/$build combinations not listed above.
3688#
3689# ARG is the path (on $build) that should be converted to
3690# the proper representation for $host. The result is stored
3691# in $func_to_host_path_result.
3692func_to_host_path ()
3693{
3694 func_to_host_path_result="$1"
cristy292e4352009-11-19 13:54:29 +00003695 if test -n "$1"; then
cristy3ed852e2009-09-05 21:47:34 +00003696 case $host in
3697 *mingw* )
3698 lt_sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g'
3699 case $build in
3700 *mingw* ) # actually, msys
3701 # awkward: cmd appends spaces to result
cristy292e4352009-11-19 13:54:29 +00003702 func_to_host_path_result=`( cmd //c echo "$1" ) 2>/dev/null |
3703 $SED -e 's/[ ]*$//' -e "$lt_sed_naive_backslashify"`
cristy3ed852e2009-09-05 21:47:34 +00003704 ;;
3705 *cygwin* )
cristy292e4352009-11-19 13:54:29 +00003706 func_to_host_path_result=`cygpath -w "$1" |
3707 $SED -e "$lt_sed_naive_backslashify"`
cristy3ed852e2009-09-05 21:47:34 +00003708 ;;
3709 * )
3710 # Unfortunately, winepath does not exit with a non-zero
3711 # error code, so we are forced to check the contents of
3712 # stdout. On the other hand, if the command is not
3713 # found, the shell will set an exit code of 127 and print
3714 # *an error message* to stdout. So we must check for both
3715 # error code of zero AND non-empty stdout, which explains
3716 # the odd construction:
3717 func_to_host_path_tmp1=`winepath -w "$1" 2>/dev/null`
3718 if test "$?" -eq 0 && test -n "${func_to_host_path_tmp1}"; then
cristy292e4352009-11-19 13:54:29 +00003719 func_to_host_path_result=`$ECHO "$func_to_host_path_tmp1" |
cristy3ed852e2009-09-05 21:47:34 +00003720 $SED -e "$lt_sed_naive_backslashify"`
3721 else
3722 # Allow warning below.
cristy292e4352009-11-19 13:54:29 +00003723 func_to_host_path_result=
cristy3ed852e2009-09-05 21:47:34 +00003724 fi
3725 ;;
3726 esac
3727 if test -z "$func_to_host_path_result" ; then
3728 func_error "Could not determine host path corresponding to"
cristy292e4352009-11-19 13:54:29 +00003729 func_error " \`$1'"
cristy3ed852e2009-09-05 21:47:34 +00003730 func_error "Continuing, but uninstalled executables may not work."
3731 # Fallback:
3732 func_to_host_path_result="$1"
3733 fi
3734 ;;
3735 esac
3736 fi
3737}
3738# end: func_to_host_path
3739
3740# func_to_host_pathlist arg
3741#
3742# Convert pathlists to host format when used with build tools.
3743# See func_to_host_path(), above. This function supports the
3744# following $build/$host combinations (but does no harm for
3745# combinations not listed here):
3746# $build $host
3747# mingw (msys) mingw [e.g. native]
3748# cygwin mingw
3749# *nix + wine mingw
3750#
3751# Path separators are also converted from $build format to
3752# $host format. If ARG begins or ends with a path separator
3753# character, it is preserved (but converted to $host format)
3754# on output.
3755#
3756# ARG is a pathlist (on $build) that should be converted to
3757# the proper representation on $host. The result is stored
3758# in $func_to_host_pathlist_result.
3759func_to_host_pathlist ()
3760{
3761 func_to_host_pathlist_result="$1"
cristy292e4352009-11-19 13:54:29 +00003762 if test -n "$1"; then
cristy3ed852e2009-09-05 21:47:34 +00003763 case $host in
3764 *mingw* )
3765 lt_sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g'
3766 # Remove leading and trailing path separator characters from
3767 # ARG. msys behavior is inconsistent here, cygpath turns them
3768 # into '.;' and ';.', and winepath ignores them completely.
cristy292e4352009-11-19 13:54:29 +00003769 func_stripname : : "$1"
3770 func_to_host_pathlist_tmp1=$func_stripname_result
cristy3ed852e2009-09-05 21:47:34 +00003771 case $build in
3772 *mingw* ) # Actually, msys.
3773 # Awkward: cmd appends spaces to result.
cristy292e4352009-11-19 13:54:29 +00003774 func_to_host_pathlist_result=`
3775 ( cmd //c echo "$func_to_host_pathlist_tmp1" ) 2>/dev/null |
3776 $SED -e 's/[ ]*$//' -e "$lt_sed_naive_backslashify"`
cristy3ed852e2009-09-05 21:47:34 +00003777 ;;
3778 *cygwin* )
cristy292e4352009-11-19 13:54:29 +00003779 func_to_host_pathlist_result=`cygpath -w -p "$func_to_host_pathlist_tmp1" |
cristy3ed852e2009-09-05 21:47:34 +00003780 $SED -e "$lt_sed_naive_backslashify"`
3781 ;;
3782 * )
3783 # unfortunately, winepath doesn't convert pathlists
3784 func_to_host_pathlist_result=""
3785 func_to_host_pathlist_oldIFS=$IFS
3786 IFS=:
3787 for func_to_host_pathlist_f in $func_to_host_pathlist_tmp1 ; do
3788 IFS=$func_to_host_pathlist_oldIFS
3789 if test -n "$func_to_host_pathlist_f" ; then
3790 func_to_host_path "$func_to_host_pathlist_f"
3791 if test -n "$func_to_host_path_result" ; then
3792 if test -z "$func_to_host_pathlist_result" ; then
3793 func_to_host_pathlist_result="$func_to_host_path_result"
3794 else
cristy292e4352009-11-19 13:54:29 +00003795 func_append func_to_host_pathlist_result ";$func_to_host_path_result"
cristy3ed852e2009-09-05 21:47:34 +00003796 fi
3797 fi
3798 fi
cristy3ed852e2009-09-05 21:47:34 +00003799 done
3800 IFS=$func_to_host_pathlist_oldIFS
3801 ;;
3802 esac
cristy292e4352009-11-19 13:54:29 +00003803 if test -z "$func_to_host_pathlist_result"; then
cristy3ed852e2009-09-05 21:47:34 +00003804 func_error "Could not determine the host path(s) corresponding to"
cristy292e4352009-11-19 13:54:29 +00003805 func_error " \`$1'"
cristy3ed852e2009-09-05 21:47:34 +00003806 func_error "Continuing, but uninstalled executables may not work."
3807 # Fallback. This may break if $1 contains DOS-style drive
3808 # specifications. The fix is not to complicate the expression
3809 # below, but for the user to provide a working wine installation
3810 # with winepath so that path translation in the cross-to-mingw
3811 # case works properly.
3812 lt_replace_pathsep_nix_to_dos="s|:|;|g"
3813 func_to_host_pathlist_result=`echo "$func_to_host_pathlist_tmp1" |\
3814 $SED -e "$lt_replace_pathsep_nix_to_dos"`
3815 fi
3816 # Now, add the leading and trailing path separators back
3817 case "$1" in
3818 :* ) func_to_host_pathlist_result=";$func_to_host_pathlist_result"
3819 ;;
3820 esac
3821 case "$1" in
cristy292e4352009-11-19 13:54:29 +00003822 *: ) func_append func_to_host_pathlist_result ";"
cristy3ed852e2009-09-05 21:47:34 +00003823 ;;
3824 esac
3825 ;;
3826 esac
3827 fi
3828}
3829# end: func_to_host_pathlist
3830
3831# func_emit_cwrapperexe_src
3832# emit the source code for a wrapper executable on stdout
3833# Must ONLY be called from within func_mode_link because
3834# it depends on a number of variable set therein.
3835func_emit_cwrapperexe_src ()
3836{
3837 cat <<EOF
3838
3839/* $cwrappersource - temporary wrapper executable for $objdir/$outputname
3840 Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
3841
3842 The $output program cannot be directly executed until all the libtool
3843 libraries that it depends on are installed.
3844
3845 This wrapper executable should never be moved out of the build directory.
3846 If it is, it will not operate correctly.
3847
3848 Currently, it simply execs the wrapper *script* "$SHELL $output",
3849 but could eventually absorb all of the scripts functionality and
3850 exec $objdir/$outputname directly.
3851*/
3852EOF
3853 cat <<"EOF"
cristy292e4352009-11-19 13:54:29 +00003854#ifdef _MSC_VER
3855# define _CRT_SECURE_NO_DEPRECATE 1
3856#endif
cristy3ed852e2009-09-05 21:47:34 +00003857#include <stdio.h>
3858#include <stdlib.h>
3859#ifdef _MSC_VER
3860# include <direct.h>
3861# include <process.h>
3862# include <io.h>
cristy3ed852e2009-09-05 21:47:34 +00003863#else
3864# include <unistd.h>
3865# include <stdint.h>
3866# ifdef __CYGWIN__
3867# include <io.h>
cristy3ed852e2009-09-05 21:47:34 +00003868# endif
3869#endif
3870#include <malloc.h>
3871#include <stdarg.h>
3872#include <assert.h>
3873#include <string.h>
3874#include <ctype.h>
3875#include <errno.h>
3876#include <fcntl.h>
3877#include <sys/stat.h>
3878
cristy292e4352009-11-19 13:54:29 +00003879/* declarations of non-ANSI functions */
3880#if defined(__MINGW32__)
3881# ifdef __STRICT_ANSI__
3882int _putenv (const char *);
3883# endif
3884#elif defined(__CYGWIN__)
3885# ifdef __STRICT_ANSI__
3886char *realpath (const char *, char *);
3887int putenv (char *);
3888int setenv (const char *, const char *, int);
3889# endif
3890/* #elif defined (other platforms) ... */
3891#endif
3892
3893/* portability defines, excluding path handling macros */
3894#if defined(_MSC_VER)
3895# define setmode _setmode
3896# define stat _stat
3897# define chmod _chmod
3898# define getcwd _getcwd
3899# define putenv _putenv
3900# define S_IXUSR _S_IEXEC
3901# ifndef _INTPTR_T_DEFINED
3902# define _INTPTR_T_DEFINED
3903# define intptr_t int
3904# endif
3905#elif defined(__MINGW32__)
3906# define setmode _setmode
3907# define stat _stat
3908# define chmod _chmod
3909# define getcwd _getcwd
3910# define putenv _putenv
3911#elif defined(__CYGWIN__)
3912# define HAVE_SETENV
3913# define FOPEN_WB "wb"
3914/* #elif defined (other platforms) ... */
3915#endif
3916
cristy3ed852e2009-09-05 21:47:34 +00003917#if defined(PATH_MAX)
3918# define LT_PATHMAX PATH_MAX
3919#elif defined(MAXPATHLEN)
3920# define LT_PATHMAX MAXPATHLEN
3921#else
3922# define LT_PATHMAX 1024
3923#endif
3924
3925#ifndef S_IXOTH
3926# define S_IXOTH 0
3927#endif
3928#ifndef S_IXGRP
3929# define S_IXGRP 0
3930#endif
3931
cristy292e4352009-11-19 13:54:29 +00003932/* path handling portability macros */
cristy3ed852e2009-09-05 21:47:34 +00003933#ifndef DIR_SEPARATOR
3934# define DIR_SEPARATOR '/'
3935# define PATH_SEPARATOR ':'
3936#endif
3937
3938#if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \
3939 defined (__OS2__)
3940# define HAVE_DOS_BASED_FILE_SYSTEM
3941# define FOPEN_WB "wb"
3942# ifndef DIR_SEPARATOR_2
3943# define DIR_SEPARATOR_2 '\\'
3944# endif
3945# ifndef PATH_SEPARATOR_2
3946# define PATH_SEPARATOR_2 ';'
3947# endif
3948#endif
3949
3950#ifndef DIR_SEPARATOR_2
3951# define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR)
3952#else /* DIR_SEPARATOR_2 */
3953# define IS_DIR_SEPARATOR(ch) \
3954 (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2))
3955#endif /* DIR_SEPARATOR_2 */
3956
3957#ifndef PATH_SEPARATOR_2
3958# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR)
3959#else /* PATH_SEPARATOR_2 */
3960# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2)
3961#endif /* PATH_SEPARATOR_2 */
3962
cristy3ed852e2009-09-05 21:47:34 +00003963#ifndef FOPEN_WB
3964# define FOPEN_WB "w"
3965#endif
3966#ifndef _O_BINARY
3967# define _O_BINARY 0
3968#endif
3969
3970#define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type)))
3971#define XFREE(stale) do { \
3972 if (stale) { free ((void *) stale); stale = 0; } \
3973} while (0)
3974
3975#undef LTWRAPPER_DEBUGPRINTF
cristy292e4352009-11-19 13:54:29 +00003976#if defined LT_DEBUGWRAPPER
cristy3ed852e2009-09-05 21:47:34 +00003977# define LTWRAPPER_DEBUGPRINTF(args) ltwrapper_debugprintf args
3978static void
3979ltwrapper_debugprintf (const char *fmt, ...)
3980{
3981 va_list args;
3982 va_start (args, fmt);
3983 (void) vfprintf (stderr, fmt, args);
3984 va_end (args);
3985}
3986#else
3987# define LTWRAPPER_DEBUGPRINTF(args)
3988#endif
3989
3990const char *program_name = NULL;
3991
3992void *xmalloc (size_t num);
3993char *xstrdup (const char *string);
3994const char *base_name (const char *name);
3995char *find_executable (const char *wrapper);
3996char *chase_symlinks (const char *pathspec);
3997int make_executable (const char *path);
3998int check_executable (const char *path);
3999char *strendzap (char *str, const char *pat);
4000void lt_fatal (const char *message, ...);
4001void lt_setenv (const char *name, const char *value);
4002char *lt_extend_str (const char *orig_value, const char *add, int to_end);
cristy3ed852e2009-09-05 21:47:34 +00004003void lt_update_exe_path (const char *name, const char *value);
4004void lt_update_lib_path (const char *name, const char *value);
cristy292e4352009-11-19 13:54:29 +00004005char **prepare_spawn (char **argv);
4006void lt_dump_script (FILE *f);
cristy3ed852e2009-09-05 21:47:34 +00004007EOF
4008
cristy3ed852e2009-09-05 21:47:34 +00004009 cat <<EOF
4010const char * MAGIC_EXE = "$magic_exe";
4011const char * LIB_PATH_VARNAME = "$shlibpath_var";
4012EOF
4013
4014 if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
4015 func_to_host_pathlist "$temp_rpath"
4016 cat <<EOF
4017const char * LIB_PATH_VALUE = "$func_to_host_pathlist_result";
4018EOF
4019 else
4020 cat <<"EOF"
4021const char * LIB_PATH_VALUE = "";
4022EOF
4023 fi
4024
4025 if test -n "$dllsearchpath"; then
4026 func_to_host_pathlist "$dllsearchpath:"
4027 cat <<EOF
4028const char * EXE_PATH_VARNAME = "PATH";
4029const char * EXE_PATH_VALUE = "$func_to_host_pathlist_result";
4030EOF
4031 else
4032 cat <<"EOF"
4033const char * EXE_PATH_VARNAME = "";
4034const char * EXE_PATH_VALUE = "";
4035EOF
4036 fi
4037
4038 if test "$fast_install" = yes; then
4039 cat <<EOF
4040const char * TARGET_PROGRAM_NAME = "lt-$outputname"; /* hopefully, no .exe */
4041EOF
4042 else
4043 cat <<EOF
4044const char * TARGET_PROGRAM_NAME = "$outputname"; /* hopefully, no .exe */
4045EOF
4046 fi
4047
4048
4049 cat <<"EOF"
4050
4051#define LTWRAPPER_OPTION_PREFIX "--lt-"
4052#define LTWRAPPER_OPTION_PREFIX_LENGTH 5
4053
4054static const size_t opt_prefix_len = LTWRAPPER_OPTION_PREFIX_LENGTH;
4055static const char *ltwrapper_option_prefix = LTWRAPPER_OPTION_PREFIX;
4056
4057static const char *dumpscript_opt = LTWRAPPER_OPTION_PREFIX "dump-script";
4058
cristy3ed852e2009-09-05 21:47:34 +00004059int
4060main (int argc, char *argv[])
4061{
4062 char **newargz;
4063 int newargc;
4064 char *tmp_pathspec;
4065 char *actual_cwrapper_path;
4066 char *actual_cwrapper_name;
4067 char *target_name;
4068 char *lt_argv_zero;
4069 intptr_t rval = 127;
4070
4071 int i;
4072
4073 program_name = (char *) xstrdup (base_name (argv[0]));
4074 LTWRAPPER_DEBUGPRINTF (("(main) argv[0] : %s\n", argv[0]));
4075 LTWRAPPER_DEBUGPRINTF (("(main) program_name : %s\n", program_name));
4076
4077 /* very simple arg parsing; don't want to rely on getopt */
4078 for (i = 1; i < argc; i++)
4079 {
4080 if (strcmp (argv[i], dumpscript_opt) == 0)
4081 {
4082EOF
4083 case "$host" in
4084 *mingw* | *cygwin* )
4085 # make stdout use "unix" line endings
4086 echo " setmode(1,_O_BINARY);"
4087 ;;
4088 esac
4089
4090 cat <<"EOF"
cristy292e4352009-11-19 13:54:29 +00004091 lt_dump_script (stdout);
cristy3ed852e2009-09-05 21:47:34 +00004092 return 0;
4093 }
4094 }
4095
4096 newargz = XMALLOC (char *, argc + 1);
4097 tmp_pathspec = find_executable (argv[0]);
4098 if (tmp_pathspec == NULL)
4099 lt_fatal ("Couldn't find %s", argv[0]);
4100 LTWRAPPER_DEBUGPRINTF (("(main) found exe (before symlink chase) at : %s\n",
4101 tmp_pathspec));
4102
4103 actual_cwrapper_path = chase_symlinks (tmp_pathspec);
4104 LTWRAPPER_DEBUGPRINTF (("(main) found exe (after symlink chase) at : %s\n",
4105 actual_cwrapper_path));
4106 XFREE (tmp_pathspec);
4107
4108 actual_cwrapper_name = xstrdup( base_name (actual_cwrapper_path));
4109 strendzap (actual_cwrapper_path, actual_cwrapper_name);
4110
4111 /* wrapper name transforms */
4112 strendzap (actual_cwrapper_name, ".exe");
4113 tmp_pathspec = lt_extend_str (actual_cwrapper_name, ".exe", 1);
4114 XFREE (actual_cwrapper_name);
4115 actual_cwrapper_name = tmp_pathspec;
4116 tmp_pathspec = 0;
4117
4118 /* target_name transforms -- use actual target program name; might have lt- prefix */
4119 target_name = xstrdup (base_name (TARGET_PROGRAM_NAME));
4120 strendzap (target_name, ".exe");
4121 tmp_pathspec = lt_extend_str (target_name, ".exe", 1);
4122 XFREE (target_name);
4123 target_name = tmp_pathspec;
4124 tmp_pathspec = 0;
4125
4126 LTWRAPPER_DEBUGPRINTF (("(main) libtool target name: %s\n",
4127 target_name));
4128EOF
4129
4130 cat <<EOF
4131 newargz[0] =
4132 XMALLOC (char, (strlen (actual_cwrapper_path) +
4133 strlen ("$objdir") + 1 + strlen (actual_cwrapper_name) + 1));
4134 strcpy (newargz[0], actual_cwrapper_path);
4135 strcat (newargz[0], "$objdir");
4136 strcat (newargz[0], "/");
4137EOF
4138
4139 cat <<"EOF"
4140 /* stop here, and copy so we don't have to do this twice */
4141 tmp_pathspec = xstrdup (newargz[0]);
4142
4143 /* do NOT want the lt- prefix here, so use actual_cwrapper_name */
4144 strcat (newargz[0], actual_cwrapper_name);
4145
4146 /* DO want the lt- prefix here if it exists, so use target_name */
4147 lt_argv_zero = lt_extend_str (tmp_pathspec, target_name, 1);
4148 XFREE (tmp_pathspec);
4149 tmp_pathspec = NULL;
4150EOF
4151
4152 case $host_os in
4153 mingw*)
4154 cat <<"EOF"
4155 {
4156 char* p;
4157 while ((p = strchr (newargz[0], '\\')) != NULL)
4158 {
4159 *p = '/';
4160 }
4161 while ((p = strchr (lt_argv_zero, '\\')) != NULL)
4162 {
4163 *p = '/';
4164 }
4165 }
4166EOF
4167 ;;
4168 esac
4169
4170 cat <<"EOF"
4171 XFREE (target_name);
4172 XFREE (actual_cwrapper_path);
4173 XFREE (actual_cwrapper_name);
4174
4175 lt_setenv ("BIN_SH", "xpg4"); /* for Tru64 */
4176 lt_setenv ("DUALCASE", "1"); /* for MSK sh */
4177 lt_update_lib_path (LIB_PATH_VARNAME, LIB_PATH_VALUE);
4178 lt_update_exe_path (EXE_PATH_VARNAME, EXE_PATH_VALUE);
4179
4180 newargc=0;
4181 for (i = 1; i < argc; i++)
4182 {
cristy3ed852e2009-09-05 21:47:34 +00004183 if (strncmp (argv[i], ltwrapper_option_prefix, opt_prefix_len) == 0)
4184 {
4185 /* however, if there is an option in the LTWRAPPER_OPTION_PREFIX
4186 namespace, but it is not one of the ones we know about and
4187 have already dealt with, above (inluding dump-script), then
4188 report an error. Otherwise, targets might begin to believe
4189 they are allowed to use options in the LTWRAPPER_OPTION_PREFIX
4190 namespace. The first time any user complains about this, we'll
4191 need to make LTWRAPPER_OPTION_PREFIX a configure-time option
4192 or a configure.ac-settable value.
4193 */
4194 lt_fatal ("Unrecognized option in %s namespace: '%s'",
4195 ltwrapper_option_prefix, argv[i]);
4196 }
4197 /* otherwise ... */
4198 newargz[++newargc] = xstrdup (argv[i]);
4199 }
4200 newargz[++newargc] = NULL;
4201
4202 LTWRAPPER_DEBUGPRINTF (("(main) lt_argv_zero : %s\n", (lt_argv_zero ? lt_argv_zero : "<NULL>")));
4203 for (i = 0; i < newargc; i++)
4204 {
4205 LTWRAPPER_DEBUGPRINTF (("(main) newargz[%d] : %s\n", i, (newargz[i] ? newargz[i] : "<NULL>")));
4206 }
4207
4208EOF
4209
4210 case $host_os in
4211 mingw*)
4212 cat <<"EOF"
4213 /* execv doesn't actually work on mingw as expected on unix */
cristy292e4352009-11-19 13:54:29 +00004214 newargz = prepare_spawn (newargz);
cristy3ed852e2009-09-05 21:47:34 +00004215 rval = _spawnv (_P_WAIT, lt_argv_zero, (const char * const *) newargz);
4216 if (rval == -1)
4217 {
4218 /* failed to start process */
4219 LTWRAPPER_DEBUGPRINTF (("(main) failed to launch target \"%s\": errno = %d\n", lt_argv_zero, errno));
4220 return 127;
4221 }
4222 return rval;
4223EOF
4224 ;;
4225 *)
4226 cat <<"EOF"
4227 execv (lt_argv_zero, newargz);
4228 return rval; /* =127, but avoids unused variable warning */
4229EOF
4230 ;;
4231 esac
4232
4233 cat <<"EOF"
4234}
4235
4236void *
4237xmalloc (size_t num)
4238{
4239 void *p = (void *) malloc (num);
4240 if (!p)
4241 lt_fatal ("Memory exhausted");
4242
4243 return p;
4244}
4245
4246char *
4247xstrdup (const char *string)
4248{
4249 return string ? strcpy ((char *) xmalloc (strlen (string) + 1),
4250 string) : NULL;
4251}
4252
4253const char *
4254base_name (const char *name)
4255{
4256 const char *base;
4257
4258#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
4259 /* Skip over the disk name in MSDOS pathnames. */
4260 if (isalpha ((unsigned char) name[0]) && name[1] == ':')
4261 name += 2;
4262#endif
4263
4264 for (base = name; *name; name++)
4265 if (IS_DIR_SEPARATOR (*name))
4266 base = name + 1;
4267 return base;
4268}
4269
4270int
4271check_executable (const char *path)
4272{
4273 struct stat st;
4274
4275 LTWRAPPER_DEBUGPRINTF (("(check_executable) : %s\n",
4276 path ? (*path ? path : "EMPTY!") : "NULL!"));
4277 if ((!path) || (!*path))
4278 return 0;
4279
4280 if ((stat (path, &st) >= 0)
4281 && (st.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH)))
4282 return 1;
4283 else
4284 return 0;
4285}
4286
4287int
4288make_executable (const char *path)
4289{
4290 int rval = 0;
4291 struct stat st;
4292
4293 LTWRAPPER_DEBUGPRINTF (("(make_executable) : %s\n",
4294 path ? (*path ? path : "EMPTY!") : "NULL!"));
4295 if ((!path) || (!*path))
4296 return 0;
4297
4298 if (stat (path, &st) >= 0)
4299 {
4300 rval = chmod (path, st.st_mode | S_IXOTH | S_IXGRP | S_IXUSR);
4301 }
4302 return rval;
4303}
4304
4305/* Searches for the full path of the wrapper. Returns
4306 newly allocated full path name if found, NULL otherwise
4307 Does not chase symlinks, even on platforms that support them.
4308*/
4309char *
4310find_executable (const char *wrapper)
4311{
4312 int has_slash = 0;
4313 const char *p;
4314 const char *p_next;
4315 /* static buffer for getcwd */
4316 char tmp[LT_PATHMAX + 1];
4317 int tmp_len;
4318 char *concat_name;
4319
4320 LTWRAPPER_DEBUGPRINTF (("(find_executable) : %s\n",
4321 wrapper ? (*wrapper ? wrapper : "EMPTY!") : "NULL!"));
4322
4323 if ((wrapper == NULL) || (*wrapper == '\0'))
4324 return NULL;
4325
4326 /* Absolute path? */
4327#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
4328 if (isalpha ((unsigned char) wrapper[0]) && wrapper[1] == ':')
4329 {
4330 concat_name = xstrdup (wrapper);
4331 if (check_executable (concat_name))
4332 return concat_name;
4333 XFREE (concat_name);
4334 }
4335 else
4336 {
4337#endif
4338 if (IS_DIR_SEPARATOR (wrapper[0]))
4339 {
4340 concat_name = xstrdup (wrapper);
4341 if (check_executable (concat_name))
4342 return concat_name;
4343 XFREE (concat_name);
4344 }
4345#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
4346 }
4347#endif
4348
4349 for (p = wrapper; *p; p++)
4350 if (*p == '/')
4351 {
4352 has_slash = 1;
4353 break;
4354 }
4355 if (!has_slash)
4356 {
4357 /* no slashes; search PATH */
4358 const char *path = getenv ("PATH");
4359 if (path != NULL)
4360 {
4361 for (p = path; *p; p = p_next)
4362 {
4363 const char *q;
4364 size_t p_len;
4365 for (q = p; *q; q++)
4366 if (IS_PATH_SEPARATOR (*q))
4367 break;
4368 p_len = q - p;
4369 p_next = (*q == '\0' ? q : q + 1);
4370 if (p_len == 0)
4371 {
4372 /* empty path: current directory */
4373 if (getcwd (tmp, LT_PATHMAX) == NULL)
4374 lt_fatal ("getcwd failed");
4375 tmp_len = strlen (tmp);
4376 concat_name =
4377 XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1);
4378 memcpy (concat_name, tmp, tmp_len);
4379 concat_name[tmp_len] = '/';
4380 strcpy (concat_name + tmp_len + 1, wrapper);
4381 }
4382 else
4383 {
4384 concat_name =
4385 XMALLOC (char, p_len + 1 + strlen (wrapper) + 1);
4386 memcpy (concat_name, p, p_len);
4387 concat_name[p_len] = '/';
4388 strcpy (concat_name + p_len + 1, wrapper);
4389 }
4390 if (check_executable (concat_name))
4391 return concat_name;
4392 XFREE (concat_name);
4393 }
4394 }
4395 /* not found in PATH; assume curdir */
4396 }
4397 /* Relative path | not found in path: prepend cwd */
4398 if (getcwd (tmp, LT_PATHMAX) == NULL)
4399 lt_fatal ("getcwd failed");
4400 tmp_len = strlen (tmp);
4401 concat_name = XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1);
4402 memcpy (concat_name, tmp, tmp_len);
4403 concat_name[tmp_len] = '/';
4404 strcpy (concat_name + tmp_len + 1, wrapper);
4405
4406 if (check_executable (concat_name))
4407 return concat_name;
4408 XFREE (concat_name);
4409 return NULL;
4410}
4411
4412char *
4413chase_symlinks (const char *pathspec)
4414{
4415#ifndef S_ISLNK
4416 return xstrdup (pathspec);
4417#else
4418 char buf[LT_PATHMAX];
4419 struct stat s;
4420 char *tmp_pathspec = xstrdup (pathspec);
4421 char *p;
4422 int has_symlinks = 0;
4423 while (strlen (tmp_pathspec) && !has_symlinks)
4424 {
4425 LTWRAPPER_DEBUGPRINTF (("checking path component for symlinks: %s\n",
4426 tmp_pathspec));
4427 if (lstat (tmp_pathspec, &s) == 0)
4428 {
4429 if (S_ISLNK (s.st_mode) != 0)
4430 {
4431 has_symlinks = 1;
4432 break;
4433 }
4434
4435 /* search backwards for last DIR_SEPARATOR */
4436 p = tmp_pathspec + strlen (tmp_pathspec) - 1;
4437 while ((p > tmp_pathspec) && (!IS_DIR_SEPARATOR (*p)))
4438 p--;
4439 if ((p == tmp_pathspec) && (!IS_DIR_SEPARATOR (*p)))
4440 {
4441 /* no more DIR_SEPARATORS left */
4442 break;
4443 }
4444 *p = '\0';
4445 }
4446 else
4447 {
4448 char *errstr = strerror (errno);
4449 lt_fatal ("Error accessing file %s (%s)", tmp_pathspec, errstr);
4450 }
4451 }
4452 XFREE (tmp_pathspec);
4453
4454 if (!has_symlinks)
4455 {
4456 return xstrdup (pathspec);
4457 }
4458
4459 tmp_pathspec = realpath (pathspec, buf);
4460 if (tmp_pathspec == 0)
4461 {
4462 lt_fatal ("Could not follow symlinks for %s", pathspec);
4463 }
4464 return xstrdup (tmp_pathspec);
4465#endif
4466}
4467
4468char *
4469strendzap (char *str, const char *pat)
4470{
4471 size_t len, patlen;
4472
4473 assert (str != NULL);
4474 assert (pat != NULL);
4475
4476 len = strlen (str);
4477 patlen = strlen (pat);
4478
4479 if (patlen <= len)
4480 {
4481 str += len - patlen;
4482 if (strcmp (str, pat) == 0)
4483 *str = '\0';
4484 }
4485 return str;
4486}
4487
4488static void
4489lt_error_core (int exit_status, const char *mode,
4490 const char *message, va_list ap)
4491{
4492 fprintf (stderr, "%s: %s: ", program_name, mode);
4493 vfprintf (stderr, message, ap);
4494 fprintf (stderr, ".\n");
4495
4496 if (exit_status >= 0)
4497 exit (exit_status);
4498}
4499
4500void
4501lt_fatal (const char *message, ...)
4502{
4503 va_list ap;
4504 va_start (ap, message);
4505 lt_error_core (EXIT_FAILURE, "FATAL", message, ap);
4506 va_end (ap);
4507}
4508
4509void
4510lt_setenv (const char *name, const char *value)
4511{
4512 LTWRAPPER_DEBUGPRINTF (("(lt_setenv) setting '%s' to '%s'\n",
4513 (name ? name : "<NULL>"),
4514 (value ? value : "<NULL>")));
4515 {
4516#ifdef HAVE_SETENV
4517 /* always make a copy, for consistency with !HAVE_SETENV */
4518 char *str = xstrdup (value);
4519 setenv (name, str, 1);
4520#else
4521 int len = strlen (name) + 1 + strlen (value) + 1;
4522 char *str = XMALLOC (char, len);
4523 sprintf (str, "%s=%s", name, value);
4524 if (putenv (str) != EXIT_SUCCESS)
4525 {
4526 XFREE (str);
4527 }
4528#endif
4529 }
4530}
4531
4532char *
4533lt_extend_str (const char *orig_value, const char *add, int to_end)
4534{
4535 char *new_value;
4536 if (orig_value && *orig_value)
4537 {
4538 int orig_value_len = strlen (orig_value);
4539 int add_len = strlen (add);
4540 new_value = XMALLOC (char, add_len + orig_value_len + 1);
4541 if (to_end)
4542 {
4543 strcpy (new_value, orig_value);
4544 strcpy (new_value + orig_value_len, add);
4545 }
4546 else
4547 {
4548 strcpy (new_value, add);
4549 strcpy (new_value + add_len, orig_value);
4550 }
4551 }
4552 else
4553 {
4554 new_value = xstrdup (add);
4555 }
4556 return new_value;
4557}
4558
cristy3ed852e2009-09-05 21:47:34 +00004559void
4560lt_update_exe_path (const char *name, const char *value)
4561{
4562 LTWRAPPER_DEBUGPRINTF (("(lt_update_exe_path) modifying '%s' by prepending '%s'\n",
4563 (name ? name : "<NULL>"),
4564 (value ? value : "<NULL>")));
4565
4566 if (name && *name && value && *value)
4567 {
4568 char *new_value = lt_extend_str (getenv (name), value, 0);
4569 /* some systems can't cope with a ':'-terminated path #' */
4570 int len = strlen (new_value);
4571 while (((len = strlen (new_value)) > 0) && IS_PATH_SEPARATOR (new_value[len-1]))
4572 {
4573 new_value[len-1] = '\0';
4574 }
4575 lt_setenv (name, new_value);
4576 XFREE (new_value);
4577 }
4578}
4579
4580void
4581lt_update_lib_path (const char *name, const char *value)
4582{
4583 LTWRAPPER_DEBUGPRINTF (("(lt_update_lib_path) modifying '%s' by prepending '%s'\n",
4584 (name ? name : "<NULL>"),
4585 (value ? value : "<NULL>")));
4586
4587 if (name && *name && value && *value)
4588 {
4589 char *new_value = lt_extend_str (getenv (name), value, 0);
4590 lt_setenv (name, new_value);
4591 XFREE (new_value);
4592 }
4593}
4594
cristy292e4352009-11-19 13:54:29 +00004595EOF
4596 case $host_os in
4597 mingw*)
4598 cat <<"EOF"
cristy3ed852e2009-09-05 21:47:34 +00004599
cristy292e4352009-11-19 13:54:29 +00004600/* Prepares an argument vector before calling spawn().
4601 Note that spawn() does not by itself call the command interpreter
4602 (getenv ("COMSPEC") != NULL ? getenv ("COMSPEC") :
4603 ({ OSVERSIONINFO v; v.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
4604 GetVersionEx(&v);
4605 v.dwPlatformId == VER_PLATFORM_WIN32_NT;
4606 }) ? "cmd.exe" : "command.com").
4607 Instead it simply concatenates the arguments, separated by ' ', and calls
4608 CreateProcess(). We must quote the arguments since Win32 CreateProcess()
4609 interprets characters like ' ', '\t', '\\', '"' (but not '<' and '>') in a
4610 special way:
4611 - Space and tab are interpreted as delimiters. They are not treated as
4612 delimiters if they are surrounded by double quotes: "...".
4613 - Unescaped double quotes are removed from the input. Their only effect is
4614 that within double quotes, space and tab are treated like normal
4615 characters.
4616 - Backslashes not followed by double quotes are not special.
4617 - But 2*n+1 backslashes followed by a double quote become
4618 n backslashes followed by a double quote (n >= 0):
4619 \" -> "
4620 \\\" -> \"
4621 \\\\\" -> \\"
4622 */
4623#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"
4624#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"
4625char **
4626prepare_spawn (char **argv)
4627{
4628 size_t argc;
4629 char **new_argv;
4630 size_t i;
4631
4632 /* Count number of arguments. */
4633 for (argc = 0; argv[argc] != NULL; argc++)
4634 ;
4635
4636 /* Allocate new argument vector. */
4637 new_argv = XMALLOC (char *, argc + 1);
4638
4639 /* Put quoted arguments into the new argument vector. */
4640 for (i = 0; i < argc; i++)
4641 {
4642 const char *string = argv[i];
4643
4644 if (string[0] == '\0')
4645 new_argv[i] = xstrdup ("\"\"");
4646 else if (strpbrk (string, SHELL_SPECIAL_CHARS) != NULL)
4647 {
4648 int quote_around = (strpbrk (string, SHELL_SPACE_CHARS) != NULL);
4649 size_t length;
4650 unsigned int backslashes;
4651 const char *s;
4652 char *quoted_string;
4653 char *p;
4654
4655 length = 0;
4656 backslashes = 0;
4657 if (quote_around)
4658 length++;
4659 for (s = string; *s != '\0'; s++)
4660 {
4661 char c = *s;
4662 if (c == '"')
4663 length += backslashes + 1;
4664 length++;
4665 if (c == '\\')
4666 backslashes++;
4667 else
4668 backslashes = 0;
4669 }
4670 if (quote_around)
4671 length += backslashes + 1;
4672
4673 quoted_string = XMALLOC (char, length + 1);
4674
4675 p = quoted_string;
4676 backslashes = 0;
4677 if (quote_around)
4678 *p++ = '"';
4679 for (s = string; *s != '\0'; s++)
4680 {
4681 char c = *s;
4682 if (c == '"')
4683 {
4684 unsigned int j;
4685 for (j = backslashes + 1; j > 0; j--)
4686 *p++ = '\\';
4687 }
4688 *p++ = c;
4689 if (c == '\\')
4690 backslashes++;
4691 else
4692 backslashes = 0;
4693 }
4694 if (quote_around)
4695 {
4696 unsigned int j;
4697 for (j = backslashes; j > 0; j--)
4698 *p++ = '\\';
4699 *p++ = '"';
4700 }
4701 *p = '\0';
4702
4703 new_argv[i] = quoted_string;
4704 }
4705 else
4706 new_argv[i] = (char *) string;
4707 }
4708 new_argv[argc] = NULL;
4709
4710 return new_argv;
4711}
4712EOF
4713 ;;
4714 esac
4715
4716 cat <<"EOF"
4717void lt_dump_script (FILE* f)
4718{
4719EOF
4720 func_emit_wrapper yes |
4721 $SED -e 's/\([\\"]\)/\\\1/g' \
4722 -e 's/^/ fputs ("/' -e 's/$/\\n", f);/'
4723
4724 cat <<"EOF"
4725}
cristy3ed852e2009-09-05 21:47:34 +00004726EOF
4727}
4728# end: func_emit_cwrapperexe_src
4729
cristy292e4352009-11-19 13:54:29 +00004730# func_win32_import_lib_p ARG
4731# True if ARG is an import lib, as indicated by $file_magic_cmd
4732func_win32_import_lib_p ()
4733{
4734 $opt_debug
4735 case `eval $file_magic_cmd \"\$1\" 2>/dev/null | $SED -e 10q` in
4736 *import*) : ;;
4737 *) false ;;
4738 esac
4739}
4740
cristy3ed852e2009-09-05 21:47:34 +00004741# func_mode_link arg...
4742func_mode_link ()
4743{
4744 $opt_debug
4745 case $host in
4746 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
4747 # It is impossible to link a dll without this setting, and
4748 # we shouldn't force the makefile maintainer to figure out
4749 # which system we are compiling for in order to pass an extra
4750 # flag for every libtool invocation.
4751 # allow_undefined=no
4752
4753 # FIXME: Unfortunately, there are problems with the above when trying
4754 # to make a dll which has undefined symbols, in which case not
4755 # even a static library is built. For now, we need to specify
4756 # -no-undefined on the libtool link line when we can be certain
4757 # that all symbols are satisfied, otherwise we get a static library.
4758 allow_undefined=yes
4759 ;;
4760 *)
4761 allow_undefined=yes
4762 ;;
4763 esac
4764 libtool_args=$nonopt
4765 base_compile="$nonopt $@"
4766 compile_command=$nonopt
4767 finalize_command=$nonopt
4768
4769 compile_rpath=
4770 finalize_rpath=
4771 compile_shlibpath=
4772 finalize_shlibpath=
4773 convenience=
4774 old_convenience=
4775 deplibs=
4776 old_deplibs=
4777 compiler_flags=
4778 linker_flags=
4779 dllsearchpath=
4780 lib_search_path=`pwd`
4781 inst_prefix_dir=
4782 new_inherited_linker_flags=
4783
4784 avoid_version=no
cristy292e4352009-11-19 13:54:29 +00004785 bindir=
cristy3ed852e2009-09-05 21:47:34 +00004786 dlfiles=
4787 dlprefiles=
4788 dlself=no
4789 export_dynamic=no
4790 export_symbols=
4791 export_symbols_regex=
4792 generated=
4793 libobjs=
4794 ltlibs=
4795 module=no
4796 no_install=no
4797 objs=
4798 non_pic_objects=
4799 precious_files_regex=
4800 prefer_static_libs=no
4801 preload=no
4802 prev=
4803 prevarg=
4804 release=
4805 rpath=
4806 xrpath=
4807 perm_rpath=
4808 temp_rpath=
4809 thread_safe=no
4810 vinfo=
4811 vinfo_number=no
4812 weak_libs=
4813 single_module="${wl}-single_module"
4814 func_infer_tag $base_compile
4815
4816 # We need to know -static, to get the right output filenames.
4817 for arg
4818 do
4819 case $arg in
4820 -shared)
4821 test "$build_libtool_libs" != yes && \
4822 func_fatal_configuration "can not build a shared library"
4823 build_old_libs=no
4824 break
4825 ;;
4826 -all-static | -static | -static-libtool-libs)
4827 case $arg in
4828 -all-static)
4829 if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then
4830 func_warning "complete static linking is impossible in this configuration"
4831 fi
4832 if test -n "$link_static_flag"; then
4833 dlopen_self=$dlopen_self_static
4834 fi
4835 prefer_static_libs=yes
4836 ;;
4837 -static)
4838 if test -z "$pic_flag" && test -n "$link_static_flag"; then
4839 dlopen_self=$dlopen_self_static
4840 fi
4841 prefer_static_libs=built
4842 ;;
4843 -static-libtool-libs)
4844 if test -z "$pic_flag" && test -n "$link_static_flag"; then
4845 dlopen_self=$dlopen_self_static
4846 fi
4847 prefer_static_libs=yes
4848 ;;
4849 esac
4850 build_libtool_libs=no
4851 build_old_libs=yes
4852 break
4853 ;;
4854 esac
4855 done
4856
4857 # See if our shared archives depend on static archives.
4858 test -n "$old_archive_from_new_cmds" && build_old_libs=yes
4859
4860 # Go through the arguments, transforming them on the way.
4861 while test "$#" -gt 0; do
4862 arg="$1"
4863 shift
4864 func_quote_for_eval "$arg"
4865 qarg=$func_quote_for_eval_unquoted_result
4866 func_append libtool_args " $func_quote_for_eval_result"
4867
4868 # If the previous option needs an argument, assign it.
4869 if test -n "$prev"; then
4870 case $prev in
4871 output)
4872 func_append compile_command " @OUTPUT@"
4873 func_append finalize_command " @OUTPUT@"
4874 ;;
4875 esac
4876
4877 case $prev in
cristy292e4352009-11-19 13:54:29 +00004878 bindir)
4879 bindir="$arg"
4880 prev=
4881 continue
4882 ;;
cristy3ed852e2009-09-05 21:47:34 +00004883 dlfiles|dlprefiles)
4884 if test "$preload" = no; then
4885 # Add the symbol object into the linking commands.
4886 func_append compile_command " @SYMFILE@"
4887 func_append finalize_command " @SYMFILE@"
4888 preload=yes
4889 fi
4890 case $arg in
4891 *.la | *.lo) ;; # We handle these cases below.
4892 force)
4893 if test "$dlself" = no; then
4894 dlself=needless
4895 export_dynamic=yes
4896 fi
4897 prev=
4898 continue
4899 ;;
4900 self)
4901 if test "$prev" = dlprefiles; then
4902 dlself=yes
4903 elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then
4904 dlself=yes
4905 else
4906 dlself=needless
4907 export_dynamic=yes
4908 fi
4909 prev=
4910 continue
4911 ;;
4912 *)
4913 if test "$prev" = dlfiles; then
4914 dlfiles="$dlfiles $arg"
4915 else
4916 dlprefiles="$dlprefiles $arg"
4917 fi
4918 prev=
4919 continue
4920 ;;
4921 esac
4922 ;;
4923 expsyms)
4924 export_symbols="$arg"
4925 test -f "$arg" \
4926 || func_fatal_error "symbol file \`$arg' does not exist"
4927 prev=
4928 continue
4929 ;;
4930 expsyms_regex)
4931 export_symbols_regex="$arg"
4932 prev=
4933 continue
4934 ;;
4935 framework)
4936 case $host in
4937 *-*-darwin*)
4938 case "$deplibs " in
4939 *" $qarg.ltframework "*) ;;
4940 *) deplibs="$deplibs $qarg.ltframework" # this is fixed later
4941 ;;
4942 esac
4943 ;;
4944 esac
4945 prev=
4946 continue
4947 ;;
4948 inst_prefix)
4949 inst_prefix_dir="$arg"
4950 prev=
4951 continue
4952 ;;
4953 objectlist)
4954 if test -f "$arg"; then
4955 save_arg=$arg
4956 moreargs=
4957 for fil in `cat "$save_arg"`
4958 do
4959# moreargs="$moreargs $fil"
4960 arg=$fil
4961 # A libtool-controlled object.
4962
4963 # Check to see that this really is a libtool object.
4964 if func_lalib_unsafe_p "$arg"; then
4965 pic_object=
4966 non_pic_object=
4967
4968 # Read the .lo file
4969 func_source "$arg"
4970
4971 if test -z "$pic_object" ||
4972 test -z "$non_pic_object" ||
4973 test "$pic_object" = none &&
4974 test "$non_pic_object" = none; then
4975 func_fatal_error "cannot find name of object for \`$arg'"
4976 fi
4977
4978 # Extract subdirectory from the argument.
4979 func_dirname "$arg" "/" ""
4980 xdir="$func_dirname_result"
4981
4982 if test "$pic_object" != none; then
4983 # Prepend the subdirectory the object is found in.
4984 pic_object="$xdir$pic_object"
4985
4986 if test "$prev" = dlfiles; then
4987 if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
4988 dlfiles="$dlfiles $pic_object"
4989 prev=
4990 continue
4991 else
4992 # If libtool objects are unsupported, then we need to preload.
4993 prev=dlprefiles
4994 fi
4995 fi
4996
4997 # CHECK ME: I think I busted this. -Ossama
4998 if test "$prev" = dlprefiles; then
4999 # Preload the old-style object.
5000 dlprefiles="$dlprefiles $pic_object"
5001 prev=
5002 fi
5003
5004 # A PIC object.
5005 func_append libobjs " $pic_object"
5006 arg="$pic_object"
5007 fi
5008
5009 # Non-PIC object.
5010 if test "$non_pic_object" != none; then
5011 # Prepend the subdirectory the object is found in.
5012 non_pic_object="$xdir$non_pic_object"
5013
5014 # A standard non-PIC object
5015 func_append non_pic_objects " $non_pic_object"
5016 if test -z "$pic_object" || test "$pic_object" = none ; then
5017 arg="$non_pic_object"
5018 fi
5019 else
5020 # If the PIC object exists, use it instead.
5021 # $xdir was prepended to $pic_object above.
5022 non_pic_object="$pic_object"
5023 func_append non_pic_objects " $non_pic_object"
5024 fi
5025 else
5026 # Only an error if not doing a dry-run.
5027 if $opt_dry_run; then
5028 # Extract subdirectory from the argument.
5029 func_dirname "$arg" "/" ""
5030 xdir="$func_dirname_result"
5031
5032 func_lo2o "$arg"
5033 pic_object=$xdir$objdir/$func_lo2o_result
5034 non_pic_object=$xdir$func_lo2o_result
5035 func_append libobjs " $pic_object"
5036 func_append non_pic_objects " $non_pic_object"
5037 else
5038 func_fatal_error "\`$arg' is not a valid libtool object"
5039 fi
5040 fi
5041 done
5042 else
5043 func_fatal_error "link input file \`$arg' does not exist"
5044 fi
5045 arg=$save_arg
5046 prev=
5047 continue
5048 ;;
5049 precious_regex)
5050 precious_files_regex="$arg"
5051 prev=
5052 continue
5053 ;;
5054 release)
5055 release="-$arg"
5056 prev=
5057 continue
5058 ;;
5059 rpath | xrpath)
5060 # We need an absolute path.
5061 case $arg in
5062 [\\/]* | [A-Za-z]:[\\/]*) ;;
5063 *)
5064 func_fatal_error "only absolute run-paths are allowed"
5065 ;;
5066 esac
5067 if test "$prev" = rpath; then
5068 case "$rpath " in
5069 *" $arg "*) ;;
5070 *) rpath="$rpath $arg" ;;
5071 esac
5072 else
5073 case "$xrpath " in
5074 *" $arg "*) ;;
5075 *) xrpath="$xrpath $arg" ;;
5076 esac
5077 fi
5078 prev=
5079 continue
5080 ;;
5081 shrext)
5082 shrext_cmds="$arg"
5083 prev=
5084 continue
5085 ;;
5086 weak)
5087 weak_libs="$weak_libs $arg"
5088 prev=
5089 continue
5090 ;;
5091 xcclinker)
5092 linker_flags="$linker_flags $qarg"
5093 compiler_flags="$compiler_flags $qarg"
5094 prev=
5095 func_append compile_command " $qarg"
5096 func_append finalize_command " $qarg"
5097 continue
5098 ;;
5099 xcompiler)
5100 compiler_flags="$compiler_flags $qarg"
5101 prev=
5102 func_append compile_command " $qarg"
5103 func_append finalize_command " $qarg"
5104 continue
5105 ;;
5106 xlinker)
5107 linker_flags="$linker_flags $qarg"
5108 compiler_flags="$compiler_flags $wl$qarg"
5109 prev=
5110 func_append compile_command " $wl$qarg"
5111 func_append finalize_command " $wl$qarg"
5112 continue
5113 ;;
5114 *)
5115 eval "$prev=\"\$arg\""
5116 prev=
5117 continue
5118 ;;
5119 esac
5120 fi # test -n "$prev"
5121
5122 prevarg="$arg"
5123
5124 case $arg in
5125 -all-static)
5126 if test -n "$link_static_flag"; then
5127 # See comment for -static flag below, for more details.
5128 func_append compile_command " $link_static_flag"
5129 func_append finalize_command " $link_static_flag"
5130 fi
5131 continue
5132 ;;
5133
5134 -allow-undefined)
5135 # FIXME: remove this flag sometime in the future.
5136 func_fatal_error "\`-allow-undefined' must not be used because it is the default"
5137 ;;
5138
5139 -avoid-version)
5140 avoid_version=yes
5141 continue
5142 ;;
5143
cristy292e4352009-11-19 13:54:29 +00005144 -bindir)
5145 prev=bindir
5146 continue
5147 ;;
5148
cristy3ed852e2009-09-05 21:47:34 +00005149 -dlopen)
5150 prev=dlfiles
5151 continue
5152 ;;
5153
5154 -dlpreopen)
5155 prev=dlprefiles
5156 continue
5157 ;;
5158
5159 -export-dynamic)
5160 export_dynamic=yes
5161 continue
5162 ;;
5163
5164 -export-symbols | -export-symbols-regex)
5165 if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
5166 func_fatal_error "more than one -exported-symbols argument is not allowed"
5167 fi
5168 if test "X$arg" = "X-export-symbols"; then
5169 prev=expsyms
5170 else
5171 prev=expsyms_regex
5172 fi
5173 continue
5174 ;;
5175
5176 -framework)
5177 prev=framework
5178 continue
5179 ;;
5180
5181 -inst-prefix-dir)
5182 prev=inst_prefix
5183 continue
5184 ;;
5185
5186 # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:*
5187 # so, if we see these flags be careful not to treat them like -L
5188 -L[A-Z][A-Z]*:*)
5189 case $with_gcc/$host in
5190 no/*-*-irix* | /*-*-irix*)
5191 func_append compile_command " $arg"
5192 func_append finalize_command " $arg"
5193 ;;
5194 esac
5195 continue
5196 ;;
5197
5198 -L*)
5199 func_stripname '-L' '' "$arg"
5200 dir=$func_stripname_result
5201 if test -z "$dir"; then
5202 if test "$#" -gt 0; then
5203 func_fatal_error "require no space between \`-L' and \`$1'"
5204 else
5205 func_fatal_error "need path for \`-L' option"
5206 fi
5207 fi
5208 # We need an absolute path.
5209 case $dir in
5210 [\\/]* | [A-Za-z]:[\\/]*) ;;
5211 *)
5212 absdir=`cd "$dir" && pwd`
5213 test -z "$absdir" && \
5214 func_fatal_error "cannot determine absolute directory name of \`$dir'"
5215 dir="$absdir"
5216 ;;
5217 esac
5218 case "$deplibs " in
5219 *" -L$dir "*) ;;
5220 *)
5221 deplibs="$deplibs -L$dir"
5222 lib_search_path="$lib_search_path $dir"
5223 ;;
5224 esac
5225 case $host in
5226 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
cristy292e4352009-11-19 13:54:29 +00005227 testbindir=`$ECHO "$dir" | $SED 's*/lib$*/bin*'`
cristy3ed852e2009-09-05 21:47:34 +00005228 case :$dllsearchpath: in
5229 *":$dir:"*) ;;
5230 ::) dllsearchpath=$dir;;
5231 *) dllsearchpath="$dllsearchpath:$dir";;
5232 esac
5233 case :$dllsearchpath: in
5234 *":$testbindir:"*) ;;
5235 ::) dllsearchpath=$testbindir;;
5236 *) dllsearchpath="$dllsearchpath:$testbindir";;
5237 esac
5238 ;;
5239 esac
5240 continue
5241 ;;
5242
5243 -l*)
5244 if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then
5245 case $host in
cristy292e4352009-11-19 13:54:29 +00005246 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos* | *-cegcc* | *-*-haiku*)
cristy3ed852e2009-09-05 21:47:34 +00005247 # These systems don't actually have a C or math library (as such)
5248 continue
5249 ;;
5250 *-*-os2*)
5251 # These systems don't actually have a C library (as such)
5252 test "X$arg" = "X-lc" && continue
5253 ;;
5254 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
5255 # Do not include libc due to us having libc/libc_r.
5256 test "X$arg" = "X-lc" && continue
5257 ;;
5258 *-*-rhapsody* | *-*-darwin1.[012])
5259 # Rhapsody C and math libraries are in the System framework
5260 deplibs="$deplibs System.ltframework"
5261 continue
5262 ;;
5263 *-*-sco3.2v5* | *-*-sco5v6*)
5264 # Causes problems with __ctype
5265 test "X$arg" = "X-lc" && continue
5266 ;;
5267 *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
5268 # Compiler inserts libc in the correct place for threads to work
5269 test "X$arg" = "X-lc" && continue
5270 ;;
5271 esac
5272 elif test "X$arg" = "X-lc_r"; then
5273 case $host in
5274 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
5275 # Do not include libc_r directly, use -pthread flag.
5276 continue
5277 ;;
5278 esac
5279 fi
5280 deplibs="$deplibs $arg"
5281 continue
5282 ;;
5283
5284 -module)
5285 module=yes
5286 continue
5287 ;;
5288
5289 # Tru64 UNIX uses -model [arg] to determine the layout of C++
5290 # classes, name mangling, and exception handling.
5291 # Darwin uses the -arch flag to determine output architecture.
5292 -model|-arch|-isysroot)
5293 compiler_flags="$compiler_flags $arg"
5294 func_append compile_command " $arg"
5295 func_append finalize_command " $arg"
5296 prev=xcompiler
5297 continue
5298 ;;
5299
5300 -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads)
5301 compiler_flags="$compiler_flags $arg"
5302 func_append compile_command " $arg"
5303 func_append finalize_command " $arg"
5304 case "$new_inherited_linker_flags " in
5305 *" $arg "*) ;;
5306 * ) new_inherited_linker_flags="$new_inherited_linker_flags $arg" ;;
5307 esac
5308 continue
5309 ;;
5310
5311 -multi_module)
5312 single_module="${wl}-multi_module"
5313 continue
5314 ;;
5315
5316 -no-fast-install)
5317 fast_install=no
5318 continue
5319 ;;
5320
5321 -no-install)
5322 case $host in
5323 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin* | *-cegcc*)
5324 # The PATH hackery in wrapper scripts is required on Windows
5325 # and Darwin in order for the loader to find any dlls it needs.
5326 func_warning "\`-no-install' is ignored for $host"
5327 func_warning "assuming \`-no-fast-install' instead"
5328 fast_install=no
5329 ;;
5330 *) no_install=yes ;;
5331 esac
5332 continue
5333 ;;
5334
5335 -no-undefined)
5336 allow_undefined=no
5337 continue
5338 ;;
5339
5340 -objectlist)
5341 prev=objectlist
5342 continue
5343 ;;
5344
5345 -o) prev=output ;;
5346
5347 -precious-files-regex)
5348 prev=precious_regex
5349 continue
5350 ;;
5351
5352 -release)
5353 prev=release
5354 continue
5355 ;;
5356
5357 -rpath)
5358 prev=rpath
5359 continue
5360 ;;
5361
5362 -R)
5363 prev=xrpath
5364 continue
5365 ;;
5366
5367 -R*)
5368 func_stripname '-R' '' "$arg"
5369 dir=$func_stripname_result
5370 # We need an absolute path.
5371 case $dir in
5372 [\\/]* | [A-Za-z]:[\\/]*) ;;
5373 *)
5374 func_fatal_error "only absolute run-paths are allowed"
5375 ;;
5376 esac
5377 case "$xrpath " in
5378 *" $dir "*) ;;
5379 *) xrpath="$xrpath $dir" ;;
5380 esac
5381 continue
5382 ;;
5383
5384 -shared)
5385 # The effects of -shared are defined in a previous loop.
5386 continue
5387 ;;
5388
5389 -shrext)
5390 prev=shrext
5391 continue
5392 ;;
5393
5394 -static | -static-libtool-libs)
5395 # The effects of -static are defined in a previous loop.
5396 # We used to do the same as -all-static on platforms that
5397 # didn't have a PIC flag, but the assumption that the effects
5398 # would be equivalent was wrong. It would break on at least
5399 # Digital Unix and AIX.
5400 continue
5401 ;;
5402
5403 -thread-safe)
5404 thread_safe=yes
5405 continue
5406 ;;
5407
5408 -version-info)
5409 prev=vinfo
5410 continue
5411 ;;
5412
5413 -version-number)
5414 prev=vinfo
5415 vinfo_number=yes
5416 continue
5417 ;;
5418
5419 -weak)
5420 prev=weak
5421 continue
5422 ;;
5423
5424 -Wc,*)
5425 func_stripname '-Wc,' '' "$arg"
5426 args=$func_stripname_result
5427 arg=
5428 save_ifs="$IFS"; IFS=','
5429 for flag in $args; do
5430 IFS="$save_ifs"
5431 func_quote_for_eval "$flag"
cristy292e4352009-11-19 13:54:29 +00005432 arg="$arg $func_quote_for_eval_result"
cristy3ed852e2009-09-05 21:47:34 +00005433 compiler_flags="$compiler_flags $func_quote_for_eval_result"
5434 done
5435 IFS="$save_ifs"
5436 func_stripname ' ' '' "$arg"
5437 arg=$func_stripname_result
5438 ;;
5439
5440 -Wl,*)
5441 func_stripname '-Wl,' '' "$arg"
5442 args=$func_stripname_result
5443 arg=
5444 save_ifs="$IFS"; IFS=','
5445 for flag in $args; do
5446 IFS="$save_ifs"
5447 func_quote_for_eval "$flag"
5448 arg="$arg $wl$func_quote_for_eval_result"
5449 compiler_flags="$compiler_flags $wl$func_quote_for_eval_result"
5450 linker_flags="$linker_flags $func_quote_for_eval_result"
5451 done
5452 IFS="$save_ifs"
5453 func_stripname ' ' '' "$arg"
5454 arg=$func_stripname_result
5455 ;;
5456
5457 -Xcompiler)
5458 prev=xcompiler
5459 continue
5460 ;;
5461
5462 -Xlinker)
5463 prev=xlinker
5464 continue
5465 ;;
5466
5467 -XCClinker)
5468 prev=xcclinker
5469 continue
5470 ;;
5471
5472 # -msg_* for osf cc
5473 -msg_*)
5474 func_quote_for_eval "$arg"
5475 arg="$func_quote_for_eval_result"
5476 ;;
5477
5478 # -64, -mips[0-9] enable 64-bit mode on the SGI compiler
5479 # -r[0-9][0-9]* specifies the processor on the SGI compiler
5480 # -xarch=*, -xtarget=* enable 64-bit mode on the Sun compiler
5481 # +DA*, +DD* enable 64-bit mode on the HP compiler
5482 # -q* pass through compiler args for the IBM compiler
5483 # -m*, -t[45]*, -txscale* pass through architecture-specific
5484 # compiler args for GCC
5485 # -F/path gives path to uninstalled frameworks, gcc on darwin
5486 # -p, -pg, --coverage, -fprofile-* pass through profiling flag for GCC
5487 # @file GCC response files
cristy292e4352009-11-19 13:54:29 +00005488 # -tp=* Portland pgcc target processor selection
cristy3ed852e2009-09-05 21:47:34 +00005489 -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \
cristy292e4352009-11-19 13:54:29 +00005490 -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*|-tp=*)
cristy3ed852e2009-09-05 21:47:34 +00005491 func_quote_for_eval "$arg"
5492 arg="$func_quote_for_eval_result"
5493 func_append compile_command " $arg"
5494 func_append finalize_command " $arg"
5495 compiler_flags="$compiler_flags $arg"
5496 continue
5497 ;;
5498
5499 # Some other compiler flag.
5500 -* | +*)
5501 func_quote_for_eval "$arg"
5502 arg="$func_quote_for_eval_result"
5503 ;;
5504
5505 *.$objext)
5506 # A standard object.
5507 objs="$objs $arg"
5508 ;;
5509
5510 *.lo)
5511 # A libtool-controlled object.
5512
5513 # Check to see that this really is a libtool object.
5514 if func_lalib_unsafe_p "$arg"; then
5515 pic_object=
5516 non_pic_object=
5517
5518 # Read the .lo file
5519 func_source "$arg"
5520
5521 if test -z "$pic_object" ||
5522 test -z "$non_pic_object" ||
5523 test "$pic_object" = none &&
5524 test "$non_pic_object" = none; then
5525 func_fatal_error "cannot find name of object for \`$arg'"
5526 fi
5527
5528 # Extract subdirectory from the argument.
5529 func_dirname "$arg" "/" ""
5530 xdir="$func_dirname_result"
5531
5532 if test "$pic_object" != none; then
5533 # Prepend the subdirectory the object is found in.
5534 pic_object="$xdir$pic_object"
5535
5536 if test "$prev" = dlfiles; then
5537 if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
5538 dlfiles="$dlfiles $pic_object"
5539 prev=
5540 continue
5541 else
5542 # If libtool objects are unsupported, then we need to preload.
5543 prev=dlprefiles
5544 fi
5545 fi
5546
5547 # CHECK ME: I think I busted this. -Ossama
5548 if test "$prev" = dlprefiles; then
5549 # Preload the old-style object.
5550 dlprefiles="$dlprefiles $pic_object"
5551 prev=
5552 fi
5553
5554 # A PIC object.
5555 func_append libobjs " $pic_object"
5556 arg="$pic_object"
5557 fi
5558
5559 # Non-PIC object.
5560 if test "$non_pic_object" != none; then
5561 # Prepend the subdirectory the object is found in.
5562 non_pic_object="$xdir$non_pic_object"
5563
5564 # A standard non-PIC object
5565 func_append non_pic_objects " $non_pic_object"
5566 if test -z "$pic_object" || test "$pic_object" = none ; then
5567 arg="$non_pic_object"
5568 fi
5569 else
5570 # If the PIC object exists, use it instead.
5571 # $xdir was prepended to $pic_object above.
5572 non_pic_object="$pic_object"
5573 func_append non_pic_objects " $non_pic_object"
5574 fi
5575 else
5576 # Only an error if not doing a dry-run.
5577 if $opt_dry_run; then
5578 # Extract subdirectory from the argument.
5579 func_dirname "$arg" "/" ""
5580 xdir="$func_dirname_result"
5581
5582 func_lo2o "$arg"
5583 pic_object=$xdir$objdir/$func_lo2o_result
5584 non_pic_object=$xdir$func_lo2o_result
5585 func_append libobjs " $pic_object"
5586 func_append non_pic_objects " $non_pic_object"
5587 else
5588 func_fatal_error "\`$arg' is not a valid libtool object"
5589 fi
5590 fi
5591 ;;
5592
5593 *.$libext)
5594 # An archive.
5595 deplibs="$deplibs $arg"
5596 old_deplibs="$old_deplibs $arg"
5597 continue
5598 ;;
5599
5600 *.la)
5601 # A libtool-controlled library.
5602
5603 if test "$prev" = dlfiles; then
5604 # This library was specified with -dlopen.
5605 dlfiles="$dlfiles $arg"
5606 prev=
5607 elif test "$prev" = dlprefiles; then
5608 # The library was specified with -dlpreopen.
5609 dlprefiles="$dlprefiles $arg"
5610 prev=
5611 else
5612 deplibs="$deplibs $arg"
5613 fi
5614 continue
5615 ;;
5616
5617 # Some other compiler argument.
5618 *)
5619 # Unknown arguments in both finalize_command and compile_command need
5620 # to be aesthetically quoted because they are evaled later.
5621 func_quote_for_eval "$arg"
5622 arg="$func_quote_for_eval_result"
5623 ;;
5624 esac # arg
5625
5626 # Now actually substitute the argument into the commands.
5627 if test -n "$arg"; then
5628 func_append compile_command " $arg"
5629 func_append finalize_command " $arg"
5630 fi
5631 done # argument parsing loop
5632
5633 test -n "$prev" && \
5634 func_fatal_help "the \`$prevarg' option requires an argument"
5635
5636 if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then
5637 eval arg=\"$export_dynamic_flag_spec\"
5638 func_append compile_command " $arg"
5639 func_append finalize_command " $arg"
5640 fi
5641
5642 oldlibs=
5643 # calculate the name of the file, without its directory
5644 func_basename "$output"
5645 outputname="$func_basename_result"
5646 libobjs_save="$libobjs"
5647
5648 if test -n "$shlibpath_var"; then
5649 # get the directories listed in $shlibpath_var
cristy292e4352009-11-19 13:54:29 +00005650 eval shlib_search_path=\`\$ECHO \"\${$shlibpath_var}\" \| \$SED \'s/:/ /g\'\`
cristy3ed852e2009-09-05 21:47:34 +00005651 else
5652 shlib_search_path=
5653 fi
5654 eval sys_lib_search_path=\"$sys_lib_search_path_spec\"
5655 eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\"
5656
5657 func_dirname "$output" "/" ""
5658 output_objdir="$func_dirname_result$objdir"
5659 # Create the object directory.
5660 func_mkdir_p "$output_objdir"
5661
5662 # Determine the type of output
5663 case $output in
5664 "")
5665 func_fatal_help "you must specify an output file"
5666 ;;
5667 *.$libext) linkmode=oldlib ;;
5668 *.lo | *.$objext) linkmode=obj ;;
5669 *.la) linkmode=lib ;;
5670 *) linkmode=prog ;; # Anything else should be a program.
5671 esac
5672
5673 specialdeplibs=
5674
5675 libs=
5676 # Find all interdependent deplibs by searching for libraries
5677 # that are linked more than once (e.g. -la -lb -la)
5678 for deplib in $deplibs; do
5679 if $opt_duplicate_deps ; then
5680 case "$libs " in
5681 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
5682 esac
5683 fi
5684 libs="$libs $deplib"
5685 done
5686
5687 if test "$linkmode" = lib; then
5688 libs="$predeps $libs $compiler_lib_search_path $postdeps"
5689
5690 # Compute libraries that are listed more than once in $predeps
5691 # $postdeps and mark them as special (i.e., whose duplicates are
5692 # not to be eliminated).
5693 pre_post_deps=
5694 if $opt_duplicate_compiler_generated_deps; then
5695 for pre_post_dep in $predeps $postdeps; do
5696 case "$pre_post_deps " in
5697 *" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;;
5698 esac
5699 pre_post_deps="$pre_post_deps $pre_post_dep"
5700 done
5701 fi
5702 pre_post_deps=
5703 fi
5704
5705 deplibs=
5706 newdependency_libs=
5707 newlib_search_path=
5708 need_relink=no # whether we're linking any uninstalled libtool libraries
5709 notinst_deplibs= # not-installed libtool libraries
5710 notinst_path= # paths that contain not-installed libtool libraries
5711
5712 case $linkmode in
5713 lib)
5714 passes="conv dlpreopen link"
5715 for file in $dlfiles $dlprefiles; do
5716 case $file in
5717 *.la) ;;
5718 *)
5719 func_fatal_help "libraries can \`-dlopen' only libtool libraries: $file"
5720 ;;
5721 esac
5722 done
5723 ;;
5724 prog)
5725 compile_deplibs=
5726 finalize_deplibs=
5727 alldeplibs=no
5728 newdlfiles=
5729 newdlprefiles=
5730 passes="conv scan dlopen dlpreopen link"
5731 ;;
5732 *) passes="conv"
5733 ;;
5734 esac
5735
5736 for pass in $passes; do
5737 # The preopen pass in lib mode reverses $deplibs; put it back here
5738 # so that -L comes before libs that need it for instance...
5739 if test "$linkmode,$pass" = "lib,link"; then
5740 ## FIXME: Find the place where the list is rebuilt in the wrong
5741 ## order, and fix it there properly
5742 tmp_deplibs=
5743 for deplib in $deplibs; do
5744 tmp_deplibs="$deplib $tmp_deplibs"
5745 done
5746 deplibs="$tmp_deplibs"
5747 fi
5748
5749 if test "$linkmode,$pass" = "lib,link" ||
5750 test "$linkmode,$pass" = "prog,scan"; then
5751 libs="$deplibs"
5752 deplibs=
5753 fi
5754 if test "$linkmode" = prog; then
5755 case $pass in
5756 dlopen) libs="$dlfiles" ;;
5757 dlpreopen) libs="$dlprefiles" ;;
5758 link) libs="$deplibs %DEPLIBS% $dependency_libs" ;;
5759 esac
5760 fi
5761 if test "$linkmode,$pass" = "lib,dlpreopen"; then
5762 # Collect and forward deplibs of preopened libtool libs
5763 for lib in $dlprefiles; do
5764 # Ignore non-libtool-libs
5765 dependency_libs=
5766 case $lib in
5767 *.la) func_source "$lib" ;;
5768 esac
5769
5770 # Collect preopened libtool deplibs, except any this library
5771 # has declared as weak libs
5772 for deplib in $dependency_libs; do
cristy292e4352009-11-19 13:54:29 +00005773 func_basename "$deplib"
5774 deplib_base=$func_basename_result
cristy3ed852e2009-09-05 21:47:34 +00005775 case " $weak_libs " in
5776 *" $deplib_base "*) ;;
5777 *) deplibs="$deplibs $deplib" ;;
5778 esac
5779 done
5780 done
5781 libs="$dlprefiles"
5782 fi
5783 if test "$pass" = dlopen; then
5784 # Collect dlpreopened libraries
5785 save_deplibs="$deplibs"
5786 deplibs=
5787 fi
5788
5789 for deplib in $libs; do
5790 lib=
5791 found=no
5792 case $deplib in
5793 -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads)
5794 if test "$linkmode,$pass" = "prog,link"; then
5795 compile_deplibs="$deplib $compile_deplibs"
5796 finalize_deplibs="$deplib $finalize_deplibs"
5797 else
5798 compiler_flags="$compiler_flags $deplib"
5799 if test "$linkmode" = lib ; then
5800 case "$new_inherited_linker_flags " in
5801 *" $deplib "*) ;;
5802 * ) new_inherited_linker_flags="$new_inherited_linker_flags $deplib" ;;
5803 esac
5804 fi
5805 fi
5806 continue
5807 ;;
5808 -l*)
5809 if test "$linkmode" != lib && test "$linkmode" != prog; then
5810 func_warning "\`-l' is ignored for archives/objects"
5811 continue
5812 fi
5813 func_stripname '-l' '' "$deplib"
5814 name=$func_stripname_result
5815 if test "$linkmode" = lib; then
5816 searchdirs="$newlib_search_path $lib_search_path $compiler_lib_search_dirs $sys_lib_search_path $shlib_search_path"
5817 else
5818 searchdirs="$newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path"
5819 fi
5820 for searchdir in $searchdirs; do
5821 for search_ext in .la $std_shrext .so .a; do
5822 # Search the libtool library
5823 lib="$searchdir/lib${name}${search_ext}"
5824 if test -f "$lib"; then
5825 if test "$search_ext" = ".la"; then
5826 found=yes
5827 else
5828 found=no
5829 fi
5830 break 2
5831 fi
5832 done
5833 done
5834 if test "$found" != yes; then
5835 # deplib doesn't seem to be a libtool library
5836 if test "$linkmode,$pass" = "prog,link"; then
5837 compile_deplibs="$deplib $compile_deplibs"
5838 finalize_deplibs="$deplib $finalize_deplibs"
5839 else
5840 deplibs="$deplib $deplibs"
5841 test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
5842 fi
5843 continue
5844 else # deplib is a libtool library
5845 # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib,
5846 # We need to do some special things here, and not later.
5847 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
5848 case " $predeps $postdeps " in
5849 *" $deplib "*)
5850 if func_lalib_p "$lib"; then
5851 library_names=
5852 old_library=
5853 func_source "$lib"
5854 for l in $old_library $library_names; do
5855 ll="$l"
5856 done
5857 if test "X$ll" = "X$old_library" ; then # only static version available
5858 found=no
5859 func_dirname "$lib" "" "."
5860 ladir="$func_dirname_result"
5861 lib=$ladir/$old_library
5862 if test "$linkmode,$pass" = "prog,link"; then
5863 compile_deplibs="$deplib $compile_deplibs"
5864 finalize_deplibs="$deplib $finalize_deplibs"
5865 else
5866 deplibs="$deplib $deplibs"
5867 test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
5868 fi
5869 continue
5870 fi
5871 fi
5872 ;;
5873 *) ;;
5874 esac
5875 fi
5876 fi
5877 ;; # -l
5878 *.ltframework)
5879 if test "$linkmode,$pass" = "prog,link"; then
5880 compile_deplibs="$deplib $compile_deplibs"
5881 finalize_deplibs="$deplib $finalize_deplibs"
5882 else
5883 deplibs="$deplib $deplibs"
5884 if test "$linkmode" = lib ; then
5885 case "$new_inherited_linker_flags " in
5886 *" $deplib "*) ;;
5887 * ) new_inherited_linker_flags="$new_inherited_linker_flags $deplib" ;;
5888 esac
5889 fi
5890 fi
5891 continue
5892 ;;
5893 -L*)
5894 case $linkmode in
5895 lib)
5896 deplibs="$deplib $deplibs"
5897 test "$pass" = conv && continue
5898 newdependency_libs="$deplib $newdependency_libs"
5899 func_stripname '-L' '' "$deplib"
5900 newlib_search_path="$newlib_search_path $func_stripname_result"
5901 ;;
5902 prog)
5903 if test "$pass" = conv; then
5904 deplibs="$deplib $deplibs"
5905 continue
5906 fi
5907 if test "$pass" = scan; then
5908 deplibs="$deplib $deplibs"
5909 else
5910 compile_deplibs="$deplib $compile_deplibs"
5911 finalize_deplibs="$deplib $finalize_deplibs"
5912 fi
5913 func_stripname '-L' '' "$deplib"
5914 newlib_search_path="$newlib_search_path $func_stripname_result"
5915 ;;
5916 *)
5917 func_warning "\`-L' is ignored for archives/objects"
5918 ;;
5919 esac # linkmode
5920 continue
5921 ;; # -L
5922 -R*)
5923 if test "$pass" = link; then
5924 func_stripname '-R' '' "$deplib"
5925 dir=$func_stripname_result
5926 # Make sure the xrpath contains only unique directories.
5927 case "$xrpath " in
5928 *" $dir "*) ;;
5929 *) xrpath="$xrpath $dir" ;;
5930 esac
5931 fi
5932 deplibs="$deplib $deplibs"
5933 continue
5934 ;;
5935 *.la) lib="$deplib" ;;
5936 *.$libext)
5937 if test "$pass" = conv; then
5938 deplibs="$deplib $deplibs"
5939 continue
5940 fi
5941 case $linkmode in
5942 lib)
5943 # Linking convenience modules into shared libraries is allowed,
5944 # but linking other static libraries is non-portable.
5945 case " $dlpreconveniencelibs " in
5946 *" $deplib "*) ;;
5947 *)
5948 valid_a_lib=no
5949 case $deplibs_check_method in
5950 match_pattern*)
5951 set dummy $deplibs_check_method; shift
5952 match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
cristy292e4352009-11-19 13:54:29 +00005953 if eval "\$ECHO \"$deplib\"" 2>/dev/null | $SED 10q \
cristy3ed852e2009-09-05 21:47:34 +00005954 | $EGREP "$match_pattern_regex" > /dev/null; then
5955 valid_a_lib=yes
5956 fi
5957 ;;
5958 pass_all)
5959 valid_a_lib=yes
5960 ;;
5961 esac
5962 if test "$valid_a_lib" != yes; then
cristy292e4352009-11-19 13:54:29 +00005963 echo
cristy3ed852e2009-09-05 21:47:34 +00005964 $ECHO "*** Warning: Trying to link with static lib archive $deplib."
cristy292e4352009-11-19 13:54:29 +00005965 echo "*** I have the capability to make that library automatically link in when"
5966 echo "*** you link to this library. But I can only do this if you have a"
5967 echo "*** shared version of the library, which you do not appear to have"
5968 echo "*** because the file extensions .$libext of this argument makes me believe"
5969 echo "*** that it is just a static archive that I should not use here."
cristy3ed852e2009-09-05 21:47:34 +00005970 else
cristy292e4352009-11-19 13:54:29 +00005971 echo
cristy3ed852e2009-09-05 21:47:34 +00005972 $ECHO "*** Warning: Linking the shared library $output against the"
5973 $ECHO "*** static library $deplib is not portable!"
5974 deplibs="$deplib $deplibs"
5975 fi
5976 ;;
5977 esac
5978 continue
5979 ;;
5980 prog)
5981 if test "$pass" != link; then
5982 deplibs="$deplib $deplibs"
5983 else
5984 compile_deplibs="$deplib $compile_deplibs"
5985 finalize_deplibs="$deplib $finalize_deplibs"
5986 fi
5987 continue
5988 ;;
5989 esac # linkmode
5990 ;; # *.$libext
5991 *.lo | *.$objext)
5992 if test "$pass" = conv; then
5993 deplibs="$deplib $deplibs"
5994 elif test "$linkmode" = prog; then
5995 if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
5996 # If there is no dlopen support or we're linking statically,
5997 # we need to preload.
5998 newdlprefiles="$newdlprefiles $deplib"
5999 compile_deplibs="$deplib $compile_deplibs"
6000 finalize_deplibs="$deplib $finalize_deplibs"
6001 else
6002 newdlfiles="$newdlfiles $deplib"
6003 fi
6004 fi
6005 continue
6006 ;;
6007 %DEPLIBS%)
6008 alldeplibs=yes
6009 continue
6010 ;;
6011 esac # case $deplib
6012
6013 if test "$found" = yes || test -f "$lib"; then :
6014 else
6015 func_fatal_error "cannot find the library \`$lib' or unhandled argument \`$deplib'"
6016 fi
6017
6018 # Check to see that this really is a libtool archive.
6019 func_lalib_unsafe_p "$lib" \
6020 || func_fatal_error "\`$lib' is not a valid libtool archive"
6021
6022 func_dirname "$lib" "" "."
6023 ladir="$func_dirname_result"
6024
6025 dlname=
6026 dlopen=
6027 dlpreopen=
6028 libdir=
6029 library_names=
6030 old_library=
6031 inherited_linker_flags=
6032 # If the library was installed with an old release of libtool,
6033 # it will not redefine variables installed, or shouldnotlink
6034 installed=yes
6035 shouldnotlink=no
6036 avoidtemprpath=
6037
6038
6039 # Read the .la file
6040 func_source "$lib"
6041
6042 # Convert "-framework foo" to "foo.ltframework"
6043 if test -n "$inherited_linker_flags"; then
cristy292e4352009-11-19 13:54:29 +00006044 tmp_inherited_linker_flags=`$ECHO "$inherited_linker_flags" | $SED 's/-framework \([^ $]*\)/\1.ltframework/g'`
cristy3ed852e2009-09-05 21:47:34 +00006045 for tmp_inherited_linker_flag in $tmp_inherited_linker_flags; do
6046 case " $new_inherited_linker_flags " in
6047 *" $tmp_inherited_linker_flag "*) ;;
6048 *) new_inherited_linker_flags="$new_inherited_linker_flags $tmp_inherited_linker_flag";;
6049 esac
6050 done
6051 fi
cristy292e4352009-11-19 13:54:29 +00006052 dependency_libs=`$ECHO " $dependency_libs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
cristy3ed852e2009-09-05 21:47:34 +00006053 if test "$linkmode,$pass" = "lib,link" ||
6054 test "$linkmode,$pass" = "prog,scan" ||
6055 { test "$linkmode" != prog && test "$linkmode" != lib; }; then
6056 test -n "$dlopen" && dlfiles="$dlfiles $dlopen"
6057 test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen"
6058 fi
6059
6060 if test "$pass" = conv; then
6061 # Only check for convenience libraries
6062 deplibs="$lib $deplibs"
6063 if test -z "$libdir"; then
6064 if test -z "$old_library"; then
6065 func_fatal_error "cannot find name of link library for \`$lib'"
6066 fi
6067 # It is a libtool convenience library, so add in its objects.
6068 convenience="$convenience $ladir/$objdir/$old_library"
6069 old_convenience="$old_convenience $ladir/$objdir/$old_library"
6070 elif test "$linkmode" != prog && test "$linkmode" != lib; then
6071 func_fatal_error "\`$lib' is not a convenience library"
6072 fi
6073 tmp_libs=
6074 for deplib in $dependency_libs; do
6075 deplibs="$deplib $deplibs"
6076 if $opt_duplicate_deps ; then
6077 case "$tmp_libs " in
6078 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
6079 esac
6080 fi
6081 tmp_libs="$tmp_libs $deplib"
6082 done
6083 continue
6084 fi # $pass = conv
6085
6086
6087 # Get the name of the library we link against.
6088 linklib=
6089 for l in $old_library $library_names; do
6090 linklib="$l"
6091 done
6092 if test -z "$linklib"; then
6093 func_fatal_error "cannot find name of link library for \`$lib'"
6094 fi
6095
6096 # This library was specified with -dlopen.
6097 if test "$pass" = dlopen; then
6098 if test -z "$libdir"; then
6099 func_fatal_error "cannot -dlopen a convenience library: \`$lib'"
6100 fi
6101 if test -z "$dlname" ||
6102 test "$dlopen_support" != yes ||
6103 test "$build_libtool_libs" = no; then
6104 # If there is no dlname, no dlopen support or we're linking
6105 # statically, we need to preload. We also need to preload any
6106 # dependent libraries so libltdl's deplib preloader doesn't
6107 # bomb out in the load deplibs phase.
6108 dlprefiles="$dlprefiles $lib $dependency_libs"
6109 else
6110 newdlfiles="$newdlfiles $lib"
6111 fi
6112 continue
6113 fi # $pass = dlopen
6114
6115 # We need an absolute path.
6116 case $ladir in
6117 [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;;
6118 *)
6119 abs_ladir=`cd "$ladir" && pwd`
6120 if test -z "$abs_ladir"; then
6121 func_warning "cannot determine absolute directory name of \`$ladir'"
6122 func_warning "passing it literally to the linker, although it might fail"
6123 abs_ladir="$ladir"
6124 fi
6125 ;;
6126 esac
6127 func_basename "$lib"
6128 laname="$func_basename_result"
6129
6130 # Find the relevant object directory and library name.
6131 if test "X$installed" = Xyes; then
6132 if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then
6133 func_warning "library \`$lib' was moved."
6134 dir="$ladir"
6135 absdir="$abs_ladir"
6136 libdir="$abs_ladir"
6137 else
6138 dir="$libdir"
6139 absdir="$libdir"
6140 fi
6141 test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes
6142 else
6143 if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then
6144 dir="$ladir"
6145 absdir="$abs_ladir"
6146 # Remove this search path later
6147 notinst_path="$notinst_path $abs_ladir"
6148 else
6149 dir="$ladir/$objdir"
6150 absdir="$abs_ladir/$objdir"
6151 # Remove this search path later
6152 notinst_path="$notinst_path $abs_ladir"
6153 fi
6154 fi # $installed = yes
6155 func_stripname 'lib' '.la' "$laname"
6156 name=$func_stripname_result
6157
6158 # This library was specified with -dlpreopen.
6159 if test "$pass" = dlpreopen; then
6160 if test -z "$libdir" && test "$linkmode" = prog; then
6161 func_fatal_error "only libraries may -dlpreopen a convenience library: \`$lib'"
6162 fi
6163 # Prefer using a static library (so that no silly _DYNAMIC symbols
6164 # are required to link).
6165 if test -n "$old_library"; then
6166 newdlprefiles="$newdlprefiles $dir/$old_library"
6167 # Keep a list of preopened convenience libraries to check
6168 # that they are being used correctly in the link pass.
6169 test -z "$libdir" && \
6170 dlpreconveniencelibs="$dlpreconveniencelibs $dir/$old_library"
6171 # Otherwise, use the dlname, so that lt_dlopen finds it.
6172 elif test -n "$dlname"; then
6173 newdlprefiles="$newdlprefiles $dir/$dlname"
6174 else
6175 newdlprefiles="$newdlprefiles $dir/$linklib"
6176 fi
6177 fi # $pass = dlpreopen
6178
6179 if test -z "$libdir"; then
6180 # Link the convenience library
6181 if test "$linkmode" = lib; then
6182 deplibs="$dir/$old_library $deplibs"
6183 elif test "$linkmode,$pass" = "prog,link"; then
6184 compile_deplibs="$dir/$old_library $compile_deplibs"
6185 finalize_deplibs="$dir/$old_library $finalize_deplibs"
6186 else
6187 deplibs="$lib $deplibs" # used for prog,scan pass
6188 fi
6189 continue
6190 fi
6191
6192
6193 if test "$linkmode" = prog && test "$pass" != link; then
6194 newlib_search_path="$newlib_search_path $ladir"
6195 deplibs="$lib $deplibs"
6196
6197 linkalldeplibs=no
6198 if test "$link_all_deplibs" != no || test -z "$library_names" ||
6199 test "$build_libtool_libs" = no; then
6200 linkalldeplibs=yes
6201 fi
6202
6203 tmp_libs=
6204 for deplib in $dependency_libs; do
6205 case $deplib in
6206 -L*) func_stripname '-L' '' "$deplib"
6207 newlib_search_path="$newlib_search_path $func_stripname_result"
6208 ;;
6209 esac
6210 # Need to link against all dependency_libs?
6211 if test "$linkalldeplibs" = yes; then
6212 deplibs="$deplib $deplibs"
6213 else
6214 # Need to hardcode shared library paths
6215 # or/and link against static libraries
6216 newdependency_libs="$deplib $newdependency_libs"
6217 fi
6218 if $opt_duplicate_deps ; then
6219 case "$tmp_libs " in
6220 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
6221 esac
6222 fi
6223 tmp_libs="$tmp_libs $deplib"
6224 done # for deplib
6225 continue
6226 fi # $linkmode = prog...
6227
6228 if test "$linkmode,$pass" = "prog,link"; then
6229 if test -n "$library_names" &&
6230 { { test "$prefer_static_libs" = no ||
6231 test "$prefer_static_libs,$installed" = "built,yes"; } ||
6232 test -z "$old_library"; }; then
6233 # We need to hardcode the library path
6234 if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then
6235 # Make sure the rpath contains only unique directories.
6236 case "$temp_rpath:" in
6237 *"$absdir:"*) ;;
6238 *) temp_rpath="$temp_rpath$absdir:" ;;
6239 esac
6240 fi
6241
6242 # Hardcode the library path.
6243 # Skip directories that are in the system default run-time
6244 # search path.
6245 case " $sys_lib_dlsearch_path " in
6246 *" $absdir "*) ;;
6247 *)
6248 case "$compile_rpath " in
6249 *" $absdir "*) ;;
6250 *) compile_rpath="$compile_rpath $absdir"
6251 esac
6252 ;;
6253 esac
6254 case " $sys_lib_dlsearch_path " in
6255 *" $libdir "*) ;;
6256 *)
6257 case "$finalize_rpath " in
6258 *" $libdir "*) ;;
6259 *) finalize_rpath="$finalize_rpath $libdir"
6260 esac
6261 ;;
6262 esac
6263 fi # $linkmode,$pass = prog,link...
6264
6265 if test "$alldeplibs" = yes &&
6266 { test "$deplibs_check_method" = pass_all ||
6267 { test "$build_libtool_libs" = yes &&
6268 test -n "$library_names"; }; }; then
6269 # We only need to search for static libraries
6270 continue
6271 fi
6272 fi
6273
6274 link_static=no # Whether the deplib will be linked statically
6275 use_static_libs=$prefer_static_libs
6276 if test "$use_static_libs" = built && test "$installed" = yes; then
6277 use_static_libs=no
6278 fi
6279 if test -n "$library_names" &&
6280 { test "$use_static_libs" = no || test -z "$old_library"; }; then
6281 case $host in
6282 *cygwin* | *mingw* | *cegcc*)
6283 # No point in relinking DLLs because paths are not encoded
6284 notinst_deplibs="$notinst_deplibs $lib"
6285 need_relink=no
6286 ;;
6287 *)
6288 if test "$installed" = no; then
6289 notinst_deplibs="$notinst_deplibs $lib"
6290 need_relink=yes
6291 fi
6292 ;;
6293 esac
6294 # This is a shared library
6295
6296 # Warn about portability, can't link against -module's on some
6297 # systems (darwin). Don't bleat about dlopened modules though!
6298 dlopenmodule=""
6299 for dlpremoduletest in $dlprefiles; do
6300 if test "X$dlpremoduletest" = "X$lib"; then
6301 dlopenmodule="$dlpremoduletest"
6302 break
6303 fi
6304 done
6305 if test -z "$dlopenmodule" && test "$shouldnotlink" = yes && test "$pass" = link; then
cristy292e4352009-11-19 13:54:29 +00006306 echo
cristy3ed852e2009-09-05 21:47:34 +00006307 if test "$linkmode" = prog; then
6308 $ECHO "*** Warning: Linking the executable $output against the loadable module"
6309 else
6310 $ECHO "*** Warning: Linking the shared library $output against the loadable module"
6311 fi
6312 $ECHO "*** $linklib is not portable!"
6313 fi
6314 if test "$linkmode" = lib &&
6315 test "$hardcode_into_libs" = yes; then
6316 # Hardcode the library path.
6317 # Skip directories that are in the system default run-time
6318 # search path.
6319 case " $sys_lib_dlsearch_path " in
6320 *" $absdir "*) ;;
6321 *)
6322 case "$compile_rpath " in
6323 *" $absdir "*) ;;
6324 *) compile_rpath="$compile_rpath $absdir"
6325 esac
6326 ;;
6327 esac
6328 case " $sys_lib_dlsearch_path " in
6329 *" $libdir "*) ;;
6330 *)
6331 case "$finalize_rpath " in
6332 *" $libdir "*) ;;
6333 *) finalize_rpath="$finalize_rpath $libdir"
6334 esac
6335 ;;
6336 esac
6337 fi
6338
6339 if test -n "$old_archive_from_expsyms_cmds"; then
6340 # figure out the soname
6341 set dummy $library_names
6342 shift
6343 realname="$1"
6344 shift
6345 libname=`eval "\\$ECHO \"$libname_spec\""`
6346 # use dlname if we got it. it's perfectly good, no?
6347 if test -n "$dlname"; then
6348 soname="$dlname"
6349 elif test -n "$soname_spec"; then
6350 # bleh windows
6351 case $host in
6352 *cygwin* | mingw* | *cegcc*)
6353 func_arith $current - $age
6354 major=$func_arith_result
6355 versuffix="-$major"
6356 ;;
6357 esac
6358 eval soname=\"$soname_spec\"
6359 else
6360 soname="$realname"
6361 fi
6362
6363 # Make a new name for the extract_expsyms_cmds to use
6364 soroot="$soname"
6365 func_basename "$soroot"
6366 soname="$func_basename_result"
6367 func_stripname 'lib' '.dll' "$soname"
6368 newlib=libimp-$func_stripname_result.a
6369
6370 # If the library has no export list, then create one now
6371 if test -f "$output_objdir/$soname-def"; then :
6372 else
6373 func_verbose "extracting exported symbol list from \`$soname'"
6374 func_execute_cmds "$extract_expsyms_cmds" 'exit $?'
6375 fi
6376
6377 # Create $newlib
6378 if test -f "$output_objdir/$newlib"; then :; else
6379 func_verbose "generating import library for \`$soname'"
6380 func_execute_cmds "$old_archive_from_expsyms_cmds" 'exit $?'
6381 fi
6382 # make sure the library variables are pointing to the new library
6383 dir=$output_objdir
6384 linklib=$newlib
6385 fi # test -n "$old_archive_from_expsyms_cmds"
6386
6387 if test "$linkmode" = prog || test "$mode" != relink; then
6388 add_shlibpath=
6389 add_dir=
6390 add=
6391 lib_linked=yes
6392 case $hardcode_action in
6393 immediate | unsupported)
6394 if test "$hardcode_direct" = no; then
6395 add="$dir/$linklib"
6396 case $host in
6397 *-*-sco3.2v5.0.[024]*) add_dir="-L$dir" ;;
6398 *-*-sysv4*uw2*) add_dir="-L$dir" ;;
6399 *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \
6400 *-*-unixware7*) add_dir="-L$dir" ;;
6401 *-*-darwin* )
6402 # if the lib is a (non-dlopened) module then we can not
6403 # link against it, someone is ignoring the earlier warnings
6404 if /usr/bin/file -L $add 2> /dev/null |
6405 $GREP ": [^:]* bundle" >/dev/null ; then
6406 if test "X$dlopenmodule" != "X$lib"; then
6407 $ECHO "*** Warning: lib $linklib is a module, not a shared library"
6408 if test -z "$old_library" ; then
cristy292e4352009-11-19 13:54:29 +00006409 echo
6410 echo "*** And there doesn't seem to be a static archive available"
6411 echo "*** The link will probably fail, sorry"
cristy3ed852e2009-09-05 21:47:34 +00006412 else
6413 add="$dir/$old_library"
6414 fi
6415 elif test -n "$old_library"; then
6416 add="$dir/$old_library"
6417 fi
6418 fi
6419 esac
6420 elif test "$hardcode_minus_L" = no; then
6421 case $host in
6422 *-*-sunos*) add_shlibpath="$dir" ;;
6423 esac
6424 add_dir="-L$dir"
6425 add="-l$name"
6426 elif test "$hardcode_shlibpath_var" = no; then
6427 add_shlibpath="$dir"
6428 add="-l$name"
6429 else
6430 lib_linked=no
6431 fi
6432 ;;
6433 relink)
6434 if test "$hardcode_direct" = yes &&
6435 test "$hardcode_direct_absolute" = no; then
6436 add="$dir/$linklib"
6437 elif test "$hardcode_minus_L" = yes; then
6438 add_dir="-L$dir"
6439 # Try looking first in the location we're being installed to.
6440 if test -n "$inst_prefix_dir"; then
6441 case $libdir in
6442 [\\/]*)
6443 add_dir="$add_dir -L$inst_prefix_dir$libdir"
6444 ;;
6445 esac
6446 fi
6447 add="-l$name"
6448 elif test "$hardcode_shlibpath_var" = yes; then
6449 add_shlibpath="$dir"
6450 add="-l$name"
6451 else
6452 lib_linked=no
6453 fi
6454 ;;
6455 *) lib_linked=no ;;
6456 esac
6457
6458 if test "$lib_linked" != yes; then
6459 func_fatal_configuration "unsupported hardcode properties"
6460 fi
6461
6462 if test -n "$add_shlibpath"; then
6463 case :$compile_shlibpath: in
6464 *":$add_shlibpath:"*) ;;
6465 *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;;
6466 esac
6467 fi
6468 if test "$linkmode" = prog; then
6469 test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs"
6470 test -n "$add" && compile_deplibs="$add $compile_deplibs"
6471 else
6472 test -n "$add_dir" && deplibs="$add_dir $deplibs"
6473 test -n "$add" && deplibs="$add $deplibs"
6474 if test "$hardcode_direct" != yes &&
6475 test "$hardcode_minus_L" != yes &&
6476 test "$hardcode_shlibpath_var" = yes; then
6477 case :$finalize_shlibpath: in
6478 *":$libdir:"*) ;;
6479 *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
6480 esac
6481 fi
6482 fi
6483 fi
6484
6485 if test "$linkmode" = prog || test "$mode" = relink; then
6486 add_shlibpath=
6487 add_dir=
6488 add=
6489 # Finalize command for both is simple: just hardcode it.
6490 if test "$hardcode_direct" = yes &&
6491 test "$hardcode_direct_absolute" = no; then
6492 add="$libdir/$linklib"
6493 elif test "$hardcode_minus_L" = yes; then
6494 add_dir="-L$libdir"
6495 add="-l$name"
6496 elif test "$hardcode_shlibpath_var" = yes; then
6497 case :$finalize_shlibpath: in
6498 *":$libdir:"*) ;;
6499 *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
6500 esac
6501 add="-l$name"
6502 elif test "$hardcode_automatic" = yes; then
6503 if test -n "$inst_prefix_dir" &&
6504 test -f "$inst_prefix_dir$libdir/$linklib" ; then
6505 add="$inst_prefix_dir$libdir/$linklib"
6506 else
6507 add="$libdir/$linklib"
6508 fi
6509 else
6510 # We cannot seem to hardcode it, guess we'll fake it.
6511 add_dir="-L$libdir"
6512 # Try looking first in the location we're being installed to.
6513 if test -n "$inst_prefix_dir"; then
6514 case $libdir in
6515 [\\/]*)
6516 add_dir="$add_dir -L$inst_prefix_dir$libdir"
6517 ;;
6518 esac
6519 fi
6520 add="-l$name"
6521 fi
6522
6523 if test "$linkmode" = prog; then
6524 test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs"
6525 test -n "$add" && finalize_deplibs="$add $finalize_deplibs"
6526 else
6527 test -n "$add_dir" && deplibs="$add_dir $deplibs"
6528 test -n "$add" && deplibs="$add $deplibs"
6529 fi
6530 fi
6531 elif test "$linkmode" = prog; then
6532 # Here we assume that one of hardcode_direct or hardcode_minus_L
6533 # is not unsupported. This is valid on all known static and
6534 # shared platforms.
6535 if test "$hardcode_direct" != unsupported; then
6536 test -n "$old_library" && linklib="$old_library"
6537 compile_deplibs="$dir/$linklib $compile_deplibs"
6538 finalize_deplibs="$dir/$linklib $finalize_deplibs"
6539 else
6540 compile_deplibs="-l$name -L$dir $compile_deplibs"
6541 finalize_deplibs="-l$name -L$dir $finalize_deplibs"
6542 fi
6543 elif test "$build_libtool_libs" = yes; then
6544 # Not a shared library
6545 if test "$deplibs_check_method" != pass_all; then
6546 # We're trying link a shared library against a static one
6547 # but the system doesn't support it.
6548
6549 # Just print a warning and add the library to dependency_libs so
6550 # that the program can be linked against the static library.
cristy292e4352009-11-19 13:54:29 +00006551 echo
cristy3ed852e2009-09-05 21:47:34 +00006552 $ECHO "*** Warning: This system can not link to static lib archive $lib."
cristy292e4352009-11-19 13:54:29 +00006553 echo "*** I have the capability to make that library automatically link in when"
6554 echo "*** you link to this library. But I can only do this if you have a"
6555 echo "*** shared version of the library, which you do not appear to have."
cristy3ed852e2009-09-05 21:47:34 +00006556 if test "$module" = yes; then
cristy292e4352009-11-19 13:54:29 +00006557 echo "*** But as you try to build a module library, libtool will still create "
6558 echo "*** a static module, that should work as long as the dlopening application"
6559 echo "*** is linked with the -dlopen flag to resolve symbols at runtime."
cristy3ed852e2009-09-05 21:47:34 +00006560 if test -z "$global_symbol_pipe"; then
cristy292e4352009-11-19 13:54:29 +00006561 echo
6562 echo "*** However, this would only work if libtool was able to extract symbol"
6563 echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
6564 echo "*** not find such a program. So, this module is probably useless."
6565 echo "*** \`nm' from GNU binutils and a full rebuild may help."
cristy3ed852e2009-09-05 21:47:34 +00006566 fi
6567 if test "$build_old_libs" = no; then
6568 build_libtool_libs=module
6569 build_old_libs=yes
6570 else
6571 build_libtool_libs=no
6572 fi
6573 fi
6574 else
6575 deplibs="$dir/$old_library $deplibs"
6576 link_static=yes
6577 fi
6578 fi # link shared/static library?
6579
6580 if test "$linkmode" = lib; then
6581 if test -n "$dependency_libs" &&
6582 { test "$hardcode_into_libs" != yes ||
6583 test "$build_old_libs" = yes ||
6584 test "$link_static" = yes; }; then
6585 # Extract -R from dependency_libs
6586 temp_deplibs=
6587 for libdir in $dependency_libs; do
6588 case $libdir in
6589 -R*) func_stripname '-R' '' "$libdir"
6590 temp_xrpath=$func_stripname_result
6591 case " $xrpath " in
6592 *" $temp_xrpath "*) ;;
6593 *) xrpath="$xrpath $temp_xrpath";;
6594 esac;;
6595 *) temp_deplibs="$temp_deplibs $libdir";;
6596 esac
6597 done
6598 dependency_libs="$temp_deplibs"
6599 fi
6600
6601 newlib_search_path="$newlib_search_path $absdir"
6602 # Link against this library
6603 test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs"
6604 # ... and its dependency_libs
6605 tmp_libs=
6606 for deplib in $dependency_libs; do
6607 newdependency_libs="$deplib $newdependency_libs"
6608 if $opt_duplicate_deps ; then
6609 case "$tmp_libs " in
6610 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
6611 esac
6612 fi
6613 tmp_libs="$tmp_libs $deplib"
6614 done
6615
6616 if test "$link_all_deplibs" != no; then
6617 # Add the search paths of all dependency libraries
6618 for deplib in $dependency_libs; do
cristy292e4352009-11-19 13:54:29 +00006619 path=
cristy3ed852e2009-09-05 21:47:34 +00006620 case $deplib in
6621 -L*) path="$deplib" ;;
6622 *.la)
6623 func_dirname "$deplib" "" "."
6624 dir="$func_dirname_result"
6625 # We need an absolute path.
6626 case $dir in
6627 [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;;
6628 *)
6629 absdir=`cd "$dir" && pwd`
6630 if test -z "$absdir"; then
6631 func_warning "cannot determine absolute directory name of \`$dir'"
6632 absdir="$dir"
6633 fi
6634 ;;
6635 esac
6636 if $GREP "^installed=no" $deplib > /dev/null; then
6637 case $host in
6638 *-*-darwin*)
6639 depdepl=
6640 eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib`
6641 if test -n "$deplibrary_names" ; then
6642 for tmp in $deplibrary_names ; do
6643 depdepl=$tmp
6644 done
6645 if test -f "$absdir/$objdir/$depdepl" ; then
6646 depdepl="$absdir/$objdir/$depdepl"
6647 darwin_install_name=`${OTOOL} -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'`
6648 if test -z "$darwin_install_name"; then
6649 darwin_install_name=`${OTOOL64} -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'`
6650 fi
6651 compiler_flags="$compiler_flags ${wl}-dylib_file ${wl}${darwin_install_name}:${depdepl}"
6652 linker_flags="$linker_flags -dylib_file ${darwin_install_name}:${depdepl}"
6653 path=
6654 fi
6655 fi
6656 ;;
6657 *)
6658 path="-L$absdir/$objdir"
6659 ;;
6660 esac
6661 else
6662 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
6663 test -z "$libdir" && \
6664 func_fatal_error "\`$deplib' is not a valid libtool archive"
6665 test "$absdir" != "$libdir" && \
6666 func_warning "\`$deplib' seems to be moved"
6667
6668 path="-L$absdir"
6669 fi
6670 ;;
6671 esac
6672 case " $deplibs " in
6673 *" $path "*) ;;
6674 *) deplibs="$path $deplibs" ;;
6675 esac
6676 done
6677 fi # link_all_deplibs != no
6678 fi # linkmode = lib
6679 done # for deplib in $libs
6680 if test "$pass" = link; then
6681 if test "$linkmode" = "prog"; then
6682 compile_deplibs="$new_inherited_linker_flags $compile_deplibs"
6683 finalize_deplibs="$new_inherited_linker_flags $finalize_deplibs"
6684 else
cristy292e4352009-11-19 13:54:29 +00006685 compiler_flags="$compiler_flags "`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
cristy3ed852e2009-09-05 21:47:34 +00006686 fi
6687 fi
6688 dependency_libs="$newdependency_libs"
6689 if test "$pass" = dlpreopen; then
6690 # Link the dlpreopened libraries before other libraries
6691 for deplib in $save_deplibs; do
6692 deplibs="$deplib $deplibs"
6693 done
6694 fi
6695 if test "$pass" != dlopen; then
6696 if test "$pass" != conv; then
6697 # Make sure lib_search_path contains only unique directories.
6698 lib_search_path=
6699 for dir in $newlib_search_path; do
6700 case "$lib_search_path " in
6701 *" $dir "*) ;;
6702 *) lib_search_path="$lib_search_path $dir" ;;
6703 esac
6704 done
6705 newlib_search_path=
6706 fi
6707
6708 if test "$linkmode,$pass" != "prog,link"; then
6709 vars="deplibs"
6710 else
6711 vars="compile_deplibs finalize_deplibs"
6712 fi
6713 for var in $vars dependency_libs; do
6714 # Add libraries to $var in reverse order
6715 eval tmp_libs=\"\$$var\"
6716 new_libs=
6717 for deplib in $tmp_libs; do
6718 # FIXME: Pedantically, this is the right thing to do, so
6719 # that some nasty dependency loop isn't accidentally
6720 # broken:
6721 #new_libs="$deplib $new_libs"
6722 # Pragmatically, this seems to cause very few problems in
6723 # practice:
6724 case $deplib in
6725 -L*) new_libs="$deplib $new_libs" ;;
6726 -R*) ;;
6727 *)
6728 # And here is the reason: when a library appears more
6729 # than once as an explicit dependence of a library, or
6730 # is implicitly linked in more than once by the
6731 # compiler, it is considered special, and multiple
6732 # occurrences thereof are not removed. Compare this
6733 # with having the same library being listed as a
6734 # dependency of multiple other libraries: in this case,
6735 # we know (pedantically, we assume) the library does not
6736 # need to be listed more than once, so we keep only the
6737 # last copy. This is not always right, but it is rare
6738 # enough that we require users that really mean to play
6739 # such unportable linking tricks to link the library
6740 # using -Wl,-lname, so that libtool does not consider it
6741 # for duplicate removal.
6742 case " $specialdeplibs " in
6743 *" $deplib "*) new_libs="$deplib $new_libs" ;;
6744 *)
6745 case " $new_libs " in
6746 *" $deplib "*) ;;
6747 *) new_libs="$deplib $new_libs" ;;
6748 esac
6749 ;;
6750 esac
6751 ;;
6752 esac
6753 done
6754 tmp_libs=
6755 for deplib in $new_libs; do
6756 case $deplib in
6757 -L*)
6758 case " $tmp_libs " in
6759 *" $deplib "*) ;;
6760 *) tmp_libs="$tmp_libs $deplib" ;;
6761 esac
6762 ;;
6763 *) tmp_libs="$tmp_libs $deplib" ;;
6764 esac
6765 done
6766 eval $var=\"$tmp_libs\"
6767 done # for var
6768 fi
6769 # Last step: remove runtime libs from dependency_libs
6770 # (they stay in deplibs)
6771 tmp_libs=
6772 for i in $dependency_libs ; do
6773 case " $predeps $postdeps $compiler_lib_search_path " in
6774 *" $i "*)
6775 i=""
6776 ;;
6777 esac
6778 if test -n "$i" ; then
6779 tmp_libs="$tmp_libs $i"
6780 fi
6781 done
6782 dependency_libs=$tmp_libs
6783 done # for pass
6784 if test "$linkmode" = prog; then
6785 dlfiles="$newdlfiles"
6786 fi
6787 if test "$linkmode" = prog || test "$linkmode" = lib; then
6788 dlprefiles="$newdlprefiles"
6789 fi
6790
6791 case $linkmode in
6792 oldlib)
6793 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
6794 func_warning "\`-dlopen' is ignored for archives"
6795 fi
6796
6797 case " $deplibs" in
6798 *\ -l* | *\ -L*)
6799 func_warning "\`-l' and \`-L' are ignored for archives" ;;
6800 esac
6801
6802 test -n "$rpath" && \
6803 func_warning "\`-rpath' is ignored for archives"
6804
6805 test -n "$xrpath" && \
6806 func_warning "\`-R' is ignored for archives"
6807
6808 test -n "$vinfo" && \
6809 func_warning "\`-version-info/-version-number' is ignored for archives"
6810
6811 test -n "$release" && \
6812 func_warning "\`-release' is ignored for archives"
6813
6814 test -n "$export_symbols$export_symbols_regex" && \
6815 func_warning "\`-export-symbols' is ignored for archives"
6816
6817 # Now set the variables for building old libraries.
6818 build_libtool_libs=no
6819 oldlibs="$output"
6820 objs="$objs$old_deplibs"
6821 ;;
6822
6823 lib)
6824 # Make sure we only generate libraries of the form `libNAME.la'.
6825 case $outputname in
6826 lib*)
6827 func_stripname 'lib' '.la' "$outputname"
6828 name=$func_stripname_result
6829 eval shared_ext=\"$shrext_cmds\"
6830 eval libname=\"$libname_spec\"
6831 ;;
6832 *)
6833 test "$module" = no && \
6834 func_fatal_help "libtool library \`$output' must begin with \`lib'"
6835
6836 if test "$need_lib_prefix" != no; then
6837 # Add the "lib" prefix for modules if required
6838 func_stripname '' '.la' "$outputname"
6839 name=$func_stripname_result
6840 eval shared_ext=\"$shrext_cmds\"
6841 eval libname=\"$libname_spec\"
6842 else
6843 func_stripname '' '.la' "$outputname"
6844 libname=$func_stripname_result
6845 fi
6846 ;;
6847 esac
6848
6849 if test -n "$objs"; then
6850 if test "$deplibs_check_method" != pass_all; then
6851 func_fatal_error "cannot build libtool library \`$output' from non-libtool objects on this host:$objs"
6852 else
cristy292e4352009-11-19 13:54:29 +00006853 echo
cristy3ed852e2009-09-05 21:47:34 +00006854 $ECHO "*** Warning: Linking the shared library $output against the non-libtool"
6855 $ECHO "*** objects $objs is not portable!"
6856 libobjs="$libobjs $objs"
6857 fi
6858 fi
6859
6860 test "$dlself" != no && \
6861 func_warning "\`-dlopen self' is ignored for libtool libraries"
6862
6863 set dummy $rpath
6864 shift
6865 test "$#" -gt 1 && \
6866 func_warning "ignoring multiple \`-rpath's for a libtool library"
6867
6868 install_libdir="$1"
6869
6870 oldlibs=
6871 if test -z "$rpath"; then
6872 if test "$build_libtool_libs" = yes; then
6873 # Building a libtool convenience library.
6874 # Some compilers have problems with a `.al' extension so
6875 # convenience libraries should have the same extension an
6876 # archive normally would.
6877 oldlibs="$output_objdir/$libname.$libext $oldlibs"
6878 build_libtool_libs=convenience
6879 build_old_libs=yes
6880 fi
6881
6882 test -n "$vinfo" && \
6883 func_warning "\`-version-info/-version-number' is ignored for convenience libraries"
6884
6885 test -n "$release" && \
6886 func_warning "\`-release' is ignored for convenience libraries"
6887 else
6888
6889 # Parse the version information argument.
6890 save_ifs="$IFS"; IFS=':'
6891 set dummy $vinfo 0 0 0
6892 shift
6893 IFS="$save_ifs"
6894
6895 test -n "$7" && \
6896 func_fatal_help "too many parameters to \`-version-info'"
6897
6898 # convert absolute version numbers to libtool ages
6899 # this retains compatibility with .la files and attempts
6900 # to make the code below a bit more comprehensible
6901
6902 case $vinfo_number in
6903 yes)
6904 number_major="$1"
6905 number_minor="$2"
6906 number_revision="$3"
6907 #
6908 # There are really only two kinds -- those that
6909 # use the current revision as the major version
6910 # and those that subtract age and use age as
6911 # a minor version. But, then there is irix
6912 # which has an extra 1 added just for fun
6913 #
6914 case $version_type in
6915 darwin|linux|osf|windows|none)
6916 func_arith $number_major + $number_minor
6917 current=$func_arith_result
6918 age="$number_minor"
6919 revision="$number_revision"
6920 ;;
cristy292e4352009-11-19 13:54:29 +00006921 freebsd-aout|freebsd-elf|qnx|sunos)
cristy3ed852e2009-09-05 21:47:34 +00006922 current="$number_major"
6923 revision="$number_minor"
6924 age="0"
6925 ;;
6926 irix|nonstopux)
6927 func_arith $number_major + $number_minor
6928 current=$func_arith_result
6929 age="$number_minor"
6930 revision="$number_minor"
6931 lt_irix_increment=no
6932 ;;
6933 esac
6934 ;;
6935 no)
6936 current="$1"
6937 revision="$2"
6938 age="$3"
6939 ;;
6940 esac
6941
6942 # Check that each of the things are valid numbers.
6943 case $current in
6944 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;;
6945 *)
6946 func_error "CURRENT \`$current' must be a nonnegative integer"
6947 func_fatal_error "\`$vinfo' is not valid version information"
6948 ;;
6949 esac
6950
6951 case $revision in
6952 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;;
6953 *)
6954 func_error "REVISION \`$revision' must be a nonnegative integer"
6955 func_fatal_error "\`$vinfo' is not valid version information"
6956 ;;
6957 esac
6958
6959 case $age in
6960 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;;
6961 *)
6962 func_error "AGE \`$age' must be a nonnegative integer"
6963 func_fatal_error "\`$vinfo' is not valid version information"
6964 ;;
6965 esac
6966
6967 if test "$age" -gt "$current"; then
6968 func_error "AGE \`$age' is greater than the current interface number \`$current'"
6969 func_fatal_error "\`$vinfo' is not valid version information"
6970 fi
6971
6972 # Calculate the version variables.
6973 major=
6974 versuffix=
6975 verstring=
6976 case $version_type in
6977 none) ;;
6978
6979 darwin)
6980 # Like Linux, but with the current version available in
6981 # verstring for coding it into the library header
6982 func_arith $current - $age
6983 major=.$func_arith_result
6984 versuffix="$major.$age.$revision"
6985 # Darwin ld doesn't like 0 for these options...
6986 func_arith $current + 1
6987 minor_current=$func_arith_result
6988 xlcverstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision"
6989 verstring="-compatibility_version $minor_current -current_version $minor_current.$revision"
6990 ;;
6991
6992 freebsd-aout)
6993 major=".$current"
6994 versuffix=".$current.$revision";
6995 ;;
6996
6997 freebsd-elf)
6998 major=".$current"
6999 versuffix=".$current"
7000 ;;
7001
7002 irix | nonstopux)
7003 if test "X$lt_irix_increment" = "Xno"; then
7004 func_arith $current - $age
7005 else
7006 func_arith $current - $age + 1
7007 fi
7008 major=$func_arith_result
7009
7010 case $version_type in
7011 nonstopux) verstring_prefix=nonstopux ;;
7012 *) verstring_prefix=sgi ;;
7013 esac
7014 verstring="$verstring_prefix$major.$revision"
7015
7016 # Add in all the interfaces that we are compatible with.
7017 loop=$revision
7018 while test "$loop" -ne 0; do
7019 func_arith $revision - $loop
7020 iface=$func_arith_result
7021 func_arith $loop - 1
7022 loop=$func_arith_result
7023 verstring="$verstring_prefix$major.$iface:$verstring"
7024 done
7025
7026 # Before this point, $major must not contain `.'.
7027 major=.$major
7028 versuffix="$major.$revision"
7029 ;;
7030
7031 linux)
7032 func_arith $current - $age
7033 major=.$func_arith_result
7034 versuffix="$major.$age.$revision"
7035 ;;
7036
7037 osf)
7038 func_arith $current - $age
7039 major=.$func_arith_result
7040 versuffix=".$current.$age.$revision"
7041 verstring="$current.$age.$revision"
7042
7043 # Add in all the interfaces that we are compatible with.
7044 loop=$age
7045 while test "$loop" -ne 0; do
7046 func_arith $current - $loop
7047 iface=$func_arith_result
7048 func_arith $loop - 1
7049 loop=$func_arith_result
7050 verstring="$verstring:${iface}.0"
7051 done
7052
7053 # Make executables depend on our current version.
7054 verstring="$verstring:${current}.0"
7055 ;;
7056
7057 qnx)
7058 major=".$current"
7059 versuffix=".$current"
7060 ;;
7061
7062 sunos)
7063 major=".$current"
7064 versuffix=".$current.$revision"
7065 ;;
7066
7067 windows)
7068 # Use '-' rather than '.', since we only want one
7069 # extension on DOS 8.3 filesystems.
7070 func_arith $current - $age
7071 major=$func_arith_result
7072 versuffix="-$major"
7073 ;;
7074
7075 *)
7076 func_fatal_configuration "unknown library version type \`$version_type'"
7077 ;;
7078 esac
7079
7080 # Clear the version info if we defaulted, and they specified a release.
7081 if test -z "$vinfo" && test -n "$release"; then
7082 major=
7083 case $version_type in
7084 darwin)
7085 # we can't check for "0.0" in archive_cmds due to quoting
7086 # problems, so we reset it completely
7087 verstring=
7088 ;;
7089 *)
7090 verstring="0.0"
7091 ;;
7092 esac
7093 if test "$need_version" = no; then
7094 versuffix=
7095 else
7096 versuffix=".0.0"
7097 fi
7098 fi
7099
7100 # Remove version info from name if versioning should be avoided
7101 if test "$avoid_version" = yes && test "$need_version" = no; then
7102 major=
7103 versuffix=
7104 verstring=""
7105 fi
7106
7107 # Check to see if the archive will have undefined symbols.
7108 if test "$allow_undefined" = yes; then
7109 if test "$allow_undefined_flag" = unsupported; then
7110 func_warning "undefined symbols not allowed in $host shared libraries"
7111 build_libtool_libs=no
7112 build_old_libs=yes
7113 fi
7114 else
7115 # Don't allow undefined symbols.
7116 allow_undefined_flag="$no_undefined_flag"
7117 fi
7118
7119 fi
7120
7121 func_generate_dlsyms "$libname" "$libname" "yes"
7122 libobjs="$libobjs $symfileobj"
7123 test "X$libobjs" = "X " && libobjs=
7124
7125 if test "$mode" != relink; then
7126 # Remove our outputs, but don't remove object files since they
7127 # may have been created when compiling PIC objects.
7128 removelist=
7129 tempremovelist=`$ECHO "$output_objdir/*"`
7130 for p in $tempremovelist; do
7131 case $p in
7132 *.$objext | *.gcno)
7133 ;;
7134 $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*)
7135 if test "X$precious_files_regex" != "X"; then
7136 if $ECHO "$p" | $EGREP -e "$precious_files_regex" >/dev/null 2>&1
7137 then
7138 continue
7139 fi
7140 fi
7141 removelist="$removelist $p"
7142 ;;
7143 *) ;;
7144 esac
7145 done
7146 test -n "$removelist" && \
7147 func_show_eval "${RM}r \$removelist"
7148 fi
7149
7150 # Now set the variables for building old libraries.
7151 if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then
7152 oldlibs="$oldlibs $output_objdir/$libname.$libext"
7153
7154 # Transform .lo files to .o files.
cristy292e4352009-11-19 13:54:29 +00007155 oldobjs="$objs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.${libext}$/d; $lo2o" | $NL2SP`
cristy3ed852e2009-09-05 21:47:34 +00007156 fi
7157
7158 # Eliminate all temporary directories.
7159 #for path in $notinst_path; do
cristy292e4352009-11-19 13:54:29 +00007160 # lib_search_path=`$ECHO "$lib_search_path " | $SED "s% $path % %g"`
7161 # deplibs=`$ECHO "$deplibs " | $SED "s% -L$path % %g"`
7162 # dependency_libs=`$ECHO "$dependency_libs " | $SED "s% -L$path % %g"`
cristy3ed852e2009-09-05 21:47:34 +00007163 #done
7164
7165 if test -n "$xrpath"; then
7166 # If the user specified any rpath flags, then add them.
7167 temp_xrpath=
7168 for libdir in $xrpath; do
7169 temp_xrpath="$temp_xrpath -R$libdir"
7170 case "$finalize_rpath " in
7171 *" $libdir "*) ;;
7172 *) finalize_rpath="$finalize_rpath $libdir" ;;
7173 esac
7174 done
7175 if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then
7176 dependency_libs="$temp_xrpath $dependency_libs"
7177 fi
7178 fi
7179
7180 # Make sure dlfiles contains only unique files that won't be dlpreopened
7181 old_dlfiles="$dlfiles"
7182 dlfiles=
7183 for lib in $old_dlfiles; do
7184 case " $dlprefiles $dlfiles " in
7185 *" $lib "*) ;;
7186 *) dlfiles="$dlfiles $lib" ;;
7187 esac
7188 done
7189
7190 # Make sure dlprefiles contains only unique files
7191 old_dlprefiles="$dlprefiles"
7192 dlprefiles=
7193 for lib in $old_dlprefiles; do
7194 case "$dlprefiles " in
7195 *" $lib "*) ;;
7196 *) dlprefiles="$dlprefiles $lib" ;;
7197 esac
7198 done
7199
7200 if test "$build_libtool_libs" = yes; then
7201 if test -n "$rpath"; then
7202 case $host in
cristy292e4352009-11-19 13:54:29 +00007203 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos* | *-cegcc* | *-*-haiku*)
cristy3ed852e2009-09-05 21:47:34 +00007204 # these systems don't actually have a c library (as such)!
7205 ;;
7206 *-*-rhapsody* | *-*-darwin1.[012])
7207 # Rhapsody C library is in the System framework
7208 deplibs="$deplibs System.ltframework"
7209 ;;
7210 *-*-netbsd*)
7211 # Don't link with libc until the a.out ld.so is fixed.
7212 ;;
7213 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
7214 # Do not include libc due to us having libc/libc_r.
7215 ;;
7216 *-*-sco3.2v5* | *-*-sco5v6*)
7217 # Causes problems with __ctype
7218 ;;
7219 *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
7220 # Compiler inserts libc in the correct place for threads to work
7221 ;;
7222 *)
7223 # Add libc to deplibs on all other systems if necessary.
7224 if test "$build_libtool_need_lc" = "yes"; then
7225 deplibs="$deplibs -lc"
7226 fi
7227 ;;
7228 esac
7229 fi
7230
7231 # Transform deplibs into only deplibs that can be linked in shared.
7232 name_save=$name
7233 libname_save=$libname
7234 release_save=$release
7235 versuffix_save=$versuffix
7236 major_save=$major
7237 # I'm not sure if I'm treating the release correctly. I think
7238 # release should show up in the -l (ie -lgmp5) so we don't want to
7239 # add it in twice. Is that correct?
7240 release=""
7241 versuffix=""
7242 major=""
7243 newdeplibs=
7244 droppeddeps=no
7245 case $deplibs_check_method in
7246 pass_all)
7247 # Don't check for shared/static. Everything works.
7248 # This might be a little naive. We might want to check
7249 # whether the library exists or not. But this is on
7250 # osf3 & osf4 and I'm not really sure... Just
7251 # implementing what was already the behavior.
7252 newdeplibs=$deplibs
7253 ;;
7254 test_compile)
7255 # This code stresses the "libraries are programs" paradigm to its
7256 # limits. Maybe even breaks it. We compile a program, linking it
7257 # against the deplibs as a proxy for the library. Then we can check
7258 # whether they linked in statically or dynamically with ldd.
7259 $opt_dry_run || $RM conftest.c
7260 cat > conftest.c <<EOF
7261 int main() { return 0; }
7262EOF
7263 $opt_dry_run || $RM conftest
7264 if $LTCC $LTCFLAGS -o conftest conftest.c $deplibs; then
7265 ldd_output=`ldd conftest`
7266 for i in $deplibs; do
7267 case $i in
7268 -l*)
7269 func_stripname -l '' "$i"
7270 name=$func_stripname_result
7271 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
7272 case " $predeps $postdeps " in
7273 *" $i "*)
7274 newdeplibs="$newdeplibs $i"
7275 i=""
7276 ;;
7277 esac
7278 fi
7279 if test -n "$i" ; then
7280 libname=`eval "\\$ECHO \"$libname_spec\""`
7281 deplib_matches=`eval "\\$ECHO \"$library_names_spec\""`
7282 set dummy $deplib_matches; shift
7283 deplib_match=$1
7284 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
7285 newdeplibs="$newdeplibs $i"
7286 else
7287 droppeddeps=yes
cristy292e4352009-11-19 13:54:29 +00007288 echo
cristy3ed852e2009-09-05 21:47:34 +00007289 $ECHO "*** Warning: dynamic linker does not accept needed library $i."
cristy292e4352009-11-19 13:54:29 +00007290 echo "*** I have the capability to make that library automatically link in when"
7291 echo "*** you link to this library. But I can only do this if you have a"
7292 echo "*** shared version of the library, which I believe you do not have"
7293 echo "*** because a test_compile did reveal that the linker did not use it for"
7294 echo "*** its dynamic dependency list that programs get resolved with at runtime."
cristy3ed852e2009-09-05 21:47:34 +00007295 fi
7296 fi
7297 ;;
7298 *)
7299 newdeplibs="$newdeplibs $i"
7300 ;;
7301 esac
7302 done
7303 else
7304 # Error occurred in the first compile. Let's try to salvage
7305 # the situation: Compile a separate program for each library.
7306 for i in $deplibs; do
7307 case $i in
7308 -l*)
7309 func_stripname -l '' "$i"
7310 name=$func_stripname_result
7311 $opt_dry_run || $RM conftest
7312 if $LTCC $LTCFLAGS -o conftest conftest.c $i; then
7313 ldd_output=`ldd conftest`
7314 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
7315 case " $predeps $postdeps " in
7316 *" $i "*)
7317 newdeplibs="$newdeplibs $i"
7318 i=""
7319 ;;
7320 esac
7321 fi
7322 if test -n "$i" ; then
7323 libname=`eval "\\$ECHO \"$libname_spec\""`
7324 deplib_matches=`eval "\\$ECHO \"$library_names_spec\""`
7325 set dummy $deplib_matches; shift
7326 deplib_match=$1
7327 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
7328 newdeplibs="$newdeplibs $i"
7329 else
7330 droppeddeps=yes
cristy292e4352009-11-19 13:54:29 +00007331 echo
cristy3ed852e2009-09-05 21:47:34 +00007332 $ECHO "*** Warning: dynamic linker does not accept needed library $i."
cristy292e4352009-11-19 13:54:29 +00007333 echo "*** I have the capability to make that library automatically link in when"
7334 echo "*** you link to this library. But I can only do this if you have a"
7335 echo "*** shared version of the library, which you do not appear to have"
7336 echo "*** because a test_compile did reveal that the linker did not use this one"
7337 echo "*** as a dynamic dependency that programs can get resolved with at runtime."
cristy3ed852e2009-09-05 21:47:34 +00007338 fi
7339 fi
7340 else
7341 droppeddeps=yes
cristy292e4352009-11-19 13:54:29 +00007342 echo
cristy3ed852e2009-09-05 21:47:34 +00007343 $ECHO "*** Warning! Library $i is needed by this library but I was not able to"
cristy292e4352009-11-19 13:54:29 +00007344 echo "*** make it link in! You will probably need to install it or some"
7345 echo "*** library that it depends on before this library will be fully"
7346 echo "*** functional. Installing it before continuing would be even better."
cristy3ed852e2009-09-05 21:47:34 +00007347 fi
7348 ;;
7349 *)
7350 newdeplibs="$newdeplibs $i"
7351 ;;
7352 esac
7353 done
7354 fi
7355 ;;
7356 file_magic*)
7357 set dummy $deplibs_check_method; shift
7358 file_magic_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
7359 for a_deplib in $deplibs; do
7360 case $a_deplib in
7361 -l*)
7362 func_stripname -l '' "$a_deplib"
7363 name=$func_stripname_result
7364 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
7365 case " $predeps $postdeps " in
7366 *" $a_deplib "*)
7367 newdeplibs="$newdeplibs $a_deplib"
7368 a_deplib=""
7369 ;;
7370 esac
7371 fi
7372 if test -n "$a_deplib" ; then
7373 libname=`eval "\\$ECHO \"$libname_spec\""`
7374 for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
7375 potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
7376 for potent_lib in $potential_libs; do
7377 # Follow soft links.
7378 if ls -lLd "$potent_lib" 2>/dev/null |
7379 $GREP " -> " >/dev/null; then
7380 continue
7381 fi
7382 # The statement above tries to avoid entering an
7383 # endless loop below, in case of cyclic links.
7384 # We might still enter an endless loop, since a link
7385 # loop can be closed while we follow links,
7386 # but so what?
7387 potlib="$potent_lib"
7388 while test -h "$potlib" 2>/dev/null; do
7389 potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'`
7390 case $potliblink in
7391 [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";;
cristy292e4352009-11-19 13:54:29 +00007392 *) potlib=`$ECHO "$potlib" | $SED 's,[^/]*$,,'`"$potliblink";;
cristy3ed852e2009-09-05 21:47:34 +00007393 esac
7394 done
7395 if eval $file_magic_cmd \"\$potlib\" 2>/dev/null |
7396 $SED -e 10q |
7397 $EGREP "$file_magic_regex" > /dev/null; then
7398 newdeplibs="$newdeplibs $a_deplib"
7399 a_deplib=""
7400 break 2
7401 fi
7402 done
7403 done
7404 fi
7405 if test -n "$a_deplib" ; then
7406 droppeddeps=yes
cristy292e4352009-11-19 13:54:29 +00007407 echo
cristy3ed852e2009-09-05 21:47:34 +00007408 $ECHO "*** Warning: linker path does not have real file for library $a_deplib."
cristy292e4352009-11-19 13:54:29 +00007409 echo "*** I have the capability to make that library automatically link in when"
7410 echo "*** you link to this library. But I can only do this if you have a"
7411 echo "*** shared version of the library, which you do not appear to have"
7412 echo "*** because I did check the linker path looking for a file starting"
cristy3ed852e2009-09-05 21:47:34 +00007413 if test -z "$potlib" ; then
7414 $ECHO "*** with $libname but no candidates were found. (...for file magic test)"
7415 else
7416 $ECHO "*** with $libname and none of the candidates passed a file format test"
7417 $ECHO "*** using a file magic. Last file checked: $potlib"
7418 fi
7419 fi
7420 ;;
7421 *)
7422 # Add a -L argument.
7423 newdeplibs="$newdeplibs $a_deplib"
7424 ;;
7425 esac
7426 done # Gone through all deplibs.
7427 ;;
7428 match_pattern*)
7429 set dummy $deplibs_check_method; shift
7430 match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
7431 for a_deplib in $deplibs; do
7432 case $a_deplib in
7433 -l*)
7434 func_stripname -l '' "$a_deplib"
7435 name=$func_stripname_result
7436 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
7437 case " $predeps $postdeps " in
7438 *" $a_deplib "*)
7439 newdeplibs="$newdeplibs $a_deplib"
7440 a_deplib=""
7441 ;;
7442 esac
7443 fi
7444 if test -n "$a_deplib" ; then
7445 libname=`eval "\\$ECHO \"$libname_spec\""`
7446 for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
7447 potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
7448 for potent_lib in $potential_libs; do
7449 potlib="$potent_lib" # see symlink-check above in file_magic test
cristy292e4352009-11-19 13:54:29 +00007450 if eval "\$ECHO \"$potent_lib\"" 2>/dev/null | $SED 10q | \
cristy3ed852e2009-09-05 21:47:34 +00007451 $EGREP "$match_pattern_regex" > /dev/null; then
7452 newdeplibs="$newdeplibs $a_deplib"
7453 a_deplib=""
7454 break 2
7455 fi
7456 done
7457 done
7458 fi
7459 if test -n "$a_deplib" ; then
7460 droppeddeps=yes
cristy292e4352009-11-19 13:54:29 +00007461 echo
cristy3ed852e2009-09-05 21:47:34 +00007462 $ECHO "*** Warning: linker path does not have real file for library $a_deplib."
cristy292e4352009-11-19 13:54:29 +00007463 echo "*** I have the capability to make that library automatically link in when"
7464 echo "*** you link to this library. But I can only do this if you have a"
7465 echo "*** shared version of the library, which you do not appear to have"
7466 echo "*** because I did check the linker path looking for a file starting"
cristy3ed852e2009-09-05 21:47:34 +00007467 if test -z "$potlib" ; then
7468 $ECHO "*** with $libname but no candidates were found. (...for regex pattern test)"
7469 else
7470 $ECHO "*** with $libname and none of the candidates passed a file format test"
7471 $ECHO "*** using a regex pattern. Last file checked: $potlib"
7472 fi
7473 fi
7474 ;;
7475 *)
7476 # Add a -L argument.
7477 newdeplibs="$newdeplibs $a_deplib"
7478 ;;
7479 esac
7480 done # Gone through all deplibs.
7481 ;;
7482 none | unknown | *)
7483 newdeplibs=""
cristy292e4352009-11-19 13:54:29 +00007484 tmp_deplibs=`$ECHO " $deplibs" | $SED 's/ -lc$//; s/ -[LR][^ ]*//g'`
cristy3ed852e2009-09-05 21:47:34 +00007485 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
7486 for i in $predeps $postdeps ; do
7487 # can't use Xsed below, because $i might contain '/'
cristy292e4352009-11-19 13:54:29 +00007488 tmp_deplibs=`$ECHO " $tmp_deplibs" | $SED "s,$i,,"`
cristy3ed852e2009-09-05 21:47:34 +00007489 done
7490 fi
cristy292e4352009-11-19 13:54:29 +00007491 case $tmp_deplibs in
7492 *[!\ \ ]*)
7493 echo
cristy3ed852e2009-09-05 21:47:34 +00007494 if test "X$deplibs_check_method" = "Xnone"; then
cristy292e4352009-11-19 13:54:29 +00007495 echo "*** Warning: inter-library dependencies are not supported in this platform."
cristy3ed852e2009-09-05 21:47:34 +00007496 else
cristy292e4352009-11-19 13:54:29 +00007497 echo "*** Warning: inter-library dependencies are not known to be supported."
cristy3ed852e2009-09-05 21:47:34 +00007498 fi
cristy292e4352009-11-19 13:54:29 +00007499 echo "*** All declared inter-library dependencies are being dropped."
cristy3ed852e2009-09-05 21:47:34 +00007500 droppeddeps=yes
cristy292e4352009-11-19 13:54:29 +00007501 ;;
7502 esac
cristy3ed852e2009-09-05 21:47:34 +00007503 ;;
7504 esac
7505 versuffix=$versuffix_save
7506 major=$major_save
7507 release=$release_save
7508 libname=$libname_save
7509 name=$name_save
7510
7511 case $host in
7512 *-*-rhapsody* | *-*-darwin1.[012])
7513 # On Rhapsody replace the C library with the System framework
cristy292e4352009-11-19 13:54:29 +00007514 newdeplibs=`$ECHO " $newdeplibs" | $SED 's/ -lc / System.ltframework /'`
cristy3ed852e2009-09-05 21:47:34 +00007515 ;;
7516 esac
7517
7518 if test "$droppeddeps" = yes; then
7519 if test "$module" = yes; then
cristy292e4352009-11-19 13:54:29 +00007520 echo
7521 echo "*** Warning: libtool could not satisfy all declared inter-library"
cristy3ed852e2009-09-05 21:47:34 +00007522 $ECHO "*** dependencies of module $libname. Therefore, libtool will create"
cristy292e4352009-11-19 13:54:29 +00007523 echo "*** a static module, that should work as long as the dlopening"
7524 echo "*** application is linked with the -dlopen flag."
cristy3ed852e2009-09-05 21:47:34 +00007525 if test -z "$global_symbol_pipe"; then
cristy292e4352009-11-19 13:54:29 +00007526 echo
7527 echo "*** However, this would only work if libtool was able to extract symbol"
7528 echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
7529 echo "*** not find such a program. So, this module is probably useless."
7530 echo "*** \`nm' from GNU binutils and a full rebuild may help."
cristy3ed852e2009-09-05 21:47:34 +00007531 fi
7532 if test "$build_old_libs" = no; then
7533 oldlibs="$output_objdir/$libname.$libext"
7534 build_libtool_libs=module
7535 build_old_libs=yes
7536 else
7537 build_libtool_libs=no
7538 fi
7539 else
cristy292e4352009-11-19 13:54:29 +00007540 echo "*** The inter-library dependencies that have been dropped here will be"
7541 echo "*** automatically added whenever a program is linked with this library"
7542 echo "*** or is declared to -dlopen it."
cristy3ed852e2009-09-05 21:47:34 +00007543
7544 if test "$allow_undefined" = no; then
cristy292e4352009-11-19 13:54:29 +00007545 echo
7546 echo "*** Since this library must not contain undefined symbols,"
7547 echo "*** because either the platform does not support them or"
7548 echo "*** it was explicitly requested with -no-undefined,"
7549 echo "*** libtool will only create a static version of it."
cristy3ed852e2009-09-05 21:47:34 +00007550 if test "$build_old_libs" = no; then
7551 oldlibs="$output_objdir/$libname.$libext"
7552 build_libtool_libs=module
7553 build_old_libs=yes
7554 else
7555 build_libtool_libs=no
7556 fi
7557 fi
7558 fi
7559 fi
7560 # Done checking deplibs!
7561 deplibs=$newdeplibs
7562 fi
7563 # Time to change all our "foo.ltframework" stuff back to "-framework foo"
7564 case $host in
7565 *-*-darwin*)
cristy292e4352009-11-19 13:54:29 +00007566 newdeplibs=`$ECHO " $newdeplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
7567 new_inherited_linker_flags=`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
7568 deplibs=`$ECHO " $deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
cristy3ed852e2009-09-05 21:47:34 +00007569 ;;
7570 esac
7571
7572 # move library search paths that coincide with paths to not yet
7573 # installed libraries to the beginning of the library search list
7574 new_libs=
7575 for path in $notinst_path; do
7576 case " $new_libs " in
7577 *" -L$path/$objdir "*) ;;
7578 *)
7579 case " $deplibs " in
7580 *" -L$path/$objdir "*)
7581 new_libs="$new_libs -L$path/$objdir" ;;
7582 esac
7583 ;;
7584 esac
7585 done
7586 for deplib in $deplibs; do
7587 case $deplib in
7588 -L*)
7589 case " $new_libs " in
7590 *" $deplib "*) ;;
7591 *) new_libs="$new_libs $deplib" ;;
7592 esac
7593 ;;
7594 *) new_libs="$new_libs $deplib" ;;
7595 esac
7596 done
7597 deplibs="$new_libs"
7598
7599 # All the library-specific variables (install_libdir is set above).
7600 library_names=
7601 old_library=
7602 dlname=
7603
7604 # Test again, we may have decided not to build it any more
7605 if test "$build_libtool_libs" = yes; then
7606 if test "$hardcode_into_libs" = yes; then
7607 # Hardcode the library paths
7608 hardcode_libdirs=
7609 dep_rpath=
7610 rpath="$finalize_rpath"
7611 test "$mode" != relink && rpath="$compile_rpath$rpath"
7612 for libdir in $rpath; do
7613 if test -n "$hardcode_libdir_flag_spec"; then
7614 if test -n "$hardcode_libdir_separator"; then
7615 if test -z "$hardcode_libdirs"; then
7616 hardcode_libdirs="$libdir"
7617 else
7618 # Just accumulate the unique libdirs.
7619 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
7620 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
7621 ;;
7622 *)
7623 hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
7624 ;;
7625 esac
7626 fi
7627 else
7628 eval flag=\"$hardcode_libdir_flag_spec\"
7629 dep_rpath="$dep_rpath $flag"
7630 fi
7631 elif test -n "$runpath_var"; then
7632 case "$perm_rpath " in
7633 *" $libdir "*) ;;
7634 *) perm_rpath="$perm_rpath $libdir" ;;
7635 esac
7636 fi
7637 done
7638 # Substitute the hardcoded libdirs into the rpath.
7639 if test -n "$hardcode_libdir_separator" &&
7640 test -n "$hardcode_libdirs"; then
7641 libdir="$hardcode_libdirs"
7642 if test -n "$hardcode_libdir_flag_spec_ld"; then
7643 eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\"
7644 else
7645 eval dep_rpath=\"$hardcode_libdir_flag_spec\"
7646 fi
7647 fi
7648 if test -n "$runpath_var" && test -n "$perm_rpath"; then
7649 # We should set the runpath_var.
7650 rpath=
7651 for dir in $perm_rpath; do
7652 rpath="$rpath$dir:"
7653 done
7654 eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var"
7655 fi
7656 test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs"
7657 fi
7658
7659 shlibpath="$finalize_shlibpath"
7660 test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath"
7661 if test -n "$shlibpath"; then
7662 eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var"
7663 fi
7664
7665 # Get the real and link names of the library.
7666 eval shared_ext=\"$shrext_cmds\"
7667 eval library_names=\"$library_names_spec\"
7668 set dummy $library_names
7669 shift
7670 realname="$1"
7671 shift
7672
7673 if test -n "$soname_spec"; then
7674 eval soname=\"$soname_spec\"
7675 else
7676 soname="$realname"
7677 fi
7678 if test -z "$dlname"; then
7679 dlname=$soname
7680 fi
7681
7682 lib="$output_objdir/$realname"
7683 linknames=
7684 for link
7685 do
7686 linknames="$linknames $link"
7687 done
7688
7689 # Use standard objects if they are pic
cristy292e4352009-11-19 13:54:29 +00007690 test -z "$pic_flag" && libobjs=`$ECHO "$libobjs" | $SP2NL | $SED "$lo2o" | $NL2SP`
cristy3ed852e2009-09-05 21:47:34 +00007691 test "X$libobjs" = "X " && libobjs=
7692
7693 delfiles=
7694 if test -n "$export_symbols" && test -n "$include_expsyms"; then
7695 $opt_dry_run || cp "$export_symbols" "$output_objdir/$libname.uexp"
7696 export_symbols="$output_objdir/$libname.uexp"
7697 delfiles="$delfiles $export_symbols"
7698 fi
7699
7700 orig_export_symbols=
7701 case $host_os in
7702 cygwin* | mingw* | cegcc*)
7703 if test -n "$export_symbols" && test -z "$export_symbols_regex"; then
7704 # exporting using user supplied symfile
7705 if test "x`$SED 1q $export_symbols`" != xEXPORTS; then
7706 # and it's NOT already a .def file. Must figure out
7707 # which of the given symbols are data symbols and tag
7708 # them as such. So, trigger use of export_symbols_cmds.
7709 # export_symbols gets reassigned inside the "prepare
7710 # the list of exported symbols" if statement, so the
7711 # include_expsyms logic still works.
7712 orig_export_symbols="$export_symbols"
7713 export_symbols=
7714 always_export_symbols=yes
7715 fi
7716 fi
7717 ;;
7718 esac
7719
7720 # Prepare the list of exported symbols
7721 if test -z "$export_symbols"; then
7722 if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then
7723 func_verbose "generating symbol list for \`$libname.la'"
7724 export_symbols="$output_objdir/$libname.exp"
7725 $opt_dry_run || $RM $export_symbols
7726 cmds=$export_symbols_cmds
7727 save_ifs="$IFS"; IFS='~'
7728 for cmd in $cmds; do
7729 IFS="$save_ifs"
7730 eval cmd=\"$cmd\"
7731 func_len " $cmd"
7732 len=$func_len_result
7733 if test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then
7734 func_show_eval "$cmd" 'exit $?'
7735 skipped_export=false
7736 else
7737 # The command line is too long to execute in one step.
7738 func_verbose "using reloadable object file for export list..."
7739 skipped_export=:
7740 # Break out early, otherwise skipped_export may be
7741 # set to false by a later but shorter cmd.
7742 break
7743 fi
7744 done
7745 IFS="$save_ifs"
7746 if test -n "$export_symbols_regex" && test "X$skipped_export" != "X:"; then
7747 func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
7748 func_show_eval '$MV "${export_symbols}T" "$export_symbols"'
7749 fi
7750 fi
7751 fi
7752
7753 if test -n "$export_symbols" && test -n "$include_expsyms"; then
7754 tmp_export_symbols="$export_symbols"
7755 test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols"
cristy292e4352009-11-19 13:54:29 +00007756 $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"'
cristy3ed852e2009-09-05 21:47:34 +00007757 fi
7758
7759 if test "X$skipped_export" != "X:" && test -n "$orig_export_symbols"; then
7760 # The given exports_symbols file has to be filtered, so filter it.
7761 func_verbose "filter symbol list for \`$libname.la' to tag DATA exports"
7762 # FIXME: $output_objdir/$libname.filter potentially contains lots of
7763 # 's' commands which not all seds can handle. GNU sed should be fine
7764 # though. Also, the filter scales superlinearly with the number of
7765 # global variables. join(1) would be nice here, but unfortunately
7766 # isn't a blessed tool.
7767 $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter
7768 delfiles="$delfiles $export_symbols $output_objdir/$libname.filter"
7769 export_symbols=$output_objdir/$libname.def
7770 $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols
7771 fi
7772
7773 tmp_deplibs=
7774 for test_deplib in $deplibs; do
7775 case " $convenience " in
7776 *" $test_deplib "*) ;;
7777 *)
7778 tmp_deplibs="$tmp_deplibs $test_deplib"
7779 ;;
7780 esac
7781 done
7782 deplibs="$tmp_deplibs"
7783
7784 if test -n "$convenience"; then
7785 if test -n "$whole_archive_flag_spec" &&
7786 test "$compiler_needs_object" = yes &&
7787 test -z "$libobjs"; then
7788 # extract the archives, so we have objects to list.
7789 # TODO: could optimize this to just extract one archive.
7790 whole_archive_flag_spec=
7791 fi
7792 if test -n "$whole_archive_flag_spec"; then
7793 save_libobjs=$libobjs
7794 eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
7795 test "X$libobjs" = "X " && libobjs=
7796 else
7797 gentop="$output_objdir/${outputname}x"
7798 generated="$generated $gentop"
7799
7800 func_extract_archives $gentop $convenience
7801 libobjs="$libobjs $func_extract_archives_result"
7802 test "X$libobjs" = "X " && libobjs=
7803 fi
7804 fi
7805
7806 if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then
7807 eval flag=\"$thread_safe_flag_spec\"
7808 linker_flags="$linker_flags $flag"
7809 fi
7810
7811 # Make a backup of the uninstalled library when relinking
7812 if test "$mode" = relink; then
7813 $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}U && $MV $realname ${realname}U)' || exit $?
7814 fi
7815
7816 # Do each of the archive commands.
7817 if test "$module" = yes && test -n "$module_cmds" ; then
7818 if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
7819 eval test_cmds=\"$module_expsym_cmds\"
7820 cmds=$module_expsym_cmds
7821 else
7822 eval test_cmds=\"$module_cmds\"
7823 cmds=$module_cmds
7824 fi
7825 else
7826 if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
7827 eval test_cmds=\"$archive_expsym_cmds\"
7828 cmds=$archive_expsym_cmds
7829 else
7830 eval test_cmds=\"$archive_cmds\"
7831 cmds=$archive_cmds
7832 fi
7833 fi
7834
7835 if test "X$skipped_export" != "X:" &&
7836 func_len " $test_cmds" &&
7837 len=$func_len_result &&
7838 test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then
7839 :
7840 else
7841 # The command line is too long to link in one step, link piecewise
7842 # or, if using GNU ld and skipped_export is not :, use a linker
7843 # script.
7844
7845 # Save the value of $output and $libobjs because we want to
7846 # use them later. If we have whole_archive_flag_spec, we
7847 # want to use save_libobjs as it was before
7848 # whole_archive_flag_spec was expanded, because we can't
7849 # assume the linker understands whole_archive_flag_spec.
7850 # This may have to be revisited, in case too many
7851 # convenience libraries get linked in and end up exceeding
7852 # the spec.
7853 if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then
7854 save_libobjs=$libobjs
7855 fi
7856 save_output=$output
cristy292e4352009-11-19 13:54:29 +00007857 func_basename "$output"
7858 output_la=$func_basename_result
cristy3ed852e2009-09-05 21:47:34 +00007859
7860 # Clear the reloadable object creation command queue and
7861 # initialize k to one.
7862 test_cmds=
7863 concat_cmds=
7864 objlist=
7865 last_robj=
7866 k=1
7867
7868 if test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "$with_gnu_ld" = yes; then
7869 output=${output_objdir}/${output_la}.lnkscript
7870 func_verbose "creating GNU ld script: $output"
cristy292e4352009-11-19 13:54:29 +00007871 echo 'INPUT (' > $output
cristy3ed852e2009-09-05 21:47:34 +00007872 for obj in $save_libobjs
7873 do
7874 $ECHO "$obj" >> $output
7875 done
cristy292e4352009-11-19 13:54:29 +00007876 echo ')' >> $output
cristy3ed852e2009-09-05 21:47:34 +00007877 delfiles="$delfiles $output"
7878 elif test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "X$file_list_spec" != X; then
7879 output=${output_objdir}/${output_la}.lnk
7880 func_verbose "creating linker input file list: $output"
7881 : > $output
7882 set x $save_libobjs
7883 shift
7884 firstobj=
7885 if test "$compiler_needs_object" = yes; then
7886 firstobj="$1 "
7887 shift
7888 fi
7889 for obj
7890 do
7891 $ECHO "$obj" >> $output
7892 done
7893 delfiles="$delfiles $output"
7894 output=$firstobj\"$file_list_spec$output\"
7895 else
7896 if test -n "$save_libobjs"; then
7897 func_verbose "creating reloadable object files..."
7898 output=$output_objdir/$output_la-${k}.$objext
7899 eval test_cmds=\"$reload_cmds\"
7900 func_len " $test_cmds"
7901 len0=$func_len_result
7902 len=$len0
7903
7904 # Loop over the list of objects to be linked.
7905 for obj in $save_libobjs
7906 do
7907 func_len " $obj"
7908 func_arith $len + $func_len_result
7909 len=$func_arith_result
7910 if test "X$objlist" = X ||
7911 test "$len" -lt "$max_cmd_len"; then
7912 func_append objlist " $obj"
7913 else
7914 # The command $test_cmds is almost too long, add a
7915 # command to the queue.
7916 if test "$k" -eq 1 ; then
7917 # The first file doesn't have a previous command to add.
cristy292e4352009-11-19 13:54:29 +00007918 reload_objs=$objlist
7919 eval concat_cmds=\"$reload_cmds\"
cristy3ed852e2009-09-05 21:47:34 +00007920 else
7921 # All subsequent reloadable object files will link in
7922 # the last one created.
cristy292e4352009-11-19 13:54:29 +00007923 reload_objs="$objlist $last_robj"
7924 eval concat_cmds=\"\$concat_cmds~$reload_cmds~\$RM $last_robj\"
cristy3ed852e2009-09-05 21:47:34 +00007925 fi
7926 last_robj=$output_objdir/$output_la-${k}.$objext
7927 func_arith $k + 1
7928 k=$func_arith_result
7929 output=$output_objdir/$output_la-${k}.$objext
cristy292e4352009-11-19 13:54:29 +00007930 objlist=" $obj"
cristy3ed852e2009-09-05 21:47:34 +00007931 func_len " $last_robj"
7932 func_arith $len0 + $func_len_result
7933 len=$func_arith_result
7934 fi
7935 done
7936 # Handle the remaining objects by creating one last
7937 # reloadable object file. All subsequent reloadable object
7938 # files will link in the last one created.
7939 test -z "$concat_cmds" || concat_cmds=$concat_cmds~
cristy292e4352009-11-19 13:54:29 +00007940 reload_objs="$objlist $last_robj"
7941 eval concat_cmds=\"\${concat_cmds}$reload_cmds\"
cristy3ed852e2009-09-05 21:47:34 +00007942 if test -n "$last_robj"; then
7943 eval concat_cmds=\"\${concat_cmds}~\$RM $last_robj\"
7944 fi
7945 delfiles="$delfiles $output"
7946
7947 else
7948 output=
7949 fi
7950
7951 if ${skipped_export-false}; then
7952 func_verbose "generating symbol list for \`$libname.la'"
7953 export_symbols="$output_objdir/$libname.exp"
7954 $opt_dry_run || $RM $export_symbols
7955 libobjs=$output
7956 # Append the command to create the export file.
7957 test -z "$concat_cmds" || concat_cmds=$concat_cmds~
7958 eval concat_cmds=\"\$concat_cmds$export_symbols_cmds\"
7959 if test -n "$last_robj"; then
7960 eval concat_cmds=\"\$concat_cmds~\$RM $last_robj\"
7961 fi
7962 fi
7963
7964 test -n "$save_libobjs" &&
7965 func_verbose "creating a temporary reloadable object file: $output"
7966
7967 # Loop through the commands generated above and execute them.
7968 save_ifs="$IFS"; IFS='~'
7969 for cmd in $concat_cmds; do
7970 IFS="$save_ifs"
7971 $opt_silent || {
7972 func_quote_for_expand "$cmd"
7973 eval "func_echo $func_quote_for_expand_result"
7974 }
7975 $opt_dry_run || eval "$cmd" || {
7976 lt_exit=$?
7977
7978 # Restore the uninstalled library and exit
7979 if test "$mode" = relink; then
7980 ( cd "$output_objdir" && \
7981 $RM "${realname}T" && \
7982 $MV "${realname}U" "$realname" )
7983 fi
7984
7985 exit $lt_exit
7986 }
7987 done
7988 IFS="$save_ifs"
7989
7990 if test -n "$export_symbols_regex" && ${skipped_export-false}; then
7991 func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
7992 func_show_eval '$MV "${export_symbols}T" "$export_symbols"'
7993 fi
7994 fi
7995
7996 if ${skipped_export-false}; then
7997 if test -n "$export_symbols" && test -n "$include_expsyms"; then
7998 tmp_export_symbols="$export_symbols"
7999 test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols"
cristy292e4352009-11-19 13:54:29 +00008000 $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"'
cristy3ed852e2009-09-05 21:47:34 +00008001 fi
8002
8003 if test -n "$orig_export_symbols"; then
8004 # The given exports_symbols file has to be filtered, so filter it.
8005 func_verbose "filter symbol list for \`$libname.la' to tag DATA exports"
8006 # FIXME: $output_objdir/$libname.filter potentially contains lots of
8007 # 's' commands which not all seds can handle. GNU sed should be fine
8008 # though. Also, the filter scales superlinearly with the number of
8009 # global variables. join(1) would be nice here, but unfortunately
8010 # isn't a blessed tool.
8011 $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter
8012 delfiles="$delfiles $export_symbols $output_objdir/$libname.filter"
8013 export_symbols=$output_objdir/$libname.def
8014 $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols
8015 fi
8016 fi
8017
8018 libobjs=$output
8019 # Restore the value of output.
8020 output=$save_output
8021
8022 if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then
8023 eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
8024 test "X$libobjs" = "X " && libobjs=
8025 fi
8026 # Expand the library linking commands again to reset the
8027 # value of $libobjs for piecewise linking.
8028
8029 # Do each of the archive commands.
8030 if test "$module" = yes && test -n "$module_cmds" ; then
8031 if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
8032 cmds=$module_expsym_cmds
8033 else
8034 cmds=$module_cmds
8035 fi
8036 else
8037 if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
8038 cmds=$archive_expsym_cmds
8039 else
8040 cmds=$archive_cmds
8041 fi
8042 fi
8043 fi
8044
8045 if test -n "$delfiles"; then
8046 # Append the command to remove temporary files to $cmds.
8047 eval cmds=\"\$cmds~\$RM $delfiles\"
8048 fi
8049
8050 # Add any objects from preloaded convenience libraries
8051 if test -n "$dlprefiles"; then
8052 gentop="$output_objdir/${outputname}x"
8053 generated="$generated $gentop"
8054
8055 func_extract_archives $gentop $dlprefiles
8056 libobjs="$libobjs $func_extract_archives_result"
8057 test "X$libobjs" = "X " && libobjs=
8058 fi
8059
8060 save_ifs="$IFS"; IFS='~'
8061 for cmd in $cmds; do
8062 IFS="$save_ifs"
8063 eval cmd=\"$cmd\"
8064 $opt_silent || {
8065 func_quote_for_expand "$cmd"
8066 eval "func_echo $func_quote_for_expand_result"
8067 }
8068 $opt_dry_run || eval "$cmd" || {
8069 lt_exit=$?
8070
8071 # Restore the uninstalled library and exit
8072 if test "$mode" = relink; then
8073 ( cd "$output_objdir" && \
8074 $RM "${realname}T" && \
8075 $MV "${realname}U" "$realname" )
8076 fi
8077
8078 exit $lt_exit
8079 }
8080 done
8081 IFS="$save_ifs"
8082
8083 # Restore the uninstalled library and exit
8084 if test "$mode" = relink; then
8085 $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}T && $MV $realname ${realname}T && $MV ${realname}U $realname)' || exit $?
8086
8087 if test -n "$convenience"; then
8088 if test -z "$whole_archive_flag_spec"; then
8089 func_show_eval '${RM}r "$gentop"'
8090 fi
8091 fi
8092
8093 exit $EXIT_SUCCESS
8094 fi
8095
8096 # Create links to the real library.
8097 for linkname in $linknames; do
8098 if test "$realname" != "$linkname"; then
8099 func_show_eval '(cd "$output_objdir" && $RM "$linkname" && $LN_S "$realname" "$linkname")' 'exit $?'
8100 fi
8101 done
8102
8103 # If -module or -export-dynamic was specified, set the dlname.
8104 if test "$module" = yes || test "$export_dynamic" = yes; then
8105 # On all known operating systems, these are identical.
8106 dlname="$soname"
8107 fi
8108 fi
8109 ;;
8110
8111 obj)
8112 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
8113 func_warning "\`-dlopen' is ignored for objects"
8114 fi
8115
8116 case " $deplibs" in
8117 *\ -l* | *\ -L*)
8118 func_warning "\`-l' and \`-L' are ignored for objects" ;;
8119 esac
8120
8121 test -n "$rpath" && \
8122 func_warning "\`-rpath' is ignored for objects"
8123
8124 test -n "$xrpath" && \
8125 func_warning "\`-R' is ignored for objects"
8126
8127 test -n "$vinfo" && \
8128 func_warning "\`-version-info' is ignored for objects"
8129
8130 test -n "$release" && \
8131 func_warning "\`-release' is ignored for objects"
8132
8133 case $output in
8134 *.lo)
8135 test -n "$objs$old_deplibs" && \
8136 func_fatal_error "cannot build library object \`$output' from non-libtool objects"
8137
8138 libobj=$output
8139 func_lo2o "$libobj"
8140 obj=$func_lo2o_result
8141 ;;
8142 *)
8143 libobj=
8144 obj="$output"
8145 ;;
8146 esac
8147
8148 # Delete the old objects.
8149 $opt_dry_run || $RM $obj $libobj
8150
8151 # Objects from convenience libraries. This assumes
8152 # single-version convenience libraries. Whenever we create
8153 # different ones for PIC/non-PIC, this we'll have to duplicate
8154 # the extraction.
8155 reload_conv_objs=
8156 gentop=
8157 # reload_cmds runs $LD directly, so let us get rid of
8158 # -Wl from whole_archive_flag_spec and hope we can get by with
8159 # turning comma into space..
8160 wl=
8161
8162 if test -n "$convenience"; then
8163 if test -n "$whole_archive_flag_spec"; then
8164 eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\"
cristy292e4352009-11-19 13:54:29 +00008165 reload_conv_objs=$reload_objs\ `$ECHO "$tmp_whole_archive_flags" | $SED 's|,| |g'`
cristy3ed852e2009-09-05 21:47:34 +00008166 else
8167 gentop="$output_objdir/${obj}x"
8168 generated="$generated $gentop"
8169
8170 func_extract_archives $gentop $convenience
8171 reload_conv_objs="$reload_objs $func_extract_archives_result"
8172 fi
8173 fi
8174
8175 # Create the old-style object.
cristy292e4352009-11-19 13:54:29 +00008176 reload_objs="$objs$old_deplibs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.${libext}$/d; /\.lib$/d; $lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test
cristy3ed852e2009-09-05 21:47:34 +00008177
8178 output="$obj"
8179 func_execute_cmds "$reload_cmds" 'exit $?'
8180
8181 # Exit if we aren't doing a library object file.
8182 if test -z "$libobj"; then
8183 if test -n "$gentop"; then
8184 func_show_eval '${RM}r "$gentop"'
8185 fi
8186
8187 exit $EXIT_SUCCESS
8188 fi
8189
8190 if test "$build_libtool_libs" != yes; then
8191 if test -n "$gentop"; then
8192 func_show_eval '${RM}r "$gentop"'
8193 fi
8194
8195 # Create an invalid libtool object if no PIC, so that we don't
8196 # accidentally link it into a program.
8197 # $show "echo timestamp > $libobj"
8198 # $opt_dry_run || eval "echo timestamp > $libobj" || exit $?
8199 exit $EXIT_SUCCESS
8200 fi
8201
8202 if test -n "$pic_flag" || test "$pic_mode" != default; then
8203 # Only do commands if we really have different PIC objects.
8204 reload_objs="$libobjs $reload_conv_objs"
8205 output="$libobj"
8206 func_execute_cmds "$reload_cmds" 'exit $?'
8207 fi
8208
8209 if test -n "$gentop"; then
8210 func_show_eval '${RM}r "$gentop"'
8211 fi
8212
8213 exit $EXIT_SUCCESS
8214 ;;
8215
8216 prog)
8217 case $host in
8218 *cygwin*) func_stripname '' '.exe' "$output"
8219 output=$func_stripname_result.exe;;
8220 esac
8221 test -n "$vinfo" && \
8222 func_warning "\`-version-info' is ignored for programs"
8223
8224 test -n "$release" && \
8225 func_warning "\`-release' is ignored for programs"
8226
8227 test "$preload" = yes \
8228 && test "$dlopen_support" = unknown \
8229 && test "$dlopen_self" = unknown \
8230 && test "$dlopen_self_static" = unknown && \
8231 func_warning "\`LT_INIT([dlopen])' not used. Assuming no dlopen support."
8232
8233 case $host in
8234 *-*-rhapsody* | *-*-darwin1.[012])
8235 # On Rhapsody replace the C library is the System framework
cristy292e4352009-11-19 13:54:29 +00008236 compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's/ -lc / System.ltframework /'`
8237 finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's/ -lc / System.ltframework /'`
cristy3ed852e2009-09-05 21:47:34 +00008238 ;;
8239 esac
8240
8241 case $host in
8242 *-*-darwin*)
8243 # Don't allow lazy linking, it breaks C++ global constructors
8244 # But is supposedly fixed on 10.4 or later (yay!).
8245 if test "$tagname" = CXX ; then
8246 case ${MACOSX_DEPLOYMENT_TARGET-10.0} in
8247 10.[0123])
8248 compile_command="$compile_command ${wl}-bind_at_load"
8249 finalize_command="$finalize_command ${wl}-bind_at_load"
8250 ;;
8251 esac
8252 fi
8253 # Time to change all our "foo.ltframework" stuff back to "-framework foo"
cristy292e4352009-11-19 13:54:29 +00008254 compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
8255 finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
cristy3ed852e2009-09-05 21:47:34 +00008256 ;;
8257 esac
8258
8259
8260 # move library search paths that coincide with paths to not yet
8261 # installed libraries to the beginning of the library search list
8262 new_libs=
8263 for path in $notinst_path; do
8264 case " $new_libs " in
8265 *" -L$path/$objdir "*) ;;
8266 *)
8267 case " $compile_deplibs " in
8268 *" -L$path/$objdir "*)
8269 new_libs="$new_libs -L$path/$objdir" ;;
8270 esac
8271 ;;
8272 esac
8273 done
8274 for deplib in $compile_deplibs; do
8275 case $deplib in
8276 -L*)
8277 case " $new_libs " in
8278 *" $deplib "*) ;;
8279 *) new_libs="$new_libs $deplib" ;;
8280 esac
8281 ;;
8282 *) new_libs="$new_libs $deplib" ;;
8283 esac
8284 done
8285 compile_deplibs="$new_libs"
8286
8287
8288 compile_command="$compile_command $compile_deplibs"
8289 finalize_command="$finalize_command $finalize_deplibs"
8290
8291 if test -n "$rpath$xrpath"; then
8292 # If the user specified any rpath flags, then add them.
8293 for libdir in $rpath $xrpath; do
8294 # This is the magic to use -rpath.
8295 case "$finalize_rpath " in
8296 *" $libdir "*) ;;
8297 *) finalize_rpath="$finalize_rpath $libdir" ;;
8298 esac
8299 done
8300 fi
8301
8302 # Now hardcode the library paths
8303 rpath=
8304 hardcode_libdirs=
8305 for libdir in $compile_rpath $finalize_rpath; do
8306 if test -n "$hardcode_libdir_flag_spec"; then
8307 if test -n "$hardcode_libdir_separator"; then
8308 if test -z "$hardcode_libdirs"; then
8309 hardcode_libdirs="$libdir"
8310 else
8311 # Just accumulate the unique libdirs.
8312 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
8313 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
8314 ;;
8315 *)
8316 hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
8317 ;;
8318 esac
8319 fi
8320 else
8321 eval flag=\"$hardcode_libdir_flag_spec\"
8322 rpath="$rpath $flag"
8323 fi
8324 elif test -n "$runpath_var"; then
8325 case "$perm_rpath " in
8326 *" $libdir "*) ;;
8327 *) perm_rpath="$perm_rpath $libdir" ;;
8328 esac
8329 fi
8330 case $host in
8331 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
8332 testbindir=`${ECHO} "$libdir" | ${SED} -e 's*/lib$*/bin*'`
8333 case :$dllsearchpath: in
8334 *":$libdir:"*) ;;
8335 ::) dllsearchpath=$libdir;;
8336 *) dllsearchpath="$dllsearchpath:$libdir";;
8337 esac
8338 case :$dllsearchpath: in
8339 *":$testbindir:"*) ;;
8340 ::) dllsearchpath=$testbindir;;
8341 *) dllsearchpath="$dllsearchpath:$testbindir";;
8342 esac
8343 ;;
8344 esac
8345 done
8346 # Substitute the hardcoded libdirs into the rpath.
8347 if test -n "$hardcode_libdir_separator" &&
8348 test -n "$hardcode_libdirs"; then
8349 libdir="$hardcode_libdirs"
8350 eval rpath=\" $hardcode_libdir_flag_spec\"
8351 fi
8352 compile_rpath="$rpath"
8353
8354 rpath=
8355 hardcode_libdirs=
8356 for libdir in $finalize_rpath; do
8357 if test -n "$hardcode_libdir_flag_spec"; then
8358 if test -n "$hardcode_libdir_separator"; then
8359 if test -z "$hardcode_libdirs"; then
8360 hardcode_libdirs="$libdir"
8361 else
8362 # Just accumulate the unique libdirs.
8363 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
8364 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
8365 ;;
8366 *)
8367 hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
8368 ;;
8369 esac
8370 fi
8371 else
8372 eval flag=\"$hardcode_libdir_flag_spec\"
8373 rpath="$rpath $flag"
8374 fi
8375 elif test -n "$runpath_var"; then
8376 case "$finalize_perm_rpath " in
8377 *" $libdir "*) ;;
8378 *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;;
8379 esac
8380 fi
8381 done
8382 # Substitute the hardcoded libdirs into the rpath.
8383 if test -n "$hardcode_libdir_separator" &&
8384 test -n "$hardcode_libdirs"; then
8385 libdir="$hardcode_libdirs"
8386 eval rpath=\" $hardcode_libdir_flag_spec\"
8387 fi
8388 finalize_rpath="$rpath"
8389
8390 if test -n "$libobjs" && test "$build_old_libs" = yes; then
8391 # Transform all the library objects into standard objects.
cristy292e4352009-11-19 13:54:29 +00008392 compile_command=`$ECHO "$compile_command" | $SP2NL | $SED "$lo2o" | $NL2SP`
8393 finalize_command=`$ECHO "$finalize_command" | $SP2NL | $SED "$lo2o" | $NL2SP`
cristy3ed852e2009-09-05 21:47:34 +00008394 fi
8395
8396 func_generate_dlsyms "$outputname" "@PROGRAM@" "no"
8397
8398 # template prelinking step
8399 if test -n "$prelink_cmds"; then
8400 func_execute_cmds "$prelink_cmds" 'exit $?'
8401 fi
8402
8403 wrappers_required=yes
8404 case $host in
cristy292e4352009-11-19 13:54:29 +00008405 *cegcc* | *mingw32ce*)
8406 # Disable wrappers for cegcc and mingw32ce hosts, we are cross compiling anyway.
8407 wrappers_required=no
8408 ;;
cristy3ed852e2009-09-05 21:47:34 +00008409 *cygwin* | *mingw* )
8410 if test "$build_libtool_libs" != yes; then
8411 wrappers_required=no
8412 fi
8413 ;;
cristy3ed852e2009-09-05 21:47:34 +00008414 *)
8415 if test "$need_relink" = no || test "$build_libtool_libs" != yes; then
8416 wrappers_required=no
8417 fi
8418 ;;
8419 esac
8420 if test "$wrappers_required" = no; then
8421 # Replace the output file specification.
cristy292e4352009-11-19 13:54:29 +00008422 compile_command=`$ECHO "$compile_command" | $SED 's%@OUTPUT@%'"$output"'%g'`
cristy3ed852e2009-09-05 21:47:34 +00008423 link_command="$compile_command$compile_rpath"
8424
8425 # We have no uninstalled library dependencies, so finalize right now.
8426 exit_status=0
8427 func_show_eval "$link_command" 'exit_status=$?'
8428
8429 # Delete the generated files.
8430 if test -f "$output_objdir/${outputname}S.${objext}"; then
8431 func_show_eval '$RM "$output_objdir/${outputname}S.${objext}"'
8432 fi
8433
8434 exit $exit_status
8435 fi
8436
8437 if test -n "$compile_shlibpath$finalize_shlibpath"; then
8438 compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command"
8439 fi
8440 if test -n "$finalize_shlibpath"; then
8441 finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command"
8442 fi
8443
8444 compile_var=
8445 finalize_var=
8446 if test -n "$runpath_var"; then
8447 if test -n "$perm_rpath"; then
8448 # We should set the runpath_var.
8449 rpath=
8450 for dir in $perm_rpath; do
8451 rpath="$rpath$dir:"
8452 done
8453 compile_var="$runpath_var=\"$rpath\$$runpath_var\" "
8454 fi
8455 if test -n "$finalize_perm_rpath"; then
8456 # We should set the runpath_var.
8457 rpath=
8458 for dir in $finalize_perm_rpath; do
8459 rpath="$rpath$dir:"
8460 done
8461 finalize_var="$runpath_var=\"$rpath\$$runpath_var\" "
8462 fi
8463 fi
8464
8465 if test "$no_install" = yes; then
8466 # We don't need to create a wrapper script.
8467 link_command="$compile_var$compile_command$compile_rpath"
8468 # Replace the output file specification.
cristy292e4352009-11-19 13:54:29 +00008469 link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output"'%g'`
cristy3ed852e2009-09-05 21:47:34 +00008470 # Delete the old output file.
8471 $opt_dry_run || $RM $output
8472 # Link the executable and exit
8473 func_show_eval "$link_command" 'exit $?'
8474 exit $EXIT_SUCCESS
8475 fi
8476
8477 if test "$hardcode_action" = relink; then
8478 # Fast installation is not supported
8479 link_command="$compile_var$compile_command$compile_rpath"
8480 relink_command="$finalize_var$finalize_command$finalize_rpath"
8481
8482 func_warning "this platform does not like uninstalled shared libraries"
8483 func_warning "\`$output' will be relinked during installation"
8484 else
8485 if test "$fast_install" != no; then
8486 link_command="$finalize_var$compile_command$finalize_rpath"
8487 if test "$fast_install" = yes; then
cristy292e4352009-11-19 13:54:29 +00008488 relink_command=`$ECHO "$compile_var$compile_command$compile_rpath" | $SED 's%@OUTPUT@%\$progdir/\$file%g'`
cristy3ed852e2009-09-05 21:47:34 +00008489 else
8490 # fast_install is set to needless
8491 relink_command=
8492 fi
8493 else
8494 link_command="$compile_var$compile_command$compile_rpath"
8495 relink_command="$finalize_var$finalize_command$finalize_rpath"
8496 fi
8497 fi
8498
8499 # Replace the output file specification.
cristy292e4352009-11-19 13:54:29 +00008500 link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`
cristy3ed852e2009-09-05 21:47:34 +00008501
8502 # Delete the old output files.
8503 $opt_dry_run || $RM $output $output_objdir/$outputname $output_objdir/lt-$outputname
8504
8505 func_show_eval "$link_command" 'exit $?'
8506
8507 # Now create the wrapper script.
8508 func_verbose "creating $output"
8509
8510 # Quote the relink command for shipping.
8511 if test -n "$relink_command"; then
8512 # Preserve any variables that may affect compiler behavior
8513 for var in $variables_saved_for_relink; do
8514 if eval test -z \"\${$var+set}\"; then
8515 relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command"
8516 elif eval var_value=\$$var; test -z "$var_value"; then
8517 relink_command="$var=; export $var; $relink_command"
8518 else
8519 func_quote_for_eval "$var_value"
8520 relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command"
8521 fi
8522 done
8523 relink_command="(cd `pwd`; $relink_command)"
cristy292e4352009-11-19 13:54:29 +00008524 relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"`
cristy3ed852e2009-09-05 21:47:34 +00008525 fi
8526
8527 # Only actually do things if not in dry run mode.
8528 $opt_dry_run || {
8529 # win32 will think the script is a binary if it has
8530 # a .exe suffix, so we strip it off here.
8531 case $output in
8532 *.exe) func_stripname '' '.exe' "$output"
8533 output=$func_stripname_result ;;
8534 esac
8535 # test for cygwin because mv fails w/o .exe extensions
8536 case $host in
8537 *cygwin*)
8538 exeext=.exe
8539 func_stripname '' '.exe' "$outputname"
8540 outputname=$func_stripname_result ;;
8541 *) exeext= ;;
8542 esac
8543 case $host in
8544 *cygwin* | *mingw* )
8545 func_dirname_and_basename "$output" "" "."
8546 output_name=$func_basename_result
8547 output_path=$func_dirname_result
8548 cwrappersource="$output_path/$objdir/lt-$output_name.c"
8549 cwrapper="$output_path/$output_name.exe"
8550 $RM $cwrappersource $cwrapper
8551 trap "$RM $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15
8552
8553 func_emit_cwrapperexe_src > $cwrappersource
8554
8555 # The wrapper executable is built using the $host compiler,
8556 # because it contains $host paths and files. If cross-
8557 # compiling, it, like the target executable, must be
8558 # executed on the $host or under an emulation environment.
8559 $opt_dry_run || {
8560 $LTCC $LTCFLAGS -o $cwrapper $cwrappersource
8561 $STRIP $cwrapper
8562 }
8563
8564 # Now, create the wrapper script for func_source use:
8565 func_ltwrapper_scriptname $cwrapper
8566 $RM $func_ltwrapper_scriptname_result
8567 trap "$RM $func_ltwrapper_scriptname_result; exit $EXIT_FAILURE" 1 2 15
8568 $opt_dry_run || {
8569 # note: this script will not be executed, so do not chmod.
8570 if test "x$build" = "x$host" ; then
8571 $cwrapper --lt-dump-script > $func_ltwrapper_scriptname_result
8572 else
8573 func_emit_wrapper no > $func_ltwrapper_scriptname_result
8574 fi
8575 }
8576 ;;
8577 * )
8578 $RM $output
8579 trap "$RM $output; exit $EXIT_FAILURE" 1 2 15
8580
8581 func_emit_wrapper no > $output
8582 chmod +x $output
8583 ;;
8584 esac
8585 }
8586 exit $EXIT_SUCCESS
8587 ;;
8588 esac
8589
8590 # See if we need to build an old-fashioned archive.
8591 for oldlib in $oldlibs; do
8592
8593 if test "$build_libtool_libs" = convenience; then
8594 oldobjs="$libobjs_save $symfileobj"
8595 addlibs="$convenience"
8596 build_libtool_libs=no
8597 else
8598 if test "$build_libtool_libs" = module; then
8599 oldobjs="$libobjs_save"
8600 build_libtool_libs=no
8601 else
8602 oldobjs="$old_deplibs $non_pic_objects"
8603 if test "$preload" = yes && test -f "$symfileobj"; then
8604 oldobjs="$oldobjs $symfileobj"
8605 fi
8606 fi
8607 addlibs="$old_convenience"
8608 fi
8609
8610 if test -n "$addlibs"; then
8611 gentop="$output_objdir/${outputname}x"
8612 generated="$generated $gentop"
8613
8614 func_extract_archives $gentop $addlibs
8615 oldobjs="$oldobjs $func_extract_archives_result"
8616 fi
8617
8618 # Do each command in the archive commands.
8619 if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then
8620 cmds=$old_archive_from_new_cmds
8621 else
8622
8623 # Add any objects from preloaded convenience libraries
8624 if test -n "$dlprefiles"; then
8625 gentop="$output_objdir/${outputname}x"
8626 generated="$generated $gentop"
8627
8628 func_extract_archives $gentop $dlprefiles
8629 oldobjs="$oldobjs $func_extract_archives_result"
8630 fi
8631
8632 # POSIX demands no paths to be encoded in archives. We have
8633 # to avoid creating archives with duplicate basenames if we
8634 # might have to extract them afterwards, e.g., when creating a
8635 # static archive out of a convenience library, or when linking
8636 # the entirety of a libtool archive into another (currently
8637 # not supported by libtool).
8638 if (for obj in $oldobjs
8639 do
8640 func_basename "$obj"
8641 $ECHO "$func_basename_result"
8642 done | sort | sort -uc >/dev/null 2>&1); then
8643 :
8644 else
cristy292e4352009-11-19 13:54:29 +00008645 echo "copying selected object files to avoid basename conflicts..."
cristy3ed852e2009-09-05 21:47:34 +00008646 gentop="$output_objdir/${outputname}x"
8647 generated="$generated $gentop"
8648 func_mkdir_p "$gentop"
8649 save_oldobjs=$oldobjs
8650 oldobjs=
8651 counter=1
8652 for obj in $save_oldobjs
8653 do
8654 func_basename "$obj"
8655 objbase="$func_basename_result"
8656 case " $oldobjs " in
8657 " ") oldobjs=$obj ;;
8658 *[\ /]"$objbase "*)
8659 while :; do
8660 # Make sure we don't pick an alternate name that also
8661 # overlaps.
8662 newobj=lt$counter-$objbase
8663 func_arith $counter + 1
8664 counter=$func_arith_result
8665 case " $oldobjs " in
8666 *[\ /]"$newobj "*) ;;
8667 *) if test ! -f "$gentop/$newobj"; then break; fi ;;
8668 esac
8669 done
8670 func_show_eval "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj"
8671 oldobjs="$oldobjs $gentop/$newobj"
8672 ;;
8673 *) oldobjs="$oldobjs $obj" ;;
8674 esac
8675 done
8676 fi
8677 eval cmds=\"$old_archive_cmds\"
8678
8679 func_len " $cmds"
8680 len=$func_len_result
8681 if test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then
8682 cmds=$old_archive_cmds
8683 else
8684 # the command line is too long to link in one step, link in parts
8685 func_verbose "using piecewise archive linking..."
8686 save_RANLIB=$RANLIB
8687 RANLIB=:
8688 objlist=
8689 concat_cmds=
8690 save_oldobjs=$oldobjs
8691 oldobjs=
8692 # Is there a better way of finding the last object in the list?
8693 for obj in $save_oldobjs
8694 do
8695 last_oldobj=$obj
8696 done
8697 eval test_cmds=\"$old_archive_cmds\"
8698 func_len " $test_cmds"
8699 len0=$func_len_result
8700 len=$len0
8701 for obj in $save_oldobjs
8702 do
8703 func_len " $obj"
8704 func_arith $len + $func_len_result
8705 len=$func_arith_result
8706 func_append objlist " $obj"
8707 if test "$len" -lt "$max_cmd_len"; then
8708 :
8709 else
8710 # the above command should be used before it gets too long
8711 oldobjs=$objlist
8712 if test "$obj" = "$last_oldobj" ; then
8713 RANLIB=$save_RANLIB
8714 fi
8715 test -z "$concat_cmds" || concat_cmds=$concat_cmds~
8716 eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\"
8717 objlist=
8718 len=$len0
8719 fi
8720 done
8721 RANLIB=$save_RANLIB
8722 oldobjs=$objlist
8723 if test "X$oldobjs" = "X" ; then
8724 eval cmds=\"\$concat_cmds\"
8725 else
8726 eval cmds=\"\$concat_cmds~\$old_archive_cmds\"
8727 fi
8728 fi
8729 fi
8730 func_execute_cmds "$cmds" 'exit $?'
8731 done
8732
8733 test -n "$generated" && \
8734 func_show_eval "${RM}r$generated"
8735
8736 # Now create the libtool archive.
8737 case $output in
8738 *.la)
8739 old_library=
8740 test "$build_old_libs" = yes && old_library="$libname.$libext"
8741 func_verbose "creating $output"
8742
8743 # Preserve any variables that may affect compiler behavior
8744 for var in $variables_saved_for_relink; do
8745 if eval test -z \"\${$var+set}\"; then
8746 relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command"
8747 elif eval var_value=\$$var; test -z "$var_value"; then
8748 relink_command="$var=; export $var; $relink_command"
8749 else
8750 func_quote_for_eval "$var_value"
8751 relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command"
8752 fi
8753 done
8754 # Quote the link command for shipping.
8755 relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)"
cristy292e4352009-11-19 13:54:29 +00008756 relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"`
cristy3ed852e2009-09-05 21:47:34 +00008757 if test "$hardcode_automatic" = yes ; then
8758 relink_command=
8759 fi
8760
8761 # Only create the output if not a dry run.
8762 $opt_dry_run || {
8763 for installed in no yes; do
8764 if test "$installed" = yes; then
8765 if test -z "$install_libdir"; then
8766 break
8767 fi
8768 output="$output_objdir/$outputname"i
8769 # Replace all uninstalled libtool libraries with the installed ones
8770 newdependency_libs=
8771 for deplib in $dependency_libs; do
8772 case $deplib in
8773 *.la)
8774 func_basename "$deplib"
8775 name="$func_basename_result"
8776 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
8777 test -z "$libdir" && \
8778 func_fatal_error "\`$deplib' is not a valid libtool archive"
8779 newdependency_libs="$newdependency_libs $libdir/$name"
8780 ;;
8781 *) newdependency_libs="$newdependency_libs $deplib" ;;
8782 esac
8783 done
8784 dependency_libs="$newdependency_libs"
8785 newdlfiles=
8786
8787 for lib in $dlfiles; do
8788 case $lib in
8789 *.la)
8790 func_basename "$lib"
8791 name="$func_basename_result"
8792 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
8793 test -z "$libdir" && \
8794 func_fatal_error "\`$lib' is not a valid libtool archive"
8795 newdlfiles="$newdlfiles $libdir/$name"
8796 ;;
8797 *) newdlfiles="$newdlfiles $lib" ;;
8798 esac
8799 done
8800 dlfiles="$newdlfiles"
8801 newdlprefiles=
8802 for lib in $dlprefiles; do
8803 case $lib in
8804 *.la)
8805 # Only pass preopened files to the pseudo-archive (for
8806 # eventual linking with the app. that links it) if we
8807 # didn't already link the preopened objects directly into
8808 # the library:
8809 func_basename "$lib"
8810 name="$func_basename_result"
8811 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
8812 test -z "$libdir" && \
8813 func_fatal_error "\`$lib' is not a valid libtool archive"
8814 newdlprefiles="$newdlprefiles $libdir/$name"
8815 ;;
8816 esac
8817 done
8818 dlprefiles="$newdlprefiles"
8819 else
8820 newdlfiles=
8821 for lib in $dlfiles; do
8822 case $lib in
8823 [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
8824 *) abs=`pwd`"/$lib" ;;
8825 esac
8826 newdlfiles="$newdlfiles $abs"
8827 done
8828 dlfiles="$newdlfiles"
8829 newdlprefiles=
8830 for lib in $dlprefiles; do
8831 case $lib in
8832 [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
8833 *) abs=`pwd`"/$lib" ;;
8834 esac
8835 newdlprefiles="$newdlprefiles $abs"
8836 done
8837 dlprefiles="$newdlprefiles"
8838 fi
8839 $RM $output
8840 # place dlname in correct position for cygwin
cristy292e4352009-11-19 13:54:29 +00008841 # In fact, it would be nice if we could use this code for all target
8842 # systems that can't hard-code library paths into their executables
8843 # and that have no shared library path variable independent of PATH,
8844 # but it turns out we can't easily determine that from inspecting
8845 # libtool variables, so we have to hard-code the OSs to which it
8846 # applies here; at the moment, that means platforms that use the PE
8847 # object format with DLL files. See the long comment at the top of
8848 # tests/bindir.at for full details.
cristy3ed852e2009-09-05 21:47:34 +00008849 tdlname=$dlname
8850 case $host,$output,$installed,$module,$dlname in
cristy292e4352009-11-19 13:54:29 +00008851 *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll | *cegcc*,*lai,yes,no,*.dll)
8852 # If a -bindir argument was supplied, place the dll there.
8853 if test "x$bindir" != x ;
8854 then
8855 func_relative_path "$install_libdir" "$bindir"
8856 tdlname=$func_relative_path_result$dlname
8857 else
8858 # Otherwise fall back on heuristic.
8859 tdlname=../bin/$dlname
8860 fi
8861 ;;
cristy3ed852e2009-09-05 21:47:34 +00008862 esac
8863 $ECHO > $output "\
8864# $outputname - a libtool library file
8865# Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
8866#
8867# Please DO NOT delete this file!
8868# It is necessary for linking the library.
8869
8870# The name that we can dlopen(3).
8871dlname='$tdlname'
8872
8873# Names of this library.
8874library_names='$library_names'
8875
8876# The name of the static archive.
8877old_library='$old_library'
8878
8879# Linker flags that can not go in dependency_libs.
8880inherited_linker_flags='$new_inherited_linker_flags'
8881
8882# Libraries that this one depends upon.
8883dependency_libs='$dependency_libs'
8884
8885# Names of additional weak libraries provided by this library
8886weak_library_names='$weak_libs'
8887
8888# Version information for $libname.
8889current=$current
8890age=$age
8891revision=$revision
8892
8893# Is this an already installed library?
8894installed=$installed
8895
8896# Should we warn about portability when linking against -modules?
8897shouldnotlink=$module
8898
8899# Files to dlopen/dlpreopen
8900dlopen='$dlfiles'
8901dlpreopen='$dlprefiles'
8902
8903# Directory that this library needs to be installed in:
8904libdir='$install_libdir'"
8905 if test "$installed" = no && test "$need_relink" = yes; then
8906 $ECHO >> $output "\
8907relink_command=\"$relink_command\""
8908 fi
8909 done
8910 }
8911
8912 # Do a symbolic link so that the libtool archive can be found in
8913 # LD_LIBRARY_PATH before the program is installed.
8914 func_show_eval '( cd "$output_objdir" && $RM "$outputname" && $LN_S "../$outputname" "$outputname" )' 'exit $?'
8915 ;;
8916 esac
8917 exit $EXIT_SUCCESS
8918}
8919
8920{ test "$mode" = link || test "$mode" = relink; } &&
8921 func_mode_link ${1+"$@"}
8922
8923
8924# func_mode_uninstall arg...
8925func_mode_uninstall ()
8926{
8927 $opt_debug
8928 RM="$nonopt"
8929 files=
8930 rmforce=
8931 exit_status=0
8932
8933 # This variable tells wrapper scripts just to set variables rather
8934 # than running their programs.
8935 libtool_install_magic="$magic"
8936
8937 for arg
8938 do
8939 case $arg in
8940 -f) RM="$RM $arg"; rmforce=yes ;;
8941 -*) RM="$RM $arg" ;;
8942 *) files="$files $arg" ;;
8943 esac
8944 done
8945
8946 test -z "$RM" && \
8947 func_fatal_help "you must specify an RM program"
8948
8949 rmdirs=
8950
8951 origobjdir="$objdir"
8952 for file in $files; do
8953 func_dirname "$file" "" "."
8954 dir="$func_dirname_result"
8955 if test "X$dir" = X.; then
8956 objdir="$origobjdir"
8957 else
8958 objdir="$dir/$origobjdir"
8959 fi
8960 func_basename "$file"
8961 name="$func_basename_result"
8962 test "$mode" = uninstall && objdir="$dir"
8963
8964 # Remember objdir for removal later, being careful to avoid duplicates
8965 if test "$mode" = clean; then
8966 case " $rmdirs " in
8967 *" $objdir "*) ;;
8968 *) rmdirs="$rmdirs $objdir" ;;
8969 esac
8970 fi
8971
8972 # Don't error if the file doesn't exist and rm -f was used.
8973 if { test -L "$file"; } >/dev/null 2>&1 ||
8974 { test -h "$file"; } >/dev/null 2>&1 ||
8975 test -f "$file"; then
8976 :
8977 elif test -d "$file"; then
8978 exit_status=1
8979 continue
8980 elif test "$rmforce" = yes; then
8981 continue
8982 fi
8983
8984 rmfiles="$file"
8985
8986 case $name in
8987 *.la)
8988 # Possibly a libtool archive, so verify it.
8989 if func_lalib_p "$file"; then
8990 func_source $dir/$name
8991
8992 # Delete the libtool libraries and symlinks.
8993 for n in $library_names; do
8994 rmfiles="$rmfiles $objdir/$n"
8995 done
8996 test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library"
8997
8998 case "$mode" in
8999 clean)
9000 case " $library_names " in
9001 # " " in the beginning catches empty $dlname
9002 *" $dlname "*) ;;
9003 *) rmfiles="$rmfiles $objdir/$dlname" ;;
9004 esac
9005 test -n "$libdir" && rmfiles="$rmfiles $objdir/$name $objdir/${name}i"
9006 ;;
9007 uninstall)
9008 if test -n "$library_names"; then
9009 # Do each command in the postuninstall commands.
9010 func_execute_cmds "$postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1'
9011 fi
9012
9013 if test -n "$old_library"; then
9014 # Do each command in the old_postuninstall commands.
9015 func_execute_cmds "$old_postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1'
9016 fi
9017 # FIXME: should reinstall the best remaining shared library.
9018 ;;
9019 esac
9020 fi
9021 ;;
9022
9023 *.lo)
9024 # Possibly a libtool object, so verify it.
9025 if func_lalib_p "$file"; then
9026
9027 # Read the .lo file
9028 func_source $dir/$name
9029
9030 # Add PIC object to the list of files to remove.
9031 if test -n "$pic_object" &&
9032 test "$pic_object" != none; then
9033 rmfiles="$rmfiles $dir/$pic_object"
9034 fi
9035
9036 # Add non-PIC object to the list of files to remove.
9037 if test -n "$non_pic_object" &&
9038 test "$non_pic_object" != none; then
9039 rmfiles="$rmfiles $dir/$non_pic_object"
9040 fi
9041 fi
9042 ;;
9043
9044 *)
9045 if test "$mode" = clean ; then
9046 noexename=$name
9047 case $file in
9048 *.exe)
9049 func_stripname '' '.exe' "$file"
9050 file=$func_stripname_result
9051 func_stripname '' '.exe' "$name"
9052 noexename=$func_stripname_result
9053 # $file with .exe has already been added to rmfiles,
9054 # add $file without .exe
9055 rmfiles="$rmfiles $file"
9056 ;;
9057 esac
9058 # Do a test to see if this is a libtool program.
9059 if func_ltwrapper_p "$file"; then
9060 if func_ltwrapper_executable_p "$file"; then
9061 func_ltwrapper_scriptname "$file"
9062 relink_command=
9063 func_source $func_ltwrapper_scriptname_result
9064 rmfiles="$rmfiles $func_ltwrapper_scriptname_result"
9065 else
9066 relink_command=
9067 func_source $dir/$noexename
9068 fi
9069
9070 # note $name still contains .exe if it was in $file originally
9071 # as does the version of $file that was added into $rmfiles
9072 rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}"
9073 if test "$fast_install" = yes && test -n "$relink_command"; then
9074 rmfiles="$rmfiles $objdir/lt-$name"
9075 fi
9076 if test "X$noexename" != "X$name" ; then
9077 rmfiles="$rmfiles $objdir/lt-${noexename}.c"
9078 fi
9079 fi
9080 fi
9081 ;;
9082 esac
9083 func_show_eval "$RM $rmfiles" 'exit_status=1'
9084 done
9085 objdir="$origobjdir"
9086
9087 # Try to remove the ${objdir}s in the directories where we deleted files
9088 for dir in $rmdirs; do
9089 if test -d "$dir"; then
9090 func_show_eval "rmdir $dir >/dev/null 2>&1"
9091 fi
9092 done
9093
9094 exit $exit_status
9095}
9096
9097{ test "$mode" = uninstall || test "$mode" = clean; } &&
9098 func_mode_uninstall ${1+"$@"}
9099
9100test -z "$mode" && {
9101 help="$generic_help"
9102 func_fatal_help "you must specify a MODE"
9103}
9104
9105test -z "$exec_cmd" && \
9106 func_fatal_help "invalid operation mode \`$mode'"
9107
9108if test -n "$exec_cmd"; then
9109 eval exec "$exec_cmd"
9110 exit $EXIT_FAILURE
9111fi
9112
9113exit $exit_status
9114
9115
9116# The TAGs below are defined such that we never get into a situation
9117# in which we disable both kinds of libraries. Given conflicting
9118# choices, we go for a static library, that is the most portable,
9119# since we can't tell whether shared libraries were disabled because
9120# the user asked for that or because the platform doesn't support
9121# them. This is particularly important on AIX, because we don't
9122# support having both static and shared libraries enabled at the same
9123# time on that platform, so we default to a shared-only configuration.
9124# If a disable-shared tag is given, we'll fallback to a static-only
9125# configuration. But we'll never go from static-only to shared-only.
9126
9127# ### BEGIN LIBTOOL TAG CONFIG: disable-shared
9128build_libtool_libs=no
9129build_old_libs=yes
9130# ### END LIBTOOL TAG CONFIG: disable-shared
9131
9132# ### BEGIN LIBTOOL TAG CONFIG: disable-static
9133build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac`
9134# ### END LIBTOOL TAG CONFIG: disable-static
9135
9136# Local Variables:
9137# mode:shell-script
9138# sh-indentation:2
9139# End:
9140# vi:sw=2
9141
9142
9143# ### BEGIN LIBTOOL TAG CONFIG: CXX
9144
9145# The linker used to build libraries.
9146LD="/usr/bin/ld -m elf_x86_64"
9147
cristy932c9122009-11-19 13:57:03 +00009148# How to create reloadable object files.
9149reload_flag=" -r"
9150reload_cmds="\$LD\$reload_flag -o \$output\$reload_objs"
9151
cristy3ed852e2009-09-05 21:47:34 +00009152# Commands used to build an old-style archive.
9153old_archive_cmds="\$AR \$AR_FLAGS \$oldlib\$oldobjs~\$RANLIB \$oldlib"
9154
9155# A language specific compiler.
9156CC="g++"
9157
9158# Is the compiler the GNU compiler?
9159with_gcc=yes
9160
9161# Compiler flag to turn off builtin functions.
9162no_builtin_flag=" -fno-builtin"
9163
9164# How to pass a linker flag through the compiler.
9165wl="-Wl,"
9166
9167# Additional compiler flags for building library objects.
9168pic_flag=" -fPIC -DPIC"
9169
9170# Compiler flag to prevent dynamic linking.
9171link_static_flag=""
9172
9173# Does compiler simultaneously support -c and -o options?
9174compiler_c_o="yes"
9175
9176# Whether or not to add -lc for building shared libraries.
9177build_libtool_need_lc=no
9178
9179# Whether or not to disallow shared libs when runtime libs are static.
9180allow_libtool_libs_with_static_runtimes=no
9181
9182# Compiler flag to allow reflexive dlopens.
9183export_dynamic_flag_spec="\${wl}--export-dynamic"
9184
9185# Compiler flag to generate shared objects directly from archives.
9186whole_archive_flag_spec="\${wl}--whole-archive\$convenience \${wl}--no-whole-archive"
9187
9188# Whether the compiler copes with passing no objects directly.
9189compiler_needs_object="no"
9190
9191# Create an old-style archive from a shared archive.
9192old_archive_from_new_cmds=""
9193
9194# Create a temporary old-style archive to link instead of a shared archive.
9195old_archive_from_expsyms_cmds=""
9196
9197# Commands used to build a shared archive.
9198archive_cmds="\$CC -shared -nostdlib \$predep_objects \$libobjs \$deplibs \$postdep_objects \$compiler_flags \${wl}-soname \$wl\$soname -o \$lib"
9199archive_expsym_cmds="\$CC -shared -nostdlib \$predep_objects \$libobjs \$deplibs \$postdep_objects \$compiler_flags \${wl}-soname \$wl\$soname \${wl}-retain-symbols-file \$wl\$export_symbols -o \$lib"
9200
9201# Commands used to build a loadable module if different from building
9202# a shared archive.
9203module_cmds=""
9204module_expsym_cmds=""
9205
9206# Whether we are building with GNU ld or not.
9207with_gnu_ld="yes"
9208
9209# Flag that allows shared libraries with undefined symbols to be built.
9210allow_undefined_flag=""
9211
9212# Flag that enforces no undefined symbols.
9213no_undefined_flag=""
9214
9215# Flag to hardcode $libdir into a binary during linking.
9216# This must work even if $libdir does not exist
9217hardcode_libdir_flag_spec="\${wl}-rpath \${wl}\$libdir"
9218
9219# If ld is used when linking, flag to hardcode $libdir into a binary
9220# during linking. This must work even if $libdir does not exist.
9221hardcode_libdir_flag_spec_ld=""
9222
9223# Whether we need a single "-rpath" flag with a separated argument.
9224hardcode_libdir_separator=""
9225
9226# Set to "yes" if using DIR/libNAME${shared_ext} during linking hardcodes
9227# DIR into the resulting binary.
9228hardcode_direct=no
9229
9230# Set to "yes" if using DIR/libNAME${shared_ext} during linking hardcodes
9231# DIR into the resulting binary and the resulting library dependency is
9232# "absolute",i.e impossible to change by setting ${shlibpath_var} if the
9233# library is relocated.
9234hardcode_direct_absolute=no
9235
9236# Set to "yes" if using the -LDIR flag during linking hardcodes DIR
9237# into the resulting binary.
9238hardcode_minus_L=no
9239
9240# Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR
9241# into the resulting binary.
9242hardcode_shlibpath_var=unsupported
9243
9244# Set to "yes" if building a shared library automatically hardcodes DIR
9245# into the library and all subsequent libraries and executables linked
9246# against it.
9247hardcode_automatic=no
9248
9249# Set to yes if linker adds runtime paths of dependent libraries
9250# to runtime path list.
9251inherit_rpath=no
9252
9253# Whether libtool must link a program against all its dependency libraries.
9254link_all_deplibs=unknown
9255
9256# Fix the shell variable $srcfile for the compiler.
9257fix_srcfile_path=""
9258
9259# Set to "yes" if exported symbols are required.
9260always_export_symbols=no
9261
9262# The commands to list exported symbols.
9263export_symbols_cmds="\$NM \$libobjs \$convenience | \$global_symbol_pipe | \$SED 's/.* //' | sort | uniq > \$export_symbols"
9264
9265# Symbols that should not be listed in the preloaded symbols.
9266exclude_expsyms="_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*"
9267
9268# Symbols that must always be exported.
9269include_expsyms=""
9270
9271# Commands necessary for linking programs (against libraries) with templates.
9272prelink_cmds=""
9273
9274# Specify filename containing input files.
9275file_list_spec=""
9276
9277# How to hardcode a shared library path into an executable.
9278hardcode_action=immediate
9279
9280# The directories searched by this compiler when creating a shared library.
cristy739df912009-10-24 16:10:18 +00009281compiler_lib_search_dirs="/usr/lib/gcc/x86_64-redhat-linux/4.4.2 /usr/lib/gcc/x86_64-redhat-linux/4.4.2 /usr/lib/gcc/x86_64-redhat-linux/4.4.2/../../../../lib64 /lib/../lib64 /usr/lib/../lib64 /usr/lib/gcc/x86_64-redhat-linux/4.4.2/../../.."
cristy3ed852e2009-09-05 21:47:34 +00009282
9283# Dependencies to place before and after the objects being linked to
9284# create a shared library.
cristy739df912009-10-24 16:10:18 +00009285predep_objects="/usr/lib/gcc/x86_64-redhat-linux/4.4.2/../../../../lib64/crti.o /usr/lib/gcc/x86_64-redhat-linux/4.4.2/crtbeginS.o"
9286postdep_objects="/usr/lib/gcc/x86_64-redhat-linux/4.4.2/crtendS.o /usr/lib/gcc/x86_64-redhat-linux/4.4.2/../../../../lib64/crtn.o"
cristy3ed852e2009-09-05 21:47:34 +00009287predeps=""
9288postdeps="-lstdc++ -lm -lgomp -lgcc_s -lpthread -lc -lgcc_s"
9289
9290# The library search path used internally by the compiler when linking
9291# a shared library.
cristy739df912009-10-24 16:10:18 +00009292compiler_lib_search_path="-L/usr/lib/gcc/x86_64-redhat-linux/4.4.2 -L/usr/lib/gcc/x86_64-redhat-linux/4.4.2 -L/usr/lib/gcc/x86_64-redhat-linux/4.4.2/../../../../lib64 -L/lib/../lib64 -L/usr/lib/../lib64 -L/usr/lib/gcc/x86_64-redhat-linux/4.4.2/../../.."
cristy3ed852e2009-09-05 21:47:34 +00009293
9294# ### END LIBTOOL TAG CONFIG: CXX