Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
sudo-project
GitHub Repository: sudo-project/sudo
Path: blob/main/scripts/ltmain.sh
1532 views
1
#! /usr/bin/env sh
2
## DO NOT EDIT - This file generated from ./build-aux/ltmain.in
3
## by inline-source v2019-02-19.15
4
5
# libtool (GNU libtool) 2.5.4
6
# Provide generalized library-building support services.
7
# Written by Gordon Matzigkeit <[email protected]>, 1996
8
9
# Copyright (C) 1996-2019, 2021-2024 Free Software Foundation, Inc.
10
# This is free software; see the source for copying conditions. There is NO
11
# warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12
13
# GNU Libtool is free software; you can redistribute it and/or modify
14
# it under the terms of the GNU General Public License as published by
15
# the Free Software Foundation; either version 2 of the License, or
16
# (at your option) any later version.
17
#
18
# As a special exception to the GNU General Public License,
19
# if you distribute this file as part of a program or library that
20
# is built using GNU Libtool, you may include this file under the
21
# same distribution terms that you use for the rest of that program.
22
#
23
# GNU Libtool is distributed in the hope that it will be useful, but
24
# WITHOUT ANY WARRANTY; without even the implied warranty of
25
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
26
# General Public License for more details.
27
#
28
# You should have received a copy of the GNU General Public License
29
# along with this program. If not, see <http://www.gnu.org/licenses/>.
30
31
32
PROGRAM=libtool
33
PACKAGE=libtool
34
VERSION=2.5.4
35
package_revision=2.5.4
36
37
38
## ------ ##
39
## Usage. ##
40
## ------ ##
41
42
# Run './libtool --help' for help with using this script from the
43
# command line.
44
45
46
## ------------------------------- ##
47
## User overridable command paths. ##
48
## ------------------------------- ##
49
50
# After configure completes, it has a better idea of some of the
51
# shell tools we need than the defaults used by the functions shared
52
# with bootstrap, so set those here where they can still be over-
53
# ridden by the user, but otherwise take precedence.
54
55
: ${AUTOCONF="autoconf"}
56
: ${AUTOMAKE="automake"}
57
58
59
## -------------------------- ##
60
## Source external libraries. ##
61
## -------------------------- ##
62
63
# Much of our low-level functionality needs to be sourced from external
64
# libraries, which are installed to $pkgauxdir.
65
66
# Set a version string for this script.
67
scriptversion=2019-02-19.15; # UTC
68
69
# General shell script boiler plate, and helper functions.
70
# Written by Gary V. Vaughan, 2004
71
72
# This is free software. There is NO warranty; not even for
73
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
74
#
75
# Copyright (C) 2004-2019, 2021, 2023-2024 Bootstrap Authors
76
#
77
# This file is dual licensed under the terms of the MIT license
78
# <https://opensource.org/licenses/MIT>, and GPL version 2 or later
79
# <https://www.gnu.org/licenses/gpl-2.0.html>. You must apply one of
80
# these licenses when using or redistributing this software or any of
81
# the files within it. See the URLs above, or the file `LICENSE`
82
# included in the Bootstrap distribution for the full license texts.
83
84
# Please report bugs or propose patches to:
85
# <https://github.com/gnulib-modules/bootstrap/issues>
86
87
88
## ------ ##
89
## Usage. ##
90
## ------ ##
91
92
# Evaluate this file near the top of your script to gain access to
93
# the functions and variables defined here:
94
#
95
# . `echo "$0" | ${SED-sed} 's|[^/]*$||'`/build-aux/funclib.sh
96
#
97
# If you need to override any of the default environment variable
98
# settings, do that before evaluating this file.
99
100
101
## -------------------- ##
102
## Shell normalisation. ##
103
## -------------------- ##
104
105
# Some shells need a little help to be as Bourne compatible as possible.
106
# Before doing anything else, make sure all that help has been provided!
107
108
DUALCASE=1; export DUALCASE # for MKS sh
109
if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then :
110
emulate sh
111
NULLCMD=:
112
# Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which
113
# is contrary to our usage. Disable this feature.
114
alias -g '${1+"$@"}'='"$@"'
115
setopt NO_GLOB_SUBST
116
else
117
case `(set -o) 2>/dev/null` in *posix*) set -o posix ;; esac
118
fi
119
120
# NLS nuisances: We save the old values in case they are required later.
121
_G_user_locale=
122
_G_safe_locale=
123
for _G_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
124
do
125
eval "if test set = \"\${$_G_var+set}\"; then
126
save_$_G_var=\$$_G_var
127
$_G_var=C
128
export $_G_var
129
_G_user_locale=\"$_G_var=\\\$save_\$_G_var; \$_G_user_locale\"
130
_G_safe_locale=\"$_G_var=C; \$_G_safe_locale\"
131
fi"
132
done
133
# These NLS vars are set unconditionally (bootstrap issue #24). Unset those
134
# in case the environment reset is needed later and the $save_* variant is not
135
# defined (see the code above).
136
LC_ALL=C
137
LANGUAGE=C
138
export LANGUAGE LC_ALL
139
140
# Make sure IFS has a sensible default
141
sp=' '
142
nl='
143
'
144
IFS="$sp $nl"
145
146
# There are apparently some systems that use ';' as a PATH separator!
147
if test "${PATH_SEPARATOR+set}" != set; then
148
PATH_SEPARATOR=:
149
(PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && {
150
(PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 ||
151
PATH_SEPARATOR=';'
152
}
153
fi
154
155
156
# func_unset VAR
157
# --------------
158
# Portably unset VAR.
159
# In some shells, an 'unset VAR' statement leaves a non-zero return
160
# status if VAR is already unset, which might be problematic if the
161
# statement is used at the end of a function (thus poisoning its return
162
# value) or when 'set -e' is active (causing even a spurious abort of
163
# the script in this case).
164
func_unset ()
165
{
166
{ eval $1=; (eval unset $1) >/dev/null 2>&1 && eval unset $1 || : ; }
167
}
168
169
170
# Make sure CDPATH doesn't cause `cd` commands to output the target dir.
171
func_unset CDPATH
172
173
# Make sure ${,E,F}GREP behave sanely.
174
func_unset GREP_OPTIONS
175
176
177
## ------------------------- ##
178
## Locate command utilities. ##
179
## ------------------------- ##
180
181
182
# func_executable_p FILE
183
# ----------------------
184
# Check that FILE is an executable regular file.
185
func_executable_p ()
186
{
187
test -f "$1" && test -x "$1"
188
}
189
190
191
# func_path_progs PROGS_LIST CHECK_FUNC [PATH]
192
# --------------------------------------------
193
# Search for either a program that responds to --version with output
194
# containing "GNU", or else returned by CHECK_FUNC otherwise, by
195
# trying all the directories in PATH with each of the elements of
196
# PROGS_LIST.
197
#
198
# CHECK_FUNC should accept the path to a candidate program, and
199
# set $func_check_prog_result if it truncates its output less than
200
# $_G_path_prog_max characters.
201
func_path_progs ()
202
{
203
_G_progs_list=$1
204
_G_check_func=$2
205
_G_PATH=${3-"$PATH"}
206
207
_G_path_prog_max=0
208
_G_path_prog_found=false
209
_G_save_IFS=$IFS; IFS=${PATH_SEPARATOR-:}
210
for _G_dir in $_G_PATH; do
211
IFS=$_G_save_IFS
212
test -z "$_G_dir" && _G_dir=.
213
for _G_prog_name in $_G_progs_list; do
214
for _exeext in '' .EXE; do
215
_G_path_prog=$_G_dir/$_G_prog_name$_exeext
216
func_executable_p "$_G_path_prog" || continue
217
case `"$_G_path_prog" --version 2>&1` in
218
*GNU*) func_path_progs_result=$_G_path_prog _G_path_prog_found=: ;;
219
*) $_G_check_func $_G_path_prog
220
func_path_progs_result=$func_check_prog_result
221
;;
222
esac
223
$_G_path_prog_found && break 3
224
done
225
done
226
done
227
IFS=$_G_save_IFS
228
test -z "$func_path_progs_result" && {
229
echo "no acceptable sed could be found in \$PATH" >&2
230
exit 1
231
}
232
}
233
234
235
# We want to be able to use the functions in this file before configure
236
# has figured out where the best binaries are kept, which means we have
237
# to search for them ourselves - except when the results are already set
238
# where we skip the searches.
239
240
# Unless the user overrides by setting SED, search the path for either GNU
241
# sed, or the sed that truncates its output the least.
242
test -z "$SED" && {
243
_G_sed_script=s/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb/
244
for _G_i in 1 2 3 4 5 6 7; do
245
_G_sed_script=$_G_sed_script$nl$_G_sed_script
246
done
247
echo "$_G_sed_script" 2>/dev/null | sed 99q >conftest.sed
248
_G_sed_script=
249
250
func_check_prog_sed ()
251
{
252
_G_path_prog=$1
253
254
_G_count=0
255
printf 0123456789 >conftest.in
256
while :
257
do
258
cat conftest.in conftest.in >conftest.tmp
259
mv conftest.tmp conftest.in
260
cp conftest.in conftest.nl
261
echo '' >> conftest.nl
262
"$_G_path_prog" -f conftest.sed <conftest.nl >conftest.out 2>/dev/null || break
263
diff conftest.out conftest.nl >/dev/null 2>&1 || break
264
_G_count=`expr $_G_count + 1`
265
if test "$_G_count" -gt "$_G_path_prog_max"; then
266
# Best one so far, save it but keep looking for a better one
267
func_check_prog_result=$_G_path_prog
268
_G_path_prog_max=$_G_count
269
fi
270
# 10*(2^10) chars as input seems more than enough
271
test 10 -lt "$_G_count" && break
272
done
273
rm -f conftest.in conftest.tmp conftest.nl conftest.out
274
}
275
276
func_path_progs "sed gsed" func_check_prog_sed "$PATH:/usr/xpg4/bin"
277
rm -f conftest.sed
278
SED=$func_path_progs_result
279
}
280
281
282
# Unless the user overrides by setting GREP, search the path for either GNU
283
# grep, or the grep that truncates its output the least.
284
test -z "$GREP" && {
285
func_check_prog_grep ()
286
{
287
_G_path_prog=$1
288
289
_G_count=0
290
_G_path_prog_max=0
291
printf 0123456789 >conftest.in
292
while :
293
do
294
cat conftest.in conftest.in >conftest.tmp
295
mv conftest.tmp conftest.in
296
cp conftest.in conftest.nl
297
echo 'GREP' >> conftest.nl
298
"$_G_path_prog" -e 'GREP$' -e '-(cannot match)-' <conftest.nl >conftest.out 2>/dev/null || break
299
diff conftest.out conftest.nl >/dev/null 2>&1 || break
300
_G_count=`expr $_G_count + 1`
301
if test "$_G_count" -gt "$_G_path_prog_max"; then
302
# Best one so far, save it but keep looking for a better one
303
func_check_prog_result=$_G_path_prog
304
_G_path_prog_max=$_G_count
305
fi
306
# 10*(2^10) chars as input seems more than enough
307
test 10 -lt "$_G_count" && break
308
done
309
rm -f conftest.in conftest.tmp conftest.nl conftest.out
310
}
311
312
func_path_progs "grep ggrep" func_check_prog_grep "$PATH:/usr/xpg4/bin"
313
GREP=$func_path_progs_result
314
}
315
316
317
## ------------------------------- ##
318
## User overridable command paths. ##
319
## ------------------------------- ##
320
321
# All uppercase variable names are used for environment variables. These
322
# variables can be overridden by the user before calling a script that
323
# uses them if a suitable command of that name is not already available
324
# in the command search PATH.
325
326
: ${CP="cp -f"}
327
: ${ECHO="printf %s\n"}
328
: ${EGREP="$GREP -E"}
329
: ${FGREP="$GREP -F"}
330
: ${LN_S="ln -s"}
331
: ${MAKE="make"}
332
: ${MKDIR="mkdir"}
333
: ${MV="mv -f"}
334
: ${RM="rm -f"}
335
: ${SHELL="${CONFIG_SHELL-/bin/sh}"}
336
337
338
## -------------------- ##
339
## Useful sed snippets. ##
340
## -------------------- ##
341
342
sed_dirname='s|/[^/]*$||'
343
sed_basename='s|^.*/||'
344
345
# Sed substitution that helps us do robust quoting. It backslashifies
346
# metacharacters that are still active within double-quoted strings.
347
sed_quote_subst='s|\([`"$\\]\)|\\\1|g'
348
349
# Same as above, but do not quote variable references.
350
sed_double_quote_subst='s/\(["`\\]\)/\\\1/g'
351
352
# Sed substitution that turns a string into a regex matching for the
353
# string literally.
354
sed_make_literal_regex='s|[].[^$\\*\/]|\\&|g'
355
356
# Sed substitution that converts a w32 file name or path
357
# that contains forward slashes, into one that contains
358
# (escaped) backslashes. A very naive implementation.
359
sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g'
360
361
# Re-'\' parameter expansions in output of sed_double_quote_subst that
362
# were '\'-ed in input to the same. If an odd number of '\' preceded a
363
# '$' in input to sed_double_quote_subst, that '$' was protected from
364
# expansion. Since each input '\' is now two '\'s, look for any number
365
# of runs of four '\'s followed by two '\'s and then a '$'. '\' that '$'.
366
_G_bs='\\'
367
_G_bs2='\\\\'
368
_G_bs4='\\\\\\\\'
369
_G_dollar='\$'
370
sed_double_backslash="\
371
s/$_G_bs4/&\\
372
/g
373
s/^$_G_bs2$_G_dollar/$_G_bs&/
374
s/\\([^$_G_bs]\\)$_G_bs2$_G_dollar/\\1$_G_bs2$_G_bs$_G_dollar/g
375
s/\n//g"
376
377
# require_check_ifs_backslash
378
# ---------------------------
379
# Check if we can use backslash as IFS='\' separator, and set
380
# $check_ifs_backshlash_broken to ':' or 'false'.
381
require_check_ifs_backslash=func_require_check_ifs_backslash
382
func_require_check_ifs_backslash ()
383
{
384
_G_save_IFS=$IFS
385
IFS='\'
386
_G_check_ifs_backshlash='a\\b'
387
for _G_i in $_G_check_ifs_backshlash
388
do
389
case $_G_i in
390
a)
391
check_ifs_backshlash_broken=false
392
;;
393
'')
394
break
395
;;
396
*)
397
check_ifs_backshlash_broken=:
398
break
399
;;
400
esac
401
done
402
IFS=$_G_save_IFS
403
require_check_ifs_backslash=:
404
}
405
406
407
## ----------------- ##
408
## Global variables. ##
409
## ----------------- ##
410
411
# Except for the global variables explicitly listed below, the following
412
# functions in the '^func_' namespace, and the '^require_' namespace
413
# variables initialised in the 'Resource management' section, sourcing
414
# this file will not pollute your global namespace with anything
415
# else. There's no portable way to scope variables in Bourne shell
416
# though, so actually running these functions will sometimes place
417
# results into a variable named after the function, and often use
418
# temporary variables in the '^_G_' namespace. If you are careful to
419
# avoid using those namespaces casually in your sourcing script, things
420
# should continue to work as you expect. And, of course, you can freely
421
# overwrite any of the functions or variables defined here before
422
# calling anything to customize them.
423
424
EXIT_SUCCESS=0
425
EXIT_FAILURE=1
426
EXIT_MISMATCH=63 # $? = 63 is used to indicate version mismatch to missing.
427
EXIT_SKIP=77 # $? = 77 is used to indicate a skipped test to automake.
428
429
# Allow overriding, eg assuming that you follow the convention of
430
# putting '$debug_cmd' at the start of all your functions, you can get
431
# bash to show function call trace with:
432
#
433
# debug_cmd='eval echo "${FUNCNAME[0]} $*" >&2' bash your-script-name
434
debug_cmd=${debug_cmd-":"}
435
exit_cmd=:
436
437
# By convention, finish your script with:
438
#
439
# exit $exit_status
440
#
441
# so that you can set exit_status to non-zero if you want to indicate
442
# something went wrong during execution without actually bailing out at
443
# the point of failure.
444
exit_status=$EXIT_SUCCESS
445
446
# Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh
447
# is ksh but when the shell is invoked as "sh" and the current value of
448
# the _XPG environment variable is not equal to 1 (one), the special
449
# positional parameter $0, within a function call, is the name of the
450
# function.
451
progpath=$0
452
453
# The name of this program.
454
progname=`$ECHO "$progpath" |$SED "$sed_basename"`
455
456
# Make sure we have an absolute progpath for reexecution:
457
case $progpath in
458
[\\/]*|[A-Za-z]:\\*) ;;
459
*[\\/]*)
460
progdir=`$ECHO "$progpath" |$SED "$sed_dirname"`
461
progdir=`cd "$progdir" && pwd`
462
progpath=$progdir/$progname
463
;;
464
*)
465
_G_IFS=$IFS
466
IFS=${PATH_SEPARATOR-:}
467
for progdir in $PATH; do
468
IFS=$_G_IFS
469
test -x "$progdir/$progname" && break
470
done
471
IFS=$_G_IFS
472
test -n "$progdir" || progdir=`pwd`
473
progpath=$progdir/$progname
474
;;
475
esac
476
477
478
## ----------------- ##
479
## Standard options. ##
480
## ----------------- ##
481
482
# The following options affect the operation of the functions defined
483
# below, and should be set appropriately depending on run-time para-
484
# meters passed on the command line.
485
486
opt_dry_run=false
487
opt_quiet=false
488
opt_verbose=false
489
490
# Categories 'all' and 'none' are always available. Append any others
491
# you will pass as the first argument to func_warning from your own
492
# code.
493
warning_categories=
494
495
# By default, display warnings according to 'opt_warning_types'. Set
496
# 'warning_func' to ':' to elide all warnings, or func_fatal_error to
497
# treat the next displayed warning as a fatal error.
498
warning_func=func_warn_and_continue
499
500
# Set to 'all' to display all warnings, 'none' to suppress all
501
# warnings, or a space delimited list of some subset of
502
# 'warning_categories' to display only the listed warnings.
503
opt_warning_types=all
504
505
506
## -------------------- ##
507
## Resource management. ##
508
## -------------------- ##
509
510
# This section contains definitions for functions that each ensure a
511
# particular resource (a file, or a non-empty configuration variable for
512
# example) is available, and if appropriate to extract default values
513
# from pertinent package files. Call them using their associated
514
# 'require_*' variable to ensure that they are executed, at most, once.
515
#
516
# It's entirely deliberate that calling these functions can set
517
# variables that don't obey the namespace limitations obeyed by the rest
518
# of this file, in order that that they be as useful as possible to
519
# callers.
520
521
522
# require_term_colors
523
# -------------------
524
# Allow display of bold text on terminals that support it.
525
require_term_colors=func_require_term_colors
526
func_require_term_colors ()
527
{
528
$debug_cmd
529
530
test -t 1 && {
531
# COLORTERM and USE_ANSI_COLORS environment variables take
532
# precedence, because most terminfo databases neglect to describe
533
# whether color sequences are supported.
534
test -n "${COLORTERM+set}" && : ${USE_ANSI_COLORS="1"}
535
536
if test 1 = "$USE_ANSI_COLORS"; then
537
# Standard ANSI escape sequences
538
tc_reset=''
539
tc_bold=''; tc_standout=''
540
tc_red=''; tc_green=''
541
tc_blue=''; tc_cyan=''
542
else
543
# Otherwise trust the terminfo database after all.
544
test -n "`tput sgr0 2>/dev/null`" && {
545
tc_reset=`tput sgr0`
546
test -n "`tput bold 2>/dev/null`" && tc_bold=`tput bold`
547
tc_standout=$tc_bold
548
test -n "`tput smso 2>/dev/null`" && tc_standout=`tput smso`
549
test -n "`tput setaf 1 2>/dev/null`" && tc_red=`tput setaf 1`
550
test -n "`tput setaf 2 2>/dev/null`" && tc_green=`tput setaf 2`
551
test -n "`tput setaf 4 2>/dev/null`" && tc_blue=`tput setaf 4`
552
test -n "`tput setaf 5 2>/dev/null`" && tc_cyan=`tput setaf 5`
553
}
554
fi
555
}
556
557
require_term_colors=:
558
}
559
560
561
## ----------------- ##
562
## Function library. ##
563
## ----------------- ##
564
565
# This section contains a variety of useful functions to call in your
566
# scripts. Take note of the portable wrappers for features provided by
567
# some modern shells, which will fall back to slower equivalents on
568
# less featureful shells.
569
570
571
# func_append VAR VALUE
572
# ---------------------
573
# Append VALUE onto the existing contents of VAR.
574
575
# We should try to minimise forks, especially on Windows where they are
576
# unreasonably slow, so skip the feature probes when bash or zsh are
577
# being used:
578
if test set = "${BASH_VERSION+set}${ZSH_VERSION+set}"; then
579
: ${_G_HAVE_ARITH_OP="yes"}
580
: ${_G_HAVE_XSI_OPS="yes"}
581
# The += operator was introduced in bash 3.1
582
case $BASH_VERSION in
583
[12].* | 3.0 | 3.0*) ;;
584
*)
585
: ${_G_HAVE_PLUSEQ_OP="yes"}
586
;;
587
esac
588
fi
589
590
# _G_HAVE_PLUSEQ_OP
591
# Can be empty, in which case the shell is probed, "yes" if += is
592
# usable or anything else if it does not work.
593
test -z "$_G_HAVE_PLUSEQ_OP" \
594
&& (eval 'x=a; x+=" b"; test "a b" = "$x"') 2>/dev/null \
595
&& _G_HAVE_PLUSEQ_OP=yes
596
597
if test yes = "$_G_HAVE_PLUSEQ_OP"
598
then
599
# This is an XSI compatible shell, allowing a faster implementation...
600
eval 'func_append ()
601
{
602
$debug_cmd
603
604
eval "$1+=\$2"
605
}'
606
else
607
# ...otherwise fall back to using expr, which is often a shell builtin.
608
func_append ()
609
{
610
$debug_cmd
611
612
eval "$1=\$$1\$2"
613
}
614
fi
615
616
617
# func_append_quoted VAR VALUE
618
# ----------------------------
619
# Quote VALUE and append to the end of shell variable VAR, separated
620
# by a space.
621
if test yes = "$_G_HAVE_PLUSEQ_OP"; then
622
eval 'func_append_quoted ()
623
{
624
$debug_cmd
625
626
func_quote_arg pretty "$2"
627
eval "$1+=\\ \$func_quote_arg_result"
628
}'
629
else
630
func_append_quoted ()
631
{
632
$debug_cmd
633
634
func_quote_arg pretty "$2"
635
eval "$1=\$$1\\ \$func_quote_arg_result"
636
}
637
fi
638
639
640
# func_append_uniq VAR VALUE
641
# --------------------------
642
# Append unique VALUE onto the existing contents of VAR, assuming
643
# entries are delimited by the first character of VALUE. For example:
644
#
645
# func_append_uniq options " --another-option option-argument"
646
#
647
# will only append to $options if " --another-option option-argument "
648
# is not already present somewhere in $options already (note spaces at
649
# each end implied by leading space in second argument).
650
func_append_uniq ()
651
{
652
$debug_cmd
653
654
eval _G_current_value='`$ECHO $'$1'`'
655
_G_delim=`expr "$2" : '\(.\)'`
656
657
case $_G_delim$_G_current_value$_G_delim in
658
*"$2$_G_delim"*) ;;
659
*) func_append "$@" ;;
660
esac
661
}
662
663
664
# func_arith TERM...
665
# ------------------
666
# Set func_arith_result to the result of evaluating TERMs.
667
test -z "$_G_HAVE_ARITH_OP" \
668
&& (eval 'test 2 = $(( 1 + 1 ))') 2>/dev/null \
669
&& _G_HAVE_ARITH_OP=yes
670
671
if test yes = "$_G_HAVE_ARITH_OP"; then
672
eval 'func_arith ()
673
{
674
$debug_cmd
675
676
func_arith_result=$(( $* ))
677
}'
678
else
679
func_arith ()
680
{
681
$debug_cmd
682
683
func_arith_result=`expr "$@"`
684
}
685
fi
686
687
688
# func_basename FILE
689
# ------------------
690
# Set func_basename_result to FILE with everything up to and including
691
# the last / stripped.
692
if test yes = "$_G_HAVE_XSI_OPS"; then
693
# If this shell supports suffix pattern removal, then use it to avoid
694
# forking. Hide the definitions single quotes in case the shell chokes
695
# on unsupported syntax...
696
_b='func_basename_result=${1##*/}'
697
_d='case $1 in
698
*/*) func_dirname_result=${1%/*}$2 ;;
699
* ) func_dirname_result=$3 ;;
700
esac'
701
702
else
703
# ...otherwise fall back to using sed.
704
_b='func_basename_result=`$ECHO "$1" |$SED "$sed_basename"`'
705
_d='func_dirname_result=`$ECHO "$1" |$SED "$sed_dirname"`
706
if test "X$func_dirname_result" = "X$1"; then
707
func_dirname_result=$3
708
else
709
func_append func_dirname_result "$2"
710
fi'
711
fi
712
713
eval 'func_basename ()
714
{
715
$debug_cmd
716
717
'"$_b"'
718
}'
719
720
721
# func_dirname FILE APPEND NONDIR_REPLACEMENT
722
# -------------------------------------------
723
# Compute the dirname of FILE. If nonempty, add APPEND to the result,
724
# otherwise set result to NONDIR_REPLACEMENT.
725
eval 'func_dirname ()
726
{
727
$debug_cmd
728
729
'"$_d"'
730
}'
731
732
733
# func_dirname_and_basename FILE APPEND NONDIR_REPLACEMENT
734
# --------------------------------------------------------
735
# Perform func_basename and func_dirname in a single function
736
# call:
737
# dirname: Compute the dirname of FILE. If nonempty,
738
# add APPEND to the result, otherwise set result
739
# to NONDIR_REPLACEMENT.
740
# value returned in "$func_dirname_result"
741
# basename: Compute filename of FILE.
742
# value returned in "$func_basename_result"
743
# For efficiency, we do not delegate to the functions above but instead
744
# duplicate the functionality here.
745
eval 'func_dirname_and_basename ()
746
{
747
$debug_cmd
748
749
'"$_b"'
750
'"$_d"'
751
}'
752
753
754
# func_echo ARG...
755
# ----------------
756
# Echo program name prefixed message.
757
func_echo ()
758
{
759
$debug_cmd
760
761
_G_message=$*
762
763
func_echo_IFS=$IFS
764
IFS=$nl
765
for _G_line in $_G_message; do
766
IFS=$func_echo_IFS
767
$ECHO "$progname: $_G_line"
768
done
769
IFS=$func_echo_IFS
770
}
771
772
773
# func_echo_all ARG...
774
# --------------------
775
# Invoke $ECHO with all args, space-separated.
776
func_echo_all ()
777
{
778
$ECHO "$*"
779
}
780
781
782
# func_echo_infix_1 INFIX ARG...
783
# ------------------------------
784
# Echo program name, followed by INFIX on the first line, with any
785
# additional lines not showing INFIX.
786
func_echo_infix_1 ()
787
{
788
$debug_cmd
789
790
$require_term_colors
791
792
_G_infix=$1; shift
793
_G_indent=$_G_infix
794
_G_prefix="$progname: $_G_infix: "
795
_G_message=$*
796
797
# Strip color escape sequences before counting printable length
798
for _G_tc in "$tc_reset" "$tc_bold" "$tc_standout" "$tc_red" "$tc_green" "$tc_blue" "$tc_cyan"
799
do
800
test -n "$_G_tc" && {
801
_G_esc_tc=`$ECHO "$_G_tc" | $SED "$sed_make_literal_regex"`
802
_G_indent=`$ECHO "$_G_indent" | $SED "s|$_G_esc_tc||g"`
803
}
804
done
805
_G_indent="$progname: "`echo "$_G_indent" | $SED 's|.| |g'`" " ## exclude from sc_prohibit_nested_quotes
806
807
func_echo_infix_1_IFS=$IFS
808
IFS=$nl
809
for _G_line in $_G_message; do
810
IFS=$func_echo_infix_1_IFS
811
$ECHO "$_G_prefix$tc_bold$_G_line$tc_reset" >&2
812
_G_prefix=$_G_indent
813
done
814
IFS=$func_echo_infix_1_IFS
815
}
816
817
818
# func_error ARG...
819
# -----------------
820
# Echo program name prefixed message to standard error.
821
func_error ()
822
{
823
$debug_cmd
824
825
$require_term_colors
826
827
func_echo_infix_1 " $tc_standout${tc_red}error$tc_reset" "$*" >&2
828
}
829
830
831
# func_fatal_error ARG...
832
# -----------------------
833
# Echo program name prefixed message to standard error, and exit.
834
func_fatal_error ()
835
{
836
$debug_cmd
837
838
func_error "$*"
839
exit $EXIT_FAILURE
840
}
841
842
843
# func_grep EXPRESSION FILENAME
844
# -----------------------------
845
# Check whether EXPRESSION matches any line of FILENAME, without output.
846
func_grep ()
847
{
848
$debug_cmd
849
850
$GREP "$1" "$2" >/dev/null 2>&1
851
}
852
853
854
# func_len STRING
855
# ---------------
856
# Set func_len_result to the length of STRING. STRING may not
857
# start with a hyphen.
858
test -z "$_G_HAVE_XSI_OPS" \
859
&& (eval 'x=a/b/c;
860
test 5aa/bb/cc = "${#x}${x%%/*}${x%/*}${x#*/}${x##*/}"') 2>/dev/null \
861
&& _G_HAVE_XSI_OPS=yes
862
863
if test yes = "$_G_HAVE_XSI_OPS"; then
864
eval 'func_len ()
865
{
866
$debug_cmd
867
868
func_len_result=${#1}
869
}'
870
else
871
func_len ()
872
{
873
$debug_cmd
874
875
func_len_result=`expr "$1" : ".*" 2>/dev/null || echo $max_cmd_len`
876
}
877
fi
878
879
880
# func_mkdir_p DIRECTORY-PATH
881
# ---------------------------
882
# Make sure the entire path to DIRECTORY-PATH is available.
883
func_mkdir_p ()
884
{
885
$debug_cmd
886
887
_G_directory_path=$1
888
_G_dir_list=
889
890
if test -n "$_G_directory_path" && test : != "$opt_dry_run"; then
891
892
# Protect directory names starting with '-'
893
case $_G_directory_path in
894
-*) _G_directory_path=./$_G_directory_path ;;
895
esac
896
897
# While some portion of DIR does not yet exist...
898
while test ! -d "$_G_directory_path"; do
899
# ...make a list in topmost first order. Use a colon delimited
900
# list in case some portion of path contains whitespace.
901
_G_dir_list=$_G_directory_path:$_G_dir_list
902
903
# If the last portion added has no slash in it, the list is done
904
case $_G_directory_path in */*) ;; *) break ;; esac
905
906
# ...otherwise throw away the child directory and loop
907
_G_directory_path=`$ECHO "$_G_directory_path" | $SED -e "$sed_dirname"`
908
done
909
_G_dir_list=`$ECHO "$_G_dir_list" | $SED 's|:*$||'`
910
911
func_mkdir_p_IFS=$IFS; IFS=:
912
for _G_dir in $_G_dir_list; do
913
IFS=$func_mkdir_p_IFS
914
# mkdir can fail with a 'File exist' error if two processes
915
# try to create one of the directories concurrently. Don't
916
# stop in that case!
917
$MKDIR "$_G_dir" 2>/dev/null || :
918
done
919
IFS=$func_mkdir_p_IFS
920
921
# Bail out if we (or some other process) failed to create a directory.
922
test -d "$_G_directory_path" || \
923
func_fatal_error "Failed to create '$1'"
924
fi
925
}
926
927
928
# func_mktempdir [BASENAME]
929
# -------------------------
930
# Make a temporary directory that won't clash with other running
931
# libtool processes, and avoids race conditions if possible. If
932
# given, BASENAME is the basename for that directory.
933
func_mktempdir ()
934
{
935
$debug_cmd
936
937
_G_template=${TMPDIR-/tmp}/${1-$progname}
938
939
if test : = "$opt_dry_run"; then
940
# Return a directory name, but don't create it in dry-run mode
941
_G_tmpdir=$_G_template-$$
942
else
943
944
# If mktemp works, use that first and foremost
945
_G_tmpdir=`mktemp -d "$_G_template-XXXXXXXX" 2>/dev/null`
946
947
if test ! -d "$_G_tmpdir"; then
948
# Failing that, at least try and use $RANDOM to avoid a race
949
_G_tmpdir=$_G_template-${RANDOM-0}$$
950
951
func_mktempdir_umask=`umask`
952
umask 0077
953
$MKDIR "$_G_tmpdir"
954
umask $func_mktempdir_umask
955
fi
956
957
# If we're not in dry-run mode, bomb out on failure
958
test -d "$_G_tmpdir" || \
959
func_fatal_error "cannot create temporary directory '$_G_tmpdir'"
960
fi
961
962
$ECHO "$_G_tmpdir"
963
}
964
965
966
# func_normal_abspath PATH
967
# ------------------------
968
# Remove doubled-up and trailing slashes, "." path components,
969
# and cancel out any ".." path components in PATH after making
970
# it an absolute path.
971
func_normal_abspath ()
972
{
973
$debug_cmd
974
975
# These SED scripts presuppose an absolute path with a trailing slash.
976
_G_pathcar='s|^/\([^/]*\).*$|\1|'
977
_G_pathcdr='s|^/[^/]*||'
978
_G_removedotparts=':dotsl
979
s|/\./|/|g
980
t dotsl
981
s|/\.$|/|'
982
_G_collapseslashes='s|/\{1,\}|/|g'
983
_G_finalslash='s|/*$|/|'
984
985
# Start from root dir and reassemble the path.
986
func_normal_abspath_result=
987
func_normal_abspath_tpath=$1
988
func_normal_abspath_altnamespace=
989
case $func_normal_abspath_tpath in
990
"")
991
# Empty path, that just means $cwd.
992
func_stripname '' '/' "`pwd`"
993
func_normal_abspath_result=$func_stripname_result
994
return
995
;;
996
# The next three entries are used to spot a run of precisely
997
# two leading slashes without using negated character classes;
998
# we take advantage of case's first-match behaviour.
999
///*)
1000
# Unusual form of absolute path, do nothing.
1001
;;
1002
//*)
1003
# Not necessarily an ordinary path; POSIX reserves leading '//'
1004
# and for example Cygwin uses it to access remote file shares
1005
# over CIFS/SMB, so we conserve a leading double slash if found.
1006
func_normal_abspath_altnamespace=/
1007
;;
1008
/*)
1009
# Absolute path, do nothing.
1010
;;
1011
*)
1012
# Relative path, prepend $cwd.
1013
func_normal_abspath_tpath=`pwd`/$func_normal_abspath_tpath
1014
;;
1015
esac
1016
1017
# Cancel out all the simple stuff to save iterations. We also want
1018
# the path to end with a slash for ease of parsing, so make sure
1019
# there is one (and only one) here.
1020
func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \
1021
-e "$_G_removedotparts" -e "$_G_collapseslashes" -e "$_G_finalslash"`
1022
while :; do
1023
# Processed it all yet?
1024
if test / = "$func_normal_abspath_tpath"; then
1025
# If we ascended to the root using ".." the result may be empty now.
1026
if test -z "$func_normal_abspath_result"; then
1027
func_normal_abspath_result=/
1028
fi
1029
break
1030
fi
1031
func_normal_abspath_tcomponent=`$ECHO "$func_normal_abspath_tpath" | $SED \
1032
-e "$_G_pathcar"`
1033
func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \
1034
-e "$_G_pathcdr"`
1035
# Figure out what to do with it
1036
case $func_normal_abspath_tcomponent in
1037
"")
1038
# Trailing empty path component, ignore it.
1039
;;
1040
..)
1041
# Parent dir; strip last assembled component from result.
1042
func_dirname "$func_normal_abspath_result"
1043
func_normal_abspath_result=$func_dirname_result
1044
;;
1045
*)
1046
# Actual path component, append it.
1047
func_append func_normal_abspath_result "/$func_normal_abspath_tcomponent"
1048
;;
1049
esac
1050
done
1051
# Restore leading double-slash if one was found on entry.
1052
func_normal_abspath_result=$func_normal_abspath_altnamespace$func_normal_abspath_result
1053
}
1054
1055
1056
# func_notquiet ARG...
1057
# --------------------
1058
# Echo program name prefixed message only when not in quiet mode.
1059
func_notquiet ()
1060
{
1061
$debug_cmd
1062
1063
$opt_quiet || func_echo ${1+"$@"}
1064
1065
# A bug in bash halts the script if the last line of a function
1066
# fails when set -e is in force, so we need another command to
1067
# work around that:
1068
:
1069
}
1070
1071
1072
# func_relative_path SRCDIR DSTDIR
1073
# --------------------------------
1074
# Set func_relative_path_result to the relative path from SRCDIR to DSTDIR.
1075
func_relative_path ()
1076
{
1077
$debug_cmd
1078
1079
func_relative_path_result=
1080
func_normal_abspath "$1"
1081
func_relative_path_tlibdir=$func_normal_abspath_result
1082
func_normal_abspath "$2"
1083
func_relative_path_tbindir=$func_normal_abspath_result
1084
1085
# Ascend the tree starting from libdir
1086
while :; do
1087
# check if we have found a prefix of bindir
1088
case $func_relative_path_tbindir in
1089
$func_relative_path_tlibdir)
1090
# found an exact match
1091
func_relative_path_tcancelled=
1092
break
1093
;;
1094
$func_relative_path_tlibdir*)
1095
# found a matching prefix
1096
func_stripname "$func_relative_path_tlibdir" '' "$func_relative_path_tbindir"
1097
func_relative_path_tcancelled=$func_stripname_result
1098
if test -z "$func_relative_path_result"; then
1099
func_relative_path_result=.
1100
fi
1101
break
1102
;;
1103
*)
1104
func_dirname $func_relative_path_tlibdir
1105
func_relative_path_tlibdir=$func_dirname_result
1106
if test -z "$func_relative_path_tlibdir"; then
1107
# Have to descend all the way to the root!
1108
func_relative_path_result=../$func_relative_path_result
1109
func_relative_path_tcancelled=$func_relative_path_tbindir
1110
break
1111
fi
1112
func_relative_path_result=../$func_relative_path_result
1113
;;
1114
esac
1115
done
1116
1117
# Now calculate path; take care to avoid doubling-up slashes.
1118
func_stripname '' '/' "$func_relative_path_result"
1119
func_relative_path_result=$func_stripname_result
1120
func_stripname '/' '/' "$func_relative_path_tcancelled"
1121
if test -n "$func_stripname_result"; then
1122
func_append func_relative_path_result "/$func_stripname_result"
1123
fi
1124
1125
# Normalisation. If bindir is libdir, return '.' else relative path.
1126
if test -n "$func_relative_path_result"; then
1127
func_stripname './' '' "$func_relative_path_result"
1128
func_relative_path_result=$func_stripname_result
1129
fi
1130
1131
test -n "$func_relative_path_result" || func_relative_path_result=.
1132
1133
:
1134
}
1135
1136
1137
# func_quote_portable EVAL ARG
1138
# ----------------------------
1139
# Internal function to portably implement func_quote_arg. Note that we still
1140
# keep attention to performance here so we as much as possible try to avoid
1141
# calling sed binary (so far O(N) complexity as long as func_append is O(1)).
1142
func_quote_portable ()
1143
{
1144
$debug_cmd
1145
1146
$require_check_ifs_backslash
1147
1148
func_quote_portable_result=$2
1149
1150
# one-time-loop (easy break)
1151
while true
1152
do
1153
if $1; then
1154
func_quote_portable_result=`$ECHO "$2" | $SED \
1155
-e "$sed_double_quote_subst" -e "$sed_double_backslash"`
1156
break
1157
fi
1158
1159
# Quote for eval.
1160
case $func_quote_portable_result in
1161
*[\\\`\"\$]*)
1162
# Fallback to sed for $func_check_bs_ifs_broken=:, or when the string
1163
# contains the shell wildcard characters.
1164
case $check_ifs_backshlash_broken$func_quote_portable_result in
1165
:*|*[\[\*\?]*)
1166
func_quote_portable_result=`$ECHO "$func_quote_portable_result" \
1167
| $SED "$sed_quote_subst"`
1168
break
1169
;;
1170
esac
1171
1172
func_quote_portable_old_IFS=$IFS
1173
for _G_char in '\' '`' '"' '$'
1174
do
1175
# STATE($1) PREV($2) SEPARATOR($3)
1176
set start "" ""
1177
func_quote_portable_result=dummy"$_G_char$func_quote_portable_result$_G_char"dummy
1178
IFS=$_G_char
1179
for _G_part in $func_quote_portable_result
1180
do
1181
case $1 in
1182
quote)
1183
func_append func_quote_portable_result "$3$2"
1184
set quote "$_G_part" "\\$_G_char"
1185
;;
1186
start)
1187
set first "" ""
1188
func_quote_portable_result=
1189
;;
1190
first)
1191
set quote "$_G_part" ""
1192
;;
1193
esac
1194
done
1195
done
1196
IFS=$func_quote_portable_old_IFS
1197
;;
1198
*) ;;
1199
esac
1200
break
1201
done
1202
1203
func_quote_portable_unquoted_result=$func_quote_portable_result
1204
case $func_quote_portable_result in
1205
# double-quote args containing shell metacharacters to delay
1206
# word splitting, command substitution and variable expansion
1207
# for a subsequent eval.
1208
# many bourne shells cannot handle close brackets correctly
1209
# in scan sets, so we specify it separately.
1210
*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1211
func_quote_portable_result=\"$func_quote_portable_result\"
1212
;;
1213
esac
1214
}
1215
1216
1217
# func_quotefast_eval ARG
1218
# -----------------------
1219
# Quote one ARG (internal). This is equivalent to 'func_quote_arg eval ARG',
1220
# but optimized for speed. Result is stored in $func_quotefast_eval.
1221
if test xyes = `(x=; printf -v x %q yes; echo x"$x") 2>/dev/null`; then
1222
printf -v _GL_test_printf_tilde %q '~'
1223
if test '\~' = "$_GL_test_printf_tilde"; then
1224
func_quotefast_eval ()
1225
{
1226
printf -v func_quotefast_eval_result %q "$1"
1227
}
1228
else
1229
# Broken older Bash implementations. Make those faster too if possible.
1230
func_quotefast_eval ()
1231
{
1232
case $1 in
1233
'~'*)
1234
func_quote_portable false "$1"
1235
func_quotefast_eval_result=$func_quote_portable_result
1236
;;
1237
*)
1238
printf -v func_quotefast_eval_result %q "$1"
1239
;;
1240
esac
1241
}
1242
fi
1243
else
1244
func_quotefast_eval ()
1245
{
1246
func_quote_portable false "$1"
1247
func_quotefast_eval_result=$func_quote_portable_result
1248
}
1249
fi
1250
1251
1252
# func_quote_arg MODEs ARG
1253
# ------------------------
1254
# Quote one ARG to be evaled later. MODEs argument may contain zero or more
1255
# specifiers listed below separated by ',' character. This function returns two
1256
# values:
1257
# i) func_quote_arg_result
1258
# double-quoted (when needed), suitable for a subsequent eval
1259
# ii) func_quote_arg_unquoted_result
1260
# has all characters that are still active within double
1261
# quotes backslashified. Available only if 'unquoted' is specified.
1262
#
1263
# Available modes:
1264
# ----------------
1265
# 'eval' (default)
1266
# - escape shell special characters
1267
# 'expand'
1268
# - the same as 'eval'; but do not quote variable references
1269
# 'pretty'
1270
# - request aesthetic output, i.e. '"a b"' instead of 'a\ b'. This might
1271
# be used later in func_quote to get output like: 'echo "a b"' instead
1272
# of 'echo a\ b'. This is slower than default on some shells.
1273
# 'unquoted'
1274
# - produce also $func_quote_arg_unquoted_result which does not contain
1275
# wrapping double-quotes.
1276
#
1277
# Examples for 'func_quote_arg pretty,unquoted string':
1278
#
1279
# string | *_result | *_unquoted_result
1280
# ------------+-----------------------+-------------------
1281
# " | \" | \"
1282
# a b | "a b" | a b
1283
# "a b" | "\"a b\"" | \"a b\"
1284
# * | "*" | *
1285
# z="${x-$y}" | "z=\"\${x-\$y}\"" | z=\"\${x-\$y}\"
1286
#
1287
# Examples for 'func_quote_arg pretty,unquoted,expand string':
1288
#
1289
# string | *_result | *_unquoted_result
1290
# --------------+---------------------+--------------------
1291
# z="${x-$y}" | "z=\"${x-$y}\"" | z=\"${x-$y}\"
1292
func_quote_arg ()
1293
{
1294
_G_quote_expand=false
1295
case ,$1, in
1296
*,expand,*)
1297
_G_quote_expand=:
1298
;;
1299
esac
1300
1301
case ,$1, in
1302
*,pretty,*|*,expand,*|*,unquoted,*)
1303
func_quote_portable $_G_quote_expand "$2"
1304
func_quote_arg_result=$func_quote_portable_result
1305
func_quote_arg_unquoted_result=$func_quote_portable_unquoted_result
1306
;;
1307
*)
1308
# Faster quote-for-eval for some shells.
1309
func_quotefast_eval "$2"
1310
func_quote_arg_result=$func_quotefast_eval_result
1311
;;
1312
esac
1313
}
1314
1315
1316
# func_quote MODEs ARGs...
1317
# ------------------------
1318
# Quote all ARGs to be evaled later and join them into single command. See
1319
# func_quote_arg's description for more info.
1320
func_quote ()
1321
{
1322
$debug_cmd
1323
_G_func_quote_mode=$1 ; shift
1324
func_quote_result=
1325
while test 0 -lt $#; do
1326
func_quote_arg "$_G_func_quote_mode" "$1"
1327
if test -n "$func_quote_result"; then
1328
func_append func_quote_result " $func_quote_arg_result"
1329
else
1330
func_append func_quote_result "$func_quote_arg_result"
1331
fi
1332
shift
1333
done
1334
}
1335
1336
1337
# func_stripname PREFIX SUFFIX NAME
1338
# ---------------------------------
1339
# strip PREFIX and SUFFIX from NAME, and store in func_stripname_result.
1340
# PREFIX and SUFFIX must not contain globbing or regex special
1341
# characters, hashes, percent signs, but SUFFIX may contain a leading
1342
# dot (in which case that matches only a dot).
1343
if test yes = "$_G_HAVE_XSI_OPS"; then
1344
eval 'func_stripname ()
1345
{
1346
$debug_cmd
1347
1348
# pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are
1349
# positional parameters, so assign one to ordinary variable first.
1350
func_stripname_result=$3
1351
func_stripname_result=${func_stripname_result#"$1"}
1352
func_stripname_result=${func_stripname_result%"$2"}
1353
}'
1354
else
1355
func_stripname ()
1356
{
1357
$debug_cmd
1358
1359
case $2 in
1360
.*) func_stripname_result=`$ECHO "$3" | $SED -e "s%^$1%%" -e "s%\\\\$2\$%%"`;;
1361
*) func_stripname_result=`$ECHO "$3" | $SED -e "s%^$1%%" -e "s%$2\$%%"`;;
1362
esac
1363
}
1364
fi
1365
1366
1367
# func_show_eval CMD [FAIL_EXP]
1368
# -----------------------------
1369
# Unless opt_quiet is true, then output CMD. Then, if opt_dryrun is
1370
# not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP
1371
# is given, then evaluate it.
1372
func_show_eval ()
1373
{
1374
$debug_cmd
1375
1376
_G_cmd=$1
1377
_G_fail_exp=${2-':'}
1378
1379
func_quote_arg pretty,expand "$_G_cmd"
1380
eval "func_notquiet $func_quote_arg_result"
1381
1382
$opt_dry_run || {
1383
eval "$_G_cmd"
1384
_G_status=$?
1385
if test 0 -ne "$_G_status"; then
1386
eval "(exit $_G_status); $_G_fail_exp"
1387
fi
1388
}
1389
}
1390
1391
1392
# func_show_eval_locale CMD [FAIL_EXP]
1393
# ------------------------------------
1394
# Unless opt_quiet is true, then output CMD. Then, if opt_dryrun is
1395
# not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP
1396
# is given, then evaluate it. Use the saved locale for evaluation.
1397
func_show_eval_locale ()
1398
{
1399
$debug_cmd
1400
1401
_G_cmd=$1
1402
_G_fail_exp=${2-':'}
1403
1404
$opt_quiet || {
1405
func_quote_arg expand,pretty "$_G_cmd"
1406
eval "func_echo $func_quote_arg_result"
1407
}
1408
1409
$opt_dry_run || {
1410
eval "$_G_user_locale
1411
$_G_cmd"
1412
_G_status=$?
1413
eval "$_G_safe_locale"
1414
if test 0 -ne "$_G_status"; then
1415
eval "(exit $_G_status); $_G_fail_exp"
1416
fi
1417
}
1418
}
1419
1420
1421
# func_tr_sh
1422
# ----------
1423
# Turn $1 into a string suitable for a shell variable name.
1424
# Result is stored in $func_tr_sh_result. All characters
1425
# not in the set a-zA-Z0-9_ are replaced with '_'. Further,
1426
# if $1 begins with a digit, a '_' is prepended as well.
1427
func_tr_sh ()
1428
{
1429
$debug_cmd
1430
1431
case $1 in
1432
[0-9]* | *[!a-zA-Z0-9_]*)
1433
func_tr_sh_result=`$ECHO "$1" | $SED -e 's/^\([0-9]\)/_\1/' -e 's/[^a-zA-Z0-9_]/_/g'`
1434
;;
1435
* )
1436
func_tr_sh_result=$1
1437
;;
1438
esac
1439
}
1440
1441
1442
# func_verbose ARG...
1443
# -------------------
1444
# Echo program name prefixed message in verbose mode only.
1445
func_verbose ()
1446
{
1447
$debug_cmd
1448
1449
$opt_verbose && func_echo "$*"
1450
1451
:
1452
}
1453
1454
1455
# func_warn_and_continue ARG...
1456
# -----------------------------
1457
# Echo program name prefixed warning message to standard error.
1458
func_warn_and_continue ()
1459
{
1460
$debug_cmd
1461
1462
$require_term_colors
1463
1464
func_echo_infix_1 "${tc_red}warning$tc_reset" "$*" >&2
1465
}
1466
1467
1468
# func_warning CATEGORY ARG...
1469
# ----------------------------
1470
# Echo program name prefixed warning message to standard error. Warning
1471
# messages can be filtered according to CATEGORY, where this function
1472
# elides messages where CATEGORY is not listed in the global variable
1473
# 'opt_warning_types'.
1474
func_warning ()
1475
{
1476
$debug_cmd
1477
1478
# CATEGORY must be in the warning_categories list!
1479
case " $warning_categories " in
1480
*" $1 "*) ;;
1481
*) func_internal_error "invalid warning category '$1'" ;;
1482
esac
1483
1484
_G_category=$1
1485
shift
1486
1487
case " $opt_warning_types " in
1488
*" $_G_category "*) $warning_func ${1+"$@"} ;;
1489
esac
1490
}
1491
1492
1493
# func_sort_ver VER1 VER2
1494
# -----------------------
1495
# 'sort -V' is not generally available.
1496
# Note this deviates from the version comparison in automake
1497
# in that it treats 1.5 < 1.5.0, and treats 1.4.4a < 1.4-p3a
1498
# but this should suffice as we won't be specifying old
1499
# version formats or redundant trailing .0 in bootstrap.conf.
1500
# If we did want full compatibility then we should probably
1501
# use m4_version_compare from autoconf.
1502
func_sort_ver ()
1503
{
1504
$debug_cmd
1505
1506
printf '%s\n%s\n' "$1" "$2" \
1507
| sort -t. -k 1,1n -k 2,2n -k 3,3n -k 4,4n -k 5,5n -k 6,6n -k 7,7n -k 8,8n -k 9,9n
1508
}
1509
1510
# func_lt_ver PREV CURR
1511
# ---------------------
1512
# Return true if PREV and CURR are in the correct order according to
1513
# func_sort_ver, otherwise false. Use it like this:
1514
#
1515
# func_lt_ver "$prev_ver" "$proposed_ver" || func_fatal_error "..."
1516
func_lt_ver ()
1517
{
1518
$debug_cmd
1519
1520
test "x$1" = x`func_sort_ver "$1" "$2" | $SED 1q`
1521
}
1522
1523
1524
# Local variables:
1525
# mode: shell-script
1526
# sh-indentation: 2
1527
# eval: (add-hook 'before-save-hook 'time-stamp)
1528
# time-stamp-pattern: "10/scriptversion=%:y-%02m-%02d.%02H; # UTC"
1529
# time-stamp-time-zone: "UTC"
1530
# End:
1531
#! /bin/sh
1532
1533
# A portable, pluggable option parser for Bourne shell.
1534
# Written by Gary V. Vaughan, 2010
1535
1536
# This is free software. There is NO warranty; not even for
1537
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
1538
#
1539
# Copyright (C) 2010-2019, 2021, 2023-2024 Bootstrap Authors
1540
#
1541
# This file is dual licensed under the terms of the MIT license
1542
# <https://opensource.org/licenses/MIT>, and GPL version 2 or later
1543
# <https://www.gnu.org/licenses/gpl-2.0.html>. You must apply one of
1544
# these licenses when using or redistributing this software or any of
1545
# the files within it. See the URLs above, or the file `LICENSE`
1546
# included in the Bootstrap distribution for the full license texts.
1547
1548
# Please report bugs or propose patches to:
1549
# <https://github.com/gnulib-modules/bootstrap/issues>
1550
1551
# Set a version string for this script.
1552
scriptversion=2019-02-19.15; # UTC
1553
1554
1555
## ------ ##
1556
## Usage. ##
1557
## ------ ##
1558
1559
# This file is a library for parsing options in your shell scripts along
1560
# with assorted other useful supporting features that you can make use
1561
# of too.
1562
#
1563
# For the simplest scripts you might need only:
1564
#
1565
# #!/bin/sh
1566
# . relative/path/to/funclib.sh
1567
# . relative/path/to/options-parser
1568
# scriptversion=1.0
1569
# func_options ${1+"$@"}
1570
# eval set dummy "$func_options_result"; shift
1571
# ...rest of your script...
1572
#
1573
# In order for the '--version' option to work, you will need to have a
1574
# suitably formatted comment like the one at the top of this file
1575
# starting with '# Written by ' and ending with '# Copyright'.
1576
#
1577
# For '-h' and '--help' to work, you will also need a one line
1578
# description of your script's purpose in a comment directly above the
1579
# '# Written by ' line, like the one at the top of this file.
1580
#
1581
# The default options also support '--debug', which will turn on shell
1582
# execution tracing (see the comment above debug_cmd below for another
1583
# use), and '--verbose' and the func_verbose function to allow your script
1584
# to display verbose messages only when your user has specified
1585
# '--verbose'.
1586
#
1587
# After sourcing this file, you can plug in processing for additional
1588
# options by amending the variables from the 'Configuration' section
1589
# below, and following the instructions in the 'Option parsing'
1590
# section further down.
1591
1592
## -------------- ##
1593
## Configuration. ##
1594
## -------------- ##
1595
1596
# You should override these variables in your script after sourcing this
1597
# file so that they reflect the customisations you have added to the
1598
# option parser.
1599
1600
# The usage line for option parsing errors and the start of '-h' and
1601
# '--help' output messages. You can embed shell variables for delayed
1602
# expansion at the time the message is displayed, but you will need to
1603
# quote other shell meta-characters carefully to prevent them being
1604
# expanded when the contents are evaled.
1605
usage='$progpath [OPTION]...'
1606
1607
# Short help message in response to '-h' and '--help'. Add to this or
1608
# override it after sourcing this library to reflect the full set of
1609
# options your script accepts.
1610
usage_message="\
1611
--debug enable verbose shell tracing
1612
-W, --warnings=CATEGORY
1613
report the warnings falling in CATEGORY [all]
1614
-v, --verbose verbosely report processing
1615
--version print version information and exit
1616
-h, --help print short or long help message and exit
1617
"
1618
1619
# Additional text appended to 'usage_message' in response to '--help'.
1620
long_help_message="
1621
Warning categories include:
1622
'all' show all warnings
1623
'none' turn off all the warnings
1624
'error' warnings are treated as fatal errors"
1625
1626
# Help message printed before fatal option parsing errors.
1627
fatal_help="Try '\$progname --help' for more information."
1628
1629
1630
1631
## ------------------------- ##
1632
## Hook function management. ##
1633
## ------------------------- ##
1634
1635
# This section contains functions for adding, removing, and running hooks
1636
# in the main code. A hook is just a list of function names that can be
1637
# run in order later on.
1638
1639
# func_hookable FUNC_NAME
1640
# -----------------------
1641
# Declare that FUNC_NAME will run hooks added with
1642
# 'func_add_hook FUNC_NAME ...'.
1643
func_hookable ()
1644
{
1645
$debug_cmd
1646
1647
func_append hookable_fns " $1"
1648
}
1649
1650
1651
# func_add_hook FUNC_NAME HOOK_FUNC
1652
# ---------------------------------
1653
# Request that FUNC_NAME call HOOK_FUNC before it returns. FUNC_NAME must
1654
# first have been declared "hookable" by a call to 'func_hookable'.
1655
func_add_hook ()
1656
{
1657
$debug_cmd
1658
1659
case " $hookable_fns " in
1660
*" $1 "*) ;;
1661
*) func_fatal_error "'$1' does not accept hook functions." ;;
1662
esac
1663
1664
eval func_append ${1}_hooks '" $2"'
1665
}
1666
1667
1668
# func_remove_hook FUNC_NAME HOOK_FUNC
1669
# ------------------------------------
1670
# Remove HOOK_FUNC from the list of hook functions to be called by
1671
# FUNC_NAME.
1672
func_remove_hook ()
1673
{
1674
$debug_cmd
1675
1676
eval ${1}_hooks='`$ECHO "\$'$1'_hooks" |$SED "s| '$2'||"`'
1677
}
1678
1679
1680
# func_propagate_result FUNC_NAME_A FUNC_NAME_B
1681
# ---------------------------------------------
1682
# If the *_result variable of FUNC_NAME_A _is set_, assign its value to
1683
# *_result variable of FUNC_NAME_B.
1684
func_propagate_result ()
1685
{
1686
$debug_cmd
1687
1688
func_propagate_result_result=:
1689
if eval "test \"\${${1}_result+set}\" = set"
1690
then
1691
eval "${2}_result=\$${1}_result"
1692
else
1693
func_propagate_result_result=false
1694
fi
1695
}
1696
1697
1698
# func_run_hooks FUNC_NAME [ARG]...
1699
# ---------------------------------
1700
# Run all hook functions registered to FUNC_NAME.
1701
# It's assumed that the list of hook functions contains nothing more
1702
# than a whitespace-delimited list of legal shell function names, and
1703
# no effort is wasted trying to catch shell meta-characters or preserve
1704
# whitespace.
1705
func_run_hooks ()
1706
{
1707
$debug_cmd
1708
1709
case " $hookable_fns " in
1710
*" $1 "*) ;;
1711
*) func_fatal_error "'$1' does not support hook functions." ;;
1712
esac
1713
1714
eval _G_hook_fns=\$$1_hooks; shift
1715
1716
for _G_hook in $_G_hook_fns; do
1717
func_unset "${_G_hook}_result"
1718
eval $_G_hook '${1+"$@"}'
1719
func_propagate_result $_G_hook func_run_hooks
1720
if $func_propagate_result_result; then
1721
eval set dummy "$func_run_hooks_result"; shift
1722
fi
1723
done
1724
}
1725
1726
1727
1728
## --------------- ##
1729
## Option parsing. ##
1730
## --------------- ##
1731
1732
# In order to add your own option parsing hooks, you must accept the
1733
# full positional parameter list from your hook function. You may remove
1734
# or edit any options that you action, and then pass back the remaining
1735
# unprocessed options in '<hooked_function_name>_result', escaped
1736
# suitably for 'eval'.
1737
#
1738
# The '<hooked_function_name>_result' variable is automatically unset
1739
# before your hook gets called; for best performance, only set the
1740
# *_result variable when necessary (i.e. don't call the 'func_quote'
1741
# function unnecessarily because it can be an expensive operation on some
1742
# machines).
1743
#
1744
# Like this:
1745
#
1746
# my_options_prep ()
1747
# {
1748
# $debug_cmd
1749
#
1750
# # Extend the existing usage message.
1751
# usage_message=$usage_message'
1752
# -s, --silent don'\''t print informational messages
1753
# '
1754
# # No change in '$@' (ignored completely by this hook). Leave
1755
# # my_options_prep_result variable intact.
1756
# }
1757
# func_add_hook func_options_prep my_options_prep
1758
#
1759
#
1760
# my_silent_option ()
1761
# {
1762
# $debug_cmd
1763
#
1764
# args_changed=false
1765
#
1766
# # Note that, for efficiency, we parse as many options as we can
1767
# # recognise in a loop before passing the remainder back to the
1768
# # caller on the first unrecognised argument we encounter.
1769
# while test $# -gt 0; do
1770
# opt=$1; shift
1771
# case $opt in
1772
# --silent|-s) opt_silent=:
1773
# args_changed=:
1774
# ;;
1775
# # Separate non-argument short options:
1776
# -s*) func_split_short_opt "$_G_opt"
1777
# set dummy "$func_split_short_opt_name" \
1778
# "-$func_split_short_opt_arg" ${1+"$@"}
1779
# shift
1780
# args_changed=:
1781
# ;;
1782
# *) # Make sure the first unrecognised option "$_G_opt"
1783
# # is added back to "$@" in case we need it later,
1784
# # if $args_changed was set to 'true'.
1785
# set dummy "$_G_opt" ${1+"$@"}; shift; break ;;
1786
# esac
1787
# done
1788
#
1789
# # Only call 'func_quote' here if we processed at least one argument.
1790
# if $args_changed; then
1791
# func_quote eval ${1+"$@"}
1792
# my_silent_option_result=$func_quote_result
1793
# fi
1794
# }
1795
# func_add_hook func_parse_options my_silent_option
1796
#
1797
#
1798
# my_option_validation ()
1799
# {
1800
# $debug_cmd
1801
#
1802
# $opt_silent && $opt_verbose && func_fatal_help "\
1803
# '--silent' and '--verbose' options are mutually exclusive."
1804
# }
1805
# func_add_hook func_validate_options my_option_validation
1806
#
1807
# You'll also need to manually amend $usage_message to reflect the extra
1808
# options you parse. It's preferable to append if you can, so that
1809
# multiple option parsing hooks can be added safely.
1810
1811
1812
# func_options_finish [ARG]...
1813
# ----------------------------
1814
# Finishing the option parse loop (call 'func_options' hooks ATM).
1815
func_options_finish ()
1816
{
1817
$debug_cmd
1818
1819
func_run_hooks func_options ${1+"$@"}
1820
func_propagate_result func_run_hooks func_options_finish
1821
}
1822
1823
1824
# func_options [ARG]...
1825
# ---------------------
1826
# All the functions called inside func_options are hookable. See the
1827
# individual implementations for details.
1828
func_hookable func_options
1829
func_options ()
1830
{
1831
$debug_cmd
1832
1833
_G_options_quoted=false
1834
1835
for my_func in options_prep parse_options validate_options options_finish
1836
do
1837
func_unset func_${my_func}_result
1838
func_unset func_run_hooks_result
1839
eval func_$my_func '${1+"$@"}'
1840
func_propagate_result func_$my_func func_options
1841
if $func_propagate_result_result; then
1842
eval set dummy "$func_options_result"; shift
1843
_G_options_quoted=:
1844
fi
1845
done
1846
1847
$_G_options_quoted || {
1848
# As we (func_options) are top-level options-parser function and
1849
# nobody quoted "$@" for us yet, we need to do it explicitly for
1850
# caller.
1851
func_quote eval ${1+"$@"}
1852
func_options_result=$func_quote_result
1853
}
1854
}
1855
1856
1857
# func_options_prep [ARG]...
1858
# --------------------------
1859
# All initialisations required before starting the option parse loop.
1860
# Note that when calling hook functions, we pass through the list of
1861
# positional parameters. If a hook function modifies that list, and
1862
# needs to propagate that back to rest of this script, then the complete
1863
# modified list must be put in 'func_run_hooks_result' before returning.
1864
func_hookable func_options_prep
1865
func_options_prep ()
1866
{
1867
$debug_cmd
1868
1869
# Option defaults:
1870
opt_verbose=false
1871
opt_warning_types=
1872
1873
func_run_hooks func_options_prep ${1+"$@"}
1874
func_propagate_result func_run_hooks func_options_prep
1875
}
1876
1877
1878
# func_parse_options [ARG]...
1879
# ---------------------------
1880
# The main option parsing loop.
1881
func_hookable func_parse_options
1882
func_parse_options ()
1883
{
1884
$debug_cmd
1885
1886
_G_parse_options_requote=false
1887
# this just eases exit handling
1888
while test $# -gt 0; do
1889
# Defer to hook functions for initial option parsing, so they
1890
# get priority in the event of reusing an option name.
1891
func_run_hooks func_parse_options ${1+"$@"}
1892
func_propagate_result func_run_hooks func_parse_options
1893
if $func_propagate_result_result; then
1894
eval set dummy "$func_parse_options_result"; shift
1895
# Even though we may have changed "$@", we passed the "$@" array
1896
# down into the hook and it quoted it for us (because we are in
1897
# this if-branch). No need to quote it again.
1898
_G_parse_options_requote=false
1899
fi
1900
1901
# Break out of the loop if we already parsed every option.
1902
test $# -gt 0 || break
1903
1904
# We expect that one of the options parsed in this function matches
1905
# and thus we remove _G_opt from "$@" and need to re-quote.
1906
_G_match_parse_options=:
1907
_G_opt=$1
1908
shift
1909
case $_G_opt in
1910
--debug|-x) debug_cmd='set -x'
1911
func_echo "enabling shell trace mode" >&2
1912
$debug_cmd
1913
;;
1914
1915
--no-warnings|--no-warning|--no-warn)
1916
set dummy --warnings none ${1+"$@"}
1917
shift
1918
;;
1919
1920
--warnings|--warning|-W)
1921
if test $# = 0 && func_missing_arg $_G_opt; then
1922
_G_parse_options_requote=:
1923
break
1924
fi
1925
case " $warning_categories $1" in
1926
*" $1 "*)
1927
# trailing space prevents matching last $1 above
1928
func_append_uniq opt_warning_types " $1"
1929
;;
1930
*all)
1931
opt_warning_types=$warning_categories
1932
;;
1933
*none)
1934
opt_warning_types=none
1935
warning_func=:
1936
;;
1937
*error)
1938
opt_warning_types=$warning_categories
1939
warning_func=func_fatal_error
1940
;;
1941
*)
1942
func_fatal_error \
1943
"unsupported warning category: '$1'"
1944
;;
1945
esac
1946
shift
1947
;;
1948
1949
--verbose|-v) opt_verbose=: ;;
1950
--version) func_version ;;
1951
-\?|-h) func_usage ;;
1952
--help) func_help ;;
1953
1954
# Separate optargs to long options (plugins may need this):
1955
--*=*) func_split_equals "$_G_opt"
1956
set dummy "$func_split_equals_lhs" \
1957
"$func_split_equals_rhs" ${1+"$@"}
1958
shift
1959
;;
1960
1961
# Separate optargs to short options:
1962
-W*)
1963
func_split_short_opt "$_G_opt"
1964
set dummy "$func_split_short_opt_name" \
1965
"$func_split_short_opt_arg" ${1+"$@"}
1966
shift
1967
;;
1968
1969
# Separate non-argument short options:
1970
-\?*|-h*|-v*|-x*)
1971
func_split_short_opt "$_G_opt"
1972
set dummy "$func_split_short_opt_name" \
1973
"-$func_split_short_opt_arg" ${1+"$@"}
1974
shift
1975
;;
1976
1977
--) _G_parse_options_requote=: ; break ;;
1978
-*) func_fatal_help "unrecognised option: '$_G_opt'" ;;
1979
*) set dummy "$_G_opt" ${1+"$@"}; shift
1980
_G_match_parse_options=false
1981
break
1982
;;
1983
esac
1984
1985
if $_G_match_parse_options; then
1986
_G_parse_options_requote=:
1987
fi
1988
done
1989
1990
if $_G_parse_options_requote; then
1991
# save modified positional parameters for caller
1992
func_quote eval ${1+"$@"}
1993
func_parse_options_result=$func_quote_result
1994
fi
1995
}
1996
1997
1998
# func_validate_options [ARG]...
1999
# ------------------------------
2000
# Perform any sanity checks on option settings and/or unconsumed
2001
# arguments.
2002
func_hookable func_validate_options
2003
func_validate_options ()
2004
{
2005
$debug_cmd
2006
2007
# Display all warnings if -W was not given.
2008
test -n "$opt_warning_types" || opt_warning_types=" $warning_categories"
2009
2010
func_run_hooks func_validate_options ${1+"$@"}
2011
func_propagate_result func_run_hooks func_validate_options
2012
2013
# Bail if the options were screwed!
2014
$exit_cmd $EXIT_FAILURE
2015
}
2016
2017
2018
2019
## ----------------- ##
2020
## Helper functions. ##
2021
## ----------------- ##
2022
2023
# This section contains the helper functions used by the rest of the
2024
# hookable option parser framework in ascii-betical order.
2025
2026
2027
# func_fatal_help ARG...
2028
# ----------------------
2029
# Echo program name prefixed message to standard error, followed by
2030
# a help hint, and exit.
2031
func_fatal_help ()
2032
{
2033
$debug_cmd
2034
2035
eval \$ECHO \""Usage: $usage"\"
2036
eval \$ECHO \""$fatal_help"\"
2037
func_error ${1+"$@"}
2038
exit $EXIT_FAILURE
2039
}
2040
2041
2042
# func_help
2043
# ---------
2044
# Echo long help message to standard output and exit.
2045
func_help ()
2046
{
2047
$debug_cmd
2048
2049
func_usage_message
2050
$ECHO "$long_help_message"
2051
exit 0
2052
}
2053
2054
2055
# func_missing_arg ARGNAME
2056
# ------------------------
2057
# Echo program name prefixed message to standard error and set global
2058
# exit_cmd.
2059
func_missing_arg ()
2060
{
2061
$debug_cmd
2062
2063
func_error "Missing argument for '$1'."
2064
exit_cmd=exit
2065
}
2066
2067
2068
# func_split_equals STRING
2069
# ------------------------
2070
# Set func_split_equals_lhs and func_split_equals_rhs shell variables
2071
# after splitting STRING at the '=' sign.
2072
test -z "$_G_HAVE_XSI_OPS" \
2073
&& (eval 'x=a/b/c;
2074
test 5aa/bb/cc = "${#x}${x%%/*}${x%/*}${x#*/}${x##*/}"') 2>/dev/null \
2075
&& _G_HAVE_XSI_OPS=yes
2076
2077
if test yes = "$_G_HAVE_XSI_OPS"
2078
then
2079
# This is an XSI compatible shell, allowing a faster implementation...
2080
eval 'func_split_equals ()
2081
{
2082
$debug_cmd
2083
2084
func_split_equals_lhs=${1%%=*}
2085
func_split_equals_rhs=${1#*=}
2086
if test "x$func_split_equals_lhs" = "x$1"; then
2087
func_split_equals_rhs=
2088
fi
2089
}'
2090
else
2091
# ...otherwise fall back to using expr, which is often a shell builtin.
2092
func_split_equals ()
2093
{
2094
$debug_cmd
2095
2096
func_split_equals_lhs=`expr "x$1" : 'x\([^=]*\)'`
2097
func_split_equals_rhs=
2098
test "x$func_split_equals_lhs=" = "x$1" \
2099
|| func_split_equals_rhs=`expr "x$1" : 'x[^=]*=\(.*\)$'`
2100
}
2101
fi #func_split_equals
2102
2103
2104
# func_split_short_opt SHORTOPT
2105
# -----------------------------
2106
# Set func_split_short_opt_name and func_split_short_opt_arg shell
2107
# variables after splitting SHORTOPT after the 2nd character.
2108
if test yes = "$_G_HAVE_XSI_OPS"
2109
then
2110
# This is an XSI compatible shell, allowing a faster implementation...
2111
eval 'func_split_short_opt ()
2112
{
2113
$debug_cmd
2114
2115
func_split_short_opt_arg=${1#??}
2116
func_split_short_opt_name=${1%"$func_split_short_opt_arg"}
2117
}'
2118
else
2119
# ...otherwise fall back to using expr, which is often a shell builtin.
2120
func_split_short_opt ()
2121
{
2122
$debug_cmd
2123
2124
func_split_short_opt_name=`expr "x$1" : 'x\(-.\)'`
2125
func_split_short_opt_arg=`expr "x$1" : 'x-.\(.*\)$'`
2126
}
2127
fi #func_split_short_opt
2128
2129
2130
# func_usage
2131
# ----------
2132
# Echo short help message to standard output and exit.
2133
func_usage ()
2134
{
2135
$debug_cmd
2136
2137
func_usage_message
2138
$ECHO "Run '$progname --help |${PAGER-more}' for full usage"
2139
exit 0
2140
}
2141
2142
2143
# func_usage_message
2144
# ------------------
2145
# Echo short help message to standard output.
2146
func_usage_message ()
2147
{
2148
$debug_cmd
2149
2150
eval \$ECHO \""Usage: $usage"\"
2151
echo
2152
$SED -n 's|^# ||
2153
/^Written by/{
2154
x;p;x
2155
}
2156
h
2157
/^Written by/q' < "$progpath"
2158
echo
2159
eval \$ECHO \""$usage_message"\"
2160
}
2161
2162
2163
# func_version
2164
# ------------
2165
# Echo version message to standard output and exit.
2166
# The version message is extracted from the calling file's header
2167
# comments, with leading '# ' stripped:
2168
# 1. First display the progname and version
2169
# 2. Followed by the header comment line matching /^# Written by /
2170
# 3. Then a blank line followed by the first following line matching
2171
# /^# Copyright /
2172
# 4. Immediately followed by any lines between the previous matches,
2173
# except lines preceding the intervening completely blank line.
2174
# For example, see the header comments of this file.
2175
func_version ()
2176
{
2177
$debug_cmd
2178
2179
printf '%s\n' "$progname $scriptversion"
2180
$SED -n '
2181
/^# Written by /!b
2182
s|^# ||; p; n
2183
2184
:fwd2blnk
2185
/./ {
2186
n
2187
b fwd2blnk
2188
}
2189
p; n
2190
2191
:holdwrnt
2192
s|^# ||
2193
s|^# *$||
2194
/^Copyright /!{
2195
/./H
2196
n
2197
b holdwrnt
2198
}
2199
2200
s|\((C)\)[ 0-9,-]*[ ,-]\([1-9][0-9]* \)|\1 \2|
2201
G
2202
s|\(\n\)\n*|\1|g
2203
p; q' < "$progpath"
2204
2205
exit $?
2206
}
2207
2208
2209
# Local variables:
2210
# mode: shell-script
2211
# sh-indentation: 2
2212
# eval: (add-hook 'before-save-hook 'time-stamp)
2213
# time-stamp-pattern: "30/scriptversion=%:y-%02m-%02d.%02H; # UTC"
2214
# time-stamp-time-zone: "UTC"
2215
# End:
2216
2217
# Set a version string.
2218
scriptversion='(GNU libtool) 2.5.4'
2219
2220
# func_version
2221
# ------------
2222
# Echo version message to standard output and exit.
2223
func_version ()
2224
{
2225
$debug_cmd
2226
2227
year=`date +%Y`
2228
2229
cat <<EOF
2230
$progname $scriptversion
2231
Copyright (C) $year Free Software Foundation, Inc.
2232
License GPLv2+: GNU GPL version 2 or later <https://gnu.org/licenses/gpl.html>
2233
This is free software: you are free to change and redistribute it.
2234
There is NO WARRANTY, to the extent permitted by law.
2235
2236
Originally written by Gordon Matzigkeit, 1996
2237
(See AUTHORS for complete contributor listing)
2238
EOF
2239
2240
exit $?
2241
}
2242
2243
2244
# func_echo ARG...
2245
# ----------------
2246
# Libtool also displays the current mode in messages, so override
2247
# funclib.sh func_echo with this custom definition.
2248
func_echo ()
2249
{
2250
$debug_cmd
2251
2252
_G_message=$*
2253
2254
func_echo_IFS=$IFS
2255
IFS=$nl
2256
for _G_line in $_G_message; do
2257
IFS=$func_echo_IFS
2258
$ECHO "$progname${opt_mode+: $opt_mode}: $_G_line"
2259
done
2260
IFS=$func_echo_IFS
2261
}
2262
2263
2264
## ---------------- ##
2265
## Options parsing. ##
2266
## ---------------- ##
2267
2268
# Hook in the functions to make sure our own options are parsed during
2269
# the option parsing loop.
2270
2271
usage='$progpath [OPTION]... [MODE-ARG]...'
2272
2273
# Short help message in response to '-h'.
2274
usage_message="Options:
2275
--config show all configuration variables
2276
--debug enable verbose shell tracing
2277
-n, --dry-run display commands without modifying any files
2278
--features display basic configuration information
2279
--finish use operation '--mode=finish'
2280
--mode=MODE use operation mode MODE
2281
--no-finish don't update shared library cache
2282
--no-quiet, --no-silent print default informational messages
2283
--no-warnings equivalent to '-Wnone'
2284
--preserve-dup-deps don't remove duplicate dependency libraries
2285
--quiet, --silent don't print informational messages
2286
--reorder-cache=DIRS reorder shared library cache for preferred DIRS
2287
--tag=TAG use configuration variables from tag TAG
2288
-v, --verbose print more informational messages than default
2289
--version print version information
2290
-W, --warnings=CATEGORY report the warnings falling in CATEGORY [all]
2291
-h, --help, --help-all print short, long, or detailed help message
2292
"
2293
2294
# Additional text appended to 'usage_message' in response to '--help'.
2295
func_help ()
2296
{
2297
$debug_cmd
2298
2299
func_usage_message
2300
$ECHO "$long_help_message
2301
2302
MODE must be one of the following:
2303
2304
clean remove files from the build directory
2305
compile compile a source file into a libtool object
2306
execute automatically set library path, then run a program
2307
finish complete the installation of libtool libraries
2308
install install libraries or executables
2309
link create a library or an executable
2310
uninstall remove libraries from an installed directory
2311
2312
MODE-ARGS vary depending on the MODE. When passed as first option,
2313
'--mode=MODE' may be abbreviated as 'MODE' or a unique abbreviation of that.
2314
Try '$progname --help --mode=MODE' for a more detailed description of MODE.
2315
2316
When reporting a bug, please describe a test case to reproduce it and
2317
include the following information:
2318
2319
host-triplet: $host
2320
shell: $SHELL
2321
compiler: $LTCC
2322
compiler flags: $LTCFLAGS
2323
linker: $LD (gnu? $with_gnu_ld)
2324
version: $progname $scriptversion
2325
automake: `($AUTOMAKE --version) 2>/dev/null |$SED 1q`
2326
autoconf: `($AUTOCONF --version) 2>/dev/null |$SED 1q`
2327
2328
Report bugs to <[email protected]>.
2329
GNU libtool home page: <https://www.gnu.org/software/libtool/>.
2330
General help using GNU software: <https://www.gnu.org/gethelp/>."
2331
exit 0
2332
}
2333
2334
2335
# func_lo2o OBJECT-NAME
2336
# ---------------------
2337
# Transform OBJECT-NAME from a '.lo' suffix to the platform specific
2338
# object suffix.
2339
2340
lo2o=s/\\.lo\$/.$objext/
2341
o2lo=s/\\.$objext\$/.lo/
2342
2343
if test yes = "$_G_HAVE_XSI_OPS"; then
2344
eval 'func_lo2o ()
2345
{
2346
case $1 in
2347
*.lo) func_lo2o_result=${1%.lo}.$objext ;;
2348
* ) func_lo2o_result=$1 ;;
2349
esac
2350
}'
2351
2352
# func_xform LIBOBJ-OR-SOURCE
2353
# ---------------------------
2354
# Transform LIBOBJ-OR-SOURCE from a '.o' or '.c' (or otherwise)
2355
# suffix to a '.lo' libtool-object suffix.
2356
eval 'func_xform ()
2357
{
2358
func_xform_result=${1%.*}.lo
2359
}'
2360
else
2361
# ...otherwise fall back to using sed.
2362
func_lo2o ()
2363
{
2364
func_lo2o_result=`$ECHO "$1" | $SED "$lo2o"`
2365
}
2366
2367
func_xform ()
2368
{
2369
func_xform_result=`$ECHO "$1" | $SED 's|\.[^.]*$|.lo|'`
2370
}
2371
fi
2372
2373
2374
# func_fatal_configuration ARG...
2375
# -------------------------------
2376
# Echo program name prefixed message to standard error, followed by
2377
# a configuration failure hint, and exit.
2378
func_fatal_configuration ()
2379
{
2380
func_fatal_error ${1+"$@"} \
2381
"See the $PACKAGE documentation for more information." \
2382
"Fatal configuration error."
2383
}
2384
2385
2386
# func_config
2387
# -----------
2388
# Display the configuration for all the tags in this script.
2389
func_config ()
2390
{
2391
re_begincf='^# ### BEGIN LIBTOOL'
2392
re_endcf='^# ### END LIBTOOL'
2393
2394
# Default configuration.
2395
$SED "1,/$re_begincf CONFIG/d;/$re_endcf CONFIG/,\$d" < "$progpath"
2396
2397
# Now print the configurations for the tags.
2398
for tagname in $taglist; do
2399
$SED -n "/$re_begincf TAG CONFIG: $tagname\$/,/$re_endcf TAG CONFIG: $tagname\$/p" < "$progpath"
2400
done
2401
2402
exit $?
2403
}
2404
2405
2406
# func_features
2407
# -------------
2408
# Display the features supported by this script.
2409
func_features ()
2410
{
2411
echo "host: $host"
2412
if test yes = "$build_libtool_libs"; then
2413
echo "enable shared libraries"
2414
else
2415
echo "disable shared libraries"
2416
fi
2417
if test yes = "$build_old_libs"; then
2418
echo "enable static libraries"
2419
else
2420
echo "disable static libraries"
2421
fi
2422
2423
exit $?
2424
}
2425
2426
2427
# func_enable_tag TAGNAME
2428
# -----------------------
2429
# Verify that TAGNAME is valid, and either flag an error and exit, or
2430
# enable the TAGNAME tag. We also add TAGNAME to the global $taglist
2431
# variable here.
2432
func_enable_tag ()
2433
{
2434
# Global variable:
2435
tagname=$1
2436
2437
re_begincf="^# ### BEGIN LIBTOOL TAG CONFIG: $tagname\$"
2438
re_endcf="^# ### END LIBTOOL TAG CONFIG: $tagname\$"
2439
sed_extractcf=/$re_begincf/,/$re_endcf/p
2440
2441
# Validate tagname.
2442
case $tagname in
2443
*[!-_A-Za-z0-9,/]*)
2444
func_fatal_error "invalid tag name: $tagname"
2445
;;
2446
esac
2447
2448
# Don't test for the "default" C tag, as we know it's
2449
# there but not specially marked.
2450
case $tagname in
2451
CC) ;;
2452
*)
2453
if $GREP "$re_begincf" "$progpath" >/dev/null 2>&1; then
2454
taglist="$taglist $tagname"
2455
2456
# Evaluate the configuration. Be careful to quote the path
2457
# and the sed script, to avoid splitting on whitespace, but
2458
# also don't use non-portable quotes within backquotes within
2459
# quotes we have to do it in 2 steps:
2460
extractedcf=`$SED -n -e "$sed_extractcf" < "$progpath"`
2461
eval "$extractedcf"
2462
else
2463
func_error "ignoring unknown tag $tagname"
2464
fi
2465
;;
2466
esac
2467
}
2468
2469
2470
# func_check_version_match
2471
# ------------------------
2472
# Ensure that we are using m4 macros, and libtool script from the same
2473
# release of libtool.
2474
func_check_version_match ()
2475
{
2476
if test "$package_revision" != "$macro_revision"; then
2477
if test "$VERSION" != "$macro_version"; then
2478
if test -z "$macro_version"; then
2479
cat >&2 <<_LT_EOF
2480
$progname: Version mismatch error. This is $PACKAGE $VERSION, but the
2481
$progname: definition of this LT_INIT comes from an older release.
2482
$progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION
2483
$progname: and run autoconf again.
2484
_LT_EOF
2485
else
2486
cat >&2 <<_LT_EOF
2487
$progname: Version mismatch error. This is $PACKAGE $VERSION, but the
2488
$progname: definition of this LT_INIT comes from $PACKAGE $macro_version.
2489
$progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION
2490
$progname: and run autoconf again.
2491
_LT_EOF
2492
fi
2493
else
2494
cat >&2 <<_LT_EOF
2495
$progname: Version mismatch error. This is $PACKAGE $VERSION, revision $package_revision,
2496
$progname: but the definition of this LT_INIT comes from revision $macro_revision.
2497
$progname: You should recreate aclocal.m4 with macros from revision $package_revision
2498
$progname: of $PACKAGE $VERSION and run autoconf again.
2499
_LT_EOF
2500
fi
2501
2502
exit $EXIT_MISMATCH
2503
fi
2504
}
2505
2506
2507
# libtool_options_prep [ARG]...
2508
# -----------------------------
2509
# Preparation for options parsed by libtool.
2510
libtool_options_prep ()
2511
{
2512
$debug_mode
2513
2514
# Option defaults:
2515
opt_config=false
2516
opt_dlopen=
2517
opt_dry_run=false
2518
opt_help=false
2519
opt_mode=
2520
opt_reorder_cache=false
2521
opt_preserve_dup_deps=false
2522
opt_quiet=false
2523
opt_finishing=true
2524
opt_warning=
2525
2526
nonopt=
2527
preserve_args=
2528
2529
_G_rc_lt_options_prep=:
2530
2531
# Shorthand for --mode=foo, only valid as the first argument
2532
case $1 in
2533
clean|clea|cle|cl)
2534
shift; set dummy --mode clean ${1+"$@"}; shift
2535
;;
2536
compile|compil|compi|comp|com|co|c)
2537
shift; set dummy --mode compile ${1+"$@"}; shift
2538
;;
2539
execute|execut|execu|exec|exe|ex|e)
2540
shift; set dummy --mode execute ${1+"$@"}; shift
2541
;;
2542
finish|finis|fini|fin|fi|f)
2543
shift; set dummy --mode finish ${1+"$@"}; shift
2544
;;
2545
install|instal|insta|inst|ins|in|i)
2546
shift; set dummy --mode install ${1+"$@"}; shift
2547
;;
2548
link|lin|li|l)
2549
shift; set dummy --mode link ${1+"$@"}; shift
2550
;;
2551
uninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u)
2552
shift; set dummy --mode uninstall ${1+"$@"}; shift
2553
;;
2554
*)
2555
_G_rc_lt_options_prep=false
2556
;;
2557
esac
2558
2559
if $_G_rc_lt_options_prep; then
2560
# Pass back the list of options.
2561
func_quote eval ${1+"$@"}
2562
libtool_options_prep_result=$func_quote_result
2563
fi
2564
}
2565
func_add_hook func_options_prep libtool_options_prep
2566
2567
2568
# libtool_parse_options [ARG]...
2569
# ---------------------------------
2570
# Provide handling for libtool specific options.
2571
libtool_parse_options ()
2572
{
2573
$debug_cmd
2574
2575
_G_rc_lt_parse_options=false
2576
2577
# Perform our own loop to consume as many options as possible in
2578
# each iteration.
2579
while test $# -gt 0; do
2580
_G_match_lt_parse_options=:
2581
_G_opt=$1
2582
shift
2583
case $_G_opt in
2584
--dry-run|--dryrun|-n)
2585
opt_dry_run=:
2586
;;
2587
2588
--config) func_config ;;
2589
2590
--dlopen|-dlopen)
2591
opt_dlopen="${opt_dlopen+$opt_dlopen
2592
}$1"
2593
shift
2594
;;
2595
2596
--preserve-dup-deps)
2597
opt_preserve_dup_deps=: ;;
2598
2599
--features) func_features ;;
2600
2601
--finish) set dummy --mode finish ${1+"$@"}; shift ;;
2602
2603
--help) opt_help=: ;;
2604
2605
--help-all) opt_help=': help-all' ;;
2606
2607
--mode) test $# = 0 && func_missing_arg $_G_opt && break
2608
opt_mode=$1
2609
case $1 in
2610
# Valid mode arguments:
2611
clean|compile|execute|finish|install|link|relink|uninstall) ;;
2612
2613
# Catch anything else as an error
2614
*) func_error "invalid argument '$1' for $_G_opt"
2615
exit_cmd=exit
2616
;;
2617
esac
2618
shift
2619
;;
2620
2621
--no-finish)
2622
opt_finishing=false
2623
func_append preserve_args " $_G_opt"
2624
;;
2625
2626
--no-silent|--no-quiet)
2627
opt_quiet=false
2628
func_append preserve_args " $_G_opt"
2629
;;
2630
2631
--no-warnings|--no-warning|--no-warn)
2632
opt_warning=false
2633
func_append preserve_args " $_G_opt"
2634
;;
2635
2636
--no-verbose)
2637
opt_verbose=false
2638
func_append preserve_args " $_G_opt"
2639
;;
2640
2641
--reorder-cache)
2642
opt_reorder_cache=true
2643
shared_lib_dirs=$1
2644
if test -n "$shared_lib_dirs"; then
2645
case $1 in
2646
# Must begin with /:
2647
/*) ;;
2648
2649
# Catch anything else as an error (relative paths)
2650
*) func_error "invalid argument '$1' for $_G_opt"
2651
func_error "absolute paths are required for $_G_opt"
2652
exit_cmd=exit
2653
;;
2654
esac
2655
fi
2656
shift
2657
;;
2658
2659
--silent|--quiet)
2660
opt_quiet=:
2661
opt_verbose=false
2662
func_append preserve_args " $_G_opt"
2663
;;
2664
2665
--tag) test $# = 0 && func_missing_arg $_G_opt && break
2666
opt_tag=$1
2667
func_append preserve_args " $_G_opt $1"
2668
func_enable_tag "$1"
2669
shift
2670
;;
2671
2672
--verbose|-v) opt_quiet=false
2673
opt_verbose=:
2674
func_append preserve_args " $_G_opt"
2675
;;
2676
2677
# An option not handled by this hook function:
2678
*) set dummy "$_G_opt" ${1+"$@"} ; shift
2679
_G_match_lt_parse_options=false
2680
break
2681
;;
2682
esac
2683
$_G_match_lt_parse_options && _G_rc_lt_parse_options=:
2684
done
2685
2686
if $_G_rc_lt_parse_options; then
2687
# save modified positional parameters for caller
2688
func_quote eval ${1+"$@"}
2689
libtool_parse_options_result=$func_quote_result
2690
fi
2691
}
2692
func_add_hook func_parse_options libtool_parse_options
2693
2694
2695
# func_warning ARG...
2696
# -------------------
2697
# Libtool warnings are not categorized, so override funclib.sh
2698
# func_warning with this simpler definition.
2699
func_warning ()
2700
{
2701
if $opt_warning; then
2702
$debug_cmd
2703
$warning_func ${1+"$@"}
2704
fi
2705
}
2706
2707
2708
# libtool_validate_options [ARG]...
2709
# ---------------------------------
2710
# Perform any sanity checks on option settings and/or unconsumed
2711
# arguments.
2712
libtool_validate_options ()
2713
{
2714
# save first non-option argument
2715
if test 0 -lt $#; then
2716
nonopt=$1
2717
shift
2718
fi
2719
2720
# preserve --debug
2721
test : = "$debug_cmd" || func_append preserve_args " --debug"
2722
2723
case $host_os in
2724
# Solaris2 added to fix http://debbugs.gnu.org/cgi/bugreport.cgi?bug=16452
2725
# see also: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59788
2726
cygwin* | mingw* | windows* | pw32* | cegcc* | solaris2* | os2*)
2727
# don't eliminate duplications in $postdeps and $predeps
2728
opt_duplicate_compiler_generated_deps=:
2729
;;
2730
*)
2731
opt_duplicate_compiler_generated_deps=$opt_preserve_dup_deps
2732
;;
2733
esac
2734
2735
$opt_help || {
2736
# Sanity checks first:
2737
func_check_version_match
2738
2739
test yes != "$build_libtool_libs" \
2740
&& test yes != "$build_old_libs" \
2741
&& func_fatal_configuration "not configured to build any kind of library"
2742
2743
# Darwin sucks
2744
eval std_shrext=\"$shrext_cmds\"
2745
2746
# Only execute mode is allowed to have -dlopen flags.
2747
if test -n "$opt_dlopen" && test execute != "$opt_mode"; then
2748
func_error "unrecognized option '-dlopen'"
2749
$ECHO "$help" 1>&2
2750
exit $EXIT_FAILURE
2751
fi
2752
2753
# Change the help message to a mode-specific one.
2754
generic_help=$help
2755
help="Try '$progname --help --mode=$opt_mode' for more information."
2756
}
2757
2758
# Pass back the unparsed argument list
2759
func_quote eval ${1+"$@"}
2760
libtool_validate_options_result=$func_quote_result
2761
}
2762
func_add_hook func_validate_options libtool_validate_options
2763
2764
2765
# Process options as early as possible so that --help and --version
2766
# can return quickly.
2767
func_options ${1+"$@"}
2768
eval set dummy "$func_options_result"; shift
2769
2770
2771
2772
## ----------- ##
2773
## Main. ##
2774
## ----------- ##
2775
2776
magic='%%%MAGIC variable%%%'
2777
magic_exe='%%%MAGIC EXE variable%%%'
2778
2779
# Global variables.
2780
extracted_archives=
2781
extracted_serial=0
2782
2783
# If this variable is set in any of the actions, the command in it
2784
# will be execed at the end. This prevents here-documents from being
2785
# left over by shells.
2786
exec_cmd=
2787
2788
2789
# A function that is used when there is no print builtin or printf.
2790
func_fallback_echo ()
2791
{
2792
eval 'cat <<_LTECHO_EOF
2793
$1
2794
_LTECHO_EOF'
2795
}
2796
2797
# func_generated_by_libtool
2798
# True iff stdin has been generated by Libtool. This function is only
2799
# a basic sanity check; it will hardly flush out determined imposters.
2800
func_generated_by_libtool_p ()
2801
{
2802
$GREP "^# Generated by .*$PACKAGE" > /dev/null 2>&1
2803
}
2804
2805
# func_lalib_p file
2806
# True iff FILE is a libtool '.la' library or '.lo' object file.
2807
# This function is only a basic sanity check; it will hardly flush out
2808
# determined imposters.
2809
func_lalib_p ()
2810
{
2811
test -f "$1" &&
2812
$SED -e 4q "$1" 2>/dev/null | func_generated_by_libtool_p
2813
}
2814
2815
# func_lalib_unsafe_p file
2816
# True iff FILE is a libtool '.la' library or '.lo' object file.
2817
# This function implements the same check as func_lalib_p without
2818
# resorting to external programs. To this end, it redirects stdin and
2819
# closes it afterwards, without saving the original file descriptor.
2820
# As a safety measure, use it only where a negative result would be
2821
# fatal anyway. Works if 'file' does not exist.
2822
func_lalib_unsafe_p ()
2823
{
2824
lalib_p=no
2825
if test -f "$1" && test -r "$1" && exec 5<&0 <"$1"; then
2826
for lalib_p_l in 1 2 3 4
2827
do
2828
read lalib_p_line
2829
case $lalib_p_line in
2830
\#\ Generated\ by\ *$PACKAGE* ) lalib_p=yes; break;;
2831
esac
2832
done
2833
exec 0<&5 5<&-
2834
fi
2835
test yes = "$lalib_p"
2836
}
2837
2838
# func_ltwrapper_script_p file
2839
# True iff FILE is a libtool wrapper script
2840
# This function is only a basic sanity check; it will hardly flush out
2841
# determined imposters.
2842
func_ltwrapper_script_p ()
2843
{
2844
test -f "$1" &&
2845
$lt_truncate_bin < "$1" 2>/dev/null | func_generated_by_libtool_p
2846
}
2847
2848
# func_ltwrapper_executable_p file
2849
# True iff FILE is a libtool wrapper executable
2850
# This function is only a basic sanity check; it will hardly flush out
2851
# determined imposters.
2852
func_ltwrapper_executable_p ()
2853
{
2854
func_ltwrapper_exec_suffix=
2855
case $1 in
2856
*.exe) ;;
2857
*) func_ltwrapper_exec_suffix=.exe ;;
2858
esac
2859
$GREP "$magic_exe" "$1$func_ltwrapper_exec_suffix" >/dev/null 2>&1
2860
}
2861
2862
# func_ltwrapper_scriptname file
2863
# Assumes file is an ltwrapper_executable
2864
# uses $file to determine the appropriate filename for a
2865
# temporary ltwrapper_script.
2866
func_ltwrapper_scriptname ()
2867
{
2868
func_dirname_and_basename "$1" "" "."
2869
func_stripname '' '.exe' "$func_basename_result"
2870
func_ltwrapper_scriptname_result=$func_dirname_result/$objdir/${func_stripname_result}_ltshwrapper
2871
}
2872
2873
# func_ltwrapper_p file
2874
# True iff FILE is a libtool wrapper script or wrapper executable
2875
# This function is only a basic sanity check; it will hardly flush out
2876
# determined imposters.
2877
func_ltwrapper_p ()
2878
{
2879
func_ltwrapper_script_p "$1" || func_ltwrapper_executable_p "$1"
2880
}
2881
2882
2883
# func_execute_cmds commands fail_cmd
2884
# Execute tilde-delimited COMMANDS.
2885
# If FAIL_CMD is given, eval that upon failure.
2886
# FAIL_CMD may read-access the current command in variable CMD!
2887
func_execute_cmds ()
2888
{
2889
$debug_cmd
2890
2891
save_ifs=$IFS; IFS='~'
2892
for cmd in $1; do
2893
IFS=$sp$nl
2894
eval cmd=\"$cmd\"
2895
IFS=$save_ifs
2896
func_show_eval "$cmd" "${2-:}"
2897
done
2898
IFS=$save_ifs
2899
}
2900
2901
2902
# func_source file
2903
# Source FILE, adding directory component if necessary.
2904
# Note that it is not necessary on cygwin/mingw to append a dot to
2905
# FILE even if both FILE and FILE.exe exist: automatic-append-.exe
2906
# behavior happens only for exec(3), not for open(2)! Also, sourcing
2907
# 'FILE.' does not work on cygwin managed mounts.
2908
func_source ()
2909
{
2910
$debug_cmd
2911
2912
case $1 in
2913
*/* | *\\*) . "$1" ;;
2914
*) . "./$1" ;;
2915
esac
2916
}
2917
2918
2919
# func_resolve_sysroot PATH
2920
# Replace a leading = in PATH with a sysroot. Store the result into
2921
# func_resolve_sysroot_result
2922
func_resolve_sysroot ()
2923
{
2924
func_resolve_sysroot_result=$1
2925
case $func_resolve_sysroot_result in
2926
=*)
2927
func_stripname '=' '' "$func_resolve_sysroot_result"
2928
func_resolve_sysroot_result=$lt_sysroot$func_stripname_result
2929
;;
2930
esac
2931
}
2932
2933
# func_replace_sysroot PATH
2934
# If PATH begins with the sysroot, replace it with = and
2935
# store the result into func_replace_sysroot_result.
2936
func_replace_sysroot ()
2937
{
2938
case $lt_sysroot:$1 in
2939
?*:"$lt_sysroot"*)
2940
func_stripname "$lt_sysroot" '' "$1"
2941
func_replace_sysroot_result='='$func_stripname_result
2942
;;
2943
*)
2944
# Including no sysroot.
2945
func_replace_sysroot_result=$1
2946
;;
2947
esac
2948
}
2949
2950
# func_infer_tag arg
2951
# Infer tagged configuration to use if any are available and
2952
# if one wasn't chosen via the "--tag" command line option.
2953
# Only attempt this if the compiler in the base compile
2954
# command doesn't match the default compiler.
2955
# arg is usually of the form 'gcc ...'
2956
func_infer_tag ()
2957
{
2958
$debug_cmd
2959
2960
if test -n "$available_tags" && test -z "$tagname"; then
2961
CC_quoted=
2962
for arg in $CC; do
2963
func_append_quoted CC_quoted "$arg"
2964
done
2965
CC_expanded=`func_echo_all $CC`
2966
CC_quoted_expanded=`func_echo_all $CC_quoted`
2967
case $@ in
2968
# Blanks in the command may have been stripped by the calling shell,
2969
# but not from the CC environment variable when configure was run.
2970
" $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \
2971
" $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*) ;;
2972
# Blanks at the start of $base_compile will cause this to fail
2973
# if we don't check for them as well.
2974
*)
2975
for z in $available_tags; do
2976
if $GREP "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then
2977
# Evaluate the configuration.
2978
eval "`$SED -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`"
2979
CC_quoted=
2980
for arg in $CC; do
2981
# Double-quote args containing other shell metacharacters.
2982
func_append_quoted CC_quoted "$arg"
2983
done
2984
CC_expanded=`func_echo_all $CC`
2985
CC_quoted_expanded=`func_echo_all $CC_quoted`
2986
case "$@ " in
2987
" $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \
2988
" $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*)
2989
# The compiler in the base compile command matches
2990
# the one in the tagged configuration.
2991
# Assume this is the tagged configuration we want.
2992
tagname=$z
2993
break
2994
;;
2995
esac
2996
fi
2997
done
2998
# If $tagname still isn't set, then no tagged configuration
2999
# was found and let the user know that the "--tag" command
3000
# line option must be used.
3001
if test -z "$tagname"; then
3002
func_echo "unable to infer tagged configuration"
3003
func_fatal_error "specify a tag with '--tag'"
3004
# else
3005
# func_verbose "using $tagname tagged configuration"
3006
fi
3007
;;
3008
esac
3009
fi
3010
}
3011
3012
3013
3014
# func_write_libtool_object output_name pic_name nonpic_name
3015
# Create a libtool object file (analogous to a ".la" file),
3016
# but don't create it if we're doing a dry run.
3017
func_write_libtool_object ()
3018
{
3019
write_libobj=$1
3020
if test yes = "$build_libtool_libs"; then
3021
write_lobj=\'$2\'
3022
else
3023
write_lobj=none
3024
fi
3025
3026
if test yes = "$build_old_libs"; then
3027
write_oldobj=\'$3\'
3028
else
3029
write_oldobj=none
3030
fi
3031
3032
$opt_dry_run || {
3033
cat >${write_libobj}T <<EOF
3034
# $write_libobj - a libtool object file
3035
# Generated by $PROGRAM (GNU $PACKAGE) $VERSION
3036
#
3037
# Please DO NOT delete this file!
3038
# It is necessary for linking the library.
3039
3040
# Name of the PIC object.
3041
pic_object=$write_lobj
3042
3043
# Name of the non-PIC object
3044
non_pic_object=$write_oldobj
3045
3046
EOF
3047
$MV "${write_libobj}T" "$write_libobj"
3048
}
3049
}
3050
3051
3052
##################################################
3053
# FILE NAME AND PATH CONVERSION HELPER FUNCTIONS #
3054
##################################################
3055
3056
# func_convert_core_file_wine_to_w32 ARG
3057
# Helper function used by file name conversion functions when $build is *nix,
3058
# and $host is mingw, windows, cygwin, or some other w32 environment. Relies on a
3059
# correctly configured wine environment available, with the winepath program
3060
# in $build's $PATH.
3061
#
3062
# ARG is the $build file name to be converted to w32 format.
3063
# Result is available in $func_convert_core_file_wine_to_w32_result, and will
3064
# be empty on error (or when ARG is empty)
3065
func_convert_core_file_wine_to_w32 ()
3066
{
3067
$debug_cmd
3068
3069
func_convert_core_file_wine_to_w32_result=$1
3070
if test -n "$1"; then
3071
# Unfortunately, winepath does not exit with a non-zero error code, so we
3072
# are forced to check the contents of stdout. On the other hand, if the
3073
# command is not found, the shell will set an exit code of 127 and print
3074
# *an error message* to stdout. So we must check for both error code of
3075
# zero AND non-empty stdout, which explains the odd construction:
3076
func_convert_core_file_wine_to_w32_tmp=`winepath -w "$1" 2>/dev/null`
3077
if test "$?" -eq 0 && test -n "$func_convert_core_file_wine_to_w32_tmp"; then
3078
func_convert_core_file_wine_to_w32_result=`$ECHO "$func_convert_core_file_wine_to_w32_tmp" |
3079
$SED -e "$sed_naive_backslashify"`
3080
else
3081
func_convert_core_file_wine_to_w32_result=
3082
fi
3083
fi
3084
}
3085
# end: func_convert_core_file_wine_to_w32
3086
3087
3088
# func_convert_core_path_wine_to_w32 ARG
3089
# Helper function used by path conversion functions when $build is *nix, and
3090
# $host is mingw, windows, cygwin, or some other w32 environment. Relies on a
3091
# correctly configured wine environment available, with the winepath program
3092
# in $build's $PATH. Assumes ARG has no leading or trailing path separator
3093
# characters.
3094
#
3095
# ARG is path to be converted from $build format to win32.
3096
# Result is available in $func_convert_core_path_wine_to_w32_result.
3097
# Unconvertible file (directory) names in ARG are skipped; if no directory names
3098
# are convertible, then the result may be empty.
3099
func_convert_core_path_wine_to_w32 ()
3100
{
3101
$debug_cmd
3102
3103
# unfortunately, winepath doesn't convert paths, only file names
3104
func_convert_core_path_wine_to_w32_result=
3105
if test -n "$1"; then
3106
oldIFS=$IFS
3107
IFS=:
3108
for func_convert_core_path_wine_to_w32_f in $1; do
3109
IFS=$oldIFS
3110
func_convert_core_file_wine_to_w32 "$func_convert_core_path_wine_to_w32_f"
3111
if test -n "$func_convert_core_file_wine_to_w32_result"; then
3112
if test -z "$func_convert_core_path_wine_to_w32_result"; then
3113
func_convert_core_path_wine_to_w32_result=$func_convert_core_file_wine_to_w32_result
3114
else
3115
func_append func_convert_core_path_wine_to_w32_result ";$func_convert_core_file_wine_to_w32_result"
3116
fi
3117
fi
3118
done
3119
IFS=$oldIFS
3120
fi
3121
}
3122
# end: func_convert_core_path_wine_to_w32
3123
3124
3125
# func_cygpath ARGS...
3126
# Wrapper around calling the cygpath program via LT_CYGPATH. This is used when
3127
# when (1) $build is *nix and Cygwin is hosted via a wine environment; or (2)
3128
# $build is MSYS and $host is Cygwin, or (3) $build is Cygwin. In case (1) or
3129
# (2), returns the Cygwin file name or path in func_cygpath_result (input
3130
# file name or path is assumed to be in w32 format, as previously converted
3131
# from $build's *nix or MSYS format). In case (3), returns the w32 file name
3132
# or path in func_cygpath_result (input file name or path is assumed to be in
3133
# Cygwin format). Returns an empty string on error.
3134
#
3135
# ARGS are passed to cygpath, with the last one being the file name or path to
3136
# be converted.
3137
#
3138
# Specify the absolute *nix (or w32) name to cygpath in the LT_CYGPATH
3139
# environment variable; do not put it in $PATH.
3140
func_cygpath ()
3141
{
3142
$debug_cmd
3143
3144
if test -n "$LT_CYGPATH" && test -f "$LT_CYGPATH"; then
3145
func_cygpath_result=`$LT_CYGPATH "$@" 2>/dev/null`
3146
if test "$?" -ne 0; then
3147
# on failure, ensure result is empty
3148
func_cygpath_result=
3149
fi
3150
else
3151
func_cygpath_result=
3152
func_error "LT_CYGPATH is empty or specifies non-existent file: '$LT_CYGPATH'"
3153
fi
3154
}
3155
#end: func_cygpath
3156
3157
3158
# func_convert_core_msys_to_w32 ARG
3159
# Convert file name or path ARG from MSYS format to w32 format. Return
3160
# result in func_convert_core_msys_to_w32_result.
3161
func_convert_core_msys_to_w32 ()
3162
{
3163
$debug_cmd
3164
3165
# awkward: cmd appends spaces to result
3166
func_convert_core_msys_to_w32_result=`( cmd //c echo "$1" ) 2>/dev/null |
3167
$SED -e 's/[ ]*$//' -e "$sed_naive_backslashify"`
3168
}
3169
#end: func_convert_core_msys_to_w32
3170
3171
3172
# func_convert_file_check ARG1 ARG2
3173
# Verify that ARG1 (a file name in $build format) was converted to $host
3174
# format in ARG2. Otherwise, emit an error message, but continue (resetting
3175
# func_to_host_file_result to ARG1).
3176
func_convert_file_check ()
3177
{
3178
$debug_cmd
3179
3180
if test -z "$2" && test -n "$1"; then
3181
func_error "Could not determine host file name corresponding to"
3182
func_error " '$1'"
3183
func_error "Continuing, but uninstalled executables may not work."
3184
# Fallback:
3185
func_to_host_file_result=$1
3186
fi
3187
}
3188
# end func_convert_file_check
3189
3190
3191
# func_convert_path_check FROM_PATHSEP TO_PATHSEP FROM_PATH TO_PATH
3192
# Verify that FROM_PATH (a path in $build format) was converted to $host
3193
# format in TO_PATH. Otherwise, emit an error message, but continue, resetting
3194
# func_to_host_file_result to a simplistic fallback value (see below).
3195
func_convert_path_check ()
3196
{
3197
$debug_cmd
3198
3199
if test -z "$4" && test -n "$3"; then
3200
func_error "Could not determine the host path corresponding to"
3201
func_error " '$3'"
3202
func_error "Continuing, but uninstalled executables may not work."
3203
# Fallback. This is a deliberately simplistic "conversion" and
3204
# should not be "improved". See libtool.info.
3205
if test "x$1" != "x$2"; then
3206
lt_replace_pathsep_chars="s|$1|$2|g"
3207
func_to_host_path_result=`echo "$3" |
3208
$SED -e "$lt_replace_pathsep_chars"`
3209
else
3210
func_to_host_path_result=$3
3211
fi
3212
fi
3213
}
3214
# end func_convert_path_check
3215
3216
3217
# func_convert_path_front_back_pathsep FRONTPAT BACKPAT REPL ORIG
3218
# Modifies func_to_host_path_result by prepending REPL if ORIG matches FRONTPAT
3219
# and appending REPL if ORIG matches BACKPAT.
3220
func_convert_path_front_back_pathsep ()
3221
{
3222
$debug_cmd
3223
3224
case $4 in
3225
$1 ) func_to_host_path_result=$3$func_to_host_path_result
3226
;;
3227
esac
3228
case $4 in
3229
$2 ) func_append func_to_host_path_result "$3"
3230
;;
3231
esac
3232
}
3233
# end func_convert_path_front_back_pathsep
3234
3235
3236
# func_convert_delimited_path PATH ORIG_DELIMITER NEW_DELIMITER
3237
# Replaces a delimiter for a given path.
3238
func_convert_delimited_path ()
3239
{
3240
converted_path=`$ECHO "$1" | $SED "s#$2#$3#g"`
3241
}
3242
# end func_convert_delimited_path
3243
3244
3245
##################################################
3246
# $build to $host FILE NAME CONVERSION FUNCTIONS #
3247
##################################################
3248
# invoked via '$to_host_file_cmd ARG'
3249
#
3250
# In each case, ARG is the path to be converted from $build to $host format.
3251
# Result will be available in $func_to_host_file_result.
3252
3253
3254
# func_to_host_file ARG
3255
# Converts the file name ARG from $build format to $host format. Return result
3256
# in func_to_host_file_result.
3257
func_to_host_file ()
3258
{
3259
$debug_cmd
3260
3261
$to_host_file_cmd "$1"
3262
}
3263
# end func_to_host_file
3264
3265
3266
# func_to_tool_file ARG LAZY
3267
# converts the file name ARG from $build format to toolchain format. Return
3268
# result in func_to_tool_file_result. If the conversion in use is listed
3269
# in (the comma separated) LAZY, no conversion takes place.
3270
func_to_tool_file ()
3271
{
3272
$debug_cmd
3273
3274
case ,$2, in
3275
*,"$to_tool_file_cmd",*)
3276
func_to_tool_file_result=$1
3277
;;
3278
*)
3279
$to_tool_file_cmd "$1"
3280
func_to_tool_file_result=$func_to_host_file_result
3281
;;
3282
esac
3283
}
3284
# end func_to_tool_file
3285
3286
3287
# func_convert_file_noop ARG
3288
# Copy ARG to func_to_host_file_result.
3289
func_convert_file_noop ()
3290
{
3291
func_to_host_file_result=$1
3292
}
3293
# end func_convert_file_noop
3294
3295
3296
# func_convert_file_msys_to_w32 ARG
3297
# Convert file name ARG from (mingw) MSYS to (mingw) w32 format; automatic
3298
# conversion to w32 is not available inside the cwrapper. Returns result in
3299
# func_to_host_file_result.
3300
func_convert_file_msys_to_w32 ()
3301
{
3302
$debug_cmd
3303
3304
func_to_host_file_result=$1
3305
if test -n "$1"; then
3306
func_convert_core_msys_to_w32 "$1"
3307
func_to_host_file_result=$func_convert_core_msys_to_w32_result
3308
fi
3309
func_convert_file_check "$1" "$func_to_host_file_result"
3310
}
3311
# end func_convert_file_msys_to_w32
3312
3313
3314
# func_convert_file_cygwin_to_w32 ARG
3315
# Convert file name ARG from Cygwin to w32 format. Returns result in
3316
# func_to_host_file_result.
3317
func_convert_file_cygwin_to_w32 ()
3318
{
3319
$debug_cmd
3320
3321
func_to_host_file_result=$1
3322
if test -n "$1"; then
3323
# because $build is cygwin, we call "the" cygpath in $PATH; no need to use
3324
# LT_CYGPATH in this case.
3325
func_to_host_file_result=`cygpath -m "$1"`
3326
fi
3327
func_convert_file_check "$1" "$func_to_host_file_result"
3328
}
3329
# end func_convert_file_cygwin_to_w32
3330
3331
3332
# func_convert_file_nix_to_w32 ARG
3333
# Convert file name ARG from *nix to w32 format. Requires a wine environment
3334
# and a working winepath. Returns result in func_to_host_file_result.
3335
func_convert_file_nix_to_w32 ()
3336
{
3337
$debug_cmd
3338
3339
func_to_host_file_result=$1
3340
if test -n "$1"; then
3341
func_convert_core_file_wine_to_w32 "$1"
3342
func_to_host_file_result=$func_convert_core_file_wine_to_w32_result
3343
fi
3344
func_convert_file_check "$1" "$func_to_host_file_result"
3345
}
3346
# end func_convert_file_nix_to_w32
3347
3348
3349
# func_convert_file_msys_to_cygwin ARG
3350
# Convert file name ARG from MSYS to Cygwin format. Requires LT_CYGPATH set.
3351
# Returns result in func_to_host_file_result.
3352
func_convert_file_msys_to_cygwin ()
3353
{
3354
$debug_cmd
3355
3356
func_to_host_file_result=$1
3357
if test -n "$1"; then
3358
func_convert_core_msys_to_w32 "$1"
3359
func_cygpath -u "$func_convert_core_msys_to_w32_result"
3360
func_to_host_file_result=$func_cygpath_result
3361
fi
3362
func_convert_file_check "$1" "$func_to_host_file_result"
3363
}
3364
# end func_convert_file_msys_to_cygwin
3365
3366
3367
# func_convert_file_nix_to_cygwin ARG
3368
# Convert file name ARG from *nix to Cygwin format. Requires Cygwin installed
3369
# in a wine environment, working winepath, and LT_CYGPATH set. Returns result
3370
# in func_to_host_file_result.
3371
func_convert_file_nix_to_cygwin ()
3372
{
3373
$debug_cmd
3374
3375
func_to_host_file_result=$1
3376
if test -n "$1"; then
3377
# convert from *nix to w32, then use cygpath to convert from w32 to cygwin.
3378
func_convert_core_file_wine_to_w32 "$1"
3379
func_cygpath -u "$func_convert_core_file_wine_to_w32_result"
3380
func_to_host_file_result=$func_cygpath_result
3381
fi
3382
func_convert_file_check "$1" "$func_to_host_file_result"
3383
}
3384
# end func_convert_file_nix_to_cygwin
3385
3386
3387
#############################################
3388
# $build to $host PATH CONVERSION FUNCTIONS #
3389
#############################################
3390
# invoked via '$to_host_path_cmd ARG'
3391
#
3392
# In each case, ARG is the path to be converted from $build to $host format.
3393
# The result will be available in $func_to_host_path_result.
3394
#
3395
# Path separators are also converted from $build format to $host format. If
3396
# ARG begins or ends with a path separator character, it is preserved (but
3397
# converted to $host format) on output.
3398
#
3399
# All path conversion functions are named using the following convention:
3400
# file name conversion function : func_convert_file_X_to_Y ()
3401
# path conversion function : func_convert_path_X_to_Y ()
3402
# where, for any given $build/$host combination the 'X_to_Y' value is the
3403
# same. If conversion functions are added for new $build/$host combinations,
3404
# the two new functions must follow this pattern, or func_init_to_host_path_cmd
3405
# will break.
3406
3407
3408
# func_init_to_host_path_cmd
3409
# Ensures that function "pointer" variable $to_host_path_cmd is set to the
3410
# appropriate value, based on the value of $to_host_file_cmd.
3411
to_host_path_cmd=
3412
func_init_to_host_path_cmd ()
3413
{
3414
$debug_cmd
3415
3416
if test -z "$to_host_path_cmd"; then
3417
func_stripname 'func_convert_file_' '' "$to_host_file_cmd"
3418
to_host_path_cmd=func_convert_path_$func_stripname_result
3419
fi
3420
}
3421
3422
3423
# func_to_host_path ARG
3424
# Converts the path ARG from $build format to $host format. Return result
3425
# in func_to_host_path_result.
3426
func_to_host_path ()
3427
{
3428
$debug_cmd
3429
3430
func_init_to_host_path_cmd
3431
$to_host_path_cmd "$1"
3432
}
3433
# end func_to_host_path
3434
3435
3436
# func_convert_path_noop ARG
3437
# Copy ARG to func_to_host_path_result.
3438
func_convert_path_noop ()
3439
{
3440
func_to_host_path_result=$1
3441
}
3442
# end func_convert_path_noop
3443
3444
3445
# func_convert_path_msys_to_w32 ARG
3446
# Convert path ARG from (mingw) MSYS to (mingw) w32 format; automatic
3447
# conversion to w32 is not available inside the cwrapper. Returns result in
3448
# func_to_host_path_result.
3449
func_convert_path_msys_to_w32 ()
3450
{
3451
$debug_cmd
3452
3453
func_to_host_path_result=$1
3454
if test -n "$1"; then
3455
# Remove leading and trailing path separator characters from ARG. MSYS
3456
# behavior is inconsistent here; cygpath turns them into '.;' and ';.';
3457
# and winepath ignores them completely.
3458
func_stripname : : "$1"
3459
func_to_host_path_tmp1=$func_stripname_result
3460
func_convert_core_msys_to_w32 "$func_to_host_path_tmp1"
3461
func_to_host_path_result=$func_convert_core_msys_to_w32_result
3462
func_convert_path_check : ";" \
3463
"$func_to_host_path_tmp1" "$func_to_host_path_result"
3464
func_convert_path_front_back_pathsep ":*" "*:" ";" "$1"
3465
fi
3466
}
3467
# end func_convert_path_msys_to_w32
3468
3469
3470
# func_convert_path_cygwin_to_w32 ARG
3471
# Convert path ARG from Cygwin to w32 format. Returns result in
3472
# func_to_host_file_result.
3473
func_convert_path_cygwin_to_w32 ()
3474
{
3475
$debug_cmd
3476
3477
func_to_host_path_result=$1
3478
if test -n "$1"; then
3479
# See func_convert_path_msys_to_w32:
3480
func_stripname : : "$1"
3481
func_to_host_path_tmp1=$func_stripname_result
3482
func_to_host_path_result=`cygpath -m -p "$func_to_host_path_tmp1"`
3483
func_convert_path_check : ";" \
3484
"$func_to_host_path_tmp1" "$func_to_host_path_result"
3485
func_convert_path_front_back_pathsep ":*" "*:" ";" "$1"
3486
fi
3487
}
3488
# end func_convert_path_cygwin_to_w32
3489
3490
3491
# func_convert_path_nix_to_w32 ARG
3492
# Convert path ARG from *nix to w32 format. Requires a wine environment and
3493
# a working winepath. Returns result in func_to_host_file_result.
3494
func_convert_path_nix_to_w32 ()
3495
{
3496
$debug_cmd
3497
3498
func_to_host_path_result=$1
3499
if test -n "$1"; then
3500
# See func_convert_path_msys_to_w32:
3501
func_stripname : : "$1"
3502
func_to_host_path_tmp1=$func_stripname_result
3503
func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1"
3504
func_to_host_path_result=$func_convert_core_path_wine_to_w32_result
3505
func_convert_path_check : ";" \
3506
"$func_to_host_path_tmp1" "$func_to_host_path_result"
3507
func_convert_path_front_back_pathsep ":*" "*:" ";" "$1"
3508
fi
3509
}
3510
# end func_convert_path_nix_to_w32
3511
3512
3513
# func_convert_path_msys_to_cygwin ARG
3514
# Convert path ARG from MSYS to Cygwin format. Requires LT_CYGPATH set.
3515
# Returns result in func_to_host_file_result.
3516
func_convert_path_msys_to_cygwin ()
3517
{
3518
$debug_cmd
3519
3520
func_to_host_path_result=$1
3521
if test -n "$1"; then
3522
# See func_convert_path_msys_to_w32:
3523
func_stripname : : "$1"
3524
func_to_host_path_tmp1=$func_stripname_result
3525
func_convert_core_msys_to_w32 "$func_to_host_path_tmp1"
3526
func_cygpath -u -p "$func_convert_core_msys_to_w32_result"
3527
func_to_host_path_result=$func_cygpath_result
3528
func_convert_path_check : : \
3529
"$func_to_host_path_tmp1" "$func_to_host_path_result"
3530
func_convert_path_front_back_pathsep ":*" "*:" : "$1"
3531
fi
3532
}
3533
# end func_convert_path_msys_to_cygwin
3534
3535
3536
# func_convert_path_nix_to_cygwin ARG
3537
# Convert path ARG from *nix to Cygwin format. Requires Cygwin installed in a
3538
# a wine environment, working winepath, and LT_CYGPATH set. Returns result in
3539
# func_to_host_file_result.
3540
func_convert_path_nix_to_cygwin ()
3541
{
3542
$debug_cmd
3543
3544
func_to_host_path_result=$1
3545
if test -n "$1"; then
3546
# Remove leading and trailing path separator characters from
3547
# ARG. msys behavior is inconsistent here, cygpath turns them
3548
# into '.;' and ';.', and winepath ignores them completely.
3549
func_stripname : : "$1"
3550
func_to_host_path_tmp1=$func_stripname_result
3551
func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1"
3552
func_cygpath -u -p "$func_convert_core_path_wine_to_w32_result"
3553
func_to_host_path_result=$func_cygpath_result
3554
func_convert_path_check : : \
3555
"$func_to_host_path_tmp1" "$func_to_host_path_result"
3556
func_convert_path_front_back_pathsep ":*" "*:" : "$1"
3557
fi
3558
}
3559
# end func_convert_path_nix_to_cygwin
3560
3561
3562
# func_dll_def_p FILE
3563
# True iff FILE is a Windows DLL '.def' file.
3564
# Keep in sync with _LT_DLL_DEF_P in libtool.m4
3565
func_dll_def_p ()
3566
{
3567
$debug_cmd
3568
3569
func_dll_def_p_tmp=`$SED -n \
3570
-e 's/^[ ]*//' \
3571
-e '/^\(;.*\)*$/d' \
3572
-e 's/^\(EXPORTS\|LIBRARY\)\([ ].*\)*$/DEF/p' \
3573
-e q \
3574
"$1"`
3575
test DEF = "$func_dll_def_p_tmp"
3576
}
3577
3578
3579
# func_reorder_shared_lib_cache DIRS
3580
# Reorder the shared library cache by unconfiguring previous shared library cache
3581
# and configuring preferred search directories before previous search directories.
3582
# Previous shared library cache: /usr/lib /usr/local/lib
3583
# Preferred search directories: /tmp/testing
3584
# Reordered shared library cache: /tmp/testing /usr/lib /usr/local/lib
3585
func_reorder_shared_lib_cache ()
3586
{
3587
$debug_cmd
3588
3589
case $host_os in
3590
openbsd*)
3591
get_search_directories=`PATH="$PATH:/sbin" ldconfig -r | $GREP "search directories" | $SED "s#.*search directories:\ ##g"`
3592
func_convert_delimited_path "$get_search_directories" ':' '\ '
3593
save_search_directories=$converted_path
3594
func_convert_delimited_path "$1" ':' '\ '
3595
3596
# Ensure directories exist
3597
for dir in $converted_path; do
3598
# Ensure each directory is an absolute path
3599
case $dir in
3600
/*) ;;
3601
*) func_error "Directory '$dir' is not an absolute path"
3602
exit $EXIT_FAILURE ;;
3603
esac
3604
# Ensure no trailing slashes
3605
func_stripname '' '/' "$dir"
3606
dir=$func_stripname_result
3607
if test -d "$dir"; then
3608
if test -n "$preferred_search_directories"; then
3609
preferred_search_directories="$preferred_search_directories $dir"
3610
else
3611
preferred_search_directories=$dir
3612
fi
3613
else
3614
func_error "Directory '$dir' does not exist"
3615
exit $EXIT_FAILURE
3616
fi
3617
done
3618
3619
PATH="$PATH:/sbin" ldconfig -U $save_search_directories
3620
PATH="$PATH:/sbin" ldconfig -m $preferred_search_directories $save_search_directories
3621
get_search_directories=`PATH="$PATH:/sbin" ldconfig -r | $GREP "search directories" | $SED "s#.*search directories:\ ##g"`
3622
func_convert_delimited_path "$get_search_directories" ':' '\ '
3623
reordered_search_directories=$converted_path
3624
3625
$ECHO "Original: $save_search_directories"
3626
$ECHO "Reordered: $reordered_search_directories"
3627
exit $EXIT_SUCCESS
3628
;;
3629
*)
3630
func_error "--reorder-cache is not supported for host_os=$host_os."
3631
exit $EXIT_FAILURE
3632
;;
3633
esac
3634
}
3635
# end func_reorder_shared_lib_cache
3636
3637
3638
# func_mode_compile arg...
3639
func_mode_compile ()
3640
{
3641
$debug_cmd
3642
3643
# Get the compilation command and the source file.
3644
base_compile=
3645
srcfile=$nonopt # always keep a non-empty value in "srcfile"
3646
suppress_opt=yes
3647
suppress_output=
3648
arg_mode=normal
3649
libobj=
3650
later=
3651
pie_flag=
3652
3653
for arg
3654
do
3655
case $arg_mode in
3656
arg )
3657
# do not "continue". Instead, add this to base_compile
3658
lastarg=$arg
3659
arg_mode=normal
3660
;;
3661
3662
target )
3663
libobj=$arg
3664
arg_mode=normal
3665
continue
3666
;;
3667
3668
normal )
3669
# Accept any command-line options.
3670
case $arg in
3671
-o)
3672
test -n "$libobj" && \
3673
func_fatal_error "you cannot specify '-o' more than once"
3674
arg_mode=target
3675
continue
3676
;;
3677
3678
-pie | -fpie | -fPIE)
3679
func_append pie_flag " $arg"
3680
continue
3681
;;
3682
3683
-shared | -static | -prefer-pic | -prefer-non-pic)
3684
func_append later " $arg"
3685
continue
3686
;;
3687
3688
-no-suppress)
3689
suppress_opt=no
3690
continue
3691
;;
3692
3693
-Xcompiler)
3694
arg_mode=arg # the next one goes into the "base_compile" arg list
3695
continue # The current "srcfile" will either be retained or
3696
;; # replaced later. I would guess that would be a bug.
3697
3698
-Wc,*)
3699
func_stripname '-Wc,' '' "$arg"
3700
args=$func_stripname_result
3701
lastarg=
3702
save_ifs=$IFS; IFS=,
3703
for arg in $args; do
3704
IFS=$save_ifs
3705
func_append_quoted lastarg "$arg"
3706
done
3707
IFS=$save_ifs
3708
func_stripname ' ' '' "$lastarg"
3709
lastarg=$func_stripname_result
3710
3711
# Add the arguments to base_compile.
3712
func_append base_compile " $lastarg"
3713
continue
3714
;;
3715
3716
*)
3717
# Accept the current argument as the source file.
3718
# The previous "srcfile" becomes the current argument.
3719
#
3720
lastarg=$srcfile
3721
srcfile=$arg
3722
;;
3723
esac # case $arg
3724
;;
3725
esac # case $arg_mode
3726
3727
# Aesthetically quote the previous argument.
3728
func_append_quoted base_compile "$lastarg"
3729
done # for arg
3730
3731
case $arg_mode in
3732
arg)
3733
func_fatal_error "you must specify an argument for -Xcompile"
3734
;;
3735
target)
3736
func_fatal_error "you must specify a target with '-o'"
3737
;;
3738
*)
3739
# Get the name of the library object.
3740
test -z "$libobj" && {
3741
func_basename "$srcfile"
3742
libobj=$func_basename_result
3743
}
3744
;;
3745
esac
3746
3747
# Recognize several different file suffixes.
3748
# If the user specifies -o file.o, it is replaced with file.lo
3749
case $libobj in
3750
*.[cCFSifmso] | \
3751
*.ada | *.adb | *.ads | *.asm | \
3752
*.c++ | *.cc | *.ii | *.class | *.cpp | *.cxx | \
3753
*.[fF][09]? | *.for | *.java | *.go | *.obj | *.sx | *.cu | *.cup)
3754
func_xform "$libobj"
3755
libobj=$func_xform_result
3756
;;
3757
esac
3758
3759
case $libobj in
3760
*.lo) func_lo2o "$libobj"; obj=$func_lo2o_result ;;
3761
*)
3762
func_fatal_error "cannot determine name of library object from '$libobj'"
3763
;;
3764
esac
3765
3766
func_infer_tag $base_compile
3767
3768
for arg in $later; do
3769
case $arg in
3770
-shared)
3771
test yes = "$build_libtool_libs" \
3772
|| func_fatal_configuration "cannot build a shared library"
3773
build_old_libs=no
3774
continue
3775
;;
3776
3777
-static)
3778
build_libtool_libs=no
3779
build_old_libs=yes
3780
continue
3781
;;
3782
3783
-prefer-pic)
3784
pic_mode=yes
3785
continue
3786
;;
3787
3788
-prefer-non-pic)
3789
pic_mode=no
3790
continue
3791
;;
3792
esac
3793
done
3794
3795
func_quote_arg pretty "$libobj"
3796
test "X$libobj" != "X$func_quote_arg_result" \
3797
&& $ECHO "X$libobj" | $GREP '[]~#^*{};<>?"'"'"' &()|`$[]' \
3798
&& func_warning "libobj name '$libobj' may not contain shell special characters."
3799
func_dirname_and_basename "$obj" "/" ""
3800
objname=$func_basename_result
3801
xdir=$func_dirname_result
3802
lobj=$xdir$objdir/$objname
3803
3804
test -z "$base_compile" && \
3805
func_fatal_help "you must specify a compilation command"
3806
3807
# Delete any leftover library objects.
3808
if test yes = "$build_old_libs"; then
3809
removelist="$obj $lobj $libobj ${libobj}T"
3810
else
3811
removelist="$lobj $libobj ${libobj}T"
3812
fi
3813
3814
# On Cygwin there's no "real" PIC flag so we must build both object types
3815
case $host_os in
3816
cygwin* | mingw* | windows* | pw32* | os2* | cegcc*)
3817
pic_mode=default
3818
;;
3819
esac
3820
if test no = "$pic_mode" && test pass_all != "$deplibs_check_method"; then
3821
# non-PIC code in shared libraries is not supported
3822
pic_mode=default
3823
fi
3824
3825
# Calculate the filename of the output object if compiler does
3826
# not support -o with -c
3827
if test no = "$compiler_c_o"; then
3828
output_obj=`$ECHO "$srcfile" | $SED 's%^.*/%%; s%\.[^.]*$%%'`.$objext
3829
lockfile=$output_obj.lock
3830
else
3831
output_obj=
3832
need_locks=no
3833
lockfile=
3834
fi
3835
3836
# Lock this critical section if it is needed
3837
# We use this script file to make the link, it avoids creating a new file
3838
if test yes = "$need_locks"; then
3839
until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do
3840
func_echo "Waiting for $lockfile to be removed"
3841
sleep 2
3842
done
3843
elif test warn = "$need_locks"; then
3844
if test -f "$lockfile"; then
3845
$ECHO "\
3846
*** ERROR, $lockfile exists and contains:
3847
`cat $lockfile 2>/dev/null`
3848
3849
This indicates that another process is trying to use the same
3850
temporary object file, and libtool could not work around it because
3851
your compiler does not support '-c' and '-o' together. If you
3852
repeat this compilation, it may succeed, by chance, but you had better
3853
avoid parallel builds (make -j) in this platform, or get a better
3854
compiler."
3855
3856
$opt_dry_run || $RM $removelist
3857
exit $EXIT_FAILURE
3858
fi
3859
func_append removelist " $output_obj"
3860
$ECHO "$srcfile" > "$lockfile"
3861
fi
3862
3863
$opt_dry_run || $RM $removelist
3864
func_append removelist " $lockfile"
3865
trap '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' 1 2 15
3866
3867
func_to_tool_file "$srcfile" func_convert_file_msys_to_w32
3868
srcfile=$func_to_tool_file_result
3869
func_quote_arg pretty "$srcfile"
3870
qsrcfile=$func_quote_arg_result
3871
3872
# Only build a PIC object if we are building libtool libraries.
3873
if test yes = "$build_libtool_libs"; then
3874
# Without this assignment, base_compile gets emptied.
3875
fbsd_hideous_sh_bug=$base_compile
3876
3877
if test no != "$pic_mode"; then
3878
command="$base_compile $qsrcfile $pic_flag"
3879
else
3880
# Don't build PIC code
3881
command="$base_compile $qsrcfile"
3882
fi
3883
3884
func_mkdir_p "$xdir$objdir"
3885
3886
if test -z "$output_obj"; then
3887
# Place PIC objects in $objdir
3888
func_append command " -o $lobj"
3889
fi
3890
3891
func_show_eval_locale "$command" \
3892
'test -n "$output_obj" && $RM $removelist; exit $EXIT_FAILURE'
3893
3894
if test warn = "$need_locks" &&
3895
test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
3896
$ECHO "\
3897
*** ERROR, $lockfile contains:
3898
`cat $lockfile 2>/dev/null`
3899
3900
but it should contain:
3901
$srcfile
3902
3903
This indicates that another process is trying to use the same
3904
temporary object file, and libtool could not work around it because
3905
your compiler does not support '-c' and '-o' together. If you
3906
repeat this compilation, it may succeed, by chance, but you had better
3907
avoid parallel builds (make -j) in this platform, or get a better
3908
compiler."
3909
3910
$opt_dry_run || $RM $removelist
3911
exit $EXIT_FAILURE
3912
fi
3913
3914
# Just move the object if needed, then go on to compile the next one
3915
if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then
3916
func_show_eval '$MV "$output_obj" "$lobj"' \
3917
'error=$?; $opt_dry_run || $RM $removelist; exit $error'
3918
fi
3919
3920
# Allow error messages only from the first compilation.
3921
if test yes = "$suppress_opt"; then
3922
suppress_output=' >/dev/null 2>&1'
3923
fi
3924
fi
3925
3926
# Only build a position-dependent object if we build old libraries.
3927
if test yes = "$build_old_libs"; then
3928
if test yes != "$pic_mode"; then
3929
# Don't build PIC code
3930
command="$base_compile $qsrcfile$pie_flag"
3931
else
3932
command="$base_compile $qsrcfile $pic_flag"
3933
fi
3934
if test yes = "$compiler_c_o"; then
3935
func_append command " -o $obj"
3936
fi
3937
3938
# Suppress compiler output if we already did a PIC compilation.
3939
func_append command "$suppress_output"
3940
func_show_eval_locale "$command" \
3941
'$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE'
3942
3943
if test warn = "$need_locks" &&
3944
test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
3945
$ECHO "\
3946
*** ERROR, $lockfile contains:
3947
`cat $lockfile 2>/dev/null`
3948
3949
but it should contain:
3950
$srcfile
3951
3952
This indicates that another process is trying to use the same
3953
temporary object file, and libtool could not work around it because
3954
your compiler does not support '-c' and '-o' together. If you
3955
repeat this compilation, it may succeed, by chance, but you had better
3956
avoid parallel builds (make -j) in this platform, or get a better
3957
compiler."
3958
3959
$opt_dry_run || $RM $removelist
3960
exit $EXIT_FAILURE
3961
fi
3962
3963
# Just move the object if needed
3964
if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then
3965
func_show_eval '$MV "$output_obj" "$obj"' \
3966
'error=$?; $opt_dry_run || $RM $removelist; exit $error'
3967
fi
3968
fi
3969
3970
$opt_dry_run || {
3971
func_write_libtool_object "$libobj" "$objdir/$objname" "$objname"
3972
3973
# Unlock the critical section if it was locked
3974
if test no != "$need_locks"; then
3975
removelist=$lockfile
3976
$RM "$lockfile"
3977
fi
3978
}
3979
3980
exit $EXIT_SUCCESS
3981
}
3982
3983
$opt_help || {
3984
test compile = "$opt_mode" && func_mode_compile ${1+"$@"}
3985
}
3986
3987
func_mode_help ()
3988
{
3989
# We need to display help for each of the modes.
3990
case $opt_mode in
3991
"")
3992
# Generic help is extracted from the usage comments
3993
# at the start of this file.
3994
func_help
3995
;;
3996
3997
clean)
3998
$ECHO \
3999
"Usage: $progname [OPTION]... --mode=clean RM [RM-OPTION]... FILE...
4000
4001
Remove files from the build directory.
4002
4003
RM is the name of the program to use to delete files associated with each FILE
4004
(typically '/bin/rm'). RM-OPTIONS are options (such as '-f') to be passed
4005
to RM.
4006
4007
If FILE is a libtool library, object or program, all the files associated
4008
with it are deleted. Otherwise, only FILE itself is deleted using RM."
4009
;;
4010
4011
compile)
4012
$ECHO \
4013
"Usage: $progname [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE
4014
4015
Compile a source file into a libtool library object.
4016
4017
This mode accepts the following additional options:
4018
4019
-o OUTPUT-FILE set the output file name to OUTPUT-FILE
4020
-no-suppress do not suppress compiler output for multiple passes
4021
-prefer-pic try to build PIC objects only
4022
-prefer-non-pic try to build non-PIC objects only
4023
-shared do not build a '.o' file suitable for static linking
4024
-static only build a '.o' file suitable for static linking
4025
-Wc,FLAG
4026
-Xcompiler FLAG pass FLAG directly to the compiler
4027
4028
COMPILE-COMMAND is a command to be used in creating a 'standard' object file
4029
from the given SOURCEFILE.
4030
4031
The output file name is determined by removing the directory component from
4032
SOURCEFILE, then substituting the C source code suffix '.c' with the
4033
library object suffix, '.lo'."
4034
;;
4035
4036
execute)
4037
$ECHO \
4038
"Usage: $progname [OPTION]... --mode=execute COMMAND [ARGS]...
4039
4040
Automatically set library path, then run a program.
4041
4042
This mode accepts the following additional options:
4043
4044
-dlopen FILE add the directory containing FILE to the library path
4045
4046
This mode sets the library path environment variable according to '-dlopen'
4047
flags.
4048
4049
If any of the ARGS are libtool executable wrappers, then they are translated
4050
into their corresponding uninstalled binary, and any of their required library
4051
directories are added to the library path.
4052
4053
Then, COMMAND is executed, with ARGS as arguments."
4054
;;
4055
4056
finish)
4057
$ECHO \
4058
"Usage: $progname [OPTION]... --mode=finish [LIBDIR]...
4059
4060
Complete the installation of libtool libraries.
4061
4062
Each LIBDIR is a directory that contains libtool libraries.
4063
4064
The commands that this mode executes may require superuser privileges. Use
4065
the '--dry-run' option if you just want to see what would be executed."
4066
;;
4067
4068
install)
4069
$ECHO \
4070
"Usage: $progname [OPTION]... --mode=install INSTALL-COMMAND...
4071
4072
Install executables or libraries.
4073
4074
INSTALL-COMMAND is the installation command. The first component should be
4075
either the 'install' or 'cp' program.
4076
4077
The following components of INSTALL-COMMAND are treated specially:
4078
4079
-inst-prefix-dir PREFIX-DIR Use PREFIX-DIR as a staging area for installation
4080
4081
The rest of the components are interpreted as arguments to that command (only
4082
BSD-compatible install options are recognized)."
4083
;;
4084
4085
link)
4086
$ECHO \
4087
"Usage: $progname [OPTION]... --mode=link LINK-COMMAND...
4088
4089
Link object files or libraries together to form another library, or to
4090
create an executable program.
4091
4092
LINK-COMMAND is a command using the C compiler that you would use to create
4093
a program from several object files.
4094
4095
The following components of LINK-COMMAND are treated specially:
4096
4097
-all-static do not do any dynamic linking at all
4098
-avoid-version do not add a version suffix if possible
4099
-bindir BINDIR specify path to binaries directory (for systems where
4100
libraries must be found in the PATH setting at runtime)
4101
-dlopen FILE '-dlpreopen' FILE if it cannot be dlopened at runtime
4102
-dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols
4103
-export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
4104
-export-symbols SYMFILE
4105
try to export only the symbols listed in SYMFILE
4106
-export-symbols-regex REGEX
4107
try to export only the symbols matching REGEX
4108
-LLIBDIR search LIBDIR for required installed libraries
4109
-lNAME OUTPUT-FILE requires the installed library libNAME
4110
-module build a library that can dlopened
4111
-no-fast-install disable the fast-install mode
4112
-no-install link a not-installable executable
4113
-no-undefined declare that a library does not refer to external symbols
4114
-o OUTPUT-FILE create OUTPUT-FILE from the specified objects
4115
-objectlist FILE use a list of object files found in FILE to specify objects
4116
-os2dllname NAME force a short DLL name on OS/2 (no effect on other OSes)
4117
-precious-files-regex REGEX
4118
don't remove output files matching REGEX
4119
-release RELEASE specify package release information
4120
-rpath LIBDIR the created library will eventually be installed in LIBDIR
4121
-R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries
4122
-shared only do dynamic linking of libtool libraries
4123
-shrext SUFFIX override the standard shared library file extension
4124
-static do not do any dynamic linking of uninstalled libtool libraries
4125
-static-libtool-libs
4126
do not do any dynamic linking of libtool libraries
4127
-version-info CURRENT[:REVISION[:AGE]]
4128
specify library version info [each variable defaults to 0]
4129
-weak LIBNAME declare that the target provides the LIBNAME interface
4130
-Wc,FLAG
4131
-Xcompiler FLAG pass linker-specific FLAG directly to the compiler
4132
-Wa,FLAG
4133
-Xassembler FLAG pass linker-specific FLAG directly to the assembler
4134
-Wl,FLAG
4135
-Xlinker FLAG pass linker-specific FLAG directly to the linker
4136
-XCClinker FLAG pass link-specific FLAG to the compiler driver (CC)
4137
4138
All other options (arguments beginning with '-') are ignored.
4139
4140
Every other argument is treated as a filename. Files ending in '.la' are
4141
treated as uninstalled libtool libraries, other files are standard or library
4142
object files.
4143
4144
If the OUTPUT-FILE ends in '.la', then a libtool library is created,
4145
only library objects ('.lo' files) may be specified, and '-rpath' is
4146
required, except when creating a convenience library.
4147
4148
If OUTPUT-FILE ends in '.a' or '.lib', then a standard library is created
4149
using 'ar' and 'ranlib', or on Windows using 'lib'.
4150
4151
If OUTPUT-FILE ends in '.lo' or '.$objext', then a reloadable object file
4152
is created, otherwise an executable program is created."
4153
;;
4154
4155
uninstall)
4156
$ECHO \
4157
"Usage: $progname [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE...
4158
4159
Remove libraries from an installation directory.
4160
4161
RM is the name of the program to use to delete files associated with each FILE
4162
(typically '/bin/rm'). RM-OPTIONS are options (such as '-f') to be passed
4163
to RM.
4164
4165
If FILE is a libtool library, all the files associated with it are deleted.
4166
Otherwise, only FILE itself is deleted using RM."
4167
;;
4168
4169
*)
4170
func_fatal_help "invalid operation mode '$opt_mode'"
4171
;;
4172
esac
4173
4174
echo
4175
$ECHO "Try '$progname --help' for more information about other modes."
4176
}
4177
4178
# Now that we've collected a possible --mode arg, show help if necessary
4179
if $opt_help; then
4180
if test : = "$opt_help"; then
4181
func_mode_help
4182
else
4183
{
4184
func_help noexit
4185
for opt_mode in compile link execute install finish uninstall clean; do
4186
func_mode_help
4187
done
4188
} | $SED -n '1p; 2,$s/^Usage:/ or: /p'
4189
{
4190
func_help noexit
4191
for opt_mode in compile link execute install finish uninstall clean; do
4192
echo
4193
func_mode_help
4194
done
4195
} |
4196
$SED '1d
4197
/^When reporting/,/^Report/{
4198
H
4199
d
4200
}
4201
$x
4202
/information about other modes/d
4203
/more detailed .*MODE/d
4204
s/^Usage:.*--mode=\([^ ]*\) .*/Description of \1 mode:/'
4205
fi
4206
exit $?
4207
fi
4208
4209
4210
# If option '--reorder-cache', reorder the shared library cache and exit.
4211
if $opt_reorder_cache; then
4212
func_reorder_shared_lib_cache $shared_lib_dirs
4213
fi
4214
4215
4216
# func_mode_execute arg...
4217
func_mode_execute ()
4218
{
4219
$debug_cmd
4220
4221
# The first argument is the command name.
4222
cmd=$nonopt
4223
test -z "$cmd" && \
4224
func_fatal_help "you must specify a COMMAND"
4225
4226
# Handle -dlopen flags immediately.
4227
for file in $opt_dlopen; do
4228
test -f "$file" \
4229
|| func_fatal_help "'$file' is not a file"
4230
4231
dir=
4232
case $file in
4233
*.la)
4234
func_resolve_sysroot "$file"
4235
file=$func_resolve_sysroot_result
4236
4237
# Check to see that this really is a libtool archive.
4238
func_lalib_unsafe_p "$file" \
4239
|| func_fatal_help "'$lib' is not a valid libtool archive"
4240
4241
# Read the libtool library.
4242
dlname=
4243
library_names=
4244
func_source "$file"
4245
4246
# Skip this library if it cannot be dlopened.
4247
if test -z "$dlname"; then
4248
# Warn if it was a shared library.
4249
test -n "$library_names" && \
4250
func_warning "'$file' was not linked with '-export-dynamic'"
4251
continue
4252
fi
4253
4254
func_dirname "$file" "" "."
4255
dir=$func_dirname_result
4256
4257
if test -f "$dir/$objdir/$dlname"; then
4258
func_append dir "/$objdir"
4259
else
4260
if test ! -f "$dir/$dlname"; then
4261
func_fatal_error "cannot find '$dlname' in '$dir' or '$dir/$objdir'"
4262
fi
4263
fi
4264
;;
4265
4266
*.lo)
4267
# Just add the directory containing the .lo file.
4268
func_dirname "$file" "" "."
4269
dir=$func_dirname_result
4270
;;
4271
4272
*)
4273
func_warning "'-dlopen' is ignored for non-libtool libraries and objects"
4274
continue
4275
;;
4276
esac
4277
4278
# Get the absolute pathname.
4279
absdir=`cd "$dir" && pwd`
4280
test -n "$absdir" && dir=$absdir
4281
4282
# Now add the directory to shlibpath_var.
4283
if eval "test -z \"\$$shlibpath_var\""; then
4284
eval "$shlibpath_var=\"\$dir\""
4285
else
4286
eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\""
4287
fi
4288
done
4289
4290
# This variable tells wrapper scripts just to set shlibpath_var
4291
# rather than running their programs.
4292
libtool_execute_magic=$magic
4293
4294
# Check if any of the arguments is a wrapper script.
4295
args=
4296
for file
4297
do
4298
case $file in
4299
-* | *.la | *.lo ) ;;
4300
*)
4301
# Do a test to see if this is really a libtool program.
4302
if func_ltwrapper_script_p "$file"; then
4303
func_source "$file"
4304
# Transform arg to wrapped name.
4305
file=$progdir/$program
4306
elif func_ltwrapper_executable_p "$file"; then
4307
func_ltwrapper_scriptname "$file"
4308
func_source "$func_ltwrapper_scriptname_result"
4309
# Transform arg to wrapped name.
4310
file=$progdir/$program
4311
fi
4312
;;
4313
esac
4314
# Quote arguments (to preserve shell metacharacters).
4315
func_append_quoted args "$file"
4316
done
4317
4318
if $opt_dry_run; then
4319
# Display what would be done.
4320
if test -n "$shlibpath_var"; then
4321
eval "\$ECHO \"\$shlibpath_var=\$$shlibpath_var\""
4322
echo "export $shlibpath_var"
4323
fi
4324
$ECHO "$cmd$args"
4325
exit $EXIT_SUCCESS
4326
else
4327
if test -n "$shlibpath_var"; then
4328
# Export the shlibpath_var.
4329
eval "export $shlibpath_var"
4330
fi
4331
4332
# Restore saved environment variables
4333
for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
4334
do
4335
eval "if test \"\${save_$lt_var+set}\" = set; then
4336
$lt_var=\$save_$lt_var; export $lt_var
4337
else
4338
$lt_unset $lt_var
4339
fi"
4340
done
4341
4342
# Now prepare to actually exec the command.
4343
exec_cmd=\$cmd$args
4344
fi
4345
}
4346
4347
test execute = "$opt_mode" && func_mode_execute ${1+"$@"}
4348
4349
4350
# func_mode_finish arg...
4351
func_mode_finish ()
4352
{
4353
$debug_cmd
4354
4355
libs=
4356
libdirs=
4357
admincmds=
4358
4359
for opt in "$nonopt" ${1+"$@"}
4360
do
4361
if test -d "$opt"; then
4362
func_append libdirs " $opt"
4363
4364
elif test -f "$opt"; then
4365
if func_lalib_unsafe_p "$opt"; then
4366
func_append libs " $opt"
4367
else
4368
func_warning "'$opt' is not a valid libtool archive"
4369
fi
4370
4371
else
4372
func_fatal_error "invalid argument '$opt'"
4373
fi
4374
done
4375
4376
if test -n "$libs"; then
4377
if test -n "$lt_sysroot"; then
4378
sysroot_regex=`$ECHO "$lt_sysroot" | $SED "$sed_make_literal_regex"`
4379
sysroot_cmd="s/\([ ']\)$sysroot_regex/\1/g;"
4380
else
4381
sysroot_cmd=
4382
fi
4383
4384
# Remove sysroot references
4385
if $opt_dry_run; then
4386
for lib in $libs; do
4387
echo "removing references to $lt_sysroot and '=' prefixes from $lib"
4388
done
4389
else
4390
tmpdir=`func_mktempdir`
4391
for lib in $libs; do
4392
$SED -e "$sysroot_cmd s/\([ ']-[LR]\)=/\1/g; s/\([ ']\)=/\1/g" $lib \
4393
> $tmpdir/tmp-la
4394
mv -f $tmpdir/tmp-la $lib
4395
done
4396
${RM}r "$tmpdir"
4397
fi
4398
fi
4399
4400
if test -n "$finish_cmds$finish_eval" && test -n "$libdirs" && $opt_finishing; then
4401
for libdir in $libdirs; do
4402
if test -n "$finish_cmds"; then
4403
# Do each command in the finish commands.
4404
func_execute_cmds "$finish_cmds" 'admincmds="$admincmds
4405
'"$cmd"'"'
4406
fi
4407
if test -n "$finish_eval"; then
4408
# Do the single finish_eval.
4409
eval cmds=\"$finish_eval\"
4410
$opt_dry_run || eval "$cmds" || func_append admincmds "
4411
$cmds"
4412
fi
4413
done
4414
fi
4415
4416
# Exit here if they wanted silent mode.
4417
$opt_quiet && exit $EXIT_SUCCESS
4418
4419
if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
4420
echo "----------------------------------------------------------------------"
4421
echo "Libraries have been installed in:"
4422
for libdir in $libdirs; do
4423
$ECHO " $libdir"
4424
done
4425
if test "false" = "$opt_finishing"; then
4426
echo
4427
echo "NOTE: finish_cmds were not executed during testing, so you must"
4428
echo "manually run ldconfig to add a given test directory, LIBDIR, to"
4429
echo "the search path for generated executables."
4430
fi
4431
echo
4432
echo "If you ever happen to want to link against installed libraries"
4433
echo "in a given directory, LIBDIR, you must either use libtool, and"
4434
echo "specify the full pathname of the library, or use the '-LLIBDIR'"
4435
echo "flag during linking and do at least one of the following:"
4436
if test -n "$shlibpath_var"; then
4437
echo " - add LIBDIR to the '$shlibpath_var' environment variable"
4438
echo " during execution"
4439
fi
4440
if test -n "$runpath_var"; then
4441
echo " - add LIBDIR to the '$runpath_var' environment variable"
4442
echo " during linking"
4443
fi
4444
if test -n "$hardcode_libdir_flag_spec"; then
4445
libdir=LIBDIR
4446
eval flag=\"$hardcode_libdir_flag_spec\"
4447
4448
$ECHO " - use the '$flag' linker flag"
4449
fi
4450
if test -n "$admincmds"; then
4451
$ECHO " - have your system administrator run these commands:$admincmds"
4452
fi
4453
if test -f /etc/ld.so.conf; then
4454
echo " - have your system administrator add LIBDIR to '/etc/ld.so.conf'"
4455
fi
4456
echo
4457
4458
echo "See any operating system documentation about shared libraries for"
4459
case $host in
4460
solaris2.[6789]|solaris2.1[0-9])
4461
echo "more information, such as the ld(1), crle(1) and ld.so(8) manual"
4462
echo "pages."
4463
;;
4464
*)
4465
echo "more information, such as the ld(1) and ld.so(8) manual pages."
4466
;;
4467
esac
4468
echo "----------------------------------------------------------------------"
4469
fi
4470
exit $EXIT_SUCCESS
4471
}
4472
4473
test finish = "$opt_mode" && func_mode_finish ${1+"$@"}
4474
4475
4476
# func_mode_install arg...
4477
func_mode_install ()
4478
{
4479
$debug_cmd
4480
4481
# There may be an optional sh(1) argument at the beginning of
4482
# install_prog (especially on Windows NT).
4483
if test "$SHELL" = "$nonopt" || test /bin/sh = "$nonopt" ||
4484
# Allow the use of GNU shtool's install command.
4485
case $nonopt in *shtool*) :;; *) false;; esac
4486
then
4487
# Aesthetically quote it.
4488
func_quote_arg pretty "$nonopt"
4489
install_prog="$func_quote_arg_result "
4490
arg=$1
4491
shift
4492
else
4493
install_prog=
4494
arg=$nonopt
4495
fi
4496
4497
# The real first argument should be the name of the installation program.
4498
# Aesthetically quote it.
4499
func_quote_arg pretty "$arg"
4500
func_append install_prog "$func_quote_arg_result"
4501
install_shared_prog=$install_prog
4502
case " $install_prog " in
4503
*[\\\ /]cp\ *) install_cp=: ;;
4504
*) install_cp=false ;;
4505
esac
4506
4507
# We need to accept at least all the BSD install flags.
4508
dest=
4509
files=
4510
opts=
4511
prev=
4512
install_type=
4513
isdir=false
4514
stripme=
4515
no_mode=:
4516
for arg
4517
do
4518
arg2=
4519
if test -n "$dest"; then
4520
func_append files " $dest"
4521
dest=$arg
4522
continue
4523
fi
4524
4525
case $arg in
4526
-d) isdir=: ;;
4527
-f)
4528
if $install_cp; then :; else
4529
prev=$arg
4530
fi
4531
;;
4532
-g | -m | -o)
4533
prev=$arg
4534
;;
4535
-s)
4536
stripme=" -s"
4537
continue
4538
;;
4539
-*)
4540
;;
4541
*)
4542
# If the previous option needed an argument, then skip it.
4543
if test -n "$prev"; then
4544
if test X-m = "X$prev" && test -n "$install_override_mode"; then
4545
arg2=$install_override_mode
4546
no_mode=false
4547
fi
4548
prev=
4549
else
4550
dest=$arg
4551
continue
4552
fi
4553
;;
4554
esac
4555
4556
# Aesthetically quote the argument.
4557
func_quote_arg pretty "$arg"
4558
func_append install_prog " $func_quote_arg_result"
4559
if test -n "$arg2"; then
4560
func_quote_arg pretty "$arg2"
4561
fi
4562
func_append install_shared_prog " $func_quote_arg_result"
4563
done
4564
4565
test -z "$install_prog" && \
4566
func_fatal_help "you must specify an install program"
4567
4568
test -n "$prev" && \
4569
func_fatal_help "the '$prev' option requires an argument"
4570
4571
if test -n "$install_override_mode" && $no_mode; then
4572
if $install_cp; then :; else
4573
func_quote_arg pretty "$install_override_mode"
4574
func_append install_shared_prog " -m $func_quote_arg_result"
4575
fi
4576
fi
4577
4578
if test -z "$files"; then
4579
if test -z "$dest"; then
4580
func_fatal_help "no file or destination specified"
4581
else
4582
func_fatal_help "you must specify a destination"
4583
fi
4584
fi
4585
4586
# Strip any trailing slash from the destination.
4587
func_stripname '' '/' "$dest"
4588
dest=$func_stripname_result
4589
4590
# Check to see that the destination is a directory.
4591
test -d "$dest" && isdir=:
4592
if $isdir; then
4593
destdir=$dest
4594
destname=
4595
else
4596
func_dirname_and_basename "$dest" "" "."
4597
destdir=$func_dirname_result
4598
destname=$func_basename_result
4599
4600
# Not a directory, so check to see that there is only one file specified.
4601
set dummy $files; shift
4602
test "$#" -gt 1 && \
4603
func_fatal_help "'$dest' is not a directory"
4604
fi
4605
case $destdir in
4606
[\\/]* | [A-Za-z]:[\\/]*) ;;
4607
*)
4608
for file in $files; do
4609
case $file in
4610
*.lo) ;;
4611
*)
4612
func_fatal_help "'$destdir' must be an absolute directory name"
4613
;;
4614
esac
4615
done
4616
;;
4617
esac
4618
4619
# This variable tells wrapper scripts just to set variables rather
4620
# than running their programs.
4621
libtool_install_magic=$magic
4622
4623
staticlibs=
4624
future_libdirs=
4625
current_libdirs=
4626
for file in $files; do
4627
4628
# Do each installation.
4629
case $file in
4630
*.$libext)
4631
# Do the static libraries later.
4632
func_append staticlibs " $file"
4633
;;
4634
4635
*.la)
4636
func_resolve_sysroot "$file"
4637
file=$func_resolve_sysroot_result
4638
4639
# Check to see that this really is a libtool archive.
4640
func_lalib_unsafe_p "$file" \
4641
|| func_fatal_help "'$file' is not a valid libtool archive"
4642
4643
library_names=
4644
old_library=
4645
relink_command=
4646
func_source "$file"
4647
4648
# Add the libdir to current_libdirs if it is the destination.
4649
if test "X$destdir" = "X$libdir"; then
4650
case "$current_libdirs " in
4651
*" $libdir "*) ;;
4652
*) func_append current_libdirs " $libdir" ;;
4653
esac
4654
else
4655
# Note the libdir as a future libdir.
4656
case "$future_libdirs " in
4657
*" $libdir "*) ;;
4658
*) func_append future_libdirs " $libdir" ;;
4659
esac
4660
fi
4661
4662
func_dirname "$file" "/" ""
4663
dir=$func_dirname_result
4664
func_append dir "$objdir"
4665
4666
if test -n "$relink_command"; then
4667
# Strip any trailing slash from the destination.
4668
func_stripname '' '/' "$libdir"
4669
destlibdir=$func_stripname_result
4670
4671
func_stripname '' '/' "$destdir"
4672
s_destdir=$func_stripname_result
4673
4674
# Determine the prefix the user has applied to our future dir.
4675
inst_prefix_dir=`$ECHO "X$s_destdir" | $Xsed -e "s%$destlibdir\$%%"`
4676
4677
# Don't allow the user to place us outside of our expected
4678
# location b/c this prevents finding dependent libraries that
4679
# are installed to the same prefix.
4680
# At present, this check doesn't affect windows .dll's that
4681
# are installed into $libdir/../bin (currently, that works fine)
4682
# but it's something to keep an eye on.
4683
test "$inst_prefix_dir" = "$destdir" && \
4684
func_fatal_error "error: cannot install '$file' to a directory not ending in $libdir"
4685
4686
if test -n "$inst_prefix_dir"; then
4687
# Stick the inst_prefix_dir data into the link command.
4688
relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"`
4689
else
4690
relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%%"`
4691
fi
4692
4693
func_warning "relinking '$file'"
4694
func_show_eval "$relink_command" \
4695
'func_fatal_error "error: relink '\''$file'\'' with the above command before installing it"'
4696
fi
4697
4698
# See the names of the shared library.
4699
set dummy $library_names; shift
4700
if test -n "$1"; then
4701
realname=$1
4702
shift
4703
4704
srcname=$realname
4705
test -n "$relink_command" && srcname=${realname}T
4706
4707
# Install the shared library and build the symlinks.
4708
func_show_eval "$install_shared_prog $dir/$srcname $destdir/$realname" \
4709
'exit $?'
4710
tstripme=$stripme
4711
case $host_os in
4712
cygwin* | mingw* | windows* | pw32* | cegcc*)
4713
case $realname in
4714
*.dll.a)
4715
tstripme=
4716
;;
4717
esac
4718
;;
4719
os2*)
4720
case $realname in
4721
*_dll.a)
4722
tstripme=
4723
;;
4724
esac
4725
;;
4726
esac
4727
if test -n "$tstripme" && test -n "$striplib"; then
4728
func_show_eval "$striplib $destdir/$realname" 'exit $?'
4729
fi
4730
4731
if test "$#" -gt 0; then
4732
# Delete the old symlinks, and create new ones.
4733
# Try 'ln -sf' first, because the 'ln' binary might depend on
4734
# the symlink we replace! Solaris /bin/ln does not understand -f,
4735
# so we also need to try rm && ln -s.
4736
for linkname
4737
do
4738
test "$linkname" != "$realname" \
4739
&& func_show_eval "(cd $destdir && { $LN_S -f $realname $linkname || { $RM $linkname && $LN_S $realname $linkname; }; })"
4740
done
4741
fi
4742
4743
# Do each command in the postinstall commands.
4744
lib=$destdir/$realname
4745
func_execute_cmds "$postinstall_cmds" 'exit $?'
4746
fi
4747
4748
# Install the pseudo-library for information purposes.
4749
func_basename "$file"
4750
name=$func_basename_result
4751
instname=$dir/${name}i
4752
func_show_eval "$install_prog $instname $destdir/$name" 'exit $?'
4753
4754
# Maybe install the static library, too.
4755
test -n "$old_library" && func_append staticlibs " $dir/$old_library"
4756
;;
4757
4758
*.lo)
4759
# Install (i.e. copy) a libtool object.
4760
4761
# Figure out destination file name, if it wasn't already specified.
4762
if test -n "$destname"; then
4763
destfile=$destdir/$destname
4764
else
4765
func_basename "$file"
4766
destfile=$func_basename_result
4767
destfile=$destdir/$destfile
4768
fi
4769
4770
# Deduce the name of the destination old-style object file.
4771
case $destfile in
4772
*.lo)
4773
func_lo2o "$destfile"
4774
staticdest=$func_lo2o_result
4775
;;
4776
*.$objext)
4777
staticdest=$destfile
4778
destfile=
4779
;;
4780
*)
4781
func_fatal_help "cannot copy a libtool object to '$destfile'"
4782
;;
4783
esac
4784
4785
# Install the libtool object if requested.
4786
test -n "$destfile" && \
4787
func_show_eval "$install_prog $file $destfile" 'exit $?'
4788
4789
# Install the old object if enabled.
4790
if test yes = "$build_old_libs"; then
4791
# Deduce the name of the old-style object file.
4792
func_lo2o "$file"
4793
staticobj=$func_lo2o_result
4794
func_show_eval "$install_prog \$staticobj \$staticdest" 'exit $?'
4795
fi
4796
exit $EXIT_SUCCESS
4797
;;
4798
4799
*)
4800
# Figure out destination file name, if it wasn't already specified.
4801
if test -n "$destname"; then
4802
destfile=$destdir/$destname
4803
else
4804
func_basename "$file"
4805
destfile=$func_basename_result
4806
destfile=$destdir/$destfile
4807
fi
4808
4809
# If the file is missing, and there is a .exe on the end, strip it
4810
# because it is most likely a libtool script we actually want to
4811
# install
4812
stripped_ext=
4813
case $file in
4814
*.exe)
4815
if test ! -f "$file"; then
4816
func_stripname '' '.exe' "$file"
4817
file=$func_stripname_result
4818
stripped_ext=.exe
4819
fi
4820
;;
4821
esac
4822
4823
# Do a test to see if this is really a libtool program.
4824
case $host in
4825
*cygwin* | *mingw* | *windows*)
4826
if func_ltwrapper_executable_p "$file"; then
4827
func_ltwrapper_scriptname "$file"
4828
wrapper=$func_ltwrapper_scriptname_result
4829
else
4830
func_stripname '' '.exe' "$file"
4831
wrapper=$func_stripname_result
4832
fi
4833
;;
4834
*)
4835
wrapper=$file
4836
;;
4837
esac
4838
if func_ltwrapper_script_p "$wrapper"; then
4839
notinst_deplibs=
4840
relink_command=
4841
4842
func_source "$wrapper"
4843
4844
# Check the variables that should have been set.
4845
test -z "$generated_by_libtool_version" && \
4846
func_fatal_error "invalid libtool wrapper script '$wrapper'"
4847
4848
finalize=:
4849
for lib in $notinst_deplibs; do
4850
# Check to see that each library is installed.
4851
libdir=
4852
if test -f "$lib"; then
4853
func_source "$lib"
4854
fi
4855
libfile=$libdir/`$ECHO "$lib" | $SED 's%^.*/%%g'`
4856
if test -n "$libdir" && test ! -f "$libfile"; then
4857
func_warning "'$lib' has not been installed in '$libdir'"
4858
finalize=false
4859
fi
4860
done
4861
4862
relink_command=
4863
func_source "$wrapper"
4864
4865
outputname=
4866
if test no = "$fast_install" && test -n "$relink_command"; then
4867
$opt_dry_run || {
4868
if $finalize; then
4869
tmpdir=`func_mktempdir`
4870
func_basename "$file$stripped_ext"
4871
file=$func_basename_result
4872
outputname=$tmpdir/$file
4873
# Replace the output file specification.
4874
relink_command=`$ECHO "$relink_command" | $SED 's%@OUTPUT@%'"$outputname"'%g'`
4875
4876
$opt_quiet || {
4877
func_quote_arg expand,pretty "$relink_command"
4878
eval "func_echo $func_quote_arg_result"
4879
}
4880
if eval "$relink_command"; then :
4881
else
4882
func_error "error: relink '$file' with the above command before installing it"
4883
$opt_dry_run || ${RM}r "$tmpdir"
4884
continue
4885
fi
4886
file=$outputname
4887
else
4888
func_warning "cannot relink '$file'"
4889
fi
4890
}
4891
else
4892
# Install the binary that we compiled earlier.
4893
file=`$ECHO "$file$stripped_ext" | $SED "s%\([^/]*\)$%$objdir/\1%"`
4894
fi
4895
fi
4896
4897
# remove .exe since cygwin /usr/bin/install will append another
4898
# one anyway
4899
case $install_prog,$host in
4900
*/usr/bin/install*,*cygwin*)
4901
case $file:$destfile in
4902
*.exe:*.exe)
4903
# this is ok
4904
;;
4905
*.exe:*)
4906
destfile=$destfile.exe
4907
;;
4908
*:*.exe)
4909
func_stripname '' '.exe' "$destfile"
4910
destfile=$func_stripname_result
4911
;;
4912
esac
4913
;;
4914
esac
4915
func_show_eval "$install_prog\$stripme \$file \$destfile" 'exit $?'
4916
$opt_dry_run || if test -n "$outputname"; then
4917
${RM}r "$tmpdir"
4918
fi
4919
;;
4920
esac
4921
done
4922
4923
for file in $staticlibs; do
4924
func_basename "$file"
4925
name=$func_basename_result
4926
4927
# Set up the ranlib parameters.
4928
oldlib=$destdir/$name
4929
func_to_tool_file "$oldlib" func_convert_file_msys_to_w32
4930
tool_oldlib=$func_to_tool_file_result
4931
4932
func_show_eval "$install_prog \$file \$oldlib" 'exit $?'
4933
4934
if test -n "$stripme" && test -n "$old_striplib"; then
4935
func_show_eval "$old_striplib $tool_oldlib" 'exit $?'
4936
fi
4937
4938
# Do each command in the postinstall commands.
4939
func_execute_cmds "$old_postinstall_cmds" 'exit $?'
4940
done
4941
4942
test -n "$future_libdirs" && \
4943
func_warning "remember to run '$progname --finish$future_libdirs'"
4944
4945
if test -n "$current_libdirs"; then
4946
# Maybe just do a dry run.
4947
$opt_dry_run && current_libdirs=" -n$current_libdirs"
4948
exec_cmd='$SHELL "$progpath" $preserve_args --finish$current_libdirs'
4949
else
4950
exit $EXIT_SUCCESS
4951
fi
4952
}
4953
4954
test install = "$opt_mode" && func_mode_install ${1+"$@"}
4955
4956
4957
# func_generate_dlsyms outputname originator pic_p
4958
# Extract symbols from dlprefiles and create ${outputname}S.o with
4959
# a dlpreopen symbol table.
4960
func_generate_dlsyms ()
4961
{
4962
$debug_cmd
4963
4964
my_outputname=$1
4965
my_originator=$2
4966
my_pic_p=${3-false}
4967
my_prefix=`$ECHO "$my_originator" | $SED 's%[^a-zA-Z0-9]%_%g'`
4968
my_dlsyms=
4969
4970
if test -n "$dlfiles$dlprefiles" || test no != "$dlself"; then
4971
if test -n "$NM" && test -n "$global_symbol_pipe"; then
4972
my_dlsyms=${my_outputname}S.c
4973
else
4974
func_error "not configured to extract global symbols from dlpreopened files"
4975
fi
4976
fi
4977
4978
if test -n "$my_dlsyms"; then
4979
case $my_dlsyms in
4980
"") ;;
4981
*.c)
4982
# Discover the nlist of each of the dlfiles.
4983
nlist=$output_objdir/$my_outputname.nm
4984
4985
func_show_eval "$RM $nlist ${nlist}S ${nlist}T"
4986
4987
# Parse the name list into a source file.
4988
func_verbose "creating $output_objdir/$my_dlsyms"
4989
4990
$opt_dry_run || $ECHO > "$output_objdir/$my_dlsyms" "\
4991
/* $my_dlsyms - symbol resolution table for '$my_outputname' dlsym emulation. */
4992
/* Generated by $PROGRAM (GNU $PACKAGE) $VERSION */
4993
4994
#ifdef __cplusplus
4995
extern \"C\" {
4996
#endif
4997
4998
#if defined __GNUC__ && (((__GNUC__ == 4) && (__GNUC_MINOR__ >= 4)) || (__GNUC__ > 4))
4999
#pragma GCC diagnostic ignored \"-Wstrict-prototypes\"
5000
#endif
5001
5002
/* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */
5003
#if defined _WIN32 || defined __CYGWIN__ || defined _WIN32_WCE
5004
/* DATA imports from DLLs on WIN32 can't be const, because runtime
5005
relocations are performed -- see ld's documentation on pseudo-relocs. */
5006
# define LT_DLSYM_CONST
5007
#elif defined __osf__
5008
/* This system does not cope well with relocations in const data. */
5009
# define LT_DLSYM_CONST
5010
#else
5011
# define LT_DLSYM_CONST const
5012
#endif
5013
5014
#define STREQ(s1, s2) (strcmp ((s1), (s2)) == 0)
5015
5016
/* External symbol declarations for the compiler. */\
5017
"
5018
5019
if test yes = "$dlself"; then
5020
func_verbose "generating symbol list for '$output'"
5021
5022
$opt_dry_run || echo ': @PROGRAM@ ' > "$nlist"
5023
5024
# Add our own program objects to the symbol list.
5025
progfiles=`$ECHO "$objs$old_deplibs" | $SP2NL | $SED "$lo2o" | $NL2SP`
5026
for progfile in $progfiles; do
5027
func_to_tool_file "$progfile" func_convert_file_msys_to_w32
5028
func_verbose "extracting global C symbols from '$func_to_tool_file_result'"
5029
$opt_dry_run || eval "$NM $func_to_tool_file_result | $global_symbol_pipe >> '$nlist'"
5030
done
5031
5032
if test -n "$exclude_expsyms"; then
5033
$opt_dry_run || {
5034
eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
5035
eval '$MV "$nlist"T "$nlist"'
5036
}
5037
fi
5038
5039
if test -n "$export_symbols_regex"; then
5040
$opt_dry_run || {
5041
eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T'
5042
eval '$MV "$nlist"T "$nlist"'
5043
}
5044
fi
5045
5046
# Prepare the list of exported symbols
5047
if test -z "$export_symbols"; then
5048
export_symbols=$output_objdir/$outputname.exp
5049
$opt_dry_run || {
5050
$RM $export_symbols
5051
eval "$SED -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
5052
case $host in
5053
*cygwin* | *mingw* | *windows* | *cegcc* )
5054
eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
5055
eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"'
5056
;;
5057
esac
5058
}
5059
else
5060
$opt_dry_run || {
5061
eval "$SED -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"'
5062
eval '$GREP -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T'
5063
eval '$MV "$nlist"T "$nlist"'
5064
case $host in
5065
*cygwin* | *mingw* | *windows* | *cegcc* )
5066
eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
5067
eval 'cat "$nlist" >> "$output_objdir/$outputname.def"'
5068
;;
5069
esac
5070
}
5071
fi
5072
fi
5073
5074
for dlprefile in $dlprefiles; do
5075
func_verbose "extracting global C symbols from '$dlprefile'"
5076
func_basename "$dlprefile"
5077
name=$func_basename_result
5078
case $host in
5079
*cygwin* | *mingw* | *windows* | *cegcc* )
5080
# if an import library, we need to obtain dlname
5081
if func_win32_import_lib_p "$dlprefile"; then
5082
func_tr_sh "$dlprefile"
5083
eval "curr_lafile=\$libfile_$func_tr_sh_result"
5084
dlprefile_dlbasename=
5085
if test -n "$curr_lafile" && func_lalib_p "$curr_lafile"; then
5086
# Use subshell, to avoid clobbering current variable values
5087
dlprefile_dlname=`source "$curr_lafile" && echo "$dlname"`
5088
if test -n "$dlprefile_dlname"; then
5089
func_basename "$dlprefile_dlname"
5090
dlprefile_dlbasename=$func_basename_result
5091
else
5092
# no lafile. user explicitly requested -dlpreopen <import library>.
5093
$sharedlib_from_linklib_cmd "$dlprefile"
5094
dlprefile_dlbasename=$sharedlib_from_linklib_result
5095
fi
5096
fi
5097
$opt_dry_run || {
5098
if test -n "$dlprefile_dlbasename"; then
5099
eval '$ECHO ": $dlprefile_dlbasename" >> "$nlist"'
5100
else
5101
func_warning "Could not compute DLL name from $name"
5102
eval '$ECHO ": $name " >> "$nlist"'
5103
fi
5104
func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32
5105
case $host in
5106
i[3456]86-*-mingw32*)
5107
eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe |
5108
$SED -e '/I __imp/d' -e 's/I __nm_/D /;s/_nm__//' >> '$nlist'"
5109
;;
5110
*)
5111
eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe |
5112
$SED -e '/I __imp/d' -e 's/I __nm_/D /;s/__nm_//' >> '$nlist'"
5113
;;
5114
esac
5115
}
5116
else # not an import lib
5117
$opt_dry_run || {
5118
eval '$ECHO ": $name " >> "$nlist"'
5119
func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32
5120
eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'"
5121
}
5122
fi
5123
;;
5124
*)
5125
$opt_dry_run || {
5126
eval '$ECHO ": $name " >> "$nlist"'
5127
func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32
5128
eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'"
5129
}
5130
;;
5131
esac
5132
done
5133
5134
$opt_dry_run || {
5135
# Make sure we have at least an empty file.
5136
test -f "$nlist" || : > "$nlist"
5137
5138
if test -n "$exclude_expsyms"; then
5139
$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T
5140
$MV "$nlist"T "$nlist"
5141
fi
5142
5143
# Try sorting and uniquifying the output.
5144
if $GREP -v "^: " < "$nlist" |
5145
if sort -k 3 </dev/null >/dev/null 2>&1; then
5146
sort -k 3
5147
else
5148
sort +2
5149
fi |
5150
uniq > "$nlist"S; then
5151
:
5152
else
5153
$GREP -v "^: " < "$nlist" > "$nlist"S
5154
fi
5155
5156
if test -f "$nlist"S; then
5157
eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$my_dlsyms"'
5158
else
5159
echo '/* NONE */' >> "$output_objdir/$my_dlsyms"
5160
fi
5161
5162
func_show_eval '$RM "${nlist}I"'
5163
if test -n "$global_symbol_to_import"; then
5164
eval "$global_symbol_to_import"' < "$nlist"S > "$nlist"I'
5165
fi
5166
5167
echo >> "$output_objdir/$my_dlsyms" "\
5168
5169
/* The mapping between symbol names and symbols. */
5170
typedef struct {
5171
const char *name;
5172
void *address;
5173
} lt_dlsymlist;
5174
extern LT_DLSYM_CONST lt_dlsymlist
5175
lt_${my_prefix}_LTX_preloaded_symbols[];\
5176
"
5177
5178
if test -s "$nlist"I; then
5179
echo >> "$output_objdir/$my_dlsyms" "\
5180
static void lt_syminit(void)
5181
{
5182
LT_DLSYM_CONST lt_dlsymlist *symbol = lt_${my_prefix}_LTX_preloaded_symbols;
5183
for (; symbol->name; ++symbol)
5184
{"
5185
$SED 's/.*/ if (STREQ (symbol->name, \"&\")) symbol->address = (void *) \&&;/' < "$nlist"I >> "$output_objdir/$my_dlsyms"
5186
echo >> "$output_objdir/$my_dlsyms" "\
5187
}
5188
}"
5189
fi
5190
echo >> "$output_objdir/$my_dlsyms" "\
5191
LT_DLSYM_CONST lt_dlsymlist
5192
lt_${my_prefix}_LTX_preloaded_symbols[] =
5193
{ {\"$my_originator\", (void *) 0},"
5194
5195
if test -s "$nlist"I; then
5196
echo >> "$output_objdir/$my_dlsyms" "\
5197
{\"@INIT@\", (void *) &lt_syminit},"
5198
fi
5199
5200
case $need_lib_prefix in
5201
no)
5202
eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$my_dlsyms"
5203
;;
5204
*)
5205
eval "$global_symbol_to_c_name_address_lib_prefix" < "$nlist" >> "$output_objdir/$my_dlsyms"
5206
;;
5207
esac
5208
echo >> "$output_objdir/$my_dlsyms" "\
5209
{0, (void *) 0}
5210
};
5211
5212
/* This works around a problem in FreeBSD linker */
5213
#ifdef FREEBSD_WORKAROUND
5214
static const void *lt_preloaded_setup() {
5215
return lt_${my_prefix}_LTX_preloaded_symbols;
5216
}
5217
#endif
5218
5219
#ifdef __cplusplus
5220
}
5221
#endif\
5222
"
5223
} # !$opt_dry_run
5224
5225
pic_flag_for_symtable=
5226
case "$compile_command " in
5227
*" -static "*) ;;
5228
*)
5229
case $host in
5230
# compiling the symbol table file with pic_flag works around
5231
# a FreeBSD bug that causes programs to crash when -lm is
5232
# linked before any other PIC object. But we must not use
5233
# pic_flag when linking with -static. The problem exists in
5234
# FreeBSD 2.2.6 and is fixed in FreeBSD 3.1.
5235
*-*-freebsd2.*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)
5236
pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND" ;;
5237
*-*-hpux*)
5238
pic_flag_for_symtable=" $pic_flag" ;;
5239
*)
5240
$my_pic_p && pic_flag_for_symtable=" $pic_flag"
5241
;;
5242
esac
5243
;;
5244
esac
5245
symtab_cflags=
5246
for arg in $LTCFLAGS; do
5247
case $arg in
5248
-pie | -fpie | -fPIE) ;;
5249
*) func_append symtab_cflags " $arg" ;;
5250
esac
5251
done
5252
5253
# Now compile the dynamic symbol file.
5254
func_show_eval '(cd $output_objdir && $LTCC$symtab_cflags -c$no_builtin_flag$pic_flag_for_symtable "$my_dlsyms")' 'exit $?'
5255
5256
# Clean up the generated files.
5257
func_show_eval '$RM "$output_objdir/$my_dlsyms" "$nlist" "${nlist}S" "${nlist}T" "${nlist}I"'
5258
5259
# Transform the symbol file into the correct name.
5260
symfileobj=$output_objdir/${my_outputname}S.$objext
5261
case $host in
5262
*cygwin* | *mingw* | *windows* | *cegcc* )
5263
if test -f "$output_objdir/$my_outputname.def"; then
5264
compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"`
5265
finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"`
5266
else
5267
compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"`
5268
finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"`
5269
fi
5270
;;
5271
*)
5272
compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"`
5273
finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"`
5274
;;
5275
esac
5276
;;
5277
*)
5278
func_fatal_error "unknown suffix for '$my_dlsyms'"
5279
;;
5280
esac
5281
else
5282
# We keep going just in case the user didn't refer to
5283
# lt_preloaded_symbols. The linker will fail if global_symbol_pipe
5284
# really was required.
5285
5286
# Nullify the symbol file.
5287
compile_command=`$ECHO "$compile_command" | $SED "s% @SYMFILE@%%"`
5288
finalize_command=`$ECHO "$finalize_command" | $SED "s% @SYMFILE@%%"`
5289
fi
5290
}
5291
5292
# func_cygming_gnu_implib_p ARG
5293
# This predicate returns with zero status (TRUE) if
5294
# ARG is a GNU/binutils-style import library. Returns
5295
# with nonzero status (FALSE) otherwise.
5296
func_cygming_gnu_implib_p ()
5297
{
5298
$debug_cmd
5299
5300
func_to_tool_file "$1" func_convert_file_msys_to_w32
5301
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)$'`
5302
test -n "$func_cygming_gnu_implib_tmp"
5303
}
5304
5305
# func_cygming_ms_implib_p ARG
5306
# This predicate returns with zero status (TRUE) if
5307
# ARG is an MS-style import library. Returns
5308
# with nonzero status (FALSE) otherwise.
5309
func_cygming_ms_implib_p ()
5310
{
5311
$debug_cmd
5312
5313
func_to_tool_file "$1" func_convert_file_msys_to_w32
5314
func_cygming_ms_implib_tmp=`$NM "$func_to_tool_file_result" | eval "$global_symbol_pipe" | $GREP '_NULL_IMPORT_DESCRIPTOR'`
5315
test -n "$func_cygming_ms_implib_tmp"
5316
}
5317
5318
# func_win32_libid arg
5319
# return the library type of file 'arg'
5320
#
5321
# Need a lot of goo to handle *both* DLLs and import libs
5322
# Has to be a shell function in order to 'eat' the argument
5323
# that is supplied when $file_magic_command is called.
5324
# Despite the name, also deal with 64 bit binaries.
5325
func_win32_libid ()
5326
{
5327
$debug_cmd
5328
5329
win32_libid_type=unknown
5330
win32_fileres=`file -L $1 2>/dev/null`
5331
case $win32_fileres in
5332
*ar\ archive\ import\ library*) # definitely import
5333
win32_libid_type="x86 archive import"
5334
;;
5335
*ar\ archive*) # could be an import, or static
5336
# Keep the egrep pattern in sync with the one in _LT_CHECK_MAGIC_METHOD.
5337
if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null |
5338
$EGREP 'file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64|pe-aarch64)' >/dev/null; then
5339
case $nm_interface in
5340
"MS dumpbin")
5341
if func_cygming_ms_implib_p "$1" ||
5342
func_cygming_gnu_implib_p "$1"
5343
then
5344
win32_nmres=import
5345
else
5346
win32_nmres=
5347
fi
5348
;;
5349
*)
5350
func_to_tool_file "$1" func_convert_file_msys_to_w32
5351
win32_nmres=`eval $NM -f posix -A \"$func_to_tool_file_result\" |
5352
$SED -n -e '
5353
1,100{
5354
/ I /{
5355
s|.*|import|
5356
p
5357
q
5358
}
5359
}'`
5360
;;
5361
esac
5362
case $win32_nmres in
5363
import*) win32_libid_type="x86 archive import";;
5364
*) win32_libid_type="x86 archive static";;
5365
esac
5366
fi
5367
;;
5368
*DLL*)
5369
win32_libid_type="x86 DLL"
5370
;;
5371
*executable*) # but shell scripts are "executable" too...
5372
case $win32_fileres in
5373
*MS\ Windows\ PE\ Intel*)
5374
win32_libid_type="x86 DLL"
5375
;;
5376
esac
5377
;;
5378
esac
5379
$ECHO "$win32_libid_type"
5380
}
5381
5382
# func_cygming_dll_for_implib ARG
5383
#
5384
# Platform-specific function to extract the
5385
# name of the DLL associated with the specified
5386
# import library ARG.
5387
# Invoked by eval'ing the libtool variable
5388
# $sharedlib_from_linklib_cmd
5389
# Result is available in the variable
5390
# $sharedlib_from_linklib_result
5391
func_cygming_dll_for_implib ()
5392
{
5393
$debug_cmd
5394
5395
sharedlib_from_linklib_result=`$DLLTOOL --identify-strict --identify "$1"`
5396
}
5397
5398
# func_cygming_dll_for_implib_fallback_core SECTION_NAME LIBNAMEs
5399
#
5400
# The is the core of a fallback implementation of a
5401
# platform-specific function to extract the name of the
5402
# DLL associated with the specified import library LIBNAME.
5403
#
5404
# SECTION_NAME is either .idata$6 or .idata$7, depending
5405
# on the platform and compiler that created the implib.
5406
#
5407
# Echos the name of the DLL associated with the
5408
# specified import library.
5409
func_cygming_dll_for_implib_fallback_core ()
5410
{
5411
$debug_cmd
5412
5413
match_literal=`$ECHO "$1" | $SED "$sed_make_literal_regex"`
5414
$OBJDUMP -s --section "$1" "$2" 2>/dev/null |
5415
$SED '/^Contents of section '"$match_literal"':/{
5416
# Place marker at beginning of archive member dllname section
5417
s/.*/====MARK====/
5418
p
5419
d
5420
}
5421
# These lines can sometimes be longer than 43 characters, but
5422
# are always uninteresting
5423
/:[ ]*file format pe[i]\{,1\}-/d
5424
/^In archive [^:]*:/d
5425
# Ensure marker is printed
5426
/^====MARK====/p
5427
# Remove all lines with less than 43 characters
5428
/^.\{43\}/!d
5429
# From remaining lines, remove first 43 characters
5430
s/^.\{43\}//' |
5431
$SED -n '
5432
# Join marker and all lines until next marker into a single line
5433
/^====MARK====/ b para
5434
H
5435
$ b para
5436
b
5437
:para
5438
x
5439
s/\n//g
5440
# Remove the marker
5441
s/^====MARK====//
5442
# Remove trailing dots and whitespace
5443
s/[\. \t]*$//
5444
# Print
5445
/./p' |
5446
# we now have a list, one entry per line, of the stringified
5447
# contents of the appropriate section of all members of the
5448
# archive that possess that section. Heuristic: eliminate
5449
# all those that have a first or second character that is
5450
# a '.' (that is, objdump's representation of an unprintable
5451
# character.) This should work for all archives with less than
5452
# 0x302f exports -- but will fail for DLLs whose name actually
5453
# begins with a literal '.' or a single character followed by
5454
# a '.'.
5455
#
5456
# Of those that remain, print the first one.
5457
$SED -e '/^\./d;/^.\./d;q'
5458
}
5459
5460
# func_cygming_dll_for_implib_fallback ARG
5461
# Platform-specific function to extract the
5462
# name of the DLL associated with the specified
5463
# import library ARG.
5464
#
5465
# This fallback implementation is for use when $DLLTOOL
5466
# does not support the --identify-strict option.
5467
# Invoked by eval'ing the libtool variable
5468
# $sharedlib_from_linklib_cmd
5469
# Result is available in the variable
5470
# $sharedlib_from_linklib_result
5471
func_cygming_dll_for_implib_fallback ()
5472
{
5473
$debug_cmd
5474
5475
if func_cygming_gnu_implib_p "$1"; then
5476
# binutils import library
5477
sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$7' "$1"`
5478
elif func_cygming_ms_implib_p "$1"; then
5479
# ms-generated import library
5480
sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$6' "$1"`
5481
else
5482
# unknown
5483
sharedlib_from_linklib_result=
5484
fi
5485
}
5486
5487
5488
# func_extract_an_archive dir oldlib
5489
func_extract_an_archive ()
5490
{
5491
$debug_cmd
5492
5493
f_ex_an_ar_dir=$1; shift
5494
f_ex_an_ar_oldlib=$1
5495
if test yes = "$lock_old_archive_extraction"; then
5496
lockfile=$f_ex_an_ar_oldlib.lock
5497
until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do
5498
func_echo "Waiting for $lockfile to be removed"
5499
sleep 2
5500
done
5501
fi
5502
func_show_eval "(cd \$f_ex_an_ar_dir && $AR x \"\$f_ex_an_ar_oldlib\")" \
5503
'stat=$?; rm -f "$lockfile"; exit $stat'
5504
if test yes = "$lock_old_archive_extraction"; then
5505
$opt_dry_run || rm -f "$lockfile"
5506
fi
5507
if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then
5508
:
5509
else
5510
func_fatal_error "object name conflicts in archive: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib"
5511
fi
5512
}
5513
5514
5515
# func_extract_archives gentop oldlib ...
5516
func_extract_archives ()
5517
{
5518
$debug_cmd
5519
5520
my_gentop=$1; shift
5521
my_oldlibs=${1+"$@"}
5522
my_oldobjs=
5523
my_xlib=
5524
my_xabs=
5525
my_xdir=
5526
5527
for my_xlib in $my_oldlibs; do
5528
# Extract the objects.
5529
case $my_xlib in
5530
[\\/]* | [A-Za-z]:[\\/]*) my_xabs=$my_xlib ;;
5531
*) my_xabs=`pwd`"/$my_xlib" ;;
5532
esac
5533
func_basename "$my_xlib"
5534
my_xlib=$func_basename_result
5535
my_xlib_u=$my_xlib
5536
while :; do
5537
case " $extracted_archives " in
5538
*" $my_xlib_u "*)
5539
func_arith $extracted_serial + 1
5540
extracted_serial=$func_arith_result
5541
my_xlib_u=lt$extracted_serial-$my_xlib ;;
5542
*) break ;;
5543
esac
5544
done
5545
extracted_archives="$extracted_archives $my_xlib_u"
5546
my_xdir=$my_gentop/$my_xlib_u
5547
5548
func_mkdir_p "$my_xdir"
5549
5550
case $host in
5551
*-darwin*)
5552
func_verbose "Extracting $my_xabs"
5553
# Do not bother doing anything if just a dry run
5554
$opt_dry_run || {
5555
darwin_orig_dir=`pwd`
5556
cd $my_xdir || exit $?
5557
darwin_archive=$my_xabs
5558
darwin_curdir=`pwd`
5559
func_basename "$darwin_archive"
5560
darwin_base_archive=$func_basename_result
5561
darwin_arches=`$LIPO -info "$darwin_archive" 2>/dev/null | $GREP Architectures 2>/dev/null || true`
5562
if test -n "$darwin_arches"; then
5563
darwin_arches=`$ECHO "$darwin_arches" | $SED -e 's/.*are://'`
5564
darwin_arch=
5565
func_verbose "$darwin_base_archive has multiple architectures $darwin_arches"
5566
for darwin_arch in $darwin_arches; do
5567
func_mkdir_p "unfat-$$/$darwin_base_archive-$darwin_arch"
5568
$LIPO -thin $darwin_arch -output "unfat-$$/$darwin_base_archive-$darwin_arch/$darwin_base_archive" "$darwin_archive"
5569
cd "unfat-$$/$darwin_base_archive-$darwin_arch"
5570
func_extract_an_archive "`pwd`" "$darwin_base_archive"
5571
cd "$darwin_curdir"
5572
$RM "unfat-$$/$darwin_base_archive-$darwin_arch/$darwin_base_archive"
5573
done # $darwin_arches
5574
## Okay now we've a bunch of thin objects, gotta fatten them up :)
5575
darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print | $SED -e "$sed_basename" | sort -u`
5576
darwin_file=
5577
darwin_files=
5578
for darwin_file in $darwin_filelist; do
5579
darwin_files=`find unfat-$$ -name $darwin_file -print | sort | $NL2SP`
5580
$LIPO -create -output "$darwin_file" $darwin_files
5581
done # $darwin_filelist
5582
$RM -rf unfat-$$
5583
cd "$darwin_orig_dir"
5584
else
5585
cd $darwin_orig_dir
5586
func_extract_an_archive "$my_xdir" "$my_xabs"
5587
fi # $darwin_arches
5588
} # !$opt_dry_run
5589
;;
5590
*)
5591
func_extract_an_archive "$my_xdir" "$my_xabs"
5592
;;
5593
esac
5594
my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | sort | $NL2SP`
5595
done
5596
5597
func_extract_archives_result=$my_oldobjs
5598
}
5599
5600
5601
# func_emit_wrapper [arg=no]
5602
#
5603
# Emit a libtool wrapper script on stdout.
5604
# Don't directly open a file because we may want to
5605
# incorporate the script contents within a cygwin/mingw/windows
5606
# wrapper executable. Must ONLY be called from within
5607
# func_mode_link because it depends on a number of variables
5608
# set therein.
5609
#
5610
# ARG is the value that the WRAPPER_SCRIPT_BELONGS_IN_OBJDIR
5611
# variable will take. If 'yes', then the emitted script
5612
# will assume that the directory where it is stored is
5613
# the $objdir directory. This is a cygwin/mingw/windows-specific
5614
# behavior.
5615
func_emit_wrapper ()
5616
{
5617
func_emit_wrapper_arg1=${1-no}
5618
5619
$ECHO "\
5620
#! $SHELL
5621
5622
# $output - temporary wrapper script for $objdir/$outputname
5623
# Generated by $PROGRAM (GNU $PACKAGE) $VERSION
5624
#
5625
# The $output program cannot be directly executed until all the libtool
5626
# libraries that it depends on are installed.
5627
#
5628
# This wrapper script should never be moved out of the build directory.
5629
# If it is, it will not operate correctly.
5630
5631
# Sed substitution that helps us do robust quoting. It backslashifies
5632
# metacharacters that are still active within double-quoted strings.
5633
sed_quote_subst='$sed_quote_subst'
5634
5635
# Be Bourne compatible
5636
if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then
5637
emulate sh
5638
NULLCMD=:
5639
# Zsh 3.x and 4.x performs word splitting on \${1+\"\$@\"}, which
5640
# is contrary to our usage. Disable this feature.
5641
alias -g '\${1+\"\$@\"}'='\"\$@\"'
5642
setopt NO_GLOB_SUBST
5643
else
5644
case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac
5645
fi
5646
BIN_SH=xpg4; export BIN_SH # for Tru64
5647
DUALCASE=1; export DUALCASE # for MKS sh
5648
5649
# The HP-UX ksh and POSIX shell print the target directory to stdout
5650
# if CDPATH is set.
5651
(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
5652
5653
relink_command=\"$relink_command\"
5654
5655
# This environment variable determines our operation mode.
5656
if test \"\$libtool_install_magic\" = \"$magic\"; then
5657
# install mode needs the following variables:
5658
generated_by_libtool_version='$macro_version'
5659
notinst_deplibs='$notinst_deplibs'
5660
else
5661
# When we are sourced in execute mode, \$file and \$ECHO are already set.
5662
if test \"\$libtool_execute_magic\" != \"$magic\"; then
5663
file=\"\$0\""
5664
5665
func_quote_arg pretty "$ECHO"
5666
qECHO=$func_quote_arg_result
5667
$ECHO "\
5668
5669
# A function that is used when there is no print builtin or printf.
5670
func_fallback_echo ()
5671
{
5672
eval 'cat <<_LTECHO_EOF
5673
\$1
5674
_LTECHO_EOF'
5675
}
5676
ECHO=$qECHO
5677
fi
5678
5679
# Very basic option parsing. These options are (a) specific to
5680
# the libtool wrapper, (b) are identical between the wrapper
5681
# /script/ and the wrapper /executable/ that is used only on
5682
# windows platforms, and (c) all begin with the string "--lt-"
5683
# (application programs are unlikely to have options that match
5684
# this pattern).
5685
#
5686
# There are only two supported options: --lt-debug and
5687
# --lt-dump-script. There is, deliberately, no --lt-help.
5688
#
5689
# The first argument to this parsing function should be the
5690
# script's $0 value, followed by "$@".
5691
lt_option_debug=
5692
func_parse_lt_options ()
5693
{
5694
lt_script_arg0=\$0
5695
shift
5696
for lt_opt
5697
do
5698
case \"\$lt_opt\" in
5699
--lt-debug) lt_option_debug=1 ;;
5700
--lt-dump-script)
5701
lt_dump_D=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%/[^/]*$%%'\`
5702
test \"X\$lt_dump_D\" = \"X\$lt_script_arg0\" && lt_dump_D=.
5703
lt_dump_F=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%^.*/%%'\`
5704
cat \"\$lt_dump_D/\$lt_dump_F\"
5705
exit 0
5706
;;
5707
--lt-*)
5708
\$ECHO \"Unrecognized --lt- option: '\$lt_opt'\" 1>&2
5709
exit 1
5710
;;
5711
esac
5712
done
5713
5714
# Print the debug banner immediately:
5715
if test -n \"\$lt_option_debug\"; then
5716
echo \"$outputname:$output:\$LINENO: libtool wrapper (GNU $PACKAGE) $VERSION\" 1>&2
5717
fi
5718
}
5719
5720
# Used when --lt-debug. Prints its arguments to stdout
5721
# (redirection is the responsibility of the caller)
5722
func_lt_dump_args ()
5723
{
5724
lt_dump_args_N=1;
5725
for lt_arg
5726
do
5727
\$ECHO \"$outputname:$output:\$LINENO: newargv[\$lt_dump_args_N]: \$lt_arg\"
5728
lt_dump_args_N=\`expr \$lt_dump_args_N + 1\`
5729
done
5730
}
5731
5732
# Core function for launching the target application
5733
func_exec_program_core ()
5734
{
5735
"
5736
case $host in
5737
# Backslashes separate directories on plain windows
5738
*-*-mingw* | *-*-windows* | *-*-os2* | *-cegcc*)
5739
$ECHO "\
5740
if test -n \"\$lt_option_debug\"; then
5741
\$ECHO \"$outputname:$output:\$LINENO: newargv[0]: \$progdir\\\\\$program\" 1>&2
5742
func_lt_dump_args \${1+\"\$@\"} 1>&2
5743
fi
5744
exec \"\$progdir\\\\\$program\" \${1+\"\$@\"}
5745
"
5746
;;
5747
5748
*)
5749
$ECHO "\
5750
if test -n \"\$lt_option_debug\"; then
5751
\$ECHO \"$outputname:$output:\$LINENO: newargv[0]: \$progdir/\$program\" 1>&2
5752
func_lt_dump_args \${1+\"\$@\"} 1>&2
5753
fi
5754
exec \"\$progdir/\$program\" \${1+\"\$@\"}
5755
"
5756
;;
5757
esac
5758
$ECHO "\
5759
\$ECHO \"\$0: cannot exec \$program \$*\" 1>&2
5760
exit 1
5761
}
5762
5763
# A function to encapsulate launching the target application
5764
# Strips options in the --lt-* namespace from \$@ and
5765
# launches target application with the remaining arguments.
5766
func_exec_program ()
5767
{
5768
case \" \$* \" in
5769
*\\ --lt-*)
5770
for lt_wr_arg
5771
do
5772
case \$lt_wr_arg in
5773
--lt-*) ;;
5774
*) set x \"\$@\" \"\$lt_wr_arg\"; shift;;
5775
esac
5776
shift
5777
done ;;
5778
esac
5779
func_exec_program_core \${1+\"\$@\"}
5780
}
5781
5782
# Parse options
5783
func_parse_lt_options \"\$0\" \${1+\"\$@\"}
5784
5785
# Find the directory that this script lives in.
5786
thisdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*$%%'\`
5787
test \"x\$thisdir\" = \"x\$file\" && thisdir=.
5788
5789
# Follow symbolic links until we get to the real thisdir.
5790
file=\`ls -ld \"\$file\" | $SED -n 's/.*-> //p'\`
5791
while test -n \"\$file\"; do
5792
destdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*\$%%'\`
5793
5794
# If there was a directory component, then change thisdir.
5795
if test \"x\$destdir\" != \"x\$file\"; then
5796
case \"\$destdir\" in
5797
[\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;;
5798
*) thisdir=\"\$thisdir/\$destdir\" ;;
5799
esac
5800
fi
5801
5802
file=\`\$ECHO \"\$file\" | $SED 's%^.*/%%'\`
5803
file=\`ls -ld \"\$thisdir/\$file\" | $SED -n 's/.*-> //p'\`
5804
done
5805
5806
# Usually 'no', except on cygwin/mingw/windows when embedded into
5807
# the cwrapper.
5808
WRAPPER_SCRIPT_BELONGS_IN_OBJDIR=$func_emit_wrapper_arg1
5809
if test \"\$WRAPPER_SCRIPT_BELONGS_IN_OBJDIR\" = \"yes\"; then
5810
# special case for '.'
5811
if test \"\$thisdir\" = \".\"; then
5812
thisdir=\`pwd\`
5813
fi
5814
# remove .libs from thisdir
5815
case \"\$thisdir\" in
5816
*[\\\\/]$objdir ) thisdir=\`\$ECHO \"\$thisdir\" | $SED 's%[\\\\/][^\\\\/]*$%%'\` ;;
5817
$objdir ) thisdir=. ;;
5818
esac
5819
fi
5820
5821
# Try to get the absolute directory name.
5822
absdir=\`cd \"\$thisdir\" && pwd\`
5823
test -n \"\$absdir\" && thisdir=\"\$absdir\"
5824
"
5825
5826
if test yes = "$fast_install"; then
5827
$ECHO "\
5828
program=lt-'$outputname'$exeext
5829
progdir=\"\$thisdir/$objdir\"
5830
5831
if test ! -f \"\$progdir/\$program\" ||
5832
{ file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | $SED 1q\`; \\
5833
test \"X\$file\" != \"X\$progdir/\$program\"; }; then
5834
5835
file=\"\$\$-\$program\"
5836
5837
if test ! -d \"\$progdir\"; then
5838
$MKDIR \"\$progdir\"
5839
else
5840
$RM \"\$progdir/\$file\"
5841
fi"
5842
5843
$ECHO "\
5844
5845
# relink executable if necessary
5846
if test -n \"\$relink_command\"; then
5847
if relink_command_output=\`eval \$relink_command 2>&1\`; then :
5848
else
5849
\$ECHO \"\$relink_command_output\" >&2
5850
$RM \"\$progdir/\$file\"
5851
exit 1
5852
fi
5853
fi
5854
5855
$MV \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null ||
5856
{ $RM \"\$progdir/\$program\";
5857
$MV \"\$progdir/\$file\" \"\$progdir/\$program\"; }
5858
$RM \"\$progdir/\$file\"
5859
fi"
5860
else
5861
$ECHO "\
5862
program='$outputname'
5863
progdir=\"\$thisdir/$objdir\"
5864
"
5865
fi
5866
5867
$ECHO "\
5868
5869
if test -f \"\$progdir/\$program\"; then"
5870
5871
# fixup the dll searchpath if we need to.
5872
#
5873
# Fix the DLL searchpath if we need to. Do this before prepending
5874
# to shlibpath, because on Windows, both are PATH and uninstalled
5875
# libraries must come first.
5876
if test -n "$dllsearchpath"; then
5877
$ECHO "\
5878
# Add the dll search path components to the executable PATH
5879
PATH=$dllsearchpath:\$PATH
5880
"
5881
fi
5882
5883
# Export our shlibpath_var if we have one.
5884
if test yes = "$shlibpath_overrides_runpath" && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
5885
$ECHO "\
5886
# Add our own library path to $shlibpath_var
5887
$shlibpath_var=\"$temp_rpath\$$shlibpath_var\"
5888
5889
# Some systems cannot cope with colon-terminated $shlibpath_var
5890
# The second colon is a workaround for a bug in BeOS R4 sed
5891
$shlibpath_var=\`\$ECHO \"\$$shlibpath_var\" | $SED 's/::*\$//'\`
5892
5893
export $shlibpath_var
5894
"
5895
fi
5896
5897
$ECHO "\
5898
if test \"\$libtool_execute_magic\" != \"$magic\"; then
5899
# Run the actual program with our arguments.
5900
func_exec_program \${1+\"\$@\"}
5901
fi
5902
else
5903
# The program doesn't exist.
5904
\$ECHO \"\$0: error: '\$progdir/\$program' does not exist\" 1>&2
5905
\$ECHO \"This script is just a wrapper for \$program.\" 1>&2
5906
\$ECHO \"See the $PACKAGE documentation for more information.\" 1>&2
5907
exit 1
5908
fi
5909
fi\
5910
"
5911
}
5912
5913
5914
# func_emit_cwrapperexe_src
5915
# emit the source code for a wrapper executable on stdout
5916
# Must ONLY be called from within func_mode_link because
5917
# it depends on a number of variable set therein.
5918
func_emit_cwrapperexe_src ()
5919
{
5920
cat <<EOF
5921
5922
/* $cwrappersource - temporary wrapper executable for $objdir/$outputname
5923
Generated by $PROGRAM (GNU $PACKAGE) $VERSION
5924
5925
The $output program cannot be directly executed until all the libtool
5926
libraries that it depends on are installed.
5927
5928
This wrapper executable should never be moved out of the build directory.
5929
If it is, it will not operate correctly.
5930
*/
5931
EOF
5932
cat <<"EOF"
5933
#ifdef _MSC_VER
5934
# define _CRT_SECURE_NO_DEPRECATE 1
5935
#endif
5936
#include <stdio.h>
5937
#include <stdlib.h>
5938
#if defined _WIN32 && !defined __GNUC__
5939
# include <direct.h>
5940
# include <process.h>
5941
# include <io.h>
5942
#else
5943
# include <unistd.h>
5944
# include <stdint.h>
5945
# ifdef __CYGWIN__
5946
# include <io.h>
5947
# endif
5948
#endif
5949
#include <malloc.h>
5950
#include <stdarg.h>
5951
#include <assert.h>
5952
#include <string.h>
5953
#include <ctype.h>
5954
#include <errno.h>
5955
#include <fcntl.h>
5956
#include <sys/stat.h>
5957
5958
#define STREQ(s1, s2) (strcmp ((s1), (s2)) == 0)
5959
5960
/* declarations of non-ANSI functions */
5961
#if defined __MINGW32__
5962
# ifdef __STRICT_ANSI__
5963
_CRTIMP int __cdecl _putenv (const char *);
5964
# endif
5965
#elif defined __CYGWIN__
5966
# ifdef __STRICT_ANSI__
5967
char *realpath (const char *, char *);
5968
int putenv (char *);
5969
int setenv (const char *, const char *, int);
5970
# endif
5971
/* #elif defined other_platform || defined ... */
5972
#endif
5973
5974
/* portability defines, excluding path handling macros */
5975
#if defined _MSC_VER
5976
# define setmode _setmode
5977
# define stat _stat
5978
# define chmod _chmod
5979
# define getcwd _getcwd
5980
# define putenv _putenv
5981
# define S_IXUSR _S_IEXEC
5982
#elif defined __MINGW32__
5983
# define setmode _setmode
5984
# define stat _stat
5985
# define chmod _chmod
5986
# define getcwd _getcwd
5987
# define putenv _putenv
5988
#elif defined __CYGWIN__
5989
# define HAVE_SETENV
5990
# define FOPEN_WB "wb"
5991
/* #elif defined other platforms ... */
5992
#endif
5993
5994
#if defined PATH_MAX
5995
# define LT_PATHMAX PATH_MAX
5996
#elif defined MAXPATHLEN
5997
# define LT_PATHMAX MAXPATHLEN
5998
#else
5999
# define LT_PATHMAX 1024
6000
#endif
6001
6002
#ifndef S_IXOTH
6003
# define S_IXOTH 0
6004
#endif
6005
#ifndef S_IXGRP
6006
# define S_IXGRP 0
6007
#endif
6008
6009
/* path handling portability macros */
6010
#ifndef DIR_SEPARATOR
6011
# define DIR_SEPARATOR '/'
6012
# define PATH_SEPARATOR ':'
6013
#endif
6014
6015
#if defined _WIN32 || defined __MSDOS__ || defined __DJGPP__ || \
6016
defined __OS2__
6017
# define HAVE_DOS_BASED_FILE_SYSTEM
6018
# define FOPEN_WB "wb"
6019
# ifndef DIR_SEPARATOR_2
6020
# define DIR_SEPARATOR_2 '\\'
6021
# endif
6022
# ifndef PATH_SEPARATOR_2
6023
# define PATH_SEPARATOR_2 ';'
6024
# endif
6025
#endif
6026
6027
#ifndef DIR_SEPARATOR_2
6028
# define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR)
6029
#else /* DIR_SEPARATOR_2 */
6030
# define IS_DIR_SEPARATOR(ch) \
6031
(((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2))
6032
#endif /* DIR_SEPARATOR_2 */
6033
6034
#ifndef PATH_SEPARATOR_2
6035
# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR)
6036
#else /* PATH_SEPARATOR_2 */
6037
# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2)
6038
#endif /* PATH_SEPARATOR_2 */
6039
6040
#ifndef FOPEN_WB
6041
# define FOPEN_WB "w"
6042
#endif
6043
#ifndef _O_BINARY
6044
# define _O_BINARY 0
6045
#endif
6046
6047
#define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type)))
6048
#define XFREE(stale) do { \
6049
if (stale) { free (stale); stale = 0; } \
6050
} while (0)
6051
6052
#if defined LT_DEBUGWRAPPER
6053
static int lt_debug = 1;
6054
#else
6055
static int lt_debug = 0;
6056
#endif
6057
6058
const char *program_name = "libtool-wrapper"; /* in case xstrdup fails */
6059
6060
void *xmalloc (size_t num);
6061
char *xstrdup (const char *string);
6062
const char *base_name (const char *name);
6063
char *find_executable (const char *wrapper);
6064
char *chase_symlinks (const char *pathspec);
6065
int make_executable (const char *path);
6066
int check_executable (const char *path);
6067
char *strendzap (char *str, const char *pat);
6068
void lt_debugprintf (const char *file, int line, const char *fmt, ...);
6069
void lt_fatal (const char *file, int line, const char *message, ...);
6070
static const char *nonnull (const char *s);
6071
static const char *nonempty (const char *s);
6072
void lt_setenv (const char *name, const char *value);
6073
char *lt_extend_str (const char *orig_value, const char *add, int to_end);
6074
void lt_update_exe_path (const char *name, const char *value);
6075
void lt_update_lib_path (const char *name, const char *value);
6076
char **prepare_spawn (char **argv);
6077
void lt_dump_script (FILE *f);
6078
EOF
6079
6080
cat <<EOF
6081
#if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 5)
6082
# define externally_visible volatile
6083
#else
6084
# define externally_visible __attribute__((externally_visible)) volatile
6085
#endif
6086
externally_visible const char * MAGIC_EXE = "$magic_exe";
6087
const char * LIB_PATH_VARNAME = "$shlibpath_var";
6088
EOF
6089
6090
if test yes = "$shlibpath_overrides_runpath" && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
6091
func_to_host_path "$temp_rpath"
6092
cat <<EOF
6093
const char * LIB_PATH_VALUE = "$func_to_host_path_result";
6094
EOF
6095
else
6096
cat <<"EOF"
6097
const char * LIB_PATH_VALUE = "";
6098
EOF
6099
fi
6100
6101
if test -n "$dllsearchpath"; then
6102
func_to_host_path "$dllsearchpath:"
6103
cat <<EOF
6104
const char * EXE_PATH_VARNAME = "PATH";
6105
const char * EXE_PATH_VALUE = "$func_to_host_path_result";
6106
EOF
6107
else
6108
cat <<"EOF"
6109
const char * EXE_PATH_VARNAME = "";
6110
const char * EXE_PATH_VALUE = "";
6111
EOF
6112
fi
6113
6114
if test yes = "$fast_install"; then
6115
cat <<EOF
6116
const char * TARGET_PROGRAM_NAME = "lt-$outputname"; /* hopefully, no .exe */
6117
EOF
6118
else
6119
cat <<EOF
6120
const char * TARGET_PROGRAM_NAME = "$outputname"; /* hopefully, no .exe */
6121
EOF
6122
fi
6123
6124
6125
cat <<"EOF"
6126
6127
#define LTWRAPPER_OPTION_PREFIX "--lt-"
6128
6129
static const char *ltwrapper_option_prefix = LTWRAPPER_OPTION_PREFIX;
6130
static const char *dumpscript_opt = LTWRAPPER_OPTION_PREFIX "dump-script";
6131
static const char *debug_opt = LTWRAPPER_OPTION_PREFIX "debug";
6132
6133
int
6134
main (int argc, char *argv[])
6135
{
6136
char **newargz;
6137
int newargc;
6138
char *tmp_pathspec;
6139
char *actual_cwrapper_path;
6140
char *actual_cwrapper_name;
6141
char *target_name;
6142
char *lt_argv_zero;
6143
int rval = 127;
6144
6145
int i;
6146
6147
program_name = (char *) xstrdup (base_name (argv[0]));
6148
newargz = XMALLOC (char *, (size_t) argc + 1);
6149
6150
/* very simple arg parsing; don't want to rely on getopt
6151
* also, copy all non cwrapper options to newargz, except
6152
* argz[0], which is handled differently
6153
*/
6154
newargc=0;
6155
for (i = 1; i < argc; i++)
6156
{
6157
if (STREQ (argv[i], dumpscript_opt))
6158
{
6159
EOF
6160
case $host in
6161
*mingw* | *windows* | *cygwin* )
6162
# make stdout use "unix" line endings
6163
echo " setmode(1,_O_BINARY);"
6164
;;
6165
esac
6166
6167
cat <<"EOF"
6168
lt_dump_script (stdout);
6169
return 0;
6170
}
6171
if (STREQ (argv[i], debug_opt))
6172
{
6173
lt_debug = 1;
6174
continue;
6175
}
6176
if (STREQ (argv[i], ltwrapper_option_prefix))
6177
{
6178
/* however, if there is an option in the LTWRAPPER_OPTION_PREFIX
6179
namespace, but it is not one of the ones we know about and
6180
have already dealt with, above (including dump-script), then
6181
report an error. Otherwise, targets might begin to believe
6182
they are allowed to use options in the LTWRAPPER_OPTION_PREFIX
6183
namespace. The first time any user complains about this, we'll
6184
need to make LTWRAPPER_OPTION_PREFIX a configure-time option
6185
or a configure.ac-settable value.
6186
*/
6187
lt_fatal (__FILE__, __LINE__,
6188
"unrecognized %s option: '%s'",
6189
ltwrapper_option_prefix, argv[i]);
6190
}
6191
/* otherwise ... */
6192
newargz[++newargc] = xstrdup (argv[i]);
6193
}
6194
newargz[++newargc] = NULL;
6195
6196
EOF
6197
cat <<EOF
6198
/* The GNU banner must be the first non-error debug message */
6199
lt_debugprintf (__FILE__, __LINE__, "libtool wrapper (GNU $PACKAGE) $VERSION\n");
6200
EOF
6201
cat <<"EOF"
6202
lt_debugprintf (__FILE__, __LINE__, "(main) argv[0]: %s\n", argv[0]);
6203
lt_debugprintf (__FILE__, __LINE__, "(main) program_name: %s\n", program_name);
6204
6205
tmp_pathspec = find_executable (argv[0]);
6206
if (tmp_pathspec == NULL)
6207
lt_fatal (__FILE__, __LINE__, "couldn't find %s", argv[0]);
6208
lt_debugprintf (__FILE__, __LINE__,
6209
"(main) found exe (before symlink chase) at: %s\n",
6210
tmp_pathspec);
6211
6212
actual_cwrapper_path = chase_symlinks (tmp_pathspec);
6213
lt_debugprintf (__FILE__, __LINE__,
6214
"(main) found exe (after symlink chase) at: %s\n",
6215
actual_cwrapper_path);
6216
XFREE (tmp_pathspec);
6217
6218
actual_cwrapper_name = xstrdup (base_name (actual_cwrapper_path));
6219
strendzap (actual_cwrapper_path, actual_cwrapper_name);
6220
6221
/* wrapper name transforms */
6222
strendzap (actual_cwrapper_name, ".exe");
6223
tmp_pathspec = lt_extend_str (actual_cwrapper_name, ".exe", 1);
6224
XFREE (actual_cwrapper_name);
6225
actual_cwrapper_name = tmp_pathspec;
6226
tmp_pathspec = 0;
6227
6228
/* target_name transforms -- use actual target program name; might have lt- prefix */
6229
target_name = xstrdup (base_name (TARGET_PROGRAM_NAME));
6230
strendzap (target_name, ".exe");
6231
tmp_pathspec = lt_extend_str (target_name, ".exe", 1);
6232
XFREE (target_name);
6233
target_name = tmp_pathspec;
6234
tmp_pathspec = 0;
6235
6236
lt_debugprintf (__FILE__, __LINE__,
6237
"(main) libtool target name: %s\n",
6238
target_name);
6239
EOF
6240
6241
cat <<EOF
6242
newargz[0] =
6243
XMALLOC (char, (strlen (actual_cwrapper_path) +
6244
strlen ("$objdir") + 1 + strlen (actual_cwrapper_name) + 1));
6245
strcpy (newargz[0], actual_cwrapper_path);
6246
strcat (newargz[0], "$objdir");
6247
strcat (newargz[0], "/");
6248
EOF
6249
6250
cat <<"EOF"
6251
/* stop here, and copy so we don't have to do this twice */
6252
tmp_pathspec = xstrdup (newargz[0]);
6253
6254
/* do NOT want the lt- prefix here, so use actual_cwrapper_name */
6255
strcat (newargz[0], actual_cwrapper_name);
6256
6257
/* DO want the lt- prefix here if it exists, so use target_name */
6258
lt_argv_zero = lt_extend_str (tmp_pathspec, target_name, 1);
6259
XFREE (tmp_pathspec);
6260
tmp_pathspec = NULL;
6261
EOF
6262
6263
case $host_os in
6264
mingw* | windows*)
6265
cat <<"EOF"
6266
{
6267
char* p;
6268
while ((p = strchr (newargz[0], '\\')) != NULL)
6269
{
6270
*p = '/';
6271
}
6272
while ((p = strchr (lt_argv_zero, '\\')) != NULL)
6273
{
6274
*p = '/';
6275
}
6276
}
6277
EOF
6278
;;
6279
esac
6280
6281
cat <<"EOF"
6282
XFREE (target_name);
6283
XFREE (actual_cwrapper_path);
6284
XFREE (actual_cwrapper_name);
6285
6286
lt_setenv ("BIN_SH", "xpg4"); /* for Tru64 */
6287
lt_setenv ("DUALCASE", "1"); /* for MSK sh */
6288
/* Update the DLL searchpath. EXE_PATH_VALUE ($dllsearchpath) must
6289
be prepended before (that is, appear after) LIB_PATH_VALUE ($temp_rpath)
6290
because on Windows, both *_VARNAMEs are PATH but uninstalled
6291
libraries must come first. */
6292
lt_update_exe_path (EXE_PATH_VARNAME, EXE_PATH_VALUE);
6293
lt_update_lib_path (LIB_PATH_VARNAME, LIB_PATH_VALUE);
6294
6295
lt_debugprintf (__FILE__, __LINE__, "(main) lt_argv_zero: %s\n",
6296
nonnull (lt_argv_zero));
6297
for (i = 0; i < newargc; i++)
6298
{
6299
lt_debugprintf (__FILE__, __LINE__, "(main) newargz[%d]: %s\n",
6300
i, nonnull (newargz[i]));
6301
}
6302
6303
EOF
6304
6305
case $host_os in
6306
mingw* | windows*)
6307
cat <<"EOF"
6308
/* execv doesn't actually work on mingw as expected on unix */
6309
newargz = prepare_spawn (newargz);
6310
rval = (int) _spawnv (_P_WAIT, lt_argv_zero, (const char * const *) newargz);
6311
if (rval == -1)
6312
{
6313
/* failed to start process */
6314
lt_debugprintf (__FILE__, __LINE__,
6315
"(main) failed to launch target \"%s\": %s\n",
6316
lt_argv_zero, nonnull (strerror (errno)));
6317
return 127;
6318
}
6319
return rval;
6320
EOF
6321
;;
6322
*)
6323
cat <<"EOF"
6324
execv (lt_argv_zero, newargz);
6325
return rval; /* =127, but avoids unused variable warning */
6326
EOF
6327
;;
6328
esac
6329
6330
cat <<"EOF"
6331
}
6332
6333
void *
6334
xmalloc (size_t num)
6335
{
6336
void *p = (void *) malloc (num);
6337
if (!p)
6338
lt_fatal (__FILE__, __LINE__, "memory exhausted");
6339
6340
return p;
6341
}
6342
6343
char *
6344
xstrdup (const char *string)
6345
{
6346
return string ? strcpy ((char *) xmalloc (strlen (string) + 1),
6347
string) : NULL;
6348
}
6349
6350
const char *
6351
base_name (const char *name)
6352
{
6353
const char *base;
6354
6355
#if defined HAVE_DOS_BASED_FILE_SYSTEM
6356
/* Skip over the disk name in MSDOS pathnames. */
6357
if (isalpha ((unsigned char) name[0]) && name[1] == ':')
6358
name += 2;
6359
#endif
6360
6361
for (base = name; *name; name++)
6362
if (IS_DIR_SEPARATOR (*name))
6363
base = name + 1;
6364
return base;
6365
}
6366
6367
int
6368
check_executable (const char *path)
6369
{
6370
struct stat st;
6371
6372
lt_debugprintf (__FILE__, __LINE__, "(check_executable): %s\n",
6373
nonempty (path));
6374
if ((!path) || (!*path))
6375
return 0;
6376
6377
if ((stat (path, &st) >= 0)
6378
&& (st.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH)))
6379
return 1;
6380
else
6381
return 0;
6382
}
6383
6384
int
6385
make_executable (const char *path)
6386
{
6387
int rval = 0;
6388
struct stat st;
6389
6390
lt_debugprintf (__FILE__, __LINE__, "(make_executable): %s\n",
6391
nonempty (path));
6392
if ((!path) || (!*path))
6393
return 0;
6394
6395
if (stat (path, &st) >= 0)
6396
{
6397
rval = chmod (path, st.st_mode | S_IXOTH | S_IXGRP | S_IXUSR);
6398
}
6399
return rval;
6400
}
6401
6402
/* Searches for the full path of the wrapper. Returns
6403
newly allocated full path name if found, NULL otherwise
6404
Does not chase symlinks, even on platforms that support them.
6405
*/
6406
char *
6407
find_executable (const char *wrapper)
6408
{
6409
int has_slash = 0;
6410
const char *p;
6411
const char *p_next;
6412
/* static buffer for getcwd */
6413
char tmp[LT_PATHMAX + 1];
6414
size_t tmp_len;
6415
char *concat_name;
6416
6417
lt_debugprintf (__FILE__, __LINE__, "(find_executable): %s\n",
6418
nonempty (wrapper));
6419
6420
if ((wrapper == NULL) || (*wrapper == '\0'))
6421
return NULL;
6422
6423
/* Absolute path? */
6424
#if defined HAVE_DOS_BASED_FILE_SYSTEM
6425
if (isalpha ((unsigned char) wrapper[0]) && wrapper[1] == ':')
6426
{
6427
concat_name = xstrdup (wrapper);
6428
if (check_executable (concat_name))
6429
return concat_name;
6430
XFREE (concat_name);
6431
}
6432
else
6433
{
6434
#endif
6435
if (IS_DIR_SEPARATOR (wrapper[0]))
6436
{
6437
concat_name = xstrdup (wrapper);
6438
if (check_executable (concat_name))
6439
return concat_name;
6440
XFREE (concat_name);
6441
}
6442
#if defined HAVE_DOS_BASED_FILE_SYSTEM
6443
}
6444
#endif
6445
6446
for (p = wrapper; *p; p++)
6447
if (*p == '/')
6448
{
6449
has_slash = 1;
6450
break;
6451
}
6452
if (!has_slash)
6453
{
6454
/* no slashes; search PATH */
6455
const char *path = getenv ("PATH");
6456
if (path != NULL)
6457
{
6458
for (p = path; *p; p = p_next)
6459
{
6460
const char *q;
6461
size_t p_len;
6462
for (q = p; *q; q++)
6463
if (IS_PATH_SEPARATOR (*q))
6464
break;
6465
p_len = (size_t) (q - p);
6466
p_next = (*q == '\0' ? q : q + 1);
6467
if (p_len == 0)
6468
{
6469
/* empty path: current directory */
6470
if (getcwd (tmp, LT_PATHMAX) == NULL)
6471
lt_fatal (__FILE__, __LINE__, "getcwd failed: %s",
6472
nonnull (strerror (errno)));
6473
tmp_len = strlen (tmp);
6474
concat_name =
6475
XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1);
6476
memcpy (concat_name, tmp, tmp_len);
6477
concat_name[tmp_len] = '/';
6478
strcpy (concat_name + tmp_len + 1, wrapper);
6479
}
6480
else
6481
{
6482
concat_name =
6483
XMALLOC (char, p_len + 1 + strlen (wrapper) + 1);
6484
memcpy (concat_name, p, p_len);
6485
concat_name[p_len] = '/';
6486
strcpy (concat_name + p_len + 1, wrapper);
6487
}
6488
if (check_executable (concat_name))
6489
return concat_name;
6490
XFREE (concat_name);
6491
}
6492
}
6493
/* not found in PATH; assume curdir */
6494
}
6495
/* Relative path | not found in path: prepend cwd */
6496
if (getcwd (tmp, LT_PATHMAX) == NULL)
6497
lt_fatal (__FILE__, __LINE__, "getcwd failed: %s",
6498
nonnull (strerror (errno)));
6499
tmp_len = strlen (tmp);
6500
concat_name = XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1);
6501
memcpy (concat_name, tmp, tmp_len);
6502
concat_name[tmp_len] = '/';
6503
strcpy (concat_name + tmp_len + 1, wrapper);
6504
6505
if (check_executable (concat_name))
6506
return concat_name;
6507
XFREE (concat_name);
6508
return NULL;
6509
}
6510
6511
char *
6512
chase_symlinks (const char *pathspec)
6513
{
6514
#ifndef S_ISLNK
6515
return xstrdup (pathspec);
6516
#else
6517
char buf[LT_PATHMAX];
6518
struct stat s;
6519
char *tmp_pathspec = xstrdup (pathspec);
6520
char *p;
6521
int has_symlinks = 0;
6522
while (strlen (tmp_pathspec) && !has_symlinks)
6523
{
6524
lt_debugprintf (__FILE__, __LINE__,
6525
"checking path component for symlinks: %s\n",
6526
tmp_pathspec);
6527
if (lstat (tmp_pathspec, &s) == 0)
6528
{
6529
if (S_ISLNK (s.st_mode) != 0)
6530
{
6531
has_symlinks = 1;
6532
break;
6533
}
6534
6535
/* search backwards for last DIR_SEPARATOR */
6536
p = tmp_pathspec + strlen (tmp_pathspec) - 1;
6537
while ((p > tmp_pathspec) && (!IS_DIR_SEPARATOR (*p)))
6538
p--;
6539
if ((p == tmp_pathspec) && (!IS_DIR_SEPARATOR (*p)))
6540
{
6541
/* no more DIR_SEPARATORS left */
6542
break;
6543
}
6544
*p = '\0';
6545
}
6546
else
6547
{
6548
lt_fatal (__FILE__, __LINE__,
6549
"error accessing file \"%s\": %s",
6550
tmp_pathspec, nonnull (strerror (errno)));
6551
}
6552
}
6553
XFREE (tmp_pathspec);
6554
6555
if (!has_symlinks)
6556
{
6557
return xstrdup (pathspec);
6558
}
6559
6560
tmp_pathspec = realpath (pathspec, buf);
6561
if (tmp_pathspec == 0)
6562
{
6563
lt_fatal (__FILE__, __LINE__,
6564
"could not follow symlinks for %s", pathspec);
6565
}
6566
return xstrdup (tmp_pathspec);
6567
#endif
6568
}
6569
6570
char *
6571
strendzap (char *str, const char *pat)
6572
{
6573
size_t len, patlen;
6574
6575
assert (str != NULL);
6576
assert (pat != NULL);
6577
6578
len = strlen (str);
6579
patlen = strlen (pat);
6580
6581
if (patlen <= len)
6582
{
6583
str += len - patlen;
6584
if (STREQ (str, pat))
6585
*str = '\0';
6586
}
6587
return str;
6588
}
6589
6590
void
6591
lt_debugprintf (const char *file, int line, const char *fmt, ...)
6592
{
6593
va_list args;
6594
if (lt_debug)
6595
{
6596
(void) fprintf (stderr, "%s:%s:%d: ", program_name, file, line);
6597
va_start (args, fmt);
6598
(void) vfprintf (stderr, fmt, args);
6599
va_end (args);
6600
}
6601
}
6602
6603
static void
6604
lt_error_core (int exit_status, const char *file,
6605
int line, const char *mode,
6606
const char *message, va_list ap)
6607
{
6608
fprintf (stderr, "%s:%s:%d: %s: ", program_name, file, line, mode);
6609
vfprintf (stderr, message, ap);
6610
fprintf (stderr, ".\n");
6611
6612
if (exit_status >= 0)
6613
exit (exit_status);
6614
}
6615
6616
void
6617
lt_fatal (const char *file, int line, const char *message, ...)
6618
{
6619
va_list ap;
6620
va_start (ap, message);
6621
lt_error_core (EXIT_FAILURE, file, line, "FATAL", message, ap);
6622
va_end (ap);
6623
}
6624
6625
static const char *
6626
nonnull (const char *s)
6627
{
6628
return s ? s : "(null)";
6629
}
6630
6631
static const char *
6632
nonempty (const char *s)
6633
{
6634
return (s && !*s) ? "(empty)" : nonnull (s);
6635
}
6636
6637
void
6638
lt_setenv (const char *name, const char *value)
6639
{
6640
lt_debugprintf (__FILE__, __LINE__,
6641
"(lt_setenv) setting '%s' to '%s'\n",
6642
nonnull (name), nonnull (value));
6643
{
6644
#ifdef HAVE_SETENV
6645
/* always make a copy, for consistency with !HAVE_SETENV */
6646
char *str = xstrdup (value);
6647
setenv (name, str, 1);
6648
#else
6649
size_t len = strlen (name) + 1 + strlen (value) + 1;
6650
char *str = XMALLOC (char, len);
6651
sprintf (str, "%s=%s", name, value);
6652
if (putenv (str) != EXIT_SUCCESS)
6653
{
6654
XFREE (str);
6655
}
6656
#endif
6657
}
6658
}
6659
6660
char *
6661
lt_extend_str (const char *orig_value, const char *add, int to_end)
6662
{
6663
char *new_value;
6664
if (orig_value && *orig_value)
6665
{
6666
size_t orig_value_len = strlen (orig_value);
6667
size_t add_len = strlen (add);
6668
new_value = XMALLOC (char, add_len + orig_value_len + 1);
6669
if (to_end)
6670
{
6671
strcpy (new_value, orig_value);
6672
strcpy (new_value + orig_value_len, add);
6673
}
6674
else
6675
{
6676
strcpy (new_value, add);
6677
strcpy (new_value + add_len, orig_value);
6678
}
6679
}
6680
else
6681
{
6682
new_value = xstrdup (add);
6683
}
6684
return new_value;
6685
}
6686
6687
void
6688
lt_update_exe_path (const char *name, const char *value)
6689
{
6690
lt_debugprintf (__FILE__, __LINE__,
6691
"(lt_update_exe_path) modifying '%s' by prepending '%s'\n",
6692
nonnull (name), nonnull (value));
6693
6694
if (name && *name && value && *value)
6695
{
6696
char *new_value = lt_extend_str (getenv (name), value, 0);
6697
/* some systems can't cope with a ':'-terminated path #' */
6698
size_t len = strlen (new_value);
6699
while ((len > 0) && IS_PATH_SEPARATOR (new_value[len-1]))
6700
{
6701
new_value[--len] = '\0';
6702
}
6703
lt_setenv (name, new_value);
6704
XFREE (new_value);
6705
}
6706
}
6707
6708
void
6709
lt_update_lib_path (const char *name, const char *value)
6710
{
6711
lt_debugprintf (__FILE__, __LINE__,
6712
"(lt_update_lib_path) modifying '%s' by prepending '%s'\n",
6713
nonnull (name), nonnull (value));
6714
6715
if (name && *name && value && *value)
6716
{
6717
char *new_value = lt_extend_str (getenv (name), value, 0);
6718
lt_setenv (name, new_value);
6719
XFREE (new_value);
6720
}
6721
}
6722
6723
EOF
6724
case $host_os in
6725
mingw* | windows*)
6726
cat <<"EOF"
6727
6728
/* Prepares an argument vector before calling spawn().
6729
Note that spawn() does not by itself call the command interpreter
6730
(getenv ("COMSPEC") != NULL ? getenv ("COMSPEC") :
6731
({ OSVERSIONINFO v; v.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
6732
GetVersionEx(&v);
6733
v.dwPlatformId == VER_PLATFORM_WIN32_NT;
6734
}) ? "cmd.exe" : "command.com").
6735
Instead it simply concatenates the arguments, separated by ' ', and calls
6736
CreateProcess(). We must quote the arguments since Win32 CreateProcess()
6737
interprets characters like ' ', '\t', '\\', '"' (but not '<' and '>') in a
6738
special way:
6739
- Space and tab are interpreted as delimiters. They are not treated as
6740
delimiters if they are surrounded by double quotes: "...".
6741
- Unescaped double quotes are removed from the input. Their only effect is
6742
that within double quotes, space and tab are treated like normal
6743
characters.
6744
- Backslashes not followed by double quotes are not special.
6745
- But 2*n+1 backslashes followed by a double quote become
6746
n backslashes followed by a double quote (n >= 0):
6747
\" -> "
6748
\\\" -> \"
6749
\\\\\" -> \\"
6750
*/
6751
#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"
6752
#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"
6753
char **
6754
prepare_spawn (char **argv)
6755
{
6756
size_t argc;
6757
char **new_argv;
6758
size_t i;
6759
6760
/* Count number of arguments. */
6761
for (argc = 0; argv[argc] != NULL; argc++)
6762
;
6763
6764
/* Allocate new argument vector. */
6765
new_argv = XMALLOC (char *, argc + 1);
6766
6767
/* Put quoted arguments into the new argument vector. */
6768
for (i = 0; i < argc; i++)
6769
{
6770
const char *string = argv[i];
6771
6772
if (string[0] == '\0')
6773
new_argv[i] = xstrdup ("\"\"");
6774
else if (strpbrk (string, SHELL_SPECIAL_CHARS) != NULL)
6775
{
6776
int quote_around = (strpbrk (string, SHELL_SPACE_CHARS) != NULL);
6777
size_t length;
6778
unsigned int backslashes;
6779
const char *s;
6780
char *quoted_string;
6781
char *p;
6782
6783
length = 0;
6784
backslashes = 0;
6785
if (quote_around)
6786
length++;
6787
for (s = string; *s != '\0'; s++)
6788
{
6789
char c = *s;
6790
if (c == '"')
6791
length += backslashes + 1;
6792
length++;
6793
if (c == '\\')
6794
backslashes++;
6795
else
6796
backslashes = 0;
6797
}
6798
if (quote_around)
6799
length += backslashes + 1;
6800
6801
quoted_string = XMALLOC (char, length + 1);
6802
6803
p = quoted_string;
6804
backslashes = 0;
6805
if (quote_around)
6806
*p++ = '"';
6807
for (s = string; *s != '\0'; s++)
6808
{
6809
char c = *s;
6810
if (c == '"')
6811
{
6812
unsigned int j;
6813
for (j = backslashes + 1; j > 0; j--)
6814
*p++ = '\\';
6815
}
6816
*p++ = c;
6817
if (c == '\\')
6818
backslashes++;
6819
else
6820
backslashes = 0;
6821
}
6822
if (quote_around)
6823
{
6824
unsigned int j;
6825
for (j = backslashes; j > 0; j--)
6826
*p++ = '\\';
6827
*p++ = '"';
6828
}
6829
*p = '\0';
6830
6831
new_argv[i] = quoted_string;
6832
}
6833
else
6834
new_argv[i] = (char *) string;
6835
}
6836
new_argv[argc] = NULL;
6837
6838
return new_argv;
6839
}
6840
EOF
6841
;;
6842
esac
6843
6844
cat <<"EOF"
6845
void lt_dump_script (FILE* f)
6846
{
6847
EOF
6848
func_emit_wrapper yes |
6849
$SED -n -e '
6850
s/^\(.\{79\}\)\(..*\)/\1\
6851
\2/
6852
h
6853
s/\([\\"]\)/\\\1/g
6854
s/$/\\n/
6855
s/\([^\n]*\).*/ fputs ("\1", f);/p
6856
g
6857
D'
6858
cat <<"EOF"
6859
}
6860
EOF
6861
}
6862
# end: func_emit_cwrapperexe_src
6863
6864
# func_win32_import_lib_p ARG
6865
# True if ARG is an import lib, as indicated by $file_magic_cmd
6866
func_win32_import_lib_p ()
6867
{
6868
$debug_cmd
6869
6870
case `eval $file_magic_cmd \"\$1\" 2>/dev/null | $SED -e 10q` in
6871
*import*) : ;;
6872
*) false ;;
6873
esac
6874
}
6875
6876
# func_suncc_cstd_abi
6877
# !!ONLY CALL THIS FOR SUN CC AFTER $compile_command IS FULLY EXPANDED!!
6878
# Several compiler flags select an ABI that is incompatible with the
6879
# Cstd library. Avoid specifying it if any are in CXXFLAGS.
6880
func_suncc_cstd_abi ()
6881
{
6882
$debug_cmd
6883
6884
case " $compile_command " in
6885
*" -compat=g "*|*\ -std=c++[0-9][0-9]\ *|*" -library=stdcxx4 "*|*" -library=stlport4 "*)
6886
suncc_use_cstd_abi=no
6887
;;
6888
*)
6889
suncc_use_cstd_abi=yes
6890
;;
6891
esac
6892
}
6893
6894
# func_mode_link arg...
6895
func_mode_link ()
6896
{
6897
$debug_cmd
6898
6899
case $host in
6900
*-*-cygwin* | *-*-mingw* | *-*-windows* | *-*-pw32* | *-*-os2* | *-cegcc*)
6901
# It is impossible to link a dll without this setting, and
6902
# we shouldn't force the makefile maintainer to figure out
6903
# what system we are compiling for in order to pass an extra
6904
# flag for every libtool invocation.
6905
# allow_undefined=no
6906
6907
# FIXME: Unfortunately, there are problems with the above when trying
6908
# to make a dll that has undefined symbols, in which case not
6909
# even a static library is built. For now, we need to specify
6910
# -no-undefined on the libtool link line when we can be certain
6911
# that all symbols are satisfied, otherwise we get a static library.
6912
allow_undefined=yes
6913
;;
6914
*)
6915
allow_undefined=yes
6916
;;
6917
esac
6918
libtool_args=$nonopt
6919
base_compile="$nonopt $@"
6920
compile_command=$nonopt
6921
finalize_command=$nonopt
6922
6923
compile_rpath=
6924
compile_rpath_tail=
6925
finalize_rpath=
6926
compile_shlibpath=
6927
finalize_shlibpath=
6928
convenience=
6929
old_convenience=
6930
deplibs=
6931
old_deplibs=
6932
compiler_flags=
6933
linker_flags=
6934
dllsearchpath=
6935
lib_search_path=`pwd`
6936
inst_prefix_dir=
6937
new_inherited_linker_flags=
6938
fix_hardcoded_libdir_flag=
6939
fix_hardcoded_libdir_flag_ld=
6940
6941
avoid_version=no
6942
bindir=
6943
dlfiles=
6944
dlprefiles=
6945
dlself=no
6946
export_dynamic=no
6947
export_symbols=
6948
export_symbols_regex=
6949
generated=
6950
libobjs=
6951
ltlibs=
6952
module=no
6953
no_install=no
6954
objs=
6955
os2dllname=
6956
non_pic_objects=
6957
precious_files_regex=
6958
prefer_static_libs=no
6959
preload=false
6960
prev=
6961
prevarg=
6962
release=
6963
rpath=
6964
xrpath=
6965
perm_rpath=
6966
temp_rpath=
6967
temp_rpath_tail=
6968
thread_safe=no
6969
vinfo=
6970
vinfo_number=no
6971
weak_libs=
6972
rpath_arg=
6973
single_module=$wl-single_module
6974
func_infer_tag $base_compile
6975
6976
# We need to know -static, to get the right output filenames.
6977
for arg
6978
do
6979
case $arg in
6980
-shared)
6981
test yes != "$build_libtool_libs" \
6982
&& func_fatal_configuration "cannot build a shared library"
6983
build_old_libs=no
6984
break
6985
;;
6986
-all-static | -static | -static-libtool-libs)
6987
case $arg in
6988
-all-static)
6989
if test yes = "$build_libtool_libs" && test -z "$link_static_flag"; then
6990
func_warning "complete static linking is impossible in this configuration"
6991
fi
6992
if test -n "$link_static_flag"; then
6993
dlopen_self=$dlopen_self_static
6994
fi
6995
prefer_static_libs=yes
6996
;;
6997
-static)
6998
if test -z "$pic_flag" && test -n "$link_static_flag"; then
6999
dlopen_self=$dlopen_self_static
7000
fi
7001
prefer_static_libs=built
7002
;;
7003
-static-libtool-libs)
7004
if test -z "$pic_flag" && test -n "$link_static_flag"; then
7005
dlopen_self=$dlopen_self_static
7006
fi
7007
prefer_static_libs=yes
7008
;;
7009
esac
7010
build_libtool_libs=no
7011
build_old_libs=yes
7012
break
7013
;;
7014
esac
7015
done
7016
7017
# See if our shared archives depend on static archives.
7018
test -n "$old_archive_from_new_cmds" && build_old_libs=yes
7019
7020
# Go through the arguments, transforming them on the way.
7021
while test "$#" -gt 0; do
7022
arg=$1
7023
shift
7024
func_quote_arg pretty,unquoted "$arg"
7025
qarg=$func_quote_arg_unquoted_result
7026
func_append libtool_args " $func_quote_arg_result"
7027
7028
# If the previous option needs an argument, assign it.
7029
if test -n "$prev"; then
7030
case $prev in
7031
output)
7032
func_append compile_command " @OUTPUT@"
7033
func_append finalize_command " @OUTPUT@"
7034
;;
7035
esac
7036
7037
case $prev in
7038
bindir)
7039
bindir=$arg
7040
prev=
7041
continue
7042
;;
7043
dlfiles|dlprefiles)
7044
$preload || {
7045
# Add the symbol object into the linking commands.
7046
func_append compile_command " @SYMFILE@"
7047
func_append finalize_command " @SYMFILE@"
7048
preload=:
7049
}
7050
case $arg in
7051
*.la | *.lo) ;; # We handle these cases below.
7052
force)
7053
if test no = "$dlself"; then
7054
dlself=needless
7055
export_dynamic=yes
7056
fi
7057
prev=
7058
continue
7059
;;
7060
self)
7061
if test dlprefiles = "$prev"; then
7062
dlself=yes
7063
elif test dlfiles = "$prev" && test yes != "$dlopen_self"; then
7064
dlself=yes
7065
else
7066
dlself=needless
7067
export_dynamic=yes
7068
fi
7069
prev=
7070
continue
7071
;;
7072
*)
7073
if test dlfiles = "$prev"; then
7074
func_append dlfiles " $arg"
7075
else
7076
func_append dlprefiles " $arg"
7077
fi
7078
prev=
7079
continue
7080
;;
7081
esac
7082
;;
7083
expsyms)
7084
export_symbols=$arg
7085
test -f "$arg" \
7086
|| func_fatal_error "symbol file '$arg' does not exist"
7087
prev=
7088
continue
7089
;;
7090
expsyms_regex)
7091
export_symbols_regex=$arg
7092
prev=
7093
continue
7094
;;
7095
framework)
7096
case $host in
7097
*-*-darwin*)
7098
case "$deplibs " in
7099
*" $qarg.ltframework "*) ;;
7100
*) func_append deplibs " $qarg.ltframework" # this is fixed later
7101
;;
7102
esac
7103
;;
7104
esac
7105
prev=
7106
continue
7107
;;
7108
inst_prefix)
7109
inst_prefix_dir=$arg
7110
prev=
7111
continue
7112
;;
7113
mllvm)
7114
# Clang does not use LLVM to link, so we can simply discard any
7115
# '-mllvm $arg' options when doing the link step.
7116
prev=
7117
continue
7118
;;
7119
objectlist)
7120
if test -f "$arg"; then
7121
save_arg=$arg
7122
moreargs=
7123
for fil in `cat "$save_arg"`
7124
do
7125
# func_append moreargs " $fil"
7126
arg=$fil
7127
# A libtool-controlled object.
7128
7129
# Check to see that this really is a libtool object.
7130
if func_lalib_unsafe_p "$arg"; then
7131
pic_object=
7132
non_pic_object=
7133
7134
# Read the .lo file
7135
func_source "$arg"
7136
7137
if test -z "$pic_object" ||
7138
test -z "$non_pic_object" ||
7139
test none = "$pic_object" &&
7140
test none = "$non_pic_object"; then
7141
func_fatal_error "cannot find name of object for '$arg'"
7142
fi
7143
7144
# Extract subdirectory from the argument.
7145
func_dirname "$arg" "/" ""
7146
xdir=$func_dirname_result
7147
7148
if test none != "$pic_object"; then
7149
# Prepend the subdirectory the object is found in.
7150
pic_object=$xdir$pic_object
7151
7152
if test dlfiles = "$prev"; then
7153
if test yes = "$build_libtool_libs" && test yes = "$dlopen_support"; then
7154
func_append dlfiles " $pic_object"
7155
prev=
7156
continue
7157
else
7158
# If libtool objects are unsupported, then we need to preload.
7159
prev=dlprefiles
7160
fi
7161
fi
7162
7163
# CHECK ME: I think I busted this. -Ossama
7164
if test dlprefiles = "$prev"; then
7165
# Preload the old-style object.
7166
func_append dlprefiles " $pic_object"
7167
prev=
7168
fi
7169
7170
# A PIC object.
7171
func_append libobjs " $pic_object"
7172
arg=$pic_object
7173
fi
7174
7175
# Non-PIC object.
7176
if test none != "$non_pic_object"; then
7177
# Prepend the subdirectory the object is found in.
7178
non_pic_object=$xdir$non_pic_object
7179
7180
# A standard non-PIC object
7181
func_append non_pic_objects " $non_pic_object"
7182
if test -z "$pic_object" || test none = "$pic_object"; then
7183
arg=$non_pic_object
7184
fi
7185
else
7186
# If the PIC object exists, use it instead.
7187
# $xdir was prepended to $pic_object above.
7188
non_pic_object=$pic_object
7189
func_append non_pic_objects " $non_pic_object"
7190
fi
7191
else
7192
# Only an error if not doing a dry-run.
7193
if $opt_dry_run; then
7194
# Extract subdirectory from the argument.
7195
func_dirname "$arg" "/" ""
7196
xdir=$func_dirname_result
7197
7198
func_lo2o "$arg"
7199
pic_object=$xdir$objdir/$func_lo2o_result
7200
non_pic_object=$xdir$func_lo2o_result
7201
func_append libobjs " $pic_object"
7202
func_append non_pic_objects " $non_pic_object"
7203
else
7204
func_fatal_error "'$arg' is not a valid libtool object"
7205
fi
7206
fi
7207
done
7208
else
7209
func_fatal_error "link input file '$arg' does not exist"
7210
fi
7211
arg=$save_arg
7212
prev=
7213
continue
7214
;;
7215
os2dllname)
7216
os2dllname=$arg
7217
prev=
7218
continue
7219
;;
7220
precious_regex)
7221
precious_files_regex=$arg
7222
prev=
7223
continue
7224
;;
7225
release)
7226
release=-$arg
7227
prev=
7228
continue
7229
;;
7230
rpath | xrpath)
7231
# We need an absolute path.
7232
case $arg in
7233
[\\/]* | [A-Za-z]:[\\/]*) ;;
7234
*)
7235
func_fatal_error "argument to -rpath is not absolute: $arg"
7236
;;
7237
esac
7238
if test rpath = "$prev"; then
7239
case "$rpath " in
7240
*" $arg "*) ;;
7241
*) func_append rpath " $arg" ;;
7242
esac
7243
else
7244
case "$xrpath " in
7245
*" $arg "*) ;;
7246
*) func_append xrpath " $arg" ;;
7247
esac
7248
fi
7249
prev=
7250
continue
7251
;;
7252
shrext)
7253
shrext_cmds=$arg
7254
prev=
7255
continue
7256
;;
7257
weak)
7258
func_append weak_libs " $arg"
7259
prev=
7260
continue
7261
;;
7262
xassembler)
7263
func_append compiler_flags " -Xassembler $qarg"
7264
prev=
7265
func_append compile_command " -Xassembler $qarg"
7266
func_append finalize_command " -Xassembler $qarg"
7267
continue
7268
;;
7269
xcclinker)
7270
func_append linker_flags " $qarg"
7271
func_append compiler_flags " $qarg"
7272
prev=
7273
func_append compile_command " $qarg"
7274
func_append finalize_command " $qarg"
7275
continue
7276
;;
7277
xcompiler)
7278
func_append compiler_flags " $qarg"
7279
prev=
7280
func_append compile_command " $qarg"
7281
func_append finalize_command " $qarg"
7282
continue
7283
;;
7284
xlinker)
7285
func_append linker_flags " $qarg"
7286
func_append compiler_flags " $wl$qarg"
7287
prev=
7288
func_append compile_command " $wl$qarg"
7289
func_append finalize_command " $wl$qarg"
7290
continue
7291
;;
7292
*)
7293
eval "$prev=\"\$arg\""
7294
prev=
7295
continue
7296
;;
7297
esac
7298
fi # test -n "$prev"
7299
7300
prevarg=$arg
7301
7302
case $arg in
7303
-all-static)
7304
if test -n "$link_static_flag"; then
7305
# See comment for -static flag below, for more details.
7306
func_append compile_command " $link_static_flag"
7307
func_append finalize_command " $link_static_flag"
7308
fi
7309
continue
7310
;;
7311
7312
-allow-undefined)
7313
# FIXME: remove this flag sometime in the future.
7314
func_fatal_error "'-allow-undefined' must not be used because it is the default"
7315
;;
7316
7317
-avoid-version)
7318
avoid_version=yes
7319
continue
7320
;;
7321
7322
-bindir)
7323
prev=bindir
7324
continue
7325
;;
7326
7327
-dlopen)
7328
prev=dlfiles
7329
continue
7330
;;
7331
7332
-dlpreopen)
7333
prev=dlprefiles
7334
continue
7335
;;
7336
7337
-export-dynamic)
7338
export_dynamic=yes
7339
continue
7340
;;
7341
7342
-export-symbols | -export-symbols-regex)
7343
if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
7344
func_fatal_error "more than one -exported-symbols argument is not allowed"
7345
fi
7346
if test X-export-symbols = "X$arg"; then
7347
prev=expsyms
7348
else
7349
prev=expsyms_regex
7350
fi
7351
continue
7352
;;
7353
7354
-framework)
7355
prev=framework
7356
continue
7357
;;
7358
7359
-inst-prefix-dir)
7360
prev=inst_prefix
7361
continue
7362
;;
7363
7364
# The native IRIX linker understands -LANG:*, -LIST:* and -LNO:*
7365
# so, if we see these flags be careful not to treat them like -L
7366
-L[A-Z][A-Z]*:*)
7367
case $with_gcc/$host in
7368
no/*-*-irix* | /*-*-irix*)
7369
func_append compile_command " $arg"
7370
func_append finalize_command " $arg"
7371
;;
7372
esac
7373
continue
7374
;;
7375
7376
-L*)
7377
func_stripname "-L" '' "$arg"
7378
if test -z "$func_stripname_result"; then
7379
if test "$#" -gt 0; then
7380
func_fatal_error "require no space between '-L' and '$1'"
7381
else
7382
func_fatal_error "need path for '-L' option"
7383
fi
7384
fi
7385
func_resolve_sysroot "$func_stripname_result"
7386
dir=$func_resolve_sysroot_result
7387
# We need an absolute path.
7388
case $dir in
7389
[\\/]* | [A-Za-z]:[\\/]*) ;;
7390
*)
7391
absdir=`cd "$dir" && pwd`
7392
test -z "$absdir" && \
7393
func_fatal_error "cannot determine absolute directory name of '$dir'"
7394
dir=$absdir
7395
;;
7396
esac
7397
case "$deplibs " in
7398
*" -L$dir "* | *" $arg "*)
7399
# Will only happen for absolute or sysroot arguments
7400
;;
7401
*)
7402
# Preserve sysroot, but never include relative directories
7403
case $dir in
7404
[\\/]* | [A-Za-z]:[\\/]* | =*) func_append deplibs " $arg" ;;
7405
*) func_append deplibs " -L$dir" ;;
7406
esac
7407
func_append lib_search_path " $dir"
7408
;;
7409
esac
7410
case $host in
7411
*-*-cygwin* | *-*-mingw* | *-*-windows* | *-*-pw32* | *-*-os2* | *-cegcc*)
7412
testbindir=`$ECHO "$dir" | $SED 's*/lib$*/bin*'`
7413
case :$dllsearchpath: in
7414
*":$dir:"*) ;;
7415
::) dllsearchpath=$dir;;
7416
*) func_append dllsearchpath ":$dir";;
7417
esac
7418
case :$dllsearchpath: in
7419
*":$testbindir:"*) ;;
7420
::) dllsearchpath=$testbindir;;
7421
*) func_append dllsearchpath ":$testbindir";;
7422
esac
7423
;;
7424
esac
7425
continue
7426
;;
7427
7428
-l*)
7429
if test X-lc = "X$arg" || test X-lm = "X$arg"; then
7430
case $host in
7431
*-*-cygwin* | *-*-mingw* | *-*-windows* | *-*-pw32* | *-*-beos* | *-cegcc* | *-*-haiku*)
7432
# These systems don't actually have a C or math library (as such)
7433
continue
7434
;;
7435
*-*-os2*)
7436
# These systems don't actually have a C library (as such)
7437
test X-lc = "X$arg" && continue
7438
;;
7439
*-*-openbsd* | *-*-freebsd* | *-*-dragonfly* | *-*-midnightbsd*)
7440
# Do not include libc due to us having libc/libc_r.
7441
test X-lc = "X$arg" && continue
7442
;;
7443
*-*-rhapsody* | *-*-darwin1.[012])
7444
# Rhapsody C and math libraries are in the System framework
7445
func_append deplibs " System.ltframework"
7446
continue
7447
;;
7448
*-*-sco3.2v5* | *-*-sco5v6*)
7449
# Causes problems with __ctype
7450
test X-lc = "X$arg" && continue
7451
;;
7452
*-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
7453
# Compiler inserts libc in the correct place for threads to work
7454
test X-lc = "X$arg" && continue
7455
;;
7456
esac
7457
elif test X-lc_r = "X$arg"; then
7458
case $host in
7459
*-*-openbsd* | *-*-freebsd* | *-*-dragonfly* | *-*-midnightbsd*)
7460
# Do not include libc_r directly, use -pthread flag.
7461
continue
7462
;;
7463
esac
7464
fi
7465
func_append deplibs " $arg"
7466
continue
7467
;;
7468
7469
-mllvm)
7470
prev=mllvm
7471
continue
7472
;;
7473
7474
-module)
7475
module=yes
7476
continue
7477
;;
7478
7479
# Tru64 UNIX uses -model [arg] to determine the layout of C++
7480
# classes, name mangling, and exception handling.
7481
# Darwin uses the -arch flag to determine output architecture.
7482
# -q <option> for IBM XL C/C++ compiler.
7483
-model|-arch|-isysroot|--sysroot|-q)
7484
func_append compiler_flags " $arg"
7485
func_append compile_command " $arg"
7486
func_append finalize_command " $arg"
7487
prev=xcompiler
7488
continue
7489
;;
7490
# Solaris ld rejects as of 11.4. Refer to Oracle bug 22985199.
7491
-pthread)
7492
case $host in
7493
*solaris2*) ;;
7494
*)
7495
case "$new_inherited_linker_flags " in
7496
*" $arg "*) ;;
7497
* ) func_append new_inherited_linker_flags " $arg" ;;
7498
esac
7499
;;
7500
esac
7501
continue
7502
;;
7503
-mt|-mthreads|-kthread|-Kthread|-pthreads|--thread-safe \
7504
|-threads|-fopenmp|-fopenmp=*|-openmp|-mp|-xopenmp|-omp|-qsmp=*)
7505
func_append compiler_flags " $arg"
7506
func_append compile_command " $arg"
7507
func_append finalize_command " $arg"
7508
case "$new_inherited_linker_flags " in
7509
*" $arg "*) ;;
7510
* ) func_append new_inherited_linker_flags " $arg" ;;
7511
esac
7512
continue
7513
;;
7514
7515
-multi_module)
7516
single_module=$wl-multi_module
7517
continue
7518
;;
7519
7520
-no-fast-install)
7521
fast_install=no
7522
continue
7523
;;
7524
7525
-no-install)
7526
case $host in
7527
*-*-cygwin* | *-*-mingw* | *-*-windows* | *-*-pw32* | *-*-os2* | *-*-darwin* | *-cegcc*)
7528
# The PATH hackery in wrapper scripts is required on Windows
7529
# and Darwin in order for the loader to find any dlls it needs.
7530
func_warning "'-no-install' is ignored for $host"
7531
func_warning "assuming '-no-fast-install' instead"
7532
fast_install=no
7533
;;
7534
*) no_install=yes ;;
7535
esac
7536
continue
7537
;;
7538
7539
-no-undefined)
7540
allow_undefined=no
7541
continue
7542
;;
7543
7544
-objectlist)
7545
prev=objectlist
7546
continue
7547
;;
7548
7549
-os2dllname)
7550
prev=os2dllname
7551
continue
7552
;;
7553
7554
-o) prev=output ;;
7555
7556
-precious-files-regex)
7557
prev=precious_regex
7558
continue
7559
;;
7560
7561
-release)
7562
prev=release
7563
continue
7564
;;
7565
7566
-rpath)
7567
prev=rpath
7568
continue
7569
;;
7570
7571
-R)
7572
prev=xrpath
7573
continue
7574
;;
7575
7576
-R*)
7577
func_stripname '-R' '' "$arg"
7578
dir=$func_stripname_result
7579
# We need an absolute path.
7580
case $dir in
7581
[\\/]* | [A-Za-z]:[\\/]*) ;;
7582
=*)
7583
func_stripname '=' '' "$dir"
7584
dir=$lt_sysroot$func_stripname_result
7585
;;
7586
*)
7587
func_fatal_error "argument ($arg) to '-R' is not an absolute path: $dir"
7588
;;
7589
esac
7590
case "$xrpath " in
7591
*" $dir "*) ;;
7592
*) func_append xrpath " $dir" ;;
7593
esac
7594
continue
7595
;;
7596
7597
-shared)
7598
# The effects of -shared are defined in a previous loop.
7599
continue
7600
;;
7601
7602
-shrext)
7603
prev=shrext
7604
continue
7605
;;
7606
7607
-static | -static-libtool-libs)
7608
# The effects of -static are defined in a previous loop.
7609
# We used to do the same as -all-static on platforms that
7610
# didn't have a PIC flag, but the assumption that the effects
7611
# would be equivalent was wrong. It would break on at least
7612
# Digital Unix and AIX.
7613
continue
7614
;;
7615
7616
-thread-safe)
7617
thread_safe=yes
7618
continue
7619
;;
7620
7621
-version-info)
7622
prev=vinfo
7623
continue
7624
;;
7625
7626
-version-number)
7627
prev=vinfo
7628
vinfo_number=yes
7629
continue
7630
;;
7631
7632
-weak)
7633
prev=weak
7634
continue
7635
;;
7636
7637
-Wc,*)
7638
func_stripname '-Wc,' '' "$arg"
7639
args=$func_stripname_result
7640
arg=
7641
save_ifs=$IFS; IFS=,
7642
for flag in $args; do
7643
IFS=$save_ifs
7644
func_quote_arg pretty "$flag"
7645
func_append arg " $func_quote_arg_result"
7646
func_append compiler_flags " $func_quote_arg_result"
7647
done
7648
IFS=$save_ifs
7649
func_stripname ' ' '' "$arg"
7650
arg=$func_stripname_result
7651
;;
7652
7653
-Wl,*)
7654
func_stripname '-Wl,' '' "$arg"
7655
args=$func_stripname_result
7656
arg=
7657
save_ifs=$IFS; IFS=,
7658
for flag in $args; do
7659
IFS=$save_ifs
7660
func_quote_arg pretty "$flag"
7661
func_append arg " $wl$func_quote_arg_result"
7662
func_append compiler_flags " $wl$func_quote_arg_result"
7663
func_append linker_flags " $func_quote_arg_result"
7664
done
7665
IFS=$save_ifs
7666
func_stripname ' ' '' "$arg"
7667
arg=$func_stripname_result
7668
;;
7669
7670
-Xassembler)
7671
prev=xassembler
7672
continue
7673
;;
7674
7675
-Xcompiler)
7676
prev=xcompiler
7677
continue
7678
;;
7679
7680
-Xlinker)
7681
prev=xlinker
7682
continue
7683
;;
7684
7685
-XCClinker)
7686
prev=xcclinker
7687
continue
7688
;;
7689
7690
# -msg_* for osf cc
7691
-msg_*)
7692
func_quote_arg pretty "$arg"
7693
arg=$func_quote_arg_result
7694
;;
7695
7696
# Flags to be passed through unchanged, with rationale:
7697
# -64, -mips[0-9] enable 64-bit mode for the SGI compiler
7698
# -r[0-9][0-9]* specify processor for the SGI compiler
7699
# -xarch=*, -xtarget=* enable 64-bit mode for the Sun compiler
7700
# +DA*, +DD* enable 64-bit mode for the HP compiler
7701
# -q* compiler args for the IBM compiler
7702
# -m*, -t[45]*, -txscale* architecture-specific flags for GCC
7703
# -F/path path to uninstalled frameworks, gcc on darwin
7704
# -p, -pg, --coverage, -fprofile-* profiling flags for GCC
7705
# -fstack-protector* stack protector flags for GCC
7706
# @file GCC response files
7707
# -tp=* Portland pgcc target processor selection
7708
# --sysroot=* for sysroot support
7709
# -O*, -g*, -flto*, -fwhopr*, -fuse-linker-plugin GCC link-time optimization
7710
# -specs=* GCC specs files
7711
# -stdlib=* select c++ std lib with clang
7712
# -fdiagnostics-color* simply affects output
7713
# -frecord-gcc-switches used to verify flags were respected
7714
# -fsanitize=* Clang/GCC memory and address sanitizer
7715
# -fno-sanitize* Clang/GCC memory and address sanitizer
7716
# -shared-libsan Link with shared sanitizer runtimes (Clang)
7717
# -static-libsan Link with static sanitizer runtimes (Clang)
7718
# -no-canonical-prefixes Do not expand any symbolic links
7719
# -fuse-ld=* Linker select flags for GCC
7720
# -static-* direct GCC to link specific libraries statically
7721
# -fcilkplus Cilk Plus language extension features for C/C++
7722
# -rtlib=* select c runtime lib with clang
7723
# --unwindlib=* select unwinder library with clang
7724
# -f{file|debug|macro|profile}-prefix-map=* needed for lto linking
7725
# -Wa,* Pass flags directly to the assembler
7726
# -Werror, -Werror=* Report (specified) warnings as errors
7727
-64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \
7728
-t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*|-tp=*|--sysroot=*| \
7729
-O*|-g*|-flto*|-fwhopr*|-fuse-linker-plugin|-fstack-protector*|-no-canonical-prefixes| \
7730
-stdlib=*|-rtlib=*|--unwindlib=*| \
7731
-specs=*|-fsanitize=*|-fno-sanitize*|-shared-libsan|-static-libsan| \
7732
-ffile-prefix-map=*|-fdebug-prefix-map=*|-fmacro-prefix-map=*|-fprofile-prefix-map=*| \
7733
-fdiagnostics-color*|-frecord-gcc-switches| \
7734
-fuse-ld=*|-static-*|-fcilkplus|-Wa,*|-Werror|-Werror=*)
7735
func_quote_arg pretty "$arg"
7736
arg=$func_quote_arg_result
7737
func_append compile_command " $arg"
7738
func_append finalize_command " $arg"
7739
func_append compiler_flags " $arg"
7740
continue
7741
;;
7742
7743
-Z*)
7744
if test os2 = "`expr $host : '.*\(os2\)'`"; then
7745
# OS/2 uses -Zxxx to specify OS/2-specific options
7746
compiler_flags="$compiler_flags $arg"
7747
func_append compile_command " $arg"
7748
func_append finalize_command " $arg"
7749
case $arg in
7750
-Zlinker | -Zstack)
7751
prev=xcompiler
7752
;;
7753
esac
7754
continue
7755
else
7756
# Otherwise treat like 'Some other compiler flag' below
7757
func_quote_arg pretty "$arg"
7758
arg=$func_quote_arg_result
7759
fi
7760
;;
7761
7762
# Some other compiler flag.
7763
-* | +*)
7764
func_quote_arg pretty "$arg"
7765
arg=$func_quote_arg_result
7766
;;
7767
7768
*.$objext)
7769
# A standard object.
7770
func_append objs " $arg"
7771
;;
7772
7773
*.lo)
7774
# A libtool-controlled object.
7775
7776
# Check to see that this really is a libtool object.
7777
if func_lalib_unsafe_p "$arg"; then
7778
pic_object=
7779
non_pic_object=
7780
7781
# Read the .lo file
7782
func_source "$arg"
7783
7784
if test -z "$pic_object" ||
7785
test -z "$non_pic_object" ||
7786
test none = "$pic_object" &&
7787
test none = "$non_pic_object"; then
7788
func_fatal_error "cannot find name of object for '$arg'"
7789
fi
7790
7791
# Extract subdirectory from the argument.
7792
func_dirname "$arg" "/" ""
7793
xdir=$func_dirname_result
7794
7795
test none = "$pic_object" || {
7796
# Prepend the subdirectory the object is found in.
7797
pic_object=$xdir$pic_object
7798
7799
if test dlfiles = "$prev"; then
7800
if test yes = "$build_libtool_libs" && test yes = "$dlopen_support"; then
7801
func_append dlfiles " $pic_object"
7802
prev=
7803
continue
7804
else
7805
# If libtool objects are unsupported, then we need to preload.
7806
prev=dlprefiles
7807
fi
7808
fi
7809
7810
# CHECK ME: I think I busted this. -Ossama
7811
if test dlprefiles = "$prev"; then
7812
# Preload the old-style object.
7813
func_append dlprefiles " $pic_object"
7814
prev=
7815
fi
7816
7817
# A PIC object.
7818
func_append libobjs " $pic_object"
7819
arg=$pic_object
7820
}
7821
7822
# Non-PIC object.
7823
if test none != "$non_pic_object"; then
7824
# Prepend the subdirectory the object is found in.
7825
non_pic_object=$xdir$non_pic_object
7826
7827
# A standard non-PIC object
7828
func_append non_pic_objects " $non_pic_object"
7829
if test -z "$pic_object" || test none = "$pic_object"; then
7830
arg=$non_pic_object
7831
fi
7832
else
7833
# If the PIC object exists, use it instead.
7834
# $xdir was prepended to $pic_object above.
7835
non_pic_object=$pic_object
7836
func_append non_pic_objects " $non_pic_object"
7837
fi
7838
else
7839
# Only an error if not doing a dry-run.
7840
if $opt_dry_run; then
7841
# Extract subdirectory from the argument.
7842
func_dirname "$arg" "/" ""
7843
xdir=$func_dirname_result
7844
7845
func_lo2o "$arg"
7846
pic_object=$xdir$objdir/$func_lo2o_result
7847
non_pic_object=$xdir$func_lo2o_result
7848
func_append libobjs " $pic_object"
7849
func_append non_pic_objects " $non_pic_object"
7850
else
7851
func_fatal_error "'$arg' is not a valid libtool object"
7852
fi
7853
fi
7854
;;
7855
7856
*.$libext)
7857
# An archive.
7858
func_append deplibs " $arg"
7859
func_append old_deplibs " $arg"
7860
continue
7861
;;
7862
7863
*.la)
7864
# A libtool-controlled library.
7865
7866
func_resolve_sysroot "$arg"
7867
if test dlfiles = "$prev"; then
7868
# This library was specified with -dlopen.
7869
func_append dlfiles " $func_resolve_sysroot_result"
7870
prev=
7871
elif test dlprefiles = "$prev"; then
7872
# The library was specified with -dlpreopen.
7873
func_append dlprefiles " $func_resolve_sysroot_result"
7874
prev=
7875
else
7876
func_append deplibs " $func_resolve_sysroot_result"
7877
fi
7878
continue
7879
;;
7880
7881
# Some other compiler argument.
7882
*)
7883
# Unknown arguments in both finalize_command and compile_command need
7884
# to be aesthetically quoted because they are evaled later.
7885
func_quote_arg pretty "$arg"
7886
arg=$func_quote_arg_result
7887
;;
7888
esac # arg
7889
7890
# Now actually substitute the argument into the commands.
7891
if test -n "$arg"; then
7892
if test -n "$rpath_arg"; then
7893
func_append finalize_rpath " ${arg##*,}"
7894
unset rpath_arg
7895
else
7896
case $arg in
7897
-Wl,-rpath,*)
7898
func_append finalize_rpath " ${arg##*,}";;
7899
-Wl,-rpath)
7900
rpath_arg=1;;
7901
*)
7902
func_append compile_command " $arg"
7903
func_append finalize_command " $arg"
7904
esac
7905
fi
7906
fi
7907
done # argument parsing loop
7908
7909
test -n "$prev" && \
7910
func_fatal_help "the '$prevarg' option requires an argument"
7911
7912
if test yes = "$export_dynamic" && test -n "$export_dynamic_flag_spec"; then
7913
eval arg=\"$export_dynamic_flag_spec\"
7914
func_append compile_command " $arg"
7915
func_append finalize_command " $arg"
7916
fi
7917
7918
oldlibs=
7919
# calculate the name of the file, without its directory
7920
func_basename "$output"
7921
outputname=$func_basename_result
7922
libobjs_save=$libobjs
7923
7924
if test -n "$shlibpath_var"; then
7925
# get the directories listed in $shlibpath_var
7926
eval shlib_search_path=\`\$ECHO \"\$$shlibpath_var\" \| \$SED \'s/:/ /g\'\`
7927
else
7928
shlib_search_path=
7929
fi
7930
eval sys_lib_search_path=\"$sys_lib_search_path_spec\"
7931
eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\"
7932
7933
# Definition is injected by LT_CONFIG during libtool generation.
7934
func_munge_path_list sys_lib_dlsearch_path "$LT_SYS_LIBRARY_PATH"
7935
7936
func_dirname "$output" "/" ""
7937
output_objdir=$func_dirname_result$objdir
7938
func_to_tool_file "$output_objdir/"
7939
tool_output_objdir=$func_to_tool_file_result
7940
# Create the object directory.
7941
func_mkdir_p "$output_objdir"
7942
7943
# Determine the type of output
7944
case $output in
7945
"")
7946
func_fatal_help "you must specify an output file"
7947
;;
7948
*.$libext) linkmode=oldlib ;;
7949
*.lo | *.$objext) linkmode=obj ;;
7950
*.la) linkmode=lib ;;
7951
*) linkmode=prog ;; # Anything else should be a program.
7952
esac
7953
7954
specialdeplibs=
7955
7956
libs=
7957
# Find all interdependent deplibs by searching for libraries
7958
# that are linked more than once (e.g. -la -lb -la)
7959
for deplib in $deplibs; do
7960
if $opt_preserve_dup_deps; then
7961
case "$libs " in
7962
*" $deplib "*) func_append specialdeplibs " $deplib" ;;
7963
esac
7964
fi
7965
func_append libs " $deplib"
7966
done
7967
7968
if test lib = "$linkmode"; then
7969
libs="$predeps $libs $compiler_lib_search_path $postdeps"
7970
7971
# Compute libraries that are listed more than once in $predeps
7972
# $postdeps and mark them as special (i.e., whose duplicates are
7973
# not to be eliminated).
7974
pre_post_deps=
7975
if $opt_duplicate_compiler_generated_deps; then
7976
for pre_post_dep in $predeps $postdeps; do
7977
case "$pre_post_deps " in
7978
*" $pre_post_dep "*) func_append specialdeplibs " $pre_post_deps" ;;
7979
esac
7980
func_append pre_post_deps " $pre_post_dep"
7981
done
7982
fi
7983
pre_post_deps=
7984
fi
7985
7986
deplibs=
7987
newdependency_libs=
7988
newlib_search_path=
7989
need_relink=no # whether we're linking any uninstalled libtool libraries
7990
notinst_deplibs= # not-installed libtool libraries
7991
notinst_path= # paths that contain not-installed libtool libraries
7992
7993
case $linkmode in
7994
lib)
7995
passes="conv dlpreopen link"
7996
for file in $dlfiles $dlprefiles; do
7997
case $file in
7998
*.la) ;;
7999
*)
8000
func_fatal_help "libraries can '-dlopen' only libtool libraries: $file"
8001
;;
8002
esac
8003
done
8004
;;
8005
prog)
8006
compile_deplibs=
8007
finalize_deplibs=
8008
alldeplibs=false
8009
newdlfiles=
8010
newdlprefiles=
8011
passes="conv scan dlopen dlpreopen link"
8012
;;
8013
*) passes="conv"
8014
;;
8015
esac
8016
8017
for pass in $passes; do
8018
# The preopen pass in lib mode reverses $deplibs; put it back here
8019
# so that -L comes before libs that need it for instance...
8020
if test lib,link = "$linkmode,$pass"; then
8021
## FIXME: Find the place where the list is rebuilt in the wrong
8022
## order, and fix it there properly
8023
tmp_deplibs=
8024
for deplib in $deplibs; do
8025
tmp_deplibs="$deplib $tmp_deplibs"
8026
done
8027
deplibs=$tmp_deplibs
8028
fi
8029
8030
if test lib,link = "$linkmode,$pass" ||
8031
test prog,scan = "$linkmode,$pass"; then
8032
libs=$deplibs
8033
deplibs=
8034
fi
8035
if test prog = "$linkmode"; then
8036
case $pass in
8037
dlopen) libs=$dlfiles ;;
8038
dlpreopen) libs=$dlprefiles ;;
8039
link) libs="$deplibs %DEPLIBS% $dependency_libs" ;;
8040
esac
8041
fi
8042
if test lib,dlpreopen = "$linkmode,$pass"; then
8043
# Collect and forward deplibs of preopened libtool libs
8044
for lib in $dlprefiles; do
8045
# Ignore non-libtool-libs
8046
dependency_libs=
8047
func_resolve_sysroot "$lib"
8048
case $lib in
8049
*.la) func_source "$func_resolve_sysroot_result" ;;
8050
esac
8051
8052
# Collect preopened libtool deplibs, except any this library
8053
# has declared as weak libs
8054
for deplib in $dependency_libs; do
8055
func_basename "$deplib"
8056
deplib_base=$func_basename_result
8057
case " $weak_libs " in
8058
*" $deplib_base "*) ;;
8059
*) func_append deplibs " $deplib" ;;
8060
esac
8061
done
8062
done
8063
libs=$dlprefiles
8064
fi
8065
if test dlopen = "$pass"; then
8066
# Collect dlpreopened libraries
8067
save_deplibs=$deplibs
8068
deplibs=
8069
fi
8070
8071
for deplib in $libs; do
8072
lib=
8073
found=false
8074
case $deplib in
8075
-mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe \
8076
|-threads|-fopenmp|-fopenmp=*|-openmp|-mp|-xopenmp|-omp|-qsmp=*)
8077
if test prog,link = "$linkmode,$pass"; then
8078
compile_deplibs="$deplib $compile_deplibs"
8079
finalize_deplibs="$deplib $finalize_deplibs"
8080
else
8081
func_append compiler_flags " $deplib"
8082
if test lib = "$linkmode"; then
8083
case "$new_inherited_linker_flags " in
8084
*" $deplib "*) ;;
8085
* ) func_append new_inherited_linker_flags " $deplib" ;;
8086
esac
8087
fi
8088
fi
8089
continue
8090
;;
8091
-l*)
8092
if test lib != "$linkmode" && test prog != "$linkmode"; then
8093
func_warning "'-l' is ignored for archives/objects"
8094
continue
8095
fi
8096
func_stripname '-l' '' "$deplib"
8097
name=$func_stripname_result
8098
if test lib = "$linkmode"; then
8099
searchdirs="$newlib_search_path $lib_search_path $compiler_lib_search_dirs $sys_lib_search_path $shlib_search_path"
8100
else
8101
searchdirs="$newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path"
8102
fi
8103
for searchdir in $searchdirs; do
8104
for search_ext in .la $std_shrext .so .a; do
8105
# Search the libtool library
8106
lib=$searchdir/lib$name$search_ext
8107
if test -f "$lib"; then
8108
if test .la = "$search_ext"; then
8109
found=:
8110
else
8111
found=false
8112
fi
8113
break 2
8114
fi
8115
done
8116
done
8117
if $found; then
8118
# deplib is a libtool library
8119
# If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib,
8120
# We need to do some special things here, and not later.
8121
if test yes = "$allow_libtool_libs_with_static_runtimes"; then
8122
case " $predeps $postdeps " in
8123
*" $deplib "*)
8124
if func_lalib_p "$lib"; then
8125
library_names=
8126
old_library=
8127
func_source "$lib"
8128
for l in $old_library $library_names; do
8129
ll=$l
8130
done
8131
if test "X$ll" = "X$old_library"; then # only static version available
8132
found=false
8133
func_dirname "$lib" "" "."
8134
ladir=$func_dirname_result
8135
lib=$ladir/$old_library
8136
if test prog,link = "$linkmode,$pass"; then
8137
compile_deplibs="$deplib $compile_deplibs"
8138
finalize_deplibs="$deplib $finalize_deplibs"
8139
else
8140
deplibs="$deplib $deplibs"
8141
test lib = "$linkmode" && newdependency_libs="$deplib $newdependency_libs"
8142
fi
8143
continue
8144
fi
8145
fi
8146
;;
8147
*) ;;
8148
esac
8149
fi
8150
else
8151
# deplib doesn't seem to be a libtool library
8152
if test prog,link = "$linkmode,$pass"; then
8153
compile_deplibs="$deplib $compile_deplibs"
8154
finalize_deplibs="$deplib $finalize_deplibs"
8155
else
8156
deplibs="$deplib $deplibs"
8157
test lib = "$linkmode" && newdependency_libs="$deplib $newdependency_libs"
8158
fi
8159
continue
8160
fi
8161
;; # -l
8162
*.ltframework)
8163
if test prog,link = "$linkmode,$pass"; then
8164
compile_deplibs="$deplib $compile_deplibs"
8165
finalize_deplibs="$deplib $finalize_deplibs"
8166
else
8167
deplibs="$deplib $deplibs"
8168
if test lib = "$linkmode"; then
8169
case "$new_inherited_linker_flags " in
8170
*" $deplib "*) ;;
8171
* ) func_append new_inherited_linker_flags " $deplib" ;;
8172
esac
8173
fi
8174
fi
8175
continue
8176
;;
8177
-L*)
8178
case $linkmode in
8179
lib)
8180
deplibs="$deplib $deplibs"
8181
test conv = "$pass" && continue
8182
newdependency_libs="$deplib $newdependency_libs"
8183
func_stripname '-L' '' "$deplib"
8184
func_resolve_sysroot "$func_stripname_result"
8185
func_append newlib_search_path " $func_resolve_sysroot_result"
8186
;;
8187
prog)
8188
if test conv = "$pass"; then
8189
deplibs="$deplib $deplibs"
8190
continue
8191
fi
8192
if test scan = "$pass"; then
8193
deplibs="$deplib $deplibs"
8194
else
8195
compile_deplibs="$deplib $compile_deplibs"
8196
finalize_deplibs="$deplib $finalize_deplibs"
8197
fi
8198
func_stripname '-L' '' "$deplib"
8199
func_resolve_sysroot "$func_stripname_result"
8200
func_append newlib_search_path " $func_resolve_sysroot_result"
8201
;;
8202
*)
8203
func_warning "'-L' is ignored for archives/objects"
8204
;;
8205
esac # linkmode
8206
continue
8207
;; # -L
8208
-R*)
8209
if test link = "$pass"; then
8210
func_stripname '-R' '' "$deplib"
8211
func_resolve_sysroot "$func_stripname_result"
8212
dir=$func_resolve_sysroot_result
8213
# Make sure the xrpath contains only unique directories.
8214
case "$xrpath " in
8215
*" $dir "*) ;;
8216
*) func_append xrpath " $dir" ;;
8217
esac
8218
fi
8219
deplibs="$deplib $deplibs"
8220
continue
8221
;;
8222
*.la)
8223
func_resolve_sysroot "$deplib"
8224
lib=$func_resolve_sysroot_result
8225
;;
8226
*.$libext)
8227
if test conv = "$pass"; then
8228
deplibs="$deplib $deplibs"
8229
continue
8230
fi
8231
case $linkmode in
8232
lib)
8233
# Linking convenience modules into shared libraries is allowed,
8234
# but linking other static libraries is non-portable.
8235
case " $dlpreconveniencelibs " in
8236
*" $deplib "*) ;;
8237
*)
8238
valid_a_lib=false
8239
case $deplibs_check_method in
8240
match_pattern*)
8241
set dummy $deplibs_check_method; shift
8242
match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
8243
if eval "\$ECHO \"$deplib\"" 2>/dev/null | $SED 10q \
8244
| $EGREP "$match_pattern_regex" > /dev/null; then
8245
valid_a_lib=:
8246
fi
8247
;;
8248
pass_all)
8249
valid_a_lib=:
8250
;;
8251
esac
8252
if $valid_a_lib; then
8253
func_warning "Linking the shared library $output against the static library $deplib is not portable!"
8254
deplibs="$deplib $deplibs"
8255
else
8256
func_warning "Trying to link with static lib archive $deplib."
8257
func_warning "I have the capability to make that library automatically link in when"
8258
func_warning "you link to this library. But I can only do this if you have a"
8259
func_warning "shared version of the library, which you do not appear to have"
8260
func_warning "because the file extensions .$libext of this argument makes me believe"
8261
func_warning "that it is just a static archive that I should not use here."
8262
fi
8263
;;
8264
esac
8265
continue
8266
;;
8267
prog)
8268
if test link != "$pass"; then
8269
deplibs="$deplib $deplibs"
8270
else
8271
compile_deplibs="$deplib $compile_deplibs"
8272
finalize_deplibs="$deplib $finalize_deplibs"
8273
fi
8274
continue
8275
;;
8276
esac # linkmode
8277
;; # *.$libext
8278
*.lo | *.$objext)
8279
if test conv = "$pass"; then
8280
deplibs="$deplib $deplibs"
8281
elif test prog = "$linkmode"; then
8282
if test dlpreopen = "$pass" || test yes != "$dlopen_support" || test no = "$build_libtool_libs"; then
8283
# If there is no dlopen support or we're linking statically,
8284
# we need to preload.
8285
func_append newdlprefiles " $deplib"
8286
compile_deplibs="$deplib $compile_deplibs"
8287
finalize_deplibs="$deplib $finalize_deplibs"
8288
else
8289
func_append newdlfiles " $deplib"
8290
fi
8291
fi
8292
continue
8293
;;
8294
%DEPLIBS%)
8295
alldeplibs=:
8296
continue
8297
;;
8298
esac # case $deplib
8299
8300
$found || test -f "$lib" \
8301
|| func_fatal_error "cannot find the library '$lib' or unhandled argument '$deplib'"
8302
8303
# Check to see that this really is a libtool archive.
8304
func_lalib_unsafe_p "$lib" \
8305
|| func_fatal_error "'$lib' is not a valid libtool archive"
8306
8307
func_dirname "$lib" "" "."
8308
ladir=$func_dirname_result
8309
8310
dlname=
8311
dlopen=
8312
dlpreopen=
8313
libdir=
8314
library_names=
8315
old_library=
8316
inherited_linker_flags=
8317
# If the library was installed with an old release of libtool,
8318
# it will not redefine variables installed, or shouldnotlink
8319
installed=yes
8320
shouldnotlink=no
8321
avoidtemprpath=
8322
8323
8324
# Read the .la file
8325
func_source "$lib"
8326
8327
# Convert "-framework foo" to "foo.ltframework"
8328
if test -n "$inherited_linker_flags"; then
8329
tmp_inherited_linker_flags=`$ECHO "$inherited_linker_flags" | $SED 's/-framework \([^ $]*\)/\1.ltframework/g'`
8330
for tmp_inherited_linker_flag in $tmp_inherited_linker_flags; do
8331
case " $new_inherited_linker_flags " in
8332
*" $tmp_inherited_linker_flag "*) ;;
8333
*) func_append new_inherited_linker_flags " $tmp_inherited_linker_flag";;
8334
esac
8335
done
8336
fi
8337
dependency_libs=`$ECHO " $dependency_libs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
8338
if test lib,link = "$linkmode,$pass" ||
8339
test prog,scan = "$linkmode,$pass" ||
8340
{ test prog != "$linkmode" && test lib != "$linkmode"; }; then
8341
test -n "$dlopen" && func_append dlfiles " $dlopen"
8342
test -n "$dlpreopen" && func_append dlprefiles " $dlpreopen"
8343
fi
8344
8345
if test conv = "$pass"; then
8346
# Only check for convenience libraries
8347
deplibs="$lib $deplibs"
8348
if test -z "$libdir"; then
8349
if test -z "$old_library"; then
8350
func_fatal_error "cannot find name of link library for '$lib'"
8351
fi
8352
# It is a libtool convenience library, so add in its objects.
8353
func_append convenience " $ladir/$objdir/$old_library"
8354
func_append old_convenience " $ladir/$objdir/$old_library"
8355
elif test prog != "$linkmode" && test lib != "$linkmode"; then
8356
func_fatal_error "'$lib' is not a convenience library"
8357
fi
8358
tmp_libs=
8359
for deplib in $dependency_libs; do
8360
deplibs="$deplib $deplibs"
8361
if $opt_preserve_dup_deps; then
8362
case "$tmp_libs " in
8363
*" $deplib "*) func_append specialdeplibs " $deplib" ;;
8364
esac
8365
fi
8366
func_append tmp_libs " $deplib"
8367
done
8368
continue
8369
fi # $pass = conv
8370
8371
8372
# Get the name of the library we link against.
8373
linklib=
8374
if test -n "$old_library" &&
8375
{ test yes = "$prefer_static_libs" ||
8376
test built,no = "$prefer_static_libs,$installed"; }; then
8377
linklib=$old_library
8378
else
8379
for l in $old_library $library_names; do
8380
linklib=$l
8381
done
8382
fi
8383
if test -z "$linklib"; then
8384
func_fatal_error "cannot find name of link library for '$lib'"
8385
fi
8386
8387
# This library was specified with -dlopen.
8388
if test dlopen = "$pass"; then
8389
test -z "$libdir" \
8390
&& func_fatal_error "cannot -dlopen a convenience library: '$lib'"
8391
if test -z "$dlname" ||
8392
test yes != "$dlopen_support" ||
8393
test no = "$build_libtool_libs"
8394
then
8395
# If there is no dlname, no dlopen support or we're linking
8396
# statically, we need to preload. We also need to preload any
8397
# dependent libraries so libltdl's deplib preloader doesn't
8398
# bomb out in the load deplibs phase.
8399
func_append dlprefiles " $lib $dependency_libs"
8400
else
8401
func_append newdlfiles " $lib"
8402
fi
8403
continue
8404
fi # $pass = dlopen
8405
8406
# We need an absolute path.
8407
case $ladir in
8408
[\\/]* | [A-Za-z]:[\\/]*) abs_ladir=$ladir ;;
8409
*)
8410
abs_ladir=`cd "$ladir" && pwd`
8411
if test -z "$abs_ladir"; then
8412
func_warning "cannot determine absolute directory name of '$ladir'"
8413
func_warning "passing it literally to the linker, although it might fail"
8414
abs_ladir=$ladir
8415
fi
8416
;;
8417
esac
8418
func_basename "$lib"
8419
laname=$func_basename_result
8420
8421
# Find the relevant object directory and library name.
8422
if test yes = "$installed"; then
8423
if test ! -f "$lt_sysroot$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then
8424
func_warning "library '$lib' was moved."
8425
dir=$ladir
8426
absdir=$abs_ladir
8427
libdir=$abs_ladir
8428
else
8429
dir=$lt_sysroot$libdir
8430
absdir=$lt_sysroot$libdir
8431
fi
8432
test yes = "$hardcode_automatic" && avoidtemprpath=yes
8433
else
8434
if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then
8435
dir=$ladir
8436
absdir=$abs_ladir
8437
# Remove this search path later
8438
func_append notinst_path " $abs_ladir"
8439
else
8440
dir=$ladir/$objdir
8441
absdir=$abs_ladir/$objdir
8442
# Remove this search path later
8443
func_append notinst_path " $abs_ladir"
8444
fi
8445
fi # $installed = yes
8446
func_stripname 'lib' '.la' "$laname"
8447
name=$func_stripname_result
8448
8449
# This library was specified with -dlpreopen.
8450
if test dlpreopen = "$pass"; then
8451
if test -z "$libdir" && test prog = "$linkmode"; then
8452
func_fatal_error "only libraries may -dlpreopen a convenience library: '$lib'"
8453
fi
8454
case $host in
8455
# special handling for platforms with PE-DLLs.
8456
*cygwin* | *mingw* | *windows* | *cegcc* )
8457
# Linker will automatically link against shared library if both
8458
# static and shared are present. Therefore, ensure we extract
8459
# symbols from the import library if a shared library is present
8460
# (otherwise, the dlopen module name will be incorrect). We do
8461
# this by putting the import library name into $newdlprefiles.
8462
# We recover the dlopen module name by 'saving' the la file
8463
# name in a special purpose variable, and (later) extracting the
8464
# dlname from the la file.
8465
if test -n "$dlname"; then
8466
func_tr_sh "$dir/$linklib"
8467
eval "libfile_$func_tr_sh_result=\$abs_ladir/\$laname"
8468
func_append newdlprefiles " $dir/$linklib"
8469
else
8470
func_append newdlprefiles " $dir/$old_library"
8471
# Keep a list of preopened convenience libraries to check
8472
# that they are being used correctly in the link pass.
8473
test -z "$libdir" && \
8474
func_append dlpreconveniencelibs " $dir/$old_library"
8475
fi
8476
;;
8477
* )
8478
# Prefer using a static library (so that no silly _DYNAMIC symbols
8479
# are required to link).
8480
if test -n "$old_library"; then
8481
func_append newdlprefiles " $dir/$old_library"
8482
# Keep a list of preopened convenience libraries to check
8483
# that they are being used correctly in the link pass.
8484
test -z "$libdir" && \
8485
func_append dlpreconveniencelibs " $dir/$old_library"
8486
# Otherwise, use the dlname, so that lt_dlopen finds it.
8487
elif test -n "$dlname"; then
8488
func_append newdlprefiles " $dir/$dlname"
8489
else
8490
func_append newdlprefiles " $dir/$linklib"
8491
fi
8492
;;
8493
esac
8494
fi # $pass = dlpreopen
8495
8496
if test -z "$libdir"; then
8497
# Link the convenience library
8498
if test lib = "$linkmode"; then
8499
deplibs="$dir/$old_library $deplibs"
8500
elif test prog,link = "$linkmode,$pass"; then
8501
compile_deplibs="$dir/$old_library $compile_deplibs"
8502
finalize_deplibs="$dir/$old_library $finalize_deplibs"
8503
else
8504
deplibs="$lib $deplibs" # used for prog,scan pass
8505
fi
8506
continue
8507
fi
8508
8509
8510
if test prog = "$linkmode" && test link != "$pass"; then
8511
func_append newlib_search_path " $ladir"
8512
deplibs="$lib $deplibs"
8513
8514
linkalldeplibs=false
8515
if test no != "$link_all_deplibs" || test -z "$library_names" ||
8516
test no = "$build_libtool_libs"; then
8517
linkalldeplibs=:
8518
fi
8519
8520
tmp_libs=
8521
for deplib in $dependency_libs; do
8522
case $deplib in
8523
-L*) func_stripname '-L' '' "$deplib"
8524
func_resolve_sysroot "$func_stripname_result"
8525
func_append newlib_search_path " $func_resolve_sysroot_result"
8526
;;
8527
esac
8528
# Need to link against all dependency_libs?
8529
if $linkalldeplibs; then
8530
deplibs="$deplib $deplibs"
8531
else
8532
# Need to hardcode shared library paths
8533
# or/and link against static libraries
8534
newdependency_libs="$deplib $newdependency_libs"
8535
fi
8536
if $opt_preserve_dup_deps; then
8537
case "$tmp_libs " in
8538
*" $deplib "*) func_append specialdeplibs " $deplib" ;;
8539
esac
8540
fi
8541
func_append tmp_libs " $deplib"
8542
done # for deplib
8543
continue
8544
fi # $linkmode = prog...
8545
8546
if test prog,link = "$linkmode,$pass"; then
8547
if test -n "$library_names" &&
8548
{ { test no = "$prefer_static_libs" ||
8549
test built,yes = "$prefer_static_libs,$installed"; } ||
8550
test -z "$old_library"; }; then
8551
# We need to hardcode the library path
8552
if test -n "$shlibpath_var" && test -z "$avoidtemprpath"; then
8553
# Make sure the rpath contains only unique directories.
8554
case $temp_rpath: in
8555
*"$absdir:"*) ;;
8556
*) case $absdir in
8557
"$progdir/"*) func_append temp_rpath "$absdir:" ;;
8558
*) func_append temp_rpath_tail "$absdir:" ;;
8559
esac
8560
esac
8561
fi
8562
8563
# Hardcode the library path.
8564
# Skip directories that are in the system default run-time
8565
# search path.
8566
case " $sys_lib_dlsearch_path " in
8567
*" $absdir "*) ;;
8568
*)
8569
case "$compile_rpath$compile_rpath_tail " in
8570
*" $absdir "*) ;;
8571
*) case $absdir in
8572
"$progdir/"*) func_append compile_rpath " $absdir" ;;
8573
*) func_append compile_rpath_tail " $absdir" ;;
8574
esac
8575
esac
8576
;;
8577
esac
8578
case " $sys_lib_dlsearch_path " in
8579
*" $libdir "*) ;;
8580
*)
8581
case "$finalize_rpath " in
8582
*" $libdir "*) ;;
8583
*) func_append finalize_rpath " $libdir" ;;
8584
esac
8585
;;
8586
esac
8587
fi # $linkmode,$pass = prog,link...
8588
8589
if $alldeplibs &&
8590
{ test pass_all = "$deplibs_check_method" ||
8591
{ test yes = "$build_libtool_libs" &&
8592
test -n "$library_names"; }; }; then
8593
# We only need to search for static libraries
8594
continue
8595
fi
8596
fi
8597
8598
link_static=no # Whether the deplib will be linked statically
8599
use_static_libs=$prefer_static_libs
8600
if test built = "$use_static_libs" && test yes = "$installed"; then
8601
use_static_libs=no
8602
fi
8603
if test -n "$library_names" &&
8604
{ test no = "$use_static_libs" || test -z "$old_library"; }; then
8605
case $host_os in
8606
cygwin* | mingw* | windows* | cegcc* | os2*)
8607
# No point in relinking DLLs because paths are not encoded
8608
func_append notinst_deplibs " $lib"
8609
need_relink=no
8610
;;
8611
*)
8612
if test no = "$installed"; then
8613
func_append notinst_deplibs " $lib"
8614
need_relink=yes
8615
fi
8616
;;
8617
esac
8618
# This is a shared library
8619
8620
# Warn about portability, can't link against -module's on some
8621
# systems (darwin). Don't bleat about dlopened modules though!
8622
dlopenmodule=
8623
for dlpremoduletest in $dlprefiles; do
8624
if test "X$dlpremoduletest" = "X$lib"; then
8625
dlopenmodule=$dlpremoduletest
8626
break
8627
fi
8628
done
8629
if test -z "$dlopenmodule" && test yes = "$shouldnotlink" && test link = "$pass"; then
8630
echo
8631
if test prog = "$linkmode"; then
8632
func_warning "Linking the executable $output against the loadable module"
8633
else
8634
func_warning "Linking the shared library $output against the loadable module"
8635
fi
8636
func_warning "$linklib is not portable!"
8637
fi
8638
if test lib = "$linkmode" &&
8639
test yes = "$hardcode_into_libs"; then
8640
# Hardcode the library path.
8641
# Skip directories that are in the system default run-time
8642
# search path.
8643
case " $sys_lib_dlsearch_path " in
8644
*" $absdir "*) ;;
8645
*)
8646
case "$compile_rpath$compile_rpath_tail " in
8647
*" $absdir "*) ;;
8648
*) case $absdir in
8649
"$progdir/"*) func_append compile_rpath " $absdir" ;;
8650
*) func_append compile_rpath_tail " $absdir" ;;
8651
esac
8652
esac
8653
;;
8654
esac
8655
case " $sys_lib_dlsearch_path " in
8656
*" $libdir "*) ;;
8657
*)
8658
case "$finalize_rpath " in
8659
*" $libdir "*) ;;
8660
*) func_append finalize_rpath " $libdir" ;;
8661
esac
8662
;;
8663
esac
8664
fi
8665
8666
if test -n "$old_archive_from_expsyms_cmds"; then
8667
# figure out the soname
8668
set dummy $library_names
8669
shift
8670
realname=$1
8671
shift
8672
libname=`eval "\\$ECHO \"$libname_spec\""`
8673
# use dlname if we got it. it's perfectly good, no?
8674
if test -n "$dlname"; then
8675
soname=$dlname
8676
elif test -n "$soname_spec"; then
8677
# bleh windows
8678
case $host_os in
8679
cygwin* | mingw* | windows* | cegcc* | os2*)
8680
func_arith $current - $age
8681
major=$func_arith_result
8682
versuffix=-$major
8683
;;
8684
esac
8685
eval soname=\"$soname_spec\"
8686
else
8687
soname=$realname
8688
fi
8689
8690
# Make a new name for the extract_expsyms_cmds to use
8691
soroot=$soname
8692
func_basename "$soroot"
8693
soname=$func_basename_result
8694
func_stripname 'lib' '.dll' "$soname"
8695
newlib=libimp-$func_stripname_result.a
8696
8697
# If the library has no export list, then create one now
8698
if test -f "$output_objdir/$soname-def"; then :
8699
else
8700
func_verbose "extracting exported symbol list from '$soname'"
8701
func_execute_cmds "$extract_expsyms_cmds" 'exit $?'
8702
fi
8703
8704
# Create $newlib
8705
if test -f "$output_objdir/$newlib"; then :; else
8706
func_verbose "generating import library for '$soname'"
8707
func_execute_cmds "$old_archive_from_expsyms_cmds" 'exit $?'
8708
fi
8709
# make sure the library variables are pointing to the new library
8710
dir=$output_objdir
8711
linklib=$newlib
8712
fi # test -n "$old_archive_from_expsyms_cmds"
8713
8714
if test prog = "$linkmode" || test relink != "$opt_mode"; then
8715
add_shlibpath=
8716
add_dir=
8717
add=
8718
lib_linked=yes
8719
case $hardcode_action in
8720
immediate | unsupported)
8721
if test no = "$hardcode_direct"; then
8722
add=$dir/$linklib
8723
case $host in
8724
*-*-sco3.2v5.0.[024]*) add_dir=-L$dir ;;
8725
*-*-sysv4*uw2*) add_dir=-L$dir ;;
8726
*-*-emscripten*) add_dir=-L$dir ;;
8727
*-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \
8728
*-*-unixware7*) add_dir=-L$dir ;;
8729
*-*-darwin* )
8730
# if the lib is a (non-dlopened) module then we cannot
8731
# link against it, someone is ignoring the earlier warnings
8732
if /usr/bin/file -L $add 2> /dev/null |
8733
$GREP ": [^:]* bundle" >/dev/null; then
8734
if test "X$dlopenmodule" != "X$lib"; then
8735
func_warning "lib $linklib is a module, not a shared library"
8736
if test -z "$old_library"; then
8737
func_warning "And there doesn't seem to be a static archive available"
8738
func_warning "The link will probably fail, sorry"
8739
else
8740
add=$dir/$old_library
8741
fi
8742
elif test -n "$old_library"; then
8743
add=$dir/$old_library
8744
fi
8745
fi
8746
esac
8747
elif test no = "$hardcode_minus_L"; then
8748
case $host in
8749
*-*-sunos*) add_shlibpath=$dir ;;
8750
esac
8751
add_dir=-L$dir
8752
add=-l$name
8753
elif test no = "$hardcode_shlibpath_var"; then
8754
add_shlibpath=$dir
8755
add=-l$name
8756
elif test -n "$fix_hardcoded_libdir_flag_spec"; then
8757
add_dir="-L${absdir}"
8758
add="-l$name"
8759
if test "${linkmode}" = prog && test "X${absdir}" != "X${libdir}"; then
8760
linkdir=$absdir
8761
eval "fix_hardcoded_libdir_flag=\"\${fix_hardcoded_libdir_flag} ${fix_hardcoded_libdir_flag_spec}\""
8762
# fix_hardcoded_libdir_flag_ld not needed, programs are linked with $CC
8763
$lt_unset linkdir
8764
fi
8765
else
8766
lib_linked=no
8767
fi
8768
;;
8769
relink)
8770
if test yes = "$hardcode_direct" &&
8771
test no = "$hardcode_direct_absolute"; then
8772
add=$dir/$linklib
8773
elif test yes = "$hardcode_minus_L"; then
8774
add_dir=-L$absdir
8775
# Try looking first in the location we're being installed to.
8776
if test -n "$inst_prefix_dir"; then
8777
case $libdir in
8778
[\\/]*)
8779
func_append add_dir " -L$inst_prefix_dir$libdir"
8780
;;
8781
esac
8782
fi
8783
add=-l$name
8784
elif test yes = "$hardcode_shlibpath_var"; then
8785
add_shlibpath=$dir
8786
add=-l$name
8787
else
8788
lib_linked=no
8789
fi
8790
;;
8791
*) lib_linked=no ;;
8792
esac
8793
8794
if test yes != "$lib_linked"; then
8795
func_fatal_configuration "unsupported hardcode properties"
8796
fi
8797
8798
if test -n "$add_shlibpath"; then
8799
case :$compile_shlibpath: in
8800
*":$add_shlibpath:"*) ;;
8801
*) func_append compile_shlibpath "$add_shlibpath:" ;;
8802
esac
8803
fi
8804
if test prog = "$linkmode"; then
8805
test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs"
8806
test -n "$add" && compile_deplibs="$add $compile_deplibs"
8807
else
8808
test -n "$add_dir" && deplibs="$add_dir $deplibs"
8809
test -n "$add" && deplibs="$add $deplibs"
8810
if test yes != "$hardcode_direct" &&
8811
test yes != "$hardcode_minus_L" &&
8812
test yes = "$hardcode_shlibpath_var"; then
8813
case :$finalize_shlibpath: in
8814
*":$libdir:"*) ;;
8815
*) func_append finalize_shlibpath "$libdir:" ;;
8816
esac
8817
fi
8818
fi
8819
fi
8820
8821
if test prog = "$linkmode" || test relink = "$opt_mode"; then
8822
add_shlibpath=
8823
add_dir=
8824
add=
8825
# Finalize command for both is simple: just hardcode it.
8826
if test yes = "$hardcode_direct" &&
8827
test no = "$hardcode_direct_absolute"; then
8828
add=$libdir/$linklib
8829
elif test yes = "$hardcode_minus_L"; then
8830
add_dir=-L$lt_sysroot$libdir
8831
add=-l$name
8832
if test -n "$inst_prefix_dir" &&
8833
test -f "$inst_prefix_dir$libdir/$linklib" &&
8834
test -n "${fix_hardcoded_libdir_flag_spec}"; then
8835
linkdir="$inst_prefix_dir$libdir"
8836
add_dir="-L$linkdir"
8837
eval "fix_hardcoded_libdir_flag=\"\${fix_hardcoded_libdir_flag} ${fix_hardcoded_libdir_flag_spec}\""
8838
eval "fix_hardcoded_libdir_flag_ld=\"\${fix_hardcoded_libdir_flag_ld} ${fix_hardcoded_libdir_flag_spec_ld}\""
8839
$lt_unset linkdir
8840
fi
8841
elif test yes = "$hardcode_shlibpath_var"; then
8842
case :$finalize_shlibpath: in
8843
*":$libdir:"*) ;;
8844
*) func_append finalize_shlibpath "$libdir:" ;;
8845
esac
8846
add=-l$name
8847
elif test yes = "$hardcode_automatic"; then
8848
if test -n "$inst_prefix_dir" &&
8849
test -f "$inst_prefix_dir$libdir/$linklib"; then
8850
add=$inst_prefix_dir$libdir/$linklib
8851
else
8852
add=$libdir/$linklib
8853
fi
8854
else
8855
# We cannot seem to hardcode it, guess we'll fake it.
8856
add_dir=-L$lt_sysroot$libdir
8857
# Try looking first in the location we're being installed to.
8858
if test -n "$inst_prefix_dir"; then
8859
case $libdir in
8860
[\\/]*)
8861
func_append add_dir " -L$inst_prefix_dir$libdir"
8862
;;
8863
esac
8864
fi
8865
add=-l$name
8866
fi
8867
8868
if test prog = "$linkmode"; then
8869
test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs"
8870
test -n "$add" && finalize_deplibs="$add $finalize_deplibs"
8871
else
8872
test -n "$add_dir" && deplibs="$add_dir $deplibs"
8873
test -n "$add" && deplibs="$add $deplibs"
8874
fi
8875
fi
8876
elif test prog = "$linkmode"; then
8877
# Here we assume that one of hardcode_direct or hardcode_minus_L
8878
# is not unsupported. This is valid on all known static and
8879
# shared platforms.
8880
if test unsupported != "$hardcode_direct"; then
8881
test -n "$old_library" && linklib=$old_library
8882
compile_deplibs="$dir/$linklib $compile_deplibs"
8883
finalize_deplibs="$dir/$linklib $finalize_deplibs"
8884
else
8885
compile_deplibs="-l$name -L$dir $compile_deplibs"
8886
finalize_deplibs="-l$name -L$dir $finalize_deplibs"
8887
fi
8888
elif test yes = "$build_libtool_libs"; then
8889
# Not a shared library
8890
if test pass_all != "$deplibs_check_method"; then
8891
# We're trying link a shared library against a static one
8892
# but the system doesn't support it.
8893
8894
# Just print a warning and add the library to dependency_libs so
8895
# that the program can be linked against the static library.
8896
func_warning "This system cannot link to static lib archive $lib."
8897
func_warning "I have the capability to make that library automatically link in when"
8898
func_warning "you link to this library. But I can only do this if you have a"
8899
func_warning "shared version of the library, which you do not appear to have."
8900
if test yes = "$module"; then
8901
func_warning "But as you try to build a module library, libtool will still create "
8902
func_warning "a static module, that should work as long as the dlopening application"
8903
func_warning "is linked with the -dlopen flag to resolve symbols at runtime."
8904
if test -z "$global_symbol_pipe"; then
8905
func_warning "However, this would only work if libtool was able to extract symbol"
8906
func_warning "lists from a program, using 'nm' or equivalent, but libtool could"
8907
func_warning "not find such a program. So, this module is probably useless."
8908
func_warning "'nm' from GNU binutils and a full rebuild may help."
8909
fi
8910
if test no = "$build_old_libs"; then
8911
build_libtool_libs=module
8912
build_old_libs=yes
8913
else
8914
build_libtool_libs=no
8915
fi
8916
fi
8917
else
8918
deplibs="$dir/$old_library $deplibs"
8919
link_static=yes
8920
fi
8921
fi # link shared/static library?
8922
8923
if test lib = "$linkmode"; then
8924
if test -n "$dependency_libs" &&
8925
{ test yes != "$hardcode_into_libs" ||
8926
test yes = "$build_old_libs" ||
8927
test yes = "$link_static"; }; then
8928
# Extract -R from dependency_libs
8929
temp_deplibs=
8930
for libdir in $dependency_libs; do
8931
case $libdir in
8932
-R*) func_stripname '-R' '' "$libdir"
8933
temp_xrpath=$func_stripname_result
8934
case " $xrpath " in
8935
*" $temp_xrpath "*) ;;
8936
*) func_append xrpath " $temp_xrpath";;
8937
esac;;
8938
*) func_append temp_deplibs " $libdir";;
8939
esac
8940
done
8941
dependency_libs=$temp_deplibs
8942
fi
8943
8944
func_append newlib_search_path " $absdir"
8945
# Link against this library
8946
test no = "$link_static" && newdependency_libs="$abs_ladir/$laname $newdependency_libs"
8947
# ... and its dependency_libs
8948
tmp_libs=
8949
for deplib in $dependency_libs; do
8950
newdependency_libs="$deplib $newdependency_libs"
8951
case $deplib in
8952
-L*) func_stripname '-L' '' "$deplib"
8953
func_resolve_sysroot "$func_stripname_result";;
8954
*) func_resolve_sysroot "$deplib" ;;
8955
esac
8956
if $opt_preserve_dup_deps; then
8957
case "$tmp_libs " in
8958
*" $func_resolve_sysroot_result "*)
8959
func_append specialdeplibs " $func_resolve_sysroot_result" ;;
8960
esac
8961
fi
8962
func_append tmp_libs " $func_resolve_sysroot_result"
8963
done
8964
8965
if test no != "$link_all_deplibs"; then
8966
# Add the search paths of all dependency libraries
8967
for deplib in $dependency_libs; do
8968
path=
8969
case $deplib in
8970
-L*) path=$deplib ;;
8971
*.la)
8972
func_resolve_sysroot "$deplib"
8973
deplib=$func_resolve_sysroot_result
8974
func_dirname "$deplib" "" "."
8975
dir=$func_dirname_result
8976
# We need an absolute path.
8977
case $dir in
8978
[\\/]* | [A-Za-z]:[\\/]*) absdir=$dir ;;
8979
*)
8980
absdir=`cd "$dir" && pwd`
8981
if test -z "$absdir"; then
8982
func_warning "cannot determine absolute directory name of '$dir'"
8983
absdir=$dir
8984
fi
8985
;;
8986
esac
8987
if $GREP "^installed=no" $deplib > /dev/null; then
8988
case $host in
8989
*-*-darwin*)
8990
depdepl=
8991
eval deplibrary_names=`$SED -n -e 's/^library_names=\(.*\)$/\1/p' $deplib`
8992
if test -n "$deplibrary_names"; then
8993
for tmp in $deplibrary_names; do
8994
depdepl=$tmp
8995
done
8996
if test -f "$absdir/$objdir/$depdepl"; then
8997
depdepl=$absdir/$objdir/$depdepl
8998
darwin_install_name=`$OTOOL -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'`
8999
if test -z "$darwin_install_name"; then
9000
darwin_install_name=`$OTOOL64 -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'`
9001
fi
9002
func_append compiler_flags " $wl-dylib_file $wl$darwin_install_name:$depdepl"
9003
func_append linker_flags " -dylib_file $darwin_install_name:$depdepl"
9004
path=
9005
fi
9006
fi
9007
;;
9008
*)
9009
path=-L$absdir/$objdir
9010
;;
9011
esac
9012
else
9013
eval libdir=`$SED -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
9014
test -z "$libdir" && \
9015
func_fatal_error "'$deplib' is not a valid libtool archive"
9016
test "$absdir" != "$libdir" && \
9017
func_warning "'$deplib' seems to be moved"
9018
9019
path=-L$absdir
9020
fi
9021
;;
9022
esac
9023
case " $deplibs " in
9024
*" $path "*) ;;
9025
*) deplibs="$path $deplibs" ;;
9026
esac
9027
done
9028
fi # link_all_deplibs != no
9029
fi # linkmode = lib
9030
done # for deplib in $libs
9031
9032
func_append temp_rpath "$temp_rpath_tail"
9033
func_append compile_rpath "$compile_rpath_tail"
9034
9035
if test link = "$pass"; then
9036
if test prog = "$linkmode"; then
9037
compile_deplibs="$new_inherited_linker_flags $compile_deplibs"
9038
finalize_deplibs="$new_inherited_linker_flags $finalize_deplibs"
9039
else
9040
compiler_flags="$compiler_flags "`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
9041
fi
9042
fi
9043
dependency_libs=$newdependency_libs
9044
if test dlpreopen = "$pass"; then
9045
# Link the dlpreopened libraries before other libraries
9046
for deplib in $save_deplibs; do
9047
deplibs="$deplib $deplibs"
9048
done
9049
fi
9050
if test dlopen != "$pass"; then
9051
test conv = "$pass" || {
9052
# Make sure lib_search_path contains only unique directories.
9053
lib_search_path=
9054
for dir in $newlib_search_path; do
9055
case "$lib_search_path " in
9056
*" $dir "*) ;;
9057
*) func_append lib_search_path " $dir" ;;
9058
esac
9059
done
9060
newlib_search_path=
9061
}
9062
9063
if test prog,link = "$linkmode,$pass"; then
9064
vars="compile_deplibs finalize_deplibs"
9065
else
9066
vars=deplibs
9067
fi
9068
for var in $vars dependency_libs; do
9069
# Add libraries to $var in reverse order
9070
eval tmp_libs=\"\$$var\"
9071
new_libs=
9072
# FIXME: Pedantically, this is the right thing to do, so
9073
# that some nasty dependency loop isn't accidentally
9074
# broken: new_libs="$deplib $new_libs"
9075
for deplib in $tmp_libs; do
9076
if $opt_preserve_dup_deps; then
9077
new_libs="$deplib $new_libs"
9078
else
9079
# Pragmatically, this seems to cause very few problems in
9080
# practice:
9081
case $deplib in
9082
-L*) new_libs="$deplib $new_libs" ;;
9083
-R*) ;;
9084
*)
9085
# And here is the reason: when a library appears more
9086
# than once as an explicit dependence of a library, or
9087
# is implicitly linked in more than once by the
9088
# compiler, it is considered special, and multiple
9089
# occurrences thereof are not removed. Compare this
9090
# with having the same library being listed as a
9091
# dependency of multiple other libraries: in this case,
9092
# we know (pedantically, we assume) the library does not
9093
# need to be listed more than once, so we keep only the
9094
# last copy. This is not always right, but it is rare
9095
# enough that we require users that really mean to play
9096
# such unportable linking tricks to link the library
9097
# using -Wl,-lname, so that libtool does not consider it
9098
# for duplicate removal. And if not possible for portability
9099
# reasons, then --preserve-dup-deps should be used.
9100
case " $specialdeplibs " in
9101
*" $deplib "*) new_libs="$deplib $new_libs" ;;
9102
*)
9103
case " $new_libs " in
9104
*" $deplib "*) ;;
9105
*) new_libs="$deplib $new_libs" ;;
9106
esac
9107
;;
9108
esac
9109
;;
9110
esac
9111
fi
9112
done
9113
tmp_libs=
9114
for deplib in $new_libs; do
9115
case $deplib in
9116
-L*)
9117
case " $tmp_libs " in
9118
*" $deplib "*) ;;
9119
*) func_append tmp_libs " $deplib" ;;
9120
esac
9121
;;
9122
*) func_append tmp_libs " $deplib" ;;
9123
esac
9124
done
9125
eval $var=\"$tmp_libs\"
9126
done # for var
9127
fi
9128
9129
# Add Sun CC postdeps if required:
9130
test CXX = "$tagname" && {
9131
case $host_os in
9132
linux*)
9133
case `$CC -V 2>&1 | $SED 5q` in
9134
*Sun\ C*) # Sun C++ 5.9
9135
func_suncc_cstd_abi
9136
9137
if test no != "$suncc_use_cstd_abi"; then
9138
func_append postdeps ' -library=Cstd -library=Crun'
9139
fi
9140
;;
9141
esac
9142
;;
9143
9144
solaris*)
9145
func_cc_basename "$CC"
9146
case $func_cc_basename_result in
9147
CC* | sunCC*)
9148
func_suncc_cstd_abi
9149
9150
if test no != "$suncc_use_cstd_abi"; then
9151
func_append postdeps ' -library=Cstd -library=Crun'
9152
fi
9153
;;
9154
esac
9155
;;
9156
esac
9157
}
9158
9159
# Last step: remove runtime libs from dependency_libs
9160
# (they stay in deplibs)
9161
tmp_libs=
9162
for i in $dependency_libs; do
9163
case " $predeps $postdeps $compiler_lib_search_path " in
9164
*" $i "*)
9165
i=
9166
;;
9167
esac
9168
if test -n "$i"; then
9169
func_append tmp_libs " $i"
9170
fi
9171
done
9172
dependency_libs=$tmp_libs
9173
done # for pass
9174
if test prog = "$linkmode"; then
9175
dlfiles=$newdlfiles
9176
fi
9177
if test prog = "$linkmode" || test lib = "$linkmode"; then
9178
dlprefiles=$newdlprefiles
9179
fi
9180
9181
case $linkmode in
9182
oldlib)
9183
if test -n "$dlfiles$dlprefiles" || test no != "$dlself"; then
9184
func_warning "'-dlopen' is ignored for archives"
9185
fi
9186
9187
case " $deplibs" in
9188
*\ -l* | *\ -L*)
9189
func_warning "'-l' and '-L' are ignored for archives" ;;
9190
esac
9191
9192
test -n "$rpath" && \
9193
func_warning "'-rpath' is ignored for archives"
9194
9195
test -n "$xrpath" && \
9196
func_warning "'-R' is ignored for archives"
9197
9198
test -n "$vinfo" && \
9199
func_warning "'-version-info/-version-number' is ignored for archives"
9200
9201
test -n "$release" && \
9202
func_warning "'-release' is ignored for archives"
9203
9204
test -n "$export_symbols$export_symbols_regex" && \
9205
func_warning "'-export-symbols' is ignored for archives"
9206
9207
# Now set the variables for building old libraries.
9208
build_libtool_libs=no
9209
oldlibs=$output
9210
func_append objs "$old_deplibs"
9211
;;
9212
9213
lib)
9214
# Make sure we only generate libraries of the form 'libNAME.la'.
9215
case $outputname in
9216
lib*)
9217
func_stripname 'lib' '.la' "$outputname"
9218
name=$func_stripname_result
9219
eval shared_ext=\"$shrext_cmds\"
9220
eval libname=\"$libname_spec\"
9221
;;
9222
*)
9223
if test no != "$need_lib_prefix"; then
9224
# Add the "lib" prefix for modules if required
9225
func_stripname '' '.la' "$outputname"
9226
name=$func_stripname_result
9227
eval shared_ext=\"$shrext_cmds\"
9228
eval libname=\"$libname_spec\"
9229
else
9230
func_stripname '' '.la' "$outputname"
9231
libname=$func_stripname_result
9232
fi
9233
;;
9234
esac
9235
9236
if test -n "$objs"; then
9237
if test pass_all != "$deplibs_check_method"; then
9238
func_fatal_error "cannot build libtool library '$output' from non-libtool objects on this host:$objs"
9239
else
9240
func_warning "Linking the shared library $output against the non-libtool objects $objs is not portable!"
9241
func_append libobjs " $objs"
9242
fi
9243
fi
9244
9245
test no = "$dlself" \
9246
|| func_warning "'-dlopen self' is ignored for libtool libraries"
9247
9248
set dummy $rpath
9249
shift
9250
test 1 -lt "$#" \
9251
&& func_warning "ignoring multiple '-rpath's for a libtool library"
9252
9253
install_libdir=$1
9254
9255
oldlibs=
9256
if test -z "$rpath"; then
9257
if test yes = "$build_libtool_libs"; then
9258
# Building a libtool convenience library.
9259
# Some compilers have problems with a '.al' extension so
9260
# convenience libraries should have the same extension an
9261
# archive normally would.
9262
oldlibs="$output_objdir/$libname.$libext $oldlibs"
9263
build_libtool_libs=convenience
9264
build_old_libs=yes
9265
fi
9266
9267
test -n "$vinfo" && \
9268
func_warning "'-version-info/-version-number' is ignored for convenience libraries"
9269
9270
test -n "$release" && \
9271
func_warning "'-release' is ignored for convenience libraries"
9272
else
9273
9274
# Parse the version information argument.
9275
save_ifs=$IFS; IFS=:
9276
set dummy $vinfo 0 0 0
9277
shift
9278
IFS=$save_ifs
9279
9280
test -n "$7" && \
9281
func_fatal_help "too many parameters to '-version-info'"
9282
9283
# convert absolute version numbers to libtool ages
9284
# this retains compatibility with .la files and attempts
9285
# to make the code below a bit more comprehensible
9286
9287
case $vinfo_number in
9288
yes)
9289
number_major=$1
9290
number_minor=$2
9291
number_revision=$3
9292
#
9293
# There are really only two kinds -- those that
9294
# use the current revision as the major version
9295
# and those that subtract age and use age as
9296
# a minor version. But, then there is irix
9297
# that has an extra 1 added just for fun
9298
#
9299
case $version_type in
9300
# correct linux to gnu/linux during the next big refactor
9301
darwin|freebsd-elf|linux|midnightbsd-elf|osf|qnx|windows|none)
9302
func_arith $number_major + $number_minor
9303
current=$func_arith_result
9304
age=$number_minor
9305
revision=$number_revision
9306
;;
9307
freebsd-aout|sco|sunos)
9308
current=$number_major
9309
revision=$number_minor
9310
age=0
9311
;;
9312
irix|nonstopux)
9313
func_arith $number_major + $number_minor
9314
current=$func_arith_result
9315
age=$number_minor
9316
revision=$number_minor
9317
lt_irix_increment=no
9318
;;
9319
*)
9320
func_fatal_configuration "$modename: unknown library version type '$version_type'"
9321
;;
9322
esac
9323
;;
9324
no)
9325
current=$1
9326
revision=$2
9327
age=$3
9328
;;
9329
esac
9330
9331
# Check that each of the things are valid numbers.
9332
case $current in
9333
0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;;
9334
*)
9335
func_error "CURRENT '$current' must be a nonnegative integer"
9336
func_fatal_error "'$vinfo' is not valid version information"
9337
;;
9338
esac
9339
9340
case $revision in
9341
0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;;
9342
*)
9343
func_error "REVISION '$revision' must be a nonnegative integer"
9344
func_fatal_error "'$vinfo' is not valid version information"
9345
;;
9346
esac
9347
9348
case $age in
9349
0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;;
9350
*)
9351
func_error "AGE '$age' must be a nonnegative integer"
9352
func_fatal_error "'$vinfo' is not valid version information"
9353
;;
9354
esac
9355
9356
if test "$age" -gt "$current"; then
9357
func_error "AGE '$age' is greater than the current interface number '$current'"
9358
func_fatal_error "'$vinfo' is not valid version information"
9359
fi
9360
9361
# Calculate the version variables.
9362
major=
9363
versuffix=
9364
verstring=
9365
case $version_type in
9366
none) ;;
9367
9368
darwin)
9369
# Like Linux, but with the current version available in
9370
# verstring for coding it into the library header
9371
func_arith $current - $age
9372
major=.$func_arith_result
9373
versuffix=$major.$age.$revision
9374
# Darwin ld doesn't like 0 for these options...
9375
func_arith $current + 1
9376
minor_current=$func_arith_result
9377
xlcverstring="$wl-compatibility_version $wl$minor_current $wl-current_version $wl$minor_current.$revision"
9378
verstring="-compatibility_version $minor_current -current_version $minor_current.$revision"
9379
# On Darwin other compilers
9380
case $CC in
9381
nagfor*)
9382
verstring="$wl-compatibility_version $wl$minor_current $wl-current_version $wl$minor_current.$revision"
9383
;;
9384
*)
9385
verstring="-compatibility_version $minor_current -current_version $minor_current.$revision"
9386
;;
9387
esac
9388
;;
9389
9390
freebsd-aout)
9391
major=.$current
9392
versuffix=.$current.$revision
9393
;;
9394
9395
freebsd-elf | midnightbsd-elf)
9396
func_arith $current - $age
9397
major=.$func_arith_result
9398
versuffix=$major.$age.$revision
9399
;;
9400
9401
irix | nonstopux)
9402
if test no = "$lt_irix_increment"; then
9403
func_arith $current - $age
9404
else
9405
func_arith $current - $age + 1
9406
fi
9407
major=$func_arith_result
9408
9409
case $version_type in
9410
nonstopux) verstring_prefix=nonstopux ;;
9411
*) verstring_prefix=sgi ;;
9412
esac
9413
verstring=$verstring_prefix$major.$revision
9414
9415
# Add in all the interfaces that we are compatible with.
9416
loop=$revision
9417
while test 0 -ne "$loop"; do
9418
func_arith $revision - $loop
9419
iface=$func_arith_result
9420
func_arith $loop - 1
9421
loop=$func_arith_result
9422
verstring=$verstring_prefix$major.$iface:$verstring
9423
done
9424
9425
# Before this point, $major must not contain '.'.
9426
major=.$major
9427
versuffix=$major.$revision
9428
;;
9429
9430
linux) # correct to gnu/linux during the next big refactor
9431
func_arith $current - $age
9432
major=.$func_arith_result
9433
versuffix=$major.$age.$revision
9434
;;
9435
9436
osf)
9437
func_arith $current - $age
9438
major=.$func_arith_result
9439
versuffix=.$current.$age.$revision
9440
verstring=$current.$age.$revision
9441
9442
# Add in all the interfaces that we are compatible with.
9443
loop=$age
9444
while test 0 -ne "$loop"; do
9445
func_arith $current - $loop
9446
iface=$func_arith_result
9447
func_arith $loop - 1
9448
loop=$func_arith_result
9449
verstring=$verstring:$iface.0
9450
done
9451
9452
# Make executables depend on our current version.
9453
func_append verstring ":$current.0"
9454
;;
9455
9456
qnx)
9457
func_arith $current - $age
9458
major=.$func_arith_result
9459
versuffix=$major.$age.$revision
9460
;;
9461
9462
sco)
9463
major=.$current
9464
versuffix=.$current
9465
;;
9466
9467
sunos)
9468
major=.$current
9469
versuffix=.$current.$revision
9470
;;
9471
9472
windows)
9473
# Use '-' rather than '.', since we only want one
9474
# extension on DOS 8.3 file systems.
9475
func_arith $current - $age
9476
major=$func_arith_result
9477
versuffix=-$major
9478
;;
9479
9480
*)
9481
func_fatal_configuration "unknown library version type '$version_type'"
9482
;;
9483
esac
9484
9485
# Clear the version info if we defaulted, and they specified a release.
9486
if test -z "$vinfo" && test -n "$release"; then
9487
major=
9488
case $version_type in
9489
darwin)
9490
# we can't check for "0.0" in archive_cmds due to quoting
9491
# problems, so we reset it completely
9492
verstring=
9493
;;
9494
*)
9495
verstring=0.0
9496
;;
9497
esac
9498
if test no = "$need_version"; then
9499
versuffix=
9500
else
9501
versuffix=.0.0
9502
fi
9503
fi
9504
9505
# Remove version info from name if versioning should be avoided
9506
if test yes,no = "$avoid_version,$need_version"; then
9507
major=
9508
versuffix=
9509
verstring=
9510
fi
9511
9512
# Check to see if the archive will have undefined symbols.
9513
if test yes = "$allow_undefined"; then
9514
if test unsupported = "$allow_undefined_flag"; then
9515
if test yes = "$build_old_libs"; then
9516
func_warning "undefined symbols not allowed in $host shared libraries; building static only"
9517
build_libtool_libs=no
9518
else
9519
func_fatal_error "can't build $host shared library unless -no-undefined is specified"
9520
fi
9521
fi
9522
else
9523
# Don't allow undefined symbols.
9524
allow_undefined_flag=$no_undefined_flag
9525
fi
9526
9527
fi
9528
9529
func_generate_dlsyms "$libname" "$libname" :
9530
func_append libobjs " $symfileobj"
9531
test " " = "$libobjs" && libobjs=
9532
9533
if test relink != "$opt_mode"; then
9534
# Remove our outputs, but don't remove object files since they
9535
# may have been created when compiling PIC objects.
9536
removelist=
9537
tempremovelist=`$ECHO "$output_objdir/*"`
9538
for p in $tempremovelist; do
9539
case $p in
9540
*.$objext | *.gcno)
9541
;;
9542
$output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/$libname$release.*)
9543
if test -n "$precious_files_regex"; then
9544
if $ECHO "$p" | $EGREP -e "$precious_files_regex" >/dev/null 2>&1
9545
then
9546
continue
9547
fi
9548
fi
9549
func_append removelist " $p"
9550
;;
9551
*) ;;
9552
esac
9553
done
9554
test -n "$removelist" && \
9555
func_show_eval "${RM}r \$removelist"
9556
fi
9557
9558
# Now set the variables for building old libraries.
9559
if test yes = "$build_old_libs" && test convenience != "$build_libtool_libs"; then
9560
func_append oldlibs " $output_objdir/$libname.$libext"
9561
9562
# Transform .lo files to .o files.
9563
oldobjs="$objs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.$libext$/d; $lo2o" | $NL2SP`
9564
fi
9565
9566
# Eliminate all temporary directories.
9567
#for path in $notinst_path; do
9568
# lib_search_path=`$ECHO "$lib_search_path " | $SED "s% $path % %g"`
9569
# deplibs=`$ECHO "$deplibs " | $SED "s% -L$path % %g"`
9570
# dependency_libs=`$ECHO "$dependency_libs " | $SED "s% -L$path % %g"`
9571
#done
9572
9573
if test -n "$xrpath"; then
9574
# If the user specified any rpath flags, then add them.
9575
temp_xrpath=
9576
for libdir in $xrpath; do
9577
func_replace_sysroot "$libdir"
9578
func_append temp_xrpath " -R$func_replace_sysroot_result"
9579
case "$finalize_rpath " in
9580
*" $libdir "*) ;;
9581
*) func_append finalize_rpath " $libdir" ;;
9582
esac
9583
done
9584
if test yes != "$hardcode_into_libs" || test yes = "$build_old_libs"; then
9585
dependency_libs="$temp_xrpath $dependency_libs"
9586
fi
9587
fi
9588
9589
# Make sure dlfiles contains only unique files that won't be dlpreopened
9590
old_dlfiles=$dlfiles
9591
dlfiles=
9592
for lib in $old_dlfiles; do
9593
case " $dlprefiles $dlfiles " in
9594
*" $lib "*) ;;
9595
*) func_append dlfiles " $lib" ;;
9596
esac
9597
done
9598
9599
# Make sure dlprefiles contains only unique files
9600
old_dlprefiles=$dlprefiles
9601
dlprefiles=
9602
for lib in $old_dlprefiles; do
9603
case "$dlprefiles " in
9604
*" $lib "*) ;;
9605
*) func_append dlprefiles " $lib" ;;
9606
esac
9607
done
9608
9609
if test yes = "$build_libtool_libs"; then
9610
if test -n "$rpath"; then
9611
case $host in
9612
*-*-cygwin* | *-*-mingw* | *-*-windows* | *-*-pw32* | *-*-os2* | *-*-beos* | *-cegcc* | *-*-haiku*)
9613
# these systems don't actually have a c library (as such)!
9614
;;
9615
*-*-rhapsody* | *-*-darwin1.[012])
9616
# Rhapsody C library is in the System framework
9617
func_append deplibs " System.ltframework"
9618
;;
9619
*-*-netbsd*)
9620
# Don't link with libc until the a.out ld.so is fixed.
9621
;;
9622
*-*-openbsd* | *-*-freebsd* | *-*-dragonfly* | *-*-midnightbsd*)
9623
# Do not include libc due to us having libc/libc_r.
9624
;;
9625
*-*-sco3.2v5* | *-*-sco5v6*)
9626
# Causes problems with __ctype
9627
;;
9628
*-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
9629
# Compiler inserts libc in the correct place for threads to work
9630
;;
9631
*)
9632
# Add libc to deplibs on all other systems if necessary.
9633
if test yes = "$build_libtool_need_lc"; then
9634
func_append deplibs " -lc"
9635
fi
9636
;;
9637
esac
9638
fi
9639
9640
# Transform deplibs into only deplibs that can be linked in shared.
9641
name_save=$name
9642
libname_save=$libname
9643
release_save=$release
9644
versuffix_save=$versuffix
9645
major_save=$major
9646
# I'm not sure if I'm treating the release correctly. I think
9647
# release should show up in the -l (ie -lgmp5) so we don't want to
9648
# add it in twice. Is that correct?
9649
release=
9650
versuffix=
9651
major=
9652
newdeplibs=
9653
droppeddeps=no
9654
case $deplibs_check_method in
9655
pass_all)
9656
# Don't check for shared/static. Everything works.
9657
# This might be a little naive. We might want to check
9658
# whether the library exists or not. But this is on
9659
# osf3 & osf4 and I'm not really sure... Just
9660
# implementing what was already the behavior.
9661
newdeplibs=$deplibs
9662
;;
9663
file_magic*)
9664
set dummy $deplibs_check_method; shift
9665
file_magic_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
9666
for a_deplib in $deplibs; do
9667
case $a_deplib in
9668
-l*)
9669
func_stripname -l '' "$a_deplib"
9670
name=$func_stripname_result
9671
if test yes = "$allow_libtool_libs_with_static_runtimes"; then
9672
case " $predeps $postdeps " in
9673
*" $a_deplib "*)
9674
func_append newdeplibs " $a_deplib"
9675
a_deplib=
9676
;;
9677
esac
9678
fi
9679
if test -n "$a_deplib"; then
9680
libname=`eval "\\$ECHO \"$libname_spec\""`
9681
if test -n "$file_magic_glob"; then
9682
libnameglob=`func_echo_all "$libname" | $SED -e $file_magic_glob`
9683
else
9684
libnameglob=$libname
9685
fi
9686
test yes = "$want_nocaseglob" && nocaseglob=`shopt -p nocaseglob`
9687
for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
9688
if test yes = "$want_nocaseglob"; then
9689
shopt -s nocaseglob
9690
potential_libs=`ls $i/$libnameglob[.-]* 2>/dev/null`
9691
$nocaseglob
9692
else
9693
potential_libs=`ls $i/$libnameglob[.-]* 2>/dev/null`
9694
fi
9695
for potent_lib in $potential_libs; do
9696
# Follow soft links.
9697
if ls -lLd "$potent_lib" 2>/dev/null |
9698
$GREP " -> " >/dev/null; then
9699
continue
9700
fi
9701
# The statement above tries to avoid entering an
9702
# endless loop below, in case of cyclic links.
9703
# We might still enter an endless loop, since a link
9704
# loop can be closed while we follow links,
9705
# but so what?
9706
potlib=$potent_lib
9707
while test -h "$potlib" 2>/dev/null; do
9708
potliblink=`ls -ld $potlib | $SED 's/.* -> //'`
9709
case $potliblink in
9710
[\\/]* | [A-Za-z]:[\\/]*) potlib=$potliblink;;
9711
*) potlib=`$ECHO "$potlib" | $SED 's|[^/]*$||'`"$potliblink";;
9712
esac
9713
done
9714
if eval $file_magic_cmd \"\$potlib\" 2>/dev/null |
9715
$SED -e 10q |
9716
$EGREP "$file_magic_regex" > /dev/null; then
9717
func_append newdeplibs " $a_deplib"
9718
a_deplib=
9719
break 2
9720
fi
9721
done
9722
done
9723
fi
9724
if test -n "$a_deplib"; then
9725
droppeddeps=yes
9726
func_warning "Linker path does not have real file for library $a_deplib."
9727
func_warning "I have the capability to make that library automatically link in when"
9728
func_warning "you link to this library. But I can only do this if you have a"
9729
func_warning "shared version of the library, which you do not appear to have"
9730
func_warning "because I did check the linker path looking for a file starting"
9731
if test -z "$potlib"; then
9732
func_warning "with $libname but no candidates were found. (...for file magic test)"
9733
else
9734
func_warning "with $libname and none of the candidates passed a file format test"
9735
func_warning "using a file magic. Last file checked: $potlib"
9736
fi
9737
fi
9738
;;
9739
*)
9740
# Add a -L argument.
9741
func_append newdeplibs " $a_deplib"
9742
;;
9743
esac
9744
done # Gone through all deplibs.
9745
;;
9746
match_pattern*)
9747
set dummy $deplibs_check_method; shift
9748
match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
9749
for a_deplib in $deplibs; do
9750
case $a_deplib in
9751
-l*)
9752
func_stripname -l '' "$a_deplib"
9753
name=$func_stripname_result
9754
if test yes = "$allow_libtool_libs_with_static_runtimes"; then
9755
case " $predeps $postdeps " in
9756
*" $a_deplib "*)
9757
func_append newdeplibs " $a_deplib"
9758
a_deplib=
9759
;;
9760
esac
9761
fi
9762
if test -n "$a_deplib"; then
9763
libname=`eval "\\$ECHO \"$libname_spec\""`
9764
for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
9765
potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
9766
for potent_lib in $potential_libs; do
9767
potlib=$potent_lib # see symlink-check above in file_magic test
9768
if eval "\$ECHO \"$potent_lib\"" 2>/dev/null | $SED 10q | \
9769
$EGREP "$match_pattern_regex" > /dev/null; then
9770
func_append newdeplibs " $a_deplib"
9771
a_deplib=
9772
break 2
9773
fi
9774
done
9775
done
9776
fi
9777
if test -n "$a_deplib"; then
9778
droppeddeps=yes
9779
func_warning "Linker path does not have real file for library $a_deplib."
9780
func_warning "I have the capability to make that library automatically link in when"
9781
func_warning "you link to this library. But I can only do this if you have a"
9782
func_warning "shared version of the library, which you do not appear to have"
9783
func_warning "because I did check the linker path looking for a file starting"
9784
if test -z "$potlib"; then
9785
func_warning "with $libname but no candidates were found. (...for regex pattern test)"
9786
else
9787
func_warning "with $libname and none of the candidates passed a file format test"
9788
func_warning "using a regex pattern. Last file checked: $potlib"
9789
fi
9790
fi
9791
;;
9792
*)
9793
# Add a -L argument.
9794
func_append newdeplibs " $a_deplib"
9795
;;
9796
esac
9797
done # Gone through all deplibs.
9798
;;
9799
none | unknown | *)
9800
newdeplibs=
9801
tmp_deplibs=`$ECHO " $deplibs" | $SED 's/ -lc$//; s/ -[LR][^ ]*//g'`
9802
if test yes = "$allow_libtool_libs_with_static_runtimes"; then
9803
for i in $predeps $postdeps; do
9804
# can't use Xsed below, because $i might contain '/'
9805
tmp_deplibs=`$ECHO " $tmp_deplibs" | $SED "s|$i||"`
9806
done
9807
fi
9808
case $tmp_deplibs in
9809
*[!\ \ ]*)
9810
echo
9811
if test none = "$deplibs_check_method"; then
9812
func_warning "Inter-library dependencies are not supported in this platform."
9813
else
9814
func_warning "Inter-library dependencies are not known to be supported."
9815
fi
9816
func_warning "All declared inter-library dependencies are being dropped."
9817
droppeddeps=yes
9818
;;
9819
esac
9820
;;
9821
esac
9822
versuffix=$versuffix_save
9823
major=$major_save
9824
release=$release_save
9825
libname=$libname_save
9826
name=$name_save
9827
9828
case $host in
9829
*-*-rhapsody* | *-*-darwin1.[012])
9830
# On Rhapsody replace the C library with the System framework
9831
newdeplibs=`$ECHO " $newdeplibs" | $SED 's/ -lc / System.ltframework /'`
9832
;;
9833
esac
9834
9835
if test yes = "$droppeddeps"; then
9836
if test yes = "$module"; then
9837
func_warning "libtool could not satisfy all declared inter-library"
9838
func_warning "dependencies of module $libname. Therefore, libtool will create"
9839
func_warning "a static module, that should work as long as the dlopening"
9840
func_warning "application is linked with the -dlopen flag."
9841
if test -z "$global_symbol_pipe"; then
9842
func_warning "However, this would only work if libtool was able to extract symbol"
9843
func_warning "lists from a program, using 'nm' or equivalent, but libtool could"
9844
func_warning "not find such a program. So, this module is probably useless."
9845
func_warning "'nm' from GNU binutils and a full rebuild may help."
9846
fi
9847
if test no = "$build_old_libs"; then
9848
oldlibs=$output_objdir/$libname.$libext
9849
build_libtool_libs=module
9850
build_old_libs=yes
9851
else
9852
build_libtool_libs=no
9853
fi
9854
else
9855
echo "*** The inter-library dependencies that have been dropped here will be"
9856
echo "*** automatically added whenever a program is linked with this library"
9857
echo "*** or is declared to -dlopen it."
9858
9859
if test no = "$allow_undefined"; then
9860
echo
9861
echo "*** Since this library must not contain undefined symbols,"
9862
echo "*** because either the platform does not support them or"
9863
echo "*** it was explicitly requested with -no-undefined,"
9864
echo "*** libtool will only create a static version of it."
9865
if test no = "$build_old_libs"; then
9866
oldlibs=$output_objdir/$libname.$libext
9867
build_libtool_libs=module
9868
build_old_libs=yes
9869
else
9870
build_libtool_libs=no
9871
fi
9872
fi
9873
fi
9874
fi
9875
# Done checking deplibs!
9876
deplibs=$newdeplibs
9877
fi
9878
# Time to change all our "foo.ltframework" stuff back to "-framework foo"
9879
case $host in
9880
*-*-darwin*)
9881
newdeplibs=`$ECHO " $newdeplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
9882
new_inherited_linker_flags=`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
9883
deplibs=`$ECHO " $deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
9884
;;
9885
esac
9886
9887
# move library search paths that coincide with paths to not yet
9888
# installed libraries to the beginning of the library search list
9889
new_libs=
9890
for path in $notinst_path; do
9891
case " $new_libs " in
9892
*" -L$path/$objdir "*) ;;
9893
*)
9894
case " $deplibs " in
9895
*" -L$path/$objdir "*)
9896
func_append new_libs " -L$path/$objdir" ;;
9897
esac
9898
;;
9899
esac
9900
done
9901
for deplib in $deplibs; do
9902
case $deplib in
9903
-L*)
9904
case " $new_libs " in
9905
*" $deplib "*) ;;
9906
*) func_append new_libs " $deplib" ;;
9907
esac
9908
;;
9909
*) func_append new_libs " $deplib" ;;
9910
esac
9911
done
9912
deplibs=$new_libs
9913
9914
# All the library-specific variables (install_libdir is set above).
9915
library_names=
9916
old_library=
9917
dlname=
9918
9919
# Test again, we may have decided not to build it any more
9920
if test yes = "$build_libtool_libs"; then
9921
# Remove $wl instances when linking with ld.
9922
# FIXME: should test the right _cmds variable.
9923
case $archive_cmds in
9924
*\$LD\ *) wl= ;;
9925
esac
9926
if test yes = "$hardcode_into_libs"; then
9927
# Hardcode the library paths
9928
hardcode_libdirs=
9929
dep_rpath=
9930
rpath=$finalize_rpath
9931
test relink = "$opt_mode" || rpath=$compile_rpath$rpath
9932
for libdir in $rpath; do
9933
if test -n "$hardcode_libdir_flag_spec"; then
9934
if test -n "$hardcode_libdir_separator"; then
9935
func_replace_sysroot "$libdir"
9936
libdir=$func_replace_sysroot_result
9937
if test -z "$hardcode_libdirs"; then
9938
hardcode_libdirs=$libdir
9939
else
9940
# Just accumulate the unique libdirs.
9941
case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
9942
*"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
9943
;;
9944
*)
9945
func_append hardcode_libdirs "$hardcode_libdir_separator$libdir"
9946
;;
9947
esac
9948
fi
9949
else
9950
eval flag=\"$hardcode_libdir_flag_spec\"
9951
func_append dep_rpath " $flag"
9952
fi
9953
elif test -n "$runpath_var"; then
9954
case "$perm_rpath " in
9955
*" $libdir "*) ;;
9956
*) func_append perm_rpath " $libdir" ;;
9957
esac
9958
fi
9959
done
9960
# Substitute the hardcoded libdirs into the rpath.
9961
if test -n "$hardcode_libdir_separator" &&
9962
test -n "$hardcode_libdirs"; then
9963
libdir=$hardcode_libdirs
9964
eval "dep_rpath=\"$hardcode_libdir_flag_spec\""
9965
fi
9966
if test -n "$runpath_var" && test -n "$perm_rpath"; then
9967
# We should set the runpath_var.
9968
rpath=
9969
for dir in $perm_rpath; do
9970
func_append rpath "$dir:"
9971
done
9972
eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var"
9973
fi
9974
test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs"
9975
fi
9976
9977
shlibpath=$finalize_shlibpath
9978
test relink = "$opt_mode" || shlibpath=$compile_shlibpath$shlibpath
9979
if test -n "$shlibpath"; then
9980
eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var"
9981
fi
9982
9983
# Get the real and link names of the library.
9984
eval shared_ext=\"$shrext_cmds\"
9985
eval library_names=\"$library_names_spec\"
9986
set dummy $library_names
9987
shift
9988
realname=$1
9989
shift
9990
9991
if test -n "$soname_spec"; then
9992
eval soname=\"$soname_spec\"
9993
else
9994
soname=$realname
9995
fi
9996
if test -z "$dlname"; then
9997
dlname=$soname
9998
fi
9999
10000
lib=$output_objdir/$realname
10001
linknames=
10002
for link
10003
do
10004
func_append linknames " $link"
10005
done
10006
10007
# Use standard objects if they are pic
10008
test -z "$pic_flag" && libobjs=`$ECHO "$libobjs" | $SP2NL | $SED "$lo2o" | $NL2SP`
10009
test "X$libobjs" = "X " && libobjs=
10010
10011
delfiles=
10012
if test -n "$export_symbols" && test -n "$include_expsyms"; then
10013
$opt_dry_run || cp "$export_symbols" "$output_objdir/$libname.uexp"
10014
export_symbols=$output_objdir/$libname.uexp
10015
func_append delfiles " $export_symbols"
10016
fi
10017
10018
orig_export_symbols=
10019
case $host_os in
10020
cygwin* | mingw* | windows* | cegcc*)
10021
if test -n "$export_symbols" && test -z "$export_symbols_regex"; then
10022
# exporting using user supplied symfile
10023
func_dll_def_p "$export_symbols" || {
10024
# and it's NOT already a .def file. Must figure out
10025
# which of the given symbols are data symbols and tag
10026
# them as such. So, trigger use of export_symbols_cmds.
10027
# export_symbols gets reassigned inside the "prepare
10028
# the list of exported symbols" if statement, so the
10029
# include_expsyms logic still works.
10030
orig_export_symbols=$export_symbols
10031
export_symbols=
10032
always_export_symbols=yes
10033
}
10034
fi
10035
;;
10036
esac
10037
10038
# Prepare the list of exported symbols
10039
if test -z "$export_symbols"; then
10040
if test yes = "$always_export_symbols" || test -n "$export_symbols_regex"; then
10041
func_verbose "generating symbol list for '$libname.la'"
10042
export_symbols=$output_objdir/$libname.exp
10043
$opt_dry_run || $RM $export_symbols
10044
cmds=$export_symbols_cmds
10045
save_ifs=$IFS; IFS='~'
10046
for cmd1 in $cmds; do
10047
IFS=$save_ifs
10048
# Take the normal branch if the nm_file_list_spec branch
10049
# doesn't work or if tool conversion is not needed.
10050
case $nm_file_list_spec~$to_tool_file_cmd in
10051
*~func_convert_file_noop | *~func_convert_file_msys_to_w32 | ~*)
10052
try_normal_branch=yes
10053
eval cmd=\"$cmd1\"
10054
func_len " $cmd"
10055
len=$func_len_result
10056
;;
10057
*)
10058
try_normal_branch=no
10059
;;
10060
esac
10061
if test yes = "$try_normal_branch" \
10062
&& { test "$len" -lt "$max_cmd_len" \
10063
|| test "$max_cmd_len" -le -1; }
10064
then
10065
func_show_eval "$cmd" 'exit $?'
10066
skipped_export=false
10067
elif test -n "$nm_file_list_spec"; then
10068
func_basename "$output"
10069
output_la=$func_basename_result
10070
save_libobjs=$libobjs
10071
save_output=$output
10072
output=$output_objdir/$output_la.nm
10073
func_to_tool_file "$output"
10074
libobjs=$nm_file_list_spec$func_to_tool_file_result
10075
func_append delfiles " $output"
10076
func_verbose "creating $NM input file list: $output"
10077
for obj in $save_libobjs; do
10078
func_to_tool_file "$obj"
10079
$ECHO "$func_to_tool_file_result"
10080
done > "$output"
10081
eval cmd=\"$cmd1\"
10082
func_show_eval "$cmd" 'exit $?'
10083
output=$save_output
10084
libobjs=$save_libobjs
10085
skipped_export=false
10086
else
10087
# The command line is too long to execute in one step.
10088
func_verbose "using reloadable object file for export list..."
10089
skipped_export=:
10090
# Break out early, otherwise skipped_export may be
10091
# set to false by a later but shorter cmd.
10092
break
10093
fi
10094
done
10095
IFS=$save_ifs
10096
if test -n "$export_symbols_regex" && test : != "$skipped_export"; then
10097
func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
10098
func_show_eval '$MV "${export_symbols}T" "$export_symbols"'
10099
fi
10100
fi
10101
fi
10102
10103
if test -n "$export_symbols" && test -n "$include_expsyms"; then
10104
tmp_export_symbols=$export_symbols
10105
test -n "$orig_export_symbols" && tmp_export_symbols=$orig_export_symbols
10106
$opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"'
10107
fi
10108
10109
if test : != "$skipped_export" && test -n "$orig_export_symbols"; then
10110
# The given exports_symbols file has to be filtered, so filter it.
10111
func_verbose "filter symbol list for '$libname.la' to tag DATA exports"
10112
# FIXME: $output_objdir/$libname.filter potentially contains lots of
10113
# 's' commands, which not all seds can handle. GNU sed should be fine
10114
# though. Also, the filter scales superlinearly with the number of
10115
# global variables. join(1) would be nice here, but unfortunately
10116
# isn't a blessed tool.
10117
$opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter
10118
func_append delfiles " $export_symbols $output_objdir/$libname.filter"
10119
export_symbols=$output_objdir/$libname.def
10120
$opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols
10121
fi
10122
10123
tmp_deplibs=
10124
for test_deplib in $deplibs; do
10125
case " $convenience " in
10126
*" $test_deplib "*) ;;
10127
*)
10128
func_append tmp_deplibs " $test_deplib"
10129
;;
10130
esac
10131
done
10132
deplibs=$tmp_deplibs
10133
10134
if test -n "$convenience"; then
10135
if test -n "$whole_archive_flag_spec" &&
10136
test yes = "$compiler_needs_object" &&
10137
test -z "$libobjs"; then
10138
# extract the archives, so we have objects to list.
10139
# TODO: could optimize this to just extract one archive.
10140
whole_archive_flag_spec=
10141
fi
10142
if test -n "$whole_archive_flag_spec"; then
10143
save_libobjs=$libobjs
10144
eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
10145
test "X$libobjs" = "X " && libobjs=
10146
else
10147
gentop=$output_objdir/${outputname}x
10148
func_append generated " $gentop"
10149
10150
func_extract_archives $gentop $convenience
10151
func_append libobjs " $func_extract_archives_result"
10152
test "X$libobjs" = "X " && libobjs=
10153
fi
10154
fi
10155
10156
if test yes = "$thread_safe" && test -n "$thread_safe_flag_spec"; then
10157
eval flag=\"$thread_safe_flag_spec\"
10158
func_append linker_flags " $flag"
10159
fi
10160
10161
# Make a backup of the uninstalled library when relinking
10162
if test relink = "$opt_mode"; then
10163
$opt_dry_run || eval '(cd $output_objdir && $RM ${realname}U && $MV $realname ${realname}U)' || exit $?
10164
fi
10165
10166
# Do each of the archive commands.
10167
if test yes = "$module" && test -n "$module_cmds"; then
10168
if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
10169
eval test_cmds=\"$module_expsym_cmds\"
10170
cmds=$module_expsym_cmds
10171
else
10172
eval test_cmds=\"$module_cmds\"
10173
cmds=$module_cmds
10174
fi
10175
else
10176
if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
10177
eval test_cmds=\"$archive_expsym_cmds\"
10178
cmds=$archive_expsym_cmds
10179
else
10180
eval test_cmds=\"$archive_cmds\"
10181
cmds=$archive_cmds
10182
fi
10183
fi
10184
10185
if test : != "$skipped_export" &&
10186
func_len " $test_cmds" &&
10187
len=$func_len_result &&
10188
test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then
10189
:
10190
else
10191
# The command line is too long to link in one step, link piecewise
10192
# or, if using GNU ld and skipped_export is not :, use a linker
10193
# script.
10194
10195
# Save the value of $output and $libobjs because we want to
10196
# use them later. If we have whole_archive_flag_spec, we
10197
# want to use save_libobjs as it was before
10198
# whole_archive_flag_spec was expanded, because we can't
10199
# assume the linker understands whole_archive_flag_spec.
10200
# This may have to be revisited, in case too many
10201
# convenience libraries get linked in and end up exceeding
10202
# the spec.
10203
if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then
10204
save_libobjs=$libobjs
10205
fi
10206
save_output=$output
10207
func_basename "$output"
10208
output_la=$func_basename_result
10209
10210
# Clear the reloadable object creation command queue and
10211
# initialize k to one.
10212
test_cmds=
10213
concat_cmds=
10214
objlist=
10215
last_robj=
10216
k=1
10217
10218
if test -n "$save_libobjs" && test : != "$skipped_export" && test -n "$file_list_spec"; then
10219
output=$output_objdir/$output_la.lnk
10220
func_verbose "creating linker input file list: $output"
10221
: > $output
10222
set x $save_libobjs
10223
shift
10224
firstobj=
10225
if test yes = "$compiler_needs_object"; then
10226
firstobj="$1 "
10227
shift
10228
fi
10229
for obj
10230
do
10231
func_to_tool_file "$obj"
10232
$ECHO "$func_to_tool_file_result" >> $output
10233
done
10234
func_append delfiles " $output"
10235
func_to_tool_file "$output"
10236
output=$firstobj\"$file_list_spec$func_to_tool_file_result\"
10237
elif test -n "$save_libobjs" && test : != "$skipped_export" && test yes = "$with_gnu_ld"; then
10238
output=$output_objdir/$output_la.lnkscript
10239
func_verbose "creating GNU ld script: $output"
10240
echo 'INPUT (' > $output
10241
for obj in $save_libobjs
10242
do
10243
func_to_tool_file "$obj"
10244
$ECHO "$func_to_tool_file_result" >> $output
10245
done
10246
echo ')' >> $output
10247
func_append delfiles " $output"
10248
func_to_tool_file "$output"
10249
output=$func_to_tool_file_result
10250
else
10251
if test -n "$save_libobjs"; then
10252
func_verbose "creating reloadable object files..."
10253
output=$output_objdir/$output_la-$k.$objext
10254
eval test_cmds=\"$reload_cmds\"
10255
func_len " $test_cmds"
10256
len0=$func_len_result
10257
len=$len0
10258
10259
# Loop over the list of objects to be linked.
10260
for obj in $save_libobjs
10261
do
10262
func_len " $obj"
10263
func_arith $len + $func_len_result
10264
len=$func_arith_result
10265
if test -z "$objlist" ||
10266
test "$len" -lt "$max_cmd_len"; then
10267
func_append objlist " $obj"
10268
else
10269
# The command $test_cmds is almost too long, add a
10270
# command to the queue.
10271
if test 1 -eq "$k"; then
10272
# The first file doesn't have a previous command to add.
10273
reload_objs=$objlist
10274
eval concat_cmds=\"$reload_cmds\"
10275
else
10276
# All subsequent reloadable object files will link in
10277
# the last one created.
10278
reload_objs="$objlist $last_robj"
10279
eval concat_cmds=\"\$concat_cmds~$reload_cmds~\$RM $last_robj\"
10280
fi
10281
last_robj=$output_objdir/$output_la-$k.$objext
10282
func_arith $k + 1
10283
k=$func_arith_result
10284
output=$output_objdir/$output_la-$k.$objext
10285
objlist=" $obj"
10286
func_len " $last_robj"
10287
func_arith $len0 + $func_len_result
10288
len=$func_arith_result
10289
fi
10290
done
10291
# Handle the remaining objects by creating one last
10292
# reloadable object file. All subsequent reloadable object
10293
# files will link in the last one created.
10294
test -z "$concat_cmds" || concat_cmds=$concat_cmds~
10295
reload_objs="$objlist $last_robj"
10296
eval concat_cmds=\"\$concat_cmds$reload_cmds\"
10297
if test -n "$last_robj"; then
10298
eval concat_cmds=\"\$concat_cmds~\$RM $last_robj\"
10299
fi
10300
func_append delfiles " $output"
10301
10302
else
10303
output=
10304
fi
10305
10306
${skipped_export-false} && {
10307
func_verbose "generating symbol list for '$libname.la'"
10308
export_symbols=$output_objdir/$libname.exp
10309
$opt_dry_run || $RM $export_symbols
10310
libobjs=$output
10311
# Append the command to create the export file.
10312
test -z "$concat_cmds" || concat_cmds=$concat_cmds~
10313
eval concat_cmds=\"\$concat_cmds$export_symbols_cmds\"
10314
if test -n "$last_robj"; then
10315
eval concat_cmds=\"\$concat_cmds~\$RM $last_robj\"
10316
fi
10317
}
10318
10319
test -n "$save_libobjs" &&
10320
func_verbose "creating a temporary reloadable object file: $output"
10321
10322
# Loop through the commands generated above and execute them.
10323
save_ifs=$IFS; IFS='~'
10324
for cmd in $concat_cmds; do
10325
IFS=$save_ifs
10326
$opt_quiet || {
10327
func_quote_arg expand,pretty "$cmd"
10328
eval "func_echo $func_quote_arg_result"
10329
}
10330
$opt_dry_run || eval "$cmd" || {
10331
lt_exit=$?
10332
10333
# Restore the uninstalled library and exit
10334
if test relink = "$opt_mode"; then
10335
( cd "$output_objdir" && \
10336
$RM "${realname}T" && \
10337
$MV "${realname}U" "$realname" )
10338
fi
10339
10340
exit $lt_exit
10341
}
10342
done
10343
IFS=$save_ifs
10344
10345
if test -n "$export_symbols_regex" && ${skipped_export-false}; then
10346
func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
10347
func_show_eval '$MV "${export_symbols}T" "$export_symbols"'
10348
fi
10349
fi
10350
10351
${skipped_export-false} && {
10352
if test -n "$export_symbols" && test -n "$include_expsyms"; then
10353
tmp_export_symbols=$export_symbols
10354
test -n "$orig_export_symbols" && tmp_export_symbols=$orig_export_symbols
10355
$opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"'
10356
fi
10357
10358
if test -n "$orig_export_symbols"; then
10359
# The given exports_symbols file has to be filtered, so filter it.
10360
func_verbose "filter symbol list for '$libname.la' to tag DATA exports"
10361
# FIXME: $output_objdir/$libname.filter potentially contains lots of
10362
# 's' commands, which not all seds can handle. GNU sed should be fine
10363
# though. Also, the filter scales superlinearly with the number of
10364
# global variables. join(1) would be nice here, but unfortunately
10365
# isn't a blessed tool.
10366
$opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter
10367
func_append delfiles " $export_symbols $output_objdir/$libname.filter"
10368
export_symbols=$output_objdir/$libname.def
10369
$opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols
10370
fi
10371
}
10372
10373
libobjs=$output
10374
# Restore the value of output.
10375
output=$save_output
10376
10377
if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then
10378
eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
10379
test "X$libobjs" = "X " && libobjs=
10380
fi
10381
# Expand the library linking commands again to reset the
10382
# value of $libobjs for piecewise linking.
10383
10384
# Do each of the archive commands.
10385
if test yes = "$module" && test -n "$module_cmds"; then
10386
if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
10387
cmds=$module_expsym_cmds
10388
else
10389
cmds=$module_cmds
10390
fi
10391
else
10392
if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
10393
cmds=$archive_expsym_cmds
10394
else
10395
cmds=$archive_cmds
10396
fi
10397
fi
10398
fi
10399
10400
if test -n "$delfiles"; then
10401
# Append the command to remove temporary files to $cmds.
10402
eval cmds=\"\$cmds~\$RM $delfiles\"
10403
fi
10404
10405
# Add any objects from preloaded convenience libraries
10406
if test -n "$dlprefiles"; then
10407
gentop=$output_objdir/${outputname}x
10408
func_append generated " $gentop"
10409
10410
func_extract_archives $gentop $dlprefiles
10411
func_append libobjs " $func_extract_archives_result"
10412
test "X$libobjs" = "X " && libobjs=
10413
fi
10414
10415
save_ifs=$IFS; IFS='~'
10416
for cmd in $cmds; do
10417
IFS=$sp$nl
10418
eval cmd=\"$cmd\"
10419
IFS=$save_ifs
10420
$opt_quiet || {
10421
func_quote_arg expand,pretty "$cmd"
10422
eval "func_echo $func_quote_arg_result"
10423
}
10424
$opt_dry_run || eval "$cmd" || {
10425
lt_exit=$?
10426
10427
# Restore the uninstalled library and exit
10428
if test relink = "$opt_mode"; then
10429
( cd "$output_objdir" && \
10430
$RM "${realname}T" && \
10431
$MV "${realname}U" "$realname" )
10432
fi
10433
10434
exit $lt_exit
10435
}
10436
done
10437
IFS=$save_ifs
10438
10439
# Restore the uninstalled library and exit
10440
if test relink = "$opt_mode"; then
10441
$opt_dry_run || eval '(cd $output_objdir && $RM ${realname}T && $MV $realname ${realname}T && $MV ${realname}U $realname)' || exit $?
10442
10443
if test -n "$convenience"; then
10444
if test -z "$whole_archive_flag_spec"; then
10445
func_show_eval '${RM}r "$gentop"'
10446
fi
10447
fi
10448
10449
exit $EXIT_SUCCESS
10450
fi
10451
10452
# Create links to the real library.
10453
for linkname in $linknames; do
10454
if test "$realname" != "$linkname"; then
10455
func_show_eval '(cd "$output_objdir" && $RM "$linkname" && $LN_S "$realname" "$linkname")' 'exit $?'
10456
fi
10457
done
10458
10459
# If -module or -export-dynamic was specified, set the dlname.
10460
if test yes = "$module" || test yes = "$export_dynamic"; then
10461
# On all known operating systems, these are identical.
10462
dlname=$soname
10463
fi
10464
fi
10465
;;
10466
10467
obj)
10468
if test -n "$dlfiles$dlprefiles" || test no != "$dlself"; then
10469
func_warning "'-dlopen' is ignored for objects"
10470
fi
10471
10472
case " $deplibs" in
10473
*\ -l* | *\ -L*)
10474
func_warning "'-l' and '-L' are ignored for objects" ;;
10475
esac
10476
10477
test -n "$rpath" && \
10478
func_warning "'-rpath' is ignored for objects"
10479
10480
test -n "$xrpath" && \
10481
func_warning "'-R' is ignored for objects"
10482
10483
test -n "$vinfo" && \
10484
func_warning "'-version-info' is ignored for objects"
10485
10486
test -n "$release" && \
10487
func_warning "'-release' is ignored for objects"
10488
10489
case $output in
10490
*.lo)
10491
test -n "$objs$old_deplibs" && \
10492
func_fatal_error "cannot build library object '$output' from non-libtool objects"
10493
10494
libobj=$output
10495
func_lo2o "$libobj"
10496
obj=$func_lo2o_result
10497
;;
10498
*)
10499
libobj=
10500
obj=$output
10501
;;
10502
esac
10503
10504
# Delete the old objects.
10505
$opt_dry_run || $RM $obj $libobj
10506
10507
# Objects from convenience libraries. This assumes
10508
# single-version convenience libraries. Whenever we create
10509
# different ones for PIC/non-PIC, this we'll have to duplicate
10510
# the extraction.
10511
reload_conv_objs=
10512
gentop=
10513
# if reload_cmds runs $LD directly, get rid of -Wl from
10514
# whole_archive_flag_spec and hope we can get by with turning comma
10515
# into space.
10516
case $reload_cmds in
10517
*\$LD[\ \$]*) wl= ;;
10518
esac
10519
if test -n "$convenience"; then
10520
if test -n "$whole_archive_flag_spec"; then
10521
eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\"
10522
test -n "$wl" || tmp_whole_archive_flags=`$ECHO "$tmp_whole_archive_flags" | $SED 's|,| |g'`
10523
reload_conv_objs=$reload_objs\ $tmp_whole_archive_flags
10524
else
10525
gentop=$output_objdir/${obj}x
10526
func_append generated " $gentop"
10527
10528
func_extract_archives $gentop $convenience
10529
reload_conv_objs="$reload_objs $func_extract_archives_result"
10530
fi
10531
fi
10532
10533
# If we're not building shared, we need to use non_pic_objs
10534
test yes = "$build_libtool_libs" || libobjs=$non_pic_objects
10535
10536
# Create the old-style object.
10537
reload_objs=$objs$old_deplibs' '`$ECHO "$libobjs" | $SP2NL | $SED "/\.$libext$/d; /\.lib$/d; $lo2o" | $NL2SP`' '$reload_conv_objs
10538
10539
output=$obj
10540
func_execute_cmds "$reload_cmds" 'exit $?'
10541
10542
# Exit if we aren't doing a library object file.
10543
if test -z "$libobj"; then
10544
if test -n "$gentop"; then
10545
func_show_eval '${RM}r "$gentop"'
10546
fi
10547
10548
exit $EXIT_SUCCESS
10549
fi
10550
10551
test yes = "$build_libtool_libs" || {
10552
if test -n "$gentop"; then
10553
func_show_eval '${RM}r "$gentop"'
10554
fi
10555
10556
# Create an invalid libtool object if no PIC, so that we don't
10557
# accidentally link it into a program.
10558
# $show "echo timestamp > $libobj"
10559
# $opt_dry_run || eval "echo timestamp > $libobj" || exit $?
10560
exit $EXIT_SUCCESS
10561
}
10562
10563
if test -n "$pic_flag" || test default != "$pic_mode"; then
10564
# Only do commands if we really have different PIC objects.
10565
reload_objs="$libobjs $reload_conv_objs"
10566
output=$libobj
10567
func_execute_cmds "$reload_cmds" 'exit $?'
10568
fi
10569
10570
if test -n "$gentop"; then
10571
func_show_eval '${RM}r "$gentop"'
10572
fi
10573
10574
exit $EXIT_SUCCESS
10575
;;
10576
10577
prog)
10578
case $host in
10579
*cygwin*) func_stripname '' '.exe' "$output"
10580
output=$func_stripname_result.exe;;
10581
esac
10582
test -n "$vinfo" && \
10583
func_warning "'-version-info' is ignored for programs"
10584
10585
test -n "$release" && \
10586
func_warning "'-release' is ignored for programs"
10587
10588
$preload \
10589
&& test unknown,unknown,unknown = "$dlopen_support,$dlopen_self,$dlopen_self_static" \
10590
&& func_warning "'LT_INIT([dlopen])' not used. Assuming no dlopen support."
10591
10592
case $host in
10593
*-*-rhapsody* | *-*-darwin1.[012])
10594
# On Rhapsody replace the C library is the System framework
10595
compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's/ -lc / System.ltframework /'`
10596
finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's/ -lc / System.ltframework /'`
10597
;;
10598
esac
10599
10600
case $host in
10601
*-*-darwin*)
10602
# Don't allow lazy linking, it breaks C++ global constructors
10603
# But is supposedly fixed on 10.4 or later (yay!).
10604
if test CXX = "$tagname"; then
10605
case ${MACOSX_DEPLOYMENT_TARGET-10.0} in
10606
10.[0123])
10607
func_append compile_command " $wl-bind_at_load"
10608
func_append finalize_command " $wl-bind_at_load"
10609
;;
10610
esac
10611
fi
10612
# Time to change all our "foo.ltframework" stuff back to "-framework foo"
10613
compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
10614
finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
10615
;;
10616
esac
10617
10618
10619
# move library search paths that coincide with paths to not yet
10620
# installed libraries to the beginning of the library search list
10621
new_libs=
10622
for path in $notinst_path; do
10623
case " $new_libs " in
10624
*" -L$path/$objdir "*) ;;
10625
*)
10626
case " $compile_deplibs " in
10627
*" -L$path/$objdir "*)
10628
func_append new_libs " -L$path/$objdir" ;;
10629
esac
10630
;;
10631
esac
10632
done
10633
for deplib in $compile_deplibs; do
10634
case $deplib in
10635
-L*)
10636
case " $new_libs " in
10637
*" $deplib "*) ;;
10638
*) func_append new_libs " $deplib" ;;
10639
esac
10640
;;
10641
*) func_append new_libs " $deplib" ;;
10642
esac
10643
done
10644
compile_deplibs=$new_libs
10645
10646
10647
func_append compile_command " $compile_deplibs"
10648
func_append finalize_command " $finalize_deplibs"
10649
10650
if test -n "$rpath$xrpath"; then
10651
# If the user specified any rpath flags, then add them.
10652
for libdir in $rpath $xrpath; do
10653
# This is the magic to use -rpath.
10654
case "$finalize_rpath " in
10655
*" $libdir "*) ;;
10656
*) func_append finalize_rpath " $libdir" ;;
10657
esac
10658
done
10659
fi
10660
10661
# Now hardcode the library paths
10662
rpath=
10663
hardcode_libdirs=
10664
for libdir in $compile_rpath $finalize_rpath; do
10665
if test -n "$hardcode_libdir_flag_spec"; then
10666
if test -n "$hardcode_libdir_separator"; then
10667
if test -z "$hardcode_libdirs"; then
10668
hardcode_libdirs=$libdir
10669
else
10670
# Just accumulate the unique libdirs.
10671
case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
10672
*"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
10673
;;
10674
*)
10675
func_append hardcode_libdirs "$hardcode_libdir_separator$libdir"
10676
;;
10677
esac
10678
fi
10679
else
10680
eval flag=\"$hardcode_libdir_flag_spec\"
10681
func_append rpath " $flag"
10682
fi
10683
elif test -n "$runpath_var"; then
10684
case "$perm_rpath " in
10685
*" $libdir "*) ;;
10686
*) func_append perm_rpath " $libdir" ;;
10687
esac
10688
fi
10689
case $host in
10690
*-*-cygwin* | *-*-mingw* | *-*-windows* | *-*-pw32* | *-*-os2* | *-cegcc*)
10691
testbindir=`$ECHO "$libdir" | $SED -e 's*/lib$*/bin*'`
10692
case :$dllsearchpath: in
10693
*":$libdir:"*) ;;
10694
::) dllsearchpath=$libdir;;
10695
*) func_append dllsearchpath ":$libdir";;
10696
esac
10697
case :$dllsearchpath: in
10698
*":$testbindir:"*) ;;
10699
::) dllsearchpath=$testbindir;;
10700
*) func_append dllsearchpath ":$testbindir";;
10701
esac
10702
;;
10703
esac
10704
done
10705
# Substitute the hardcoded libdirs into the rpath.
10706
if test -n "$hardcode_libdir_separator" &&
10707
test -n "$hardcode_libdirs"; then
10708
libdir=$hardcode_libdirs
10709
eval rpath=\" $hardcode_libdir_flag_spec\"
10710
fi
10711
compile_rpath=$rpath
10712
10713
rpath=
10714
hardcode_libdirs=
10715
for libdir in $finalize_rpath; do
10716
if test -n "$hardcode_libdir_flag_spec"; then
10717
if test -n "$hardcode_libdir_separator"; then
10718
if test -z "$hardcode_libdirs"; then
10719
hardcode_libdirs=$libdir
10720
else
10721
# Just accumulate the unique libdirs.
10722
case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
10723
*"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
10724
;;
10725
*)
10726
func_append hardcode_libdirs "$hardcode_libdir_separator$libdir"
10727
;;
10728
esac
10729
fi
10730
else
10731
eval flag=\"$hardcode_libdir_flag_spec\"
10732
func_append rpath " $flag"
10733
fi
10734
elif test -n "$runpath_var"; then
10735
case "$finalize_perm_rpath " in
10736
*" $libdir "*) ;;
10737
*) func_append finalize_perm_rpath " $libdir" ;;
10738
esac
10739
fi
10740
done
10741
# Substitute the hardcoded libdirs into the rpath.
10742
if test -n "$hardcode_libdir_separator" &&
10743
test -n "$hardcode_libdirs"; then
10744
libdir=$hardcode_libdirs
10745
eval rpath=\" $hardcode_libdir_flag_spec\"
10746
fi
10747
finalize_rpath=$rpath
10748
10749
if test -n "$libobjs" && test yes = "$build_old_libs"; then
10750
# Transform all the library objects into standard objects.
10751
compile_command=`$ECHO "$compile_command" | $SP2NL | $SED "$lo2o" | $NL2SP`
10752
finalize_command=`$ECHO "$finalize_command" | $SP2NL | $SED "$lo2o" | $NL2SP`
10753
fi
10754
10755
func_generate_dlsyms "$outputname" "@PROGRAM@" false
10756
10757
# template prelinking step
10758
if test -n "$prelink_cmds"; then
10759
func_execute_cmds "$prelink_cmds" 'exit $?'
10760
fi
10761
10762
wrappers_required=:
10763
case $host in
10764
*cegcc* | *mingw32ce*)
10765
# Disable wrappers for cegcc and mingw32ce hosts, we are cross compiling anyway.
10766
wrappers_required=false
10767
;;
10768
*cygwin* | *mingw* | *windows* )
10769
test yes = "$build_libtool_libs" || wrappers_required=false
10770
;;
10771
*)
10772
if test no = "$need_relink" || test yes != "$build_libtool_libs"; then
10773
wrappers_required=false
10774
fi
10775
;;
10776
esac
10777
$wrappers_required || {
10778
# Replace the output file specification.
10779
compile_command=`$ECHO "$compile_command" | $SED 's%@OUTPUT@%'"$output"'%g'`
10780
link_command=$compile_command$compile_rpath
10781
10782
# We have no uninstalled library dependencies, so finalize right now.
10783
exit_status=0
10784
func_show_eval "$link_command" 'exit_status=$?'
10785
10786
if test -n "$postlink_cmds"; then
10787
func_to_tool_file "$output"
10788
postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'`
10789
func_execute_cmds "$postlink_cmds" 'exit $?'
10790
fi
10791
10792
# Delete the generated files.
10793
if test -f "$output_objdir/${outputname}S.$objext"; then
10794
func_show_eval '$RM "$output_objdir/${outputname}S.$objext"'
10795
fi
10796
10797
exit $exit_status
10798
}
10799
10800
if test -n "$compile_shlibpath$finalize_shlibpath"; then
10801
compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command"
10802
fi
10803
if test -n "$finalize_shlibpath"; then
10804
finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command"
10805
fi
10806
10807
compile_var=
10808
finalize_var=
10809
if test -n "$runpath_var"; then
10810
if test -n "$perm_rpath"; then
10811
# We should set the runpath_var.
10812
rpath=
10813
for dir in $perm_rpath; do
10814
func_append rpath "$dir:"
10815
done
10816
compile_var="$runpath_var=\"$rpath\$$runpath_var\" "
10817
fi
10818
if test -n "$finalize_perm_rpath"; then
10819
# We should set the runpath_var.
10820
rpath=
10821
for dir in $finalize_perm_rpath; do
10822
func_append rpath "$dir:"
10823
done
10824
finalize_var="$runpath_var=\"$rpath\$$runpath_var\" "
10825
fi
10826
fi
10827
10828
if test yes = "$no_install"; then
10829
# We don't need to create a wrapper script.
10830
link_command=$compile_var$compile_command$compile_rpath
10831
# Replace the output file specification.
10832
link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output"'%g'`
10833
# Delete the old output file.
10834
$opt_dry_run || $RM $output
10835
# Link the executable and exit
10836
func_show_eval "$link_command" 'exit $?'
10837
10838
if test -n "$postlink_cmds"; then
10839
func_to_tool_file "$output"
10840
postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'`
10841
func_execute_cmds "$postlink_cmds" 'exit $?'
10842
fi
10843
10844
exit $EXIT_SUCCESS
10845
fi
10846
10847
case $hardcode_action,$fast_install in
10848
relink,*)
10849
# Fast installation is not supported
10850
link_command=$compile_var$compile_command$compile_rpath
10851
relink_command=$finalize_var$finalize_command$finalize_rpath
10852
10853
func_warning "this platform does not like uninstalled shared libraries"
10854
func_warning "'$output' will be relinked during installation"
10855
;;
10856
*,yes)
10857
link_command=$finalize_var$compile_command$finalize_rpath
10858
relink_command=`$ECHO "$compile_var$compile_command$compile_rpath" | $SED 's%@OUTPUT@%\$progdir/\$file%g'`
10859
;;
10860
*,no)
10861
link_command=$compile_var$compile_command$compile_rpath
10862
relink_command=$finalize_var$finalize_command$finalize_rpath
10863
;;
10864
*,needless)
10865
link_command=$finalize_var$compile_command$finalize_rpath
10866
relink_command=
10867
;;
10868
esac
10869
10870
# Replace the output file specification.
10871
link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`
10872
10873
# Delete the old output files.
10874
$opt_dry_run || $RM $output $output_objdir/$outputname $output_objdir/lt-$outputname
10875
10876
func_show_eval "$link_command" 'exit $?'
10877
10878
if test -n "$postlink_cmds"; then
10879
func_to_tool_file "$output_objdir/$outputname"
10880
postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'`
10881
func_execute_cmds "$postlink_cmds" 'exit $?'
10882
fi
10883
10884
# Now create the wrapper script.
10885
func_verbose "creating $output"
10886
10887
# Quote the relink command for shipping.
10888
if test -n "$relink_command"; then
10889
# Preserve any variables that may affect compiler behavior
10890
for var in $variables_saved_for_relink; do
10891
if eval test -z \"\${$var+set}\"; then
10892
relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command"
10893
elif eval var_value=\$$var; test -z "$var_value"; then
10894
relink_command="$var=; export $var; $relink_command"
10895
else
10896
func_quote_arg pretty "$var_value"
10897
relink_command="$var=$func_quote_arg_result; export $var; $relink_command"
10898
fi
10899
done
10900
func_quote eval cd "`pwd`"
10901
func_quote_arg pretty,unquoted "($func_quote_result; $relink_command)"
10902
relink_command=$func_quote_arg_unquoted_result
10903
fi
10904
10905
# Only actually do things if not in dry run mode.
10906
$opt_dry_run || {
10907
# win32 will think the script is a binary if it has
10908
# a .exe suffix, so we strip it off here.
10909
case $output in
10910
*.exe) func_stripname '' '.exe' "$output"
10911
output=$func_stripname_result ;;
10912
esac
10913
# test for cygwin because mv fails w/o .exe extensions
10914
case $host in
10915
*cygwin*)
10916
exeext=.exe
10917
func_stripname '' '.exe' "$outputname"
10918
outputname=$func_stripname_result ;;
10919
*) exeext= ;;
10920
esac
10921
case $host in
10922
*cygwin* | *mingw* | windows* )
10923
func_dirname_and_basename "$output" "" "."
10924
output_name=$func_basename_result
10925
output_path=$func_dirname_result
10926
cwrappersource=$output_path/$objdir/lt-$output_name.c
10927
cwrapper=$output_path/$output_name.exe
10928
$RM $cwrappersource $cwrapper
10929
trap "$RM $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15
10930
10931
func_emit_cwrapperexe_src > $cwrappersource
10932
10933
# The wrapper executable is built using the $host compiler,
10934
# because it contains $host paths and files. If cross-
10935
# compiling, it, like the target executable, must be
10936
# executed on the $host or under an emulation environment.
10937
$opt_dry_run || {
10938
$LTCC $LTCFLAGS -o $cwrapper $cwrappersource
10939
$STRIP $cwrapper
10940
}
10941
10942
# Now, create the wrapper script for func_source use:
10943
func_ltwrapper_scriptname $cwrapper
10944
$RM $func_ltwrapper_scriptname_result
10945
trap "$RM $func_ltwrapper_scriptname_result; exit $EXIT_FAILURE" 1 2 15
10946
$opt_dry_run || {
10947
# note: this script will not be executed, so do not chmod.
10948
if test "x$build" = "x$host"; then
10949
$cwrapper --lt-dump-script > $func_ltwrapper_scriptname_result
10950
else
10951
func_emit_wrapper no > $func_ltwrapper_scriptname_result
10952
fi
10953
}
10954
;;
10955
* )
10956
$RM $output
10957
trap "$RM $output; exit $EXIT_FAILURE" 1 2 15
10958
10959
func_emit_wrapper no > $output
10960
chmod +x $output
10961
;;
10962
esac
10963
}
10964
exit $EXIT_SUCCESS
10965
;;
10966
esac
10967
10968
# See if we need to build an old-fashioned archive.
10969
for oldlib in $oldlibs; do
10970
10971
case $build_libtool_libs in
10972
convenience)
10973
oldobjs="$libobjs_save $symfileobj"
10974
addlibs=$convenience
10975
build_libtool_libs=no
10976
;;
10977
module)
10978
oldobjs=$libobjs_save
10979
addlibs=$old_convenience
10980
build_libtool_libs=no
10981
;;
10982
*)
10983
oldobjs="$old_deplibs $non_pic_objects"
10984
$preload && test -f "$symfileobj" \
10985
&& func_append oldobjs " $symfileobj"
10986
addlibs=$old_convenience
10987
;;
10988
esac
10989
10990
if test -n "$addlibs"; then
10991
gentop=$output_objdir/${outputname}x
10992
func_append generated " $gentop"
10993
10994
func_extract_archives $gentop $addlibs
10995
func_append oldobjs " $func_extract_archives_result"
10996
fi
10997
10998
# Do each command in the archive commands.
10999
if test -n "$old_archive_from_new_cmds" && test yes = "$build_libtool_libs"; then
11000
cmds=$old_archive_from_new_cmds
11001
else
11002
11003
# Add any objects from preloaded convenience libraries
11004
if test -n "$dlprefiles"; then
11005
gentop=$output_objdir/${outputname}x
11006
func_append generated " $gentop"
11007
11008
func_extract_archives $gentop $dlprefiles
11009
func_append oldobjs " $func_extract_archives_result"
11010
fi
11011
11012
# POSIX demands no paths to be encoded in archives. We have
11013
# to avoid creating archives with duplicate basenames if we
11014
# might have to extract them afterwards, e.g., when creating a
11015
# static archive out of a convenience library, or when linking
11016
# the entirety of a libtool archive into another (currently
11017
# not supported by libtool).
11018
if (for obj in $oldobjs
11019
do
11020
func_basename "$obj"
11021
$ECHO "$func_basename_result"
11022
done | sort | sort -uc >/dev/null 2>&1); then
11023
:
11024
else
11025
echo "copying selected object files to avoid basename conflicts..."
11026
gentop=$output_objdir/${outputname}x
11027
func_append generated " $gentop"
11028
func_mkdir_p "$gentop"
11029
save_oldobjs=$oldobjs
11030
oldobjs=
11031
counter=1
11032
for obj in $save_oldobjs
11033
do
11034
func_basename "$obj"
11035
objbase=$func_basename_result
11036
case " $oldobjs " in
11037
" ") oldobjs=$obj ;;
11038
*[\ /]"$objbase "*)
11039
while :; do
11040
# Make sure we don't pick an alternate name that also
11041
# overlaps.
11042
newobj=lt$counter-$objbase
11043
func_arith $counter + 1
11044
counter=$func_arith_result
11045
case " $oldobjs " in
11046
*[\ /]"$newobj "*) ;;
11047
*) if test ! -f "$gentop/$newobj"; then break; fi ;;
11048
esac
11049
done
11050
func_show_eval "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj"
11051
func_append oldobjs " $gentop/$newobj"
11052
;;
11053
*) func_append oldobjs " $obj" ;;
11054
esac
11055
done
11056
fi
11057
func_to_tool_file "$oldlib" func_convert_file_msys_to_w32
11058
tool_oldlib=$func_to_tool_file_result
11059
eval cmds=\"$old_archive_cmds\"
11060
11061
func_len " $cmds"
11062
len=$func_len_result
11063
if test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then
11064
cmds=$old_archive_cmds
11065
elif test -n "$archiver_list_spec"; then
11066
func_verbose "using command file archive linking..."
11067
for obj in $oldobjs
11068
do
11069
func_to_tool_file "$obj"
11070
$ECHO "$func_to_tool_file_result"
11071
done > $output_objdir/$libname.libcmd
11072
func_to_tool_file "$output_objdir/$libname.libcmd"
11073
oldobjs=" $archiver_list_spec$func_to_tool_file_result"
11074
cmds=$old_archive_cmds
11075
else
11076
# the command line is too long to link in one step, link in parts
11077
func_verbose "using piecewise archive linking..."
11078
save_RANLIB=$RANLIB
11079
RANLIB=:
11080
objlist=
11081
concat_cmds=
11082
save_oldobjs=$oldobjs
11083
oldobjs=
11084
# Is there a better way of finding the last object in the list?
11085
for obj in $save_oldobjs
11086
do
11087
last_oldobj=$obj
11088
done
11089
eval test_cmds=\"$old_archive_cmds\"
11090
func_len " $test_cmds"
11091
len0=$func_len_result
11092
len=$len0
11093
for obj in $save_oldobjs
11094
do
11095
func_len " $obj"
11096
func_arith $len + $func_len_result
11097
len=$func_arith_result
11098
func_append objlist " $obj"
11099
if test "$len" -lt "$max_cmd_len"; then
11100
:
11101
else
11102
# the above command should be used before it gets too long
11103
oldobjs=$objlist
11104
if test "$obj" = "$last_oldobj"; then
11105
RANLIB=$save_RANLIB
11106
fi
11107
test -z "$concat_cmds" || concat_cmds=$concat_cmds~
11108
eval concat_cmds=\"\$concat_cmds$old_archive_cmds\"
11109
objlist=
11110
len=$len0
11111
fi
11112
done
11113
RANLIB=$save_RANLIB
11114
oldobjs=$objlist
11115
if test -z "$oldobjs"; then
11116
eval cmds=\"\$concat_cmds\"
11117
else
11118
eval cmds=\"\$concat_cmds~\$old_archive_cmds\"
11119
fi
11120
fi
11121
fi
11122
func_execute_cmds "$cmds" 'exit $?'
11123
done
11124
11125
test -n "$generated" && \
11126
func_show_eval "${RM}r$generated"
11127
11128
# Now create the libtool archive.
11129
case $output in
11130
*.la)
11131
old_library=
11132
test yes = "$build_old_libs" && old_library=$libname.$libext
11133
func_verbose "creating $output"
11134
11135
# Preserve any variables that may affect compiler behavior
11136
for var in $variables_saved_for_relink; do
11137
if eval test -z \"\${$var+set}\"; then
11138
relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command"
11139
elif eval var_value=\$$var; test -z "$var_value"; then
11140
relink_command="$var=; export $var; $relink_command"
11141
else
11142
func_quote_arg pretty,unquoted "$var_value"
11143
relink_command="$var=$func_quote_arg_unquoted_result; export $var; $relink_command"
11144
fi
11145
done
11146
# Quote the link command for shipping.
11147
func_quote eval cd "`pwd`"
11148
relink_command="($func_quote_result; $SHELL \"$progpath\" $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)"
11149
func_quote_arg pretty,unquoted "$relink_command"
11150
relink_command=$func_quote_arg_unquoted_result
11151
if test yes = "$hardcode_automatic"; then
11152
relink_command=
11153
fi
11154
11155
# Only create the output if not a dry run.
11156
$opt_dry_run || {
11157
for installed in no yes; do
11158
if test yes = "$installed"; then
11159
if test -z "$install_libdir"; then
11160
break
11161
fi
11162
output=$output_objdir/${outputname}i
11163
# Replace all uninstalled libtool libraries with the installed ones
11164
newdependency_libs=
11165
for deplib in $dependency_libs; do
11166
case $deplib in
11167
*.la)
11168
func_basename "$deplib"
11169
name=$func_basename_result
11170
func_resolve_sysroot "$deplib"
11171
eval libdir=`$SED -n -e 's/^libdir=\(.*\)$/\1/p' $func_resolve_sysroot_result`
11172
test -z "$libdir" && \
11173
func_fatal_error "'$deplib' is not a valid libtool archive"
11174
func_append newdependency_libs " ${lt_sysroot:+=}$libdir/$name"
11175
;;
11176
-L*)
11177
func_stripname -L '' "$deplib"
11178
func_replace_sysroot "$func_stripname_result"
11179
func_append newdependency_libs " -L$func_replace_sysroot_result"
11180
;;
11181
-R*)
11182
func_stripname -R '' "$deplib"
11183
func_replace_sysroot "$func_stripname_result"
11184
func_append newdependency_libs " -R$func_replace_sysroot_result"
11185
;;
11186
*) func_append newdependency_libs " $deplib" ;;
11187
esac
11188
done
11189
dependency_libs=$newdependency_libs
11190
newdlfiles=
11191
11192
for lib in $dlfiles; do
11193
case $lib in
11194
*.la)
11195
func_basename "$lib"
11196
name=$func_basename_result
11197
eval libdir=`$SED -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
11198
test -z "$libdir" && \
11199
func_fatal_error "'$lib' is not a valid libtool archive"
11200
func_append newdlfiles " ${lt_sysroot:+=}$libdir/$name"
11201
;;
11202
*) func_append newdlfiles " $lib" ;;
11203
esac
11204
done
11205
dlfiles=$newdlfiles
11206
newdlprefiles=
11207
for lib in $dlprefiles; do
11208
case $lib in
11209
*.la)
11210
# Only pass preopened files to the pseudo-archive (for
11211
# eventual linking with the app. that links it) if we
11212
# didn't already link the preopened objects directly into
11213
# the library:
11214
func_basename "$lib"
11215
name=$func_basename_result
11216
eval libdir=`$SED -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
11217
test -z "$libdir" && \
11218
func_fatal_error "'$lib' is not a valid libtool archive"
11219
func_append newdlprefiles " ${lt_sysroot:+=}$libdir/$name"
11220
;;
11221
esac
11222
done
11223
dlprefiles=$newdlprefiles
11224
else
11225
newdlfiles=
11226
for lib in $dlfiles; do
11227
case $lib in
11228
[\\/]* | [A-Za-z]:[\\/]*) abs=$lib ;;
11229
*) abs=`pwd`"/$lib" ;;
11230
esac
11231
func_append newdlfiles " $abs"
11232
done
11233
dlfiles=$newdlfiles
11234
newdlprefiles=
11235
for lib in $dlprefiles; do
11236
case $lib in
11237
[\\/]* | [A-Za-z]:[\\/]*) abs=$lib ;;
11238
*) abs=`pwd`"/$lib" ;;
11239
esac
11240
func_append newdlprefiles " $abs"
11241
done
11242
dlprefiles=$newdlprefiles
11243
fi
11244
$RM $output
11245
# place dlname in correct position for cygwin
11246
# In fact, it would be nice if we could use this code for all target
11247
# systems that can't hard-code library paths into their executables
11248
# and that have no shared library path variable independent of PATH,
11249
# but it turns out we can't easily determine that from inspecting
11250
# libtool variables, so we have to hard-code the OSs to which it
11251
# applies here; at the moment, that means platforms that use the PE
11252
# object format with DLL files. See the long comment at the top of
11253
# tests/bindir.at for full details.
11254
tdlname=$dlname
11255
case $host,$output,$installed,$module,$dlname in
11256
*cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll | *windows*,*lai,yes,no,*.dll | *cegcc*,*lai,yes,no,*.dll)
11257
# If a -bindir argument was supplied, place the dll there.
11258
if test -n "$bindir"; then
11259
func_relative_path "$install_libdir" "$bindir"
11260
tdlname=$func_relative_path_result/$dlname
11261
else
11262
# Otherwise fall back on heuristic.
11263
tdlname=../bin/$dlname
11264
fi
11265
;;
11266
esac
11267
$ECHO > $output "\
11268
# $outputname - a libtool library file
11269
# Generated by $PROGRAM (GNU $PACKAGE) $VERSION
11270
#
11271
# Please DO NOT delete this file!
11272
# It is necessary for linking the library.
11273
11274
# The name that we can dlopen(3).
11275
dlname='$tdlname'
11276
11277
# Names of this library.
11278
library_names='$library_names'
11279
11280
# The name of the static archive.
11281
old_library='$old_library'
11282
11283
# Linker flags that cannot go in dependency_libs.
11284
inherited_linker_flags='$new_inherited_linker_flags'
11285
11286
# Libraries that this one depends upon.
11287
dependency_libs='$dependency_libs'
11288
11289
# Names of additional weak libraries provided by this library
11290
weak_library_names='$weak_libs'
11291
11292
# Version information for $libname.
11293
current=$current
11294
age=$age
11295
revision=$revision
11296
11297
# Is this an already installed library?
11298
installed=$installed
11299
11300
# Should we warn about portability when linking against -modules?
11301
shouldnotlink=$module
11302
11303
# Files to dlopen/dlpreopen
11304
dlopen='$dlfiles'
11305
dlpreopen='$dlprefiles'
11306
11307
# Directory that this library needs to be installed in:
11308
libdir='$install_libdir'"
11309
if test no,yes = "$installed,$need_relink"; then
11310
$ECHO >> $output "\
11311
relink_command=\"$relink_command\""
11312
fi
11313
done
11314
}
11315
11316
# Do a symbolic link so that the libtool archive can be found in
11317
# LD_LIBRARY_PATH before the program is installed.
11318
func_show_eval '( cd "$output_objdir" && $RM "$outputname" && $LN_S "../$outputname" "$outputname" )' 'exit $?'
11319
;;
11320
esac
11321
exit $EXIT_SUCCESS
11322
}
11323
11324
if test link = "$opt_mode" || test relink = "$opt_mode"; then
11325
func_mode_link ${1+"$@"}
11326
fi
11327
11328
11329
# func_mode_uninstall arg...
11330
func_mode_uninstall ()
11331
{
11332
$debug_cmd
11333
11334
RM=$nonopt
11335
files=
11336
rmforce=false
11337
exit_status=0
11338
11339
# This variable tells wrapper scripts just to set variables rather
11340
# than running their programs.
11341
libtool_install_magic=$magic
11342
11343
for arg
11344
do
11345
case $arg in
11346
-f) func_append RM " $arg"; rmforce=: ;;
11347
-*) func_append RM " $arg" ;;
11348
*) func_append files " $arg" ;;
11349
esac
11350
done
11351
11352
test -z "$RM" && \
11353
func_fatal_help "you must specify an RM program"
11354
11355
rmdirs=
11356
11357
for file in $files; do
11358
func_dirname "$file" "" "."
11359
dir=$func_dirname_result
11360
if test . = "$dir"; then
11361
odir=$objdir
11362
else
11363
odir=$dir/$objdir
11364
fi
11365
func_basename "$file"
11366
name=$func_basename_result
11367
test uninstall = "$opt_mode" && odir=$dir
11368
11369
# Remember odir for removal later, being careful to avoid duplicates
11370
if test clean = "$opt_mode"; then
11371
case " $rmdirs " in
11372
*" $odir "*) ;;
11373
*) func_append rmdirs " $odir" ;;
11374
esac
11375
fi
11376
11377
# Don't error if the file doesn't exist and rm -f was used.
11378
if { test -L "$file"; } >/dev/null 2>&1 ||
11379
{ test -h "$file"; } >/dev/null 2>&1 ||
11380
test -f "$file"; then
11381
:
11382
elif test -d "$file"; then
11383
exit_status=1
11384
continue
11385
elif $rmforce; then
11386
continue
11387
fi
11388
11389
rmfiles=$file
11390
11391
case $name in
11392
*.la)
11393
# Possibly a libtool archive, so verify it.
11394
if func_lalib_p "$file"; then
11395
func_source $dir/$name
11396
11397
# Delete the libtool libraries and symlinks.
11398
for n in $library_names; do
11399
func_append rmfiles " $odir/$n"
11400
done
11401
test -n "$old_library" && func_append rmfiles " $odir/$old_library"
11402
11403
case $opt_mode in
11404
clean)
11405
case " $library_names " in
11406
*" $dlname "*) ;;
11407
*) test -n "$dlname" && func_append rmfiles " $odir/$dlname" ;;
11408
esac
11409
test -n "$libdir" && func_append rmfiles " $odir/$name $odir/${name}i"
11410
;;
11411
uninstall)
11412
if test -n "$library_names"; then
11413
# Do each command in the postuninstall commands.
11414
func_execute_cmds "$postuninstall_cmds" '$rmforce || exit_status=1'
11415
fi
11416
11417
if test -n "$old_library"; then
11418
# Do each command in the old_postuninstall commands.
11419
func_execute_cmds "$old_postuninstall_cmds" '$rmforce || exit_status=1'
11420
fi
11421
# FIXME: should reinstall the best remaining shared library.
11422
;;
11423
esac
11424
fi
11425
;;
11426
11427
*.lo)
11428
# Possibly a libtool object, so verify it.
11429
if func_lalib_p "$file"; then
11430
11431
# Read the .lo file
11432
func_source $dir/$name
11433
11434
# Add PIC object to the list of files to remove.
11435
if test -n "$pic_object" && test none != "$pic_object"; then
11436
func_append rmfiles " $dir/$pic_object"
11437
fi
11438
11439
# Add non-PIC object to the list of files to remove.
11440
if test -n "$non_pic_object" && test none != "$non_pic_object"; then
11441
func_append rmfiles " $dir/$non_pic_object"
11442
fi
11443
fi
11444
;;
11445
11446
*)
11447
if test clean = "$opt_mode"; then
11448
noexename=$name
11449
case $file in
11450
*.exe)
11451
func_stripname '' '.exe' "$file"
11452
file=$func_stripname_result
11453
func_stripname '' '.exe' "$name"
11454
noexename=$func_stripname_result
11455
# $file with .exe has already been added to rmfiles,
11456
# add $file without .exe
11457
func_append rmfiles " $file"
11458
;;
11459
esac
11460
# Do a test to see if this is a libtool program.
11461
if func_ltwrapper_p "$file"; then
11462
if func_ltwrapper_executable_p "$file"; then
11463
func_ltwrapper_scriptname "$file"
11464
relink_command=
11465
func_source $func_ltwrapper_scriptname_result
11466
func_append rmfiles " $func_ltwrapper_scriptname_result"
11467
else
11468
relink_command=
11469
func_source $dir/$noexename
11470
fi
11471
11472
# note $name still contains .exe if it was in $file originally
11473
# as does the version of $file that was added into $rmfiles
11474
func_append rmfiles " $odir/$name $odir/${name}S.$objext"
11475
if test yes = "$fast_install" && test -n "$relink_command"; then
11476
func_append rmfiles " $odir/lt-$name"
11477
fi
11478
if test "X$noexename" != "X$name"; then
11479
func_append rmfiles " $odir/lt-$noexename.c"
11480
fi
11481
fi
11482
fi
11483
;;
11484
esac
11485
func_show_eval "$RM $rmfiles" 'exit_status=1'
11486
done
11487
11488
# Try to remove the $objdir's in the directories where we deleted files
11489
for dir in $rmdirs; do
11490
if test -d "$dir"; then
11491
func_show_eval "rmdir $dir >/dev/null 2>&1"
11492
fi
11493
done
11494
11495
exit $exit_status
11496
}
11497
11498
if test uninstall = "$opt_mode" || test clean = "$opt_mode"; then
11499
func_mode_uninstall ${1+"$@"}
11500
fi
11501
11502
test -z "$opt_mode" && {
11503
help=$generic_help
11504
func_fatal_help "you must specify a MODE"
11505
}
11506
11507
test -z "$exec_cmd" && \
11508
func_fatal_help "invalid operation mode '$opt_mode'"
11509
11510
if test -n "$exec_cmd"; then
11511
eval exec "$exec_cmd"
11512
exit $EXIT_FAILURE
11513
fi
11514
11515
exit $exit_status
11516
11517
11518
# The TAGs below are defined such that we never get into a situation
11519
# where we disable both kinds of libraries. Given conflicting
11520
# choices, we go for a static library, that is the most portable,
11521
# since we can't tell whether shared libraries were disabled because
11522
# the user asked for that or because the platform doesn't support
11523
# them. This is particularly important on AIX, because we don't
11524
# support having both static and shared libraries enabled at the same
11525
# time on that platform, so we default to a shared-only configuration.
11526
# If a disable-shared tag is given, we'll fallback to a static-only
11527
# configuration. But we'll never go from static-only to shared-only.
11528
11529
# ### BEGIN LIBTOOL TAG CONFIG: disable-shared
11530
build_libtool_libs=no
11531
build_old_libs=yes
11532
# ### END LIBTOOL TAG CONFIG: disable-shared
11533
11534
# ### BEGIN LIBTOOL TAG CONFIG: disable-static
11535
build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac`
11536
# ### END LIBTOOL TAG CONFIG: disable-static
11537
11538
# Local Variables:
11539
# mode:shell-script
11540
# sh-indentation:2
11541
# End:
11542
11543