176
526
my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null`
178
528
if test ! -d "$my_tmpdir"; then
179
# Failing that, at least try and use $RANDOM to avoid a race
180
my_tmpdir="${my_template}-${RANDOM-0}$$"
529
# Failing that, at least try and use $RANDOM to avoid a race
530
my_tmpdir="${my_template}-${RANDOM-0}$$"
182
save_mktempdir_umask=`umask`
185
umask $save_mktempdir_umask
532
save_mktempdir_umask=`umask`
535
umask $save_mktempdir_umask
188
538
# If we're not in dry-run mode, bomb out on failure
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
539
test -d "$my_tmpdir" || \
540
func_fatal_error "cannot create temporary directory \`$my_tmpdir'"
547
# func_quote_for_eval arg
548
# Aesthetically quote ARG to be evaled later.
549
# This function returns two values: FUNC_QUOTE_FOR_EVAL_RESULT
550
# is double-quoted, suitable for a subsequent eval, whereas
551
# FUNC_QUOTE_FOR_EVAL_UNQUOTED_RESULT has merely all characters
552
# which are still active within double quotes backslashified.
553
func_quote_for_eval ()
557
func_quote_for_eval_unquoted_result=`$ECHO "$1" | $SED "$sed_quote_subst"` ;;
559
func_quote_for_eval_unquoted_result="$1" ;;
562
case $func_quote_for_eval_unquoted_result in
563
# Double-quote args containing shell metacharacters to delay
564
# word splitting, command substitution and and variable
565
# expansion for a subsequent eval.
566
# Many Bourne shells cannot handle close brackets correctly
567
# in scan sets, so we specify it separately.
568
*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
569
func_quote_for_eval_result="\"$func_quote_for_eval_unquoted_result\""
572
func_quote_for_eval_result="$func_quote_for_eval_unquoted_result"
577
# func_quote_for_expand arg
578
# Aesthetically quote ARG to be evaled later; same as above,
579
# but do not quote variable references.
580
func_quote_for_expand ()
584
my_arg=`$ECHO "$1" | $SED \
585
-e "$double_quote_subst" -e "$sed_double_backslash"` ;;
591
# Double-quote args containing shell metacharacters to delay
592
# word splitting and command substitution for a subsequent eval.
593
# Many Bourne shells cannot handle close brackets correctly
594
# in scan sets, so we specify it separately.
595
*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
600
func_quote_for_expand_result="$my_arg"
604
# func_show_eval cmd [fail_exp]
605
# Unless opt_silent is true, then output CMD. Then, if opt_dryrun is
606
# not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP
607
# is given, then evaluate it.
613
${opt_silent-false} || {
614
func_quote_for_expand "$my_cmd"
615
eval "func_echo $func_quote_for_expand_result"
618
if ${opt_dry_run-false}; then :; else
621
if test "$my_status" -eq 0; then :; else
622
eval "(exit $my_status); $my_fail_exp"
628
# func_show_eval_locale cmd [fail_exp]
629
# Unless opt_silent is true, then output CMD. Then, if opt_dryrun is
630
# not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP
631
# is given, then evaluate it. Use the saved locale for evaluation.
632
func_show_eval_locale ()
637
${opt_silent-false} || {
638
func_quote_for_expand "$my_cmd"
639
eval "func_echo $func_quote_for_expand_result"
642
if ${opt_dry_run-false}; then :; else
643
eval "$lt_user_locale
646
eval "$lt_safe_locale"
647
if test "$my_status" -eq 0; then :; else
648
eval "(exit $my_status); $my_fail_exp"
655
# Echo version message to standard output and exit.
666
/^# '$PROGRAM' (GNU /,/# warranty; / {
669
s/\((C)\)[ 0-9,-]*\( [1-9][0-9]*\)/\1\2/
676
# Echo short help message to standard output and exit.
679
$SED -n '/^# Usage:/,/^# *.*--help/ {
682
s/\$progname/'$progname'/
686
$ECHO "run \`$progname --help | more' for full usage"
691
# Echo long help message to standard output and exit,
692
# unless 'noexit' is passed as argument.
695
$SED -n '/^# Usage:/,/# Report bugs to/ {
698
s*\$progname*'$progname'*
700
s*\$SHELL*'"$SHELL"'*
702
s*\$LTCFLAGS*'"$LTCFLAGS"'*
704
s/\$with_gnu_ld/'"$with_gnu_ld"'/
705
s/\$automake_version/'"`(automake --version) 2>/dev/null |$SED 1q`"'/
706
s/\$autoconf_version/'"`(autoconf --version) 2>/dev/null |$SED 1q`"'/
710
if test -z "$1"; then
715
# func_missing_arg argname
716
# Echo program name prefixed message to standard error and set global
720
func_error "missing argument for $1."
731
magic="%%%MAGIC variable%%%"
732
magic_exe="%%%MAGIC EXE variable%%%"
739
lo2o="s/\\.lo\$/.${objext}/"
740
o2lo="s/\\.${objext}\$/.lo/"
745
opt_duplicate_deps=false
749
# If this variable is set in any of the actions, the command in it
750
# will be execed at the end. This prevents here-documents from being
751
# left over by shells.
754
# func_fatal_configuration arg...
755
# Echo program name prefixed message to standard error, followed by
756
# a configuration failure hint, and exit.
757
func_fatal_configuration ()
760
func_error "See the $PACKAGE documentation for more information."
761
func_fatal_error "Fatal configuration error."
766
# Display the configuration for all the tags in this script.
769
re_begincf='^# ### BEGIN LIBTOOL'
770
re_endcf='^# ### END LIBTOOL'
772
# Default configuration.
773
$SED "1,/$re_begincf CONFIG/d;/$re_endcf CONFIG/,\$d" < "$progpath"
775
# Now print the configurations for the tags.
776
for tagname in $taglist; do
777
$SED -n "/$re_begincf TAG CONFIG: $tagname\$/,/$re_endcf TAG CONFIG: $tagname\$/p" < "$progpath"
784
# Display the features supported by this script.
788
if test "$build_libtool_libs" = yes; then
789
echo "enable shared libraries"
791
echo "disable shared libraries"
793
if test "$build_old_libs" = yes; then
794
echo "enable static libraries"
796
echo "disable static libraries"
802
# func_enable_tag tagname
803
# Verify that TAGNAME is valid, and either flag an error and exit, or
804
# enable the TAGNAME tag. We also add TAGNAME to the global $taglist
811
re_begincf="^# ### BEGIN LIBTOOL TAG CONFIG: $tagname\$"
812
re_endcf="^# ### END LIBTOOL TAG CONFIG: $tagname\$"
813
sed_extractcf="/$re_begincf/,/$re_endcf/p"
818
func_fatal_error "invalid tag name: $tagname"
822
# Don't test for the "default" C tag, as we know it's
823
# there but not specially marked.
827
if $GREP "$re_begincf" "$progpath" >/dev/null 2>&1; then
828
taglist="$taglist $tagname"
830
# Evaluate the configuration. Be careful to quote the path
831
# and the sed script, to avoid splitting on whitespace, but
832
# also don't use non-portable quotes within backquotes within
833
# quotes we have to do it in 2 steps:
834
extractedcf=`$SED -n -e "$sed_extractcf" < "$progpath"`
837
func_error "ignoring unknown tag $tagname"
843
# Parse options once, thoroughly. This comes as soon as possible in
844
# the script to make things like `libtool --version' happen quickly.
847
# Shorthand for --mode=foo, only valid as the first argument
850
shift; set dummy --mode clean ${1+"$@"}; shift
852
compile|compil|compi|comp|com|co|c)
853
shift; set dummy --mode compile ${1+"$@"}; shift
855
execute|execut|execu|exec|exe|ex|e)
856
shift; set dummy --mode execute ${1+"$@"}; shift
858
finish|finis|fini|fin|fi|f)
859
shift; set dummy --mode finish ${1+"$@"}; shift
861
install|instal|insta|inst|ins|in|i)
862
shift; set dummy --mode install ${1+"$@"}; shift
865
shift; set dummy --mode link ${1+"$@"}; shift
867
uninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u)
868
shift; set dummy --mode uninstall ${1+"$@"}; shift
872
# Parse non-mode specific arguments:
873
while test "$#" -gt 0; do
878
--config) func_config ;;
880
--debug) preserve_args="$preserve_args $opt"
881
func_echo "enabling shell trace mode"
886
-dlopen) test "$#" -eq 0 && func_missing_arg "$opt" && break
887
execute_dlfiles="$execute_dlfiles $1"
891
--dry-run | -n) opt_dry_run=: ;;
892
--features) func_features ;;
893
--finish) mode="finish" ;;
895
--mode) test "$#" -eq 0 && func_missing_arg "$opt" && break
897
# Valid mode arguments:
907
# Catch anything else as an error
908
*) func_error "invalid argument for $opt"
919
opt_duplicate_deps=: ;;
921
--quiet|--silent) preserve_args="$preserve_args $opt"
926
--no-quiet|--no-silent)
927
preserve_args="$preserve_args $opt"
931
--verbose| -v) preserve_args="$preserve_args $opt"
936
--no-verbose) preserve_args="$preserve_args $opt"
940
--tag) test "$#" -eq 0 && func_missing_arg "$opt" && break
941
preserve_args="$preserve_args $opt $1"
942
func_enable_tag "$1" # tagname is set here
946
# Separate optargs to long options:
947
-dlopen=*|--mode=*|--tag=*)
948
func_opt_split "$opt"
949
set dummy "$func_opt_split_opt" "$func_opt_split_arg" ${1+"$@"}
953
-\?|-h) func_usage ;;
954
--help) opt_help=: ;;
955
--help-all) opt_help=': help-all' ;;
956
--version) func_version ;;
958
-*) func_fatal_help "unrecognized option \`$opt'" ;;
968
*cygwin* | *mingw* | *pw32* | *cegcc*)
969
# don't eliminate duplications in $postdeps and $predeps
970
opt_duplicate_compiler_generated_deps=:
973
opt_duplicate_compiler_generated_deps=$opt_duplicate_deps
977
# Having warned about all mis-specified options, bail out if
978
# anything was wrong.
979
$exit_cmd $EXIT_FAILURE
982
# func_check_version_match
983
# Ensure that we are using m4 macros, and libtool script from the same
984
# release of libtool.
985
func_check_version_match ()
987
if test "$package_revision" != "$macro_revision"; then
988
if test "$VERSION" != "$macro_version"; then
989
if test -z "$macro_version"; then
991
$progname: Version mismatch error. This is $PACKAGE $VERSION, but the
992
$progname: definition of this LT_INIT comes from an older release.
993
$progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION
994
$progname: and run autoconf again.
998
$progname: Version mismatch error. This is $PACKAGE $VERSION, but the
999
$progname: definition of this LT_INIT comes from $PACKAGE $macro_version.
1000
$progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION
1001
$progname: and run autoconf again.
1006
$progname: Version mismatch error. This is $PACKAGE $VERSION, revision $package_revision,
1007
$progname: but the definition of this LT_INIT comes from revision $macro_revision.
1008
$progname: You should recreate aclocal.m4 with macros from revision $package_revision
1009
$progname: of $PACKAGE $VERSION and run autoconf again.
1023
# Sanity checks first:
1024
func_check_version_match
1026
if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
1027
func_fatal_configuration "not configured to build any kind of library"
1030
test -z "$mode" && func_fatal_error "error: you must specify a MODE."
1034
eval std_shrext=\"$shrext_cmds\"
1037
# Only execute mode is allowed to have -dlopen flags.
1038
if test -n "$execute_dlfiles" && test "$mode" != execute; then
1039
func_error "unrecognized option \`-dlopen'"
1044
# Change the help message to a mode-specific one.
1045
generic_help="$help"
1046
help="Try \`$progname --help --mode=$mode' for more information."
1051
# True iff FILE is a libtool `.la' library or `.lo' object file.
1052
# This function is only a basic sanity check; it will hardly flush out
1053
# determined imposters.
1057
$SED -e 4q "$1" 2>/dev/null \
1058
| $GREP "^# Generated by .*$PACKAGE" > /dev/null 2>&1
1061
# func_lalib_unsafe_p file
1062
# True iff FILE is a libtool `.la' library or `.lo' object file.
1063
# This function implements the same check as func_lalib_p without
1064
# resorting to external programs. To this end, it redirects stdin and
1065
# closes it afterwards, without saving the original file descriptor.
1066
# As a safety measure, use it only where a negative result would be
1067
# fatal anyway. Works if `file' does not exist.
1068
func_lalib_unsafe_p ()
1071
if test -f "$1" && test -r "$1" && exec 5<&0 <"$1"; then
1072
for lalib_p_l in 1 2 3 4
1075
case "$lalib_p_line" in
1076
\#\ Generated\ by\ *$PACKAGE* ) lalib_p=yes; break;;
1081
test "$lalib_p" = yes
1084
# func_ltwrapper_script_p file
1085
# True iff FILE is a libtool wrapper script
1086
# This function is only a basic sanity check; it will hardly flush out
1087
# determined imposters.
1088
func_ltwrapper_script_p ()
1093
# func_ltwrapper_executable_p file
1094
# True iff FILE is a libtool wrapper executable
1095
# This function is only a basic sanity check; it will hardly flush out
1096
# determined imposters.
1097
func_ltwrapper_executable_p ()
1099
func_ltwrapper_exec_suffix=
1102
*) func_ltwrapper_exec_suffix=.exe ;;
1104
$GREP "$magic_exe" "$1$func_ltwrapper_exec_suffix" >/dev/null 2>&1
1107
# func_ltwrapper_scriptname file
1108
# Assumes file is an ltwrapper_executable
1109
# uses $file to determine the appropriate filename for a
1110
# temporary ltwrapper_script.
1111
func_ltwrapper_scriptname ()
1113
func_ltwrapper_scriptname_result=""
1114
if func_ltwrapper_executable_p "$1"; then
1115
func_dirname_and_basename "$1" "" "."
1116
func_stripname '' '.exe' "$func_basename_result"
1117
func_ltwrapper_scriptname_result="$func_dirname_result/$objdir/${func_stripname_result}_ltshwrapper"
1121
# func_ltwrapper_p file
1122
# True iff FILE is a libtool wrapper script or wrapper executable
1123
# This function is only a basic sanity check; it will hardly flush out
1124
# determined imposters.
1127
func_ltwrapper_script_p "$1" || func_ltwrapper_executable_p "$1"
1131
# func_execute_cmds commands fail_cmd
1132
# Execute tilde-delimited COMMANDS.
1133
# If FAIL_CMD is given, eval that upon failure.
1134
# FAIL_CMD may read-access the current command in variable CMD!
1135
func_execute_cmds ()
1138
save_ifs=$IFS; IFS='~'
1142
func_show_eval "$cmd" "${2-:}"
1149
# Source FILE, adding directory component if necessary.
1150
# Note that it is not necessary on cygwin/mingw to append a dot to
1151
# FILE even if both FILE and FILE.exe exist: automatic-append-.exe
1152
# behavior happens only for exec(3), not for open(2)! Also, sourcing
1153
# `FILE.' does not work on cygwin managed mounts.
1158
*/* | *\\*) . "$1" ;;
1057
1586
avoid parallel builds (make -j) in this platform, or get a better
1060
$run $rm $removelist
1589
$opt_dry_run || $RM $removelist
1061
1590
exit $EXIT_FAILURE
1064
1593
# Just move the object if needed
1065
1594
if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then
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"
1106
*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
1595
func_show_eval '$MV "$output_obj" "$obj"' \
1596
'error=$?; $opt_dry_run || $RM $removelist; exit $error'
1601
func_write_libtool_object "$libobj" "$objdir/$objname" "$objname"
1603
# Unlock the critical section if it was locked
1604
if test "$need_locks" != no; then
1605
removelist=$lockfile
1614
test "$mode" = compile && func_mode_compile ${1+"$@"}
1619
# We need to display help for each of the modes.
1622
# Generic help is extracted from the usage comments
1623
# at the start of this file.
1629
"Usage: $progname [OPTION]... --mode=clean RM [RM-OPTION]... FILE...
1631
Remove files from the build directory.
1633
RM is the name of the program to use to delete files associated with each FILE
1634
(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
1637
If FILE is a libtool library, object or program, all the files associated
1638
with it are deleted. Otherwise, only FILE itself is deleted using RM."
1643
"Usage: $progname [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE
1645
Compile a source file into a libtool library object.
1647
This mode accepts the following additional options:
1649
-o OUTPUT-FILE set the output file name to OUTPUT-FILE
1650
-no-suppress do not suppress compiler output for multiple passes
1651
-prefer-pic try to build PIC objects only
1652
-prefer-non-pic try to build non-PIC objects only
1653
-shared do not build a \`.o' file suitable for static linking
1654
-static only build a \`.o' file suitable for static linking
1655
-Wc,FLAG pass FLAG directly to the compiler
1657
COMPILE-COMMAND is a command to be used in creating a \`standard' object file
1658
from the given SOURCEFILE.
1660
The output file name is determined by removing the directory component from
1661
SOURCEFILE, then substituting the C source code suffix \`.c' with the
1662
library object suffix, \`.lo'."
1667
"Usage: $progname [OPTION]... --mode=execute COMMAND [ARGS]...
1669
Automatically set library path, then run a program.
1671
This mode accepts the following additional options:
1673
-dlopen FILE add the directory containing FILE to the library path
1675
This mode sets the library path environment variable according to \`-dlopen'
1678
If any of the ARGS are libtool executable wrappers, then they are translated
1679
into their corresponding uninstalled binary, and any of their required library
1680
directories are added to the library path.
1682
Then, COMMAND is executed, with ARGS as arguments."
1687
"Usage: $progname [OPTION]... --mode=finish [LIBDIR]...
1689
Complete the installation of libtool libraries.
1691
Each LIBDIR is a directory that contains libtool libraries.
1693
The commands that this mode executes may require superuser privileges. Use
1694
the \`--dry-run' option if you just want to see what would be executed."
1699
"Usage: $progname [OPTION]... --mode=install INSTALL-COMMAND...
1701
Install executables or libraries.
1703
INSTALL-COMMAND is the installation command. The first component should be
1704
either the \`install' or \`cp' program.
1706
The following components of INSTALL-COMMAND are treated specially:
1708
-inst-prefix-dir PREFIX-DIR Use PREFIX-DIR as a staging area for installation
1710
The rest of the components are interpreted as arguments to that command (only
1711
BSD-compatible install options are recognized)."
1716
"Usage: $progname [OPTION]... --mode=link LINK-COMMAND...
1718
Link object files or libraries together to form another library, or to
1719
create an executable program.
1721
LINK-COMMAND is a command using the C compiler that you would use to create
1722
a program from several object files.
1724
The following components of LINK-COMMAND are treated specially:
1726
-all-static do not do any dynamic linking at all
1727
-avoid-version do not add a version suffix if possible
1728
-bindir BINDIR specify path to binaries directory (for systems where
1729
libraries must be found in the PATH setting at runtime)
1730
-dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime
1731
-dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols
1732
-export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
1733
-export-symbols SYMFILE
1734
try to export only the symbols listed in SYMFILE
1735
-export-symbols-regex REGEX
1736
try to export only the symbols matching REGEX
1737
-LLIBDIR search LIBDIR for required installed libraries
1738
-lNAME OUTPUT-FILE requires the installed library libNAME
1739
-module build a library that can dlopened
1740
-no-fast-install disable the fast-install mode
1741
-no-install link a not-installable executable
1742
-no-undefined declare that a library does not refer to external symbols
1743
-o OUTPUT-FILE create OUTPUT-FILE from the specified objects
1744
-objectlist FILE Use a list of object files found in FILE to specify objects
1745
-precious-files-regex REGEX
1746
don't remove output files matching REGEX
1747
-release RELEASE specify package release information
1748
-rpath LIBDIR the created library will eventually be installed in LIBDIR
1749
-R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries
1750
-shared only do dynamic linking of libtool libraries
1751
-shrext SUFFIX override the standard shared library file extension
1752
-static do not do any dynamic linking of uninstalled libtool libraries
1753
-static-libtool-libs
1754
do not do any dynamic linking of libtool libraries
1755
-version-info CURRENT[:REVISION[:AGE]]
1756
specify library version info [each variable defaults to 0]
1757
-weak LIBNAME declare that the target provides the LIBNAME interface
1759
-Xcompiler FLAG pass linker-specific FLAG directly to the compiler
1761
-Xlinker FLAG pass linker-specific FLAG directly to the linker
1762
-XCClinker FLAG pass link-specific FLAG to the compiler driver (CC)
1764
All other options (arguments beginning with \`-') are ignored.
1766
Every other argument is treated as a filename. Files ending in \`.la' are
1767
treated as uninstalled libtool libraries, other files are standard or library
1770
If the OUTPUT-FILE ends in \`.la', then a libtool library is created,
1771
only library objects (\`.lo' files) may be specified, and \`-rpath' is
1772
required, except when creating a convenience library.
1774
If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created
1775
using \`ar' and \`ranlib', or on Windows using \`lib'.
1777
If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file
1778
is created, otherwise an executable program is created."
1783
"Usage: $progname [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE...
1785
Remove libraries from an installation directory.
1787
RM is the name of the program to use to delete files associated with each FILE
1788
(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
1791
If FILE is a libtool library, all the files associated with it are deleted.
1792
Otherwise, only FILE itself is deleted using RM."
1796
func_fatal_help "invalid operation mode \`$mode'"
1801
$ECHO "Try \`$progname --help' for more information about other modes."
1804
# Now that we've collected a possible --mode arg, show help if necessary
1806
if test "$opt_help" = :; then
1811
for mode in compile link execute install finish uninstall clean; do
1814
} | sed -n '1p; 2,$s/^Usage:/ or: /p'
1817
for mode in compile link execute install finish uninstall clean; do
1823
/^When reporting/,/^Report/{
1828
/information about other modes/d
1829
/more detailed .*MODE/d
1830
s/^Usage:.*--mode=\([^ ]*\) .*/Description of \1 mode:/'
1836
# func_mode_execute arg...
1837
func_mode_execute ()
1840
# The first argument is the command name.
1843
func_fatal_help "you must specify a COMMAND"
1845
# Handle -dlopen flags immediately.
1846
for file in $execute_dlfiles; do
1848
|| func_fatal_help "\`$file' is not a file"
1853
# Check to see that this really is a libtool archive.
1854
func_lalib_unsafe_p "$file" \
1855
|| func_fatal_help "\`$lib' is not a valid libtool archive"
1857
# Read the libtool library.
1862
# Skip this library if it cannot be dlopened.
1863
if test -z "$dlname"; then
1864
# Warn if it was a shared library.
1865
test -n "$library_names" && \
1866
func_warning "\`$file' was not linked with \`-export-dynamic'"
1870
func_dirname "$file" "" "."
1871
dir="$func_dirname_result"
1873
if test -f "$dir/$objdir/$dlname"; then
1876
if test ! -f "$dir/$dlname"; then
1877
func_fatal_error "cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'"
1883
# Just add the directory containing the .lo file.
1884
func_dirname "$file" "" "."
1885
dir="$func_dirname_result"
1889
func_warning "\`-dlopen' is ignored for non-libtool libraries and objects"
1894
# Get the absolute pathname.
1895
absdir=`cd "$dir" && pwd`
1896
test -n "$absdir" && dir="$absdir"
1898
# Now add the directory to shlibpath_var.
1899
if eval "test -z \"\$$shlibpath_var\""; then
1900
eval "$shlibpath_var=\"\$dir\""
1902
eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\""
1906
# This variable tells wrapper scripts just to set shlibpath_var
1907
# rather than running their programs.
1908
libtool_execute_magic="$magic"
1910
# Check if any of the arguments is a wrapper script.
1915
-* | *.la | *.lo ) ;;
1917
# Do a test to see if this is really a libtool program.
1918
if func_ltwrapper_script_p "$file"; then
1920
# Transform arg to wrapped name.
1921
file="$progdir/$program"
1922
elif func_ltwrapper_executable_p "$file"; then
1923
func_ltwrapper_scriptname "$file"
1924
func_source "$func_ltwrapper_scriptname_result"
1925
# Transform arg to wrapped name.
1926
file="$progdir/$program"
1930
# Quote arguments (to preserve shell metacharacters).
1931
func_quote_for_eval "$file"
1932
args="$args $func_quote_for_eval_result"
1935
if test "X$opt_dry_run" = Xfalse; then
1936
if test -n "$shlibpath_var"; then
1937
# Export the shlibpath_var.
1938
eval "export $shlibpath_var"
1941
# Restore saved environment variables
1942
for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
1944
eval "if test \"\${save_$lt_var+set}\" = set; then
1945
$lt_var=\$save_$lt_var; export $lt_var
1951
# Now prepare to actually exec the command.
1952
exec_cmd="\$cmd$args"
1954
# Display what would be done.
1955
if test -n "$shlibpath_var"; then
1956
eval "\$ECHO \"\$shlibpath_var=\$$shlibpath_var\""
1957
echo "export $shlibpath_var"
1964
test "$mode" = execute && func_mode_execute ${1+"$@"}
1967
# func_mode_finish arg...
1974
if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
1977
libdirs="$libdirs $dir"
1980
for libdir in $libdirs; do
1981
if test -n "$finish_cmds"; then
1982
# Do each command in the finish commands.
1983
func_execute_cmds "$finish_cmds" 'admincmds="$admincmds
1986
if test -n "$finish_eval"; then
1987
# Do the single finish_eval.
1988
eval cmds=\"$finish_eval\"
1989
$opt_dry_run || eval "$cmds" || admincmds="$admincmds
1995
# Exit here if they wanted silent mode.
1996
$opt_silent && exit $EXIT_SUCCESS
1998
echo "----------------------------------------------------------------------"
1999
echo "Libraries have been installed in:"
2000
for libdir in $libdirs; do
2004
echo "If you ever happen to want to link against installed libraries"
2005
echo "in a given directory, LIBDIR, you must either use libtool, and"
2006
echo "specify the full pathname of the library, or use the \`-LLIBDIR'"
2007
echo "flag during linking and do at least one of the following:"
2008
if test -n "$shlibpath_var"; then
2009
echo " - add LIBDIR to the \`$shlibpath_var' environment variable"
2010
echo " during execution"
2012
if test -n "$runpath_var"; then
2013
echo " - add LIBDIR to the \`$runpath_var' environment variable"
2014
echo " during linking"
2016
if test -n "$hardcode_libdir_flag_spec"; then
2018
eval flag=\"$hardcode_libdir_flag_spec\"
2020
$ECHO " - use the \`$flag' linker flag"
2022
if test -n "$admincmds"; then
2023
$ECHO " - have your system administrator run these commands:$admincmds"
2025
if test -f /etc/ld.so.conf; then
2026
echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'"
2030
echo "See any operating system documentation about shared libraries for"
2032
solaris2.[6789]|solaris2.1[0-9])
2033
echo "more information, such as the ld(1), crle(1) and ld.so(8) manual"
2037
echo "more information, such as the ld(1) and ld.so(8) manual pages."
2040
echo "----------------------------------------------------------------------"
2044
test "$mode" = finish && func_mode_finish ${1+"$@"}
2047
# func_mode_install arg...
2048
func_mode_install ()
2051
# There may be an optional sh(1) argument at the beginning of
2052
# install_prog (especially on Windows NT).
2053
if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh ||
2054
# Allow the use of GNU shtool's install command.
2055
case $nonopt in *shtool*) :;; *) false;; esac; then
2056
# Aesthetically quote it.
2057
func_quote_for_eval "$nonopt"
2058
install_prog="$func_quote_for_eval_result "
2066
# The real first argument should be the name of the installation program.
2067
# Aesthetically quote it.
2068
func_quote_for_eval "$arg"
2069
install_prog="$install_prog$func_quote_for_eval_result"
2070
install_shared_prog=$install_prog
2071
case " $install_prog " in
2072
*[\\\ /]cp\ *) install_cp=: ;;
2073
*) install_cp=false ;;
2076
# We need to accept at least all the BSD install flags.
2088
if test -n "$dest"; then
2089
files="$files $dest"
2097
if $install_cp; then :; else
2111
# If the previous option needed an argument, then skip it.
2112
if test -n "$prev"; then
2113
if test "x$prev" = x-m && test -n "$install_override_mode"; then
2114
arg2=$install_override_mode
2125
# Aesthetically quote the argument.
2126
func_quote_for_eval "$arg"
2127
install_prog="$install_prog $func_quote_for_eval_result"
2128
if test -n "$arg2"; then
2129
func_quote_for_eval "$arg2"
2131
install_shared_prog="$install_shared_prog $func_quote_for_eval_result"
2134
test -z "$install_prog" && \
2135
func_fatal_help "you must specify an install program"
2137
test -n "$prev" && \
2138
func_fatal_help "the \`$prev' option requires an argument"
2140
if test -n "$install_override_mode" && $no_mode; then
2141
if $install_cp; then :; else
2142
func_quote_for_eval "$install_override_mode"
2143
install_shared_prog="$install_shared_prog -m $func_quote_for_eval_result"
2147
if test -z "$files"; then
2148
if test -z "$dest"; then
2149
func_fatal_help "no file or destination specified"
2151
func_fatal_help "you must specify a destination"
2155
# Strip any trailing slash from the destination.
2156
func_stripname '' '/' "$dest"
2157
dest=$func_stripname_result
2159
# Check to see that the destination is a directory.
2160
test -d "$dest" && isdir=yes
2161
if test "$isdir" = yes; then
2165
func_dirname_and_basename "$dest" "" "."
2166
destdir="$func_dirname_result"
2167
destname="$func_basename_result"
2169
# Not a directory, so check to see that there is only one file specified.
2170
set dummy $files; shift
2171
test "$#" -gt 1 && \
2172
func_fatal_help "\`$dest' is not a directory"
2175
[\\/]* | [A-Za-z]:[\\/]*) ;;
2177
for file in $files; do
2181
func_fatal_help "\`$destdir' must be an absolute directory name"
2188
# This variable tells wrapper scripts just to set variables rather
2189
# than running their programs.
2190
libtool_install_magic="$magic"
2195
for file in $files; do
2197
# Do each installation.
2200
# Do the static libraries later.
2201
staticlibs="$staticlibs $file"
2205
# Check to see that this really is a libtool archive.
2206
func_lalib_unsafe_p "$file" \
2207
|| func_fatal_help "\`$file' is not a valid libtool archive"
2214
# Add the libdir to current_libdirs if it is the destination.
2215
if test "X$destdir" = "X$libdir"; then
2216
case "$current_libdirs " in
2218
*) current_libdirs="$current_libdirs $libdir" ;;
2221
# Note the libdir as a future libdir.
2222
case "$future_libdirs " in
2224
*) future_libdirs="$future_libdirs $libdir" ;;
2228
func_dirname "$file" "/" ""
2229
dir="$func_dirname_result"
2232
if test -n "$relink_command"; then
2233
# Determine the prefix the user has applied to our future dir.
2234
inst_prefix_dir=`$ECHO "$destdir" | $SED -e "s%$libdir\$%%"`
2236
# Don't allow the user to place us outside of our expected
2237
# location b/c this prevents finding dependent libraries that
2238
# are installed to the same prefix.
2239
# At present, this check doesn't affect windows .dll's that
2240
# are installed into $libdir/../bin (currently, that works fine)
2241
# but it's something to keep an eye on.
2242
test "$inst_prefix_dir" = "$destdir" && \
2243
func_fatal_error "error: cannot install \`$file' to a directory not ending in $libdir"
2245
if test -n "$inst_prefix_dir"; then
2246
# Stick the inst_prefix_dir data into the link command.
2247
relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"`
2249
relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%%"`
2252
func_warning "relinking \`$file'"
2253
func_show_eval "$relink_command" \
2254
'func_fatal_error "error: relink \`$file'\'' with the above command before installing it"'
2257
# See the names of the shared library.
2258
set dummy $library_names; shift
2259
if test -n "$1"; then
2264
test -n "$relink_command" && srcname="$realname"T
2266
# Install the shared library and build the symlinks.
2267
func_show_eval "$install_shared_prog $dir/$srcname $destdir/$realname" \
2271
cygwin* | mingw* | pw32* | cegcc*)
2279
if test -n "$tstripme" && test -n "$striplib"; then
2280
func_show_eval "$striplib $destdir/$realname" 'exit $?'
2283
if test "$#" -gt 0; then
2284
# Delete the old symlinks, and create new ones.
2285
# Try `ln -sf' first, because the `ln' binary might depend on
2286
# the symlink we replace! Solaris /bin/ln does not understand -f,
2287
# so we also need to try rm && ln -s.
2290
test "$linkname" != "$realname" \
2291
&& func_show_eval "(cd $destdir && { $LN_S -f $realname $linkname || { $RM $linkname && $LN_S $realname $linkname; }; })"
2295
# Do each command in the postinstall commands.
2296
lib="$destdir/$realname"
2297
func_execute_cmds "$postinstall_cmds" 'exit $?'
2300
# Install the pseudo-library for information purposes.
2301
func_basename "$file"
2302
name="$func_basename_result"
2303
instname="$dir/$name"i
2304
func_show_eval "$install_prog $instname $destdir/$name" 'exit $?'
2306
# Maybe install the static library, too.
2307
test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library"
2311
# Install (i.e. copy) a libtool object.
2313
# Figure out destination file name, if it wasn't already specified.
2314
if test -n "$destname"; then
2315
destfile="$destdir/$destname"
2317
func_basename "$file"
2318
destfile="$func_basename_result"
2319
destfile="$destdir/$destfile"
2322
# Deduce the name of the destination old-style object file.
2325
func_lo2o "$destfile"
2326
staticdest=$func_lo2o_result
2329
staticdest="$destfile"
2333
func_fatal_help "cannot copy a libtool object to \`$destfile'"
2337
# Install the libtool object if requested.
2338
test -n "$destfile" && \
2339
func_show_eval "$install_prog $file $destfile" 'exit $?'
2341
# Install the old object if enabled.
2342
if test "$build_old_libs" = yes; then
2343
# Deduce the name of the old-style object file.
2345
staticobj=$func_lo2o_result
2346
func_show_eval "$install_prog \$staticobj \$staticdest" 'exit $?'
2352
# Figure out destination file name, if it wasn't already specified.
2353
if test -n "$destname"; then
2354
destfile="$destdir/$destname"
2356
func_basename "$file"
2357
destfile="$func_basename_result"
2358
destfile="$destdir/$destfile"
2361
# If the file is missing, and there is a .exe on the end, strip it
2362
# because it is most likely a libtool script we actually want to
2367
if test ! -f "$file"; then
2368
func_stripname '' '.exe' "$file"
2369
file=$func_stripname_result
2375
# Do a test to see if this is really a libtool program.
2378
if func_ltwrapper_executable_p "$file"; then
2379
func_ltwrapper_scriptname "$file"
2380
wrapper=$func_ltwrapper_scriptname_result
2382
func_stripname '' '.exe' "$file"
2383
wrapper=$func_stripname_result
2390
if func_ltwrapper_script_p "$wrapper"; then
2394
func_source "$wrapper"
2396
# Check the variables that should have been set.
2397
test -z "$generated_by_libtool_version" && \
2398
func_fatal_error "invalid libtool wrapper script \`$wrapper'"
2401
for lib in $notinst_deplibs; do
2402
# Check to see that each library is installed.
2404
if test -f "$lib"; then
2407
libfile="$libdir/"`$ECHO "$lib" | $SED 's%^.*/%%g'` ### testsuite: skip nested quoting test
2408
if test -n "$libdir" && test ! -f "$libfile"; then
2409
func_warning "\`$lib' has not been installed in \`$libdir'"
2415
func_source "$wrapper"
2418
if test "$fast_install" = no && test -n "$relink_command"; then
2420
if test "$finalize" = yes; then
2421
tmpdir=`func_mktempdir`
2422
func_basename "$file$stripped_ext"
2423
file="$func_basename_result"
2424
outputname="$tmpdir/$file"
2425
# Replace the output file specification.
2426
relink_command=`$ECHO "$relink_command" | $SED 's%@OUTPUT@%'"$outputname"'%g'`
2429
func_quote_for_expand "$relink_command"
2430
eval "func_echo $func_quote_for_expand_result"
2432
if eval "$relink_command"; then :
2434
func_error "error: relink \`$file' with the above command before installing it"
2435
$opt_dry_run || ${RM}r "$tmpdir"
2440
func_warning "cannot relink \`$file'"
2444
# Install the binary that we compiled earlier.
2445
file=`$ECHO "$file$stripped_ext" | $SED "s%\([^/]*\)$%$objdir/\1%"`
2449
# remove .exe since cygwin /usr/bin/install will append another
2451
case $install_prog,$host in
2452
*/usr/bin/install*,*cygwin*)
2453
case $file:$destfile in
2458
destfile=$destfile.exe
2461
func_stripname '' '.exe' "$destfile"
2462
destfile=$func_stripname_result
2467
func_show_eval "$install_prog\$stripme \$file \$destfile" 'exit $?'
2468
$opt_dry_run || if test -n "$outputname"; then
2475
for file in $staticlibs; do
2476
func_basename "$file"
2477
name="$func_basename_result"
2479
# Set up the ranlib parameters.
2480
oldlib="$destdir/$name"
2482
func_show_eval "$install_prog \$file \$oldlib" 'exit $?'
2484
if test -n "$stripme" && test -n "$old_striplib"; then
2485
func_show_eval "$old_striplib $oldlib" 'exit $?'
2488
# Do each command in the postinstall commands.
2489
func_execute_cmds "$old_postinstall_cmds" 'exit $?'
2492
test -n "$future_libdirs" && \
2493
func_warning "remember to run \`$progname --finish$future_libdirs'"
2495
if test -n "$current_libdirs"; then
2496
# Maybe just do a dry run.
2497
$opt_dry_run && current_libdirs=" -n$current_libdirs"
2498
exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs'
2504
test "$mode" = install && func_mode_install ${1+"$@"}
2507
# func_generate_dlsyms outputname originator pic_p
2508
# Extract symbols from dlprefiles and create ${outputname}S.o with
2509
# a dlpreopen symbol table.
2510
func_generate_dlsyms ()
2516
my_prefix=`$ECHO "$my_originator" | sed 's%[^a-zA-Z0-9]%_%g'`
2519
if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
2520
if test -n "$NM" && test -n "$global_symbol_pipe"; then
2521
my_dlsyms="${my_outputname}S.c"
2523
func_error "not configured to extract global symbols from dlpreopened files"
2527
if test -n "$my_dlsyms"; then
2531
# Discover the nlist of each of the dlfiles.
2532
nlist="$output_objdir/${my_outputname}.nm"
2534
func_show_eval "$RM $nlist ${nlist}S ${nlist}T"
2536
# Parse the name list into a source file.
2537
func_verbose "creating $output_objdir/$my_dlsyms"
2539
$opt_dry_run || $ECHO > "$output_objdir/$my_dlsyms" "\
2540
/* $my_dlsyms - symbol resolution table for \`$my_outputname' dlsym emulation. */
2541
/* Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION */
2547
#if defined(__GNUC__) && (((__GNUC__ == 4) && (__GNUC_MINOR__ >= 4)) || (__GNUC__ > 4))
2548
#pragma GCC diagnostic ignored \"-Wstrict-prototypes\"
2551
/* External symbol declarations for the compiler. */\
2554
if test "$dlself" = yes; then
2555
func_verbose "generating symbol list for \`$output'"
2557
$opt_dry_run || echo ': @PROGRAM@ ' > "$nlist"
2559
# Add our own program objects to the symbol list.
2560
progfiles=`$ECHO "$objs$old_deplibs" | $SP2NL | $SED "$lo2o" | $NL2SP`
2561
for progfile in $progfiles; do
2562
func_verbose "extracting global C symbols from \`$progfile'"
2563
$opt_dry_run || eval "$NM $progfile | $global_symbol_pipe >> '$nlist'"
2566
if test -n "$exclude_expsyms"; then
2568
eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
2569
eval '$MV "$nlist"T "$nlist"'
2573
if test -n "$export_symbols_regex"; then
2575
eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T'
2576
eval '$MV "$nlist"T "$nlist"'
2580
# Prepare the list of exported symbols
2581
if test -z "$export_symbols"; then
2582
export_symbols="$output_objdir/$outputname.exp"
2585
eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
2587
*cygwin* | *mingw* | *cegcc* )
2588
eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
2589
eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"'
2595
eval "${SED} -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"'
2596
eval '$GREP -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T'
2597
eval '$MV "$nlist"T "$nlist"'
2599
*cygwin* | *mingw* | *cegcc* )
2600
eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
2601
eval 'cat "$nlist" >> "$output_objdir/$outputname.def"'
2608
for dlprefile in $dlprefiles; do
2609
func_verbose "extracting global C symbols from \`$dlprefile'"
2610
func_basename "$dlprefile"
2611
name="$func_basename_result"
2613
eval '$ECHO ": $name " >> "$nlist"'
2614
eval "$NM $dlprefile 2>/dev/null | $global_symbol_pipe >> '$nlist'"
2619
# Make sure we have at least an empty file.
2620
test -f "$nlist" || : > "$nlist"
2622
if test -n "$exclude_expsyms"; then
2623
$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T
2624
$MV "$nlist"T "$nlist"
2627
# Try sorting and uniquifying the output.
2628
if $GREP -v "^: " < "$nlist" |
2629
if sort -k 3 </dev/null >/dev/null 2>&1; then
2634
uniq > "$nlist"S; then
2637
$GREP -v "^: " < "$nlist" > "$nlist"S
2640
if test -f "$nlist"S; then
2641
eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$my_dlsyms"'
2643
echo '/* NONE */' >> "$output_objdir/$my_dlsyms"
2646
echo >> "$output_objdir/$my_dlsyms" "\
2648
/* The mapping between symbol names and symbols. */
2655
*cygwin* | *mingw* | *cegcc* )
2656
echo >> "$output_objdir/$my_dlsyms" "\
2657
/* DATA imports from DLLs on WIN32 con't be const, because
2658
runtime relocations are performed -- see ld's documentation
2659
on pseudo-relocs. */"
2662
echo >> "$output_objdir/$my_dlsyms" "\
2663
/* This system does not cope well with relocations in const data */"
2666
lt_dlsym_const=const ;;
2669
echo >> "$output_objdir/$my_dlsyms" "\
2670
extern $lt_dlsym_const lt_dlsymlist
2671
lt_${my_prefix}_LTX_preloaded_symbols[];
2672
$lt_dlsym_const lt_dlsymlist
2673
lt_${my_prefix}_LTX_preloaded_symbols[] =
2675
{ \"$my_originator\", (void *) 0 },"
2677
case $need_lib_prefix in
2679
eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$my_dlsyms"
2682
eval "$global_symbol_to_c_name_address_lib_prefix" < "$nlist" >> "$output_objdir/$my_dlsyms"
2685
echo >> "$output_objdir/$my_dlsyms" "\
2689
/* This works around a problem in FreeBSD linker */
2690
#ifdef FREEBSD_WORKAROUND
2691
static const void *lt_preloaded_setup() {
2692
return lt_${my_prefix}_LTX_preloaded_symbols;
2702
pic_flag_for_symtable=
2703
case "$compile_command " in
2707
# compiling the symbol table file with pic_flag works around
2708
# a FreeBSD bug that causes programs to crash when -lm is
2709
# linked before any other PIC object. But we must not use
2710
# pic_flag when linking with -static. The problem exists in
2711
# FreeBSD 2.2.6 and is fixed in FreeBSD 3.1.
2712
*-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)
2713
pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND" ;;
2715
pic_flag_for_symtable=" $pic_flag" ;;
2717
if test "X$my_pic_p" != Xno; then
2718
pic_flag_for_symtable=" $pic_flag"
2725
for arg in $LTCFLAGS; do
2727
-pie | -fpie | -fPIE) ;;
2728
*) symtab_cflags="$symtab_cflags $arg" ;;
2732
# Now compile the dynamic symbol file.
2733
func_show_eval '(cd $output_objdir && $LTCC$symtab_cflags -c$no_builtin_flag$pic_flag_for_symtable "$my_dlsyms")' 'exit $?'
2735
# Clean up the generated files.
2736
func_show_eval '$RM "$output_objdir/$my_dlsyms" "$nlist" "${nlist}S" "${nlist}T"'
2738
# Transform the symbol file into the correct name.
2739
symfileobj="$output_objdir/${my_outputname}S.$objext"
2741
*cygwin* | *mingw* | *cegcc* )
2742
if test -f "$output_objdir/$my_outputname.def"; then
2743
compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"`
2744
finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"`
2746
compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"`
2747
finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"`
2751
compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"`
2752
finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"`
2757
func_fatal_error "unknown suffix for \`$my_dlsyms'"
2761
# We keep going just in case the user didn't refer to
2762
# lt_preloaded_symbols. The linker will fail if global_symbol_pipe
2763
# really was required.
2765
# Nullify the symbol file.
2766
compile_command=`$ECHO "$compile_command" | $SED "s% @SYMFILE@%%"`
2767
finalize_command=`$ECHO "$finalize_command" | $SED "s% @SYMFILE@%%"`
2771
# func_win32_libid arg
2772
# return the library type of file 'arg'
2774
# Need a lot of goo to handle *both* DLLs and import libs
2775
# Has to be a shell function in order to 'eat' the argument
2776
# that is supplied when $file_magic_command is called.
2777
# Despite the name, also deal with 64 bit binaries.
2781
win32_libid_type="unknown"
2782
win32_fileres=`file -L $1 2>/dev/null`
2783
case $win32_fileres in
2784
*ar\ archive\ import\ library*) # definitely import
2785
win32_libid_type="x86 archive import"
2787
*ar\ archive*) # could be an import, or static
2788
# Keep the egrep pattern in sync with the one in _LT_CHECK_MAGIC_METHOD.
2789
if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null |
2790
$EGREP 'file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' >/dev/null; then
2791
win32_nmres=`eval $NM -f posix -A $1 |
2800
case $win32_nmres in
2801
import*) win32_libid_type="x86 archive import";;
2802
*) win32_libid_type="x86 archive static";;
2807
win32_libid_type="x86 DLL"
2809
*executable*) # but shell scripts are "executable" too...
2810
case $win32_fileres in
2811
*MS\ Windows\ PE\ Intel*)
2812
win32_libid_type="x86 DLL"
2817
$ECHO "$win32_libid_type"
2822
# func_extract_an_archive dir oldlib
2823
func_extract_an_archive ()
2826
f_ex_an_ar_dir="$1"; shift
2827
f_ex_an_ar_oldlib="$1"
2828
if test "$lock_old_archive_extraction" = yes; then
2829
lockfile=$f_ex_an_ar_oldlib.lock
2830
until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do
2831
func_echo "Waiting for $lockfile to be removed"
2835
func_show_eval "(cd \$f_ex_an_ar_dir && $AR x \"\$f_ex_an_ar_oldlib\")" \
2836
'stat=$?; rm -f "$lockfile"; exit $stat'
2837
if test "$lock_old_archive_extraction" = yes; then
2838
$opt_dry_run || rm -f "$lockfile"
2840
if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then
2843
func_fatal_error "object name conflicts in archive: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib"
2848
# func_extract_archives gentop oldlib ...
2849
func_extract_archives ()
2852
my_gentop="$1"; shift
2853
my_oldlibs=${1+"$@"}
2859
for my_xlib in $my_oldlibs; do
2860
# Extract the objects.
2862
[\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;;
2863
*) my_xabs=`pwd`"/$my_xlib" ;;
2865
func_basename "$my_xlib"
2866
my_xlib="$func_basename_result"
2869
case " $extracted_archives " in
2871
func_arith $extracted_serial + 1
2872
extracted_serial=$func_arith_result
2873
my_xlib_u=lt$extracted_serial-$my_xlib ;;
2877
extracted_archives="$extracted_archives $my_xlib_u"
2878
my_xdir="$my_gentop/$my_xlib_u"
2880
func_mkdir_p "$my_xdir"
2884
func_verbose "Extracting $my_xabs"
2885
# Do not bother doing anything if just a dry run
2887
darwin_orig_dir=`pwd`
2888
cd $my_xdir || exit $?
2889
darwin_archive=$my_xabs
2891
darwin_base_archive=`basename "$darwin_archive"`
2892
darwin_arches=`$LIPO -info "$darwin_archive" 2>/dev/null | $GREP Architectures 2>/dev/null || true`
2893
if test -n "$darwin_arches"; then
2894
darwin_arches=`$ECHO "$darwin_arches" | $SED -e 's/.*are://'`
2896
func_verbose "$darwin_base_archive has multiple architectures $darwin_arches"
2897
for darwin_arch in $darwin_arches ; do
2898
func_mkdir_p "unfat-$$/${darwin_base_archive}-${darwin_arch}"
2899
$LIPO -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}"
2900
cd "unfat-$$/${darwin_base_archive}-${darwin_arch}"
2901
func_extract_an_archive "`pwd`" "${darwin_base_archive}"
2903
$RM "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}"
2904
done # $darwin_arches
2905
## Okay now we've a bunch of thin objects, gotta fatten them up :)
2906
darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print | $SED -e "$basename" | sort -u`
2909
for darwin_file in $darwin_filelist; do
2910
darwin_files=`find unfat-$$ -name $darwin_file -print | sort | $NL2SP`
2911
$LIPO -create -output "$darwin_file" $darwin_files
2912
done # $darwin_filelist
2914
cd "$darwin_orig_dir"
2917
func_extract_an_archive "$my_xdir" "$my_xabs"
2922
func_extract_an_archive "$my_xdir" "$my_xabs"
2925
my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | sort | $NL2SP`
2928
func_extract_archives_result="$my_oldobjs"
2932
# func_emit_wrapper [arg=no]
2934
# Emit a libtool wrapper script on stdout.
2935
# Don't directly open a file because we may want to
2936
# incorporate the script contents within a cygwin/mingw
2937
# wrapper executable. Must ONLY be called from within
2938
# func_mode_link because it depends on a number of variables
2941
# ARG is the value that the WRAPPER_SCRIPT_BELONGS_IN_OBJDIR
2942
# variable will take. If 'yes', then the emitted script
2943
# will assume that the directory in which it is stored is
2944
# the $objdir directory. This is a cygwin/mingw-specific
2946
func_emit_wrapper ()
2948
func_emit_wrapper_arg1=${1-no}
2953
# $output - temporary wrapper script for $objdir/$outputname
2954
# Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
2956
# The $output program cannot be directly executed until all the libtool
2957
# libraries that it depends on are installed.
2959
# This wrapper script should never be moved out of the build directory.
2960
# If it is, it will not operate correctly.
2962
# Sed substitution that helps us do robust quoting. It backslashifies
2963
# metacharacters that are still active within double-quoted strings.
2964
sed_quote_subst='$sed_quote_subst'
2966
# Be Bourne compatible
2967
if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then
2970
# Zsh 3.x and 4.x performs word splitting on \${1+\"\$@\"}, which
2971
# is contrary to our usage. Disable this feature.
2972
alias -g '\${1+\"\$@\"}'='\"\$@\"'
2973
setopt NO_GLOB_SUBST
2975
case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac
2977
BIN_SH=xpg4; export BIN_SH # for Tru64
2978
DUALCASE=1; export DUALCASE # for MKS sh
2980
# The HP-UX ksh and POSIX shell print the target directory to stdout
2982
(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
2984
relink_command=\"$relink_command\"
2986
# This environment variable determines our operation mode.
2987
if test \"\$libtool_install_magic\" = \"$magic\"; then
2988
# install mode needs the following variables:
2989
generated_by_libtool_version='$macro_version'
2990
notinst_deplibs='$notinst_deplibs'
2992
# When we are sourced in execute mode, \$file and \$ECHO are already set.
2993
if test \"\$libtool_execute_magic\" != \"$magic\"; then
2996
qECHO=`$ECHO "$ECHO" | $SED "$sed_quote_subst"`
2999
# A function that is used when there is no print builtin or printf.
3000
func_fallback_echo ()
3002
eval 'cat <<_LTECHO_EOF
3009
# Very basic option parsing. These options are (a) specific to
3010
# the libtool wrapper, (b) are identical between the wrapper
3011
# /script/ and the wrapper /executable/ which is used only on
3012
# windows platforms, and (c) all begin with the string "--lt-"
3013
# (application programs are unlikely to have options which match
3016
# There are only two supported options: --lt-debug and
3017
# --lt-dump-script. There is, deliberately, no --lt-help.
3019
# The first argument to this parsing function should be the
3020
# script's $0 value, followed by "$@".
3022
func_parse_lt_options ()
3028
case \"\$lt_opt\" in
3029
--lt-debug) lt_option_debug=1 ;;
3031
lt_dump_D=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%/[^/]*$%%'\`
3032
test \"X\$lt_dump_D\" = \"X\$lt_script_arg0\" && lt_dump_D=.
3033
lt_dump_F=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%^.*/%%'\`
3034
cat \"\$lt_dump_D/\$lt_dump_F\"
3038
\$ECHO \"Unrecognized --lt- option: '\$lt_opt'\" 1>&2
3044
# Print the debug banner immediately:
3045
if test -n \"\$lt_option_debug\"; then
3046
echo \"${outputname}:${output}:\${LINENO}: libtool wrapper (GNU $PACKAGE$TIMESTAMP) $VERSION\" 1>&2
3050
# Used when --lt-debug. Prints its arguments to stdout
3051
# (redirection is the responsibility of the caller)
3052
func_lt_dump_args ()
3057
\$ECHO \"${outputname}:${output}:\${LINENO}: newargv[\$lt_dump_args_N]: \$lt_arg\"
3058
lt_dump_args_N=\`expr \$lt_dump_args_N + 1\`
3062
# Core function for launching the target application
3063
func_exec_program_core ()
3067
# Backslashes separate directories on plain windows
3068
*-*-mingw | *-*-os2* | *-cegcc*)
3070
if test -n \"\$lt_option_debug\"; then
3071
\$ECHO \"${outputname}:${output}:\${LINENO}: newargv[0]: \$progdir\\\\\$program\" 1>&2
3072
func_lt_dump_args \${1+\"\$@\"} 1>&2
3074
exec \"\$progdir\\\\\$program\" \${1+\"\$@\"}
3080
if test -n \"\$lt_option_debug\"; then
3081
\$ECHO \"${outputname}:${output}:\${LINENO}: newargv[0]: \$progdir/\$program\" 1>&2
3082
func_lt_dump_args \${1+\"\$@\"} 1>&2
3084
exec \"\$progdir/\$program\" \${1+\"\$@\"}
3089
\$ECHO \"\$0: cannot exec \$program \$*\" 1>&2
3093
# A function to encapsulate launching the target application
3094
# Strips options in the --lt-* namespace from \$@ and
3095
# launches target application with the remaining arguments.
3096
func_exec_program ()
3102
*) set x \"\$@\" \"\$lt_wr_arg\"; shift;;
3106
func_exec_program_core \${1+\"\$@\"}
3110
func_parse_lt_options \"\$0\" \${1+\"\$@\"}
3112
# Find the directory that this script lives in.
3113
thisdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*$%%'\`
3114
test \"x\$thisdir\" = \"x\$file\" && thisdir=.
3116
# Follow symbolic links until we get to the real thisdir.
3117
file=\`ls -ld \"\$file\" | $SED -n 's/.*-> //p'\`
3118
while test -n \"\$file\"; do
3119
destdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*\$%%'\`
3121
# If there was a directory component, then change thisdir.
3122
if test \"x\$destdir\" != \"x\$file\"; then
3123
case \"\$destdir\" in
3124
[\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;;
3125
*) thisdir=\"\$thisdir/\$destdir\" ;;
3129
file=\`\$ECHO \"\$file\" | $SED 's%^.*/%%'\`
3130
file=\`ls -ld \"\$thisdir/\$file\" | $SED -n 's/.*-> //p'\`
3133
# Usually 'no', except on cygwin/mingw when embedded into
3135
WRAPPER_SCRIPT_BELONGS_IN_OBJDIR=$func_emit_wrapper_arg1
3136
if test \"\$WRAPPER_SCRIPT_BELONGS_IN_OBJDIR\" = \"yes\"; then
3137
# special case for '.'
3138
if test \"\$thisdir\" = \".\"; then
3141
# remove .libs from thisdir
3142
case \"\$thisdir\" in
3143
*[\\\\/]$objdir ) thisdir=\`\$ECHO \"\$thisdir\" | $SED 's%[\\\\/][^\\\\/]*$%%'\` ;;
3144
$objdir ) thisdir=. ;;
3148
# Try to get the absolute directory name.
3149
absdir=\`cd \"\$thisdir\" && pwd\`
3150
test -n \"\$absdir\" && thisdir=\"\$absdir\"
3153
if test "$fast_install" = yes; then
3155
program=lt-'$outputname'$exeext
3156
progdir=\"\$thisdir/$objdir\"
3158
if test ! -f \"\$progdir/\$program\" ||
3159
{ file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\
3160
test \"X\$file\" != \"X\$progdir/\$program\"; }; then
3162
file=\"\$\$-\$program\"
3164
if test ! -d \"\$progdir\"; then
3165
$MKDIR \"\$progdir\"
3167
$RM \"\$progdir/\$file\"
3172
# relink executable if necessary
3173
if test -n \"\$relink_command\"; then
3174
if relink_command_output=\`eval \$relink_command 2>&1\`; then :
3176
$ECHO \"\$relink_command_output\" >&2
3177
$RM \"\$progdir/\$file\"
3182
$MV \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null ||
3183
{ $RM \"\$progdir/\$program\";
3184
$MV \"\$progdir/\$file\" \"\$progdir/\$program\"; }
3185
$RM \"\$progdir/\$file\"
3189
program='$outputname'
3190
progdir=\"\$thisdir/$objdir\"
3196
if test -f \"\$progdir/\$program\"; then"
3198
# Export our shlibpath_var if we have one.
3199
if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
3201
# Add our own library path to $shlibpath_var
3202
$shlibpath_var=\"$temp_rpath\$$shlibpath_var\"
3204
# Some systems cannot cope with colon-terminated $shlibpath_var
3205
# The second colon is a workaround for a bug in BeOS R4 sed
3206
$shlibpath_var=\`\$ECHO \"\$$shlibpath_var\" | $SED 's/::*\$//'\`
3208
export $shlibpath_var
3212
# fixup the dll searchpath if we need to.
3213
if test -n "$dllsearchpath"; then
3215
# Add the dll search path components to the executable PATH
3216
PATH=$dllsearchpath:\$PATH
3221
if test \"\$libtool_execute_magic\" != \"$magic\"; then
3222
# Run the actual program with our arguments.
3223
func_exec_program \${1+\"\$@\"}
3226
# The program doesn't exist.
3227
\$ECHO \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2
3228
\$ECHO \"This script is just a wrapper for \$program.\" 1>&2
3229
\$ECHO \"See the $PACKAGE documentation for more information.\" 1>&2
3237
# func_to_host_path arg
3239
# Convert paths to host format when used with build tools.
3240
# Intended for use with "native" mingw (where libtool itself
3241
# is running under the msys shell), or in the following cross-
3242
# build environments:
3244
# mingw (msys) mingw [e.g. native]
3247
# where wine is equipped with the `winepath' executable.
3248
# In the native mingw case, the (msys) shell automatically
3249
# converts paths for any non-msys applications it launches,
3250
# but that facility isn't available from inside the cwrapper.
3251
# Similar accommodations are necessary for $host mingw and
3252
# $build cygwin. Calling this function does no harm for other
3253
# $host/$build combinations not listed above.
3255
# ARG is the path (on $build) that should be converted to
3256
# the proper representation for $host. The result is stored
3257
# in $func_to_host_path_result.
3258
func_to_host_path ()
3260
func_to_host_path_result="$1"
3261
if test -n "$1"; then
3264
lt_sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g'
3266
*mingw* ) # actually, msys
3267
# awkward: cmd appends spaces to result
3268
func_to_host_path_result=`( cmd //c echo "$1" ) 2>/dev/null |
3269
$SED -e 's/[ ]*$//' -e "$lt_sed_naive_backslashify"`
3272
func_to_host_path_result=`cygpath -w "$1" |
3273
$SED -e "$lt_sed_naive_backslashify"`
3276
# Unfortunately, winepath does not exit with a non-zero
3277
# error code, so we are forced to check the contents of
3278
# stdout. On the other hand, if the command is not
3279
# found, the shell will set an exit code of 127 and print
3280
# *an error message* to stdout. So we must check for both
3281
# error code of zero AND non-empty stdout, which explains
3282
# the odd construction:
3283
func_to_host_path_tmp1=`winepath -w "$1" 2>/dev/null`
3284
if test "$?" -eq 0 && test -n "${func_to_host_path_tmp1}"; then
3285
func_to_host_path_result=`$ECHO "$func_to_host_path_tmp1" |
3286
$SED -e "$lt_sed_naive_backslashify"`
3288
# Allow warning below.
3289
func_to_host_path_result=
3293
if test -z "$func_to_host_path_result" ; then
3294
func_error "Could not determine host path corresponding to"
3296
func_error "Continuing, but uninstalled executables may not work."
3298
func_to_host_path_result="$1"
3304
# end: func_to_host_path
3306
# func_to_host_pathlist arg
3308
# Convert pathlists to host format when used with build tools.
3309
# See func_to_host_path(), above. This function supports the
3310
# following $build/$host combinations (but does no harm for
3311
# combinations not listed here):
3313
# mingw (msys) mingw [e.g. native]
3317
# Path separators are also converted from $build format to
3318
# $host format. If ARG begins or ends with a path separator
3319
# character, it is preserved (but converted to $host format)
3322
# ARG is a pathlist (on $build) that should be converted to
3323
# the proper representation on $host. The result is stored
3324
# in $func_to_host_pathlist_result.
3325
func_to_host_pathlist ()
3327
func_to_host_pathlist_result="$1"
3328
if test -n "$1"; then
3331
lt_sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g'
3332
# Remove leading and trailing path separator characters from
3333
# ARG. msys behavior is inconsistent here, cygpath turns them
3334
# into '.;' and ';.', and winepath ignores them completely.
3335
func_stripname : : "$1"
3336
func_to_host_pathlist_tmp1=$func_stripname_result
3338
*mingw* ) # Actually, msys.
3339
# Awkward: cmd appends spaces to result.
3340
func_to_host_pathlist_result=`
3341
( cmd //c echo "$func_to_host_pathlist_tmp1" ) 2>/dev/null |
3342
$SED -e 's/[ ]*$//' -e "$lt_sed_naive_backslashify"`
3345
func_to_host_pathlist_result=`cygpath -w -p "$func_to_host_pathlist_tmp1" |
3346
$SED -e "$lt_sed_naive_backslashify"`
3349
# unfortunately, winepath doesn't convert pathlists
3350
func_to_host_pathlist_result=""
3351
func_to_host_pathlist_oldIFS=$IFS
3353
for func_to_host_pathlist_f in $func_to_host_pathlist_tmp1 ; do
3354
IFS=$func_to_host_pathlist_oldIFS
3355
if test -n "$func_to_host_pathlist_f" ; then
3356
func_to_host_path "$func_to_host_pathlist_f"
3357
if test -n "$func_to_host_path_result" ; then
3358
if test -z "$func_to_host_pathlist_result" ; then
3359
func_to_host_pathlist_result="$func_to_host_path_result"
3361
func_append func_to_host_pathlist_result ";$func_to_host_path_result"
3366
IFS=$func_to_host_pathlist_oldIFS
3369
if test -z "$func_to_host_pathlist_result"; then
3370
func_error "Could not determine the host path(s) corresponding to"
3372
func_error "Continuing, but uninstalled executables may not work."
3373
# Fallback. This may break if $1 contains DOS-style drive
3374
# specifications. The fix is not to complicate the expression
3375
# below, but for the user to provide a working wine installation
3376
# with winepath so that path translation in the cross-to-mingw
3377
# case works properly.
3378
lt_replace_pathsep_nix_to_dos="s|:|;|g"
3379
func_to_host_pathlist_result=`echo "$func_to_host_pathlist_tmp1" |\
3380
$SED -e "$lt_replace_pathsep_nix_to_dos"`
3382
# Now, add the leading and trailing path separators back
3384
:* ) func_to_host_pathlist_result=";$func_to_host_pathlist_result"
3388
*: ) func_append func_to_host_pathlist_result ";"
3395
# end: func_to_host_pathlist
3397
# func_emit_cwrapperexe_src
3398
# emit the source code for a wrapper executable on stdout
3399
# Must ONLY be called from within func_mode_link because
3400
# it depends on a number of variable set therein.
3401
func_emit_cwrapperexe_src ()
3405
/* $cwrappersource - temporary wrapper executable for $objdir/$outputname
3406
Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
3408
The $output program cannot be directly executed until all the libtool
3409
libraries that it depends on are installed.
3411
This wrapper executable should never be moved out of the build directory.
3412
If it is, it will not operate correctly.
3417
# define _CRT_SECURE_NO_DEPRECATE 1
3422
# include <direct.h>
3423
# include <process.h>
3426
# include <unistd.h>
3427
# include <stdint.h>
3439
#include <sys/stat.h>
3441
/* declarations of non-ANSI functions */
3442
#if defined(__MINGW32__)
3443
# ifdef __STRICT_ANSI__
3444
int _putenv (const char *);
3446
#elif defined(__CYGWIN__)
3447
# ifdef __STRICT_ANSI__
3448
char *realpath (const char *, char *);
3449
int putenv (char *);
3450
int setenv (const char *, const char *, int);
3452
/* #elif defined (other platforms) ... */
3455
/* portability defines, excluding path handling macros */
3456
#if defined(_MSC_VER)
3457
# define setmode _setmode
3459
# define chmod _chmod
3460
# define getcwd _getcwd
3461
# define putenv _putenv
3462
# define S_IXUSR _S_IEXEC
3463
# ifndef _INTPTR_T_DEFINED
3464
# define _INTPTR_T_DEFINED
3465
# define intptr_t int
3467
#elif defined(__MINGW32__)
3468
# define setmode _setmode
3470
# define chmod _chmod
3471
# define getcwd _getcwd
3472
# define putenv _putenv
3473
#elif defined(__CYGWIN__)
3474
# define HAVE_SETENV
3475
# define FOPEN_WB "wb"
3476
/* #elif defined (other platforms) ... */
3479
#if defined(PATH_MAX)
3480
# define LT_PATHMAX PATH_MAX
3481
#elif defined(MAXPATHLEN)
3482
# define LT_PATHMAX MAXPATHLEN
3484
# define LT_PATHMAX 1024
3494
/* path handling portability macros */
3495
#ifndef DIR_SEPARATOR
3496
# define DIR_SEPARATOR '/'
3497
# define PATH_SEPARATOR ':'
3500
#if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \
3502
# define HAVE_DOS_BASED_FILE_SYSTEM
3503
# define FOPEN_WB "wb"
3504
# ifndef DIR_SEPARATOR_2
3505
# define DIR_SEPARATOR_2 '\\'
3507
# ifndef PATH_SEPARATOR_2
3508
# define PATH_SEPARATOR_2 ';'
3512
#ifndef DIR_SEPARATOR_2
3513
# define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR)
3514
#else /* DIR_SEPARATOR_2 */
3515
# define IS_DIR_SEPARATOR(ch) \
3516
(((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2))
3517
#endif /* DIR_SEPARATOR_2 */
3519
#ifndef PATH_SEPARATOR_2
3520
# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR)
3521
#else /* PATH_SEPARATOR_2 */
3522
# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2)
3523
#endif /* PATH_SEPARATOR_2 */
3526
# define FOPEN_WB "w"
3529
# define _O_BINARY 0
3532
#define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type)))
3533
#define XFREE(stale) do { \
3534
if (stale) { free ((void *) stale); stale = 0; } \
3537
#if defined(LT_DEBUGWRAPPER)
3538
static int lt_debug = 1;
3540
static int lt_debug = 0;
3543
const char *program_name = "libtool-wrapper"; /* in case xstrdup fails */
3545
void *xmalloc (size_t num);
3546
char *xstrdup (const char *string);
3547
const char *base_name (const char *name);
3548
char *find_executable (const char *wrapper);
3549
char *chase_symlinks (const char *pathspec);
3550
int make_executable (const char *path);
3551
int check_executable (const char *path);
3552
char *strendzap (char *str, const char *pat);
3553
void lt_debugprintf (const char *file, int line, const char *fmt, ...);
3554
void lt_fatal (const char *file, int line, const char *message, ...);
3555
static const char *nonnull (const char *s);
3556
static const char *nonempty (const char *s);
3557
void lt_setenv (const char *name, const char *value);
3558
char *lt_extend_str (const char *orig_value, const char *add, int to_end);
3559
void lt_update_exe_path (const char *name, const char *value);
3560
void lt_update_lib_path (const char *name, const char *value);
3561
char **prepare_spawn (char **argv);
3562
void lt_dump_script (FILE *f);
3566
const char * MAGIC_EXE = "$magic_exe";
3567
const char * LIB_PATH_VARNAME = "$shlibpath_var";
3570
if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
3571
func_to_host_pathlist "$temp_rpath"
3573
const char * LIB_PATH_VALUE = "$func_to_host_pathlist_result";
3577
const char * LIB_PATH_VALUE = "";
3581
if test -n "$dllsearchpath"; then
3582
func_to_host_pathlist "$dllsearchpath:"
3584
const char * EXE_PATH_VARNAME = "PATH";
3585
const char * EXE_PATH_VALUE = "$func_to_host_pathlist_result";
3589
const char * EXE_PATH_VARNAME = "";
3590
const char * EXE_PATH_VALUE = "";
3594
if test "$fast_install" = yes; then
3596
const char * TARGET_PROGRAM_NAME = "lt-$outputname"; /* hopefully, no .exe */
3600
const char * TARGET_PROGRAM_NAME = "$outputname"; /* hopefully, no .exe */
3607
#define LTWRAPPER_OPTION_PREFIX "--lt-"
3609
static const char *ltwrapper_option_prefix = LTWRAPPER_OPTION_PREFIX;
3610
static const char *dumpscript_opt = LTWRAPPER_OPTION_PREFIX "dump-script";
3611
static const char *debug_opt = LTWRAPPER_OPTION_PREFIX "debug";
3614
main (int argc, char *argv[])
3619
char *actual_cwrapper_path;
3620
char *actual_cwrapper_name;
3623
intptr_t rval = 127;
3627
program_name = (char *) xstrdup (base_name (argv[0]));
3628
newargz = XMALLOC (char *, argc + 1);
3630
/* very simple arg parsing; don't want to rely on getopt
3631
* also, copy all non cwrapper options to newargz, except
3632
* argz[0], which is handled differently
3635
for (i = 1; i < argc; i++)
3637
if (strcmp (argv[i], dumpscript_opt) == 0)
3641
*mingw* | *cygwin* )
3642
# make stdout use "unix" line endings
3643
echo " setmode(1,_O_BINARY);"
3648
lt_dump_script (stdout);
3651
if (strcmp (argv[i], debug_opt) == 0)
3656
if (strcmp (argv[i], ltwrapper_option_prefix) == 0)
3658
/* however, if there is an option in the LTWRAPPER_OPTION_PREFIX
3659
namespace, but it is not one of the ones we know about and
3660
have already dealt with, above (inluding dump-script), then
3661
report an error. Otherwise, targets might begin to believe
3662
they are allowed to use options in the LTWRAPPER_OPTION_PREFIX
3663
namespace. The first time any user complains about this, we'll
3664
need to make LTWRAPPER_OPTION_PREFIX a configure-time option
3665
or a configure.ac-settable value.
3667
lt_fatal (__FILE__, __LINE__,
3668
"unrecognized %s option: '%s'",
3669
ltwrapper_option_prefix, argv[i]);
3672
newargz[++newargc] = xstrdup (argv[i]);
3674
newargz[++newargc] = NULL;
3678
/* The GNU banner must be the first non-error debug message */
3679
lt_debugprintf (__FILE__, __LINE__, "libtool wrapper (GNU $PACKAGE$TIMESTAMP) $VERSION\n");
3682
lt_debugprintf (__FILE__, __LINE__, "(main) argv[0]: %s\n", argv[0]);
3683
lt_debugprintf (__FILE__, __LINE__, "(main) program_name: %s\n", program_name);
3685
tmp_pathspec = find_executable (argv[0]);
3686
if (tmp_pathspec == NULL)
3687
lt_fatal (__FILE__, __LINE__, "couldn't find %s", argv[0]);
3688
lt_debugprintf (__FILE__, __LINE__,
3689
"(main) found exe (before symlink chase) at: %s\n",
3692
actual_cwrapper_path = chase_symlinks (tmp_pathspec);
3693
lt_debugprintf (__FILE__, __LINE__,
3694
"(main) found exe (after symlink chase) at: %s\n",
3695
actual_cwrapper_path);
3696
XFREE (tmp_pathspec);
3698
actual_cwrapper_name = xstrdup (base_name (actual_cwrapper_path));
3699
strendzap (actual_cwrapper_path, actual_cwrapper_name);
3701
/* wrapper name transforms */
3702
strendzap (actual_cwrapper_name, ".exe");
3703
tmp_pathspec = lt_extend_str (actual_cwrapper_name, ".exe", 1);
3704
XFREE (actual_cwrapper_name);
3705
actual_cwrapper_name = tmp_pathspec;
3708
/* target_name transforms -- use actual target program name; might have lt- prefix */
3709
target_name = xstrdup (base_name (TARGET_PROGRAM_NAME));
3710
strendzap (target_name, ".exe");
3711
tmp_pathspec = lt_extend_str (target_name, ".exe", 1);
3712
XFREE (target_name);
3713
target_name = tmp_pathspec;
3716
lt_debugprintf (__FILE__, __LINE__,
3717
"(main) libtool target name: %s\n",
3723
XMALLOC (char, (strlen (actual_cwrapper_path) +
3724
strlen ("$objdir") + 1 + strlen (actual_cwrapper_name) + 1));
3725
strcpy (newargz[0], actual_cwrapper_path);
3726
strcat (newargz[0], "$objdir");
3727
strcat (newargz[0], "/");
3731
/* stop here, and copy so we don't have to do this twice */
3732
tmp_pathspec = xstrdup (newargz[0]);
3734
/* do NOT want the lt- prefix here, so use actual_cwrapper_name */
3735
strcat (newargz[0], actual_cwrapper_name);
3737
/* DO want the lt- prefix here if it exists, so use target_name */
3738
lt_argv_zero = lt_extend_str (tmp_pathspec, target_name, 1);
3739
XFREE (tmp_pathspec);
3740
tmp_pathspec = NULL;
3748
while ((p = strchr (newargz[0], '\\')) != NULL)
3752
while ((p = strchr (lt_argv_zero, '\\')) != NULL)
3762
XFREE (target_name);
3763
XFREE (actual_cwrapper_path);
3764
XFREE (actual_cwrapper_name);
3766
lt_setenv ("BIN_SH", "xpg4"); /* for Tru64 */
3767
lt_setenv ("DUALCASE", "1"); /* for MSK sh */
3768
lt_update_lib_path (LIB_PATH_VARNAME, LIB_PATH_VALUE);
3769
lt_update_exe_path (EXE_PATH_VARNAME, EXE_PATH_VALUE);
3771
lt_debugprintf (__FILE__, __LINE__, "(main) lt_argv_zero: %s\n",
3772
nonnull (lt_argv_zero));
3773
for (i = 0; i < newargc; i++)
3775
lt_debugprintf (__FILE__, __LINE__, "(main) newargz[%d]: %s\n",
3776
i, nonnull (newargz[i]));
3784
/* execv doesn't actually work on mingw as expected on unix */
3785
newargz = prepare_spawn (newargz);
3786
rval = _spawnv (_P_WAIT, lt_argv_zero, (const char * const *) newargz);
3789
/* failed to start process */
3790
lt_debugprintf (__FILE__, __LINE__,
3791
"(main) failed to launch target \"%s\": %s\n",
3792
lt_argv_zero, nonnull (strerror (errno)));
3800
execv (lt_argv_zero, newargz);
3801
return rval; /* =127, but avoids unused variable warning */
3810
xmalloc (size_t num)
3812
void *p = (void *) malloc (num);
3814
lt_fatal (__FILE__, __LINE__, "memory exhausted");
3820
xstrdup (const char *string)
3822
return string ? strcpy ((char *) xmalloc (strlen (string) + 1),
3827
base_name (const char *name)
3831
#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
3832
/* Skip over the disk name in MSDOS pathnames. */
3833
if (isalpha ((unsigned char) name[0]) && name[1] == ':')
3837
for (base = name; *name; name++)
3838
if (IS_DIR_SEPARATOR (*name))
3844
check_executable (const char *path)
3848
lt_debugprintf (__FILE__, __LINE__, "(check_executable): %s\n",
3850
if ((!path) || (!*path))
3853
if ((stat (path, &st) >= 0)
3854
&& (st.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH)))
3861
make_executable (const char *path)
3866
lt_debugprintf (__FILE__, __LINE__, "(make_executable): %s\n",
3868
if ((!path) || (!*path))
3871
if (stat (path, &st) >= 0)
3873
rval = chmod (path, st.st_mode | S_IXOTH | S_IXGRP | S_IXUSR);
3878
/* Searches for the full path of the wrapper. Returns
3879
newly allocated full path name if found, NULL otherwise
3880
Does not chase symlinks, even on platforms that support them.
3883
find_executable (const char *wrapper)
3888
/* static buffer for getcwd */
3889
char tmp[LT_PATHMAX + 1];
3893
lt_debugprintf (__FILE__, __LINE__, "(find_executable): %s\n",
3894
nonempty (wrapper));
3896
if ((wrapper == NULL) || (*wrapper == '\0'))
3899
/* Absolute path? */
3900
#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
3901
if (isalpha ((unsigned char) wrapper[0]) && wrapper[1] == ':')
3903
concat_name = xstrdup (wrapper);
3904
if (check_executable (concat_name))
3906
XFREE (concat_name);
3911
if (IS_DIR_SEPARATOR (wrapper[0]))
3913
concat_name = xstrdup (wrapper);
3914
if (check_executable (concat_name))
3916
XFREE (concat_name);
3918
#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
3922
for (p = wrapper; *p; p++)
3930
/* no slashes; search PATH */
3931
const char *path = getenv ("PATH");
3934
for (p = path; *p; p = p_next)
3938
for (q = p; *q; q++)
3939
if (IS_PATH_SEPARATOR (*q))
3942
p_next = (*q == '\0' ? q : q + 1);
3945
/* empty path: current directory */
3946
if (getcwd (tmp, LT_PATHMAX) == NULL)
3947
lt_fatal (__FILE__, __LINE__, "getcwd failed: %s",
3948
nonnull (strerror (errno)));
3949
tmp_len = strlen (tmp);
3951
XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1);
3952
memcpy (concat_name, tmp, tmp_len);
3953
concat_name[tmp_len] = '/';
3954
strcpy (concat_name + tmp_len + 1, wrapper);
3959
XMALLOC (char, p_len + 1 + strlen (wrapper) + 1);
3960
memcpy (concat_name, p, p_len);
3961
concat_name[p_len] = '/';
3962
strcpy (concat_name + p_len + 1, wrapper);
3964
if (check_executable (concat_name))
3966
XFREE (concat_name);
3969
/* not found in PATH; assume curdir */
3971
/* Relative path | not found in path: prepend cwd */
3972
if (getcwd (tmp, LT_PATHMAX) == NULL)
3973
lt_fatal (__FILE__, __LINE__, "getcwd failed: %s",
3974
nonnull (strerror (errno)));
3975
tmp_len = strlen (tmp);
3976
concat_name = XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1);
3977
memcpy (concat_name, tmp, tmp_len);
3978
concat_name[tmp_len] = '/';
3979
strcpy (concat_name + tmp_len + 1, wrapper);
3981
if (check_executable (concat_name))
3983
XFREE (concat_name);
3988
chase_symlinks (const char *pathspec)
3991
return xstrdup (pathspec);
3993
char buf[LT_PATHMAX];
3995
char *tmp_pathspec = xstrdup (pathspec);
3997
int has_symlinks = 0;
3998
while (strlen (tmp_pathspec) && !has_symlinks)
4000
lt_debugprintf (__FILE__, __LINE__,
4001
"checking path component for symlinks: %s\n",
4003
if (lstat (tmp_pathspec, &s) == 0)
4005
if (S_ISLNK (s.st_mode) != 0)
4011
/* search backwards for last DIR_SEPARATOR */
4012
p = tmp_pathspec + strlen (tmp_pathspec) - 1;
4013
while ((p > tmp_pathspec) && (!IS_DIR_SEPARATOR (*p)))
4015
if ((p == tmp_pathspec) && (!IS_DIR_SEPARATOR (*p)))
4017
/* no more DIR_SEPARATORS left */
4024
lt_fatal (__FILE__, __LINE__,
4025
"error accessing file \"%s\": %s",
4026
tmp_pathspec, nonnull (strerror (errno)));
4029
XFREE (tmp_pathspec);
4033
return xstrdup (pathspec);
4036
tmp_pathspec = realpath (pathspec, buf);
4037
if (tmp_pathspec == 0)
4039
lt_fatal (__FILE__, __LINE__,
4040
"could not follow symlinks for %s", pathspec);
4042
return xstrdup (tmp_pathspec);
4047
strendzap (char *str, const char *pat)
4051
assert (str != NULL);
4052
assert (pat != NULL);
4055
patlen = strlen (pat);
4059
str += len - patlen;
4060
if (strcmp (str, pat) == 0)
4067
lt_debugprintf (const char *file, int line, const char *fmt, ...)
4072
(void) fprintf (stderr, "%s:%s:%d: ", program_name, file, line);
4073
va_start (args, fmt);
4074
(void) vfprintf (stderr, fmt, args);
4080
lt_error_core (int exit_status, const char *file,
4081
int line, const char *mode,
4082
const char *message, va_list ap)
4084
fprintf (stderr, "%s:%s:%d: %s: ", program_name, file, line, mode);
4085
vfprintf (stderr, message, ap);
4086
fprintf (stderr, ".\n");
4088
if (exit_status >= 0)
4093
lt_fatal (const char *file, int line, const char *message, ...)
4096
va_start (ap, message);
4097
lt_error_core (EXIT_FAILURE, file, line, "FATAL", message, ap);
4102
nonnull (const char *s)
4104
return s ? s : "(null)";
4108
nonempty (const char *s)
4110
return (s && !*s) ? "(empty)" : nonnull (s);
4114
lt_setenv (const char *name, const char *value)
4116
lt_debugprintf (__FILE__, __LINE__,
4117
"(lt_setenv) setting '%s' to '%s'\n",
4118
nonnull (name), nonnull (value));
4121
/* always make a copy, for consistency with !HAVE_SETENV */
4122
char *str = xstrdup (value);
4123
setenv (name, str, 1);
4125
int len = strlen (name) + 1 + strlen (value) + 1;
4126
char *str = XMALLOC (char, len);
4127
sprintf (str, "%s=%s", name, value);
4128
if (putenv (str) != EXIT_SUCCESS)
4137
lt_extend_str (const char *orig_value, const char *add, int to_end)
4140
if (orig_value && *orig_value)
4142
int orig_value_len = strlen (orig_value);
4143
int add_len = strlen (add);
4144
new_value = XMALLOC (char, add_len + orig_value_len + 1);
4147
strcpy (new_value, orig_value);
4148
strcpy (new_value + orig_value_len, add);
4152
strcpy (new_value, add);
4153
strcpy (new_value + add_len, orig_value);
4158
new_value = xstrdup (add);
4164
lt_update_exe_path (const char *name, const char *value)
4166
lt_debugprintf (__FILE__, __LINE__,
4167
"(lt_update_exe_path) modifying '%s' by prepending '%s'\n",
4168
nonnull (name), nonnull (value));
4170
if (name && *name && value && *value)
4172
char *new_value = lt_extend_str (getenv (name), value, 0);
4173
/* some systems can't cope with a ':'-terminated path #' */
4174
int len = strlen (new_value);
4175
while (((len = strlen (new_value)) > 0) && IS_PATH_SEPARATOR (new_value[len-1]))
4177
new_value[len-1] = '\0';
4179
lt_setenv (name, new_value);
4185
lt_update_lib_path (const char *name, const char *value)
4187
lt_debugprintf (__FILE__, __LINE__,
4188
"(lt_update_lib_path) modifying '%s' by prepending '%s'\n",
4189
nonnull (name), nonnull (value));
4191
if (name && *name && value && *value)
4193
char *new_value = lt_extend_str (getenv (name), value, 0);
4194
lt_setenv (name, new_value);
4204
/* Prepares an argument vector before calling spawn().
4205
Note that spawn() does not by itself call the command interpreter
4206
(getenv ("COMSPEC") != NULL ? getenv ("COMSPEC") :
4207
({ OSVERSIONINFO v; v.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
4209
v.dwPlatformId == VER_PLATFORM_WIN32_NT;
4210
}) ? "cmd.exe" : "command.com").
4211
Instead it simply concatenates the arguments, separated by ' ', and calls
4212
CreateProcess(). We must quote the arguments since Win32 CreateProcess()
4213
interprets characters like ' ', '\t', '\\', '"' (but not '<' and '>') in a
4215
- Space and tab are interpreted as delimiters. They are not treated as
4216
delimiters if they are surrounded by double quotes: "...".
4217
- Unescaped double quotes are removed from the input. Their only effect is
4218
that within double quotes, space and tab are treated like normal
4220
- Backslashes not followed by double quotes are not special.
4221
- But 2*n+1 backslashes followed by a double quote become
4222
n backslashes followed by a double quote (n >= 0):
4227
#define SHELL_SPECIAL_CHARS "\"\\ \001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037"
4228
#define SHELL_SPACE_CHARS " \001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037"
4230
prepare_spawn (char **argv)
4236
/* Count number of arguments. */
4237
for (argc = 0; argv[argc] != NULL; argc++)
4240
/* Allocate new argument vector. */
4241
new_argv = XMALLOC (char *, argc + 1);
4243
/* Put quoted arguments into the new argument vector. */
4244
for (i = 0; i < argc; i++)
4246
const char *string = argv[i];
4248
if (string[0] == '\0')
4249
new_argv[i] = xstrdup ("\"\"");
4250
else if (strpbrk (string, SHELL_SPECIAL_CHARS) != NULL)
4252
int quote_around = (strpbrk (string, SHELL_SPACE_CHARS) != NULL);
4254
unsigned int backslashes;
4256
char *quoted_string;
4263
for (s = string; *s != '\0'; s++)
4267
length += backslashes + 1;
4275
length += backslashes + 1;
4277
quoted_string = XMALLOC (char, length + 1);
4283
for (s = string; *s != '\0'; s++)
4289
for (j = backslashes + 1; j > 0; j--)
4301
for (j = backslashes; j > 0; j--)
4307
new_argv[i] = quoted_string;
4310
new_argv[i] = (char *) string;
4312
new_argv[argc] = NULL;
4321
void lt_dump_script (FILE* f)
4324
func_emit_wrapper yes |
4325
$SED -e 's/\([\\"]\)/\\\1/g' \
4326
-e 's/^/ fputs ("/' -e 's/$/\\n", f);/'
4332
# end: func_emit_cwrapperexe_src
4334
# func_win32_import_lib_p ARG
4335
# True if ARG is an import lib, as indicated by $file_magic_cmd
4336
func_win32_import_lib_p ()
4339
case `eval $file_magic_cmd \"\$1\" 2>/dev/null | $SED -e 10q` in
4345
# func_mode_link arg...
4350
*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
1107
4351
# It is impossible to link a dll without this setting, and
1108
4352
# we shouldn't force the makefile maintainer to figure out
1109
4353
# which system we are compiling for in order to pass an extra
4898
8103
# Replace the output file specification.
4899
link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`
8104
link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`
4901
8106
# Delete the old output files.
4902
$run $rm $output $output_objdir/$outputname $output_objdir/lt-$outputname
8107
$opt_dry_run || $RM $output $output_objdir/$outputname $output_objdir/lt-$outputname
4904
$show "$link_command"
4905
$run eval "$link_command" || exit $?
8109
func_show_eval "$link_command" 'exit $?'
4907
8111
# Now create the wrapper script.
4908
$show "creating $output"
8112
func_verbose "creating $output"
4910
8114
# Quote the relink command for shipping.
4911
8115
if test -n "$relink_command"; then
4912
8116
# Preserve any variables that may affect compiler behavior
4913
8117
for var in $variables_saved_for_relink; do
4914
8118
if eval test -z \"\${$var+set}\"; then
4915
relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command"
8119
relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command"
4916
8120
elif eval var_value=\$$var; test -z "$var_value"; then
4917
8121
relink_command="$var=; export $var; $relink_command"
4919
var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"`
4920
relink_command="$var=\"$var_value\"; export $var; $relink_command"
8123
func_quote_for_eval "$var_value"
8124
relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command"
4923
8127
relink_command="(cd `pwd`; $relink_command)"
4924
relink_command=`$echo "X$relink_command" | $SP2NL | $Xsed -e "$sed_quote_subst" | $NL2SP`
4927
# Quote $echo for shipping.
4928
if test "X$echo" = "X$SHELL $progpath --fallback-echo"; then
4930
[\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $progpath --fallback-echo";;
4931
*) qecho="$SHELL `pwd`/$progpath --fallback-echo";;
4933
qecho=`$echo "X$qecho" | $Xsed -e "$sed_quote_subst"`
4935
qecho=`$echo "X$echo" | $Xsed -e "$sed_quote_subst"`
4938
# Only actually do things if our run command is non-null.
4939
if test -z "$run"; then
8128
relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"`
8131
# Only actually do things if not in dry run mode.
4940
8133
# win32 will think the script is a binary if it has
4941
8134
# a .exe suffix, so we strip it off here.
4942
8135
case $output in
4943
*.exe) output=`$echo $output|${SED} 's,.exe$,,'` ;;
8136
*.exe) func_stripname '' '.exe' "$output"
8137
output=$func_stripname_result ;;
4945
8139
# test for cygwin because mv fails w/o .exe extensions
4949
outputname=`$echo $outputname|${SED} 's,.exe$,,'` ;;
8143
func_stripname '' '.exe' "$outputname"
8144
outputname=$func_stripname_result ;;
4953
8148
*cygwin* | *mingw* )
4954
output_name=`basename $output`
4955
output_path=`dirname $output`
4956
cwrappersource="$output_path/$objdir/lt-$output_name.c"
4957
cwrapper="$output_path/$output_name.exe"
4958
$rm $cwrappersource $cwrapper
4959
trap "$rm $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15
4961
cat > $cwrappersource <<EOF
4963
/* $cwrappersource - temporary wrapper executable for $objdir/$outputname
4964
Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
4966
The $output program cannot be directly executed until all the libtool
4967
libraries that it depends on are installed.
4969
This wrapper executable should never be moved out of the build directory.
4970
If it is, it will not operate correctly.
4972
Currently, it simply execs the wrapper *script* "/bin/sh $output",
4973
but could eventually absorb all of the scripts functionality and
4974
exec $objdir/$outputname directly.
4977
cat >> $cwrappersource<<"EOF"
4986
#include <sys/stat.h>
4988
#if defined(PATH_MAX)
4989
# define LT_PATHMAX PATH_MAX
4990
#elif defined(MAXPATHLEN)
4991
# define LT_PATHMAX MAXPATHLEN
4993
# define LT_PATHMAX 1024
4996
#ifndef DIR_SEPARATOR
4997
# define DIR_SEPARATOR '/'
4998
# define PATH_SEPARATOR ':'
5001
#if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \
5003
# define HAVE_DOS_BASED_FILE_SYSTEM
5004
# ifndef DIR_SEPARATOR_2
5005
# define DIR_SEPARATOR_2 '\\'
5007
# ifndef PATH_SEPARATOR_2
5008
# define PATH_SEPARATOR_2 ';'
5012
#ifndef DIR_SEPARATOR_2
5013
# define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR)
5014
#else /* DIR_SEPARATOR_2 */
5015
# define IS_DIR_SEPARATOR(ch) \
5016
(((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2))
5017
#endif /* DIR_SEPARATOR_2 */
5019
#ifndef PATH_SEPARATOR_2
5020
# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR)
5021
#else /* PATH_SEPARATOR_2 */
5022
# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2)
5023
#endif /* PATH_SEPARATOR_2 */
5025
#define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type)))
5026
#define XFREE(stale) do { \
5027
if (stale) { free ((void *) stale); stale = 0; } \
5030
/* -DDEBUG is fairly common in CFLAGS. */
5032
#if defined DEBUGWRAPPER
5033
# define DEBUG(format, ...) fprintf(stderr, format, __VA_ARGS__)
5035
# define DEBUG(format, ...)
5038
const char *program_name = NULL;
5040
void * xmalloc (size_t num);
5041
char * xstrdup (const char *string);
5042
const char * base_name (const char *name);
5043
char * find_executable(const char *wrapper);
5044
int check_executable(const char *path);
5045
char * strendzap(char *str, const char *pat);
5046
void lt_fatal (const char *message, ...);
5049
main (int argc, char *argv[])
5054
program_name = (char *) xstrdup (base_name (argv[0]));
5055
DEBUG("(main) argv[0] : %s\n",argv[0]);
5056
DEBUG("(main) program_name : %s\n",program_name);
5057
newargz = XMALLOC(char *, argc+2);
5060
cat >> $cwrappersource <<EOF
5061
newargz[0] = (char *) xstrdup("$SHELL");
5064
cat >> $cwrappersource <<"EOF"
5065
newargz[1] = find_executable(argv[0]);
5066
if (newargz[1] == NULL)
5067
lt_fatal("Couldn't find %s", argv[0]);
5068
DEBUG("(main) found exe at : %s\n",newargz[1]);
5069
/* we know the script has the same name, without the .exe */
5070
/* so make sure newargz[1] doesn't end in .exe */
5071
strendzap(newargz[1],".exe");
5072
for (i = 1; i < argc; i++)
5073
newargz[i+1] = xstrdup(argv[i]);
5074
newargz[argc+1] = NULL;
5076
for (i=0; i<argc+1; i++)
5078
DEBUG("(main) newargz[%d] : %s\n",i,newargz[i]);
5086
cat >> $cwrappersource <<EOF
5087
execv("$SHELL",(char const **)newargz);
5091
cat >> $cwrappersource <<EOF
5092
execv("$SHELL",newargz);
5097
cat >> $cwrappersource <<"EOF"
5102
xmalloc (size_t num)
5104
void * p = (void *) malloc (num);
5106
lt_fatal ("Memory exhausted");
5112
xstrdup (const char *string)
5114
return string ? strcpy ((char *) xmalloc (strlen (string) + 1), string) : NULL
5119
base_name (const char *name)
5123
#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
5124
/* Skip over the disk name in MSDOS pathnames. */
5125
if (isalpha ((unsigned char)name[0]) && name[1] == ':')
5129
for (base = name; *name; name++)
5130
if (IS_DIR_SEPARATOR (*name))
5136
check_executable(const char * path)
5140
DEBUG("(check_executable) : %s\n", path ? (*path ? path : "EMPTY!") : "NULL!");
5141
if ((!path) || (!*path))
5144
if ((stat (path, &st) >= 0) &&
5146
/* MinGW & native WIN32 do not support S_IXOTH or S_IXGRP */
5147
#if defined (S_IXOTH)
5148
((st.st_mode & S_IXOTH) == S_IXOTH) ||
5150
#if defined (S_IXGRP)
5151
((st.st_mode & S_IXGRP) == S_IXGRP) ||
5153
((st.st_mode & S_IXUSR) == S_IXUSR))
5160
/* Searches for the full path of the wrapper. Returns
5161
newly allocated full path name if found, NULL otherwise */
5163
find_executable (const char* wrapper)
5168
/* static buffer for getcwd */
5169
char tmp[LT_PATHMAX + 1];
5173
DEBUG("(find_executable) : %s\n", wrapper ? (*wrapper ? wrapper : "EMPTY!") : "NULL!");
5175
if ((wrapper == NULL) || (*wrapper == '\0'))
5178
/* Absolute path? */
5179
#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
5180
if (isalpha ((unsigned char)wrapper[0]) && wrapper[1] == ':')
5182
concat_name = xstrdup (wrapper);
5183
if (check_executable(concat_name))
5190
if (IS_DIR_SEPARATOR (wrapper[0]))
5192
concat_name = xstrdup (wrapper);
5193
if (check_executable(concat_name))
5197
#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
5201
for (p = wrapper; *p; p++)
5209
/* no slashes; search PATH */
5210
const char* path = getenv ("PATH");
5213
for (p = path; *p; p = p_next)
5217
for (q = p; *q; q++)
5218
if (IS_PATH_SEPARATOR(*q))
5221
p_next = (*q == '\0' ? q : q + 1);
5224
/* empty path: current directory */
5225
if (getcwd (tmp, LT_PATHMAX) == NULL)
5226
lt_fatal ("getcwd failed");
5227
tmp_len = strlen(tmp);
5228
concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1);
5229
memcpy (concat_name, tmp, tmp_len);
5230
concat_name[tmp_len] = '/';
5231
strcpy (concat_name + tmp_len + 1, wrapper);
5235
concat_name = XMALLOC(char, p_len + 1 + strlen(wrapper) + 1);
5236
memcpy (concat_name, p, p_len);
5237
concat_name[p_len] = '/';
5238
strcpy (concat_name + p_len + 1, wrapper);
5240
if (check_executable(concat_name))
8149
func_dirname_and_basename "$output" "" "."
8150
output_name=$func_basename_result
8151
output_path=$func_dirname_result
8152
cwrappersource="$output_path/$objdir/lt-$output_name.c"
8153
cwrapper="$output_path/$output_name.exe"
8154
$RM $cwrappersource $cwrapper
8155
trap "$RM $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15
8157
func_emit_cwrapperexe_src > $cwrappersource
8159
# The wrapper executable is built using the $host compiler,
8160
# because it contains $host paths and files. If cross-
8161
# compiling, it, like the target executable, must be
8162
# executed on the $host or under an emulation environment.
8164
$LTCC $LTCFLAGS -o $cwrapper $cwrappersource
8168
# Now, create the wrapper script for func_source use:
8169
func_ltwrapper_scriptname $cwrapper
8170
$RM $func_ltwrapper_scriptname_result
8171
trap "$RM $func_ltwrapper_scriptname_result; exit $EXIT_FAILURE" 1 2 15
8173
# note: this script will not be executed, so do not chmod.
8174
if test "x$build" = "x$host" ; then
8175
$cwrapper --lt-dump-script > $func_ltwrapper_scriptname_result
8177
func_emit_wrapper no > $func_ltwrapper_scriptname_result
8183
trap "$RM $output; exit $EXIT_FAILURE" 1 2 15
8185
func_emit_wrapper no > $output
5245
/* not found in PATH; assume curdir */
5247
/* Relative path | not found in path: prepend cwd */
5248
if (getcwd (tmp, LT_PATHMAX) == NULL)
5249
lt_fatal ("getcwd failed");
5250
tmp_len = strlen(tmp);
5251
concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1);
5252
memcpy (concat_name, tmp, tmp_len);
5253
concat_name[tmp_len] = '/';
5254
strcpy (concat_name + tmp_len + 1, wrapper);
5256
if (check_executable(concat_name))
5263
strendzap(char *str, const char *pat)
5267
assert(str != NULL);
5268
assert(pat != NULL);
5271
patlen = strlen(pat);
5275
str += len - patlen;
5276
if (strcmp(str, pat) == 0)
5283
lt_error_core (int exit_status, const char * mode,
5284
const char * message, va_list ap)
5286
fprintf (stderr, "%s: %s: ", program_name, mode);
5287
vfprintf (stderr, message, ap);
5288
fprintf (stderr, ".\n");
5290
if (exit_status >= 0)
5295
lt_fatal (const char *message, ...)
5298
va_start (ap, message);
5299
lt_error_core (EXIT_FAILURE, "FATAL", message, ap);
5303
# we should really use a build-platform specific compiler
5304
# here, but OTOH, the wrappers (shell script and this C one)
5305
# are only useful if you want to execute the "real" binary.
5306
# Since the "real" binary is built for $host, then this
5307
# wrapper might as well be built for $host, too.
5308
$run $LTCC $LTCFLAGS -s -o $cwrapper $cwrappersource
5312
trap "$rm $output; exit $EXIT_FAILURE" 1 2 15
5317
# $output - temporary wrapper script for $objdir/$outputname
5318
# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
5320
# The $output program cannot be directly executed until all the libtool
5321
# libraries that it depends on are installed.
5323
# This wrapper script should never be moved out of the build directory.
5324
# If it is, it will not operate correctly.
5326
# Sed substitution that helps us do robust quoting. It backslashifies
5327
# metacharacters that are still active within double-quoted strings.
5328
Xsed='${SED} -e 1s/^X//'
5329
sed_quote_subst='$sed_quote_subst'
5331
# Be Bourne compatible (taken from Autoconf:_AS_BOURNE_COMPATIBLE).
5332
if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then
5335
# Zsh 3.x and 4.x performs word splitting on \${1+\"\$@\"}, which
5336
# is contrary to our usage. Disable this feature.
5337
alias -g '\${1+\"\$@\"}'='\"\$@\"'
5338
setopt NO_GLOB_SUBST
5340
case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac
5342
BIN_SH=xpg4; export BIN_SH # for Tru64
5343
DUALCASE=1; export DUALCASE # for MKS sh
5345
# The HP-UX ksh and POSIX shell print the target directory to stdout
5347
(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
5349
relink_command=\"$relink_command\"
5351
# This environment variable determines our operation mode.
5352
if test \"\$libtool_install_magic\" = \"$magic\"; then
5353
# install mode needs the following variable:
5354
notinst_deplibs='$notinst_deplibs'
5356
# When we are sourced in execute mode, \$file and \$echo are already set.
5357
if test \"\$libtool_execute_magic\" != \"$magic\"; then
5360
# Make sure echo works.
5361
if test \"X\$1\" = X--no-reexec; then
5362
# Discard the --no-reexec flag, and continue.
5364
elif test \"X\`(\$echo '\t') 2>/dev/null\`\" = 'X\t'; then
5365
# Yippee, \$echo works!
5368
# Restart under the correct shell, and then maybe \$echo will work.
5369
exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"}
5375
# Find the directory that this script lives in.
5376
thisdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\`
5377
test \"x\$thisdir\" = \"x\$file\" && thisdir=.
5379
# Follow symbolic links until we get to the real thisdir.
5380
file=\`ls -ld \"\$file\" | ${SED} -n 's/.*-> //p'\`
5381
while test -n \"\$file\"; do
5382
destdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\`
5384
# If there was a directory component, then change thisdir.
5385
if test \"x\$destdir\" != \"x\$file\"; then
5386
case \"\$destdir\" in
5387
[\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;;
5388
*) thisdir=\"\$thisdir/\$destdir\" ;;
5392
file=\`\$echo \"X\$file\" | \$Xsed -e 's%^.*/%%'\`
5393
file=\`ls -ld \"\$thisdir/\$file\" | ${SED} -n 's/.*-> //p'\`
5396
# Try to get the absolute directory name.
5397
absdir=\`cd \"\$thisdir\" && pwd\`
5398
test -n \"\$absdir\" && thisdir=\"\$absdir\"
5401
if test "$fast_install" = yes; then
5403
program=lt-'$outputname'$exeext
5404
progdir=\"\$thisdir/$objdir\"
5406
if test ! -f \"\$progdir/\$program\" || \\
5407
{ file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\
5408
test \"X\$file\" != \"X\$progdir/\$program\"; }; then
5410
file=\"\$\$-\$program\"
5412
if test ! -d \"\$progdir\"; then
5413
$mkdir \"\$progdir\"
5415
$rm \"\$progdir/\$file\"
5420
# relink executable if necessary
5421
if test -n \"\$relink_command\"; then
5422
if relink_command_output=\`eval \$relink_command 2>&1\`; then :
5424
$echo \"\$relink_command_output\" >&2
5425
$rm \"\$progdir/\$file\"
5430
$mv \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null ||
5431
{ $rm \"\$progdir/\$program\";
5432
$mv \"\$progdir/\$file\" \"\$progdir/\$program\"; }
5433
$rm \"\$progdir/\$file\"
5437
program='$outputname'
5438
progdir=\"\$thisdir/$objdir\"
5444
if test -f \"\$progdir/\$program\"; then"
5446
# Export our shlibpath_var if we have one.
5447
if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
5449
# Add our own library path to $shlibpath_var
5450
$shlibpath_var=\"$temp_rpath\$$shlibpath_var\"
5452
# Some systems cannot cope with colon-terminated $shlibpath_var
5453
# The second colon is a workaround for a bug in BeOS R4 sed
5454
$shlibpath_var=\`\$echo \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\`
5456
export $shlibpath_var
5460
# fixup the dll searchpath if we need to.
5461
if test -n "$dllsearchpath"; then
5463
# Add the dll search path components to the executable PATH
5464
PATH=$dllsearchpath:\$PATH
5469
if test \"\$libtool_execute_magic\" != \"$magic\"; then
5470
# Run the actual program with our arguments.
5473
# Backslashes separate directories on plain windows
5474
*-*-mingw | *-*-os2*)
5476
exec \"\$progdir\\\\\$program\" \${1+\"\$@\"}
5482
exec \"\$progdir/\$program\" \${1+\"\$@\"}
5487
\$echo \"\$0: cannot exec \$program \$*\"
5491
# The program doesn't exist.
5492
\$echo \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2
5493
\$echo \"This script is just a wrapper for \$program.\" 1>&2
5494
$echo \"See the $PACKAGE documentation for more information.\" 1>&2
5501
8190
exit $EXIT_SUCCESS
5786
8507
# Directory that this library needs to be installed in:
5787
8508
libdir='$install_libdir'"
5788
8509
if test "$installed" = no && test "$need_relink" = yes; then
5790
8511
relink_command=\"$relink_command\""
5795
8516
# Do a symbolic link so that the libtool archive can be found in
5796
8517
# LD_LIBRARY_PATH before the program is installed.
5797
$show "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)"
5798
$run eval '(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)' || exit $?
5804
# libtool install mode
5806
modename="$modename: install"
5808
# There may be an optional sh(1) argument at the beginning of
5809
# install_prog (especially on Windows NT).
5810
if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh ||
5811
# Allow the use of GNU shtool's install command.
5812
$echo "X$nonopt" | grep shtool > /dev/null; then
5813
# Aesthetically quote it.
5814
arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"`
5816
*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
5820
install_prog="$arg "
5828
# The real first argument should be the name of the installation program.
5829
# Aesthetically quote it.
5830
arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
5832
*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
5836
install_prog="$install_prog$arg"
5838
# We need to accept at least all the BSD install flags.
5848
if test -n "$dest"; then
5849
files="$files $dest"
5857
case " $install_prog " in
5862
-g | -m | -o) prev=$arg ;;
5870
# If the previous option needed an argument, then skip it.
5871
if test -n "$prev"; then
5880
# Aesthetically quote the argument.
5881
arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
5883
*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
5887
install_prog="$install_prog $arg"
5890
if test -z "$install_prog"; then
5891
$echo "$modename: you must specify an install program" 1>&2
5896
if test -n "$prev"; then
5897
$echo "$modename: the \`$prev' option requires an argument" 1>&2
5902
if test -z "$files"; then
5903
if test -z "$dest"; then
5904
$echo "$modename: no file or destination specified" 1>&2
5906
$echo "$modename: you must specify a destination" 1>&2
5912
# Strip any trailing slash from the destination.
5913
dest=`$echo "X$dest" | $Xsed -e 's%/$%%'`
5915
# Check to see that the destination is a directory.
5916
test -d "$dest" && isdir=yes
5917
if test "$isdir" = yes; then
5921
destdir=`$echo "X$dest" | $Xsed -e 's%/[^/]*$%%'`
5922
test "X$destdir" = "X$dest" && destdir=.
5923
destname=`$echo "X$dest" | $Xsed -e 's%^.*/%%'`
5925
# Not a directory, so check to see that there is only one file specified.
5927
if test "$#" -gt 2; then
5928
$echo "$modename: \`$dest' is not a directory" 1>&2
5934
[\\/]* | [A-Za-z]:[\\/]*) ;;
5936
for file in $files; do
5940
$echo "$modename: \`$destdir' must be an absolute directory name" 1>&2
5949
# This variable tells wrapper scripts just to set variables rather
5950
# than running their programs.
5951
libtool_install_magic="$magic"
5956
for file in $files; do
5958
# Do each installation.
5961
# Do the static libraries later.
5962
staticlibs="$staticlibs $file"
5966
# Check to see that this really is a libtool archive.
5967
if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
5969
$echo "$modename: \`$file' is not a valid libtool archive" 1>&2
5977
# If there is no directory component, then add one.
5979
*/* | *\\*) . $file ;;
5983
# Add the libdir to current_libdirs if it is the destination.
5984
if test "X$destdir" = "X$libdir"; then
5985
case "$current_libdirs " in
5987
*) current_libdirs="$current_libdirs $libdir" ;;
5990
# Note the libdir as a future libdir.
5991
case "$future_libdirs " in
5993
*) future_libdirs="$future_libdirs $libdir" ;;
5997
dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`/
5998
test "X$dir" = "X$file/" && dir=
6001
if test -n "$relink_command"; then
6002
# Determine the prefix the user has applied to our future dir.
6003
inst_prefix_dir=`$echo "$destdir" | $SED "s%$libdir\$%%"`
6005
# Don't allow the user to place us outside of our expected
6006
# location b/c this prevents finding dependent libraries that
6007
# are installed to the same prefix.
6008
# At present, this check doesn't affect windows .dll's that
6009
# are installed into $libdir/../bin (currently, that works fine)
6010
# but it's something to keep an eye on.
6011
if test "$inst_prefix_dir" = "$destdir"; then
6012
$echo "$modename: error: cannot install \`$file' to a directory not ending in $libdir" 1>&2
6016
if test -n "$inst_prefix_dir"; then
6017
# Stick the inst_prefix_dir data into the link command.
6018
relink_command=`$echo "$relink_command" | $SP2NL | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%" | $NL2SP`
6020
relink_command=`$echo "$relink_command" | $SP2NL | $SED "s%@inst_prefix_dir@%%" | $NL2SP`
6023
$echo "$modename: warning: relinking \`$file'" 1>&2
6024
$show "$relink_command"
6025
if $run eval "$relink_command"; then :
6027
$echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
6032
# See the names of the shared library.
6033
set dummy $library_names
6034
if test -n "$2"; then
6040
test -n "$relink_command" && srcname="$realname"T
6042
# Install the shared library and build the symlinks.
6043
$show "$install_prog $dir/$srcname $destdir/$realname"
6044
$run eval "$install_prog $dir/$srcname $destdir/$realname" || exit $?
6045
if test -n "$stripme" && test -n "$striplib"; then
6046
$show "$striplib $destdir/$realname"
6047
$run eval "$striplib $destdir/$realname" || exit $?
6050
if test "$#" -gt 0; then
6051
# Delete the old symlinks, and create new ones.
6052
# Try `ln -sf' first, because the `ln' binary might depend on
6053
# the symlink we replace! Solaris /bin/ln does not understand -f,
6054
# so we also need to try rm && ln -s.
6057
if test "$linkname" != "$realname"; then
6058
$show "(cd $destdir && { $LN_S -f $realname $linkname || { $rm $linkname && $LN_S $realname $linkname; }; })"
6059
$run eval "(cd $destdir && { $LN_S -f $realname $linkname || { $rm $linkname && $LN_S $realname $linkname; }; })"
6064
# Do each command in the postinstall commands.
6065
lib="$destdir/$realname"
6066
cmds=$postinstall_cmds
6067
save_ifs="$IFS"; IFS='~'
6068
for cmd in $cmds; do
6072
$run eval "$cmd" || {
6075
# Restore the uninstalled library and exit
6076
if test "$mode" = relink; then
6077
$run eval '(cd $output_objdir && $rm ${realname}T && $mv ${realname}U $realname)'
6086
# Install the pseudo-library for information purposes.
6087
name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
6088
instname="$dir/$name"i
6089
$show "$install_prog $instname $destdir/$name"
6090
$run eval "$install_prog $instname $destdir/$name" || exit $?
6092
# Maybe install the static library, too.
6093
test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library"
6097
# Install (i.e. copy) a libtool object.
6099
# Figure out destination file name, if it wasn't already specified.
6100
if test -n "$destname"; then
6101
destfile="$destdir/$destname"
6103
destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
6104
destfile="$destdir/$destfile"
6107
# Deduce the name of the destination old-style object file.
6110
staticdest=`$echo "X$destfile" | $Xsed -e "$lo2o"`
6113
staticdest="$destfile"
6117
$echo "$modename: cannot copy a libtool object to \`$destfile'" 1>&2
6123
# Install the libtool object if requested.
6124
if test -n "$destfile"; then
6125
$show "$install_prog $file $destfile"
6126
$run eval "$install_prog $file $destfile" || exit $?
6129
# Install the old object if enabled.
6130
if test "$build_old_libs" = yes; then
6131
# Deduce the name of the old-style object file.
6132
staticobj=`$echo "X$file" | $Xsed -e "$lo2o"`
6134
$show "$install_prog $staticobj $staticdest"
6135
$run eval "$install_prog \$staticobj \$staticdest" || exit $?
6141
# Figure out destination file name, if it wasn't already specified.
6142
if test -n "$destname"; then
6143
destfile="$destdir/$destname"
6145
destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
6146
destfile="$destdir/$destfile"
6149
# If the file is missing, and there is a .exe on the end, strip it
6150
# because it is most likely a libtool script we actually want to
6155
if test ! -f "$file"; then
6156
file=`$echo $file|${SED} 's,.exe$,,'`
6162
# Do a test to see if this is really a libtool program.
6165
wrapper=`$echo $file | ${SED} -e 's,.exe$,,'`
6171
if (${SED} -e '4q' $wrapper | grep "^# Generated by .*$PACKAGE")>/dev/null 2>&1; then
6175
# Note that it is not necessary on cygwin/mingw to append a dot to
6176
# foo even if both foo and FILE.exe exist: automatic-append-.exe
6177
# behavior happens only for exec(3), not for open(2)! Also, sourcing
6178
# `FILE.' does not work on cygwin managed mounts.
6180
# If there is no directory component, then add one.
6182
*/* | *\\*) . ${wrapper} ;;
6183
*) . ./${wrapper} ;;
6186
# Check the variables that should have been set.
6187
if test -z "$notinst_deplibs"; then
6188
$echo "$modename: invalid libtool wrapper script \`$wrapper'" 1>&2
6193
for lib in $notinst_deplibs; do
6194
# Check to see that each library is installed.
6196
if test -f "$lib"; then
6197
# If there is no directory component, then add one.
6199
*/* | *\\*) . $lib ;;
6203
libfile="$libdir/"`$echo "X$lib" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test
6204
if test -n "$libdir" && test ! -f "$libfile"; then
6205
$echo "$modename: warning: \`$lib' has not been installed in \`$libdir'" 1>&2
6211
# Note that it is not necessary on cygwin/mingw to append a dot to
6212
# foo even if both foo and FILE.exe exist: automatic-append-.exe
6213
# behavior happens only for exec(3), not for open(2)! Also, sourcing
6214
# `FILE.' does not work on cygwin managed mounts.
6216
# If there is no directory component, then add one.
6218
*/* | *\\*) . ${wrapper} ;;
6219
*) . ./${wrapper} ;;
6223
if test "$fast_install" = no && test -n "$relink_command"; then
6224
if test "$finalize" = yes && test -z "$run"; then
6225
tmpdir=`func_mktempdir`
6226
file=`$echo "X$file$stripped_ext" | $Xsed -e 's%^.*/%%'`
6227
outputname="$tmpdir/$file"
6228
# Replace the output file specification.
6229
relink_command=`$echo "X$relink_command" | $SP2NL | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g' | $NL2SP`
6231
$show "$relink_command"
6232
if $run eval "$relink_command"; then :
6234
$echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
6240
$echo "$modename: warning: cannot relink \`$file'" 1>&2
6243
# Install the binary that we compiled earlier.
6244
file=`$echo "X$file$stripped_ext" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"`
6248
# remove .exe since cygwin /usr/bin/install will append another
6250
case $install_prog,$host in
6251
*/usr/bin/install*,*cygwin*)
6252
case $file:$destfile in
6257
destfile=$destfile.exe
6260
destfile=`$echo $destfile | ${SED} -e 's,.exe$,,'`
6265
$show "$install_prog$stripme $file $destfile"
6266
$run eval "$install_prog\$stripme \$file \$destfile" || exit $?
6267
test -n "$outputname" && ${rm}r "$tmpdir"
6272
for file in $staticlibs; do
6273
name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
6275
# Set up the ranlib parameters.
6276
oldlib="$destdir/$name"
6278
$show "$install_prog $file $oldlib"
6279
$run eval "$install_prog \$file \$oldlib" || exit $?
6281
if test -n "$stripme" && test -n "$old_striplib"; then
6282
$show "$old_striplib $oldlib"
6283
$run eval "$old_striplib $oldlib" || exit $?
6286
# Do each command in the postinstall commands.
6287
cmds=$old_postinstall_cmds
6288
save_ifs="$IFS"; IFS='~'
6289
for cmd in $cmds; do
6293
$run eval "$cmd" || exit $?
6298
if test -n "$future_libdirs"; then
6299
$echo "$modename: warning: remember to run \`$progname --finish$future_libdirs'" 1>&2
6302
if test -n "$current_libdirs"; then
6303
# Maybe just do a dry run.
6304
test -n "$run" && current_libdirs=" -n$current_libdirs"
6305
exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs'
6311
# libtool finish mode
6313
modename="$modename: finish"
6317
if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
6320
libdirs="$libdirs $dir"
6323
for libdir in $libdirs; do
6324
if test -n "$finish_cmds"; then
6325
# Do each command in the finish commands.
6327
save_ifs="$IFS"; IFS='~'
6328
for cmd in $cmds; do
6332
$run eval "$cmd" || admincmds="$admincmds
6337
if test -n "$finish_eval"; then
6338
# Do the single finish_eval.
6339
eval cmds=\"$finish_eval\"
6340
$run eval "$cmds" || admincmds="$admincmds
6346
# Exit here if they wanted silent mode.
6347
test "$show" = : && exit $EXIT_SUCCESS
6349
$echo "X----------------------------------------------------------------------" | $Xsed
6350
$echo "Libraries have been installed in:"
6351
for libdir in $libdirs; do
6355
$echo "If you ever happen to want to link against installed libraries"
6356
$echo "in a given directory, LIBDIR, you must either use libtool, and"
6357
$echo "specify the full pathname of the library, or use the \`-LLIBDIR'"
6358
$echo "flag during linking and do at least one of the following:"
6359
if test -n "$shlibpath_var"; then
6360
$echo " - add LIBDIR to the \`$shlibpath_var' environment variable"
6361
$echo " during execution"
6363
if test -n "$runpath_var"; then
6364
$echo " - add LIBDIR to the \`$runpath_var' environment variable"
6365
$echo " during linking"
6367
if test -n "$hardcode_libdir_flag_spec"; then
6369
eval flag=\"$hardcode_libdir_flag_spec\"
6371
$echo " - use the \`$flag' linker flag"
6373
if test -n "$admincmds"; then
6374
$echo " - have your system administrator run these commands:$admincmds"
6376
if test -f /etc/ld.so.conf; then
6377
$echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'"
6380
$echo "See any operating system documentation about shared libraries for"
6381
$echo "more information, such as the ld(1) and ld.so(8) manual pages."
6382
$echo "X----------------------------------------------------------------------" | $Xsed
6386
# libtool execute mode
6388
modename="$modename: execute"
6390
# The first argument is the command name.
6392
if test -z "$cmd"; then
6393
$echo "$modename: you must specify a COMMAND" 1>&2
6398
# Handle -dlopen flags immediately.
6399
for file in $execute_dlfiles; do
6400
if test ! -f "$file"; then
6401
$echo "$modename: \`$file' is not a file" 1>&2
6409
# Check to see that this really is a libtool archive.
6410
if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
6412
$echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
6417
# Read the libtool library.
6421
# If there is no directory component, then add one.
6423
*/* | *\\*) . $file ;;
6427
# Skip this library if it cannot be dlopened.
6428
if test -z "$dlname"; then
6429
# Warn if it was a shared library.
6430
test -n "$library_names" && $echo "$modename: warning: \`$file' was not linked with \`-export-dynamic'"
6434
dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
6435
test "X$dir" = "X$file" && dir=.
6437
if test -f "$dir/$objdir/$dlname"; then
6440
if test ! -f "$dir/$dlname"; then
6441
$echo "$modename: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2
6448
# Just add the directory containing the .lo file.
6449
dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
6450
test "X$dir" = "X$file" && dir=.
6454
$echo "$modename: warning \`-dlopen' is ignored for non-libtool libraries and objects" 1>&2
6459
# Get the absolute pathname.
6460
absdir=`cd "$dir" && pwd`
6461
test -n "$absdir" && dir="$absdir"
6463
# Now add the directory to shlibpath_var.
6464
if eval "test -z \"\$$shlibpath_var\""; then
6465
eval "$shlibpath_var=\"\$dir\""
6467
eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\""
6471
# This variable tells wrapper scripts just to set shlibpath_var
6472
# rather than running their programs.
6473
libtool_execute_magic="$magic"
6475
# Check if any of the arguments is a wrapper script.
6482
# Do a test to see if this is really a libtool program.
6483
if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
6484
# If there is no directory component, then add one.
6486
*/* | *\\*) . $file ;;
6490
# Transform arg to wrapped name.
6491
file="$progdir/$program"
6495
# Quote arguments (to preserve shell metacharacters).
6496
file=`$echo "X$file" | $Xsed -e "$sed_quote_subst"`
6497
args="$args \"$file\""
6500
if test -z "$run"; then
6501
if test -n "$shlibpath_var"; then
6502
# Export the shlibpath_var.
6503
eval "export $shlibpath_var"
6506
# Restore saved environment variables
6507
for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
6509
eval "if test \"\${save_$lt_var+set}\" = set; then
6510
$lt_var=\$save_$lt_var; export $lt_var
6514
# Now prepare to actually exec the command.
6515
exec_cmd="\$cmd$args"
6517
# Display what would be done.
6518
if test -n "$shlibpath_var"; then
6519
eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\""
6520
$echo "export $shlibpath_var"
6527
# libtool clean and uninstall mode
6529
modename="$modename: $mode"
8518
func_show_eval '( cd "$output_objdir" && $RM "$outputname" && $LN_S "../$outputname" "$outputname" )' 'exit $?'
8524
{ test "$mode" = link || test "$mode" = relink; } &&
8525
func_mode_link ${1+"$@"}
8528
# func_mode_uninstall arg...
8529
func_mode_uninstall ()