Commit a4ce75ef authored by Sam Lantinga's avatar Sam Lantinga

Updated to libtool-1.5.22

--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%401574
parent d8557b04
This source diff could not be displayed because it is too large. You can view the blob instead.
# Based on libtool-1.5.8 # Based on libtool-1.5.22
# ltmain.sh - Provide generalized library-building support services. # ltmain.sh - Provide generalized library-building support services.
# NOTE: Changing this file will not affect anything until you rerun configure. # NOTE: Changing this file will not affect anything until you rerun configure.
# #
# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004 # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005
# Free Software Foundation, Inc. # Free Software Foundation, Inc.
# Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996 # Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
# #
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
# #
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software # along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
# #
# As a special exception to the GNU General Public License, if you # As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a # distribute this file as part of a program that contains a
...@@ -44,8 +44,8 @@ EXIT_FAILURE=1 ...@@ -44,8 +44,8 @@ EXIT_FAILURE=1
PROGRAM=ltmain.sh PROGRAM=ltmain.sh
PACKAGE=libtool PACKAGE=libtool
VERSION=1.5.8 VERSION=1.5.22
TIMESTAMP=" (1.1220.2.117 2004/08/04 14:12:05)" TIMESTAMP=" (1.1220.2.365 2005/12/18 22:14:06)"
# See if we are running on zsh, and set the options which allow our # See if we are running on zsh, and set the options which allow our
# commands through without removal of \ escapes. # commands through without removal of \ escapes.
...@@ -89,14 +89,15 @@ rm="rm -f" ...@@ -89,14 +89,15 @@ rm="rm -f"
Xsed="${SED}"' -e 1s/^X//' Xsed="${SED}"' -e 1s/^X//'
sed_quote_subst='s/\([\\`\\"$\\\\]\)/\\\1/g' sed_quote_subst='s/\([\\`\\"$\\\\]\)/\\\1/g'
# test EBCDIC or ASCII # test EBCDIC or ASCII
case `echo A|tr A '\301'` in case `echo X|tr X '\101'` in
A) # EBCDIC based system A) # ASCII based system
SP2NL="tr '\100' '\n'" # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr
NL2SP="tr '\r\n' '\100\100'" SP2NL='tr \040 \012'
NL2SP='tr \015\012 \040\040'
;; ;;
*) # Assume ASCII based system *) # EBCDIC based system
SP2NL="tr '\040' '\012'" SP2NL='tr \100 \n'
NL2SP="tr '\015\012' '\040\040'" NL2SP='tr \r\n \100\100'
;; ;;
esac esac
...@@ -113,8 +114,9 @@ if test "${LANG+set}" = set; then ...@@ -113,8 +114,9 @@ if test "${LANG+set}" = set; then
fi fi
# Make sure IFS has a sensible default # Make sure IFS has a sensible default
: ${IFS=" lt_nl='
"} '
IFS=" $lt_nl"
if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
$echo "$modename: not configured to build any kind of library" 1>&2 $echo "$modename: not configured to build any kind of library" 1>&2
...@@ -131,6 +133,8 @@ run= ...@@ -131,6 +133,8 @@ run=
show="$echo" show="$echo"
show_help= show_help=
execute_dlfiles= execute_dlfiles=
duplicate_deps=no
preserve_args=
lo2o="s/\\.lo\$/.${objext}/" lo2o="s/\\.lo\$/.${objext}/"
o2lo="s/\\.${objext}\$/.lo/" o2lo="s/\\.${objext}\$/.lo/"
...@@ -138,13 +142,51 @@ o2lo="s/\\.${objext}\$/.lo/" ...@@ -138,13 +142,51 @@ o2lo="s/\\.${objext}\$/.lo/"
# Shell function definitions: # Shell function definitions:
# This seems to be the best place for them # This seems to be the best place for them
# func_mktempdir [string]
# Make a temporary directory that won't clash with other running
# libtool processes, and avoids race conditions if possible. If
# given, STRING is the basename for that directory.
func_mktempdir ()
{
my_template="${TMPDIR-/tmp}/${1-$progname}"
if test "$run" = ":"; then
# Return a directory name, but don't create it in dry-run mode
my_tmpdir="${my_template}-$$"
else
# If mktemp works, use that first and foremost
my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null`
if test ! -d "$my_tmpdir"; then
# Failing that, at least try and use $RANDOM to avoid a race
my_tmpdir="${my_template}-${RANDOM-0}$$"
save_mktempdir_umask=`umask`
umask 0077
$mkdir "$my_tmpdir"
umask $save_mktempdir_umask
fi
# If we're not in dry-run mode, bomb out on failure
test -d "$my_tmpdir" || {
$echo "cannot create temporary directory \`$my_tmpdir'" 1>&2
exit $EXIT_FAILURE
}
fi
$echo "X$my_tmpdir" | $Xsed
}
# func_win32_libid arg # func_win32_libid arg
# return the library type of file 'arg' # return the library type of file 'arg'
# #
# Need a lot of goo to handle *both* DLLs and import libs # Need a lot of goo to handle *both* DLLs and import libs
# Has to be a shell function in order to 'eat' the argument # Has to be a shell function in order to 'eat' the argument
# that is supplied when $file_magic_command is called. # that is supplied when $file_magic_command is called.
func_win32_libid () { func_win32_libid ()
{
win32_libid_type="unknown" win32_libid_type="unknown"
win32_fileres=`file -L $1 2>/dev/null` win32_fileres=`file -L $1 2>/dev/null`
case $win32_fileres in case $win32_fileres in
...@@ -155,12 +197,11 @@ func_win32_libid () { ...@@ -155,12 +197,11 @@ func_win32_libid () {
if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | \ if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | \
$EGREP -e 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then $EGREP -e 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then
win32_nmres=`eval $NM -f posix -A $1 | \ win32_nmres=`eval $NM -f posix -A $1 | \
sed -n -e '1,100{/ I /{x;/import/!{s/^/import/;h;p;};x;};}'` $SED -n -e '1,100{/ I /{s,.*,import,;p;q;};}'`
if test "X$win32_nmres" = "Ximport" ; then case $win32_nmres in
win32_libid_type="x86 archive import" import*) win32_libid_type="x86 archive import";;
else *) win32_libid_type="x86 archive static";;
win32_libid_type="x86 archive static" esac
fi
fi fi
;; ;;
*DLL*) *DLL*)
...@@ -184,7 +225,8 @@ func_win32_libid () { ...@@ -184,7 +225,8 @@ func_win32_libid () {
# Only attempt this if the compiler in the base compile # Only attempt this if the compiler in the base compile
# command doesn't match the default compiler. # command doesn't match the default compiler.
# arg is usually of the form 'gcc ...' # arg is usually of the form 'gcc ...'
func_infer_tag () { func_infer_tag ()
{
if test -n "$available_tags" && test -z "$tagname"; then if test -n "$available_tags" && test -z "$tagname"; then
CC_quoted= CC_quoted=
for arg in $CC; do for arg in $CC; do
...@@ -243,8 +285,25 @@ func_infer_tag () { ...@@ -243,8 +285,25 @@ func_infer_tag () {
} }
# func_extract_an_archive dir oldlib
func_extract_an_archive ()
{
f_ex_an_ar_dir="$1"; shift
f_ex_an_ar_oldlib="$1"
$show "(cd $f_ex_an_ar_dir && $AR x $f_ex_an_ar_oldlib)"
$run eval "(cd \$f_ex_an_ar_dir && $AR x \$f_ex_an_ar_oldlib)" || exit $?
if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then
:
else
$echo "$modename: ERROR: object name conflicts: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib" 1>&2
exit $EXIT_FAILURE
fi
}
# func_extract_archives gentop oldlib ... # func_extract_archives gentop oldlib ...
func_extract_archives () { func_extract_archives ()
{
my_gentop="$1"; shift my_gentop="$1"; shift
my_oldlibs=${1+"$@"} my_oldlibs=${1+"$@"}
my_oldobjs="" my_oldobjs=""
...@@ -275,9 +334,9 @@ func_extract_archives () { ...@@ -275,9 +334,9 @@ func_extract_archives () {
$run ${rm}r "$my_xdir" $run ${rm}r "$my_xdir"
$show "$mkdir $my_xdir" $show "$mkdir $my_xdir"
$run $mkdir "$my_xdir" $run $mkdir "$my_xdir"
status=$? exit_status=$?
if test "$status" -ne 0 && test ! -d "$my_xdir"; then if test "$exit_status" -ne 0 && test ! -d "$my_xdir"; then
exit $status exit $exit_status
fi fi
case $host in case $host in
*-darwin*) *-darwin*)
...@@ -288,7 +347,7 @@ func_extract_archives () { ...@@ -288,7 +347,7 @@ func_extract_archives () {
cd $my_xdir || exit $? cd $my_xdir || exit $?
darwin_archive=$my_xabs darwin_archive=$my_xabs
darwin_curdir=`pwd` darwin_curdir=`pwd`
darwin_base_archive=`basename $darwin_archive` darwin_base_archive=`$echo "X$darwin_archive" | $Xsed -e 's%^.*/%%'`
darwin_arches=`lipo -info "$darwin_archive" 2>/dev/null | $EGREP Architectures 2>/dev/null` darwin_arches=`lipo -info "$darwin_archive" 2>/dev/null | $EGREP Architectures 2>/dev/null`
if test -n "$darwin_arches"; then if test -n "$darwin_arches"; then
darwin_arches=`echo "$darwin_arches" | $SED -e 's/.*are://'` darwin_arches=`echo "$darwin_arches" | $SED -e 's/.*are://'`
...@@ -297,64 +356,33 @@ func_extract_archives () { ...@@ -297,64 +356,33 @@ func_extract_archives () {
for darwin_arch in $darwin_arches ; do for darwin_arch in $darwin_arches ; do
mkdir -p "unfat-$$/${darwin_base_archive}-${darwin_arch}" mkdir -p "unfat-$$/${darwin_base_archive}-${darwin_arch}"
lipo -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}" lipo -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}"
# Remove the table of contents from the thin files.
$AR -d "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" __.SYMDEF 2>/dev/null || true
$AR -d "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" __.SYMDEF\ SORTED 2>/dev/null || true
cd "unfat-$$/${darwin_base_archive}-${darwin_arch}" cd "unfat-$$/${darwin_base_archive}-${darwin_arch}"
$AR -xo "${darwin_base_archive}" func_extract_an_archive "`pwd`" "${darwin_base_archive}"
rm "${darwin_base_archive}"
cd "$darwin_curdir" cd "$darwin_curdir"
$rm "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}"
done # $darwin_arches done # $darwin_arches
## Okay now we have a bunch of thin objects, gotta fatten them up :) ## Okay now we have a bunch of thin objects, gotta fatten them up :)
darwin_filelist=`find unfat-$$ -type f | xargs basename | sort -u | $NL2SP` darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print| xargs basename | sort -u | $NL2SP`
darwin_file= darwin_file=
darwin_files= darwin_files=
for darwin_file in $darwin_filelist; do for darwin_file in $darwin_filelist; do
darwin_files=`find unfat-$$ -name $darwin_file -print | $NL2SP` darwin_files=`find unfat-$$ -name $darwin_file -print | $NL2SP`
lipo -create -output "$darwin_file" $darwin_files lipo -create -output "$darwin_file" $darwin_files
done # $darwin_filelist done # $darwin_filelist
rm -rf unfat-$$ ${rm}r unfat-$$
cd "$darwin_orig_dir" cd "$darwin_orig_dir"
else else
cd $darwin_orig_dir cd "$darwin_orig_dir"
(cd $my_xdir && $AR x $my_xabs) || exit $? func_extract_an_archive "$my_xdir" "$my_xabs"
fi # $darwin_arches fi # $darwin_arches
fi # $run fi # $run
;;
*)
# We will extract separately just the conflicting names and we will
# no longer touch any unique names. It is faster to leave these
# extract automatically by $AR in one run.
$show "(cd $my_xdir && $AR x $my_xabs)"
$run eval "(cd \$my_xdir && $AR x \$my_xabs)" || exit $?
if ($AR t "$my_xabs" | sort | sort -uc >/dev/null 2>&1); then
:
else
$echo "$modename: warning: object name conflicts; renaming object files" 1>&2
$echo "$modename: warning: to ensure that they will not overwrite" 1>&2
$AR t "$my_xabs" | sort | uniq -cd | while read -r count name
do
i=1
while test "$i" -le "$count"
do
# Put our $i before any first dot (extension)
# Never overwrite any file
name_to="$name"
while test "X$name_to" = "X$name" || test -f "$my_xdir/$name_to"
do
name_to=`$echo "X$name_to" | $Xsed -e "s/\([^.]*\)/\1-$i/"`
done
$show "(cd $my_xdir && $AR xN $i $my_xabs '$name' && $mv '$name' '$name_to')"
$run eval "(cd \$my_xdir && $AR xN $i \$my_xabs '$name' && $mv '$name' '$name_to')" || exit $?
i=`expr $i + 1`
done
done
fi
;; ;;
*)
func_extract_an_archive "$my_xdir" "$my_xabs"
;;
esac esac
my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP` my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP`
done done
func_extract_archives_result="$my_oldobjs" func_extract_archives_result="$my_oldobjs"
} }
# End of Shell function definitions # End of Shell function definitions
...@@ -363,6 +391,8 @@ func_extract_archives () { ...@@ -363,6 +391,8 @@ func_extract_archives () {
# Darwin sucks # Darwin sucks
eval std_shrext=\"$shrext_cmds\" eval std_shrext=\"$shrext_cmds\"
disable_libs=no
# Parse our command line options once, thoroughly. # Parse our command line options once, thoroughly.
while test "$#" -gt 0 while test "$#" -gt 0
do do
...@@ -427,10 +457,10 @@ do ...@@ -427,10 +457,10 @@ do
--version) --version)
$echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP" $echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP"
$echo $echo
$echo "Copyright (C) 2003 Free Software Foundation, Inc." $echo "Copyright (C) 2005 Free Software Foundation, Inc."
$echo "This is free software; see the source for copying conditions. There is NO" $echo "This is free software; see the source for copying conditions. There is NO"
$echo "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." $echo "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
exit $EXIT_SUCCESS exit $?
;; ;;
--config) --config)
...@@ -439,7 +469,7 @@ do ...@@ -439,7 +469,7 @@ do
for tagname in $taglist; do for tagname in $taglist; do
${SED} -n -e "/^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$/,/^# ### END LIBTOOL TAG CONFIG: $tagname$/p" < "$progpath" ${SED} -n -e "/^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$/,/^# ### END LIBTOOL TAG CONFIG: $tagname$/p" < "$progpath"
done done
exit $EXIT_SUCCESS exit $?
;; ;;
--debug) --debug)
...@@ -464,7 +494,7 @@ do ...@@ -464,7 +494,7 @@ do
else else
$echo "disable static libraries" $echo "disable static libraries"
fi fi
exit $EXIT_SUCCESS exit $?
;; ;;
--finish) mode="finish" ;; --finish) mode="finish" ;;
...@@ -479,7 +509,11 @@ do ...@@ -479,7 +509,11 @@ do
preserve_args="$preserve_args $arg" preserve_args="$preserve_args $arg"
;; ;;
--tag) prevopt="--tag" prev=tag ;; --tag)
prevopt="--tag"
prev=tag
preserve_args="$preserve_args --tag"
;;
--tag=*) --tag=*)
set tag "$optarg" ${1+"$@"} set tag "$optarg" ${1+"$@"}
shift shift
...@@ -511,6 +545,18 @@ if test -n "$prevopt"; then ...@@ -511,6 +545,18 @@ if test -n "$prevopt"; then
exit $EXIT_FAILURE exit $EXIT_FAILURE
fi fi
case $disable_libs in
no)
;;
shared)
build_libtool_libs=no
build_old_libs=yes
;;
static)
build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac`
;;
esac
# If this variable is set in any of the actions, the command in it # If this variable is set in any of the actions, the command in it
# will be execed at the end. This prevents here-documents from being # will be execed at the end. This prevents here-documents from being
# left over by shells. # left over by shells.
...@@ -521,7 +567,7 @@ if test -z "$show_help"; then ...@@ -521,7 +567,7 @@ if test -z "$show_help"; then
# Infer the operation mode. # Infer the operation mode.
if test -z "$mode"; then if test -z "$mode"; then
$echo "*** Warning: inferring the mode of operation is deprecated." 1>&2 $echo "*** Warning: inferring the mode of operation is deprecated." 1>&2
$echo "*** Future versions of Libtool will require -mode=MODE be specified." 1>&2 $echo "*** Future versions of Libtool will require --mode=MODE be specified." 1>&2
case $nonopt in case $nonopt in
*cc | cc* | *++ | gcc* | *-gcc* | g++* | xlc*) *cc | cc* | *++ | gcc* | *-gcc* | g++* | xlc*)
mode=link mode=link
...@@ -587,7 +633,7 @@ if test -z "$show_help"; then ...@@ -587,7 +633,7 @@ if test -z "$show_help"; then
for arg for arg
do do
case "$arg_mode" in case $arg_mode in
arg ) arg )
# do not "continue". Instead, add this to base_compile # do not "continue". Instead, add this to base_compile
lastarg="$arg" lastarg="$arg"
...@@ -669,7 +715,10 @@ if test -z "$show_help"; then ...@@ -669,7 +715,10 @@ if test -z "$show_help"; then
case $lastarg in case $lastarg in
# Double-quote args containing other shell metacharacters. # Double-quote args containing other shell metacharacters.
# Many Bourne shells cannot handle close brackets correctly # Many Bourne shells cannot handle close brackets correctly
# in scan sets, so we specify it separately. # in scan sets, and some SunOS ksh mistreat backslash-escaping
# in scan sets (worked around with variable expansion),
# and furthermore cannot handle '|' '&' '(' ')' in scan sets
# at all, so we specify them separately.
*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
lastarg="\"$lastarg\"" lastarg="\"$lastarg\""
;; ;;
...@@ -743,6 +792,14 @@ if test -z "$show_help"; then ...@@ -743,6 +792,14 @@ if test -z "$show_help"; then
esac esac
done done
qlibobj=`$echo "X$libobj" | $Xsed -e "$sed_quote_subst"`
case $qlibobj in
*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
qlibobj="\"$qlibobj\"" ;;
esac
test "X$libobj" != "X$qlibobj" \
&& $echo "X$libobj" | grep '[]~#^*{};<>?"'"'"' &()|`$[]' \
&& $echo "$modename: libobj name \`$libobj' may not contain shell special characters."
objname=`$echo "X$obj" | $Xsed -e 's%^.*/%%'` objname=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'` xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'`
if test "X$xdir" = "X$obj"; then if test "X$xdir" = "X$obj"; then
...@@ -815,12 +872,17 @@ compiler." ...@@ -815,12 +872,17 @@ compiler."
$run $rm $removelist $run $rm $removelist
exit $EXIT_FAILURE exit $EXIT_FAILURE
fi fi
$echo $srcfile > "$lockfile" $echo "$srcfile" > "$lockfile"
fi fi
if test -n "$fix_srcfile_path"; then if test -n "$fix_srcfile_path"; then
eval srcfile=\"$fix_srcfile_path\" eval srcfile=\"$fix_srcfile_path\"
fi fi
qsrcfile=`$echo "X$srcfile" | $Xsed -e "$sed_quote_subst"`
case $qsrcfile in
*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
qsrcfile="\"$qsrcfile\"" ;;
esac
$run $rm "$libobj" "${libobj}T" $run $rm "$libobj" "${libobj}T"
...@@ -842,18 +904,18 @@ EOF ...@@ -842,18 +904,18 @@ EOF
fbsd_hideous_sh_bug=$base_compile fbsd_hideous_sh_bug=$base_compile
if test "$pic_mode" != no; then if test "$pic_mode" != no; then
command="$base_compile $srcfile $pic_flag" command="$base_compile $qsrcfile $pic_flag"
else else
# Don't build PIC code # Don't build PIC code
command="$base_compile $srcfile" command="$base_compile $qsrcfile"
fi fi
if test ! -d "${xdir}$objdir"; then if test ! -d "${xdir}$objdir"; then
$show "$mkdir ${xdir}$objdir" $show "$mkdir ${xdir}$objdir"
$run $mkdir ${xdir}$objdir $run $mkdir ${xdir}$objdir
status=$? exit_status=$?
if test "$status" -ne 0 && test ! -d "${xdir}$objdir"; then if test "$exit_status" -ne 0 && test ! -d "${xdir}$objdir"; then
exit $status exit $exit_status
fi fi
fi fi
...@@ -925,9 +987,9 @@ EOF ...@@ -925,9 +987,9 @@ EOF
if test "$build_old_libs" = yes; then if test "$build_old_libs" = yes; then
if test "$pic_mode" != yes; then if test "$pic_mode" != yes; then
# Don't build PIC code # Don't build PIC code
command="$base_compile $srcfile" command="$base_compile $qsrcfile"
else else
command="$base_compile $srcfile $pic_flag" command="$base_compile $qsrcfile $pic_flag"
fi fi
if test "$compiler_c_o" = yes; then if test "$compiler_c_o" = yes; then
command="$command -o $obj" command="$command -o $obj"
...@@ -1056,6 +1118,7 @@ EOF ...@@ -1056,6 +1118,7 @@ EOF
no_install=no no_install=no
objs= objs=
non_pic_objects= non_pic_objects=
notinst_path= # paths that contain not-installed libtool libraries
precious_files_regex= precious_files_regex=
prefer_static_libs=no prefer_static_libs=no
preload=no preload=no
...@@ -1084,14 +1147,15 @@ EOF ...@@ -1084,14 +1147,15 @@ EOF
if test -n "$link_static_flag"; then if test -n "$link_static_flag"; then
dlopen_self=$dlopen_self_static dlopen_self=$dlopen_self_static
fi fi
prefer_static_libs=yes
else else
if test -z "$pic_flag" && test -n "$link_static_flag"; then if test -z "$pic_flag" && test -n "$link_static_flag"; then
dlopen_self=$dlopen_self_static dlopen_self=$dlopen_self_static
fi fi
prefer_static_libs=built
fi fi
build_libtool_libs=no build_libtool_libs=no
build_old_libs=yes build_old_libs=yes
prefer_static_libs=yes
break break
;; ;;
esac esac
...@@ -1266,6 +1330,11 @@ EOF ...@@ -1266,6 +1330,11 @@ EOF
if test -z "$pic_object" || test "$pic_object" = none ; then if test -z "$pic_object" || test "$pic_object" = none ; then
arg="$non_pic_object" arg="$non_pic_object"
fi fi
else
# If the PIC object exists, use it instead.
# $xdir was prepended to $pic_object above.
non_pic_object="$pic_object"
non_pic_objects="$non_pic_objects $non_pic_object"
fi fi
else else
# Only an error if not doing a dry-run. # Only an error if not doing a dry-run.
...@@ -1362,6 +1431,13 @@ EOF ...@@ -1362,6 +1431,13 @@ EOF
prev= prev=
continue continue
;; ;;
darwin_framework|darwin_framework_skip)
test "$prev" = "darwin_framework" && compiler_flags="$compiler_flags $arg"
compile_command="$compile_command $arg"
finalize_command="$finalize_command $arg"
prev=
continue
;;
*) *)
eval "$prev=\"\$arg\"" eval "$prev=\"\$arg\""
prev= prev=
...@@ -1420,6 +1496,18 @@ EOF ...@@ -1420,6 +1496,18 @@ EOF
continue continue
;; ;;
-framework|-arch|-isysroot)
case " $CC " in
*" ${arg} ${1} "* | *" ${arg} ${1} "*)
prev=darwin_framework_skip ;;
*) compiler_flags="$compiler_flags $arg"
prev=darwin_framework ;;
esac
compile_command="$compile_command $arg"
finalize_command="$finalize_command $arg"
continue
;;
-inst-prefix-dir) -inst-prefix-dir)
prev=inst_prefix prev=inst_prefix
continue continue
...@@ -1446,7 +1534,8 @@ EOF ...@@ -1446,7 +1534,8 @@ EOF
absdir=`cd "$dir" && pwd` absdir=`cd "$dir" && pwd`
if test -z "$absdir"; then if test -z "$absdir"; then
$echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2 $echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2
exit $EXIT_FAILURE absdir="$dir"
notinst_path="$notinst_path $dir"
fi fi
dir="$absdir" dir="$absdir"
;; ;;
...@@ -1460,10 +1549,15 @@ EOF ...@@ -1460,10 +1549,15 @@ EOF
esac esac
case $host in case $host in
*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
testbindir=`$echo "X$dir" | $Xsed -e 's*/lib$*/bin*'`
case :$dllsearchpath: in case :$dllsearchpath: in
*":$dir:"*) ;; *":$dir:"*) ;;
*) dllsearchpath="$dllsearchpath:$dir";; *) dllsearchpath="$dllsearchpath:$dir";;
esac esac
case :$dllsearchpath: in
*":$testbindir:"*) ;;
*) dllsearchpath="$dllsearchpath:$testbindir";;
esac
;; ;;
esac esac
continue continue
...@@ -1472,15 +1566,15 @@ EOF ...@@ -1472,15 +1566,15 @@ EOF
-l*) -l*)
if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then
case $host in case $host in
*-*-cygwin* | *-*-pw32* | *-*-beos*) *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos*)
# These systems don't actually have a C or math library (as such) # These systems don't actually have a C or math library (as such)
continue continue
;; ;;
*-*-mingw* | *-*-os2*) *-*-os2*)
# These systems don't actually have a C library (as such) # These systems don't actually have a C library (as such)
test "X$arg" = "X-lc" && continue test "X$arg" = "X-lc" && continue
;; ;;
*-*-openbsd* | *-*-freebsd*) *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
# Do not include libc due to us having libc/libc_r. # Do not include libc due to us having libc/libc_r.
test "X$arg" = "X-lc" && continue test "X$arg" = "X-lc" && continue
;; ;;
...@@ -1488,10 +1582,19 @@ EOF ...@@ -1488,10 +1582,19 @@ EOF
# Rhapsody C and math libraries are in the System framework # Rhapsody C and math libraries are in the System framework
deplibs="$deplibs -framework System" deplibs="$deplibs -framework System"
continue continue
;;
*-*-sco3.2v5* | *-*-sco5v6*)
# Causes problems with __ctype
test "X$arg" = "X-lc" && continue
;;
*-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
# Compiler inserts libc in the correct place for threads to work
test "X$arg" = "X-lc" && continue
;;
esac esac
elif test "X$arg" = "X-lc_r"; then elif test "X$arg" = "X-lc_r"; then
case $host in case $host in
*-*-openbsd* | *-*-freebsd*) *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
# Do not include libc_r directly, use -pthread flag. # Do not include libc_r directly, use -pthread flag.
continue continue
;; ;;
...@@ -1501,8 +1604,20 @@ EOF ...@@ -1501,8 +1604,20 @@ EOF
continue continue
;; ;;
# Tru64 UNIX uses -model [arg] to determine the layout of C++
# classes, name mangling, and exception handling.
-model)
compile_command="$compile_command $arg"
compiler_flags="$compiler_flags $arg"
finalize_command="$finalize_command $arg"
prev=xcompiler
continue
;;
-mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe) -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe)
deplibs="$deplibs $arg" compiler_flags="$compiler_flags $arg"
compile_command="$compile_command $arg"
finalize_command="$finalize_command $arg"
continue continue
;; ;;
...@@ -1511,13 +1626,19 @@ EOF ...@@ -1511,13 +1626,19 @@ EOF
continue continue
;; ;;
# gcc -m* arguments should be passed to the linker via $compiler_flags # -64, -mips[0-9] enable 64-bit mode on the SGI compiler
# in order to pass architecture information to the linker # -r[0-9][0-9]* specifies the processor on the SGI compiler
# (e.g. 32 vs 64-bit). This may also be accomplished via -Wl,-mfoo # -xarch=*, -xtarget=* enable 64-bit mode on the Sun compiler
# but this is not reliable with gcc because gcc may use -mfoo to # +DA*, +DD* enable 64-bit mode on the HP compiler
# select a different linker, different libraries, etc, while # -q* pass through compiler args for the IBM compiler
# -Wl,-mfoo simply passes -mfoo to the linker. # -m* pass through architecture-specific compiler args for GCC
-m*) # -m*, -t[45]*, -txscale* pass through architecture-specific
# compiler args for GCC
# -pg pass through profiling flag for GCC
# @file GCC response files
-64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*|-pg| \
-t[45]*|-txscale*|@*)
# Unknown arguments in both finalize_command and compile_command need # Unknown arguments in both finalize_command and compile_command need
# to be aesthetically quoted because they are evaled later. # to be aesthetically quoted because they are evaled later.
arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
...@@ -1528,9 +1649,7 @@ EOF ...@@ -1528,9 +1649,7 @@ EOF
esac esac
compile_command="$compile_command $arg" compile_command="$compile_command $arg"
finalize_command="$finalize_command $arg" finalize_command="$finalize_command $arg"
if test "$with_gcc" = "yes" ; then compiler_flags="$compiler_flags $arg"
compiler_flags="$compiler_flags $arg"
fi
continue continue
;; ;;
...@@ -1773,6 +1892,11 @@ EOF ...@@ -1773,6 +1892,11 @@ EOF
if test -z "$pic_object" || test "$pic_object" = none ; then if test -z "$pic_object" || test "$pic_object" = none ; then
arg="$non_pic_object" arg="$non_pic_object"
fi fi
else
# If the PIC object exists, use it instead.
# $xdir was prepended to $pic_object above.
non_pic_object="$pic_object"
non_pic_objects="$non_pic_objects $non_pic_object"
fi fi
else else
# Only an error if not doing a dry-run. # Only an error if not doing a dry-run.
...@@ -1878,9 +2002,9 @@ EOF ...@@ -1878,9 +2002,9 @@ EOF
if test ! -d "$output_objdir"; then if test ! -d "$output_objdir"; then
$show "$mkdir $output_objdir" $show "$mkdir $output_objdir"
$run $mkdir $output_objdir $run $mkdir $output_objdir
status=$? exit_status=$?
if test "$status" -ne 0 && test ! -d "$output_objdir"; then if test "$exit_status" -ne 0 && test ! -d "$output_objdir"; then
exit $status exit $exit_status
fi fi
fi fi
...@@ -1943,7 +2067,6 @@ EOF ...@@ -1943,7 +2067,6 @@ EOF
newlib_search_path= newlib_search_path=
need_relink=no # whether we're linking any uninstalled libtool libraries need_relink=no # whether we're linking any uninstalled libtool libraries
notinst_deplibs= # not-installed libtool libraries notinst_deplibs= # not-installed libtool libraries
notinst_path= # paths that contain not-installed libtool libraries
case $linkmode in case $linkmode in
lib) lib)
passes="conv link" passes="conv link"
...@@ -1995,7 +2118,7 @@ EOF ...@@ -1995,7 +2118,7 @@ EOF
compile_deplibs="$deplib $compile_deplibs" compile_deplibs="$deplib $compile_deplibs"
finalize_deplibs="$deplib $finalize_deplibs" finalize_deplibs="$deplib $finalize_deplibs"
else else
deplibs="$deplib $deplibs" compiler_flags="$compiler_flags $deplib"
fi fi
continue continue
;; ;;
...@@ -2004,10 +2127,6 @@ EOF ...@@ -2004,10 +2127,6 @@ EOF
$echo "$modename: warning: \`-l' is ignored for archives/objects" 1>&2 $echo "$modename: warning: \`-l' is ignored for archives/objects" 1>&2
continue continue
fi fi
if test "$pass" = conv; then
deplibs="$deplib $deplibs"
continue
fi
name=`$echo "X$deplib" | $Xsed -e 's/^-l//'` name=`$echo "X$deplib" | $Xsed -e 's/^-l//'`
for searchdir in $newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path; do for searchdir in $newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path; do
for search_ext in .la $std_shrext .so .a; do for search_ext in .la $std_shrext .so .a; do
...@@ -2195,7 +2314,7 @@ EOF ...@@ -2195,7 +2314,7 @@ EOF
esac # case $deplib esac # case $deplib
if test "$found" = yes || test -f "$lib"; then : if test "$found" = yes || test -f "$lib"; then :
else else
$echo "$modename: cannot find the library \`$lib'" 1>&2 $echo "$modename: cannot find the library \`$lib' or unhandled argument \`$deplib'" 1>&2
exit $EXIT_FAILURE exit $EXIT_FAILURE
fi fi
...@@ -2219,6 +2338,8 @@ EOF ...@@ -2219,6 +2338,8 @@ EOF
# it will not redefine variables installed, or shouldnotlink # it will not redefine variables installed, or shouldnotlink
installed=yes installed=yes
shouldnotlink=no shouldnotlink=no
avoidtemprpath=
# Read the .la file # Read the .la file
case $lib in case $lib in
...@@ -2324,6 +2445,7 @@ EOF ...@@ -2324,6 +2445,7 @@ EOF
dir="$libdir" dir="$libdir"
absdir="$libdir" absdir="$libdir"
fi fi
test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes
else else
if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then
dir="$ladir" dir="$ladir"
...@@ -2408,12 +2530,12 @@ EOF ...@@ -2408,12 +2530,12 @@ EOF
if test -n "$library_names" && if test -n "$library_names" &&
{ test "$prefer_static_libs" = no || test -z "$old_library"; }; then { test "$prefer_static_libs" = no || test -z "$old_library"; }; then
# We need to hardcode the library path # We need to hardcode the library path
if test -n "$shlibpath_var"; then if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then
# Make sure the rpath contains only unique directories. # Make sure the rpath contains only unique directories.
case "$temp_rpath " in case "$temp_rpath " in
*" $dir "*) ;; *" $dir "*) ;;
*" $absdir "*) ;; *" $absdir "*) ;;
*) temp_rpath="$temp_rpath $dir" ;; *) temp_rpath="$temp_rpath $absdir" ;;
esac esac
fi fi
...@@ -2450,8 +2572,12 @@ EOF ...@@ -2450,8 +2572,12 @@ EOF
fi fi
link_static=no # Whether the deplib will be linked statically link_static=no # Whether the deplib will be linked statically
use_static_libs=$prefer_static_libs
if test "$use_static_libs" = built && test "$installed" = yes ; then
use_static_libs=no
fi
if test -n "$library_names" && if test -n "$library_names" &&
{ test "$prefer_static_libs" = no || test -z "$old_library"; }; then { test "$use_static_libs" = no || test -z "$old_library"; }; then
if test "$installed" = no; then if test "$installed" = no; then
notinst_deplibs="$notinst_deplibs $lib" notinst_deplibs="$notinst_deplibs $lib"
need_relink=yes need_relink=yes
...@@ -2564,11 +2690,15 @@ EOF ...@@ -2564,11 +2690,15 @@ EOF
if test "$hardcode_direct" = no; then if test "$hardcode_direct" = no; then
add="$dir/$linklib" add="$dir/$linklib"
case $host in case $host in
*-*-sco3.2v5* ) add_dir="-L$dir" ;; *-*-sco3.2v5.0.[024]*) add_dir="-L$dir" ;;
*-*-sysv4*uw2*) add_dir="-L$dir" ;;
*-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \
*-*-unixware7*) add_dir="-L$dir" ;;
*-*-darwin* ) *-*-darwin* )
# if the lib is a module then we can not link against # if the lib is a module then we can not link against
# it, someone is ignoring the new warnings I added # it, someone is ignoring the new warnings I added
if /usr/bin/file -L $add 2> /dev/null | $EGREP "bundle" >/dev/null ; then if /usr/bin/file -L $add 2> /dev/null |
$EGREP ": [^:]* bundle" >/dev/null ; then
$echo "** Warning, lib $linklib is a module, not a shared library" $echo "** Warning, lib $linklib is a module, not a shared library"
if test -z "$old_library" ; then if test -z "$old_library" ; then
$echo $echo
...@@ -2599,7 +2729,7 @@ EOF ...@@ -2599,7 +2729,7 @@ EOF
add_dir="-L$dir" add_dir="-L$dir"
# Try looking first in the location we're being installed to. # Try looking first in the location we're being installed to.
if test -n "$inst_prefix_dir"; then if test -n "$inst_prefix_dir"; then
case "$libdir" in case $libdir in
[\\/]*) [\\/]*)
add_dir="$add_dir -L$inst_prefix_dir$libdir" add_dir="$add_dir -L$inst_prefix_dir$libdir"
;; ;;
...@@ -2672,7 +2802,7 @@ EOF ...@@ -2672,7 +2802,7 @@ EOF
add_dir="-L$libdir" add_dir="-L$libdir"
# Try looking first in the location we're being installed to. # Try looking first in the location we're being installed to.
if test -n "$inst_prefix_dir"; then if test -n "$inst_prefix_dir"; then
case "$libdir" in case $libdir in
[\\/]*) [\\/]*)
add_dir="$add_dir -L$inst_prefix_dir$libdir" add_dir="$add_dir -L$inst_prefix_dir$libdir"
;; ;;
...@@ -2733,8 +2863,6 @@ EOF ...@@ -2733,8 +2863,6 @@ EOF
fi fi
fi fi
else else
convenience="$convenience $dir/$old_library"
old_convenience="$old_convenience $dir/$old_library"
deplibs="$dir/$old_library $deplibs" deplibs="$dir/$old_library $deplibs"
link_static=yes link_static=yes
fi fi
...@@ -2859,12 +2987,12 @@ EOF ...@@ -2859,12 +2987,12 @@ EOF
*) continue ;; *) continue ;;
esac esac
case " $deplibs " in case " $deplibs " in
*" $depdepl "*) ;; *" $path "*) ;;
*) deplibs="$depdepl $deplibs" ;; *) deplibs="$path $deplibs" ;;
esac esac
case " $deplibs " in case " $deplibs " in
*" $path "*) ;; *" $depdepl "*) ;;
*) deplibs="$deplibs $path" ;; *) deplibs="$depdepl $deplibs" ;;
esac esac
done done
fi # link_all_deplibs != no fi # link_all_deplibs != no
...@@ -3129,27 +3257,27 @@ EOF ...@@ -3129,27 +3257,27 @@ EOF
# Check that each of the things are valid numbers. # Check that each of the things are valid numbers.
case $current in case $current in
0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;; 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;;
*) *)
$echo "$modename: CURRENT \`$current' is not a nonnegative integer" 1>&2 $echo "$modename: CURRENT \`$current' must be a nonnegative integer" 1>&2
$echo "$modename: \`$vinfo' is not valid version information" 1>&2 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
exit $EXIT_FAILURE exit $EXIT_FAILURE
;; ;;
esac esac
case $revision in case $revision in
0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;; 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;;
*) *)
$echo "$modename: REVISION \`$revision' is not a nonnegative integer" 1>&2 $echo "$modename: REVISION \`$revision' must be a nonnegative integer" 1>&2
$echo "$modename: \`$vinfo' is not valid version information" 1>&2 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
exit $EXIT_FAILURE exit $EXIT_FAILURE
;; ;;
esac esac
case $age in case $age in
0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;; 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;;
*) *)
$echo "$modename: AGE \`$age' is not a nonnegative integer" 1>&2 $echo "$modename: AGE \`$age' must be a nonnegative integer" 1>&2
$echo "$modename: \`$vinfo' is not valid version information" 1>&2 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
exit $EXIT_FAILURE exit $EXIT_FAILURE
;; ;;
...@@ -3328,9 +3456,9 @@ EOF ...@@ -3328,9 +3456,9 @@ EOF
# Eliminate all temporary directories. # Eliminate all temporary directories.
for path in $notinst_path; do for path in $notinst_path; do
lib_search_path=`$echo "$lib_search_path " | ${SED} -e 's% $path % %g'` lib_search_path=`$echo "$lib_search_path " | ${SED} -e "s% $path % %g"`
deplibs=`$echo "$deplibs " | ${SED} -e 's% -L$path % %g'` deplibs=`$echo "$deplibs " | ${SED} -e "s% -L$path % %g"`
dependency_libs=`$echo "$dependency_libs " | ${SED} -e 's% -L$path % %g'` dependency_libs=`$echo "$dependency_libs " | ${SED} -e "s% -L$path % %g"`
done done
if test -n "$xrpath"; then if test -n "$xrpath"; then
...@@ -3381,9 +3509,14 @@ EOF ...@@ -3381,9 +3509,14 @@ EOF
*-*-netbsd*) *-*-netbsd*)
# Don't link with libc until the a.out ld.so is fixed. # Don't link with libc until the a.out ld.so is fixed.
;; ;;
*-*-openbsd* | *-*-freebsd*) *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
# Do not include libc due to us having libc/libc_r. # Do not include libc due to us having libc/libc_r.
test "X$arg" = "X-lc" && continue ;;
*-*-sco3.2v5* | *-*-sco5v6*)
# Causes problems with __ctype
;;
*-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
# Compiler inserts libc in the correct place for threads to work
;; ;;
*) *)
# Add libc to deplibs on all other systems if necessary. # Add libc to deplibs on all other systems if necessary.
...@@ -3427,11 +3560,11 @@ EOF ...@@ -3427,11 +3560,11 @@ EOF
int main() { return 0; } int main() { return 0; }
EOF EOF
$rm conftest $rm conftest
$LTCC -o conftest conftest.c $deplibs $LTCC $LTCFLAGS -o conftest conftest.c $deplibs
if test "$?" -eq 0 ; then if test "$?" -eq 0 ; then
ldd_output=`ldd conftest` ldd_output=`ldd conftest`
for i in $deplibs; do for i in $deplibs; do
name="`expr $i : '-l\(.*\)'`" name=`expr $i : '-l\(.*\)'`
# If $name is empty we are operating on a -L argument. # If $name is empty we are operating on a -L argument.
if test "$name" != "" && test "$name" -ne "0"; then if test "$name" != "" && test "$name" -ne "0"; then
if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
...@@ -3468,11 +3601,11 @@ EOF ...@@ -3468,11 +3601,11 @@ EOF
# Error occurred in the first compile. Let's try to salvage # Error occurred in the first compile. Let's try to salvage
# the situation: Compile a separate program for each library. # the situation: Compile a separate program for each library.
for i in $deplibs; do for i in $deplibs; do
name="`expr $i : '-l\(.*\)'`" name=`expr $i : '-l\(.*\)'`
# If $name is empty we are operating on a -L argument. # If $name is empty we are operating on a -L argument.
if test "$name" != "" && test "$name" != "0"; then if test "$name" != "" && test "$name" != "0"; then
$rm conftest $rm conftest
$LTCC -o conftest conftest.c $i $LTCC $LTCFLAGS -o conftest conftest.c $i
# Did it work? # Did it work?
if test "$?" -eq 0 ; then if test "$?" -eq 0 ; then
ldd_output=`ldd conftest` ldd_output=`ldd conftest`
...@@ -3520,7 +3653,7 @@ EOF ...@@ -3520,7 +3653,7 @@ EOF
set dummy $deplibs_check_method set dummy $deplibs_check_method
file_magic_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"` file_magic_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
for a_deplib in $deplibs; do for a_deplib in $deplibs; do
name="`expr $a_deplib : '-l\(.*\)'`" name=`expr $a_deplib : '-l\(.*\)'`
# If $name is empty we are operating on a -L argument. # If $name is empty we are operating on a -L argument.
if test "$name" != "" && test "$name" != "0"; then if test "$name" != "" && test "$name" != "0"; then
if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
...@@ -3589,7 +3722,7 @@ EOF ...@@ -3589,7 +3722,7 @@ EOF
set dummy $deplibs_check_method set dummy $deplibs_check_method
match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"` match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
for a_deplib in $deplibs; do for a_deplib in $deplibs; do
name="`expr $a_deplib : '-l\(.*\)'`" name=`expr $a_deplib : '-l\(.*\)'`
# If $name is empty we are operating on a -L argument. # If $name is empty we are operating on a -L argument.
if test -n "$name" && test "$name" != "0"; then if test -n "$name" && test "$name" != "0"; then
if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
...@@ -3726,6 +3859,35 @@ EOF ...@@ -3726,6 +3859,35 @@ EOF
deplibs=$newdeplibs deplibs=$newdeplibs
fi fi
# move library search paths that coincide with paths to not yet
# installed libraries to the beginning of the library search list
new_libs=
for path in $notinst_path; do
case " $new_libs " in
*" -L$path/$objdir "*) ;;
*)
case " $deplibs " in
*" -L$path/$objdir "*)
new_libs="$new_libs -L$path/$objdir" ;;
esac
;;
esac
done
for deplib in $deplibs; do
case $deplib in
-L*)
case " $new_libs " in
*" $deplib "*) ;;
*) new_libs="$new_libs $deplib" ;;
esac
;;
*) new_libs="$new_libs $deplib" ;;
esac
done
deplibs="$new_libs"
# All the library-specific variables (install_libdir is set above). # All the library-specific variables (install_libdir is set above).
library_names= library_names=
old_library= old_library=
...@@ -3809,6 +3971,7 @@ EOF ...@@ -3809,6 +3971,7 @@ EOF
fi fi
lib="$output_objdir/$realname" lib="$output_objdir/$realname"
linknames=
for link for link
do do
linknames="$linknames $link" linknames="$linknames $link"
...@@ -3837,6 +4000,9 @@ EOF ...@@ -3837,6 +4000,9 @@ EOF
# The command line is too long to execute in one step. # The command line is too long to execute in one step.
$show "using reloadable object file for export list..." $show "using reloadable object file for export list..."
skipped_export=: skipped_export=:
# Break out early, otherwise skipped_export may be
# set to false by a later but shorter cmd.
break
fi fi
done done
IFS="$save_ifs" IFS="$save_ifs"
...@@ -3906,7 +4072,8 @@ EOF ...@@ -3906,7 +4072,8 @@ EOF
fi fi
fi fi
if test "X$skipped_export" != "X:" && len=`expr "X$test_cmds" : ".*"` && if test "X$skipped_export" != "X:" &&
len=`expr "X$test_cmds" : ".*" 2>/dev/null` &&
test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
: :
else else
...@@ -3925,6 +4092,7 @@ EOF ...@@ -3925,6 +4092,7 @@ EOF
save_libobjs=$libobjs save_libobjs=$libobjs
fi fi
save_output=$output save_output=$output
output_la=`$echo "X$output" | $Xsed -e "$basename"`
# Clear the reloadable object creation command queue and # Clear the reloadable object creation command queue and
# initialize k to one. # initialize k to one.
...@@ -3934,13 +4102,13 @@ EOF ...@@ -3934,13 +4102,13 @@ EOF
delfiles= delfiles=
last_robj= last_robj=
k=1 k=1
output=$output_objdir/$save_output-${k}.$objext output=$output_objdir/$output_la-${k}.$objext
# Loop over the list of objects to be linked. # Loop over the list of objects to be linked.
for obj in $save_libobjs for obj in $save_libobjs
do do
eval test_cmds=\"$reload_cmds $objlist $last_robj\" eval test_cmds=\"$reload_cmds $objlist $last_robj\"
if test "X$objlist" = X || if test "X$objlist" = X ||
{ len=`expr "X$test_cmds" : ".*"` && { len=`expr "X$test_cmds" : ".*" 2>/dev/null` &&
test "$len" -le "$max_cmd_len"; }; then test "$len" -le "$max_cmd_len"; }; then
objlist="$objlist $obj" objlist="$objlist $obj"
else else
...@@ -3954,9 +4122,9 @@ EOF ...@@ -3954,9 +4122,9 @@ EOF
# the last one created. # the last one created.
eval concat_cmds=\"\$concat_cmds~$reload_cmds $objlist $last_robj\" eval concat_cmds=\"\$concat_cmds~$reload_cmds $objlist $last_robj\"
fi fi
last_robj=$output_objdir/$save_output-${k}.$objext last_robj=$output_objdir/$output_la-${k}.$objext
k=`expr $k + 1` k=`expr $k + 1`
output=$output_objdir/$save_output-${k}.$objext output=$output_objdir/$output_la-${k}.$objext
objlist=$obj objlist=$obj
len=1 len=1
fi fi
...@@ -3976,13 +4144,13 @@ EOF ...@@ -3976,13 +4144,13 @@ EOF
eval concat_cmds=\"\$concat_cmds~$export_symbols_cmds\" eval concat_cmds=\"\$concat_cmds~$export_symbols_cmds\"
fi fi
# Set up a command to remove the reloadale object files # Set up a command to remove the reloadable object files
# after they are used. # after they are used.
i=0 i=0
while test "$i" -lt "$k" while test "$i" -lt "$k"
do do
i=`expr $i + 1` i=`expr $i + 1`
delfiles="$delfiles $output_objdir/$save_output-${i}.$objext" delfiles="$delfiles $output_objdir/$output_la-${i}.$objext"
done done
$echo "creating a temporary reloadable object file: $output" $echo "creating a temporary reloadable object file: $output"
...@@ -4030,13 +4198,30 @@ EOF ...@@ -4030,13 +4198,30 @@ EOF
IFS="$save_ifs" IFS="$save_ifs"
eval cmd=\"$cmd\" eval cmd=\"$cmd\"
$show "$cmd" $show "$cmd"
$run eval "$cmd" || exit $? $run eval "$cmd" || {
lt_exit=$?
# Restore the uninstalled library and exit
if test "$mode" = relink; then
$run eval '(cd $output_objdir && $rm ${realname}T && $mv ${realname}U $realname)'
fi
exit $lt_exit
}
done done
IFS="$save_ifs" IFS="$save_ifs"
# Restore the uninstalled library and exit # Restore the uninstalled library and exit
if test "$mode" = relink; then if test "$mode" = relink; then
$run eval '(cd $output_objdir && $rm ${realname}T && $mv $realname ${realname}T && $mv "$realname"U $realname)' || exit $? $run eval '(cd $output_objdir && $rm ${realname}T && $mv $realname ${realname}T && $mv "$realname"U $realname)' || exit $?
if test -n "$convenience"; then
if test -z "$whole_archive_flag_spec"; then
$show "${rm}r $gentop"
$run ${rm}r "$gentop"
fi
fi
exit $EXIT_SUCCESS exit $EXIT_SUCCESS
fi fi
...@@ -4221,6 +4406,35 @@ EOF ...@@ -4221,6 +4406,35 @@ EOF
;; ;;
esac esac
# move library search paths that coincide with paths to not yet
# installed libraries to the beginning of the library search list
new_libs=
for path in $notinst_path; do
case " $new_libs " in
*" -L$path/$objdir "*) ;;
*)
case " $compile_deplibs " in
*" -L$path/$objdir "*)
new_libs="$new_libs -L$path/$objdir" ;;
esac
;;
esac
done
for deplib in $compile_deplibs; do
case $deplib in
-L*)
case " $new_libs " in
*" $deplib "*) ;;
*) new_libs="$new_libs $deplib" ;;
esac
;;
*) new_libs="$new_libs $deplib" ;;
esac
done
compile_deplibs="$new_libs"
compile_command="$compile_command $compile_deplibs" compile_command="$compile_command $compile_deplibs"
finalize_command="$finalize_command $finalize_deplibs" finalize_command="$finalize_command $finalize_deplibs"
...@@ -4265,10 +4479,15 @@ EOF ...@@ -4265,10 +4479,15 @@ EOF
fi fi
case $host in case $host in
*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
testbindir=`$echo "X$libdir" | $Xsed -e 's*/lib$*/bin*'`
case :$dllsearchpath: in case :$dllsearchpath: in
*":$libdir:"*) ;; *":$libdir:"*) ;;
*) dllsearchpath="$dllsearchpath:$libdir";; *) dllsearchpath="$dllsearchpath:$libdir";;
esac esac
case :$dllsearchpath: in
*":$testbindir:"*) ;;
*) dllsearchpath="$dllsearchpath:$testbindir";;
esac
;; ;;
esac esac
done done
...@@ -4382,13 +4601,25 @@ extern \"C\" { ...@@ -4382,13 +4601,25 @@ extern \"C\" {
# Prepare the list of exported symbols # Prepare the list of exported symbols
if test -z "$export_symbols"; then if test -z "$export_symbols"; then
export_symbols="$output_objdir/$output.exp" export_symbols="$output_objdir/$outputname.exp"
$run $rm $export_symbols $run $rm $export_symbols
$run eval "${SED} -n -e '/^: @PROGRAM@$/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"' $run eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
case $host in
*cygwin* | *mingw* )
$run eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
$run eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"'
;;
esac
else else
$run eval "${SED} -e 's/\([][.*^$]\)/\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$output.exp"' $run eval "${SED} -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"'
$run eval 'grep -f "$output_objdir/$output.exp" < "$nlist" > "$nlist"T' $run eval 'grep -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T'
$run eval 'mv "$nlist"T "$nlist"' $run eval 'mv "$nlist"T "$nlist"'
case $host in
*cygwin* | *mingw* )
$run eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
$run eval 'cat "$nlist" >> "$output_objdir/$outputname.def"'
;;
esac
fi fi
fi fi
...@@ -4439,7 +4670,26 @@ extern \"C\" { ...@@ -4439,7 +4670,26 @@ extern \"C\" {
#endif #endif
/* The mapping between symbol names and symbols. */ /* The mapping between symbol names and symbols. */
"
case $host in
*cygwin* | *mingw* )
$echo >> "$output_objdir/$dlsyms" "\
/* DATA imports from DLLs on WIN32 can't be const, because
runtime relocations are performed -- see ld's documentation
on pseudo-relocs */
struct {
"
;;
* )
$echo >> "$output_objdir/$dlsyms" "\
const struct { const struct {
"
;;
esac
$echo >> "$output_objdir/$dlsyms" "\
const char *name; const char *name;
lt_ptr address; lt_ptr address;
} }
...@@ -4486,16 +4736,29 @@ static const void *lt_preloaded_setup() { ...@@ -4486,16 +4736,29 @@ static const void *lt_preloaded_setup() {
esac esac
# Now compile the dynamic symbol file. # Now compile the dynamic symbol file.
$show "(cd $output_objdir && $LTCC -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")" $show "(cd $output_objdir && $LTCC $LTCFLAGS -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")"
$run eval '(cd $output_objdir && $LTCC -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $? $run eval '(cd $output_objdir && $LTCC $LTCFLAGS -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $?
# Clean up the generated files. # Clean up the generated files.
$show "$rm $output_objdir/$dlsyms $nlist ${nlist}S ${nlist}T" $show "$rm $output_objdir/$dlsyms $nlist ${nlist}S ${nlist}T"
$run $rm "$output_objdir/$dlsyms" "$nlist" "${nlist}S" "${nlist}T" $run $rm "$output_objdir/$dlsyms" "$nlist" "${nlist}S" "${nlist}T"
# Transform the symbol file into the correct name. # Transform the symbol file into the correct name.
compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"` case $host in
finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"` *cygwin* | *mingw* )
if test -f "$output_objdir/${outputname}.def" ; then
compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}.def $output_objdir/${outputname}S.${objext}%"`
finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}.def $output_objdir/${outputname}S.${objext}%"`
else
compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
fi
;;
* )
compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
;;
esac
;; ;;
*) *)
$echo "$modename: unknown suffix for \`$dlsyms'" 1>&2 $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2
...@@ -4520,7 +4783,7 @@ static const void *lt_preloaded_setup() { ...@@ -4520,7 +4783,7 @@ static const void *lt_preloaded_setup() {
# We have no uninstalled library dependencies, so finalize right now. # We have no uninstalled library dependencies, so finalize right now.
$show "$link_command" $show "$link_command"
$run eval "$link_command" $run eval "$link_command"
status=$? exit_status=$?
# Delete the generated files. # Delete the generated files.
if test -n "$dlsyms"; then if test -n "$dlsyms"; then
...@@ -4528,7 +4791,7 @@ static const void *lt_preloaded_setup() { ...@@ -4528,7 +4791,7 @@ static const void *lt_preloaded_setup() {
$run $rm "$output_objdir/${outputname}S.${objext}" $run $rm "$output_objdir/${outputname}S.${objext}"
fi fi
exit $status exit $exit_status
fi fi
if test -n "$shlibpath_var"; then if test -n "$shlibpath_var"; then
...@@ -4668,10 +4931,12 @@ static const void *lt_preloaded_setup() { ...@@ -4668,10 +4931,12 @@ static const void *lt_preloaded_setup() {
esac esac
case $host in case $host in
*cygwin* | *mingw* ) *cygwin* | *mingw* )
cwrappersource=`$echo ${objdir}/lt-${output}.c` output_name=`basename $output`
cwrapper=`$echo ${output}.exe` output_path=`dirname $output`
$rm $cwrappersource $cwrapper cwrappersource="$output_path/$objdir/lt-$output_name.c"
trap "$rm $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15 cwrapper="$output_path/$output_name.exe"
$rm $cwrappersource $cwrapper
trap "$rm $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15
cat > $cwrappersource <<EOF cat > $cwrappersource <<EOF
...@@ -4696,6 +4961,9 @@ EOF ...@@ -4696,6 +4961,9 @@ EOF
#include <malloc.h> #include <malloc.h>
#include <stdarg.h> #include <stdarg.h>
#include <assert.h> #include <assert.h>
#include <string.h>
#include <ctype.h>
#include <sys/stat.h>
#if defined(PATH_MAX) #if defined(PATH_MAX)
# define LT_PATHMAX PATH_MAX # define LT_PATHMAX PATH_MAX
...@@ -4706,15 +4974,19 @@ EOF ...@@ -4706,15 +4974,19 @@ EOF
#endif #endif
#ifndef DIR_SEPARATOR #ifndef DIR_SEPARATOR
#define DIR_SEPARATOR '/' # define DIR_SEPARATOR '/'
# define PATH_SEPARATOR ':'
#endif #endif
#if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \ #if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \
defined (__OS2__) defined (__OS2__)
#define HAVE_DOS_BASED_FILE_SYSTEM # define HAVE_DOS_BASED_FILE_SYSTEM
#ifndef DIR_SEPARATOR_2 # ifndef DIR_SEPARATOR_2
#define DIR_SEPARATOR_2 '\\' # define DIR_SEPARATOR_2 '\\'
#endif # endif
# ifndef PATH_SEPARATOR_2
# define PATH_SEPARATOR_2 ';'
# endif
#endif #endif
#ifndef DIR_SEPARATOR_2 #ifndef DIR_SEPARATOR_2
...@@ -4724,17 +4996,32 @@ EOF ...@@ -4724,17 +4996,32 @@ EOF
(((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2)) (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2))
#endif /* DIR_SEPARATOR_2 */ #endif /* DIR_SEPARATOR_2 */
#ifndef PATH_SEPARATOR_2
# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR)
#else /* PATH_SEPARATOR_2 */
# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2)
#endif /* PATH_SEPARATOR_2 */
#define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type))) #define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type)))
#define XFREE(stale) do { \ #define XFREE(stale) do { \
if (stale) { free ((void *) stale); stale = 0; } \ if (stale) { free ((void *) stale); stale = 0; } \
} while (0) } while (0)
/* -DDEBUG is fairly common in CFLAGS. */
#undef DEBUG
#if defined DEBUGWRAPPER
# define DEBUG(format, ...) fprintf(stderr, format, __VA_ARGS__)
#else
# define DEBUG(format, ...)
#endif
const char *program_name = NULL; const char *program_name = NULL;
void * xmalloc (size_t num); void * xmalloc (size_t num);
char * xstrdup (const char *string); char * xstrdup (const char *string);
char * basename (const char *name); const char * base_name (const char *name);
char * fnqualify(const char *path); char * find_executable(const char *wrapper);
int check_executable(const char *path);
char * strendzap(char *str, const char *pat); char * strendzap(char *str, const char *pat);
void lt_fatal (const char *message, ...); void lt_fatal (const char *message, ...);
...@@ -4744,29 +5031,51 @@ main (int argc, char *argv[]) ...@@ -4744,29 +5031,51 @@ main (int argc, char *argv[])
char **newargz; char **newargz;
int i; int i;
program_name = (char *) xstrdup ((char *) basename (argv[0])); program_name = (char *) xstrdup (base_name (argv[0]));
DEBUG("(main) argv[0] : %s\n",argv[0]);
DEBUG("(main) program_name : %s\n",program_name);
newargz = XMALLOC(char *, argc+2); newargz = XMALLOC(char *, argc+2);
EOF EOF
cat >> $cwrappersource <<EOF cat >> $cwrappersource <<EOF
newargz[0] = "$SHELL"; newargz[0] = (char *) xstrdup("$SHELL");
EOF EOF
cat >> $cwrappersource <<"EOF" cat >> $cwrappersource <<"EOF"
newargz[1] = fnqualify(argv[0]); newargz[1] = find_executable(argv[0]);
if (newargz[1] == NULL)
lt_fatal("Couldn't find %s", argv[0]);
DEBUG("(main) found exe at : %s\n",newargz[1]);
/* we know the script has the same name, without the .exe */ /* we know the script has the same name, without the .exe */
/* so make sure newargz[1] doesn't end in .exe */ /* so make sure newargz[1] doesn't end in .exe */
strendzap(newargz[1],".exe"); strendzap(newargz[1],".exe");
for (i = 1; i < argc; i++) for (i = 1; i < argc; i++)
newargz[i+1] = xstrdup(argv[i]); newargz[i+1] = xstrdup(argv[i]);
newargz[argc+1] = NULL; newargz[argc+1] = NULL;
for (i=0; i<argc+1; i++)
{
DEBUG("(main) newargz[%d] : %s\n",i,newargz[i]);
;
}
EOF EOF
cat >> $cwrappersource <<EOF case $host_os in
mingw*)
cat >> $cwrappersource <<EOF
execv("$SHELL",(char const **)newargz);
EOF
;;
*)
cat >> $cwrappersource <<EOF
execv("$SHELL",newargz); execv("$SHELL",newargz);
EOF EOF
;;
esac
cat >> $cwrappersource <<"EOF" cat >> $cwrappersource <<"EOF"
return 127;
} }
void * void *
...@@ -4786,48 +5095,148 @@ xstrdup (const char *string) ...@@ -4786,48 +5095,148 @@ xstrdup (const char *string)
; ;
} }
char * const char *
basename (const char *name) base_name (const char *name)
{ {
const char *base; const char *base;
#if defined (HAVE_DOS_BASED_FILE_SYSTEM) #if defined (HAVE_DOS_BASED_FILE_SYSTEM)
/* Skip over the disk name in MSDOS pathnames. */ /* Skip over the disk name in MSDOS pathnames. */
if (isalpha (name[0]) && name[1] == ':') if (isalpha ((unsigned char)name[0]) && name[1] == ':')
name += 2; name += 2;
#endif #endif
for (base = name; *name; name++) for (base = name; *name; name++)
if (IS_DIR_SEPARATOR (*name)) if (IS_DIR_SEPARATOR (*name))
base = name + 1; base = name + 1;
return (char *) base; return base;
} }
int
check_executable(const char * path)
{
struct stat st;
DEBUG("(check_executable) : %s\n", path ? (*path ? path : "EMPTY!") : "NULL!");
if ((!path) || (!*path))
return 0;
if ((stat (path, &st) >= 0) &&
(
/* MinGW & native WIN32 do not support S_IXOTH or S_IXGRP */
#if defined (S_IXOTH)
((st.st_mode & S_IXOTH) == S_IXOTH) ||
#endif
#if defined (S_IXGRP)
((st.st_mode & S_IXGRP) == S_IXGRP) ||
#endif
((st.st_mode & S_IXUSR) == S_IXUSR))
)
return 1;
else
return 0;
}
/* Searches for the full path of the wrapper. Returns
newly allocated full path name if found, NULL otherwise */
char * char *
fnqualify(const char *path) find_executable (const char* wrapper)
{ {
size_t size; int has_slash = 0;
char *p; const char* p;
const char* p_next;
/* static buffer for getcwd */
char tmp[LT_PATHMAX + 1]; char tmp[LT_PATHMAX + 1];
int tmp_len;
char* concat_name;
DEBUG("(find_executable) : %s\n", wrapper ? (*wrapper ? wrapper : "EMPTY!") : "NULL!");
assert(path != NULL); if ((wrapper == NULL) || (*wrapper == '\0'))
return NULL;
/* Is it qualified already? */ /* Absolute path? */
#if defined (HAVE_DOS_BASED_FILE_SYSTEM) #if defined (HAVE_DOS_BASED_FILE_SYSTEM)
if (isalpha (path[0]) && path[1] == ':') if (isalpha ((unsigned char)wrapper[0]) && wrapper[1] == ':')
return xstrdup (path); {
concat_name = xstrdup (wrapper);
if (check_executable(concat_name))
return concat_name;
XFREE(concat_name);
}
else
{
#endif
if (IS_DIR_SEPARATOR (wrapper[0]))
{
concat_name = xstrdup (wrapper);
if (check_executable(concat_name))
return concat_name;
XFREE(concat_name);
}
#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
}
#endif #endif
if (IS_DIR_SEPARATOR (path[0]))
return xstrdup (path);
/* prepend the current directory */ for (p = wrapper; *p; p++)
/* doesn't handle '~' */ if (*p == '/')
{
has_slash = 1;
break;
}
if (!has_slash)
{
/* no slashes; search PATH */
const char* path = getenv ("PATH");
if (path != NULL)
{
for (p = path; *p; p = p_next)
{
const char* q;
size_t p_len;
for (q = p; *q; q++)
if (IS_PATH_SEPARATOR(*q))
break;
p_len = q - p;
p_next = (*q == '\0' ? q : q + 1);
if (p_len == 0)
{
/* empty path: current directory */
if (getcwd (tmp, LT_PATHMAX) == NULL)
lt_fatal ("getcwd failed");
tmp_len = strlen(tmp);
concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1);
memcpy (concat_name, tmp, tmp_len);
concat_name[tmp_len] = '/';
strcpy (concat_name + tmp_len + 1, wrapper);
}
else
{
concat_name = XMALLOC(char, p_len + 1 + strlen(wrapper) + 1);
memcpy (concat_name, p, p_len);
concat_name[p_len] = '/';
strcpy (concat_name + p_len + 1, wrapper);
}
if (check_executable(concat_name))
return concat_name;
XFREE(concat_name);
}
}
/* not found in PATH; assume curdir */
}
/* Relative path | not found in path: prepend cwd */
if (getcwd (tmp, LT_PATHMAX) == NULL) if (getcwd (tmp, LT_PATHMAX) == NULL)
lt_fatal ("getcwd failed"); lt_fatal ("getcwd failed");
size = strlen(tmp) + 1 + strlen(path) + 1; /* +2 for '/' and '\0' */ tmp_len = strlen(tmp);
p = XMALLOC(char, size); concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1);
sprintf(p, "%s%c%s", tmp, DIR_SEPARATOR, path); memcpy (concat_name, tmp, tmp_len);
return p; concat_name[tmp_len] = '/';
strcpy (concat_name + tmp_len + 1, wrapper);
if (check_executable(concat_name))
return concat_name;
XFREE(concat_name);
return NULL;
} }
char * char *
...@@ -4871,16 +5280,16 @@ lt_fatal (const char *message, ...) ...@@ -4871,16 +5280,16 @@ lt_fatal (const char *message, ...)
va_end (ap); va_end (ap);
} }
EOF EOF
# we should really use a build-platform specific compiler # we should really use a build-platform specific compiler
# here, but OTOH, the wrappers (shell script and this C one) # here, but OTOH, the wrappers (shell script and this C one)
# are only useful if you want to execute the "real" binary. # are only useful if you want to execute the "real" binary.
# Since the "real" binary is built for $host, then this # Since the "real" binary is built for $host, then this
# wrapper might as well be built for $host, too. # wrapper might as well be built for $host, too.
$run $LTCC -s -o $cwrapper $cwrappersource $run $LTCC $LTCFLAGS -s -o $cwrapper $cwrappersource
;; ;;
esac esac
$rm $output $rm $output
trap "$rm $output; exit $EXIT_FAILURE" 1 2 15 trap "$rm $output; exit $EXIT_FAILURE" 1 2 15
$echo > $output "\ $echo > $output "\
#! $SHELL #! $SHELL
...@@ -5030,13 +5439,13 @@ else ...@@ -5030,13 +5439,13 @@ else
# Backslashes separate directories on plain windows # Backslashes separate directories on plain windows
*-*-mingw | *-*-os2*) *-*-mingw | *-*-os2*)
$echo >> $output "\ $echo >> $output "\
exec \$progdir\\\\\$program \${1+\"\$@\"} exec \"\$progdir\\\\\$program\" \${1+\"\$@\"}
" "
;; ;;
*) *)
$echo >> $output "\ $echo >> $output "\
exec \$progdir/\$program \${1+\"\$@\"} exec \"\$progdir/\$program\" \${1+\"\$@\"}
" "
;; ;;
esac esac
...@@ -5046,7 +5455,7 @@ else ...@@ -5046,7 +5455,7 @@ else
fi fi
else else
# The program doesn't exist. # The program doesn't exist.
\$echo \"\$0: error: \$progdir/\$program does not exist\" 1>&2 \$echo \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2
\$echo \"This script is just a wrapper for \$program.\" 1>&2 \$echo \"This script is just a wrapper for \$program.\" 1>&2
$echo \"See the $PACKAGE documentation for more information.\" 1>&2 $echo \"See the $PACKAGE documentation for more information.\" 1>&2
exit $EXIT_FAILURE exit $EXIT_FAILURE
...@@ -5088,6 +5497,63 @@ fi\ ...@@ -5088,6 +5497,63 @@ fi\
if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then
cmds=$old_archive_from_new_cmds cmds=$old_archive_from_new_cmds
else else
# POSIX demands no paths to be encoded in archives. We have
# to avoid creating archives with duplicate basenames if we
# might have to extract them afterwards, e.g., when creating a
# static archive out of a convenience library, or when linking
# the entirety of a libtool archive into another (currently
# not supported by libtool).
if (for obj in $oldobjs
do
$echo "X$obj" | $Xsed -e 's%^.*/%%'
done | sort | sort -uc >/dev/null 2>&1); then
:
else
$echo "copying selected object files to avoid basename conflicts..."
if test -z "$gentop"; then
gentop="$output_objdir/${outputname}x"
generated="$generated $gentop"
$show "${rm}r $gentop"
$run ${rm}r "$gentop"
$show "$mkdir $gentop"
$run $mkdir "$gentop"
exit_status=$?
if test "$exit_status" -ne 0 && test ! -d "$gentop"; then
exit $exit_status
fi
fi
save_oldobjs=$oldobjs
oldobjs=
counter=1
for obj in $save_oldobjs
do
objbase=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
case " $oldobjs " in
" ") oldobjs=$obj ;;
*[\ /]"$objbase "*)
while :; do
# Make sure we don't pick an alternate name that also
# overlaps.
newobj=lt$counter-$objbase
counter=`expr $counter + 1`
case " $oldobjs " in
*[\ /]"$newobj "*) ;;
*) if test ! -f "$gentop/$newobj"; then break; fi ;;
esac
done
$show "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj"
$run ln "$obj" "$gentop/$newobj" ||
$run cp "$obj" "$gentop/$newobj"
oldobjs="$oldobjs $gentop/$newobj"
;;
*) oldobjs="$oldobjs $obj" ;;
esac
done
fi
eval cmds=\"$old_archive_cmds\" eval cmds=\"$old_archive_cmds\"
if len=`expr "X$cmds" : ".*"` && if len=`expr "X$cmds" : ".*"` &&
...@@ -5101,20 +5567,7 @@ fi\ ...@@ -5101,20 +5567,7 @@ fi\
objlist= objlist=
concat_cmds= concat_cmds=
save_oldobjs=$oldobjs save_oldobjs=$oldobjs
# GNU ar 2.10+ was changed to match POSIX; thus no paths are
# encoded into archives. This makes 'ar r' malfunction in
# this piecewise linking case whenever conflicting object
# names appear in distinct ar calls; check, warn and compensate.
if (for obj in $save_oldobjs
do
$echo "X$obj" | $Xsed -e 's%^.*/%%'
done | sort | sort -uc >/dev/null 2>&1); then
:
else
$echo "$modename: warning: object name conflicts; overriding AR_FLAGS to 'cq'" 1>&2
$echo "$modename: warning: to ensure that POSIX-compatible ar will work" 1>&2
AR_FLAGS=cq
fi
# Is there a better way of finding the last object in the list? # Is there a better way of finding the last object in the list?
for obj in $save_oldobjs for obj in $save_oldobjs
do do
...@@ -5125,7 +5578,7 @@ fi\ ...@@ -5125,7 +5578,7 @@ fi\
oldobjs="$objlist $obj" oldobjs="$objlist $obj"
objlist="$objlist $obj" objlist="$objlist $obj"
eval test_cmds=\"$old_archive_cmds\" eval test_cmds=\"$old_archive_cmds\"
if len=`expr "X$test_cmds" : ".*"` && if len=`expr "X$test_cmds" : ".*" 2>/dev/null` &&
test "$len" -le "$max_cmd_len"; then test "$len" -le "$max_cmd_len"; then
: :
else else
...@@ -5322,11 +5775,11 @@ relink_command=\"$relink_command\"" ...@@ -5322,11 +5775,11 @@ relink_command=\"$relink_command\""
# install_prog (especially on Windows NT). # install_prog (especially on Windows NT).
if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh || if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh ||
# Allow the use of GNU shtool's install command. # Allow the use of GNU shtool's install command.
$echo "X$nonopt" | $Xsed | grep shtool > /dev/null; then $echo "X$nonopt" | grep shtool > /dev/null; then
# Aesthetically quote it. # Aesthetically quote it.
arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"` arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"`
case $arg in case $arg in
*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*) *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
arg="\"$arg\"" arg="\"$arg\""
;; ;;
esac esac
...@@ -5335,14 +5788,14 @@ relink_command=\"$relink_command\"" ...@@ -5335,14 +5788,14 @@ relink_command=\"$relink_command\""
shift shift
else else
install_prog= install_prog=
arg="$nonopt" arg=$nonopt
fi fi
# The real first argument should be the name of the installation program. # The real first argument should be the name of the installation program.
# Aesthetically quote it. # Aesthetically quote it.
arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
case $arg in case $arg in
*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*) *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
arg="\"$arg\"" arg="\"$arg\""
;; ;;
esac esac
...@@ -5360,28 +5813,31 @@ relink_command=\"$relink_command\"" ...@@ -5360,28 +5813,31 @@ relink_command=\"$relink_command\""
do do
if test -n "$dest"; then if test -n "$dest"; then
files="$files $dest" files="$files $dest"
dest="$arg" dest=$arg
continue continue
fi fi
case $arg in case $arg in
-d) isdir=yes ;; -d) isdir=yes ;;
-f) prev="-f" ;; -f)
-g) prev="-g" ;; case " $install_prog " in
-m) prev="-m" ;; *[\\\ /]cp\ *) ;;
-o) prev="-o" ;; *) prev=$arg ;;
esac
;;
-g | -m | -o) prev=$arg ;;
-s) -s)
stripme=" -s" stripme=" -s"
continue continue
;; ;;
-*) ;; -*)
;;
*) *)
# If the previous option needed an argument, then skip it. # If the previous option needed an argument, then skip it.
if test -n "$prev"; then if test -n "$prev"; then
prev= prev=
else else
dest="$arg" dest=$arg
continue continue
fi fi
;; ;;
...@@ -5390,7 +5846,7 @@ relink_command=\"$relink_command\"" ...@@ -5390,7 +5846,7 @@ relink_command=\"$relink_command\""
# Aesthetically quote the argument. # Aesthetically quote the argument.
arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
case $arg in case $arg in
*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*) *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
arg="\"$arg\"" arg="\"$arg\""
;; ;;
esac esac
...@@ -5559,11 +6015,14 @@ relink_command=\"$relink_command\"" ...@@ -5559,11 +6015,14 @@ relink_command=\"$relink_command\""
if test "$#" -gt 0; then if test "$#" -gt 0; then
# Delete the old symlinks, and create new ones. # Delete the old symlinks, and create new ones.
# Try `ln -sf' first, because the `ln' binary might depend on
# the symlink we replace! Solaris /bin/ln does not understand -f,
# so we also need to try rm && ln -s.
for linkname for linkname
do do
if test "$linkname" != "$realname"; then if test "$linkname" != "$realname"; then
$show "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)" $show "(cd $destdir && { $LN_S -f $realname $linkname || { $rm $linkname && $LN_S $realname $linkname; }; })"
$run eval "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)" $run eval "(cd $destdir && { $LN_S -f $realname $linkname || { $rm $linkname && $LN_S $realname $linkname; }; })"
fi fi
done done
fi fi
...@@ -5576,7 +6035,16 @@ relink_command=\"$relink_command\"" ...@@ -5576,7 +6035,16 @@ relink_command=\"$relink_command\""
IFS="$save_ifs" IFS="$save_ifs"
eval cmd=\"$cmd\" eval cmd=\"$cmd\"
$show "$cmd" $show "$cmd"
$run eval "$cmd" || exit $? $run eval "$cmd" || {
lt_exit=$?
# Restore the uninstalled library and exit
if test "$mode" = relink; then
$run eval '(cd $output_objdir && $rm ${realname}T && $mv ${realname}U $realname)'
fi
exit $lt_exit
}
done done
IFS="$save_ifs" IFS="$save_ifs"
fi fi
...@@ -5670,17 +6138,15 @@ relink_command=\"$relink_command\"" ...@@ -5670,17 +6138,15 @@ relink_command=\"$relink_command\""
notinst_deplibs= notinst_deplibs=
relink_command= relink_command=
# To insure that "foo" is sourced, and not "foo.exe", # Note that it is not necessary on cygwin/mingw to append a dot to
# finese the cygwin/MSYS system by explicitly sourcing "foo." # foo even if both foo and FILE.exe exist: automatic-append-.exe
# which disallows the automatic-append-.exe behavior. # behavior happens only for exec(3), not for open(2)! Also, sourcing
case $build in # `FILE.' does not work on cygwin managed mounts.
*cygwin* | *mingw*) wrapperdot=${wrapper}. ;; #
*) wrapperdot=${wrapper} ;;
esac
# If there is no directory component, then add one. # If there is no directory component, then add one.
case $file in case $wrapper in
*/* | *\\*) . ${wrapperdot} ;; */* | *\\*) . ${wrapper} ;;
*) . ./${wrapperdot} ;; *) . ./${wrapper} ;;
esac esac
# Check the variables that should have been set. # Check the variables that should have been set.
...@@ -5708,34 +6174,21 @@ relink_command=\"$relink_command\"" ...@@ -5708,34 +6174,21 @@ relink_command=\"$relink_command\""
done done
relink_command= relink_command=
# To insure that "foo" is sourced, and not "foo.exe", # Note that it is not necessary on cygwin/mingw to append a dot to
# finese the cygwin/MSYS system by explicitly sourcing "foo." # foo even if both foo and FILE.exe exist: automatic-append-.exe
# which disallows the automatic-append-.exe behavior. # behavior happens only for exec(3), not for open(2)! Also, sourcing
case $build in # `FILE.' does not work on cygwin managed mounts.
*cygwin* | *mingw*) wrapperdot=${wrapper}. ;; #
*) wrapperdot=${wrapper} ;;
esac
# If there is no directory component, then add one. # If there is no directory component, then add one.
case $file in case $wrapper in
*/* | *\\*) . ${wrapperdot} ;; */* | *\\*) . ${wrapper} ;;
*) . ./${wrapperdot} ;; *) . ./${wrapper} ;;
esac esac
outputname= outputname=
if test "$fast_install" = no && test -n "$relink_command"; then if test "$fast_install" = no && test -n "$relink_command"; then
if test "$finalize" = yes && test -z "$run"; then if test "$finalize" = yes && test -z "$run"; then
tmpdir="/tmp" tmpdir=`func_mktempdir`
test -n "$TMPDIR" && tmpdir="$TMPDIR"
tmpdir="$tmpdir/libtool-$$"
save_umask=`umask`
umask 0077
if $mkdir "$tmpdir"; then
umask $save_umask
else
umask $save_umask
$echo "$modename: error: cannot create temporary directory \`$tmpdir'" 1>&2
continue
fi
file=`$echo "X$file$stripped_ext" | $Xsed -e 's%^.*/%%'` file=`$echo "X$file$stripped_ext" | $Xsed -e 's%^.*/%%'`
outputname="$tmpdir/$file" outputname="$tmpdir/$file"
# Replace the output file specification. # Replace the output file specification.
...@@ -5759,7 +6212,7 @@ relink_command=\"$relink_command\"" ...@@ -5759,7 +6212,7 @@ relink_command=\"$relink_command\""
fi fi
# remove .exe since cygwin /usr/bin/install will append another # remove .exe since cygwin /usr/bin/install will append another
# one anyways # one anyway
case $install_prog,$host in case $install_prog,$host in
*/usr/bin/install*,*cygwin*) */usr/bin/install*,*cygwin*)
case $file:$destfile in case $file:$destfile in
...@@ -5859,7 +6312,7 @@ relink_command=\"$relink_command\"" ...@@ -5859,7 +6312,7 @@ relink_command=\"$relink_command\""
# Exit here if they wanted silent mode. # Exit here if they wanted silent mode.
test "$show" = : && exit $EXIT_SUCCESS test "$show" = : && exit $EXIT_SUCCESS
$echo "----------------------------------------------------------------------" $echo "X----------------------------------------------------------------------" | $Xsed
$echo "Libraries have been installed in:" $echo "Libraries have been installed in:"
for libdir in $libdirs; do for libdir in $libdirs; do
$echo " $libdir" $echo " $libdir"
...@@ -5892,7 +6345,7 @@ relink_command=\"$relink_command\"" ...@@ -5892,7 +6345,7 @@ relink_command=\"$relink_command\""
$echo $echo
$echo "See any operating system documentation about shared libraries for" $echo "See any operating system documentation about shared libraries for"
$echo "more information, such as the ld(1) and ld.so(8) manual pages." $echo "more information, such as the ld(1) and ld.so(8) manual pages."
$echo "----------------------------------------------------------------------" $echo "X----------------------------------------------------------------------" | $Xsed
exit $EXIT_SUCCESS exit $EXIT_SUCCESS
;; ;;
...@@ -6109,9 +6562,17 @@ relink_command=\"$relink_command\"" ...@@ -6109,9 +6562,17 @@ relink_command=\"$relink_command\""
rmfiles="$rmfiles $objdir/$n" rmfiles="$rmfiles $objdir/$n"
done done
test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library" test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library"
test "$mode" = clean && rmfiles="$rmfiles $objdir/$name $objdir/${name}i"
if test "$mode" = uninstall; then case "$mode" in
clean)
case " $library_names " in
# " " in the beginning catches empty $dlname
*" $dlname "*) ;;
*) rmfiles="$rmfiles $objdir/$dlname" ;;
esac
test -n "$libdir" && rmfiles="$rmfiles $objdir/$name $objdir/${name}i"
;;
uninstall)
if test -n "$library_names"; then if test -n "$library_names"; then
# Do each command in the postuninstall commands. # Do each command in the postuninstall commands.
cmds=$postuninstall_cmds cmds=$postuninstall_cmds
...@@ -6144,7 +6605,8 @@ relink_command=\"$relink_command\"" ...@@ -6144,7 +6605,8 @@ relink_command=\"$relink_command\""
IFS="$save_ifs" IFS="$save_ifs"
fi fi
# FIXME: should reinstall the best remaining shared library. # FIXME: should reinstall the best remaining shared library.
fi ;;
esac
fi fi
;; ;;
...@@ -6429,7 +6891,7 @@ esac ...@@ -6429,7 +6891,7 @@ esac
$echo $echo
$echo "Try \`$modename --help' for more information about other modes." $echo "Try \`$modename --help' for more information about other modes."
exit $EXIT_SUCCESS exit $?
# The TAGs below are defined such that we never get into a situation # The TAGs below are defined such that we never get into a situation
# in which we disable both kinds of libraries. Given conflicting # in which we disable both kinds of libraries. Given conflicting
...@@ -6443,12 +6905,11 @@ exit $EXIT_SUCCESS ...@@ -6443,12 +6905,11 @@ exit $EXIT_SUCCESS
# configuration. But we'll never go from static-only to shared-only. # configuration. But we'll never go from static-only to shared-only.
# ### BEGIN LIBTOOL TAG CONFIG: disable-shared # ### BEGIN LIBTOOL TAG CONFIG: disable-shared
build_libtool_libs=no disable_libs=shared
build_old_libs=yes
# ### END LIBTOOL TAG CONFIG: disable-shared # ### END LIBTOOL TAG CONFIG: disable-shared
# ### BEGIN LIBTOOL TAG CONFIG: disable-static # ### BEGIN LIBTOOL TAG CONFIG: disable-static
build_old_libs=`case $build_libtool_libs in yes) $echo no;; *) $echo yes;; esac` disable_libs=static
# ### END LIBTOOL TAG CONFIG: disable-static # ### END LIBTOOL TAG CONFIG: disable-static
# Local Variables: # Local Variables:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment