Skip to content
This repository has been archived by the owner on Feb 11, 2021. It is now read-only.

Latest commit

 

History

History
8407 lines (7531 loc) · 238 KB

File metadata and controls

8407 lines (7531 loc) · 238 KB
 
Mar 4, 2009
Mar 4, 2009
1
2
3
4
5
6
7
8
9
10
# Generated from ltmain.m4sh.
# ltmain.sh (GNU libtool) 2.2.6
# Written by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006, 2007 2008 Free Software Foundation, Inc.
# This is free software; see the source for copying conditions. There is NO
# warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# GNU Libtool is free software; you can redistribute it and/or modify
Apr 26, 2001
Apr 26, 2001
11
12
13
14
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
Mar 4, 2009
Mar 4, 2009
15
16
17
18
19
20
# As a special exception to the GNU General Public License,
# if you distribute this file as part of a program or library that
# is built using GNU Libtool, you may include this file under the
# same distribution terms that you use for the rest of that program.
#
# GNU Libtool is distributed in the hope that it will be useful, but
Apr 26, 2001
Apr 26, 2001
21
22
23
24
25
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
Mar 4, 2009
Mar 4, 2009
26
27
28
29
30
31
32
33
# along with GNU Libtool; see the file COPYING. If not, a copy
# can be downloaded from http://www.gnu.org/licenses/gpl.html,
# or obtained by writing to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
# Usage: $progname [OPTION]... [MODE-ARG]...
#
# Provide generalized library-building support services.
Apr 26, 2001
Apr 26, 2001
34
#
Mar 4, 2009
Mar 4, 2009
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
# --config show all configuration variables
# --debug enable verbose shell tracing
# -n, --dry-run display commands without modifying any files
# --features display basic configuration information and exit
# --mode=MODE use operation mode MODE
# --preserve-dup-deps don't remove duplicate dependency libraries
# --quiet, --silent don't print informational messages
# --tag=TAG use configuration variables from tag TAG
# -v, --verbose print informational messages (default)
# --version print version information
# -h, --help print short or long help message
#
# MODE must be one of the following:
#
# clean remove files from the build directory
# compile compile a source file into a libtool object
# execute automatically set library path, then run a program
# finish complete the installation of libtool libraries
# install install libraries or executables
# link create a library or an executable
# uninstall remove libraries from an installed directory
#
# MODE-ARGS vary depending on the MODE.
# Try `$progname --help --mode=MODE' for a more detailed description of MODE.
#
# When reporting a bug, please describe a test case to reproduce it and
# include the following information:
#
# host-triplet: $host
# shell: $SHELL
# compiler: $LTCC
# compiler flags: $LTCFLAGS
# linker: $LD (gnu? $with_gnu_ld)
# $progname: (GNU libtool) 2.2.6
# automake: $automake_version
# autoconf: $autoconf_version
#
# Report bugs to <bug-libtool@gnu.org>.
PROGRAM=ltmain.sh
PACKAGE=libtool
VERSION=2.2.6
TIMESTAMP=""
package_revision=1.3012
# Be Bourne compatible
if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
emulate sh
NULLCMD=:
# Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
# is contrary to our usage. Disable this feature.
alias -g '${1+"$@"}'='"$@"'
setopt NO_GLOB_SUBST
else
case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac
fi
BIN_SH=xpg4; export BIN_SH # for Tru64
DUALCASE=1; export DUALCASE # for MKS sh
# NLS nuisances: We save the old values to restore during execute mode.
# Only set LANG and LC_ALL to C if already set.
# These must not be set unconditionally because not all systems understand
# e.g. LANG=C (notably SCO).
lt_user_locale=
lt_safe_locale=
for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
do
eval "if test \"\${$lt_var+set}\" = set; then
save_$lt_var=\$$lt_var
$lt_var=C
export $lt_var
lt_user_locale=\"$lt_var=\\\$save_\$lt_var; \$lt_user_locale\"
lt_safe_locale=\"$lt_var=C; \$lt_safe_locale\"
fi"
done
$lt_unset CDPATH
: ${CP="cp -f"}
: ${ECHO="echo"}
: ${EGREP="/usr/bin/grep -E"}
: ${FGREP="/usr/bin/grep -F"}
: ${GREP="/usr/bin/grep"}
: ${LN_S="ln -s"}
: ${MAKE="make"}
: ${MKDIR="mkdir"}
: ${MV="mv -f"}
: ${RM="rm -f"}
: ${SED="/opt/local/bin/gsed"}
: ${SHELL="${CONFIG_SHELL-/bin/sh}"}
: ${Xsed="$SED -e 1s/^X//"}
Apr 26, 2001
Apr 26, 2001
130
Mar 4, 2009
Mar 4, 2009
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
# Global variables:
EXIT_SUCCESS=0
EXIT_FAILURE=1
EXIT_MISMATCH=63 # $? = 63 is used to indicate version mismatch to missing.
EXIT_SKIP=77 # $? = 77 is used to indicate a skipped test to automake.
exit_status=$EXIT_SUCCESS
# Make sure IFS has a sensible default
lt_nl='
'
IFS=" $lt_nl"
dirname="s,/[^/]*$,,"
basename="s,^.*/,,"
# func_dirname_and_basename file append nondir_replacement
# perform func_basename and func_dirname in a single function
# call:
# dirname: Compute the dirname of FILE. If nonempty,
# add APPEND to the result, otherwise set result
# to NONDIR_REPLACEMENT.
# value returned in "$func_dirname_result"
# basename: Compute filename of FILE.
# value retuned in "$func_basename_result"
# Implementation must be kept synchronized with func_dirname
# and func_basename. For efficiency, we do not delegate to
# those functions but instead duplicate the functionality here.
func_dirname_and_basename ()
{
# Extract subdirectory from the argument.
func_dirname_result=`$ECHO "X${1}" | $Xsed -e "$dirname"`
if test "X$func_dirname_result" = "X${1}"; then
func_dirname_result="${3}"
else
func_dirname_result="$func_dirname_result${2}"
fi
func_basename_result=`$ECHO "X${1}" | $Xsed -e "$basename"`
}
# Generated shell functions inserted here.
Aug 21, 2004
Aug 21, 2004
172
173
174
175
176
177
178
179
180
# Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh
# is ksh but when the shell is invoked as "sh" and the current value of
# the _XPG environment variable is not equal to 1 (one), the special
# positional parameter $0, within a function call, is the name of the
# function.
progpath="$0"
# The name of this program:
Mar 4, 2009
Mar 4, 2009
181
182
183
184
185
186
187
# In the unlikely event $progname began with a '-', it would play havoc with
# func_echo (imagine progname=-n), so we prepend ./ in that case:
func_dirname_and_basename "$progpath"
progname=$func_basename_result
case $progname in
-*) progname=./$progname ;;
esac
Aug 21, 2004
Aug 21, 2004
188
Mar 4, 2009
Mar 4, 2009
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
# Make sure we have an absolute path for reexecution:
case $progpath in
[\\/]*|[A-Za-z]:\\*) ;;
*[\\/]*)
progdir=$func_dirname_result
progdir=`cd "$progdir" && pwd`
progpath="$progdir/$progname"
;;
*)
save_IFS="$IFS"
IFS=:
for progdir in $PATH; do
IFS="$save_IFS"
test -x "$progdir/$progname" && break
done
IFS="$save_IFS"
test -n "$progdir" || progdir=`pwd`
progpath="$progdir/$progname"
;;
esac
Aug 21, 2004
Aug 21, 2004
209
Mar 4, 2009
Mar 4, 2009
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
# Sed substitution that helps us do robust quoting. It backslashifies
# metacharacters that are still active within double-quoted strings.
Xsed="${SED}"' -e 1s/^X//'
sed_quote_subst='s/\([`"$\\]\)/\\\1/g'
# Same as above, but do not quote variable references.
double_quote_subst='s/\(["`\\]\)/\\\1/g'
# Re-`\' parameter expansions in output of double_quote_subst that were
# `\'-ed in input to the same. If an odd number of `\' preceded a '$'
# in input to double_quote_subst, that '$' was protected from expansion.
# Since each input `\' is now two `\'s, look for any number of runs of
# four `\'s followed by two `\'s and then a '$'. `\' that '$'.
bs='\\'
bs2='\\\\'
bs4='\\\\\\\\'
dollar='\$'
sed_double_backslash="\
s/$bs4/&\\
/g
s/^$bs2$dollar/$bs&/
s/\\([^$bs]\\)$bs2$dollar/\\1$bs2$bs$dollar/g
s/\n//g"
# Standard options:
opt_dry_run=false
opt_help=false
opt_quiet=false
opt_verbose=false
opt_warning=:
# func_echo arg...
# Echo program name prefixed message, along with the current mode
# name if it has been set yet.
func_echo ()
{
$ECHO "$progname${mode+: }$mode: $*"
}
Aug 21, 2004
Aug 21, 2004
248
Mar 4, 2009
Mar 4, 2009
249
250
251
252
253
# func_verbose arg...
# Echo program name prefixed message in verbose mode only.
func_verbose ()
{
$opt_verbose && func_echo ${1+"$@"}
Aug 21, 2004
Aug 21, 2004
254
Mar 4, 2009
Mar 4, 2009
255
256
257
258
259
# A bug in bash halts the script if the last line of a function
# fails when set -e is in force, so we need another command to
# work around that:
:
}
Apr 26, 2001
Apr 26, 2001
260
Mar 4, 2009
Mar 4, 2009
261
262
263
264
265
266
# func_error arg...
# Echo program name prefixed message to standard error.
func_error ()
{
$ECHO "$progname${mode+: }$mode: "${1+"$@"} 1>&2
}
Apr 26, 2001
Apr 26, 2001
267
Mar 4, 2009
Mar 4, 2009
268
269
270
271
272
# func_warning arg...
# Echo program name prefixed warning message to standard error.
func_warning ()
{
$opt_warning && $ECHO "$progname${mode+: }$mode: warning: "${1+"$@"} 1>&2
Apr 26, 2001
Apr 26, 2001
273
Mar 4, 2009
Mar 4, 2009
274
275
276
# bash bug again:
:
}
Apr 26, 2001
Apr 26, 2001
277
Mar 4, 2009
Mar 4, 2009
278
279
280
281
282
283
284
# func_fatal_error arg...
# Echo program name prefixed message to standard error, and exit.
func_fatal_error ()
{
func_error ${1+"$@"}
exit $EXIT_FAILURE
}
Apr 26, 2001
Apr 26, 2001
285
Mar 4, 2009
Mar 4, 2009
286
287
288
289
290
291
292
293
294
# func_fatal_help arg...
# Echo program name prefixed message to standard error, followed by
# a help hint, and exit.
func_fatal_help ()
{
func_error ${1+"$@"}
func_fatal_error "$help"
}
help="Try \`$progname --help' for more information." ## default
Apr 26, 2001
Apr 26, 2001
295
296
Mar 4, 2009
Mar 4, 2009
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
# func_grep expression filename
# Check whether EXPRESSION matches any line of FILENAME, without output.
func_grep ()
{
$GREP "$1" "$2" >/dev/null 2>&1
}
# func_mkdir_p directory-path
# Make sure the entire path to DIRECTORY-PATH is available.
func_mkdir_p ()
{
my_directory_path="$1"
my_dir_list=
if test -n "$my_directory_path" && test "$opt_dry_run" != ":"; then
# Protect directory names starting with `-'
case $my_directory_path in
-*) my_directory_path="./$my_directory_path" ;;
esac
# While some portion of DIR does not yet exist...
while test ! -d "$my_directory_path"; do
# ...make a list in topmost first order. Use a colon delimited
# list incase some portion of path contains whitespace.
my_dir_list="$my_directory_path:$my_dir_list"
# If the last portion added has no slash in it, the list is done
case $my_directory_path in */*) ;; *) break ;; esac
# ...otherwise throw away the child directory and loop
my_directory_path=`$ECHO "X$my_directory_path" | $Xsed -e "$dirname"`
done
my_dir_list=`$ECHO "X$my_dir_list" | $Xsed -e 's,:*$,,'`
save_mkdir_p_IFS="$IFS"; IFS=':'
for my_dir in $my_dir_list; do
IFS="$save_mkdir_p_IFS"
# mkdir can fail with a `File exist' error if two processes
# try to create one of the directories concurrently. Don't
# stop in that case!
$MKDIR "$my_dir" 2>/dev/null || :
done
IFS="$save_mkdir_p_IFS"
# Bail out if we (or some other process) failed to create a directory.
test -d "$my_directory_path" || \
func_fatal_error "Failed to create \`$1'"
fi
}
Apr 26, 2001
Apr 26, 2001
348
Oct 6, 2003
Oct 6, 2003
349
Mar 21, 2006
Mar 21, 2006
350
351
352
353
354
355
356
357
# func_mktempdir [string]
# Make a temporary directory that won't clash with other running
# libtool processes, and avoids race conditions if possible. If
# given, STRING is the basename for that directory.
func_mktempdir ()
{
my_template="${TMPDIR-/tmp}/${1-$progname}"
Mar 4, 2009
Mar 4, 2009
358
if test "$opt_dry_run" = ":"; then
Mar 21, 2006
Mar 21, 2006
359
360
361
362
363
364
365
366
# Return a directory name, but don't create it in dry-run mode
my_tmpdir="${my_template}-$$"
else
# If mktemp works, use that first and foremost
my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null`
if test ! -d "$my_tmpdir"; then
Mar 4, 2009
Mar 4, 2009
367
368
# Failing that, at least try and use $RANDOM to avoid a race
my_tmpdir="${my_template}-${RANDOM-0}$$"
Mar 21, 2006
Mar 21, 2006
369
Mar 4, 2009
Mar 4, 2009
370
371
372
373
save_mktempdir_umask=`umask`
umask 0077
$MKDIR "$my_tmpdir"
umask $save_mktempdir_umask
Mar 21, 2006
Mar 21, 2006
374
375
376
fi
# If we're not in dry-run mode, bomb out on failure
Mar 4, 2009
Mar 4, 2009
377
378
test -d "$my_tmpdir" || \
func_fatal_error "cannot create temporary directory \`$my_tmpdir'"
Mar 21, 2006
Mar 21, 2006
379
380
fi
Mar 4, 2009
Mar 4, 2009
381
$ECHO "X$my_tmpdir" | $Xsed
Mar 21, 2006
Mar 21, 2006
382
383
384
}
Mar 4, 2009
Mar 4, 2009
385
386
387
388
389
390
391
# func_quote_for_eval arg
# Aesthetically quote ARG to be evaled later.
# This function returns two values: FUNC_QUOTE_FOR_EVAL_RESULT
# is double-quoted, suitable for a subsequent eval, whereas
# FUNC_QUOTE_FOR_EVAL_UNQUOTED_RESULT has merely all characters
# which are still active within double quotes backslashified.
func_quote_for_eval ()
Mar 21, 2006
Mar 21, 2006
392
{
Mar 4, 2009
Mar 4, 2009
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
case $1 in
*[\\\`\"\$]*)
func_quote_for_eval_unquoted_result=`$ECHO "X$1" | $Xsed -e "$sed_quote_subst"` ;;
*)
func_quote_for_eval_unquoted_result="$1" ;;
esac
case $func_quote_for_eval_unquoted_result in
# Double-quote args containing shell metacharacters to delay
# word splitting, command substitution and and variable
# expansion for a subsequent eval.
# Many Bourne shells cannot handle close brackets correctly
# in scan sets, so we specify it separately.
*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
func_quote_for_eval_result="\"$func_quote_for_eval_unquoted_result\""
;;
*)
func_quote_for_eval_result="$func_quote_for_eval_unquoted_result"
Oct 6, 2003
Oct 6, 2003
411
412
413
esac
}
Aug 21, 2004
Aug 21, 2004
414
Mar 4, 2009
Mar 4, 2009
415
416
417
418
# func_quote_for_expand arg
# Aesthetically quote ARG to be evaled later; same as above,
# but do not quote variable references.
func_quote_for_expand ()
Mar 21, 2006
Mar 21, 2006
419
{
Mar 4, 2009
Mar 4, 2009
420
421
422
423
case $1 in
*[\\\`\"]*)
my_arg=`$ECHO "X$1" | $Xsed \
-e "$double_quote_subst" -e "$sed_double_backslash"` ;;
Aug 21, 2004
Aug 21, 2004
424
*)
Mar 4, 2009
Mar 4, 2009
425
426
427
428
429
430
431
432
433
434
435
436
437
438
my_arg="$1" ;;
esac
case $my_arg in
# Double-quote args containing shell metacharacters to delay
# word splitting and command substitution for a subsequent eval.
# Many Bourne shells cannot handle close brackets correctly
# in scan sets, so we specify it separately.
*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
my_arg="\"$my_arg\""
;;
esac
func_quote_for_expand_result="$my_arg"
Aug 21, 2004
Aug 21, 2004
439
440
441
}
Mar 4, 2009
Mar 4, 2009
442
443
444
445
446
# func_show_eval cmd [fail_exp]
# Unless opt_silent is true, then output CMD. Then, if opt_dryrun is
# not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP
# is given, then evaluate it.
func_show_eval ()
Mar 21, 2006
Mar 21, 2006
447
{
Mar 4, 2009
Mar 4, 2009
448
449
my_cmd="$1"
my_fail_exp="${2-:}"
Mar 21, 2006
Mar 21, 2006
450
Mar 4, 2009
Mar 4, 2009
451
452
453
454
455
456
457
458
459
460
461
${opt_silent-false} || {
func_quote_for_expand "$my_cmd"
eval "func_echo $func_quote_for_expand_result"
}
if ${opt_dry_run-false}; then :; else
eval "$my_cmd"
my_status=$?
if test "$my_status" -eq 0; then :; else
eval "(exit $my_status); $my_fail_exp"
fi
Mar 21, 2006
Mar 21, 2006
462
463
464
fi
}
Mar 4, 2009
Mar 4, 2009
465
466
467
468
469
470
# func_show_eval_locale cmd [fail_exp]
# Unless opt_silent is true, then output CMD. Then, if opt_dryrun is
# not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP
# is given, then evaluate it. Use the saved locale for evaluation.
func_show_eval_locale ()
Mar 21, 2006
Mar 21, 2006
471
{
Mar 4, 2009
Mar 4, 2009
472
473
my_cmd="$1"
my_fail_exp="${2-:}"
Aug 21, 2004
Aug 21, 2004
474
Mar 4, 2009
Mar 4, 2009
475
476
477
478
479
480
481
482
483
484
485
486
${opt_silent-false} || {
func_quote_for_expand "$my_cmd"
eval "func_echo $func_quote_for_expand_result"
}
if ${opt_dry_run-false}; then :; else
eval "$lt_user_locale
$my_cmd"
my_status=$?
eval "$lt_safe_locale"
if test "$my_status" -eq 0; then :; else
eval "(exit $my_status); $my_fail_exp"
Aug 21, 2004
Aug 21, 2004
487
fi
Mar 4, 2009
Mar 4, 2009
488
fi
Aug 21, 2004
Aug 21, 2004
489
}
Oct 6, 2003
Oct 6, 2003
490
Aug 21, 2004
Aug 21, 2004
491
Mar 21, 2006
Mar 21, 2006
492
Mar 4, 2009
Mar 4, 2009
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
# func_version
# Echo version message to standard output and exit.
func_version ()
{
$SED -n '/^# '$PROGRAM' (GNU /,/# warranty; / {
s/^# //
s/^# *$//
s/\((C)\)[ 0-9,-]*\( [1-9][0-9]*\)/\1\2/
p
}' < "$progpath"
exit $?
}
# func_usage
# Echo short help message to standard output and exit.
func_usage ()
{
$SED -n '/^# Usage:/,/# -h/ {
s/^# //
s/^# *$//
s/\$progname/'$progname'/
p
}' < "$progpath"
$ECHO
$ECHO "run \`$progname --help | more' for full usage"
exit $?
}
# func_help
# Echo long help message to standard output and exit.
func_help ()
{
$SED -n '/^# Usage:/,/# Report bugs to/ {
s/^# //
s/^# *$//
s*\$progname*'$progname'*
s*\$host*'"$host"'*
s*\$SHELL*'"$SHELL"'*
s*\$LTCC*'"$LTCC"'*
s*\$LTCFLAGS*'"$LTCFLAGS"'*
s*\$LD*'"$LD"'*
s/\$with_gnu_ld/'"$with_gnu_ld"'/
s/\$automake_version/'"`(automake --version) 2>/dev/null |$SED 1q`"'/
s/\$autoconf_version/'"`(autoconf --version) 2>/dev/null |$SED 1q`"'/
p
}' < "$progpath"
exit $?
}
# func_missing_arg argname
# Echo program name prefixed message to standard error and set global
# exit_cmd.
func_missing_arg ()
{
func_error "missing argument for $1"
exit_cmd=exit
}
exit_cmd=:
# Check that we have a working $ECHO.
if test "X$1" = X--no-reexec; then
# Discard the --no-reexec flag, and continue.
Apr 26, 2001
Apr 26, 2001
562
shift
Mar 4, 2009
Mar 4, 2009
563
564
565
566
567
568
569
570
571
572
elif test "X$1" = X--fallback-echo; then
# Avoid inline document here, it may be left over
:
elif test "X`{ $ECHO '\t'; } 2>/dev/null`" = 'X\t'; then
# Yippee, $ECHO works!
:
else
# Restart under the correct shell, and then maybe $ECHO will work.
exec $SHELL "$progpath" --no-reexec ${1+"$@"}
fi
Apr 26, 2001
Apr 26, 2001
573
Mar 4, 2009
Mar 4, 2009
574
575
576
577
578
579
580
581
if test "X$1" = X--fallback-echo; then
# used as fallback echo
shift
cat <<EOF
$*
EOF
exit $EXIT_SUCCESS
fi
Apr 26, 2001
Apr 26, 2001
582
Mar 4, 2009
Mar 4, 2009
583
584
magic="%%%MAGIC variable%%%"
magic_exe="%%%MAGIC EXE variable%%%"
Oct 6, 2003
Oct 6, 2003
585
Mar 4, 2009
Mar 4, 2009
586
587
588
589
590
591
592
593
594
# Global variables.
# $mode is unset
nonopt=
execute_dlfiles=
preserve_args=
lo2o="s/\\.lo\$/.${objext}/"
o2lo="s/\\.${objext}\$/.lo/"
extracted_archives=
extracted_serial=0
Apr 26, 2001
Apr 26, 2001
595
Mar 4, 2009
Mar 4, 2009
596
597
598
599
opt_dry_run=false
opt_duplicate_deps=false
opt_silent=false
opt_debug=:
Apr 26, 2001
Apr 26, 2001
600
Mar 4, 2009
Mar 4, 2009
601
602
603
604
# If this variable is set in any of the actions, the command in it
# will be execed at the end. This prevents here-documents from being
# left over by shells.
exec_cmd=
Apr 26, 2001
Apr 26, 2001
605
Mar 4, 2009
Mar 4, 2009
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
# func_fatal_configuration arg...
# Echo program name prefixed message to standard error, followed by
# a configuration failure hint, and exit.
func_fatal_configuration ()
{
func_error ${1+"$@"}
func_error "See the $PACKAGE documentation for more information."
func_fatal_error "Fatal configuration error."
}
# func_config
# Display the configuration for all the tags in this script.
func_config ()
{
re_begincf='^# ### BEGIN LIBTOOL'
re_endcf='^# ### END LIBTOOL'
# Default configuration.
$SED "1,/$re_begincf CONFIG/d;/$re_endcf CONFIG/,\$d" < "$progpath"
Apr 26, 2001
Apr 26, 2001
626
Oct 6, 2003
Oct 6, 2003
627
628
# Now print the configurations for the tags.
for tagname in $taglist; do
Mar 4, 2009
Mar 4, 2009
629
$SED -n "/$re_begincf TAG CONFIG: $tagname\$/,/$re_endcf TAG CONFIG: $tagname\$/p" < "$progpath"
Oct 6, 2003
Oct 6, 2003
630
done
Apr 26, 2001
Apr 26, 2001
631
Mar 4, 2009
Mar 4, 2009
632
633
exit $?
}
Apr 26, 2001
Apr 26, 2001
634
Mar 4, 2009
Mar 4, 2009
635
636
637
638
639
# func_features
# Display the features supported by this script.
func_features ()
{
$ECHO "host: $host"
Apr 26, 2001
Apr 26, 2001
640
if test "$build_libtool_libs" = yes; then
Mar 4, 2009
Mar 4, 2009
641
$ECHO "enable shared libraries"
Apr 26, 2001
Apr 26, 2001
642
else
Mar 4, 2009
Mar 4, 2009
643
$ECHO "disable shared libraries"
Apr 26, 2001
Apr 26, 2001
644
645
fi
if test "$build_old_libs" = yes; then
Mar 4, 2009
Mar 4, 2009
646
$ECHO "enable static libraries"
Apr 26, 2001
Apr 26, 2001
647
else
Mar 4, 2009
Mar 4, 2009
648
$ECHO "disable static libraries"
Apr 26, 2001
Apr 26, 2001
649
fi
Mar 4, 2009
Mar 4, 2009
650
Mar 21, 2006
Mar 21, 2006
651
exit $?
Mar 4, 2009
Mar 4, 2009
652
653
654
655
656
657
658
659
660
661
}
# func_enable_tag tagname
# Verify that TAGNAME is valid, and either flag an error and exit, or
# enable the TAGNAME tag. We also add TAGNAME to the global $taglist
# variable here.
func_enable_tag ()
{
# Global variable:
tagname="$1"
Apr 26, 2001
Apr 26, 2001
662
Mar 4, 2009
Mar 4, 2009
663
664
665
re_begincf="^# ### BEGIN LIBTOOL TAG CONFIG: $tagname\$"
re_endcf="^# ### END LIBTOOL TAG CONFIG: $tagname\$"
sed_extractcf="/$re_begincf/,/$re_endcf/p"
Apr 26, 2001
Apr 26, 2001
666
Mar 4, 2009
Mar 4, 2009
667
668
669
670
671
672
# Validate tagname.
case $tagname in
*[!-_A-Za-z0-9,/]*)
func_fatal_error "invalid tag name: $tagname"
;;
esac
Apr 26, 2001
Apr 26, 2001
673
Mar 4, 2009
Mar 4, 2009
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
# Don't test for the "default" C tag, as we know it's
# there but not specially marked.
case $tagname in
CC) ;;
*)
if $GREP "$re_begincf" "$progpath" >/dev/null 2>&1; then
taglist="$taglist $tagname"
# Evaluate the configuration. Be careful to quote the path
# and the sed script, to avoid splitting on whitespace, but
# also don't use non-portable quotes within backquotes within
# quotes we have to do it in 2 steps:
extractedcf=`$SED -n -e "$sed_extractcf" < "$progpath"`
eval "$extractedcf"
else
func_error "ignoring unknown tag $tagname"
fi
;;
esac
}
Oct 6, 2003
Oct 6, 2003
694
Mar 4, 2009
Mar 4, 2009
695
696
697
# Parse options once, thoroughly. This comes as soon as possible in
# the script to make things like `libtool --version' happen quickly.
{
Apr 26, 2001
Apr 26, 2001
698
Mar 4, 2009
Mar 4, 2009
699
700
701
702
# Shorthand for --mode=foo, only valid as the first argument
case $1 in
clean|clea|cle|cl)
shift; set dummy --mode clean ${1+"$@"}; shift
Mar 21, 2006
Mar 21, 2006
703
;;
Mar 4, 2009
Mar 4, 2009
704
705
compile|compil|compi|comp|com|co|c)
shift; set dummy --mode compile ${1+"$@"}; shift
Oct 6, 2003
Oct 6, 2003
706
;;
Mar 4, 2009
Mar 4, 2009
707
708
execute|execut|execu|exec|exe|ex|e)
shift; set dummy --mode execute ${1+"$@"}; shift
Apr 26, 2001
Apr 26, 2001
709
;;
Mar 4, 2009
Mar 4, 2009
710
711
finish|finis|fini|fin|fi|f)
shift; set dummy --mode finish ${1+"$@"}; shift
Apr 26, 2001
Apr 26, 2001
712
;;
Mar 4, 2009
Mar 4, 2009
713
714
715
716
717
718
719
720
install|instal|insta|inst|ins|in|i)
shift; set dummy --mode install ${1+"$@"}; shift
;;
link|lin|li|l)
shift; set dummy --mode link ${1+"$@"}; shift
;;
uninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u)
shift; set dummy --mode uninstall ${1+"$@"}; shift
Apr 26, 2001
Apr 26, 2001
721
722
723
;;
esac
Mar 4, 2009
Mar 4, 2009
724
725
726
727
# Parse non-mode specific arguments:
while test "$#" -gt 0; do
opt="$1"
shift
Apr 26, 2001
Apr 26, 2001
728
Mar 4, 2009
Mar 4, 2009
729
730
case $opt in
--config) func_config ;;
Mar 21, 2006
Mar 21, 2006
731
Mar 4, 2009
Mar 4, 2009
732
733
734
735
736
--debug) preserve_args="$preserve_args $opt"
func_echo "enabling shell trace mode"
opt_debug='set -x'
$opt_debug
;;
Oct 6, 2003
Oct 6, 2003
737
Mar 4, 2009
Mar 4, 2009
738
739
740
741
-dlopen) test "$#" -eq 0 && func_missing_arg "$opt" && break
execute_dlfiles="$execute_dlfiles $1"
shift
;;
Apr 26, 2001
Apr 26, 2001
742
Mar 4, 2009
Mar 4, 2009
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
--dry-run | -n) opt_dry_run=: ;;
--features) func_features ;;
--finish) mode="finish" ;;
--mode) test "$#" -eq 0 && func_missing_arg "$opt" && break
case $1 in
# Valid mode arguments:
clean) ;;
compile) ;;
execute) ;;
finish) ;;
install) ;;
link) ;;
relink) ;;
uninstall) ;;
# Catch anything else as an error
*) func_error "invalid argument for $opt"
exit_cmd=exit
break
;;
esac
mode="$1"
shift
;;
--preserve-dup-deps)
opt_duplicate_deps=: ;;
--quiet|--silent) preserve_args="$preserve_args $opt"
opt_silent=:
;;
--verbose| -v) preserve_args="$preserve_args $opt"
opt_silent=false
;;
--tag) test "$#" -eq 0 && func_missing_arg "$opt" && break
preserve_args="$preserve_args $opt $1"
func_enable_tag "$1" # tagname is set here
shift
;;
# Separate optargs to long options:
-dlopen=*|--mode=*|--tag=*)
func_opt_split "$opt"
set dummy "$func_opt_split_opt" "$func_opt_split_arg" ${1+"$@"}
shift
;;
-\?|-h) func_usage ;;
--help) opt_help=: ;;
--version) func_version ;;
-*) func_fatal_help "unrecognized option \`$opt'" ;;
*) nonopt="$opt"
break
;;
esac
done
case $host in
*cygwin* | *mingw* | *pw32* | *cegcc*)
# don't eliminate duplications in $postdeps and $predeps
opt_duplicate_compiler_generated_deps=:
Apr 26, 2001
Apr 26, 2001
811
812
;;
*)
Mar 4, 2009
Mar 4, 2009
813
814
815
opt_duplicate_compiler_generated_deps=$opt_duplicate_deps
;;
esac
Apr 26, 2001
Apr 26, 2001
816
Mar 4, 2009
Mar 4, 2009
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
# Having warned about all mis-specified options, bail out if
# anything was wrong.
$exit_cmd $EXIT_FAILURE
}
# func_check_version_match
# Ensure that we are using m4 macros, and libtool script from the same
# release of libtool.
func_check_version_match ()
{
if test "$package_revision" != "$macro_revision"; then
if test "$VERSION" != "$macro_version"; then
if test -z "$macro_version"; then
cat >&2 <<_LT_EOF
$progname: Version mismatch error. This is $PACKAGE $VERSION, but the
$progname: definition of this LT_INIT comes from an older release.
$progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION
$progname: and run autoconf again.
_LT_EOF
else
cat >&2 <<_LT_EOF
$progname: Version mismatch error. This is $PACKAGE $VERSION, but the
$progname: definition of this LT_INIT comes from $PACKAGE $macro_version.
$progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION
$progname: and run autoconf again.
_LT_EOF
Apr 26, 2001
Apr 26, 2001
843
fi
Mar 4, 2009
Mar 4, 2009
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
else
cat >&2 <<_LT_EOF
$progname: Version mismatch error. This is $PACKAGE $VERSION, revision $package_revision,
$progname: but the definition of this LT_INIT comes from revision $macro_revision.
$progname: You should recreate aclocal.m4 with macros from revision $package_revision
$progname: of $PACKAGE $VERSION and run autoconf again.
_LT_EOF
fi
exit $EXIT_MISMATCH
fi
}
## ----------- ##
## Main. ##
## ----------- ##
$opt_help || {
# Sanity checks first:
func_check_version_match
if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
func_fatal_configuration "not configured to build any kind of library"
Apr 26, 2001
Apr 26, 2001
868
869
fi
Mar 4, 2009
Mar 4, 2009
870
871
872
873
874
875
876
test -z "$mode" && func_fatal_error "error: you must specify a MODE."
# Darwin sucks
eval std_shrext=\"$shrext_cmds\"
Apr 26, 2001
Apr 26, 2001
877
878
# Only execute mode is allowed to have -dlopen flags.
if test -n "$execute_dlfiles" && test "$mode" != execute; then
Mar 4, 2009
Mar 4, 2009
879
880
func_error "unrecognized option \`-dlopen'"
$ECHO "$help" 1>&2
Aug 21, 2004
Aug 21, 2004
881
exit $EXIT_FAILURE
Apr 26, 2001
Apr 26, 2001
882
883
884
885
fi
# Change the help message to a mode-specific one.
generic_help="$help"
Mar 4, 2009
Mar 4, 2009
886
887
help="Try \`$progname --help --mode=$mode' for more information."
}
Apr 26, 2001
Apr 26, 2001
888
889
Mar 4, 2009
Mar 4, 2009
890
891
892
893
894
895
896
897
898
899
# func_lalib_p file
# True iff FILE is a libtool `.la' library or `.lo' object file.
# This function is only a basic sanity check; it will hardly flush out
# determined imposters.
func_lalib_p ()
{
test -f "$1" &&
$SED -e 4q "$1" 2>/dev/null \
| $GREP "^# Generated by .*$PACKAGE" > /dev/null 2>&1
}
Apr 26, 2001
Apr 26, 2001
900
Mar 4, 2009
Mar 4, 2009
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
# func_lalib_unsafe_p file
# True iff FILE is a libtool `.la' library or `.lo' object file.
# This function implements the same check as func_lalib_p without
# resorting to external programs. To this end, it redirects stdin and
# closes it afterwards, without saving the original file descriptor.
# As a safety measure, use it only where a negative result would be
# fatal anyway. Works if `file' does not exist.
func_lalib_unsafe_p ()
{
lalib_p=no
if test -f "$1" && test -r "$1" && exec 5<&0 <"$1"; then
for lalib_p_l in 1 2 3 4
do
read lalib_p_line
case "$lalib_p_line" in
\#\ Generated\ by\ *$PACKAGE* ) lalib_p=yes; break;;
esac
done
exec 0<&5 5<&-
fi
test "$lalib_p" = yes
}
Apr 26, 2001
Apr 26, 2001
923
Mar 4, 2009
Mar 4, 2009
924
925
926
927
928
929
930
931
# func_ltwrapper_script_p file
# True iff FILE is a libtool wrapper script
# This function is only a basic sanity check; it will hardly flush out
# determined imposters.
func_ltwrapper_script_p ()
{
func_lalib_p "$1"
}
Oct 6, 2003
Oct 6, 2003
932
Mar 4, 2009
Mar 4, 2009
933
934
935
936
937
938
939
940
941
942
943
944
945
# func_ltwrapper_executable_p file
# True iff FILE is a libtool wrapper executable
# This function is only a basic sanity check; it will hardly flush out
# determined imposters.
func_ltwrapper_executable_p ()
{
func_ltwrapper_exec_suffix=
case $1 in
*.exe) ;;
*) func_ltwrapper_exec_suffix=.exe ;;
esac
$GREP "$magic_exe" "$1$func_ltwrapper_exec_suffix" >/dev/null 2>&1
}
Oct 6, 2003
Oct 6, 2003
946
Mar 4, 2009
Mar 4, 2009
947
948
949
950
951
952
953
954
955
956
957
958
959
# func_ltwrapper_scriptname file
# Assumes file is an ltwrapper_executable
# uses $file to determine the appropriate filename for a
# temporary ltwrapper_script.
func_ltwrapper_scriptname ()
{
func_ltwrapper_scriptname_result=""
if func_ltwrapper_executable_p "$1"; then
func_dirname_and_basename "$1" "" "."
func_stripname '' '.exe' "$func_basename_result"
func_ltwrapper_scriptname_result="$func_dirname_result/$objdir/${func_stripname_result}_ltshwrapper"
fi
}
Oct 6, 2003
Oct 6, 2003
960
Mar 4, 2009
Mar 4, 2009
961
962
963
964
965
966
967
968
# func_ltwrapper_p file
# True iff FILE is a libtool wrapper script or wrapper executable
# This function is only a basic sanity check; it will hardly flush out
# determined imposters.
func_ltwrapper_p ()
{
func_ltwrapper_script_p "$1" || func_ltwrapper_executable_p "$1"
}
Oct 6, 2003
Oct 6, 2003
969
970
Mar 4, 2009
Mar 4, 2009
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
# func_execute_cmds commands fail_cmd
# Execute tilde-delimited COMMANDS.
# If FAIL_CMD is given, eval that upon failure.
# FAIL_CMD may read-access the current command in variable CMD!
func_execute_cmds ()
{
$opt_debug
save_ifs=$IFS; IFS='~'
for cmd in $1; do
IFS=$save_ifs
eval cmd=\"$cmd\"
func_show_eval "$cmd" "${2-:}"
done
IFS=$save_ifs
}
# func_source file
# Source FILE, adding directory component if necessary.
# Note that it is not necessary on cygwin/mingw to append a dot to
# FILE even if both FILE and FILE.exe exist: automatic-append-.exe
# behavior happens only for exec(3), not for open(2)! Also, sourcing
# `FILE.' does not work on cygwin managed mounts.
func_source ()
{
$opt_debug
case $1 in
*/* | *\\*) . "$1" ;;
*) . "./$1" ;;
esac