158
567
my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null`
160
569
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}$$"
570
# Failing that, at least try and use $RANDOM to avoid a race
571
my_tmpdir="${my_template}-${RANDOM-0}$$"
164
save_mktempdir_umask=`umask`
167
umask $save_mktempdir_umask
573
save_mktempdir_umask=`umask`
576
umask $save_mktempdir_umask
170
579
# 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
580
test -d "$my_tmpdir" || \
581
func_fatal_error "cannot create temporary directory \`$my_tmpdir'"
588
# func_quote_for_eval arg
589
# Aesthetically quote ARG to be evaled later.
590
# This function returns two values: FUNC_QUOTE_FOR_EVAL_RESULT
591
# is double-quoted, suitable for a subsequent eval, whereas
592
# FUNC_QUOTE_FOR_EVAL_UNQUOTED_RESULT has merely all characters
593
# which are still active within double quotes backslashified.
594
func_quote_for_eval ()
598
func_quote_for_eval_unquoted_result=`$ECHO "$1" | $SED "$sed_quote_subst"` ;;
600
func_quote_for_eval_unquoted_result="$1" ;;
603
case $func_quote_for_eval_unquoted_result in
604
# Double-quote args containing shell metacharacters to delay
605
# word splitting, command substitution and and variable
606
# expansion for a subsequent eval.
607
# Many Bourne shells cannot handle close brackets correctly
608
# in scan sets, so we specify it separately.
609
*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
610
func_quote_for_eval_result="\"$func_quote_for_eval_unquoted_result\""
613
func_quote_for_eval_result="$func_quote_for_eval_unquoted_result"
618
# func_quote_for_expand arg
619
# Aesthetically quote ARG to be evaled later; same as above,
620
# but do not quote variable references.
621
func_quote_for_expand ()
625
my_arg=`$ECHO "$1" | $SED \
626
-e "$double_quote_subst" -e "$sed_double_backslash"` ;;
632
# Double-quote args containing shell metacharacters to delay
633
# word splitting and command substitution for a subsequent eval.
634
# Many Bourne shells cannot handle close brackets correctly
635
# in scan sets, so we specify it separately.
636
*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
641
func_quote_for_expand_result="$my_arg"
645
# func_show_eval cmd [fail_exp]
646
# Unless opt_silent is true, then output CMD. Then, if opt_dryrun is
647
# not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP
648
# is given, then evaluate it.
654
${opt_silent-false} || {
655
func_quote_for_expand "$my_cmd"
656
eval "func_echo $func_quote_for_expand_result"
659
if ${opt_dry_run-false}; then :; else
662
if test "$my_status" -eq 0; then :; else
663
eval "(exit $my_status); $my_fail_exp"
669
# func_show_eval_locale cmd [fail_exp]
670
# Unless opt_silent is true, then output CMD. Then, if opt_dryrun is
671
# not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP
672
# is given, then evaluate it. Use the saved locale for evaluation.
673
func_show_eval_locale ()
678
${opt_silent-false} || {
679
func_quote_for_expand "$my_cmd"
680
eval "func_echo $func_quote_for_expand_result"
683
if ${opt_dry_run-false}; then :; else
684
eval "$lt_user_locale
687
eval "$lt_safe_locale"
688
if test "$my_status" -eq 0; then :; else
689
eval "(exit $my_status); $my_fail_exp"
695
# Turn $1 into a string suitable for a shell variable name.
696
# Result is stored in $func_tr_sh_result. All characters
697
# not in the set a-zA-Z0-9_ are replaced with '_'. Further,
698
# if $1 begins with a digit, a '_' is prepended as well.
702
[0-9]* | *[!a-zA-Z0-9_]*)
703
func_tr_sh_result=`$ECHO "$1" | $SED 's/^\([0-9]\)/_\1/; s/[^a-zA-Z0-9_]/_/g'`
713
# Echo version message to standard output and exit.
726
/^# '$PROGRAM' (GNU /,/# warranty; / {
729
s/\((C)\)[ 0-9,-]*\( [1-9][0-9]*\)/\1\2/
736
# Echo short help message to standard output and exit.
741
$SED -n '/^# Usage:/,/^# *.*--help/ {
744
s/\$progname/'$progname'/
748
$ECHO "run \`$progname --help | more' for full usage"
753
# Echo long help message to standard output and exit,
754
# unless 'noexit' is passed as argument.
759
$SED -n '/^# Usage:/,/# Report bugs to/ {
763
s*\$progname*'$progname'*
765
s*\$SHELL*'"$SHELL"'*
767
s*\$LTCFLAGS*'"$LTCFLAGS"'*
769
s/\$with_gnu_ld/'"$with_gnu_ld"'/
770
s/\$automake_version/'"`(${AUTOMAKE-automake} --version) 2>/dev/null |$SED 1q`"'/
771
s/\$autoconf_version/'"`(${AUTOCONF-autoconf} --version) 2>/dev/null |$SED 1q`"'/
775
/^# .* home page:/b print
776
/^# General help using/b print
779
if test -z "$1"; then
784
# func_missing_arg argname
785
# Echo program name prefixed message to standard error and set global
791
func_error "missing argument for $1."
796
# func_split_short_opt shortopt
797
# Set func_split_short_opt_name and func_split_short_opt_arg shell
798
# variables after splitting SHORTOPT after the 2nd character.
799
func_split_short_opt ()
801
my_sed_short_opt='1s/^\(..\).*$/\1/;q'
802
my_sed_short_rest='1s/^..\(.*\)$/\1/;q'
804
func_split_short_opt_name=`$ECHO "$1" | $SED "$my_sed_short_opt"`
805
func_split_short_opt_arg=`$ECHO "$1" | $SED "$my_sed_short_rest"`
806
} # func_split_short_opt may be replaced by extended shell implementation
809
# func_split_long_opt longopt
810
# Set func_split_long_opt_name and func_split_long_opt_arg shell
811
# variables after splitting LONGOPT at the `=' sign.
812
func_split_long_opt ()
814
my_sed_long_opt='1s/^\(--[^=]*\)=.*/\1/;q'
815
my_sed_long_arg='1s/^--[^=]*=//'
817
func_split_long_opt_name=`$ECHO "$1" | $SED "$my_sed_long_opt"`
818
func_split_long_opt_arg=`$ECHO "$1" | $SED "$my_sed_long_arg"`
819
} # func_split_long_opt may be replaced by extended shell implementation
827
magic="%%%MAGIC variable%%%"
828
magic_exe="%%%MAGIC EXE variable%%%"
833
lo2o="s/\\.lo\$/.${objext}/"
834
o2lo="s/\\.${objext}\$/.lo/"
838
# If this variable is set in any of the actions, the command in it
839
# will be execed at the end. This prevents here-documents from being
840
# left over by shells.
843
# func_append var value
844
# Append VALUE to the end of shell variable VAR.
847
eval "${1}=\$${1}\${2}"
848
} # func_append may be replaced by extended shell implementation
850
# func_append_quoted var value
851
# Quote VALUE and append to the end of shell variable VAR, separated
853
func_append_quoted ()
855
func_quote_for_eval "${2}"
856
eval "${1}=\$${1}\\ \$func_quote_for_eval_result"
857
} # func_append_quoted may be replaced by extended shell implementation
860
# func_arith arithmetic-term...
863
func_arith_result=`expr "${@}"`
864
} # func_arith may be replaced by extended shell implementation
868
# STRING may not start with a hyphen.
871
func_len_result=`expr "${1}" : ".*" 2>/dev/null || echo $max_cmd_len`
872
} # func_len may be replaced by extended shell implementation
878
func_lo2o_result=`$ECHO "${1}" | $SED "$lo2o"`
879
} # func_lo2o may be replaced by extended shell implementation
882
# func_xform libobj-or-source
885
func_xform_result=`$ECHO "${1}" | $SED 's/\.[^.]*$/.lo/'`
886
} # func_xform may be replaced by extended shell implementation
889
# func_fatal_configuration arg...
890
# Echo program name prefixed message to standard error, followed by
891
# a configuration failure hint, and exit.
892
func_fatal_configuration ()
895
func_error "See the $PACKAGE documentation for more information."
896
func_fatal_error "Fatal configuration error."
901
# Display the configuration for all the tags in this script.
904
re_begincf='^# ### BEGIN LIBTOOL'
905
re_endcf='^# ### END LIBTOOL'
907
# Default configuration.
908
$SED "1,/$re_begincf CONFIG/d;/$re_endcf CONFIG/,\$d" < "$progpath"
910
# Now print the configurations for the tags.
911
for tagname in $taglist; do
912
$SED -n "/$re_begincf TAG CONFIG: $tagname\$/,/$re_endcf TAG CONFIG: $tagname\$/p" < "$progpath"
919
# Display the features supported by this script.
923
if test "$build_libtool_libs" = yes; then
924
echo "enable shared libraries"
926
echo "disable shared libraries"
928
if test "$build_old_libs" = yes; then
929
echo "enable static libraries"
931
echo "disable static libraries"
937
# func_enable_tag tagname
938
# Verify that TAGNAME is valid, and either flag an error and exit, or
939
# enable the TAGNAME tag. We also add TAGNAME to the global $taglist
946
re_begincf="^# ### BEGIN LIBTOOL TAG CONFIG: $tagname\$"
947
re_endcf="^# ### END LIBTOOL TAG CONFIG: $tagname\$"
948
sed_extractcf="/$re_begincf/,/$re_endcf/p"
953
func_fatal_error "invalid tag name: $tagname"
957
# Don't test for the "default" C tag, as we know it's
958
# there but not specially marked.
962
if $GREP "$re_begincf" "$progpath" >/dev/null 2>&1; then
963
taglist="$taglist $tagname"
965
# Evaluate the configuration. Be careful to quote the path
966
# and the sed script, to avoid splitting on whitespace, but
967
# also don't use non-portable quotes within backquotes within
968
# quotes we have to do it in 2 steps:
969
extractedcf=`$SED -n -e "$sed_extractcf" < "$progpath"`
972
func_error "ignoring unknown tag $tagname"
978
# func_check_version_match
979
# Ensure that we are using m4 macros, and libtool script from the same
980
# release of libtool.
981
func_check_version_match ()
983
if test "$package_revision" != "$macro_revision"; then
984
if test "$VERSION" != "$macro_version"; then
985
if test -z "$macro_version"; then
987
$progname: Version mismatch error. This is $PACKAGE $VERSION, but the
988
$progname: definition of this LT_INIT comes from an older release.
989
$progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION
990
$progname: and run autoconf again.
994
$progname: Version mismatch error. This is $PACKAGE $VERSION, but the
995
$progname: definition of this LT_INIT comes from $PACKAGE $macro_version.
996
$progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION
997
$progname: and run autoconf again.
1002
$progname: Version mismatch error. This is $PACKAGE $VERSION, revision $package_revision,
1003
$progname: but the definition of this LT_INIT comes from revision $macro_revision.
1004
$progname: You should recreate aclocal.m4 with macros from revision $package_revision
1005
$progname: of $PACKAGE $VERSION and run autoconf again.
1014
# Shorthand for --mode=foo, only valid as the first argument
1017
shift; set dummy --mode clean ${1+"$@"}; shift
1019
compile|compil|compi|comp|com|co|c)
1020
shift; set dummy --mode compile ${1+"$@"}; shift
1022
execute|execut|execu|exec|exe|ex|e)
1023
shift; set dummy --mode execute ${1+"$@"}; shift
1025
finish|finis|fini|fin|fi|f)
1026
shift; set dummy --mode finish ${1+"$@"}; shift
1028
install|instal|insta|inst|ins|in|i)
1029
shift; set dummy --mode install ${1+"$@"}; shift
1032
shift; set dummy --mode link ${1+"$@"}; shift
1034
uninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u)
1035
shift; set dummy --mode uninstall ${1+"$@"}; shift
1045
opt_preserve_dup_deps=false
1057
# Parse options once, thoroughly. This comes as soon as possible in the
1058
# script to make things like `--version' happen as quickly as we can.
1060
# this just eases exit handling
1061
while test $# -gt 0; do
1065
--debug|-x) opt_debug='set -x'
1066
func_echo "enabling shell trace mode"
1069
--dry-run|--dryrun|-n)
1078
opt_dlopen="${opt_dlopen+$opt_dlopen
1082
--preserve-dup-deps)
1083
opt_preserve_dup_deps=:
1091
set dummy --mode finish ${1+"$@"}; shift
1098
opt_help=': help-all'
1101
test $# = 0 && func_missing_arg $opt && break
1105
# Valid mode arguments:
1106
clean|compile|execute|finish|install|link|relink|uninstall) ;;
1108
# Catch anything else as an error
1109
*) func_error "invalid argument for $opt"
1116
--no-silent|--no-quiet)
1118
func_append preserve_args " $opt"
1120
--no-warning|--no-warn)
1122
func_append preserve_args " $opt"
1126
func_append preserve_args " $opt"
1130
func_append preserve_args " $opt"
1135
func_append preserve_args " $opt"
1139
test $# = 0 && func_missing_arg $opt && break
1142
func_append preserve_args " $opt $optarg"
1143
func_enable_tag "$optarg"
1147
-\?|-h) func_usage ;;
1148
--help) func_help ;;
1149
--version) func_version ;;
1151
# Separate optargs to long options:
1153
func_split_long_opt "$opt"
1154
set dummy "$func_split_long_opt_name" "$func_split_long_opt_arg" ${1+"$@"}
1158
# Separate non-argument short options:
1160
func_split_short_opt "$opt"
1161
set dummy "$func_split_short_opt_name" "-$func_split_short_opt_arg" ${1+"$@"}
1166
-*) func_fatal_help "unrecognized option \`$opt'" ;;
1167
*) set dummy "$opt" ${1+"$@"}; shift; break ;;
1173
# save first non-option argument
1174
if test "$#" -gt 0; then
1180
test "$opt_debug" = : || func_append preserve_args " --debug"
1183
*cygwin* | *mingw* | *pw32* | *cegcc*)
1184
# don't eliminate duplications in $postdeps and $predeps
1185
opt_duplicate_compiler_generated_deps=:
1188
opt_duplicate_compiler_generated_deps=$opt_preserve_dup_deps
1193
# Sanity checks first:
1194
func_check_version_match
1196
if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
1197
func_fatal_configuration "not configured to build any kind of library"
1201
eval std_shrext=\"$shrext_cmds\"
1203
# Only execute mode is allowed to have -dlopen flags.
1204
if test -n "$opt_dlopen" && test "$opt_mode" != execute; then
1205
func_error "unrecognized option \`-dlopen'"
1210
# Change the help message to a mode-specific one.
1211
generic_help="$help"
1212
help="Try \`$progname --help --mode=$opt_mode' for more information."
1216
# Bail if the options were screwed
1217
$exit_cmd $EXIT_FAILURE
1228
# True iff FILE is a libtool `.la' library or `.lo' object file.
1229
# This function is only a basic sanity check; it will hardly flush out
1230
# determined imposters.
1234
$SED -e 4q "$1" 2>/dev/null \
1235
| $GREP "^# Generated by .*$PACKAGE" > /dev/null 2>&1
1238
# func_lalib_unsafe_p file
1239
# True iff FILE is a libtool `.la' library or `.lo' object file.
1240
# This function implements the same check as func_lalib_p without
1241
# resorting to external programs. To this end, it redirects stdin and
1242
# closes it afterwards, without saving the original file descriptor.
1243
# As a safety measure, use it only where a negative result would be
1244
# fatal anyway. Works if `file' does not exist.
1245
func_lalib_unsafe_p ()
1248
if test -f "$1" && test -r "$1" && exec 5<&0 <"$1"; then
1249
for lalib_p_l in 1 2 3 4
1252
case "$lalib_p_line" in
1253
\#\ Generated\ by\ *$PACKAGE* ) lalib_p=yes; break;;
1258
test "$lalib_p" = yes
1261
# func_ltwrapper_script_p file
1262
# True iff FILE is a libtool wrapper script
1263
# This function is only a basic sanity check; it will hardly flush out
1264
# determined imposters.
1265
func_ltwrapper_script_p ()
1270
# func_ltwrapper_executable_p file
1271
# True iff FILE is a libtool wrapper executable
1272
# This function is only a basic sanity check; it will hardly flush out
1273
# determined imposters.
1274
func_ltwrapper_executable_p ()
1276
func_ltwrapper_exec_suffix=
1279
*) func_ltwrapper_exec_suffix=.exe ;;
1281
$GREP "$magic_exe" "$1$func_ltwrapper_exec_suffix" >/dev/null 2>&1
1284
# func_ltwrapper_scriptname file
1285
# Assumes file is an ltwrapper_executable
1286
# uses $file to determine the appropriate filename for a
1287
# temporary ltwrapper_script.
1288
func_ltwrapper_scriptname ()
1290
func_dirname_and_basename "$1" "" "."
1291
func_stripname '' '.exe' "$func_basename_result"
1292
func_ltwrapper_scriptname_result="$func_dirname_result/$objdir/${func_stripname_result}_ltshwrapper"
1295
# func_ltwrapper_p file
1296
# True iff FILE is a libtool wrapper script or wrapper executable
1297
# This function is only a basic sanity check; it will hardly flush out
1298
# determined imposters.
1301
func_ltwrapper_script_p "$1" || func_ltwrapper_executable_p "$1"
1305
# func_execute_cmds commands fail_cmd
1306
# Execute tilde-delimited COMMANDS.
1307
# If FAIL_CMD is given, eval that upon failure.
1308
# FAIL_CMD may read-access the current command in variable CMD!
1309
func_execute_cmds ()
1312
save_ifs=$IFS; IFS='~'
1316
func_show_eval "$cmd" "${2-:}"
1323
# Source FILE, adding directory component if necessary.
1324
# Note that it is not necessary on cygwin/mingw to append a dot to
1325
# FILE even if both FILE and FILE.exe exist: automatic-append-.exe
1326
# behavior happens only for exec(3), not for open(2)! Also, sourcing
1327
# `FILE.' does not work on cygwin managed mounts.
1332
*/* | *\\*) . "$1" ;;
1338
# func_resolve_sysroot PATH
1339
# Replace a leading = in PATH with a sysroot. Store the result into
1340
# func_resolve_sysroot_result
1341
func_resolve_sysroot ()
1343
func_resolve_sysroot_result=$1
1344
case $func_resolve_sysroot_result in
1346
func_stripname '=' '' "$func_resolve_sysroot_result"
1347
func_resolve_sysroot_result=$lt_sysroot$func_stripname_result
1352
# func_replace_sysroot PATH
1353
# If PATH begins with the sysroot, replace it with = and
1354
# store the result into func_replace_sysroot_result.
1355
func_replace_sysroot ()
1357
case "$lt_sysroot:$1" in
1359
func_stripname "$lt_sysroot" '' "$1"
1360
func_replace_sysroot_result="=$func_stripname_result"
1363
# Including no sysroot.
1364
func_replace_sysroot_result=$1
221
1369
# func_infer_tag arg
222
1370
# Infer tagged configuration to use if any are available and
272
1417
# was found and let the user know that the "--tag" command
273
1418
# line option must be used.
274
1419
if test -z "$tagname"; then
275
$echo "$modename: unable to infer tagged configuration"
276
$echo "$modename: specify a tag with \`--tag'" 1>&2
279
# $echo "$modename: using $tagname tagged configuration"
287
# func_extract_an_archive dir oldlib
288
func_extract_an_archive ()
290
f_ex_an_ar_dir="$1"; shift
291
f_ex_an_ar_oldlib="$1"
293
$show "(cd $f_ex_an_ar_dir && $AR x $f_ex_an_ar_oldlib)"
294
$run eval "(cd \$f_ex_an_ar_dir && $AR x \$f_ex_an_ar_oldlib)" || exit $?
295
if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then
298
$echo "$modename: ERROR: object name conflicts: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib" 1>&2
303
# func_extract_archives gentop oldlib ...
304
func_extract_archives ()
306
my_gentop="$1"; shift
314
$show "${rm}r $my_gentop"
315
$run ${rm}r "$my_gentop"
316
$show "$mkdir $my_gentop"
317
$run $mkdir "$my_gentop"
319
if test "$my_status" -ne 0 && test ! -d "$my_gentop"; then
323
for my_xlib in $my_oldlibs; do
324
# Extract the objects.
326
[\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;;
327
*) my_xabs=`pwd`"/$my_xlib" ;;
329
my_xlib=`$echo "X$my_xlib" | $Xsed -e 's%^.*/%%'`
330
my_xdir="$my_gentop/$my_xlib"
332
$show "${rm}r $my_xdir"
333
$run ${rm}r "$my_xdir"
334
$show "$mkdir $my_xdir"
335
$run $mkdir "$my_xdir"
337
if test "$exit_status" -ne 0 && test ! -d "$my_xdir"; then
342
$show "Extracting $my_xabs"
343
# Do not bother doing anything if just a dry run
344
if test -z "$run"; then
345
darwin_orig_dir=`pwd`
346
cd $my_xdir || exit $?
347
darwin_archive=$my_xabs
349
darwin_base_archive=`$echo "X$darwin_archive" | $Xsed -e 's%^.*/%%'`
350
darwin_arches=`lipo -info "$darwin_archive" 2>/dev/null | $EGREP Architectures 2>/dev/null`
351
if test -n "$darwin_arches"; then
352
darwin_arches=`echo "$darwin_arches" | $SED -e 's/.*are://'`
354
$show "$darwin_base_archive has multiple architectures $darwin_arches"
355
for darwin_arch in $darwin_arches ; do
356
mkdir -p "unfat-$$/${darwin_base_archive}-${darwin_arch}"
357
lipo -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}"
358
cd "unfat-$$/${darwin_base_archive}-${darwin_arch}"
359
func_extract_an_archive "`pwd`" "${darwin_base_archive}"
361
$rm "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}"
362
done # $darwin_arches
363
## Okay now we have a bunch of thin objects, gotta fatten them up :)
364
darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print| xargs basename | sort -u | $NL2SP`
367
for darwin_file in $darwin_filelist; do
368
darwin_files=`find unfat-$$ -name $darwin_file -print | $NL2SP`
369
lipo -create -output "$darwin_file" $darwin_files
370
done # $darwin_filelist
372
cd "$darwin_orig_dir"
374
cd "$darwin_orig_dir"
375
func_extract_an_archive "$my_xdir" "$my_xabs"
380
func_extract_an_archive "$my_xdir" "$my_xabs"
383
my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP`
385
func_extract_archives_result="$my_oldobjs"
387
# End of Shell function definitions
388
#####################################
391
eval std_shrext=\"$shrext_cmds\"
395
# Parse our command line options once, thoroughly.
396
while test "$#" -gt 0
402
-*=*) optarg=`$echo "X$arg" | $Xsed -e 's/[-_a-zA-Z0-9]*=//'` ;;
406
# If the previous option needs an argument, assign it.
407
if test -n "$prev"; then
410
execute_dlfiles="$execute_dlfiles $arg"
414
preserve_args="${preserve_args}=$arg"
416
# Check whether tagname contains only valid characters
419
$echo "$progname: invalid tag name: $tagname" 1>&2
426
# Don't test for the "default" C tag, as we know, it's there, but
427
# not specially marked.
430
if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "$progpath" > /dev/null; then
431
taglist="$taglist $tagname"
432
# Evaluate the configuration.
433
eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$tagname'$/,/^# ### END LIBTOOL TAG CONFIG: '$tagname'$/p' < $progpath`"
435
$echo "$progname: ignoring unknown tag $tagname" 1>&2
450
# Have we seen a non-optional argument yet?
457
$echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP"
459
$echo "Copyright (C) 2005 Free Software Foundation, Inc."
460
$echo "This is free software; see the source for copying conditions. There is NO"
461
$echo "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
466
${SED} -e '1,/^# ### BEGIN LIBTOOL CONFIG/d' -e '/^# ### END LIBTOOL CONFIG/,$d' $progpath
467
# Now print the configurations for the tags.
468
for tagname in $taglist; do
469
${SED} -n -e "/^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$/,/^# ### END LIBTOOL TAG CONFIG: $tagname$/p" < "$progpath"
475
$echo "$progname: enabling shell trace mode"
477
preserve_args="$preserve_args $arg"
1420
func_echo "unable to infer tagged configuration"
1421
func_fatal_error "specify a tag with \`--tag'"
1423
# func_verbose "using $tagname tagged configuration"
1432
# func_write_libtool_object output_name pic_name nonpic_name
1433
# Create a libtool object file (analogous to a ".la" file),
1434
# but don't create it if we're doing a dry run.
1435
func_write_libtool_object ()
486
1438
if test "$build_libtool_libs" = yes; then
487
$echo "enable shared libraries"
489
$echo "disable shared libraries"
491
1444
if test "$build_old_libs" = yes; then
492
$echo "enable static libraries"
494
$echo "disable static libraries"
499
--finish) mode="finish" ;;
501
--mode) prevopt="--mode" prev=mode ;;
502
--mode=*) mode="$optarg" ;;
504
--preserve-dup-deps) duplicate_deps="yes" ;;
508
preserve_args="$preserve_args $arg"
514
preserve_args="$preserve_args --tag"
517
set tag "$optarg" ${1+"$@"}
520
preserve_args="$preserve_args --tag"
529
$echo "$modename: unrecognized option \`$arg'" 1>&2
541
if test -n "$prevopt"; then
542
$echo "$modename: option \`$prevopt' requires an argument" 1>&2
547
case $disable_libs in
551
build_libtool_libs=no
555
build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac`
559
# If this variable is set in any of the actions, the command in it
560
# will be execed at the end. This prevents here-documents from being
561
# left over by shells.
564
if test -z "$show_help"; then
566
# Infer the operation mode.
567
if test -z "$mode"; then
568
$echo "*** Warning: inferring the mode of operation is deprecated." 1>&2
569
$echo "*** Future versions of Libtool will require --mode=MODE be specified." 1>&2
571
*cc | cc* | *++ | gcc* | *-gcc* | g++* | xlc*)
583
*db | *dbx | *strace | *truss)
1445
write_oldobj=\'${3}\'
1451
cat >${write_libobj}T <<EOF
1452
# $write_libobj - a libtool object file
1453
# Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
1455
# Please DO NOT delete this file!
1456
# It is necessary for linking the library.
1458
# Name of the PIC object.
1459
pic_object=$write_lobj
1461
# Name of the non-PIC object
1462
non_pic_object=$write_oldobj
1465
$MV "${write_libobj}T" "${write_libobj}"
1470
##################################################
1471
# FILE NAME AND PATH CONVERSION HELPER FUNCTIONS #
1472
##################################################
1474
# func_convert_core_file_wine_to_w32 ARG
1475
# Helper function used by file name conversion functions when $build is *nix,
1476
# and $host is mingw, cygwin, or some other w32 environment. Relies on a
1477
# correctly configured wine environment available, with the winepath program
1478
# in $build's $PATH.
1480
# ARG is the $build file name to be converted to w32 format.
1481
# Result is available in $func_convert_core_file_wine_to_w32_result, and will
1482
# be empty on error (or when ARG is empty)
1483
func_convert_core_file_wine_to_w32 ()
1486
func_convert_core_file_wine_to_w32_result="$1"
1487
if test -n "$1"; then
1488
# Unfortunately, winepath does not exit with a non-zero error code, so we
1489
# are forced to check the contents of stdout. On the other hand, if the
1490
# command is not found, the shell will set an exit code of 127 and print
1491
# *an error message* to stdout. So we must check for both error code of
1492
# zero AND non-empty stdout, which explains the odd construction:
1493
func_convert_core_file_wine_to_w32_tmp=`winepath -w "$1" 2>/dev/null`
1494
if test "$?" -eq 0 && test -n "${func_convert_core_file_wine_to_w32_tmp}"; then
1495
func_convert_core_file_wine_to_w32_result=`$ECHO "$func_convert_core_file_wine_to_w32_tmp" |
1496
$SED -e "$lt_sed_naive_backslashify"`
1498
func_convert_core_file_wine_to_w32_result=
1502
# end: func_convert_core_file_wine_to_w32
1505
# func_convert_core_path_wine_to_w32 ARG
1506
# Helper function used by path conversion functions when $build is *nix, and
1507
# $host is mingw, cygwin, or some other w32 environment. Relies on a correctly
1508
# configured wine environment available, with the winepath program in $build's
1509
# $PATH. Assumes ARG has no leading or trailing path separator characters.
1511
# ARG is path to be converted from $build format to win32.
1512
# Result is available in $func_convert_core_path_wine_to_w32_result.
1513
# Unconvertible file (directory) names in ARG are skipped; if no directory names
1514
# are convertible, then the result may be empty.
1515
func_convert_core_path_wine_to_w32 ()
1518
# unfortunately, winepath doesn't convert paths, only file names
1519
func_convert_core_path_wine_to_w32_result=""
1520
if test -n "$1"; then
1523
for func_convert_core_path_wine_to_w32_f in $1; do
1525
func_convert_core_file_wine_to_w32 "$func_convert_core_path_wine_to_w32_f"
1526
if test -n "$func_convert_core_file_wine_to_w32_result" ; then
1527
if test -z "$func_convert_core_path_wine_to_w32_result"; then
1528
func_convert_core_path_wine_to_w32_result="$func_convert_core_file_wine_to_w32_result"
1530
func_append func_convert_core_path_wine_to_w32_result ";$func_convert_core_file_wine_to_w32_result"
1537
# end: func_convert_core_path_wine_to_w32
1540
# func_cygpath ARGS...
1541
# Wrapper around calling the cygpath program via LT_CYGPATH. This is used when
1542
# when (1) $build is *nix and Cygwin is hosted via a wine environment; or (2)
1543
# $build is MSYS and $host is Cygwin, or (3) $build is Cygwin. In case (1) or
1544
# (2), returns the Cygwin file name or path in func_cygpath_result (input
1545
# file name or path is assumed to be in w32 format, as previously converted
1546
# from $build's *nix or MSYS format). In case (3), returns the w32 file name
1547
# or path in func_cygpath_result (input file name or path is assumed to be in
1548
# Cygwin format). Returns an empty string on error.
1550
# ARGS are passed to cygpath, with the last one being the file name or path to
1553
# Specify the absolute *nix (or w32) name to cygpath in the LT_CYGPATH
1554
# environment variable; do not put it in $PATH.
1558
if test -n "$LT_CYGPATH" && test -f "$LT_CYGPATH"; then
1559
func_cygpath_result=`$LT_CYGPATH "$@" 2>/dev/null`
1560
if test "$?" -ne 0; then
1561
# on failure, ensure result is empty
1562
func_cygpath_result=
1565
func_cygpath_result=
1566
func_error "LT_CYGPATH is empty or specifies non-existent file: \`$LT_CYGPATH'"
1572
# func_convert_core_msys_to_w32 ARG
1573
# Convert file name or path ARG from MSYS format to w32 format. Return
1574
# result in func_convert_core_msys_to_w32_result.
1575
func_convert_core_msys_to_w32 ()
1578
# awkward: cmd appends spaces to result
1579
func_convert_core_msys_to_w32_result=`( cmd //c echo "$1" ) 2>/dev/null |
1580
$SED -e 's/[ ]*$//' -e "$lt_sed_naive_backslashify"`
1582
#end: func_convert_core_msys_to_w32
1585
# func_convert_file_check ARG1 ARG2
1586
# Verify that ARG1 (a file name in $build format) was converted to $host
1587
# format in ARG2. Otherwise, emit an error message, but continue (resetting
1588
# func_to_host_file_result to ARG1).
1589
func_convert_file_check ()
1592
if test -z "$2" && test -n "$1" ; then
1593
func_error "Could not determine host file name corresponding to"
1595
func_error "Continuing, but uninstalled executables may not work."
1597
func_to_host_file_result="$1"
1600
# end func_convert_file_check
1603
# func_convert_path_check FROM_PATHSEP TO_PATHSEP FROM_PATH TO_PATH
1604
# Verify that FROM_PATH (a path in $build format) was converted to $host
1605
# format in TO_PATH. Otherwise, emit an error message, but continue, resetting
1606
# func_to_host_file_result to a simplistic fallback value (see below).
1607
func_convert_path_check ()
1610
if test -z "$4" && test -n "$3"; then
1611
func_error "Could not determine the host path corresponding to"
1613
func_error "Continuing, but uninstalled executables may not work."
1614
# Fallback. This is a deliberately simplistic "conversion" and
1615
# should not be "improved". See libtool.info.
1616
if test "x$1" != "x$2"; then
1617
lt_replace_pathsep_chars="s|$1|$2|g"
1618
func_to_host_path_result=`echo "$3" |
1619
$SED -e "$lt_replace_pathsep_chars"`
1621
func_to_host_path_result="$3"
1625
# end func_convert_path_check
1628
# func_convert_path_front_back_pathsep FRONTPAT BACKPAT REPL ORIG
1629
# Modifies func_to_host_path_result by prepending REPL if ORIG matches FRONTPAT
1630
# and appending REPL if ORIG matches BACKPAT.
1631
func_convert_path_front_back_pathsep ()
1635
$1 ) func_to_host_path_result="$3$func_to_host_path_result"
1639
$2 ) func_append func_to_host_path_result "$3"
1643
# end func_convert_path_front_back_pathsep
1646
##################################################
1647
# $build to $host FILE NAME CONVERSION FUNCTIONS #
1648
##################################################
1649
# invoked via `$to_host_file_cmd ARG'
1651
# In each case, ARG is the path to be converted from $build to $host format.
1652
# Result will be available in $func_to_host_file_result.
1655
# func_to_host_file ARG
1656
# Converts the file name ARG from $build format to $host format. Return result
1657
# in func_to_host_file_result.
1658
func_to_host_file ()
1661
$to_host_file_cmd "$1"
1663
# end func_to_host_file
1666
# func_to_tool_file ARG LAZY
1667
# converts the file name ARG from $build format to toolchain format. Return
1668
# result in func_to_tool_file_result. If the conversion in use is listed
1669
# in (the comma separated) LAZY, no conversion takes place.
1670
func_to_tool_file ()
1674
*,"$to_tool_file_cmd",*)
1675
func_to_tool_file_result=$1
593
# If we have no mode, but dlfiles were specified, then do execute mode.
594
test -n "$execute_dlfiles" && mode=execute
596
# Just use the default operation mode.
597
if test -z "$mode"; then
598
if test -n "$nonopt"; then
599
$echo "$modename: warning: cannot infer operation mode from \`$nonopt'" 1>&2
601
$echo "$modename: warning: cannot infer operation mode without MODE-ARGS" 1>&2
1678
$to_tool_file_cmd "$1"
1679
func_to_tool_file_result=$func_to_host_file_result
608
# Only execute mode is allowed to have -dlopen flags.
609
if test -n "$execute_dlfiles" && test "$mode" != execute; then
610
$echo "$modename: unrecognized option \`-dlopen'" 1>&2
615
# Change the help message to a mode-specific one.
617
help="Try \`$modename --help --mode=$mode' for more information."
619
# These modes are in order of execution frequency so that they run quickly.
621
# libtool compile mode
623
modename="$modename: compile"
1683
# end func_to_tool_file
1686
# func_convert_file_noop ARG
1687
# Copy ARG to func_to_host_file_result.
1688
func_convert_file_noop ()
1690
func_to_host_file_result="$1"
1692
# end func_convert_file_noop
1695
# func_convert_file_msys_to_w32 ARG
1696
# Convert file name ARG from (mingw) MSYS to (mingw) w32 format; automatic
1697
# conversion to w32 is not available inside the cwrapper. Returns result in
1698
# func_to_host_file_result.
1699
func_convert_file_msys_to_w32 ()
1702
func_to_host_file_result="$1"
1703
if test -n "$1"; then
1704
func_convert_core_msys_to_w32 "$1"
1705
func_to_host_file_result="$func_convert_core_msys_to_w32_result"
1707
func_convert_file_check "$1" "$func_to_host_file_result"
1709
# end func_convert_file_msys_to_w32
1712
# func_convert_file_cygwin_to_w32 ARG
1713
# Convert file name ARG from Cygwin to w32 format. Returns result in
1714
# func_to_host_file_result.
1715
func_convert_file_cygwin_to_w32 ()
1718
func_to_host_file_result="$1"
1719
if test -n "$1"; then
1720
# because $build is cygwin, we call "the" cygpath in $PATH; no need to use
1721
# LT_CYGPATH in this case.
1722
func_to_host_file_result=`cygpath -m "$1"`
1724
func_convert_file_check "$1" "$func_to_host_file_result"
1726
# end func_convert_file_cygwin_to_w32
1729
# func_convert_file_nix_to_w32 ARG
1730
# Convert file name ARG from *nix to w32 format. Requires a wine environment
1731
# and a working winepath. Returns result in func_to_host_file_result.
1732
func_convert_file_nix_to_w32 ()
1735
func_to_host_file_result="$1"
1736
if test -n "$1"; then
1737
func_convert_core_file_wine_to_w32 "$1"
1738
func_to_host_file_result="$func_convert_core_file_wine_to_w32_result"
1740
func_convert_file_check "$1" "$func_to_host_file_result"
1742
# end func_convert_file_nix_to_w32
1745
# func_convert_file_msys_to_cygwin ARG
1746
# Convert file name ARG from MSYS to Cygwin format. Requires LT_CYGPATH set.
1747
# Returns result in func_to_host_file_result.
1748
func_convert_file_msys_to_cygwin ()
1751
func_to_host_file_result="$1"
1752
if test -n "$1"; then
1753
func_convert_core_msys_to_w32 "$1"
1754
func_cygpath -u "$func_convert_core_msys_to_w32_result"
1755
func_to_host_file_result="$func_cygpath_result"
1757
func_convert_file_check "$1" "$func_to_host_file_result"
1759
# end func_convert_file_msys_to_cygwin
1762
# func_convert_file_nix_to_cygwin ARG
1763
# Convert file name ARG from *nix to Cygwin format. Requires Cygwin installed
1764
# in a wine environment, working winepath, and LT_CYGPATH set. Returns result
1765
# in func_to_host_file_result.
1766
func_convert_file_nix_to_cygwin ()
1769
func_to_host_file_result="$1"
1770
if test -n "$1"; then
1771
# convert from *nix to w32, then use cygpath to convert from w32 to cygwin.
1772
func_convert_core_file_wine_to_w32 "$1"
1773
func_cygpath -u "$func_convert_core_file_wine_to_w32_result"
1774
func_to_host_file_result="$func_cygpath_result"
1776
func_convert_file_check "$1" "$func_to_host_file_result"
1778
# end func_convert_file_nix_to_cygwin
1781
#############################################
1782
# $build to $host PATH CONVERSION FUNCTIONS #
1783
#############################################
1784
# invoked via `$to_host_path_cmd ARG'
1786
# In each case, ARG is the path to be converted from $build to $host format.
1787
# The result will be available in $func_to_host_path_result.
1789
# Path separators are also converted from $build format to $host format. If
1790
# ARG begins or ends with a path separator character, it is preserved (but
1791
# converted to $host format) on output.
1793
# All path conversion functions are named using the following convention:
1794
# file name conversion function : func_convert_file_X_to_Y ()
1795
# path conversion function : func_convert_path_X_to_Y ()
1796
# where, for any given $build/$host combination the 'X_to_Y' value is the
1797
# same. If conversion functions are added for new $build/$host combinations,
1798
# the two new functions must follow this pattern, or func_init_to_host_path_cmd
1802
# func_init_to_host_path_cmd
1803
# Ensures that function "pointer" variable $to_host_path_cmd is set to the
1804
# appropriate value, based on the value of $to_host_file_cmd.
1806
func_init_to_host_path_cmd ()
1809
if test -z "$to_host_path_cmd"; then
1810
func_stripname 'func_convert_file_' '' "$to_host_file_cmd"
1811
to_host_path_cmd="func_convert_path_${func_stripname_result}"
1816
# func_to_host_path ARG
1817
# Converts the path ARG from $build format to $host format. Return result
1818
# in func_to_host_path_result.
1819
func_to_host_path ()
1822
func_init_to_host_path_cmd
1823
$to_host_path_cmd "$1"
1825
# end func_to_host_path
1828
# func_convert_path_noop ARG
1829
# Copy ARG to func_to_host_path_result.
1830
func_convert_path_noop ()
1832
func_to_host_path_result="$1"
1834
# end func_convert_path_noop
1837
# func_convert_path_msys_to_w32 ARG
1838
# Convert path ARG from (mingw) MSYS to (mingw) w32 format; automatic
1839
# conversion to w32 is not available inside the cwrapper. Returns result in
1840
# func_to_host_path_result.
1841
func_convert_path_msys_to_w32 ()
1844
func_to_host_path_result="$1"
1845
if test -n "$1"; then
1846
# Remove leading and trailing path separator characters from ARG. MSYS
1847
# behavior is inconsistent here; cygpath turns them into '.;' and ';.';
1848
# and winepath ignores them completely.
1849
func_stripname : : "$1"
1850
func_to_host_path_tmp1=$func_stripname_result
1851
func_convert_core_msys_to_w32 "$func_to_host_path_tmp1"
1852
func_to_host_path_result="$func_convert_core_msys_to_w32_result"
1853
func_convert_path_check : ";" \
1854
"$func_to_host_path_tmp1" "$func_to_host_path_result"
1855
func_convert_path_front_back_pathsep ":*" "*:" ";" "$1"
1858
# end func_convert_path_msys_to_w32
1861
# func_convert_path_cygwin_to_w32 ARG
1862
# Convert path ARG from Cygwin to w32 format. Returns result in
1863
# func_to_host_file_result.
1864
func_convert_path_cygwin_to_w32 ()
1867
func_to_host_path_result="$1"
1868
if test -n "$1"; then
1869
# See func_convert_path_msys_to_w32:
1870
func_stripname : : "$1"
1871
func_to_host_path_tmp1=$func_stripname_result
1872
func_to_host_path_result=`cygpath -m -p "$func_to_host_path_tmp1"`
1873
func_convert_path_check : ";" \
1874
"$func_to_host_path_tmp1" "$func_to_host_path_result"
1875
func_convert_path_front_back_pathsep ":*" "*:" ";" "$1"
1878
# end func_convert_path_cygwin_to_w32
1881
# func_convert_path_nix_to_w32 ARG
1882
# Convert path ARG from *nix to w32 format. Requires a wine environment and
1883
# a working winepath. Returns result in func_to_host_file_result.
1884
func_convert_path_nix_to_w32 ()
1887
func_to_host_path_result="$1"
1888
if test -n "$1"; then
1889
# See func_convert_path_msys_to_w32:
1890
func_stripname : : "$1"
1891
func_to_host_path_tmp1=$func_stripname_result
1892
func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1"
1893
func_to_host_path_result="$func_convert_core_path_wine_to_w32_result"
1894
func_convert_path_check : ";" \
1895
"$func_to_host_path_tmp1" "$func_to_host_path_result"
1896
func_convert_path_front_back_pathsep ":*" "*:" ";" "$1"
1899
# end func_convert_path_nix_to_w32
1902
# func_convert_path_msys_to_cygwin ARG
1903
# Convert path ARG from MSYS to Cygwin format. Requires LT_CYGPATH set.
1904
# Returns result in func_to_host_file_result.
1905
func_convert_path_msys_to_cygwin ()
1908
func_to_host_path_result="$1"
1909
if test -n "$1"; then
1910
# See func_convert_path_msys_to_w32:
1911
func_stripname : : "$1"
1912
func_to_host_path_tmp1=$func_stripname_result
1913
func_convert_core_msys_to_w32 "$func_to_host_path_tmp1"
1914
func_cygpath -u -p "$func_convert_core_msys_to_w32_result"
1915
func_to_host_path_result="$func_cygpath_result"
1916
func_convert_path_check : : \
1917
"$func_to_host_path_tmp1" "$func_to_host_path_result"
1918
func_convert_path_front_back_pathsep ":*" "*:" : "$1"
1921
# end func_convert_path_msys_to_cygwin
1924
# func_convert_path_nix_to_cygwin ARG
1925
# Convert path ARG from *nix to Cygwin format. Requires Cygwin installed in a
1926
# a wine environment, working winepath, and LT_CYGPATH set. Returns result in
1927
# func_to_host_file_result.
1928
func_convert_path_nix_to_cygwin ()
1931
func_to_host_path_result="$1"
1932
if test -n "$1"; then
1933
# Remove leading and trailing path separator characters from
1934
# ARG. msys behavior is inconsistent here, cygpath turns them
1935
# into '.;' and ';.', and winepath ignores them completely.
1936
func_stripname : : "$1"
1937
func_to_host_path_tmp1=$func_stripname_result
1938
func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1"
1939
func_cygpath -u -p "$func_convert_core_path_wine_to_w32_result"
1940
func_to_host_path_result="$func_cygpath_result"
1941
func_convert_path_check : : \
1942
"$func_to_host_path_tmp1" "$func_to_host_path_result"
1943
func_convert_path_front_back_pathsep ":*" "*:" : "$1"
1946
# end func_convert_path_nix_to_cygwin
1949
# func_mode_compile arg...
1950
func_mode_compile ()
624
1953
# Get the compilation command and the source file.
626
1955
srcfile="$nonopt" # always keep a non-empty value in "srcfile"
1020
2266
avoid parallel builds (make -j) in this platform, or get a better
1023
$run $rm $removelist
2269
$opt_dry_run || $RM $removelist
1024
2270
exit $EXIT_FAILURE
1027
2273
# Just move the object if needed
1028
2274
if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then
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"
2275
func_show_eval '$MV "$output_obj" "$obj"' \
2276
'error=$?; $opt_dry_run || $RM $removelist; exit $error'
2281
func_write_libtool_object "$libobj" "$objdir/$objname" "$objname"
2283
# Unlock the critical section if it was locked
2284
if test "$need_locks" != no; then
2285
removelist=$lockfile
2294
test "$opt_mode" = compile && func_mode_compile ${1+"$@"}
2299
# We need to display help for each of the modes.
2302
# Generic help is extracted from the usage comments
2303
# at the start of this file.
2309
"Usage: $progname [OPTION]... --mode=clean RM [RM-OPTION]... FILE...
2311
Remove files from the build directory.
2313
RM is the name of the program to use to delete files associated with each FILE
2314
(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
2317
If FILE is a libtool library, object or program, all the files associated
2318
with it are deleted. Otherwise, only FILE itself is deleted using RM."
2323
"Usage: $progname [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE
2325
Compile a source file into a libtool library object.
2327
This mode accepts the following additional options:
2329
-o OUTPUT-FILE set the output file name to OUTPUT-FILE
2330
-no-suppress do not suppress compiler output for multiple passes
2331
-prefer-pic try to build PIC objects only
2332
-prefer-non-pic try to build non-PIC objects only
2333
-shared do not build a \`.o' file suitable for static linking
2334
-static only build a \`.o' file suitable for static linking
2335
-Wc,FLAG pass FLAG directly to the compiler
2337
COMPILE-COMMAND is a command to be used in creating a \`standard' object file
2338
from the given SOURCEFILE.
2340
The output file name is determined by removing the directory component from
2341
SOURCEFILE, then substituting the C source code suffix \`.c' with the
2342
library object suffix, \`.lo'."
2347
"Usage: $progname [OPTION]... --mode=execute COMMAND [ARGS]...
2349
Automatically set library path, then run a program.
2351
This mode accepts the following additional options:
2353
-dlopen FILE add the directory containing FILE to the library path
2355
This mode sets the library path environment variable according to \`-dlopen'
2358
If any of the ARGS are libtool executable wrappers, then they are translated
2359
into their corresponding uninstalled binary, and any of their required library
2360
directories are added to the library path.
2362
Then, COMMAND is executed, with ARGS as arguments."
2367
"Usage: $progname [OPTION]... --mode=finish [LIBDIR]...
2369
Complete the installation of libtool libraries.
2371
Each LIBDIR is a directory that contains libtool libraries.
2373
The commands that this mode executes may require superuser privileges. Use
2374
the \`--dry-run' option if you just want to see what would be executed."
2379
"Usage: $progname [OPTION]... --mode=install INSTALL-COMMAND...
2381
Install executables or libraries.
2383
INSTALL-COMMAND is the installation command. The first component should be
2384
either the \`install' or \`cp' program.
2386
The following components of INSTALL-COMMAND are treated specially:
2388
-inst-prefix-dir PREFIX-DIR Use PREFIX-DIR as a staging area for installation
2390
The rest of the components are interpreted as arguments to that command (only
2391
BSD-compatible install options are recognized)."
2396
"Usage: $progname [OPTION]... --mode=link LINK-COMMAND...
2398
Link object files or libraries together to form another library, or to
2399
create an executable program.
2401
LINK-COMMAND is a command using the C compiler that you would use to create
2402
a program from several object files.
2404
The following components of LINK-COMMAND are treated specially:
2406
-all-static do not do any dynamic linking at all
2407
-avoid-version do not add a version suffix if possible
2408
-bindir BINDIR specify path to binaries directory (for systems where
2409
libraries must be found in the PATH setting at runtime)
2410
-dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime
2411
-dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols
2412
-export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
2413
-export-symbols SYMFILE
2414
try to export only the symbols listed in SYMFILE
2415
-export-symbols-regex REGEX
2416
try to export only the symbols matching REGEX
2417
-LLIBDIR search LIBDIR for required installed libraries
2418
-lNAME OUTPUT-FILE requires the installed library libNAME
2419
-module build a library that can dlopened
2420
-no-fast-install disable the fast-install mode
2421
-no-install link a not-installable executable
2422
-no-undefined declare that a library does not refer to external symbols
2423
-o OUTPUT-FILE create OUTPUT-FILE from the specified objects
2424
-objectlist FILE Use a list of object files found in FILE to specify objects
2425
-precious-files-regex REGEX
2426
don't remove output files matching REGEX
2427
-release RELEASE specify package release information
2428
-rpath LIBDIR the created library will eventually be installed in LIBDIR
2429
-R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries
2430
-shared only do dynamic linking of libtool libraries
2431
-shrext SUFFIX override the standard shared library file extension
2432
-static do not do any dynamic linking of uninstalled libtool libraries
2433
-static-libtool-libs
2434
do not do any dynamic linking of libtool libraries
2435
-version-info CURRENT[:REVISION[:AGE]]
2436
specify library version info [each variable defaults to 0]
2437
-weak LIBNAME declare that the target provides the LIBNAME interface
2439
-Xcompiler FLAG pass linker-specific FLAG directly to the compiler
2441
-Xlinker FLAG pass linker-specific FLAG directly to the linker
2442
-XCClinker FLAG pass link-specific FLAG to the compiler driver (CC)
2444
All other options (arguments beginning with \`-') are ignored.
2446
Every other argument is treated as a filename. Files ending in \`.la' are
2447
treated as uninstalled libtool libraries, other files are standard or library
2450
If the OUTPUT-FILE ends in \`.la', then a libtool library is created,
2451
only library objects (\`.lo' files) may be specified, and \`-rpath' is
2452
required, except when creating a convenience library.
2454
If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created
2455
using \`ar' and \`ranlib', or on Windows using \`lib'.
2457
If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file
2458
is created, otherwise an executable program is created."
2463
"Usage: $progname [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE...
2465
Remove libraries from an installation directory.
2467
RM is the name of the program to use to delete files associated with each FILE
2468
(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
2471
If FILE is a libtool library, all the files associated with it are deleted.
2472
Otherwise, only FILE itself is deleted using RM."
2476
func_fatal_help "invalid operation mode \`$opt_mode'"
2481
$ECHO "Try \`$progname --help' for more information about other modes."
2484
# Now that we've collected a possible --mode arg, show help if necessary
2486
if test "$opt_help" = :; then
2491
for opt_mode in compile link execute install finish uninstall clean; do
2494
} | sed -n '1p; 2,$s/^Usage:/ or: /p'
2497
for opt_mode in compile link execute install finish uninstall clean; do
2503
/^When reporting/,/^Report/{
2508
/information about other modes/d
2509
/more detailed .*MODE/d
2510
s/^Usage:.*--mode=\([^ ]*\) .*/Description of \1 mode:/'
2516
# func_mode_execute arg...
2517
func_mode_execute ()
2520
# The first argument is the command name.
2523
func_fatal_help "you must specify a COMMAND"
2525
# Handle -dlopen flags immediately.
2526
for file in $opt_dlopen; do
2528
|| func_fatal_help "\`$file' is not a file"
2533
func_resolve_sysroot "$file"
2534
file=$func_resolve_sysroot_result
2536
# Check to see that this really is a libtool archive.
2537
func_lalib_unsafe_p "$file" \
2538
|| func_fatal_help "\`$lib' is not a valid libtool archive"
2540
# Read the libtool library.
2545
# Skip this library if it cannot be dlopened.
2546
if test -z "$dlname"; then
2547
# Warn if it was a shared library.
2548
test -n "$library_names" && \
2549
func_warning "\`$file' was not linked with \`-export-dynamic'"
2553
func_dirname "$file" "" "."
2554
dir="$func_dirname_result"
2556
if test -f "$dir/$objdir/$dlname"; then
2557
func_append dir "/$objdir"
2559
if test ! -f "$dir/$dlname"; then
2560
func_fatal_error "cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'"
2566
# Just add the directory containing the .lo file.
2567
func_dirname "$file" "" "."
2568
dir="$func_dirname_result"
2572
func_warning "\`-dlopen' is ignored for non-libtool libraries and objects"
2577
# Get the absolute pathname.
2578
absdir=`cd "$dir" && pwd`
2579
test -n "$absdir" && dir="$absdir"
2581
# Now add the directory to shlibpath_var.
2582
if eval "test -z \"\$$shlibpath_var\""; then
2583
eval "$shlibpath_var=\"\$dir\""
2585
eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\""
2589
# This variable tells wrapper scripts just to set shlibpath_var
2590
# rather than running their programs.
2591
libtool_execute_magic="$magic"
2593
# Check if any of the arguments is a wrapper script.
2598
-* | *.la | *.lo ) ;;
2600
# Do a test to see if this is really a libtool program.
2601
if func_ltwrapper_script_p "$file"; then
2603
# Transform arg to wrapped name.
2604
file="$progdir/$program"
2605
elif func_ltwrapper_executable_p "$file"; then
2606
func_ltwrapper_scriptname "$file"
2607
func_source "$func_ltwrapper_scriptname_result"
2608
# Transform arg to wrapped name.
2609
file="$progdir/$program"
2613
# Quote arguments (to preserve shell metacharacters).
2614
func_append_quoted args "$file"
2617
if test "X$opt_dry_run" = Xfalse; then
2618
if test -n "$shlibpath_var"; then
2619
# Export the shlibpath_var.
2620
eval "export $shlibpath_var"
2623
# Restore saved environment variables
2624
for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
2626
eval "if test \"\${save_$lt_var+set}\" = set; then
2627
$lt_var=\$save_$lt_var; export $lt_var
2633
# Now prepare to actually exec the command.
2634
exec_cmd="\$cmd$args"
2636
# Display what would be done.
2637
if test -n "$shlibpath_var"; then
2638
eval "\$ECHO \"\$shlibpath_var=\$$shlibpath_var\""
2639
echo "export $shlibpath_var"
2646
test "$opt_mode" = execute && func_mode_execute ${1+"$@"}
2649
# func_mode_finish arg...
2657
for opt in "$nonopt" ${1+"$@"}
2659
if test -d "$opt"; then
2660
func_append libdirs " $opt"
2662
elif test -f "$opt"; then
2663
if func_lalib_unsafe_p "$opt"; then
2664
func_append libs " $opt"
2666
func_warning "\`$opt' is not a valid libtool archive"
2670
func_fatal_error "invalid argument \`$opt'"
2674
if test -n "$libs"; then
2675
if test -n "$lt_sysroot"; then
2676
sysroot_regex=`$ECHO "$lt_sysroot" | $SED "$sed_make_literal_regex"`
2677
sysroot_cmd="s/\([ ']\)$sysroot_regex/\1/g;"
2682
# Remove sysroot references
2683
if $opt_dry_run; then
2684
for lib in $libs; do
2685
echo "removing references to $lt_sysroot and \`=' prefixes from $lib"
2688
tmpdir=`func_mktempdir`
2689
for lib in $libs; do
2690
sed -e "${sysroot_cmd} s/\([ ']-[LR]\)=/\1/g; s/\([ ']\)=/\1/g" $lib \
2692
mv -f $tmpdir/tmp-la $lib
2698
if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
2699
for libdir in $libdirs; do
2700
if test -n "$finish_cmds"; then
2701
# Do each command in the finish commands.
2702
func_execute_cmds "$finish_cmds" 'admincmds="$admincmds
2705
if test -n "$finish_eval"; then
2706
# Do the single finish_eval.
2707
eval cmds=\"$finish_eval\"
2708
$opt_dry_run || eval "$cmds" || func_append admincmds "
2714
# Exit here if they wanted silent mode.
2715
$opt_silent && exit $EXIT_SUCCESS
2717
if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
2718
echo "----------------------------------------------------------------------"
2719
echo "Libraries have been installed in:"
2720
for libdir in $libdirs; do
2724
echo "If you ever happen to want to link against installed libraries"
2725
echo "in a given directory, LIBDIR, you must either use libtool, and"
2726
echo "specify the full pathname of the library, or use the \`-LLIBDIR'"
2727
echo "flag during linking and do at least one of the following:"
2728
if test -n "$shlibpath_var"; then
2729
echo " - add LIBDIR to the \`$shlibpath_var' environment variable"
2730
echo " during execution"
2732
if test -n "$runpath_var"; then
2733
echo " - add LIBDIR to the \`$runpath_var' environment variable"
2734
echo " during linking"
2736
if test -n "$hardcode_libdir_flag_spec"; then
2738
eval flag=\"$hardcode_libdir_flag_spec\"
2740
$ECHO " - use the \`$flag' linker flag"
2742
if test -n "$admincmds"; then
2743
$ECHO " - have your system administrator run these commands:$admincmds"
2745
if test -f /etc/ld.so.conf; then
2746
echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'"
2750
echo "See any operating system documentation about shared libraries for"
2752
solaris2.[6789]|solaris2.1[0-9])
2753
echo "more information, such as the ld(1), crle(1) and ld.so(8) manual"
2757
echo "more information, such as the ld(1) and ld.so(8) manual pages."
2760
echo "----------------------------------------------------------------------"
2765
test "$opt_mode" = finish && func_mode_finish ${1+"$@"}
2768
# func_mode_install arg...
2769
func_mode_install ()
2772
# There may be an optional sh(1) argument at the beginning of
2773
# install_prog (especially on Windows NT).
2774
if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh ||
2775
# Allow the use of GNU shtool's install command.
2776
case $nonopt in *shtool*) :;; *) false;; esac; then
2777
# Aesthetically quote it.
2778
func_quote_for_eval "$nonopt"
2779
install_prog="$func_quote_for_eval_result "
2787
# The real first argument should be the name of the installation program.
2788
# Aesthetically quote it.
2789
func_quote_for_eval "$arg"
2790
func_append install_prog "$func_quote_for_eval_result"
2791
install_shared_prog=$install_prog
2792
case " $install_prog " in
2793
*[\\\ /]cp\ *) install_cp=: ;;
2794
*) install_cp=false ;;
2797
# We need to accept at least all the BSD install flags.
2809
if test -n "$dest"; then
2810
func_append files " $dest"
2818
if $install_cp; then :; else
2832
# If the previous option needed an argument, then skip it.
2833
if test -n "$prev"; then
2834
if test "x$prev" = x-m && test -n "$install_override_mode"; then
2835
arg2=$install_override_mode
2846
# Aesthetically quote the argument.
2847
func_quote_for_eval "$arg"
2848
func_append install_prog " $func_quote_for_eval_result"
2849
if test -n "$arg2"; then
2850
func_quote_for_eval "$arg2"
2852
func_append install_shared_prog " $func_quote_for_eval_result"
2855
test -z "$install_prog" && \
2856
func_fatal_help "you must specify an install program"
2858
test -n "$prev" && \
2859
func_fatal_help "the \`$prev' option requires an argument"
2861
if test -n "$install_override_mode" && $no_mode; then
2862
if $install_cp; then :; else
2863
func_quote_for_eval "$install_override_mode"
2864
func_append install_shared_prog " -m $func_quote_for_eval_result"
2868
if test -z "$files"; then
2869
if test -z "$dest"; then
2870
func_fatal_help "no file or destination specified"
2872
func_fatal_help "you must specify a destination"
2876
# Strip any trailing slash from the destination.
2877
func_stripname '' '/' "$dest"
2878
dest=$func_stripname_result
2880
# Check to see that the destination is a directory.
2881
test -d "$dest" && isdir=yes
2882
if test "$isdir" = yes; then
2886
func_dirname_and_basename "$dest" "" "."
2887
destdir="$func_dirname_result"
2888
destname="$func_basename_result"
2890
# Not a directory, so check to see that there is only one file specified.
2891
set dummy $files; shift
2892
test "$#" -gt 1 && \
2893
func_fatal_help "\`$dest' is not a directory"
2896
[\\/]* | [A-Za-z]:[\\/]*) ;;
2898
for file in $files; do
2902
func_fatal_help "\`$destdir' must be an absolute directory name"
2909
# This variable tells wrapper scripts just to set variables rather
2910
# than running their programs.
2911
libtool_install_magic="$magic"
2916
for file in $files; do
2918
# Do each installation.
2921
# Do the static libraries later.
2922
func_append staticlibs " $file"
2926
func_resolve_sysroot "$file"
2927
file=$func_resolve_sysroot_result
2929
# Check to see that this really is a libtool archive.
2930
func_lalib_unsafe_p "$file" \
2931
|| func_fatal_help "\`$file' is not a valid libtool archive"
2938
# Add the libdir to current_libdirs if it is the destination.
2939
if test "X$destdir" = "X$libdir"; then
2940
case "$current_libdirs " in
2942
*) func_append current_libdirs " $libdir" ;;
2945
# Note the libdir as a future libdir.
2946
case "$future_libdirs " in
2948
*) func_append future_libdirs " $libdir" ;;
2952
func_dirname "$file" "/" ""
2953
dir="$func_dirname_result"
2954
func_append dir "$objdir"
2956
if test -n "$relink_command"; then
2957
# Determine the prefix the user has applied to our future dir.
2958
inst_prefix_dir=`$ECHO "$destdir" | $SED -e "s%$libdir\$%%"`
2960
# Don't allow the user to place us outside of our expected
2961
# location b/c this prevents finding dependent libraries that
2962
# are installed to the same prefix.
2963
# At present, this check doesn't affect windows .dll's that
2964
# are installed into $libdir/../bin (currently, that works fine)
2965
# but it's something to keep an eye on.
2966
test "$inst_prefix_dir" = "$destdir" && \
2967
func_fatal_error "error: cannot install \`$file' to a directory not ending in $libdir"
2969
if test -n "$inst_prefix_dir"; then
2970
# Stick the inst_prefix_dir data into the link command.
2971
relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"`
2973
relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%%"`
2976
func_warning "relinking \`$file'"
2977
func_show_eval "$relink_command" \
2978
'func_fatal_error "error: relink \`$file'\'' with the above command before installing it"'
2981
# See the names of the shared library.
2982
set dummy $library_names; shift
2983
if test -n "$1"; then
2988
test -n "$relink_command" && srcname="$realname"T
2990
# Install the shared library and build the symlinks.
2991
func_show_eval "$install_shared_prog $dir/$srcname $destdir/$realname" \
2995
cygwin* | mingw* | pw32* | cegcc*)
3003
if test -n "$tstripme" && test -n "$striplib"; then
3004
func_show_eval "$striplib $destdir/$realname" 'exit $?'
3007
if test "$#" -gt 0; then
3008
# Delete the old symlinks, and create new ones.
3009
# Try `ln -sf' first, because the `ln' binary might depend on
3010
# the symlink we replace! Solaris /bin/ln does not understand -f,
3011
# so we also need to try rm && ln -s.
3014
test "$linkname" != "$realname" \
3015
&& func_show_eval "(cd $destdir && { $LN_S -f $realname $linkname || { $RM $linkname && $LN_S $realname $linkname; }; })"
3019
# Do each command in the postinstall commands.
3020
lib="$destdir/$realname"
3021
func_execute_cmds "$postinstall_cmds" 'exit $?'
3024
# Install the pseudo-library for information purposes.
3025
func_basename "$file"
3026
name="$func_basename_result"
3027
instname="$dir/$name"i
3028
func_show_eval "$install_prog $instname $destdir/$name" 'exit $?'
3030
# Maybe install the static library, too.
3031
test -n "$old_library" && func_append staticlibs " $dir/$old_library"
3035
# Install (i.e. copy) a libtool object.
3037
# Figure out destination file name, if it wasn't already specified.
3038
if test -n "$destname"; then
3039
destfile="$destdir/$destname"
3041
func_basename "$file"
3042
destfile="$func_basename_result"
3043
destfile="$destdir/$destfile"
3046
# Deduce the name of the destination old-style object file.
3049
func_lo2o "$destfile"
3050
staticdest=$func_lo2o_result
3053
staticdest="$destfile"
3057
func_fatal_help "cannot copy a libtool object to \`$destfile'"
3061
# Install the libtool object if requested.
3062
test -n "$destfile" && \
3063
func_show_eval "$install_prog $file $destfile" 'exit $?'
3065
# Install the old object if enabled.
3066
if test "$build_old_libs" = yes; then
3067
# Deduce the name of the old-style object file.
3069
staticobj=$func_lo2o_result
3070
func_show_eval "$install_prog \$staticobj \$staticdest" 'exit $?'
3076
# Figure out destination file name, if it wasn't already specified.
3077
if test -n "$destname"; then
3078
destfile="$destdir/$destname"
3080
func_basename "$file"
3081
destfile="$func_basename_result"
3082
destfile="$destdir/$destfile"
3085
# If the file is missing, and there is a .exe on the end, strip it
3086
# because it is most likely a libtool script we actually want to
3091
if test ! -f "$file"; then
3092
func_stripname '' '.exe' "$file"
3093
file=$func_stripname_result
3099
# Do a test to see if this is really a libtool program.
3102
if func_ltwrapper_executable_p "$file"; then
3103
func_ltwrapper_scriptname "$file"
3104
wrapper=$func_ltwrapper_scriptname_result
3106
func_stripname '' '.exe' "$file"
3107
wrapper=$func_stripname_result
3114
if func_ltwrapper_script_p "$wrapper"; then
3118
func_source "$wrapper"
3120
# Check the variables that should have been set.
3121
test -z "$generated_by_libtool_version" && \
3122
func_fatal_error "invalid libtool wrapper script \`$wrapper'"
3125
for lib in $notinst_deplibs; do
3126
# Check to see that each library is installed.
3128
if test -f "$lib"; then
3131
libfile="$libdir/"`$ECHO "$lib" | $SED 's%^.*/%%g'` ### testsuite: skip nested quoting test
3132
if test -n "$libdir" && test ! -f "$libfile"; then
3133
func_warning "\`$lib' has not been installed in \`$libdir'"
3139
func_source "$wrapper"
3142
if test "$fast_install" = no && test -n "$relink_command"; then
3144
if test "$finalize" = yes; then
3145
tmpdir=`func_mktempdir`
3146
func_basename "$file$stripped_ext"
3147
file="$func_basename_result"
3148
outputname="$tmpdir/$file"
3149
# Replace the output file specification.
3150
relink_command=`$ECHO "$relink_command" | $SED 's%@OUTPUT@%'"$outputname"'%g'`
3153
func_quote_for_expand "$relink_command"
3154
eval "func_echo $func_quote_for_expand_result"
3156
if eval "$relink_command"; then :
3158
func_error "error: relink \`$file' with the above command before installing it"
3159
$opt_dry_run || ${RM}r "$tmpdir"
3164
func_warning "cannot relink \`$file'"
3168
# Install the binary that we compiled earlier.
3169
file=`$ECHO "$file$stripped_ext" | $SED "s%\([^/]*\)$%$objdir/\1%"`
3173
# remove .exe since cygwin /usr/bin/install will append another
3175
case $install_prog,$host in
3176
*/usr/bin/install*,*cygwin*)
3177
case $file:$destfile in
3182
destfile=$destfile.exe
3185
func_stripname '' '.exe' "$destfile"
3186
destfile=$func_stripname_result
3191
func_show_eval "$install_prog\$stripme \$file \$destfile" 'exit $?'
3192
$opt_dry_run || if test -n "$outputname"; then
3199
for file in $staticlibs; do
3200
func_basename "$file"
3201
name="$func_basename_result"
3203
# Set up the ranlib parameters.
3204
oldlib="$destdir/$name"
3205
func_to_tool_file "$oldlib" func_convert_file_msys_to_w32
3206
tool_oldlib=$func_to_tool_file_result
3208
func_show_eval "$install_prog \$file \$oldlib" 'exit $?'
3210
if test -n "$stripme" && test -n "$old_striplib"; then
3211
func_show_eval "$old_striplib $tool_oldlib" 'exit $?'
3214
# Do each command in the postinstall commands.
3215
func_execute_cmds "$old_postinstall_cmds" 'exit $?'
3218
test -n "$future_libdirs" && \
3219
func_warning "remember to run \`$progname --finish$future_libdirs'"
3221
if test -n "$current_libdirs"; then
3222
# Maybe just do a dry run.
3223
$opt_dry_run && current_libdirs=" -n$current_libdirs"
3224
exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs'
3230
test "$opt_mode" = install && func_mode_install ${1+"$@"}
3233
# func_generate_dlsyms outputname originator pic_p
3234
# Extract symbols from dlprefiles and create ${outputname}S.o with
3235
# a dlpreopen symbol table.
3236
func_generate_dlsyms ()
3242
my_prefix=`$ECHO "$my_originator" | sed 's%[^a-zA-Z0-9]%_%g'`
3245
if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
3246
if test -n "$NM" && test -n "$global_symbol_pipe"; then
3247
my_dlsyms="${my_outputname}S.c"
3249
func_error "not configured to extract global symbols from dlpreopened files"
3253
if test -n "$my_dlsyms"; then
3257
# Discover the nlist of each of the dlfiles.
3258
nlist="$output_objdir/${my_outputname}.nm"
3260
func_show_eval "$RM $nlist ${nlist}S ${nlist}T"
3262
# Parse the name list into a source file.
3263
func_verbose "creating $output_objdir/$my_dlsyms"
3265
$opt_dry_run || $ECHO > "$output_objdir/$my_dlsyms" "\
3266
/* $my_dlsyms - symbol resolution table for \`$my_outputname' dlsym emulation. */
3267
/* Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION */
3273
#if defined(__GNUC__) && (((__GNUC__ == 4) && (__GNUC_MINOR__ >= 4)) || (__GNUC__ > 4))
3274
#pragma GCC diagnostic ignored \"-Wstrict-prototypes\"
3277
/* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */
3278
#if defined(_WIN32) || defined(__CYGWIN__) || defined(_WIN32_WCE)
3279
/* DATA imports from DLLs on WIN32 con't be const, because runtime
3280
relocations are performed -- see ld's documentation on pseudo-relocs. */
3281
# define LT_DLSYM_CONST
3282
#elif defined(__osf__)
3283
/* This system does not cope well with relocations in const data. */
3284
# define LT_DLSYM_CONST
3286
# define LT_DLSYM_CONST const
3289
/* External symbol declarations for the compiler. */\
3292
if test "$dlself" = yes; then
3293
func_verbose "generating symbol list for \`$output'"
3295
$opt_dry_run || echo ': @PROGRAM@ ' > "$nlist"
3297
# Add our own program objects to the symbol list.
3298
progfiles=`$ECHO "$objs$old_deplibs" | $SP2NL | $SED "$lo2o" | $NL2SP`
3299
for progfile in $progfiles; do
3300
func_to_tool_file "$progfile" func_convert_file_msys_to_w32
3301
func_verbose "extracting global C symbols from \`$func_to_tool_file_result'"
3302
$opt_dry_run || eval "$NM $func_to_tool_file_result | $global_symbol_pipe >> '$nlist'"
3305
if test -n "$exclude_expsyms"; then
3307
eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
3308
eval '$MV "$nlist"T "$nlist"'
3312
if test -n "$export_symbols_regex"; then
3314
eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T'
3315
eval '$MV "$nlist"T "$nlist"'
3319
# Prepare the list of exported symbols
3320
if test -z "$export_symbols"; then
3321
export_symbols="$output_objdir/$outputname.exp"
3324
eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
3326
*cygwin* | *mingw* | *cegcc* )
3327
eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
3328
eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"'
3334
eval "${SED} -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"'
3335
eval '$GREP -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T'
3336
eval '$MV "$nlist"T "$nlist"'
3338
*cygwin* | *mingw* | *cegcc* )
3339
eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
3340
eval 'cat "$nlist" >> "$output_objdir/$outputname.def"'
3347
for dlprefile in $dlprefiles; do
3348
func_verbose "extracting global C symbols from \`$dlprefile'"
3349
func_basename "$dlprefile"
3350
name="$func_basename_result"
3352
*cygwin* | *mingw* | *cegcc* )
3353
# if an import library, we need to obtain dlname
3354
if func_win32_import_lib_p "$dlprefile"; then
3355
func_tr_sh "$dlprefile"
3356
eval "curr_lafile=\$libfile_$func_tr_sh_result"
3357
dlprefile_dlbasename=""
3358
if test -n "$curr_lafile" && func_lalib_p "$curr_lafile"; then
3359
# Use subshell, to avoid clobbering current variable values
3360
dlprefile_dlname=`source "$curr_lafile" && echo "$dlname"`
3361
if test -n "$dlprefile_dlname" ; then
3362
func_basename "$dlprefile_dlname"
3363
dlprefile_dlbasename="$func_basename_result"
3365
# no lafile. user explicitly requested -dlpreopen <import library>.
3366
$sharedlib_from_linklib_cmd "$dlprefile"
3367
dlprefile_dlbasename=$sharedlib_from_linklib_result
3371
if test -n "$dlprefile_dlbasename" ; then
3372
eval '$ECHO ": $dlprefile_dlbasename" >> "$nlist"'
3374
func_warning "Could not compute DLL name from $name"
3375
eval '$ECHO ": $name " >> "$nlist"'
3377
func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32
3378
eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe |
3379
$SED -e '/I __imp/d' -e 's/I __nm_/D /;s/_nm__//' >> '$nlist'"
3381
else # not an import lib
3383
eval '$ECHO ": $name " >> "$nlist"'
3384
func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32
3385
eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'"
3391
eval '$ECHO ": $name " >> "$nlist"'
3392
func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32
3393
eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'"
3400
# Make sure we have at least an empty file.
3401
test -f "$nlist" || : > "$nlist"
3403
if test -n "$exclude_expsyms"; then
3404
$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T
3405
$MV "$nlist"T "$nlist"
3408
# Try sorting and uniquifying the output.
3409
if $GREP -v "^: " < "$nlist" |
3410
if sort -k 3 </dev/null >/dev/null 2>&1; then
3415
uniq > "$nlist"S; then
3418
$GREP -v "^: " < "$nlist" > "$nlist"S
3421
if test -f "$nlist"S; then
3422
eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$my_dlsyms"'
3424
echo '/* NONE */' >> "$output_objdir/$my_dlsyms"
3427
echo >> "$output_objdir/$my_dlsyms" "\
3429
/* The mapping between symbol names and symbols. */
3434
extern LT_DLSYM_CONST lt_dlsymlist
3435
lt_${my_prefix}_LTX_preloaded_symbols[];
3436
LT_DLSYM_CONST lt_dlsymlist
3437
lt_${my_prefix}_LTX_preloaded_symbols[] =
3439
{ \"$my_originator\", (void *) 0 },"
3441
case $need_lib_prefix in
3443
eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$my_dlsyms"
3446
eval "$global_symbol_to_c_name_address_lib_prefix" < "$nlist" >> "$output_objdir/$my_dlsyms"
3449
echo >> "$output_objdir/$my_dlsyms" "\
3453
/* This works around a problem in FreeBSD linker */
3454
#ifdef FREEBSD_WORKAROUND
3455
static const void *lt_preloaded_setup() {
3456
return lt_${my_prefix}_LTX_preloaded_symbols;
3466
pic_flag_for_symtable=
3467
case "$compile_command " in
3471
# compiling the symbol table file with pic_flag works around
3472
# a FreeBSD bug that causes programs to crash when -lm is
3473
# linked before any other PIC object. But we must not use
3474
# pic_flag when linking with -static. The problem exists in
3475
# FreeBSD 2.2.6 and is fixed in FreeBSD 3.1.
3476
*-*-freebsd2.*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)
3477
pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND" ;;
3479
pic_flag_for_symtable=" $pic_flag" ;;
3481
if test "X$my_pic_p" != Xno; then
3482
pic_flag_for_symtable=" $pic_flag"
3489
for arg in $LTCFLAGS; do
3491
-pie | -fpie | -fPIE) ;;
3492
*) func_append symtab_cflags " $arg" ;;
3496
# Now compile the dynamic symbol file.
3497
func_show_eval '(cd $output_objdir && $LTCC$symtab_cflags -c$no_builtin_flag$pic_flag_for_symtable "$my_dlsyms")' 'exit $?'
3499
# Clean up the generated files.
3500
func_show_eval '$RM "$output_objdir/$my_dlsyms" "$nlist" "${nlist}S" "${nlist}T"'
3502
# Transform the symbol file into the correct name.
3503
symfileobj="$output_objdir/${my_outputname}S.$objext"
3505
*cygwin* | *mingw* | *cegcc* )
3506
if test -f "$output_objdir/$my_outputname.def"; then
3507
compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"`
3508
finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"`
3510
compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"`
3511
finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"`
3515
compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"`
3516
finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"`
3521
func_fatal_error "unknown suffix for \`$my_dlsyms'"
3525
# We keep going just in case the user didn't refer to
3526
# lt_preloaded_symbols. The linker will fail if global_symbol_pipe
3527
# really was required.
3529
# Nullify the symbol file.
3530
compile_command=`$ECHO "$compile_command" | $SED "s% @SYMFILE@%%"`
3531
finalize_command=`$ECHO "$finalize_command" | $SED "s% @SYMFILE@%%"`
3535
# func_win32_libid arg
3536
# return the library type of file 'arg'
3538
# Need a lot of goo to handle *both* DLLs and import libs
3539
# Has to be a shell function in order to 'eat' the argument
3540
# that is supplied when $file_magic_command is called.
3541
# Despite the name, also deal with 64 bit binaries.
3545
win32_libid_type="unknown"
3546
win32_fileres=`file -L $1 2>/dev/null`
3547
case $win32_fileres in
3548
*ar\ archive\ import\ library*) # definitely import
3549
win32_libid_type="x86 archive import"
3551
*ar\ archive*) # could be an import, or static
3552
# Keep the egrep pattern in sync with the one in _LT_CHECK_MAGIC_METHOD.
3553
if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null |
3554
$EGREP 'file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' >/dev/null; then
3555
func_to_tool_file "$1" func_convert_file_msys_to_w32
3556
win32_nmres=`eval $NM -f posix -A \"$func_to_tool_file_result\" |
3565
case $win32_nmres in
3566
import*) win32_libid_type="x86 archive import";;
3567
*) win32_libid_type="x86 archive static";;
3572
win32_libid_type="x86 DLL"
3574
*executable*) # but shell scripts are "executable" too...
3575
case $win32_fileres in
3576
*MS\ Windows\ PE\ Intel*)
3577
win32_libid_type="x86 DLL"
3582
$ECHO "$win32_libid_type"
3585
# func_cygming_dll_for_implib ARG
3587
# Platform-specific function to extract the
3588
# name of the DLL associated with the specified
3589
# import library ARG.
3590
# Invoked by eval'ing the libtool variable
3591
# $sharedlib_from_linklib_cmd
3592
# Result is available in the variable
3593
# $sharedlib_from_linklib_result
3594
func_cygming_dll_for_implib ()
3597
sharedlib_from_linklib_result=`$DLLTOOL --identify-strict --identify "$1"`
3600
# func_cygming_dll_for_implib_fallback_core SECTION_NAME LIBNAMEs
3602
# The is the core of a fallback implementation of a
3603
# platform-specific function to extract the name of the
3604
# DLL associated with the specified import library LIBNAME.
3606
# SECTION_NAME is either .idata$6 or .idata$7, depending
3607
# on the platform and compiler that created the implib.
3609
# Echos the name of the DLL associated with the
3610
# specified import library.
3611
func_cygming_dll_for_implib_fallback_core ()
3614
match_literal=`$ECHO "$1" | $SED "$sed_make_literal_regex"`
3615
$OBJDUMP -s --section "$1" "$2" 2>/dev/null |
3616
$SED '/^Contents of section '"$match_literal"':/{
3617
# Place marker at beginning of archive member dllname section
3622
# These lines can sometimes be longer than 43 characters, but
3623
# are always uninteresting
3624
/:[ ]*file format pe[i]\{,1\}-/d
3625
/^In archive [^:]*:/d
3626
# Ensure marker is printed
3628
# Remove all lines with less than 43 characters
3630
# From remaining lines, remove first 43 characters
3633
# Join marker and all lines until next marker into a single line
3634
/^====MARK====/ b para
3643
# Remove trailing dots and whitespace
3647
# we now have a list, one entry per line, of the stringified
3648
# contents of the appropriate section of all members of the
3649
# archive which possess that section. Heuristic: eliminate
3650
# all those which have a first or second character that is
3651
# a '.' (that is, objdump's representation of an unprintable
3652
# character.) This should work for all archives with less than
3653
# 0x302f exports -- but will fail for DLLs whose name actually
3654
# begins with a literal '.' or a single character followed by
3657
# Of those that remain, print the first one.
3658
$SED -e '/^\./d;/^.\./d;q'
3661
# func_cygming_gnu_implib_p ARG
3662
# This predicate returns with zero status (TRUE) if
3663
# ARG is a GNU/binutils-style import library. Returns
3664
# with nonzero status (FALSE) otherwise.
3665
func_cygming_gnu_implib_p ()
3668
func_to_tool_file "$1" func_convert_file_msys_to_w32
3669
func_cygming_gnu_implib_tmp=`$NM "$func_to_tool_file_result" | eval "$global_symbol_pipe" | $EGREP ' (_head_[A-Za-z0-9_]+_[ad]l*|[A-Za-z0-9_]+_[ad]l*_iname)$'`
3670
test -n "$func_cygming_gnu_implib_tmp"
3673
# func_cygming_ms_implib_p ARG
3674
# This predicate returns with zero status (TRUE) if
3675
# ARG is an MS-style import library. Returns
3676
# with nonzero status (FALSE) otherwise.
3677
func_cygming_ms_implib_p ()
3680
func_to_tool_file "$1" func_convert_file_msys_to_w32
3681
func_cygming_ms_implib_tmp=`$NM "$func_to_tool_file_result" | eval "$global_symbol_pipe" | $GREP '_NULL_IMPORT_DESCRIPTOR'`
3682
test -n "$func_cygming_ms_implib_tmp"
3685
# func_cygming_dll_for_implib_fallback ARG
3686
# Platform-specific function to extract the
3687
# name of the DLL associated with the specified
3688
# import library ARG.
3690
# This fallback implementation is for use when $DLLTOOL
3691
# does not support the --identify-strict option.
3692
# Invoked by eval'ing the libtool variable
3693
# $sharedlib_from_linklib_cmd
3694
# Result is available in the variable
3695
# $sharedlib_from_linklib_result
3696
func_cygming_dll_for_implib_fallback ()
3699
if func_cygming_gnu_implib_p "$1" ; then
3700
# binutils import library
3701
sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$7' "$1"`
3702
elif func_cygming_ms_implib_p "$1" ; then
3703
# ms-generated import library
3704
sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$6' "$1"`
3707
sharedlib_from_linklib_result=""
3712
# func_extract_an_archive dir oldlib
3713
func_extract_an_archive ()
3716
f_ex_an_ar_dir="$1"; shift
3717
f_ex_an_ar_oldlib="$1"
3718
if test "$lock_old_archive_extraction" = yes; then
3719
lockfile=$f_ex_an_ar_oldlib.lock
3720
until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do
3721
func_echo "Waiting for $lockfile to be removed"
3725
func_show_eval "(cd \$f_ex_an_ar_dir && $AR x \"\$f_ex_an_ar_oldlib\")" \
3726
'stat=$?; rm -f "$lockfile"; exit $stat'
3727
if test "$lock_old_archive_extraction" = yes; then
3728
$opt_dry_run || rm -f "$lockfile"
3730
if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then
3733
func_fatal_error "object name conflicts in archive: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib"
3738
# func_extract_archives gentop oldlib ...
3739
func_extract_archives ()
3742
my_gentop="$1"; shift
3743
my_oldlibs=${1+"$@"}
3749
for my_xlib in $my_oldlibs; do
3750
# Extract the objects.
3752
[\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;;
3753
*) my_xabs=`pwd`"/$my_xlib" ;;
3755
func_basename "$my_xlib"
3756
my_xlib="$func_basename_result"
3759
case " $extracted_archives " in
3761
func_arith $extracted_serial + 1
3762
extracted_serial=$func_arith_result
3763
my_xlib_u=lt$extracted_serial-$my_xlib ;;
3767
extracted_archives="$extracted_archives $my_xlib_u"
3768
my_xdir="$my_gentop/$my_xlib_u"
3770
func_mkdir_p "$my_xdir"
3774
func_verbose "Extracting $my_xabs"
3775
# Do not bother doing anything if just a dry run
3777
darwin_orig_dir=`pwd`
3778
cd $my_xdir || exit $?
3779
darwin_archive=$my_xabs
3781
darwin_base_archive=`basename "$darwin_archive"`
3782
darwin_arches=`$LIPO -info "$darwin_archive" 2>/dev/null | $GREP Architectures 2>/dev/null || true`
3783
if test -n "$darwin_arches"; then
3784
darwin_arches=`$ECHO "$darwin_arches" | $SED -e 's/.*are://'`
3786
func_verbose "$darwin_base_archive has multiple architectures $darwin_arches"
3787
for darwin_arch in $darwin_arches ; do
3788
func_mkdir_p "unfat-$$/${darwin_base_archive}-${darwin_arch}"
3789
$LIPO -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}"
3790
cd "unfat-$$/${darwin_base_archive}-${darwin_arch}"
3791
func_extract_an_archive "`pwd`" "${darwin_base_archive}"
3793
$RM "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}"
3794
done # $darwin_arches
3795
## Okay now we've a bunch of thin objects, gotta fatten them up :)
3796
darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print | $SED -e "$basename" | sort -u`
3799
for darwin_file in $darwin_filelist; do
3800
darwin_files=`find unfat-$$ -name $darwin_file -print | sort | $NL2SP`
3801
$LIPO -create -output "$darwin_file" $darwin_files
3802
done # $darwin_filelist
3804
cd "$darwin_orig_dir"
3807
func_extract_an_archive "$my_xdir" "$my_xabs"
3812
func_extract_an_archive "$my_xdir" "$my_xabs"
3815
my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | sort | $NL2SP`
3818
func_extract_archives_result="$my_oldobjs"
3822
# func_emit_wrapper [arg=no]
3824
# Emit a libtool wrapper script on stdout.
3825
# Don't directly open a file because we may want to
3826
# incorporate the script contents within a cygwin/mingw
3827
# wrapper executable. Must ONLY be called from within
3828
# func_mode_link because it depends on a number of variables
3831
# ARG is the value that the WRAPPER_SCRIPT_BELONGS_IN_OBJDIR
3832
# variable will take. If 'yes', then the emitted script
3833
# will assume that the directory in which it is stored is
3834
# the $objdir directory. This is a cygwin/mingw-specific
3836
func_emit_wrapper ()
3838
func_emit_wrapper_arg1=${1-no}
3843
# $output - temporary wrapper script for $objdir/$outputname
3844
# Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
3846
# The $output program cannot be directly executed until all the libtool
3847
# libraries that it depends on are installed.
3849
# This wrapper script should never be moved out of the build directory.
3850
# If it is, it will not operate correctly.
3852
# Sed substitution that helps us do robust quoting. It backslashifies
3853
# metacharacters that are still active within double-quoted strings.
3854
sed_quote_subst='$sed_quote_subst'
3856
# Be Bourne compatible
3857
if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then
3860
# Zsh 3.x and 4.x performs word splitting on \${1+\"\$@\"}, which
3861
# is contrary to our usage. Disable this feature.
3862
alias -g '\${1+\"\$@\"}'='\"\$@\"'
3863
setopt NO_GLOB_SUBST
3865
case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac
3867
BIN_SH=xpg4; export BIN_SH # for Tru64
3868
DUALCASE=1; export DUALCASE # for MKS sh
3870
# The HP-UX ksh and POSIX shell print the target directory to stdout
3872
(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
3874
relink_command=\"$relink_command\"
3876
# This environment variable determines our operation mode.
3877
if test \"\$libtool_install_magic\" = \"$magic\"; then
3878
# install mode needs the following variables:
3879
generated_by_libtool_version='$macro_version'
3880
notinst_deplibs='$notinst_deplibs'
3882
# When we are sourced in execute mode, \$file and \$ECHO are already set.
3883
if test \"\$libtool_execute_magic\" != \"$magic\"; then
3886
qECHO=`$ECHO "$ECHO" | $SED "$sed_quote_subst"`
3889
# A function that is used when there is no print builtin or printf.
3890
func_fallback_echo ()
3892
eval 'cat <<_LTECHO_EOF
3899
# Very basic option parsing. These options are (a) specific to
3900
# the libtool wrapper, (b) are identical between the wrapper
3901
# /script/ and the wrapper /executable/ which is used only on
3902
# windows platforms, and (c) all begin with the string "--lt-"
3903
# (application programs are unlikely to have options which match
3906
# There are only two supported options: --lt-debug and
3907
# --lt-dump-script. There is, deliberately, no --lt-help.
3909
# The first argument to this parsing function should be the
3910
# script's $0 value, followed by "$@".
3912
func_parse_lt_options ()
3918
case \"\$lt_opt\" in
3919
--lt-debug) lt_option_debug=1 ;;
3921
lt_dump_D=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%/[^/]*$%%'\`
3922
test \"X\$lt_dump_D\" = \"X\$lt_script_arg0\" && lt_dump_D=.
3923
lt_dump_F=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%^.*/%%'\`
3924
cat \"\$lt_dump_D/\$lt_dump_F\"
3928
\$ECHO \"Unrecognized --lt- option: '\$lt_opt'\" 1>&2
3934
# Print the debug banner immediately:
3935
if test -n \"\$lt_option_debug\"; then
3936
echo \"${outputname}:${output}:\${LINENO}: libtool wrapper (GNU $PACKAGE$TIMESTAMP) $VERSION\" 1>&2
3940
# Used when --lt-debug. Prints its arguments to stdout
3941
# (redirection is the responsibility of the caller)
3942
func_lt_dump_args ()
3947
\$ECHO \"${outputname}:${output}:\${LINENO}: newargv[\$lt_dump_args_N]: \$lt_arg\"
3948
lt_dump_args_N=\`expr \$lt_dump_args_N + 1\`
3952
# Core function for launching the target application
3953
func_exec_program_core ()
3957
# Backslashes separate directories on plain windows
3958
*-*-mingw | *-*-os2* | *-cegcc*)
3960
if test -n \"\$lt_option_debug\"; then
3961
\$ECHO \"${outputname}:${output}:\${LINENO}: newargv[0]: \$progdir\\\\\$program\" 1>&2
3962
func_lt_dump_args \${1+\"\$@\"} 1>&2
3964
exec \"\$progdir\\\\\$program\" \${1+\"\$@\"}
3970
if test -n \"\$lt_option_debug\"; then
3971
\$ECHO \"${outputname}:${output}:\${LINENO}: newargv[0]: \$progdir/\$program\" 1>&2
3972
func_lt_dump_args \${1+\"\$@\"} 1>&2
3974
exec \"\$progdir/\$program\" \${1+\"\$@\"}
3979
\$ECHO \"\$0: cannot exec \$program \$*\" 1>&2
3983
# A function to encapsulate launching the target application
3984
# Strips options in the --lt-* namespace from \$@ and
3985
# launches target application with the remaining arguments.
3986
func_exec_program ()
3994
*) set x \"\$@\" \"\$lt_wr_arg\"; shift;;
3999
func_exec_program_core \${1+\"\$@\"}
4003
func_parse_lt_options \"\$0\" \${1+\"\$@\"}
4005
# Find the directory that this script lives in.
4006
thisdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*$%%'\`
4007
test \"x\$thisdir\" = \"x\$file\" && thisdir=.
4009
# Follow symbolic links until we get to the real thisdir.
4010
file=\`ls -ld \"\$file\" | $SED -n 's/.*-> //p'\`
4011
while test -n \"\$file\"; do
4012
destdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*\$%%'\`
4014
# If there was a directory component, then change thisdir.
4015
if test \"x\$destdir\" != \"x\$file\"; then
4016
case \"\$destdir\" in
4017
[\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;;
4018
*) thisdir=\"\$thisdir/\$destdir\" ;;
4022
file=\`\$ECHO \"\$file\" | $SED 's%^.*/%%'\`
4023
file=\`ls -ld \"\$thisdir/\$file\" | $SED -n 's/.*-> //p'\`
4026
# Usually 'no', except on cygwin/mingw when embedded into
4028
WRAPPER_SCRIPT_BELONGS_IN_OBJDIR=$func_emit_wrapper_arg1
4029
if test \"\$WRAPPER_SCRIPT_BELONGS_IN_OBJDIR\" = \"yes\"; then
4030
# special case for '.'
4031
if test \"\$thisdir\" = \".\"; then
4034
# remove .libs from thisdir
4035
case \"\$thisdir\" in
4036
*[\\\\/]$objdir ) thisdir=\`\$ECHO \"\$thisdir\" | $SED 's%[\\\\/][^\\\\/]*$%%'\` ;;
4037
$objdir ) thisdir=. ;;
4041
# Try to get the absolute directory name.
4042
absdir=\`cd \"\$thisdir\" && pwd\`
4043
test -n \"\$absdir\" && thisdir=\"\$absdir\"
4046
if test "$fast_install" = yes; then
4048
program=lt-'$outputname'$exeext
4049
progdir=\"\$thisdir/$objdir\"
4051
if test ! -f \"\$progdir/\$program\" ||
4052
{ file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\
4053
test \"X\$file\" != \"X\$progdir/\$program\"; }; then
4055
file=\"\$\$-\$program\"
4057
if test ! -d \"\$progdir\"; then
4058
$MKDIR \"\$progdir\"
4060
$RM \"\$progdir/\$file\"
4065
# relink executable if necessary
4066
if test -n \"\$relink_command\"; then
4067
if relink_command_output=\`eval \$relink_command 2>&1\`; then :
4069
$ECHO \"\$relink_command_output\" >&2
4070
$RM \"\$progdir/\$file\"
4075
$MV \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null ||
4076
{ $RM \"\$progdir/\$program\";
4077
$MV \"\$progdir/\$file\" \"\$progdir/\$program\"; }
4078
$RM \"\$progdir/\$file\"
4082
program='$outputname'
4083
progdir=\"\$thisdir/$objdir\"
4089
if test -f \"\$progdir/\$program\"; then"
4091
# fixup the dll searchpath if we need to.
4093
# Fix the DLL searchpath if we need to. Do this before prepending
4094
# to shlibpath, because on Windows, both are PATH and uninstalled
4095
# libraries must come first.
4096
if test -n "$dllsearchpath"; then
4098
# Add the dll search path components to the executable PATH
4099
PATH=$dllsearchpath:\$PATH
4103
# Export our shlibpath_var if we have one.
4104
if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
4106
# Add our own library path to $shlibpath_var
4107
$shlibpath_var=\"$temp_rpath\$$shlibpath_var\"
4109
# Some systems cannot cope with colon-terminated $shlibpath_var
4110
# The second colon is a workaround for a bug in BeOS R4 sed
4111
$shlibpath_var=\`\$ECHO \"\$$shlibpath_var\" | $SED 's/::*\$//'\`
4113
export $shlibpath_var
4118
if test \"\$libtool_execute_magic\" != \"$magic\"; then
4119
# Run the actual program with our arguments.
4120
func_exec_program \${1+\"\$@\"}
4123
# The program doesn't exist.
4124
\$ECHO \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2
4125
\$ECHO \"This script is just a wrapper for \$program.\" 1>&2
4126
\$ECHO \"See the $PACKAGE documentation for more information.\" 1>&2
4134
# func_emit_cwrapperexe_src
4135
# emit the source code for a wrapper executable on stdout
4136
# Must ONLY be called from within func_mode_link because
4137
# it depends on a number of variable set therein.
4138
func_emit_cwrapperexe_src ()
4142
/* $cwrappersource - temporary wrapper executable for $objdir/$outputname
4143
Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
4145
The $output program cannot be directly executed until all the libtool
4146
libraries that it depends on are installed.
4148
This wrapper executable should never be moved out of the build directory.
4149
If it is, it will not operate correctly.
4154
# define _CRT_SECURE_NO_DEPRECATE 1
4159
# include <direct.h>
4160
# include <process.h>
4163
# include <unistd.h>
4164
# include <stdint.h>
4176
#include <sys/stat.h>
4178
/* declarations of non-ANSI functions */
4179
#if defined(__MINGW32__)
4180
# ifdef __STRICT_ANSI__
4181
int _putenv (const char *);
4183
#elif defined(__CYGWIN__)
4184
# ifdef __STRICT_ANSI__
4185
char *realpath (const char *, char *);
4186
int putenv (char *);
4187
int setenv (const char *, const char *, int);
4189
/* #elif defined (other platforms) ... */
4192
/* portability defines, excluding path handling macros */
4193
#if defined(_MSC_VER)
4194
# define setmode _setmode
4196
# define chmod _chmod
4197
# define getcwd _getcwd
4198
# define putenv _putenv
4199
# define S_IXUSR _S_IEXEC
4200
# ifndef _INTPTR_T_DEFINED
4201
# define _INTPTR_T_DEFINED
4202
# define intptr_t int
4204
#elif defined(__MINGW32__)
4205
# define setmode _setmode
4207
# define chmod _chmod
4208
# define getcwd _getcwd
4209
# define putenv _putenv
4210
#elif defined(__CYGWIN__)
4211
# define HAVE_SETENV
4212
# define FOPEN_WB "wb"
4213
/* #elif defined (other platforms) ... */
4216
#if defined(PATH_MAX)
4217
# define LT_PATHMAX PATH_MAX
4218
#elif defined(MAXPATHLEN)
4219
# define LT_PATHMAX MAXPATHLEN
4221
# define LT_PATHMAX 1024
4231
/* path handling portability macros */
4232
#ifndef DIR_SEPARATOR
4233
# define DIR_SEPARATOR '/'
4234
# define PATH_SEPARATOR ':'
4237
#if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \
4239
# define HAVE_DOS_BASED_FILE_SYSTEM
4240
# define FOPEN_WB "wb"
4241
# ifndef DIR_SEPARATOR_2
4242
# define DIR_SEPARATOR_2 '\\'
4244
# ifndef PATH_SEPARATOR_2
4245
# define PATH_SEPARATOR_2 ';'
4249
#ifndef DIR_SEPARATOR_2
4250
# define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR)
4251
#else /* DIR_SEPARATOR_2 */
4252
# define IS_DIR_SEPARATOR(ch) \
4253
(((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2))
4254
#endif /* DIR_SEPARATOR_2 */
4256
#ifndef PATH_SEPARATOR_2
4257
# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR)
4258
#else /* PATH_SEPARATOR_2 */
4259
# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2)
4260
#endif /* PATH_SEPARATOR_2 */
4263
# define FOPEN_WB "w"
4266
# define _O_BINARY 0
4269
#define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type)))
4270
#define XFREE(stale) do { \
4271
if (stale) { free ((void *) stale); stale = 0; } \
4274
#if defined(LT_DEBUGWRAPPER)
4275
static int lt_debug = 1;
4277
static int lt_debug = 0;
4280
const char *program_name = "libtool-wrapper"; /* in case xstrdup fails */
4282
void *xmalloc (size_t num);
4283
char *xstrdup (const char *string);
4284
const char *base_name (const char *name);
4285
char *find_executable (const char *wrapper);
4286
char *chase_symlinks (const char *pathspec);
4287
int make_executable (const char *path);
4288
int check_executable (const char *path);
4289
char *strendzap (char *str, const char *pat);
4290
void lt_debugprintf (const char *file, int line, const char *fmt, ...);
4291
void lt_fatal (const char *file, int line, const char *message, ...);
4292
static const char *nonnull (const char *s);
4293
static const char *nonempty (const char *s);
4294
void lt_setenv (const char *name, const char *value);
4295
char *lt_extend_str (const char *orig_value, const char *add, int to_end);
4296
void lt_update_exe_path (const char *name, const char *value);
4297
void lt_update_lib_path (const char *name, const char *value);
4298
char **prepare_spawn (char **argv);
4299
void lt_dump_script (FILE *f);
4303
volatile const char * MAGIC_EXE = "$magic_exe";
4304
const char * LIB_PATH_VARNAME = "$shlibpath_var";
4307
if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
4308
func_to_host_path "$temp_rpath"
4310
const char * LIB_PATH_VALUE = "$func_to_host_path_result";
4314
const char * LIB_PATH_VALUE = "";
4318
if test -n "$dllsearchpath"; then
4319
func_to_host_path "$dllsearchpath:"
4321
const char * EXE_PATH_VARNAME = "PATH";
4322
const char * EXE_PATH_VALUE = "$func_to_host_path_result";
4326
const char * EXE_PATH_VARNAME = "";
4327
const char * EXE_PATH_VALUE = "";
4331
if test "$fast_install" = yes; then
4333
const char * TARGET_PROGRAM_NAME = "lt-$outputname"; /* hopefully, no .exe */
4337
const char * TARGET_PROGRAM_NAME = "$outputname"; /* hopefully, no .exe */
4344
#define LTWRAPPER_OPTION_PREFIX "--lt-"
4346
static const char *ltwrapper_option_prefix = LTWRAPPER_OPTION_PREFIX;
4347
static const char *dumpscript_opt = LTWRAPPER_OPTION_PREFIX "dump-script";
4348
static const char *debug_opt = LTWRAPPER_OPTION_PREFIX "debug";
4351
main (int argc, char *argv[])
4356
char *actual_cwrapper_path;
4357
char *actual_cwrapper_name;
4360
intptr_t rval = 127;
4364
program_name = (char *) xstrdup (base_name (argv[0]));
4365
newargz = XMALLOC (char *, argc + 1);
4367
/* very simple arg parsing; don't want to rely on getopt
4368
* also, copy all non cwrapper options to newargz, except
4369
* argz[0], which is handled differently
4372
for (i = 1; i < argc; i++)
4374
if (strcmp (argv[i], dumpscript_opt) == 0)
4378
*mingw* | *cygwin* )
4379
# make stdout use "unix" line endings
4380
echo " setmode(1,_O_BINARY);"
4385
lt_dump_script (stdout);
4388
if (strcmp (argv[i], debug_opt) == 0)
4393
if (strcmp (argv[i], ltwrapper_option_prefix) == 0)
4395
/* however, if there is an option in the LTWRAPPER_OPTION_PREFIX
4396
namespace, but it is not one of the ones we know about and
4397
have already dealt with, above (inluding dump-script), then
4398
report an error. Otherwise, targets might begin to believe
4399
they are allowed to use options in the LTWRAPPER_OPTION_PREFIX
4400
namespace. The first time any user complains about this, we'll
4401
need to make LTWRAPPER_OPTION_PREFIX a configure-time option
4402
or a configure.ac-settable value.
4404
lt_fatal (__FILE__, __LINE__,
4405
"unrecognized %s option: '%s'",
4406
ltwrapper_option_prefix, argv[i]);
4409
newargz[++newargc] = xstrdup (argv[i]);
4411
newargz[++newargc] = NULL;
4415
/* The GNU banner must be the first non-error debug message */
4416
lt_debugprintf (__FILE__, __LINE__, "libtool wrapper (GNU $PACKAGE$TIMESTAMP) $VERSION\n");
4419
lt_debugprintf (__FILE__, __LINE__, "(main) argv[0]: %s\n", argv[0]);
4420
lt_debugprintf (__FILE__, __LINE__, "(main) program_name: %s\n", program_name);
4422
tmp_pathspec = find_executable (argv[0]);
4423
if (tmp_pathspec == NULL)
4424
lt_fatal (__FILE__, __LINE__, "couldn't find %s", argv[0]);
4425
lt_debugprintf (__FILE__, __LINE__,
4426
"(main) found exe (before symlink chase) at: %s\n",
4429
actual_cwrapper_path = chase_symlinks (tmp_pathspec);
4430
lt_debugprintf (__FILE__, __LINE__,
4431
"(main) found exe (after symlink chase) at: %s\n",
4432
actual_cwrapper_path);
4433
XFREE (tmp_pathspec);
4435
actual_cwrapper_name = xstrdup (base_name (actual_cwrapper_path));
4436
strendzap (actual_cwrapper_path, actual_cwrapper_name);
4438
/* wrapper name transforms */
4439
strendzap (actual_cwrapper_name, ".exe");
4440
tmp_pathspec = lt_extend_str (actual_cwrapper_name, ".exe", 1);
4441
XFREE (actual_cwrapper_name);
4442
actual_cwrapper_name = tmp_pathspec;
4445
/* target_name transforms -- use actual target program name; might have lt- prefix */
4446
target_name = xstrdup (base_name (TARGET_PROGRAM_NAME));
4447
strendzap (target_name, ".exe");
4448
tmp_pathspec = lt_extend_str (target_name, ".exe", 1);
4449
XFREE (target_name);
4450
target_name = tmp_pathspec;
4453
lt_debugprintf (__FILE__, __LINE__,
4454
"(main) libtool target name: %s\n",
4460
XMALLOC (char, (strlen (actual_cwrapper_path) +
4461
strlen ("$objdir") + 1 + strlen (actual_cwrapper_name) + 1));
4462
strcpy (newargz[0], actual_cwrapper_path);
4463
strcat (newargz[0], "$objdir");
4464
strcat (newargz[0], "/");
4468
/* stop here, and copy so we don't have to do this twice */
4469
tmp_pathspec = xstrdup (newargz[0]);
4471
/* do NOT want the lt- prefix here, so use actual_cwrapper_name */
4472
strcat (newargz[0], actual_cwrapper_name);
4474
/* DO want the lt- prefix here if it exists, so use target_name */
4475
lt_argv_zero = lt_extend_str (tmp_pathspec, target_name, 1);
4476
XFREE (tmp_pathspec);
4477
tmp_pathspec = NULL;
4485
while ((p = strchr (newargz[0], '\\')) != NULL)
4489
while ((p = strchr (lt_argv_zero, '\\')) != NULL)
4499
XFREE (target_name);
4500
XFREE (actual_cwrapper_path);
4501
XFREE (actual_cwrapper_name);
4503
lt_setenv ("BIN_SH", "xpg4"); /* for Tru64 */
4504
lt_setenv ("DUALCASE", "1"); /* for MSK sh */
4505
/* Update the DLL searchpath. EXE_PATH_VALUE ($dllsearchpath) must
4506
be prepended before (that is, appear after) LIB_PATH_VALUE ($temp_rpath)
4507
because on Windows, both *_VARNAMEs are PATH but uninstalled
4508
libraries must come first. */
4509
lt_update_exe_path (EXE_PATH_VARNAME, EXE_PATH_VALUE);
4510
lt_update_lib_path (LIB_PATH_VARNAME, LIB_PATH_VALUE);
4512
lt_debugprintf (__FILE__, __LINE__, "(main) lt_argv_zero: %s\n",
4513
nonnull (lt_argv_zero));
4514
for (i = 0; i < newargc; i++)
4516
lt_debugprintf (__FILE__, __LINE__, "(main) newargz[%d]: %s\n",
4517
i, nonnull (newargz[i]));
4525
/* execv doesn't actually work on mingw as expected on unix */
4526
newargz = prepare_spawn (newargz);
4527
rval = _spawnv (_P_WAIT, lt_argv_zero, (const char * const *) newargz);
4530
/* failed to start process */
4531
lt_debugprintf (__FILE__, __LINE__,
4532
"(main) failed to launch target \"%s\": %s\n",
4533
lt_argv_zero, nonnull (strerror (errno)));
4541
execv (lt_argv_zero, newargz);
4542
return rval; /* =127, but avoids unused variable warning */
4551
xmalloc (size_t num)
4553
void *p = (void *) malloc (num);
4555
lt_fatal (__FILE__, __LINE__, "memory exhausted");
4561
xstrdup (const char *string)
4563
return string ? strcpy ((char *) xmalloc (strlen (string) + 1),
4568
base_name (const char *name)
4572
#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
4573
/* Skip over the disk name in MSDOS pathnames. */
4574
if (isalpha ((unsigned char) name[0]) && name[1] == ':')
4578
for (base = name; *name; name++)
4579
if (IS_DIR_SEPARATOR (*name))
4585
check_executable (const char *path)
4589
lt_debugprintf (__FILE__, __LINE__, "(check_executable): %s\n",
4591
if ((!path) || (!*path))
4594
if ((stat (path, &st) >= 0)
4595
&& (st.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH)))
4602
make_executable (const char *path)
4607
lt_debugprintf (__FILE__, __LINE__, "(make_executable): %s\n",
4609
if ((!path) || (!*path))
4612
if (stat (path, &st) >= 0)
4614
rval = chmod (path, st.st_mode | S_IXOTH | S_IXGRP | S_IXUSR);
4619
/* Searches for the full path of the wrapper. Returns
4620
newly allocated full path name if found, NULL otherwise
4621
Does not chase symlinks, even on platforms that support them.
4624
find_executable (const char *wrapper)
4629
/* static buffer for getcwd */
4630
char tmp[LT_PATHMAX + 1];
4634
lt_debugprintf (__FILE__, __LINE__, "(find_executable): %s\n",
4635
nonempty (wrapper));
4637
if ((wrapper == NULL) || (*wrapper == '\0'))
4640
/* Absolute path? */
4641
#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
4642
if (isalpha ((unsigned char) wrapper[0]) && wrapper[1] == ':')
4644
concat_name = xstrdup (wrapper);
4645
if (check_executable (concat_name))
4647
XFREE (concat_name);
4652
if (IS_DIR_SEPARATOR (wrapper[0]))
4654
concat_name = xstrdup (wrapper);
4655
if (check_executable (concat_name))
4657
XFREE (concat_name);
4659
#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
4663
for (p = wrapper; *p; p++)
4671
/* no slashes; search PATH */
4672
const char *path = getenv ("PATH");
4675
for (p = path; *p; p = p_next)
4679
for (q = p; *q; q++)
4680
if (IS_PATH_SEPARATOR (*q))
4683
p_next = (*q == '\0' ? q : q + 1);
4686
/* empty path: current directory */
4687
if (getcwd (tmp, LT_PATHMAX) == NULL)
4688
lt_fatal (__FILE__, __LINE__, "getcwd failed: %s",
4689
nonnull (strerror (errno)));
4690
tmp_len = strlen (tmp);
4692
XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1);
4693
memcpy (concat_name, tmp, tmp_len);
4694
concat_name[tmp_len] = '/';
4695
strcpy (concat_name + tmp_len + 1, wrapper);
4700
XMALLOC (char, p_len + 1 + strlen (wrapper) + 1);
4701
memcpy (concat_name, p, p_len);
4702
concat_name[p_len] = '/';
4703
strcpy (concat_name + p_len + 1, wrapper);
4705
if (check_executable (concat_name))
4707
XFREE (concat_name);
4710
/* not found in PATH; assume curdir */
4712
/* Relative path | not found in path: prepend cwd */
4713
if (getcwd (tmp, LT_PATHMAX) == NULL)
4714
lt_fatal (__FILE__, __LINE__, "getcwd failed: %s",
4715
nonnull (strerror (errno)));
4716
tmp_len = strlen (tmp);
4717
concat_name = XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1);
4718
memcpy (concat_name, tmp, tmp_len);
4719
concat_name[tmp_len] = '/';
4720
strcpy (concat_name + tmp_len + 1, wrapper);
4722
if (check_executable (concat_name))
4724
XFREE (concat_name);
4729
chase_symlinks (const char *pathspec)
4732
return xstrdup (pathspec);
4734
char buf[LT_PATHMAX];
4736
char *tmp_pathspec = xstrdup (pathspec);
4738
int has_symlinks = 0;
4739
while (strlen (tmp_pathspec) && !has_symlinks)
4741
lt_debugprintf (__FILE__, __LINE__,
4742
"checking path component for symlinks: %s\n",
4744
if (lstat (tmp_pathspec, &s) == 0)
4746
if (S_ISLNK (s.st_mode) != 0)
4752
/* search backwards for last DIR_SEPARATOR */
4753
p = tmp_pathspec + strlen (tmp_pathspec) - 1;
4754
while ((p > tmp_pathspec) && (!IS_DIR_SEPARATOR (*p)))
4756
if ((p == tmp_pathspec) && (!IS_DIR_SEPARATOR (*p)))
4758
/* no more DIR_SEPARATORS left */
4765
lt_fatal (__FILE__, __LINE__,
4766
"error accessing file \"%s\": %s",
4767
tmp_pathspec, nonnull (strerror (errno)));
4770
XFREE (tmp_pathspec);
4774
return xstrdup (pathspec);
4777
tmp_pathspec = realpath (pathspec, buf);
4778
if (tmp_pathspec == 0)
4780
lt_fatal (__FILE__, __LINE__,
4781
"could not follow symlinks for %s", pathspec);
4783
return xstrdup (tmp_pathspec);
4788
strendzap (char *str, const char *pat)
4792
assert (str != NULL);
4793
assert (pat != NULL);
4796
patlen = strlen (pat);
4800
str += len - patlen;
4801
if (strcmp (str, pat) == 0)
4808
lt_debugprintf (const char *file, int line, const char *fmt, ...)
4813
(void) fprintf (stderr, "%s:%s:%d: ", program_name, file, line);
4814
va_start (args, fmt);
4815
(void) vfprintf (stderr, fmt, args);
4821
lt_error_core (int exit_status, const char *file,
4822
int line, const char *mode,
4823
const char *message, va_list ap)
4825
fprintf (stderr, "%s:%s:%d: %s: ", program_name, file, line, mode);
4826
vfprintf (stderr, message, ap);
4827
fprintf (stderr, ".\n");
4829
if (exit_status >= 0)
4834
lt_fatal (const char *file, int line, const char *message, ...)
4837
va_start (ap, message);
4838
lt_error_core (EXIT_FAILURE, file, line, "FATAL", message, ap);
4843
nonnull (const char *s)
4845
return s ? s : "(null)";
4849
nonempty (const char *s)
4851
return (s && !*s) ? "(empty)" : nonnull (s);
4855
lt_setenv (const char *name, const char *value)
4857
lt_debugprintf (__FILE__, __LINE__,
4858
"(lt_setenv) setting '%s' to '%s'\n",
4859
nonnull (name), nonnull (value));
4862
/* always make a copy, for consistency with !HAVE_SETENV */
4863
char *str = xstrdup (value);
4864
setenv (name, str, 1);
4866
int len = strlen (name) + 1 + strlen (value) + 1;
4867
char *str = XMALLOC (char, len);
4868
sprintf (str, "%s=%s", name, value);
4869
if (putenv (str) != EXIT_SUCCESS)
4878
lt_extend_str (const char *orig_value, const char *add, int to_end)
4881
if (orig_value && *orig_value)
4883
int orig_value_len = strlen (orig_value);
4884
int add_len = strlen (add);
4885
new_value = XMALLOC (char, add_len + orig_value_len + 1);
4888
strcpy (new_value, orig_value);
4889
strcpy (new_value + orig_value_len, add);
4893
strcpy (new_value, add);
4894
strcpy (new_value + add_len, orig_value);
4899
new_value = xstrdup (add);
4905
lt_update_exe_path (const char *name, const char *value)
4907
lt_debugprintf (__FILE__, __LINE__,
4908
"(lt_update_exe_path) modifying '%s' by prepending '%s'\n",
4909
nonnull (name), nonnull (value));
4911
if (name && *name && value && *value)
4913
char *new_value = lt_extend_str (getenv (name), value, 0);
4914
/* some systems can't cope with a ':'-terminated path #' */
4915
int len = strlen (new_value);
4916
while (((len = strlen (new_value)) > 0) && IS_PATH_SEPARATOR (new_value[len-1]))
4918
new_value[len-1] = '\0';
4920
lt_setenv (name, new_value);
4926
lt_update_lib_path (const char *name, const char *value)
4928
lt_debugprintf (__FILE__, __LINE__,
4929
"(lt_update_lib_path) modifying '%s' by prepending '%s'\n",
4930
nonnull (name), nonnull (value));
4932
if (name && *name && value && *value)
4934
char *new_value = lt_extend_str (getenv (name), value, 0);
4935
lt_setenv (name, new_value);
4945
/* Prepares an argument vector before calling spawn().
4946
Note that spawn() does not by itself call the command interpreter
4947
(getenv ("COMSPEC") != NULL ? getenv ("COMSPEC") :
4948
({ OSVERSIONINFO v; v.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
4950
v.dwPlatformId == VER_PLATFORM_WIN32_NT;
4951
}) ? "cmd.exe" : "command.com").
4952
Instead it simply concatenates the arguments, separated by ' ', and calls
4953
CreateProcess(). We must quote the arguments since Win32 CreateProcess()
4954
interprets characters like ' ', '\t', '\\', '"' (but not '<' and '>') in a
4956
- Space and tab are interpreted as delimiters. They are not treated as
4957
delimiters if they are surrounded by double quotes: "...".
4958
- Unescaped double quotes are removed from the input. Their only effect is
4959
that within double quotes, space and tab are treated like normal
4961
- Backslashes not followed by double quotes are not special.
4962
- But 2*n+1 backslashes followed by a double quote become
4963
n backslashes followed by a double quote (n >= 0):
4968
#define SHELL_SPECIAL_CHARS "\"\\ \001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037"
4969
#define SHELL_SPACE_CHARS " \001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037"
4971
prepare_spawn (char **argv)
4977
/* Count number of arguments. */
4978
for (argc = 0; argv[argc] != NULL; argc++)
4981
/* Allocate new argument vector. */
4982
new_argv = XMALLOC (char *, argc + 1);
4984
/* Put quoted arguments into the new argument vector. */
4985
for (i = 0; i < argc; i++)
4987
const char *string = argv[i];
4989
if (string[0] == '\0')
4990
new_argv[i] = xstrdup ("\"\"");
4991
else if (strpbrk (string, SHELL_SPECIAL_CHARS) != NULL)
4993
int quote_around = (strpbrk (string, SHELL_SPACE_CHARS) != NULL);
4995
unsigned int backslashes;
4997
char *quoted_string;
5004
for (s = string; *s != '\0'; s++)
5008
length += backslashes + 1;
5016
length += backslashes + 1;
5018
quoted_string = XMALLOC (char, length + 1);
5024
for (s = string; *s != '\0'; s++)
5030
for (j = backslashes + 1; j > 0; j--)
5042
for (j = backslashes; j > 0; j--)
5048
new_argv[i] = quoted_string;
5051
new_argv[i] = (char *) string;
5053
new_argv[argc] = NULL;
5062
void lt_dump_script (FILE* f)
5065
func_emit_wrapper yes |
5067
s/^\(.\{79\}\)\(..*\)/\1\
5072
s/\([^\n]*\).*/ fputs ("\1", f);/p
5079
# end: func_emit_cwrapperexe_src
5081
# func_win32_import_lib_p ARG
5082
# True if ARG is an import lib, as indicated by $file_magic_cmd
5083
func_win32_import_lib_p ()
5086
case `eval $file_magic_cmd \"\$1\" 2>/dev/null | $SED -e 10q` in
5092
# func_mode_link arg...
1069
*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
5097
*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
1070
5098
# It is impossible to link a dll without this setting, and
1071
5099
# we shouldn't force the makefile maintainer to figure out
1072
5100
# which system we are compiling for in order to pass an extra
4831
8993
# Replace the output file specification.
4832
link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`
8994
link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`
4834
8996
# Delete the old output files.
4835
$run $rm $output $output_objdir/$outputname $output_objdir/lt-$outputname
4837
$show "$link_command"
4838
$run eval "$link_command" || exit $?
8997
$opt_dry_run || $RM $output $output_objdir/$outputname $output_objdir/lt-$outputname
8999
func_show_eval "$link_command" 'exit $?'
9001
if test -n "$postlink_cmds"; then
9002
func_to_tool_file "$output_objdir/$outputname"
9003
postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'`
9004
func_execute_cmds "$postlink_cmds" 'exit $?'
4840
9007
# Now create the wrapper script.
4841
$show "creating $output"
9008
func_verbose "creating $output"
4843
9010
# Quote the relink command for shipping.
4844
9011
if test -n "$relink_command"; then
4845
9012
# Preserve any variables that may affect compiler behavior
4846
9013
for var in $variables_saved_for_relink; do
4847
9014
if eval test -z \"\${$var+set}\"; then
4848
relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command"
9015
relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command"
4849
9016
elif eval var_value=\$$var; test -z "$var_value"; then
4850
9017
relink_command="$var=; 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"
9019
func_quote_for_eval "$var_value"
9020
relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command"
4856
9023
relink_command="(cd `pwd`; $relink_command)"
4857
relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"`
4860
# Quote $echo for shipping.
4861
if test "X$echo" = "X$SHELL $progpath --fallback-echo"; then
4863
[\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $progpath --fallback-echo";;
4864
*) qecho="$SHELL `pwd`/$progpath --fallback-echo";;
4866
qecho=`$echo "X$qecho" | $Xsed -e "$sed_quote_subst"`
4868
qecho=`$echo "X$echo" | $Xsed -e "$sed_quote_subst"`
4871
# Only actually do things if our run command is non-null.
4872
if test -z "$run"; then
9024
relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"`
9027
# Only actually do things if not in dry run mode.
4873
9029
# win32 will think the script is a binary if it has
4874
9030
# a .exe suffix, so we strip it off here.
4875
9031
case $output in
4876
*.exe) output=`$echo $output|${SED} 's,.exe$,,'` ;;
9032
*.exe) func_stripname '' '.exe' "$output"
9033
output=$func_stripname_result ;;
4878
9035
# test for cygwin because mv fails w/o .exe extensions
4882
outputname=`$echo $outputname|${SED} 's,.exe$,,'` ;;
9039
func_stripname '' '.exe' "$outputname"
9040
outputname=$func_stripname_result ;;
4886
9044
*cygwin* | *mingw* )
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))
9045
func_dirname_and_basename "$output" "" "."
9046
output_name=$func_basename_result
9047
output_path=$func_dirname_result
9048
cwrappersource="$output_path/$objdir/lt-$output_name.c"
9049
cwrapper="$output_path/$output_name.exe"
9050
$RM $cwrappersource $cwrapper
9051
trap "$RM $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15
9053
func_emit_cwrapperexe_src > $cwrappersource
9055
# The wrapper executable is built using the $host compiler,
9056
# because it contains $host paths and files. If cross-
9057
# compiling, it, like the target executable, must be
9058
# executed on the $host or under an emulation environment.
9060
$LTCC $LTCFLAGS -o $cwrapper $cwrappersource
9064
# Now, create the wrapper script for func_source use:
9065
func_ltwrapper_scriptname $cwrapper
9066
$RM $func_ltwrapper_scriptname_result
9067
trap "$RM $func_ltwrapper_scriptname_result; exit $EXIT_FAILURE" 1 2 15
9069
# note: this script will not be executed, so do not chmod.
9070
if test "x$build" = "x$host" ; then
9071
$cwrapper --lt-dump-script > $func_ltwrapper_scriptname_result
9073
func_emit_wrapper no > $func_ltwrapper_scriptname_result
9079
trap "$RM $output; exit $EXIT_FAILURE" 1 2 15
9081
func_emit_wrapper no > $output
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
5420
9086
exit $EXIT_SUCCESS
5705
9426
# Directory that this library needs to be installed in:
5706
9427
libdir='$install_libdir'"
5707
9428
if test "$installed" = no && test "$need_relink" = yes; then
5709
9430
relink_command=\"$relink_command\""
5714
9435
# Do a symbolic link so that the libtool archive can be found in
5715
9436
# LD_LIBRARY_PATH before the program is installed.
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"
9437
func_show_eval '( cd "$output_objdir" && $RM "$outputname" && $LN_S "../$outputname" "$outputname" )' 'exit $?'
9443
{ test "$opt_mode" = link || test "$opt_mode" = relink; } &&
9444
func_mode_link ${1+"$@"}
9447
# func_mode_uninstall arg...
9448
func_mode_uninstall ()