364
176
my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null`
366
178
if test ! -d "$my_tmpdir"; then
367
# Failing that, at least try and use $RANDOM to avoid a race
368
my_tmpdir="${my_template}-${RANDOM-0}$$"
179
# Failing that, at least try and use $RANDOM to avoid a race
180
my_tmpdir="${my_template}-${RANDOM-0}$$"
370
save_mktempdir_umask=`umask`
373
umask $save_mktempdir_umask
182
save_mktempdir_umask=`umask`
185
umask $save_mktempdir_umask
376
188
# If we're not in dry-run mode, bomb out on failure
377
test -d "$my_tmpdir" || \
378
func_fatal_error "cannot create temporary directory \`$my_tmpdir'"
381
$ECHO "X$my_tmpdir" | $Xsed
385
# func_quote_for_eval arg
386
# Aesthetically quote ARG to be evaled later.
387
# This function returns two values: FUNC_QUOTE_FOR_EVAL_RESULT
388
# is double-quoted, suitable for a subsequent eval, whereas
389
# FUNC_QUOTE_FOR_EVAL_UNQUOTED_RESULT has merely all characters
390
# which are still active within double quotes backslashified.
391
func_quote_for_eval ()
395
func_quote_for_eval_unquoted_result=`$ECHO "X$1" | $Xsed -e "$sed_quote_subst"` ;;
397
func_quote_for_eval_unquoted_result="$1" ;;
400
case $func_quote_for_eval_unquoted_result in
401
# Double-quote args containing shell metacharacters to delay
402
# word splitting, command substitution and and variable
403
# expansion for a subsequent eval.
404
# Many Bourne shells cannot handle close brackets correctly
405
# in scan sets, so we specify it separately.
406
*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
407
func_quote_for_eval_result="\"$func_quote_for_eval_unquoted_result\""
410
func_quote_for_eval_result="$func_quote_for_eval_unquoted_result"
415
# func_quote_for_expand arg
416
# Aesthetically quote ARG to be evaled later; same as above,
417
# but do not quote variable references.
418
func_quote_for_expand ()
422
my_arg=`$ECHO "X$1" | $Xsed \
423
-e "$double_quote_subst" -e "$sed_double_backslash"` ;;
429
# Double-quote args containing shell metacharacters to delay
430
# word splitting and command substitution for a subsequent eval.
431
# Many Bourne shells cannot handle close brackets correctly
432
# in scan sets, so we specify it separately.
433
*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
438
func_quote_for_expand_result="$my_arg"
442
# func_show_eval cmd [fail_exp]
443
# Unless opt_silent is true, then output CMD. Then, if opt_dryrun is
444
# not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP
445
# is given, then evaluate it.
451
${opt_silent-false} || {
452
func_quote_for_expand "$my_cmd"
453
eval "func_echo $func_quote_for_expand_result"
456
if ${opt_dry_run-false}; then :; else
459
if test "$my_status" -eq 0; then :; else
460
eval "(exit $my_status); $my_fail_exp"
466
# func_show_eval_locale cmd [fail_exp]
467
# Unless opt_silent is true, then output CMD. Then, if opt_dryrun is
468
# not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP
469
# is given, then evaluate it. Use the saved locale for evaluation.
470
func_show_eval_locale ()
475
${opt_silent-false} || {
476
func_quote_for_expand "$my_cmd"
477
eval "func_echo $func_quote_for_expand_result"
480
if ${opt_dry_run-false}; then :; else
481
eval "$lt_user_locale
484
eval "$lt_safe_locale"
485
if test "$my_status" -eq 0; then :; else
486
eval "(exit $my_status); $my_fail_exp"
496
# Echo version message to standard output and exit.
499
$SED -n '/^# '$PROGRAM' (GNU /,/# warranty; / {
502
s/\((C)\)[ 0-9,-]*\( [1-9][0-9]*\)/\1\2/
509
# Echo short help message to standard output and exit.
512
$SED -n '/^# Usage:/,/# -h/ {
515
s/\$progname/'$progname'/
519
$ECHO "run \`$progname --help | more' for full usage"
524
# Echo long help message to standard output and exit.
527
$SED -n '/^# Usage:/,/# Report bugs to/ {
530
s*\$progname*'$progname'*
532
s*\$SHELL*'"$SHELL"'*
534
s*\$LTCFLAGS*'"$LTCFLAGS"'*
536
s/\$with_gnu_ld/'"$with_gnu_ld"'/
537
s/\$automake_version/'"`(automake --version) 2>/dev/null |$SED 1q`"'/
538
s/\$autoconf_version/'"`(autoconf --version) 2>/dev/null |$SED 1q`"'/
544
# func_missing_arg argname
545
# Echo program name prefixed message to standard error and set global
549
func_error "missing argument for $1"
559
# Check that we have a working $ECHO.
560
if test "X$1" = X--no-reexec; then
561
# Discard the --no-reexec flag, and continue.
563
elif test "X$1" = X--fallback-echo; then
564
# Avoid inline document here, it may be left over
566
elif test "X`{ $ECHO '\t'; } 2>/dev/null`" = 'X\t'; then
567
# Yippee, $ECHO works!
570
# Restart under the correct shell, and then maybe $ECHO will work.
571
exec $SHELL "$progpath" --no-reexec ${1+"$@"}
574
if test "X$1" = X--fallback-echo; then
575
# used as fallback echo
583
magic="%%%MAGIC variable%%%"
584
magic_exe="%%%MAGIC EXE variable%%%"
591
lo2o="s/\\.lo\$/.${objext}/"
592
o2lo="s/\\.${objext}\$/.lo/"
597
opt_duplicate_deps=false
601
# If this variable is set in any of the actions, the command in it
602
# will be execed at the end. This prevents here-documents from being
603
# left over by shells.
606
# func_fatal_configuration arg...
607
# Echo program name prefixed message to standard error, followed by
608
# a configuration failure hint, and exit.
609
func_fatal_configuration ()
612
func_error "See the $PACKAGE documentation for more information."
613
func_fatal_error "Fatal configuration error."
618
# Display the configuration for all the tags in this script.
621
re_begincf='^# ### BEGIN LIBTOOL'
622
re_endcf='^# ### END LIBTOOL'
624
# Default configuration.
625
$SED "1,/$re_begincf CONFIG/d;/$re_endcf CONFIG/,\$d" < "$progpath"
627
# Now print the configurations for the tags.
628
for tagname in $taglist; do
629
$SED -n "/$re_begincf TAG CONFIG: $tagname\$/,/$re_endcf TAG CONFIG: $tagname\$/p" < "$progpath"
636
# Display the features supported by this script.
640
if test "$build_libtool_libs" = yes; then
641
$ECHO "enable shared libraries"
643
$ECHO "disable shared libraries"
645
if test "$build_old_libs" = yes; then
646
$ECHO "enable static libraries"
648
$ECHO "disable static libraries"
654
# func_enable_tag tagname
655
# Verify that TAGNAME is valid, and either flag an error and exit, or
656
# enable the TAGNAME tag. We also add TAGNAME to the global $taglist
663
re_begincf="^# ### BEGIN LIBTOOL TAG CONFIG: $tagname\$"
664
re_endcf="^# ### END LIBTOOL TAG CONFIG: $tagname\$"
665
sed_extractcf="/$re_begincf/,/$re_endcf/p"
670
func_fatal_error "invalid tag name: $tagname"
674
# Don't test for the "default" C tag, as we know it's
675
# there but not specially marked.
679
if $GREP "$re_begincf" "$progpath" >/dev/null 2>&1; then
680
taglist="$taglist $tagname"
682
# Evaluate the configuration. Be careful to quote the path
683
# and the sed script, to avoid splitting on whitespace, but
684
# also don't use non-portable quotes within backquotes within
685
# quotes we have to do it in 2 steps:
686
extractedcf=`$SED -n -e "$sed_extractcf" < "$progpath"`
689
func_error "ignoring unknown tag $tagname"
695
# Parse options once, thoroughly. This comes as soon as possible in
696
# the script to make things like `libtool --version' happen quickly.
699
# Shorthand for --mode=foo, only valid as the first argument
702
shift; set dummy --mode clean ${1+"$@"}; shift
704
compile|compil|compi|comp|com|co|c)
705
shift; set dummy --mode compile ${1+"$@"}; shift
707
execute|execut|execu|exec|exe|ex|e)
708
shift; set dummy --mode execute ${1+"$@"}; shift
710
finish|finis|fini|fin|fi|f)
711
shift; set dummy --mode finish ${1+"$@"}; shift
713
install|instal|insta|inst|ins|in|i)
714
shift; set dummy --mode install ${1+"$@"}; shift
717
shift; set dummy --mode link ${1+"$@"}; shift
719
uninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u)
720
shift; set dummy --mode uninstall ${1+"$@"}; shift
724
# Parse non-mode specific arguments:
725
while test "$#" -gt 0; do
730
--config) func_config ;;
732
--debug) preserve_args="$preserve_args $opt"
733
func_echo "enabling shell trace mode"
738
-dlopen) test "$#" -eq 0 && func_missing_arg "$opt" && break
739
execute_dlfiles="$execute_dlfiles $1"
743
--dry-run | -n) opt_dry_run=: ;;
744
--features) func_features ;;
745
--finish) mode="finish" ;;
747
--mode) test "$#" -eq 0 && func_missing_arg "$opt" && break
749
# Valid mode arguments:
759
# Catch anything else as an error
760
*) func_error "invalid argument for $opt"
771
opt_duplicate_deps=: ;;
773
--quiet|--silent) preserve_args="$preserve_args $opt"
777
--verbose| -v) preserve_args="$preserve_args $opt"
781
--tag) test "$#" -eq 0 && func_missing_arg "$opt" && break
782
preserve_args="$preserve_args $opt $1"
783
func_enable_tag "$1" # tagname is set here
787
# Separate optargs to long options:
788
-dlopen=*|--mode=*|--tag=*)
789
func_opt_split "$opt"
790
set dummy "$func_opt_split_opt" "$func_opt_split_arg" ${1+"$@"}
794
-\?|-h) func_usage ;;
795
--help) opt_help=: ;;
796
--version) func_version ;;
798
-*) func_fatal_help "unrecognized option \`$opt'" ;;
808
*cygwin* | *mingw* | *pw32*)
809
# don't eliminate duplications in $postdeps and $predeps
810
opt_duplicate_compiler_generated_deps=:
813
opt_duplicate_compiler_generated_deps=$opt_duplicate_deps
817
# Having warned about all mis-specified options, bail out if
818
# anything was wrong.
819
$exit_cmd $EXIT_FAILURE
822
# func_check_version_match
823
# Ensure that we are using m4 macros, and libtool script from the same
824
# release of libtool.
825
func_check_version_match ()
827
if test "$package_revision" != "$macro_revision"; then
828
if test "$VERSION" != "$macro_version"; then
829
if test -z "$macro_version"; then
831
$progname: Version mismatch error. This is $PACKAGE $VERSION, but the
832
$progname: definition of this LT_INIT comes from an older release.
833
$progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION
834
$progname: and run autoconf again.
838
$progname: Version mismatch error. This is $PACKAGE $VERSION, but the
839
$progname: definition of this LT_INIT comes from $PACKAGE $macro_version.
840
$progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION
841
$progname: and run autoconf again.
846
$progname: Version mismatch error. This is $PACKAGE $VERSION, revision $package_revision,
847
$progname: but the definition of this LT_INIT comes from revision $macro_revision.
848
$progname: You should recreate aclocal.m4 with macros from revision $package_revision
849
$progname: of $PACKAGE $VERSION and run autoconf again.
863
# Sanity checks first:
864
func_check_version_match
866
if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
867
func_fatal_configuration "not configured to build any kind of library"
870
test -z "$mode" && func_fatal_error "error: you must specify a MODE."
874
eval std_shrext=\"$shrext_cmds\"
877
# Only execute mode is allowed to have -dlopen flags.
878
if test -n "$execute_dlfiles" && test "$mode" != execute; then
879
func_error "unrecognized option \`-dlopen'"
884
# Change the help message to a mode-specific one.
886
help="Try \`$progname --help --mode=$mode' for more information."
891
# True iff FILE is a libtool `.la' library or `.lo' object file.
892
# This function is only a basic sanity check; it will hardly flush out
893
# determined imposters.
896
$SED -e 4q "$1" 2>/dev/null \
897
| $GREP "^# Generated by .*$PACKAGE" > /dev/null 2>&1
900
# func_lalib_unsafe_p file
901
# True iff FILE is a libtool `.la' library or `.lo' object file.
902
# This function implements the same check as func_lalib_p without
903
# resorting to external programs. To this end, it redirects stdin and
904
# closes it afterwards, without saving the original file descriptor.
905
# As a safety measure, use it only where a negative result would be
906
# fatal anyway. Works if `file' does not exist.
907
func_lalib_unsafe_p ()
910
if test -r "$1" && exec 5<&0 <"$1"; then
911
for lalib_p_l in 1 2 3 4
914
case "$lalib_p_line" in
915
\#\ Generated\ by\ *$PACKAGE* ) lalib_p=yes; break;;
920
test "$lalib_p" = yes
923
# func_ltwrapper_script_p file
924
# True iff FILE is a libtool wrapper script
925
# This function is only a basic sanity check; it will hardly flush out
926
# determined imposters.
927
func_ltwrapper_script_p ()
932
# func_ltwrapper_executable_p file
933
# True iff FILE is a libtool wrapper executable
934
# This function is only a basic sanity check; it will hardly flush out
935
# determined imposters.
936
func_ltwrapper_executable_p ()
938
func_ltwrapper_exec_suffix=
941
*) func_ltwrapper_exec_suffix=.exe ;;
943
$GREP "$magic_exe" "$1$func_ltwrapper_exec_suffix" >/dev/null 2>&1
946
# func_ltwrapper_scriptname file
947
# Assumes file is an ltwrapper_executable
948
# uses $file to determine the appropriate filename for a
949
# temporary ltwrapper_script.
950
func_ltwrapper_scriptname ()
952
func_ltwrapper_scriptname_result=""
953
if func_ltwrapper_executable_p "$1"; then
954
func_dirname_and_basename "$1" "" "."
955
func_stripname '' '.exe' "$func_basename_result"
956
func_ltwrapper_scriptname_result="$func_dirname_result/$objdir/${func_stripname_result}_ltshwrapper"
960
# func_ltwrapper_p file
961
# True iff FILE is a libtool wrapper script or wrapper executable
962
# This function is only a basic sanity check; it will hardly flush out
963
# determined imposters.
966
func_ltwrapper_script_p "$1" || func_ltwrapper_executable_p "$1"
970
# func_execute_cmds commands fail_cmd
971
# Execute tilde-delimited COMMANDS.
972
# If FAIL_CMD is given, eval that upon failure.
973
# FAIL_CMD may read-access the current command in variable CMD!
977
save_ifs=$IFS; IFS='~'
981
func_show_eval "$cmd" "${2-:}"
988
# Source FILE, adding directory component if necessary.
989
# Note that it is not necessary on cygwin/mingw to append a dot to
990
# FILE even if both FILE and FILE.exe exist: automatic-append-.exe
991
# behavior happens only for exec(3), not for open(2)! Also, sourcing
992
# `FILE.' does not work on cygwin managed mounts.
997
*/* | *\\*) . "$1" ;;
189
test -d "$my_tmpdir" || {
190
$echo "cannot create temporary directory \`$my_tmpdir'" 1>&2
195
$echo "X$my_tmpdir" | $Xsed
199
# func_win32_libid arg
200
# return the library type of file 'arg'
202
# Need a lot of goo to handle *both* DLLs and import libs
203
# Has to be a shell function in order to 'eat' the argument
204
# that is supplied when $file_magic_command is called.
207
win32_libid_type="unknown"
208
win32_fileres=`file -L $1 2>/dev/null`
209
case $win32_fileres in
210
*ar\ archive\ import\ library*) # definitely import
211
win32_libid_type="x86 archive import"
213
*ar\ archive*) # could be an import, or static
214
if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | \
215
$EGREP -e 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then
216
win32_nmres=`eval $NM -f posix -A $1 | \
225
import*) win32_libid_type="x86 archive import";;
226
*) win32_libid_type="x86 archive static";;
231
win32_libid_type="x86 DLL"
233
*executable*) # but shell scripts are "executable" too...
234
case $win32_fileres in
235
*MS\ Windows\ PE\ Intel*)
236
win32_libid_type="x86 DLL"
241
$echo $win32_libid_type
1419
1057
avoid parallel builds (make -j) in this platform, or get a better
1422
$opt_dry_run || $RM $removelist
1060
$run $rm $removelist
1423
1061
exit $EXIT_FAILURE
1426
1064
# Just move the object if needed
1427
1065
if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then
1428
func_show_eval '$MV "$output_obj" "$obj"' \
1429
'error=$?; $opt_dry_run || $RM $removelist; exit $error'
1434
func_write_libtool_object "$libobj" "$objdir/$objname" "$objname"
1436
# Unlock the critical section if it was locked
1437
if test "$need_locks" != no; then
1438
removelist=$lockfile
1447
test "$mode" = compile && func_mode_compile ${1+"$@"}
1452
# We need to display help for each of the modes.
1455
# Generic help is extracted from the usage comments
1456
# at the start of this file.
1462
"Usage: $progname [OPTION]... --mode=clean RM [RM-OPTION]... FILE...
1464
Remove files from the build directory.
1466
RM is the name of the program to use to delete files associated with each FILE
1467
(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
1470
If FILE is a libtool library, object or program, all the files associated
1471
with it are deleted. Otherwise, only FILE itself is deleted using RM."
1476
"Usage: $progname [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE
1478
Compile a source file into a libtool library object.
1480
This mode accepts the following additional options:
1482
-o OUTPUT-FILE set the output file name to OUTPUT-FILE
1483
-no-suppress do not suppress compiler output for multiple passes
1484
-prefer-pic try to building PIC objects only
1485
-prefer-non-pic try to building non-PIC objects only
1486
-shared do not build a \`.o' file suitable for static linking
1487
-static only build a \`.o' file suitable for static linking
1489
COMPILE-COMMAND is a command to be used in creating a \`standard' object file
1490
from the given SOURCEFILE.
1492
The output file name is determined by removing the directory component from
1493
SOURCEFILE, then substituting the C source code suffix \`.c' with the
1494
library object suffix, \`.lo'."
1499
"Usage: $progname [OPTION]... --mode=execute COMMAND [ARGS]...
1501
Automatically set library path, then run a program.
1503
This mode accepts the following additional options:
1505
-dlopen FILE add the directory containing FILE to the library path
1507
This mode sets the library path environment variable according to \`-dlopen'
1510
If any of the ARGS are libtool executable wrappers, then they are translated
1511
into their corresponding uninstalled binary, and any of their required library
1512
directories are added to the library path.
1514
Then, COMMAND is executed, with ARGS as arguments."
1519
"Usage: $progname [OPTION]... --mode=finish [LIBDIR]...
1521
Complete the installation of libtool libraries.
1523
Each LIBDIR is a directory that contains libtool libraries.
1525
The commands that this mode executes may require superuser privileges. Use
1526
the \`--dry-run' option if you just want to see what would be executed."
1531
"Usage: $progname [OPTION]... --mode=install INSTALL-COMMAND...
1533
Install executables or libraries.
1535
INSTALL-COMMAND is the installation command. The first component should be
1536
either the \`install' or \`cp' program.
1538
The following components of INSTALL-COMMAND are treated specially:
1540
-inst-prefix PREFIX-DIR Use PREFIX-DIR as a staging area for installation
1542
The rest of the components are interpreted as arguments to that command (only
1543
BSD-compatible install options are recognized)."
1548
"Usage: $progname [OPTION]... --mode=link LINK-COMMAND...
1550
Link object files or libraries together to form another library, or to
1551
create an executable program.
1553
LINK-COMMAND is a command using the C compiler that you would use to create
1554
a program from several object files.
1556
The following components of LINK-COMMAND are treated specially:
1558
-all-static do not do any dynamic linking at all
1559
-avoid-version do not add a version suffix if possible
1560
-dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime
1561
-dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols
1562
-export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
1563
-export-symbols SYMFILE
1564
try to export only the symbols listed in SYMFILE
1565
-export-symbols-regex REGEX
1566
try to export only the symbols matching REGEX
1567
-LLIBDIR search LIBDIR for required installed libraries
1568
-lNAME OUTPUT-FILE requires the installed library libNAME
1569
-module build a library that can dlopened
1570
-no-fast-install disable the fast-install mode
1571
-no-install link a not-installable executable
1572
-no-undefined declare that a library does not refer to external symbols
1573
-o OUTPUT-FILE create OUTPUT-FILE from the specified objects
1574
-objectlist FILE Use a list of object files found in FILE to specify objects
1575
-precious-files-regex REGEX
1576
don't remove output files matching REGEX
1577
-release RELEASE specify package release information
1578
-rpath LIBDIR the created library will eventually be installed in LIBDIR
1579
-R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries
1580
-shared only do dynamic linking of libtool libraries
1581
-shrext SUFFIX override the standard shared library file extension
1582
-static do not do any dynamic linking of uninstalled libtool libraries
1583
-static-libtool-libs
1584
do not do any dynamic linking of libtool libraries
1585
-version-info CURRENT[:REVISION[:AGE]]
1586
specify library version info [each variable defaults to 0]
1587
-weak LIBNAME declare that the target provides the LIBNAME interface
1589
All other options (arguments beginning with \`-') are ignored.
1591
Every other argument is treated as a filename. Files ending in \`.la' are
1592
treated as uninstalled libtool libraries, other files are standard or library
1595
If the OUTPUT-FILE ends in \`.la', then a libtool library is created,
1596
only library objects (\`.lo' files) may be specified, and \`-rpath' is
1597
required, except when creating a convenience library.
1599
If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created
1600
using \`ar' and \`ranlib', or on Windows using \`lib'.
1602
If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file
1603
is created, otherwise an executable program is created."
1608
"Usage: $progname [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE...
1610
Remove libraries from an installation directory.
1612
RM is the name of the program to use to delete files associated with each FILE
1613
(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
1616
If FILE is a libtool library, all the files associated with it are deleted.
1617
Otherwise, only FILE itself is deleted using RM."
1621
func_fatal_help "invalid operation mode \`$mode'"
1626
$ECHO "Try \`$progname --help' for more information about other modes."
1631
# Now that we've collected a possible --mode arg, show help if necessary
1632
$opt_help && func_mode_help
1635
# func_mode_execute arg...
1636
func_mode_execute ()
1639
# The first argument is the command name.
1642
func_fatal_help "you must specify a COMMAND"
1644
# Handle -dlopen flags immediately.
1645
for file in $execute_dlfiles; do
1647
|| func_fatal_help "\`$file' is not a file"
1652
# Check to see that this really is a libtool archive.
1653
func_lalib_unsafe_p "$file" \
1654
|| func_fatal_help "\`$lib' is not a valid libtool archive"
1656
# Read the libtool library.
1661
# Skip this library if it cannot be dlopened.
1662
if test -z "$dlname"; then
1663
# Warn if it was a shared library.
1664
test -n "$library_names" && \
1665
func_warning "\`$file' was not linked with \`-export-dynamic'"
1669
func_dirname "$file" "" "."
1670
dir="$func_dirname_result"
1672
if test -f "$dir/$objdir/$dlname"; then
1675
if test ! -f "$dir/$dlname"; then
1676
func_fatal_error "cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'"
1682
# Just add the directory containing the .lo file.
1683
func_dirname "$file" "" "."
1684
dir="$func_dirname_result"
1688
func_warning "\`-dlopen' is ignored for non-libtool libraries and objects"
1693
# Get the absolute pathname.
1694
absdir=`cd "$dir" && pwd`
1695
test -n "$absdir" && dir="$absdir"
1697
# Now add the directory to shlibpath_var.
1698
if eval "test -z \"\$$shlibpath_var\""; then
1699
eval "$shlibpath_var=\"\$dir\""
1701
eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\""
1705
# This variable tells wrapper scripts just to set shlibpath_var
1706
# rather than running their programs.
1707
libtool_execute_magic="$magic"
1709
# Check if any of the arguments is a wrapper script.
1716
# Do a test to see if this is really a libtool program.
1717
if func_ltwrapper_script_p "$file"; then
1719
# Transform arg to wrapped name.
1720
file="$progdir/$program"
1721
elif func_ltwrapper_executable_p "$file"; then
1722
func_ltwrapper_scriptname "$file"
1723
func_source "$func_ltwrapper_scriptname_result"
1724
# Transform arg to wrapped name.
1725
file="$progdir/$program"
1729
# Quote arguments (to preserve shell metacharacters).
1730
func_quote_for_eval "$file"
1731
args="$args $func_quote_for_eval_result"
1734
if test "X$opt_dry_run" = Xfalse; then
1735
if test -n "$shlibpath_var"; then
1736
# Export the shlibpath_var.
1737
eval "export $shlibpath_var"
1740
# Restore saved environment variables
1741
for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
1743
eval "if test \"\${save_$lt_var+set}\" = set; then
1744
$lt_var=\$save_$lt_var; export $lt_var
1750
# Now prepare to actually exec the command.
1751
exec_cmd="\$cmd$args"
1753
# Display what would be done.
1754
if test -n "$shlibpath_var"; then
1755
eval "\$ECHO \"\$shlibpath_var=\$$shlibpath_var\""
1756
$ECHO "export $shlibpath_var"
1763
test "$mode" = execute && func_mode_execute ${1+"$@"}
1766
# func_mode_finish arg...
1773
if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
1776
libdirs="$libdirs $dir"
1779
for libdir in $libdirs; do
1780
if test -n "$finish_cmds"; then
1781
# Do each command in the finish commands.
1782
func_execute_cmds "$finish_cmds" 'admincmds="$admincmds
1785
if test -n "$finish_eval"; then
1786
# Do the single finish_eval.
1787
eval cmds=\"$finish_eval\"
1788
$opt_dry_run || eval "$cmds" || admincmds="$admincmds
1794
# Exit here if they wanted silent mode.
1795
$opt_silent && exit $EXIT_SUCCESS
1797
$ECHO "X----------------------------------------------------------------------" | $Xsed
1798
$ECHO "Libraries have been installed in:"
1799
for libdir in $libdirs; do
1803
$ECHO "If you ever happen to want to link against installed libraries"
1804
$ECHO "in a given directory, LIBDIR, you must either use libtool, and"
1805
$ECHO "specify the full pathname of the library, or use the \`-LLIBDIR'"
1806
$ECHO "flag during linking and do at least one of the following:"
1807
if test -n "$shlibpath_var"; then
1808
$ECHO " - add LIBDIR to the \`$shlibpath_var' environment variable"
1809
$ECHO " during execution"
1811
if test -n "$runpath_var"; then
1812
$ECHO " - add LIBDIR to the \`$runpath_var' environment variable"
1813
$ECHO " during linking"
1815
if test -n "$hardcode_libdir_flag_spec"; then
1817
eval flag=\"$hardcode_libdir_flag_spec\"
1819
$ECHO " - use the \`$flag' linker flag"
1821
if test -n "$admincmds"; then
1822
$ECHO " - have your system administrator run these commands:$admincmds"
1824
if test -f /etc/ld.so.conf; then
1825
$ECHO " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'"
1829
$ECHO "See any operating system documentation about shared libraries for"
1831
solaris2.[6789]|solaris2.1[0-9])
1832
$ECHO "more information, such as the ld(1), crle(1) and ld.so(8) manual"
1836
$ECHO "more information, such as the ld(1) and ld.so(8) manual pages."
1839
$ECHO "X----------------------------------------------------------------------" | $Xsed
1843
test "$mode" = finish && func_mode_finish ${1+"$@"}
1846
# func_mode_install arg...
1847
func_mode_install ()
1850
# There may be an optional sh(1) argument at the beginning of
1851
# install_prog (especially on Windows NT).
1852
if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh ||
1853
# Allow the use of GNU shtool's install command.
1854
$ECHO "X$nonopt" | $GREP shtool >/dev/null; then
1855
# Aesthetically quote it.
1856
func_quote_for_eval "$nonopt"
1857
install_prog="$func_quote_for_eval_result "
1865
# The real first argument should be the name of the installation program.
1866
# Aesthetically quote it.
1867
func_quote_for_eval "$arg"
1868
install_prog="$install_prog$func_quote_for_eval_result"
1870
# We need to accept at least all the BSD install flags.
1880
if test -n "$dest"; then
1881
files="$files $dest"
1889
case " $install_prog " in
1904
# If the previous option needed an argument, then skip it.
1905
if test -n "$prev"; then
1914
# Aesthetically quote the argument.
1915
func_quote_for_eval "$arg"
1916
install_prog="$install_prog $func_quote_for_eval_result"
1919
test -z "$install_prog" && \
1920
func_fatal_help "you must specify an install program"
1922
test -n "$prev" && \
1923
func_fatal_help "the \`$prev' option requires an argument"
1925
if test -z "$files"; then
1926
if test -z "$dest"; then
1927
func_fatal_help "no file or destination specified"
1929
func_fatal_help "you must specify a destination"
1933
# Strip any trailing slash from the destination.
1934
func_stripname '' '/' "$dest"
1935
dest=$func_stripname_result
1937
# Check to see that the destination is a directory.
1938
test -d "$dest" && isdir=yes
1939
if test "$isdir" = yes; then
1943
func_dirname_and_basename "$dest" "" "."
1944
destdir="$func_dirname_result"
1945
destname="$func_basename_result"
1947
# Not a directory, so check to see that there is only one file specified.
1948
set dummy $files; shift
1949
test "$#" -gt 1 && \
1950
func_fatal_help "\`$dest' is not a directory"
1953
[\\/]* | [A-Za-z]:[\\/]*) ;;
1955
for file in $files; do
1959
func_fatal_help "\`$destdir' must be an absolute directory name"
1966
# This variable tells wrapper scripts just to set variables rather
1967
# than running their programs.
1968
libtool_install_magic="$magic"
1973
for file in $files; do
1975
# Do each installation.
1978
# Do the static libraries later.
1979
staticlibs="$staticlibs $file"
1983
# Check to see that this really is a libtool archive.
1984
func_lalib_unsafe_p "$file" \
1985
|| func_fatal_help "\`$file' is not a valid libtool archive"
1992
# Add the libdir to current_libdirs if it is the destination.
1993
if test "X$destdir" = "X$libdir"; then
1994
case "$current_libdirs " in
1996
*) current_libdirs="$current_libdirs $libdir" ;;
1999
# Note the libdir as a future libdir.
2000
case "$future_libdirs " in
2002
*) future_libdirs="$future_libdirs $libdir" ;;
2006
func_dirname "$file" "/" ""
2007
dir="$func_dirname_result"
2010
if test -n "$relink_command"; then
2011
# Determine the prefix the user has applied to our future dir.
2012
inst_prefix_dir=`$ECHO "X$destdir" | $Xsed -e "s%$libdir\$%%"`
2014
# Don't allow the user to place us outside of our expected
2015
# location b/c this prevents finding dependent libraries that
2016
# are installed to the same prefix.
2017
# At present, this check doesn't affect windows .dll's that
2018
# are installed into $libdir/../bin (currently, that works fine)
2019
# but it's something to keep an eye on.
2020
test "$inst_prefix_dir" = "$destdir" && \
2021
func_fatal_error "error: cannot install \`$file' to a directory not ending in $libdir"
2023
if test -n "$inst_prefix_dir"; then
2024
# Stick the inst_prefix_dir data into the link command.
2025
relink_command=`$ECHO "X$relink_command" | $Xsed -e "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"`
2027
relink_command=`$ECHO "X$relink_command" | $Xsed -e "s%@inst_prefix_dir@%%"`
2030
func_warning "relinking \`$file'"
2031
func_show_eval "$relink_command" \
2032
'func_fatal_error "error: relink \`$file'\'' with the above command before installing it"'
2035
# See the names of the shared library.
2036
set dummy $library_names; shift
2037
if test -n "$1"; then
2042
test -n "$relink_command" && srcname="$realname"T
2044
# Install the shared library and build the symlinks.
2045
func_show_eval "$install_prog $dir/$srcname $destdir/$realname" \
2049
cygwin* | mingw* | pw32*)
2057
if test -n "$tstripme" && test -n "$striplib"; then
2058
func_show_eval "$striplib $destdir/$realname" 'exit $?'
2061
if test "$#" -gt 0; then
2062
# Delete the old symlinks, and create new ones.
2063
# Try `ln -sf' first, because the `ln' binary might depend on
2064
# the symlink we replace! Solaris /bin/ln does not understand -f,
2065
# so we also need to try rm && ln -s.
2068
test "$linkname" != "$realname" \
2069
&& func_show_eval "(cd $destdir && { $LN_S -f $realname $linkname || { $RM $linkname && $LN_S $realname $linkname; }; })"
2073
# Do each command in the postinstall commands.
2074
lib="$destdir/$realname"
2075
func_execute_cmds "$postinstall_cmds" 'exit $?'
2078
# Install the pseudo-library for information purposes.
2079
func_basename "$file"
2080
name="$func_basename_result"
2081
instname="$dir/$name"i
2082
func_show_eval "$install_prog $instname $destdir/$name" 'exit $?'
2084
# Maybe install the static library, too.
2085
test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library"
2089
# Install (i.e. copy) a libtool object.
2091
# Figure out destination file name, if it wasn't already specified.
2092
if test -n "$destname"; then
2093
destfile="$destdir/$destname"
2095
func_basename "$file"
2096
destfile="$func_basename_result"
2097
destfile="$destdir/$destfile"
2100
# Deduce the name of the destination old-style object file.
2103
func_lo2o "$destfile"
2104
staticdest=$func_lo2o_result
2107
staticdest="$destfile"
2111
func_fatal_help "cannot copy a libtool object to \`$destfile'"
2115
# Install the libtool object if requested.
2116
test -n "$destfile" && \
2117
func_show_eval "$install_prog $file $destfile" 'exit $?'
2119
# Install the old object if enabled.
2120
if test "$build_old_libs" = yes; then
2121
# Deduce the name of the old-style object file.
2123
staticobj=$func_lo2o_result
2124
func_show_eval "$install_prog \$staticobj \$staticdest" 'exit $?'
2130
# Figure out destination file name, if it wasn't already specified.
2131
if test -n "$destname"; then
2132
destfile="$destdir/$destname"
2134
func_basename "$file"
2135
destfile="$func_basename_result"
2136
destfile="$destdir/$destfile"
2139
# If the file is missing, and there is a .exe on the end, strip it
2140
# because it is most likely a libtool script we actually want to
2145
if test ! -f "$file"; then
2146
func_stripname '' '.exe' "$file"
2147
file=$func_stripname_result
2153
# Do a test to see if this is really a libtool program.
2156
if func_ltwrapper_executable_p "$file"; then
2157
func_ltwrapper_scriptname "$file"
2158
wrapper=$func_ltwrapper_scriptname_result
2160
func_stripname '' '.exe' "$file"
2161
wrapper=$func_stripname_result
2168
if func_ltwrapper_script_p "$wrapper"; then
2172
func_source "$wrapper"
2174
# Check the variables that should have been set.
2175
test -z "$generated_by_libtool_version" && \
2176
func_fatal_error "invalid libtool wrapper script \`$wrapper'"
2179
for lib in $notinst_deplibs; do
2180
# Check to see that each library is installed.
2182
if test -f "$lib"; then
2185
libfile="$libdir/"`$ECHO "X$lib" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test
2186
if test -n "$libdir" && test ! -f "$libfile"; then
2187
func_warning "\`$lib' has not been installed in \`$libdir'"
2193
func_source "$wrapper"
2196
if test "$fast_install" = no && test -n "$relink_command"; then
2198
if test "$finalize" = yes; then
2199
tmpdir=`func_mktempdir`
2200
func_basename "$file$stripped_ext"
2201
file="$func_basename_result"
2202
outputname="$tmpdir/$file"
2203
# Replace the output file specification.
2204
relink_command=`$ECHO "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'`
2207
func_quote_for_expand "$relink_command"
2208
eval "func_echo $func_quote_for_expand_result"
2210
if eval "$relink_command"; then :
2212
func_error "error: relink \`$file' with the above command before installing it"
2213
$opt_dry_run || ${RM}r "$tmpdir"
2218
func_warning "cannot relink \`$file'"
2222
# Install the binary that we compiled earlier.
2223
file=`$ECHO "X$file$stripped_ext" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"`
2227
# remove .exe since cygwin /usr/bin/install will append another
2229
case $install_prog,$host in
2230
*/usr/bin/install*,*cygwin*)
2231
case $file:$destfile in
2236
destfile=$destfile.exe
2239
func_stripname '' '.exe' "$destfile"
2240
destfile=$func_stripname_result
2245
func_show_eval "$install_prog\$stripme \$file \$destfile" 'exit $?'
2246
$opt_dry_run || if test -n "$outputname"; then
2253
for file in $staticlibs; do
2254
func_basename "$file"
2255
name="$func_basename_result"
2257
# Set up the ranlib parameters.
2258
oldlib="$destdir/$name"
2260
func_show_eval "$install_prog \$file \$oldlib" 'exit $?'
2262
if test -n "$stripme" && test -n "$old_striplib"; then
2263
func_show_eval "$old_striplib $oldlib" 'exit $?'
2266
# Do each command in the postinstall commands.
2267
func_execute_cmds "$old_postinstall_cmds" 'exit $?'
2270
test -n "$future_libdirs" && \
2271
func_warning "remember to run \`$progname --finish$future_libdirs'"
2273
if test -n "$current_libdirs"; then
2274
# Maybe just do a dry run.
2275
$opt_dry_run && current_libdirs=" -n$current_libdirs"
2276
exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs'
2282
test "$mode" = install && func_mode_install ${1+"$@"}
2285
# func_generate_dlsyms outputname originator pic_p
2286
# Extract symbols from dlprefiles and create ${outputname}S.o with
2287
# a dlpreopen symbol table.
2288
func_generate_dlsyms ()
2294
my_prefix=`$ECHO "$my_originator" | sed 's%[^a-zA-Z0-9]%_%g'`
2297
if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
2298
if test -n "$NM" && test -n "$global_symbol_pipe"; then
2299
my_dlsyms="${my_outputname}S.c"
2301
func_error "not configured to extract global symbols from dlpreopened files"
2305
if test -n "$my_dlsyms"; then
2309
# Discover the nlist of each of the dlfiles.
2310
nlist="$output_objdir/${my_outputname}.nm"
2312
func_show_eval "$RM $nlist ${nlist}S ${nlist}T"
2314
# Parse the name list into a source file.
2315
func_verbose "creating $output_objdir/$my_dlsyms"
2317
$opt_dry_run || $ECHO > "$output_objdir/$my_dlsyms" "\
2318
/* $my_dlsyms - symbol resolution table for \`$my_outputname' dlsym emulation. */
2319
/* Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION */
2325
/* External symbol declarations for the compiler. */\
2328
if test "$dlself" = yes; then
2329
func_verbose "generating symbol list for \`$output'"
2331
$opt_dry_run || echo ': @PROGRAM@ ' > "$nlist"
2333
# Add our own program objects to the symbol list.
2334
progfiles=`$ECHO "X$objs$old_deplibs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
2335
for progfile in $progfiles; do
2336
func_verbose "extracting global C symbols from \`$progfile'"
2337
$opt_dry_run || eval "$NM $progfile | $global_symbol_pipe >> '$nlist'"
2340
if test -n "$exclude_expsyms"; then
2342
eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
2343
eval '$MV "$nlist"T "$nlist"'
2347
if test -n "$export_symbols_regex"; then
2349
eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T'
2350
eval '$MV "$nlist"T "$nlist"'
2354
# Prepare the list of exported symbols
2355
if test -z "$export_symbols"; then
2356
export_symbols="$output_objdir/$outputname.exp"
2359
eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
2361
*cygwin* | *mingw* )
2362
eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
2363
eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"'
2369
eval "${SED} -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"'
2370
eval '$GREP -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T'
2371
eval '$MV "$nlist"T "$nlist"'
2374
eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
2375
eval 'cat "$nlist" >> "$output_objdir/$outputname.def"'
2382
for dlprefile in $dlprefiles; do
2383
func_verbose "extracting global C symbols from \`$dlprefile'"
2384
func_basename "$dlprefile"
2385
name="$func_basename_result"
2387
eval '$ECHO ": $name " >> "$nlist"'
2388
eval "$NM $dlprefile 2>/dev/null | $global_symbol_pipe >> '$nlist'"
2393
# Make sure we have at least an empty file.
2394
test -f "$nlist" || : > "$nlist"
2396
if test -n "$exclude_expsyms"; then
2397
$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T
2398
$MV "$nlist"T "$nlist"
2401
# Try sorting and uniquifying the output.
2402
if $GREP -v "^: " < "$nlist" |
2403
if sort -k 3 </dev/null >/dev/null 2>&1; then
2408
uniq > "$nlist"S; then
2411
$GREP -v "^: " < "$nlist" > "$nlist"S
2414
if test -f "$nlist"S; then
2415
eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$my_dlsyms"'
2417
$ECHO '/* NONE */' >> "$output_objdir/$my_dlsyms"
2420
$ECHO >> "$output_objdir/$my_dlsyms" "\
2422
/* The mapping between symbol names and symbols. */
2429
*cygwin* | *mingw* )
2430
$ECHO >> "$output_objdir/$my_dlsyms" "\
2431
/* DATA imports from DLLs on WIN32 con't be const, because
2432
runtime relocations are performed -- see ld's documentation
2433
on pseudo-relocs. */"
2436
echo >> "$output_objdir/$my_dlsyms" "\
2437
/* This system does not cope well with relocations in const data */"
2440
lt_dlsym_const=const ;;
2443
$ECHO >> "$output_objdir/$my_dlsyms" "\
2444
extern $lt_dlsym_const lt_dlsymlist
2445
lt_${my_prefix}_LTX_preloaded_symbols[];
2446
$lt_dlsym_const lt_dlsymlist
2447
lt_${my_prefix}_LTX_preloaded_symbols[] =
2449
{ \"$my_originator\", (void *) 0 },"
2451
case $need_lib_prefix in
2453
eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$my_dlsyms"
2456
eval "$global_symbol_to_c_name_address_lib_prefix" < "$nlist" >> "$output_objdir/$my_dlsyms"
2459
$ECHO >> "$output_objdir/$my_dlsyms" "\
2463
/* This works around a problem in FreeBSD linker */
2464
#ifdef FREEBSD_WORKAROUND
2465
static const void *lt_preloaded_setup() {
2466
return lt_${my_prefix}_LTX_preloaded_symbols;
2476
pic_flag_for_symtable=
2477
case "$compile_command " in
2481
# compiling the symbol table file with pic_flag works around
2482
# a FreeBSD bug that causes programs to crash when -lm is
2483
# linked before any other PIC object. But we must not use
2484
# pic_flag when linking with -static. The problem exists in
2485
# FreeBSD 2.2.6 and is fixed in FreeBSD 3.1.
2486
*-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)
2487
pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND" ;;
2489
pic_flag_for_symtable=" $pic_flag" ;;
2491
if test "X$my_pic_p" != Xno; then
2492
pic_flag_for_symtable=" $pic_flag"
2499
for arg in $LTCFLAGS; do
2501
-pie | -fpie | -fPIE) ;;
2502
*) symtab_cflags="$symtab_cflags $arg" ;;
2506
# Now compile the dynamic symbol file.
2507
func_show_eval '(cd $output_objdir && $LTCC$symtab_cflags -c$no_builtin_flag$pic_flag_for_symtable "$my_dlsyms")' 'exit $?'
2509
# Clean up the generated files.
2510
func_show_eval '$RM "$output_objdir/$my_dlsyms" "$nlist" "${nlist}S" "${nlist}T"'
2512
# Transform the symbol file into the correct name.
2513
symfileobj="$output_objdir/${my_outputname}S.$objext"
2515
*cygwin* | *mingw* )
2516
if test -f "$output_objdir/$my_outputname.def"; then
2517
compile_command=`$ECHO "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"`
2518
finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"`
2520
compile_command=`$ECHO "X$compile_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"`
2521
finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"`
2525
compile_command=`$ECHO "X$compile_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"`
2526
finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"`
2531
func_fatal_error "unknown suffix for \`$my_dlsyms'"
2535
# We keep going just in case the user didn't refer to
2536
# lt_preloaded_symbols. The linker will fail if global_symbol_pipe
2537
# really was required.
2539
# Nullify the symbol file.
2540
compile_command=`$ECHO "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"`
2541
finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"`
2545
# func_win32_libid arg
2546
# return the library type of file 'arg'
2548
# Need a lot of goo to handle *both* DLLs and import libs
2549
# Has to be a shell function in order to 'eat' the argument
2550
# that is supplied when $file_magic_command is called.
2554
win32_libid_type="unknown"
2555
win32_fileres=`file -L $1 2>/dev/null`
2556
case $win32_fileres in
2557
*ar\ archive\ import\ library*) # definitely import
2558
win32_libid_type="x86 archive import"
2560
*ar\ archive*) # could be an import, or static
2561
if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null |
2562
$EGREP 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then
2563
win32_nmres=`eval $NM -f posix -A $1 |
2572
case $win32_nmres in
2573
import*) win32_libid_type="x86 archive import";;
2574
*) win32_libid_type="x86 archive static";;
2579
win32_libid_type="x86 DLL"
2581
*executable*) # but shell scripts are "executable" too...
2582
case $win32_fileres in
2583
*MS\ Windows\ PE\ Intel*)
2584
win32_libid_type="x86 DLL"
2589
$ECHO "$win32_libid_type"
2594
# func_extract_an_archive dir oldlib
2595
func_extract_an_archive ()
2598
f_ex_an_ar_dir="$1"; shift
2599
f_ex_an_ar_oldlib="$1"
2600
func_show_eval "(cd \$f_ex_an_ar_dir && $AR x \"\$f_ex_an_ar_oldlib\")" 'exit $?'
2601
if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then
2604
func_fatal_error "object name conflicts in archive: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib"
2609
# func_extract_archives gentop oldlib ...
2610
func_extract_archives ()
2613
my_gentop="$1"; shift
2614
my_oldlibs=${1+"$@"}
2620
for my_xlib in $my_oldlibs; do
2621
# Extract the objects.
2623
[\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;;
2624
*) my_xabs=`pwd`"/$my_xlib" ;;
2626
func_basename "$my_xlib"
2627
my_xlib="$func_basename_result"
2630
case " $extracted_archives " in
2632
func_arith $extracted_serial + 1
2633
extracted_serial=$func_arith_result
2634
my_xlib_u=lt$extracted_serial-$my_xlib ;;
2638
extracted_archives="$extracted_archives $my_xlib_u"
2639
my_xdir="$my_gentop/$my_xlib_u"
2641
func_mkdir_p "$my_xdir"
2645
func_verbose "Extracting $my_xabs"
2646
# Do not bother doing anything if just a dry run
2648
darwin_orig_dir=`pwd`
2649
cd $my_xdir || exit $?
2650
darwin_archive=$my_xabs
2652
darwin_base_archive=`basename "$darwin_archive"`
2653
darwin_arches=`$LIPO -info "$darwin_archive" 2>/dev/null | $GREP Architectures 2>/dev/null || true`
2654
if test -n "$darwin_arches"; then
2655
darwin_arches=`$ECHO "$darwin_arches" | $SED -e 's/.*are://'`
2657
func_verbose "$darwin_base_archive has multiple architectures $darwin_arches"
2658
for darwin_arch in $darwin_arches ; do
2659
func_mkdir_p "unfat-$$/${darwin_base_archive}-${darwin_arch}"
2660
$LIPO -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}"
2661
cd "unfat-$$/${darwin_base_archive}-${darwin_arch}"
2662
func_extract_an_archive "`pwd`" "${darwin_base_archive}"
2664
$RM "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}"
2665
done # $darwin_arches
2666
## Okay now we've a bunch of thin objects, gotta fatten them up :)
2667
darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print | $SED -e "$basename" | sort -u`
2670
for darwin_file in $darwin_filelist; do
2671
darwin_files=`find unfat-$$ -name $darwin_file -print | $NL2SP`
2672
$LIPO -create -output "$darwin_file" $darwin_files
2673
done # $darwin_filelist
2675
cd "$darwin_orig_dir"
2678
func_extract_an_archive "$my_xdir" "$my_xabs"
2683
func_extract_an_archive "$my_xdir" "$my_xabs"
2686
my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP`
2689
func_extract_archives_result="$my_oldobjs"
2694
# func_emit_wrapper arg
2696
# emit a libtool wrapper script on stdout
2697
# don't directly open a file because we may want to
2698
# incorporate the script contents within a cygwin/mingw
2699
# wrapper executable. Must ONLY be called from within
2700
# func_mode_link because it depends on a number of variable
2703
# arg is the value that the WRAPPER_SCRIPT_BELONGS_IN_OBJDIR
2704
# variable will take. If 'yes', then the emitted script
2705
# will assume that the directory in which it is stored is
2706
# the '.lib' directory. This is a cygwin/mingw-specific
2708
func_emit_wrapper ()
2710
func_emit_wrapper_arg1=no
2711
if test -n "$1" ; then
2712
func_emit_wrapper_arg1=$1
2718
# $output - temporary wrapper script for $objdir/$outputname
2719
# Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
2721
# The $output program cannot be directly executed until all the libtool
2722
# libraries that it depends on are installed.
2724
# This wrapper script should never be moved out of the build directory.
2725
# If it is, it will not operate correctly.
2727
# Sed substitution that helps us do robust quoting. It backslashifies
2728
# metacharacters that are still active within double-quoted strings.
2729
Xsed='${SED} -e 1s/^X//'
2730
sed_quote_subst='$sed_quote_subst'
2732
# Be Bourne compatible
2733
if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then
2736
# Zsh 3.x and 4.x performs word splitting on \${1+\"\$@\"}, which
2737
# is contrary to our usage. Disable this feature.
2738
alias -g '\${1+\"\$@\"}'='\"\$@\"'
2739
setopt NO_GLOB_SUBST
2741
case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac
2743
BIN_SH=xpg4; export BIN_SH # for Tru64
2744
DUALCASE=1; export DUALCASE # for MKS sh
2746
# The HP-UX ksh and POSIX shell print the target directory to stdout
2748
(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
2750
relink_command=\"$relink_command\"
2752
# This environment variable determines our operation mode.
2753
if test \"\$libtool_install_magic\" = \"$magic\"; then
2754
# install mode needs the following variables:
2755
generated_by_libtool_version='$macro_version'
2756
notinst_deplibs='$notinst_deplibs'
2758
# When we are sourced in execute mode, \$file and \$ECHO are already set.
2759
if test \"\$libtool_execute_magic\" != \"$magic\"; then
2762
# Make sure echo works.
2763
if test \"X\$1\" = X--no-reexec; then
2764
# Discard the --no-reexec flag, and continue.
2766
elif test \"X\`{ \$ECHO '\t'; } 2>/dev/null\`\" = 'X\t'; then
2767
# Yippee, \$ECHO works!
2770
# Restart under the correct shell, and then maybe \$ECHO will work.
2771
exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"}
2777
# Find the directory that this script lives in.
2778
thisdir=\`\$ECHO \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\`
2779
test \"x\$thisdir\" = \"x\$file\" && thisdir=.
2781
# Follow symbolic links until we get to the real thisdir.
2782
file=\`ls -ld \"\$file\" | ${SED} -n 's/.*-> //p'\`
2783
while test -n \"\$file\"; do
2784
destdir=\`\$ECHO \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\`
2786
# If there was a directory component, then change thisdir.
2787
if test \"x\$destdir\" != \"x\$file\"; then
2788
case \"\$destdir\" in
2789
[\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;;
2790
*) thisdir=\"\$thisdir/\$destdir\" ;;
2794
file=\`\$ECHO \"X\$file\" | \$Xsed -e 's%^.*/%%'\`
2795
file=\`ls -ld \"\$thisdir/\$file\" | ${SED} -n 's/.*-> //p'\`
2798
# Usually 'no', except on cygwin/mingw when embedded into
2800
WRAPPER_SCRIPT_BELONGS_IN_OBJDIR=$func_emit_wrapper_arg1
2801
if test \"\$WRAPPER_SCRIPT_BELONGS_IN_OBJDIR\" = \"yes\"; then
2802
# special case for '.'
2803
if test \"\$thisdir\" = \".\"; then
2806
# remove .libs from thisdir
2807
case \"\$thisdir\" in
2808
*[\\\\/]$objdir ) thisdir=\`\$ECHO \"X\$thisdir\" | \$Xsed -e 's%[\\\\/][^\\\\/]*$%%'\` ;;
2809
$objdir ) thisdir=. ;;
2813
# Try to get the absolute directory name.
2814
absdir=\`cd \"\$thisdir\" && pwd\`
2815
test -n \"\$absdir\" && thisdir=\"\$absdir\"
2818
if test "$fast_install" = yes; then
2820
program=lt-'$outputname'$exeext
2821
progdir=\"\$thisdir/$objdir\"
2823
if test ! -f \"\$progdir/\$program\" ||
2824
{ file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\
2825
test \"X\$file\" != \"X\$progdir/\$program\"; }; then
2827
file=\"\$\$-\$program\"
2829
if test ! -d \"\$progdir\"; then
2830
$MKDIR \"\$progdir\"
2832
$RM \"\$progdir/\$file\"
2837
# relink executable if necessary
2838
if test -n \"\$relink_command\"; then
2839
if relink_command_output=\`eval \$relink_command 2>&1\`; then :
2841
$ECHO \"\$relink_command_output\" >&2
2842
$RM \"\$progdir/\$file\"
2847
$MV \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null ||
2848
{ $RM \"\$progdir/\$program\";
2849
$MV \"\$progdir/\$file\" \"\$progdir/\$program\"; }
2850
$RM \"\$progdir/\$file\"
2854
program='$outputname'
2855
progdir=\"\$thisdir/$objdir\"
2861
if test -f \"\$progdir/\$program\"; then"
2863
# Export our shlibpath_var if we have one.
2864
if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
2866
# Add our own library path to $shlibpath_var
2867
$shlibpath_var=\"$temp_rpath\$$shlibpath_var\"
2869
# Some systems cannot cope with colon-terminated $shlibpath_var
2870
# The second colon is a workaround for a bug in BeOS R4 sed
2871
$shlibpath_var=\`\$ECHO \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\`
2873
export $shlibpath_var
2877
# fixup the dll searchpath if we need to.
2878
if test -n "$dllsearchpath"; then
2880
# Add the dll search path components to the executable PATH
2881
PATH=$dllsearchpath:\$PATH
2886
if test \"\$libtool_execute_magic\" != \"$magic\"; then
2887
# Run the actual program with our arguments.
2890
# Backslashes separate directories on plain windows
2891
*-*-mingw | *-*-os2*)
2893
exec \"\$progdir\\\\\$program\" \${1+\"\$@\"}
2899
exec \"\$progdir/\$program\" \${1+\"\$@\"}
2904
\$ECHO \"\$0: cannot exec \$program \$*\" 1>&2
2908
# The program doesn't exist.
2909
\$ECHO \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2
2910
\$ECHO \"This script is just a wrapper for \$program.\" 1>&2
2911
$ECHO \"See the $PACKAGE documentation for more information.\" 1>&2
2917
# end: func_emit_wrapper
2919
# func_emit_cwrapperexe_src
2920
# emit the source code for a wrapper executable on stdout
2921
# Must ONLY be called from within func_mode_link because
2922
# it depends on a number of variable set therein.
2923
func_emit_cwrapperexe_src ()
2927
/* $cwrappersource - temporary wrapper executable for $objdir/$outputname
2928
Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
2930
The $output program cannot be directly executed until all the libtool
2931
libraries that it depends on are installed.
2933
This wrapper executable should never be moved out of the build directory.
2934
If it is, it will not operate correctly.
2936
Currently, it simply execs the wrapper *script* "$SHELL $output",
2937
but could eventually absorb all of the scripts functionality and
2938
exec $objdir/$outputname directly.
2945
# include <direct.h>
2946
# include <process.h>
2948
# define setmode _setmode
2950
# include <unistd.h>
2951
# include <stdint.h>
2963
#include <sys/stat.h>
2965
#if defined(PATH_MAX)
2966
# define LT_PATHMAX PATH_MAX
2967
#elif defined(MAXPATHLEN)
2968
# define LT_PATHMAX MAXPATHLEN
2970
# define LT_PATHMAX 1024
2981
# define S_IXUSR _S_IEXEC
2983
# ifndef _INTPTR_T_DEFINED
2984
# define intptr_t int
2988
#ifndef DIR_SEPARATOR
2989
# define DIR_SEPARATOR '/'
2990
# define PATH_SEPARATOR ':'
2993
#if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \
2995
# define HAVE_DOS_BASED_FILE_SYSTEM
2996
# define FOPEN_WB "wb"
2997
# ifndef DIR_SEPARATOR_2
2998
# define DIR_SEPARATOR_2 '\\'
3000
# ifndef PATH_SEPARATOR_2
3001
# define PATH_SEPARATOR_2 ';'
3005
#ifndef DIR_SEPARATOR_2
3006
# define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR)
3007
#else /* DIR_SEPARATOR_2 */
3008
# define IS_DIR_SEPARATOR(ch) \
3009
(((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2))
3010
#endif /* DIR_SEPARATOR_2 */
3012
#ifndef PATH_SEPARATOR_2
3013
# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR)
3014
#else /* PATH_SEPARATOR_2 */
3015
# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2)
3016
#endif /* PATH_SEPARATOR_2 */
3019
# define FOPEN_WB "wb"
3023
# define FOPEN_WB "w"
3026
# define _O_BINARY 0
3029
#define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type)))
3030
#define XFREE(stale) do { \
3031
if (stale) { free ((void *) stale); stale = 0; } \
3034
#undef LTWRAPPER_DEBUGPRINTF
3035
#if defined DEBUGWRAPPER
3036
# define LTWRAPPER_DEBUGPRINTF(args) ltwrapper_debugprintf args
3038
ltwrapper_debugprintf (const char *fmt, ...)
3041
va_start (args, fmt);
3042
(void) vfprintf (stderr, fmt, args);
3046
# define LTWRAPPER_DEBUGPRINTF(args)
3049
const char *program_name = NULL;
3051
void *xmalloc (size_t num);
3052
char *xstrdup (const char *string);
3053
const char *base_name (const char *name);
3054
char *find_executable (const char *wrapper);
3055
char *chase_symlinks (const char *pathspec);
3056
int make_executable (const char *path);
3057
int check_executable (const char *path);
3058
char *strendzap (char *str, const char *pat);
3059
void lt_fatal (const char *message, ...);
3061
static const char *script_text =
3064
func_emit_wrapper yes |
3065
$SED -e 's/\([\\"]\)/\\\1/g' \
3066
-e 's/^/ "/' -e 's/$/\\n"/'
3070
const char * MAGIC_EXE = "$magic_exe";
3073
main (int argc, char *argv[])
3077
char *actual_cwrapper_path;
3078
char *shwrapper_name;
3079
intptr_t rval = 127;
3082
const char *dumpscript_opt = "--lt-dump-script";
3085
program_name = (char *) xstrdup (base_name (argv[0]));
3086
LTWRAPPER_DEBUGPRINTF (("(main) argv[0] : %s\n", argv[0]));
3087
LTWRAPPER_DEBUGPRINTF (("(main) program_name : %s\n", program_name));
3089
/* very simple arg parsing; don't want to rely on getopt */
3090
for (i = 1; i < argc; i++)
3092
if (strcmp (argv[i], dumpscript_opt) == 0)
3096
*mingw* | *cygwin* )
3097
# make stdout use "unix" line endings
3098
echo " setmode(1,_O_BINARY);"
3103
printf ("%s", script_text);
3108
newargz = XMALLOC (char *, argc + 2);
3111
if test -n "$TARGETSHELL" ; then
3112
# no path translation at all
3113
lt_newargv0=$TARGETSHELL
3117
# awkward: cmd appends spaces to result
3118
lt_sed_strip_trailing_spaces="s/[ ]*\$//"
3119
lt_newargv0=`( cmd //c echo $SHELL | $SED -e "$lt_sed_strip_trailing_spaces" ) 2>/dev/null || echo $SHELL`
3120
case $lt_newargv0 in
3122
*) lt_newargv0=$lt_newargv0.exe ;;
3125
* ) lt_newargv0=$SHELL ;;
3130
newargz[0] = (char *) xstrdup ("$lt_newargv0");
3134
tmp_pathspec = find_executable (argv[0]);
3135
if (tmp_pathspec == NULL)
3136
lt_fatal ("Couldn't find %s", argv[0]);
3137
LTWRAPPER_DEBUGPRINTF (("(main) found exe (before symlink chase) at : %s\n",
3140
actual_cwrapper_path = chase_symlinks (tmp_pathspec);
3141
LTWRAPPER_DEBUGPRINTF (("(main) found exe (after symlink chase) at : %s\n",
3142
actual_cwrapper_path));
3143
XFREE (tmp_pathspec);
3145
shwrapper_name = (char *) xstrdup (base_name (actual_cwrapper_path));
3146
strendzap (actual_cwrapper_path, shwrapper_name);
3148
/* shwrapper_name transforms */
3149
strendzap (shwrapper_name, ".exe");
3150
tmp_pathspec = XMALLOC (char, (strlen (shwrapper_name) +
3151
strlen ("_ltshwrapperTMP") + 1));
3152
strcpy (tmp_pathspec, shwrapper_name);
3153
strcat (tmp_pathspec, "_ltshwrapperTMP");
3154
XFREE (shwrapper_name);
3155
shwrapper_name = tmp_pathspec;
3157
LTWRAPPER_DEBUGPRINTF (("(main) libtool shell wrapper name: %s\n",
3163
XMALLOC (char, (strlen (actual_cwrapper_path) +
3164
strlen ("$objdir") + 1 + strlen (shwrapper_name) + 1));
3165
strcpy (newargz[1], actual_cwrapper_path);
3166
strcat (newargz[1], "$objdir");
3167
strcat (newargz[1], "/");
3168
strcat (newargz[1], shwrapper_name);
3177
while ((p = strchr (newargz[1], '\\')) != NULL)
3187
XFREE (shwrapper_name);
3188
XFREE (actual_cwrapper_path);
3190
/* always write in binary mode */
3191
if ((shwrapper = fopen (newargz[1], FOPEN_WB)) == 0)
3193
lt_fatal ("Could not open %s for writing", newargz[1]);
3195
fprintf (shwrapper, "%s", script_text);
3198
make_executable (newargz[1]);
3200
for (i = 1; i < argc; i++)
3201
newargz[i + 1] = xstrdup (argv[i]);
3202
newargz[argc + 1] = NULL;
3204
for (i = 0; i < argc + 1; i++)
3206
LTWRAPPER_DEBUGPRINTF (("(main) newargz[%d] : %s\n", i, newargz[i]));
3214
/* execv doesn't actually work on mingw as expected on unix */
3215
rval = _spawnv (_P_WAIT, "$lt_newargv0", (const char * const *) newargz);
3218
/* failed to start process */
3219
LTWRAPPER_DEBUGPRINTF (("(main) failed to launch target \"$lt_newargv0\": errno = %d\n", errno));
3228
execv ("$lt_newargv0", newargz);
3229
return rval; /* =127, but avoids unused variable warning */
3238
xmalloc (size_t num)
3240
void *p = (void *) malloc (num);
3242
lt_fatal ("Memory exhausted");
3248
xstrdup (const char *string)
3250
return string ? strcpy ((char *) xmalloc (strlen (string) + 1),
3255
base_name (const char *name)
3259
#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
3260
/* Skip over the disk name in MSDOS pathnames. */
3261
if (isalpha ((unsigned char) name[0]) && name[1] == ':')
3265
for (base = name; *name; name++)
3266
if (IS_DIR_SEPARATOR (*name))
3272
check_executable (const char *path)
3276
LTWRAPPER_DEBUGPRINTF (("(check_executable) : %s\n",
3277
path ? (*path ? path : "EMPTY!") : "NULL!"));
3278
if ((!path) || (!*path))
3281
if ((stat (path, &st) >= 0)
3282
&& (st.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH)))
3289
make_executable (const char *path)
3294
LTWRAPPER_DEBUGPRINTF (("(make_executable) : %s\n",
3295
path ? (*path ? path : "EMPTY!") : "NULL!"));
3296
if ((!path) || (!*path))
3299
if (stat (path, &st) >= 0)
3301
rval = chmod (path, st.st_mode | S_IXOTH | S_IXGRP | S_IXUSR);
3306
/* Searches for the full path of the wrapper. Returns
3307
newly allocated full path name if found, NULL otherwise
3308
Does not chase symlinks, even on platforms that support them.
3311
find_executable (const char *wrapper)
3316
/* static buffer for getcwd */
3317
char tmp[LT_PATHMAX + 1];
3321
LTWRAPPER_DEBUGPRINTF (("(find_executable) : %s\n",
3322
wrapper ? (*wrapper ? wrapper : "EMPTY!") : "NULL!"));
3324
if ((wrapper == NULL) || (*wrapper == '\0'))
3327
/* Absolute path? */
3328
#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
3329
if (isalpha ((unsigned char) wrapper[0]) && wrapper[1] == ':')
3331
concat_name = xstrdup (wrapper);
3332
if (check_executable (concat_name))
3334
XFREE (concat_name);
3339
if (IS_DIR_SEPARATOR (wrapper[0]))
3341
concat_name = xstrdup (wrapper);
3342
if (check_executable (concat_name))
3344
XFREE (concat_name);
3346
#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
3350
for (p = wrapper; *p; p++)
3358
/* no slashes; search PATH */
3359
const char *path = getenv ("PATH");
3362
for (p = path; *p; p = p_next)
3366
for (q = p; *q; q++)
3367
if (IS_PATH_SEPARATOR (*q))
3370
p_next = (*q == '\0' ? q : q + 1);
3373
/* empty path: current directory */
3374
if (getcwd (tmp, LT_PATHMAX) == NULL)
3375
lt_fatal ("getcwd failed");
3376
tmp_len = strlen (tmp);
3378
XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1);
3379
memcpy (concat_name, tmp, tmp_len);
3380
concat_name[tmp_len] = '/';
3381
strcpy (concat_name + tmp_len + 1, wrapper);
3386
XMALLOC (char, p_len + 1 + strlen (wrapper) + 1);
3387
memcpy (concat_name, p, p_len);
3388
concat_name[p_len] = '/';
3389
strcpy (concat_name + p_len + 1, wrapper);
3391
if (check_executable (concat_name))
3393
XFREE (concat_name);
3396
/* not found in PATH; assume curdir */
3398
/* Relative path | not found in path: prepend cwd */
3399
if (getcwd (tmp, LT_PATHMAX) == NULL)
3400
lt_fatal ("getcwd failed");
3401
tmp_len = strlen (tmp);
3402
concat_name = XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1);
3403
memcpy (concat_name, tmp, tmp_len);
3404
concat_name[tmp_len] = '/';
3405
strcpy (concat_name + tmp_len + 1, wrapper);
3407
if (check_executable (concat_name))
3409
XFREE (concat_name);
3414
chase_symlinks (const char *pathspec)
3417
return xstrdup (pathspec);
3419
char buf[LT_PATHMAX];
3421
char *tmp_pathspec = xstrdup (pathspec);
3423
int has_symlinks = 0;
3424
while (strlen (tmp_pathspec) && !has_symlinks)
3426
LTWRAPPER_DEBUGPRINTF (("checking path component for symlinks: %s\n",
3428
if (lstat (tmp_pathspec, &s) == 0)
3430
if (S_ISLNK (s.st_mode) != 0)
3436
/* search backwards for last DIR_SEPARATOR */
3437
p = tmp_pathspec + strlen (tmp_pathspec) - 1;
3438
while ((p > tmp_pathspec) && (!IS_DIR_SEPARATOR (*p)))
3440
if ((p == tmp_pathspec) && (!IS_DIR_SEPARATOR (*p)))
3442
/* no more DIR_SEPARATORS left */
3449
char *errstr = strerror (errno);
3450
lt_fatal ("Error accessing file %s (%s)", tmp_pathspec, errstr);
3453
XFREE (tmp_pathspec);
3457
return xstrdup (pathspec);
3460
tmp_pathspec = realpath (pathspec, buf);
3461
if (tmp_pathspec == 0)
3463
lt_fatal ("Could not follow symlinks for %s", pathspec);
3465
return xstrdup (tmp_pathspec);
3470
strendzap (char *str, const char *pat)
3474
assert (str != NULL);
3475
assert (pat != NULL);
3478
patlen = strlen (pat);
3482
str += len - patlen;
3483
if (strcmp (str, pat) == 0)
3490
lt_error_core (int exit_status, const char *mode,
3491
const char *message, va_list ap)
3493
fprintf (stderr, "%s: %s: ", program_name, mode);
3494
vfprintf (stderr, message, ap);
3495
fprintf (stderr, ".\n");
3497
if (exit_status >= 0)
3502
lt_fatal (const char *message, ...)
3505
va_start (ap, message);
3506
lt_error_core (EXIT_FAILURE, "FATAL", message, ap);
3511
# end: func_emit_cwrapperexe_src
3513
# func_mode_link arg...
1066
$show "$mv $output_obj $obj"
1067
if $run $mv $output_obj $obj; then :
1070
$run $rm $removelist
1075
# Append the name of the non-PIC object the libtool object file.
1076
# Only append if the libtool object file exists.
1077
test -z "$run" && cat >> ${libobj}T <<EOF
1078
# Name of the non-PIC object.
1079
non_pic_object='$objname'
1083
# Append the name of the non-PIC object the libtool object file.
1084
# Only append if the libtool object file exists.
1085
test -z "$run" && cat >> ${libobj}T <<EOF
1086
# Name of the non-PIC object.
1092
$run $mv "${libobj}T" "${libobj}"
1094
# Unlock the critical section if it was locked
1095
if test "$need_locks" != no; then
1096
$run $rm "$lockfile"
1104
modename="$modename: link"
3518
1106
*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
3519
1107
# It is impossible to link a dll without this setting, and
7244
4906
# Replace the output file specification.
7245
link_command=`$ECHO "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`
4907
link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`
7247
4909
# Delete the old output files.
7248
$opt_dry_run || $RM $output $output_objdir/$outputname $output_objdir/lt-$outputname
4910
$run $rm $output $output_objdir/$outputname $output_objdir/lt-$outputname
7250
func_show_eval "$link_command" 'exit $?'
4912
$show "$link_command"
4913
$run eval "$link_command" || exit $?
7252
4915
# Now create the wrapper script.
7253
func_verbose "creating $output"
4916
$show "creating $output"
7255
4918
# Quote the relink command for shipping.
7256
4919
if test -n "$relink_command"; then
7257
4920
# Preserve any variables that may affect compiler behavior
7258
4921
for var in $variables_saved_for_relink; do
7259
4922
if eval test -z \"\${$var+set}\"; then
7260
relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command"
4923
relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command"
7261
4924
elif eval var_value=\$$var; test -z "$var_value"; then
7262
4925
relink_command="$var=; export $var; $relink_command"
7264
func_quote_for_eval "$var_value"
7265
relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command"
4927
var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"`
4928
relink_command="$var=\"$var_value\"; export $var; $relink_command"
7268
4931
relink_command="(cd `pwd`; $relink_command)"
7269
relink_command=`$ECHO "X$relink_command" | $Xsed -e "$sed_quote_subst"`
4932
relink_command=`$echo "X$relink_command" | $SP2NL | $Xsed -e "$sed_quote_subst" | $NL2SP`
7272
# Quote $ECHO for shipping.
7273
if test "X$ECHO" = "X$SHELL $progpath --fallback-echo"; then
4935
# Quote $echo for shipping.
4936
if test "X$echo" = "X$SHELL $progpath --fallback-echo"; then
7274
4937
case $progpath in
7275
4938
[\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $progpath --fallback-echo";;
7276
4939
*) qecho="$SHELL `pwd`/$progpath --fallback-echo";;
7278
qecho=`$ECHO "X$qecho" | $Xsed -e "$sed_quote_subst"`
4941
qecho=`$echo "X$qecho" | $Xsed -e "$sed_quote_subst"`
7280
qecho=`$ECHO "X$ECHO" | $Xsed -e "$sed_quote_subst"`
4943
qecho=`$echo "X$echo" | $Xsed -e "$sed_quote_subst"`
7283
# Only actually do things if not in dry run mode.
4946
# Only actually do things if our run command is non-null.
4947
if test -z "$run"; then
7285
4948
# win32 will think the script is a binary if it has
7286
4949
# a .exe suffix, so we strip it off here.
7287
4950
case $output in
7288
*.exe) func_stripname '' '.exe' "$output"
7289
output=$func_stripname_result ;;
4951
*.exe) output=`$echo $output|${SED} 's,.exe$,,'` ;;
7291
4953
# test for cygwin because mv fails w/o .exe extensions
7295
func_stripname '' '.exe' "$outputname"
7296
outputname=$func_stripname_result ;;
4957
outputname=`$echo $outputname|${SED} 's,.exe$,,'` ;;
7300
4961
*cygwin* | *mingw* )
7301
func_dirname_and_basename "$output" "" "."
7302
output_name=$func_basename_result
7303
output_path=$func_dirname_result
7304
cwrappersource="$output_path/$objdir/lt-$output_name.c"
7305
cwrapper="$output_path/$output_name.exe"
7306
$RM $cwrappersource $cwrapper
7307
trap "$RM $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15
7309
func_emit_cwrapperexe_src > $cwrappersource
7311
# we should really use a build-platform specific compiler
7312
# here, but OTOH, the wrappers (shell script and this C one)
7313
# are only useful if you want to execute the "real" binary.
7314
# Since the "real" binary is built for $host, then this
7315
# wrapper might as well be built for $host, too.
7317
$LTCC $LTCFLAGS -o $cwrapper $cwrappersource
7321
# Now, create the wrapper script for func_source use:
7322
func_ltwrapper_scriptname $cwrapper
7323
$RM $func_ltwrapper_scriptname_result
7324
trap "$RM $func_ltwrapper_scriptname_result; exit $EXIT_FAILURE" 1 2 15
7326
# note: this script will not be executed, so do not chmod.
7327
if test "x$build" = "x$host" ; then
7328
$cwrapper --lt-dump-script > $func_ltwrapper_scriptname_result
7330
func_emit_wrapper no > $func_ltwrapper_scriptname_result
7336
trap "$RM $output; exit $EXIT_FAILURE" 1 2 15
7338
func_emit_wrapper no > $output
4962
output_name=`basename $output`
4963
output_path=`dirname $output`
4964
cwrappersource="$output_path/$objdir/lt-$output_name.c"
4965
cwrapper="$output_path/$output_name.exe"
4966
$rm $cwrappersource $cwrapper
4967
trap "$rm $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15
4969
cat > $cwrappersource <<EOF
4971
/* $cwrappersource - temporary wrapper executable for $objdir/$outputname
4972
Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
4974
The $output program cannot be directly executed until all the libtool
4975
libraries that it depends on are installed.
4977
This wrapper executable should never be moved out of the build directory.
4978
If it is, it will not operate correctly.
4980
Currently, it simply execs the wrapper *script* "/bin/sh $output",
4981
but could eventually absorb all of the scripts functionality and
4982
exec $objdir/$outputname directly.
4985
cat >> $cwrappersource<<"EOF"
4994
#include <sys/stat.h>
4996
#if defined(PATH_MAX)
4997
# define LT_PATHMAX PATH_MAX
4998
#elif defined(MAXPATHLEN)
4999
# define LT_PATHMAX MAXPATHLEN
5001
# define LT_PATHMAX 1024
5004
#ifndef DIR_SEPARATOR
5005
# define DIR_SEPARATOR '/'
5006
# define PATH_SEPARATOR ':'
5009
#if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \
5011
# define HAVE_DOS_BASED_FILE_SYSTEM
5012
# ifndef DIR_SEPARATOR_2
5013
# define DIR_SEPARATOR_2 '\\'
5015
# ifndef PATH_SEPARATOR_2
5016
# define PATH_SEPARATOR_2 ';'
5020
#ifndef DIR_SEPARATOR_2
5021
# define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR)
5022
#else /* DIR_SEPARATOR_2 */
5023
# define IS_DIR_SEPARATOR(ch) \
5024
(((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2))
5025
#endif /* DIR_SEPARATOR_2 */
5027
#ifndef PATH_SEPARATOR_2
5028
# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR)
5029
#else /* PATH_SEPARATOR_2 */
5030
# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2)
5031
#endif /* PATH_SEPARATOR_2 */
5033
#define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type)))
5034
#define XFREE(stale) do { \
5035
if (stale) { free ((void *) stale); stale = 0; } \
5038
/* -DDEBUG is fairly common in CFLAGS. */
5040
#if defined DEBUGWRAPPER
5041
# define DEBUG(format, ...) fprintf(stderr, format, __VA_ARGS__)
5043
# define DEBUG(format, ...)
5046
const char *program_name = NULL;
5048
void * xmalloc (size_t num);
5049
char * xstrdup (const char *string);
5050
const char * base_name (const char *name);
5051
char * find_executable(const char *wrapper);
5052
int check_executable(const char *path);
5053
char * strendzap(char *str, const char *pat);
5054
void lt_fatal (const char *message, ...);
5057
main (int argc, char *argv[])
5062
program_name = (char *) xstrdup (base_name (argv[0]));
5063
DEBUG("(main) argv[0] : %s\n",argv[0]);
5064
DEBUG("(main) program_name : %s\n",program_name);
5065
newargz = XMALLOC(char *, argc+2);
5068
cat >> $cwrappersource <<EOF
5069
newargz[0] = (char *) xstrdup("$SHELL");
5072
cat >> $cwrappersource <<"EOF"
5073
newargz[1] = find_executable(argv[0]);
5074
if (newargz[1] == NULL)
5075
lt_fatal("Couldn't find %s", argv[0]);
5076
DEBUG("(main) found exe at : %s\n",newargz[1]);
5077
/* we know the script has the same name, without the .exe */
5078
/* so make sure newargz[1] doesn't end in .exe */
5079
strendzap(newargz[1],".exe");
5080
for (i = 1; i < argc; i++)
5081
newargz[i+1] = xstrdup(argv[i]);
5082
newargz[argc+1] = NULL;
5084
for (i=0; i<argc+1; i++)
5086
DEBUG("(main) newargz[%d] : %s\n",i,newargz[i]);
5094
cat >> $cwrappersource <<EOF
5095
execv("$SHELL",(char const **)newargz);
5099
cat >> $cwrappersource <<EOF
5100
execv("$SHELL",newargz);
5105
cat >> $cwrappersource <<"EOF"
5110
xmalloc (size_t num)
5112
void * p = (void *) malloc (num);
5114
lt_fatal ("Memory exhausted");
5120
xstrdup (const char *string)
5122
return string ? strcpy ((char *) xmalloc (strlen (string) + 1), string) : NULL
5127
base_name (const char *name)
5131
#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
5132
/* Skip over the disk name in MSDOS pathnames. */
5133
if (isalpha ((unsigned char)name[0]) && name[1] == ':')
5137
for (base = name; *name; name++)
5138
if (IS_DIR_SEPARATOR (*name))
5144
check_executable(const char * path)
5148
DEBUG("(check_executable) : %s\n", path ? (*path ? path : "EMPTY!") : "NULL!");
5149
if ((!path) || (!*path))
5152
if ((stat (path, &st) >= 0) &&
5154
/* MinGW & native WIN32 do not support S_IXOTH or S_IXGRP */
5155
#if defined (S_IXOTH)
5156
((st.st_mode & S_IXOTH) == S_IXOTH) ||
5158
#if defined (S_IXGRP)
5159
((st.st_mode & S_IXGRP) == S_IXGRP) ||
5161
((st.st_mode & S_IXUSR) == S_IXUSR))
5168
/* Searches for the full path of the wrapper. Returns
5169
newly allocated full path name if found, NULL otherwise */
5171
find_executable (const char* wrapper)
5176
/* static buffer for getcwd */
5177
char tmp[LT_PATHMAX + 1];
5181
DEBUG("(find_executable) : %s\n", wrapper ? (*wrapper ? wrapper : "EMPTY!") : "NULL!");
5183
if ((wrapper == NULL) || (*wrapper == '\0'))
5186
/* Absolute path? */
5187
#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
5188
if (isalpha ((unsigned char)wrapper[0]) && wrapper[1] == ':')
5190
concat_name = xstrdup (wrapper);
5191
if (check_executable(concat_name))
5198
if (IS_DIR_SEPARATOR (wrapper[0]))
5200
concat_name = xstrdup (wrapper);
5201
if (check_executable(concat_name))
5205
#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
5209
for (p = wrapper; *p; p++)
5217
/* no slashes; search PATH */
5218
const char* path = getenv ("PATH");
5221
for (p = path; *p; p = p_next)
5225
for (q = p; *q; q++)
5226
if (IS_PATH_SEPARATOR(*q))
5229
p_next = (*q == '\0' ? q : q + 1);
5232
/* empty path: current directory */
5233
if (getcwd (tmp, LT_PATHMAX) == NULL)
5234
lt_fatal ("getcwd failed");
5235
tmp_len = strlen(tmp);
5236
concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1);
5237
memcpy (concat_name, tmp, tmp_len);
5238
concat_name[tmp_len] = '/';
5239
strcpy (concat_name + tmp_len + 1, wrapper);
5243
concat_name = XMALLOC(char, p_len + 1 + strlen(wrapper) + 1);
5244
memcpy (concat_name, p, p_len);
5245
concat_name[p_len] = '/';
5246
strcpy (concat_name + p_len + 1, wrapper);
5248
if (check_executable(concat_name))
5253
/* not found in PATH; assume curdir */
5255
/* Relative path | not found in path: prepend cwd */
5256
if (getcwd (tmp, LT_PATHMAX) == NULL)
5257
lt_fatal ("getcwd failed");
5258
tmp_len = strlen(tmp);
5259
concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1);
5260
memcpy (concat_name, tmp, tmp_len);
5261
concat_name[tmp_len] = '/';
5262
strcpy (concat_name + tmp_len + 1, wrapper);
5264
if (check_executable(concat_name))
5271
strendzap(char *str, const char *pat)
5275
assert(str != NULL);
5276
assert(pat != NULL);
5279
patlen = strlen(pat);
5283
str += len - patlen;
5284
if (strcmp(str, pat) == 0)
5291
lt_error_core (int exit_status, const char * mode,
5292
const char * message, va_list ap)
5294
fprintf (stderr, "%s: %s: ", program_name, mode);
5295
vfprintf (stderr, message, ap);
5296
fprintf (stderr, ".\n");
5298
if (exit_status >= 0)
5303
lt_fatal (const char *message, ...)
5306
va_start (ap, message);
5307
lt_error_core (EXIT_FAILURE, "FATAL", message, ap);
5311
# we should really use a build-platform specific compiler
5312
# here, but OTOH, the wrappers (shell script and this C one)
5313
# are only useful if you want to execute the "real" binary.
5314
# Since the "real" binary is built for $host, then this
5315
# wrapper might as well be built for $host, too.
5316
$run $LTCC $LTCFLAGS -s -o $cwrapper $cwrappersource
5320
trap "$rm $output; exit $EXIT_FAILURE" 1 2 15
5325
# $output - temporary wrapper script for $objdir/$outputname
5326
# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
5328
# The $output program cannot be directly executed until all the libtool
5329
# libraries that it depends on are installed.
5331
# This wrapper script should never be moved out of the build directory.
5332
# If it is, it will not operate correctly.
5334
# Sed substitution that helps us do robust quoting. It backslashifies
5335
# metacharacters that are still active within double-quoted strings.
5336
Xsed='${SED} -e 1s/^X//'
5337
sed_quote_subst='$sed_quote_subst'
5339
# Be Bourne compatible (taken from Autoconf:_AS_BOURNE_COMPATIBLE).
5340
if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then
5343
# Zsh 3.x and 4.x performs word splitting on \${1+\"\$@\"}, which
5344
# is contrary to our usage. Disable this feature.
5345
alias -g '\${1+\"\$@\"}'='\"\$@\"'
5346
setopt NO_GLOB_SUBST
5348
case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac
5350
BIN_SH=xpg4; export BIN_SH # for Tru64
5351
DUALCASE=1; export DUALCASE # for MKS sh
5353
# The HP-UX ksh and POSIX shell print the target directory to stdout
5355
(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
5357
relink_command=\"$relink_command\"
5359
# This environment variable determines our operation mode.
5360
if test \"\$libtool_install_magic\" = \"$magic\"; then
5361
# install mode needs the following variable:
5362
notinst_deplibs='$notinst_deplibs'
5364
# When we are sourced in execute mode, \$file and \$echo are already set.
5365
if test \"\$libtool_execute_magic\" != \"$magic\"; then
5368
# Make sure echo works.
5369
if test \"X\$1\" = X--no-reexec; then
5370
# Discard the --no-reexec flag, and continue.
5372
elif test \"X\`(\$echo '\t') 2>/dev/null\`\" = 'X\t'; then
5373
# Yippee, \$echo works!
5376
# Restart under the correct shell, and then maybe \$echo will work.
5377
exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"}
5383
# Find the directory that this script lives in.
5384
thisdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\`
5385
test \"x\$thisdir\" = \"x\$file\" && thisdir=.
5387
# Follow symbolic links until we get to the real thisdir.
5388
file=\`ls -ld \"\$file\" | ${SED} -n 's/.*-> //p'\`
5389
while test -n \"\$file\"; do
5390
destdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\`
5392
# If there was a directory component, then change thisdir.
5393
if test \"x\$destdir\" != \"x\$file\"; then
5394
case \"\$destdir\" in
5395
[\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;;
5396
*) thisdir=\"\$thisdir/\$destdir\" ;;
5400
file=\`\$echo \"X\$file\" | \$Xsed -e 's%^.*/%%'\`
5401
file=\`ls -ld \"\$thisdir/\$file\" | ${SED} -n 's/.*-> //p'\`
5404
# Try to get the absolute directory name.
5405
absdir=\`cd \"\$thisdir\" && pwd\`
5406
test -n \"\$absdir\" && thisdir=\"\$absdir\"
5409
if test "$fast_install" = yes; then
5411
program=lt-'$outputname'$exeext
5412
progdir=\"\$thisdir/$objdir\"
5414
if test ! -f \"\$progdir/\$program\" || \\
5415
{ file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\
5416
test \"X\$file\" != \"X\$progdir/\$program\"; }; then
5418
file=\"\$\$-\$program\"
5420
if test ! -d \"\$progdir\"; then
5421
$mkdir \"\$progdir\"
5423
$rm \"\$progdir/\$file\"
5428
# relink executable if necessary
5429
if test -n \"\$relink_command\"; then
5430
if relink_command_output=\`eval \$relink_command 2>&1\`; then :
5432
$echo \"\$relink_command_output\" >&2
5433
$rm \"\$progdir/\$file\"
5438
$mv \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null ||
5439
{ $rm \"\$progdir/\$program\";
5440
$mv \"\$progdir/\$file\" \"\$progdir/\$program\"; }
5441
$rm \"\$progdir/\$file\"
5445
program='$outputname'
5446
progdir=\"\$thisdir/$objdir\"
5452
if test -f \"\$progdir/\$program\"; then"
5454
# Export our shlibpath_var if we have one.
5455
if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
5457
# Add our own library path to $shlibpath_var
5458
$shlibpath_var=\"$temp_rpath\$$shlibpath_var\"
5460
# Some systems cannot cope with colon-terminated $shlibpath_var
5461
# The second colon is a workaround for a bug in BeOS R4 sed
5462
$shlibpath_var=\`\$echo \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\`
5464
export $shlibpath_var
5468
# fixup the dll searchpath if we need to.
5469
if test -n "$dllsearchpath"; then
5471
# Add the dll search path components to the executable PATH
5472
PATH=$dllsearchpath:\$PATH
5477
if test \"\$libtool_execute_magic\" != \"$magic\"; then
5478
# Run the actual program with our arguments.
5481
# Backslashes separate directories on plain windows
5482
*-*-mingw | *-*-os2*)
5484
exec \"\$progdir\\\\\$program\" \${1+\"\$@\"}
5490
exec \"\$progdir/\$program\" \${1+\"\$@\"}
5495
\$echo \"\$0: cannot exec \$program \$*\"
5499
# The program doesn't exist.
5500
\$echo \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2
5501
\$echo \"This script is just a wrapper for \$program.\" 1>&2
5502
$echo \"See the $PACKAGE documentation for more information.\" 1>&2
7343
5509
exit $EXIT_SUCCESS
7642
5794
# Directory that this library needs to be installed in:
7643
5795
libdir='$install_libdir'"
7644
5796
if test "$installed" = no && test "$need_relink" = yes; then
7646
5798
relink_command=\"$relink_command\""
7651
5803
# Do a symbolic link so that the libtool archive can be found in
7652
5804
# LD_LIBRARY_PATH before the program is installed.
7653
func_show_eval '( cd "$output_objdir" && $RM "$outputname" && $LN_S "../$outputname" "$outputname" )' 'exit $?'
7659
{ test "$mode" = link || test "$mode" = relink; } &&
7660
func_mode_link ${1+"$@"}
7663
# func_mode_uninstall arg...
7664
func_mode_uninstall ()
5805
$show "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)"
5806
$run eval '(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)' || exit $?
5812
# libtool install mode
5814
modename="$modename: install"
5816
# There may be an optional sh(1) argument at the beginning of
5817
# install_prog (especially on Windows NT).
5818
if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh ||
5819
# Allow the use of GNU shtool's install command.
5820
$echo "X$nonopt" | grep shtool > /dev/null; then
5821
# Aesthetically quote it.
5822
arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"`
5824
*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
5828
install_prog="$arg "
5836
# The real first argument should be the name of the installation program.
5837
# Aesthetically quote it.
5838
arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
5840
*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
5844
install_prog="$install_prog$arg"
5846
# We need to accept at least all the BSD install flags.
5856
if test -n "$dest"; then
5857
files="$files $dest"
5865
case " $install_prog " in
5870
-g | -m | -o) prev=$arg ;;
5878
# If the previous option needed an argument, then skip it.
5879
if test -n "$prev"; then
5888
# Aesthetically quote the argument.
5889
arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
5891
*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
5895
install_prog="$install_prog $arg"
5898
if test -z "$install_prog"; then
5899
$echo "$modename: you must specify an install program" 1>&2
5904
if test -n "$prev"; then
5905
$echo "$modename: the \`$prev' option requires an argument" 1>&2
5910
if test -z "$files"; then
5911
if test -z "$dest"; then
5912
$echo "$modename: no file or destination specified" 1>&2
5914
$echo "$modename: you must specify a destination" 1>&2
5920
# Strip any trailing slash from the destination.
5921
dest=`$echo "X$dest" | $Xsed -e 's%/$%%'`
5923
# Check to see that the destination is a directory.
5924
test -d "$dest" && isdir=yes
5925
if test "$isdir" = yes; then
5929
destdir=`$echo "X$dest" | $Xsed -e 's%/[^/]*$%%'`
5930
test "X$destdir" = "X$dest" && destdir=.
5931
destname=`$echo "X$dest" | $Xsed -e 's%^.*/%%'`
5933
# Not a directory, so check to see that there is only one file specified.
5935
if test "$#" -gt 2; then
5936
$echo "$modename: \`$dest' is not a directory" 1>&2
5942
[\\/]* | [A-Za-z]:[\\/]*) ;;
5944
for file in $files; do
5948
$echo "$modename: \`$destdir' must be an absolute directory name" 1>&2
5957
# This variable tells wrapper scripts just to set variables rather
5958
# than running their programs.
5959
libtool_install_magic="$magic"
5964
for file in $files; do
5966
# Do each installation.
5969
# Do the static libraries later.
5970
staticlibs="$staticlibs $file"
5974
# Check to see that this really is a libtool archive.
5975
if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
5977
$echo "$modename: \`$file' is not a valid libtool archive" 1>&2
5985
# If there is no directory component, then add one.
5987
*/* | *\\*) . $file ;;
5991
# Add the libdir to current_libdirs if it is the destination.
5992
if test "X$destdir" = "X$libdir"; then
5993
case "$current_libdirs " in
5995
*) current_libdirs="$current_libdirs $libdir" ;;
5998
# Note the libdir as a future libdir.
5999
case "$future_libdirs " in
6001
*) future_libdirs="$future_libdirs $libdir" ;;
6005
dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`/
6006
test "X$dir" = "X$file/" && dir=
6009
if test -n "$relink_command"; then
6010
# Determine the prefix the user has applied to our future dir.
6011
inst_prefix_dir=`$echo "$destdir" | $SED "s%$libdir\$%%"`
6013
# Don't allow the user to place us outside of our expected
6014
# location b/c this prevents finding dependent libraries that
6015
# are installed to the same prefix.
6016
# At present, this check doesn't affect windows .dll's that
6017
# are installed into $libdir/../bin (currently, that works fine)
6018
# but it's something to keep an eye on.
6019
if test "$inst_prefix_dir" = "$destdir"; then
6020
$echo "$modename: error: cannot install \`$file' to a directory not ending in $libdir" 1>&2
6024
if test -n "$inst_prefix_dir"; then
6025
# Stick the inst_prefix_dir data into the link command.
6026
relink_command=`$echo "$relink_command" | $SP2NL | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%" | $NL2SP`
6028
relink_command=`$echo "$relink_command" | $SP2NL | $SED "s%@inst_prefix_dir@%%" | $NL2SP`
6031
$echo "$modename: warning: relinking \`$file'" 1>&2
6032
$show "$relink_command"
6033
if $run eval "$relink_command"; then :
6035
$echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
6040
# See the names of the shared library.
6041
set dummy $library_names
6042
if test -n "$2"; then
6048
test -n "$relink_command" && srcname="$realname"T
6050
# Install the shared library and build the symlinks.
6051
$show "$install_prog $dir/$srcname $destdir/$realname"
6052
$run eval "$install_prog $dir/$srcname $destdir/$realname" || exit $?
6053
if test -n "$stripme" && test -n "$striplib"; then
6054
$show "$striplib $destdir/$realname"
6055
$run eval "$striplib $destdir/$realname" || exit $?
6058
if test "$#" -gt 0; then
6059
# Delete the old symlinks, and create new ones.
6060
# Try `ln -sf' first, because the `ln' binary might depend on
6061
# the symlink we replace! Solaris /bin/ln does not understand -f,
6062
# so we also need to try rm && ln -s.
6065
if test "$linkname" != "$realname"; then
6066
$show "(cd $destdir && { $LN_S -f $realname $linkname || { $rm $linkname && $LN_S $realname $linkname; }; })"
6067
$run eval "(cd $destdir && { $LN_S -f $realname $linkname || { $rm $linkname && $LN_S $realname $linkname; }; })"
6072
# Do each command in the postinstall commands.
6073
lib="$destdir/$realname"
6074
cmds=$postinstall_cmds
6075
save_ifs="$IFS"; IFS='~'
6076
for cmd in $cmds; do
6080
$run eval "$cmd" || {
6083
# Restore the uninstalled library and exit
6084
if test "$mode" = relink; then
6085
$run eval '(cd $output_objdir && $rm ${realname}T && $mv ${realname}U $realname)'
6094
# Install the pseudo-library for information purposes.
6095
name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
6096
instname="$dir/$name"i
6097
$show "$install_prog $instname $destdir/$name"
6098
$run eval "$install_prog $instname $destdir/$name" || exit $?
6100
# Maybe install the static library, too.
6101
test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library"
6105
# Install (i.e. copy) a libtool object.
6107
# Figure out destination file name, if it wasn't already specified.
6108
if test -n "$destname"; then
6109
destfile="$destdir/$destname"
6111
destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
6112
destfile="$destdir/$destfile"
6115
# Deduce the name of the destination old-style object file.
6118
staticdest=`$echo "X$destfile" | $Xsed -e "$lo2o"`
6121
staticdest="$destfile"
6125
$echo "$modename: cannot copy a libtool object to \`$destfile'" 1>&2
6131
# Install the libtool object if requested.
6132
if test -n "$destfile"; then
6133
$show "$install_prog $file $destfile"
6134
$run eval "$install_prog $file $destfile" || exit $?
6137
# Install the old object if enabled.
6138
if test "$build_old_libs" = yes; then
6139
# Deduce the name of the old-style object file.
6140
staticobj=`$echo "X$file" | $Xsed -e "$lo2o"`
6142
$show "$install_prog $staticobj $staticdest"
6143
$run eval "$install_prog \$staticobj \$staticdest" || exit $?
6149
# Figure out destination file name, if it wasn't already specified.
6150
if test -n "$destname"; then
6151
destfile="$destdir/$destname"
6153
destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
6154
destfile="$destdir/$destfile"
6157
# If the file is missing, and there is a .exe on the end, strip it
6158
# because it is most likely a libtool script we actually want to
6163
if test ! -f "$file"; then
6164
file=`$echo $file|${SED} 's,.exe$,,'`
6170
# Do a test to see if this is really a libtool program.
6173
wrapper=`$echo $file | ${SED} -e 's,.exe$,,'`
6179
if (${SED} -e '4q' $wrapper | grep "^# Generated by .*$PACKAGE")>/dev/null 2>&1; then
6183
# Note that it is not necessary on cygwin/mingw to append a dot to
6184
# foo even if both foo and FILE.exe exist: automatic-append-.exe
6185
# behavior happens only for exec(3), not for open(2)! Also, sourcing
6186
# `FILE.' does not work on cygwin managed mounts.
6188
# If there is no directory component, then add one.
6190
*/* | *\\*) . ${wrapper} ;;
6191
*) . ./${wrapper} ;;
6194
# Check the variables that should have been set.
6195
if test -z "$notinst_deplibs"; then
6196
$echo "$modename: invalid libtool wrapper script \`$wrapper'" 1>&2
6201
for lib in $notinst_deplibs; do
6202
# Check to see that each library is installed.
6204
if test -f "$lib"; then
6205
# If there is no directory component, then add one.
6207
*/* | *\\*) . $lib ;;
6211
libfile="$libdir/"`$echo "X$lib" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test
6212
if test -n "$libdir" && test ! -f "$libfile"; then
6213
$echo "$modename: warning: \`$lib' has not been installed in \`$libdir'" 1>&2
6219
# Note that it is not necessary on cygwin/mingw to append a dot to
6220
# foo even if both foo and FILE.exe exist: automatic-append-.exe
6221
# behavior happens only for exec(3), not for open(2)! Also, sourcing
6222
# `FILE.' does not work on cygwin managed mounts.
6224
# If there is no directory component, then add one.
6226
*/* | *\\*) . ${wrapper} ;;
6227
*) . ./${wrapper} ;;
6231
if test "$fast_install" = no && test -n "$relink_command"; then
6232
if test "$finalize" = yes && test -z "$run"; then
6233
tmpdir=`func_mktempdir`
6234
file=`$echo "X$file$stripped_ext" | $Xsed -e 's%^.*/%%'`
6235
outputname="$tmpdir/$file"
6236
# Replace the output file specification.
6237
relink_command=`$echo "X$relink_command" | $SP2NL | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g' | $NL2SP`
6239
$show "$relink_command"
6240
if $run eval "$relink_command"; then :
6242
$echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
6248
$echo "$modename: warning: cannot relink \`$file'" 1>&2
6251
# Install the binary that we compiled earlier.
6252
file=`$echo "X$file$stripped_ext" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"`
6256
# remove .exe since cygwin /usr/bin/install will append another
6258
case $install_prog,$host in
6259
*/usr/bin/install*,*cygwin*)
6260
case $file:$destfile in
6265
destfile=$destfile.exe
6268
destfile=`$echo $destfile | ${SED} -e 's,.exe$,,'`
6273
$show "$install_prog$stripme $file $destfile"
6274
$run eval "$install_prog\$stripme \$file \$destfile" || exit $?
6275
test -n "$outputname" && ${rm}r "$tmpdir"
6280
for file in $staticlibs; do
6281
name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
6283
# Set up the ranlib parameters.
6284
oldlib="$destdir/$name"
6286
$show "$install_prog $file $oldlib"
6287
$run eval "$install_prog \$file \$oldlib" || exit $?
6289
if test -n "$stripme" && test -n "$old_striplib"; then
6290
$show "$old_striplib $oldlib"
6291
$run eval "$old_striplib $oldlib" || exit $?
6294
# Do each command in the postinstall commands.
6295
cmds=$old_postinstall_cmds
6296
save_ifs="$IFS"; IFS='~'
6297
for cmd in $cmds; do
6301
$run eval "$cmd" || exit $?
6306
if test -n "$future_libdirs"; then
6307
$echo "$modename: warning: remember to run \`$progname --finish$future_libdirs'" 1>&2
6310
if test -n "$current_libdirs"; then
6311
# Maybe just do a dry run.
6312
test -n "$run" && current_libdirs=" -n$current_libdirs"
6313
exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs'
6319
# libtool finish mode
6321
modename="$modename: finish"
6325
if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
6328
libdirs="$libdirs $dir"
6331
for libdir in $libdirs; do
6332
if test -n "$finish_cmds"; then
6333
# Do each command in the finish commands.
6335
save_ifs="$IFS"; IFS='~'
6336
for cmd in $cmds; do
6340
$run eval "$cmd" || admincmds="$admincmds
6345
if test -n "$finish_eval"; then
6346
# Do the single finish_eval.
6347
eval cmds=\"$finish_eval\"
6348
$run eval "$cmds" || admincmds="$admincmds
6354
# Exit here if they wanted silent mode.
6355
test "$show" = : && exit $EXIT_SUCCESS
6357
$echo "X----------------------------------------------------------------------" | $Xsed
6358
$echo "Libraries have been installed in:"
6359
for libdir in $libdirs; do
6363
$echo "If you ever happen to want to link against installed libraries"
6364
$echo "in a given directory, LIBDIR, you must either use libtool, and"
6365
$echo "specify the full pathname of the library, or use the \`-LLIBDIR'"
6366
$echo "flag during linking and do at least one of the following:"
6367
if test -n "$shlibpath_var"; then
6368
$echo " - add LIBDIR to the \`$shlibpath_var' environment variable"
6369
$echo " during execution"
6371
if test -n "$runpath_var"; then
6372
$echo " - add LIBDIR to the \`$runpath_var' environment variable"
6373
$echo " during linking"
6375
if test -n "$hardcode_libdir_flag_spec"; then
6377
eval flag=\"$hardcode_libdir_flag_spec\"
6379
$echo " - use the \`$flag' linker flag"
6381
if test -n "$admincmds"; then
6382
$echo " - have your system administrator run these commands:$admincmds"
6384
if test -f /etc/ld.so.conf; then
6385
$echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'"
6388
$echo "See any operating system documentation about shared libraries for"
6389
$echo "more information, such as the ld(1) and ld.so(8) manual pages."
6390
$echo "X----------------------------------------------------------------------" | $Xsed
6394
# libtool execute mode
6396
modename="$modename: execute"
6398
# The first argument is the command name.
6400
if test -z "$cmd"; then
6401
$echo "$modename: you must specify a COMMAND" 1>&2
6406
# Handle -dlopen flags immediately.
6407
for file in $execute_dlfiles; do
6408
if test ! -f "$file"; then
6409
$echo "$modename: \`$file' is not a file" 1>&2
6417
# Check to see that this really is a libtool archive.
6418
if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
6420
$echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
6425
# Read the libtool library.
6429
# If there is no directory component, then add one.
6431
*/* | *\\*) . $file ;;
6435
# Skip this library if it cannot be dlopened.
6436
if test -z "$dlname"; then
6437
# Warn if it was a shared library.
6438
test -n "$library_names" && $echo "$modename: warning: \`$file' was not linked with \`-export-dynamic'"
6442
dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
6443
test "X$dir" = "X$file" && dir=.
6445
if test -f "$dir/$objdir/$dlname"; then
6448
if test ! -f "$dir/$dlname"; then
6449
$echo "$modename: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2
6456
# Just add the directory containing the .lo file.
6457
dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
6458
test "X$dir" = "X$file" && dir=.
6462
$echo "$modename: warning \`-dlopen' is ignored for non-libtool libraries and objects" 1>&2
6467
# Get the absolute pathname.
6468
absdir=`cd "$dir" && pwd`
6469
test -n "$absdir" && dir="$absdir"
6471
# Now add the directory to shlibpath_var.
6472
if eval "test -z \"\$$shlibpath_var\""; then
6473
eval "$shlibpath_var=\"\$dir\""
6475
eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\""
6479
# This variable tells wrapper scripts just to set shlibpath_var
6480
# rather than running their programs.
6481
libtool_execute_magic="$magic"
6483
# Check if any of the arguments is a wrapper script.
6490
# Do a test to see if this is really a libtool program.
6491
if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
6492
# If there is no directory component, then add one.
6494
*/* | *\\*) . $file ;;
6498
# Transform arg to wrapped name.
6499
file="$progdir/$program"
6503
# Quote arguments (to preserve shell metacharacters).
6504
file=`$echo "X$file" | $Xsed -e "$sed_quote_subst"`
6505
args="$args \"$file\""
6508
if test -z "$run"; then
6509
if test -n "$shlibpath_var"; then
6510
# Export the shlibpath_var.
6511
eval "export $shlibpath_var"
6514
# Restore saved environment variables
6515
for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
6517
eval "if test \"\${save_$lt_var+set}\" = set; then
6518
$lt_var=\$save_$lt_var; export $lt_var
6522
# Now prepare to actually exec the command.
6523
exec_cmd="\$cmd$args"
6525
# Display what would be done.
6526
if test -n "$shlibpath_var"; then
6527
eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\""
6528
$echo "export $shlibpath_var"
6535
# libtool clean and uninstall mode
6537
modename="$modename: $mode"