170
383
my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null`
172
385
if test ! -d "$my_tmpdir"; then
173
# Failing that, at least try and use $RANDOM to avoid a race
174
my_tmpdir="${my_template}-${RANDOM-0}$$"
386
# Failing that, at least try and use $RANDOM to avoid a race
387
my_tmpdir="${my_template}-${RANDOM-0}$$"
176
save_mktempdir_umask=`umask`
179
umask $save_mktempdir_umask
389
save_mktempdir_umask=`umask`
392
umask $save_mktempdir_umask
182
395
# If we're not in dry-run mode, bomb out on failure
183
test -d "$my_tmpdir" || {
184
$echo "cannot create temporary directory \`$my_tmpdir'" 1>&2
189
$echo "X$my_tmpdir" | $Xsed
193
# func_win32_libid arg
194
# return the library type of file 'arg'
196
# Need a lot of goo to handle *both* DLLs and import libs
197
# Has to be a shell function in order to 'eat' the argument
198
# that is supplied when $file_magic_command is called.
201
win32_libid_type="unknown"
202
win32_fileres=`file -L $1 2>/dev/null`
203
case $win32_fileres in
204
*ar\ archive\ import\ library*) # definitely import
205
win32_libid_type="x86 archive import"
207
*ar\ archive*) # could be an import, or static
208
if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | \
209
$EGREP -e 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then
210
win32_nmres=`eval $NM -f posix -A $1 | \
219
import*) win32_libid_type="x86 archive import";;
220
*) win32_libid_type="x86 archive static";;
225
win32_libid_type="x86 DLL"
227
*executable*) # but shell scripts are "executable" too...
228
case $win32_fileres in
229
*MS\ Windows\ PE\ Intel*)
230
win32_libid_type="x86 DLL"
235
$echo $win32_libid_type
396
test -d "$my_tmpdir" || \
397
func_fatal_error "cannot create temporary directory \`$my_tmpdir'"
404
# func_quote_for_eval arg
405
# Aesthetically quote ARG to be evaled later.
406
# This function returns two values: FUNC_QUOTE_FOR_EVAL_RESULT
407
# is double-quoted, suitable for a subsequent eval, whereas
408
# FUNC_QUOTE_FOR_EVAL_UNQUOTED_RESULT has merely all characters
409
# which are still active within double quotes backslashified.
410
func_quote_for_eval ()
414
func_quote_for_eval_unquoted_result=`$ECHO "$1" | $SED "$sed_quote_subst"` ;;
416
func_quote_for_eval_unquoted_result="$1" ;;
419
case $func_quote_for_eval_unquoted_result in
420
# Double-quote args containing shell metacharacters to delay
421
# word splitting, command substitution and and variable
422
# expansion for a subsequent eval.
423
# Many Bourne shells cannot handle close brackets correctly
424
# in scan sets, so we specify it separately.
425
*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
426
func_quote_for_eval_result="\"$func_quote_for_eval_unquoted_result\""
429
func_quote_for_eval_result="$func_quote_for_eval_unquoted_result"
434
# func_quote_for_expand arg
435
# Aesthetically quote ARG to be evaled later; same as above,
436
# but do not quote variable references.
437
func_quote_for_expand ()
441
my_arg=`$ECHO "$1" | $SED \
442
-e "$double_quote_subst" -e "$sed_double_backslash"` ;;
448
# Double-quote args containing shell metacharacters to delay
449
# word splitting and command substitution for a subsequent eval.
450
# Many Bourne shells cannot handle close brackets correctly
451
# in scan sets, so we specify it separately.
452
*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
457
func_quote_for_expand_result="$my_arg"
461
# func_show_eval cmd [fail_exp]
462
# Unless opt_silent is true, then output CMD. Then, if opt_dryrun is
463
# not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP
464
# is given, then evaluate it.
470
${opt_silent-false} || {
471
func_quote_for_expand "$my_cmd"
472
eval "func_echo $func_quote_for_expand_result"
475
if ${opt_dry_run-false}; then :; else
478
if test "$my_status" -eq 0; then :; else
479
eval "(exit $my_status); $my_fail_exp"
485
# func_show_eval_locale cmd [fail_exp]
486
# Unless opt_silent is true, then output CMD. Then, if opt_dryrun is
487
# not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP
488
# is given, then evaluate it. Use the saved locale for evaluation.
489
func_show_eval_locale ()
494
${opt_silent-false} || {
495
func_quote_for_expand "$my_cmd"
496
eval "func_echo $func_quote_for_expand_result"
499
if ${opt_dry_run-false}; then :; else
500
eval "$lt_user_locale
503
eval "$lt_safe_locale"
504
if test "$my_status" -eq 0; then :; else
505
eval "(exit $my_status); $my_fail_exp"
515
# Echo version message to standard output and exit.
526
/^# '$PROGRAM' (GNU /,/# warranty; / {
529
s/\((C)\)[ 0-9,-]*\( [1-9][0-9]*\)/\1\2/
536
# Echo short help message to standard output and exit.
539
$SED -n '/^# Usage:/,/^# *-h/ {
542
s/\$progname/'$progname'/
546
$ECHO "run \`$progname --help | more' for full usage"
551
# Echo long help message to standard output and exit,
552
# unless 'noexit' is passed as argument.
555
$SED -n '/^# Usage:/,/# Report bugs to/ {
558
s*\$progname*'$progname'*
560
s*\$SHELL*'"$SHELL"'*
562
s*\$LTCFLAGS*'"$LTCFLAGS"'*
564
s/\$with_gnu_ld/'"$with_gnu_ld"'/
565
s/\$automake_version/'"`(automake --version) 2>/dev/null |$SED 1q`"'/
566
s/\$autoconf_version/'"`(autoconf --version) 2>/dev/null |$SED 1q`"'/
570
if test -z "$1"; then
575
# func_missing_arg argname
576
# Echo program name prefixed message to standard error and set global
580
func_error "missing argument for $1"
591
magic="%%%MAGIC variable%%%"
592
magic_exe="%%%MAGIC EXE variable%%%"
599
lo2o="s/\\.lo\$/.${objext}/"
600
o2lo="s/\\.${objext}\$/.lo/"
605
opt_duplicate_deps=false
609
# If this variable is set in any of the actions, the command in it
610
# will be execed at the end. This prevents here-documents from being
611
# left over by shells.
614
# func_fatal_configuration arg...
615
# Echo program name prefixed message to standard error, followed by
616
# a configuration failure hint, and exit.
617
func_fatal_configuration ()
620
func_error "See the $PACKAGE documentation for more information."
621
func_fatal_error "Fatal configuration error."
626
# Display the configuration for all the tags in this script.
629
re_begincf='^# ### BEGIN LIBTOOL'
630
re_endcf='^# ### END LIBTOOL'
632
# Default configuration.
633
$SED "1,/$re_begincf CONFIG/d;/$re_endcf CONFIG/,\$d" < "$progpath"
635
# Now print the configurations for the tags.
636
for tagname in $taglist; do
637
$SED -n "/$re_begincf TAG CONFIG: $tagname\$/,/$re_endcf TAG CONFIG: $tagname\$/p" < "$progpath"
644
# Display the features supported by this script.
648
if test "$build_libtool_libs" = yes; then
649
echo "enable shared libraries"
651
echo "disable shared libraries"
653
if test "$build_old_libs" = yes; then
654
echo "enable static libraries"
656
echo "disable static libraries"
662
# func_enable_tag tagname
663
# Verify that TAGNAME is valid, and either flag an error and exit, or
664
# enable the TAGNAME tag. We also add TAGNAME to the global $taglist
671
re_begincf="^# ### BEGIN LIBTOOL TAG CONFIG: $tagname\$"
672
re_endcf="^# ### END LIBTOOL TAG CONFIG: $tagname\$"
673
sed_extractcf="/$re_begincf/,/$re_endcf/p"
678
func_fatal_error "invalid tag name: $tagname"
682
# Don't test for the "default" C tag, as we know it's
683
# there but not specially marked.
687
if $GREP "$re_begincf" "$progpath" >/dev/null 2>&1; then
688
taglist="$taglist $tagname"
690
# Evaluate the configuration. Be careful to quote the path
691
# and the sed script, to avoid splitting on whitespace, but
692
# also don't use non-portable quotes within backquotes within
693
# quotes we have to do it in 2 steps:
694
extractedcf=`$SED -n -e "$sed_extractcf" < "$progpath"`
697
func_error "ignoring unknown tag $tagname"
703
# Parse options once, thoroughly. This comes as soon as possible in
704
# the script to make things like `libtool --version' happen quickly.
707
# Shorthand for --mode=foo, only valid as the first argument
710
shift; set dummy --mode clean ${1+"$@"}; shift
712
compile|compil|compi|comp|com|co|c)
713
shift; set dummy --mode compile ${1+"$@"}; shift
715
execute|execut|execu|exec|exe|ex|e)
716
shift; set dummy --mode execute ${1+"$@"}; shift
718
finish|finis|fini|fin|fi|f)
719
shift; set dummy --mode finish ${1+"$@"}; shift
721
install|instal|insta|inst|ins|in|i)
722
shift; set dummy --mode install ${1+"$@"}; shift
725
shift; set dummy --mode link ${1+"$@"}; shift
727
uninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u)
728
shift; set dummy --mode uninstall ${1+"$@"}; shift
732
# Parse non-mode specific arguments:
733
while test "$#" -gt 0; do
738
--config) func_config ;;
740
--debug) preserve_args="$preserve_args $opt"
741
func_echo "enabling shell trace mode"
746
-dlopen) test "$#" -eq 0 && func_missing_arg "$opt" && break
747
execute_dlfiles="$execute_dlfiles $1"
751
--dry-run | -n) opt_dry_run=: ;;
752
--features) func_features ;;
753
--finish) mode="finish" ;;
755
--mode) test "$#" -eq 0 && func_missing_arg "$opt" && break
757
# Valid mode arguments:
767
# Catch anything else as an error
768
*) func_error "invalid argument for $opt"
779
opt_duplicate_deps=: ;;
781
--quiet|--silent) preserve_args="$preserve_args $opt"
786
--no-quiet|--no-silent)
787
preserve_args="$preserve_args $opt"
791
--verbose| -v) preserve_args="$preserve_args $opt"
796
--no-verbose) preserve_args="$preserve_args $opt"
800
--tag) test "$#" -eq 0 && func_missing_arg "$opt" && break
801
preserve_args="$preserve_args $opt $1"
802
func_enable_tag "$1" # tagname is set here
806
# Separate optargs to long options:
807
-dlopen=*|--mode=*|--tag=*)
808
func_opt_split "$opt"
809
set dummy "$func_opt_split_opt" "$func_opt_split_arg" ${1+"$@"}
813
-\?|-h) func_usage ;;
814
--help) opt_help=: ;;
815
--help-all) opt_help=': help-all' ;;
816
--version) func_version ;;
818
-*) func_fatal_help "unrecognized option \`$opt'" ;;
828
*cygwin* | *mingw* | *pw32* | *cegcc*)
829
# don't eliminate duplications in $postdeps and $predeps
830
opt_duplicate_compiler_generated_deps=:
833
opt_duplicate_compiler_generated_deps=$opt_duplicate_deps
837
# Having warned about all mis-specified options, bail out if
838
# anything was wrong.
839
$exit_cmd $EXIT_FAILURE
842
# func_check_version_match
843
# Ensure that we are using m4 macros, and libtool script from the same
844
# release of libtool.
845
func_check_version_match ()
847
if test "$package_revision" != "$macro_revision"; then
848
if test "$VERSION" != "$macro_version"; then
849
if test -z "$macro_version"; then
851
$progname: Version mismatch error. This is $PACKAGE $VERSION, but the
852
$progname: definition of this LT_INIT comes from an older release.
853
$progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION
854
$progname: and run autoconf again.
858
$progname: Version mismatch error. This is $PACKAGE $VERSION, but the
859
$progname: definition of this LT_INIT comes from $PACKAGE $macro_version.
860
$progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION
861
$progname: and run autoconf again.
866
$progname: Version mismatch error. This is $PACKAGE $VERSION, revision $package_revision,
867
$progname: but the definition of this LT_INIT comes from revision $macro_revision.
868
$progname: You should recreate aclocal.m4 with macros from revision $package_revision
869
$progname: of $PACKAGE $VERSION and run autoconf again.
883
# Sanity checks first:
884
func_check_version_match
886
if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
887
func_fatal_configuration "not configured to build any kind of library"
890
test -z "$mode" && func_fatal_error "error: you must specify a MODE."
894
eval std_shrext=\"$shrext_cmds\"
897
# Only execute mode is allowed to have -dlopen flags.
898
if test -n "$execute_dlfiles" && test "$mode" != execute; then
899
func_error "unrecognized option \`-dlopen'"
904
# Change the help message to a mode-specific one.
906
help="Try \`$progname --help --mode=$mode' for more information."
911
# True iff FILE is a libtool `.la' library or `.lo' object file.
912
# This function is only a basic sanity check; it will hardly flush out
913
# determined imposters.
917
$SED -e 4q "$1" 2>/dev/null \
918
| $GREP "^# Generated by .*$PACKAGE" > /dev/null 2>&1
921
# func_lalib_unsafe_p file
922
# True iff FILE is a libtool `.la' library or `.lo' object file.
923
# This function implements the same check as func_lalib_p without
924
# resorting to external programs. To this end, it redirects stdin and
925
# closes it afterwards, without saving the original file descriptor.
926
# As a safety measure, use it only where a negative result would be
927
# fatal anyway. Works if `file' does not exist.
928
func_lalib_unsafe_p ()
931
if test -f "$1" && test -r "$1" && exec 5<&0 <"$1"; then
932
for lalib_p_l in 1 2 3 4
935
case "$lalib_p_line" in
936
\#\ Generated\ by\ *$PACKAGE* ) lalib_p=yes; break;;
941
test "$lalib_p" = yes
944
# func_ltwrapper_script_p file
945
# True iff FILE is a libtool wrapper script
946
# This function is only a basic sanity check; it will hardly flush out
947
# determined imposters.
948
func_ltwrapper_script_p ()
953
# func_ltwrapper_executable_p file
954
# True iff FILE is a libtool wrapper executable
955
# This function is only a basic sanity check; it will hardly flush out
956
# determined imposters.
957
func_ltwrapper_executable_p ()
959
func_ltwrapper_exec_suffix=
962
*) func_ltwrapper_exec_suffix=.exe ;;
964
$GREP "$magic_exe" "$1$func_ltwrapper_exec_suffix" >/dev/null 2>&1
967
# func_ltwrapper_scriptname file
968
# Assumes file is an ltwrapper_executable
969
# uses $file to determine the appropriate filename for a
970
# temporary ltwrapper_script.
971
func_ltwrapper_scriptname ()
973
func_ltwrapper_scriptname_result=""
974
if func_ltwrapper_executable_p "$1"; then
975
func_dirname_and_basename "$1" "" "."
976
func_stripname '' '.exe' "$func_basename_result"
977
func_ltwrapper_scriptname_result="$func_dirname_result/$objdir/${func_stripname_result}_ltshwrapper"
981
# func_ltwrapper_p file
982
# True iff FILE is a libtool wrapper script or wrapper executable
983
# This function is only a basic sanity check; it will hardly flush out
984
# determined imposters.
987
func_ltwrapper_script_p "$1" || func_ltwrapper_executable_p "$1"
991
# func_execute_cmds commands fail_cmd
992
# Execute tilde-delimited COMMANDS.
993
# If FAIL_CMD is given, eval that upon failure.
994
# FAIL_CMD may read-access the current command in variable CMD!
998
save_ifs=$IFS; IFS='~'
1002
func_show_eval "$cmd" "${2-:}"
1009
# Source FILE, adding directory component if necessary.
1010
# Note that it is not necessary on cygwin/mingw to append a dot to
1011
# FILE even if both FILE and FILE.exe exist: automatic-append-.exe
1012
# behavior happens only for exec(3), not for open(2)! Also, sourcing
1013
# `FILE.' does not work on cygwin managed mounts.
1018
*/* | *\\*) . "$1" ;;
1050
1446
avoid parallel builds (make -j) in this platform, or get a better
1053
$run $rm $removelist
1449
$opt_dry_run || $RM $removelist
1054
1450
exit $EXIT_FAILURE
1057
1453
# Just move the object if needed
1058
1454
if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then
1059
$show "$mv $output_obj $obj"
1060
if $run $mv $output_obj $obj; then :
1063
$run $rm $removelist
1068
# Append the name of the non-PIC object the libtool object file.
1069
# Only append if the libtool object file exists.
1070
test -z "$run" && cat >> ${libobj}T <<EOF
1071
# Name of the non-PIC object.
1072
non_pic_object='$objname'
1076
# Append the name of the non-PIC object the libtool object file.
1077
# Only append if the libtool object file exists.
1078
test -z "$run" && cat >> ${libobj}T <<EOF
1079
# Name of the non-PIC object.
1085
$run $mv "${libobj}T" "${libobj}"
1087
# Unlock the critical section if it was locked
1088
if test "$need_locks" != no; then
1089
$run $rm "$lockfile"
1097
modename="$modename: link"
1099
*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
1455
func_show_eval '$MV "$output_obj" "$obj"' \
1456
'error=$?; $opt_dry_run || $RM $removelist; exit $error'
1461
func_write_libtool_object "$libobj" "$objdir/$objname" "$objname"
1463
# Unlock the critical section if it was locked
1464
if test "$need_locks" != no; then
1465
removelist=$lockfile
1474
test "$mode" = compile && func_mode_compile ${1+"$@"}
1479
# We need to display help for each of the modes.
1482
# Generic help is extracted from the usage comments
1483
# at the start of this file.
1489
"Usage: $progname [OPTION]... --mode=clean RM [RM-OPTION]... FILE...
1491
Remove files from the build directory.
1493
RM is the name of the program to use to delete files associated with each FILE
1494
(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
1497
If FILE is a libtool library, object or program, all the files associated
1498
with it are deleted. Otherwise, only FILE itself is deleted using RM."
1503
"Usage: $progname [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE
1505
Compile a source file into a libtool library object.
1507
This mode accepts the following additional options:
1509
-o OUTPUT-FILE set the output file name to OUTPUT-FILE
1510
-no-suppress do not suppress compiler output for multiple passes
1511
-prefer-pic try to building PIC objects only
1512
-prefer-non-pic try to building non-PIC objects only
1513
-shared do not build a \`.o' file suitable for static linking
1514
-static only build a \`.o' file suitable for static linking
1515
-Wc,FLAG pass FLAG directly to the compiler
1517
COMPILE-COMMAND is a command to be used in creating a \`standard' object file
1518
from the given SOURCEFILE.
1520
The output file name is determined by removing the directory component from
1521
SOURCEFILE, then substituting the C source code suffix \`.c' with the
1522
library object suffix, \`.lo'."
1527
"Usage: $progname [OPTION]... --mode=execute COMMAND [ARGS]...
1529
Automatically set library path, then run a program.
1531
This mode accepts the following additional options:
1533
-dlopen FILE add the directory containing FILE to the library path
1535
This mode sets the library path environment variable according to \`-dlopen'
1538
If any of the ARGS are libtool executable wrappers, then they are translated
1539
into their corresponding uninstalled binary, and any of their required library
1540
directories are added to the library path.
1542
Then, COMMAND is executed, with ARGS as arguments."
1547
"Usage: $progname [OPTION]... --mode=finish [LIBDIR]...
1549
Complete the installation of libtool libraries.
1551
Each LIBDIR is a directory that contains libtool libraries.
1553
The commands that this mode executes may require superuser privileges. Use
1554
the \`--dry-run' option if you just want to see what would be executed."
1559
"Usage: $progname [OPTION]... --mode=install INSTALL-COMMAND...
1561
Install executables or libraries.
1563
INSTALL-COMMAND is the installation command. The first component should be
1564
either the \`install' or \`cp' program.
1566
The following components of INSTALL-COMMAND are treated specially:
1568
-inst-prefix-dir PREFIX-DIR Use PREFIX-DIR as a staging area for installation
1570
The rest of the components are interpreted as arguments to that command (only
1571
BSD-compatible install options are recognized)."
1576
"Usage: $progname [OPTION]... --mode=link LINK-COMMAND...
1578
Link object files or libraries together to form another library, or to
1579
create an executable program.
1581
LINK-COMMAND is a command using the C compiler that you would use to create
1582
a program from several object files.
1584
The following components of LINK-COMMAND are treated specially:
1586
-all-static do not do any dynamic linking at all
1587
-avoid-version do not add a version suffix if possible
1588
-dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime
1589
-dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols
1590
-export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
1591
-export-symbols SYMFILE
1592
try to export only the symbols listed in SYMFILE
1593
-export-symbols-regex REGEX
1594
try to export only the symbols matching REGEX
1595
-LLIBDIR search LIBDIR for required installed libraries
1596
-lNAME OUTPUT-FILE requires the installed library libNAME
1597
-module build a library that can dlopened
1598
-no-fast-install disable the fast-install mode
1599
-no-install link a not-installable executable
1600
-no-undefined declare that a library does not refer to external symbols
1601
-o OUTPUT-FILE create OUTPUT-FILE from the specified objects
1602
-objectlist FILE Use a list of object files found in FILE to specify objects
1603
-precious-files-regex REGEX
1604
don't remove output files matching REGEX
1605
-release RELEASE specify package release information
1606
-rpath LIBDIR the created library will eventually be installed in LIBDIR
1607
-R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries
1608
-shared only do dynamic linking of libtool libraries
1609
-shrext SUFFIX override the standard shared library file extension
1610
-static do not do any dynamic linking of uninstalled libtool libraries
1611
-static-libtool-libs
1612
do not do any dynamic linking of libtool libraries
1613
-version-info CURRENT[:REVISION[:AGE]]
1614
specify library version info [each variable defaults to 0]
1615
-weak LIBNAME declare that the target provides the LIBNAME interface
1617
-Xcompiler FLAG pass linker-specific FLAG directly to the compiler
1619
-Xlinker FLAG pass linker-specific FLAG directly to the linker
1620
-XCClinker FLAG pass link-specific FLAG to the compiler driver (CC)
1622
All other options (arguments beginning with \`-') are ignored.
1624
Every other argument is treated as a filename. Files ending in \`.la' are
1625
treated as uninstalled libtool libraries, other files are standard or library
1628
If the OUTPUT-FILE ends in \`.la', then a libtool library is created,
1629
only library objects (\`.lo' files) may be specified, and \`-rpath' is
1630
required, except when creating a convenience library.
1632
If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created
1633
using \`ar' and \`ranlib', or on Windows using \`lib'.
1635
If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file
1636
is created, otherwise an executable program is created."
1641
"Usage: $progname [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE...
1643
Remove libraries from an installation directory.
1645
RM is the name of the program to use to delete files associated with each FILE
1646
(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
1649
If FILE is a libtool library, all the files associated with it are deleted.
1650
Otherwise, only FILE itself is deleted using RM."
1654
func_fatal_help "invalid operation mode \`$mode'"
1659
$ECHO "Try \`$progname --help' for more information about other modes."
1662
# Now that we've collected a possible --mode arg, show help if necessary
1664
if test "$opt_help" = :; then
1669
for mode in compile link execute install finish uninstall clean; do
1672
} | sed -n '1p; 2,$s/^Usage:/ or: /p'
1675
for mode in compile link execute install finish uninstall clean; do
1681
/^When reporting/,/^Report/{
1686
/information about other modes/d
1687
/more detailed .*MODE/d
1688
s/^Usage:.*--mode=\([^ ]*\) .*/Description of \1 mode:/'
1694
# func_mode_execute arg...
1695
func_mode_execute ()
1698
# The first argument is the command name.
1701
func_fatal_help "you must specify a COMMAND"
1703
# Handle -dlopen flags immediately.
1704
for file in $execute_dlfiles; do
1706
|| func_fatal_help "\`$file' is not a file"
1711
# Check to see that this really is a libtool archive.
1712
func_lalib_unsafe_p "$file" \
1713
|| func_fatal_help "\`$lib' is not a valid libtool archive"
1715
# Read the libtool library.
1720
# Skip this library if it cannot be dlopened.
1721
if test -z "$dlname"; then
1722
# Warn if it was a shared library.
1723
test -n "$library_names" && \
1724
func_warning "\`$file' was not linked with \`-export-dynamic'"
1728
func_dirname "$file" "" "."
1729
dir="$func_dirname_result"
1731
if test -f "$dir/$objdir/$dlname"; then
1734
if test ! -f "$dir/$dlname"; then
1735
func_fatal_error "cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'"
1741
# Just add the directory containing the .lo file.
1742
func_dirname "$file" "" "."
1743
dir="$func_dirname_result"
1747
func_warning "\`-dlopen' is ignored for non-libtool libraries and objects"
1752
# Get the absolute pathname.
1753
absdir=`cd "$dir" && pwd`
1754
test -n "$absdir" && dir="$absdir"
1756
# Now add the directory to shlibpath_var.
1757
if eval "test -z \"\$$shlibpath_var\""; then
1758
eval "$shlibpath_var=\"\$dir\""
1760
eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\""
1764
# This variable tells wrapper scripts just to set shlibpath_var
1765
# rather than running their programs.
1766
libtool_execute_magic="$magic"
1768
# Check if any of the arguments is a wrapper script.
1773
-* | *.la | *.lo ) ;;
1775
# Do a test to see if this is really a libtool program.
1776
if func_ltwrapper_script_p "$file"; then
1778
# Transform arg to wrapped name.
1779
file="$progdir/$program"
1780
elif func_ltwrapper_executable_p "$file"; then
1781
func_ltwrapper_scriptname "$file"
1782
func_source "$func_ltwrapper_scriptname_result"
1783
# Transform arg to wrapped name.
1784
file="$progdir/$program"
1788
# Quote arguments (to preserve shell metacharacters).
1789
func_quote_for_eval "$file"
1790
args="$args $func_quote_for_eval_result"
1793
if test "X$opt_dry_run" = Xfalse; then
1794
if test -n "$shlibpath_var"; then
1795
# Export the shlibpath_var.
1796
eval "export $shlibpath_var"
1799
# Restore saved environment variables
1800
for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
1802
eval "if test \"\${save_$lt_var+set}\" = set; then
1803
$lt_var=\$save_$lt_var; export $lt_var
1809
# Now prepare to actually exec the command.
1810
exec_cmd="\$cmd$args"
1812
# Display what would be done.
1813
if test -n "$shlibpath_var"; then
1814
eval "\$ECHO \"\$shlibpath_var=\$$shlibpath_var\""
1815
echo "export $shlibpath_var"
1822
test "$mode" = execute && func_mode_execute ${1+"$@"}
1825
# func_mode_finish arg...
1832
if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
1835
libdirs="$libdirs $dir"
1838
for libdir in $libdirs; do
1839
if test -n "$finish_cmds"; then
1840
# Do each command in the finish commands.
1841
func_execute_cmds "$finish_cmds" 'admincmds="$admincmds
1844
if test -n "$finish_eval"; then
1845
# Do the single finish_eval.
1846
eval cmds=\"$finish_eval\"
1847
$opt_dry_run || eval "$cmds" || admincmds="$admincmds
1853
# Exit here if they wanted silent mode.
1854
$opt_silent && exit $EXIT_SUCCESS
1856
echo "----------------------------------------------------------------------"
1857
echo "Libraries have been installed in:"
1858
for libdir in $libdirs; do
1862
echo "If you ever happen to want to link against installed libraries"
1863
echo "in a given directory, LIBDIR, you must either use libtool, and"
1864
echo "specify the full pathname of the library, or use the \`-LLIBDIR'"
1865
echo "flag during linking and do at least one of the following:"
1866
if test -n "$shlibpath_var"; then
1867
echo " - add LIBDIR to the \`$shlibpath_var' environment variable"
1868
echo " during execution"
1870
if test -n "$runpath_var"; then
1871
echo " - add LIBDIR to the \`$runpath_var' environment variable"
1872
echo " during linking"
1874
if test -n "$hardcode_libdir_flag_spec"; then
1876
eval flag=\"$hardcode_libdir_flag_spec\"
1878
$ECHO " - use the \`$flag' linker flag"
1880
if test -n "$admincmds"; then
1881
$ECHO " - have your system administrator run these commands:$admincmds"
1883
if test -f /etc/ld.so.conf; then
1884
echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'"
1888
echo "See any operating system documentation about shared libraries for"
1890
solaris2.[6789]|solaris2.1[0-9])
1891
echo "more information, such as the ld(1), crle(1) and ld.so(8) manual"
1895
echo "more information, such as the ld(1) and ld.so(8) manual pages."
1898
echo "----------------------------------------------------------------------"
1902
test "$mode" = finish && func_mode_finish ${1+"$@"}
1905
# func_mode_install arg...
1906
func_mode_install ()
1909
# There may be an optional sh(1) argument at the beginning of
1910
# install_prog (especially on Windows NT).
1911
if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh ||
1912
# Allow the use of GNU shtool's install command.
1913
case $nonopt in *shtool*) :;; *) false;; esac; then
1914
# Aesthetically quote it.
1915
func_quote_for_eval "$nonopt"
1916
install_prog="$func_quote_for_eval_result "
1924
# The real first argument should be the name of the installation program.
1925
# Aesthetically quote it.
1926
func_quote_for_eval "$arg"
1927
install_prog="$install_prog$func_quote_for_eval_result"
1928
install_shared_prog=$install_prog
1929
case " $install_prog " in
1930
*[\\\ /]cp\ *) install_cp=: ;;
1931
*) install_cp=false ;;
1934
# We need to accept at least all the BSD install flags.
1946
if test -n "$dest"; then
1947
files="$files $dest"
1955
if $install_cp; then :; else
1969
# If the previous option needed an argument, then skip it.
1970
if test -n "$prev"; then
1971
if test "x$prev" = x-m && test -n "$install_override_mode"; then
1972
arg2=$install_override_mode
1983
# Aesthetically quote the argument.
1984
func_quote_for_eval "$arg"
1985
install_prog="$install_prog $func_quote_for_eval_result"
1986
if test -n "$arg2"; then
1987
func_quote_for_eval "$arg2"
1989
install_shared_prog="$install_shared_prog $func_quote_for_eval_result"
1992
test -z "$install_prog" && \
1993
func_fatal_help "you must specify an install program"
1995
test -n "$prev" && \
1996
func_fatal_help "the \`$prev' option requires an argument"
1998
if test -n "$install_override_mode" && $no_mode; then
1999
if $install_cp; then :; else
2000
func_quote_for_eval "$install_override_mode"
2001
install_shared_prog="$install_shared_prog -m $func_quote_for_eval_result"
2005
if test -z "$files"; then
2006
if test -z "$dest"; then
2007
func_fatal_help "no file or destination specified"
2009
func_fatal_help "you must specify a destination"
2013
# Strip any trailing slash from the destination.
2014
func_stripname '' '/' "$dest"
2015
dest=$func_stripname_result
2017
# Check to see that the destination is a directory.
2018
test -d "$dest" && isdir=yes
2019
if test "$isdir" = yes; then
2023
func_dirname_and_basename "$dest" "" "."
2024
destdir="$func_dirname_result"
2025
destname="$func_basename_result"
2027
# Not a directory, so check to see that there is only one file specified.
2028
set dummy $files; shift
2029
test "$#" -gt 1 && \
2030
func_fatal_help "\`$dest' is not a directory"
2033
[\\/]* | [A-Za-z]:[\\/]*) ;;
2035
for file in $files; do
2039
func_fatal_help "\`$destdir' must be an absolute directory name"
2046
# This variable tells wrapper scripts just to set variables rather
2047
# than running their programs.
2048
libtool_install_magic="$magic"
2053
for file in $files; do
2055
# Do each installation.
2058
# Do the static libraries later.
2059
staticlibs="$staticlibs $file"
2063
# Check to see that this really is a libtool archive.
2064
func_lalib_unsafe_p "$file" \
2065
|| func_fatal_help "\`$file' is not a valid libtool archive"
2072
# Add the libdir to current_libdirs if it is the destination.
2073
if test "X$destdir" = "X$libdir"; then
2074
case "$current_libdirs " in
2076
*) current_libdirs="$current_libdirs $libdir" ;;
2079
# Note the libdir as a future libdir.
2080
case "$future_libdirs " in
2082
*) future_libdirs="$future_libdirs $libdir" ;;
2086
func_dirname "$file" "/" ""
2087
dir="$func_dirname_result"
2090
if test -n "$relink_command"; then
2091
# Determine the prefix the user has applied to our future dir.
2092
inst_prefix_dir=`$ECHO "$destdir" | $SED -e "s%$libdir\$%%"`
2094
# Don't allow the user to place us outside of our expected
2095
# location b/c this prevents finding dependent libraries that
2096
# are installed to the same prefix.
2097
# At present, this check doesn't affect windows .dll's that
2098
# are installed into $libdir/../bin (currently, that works fine)
2099
# but it's something to keep an eye on.
2100
test "$inst_prefix_dir" = "$destdir" && \
2101
func_fatal_error "error: cannot install \`$file' to a directory not ending in $libdir"
2103
if test -n "$inst_prefix_dir"; then
2104
# Stick the inst_prefix_dir data into the link command.
2105
relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"`
2107
relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%%"`
2110
func_warning "relinking \`$file'"
2111
func_show_eval "$relink_command" \
2112
'func_fatal_error "error: relink \`$file'\'' with the above command before installing it"'
2115
# See the names of the shared library.
2116
set dummy $library_names; shift
2117
if test -n "$1"; then
2122
test -n "$relink_command" && srcname="$realname"T
2124
# Install the shared library and build the symlinks.
2125
func_show_eval "$install_shared_prog $dir/$srcname $destdir/$realname" \
2129
cygwin* | mingw* | pw32* | cegcc*)
2137
if test -n "$tstripme" && test -n "$striplib"; then
2138
func_show_eval "$striplib $destdir/$realname" 'exit $?'
2141
if test "$#" -gt 0; then
2142
# Delete the old symlinks, and create new ones.
2143
# Try `ln -sf' first, because the `ln' binary might depend on
2144
# the symlink we replace! Solaris /bin/ln does not understand -f,
2145
# so we also need to try rm && ln -s.
2148
test "$linkname" != "$realname" \
2149
&& func_show_eval "(cd $destdir && { $LN_S -f $realname $linkname || { $RM $linkname && $LN_S $realname $linkname; }; })"
2153
# Do each command in the postinstall commands.
2154
lib="$destdir/$realname"
2155
func_execute_cmds "$postinstall_cmds" 'exit $?'
2158
# Install the pseudo-library for information purposes.
2159
func_basename "$file"
2160
name="$func_basename_result"
2161
instname="$dir/$name"i
2162
func_show_eval "$install_prog $instname $destdir/$name" 'exit $?'
2164
# Maybe install the static library, too.
2165
test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library"
2169
# Install (i.e. copy) a libtool object.
2171
# Figure out destination file name, if it wasn't already specified.
2172
if test -n "$destname"; then
2173
destfile="$destdir/$destname"
2175
func_basename "$file"
2176
destfile="$func_basename_result"
2177
destfile="$destdir/$destfile"
2180
# Deduce the name of the destination old-style object file.
2183
func_lo2o "$destfile"
2184
staticdest=$func_lo2o_result
2187
staticdest="$destfile"
2191
func_fatal_help "cannot copy a libtool object to \`$destfile'"
2195
# Install the libtool object if requested.
2196
test -n "$destfile" && \
2197
func_show_eval "$install_prog $file $destfile" 'exit $?'
2199
# Install the old object if enabled.
2200
if test "$build_old_libs" = yes; then
2201
# Deduce the name of the old-style object file.
2203
staticobj=$func_lo2o_result
2204
func_show_eval "$install_prog \$staticobj \$staticdest" 'exit $?'
2210
# Figure out destination file name, if it wasn't already specified.
2211
if test -n "$destname"; then
2212
destfile="$destdir/$destname"
2214
func_basename "$file"
2215
destfile="$func_basename_result"
2216
destfile="$destdir/$destfile"
2219
# If the file is missing, and there is a .exe on the end, strip it
2220
# because it is most likely a libtool script we actually want to
2225
if test ! -f "$file"; then
2226
func_stripname '' '.exe' "$file"
2227
file=$func_stripname_result
2233
# Do a test to see if this is really a libtool program.
2236
if func_ltwrapper_executable_p "$file"; then
2237
func_ltwrapper_scriptname "$file"
2238
wrapper=$func_ltwrapper_scriptname_result
2240
func_stripname '' '.exe' "$file"
2241
wrapper=$func_stripname_result
2248
if func_ltwrapper_script_p "$wrapper"; then
2252
func_source "$wrapper"
2254
# Check the variables that should have been set.
2255
test -z "$generated_by_libtool_version" && \
2256
func_fatal_error "invalid libtool wrapper script \`$wrapper'"
2259
for lib in $notinst_deplibs; do
2260
# Check to see that each library is installed.
2262
if test -f "$lib"; then
2265
libfile="$libdir/"`$ECHO "$lib" | $SED 's%^.*/%%g'` ### testsuite: skip nested quoting test
2266
if test -n "$libdir" && test ! -f "$libfile"; then
2267
func_warning "\`$lib' has not been installed in \`$libdir'"
2273
func_source "$wrapper"
2276
if test "$fast_install" = no && test -n "$relink_command"; then
2278
if test "$finalize" = yes; then
2279
tmpdir=`func_mktempdir`
2280
func_basename "$file$stripped_ext"
2281
file="$func_basename_result"
2282
outputname="$tmpdir/$file"
2283
# Replace the output file specification.
2284
relink_command=`$ECHO "$relink_command" | $SED 's%@OUTPUT@%'"$outputname"'%g'`
2287
func_quote_for_expand "$relink_command"
2288
eval "func_echo $func_quote_for_expand_result"
2290
if eval "$relink_command"; then :
2292
func_error "error: relink \`$file' with the above command before installing it"
2293
$opt_dry_run || ${RM}r "$tmpdir"
2298
func_warning "cannot relink \`$file'"
2302
# Install the binary that we compiled earlier.
2303
file=`$ECHO "$file$stripped_ext" | $SED "s%\([^/]*\)$%$objdir/\1%"`
2307
# remove .exe since cygwin /usr/bin/install will append another
2309
case $install_prog,$host in
2310
*/usr/bin/install*,*cygwin*)
2311
case $file:$destfile in
2316
destfile=$destfile.exe
2319
func_stripname '' '.exe' "$destfile"
2320
destfile=$func_stripname_result
2325
func_show_eval "$install_prog\$stripme \$file \$destfile" 'exit $?'
2326
$opt_dry_run || if test -n "$outputname"; then
2333
for file in $staticlibs; do
2334
func_basename "$file"
2335
name="$func_basename_result"
2337
# Set up the ranlib parameters.
2338
oldlib="$destdir/$name"
2340
func_show_eval "$install_prog \$file \$oldlib" 'exit $?'
2342
if test -n "$stripme" && test -n "$old_striplib"; then
2343
func_show_eval "$old_striplib $oldlib" 'exit $?'
2346
# Do each command in the postinstall commands.
2347
func_execute_cmds "$old_postinstall_cmds" 'exit $?'
2350
test -n "$future_libdirs" && \
2351
func_warning "remember to run \`$progname --finish$future_libdirs'"
2353
if test -n "$current_libdirs"; then
2354
# Maybe just do a dry run.
2355
$opt_dry_run && current_libdirs=" -n$current_libdirs"
2356
exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs'
2362
test "$mode" = install && func_mode_install ${1+"$@"}
2365
# func_generate_dlsyms outputname originator pic_p
2366
# Extract symbols from dlprefiles and create ${outputname}S.o with
2367
# a dlpreopen symbol table.
2368
func_generate_dlsyms ()
2374
my_prefix=`$ECHO "$my_originator" | sed 's%[^a-zA-Z0-9]%_%g'`
2377
if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
2378
if test -n "$NM" && test -n "$global_symbol_pipe"; then
2379
my_dlsyms="${my_outputname}S.c"
2381
func_error "not configured to extract global symbols from dlpreopened files"
2385
if test -n "$my_dlsyms"; then
2389
# Discover the nlist of each of the dlfiles.
2390
nlist="$output_objdir/${my_outputname}.nm"
2392
func_show_eval "$RM $nlist ${nlist}S ${nlist}T"
2394
# Parse the name list into a source file.
2395
func_verbose "creating $output_objdir/$my_dlsyms"
2397
$opt_dry_run || $ECHO > "$output_objdir/$my_dlsyms" "\
2398
/* $my_dlsyms - symbol resolution table for \`$my_outputname' dlsym emulation. */
2399
/* Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION */
2405
/* External symbol declarations for the compiler. */\
2408
if test "$dlself" = yes; then
2409
func_verbose "generating symbol list for \`$output'"
2411
$opt_dry_run || echo ': @PROGRAM@ ' > "$nlist"
2413
# Add our own program objects to the symbol list.
2414
progfiles=`$ECHO "$objs$old_deplibs" | $SP2NL | $SED "$lo2o" | $NL2SP`
2415
for progfile in $progfiles; do
2416
func_verbose "extracting global C symbols from \`$progfile'"
2417
$opt_dry_run || eval "$NM $progfile | $global_symbol_pipe >> '$nlist'"
2420
if test -n "$exclude_expsyms"; then
2422
eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
2423
eval '$MV "$nlist"T "$nlist"'
2427
if test -n "$export_symbols_regex"; then
2429
eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T'
2430
eval '$MV "$nlist"T "$nlist"'
2434
# Prepare the list of exported symbols
2435
if test -z "$export_symbols"; then
2436
export_symbols="$output_objdir/$outputname.exp"
2439
eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
2441
*cygwin* | *mingw* | *cegcc* )
2442
eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
2443
eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"'
2449
eval "${SED} -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"'
2450
eval '$GREP -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T'
2451
eval '$MV "$nlist"T "$nlist"'
2453
*cygwin* | *mingw* | *cegcc* )
2454
eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
2455
eval 'cat "$nlist" >> "$output_objdir/$outputname.def"'
2462
for dlprefile in $dlprefiles; do
2463
func_verbose "extracting global C symbols from \`$dlprefile'"
2464
func_basename "$dlprefile"
2465
name="$func_basename_result"
2467
eval '$ECHO ": $name " >> "$nlist"'
2468
eval "$NM $dlprefile 2>/dev/null | $global_symbol_pipe >> '$nlist'"
2473
# Make sure we have at least an empty file.
2474
test -f "$nlist" || : > "$nlist"
2476
if test -n "$exclude_expsyms"; then
2477
$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T
2478
$MV "$nlist"T "$nlist"
2481
# Try sorting and uniquifying the output.
2482
if $GREP -v "^: " < "$nlist" |
2483
if sort -k 3 </dev/null >/dev/null 2>&1; then
2488
uniq > "$nlist"S; then
2491
$GREP -v "^: " < "$nlist" > "$nlist"S
2494
if test -f "$nlist"S; then
2495
eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$my_dlsyms"'
2497
echo '/* NONE */' >> "$output_objdir/$my_dlsyms"
2500
echo >> "$output_objdir/$my_dlsyms" "\
2502
/* The mapping between symbol names and symbols. */
2509
*cygwin* | *mingw* | *cegcc* )
2510
echo >> "$output_objdir/$my_dlsyms" "\
2511
/* DATA imports from DLLs on WIN32 con't be const, because
2512
runtime relocations are performed -- see ld's documentation
2513
on pseudo-relocs. */"
2516
echo >> "$output_objdir/$my_dlsyms" "\
2517
/* This system does not cope well with relocations in const data */"
2520
lt_dlsym_const=const ;;
2523
echo >> "$output_objdir/$my_dlsyms" "\
2524
extern $lt_dlsym_const lt_dlsymlist
2525
lt_${my_prefix}_LTX_preloaded_symbols[];
2526
$lt_dlsym_const lt_dlsymlist
2527
lt_${my_prefix}_LTX_preloaded_symbols[] =
2529
{ \"$my_originator\", (void *) 0 },"
2531
case $need_lib_prefix in
2533
eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$my_dlsyms"
2536
eval "$global_symbol_to_c_name_address_lib_prefix" < "$nlist" >> "$output_objdir/$my_dlsyms"
2539
echo >> "$output_objdir/$my_dlsyms" "\
2543
/* This works around a problem in FreeBSD linker */
2544
#ifdef FREEBSD_WORKAROUND
2545
static const void *lt_preloaded_setup() {
2546
return lt_${my_prefix}_LTX_preloaded_symbols;
2556
pic_flag_for_symtable=
2557
case "$compile_command " in
2561
# compiling the symbol table file with pic_flag works around
2562
# a FreeBSD bug that causes programs to crash when -lm is
2563
# linked before any other PIC object. But we must not use
2564
# pic_flag when linking with -static. The problem exists in
2565
# FreeBSD 2.2.6 and is fixed in FreeBSD 3.1.
2566
*-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)
2567
pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND" ;;
2569
pic_flag_for_symtable=" $pic_flag" ;;
2571
if test "X$my_pic_p" != Xno; then
2572
pic_flag_for_symtable=" $pic_flag"
2579
for arg in $LTCFLAGS; do
2581
-pie | -fpie | -fPIE) ;;
2582
*) symtab_cflags="$symtab_cflags $arg" ;;
2586
# Now compile the dynamic symbol file.
2587
func_show_eval '(cd $output_objdir && $LTCC$symtab_cflags -c$no_builtin_flag$pic_flag_for_symtable "$my_dlsyms")' 'exit $?'
2589
# Clean up the generated files.
2590
func_show_eval '$RM "$output_objdir/$my_dlsyms" "$nlist" "${nlist}S" "${nlist}T"'
2592
# Transform the symbol file into the correct name.
2593
symfileobj="$output_objdir/${my_outputname}S.$objext"
2595
*cygwin* | *mingw* | *cegcc* )
2596
if test -f "$output_objdir/$my_outputname.def"; then
2597
compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"`
2598
finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"`
2600
compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"`
2601
finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"`
2605
compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"`
2606
finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"`
2611
func_fatal_error "unknown suffix for \`$my_dlsyms'"
2615
# We keep going just in case the user didn't refer to
2616
# lt_preloaded_symbols. The linker will fail if global_symbol_pipe
2617
# really was required.
2619
# Nullify the symbol file.
2620
compile_command=`$ECHO "$compile_command" | $SED "s% @SYMFILE@%%"`
2621
finalize_command=`$ECHO "$finalize_command" | $SED "s% @SYMFILE@%%"`
2625
# func_win32_libid arg
2626
# return the library type of file 'arg'
2628
# Need a lot of goo to handle *both* DLLs and import libs
2629
# Has to be a shell function in order to 'eat' the argument
2630
# that is supplied when $file_magic_command is called.
2631
# Despite the name, also deal with 64 bit binaries.
2635
win32_libid_type="unknown"
2636
win32_fileres=`file -L $1 2>/dev/null`
2637
case $win32_fileres in
2638
*ar\ archive\ import\ library*) # definitely import
2639
win32_libid_type="x86 archive import"
2641
*ar\ archive*) # could be an import, or static
2642
if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null |
2643
$EGREP 'file format (pe-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' >/dev/null; then
2644
win32_nmres=`eval $NM -f posix -A $1 |
2653
case $win32_nmres in
2654
import*) win32_libid_type="x86 archive import";;
2655
*) win32_libid_type="x86 archive static";;
2660
win32_libid_type="x86 DLL"
2662
*executable*) # but shell scripts are "executable" too...
2663
case $win32_fileres in
2664
*MS\ Windows\ PE\ Intel*)
2665
win32_libid_type="x86 DLL"
2670
$ECHO "$win32_libid_type"
2675
# func_extract_an_archive dir oldlib
2676
func_extract_an_archive ()
2679
f_ex_an_ar_dir="$1"; shift
2680
f_ex_an_ar_oldlib="$1"
2681
if test "$lock_old_archive_extraction" = yes; then
2682
lockfile=$f_ex_an_ar_oldlib.lock
2683
until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do
2684
func_echo "Waiting for $lockfile to be removed"
2688
func_show_eval "(cd \$f_ex_an_ar_dir && $AR x \"\$f_ex_an_ar_oldlib\")" \
2689
'stat=$?; rm -f "$lockfile"; exit $stat'
2690
if test "$lock_old_archive_extraction" = yes; then
2691
$opt_dry_run || rm -f "$lockfile"
2693
if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then
2696
func_fatal_error "object name conflicts in archive: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib"
2701
# func_extract_archives gentop oldlib ...
2702
func_extract_archives ()
2705
my_gentop="$1"; shift
2706
my_oldlibs=${1+"$@"}
2712
for my_xlib in $my_oldlibs; do
2713
# Extract the objects.
2715
[\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;;
2716
*) my_xabs=`pwd`"/$my_xlib" ;;
2718
func_basename "$my_xlib"
2719
my_xlib="$func_basename_result"
2722
case " $extracted_archives " in
2724
func_arith $extracted_serial + 1
2725
extracted_serial=$func_arith_result
2726
my_xlib_u=lt$extracted_serial-$my_xlib ;;
2730
extracted_archives="$extracted_archives $my_xlib_u"
2731
my_xdir="$my_gentop/$my_xlib_u"
2733
func_mkdir_p "$my_xdir"
2737
func_verbose "Extracting $my_xabs"
2738
# Do not bother doing anything if just a dry run
2740
darwin_orig_dir=`pwd`
2741
cd $my_xdir || exit $?
2742
darwin_archive=$my_xabs
2744
darwin_base_archive=`basename "$darwin_archive"`
2745
darwin_arches=`$LIPO -info "$darwin_archive" 2>/dev/null | $GREP Architectures 2>/dev/null || true`
2746
if test -n "$darwin_arches"; then
2747
darwin_arches=`$ECHO "$darwin_arches" | $SED -e 's/.*are://'`
2749
func_verbose "$darwin_base_archive has multiple architectures $darwin_arches"
2750
for darwin_arch in $darwin_arches ; do
2751
func_mkdir_p "unfat-$$/${darwin_base_archive}-${darwin_arch}"
2752
$LIPO -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}"
2753
cd "unfat-$$/${darwin_base_archive}-${darwin_arch}"
2754
func_extract_an_archive "`pwd`" "${darwin_base_archive}"
2756
$RM "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}"
2757
done # $darwin_arches
2758
## Okay now we've a bunch of thin objects, gotta fatten them up :)
2759
darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print | $SED -e "$basename" | sort -u`
2762
for darwin_file in $darwin_filelist; do
2763
darwin_files=`find unfat-$$ -name $darwin_file -print | $NL2SP`
2764
$LIPO -create -output "$darwin_file" $darwin_files
2765
done # $darwin_filelist
2767
cd "$darwin_orig_dir"
2770
func_extract_an_archive "$my_xdir" "$my_xabs"
2775
func_extract_an_archive "$my_xdir" "$my_xabs"
2778
my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP`
2781
func_extract_archives_result="$my_oldobjs"
2785
# func_emit_wrapper [arg=no]
2787
# Emit a libtool wrapper script on stdout.
2788
# Don't directly open a file because we may want to
2789
# incorporate the script contents within a cygwin/mingw
2790
# wrapper executable. Must ONLY be called from within
2791
# func_mode_link because it depends on a number of variables
2794
# ARG is the value that the WRAPPER_SCRIPT_BELONGS_IN_OBJDIR
2795
# variable will take. If 'yes', then the emitted script
2796
# will assume that the directory in which it is stored is
2797
# the $objdir directory. This is a cygwin/mingw-specific
2799
func_emit_wrapper ()
2801
func_emit_wrapper_arg1=${1-no}
2806
# $output - temporary wrapper script for $objdir/$outputname
2807
# Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
2809
# The $output program cannot be directly executed until all the libtool
2810
# libraries that it depends on are installed.
2812
# This wrapper script should never be moved out of the build directory.
2813
# If it is, it will not operate correctly.
2815
# Sed substitution that helps us do robust quoting. It backslashifies
2816
# metacharacters that are still active within double-quoted strings.
2817
sed_quote_subst='$sed_quote_subst'
2819
# Be Bourne compatible
2820
if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then
2823
# Zsh 3.x and 4.x performs word splitting on \${1+\"\$@\"}, which
2824
# is contrary to our usage. Disable this feature.
2825
alias -g '\${1+\"\$@\"}'='\"\$@\"'
2826
setopt NO_GLOB_SUBST
2828
case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac
2830
BIN_SH=xpg4; export BIN_SH # for Tru64
2831
DUALCASE=1; export DUALCASE # for MKS sh
2833
# The HP-UX ksh and POSIX shell print the target directory to stdout
2835
(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
2837
relink_command=\"$relink_command\"
2839
# This environment variable determines our operation mode.
2840
if test \"\$libtool_install_magic\" = \"$magic\"; then
2841
# install mode needs the following variables:
2842
generated_by_libtool_version='$macro_version'
2843
notinst_deplibs='$notinst_deplibs'
2845
# When we are sourced in execute mode, \$file and \$ECHO are already set.
2846
if test \"\$libtool_execute_magic\" != \"$magic\"; then
2849
qECHO=`$ECHO "$ECHO" | $SED "$sed_quote_subst"`
2852
# A function that is used when there is no print builtin or printf.
2853
func_fallback_echo ()
2855
eval 'cat <<_LTECHO_EOF
2862
# Find the directory that this script lives in.
2863
thisdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*$%%'\`
2864
test \"x\$thisdir\" = \"x\$file\" && thisdir=.
2866
# Follow symbolic links until we get to the real thisdir.
2867
file=\`ls -ld \"\$file\" | $SED -n 's/.*-> //p'\`
2868
while test -n \"\$file\"; do
2869
destdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*\$%%'\`
2871
# If there was a directory component, then change thisdir.
2872
if test \"x\$destdir\" != \"x\$file\"; then
2873
case \"\$destdir\" in
2874
[\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;;
2875
*) thisdir=\"\$thisdir/\$destdir\" ;;
2879
file=\`\$ECHO \"\$file\" | $SED 's%^.*/%%'\`
2880
file=\`ls -ld \"\$thisdir/\$file\" | $SED -n 's/.*-> //p'\`
2883
# Usually 'no', except on cygwin/mingw when embedded into
2885
WRAPPER_SCRIPT_BELONGS_IN_OBJDIR=$func_emit_wrapper_arg1
2886
if test \"\$WRAPPER_SCRIPT_BELONGS_IN_OBJDIR\" = \"yes\"; then
2887
# special case for '.'
2888
if test \"\$thisdir\" = \".\"; then
2891
# remove .libs from thisdir
2892
case \"\$thisdir\" in
2893
*[\\\\/]$objdir ) thisdir=\`\$ECHO \"\$thisdir\" | $SED 's%[\\\\/][^\\\\/]*$%%'\` ;;
2894
$objdir ) thisdir=. ;;
2898
# Try to get the absolute directory name.
2899
absdir=\`cd \"\$thisdir\" && pwd\`
2900
test -n \"\$absdir\" && thisdir=\"\$absdir\"
2903
if test "$fast_install" = yes; then
2905
program=lt-'$outputname'$exeext
2906
progdir=\"\$thisdir/$objdir\"
2908
if test ! -f \"\$progdir/\$program\" ||
2909
{ file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\
2910
test \"X\$file\" != \"X\$progdir/\$program\"; }; then
2912
file=\"\$\$-\$program\"
2914
if test ! -d \"\$progdir\"; then
2915
$MKDIR \"\$progdir\"
2917
$RM \"\$progdir/\$file\"
2922
# relink executable if necessary
2923
if test -n \"\$relink_command\"; then
2924
if relink_command_output=\`eval \$relink_command 2>&1\`; then :
2926
$ECHO \"\$relink_command_output\" >&2
2927
$RM \"\$progdir/\$file\"
2932
$MV \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null ||
2933
{ $RM \"\$progdir/\$program\";
2934
$MV \"\$progdir/\$file\" \"\$progdir/\$program\"; }
2935
$RM \"\$progdir/\$file\"
2939
program='$outputname'
2940
progdir=\"\$thisdir/$objdir\"
2946
if test -f \"\$progdir/\$program\"; then"
2948
# Export our shlibpath_var if we have one.
2949
if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
2951
# Add our own library path to $shlibpath_var
2952
$shlibpath_var=\"$temp_rpath\$$shlibpath_var\"
2954
# Some systems cannot cope with colon-terminated $shlibpath_var
2955
# The second colon is a workaround for a bug in BeOS R4 sed
2956
$shlibpath_var=\`\$ECHO \"\$$shlibpath_var\" | $SED 's/::*\$//'\`
2958
export $shlibpath_var
2962
# fixup the dll searchpath if we need to.
2963
if test -n "$dllsearchpath"; then
2965
# Add the dll search path components to the executable PATH
2966
PATH=$dllsearchpath:\$PATH
2971
if test \"\$libtool_execute_magic\" != \"$magic\"; then
2972
# Run the actual program with our arguments.
2975
# Backslashes separate directories on plain windows
2976
*-*-mingw | *-*-os2* | *-cegcc*)
2978
exec \"\$progdir\\\\\$program\" \${1+\"\$@\"}
2984
exec \"\$progdir/\$program\" \${1+\"\$@\"}
2989
\$ECHO \"\$0: cannot exec \$program \$*\" 1>&2
2993
# The program doesn't exist.
2994
\$ECHO \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2
2995
\$ECHO \"This script is just a wrapper for \$program.\" 1>&2
2996
\$ECHO \"See the $PACKAGE documentation for more information.\" 1>&2
3004
# func_to_host_path arg
3006
# Convert paths to host format when used with build tools.
3007
# Intended for use with "native" mingw (where libtool itself
3008
# is running under the msys shell), or in the following cross-
3009
# build environments:
3011
# mingw (msys) mingw [e.g. native]
3014
# where wine is equipped with the `winepath' executable.
3015
# In the native mingw case, the (msys) shell automatically
3016
# converts paths for any non-msys applications it launches,
3017
# but that facility isn't available from inside the cwrapper.
3018
# Similar accommodations are necessary for $host mingw and
3019
# $build cygwin. Calling this function does no harm for other
3020
# $host/$build combinations not listed above.
3022
# ARG is the path (on $build) that should be converted to
3023
# the proper representation for $host. The result is stored
3024
# in $func_to_host_path_result.
3025
func_to_host_path ()
3027
func_to_host_path_result="$1"
3028
if test -n "$1"; then
3031
lt_sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g'
3033
*mingw* ) # actually, msys
3034
# awkward: cmd appends spaces to result
3035
func_to_host_path_result=`( cmd //c echo "$1" ) 2>/dev/null |
3036
$SED -e 's/[ ]*$//' -e "$lt_sed_naive_backslashify"`
3039
func_to_host_path_result=`cygpath -w "$1" |
3040
$SED -e "$lt_sed_naive_backslashify"`
3043
# Unfortunately, winepath does not exit with a non-zero
3044
# error code, so we are forced to check the contents of
3045
# stdout. On the other hand, if the command is not
3046
# found, the shell will set an exit code of 127 and print
3047
# *an error message* to stdout. So we must check for both
3048
# error code of zero AND non-empty stdout, which explains
3049
# the odd construction:
3050
func_to_host_path_tmp1=`winepath -w "$1" 2>/dev/null`
3051
if test "$?" -eq 0 && test -n "${func_to_host_path_tmp1}"; then
3052
func_to_host_path_result=`$ECHO "$func_to_host_path_tmp1" |
3053
$SED -e "$lt_sed_naive_backslashify"`
3055
# Allow warning below.
3056
func_to_host_path_result=
3060
if test -z "$func_to_host_path_result" ; then
3061
func_error "Could not determine host path corresponding to"
3063
func_error "Continuing, but uninstalled executables may not work."
3065
func_to_host_path_result="$1"
3071
# end: func_to_host_path
3073
# func_to_host_pathlist arg
3075
# Convert pathlists to host format when used with build tools.
3076
# See func_to_host_path(), above. This function supports the
3077
# following $build/$host combinations (but does no harm for
3078
# combinations not listed here):
3080
# mingw (msys) mingw [e.g. native]
3084
# Path separators are also converted from $build format to
3085
# $host format. If ARG begins or ends with a path separator
3086
# character, it is preserved (but converted to $host format)
3089
# ARG is a pathlist (on $build) that should be converted to
3090
# the proper representation on $host. The result is stored
3091
# in $func_to_host_pathlist_result.
3092
func_to_host_pathlist ()
3094
func_to_host_pathlist_result="$1"
3095
if test -n "$1"; then
3098
lt_sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g'
3099
# Remove leading and trailing path separator characters from
3100
# ARG. msys behavior is inconsistent here, cygpath turns them
3101
# into '.;' and ';.', and winepath ignores them completely.
3102
func_stripname : : "$1"
3103
func_to_host_pathlist_tmp1=$func_stripname_result
3105
*mingw* ) # Actually, msys.
3106
# Awkward: cmd appends spaces to result.
3107
func_to_host_pathlist_result=`
3108
( cmd //c echo "$func_to_host_pathlist_tmp1" ) 2>/dev/null |
3109
$SED -e 's/[ ]*$//' -e "$lt_sed_naive_backslashify"`
3112
func_to_host_pathlist_result=`cygpath -w -p "$func_to_host_pathlist_tmp1" |
3113
$SED -e "$lt_sed_naive_backslashify"`
3116
# unfortunately, winepath doesn't convert pathlists
3117
func_to_host_pathlist_result=""
3118
func_to_host_pathlist_oldIFS=$IFS
3120
for func_to_host_pathlist_f in $func_to_host_pathlist_tmp1 ; do
3121
IFS=$func_to_host_pathlist_oldIFS
3122
if test -n "$func_to_host_pathlist_f" ; then
3123
func_to_host_path "$func_to_host_pathlist_f"
3124
if test -n "$func_to_host_path_result" ; then
3125
if test -z "$func_to_host_pathlist_result" ; then
3126
func_to_host_pathlist_result="$func_to_host_path_result"
3128
func_append func_to_host_pathlist_result ";$func_to_host_path_result"
3133
IFS=$func_to_host_pathlist_oldIFS
3136
if test -z "$func_to_host_pathlist_result"; then
3137
func_error "Could not determine the host path(s) corresponding to"
3139
func_error "Continuing, but uninstalled executables may not work."
3140
# Fallback. This may break if $1 contains DOS-style drive
3141
# specifications. The fix is not to complicate the expression
3142
# below, but for the user to provide a working wine installation
3143
# with winepath so that path translation in the cross-to-mingw
3144
# case works properly.
3145
lt_replace_pathsep_nix_to_dos="s|:|;|g"
3146
func_to_host_pathlist_result=`echo "$func_to_host_pathlist_tmp1" |\
3147
$SED -e "$lt_replace_pathsep_nix_to_dos"`
3149
# Now, add the leading and trailing path separators back
3151
:* ) func_to_host_pathlist_result=";$func_to_host_pathlist_result"
3155
*: ) func_append func_to_host_pathlist_result ";"
3162
# end: func_to_host_pathlist
3164
# func_emit_cwrapperexe_src
3165
# emit the source code for a wrapper executable on stdout
3166
# Must ONLY be called from within func_mode_link because
3167
# it depends on a number of variable set therein.
3168
func_emit_cwrapperexe_src ()
3172
/* $cwrappersource - temporary wrapper executable for $objdir/$outputname
3173
Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
3175
The $output program cannot be directly executed until all the libtool
3176
libraries that it depends on are installed.
3178
This wrapper executable should never be moved out of the build directory.
3179
If it is, it will not operate correctly.
3181
Currently, it simply execs the wrapper *script* "$SHELL $output",
3182
but could eventually absorb all of the scripts functionality and
3183
exec $objdir/$outputname directly.
3188
# define _CRT_SECURE_NO_DEPRECATE 1
3193
# include <direct.h>
3194
# include <process.h>
3197
# include <unistd.h>
3198
# include <stdint.h>
3210
#include <sys/stat.h>
3212
/* declarations of non-ANSI functions */
3213
#if defined(__MINGW32__)
3214
# ifdef __STRICT_ANSI__
3215
int _putenv (const char *);
3217
#elif defined(__CYGWIN__)
3218
# ifdef __STRICT_ANSI__
3219
char *realpath (const char *, char *);
3220
int putenv (char *);
3221
int setenv (const char *, const char *, int);
3223
/* #elif defined (other platforms) ... */
3226
/* portability defines, excluding path handling macros */
3227
#if defined(_MSC_VER)
3228
# define setmode _setmode
3230
# define chmod _chmod
3231
# define getcwd _getcwd
3232
# define putenv _putenv
3233
# define S_IXUSR _S_IEXEC
3234
# ifndef _INTPTR_T_DEFINED
3235
# define _INTPTR_T_DEFINED
3236
# define intptr_t int
3238
#elif defined(__MINGW32__)
3239
# define setmode _setmode
3241
# define chmod _chmod
3242
# define getcwd _getcwd
3243
# define putenv _putenv
3244
#elif defined(__CYGWIN__)
3245
# define HAVE_SETENV
3246
# define FOPEN_WB "wb"
3247
/* #elif defined (other platforms) ... */
3250
#if defined(PATH_MAX)
3251
# define LT_PATHMAX PATH_MAX
3252
#elif defined(MAXPATHLEN)
3253
# define LT_PATHMAX MAXPATHLEN
3255
# define LT_PATHMAX 1024
3265
/* path handling portability macros */
3266
#ifndef DIR_SEPARATOR
3267
# define DIR_SEPARATOR '/'
3268
# define PATH_SEPARATOR ':'
3271
#if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \
3273
# define HAVE_DOS_BASED_FILE_SYSTEM
3274
# define FOPEN_WB "wb"
3275
# ifndef DIR_SEPARATOR_2
3276
# define DIR_SEPARATOR_2 '\\'
3278
# ifndef PATH_SEPARATOR_2
3279
# define PATH_SEPARATOR_2 ';'
3283
#ifndef DIR_SEPARATOR_2
3284
# define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR)
3285
#else /* DIR_SEPARATOR_2 */
3286
# define IS_DIR_SEPARATOR(ch) \
3287
(((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2))
3288
#endif /* DIR_SEPARATOR_2 */
3290
#ifndef PATH_SEPARATOR_2
3291
# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR)
3292
#else /* PATH_SEPARATOR_2 */
3293
# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2)
3294
#endif /* PATH_SEPARATOR_2 */
3297
# define FOPEN_WB "w"
3300
# define _O_BINARY 0
3303
#define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type)))
3304
#define XFREE(stale) do { \
3305
if (stale) { free ((void *) stale); stale = 0; } \
3308
#undef LTWRAPPER_DEBUGPRINTF
3309
#if defined LT_DEBUGWRAPPER
3310
# define LTWRAPPER_DEBUGPRINTF(args) ltwrapper_debugprintf args
3312
ltwrapper_debugprintf (const char *fmt, ...)
3315
va_start (args, fmt);
3316
(void) vfprintf (stderr, fmt, args);
3320
# define LTWRAPPER_DEBUGPRINTF(args)
3323
const char *program_name = NULL;
3325
void *xmalloc (size_t num);
3326
char *xstrdup (const char *string);
3327
const char *base_name (const char *name);
3328
char *find_executable (const char *wrapper);
3329
char *chase_symlinks (const char *pathspec);
3330
int make_executable (const char *path);
3331
int check_executable (const char *path);
3332
char *strendzap (char *str, const char *pat);
3333
void lt_fatal (const char *message, ...);
3334
void lt_setenv (const char *name, const char *value);
3335
char *lt_extend_str (const char *orig_value, const char *add, int to_end);
3336
void lt_update_exe_path (const char *name, const char *value);
3337
void lt_update_lib_path (const char *name, const char *value);
3338
char **prepare_spawn (char **argv);
3339
void lt_dump_script (FILE *f);
3343
const char * MAGIC_EXE = "$magic_exe";
3344
const char * LIB_PATH_VARNAME = "$shlibpath_var";
3347
if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
3348
func_to_host_pathlist "$temp_rpath"
3350
const char * LIB_PATH_VALUE = "$func_to_host_pathlist_result";
3354
const char * LIB_PATH_VALUE = "";
3358
if test -n "$dllsearchpath"; then
3359
func_to_host_pathlist "$dllsearchpath:"
3361
const char * EXE_PATH_VARNAME = "PATH";
3362
const char * EXE_PATH_VALUE = "$func_to_host_pathlist_result";
3366
const char * EXE_PATH_VARNAME = "";
3367
const char * EXE_PATH_VALUE = "";
3371
if test "$fast_install" = yes; then
3373
const char * TARGET_PROGRAM_NAME = "lt-$outputname"; /* hopefully, no .exe */
3377
const char * TARGET_PROGRAM_NAME = "$outputname"; /* hopefully, no .exe */
3384
#define LTWRAPPER_OPTION_PREFIX "--lt-"
3385
#define LTWRAPPER_OPTION_PREFIX_LENGTH 5
3387
static const size_t opt_prefix_len = LTWRAPPER_OPTION_PREFIX_LENGTH;
3388
static const char *ltwrapper_option_prefix = LTWRAPPER_OPTION_PREFIX;
3390
static const char *dumpscript_opt = LTWRAPPER_OPTION_PREFIX "dump-script";
3393
main (int argc, char *argv[])
3398
char *actual_cwrapper_path;
3399
char *actual_cwrapper_name;
3402
intptr_t rval = 127;
3406
program_name = (char *) xstrdup (base_name (argv[0]));
3407
LTWRAPPER_DEBUGPRINTF (("(main) argv[0] : %s\n", argv[0]));
3408
LTWRAPPER_DEBUGPRINTF (("(main) program_name : %s\n", program_name));
3410
/* very simple arg parsing; don't want to rely on getopt */
3411
for (i = 1; i < argc; i++)
3413
if (strcmp (argv[i], dumpscript_opt) == 0)
3417
*mingw* | *cygwin* )
3418
# make stdout use "unix" line endings
3419
echo " setmode(1,_O_BINARY);"
3424
lt_dump_script (stdout);
3429
newargz = XMALLOC (char *, argc + 1);
3430
tmp_pathspec = find_executable (argv[0]);
3431
if (tmp_pathspec == NULL)
3432
lt_fatal ("Couldn't find %s", argv[0]);
3433
LTWRAPPER_DEBUGPRINTF (("(main) found exe (before symlink chase) at : %s\n",
3436
actual_cwrapper_path = chase_symlinks (tmp_pathspec);
3437
LTWRAPPER_DEBUGPRINTF (("(main) found exe (after symlink chase) at : %s\n",
3438
actual_cwrapper_path));
3439
XFREE (tmp_pathspec);
3441
actual_cwrapper_name = xstrdup( base_name (actual_cwrapper_path));
3442
strendzap (actual_cwrapper_path, actual_cwrapper_name);
3444
/* wrapper name transforms */
3445
strendzap (actual_cwrapper_name, ".exe");
3446
tmp_pathspec = lt_extend_str (actual_cwrapper_name, ".exe", 1);
3447
XFREE (actual_cwrapper_name);
3448
actual_cwrapper_name = tmp_pathspec;
3451
/* target_name transforms -- use actual target program name; might have lt- prefix */
3452
target_name = xstrdup (base_name (TARGET_PROGRAM_NAME));
3453
strendzap (target_name, ".exe");
3454
tmp_pathspec = lt_extend_str (target_name, ".exe", 1);
3455
XFREE (target_name);
3456
target_name = tmp_pathspec;
3459
LTWRAPPER_DEBUGPRINTF (("(main) libtool target name: %s\n",
3465
XMALLOC (char, (strlen (actual_cwrapper_path) +
3466
strlen ("$objdir") + 1 + strlen (actual_cwrapper_name) + 1));
3467
strcpy (newargz[0], actual_cwrapper_path);
3468
strcat (newargz[0], "$objdir");
3469
strcat (newargz[0], "/");
3473
/* stop here, and copy so we don't have to do this twice */
3474
tmp_pathspec = xstrdup (newargz[0]);
3476
/* do NOT want the lt- prefix here, so use actual_cwrapper_name */
3477
strcat (newargz[0], actual_cwrapper_name);
3479
/* DO want the lt- prefix here if it exists, so use target_name */
3480
lt_argv_zero = lt_extend_str (tmp_pathspec, target_name, 1);
3481
XFREE (tmp_pathspec);
3482
tmp_pathspec = NULL;
3490
while ((p = strchr (newargz[0], '\\')) != NULL)
3494
while ((p = strchr (lt_argv_zero, '\\')) != NULL)
3504
XFREE (target_name);
3505
XFREE (actual_cwrapper_path);
3506
XFREE (actual_cwrapper_name);
3508
lt_setenv ("BIN_SH", "xpg4"); /* for Tru64 */
3509
lt_setenv ("DUALCASE", "1"); /* for MSK sh */
3510
lt_update_lib_path (LIB_PATH_VARNAME, LIB_PATH_VALUE);
3511
lt_update_exe_path (EXE_PATH_VARNAME, EXE_PATH_VALUE);
3514
for (i = 1; i < argc; i++)
3516
if (strncmp (argv[i], ltwrapper_option_prefix, opt_prefix_len) == 0)
3518
/* however, if there is an option in the LTWRAPPER_OPTION_PREFIX
3519
namespace, but it is not one of the ones we know about and
3520
have already dealt with, above (inluding dump-script), then
3521
report an error. Otherwise, targets might begin to believe
3522
they are allowed to use options in the LTWRAPPER_OPTION_PREFIX
3523
namespace. The first time any user complains about this, we'll
3524
need to make LTWRAPPER_OPTION_PREFIX a configure-time option
3525
or a configure.ac-settable value.
3527
lt_fatal ("Unrecognized option in %s namespace: '%s'",
3528
ltwrapper_option_prefix, argv[i]);
3531
newargz[++newargc] = xstrdup (argv[i]);
3533
newargz[++newargc] = NULL;
3535
LTWRAPPER_DEBUGPRINTF (("(main) lt_argv_zero : %s\n", (lt_argv_zero ? lt_argv_zero : "<NULL>")));
3536
for (i = 0; i < newargc; i++)
3538
LTWRAPPER_DEBUGPRINTF (("(main) newargz[%d] : %s\n", i, (newargz[i] ? newargz[i] : "<NULL>")));
3546
/* execv doesn't actually work on mingw as expected on unix */
3547
newargz = prepare_spawn (newargz);
3548
rval = _spawnv (_P_WAIT, lt_argv_zero, (const char * const *) newargz);
3551
/* failed to start process */
3552
LTWRAPPER_DEBUGPRINTF (("(main) failed to launch target \"%s\": errno = %d\n", lt_argv_zero, errno));
3560
execv (lt_argv_zero, newargz);
3561
return rval; /* =127, but avoids unused variable warning */
3570
xmalloc (size_t num)
3572
void *p = (void *) malloc (num);
3574
lt_fatal ("Memory exhausted");
3580
xstrdup (const char *string)
3582
return string ? strcpy ((char *) xmalloc (strlen (string) + 1),
3587
base_name (const char *name)
3591
#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
3592
/* Skip over the disk name in MSDOS pathnames. */
3593
if (isalpha ((unsigned char) name[0]) && name[1] == ':')
3597
for (base = name; *name; name++)
3598
if (IS_DIR_SEPARATOR (*name))
3604
check_executable (const char *path)
3608
LTWRAPPER_DEBUGPRINTF (("(check_executable) : %s\n",
3609
path ? (*path ? path : "EMPTY!") : "NULL!"));
3610
if ((!path) || (!*path))
3613
if ((stat (path, &st) >= 0)
3614
&& (st.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH)))
3621
make_executable (const char *path)
3626
LTWRAPPER_DEBUGPRINTF (("(make_executable) : %s\n",
3627
path ? (*path ? path : "EMPTY!") : "NULL!"));
3628
if ((!path) || (!*path))
3631
if (stat (path, &st) >= 0)
3633
rval = chmod (path, st.st_mode | S_IXOTH | S_IXGRP | S_IXUSR);
3638
/* Searches for the full path of the wrapper. Returns
3639
newly allocated full path name if found, NULL otherwise
3640
Does not chase symlinks, even on platforms that support them.
3643
find_executable (const char *wrapper)
3648
/* static buffer for getcwd */
3649
char tmp[LT_PATHMAX + 1];
3653
LTWRAPPER_DEBUGPRINTF (("(find_executable) : %s\n",
3654
wrapper ? (*wrapper ? wrapper : "EMPTY!") : "NULL!"));
3656
if ((wrapper == NULL) || (*wrapper == '\0'))
3659
/* Absolute path? */
3660
#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
3661
if (isalpha ((unsigned char) wrapper[0]) && wrapper[1] == ':')
3663
concat_name = xstrdup (wrapper);
3664
if (check_executable (concat_name))
3666
XFREE (concat_name);
3671
if (IS_DIR_SEPARATOR (wrapper[0]))
3673
concat_name = xstrdup (wrapper);
3674
if (check_executable (concat_name))
3676
XFREE (concat_name);
3678
#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
3682
for (p = wrapper; *p; p++)
3690
/* no slashes; search PATH */
3691
const char *path = getenv ("PATH");
3694
for (p = path; *p; p = p_next)
3698
for (q = p; *q; q++)
3699
if (IS_PATH_SEPARATOR (*q))
3702
p_next = (*q == '\0' ? q : q + 1);
3705
/* empty path: current directory */
3706
if (getcwd (tmp, LT_PATHMAX) == NULL)
3707
lt_fatal ("getcwd failed");
3708
tmp_len = strlen (tmp);
3710
XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1);
3711
memcpy (concat_name, tmp, tmp_len);
3712
concat_name[tmp_len] = '/';
3713
strcpy (concat_name + tmp_len + 1, wrapper);
3718
XMALLOC (char, p_len + 1 + strlen (wrapper) + 1);
3719
memcpy (concat_name, p, p_len);
3720
concat_name[p_len] = '/';
3721
strcpy (concat_name + p_len + 1, wrapper);
3723
if (check_executable (concat_name))
3725
XFREE (concat_name);
3728
/* not found in PATH; assume curdir */
3730
/* Relative path | not found in path: prepend cwd */
3731
if (getcwd (tmp, LT_PATHMAX) == NULL)
3732
lt_fatal ("getcwd failed");
3733
tmp_len = strlen (tmp);
3734
concat_name = XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1);
3735
memcpy (concat_name, tmp, tmp_len);
3736
concat_name[tmp_len] = '/';
3737
strcpy (concat_name + tmp_len + 1, wrapper);
3739
if (check_executable (concat_name))
3741
XFREE (concat_name);
3746
chase_symlinks (const char *pathspec)
3749
return xstrdup (pathspec);
3751
char buf[LT_PATHMAX];
3753
char *tmp_pathspec = xstrdup (pathspec);
3755
int has_symlinks = 0;
3756
while (strlen (tmp_pathspec) && !has_symlinks)
3758
LTWRAPPER_DEBUGPRINTF (("checking path component for symlinks: %s\n",
3760
if (lstat (tmp_pathspec, &s) == 0)
3762
if (S_ISLNK (s.st_mode) != 0)
3768
/* search backwards for last DIR_SEPARATOR */
3769
p = tmp_pathspec + strlen (tmp_pathspec) - 1;
3770
while ((p > tmp_pathspec) && (!IS_DIR_SEPARATOR (*p)))
3772
if ((p == tmp_pathspec) && (!IS_DIR_SEPARATOR (*p)))
3774
/* no more DIR_SEPARATORS left */
3781
char *errstr = strerror (errno);
3782
lt_fatal ("Error accessing file %s (%s)", tmp_pathspec, errstr);
3785
XFREE (tmp_pathspec);
3789
return xstrdup (pathspec);
3792
tmp_pathspec = realpath (pathspec, buf);
3793
if (tmp_pathspec == 0)
3795
lt_fatal ("Could not follow symlinks for %s", pathspec);
3797
return xstrdup (tmp_pathspec);
3802
strendzap (char *str, const char *pat)
3806
assert (str != NULL);
3807
assert (pat != NULL);
3810
patlen = strlen (pat);
3814
str += len - patlen;
3815
if (strcmp (str, pat) == 0)
3822
lt_error_core (int exit_status, const char *mode,
3823
const char *message, va_list ap)
3825
fprintf (stderr, "%s: %s: ", program_name, mode);
3826
vfprintf (stderr, message, ap);
3827
fprintf (stderr, ".\n");
3829
if (exit_status >= 0)
3834
lt_fatal (const char *message, ...)
3837
va_start (ap, message);
3838
lt_error_core (EXIT_FAILURE, "FATAL", message, ap);
3843
lt_setenv (const char *name, const char *value)
3845
LTWRAPPER_DEBUGPRINTF (("(lt_setenv) setting '%s' to '%s'\n",
3846
(name ? name : "<NULL>"),
3847
(value ? value : "<NULL>")));
3850
/* always make a copy, for consistency with !HAVE_SETENV */
3851
char *str = xstrdup (value);
3852
setenv (name, str, 1);
3854
int len = strlen (name) + 1 + strlen (value) + 1;
3855
char *str = XMALLOC (char, len);
3856
sprintf (str, "%s=%s", name, value);
3857
if (putenv (str) != EXIT_SUCCESS)
3866
lt_extend_str (const char *orig_value, const char *add, int to_end)
3869
if (orig_value && *orig_value)
3871
int orig_value_len = strlen (orig_value);
3872
int add_len = strlen (add);
3873
new_value = XMALLOC (char, add_len + orig_value_len + 1);
3876
strcpy (new_value, orig_value);
3877
strcpy (new_value + orig_value_len, add);
3881
strcpy (new_value, add);
3882
strcpy (new_value + add_len, orig_value);
3887
new_value = xstrdup (add);
3893
lt_update_exe_path (const char *name, const char *value)
3895
LTWRAPPER_DEBUGPRINTF (("(lt_update_exe_path) modifying '%s' by prepending '%s'\n",
3896
(name ? name : "<NULL>"),
3897
(value ? value : "<NULL>")));
3899
if (name && *name && value && *value)
3901
char *new_value = lt_extend_str (getenv (name), value, 0);
3902
/* some systems can't cope with a ':'-terminated path #' */
3903
int len = strlen (new_value);
3904
while (((len = strlen (new_value)) > 0) && IS_PATH_SEPARATOR (new_value[len-1]))
3906
new_value[len-1] = '\0';
3908
lt_setenv (name, new_value);
3914
lt_update_lib_path (const char *name, const char *value)
3916
LTWRAPPER_DEBUGPRINTF (("(lt_update_lib_path) modifying '%s' by prepending '%s'\n",
3917
(name ? name : "<NULL>"),
3918
(value ? value : "<NULL>")));
3920
if (name && *name && value && *value)
3922
char *new_value = lt_extend_str (getenv (name), value, 0);
3923
lt_setenv (name, new_value);
3933
/* Prepares an argument vector before calling spawn().
3934
Note that spawn() does not by itself call the command interpreter
3935
(getenv ("COMSPEC") != NULL ? getenv ("COMSPEC") :
3936
({ OSVERSIONINFO v; v.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
3938
v.dwPlatformId == VER_PLATFORM_WIN32_NT;
3939
}) ? "cmd.exe" : "command.com").
3940
Instead it simply concatenates the arguments, separated by ' ', and calls
3941
CreateProcess(). We must quote the arguments since Win32 CreateProcess()
3942
interprets characters like ' ', '\t', '\\', '"' (but not '<' and '>') in a
3944
- Space and tab are interpreted as delimiters. They are not treated as
3945
delimiters if they are surrounded by double quotes: "...".
3946
- Unescaped double quotes are removed from the input. Their only effect is
3947
that within double quotes, space and tab are treated like normal
3949
- Backslashes not followed by double quotes are not special.
3950
- But 2*n+1 backslashes followed by a double quote become
3951
n backslashes followed by a double quote (n >= 0):
3956
#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"
3957
#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"
3959
prepare_spawn (char **argv)
3965
/* Count number of arguments. */
3966
for (argc = 0; argv[argc] != NULL; argc++)
3969
/* Allocate new argument vector. */
3970
new_argv = XMALLOC (char *, argc + 1);
3972
/* Put quoted arguments into the new argument vector. */
3973
for (i = 0; i < argc; i++)
3975
const char *string = argv[i];
3977
if (string[0] == '\0')
3978
new_argv[i] = xstrdup ("\"\"");
3979
else if (strpbrk (string, SHELL_SPECIAL_CHARS) != NULL)
3981
int quote_around = (strpbrk (string, SHELL_SPACE_CHARS) != NULL);
3983
unsigned int backslashes;
3985
char *quoted_string;
3992
for (s = string; *s != '\0'; s++)
3996
length += backslashes + 1;
4004
length += backslashes + 1;
4006
quoted_string = XMALLOC (char, length + 1);
4012
for (s = string; *s != '\0'; s++)
4018
for (j = backslashes + 1; j > 0; j--)
4030
for (j = backslashes; j > 0; j--)
4036
new_argv[i] = quoted_string;
4039
new_argv[i] = (char *) string;
4041
new_argv[argc] = NULL;
4050
void lt_dump_script (FILE* f)
4053
func_emit_wrapper yes |
4054
$SED -e 's/\([\\"]\)/\\\1/g' \
4055
-e 's/^/ fputs ("/' -e 's/$/\\n", f);/'
4061
# end: func_emit_cwrapperexe_src
4063
# func_win32_import_lib_p ARG
4064
# True if ARG is an import lib, as indicated by $file_magic_cmd
4065
func_win32_import_lib_p ()
4068
case `eval $file_magic_cmd \"\$1\" 2>/dev/null | $SED -e 10q` in
4074
# func_mode_link arg...
4079
*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
1100
4080
# It is impossible to link a dll without this setting, and
1101
4081
# we shouldn't force the makefile maintainer to figure out
1102
4082
# which system we are compiling for in order to pass an extra
4867
7821
# Replace the output file specification.
4868
link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`
7822
link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`
4870
7824
# Delete the old output files.
4871
$run $rm $output $output_objdir/$outputname $output_objdir/lt-$outputname
7825
$opt_dry_run || $RM $output $output_objdir/$outputname $output_objdir/lt-$outputname
4873
$show "$link_command"
4874
$run eval "$link_command" || exit $?
7827
func_show_eval "$link_command" 'exit $?'
4876
7829
# Now create the wrapper script.
4877
$show "creating $output"
7830
func_verbose "creating $output"
4879
7832
# Quote the relink command for shipping.
4880
7833
if test -n "$relink_command"; then
4881
7834
# Preserve any variables that may affect compiler behavior
4882
7835
for var in $variables_saved_for_relink; do
4883
7836
if eval test -z \"\${$var+set}\"; then
4884
relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command"
7837
relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command"
4885
7838
elif eval var_value=\$$var; test -z "$var_value"; then
4886
7839
relink_command="$var=; export $var; $relink_command"
4888
var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"`
4889
relink_command="$var=\"$var_value\"; export $var; $relink_command"
7841
func_quote_for_eval "$var_value"
7842
relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command"
4892
7845
relink_command="(cd `pwd`; $relink_command)"
4893
relink_command=`$echo "X$relink_command" | $SP2NL | $Xsed -e "$sed_quote_subst" | $NL2SP`
4896
# Quote $echo for shipping.
4897
if test "X$echo" = "X$SHELL $progpath --fallback-echo"; then
4899
[\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $progpath --fallback-echo";;
4900
*) qecho="$SHELL `pwd`/$progpath --fallback-echo";;
4902
qecho=`$echo "X$qecho" | $Xsed -e "$sed_quote_subst"`
4904
qecho=`$echo "X$echo" | $Xsed -e "$sed_quote_subst"`
4907
# Only actually do things if our run command is non-null.
4908
if test -z "$run"; then
7846
relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"`
7849
# Only actually do things if not in dry run mode.
4909
7851
# win32 will think the script is a binary if it has
4910
7852
# a .exe suffix, so we strip it off here.
4911
7853
case $output in
4912
*.exe) output=`$echo $output|${SED} 's,.exe$,,'` ;;
7854
*.exe) func_stripname '' '.exe' "$output"
7855
output=$func_stripname_result ;;
4914
7857
# test for cygwin because mv fails w/o .exe extensions
4918
outputname=`$echo $outputname|${SED} 's,.exe$,,'` ;;
7861
func_stripname '' '.exe' "$outputname"
7862
outputname=$func_stripname_result ;;
4922
7866
*cygwin* | *mingw* )
4923
output_name=`basename $output`
4924
output_path=`dirname $output`
4925
cwrappersource="$output_path/$objdir/lt-$output_name.c"
4926
cwrapper="$output_path/$output_name.exe"
4927
$rm $cwrappersource $cwrapper
4928
trap "$rm $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15
4930
cat > $cwrappersource <<EOF
4932
/* $cwrappersource - temporary wrapper executable for $objdir/$outputname
4933
Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
4935
The $output program cannot be directly executed until all the libtool
4936
libraries that it depends on are installed.
4938
This wrapper executable should never be moved out of the build directory.
4939
If it is, it will not operate correctly.
4941
Currently, it simply execs the wrapper *script* "/bin/sh $output",
4942
but could eventually absorb all of the scripts functionality and
4943
exec $objdir/$outputname directly.
4946
cat >> $cwrappersource<<"EOF"
4955
#include <sys/stat.h>
4957
#if defined(PATH_MAX)
4958
# define LT_PATHMAX PATH_MAX
4959
#elif defined(MAXPATHLEN)
4960
# define LT_PATHMAX MAXPATHLEN
4962
# define LT_PATHMAX 1024
4965
#ifndef DIR_SEPARATOR
4966
# define DIR_SEPARATOR '/'
4967
# define PATH_SEPARATOR ':'
4970
#if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \
4972
# define HAVE_DOS_BASED_FILE_SYSTEM
4973
# ifndef DIR_SEPARATOR_2
4974
# define DIR_SEPARATOR_2 '\\'
4976
# ifndef PATH_SEPARATOR_2
4977
# define PATH_SEPARATOR_2 ';'
4981
#ifndef DIR_SEPARATOR_2
4982
# define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR)
4983
#else /* DIR_SEPARATOR_2 */
4984
# define IS_DIR_SEPARATOR(ch) \
4985
(((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2))
4986
#endif /* DIR_SEPARATOR_2 */
4988
#ifndef PATH_SEPARATOR_2
4989
# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR)
4990
#else /* PATH_SEPARATOR_2 */
4991
# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2)
4992
#endif /* PATH_SEPARATOR_2 */
4994
#define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type)))
4995
#define XFREE(stale) do { \
4996
if (stale) { free ((void *) stale); stale = 0; } \
4999
/* -DDEBUG is fairly common in CFLAGS. */
5001
#if defined DEBUGWRAPPER
5002
# define DEBUG(format, ...) fprintf(stderr, format, __VA_ARGS__)
5004
# define DEBUG(format, ...)
5007
const char *program_name = NULL;
5009
void * xmalloc (size_t num);
5010
char * xstrdup (const char *string);
5011
const char * base_name (const char *name);
5012
char * find_executable(const char *wrapper);
5013
int check_executable(const char *path);
5014
char * strendzap(char *str, const char *pat);
5015
void lt_fatal (const char *message, ...);
5018
main (int argc, char *argv[])
5023
program_name = (char *) xstrdup (base_name (argv[0]));
5024
DEBUG("(main) argv[0] : %s\n",argv[0]);
5025
DEBUG("(main) program_name : %s\n",program_name);
5026
newargz = XMALLOC(char *, argc+2);
5029
cat >> $cwrappersource <<EOF
5030
newargz[0] = (char *) xstrdup("$SHELL");
5033
cat >> $cwrappersource <<"EOF"
5034
newargz[1] = find_executable(argv[0]);
5035
if (newargz[1] == NULL)
5036
lt_fatal("Couldn't find %s", argv[0]);
5037
DEBUG("(main) found exe at : %s\n",newargz[1]);
5038
/* we know the script has the same name, without the .exe */
5039
/* so make sure newargz[1] doesn't end in .exe */
5040
strendzap(newargz[1],".exe");
5041
for (i = 1; i < argc; i++)
5042
newargz[i+1] = xstrdup(argv[i]);
5043
newargz[argc+1] = NULL;
5045
for (i=0; i<argc+1; i++)
5047
DEBUG("(main) newargz[%d] : %s\n",i,newargz[i]);
5055
cat >> $cwrappersource <<EOF
5056
execv("$SHELL",(char const **)newargz);
5060
cat >> $cwrappersource <<EOF
5061
execv("$SHELL",newargz);
5066
cat >> $cwrappersource <<"EOF"
5071
xmalloc (size_t num)
5073
void * p = (void *) malloc (num);
5075
lt_fatal ("Memory exhausted");
5081
xstrdup (const char *string)
5083
return string ? strcpy ((char *) xmalloc (strlen (string) + 1), string) : NULL
5088
base_name (const char *name)
5092
#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
5093
/* Skip over the disk name in MSDOS pathnames. */
5094
if (isalpha ((unsigned char)name[0]) && name[1] == ':')
5098
for (base = name; *name; name++)
5099
if (IS_DIR_SEPARATOR (*name))
5105
check_executable(const char * path)
5109
DEBUG("(check_executable) : %s\n", path ? (*path ? path : "EMPTY!") : "NULL!");
5110
if ((!path) || (!*path))
5113
if ((stat (path, &st) >= 0) &&
5115
/* MinGW & native WIN32 do not support S_IXOTH or S_IXGRP */
5116
#if defined (S_IXOTH)
5117
((st.st_mode & S_IXOTH) == S_IXOTH) ||
5119
#if defined (S_IXGRP)
5120
((st.st_mode & S_IXGRP) == S_IXGRP) ||
5122
((st.st_mode & S_IXUSR) == S_IXUSR))
5129
/* Searches for the full path of the wrapper. Returns
5130
newly allocated full path name if found, NULL otherwise */
5132
find_executable (const char* wrapper)
5137
/* static buffer for getcwd */
5138
char tmp[LT_PATHMAX + 1];
5142
DEBUG("(find_executable) : %s\n", wrapper ? (*wrapper ? wrapper : "EMPTY!") : "NULL!");
5144
if ((wrapper == NULL) || (*wrapper == '\0'))
5147
/* Absolute path? */
5148
#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
5149
if (isalpha ((unsigned char)wrapper[0]) && wrapper[1] == ':')
5151
concat_name = xstrdup (wrapper);
5152
if (check_executable(concat_name))
5159
if (IS_DIR_SEPARATOR (wrapper[0]))
5161
concat_name = xstrdup (wrapper);
5162
if (check_executable(concat_name))
5166
#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
5170
for (p = wrapper; *p; p++)
5178
/* no slashes; search PATH */
5179
const char* path = getenv ("PATH");
5182
for (p = path; *p; p = p_next)
5186
for (q = p; *q; q++)
5187
if (IS_PATH_SEPARATOR(*q))
5190
p_next = (*q == '\0' ? q : q + 1);
5193
/* empty path: current directory */
5194
if (getcwd (tmp, LT_PATHMAX) == NULL)
5195
lt_fatal ("getcwd failed");
5196
tmp_len = strlen(tmp);
5197
concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1);
5198
memcpy (concat_name, tmp, tmp_len);
5199
concat_name[tmp_len] = '/';
5200
strcpy (concat_name + tmp_len + 1, wrapper);
5204
concat_name = XMALLOC(char, p_len + 1 + strlen(wrapper) + 1);
5205
memcpy (concat_name, p, p_len);
5206
concat_name[p_len] = '/';
5207
strcpy (concat_name + p_len + 1, wrapper);
5209
if (check_executable(concat_name))
7867
func_dirname_and_basename "$output" "" "."
7868
output_name=$func_basename_result
7869
output_path=$func_dirname_result
7870
cwrappersource="$output_path/$objdir/lt-$output_name.c"
7871
cwrapper="$output_path/$output_name.exe"
7872
$RM $cwrappersource $cwrapper
7873
trap "$RM $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15
7875
func_emit_cwrapperexe_src > $cwrappersource
7877
# The wrapper executable is built using the $host compiler,
7878
# because it contains $host paths and files. If cross-
7879
# compiling, it, like the target executable, must be
7880
# executed on the $host or under an emulation environment.
7882
$LTCC $LTCFLAGS -o $cwrapper $cwrappersource
7886
# Now, create the wrapper script for func_source use:
7887
func_ltwrapper_scriptname $cwrapper
7888
$RM $func_ltwrapper_scriptname_result
7889
trap "$RM $func_ltwrapper_scriptname_result; exit $EXIT_FAILURE" 1 2 15
7891
# note: this script will not be executed, so do not chmod.
7892
if test "x$build" = "x$host" ; then
7893
$cwrapper --lt-dump-script > $func_ltwrapper_scriptname_result
7895
func_emit_wrapper no > $func_ltwrapper_scriptname_result
7901
trap "$RM $output; exit $EXIT_FAILURE" 1 2 15
7903
func_emit_wrapper no > $output
5214
/* not found in PATH; assume curdir */
5216
/* Relative path | not found in path: prepend cwd */
5217
if (getcwd (tmp, LT_PATHMAX) == NULL)
5218
lt_fatal ("getcwd failed");
5219
tmp_len = strlen(tmp);
5220
concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1);
5221
memcpy (concat_name, tmp, tmp_len);
5222
concat_name[tmp_len] = '/';
5223
strcpy (concat_name + tmp_len + 1, wrapper);
5225
if (check_executable(concat_name))
5232
strendzap(char *str, const char *pat)
5236
assert(str != NULL);
5237
assert(pat != NULL);
5240
patlen = strlen(pat);
5244
str += len - patlen;
5245
if (strcmp(str, pat) == 0)
5252
lt_error_core (int exit_status, const char * mode,
5253
const char * message, va_list ap)
5255
fprintf (stderr, "%s: %s: ", program_name, mode);
5256
vfprintf (stderr, message, ap);
5257
fprintf (stderr, ".\n");
5259
if (exit_status >= 0)
5264
lt_fatal (const char *message, ...)
5267
va_start (ap, message);
5268
lt_error_core (EXIT_FAILURE, "FATAL", message, ap);
5272
# we should really use a build-platform specific compiler
5273
# here, but OTOH, the wrappers (shell script and this C one)
5274
# are only useful if you want to execute the "real" binary.
5275
# Since the "real" binary is built for $host, then this
5276
# wrapper might as well be built for $host, too.
5277
$run $LTCC $LTCFLAGS -s -o $cwrapper $cwrappersource
5281
trap "$rm $output; exit $EXIT_FAILURE" 1 2 15
5286
# $output - temporary wrapper script for $objdir/$outputname
5287
# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
5289
# The $output program cannot be directly executed until all the libtool
5290
# libraries that it depends on are installed.
5292
# This wrapper script should never be moved out of the build directory.
5293
# If it is, it will not operate correctly.
5295
# Sed substitution that helps us do robust quoting. It backslashifies
5296
# metacharacters that are still active within double-quoted strings.
5297
Xsed='${SED} -e 1s/^X//'
5298
sed_quote_subst='$sed_quote_subst'
5300
# Be Bourne compatible (taken from Autoconf:_AS_BOURNE_COMPATIBLE).
5301
if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then
5304
# Zsh 3.x and 4.x performs word splitting on \${1+\"\$@\"}, which
5305
# is contrary to our usage. Disable this feature.
5306
alias -g '\${1+\"\$@\"}'='\"\$@\"'
5307
setopt NO_GLOB_SUBST
5309
case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac
5311
BIN_SH=xpg4; export BIN_SH # for Tru64
5312
DUALCASE=1; export DUALCASE # for MKS sh
5314
# The HP-UX ksh and POSIX shell print the target directory to stdout
5316
(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
5318
relink_command=\"$relink_command\"
5320
# This environment variable determines our operation mode.
5321
if test \"\$libtool_install_magic\" = \"$magic\"; then
5322
# install mode needs the following variable:
5323
notinst_deplibs='$notinst_deplibs'
5325
# When we are sourced in execute mode, \$file and \$echo are already set.
5326
if test \"\$libtool_execute_magic\" != \"$magic\"; then
5329
# Make sure echo works.
5330
if test \"X\$1\" = X--no-reexec; then
5331
# Discard the --no-reexec flag, and continue.
5333
elif test \"X\`(\$echo '\t') 2>/dev/null\`\" = 'X\t'; then
5334
# Yippee, \$echo works!
5337
# Restart under the correct shell, and then maybe \$echo will work.
5338
exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"}
5344
# Find the directory that this script lives in.
5345
thisdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\`
5346
test \"x\$thisdir\" = \"x\$file\" && thisdir=.
5348
# Follow symbolic links until we get to the real thisdir.
5349
file=\`ls -ld \"\$file\" | ${SED} -n 's/.*-> //p'\`
5350
while test -n \"\$file\"; do
5351
destdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\`
5353
# If there was a directory component, then change thisdir.
5354
if test \"x\$destdir\" != \"x\$file\"; then
5355
case \"\$destdir\" in
5356
[\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;;
5357
*) thisdir=\"\$thisdir/\$destdir\" ;;
5361
file=\`\$echo \"X\$file\" | \$Xsed -e 's%^.*/%%'\`
5362
file=\`ls -ld \"\$thisdir/\$file\" | ${SED} -n 's/.*-> //p'\`
5365
# Try to get the absolute directory name.
5366
absdir=\`cd \"\$thisdir\" && pwd\`
5367
test -n \"\$absdir\" && thisdir=\"\$absdir\"
5370
if test "$fast_install" = yes; then
5372
program=lt-'$outputname'$exeext
5373
progdir=\"\$thisdir/$objdir\"
5375
if test ! -f \"\$progdir/\$program\" || \\
5376
{ file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\
5377
test \"X\$file\" != \"X\$progdir/\$program\"; }; then
5379
file=\"\$\$-\$program\"
5381
if test ! -d \"\$progdir\"; then
5382
$mkdir \"\$progdir\"
5384
$rm \"\$progdir/\$file\"
5389
# relink executable if necessary
5390
if test -n \"\$relink_command\"; then
5391
if relink_command_output=\`eval \$relink_command 2>&1\`; then :
5393
$echo \"\$relink_command_output\" >&2
5394
$rm \"\$progdir/\$file\"
5399
$mv \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null ||
5400
{ $rm \"\$progdir/\$program\";
5401
$mv \"\$progdir/\$file\" \"\$progdir/\$program\"; }
5402
$rm \"\$progdir/\$file\"
5406
program='$outputname'
5407
progdir=\"\$thisdir/$objdir\"
5413
if test -f \"\$progdir/\$program\"; then"
5415
# Export our shlibpath_var if we have one.
5416
if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
5418
# Add our own library path to $shlibpath_var
5419
$shlibpath_var=\"$temp_rpath\$$shlibpath_var\"
5421
# Some systems cannot cope with colon-terminated $shlibpath_var
5422
# The second colon is a workaround for a bug in BeOS R4 sed
5423
$shlibpath_var=\`\$echo \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\`
5425
export $shlibpath_var
5429
# fixup the dll searchpath if we need to.
5430
if test -n "$dllsearchpath"; then
5432
# Add the dll search path components to the executable PATH
5433
PATH=$dllsearchpath:\$PATH
5438
if test \"\$libtool_execute_magic\" != \"$magic\"; then
5439
# Run the actual program with our arguments.
5442
# Backslashes separate directories on plain windows
5443
*-*-mingw | *-*-os2*)
5445
exec \"\$progdir\\\\\$program\" \${1+\"\$@\"}
5451
exec \"\$progdir/\$program\" \${1+\"\$@\"}
5456
\$echo \"\$0: cannot exec \$program \$*\"
5460
# The program doesn't exist.
5461
\$echo \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2
5462
\$echo \"This script is just a wrapper for \$program.\" 1>&2
5463
$echo \"See the $PACKAGE documentation for more information.\" 1>&2
5470
7908
exit $EXIT_SUCCESS
5755
8207
# Directory that this library needs to be installed in:
5756
8208
libdir='$install_libdir'"
5757
8209
if test "$installed" = no && test "$need_relink" = yes; then
5759
8211
relink_command=\"$relink_command\""
5764
8216
# Do a symbolic link so that the libtool archive can be found in
5765
8217
# LD_LIBRARY_PATH before the program is installed.
5766
$show "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)"
5767
$run eval '(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)' || exit $?
5773
# libtool install mode
5775
modename="$modename: install"
5777
# There may be an optional sh(1) argument at the beginning of
5778
# install_prog (especially on Windows NT).
5779
if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh ||
5780
# Allow the use of GNU shtool's install command.
5781
$echo "X$nonopt" | grep shtool > /dev/null; then
5782
# Aesthetically quote it.
5783
arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"`
5785
*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
5789
install_prog="$arg "
5797
# The real first argument should be the name of the installation program.
5798
# Aesthetically quote it.
5799
arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
5801
*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
5805
install_prog="$install_prog$arg"
5807
# We need to accept at least all the BSD install flags.
5817
if test -n "$dest"; then
5818
files="$files $dest"
5826
case " $install_prog " in
5831
-g | -m | -o) prev=$arg ;;
5839
# If the previous option needed an argument, then skip it.
5840
if test -n "$prev"; then
5849
# Aesthetically quote the argument.
5850
arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
5852
*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
5856
install_prog="$install_prog $arg"
5859
if test -z "$install_prog"; then
5860
$echo "$modename: you must specify an install program" 1>&2
5865
if test -n "$prev"; then
5866
$echo "$modename: the \`$prev' option requires an argument" 1>&2
5871
if test -z "$files"; then
5872
if test -z "$dest"; then
5873
$echo "$modename: no file or destination specified" 1>&2
5875
$echo "$modename: you must specify a destination" 1>&2
5881
# Strip any trailing slash from the destination.
5882
dest=`$echo "X$dest" | $Xsed -e 's%/$%%'`
5884
# Check to see that the destination is a directory.
5885
test -d "$dest" && isdir=yes
5886
if test "$isdir" = yes; then
5890
destdir=`$echo "X$dest" | $Xsed -e 's%/[^/]*$%%'`
5891
test "X$destdir" = "X$dest" && destdir=.
5892
destname=`$echo "X$dest" | $Xsed -e 's%^.*/%%'`
5894
# Not a directory, so check to see that there is only one file specified.
5896
if test "$#" -gt 2; then
5897
$echo "$modename: \`$dest' is not a directory" 1>&2
5903
[\\/]* | [A-Za-z]:[\\/]*) ;;
5905
for file in $files; do
5909
$echo "$modename: \`$destdir' must be an absolute directory name" 1>&2
5918
# This variable tells wrapper scripts just to set variables rather
5919
# than running their programs.
5920
libtool_install_magic="$magic"
5925
for file in $files; do
5927
# Do each installation.
5930
# Do the static libraries later.
5931
staticlibs="$staticlibs $file"
5935
# Check to see that this really is a libtool archive.
5936
if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
5938
$echo "$modename: \`$file' is not a valid libtool archive" 1>&2
5946
# If there is no directory component, then add one.
5948
*/* | *\\*) . $file ;;
5952
# Add the libdir to current_libdirs if it is the destination.
5953
if test "X$destdir" = "X$libdir"; then
5954
case "$current_libdirs " in
5956
*) current_libdirs="$current_libdirs $libdir" ;;
5959
# Note the libdir as a future libdir.
5960
case "$future_libdirs " in
5962
*) future_libdirs="$future_libdirs $libdir" ;;
5966
dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`/
5967
test "X$dir" = "X$file/" && dir=
5970
if test -n "$relink_command"; then
5971
# Determine the prefix the user has applied to our future dir.
5972
inst_prefix_dir=`$echo "$destdir" | $SED "s%$libdir\$%%"`
5974
# Don't allow the user to place us outside of our expected
5975
# location b/c this prevents finding dependent libraries that
5976
# are installed to the same prefix.
5977
# At present, this check doesn't affect windows .dll's that
5978
# are installed into $libdir/../bin (currently, that works fine)
5979
# but it's something to keep an eye on.
5980
if test "$inst_prefix_dir" = "$destdir"; then
5981
$echo "$modename: error: cannot install \`$file' to a directory not ending in $libdir" 1>&2
5985
if test -n "$inst_prefix_dir"; then
5986
# Stick the inst_prefix_dir data into the link command.
5987
relink_command=`$echo "$relink_command" | $SP2NL | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%" | $NL2SP`
5989
relink_command=`$echo "$relink_command" | $SP2NL | $SED "s%@inst_prefix_dir@%%" | $NL2SP`
5992
$echo "$modename: warning: relinking \`$file'" 1>&2
5993
$show "$relink_command"
5994
if $run eval "$relink_command"; then :
5996
$echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
6001
# See the names of the shared library.
6002
set dummy $library_names
6003
if test -n "$2"; then
6009
test -n "$relink_command" && srcname="$realname"T
6011
# Install the shared library and build the symlinks.
6012
$show "$install_prog $dir/$srcname $destdir/$realname"
6013
$run eval "$install_prog $dir/$srcname $destdir/$realname" || exit $?
6014
if test -n "$stripme" && test -n "$striplib"; then
6015
$show "$striplib $destdir/$realname"
6016
$run eval "$striplib $destdir/$realname" || exit $?
6019
if test "$#" -gt 0; then
6020
# Delete the old symlinks, and create new ones.
6021
# Try `ln -sf' first, because the `ln' binary might depend on
6022
# the symlink we replace! Solaris /bin/ln does not understand -f,
6023
# so we also need to try rm && ln -s.
6026
if test "$linkname" != "$realname"; then
6027
$show "(cd $destdir && { $LN_S -f $realname $linkname || { $rm $linkname && $LN_S $realname $linkname; }; })"
6028
$run eval "(cd $destdir && { $LN_S -f $realname $linkname || { $rm $linkname && $LN_S $realname $linkname; }; })"
6033
# Do each command in the postinstall commands.
6034
lib="$destdir/$realname"
6035
cmds=$postinstall_cmds
6036
save_ifs="$IFS"; IFS='~'
6037
for cmd in $cmds; do
6041
$run eval "$cmd" || {
6044
# Restore the uninstalled library and exit
6045
if test "$mode" = relink; then
6046
$run eval '(cd $output_objdir && $rm ${realname}T && $mv ${realname}U $realname)'
6055
# Install the pseudo-library for information purposes.
6056
name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
6057
instname="$dir/$name"i
6058
$show "$install_prog $instname $destdir/$name"
6059
$run eval "$install_prog $instname $destdir/$name" || exit $?
6061
# Maybe install the static library, too.
6062
test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library"
6066
# Install (i.e. copy) a libtool object.
6068
# Figure out destination file name, if it wasn't already specified.
6069
if test -n "$destname"; then
6070
destfile="$destdir/$destname"
6072
destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
6073
destfile="$destdir/$destfile"
6076
# Deduce the name of the destination old-style object file.
6079
staticdest=`$echo "X$destfile" | $Xsed -e "$lo2o"`
6082
staticdest="$destfile"
6086
$echo "$modename: cannot copy a libtool object to \`$destfile'" 1>&2
6092
# Install the libtool object if requested.
6093
if test -n "$destfile"; then
6094
$show "$install_prog $file $destfile"
6095
$run eval "$install_prog $file $destfile" || exit $?
6098
# Install the old object if enabled.
6099
if test "$build_old_libs" = yes; then
6100
# Deduce the name of the old-style object file.
6101
staticobj=`$echo "X$file" | $Xsed -e "$lo2o"`
6103
$show "$install_prog $staticobj $staticdest"
6104
$run eval "$install_prog \$staticobj \$staticdest" || exit $?
6110
# Figure out destination file name, if it wasn't already specified.
6111
if test -n "$destname"; then
6112
destfile="$destdir/$destname"
6114
destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
6115
destfile="$destdir/$destfile"
6118
# If the file is missing, and there is a .exe on the end, strip it
6119
# because it is most likely a libtool script we actually want to
6124
if test ! -f "$file"; then
6125
file=`$echo $file|${SED} 's,.exe$,,'`
6131
# Do a test to see if this is really a libtool program.
6134
wrapper=`$echo $file | ${SED} -e 's,.exe$,,'`
6140
if (${SED} -e '4q' $wrapper | grep "^# Generated by .*$PACKAGE")>/dev/null 2>&1; then
6144
# Note that it is not necessary on cygwin/mingw to append a dot to
6145
# foo even if both foo and FILE.exe exist: automatic-append-.exe
6146
# behavior happens only for exec(3), not for open(2)! Also, sourcing
6147
# `FILE.' does not work on cygwin managed mounts.
6149
# If there is no directory component, then add one.
6151
*/* | *\\*) . ${wrapper} ;;
6152
*) . ./${wrapper} ;;
6155
# Check the variables that should have been set.
6156
if test -z "$notinst_deplibs"; then
6157
$echo "$modename: invalid libtool wrapper script \`$wrapper'" 1>&2
6162
for lib in $notinst_deplibs; do
6163
# Check to see that each library is installed.
6165
if test -f "$lib"; then
6166
# If there is no directory component, then add one.
6168
*/* | *\\*) . $lib ;;
6172
libfile="$libdir/"`$echo "X$lib" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test
6173
if test -n "$libdir" && test ! -f "$libfile"; then
6174
$echo "$modename: warning: \`$lib' has not been installed in \`$libdir'" 1>&2
6180
# Note that it is not necessary on cygwin/mingw to append a dot to
6181
# foo even if both foo and FILE.exe exist: automatic-append-.exe
6182
# behavior happens only for exec(3), not for open(2)! Also, sourcing
6183
# `FILE.' does not work on cygwin managed mounts.
6185
# If there is no directory component, then add one.
6187
*/* | *\\*) . ${wrapper} ;;
6188
*) . ./${wrapper} ;;
6192
if test "$fast_install" = no && test -n "$relink_command"; then
6193
if test "$finalize" = yes && test -z "$run"; then
6194
tmpdir=`func_mktempdir`
6195
file=`$echo "X$file$stripped_ext" | $Xsed -e 's%^.*/%%'`
6196
outputname="$tmpdir/$file"
6197
# Replace the output file specification.
6198
relink_command=`$echo "X$relink_command" | $SP2NL | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g' | $NL2SP`
6200
$show "$relink_command"
6201
if $run eval "$relink_command"; then :
6203
$echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
6209
$echo "$modename: warning: cannot relink \`$file'" 1>&2
6212
# Install the binary that we compiled earlier.
6213
file=`$echo "X$file$stripped_ext" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"`
6217
# remove .exe since cygwin /usr/bin/install will append another
6219
case $install_prog,$host in
6220
*/usr/bin/install*,*cygwin*)
6221
case $file:$destfile in
6226
destfile=$destfile.exe
6229
destfile=`$echo $destfile | ${SED} -e 's,.exe$,,'`
6234
$show "$install_prog$stripme $file $destfile"
6235
$run eval "$install_prog\$stripme \$file \$destfile" || exit $?
6236
test -n "$outputname" && ${rm}r "$tmpdir"
6241
for file in $staticlibs; do
6242
name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
6244
# Set up the ranlib parameters.
6245
oldlib="$destdir/$name"
6247
$show "$install_prog $file $oldlib"
6248
$run eval "$install_prog \$file \$oldlib" || exit $?
6250
if test -n "$stripme" && test -n "$old_striplib"; then
6251
$show "$old_striplib $oldlib"
6252
$run eval "$old_striplib $oldlib" || exit $?
6255
# Do each command in the postinstall commands.
6256
cmds=$old_postinstall_cmds
6257
save_ifs="$IFS"; IFS='~'
6258
for cmd in $cmds; do
6262
$run eval "$cmd" || exit $?
6267
if test -n "$future_libdirs"; then
6268
$echo "$modename: warning: remember to run \`$progname --finish$future_libdirs'" 1>&2
6271
if test -n "$current_libdirs"; then
6272
# Maybe just do a dry run.
6273
test -n "$run" && current_libdirs=" -n$current_libdirs"
6274
exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs'
6280
# libtool finish mode
6282
modename="$modename: finish"
6286
if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
6289
libdirs="$libdirs $dir"
6292
for libdir in $libdirs; do
6293
if test -n "$finish_cmds"; then
6294
# Do each command in the finish commands.
6296
save_ifs="$IFS"; IFS='~'
6297
for cmd in $cmds; do
6301
$run eval "$cmd" || admincmds="$admincmds
6306
if test -n "$finish_eval"; then
6307
# Do the single finish_eval.
6308
eval cmds=\"$finish_eval\"
6309
$run eval "$cmds" || admincmds="$admincmds
6315
# Exit here if they wanted silent mode.
6316
test "$show" = : && exit $EXIT_SUCCESS
6318
$echo "X----------------------------------------------------------------------" | $Xsed
6319
$echo "Libraries have been installed in:"
6320
for libdir in $libdirs; do
6324
$echo "If you ever happen to want to link against installed libraries"
6325
$echo "in a given directory, LIBDIR, you must either use libtool, and"
6326
$echo "specify the full pathname of the library, or use the \`-LLIBDIR'"
6327
$echo "flag during linking and do at least one of the following:"
6328
if test -n "$shlibpath_var"; then
6329
$echo " - add LIBDIR to the \`$shlibpath_var' environment variable"
6330
$echo " during execution"
6332
if test -n "$runpath_var"; then
6333
$echo " - add LIBDIR to the \`$runpath_var' environment variable"
6334
$echo " during linking"
6336
if test -n "$hardcode_libdir_flag_spec"; then
6338
eval flag=\"$hardcode_libdir_flag_spec\"
6340
$echo " - use the \`$flag' linker flag"
6342
if test -n "$admincmds"; then
6343
$echo " - have your system administrator run these commands:$admincmds"
6345
if test -f /etc/ld.so.conf; then
6346
$echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'"
6349
$echo "See any operating system documentation about shared libraries for"
6350
$echo "more information, such as the ld(1) and ld.so(8) manual pages."
6351
$echo "X----------------------------------------------------------------------" | $Xsed
6355
# libtool execute mode
6357
modename="$modename: execute"
6359
# The first argument is the command name.
6361
if test -z "$cmd"; then
6362
$echo "$modename: you must specify a COMMAND" 1>&2
6367
# Handle -dlopen flags immediately.
6368
for file in $execute_dlfiles; do
6369
if test ! -f "$file"; then
6370
$echo "$modename: \`$file' is not a file" 1>&2
6378
# Check to see that this really is a libtool archive.
6379
if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
6381
$echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
6386
# Read the libtool library.
6390
# If there is no directory component, then add one.
6392
*/* | *\\*) . $file ;;
6396
# Skip this library if it cannot be dlopened.
6397
if test -z "$dlname"; then
6398
# Warn if it was a shared library.
6399
test -n "$library_names" && $echo "$modename: warning: \`$file' was not linked with \`-export-dynamic'"
6403
dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
6404
test "X$dir" = "X$file" && dir=.
6406
if test -f "$dir/$objdir/$dlname"; then
6409
if test ! -f "$dir/$dlname"; then
6410
$echo "$modename: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2
6417
# Just add the directory containing the .lo file.
6418
dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
6419
test "X$dir" = "X$file" && dir=.
6423
$echo "$modename: warning \`-dlopen' is ignored for non-libtool libraries and objects" 1>&2
6428
# Get the absolute pathname.
6429
absdir=`cd "$dir" && pwd`
6430
test -n "$absdir" && dir="$absdir"
6432
# Now add the directory to shlibpath_var.
6433
if eval "test -z \"\$$shlibpath_var\""; then
6434
eval "$shlibpath_var=\"\$dir\""
6436
eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\""
6440
# This variable tells wrapper scripts just to set shlibpath_var
6441
# rather than running their programs.
6442
libtool_execute_magic="$magic"
6444
# Check if any of the arguments is a wrapper script.
6451
# Do a test to see if this is really a libtool program.
6452
if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
6453
# If there is no directory component, then add one.
6455
*/* | *\\*) . $file ;;
6459
# Transform arg to wrapped name.
6460
file="$progdir/$program"
6464
# Quote arguments (to preserve shell metacharacters).
6465
file=`$echo "X$file" | $Xsed -e "$sed_quote_subst"`
6466
args="$args \"$file\""
6469
if test -z "$run"; then
6470
if test -n "$shlibpath_var"; then
6471
# Export the shlibpath_var.
6472
eval "export $shlibpath_var"
6475
# Restore saved environment variables
6476
for lt_var in LANG LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
6478
eval "if test \"\${save_$lt_var+set}\" = set; then
6479
$lt_var=\$save_$lt_var; export $lt_var
6485
# Now prepare to actually exec the command.
6486
exec_cmd="\$cmd$args"
6488
# Display what would be done.
6489
if test -n "$shlibpath_var"; then
6490
eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\""
6491
$echo "export $shlibpath_var"
6498
# libtool clean and uninstall mode
6500
modename="$modename: $mode"
8218
func_show_eval '( cd "$output_objdir" && $RM "$outputname" && $LN_S "../$outputname" "$outputname" )' 'exit $?'
8224
{ test "$mode" = link || test "$mode" = relink; } &&
8225
func_mode_link ${1+"$@"}
8228
# func_mode_uninstall arg...
8229
func_mode_uninstall ()