180
36
# The name of this program:
181
# In the unlikely event $progname began with a '-', it would play havoc with
182
# func_echo (imagine progname=-n), so we prepend ./ in that case:
183
func_dirname_and_basename "$progpath"
184
progname=$func_basename_result
186
-*) progname=./$progname ;;
189
# Make sure we have an absolute path for reexecution:
191
[\\/]*|[A-Za-z]:\\*) ;;
193
progdir=$func_dirname_result
194
progdir=`cd "$progdir" && pwd`
195
progpath="$progdir/$progname"
200
for progdir in $PATH; do
202
test -x "$progdir/$progname" && break
205
test -n "$progdir" || progdir=`pwd`
206
progpath="$progdir/$progname"
210
# Sed substitution that helps us do robust quoting. It backslashifies
211
# metacharacters that are still active within double-quoted strings.
212
Xsed="${SED}"' -e 1s/^X//'
213
sed_quote_subst='s/\([`"$\\]\)/\\\1/g'
215
# Same as above, but do not quote variable references.
216
double_quote_subst='s/\(["`\\]\)/\\\1/g'
218
# Re-`\' parameter expansions in output of double_quote_subst that were
219
# `\'-ed in input to the same. If an odd number of `\' preceded a '$'
220
# in input to double_quote_subst, that '$' was protected from expansion.
221
# Since each input `\' is now two `\'s, look for any number of runs of
222
# four `\'s followed by two `\'s and then a '$'. `\' that '$'.
227
sed_double_backslash="\
231
s/\\([^$bs]\\)$bs2$dollar/\\1$bs2$bs$dollar/g
242
# Echo program name prefixed message, along with the current mode
243
# name if it has been set yet.
246
$ECHO "$progname${mode+: }$mode: $*"
249
# func_verbose arg...
250
# Echo program name prefixed message in verbose mode only.
253
$opt_verbose && func_echo ${1+"$@"}
255
# A bug in bash halts the script if the last line of a function
256
# fails when set -e is in force, so we need another command to
262
# Echo program name prefixed message to standard error.
265
$ECHO "$progname${mode+: }$mode: "${1+"$@"} 1>&2
268
# func_warning arg...
269
# Echo program name prefixed warning message to standard error.
272
$opt_warning && $ECHO "$progname${mode+: }$mode: warning: "${1+"$@"} 1>&2
278
# func_fatal_error arg...
279
# Echo program name prefixed message to standard error, and exit.
286
# func_fatal_help arg...
287
# Echo program name prefixed message to standard error, followed by
288
# a help hint, and exit.
292
func_fatal_error "$help"
294
help="Try \`$progname --help' for more information." ## default
297
# func_grep expression filename
298
# Check whether EXPRESSION matches any line of FILENAME, without output.
301
$GREP "$1" "$2" >/dev/null 2>&1
305
# func_mkdir_p directory-path
306
# Make sure the entire path to DIRECTORY-PATH is available.
309
my_directory_path="$1"
312
if test -n "$my_directory_path" && test "$opt_dry_run" != ":"; then
314
# Protect directory names starting with `-'
315
case $my_directory_path in
316
-*) my_directory_path="./$my_directory_path" ;;
319
# While some portion of DIR does not yet exist...
320
while test ! -d "$my_directory_path"; do
321
# ...make a list in topmost first order. Use a colon delimited
322
# list incase some portion of path contains whitespace.
323
my_dir_list="$my_directory_path:$my_dir_list"
325
# If the last portion added has no slash in it, the list is done
326
case $my_directory_path in */*) ;; *) break ;; esac
328
# ...otherwise throw away the child directory and loop
329
my_directory_path=`$ECHO "X$my_directory_path" | $Xsed -e "$dirname"`
331
my_dir_list=`$ECHO "X$my_dir_list" | $Xsed -e 's,:*$,,'`
333
save_mkdir_p_IFS="$IFS"; IFS=':'
334
for my_dir in $my_dir_list; do
335
IFS="$save_mkdir_p_IFS"
336
# mkdir can fail with a `File exist' error if two processes
337
# try to create one of the directories concurrently. Don't
339
$MKDIR "$my_dir" 2>/dev/null || :
341
IFS="$save_mkdir_p_IFS"
343
# Bail out if we (or some other process) failed to create a directory.
344
test -d "$my_directory_path" || \
345
func_fatal_error "Failed to create \`$1'"
350
# func_mktempdir [string]
351
# Make a temporary directory that won't clash with other running
352
# libtool processes, and avoids race conditions if possible. If
353
# given, STRING is the basename for that directory.
356
my_template="${TMPDIR-/tmp}/${1-$progname}"
358
if test "$opt_dry_run" = ":"; then
359
# Return a directory name, but don't create it in dry-run mode
360
my_tmpdir="${my_template}-$$"
363
# If mktemp works, use that first and foremost
364
my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null`
366
if test ! -d "$my_tmpdir"; then
367
# Failing that, at least try and use $RANDOM to avoid a race
368
my_tmpdir="${my_template}-${RANDOM-0}$$"
370
save_mktempdir_umask=`umask`
373
umask $save_mktempdir_umask
376
# If we're not in dry-run mode, bomb out on failure
377
test -d "$my_tmpdir" || \
378
func_fatal_error "cannot create temporary directory \`$my_tmpdir'"
381
$ECHO "X$my_tmpdir" | $Xsed
385
# func_quote_for_eval arg
386
# Aesthetically quote ARG to be evaled later.
387
# This function returns two values: FUNC_QUOTE_FOR_EVAL_RESULT
388
# is double-quoted, suitable for a subsequent eval, whereas
389
# FUNC_QUOTE_FOR_EVAL_UNQUOTED_RESULT has merely all characters
390
# which are still active within double quotes backslashified.
391
func_quote_for_eval ()
395
func_quote_for_eval_unquoted_result=`$ECHO "X$1" | $Xsed -e "$sed_quote_subst"` ;;
397
func_quote_for_eval_unquoted_result="$1" ;;
400
case $func_quote_for_eval_unquoted_result in
401
# Double-quote args containing shell metacharacters to delay
402
# word splitting, command substitution and and variable
403
# expansion for a subsequent eval.
404
# Many Bourne shells cannot handle close brackets correctly
405
# in scan sets, so we specify it separately.
406
*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
407
func_quote_for_eval_result="\"$func_quote_for_eval_unquoted_result\""
410
func_quote_for_eval_result="$func_quote_for_eval_unquoted_result"
415
# func_quote_for_expand arg
416
# Aesthetically quote ARG to be evaled later; same as above,
417
# but do not quote variable references.
418
func_quote_for_expand ()
422
my_arg=`$ECHO "X$1" | $Xsed \
423
-e "$double_quote_subst" -e "$sed_double_backslash"` ;;
429
# Double-quote args containing shell metacharacters to delay
430
# word splitting and command substitution for a subsequent eval.
431
# Many Bourne shells cannot handle close brackets correctly
432
# in scan sets, so we specify it separately.
433
*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
438
func_quote_for_expand_result="$my_arg"
442
# func_show_eval cmd [fail_exp]
443
# Unless opt_silent is true, then output CMD. Then, if opt_dryrun is
444
# not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP
445
# is given, then evaluate it.
451
${opt_silent-false} || {
452
func_quote_for_expand "$my_cmd"
453
eval "func_echo $func_quote_for_expand_result"
456
if ${opt_dry_run-false}; then :; else
459
if test "$my_status" -eq 0; then :; else
460
eval "(exit $my_status); $my_fail_exp"
466
# func_show_eval_locale cmd [fail_exp]
467
# Unless opt_silent is true, then output CMD. Then, if opt_dryrun is
468
# not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP
469
# is given, then evaluate it. Use the saved locale for evaluation.
470
func_show_eval_locale ()
475
${opt_silent-false} || {
476
func_quote_for_expand "$my_cmd"
477
eval "func_echo $func_quote_for_expand_result"
480
if ${opt_dry_run-false}; then :; else
481
eval "$lt_user_locale
484
eval "$lt_safe_locale"
485
if test "$my_status" -eq 0; then :; else
486
eval "(exit $my_status); $my_fail_exp"
496
# Echo version message to standard output and exit.
499
$SED -n '/^# '$PROGRAM' (GNU /,/# warranty; / {
502
s/\((C)\)[ 0-9,-]*\( [1-9][0-9]*\)/\1\2/
509
# Echo short help message to standard output and exit.
512
$SED -n '/^# Usage:/,/# -h/ {
515
s/\$progname/'$progname'/
519
$ECHO "run \`$progname --help | more' for full usage"
524
# Echo long help message to standard output and exit.
527
$SED -n '/^# Usage:/,/# Report bugs to/ {
530
s*\$progname*'$progname'*
532
s*\$SHELL*'"$SHELL"'*
534
s*\$LTCFLAGS*'"$LTCFLAGS"'*
536
s/\$with_gnu_ld/'"$with_gnu_ld"'/
537
s/\$automake_version/'"`(automake --version) 2>/dev/null |$SED 1q`"'/
538
s/\$autoconf_version/'"`(autoconf --version) 2>/dev/null |$SED 1q`"'/
544
# func_missing_arg argname
545
# Echo program name prefixed message to standard error and set global
549
func_error "missing argument for $1"
559
# Check that we have a working $ECHO.
37
progname=`echo "$progpath" | $SED $basename`
46
VERSION="1.5.22 Debian 1.5.22-4"
47
TIMESTAMP=" (1.1220.2.365 2005/12/18 22:14:06)"
49
# See if we are running on zsh, and set the options which allow our
50
# commands through without removal of \ escapes.
51
if test -n "${ZSH_VERSION+set}" ; then
55
# Check that we have a working $echo.
560
56
if test "X$1" = X--no-reexec; then
561
57
# Discard the --no-reexec flag, and continue.
563
59
elif test "X$1" = X--fallback-echo; then
564
60
# Avoid inline document here, it may be left over
566
elif test "X`{ $ECHO '\t'; } 2>/dev/null`" = 'X\t'; then
567
# Yippee, $ECHO works!
62
elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then
63
# Yippee, $echo works!
570
# Restart under the correct shell, and then maybe $ECHO will work.
66
# Restart under the correct shell, and then maybe $echo will work.
571
67
exec $SHELL "$progpath" --no-reexec ${1+"$@"}
580
76
exit $EXIT_SUCCESS
80
help="Try \`$progname --help' for more information."
583
81
magic="%%%MAGIC variable%%%"
584
magic_exe="%%%MAGIC EXE variable%%%"
86
# Sed substitution that helps us do robust quoting. It backslashifies
87
# metacharacters that are still active within double-quoted strings.
88
Xsed="${SED}"' -e 1s/^X//'
89
sed_quote_subst='s/\([\\`\\"$\\\\]\)/\\\1/g'
90
# test EBCDIC or ASCII
91
case `echo X|tr X '\101'` in
92
A) # ASCII based system
93
# \n is not interpreted correctly by Solaris 8 /usr/ucb/tr
95
NL2SP='tr \015\012 \040\040'
97
*) # EBCDIC based system
99
NL2SP='tr \r\n \100\100'
104
# Only set LANG and LC_ALL to C if already set.
105
# These must not be set unconditionally because not all systems understand
106
# e.g. LANG=C (notably SCO).
107
# We save the old values to restore during execute mode.
108
if test "${LC_ALL+set}" = set; then
109
save_LC_ALL="$LC_ALL"; LC_ALL=C; export LC_ALL
111
if test "${LANG+set}" = set; then
112
save_LANG="$LANG"; LANG=C; export LANG
115
# Make sure IFS has a sensible default
120
if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
121
$echo "$modename: not configured to build any kind of library" 1>&2
122
$echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2
586
126
# Global variables.
591
137
lo2o="s/\\.lo\$/.${objext}/"
592
138
o2lo="s/\\.${objext}\$/.lo/"
597
opt_duplicate_deps=false
601
# If this variable is set in any of the actions, the command in it
602
# will be execed at the end. This prevents here-documents from being
603
# left over by shells.
606
# func_fatal_configuration arg...
607
# Echo program name prefixed message to standard error, followed by
608
# a configuration failure hint, and exit.
609
func_fatal_configuration ()
612
func_error "See the $PACKAGE documentation for more information."
613
func_fatal_error "Fatal configuration error."
618
# Display the configuration for all the tags in this script.
621
re_begincf='^# ### BEGIN LIBTOOL'
622
re_endcf='^# ### END LIBTOOL'
624
# Default configuration.
625
$SED "1,/$re_begincf CONFIG/d;/$re_endcf CONFIG/,\$d" < "$progpath"
627
# Now print the configurations for the tags.
628
for tagname in $taglist; do
629
$SED -n "/$re_begincf TAG CONFIG: $tagname\$/,/$re_endcf TAG CONFIG: $tagname\$/p" < "$progpath"
636
# Display the features supported by this script.
640
if test "$build_libtool_libs" = yes; then
641
$ECHO "enable shared libraries"
643
$ECHO "disable shared libraries"
645
if test "$build_old_libs" = yes; then
646
$ECHO "enable static libraries"
648
$ECHO "disable static libraries"
654
# func_enable_tag tagname
655
# Verify that TAGNAME is valid, and either flag an error and exit, or
656
# enable the TAGNAME tag. We also add TAGNAME to the global $taglist
663
re_begincf="^# ### BEGIN LIBTOOL TAG CONFIG: $tagname\$"
664
re_endcf="^# ### END LIBTOOL TAG CONFIG: $tagname\$"
665
sed_extractcf="/$re_begincf/,/$re_endcf/p"
670
func_fatal_error "invalid tag name: $tagname"
674
# Don't test for the "default" C tag, as we know it's
675
# there but not specially marked.
679
if $GREP "$re_begincf" "$progpath" >/dev/null 2>&1; then
680
taglist="$taglist $tagname"
682
# Evaluate the configuration. Be careful to quote the path
683
# and the sed script, to avoid splitting on whitespace, but
684
# also don't use non-portable quotes within backquotes within
685
# quotes we have to do it in 2 steps:
686
extractedcf=`$SED -n -e "$sed_extractcf" < "$progpath"`
689
func_error "ignoring unknown tag $tagname"
695
# Parse options once, thoroughly. This comes as soon as possible in
696
# the script to make things like `libtool --version' happen quickly.
699
# Shorthand for --mode=foo, only valid as the first argument
702
shift; set dummy --mode clean ${1+"$@"}; shift
704
compile|compil|compi|comp|com|co|c)
705
shift; set dummy --mode compile ${1+"$@"}; shift
707
execute|execut|execu|exec|exe|ex|e)
708
shift; set dummy --mode execute ${1+"$@"}; shift
710
finish|finis|fini|fin|fi|f)
711
shift; set dummy --mode finish ${1+"$@"}; shift
713
install|instal|insta|inst|ins|in|i)
714
shift; set dummy --mode install ${1+"$@"}; shift
717
shift; set dummy --mode link ${1+"$@"}; shift
719
uninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u)
720
shift; set dummy --mode uninstall ${1+"$@"}; shift
724
# Parse non-mode specific arguments:
725
while test "$#" -gt 0; do
730
--config) func_config ;;
732
--debug) preserve_args="$preserve_args $opt"
733
func_echo "enabling shell trace mode"
738
-dlopen) test "$#" -eq 0 && func_missing_arg "$opt" && break
739
execute_dlfiles="$execute_dlfiles $1"
743
--dry-run | -n) opt_dry_run=: ;;
744
--features) func_features ;;
745
--finish) mode="finish" ;;
747
--mode) test "$#" -eq 0 && func_missing_arg "$opt" && break
749
# Valid mode arguments:
759
# Catch anything else as an error
760
*) func_error "invalid argument for $opt"
771
opt_duplicate_deps=: ;;
773
--quiet|--silent) preserve_args="$preserve_args $opt"
777
--verbose| -v) preserve_args="$preserve_args $opt"
781
--tag) test "$#" -eq 0 && func_missing_arg "$opt" && break
782
preserve_args="$preserve_args $opt $1"
783
func_enable_tag "$1" # tagname is set here
787
# Separate optargs to long options:
788
-dlopen=*|--mode=*|--tag=*)
789
func_opt_split "$opt"
790
set dummy "$func_opt_split_opt" "$func_opt_split_arg" ${1+"$@"}
794
-\?|-h) func_usage ;;
795
--help) opt_help=: ;;
796
--version) func_version ;;
798
-*) func_fatal_help "unrecognized option \`$opt'" ;;
808
*cygwin* | *mingw* | *pw32*)
809
# don't eliminate duplications in $postdeps and $predeps
810
opt_duplicate_compiler_generated_deps=:
813
opt_duplicate_compiler_generated_deps=$opt_duplicate_deps
817
# Having warned about all mis-specified options, bail out if
818
# anything was wrong.
819
$exit_cmd $EXIT_FAILURE
822
# func_check_version_match
823
# Ensure that we are using m4 macros, and libtool script from the same
824
# release of libtool.
825
func_check_version_match ()
827
if test "$package_revision" != "$macro_revision"; then
828
if test "$VERSION" != "$macro_version"; then
829
if test -z "$macro_version"; then
831
$progname: Version mismatch error. This is $PACKAGE $VERSION, but the
832
$progname: definition of this LT_INIT comes from an older release.
833
$progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION
834
$progname: and run autoconf again.
838
$progname: Version mismatch error. This is $PACKAGE $VERSION, but the
839
$progname: definition of this LT_INIT comes from $PACKAGE $macro_version.
840
$progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION
841
$progname: and run autoconf again.
846
$progname: Version mismatch error. This is $PACKAGE $VERSION, revision $package_revision,
847
$progname: but the definition of this LT_INIT comes from revision $macro_revision.
848
$progname: You should recreate aclocal.m4 with macros from revision $package_revision
849
$progname: of $PACKAGE $VERSION and run autoconf again.
863
# Sanity checks first:
864
func_check_version_match
866
if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
867
func_fatal_configuration "not configured to build any kind of library"
870
test -z "$mode" && func_fatal_error "error: you must specify a MODE."
874
eval std_shrext=\"$shrext_cmds\"
877
# Only execute mode is allowed to have -dlopen flags.
878
if test -n "$execute_dlfiles" && test "$mode" != execute; then
879
func_error "unrecognized option \`-dlopen'"
884
# Change the help message to a mode-specific one.
886
help="Try \`$progname --help --mode=$mode' for more information."
891
# True iff FILE is a libtool `.la' library or `.lo' object file.
892
# This function is only a basic sanity check; it will hardly flush out
893
# determined imposters.
896
$SED -e 4q "$1" 2>/dev/null \
897
| $GREP "^# Generated by .*$PACKAGE" > /dev/null 2>&1
900
# func_lalib_unsafe_p file
901
# True iff FILE is a libtool `.la' library or `.lo' object file.
902
# This function implements the same check as func_lalib_p without
903
# resorting to external programs. To this end, it redirects stdin and
904
# closes it afterwards, without saving the original file descriptor.
905
# As a safety measure, use it only where a negative result would be
906
# fatal anyway. Works if `file' does not exist.
907
func_lalib_unsafe_p ()
910
if test -r "$1" && exec 5<&0 <"$1"; then
911
for lalib_p_l in 1 2 3 4
914
case "$lalib_p_line" in
915
\#\ Generated\ by\ *$PACKAGE* ) lalib_p=yes; break;;
920
test "$lalib_p" = yes
923
# func_ltwrapper_script_p file
924
# True iff FILE is a libtool wrapper script
925
# This function is only a basic sanity check; it will hardly flush out
926
# determined imposters.
927
func_ltwrapper_script_p ()
932
# func_ltwrapper_executable_p file
933
# True iff FILE is a libtool wrapper executable
934
# This function is only a basic sanity check; it will hardly flush out
935
# determined imposters.
936
func_ltwrapper_executable_p ()
938
func_ltwrapper_exec_suffix=
941
*) func_ltwrapper_exec_suffix=.exe ;;
943
$GREP "$magic_exe" "$1$func_ltwrapper_exec_suffix" >/dev/null 2>&1
946
# func_ltwrapper_scriptname file
947
# Assumes file is an ltwrapper_executable
948
# uses $file to determine the appropriate filename for a
949
# temporary ltwrapper_script.
950
func_ltwrapper_scriptname ()
952
func_ltwrapper_scriptname_result=""
953
if func_ltwrapper_executable_p "$1"; then
954
func_dirname_and_basename "$1" "" "."
955
func_stripname '' '.exe' "$func_basename_result"
956
func_ltwrapper_scriptname_result="$func_dirname_result/$objdir/${func_stripname_result}_ltshwrapper"
960
# func_ltwrapper_p file
961
# True iff FILE is a libtool wrapper script or wrapper executable
962
# This function is only a basic sanity check; it will hardly flush out
963
# determined imposters.
966
func_ltwrapper_script_p "$1" || func_ltwrapper_executable_p "$1"
970
# func_execute_cmds commands fail_cmd
971
# Execute tilde-delimited COMMANDS.
972
# If FAIL_CMD is given, eval that upon failure.
973
# FAIL_CMD may read-access the current command in variable CMD!
977
save_ifs=$IFS; IFS='~'
981
func_show_eval "$cmd" "${2-:}"
988
# Source FILE, adding directory component if necessary.
989
# Note that it is not necessary on cygwin/mingw to append a dot to
990
# FILE even if both FILE and FILE.exe exist: automatic-append-.exe
991
# behavior happens only for exec(3), not for open(2)! Also, sourcing
992
# `FILE.' does not work on cygwin managed mounts.
997
*/* | *\\*) . "$1" ;;
140
#####################################
141
# Shell function definitions:
142
# This seems to be the best place for them
144
# func_mktempdir [string]
145
# Make a temporary directory that won't clash with other running
146
# libtool processes, and avoids race conditions if possible. If
147
# given, STRING is the basename for that directory.
150
my_template="${TMPDIR-/tmp}/${1-$progname}"
152
if test "$run" = ":"; then
153
# Return a directory name, but don't create it in dry-run mode
154
my_tmpdir="${my_template}-$$"
157
# If mktemp works, use that first and foremost
158
my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null`
160
if test ! -d "$my_tmpdir"; then
161
# Failing that, at least try and use $RANDOM to avoid a race
162
my_tmpdir="${my_template}-${RANDOM-0}$$"
164
save_mktempdir_umask=`umask`
167
umask $save_mktempdir_umask
170
# If we're not in dry-run mode, bomb out on failure
171
test -d "$my_tmpdir" || {
172
$echo "cannot create temporary directory \`$my_tmpdir'" 1>&2
177
$echo "X$my_tmpdir" | $Xsed
181
# func_win32_libid arg
182
# return the library type of file 'arg'
184
# Need a lot of goo to handle *both* DLLs and import libs
185
# Has to be a shell function in order to 'eat' the argument
186
# that is supplied when $file_magic_command is called.
189
win32_libid_type="unknown"
190
win32_fileres=`file -L $1 2>/dev/null`
191
case $win32_fileres in
192
*ar\ archive\ import\ library*) # definitely import
193
win32_libid_type="x86 archive import"
195
*ar\ archive*) # could be an import, or static
196
if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | \
197
$EGREP -e 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then
198
win32_nmres=`eval $NM -f posix -A $1 | \
199
$SED -n -e '1,100{/ I /{s,.*,import,;p;q;};}'`
201
import*) win32_libid_type="x86 archive import";;
202
*) win32_libid_type="x86 archive static";;
207
win32_libid_type="x86 DLL"
209
*executable*) # but shell scripts are "executable" too...
210
case $win32_fileres in
211
*MS\ Windows\ PE\ Intel*)
212
win32_libid_type="x86 DLL"
217
$echo $win32_libid_type
1419
1020
avoid parallel builds (make -j) in this platform, or get a better
1422
$opt_dry_run || $RM $removelist
1023
$run $rm $removelist
1423
1024
exit $EXIT_FAILURE
1426
1027
# Just move the object if needed
1427
1028
if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then
1428
func_show_eval '$MV "$output_obj" "$obj"' \
1429
'error=$?; $opt_dry_run || $RM $removelist; exit $error'
1434
func_write_libtool_object "$libobj" "$objdir/$objname" "$objname"
1436
# Unlock the critical section if it was locked
1437
if test "$need_locks" != no; then
1438
removelist=$lockfile
1447
test "$mode" = compile && func_mode_compile ${1+"$@"}
1452
# We need to display help for each of the modes.
1455
# Generic help is extracted from the usage comments
1456
# at the start of this file.
1462
"Usage: $progname [OPTION]... --mode=clean RM [RM-OPTION]... FILE...
1464
Remove files from the build directory.
1466
RM is the name of the program to use to delete files associated with each FILE
1467
(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
1470
If FILE is a libtool library, object or program, all the files associated
1471
with it are deleted. Otherwise, only FILE itself is deleted using RM."
1476
"Usage: $progname [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE
1478
Compile a source file into a libtool library object.
1480
This mode accepts the following additional options:
1482
-o OUTPUT-FILE set the output file name to OUTPUT-FILE
1483
-no-suppress do not suppress compiler output for multiple passes
1484
-prefer-pic try to building PIC objects only
1485
-prefer-non-pic try to building non-PIC objects only
1486
-shared do not build a \`.o' file suitable for static linking
1487
-static only build a \`.o' file suitable for static linking
1489
COMPILE-COMMAND is a command to be used in creating a \`standard' object file
1490
from the given SOURCEFILE.
1492
The output file name is determined by removing the directory component from
1493
SOURCEFILE, then substituting the C source code suffix \`.c' with the
1494
library object suffix, \`.lo'."
1499
"Usage: $progname [OPTION]... --mode=execute COMMAND [ARGS]...
1501
Automatically set library path, then run a program.
1503
This mode accepts the following additional options:
1505
-dlopen FILE add the directory containing FILE to the library path
1507
This mode sets the library path environment variable according to \`-dlopen'
1510
If any of the ARGS are libtool executable wrappers, then they are translated
1511
into their corresponding uninstalled binary, and any of their required library
1512
directories are added to the library path.
1514
Then, COMMAND is executed, with ARGS as arguments."
1519
"Usage: $progname [OPTION]... --mode=finish [LIBDIR]...
1521
Complete the installation of libtool libraries.
1523
Each LIBDIR is a directory that contains libtool libraries.
1525
The commands that this mode executes may require superuser privileges. Use
1526
the \`--dry-run' option if you just want to see what would be executed."
1531
"Usage: $progname [OPTION]... --mode=install INSTALL-COMMAND...
1533
Install executables or libraries.
1535
INSTALL-COMMAND is the installation command. The first component should be
1536
either the \`install' or \`cp' program.
1538
The following components of INSTALL-COMMAND are treated specially:
1540
-inst-prefix PREFIX-DIR Use PREFIX-DIR as a staging area for installation
1542
The rest of the components are interpreted as arguments to that command (only
1543
BSD-compatible install options are recognized)."
1548
"Usage: $progname [OPTION]... --mode=link LINK-COMMAND...
1550
Link object files or libraries together to form another library, or to
1551
create an executable program.
1553
LINK-COMMAND is a command using the C compiler that you would use to create
1554
a program from several object files.
1556
The following components of LINK-COMMAND are treated specially:
1558
-all-static do not do any dynamic linking at all
1559
-avoid-version do not add a version suffix if possible
1560
-dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime
1561
-dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols
1562
-export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
1563
-export-symbols SYMFILE
1564
try to export only the symbols listed in SYMFILE
1565
-export-symbols-regex REGEX
1566
try to export only the symbols matching REGEX
1567
-LLIBDIR search LIBDIR for required installed libraries
1568
-lNAME OUTPUT-FILE requires the installed library libNAME
1569
-module build a library that can dlopened
1570
-no-fast-install disable the fast-install mode
1571
-no-install link a not-installable executable
1572
-no-undefined declare that a library does not refer to external symbols
1573
-o OUTPUT-FILE create OUTPUT-FILE from the specified objects
1574
-objectlist FILE Use a list of object files found in FILE to specify objects
1575
-precious-files-regex REGEX
1576
don't remove output files matching REGEX
1577
-release RELEASE specify package release information
1578
-rpath LIBDIR the created library will eventually be installed in LIBDIR
1579
-R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries
1580
-shared only do dynamic linking of libtool libraries
1581
-shrext SUFFIX override the standard shared library file extension
1582
-static do not do any dynamic linking of uninstalled libtool libraries
1583
-static-libtool-libs
1584
do not do any dynamic linking of libtool libraries
1585
-version-info CURRENT[:REVISION[:AGE]]
1586
specify library version info [each variable defaults to 0]
1587
-weak LIBNAME declare that the target provides the LIBNAME interface
1589
All other options (arguments beginning with \`-') are ignored.
1591
Every other argument is treated as a filename. Files ending in \`.la' are
1592
treated as uninstalled libtool libraries, other files are standard or library
1595
If the OUTPUT-FILE ends in \`.la', then a libtool library is created,
1596
only library objects (\`.lo' files) may be specified, and \`-rpath' is
1597
required, except when creating a convenience library.
1599
If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created
1600
using \`ar' and \`ranlib', or on Windows using \`lib'.
1602
If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file
1603
is created, otherwise an executable program is created."
1608
"Usage: $progname [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE...
1610
Remove libraries from an installation directory.
1612
RM is the name of the program to use to delete files associated with each FILE
1613
(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
1616
If FILE is a libtool library, all the files associated with it are deleted.
1617
Otherwise, only FILE itself is deleted using RM."
1621
func_fatal_help "invalid operation mode \`$mode'"
1626
$ECHO "Try \`$progname --help' for more information about other modes."
1631
# Now that we've collected a possible --mode arg, show help if necessary
1632
$opt_help && func_mode_help
1635
# func_mode_execute arg...
1636
func_mode_execute ()
1639
# The first argument is the command name.
1642
func_fatal_help "you must specify a COMMAND"
1644
# Handle -dlopen flags immediately.
1645
for file in $execute_dlfiles; do
1647
|| func_fatal_help "\`$file' is not a file"
1652
# Check to see that this really is a libtool archive.
1653
func_lalib_unsafe_p "$file" \
1654
|| func_fatal_help "\`$lib' is not a valid libtool archive"
1656
# Read the libtool library.
1661
# Skip this library if it cannot be dlopened.
1662
if test -z "$dlname"; then
1663
# Warn if it was a shared library.
1664
test -n "$library_names" && \
1665
func_warning "\`$file' was not linked with \`-export-dynamic'"
1669
func_dirname "$file" "" "."
1670
dir="$func_dirname_result"
1672
if test -f "$dir/$objdir/$dlname"; then
1675
if test ! -f "$dir/$dlname"; then
1676
func_fatal_error "cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'"
1682
# Just add the directory containing the .lo file.
1683
func_dirname "$file" "" "."
1684
dir="$func_dirname_result"
1688
func_warning "\`-dlopen' is ignored for non-libtool libraries and objects"
1693
# Get the absolute pathname.
1694
absdir=`cd "$dir" && pwd`
1695
test -n "$absdir" && dir="$absdir"
1697
# Now add the directory to shlibpath_var.
1698
if eval "test -z \"\$$shlibpath_var\""; then
1699
eval "$shlibpath_var=\"\$dir\""
1701
eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\""
1705
# This variable tells wrapper scripts just to set shlibpath_var
1706
# rather than running their programs.
1707
libtool_execute_magic="$magic"
1709
# Check if any of the arguments is a wrapper script.
1716
# Do a test to see if this is really a libtool program.
1717
if func_ltwrapper_script_p "$file"; then
1719
# Transform arg to wrapped name.
1720
file="$progdir/$program"
1721
elif func_ltwrapper_executable_p "$file"; then
1722
func_ltwrapper_scriptname "$file"
1723
func_source "$func_ltwrapper_scriptname_result"
1724
# Transform arg to wrapped name.
1725
file="$progdir/$program"
1729
# Quote arguments (to preserve shell metacharacters).
1730
func_quote_for_eval "$file"
1731
args="$args $func_quote_for_eval_result"
1734
if test "X$opt_dry_run" = Xfalse; then
1735
if test -n "$shlibpath_var"; then
1736
# Export the shlibpath_var.
1737
eval "export $shlibpath_var"
1740
# Restore saved environment variables
1741
for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
1743
eval "if test \"\${save_$lt_var+set}\" = set; then
1744
$lt_var=\$save_$lt_var; export $lt_var
1750
# Now prepare to actually exec the command.
1751
exec_cmd="\$cmd$args"
1753
# Display what would be done.
1754
if test -n "$shlibpath_var"; then
1755
eval "\$ECHO \"\$shlibpath_var=\$$shlibpath_var\""
1756
$ECHO "export $shlibpath_var"
1763
test "$mode" = execute && func_mode_execute ${1+"$@"}
1766
# func_mode_finish arg...
1773
if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
1776
libdirs="$libdirs $dir"
1779
for libdir in $libdirs; do
1780
if test -n "$finish_cmds"; then
1781
# Do each command in the finish commands.
1782
func_execute_cmds "$finish_cmds" 'admincmds="$admincmds
1785
if test -n "$finish_eval"; then
1786
# Do the single finish_eval.
1787
eval cmds=\"$finish_eval\"
1788
$opt_dry_run || eval "$cmds" || admincmds="$admincmds
1794
# Exit here if they wanted silent mode.
1795
$opt_silent && exit $EXIT_SUCCESS
1797
$ECHO "X----------------------------------------------------------------------" | $Xsed
1798
$ECHO "Libraries have been installed in:"
1799
for libdir in $libdirs; do
1803
$ECHO "If you ever happen to want to link against installed libraries"
1804
$ECHO "in a given directory, LIBDIR, you must either use libtool, and"
1805
$ECHO "specify the full pathname of the library, or use the \`-LLIBDIR'"
1806
$ECHO "flag during linking and do at least one of the following:"
1807
if test -n "$shlibpath_var"; then
1808
$ECHO " - add LIBDIR to the \`$shlibpath_var' environment variable"
1809
$ECHO " during execution"
1811
if test -n "$runpath_var"; then
1812
$ECHO " - add LIBDIR to the \`$runpath_var' environment variable"
1813
$ECHO " during linking"
1815
if test -n "$hardcode_libdir_flag_spec"; then
1817
eval flag=\"$hardcode_libdir_flag_spec\"
1819
$ECHO " - use the \`$flag' linker flag"
1821
if test -n "$admincmds"; then
1822
$ECHO " - have your system administrator run these commands:$admincmds"
1824
if test -f /etc/ld.so.conf; then
1825
$ECHO " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'"
1829
$ECHO "See any operating system documentation about shared libraries for"
1831
solaris2.[6789]|solaris2.1[0-9])
1832
$ECHO "more information, such as the ld(1), crle(1) and ld.so(8) manual"
1836
$ECHO "more information, such as the ld(1) and ld.so(8) manual pages."
1839
$ECHO "X----------------------------------------------------------------------" | $Xsed
1843
test "$mode" = finish && func_mode_finish ${1+"$@"}
1846
# func_mode_install arg...
1847
func_mode_install ()
1850
# There may be an optional sh(1) argument at the beginning of
1851
# install_prog (especially on Windows NT).
1852
if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh ||
1853
# Allow the use of GNU shtool's install command.
1854
$ECHO "X$nonopt" | $GREP shtool >/dev/null; then
1855
# Aesthetically quote it.
1856
func_quote_for_eval "$nonopt"
1857
install_prog="$func_quote_for_eval_result "
1865
# The real first argument should be the name of the installation program.
1866
# Aesthetically quote it.
1867
func_quote_for_eval "$arg"
1868
install_prog="$install_prog$func_quote_for_eval_result"
1870
# We need to accept at least all the BSD install flags.
1880
if test -n "$dest"; then
1881
files="$files $dest"
1889
case " $install_prog " in
1904
# If the previous option needed an argument, then skip it.
1905
if test -n "$prev"; then
1914
# Aesthetically quote the argument.
1915
func_quote_for_eval "$arg"
1916
install_prog="$install_prog $func_quote_for_eval_result"
1919
test -z "$install_prog" && \
1920
func_fatal_help "you must specify an install program"
1922
test -n "$prev" && \
1923
func_fatal_help "the \`$prev' option requires an argument"
1925
if test -z "$files"; then
1926
if test -z "$dest"; then
1927
func_fatal_help "no file or destination specified"
1929
func_fatal_help "you must specify a destination"
1933
# Strip any trailing slash from the destination.
1934
func_stripname '' '/' "$dest"
1935
dest=$func_stripname_result
1937
# Check to see that the destination is a directory.
1938
test -d "$dest" && isdir=yes
1939
if test "$isdir" = yes; then
1943
func_dirname_and_basename "$dest" "" "."
1944
destdir="$func_dirname_result"
1945
destname="$func_basename_result"
1947
# Not a directory, so check to see that there is only one file specified.
1948
set dummy $files; shift
1949
test "$#" -gt 1 && \
1950
func_fatal_help "\`$dest' is not a directory"
1953
[\\/]* | [A-Za-z]:[\\/]*) ;;
1955
for file in $files; do
1959
func_fatal_help "\`$destdir' must be an absolute directory name"
1966
# This variable tells wrapper scripts just to set variables rather
1967
# than running their programs.
1968
libtool_install_magic="$magic"
1973
for file in $files; do
1975
# Do each installation.
1978
# Do the static libraries later.
1979
staticlibs="$staticlibs $file"
1983
# Check to see that this really is a libtool archive.
1984
func_lalib_unsafe_p "$file" \
1985
|| func_fatal_help "\`$file' is not a valid libtool archive"
1992
# Add the libdir to current_libdirs if it is the destination.
1993
if test "X$destdir" = "X$libdir"; then
1994
case "$current_libdirs " in
1996
*) current_libdirs="$current_libdirs $libdir" ;;
1999
# Note the libdir as a future libdir.
2000
case "$future_libdirs " in
2002
*) future_libdirs="$future_libdirs $libdir" ;;
2006
func_dirname "$file" "/" ""
2007
dir="$func_dirname_result"
2010
if test -n "$relink_command"; then
2011
# Determine the prefix the user has applied to our future dir.
2012
inst_prefix_dir=`$ECHO "X$destdir" | $Xsed -e "s%$libdir\$%%"`
2014
# Don't allow the user to place us outside of our expected
2015
# location b/c this prevents finding dependent libraries that
2016
# are installed to the same prefix.
2017
# At present, this check doesn't affect windows .dll's that
2018
# are installed into $libdir/../bin (currently, that works fine)
2019
# but it's something to keep an eye on.
2020
test "$inst_prefix_dir" = "$destdir" && \
2021
func_fatal_error "error: cannot install \`$file' to a directory not ending in $libdir"
2023
if test -n "$inst_prefix_dir"; then
2024
# Stick the inst_prefix_dir data into the link command.
2025
relink_command=`$ECHO "X$relink_command" | $Xsed -e "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"`
2027
relink_command=`$ECHO "X$relink_command" | $Xsed -e "s%@inst_prefix_dir@%%"`
2030
func_warning "relinking \`$file'"
2031
func_show_eval "$relink_command" \
2032
'func_fatal_error "error: relink \`$file'\'' with the above command before installing it"'
2035
# See the names of the shared library.
2036
set dummy $library_names; shift
2037
if test -n "$1"; then
2042
test -n "$relink_command" && srcname="$realname"T
2044
# Install the shared library and build the symlinks.
2045
func_show_eval "$install_prog $dir/$srcname $destdir/$realname" \
2049
cygwin* | mingw* | pw32*)
2057
if test -n "$tstripme" && test -n "$striplib"; then
2058
func_show_eval "$striplib $destdir/$realname" 'exit $?'
2061
if test "$#" -gt 0; then
2062
# Delete the old symlinks, and create new ones.
2063
# Try `ln -sf' first, because the `ln' binary might depend on
2064
# the symlink we replace! Solaris /bin/ln does not understand -f,
2065
# so we also need to try rm && ln -s.
2068
test "$linkname" != "$realname" \
2069
&& func_show_eval "(cd $destdir && { $LN_S -f $realname $linkname || { $RM $linkname && $LN_S $realname $linkname; }; })"
2073
# Do each command in the postinstall commands.
2074
lib="$destdir/$realname"
2075
func_execute_cmds "$postinstall_cmds" 'exit $?'
2078
# Install the pseudo-library for information purposes.
2079
func_basename "$file"
2080
name="$func_basename_result"
2081
instname="$dir/$name"i
2082
func_show_eval "$install_prog $instname $destdir/$name" 'exit $?'
2084
# Maybe install the static library, too.
2085
test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library"
2089
# Install (i.e. copy) a libtool object.
2091
# Figure out destination file name, if it wasn't already specified.
2092
if test -n "$destname"; then
2093
destfile="$destdir/$destname"
2095
func_basename "$file"
2096
destfile="$func_basename_result"
2097
destfile="$destdir/$destfile"
2100
# Deduce the name of the destination old-style object file.
2103
func_lo2o "$destfile"
2104
staticdest=$func_lo2o_result
2107
staticdest="$destfile"
2111
func_fatal_help "cannot copy a libtool object to \`$destfile'"
2115
# Install the libtool object if requested.
2116
test -n "$destfile" && \
2117
func_show_eval "$install_prog $file $destfile" 'exit $?'
2119
# Install the old object if enabled.
2120
if test "$build_old_libs" = yes; then
2121
# Deduce the name of the old-style object file.
2123
staticobj=$func_lo2o_result
2124
func_show_eval "$install_prog \$staticobj \$staticdest" 'exit $?'
2130
# Figure out destination file name, if it wasn't already specified.
2131
if test -n "$destname"; then
2132
destfile="$destdir/$destname"
2134
func_basename "$file"
2135
destfile="$func_basename_result"
2136
destfile="$destdir/$destfile"
2139
# If the file is missing, and there is a .exe on the end, strip it
2140
# because it is most likely a libtool script we actually want to
2145
if test ! -f "$file"; then
2146
func_stripname '' '.exe' "$file"
2147
file=$func_stripname_result
2153
# Do a test to see if this is really a libtool program.
2156
if func_ltwrapper_executable_p "$file"; then
2157
func_ltwrapper_scriptname "$file"
2158
wrapper=$func_ltwrapper_scriptname_result
2160
func_stripname '' '.exe' "$file"
2161
wrapper=$func_stripname_result
2168
if func_ltwrapper_script_p "$wrapper"; then
2172
func_source "$wrapper"
2174
# Check the variables that should have been set.
2175
test -z "$generated_by_libtool_version" && \
2176
func_fatal_error "invalid libtool wrapper script \`$wrapper'"
2179
for lib in $notinst_deplibs; do
2180
# Check to see that each library is installed.
2182
if test -f "$lib"; then
2185
libfile="$libdir/"`$ECHO "X$lib" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test
2186
if test -n "$libdir" && test ! -f "$libfile"; then
2187
func_warning "\`$lib' has not been installed in \`$libdir'"
2193
func_source "$wrapper"
2196
if test "$fast_install" = no && test -n "$relink_command"; then
2198
if test "$finalize" = yes; then
2199
tmpdir=`func_mktempdir`
2200
func_basename "$file$stripped_ext"
2201
file="$func_basename_result"
2202
outputname="$tmpdir/$file"
2203
# Replace the output file specification.
2204
relink_command=`$ECHO "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'`
2207
func_quote_for_expand "$relink_command"
2208
eval "func_echo $func_quote_for_expand_result"
2210
if eval "$relink_command"; then :
2212
func_error "error: relink \`$file' with the above command before installing it"
2213
$opt_dry_run || ${RM}r "$tmpdir"
2218
func_warning "cannot relink \`$file'"
2222
# Install the binary that we compiled earlier.
2223
file=`$ECHO "X$file$stripped_ext" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"`
2227
# remove .exe since cygwin /usr/bin/install will append another
2229
case $install_prog,$host in
2230
*/usr/bin/install*,*cygwin*)
2231
case $file:$destfile in
2236
destfile=$destfile.exe
2239
func_stripname '' '.exe' "$destfile"
2240
destfile=$func_stripname_result
2245
func_show_eval "$install_prog\$stripme \$file \$destfile" 'exit $?'
2246
$opt_dry_run || if test -n "$outputname"; then
2253
for file in $staticlibs; do
2254
func_basename "$file"
2255
name="$func_basename_result"
2257
# Set up the ranlib parameters.
2258
oldlib="$destdir/$name"
2260
func_show_eval "$install_prog \$file \$oldlib" 'exit $?'
2262
if test -n "$stripme" && test -n "$old_striplib"; then
2263
func_show_eval "$old_striplib $oldlib" 'exit $?'
2266
# Do each command in the postinstall commands.
2267
func_execute_cmds "$old_postinstall_cmds" 'exit $?'
2270
test -n "$future_libdirs" && \
2271
func_warning "remember to run \`$progname --finish$future_libdirs'"
2273
if test -n "$current_libdirs"; then
2274
# Maybe just do a dry run.
2275
$opt_dry_run && current_libdirs=" -n$current_libdirs"
2276
exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs'
2282
test "$mode" = install && func_mode_install ${1+"$@"}
2285
# func_generate_dlsyms outputname originator pic_p
2286
# Extract symbols from dlprefiles and create ${outputname}S.o with
2287
# a dlpreopen symbol table.
2288
func_generate_dlsyms ()
2294
my_prefix=`$ECHO "$my_originator" | sed 's%[^a-zA-Z0-9]%_%g'`
2297
if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
2298
if test -n "$NM" && test -n "$global_symbol_pipe"; then
2299
my_dlsyms="${my_outputname}S.c"
2301
func_error "not configured to extract global symbols from dlpreopened files"
2305
if test -n "$my_dlsyms"; then
2309
# Discover the nlist of each of the dlfiles.
2310
nlist="$output_objdir/${my_outputname}.nm"
2312
func_show_eval "$RM $nlist ${nlist}S ${nlist}T"
2314
# Parse the name list into a source file.
2315
func_verbose "creating $output_objdir/$my_dlsyms"
2317
$opt_dry_run || $ECHO > "$output_objdir/$my_dlsyms" "\
2318
/* $my_dlsyms - symbol resolution table for \`$my_outputname' dlsym emulation. */
2319
/* Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION */
2325
/* External symbol declarations for the compiler. */\
2328
if test "$dlself" = yes; then
2329
func_verbose "generating symbol list for \`$output'"
2331
$opt_dry_run || echo ': @PROGRAM@ ' > "$nlist"
2333
# Add our own program objects to the symbol list.
2334
progfiles=`$ECHO "X$objs$old_deplibs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
2335
for progfile in $progfiles; do
2336
func_verbose "extracting global C symbols from \`$progfile'"
2337
$opt_dry_run || eval "$NM $progfile | $global_symbol_pipe >> '$nlist'"
2340
if test -n "$exclude_expsyms"; then
2342
eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
2343
eval '$MV "$nlist"T "$nlist"'
2347
if test -n "$export_symbols_regex"; then
2349
eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T'
2350
eval '$MV "$nlist"T "$nlist"'
2354
# Prepare the list of exported symbols
2355
if test -z "$export_symbols"; then
2356
export_symbols="$output_objdir/$outputname.exp"
2359
eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
2361
*cygwin* | *mingw* )
2362
eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
2363
eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"'
2369
eval "${SED} -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"'
2370
eval '$GREP -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T'
2371
eval '$MV "$nlist"T "$nlist"'
2374
eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
2375
eval 'cat "$nlist" >> "$output_objdir/$outputname.def"'
2382
for dlprefile in $dlprefiles; do
2383
func_verbose "extracting global C symbols from \`$dlprefile'"
2384
func_basename "$dlprefile"
2385
name="$func_basename_result"
2387
eval '$ECHO ": $name " >> "$nlist"'
2388
eval "$NM $dlprefile 2>/dev/null | $global_symbol_pipe >> '$nlist'"
2393
# Make sure we have at least an empty file.
2394
test -f "$nlist" || : > "$nlist"
2396
if test -n "$exclude_expsyms"; then
2397
$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T
2398
$MV "$nlist"T "$nlist"
2401
# Try sorting and uniquifying the output.
2402
if $GREP -v "^: " < "$nlist" |
2403
if sort -k 3 </dev/null >/dev/null 2>&1; then
2408
uniq > "$nlist"S; then
2411
$GREP -v "^: " < "$nlist" > "$nlist"S
2414
if test -f "$nlist"S; then
2415
eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$my_dlsyms"'
2417
$ECHO '/* NONE */' >> "$output_objdir/$my_dlsyms"
2420
$ECHO >> "$output_objdir/$my_dlsyms" "\
2422
/* The mapping between symbol names and symbols. */
2429
*cygwin* | *mingw* )
2430
$ECHO >> "$output_objdir/$my_dlsyms" "\
2431
/* DATA imports from DLLs on WIN32 con't be const, because
2432
runtime relocations are performed -- see ld's documentation
2433
on pseudo-relocs. */"
2436
echo >> "$output_objdir/$my_dlsyms" "\
2437
/* This system does not cope well with relocations in const data */"
2440
lt_dlsym_const=const ;;
2443
$ECHO >> "$output_objdir/$my_dlsyms" "\
2444
extern $lt_dlsym_const lt_dlsymlist
2445
lt_${my_prefix}_LTX_preloaded_symbols[];
2446
$lt_dlsym_const lt_dlsymlist
2447
lt_${my_prefix}_LTX_preloaded_symbols[] =
2449
{ \"$my_originator\", (void *) 0 },"
2451
case $need_lib_prefix in
2453
eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$my_dlsyms"
2456
eval "$global_symbol_to_c_name_address_lib_prefix" < "$nlist" >> "$output_objdir/$my_dlsyms"
2459
$ECHO >> "$output_objdir/$my_dlsyms" "\
2463
/* This works around a problem in FreeBSD linker */
2464
#ifdef FREEBSD_WORKAROUND
2465
static const void *lt_preloaded_setup() {
2466
return lt_${my_prefix}_LTX_preloaded_symbols;
2476
pic_flag_for_symtable=
2477
case "$compile_command " in
2481
# compiling the symbol table file with pic_flag works around
2482
# a FreeBSD bug that causes programs to crash when -lm is
2483
# linked before any other PIC object. But we must not use
2484
# pic_flag when linking with -static. The problem exists in
2485
# FreeBSD 2.2.6 and is fixed in FreeBSD 3.1.
2486
*-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)
2487
pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND" ;;
2489
pic_flag_for_symtable=" $pic_flag" ;;
2491
if test "X$my_pic_p" != Xno; then
2492
pic_flag_for_symtable=" $pic_flag"
2499
for arg in $LTCFLAGS; do
2501
-pie | -fpie | -fPIE) ;;
2502
*) symtab_cflags="$symtab_cflags $arg" ;;
2506
# Now compile the dynamic symbol file.
2507
func_show_eval '(cd $output_objdir && $LTCC$symtab_cflags -c$no_builtin_flag$pic_flag_for_symtable "$my_dlsyms")' 'exit $?'
2509
# Clean up the generated files.
2510
func_show_eval '$RM "$output_objdir/$my_dlsyms" "$nlist" "${nlist}S" "${nlist}T"'
2512
# Transform the symbol file into the correct name.
2513
symfileobj="$output_objdir/${my_outputname}S.$objext"
2515
*cygwin* | *mingw* )
2516
if test -f "$output_objdir/$my_outputname.def"; then
2517
compile_command=`$ECHO "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"`
2518
finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"`
2520
compile_command=`$ECHO "X$compile_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"`
2521
finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"`
2525
compile_command=`$ECHO "X$compile_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"`
2526
finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"`
2531
func_fatal_error "unknown suffix for \`$my_dlsyms'"
2535
# We keep going just in case the user didn't refer to
2536
# lt_preloaded_symbols. The linker will fail if global_symbol_pipe
2537
# really was required.
2539
# Nullify the symbol file.
2540
compile_command=`$ECHO "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"`
2541
finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"`
2545
# func_win32_libid arg
2546
# return the library type of file 'arg'
2548
# Need a lot of goo to handle *both* DLLs and import libs
2549
# Has to be a shell function in order to 'eat' the argument
2550
# that is supplied when $file_magic_command is called.
2554
win32_libid_type="unknown"
2555
win32_fileres=`file -L $1 2>/dev/null`
2556
case $win32_fileres in
2557
*ar\ archive\ import\ library*) # definitely import
2558
win32_libid_type="x86 archive import"
2560
*ar\ archive*) # could be an import, or static
2561
if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null |
2562
$EGREP 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then
2563
win32_nmres=`eval $NM -f posix -A $1 |
2572
case $win32_nmres in
2573
import*) win32_libid_type="x86 archive import";;
2574
*) win32_libid_type="x86 archive static";;
2579
win32_libid_type="x86 DLL"
2581
*executable*) # but shell scripts are "executable" too...
2582
case $win32_fileres in
2583
*MS\ Windows\ PE\ Intel*)
2584
win32_libid_type="x86 DLL"
2589
$ECHO "$win32_libid_type"
2594
# func_extract_an_archive dir oldlib
2595
func_extract_an_archive ()
2598
f_ex_an_ar_dir="$1"; shift
2599
f_ex_an_ar_oldlib="$1"
2600
func_show_eval "(cd \$f_ex_an_ar_dir && $AR x \"\$f_ex_an_ar_oldlib\")" 'exit $?'
2601
if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then
2604
func_fatal_error "object name conflicts in archive: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib"
2609
# func_extract_archives gentop oldlib ...
2610
func_extract_archives ()
2613
my_gentop="$1"; shift
2614
my_oldlibs=${1+"$@"}
2620
for my_xlib in $my_oldlibs; do
2621
# Extract the objects.
2623
[\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;;
2624
*) my_xabs=`pwd`"/$my_xlib" ;;
2626
func_basename "$my_xlib"
2627
my_xlib="$func_basename_result"
2630
case " $extracted_archives " in
2632
func_arith $extracted_serial + 1
2633
extracted_serial=$func_arith_result
2634
my_xlib_u=lt$extracted_serial-$my_xlib ;;
2638
extracted_archives="$extracted_archives $my_xlib_u"
2639
my_xdir="$my_gentop/$my_xlib_u"
2641
func_mkdir_p "$my_xdir"
2645
func_verbose "Extracting $my_xabs"
2646
# Do not bother doing anything if just a dry run
2648
darwin_orig_dir=`pwd`
2649
cd $my_xdir || exit $?
2650
darwin_archive=$my_xabs
2652
darwin_base_archive=`basename "$darwin_archive"`
2653
darwin_arches=`$LIPO -info "$darwin_archive" 2>/dev/null | $GREP Architectures 2>/dev/null || true`
2654
if test -n "$darwin_arches"; then
2655
darwin_arches=`$ECHO "$darwin_arches" | $SED -e 's/.*are://'`
2657
func_verbose "$darwin_base_archive has multiple architectures $darwin_arches"
2658
for darwin_arch in $darwin_arches ; do
2659
func_mkdir_p "unfat-$$/${darwin_base_archive}-${darwin_arch}"
2660
$LIPO -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}"
2661
cd "unfat-$$/${darwin_base_archive}-${darwin_arch}"
2662
func_extract_an_archive "`pwd`" "${darwin_base_archive}"
2664
$RM "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}"
2665
done # $darwin_arches
2666
## Okay now we've a bunch of thin objects, gotta fatten them up :)
2667
darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print | $SED -e "$basename" | sort -u`
2670
for darwin_file in $darwin_filelist; do
2671
darwin_files=`find unfat-$$ -name $darwin_file -print | $NL2SP`
2672
$LIPO -create -output "$darwin_file" $darwin_files
2673
done # $darwin_filelist
2675
cd "$darwin_orig_dir"
2678
func_extract_an_archive "$my_xdir" "$my_xabs"
2683
func_extract_an_archive "$my_xdir" "$my_xabs"
2686
my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP`
2689
func_extract_archives_result="$my_oldobjs"
2694
# func_emit_wrapper arg
2696
# emit a libtool wrapper script on stdout
2697
# don't directly open a file because we may want to
2698
# incorporate the script contents within a cygwin/mingw
2699
# wrapper executable. Must ONLY be called from within
2700
# func_mode_link because it depends on a number of variable
2703
# arg is the value that the WRAPPER_SCRIPT_BELONGS_IN_OBJDIR
2704
# variable will take. If 'yes', then the emitted script
2705
# will assume that the directory in which it is stored is
2706
# the '.lib' directory. This is a cygwin/mingw-specific
2708
func_emit_wrapper ()
2710
func_emit_wrapper_arg1=no
2711
if test -n "$1" ; then
2712
func_emit_wrapper_arg1=$1
2718
# $output - temporary wrapper script for $objdir/$outputname
2719
# Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
2721
# The $output program cannot be directly executed until all the libtool
2722
# libraries that it depends on are installed.
2724
# This wrapper script should never be moved out of the build directory.
2725
# If it is, it will not operate correctly.
2727
# Sed substitution that helps us do robust quoting. It backslashifies
2728
# metacharacters that are still active within double-quoted strings.
2729
Xsed='${SED} -e 1s/^X//'
2730
sed_quote_subst='$sed_quote_subst'
2732
# Be Bourne compatible
2733
if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then
2736
# Zsh 3.x and 4.x performs word splitting on \${1+\"\$@\"}, which
2737
# is contrary to our usage. Disable this feature.
2738
alias -g '\${1+\"\$@\"}'='\"\$@\"'
2739
setopt NO_GLOB_SUBST
2741
case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac
2743
BIN_SH=xpg4; export BIN_SH # for Tru64
2744
DUALCASE=1; export DUALCASE # for MKS sh
2746
# The HP-UX ksh and POSIX shell print the target directory to stdout
2748
(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
2750
relink_command=\"$relink_command\"
2752
# This environment variable determines our operation mode.
2753
if test \"\$libtool_install_magic\" = \"$magic\"; then
2754
# install mode needs the following variables:
2755
generated_by_libtool_version='$macro_version'
2756
notinst_deplibs='$notinst_deplibs'
2758
# When we are sourced in execute mode, \$file and \$ECHO are already set.
2759
if test \"\$libtool_execute_magic\" != \"$magic\"; then
2762
# Make sure echo works.
2763
if test \"X\$1\" = X--no-reexec; then
2764
# Discard the --no-reexec flag, and continue.
2766
elif test \"X\`{ \$ECHO '\t'; } 2>/dev/null\`\" = 'X\t'; then
2767
# Yippee, \$ECHO works!
2770
# Restart under the correct shell, and then maybe \$ECHO will work.
2771
exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"}
2777
# Find the directory that this script lives in.
2778
thisdir=\`\$ECHO \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\`
2779
test \"x\$thisdir\" = \"x\$file\" && thisdir=.
2781
# Follow symbolic links until we get to the real thisdir.
2782
file=\`ls -ld \"\$file\" | ${SED} -n 's/.*-> //p'\`
2783
while test -n \"\$file\"; do
2784
destdir=\`\$ECHO \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\`
2786
# If there was a directory component, then change thisdir.
2787
if test \"x\$destdir\" != \"x\$file\"; then
2788
case \"\$destdir\" in
2789
[\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;;
2790
*) thisdir=\"\$thisdir/\$destdir\" ;;
2794
file=\`\$ECHO \"X\$file\" | \$Xsed -e 's%^.*/%%'\`
2795
file=\`ls -ld \"\$thisdir/\$file\" | ${SED} -n 's/.*-> //p'\`
2798
# Usually 'no', except on cygwin/mingw when embedded into
2800
WRAPPER_SCRIPT_BELONGS_IN_OBJDIR=$func_emit_wrapper_arg1
2801
if test \"\$WRAPPER_SCRIPT_BELONGS_IN_OBJDIR\" = \"yes\"; then
2802
# special case for '.'
2803
if test \"\$thisdir\" = \".\"; then
2806
# remove .libs from thisdir
2807
case \"\$thisdir\" in
2808
*[\\\\/]$objdir ) thisdir=\`\$ECHO \"X\$thisdir\" | \$Xsed -e 's%[\\\\/][^\\\\/]*$%%'\` ;;
2809
$objdir ) thisdir=. ;;
2813
# Try to get the absolute directory name.
2814
absdir=\`cd \"\$thisdir\" && pwd\`
2815
test -n \"\$absdir\" && thisdir=\"\$absdir\"
2818
if test "$fast_install" = yes; then
2820
program=lt-'$outputname'$exeext
2821
progdir=\"\$thisdir/$objdir\"
2823
if test ! -f \"\$progdir/\$program\" ||
2824
{ file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\
2825
test \"X\$file\" != \"X\$progdir/\$program\"; }; then
2827
file=\"\$\$-\$program\"
2829
if test ! -d \"\$progdir\"; then
2830
$MKDIR \"\$progdir\"
2832
$RM \"\$progdir/\$file\"
2837
# relink executable if necessary
2838
if test -n \"\$relink_command\"; then
2839
if relink_command_output=\`eval \$relink_command 2>&1\`; then :
2841
$ECHO \"\$relink_command_output\" >&2
2842
$RM \"\$progdir/\$file\"
2847
$MV \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null ||
2848
{ $RM \"\$progdir/\$program\";
2849
$MV \"\$progdir/\$file\" \"\$progdir/\$program\"; }
2850
$RM \"\$progdir/\$file\"
2854
program='$outputname'
2855
progdir=\"\$thisdir/$objdir\"
2861
if test -f \"\$progdir/\$program\"; then"
2863
# Export our shlibpath_var if we have one.
2864
if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
2866
# Add our own library path to $shlibpath_var
2867
$shlibpath_var=\"$temp_rpath\$$shlibpath_var\"
2869
# Some systems cannot cope with colon-terminated $shlibpath_var
2870
# The second colon is a workaround for a bug in BeOS R4 sed
2871
$shlibpath_var=\`\$ECHO \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\`
2873
export $shlibpath_var
2877
# fixup the dll searchpath if we need to.
2878
if test -n "$dllsearchpath"; then
2880
# Add the dll search path components to the executable PATH
2881
PATH=$dllsearchpath:\$PATH
2886
if test \"\$libtool_execute_magic\" != \"$magic\"; then
2887
# Run the actual program with our arguments.
2890
# Backslashes separate directories on plain windows
2891
*-*-mingw | *-*-os2*)
2893
exec \"\$progdir\\\\\$program\" \${1+\"\$@\"}
2899
exec \"\$progdir/\$program\" \${1+\"\$@\"}
2904
\$ECHO \"\$0: cannot exec \$program \$*\" 1>&2
2908
# The program doesn't exist.
2909
\$ECHO \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2
2910
\$ECHO \"This script is just a wrapper for \$program.\" 1>&2
2911
$ECHO \"See the $PACKAGE documentation for more information.\" 1>&2
2917
# end: func_emit_wrapper
2919
# func_emit_cwrapperexe_src
2920
# emit the source code for a wrapper executable on stdout
2921
# Must ONLY be called from within func_mode_link because
2922
# it depends on a number of variable set therein.
2923
func_emit_cwrapperexe_src ()
2927
/* $cwrappersource - temporary wrapper executable for $objdir/$outputname
2928
Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
2930
The $output program cannot be directly executed until all the libtool
2931
libraries that it depends on are installed.
2933
This wrapper executable should never be moved out of the build directory.
2934
If it is, it will not operate correctly.
2936
Currently, it simply execs the wrapper *script* "$SHELL $output",
2937
but could eventually absorb all of the scripts functionality and
2938
exec $objdir/$outputname directly.
2945
# include <direct.h>
2946
# include <process.h>
2948
# define setmode _setmode
2950
# include <unistd.h>
2951
# include <stdint.h>
2963
#include <sys/stat.h>
2965
#if defined(PATH_MAX)
2966
# define LT_PATHMAX PATH_MAX
2967
#elif defined(MAXPATHLEN)
2968
# define LT_PATHMAX MAXPATHLEN
2970
# define LT_PATHMAX 1024
2981
# define S_IXUSR _S_IEXEC
2983
# ifndef _INTPTR_T_DEFINED
2984
# define intptr_t int
2988
#ifndef DIR_SEPARATOR
2989
# define DIR_SEPARATOR '/'
2990
# define PATH_SEPARATOR ':'
2993
#if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \
2995
# define HAVE_DOS_BASED_FILE_SYSTEM
2996
# define FOPEN_WB "wb"
2997
# ifndef DIR_SEPARATOR_2
2998
# define DIR_SEPARATOR_2 '\\'
3000
# ifndef PATH_SEPARATOR_2
3001
# define PATH_SEPARATOR_2 ';'
3005
#ifndef DIR_SEPARATOR_2
3006
# define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR)
3007
#else /* DIR_SEPARATOR_2 */
3008
# define IS_DIR_SEPARATOR(ch) \
3009
(((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2))
3010
#endif /* DIR_SEPARATOR_2 */
3012
#ifndef PATH_SEPARATOR_2
3013
# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR)
3014
#else /* PATH_SEPARATOR_2 */
3015
# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2)
3016
#endif /* PATH_SEPARATOR_2 */
3019
# define FOPEN_WB "wb"
3023
# define FOPEN_WB "w"
3026
# define _O_BINARY 0
3029
#define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type)))
3030
#define XFREE(stale) do { \
3031
if (stale) { free ((void *) stale); stale = 0; } \
3034
#undef LTWRAPPER_DEBUGPRINTF
3035
#if defined DEBUGWRAPPER
3036
# define LTWRAPPER_DEBUGPRINTF(args) ltwrapper_debugprintf args
3038
ltwrapper_debugprintf (const char *fmt, ...)
3041
va_start (args, fmt);
3042
(void) vfprintf (stderr, fmt, args);
3046
# define LTWRAPPER_DEBUGPRINTF(args)
3049
const char *program_name = NULL;
3051
void *xmalloc (size_t num);
3052
char *xstrdup (const char *string);
3053
const char *base_name (const char *name);
3054
char *find_executable (const char *wrapper);
3055
char *chase_symlinks (const char *pathspec);
3056
int make_executable (const char *path);
3057
int check_executable (const char *path);
3058
char *strendzap (char *str, const char *pat);
3059
void lt_fatal (const char *message, ...);
3061
static const char *script_text =
3064
func_emit_wrapper yes |
3065
$SED -e 's/\([\\"]\)/\\\1/g' \
3066
-e 's/^/ "/' -e 's/$/\\n"/'
3070
const char * MAGIC_EXE = "$magic_exe";
3073
main (int argc, char *argv[])
3077
char *actual_cwrapper_path;
3078
char *shwrapper_name;
3079
intptr_t rval = 127;
3082
const char *dumpscript_opt = "--lt-dump-script";
3085
program_name = (char *) xstrdup (base_name (argv[0]));
3086
LTWRAPPER_DEBUGPRINTF (("(main) argv[0] : %s\n", argv[0]));
3087
LTWRAPPER_DEBUGPRINTF (("(main) program_name : %s\n", program_name));
3089
/* very simple arg parsing; don't want to rely on getopt */
3090
for (i = 1; i < argc; i++)
3092
if (strcmp (argv[i], dumpscript_opt) == 0)
3096
*mingw* | *cygwin* )
3097
# make stdout use "unix" line endings
3098
echo " setmode(1,_O_BINARY);"
3103
printf ("%s", script_text);
3108
newargz = XMALLOC (char *, argc + 2);
3111
if test -n "$TARGETSHELL" ; then
3112
# no path translation at all
3113
lt_newargv0=$TARGETSHELL
3117
# awkward: cmd appends spaces to result
3118
lt_sed_strip_trailing_spaces="s/[ ]*\$//"
3119
lt_newargv0=`( cmd //c echo $SHELL | $SED -e "$lt_sed_strip_trailing_spaces" ) 2>/dev/null || echo $SHELL`
3120
case $lt_newargv0 in
3122
*) lt_newargv0=$lt_newargv0.exe ;;
3125
* ) lt_newargv0=$SHELL ;;
3130
newargz[0] = (char *) xstrdup ("$lt_newargv0");
3134
tmp_pathspec = find_executable (argv[0]);
3135
if (tmp_pathspec == NULL)
3136
lt_fatal ("Couldn't find %s", argv[0]);
3137
LTWRAPPER_DEBUGPRINTF (("(main) found exe (before symlink chase) at : %s\n",
3140
actual_cwrapper_path = chase_symlinks (tmp_pathspec);
3141
LTWRAPPER_DEBUGPRINTF (("(main) found exe (after symlink chase) at : %s\n",
3142
actual_cwrapper_path));
3143
XFREE (tmp_pathspec);
3145
shwrapper_name = (char *) xstrdup (base_name (actual_cwrapper_path));
3146
strendzap (actual_cwrapper_path, shwrapper_name);
3148
/* shwrapper_name transforms */
3149
strendzap (shwrapper_name, ".exe");
3150
tmp_pathspec = XMALLOC (char, (strlen (shwrapper_name) +
3151
strlen ("_ltshwrapperTMP") + 1));
3152
strcpy (tmp_pathspec, shwrapper_name);
3153
strcat (tmp_pathspec, "_ltshwrapperTMP");
3154
XFREE (shwrapper_name);
3155
shwrapper_name = tmp_pathspec;
3157
LTWRAPPER_DEBUGPRINTF (("(main) libtool shell wrapper name: %s\n",
3163
XMALLOC (char, (strlen (actual_cwrapper_path) +
3164
strlen ("$objdir") + 1 + strlen (shwrapper_name) + 1));
3165
strcpy (newargz[1], actual_cwrapper_path);
3166
strcat (newargz[1], "$objdir");
3167
strcat (newargz[1], "/");
3168
strcat (newargz[1], shwrapper_name);
3177
while ((p = strchr (newargz[1], '\\')) != NULL)
3187
XFREE (shwrapper_name);
3188
XFREE (actual_cwrapper_path);
3190
/* always write in binary mode */
3191
if ((shwrapper = fopen (newargz[1], FOPEN_WB)) == 0)
3193
lt_fatal ("Could not open %s for writing", newargz[1]);
3195
fprintf (shwrapper, "%s", script_text);
3198
make_executable (newargz[1]);
3200
for (i = 1; i < argc; i++)
3201
newargz[i + 1] = xstrdup (argv[i]);
3202
newargz[argc + 1] = NULL;
3204
for (i = 0; i < argc + 1; i++)
3206
LTWRAPPER_DEBUGPRINTF (("(main) newargz[%d] : %s\n", i, newargz[i]));
3214
/* execv doesn't actually work on mingw as expected on unix */
3215
rval = _spawnv (_P_WAIT, "$lt_newargv0", (const char * const *) newargz);
3218
/* failed to start process */
3219
LTWRAPPER_DEBUGPRINTF (("(main) failed to launch target \"$lt_newargv0\": errno = %d\n", errno));
3228
execv ("$lt_newargv0", newargz);
3229
return rval; /* =127, but avoids unused variable warning */
3238
xmalloc (size_t num)
3240
void *p = (void *) malloc (num);
3242
lt_fatal ("Memory exhausted");
3248
xstrdup (const char *string)
3250
return string ? strcpy ((char *) xmalloc (strlen (string) + 1),
3255
base_name (const char *name)
3259
#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
3260
/* Skip over the disk name in MSDOS pathnames. */
3261
if (isalpha ((unsigned char) name[0]) && name[1] == ':')
3265
for (base = name; *name; name++)
3266
if (IS_DIR_SEPARATOR (*name))
3272
check_executable (const char *path)
3276
LTWRAPPER_DEBUGPRINTF (("(check_executable) : %s\n",
3277
path ? (*path ? path : "EMPTY!") : "NULL!"));
3278
if ((!path) || (!*path))
3281
if ((stat (path, &st) >= 0)
3282
&& (st.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH)))
3289
make_executable (const char *path)
3294
LTWRAPPER_DEBUGPRINTF (("(make_executable) : %s\n",
3295
path ? (*path ? path : "EMPTY!") : "NULL!"));
3296
if ((!path) || (!*path))
3299
if (stat (path, &st) >= 0)
3301
rval = chmod (path, st.st_mode | S_IXOTH | S_IXGRP | S_IXUSR);
3306
/* Searches for the full path of the wrapper. Returns
3307
newly allocated full path name if found, NULL otherwise
3308
Does not chase symlinks, even on platforms that support them.
3311
find_executable (const char *wrapper)
3316
/* static buffer for getcwd */
3317
char tmp[LT_PATHMAX + 1];
3321
LTWRAPPER_DEBUGPRINTF (("(find_executable) : %s\n",
3322
wrapper ? (*wrapper ? wrapper : "EMPTY!") : "NULL!"));
3324
if ((wrapper == NULL) || (*wrapper == '\0'))
3327
/* Absolute path? */
3328
#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
3329
if (isalpha ((unsigned char) wrapper[0]) && wrapper[1] == ':')
3331
concat_name = xstrdup (wrapper);
3332
if (check_executable (concat_name))
3334
XFREE (concat_name);
3339
if (IS_DIR_SEPARATOR (wrapper[0]))
3341
concat_name = xstrdup (wrapper);
3342
if (check_executable (concat_name))
3344
XFREE (concat_name);
3346
#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
3350
for (p = wrapper; *p; p++)
3358
/* no slashes; search PATH */
3359
const char *path = getenv ("PATH");
3362
for (p = path; *p; p = p_next)
3366
for (q = p; *q; q++)
3367
if (IS_PATH_SEPARATOR (*q))
3370
p_next = (*q == '\0' ? q : q + 1);
3373
/* empty path: current directory */
3374
if (getcwd (tmp, LT_PATHMAX) == NULL)
3375
lt_fatal ("getcwd failed");
3376
tmp_len = strlen (tmp);
3378
XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1);
3379
memcpy (concat_name, tmp, tmp_len);
3380
concat_name[tmp_len] = '/';
3381
strcpy (concat_name + tmp_len + 1, wrapper);
3386
XMALLOC (char, p_len + 1 + strlen (wrapper) + 1);
3387
memcpy (concat_name, p, p_len);
3388
concat_name[p_len] = '/';
3389
strcpy (concat_name + p_len + 1, wrapper);
3391
if (check_executable (concat_name))
3393
XFREE (concat_name);
3396
/* not found in PATH; assume curdir */
3398
/* Relative path | not found in path: prepend cwd */
3399
if (getcwd (tmp, LT_PATHMAX) == NULL)
3400
lt_fatal ("getcwd failed");
3401
tmp_len = strlen (tmp);
3402
concat_name = XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1);
3403
memcpy (concat_name, tmp, tmp_len);
3404
concat_name[tmp_len] = '/';
3405
strcpy (concat_name + tmp_len + 1, wrapper);
3407
if (check_executable (concat_name))
3409
XFREE (concat_name);
3414
chase_symlinks (const char *pathspec)
3417
return xstrdup (pathspec);
3419
char buf[LT_PATHMAX];
3421
char *tmp_pathspec = xstrdup (pathspec);
3423
int has_symlinks = 0;
3424
while (strlen (tmp_pathspec) && !has_symlinks)
3426
LTWRAPPER_DEBUGPRINTF (("checking path component for symlinks: %s\n",
3428
if (lstat (tmp_pathspec, &s) == 0)
3430
if (S_ISLNK (s.st_mode) != 0)
3436
/* search backwards for last DIR_SEPARATOR */
3437
p = tmp_pathspec + strlen (tmp_pathspec) - 1;
3438
while ((p > tmp_pathspec) && (!IS_DIR_SEPARATOR (*p)))
3440
if ((p == tmp_pathspec) && (!IS_DIR_SEPARATOR (*p)))
3442
/* no more DIR_SEPARATORS left */
3449
char *errstr = strerror (errno);
3450
lt_fatal ("Error accessing file %s (%s)", tmp_pathspec, errstr);
3453
XFREE (tmp_pathspec);
3457
return xstrdup (pathspec);
3460
tmp_pathspec = realpath (pathspec, buf);
3461
if (tmp_pathspec == 0)
3463
lt_fatal ("Could not follow symlinks for %s", pathspec);
3465
return xstrdup (tmp_pathspec);
3470
strendzap (char *str, const char *pat)
3474
assert (str != NULL);
3475
assert (pat != NULL);
3478
patlen = strlen (pat);
3482
str += len - patlen;
3483
if (strcmp (str, pat) == 0)
3490
lt_error_core (int exit_status, const char *mode,
3491
const char *message, va_list ap)
3493
fprintf (stderr, "%s: %s: ", program_name, mode);
3494
vfprintf (stderr, message, ap);
3495
fprintf (stderr, ".\n");
3497
if (exit_status >= 0)
3502
lt_fatal (const char *message, ...)
3505
va_start (ap, message);
3506
lt_error_core (EXIT_FAILURE, "FATAL", message, ap);
3511
# end: func_emit_cwrapperexe_src
3513
# func_mode_link arg...
1029
$show "$mv $output_obj $obj"
1030
if $run $mv $output_obj $obj; then :
1033
$run $rm $removelist
1038
# Append the name of the non-PIC object the libtool object file.
1039
# Only append if the libtool object file exists.
1040
test -z "$run" && cat >> ${libobj}T <<EOF
1041
# Name of the non-PIC object.
1042
non_pic_object='$objname'
1046
# Append the name of the non-PIC object the libtool object file.
1047
# Only append if the libtool object file exists.
1048
test -z "$run" && cat >> ${libobj}T <<EOF
1049
# Name of the non-PIC object.
1055
$run $mv "${libobj}T" "${libobj}"
1057
# Unlock the critical section if it was locked
1058
if test "$need_locks" != no; then
1059
$run $rm "$lockfile"
1067
modename="$modename: link"
3518
1069
*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
3519
1070
# It is impossible to link a dll without this setting, and
7244
4831
# Replace the output file specification.
7245
link_command=`$ECHO "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`
4832
link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`
7247
4834
# Delete the old output files.
7248
$opt_dry_run || $RM $output $output_objdir/$outputname $output_objdir/lt-$outputname
4835
$run $rm $output $output_objdir/$outputname $output_objdir/lt-$outputname
7250
func_show_eval "$link_command" 'exit $?'
4837
$show "$link_command"
4838
$run eval "$link_command" || exit $?
7252
4840
# Now create the wrapper script.
7253
func_verbose "creating $output"
4841
$show "creating $output"
7255
4843
# Quote the relink command for shipping.
7256
4844
if test -n "$relink_command"; then
7257
4845
# Preserve any variables that may affect compiler behavior
7258
4846
for var in $variables_saved_for_relink; do
7259
4847
if eval test -z \"\${$var+set}\"; then
7260
relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command"
4848
relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command"
7261
4849
elif eval var_value=\$$var; test -z "$var_value"; then
7262
4850
relink_command="$var=; export $var; $relink_command"
7264
func_quote_for_eval "$var_value"
7265
relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command"
4852
var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"`
4853
relink_command="$var=\"$var_value\"; export $var; $relink_command"
7268
4856
relink_command="(cd `pwd`; $relink_command)"
7269
relink_command=`$ECHO "X$relink_command" | $Xsed -e "$sed_quote_subst"`
4857
relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"`
7272
# Quote $ECHO for shipping.
7273
if test "X$ECHO" = "X$SHELL $progpath --fallback-echo"; then
4860
# Quote $echo for shipping.
4861
if test "X$echo" = "X$SHELL $progpath --fallback-echo"; then
7274
4862
case $progpath in
7275
4863
[\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $progpath --fallback-echo";;
7276
4864
*) qecho="$SHELL `pwd`/$progpath --fallback-echo";;
7278
qecho=`$ECHO "X$qecho" | $Xsed -e "$sed_quote_subst"`
4866
qecho=`$echo "X$qecho" | $Xsed -e "$sed_quote_subst"`
7280
qecho=`$ECHO "X$ECHO" | $Xsed -e "$sed_quote_subst"`
4868
qecho=`$echo "X$echo" | $Xsed -e "$sed_quote_subst"`
7283
# Only actually do things if not in dry run mode.
4871
# Only actually do things if our run command is non-null.
4872
if test -z "$run"; then
7285
4873
# win32 will think the script is a binary if it has
7286
4874
# a .exe suffix, so we strip it off here.
7287
4875
case $output in
7288
*.exe) func_stripname '' '.exe' "$output"
7289
output=$func_stripname_result ;;
4876
*.exe) output=`$echo $output|${SED} 's,.exe$,,'` ;;
7291
4878
# test for cygwin because mv fails w/o .exe extensions
7295
func_stripname '' '.exe' "$outputname"
7296
outputname=$func_stripname_result ;;
4882
outputname=`$echo $outputname|${SED} 's,.exe$,,'` ;;
7300
4886
*cygwin* | *mingw* )
7301
func_dirname_and_basename "$output" "" "."
7302
output_name=$func_basename_result
7303
output_path=$func_dirname_result
7304
cwrappersource="$output_path/$objdir/lt-$output_name.c"
7305
cwrapper="$output_path/$output_name.exe"
7306
$RM $cwrappersource $cwrapper
7307
trap "$RM $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15
7309
func_emit_cwrapperexe_src > $cwrappersource
7311
# we should really use a build-platform specific compiler
7312
# here, but OTOH, the wrappers (shell script and this C one)
7313
# are only useful if you want to execute the "real" binary.
7314
# Since the "real" binary is built for $host, then this
7315
# wrapper might as well be built for $host, too.
7317
$LTCC $LTCFLAGS -o $cwrapper $cwrappersource
7321
# Now, create the wrapper script for func_source use:
7322
func_ltwrapper_scriptname $cwrapper
7323
$RM $func_ltwrapper_scriptname_result
7324
trap "$RM $func_ltwrapper_scriptname_result; exit $EXIT_FAILURE" 1 2 15
7326
# note: this script will not be executed, so do not chmod.
7327
if test "x$build" = "x$host" ; then
7328
$cwrapper --lt-dump-script > $func_ltwrapper_scriptname_result
7330
func_emit_wrapper no > $func_ltwrapper_scriptname_result
7336
trap "$RM $output; exit $EXIT_FAILURE" 1 2 15
7338
func_emit_wrapper no > $output
4887
output_name=`basename $output`
4888
output_path=`dirname $output`
4889
cwrappersource="$output_path/$objdir/lt-$output_name.c"
4890
cwrapper="$output_path/$output_name.exe"
4891
$rm $cwrappersource $cwrapper
4892
trap "$rm $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15
4894
cat > $cwrappersource <<EOF
4896
/* $cwrappersource - temporary wrapper executable for $objdir/$outputname
4897
Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
4899
The $output program cannot be directly executed until all the libtool
4900
libraries that it depends on are installed.
4902
This wrapper executable should never be moved out of the build directory.
4903
If it is, it will not operate correctly.
4905
Currently, it simply execs the wrapper *script* "/bin/sh $output",
4906
but could eventually absorb all of the scripts functionality and
4907
exec $objdir/$outputname directly.
4910
cat >> $cwrappersource<<"EOF"
4919
#include <sys/stat.h>
4921
#if defined(PATH_MAX)
4922
# define LT_PATHMAX PATH_MAX
4923
#elif defined(MAXPATHLEN)
4924
# define LT_PATHMAX MAXPATHLEN
4926
# define LT_PATHMAX 1024
4929
#ifndef DIR_SEPARATOR
4930
# define DIR_SEPARATOR '/'
4931
# define PATH_SEPARATOR ':'
4934
#if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \
4936
# define HAVE_DOS_BASED_FILE_SYSTEM
4937
# ifndef DIR_SEPARATOR_2
4938
# define DIR_SEPARATOR_2 '\\'
4940
# ifndef PATH_SEPARATOR_2
4941
# define PATH_SEPARATOR_2 ';'
4945
#ifndef DIR_SEPARATOR_2
4946
# define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR)
4947
#else /* DIR_SEPARATOR_2 */
4948
# define IS_DIR_SEPARATOR(ch) \
4949
(((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2))
4950
#endif /* DIR_SEPARATOR_2 */
4952
#ifndef PATH_SEPARATOR_2
4953
# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR)
4954
#else /* PATH_SEPARATOR_2 */
4955
# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2)
4956
#endif /* PATH_SEPARATOR_2 */
4958
#define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type)))
4959
#define XFREE(stale) do { \
4960
if (stale) { free ((void *) stale); stale = 0; } \
4963
/* -DDEBUG is fairly common in CFLAGS. */
4965
#if defined DEBUGWRAPPER
4966
# define DEBUG(format, ...) fprintf(stderr, format, __VA_ARGS__)
4968
# define DEBUG(format, ...)
4971
const char *program_name = NULL;
4973
void * xmalloc (size_t num);
4974
char * xstrdup (const char *string);
4975
const char * base_name (const char *name);
4976
char * find_executable(const char *wrapper);
4977
int check_executable(const char *path);
4978
char * strendzap(char *str, const char *pat);
4979
void lt_fatal (const char *message, ...);
4982
main (int argc, char *argv[])
4987
program_name = (char *) xstrdup (base_name (argv[0]));
4988
DEBUG("(main) argv[0] : %s\n",argv[0]);
4989
DEBUG("(main) program_name : %s\n",program_name);
4990
newargz = XMALLOC(char *, argc+2);
4993
cat >> $cwrappersource <<EOF
4994
newargz[0] = (char *) xstrdup("$SHELL");
4997
cat >> $cwrappersource <<"EOF"
4998
newargz[1] = find_executable(argv[0]);
4999
if (newargz[1] == NULL)
5000
lt_fatal("Couldn't find %s", argv[0]);
5001
DEBUG("(main) found exe at : %s\n",newargz[1]);
5002
/* we know the script has the same name, without the .exe */
5003
/* so make sure newargz[1] doesn't end in .exe */
5004
strendzap(newargz[1],".exe");
5005
for (i = 1; i < argc; i++)
5006
newargz[i+1] = xstrdup(argv[i]);
5007
newargz[argc+1] = NULL;
5009
for (i=0; i<argc+1; i++)
5011
DEBUG("(main) newargz[%d] : %s\n",i,newargz[i]);
5019
cat >> $cwrappersource <<EOF
5020
execv("$SHELL",(char const **)newargz);
5024
cat >> $cwrappersource <<EOF
5025
execv("$SHELL",newargz);
5030
cat >> $cwrappersource <<"EOF"
5035
xmalloc (size_t num)
5037
void * p = (void *) malloc (num);
5039
lt_fatal ("Memory exhausted");
5045
xstrdup (const char *string)
5047
return string ? strcpy ((char *) xmalloc (strlen (string) + 1), string) : NULL
5052
base_name (const char *name)
5056
#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
5057
/* Skip over the disk name in MSDOS pathnames. */
5058
if (isalpha ((unsigned char)name[0]) && name[1] == ':')
5062
for (base = name; *name; name++)
5063
if (IS_DIR_SEPARATOR (*name))
5069
check_executable(const char * path)
5073
DEBUG("(check_executable) : %s\n", path ? (*path ? path : "EMPTY!") : "NULL!");
5074
if ((!path) || (!*path))
5077
if ((stat (path, &st) >= 0) &&
5079
/* MinGW & native WIN32 do not support S_IXOTH or S_IXGRP */
5080
#if defined (S_IXOTH)
5081
((st.st_mode & S_IXOTH) == S_IXOTH) ||
5083
#if defined (S_IXGRP)
5084
((st.st_mode & S_IXGRP) == S_IXGRP) ||
5086
((st.st_mode & S_IXUSR) == S_IXUSR))
5093
/* Searches for the full path of the wrapper. Returns
5094
newly allocated full path name if found, NULL otherwise */
5096
find_executable (const char* wrapper)
5101
/* static buffer for getcwd */
5102
char tmp[LT_PATHMAX + 1];
5106
DEBUG("(find_executable) : %s\n", wrapper ? (*wrapper ? wrapper : "EMPTY!") : "NULL!");
5108
if ((wrapper == NULL) || (*wrapper == '\0'))
5111
/* Absolute path? */
5112
#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
5113
if (isalpha ((unsigned char)wrapper[0]) && wrapper[1] == ':')
5115
concat_name = xstrdup (wrapper);
5116
if (check_executable(concat_name))
5123
if (IS_DIR_SEPARATOR (wrapper[0]))
5125
concat_name = xstrdup (wrapper);
5126
if (check_executable(concat_name))
5130
#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
5134
for (p = wrapper; *p; p++)
5142
/* no slashes; search PATH */
5143
const char* path = getenv ("PATH");
5146
for (p = path; *p; p = p_next)
5150
for (q = p; *q; q++)
5151
if (IS_PATH_SEPARATOR(*q))
5154
p_next = (*q == '\0' ? q : q + 1);
5157
/* empty path: current directory */
5158
if (getcwd (tmp, LT_PATHMAX) == NULL)
5159
lt_fatal ("getcwd failed");
5160
tmp_len = strlen(tmp);
5161
concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1);
5162
memcpy (concat_name, tmp, tmp_len);
5163
concat_name[tmp_len] = '/';
5164
strcpy (concat_name + tmp_len + 1, wrapper);
5168
concat_name = XMALLOC(char, p_len + 1 + strlen(wrapper) + 1);
5169
memcpy (concat_name, p, p_len);
5170
concat_name[p_len] = '/';
5171
strcpy (concat_name + p_len + 1, wrapper);
5173
if (check_executable(concat_name))
5178
/* not found in PATH; assume curdir */
5180
/* Relative path | not found in path: prepend cwd */
5181
if (getcwd (tmp, LT_PATHMAX) == NULL)
5182
lt_fatal ("getcwd failed");
5183
tmp_len = strlen(tmp);
5184
concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1);
5185
memcpy (concat_name, tmp, tmp_len);
5186
concat_name[tmp_len] = '/';
5187
strcpy (concat_name + tmp_len + 1, wrapper);
5189
if (check_executable(concat_name))
5196
strendzap(char *str, const char *pat)
5200
assert(str != NULL);
5201
assert(pat != NULL);
5204
patlen = strlen(pat);
5208
str += len - patlen;
5209
if (strcmp(str, pat) == 0)
5216
lt_error_core (int exit_status, const char * mode,
5217
const char * message, va_list ap)
5219
fprintf (stderr, "%s: %s: ", program_name, mode);
5220
vfprintf (stderr, message, ap);
5221
fprintf (stderr, ".\n");
5223
if (exit_status >= 0)
5228
lt_fatal (const char *message, ...)
5231
va_start (ap, message);
5232
lt_error_core (EXIT_FAILURE, "FATAL", message, ap);
5236
# we should really use a build-platform specific compiler
5237
# here, but OTOH, the wrappers (shell script and this C one)
5238
# are only useful if you want to execute the "real" binary.
5239
# Since the "real" binary is built for $host, then this
5240
# wrapper might as well be built for $host, too.
5241
$run $LTCC $LTCFLAGS -s -o $cwrapper $cwrappersource
5245
trap "$rm $output; exit $EXIT_FAILURE" 1 2 15
5250
# $output - temporary wrapper script for $objdir/$outputname
5251
# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
5253
# The $output program cannot be directly executed until all the libtool
5254
# libraries that it depends on are installed.
5256
# This wrapper script should never be moved out of the build directory.
5257
# If it is, it will not operate correctly.
5259
# Sed substitution that helps us do robust quoting. It backslashifies
5260
# metacharacters that are still active within double-quoted strings.
5261
Xsed='${SED} -e 1s/^X//'
5262
sed_quote_subst='$sed_quote_subst'
5264
# The HP-UX ksh and POSIX shell print the target directory to stdout
5266
(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
5268
relink_command=\"$relink_command\"
5270
# This environment variable determines our operation mode.
5271
if test \"\$libtool_install_magic\" = \"$magic\"; then
5272
# install mode needs the following variable:
5273
notinst_deplibs='$notinst_deplibs'
5275
# When we are sourced in execute mode, \$file and \$echo are already set.
5276
if test \"\$libtool_execute_magic\" != \"$magic\"; then
5279
# Make sure echo works.
5280
if test \"X\$1\" = X--no-reexec; then
5281
# Discard the --no-reexec flag, and continue.
5283
elif test \"X\`(\$echo '\t') 2>/dev/null\`\" = 'X\t'; then
5284
# Yippee, \$echo works!
5287
# Restart under the correct shell, and then maybe \$echo will work.
5288
exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"}
5294
# Find the directory that this script lives in.
5295
thisdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\`
5296
test \"x\$thisdir\" = \"x\$file\" && thisdir=.
5298
# Follow symbolic links until we get to the real thisdir.
5299
file=\`ls -ld \"\$file\" | ${SED} -n 's/.*-> //p'\`
5300
while test -n \"\$file\"; do
5301
destdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\`
5303
# If there was a directory component, then change thisdir.
5304
if test \"x\$destdir\" != \"x\$file\"; then
5305
case \"\$destdir\" in
5306
[\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;;
5307
*) thisdir=\"\$thisdir/\$destdir\" ;;
5311
file=\`\$echo \"X\$file\" | \$Xsed -e 's%^.*/%%'\`
5312
file=\`ls -ld \"\$thisdir/\$file\" | ${SED} -n 's/.*-> //p'\`
5315
# Try to get the absolute directory name.
5316
absdir=\`cd \"\$thisdir\" && pwd\`
5317
test -n \"\$absdir\" && thisdir=\"\$absdir\"
5320
if test "$fast_install" = yes; then
5322
program=lt-'$outputname'$exeext
5323
progdir=\"\$thisdir/$objdir\"
5325
if test ! -f \"\$progdir/\$program\" || \\
5326
{ file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\
5327
test \"X\$file\" != \"X\$progdir/\$program\"; }; then
5329
file=\"\$\$-\$program\"
5331
if test ! -d \"\$progdir\"; then
5332
$mkdir \"\$progdir\"
5334
$rm \"\$progdir/\$file\"
5339
# relink executable if necessary
5340
if test -n \"\$relink_command\"; then
5341
if relink_command_output=\`eval \$relink_command 2>&1\`; then :
5343
$echo \"\$relink_command_output\" >&2
5344
$rm \"\$progdir/\$file\"
5349
$mv \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null ||
5350
{ $rm \"\$progdir/\$program\";
5351
$mv \"\$progdir/\$file\" \"\$progdir/\$program\"; }
5352
$rm \"\$progdir/\$file\"
5356
program='$outputname'
5357
progdir=\"\$thisdir/$objdir\"
5363
if test -f \"\$progdir/\$program\"; then"
5365
# Export our shlibpath_var if we have one.
5366
if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
5368
# Add our own library path to $shlibpath_var
5369
$shlibpath_var=\"$temp_rpath\$$shlibpath_var\"
5371
# Some systems cannot cope with colon-terminated $shlibpath_var
5372
# The second colon is a workaround for a bug in BeOS R4 sed
5373
$shlibpath_var=\`\$echo \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\`
5375
export $shlibpath_var
5379
# fixup the dll searchpath if we need to.
5380
if test -n "$dllsearchpath"; then
5382
# Add the dll search path components to the executable PATH
5383
PATH=$dllsearchpath:\$PATH
5388
if test \"\$libtool_execute_magic\" != \"$magic\"; then
5389
# Run the actual program with our arguments.
5392
# Backslashes separate directories on plain windows
5393
*-*-mingw | *-*-os2*)
5395
exec \"\$progdir\\\\\$program\" \${1+\"\$@\"}
5401
exec \"\$progdir/\$program\" \${1+\"\$@\"}
5406
\$echo \"\$0: cannot exec \$program \${1+\"\$@\"}\"
5410
# The program doesn't exist.
5411
\$echo \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2
5412
\$echo \"This script is just a wrapper for \$program.\" 1>&2
5413
$echo \"See the $PACKAGE documentation for more information.\" 1>&2
7343
5420
exit $EXIT_SUCCESS
7642
5705
# Directory that this library needs to be installed in:
7643
5706
libdir='$install_libdir'"
7644
5707
if test "$installed" = no && test "$need_relink" = yes; then
7646
5709
relink_command=\"$relink_command\""
7651
5714
# Do a symbolic link so that the libtool archive can be found in
7652
5715
# LD_LIBRARY_PATH before the program is installed.
7653
func_show_eval '( cd "$output_objdir" && $RM "$outputname" && $LN_S "../$outputname" "$outputname" )' 'exit $?'
7659
{ test "$mode" = link || test "$mode" = relink; } &&
7660
func_mode_link ${1+"$@"}
7663
# func_mode_uninstall arg...
7664
func_mode_uninstall ()
5716
$show "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)"
5717
$run eval '(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)' || exit $?
5723
# libtool install mode
5725
modename="$modename: install"
5727
# There may be an optional sh(1) argument at the beginning of
5728
# install_prog (especially on Windows NT).
5729
if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh ||
5730
# Allow the use of GNU shtool's install command.
5731
$echo "X$nonopt" | grep shtool > /dev/null; then
5732
# Aesthetically quote it.
5733
arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"`
5735
*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
5739
install_prog="$arg "
5747
# The real first argument should be the name of the installation program.
5748
# Aesthetically quote it.
5749
arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
5751
*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
5755
install_prog="$install_prog$arg"
5757
# We need to accept at least all the BSD install flags.
5767
if test -n "$dest"; then
5768
files="$files $dest"
5776
case " $install_prog " in
5781
-g | -m | -o) prev=$arg ;;
5789
# If the previous option needed an argument, then skip it.
5790
if test -n "$prev"; then
5799
# Aesthetically quote the argument.
5800
arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
5802
*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
5806
install_prog="$install_prog $arg"
5809
if test -z "$install_prog"; then
5810
$echo "$modename: you must specify an install program" 1>&2
5815
if test -n "$prev"; then
5816
$echo "$modename: the \`$prev' option requires an argument" 1>&2
5821
if test -z "$files"; then
5822
if test -z "$dest"; then
5823
$echo "$modename: no file or destination specified" 1>&2
5825
$echo "$modename: you must specify a destination" 1>&2
5831
# Strip any trailing slash from the destination.
5832
dest=`$echo "X$dest" | $Xsed -e 's%/$%%'`
5834
# Check to see that the destination is a directory.
5835
test -d "$dest" && isdir=yes
5836
if test "$isdir" = yes; then
5840
destdir=`$echo "X$dest" | $Xsed -e 's%/[^/]*$%%'`
5841
test "X$destdir" = "X$dest" && destdir=.
5842
destname=`$echo "X$dest" | $Xsed -e 's%^.*/%%'`
5844
# Not a directory, so check to see that there is only one file specified.
5846
if test "$#" -gt 2; then
5847
$echo "$modename: \`$dest' is not a directory" 1>&2
5853
[\\/]* | [A-Za-z]:[\\/]*) ;;
5855
for file in $files; do
5859
$echo "$modename: \`$destdir' must be an absolute directory name" 1>&2
5868
# This variable tells wrapper scripts just to set variables rather
5869
# than running their programs.
5870
libtool_install_magic="$magic"
5875
for file in $files; do
5877
# Do each installation.
5880
# Do the static libraries later.
5881
staticlibs="$staticlibs $file"
5885
# Check to see that this really is a libtool archive.
5886
if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
5888
$echo "$modename: \`$file' is not a valid libtool archive" 1>&2
5896
# If there is no directory component, then add one.
5898
*/* | *\\*) . $file ;;
5902
# Add the libdir to current_libdirs if it is the destination.
5903
if test "X$destdir" = "X$libdir"; then
5904
case "$current_libdirs " in
5906
*) current_libdirs="$current_libdirs $libdir" ;;
5909
# Note the libdir as a future libdir.
5910
case "$future_libdirs " in
5912
*) future_libdirs="$future_libdirs $libdir" ;;
5916
dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`/
5917
test "X$dir" = "X$file/" && dir=
5920
if test -n "$relink_command"; then
5921
# Determine the prefix the user has applied to our future dir.
5922
inst_prefix_dir=`$echo "$destdir" | $SED "s%$libdir\$%%"`
5924
# Don't allow the user to place us outside of our expected
5925
# location b/c this prevents finding dependent libraries that
5926
# are installed to the same prefix.
5927
# At present, this check doesn't affect windows .dll's that
5928
# are installed into $libdir/../bin (currently, that works fine)
5929
# but it's something to keep an eye on.
5930
if test "$inst_prefix_dir" = "$destdir"; then
5931
$echo "$modename: error: cannot install \`$file' to a directory not ending in $libdir" 1>&2
5935
if test -n "$inst_prefix_dir"; then
5936
# Stick the inst_prefix_dir data into the link command.
5937
relink_command=`$echo "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"`
5939
relink_command=`$echo "$relink_command" | $SED "s%@inst_prefix_dir@%%"`
5942
$echo "$modename: warning: relinking \`$file'" 1>&2
5943
$show "$relink_command"
5944
if $run eval "$relink_command"; then :
5946
$echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
5951
# See the names of the shared library.
5952
set dummy $library_names
5953
if test -n "$2"; then
5959
test -n "$relink_command" && srcname="$realname"T
5961
# Install the shared library and build the symlinks.
5962
$show "$install_prog $dir/$srcname $destdir/$realname"
5963
$run eval "$install_prog $dir/$srcname $destdir/$realname" || exit $?
5964
if test -n "$stripme" && test -n "$striplib"; then
5965
$show "$striplib $destdir/$realname"
5966
$run eval "$striplib $destdir/$realname" || exit $?
5969
if test "$#" -gt 0; then
5970
# Delete the old symlinks, and create new ones.
5971
# Try `ln -sf' first, because the `ln' binary might depend on
5972
# the symlink we replace! Solaris /bin/ln does not understand -f,
5973
# so we also need to try rm && ln -s.
5976
if test "$linkname" != "$realname"; then
5977
$show "(cd $destdir && { $LN_S -f $realname $linkname || { $rm $linkname && $LN_S $realname $linkname; }; })"
5978
$run eval "(cd $destdir && { $LN_S -f $realname $linkname || { $rm $linkname && $LN_S $realname $linkname; }; })"
5983
# Do each command in the postinstall commands.
5984
lib="$destdir/$realname"
5985
cmds=$postinstall_cmds
5986
save_ifs="$IFS"; IFS='~'
5987
for cmd in $cmds; do
5991
$run eval "$cmd" || {
5994
# Restore the uninstalled library and exit
5995
if test "$mode" = relink; then
5996
$run eval '(cd $output_objdir && $rm ${realname}T && $mv ${realname}U $realname)'
6005
# Install the pseudo-library for information purposes.
6006
name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
6007
instname="$dir/$name"i
6008
$show "$install_prog $instname $destdir/$name"
6009
$run eval "$install_prog $instname $destdir/$name" || exit $?
6011
# Maybe install the static library, too.
6012
test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library"
6016
# Install (i.e. copy) a libtool object.
6018
# Figure out destination file name, if it wasn't already specified.
6019
if test -n "$destname"; then
6020
destfile="$destdir/$destname"
6022
destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
6023
destfile="$destdir/$destfile"
6026
# Deduce the name of the destination old-style object file.
6029
staticdest=`$echo "X$destfile" | $Xsed -e "$lo2o"`
6032
staticdest="$destfile"
6036
$echo "$modename: cannot copy a libtool object to \`$destfile'" 1>&2
6042
# Install the libtool object if requested.
6043
if test -n "$destfile"; then
6044
$show "$install_prog $file $destfile"
6045
$run eval "$install_prog $file $destfile" || exit $?
6048
# Install the old object if enabled.
6049
if test "$build_old_libs" = yes; then
6050
# Deduce the name of the old-style object file.
6051
staticobj=`$echo "X$file" | $Xsed -e "$lo2o"`
6053
$show "$install_prog $staticobj $staticdest"
6054
$run eval "$install_prog \$staticobj \$staticdest" || exit $?
6060
# Figure out destination file name, if it wasn't already specified.
6061
if test -n "$destname"; then
6062
destfile="$destdir/$destname"
6064
destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
6065
destfile="$destdir/$destfile"
6068
# If the file is missing, and there is a .exe on the end, strip it
6069
# because it is most likely a libtool script we actually want to
6074
if test ! -f "$file"; then
6075
file=`$echo $file|${SED} 's,.exe$,,'`
6081
# Do a test to see if this is really a libtool program.
6084
wrapper=`$echo $file | ${SED} -e 's,.exe$,,'`
6090
if (${SED} -e '4q' $wrapper | grep "^# Generated by .*$PACKAGE")>/dev/null 2>&1; then
6094
# Note that it is not necessary on cygwin/mingw to append a dot to
6095
# foo even if both foo and FILE.exe exist: automatic-append-.exe
6096
# behavior happens only for exec(3), not for open(2)! Also, sourcing
6097
# `FILE.' does not work on cygwin managed mounts.
6099
# If there is no directory component, then add one.
6101
*/* | *\\*) . ${wrapper} ;;
6102
*) . ./${wrapper} ;;
6105
# Check the variables that should have been set.
6106
if test -z "$notinst_deplibs"; then
6107
$echo "$modename: invalid libtool wrapper script \`$wrapper'" 1>&2
6112
for lib in $notinst_deplibs; do
6113
# Check to see that each library is installed.
6115
if test -f "$lib"; then
6116
# If there is no directory component, then add one.
6118
*/* | *\\*) . $lib ;;
6122
libfile="$libdir/"`$echo "X$lib" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test
6123
if test -n "$libdir" && test ! -f "$libfile"; then
6124
$echo "$modename: warning: \`$lib' has not been installed in \`$libdir'" 1>&2
6130
# Note that it is not necessary on cygwin/mingw to append a dot to
6131
# foo even if both foo and FILE.exe exist: automatic-append-.exe
6132
# behavior happens only for exec(3), not for open(2)! Also, sourcing
6133
# `FILE.' does not work on cygwin managed mounts.
6135
# If there is no directory component, then add one.
6137
*/* | *\\*) . ${wrapper} ;;
6138
*) . ./${wrapper} ;;
6142
if test "$fast_install" = no && test -n "$relink_command"; then
6143
if test "$finalize" = yes && test -z "$run"; then
6144
tmpdir=`func_mktempdir`
6145
file=`$echo "X$file$stripped_ext" | $Xsed -e 's%^.*/%%'`
6146
outputname="$tmpdir/$file"
6147
# Replace the output file specification.
6148
relink_command=`$echo "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'`
6150
$show "$relink_command"
6151
if $run eval "$relink_command"; then :
6153
$echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
6159
$echo "$modename: warning: cannot relink \`$file'" 1>&2
6162
# Install the binary that we compiled earlier.
6163
file=`$echo "X$file$stripped_ext" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"`
6167
# remove .exe since cygwin /usr/bin/install will append another
6169
case $install_prog,$host in
6170
*/usr/bin/install*,*cygwin*)
6171
case $file:$destfile in
6176
destfile=$destfile.exe
6179
destfile=`$echo $destfile | ${SED} -e 's,.exe$,,'`
6184
$show "$install_prog$stripme $file $destfile"
6185
$run eval "$install_prog\$stripme \$file \$destfile" || exit $?
6186
test -n "$outputname" && ${rm}r "$tmpdir"
6191
for file in $staticlibs; do
6192
name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
6194
# Set up the ranlib parameters.
6195
oldlib="$destdir/$name"
6197
$show "$install_prog $file $oldlib"
6198
$run eval "$install_prog \$file \$oldlib" || exit $?
6200
if test -n "$stripme" && test -n "$old_striplib"; then
6201
$show "$old_striplib $oldlib"
6202
$run eval "$old_striplib $oldlib" || exit $?
6205
# Do each command in the postinstall commands.
6206
cmds=$old_postinstall_cmds
6207
save_ifs="$IFS"; IFS='~'
6208
for cmd in $cmds; do
6212
$run eval "$cmd" || exit $?
6217
if test -n "$future_libdirs"; then
6218
$echo "$modename: warning: remember to run \`$progname --finish$future_libdirs'" 1>&2
6221
if test -n "$current_libdirs"; then
6222
# Maybe just do a dry run.
6223
test -n "$run" && current_libdirs=" -n$current_libdirs"
6224
exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs'
6230
# libtool finish mode
6232
modename="$modename: finish"
6236
if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
6239
libdirs="$libdirs $dir"
6242
for libdir in $libdirs; do
6243
if test -n "$finish_cmds"; then
6244
# Do each command in the finish commands.
6246
save_ifs="$IFS"; IFS='~'
6247
for cmd in $cmds; do
6251
$run eval "$cmd" || admincmds="$admincmds
6256
if test -n "$finish_eval"; then
6257
# Do the single finish_eval.
6258
eval cmds=\"$finish_eval\"
6259
$run eval "$cmds" || admincmds="$admincmds
6265
# Exit here if they wanted silent mode.
6266
test "$show" = : && exit $EXIT_SUCCESS
6268
$echo "X----------------------------------------------------------------------" | $Xsed
6269
$echo "Libraries have been installed in:"
6270
for libdir in $libdirs; do
6274
$echo "If you ever happen to want to link against installed libraries"
6275
$echo "in a given directory, LIBDIR, you must either use libtool, and"
6276
$echo "specify the full pathname of the library, or use the \`-LLIBDIR'"
6277
$echo "flag during linking and do at least one of the following:"
6278
if test -n "$shlibpath_var"; then
6279
$echo " - add LIBDIR to the \`$shlibpath_var' environment variable"
6280
$echo " during execution"
6282
if test -n "$runpath_var"; then
6283
$echo " - add LIBDIR to the \`$runpath_var' environment variable"
6284
$echo " during linking"
6286
if test -n "$hardcode_libdir_flag_spec"; then
6288
eval flag=\"$hardcode_libdir_flag_spec\"
6290
$echo " - use the \`$flag' linker flag"
6292
if test -n "$admincmds"; then
6293
$echo " - have your system administrator run these commands:$admincmds"
6295
if test -f /etc/ld.so.conf; then
6296
$echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'"
6299
$echo "See any operating system documentation about shared libraries for"
6300
$echo "more information, such as the ld(1) and ld.so(8) manual pages."
6301
$echo "X----------------------------------------------------------------------" | $Xsed
6305
# libtool execute mode
6307
modename="$modename: execute"
6309
# The first argument is the command name.
6311
if test -z "$cmd"; then
6312
$echo "$modename: you must specify a COMMAND" 1>&2
6317
# Handle -dlopen flags immediately.
6318
for file in $execute_dlfiles; do
6319
if test ! -f "$file"; then
6320
$echo "$modename: \`$file' is not a file" 1>&2
6328
# Check to see that this really is a libtool archive.
6329
if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
6331
$echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
6336
# Read the libtool library.
6340
# If there is no directory component, then add one.
6342
*/* | *\\*) . $file ;;
6346
# Skip this library if it cannot be dlopened.
6347
if test -z "$dlname"; then
6348
# Warn if it was a shared library.
6349
test -n "$library_names" && $echo "$modename: warning: \`$file' was not linked with \`-export-dynamic'"
6353
dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
6354
test "X$dir" = "X$file" && dir=.
6356
if test -f "$dir/$objdir/$dlname"; then
6359
$echo "$modename: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2
6365
# Just add the directory containing the .lo file.
6366
dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
6367
test "X$dir" = "X$file" && dir=.
6371
$echo "$modename: warning \`-dlopen' is ignored for non-libtool libraries and objects" 1>&2
6376
# Get the absolute pathname.
6377
absdir=`cd "$dir" && pwd`
6378
test -n "$absdir" && dir="$absdir"
6380
# Now add the directory to shlibpath_var.
6381
if eval "test -z \"\$$shlibpath_var\""; then
6382
eval "$shlibpath_var=\"\$dir\""
6384
eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\""
6388
# This variable tells wrapper scripts just to set shlibpath_var
6389
# rather than running their programs.
6390
libtool_execute_magic="$magic"
6392
# Check if any of the arguments is a wrapper script.
6399
# Do a test to see if this is really a libtool program.
6400
if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
6401
# If there is no directory component, then add one.
6403
*/* | *\\*) . $file ;;
6407
# Transform arg to wrapped name.
6408
file="$progdir/$program"
6412
# Quote arguments (to preserve shell metacharacters).
6413
file=`$echo "X$file" | $Xsed -e "$sed_quote_subst"`
6414
args="$args \"$file\""
6417
if test -z "$run"; then
6418
if test -n "$shlibpath_var"; then
6419
# Export the shlibpath_var.
6420
eval "export $shlibpath_var"
6423
# Restore saved environment variables
6424
if test "${save_LC_ALL+set}" = set; then
6425
LC_ALL="$save_LC_ALL"; export LC_ALL
6427
if test "${save_LANG+set}" = set; then
6428
LANG="$save_LANG"; export LANG
6431
# Now prepare to actually exec the command.
6432
exec_cmd="\$cmd$args"
6434
# Display what would be done.
6435
if test -n "$shlibpath_var"; then
6436
eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\""
6437
$echo "export $shlibpath_var"
6444
# libtool clean and uninstall mode
6446
modename="$modename: $mode"