1
# ltmain.sh - Provide generalized library-building support services.
2
# NOTE: Changing this file will not affect anything until you rerun configure.
4
# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003
5
# Free Software Foundation, Inc.
6
# Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
8
# This program is free software; you can redistribute it and/or modify
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
9
11
# it under the terms of the GNU General Public License as published by
10
12
# the Free Software Foundation; either version 2 of the License, or
11
13
# (at your option) any later version.
13
# This program is distributed in the hope that it will be useful, but
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
14
21
# WITHOUT ANY WARRANTY; without even the implied warranty of
15
22
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16
23
# General Public License for more details.
18
25
# You should have received a copy of the GNU General Public License
19
# along with this program; if not, write to the Free Software
20
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
22
# As a special exception to the GNU General Public License, if you
23
# distribute this file as part of a program that contains a
24
# configuration script generated by Autoconf, you may include it under
25
# the same distribution terms that you use for the rest of that program.
27
# Check that we have a working $echo.
28
if test "X$1" = X--no-reexec; then
29
# Discard the --no-reexec flag, and continue.
31
elif test "X$1" = X--fallback-echo; then
32
# Avoid inline document here, it may be left over
34
elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then
35
# Yippee, $echo works!
38
# Restart under the correct shell, and then maybe $echo will work.
39
exec $SHELL "$0" --no-reexec ${1+"$@"}
42
if test "X$1" = X--fallback-echo; then
43
# used as fallback echo
51
# The name of this program.
52
progname=`$echo "$0" | ${SED} 's%^.*/%%'`
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/>.
59
TIMESTAMP=" (1.1220.2.60 2004/01/25 12:25:08)"
62
help="Try \`$progname --help' for more information."
85
package_revision=1.3337
87
# Be Bourne compatible
88
if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
91
# Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
92
# is contrary to our usage. Disable this feature.
93
alias -g '${1+"$@"}'='"$@"'
96
case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac
98
BIN_SH=xpg4; export BIN_SH # for Tru64
99
DUALCASE=1; export DUALCASE # for MKS sh
101
# A function that is used when there is no print builtin or printf.
102
func_fallback_echo ()
104
eval 'cat <<_LTECHO_EOF
109
# NLS nuisances: We save the old values to restore during execute mode.
112
for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
114
eval "if test \"\${$lt_var+set}\" = set; then
115
save_$lt_var=\$$lt_var
118
lt_user_locale=\"$lt_var=\\\$save_\$lt_var; \$lt_user_locale\"
119
lt_safe_locale=\"$lt_var=C; \$lt_safe_locale\"
124
export LANGUAGE LC_ALL
129
# Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh
130
# is ksh but when the shell is invoked as "sh" and the current value of
131
# the _XPG environment variable is not equal to 1 (one), the special
132
# positional parameter $0, within a function call, is the name of the
139
test "${ECHO+set}" = set || ECHO=${as_echo-'printf %s\n'}
144
: ${SHELL="${CONFIG_SHELL-/bin/sh}"}
145
: ${Xsed="$SED -e 1s/^X//"}
150
EXIT_MISMATCH=63 # $? = 63 is used to indicate version mismatch to missing.
151
EXIT_SKIP=77 # $? = 77 is used to indicate a skipped test to automake.
153
exit_status=$EXIT_SUCCESS
155
# Make sure IFS has a sensible default
160
dirname="s,/[^/]*$,,"
163
# func_dirname file append nondir_replacement
164
# Compute the dirname of FILE. If nonempty, add APPEND to the result,
165
# otherwise set result to NONDIR_REPLACEMENT.
168
func_dirname_result=`$ECHO "${1}" | $SED "$dirname"`
169
if test "X$func_dirname_result" = "X${1}"; then
170
func_dirname_result="${3}"
172
func_dirname_result="$func_dirname_result${2}"
174
} # func_dirname may be replaced by extended shell implementation
180
func_basename_result=`$ECHO "${1}" | $SED "$basename"`
181
} # func_basename may be replaced by extended shell implementation
184
# func_dirname_and_basename file append nondir_replacement
185
# perform func_basename and func_dirname in a single function
187
# dirname: Compute the dirname of FILE. If nonempty,
188
# add APPEND to the result, otherwise set result
189
# to NONDIR_REPLACEMENT.
190
# value returned in "$func_dirname_result"
191
# basename: Compute filename of FILE.
192
# value retuned in "$func_basename_result"
193
# Implementation must be kept synchronized with func_dirname
194
# and func_basename. For efficiency, we do not delegate to
195
# those functions but instead duplicate the functionality here.
196
func_dirname_and_basename ()
198
# Extract subdirectory from the argument.
199
func_dirname_result=`$ECHO "${1}" | $SED -e "$dirname"`
200
if test "X$func_dirname_result" = "X${1}"; then
201
func_dirname_result="${3}"
203
func_dirname_result="$func_dirname_result${2}"
205
func_basename_result=`$ECHO "${1}" | $SED -e "$basename"`
206
} # func_dirname_and_basename may be replaced by extended shell implementation
209
# func_stripname prefix suffix name
210
# strip PREFIX and SUFFIX off of NAME.
211
# PREFIX and SUFFIX must not contain globbing or regex special
212
# characters, hashes, percent signs, but SUFFIX may contain a leading
213
# dot (in which case that matches only a dot).
214
# func_strip_suffix prefix name
218
.*) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%\\\\${2}\$%%"`;;
219
*) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%${2}\$%%"`;;
221
} # func_stripname may be replaced by extended shell implementation
224
# These SED scripts presuppose an absolute path with a trailing slash.
225
pathcar='s,^/\([^/]*\).*$,\1,'
226
pathcdr='s,^/[^/]*,,'
227
removedotparts=':dotsl
231
collapseslashes='s@/\{1,\}@/@g'
232
finalslash='s,/*$,/,'
234
# func_normal_abspath PATH
235
# Remove doubled-up and trailing slashes, "." path components,
236
# and cancel out any ".." path components in PATH after making
237
# it an absolute path.
238
# value returned in "$func_normal_abspath_result"
239
func_normal_abspath ()
241
# Start from root dir and reassemble the path.
242
func_normal_abspath_result=
243
func_normal_abspath_tpath=$1
244
func_normal_abspath_altnamespace=
245
case $func_normal_abspath_tpath in
247
# Empty path, that just means $cwd.
248
func_stripname '' '/' "`pwd`"
249
func_normal_abspath_result=$func_stripname_result
252
# The next three entries are used to spot a run of precisely
253
# two leading slashes without using negated character classes;
254
# we take advantage of case's first-match behaviour.
256
# Unusual form of absolute path, do nothing.
259
# Not necessarily an ordinary path; POSIX reserves leading '//'
260
# and for example Cygwin uses it to access remote file shares
261
# over CIFS/SMB, so we conserve a leading double slash if found.
262
func_normal_abspath_altnamespace=/
265
# Absolute path, do nothing.
268
# Relative path, prepend $cwd.
269
func_normal_abspath_tpath=`pwd`/$func_normal_abspath_tpath
272
# Cancel out all the simple stuff to save iterations. We also want
273
# the path to end with a slash for ease of parsing, so make sure
274
# there is one (and only one) here.
275
func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \
276
-e "$removedotparts" -e "$collapseslashes" -e "$finalslash"`
278
# Processed it all yet?
279
if test "$func_normal_abspath_tpath" = / ; then
280
# If we ascended to the root using ".." the result may be empty now.
281
if test -z "$func_normal_abspath_result" ; then
282
func_normal_abspath_result=/
286
func_normal_abspath_tcomponent=`$ECHO "$func_normal_abspath_tpath" | $SED \
288
func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \
290
# Figure out what to do with it
291
case $func_normal_abspath_tcomponent in
293
# Trailing empty path component, ignore it.
296
# Parent dir; strip last assembled component from result.
297
func_dirname "$func_normal_abspath_result"
298
func_normal_abspath_result=$func_dirname_result
301
# Actual path component, append it.
302
func_normal_abspath_result=$func_normal_abspath_result/$func_normal_abspath_tcomponent
306
# Restore leading double-slash if one was found on entry.
307
func_normal_abspath_result=$func_normal_abspath_altnamespace$func_normal_abspath_result
310
# func_relative_path SRCDIR DSTDIR
311
# generates a relative path from SRCDIR to DSTDIR, with a trailing
312
# slash if non-empty, suitable for immediately appending a filename
313
# without needing to append a separator.
314
# value returned in "$func_relative_path_result"
315
func_relative_path ()
317
func_relative_path_result=
318
func_normal_abspath "$1"
319
func_relative_path_tlibdir=$func_normal_abspath_result
320
func_normal_abspath "$2"
321
func_relative_path_tbindir=$func_normal_abspath_result
323
# Ascend the tree starting from libdir
325
# check if we have found a prefix of bindir
326
case $func_relative_path_tbindir in
327
$func_relative_path_tlibdir)
328
# found an exact match
329
func_relative_path_tcancelled=
332
$func_relative_path_tlibdir*)
333
# found a matching prefix
334
func_stripname "$func_relative_path_tlibdir" '' "$func_relative_path_tbindir"
335
func_relative_path_tcancelled=$func_stripname_result
336
if test -z "$func_relative_path_result"; then
337
func_relative_path_result=.
342
func_dirname $func_relative_path_tlibdir
343
func_relative_path_tlibdir=${func_dirname_result}
344
if test "x$func_relative_path_tlibdir" = x ; then
345
# Have to descend all the way to the root!
346
func_relative_path_result=../$func_relative_path_result
347
func_relative_path_tcancelled=$func_relative_path_tbindir
350
func_relative_path_result=../$func_relative_path_result
355
# Now calculate path; take care to avoid doubling-up slashes.
356
func_stripname '' '/' "$func_relative_path_result"
357
func_relative_path_result=$func_stripname_result
358
func_stripname '/' '/' "$func_relative_path_tcancelled"
359
if test "x$func_stripname_result" != x ; then
360
func_relative_path_result=${func_relative_path_result}/${func_stripname_result}
363
# Normalisation. If bindir is libdir, return empty string,
364
# else relative path ending with a slash; either way, target
365
# file name can be directly appended.
366
if test ! -z "$func_relative_path_result"; then
367
func_stripname './' '' "$func_relative_path_result/"
368
func_relative_path_result=$func_stripname_result
372
# The name of this program:
373
func_dirname_and_basename "$progpath"
374
progname=$func_basename_result
376
# Make sure we have an absolute path for reexecution:
378
[\\/]*|[A-Za-z]:\\*) ;;
380
progdir=$func_dirname_result
381
progdir=`cd "$progdir" && pwd`
382
progpath="$progdir/$progname"
386
IFS=${PATH_SEPARATOR-:}
387
for progdir in $PATH; do
389
test -x "$progdir/$progname" && break
392
test -n "$progdir" || progdir=`pwd`
393
progpath="$progdir/$progname"
397
# Sed substitution that helps us do robust quoting. It backslashifies
398
# metacharacters that are still active within double-quoted strings.
399
Xsed="${SED}"' -e 1s/^X//'
400
sed_quote_subst='s/\([`"$\\]\)/\\\1/g'
402
# Same as above, but do not quote variable references.
403
double_quote_subst='s/\(["`\\]\)/\\\1/g'
405
# Sed substitution that turns a string into a regex matching for the
407
sed_make_literal_regex='s,[].[^$\\*\/],\\&,g'
409
# Sed substitution that converts a w32 file name or path
410
# which contains forward slashes, into one that contains
411
# (escaped) backslashes. A very naive implementation.
412
lt_sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g'
414
# Re-`\' parameter expansions in output of double_quote_subst that were
415
# `\'-ed in input to the same. If an odd number of `\' preceded a '$'
416
# in input to double_quote_subst, that '$' was protected from expansion.
417
# Since each input `\' is now two `\'s, look for any number of runs of
418
# four `\'s followed by two `\'s and then a '$'. `\' that '$'.
423
sed_double_backslash="\
427
s/\\([^$bs]\\)$bs2$dollar/\\1$bs2$bs$dollar/g
438
# Echo program name prefixed message, along with the current mode
439
# name if it has been set yet.
442
$ECHO "$progname: ${opt_mode+$opt_mode: }$*"
445
# func_verbose arg...
446
# Echo program name prefixed message in verbose mode only.
449
$opt_verbose && func_echo ${1+"$@"}
451
# A bug in bash halts the script if the last line of a function
452
# fails when set -e is in force, so we need another command to
457
# func_echo_all arg...
458
# Invoke $ECHO with all args, space-separated.
465
# Echo program name prefixed message to standard error.
468
$ECHO "$progname: ${opt_mode+$opt_mode: }"${1+"$@"} 1>&2
471
# func_warning arg...
472
# Echo program name prefixed warning message to standard error.
475
$opt_warning && $ECHO "$progname: ${opt_mode+$opt_mode: }warning: "${1+"$@"} 1>&2
481
# func_fatal_error arg...
482
# Echo program name prefixed message to standard error, and exit.
489
# func_fatal_help arg...
490
# Echo program name prefixed message to standard error, followed by
491
# a help hint, and exit.
495
func_fatal_error "$help"
497
help="Try \`$progname --help' for more information." ## default
500
# func_grep expression filename
501
# Check whether EXPRESSION matches any line of FILENAME, without output.
504
$GREP "$1" "$2" >/dev/null 2>&1
508
# func_mkdir_p directory-path
509
# Make sure the entire path to DIRECTORY-PATH is available.
512
my_directory_path="$1"
515
if test -n "$my_directory_path" && test "$opt_dry_run" != ":"; then
517
# Protect directory names starting with `-'
518
case $my_directory_path in
519
-*) my_directory_path="./$my_directory_path" ;;
522
# While some portion of DIR does not yet exist...
523
while test ! -d "$my_directory_path"; do
524
# ...make a list in topmost first order. Use a colon delimited
525
# list incase some portion of path contains whitespace.
526
my_dir_list="$my_directory_path:$my_dir_list"
528
# If the last portion added has no slash in it, the list is done
529
case $my_directory_path in */*) ;; *) break ;; esac
531
# ...otherwise throw away the child directory and loop
532
my_directory_path=`$ECHO "$my_directory_path" | $SED -e "$dirname"`
534
my_dir_list=`$ECHO "$my_dir_list" | $SED 's,:*$,,'`
536
save_mkdir_p_IFS="$IFS"; IFS=':'
537
for my_dir in $my_dir_list; do
538
IFS="$save_mkdir_p_IFS"
539
# mkdir can fail with a `File exist' error if two processes
540
# try to create one of the directories concurrently. Don't
542
$MKDIR "$my_dir" 2>/dev/null || :
544
IFS="$save_mkdir_p_IFS"
546
# Bail out if we (or some other process) failed to create a directory.
547
test -d "$my_directory_path" || \
548
func_fatal_error "Failed to create \`$1'"
553
# func_mktempdir [string]
554
# Make a temporary directory that won't clash with other running
555
# libtool processes, and avoids race conditions if possible. If
556
# given, STRING is the basename for that directory.
559
my_template="${TMPDIR-/tmp}/${1-$progname}"
561
if test "$opt_dry_run" = ":"; then
562
# Return a directory name, but don't create it in dry-run mode
563
my_tmpdir="${my_template}-$$"
566
# If mktemp works, use that first and foremost
567
my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null`
569
if test ! -d "$my_tmpdir"; then
570
# Failing that, at least try and use $RANDOM to avoid a race
571
my_tmpdir="${my_template}-${RANDOM-0}$$"
573
save_mktempdir_umask=`umask`
576
umask $save_mktempdir_umask
579
# If we're not in dry-run mode, bomb out on failure
580
test -d "$my_tmpdir" || \
581
func_fatal_error "cannot create temporary directory \`$my_tmpdir'"
588
# func_quote_for_eval arg
589
# Aesthetically quote ARG to be evaled later.
590
# This function returns two values: FUNC_QUOTE_FOR_EVAL_RESULT
591
# is double-quoted, suitable for a subsequent eval, whereas
592
# FUNC_QUOTE_FOR_EVAL_UNQUOTED_RESULT has merely all characters
593
# which are still active within double quotes backslashified.
594
func_quote_for_eval ()
598
func_quote_for_eval_unquoted_result=`$ECHO "$1" | $SED "$sed_quote_subst"` ;;
600
func_quote_for_eval_unquoted_result="$1" ;;
603
case $func_quote_for_eval_unquoted_result in
604
# Double-quote args containing shell metacharacters to delay
605
# word splitting, command substitution and and variable
606
# expansion for a subsequent eval.
607
# Many Bourne shells cannot handle close brackets correctly
608
# in scan sets, so we specify it separately.
609
*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
610
func_quote_for_eval_result="\"$func_quote_for_eval_unquoted_result\""
613
func_quote_for_eval_result="$func_quote_for_eval_unquoted_result"
618
# func_quote_for_expand arg
619
# Aesthetically quote ARG to be evaled later; same as above,
620
# but do not quote variable references.
621
func_quote_for_expand ()
625
my_arg=`$ECHO "$1" | $SED \
626
-e "$double_quote_subst" -e "$sed_double_backslash"` ;;
632
# Double-quote args containing shell metacharacters to delay
633
# word splitting and command substitution for a subsequent eval.
634
# Many Bourne shells cannot handle close brackets correctly
635
# in scan sets, so we specify it separately.
636
*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
641
func_quote_for_expand_result="$my_arg"
645
# func_show_eval cmd [fail_exp]
646
# Unless opt_silent is true, then output CMD. Then, if opt_dryrun is
647
# not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP
648
# is given, then evaluate it.
654
${opt_silent-false} || {
655
func_quote_for_expand "$my_cmd"
656
eval "func_echo $func_quote_for_expand_result"
659
if ${opt_dry_run-false}; then :; else
662
if test "$my_status" -eq 0; then :; else
663
eval "(exit $my_status); $my_fail_exp"
669
# func_show_eval_locale cmd [fail_exp]
670
# Unless opt_silent is true, then output CMD. Then, if opt_dryrun is
671
# not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP
672
# is given, then evaluate it. Use the saved locale for evaluation.
673
func_show_eval_locale ()
678
${opt_silent-false} || {
679
func_quote_for_expand "$my_cmd"
680
eval "func_echo $func_quote_for_expand_result"
683
if ${opt_dry_run-false}; then :; else
684
eval "$lt_user_locale
687
eval "$lt_safe_locale"
688
if test "$my_status" -eq 0; then :; else
689
eval "(exit $my_status); $my_fail_exp"
695
# Turn $1 into a string suitable for a shell variable name.
696
# Result is stored in $func_tr_sh_result. All characters
697
# not in the set a-zA-Z0-9_ are replaced with '_'. Further,
698
# if $1 begins with a digit, a '_' is prepended as well.
702
[0-9]* | *[!a-zA-Z0-9_]*)
703
func_tr_sh_result=`$ECHO "$1" | $SED 's/^\([0-9]\)/_\1/; s/[^a-zA-Z0-9_]/_/g'`
713
# Echo version message to standard output and exit.
726
/^# '$PROGRAM' (GNU /,/# warranty; / {
729
s/\((C)\)[ 0-9,-]*\( [1-9][0-9]*\)/\1\2/
736
# Echo short help message to standard output and exit.
741
$SED -n '/^# Usage:/,/^# *.*--help/ {
744
s/\$progname/'$progname'/
748
$ECHO "run \`$progname --help | more' for full usage"
753
# Echo long help message to standard output and exit,
754
# unless 'noexit' is passed as argument.
759
$SED -n '/^# Usage:/,/# Report bugs to/ {
763
s*\$progname*'$progname'*
765
s*\$SHELL*'"$SHELL"'*
767
s*\$LTCFLAGS*'"$LTCFLAGS"'*
769
s/\$with_gnu_ld/'"$with_gnu_ld"'/
770
s/\$automake_version/'"`(${AUTOMAKE-automake} --version) 2>/dev/null |$SED 1q`"'/
771
s/\$autoconf_version/'"`(${AUTOCONF-autoconf} --version) 2>/dev/null |$SED 1q`"'/
775
/^# .* home page:/b print
776
/^# General help using/b print
779
if test -z "$1"; then
784
# func_missing_arg argname
785
# Echo program name prefixed message to standard error and set global
791
func_error "missing argument for $1."
796
# func_split_short_opt shortopt
797
# Set func_split_short_opt_name and func_split_short_opt_arg shell
798
# variables after splitting SHORTOPT after the 2nd character.
799
func_split_short_opt ()
801
my_sed_short_opt='1s/^\(..\).*$/\1/;q'
802
my_sed_short_rest='1s/^..\(.*\)$/\1/;q'
804
func_split_short_opt_name=`$ECHO "$1" | $SED "$my_sed_short_opt"`
805
func_split_short_opt_arg=`$ECHO "$1" | $SED "$my_sed_short_rest"`
806
} # func_split_short_opt may be replaced by extended shell implementation
809
# func_split_long_opt longopt
810
# Set func_split_long_opt_name and func_split_long_opt_arg shell
811
# variables after splitting LONGOPT at the `=' sign.
812
func_split_long_opt ()
814
my_sed_long_opt='1s/^\(--[^=]*\)=.*/\1/;q'
815
my_sed_long_arg='1s/^--[^=]*=//'
817
func_split_long_opt_name=`$ECHO "$1" | $SED "$my_sed_long_opt"`
818
func_split_long_opt_arg=`$ECHO "$1" | $SED "$my_sed_long_arg"`
819
} # func_split_long_opt may be replaced by extended shell implementation
63
827
magic="%%%MAGIC variable%%%"
68
# Sed substitution that helps us do robust quoting. It backslashifies
69
# metacharacters that are still active within double-quoted strings.
70
Xsed="${SED}"' -e 1s/^X//'
71
sed_quote_subst='s/\([\\`\\"$\\\\]\)/\\\1/g'
72
# test EBCDIC or ASCII
73
case `echo A|tr A '\301'` in
74
A) # EBCDIC based system
75
SP2NL="tr '\100' '\n'"
76
NL2SP="tr '\r\n' '\100\100'"
78
*) # Assume ASCII based system
79
SP2NL="tr '\040' '\012'"
80
NL2SP="tr '\015\012' '\040\040'"
85
# Only set LANG and LC_ALL to C if already set.
86
# These must not be set unconditionally because not all systems understand
87
# e.g. LANG=C (notably SCO).
88
# We save the old values to restore during execute mode.
89
if test "${LC_ALL+set}" = set; then
90
save_LC_ALL="$LC_ALL"; LC_ALL=C; export LC_ALL
92
if test "${LANG+set}" = set; then
93
save_LANG="$LANG"; LANG=C; export LANG
96
# Make sure IFS has a sensible default
100
if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
101
$echo "$modename: not configured to build any kind of library" 1>&2
102
$echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2
828
magic_exe="%%%MAGIC EXE variable%%%"
106
830
# Global variables.
115
833
lo2o="s/\\.lo\$/.${objext}/"
116
834
o2lo="s/\\.${objext}\$/.lo/"
118
#####################################
119
# Shell function definitions:
120
# This seems to be the best place for them
122
# Need a lot of goo to handle *both* DLLs and import libs
123
# Has to be a shell function in order to 'eat' the argument
124
# that is supplied when $file_magic_command is called.
126
win32_libid_type="unknown"
127
win32_fileres=`file -L $1 2>/dev/null`
128
case $win32_fileres in
129
*ar\ archive\ import\ library*) # definitely import
130
win32_libid_type="x86 archive import"
132
*ar\ archive*) # could be an import, or static
133
if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | \
134
grep -E 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then
135
win32_nmres=`eval $NM -f posix -A $1 | \
136
sed -n -e '1,100{/ I /{x;/import/!{s/^/import/;h;p;};x;};}'`
137
if test "X$win32_nmres" = "Ximport" ; then
138
win32_libid_type="x86 archive import"
140
win32_libid_type="x86 archive static"
145
win32_libid_type="x86 DLL"
147
*executable*) # but shell scripts are "executable" too...
148
case $win32_fileres in
149
*MS\ Windows\ PE\ Intel*)
150
win32_libid_type="x86 DLL"
155
$echo $win32_libid_type
158
# End of Shell function definitions
159
#####################################
161
# Parse our command line options once, thoroughly.
162
while test "$#" -gt 0
168
-*=*) optarg=`$echo "X$arg" | $Xsed -e 's/[-_a-zA-Z0-9]*=//'` ;;
172
# If the previous option needs an argument, assign it.
173
if test -n "$prev"; then
176
execute_dlfiles="$execute_dlfiles $arg"
180
preserve_args="${preserve_args}=$arg"
182
# Check whether tagname contains only valid characters
185
$echo "$progname: invalid tag name: $tagname" 1>&2
192
# Don't test for the "default" C tag, as we know, it's there, but
193
# not specially marked.
196
if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "$0" > /dev/null; then
197
taglist="$taglist $tagname"
198
# Evaluate the configuration.
199
eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$tagname'$/,/^# ### END LIBTOOL TAG CONFIG: '$tagname'$/p' < $0`"
201
$echo "$progname: ignoring unknown tag $tagname" 1>&2
216
# Have we seen a non-optional argument yet?
223
$echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP"
225
$echo "Copyright (C) 2003 Free Software Foundation, Inc."
226
$echo "This is free software; see the source for copying conditions. There is NO"
227
$echo "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
232
${SED} -e '1,/^# ### BEGIN LIBTOOL CONFIG/d' -e '/^# ### END LIBTOOL CONFIG/,$d' $0
233
# Now print the configurations for the tags.
234
for tagname in $taglist; do
235
${SED} -n -e "/^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$/,/^# ### END LIBTOOL TAG CONFIG: $tagname$/p" < "$0"
241
$echo "$progname: enabling shell trace mode"
243
preserve_args="$preserve_args $arg"
252
if test "$build_libtool_libs" = yes; then
253
$echo "enable shared libraries"
255
$echo "disable shared libraries"
257
if test "$build_old_libs" = yes; then
258
$echo "enable static libraries"
260
$echo "disable static libraries"
265
--finish) mode="finish" ;;
267
--mode) prevopt="--mode" prev=mode ;;
268
--mode=*) mode="$optarg" ;;
270
--preserve-dup-deps) duplicate_deps="yes" ;;
274
preserve_args="$preserve_args $arg"
277
--tag) prevopt="--tag" prev=tag ;;
279
set tag "$optarg" ${1+"$@"}
282
preserve_args="$preserve_args --tag"
291
$echo "$modename: unrecognized option \`$arg'" 1>&2
303
if test -n "$prevopt"; then
304
$echo "$modename: option \`$prevopt' requires an argument" 1>&2
309
838
# If this variable is set in any of the actions, the command in it
310
839
# will be execed at the end. This prevents here-documents from being
311
840
# left over by shells.
314
if test -z "$show_help"; then
316
# Infer the operation mode.
317
if test -z "$mode"; then
318
$echo "*** Warning: inferring the mode of operation is deprecated." 1>&2
319
$echo "*** Future versions of Libtool will require -mode=MODE be specified." 1>&2
321
*cc | cc* | *++ | gcc* | *-gcc* | g++* | xlc*)
843
# func_append var value
844
# Append VALUE to the end of shell variable VAR.
847
eval "${1}=\$${1}\${2}"
848
} # func_append may be replaced by extended shell implementation
850
# func_append_quoted var value
851
# Quote VALUE and append to the end of shell variable VAR, separated
853
func_append_quoted ()
855
func_quote_for_eval "${2}"
856
eval "${1}=\$${1}\\ \$func_quote_for_eval_result"
857
} # func_append_quoted may be replaced by extended shell implementation
860
# func_arith arithmetic-term...
863
func_arith_result=`expr "${@}"`
864
} # func_arith may be replaced by extended shell implementation
868
# STRING may not start with a hyphen.
871
func_len_result=`expr "${1}" : ".*" 2>/dev/null || echo $max_cmd_len`
872
} # func_len may be replaced by extended shell implementation
878
func_lo2o_result=`$ECHO "${1}" | $SED "$lo2o"`
879
} # func_lo2o may be replaced by extended shell implementation
882
# func_xform libobj-or-source
885
func_xform_result=`$ECHO "${1}" | $SED 's/\.[^.]*$/.lo/'`
886
} # func_xform may be replaced by extended shell implementation
889
# func_fatal_configuration arg...
890
# Echo program name prefixed message to standard error, followed by
891
# a configuration failure hint, and exit.
892
func_fatal_configuration ()
895
func_error "See the $PACKAGE documentation for more information."
896
func_fatal_error "Fatal configuration error."
901
# Display the configuration for all the tags in this script.
904
re_begincf='^# ### BEGIN LIBTOOL'
905
re_endcf='^# ### END LIBTOOL'
907
# Default configuration.
908
$SED "1,/$re_begincf CONFIG/d;/$re_endcf CONFIG/,\$d" < "$progpath"
910
# Now print the configurations for the tags.
911
for tagname in $taglist; do
912
$SED -n "/$re_begincf TAG CONFIG: $tagname\$/,/$re_endcf TAG CONFIG: $tagname\$/p" < "$progpath"
919
# Display the features supported by this script.
923
if test "$build_libtool_libs" = yes; then
924
echo "enable shared libraries"
926
echo "disable shared libraries"
928
if test "$build_old_libs" = yes; then
929
echo "enable static libraries"
931
echo "disable static libraries"
937
# func_enable_tag tagname
938
# Verify that TAGNAME is valid, and either flag an error and exit, or
939
# enable the TAGNAME tag. We also add TAGNAME to the global $taglist
946
re_begincf="^# ### BEGIN LIBTOOL TAG CONFIG: $tagname\$"
947
re_endcf="^# ### END LIBTOOL TAG CONFIG: $tagname\$"
948
sed_extractcf="/$re_begincf/,/$re_endcf/p"
953
func_fatal_error "invalid tag name: $tagname"
957
# Don't test for the "default" C tag, as we know it's
958
# there but not specially marked.
962
if $GREP "$re_begincf" "$progpath" >/dev/null 2>&1; then
963
taglist="$taglist $tagname"
965
# Evaluate the configuration. Be careful to quote the path
966
# and the sed script, to avoid splitting on whitespace, but
967
# also don't use non-portable quotes within backquotes within
968
# quotes we have to do it in 2 steps:
969
extractedcf=`$SED -n -e "$sed_extractcf" < "$progpath"`
972
func_error "ignoring unknown tag $tagname"
978
# func_check_version_match
979
# Ensure that we are using m4 macros, and libtool script from the same
980
# release of libtool.
981
func_check_version_match ()
983
if test "$package_revision" != "$macro_revision"; then
984
if test "$VERSION" != "$macro_version"; then
985
if test -z "$macro_version"; then
987
$progname: Version mismatch error. This is $PACKAGE $VERSION, but the
988
$progname: definition of this LT_INIT comes from an older release.
989
$progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION
990
$progname: and run autoconf again.
994
$progname: Version mismatch error. This is $PACKAGE $VERSION, but the
995
$progname: definition of this LT_INIT comes from $PACKAGE $macro_version.
996
$progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION
997
$progname: and run autoconf again.
1002
$progname: Version mismatch error. This is $PACKAGE $VERSION, revision $package_revision,
1003
$progname: but the definition of this LT_INIT comes from revision $macro_revision.
1004
$progname: You should recreate aclocal.m4 with macros from revision $package_revision
1005
$progname: of $PACKAGE $VERSION and run autoconf again.
1014
# Shorthand for --mode=foo, only valid as the first argument
1017
shift; set dummy --mode clean ${1+"$@"}; shift
1019
compile|compil|compi|comp|com|co|c)
1020
shift; set dummy --mode compile ${1+"$@"}; shift
1022
execute|execut|execu|exec|exe|ex|e)
1023
shift; set dummy --mode execute ${1+"$@"}; shift
1025
finish|finis|fini|fin|fi|f)
1026
shift; set dummy --mode finish ${1+"$@"}; shift
1028
install|instal|insta|inst|ins|in|i)
1029
shift; set dummy --mode install ${1+"$@"}; shift
1032
shift; set dummy --mode link ${1+"$@"}; shift
1034
uninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u)
1035
shift; set dummy --mode uninstall ${1+"$@"}; shift
1045
opt_preserve_dup_deps=false
1057
# Parse options once, thoroughly. This comes as soon as possible in the
1058
# script to make things like `--version' happen as quickly as we can.
1060
# this just eases exit handling
1061
while test $# -gt 0; do
1065
--debug|-x) opt_debug='set -x'
1066
func_echo "enabling shell trace mode"
1069
--dry-run|--dryrun|-n)
1078
opt_dlopen="${opt_dlopen+$opt_dlopen
1082
--preserve-dup-deps)
1083
opt_preserve_dup_deps=:
1091
set dummy --mode finish ${1+"$@"}; shift
1098
opt_help=': help-all'
1101
test $# = 0 && func_missing_arg $opt && break
1105
# Valid mode arguments:
1106
clean|compile|execute|finish|install|link|relink|uninstall) ;;
1108
# Catch anything else as an error
1109
*) func_error "invalid argument for $opt"
1116
--no-silent|--no-quiet)
1118
func_append preserve_args " $opt"
1120
--no-warning|--no-warn)
1122
func_append preserve_args " $opt"
1126
func_append preserve_args " $opt"
1130
func_append preserve_args " $opt"
1135
func_append preserve_args " $opt"
1139
test $# = 0 && func_missing_arg $opt && break
1142
func_append preserve_args " $opt $optarg"
1143
func_enable_tag "$optarg"
1147
-\?|-h) func_usage ;;
1148
--help) func_help ;;
1149
--version) func_version ;;
1151
# Separate optargs to long options:
1153
func_split_long_opt "$opt"
1154
set dummy "$func_split_long_opt_name" "$func_split_long_opt_arg" ${1+"$@"}
1158
# Separate non-argument short options:
1160
func_split_short_opt "$opt"
1161
set dummy "$func_split_short_opt_name" "-$func_split_short_opt_arg" ${1+"$@"}
1166
-*) func_fatal_help "unrecognized option \`$opt'" ;;
1167
*) set dummy "$opt" ${1+"$@"}; shift; break ;;
1173
# save first non-option argument
1174
if test "$#" -gt 0; then
1180
test "$opt_debug" = : || func_append preserve_args " --debug"
1183
*cygwin* | *mingw* | *pw32* | *cegcc*)
1184
# don't eliminate duplications in $postdeps and $predeps
1185
opt_duplicate_compiler_generated_deps=:
1188
opt_duplicate_compiler_generated_deps=$opt_preserve_dup_deps
1193
# Sanity checks first:
1194
func_check_version_match
1196
if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
1197
func_fatal_configuration "not configured to build any kind of library"
1201
eval std_shrext=\"$shrext_cmds\"
1203
# Only execute mode is allowed to have -dlopen flags.
1204
if test -n "$opt_dlopen" && test "$opt_mode" != execute; then
1205
func_error "unrecognized option \`-dlopen'"
1210
# Change the help message to a mode-specific one.
1211
generic_help="$help"
1212
help="Try \`$progname --help --mode=$opt_mode' for more information."
1216
# Bail if the options were screwed
1217
$exit_cmd $EXIT_FAILURE
1228
# True iff FILE is a libtool `.la' library or `.lo' object file.
1229
# This function is only a basic sanity check; it will hardly flush out
1230
# determined imposters.
1234
$SED -e 4q "$1" 2>/dev/null \
1235
| $GREP "^# Generated by .*$PACKAGE" > /dev/null 2>&1
1238
# func_lalib_unsafe_p file
1239
# True iff FILE is a libtool `.la' library or `.lo' object file.
1240
# This function implements the same check as func_lalib_p without
1241
# resorting to external programs. To this end, it redirects stdin and
1242
# closes it afterwards, without saving the original file descriptor.
1243
# As a safety measure, use it only where a negative result would be
1244
# fatal anyway. Works if `file' does not exist.
1245
func_lalib_unsafe_p ()
1248
if test -f "$1" && test -r "$1" && exec 5<&0 <"$1"; then
1249
for lalib_p_l in 1 2 3 4
1252
case "$lalib_p_line" in
1253
\#\ Generated\ by\ *$PACKAGE* ) lalib_p=yes; break;;
1258
test "$lalib_p" = yes
1261
# func_ltwrapper_script_p file
1262
# True iff FILE is a libtool wrapper script
1263
# This function is only a basic sanity check; it will hardly flush out
1264
# determined imposters.
1265
func_ltwrapper_script_p ()
1270
# func_ltwrapper_executable_p file
1271
# True iff FILE is a libtool wrapper executable
1272
# This function is only a basic sanity check; it will hardly flush out
1273
# determined imposters.
1274
func_ltwrapper_executable_p ()
1276
func_ltwrapper_exec_suffix=
1279
*) func_ltwrapper_exec_suffix=.exe ;;
1281
$GREP "$magic_exe" "$1$func_ltwrapper_exec_suffix" >/dev/null 2>&1
1284
# func_ltwrapper_scriptname file
1285
# Assumes file is an ltwrapper_executable
1286
# uses $file to determine the appropriate filename for a
1287
# temporary ltwrapper_script.
1288
func_ltwrapper_scriptname ()
1290
func_dirname_and_basename "$1" "" "."
1291
func_stripname '' '.exe' "$func_basename_result"
1292
func_ltwrapper_scriptname_result="$func_dirname_result/$objdir/${func_stripname_result}_ltshwrapper"
1295
# func_ltwrapper_p file
1296
# True iff FILE is a libtool wrapper script or wrapper executable
1297
# This function is only a basic sanity check; it will hardly flush out
1298
# determined imposters.
1301
func_ltwrapper_script_p "$1" || func_ltwrapper_executable_p "$1"
1305
# func_execute_cmds commands fail_cmd
1306
# Execute tilde-delimited COMMANDS.
1307
# If FAIL_CMD is given, eval that upon failure.
1308
# FAIL_CMD may read-access the current command in variable CMD!
1309
func_execute_cmds ()
1312
save_ifs=$IFS; IFS='~'
1316
func_show_eval "$cmd" "${2-:}"
1323
# Source FILE, adding directory component if necessary.
1324
# Note that it is not necessary on cygwin/mingw to append a dot to
1325
# FILE even if both FILE and FILE.exe exist: automatic-append-.exe
1326
# behavior happens only for exec(3), not for open(2)! Also, sourcing
1327
# `FILE.' does not work on cygwin managed mounts.
1332
*/* | *\\*) . "$1" ;;
1338
# func_resolve_sysroot PATH
1339
# Replace a leading = in PATH with a sysroot. Store the result into
1340
# func_resolve_sysroot_result
1341
func_resolve_sysroot ()
1343
func_resolve_sysroot_result=$1
1344
case $func_resolve_sysroot_result in
1346
func_stripname '=' '' "$func_resolve_sysroot_result"
1347
func_resolve_sysroot_result=$lt_sysroot$func_stripname_result
1352
# func_replace_sysroot PATH
1353
# If PATH begins with the sysroot, replace it with = and
1354
# store the result into func_replace_sysroot_result.
1355
func_replace_sysroot ()
1357
case "$lt_sysroot:$1" in
1359
func_stripname "$lt_sysroot" '' "$1"
1360
func_replace_sysroot_result="=$func_stripname_result"
1363
# Including no sysroot.
1364
func_replace_sysroot_result=$1
1369
# func_infer_tag arg
1370
# Infer tagged configuration to use if any are available and
1371
# if one wasn't chosen via the "--tag" command line option.
1372
# Only attempt this if the compiler in the base compile
1373
# command doesn't match the default compiler.
1374
# arg is usually of the form 'gcc ...'
1379
# FreeBSD-specific: where we install compilers with non-standard names
1380
tag_compilers_CC="*cc cc* *gcc gcc* clang"
1381
tag_compilers_CXX="*c++ c++* *g++ g++* clang++"
1382
base_compiler=`set -- "$@"; echo $1`
1384
# If $tagname isn't set, then try to infer if the default "CC" tag applies
1385
if test -z "$tagname"; then
1386
for zp in $tag_compilers_CC; do
1387
case $base_compiler in
1388
$zp) tagname="CC"; break;;
333
*db | *dbx | *strace | *truss)
343
# If we have no mode, but dlfiles were specified, then do execute mode.
344
test -n "$execute_dlfiles" && mode=execute
346
# Just use the default operation mode.
347
if test -z "$mode"; then
348
if test -n "$nonopt"; then
349
$echo "$modename: warning: cannot infer operation mode from \`$nonopt'" 1>&2
351
$echo "$modename: warning: cannot infer operation mode without MODE-ARGS" 1>&2
1393
if test -n "$available_tags" && test -z "$tagname"; then
1396
func_append_quoted CC_quoted "$arg"
1398
CC_expanded=`func_echo_all $CC`
1399
CC_quoted_expanded=`func_echo_all $CC_quoted`
1401
# Blanks in the command may have been stripped by the calling shell,
1402
# but not from the CC environment variable when configure was run.
1403
" $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \
1404
" $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*) ;;
1405
# Blanks at the start of $base_compile will cause this to fail
1406
# if we don't check for them as well.
1408
for z in $available_tags; do
1409
if $GREP "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then
1410
# Evaluate the configuration.
1411
eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`"
1414
# Double-quote args containing other shell metacharacters.
1415
func_append_quoted CC_quoted "$arg"
1417
CC_expanded=`func_echo_all $CC`
1418
CC_quoted_expanded=`func_echo_all $CC_quoted`
1420
" $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \
1421
" $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*)
1422
# The compiler in the base compile command matches
1423
# the one in the tagged configuration.
1424
# Assume this is the tagged configuration we want.
1430
# FreeBSD-specific: try compilers based on inferred tag
1431
if test -z "$tagname"; then
1432
eval "tag_compilers=\$tag_compilers_${z}"
1433
if test -n "$tag_compilers"; then
1434
for zp in $tag_compilers; do
1435
case $base_compiler in
1436
$zp) tagname=$z; break;;
1439
if test -n "$tagname"; then
1446
# If $tagname still isn't set, then no tagged configuration
1447
# was found and let the user know that the "--tag" command
1448
# line option must be used.
1449
if test -z "$tagname"; then
1450
func_echo "unable to infer tagged configuration"
1451
func_fatal_error "specify a tag with \`--tag'"
1453
# func_verbose "using $tagname tagged configuration"
1462
# func_write_libtool_object output_name pic_name nonpic_name
1463
# Create a libtool object file (analogous to a ".la" file),
1464
# but don't create it if we're doing a dry run.
1465
func_write_libtool_object ()
1468
if test "$build_libtool_libs" = yes; then
1474
if test "$build_old_libs" = yes; then
1475
write_oldobj=\'${3}\'
1481
cat >${write_libobj}T <<EOF
1482
# $write_libobj - a libtool object file
1483
# Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
1485
# Please DO NOT delete this file!
1486
# It is necessary for linking the library.
1488
# Name of the PIC object.
1489
pic_object=$write_lobj
1491
# Name of the non-PIC object
1492
non_pic_object=$write_oldobj
1495
$MV "${write_libobj}T" "${write_libobj}"
1500
##################################################
1501
# FILE NAME AND PATH CONVERSION HELPER FUNCTIONS #
1502
##################################################
1504
# func_convert_core_file_wine_to_w32 ARG
1505
# Helper function used by file name conversion functions when $build is *nix,
1506
# and $host is mingw, cygwin, or some other w32 environment. Relies on a
1507
# correctly configured wine environment available, with the winepath program
1508
# in $build's $PATH.
1510
# ARG is the $build file name to be converted to w32 format.
1511
# Result is available in $func_convert_core_file_wine_to_w32_result, and will
1512
# be empty on error (or when ARG is empty)
1513
func_convert_core_file_wine_to_w32 ()
1516
func_convert_core_file_wine_to_w32_result="$1"
1517
if test -n "$1"; then
1518
# Unfortunately, winepath does not exit with a non-zero error code, so we
1519
# are forced to check the contents of stdout. On the other hand, if the
1520
# command is not found, the shell will set an exit code of 127 and print
1521
# *an error message* to stdout. So we must check for both error code of
1522
# zero AND non-empty stdout, which explains the odd construction:
1523
func_convert_core_file_wine_to_w32_tmp=`winepath -w "$1" 2>/dev/null`
1524
if test "$?" -eq 0 && test -n "${func_convert_core_file_wine_to_w32_tmp}"; then
1525
func_convert_core_file_wine_to_w32_result=`$ECHO "$func_convert_core_file_wine_to_w32_tmp" |
1526
$SED -e "$lt_sed_naive_backslashify"`
1528
func_convert_core_file_wine_to_w32_result=
1532
# end: func_convert_core_file_wine_to_w32
1535
# func_convert_core_path_wine_to_w32 ARG
1536
# Helper function used by path conversion functions when $build is *nix, and
1537
# $host is mingw, cygwin, or some other w32 environment. Relies on a correctly
1538
# configured wine environment available, with the winepath program in $build's
1539
# $PATH. Assumes ARG has no leading or trailing path separator characters.
1541
# ARG is path to be converted from $build format to win32.
1542
# Result is available in $func_convert_core_path_wine_to_w32_result.
1543
# Unconvertible file (directory) names in ARG are skipped; if no directory names
1544
# are convertible, then the result may be empty.
1545
func_convert_core_path_wine_to_w32 ()
1548
# unfortunately, winepath doesn't convert paths, only file names
1549
func_convert_core_path_wine_to_w32_result=""
1550
if test -n "$1"; then
1553
for func_convert_core_path_wine_to_w32_f in $1; do
1555
func_convert_core_file_wine_to_w32 "$func_convert_core_path_wine_to_w32_f"
1556
if test -n "$func_convert_core_file_wine_to_w32_result" ; then
1557
if test -z "$func_convert_core_path_wine_to_w32_result"; then
1558
func_convert_core_path_wine_to_w32_result="$func_convert_core_file_wine_to_w32_result"
1560
func_append func_convert_core_path_wine_to_w32_result ";$func_convert_core_file_wine_to_w32_result"
358
# Only execute mode is allowed to have -dlopen flags.
359
if test -n "$execute_dlfiles" && test "$mode" != execute; then
360
$echo "$modename: unrecognized option \`-dlopen'" 1>&2
365
# Change the help message to a mode-specific one.
367
help="Try \`$modename --help --mode=$mode' for more information."
369
# These modes are in order of execution frequency so that they run quickly.
371
# libtool compile mode
373
modename="$modename: compile"
1567
# end: func_convert_core_path_wine_to_w32
1570
# func_cygpath ARGS...
1571
# Wrapper around calling the cygpath program via LT_CYGPATH. This is used when
1572
# when (1) $build is *nix and Cygwin is hosted via a wine environment; or (2)
1573
# $build is MSYS and $host is Cygwin, or (3) $build is Cygwin. In case (1) or
1574
# (2), returns the Cygwin file name or path in func_cygpath_result (input
1575
# file name or path is assumed to be in w32 format, as previously converted
1576
# from $build's *nix or MSYS format). In case (3), returns the w32 file name
1577
# or path in func_cygpath_result (input file name or path is assumed to be in
1578
# Cygwin format). Returns an empty string on error.
1580
# ARGS are passed to cygpath, with the last one being the file name or path to
1583
# Specify the absolute *nix (or w32) name to cygpath in the LT_CYGPATH
1584
# environment variable; do not put it in $PATH.
1588
if test -n "$LT_CYGPATH" && test -f "$LT_CYGPATH"; then
1589
func_cygpath_result=`$LT_CYGPATH "$@" 2>/dev/null`
1590
if test "$?" -ne 0; then
1591
# on failure, ensure result is empty
1592
func_cygpath_result=
1595
func_cygpath_result=
1596
func_error "LT_CYGPATH is empty or specifies non-existent file: \`$LT_CYGPATH'"
1602
# func_convert_core_msys_to_w32 ARG
1603
# Convert file name or path ARG from MSYS format to w32 format. Return
1604
# result in func_convert_core_msys_to_w32_result.
1605
func_convert_core_msys_to_w32 ()
1608
# awkward: cmd appends spaces to result
1609
func_convert_core_msys_to_w32_result=`( cmd //c echo "$1" ) 2>/dev/null |
1610
$SED -e 's/[ ]*$//' -e "$lt_sed_naive_backslashify"`
1612
#end: func_convert_core_msys_to_w32
1615
# func_convert_file_check ARG1 ARG2
1616
# Verify that ARG1 (a file name in $build format) was converted to $host
1617
# format in ARG2. Otherwise, emit an error message, but continue (resetting
1618
# func_to_host_file_result to ARG1).
1619
func_convert_file_check ()
1622
if test -z "$2" && test -n "$1" ; then
1623
func_error "Could not determine host file name corresponding to"
1625
func_error "Continuing, but uninstalled executables may not work."
1627
func_to_host_file_result="$1"
1630
# end func_convert_file_check
1633
# func_convert_path_check FROM_PATHSEP TO_PATHSEP FROM_PATH TO_PATH
1634
# Verify that FROM_PATH (a path in $build format) was converted to $host
1635
# format in TO_PATH. Otherwise, emit an error message, but continue, resetting
1636
# func_to_host_file_result to a simplistic fallback value (see below).
1637
func_convert_path_check ()
1640
if test -z "$4" && test -n "$3"; then
1641
func_error "Could not determine the host path corresponding to"
1643
func_error "Continuing, but uninstalled executables may not work."
1644
# Fallback. This is a deliberately simplistic "conversion" and
1645
# should not be "improved". See libtool.info.
1646
if test "x$1" != "x$2"; then
1647
lt_replace_pathsep_chars="s|$1|$2|g"
1648
func_to_host_path_result=`echo "$3" |
1649
$SED -e "$lt_replace_pathsep_chars"`
1651
func_to_host_path_result="$3"
1655
# end func_convert_path_check
1658
# func_convert_path_front_back_pathsep FRONTPAT BACKPAT REPL ORIG
1659
# Modifies func_to_host_path_result by prepending REPL if ORIG matches FRONTPAT
1660
# and appending REPL if ORIG matches BACKPAT.
1661
func_convert_path_front_back_pathsep ()
1665
$1 ) func_to_host_path_result="$3$func_to_host_path_result"
1669
$2 ) func_append func_to_host_path_result "$3"
1673
# end func_convert_path_front_back_pathsep
1676
##################################################
1677
# $build to $host FILE NAME CONVERSION FUNCTIONS #
1678
##################################################
1679
# invoked via `$to_host_file_cmd ARG'
1681
# In each case, ARG is the path to be converted from $build to $host format.
1682
# Result will be available in $func_to_host_file_result.
1685
# func_to_host_file ARG
1686
# Converts the file name ARG from $build format to $host format. Return result
1687
# in func_to_host_file_result.
1688
func_to_host_file ()
1691
$to_host_file_cmd "$1"
1693
# end func_to_host_file
1696
# func_to_tool_file ARG LAZY
1697
# converts the file name ARG from $build format to toolchain format. Return
1698
# result in func_to_tool_file_result. If the conversion in use is listed
1699
# in (the comma separated) LAZY, no conversion takes place.
1700
func_to_tool_file ()
1704
*,"$to_tool_file_cmd",*)
1705
func_to_tool_file_result=$1
1708
$to_tool_file_cmd "$1"
1709
func_to_tool_file_result=$func_to_host_file_result
1713
# end func_to_tool_file
1716
# func_convert_file_noop ARG
1717
# Copy ARG to func_to_host_file_result.
1718
func_convert_file_noop ()
1720
func_to_host_file_result="$1"
1722
# end func_convert_file_noop
1725
# func_convert_file_msys_to_w32 ARG
1726
# Convert file name ARG from (mingw) MSYS to (mingw) w32 format; automatic
1727
# conversion to w32 is not available inside the cwrapper. Returns result in
1728
# func_to_host_file_result.
1729
func_convert_file_msys_to_w32 ()
1732
func_to_host_file_result="$1"
1733
if test -n "$1"; then
1734
func_convert_core_msys_to_w32 "$1"
1735
func_to_host_file_result="$func_convert_core_msys_to_w32_result"
1737
func_convert_file_check "$1" "$func_to_host_file_result"
1739
# end func_convert_file_msys_to_w32
1742
# func_convert_file_cygwin_to_w32 ARG
1743
# Convert file name ARG from Cygwin to w32 format. Returns result in
1744
# func_to_host_file_result.
1745
func_convert_file_cygwin_to_w32 ()
1748
func_to_host_file_result="$1"
1749
if test -n "$1"; then
1750
# because $build is cygwin, we call "the" cygpath in $PATH; no need to use
1751
# LT_CYGPATH in this case.
1752
func_to_host_file_result=`cygpath -m "$1"`
1754
func_convert_file_check "$1" "$func_to_host_file_result"
1756
# end func_convert_file_cygwin_to_w32
1759
# func_convert_file_nix_to_w32 ARG
1760
# Convert file name ARG from *nix to w32 format. Requires a wine environment
1761
# and a working winepath. Returns result in func_to_host_file_result.
1762
func_convert_file_nix_to_w32 ()
1765
func_to_host_file_result="$1"
1766
if test -n "$1"; then
1767
func_convert_core_file_wine_to_w32 "$1"
1768
func_to_host_file_result="$func_convert_core_file_wine_to_w32_result"
1770
func_convert_file_check "$1" "$func_to_host_file_result"
1772
# end func_convert_file_nix_to_w32
1775
# func_convert_file_msys_to_cygwin ARG
1776
# Convert file name ARG from MSYS to Cygwin format. Requires LT_CYGPATH set.
1777
# Returns result in func_to_host_file_result.
1778
func_convert_file_msys_to_cygwin ()
1781
func_to_host_file_result="$1"
1782
if test -n "$1"; then
1783
func_convert_core_msys_to_w32 "$1"
1784
func_cygpath -u "$func_convert_core_msys_to_w32_result"
1785
func_to_host_file_result="$func_cygpath_result"
1787
func_convert_file_check "$1" "$func_to_host_file_result"
1789
# end func_convert_file_msys_to_cygwin
1792
# func_convert_file_nix_to_cygwin ARG
1793
# Convert file name ARG from *nix to Cygwin format. Requires Cygwin installed
1794
# in a wine environment, working winepath, and LT_CYGPATH set. Returns result
1795
# in func_to_host_file_result.
1796
func_convert_file_nix_to_cygwin ()
1799
func_to_host_file_result="$1"
1800
if test -n "$1"; then
1801
# convert from *nix to w32, then use cygpath to convert from w32 to cygwin.
1802
func_convert_core_file_wine_to_w32 "$1"
1803
func_cygpath -u "$func_convert_core_file_wine_to_w32_result"
1804
func_to_host_file_result="$func_cygpath_result"
1806
func_convert_file_check "$1" "$func_to_host_file_result"
1808
# end func_convert_file_nix_to_cygwin
1811
#############################################
1812
# $build to $host PATH CONVERSION FUNCTIONS #
1813
#############################################
1814
# invoked via `$to_host_path_cmd ARG'
1816
# In each case, ARG is the path to be converted from $build to $host format.
1817
# The result will be available in $func_to_host_path_result.
1819
# Path separators are also converted from $build format to $host format. If
1820
# ARG begins or ends with a path separator character, it is preserved (but
1821
# converted to $host format) on output.
1823
# All path conversion functions are named using the following convention:
1824
# file name conversion function : func_convert_file_X_to_Y ()
1825
# path conversion function : func_convert_path_X_to_Y ()
1826
# where, for any given $build/$host combination the 'X_to_Y' value is the
1827
# same. If conversion functions are added for new $build/$host combinations,
1828
# the two new functions must follow this pattern, or func_init_to_host_path_cmd
1832
# func_init_to_host_path_cmd
1833
# Ensures that function "pointer" variable $to_host_path_cmd is set to the
1834
# appropriate value, based on the value of $to_host_file_cmd.
1836
func_init_to_host_path_cmd ()
1839
if test -z "$to_host_path_cmd"; then
1840
func_stripname 'func_convert_file_' '' "$to_host_file_cmd"
1841
to_host_path_cmd="func_convert_path_${func_stripname_result}"
1846
# func_to_host_path ARG
1847
# Converts the path ARG from $build format to $host format. Return result
1848
# in func_to_host_path_result.
1849
func_to_host_path ()
1852
func_init_to_host_path_cmd
1853
$to_host_path_cmd "$1"
1855
# end func_to_host_path
1858
# func_convert_path_noop ARG
1859
# Copy ARG to func_to_host_path_result.
1860
func_convert_path_noop ()
1862
func_to_host_path_result="$1"
1864
# end func_convert_path_noop
1867
# func_convert_path_msys_to_w32 ARG
1868
# Convert path ARG from (mingw) MSYS to (mingw) w32 format; automatic
1869
# conversion to w32 is not available inside the cwrapper. Returns result in
1870
# func_to_host_path_result.
1871
func_convert_path_msys_to_w32 ()
1874
func_to_host_path_result="$1"
1875
if test -n "$1"; then
1876
# Remove leading and trailing path separator characters from ARG. MSYS
1877
# behavior is inconsistent here; cygpath turns them into '.;' and ';.';
1878
# and winepath ignores them completely.
1879
func_stripname : : "$1"
1880
func_to_host_path_tmp1=$func_stripname_result
1881
func_convert_core_msys_to_w32 "$func_to_host_path_tmp1"
1882
func_to_host_path_result="$func_convert_core_msys_to_w32_result"
1883
func_convert_path_check : ";" \
1884
"$func_to_host_path_tmp1" "$func_to_host_path_result"
1885
func_convert_path_front_back_pathsep ":*" "*:" ";" "$1"
1888
# end func_convert_path_msys_to_w32
1891
# func_convert_path_cygwin_to_w32 ARG
1892
# Convert path ARG from Cygwin to w32 format. Returns result in
1893
# func_to_host_file_result.
1894
func_convert_path_cygwin_to_w32 ()
1897
func_to_host_path_result="$1"
1898
if test -n "$1"; then
1899
# See func_convert_path_msys_to_w32:
1900
func_stripname : : "$1"
1901
func_to_host_path_tmp1=$func_stripname_result
1902
func_to_host_path_result=`cygpath -m -p "$func_to_host_path_tmp1"`
1903
func_convert_path_check : ";" \
1904
"$func_to_host_path_tmp1" "$func_to_host_path_result"
1905
func_convert_path_front_back_pathsep ":*" "*:" ";" "$1"
1908
# end func_convert_path_cygwin_to_w32
1911
# func_convert_path_nix_to_w32 ARG
1912
# Convert path ARG from *nix to w32 format. Requires a wine environment and
1913
# a working winepath. Returns result in func_to_host_file_result.
1914
func_convert_path_nix_to_w32 ()
1917
func_to_host_path_result="$1"
1918
if test -n "$1"; then
1919
# See func_convert_path_msys_to_w32:
1920
func_stripname : : "$1"
1921
func_to_host_path_tmp1=$func_stripname_result
1922
func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1"
1923
func_to_host_path_result="$func_convert_core_path_wine_to_w32_result"
1924
func_convert_path_check : ";" \
1925
"$func_to_host_path_tmp1" "$func_to_host_path_result"
1926
func_convert_path_front_back_pathsep ":*" "*:" ";" "$1"
1929
# end func_convert_path_nix_to_w32
1932
# func_convert_path_msys_to_cygwin ARG
1933
# Convert path ARG from MSYS to Cygwin format. Requires LT_CYGPATH set.
1934
# Returns result in func_to_host_file_result.
1935
func_convert_path_msys_to_cygwin ()
1938
func_to_host_path_result="$1"
1939
if test -n "$1"; then
1940
# See func_convert_path_msys_to_w32:
1941
func_stripname : : "$1"
1942
func_to_host_path_tmp1=$func_stripname_result
1943
func_convert_core_msys_to_w32 "$func_to_host_path_tmp1"
1944
func_cygpath -u -p "$func_convert_core_msys_to_w32_result"
1945
func_to_host_path_result="$func_cygpath_result"
1946
func_convert_path_check : : \
1947
"$func_to_host_path_tmp1" "$func_to_host_path_result"
1948
func_convert_path_front_back_pathsep ":*" "*:" : "$1"
1951
# end func_convert_path_msys_to_cygwin
1954
# func_convert_path_nix_to_cygwin ARG
1955
# Convert path ARG from *nix to Cygwin format. Requires Cygwin installed in a
1956
# a wine environment, working winepath, and LT_CYGPATH set. Returns result in
1957
# func_to_host_file_result.
1958
func_convert_path_nix_to_cygwin ()
1961
func_to_host_path_result="$1"
1962
if test -n "$1"; then
1963
# Remove leading and trailing path separator characters from
1964
# ARG. msys behavior is inconsistent here, cygpath turns them
1965
# into '.;' and ';.', and winepath ignores them completely.
1966
func_stripname : : "$1"
1967
func_to_host_path_tmp1=$func_stripname_result
1968
func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1"
1969
func_cygpath -u -p "$func_convert_core_path_wine_to_w32_result"
1970
func_to_host_path_result="$func_cygpath_result"
1971
func_convert_path_check : : \
1972
"$func_to_host_path_tmp1" "$func_to_host_path_result"
1973
func_convert_path_front_back_pathsep ":*" "*:" : "$1"
1976
# end func_convert_path_nix_to_cygwin
1979
# func_mode_compile arg...
1980
func_mode_compile ()
374
1983
# Get the compilation command and the source file.
376
1985
srcfile="$nonopt" # always keep a non-empty value in "srcfile"
793
2296
avoid parallel builds (make -j) in this platform, or get a better
2299
$opt_dry_run || $RM $removelist
800
2303
# Just move the object if needed
801
2304
if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then
802
$show "$mv $output_obj $obj"
803
if $run $mv $output_obj $obj; then :
811
# Append the name of the non-PIC object the libtool object file.
812
# Only append if the libtool object file exists.
813
test -z "$run" && cat >> ${libobj}T <<EOF
814
# Name of the non-PIC object.
815
non_pic_object='$objname'
819
# Append the name of the non-PIC object the libtool object file.
820
# Only append if the libtool object file exists.
821
test -z "$run" && cat >> ${libobj}T <<EOF
822
# Name of the non-PIC object.
828
$run $mv "${libobj}T" "${libobj}"
830
# Unlock the critical section if it was locked
831
if test "$need_locks" != no; then
840
modename="$modename: link"
2305
func_show_eval '$MV "$output_obj" "$obj"' \
2306
'error=$?; $opt_dry_run || $RM $removelist; exit $error'
2311
func_write_libtool_object "$libobj" "$objdir/$objname" "$objname"
2313
# Unlock the critical section if it was locked
2314
if test "$need_locks" != no; then
2315
removelist=$lockfile
2324
test "$opt_mode" = compile && func_mode_compile ${1+"$@"}
2329
# We need to display help for each of the modes.
2332
# Generic help is extracted from the usage comments
2333
# at the start of this file.
2339
"Usage: $progname [OPTION]... --mode=clean RM [RM-OPTION]... FILE...
2341
Remove files from the build directory.
2343
RM is the name of the program to use to delete files associated with each FILE
2344
(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
2347
If FILE is a libtool library, object or program, all the files associated
2348
with it are deleted. Otherwise, only FILE itself is deleted using RM."
2353
"Usage: $progname [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE
2355
Compile a source file into a libtool library object.
2357
This mode accepts the following additional options:
2359
-o OUTPUT-FILE set the output file name to OUTPUT-FILE
2360
-no-suppress do not suppress compiler output for multiple passes
2361
-prefer-pic try to build PIC objects only
2362
-prefer-non-pic try to build non-PIC objects only
2363
-shared do not build a \`.o' file suitable for static linking
2364
-static only build a \`.o' file suitable for static linking
2365
-Wc,FLAG pass FLAG directly to the compiler
2367
COMPILE-COMMAND is a command to be used in creating a \`standard' object file
2368
from the given SOURCEFILE.
2370
The output file name is determined by removing the directory component from
2371
SOURCEFILE, then substituting the C source code suffix \`.c' with the
2372
library object suffix, \`.lo'."
2377
"Usage: $progname [OPTION]... --mode=execute COMMAND [ARGS]...
2379
Automatically set library path, then run a program.
2381
This mode accepts the following additional options:
2383
-dlopen FILE add the directory containing FILE to the library path
2385
This mode sets the library path environment variable according to \`-dlopen'
2388
If any of the ARGS are libtool executable wrappers, then they are translated
2389
into their corresponding uninstalled binary, and any of their required library
2390
directories are added to the library path.
2392
Then, COMMAND is executed, with ARGS as arguments."
2397
"Usage: $progname [OPTION]... --mode=finish [LIBDIR]...
2399
Complete the installation of libtool libraries.
2401
Each LIBDIR is a directory that contains libtool libraries.
2403
The commands that this mode executes may require superuser privileges. Use
2404
the \`--dry-run' option if you just want to see what would be executed."
2409
"Usage: $progname [OPTION]... --mode=install INSTALL-COMMAND...
2411
Install executables or libraries.
2413
INSTALL-COMMAND is the installation command. The first component should be
2414
either the \`install' or \`cp' program.
2416
The following components of INSTALL-COMMAND are treated specially:
2418
-inst-prefix-dir PREFIX-DIR Use PREFIX-DIR as a staging area for installation
2420
The rest of the components are interpreted as arguments to that command (only
2421
BSD-compatible install options are recognized)."
2426
"Usage: $progname [OPTION]... --mode=link LINK-COMMAND...
2428
Link object files or libraries together to form another library, or to
2429
create an executable program.
2431
LINK-COMMAND is a command using the C compiler that you would use to create
2432
a program from several object files.
2434
The following components of LINK-COMMAND are treated specially:
2436
-all-static do not do any dynamic linking at all
2437
-avoid-version do not add a version suffix if possible
2438
-bindir BINDIR specify path to binaries directory (for systems where
2439
libraries must be found in the PATH setting at runtime)
2440
-dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime
2441
-dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols
2442
-export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
2443
-export-symbols SYMFILE
2444
try to export only the symbols listed in SYMFILE
2445
-export-symbols-regex REGEX
2446
try to export only the symbols matching REGEX
2447
-LLIBDIR search LIBDIR for required installed libraries
2448
-lNAME OUTPUT-FILE requires the installed library libNAME
2449
-module build a library that can dlopened
2450
-no-fast-install disable the fast-install mode
2451
-no-install link a not-installable executable
2452
-no-undefined declare that a library does not refer to external symbols
2453
-o OUTPUT-FILE create OUTPUT-FILE from the specified objects
2454
-objectlist FILE Use a list of object files found in FILE to specify objects
2455
-precious-files-regex REGEX
2456
don't remove output files matching REGEX
2457
-release RELEASE specify package release information
2458
-rpath LIBDIR the created library will eventually be installed in LIBDIR
2459
-R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries
2460
-shared only do dynamic linking of libtool libraries
2461
-shrext SUFFIX override the standard shared library file extension
2462
-static do not do any dynamic linking of uninstalled libtool libraries
2463
-static-libtool-libs
2464
do not do any dynamic linking of libtool libraries
2465
-version-info CURRENT[:REVISION[:AGE]]
2466
specify library version info [each variable defaults to 0]
2467
-weak LIBNAME declare that the target provides the LIBNAME interface
2469
-Xcompiler FLAG pass linker-specific FLAG directly to the compiler
2471
-Xlinker FLAG pass linker-specific FLAG directly to the linker
2472
-XCClinker FLAG pass link-specific FLAG to the compiler driver (CC)
2474
All other options (arguments beginning with \`-') are ignored.
2476
Every other argument is treated as a filename. Files ending in \`.la' are
2477
treated as uninstalled libtool libraries, other files are standard or library
2480
If the OUTPUT-FILE ends in \`.la', then a libtool library is created,
2481
only library objects (\`.lo' files) may be specified, and \`-rpath' is
2482
required, except when creating a convenience library.
2484
If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created
2485
using \`ar' and \`ranlib', or on Windows using \`lib'.
2487
If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file
2488
is created, otherwise an executable program is created."
2493
"Usage: $progname [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE...
2495
Remove libraries from an installation directory.
2497
RM is the name of the program to use to delete files associated with each FILE
2498
(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
2501
If FILE is a libtool library, all the files associated with it are deleted.
2502
Otherwise, only FILE itself is deleted using RM."
2506
func_fatal_help "invalid operation mode \`$opt_mode'"
2511
$ECHO "Try \`$progname --help' for more information about other modes."
2514
# Now that we've collected a possible --mode arg, show help if necessary
2516
if test "$opt_help" = :; then
2521
for opt_mode in compile link execute install finish uninstall clean; do
2524
} | sed -n '1p; 2,$s/^Usage:/ or: /p'
2527
for opt_mode in compile link execute install finish uninstall clean; do
2533
/^When reporting/,/^Report/{
2538
/information about other modes/d
2539
/more detailed .*MODE/d
2540
s/^Usage:.*--mode=\([^ ]*\) .*/Description of \1 mode:/'
2546
# func_mode_execute arg...
2547
func_mode_execute ()
2550
# The first argument is the command name.
2553
func_fatal_help "you must specify a COMMAND"
2555
# Handle -dlopen flags immediately.
2556
for file in $opt_dlopen; do
2558
|| func_fatal_help "\`$file' is not a file"
2563
func_resolve_sysroot "$file"
2564
file=$func_resolve_sysroot_result
2566
# Check to see that this really is a libtool archive.
2567
func_lalib_unsafe_p "$file" \
2568
|| func_fatal_help "\`$lib' is not a valid libtool archive"
2570
# Read the libtool library.
2575
# Skip this library if it cannot be dlopened.
2576
if test -z "$dlname"; then
2577
# Warn if it was a shared library.
2578
test -n "$library_names" && \
2579
func_warning "\`$file' was not linked with \`-export-dynamic'"
2583
func_dirname "$file" "" "."
2584
dir="$func_dirname_result"
2586
if test -f "$dir/$objdir/$dlname"; then
2587
func_append dir "/$objdir"
2589
if test ! -f "$dir/$dlname"; then
2590
func_fatal_error "cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'"
2596
# Just add the directory containing the .lo file.
2597
func_dirname "$file" "" "."
2598
dir="$func_dirname_result"
2602
func_warning "\`-dlopen' is ignored for non-libtool libraries and objects"
2607
# Get the absolute pathname.
2608
absdir=`cd "$dir" && pwd`
2609
test -n "$absdir" && dir="$absdir"
2611
# Now add the directory to shlibpath_var.
2612
if eval "test -z \"\$$shlibpath_var\""; then
2613
eval "$shlibpath_var=\"\$dir\""
2615
eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\""
2619
# This variable tells wrapper scripts just to set shlibpath_var
2620
# rather than running their programs.
2621
libtool_execute_magic="$magic"
2623
# Check if any of the arguments is a wrapper script.
2628
-* | *.la | *.lo ) ;;
2630
# Do a test to see if this is really a libtool program.
2631
if func_ltwrapper_script_p "$file"; then
2633
# Transform arg to wrapped name.
2634
file="$progdir/$program"
2635
elif func_ltwrapper_executable_p "$file"; then
2636
func_ltwrapper_scriptname "$file"
2637
func_source "$func_ltwrapper_scriptname_result"
2638
# Transform arg to wrapped name.
2639
file="$progdir/$program"
2643
# Quote arguments (to preserve shell metacharacters).
2644
func_append_quoted args "$file"
2647
if test "X$opt_dry_run" = Xfalse; then
2648
if test -n "$shlibpath_var"; then
2649
# Export the shlibpath_var.
2650
eval "export $shlibpath_var"
2653
# Restore saved environment variables
2654
for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
2656
eval "if test \"\${save_$lt_var+set}\" = set; then
2657
$lt_var=\$save_$lt_var; export $lt_var
2663
# Now prepare to actually exec the command.
2664
exec_cmd="\$cmd$args"
2666
# Display what would be done.
2667
if test -n "$shlibpath_var"; then
2668
eval "\$ECHO \"\$shlibpath_var=\$$shlibpath_var\""
2669
echo "export $shlibpath_var"
2676
test "$opt_mode" = execute && func_mode_execute ${1+"$@"}
2679
# func_mode_finish arg...
2687
for opt in "$nonopt" ${1+"$@"}
2689
if test -d "$opt"; then
2690
func_append libdirs " $opt"
2692
elif test -f "$opt"; then
2693
if func_lalib_unsafe_p "$opt"; then
2694
func_append libs " $opt"
2696
func_warning "\`$opt' is not a valid libtool archive"
2700
func_fatal_error "invalid argument \`$opt'"
2704
if test -n "$libs"; then
2705
if test -n "$lt_sysroot"; then
2706
sysroot_regex=`$ECHO "$lt_sysroot" | $SED "$sed_make_literal_regex"`
2707
sysroot_cmd="s/\([ ']\)$sysroot_regex/\1/g;"
2712
# Remove sysroot references
2713
if $opt_dry_run; then
2714
for lib in $libs; do
2715
echo "removing references to $lt_sysroot and \`=' prefixes from $lib"
2718
tmpdir=`func_mktempdir`
2719
for lib in $libs; do
2720
sed -e "${sysroot_cmd} s/\([ ']-[LR]\)=/\1/g; s/\([ ']\)=/\1/g" $lib \
2722
mv -f $tmpdir/tmp-la $lib
2728
if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
2729
for libdir in $libdirs; do
2730
if test -n "$finish_cmds"; then
2731
# Do each command in the finish commands.
2732
func_execute_cmds "$finish_cmds" 'admincmds="$admincmds
2735
if test -n "$finish_eval"; then
2736
# Do the single finish_eval.
2737
eval cmds=\"$finish_eval\"
2738
$opt_dry_run || eval "$cmds" || func_append admincmds "
2744
# Exit here if they wanted silent mode.
2745
$opt_silent && exit $EXIT_SUCCESS
2747
if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
2748
echo "----------------------------------------------------------------------"
2749
echo "Libraries have been installed in:"
2750
for libdir in $libdirs; do
2754
echo "If you ever happen to want to link against installed libraries"
2755
echo "in a given directory, LIBDIR, you must either use libtool, and"
2756
echo "specify the full pathname of the library, or use the \`-LLIBDIR'"
2757
echo "flag during linking and do at least one of the following:"
2758
if test -n "$shlibpath_var"; then
2759
echo " - add LIBDIR to the \`$shlibpath_var' environment variable"
2760
echo " during execution"
2762
if test -n "$runpath_var"; then
2763
echo " - add LIBDIR to the \`$runpath_var' environment variable"
2764
echo " during linking"
2766
if test -n "$hardcode_libdir_flag_spec"; then
2768
eval flag=\"$hardcode_libdir_flag_spec\"
2770
$ECHO " - use the \`$flag' linker flag"
2772
if test -n "$admincmds"; then
2773
$ECHO " - have your system administrator run these commands:$admincmds"
2775
if test -f /etc/ld.so.conf; then
2776
echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'"
2780
echo "See any operating system documentation about shared libraries for"
2782
solaris2.[6789]|solaris2.1[0-9])
2783
echo "more information, such as the ld(1), crle(1) and ld.so(8) manual"
2787
echo "more information, such as the ld(1) and ld.so(8) manual pages."
2790
echo "----------------------------------------------------------------------"
2795
test "$opt_mode" = finish && func_mode_finish ${1+"$@"}
2798
# func_mode_install arg...
2799
func_mode_install ()
2802
# There may be an optional sh(1) argument at the beginning of
2803
# install_prog (especially on Windows NT).
2804
if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh ||
2805
# Allow the use of GNU shtool's install command.
2806
case $nonopt in *shtool*) :;; *) false;; esac; then
2807
# Aesthetically quote it.
2808
func_quote_for_eval "$nonopt"
2809
install_prog="$func_quote_for_eval_result "
2817
# The real first argument should be the name of the installation program.
2818
# Aesthetically quote it.
2819
func_quote_for_eval "$arg"
2820
func_append install_prog "$func_quote_for_eval_result"
2821
install_shared_prog=$install_prog
2822
case " $install_prog " in
2823
*[\\\ /]cp\ *) install_cp=: ;;
2824
*) install_cp=false ;;
2827
# We need to accept at least all the BSD install flags.
2839
if test -n "$dest"; then
2840
func_append files " $dest"
2848
if $install_cp; then :; else
2862
# If the previous option needed an argument, then skip it.
2863
if test -n "$prev"; then
2864
if test "x$prev" = x-m && test -n "$install_override_mode"; then
2865
arg2=$install_override_mode
2876
# Aesthetically quote the argument.
2877
func_quote_for_eval "$arg"
2878
func_append install_prog " $func_quote_for_eval_result"
2879
if test -n "$arg2"; then
2880
func_quote_for_eval "$arg2"
2882
func_append install_shared_prog " $func_quote_for_eval_result"
2885
test -z "$install_prog" && \
2886
func_fatal_help "you must specify an install program"
2888
test -n "$prev" && \
2889
func_fatal_help "the \`$prev' option requires an argument"
2891
if test -n "$install_override_mode" && $no_mode; then
2892
if $install_cp; then :; else
2893
func_quote_for_eval "$install_override_mode"
2894
func_append install_shared_prog " -m $func_quote_for_eval_result"
2898
if test -z "$files"; then
2899
if test -z "$dest"; then
2900
func_fatal_help "no file or destination specified"
2902
func_fatal_help "you must specify a destination"
2906
# Strip any trailing slash from the destination.
2907
func_stripname '' '/' "$dest"
2908
dest=$func_stripname_result
2910
# Check to see that the destination is a directory.
2911
test -d "$dest" && isdir=yes
2912
if test "$isdir" = yes; then
2916
func_dirname_and_basename "$dest" "" "."
2917
destdir="$func_dirname_result"
2918
destname="$func_basename_result"
2920
# Not a directory, so check to see that there is only one file specified.
2921
set dummy $files; shift
2922
test "$#" -gt 1 && \
2923
func_fatal_help "\`$dest' is not a directory"
2926
[\\/]* | [A-Za-z]:[\\/]*) ;;
2928
for file in $files; do
2932
func_fatal_help "\`$destdir' must be an absolute directory name"
2939
# This variable tells wrapper scripts just to set variables rather
2940
# than running their programs.
2941
libtool_install_magic="$magic"
2946
for file in $files; do
2948
# Do each installation.
2951
# Do the static libraries later.
2952
func_append staticlibs " $file"
2956
func_resolve_sysroot "$file"
2957
file=$func_resolve_sysroot_result
2959
# Check to see that this really is a libtool archive.
2960
func_lalib_unsafe_p "$file" \
2961
|| func_fatal_help "\`$file' is not a valid libtool archive"
2968
# Add the libdir to current_libdirs if it is the destination.
2969
if test "X$destdir" = "X$libdir"; then
2970
case "$current_libdirs " in
2972
*) func_append current_libdirs " $libdir" ;;
2975
# Note the libdir as a future libdir.
2976
case "$future_libdirs " in
2978
*) func_append future_libdirs " $libdir" ;;
2982
func_dirname "$file" "/" ""
2983
dir="$func_dirname_result"
2984
func_append dir "$objdir"
2986
if test -n "$relink_command"; then
2987
# Determine the prefix the user has applied to our future dir.
2988
inst_prefix_dir=`$ECHO "$destdir" | $SED -e "s%$libdir\$%%"`
2990
# Don't allow the user to place us outside of our expected
2991
# location b/c this prevents finding dependent libraries that
2992
# are installed to the same prefix.
2993
# At present, this check doesn't affect windows .dll's that
2994
# are installed into $libdir/../bin (currently, that works fine)
2995
# but it's something to keep an eye on.
2996
test "$inst_prefix_dir" = "$destdir" && \
2997
func_fatal_error "error: cannot install \`$file' to a directory not ending in $libdir"
2999
if test -n "$inst_prefix_dir"; then
3000
# Stick the inst_prefix_dir data into the link command.
3001
relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"`
3003
relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%%"`
3006
func_warning "relinking \`$file'"
3007
func_show_eval "$relink_command" \
3008
'func_fatal_error "error: relink \`$file'\'' with the above command before installing it"'
3011
# See the names of the shared library.
3012
set dummy $library_names; shift
3013
if test -n "$1"; then
3018
test -n "$relink_command" && srcname="$realname"T
3020
# Install the shared library and build the symlinks.
3021
func_show_eval "$install_shared_prog $dir/$srcname $destdir/$realname" \
3025
cygwin* | mingw* | pw32* | cegcc*)
3033
if test -n "$tstripme" && test -n "$striplib"; then
3034
func_show_eval "$striplib $destdir/$realname" 'exit $?'
3037
if test "$#" -gt 0; then
3038
# Delete the old symlinks, and create new ones.
3039
# Try `ln -sf' first, because the `ln' binary might depend on
3040
# the symlink we replace! Solaris /bin/ln does not understand -f,
3041
# so we also need to try rm && ln -s.
3044
test "$linkname" != "$realname" \
3045
&& func_show_eval "(cd $destdir && { $LN_S -f $realname $linkname || { $RM $linkname && $LN_S $realname $linkname; }; })"
3049
# Do each command in the postinstall commands.
3050
lib="$destdir/$realname"
3051
func_execute_cmds "$postinstall_cmds" 'exit $?'
3054
# Install the pseudo-library for information purposes.
3055
func_basename "$file"
3056
name="$func_basename_result"
3057
instname="$dir/$name"i
3058
func_show_eval "$install_prog $instname $destdir/$name" 'exit $?'
3060
# Maybe install the static library, too.
3061
test -n "$old_library" && func_append staticlibs " $dir/$old_library"
3065
# Install (i.e. copy) a libtool object.
3067
# Figure out destination file name, if it wasn't already specified.
3068
if test -n "$destname"; then
3069
destfile="$destdir/$destname"
3071
func_basename "$file"
3072
destfile="$func_basename_result"
3073
destfile="$destdir/$destfile"
3076
# Deduce the name of the destination old-style object file.
3079
func_lo2o "$destfile"
3080
staticdest=$func_lo2o_result
3083
staticdest="$destfile"
3087
func_fatal_help "cannot copy a libtool object to \`$destfile'"
3091
# Install the libtool object if requested.
3092
test -n "$destfile" && \
3093
func_show_eval "$install_prog $file $destfile" 'exit $?'
3095
# Install the old object if enabled.
3096
if test "$build_old_libs" = yes; then
3097
# Deduce the name of the old-style object file.
3099
staticobj=$func_lo2o_result
3100
func_show_eval "$install_prog \$staticobj \$staticdest" 'exit $?'
3106
# Figure out destination file name, if it wasn't already specified.
3107
if test -n "$destname"; then
3108
destfile="$destdir/$destname"
3110
func_basename "$file"
3111
destfile="$func_basename_result"
3112
destfile="$destdir/$destfile"
3115
# If the file is missing, and there is a .exe on the end, strip it
3116
# because it is most likely a libtool script we actually want to
3121
if test ! -f "$file"; then
3122
func_stripname '' '.exe' "$file"
3123
file=$func_stripname_result
3129
# Do a test to see if this is really a libtool program.
3132
if func_ltwrapper_executable_p "$file"; then
3133
func_ltwrapper_scriptname "$file"
3134
wrapper=$func_ltwrapper_scriptname_result
3136
func_stripname '' '.exe' "$file"
3137
wrapper=$func_stripname_result
3144
if func_ltwrapper_script_p "$wrapper"; then
3148
func_source "$wrapper"
3150
# Check the variables that should have been set.
3151
test -z "$generated_by_libtool_version" && \
3152
func_fatal_error "invalid libtool wrapper script \`$wrapper'"
3155
for lib in $notinst_deplibs; do
3156
# Check to see that each library is installed.
3158
if test -f "$lib"; then
3161
libfile="$libdir/"`$ECHO "$lib" | $SED 's%^.*/%%g'` ### testsuite: skip nested quoting test
3162
if test -n "$libdir" && test ! -f "$libfile"; then
3163
func_warning "\`$lib' has not been installed in \`$libdir'"
3169
func_source "$wrapper"
3172
if test "$fast_install" = no && test -n "$relink_command"; then
3174
if test "$finalize" = yes; then
3175
tmpdir=`func_mktempdir`
3176
func_basename "$file$stripped_ext"
3177
file="$func_basename_result"
3178
outputname="$tmpdir/$file"
3179
# Replace the output file specification.
3180
relink_command=`$ECHO "$relink_command" | $SED 's%@OUTPUT@%'"$outputname"'%g'`
3183
func_quote_for_expand "$relink_command"
3184
eval "func_echo $func_quote_for_expand_result"
3186
if eval "$relink_command"; then :
3188
func_error "error: relink \`$file' with the above command before installing it"
3189
$opt_dry_run || ${RM}r "$tmpdir"
3194
func_warning "cannot relink \`$file'"
3198
# Install the binary that we compiled earlier.
3199
file=`$ECHO "$file$stripped_ext" | $SED "s%\([^/]*\)$%$objdir/\1%"`
3203
# remove .exe since cygwin /usr/bin/install will append another
3205
case $install_prog,$host in
3206
*/usr/bin/install*,*cygwin*)
3207
case $file:$destfile in
3212
destfile=$destfile.exe
3215
func_stripname '' '.exe' "$destfile"
3216
destfile=$func_stripname_result
3221
func_show_eval "$install_prog\$stripme \$file \$destfile" 'exit $?'
3222
$opt_dry_run || if test -n "$outputname"; then
3229
for file in $staticlibs; do
3230
func_basename "$file"
3231
name="$func_basename_result"
3233
# Set up the ranlib parameters.
3234
oldlib="$destdir/$name"
3235
func_to_tool_file "$oldlib" func_convert_file_msys_to_w32
3236
tool_oldlib=$func_to_tool_file_result
3238
func_show_eval "$install_prog \$file \$oldlib" 'exit $?'
3240
if test -n "$stripme" && test -n "$old_striplib"; then
3241
func_show_eval "$old_striplib $tool_oldlib" 'exit $?'
3244
# Do each command in the postinstall commands.
3245
func_execute_cmds "$old_postinstall_cmds" 'exit $?'
3248
test -n "$future_libdirs" && \
3249
func_warning "remember to run \`$progname --finish$future_libdirs'"
3251
if test -n "$current_libdirs"; then
3252
# Maybe just do a dry run.
3253
$opt_dry_run && current_libdirs=" -n$current_libdirs"
3254
exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs'
3260
test "$opt_mode" = install && func_mode_install ${1+"$@"}
3263
# func_generate_dlsyms outputname originator pic_p
3264
# Extract symbols from dlprefiles and create ${outputname}S.o with
3265
# a dlpreopen symbol table.
3266
func_generate_dlsyms ()
3272
my_prefix=`$ECHO "$my_originator" | sed 's%[^a-zA-Z0-9]%_%g'`
3275
if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
3276
if test -n "$NM" && test -n "$global_symbol_pipe"; then
3277
my_dlsyms="${my_outputname}S.c"
3279
func_error "not configured to extract global symbols from dlpreopened files"
3283
if test -n "$my_dlsyms"; then
3287
# Discover the nlist of each of the dlfiles.
3288
nlist="$output_objdir/${my_outputname}.nm"
3290
func_show_eval "$RM $nlist ${nlist}S ${nlist}T"
3292
# Parse the name list into a source file.
3293
func_verbose "creating $output_objdir/$my_dlsyms"
3295
$opt_dry_run || $ECHO > "$output_objdir/$my_dlsyms" "\
3296
/* $my_dlsyms - symbol resolution table for \`$my_outputname' dlsym emulation. */
3297
/* Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION */
3303
#if defined(__GNUC__) && (((__GNUC__ == 4) && (__GNUC_MINOR__ >= 4)) || (__GNUC__ > 4))
3304
#pragma GCC diagnostic ignored \"-Wstrict-prototypes\"
3307
/* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */
3308
#if defined(_WIN32) || defined(__CYGWIN__) || defined(_WIN32_WCE)
3309
/* DATA imports from DLLs on WIN32 con't be const, because runtime
3310
relocations are performed -- see ld's documentation on pseudo-relocs. */
3311
# define LT_DLSYM_CONST
3312
#elif defined(__osf__)
3313
/* This system does not cope well with relocations in const data. */
3314
# define LT_DLSYM_CONST
3316
# define LT_DLSYM_CONST const
3319
/* External symbol declarations for the compiler. */\
3322
if test "$dlself" = yes; then
3323
func_verbose "generating symbol list for \`$output'"
3325
$opt_dry_run || echo ': @PROGRAM@ ' > "$nlist"
3327
# Add our own program objects to the symbol list.
3328
progfiles=`$ECHO "$objs$old_deplibs" | $SP2NL | $SED "$lo2o" | $NL2SP`
3329
for progfile in $progfiles; do
3330
func_to_tool_file "$progfile" func_convert_file_msys_to_w32
3331
func_verbose "extracting global C symbols from \`$func_to_tool_file_result'"
3332
$opt_dry_run || eval "$NM $func_to_tool_file_result | $global_symbol_pipe >> '$nlist'"
3335
if test -n "$exclude_expsyms"; then
3337
eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
3338
eval '$MV "$nlist"T "$nlist"'
3342
if test -n "$export_symbols_regex"; then
3344
eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T'
3345
eval '$MV "$nlist"T "$nlist"'
3349
# Prepare the list of exported symbols
3350
if test -z "$export_symbols"; then
3351
export_symbols="$output_objdir/$outputname.exp"
3354
eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
3356
*cygwin* | *mingw* | *cegcc* )
3357
eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
3358
eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"'
3364
eval "${SED} -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"'
3365
eval '$GREP -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T'
3366
eval '$MV "$nlist"T "$nlist"'
3368
*cygwin* | *mingw* | *cegcc* )
3369
eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
3370
eval 'cat "$nlist" >> "$output_objdir/$outputname.def"'
3377
for dlprefile in $dlprefiles; do
3378
func_verbose "extracting global C symbols from \`$dlprefile'"
3379
func_basename "$dlprefile"
3380
name="$func_basename_result"
3382
*cygwin* | *mingw* | *cegcc* )
3383
# if an import library, we need to obtain dlname
3384
if func_win32_import_lib_p "$dlprefile"; then
3385
func_tr_sh "$dlprefile"
3386
eval "curr_lafile=\$libfile_$func_tr_sh_result"
3387
dlprefile_dlbasename=""
3388
if test -n "$curr_lafile" && func_lalib_p "$curr_lafile"; then
3389
# Use subshell, to avoid clobbering current variable values
3390
dlprefile_dlname=`source "$curr_lafile" && echo "$dlname"`
3391
if test -n "$dlprefile_dlname" ; then
3392
func_basename "$dlprefile_dlname"
3393
dlprefile_dlbasename="$func_basename_result"
3395
# no lafile. user explicitly requested -dlpreopen <import library>.
3396
$sharedlib_from_linklib_cmd "$dlprefile"
3397
dlprefile_dlbasename=$sharedlib_from_linklib_result
3401
if test -n "$dlprefile_dlbasename" ; then
3402
eval '$ECHO ": $dlprefile_dlbasename" >> "$nlist"'
3404
func_warning "Could not compute DLL name from $name"
3405
eval '$ECHO ": $name " >> "$nlist"'
3407
func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32
3408
eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe |
3409
$SED -e '/I __imp/d' -e 's/I __nm_/D /;s/_nm__//' >> '$nlist'"
3411
else # not an import lib
3413
eval '$ECHO ": $name " >> "$nlist"'
3414
func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32
3415
eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'"
3421
eval '$ECHO ": $name " >> "$nlist"'
3422
func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32
3423
eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'"
3430
# Make sure we have at least an empty file.
3431
test -f "$nlist" || : > "$nlist"
3433
if test -n "$exclude_expsyms"; then
3434
$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T
3435
$MV "$nlist"T "$nlist"
3438
# Try sorting and uniquifying the output.
3439
if $GREP -v "^: " < "$nlist" |
3440
if sort -k 3 </dev/null >/dev/null 2>&1; then
3445
uniq > "$nlist"S; then
3448
$GREP -v "^: " < "$nlist" > "$nlist"S
3451
if test -f "$nlist"S; then
3452
eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$my_dlsyms"'
3454
echo '/* NONE */' >> "$output_objdir/$my_dlsyms"
3457
echo >> "$output_objdir/$my_dlsyms" "\
3459
/* The mapping between symbol names and symbols. */
3464
extern LT_DLSYM_CONST lt_dlsymlist
3465
lt_${my_prefix}_LTX_preloaded_symbols[];
3466
LT_DLSYM_CONST lt_dlsymlist
3467
lt_${my_prefix}_LTX_preloaded_symbols[] =
3469
{ \"$my_originator\", (void *) 0 },"
3471
case $need_lib_prefix in
3473
eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$my_dlsyms"
3476
eval "$global_symbol_to_c_name_address_lib_prefix" < "$nlist" >> "$output_objdir/$my_dlsyms"
3479
echo >> "$output_objdir/$my_dlsyms" "\
3483
/* This works around a problem in FreeBSD linker */
3484
#ifdef FREEBSD_WORKAROUND
3485
static const void *lt_preloaded_setup() {
3486
return lt_${my_prefix}_LTX_preloaded_symbols;
3496
pic_flag_for_symtable=
3497
case "$compile_command " in
3501
# compiling the symbol table file with pic_flag works around
3502
# a FreeBSD bug that causes programs to crash when -lm is
3503
# linked before any other PIC object. But we must not use
3504
# pic_flag when linking with -static. The problem exists in
3505
# FreeBSD 2.2.6 and is fixed in FreeBSD 3.1.
3506
*-*-freebsd2.*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)
3507
pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND" ;;
3509
pic_flag_for_symtable=" $pic_flag" ;;
3511
if test "X$my_pic_p" != Xno; then
3512
pic_flag_for_symtable=" $pic_flag"
3519
for arg in $LTCFLAGS; do
3521
-pie | -fpie | -fPIE) ;;
3522
*) func_append symtab_cflags " $arg" ;;
3526
# Now compile the dynamic symbol file.
3527
func_show_eval '(cd $output_objdir && $LTCC$symtab_cflags -c$no_builtin_flag$pic_flag_for_symtable "$my_dlsyms")' 'exit $?'
3529
# Clean up the generated files.
3530
func_show_eval '$RM "$output_objdir/$my_dlsyms" "$nlist" "${nlist}S" "${nlist}T"'
3532
# Transform the symbol file into the correct name.
3533
symfileobj="$output_objdir/${my_outputname}S.$objext"
3535
*cygwin* | *mingw* | *cegcc* )
3536
if test -f "$output_objdir/$my_outputname.def"; then
3537
compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"`
3538
finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"`
3540
compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"`
3541
finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"`
3545
compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"`
3546
finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"`
3551
# FreeBSD doesn't need this...
3554
func_fatal_error "unknown suffix for \`$my_dlsyms'"
3558
# We keep going just in case the user didn't refer to
3559
# lt_preloaded_symbols. The linker will fail if global_symbol_pipe
3560
# really was required.
3562
# Nullify the symbol file.
3563
compile_command=`$ECHO "$compile_command" | $SED "s% @SYMFILE@%%"`
3564
finalize_command=`$ECHO "$finalize_command" | $SED "s% @SYMFILE@%%"`
3568
# func_win32_libid arg
3569
# return the library type of file 'arg'
3571
# Need a lot of goo to handle *both* DLLs and import libs
3572
# Has to be a shell function in order to 'eat' the argument
3573
# that is supplied when $file_magic_command is called.
3574
# Despite the name, also deal with 64 bit binaries.
3578
win32_libid_type="unknown"
3579
win32_fileres=`file -L $1 2>/dev/null`
3580
case $win32_fileres in
3581
*ar\ archive\ import\ library*) # definitely import
3582
win32_libid_type="x86 archive import"
3584
*ar\ archive*) # could be an import, or static
3585
# Keep the egrep pattern in sync with the one in _LT_CHECK_MAGIC_METHOD.
3586
if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null |
3587
$EGREP 'file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' >/dev/null; then
3588
func_to_tool_file "$1" func_convert_file_msys_to_w32
3589
win32_nmres=`eval $NM -f posix -A \"$func_to_tool_file_result\" |
3598
case $win32_nmres in
3599
import*) win32_libid_type="x86 archive import";;
3600
*) win32_libid_type="x86 archive static";;
3605
win32_libid_type="x86 DLL"
3607
*executable*) # but shell scripts are "executable" too...
3608
case $win32_fileres in
3609
*MS\ Windows\ PE\ Intel*)
3610
win32_libid_type="x86 DLL"
3615
$ECHO "$win32_libid_type"
3618
# func_cygming_dll_for_implib ARG
3620
# Platform-specific function to extract the
3621
# name of the DLL associated with the specified
3622
# import library ARG.
3623
# Invoked by eval'ing the libtool variable
3624
# $sharedlib_from_linklib_cmd
3625
# Result is available in the variable
3626
# $sharedlib_from_linklib_result
3627
func_cygming_dll_for_implib ()
3630
sharedlib_from_linklib_result=`$DLLTOOL --identify-strict --identify "$1"`
3633
# func_cygming_dll_for_implib_fallback_core SECTION_NAME LIBNAMEs
3635
# The is the core of a fallback implementation of a
3636
# platform-specific function to extract the name of the
3637
# DLL associated with the specified import library LIBNAME.
3639
# SECTION_NAME is either .idata$6 or .idata$7, depending
3640
# on the platform and compiler that created the implib.
3642
# Echos the name of the DLL associated with the
3643
# specified import library.
3644
func_cygming_dll_for_implib_fallback_core ()
3647
match_literal=`$ECHO "$1" | $SED "$sed_make_literal_regex"`
3648
$OBJDUMP -s --section "$1" "$2" 2>/dev/null |
3649
$SED '/^Contents of section '"$match_literal"':/{
3650
# Place marker at beginning of archive member dllname section
3655
# These lines can sometimes be longer than 43 characters, but
3656
# are always uninteresting
3657
/:[ ]*file format pe[i]\{,1\}-/d
3658
/^In archive [^:]*:/d
3659
# Ensure marker is printed
3661
# Remove all lines with less than 43 characters
3663
# From remaining lines, remove first 43 characters
3666
# Join marker and all lines until next marker into a single line
3667
/^====MARK====/ b para
3676
# Remove trailing dots and whitespace
3680
# we now have a list, one entry per line, of the stringified
3681
# contents of the appropriate section of all members of the
3682
# archive which possess that section. Heuristic: eliminate
3683
# all those which have a first or second character that is
3684
# a '.' (that is, objdump's representation of an unprintable
3685
# character.) This should work for all archives with less than
3686
# 0x302f exports -- but will fail for DLLs whose name actually
3687
# begins with a literal '.' or a single character followed by
3690
# Of those that remain, print the first one.
3691
$SED -e '/^\./d;/^.\./d;q'
3694
# func_cygming_gnu_implib_p ARG
3695
# This predicate returns with zero status (TRUE) if
3696
# ARG is a GNU/binutils-style import library. Returns
3697
# with nonzero status (FALSE) otherwise.
3698
func_cygming_gnu_implib_p ()
3701
func_to_tool_file "$1" func_convert_file_msys_to_w32
3702
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)$'`
3703
test -n "$func_cygming_gnu_implib_tmp"
3706
# func_cygming_ms_implib_p ARG
3707
# This predicate returns with zero status (TRUE) if
3708
# ARG is an MS-style import library. Returns
3709
# with nonzero status (FALSE) otherwise.
3710
func_cygming_ms_implib_p ()
3713
func_to_tool_file "$1" func_convert_file_msys_to_w32
3714
func_cygming_ms_implib_tmp=`$NM "$func_to_tool_file_result" | eval "$global_symbol_pipe" | $GREP '_NULL_IMPORT_DESCRIPTOR'`
3715
test -n "$func_cygming_ms_implib_tmp"
3718
# func_cygming_dll_for_implib_fallback ARG
3719
# Platform-specific function to extract the
3720
# name of the DLL associated with the specified
3721
# import library ARG.
3723
# This fallback implementation is for use when $DLLTOOL
3724
# does not support the --identify-strict option.
3725
# Invoked by eval'ing the libtool variable
3726
# $sharedlib_from_linklib_cmd
3727
# Result is available in the variable
3728
# $sharedlib_from_linklib_result
3729
func_cygming_dll_for_implib_fallback ()
3732
if func_cygming_gnu_implib_p "$1" ; then
3733
# binutils import library
3734
sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$7' "$1"`
3735
elif func_cygming_ms_implib_p "$1" ; then
3736
# ms-generated import library
3737
sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$6' "$1"`
3740
sharedlib_from_linklib_result=""
3745
# func_extract_an_archive dir oldlib
3746
func_extract_an_archive ()
3749
f_ex_an_ar_dir="$1"; shift
3750
f_ex_an_ar_oldlib="$1"
3751
if test "$lock_old_archive_extraction" = yes; then
3752
lockfile=$f_ex_an_ar_oldlib.lock
3753
until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do
3754
func_echo "Waiting for $lockfile to be removed"
3758
func_show_eval "(cd \$f_ex_an_ar_dir && $AR x \"\$f_ex_an_ar_oldlib\")" \
3759
'stat=$?; rm -f "$lockfile"; exit $stat'
3760
if test "$lock_old_archive_extraction" = yes; then
3761
$opt_dry_run || rm -f "$lockfile"
3763
if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then
3766
func_fatal_error "object name conflicts in archive: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib"
3771
# func_extract_archives gentop oldlib ...
3772
func_extract_archives ()
3775
my_gentop="$1"; shift
3776
my_oldlibs=${1+"$@"}
3782
for my_xlib in $my_oldlibs; do
3783
# Extract the objects.
3785
[\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;;
3786
*) my_xabs=`pwd`"/$my_xlib" ;;
3788
func_basename "$my_xlib"
3789
my_xlib="$func_basename_result"
3792
case " $extracted_archives " in
3794
func_arith $extracted_serial + 1
3795
extracted_serial=$func_arith_result
3796
my_xlib_u=lt$extracted_serial-$my_xlib ;;
3800
extracted_archives="$extracted_archives $my_xlib_u"
3801
my_xdir="$my_gentop/$my_xlib_u"
3803
func_mkdir_p "$my_xdir"
3807
func_verbose "Extracting $my_xabs"
3808
# Do not bother doing anything if just a dry run
3810
darwin_orig_dir=`pwd`
3811
cd $my_xdir || exit $?
3812
darwin_archive=$my_xabs
3814
darwin_base_archive=`basename "$darwin_archive"`
3815
darwin_arches=`$LIPO -info "$darwin_archive" 2>/dev/null | $GREP Architectures 2>/dev/null || true`
3816
if test -n "$darwin_arches"; then
3817
darwin_arches=`$ECHO "$darwin_arches" | $SED -e 's/.*are://'`
3819
func_verbose "$darwin_base_archive has multiple architectures $darwin_arches"
3820
for darwin_arch in $darwin_arches ; do
3821
func_mkdir_p "unfat-$$/${darwin_base_archive}-${darwin_arch}"
3822
$LIPO -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}"
3823
cd "unfat-$$/${darwin_base_archive}-${darwin_arch}"
3824
func_extract_an_archive "`pwd`" "${darwin_base_archive}"
3826
$RM "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}"
3827
done # $darwin_arches
3828
## Okay now we've a bunch of thin objects, gotta fatten them up :)
3829
darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print | $SED -e "$basename" | sort -u`
3832
for darwin_file in $darwin_filelist; do
3833
darwin_files=`find unfat-$$ -name $darwin_file -print | sort | $NL2SP`
3834
$LIPO -create -output "$darwin_file" $darwin_files
3835
done # $darwin_filelist
3837
cd "$darwin_orig_dir"
3840
func_extract_an_archive "$my_xdir" "$my_xabs"
3845
func_extract_an_archive "$my_xdir" "$my_xabs"
3848
my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | sort | $NL2SP`
3851
func_extract_archives_result="$my_oldobjs"
3855
# func_emit_wrapper [arg=no]
3857
# Emit a libtool wrapper script on stdout.
3858
# Don't directly open a file because we may want to
3859
# incorporate the script contents within a cygwin/mingw
3860
# wrapper executable. Must ONLY be called from within
3861
# func_mode_link because it depends on a number of variables
3864
# ARG is the value that the WRAPPER_SCRIPT_BELONGS_IN_OBJDIR
3865
# variable will take. If 'yes', then the emitted script
3866
# will assume that the directory in which it is stored is
3867
# the $objdir directory. This is a cygwin/mingw-specific
3869
func_emit_wrapper ()
3871
func_emit_wrapper_arg1=${1-no}
3876
# $output - temporary wrapper script for $objdir/$outputname
3877
# Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
3879
# The $output program cannot be directly executed until all the libtool
3880
# libraries that it depends on are installed.
3882
# This wrapper script should never be moved out of the build directory.
3883
# If it is, it will not operate correctly.
3885
# Sed substitution that helps us do robust quoting. It backslashifies
3886
# metacharacters that are still active within double-quoted strings.
3887
sed_quote_subst='$sed_quote_subst'
3889
# Be Bourne compatible
3890
if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then
3893
# Zsh 3.x and 4.x performs word splitting on \${1+\"\$@\"}, which
3894
# is contrary to our usage. Disable this feature.
3895
alias -g '\${1+\"\$@\"}'='\"\$@\"'
3896
setopt NO_GLOB_SUBST
3898
case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac
3900
BIN_SH=xpg4; export BIN_SH # for Tru64
3901
DUALCASE=1; export DUALCASE # for MKS sh
3903
# The HP-UX ksh and POSIX shell print the target directory to stdout
3905
(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
3907
relink_command=\"$relink_command\"
3909
# This environment variable determines our operation mode.
3910
if test \"\$libtool_install_magic\" = \"$magic\"; then
3911
# install mode needs the following variables:
3912
generated_by_libtool_version='$macro_version'
3913
notinst_deplibs='$notinst_deplibs'
3915
# When we are sourced in execute mode, \$file and \$ECHO are already set.
3916
if test \"\$libtool_execute_magic\" != \"$magic\"; then
3919
qECHO=`$ECHO "$ECHO" | $SED "$sed_quote_subst"`
3922
# A function that is used when there is no print builtin or printf.
3923
func_fallback_echo ()
3925
eval 'cat <<_LTECHO_EOF
3932
# Very basic option parsing. These options are (a) specific to
3933
# the libtool wrapper, (b) are identical between the wrapper
3934
# /script/ and the wrapper /executable/ which is used only on
3935
# windows platforms, and (c) all begin with the string "--lt-"
3936
# (application programs are unlikely to have options which match
3939
# There are only two supported options: --lt-debug and
3940
# --lt-dump-script. There is, deliberately, no --lt-help.
3942
# The first argument to this parsing function should be the
3943
# script's $0 value, followed by "$@".
3945
func_parse_lt_options ()
3951
case \"\$lt_opt\" in
3952
--lt-debug) lt_option_debug=1 ;;
3954
lt_dump_D=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%/[^/]*$%%'\`
3955
test \"X\$lt_dump_D\" = \"X\$lt_script_arg0\" && lt_dump_D=.
3956
lt_dump_F=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%^.*/%%'\`
3957
cat \"\$lt_dump_D/\$lt_dump_F\"
3961
\$ECHO \"Unrecognized --lt- option: '\$lt_opt'\" 1>&2
3967
# Print the debug banner immediately:
3968
if test -n \"\$lt_option_debug\"; then
3969
echo \"${outputname}:${output}:\${LINENO}: libtool wrapper (GNU $PACKAGE$TIMESTAMP) $VERSION\" 1>&2
3973
# Used when --lt-debug. Prints its arguments to stdout
3974
# (redirection is the responsibility of the caller)
3975
func_lt_dump_args ()
3980
\$ECHO \"${outputname}:${output}:\${LINENO}: newargv[\$lt_dump_args_N]: \$lt_arg\"
3981
lt_dump_args_N=\`expr \$lt_dump_args_N + 1\`
3985
# Core function for launching the target application
3986
func_exec_program_core ()
3990
# Backslashes separate directories on plain windows
3991
*-*-mingw | *-*-os2* | *-cegcc*)
3993
if test -n \"\$lt_option_debug\"; then
3994
\$ECHO \"${outputname}:${output}:\${LINENO}: newargv[0]: \$progdir\\\\\$program\" 1>&2
3995
func_lt_dump_args \${1+\"\$@\"} 1>&2
3997
exec \"\$progdir\\\\\$program\" \${1+\"\$@\"}
4003
if test -n \"\$lt_option_debug\"; then
4004
\$ECHO \"${outputname}:${output}:\${LINENO}: newargv[0]: \$progdir/\$program\" 1>&2
4005
func_lt_dump_args \${1+\"\$@\"} 1>&2
4007
exec \"\$progdir/\$program\" \${1+\"\$@\"}
4012
\$ECHO \"\$0: cannot exec \$program \$*\" 1>&2
4016
# A function to encapsulate launching the target application
4017
# Strips options in the --lt-* namespace from \$@ and
4018
# launches target application with the remaining arguments.
4019
func_exec_program ()
4027
*) set x \"\$@\" \"\$lt_wr_arg\"; shift;;
4032
func_exec_program_core \${1+\"\$@\"}
4036
func_parse_lt_options \"\$0\" \${1+\"\$@\"}
4038
# Find the directory that this script lives in.
4039
thisdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*$%%'\`
4040
test \"x\$thisdir\" = \"x\$file\" && thisdir=.
4042
# Follow symbolic links until we get to the real thisdir.
4043
file=\`ls -ld \"\$file\" | $SED -n 's/.*-> //p'\`
4044
while test -n \"\$file\"; do
4045
destdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*\$%%'\`
4047
# If there was a directory component, then change thisdir.
4048
if test \"x\$destdir\" != \"x\$file\"; then
4049
case \"\$destdir\" in
4050
[\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;;
4051
*) thisdir=\"\$thisdir/\$destdir\" ;;
4055
file=\`\$ECHO \"\$file\" | $SED 's%^.*/%%'\`
4056
file=\`ls -ld \"\$thisdir/\$file\" | $SED -n 's/.*-> //p'\`
4059
# Usually 'no', except on cygwin/mingw when embedded into
4061
WRAPPER_SCRIPT_BELONGS_IN_OBJDIR=$func_emit_wrapper_arg1
4062
if test \"\$WRAPPER_SCRIPT_BELONGS_IN_OBJDIR\" = \"yes\"; then
4063
# special case for '.'
4064
if test \"\$thisdir\" = \".\"; then
4067
# remove .libs from thisdir
4068
case \"\$thisdir\" in
4069
*[\\\\/]$objdir ) thisdir=\`\$ECHO \"\$thisdir\" | $SED 's%[\\\\/][^\\\\/]*$%%'\` ;;
4070
$objdir ) thisdir=. ;;
4074
# Try to get the absolute directory name.
4075
absdir=\`cd \"\$thisdir\" && pwd\`
4076
test -n \"\$absdir\" && thisdir=\"\$absdir\"
4079
if test "$fast_install" = yes; then
4081
program=lt-'$outputname'$exeext
4082
progdir=\"\$thisdir/$objdir\"
4084
if test ! -f \"\$progdir/\$program\" ||
4085
{ file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\
4086
test \"X\$file\" != \"X\$progdir/\$program\"; }; then
4088
file=\"\$\$-\$program\"
4090
if test ! -d \"\$progdir\"; then
4091
$MKDIR \"\$progdir\"
4093
$RM \"\$progdir/\$file\"
4098
# relink executable if necessary
4099
if test -n \"\$relink_command\"; then
4100
if relink_command_output=\`eval \$relink_command 2>&1\`; then :
4102
$ECHO \"\$relink_command_output\" >&2
4103
$RM \"\$progdir/\$file\"
4108
$MV \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null ||
4109
{ $RM \"\$progdir/\$program\";
4110
$MV \"\$progdir/\$file\" \"\$progdir/\$program\"; }
4111
$RM \"\$progdir/\$file\"
4115
program='$outputname'
4116
progdir=\"\$thisdir/$objdir\"
4122
if test -f \"\$progdir/\$program\"; then"
4124
# fixup the dll searchpath if we need to.
4126
# Fix the DLL searchpath if we need to. Do this before prepending
4127
# to shlibpath, because on Windows, both are PATH and uninstalled
4128
# libraries must come first.
4129
if test -n "$dllsearchpath"; then
4131
# Add the dll search path components to the executable PATH
4132
PATH=$dllsearchpath:\$PATH
4136
# Export our shlibpath_var if we have one.
4137
if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
4139
# Add our own library path to $shlibpath_var
4140
$shlibpath_var=\"$temp_rpath\$$shlibpath_var\"
4142
# Some systems cannot cope with colon-terminated $shlibpath_var
4143
# The second colon is a workaround for a bug in BeOS R4 sed
4144
$shlibpath_var=\`\$ECHO \"\$$shlibpath_var\" | $SED 's/::*\$//'\`
4146
export $shlibpath_var
4151
if test \"\$libtool_execute_magic\" != \"$magic\"; then
4152
# Run the actual program with our arguments.
4153
func_exec_program \${1+\"\$@\"}
4156
# The program doesn't exist.
4157
\$ECHO \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2
4158
\$ECHO \"This script is just a wrapper for \$program.\" 1>&2
4159
\$ECHO \"See the $PACKAGE documentation for more information.\" 1>&2
4167
# func_emit_cwrapperexe_src
4168
# emit the source code for a wrapper executable on stdout
4169
# Must ONLY be called from within func_mode_link because
4170
# it depends on a number of variable set therein.
4171
func_emit_cwrapperexe_src ()
4175
/* $cwrappersource - temporary wrapper executable for $objdir/$outputname
4176
Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
4178
The $output program cannot be directly executed until all the libtool
4179
libraries that it depends on are installed.
4181
This wrapper executable should never be moved out of the build directory.
4182
If it is, it will not operate correctly.
4187
# define _CRT_SECURE_NO_DEPRECATE 1
4192
# include <direct.h>
4193
# include <process.h>
4196
# include <unistd.h>
4197
# include <stdint.h>
4209
#include <sys/stat.h>
4211
/* declarations of non-ANSI functions */
4212
#if defined(__MINGW32__)
4213
# ifdef __STRICT_ANSI__
4214
int _putenv (const char *);
4216
#elif defined(__CYGWIN__)
4217
# ifdef __STRICT_ANSI__
4218
char *realpath (const char *, char *);
4219
int putenv (char *);
4220
int setenv (const char *, const char *, int);
4222
/* #elif defined (other platforms) ... */
4225
/* portability defines, excluding path handling macros */
4226
#if defined(_MSC_VER)
4227
# define setmode _setmode
4229
# define chmod _chmod
4230
# define getcwd _getcwd
4231
# define putenv _putenv
4232
# define S_IXUSR _S_IEXEC
4233
# ifndef _INTPTR_T_DEFINED
4234
# define _INTPTR_T_DEFINED
4235
# define intptr_t int
4237
#elif defined(__MINGW32__)
4238
# define setmode _setmode
4240
# define chmod _chmod
4241
# define getcwd _getcwd
4242
# define putenv _putenv
4243
#elif defined(__CYGWIN__)
4244
# define HAVE_SETENV
4245
# define FOPEN_WB "wb"
4246
/* #elif defined (other platforms) ... */
4249
#if defined(PATH_MAX)
4250
# define LT_PATHMAX PATH_MAX
4251
#elif defined(MAXPATHLEN)
4252
# define LT_PATHMAX MAXPATHLEN
4254
# define LT_PATHMAX 1024
4264
/* path handling portability macros */
4265
#ifndef DIR_SEPARATOR
4266
# define DIR_SEPARATOR '/'
4267
# define PATH_SEPARATOR ':'
4270
#if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \
4272
# define HAVE_DOS_BASED_FILE_SYSTEM
4273
# define FOPEN_WB "wb"
4274
# ifndef DIR_SEPARATOR_2
4275
# define DIR_SEPARATOR_2 '\\'
4277
# ifndef PATH_SEPARATOR_2
4278
# define PATH_SEPARATOR_2 ';'
4282
#ifndef DIR_SEPARATOR_2
4283
# define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR)
4284
#else /* DIR_SEPARATOR_2 */
4285
# define IS_DIR_SEPARATOR(ch) \
4286
(((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2))
4287
#endif /* DIR_SEPARATOR_2 */
4289
#ifndef PATH_SEPARATOR_2
4290
# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR)
4291
#else /* PATH_SEPARATOR_2 */
4292
# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2)
4293
#endif /* PATH_SEPARATOR_2 */
4296
# define FOPEN_WB "w"
4299
# define _O_BINARY 0
4302
#define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type)))
4303
#define XFREE(stale) do { \
4304
if (stale) { free ((void *) stale); stale = 0; } \
4307
#if defined(LT_DEBUGWRAPPER)
4308
static int lt_debug = 1;
4310
static int lt_debug = 0;
4313
const char *program_name = "libtool-wrapper"; /* in case xstrdup fails */
4315
void *xmalloc (size_t num);
4316
char *xstrdup (const char *string);
4317
const char *base_name (const char *name);
4318
char *find_executable (const char *wrapper);
4319
char *chase_symlinks (const char *pathspec);
4320
int make_executable (const char *path);
4321
int check_executable (const char *path);
4322
char *strendzap (char *str, const char *pat);
4323
void lt_debugprintf (const char *file, int line, const char *fmt, ...);
4324
void lt_fatal (const char *file, int line, const char *message, ...);
4325
static const char *nonnull (const char *s);
4326
static const char *nonempty (const char *s);
4327
void lt_setenv (const char *name, const char *value);
4328
char *lt_extend_str (const char *orig_value, const char *add, int to_end);
4329
void lt_update_exe_path (const char *name, const char *value);
4330
void lt_update_lib_path (const char *name, const char *value);
4331
char **prepare_spawn (char **argv);
4332
void lt_dump_script (FILE *f);
4336
volatile const char * MAGIC_EXE = "$magic_exe";
4337
const char * LIB_PATH_VARNAME = "$shlibpath_var";
4340
if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
4341
func_to_host_path "$temp_rpath"
4343
const char * LIB_PATH_VALUE = "$func_to_host_path_result";
4347
const char * LIB_PATH_VALUE = "";
4351
if test -n "$dllsearchpath"; then
4352
func_to_host_path "$dllsearchpath:"
4354
const char * EXE_PATH_VARNAME = "PATH";
4355
const char * EXE_PATH_VALUE = "$func_to_host_path_result";
4359
const char * EXE_PATH_VARNAME = "";
4360
const char * EXE_PATH_VALUE = "";
4364
if test "$fast_install" = yes; then
4366
const char * TARGET_PROGRAM_NAME = "lt-$outputname"; /* hopefully, no .exe */
4370
const char * TARGET_PROGRAM_NAME = "$outputname"; /* hopefully, no .exe */
4377
#define LTWRAPPER_OPTION_PREFIX "--lt-"
4379
static const char *ltwrapper_option_prefix = LTWRAPPER_OPTION_PREFIX;
4380
static const char *dumpscript_opt = LTWRAPPER_OPTION_PREFIX "dump-script";
4381
static const char *debug_opt = LTWRAPPER_OPTION_PREFIX "debug";
4384
main (int argc, char *argv[])
4389
char *actual_cwrapper_path;
4390
char *actual_cwrapper_name;
4393
intptr_t rval = 127;
4397
program_name = (char *) xstrdup (base_name (argv[0]));
4398
newargz = XMALLOC (char *, argc + 1);
4400
/* very simple arg parsing; don't want to rely on getopt
4401
* also, copy all non cwrapper options to newargz, except
4402
* argz[0], which is handled differently
4405
for (i = 1; i < argc; i++)
4407
if (strcmp (argv[i], dumpscript_opt) == 0)
4411
*mingw* | *cygwin* )
4412
# make stdout use "unix" line endings
4413
echo " setmode(1,_O_BINARY);"
4418
lt_dump_script (stdout);
4421
if (strcmp (argv[i], debug_opt) == 0)
4426
if (strcmp (argv[i], ltwrapper_option_prefix) == 0)
4428
/* however, if there is an option in the LTWRAPPER_OPTION_PREFIX
4429
namespace, but it is not one of the ones we know about and
4430
have already dealt with, above (inluding dump-script), then
4431
report an error. Otherwise, targets might begin to believe
4432
they are allowed to use options in the LTWRAPPER_OPTION_PREFIX
4433
namespace. The first time any user complains about this, we'll
4434
need to make LTWRAPPER_OPTION_PREFIX a configure-time option
4435
or a configure.ac-settable value.
4437
lt_fatal (__FILE__, __LINE__,
4438
"unrecognized %s option: '%s'",
4439
ltwrapper_option_prefix, argv[i]);
4442
newargz[++newargc] = xstrdup (argv[i]);
4444
newargz[++newargc] = NULL;
4448
/* The GNU banner must be the first non-error debug message */
4449
lt_debugprintf (__FILE__, __LINE__, "libtool wrapper (GNU $PACKAGE$TIMESTAMP) $VERSION\n");
4452
lt_debugprintf (__FILE__, __LINE__, "(main) argv[0]: %s\n", argv[0]);
4453
lt_debugprintf (__FILE__, __LINE__, "(main) program_name: %s\n", program_name);
4455
tmp_pathspec = find_executable (argv[0]);
4456
if (tmp_pathspec == NULL)
4457
lt_fatal (__FILE__, __LINE__, "couldn't find %s", argv[0]);
4458
lt_debugprintf (__FILE__, __LINE__,
4459
"(main) found exe (before symlink chase) at: %s\n",
4462
actual_cwrapper_path = chase_symlinks (tmp_pathspec);
4463
lt_debugprintf (__FILE__, __LINE__,
4464
"(main) found exe (after symlink chase) at: %s\n",
4465
actual_cwrapper_path);
4466
XFREE (tmp_pathspec);
4468
actual_cwrapper_name = xstrdup (base_name (actual_cwrapper_path));
4469
strendzap (actual_cwrapper_path, actual_cwrapper_name);
4471
/* wrapper name transforms */
4472
strendzap (actual_cwrapper_name, ".exe");
4473
tmp_pathspec = lt_extend_str (actual_cwrapper_name, ".exe", 1);
4474
XFREE (actual_cwrapper_name);
4475
actual_cwrapper_name = tmp_pathspec;
4478
/* target_name transforms -- use actual target program name; might have lt- prefix */
4479
target_name = xstrdup (base_name (TARGET_PROGRAM_NAME));
4480
strendzap (target_name, ".exe");
4481
tmp_pathspec = lt_extend_str (target_name, ".exe", 1);
4482
XFREE (target_name);
4483
target_name = tmp_pathspec;
4486
lt_debugprintf (__FILE__, __LINE__,
4487
"(main) libtool target name: %s\n",
4493
XMALLOC (char, (strlen (actual_cwrapper_path) +
4494
strlen ("$objdir") + 1 + strlen (actual_cwrapper_name) + 1));
4495
strcpy (newargz[0], actual_cwrapper_path);
4496
strcat (newargz[0], "$objdir");
4497
strcat (newargz[0], "/");
4501
/* stop here, and copy so we don't have to do this twice */
4502
tmp_pathspec = xstrdup (newargz[0]);
4504
/* do NOT want the lt- prefix here, so use actual_cwrapper_name */
4505
strcat (newargz[0], actual_cwrapper_name);
4507
/* DO want the lt- prefix here if it exists, so use target_name */
4508
lt_argv_zero = lt_extend_str (tmp_pathspec, target_name, 1);
4509
XFREE (tmp_pathspec);
4510
tmp_pathspec = NULL;
4518
while ((p = strchr (newargz[0], '\\')) != NULL)
4522
while ((p = strchr (lt_argv_zero, '\\')) != NULL)
4532
XFREE (target_name);
4533
XFREE (actual_cwrapper_path);
4534
XFREE (actual_cwrapper_name);
4536
lt_setenv ("BIN_SH", "xpg4"); /* for Tru64 */
4537
lt_setenv ("DUALCASE", "1"); /* for MSK sh */
4538
/* Update the DLL searchpath. EXE_PATH_VALUE ($dllsearchpath) must
4539
be prepended before (that is, appear after) LIB_PATH_VALUE ($temp_rpath)
4540
because on Windows, both *_VARNAMEs are PATH but uninstalled
4541
libraries must come first. */
4542
lt_update_exe_path (EXE_PATH_VARNAME, EXE_PATH_VALUE);
4543
lt_update_lib_path (LIB_PATH_VARNAME, LIB_PATH_VALUE);
4545
lt_debugprintf (__FILE__, __LINE__, "(main) lt_argv_zero: %s\n",
4546
nonnull (lt_argv_zero));
4547
for (i = 0; i < newargc; i++)
4549
lt_debugprintf (__FILE__, __LINE__, "(main) newargz[%d]: %s\n",
4550
i, nonnull (newargz[i]));
4558
/* execv doesn't actually work on mingw as expected on unix */
4559
newargz = prepare_spawn (newargz);
4560
rval = _spawnv (_P_WAIT, lt_argv_zero, (const char * const *) newargz);
4563
/* failed to start process */
4564
lt_debugprintf (__FILE__, __LINE__,
4565
"(main) failed to launch target \"%s\": %s\n",
4566
lt_argv_zero, nonnull (strerror (errno)));
4574
execv (lt_argv_zero, newargz);
4575
return rval; /* =127, but avoids unused variable warning */
4584
xmalloc (size_t num)
4586
void *p = (void *) malloc (num);
4588
lt_fatal (__FILE__, __LINE__, "memory exhausted");
4594
xstrdup (const char *string)
4596
return string ? strcpy ((char *) xmalloc (strlen (string) + 1),
4601
base_name (const char *name)
4605
#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
4606
/* Skip over the disk name in MSDOS pathnames. */
4607
if (isalpha ((unsigned char) name[0]) && name[1] == ':')
4611
for (base = name; *name; name++)
4612
if (IS_DIR_SEPARATOR (*name))
4618
check_executable (const char *path)
4622
lt_debugprintf (__FILE__, __LINE__, "(check_executable): %s\n",
4624
if ((!path) || (!*path))
4627
if ((stat (path, &st) >= 0)
4628
&& (st.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH)))
4635
make_executable (const char *path)
4640
lt_debugprintf (__FILE__, __LINE__, "(make_executable): %s\n",
4642
if ((!path) || (!*path))
4645
if (stat (path, &st) >= 0)
4647
rval = chmod (path, st.st_mode | S_IXOTH | S_IXGRP | S_IXUSR);
4652
/* Searches for the full path of the wrapper. Returns
4653
newly allocated full path name if found, NULL otherwise
4654
Does not chase symlinks, even on platforms that support them.
4657
find_executable (const char *wrapper)
4662
/* static buffer for getcwd */
4663
char tmp[LT_PATHMAX + 1];
4667
lt_debugprintf (__FILE__, __LINE__, "(find_executable): %s\n",
4668
nonempty (wrapper));
4670
if ((wrapper == NULL) || (*wrapper == '\0'))
4673
/* Absolute path? */
4674
#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
4675
if (isalpha ((unsigned char) wrapper[0]) && wrapper[1] == ':')
4677
concat_name = xstrdup (wrapper);
4678
if (check_executable (concat_name))
4680
XFREE (concat_name);
4685
if (IS_DIR_SEPARATOR (wrapper[0]))
4687
concat_name = xstrdup (wrapper);
4688
if (check_executable (concat_name))
4690
XFREE (concat_name);
4692
#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
4696
for (p = wrapper; *p; p++)
4704
/* no slashes; search PATH */
4705
const char *path = getenv ("PATH");
4708
for (p = path; *p; p = p_next)
4712
for (q = p; *q; q++)
4713
if (IS_PATH_SEPARATOR (*q))
4716
p_next = (*q == '\0' ? q : q + 1);
4719
/* empty path: current directory */
4720
if (getcwd (tmp, LT_PATHMAX) == NULL)
4721
lt_fatal (__FILE__, __LINE__, "getcwd failed: %s",
4722
nonnull (strerror (errno)));
4723
tmp_len = strlen (tmp);
4725
XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1);
4726
memcpy (concat_name, tmp, tmp_len);
4727
concat_name[tmp_len] = '/';
4728
strcpy (concat_name + tmp_len + 1, wrapper);
4733
XMALLOC (char, p_len + 1 + strlen (wrapper) + 1);
4734
memcpy (concat_name, p, p_len);
4735
concat_name[p_len] = '/';
4736
strcpy (concat_name + p_len + 1, wrapper);
4738
if (check_executable (concat_name))
4740
XFREE (concat_name);
4743
/* not found in PATH; assume curdir */
4745
/* Relative path | not found in path: prepend cwd */
4746
if (getcwd (tmp, LT_PATHMAX) == NULL)
4747
lt_fatal (__FILE__, __LINE__, "getcwd failed: %s",
4748
nonnull (strerror (errno)));
4749
tmp_len = strlen (tmp);
4750
concat_name = XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1);
4751
memcpy (concat_name, tmp, tmp_len);
4752
concat_name[tmp_len] = '/';
4753
strcpy (concat_name + tmp_len + 1, wrapper);
4755
if (check_executable (concat_name))
4757
XFREE (concat_name);
4762
chase_symlinks (const char *pathspec)
4765
return xstrdup (pathspec);
4767
char buf[LT_PATHMAX];
4769
char *tmp_pathspec = xstrdup (pathspec);
4771
int has_symlinks = 0;
4772
while (strlen (tmp_pathspec) && !has_symlinks)
4774
lt_debugprintf (__FILE__, __LINE__,
4775
"checking path component for symlinks: %s\n",
4777
if (lstat (tmp_pathspec, &s) == 0)
4779
if (S_ISLNK (s.st_mode) != 0)
4785
/* search backwards for last DIR_SEPARATOR */
4786
p = tmp_pathspec + strlen (tmp_pathspec) - 1;
4787
while ((p > tmp_pathspec) && (!IS_DIR_SEPARATOR (*p)))
4789
if ((p == tmp_pathspec) && (!IS_DIR_SEPARATOR (*p)))
4791
/* no more DIR_SEPARATORS left */
4798
lt_fatal (__FILE__, __LINE__,
4799
"error accessing file \"%s\": %s",
4800
tmp_pathspec, nonnull (strerror (errno)));
4803
XFREE (tmp_pathspec);
4807
return xstrdup (pathspec);
4810
tmp_pathspec = realpath (pathspec, buf);
4811
if (tmp_pathspec == 0)
4813
lt_fatal (__FILE__, __LINE__,
4814
"could not follow symlinks for %s", pathspec);
4816
return xstrdup (tmp_pathspec);
4821
strendzap (char *str, const char *pat)
4825
assert (str != NULL);
4826
assert (pat != NULL);
4829
patlen = strlen (pat);
4833
str += len - patlen;
4834
if (strcmp (str, pat) == 0)
4841
lt_debugprintf (const char *file, int line, const char *fmt, ...)
4846
(void) fprintf (stderr, "%s:%s:%d: ", program_name, file, line);
4847
va_start (args, fmt);
4848
(void) vfprintf (stderr, fmt, args);
4854
lt_error_core (int exit_status, const char *file,
4855
int line, const char *mode,
4856
const char *message, va_list ap)
4858
fprintf (stderr, "%s:%s:%d: %s: ", program_name, file, line, mode);
4859
vfprintf (stderr, message, ap);
4860
fprintf (stderr, ".\n");
4862
if (exit_status >= 0)
4867
lt_fatal (const char *file, int line, const char *message, ...)
4870
va_start (ap, message);
4871
lt_error_core (EXIT_FAILURE, file, line, "FATAL", message, ap);
4876
nonnull (const char *s)
4878
return s ? s : "(null)";
4882
nonempty (const char *s)
4884
return (s && !*s) ? "(empty)" : nonnull (s);
4888
lt_setenv (const char *name, const char *value)
4890
lt_debugprintf (__FILE__, __LINE__,
4891
"(lt_setenv) setting '%s' to '%s'\n",
4892
nonnull (name), nonnull (value));
4895
/* always make a copy, for consistency with !HAVE_SETENV */
4896
char *str = xstrdup (value);
4897
setenv (name, str, 1);
4899
int len = strlen (name) + 1 + strlen (value) + 1;
4900
char *str = XMALLOC (char, len);
4901
sprintf (str, "%s=%s", name, value);
4902
if (putenv (str) != EXIT_SUCCESS)
4911
lt_extend_str (const char *orig_value, const char *add, int to_end)
4914
if (orig_value && *orig_value)
4916
int orig_value_len = strlen (orig_value);
4917
int add_len = strlen (add);
4918
new_value = XMALLOC (char, add_len + orig_value_len + 1);
4921
strcpy (new_value, orig_value);
4922
strcpy (new_value + orig_value_len, add);
4926
strcpy (new_value, add);
4927
strcpy (new_value + add_len, orig_value);
4932
new_value = xstrdup (add);
4938
lt_update_exe_path (const char *name, const char *value)
4940
lt_debugprintf (__FILE__, __LINE__,
4941
"(lt_update_exe_path) modifying '%s' by prepending '%s'\n",
4942
nonnull (name), nonnull (value));
4944
if (name && *name && value && *value)
4946
char *new_value = lt_extend_str (getenv (name), value, 0);
4947
/* some systems can't cope with a ':'-terminated path #' */
4948
int len = strlen (new_value);
4949
while (((len = strlen (new_value)) > 0) && IS_PATH_SEPARATOR (new_value[len-1]))
4951
new_value[len-1] = '\0';
4953
lt_setenv (name, new_value);
4959
lt_update_lib_path (const char *name, const char *value)
4961
lt_debugprintf (__FILE__, __LINE__,
4962
"(lt_update_lib_path) modifying '%s' by prepending '%s'\n",
4963
nonnull (name), nonnull (value));
4965
if (name && *name && value && *value)
4967
char *new_value = lt_extend_str (getenv (name), value, 0);
4968
lt_setenv (name, new_value);
4978
/* Prepares an argument vector before calling spawn().
4979
Note that spawn() does not by itself call the command interpreter
4980
(getenv ("COMSPEC") != NULL ? getenv ("COMSPEC") :
4981
({ OSVERSIONINFO v; v.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
4983
v.dwPlatformId == VER_PLATFORM_WIN32_NT;
4984
}) ? "cmd.exe" : "command.com").
4985
Instead it simply concatenates the arguments, separated by ' ', and calls
4986
CreateProcess(). We must quote the arguments since Win32 CreateProcess()
4987
interprets characters like ' ', '\t', '\\', '"' (but not '<' and '>') in a
4989
- Space and tab are interpreted as delimiters. They are not treated as
4990
delimiters if they are surrounded by double quotes: "...".
4991
- Unescaped double quotes are removed from the input. Their only effect is
4992
that within double quotes, space and tab are treated like normal
4994
- Backslashes not followed by double quotes are not special.
4995
- But 2*n+1 backslashes followed by a double quote become
4996
n backslashes followed by a double quote (n >= 0):
5001
#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"
5002
#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"
5004
prepare_spawn (char **argv)
5010
/* Count number of arguments. */
5011
for (argc = 0; argv[argc] != NULL; argc++)
5014
/* Allocate new argument vector. */
5015
new_argv = XMALLOC (char *, argc + 1);
5017
/* Put quoted arguments into the new argument vector. */
5018
for (i = 0; i < argc; i++)
5020
const char *string = argv[i];
5022
if (string[0] == '\0')
5023
new_argv[i] = xstrdup ("\"\"");
5024
else if (strpbrk (string, SHELL_SPECIAL_CHARS) != NULL)
5026
int quote_around = (strpbrk (string, SHELL_SPACE_CHARS) != NULL);
5028
unsigned int backslashes;
5030
char *quoted_string;
5037
for (s = string; *s != '\0'; s++)
5041
length += backslashes + 1;
5049
length += backslashes + 1;
5051
quoted_string = XMALLOC (char, length + 1);
5057
for (s = string; *s != '\0'; s++)
5063
for (j = backslashes + 1; j > 0; j--)
5075
for (j = backslashes; j > 0; j--)
5081
new_argv[i] = quoted_string;
5084
new_argv[i] = (char *) string;
5086
new_argv[argc] = NULL;
5095
void lt_dump_script (FILE* f)
5098
func_emit_wrapper yes |
5100
s/^\(.\{79\}\)\(..*\)/\1\
5105
s/\([^\n]*\).*/ fputs ("\1", f);/p
5112
# end: func_emit_cwrapperexe_src
5114
# func_win32_import_lib_p ARG
5115
# True if ARG is an import lib, as indicated by $file_magic_cmd
5116
func_win32_import_lib_p ()
5119
case `eval $file_magic_cmd \"\$1\" 2>/dev/null | $SED -e 10q` in
5125
# func_mode_link arg...
842
*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
5130
*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
843
5131
# It is impossible to link a dll without this setting, and
844
5132
# we shouldn't force the makefile maintainer to figure out
845
5133
# which system we are compiling for in order to pass an extra
5245
9471
# Directory that this library needs to be installed in:
5246
9472
libdir='$install_libdir'"
5247
9473
if test "$installed" = no && test "$need_relink" = yes; then
5249
9475
relink_command=\"$relink_command\""
5254
9480
# Do a symbolic link so that the libtool archive can be found in
5255
9481
# LD_LIBRARY_PATH before the program is installed.
5256
$show "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)"
5257
$run eval '(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)' || exit $?
5263
# libtool install mode
5265
modename="$modename: install"
5267
# There may be an optional sh(1) argument at the beginning of
5268
# install_prog (especially on Windows NT).
5269
if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh ||
5270
# Allow the use of GNU shtool's install command.
5271
$echo "X$nonopt" | $Xsed | grep shtool > /dev/null; then
5272
# Aesthetically quote it.
5273
arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"`
5275
*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
5279
install_prog="$arg "
5287
# The real first argument should be the name of the installation program.
5288
# Aesthetically quote it.
5289
arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
5291
*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
5295
install_prog="$install_prog$arg"
5297
# We need to accept at least all the BSD install flags.
5307
if test -n "$dest"; then
5308
files="$files $dest"
5326
# If the previous option needed an argument, then skip it.
5327
if test -n "$prev"; then
5336
# Aesthetically quote the argument.
5337
arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
5339
*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
5343
install_prog="$install_prog $arg"
5346
if test -z "$install_prog"; then
5347
$echo "$modename: you must specify an install program" 1>&2
5352
if test -n "$prev"; then
5353
$echo "$modename: the \`$prev' option requires an argument" 1>&2
5358
if test -z "$files"; then
5359
if test -z "$dest"; then
5360
$echo "$modename: no file or destination specified" 1>&2
5362
$echo "$modename: you must specify a destination" 1>&2
5368
# Strip any trailing slash from the destination.
5369
dest=`$echo "X$dest" | $Xsed -e 's%/$%%'`
5371
# Check to see that the destination is a directory.
5372
test -d "$dest" && isdir=yes
5373
if test "$isdir" = yes; then
5377
destdir=`$echo "X$dest" | $Xsed -e 's%/[^/]*$%%'`
5378
test "X$destdir" = "X$dest" && destdir=.
5379
destname=`$echo "X$dest" | $Xsed -e 's%^.*/%%'`
5381
# Not a directory, so check to see that there is only one file specified.
5383
if test "$#" -gt 2; then
5384
$echo "$modename: \`$dest' is not a directory" 1>&2
5390
[\\/]* | [A-Za-z]:[\\/]*) ;;
5392
for file in $files; do
5396
$echo "$modename: \`$destdir' must be an absolute directory name" 1>&2
5405
# This variable tells wrapper scripts just to set variables rather
5406
# than running their programs.
5407
libtool_install_magic="$magic"
5412
for file in $files; do
5414
# Do each installation.
5417
# Do the static libraries later.
5418
staticlibs="$staticlibs $file"
5422
# Check to see that this really is a libtool archive.
5423
if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
5425
$echo "$modename: \`$file' is not a valid libtool archive" 1>&2
5433
# If there is no directory component, then add one.
5435
*/* | *\\*) . $file ;;
5439
# Add the libdir to current_libdirs if it is the destination.
5440
if test "X$destdir" = "X$libdir"; then
5441
case "$current_libdirs " in
5443
*) current_libdirs="$current_libdirs $libdir" ;;
5446
# Note the libdir as a future libdir.
5447
case "$future_libdirs " in
5449
*) future_libdirs="$future_libdirs $libdir" ;;
5453
dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`/
5454
test "X$dir" = "X$file/" && dir=
5457
if test -n "$relink_command"; then
5458
# Determine the prefix the user has applied to our future dir.
5459
inst_prefix_dir=`$echo "$destdir" | $SED "s%$libdir\$%%"`
5461
# Don't allow the user to place us outside of our expected
5462
# location b/c this prevents finding dependent libraries that
5463
# are installed to the same prefix.
5464
# At present, this check doesn't affect windows .dll's that
5465
# are installed into $libdir/../bin (currently, that works fine)
5466
# but it's something to keep an eye on.
5467
if test "$inst_prefix_dir" = "$destdir"; then
5468
$echo "$modename: error: cannot install \`$file' to a directory not ending in $libdir" 1>&2
5472
if test -n "$inst_prefix_dir"; then
5473
# Stick the inst_prefix_dir data into the link command.
5474
relink_command=`$echo "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"`
5476
relink_command=`$echo "$relink_command" | $SED "s%@inst_prefix_dir@%%"`
5479
$echo "$modename: warning: relinking \`$file'" 1>&2
5480
$show "$relink_command"
5481
if $run eval "$relink_command"; then :
5483
$echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
5488
# See the names of the shared library.
5489
set dummy $library_names
5490
if test -n "$2"; then
5496
test -n "$relink_command" && srcname="$realname"T
5498
# Install the shared library and build the symlinks.
5499
$show "$install_prog $dir/$srcname $destdir/$realname"
5500
$run eval "$install_prog $dir/$srcname $destdir/$realname" || exit $?
5501
if test -n "$stripme" && test -n "$striplib"; then
5502
$show "$striplib $destdir/$realname"
5503
$run eval "$striplib $destdir/$realname" || exit $?
5506
if test "$#" -gt 0; then
5507
# Delete the old symlinks, and create new ones.
5510
if test "$linkname" != "$realname"; then
5511
$show "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)"
5512
$run eval "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)"
5517
# Do each command in the postinstall commands.
5518
lib="$destdir/$realname"
5519
cmds=$postinstall_cmds
5520
save_ifs="$IFS"; IFS='~'
5521
for cmd in $cmds; do
5525
$run eval "$cmd" || exit $?
5530
# Install the pseudo-library for information purposes.
5531
name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
5532
instname="$dir/$name"i
5533
$show "$install_prog $instname $destdir/$name"
5534
$run eval "$install_prog $instname $destdir/$name" || exit $?
5536
# Maybe install the static library, too.
5537
test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library"
5541
# Install (i.e. copy) a libtool object.
5543
# Figure out destination file name, if it wasn't already specified.
5544
if test -n "$destname"; then
5545
destfile="$destdir/$destname"
5547
destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
5548
destfile="$destdir/$destfile"
5551
# Deduce the name of the destination old-style object file.
5554
staticdest=`$echo "X$destfile" | $Xsed -e "$lo2o"`
5557
staticdest="$destfile"
5561
$echo "$modename: cannot copy a libtool object to \`$destfile'" 1>&2
5567
# Install the libtool object if requested.
5568
if test -n "$destfile"; then
5569
$show "$install_prog $file $destfile"
5570
$run eval "$install_prog $file $destfile" || exit $?
5573
# Install the old object if enabled.
5574
if test "$build_old_libs" = yes; then
5575
# Deduce the name of the old-style object file.
5576
staticobj=`$echo "X$file" | $Xsed -e "$lo2o"`
5578
$show "$install_prog $staticobj $staticdest"
5579
$run eval "$install_prog \$staticobj \$staticdest" || exit $?
5585
# Figure out destination file name, if it wasn't already specified.
5586
if test -n "$destname"; then
5587
destfile="$destdir/$destname"
5589
destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
5590
destfile="$destdir/$destfile"
5593
# If the file is missing, and there is a .exe on the end, strip it
5594
# because it is most likely a libtool script we actually want to
5599
if test ! -f "$file"; then
5600
file=`$echo $file|${SED} 's,.exe$,,'`
5606
# Do a test to see if this is really a libtool program.
5609
wrapper=`$echo $file | ${SED} -e 's,.exe$,,'`
5615
if (${SED} -e '4q' $wrapper | grep "^# Generated by .*$PACKAGE")>/dev/null 2>&1; then
5619
# To insure that "foo" is sourced, and not "foo.exe",
5620
# finese the cygwin/MSYS system by explicitly sourcing "foo."
5621
# which disallows the automatic-append-.exe behavior.
5623
*cygwin* | *mingw*) wrapperdot=${wrapper}. ;;
5624
*) wrapperdot=${wrapper} ;;
5626
# If there is no directory component, then add one.
5628
*/* | *\\*) . ${wrapperdot} ;;
5629
*) . ./${wrapperdot} ;;
5632
# Check the variables that should have been set.
5633
if test -z "$notinst_deplibs"; then
5634
$echo "$modename: invalid libtool wrapper script \`$wrapper'" 1>&2
5639
for lib in $notinst_deplibs; do
5640
# Check to see that each library is installed.
5642
if test -f "$lib"; then
5643
# If there is no directory component, then add one.
5645
*/* | *\\*) . $lib ;;
5649
libfile="$libdir/"`$echo "X$lib" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test
5650
if test -n "$libdir" && test ! -f "$libfile"; then
5651
$echo "$modename: warning: \`$lib' has not been installed in \`$libdir'" 1>&2
5657
# To insure that "foo" is sourced, and not "foo.exe",
5658
# finese the cygwin/MSYS system by explicitly sourcing "foo."
5659
# which disallows the automatic-append-.exe behavior.
5661
*cygwin* | *mingw*) wrapperdot=${wrapper}. ;;
5662
*) wrapperdot=${wrapper} ;;
5664
# If there is no directory component, then add one.
5666
*/* | *\\*) . ${wrapperdot} ;;
5667
*) . ./${wrapperdot} ;;
5671
if test "$fast_install" = no && test -n "$relink_command"; then
5672
if test "$finalize" = yes && test -z "$run"; then
5674
test -n "$TMPDIR" && tmpdir="$TMPDIR"
5675
tmpdir="$tmpdir/libtool-$$"
5676
if $mkdir "$tmpdir" && chmod 700 "$tmpdir"; then :
5678
$echo "$modename: error: cannot create temporary directory \`$tmpdir'" 1>&2
5681
file=`$echo "X$file$stripped_ext" | $Xsed -e 's%^.*/%%'`
5682
outputname="$tmpdir/$file"
5683
# Replace the output file specification.
5684
relink_command=`$echo "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'`
5686
$show "$relink_command"
5687
if $run eval "$relink_command"; then :
5689
$echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
5695
$echo "$modename: warning: cannot relink \`$file'" 1>&2
5698
# Install the binary that we compiled earlier.
5699
file=`$echo "X$file$stripped_ext" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"`
5703
# remove .exe since cygwin /usr/bin/install will append another
5705
case $install_prog,$host in
5706
*/usr/bin/install*,*cygwin*)
5707
case $file:$destfile in
5712
destfile=$destfile.exe
5715
destfile=`$echo $destfile | ${SED} -e 's,.exe$,,'`
5720
$show "$install_prog$stripme $file $destfile"
5721
$run eval "$install_prog\$stripme \$file \$destfile" || exit $?
5722
test -n "$outputname" && ${rm}r "$tmpdir"
5727
for file in $staticlibs; do
5728
name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
5730
# Set up the ranlib parameters.
5731
oldlib="$destdir/$name"
5733
$show "$install_prog $file $oldlib"
5734
$run eval "$install_prog \$file \$oldlib" || exit $?
5736
if test -n "$stripme" && test -n "$old_striplib"; then
5737
$show "$old_striplib $oldlib"
5738
$run eval "$old_striplib $oldlib" || exit $?
5741
# Do each command in the postinstall commands.
5742
cmds=$old_postinstall_cmds
5743
save_ifs="$IFS"; IFS='~'
5744
for cmd in $cmds; do
5748
$run eval "$cmd" || exit $?
5753
if test -n "$future_libdirs"; then
5754
$echo "$modename: warning: remember to run \`$progname --finish$future_libdirs'" 1>&2
5757
if test -n "$current_libdirs"; then
5758
# Maybe just do a dry run.
5759
test -n "$run" && current_libdirs=" -n$current_libdirs"
5760
exec_cmd='$SHELL $0 $preserve_args --finish$current_libdirs'
5766
# libtool finish mode
5768
modename="$modename: finish"
5772
if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
5775
libdirs="$libdirs $dir"
5778
for libdir in $libdirs; do
5779
if test -n "$finish_cmds"; then
5780
# Do each command in the finish commands.
5782
save_ifs="$IFS"; IFS='~'
5783
for cmd in $cmds; do
5787
$run eval "$cmd" || admincmds="$admincmds
5792
if test -n "$finish_eval"; then
5793
# Do the single finish_eval.
5794
eval cmds=\"$finish_eval\"
5795
$run eval "$cmds" || admincmds="$admincmds
5801
# Exit here if they wanted silent mode.
5802
test "$show" = : && exit 0
5804
$echo "----------------------------------------------------------------------"
5805
$echo "Libraries have been installed in:"
5806
for libdir in $libdirs; do
5810
$echo "If you ever happen to want to link against installed libraries"
5811
$echo "in a given directory, LIBDIR, you must either use libtool, and"
5812
$echo "specify the full pathname of the library, or use the \`-LLIBDIR'"
5813
$echo "flag during linking and do at least one of the following:"
5814
if test -n "$shlibpath_var"; then
5815
$echo " - add LIBDIR to the \`$shlibpath_var' environment variable"
5816
$echo " during execution"
5818
if test -n "$runpath_var"; then
5819
$echo " - add LIBDIR to the \`$runpath_var' environment variable"
5820
$echo " during linking"
5822
if test -n "$hardcode_libdir_flag_spec"; then
5824
eval flag=\"$hardcode_libdir_flag_spec\"
5826
$echo " - use the \`$flag' linker flag"
5828
if test -n "$admincmds"; then
5829
$echo " - have your system administrator run these commands:$admincmds"
5831
if test -f /etc/ld.so.conf; then
5832
$echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'"
5835
$echo "See any operating system documentation about shared libraries for"
5836
$echo "more information, such as the ld(1) and ld.so(8) manual pages."
5837
$echo "----------------------------------------------------------------------"
5841
# libtool execute mode
5843
modename="$modename: execute"
5845
# The first argument is the command name.
5847
if test -z "$cmd"; then
5848
$echo "$modename: you must specify a COMMAND" 1>&2
5853
# Handle -dlopen flags immediately.
5854
for file in $execute_dlfiles; do
5855
if test ! -f "$file"; then
5856
$echo "$modename: \`$file' is not a file" 1>&2
5864
# Check to see that this really is a libtool archive.
5865
if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
5867
$echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
5872
# Read the libtool library.
5876
# If there is no directory component, then add one.
5878
*/* | *\\*) . $file ;;
5882
# Skip this library if it cannot be dlopened.
5883
if test -z "$dlname"; then
5884
# Warn if it was a shared library.
5885
test -n "$library_names" && $echo "$modename: warning: \`$file' was not linked with \`-export-dynamic'"
5889
dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
5890
test "X$dir" = "X$file" && dir=.
5892
if test -f "$dir/$objdir/$dlname"; then
5895
$echo "$modename: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2
5901
# Just add the directory containing the .lo file.
5902
dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
5903
test "X$dir" = "X$file" && dir=.
5907
$echo "$modename: warning \`-dlopen' is ignored for non-libtool libraries and objects" 1>&2
5912
# Get the absolute pathname.
5913
absdir=`cd "$dir" && pwd`
5914
test -n "$absdir" && dir="$absdir"
5916
# Now add the directory to shlibpath_var.
5917
if eval "test -z \"\$$shlibpath_var\""; then
5918
eval "$shlibpath_var=\"\$dir\""
5920
eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\""
5924
# This variable tells wrapper scripts just to set shlibpath_var
5925
# rather than running their programs.
5926
libtool_execute_magic="$magic"
5928
# Check if any of the arguments is a wrapper script.
5935
# Do a test to see if this is really a libtool program.
5936
if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
5937
# If there is no directory component, then add one.
5939
*/* | *\\*) . $file ;;
5943
# Transform arg to wrapped name.
5944
file="$progdir/$program"
5948
# Quote arguments (to preserve shell metacharacters).
5949
file=`$echo "X$file" | $Xsed -e "$sed_quote_subst"`
5950
args="$args \"$file\""
5953
if test -z "$run"; then
5954
if test -n "$shlibpath_var"; then
5955
# Export the shlibpath_var.
5956
eval "export $shlibpath_var"
5959
# Restore saved environment variables
5960
if test "${save_LC_ALL+set}" = set; then
5961
LC_ALL="$save_LC_ALL"; export LC_ALL
5963
if test "${save_LANG+set}" = set; then
5964
LANG="$save_LANG"; export LANG
5967
# Now prepare to actually exec the command.
5968
exec_cmd="\$cmd$args"
5970
# Display what would be done.
5971
if test -n "$shlibpath_var"; then
5972
eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\""
5973
$echo "export $shlibpath_var"
5980
# libtool clean and uninstall mode
5982
modename="$modename: $mode"
9482
func_show_eval '( cd "$output_objdir" && $RM "$outputname" && $LN_S "../$outputname" "$outputname" )' 'exit $?'
9488
{ test "$opt_mode" = link || test "$opt_mode" = relink; } &&
9489
func_mode_link ${1+"$@"}
9492
# func_mode_uninstall arg...
9493
func_mode_uninstall ()