2
# libtool (GNU libtool) 2.4.2
3
# Written by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
5
# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006,
6
# 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc.
7
# This is free software; see the source for copying conditions. There is NO
8
# warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
10
# GNU Libtool is free software; you can redistribute it and/or modify
11
# it under the terms of the GNU General Public License as published by
12
# the Free Software Foundation; either version 2 of the License, or
13
# (at your option) any later version.
15
# As a special exception to the GNU General Public License,
16
# if you distribute this file as part of a program or library that
17
# is built using GNU Libtool, you may include this file under the
18
# same distribution terms that you use for the rest of that program.
20
# GNU Libtool is distributed in the hope that it will be useful, but
21
# WITHOUT ANY WARRANTY; without even the implied warranty of
22
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
23
# General Public License for more details.
25
# You should have received a copy of the GNU General Public License
26
# along with GNU Libtool; see the file COPYING. If not, a copy
27
# can be downloaded from http://www.gnu.org/licenses/gpl.html,
28
# or obtained by writing to the Free Software Foundation, Inc.,
29
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
31
# Usage: $progname [OPTION]... [MODE-ARG]...
33
# Provide generalized library-building support services.
35
# --config show all configuration variables
36
# --debug enable verbose shell tracing
37
# -n, --dry-run display commands without modifying any files
38
# --features display basic configuration information and exit
39
# --mode=MODE use operation mode MODE
40
# --preserve-dup-deps don't remove duplicate dependency libraries
41
# --quiet, --silent don't print informational messages
42
# --no-quiet, --no-silent
43
# print informational messages (default)
44
# --no-warn don't display warning messages
45
# --tag=TAG use configuration variables from tag TAG
46
# -v, --verbose print more informational messages than default
47
# --no-verbose don't print the extra informational messages
48
# --version print version information
49
# -h, --help, --help-all print short, long, or detailed help message
51
# MODE must be one of the following:
53
# clean remove files from the build directory
54
# compile compile a source file into a libtool object
55
# execute automatically set library path, then run a program
56
# finish complete the installation of libtool libraries
57
# install install libraries or executables
58
# link create a library or an executable
59
# uninstall remove libraries from an installed directory
61
# MODE-ARGS vary depending on the MODE. When passed as first option,
62
# `--mode=MODE' may be abbreviated as `MODE' or a unique abbreviation of that.
63
# Try `$progname --help --mode=MODE' for a more detailed description of MODE.
65
# When reporting a bug, please describe a test case to reproduce it and
66
# include the following information:
71
# compiler flags: $LTCFLAGS
72
# linker: $LD (gnu? $with_gnu_ld)
73
# $progname: (GNU libtool) 2.4.2
74
# automake: $automake_version
75
# autoconf: $autoconf_version
77
# Report bugs to <bug-libtool@gnu.org>.
78
# GNU libtool home page: <http://www.gnu.org/software/libtool/>.
79
# General help using GNU software: <http://www.gnu.org/gethelp/>.
86
package_revision=1.3337
88
# Be Bourne compatible
89
if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
92
# Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
93
# is contrary to our usage. Disable this feature.
94
alias -g '${1+"$@"}'='"$@"'
97
case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac
99
BIN_SH=xpg4; export BIN_SH # for Tru64
100
DUALCASE=1; export DUALCASE # for MKS sh
102
# A function that is used when there is no print builtin or printf.
103
func_fallback_echo ()
105
eval 'cat <<_LTECHO_EOF
110
# NLS nuisances: We save the old values to restore during execute mode.
113
for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
115
eval "if test \"\${$lt_var+set}\" = set; then
116
save_$lt_var=\$$lt_var
119
lt_user_locale=\"$lt_var=\\\$save_\$lt_var; \$lt_user_locale\"
120
lt_safe_locale=\"$lt_var=C; \$lt_safe_locale\"
125
export LANGUAGE LC_ALL
130
# Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh
131
# is ksh but when the shell is invoked as "sh" and the current value of
132
# the _XPG environment variable is not equal to 1 (one), the special
133
# positional parameter $0, within a function call, is the name of the
140
test "${ECHO+set}" = set || ECHO=${as_echo-'printf %s\n'}
145
: ${SHELL="${CONFIG_SHELL-/bin/sh}"}
146
: ${Xsed="$SED -e 1s/^X//"}
151
EXIT_MISMATCH=63 # $? = 63 is used to indicate version mismatch to missing.
152
EXIT_SKIP=77 # $? = 77 is used to indicate a skipped test to automake.
154
exit_status=$EXIT_SUCCESS
156
# Make sure IFS has a sensible default
161
dirname="s,/[^/]*$,,"
164
# func_dirname file append nondir_replacement
165
# Compute the dirname of FILE. If nonempty, add APPEND to the result,
166
# otherwise set result to NONDIR_REPLACEMENT.
169
func_dirname_result=`$ECHO "${1}" | $SED "$dirname"`
170
if test "X$func_dirname_result" = "X${1}"; then
171
func_dirname_result="${3}"
173
func_dirname_result="$func_dirname_result${2}"
175
} # func_dirname may be replaced by extended shell implementation
181
func_basename_result=`$ECHO "${1}" | $SED "$basename"`
182
} # func_basename may be replaced by extended shell implementation
185
# func_dirname_and_basename file append nondir_replacement
186
# perform func_basename and func_dirname in a single function
188
# dirname: Compute the dirname of FILE. If nonempty,
189
# add APPEND to the result, otherwise set result
190
# to NONDIR_REPLACEMENT.
191
# value returned in "$func_dirname_result"
192
# basename: Compute filename of FILE.
193
# value retuned in "$func_basename_result"
194
# Implementation must be kept synchronized with func_dirname
195
# and func_basename. For efficiency, we do not delegate to
196
# those functions but instead duplicate the functionality here.
197
func_dirname_and_basename ()
199
# Extract subdirectory from the argument.
200
func_dirname_result=`$ECHO "${1}" | $SED -e "$dirname"`
201
if test "X$func_dirname_result" = "X${1}"; then
202
func_dirname_result="${3}"
204
func_dirname_result="$func_dirname_result${2}"
206
func_basename_result=`$ECHO "${1}" | $SED -e "$basename"`
207
} # func_dirname_and_basename may be replaced by extended shell implementation
210
# func_stripname prefix suffix name
211
# strip PREFIX and SUFFIX off of NAME.
212
# PREFIX and SUFFIX must not contain globbing or regex special
213
# characters, hashes, percent signs, but SUFFIX may contain a leading
214
# dot (in which case that matches only a dot).
215
# func_strip_suffix prefix name
219
.*) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%\\\\${2}\$%%"`;;
220
*) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%${2}\$%%"`;;
222
} # func_stripname may be replaced by extended shell implementation
225
# These SED scripts presuppose an absolute path with a trailing slash.
226
pathcar='s,^/\([^/]*\).*$,\1,'
227
pathcdr='s,^/[^/]*,,'
228
removedotparts=':dotsl
232
collapseslashes='s@/\{1,\}@/@g'
233
finalslash='s,/*$,/,'
235
# func_normal_abspath PATH
236
# Remove doubled-up and trailing slashes, "." path components,
237
# and cancel out any ".." path components in PATH after making
238
# it an absolute path.
239
# value returned in "$func_normal_abspath_result"
240
func_normal_abspath ()
242
# Start from root dir and reassemble the path.
243
func_normal_abspath_result=
244
func_normal_abspath_tpath=$1
245
func_normal_abspath_altnamespace=
246
case $func_normal_abspath_tpath in
248
# Empty path, that just means $cwd.
249
func_stripname '' '/' "`pwd`"
250
func_normal_abspath_result=$func_stripname_result
253
# The next three entries are used to spot a run of precisely
254
# two leading slashes without using negated character classes;
255
# we take advantage of case's first-match behaviour.
257
# Unusual form of absolute path, do nothing.
260
# Not necessarily an ordinary path; POSIX reserves leading '//'
261
# and for example Cygwin uses it to access remote file shares
262
# over CIFS/SMB, so we conserve a leading double slash if found.
263
func_normal_abspath_altnamespace=/
266
# Absolute path, do nothing.
269
# Relative path, prepend $cwd.
270
func_normal_abspath_tpath=`pwd`/$func_normal_abspath_tpath
273
# Cancel out all the simple stuff to save iterations. We also want
274
# the path to end with a slash for ease of parsing, so make sure
275
# there is one (and only one) here.
276
func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \
277
-e "$removedotparts" -e "$collapseslashes" -e "$finalslash"`
279
# Processed it all yet?
280
if test "$func_normal_abspath_tpath" = / ; then
281
# If we ascended to the root using ".." the result may be empty now.
282
if test -z "$func_normal_abspath_result" ; then
283
func_normal_abspath_result=/
287
func_normal_abspath_tcomponent=`$ECHO "$func_normal_abspath_tpath" | $SED \
289
func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \
291
# Figure out what to do with it
292
case $func_normal_abspath_tcomponent in
294
# Trailing empty path component, ignore it.
297
# Parent dir; strip last assembled component from result.
298
func_dirname "$func_normal_abspath_result"
299
func_normal_abspath_result=$func_dirname_result
302
# Actual path component, append it.
303
func_normal_abspath_result=$func_normal_abspath_result/$func_normal_abspath_tcomponent
307
# Restore leading double-slash if one was found on entry.
308
func_normal_abspath_result=$func_normal_abspath_altnamespace$func_normal_abspath_result
311
# func_relative_path SRCDIR DSTDIR
312
# generates a relative path from SRCDIR to DSTDIR, with a trailing
313
# slash if non-empty, suitable for immediately appending a filename
314
# without needing to append a separator.
315
# value returned in "$func_relative_path_result"
316
func_relative_path ()
318
func_relative_path_result=
319
func_normal_abspath "$1"
320
func_relative_path_tlibdir=$func_normal_abspath_result
321
func_normal_abspath "$2"
322
func_relative_path_tbindir=$func_normal_abspath_result
324
# Ascend the tree starting from libdir
326
# check if we have found a prefix of bindir
327
case $func_relative_path_tbindir in
328
$func_relative_path_tlibdir)
329
# found an exact match
330
func_relative_path_tcancelled=
333
$func_relative_path_tlibdir*)
334
# found a matching prefix
335
func_stripname "$func_relative_path_tlibdir" '' "$func_relative_path_tbindir"
336
func_relative_path_tcancelled=$func_stripname_result
337
if test -z "$func_relative_path_result"; then
338
func_relative_path_result=.
343
func_dirname $func_relative_path_tlibdir
344
func_relative_path_tlibdir=${func_dirname_result}
345
if test "x$func_relative_path_tlibdir" = x ; then
346
# Have to descend all the way to the root!
347
func_relative_path_result=../$func_relative_path_result
348
func_relative_path_tcancelled=$func_relative_path_tbindir
351
func_relative_path_result=../$func_relative_path_result
356
# Now calculate path; take care to avoid doubling-up slashes.
357
func_stripname '' '/' "$func_relative_path_result"
358
func_relative_path_result=$func_stripname_result
359
func_stripname '/' '/' "$func_relative_path_tcancelled"
360
if test "x$func_stripname_result" != x ; then
361
func_relative_path_result=${func_relative_path_result}/${func_stripname_result}
364
# Normalisation. If bindir is libdir, return empty string,
365
# else relative path ending with a slash; either way, target
366
# file name can be directly appended.
367
if test ! -z "$func_relative_path_result"; then
368
func_stripname './' '' "$func_relative_path_result/"
369
func_relative_path_result=$func_stripname_result
373
# The name of this program:
374
func_dirname_and_basename "$progpath"
375
progname=$func_basename_result
377
# Make sure we have an absolute path for reexecution:
379
[\\/]*|[A-Za-z]:\\*) ;;
381
progdir=$func_dirname_result
382
progdir=`cd "$progdir" && pwd`
383
progpath="$progdir/$progname"
387
IFS=${PATH_SEPARATOR-:}
388
for progdir in $PATH; do
390
test -x "$progdir/$progname" && break
393
test -n "$progdir" || progdir=`pwd`
394
progpath="$progdir/$progname"
398
# Sed substitution that helps us do robust quoting. It backslashifies
399
# metacharacters that are still active within double-quoted strings.
400
Xsed="${SED}"' -e 1s/^X//'
401
sed_quote_subst='s/\([`"$\\]\)/\\\1/g'
403
# Same as above, but do not quote variable references.
404
double_quote_subst='s/\(["`\\]\)/\\\1/g'
406
# Sed substitution that turns a string into a regex matching for the
408
sed_make_literal_regex='s,[].[^$\\*\/],\\&,g'
410
# Sed substitution that converts a w32 file name or path
411
# which contains forward slashes, into one that contains
412
# (escaped) backslashes. A very naive implementation.
413
lt_sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g'
415
# Re-`\' parameter expansions in output of double_quote_subst that were
416
# `\'-ed in input to the same. If an odd number of `\' preceded a '$'
417
# in input to double_quote_subst, that '$' was protected from expansion.
418
# Since each input `\' is now two `\'s, look for any number of runs of
419
# four `\'s followed by two `\'s and then a '$'. `\' that '$'.
424
sed_double_backslash="\
428
s/\\([^$bs]\\)$bs2$dollar/\\1$bs2$bs$dollar/g
439
# Echo program name prefixed message, along with the current mode
440
# name if it has been set yet.
443
$ECHO "$progname: ${opt_mode+$opt_mode: }$*"
446
# func_verbose arg...
447
# Echo program name prefixed message in verbose mode only.
450
$opt_verbose && func_echo ${1+"$@"}
452
# A bug in bash halts the script if the last line of a function
453
# fails when set -e is in force, so we need another command to
458
# func_echo_all arg...
459
# Invoke $ECHO with all args, space-separated.
466
# Echo program name prefixed message to standard error.
469
$ECHO "$progname: ${opt_mode+$opt_mode: }"${1+"$@"} 1>&2
472
# func_warning arg...
473
# Echo program name prefixed warning message to standard error.
476
$opt_warning && $ECHO "$progname: ${opt_mode+$opt_mode: }warning: "${1+"$@"} 1>&2
482
# func_fatal_error arg...
483
# Echo program name prefixed message to standard error, and exit.
490
# func_fatal_help arg...
491
# Echo program name prefixed message to standard error, followed by
492
# a help hint, and exit.
496
func_fatal_error "$help"
498
help="Try \`$progname --help' for more information." ## default
501
# func_grep expression filename
502
# Check whether EXPRESSION matches any line of FILENAME, without output.
505
$GREP "$1" "$2" >/dev/null 2>&1
509
# func_mkdir_p directory-path
510
# Make sure the entire path to DIRECTORY-PATH is available.
513
my_directory_path="$1"
516
if test -n "$my_directory_path" && test "$opt_dry_run" != ":"; then
518
# Protect directory names starting with `-'
519
case $my_directory_path in
520
-*) my_directory_path="./$my_directory_path" ;;
523
# While some portion of DIR does not yet exist...
524
while test ! -d "$my_directory_path"; do
525
# ...make a list in topmost first order. Use a colon delimited
526
# list incase some portion of path contains whitespace.
527
my_dir_list="$my_directory_path:$my_dir_list"
529
# If the last portion added has no slash in it, the list is done
530
case $my_directory_path in */*) ;; *) break ;; esac
532
# ...otherwise throw away the child directory and loop
533
my_directory_path=`$ECHO "$my_directory_path" | $SED -e "$dirname"`
535
my_dir_list=`$ECHO "$my_dir_list" | $SED 's,:*$,,'`
537
save_mkdir_p_IFS="$IFS"; IFS=':'
538
for my_dir in $my_dir_list; do
539
IFS="$save_mkdir_p_IFS"
540
# mkdir can fail with a `File exist' error if two processes
541
# try to create one of the directories concurrently. Don't
543
$MKDIR "$my_dir" 2>/dev/null || :
545
IFS="$save_mkdir_p_IFS"
547
# Bail out if we (or some other process) failed to create a directory.
548
test -d "$my_directory_path" || \
549
func_fatal_error "Failed to create \`$1'"
554
# func_mktempdir [string]
555
# Make a temporary directory that won't clash with other running
556
# libtool processes, and avoids race conditions if possible. If
557
# given, STRING is the basename for that directory.
560
my_template="${TMPDIR-/tmp}/${1-$progname}"
562
if test "$opt_dry_run" = ":"; then
563
# Return a directory name, but don't create it in dry-run mode
564
my_tmpdir="${my_template}-$$"
567
# If mktemp works, use that first and foremost
568
my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null`
570
if test ! -d "$my_tmpdir"; then
571
# Failing that, at least try and use $RANDOM to avoid a race
572
my_tmpdir="${my_template}-${RANDOM-0}$$"
574
save_mktempdir_umask=`umask`
577
umask $save_mktempdir_umask
580
# If we're not in dry-run mode, bomb out on failure
581
test -d "$my_tmpdir" || \
582
func_fatal_error "cannot create temporary directory \`$my_tmpdir'"
589
# func_quote_for_eval arg
590
# Aesthetically quote ARG to be evaled later.
591
# This function returns two values: FUNC_QUOTE_FOR_EVAL_RESULT
592
# is double-quoted, suitable for a subsequent eval, whereas
593
# FUNC_QUOTE_FOR_EVAL_UNQUOTED_RESULT has merely all characters
594
# which are still active within double quotes backslashified.
595
func_quote_for_eval ()
599
func_quote_for_eval_unquoted_result=`$ECHO "$1" | $SED "$sed_quote_subst"` ;;
601
func_quote_for_eval_unquoted_result="$1" ;;
604
case $func_quote_for_eval_unquoted_result in
605
# Double-quote args containing shell metacharacters to delay
606
# word splitting, command substitution and and variable
607
# expansion for a subsequent eval.
608
# Many Bourne shells cannot handle close brackets correctly
609
# in scan sets, so we specify it separately.
610
*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
611
func_quote_for_eval_result="\"$func_quote_for_eval_unquoted_result\""
614
func_quote_for_eval_result="$func_quote_for_eval_unquoted_result"
619
# func_quote_for_expand arg
620
# Aesthetically quote ARG to be evaled later; same as above,
621
# but do not quote variable references.
622
func_quote_for_expand ()
626
my_arg=`$ECHO "$1" | $SED \
627
-e "$double_quote_subst" -e "$sed_double_backslash"` ;;
633
# Double-quote args containing shell metacharacters to delay
634
# word splitting and command substitution for a subsequent eval.
635
# Many Bourne shells cannot handle close brackets correctly
636
# in scan sets, so we specify it separately.
637
*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
642
func_quote_for_expand_result="$my_arg"
646
# func_show_eval cmd [fail_exp]
647
# Unless opt_silent is true, then output CMD. Then, if opt_dryrun is
648
# not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP
649
# is given, then evaluate it.
655
${opt_silent-false} || {
656
func_quote_for_expand "$my_cmd"
657
eval "func_echo $func_quote_for_expand_result"
660
if ${opt_dry_run-false}; then :; else
663
if test "$my_status" -eq 0; then :; else
664
eval "(exit $my_status); $my_fail_exp"
670
# func_show_eval_locale cmd [fail_exp]
671
# Unless opt_silent is true, then output CMD. Then, if opt_dryrun is
672
# not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP
673
# is given, then evaluate it. Use the saved locale for evaluation.
674
func_show_eval_locale ()
679
${opt_silent-false} || {
680
func_quote_for_expand "$my_cmd"
681
eval "func_echo $func_quote_for_expand_result"
684
if ${opt_dry_run-false}; then :; else
685
eval "$lt_user_locale
688
eval "$lt_safe_locale"
689
if test "$my_status" -eq 0; then :; else
690
eval "(exit $my_status); $my_fail_exp"
696
# Turn $1 into a string suitable for a shell variable name.
697
# Result is stored in $func_tr_sh_result. All characters
698
# not in the set a-zA-Z0-9_ are replaced with '_'. Further,
699
# if $1 begins with a digit, a '_' is prepended as well.
703
[0-9]* | *[!a-zA-Z0-9_]*)
704
func_tr_sh_result=`$ECHO "$1" | $SED 's/^\([0-9]\)/_\1/; s/[^a-zA-Z0-9_]/_/g'`
714
# Echo version message to standard output and exit.
727
/^# '$PROGRAM' (GNU /,/# warranty; / {
730
s/\((C)\)[ 0-9,-]*\( [1-9][0-9]*\)/\1\2/
737
# Echo short help message to standard output and exit.
742
$SED -n '/^# Usage:/,/^# *.*--help/ {
745
s/\$progname/'$progname'/
749
$ECHO "run \`$progname --help | more' for full usage"
754
# Echo long help message to standard output and exit,
755
# unless 'noexit' is passed as argument.
760
$SED -n '/^# Usage:/,/# Report bugs to/ {
764
s*\$progname*'$progname'*
766
s*\$SHELL*'"$SHELL"'*
768
s*\$LTCFLAGS*'"$LTCFLAGS"'*
770
s/\$with_gnu_ld/'"$with_gnu_ld"'/
771
s/\$automake_version/'"`(${AUTOMAKE-automake} --version) 2>/dev/null |$SED 1q`"'/
772
s/\$autoconf_version/'"`(${AUTOCONF-autoconf} --version) 2>/dev/null |$SED 1q`"'/
776
/^# .* home page:/b print
777
/^# General help using/b print
780
if test -z "$1"; then
785
# func_missing_arg argname
786
# Echo program name prefixed message to standard error and set global
792
func_error "missing argument for $1."
797
# func_split_short_opt shortopt
798
# Set func_split_short_opt_name and func_split_short_opt_arg shell
799
# variables after splitting SHORTOPT after the 2nd character.
800
func_split_short_opt ()
802
my_sed_short_opt='1s/^\(..\).*$/\1/;q'
803
my_sed_short_rest='1s/^..\(.*\)$/\1/;q'
805
func_split_short_opt_name=`$ECHO "$1" | $SED "$my_sed_short_opt"`
806
func_split_short_opt_arg=`$ECHO "$1" | $SED "$my_sed_short_rest"`
807
} # func_split_short_opt may be replaced by extended shell implementation
810
# func_split_long_opt longopt
811
# Set func_split_long_opt_name and func_split_long_opt_arg shell
812
# variables after splitting LONGOPT at the `=' sign.
813
func_split_long_opt ()
815
my_sed_long_opt='1s/^\(--[^=]*\)=.*/\1/;q'
816
my_sed_long_arg='1s/^--[^=]*=//'
818
func_split_long_opt_name=`$ECHO "$1" | $SED "$my_sed_long_opt"`
819
func_split_long_opt_arg=`$ECHO "$1" | $SED "$my_sed_long_arg"`
820
} # func_split_long_opt may be replaced by extended shell implementation
828
magic="%%%MAGIC variable%%%"
829
magic_exe="%%%MAGIC EXE variable%%%"
834
lo2o="s/\\.lo\$/.${objext}/"
835
o2lo="s/\\.${objext}\$/.lo/"
839
# If this variable is set in any of the actions, the command in it
840
# will be execed at the end. This prevents here-documents from being
841
# left over by shells.
844
# func_append var value
845
# Append VALUE to the end of shell variable VAR.
848
eval "${1}=\$${1}\${2}"
849
} # func_append may be replaced by extended shell implementation
851
# func_append_quoted var value
852
# Quote VALUE and append to the end of shell variable VAR, separated
854
func_append_quoted ()
856
func_quote_for_eval "${2}"
857
eval "${1}=\$${1}\\ \$func_quote_for_eval_result"
858
} # func_append_quoted may be replaced by extended shell implementation
861
# func_arith arithmetic-term...
864
func_arith_result=`expr "${@}"`
865
} # func_arith may be replaced by extended shell implementation
869
# STRING may not start with a hyphen.
872
func_len_result=`expr "${1}" : ".*" 2>/dev/null || echo $max_cmd_len`
873
} # func_len may be replaced by extended shell implementation
879
func_lo2o_result=`$ECHO "${1}" | $SED "$lo2o"`
880
} # func_lo2o may be replaced by extended shell implementation
883
# func_xform libobj-or-source
886
func_xform_result=`$ECHO "${1}" | $SED 's/\.[^.]*$/.lo/'`
887
} # func_xform may be replaced by extended shell implementation
890
# func_fatal_configuration arg...
891
# Echo program name prefixed message to standard error, followed by
892
# a configuration failure hint, and exit.
893
func_fatal_configuration ()
896
func_error "See the $PACKAGE documentation for more information."
897
func_fatal_error "Fatal configuration error."
902
# Display the configuration for all the tags in this script.
905
re_begincf='^# ### BEGIN LIBTOOL'
906
re_endcf='^# ### END LIBTOOL'
908
# Default configuration.
909
$SED "1,/$re_begincf CONFIG/d;/$re_endcf CONFIG/,\$d" < "$progpath"
911
# Now print the configurations for the tags.
912
for tagname in $taglist; do
913
$SED -n "/$re_begincf TAG CONFIG: $tagname\$/,/$re_endcf TAG CONFIG: $tagname\$/p" < "$progpath"
920
# Display the features supported by this script.
924
if test "$build_libtool_libs" = yes; then
925
echo "enable shared libraries"
927
echo "disable shared libraries"
929
if test "$build_old_libs" = yes; then
930
echo "enable static libraries"
932
echo "disable static libraries"
938
# func_enable_tag tagname
939
# Verify that TAGNAME is valid, and either flag an error and exit, or
940
# enable the TAGNAME tag. We also add TAGNAME to the global $taglist
947
re_begincf="^# ### BEGIN LIBTOOL TAG CONFIG: $tagname\$"
948
re_endcf="^# ### END LIBTOOL TAG CONFIG: $tagname\$"
949
sed_extractcf="/$re_begincf/,/$re_endcf/p"
954
func_fatal_error "invalid tag name: $tagname"
958
# Don't test for the "default" C tag, as we know it's
959
# there but not specially marked.
963
if $GREP "$re_begincf" "$progpath" >/dev/null 2>&1; then
964
taglist="$taglist $tagname"
966
# Evaluate the configuration. Be careful to quote the path
967
# and the sed script, to avoid splitting on whitespace, but
968
# also don't use non-portable quotes within backquotes within
969
# quotes we have to do it in 2 steps:
970
extractedcf=`$SED -n -e "$sed_extractcf" < "$progpath"`
973
func_error "ignoring unknown tag $tagname"
979
# func_check_version_match
980
# Ensure that we are using m4 macros, and libtool script from the same
981
# release of libtool.
982
func_check_version_match ()
984
if test "$package_revision" != "$macro_revision"; then
985
if test "$VERSION" != "$macro_version"; then
986
if test -z "$macro_version"; then
988
$progname: Version mismatch error. This is $PACKAGE $VERSION, but the
989
$progname: definition of this LT_INIT comes from an older release.
990
$progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION
991
$progname: and run autoconf again.
995
$progname: Version mismatch error. This is $PACKAGE $VERSION, but the
996
$progname: definition of this LT_INIT comes from $PACKAGE $macro_version.
997
$progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION
998
$progname: and run autoconf again.
1003
$progname: Version mismatch error. This is $PACKAGE $VERSION, revision $package_revision,
1004
$progname: but the definition of this LT_INIT comes from revision $macro_revision.
1005
$progname: You should recreate aclocal.m4 with macros from revision $package_revision
1006
$progname: of $PACKAGE $VERSION and run autoconf again.
1015
# Shorthand for --mode=foo, only valid as the first argument
1018
shift; set dummy --mode clean ${1+"$@"}; shift
1020
compile|compil|compi|comp|com|co|c)
1021
shift; set dummy --mode compile ${1+"$@"}; shift
1023
execute|execut|execu|exec|exe|ex|e)
1024
shift; set dummy --mode execute ${1+"$@"}; shift
1026
finish|finis|fini|fin|fi|f)
1027
shift; set dummy --mode finish ${1+"$@"}; shift
1029
install|instal|insta|inst|ins|in|i)
1030
shift; set dummy --mode install ${1+"$@"}; shift
1033
shift; set dummy --mode link ${1+"$@"}; shift
1035
uninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u)
1036
shift; set dummy --mode uninstall ${1+"$@"}; shift
1046
opt_preserve_dup_deps=false
1058
# Parse options once, thoroughly. This comes as soon as possible in the
1059
# script to make things like `--version' happen as quickly as we can.
1061
# this just eases exit handling
1062
while test $# -gt 0; do
1066
--debug|-x) opt_debug='set -x'
1067
func_echo "enabling shell trace mode"
1070
--dry-run|--dryrun|-n)
1079
opt_dlopen="${opt_dlopen+$opt_dlopen
1083
--preserve-dup-deps)
1084
opt_preserve_dup_deps=:
1092
set dummy --mode finish ${1+"$@"}; shift
1099
opt_help=': help-all'
1102
test $# = 0 && func_missing_arg $opt && break
1106
# Valid mode arguments:
1107
clean|compile|execute|finish|install|link|relink|uninstall) ;;
1109
# Catch anything else as an error
1110
*) func_error "invalid argument for $opt"
1117
--no-silent|--no-quiet)
1119
func_append preserve_args " $opt"
1121
--no-warning|--no-warn)
1123
func_append preserve_args " $opt"
1127
func_append preserve_args " $opt"
1131
func_append preserve_args " $opt"
1136
func_append preserve_args " $opt"
1140
test $# = 0 && func_missing_arg $opt && break
1143
func_append preserve_args " $opt $optarg"
1144
func_enable_tag "$optarg"
1148
-\?|-h) func_usage ;;
1149
--help) func_help ;;
1150
--version) func_version ;;
1152
# Separate optargs to long options:
1154
func_split_long_opt "$opt"
1155
set dummy "$func_split_long_opt_name" "$func_split_long_opt_arg" ${1+"$@"}
1159
# Separate non-argument short options:
1161
func_split_short_opt "$opt"
1162
set dummy "$func_split_short_opt_name" "-$func_split_short_opt_arg" ${1+"$@"}
1167
-*) func_fatal_help "unrecognized option \`$opt'" ;;
1168
*) set dummy "$opt" ${1+"$@"}; shift; break ;;
1174
# save first non-option argument
1175
if test "$#" -gt 0; then
1181
test "$opt_debug" = : || func_append preserve_args " --debug"
1184
*cygwin* | *mingw* | *pw32* | *cegcc*)
1185
# don't eliminate duplications in $postdeps and $predeps
1186
opt_duplicate_compiler_generated_deps=:
1189
opt_duplicate_compiler_generated_deps=$opt_preserve_dup_deps
1194
# Sanity checks first:
1195
func_check_version_match
1197
if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
1198
func_fatal_configuration "not configured to build any kind of library"
1202
eval std_shrext=\"$shrext_cmds\"
1204
# Only execute mode is allowed to have -dlopen flags.
1205
if test -n "$opt_dlopen" && test "$opt_mode" != execute; then
1206
func_error "unrecognized option \`-dlopen'"
1211
# Change the help message to a mode-specific one.
1212
generic_help="$help"
1213
help="Try \`$progname --help --mode=$opt_mode' for more information."
1217
# Bail if the options were screwed
1218
$exit_cmd $EXIT_FAILURE
1228
# func_try_sizelim file n
1229
# try to write at most the first N bytes from FILE to the standard output when
1230
# possible, otherwise put whole file
1233
if test -n "$DD"; then
1234
$DD if="$1" bs=$2 count=1 2>/dev/null
1235
if test $? -eq 127; then
1236
cat "$1" 2>/dev/null
1239
cat "$1" 2>/dev/null
1244
# True iff FILE is a libtool `.la' library or `.lo' object file.
1245
# This function is only a basic sanity check; it will hardly flush out
1246
# determined imposters.
1250
func_try_sizelim "$1" 4096 | $SED -e 4q 2>/dev/null \
1251
| $GREP "^# Generated by .*$PACKAGE" > /dev/null 2>&1
1254
# func_lalib_unsafe_p file
1255
# True iff FILE is a libtool `.la' library or `.lo' object file.
1256
# This function implements the same check as func_lalib_p without
1257
# resorting to external programs. To this end, it redirects stdin and
1258
# closes it afterwards, without saving the original file descriptor.
1259
# As a safety measure, use it only where a negative result would be
1260
# fatal anyway. Works if `file' does not exist.
1261
func_lalib_unsafe_p ()
1264
if test -f "$1" && test -r "$1" && exec 5<&0 <"$1"; then
1265
for lalib_p_l in 1 2 3 4
1268
case "$lalib_p_line" in
1269
\#\ Generated\ by\ *$PACKAGE* ) lalib_p=yes; break;;
1274
test "$lalib_p" = yes
1277
# func_ltwrapper_script_p file
1278
# True iff FILE is a libtool wrapper script
1279
# This function is only a basic sanity check; it will hardly flush out
1280
# determined imposters.
1281
func_ltwrapper_script_p ()
1286
# func_ltwrapper_executable_p file
1287
# True iff FILE is a libtool wrapper executable
1288
# This function is only a basic sanity check; it will hardly flush out
1289
# determined imposters.
1290
func_ltwrapper_executable_p ()
1292
func_ltwrapper_exec_suffix=
1295
*) func_ltwrapper_exec_suffix=.exe ;;
1297
$GREP "$magic_exe" "$1$func_ltwrapper_exec_suffix" >/dev/null 2>&1
1300
# func_ltwrapper_scriptname file
1301
# Assumes file is an ltwrapper_executable
1302
# uses $file to determine the appropriate filename for a
1303
# temporary ltwrapper_script.
1304
func_ltwrapper_scriptname ()
1306
func_dirname_and_basename "$1" "" "."
1307
func_stripname '' '.exe' "$func_basename_result"
1308
func_ltwrapper_scriptname_result="$func_dirname_result/$objdir/${func_stripname_result}_ltshwrapper"
1311
# func_ltwrapper_p file
1312
# True iff FILE is a libtool wrapper script or wrapper executable
1313
# This function is only a basic sanity check; it will hardly flush out
1314
# determined imposters.
1317
func_ltwrapper_script_p "$1" || func_ltwrapper_executable_p "$1"
1321
# func_execute_cmds commands fail_cmd
1322
# Execute tilde-delimited COMMANDS.
1323
# If FAIL_CMD is given, eval that upon failure.
1324
# FAIL_CMD may read-access the current command in variable CMD!
1325
func_execute_cmds ()
1328
save_ifs=$IFS; IFS='~'
1332
func_show_eval "$cmd" "${2-:}"
1339
# Source FILE, adding directory component if necessary.
1340
# Note that it is not necessary on cygwin/mingw to append a dot to
1341
# FILE even if both FILE and FILE.exe exist: automatic-append-.exe
1342
# behavior happens only for exec(3), not for open(2)! Also, sourcing
1343
# `FILE.' does not work on cygwin managed mounts.
1348
*/* | *\\*) . "$1" ;;
1354
# func_resolve_sysroot PATH
1355
# Replace a leading = in PATH with a sysroot. Store the result into
1356
# func_resolve_sysroot_result
1357
func_resolve_sysroot ()
1359
func_resolve_sysroot_result=$1
1360
case $func_resolve_sysroot_result in
1362
func_stripname '=' '' "$func_resolve_sysroot_result"
1363
func_resolve_sysroot_result=$lt_sysroot$func_stripname_result
1368
# func_replace_sysroot PATH
1369
# If PATH begins with the sysroot, replace it with = and
1370
# store the result into func_replace_sysroot_result.
1371
func_replace_sysroot ()
1373
case "$lt_sysroot:$1" in
1375
func_stripname "$lt_sysroot" '' "$1"
1376
func_replace_sysroot_result="=$func_stripname_result"
1379
# Including no sysroot.
1380
func_replace_sysroot_result=$1
1385
# func_infer_tag arg
1386
# Infer tagged configuration to use if any are available and
1387
# if one wasn't chosen via the "--tag" command line option.
1388
# Only attempt this if the compiler in the base compile
1389
# command doesn't match the default compiler.
1390
# arg is usually of the form 'gcc ...'
1394
if test -n "$available_tags" && test -z "$tagname"; then
1397
func_append_quoted CC_quoted "$arg"
1399
CC_expanded=`func_echo_all $CC`
1400
CC_quoted_expanded=`func_echo_all $CC_quoted`
1402
# Blanks in the command may have been stripped by the calling shell,
1403
# but not from the CC environment variable when configure was run.
1404
" $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \
1405
" $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*) ;;
1406
# Blanks at the start of $base_compile will cause this to fail
1407
# if we don't check for them as well.
1409
for z in $available_tags; do
1410
if $GREP "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then
1411
# Evaluate the configuration.
1412
eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`"
1415
# Double-quote args containing other shell metacharacters.
1416
func_append_quoted CC_quoted "$arg"
1418
CC_expanded=`func_echo_all $CC`
1419
CC_quoted_expanded=`func_echo_all $CC_quoted`
1421
" $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \
1422
" $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*)
1423
# The compiler in the base compile command matches
1424
# the one in the tagged configuration.
1425
# Assume this is the tagged configuration we want.
1432
# If $tagname still isn't set, then no tagged configuration
1433
# was found and let the user know that the "--tag" command
1434
# line option must be used.
1435
if test -z "$tagname"; then
1436
func_echo "unable to infer tagged configuration"
1437
func_fatal_error "specify a tag with \`--tag'"
1439
# func_verbose "using $tagname tagged configuration"
1448
# func_write_libtool_object output_name pic_name nonpic_name
1449
# Create a libtool object file (analogous to a ".la" file),
1450
# but don't create it if we're doing a dry run.
1451
func_write_libtool_object ()
1454
if test "$build_libtool_libs" = yes; then
1460
if test "$build_old_libs" = yes; then
1461
write_oldobj=\'${3}\'
1467
cat >${write_libobj}T <<EOF
1468
# $write_libobj - a libtool object file
1469
# Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
1471
# Please DO NOT delete this file!
1472
# It is necessary for linking the library.
1474
# Name of the PIC object.
1475
pic_object=$write_lobj
1477
# Name of the non-PIC object
1478
non_pic_object=$write_oldobj
1481
$MV "${write_libobj}T" "${write_libobj}"
1486
##################################################
1487
# FILE NAME AND PATH CONVERSION HELPER FUNCTIONS #
1488
##################################################
1490
# func_convert_core_file_wine_to_w32 ARG
1491
# Helper function used by file name conversion functions when $build is *nix,
1492
# and $host is mingw, cygwin, or some other w32 environment. Relies on a
1493
# correctly configured wine environment available, with the winepath program
1494
# in $build's $PATH.
1496
# ARG is the $build file name to be converted to w32 format.
1497
# Result is available in $func_convert_core_file_wine_to_w32_result, and will
1498
# be empty on error (or when ARG is empty)
1499
func_convert_core_file_wine_to_w32 ()
1502
func_convert_core_file_wine_to_w32_result="$1"
1503
if test -n "$1"; then
1504
# Unfortunately, winepath does not exit with a non-zero error code, so we
1505
# are forced to check the contents of stdout. On the other hand, if the
1506
# command is not found, the shell will set an exit code of 127 and print
1507
# *an error message* to stdout. So we must check for both error code of
1508
# zero AND non-empty stdout, which explains the odd construction:
1509
func_convert_core_file_wine_to_w32_tmp=`winepath -w "$1" 2>/dev/null`
1510
if test "$?" -eq 0 && test -n "${func_convert_core_file_wine_to_w32_tmp}"; then
1511
func_convert_core_file_wine_to_w32_result=`$ECHO "$func_convert_core_file_wine_to_w32_tmp" |
1512
$SED -e "$lt_sed_naive_backslashify"`
1514
func_convert_core_file_wine_to_w32_result=
1518
# end: func_convert_core_file_wine_to_w32
1521
# func_convert_core_path_wine_to_w32 ARG
1522
# Helper function used by path conversion functions when $build is *nix, and
1523
# $host is mingw, cygwin, or some other w32 environment. Relies on a correctly
1524
# configured wine environment available, with the winepath program in $build's
1525
# $PATH. Assumes ARG has no leading or trailing path separator characters.
1527
# ARG is path to be converted from $build format to win32.
1528
# Result is available in $func_convert_core_path_wine_to_w32_result.
1529
# Unconvertible file (directory) names in ARG are skipped; if no directory names
1530
# are convertible, then the result may be empty.
1531
func_convert_core_path_wine_to_w32 ()
1534
# unfortunately, winepath doesn't convert paths, only file names
1535
func_convert_core_path_wine_to_w32_result=""
1536
if test -n "$1"; then
1539
for func_convert_core_path_wine_to_w32_f in $1; do
1541
func_convert_core_file_wine_to_w32 "$func_convert_core_path_wine_to_w32_f"
1542
if test -n "$func_convert_core_file_wine_to_w32_result" ; then
1543
if test -z "$func_convert_core_path_wine_to_w32_result"; then
1544
func_convert_core_path_wine_to_w32_result="$func_convert_core_file_wine_to_w32_result"
1546
func_append func_convert_core_path_wine_to_w32_result ";$func_convert_core_file_wine_to_w32_result"
1553
# end: func_convert_core_path_wine_to_w32
1556
# func_cygpath ARGS...
1557
# Wrapper around calling the cygpath program via LT_CYGPATH. This is used when
1558
# when (1) $build is *nix and Cygwin is hosted via a wine environment; or (2)
1559
# $build is MSYS and $host is Cygwin, or (3) $build is Cygwin. In case (1) or
1560
# (2), returns the Cygwin file name or path in func_cygpath_result (input
1561
# file name or path is assumed to be in w32 format, as previously converted
1562
# from $build's *nix or MSYS format). In case (3), returns the w32 file name
1563
# or path in func_cygpath_result (input file name or path is assumed to be in
1564
# Cygwin format). Returns an empty string on error.
1566
# ARGS are passed to cygpath, with the last one being the file name or path to
1569
# Specify the absolute *nix (or w32) name to cygpath in the LT_CYGPATH
1570
# environment variable; do not put it in $PATH.
1574
if test -n "$LT_CYGPATH" && test -f "$LT_CYGPATH"; then
1575
func_cygpath_result=`$LT_CYGPATH "$@" 2>/dev/null`
1576
if test "$?" -ne 0; then
1577
# on failure, ensure result is empty
1578
func_cygpath_result=
1581
func_cygpath_result=
1582
func_error "LT_CYGPATH is empty or specifies non-existent file: \`$LT_CYGPATH'"
1588
# func_convert_core_msys_to_w32 ARG
1589
# Convert file name or path ARG from MSYS format to w32 format. Return
1590
# result in func_convert_core_msys_to_w32_result.
1591
func_convert_core_msys_to_w32 ()
1594
# awkward: cmd appends spaces to result
1595
func_convert_core_msys_to_w32_result=`( cmd //c echo "$1" ) 2>/dev/null |
1596
$SED -e 's/[ ]*$//' -e "$lt_sed_naive_backslashify"`
1598
#end: func_convert_core_msys_to_w32
1601
# func_convert_file_check ARG1 ARG2
1602
# Verify that ARG1 (a file name in $build format) was converted to $host
1603
# format in ARG2. Otherwise, emit an error message, but continue (resetting
1604
# func_to_host_file_result to ARG1).
1605
func_convert_file_check ()
1608
if test -z "$2" && test -n "$1" ; then
1609
func_error "Could not determine host file name corresponding to"
1611
func_error "Continuing, but uninstalled executables may not work."
1613
func_to_host_file_result="$1"
1616
# end func_convert_file_check
1619
# func_convert_path_check FROM_PATHSEP TO_PATHSEP FROM_PATH TO_PATH
1620
# Verify that FROM_PATH (a path in $build format) was converted to $host
1621
# format in TO_PATH. Otherwise, emit an error message, but continue, resetting
1622
# func_to_host_file_result to a simplistic fallback value (see below).
1623
func_convert_path_check ()
1626
if test -z "$4" && test -n "$3"; then
1627
func_error "Could not determine the host path corresponding to"
1629
func_error "Continuing, but uninstalled executables may not work."
1630
# Fallback. This is a deliberately simplistic "conversion" and
1631
# should not be "improved". See libtool.info.
1632
if test "x$1" != "x$2"; then
1633
lt_replace_pathsep_chars="s|$1|$2|g"
1634
func_to_host_path_result=`echo "$3" |
1635
$SED -e "$lt_replace_pathsep_chars"`
1637
func_to_host_path_result="$3"
1641
# end func_convert_path_check
1644
# func_convert_path_front_back_pathsep FRONTPAT BACKPAT REPL ORIG
1645
# Modifies func_to_host_path_result by prepending REPL if ORIG matches FRONTPAT
1646
# and appending REPL if ORIG matches BACKPAT.
1647
func_convert_path_front_back_pathsep ()
1651
$1 ) func_to_host_path_result="$3$func_to_host_path_result"
1655
$2 ) func_append func_to_host_path_result "$3"
1659
# end func_convert_path_front_back_pathsep
1662
##################################################
1663
# $build to $host FILE NAME CONVERSION FUNCTIONS #
1664
##################################################
1665
# invoked via `$to_host_file_cmd ARG'
1667
# In each case, ARG is the path to be converted from $build to $host format.
1668
# Result will be available in $func_to_host_file_result.
1671
# func_to_host_file ARG
1672
# Converts the file name ARG from $build format to $host format. Return result
1673
# in func_to_host_file_result.
1674
func_to_host_file ()
1677
$to_host_file_cmd "$1"
1679
# end func_to_host_file
1682
# func_to_tool_file ARG LAZY
1683
# converts the file name ARG from $build format to toolchain format. Return
1684
# result in func_to_tool_file_result. If the conversion in use is listed
1685
# in (the comma separated) LAZY, no conversion takes place.
1686
func_to_tool_file ()
1690
*,"$to_tool_file_cmd",*)
1691
func_to_tool_file_result=$1
1694
$to_tool_file_cmd "$1"
1695
func_to_tool_file_result=$func_to_host_file_result
1699
# end func_to_tool_file
1702
# func_convert_file_noop ARG
1703
# Copy ARG to func_to_host_file_result.
1704
func_convert_file_noop ()
1706
func_to_host_file_result="$1"
1708
# end func_convert_file_noop
1711
# func_convert_file_msys_to_w32 ARG
1712
# Convert file name ARG from (mingw) MSYS to (mingw) w32 format; automatic
1713
# conversion to w32 is not available inside the cwrapper. Returns result in
1714
# func_to_host_file_result.
1715
func_convert_file_msys_to_w32 ()
1718
func_to_host_file_result="$1"
1719
if test -n "$1"; then
1720
func_convert_core_msys_to_w32 "$1"
1721
func_to_host_file_result="$func_convert_core_msys_to_w32_result"
1723
func_convert_file_check "$1" "$func_to_host_file_result"
1725
# end func_convert_file_msys_to_w32
1728
# func_convert_file_cygwin_to_w32 ARG
1729
# Convert file name ARG from Cygwin to w32 format. Returns result in
1730
# func_to_host_file_result.
1731
func_convert_file_cygwin_to_w32 ()
1734
func_to_host_file_result="$1"
1735
if test -n "$1"; then
1736
# because $build is cygwin, we call "the" cygpath in $PATH; no need to use
1737
# LT_CYGPATH in this case.
1738
func_to_host_file_result=`cygpath -m "$1"`
1740
func_convert_file_check "$1" "$func_to_host_file_result"
1742
# end func_convert_file_cygwin_to_w32
1745
# func_convert_file_nix_to_w32 ARG
1746
# Convert file name ARG from *nix to w32 format. Requires a wine environment
1747
# and a working winepath. Returns result in func_to_host_file_result.
1748
func_convert_file_nix_to_w32 ()
1751
func_to_host_file_result="$1"
1752
if test -n "$1"; then
1753
func_convert_core_file_wine_to_w32 "$1"
1754
func_to_host_file_result="$func_convert_core_file_wine_to_w32_result"
1756
func_convert_file_check "$1" "$func_to_host_file_result"
1758
# end func_convert_file_nix_to_w32
1761
# func_convert_file_msys_to_cygwin ARG
1762
# Convert file name ARG from MSYS to Cygwin format. Requires LT_CYGPATH set.
1763
# Returns result in func_to_host_file_result.
1764
func_convert_file_msys_to_cygwin ()
1767
func_to_host_file_result="$1"
1768
if test -n "$1"; then
1769
func_convert_core_msys_to_w32 "$1"
1770
func_cygpath -u "$func_convert_core_msys_to_w32_result"
1771
func_to_host_file_result="$func_cygpath_result"
1773
func_convert_file_check "$1" "$func_to_host_file_result"
1775
# end func_convert_file_msys_to_cygwin
1778
# func_convert_file_nix_to_cygwin ARG
1779
# Convert file name ARG from *nix to Cygwin format. Requires Cygwin installed
1780
# in a wine environment, working winepath, and LT_CYGPATH set. Returns result
1781
# in func_to_host_file_result.
1782
func_convert_file_nix_to_cygwin ()
1785
func_to_host_file_result="$1"
1786
if test -n "$1"; then
1787
# convert from *nix to w32, then use cygpath to convert from w32 to cygwin.
1788
func_convert_core_file_wine_to_w32 "$1"
1789
func_cygpath -u "$func_convert_core_file_wine_to_w32_result"
1790
func_to_host_file_result="$func_cygpath_result"
1792
func_convert_file_check "$1" "$func_to_host_file_result"
1794
# end func_convert_file_nix_to_cygwin
1797
#############################################
1798
# $build to $host PATH CONVERSION FUNCTIONS #
1799
#############################################
1800
# invoked via `$to_host_path_cmd ARG'
1802
# In each case, ARG is the path to be converted from $build to $host format.
1803
# The result will be available in $func_to_host_path_result.
1805
# Path separators are also converted from $build format to $host format. If
1806
# ARG begins or ends with a path separator character, it is preserved (but
1807
# converted to $host format) on output.
1809
# All path conversion functions are named using the following convention:
1810
# file name conversion function : func_convert_file_X_to_Y ()
1811
# path conversion function : func_convert_path_X_to_Y ()
1812
# where, for any given $build/$host combination the 'X_to_Y' value is the
1813
# same. If conversion functions are added for new $build/$host combinations,
1814
# the two new functions must follow this pattern, or func_init_to_host_path_cmd
1818
# func_init_to_host_path_cmd
1819
# Ensures that function "pointer" variable $to_host_path_cmd is set to the
1820
# appropriate value, based on the value of $to_host_file_cmd.
1822
func_init_to_host_path_cmd ()
1825
if test -z "$to_host_path_cmd"; then
1826
func_stripname 'func_convert_file_' '' "$to_host_file_cmd"
1827
to_host_path_cmd="func_convert_path_${func_stripname_result}"
1832
# func_to_host_path ARG
1833
# Converts the path ARG from $build format to $host format. Return result
1834
# in func_to_host_path_result.
1835
func_to_host_path ()
1838
func_init_to_host_path_cmd
1839
$to_host_path_cmd "$1"
1841
# end func_to_host_path
1844
# func_convert_path_noop ARG
1845
# Copy ARG to func_to_host_path_result.
1846
func_convert_path_noop ()
1848
func_to_host_path_result="$1"
1850
# end func_convert_path_noop
1853
# func_convert_path_msys_to_w32 ARG
1854
# Convert path ARG from (mingw) MSYS to (mingw) w32 format; automatic
1855
# conversion to w32 is not available inside the cwrapper. Returns result in
1856
# func_to_host_path_result.
1857
func_convert_path_msys_to_w32 ()
1860
func_to_host_path_result="$1"
1861
if test -n "$1"; then
1862
# Remove leading and trailing path separator characters from ARG. MSYS
1863
# behavior is inconsistent here; cygpath turns them into '.;' and ';.';
1864
# and winepath ignores them completely.
1865
func_stripname : : "$1"
1866
func_to_host_path_tmp1=$func_stripname_result
1867
func_convert_core_msys_to_w32 "$func_to_host_path_tmp1"
1868
func_to_host_path_result="$func_convert_core_msys_to_w32_result"
1869
func_convert_path_check : ";" \
1870
"$func_to_host_path_tmp1" "$func_to_host_path_result"
1871
func_convert_path_front_back_pathsep ":*" "*:" ";" "$1"
1874
# end func_convert_path_msys_to_w32
1877
# func_convert_path_cygwin_to_w32 ARG
1878
# Convert path ARG from Cygwin to w32 format. Returns result in
1879
# func_to_host_file_result.
1880
func_convert_path_cygwin_to_w32 ()
1883
func_to_host_path_result="$1"
1884
if test -n "$1"; then
1885
# See func_convert_path_msys_to_w32:
1886
func_stripname : : "$1"
1887
func_to_host_path_tmp1=$func_stripname_result
1888
func_to_host_path_result=`cygpath -m -p "$func_to_host_path_tmp1"`
1889
func_convert_path_check : ";" \
1890
"$func_to_host_path_tmp1" "$func_to_host_path_result"
1891
func_convert_path_front_back_pathsep ":*" "*:" ";" "$1"
1894
# end func_convert_path_cygwin_to_w32
1897
# func_convert_path_nix_to_w32 ARG
1898
# Convert path ARG from *nix to w32 format. Requires a wine environment and
1899
# a working winepath. Returns result in func_to_host_file_result.
1900
func_convert_path_nix_to_w32 ()
1903
func_to_host_path_result="$1"
1904
if test -n "$1"; then
1905
# See func_convert_path_msys_to_w32:
1906
func_stripname : : "$1"
1907
func_to_host_path_tmp1=$func_stripname_result
1908
func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1"
1909
func_to_host_path_result="$func_convert_core_path_wine_to_w32_result"
1910
func_convert_path_check : ";" \
1911
"$func_to_host_path_tmp1" "$func_to_host_path_result"
1912
func_convert_path_front_back_pathsep ":*" "*:" ";" "$1"
1915
# end func_convert_path_nix_to_w32
1918
# func_convert_path_msys_to_cygwin ARG
1919
# Convert path ARG from MSYS to Cygwin format. Requires LT_CYGPATH set.
1920
# Returns result in func_to_host_file_result.
1921
func_convert_path_msys_to_cygwin ()
1924
func_to_host_path_result="$1"
1925
if test -n "$1"; then
1926
# See func_convert_path_msys_to_w32:
1927
func_stripname : : "$1"
1928
func_to_host_path_tmp1=$func_stripname_result
1929
func_convert_core_msys_to_w32 "$func_to_host_path_tmp1"
1930
func_cygpath -u -p "$func_convert_core_msys_to_w32_result"
1931
func_to_host_path_result="$func_cygpath_result"
1932
func_convert_path_check : : \
1933
"$func_to_host_path_tmp1" "$func_to_host_path_result"
1934
func_convert_path_front_back_pathsep ":*" "*:" : "$1"
1937
# end func_convert_path_msys_to_cygwin
1940
# func_convert_path_nix_to_cygwin ARG
1941
# Convert path ARG from *nix to Cygwin format. Requires Cygwin installed in a
1942
# a wine environment, working winepath, and LT_CYGPATH set. Returns result in
1943
# func_to_host_file_result.
1944
func_convert_path_nix_to_cygwin ()
1947
func_to_host_path_result="$1"
1948
if test -n "$1"; then
1949
# Remove leading and trailing path separator characters from
1950
# ARG. msys behavior is inconsistent here, cygpath turns them
1951
# into '.;' and ';.', and winepath ignores them completely.
1952
func_stripname : : "$1"
1953
func_to_host_path_tmp1=$func_stripname_result
1954
func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1"
1955
func_cygpath -u -p "$func_convert_core_path_wine_to_w32_result"
1956
func_to_host_path_result="$func_cygpath_result"
1957
func_convert_path_check : : \
1958
"$func_to_host_path_tmp1" "$func_to_host_path_result"
1959
func_convert_path_front_back_pathsep ":*" "*:" : "$1"
1962
# end func_convert_path_nix_to_cygwin
1965
# func_mode_compile arg...
1966
func_mode_compile ()
1969
# Get the compilation command and the source file.
1971
srcfile="$nonopt" # always keep a non-empty value in "srcfile"
1983
# do not "continue". Instead, add this to base_compile
1995
# Accept any command-line options.
1998
test -n "$libobj" && \
1999
func_fatal_error "you cannot specify \`-o' more than once"
2004
-pie | -fpie | -fPIE)
2005
func_append pie_flag " $arg"
2009
-shared | -static | -prefer-pic | -prefer-non-pic)
2010
func_append later " $arg"
2020
arg_mode=arg # the next one goes into the "base_compile" arg list
2021
continue # The current "srcfile" will either be retained or
2022
;; # replaced later. I would guess that would be a bug.
2025
func_stripname '-Wc,' '' "$arg"
2026
args=$func_stripname_result
2028
save_ifs="$IFS"; IFS=','
2029
for arg in $args; do
2031
func_append_quoted lastarg "$arg"
2034
func_stripname ' ' '' "$lastarg"
2035
lastarg=$func_stripname_result
2037
# Add the arguments to base_compile.
2038
func_append base_compile " $lastarg"
2043
# Accept the current argument as the source file.
2044
# The previous "srcfile" becomes the current argument.
2051
esac # case $arg_mode
2053
# Aesthetically quote the previous argument.
2054
func_append_quoted base_compile "$lastarg"
2059
func_fatal_error "you must specify an argument for -Xcompile"
2062
func_fatal_error "you must specify a target with \`-o'"
2065
# Get the name of the library object.
2066
test -z "$libobj" && {
2067
func_basename "$srcfile"
2068
libobj="$func_basename_result"
2073
# Recognize several different file suffixes.
2074
# If the user specifies -o file.o, it is replaced with file.lo
2077
*.ada | *.adb | *.ads | *.asm | \
2078
*.c++ | *.cc | *.ii | *.class | *.cpp | *.cxx | \
2079
*.[fF][09]? | *.for | *.java | *.go | *.obj | *.sx | *.cu | *.cup)
2080
func_xform "$libobj"
2081
libobj=$func_xform_result
2086
*.lo) func_lo2o "$libobj"; obj=$func_lo2o_result ;;
2088
func_fatal_error "cannot determine name of library object from \`$libobj'"
2092
func_infer_tag $base_compile
2094
for arg in $later; do
2097
test "$build_libtool_libs" != yes && \
2098
func_fatal_configuration "can not build a shared library"
2104
build_libtool_libs=no
2121
func_quote_for_eval "$libobj"
2122
test "X$libobj" != "X$func_quote_for_eval_result" \
2123
&& $ECHO "X$libobj" | $GREP '[]~#^*{};<>?"'"'"' &()|`$[]' \
2124
&& func_warning "libobj name \`$libobj' may not contain shell special characters."
2125
func_dirname_and_basename "$obj" "/" ""
2126
objname="$func_basename_result"
2127
xdir="$func_dirname_result"
2128
lobj=${xdir}$objdir/$objname
2130
test -z "$base_compile" && \
2131
func_fatal_help "you must specify a compilation command"
2133
# Delete any leftover library objects.
2134
if test "$build_old_libs" = yes; then
2135
removelist="$obj $lobj $libobj ${libobj}T"
2137
removelist="$lobj $libobj ${libobj}T"
2140
# On Cygwin there's no "real" PIC flag so we must build both object types
2142
cygwin* | mingw* | pw32* | os2* | cegcc*)
2146
if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then
2147
# non-PIC code in shared libraries is not supported
2151
# Calculate the filename of the output object if compiler does
2152
# not support -o with -c
2153
if test "$compiler_c_o" = no; then
2154
output_obj=`$ECHO "$srcfile" | $SED 's%^.*/%%; s%\.[^.]*$%%'`.${objext}
2155
lockfile="$output_obj.lock"
2162
# Lock this critical section if it is needed
2163
# We use this script file to make the link, it avoids creating a new file
2164
if test "$need_locks" = yes; then
2165
until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do
2166
func_echo "Waiting for $lockfile to be removed"
2169
elif test "$need_locks" = warn; then
2170
if test -f "$lockfile"; then
2172
*** ERROR, $lockfile exists and contains:
2173
`cat $lockfile 2>/dev/null`
2175
This indicates that another process is trying to use the same
2176
temporary object file, and libtool could not work around it because
2177
your compiler does not support \`-c' and \`-o' together. If you
2178
repeat this compilation, it may succeed, by chance, but you had better
2179
avoid parallel builds (make -j) in this platform, or get a better
2182
$opt_dry_run || $RM $removelist
2185
func_append removelist " $output_obj"
2186
$ECHO "$srcfile" > "$lockfile"
2189
$opt_dry_run || $RM $removelist
2190
func_append removelist " $lockfile"
2191
trap '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' 1 2 15
2193
func_to_tool_file "$srcfile" func_convert_file_msys_to_w32
2194
srcfile=$func_to_tool_file_result
2195
func_quote_for_eval "$srcfile"
2196
qsrcfile=$func_quote_for_eval_result
2198
# Only build a PIC object if we are building libtool libraries.
2199
if test "$build_libtool_libs" = yes; then
2200
# Without this assignment, base_compile gets emptied.
2201
fbsd_hideous_sh_bug=$base_compile
2203
if test "$pic_mode" != no; then
2204
command="$base_compile $qsrcfile $pic_flag"
2206
# Don't build PIC code
2207
command="$base_compile $qsrcfile"
2210
func_mkdir_p "$xdir$objdir"
2212
if test -z "$output_obj"; then
2213
# Place PIC objects in $objdir
2214
func_append command " -o $lobj"
2217
func_show_eval_locale "$command" \
2218
'test -n "$output_obj" && $RM $removelist; exit $EXIT_FAILURE'
2220
if test "$need_locks" = warn &&
2221
test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
2223
*** ERROR, $lockfile contains:
2224
`cat $lockfile 2>/dev/null`
2226
but it should contain:
2229
This indicates that another process is trying to use the same
2230
temporary object file, and libtool could not work around it because
2231
your compiler does not support \`-c' and \`-o' together. If you
2232
repeat this compilation, it may succeed, by chance, but you had better
2233
avoid parallel builds (make -j) in this platform, or get a better
2236
$opt_dry_run || $RM $removelist
2240
# Just move the object if needed, then go on to compile the next one
2241
if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then
2242
func_show_eval '$MV "$output_obj" "$lobj"' \
2243
'error=$?; $opt_dry_run || $RM $removelist; exit $error'
2246
# Allow error messages only from the first compilation.
2247
if test "$suppress_opt" = yes; then
2248
suppress_output=' >/dev/null 2>&1'
2252
# Only build a position-dependent object if we build old libraries.
2253
if test "$build_old_libs" = yes; then
2254
if test "$pic_mode" != yes; then
2255
# Don't build PIC code
2256
command="$base_compile $qsrcfile$pie_flag"
2258
command="$base_compile $qsrcfile $pic_flag"
2260
if test "$compiler_c_o" = yes; then
2261
func_append command " -o $obj"
2264
# Suppress compiler output if we already did a PIC compilation.
2265
func_append command "$suppress_output"
2266
func_show_eval_locale "$command" \
2267
'$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE'
2269
if test "$need_locks" = warn &&
2270
test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
2272
*** ERROR, $lockfile contains:
2273
`cat $lockfile 2>/dev/null`
2275
but it should contain:
2278
This indicates that another process is trying to use the same
2279
temporary object file, and libtool could not work around it because
2280
your compiler does not support \`-c' and \`-o' together. If you
2281
repeat this compilation, it may succeed, by chance, but you had better
2282
avoid parallel builds (make -j) in this platform, or get a better
2285
$opt_dry_run || $RM $removelist
2289
# Just move the object if needed
2290
if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then
2291
func_show_eval '$MV "$output_obj" "$obj"' \
2292
'error=$?; $opt_dry_run || $RM $removelist; exit $error'
2297
func_write_libtool_object "$libobj" "$objdir/$objname" "$objname"
2299
# Unlock the critical section if it was locked
2300
if test "$need_locks" != no; then
2301
removelist=$lockfile
2310
test "$opt_mode" = compile && func_mode_compile ${1+"$@"}
2315
# We need to display help for each of the modes.
2318
# Generic help is extracted from the usage comments
2319
# at the start of this file.
2325
"Usage: $progname [OPTION]... --mode=clean RM [RM-OPTION]... FILE...
2327
Remove files from the build directory.
2329
RM is the name of the program to use to delete files associated with each FILE
2330
(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
2333
If FILE is a libtool library, object or program, all the files associated
2334
with it are deleted. Otherwise, only FILE itself is deleted using RM."
2339
"Usage: $progname [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE
2341
Compile a source file into a libtool library object.
2343
This mode accepts the following additional options:
2345
-o OUTPUT-FILE set the output file name to OUTPUT-FILE
2346
-no-suppress do not suppress compiler output for multiple passes
2347
-prefer-pic try to build PIC objects only
2348
-prefer-non-pic try to build non-PIC objects only
2349
-shared do not build a \`.o' file suitable for static linking
2350
-static only build a \`.o' file suitable for static linking
2351
-Wc,FLAG pass FLAG directly to the compiler
2353
COMPILE-COMMAND is a command to be used in creating a \`standard' object file
2354
from the given SOURCEFILE.
2356
The output file name is determined by removing the directory component from
2357
SOURCEFILE, then substituting the C source code suffix \`.c' with the
2358
library object suffix, \`.lo'."
2363
"Usage: $progname [OPTION]... --mode=execute COMMAND [ARGS]...
2365
Automatically set library path, then run a program.
2367
This mode accepts the following additional options:
2369
-dlopen FILE add the directory containing FILE to the library path
2371
This mode sets the library path environment variable according to \`-dlopen'
2374
If any of the ARGS are libtool executable wrappers, then they are translated
2375
into their corresponding uninstalled binary, and any of their required library
2376
directories are added to the library path.
2378
Then, COMMAND is executed, with ARGS as arguments."
2383
"Usage: $progname [OPTION]... --mode=finish [LIBDIR]...
2385
Complete the installation of libtool libraries.
2387
Each LIBDIR is a directory that contains libtool libraries.
2389
The commands that this mode executes may require superuser privileges. Use
2390
the \`--dry-run' option if you just want to see what would be executed."
2395
"Usage: $progname [OPTION]... --mode=install INSTALL-COMMAND...
2397
Install executables or libraries.
2399
INSTALL-COMMAND is the installation command. The first component should be
2400
either the \`install' or \`cp' program.
2402
The following components of INSTALL-COMMAND are treated specially:
2404
-inst-prefix-dir PREFIX-DIR Use PREFIX-DIR as a staging area for installation
2406
The rest of the components are interpreted as arguments to that command (only
2407
BSD-compatible install options are recognized)."
2412
"Usage: $progname [OPTION]... --mode=link LINK-COMMAND...
2414
Link object files or libraries together to form another library, or to
2415
create an executable program.
2417
LINK-COMMAND is a command using the C compiler that you would use to create
2418
a program from several object files.
2420
The following components of LINK-COMMAND are treated specially:
2422
-all-static do not do any dynamic linking at all
2423
-avoid-version do not add a version suffix if possible
2424
-bindir BINDIR specify path to binaries directory (for systems where
2425
libraries must be found in the PATH setting at runtime)
2426
-dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime
2427
-dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols
2428
-export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
2429
-export-symbols SYMFILE
2430
try to export only the symbols listed in SYMFILE
2431
-export-symbols-regex REGEX
2432
try to export only the symbols matching REGEX
2433
-LLIBDIR search LIBDIR for required installed libraries
2434
-lNAME OUTPUT-FILE requires the installed library libNAME
2435
-module build a library that can dlopened
2436
-no-fast-install disable the fast-install mode
2437
-no-install link a not-installable executable
2438
-no-undefined declare that a library does not refer to external symbols
2439
-o OUTPUT-FILE create OUTPUT-FILE from the specified objects
2440
-objectlist FILE Use a list of object files found in FILE to specify objects
2441
-precious-files-regex REGEX
2442
don't remove output files matching REGEX
2443
-release RELEASE specify package release information
2444
-rpath LIBDIR the created library will eventually be installed in LIBDIR
2445
-R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries
2446
-shared only do dynamic linking of libtool libraries
2447
-shrext SUFFIX override the standard shared library file extension
2448
-static do not do any dynamic linking of uninstalled libtool libraries
2449
-static-libtool-libs
2450
do not do any dynamic linking of libtool libraries
2451
-version-info CURRENT[:REVISION[:AGE]]
2452
specify library version info [each variable defaults to 0]
2453
-weak LIBNAME declare that the target provides the LIBNAME interface
2455
-Xcompiler FLAG pass linker-specific FLAG directly to the compiler
2457
-Xlinker FLAG pass linker-specific FLAG directly to the linker
2458
-XCClinker FLAG pass link-specific FLAG to the compiler driver (CC)
2460
All other options (arguments beginning with \`-') are ignored.
2462
Every other argument is treated as a filename. Files ending in \`.la' are
2463
treated as uninstalled libtool libraries, other files are standard or library
2466
If the OUTPUT-FILE ends in \`.la', then a libtool library is created,
2467
only library objects (\`.lo' files) may be specified, and \`-rpath' is
2468
required, except when creating a convenience library.
2470
If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created
2471
using \`ar' and \`ranlib', or on Windows using \`lib'.
2473
If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file
2474
is created, otherwise an executable program is created."
2479
"Usage: $progname [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE...
2481
Remove libraries from an installation directory.
2483
RM is the name of the program to use to delete files associated with each FILE
2484
(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
2487
If FILE is a libtool library, all the files associated with it are deleted.
2488
Otherwise, only FILE itself is deleted using RM."
2492
func_fatal_help "invalid operation mode \`$opt_mode'"
2497
$ECHO "Try \`$progname --help' for more information about other modes."
2500
# Now that we've collected a possible --mode arg, show help if necessary
2502
if test "$opt_help" = :; then
2507
for opt_mode in compile link execute install finish uninstall clean; do
2510
} | sed -n '1p; 2,$s/^Usage:/ or: /p'
2513
for opt_mode in compile link execute install finish uninstall clean; do
2519
/^When reporting/,/^Report/{
2524
/information about other modes/d
2525
/more detailed .*MODE/d
2526
s/^Usage:.*--mode=\([^ ]*\) .*/Description of \1 mode:/'
2532
# func_mode_execute arg...
2533
func_mode_execute ()
2536
# The first argument is the command name.
2539
func_fatal_help "you must specify a COMMAND"
2541
# Handle -dlopen flags immediately.
2542
for file in $opt_dlopen; do
2544
|| func_fatal_help "\`$file' is not a file"
2549
func_resolve_sysroot "$file"
2550
file=$func_resolve_sysroot_result
2552
# Check to see that this really is a libtool archive.
2553
func_lalib_unsafe_p "$file" \
2554
|| func_fatal_help "\`$lib' is not a valid libtool archive"
2556
# Read the libtool library.
2561
# Skip this library if it cannot be dlopened.
2562
if test -z "$dlname"; then
2563
# Warn if it was a shared library.
2564
test -n "$library_names" && \
2565
func_warning "\`$file' was not linked with \`-export-dynamic'"
2569
func_dirname "$file" "" "."
2570
dir="$func_dirname_result"
2572
if test -f "$dir/$objdir/$dlname"; then
2573
func_append dir "/$objdir"
2575
if test ! -f "$dir/$dlname"; then
2576
func_fatal_error "cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'"
2582
# Just add the directory containing the .lo file.
2583
func_dirname "$file" "" "."
2584
dir="$func_dirname_result"
2588
func_warning "\`-dlopen' is ignored for non-libtool libraries and objects"
2593
# Get the absolute pathname.
2594
absdir=`cd "$dir" && pwd`
2595
test -n "$absdir" && dir="$absdir"
2597
# Now add the directory to shlibpath_var.
2598
if eval "test -z \"\$$shlibpath_var\""; then
2599
eval "$shlibpath_var=\"\$dir\""
2601
eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\""
2605
# This variable tells wrapper scripts just to set shlibpath_var
2606
# rather than running their programs.
2607
libtool_execute_magic="$magic"
2609
# Check if any of the arguments is a wrapper script.
2614
-* | *.la | *.lo ) ;;
2616
# Do a test to see if this is really a libtool program.
2617
if func_ltwrapper_script_p "$file"; then
2619
# Transform arg to wrapped name.
2620
file="$progdir/$program"
2621
elif func_ltwrapper_executable_p "$file"; then
2622
func_ltwrapper_scriptname "$file"
2623
func_source "$func_ltwrapper_scriptname_result"
2624
# Transform arg to wrapped name.
2625
file="$progdir/$program"
2629
# Quote arguments (to preserve shell metacharacters).
2630
func_append_quoted args "$file"
2633
if test "X$opt_dry_run" = Xfalse; then
2634
if test -n "$shlibpath_var"; then
2635
# Export the shlibpath_var.
2636
eval "export $shlibpath_var"
2639
# Restore saved environment variables
2640
for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
2642
eval "if test \"\${save_$lt_var+set}\" = set; then
2643
$lt_var=\$save_$lt_var; export $lt_var
2649
# Now prepare to actually exec the command.
2650
exec_cmd="\$cmd$args"
2652
# Display what would be done.
2653
if test -n "$shlibpath_var"; then
2654
eval "\$ECHO \"\$shlibpath_var=\$$shlibpath_var\""
2655
echo "export $shlibpath_var"
2662
test "$opt_mode" = execute && func_mode_execute ${1+"$@"}
2665
# func_mode_finish arg...
2673
for opt in "$nonopt" ${1+"$@"}
2675
if test -d "$opt"; then
2676
func_append libdirs " $opt"
2678
elif test -f "$opt"; then
2679
if func_lalib_unsafe_p "$opt"; then
2680
func_append libs " $opt"
2682
func_warning "\`$opt' is not a valid libtool archive"
2686
func_fatal_error "invalid argument \`$opt'"
2690
if test -n "$libs"; then
2691
if test -n "$lt_sysroot"; then
2692
sysroot_regex=`$ECHO "$lt_sysroot" | $SED "$sed_make_literal_regex"`
2693
sysroot_cmd="s/\([ ']\)$sysroot_regex/\1/g;"
2698
# Remove sysroot references
2699
if $opt_dry_run; then
2700
for lib in $libs; do
2701
echo "removing references to $lt_sysroot and \`=' prefixes from $lib"
2704
tmpdir=`func_mktempdir`
2705
for lib in $libs; do
2706
sed -e "${sysroot_cmd} s/\([ ']-[LR]\)=/\1/g; s/\([ ']\)=/\1/g" $lib \
2708
mv -f $tmpdir/tmp-la $lib
2714
if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
2715
for libdir in $libdirs; do
2716
if test -n "$finish_cmds"; then
2717
# Do each command in the finish commands.
2718
func_execute_cmds "$finish_cmds" 'admincmds="$admincmds
2721
if test -n "$finish_eval"; then
2722
# Do the single finish_eval.
2723
eval cmds=\"$finish_eval\"
2724
$opt_dry_run || eval "$cmds" || func_append admincmds "
2730
# Exit here if they wanted silent mode.
2731
$opt_silent && exit $EXIT_SUCCESS
2733
if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
2734
echo "----------------------------------------------------------------------"
2735
echo "Libraries have been installed in:"
2736
for libdir in $libdirs; do
2740
echo "If you ever happen to want to link against installed libraries"
2741
echo "in a given directory, LIBDIR, you must either use libtool, and"
2742
echo "specify the full pathname of the library, or use the \`-LLIBDIR'"
2743
echo "flag during linking and do at least one of the following:"
2744
if test -n "$shlibpath_var"; then
2745
echo " - add LIBDIR to the \`$shlibpath_var' environment variable"
2746
echo " during execution"
2748
if test -n "$runpath_var"; then
2749
echo " - add LIBDIR to the \`$runpath_var' environment variable"
2750
echo " during linking"
2752
if test -n "$hardcode_libdir_flag_spec"; then
2754
eval flag=\"$hardcode_libdir_flag_spec\"
2756
$ECHO " - use the \`$flag' linker flag"
2758
if test -n "$admincmds"; then
2759
$ECHO " - have your system administrator run these commands:$admincmds"
2761
if test -f /etc/ld.so.conf; then
2762
echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'"
2766
echo "See any operating system documentation about shared libraries for"
2768
solaris2.[6789]|solaris2.1[0-9])
2769
echo "more information, such as the ld(1), crle(1) and ld.so(8) manual"
2773
echo "more information, such as the ld(1) and ld.so(8) manual pages."
2776
echo "----------------------------------------------------------------------"
2781
test "$opt_mode" = finish && func_mode_finish ${1+"$@"}
2784
# func_mode_install arg...
2785
func_mode_install ()
2788
# There may be an optional sh(1) argument at the beginning of
2789
# install_prog (especially on Windows NT).
2790
if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh ||
2791
# Allow the use of GNU shtool's install command.
2792
case $nonopt in *shtool*) :;; *) false;; esac; then
2793
# Aesthetically quote it.
2794
func_quote_for_eval "$nonopt"
2795
install_prog="$func_quote_for_eval_result "
2803
# The real first argument should be the name of the installation program.
2804
# Aesthetically quote it.
2805
func_quote_for_eval "$arg"
2806
func_append install_prog "$func_quote_for_eval_result"
2807
install_shared_prog=$install_prog
2808
case " $install_prog " in
2809
*[\\\ /]cp\ *) install_cp=: ;;
2810
*) install_cp=false ;;
2813
# We need to accept at least all the BSD install flags.
2825
if test -n "$dest"; then
2826
func_append files " $dest"
2834
if $install_cp; then :; else
2848
# If the previous option needed an argument, then skip it.
2849
if test -n "$prev"; then
2850
if test "x$prev" = x-m && test -n "$install_override_mode"; then
2851
arg2=$install_override_mode
2862
# Aesthetically quote the argument.
2863
func_quote_for_eval "$arg"
2864
func_append install_prog " $func_quote_for_eval_result"
2865
if test -n "$arg2"; then
2866
func_quote_for_eval "$arg2"
2868
func_append install_shared_prog " $func_quote_for_eval_result"
2871
test -z "$install_prog" && \
2872
func_fatal_help "you must specify an install program"
2874
test -n "$prev" && \
2875
func_fatal_help "the \`$prev' option requires an argument"
2877
if test -n "$install_override_mode" && $no_mode; then
2878
if $install_cp; then :; else
2879
func_quote_for_eval "$install_override_mode"
2880
func_append install_shared_prog " -m $func_quote_for_eval_result"
2884
if test -z "$files"; then
2885
if test -z "$dest"; then
2886
func_fatal_help "no file or destination specified"
2888
func_fatal_help "you must specify a destination"
2892
# Strip any trailing slash from the destination.
2893
func_stripname '' '/' "$dest"
2894
dest=$func_stripname_result
2896
# Check to see that the destination is a directory.
2897
test -d "$dest" && isdir=yes
2898
if test "$isdir" = yes; then
2902
func_dirname_and_basename "$dest" "" "."
2903
destdir="$func_dirname_result"
2904
destname="$func_basename_result"
2906
# Not a directory, so check to see that there is only one file specified.
2907
set dummy $files; shift
2908
test "$#" -gt 1 && \
2909
func_fatal_help "\`$dest' is not a directory"
2912
[\\/]* | [A-Za-z]:[\\/]*) ;;
2914
for file in $files; do
2918
func_fatal_help "\`$destdir' must be an absolute directory name"
2925
# This variable tells wrapper scripts just to set variables rather
2926
# than running their programs.
2927
libtool_install_magic="$magic"
2932
for file in $files; do
2934
# Do each installation.
2937
# Do the static libraries later.
2938
func_append staticlibs " $file"
2942
func_resolve_sysroot "$file"
2943
file=$func_resolve_sysroot_result
2945
# Check to see that this really is a libtool archive.
2946
func_lalib_unsafe_p "$file" \
2947
|| func_fatal_help "\`$file' is not a valid libtool archive"
2954
# Add the libdir to current_libdirs if it is the destination.
2955
if test "X$destdir" = "X$libdir"; then
2956
case "$current_libdirs " in
2958
*) func_append current_libdirs " $libdir" ;;
2961
# Note the libdir as a future libdir.
2962
case "$future_libdirs " in
2964
*) func_append future_libdirs " $libdir" ;;
2968
func_dirname "$file" "/" ""
2969
dir="$func_dirname_result"
2970
func_append dir "$objdir"
2972
if test -n "$relink_command"; then
2973
# Determine the prefix the user has applied to our future dir.
2974
inst_prefix_dir=`$ECHO "$destdir" | $SED -e "s%$libdir\$%%"`
2976
# Don't allow the user to place us outside of our expected
2977
# location b/c this prevents finding dependent libraries that
2978
# are installed to the same prefix.
2979
# At present, this check doesn't affect windows .dll's that
2980
# are installed into $libdir/../bin (currently, that works fine)
2981
# but it's something to keep an eye on.
2982
test "$inst_prefix_dir" = "$destdir" && \
2983
func_fatal_error "error: cannot install \`$file' to a directory not ending in $libdir"
2985
if test -n "$inst_prefix_dir"; then
2986
# Stick the inst_prefix_dir data into the link command.
2987
relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"`
2989
relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%%"`
2992
func_warning "relinking \`$file'"
2993
func_show_eval "$relink_command" \
2994
'func_fatal_error "error: relink \`$file'\'' with the above command before installing it"'
2997
# See the names of the shared library.
2998
set dummy $library_names; shift
2999
if test -n "$1"; then
3004
test -n "$relink_command" && srcname="$realname"T
3006
# Install the shared library and build the symlinks.
3007
func_show_eval "$install_shared_prog $dir/$srcname $destdir/$realname" \
3011
cygwin* | mingw* | pw32* | cegcc*)
3019
if test -n "$tstripme" && test -n "$striplib"; then
3020
func_show_eval "$striplib $destdir/$realname" 'exit $?'
3023
if test "$#" -gt 0; then
3024
# Delete the old symlinks, and create new ones.
3025
# Try `ln -sf' first, because the `ln' binary might depend on
3026
# the symlink we replace! Solaris /bin/ln does not understand -f,
3027
# so we also need to try rm && ln -s.
3030
test "$linkname" != "$realname" \
3031
&& func_show_eval "(cd $destdir && { $LN_S -f $realname $linkname || { $RM $linkname && $LN_S $realname $linkname; }; })"
3035
# Do each command in the postinstall commands.
3036
lib="$destdir/$realname"
3037
func_execute_cmds "$postinstall_cmds" 'exit $?'
3040
# Install the pseudo-library for information purposes.
3041
func_basename "$file"
3042
name="$func_basename_result"
3043
instname="$dir/$name"i
3044
func_show_eval "$install_prog $instname $destdir/$name" 'exit $?'
3046
# Maybe install the static library, too.
3047
test -n "$old_library" && func_append staticlibs " $dir/$old_library"
3051
# Install (i.e. copy) a libtool object.
3053
# Figure out destination file name, if it wasn't already specified.
3054
if test -n "$destname"; then
3055
destfile="$destdir/$destname"
3057
func_basename "$file"
3058
destfile="$func_basename_result"
3059
destfile="$destdir/$destfile"
3062
# Deduce the name of the destination old-style object file.
3065
func_lo2o "$destfile"
3066
staticdest=$func_lo2o_result
3069
staticdest="$destfile"
3073
func_fatal_help "cannot copy a libtool object to \`$destfile'"
3077
# Install the libtool object if requested.
3078
test -n "$destfile" && \
3079
func_show_eval "$install_prog $file $destfile" 'exit $?'
3081
# Install the old object if enabled.
3082
if test "$build_old_libs" = yes; then
3083
# Deduce the name of the old-style object file.
3085
staticobj=$func_lo2o_result
3086
func_show_eval "$install_prog \$staticobj \$staticdest" 'exit $?'
3092
# Figure out destination file name, if it wasn't already specified.
3093
if test -n "$destname"; then
3094
destfile="$destdir/$destname"
3096
func_basename "$file"
3097
destfile="$func_basename_result"
3098
destfile="$destdir/$destfile"
3101
# If the file is missing, and there is a .exe on the end, strip it
3102
# because it is most likely a libtool script we actually want to
3107
if test ! -f "$file"; then
3108
func_stripname '' '.exe' "$file"
3109
file=$func_stripname_result
3115
# Do a test to see if this is really a libtool program.
3118
if func_ltwrapper_executable_p "$file"; then
3119
func_ltwrapper_scriptname "$file"
3120
wrapper=$func_ltwrapper_scriptname_result
3122
func_stripname '' '.exe' "$file"
3123
wrapper=$func_stripname_result
3130
if func_ltwrapper_script_p "$wrapper"; then
3134
func_source "$wrapper"
3136
# Check the variables that should have been set.
3137
test -z "$generated_by_libtool_version" && \
3138
func_fatal_error "invalid libtool wrapper script \`$wrapper'"
3141
for lib in $notinst_deplibs; do
3142
# Check to see that each library is installed.
3144
if test -f "$lib"; then
3147
libfile="$libdir/"`$ECHO "$lib" | $SED 's%^.*/%%g'` ### testsuite: skip nested quoting test
3148
if test -n "$libdir" && test ! -f "$libfile"; then
3149
func_warning "\`$lib' has not been installed in \`$libdir'"
3155
func_source "$wrapper"
3158
if test "$fast_install" = no && test -n "$relink_command"; then
3160
if test "$finalize" = yes; then
3161
tmpdir=`func_mktempdir`
3162
func_basename "$file$stripped_ext"
3163
file="$func_basename_result"
3164
outputname="$tmpdir/$file"
3165
# Replace the output file specification.
3166
relink_command=`$ECHO "$relink_command" | $SED 's%@OUTPUT@%'"$outputname"'%g'`
3169
func_quote_for_expand "$relink_command"
3170
eval "func_echo $func_quote_for_expand_result"
3172
if eval "$relink_command"; then :
3174
func_error "error: relink \`$file' with the above command before installing it"
3175
$opt_dry_run || ${RM}r "$tmpdir"
3180
func_warning "cannot relink \`$file'"
3184
# Install the binary that we compiled earlier.
3185
file=`$ECHO "$file$stripped_ext" | $SED "s%\([^/]*\)$%$objdir/\1%"`
3189
# remove .exe since cygwin /usr/bin/install will append another
3191
case $install_prog,$host in
3192
*/usr/bin/install*,*cygwin*)
3193
case $file:$destfile in
3198
destfile=$destfile.exe
3201
func_stripname '' '.exe' "$destfile"
3202
destfile=$func_stripname_result
3207
func_show_eval "$install_prog\$stripme \$file \$destfile" 'exit $?'
3208
$opt_dry_run || if test -n "$outputname"; then
3215
for file in $staticlibs; do
3216
func_basename "$file"
3217
name="$func_basename_result"
3219
# Set up the ranlib parameters.
3220
oldlib="$destdir/$name"
3221
func_to_tool_file "$oldlib" func_convert_file_msys_to_w32
3222
tool_oldlib=$func_to_tool_file_result
3224
func_show_eval "$install_prog \$file \$oldlib" 'exit $?'
3226
if test -n "$stripme" && test -n "$old_striplib"; then
3227
func_show_eval "$old_striplib $tool_oldlib" 'exit $?'
3230
# Do each command in the postinstall commands.
3231
func_execute_cmds "$old_postinstall_cmds" 'exit $?'
3234
test -n "$future_libdirs" && \
3235
func_warning "remember to run \`$progname --finish$future_libdirs'"
3237
if test -n "$current_libdirs"; then
3238
# Maybe just do a dry run.
3239
$opt_dry_run && current_libdirs=" -n$current_libdirs"
3240
exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs'
3246
test "$opt_mode" = install && func_mode_install ${1+"$@"}
3249
# func_generate_dlsyms outputname originator pic_p
3250
# Extract symbols from dlprefiles and create ${outputname}S.o with
3251
# a dlpreopen symbol table.
3252
func_generate_dlsyms ()
3258
my_prefix=`$ECHO "$my_originator" | sed 's%[^a-zA-Z0-9]%_%g'`
3261
if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
3262
if test -n "$NM" && test -n "$global_symbol_pipe"; then
3263
my_dlsyms="${my_outputname}S.c"
3265
func_error "not configured to extract global symbols from dlpreopened files"
3269
if test -n "$my_dlsyms"; then
3273
# Discover the nlist of each of the dlfiles.
3274
nlist="$output_objdir/${my_outputname}.nm"
3276
func_show_eval "$RM $nlist ${nlist}S ${nlist}T"
3278
# Parse the name list into a source file.
3279
func_verbose "creating $output_objdir/$my_dlsyms"
3281
$opt_dry_run || $ECHO > "$output_objdir/$my_dlsyms" "\
3282
/* $my_dlsyms - symbol resolution table for \`$my_outputname' dlsym emulation. */
3283
/* Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION */
3289
#if defined(__GNUC__) && (((__GNUC__ == 4) && (__GNUC_MINOR__ >= 4)) || (__GNUC__ > 4))
3290
#pragma GCC diagnostic ignored \"-Wstrict-prototypes\"
3293
/* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */
3294
#if defined(_WIN32) || defined(__CYGWIN__) || defined(_WIN32_WCE)
3295
/* DATA imports from DLLs on WIN32 con't be const, because runtime
3296
relocations are performed -- see ld's documentation on pseudo-relocs. */
3297
# define LT_DLSYM_CONST
3298
#elif defined(__osf__)
3299
/* This system does not cope well with relocations in const data. */
3300
# define LT_DLSYM_CONST
3302
# define LT_DLSYM_CONST const
3305
/* External symbol declarations for the compiler. */\
3308
if test "$dlself" = yes; then
3309
func_verbose "generating symbol list for \`$output'"
3311
$opt_dry_run || echo ': @PROGRAM@ ' > "$nlist"
3313
# Add our own program objects to the symbol list.
3314
progfiles=`$ECHO "$objs$old_deplibs" | $SP2NL | $SED "$lo2o" | $NL2SP`
3315
for progfile in $progfiles; do
3316
func_to_tool_file "$progfile" func_convert_file_msys_to_w32
3317
func_verbose "extracting global C symbols from \`$func_to_tool_file_result'"
3318
$opt_dry_run || eval "$NM $func_to_tool_file_result | $global_symbol_pipe >> '$nlist'"
3321
if test -n "$exclude_expsyms"; then
3323
eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
3324
eval '$MV "$nlist"T "$nlist"'
3328
if test -n "$export_symbols_regex"; then
3330
eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T'
3331
eval '$MV "$nlist"T "$nlist"'
3335
# Prepare the list of exported symbols
3336
if test -z "$export_symbols"; then
3337
export_symbols="$output_objdir/$outputname.exp"
3340
eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
3342
*cygwin* | *mingw* | *cegcc* )
3343
eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
3344
eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"'
3350
eval "${SED} -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"'
3351
eval '$GREP -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T'
3352
eval '$MV "$nlist"T "$nlist"'
3354
*cygwin* | *mingw* | *cegcc* )
3355
eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
3356
eval 'cat "$nlist" >> "$output_objdir/$outputname.def"'
3363
for dlprefile in $dlprefiles; do
3364
func_verbose "extracting global C symbols from \`$dlprefile'"
3365
func_basename "$dlprefile"
3366
name="$func_basename_result"
3368
*cygwin* | *mingw* | *cegcc* )
3369
# if an import library, we need to obtain dlname
3370
if func_win32_import_lib_p "$dlprefile"; then
3371
func_tr_sh "$dlprefile"
3372
eval "curr_lafile=\$libfile_$func_tr_sh_result"
3373
dlprefile_dlbasename=""
3374
if test -n "$curr_lafile" && func_lalib_p "$curr_lafile"; then
3375
# Use subshell, to avoid clobbering current variable values
3376
dlprefile_dlname=`source "$curr_lafile" && echo "$dlname"`
3377
if test -n "$dlprefile_dlname" ; then
3378
func_basename "$dlprefile_dlname"
3379
dlprefile_dlbasename="$func_basename_result"
3381
# no lafile. user explicitly requested -dlpreopen <import library>.
3382
$sharedlib_from_linklib_cmd "$dlprefile"
3383
dlprefile_dlbasename=$sharedlib_from_linklib_result
3387
if test -n "$dlprefile_dlbasename" ; then
3388
eval '$ECHO ": $dlprefile_dlbasename" >> "$nlist"'
3390
func_warning "Could not compute DLL name from $name"
3391
eval '$ECHO ": $name " >> "$nlist"'
3393
func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32
3394
eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe |
3395
$SED -e '/I __imp/d' -e 's/I __nm_/D /;s/_nm__//' >> '$nlist'"
3397
else # not an import lib
3399
eval '$ECHO ": $name " >> "$nlist"'
3400
func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32
3401
eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'"
3407
eval '$ECHO ": $name " >> "$nlist"'
3408
func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32
3409
eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'"
3416
# Make sure we have at least an empty file.
3417
test -f "$nlist" || : > "$nlist"
3419
if test -n "$exclude_expsyms"; then
3420
$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T
3421
$MV "$nlist"T "$nlist"
3424
# Try sorting and uniquifying the output.
3425
if $GREP -v "^: " < "$nlist" |
3426
if sort -k 3 </dev/null >/dev/null 2>&1; then
3431
uniq > "$nlist"S; then
3434
$GREP -v "^: " < "$nlist" > "$nlist"S
3437
if test -f "$nlist"S; then
3438
eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$my_dlsyms"'
3440
echo '/* NONE */' >> "$output_objdir/$my_dlsyms"
3443
echo >> "$output_objdir/$my_dlsyms" "\
3445
/* The mapping between symbol names and symbols. */
3450
extern LT_DLSYM_CONST lt_dlsymlist
3451
lt_${my_prefix}_LTX_preloaded_symbols[];
3452
LT_DLSYM_CONST lt_dlsymlist
3453
lt_${my_prefix}_LTX_preloaded_symbols[] =
3455
{ \"$my_originator\", (void *) 0 },"
3457
case $need_lib_prefix in
3459
eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$my_dlsyms"
3462
eval "$global_symbol_to_c_name_address_lib_prefix" < "$nlist" >> "$output_objdir/$my_dlsyms"
3465
echo >> "$output_objdir/$my_dlsyms" "\
3469
/* This works around a problem in FreeBSD linker */
3470
#ifdef FREEBSD_WORKAROUND
3471
static const void *lt_preloaded_setup() {
3472
return lt_${my_prefix}_LTX_preloaded_symbols;
3482
pic_flag_for_symtable=
3483
case "$compile_command " in
3487
# compiling the symbol table file with pic_flag works around
3488
# a FreeBSD bug that causes programs to crash when -lm is
3489
# linked before any other PIC object. But we must not use
3490
# pic_flag when linking with -static. The problem exists in
3491
# FreeBSD 2.2.6 and is fixed in FreeBSD 3.1.
3492
*-*-freebsd2.*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)
3493
pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND" ;;
3495
pic_flag_for_symtable=" $pic_flag" ;;
3497
if test "X$my_pic_p" != Xno; then
3498
pic_flag_for_symtable=" $pic_flag"
3505
for arg in $LTCFLAGS; do
3507
-pie | -fpie | -fPIE) ;;
3508
*) func_append symtab_cflags " $arg" ;;
3512
# Now compile the dynamic symbol file.
3513
func_show_eval '(cd $output_objdir && $LTCC$symtab_cflags -c$no_builtin_flag$pic_flag_for_symtable "$my_dlsyms")' 'exit $?'
3515
# Clean up the generated files.
3516
func_show_eval '$RM "$output_objdir/$my_dlsyms" "$nlist" "${nlist}S" "${nlist}T"'
3518
# Transform the symbol file into the correct name.
3519
symfileobj="$output_objdir/${my_outputname}S.$objext"
3521
*cygwin* | *mingw* | *cegcc* )
3522
if test -f "$output_objdir/$my_outputname.def"; then
3523
compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"`
3524
finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"`
3526
compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"`
3527
finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"`
3531
compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"`
3532
finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"`
3537
func_fatal_error "unknown suffix for \`$my_dlsyms'"
3541
# We keep going just in case the user didn't refer to
3542
# lt_preloaded_symbols. The linker will fail if global_symbol_pipe
3543
# really was required.
3545
# Nullify the symbol file.
3546
compile_command=`$ECHO "$compile_command" | $SED "s% @SYMFILE@%%"`
3547
finalize_command=`$ECHO "$finalize_command" | $SED "s% @SYMFILE@%%"`
3551
# func_win32_libid arg
3552
# return the library type of file 'arg'
3554
# Need a lot of goo to handle *both* DLLs and import libs
3555
# Has to be a shell function in order to 'eat' the argument
3556
# that is supplied when $file_magic_command is called.
3557
# Despite the name, also deal with 64 bit binaries.
3561
win32_libid_type="unknown"
3562
win32_fileres=`file -L $1 2>/dev/null`
3563
case $win32_fileres in
3564
*ar\ archive\ import\ library*) # definitely import
3565
win32_libid_type="x86 archive import"
3567
*ar\ archive*) # could be an import, or static
3568
# Keep the egrep pattern in sync with the one in _LT_CHECK_MAGIC_METHOD.
3569
if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null |
3570
$EGREP 'file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' >/dev/null; then
3571
func_to_tool_file "$1" func_convert_file_msys_to_w32
3572
win32_nmres=`eval $NM -f posix -A \"$func_to_tool_file_result\" |
3581
case $win32_nmres in
3582
import*) win32_libid_type="x86 archive import";;
3583
*) win32_libid_type="x86 archive static";;
3588
win32_libid_type="x86 DLL"
3590
*executable*) # but shell scripts are "executable" too...
3591
case $win32_fileres in
3592
*MS\ Windows\ PE\ Intel*)
3593
win32_libid_type="x86 DLL"
3598
$ECHO "$win32_libid_type"
3601
# func_cygming_dll_for_implib ARG
3603
# Platform-specific function to extract the
3604
# name of the DLL associated with the specified
3605
# import library ARG.
3606
# Invoked by eval'ing the libtool variable
3607
# $sharedlib_from_linklib_cmd
3608
# Result is available in the variable
3609
# $sharedlib_from_linklib_result
3610
func_cygming_dll_for_implib ()
3613
sharedlib_from_linklib_result=`$DLLTOOL --identify-strict --identify "$1"`
3616
# func_cygming_dll_for_implib_fallback_core SECTION_NAME LIBNAMEs
3618
# The is the core of a fallback implementation of a
3619
# platform-specific function to extract the name of the
3620
# DLL associated with the specified import library LIBNAME.
3622
# SECTION_NAME is either .idata$6 or .idata$7, depending
3623
# on the platform and compiler that created the implib.
3625
# Echos the name of the DLL associated with the
3626
# specified import library.
3627
func_cygming_dll_for_implib_fallback_core ()
3630
match_literal=`$ECHO "$1" | $SED "$sed_make_literal_regex"`
3631
$OBJDUMP -s --section "$1" "$2" 2>/dev/null |
3632
$SED '/^Contents of section '"$match_literal"':/{
3633
# Place marker at beginning of archive member dllname section
3638
# These lines can sometimes be longer than 43 characters, but
3639
# are always uninteresting
3640
/:[ ]*file format pe[i]\{,1\}-/d
3641
/^In archive [^:]*:/d
3642
# Ensure marker is printed
3644
# Remove all lines with less than 43 characters
3646
# From remaining lines, remove first 43 characters
3649
# Join marker and all lines until next marker into a single line
3650
/^====MARK====/ b para
3659
# Remove trailing dots and whitespace
3663
# we now have a list, one entry per line, of the stringified
3664
# contents of the appropriate section of all members of the
3665
# archive which possess that section. Heuristic: eliminate
3666
# all those which have a first or second character that is
3667
# a '.' (that is, objdump's representation of an unprintable
3668
# character.) This should work for all archives with less than
3669
# 0x302f exports -- but will fail for DLLs whose name actually
3670
# begins with a literal '.' or a single character followed by
3673
# Of those that remain, print the first one.
3674
$SED -e '/^\./d;/^.\./d;q'
3677
# func_cygming_gnu_implib_p ARG
3678
# This predicate returns with zero status (TRUE) if
3679
# ARG is a GNU/binutils-style import library. Returns
3680
# with nonzero status (FALSE) otherwise.
3681
func_cygming_gnu_implib_p ()
3684
func_to_tool_file "$1" func_convert_file_msys_to_w32
3685
func_cygming_gnu_implib_tmp=`$NM "$func_to_tool_file_result" | eval "$global_symbol_pipe" | $EGREP ' (_head_[A-Za-z0-9_]+_[ad]l*|[A-Za-z0-9_]+_[ad]l*_iname)$'`
3686
test -n "$func_cygming_gnu_implib_tmp"
3689
# func_cygming_ms_implib_p ARG
3690
# This predicate returns with zero status (TRUE) if
3691
# ARG is an MS-style import library. Returns
3692
# with nonzero status (FALSE) otherwise.
3693
func_cygming_ms_implib_p ()
3696
func_to_tool_file "$1" func_convert_file_msys_to_w32
3697
func_cygming_ms_implib_tmp=`$NM "$func_to_tool_file_result" | eval "$global_symbol_pipe" | $GREP '_NULL_IMPORT_DESCRIPTOR'`
3698
test -n "$func_cygming_ms_implib_tmp"
3701
# func_cygming_dll_for_implib_fallback ARG
3702
# Platform-specific function to extract the
3703
# name of the DLL associated with the specified
3704
# import library ARG.
3706
# This fallback implementation is for use when $DLLTOOL
3707
# does not support the --identify-strict option.
3708
# Invoked by eval'ing the libtool variable
3709
# $sharedlib_from_linklib_cmd
3710
# Result is available in the variable
3711
# $sharedlib_from_linklib_result
3712
func_cygming_dll_for_implib_fallback ()
3715
if func_cygming_gnu_implib_p "$1" ; then
3716
# binutils import library
3717
sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$7' "$1"`
3718
elif func_cygming_ms_implib_p "$1" ; then
3719
# ms-generated import library
3720
sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$6' "$1"`
3723
sharedlib_from_linklib_result=""
3728
# func_extract_an_archive dir oldlib
3729
func_extract_an_archive ()
3732
f_ex_an_ar_dir="$1"; shift
3733
f_ex_an_ar_oldlib="$1"
3734
if test "$lock_old_archive_extraction" = yes; then
3735
lockfile=$f_ex_an_ar_oldlib.lock
3736
until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do
3737
func_echo "Waiting for $lockfile to be removed"
3741
func_show_eval "(cd \$f_ex_an_ar_dir && $AR x \"\$f_ex_an_ar_oldlib\")" \
3742
'stat=$?; rm -f "$lockfile"; exit $stat'
3743
if test "$lock_old_archive_extraction" = yes; then
3744
$opt_dry_run || rm -f "$lockfile"
3746
if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then
3749
func_fatal_error "object name conflicts in archive: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib"
3754
# func_extract_archives gentop oldlib ...
3755
func_extract_archives ()
3758
my_gentop="$1"; shift
3759
my_oldlibs=${1+"$@"}
3765
for my_xlib in $my_oldlibs; do
3766
# Extract the objects.
3768
[\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;;
3769
*) my_xabs=`pwd`"/$my_xlib" ;;
3771
func_basename "$my_xlib"
3772
my_xlib="$func_basename_result"
3775
case " $extracted_archives " in
3777
func_arith $extracted_serial + 1
3778
extracted_serial=$func_arith_result
3779
my_xlib_u=lt$extracted_serial-$my_xlib ;;
3783
extracted_archives="$extracted_archives $my_xlib_u"
3784
my_xdir="$my_gentop/$my_xlib_u"
3786
func_mkdir_p "$my_xdir"
3790
func_verbose "Extracting $my_xabs"
3791
# Do not bother doing anything if just a dry run
3793
darwin_orig_dir=`pwd`
3794
cd $my_xdir || exit $?
3795
darwin_archive=$my_xabs
3797
darwin_base_archive=`basename "$darwin_archive"`
3798
darwin_arches=`$LIPO -info "$darwin_archive" 2>/dev/null | $GREP Architectures 2>/dev/null || true`
3799
if test -n "$darwin_arches"; then
3800
darwin_arches=`$ECHO "$darwin_arches" | $SED -e 's/.*are://'`
3802
func_verbose "$darwin_base_archive has multiple architectures $darwin_arches"
3803
for darwin_arch in $darwin_arches ; do
3804
func_mkdir_p "unfat-$$/${darwin_base_archive}-${darwin_arch}"
3805
$LIPO -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}"
3806
cd "unfat-$$/${darwin_base_archive}-${darwin_arch}"
3807
func_extract_an_archive "`pwd`" "${darwin_base_archive}"
3809
$RM "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}"
3810
done # $darwin_arches
3811
## Okay now we've a bunch of thin objects, gotta fatten them up :)
3812
darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print | $SED -e "$basename" | sort -u`
3815
for darwin_file in $darwin_filelist; do
3816
darwin_files=`find unfat-$$ -name $darwin_file -print | sort | $NL2SP`
3817
$LIPO -create -output "$darwin_file" $darwin_files
3818
done # $darwin_filelist
3820
cd "$darwin_orig_dir"
3823
func_extract_an_archive "$my_xdir" "$my_xabs"
3828
func_extract_an_archive "$my_xdir" "$my_xabs"
3831
my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | sort | $NL2SP`
3834
func_extract_archives_result="$my_oldobjs"
3838
# func_emit_wrapper [arg=no]
3840
# Emit a libtool wrapper script on stdout.
3841
# Don't directly open a file because we may want to
3842
# incorporate the script contents within a cygwin/mingw
3843
# wrapper executable. Must ONLY be called from within
3844
# func_mode_link because it depends on a number of variables
3847
# ARG is the value that the WRAPPER_SCRIPT_BELONGS_IN_OBJDIR
3848
# variable will take. If 'yes', then the emitted script
3849
# will assume that the directory in which it is stored is
3850
# the $objdir directory. This is a cygwin/mingw-specific
3852
func_emit_wrapper ()
3854
func_emit_wrapper_arg1=${1-no}
3859
# $output - temporary wrapper script for $objdir/$outputname
3860
# Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
3862
# The $output program cannot be directly executed until all the libtool
3863
# libraries that it depends on are installed.
3865
# This wrapper script should never be moved out of the build directory.
3866
# If it is, it will not operate correctly.
3868
# Sed substitution that helps us do robust quoting. It backslashifies
3869
# metacharacters that are still active within double-quoted strings.
3870
sed_quote_subst='$sed_quote_subst'
3872
# Be Bourne compatible
3873
if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then
3876
# Zsh 3.x and 4.x performs word splitting on \${1+\"\$@\"}, which
3877
# is contrary to our usage. Disable this feature.
3878
alias -g '\${1+\"\$@\"}'='\"\$@\"'
3879
setopt NO_GLOB_SUBST
3881
case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac
3883
BIN_SH=xpg4; export BIN_SH # for Tru64
3884
DUALCASE=1; export DUALCASE # for MKS sh
3886
# The HP-UX ksh and POSIX shell print the target directory to stdout
3888
(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
3890
relink_command=\"$relink_command\"
3892
# This environment variable determines our operation mode.
3893
if test \"\$libtool_install_magic\" = \"$magic\"; then
3894
# install mode needs the following variables:
3895
generated_by_libtool_version='$macro_version'
3896
notinst_deplibs='$notinst_deplibs'
3898
# When we are sourced in execute mode, \$file and \$ECHO are already set.
3899
if test \"\$libtool_execute_magic\" != \"$magic\"; then
3902
qECHO=`$ECHO "$ECHO" | $SED "$sed_quote_subst"`
3905
# A function that is used when there is no print builtin or printf.
3906
func_fallback_echo ()
3908
eval 'cat <<_LTECHO_EOF
3915
# Very basic option parsing. These options are (a) specific to
3916
# the libtool wrapper, (b) are identical between the wrapper
3917
# /script/ and the wrapper /executable/ which is used only on
3918
# windows platforms, and (c) all begin with the string "--lt-"
3919
# (application programs are unlikely to have options which match
3922
# There are only two supported options: --lt-debug and
3923
# --lt-dump-script. There is, deliberately, no --lt-help.
3925
# The first argument to this parsing function should be the
3926
# script's $0 value, followed by "$@".
3928
func_parse_lt_options ()
3934
case \"\$lt_opt\" in
3935
--lt-debug) lt_option_debug=1 ;;
3937
lt_dump_D=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%/[^/]*$%%'\`
3938
test \"X\$lt_dump_D\" = \"X\$lt_script_arg0\" && lt_dump_D=.
3939
lt_dump_F=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%^.*/%%'\`
3940
cat \"\$lt_dump_D/\$lt_dump_F\"
3944
\$ECHO \"Unrecognized --lt- option: '\$lt_opt'\" 1>&2
3950
# Print the debug banner immediately:
3951
if test -n \"\$lt_option_debug\"; then
3952
echo \"${outputname}:${output}:\${LINENO}: libtool wrapper (GNU $PACKAGE$TIMESTAMP) $VERSION\" 1>&2
3956
# Used when --lt-debug. Prints its arguments to stdout
3957
# (redirection is the responsibility of the caller)
3958
func_lt_dump_args ()
3963
\$ECHO \"${outputname}:${output}:\${LINENO}: newargv[\$lt_dump_args_N]: \$lt_arg\"
3964
lt_dump_args_N=\`expr \$lt_dump_args_N + 1\`
3968
# Core function for launching the target application
3969
func_exec_program_core ()
3973
# Backslashes separate directories on plain windows
3974
*-*-mingw | *-*-os2* | *-cegcc*)
3976
if test -n \"\$lt_option_debug\"; then
3977
\$ECHO \"${outputname}:${output}:\${LINENO}: newargv[0]: \$progdir\\\\\$program\" 1>&2
3978
func_lt_dump_args \${1+\"\$@\"} 1>&2
3980
exec \"\$progdir\\\\\$program\" \${1+\"\$@\"}
3986
if test -n \"\$lt_option_debug\"; then
3987
\$ECHO \"${outputname}:${output}:\${LINENO}: newargv[0]: \$progdir/\$program\" 1>&2
3988
func_lt_dump_args \${1+\"\$@\"} 1>&2
3990
exec \"\$progdir/\$program\" \${1+\"\$@\"}
3995
\$ECHO \"\$0: cannot exec \$program \$*\" 1>&2
3999
# A function to encapsulate launching the target application
4000
# Strips options in the --lt-* namespace from \$@ and
4001
# launches target application with the remaining arguments.
4002
func_exec_program ()
4010
*) set x \"\$@\" \"\$lt_wr_arg\"; shift;;
4015
func_exec_program_core \${1+\"\$@\"}
4019
func_parse_lt_options \"\$0\" \${1+\"\$@\"}
4021
# Find the directory that this script lives in.
4022
thisdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*$%%'\`
4023
test \"x\$thisdir\" = \"x\$file\" && thisdir=.
4025
# Follow symbolic links until we get to the real thisdir.
4026
file=\`ls -ld \"\$file\" | $SED -n 's/.*-> //p'\`
4027
while test -n \"\$file\"; do
4028
destdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*\$%%'\`
4030
# If there was a directory component, then change thisdir.
4031
if test \"x\$destdir\" != \"x\$file\"; then
4032
case \"\$destdir\" in
4033
[\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;;
4034
*) thisdir=\"\$thisdir/\$destdir\" ;;
4038
file=\`\$ECHO \"\$file\" | $SED 's%^.*/%%'\`
4039
file=\`ls -ld \"\$thisdir/\$file\" | $SED -n 's/.*-> //p'\`
4042
# Usually 'no', except on cygwin/mingw when embedded into
4044
WRAPPER_SCRIPT_BELONGS_IN_OBJDIR=$func_emit_wrapper_arg1
4045
if test \"\$WRAPPER_SCRIPT_BELONGS_IN_OBJDIR\" = \"yes\"; then
4046
# special case for '.'
4047
if test \"\$thisdir\" = \".\"; then
4050
# remove .libs from thisdir
4051
case \"\$thisdir\" in
4052
*[\\\\/]$objdir ) thisdir=\`\$ECHO \"\$thisdir\" | $SED 's%[\\\\/][^\\\\/]*$%%'\` ;;
4053
$objdir ) thisdir=. ;;
4057
# Try to get the absolute directory name.
4058
absdir=\`cd \"\$thisdir\" && pwd\`
4059
test -n \"\$absdir\" && thisdir=\"\$absdir\"
4062
if test "$fast_install" = yes; then
4064
program=lt-'$outputname'$exeext
4065
progdir=\"\$thisdir/$objdir\"
4067
if test ! -f \"\$progdir/\$program\" ||
4068
{ file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\
4069
test \"X\$file\" != \"X\$progdir/\$program\"; }; then
4071
file=\"\$\$-\$program\"
4073
if test ! -d \"\$progdir\"; then
4074
$MKDIR \"\$progdir\"
4076
$RM \"\$progdir/\$file\"
4081
# relink executable if necessary
4082
if test -n \"\$relink_command\"; then
4083
if relink_command_output=\`eval \$relink_command 2>&1\`; then :
4085
$ECHO \"\$relink_command_output\" >&2
4086
$RM \"\$progdir/\$file\"
4091
$MV \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null ||
4092
{ $RM \"\$progdir/\$program\";
4093
$MV \"\$progdir/\$file\" \"\$progdir/\$program\"; }
4094
$RM \"\$progdir/\$file\"
4098
program='$outputname'
4099
progdir=\"\$thisdir/$objdir\"
4105
if test -f \"\$progdir/\$program\"; then"
4107
# fixup the dll searchpath if we need to.
4109
# Fix the DLL searchpath if we need to. Do this before prepending
4110
# to shlibpath, because on Windows, both are PATH and uninstalled
4111
# libraries must come first.
4112
if test -n "$dllsearchpath"; then
4114
# Add the dll search path components to the executable PATH
4115
PATH=$dllsearchpath:\$PATH
4119
# Export our shlibpath_var if we have one.
4120
if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
4122
# Add our own library path to $shlibpath_var
4123
$shlibpath_var=\"$temp_rpath\$$shlibpath_var\"
4125
# Some systems cannot cope with colon-terminated $shlibpath_var
4126
# The second colon is a workaround for a bug in BeOS R4 sed
4127
$shlibpath_var=\`\$ECHO \"\$$shlibpath_var\" | $SED 's/::*\$//'\`
4129
export $shlibpath_var
4134
if test \"\$libtool_execute_magic\" != \"$magic\"; then
4135
# Run the actual program with our arguments.
4136
func_exec_program \${1+\"\$@\"}
4139
# The program doesn't exist.
4140
\$ECHO \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2
4141
\$ECHO \"This script is just a wrapper for \$program.\" 1>&2
4142
\$ECHO \"See the $PACKAGE documentation for more information.\" 1>&2
4150
# func_emit_cwrapperexe_src
4151
# emit the source code for a wrapper executable on stdout
4152
# Must ONLY be called from within func_mode_link because
4153
# it depends on a number of variable set therein.
4154
func_emit_cwrapperexe_src ()
4158
/* $cwrappersource - temporary wrapper executable for $objdir/$outputname
4159
Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
4161
The $output program cannot be directly executed until all the libtool
4162
libraries that it depends on are installed.
4164
This wrapper executable should never be moved out of the build directory.
4165
If it is, it will not operate correctly.
4170
# define _CRT_SECURE_NO_DEPRECATE 1
4175
# include <direct.h>
4176
# include <process.h>
4179
# include <unistd.h>
4180
# include <stdint.h>
4192
#include <sys/stat.h>
4194
/* declarations of non-ANSI functions */
4195
#if defined(__MINGW32__)
4196
# ifdef __STRICT_ANSI__
4197
int _putenv (const char *);
4199
#elif defined(__CYGWIN__)
4200
# ifdef __STRICT_ANSI__
4201
char *realpath (const char *, char *);
4202
int putenv (char *);
4203
int setenv (const char *, const char *, int);
4205
/* #elif defined (other platforms) ... */
4208
/* portability defines, excluding path handling macros */
4209
#if defined(_MSC_VER)
4210
# define setmode _setmode
4212
# define chmod _chmod
4213
# define getcwd _getcwd
4214
# define putenv _putenv
4215
# define S_IXUSR _S_IEXEC
4216
# ifndef _INTPTR_T_DEFINED
4217
# define _INTPTR_T_DEFINED
4218
# define intptr_t int
4220
#elif defined(__MINGW32__)
4221
# define setmode _setmode
4223
# define chmod _chmod
4224
# define getcwd _getcwd
4225
# define putenv _putenv
4226
#elif defined(__CYGWIN__)
4227
# define HAVE_SETENV
4228
# define FOPEN_WB "wb"
4229
/* #elif defined (other platforms) ... */
4232
#if defined(PATH_MAX)
4233
# define LT_PATHMAX PATH_MAX
4234
#elif defined(MAXPATHLEN)
4235
# define LT_PATHMAX MAXPATHLEN
4237
# define LT_PATHMAX 1024
4247
/* path handling portability macros */
4248
#ifndef DIR_SEPARATOR
4249
# define DIR_SEPARATOR '/'
4250
# define PATH_SEPARATOR ':'
4253
#if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \
4255
# define HAVE_DOS_BASED_FILE_SYSTEM
4256
# define FOPEN_WB "wb"
4257
# ifndef DIR_SEPARATOR_2
4258
# define DIR_SEPARATOR_2 '\\'
4260
# ifndef PATH_SEPARATOR_2
4261
# define PATH_SEPARATOR_2 ';'
4265
#ifndef DIR_SEPARATOR_2
4266
# define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR)
4267
#else /* DIR_SEPARATOR_2 */
4268
# define IS_DIR_SEPARATOR(ch) \
4269
(((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2))
4270
#endif /* DIR_SEPARATOR_2 */
4272
#ifndef PATH_SEPARATOR_2
4273
# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR)
4274
#else /* PATH_SEPARATOR_2 */
4275
# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2)
4276
#endif /* PATH_SEPARATOR_2 */
4279
# define FOPEN_WB "w"
4282
# define _O_BINARY 0
4285
#define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type)))
4286
#define XFREE(stale) do { \
4287
if (stale) { free ((void *) stale); stale = 0; } \
4290
#if defined(LT_DEBUGWRAPPER)
4291
static int lt_debug = 1;
4293
static int lt_debug = 0;
4296
const char *program_name = "libtool-wrapper"; /* in case xstrdup fails */
4298
void *xmalloc (size_t num);
4299
char *xstrdup (const char *string);
4300
const char *base_name (const char *name);
4301
char *find_executable (const char *wrapper);
4302
char *chase_symlinks (const char *pathspec);
4303
int make_executable (const char *path);
4304
int check_executable (const char *path);
4305
char *strendzap (char *str, const char *pat);
4306
void lt_debugprintf (const char *file, int line, const char *fmt, ...);
4307
void lt_fatal (const char *file, int line, const char *message, ...);
4308
static const char *nonnull (const char *s);
4309
static const char *nonempty (const char *s);
4310
void lt_setenv (const char *name, const char *value);
4311
char *lt_extend_str (const char *orig_value, const char *add, int to_end);
4312
void lt_update_exe_path (const char *name, const char *value);
4313
void lt_update_lib_path (const char *name, const char *value);
4314
char **prepare_spawn (char **argv);
4315
void lt_dump_script (FILE *f);
4319
volatile const char * MAGIC_EXE = "$magic_exe";
4320
const char * LIB_PATH_VARNAME = "$shlibpath_var";
4323
if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
4324
func_to_host_path "$temp_rpath"
4326
const char * LIB_PATH_VALUE = "$func_to_host_path_result";
4330
const char * LIB_PATH_VALUE = "";
4334
if test -n "$dllsearchpath"; then
4335
func_to_host_path "$dllsearchpath:"
4337
const char * EXE_PATH_VARNAME = "PATH";
4338
const char * EXE_PATH_VALUE = "$func_to_host_path_result";
4342
const char * EXE_PATH_VARNAME = "";
4343
const char * EXE_PATH_VALUE = "";
4347
if test "$fast_install" = yes; then
4349
const char * TARGET_PROGRAM_NAME = "lt-$outputname"; /* hopefully, no .exe */
4353
const char * TARGET_PROGRAM_NAME = "$outputname"; /* hopefully, no .exe */
4360
#define LTWRAPPER_OPTION_PREFIX "--lt-"
4362
static const char *ltwrapper_option_prefix = LTWRAPPER_OPTION_PREFIX;
4363
static const char *dumpscript_opt = LTWRAPPER_OPTION_PREFIX "dump-script";
4364
static const char *debug_opt = LTWRAPPER_OPTION_PREFIX "debug";
4367
main (int argc, char *argv[])
4372
char *actual_cwrapper_path;
4373
char *actual_cwrapper_name;
4376
intptr_t rval = 127;
4380
program_name = (char *) xstrdup (base_name (argv[0]));
4381
newargz = XMALLOC (char *, argc + 1);
4383
/* very simple arg parsing; don't want to rely on getopt
4384
* also, copy all non cwrapper options to newargz, except
4385
* argz[0], which is handled differently
4388
for (i = 1; i < argc; i++)
4390
if (strcmp (argv[i], dumpscript_opt) == 0)
4394
*mingw* | *cygwin* )
4395
# make stdout use "unix" line endings
4396
echo " setmode(1,_O_BINARY);"
4401
lt_dump_script (stdout);
4404
if (strcmp (argv[i], debug_opt) == 0)
4409
if (strcmp (argv[i], ltwrapper_option_prefix) == 0)
4411
/* however, if there is an option in the LTWRAPPER_OPTION_PREFIX
4412
namespace, but it is not one of the ones we know about and
4413
have already dealt with, above (inluding dump-script), then
4414
report an error. Otherwise, targets might begin to believe
4415
they are allowed to use options in the LTWRAPPER_OPTION_PREFIX
4416
namespace. The first time any user complains about this, we'll
4417
need to make LTWRAPPER_OPTION_PREFIX a configure-time option
4418
or a configure.ac-settable value.
4420
lt_fatal (__FILE__, __LINE__,
4421
"unrecognized %s option: '%s'",
4422
ltwrapper_option_prefix, argv[i]);
4425
newargz[++newargc] = xstrdup (argv[i]);
4427
newargz[++newargc] = NULL;
4431
/* The GNU banner must be the first non-error debug message */
4432
lt_debugprintf (__FILE__, __LINE__, "libtool wrapper (GNU $PACKAGE$TIMESTAMP) $VERSION\n");
4435
lt_debugprintf (__FILE__, __LINE__, "(main) argv[0]: %s\n", argv[0]);
4436
lt_debugprintf (__FILE__, __LINE__, "(main) program_name: %s\n", program_name);
4438
tmp_pathspec = find_executable (argv[0]);
4439
if (tmp_pathspec == NULL)
4440
lt_fatal (__FILE__, __LINE__, "couldn't find %s", argv[0]);
4441
lt_debugprintf (__FILE__, __LINE__,
4442
"(main) found exe (before symlink chase) at: %s\n",
4445
actual_cwrapper_path = chase_symlinks (tmp_pathspec);
4446
lt_debugprintf (__FILE__, __LINE__,
4447
"(main) found exe (after symlink chase) at: %s\n",
4448
actual_cwrapper_path);
4449
XFREE (tmp_pathspec);
4451
actual_cwrapper_name = xstrdup (base_name (actual_cwrapper_path));
4452
strendzap (actual_cwrapper_path, actual_cwrapper_name);
4454
/* wrapper name transforms */
4455
strendzap (actual_cwrapper_name, ".exe");
4456
tmp_pathspec = lt_extend_str (actual_cwrapper_name, ".exe", 1);
4457
XFREE (actual_cwrapper_name);
4458
actual_cwrapper_name = tmp_pathspec;
4461
/* target_name transforms -- use actual target program name; might have lt- prefix */
4462
target_name = xstrdup (base_name (TARGET_PROGRAM_NAME));
4463
strendzap (target_name, ".exe");
4464
tmp_pathspec = lt_extend_str (target_name, ".exe", 1);
4465
XFREE (target_name);
4466
target_name = tmp_pathspec;
4469
lt_debugprintf (__FILE__, __LINE__,
4470
"(main) libtool target name: %s\n",
4476
XMALLOC (char, (strlen (actual_cwrapper_path) +
4477
strlen ("$objdir") + 1 + strlen (actual_cwrapper_name) + 1));
4478
strcpy (newargz[0], actual_cwrapper_path);
4479
strcat (newargz[0], "$objdir");
4480
strcat (newargz[0], "/");
4484
/* stop here, and copy so we don't have to do this twice */
4485
tmp_pathspec = xstrdup (newargz[0]);
4487
/* do NOT want the lt- prefix here, so use actual_cwrapper_name */
4488
strcat (newargz[0], actual_cwrapper_name);
4490
/* DO want the lt- prefix here if it exists, so use target_name */
4491
lt_argv_zero = lt_extend_str (tmp_pathspec, target_name, 1);
4492
XFREE (tmp_pathspec);
4493
tmp_pathspec = NULL;
4501
while ((p = strchr (newargz[0], '\\')) != NULL)
4505
while ((p = strchr (lt_argv_zero, '\\')) != NULL)
4515
XFREE (target_name);
4516
XFREE (actual_cwrapper_path);
4517
XFREE (actual_cwrapper_name);
4519
lt_setenv ("BIN_SH", "xpg4"); /* for Tru64 */
4520
lt_setenv ("DUALCASE", "1"); /* for MSK sh */
4521
/* Update the DLL searchpath. EXE_PATH_VALUE ($dllsearchpath) must
4522
be prepended before (that is, appear after) LIB_PATH_VALUE ($temp_rpath)
4523
because on Windows, both *_VARNAMEs are PATH but uninstalled
4524
libraries must come first. */
4525
lt_update_exe_path (EXE_PATH_VARNAME, EXE_PATH_VALUE);
4526
lt_update_lib_path (LIB_PATH_VARNAME, LIB_PATH_VALUE);
4528
lt_debugprintf (__FILE__, __LINE__, "(main) lt_argv_zero: %s\n",
4529
nonnull (lt_argv_zero));
4530
for (i = 0; i < newargc; i++)
4532
lt_debugprintf (__FILE__, __LINE__, "(main) newargz[%d]: %s\n",
4533
i, nonnull (newargz[i]));
4541
/* execv doesn't actually work on mingw as expected on unix */
4542
newargz = prepare_spawn (newargz);
4543
rval = _spawnv (_P_WAIT, lt_argv_zero, (const char * const *) newargz);
4546
/* failed to start process */
4547
lt_debugprintf (__FILE__, __LINE__,
4548
"(main) failed to launch target \"%s\": %s\n",
4549
lt_argv_zero, nonnull (strerror (errno)));
4557
execv (lt_argv_zero, newargz);
4558
return rval; /* =127, but avoids unused variable warning */
4567
xmalloc (size_t num)
4569
void *p = (void *) malloc (num);
4571
lt_fatal (__FILE__, __LINE__, "memory exhausted");
4577
xstrdup (const char *string)
4579
return string ? strcpy ((char *) xmalloc (strlen (string) + 1),
4584
base_name (const char *name)
4588
#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
4589
/* Skip over the disk name in MSDOS pathnames. */
4590
if (isalpha ((unsigned char) name[0]) && name[1] == ':')
4594
for (base = name; *name; name++)
4595
if (IS_DIR_SEPARATOR (*name))
4601
check_executable (const char *path)
4605
lt_debugprintf (__FILE__, __LINE__, "(check_executable): %s\n",
4607
if ((!path) || (!*path))
4610
if ((stat (path, &st) >= 0)
4611
&& (st.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH)))
4618
make_executable (const char *path)
4623
lt_debugprintf (__FILE__, __LINE__, "(make_executable): %s\n",
4625
if ((!path) || (!*path))
4628
if (stat (path, &st) >= 0)
4630
rval = chmod (path, st.st_mode | S_IXOTH | S_IXGRP | S_IXUSR);
4635
/* Searches for the full path of the wrapper. Returns
4636
newly allocated full path name if found, NULL otherwise
4637
Does not chase symlinks, even on platforms that support them.
4640
find_executable (const char *wrapper)
4645
/* static buffer for getcwd */
4646
char tmp[LT_PATHMAX + 1];
4650
lt_debugprintf (__FILE__, __LINE__, "(find_executable): %s\n",
4651
nonempty (wrapper));
4653
if ((wrapper == NULL) || (*wrapper == '\0'))
4656
/* Absolute path? */
4657
#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
4658
if (isalpha ((unsigned char) wrapper[0]) && wrapper[1] == ':')
4660
concat_name = xstrdup (wrapper);
4661
if (check_executable (concat_name))
4663
XFREE (concat_name);
4668
if (IS_DIR_SEPARATOR (wrapper[0]))
4670
concat_name = xstrdup (wrapper);
4671
if (check_executable (concat_name))
4673
XFREE (concat_name);
4675
#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
4679
for (p = wrapper; *p; p++)
4687
/* no slashes; search PATH */
4688
const char *path = getenv ("PATH");
4691
for (p = path; *p; p = p_next)
4695
for (q = p; *q; q++)
4696
if (IS_PATH_SEPARATOR (*q))
4699
p_next = (*q == '\0' ? q : q + 1);
4702
/* empty path: current directory */
4703
if (getcwd (tmp, LT_PATHMAX) == NULL)
4704
lt_fatal (__FILE__, __LINE__, "getcwd failed: %s",
4705
nonnull (strerror (errno)));
4706
tmp_len = strlen (tmp);
4708
XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1);
4709
memcpy (concat_name, tmp, tmp_len);
4710
concat_name[tmp_len] = '/';
4711
strcpy (concat_name + tmp_len + 1, wrapper);
4716
XMALLOC (char, p_len + 1 + strlen (wrapper) + 1);
4717
memcpy (concat_name, p, p_len);
4718
concat_name[p_len] = '/';
4719
strcpy (concat_name + p_len + 1, wrapper);
4721
if (check_executable (concat_name))
4723
XFREE (concat_name);
4726
/* not found in PATH; assume curdir */
4728
/* Relative path | not found in path: prepend cwd */
4729
if (getcwd (tmp, LT_PATHMAX) == NULL)
4730
lt_fatal (__FILE__, __LINE__, "getcwd failed: %s",
4731
nonnull (strerror (errno)));
4732
tmp_len = strlen (tmp);
4733
concat_name = XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1);
4734
memcpy (concat_name, tmp, tmp_len);
4735
concat_name[tmp_len] = '/';
4736
strcpy (concat_name + tmp_len + 1, wrapper);
4738
if (check_executable (concat_name))
4740
XFREE (concat_name);
4745
chase_symlinks (const char *pathspec)
4748
return xstrdup (pathspec);
4750
char buf[LT_PATHMAX];
4752
char *tmp_pathspec = xstrdup (pathspec);
4754
int has_symlinks = 0;
4755
while (strlen (tmp_pathspec) && !has_symlinks)
4757
lt_debugprintf (__FILE__, __LINE__,
4758
"checking path component for symlinks: %s\n",
4760
if (lstat (tmp_pathspec, &s) == 0)
4762
if (S_ISLNK (s.st_mode) != 0)
4768
/* search backwards for last DIR_SEPARATOR */
4769
p = tmp_pathspec + strlen (tmp_pathspec) - 1;
4770
while ((p > tmp_pathspec) && (!IS_DIR_SEPARATOR (*p)))
4772
if ((p == tmp_pathspec) && (!IS_DIR_SEPARATOR (*p)))
4774
/* no more DIR_SEPARATORS left */
4781
lt_fatal (__FILE__, __LINE__,
4782
"error accessing file \"%s\": %s",
4783
tmp_pathspec, nonnull (strerror (errno)));
4786
XFREE (tmp_pathspec);
4790
return xstrdup (pathspec);
4793
tmp_pathspec = realpath (pathspec, buf);
4794
if (tmp_pathspec == 0)
4796
lt_fatal (__FILE__, __LINE__,
4797
"could not follow symlinks for %s", pathspec);
4799
return xstrdup (tmp_pathspec);
4804
strendzap (char *str, const char *pat)
4808
assert (str != NULL);
4809
assert (pat != NULL);
4812
patlen = strlen (pat);
4816
str += len - patlen;
4817
if (strcmp (str, pat) == 0)
4824
lt_debugprintf (const char *file, int line, const char *fmt, ...)
4829
(void) fprintf (stderr, "%s:%s:%d: ", program_name, file, line);
4830
va_start (args, fmt);
4831
(void) vfprintf (stderr, fmt, args);
4837
lt_error_core (int exit_status, const char *file,
4838
int line, const char *mode,
4839
const char *message, va_list ap)
4841
fprintf (stderr, "%s:%s:%d: %s: ", program_name, file, line, mode);
4842
vfprintf (stderr, message, ap);
4843
fprintf (stderr, ".\n");
4845
if (exit_status >= 0)
4850
lt_fatal (const char *file, int line, const char *message, ...)
4853
va_start (ap, message);
4854
lt_error_core (EXIT_FAILURE, file, line, "FATAL", message, ap);
4859
nonnull (const char *s)
4861
return s ? s : "(null)";
4865
nonempty (const char *s)
4867
return (s && !*s) ? "(empty)" : nonnull (s);
4871
lt_setenv (const char *name, const char *value)
4873
lt_debugprintf (__FILE__, __LINE__,
4874
"(lt_setenv) setting '%s' to '%s'\n",
4875
nonnull (name), nonnull (value));
4878
/* always make a copy, for consistency with !HAVE_SETENV */
4879
char *str = xstrdup (value);
4880
setenv (name, str, 1);
4882
int len = strlen (name) + 1 + strlen (value) + 1;
4883
char *str = XMALLOC (char, len);
4884
sprintf (str, "%s=%s", name, value);
4885
if (putenv (str) != EXIT_SUCCESS)
4894
lt_extend_str (const char *orig_value, const char *add, int to_end)
4897
if (orig_value && *orig_value)
4899
int orig_value_len = strlen (orig_value);
4900
int add_len = strlen (add);
4901
new_value = XMALLOC (char, add_len + orig_value_len + 1);
4904
strcpy (new_value, orig_value);
4905
strcpy (new_value + orig_value_len, add);
4909
strcpy (new_value, add);
4910
strcpy (new_value + add_len, orig_value);
4915
new_value = xstrdup (add);
4921
lt_update_exe_path (const char *name, const char *value)
4923
lt_debugprintf (__FILE__, __LINE__,
4924
"(lt_update_exe_path) modifying '%s' by prepending '%s'\n",
4925
nonnull (name), nonnull (value));
4927
if (name && *name && value && *value)
4929
char *new_value = lt_extend_str (getenv (name), value, 0);
4930
/* some systems can't cope with a ':'-terminated path #' */
4931
int len = strlen (new_value);
4932
while (((len = strlen (new_value)) > 0) && IS_PATH_SEPARATOR (new_value[len-1]))
4934
new_value[len-1] = '\0';
4936
lt_setenv (name, new_value);
4942
lt_update_lib_path (const char *name, const char *value)
4944
lt_debugprintf (__FILE__, __LINE__,
4945
"(lt_update_lib_path) modifying '%s' by prepending '%s'\n",
4946
nonnull (name), nonnull (value));
4948
if (name && *name && value && *value)
4950
char *new_value = lt_extend_str (getenv (name), value, 0);
4951
lt_setenv (name, new_value);
4961
/* Prepares an argument vector before calling spawn().
4962
Note that spawn() does not by itself call the command interpreter
4963
(getenv ("COMSPEC") != NULL ? getenv ("COMSPEC") :
4964
({ OSVERSIONINFO v; v.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
4966
v.dwPlatformId == VER_PLATFORM_WIN32_NT;
4967
}) ? "cmd.exe" : "command.com").
4968
Instead it simply concatenates the arguments, separated by ' ', and calls
4969
CreateProcess(). We must quote the arguments since Win32 CreateProcess()
4970
interprets characters like ' ', '\t', '\\', '"' (but not '<' and '>') in a
4972
- Space and tab are interpreted as delimiters. They are not treated as
4973
delimiters if they are surrounded by double quotes: "...".
4974
- Unescaped double quotes are removed from the input. Their only effect is
4975
that within double quotes, space and tab are treated like normal
4977
- Backslashes not followed by double quotes are not special.
4978
- But 2*n+1 backslashes followed by a double quote become
4979
n backslashes followed by a double quote (n >= 0):
4984
#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"
4985
#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"
4987
prepare_spawn (char **argv)
4993
/* Count number of arguments. */
4994
for (argc = 0; argv[argc] != NULL; argc++)
4997
/* Allocate new argument vector. */
4998
new_argv = XMALLOC (char *, argc + 1);
5000
/* Put quoted arguments into the new argument vector. */
5001
for (i = 0; i < argc; i++)
5003
const char *string = argv[i];
5005
if (string[0] == '\0')
5006
new_argv[i] = xstrdup ("\"\"");
5007
else if (strpbrk (string, SHELL_SPECIAL_CHARS) != NULL)
5009
int quote_around = (strpbrk (string, SHELL_SPACE_CHARS) != NULL);
5011
unsigned int backslashes;
5013
char *quoted_string;
5020
for (s = string; *s != '\0'; s++)
5024
length += backslashes + 1;
5032
length += backslashes + 1;
5034
quoted_string = XMALLOC (char, length + 1);
5040
for (s = string; *s != '\0'; s++)
5046
for (j = backslashes + 1; j > 0; j--)
5058
for (j = backslashes; j > 0; j--)
5064
new_argv[i] = quoted_string;
5067
new_argv[i] = (char *) string;
5069
new_argv[argc] = NULL;
5078
void lt_dump_script (FILE* f)
5081
func_emit_wrapper yes |
5083
s/^\(.\{79\}\)\(..*\)/\1\
5088
s/\([^\n]*\).*/ fputs ("\1", f);/p
5095
# end: func_emit_cwrapperexe_src
5097
# func_win32_import_lib_p ARG
5098
# True if ARG is an import lib, as indicated by $file_magic_cmd
5099
func_win32_import_lib_p ()
5102
case `eval $file_magic_cmd \"\$1\" 2>/dev/null | $SED -e 10q` in
5108
# func_mode_link arg...
5113
*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
5114
# It is impossible to link a dll without this setting, and
5115
# we shouldn't force the makefile maintainer to figure out
5116
# which system we are compiling for in order to pass an extra
5117
# flag for every libtool invocation.
5118
# allow_undefined=no
5120
# FIXME: Unfortunately, there are problems with the above when trying
5121
# to make a dll which has undefined symbols, in which case not
5122
# even a static library is built. For now, we need to specify
5123
# -no-undefined on the libtool link line when we can be certain
5124
# that all symbols are satisfied, otherwise we get a static library.
5131
libtool_args=$nonopt
5132
base_compile="$nonopt $@"
5133
compile_command=$nonopt
5134
finalize_command=$nonopt
5147
lib_search_path=`pwd`
5149
new_inherited_linker_flags=
5158
export_symbols_regex=
5166
precious_files_regex=
5167
prefer_static_libs=no
5180
single_module="${wl}-single_module"
5181
func_infer_tag $base_compile
5183
# We need to know -static, to get the right output filenames.
5188
test "$build_libtool_libs" != yes && \
5189
func_fatal_configuration "can not build a shared library"
5193
-all-static | -static | -static-libtool-libs)
5196
if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then
5197
func_warning "complete static linking is impossible in this configuration"
5199
if test -n "$link_static_flag"; then
5200
dlopen_self=$dlopen_self_static
5202
prefer_static_libs=yes
5205
if test -z "$pic_flag" && test -n "$link_static_flag"; then
5206
dlopen_self=$dlopen_self_static
5208
prefer_static_libs=built
5210
-static-libtool-libs)
5211
if test -z "$pic_flag" && test -n "$link_static_flag"; then
5212
dlopen_self=$dlopen_self_static
5214
prefer_static_libs=yes
5217
build_libtool_libs=no
5224
# See if our shared archives depend on static archives.
5225
test -n "$old_archive_from_new_cmds" && build_old_libs=yes
5227
# Go through the arguments, transforming them on the way.
5228
while test "$#" -gt 0; do
5231
func_quote_for_eval "$arg"
5232
qarg=$func_quote_for_eval_unquoted_result
5233
func_append libtool_args " $func_quote_for_eval_result"
5235
# If the previous option needs an argument, assign it.
5236
if test -n "$prev"; then
5239
func_append compile_command " @OUTPUT@"
5240
func_append finalize_command " @OUTPUT@"
5251
if test "$preload" = no; then
5252
# Add the symbol object into the linking commands.
5253
func_append compile_command " @SYMFILE@"
5254
func_append finalize_command " @SYMFILE@"
5258
*.la | *.lo) ;; # We handle these cases below.
5260
if test "$dlself" = no; then
5268
if test "$prev" = dlprefiles; then
5270
elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then
5280
if test "$prev" = dlfiles; then
5281
func_append dlfiles " $arg"
5283
func_append dlprefiles " $arg"
5291
export_symbols="$arg"
5293
|| func_fatal_error "symbol file \`$arg' does not exist"
5298
export_symbols_regex="$arg"
5306
*" $qarg.ltframework "*) ;;
5307
*) func_append deplibs " $qarg.ltframework" # this is fixed later
5316
inst_prefix_dir="$arg"
5321
if test -f "$arg"; then
5324
for fil in `cat "$save_arg"`
5326
# func_append moreargs " $fil"
5328
# A libtool-controlled object.
5330
# Check to see that this really is a libtool object.
5331
if func_lalib_unsafe_p "$arg"; then
5338
if test -z "$pic_object" ||
5339
test -z "$non_pic_object" ||
5340
test "$pic_object" = none &&
5341
test "$non_pic_object" = none; then
5342
func_fatal_error "cannot find name of object for \`$arg'"
5345
# Extract subdirectory from the argument.
5346
func_dirname "$arg" "/" ""
5347
xdir="$func_dirname_result"
5349
if test "$pic_object" != none; then
5350
# Prepend the subdirectory the object is found in.
5351
pic_object="$xdir$pic_object"
5353
if test "$prev" = dlfiles; then
5354
if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
5355
func_append dlfiles " $pic_object"
5359
# If libtool objects are unsupported, then we need to preload.
5364
# CHECK ME: I think I busted this. -Ossama
5365
if test "$prev" = dlprefiles; then
5366
# Preload the old-style object.
5367
func_append dlprefiles " $pic_object"
5372
func_append libobjs " $pic_object"
5377
if test "$non_pic_object" != none; then
5378
# Prepend the subdirectory the object is found in.
5379
non_pic_object="$xdir$non_pic_object"
5381
# A standard non-PIC object
5382
func_append non_pic_objects " $non_pic_object"
5383
if test -z "$pic_object" || test "$pic_object" = none ; then
5384
arg="$non_pic_object"
5387
# If the PIC object exists, use it instead.
5388
# $xdir was prepended to $pic_object above.
5389
non_pic_object="$pic_object"
5390
func_append non_pic_objects " $non_pic_object"
5393
# Only an error if not doing a dry-run.
5394
if $opt_dry_run; then
5395
# Extract subdirectory from the argument.
5396
func_dirname "$arg" "/" ""
5397
xdir="$func_dirname_result"
5400
pic_object=$xdir$objdir/$func_lo2o_result
5401
non_pic_object=$xdir$func_lo2o_result
5402
func_append libobjs " $pic_object"
5403
func_append non_pic_objects " $non_pic_object"
5405
func_fatal_error "\`$arg' is not a valid libtool object"
5410
func_fatal_error "link input file \`$arg' does not exist"
5417
precious_files_regex="$arg"
5427
# We need an absolute path.
5429
[\\/]* | [A-Za-z]:[\\/]*) ;;
5431
func_fatal_error "only absolute run-paths are allowed"
5434
if test "$prev" = rpath; then
5437
*) func_append rpath " $arg" ;;
5442
*) func_append xrpath " $arg" ;;
5454
func_append weak_libs " $arg"
5459
func_append linker_flags " $qarg"
5460
func_append compiler_flags " $qarg"
5462
func_append compile_command " $qarg"
5463
func_append finalize_command " $qarg"
5467
func_append compiler_flags " $qarg"
5469
func_append compile_command " $qarg"
5470
func_append finalize_command " $qarg"
5474
func_append linker_flags " $qarg"
5475
func_append compiler_flags " $wl$qarg"
5477
func_append compile_command " $wl$qarg"
5478
func_append finalize_command " $wl$qarg"
5482
eval "$prev=\"\$arg\""
5487
fi # test -n "$prev"
5493
if test -n "$link_static_flag"; then
5494
# See comment for -static flag below, for more details.
5495
func_append compile_command " $link_static_flag"
5496
func_append finalize_command " $link_static_flag"
5502
# FIXME: remove this flag sometime in the future.
5503
func_fatal_error "\`-allow-undefined' must not be used because it is the default"
5531
-export-symbols | -export-symbols-regex)
5532
if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
5533
func_fatal_error "more than one -exported-symbols argument is not allowed"
5535
if test "X$arg" = "X-export-symbols"; then
5553
# The native IRIX linker understands -LANG:*, -LIST:* and -LNO:*
5554
# so, if we see these flags be careful not to treat them like -L
5556
case $with_gcc/$host in
5557
no/*-*-irix* | /*-*-irix*)
5558
func_append compile_command " $arg"
5559
func_append finalize_command " $arg"
5566
func_stripname "-L" '' "$arg"
5567
if test -z "$func_stripname_result"; then
5568
if test "$#" -gt 0; then
5569
func_fatal_error "require no space between \`-L' and \`$1'"
5571
func_fatal_error "need path for \`-L' option"
5574
func_resolve_sysroot "$func_stripname_result"
5575
dir=$func_resolve_sysroot_result
5576
# We need an absolute path.
5578
[\\/]* | [A-Za-z]:[\\/]*) ;;
5580
absdir=`cd "$dir" && pwd`
5581
test -z "$absdir" && \
5582
func_fatal_error "cannot determine absolute directory name of \`$dir'"
5587
*" -L$dir "* | *" $arg "*)
5588
# Will only happen for absolute or sysroot arguments
5591
# Preserve sysroot, but never include relative directories
5593
[\\/]* | [A-Za-z]:[\\/]* | =*) func_append deplibs " $arg" ;;
5594
*) func_append deplibs " -L$dir" ;;
5596
func_append lib_search_path " $dir"
5600
*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
5601
testbindir=`$ECHO "$dir" | $SED 's*/lib$*/bin*'`
5602
case :$dllsearchpath: in
5604
::) dllsearchpath=$dir;;
5605
*) func_append dllsearchpath ":$dir";;
5607
case :$dllsearchpath: in
5608
*":$testbindir:"*) ;;
5609
::) dllsearchpath=$testbindir;;
5610
*) func_append dllsearchpath ":$testbindir";;
5618
if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then
5620
*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos* | *-cegcc* | *-*-haiku*)
5621
# These systems don't actually have a C or math library (as such)
5625
# These systems don't actually have a C library (as such)
5626
test "X$arg" = "X-lc" && continue
5628
*-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
5629
# Do not include libc due to us having libc/libc_r.
5630
test "X$arg" = "X-lc" && continue
5632
*-*-rhapsody* | *-*-darwin1.[012])
5633
# Rhapsody C and math libraries are in the System framework
5634
func_append deplibs " System.ltframework"
5637
*-*-sco3.2v5* | *-*-sco5v6*)
5638
# Causes problems with __ctype
5639
test "X$arg" = "X-lc" && continue
5641
*-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
5642
# Compiler inserts libc in the correct place for threads to work
5643
test "X$arg" = "X-lc" && continue
5646
elif test "X$arg" = "X-lc_r"; then
5648
*-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
5649
# Do not include libc_r directly, use -pthread flag.
5654
func_append deplibs " $arg"
5663
# Tru64 UNIX uses -model [arg] to determine the layout of C++
5664
# classes, name mangling, and exception handling.
5665
# Darwin uses the -arch flag to determine output architecture.
5666
-model|-arch|-isysroot|--sysroot)
5667
func_append compiler_flags " $arg"
5668
func_append compile_command " $arg"
5669
func_append finalize_command " $arg"
5674
-mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe \
5675
|-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*)
5676
func_append compiler_flags " $arg"
5677
func_append compile_command " $arg"
5678
func_append finalize_command " $arg"
5679
case "$new_inherited_linker_flags " in
5681
* ) func_append new_inherited_linker_flags " $arg" ;;
5687
single_module="${wl}-multi_module"
5698
*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin* | *-cegcc*)
5699
# The PATH hackery in wrapper scripts is required on Windows
5700
# and Darwin in order for the loader to find any dlls it needs.
5701
func_warning "\`-no-install' is ignored for $host"
5702
func_warning "assuming \`-no-fast-install' instead"
5705
*) no_install=yes ;;
5722
-precious-files-regex)
5743
func_stripname '-R' '' "$arg"
5744
dir=$func_stripname_result
5745
# We need an absolute path.
5747
[\\/]* | [A-Za-z]:[\\/]*) ;;
5749
func_stripname '=' '' "$dir"
5750
dir=$lt_sysroot$func_stripname_result
5753
func_fatal_error "only absolute run-paths are allowed"
5758
*) func_append xrpath " $dir" ;;
5764
# The effects of -shared are defined in a previous loop.
5773
-static | -static-libtool-libs)
5774
# The effects of -static are defined in a previous loop.
5775
# We used to do the same as -all-static on platforms that
5776
# didn't have a PIC flag, but the assumption that the effects
5777
# would be equivalent was wrong. It would break on at least
5778
# Digital Unix and AIX.
5804
func_stripname '-Wc,' '' "$arg"
5805
args=$func_stripname_result
5807
save_ifs="$IFS"; IFS=','
5808
for flag in $args; do
5810
func_quote_for_eval "$flag"
5811
func_append arg " $func_quote_for_eval_result"
5812
func_append compiler_flags " $func_quote_for_eval_result"
5815
func_stripname ' ' '' "$arg"
5816
arg=$func_stripname_result
5820
func_stripname '-Wl,' '' "$arg"
5821
args=$func_stripname_result
5823
save_ifs="$IFS"; IFS=','
5824
for flag in $args; do
5826
func_quote_for_eval "$flag"
5827
func_append arg " $wl$func_quote_for_eval_result"
5828
func_append compiler_flags " $wl$func_quote_for_eval_result"
5829
func_append linker_flags " $func_quote_for_eval_result"
5832
func_stripname ' ' '' "$arg"
5833
arg=$func_stripname_result
5853
func_quote_for_eval "$arg"
5854
arg="$func_quote_for_eval_result"
5857
# Flags to be passed through unchanged, with rationale:
5858
# -64, -mips[0-9] enable 64-bit mode for the SGI compiler
5859
# -r[0-9][0-9]* specify processor for the SGI compiler
5860
# -xarch=*, -xtarget=* enable 64-bit mode for the Sun compiler
5861
# +DA*, +DD* enable 64-bit mode for the HP compiler
5862
# -q* compiler args for the IBM compiler
5863
# -m*, -t[45]*, -txscale* architecture-specific flags for GCC
5864
# -F/path path to uninstalled frameworks, gcc on darwin
5865
# -p, -pg, --coverage, -fprofile-* profiling flags for GCC
5866
# @file GCC response files
5867
# -tp=* Portland pgcc target processor selection
5868
# --sysroot=* for sysroot support
5869
# -O*, -flto*, -fwhopr*, -fuse-linker-plugin GCC link-time optimization
5870
-64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \
5871
-t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*|-tp=*|--sysroot=*| \
5872
-O*|-flto*|-fwhopr*|-fuse-linker-plugin)
5873
func_quote_for_eval "$arg"
5874
arg="$func_quote_for_eval_result"
5875
func_append compile_command " $arg"
5876
func_append finalize_command " $arg"
5877
func_append compiler_flags " $arg"
5881
# Some other compiler flag.
5883
func_quote_for_eval "$arg"
5884
arg="$func_quote_for_eval_result"
5888
# A standard object.
5889
func_append objs " $arg"
5893
# A libtool-controlled object.
5895
# Check to see that this really is a libtool object.
5896
if func_lalib_unsafe_p "$arg"; then
5903
if test -z "$pic_object" ||
5904
test -z "$non_pic_object" ||
5905
test "$pic_object" = none &&
5906
test "$non_pic_object" = none; then
5907
func_fatal_error "cannot find name of object for \`$arg'"
5910
# Extract subdirectory from the argument.
5911
func_dirname "$arg" "/" ""
5912
xdir="$func_dirname_result"
5914
if test "$pic_object" != none; then
5915
# Prepend the subdirectory the object is found in.
5916
pic_object="$xdir$pic_object"
5918
if test "$prev" = dlfiles; then
5919
if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
5920
func_append dlfiles " $pic_object"
5924
# If libtool objects are unsupported, then we need to preload.
5929
# CHECK ME: I think I busted this. -Ossama
5930
if test "$prev" = dlprefiles; then
5931
# Preload the old-style object.
5932
func_append dlprefiles " $pic_object"
5937
func_append libobjs " $pic_object"
5942
if test "$non_pic_object" != none; then
5943
# Prepend the subdirectory the object is found in.
5944
non_pic_object="$xdir$non_pic_object"
5946
# A standard non-PIC object
5947
func_append non_pic_objects " $non_pic_object"
5948
if test -z "$pic_object" || test "$pic_object" = none ; then
5949
arg="$non_pic_object"
5952
# If the PIC object exists, use it instead.
5953
# $xdir was prepended to $pic_object above.
5954
non_pic_object="$pic_object"
5955
func_append non_pic_objects " $non_pic_object"
5958
# Only an error if not doing a dry-run.
5959
if $opt_dry_run; then
5960
# Extract subdirectory from the argument.
5961
func_dirname "$arg" "/" ""
5962
xdir="$func_dirname_result"
5965
pic_object=$xdir$objdir/$func_lo2o_result
5966
non_pic_object=$xdir$func_lo2o_result
5967
func_append libobjs " $pic_object"
5968
func_append non_pic_objects " $non_pic_object"
5970
func_fatal_error "\`$arg' is not a valid libtool object"
5977
func_append deplibs " $arg"
5978
func_append old_deplibs " $arg"
5983
# A libtool-controlled library.
5985
func_resolve_sysroot "$arg"
5986
if test "$prev" = dlfiles; then
5987
# This library was specified with -dlopen.
5988
func_append dlfiles " $func_resolve_sysroot_result"
5990
elif test "$prev" = dlprefiles; then
5991
# The library was specified with -dlpreopen.
5992
func_append dlprefiles " $func_resolve_sysroot_result"
5995
func_append deplibs " $func_resolve_sysroot_result"
6000
# Some other compiler argument.
6002
# Unknown arguments in both finalize_command and compile_command need
6003
# to be aesthetically quoted because they are evaled later.
6004
func_quote_for_eval "$arg"
6005
arg="$func_quote_for_eval_result"
6009
# Now actually substitute the argument into the commands.
6010
if test -n "$arg"; then
6011
func_append compile_command " $arg"
6012
func_append finalize_command " $arg"
6014
done # argument parsing loop
6016
test -n "$prev" && \
6017
func_fatal_help "the \`$prevarg' option requires an argument"
6019
if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then
6020
eval arg=\"$export_dynamic_flag_spec\"
6021
func_append compile_command " $arg"
6022
func_append finalize_command " $arg"
6026
# calculate the name of the file, without its directory
6027
func_basename "$output"
6028
outputname="$func_basename_result"
6029
libobjs_save="$libobjs"
6031
if test -n "$shlibpath_var"; then
6032
# get the directories listed in $shlibpath_var
6033
eval shlib_search_path=\`\$ECHO \"\${$shlibpath_var}\" \| \$SED \'s/:/ /g\'\`
6037
eval sys_lib_search_path=\"$sys_lib_search_path_spec\"
6038
eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\"
6040
func_dirname "$output" "/" ""
6041
output_objdir="$func_dirname_result$objdir"
6042
func_to_tool_file "$output_objdir/"
6043
tool_output_objdir=$func_to_tool_file_result
6044
# Create the object directory.
6045
func_mkdir_p "$output_objdir"
6047
# Determine the type of output
6050
func_fatal_help "you must specify an output file"
6052
*.$libext) linkmode=oldlib ;;
6053
*.lo | *.$objext) linkmode=obj ;;
6054
*.la) linkmode=lib ;;
6055
*) linkmode=prog ;; # Anything else should be a program.
6061
# Find all interdependent deplibs by searching for libraries
6062
# that are linked more than once (e.g. -la -lb -la)
6063
for deplib in $deplibs; do
6064
if $opt_preserve_dup_deps ; then
6066
*" $deplib "*) func_append specialdeplibs " $deplib" ;;
6069
func_append libs " $deplib"
6072
if test "$linkmode" = lib; then
6073
libs="$predeps $libs $compiler_lib_search_path $postdeps"
6075
# Compute libraries that are listed more than once in $predeps
6076
# $postdeps and mark them as special (i.e., whose duplicates are
6077
# not to be eliminated).
6079
if $opt_duplicate_compiler_generated_deps; then
6080
for pre_post_dep in $predeps $postdeps; do
6081
case "$pre_post_deps " in
6082
*" $pre_post_dep "*) func_append specialdeplibs " $pre_post_deps" ;;
6084
func_append pre_post_deps " $pre_post_dep"
6093
need_relink=no # whether we're linking any uninstalled libtool libraries
6094
notinst_deplibs= # not-installed libtool libraries
6095
notinst_path= # paths that contain not-installed libtool libraries
6099
passes="conv dlpreopen link"
6100
for file in $dlfiles $dlprefiles; do
6104
func_fatal_help "libraries can \`-dlopen' only libtool libraries: $file"
6115
passes="conv scan dlopen dlpreopen link"
6121
for pass in $passes; do
6122
# The preopen pass in lib mode reverses $deplibs; put it back here
6123
# so that -L comes before libs that need it for instance...
6124
if test "$linkmode,$pass" = "lib,link"; then
6125
## FIXME: Find the place where the list is rebuilt in the wrong
6126
## order, and fix it there properly
6128
for deplib in $deplibs; do
6129
tmp_deplibs="$deplib $tmp_deplibs"
6131
deplibs="$tmp_deplibs"
6134
if test "$linkmode,$pass" = "lib,link" ||
6135
test "$linkmode,$pass" = "prog,scan"; then
6139
if test "$linkmode" = prog; then
6141
dlopen) libs="$dlfiles" ;;
6142
dlpreopen) libs="$dlprefiles" ;;
6143
link) libs="$deplibs %DEPLIBS% $dependency_libs" ;;
6146
if test "$linkmode,$pass" = "lib,dlpreopen"; then
6147
# Collect and forward deplibs of preopened libtool libs
6148
for lib in $dlprefiles; do
6149
# Ignore non-libtool-libs
6151
func_resolve_sysroot "$lib"
6153
*.la) func_source "$func_resolve_sysroot_result" ;;
6156
# Collect preopened libtool deplibs, except any this library
6157
# has declared as weak libs
6158
for deplib in $dependency_libs; do
6159
func_basename "$deplib"
6160
deplib_base=$func_basename_result
6161
case " $weak_libs " in
6162
*" $deplib_base "*) ;;
6163
*) func_append deplibs " $deplib" ;;
6169
if test "$pass" = dlopen; then
6170
# Collect dlpreopened libraries
6171
save_deplibs="$deplibs"
6175
for deplib in $libs; do
6179
-mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe \
6180
|-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*)
6181
if test "$linkmode,$pass" = "prog,link"; then
6182
compile_deplibs="$deplib $compile_deplibs"
6183
finalize_deplibs="$deplib $finalize_deplibs"
6185
func_append compiler_flags " $deplib"
6186
if test "$linkmode" = lib ; then
6187
case "$new_inherited_linker_flags " in
6189
* ) func_append new_inherited_linker_flags " $deplib" ;;
6196
if test "$linkmode" != lib && test "$linkmode" != prog; then
6197
func_warning "\`-l' is ignored for archives/objects"
6200
func_stripname '-l' '' "$deplib"
6201
name=$func_stripname_result
6202
if test "$linkmode" = lib; then
6203
searchdirs="$newlib_search_path $lib_search_path $compiler_lib_search_dirs $sys_lib_search_path $shlib_search_path"
6205
searchdirs="$newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path"
6207
for searchdir in $searchdirs; do
6208
for search_ext in .la $std_shrext .so .a; do
6209
# Search the libtool library
6210
lib="$searchdir/lib${name}${search_ext}"
6211
if test -f "$lib"; then
6212
if test "$search_ext" = ".la"; then
6221
if test "$found" != yes; then
6222
# deplib doesn't seem to be a libtool library
6223
if test "$linkmode,$pass" = "prog,link"; then
6224
compile_deplibs="$deplib $compile_deplibs"
6225
finalize_deplibs="$deplib $finalize_deplibs"
6227
deplibs="$deplib $deplibs"
6228
test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
6231
else # deplib is a libtool library
6232
# If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib,
6233
# We need to do some special things here, and not later.
6234
if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
6235
case " $predeps $postdeps " in
6237
if func_lalib_p "$lib"; then
6241
for l in $old_library $library_names; do
6244
if test "X$ll" = "X$old_library" ; then # only static version available
6246
func_dirname "$lib" "" "."
6247
ladir="$func_dirname_result"
6248
lib=$ladir/$old_library
6249
if test "$linkmode,$pass" = "prog,link"; then
6250
compile_deplibs="$deplib $compile_deplibs"
6251
finalize_deplibs="$deplib $finalize_deplibs"
6253
deplibs="$deplib $deplibs"
6254
test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
6266
if test "$linkmode,$pass" = "prog,link"; then
6267
compile_deplibs="$deplib $compile_deplibs"
6268
finalize_deplibs="$deplib $finalize_deplibs"
6270
deplibs="$deplib $deplibs"
6271
if test "$linkmode" = lib ; then
6272
case "$new_inherited_linker_flags " in
6274
* ) func_append new_inherited_linker_flags " $deplib" ;;
6283
deplibs="$deplib $deplibs"
6284
test "$pass" = conv && continue
6285
newdependency_libs="$deplib $newdependency_libs"
6286
func_stripname '-L' '' "$deplib"
6287
func_resolve_sysroot "$func_stripname_result"
6288
func_append newlib_search_path " $func_resolve_sysroot_result"
6291
if test "$pass" = conv; then
6292
deplibs="$deplib $deplibs"
6295
if test "$pass" = scan; then
6296
deplibs="$deplib $deplibs"
6298
compile_deplibs="$deplib $compile_deplibs"
6299
finalize_deplibs="$deplib $finalize_deplibs"
6301
func_stripname '-L' '' "$deplib"
6302
func_resolve_sysroot "$func_stripname_result"
6303
func_append newlib_search_path " $func_resolve_sysroot_result"
6306
func_warning "\`-L' is ignored for archives/objects"
6312
if test "$pass" = link; then
6313
func_stripname '-R' '' "$deplib"
6314
func_resolve_sysroot "$func_stripname_result"
6315
dir=$func_resolve_sysroot_result
6316
# Make sure the xrpath contains only unique directories.
6319
*) func_append xrpath " $dir" ;;
6322
deplibs="$deplib $deplibs"
6326
func_resolve_sysroot "$deplib"
6327
lib=$func_resolve_sysroot_result
6330
if test "$pass" = conv; then
6331
deplibs="$deplib $deplibs"
6336
# Linking convenience modules into shared libraries is allowed,
6337
# but linking other static libraries is non-portable.
6338
case " $dlpreconveniencelibs " in
6342
case $deplibs_check_method in
6344
set dummy $deplibs_check_method; shift
6345
match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
6346
if eval "\$ECHO \"$deplib\"" 2>/dev/null | $SED 10q \
6347
| $EGREP "$match_pattern_regex" > /dev/null; then
6355
if test "$valid_a_lib" != yes; then
6357
$ECHO "*** Warning: Trying to link with static lib archive $deplib."
6358
echo "*** I have the capability to make that library automatically link in when"
6359
echo "*** you link to this library. But I can only do this if you have a"
6360
echo "*** shared version of the library, which you do not appear to have"
6361
echo "*** because the file extensions .$libext of this argument makes me believe"
6362
echo "*** that it is just a static archive that I should not use here."
6365
$ECHO "*** Warning: Linking the shared library $output against the"
6366
$ECHO "*** static library $deplib is not portable!"
6367
deplibs="$deplib $deplibs"
6374
if test "$pass" != link; then
6375
deplibs="$deplib $deplibs"
6377
compile_deplibs="$deplib $compile_deplibs"
6378
finalize_deplibs="$deplib $finalize_deplibs"
6385
if test "$pass" = conv; then
6386
deplibs="$deplib $deplibs"
6387
elif test "$linkmode" = prog; then
6388
if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
6389
# If there is no dlopen support or we're linking statically,
6390
# we need to preload.
6391
func_append newdlprefiles " $deplib"
6392
compile_deplibs="$deplib $compile_deplibs"
6393
finalize_deplibs="$deplib $finalize_deplibs"
6395
func_append newdlfiles " $deplib"
6406
if test "$found" = yes || test -f "$lib"; then :
6408
func_fatal_error "cannot find the library \`$lib' or unhandled argument \`$deplib'"
6411
# Check to see that this really is a libtool archive.
6412
func_lalib_unsafe_p "$lib" \
6413
|| func_fatal_error "\`$lib' is not a valid libtool archive"
6415
func_dirname "$lib" "" "."
6416
ladir="$func_dirname_result"
6424
inherited_linker_flags=
6425
# If the library was installed with an old release of libtool,
6426
# it will not redefine variables installed, or shouldnotlink
6435
# Convert "-framework foo" to "foo.ltframework"
6436
if test -n "$inherited_linker_flags"; then
6437
tmp_inherited_linker_flags=`$ECHO "$inherited_linker_flags" | $SED 's/-framework \([^ $]*\)/\1.ltframework/g'`
6438
for tmp_inherited_linker_flag in $tmp_inherited_linker_flags; do
6439
case " $new_inherited_linker_flags " in
6440
*" $tmp_inherited_linker_flag "*) ;;
6441
*) func_append new_inherited_linker_flags " $tmp_inherited_linker_flag";;
6445
dependency_libs=`$ECHO " $dependency_libs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
6446
if test "$linkmode,$pass" = "lib,link" ||
6447
test "$linkmode,$pass" = "prog,scan" ||
6448
{ test "$linkmode" != prog && test "$linkmode" != lib; }; then
6449
test -n "$dlopen" && func_append dlfiles " $dlopen"
6450
test -n "$dlpreopen" && func_append dlprefiles " $dlpreopen"
6453
if test "$pass" = conv; then
6454
# Only check for convenience libraries
6455
deplibs="$lib $deplibs"
6456
if test -z "$libdir"; then
6457
if test -z "$old_library"; then
6458
func_fatal_error "cannot find name of link library for \`$lib'"
6460
# It is a libtool convenience library, so add in its objects.
6461
func_append convenience " $ladir/$objdir/$old_library"
6462
func_append old_convenience " $ladir/$objdir/$old_library"
6463
elif test "$linkmode" != prog && test "$linkmode" != lib; then
6464
func_fatal_error "\`$lib' is not a convenience library"
6467
for deplib in $dependency_libs; do
6468
deplibs="$deplib $deplibs"
6469
if $opt_preserve_dup_deps ; then
6470
case "$tmp_libs " in
6471
*" $deplib "*) func_append specialdeplibs " $deplib" ;;
6474
func_append tmp_libs " $deplib"
6480
# Get the name of the library we link against.
6482
if test -n "$old_library" &&
6483
{ test "$prefer_static_libs" = yes ||
6484
test "$prefer_static_libs,$installed" = "built,no"; }; then
6485
linklib=$old_library
6487
for l in $old_library $library_names; do
6491
if test -z "$linklib"; then
6492
func_fatal_error "cannot find name of link library for \`$lib'"
6495
# This library was specified with -dlopen.
6496
if test "$pass" = dlopen; then
6497
if test -z "$libdir"; then
6498
func_fatal_error "cannot -dlopen a convenience library: \`$lib'"
6500
if test -z "$dlname" ||
6501
test "$dlopen_support" != yes ||
6502
test "$build_libtool_libs" = no; then
6503
# If there is no dlname, no dlopen support or we're linking
6504
# statically, we need to preload. We also need to preload any
6505
# dependent libraries so libltdl's deplib preloader doesn't
6506
# bomb out in the load deplibs phase.
6507
func_append dlprefiles " $lib $dependency_libs"
6509
func_append newdlfiles " $lib"
6514
# We need an absolute path.
6516
[\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;;
6518
abs_ladir=`cd "$ladir" && pwd`
6519
if test -z "$abs_ladir"; then
6520
func_warning "cannot determine absolute directory name of \`$ladir'"
6521
func_warning "passing it literally to the linker, although it might fail"
6526
func_basename "$lib"
6527
laname="$func_basename_result"
6529
# Find the relevant object directory and library name.
6530
if test "X$installed" = Xyes; then
6531
if test ! -f "$lt_sysroot$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then
6532
func_warning "library \`$lib' was moved."
6537
dir="$lt_sysroot$libdir"
6538
absdir="$lt_sysroot$libdir"
6540
test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes
6542
if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then
6545
# Remove this search path later
6546
func_append notinst_path " $abs_ladir"
6548
dir="$ladir/$objdir"
6549
absdir="$abs_ladir/$objdir"
6550
# Remove this search path later
6551
func_append notinst_path " $abs_ladir"
6553
fi # $installed = yes
6554
func_stripname 'lib' '.la' "$laname"
6555
name=$func_stripname_result
6557
# This library was specified with -dlpreopen.
6558
if test "$pass" = dlpreopen; then
6559
if test -z "$libdir" && test "$linkmode" = prog; then
6560
func_fatal_error "only libraries may -dlpreopen a convenience library: \`$lib'"
6563
# special handling for platforms with PE-DLLs.
6564
*cygwin* | *mingw* | *cegcc* )
6565
# Linker will automatically link against shared library if both
6566
# static and shared are present. Therefore, ensure we extract
6567
# symbols from the import library if a shared library is present
6568
# (otherwise, the dlopen module name will be incorrect). We do
6569
# this by putting the import library name into $newdlprefiles.
6570
# We recover the dlopen module name by 'saving' the la file
6571
# name in a special purpose variable, and (later) extracting the
6572
# dlname from the la file.
6573
if test -n "$dlname"; then
6574
func_tr_sh "$dir/$linklib"
6575
eval "libfile_$func_tr_sh_result=\$abs_ladir/\$laname"
6576
func_append newdlprefiles " $dir/$linklib"
6578
func_append newdlprefiles " $dir/$old_library"
6579
# Keep a list of preopened convenience libraries to check
6580
# that they are being used correctly in the link pass.
6581
test -z "$libdir" && \
6582
func_append dlpreconveniencelibs " $dir/$old_library"
6586
# Prefer using a static library (so that no silly _DYNAMIC symbols
6587
# are required to link).
6588
if test -n "$old_library"; then
6589
func_append newdlprefiles " $dir/$old_library"
6590
# Keep a list of preopened convenience libraries to check
6591
# that they are being used correctly in the link pass.
6592
test -z "$libdir" && \
6593
func_append dlpreconveniencelibs " $dir/$old_library"
6594
# Otherwise, use the dlname, so that lt_dlopen finds it.
6595
elif test -n "$dlname"; then
6596
func_append newdlprefiles " $dir/$dlname"
6598
func_append newdlprefiles " $dir/$linklib"
6602
fi # $pass = dlpreopen
6604
if test -z "$libdir"; then
6605
# Link the convenience library
6606
if test "$linkmode" = lib; then
6607
deplibs="$dir/$old_library $deplibs"
6608
elif test "$linkmode,$pass" = "prog,link"; then
6609
compile_deplibs="$dir/$old_library $compile_deplibs"
6610
finalize_deplibs="$dir/$old_library $finalize_deplibs"
6612
deplibs="$lib $deplibs" # used for prog,scan pass
6618
if test "$linkmode" = prog && test "$pass" != link; then
6619
func_append newlib_search_path " $ladir"
6620
deplibs="$lib $deplibs"
6623
if test "$link_all_deplibs" != no || test -z "$library_names" ||
6624
test "$build_libtool_libs" = no; then
6629
for deplib in $dependency_libs; do
6631
-L*) func_stripname '-L' '' "$deplib"
6632
func_resolve_sysroot "$func_stripname_result"
6633
func_append newlib_search_path " $func_resolve_sysroot_result"
6636
# Need to link against all dependency_libs?
6637
if test "$linkalldeplibs" = yes; then
6638
deplibs="$deplib $deplibs"
6640
# Need to hardcode shared library paths
6641
# or/and link against static libraries
6642
newdependency_libs="$deplib $newdependency_libs"
6644
if $opt_preserve_dup_deps ; then
6645
case "$tmp_libs " in
6646
*" $deplib "*) func_append specialdeplibs " $deplib" ;;
6649
func_append tmp_libs " $deplib"
6652
fi # $linkmode = prog...
6654
if test "$linkmode,$pass" = "prog,link"; then
6655
if test -n "$library_names" &&
6656
{ { test "$prefer_static_libs" = no ||
6657
test "$prefer_static_libs,$installed" = "built,yes"; } ||
6658
test -z "$old_library"; }; then
6659
# We need to hardcode the library path
6660
if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then
6661
# Make sure the rpath contains only unique directories.
6662
case "$temp_rpath:" in
6664
*) func_append temp_rpath "$absdir:" ;;
6668
# Hardcode the library path.
6669
# Skip directories that are in the system default run-time
6671
case " $sys_lib_dlsearch_path " in
6674
case "$compile_rpath " in
6676
*) func_append compile_rpath " $absdir" ;;
6680
case " $sys_lib_dlsearch_path " in
6683
case "$finalize_rpath " in
6685
*) func_append finalize_rpath " $libdir" ;;
6689
fi # $linkmode,$pass = prog,link...
6691
if test "$alldeplibs" = yes &&
6692
{ test "$deplibs_check_method" = pass_all ||
6693
{ test "$build_libtool_libs" = yes &&
6694
test -n "$library_names"; }; }; then
6695
# We only need to search for static libraries
6700
link_static=no # Whether the deplib will be linked statically
6701
use_static_libs=$prefer_static_libs
6702
if test "$use_static_libs" = built && test "$installed" = yes; then
6705
if test -n "$library_names" &&
6706
{ test "$use_static_libs" = no || test -z "$old_library"; }; then
6708
*cygwin* | *mingw* | *cegcc*)
6709
# No point in relinking DLLs because paths are not encoded
6710
func_append notinst_deplibs " $lib"
6714
if test "$installed" = no; then
6715
func_append notinst_deplibs " $lib"
6720
# This is a shared library
6722
# Warn about portability, can't link against -module's on some
6723
# systems (darwin). Don't bleat about dlopened modules though!
6725
for dlpremoduletest in $dlprefiles; do
6726
if test "X$dlpremoduletest" = "X$lib"; then
6727
dlopenmodule="$dlpremoduletest"
6731
if test -z "$dlopenmodule" && test "$shouldnotlink" = yes && test "$pass" = link; then
6733
if test "$linkmode" = prog; then
6734
$ECHO "*** Warning: Linking the executable $output against the loadable module"
6736
$ECHO "*** Warning: Linking the shared library $output against the loadable module"
6738
$ECHO "*** $linklib is not portable!"
6740
if test "$linkmode" = lib &&
6741
test "$hardcode_into_libs" = yes; then
6742
# Hardcode the library path.
6743
# Skip directories that are in the system default run-time
6745
case " $sys_lib_dlsearch_path " in
6748
case "$compile_rpath " in
6750
*) func_append compile_rpath " $absdir" ;;
6754
case " $sys_lib_dlsearch_path " in
6757
case "$finalize_rpath " in
6759
*) func_append finalize_rpath " $libdir" ;;
6765
if test -n "$old_archive_from_expsyms_cmds"; then
6766
# figure out the soname
6767
set dummy $library_names
6771
libname=`eval "\\$ECHO \"$libname_spec\""`
6772
# use dlname if we got it. it's perfectly good, no?
6773
if test -n "$dlname"; then
6775
elif test -n "$soname_spec"; then
6778
*cygwin* | mingw* | *cegcc*)
6779
func_arith $current - $age
6780
major=$func_arith_result
6784
eval soname=\"$soname_spec\"
6789
# Make a new name for the extract_expsyms_cmds to use
6791
func_basename "$soroot"
6792
soname="$func_basename_result"
6793
func_stripname 'lib' '.dll' "$soname"
6794
newlib=libimp-$func_stripname_result.a
6796
# If the library has no export list, then create one now
6797
if test -f "$output_objdir/$soname-def"; then :
6799
func_verbose "extracting exported symbol list from \`$soname'"
6800
func_execute_cmds "$extract_expsyms_cmds" 'exit $?'
6804
if test -f "$output_objdir/$newlib"; then :; else
6805
func_verbose "generating import library for \`$soname'"
6806
func_execute_cmds "$old_archive_from_expsyms_cmds" 'exit $?'
6808
# make sure the library variables are pointing to the new library
6811
fi # test -n "$old_archive_from_expsyms_cmds"
6813
if test "$linkmode" = prog || test "$opt_mode" != relink; then
6818
case $hardcode_action in
6819
immediate | unsupported)
6820
if test "$hardcode_direct" = no; then
6823
*-*-sco3.2v5.0.[024]*) add_dir="-L$dir" ;;
6824
*-*-sysv4*uw2*) add_dir="-L$dir" ;;
6825
*-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \
6826
*-*-unixware7*) add_dir="-L$dir" ;;
6828
# if the lib is a (non-dlopened) module then we can not
6829
# link against it, someone is ignoring the earlier warnings
6830
if /usr/bin/file -L $add 2> /dev/null |
6831
$GREP ": [^:]* bundle" >/dev/null ; then
6832
if test "X$dlopenmodule" != "X$lib"; then
6833
$ECHO "*** Warning: lib $linklib is a module, not a shared library"
6834
if test -z "$old_library" ; then
6836
echo "*** And there doesn't seem to be a static archive available"
6837
echo "*** The link will probably fail, sorry"
6839
add="$dir/$old_library"
6841
elif test -n "$old_library"; then
6842
add="$dir/$old_library"
6846
elif test "$hardcode_minus_L" = no; then
6848
*-*-sunos*) add_shlibpath="$dir" ;;
6852
elif test "$hardcode_shlibpath_var" = no; then
6853
add_shlibpath="$dir"
6860
if test "$hardcode_direct" = yes &&
6861
test "$hardcode_direct_absolute" = no; then
6863
elif test "$hardcode_minus_L" = yes; then
6865
# Try looking first in the location we're being installed to.
6866
if test -n "$inst_prefix_dir"; then
6869
func_append add_dir " -L$inst_prefix_dir$libdir"
6874
elif test "$hardcode_shlibpath_var" = yes; then
6875
add_shlibpath="$dir"
6884
if test "$lib_linked" != yes; then
6885
func_fatal_configuration "unsupported hardcode properties"
6888
if test -n "$add_shlibpath"; then
6889
case :$compile_shlibpath: in
6890
*":$add_shlibpath:"*) ;;
6891
*) func_append compile_shlibpath "$add_shlibpath:" ;;
6894
if test "$linkmode" = prog; then
6895
test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs"
6896
test -n "$add" && compile_deplibs="$add $compile_deplibs"
6898
test -n "$add_dir" && deplibs="$add_dir $deplibs"
6899
test -n "$add" && deplibs="$add $deplibs"
6900
if test "$hardcode_direct" != yes &&
6901
test "$hardcode_minus_L" != yes &&
6902
test "$hardcode_shlibpath_var" = yes; then
6903
case :$finalize_shlibpath: in
6905
*) func_append finalize_shlibpath "$libdir:" ;;
6911
if test "$linkmode" = prog || test "$opt_mode" = relink; then
6915
# Finalize command for both is simple: just hardcode it.
6916
if test "$hardcode_direct" = yes &&
6917
test "$hardcode_direct_absolute" = no; then
6918
add="$libdir/$linklib"
6919
elif test "$hardcode_minus_L" = yes; then
6922
elif test "$hardcode_shlibpath_var" = yes; then
6923
case :$finalize_shlibpath: in
6925
*) func_append finalize_shlibpath "$libdir:" ;;
6928
elif test "$hardcode_automatic" = yes; then
6929
if test -n "$inst_prefix_dir" &&
6930
test -f "$inst_prefix_dir$libdir/$linklib" ; then
6931
add="$inst_prefix_dir$libdir/$linklib"
6933
add="$libdir/$linklib"
6936
# We cannot seem to hardcode it, guess we'll fake it.
6938
# Try looking first in the location we're being installed to.
6939
if test -n "$inst_prefix_dir"; then
6942
func_append add_dir " -L$inst_prefix_dir$libdir"
6949
if test "$linkmode" = prog; then
6950
test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs"
6951
test -n "$add" && finalize_deplibs="$add $finalize_deplibs"
6953
test -n "$add_dir" && deplibs="$add_dir $deplibs"
6954
test -n "$add" && deplibs="$add $deplibs"
6957
elif test "$linkmode" = prog; then
6958
# Here we assume that one of hardcode_direct or hardcode_minus_L
6959
# is not unsupported. This is valid on all known static and
6961
if test "$hardcode_direct" != unsupported; then
6962
test -n "$old_library" && linklib="$old_library"
6963
compile_deplibs="$dir/$linklib $compile_deplibs"
6964
finalize_deplibs="$dir/$linklib $finalize_deplibs"
6966
compile_deplibs="-l$name -L$dir $compile_deplibs"
6967
finalize_deplibs="-l$name -L$dir $finalize_deplibs"
6969
elif test "$build_libtool_libs" = yes; then
6970
# Not a shared library
6971
if test "$deplibs_check_method" != pass_all; then
6972
# We're trying link a shared library against a static one
6973
# but the system doesn't support it.
6975
# Just print a warning and add the library to dependency_libs so
6976
# that the program can be linked against the static library.
6978
$ECHO "*** Warning: This system can not link to static lib archive $lib."
6979
echo "*** I have the capability to make that library automatically link in when"
6980
echo "*** you link to this library. But I can only do this if you have a"
6981
echo "*** shared version of the library, which you do not appear to have."
6982
if test "$module" = yes; then
6983
echo "*** But as you try to build a module library, libtool will still create "
6984
echo "*** a static module, that should work as long as the dlopening application"
6985
echo "*** is linked with the -dlopen flag to resolve symbols at runtime."
6986
if test -z "$global_symbol_pipe"; then
6988
echo "*** However, this would only work if libtool was able to extract symbol"
6989
echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
6990
echo "*** not find such a program. So, this module is probably useless."
6991
echo "*** \`nm' from GNU binutils and a full rebuild may help."
6993
if test "$build_old_libs" = no; then
6994
build_libtool_libs=module
6997
build_libtool_libs=no
7001
deplibs="$dir/$old_library $deplibs"
7004
fi # link shared/static library?
7006
if test "$linkmode" = lib; then
7007
if test -n "$dependency_libs" &&
7008
{ test "$hardcode_into_libs" != yes ||
7009
test "$build_old_libs" = yes ||
7010
test "$link_static" = yes; }; then
7011
# Extract -R from dependency_libs
7013
for libdir in $dependency_libs; do
7015
-R*) func_stripname '-R' '' "$libdir"
7016
temp_xrpath=$func_stripname_result
7018
*" $temp_xrpath "*) ;;
7019
*) func_append xrpath " $temp_xrpath";;
7021
*) func_append temp_deplibs " $libdir";;
7024
dependency_libs="$temp_deplibs"
7027
func_append newlib_search_path " $absdir"
7028
# Link against this library
7029
test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs"
7030
# ... and its dependency_libs
7032
for deplib in $dependency_libs; do
7033
newdependency_libs="$deplib $newdependency_libs"
7035
-L*) func_stripname '-L' '' "$deplib"
7036
func_resolve_sysroot "$func_stripname_result";;
7037
*) func_resolve_sysroot "$deplib" ;;
7039
if $opt_preserve_dup_deps ; then
7040
case "$tmp_libs " in
7041
*" $func_resolve_sysroot_result "*)
7042
func_append specialdeplibs " $func_resolve_sysroot_result" ;;
7045
func_append tmp_libs " $func_resolve_sysroot_result"
7048
if test "$link_all_deplibs" != no; then
7049
# Add the search paths of all dependency libraries
7050
for deplib in $dependency_libs; do
7053
-L*) path="$deplib" ;;
7055
func_resolve_sysroot "$deplib"
7056
deplib=$func_resolve_sysroot_result
7057
func_dirname "$deplib" "" "."
7058
dir=$func_dirname_result
7059
# We need an absolute path.
7061
[\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;;
7063
absdir=`cd "$dir" && pwd`
7064
if test -z "$absdir"; then
7065
func_warning "cannot determine absolute directory name of \`$dir'"
7070
if $GREP "^installed=no" $deplib > /dev/null; then
7074
eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib`
7075
if test -n "$deplibrary_names" ; then
7076
for tmp in $deplibrary_names ; do
7079
if test -f "$absdir/$objdir/$depdepl" ; then
7080
depdepl="$absdir/$objdir/$depdepl"
7081
darwin_install_name=`${OTOOL} -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'`
7082
if test -z "$darwin_install_name"; then
7083
darwin_install_name=`${OTOOL64} -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'`
7085
func_append compiler_flags " ${wl}-dylib_file ${wl}${darwin_install_name}:${depdepl}"
7086
func_append linker_flags " -dylib_file ${darwin_install_name}:${depdepl}"
7092
path="-L$absdir/$objdir"
7096
eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
7097
test -z "$libdir" && \
7098
func_fatal_error "\`$deplib' is not a valid libtool archive"
7099
test "$absdir" != "$libdir" && \
7100
func_warning "\`$deplib' seems to be moved"
7106
case " $deplibs " in
7108
*) deplibs="$path $deplibs" ;;
7111
fi # link_all_deplibs != no
7113
done # for deplib in $libs
7114
if test "$pass" = link; then
7115
if test "$linkmode" = "prog"; then
7116
compile_deplibs="$new_inherited_linker_flags $compile_deplibs"
7117
finalize_deplibs="$new_inherited_linker_flags $finalize_deplibs"
7119
compiler_flags="$compiler_flags "`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
7122
dependency_libs="$newdependency_libs"
7123
if test "$pass" = dlpreopen; then
7124
# Link the dlpreopened libraries before other libraries
7125
for deplib in $save_deplibs; do
7126
deplibs="$deplib $deplibs"
7129
if test "$pass" != dlopen; then
7130
if test "$pass" != conv; then
7131
# Make sure lib_search_path contains only unique directories.
7133
for dir in $newlib_search_path; do
7134
case "$lib_search_path " in
7136
*) func_append lib_search_path " $dir" ;;
7142
if test "$linkmode,$pass" != "prog,link"; then
7145
vars="compile_deplibs finalize_deplibs"
7147
for var in $vars dependency_libs; do
7148
# Add libraries to $var in reverse order
7149
eval tmp_libs=\"\$$var\"
7151
for deplib in $tmp_libs; do
7152
# FIXME: Pedantically, this is the right thing to do, so
7153
# that some nasty dependency loop isn't accidentally
7155
#new_libs="$deplib $new_libs"
7156
# Pragmatically, this seems to cause very few problems in
7159
-L*) new_libs="$deplib $new_libs" ;;
7162
# And here is the reason: when a library appears more
7163
# than once as an explicit dependence of a library, or
7164
# is implicitly linked in more than once by the
7165
# compiler, it is considered special, and multiple
7166
# occurrences thereof are not removed. Compare this
7167
# with having the same library being listed as a
7168
# dependency of multiple other libraries: in this case,
7169
# we know (pedantically, we assume) the library does not
7170
# need to be listed more than once, so we keep only the
7171
# last copy. This is not always right, but it is rare
7172
# enough that we require users that really mean to play
7173
# such unportable linking tricks to link the library
7174
# using -Wl,-lname, so that libtool does not consider it
7175
# for duplicate removal.
7176
case " $specialdeplibs " in
7177
*" $deplib "*) new_libs="$deplib $new_libs" ;;
7179
case " $new_libs " in
7181
*) new_libs="$deplib $new_libs" ;;
7189
for deplib in $new_libs; do
7192
case " $tmp_libs " in
7194
*) func_append tmp_libs " $deplib" ;;
7197
*) func_append tmp_libs " $deplib" ;;
7200
eval $var=\"$tmp_libs\"
7203
# Last step: remove runtime libs from dependency_libs
7204
# (they stay in deplibs)
7206
for i in $dependency_libs ; do
7207
case " $predeps $postdeps $compiler_lib_search_path " in
7212
if test -n "$i" ; then
7213
func_append tmp_libs " $i"
7216
dependency_libs=$tmp_libs
7218
if test "$linkmode" = prog; then
7219
dlfiles="$newdlfiles"
7221
if test "$linkmode" = prog || test "$linkmode" = lib; then
7222
dlprefiles="$newdlprefiles"
7227
if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
7228
func_warning "\`-dlopen' is ignored for archives"
7233
func_warning "\`-l' and \`-L' are ignored for archives" ;;
7236
test -n "$rpath" && \
7237
func_warning "\`-rpath' is ignored for archives"
7239
test -n "$xrpath" && \
7240
func_warning "\`-R' is ignored for archives"
7242
test -n "$vinfo" && \
7243
func_warning "\`-version-info/-version-number' is ignored for archives"
7245
test -n "$release" && \
7246
func_warning "\`-release' is ignored for archives"
7248
test -n "$export_symbols$export_symbols_regex" && \
7249
func_warning "\`-export-symbols' is ignored for archives"
7251
# Now set the variables for building old libraries.
7252
build_libtool_libs=no
7254
func_append objs "$old_deplibs"
7258
# Make sure we only generate libraries of the form `libNAME.la'.
7261
func_stripname 'lib' '.la' "$outputname"
7262
name=$func_stripname_result
7263
eval shared_ext=\"$shrext_cmds\"
7264
eval libname=\"$libname_spec\"
7267
test "$module" = no && \
7268
func_fatal_help "libtool library \`$output' must begin with \`lib'"
7270
if test "$need_lib_prefix" != no; then
7271
# Add the "lib" prefix for modules if required
7272
func_stripname '' '.la' "$outputname"
7273
name=$func_stripname_result
7274
eval shared_ext=\"$shrext_cmds\"
7275
eval libname=\"$libname_spec\"
7277
func_stripname '' '.la' "$outputname"
7278
libname=$func_stripname_result
7283
if test -n "$objs"; then
7284
if test "$deplibs_check_method" != pass_all; then
7285
func_fatal_error "cannot build libtool library \`$output' from non-libtool objects on this host:$objs"
7288
$ECHO "*** Warning: Linking the shared library $output against the non-libtool"
7289
$ECHO "*** objects $objs is not portable!"
7290
func_append libobjs " $objs"
7294
test "$dlself" != no && \
7295
func_warning "\`-dlopen self' is ignored for libtool libraries"
7299
test "$#" -gt 1 && \
7300
func_warning "ignoring multiple \`-rpath's for a libtool library"
7305
if test -z "$rpath"; then
7306
if test "$build_libtool_libs" = yes; then
7307
# Building a libtool convenience library.
7308
# Some compilers have problems with a `.al' extension so
7309
# convenience libraries should have the same extension an
7310
# archive normally would.
7311
oldlibs="$output_objdir/$libname.$libext $oldlibs"
7312
build_libtool_libs=convenience
7316
test -n "$vinfo" && \
7317
func_warning "\`-version-info/-version-number' is ignored for convenience libraries"
7319
test -n "$release" && \
7320
func_warning "\`-release' is ignored for convenience libraries"
7323
# Parse the version information argument.
7324
save_ifs="$IFS"; IFS=':'
7325
set dummy $vinfo 0 0 0
7330
func_fatal_help "too many parameters to \`-version-info'"
7332
# convert absolute version numbers to libtool ages
7333
# this retains compatibility with .la files and attempts
7334
# to make the code below a bit more comprehensible
7336
case $vinfo_number in
7340
number_revision="$3"
7342
# There are really only two kinds -- those that
7343
# use the current revision as the major version
7344
# and those that subtract age and use age as
7345
# a minor version. But, then there is irix
7346
# which has an extra 1 added just for fun
7348
case $version_type in
7349
# correct linux to gnu/linux during the next big refactor
7350
darwin|linux|osf|windows|none)
7351
func_arith $number_major + $number_minor
7352
current=$func_arith_result
7354
revision="$number_revision"
7356
freebsd-aout|freebsd-elf|qnx|sunos)
7357
current="$number_major"
7358
revision="$number_minor"
7362
func_arith $number_major + $number_minor
7363
current=$func_arith_result
7365
revision="$number_minor"
7366
lt_irix_increment=no
7377
# Check that each of the things are valid numbers.
7379
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]) ;;
7381
func_error "CURRENT \`$current' must be a nonnegative integer"
7382
func_fatal_error "\`$vinfo' is not valid version information"
7387
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]) ;;
7389
func_error "REVISION \`$revision' must be a nonnegative integer"
7390
func_fatal_error "\`$vinfo' is not valid version information"
7395
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]) ;;
7397
func_error "AGE \`$age' must be a nonnegative integer"
7398
func_fatal_error "\`$vinfo' is not valid version information"
7402
if test "$age" -gt "$current"; then
7403
func_error "AGE \`$age' is greater than the current interface number \`$current'"
7404
func_fatal_error "\`$vinfo' is not valid version information"
7407
# Calculate the version variables.
7411
case $version_type in
7415
# Like Linux, but with the current version available in
7416
# verstring for coding it into the library header
7417
func_arith $current - $age
7418
major=.$func_arith_result
7419
versuffix="$major.$age.$revision"
7420
# Darwin ld doesn't like 0 for these options...
7421
func_arith $current + 1
7422
minor_current=$func_arith_result
7423
xlcverstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision"
7424
verstring="-compatibility_version $minor_current -current_version $minor_current.$revision"
7429
versuffix=".$current.$revision";
7434
versuffix=".$current"
7438
if test "X$lt_irix_increment" = "Xno"; then
7439
func_arith $current - $age
7441
func_arith $current - $age + 1
7443
major=$func_arith_result
7445
case $version_type in
7446
nonstopux) verstring_prefix=nonstopux ;;
7447
*) verstring_prefix=sgi ;;
7449
verstring="$verstring_prefix$major.$revision"
7451
# Add in all the interfaces that we are compatible with.
7453
while test "$loop" -ne 0; do
7454
func_arith $revision - $loop
7455
iface=$func_arith_result
7456
func_arith $loop - 1
7457
loop=$func_arith_result
7458
verstring="$verstring_prefix$major.$iface:$verstring"
7461
# Before this point, $major must not contain `.'.
7463
versuffix="$major.$revision"
7466
linux) # correct to gnu/linux during the next big refactor
7467
func_arith $current - $age
7468
major=.$func_arith_result
7469
versuffix="$major.$age.$revision"
7473
func_arith $current - $age
7474
major=.$func_arith_result
7475
versuffix=".$current.$age.$revision"
7476
verstring="$current.$age.$revision"
7478
# Add in all the interfaces that we are compatible with.
7480
while test "$loop" -ne 0; do
7481
func_arith $current - $loop
7482
iface=$func_arith_result
7483
func_arith $loop - 1
7484
loop=$func_arith_result
7485
verstring="$verstring:${iface}.0"
7488
# Make executables depend on our current version.
7489
func_append verstring ":${current}.0"
7494
versuffix=".$current"
7499
versuffix=".$current.$revision"
7503
# Use '-' rather than '.', since we only want one
7504
# extension on DOS 8.3 filesystems.
7505
func_arith $current - $age
7506
major=$func_arith_result
7511
func_fatal_configuration "unknown library version type \`$version_type'"
7515
# Clear the version info if we defaulted, and they specified a release.
7516
if test -z "$vinfo" && test -n "$release"; then
7518
case $version_type in
7520
# we can't check for "0.0" in archive_cmds due to quoting
7521
# problems, so we reset it completely
7528
if test "$need_version" = no; then
7535
# Remove version info from name if versioning should be avoided
7536
if test "$avoid_version" = yes && test "$need_version" = no; then
7542
# Check to see if the archive will have undefined symbols.
7543
if test "$allow_undefined" = yes; then
7544
if test "$allow_undefined_flag" = unsupported; then
7545
func_warning "undefined symbols not allowed in $host shared libraries"
7546
build_libtool_libs=no
7550
# Don't allow undefined symbols.
7551
allow_undefined_flag="$no_undefined_flag"
7556
func_generate_dlsyms "$libname" "$libname" "yes"
7557
func_append libobjs " $symfileobj"
7558
test "X$libobjs" = "X " && libobjs=
7560
if test "$opt_mode" != relink; then
7561
# Remove our outputs, but don't remove object files since they
7562
# may have been created when compiling PIC objects.
7564
tempremovelist=`$ECHO "$output_objdir/*"`
7565
for p in $tempremovelist; do
7569
$output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*)
7570
if test "X$precious_files_regex" != "X"; then
7571
if $ECHO "$p" | $EGREP -e "$precious_files_regex" >/dev/null 2>&1
7576
func_append removelist " $p"
7581
test -n "$removelist" && \
7582
func_show_eval "${RM}r \$removelist"
7585
# Now set the variables for building old libraries.
7586
if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then
7587
func_append oldlibs " $output_objdir/$libname.$libext"
7589
# Transform .lo files to .o files.
7590
oldobjs="$objs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.${libext}$/d; $lo2o" | $NL2SP`
7593
# Eliminate all temporary directories.
7594
#for path in $notinst_path; do
7595
# lib_search_path=`$ECHO "$lib_search_path " | $SED "s% $path % %g"`
7596
# deplibs=`$ECHO "$deplibs " | $SED "s% -L$path % %g"`
7597
# dependency_libs=`$ECHO "$dependency_libs " | $SED "s% -L$path % %g"`
7600
if test -n "$xrpath"; then
7601
# If the user specified any rpath flags, then add them.
7603
for libdir in $xrpath; do
7604
func_replace_sysroot "$libdir"
7605
func_append temp_xrpath " -R$func_replace_sysroot_result"
7606
case "$finalize_rpath " in
7608
*) func_append finalize_rpath " $libdir" ;;
7611
if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then
7612
dependency_libs="$temp_xrpath $dependency_libs"
7616
# Make sure dlfiles contains only unique files that won't be dlpreopened
7617
old_dlfiles="$dlfiles"
7619
for lib in $old_dlfiles; do
7620
case " $dlprefiles $dlfiles " in
7622
*) func_append dlfiles " $lib" ;;
7626
# Make sure dlprefiles contains only unique files
7627
old_dlprefiles="$dlprefiles"
7629
for lib in $old_dlprefiles; do
7630
case "$dlprefiles " in
7632
*) func_append dlprefiles " $lib" ;;
7636
if test "$build_libtool_libs" = yes; then
7637
if test -n "$rpath"; then
7639
*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos* | *-cegcc* | *-*-haiku*)
7640
# these systems don't actually have a c library (as such)!
7642
*-*-rhapsody* | *-*-darwin1.[012])
7643
# Rhapsody C library is in the System framework
7644
func_append deplibs " System.ltframework"
7647
# Don't link with libc until the a.out ld.so is fixed.
7649
*-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
7650
# Do not include libc due to us having libc/libc_r.
7652
*-*-sco3.2v5* | *-*-sco5v6*)
7653
# Causes problems with __ctype
7655
*-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
7656
# Compiler inserts libc in the correct place for threads to work
7659
# Add libc to deplibs on all other systems if necessary.
7660
if test "$build_libtool_need_lc" = "yes"; then
7661
func_append deplibs " -lc"
7667
# Transform deplibs into only deplibs that can be linked in shared.
7669
libname_save=$libname
7670
release_save=$release
7671
versuffix_save=$versuffix
7673
# I'm not sure if I'm treating the release correctly. I think
7674
# release should show up in the -l (ie -lgmp5) so we don't want to
7675
# add it in twice. Is that correct?
7681
case $deplibs_check_method in
7683
# Don't check for shared/static. Everything works.
7684
# This might be a little naive. We might want to check
7685
# whether the library exists or not. But this is on
7686
# osf3 & osf4 and I'm not really sure... Just
7687
# implementing what was already the behavior.
7691
# This code stresses the "libraries are programs" paradigm to its
7692
# limits. Maybe even breaks it. We compile a program, linking it
7693
# against the deplibs as a proxy for the library. Then we can check
7694
# whether they linked in statically or dynamically with ldd.
7695
$opt_dry_run || $RM conftest.c
7696
cat > conftest.c <<EOF
7697
int main() { return 0; }
7699
$opt_dry_run || $RM conftest
7700
if $LTCC $LTCFLAGS -o conftest conftest.c $deplibs; then
7701
ldd_output=`ldd conftest`
7702
for i in $deplibs; do
7705
func_stripname -l '' "$i"
7706
name=$func_stripname_result
7707
if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
7708
case " $predeps $postdeps " in
7710
func_append newdeplibs " $i"
7715
if test -n "$i" ; then
7716
libname=`eval "\\$ECHO \"$libname_spec\""`
7717
deplib_matches=`eval "\\$ECHO \"$library_names_spec\""`
7718
set dummy $deplib_matches; shift
7720
if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
7721
func_append newdeplibs " $i"
7725
$ECHO "*** Warning: dynamic linker does not accept needed library $i."
7726
echo "*** I have the capability to make that library automatically link in when"
7727
echo "*** you link to this library. But I can only do this if you have a"
7728
echo "*** shared version of the library, which I believe you do not have"
7729
echo "*** because a test_compile did reveal that the linker did not use it for"
7730
echo "*** its dynamic dependency list that programs get resolved with at runtime."
7735
func_append newdeplibs " $i"
7740
# Error occurred in the first compile. Let's try to salvage
7741
# the situation: Compile a separate program for each library.
7742
for i in $deplibs; do
7745
func_stripname -l '' "$i"
7746
name=$func_stripname_result
7747
$opt_dry_run || $RM conftest
7748
if $LTCC $LTCFLAGS -o conftest conftest.c $i; then
7749
ldd_output=`ldd conftest`
7750
if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
7751
case " $predeps $postdeps " in
7753
func_append newdeplibs " $i"
7758
if test -n "$i" ; then
7759
libname=`eval "\\$ECHO \"$libname_spec\""`
7760
deplib_matches=`eval "\\$ECHO \"$library_names_spec\""`
7761
set dummy $deplib_matches; shift
7763
if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
7764
func_append newdeplibs " $i"
7768
$ECHO "*** Warning: dynamic linker does not accept needed library $i."
7769
echo "*** I have the capability to make that library automatically link in when"
7770
echo "*** you link to this library. But I can only do this if you have a"
7771
echo "*** shared version of the library, which you do not appear to have"
7772
echo "*** because a test_compile did reveal that the linker did not use this one"
7773
echo "*** as a dynamic dependency that programs can get resolved with at runtime."
7779
$ECHO "*** Warning! Library $i is needed by this library but I was not able to"
7780
echo "*** make it link in! You will probably need to install it or some"
7781
echo "*** library that it depends on before this library will be fully"
7782
echo "*** functional. Installing it before continuing would be even better."
7786
func_append newdeplibs " $i"
7793
set dummy $deplibs_check_method; shift
7794
file_magic_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
7795
for a_deplib in $deplibs; do
7798
func_stripname -l '' "$a_deplib"
7799
name=$func_stripname_result
7800
if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
7801
case " $predeps $postdeps " in
7803
func_append newdeplibs " $a_deplib"
7808
if test -n "$a_deplib" ; then
7809
libname=`eval "\\$ECHO \"$libname_spec\""`
7810
if test -n "$file_magic_glob"; then
7811
libnameglob=`func_echo_all "$libname" | $SED -e $file_magic_glob`
7813
libnameglob=$libname
7815
test "$want_nocaseglob" = yes && nocaseglob=`shopt -p nocaseglob`
7816
for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
7817
if test "$want_nocaseglob" = yes; then
7819
potential_libs=`ls $i/$libnameglob[.-]* 2>/dev/null`
7822
potential_libs=`ls $i/$libnameglob[.-]* 2>/dev/null`
7824
for potent_lib in $potential_libs; do
7825
# Follow soft links.
7826
if ls -lLd "$potent_lib" 2>/dev/null |
7827
$GREP " -> " >/dev/null; then
7830
# The statement above tries to avoid entering an
7831
# endless loop below, in case of cyclic links.
7832
# We might still enter an endless loop, since a link
7833
# loop can be closed while we follow links,
7835
potlib="$potent_lib"
7836
while test -h "$potlib" 2>/dev/null; do
7837
potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'`
7839
[\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";;
7840
*) potlib=`$ECHO "$potlib" | $SED 's,[^/]*$,,'`"$potliblink";;
7843
if eval $file_magic_cmd \"\$potlib\" 2>/dev/null |
7845
$EGREP "$file_magic_regex" > /dev/null; then
7846
func_append newdeplibs " $a_deplib"
7853
if test -n "$a_deplib" ; then
7856
$ECHO "*** Warning: linker path does not have real file for library $a_deplib."
7857
echo "*** I have the capability to make that library automatically link in when"
7858
echo "*** you link to this library. But I can only do this if you have a"
7859
echo "*** shared version of the library, which you do not appear to have"
7860
echo "*** because I did check the linker path looking for a file starting"
7861
if test -z "$potlib" ; then
7862
$ECHO "*** with $libname but no candidates were found. (...for file magic test)"
7864
$ECHO "*** with $libname and none of the candidates passed a file format test"
7865
$ECHO "*** using a file magic. Last file checked: $potlib"
7870
# Add a -L argument.
7871
func_append newdeplibs " $a_deplib"
7874
done # Gone through all deplibs.
7877
set dummy $deplibs_check_method; shift
7878
match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
7879
for a_deplib in $deplibs; do
7882
func_stripname -l '' "$a_deplib"
7883
name=$func_stripname_result
7884
if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
7885
case " $predeps $postdeps " in
7887
func_append newdeplibs " $a_deplib"
7892
if test -n "$a_deplib" ; then
7893
libname=`eval "\\$ECHO \"$libname_spec\""`
7894
for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
7895
potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
7896
for potent_lib in $potential_libs; do
7897
potlib="$potent_lib" # see symlink-check above in file_magic test
7898
if eval "\$ECHO \"$potent_lib\"" 2>/dev/null | $SED 10q | \
7899
$EGREP "$match_pattern_regex" > /dev/null; then
7900
func_append newdeplibs " $a_deplib"
7907
if test -n "$a_deplib" ; then
7910
$ECHO "*** Warning: linker path does not have real file for library $a_deplib."
7911
echo "*** I have the capability to make that library automatically link in when"
7912
echo "*** you link to this library. But I can only do this if you have a"
7913
echo "*** shared version of the library, which you do not appear to have"
7914
echo "*** because I did check the linker path looking for a file starting"
7915
if test -z "$potlib" ; then
7916
$ECHO "*** with $libname but no candidates were found. (...for regex pattern test)"
7918
$ECHO "*** with $libname and none of the candidates passed a file format test"
7919
$ECHO "*** using a regex pattern. Last file checked: $potlib"
7924
# Add a -L argument.
7925
func_append newdeplibs " $a_deplib"
7928
done # Gone through all deplibs.
7932
tmp_deplibs=`$ECHO " $deplibs" | $SED 's/ -lc$//; s/ -[LR][^ ]*//g'`
7933
if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
7934
for i in $predeps $postdeps ; do
7935
# can't use Xsed below, because $i might contain '/'
7936
tmp_deplibs=`$ECHO " $tmp_deplibs" | $SED "s,$i,,"`
7939
case $tmp_deplibs in
7942
if test "X$deplibs_check_method" = "Xnone"; then
7943
echo "*** Warning: inter-library dependencies are not supported in this platform."
7945
echo "*** Warning: inter-library dependencies are not known to be supported."
7947
echo "*** All declared inter-library dependencies are being dropped."
7953
versuffix=$versuffix_save
7955
release=$release_save
7956
libname=$libname_save
7960
*-*-rhapsody* | *-*-darwin1.[012])
7961
# On Rhapsody replace the C library with the System framework
7962
newdeplibs=`$ECHO " $newdeplibs" | $SED 's/ -lc / System.ltframework /'`
7966
if test "$droppeddeps" = yes; then
7967
if test "$module" = yes; then
7969
echo "*** Warning: libtool could not satisfy all declared inter-library"
7970
$ECHO "*** dependencies of module $libname. Therefore, libtool will create"
7971
echo "*** a static module, that should work as long as the dlopening"
7972
echo "*** application is linked with the -dlopen flag."
7973
if test -z "$global_symbol_pipe"; then
7975
echo "*** However, this would only work if libtool was able to extract symbol"
7976
echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
7977
echo "*** not find such a program. So, this module is probably useless."
7978
echo "*** \`nm' from GNU binutils and a full rebuild may help."
7980
if test "$build_old_libs" = no; then
7981
oldlibs="$output_objdir/$libname.$libext"
7982
build_libtool_libs=module
7985
build_libtool_libs=no
7988
echo "*** The inter-library dependencies that have been dropped here will be"
7989
echo "*** automatically added whenever a program is linked with this library"
7990
echo "*** or is declared to -dlopen it."
7992
if test "$allow_undefined" = no; then
7994
echo "*** Since this library must not contain undefined symbols,"
7995
echo "*** because either the platform does not support them or"
7996
echo "*** it was explicitly requested with -no-undefined,"
7997
echo "*** libtool will only create a static version of it."
7998
if test "$build_old_libs" = no; then
7999
oldlibs="$output_objdir/$libname.$libext"
8000
build_libtool_libs=module
8003
build_libtool_libs=no
8008
# Done checking deplibs!
8011
# Time to change all our "foo.ltframework" stuff back to "-framework foo"
8014
newdeplibs=`$ECHO " $newdeplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
8015
new_inherited_linker_flags=`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
8016
deplibs=`$ECHO " $deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
8020
# move library search paths that coincide with paths to not yet
8021
# installed libraries to the beginning of the library search list
8023
for path in $notinst_path; do
8024
case " $new_libs " in
8025
*" -L$path/$objdir "*) ;;
8027
case " $deplibs " in
8028
*" -L$path/$objdir "*)
8029
func_append new_libs " -L$path/$objdir" ;;
8034
for deplib in $deplibs; do
8037
case " $new_libs " in
8039
*) func_append new_libs " $deplib" ;;
8042
*) func_append new_libs " $deplib" ;;
8047
# All the library-specific variables (install_libdir is set above).
8052
# Test again, we may have decided not to build it any more
8053
if test "$build_libtool_libs" = yes; then
8054
# Remove ${wl} instances when linking with ld.
8055
# FIXME: should test the right _cmds variable.
8056
case $archive_cmds in
8059
if test "$hardcode_into_libs" = yes; then
8060
# Hardcode the library paths
8063
rpath="$finalize_rpath"
8064
test "$opt_mode" != relink && rpath="$compile_rpath$rpath"
8065
for libdir in $rpath; do
8066
if test -n "$hardcode_libdir_flag_spec"; then
8067
if test -n "$hardcode_libdir_separator"; then
8068
func_replace_sysroot "$libdir"
8069
libdir=$func_replace_sysroot_result
8070
if test -z "$hardcode_libdirs"; then
8071
hardcode_libdirs="$libdir"
8073
# Just accumulate the unique libdirs.
8074
case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
8075
*"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
8078
func_append hardcode_libdirs "$hardcode_libdir_separator$libdir"
8083
eval flag=\"$hardcode_libdir_flag_spec\"
8084
func_append dep_rpath " $flag"
8086
elif test -n "$runpath_var"; then
8087
case "$perm_rpath " in
8089
*) func_append perm_rpath " $libdir" ;;
8093
# Substitute the hardcoded libdirs into the rpath.
8094
if test -n "$hardcode_libdir_separator" &&
8095
test -n "$hardcode_libdirs"; then
8096
libdir="$hardcode_libdirs"
8097
eval "dep_rpath=\"$hardcode_libdir_flag_spec\""
8099
if test -n "$runpath_var" && test -n "$perm_rpath"; then
8100
# We should set the runpath_var.
8102
for dir in $perm_rpath; do
8103
func_append rpath "$dir:"
8105
eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var"
8107
test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs"
8110
shlibpath="$finalize_shlibpath"
8111
test "$opt_mode" != relink && shlibpath="$compile_shlibpath$shlibpath"
8112
if test -n "$shlibpath"; then
8113
eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var"
8116
# Get the real and link names of the library.
8117
eval shared_ext=\"$shrext_cmds\"
8118
eval library_names=\"$library_names_spec\"
8119
set dummy $library_names
8124
if test -n "$soname_spec"; then
8125
eval soname=\"$soname_spec\"
8129
if test -z "$dlname"; then
8133
lib="$output_objdir/$realname"
8137
func_append linknames " $link"
8140
# Use standard objects if they are pic
8141
test -z "$pic_flag" && libobjs=`$ECHO "$libobjs" | $SP2NL | $SED "$lo2o" | $NL2SP`
8142
test "X$libobjs" = "X " && libobjs=
8145
if test -n "$export_symbols" && test -n "$include_expsyms"; then
8146
$opt_dry_run || cp "$export_symbols" "$output_objdir/$libname.uexp"
8147
export_symbols="$output_objdir/$libname.uexp"
8148
func_append delfiles " $export_symbols"
8151
orig_export_symbols=
8153
cygwin* | mingw* | cegcc*)
8154
if test -n "$export_symbols" && test -z "$export_symbols_regex"; then
8155
# exporting using user supplied symfile
8156
if test "x`$SED 1q $export_symbols`" != xEXPORTS; then
8157
# and it's NOT already a .def file. Must figure out
8158
# which of the given symbols are data symbols and tag
8159
# them as such. So, trigger use of export_symbols_cmds.
8160
# export_symbols gets reassigned inside the "prepare
8161
# the list of exported symbols" if statement, so the
8162
# include_expsyms logic still works.
8163
orig_export_symbols="$export_symbols"
8165
always_export_symbols=yes
8171
# Prepare the list of exported symbols
8172
if test -z "$export_symbols"; then
8173
if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then
8174
func_verbose "generating symbol list for \`$libname.la'"
8175
export_symbols="$output_objdir/$libname.exp"
8176
$opt_dry_run || $RM $export_symbols
8177
cmds=$export_symbols_cmds
8178
save_ifs="$IFS"; IFS='~'
8179
for cmd1 in $cmds; do
8181
# Take the normal branch if the nm_file_list_spec branch
8182
# doesn't work or if tool conversion is not needed.
8183
case $nm_file_list_spec~$to_tool_file_cmd in
8184
*~func_convert_file_noop | *~func_convert_file_msys_to_w32 | ~*)
8185
try_normal_branch=yes
8188
len=$func_len_result
8191
try_normal_branch=no
8194
if test "$try_normal_branch" = yes \
8195
&& { test "$len" -lt "$max_cmd_len" \
8196
|| test "$max_cmd_len" -le -1; }
8198
func_show_eval "$cmd" 'exit $?'
8199
skipped_export=false
8200
elif test -n "$nm_file_list_spec"; then
8201
func_basename "$output"
8202
output_la=$func_basename_result
8203
save_libobjs=$libobjs
8205
output=${output_objdir}/${output_la}.nm
8206
func_to_tool_file "$output"
8207
libobjs=$nm_file_list_spec$func_to_tool_file_result
8208
func_append delfiles " $output"
8209
func_verbose "creating $NM input file list: $output"
8210
for obj in $save_libobjs; do
8211
func_to_tool_file "$obj"
8212
$ECHO "$func_to_tool_file_result"
8215
func_show_eval "$cmd" 'exit $?'
8217
libobjs=$save_libobjs
8218
skipped_export=false
8220
# The command line is too long to execute in one step.
8221
func_verbose "using reloadable object file for export list..."
8223
# Break out early, otherwise skipped_export may be
8224
# set to false by a later but shorter cmd.
8229
if test -n "$export_symbols_regex" && test "X$skipped_export" != "X:"; then
8230
func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
8231
func_show_eval '$MV "${export_symbols}T" "$export_symbols"'
8236
if test -n "$export_symbols" && test -n "$include_expsyms"; then
8237
tmp_export_symbols="$export_symbols"
8238
test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols"
8239
$opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"'
8242
if test "X$skipped_export" != "X:" && test -n "$orig_export_symbols"; then
8243
# The given exports_symbols file has to be filtered, so filter it.
8244
func_verbose "filter symbol list for \`$libname.la' to tag DATA exports"
8245
# FIXME: $output_objdir/$libname.filter potentially contains lots of
8246
# 's' commands which not all seds can handle. GNU sed should be fine
8247
# though. Also, the filter scales superlinearly with the number of
8248
# global variables. join(1) would be nice here, but unfortunately
8249
# isn't a blessed tool.
8250
$opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter
8251
func_append delfiles " $export_symbols $output_objdir/$libname.filter"
8252
export_symbols=$output_objdir/$libname.def
8253
$opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols
8257
for test_deplib in $deplibs; do
8258
case " $convenience " in
8259
*" $test_deplib "*) ;;
8261
func_append tmp_deplibs " $test_deplib"
8265
deplibs="$tmp_deplibs"
8267
if test -n "$convenience"; then
8268
if test -n "$whole_archive_flag_spec" &&
8269
test "$compiler_needs_object" = yes &&
8270
test -z "$libobjs"; then
8271
# extract the archives, so we have objects to list.
8272
# TODO: could optimize this to just extract one archive.
8273
whole_archive_flag_spec=
8275
if test -n "$whole_archive_flag_spec"; then
8276
save_libobjs=$libobjs
8277
eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
8278
test "X$libobjs" = "X " && libobjs=
8280
gentop="$output_objdir/${outputname}x"
8281
func_append generated " $gentop"
8283
func_extract_archives $gentop $convenience
8284
func_append libobjs " $func_extract_archives_result"
8285
test "X$libobjs" = "X " && libobjs=
8289
if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then
8290
eval flag=\"$thread_safe_flag_spec\"
8291
func_append linker_flags " $flag"
8294
# Make a backup of the uninstalled library when relinking
8295
if test "$opt_mode" = relink; then
8296
$opt_dry_run || eval '(cd $output_objdir && $RM ${realname}U && $MV $realname ${realname}U)' || exit $?
8299
# Do each of the archive commands.
8300
if test "$module" = yes && test -n "$module_cmds" ; then
8301
if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
8302
eval test_cmds=\"$module_expsym_cmds\"
8303
cmds=$module_expsym_cmds
8305
eval test_cmds=\"$module_cmds\"
8309
if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
8310
eval test_cmds=\"$archive_expsym_cmds\"
8311
cmds=$archive_expsym_cmds
8313
eval test_cmds=\"$archive_cmds\"
8318
if test "X$skipped_export" != "X:" &&
8319
func_len " $test_cmds" &&
8320
len=$func_len_result &&
8321
test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then
8324
# The command line is too long to link in one step, link piecewise
8325
# or, if using GNU ld and skipped_export is not :, use a linker
8328
# Save the value of $output and $libobjs because we want to
8329
# use them later. If we have whole_archive_flag_spec, we
8330
# want to use save_libobjs as it was before
8331
# whole_archive_flag_spec was expanded, because we can't
8332
# assume the linker understands whole_archive_flag_spec.
8333
# This may have to be revisited, in case too many
8334
# convenience libraries get linked in and end up exceeding
8336
if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then
8337
save_libobjs=$libobjs
8340
func_basename "$output"
8341
output_la=$func_basename_result
8343
# Clear the reloadable object creation command queue and
8344
# initialize k to one.
8351
if test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "$with_gnu_ld" = yes; then
8352
output=${output_objdir}/${output_la}.lnkscript
8353
func_verbose "creating GNU ld script: $output"
8354
echo 'INPUT (' > $output
8355
for obj in $save_libobjs
8357
func_to_tool_file "$obj"
8358
$ECHO "$func_to_tool_file_result" >> $output
8361
func_append delfiles " $output"
8362
func_to_tool_file "$output"
8363
output=$func_to_tool_file_result
8364
elif test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "X$file_list_spec" != X; then
8365
output=${output_objdir}/${output_la}.lnk
8366
func_verbose "creating linker input file list: $output"
8371
if test "$compiler_needs_object" = yes; then
8377
func_to_tool_file "$obj"
8378
$ECHO "$func_to_tool_file_result" >> $output
8380
func_append delfiles " $output"
8381
func_to_tool_file "$output"
8382
output=$firstobj\"$file_list_spec$func_to_tool_file_result\"
8384
if test -n "$save_libobjs"; then
8385
func_verbose "creating reloadable object files..."
8386
output=$output_objdir/$output_la-${k}.$objext
8387
eval test_cmds=\"$reload_cmds\"
8388
func_len " $test_cmds"
8389
len0=$func_len_result
8392
# Loop over the list of objects to be linked.
8393
for obj in $save_libobjs
8396
func_arith $len + $func_len_result
8397
len=$func_arith_result
8398
if test "X$objlist" = X ||
8399
test "$len" -lt "$max_cmd_len"; then
8400
func_append objlist " $obj"
8402
# The command $test_cmds is almost too long, add a
8403
# command to the queue.
8404
if test "$k" -eq 1 ; then
8405
# The first file doesn't have a previous command to add.
8406
reload_objs=$objlist
8407
eval concat_cmds=\"$reload_cmds\"
8409
# All subsequent reloadable object files will link in
8410
# the last one created.
8411
reload_objs="$objlist $last_robj"
8412
eval concat_cmds=\"\$concat_cmds~$reload_cmds~\$RM $last_robj\"
8414
last_robj=$output_objdir/$output_la-${k}.$objext
8416
k=$func_arith_result
8417
output=$output_objdir/$output_la-${k}.$objext
8419
func_len " $last_robj"
8420
func_arith $len0 + $func_len_result
8421
len=$func_arith_result
8424
# Handle the remaining objects by creating one last
8425
# reloadable object file. All subsequent reloadable object
8426
# files will link in the last one created.
8427
test -z "$concat_cmds" || concat_cmds=$concat_cmds~
8428
reload_objs="$objlist $last_robj"
8429
eval concat_cmds=\"\${concat_cmds}$reload_cmds\"
8430
if test -n "$last_robj"; then
8431
eval concat_cmds=\"\${concat_cmds}~\$RM $last_robj\"
8433
func_append delfiles " $output"
8439
if ${skipped_export-false}; then
8440
func_verbose "generating symbol list for \`$libname.la'"
8441
export_symbols="$output_objdir/$libname.exp"
8442
$opt_dry_run || $RM $export_symbols
8444
# Append the command to create the export file.
8445
test -z "$concat_cmds" || concat_cmds=$concat_cmds~
8446
eval concat_cmds=\"\$concat_cmds$export_symbols_cmds\"
8447
if test -n "$last_robj"; then
8448
eval concat_cmds=\"\$concat_cmds~\$RM $last_robj\"
8452
test -n "$save_libobjs" &&
8453
func_verbose "creating a temporary reloadable object file: $output"
8455
# Loop through the commands generated above and execute them.
8456
save_ifs="$IFS"; IFS='~'
8457
for cmd in $concat_cmds; do
8460
func_quote_for_expand "$cmd"
8461
eval "func_echo $func_quote_for_expand_result"
8463
$opt_dry_run || eval "$cmd" || {
8466
# Restore the uninstalled library and exit
8467
if test "$opt_mode" = relink; then
8468
( cd "$output_objdir" && \
8469
$RM "${realname}T" && \
8470
$MV "${realname}U" "$realname" )
8478
if test -n "$export_symbols_regex" && ${skipped_export-false}; then
8479
func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
8480
func_show_eval '$MV "${export_symbols}T" "$export_symbols"'
8484
if ${skipped_export-false}; then
8485
if test -n "$export_symbols" && test -n "$include_expsyms"; then
8486
tmp_export_symbols="$export_symbols"
8487
test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols"
8488
$opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"'
8491
if test -n "$orig_export_symbols"; then
8492
# The given exports_symbols file has to be filtered, so filter it.
8493
func_verbose "filter symbol list for \`$libname.la' to tag DATA exports"
8494
# FIXME: $output_objdir/$libname.filter potentially contains lots of
8495
# 's' commands which not all seds can handle. GNU sed should be fine
8496
# though. Also, the filter scales superlinearly with the number of
8497
# global variables. join(1) would be nice here, but unfortunately
8498
# isn't a blessed tool.
8499
$opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter
8500
func_append delfiles " $export_symbols $output_objdir/$libname.filter"
8501
export_symbols=$output_objdir/$libname.def
8502
$opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols
8507
# Restore the value of output.
8510
if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then
8511
eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
8512
test "X$libobjs" = "X " && libobjs=
8514
# Expand the library linking commands again to reset the
8515
# value of $libobjs for piecewise linking.
8517
# Do each of the archive commands.
8518
if test "$module" = yes && test -n "$module_cmds" ; then
8519
if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
8520
cmds=$module_expsym_cmds
8525
if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
8526
cmds=$archive_expsym_cmds
8533
if test -n "$delfiles"; then
8534
# Append the command to remove temporary files to $cmds.
8535
eval cmds=\"\$cmds~\$RM $delfiles\"
8538
# Add any objects from preloaded convenience libraries
8539
if test -n "$dlprefiles"; then
8540
gentop="$output_objdir/${outputname}x"
8541
func_append generated " $gentop"
8543
func_extract_archives $gentop $dlprefiles
8544
func_append libobjs " $func_extract_archives_result"
8545
test "X$libobjs" = "X " && libobjs=
8548
save_ifs="$IFS"; IFS='~'
8549
for cmd in $cmds; do
8553
func_quote_for_expand "$cmd"
8554
eval "func_echo $func_quote_for_expand_result"
8556
$opt_dry_run || eval "$cmd" || {
8559
# Restore the uninstalled library and exit
8560
if test "$opt_mode" = relink; then
8561
( cd "$output_objdir" && \
8562
$RM "${realname}T" && \
8563
$MV "${realname}U" "$realname" )
8571
# Restore the uninstalled library and exit
8572
if test "$opt_mode" = relink; then
8573
$opt_dry_run || eval '(cd $output_objdir && $RM ${realname}T && $MV $realname ${realname}T && $MV ${realname}U $realname)' || exit $?
8575
if test -n "$convenience"; then
8576
if test -z "$whole_archive_flag_spec"; then
8577
func_show_eval '${RM}r "$gentop"'
8584
# Create links to the real library.
8585
for linkname in $linknames; do
8586
if test "$realname" != "$linkname"; then
8587
func_show_eval '(cd "$output_objdir" && $RM "$linkname" && $LN_S "$realname" "$linkname")' 'exit $?'
8591
# If -module or -export-dynamic was specified, set the dlname.
8592
if test "$module" = yes || test "$export_dynamic" = yes; then
8593
# On all known operating systems, these are identical.
8600
if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
8601
func_warning "\`-dlopen' is ignored for objects"
8606
func_warning "\`-l' and \`-L' are ignored for objects" ;;
8609
test -n "$rpath" && \
8610
func_warning "\`-rpath' is ignored for objects"
8612
test -n "$xrpath" && \
8613
func_warning "\`-R' is ignored for objects"
8615
test -n "$vinfo" && \
8616
func_warning "\`-version-info' is ignored for objects"
8618
test -n "$release" && \
8619
func_warning "\`-release' is ignored for objects"
8623
test -n "$objs$old_deplibs" && \
8624
func_fatal_error "cannot build library object \`$output' from non-libtool objects"
8628
obj=$func_lo2o_result
8636
# Delete the old objects.
8637
$opt_dry_run || $RM $obj $libobj
8639
# Objects from convenience libraries. This assumes
8640
# single-version convenience libraries. Whenever we create
8641
# different ones for PIC/non-PIC, this we'll have to duplicate
8645
# reload_cmds runs $LD directly, so let us get rid of
8646
# -Wl from whole_archive_flag_spec and hope we can get by with
8647
# turning comma into space..
8650
if test -n "$convenience"; then
8651
if test -n "$whole_archive_flag_spec"; then
8652
eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\"
8653
reload_conv_objs=$reload_objs\ `$ECHO "$tmp_whole_archive_flags" | $SED 's|,| |g'`
8655
gentop="$output_objdir/${obj}x"
8656
func_append generated " $gentop"
8658
func_extract_archives $gentop $convenience
8659
reload_conv_objs="$reload_objs $func_extract_archives_result"
8663
# If we're not building shared, we need to use non_pic_objs
8664
test "$build_libtool_libs" != yes && libobjs="$non_pic_objects"
8666
# Create the old-style object.
8667
reload_objs="$objs$old_deplibs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.${libext}$/d; /\.lib$/d; $lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test
8670
func_execute_cmds "$reload_cmds" 'exit $?'
8672
# Exit if we aren't doing a library object file.
8673
if test -z "$libobj"; then
8674
if test -n "$gentop"; then
8675
func_show_eval '${RM}r "$gentop"'
8681
if test "$build_libtool_libs" != yes; then
8682
if test -n "$gentop"; then
8683
func_show_eval '${RM}r "$gentop"'
8686
# Create an invalid libtool object if no PIC, so that we don't
8687
# accidentally link it into a program.
8688
# $show "echo timestamp > $libobj"
8689
# $opt_dry_run || eval "echo timestamp > $libobj" || exit $?
8693
if test -n "$pic_flag" || test "$pic_mode" != default; then
8694
# Only do commands if we really have different PIC objects.
8695
reload_objs="$libobjs $reload_conv_objs"
8697
func_execute_cmds "$reload_cmds" 'exit $?'
8700
if test -n "$gentop"; then
8701
func_show_eval '${RM}r "$gentop"'
8709
*cygwin*) func_stripname '' '.exe' "$output"
8710
output=$func_stripname_result.exe;;
8712
test -n "$vinfo" && \
8713
func_warning "\`-version-info' is ignored for programs"
8715
test -n "$release" && \
8716
func_warning "\`-release' is ignored for programs"
8718
test "$preload" = yes \
8719
&& test "$dlopen_support" = unknown \
8720
&& test "$dlopen_self" = unknown \
8721
&& test "$dlopen_self_static" = unknown && \
8722
func_warning "\`LT_INIT([dlopen])' not used. Assuming no dlopen support."
8725
*-*-rhapsody* | *-*-darwin1.[012])
8726
# On Rhapsody replace the C library is the System framework
8727
compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's/ -lc / System.ltframework /'`
8728
finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's/ -lc / System.ltframework /'`
8734
# Don't allow lazy linking, it breaks C++ global constructors
8735
# But is supposedly fixed on 10.4 or later (yay!).
8736
if test "$tagname" = CXX ; then
8737
case ${MACOSX_DEPLOYMENT_TARGET-10.0} in
8739
func_append compile_command " ${wl}-bind_at_load"
8740
func_append finalize_command " ${wl}-bind_at_load"
8744
# Time to change all our "foo.ltframework" stuff back to "-framework foo"
8745
compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
8746
finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
8751
# move library search paths that coincide with paths to not yet
8752
# installed libraries to the beginning of the library search list
8754
for path in $notinst_path; do
8755
case " $new_libs " in
8756
*" -L$path/$objdir "*) ;;
8758
case " $compile_deplibs " in
8759
*" -L$path/$objdir "*)
8760
func_append new_libs " -L$path/$objdir" ;;
8765
for deplib in $compile_deplibs; do
8768
case " $new_libs " in
8770
*) func_append new_libs " $deplib" ;;
8773
*) func_append new_libs " $deplib" ;;
8776
compile_deplibs="$new_libs"
8779
func_append compile_command " $compile_deplibs"
8780
func_append finalize_command " $finalize_deplibs"
8782
if test -n "$rpath$xrpath"; then
8783
# If the user specified any rpath flags, then add them.
8784
for libdir in $rpath $xrpath; do
8785
# This is the magic to use -rpath.
8786
case "$finalize_rpath " in
8788
*) func_append finalize_rpath " $libdir" ;;
8793
# Now hardcode the library paths
8796
for libdir in $compile_rpath $finalize_rpath; do
8797
if test -n "$hardcode_libdir_flag_spec"; then
8798
if test -n "$hardcode_libdir_separator"; then
8799
if test -z "$hardcode_libdirs"; then
8800
hardcode_libdirs="$libdir"
8802
# Just accumulate the unique libdirs.
8803
case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
8804
*"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
8807
func_append hardcode_libdirs "$hardcode_libdir_separator$libdir"
8812
eval flag=\"$hardcode_libdir_flag_spec\"
8813
func_append rpath " $flag"
8815
elif test -n "$runpath_var"; then
8816
case "$perm_rpath " in
8818
*) func_append perm_rpath " $libdir" ;;
8822
*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
8823
testbindir=`${ECHO} "$libdir" | ${SED} -e 's*/lib$*/bin*'`
8824
case :$dllsearchpath: in
8826
::) dllsearchpath=$libdir;;
8827
*) func_append dllsearchpath ":$libdir";;
8829
case :$dllsearchpath: in
8830
*":$testbindir:"*) ;;
8831
::) dllsearchpath=$testbindir;;
8832
*) func_append dllsearchpath ":$testbindir";;
8837
# Substitute the hardcoded libdirs into the rpath.
8838
if test -n "$hardcode_libdir_separator" &&
8839
test -n "$hardcode_libdirs"; then
8840
libdir="$hardcode_libdirs"
8841
eval rpath=\" $hardcode_libdir_flag_spec\"
8843
compile_rpath="$rpath"
8847
for libdir in $finalize_rpath; do
8848
if test -n "$hardcode_libdir_flag_spec"; then
8849
if test -n "$hardcode_libdir_separator"; then
8850
if test -z "$hardcode_libdirs"; then
8851
hardcode_libdirs="$libdir"
8853
# Just accumulate the unique libdirs.
8854
case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
8855
*"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
8858
func_append hardcode_libdirs "$hardcode_libdir_separator$libdir"
8863
eval flag=\"$hardcode_libdir_flag_spec\"
8864
func_append rpath " $flag"
8866
elif test -n "$runpath_var"; then
8867
case "$finalize_perm_rpath " in
8869
*) func_append finalize_perm_rpath " $libdir" ;;
8873
# Substitute the hardcoded libdirs into the rpath.
8874
if test -n "$hardcode_libdir_separator" &&
8875
test -n "$hardcode_libdirs"; then
8876
libdir="$hardcode_libdirs"
8877
eval rpath=\" $hardcode_libdir_flag_spec\"
8879
finalize_rpath="$rpath"
8881
if test -n "$libobjs" && test "$build_old_libs" = yes; then
8882
# Transform all the library objects into standard objects.
8883
compile_command=`$ECHO "$compile_command" | $SP2NL | $SED "$lo2o" | $NL2SP`
8884
finalize_command=`$ECHO "$finalize_command" | $SP2NL | $SED "$lo2o" | $NL2SP`
8887
func_generate_dlsyms "$outputname" "@PROGRAM@" "no"
8889
# template prelinking step
8890
if test -n "$prelink_cmds"; then
8891
func_execute_cmds "$prelink_cmds" 'exit $?'
8894
wrappers_required=yes
8896
*cegcc* | *mingw32ce*)
8897
# Disable wrappers for cegcc and mingw32ce hosts, we are cross compiling anyway.
8898
wrappers_required=no
8900
*cygwin* | *mingw* )
8901
if test "$build_libtool_libs" != yes; then
8902
wrappers_required=no
8906
if test "$need_relink" = no || test "$build_libtool_libs" != yes; then
8907
wrappers_required=no
8911
if test "$wrappers_required" = no; then
8912
# Replace the output file specification.
8913
compile_command=`$ECHO "$compile_command" | $SED 's%@OUTPUT@%'"$output"'%g'`
8914
link_command="$compile_command$compile_rpath"
8916
# We have no uninstalled library dependencies, so finalize right now.
8918
func_show_eval "$link_command" 'exit_status=$?'
8920
if test -n "$postlink_cmds"; then
8921
func_to_tool_file "$output"
8922
postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'`
8923
func_execute_cmds "$postlink_cmds" 'exit $?'
8926
# Delete the generated files.
8927
if test -f "$output_objdir/${outputname}S.${objext}"; then
8928
func_show_eval '$RM "$output_objdir/${outputname}S.${objext}"'
8934
if test -n "$compile_shlibpath$finalize_shlibpath"; then
8935
compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command"
8937
if test -n "$finalize_shlibpath"; then
8938
finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command"
8943
if test -n "$runpath_var"; then
8944
if test -n "$perm_rpath"; then
8945
# We should set the runpath_var.
8947
for dir in $perm_rpath; do
8948
func_append rpath "$dir:"
8950
compile_var="$runpath_var=\"$rpath\$$runpath_var\" "
8952
if test -n "$finalize_perm_rpath"; then
8953
# We should set the runpath_var.
8955
for dir in $finalize_perm_rpath; do
8956
func_append rpath "$dir:"
8958
finalize_var="$runpath_var=\"$rpath\$$runpath_var\" "
8962
if test "$no_install" = yes; then
8963
# We don't need to create a wrapper script.
8964
link_command="$compile_var$compile_command$compile_rpath"
8965
# Replace the output file specification.
8966
link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output"'%g'`
8967
# Delete the old output file.
8968
$opt_dry_run || $RM $output
8969
# Link the executable and exit
8970
func_show_eval "$link_command" 'exit $?'
8972
if test -n "$postlink_cmds"; then
8973
func_to_tool_file "$output"
8974
postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'`
8975
func_execute_cmds "$postlink_cmds" 'exit $?'
8981
if test "$hardcode_action" = relink; then
8982
# Fast installation is not supported
8983
link_command="$compile_var$compile_command$compile_rpath"
8984
relink_command="$finalize_var$finalize_command$finalize_rpath"
8986
func_warning "this platform does not like uninstalled shared libraries"
8987
func_warning "\`$output' will be relinked during installation"
8989
if test "$fast_install" != no; then
8990
link_command="$finalize_var$compile_command$finalize_rpath"
8991
if test "$fast_install" = yes; then
8992
relink_command=`$ECHO "$compile_var$compile_command$compile_rpath" | $SED 's%@OUTPUT@%\$progdir/\$file%g'`
8994
# fast_install is set to needless
8998
link_command="$compile_var$compile_command$compile_rpath"
8999
relink_command="$finalize_var$finalize_command$finalize_rpath"
9003
# Replace the output file specification.
9004
link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`
9006
# Delete the old output files.
9007
$opt_dry_run || $RM $output $output_objdir/$outputname $output_objdir/lt-$outputname
9009
func_show_eval "$link_command" 'exit $?'
9011
if test -n "$postlink_cmds"; then
9012
func_to_tool_file "$output_objdir/$outputname"
9013
postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'`
9014
func_execute_cmds "$postlink_cmds" 'exit $?'
9017
# Now create the wrapper script.
9018
func_verbose "creating $output"
9020
# Quote the relink command for shipping.
9021
if test -n "$relink_command"; then
9022
# Preserve any variables that may affect compiler behavior
9023
for var in $variables_saved_for_relink; do
9024
if eval test -z \"\${$var+set}\"; then
9025
relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command"
9026
elif eval var_value=\$$var; test -z "$var_value"; then
9027
relink_command="$var=; export $var; $relink_command"
9029
func_quote_for_eval "$var_value"
9030
relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command"
9033
relink_command="(cd `pwd`; $relink_command)"
9034
relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"`
9037
# Only actually do things if not in dry run mode.
9039
# win32 will think the script is a binary if it has
9040
# a .exe suffix, so we strip it off here.
9042
*.exe) func_stripname '' '.exe' "$output"
9043
output=$func_stripname_result ;;
9045
# test for cygwin because mv fails w/o .exe extensions
9049
func_stripname '' '.exe' "$outputname"
9050
outputname=$func_stripname_result ;;
9054
*cygwin* | *mingw* )
9055
func_dirname_and_basename "$output" "" "."
9056
output_name=$func_basename_result
9057
output_path=$func_dirname_result
9058
cwrappersource="$output_path/$objdir/lt-$output_name.c"
9059
cwrapper="$output_path/$output_name.exe"
9060
$RM $cwrappersource $cwrapper
9061
trap "$RM $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15
9063
func_emit_cwrapperexe_src > $cwrappersource
9065
# The wrapper executable is built using the $host compiler,
9066
# because it contains $host paths and files. If cross-
9067
# compiling, it, like the target executable, must be
9068
# executed on the $host or under an emulation environment.
9070
$LTCC $LTCFLAGS -o $cwrapper $cwrappersource
9074
# Now, create the wrapper script for func_source use:
9075
func_ltwrapper_scriptname $cwrapper
9076
$RM $func_ltwrapper_scriptname_result
9077
trap "$RM $func_ltwrapper_scriptname_result; exit $EXIT_FAILURE" 1 2 15
9079
# note: this script will not be executed, so do not chmod.
9080
if test "x$build" = "x$host" ; then
9081
$cwrapper --lt-dump-script > $func_ltwrapper_scriptname_result
9083
func_emit_wrapper no > $func_ltwrapper_scriptname_result
9089
trap "$RM $output; exit $EXIT_FAILURE" 1 2 15
9091
func_emit_wrapper no > $output
9100
# See if we need to build an old-fashioned archive.
9101
for oldlib in $oldlibs; do
9103
if test "$build_libtool_libs" = convenience; then
9104
oldobjs="$libobjs_save $symfileobj"
9105
addlibs="$convenience"
9106
build_libtool_libs=no
9108
if test "$build_libtool_libs" = module; then
9109
oldobjs="$libobjs_save"
9110
build_libtool_libs=no
9112
oldobjs="$old_deplibs $non_pic_objects"
9113
if test "$preload" = yes && test -f "$symfileobj"; then
9114
func_append oldobjs " $symfileobj"
9117
addlibs="$old_convenience"
9120
if test -n "$addlibs"; then
9121
gentop="$output_objdir/${outputname}x"
9122
func_append generated " $gentop"
9124
func_extract_archives $gentop $addlibs
9125
func_append oldobjs " $func_extract_archives_result"
9128
# Do each command in the archive commands.
9129
if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then
9130
cmds=$old_archive_from_new_cmds
9133
# Add any objects from preloaded convenience libraries
9134
if test -n "$dlprefiles"; then
9135
gentop="$output_objdir/${outputname}x"
9136
func_append generated " $gentop"
9138
func_extract_archives $gentop $dlprefiles
9139
func_append oldobjs " $func_extract_archives_result"
9142
# POSIX demands no paths to be encoded in archives. We have
9143
# to avoid creating archives with duplicate basenames if we
9144
# might have to extract them afterwards, e.g., when creating a
9145
# static archive out of a convenience library, or when linking
9146
# the entirety of a libtool archive into another (currently
9147
# not supported by libtool).
9148
if (for obj in $oldobjs
9150
func_basename "$obj"
9151
$ECHO "$func_basename_result"
9152
done | sort | sort -uc >/dev/null 2>&1); then
9155
echo "copying selected object files to avoid basename conflicts..."
9156
gentop="$output_objdir/${outputname}x"
9157
func_append generated " $gentop"
9158
func_mkdir_p "$gentop"
9159
save_oldobjs=$oldobjs
9162
for obj in $save_oldobjs
9164
func_basename "$obj"
9165
objbase="$func_basename_result"
9166
case " $oldobjs " in
9167
" ") oldobjs=$obj ;;
9170
# Make sure we don't pick an alternate name that also
9172
newobj=lt$counter-$objbase
9173
func_arith $counter + 1
9174
counter=$func_arith_result
9175
case " $oldobjs " in
9176
*[\ /]"$newobj "*) ;;
9177
*) if test ! -f "$gentop/$newobj"; then break; fi ;;
9180
func_show_eval "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj"
9181
func_append oldobjs " $gentop/$newobj"
9183
*) func_append oldobjs " $obj" ;;
9187
func_to_tool_file "$oldlib" func_convert_file_msys_to_w32
9188
tool_oldlib=$func_to_tool_file_result
9189
eval cmds=\"$old_archive_cmds\"
9192
len=$func_len_result
9193
if test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then
9194
cmds=$old_archive_cmds
9195
elif test -n "$archiver_list_spec"; then
9196
func_verbose "using command file archive linking..."
9199
func_to_tool_file "$obj"
9200
$ECHO "$func_to_tool_file_result"
9201
done > $output_objdir/$libname.libcmd
9202
func_to_tool_file "$output_objdir/$libname.libcmd"
9203
oldobjs=" $archiver_list_spec$func_to_tool_file_result"
9204
cmds=$old_archive_cmds
9206
# the command line is too long to link in one step, link in parts
9207
func_verbose "using piecewise archive linking..."
9212
save_oldobjs=$oldobjs
9214
# Is there a better way of finding the last object in the list?
9215
for obj in $save_oldobjs
9219
eval test_cmds=\"$old_archive_cmds\"
9220
func_len " $test_cmds"
9221
len0=$func_len_result
9223
for obj in $save_oldobjs
9226
func_arith $len + $func_len_result
9227
len=$func_arith_result
9228
func_append objlist " $obj"
9229
if test "$len" -lt "$max_cmd_len"; then
9232
# the above command should be used before it gets too long
9234
if test "$obj" = "$last_oldobj" ; then
9237
test -z "$concat_cmds" || concat_cmds=$concat_cmds~
9238
eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\"
9245
if test "X$oldobjs" = "X" ; then
9246
eval cmds=\"\$concat_cmds\"
9248
eval cmds=\"\$concat_cmds~\$old_archive_cmds\"
9252
func_execute_cmds "$cmds" 'exit $?'
9255
test -n "$generated" && \
9256
func_show_eval "${RM}r$generated"
9258
# Now create the libtool archive.
9262
test "$build_old_libs" = yes && old_library="$libname.$libext"
9263
func_verbose "creating $output"
9265
# Preserve any variables that may affect compiler behavior
9266
for var in $variables_saved_for_relink; do
9267
if eval test -z \"\${$var+set}\"; then
9268
relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command"
9269
elif eval var_value=\$$var; test -z "$var_value"; then
9270
relink_command="$var=; export $var; $relink_command"
9272
func_quote_for_eval "$var_value"
9273
relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command"
9276
# Quote the link command for shipping.
9277
relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)"
9278
relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"`
9279
if test "$hardcode_automatic" = yes ; then
9283
# Only create the output if not a dry run.
9285
for installed in no yes; do
9286
if test "$installed" = yes; then
9287
if test -z "$install_libdir"; then
9290
output="$output_objdir/$outputname"i
9291
# Replace all uninstalled libtool libraries with the installed ones
9293
for deplib in $dependency_libs; do
9296
func_basename "$deplib"
9297
name="$func_basename_result"
9298
func_resolve_sysroot "$deplib"
9299
eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $func_resolve_sysroot_result`
9300
test -z "$libdir" && \
9301
func_fatal_error "\`$deplib' is not a valid libtool archive"
9302
func_append newdependency_libs " ${lt_sysroot:+=}$libdir/$name"
9305
func_stripname -L '' "$deplib"
9306
func_replace_sysroot "$func_stripname_result"
9307
func_append newdependency_libs " -L$func_replace_sysroot_result"
9310
func_stripname -R '' "$deplib"
9311
func_replace_sysroot "$func_stripname_result"
9312
func_append newdependency_libs " -R$func_replace_sysroot_result"
9314
*) func_append newdependency_libs " $deplib" ;;
9317
dependency_libs="$newdependency_libs"
9320
for lib in $dlfiles; do
9323
func_basename "$lib"
9324
name="$func_basename_result"
9325
eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
9326
test -z "$libdir" && \
9327
func_fatal_error "\`$lib' is not a valid libtool archive"
9328
func_append newdlfiles " ${lt_sysroot:+=}$libdir/$name"
9330
*) func_append newdlfiles " $lib" ;;
9333
dlfiles="$newdlfiles"
9335
for lib in $dlprefiles; do
9338
# Only pass preopened files to the pseudo-archive (for
9339
# eventual linking with the app. that links it) if we
9340
# didn't already link the preopened objects directly into
9342
func_basename "$lib"
9343
name="$func_basename_result"
9344
eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
9345
test -z "$libdir" && \
9346
func_fatal_error "\`$lib' is not a valid libtool archive"
9347
func_append newdlprefiles " ${lt_sysroot:+=}$libdir/$name"
9351
dlprefiles="$newdlprefiles"
9354
for lib in $dlfiles; do
9356
[\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
9357
*) abs=`pwd`"/$lib" ;;
9359
func_append newdlfiles " $abs"
9361
dlfiles="$newdlfiles"
9363
for lib in $dlprefiles; do
9365
[\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
9366
*) abs=`pwd`"/$lib" ;;
9368
func_append newdlprefiles " $abs"
9370
dlprefiles="$newdlprefiles"
9373
# place dlname in correct position for cygwin
9374
# In fact, it would be nice if we could use this code for all target
9375
# systems that can't hard-code library paths into their executables
9376
# and that have no shared library path variable independent of PATH,
9377
# but it turns out we can't easily determine that from inspecting
9378
# libtool variables, so we have to hard-code the OSs to which it
9379
# applies here; at the moment, that means platforms that use the PE
9380
# object format with DLL files. See the long comment at the top of
9381
# tests/bindir.at for full details.
9383
case $host,$output,$installed,$module,$dlname in
9384
*cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll | *cegcc*,*lai,yes,no,*.dll)
9385
# If a -bindir argument was supplied, place the dll there.
9386
if test "x$bindir" != x ;
9388
func_relative_path "$install_libdir" "$bindir"
9389
tdlname=$func_relative_path_result$dlname
9391
# Otherwise fall back on heuristic.
9392
tdlname=../bin/$dlname
9397
# $outputname - a libtool library file
9398
# Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
9400
# Please DO NOT delete this file!
9401
# It is necessary for linking the library.
9403
# The name that we can dlopen(3).
9406
# Names of this library.
9407
library_names='$library_names'
9409
# The name of the static archive.
9410
old_library='$old_library'
9412
# Linker flags that can not go in dependency_libs.
9413
inherited_linker_flags='$new_inherited_linker_flags'
9415
# Libraries that this one depends upon.
9416
dependency_libs='$dependency_libs'
9418
# Names of additional weak libraries provided by this library
9419
weak_library_names='$weak_libs'
9421
# Version information for $libname.
9426
# Is this an already installed library?
9427
installed=$installed
9429
# Should we warn about portability when linking against -modules?
9430
shouldnotlink=$module
9432
# Files to dlopen/dlpreopen
9434
dlpreopen='$dlprefiles'
9436
# Directory that this library needs to be installed in:
9437
libdir='$install_libdir'"
9438
if test "$installed" = no && test "$need_relink" = yes; then
9440
relink_command=\"$relink_command\""
9445
# Do a symbolic link so that the libtool archive can be found in
9446
# LD_LIBRARY_PATH before the program is installed.
9447
func_show_eval '( cd "$output_objdir" && $RM "$outputname" && $LN_S "../$outputname" "$outputname" )' 'exit $?'
9453
{ test "$opt_mode" = link || test "$opt_mode" = relink; } &&
9454
func_mode_link ${1+"$@"}
9457
# func_mode_uninstall arg...
9458
func_mode_uninstall ()
9466
# This variable tells wrapper scripts just to set variables rather
9467
# than running their programs.
9468
libtool_install_magic="$magic"
9473
-f) func_append RM " $arg"; rmforce=yes ;;
9474
-*) func_append RM " $arg" ;;
9475
*) func_append files " $arg" ;;
9480
func_fatal_help "you must specify an RM program"
9484
for file in $files; do
9485
func_dirname "$file" "" "."
9486
dir="$func_dirname_result"
9487
if test "X$dir" = X.; then
9492
func_basename "$file"
9493
name="$func_basename_result"
9494
test "$opt_mode" = uninstall && odir="$dir"
9496
# Remember odir for removal later, being careful to avoid duplicates
9497
if test "$opt_mode" = clean; then
9500
*) func_append rmdirs " $odir" ;;
9504
# Don't error if the file doesn't exist and rm -f was used.
9505
if { test -L "$file"; } >/dev/null 2>&1 ||
9506
{ test -h "$file"; } >/dev/null 2>&1 ||
9507
test -f "$file"; then
9509
elif test -d "$file"; then
9512
elif test "$rmforce" = yes; then
9520
# Possibly a libtool archive, so verify it.
9521
if func_lalib_p "$file"; then
9522
func_source $dir/$name
9524
# Delete the libtool libraries and symlinks.
9525
for n in $library_names; do
9526
func_append rmfiles " $odir/$n"
9528
test -n "$old_library" && func_append rmfiles " $odir/$old_library"
9532
case " $library_names " in
9534
*) test -n "$dlname" && func_append rmfiles " $odir/$dlname" ;;
9536
test -n "$libdir" && func_append rmfiles " $odir/$name $odir/${name}i"
9539
if test -n "$library_names"; then
9540
# Do each command in the postuninstall commands.
9541
func_execute_cmds "$postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1'
9544
if test -n "$old_library"; then
9545
# Do each command in the old_postuninstall commands.
9546
func_execute_cmds "$old_postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1'
9548
# FIXME: should reinstall the best remaining shared library.
9555
# Possibly a libtool object, so verify it.
9556
if func_lalib_p "$file"; then
9559
func_source $dir/$name
9561
# Add PIC object to the list of files to remove.
9562
if test -n "$pic_object" &&
9563
test "$pic_object" != none; then
9564
func_append rmfiles " $dir/$pic_object"
9567
# Add non-PIC object to the list of files to remove.
9568
if test -n "$non_pic_object" &&
9569
test "$non_pic_object" != none; then
9570
func_append rmfiles " $dir/$non_pic_object"
9576
if test "$opt_mode" = clean ; then
9580
func_stripname '' '.exe' "$file"
9581
file=$func_stripname_result
9582
func_stripname '' '.exe' "$name"
9583
noexename=$func_stripname_result
9584
# $file with .exe has already been added to rmfiles,
9585
# add $file without .exe
9586
func_append rmfiles " $file"
9589
# Do a test to see if this is a libtool program.
9590
if func_ltwrapper_p "$file"; then
9591
if func_ltwrapper_executable_p "$file"; then
9592
func_ltwrapper_scriptname "$file"
9594
func_source $func_ltwrapper_scriptname_result
9595
func_append rmfiles " $func_ltwrapper_scriptname_result"
9598
func_source $dir/$noexename
9601
# note $name still contains .exe if it was in $file originally
9602
# as does the version of $file that was added into $rmfiles
9603
func_append rmfiles " $odir/$name $odir/${name}S.${objext}"
9604
if test "$fast_install" = yes && test -n "$relink_command"; then
9605
func_append rmfiles " $odir/lt-$name"
9607
if test "X$noexename" != "X$name" ; then
9608
func_append rmfiles " $odir/lt-${noexename}.c"
9614
func_show_eval "$RM $rmfiles" 'exit_status=1'
9617
# Try to remove the ${objdir}s in the directories where we deleted files
9618
for dir in $rmdirs; do
9619
if test -d "$dir"; then
9620
func_show_eval "rmdir $dir >/dev/null 2>&1"
9627
{ test "$opt_mode" = uninstall || test "$opt_mode" = clean; } &&
9628
func_mode_uninstall ${1+"$@"}
9630
test -z "$opt_mode" && {
9631
help="$generic_help"
9632
func_fatal_help "you must specify a MODE"
9635
test -z "$exec_cmd" && \
9636
func_fatal_help "invalid operation mode \`$opt_mode'"
9638
if test -n "$exec_cmd"; then
9639
eval exec "$exec_cmd"
9646
# The TAGs below are defined such that we never get into a situation
9647
# in which we disable both kinds of libraries. Given conflicting
9648
# choices, we go for a static library, that is the most portable,
9649
# since we can't tell whether shared libraries were disabled because
9650
# the user asked for that or because the platform doesn't support
9651
# them. This is particularly important on AIX, because we don't
9652
# support having both static and shared libraries enabled at the same
9653
# time on that platform, so we default to a shared-only configuration.
9654
# If a disable-shared tag is given, we'll fallback to a static-only
9655
# configuration. But we'll never go from static-only to shared-only.
9657
# ### BEGIN LIBTOOL TAG CONFIG: disable-shared
9658
build_libtool_libs=no
9660
# ### END LIBTOOL TAG CONFIG: disable-shared
9662
# ### BEGIN LIBTOOL TAG CONFIG: disable-static
9663
build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac`
9664
# ### END LIBTOOL TAG CONFIG: disable-static